@ssgc/alert-console 2.2.6 → 2.2.7
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 +1223 -1219
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
import { jsx as i, jsxs as u, Fragment as xs } from "react/jsx-runtime";
|
|
2
2
|
import * as ce from "react";
|
|
3
|
-
import { useContext as
|
|
4
|
-
import { Select as
|
|
3
|
+
import { useContext as Cs, useMemo as ue, createContext as Is, useState as x, useEffect as fe, useRef as Ts } from "react";
|
|
4
|
+
import { Select as pe, Table as bt, Row as ge, Col as H, Input as Rs, Tag as Ze, Space as we, Tooltip as ks, Button as ye, Progress as Os, Dropdown as Ps, Typography as We, Spin as St, Checkbox as _e, Divider as He, TimePicker as Ft, Tabs as At, Card as lt, Steps as Es, Modal as Ds, Carousel as Fs } from "antd";
|
|
5
5
|
import { MessageOutlined as Ms, MailOutlined as Us, MoreOutlined as Ls, EditOutlined as $s, LeftOutlined as Bs, RightOutlined as js } from "@ant-design/icons";
|
|
6
6
|
import { toast as ne } from "react-toastify";
|
|
7
|
-
const Qs = "#FF3B30", qs = "#FF9500", _s = "#FFCC00", Hs = "#34C759",
|
|
7
|
+
const Qs = "#FF3B30", qs = "#FF9500", _s = "#FFCC00", Hs = "#34C759", Ye = {
|
|
8
8
|
critical: Qs,
|
|
9
9
|
high: qs,
|
|
10
10
|
medium: _s,
|
|
11
11
|
low: Hs
|
|
12
|
-
},
|
|
13
|
-
Critical:
|
|
14
|
-
High:
|
|
15
|
-
Medium:
|
|
16
|
-
Low:
|
|
12
|
+
}, Mt = {
|
|
13
|
+
Critical: Ye.critical,
|
|
14
|
+
High: Ye.high,
|
|
15
|
+
Medium: Ye.medium,
|
|
16
|
+
Low: Ye.low
|
|
17
17
|
};
|
|
18
18
|
function Gs(e) {
|
|
19
|
-
return
|
|
19
|
+
return Mt[e] || Mt.Low;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function Ut(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
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, d = Number.isFinite(o) ? o : 0, c = Number.isFinite(l) ? l : 0;
|
|
26
26
|
return h * 3600 + d * 60 + c;
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function ct(e) {
|
|
29
29
|
const t = e.thirdPartyIds ?? e.ThirdPartyIds ?? e.thirdPartyId ?? e.ThirdPartyId ?? "", s = Array.isArray(t) ? t.join(",") : String(t ?? "");
|
|
30
30
|
if (!s || !s.trim()) return [];
|
|
31
31
|
const r = s.split(",").map((o) => parseInt(String(o).trim(), 10)).filter((o) => Number.isFinite(o)), n = /* @__PURE__ */ new Set(), a = [];
|
|
@@ -33,9 +33,9 @@ function at(e) {
|
|
|
33
33
|
n.has(o) || (n.add(o), a.push(o));
|
|
34
34
|
}), a;
|
|
35
35
|
}
|
|
36
|
-
const
|
|
36
|
+
const rs = "", Ws = rs, Ys = "", Ks = "", Lt = {
|
|
37
37
|
snl: {
|
|
38
|
-
alerts:
|
|
38
|
+
alerts: rs,
|
|
39
39
|
rules: Ws
|
|
40
40
|
},
|
|
41
41
|
schools: {
|
|
@@ -43,7 +43,7 @@ const ss = "", Ws = ss, Ys = "", Ks = "", Ut = {
|
|
|
43
43
|
rules: Ks
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
|
-
function
|
|
46
|
+
function Ae(e, t) {
|
|
47
47
|
const s = (e || "").replace(/\/+$/, ""), r = t.startsWith("/") ? t : `/${t}`;
|
|
48
48
|
return `${s}${r}`;
|
|
49
49
|
}
|
|
@@ -55,14 +55,14 @@ function zs() {
|
|
|
55
55
|
return {};
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function Ke(e, t) {
|
|
59
59
|
if (!t) return e;
|
|
60
60
|
const s = new URL(e);
|
|
61
61
|
return Object.entries(t).forEach(([r, n]) => {
|
|
62
62
|
n != null && String(n).length > 0 && s.searchParams.set(r, String(n));
|
|
63
63
|
}), s.toString();
|
|
64
64
|
}
|
|
65
|
-
async function
|
|
65
|
+
async function Ne(e, t) {
|
|
66
66
|
const s = {
|
|
67
67
|
...t.headers,
|
|
68
68
|
...zs()
|
|
@@ -91,36 +91,36 @@ function Vs(e) {
|
|
|
91
91
|
};
|
|
92
92
|
return {
|
|
93
93
|
async listAlerts() {
|
|
94
|
-
const s =
|
|
94
|
+
const s = Ae(e.baseUrl, "/api/Alert"), r = await Ne(s, {
|
|
95
95
|
method: "GET",
|
|
96
96
|
headers: t
|
|
97
97
|
});
|
|
98
98
|
return Array.isArray(r) ? r : [];
|
|
99
99
|
},
|
|
100
100
|
async getAlertStatusList() {
|
|
101
|
-
const s =
|
|
101
|
+
const s = Ae(e.baseUrl, "/api/Alert/AlertStatusList"), r = await Ne(s, {
|
|
102
102
|
method: "GET",
|
|
103
103
|
headers: t
|
|
104
104
|
});
|
|
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 =
|
|
108
|
+
const r = Ae(e.baseUrl, "/Alerts/GetAlertsReport"), n = Ke(r, s), a = await Ne(n, {
|
|
109
109
|
method: "GET",
|
|
110
110
|
headers: t
|
|
111
111
|
});
|
|
112
112
|
return Array.isArray(a) ? a : [];
|
|
113
113
|
},
|
|
114
114
|
async updateAlertStatus(s) {
|
|
115
|
-
const r =
|
|
116
|
-
return
|
|
115
|
+
const r = Ae(e.baseUrl, "/api/Alert/status");
|
|
116
|
+
return Ne(r, {
|
|
117
117
|
method: "PUT",
|
|
118
118
|
headers: t,
|
|
119
119
|
body: JSON.stringify(s ?? {})
|
|
120
120
|
});
|
|
121
121
|
},
|
|
122
122
|
async getAdminSettings() {
|
|
123
|
-
const s =
|
|
123
|
+
const s = Ae(e.baseUrl, "/api/Alert/GetAdminSettings"), r = await Ne(s, {
|
|
124
124
|
method: "GET",
|
|
125
125
|
headers: t
|
|
126
126
|
});
|
|
@@ -131,20 +131,20 @@ function Vs(e) {
|
|
|
131
131
|
return null;
|
|
132
132
|
},
|
|
133
133
|
async setAdminSettings(s) {
|
|
134
|
-
const r =
|
|
134
|
+
const r = Ae(e.baseUrl, "/api/Alert/SetAdminSettings"), n = {
|
|
135
135
|
userId: 0,
|
|
136
136
|
isAdminSetting: !0,
|
|
137
137
|
sortBy: s?.sortBy ?? "",
|
|
138
138
|
groupBy: s?.groupBy ?? null
|
|
139
139
|
};
|
|
140
|
-
return
|
|
140
|
+
return Ne(r, {
|
|
141
141
|
method: "POST",
|
|
142
142
|
headers: t,
|
|
143
143
|
body: JSON.stringify(n)
|
|
144
144
|
});
|
|
145
145
|
},
|
|
146
146
|
async getPreferenceSettings() {
|
|
147
|
-
const s =
|
|
147
|
+
const s = Ae(e.baseUrl, "/api/Alert/GetPreferenceSettings"), r = await Ne(s, {
|
|
148
148
|
method: "GET",
|
|
149
149
|
headers: t
|
|
150
150
|
});
|
|
@@ -155,7 +155,7 @@ function Vs(e) {
|
|
|
155
155
|
return null;
|
|
156
156
|
},
|
|
157
157
|
async setPreferenceSettings(s) {
|
|
158
|
-
const r =
|
|
158
|
+
const r = Ae(e.baseUrl, "/api/Alert/SetPreferenceSettings"), n = await Ne(r, {
|
|
159
159
|
method: "POST",
|
|
160
160
|
headers: t,
|
|
161
161
|
body: JSON.stringify(s ?? {})
|
|
@@ -168,29 +168,29 @@ function Vs(e) {
|
|
|
168
168
|
};
|
|
169
169
|
},
|
|
170
170
|
async getAlertNotifications(s) {
|
|
171
|
-
const r =
|
|
171
|
+
const r = Ae(e.baseUrl, "/api/Alert/GetNotifications"), n = Ke(r, { alertId: s }), a = await Ne(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 =
|
|
179
|
-
return
|
|
178
|
+
const r = Ae(e.baseUrl, "/api/Alert/NotificationToFamilyMembers"), n = Ke(r, { alertId: s });
|
|
179
|
+
return Ne(n, {
|
|
180
180
|
method: "POST",
|
|
181
181
|
headers: t
|
|
182
182
|
});
|
|
183
183
|
},
|
|
184
184
|
async sendSMSorEmailNotifications(s, r, n) {
|
|
185
|
-
const a =
|
|
186
|
-
return
|
|
185
|
+
const a = Ae(e.baseUrl, "/api/Alert/SendSMSorEmailNotifications"), o = Ke(a, { alertId: s, isEmail: r, isSMS: n });
|
|
186
|
+
return Ne(o, {
|
|
187
187
|
method: "POST",
|
|
188
188
|
headers: t
|
|
189
189
|
});
|
|
190
190
|
}
|
|
191
191
|
};
|
|
192
192
|
}
|
|
193
|
-
function
|
|
193
|
+
function $t(e, t) {
|
|
194
194
|
const s = (e || "").replace(/\/+$/, ""), r = t.startsWith("/") ? t : `/${t}`;
|
|
195
195
|
return `${s}${r}`;
|
|
196
196
|
}
|
|
@@ -202,7 +202,7 @@ function Js() {
|
|
|
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
|
...Js()
|
|
@@ -228,25 +228,25 @@ function Xs(e) {
|
|
|
228
228
|
const t = {
|
|
229
229
|
"Content-Type": "application/json",
|
|
230
230
|
...e.headers || {}
|
|
231
|
-
}, s =
|
|
231
|
+
}, s = $t(e.baseUrl, "/api/Rules"), r = $t(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 ?? {})
|
|
@@ -257,301 +257,301 @@ function Xs(e) {
|
|
|
257
257
|
function Zs(e) {
|
|
258
258
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
259
259
|
}
|
|
260
|
-
var
|
|
260
|
+
var Xe = { exports: {} }, er = Xe.exports, Bt;
|
|
261
261
|
function tr() {
|
|
262
|
-
return
|
|
262
|
+
return Bt || (Bt = 1, (function(e, t) {
|
|
263
263
|
(function(s, r) {
|
|
264
264
|
e.exports = r();
|
|
265
265
|
})(er, (function() {
|
|
266
|
-
var s = 1e3, r = 6e4, n = 36e5, a = "millisecond", o = "second", l = "minute", h = "hour", d = "day", c = "week",
|
|
267
|
-
var
|
|
268
|
-
return "[" +
|
|
269
|
-
} }, B = function(
|
|
270
|
-
var
|
|
271
|
-
return !
|
|
272
|
-
}, U = { s: B, z: function(
|
|
273
|
-
var
|
|
274
|
-
return (
|
|
275
|
-
}, m: function
|
|
276
|
-
if (
|
|
277
|
-
var
|
|
278
|
-
return +(-(
|
|
279
|
-
}, a: function(
|
|
280
|
-
return
|
|
281
|
-
}, p: function(
|
|
282
|
-
return { M:
|
|
283
|
-
}, u: function(
|
|
284
|
-
return
|
|
285
|
-
} },
|
|
286
|
-
|
|
287
|
-
var
|
|
288
|
-
return
|
|
289
|
-
},
|
|
290
|
-
var
|
|
291
|
-
if (!
|
|
292
|
-
if (typeof
|
|
293
|
-
var
|
|
294
|
-
|
|
295
|
-
var
|
|
296
|
-
if (!
|
|
266
|
+
var s = 1e3, r = 6e4, n = 36e5, a = "millisecond", o = "second", l = "minute", h = "hour", d = "day", c = "week", A = "month", f = "quarter", k = "year", N = "date", y = "Invalid Date", b = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, $ = /\[([^\]]+)]|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, M = { 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(R) {
|
|
267
|
+
var v = ["th", "st", "nd", "rd"], m = R % 100;
|
|
268
|
+
return "[" + R + (v[(m - 20) % 10] || v[m] || v[0]) + "]";
|
|
269
|
+
} }, B = function(R, v, m) {
|
|
270
|
+
var w = String(R);
|
|
271
|
+
return !w || w.length >= v ? R : "" + Array(v + 1 - w.length).join(m) + R;
|
|
272
|
+
}, U = { s: B, z: function(R) {
|
|
273
|
+
var v = -R.utcOffset(), m = Math.abs(v), w = Math.floor(m / 60), p = m % 60;
|
|
274
|
+
return (v <= 0 ? "+" : "-") + B(w, 2, "0") + ":" + B(p, 2, "0");
|
|
275
|
+
}, m: function R(v, m) {
|
|
276
|
+
if (v.date() < m.date()) return -R(m, v);
|
|
277
|
+
var w = 12 * (m.year() - v.year()) + (m.month() - v.month()), p = v.clone().add(w, A), g = m - p < 0, S = v.clone().add(w + (g ? -1 : 1), A);
|
|
278
|
+
return +(-(w + (m - p) / (g ? p - S : S - p)) || 0);
|
|
279
|
+
}, a: function(R) {
|
|
280
|
+
return R < 0 ? Math.ceil(R) || 0 : Math.floor(R);
|
|
281
|
+
}, p: function(R) {
|
|
282
|
+
return { M: A, y: k, w: c, d, D: N, h, m: l, s: o, ms: a, Q: f }[R] || String(R || "").toLowerCase().replace(/s$/, "");
|
|
283
|
+
}, u: function(R) {
|
|
284
|
+
return R === void 0;
|
|
285
|
+
} }, V = "en", K = {};
|
|
286
|
+
K[V] = M;
|
|
287
|
+
var W = "$isDayjsObject", Y = function(R) {
|
|
288
|
+
return R instanceof Z || !(!R || !R[W]);
|
|
289
|
+
}, I = function R(v, m, w) {
|
|
290
|
+
var p;
|
|
291
|
+
if (!v) return V;
|
|
292
|
+
if (typeof v == "string") {
|
|
293
|
+
var g = v.toLowerCase();
|
|
294
|
+
K[g] && (p = g), m && (K[g] = m, p = g);
|
|
295
|
+
var S = v.split("-");
|
|
296
|
+
if (!p && S.length > 1) return R(S[0]);
|
|
297
297
|
} else {
|
|
298
|
-
var
|
|
299
|
-
|
|
298
|
+
var O = v.name;
|
|
299
|
+
K[O] = v, p = O;
|
|
300
300
|
}
|
|
301
|
-
return !
|
|
302
|
-
},
|
|
303
|
-
if (
|
|
304
|
-
var m = typeof
|
|
305
|
-
return m.date =
|
|
306
|
-
},
|
|
307
|
-
|
|
308
|
-
return
|
|
301
|
+
return !w && p && (V = p), p || !w && V;
|
|
302
|
+
}, C = function(R, v) {
|
|
303
|
+
if (Y(R)) return R.clone();
|
|
304
|
+
var m = typeof v == "object" ? v : {};
|
|
305
|
+
return m.date = R, m.args = arguments, new Z(m);
|
|
306
|
+
}, T = U;
|
|
307
|
+
T.l = I, T.i = Y, T.w = function(R, v) {
|
|
308
|
+
return C(R, { locale: v.$L, utc: v.$u, x: v.$x, $offset: v.$offset });
|
|
309
309
|
};
|
|
310
|
-
var
|
|
311
|
-
function
|
|
312
|
-
this.$L =
|
|
310
|
+
var Z = (function() {
|
|
311
|
+
function R(m) {
|
|
312
|
+
this.$L = I(m.locale, null, !0), this.parse(m), this.$x = this.$x || m.x || {}, this[W] = !0;
|
|
313
313
|
}
|
|
314
|
-
var
|
|
315
|
-
return
|
|
316
|
-
this.$d = (function(
|
|
317
|
-
var
|
|
318
|
-
if (
|
|
319
|
-
if (
|
|
320
|
-
if (
|
|
321
|
-
if (typeof
|
|
322
|
-
var
|
|
323
|
-
if (
|
|
324
|
-
var
|
|
325
|
-
return
|
|
314
|
+
var v = R.prototype;
|
|
315
|
+
return v.parse = function(m) {
|
|
316
|
+
this.$d = (function(w) {
|
|
317
|
+
var p = w.date, g = w.utc;
|
|
318
|
+
if (p === null) return /* @__PURE__ */ new Date(NaN);
|
|
319
|
+
if (T.u(p)) return /* @__PURE__ */ new Date();
|
|
320
|
+
if (p instanceof Date) return new Date(p);
|
|
321
|
+
if (typeof p == "string" && !/Z$/i.test(p)) {
|
|
322
|
+
var S = p.match(b);
|
|
323
|
+
if (S) {
|
|
324
|
+
var O = S[2] - 1 || 0, L = (S[7] || "0").substring(0, 3);
|
|
325
|
+
return g ? new Date(Date.UTC(S[1], O, S[3] || 1, S[4] || 0, S[5] || 0, S[6] || 0, L)) : new Date(S[1], O, S[3] || 1, S[4] || 0, S[5] || 0, S[6] || 0, L);
|
|
326
326
|
}
|
|
327
327
|
}
|
|
328
|
-
return new Date(
|
|
328
|
+
return new Date(p);
|
|
329
329
|
})(m), this.init();
|
|
330
|
-
},
|
|
330
|
+
}, v.init = function() {
|
|
331
331
|
var m = this.$d;
|
|
332
332
|
this.$y = m.getFullYear(), this.$M = m.getMonth(), this.$D = m.getDate(), this.$W = m.getDay(), this.$H = m.getHours(), this.$m = m.getMinutes(), this.$s = m.getSeconds(), this.$ms = m.getMilliseconds();
|
|
333
|
-
},
|
|
334
|
-
return
|
|
335
|
-
},
|
|
336
|
-
return this.$d.toString() !==
|
|
337
|
-
},
|
|
338
|
-
var
|
|
339
|
-
return this.startOf(
|
|
340
|
-
},
|
|
341
|
-
return
|
|
342
|
-
},
|
|
343
|
-
return this.endOf(
|
|
344
|
-
},
|
|
345
|
-
return
|
|
346
|
-
},
|
|
333
|
+
}, v.$utils = function() {
|
|
334
|
+
return T;
|
|
335
|
+
}, v.isValid = function() {
|
|
336
|
+
return this.$d.toString() !== y;
|
|
337
|
+
}, v.isSame = function(m, w) {
|
|
338
|
+
var p = C(m);
|
|
339
|
+
return this.startOf(w) <= p && p <= this.endOf(w);
|
|
340
|
+
}, v.isAfter = function(m, w) {
|
|
341
|
+
return C(m) < this.startOf(w);
|
|
342
|
+
}, v.isBefore = function(m, w) {
|
|
343
|
+
return this.endOf(w) < C(m);
|
|
344
|
+
}, v.$g = function(m, w, p) {
|
|
345
|
+
return T.u(m) ? this[w] : this.set(p, m);
|
|
346
|
+
}, v.unix = function() {
|
|
347
347
|
return Math.floor(this.valueOf() / 1e3);
|
|
348
|
-
},
|
|
348
|
+
}, v.valueOf = function() {
|
|
349
349
|
return this.$d.getTime();
|
|
350
|
-
},
|
|
351
|
-
var
|
|
352
|
-
var
|
|
353
|
-
return
|
|
354
|
-
},
|
|
355
|
-
return
|
|
350
|
+
}, v.startOf = function(m, w) {
|
|
351
|
+
var p = this, g = !!T.u(w) || w, S = T.p(m), O = function(de, re) {
|
|
352
|
+
var ae = T.w(p.$u ? Date.UTC(p.$y, re, de) : new Date(p.$y, re, de), p);
|
|
353
|
+
return g ? ae : ae.endOf(d);
|
|
354
|
+
}, L = function(de, re) {
|
|
355
|
+
return T.w(p.toDate()[de].apply(p.toDate("s"), (g ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(re)), p);
|
|
356
356
|
}, D = this.$W, j = this.$M, Q = this.$D, z = "set" + (this.$u ? "UTC" : "");
|
|
357
|
-
switch (
|
|
358
|
-
case
|
|
359
|
-
return
|
|
360
|
-
case
|
|
361
|
-
return
|
|
357
|
+
switch (S) {
|
|
358
|
+
case k:
|
|
359
|
+
return g ? O(1, 0) : O(31, 11);
|
|
360
|
+
case A:
|
|
361
|
+
return g ? O(1, j) : O(0, j + 1);
|
|
362
362
|
case c:
|
|
363
|
-
var ie = this.$locale().weekStart || 0,
|
|
364
|
-
return
|
|
363
|
+
var ie = this.$locale().weekStart || 0, me = (D < ie ? D + 7 : D) - ie;
|
|
364
|
+
return O(g ? Q - me : Q + (6 - me), j);
|
|
365
365
|
case d:
|
|
366
|
-
case
|
|
367
|
-
return
|
|
366
|
+
case N:
|
|
367
|
+
return L(z + "Hours", 0);
|
|
368
368
|
case h:
|
|
369
|
-
return
|
|
369
|
+
return L(z + "Minutes", 1);
|
|
370
370
|
case l:
|
|
371
|
-
return
|
|
371
|
+
return L(z + "Seconds", 2);
|
|
372
372
|
case o:
|
|
373
|
-
return
|
|
373
|
+
return L(z + "Milliseconds", 3);
|
|
374
374
|
default:
|
|
375
375
|
return this.clone();
|
|
376
376
|
}
|
|
377
|
-
},
|
|
377
|
+
}, v.endOf = function(m) {
|
|
378
378
|
return this.startOf(m, !1);
|
|
379
|
-
},
|
|
380
|
-
var
|
|
381
|
-
if (
|
|
382
|
-
var D = this.clone().set(
|
|
383
|
-
D.$d[
|
|
384
|
-
} else
|
|
379
|
+
}, v.$set = function(m, w) {
|
|
380
|
+
var p, g = T.p(m), S = "set" + (this.$u ? "UTC" : ""), O = (p = {}, p[d] = S + "Date", p[N] = S + "Date", p[A] = S + "Month", p[k] = S + "FullYear", p[h] = S + "Hours", p[l] = S + "Minutes", p[o] = S + "Seconds", p[a] = S + "Milliseconds", p)[g], L = g === d ? this.$D + (w - this.$W) : w;
|
|
381
|
+
if (g === A || g === k) {
|
|
382
|
+
var D = this.clone().set(N, 1);
|
|
383
|
+
D.$d[O](L), D.init(), this.$d = D.set(N, Math.min(this.$D, D.daysInMonth())).$d;
|
|
384
|
+
} else O && this.$d[O](L);
|
|
385
385
|
return this.init(), this;
|
|
386
|
-
},
|
|
387
|
-
return this.clone().$set(m,
|
|
388
|
-
},
|
|
389
|
-
return this[
|
|
390
|
-
},
|
|
391
|
-
var
|
|
386
|
+
}, v.set = function(m, w) {
|
|
387
|
+
return this.clone().$set(m, w);
|
|
388
|
+
}, v.get = function(m) {
|
|
389
|
+
return this[T.p(m)]();
|
|
390
|
+
}, v.add = function(m, w) {
|
|
391
|
+
var p, g = this;
|
|
392
392
|
m = Number(m);
|
|
393
|
-
var
|
|
394
|
-
var Q =
|
|
395
|
-
return
|
|
393
|
+
var S = T.p(w), O = function(j) {
|
|
394
|
+
var Q = C(g);
|
|
395
|
+
return T.w(Q.date(Q.date() + Math.round(j * m)), g);
|
|
396
396
|
};
|
|
397
|
-
if (
|
|
398
|
-
if (
|
|
399
|
-
if (
|
|
400
|
-
if (
|
|
401
|
-
var
|
|
402
|
-
return
|
|
403
|
-
},
|
|
404
|
-
return this.add(-1 * m,
|
|
405
|
-
},
|
|
406
|
-
var
|
|
407
|
-
if (!this.isValid()) return
|
|
408
|
-
var
|
|
409
|
-
return re && (re[
|
|
410
|
-
},
|
|
411
|
-
return
|
|
412
|
-
},
|
|
413
|
-
var
|
|
414
|
-
return
|
|
397
|
+
if (S === A) return this.set(A, this.$M + m);
|
|
398
|
+
if (S === k) return this.set(k, this.$y + m);
|
|
399
|
+
if (S === d) return O(1);
|
|
400
|
+
if (S === c) return O(7);
|
|
401
|
+
var L = (p = {}, p[l] = r, p[h] = n, p[o] = s, p)[S] || 1, D = this.$d.getTime() + m * L;
|
|
402
|
+
return T.w(D, this);
|
|
403
|
+
}, v.subtract = function(m, w) {
|
|
404
|
+
return this.add(-1 * m, w);
|
|
405
|
+
}, v.format = function(m) {
|
|
406
|
+
var w = this, p = this.$locale();
|
|
407
|
+
if (!this.isValid()) return p.invalidDate || y;
|
|
408
|
+
var g = m || "YYYY-MM-DDTHH:mm:ssZ", S = T.z(this), O = this.$H, L = this.$m, D = this.$M, j = p.weekdays, Q = p.months, z = p.meridiem, ie = function(re, ae, be, Se) {
|
|
409
|
+
return re && (re[ae] || re(w, g)) || be[ae].slice(0, Se);
|
|
410
|
+
}, me = function(re) {
|
|
411
|
+
return T.s(O % 12 || 12, re, "0");
|
|
412
|
+
}, de = z || function(re, ae, be) {
|
|
413
|
+
var Se = re < 12 ? "AM" : "PM";
|
|
414
|
+
return be ? Se.toLowerCase() : Se;
|
|
415
415
|
};
|
|
416
|
-
return
|
|
417
|
-
return
|
|
418
|
-
switch (
|
|
416
|
+
return g.replace($, (function(re, ae) {
|
|
417
|
+
return ae || (function(be) {
|
|
418
|
+
switch (be) {
|
|
419
419
|
case "YY":
|
|
420
|
-
return String(
|
|
420
|
+
return String(w.$y).slice(-2);
|
|
421
421
|
case "YYYY":
|
|
422
|
-
return
|
|
422
|
+
return T.s(w.$y, 4, "0");
|
|
423
423
|
case "M":
|
|
424
424
|
return D + 1;
|
|
425
425
|
case "MM":
|
|
426
|
-
return
|
|
426
|
+
return T.s(D + 1, 2, "0");
|
|
427
427
|
case "MMM":
|
|
428
|
-
return ie(
|
|
428
|
+
return ie(p.monthsShort, D, Q, 3);
|
|
429
429
|
case "MMMM":
|
|
430
430
|
return ie(Q, D);
|
|
431
431
|
case "D":
|
|
432
|
-
return
|
|
432
|
+
return w.$D;
|
|
433
433
|
case "DD":
|
|
434
|
-
return
|
|
434
|
+
return T.s(w.$D, 2, "0");
|
|
435
435
|
case "d":
|
|
436
|
-
return String(
|
|
436
|
+
return String(w.$W);
|
|
437
437
|
case "dd":
|
|
438
|
-
return ie(
|
|
438
|
+
return ie(p.weekdaysMin, w.$W, j, 2);
|
|
439
439
|
case "ddd":
|
|
440
|
-
return ie(
|
|
440
|
+
return ie(p.weekdaysShort, w.$W, j, 3);
|
|
441
441
|
case "dddd":
|
|
442
|
-
return j[
|
|
442
|
+
return j[w.$W];
|
|
443
443
|
case "H":
|
|
444
|
-
return String(
|
|
444
|
+
return String(O);
|
|
445
445
|
case "HH":
|
|
446
|
-
return
|
|
446
|
+
return T.s(O, 2, "0");
|
|
447
447
|
case "h":
|
|
448
|
-
return
|
|
448
|
+
return me(1);
|
|
449
449
|
case "hh":
|
|
450
|
-
return
|
|
450
|
+
return me(2);
|
|
451
451
|
case "a":
|
|
452
|
-
return
|
|
452
|
+
return de(O, L, !0);
|
|
453
453
|
case "A":
|
|
454
|
-
return
|
|
454
|
+
return de(O, L, !1);
|
|
455
455
|
case "m":
|
|
456
|
-
return String(
|
|
456
|
+
return String(L);
|
|
457
457
|
case "mm":
|
|
458
|
-
return
|
|
458
|
+
return T.s(L, 2, "0");
|
|
459
459
|
case "s":
|
|
460
|
-
return String(
|
|
460
|
+
return String(w.$s);
|
|
461
461
|
case "ss":
|
|
462
|
-
return
|
|
462
|
+
return T.s(w.$s, 2, "0");
|
|
463
463
|
case "SSS":
|
|
464
|
-
return
|
|
464
|
+
return T.s(w.$ms, 3, "0");
|
|
465
465
|
case "Z":
|
|
466
|
-
return
|
|
466
|
+
return S;
|
|
467
467
|
}
|
|
468
468
|
return null;
|
|
469
|
-
})(re) ||
|
|
469
|
+
})(re) || S.replace(":", "");
|
|
470
470
|
}));
|
|
471
|
-
},
|
|
471
|
+
}, v.utcOffset = function() {
|
|
472
472
|
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
|
|
473
|
-
},
|
|
474
|
-
var
|
|
475
|
-
return
|
|
473
|
+
}, v.diff = function(m, w, p) {
|
|
474
|
+
var g, S = this, O = T.p(w), L = C(m), D = (L.utcOffset() - this.utcOffset()) * r, j = this - L, Q = function() {
|
|
475
|
+
return T.m(S, L);
|
|
476
476
|
};
|
|
477
|
-
switch (
|
|
478
|
-
case
|
|
479
|
-
|
|
477
|
+
switch (O) {
|
|
478
|
+
case k:
|
|
479
|
+
g = Q() / 12;
|
|
480
480
|
break;
|
|
481
|
-
case
|
|
482
|
-
|
|
481
|
+
case A:
|
|
482
|
+
g = Q();
|
|
483
483
|
break;
|
|
484
484
|
case f:
|
|
485
|
-
|
|
485
|
+
g = Q() / 3;
|
|
486
486
|
break;
|
|
487
487
|
case c:
|
|
488
|
-
|
|
488
|
+
g = (j - D) / 6048e5;
|
|
489
489
|
break;
|
|
490
490
|
case d:
|
|
491
|
-
|
|
491
|
+
g = (j - D) / 864e5;
|
|
492
492
|
break;
|
|
493
493
|
case h:
|
|
494
|
-
|
|
494
|
+
g = j / n;
|
|
495
495
|
break;
|
|
496
496
|
case l:
|
|
497
|
-
|
|
497
|
+
g = j / r;
|
|
498
498
|
break;
|
|
499
499
|
case o:
|
|
500
|
-
|
|
500
|
+
g = j / s;
|
|
501
501
|
break;
|
|
502
502
|
default:
|
|
503
|
-
|
|
503
|
+
g = j;
|
|
504
504
|
}
|
|
505
|
-
return
|
|
506
|
-
},
|
|
507
|
-
return this.endOf(
|
|
508
|
-
},
|
|
509
|
-
return
|
|
510
|
-
},
|
|
505
|
+
return p ? g : T.a(g);
|
|
506
|
+
}, v.daysInMonth = function() {
|
|
507
|
+
return this.endOf(A).$D;
|
|
508
|
+
}, v.$locale = function() {
|
|
509
|
+
return K[this.$L];
|
|
510
|
+
}, v.locale = function(m, w) {
|
|
511
511
|
if (!m) return this.$L;
|
|
512
|
-
var
|
|
513
|
-
return
|
|
514
|
-
},
|
|
515
|
-
return
|
|
516
|
-
},
|
|
512
|
+
var p = this.clone(), g = I(m, w, !0);
|
|
513
|
+
return g && (p.$L = g), p;
|
|
514
|
+
}, v.clone = function() {
|
|
515
|
+
return T.w(this.$d, this);
|
|
516
|
+
}, v.toDate = function() {
|
|
517
517
|
return new Date(this.valueOf());
|
|
518
|
-
},
|
|
518
|
+
}, v.toJSON = function() {
|
|
519
519
|
return this.isValid() ? this.toISOString() : null;
|
|
520
|
-
},
|
|
520
|
+
}, v.toISOString = function() {
|
|
521
521
|
return this.$d.toISOString();
|
|
522
|
-
},
|
|
522
|
+
}, v.toString = function() {
|
|
523
523
|
return this.$d.toUTCString();
|
|
524
|
-
},
|
|
525
|
-
})(),
|
|
526
|
-
return
|
|
527
|
-
|
|
528
|
-
return this.$g(
|
|
524
|
+
}, R;
|
|
525
|
+
})(), ee = Z.prototype;
|
|
526
|
+
return C.prototype = ee, [["$ms", a], ["$s", o], ["$m", l], ["$H", h], ["$W", d], ["$M", A], ["$y", k], ["$D", N]].forEach((function(R) {
|
|
527
|
+
ee[R[1]] = function(v) {
|
|
528
|
+
return this.$g(v, R[0], R[1]);
|
|
529
529
|
};
|
|
530
|
-
})),
|
|
531
|
-
return
|
|
532
|
-
},
|
|
533
|
-
return
|
|
534
|
-
},
|
|
530
|
+
})), C.extend = function(R, v) {
|
|
531
|
+
return R.$i || (R(v, Z, C), R.$i = !0), C;
|
|
532
|
+
}, C.locale = I, C.isDayjs = Y, C.unix = function(R) {
|
|
533
|
+
return C(1e3 * R);
|
|
534
|
+
}, C.en = K[V], C.Ls = K, C.p = {}, C;
|
|
535
535
|
}));
|
|
536
|
-
})(
|
|
536
|
+
})(Xe)), Xe.exports;
|
|
537
537
|
}
|
|
538
538
|
var sr = tr();
|
|
539
|
-
const
|
|
540
|
-
function
|
|
539
|
+
const ns = /* @__PURE__ */ Zs(sr);
|
|
540
|
+
function is(e) {
|
|
541
541
|
if (!e) return "By Severity";
|
|
542
542
|
const t = e.trim().toLowerCase();
|
|
543
543
|
return t.includes("created") ? "By Created Date" : t.includes("updated") || t.includes("modified") ? "By Updated Date" : "By Severity";
|
|
544
544
|
}
|
|
545
|
-
function
|
|
545
|
+
function as(e) {
|
|
546
546
|
if (!e || typeof e != "string") return { hours: 0, minutes: 0, seconds: 0 };
|
|
547
547
|
const t = e.split(":").map((a) => parseInt(a, 10)), s = Number.isFinite(t[0]) ? t[0] : 0, r = Number.isFinite(t[1]) ? t[1] : 0, n = Number.isFinite(t[2]) ? t[2] : 0;
|
|
548
548
|
return { hours: s, minutes: r, seconds: n };
|
|
549
549
|
}
|
|
550
|
-
function
|
|
551
|
-
const { hours: t, minutes: s, seconds: r } =
|
|
552
|
-
return
|
|
550
|
+
function jt(e) {
|
|
551
|
+
const { hours: t, minutes: s, seconds: r } = as(e);
|
|
552
|
+
return ns().hour(t).minute(s).second(r).millisecond(0);
|
|
553
553
|
}
|
|
554
|
-
function
|
|
554
|
+
function ke(e, t) {
|
|
555
555
|
const s = (e || "").replace(/\/+$/, ""), r = t.startsWith("/") ? t : `/${t}`;
|
|
556
556
|
return `${s}${r}`;
|
|
557
557
|
}
|
|
@@ -563,14 +563,14 @@ function rr() {
|
|
|
563
563
|
return {};
|
|
564
564
|
}
|
|
565
565
|
}
|
|
566
|
-
function
|
|
566
|
+
function Qt(e, t) {
|
|
567
567
|
if (!t) return e;
|
|
568
568
|
const s = new URL(e);
|
|
569
569
|
return Object.entries(t).forEach(([r, n]) => {
|
|
570
570
|
n != null && String(n).length > 0 && s.searchParams.set(r, String(n));
|
|
571
571
|
}), s.toString();
|
|
572
572
|
}
|
|
573
|
-
async function
|
|
573
|
+
async function Oe(e, t) {
|
|
574
574
|
const s = {
|
|
575
575
|
...t.headers,
|
|
576
576
|
...rr()
|
|
@@ -592,28 +592,28 @@ async function Ie(e, t) {
|
|
|
592
592
|
}
|
|
593
593
|
return a;
|
|
594
594
|
}
|
|
595
|
-
const
|
|
595
|
+
const le = (...e) => e.find((t) => t != null);
|
|
596
596
|
function nr(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(le(e?.AlertId, e?.alertId) ?? ""),
|
|
600
|
+
priority: le(e?.Priority, e?.priority, "Low"),
|
|
601
|
+
timestamp: le(e?.Timestamp, e?.timestamp, ""),
|
|
602
|
+
statusType: le(e?.Status, e?.statusType, ""),
|
|
603
|
+
description: le(e?.Description, e?.description, ""),
|
|
604
|
+
eventName: le(e?.EventName, e?.eventName),
|
|
605
|
+
ruleName: le(e?.RuleName, e?.ruleName),
|
|
606
|
+
spaceName: le(e?.SpaceName, e?.spaceName),
|
|
607
|
+
assignTeam: le(e?.AssignTeam, e?.assignTeam),
|
|
608
|
+
cameraName: le(e?.CameraName, e?.cameraName),
|
|
609
|
+
type: le(e?.Type, e?.type),
|
|
610
|
+
mediaDetails: le(e?.MediaDetails, e?.mediaDetails),
|
|
611
|
+
additionalMedia: le(e?.AdditionalMedia, e?.additionalMedia),
|
|
612
|
+
timeElapsed: le(e?.TimeElapsed, e?.timeElapsed),
|
|
613
|
+
timeRemaining: le(e?.TimeRemaining, e?.timeRemaining),
|
|
614
|
+
anomalyName: le(e?.AnomalyName, e?.anomalyName),
|
|
615
|
+
alertDetails: le(e?.AlertDetails, e?.alertDetails),
|
|
616
|
+
statusHistory: le(e?.StatusHistory, e?.statusHistory)
|
|
617
617
|
};
|
|
618
618
|
}
|
|
619
619
|
function ir(e) {
|
|
@@ -623,40 +623,40 @@ function ir(e) {
|
|
|
623
623
|
};
|
|
624
624
|
return {
|
|
625
625
|
async listAlerts() {
|
|
626
|
-
const s =
|
|
626
|
+
const s = ke(e.baseUrl, "/api/detectionpolicy/alerts?customerId=99e5c8b5-b9d4-4d35-8885-7f121c532664"), r = await Oe(s, {
|
|
627
627
|
method: "GET",
|
|
628
628
|
headers: t
|
|
629
629
|
});
|
|
630
630
|
return Array.isArray(r?.Items) ? (r?.Items).map(nr) : [];
|
|
631
631
|
},
|
|
632
632
|
async getAlertStatusList() {
|
|
633
|
-
const s =
|
|
633
|
+
const s = ke(e.baseUrl, "/api/detectionpolicy/alerts/StatusList"), r = await Oe(s, {
|
|
634
634
|
method: "GET",
|
|
635
635
|
headers: t
|
|
636
636
|
});
|
|
637
637
|
return Array.isArray(r) ? r : [];
|
|
638
638
|
},
|
|
639
639
|
async getAlertsReport(s) {
|
|
640
|
-
const r =
|
|
640
|
+
const r = ke(e.baseUrl, "/api/detectionpolicy/alerts/GetAlertsReport"), n = Qt(r, s), a = await Oe(n, {
|
|
641
641
|
method: "GET",
|
|
642
642
|
headers: t
|
|
643
643
|
});
|
|
644
644
|
return Array.isArray(a) ? a : [];
|
|
645
645
|
},
|
|
646
646
|
async updateAlertStatus(s) {
|
|
647
|
-
const r =
|
|
647
|
+
const r = ke(e.baseUrl, "/api/detectionpolicy/alerts/Log"), n = {
|
|
648
648
|
AlertId: s.alertId ?? s.alertUniqueId ?? s.AlertId,
|
|
649
649
|
Status: s.status ?? s.Status ?? "",
|
|
650
650
|
Notes: s.notes ?? s.Notes ?? ""
|
|
651
651
|
};
|
|
652
|
-
return
|
|
652
|
+
return Oe(r, {
|
|
653
653
|
method: "POST",
|
|
654
654
|
headers: t,
|
|
655
655
|
body: JSON.stringify(n)
|
|
656
656
|
});
|
|
657
657
|
},
|
|
658
658
|
async getAdminSettings() {
|
|
659
|
-
const s =
|
|
659
|
+
const s = ke(e.baseUrl, "/api/detectionpolicy/alerts/GetAdminSettings"), r = await Oe(s, {
|
|
660
660
|
method: "GET",
|
|
661
661
|
headers: t
|
|
662
662
|
});
|
|
@@ -667,19 +667,19 @@ function ir(e) {
|
|
|
667
667
|
return null;
|
|
668
668
|
},
|
|
669
669
|
async setAdminSettings(s) {
|
|
670
|
-
const r =
|
|
670
|
+
const r = ke(e.baseUrl, "/api/detectionpolicy/alerts/SetAdminSettings"), n = {
|
|
671
671
|
userId: 0,
|
|
672
672
|
isAdminSetting: !0,
|
|
673
673
|
sortBy: s?.sortBy ?? ""
|
|
674
674
|
};
|
|
675
|
-
return
|
|
675
|
+
return Oe(r, {
|
|
676
676
|
method: "POST",
|
|
677
677
|
headers: t,
|
|
678
678
|
body: JSON.stringify(n)
|
|
679
679
|
});
|
|
680
680
|
},
|
|
681
681
|
async getPreferenceSettings() {
|
|
682
|
-
const s =
|
|
682
|
+
const s = ke(e.baseUrl, "/api/detectionpolicy/alerts/GetPreferenceSettings"), r = await Oe(s, {
|
|
683
683
|
method: "GET",
|
|
684
684
|
headers: t
|
|
685
685
|
});
|
|
@@ -690,9 +690,9 @@ function ir(e) {
|
|
|
690
690
|
return null;
|
|
691
691
|
},
|
|
692
692
|
async setPreferenceSettings(s) {
|
|
693
|
-
const r =
|
|
694
|
-
const { hours: c, minutes:
|
|
695
|
-
return (c * 3600 +
|
|
693
|
+
const r = ke(e.baseUrl, "/api/detectionpolicy/alerts/SetPreferenceSettings"), n = (d) => {
|
|
694
|
+
const { hours: c, minutes: A, seconds: f } = as(d);
|
|
695
|
+
return (c * 3600 + A * 60 + f) * 1e7;
|
|
696
696
|
}, a = {
|
|
697
697
|
Settings: {
|
|
698
698
|
UserId: 0,
|
|
@@ -704,7 +704,7 @@ function ir(e) {
|
|
|
704
704
|
Email: !!s?.email,
|
|
705
705
|
SortBy: s?.sortBy ?? ""
|
|
706
706
|
}
|
|
707
|
-
}, o = await
|
|
707
|
+
}, o = await Oe(r, {
|
|
708
708
|
method: "POST",
|
|
709
709
|
headers: t,
|
|
710
710
|
body: JSON.stringify(a)
|
|
@@ -717,7 +717,7 @@ function ir(e) {
|
|
|
717
717
|
};
|
|
718
718
|
},
|
|
719
719
|
async getAlertNotifications(s) {
|
|
720
|
-
const r =
|
|
720
|
+
const r = ke(e.baseUrl, "/api/detectionpolicy/alerts/GetNotifications"), n = Qt(r, { alertId: s }), a = await Oe(n, {
|
|
721
721
|
method: "GET",
|
|
722
722
|
headers: t
|
|
723
723
|
});
|
|
@@ -733,7 +733,7 @@ function ar() {
|
|
|
733
733
|
return {};
|
|
734
734
|
}
|
|
735
735
|
}
|
|
736
|
-
async function
|
|
736
|
+
async function De(e, t) {
|
|
737
737
|
const s = {
|
|
738
738
|
...t.headers,
|
|
739
739
|
...ar()
|
|
@@ -762,11 +762,11 @@ function or(e) {
|
|
|
762
762
|
}, s = new URL("/api/detectionpolicy/rules", e.baseUrl).toString();
|
|
763
763
|
return {
|
|
764
764
|
async getRules() {
|
|
765
|
-
const r = await
|
|
765
|
+
const r = await De(s, { method: "GET", headers: t });
|
|
766
766
|
return Array.isArray(r) ? r : [];
|
|
767
767
|
},
|
|
768
768
|
async setEscalationSettings(r) {
|
|
769
|
-
return
|
|
769
|
+
return De(s, {
|
|
770
770
|
method: "POST",
|
|
771
771
|
headers: t,
|
|
772
772
|
body: JSON.stringify(r ?? {})
|
|
@@ -774,36 +774,36 @@ function or(e) {
|
|
|
774
774
|
},
|
|
775
775
|
async getLookups() {
|
|
776
776
|
const r = (U) => new URL(U, e.baseUrl).toString(), n = [
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
777
|
+
De(r("/api/detectionpolicy/lookups/actiontypes"), { method: "GET", headers: t }),
|
|
778
|
+
De(r("/api/detectionpolicy/lookups/anomalies"), { method: "GET", headers: t }),
|
|
779
|
+
De(r("/api/detectionpolicy/lookups/thirdparty"), { method: "GET", headers: t }),
|
|
780
|
+
De(r("/api/detectionpolicy/lookups/severity"), { method: "GET", headers: t }),
|
|
781
|
+
De(r("/api/detectionpolicy/lookups/scheduletypes"), { method: "GET", headers: t })
|
|
782
782
|
], [
|
|
783
783
|
a,
|
|
784
784
|
o,
|
|
785
785
|
l,
|
|
786
786
|
h,
|
|
787
787
|
d
|
|
788
|
-
] = await Promise.allSettled(n), c = (U) => U.status === "fulfilled" && Array.isArray(U.value) ? U.value : [],
|
|
788
|
+
] = await Promise.allSettled(n), c = (U) => U.status === "fulfilled" && Array.isArray(U.value) ? U.value : [], A = c(a), f = c(o), k = c(l), N = c(h), y = c(d), b = A.map((U) => ({
|
|
789
789
|
actionTypeId: Number(U?.ActionTypeId),
|
|
790
790
|
name: U?.DisplayName ?? U?.Name ?? ""
|
|
791
791
|
})), $ = f.map((U) => ({
|
|
792
792
|
recordId: U?.AnomalyId,
|
|
793
793
|
anomalyName: U?.DisplayName ?? U?.Name ?? ""
|
|
794
|
-
})),
|
|
794
|
+
})), M = k.map((U) => ({
|
|
795
795
|
thirdPartyId: Number(U?.ThirdPartyId),
|
|
796
796
|
thirdPartyName: U?.ThirdPartyName ?? U?.Name ?? ""
|
|
797
797
|
})), B = {
|
|
798
|
-
actionTypes:
|
|
798
|
+
actionTypes: b,
|
|
799
799
|
anomalies: $,
|
|
800
|
-
thirdParties:
|
|
800
|
+
thirdParties: M
|
|
801
801
|
};
|
|
802
|
-
return
|
|
802
|
+
return N.length && (B.severities = N), y.length && (B.scheduleTypes = y), B;
|
|
803
803
|
},
|
|
804
804
|
async updateRule(r, n) {
|
|
805
805
|
const a = `${s}/${r}`;
|
|
806
|
-
return
|
|
806
|
+
return De(a, {
|
|
807
807
|
method: "PUT",
|
|
808
808
|
headers: t,
|
|
809
809
|
body: JSON.stringify(n ?? {})
|
|
@@ -811,15 +811,15 @@ function or(e) {
|
|
|
811
811
|
}
|
|
812
812
|
};
|
|
813
813
|
}
|
|
814
|
-
const
|
|
814
|
+
const os = Is(null);
|
|
815
815
|
function lr({
|
|
816
816
|
tenant: e = "snl",
|
|
817
817
|
override: t,
|
|
818
818
|
children: s
|
|
819
819
|
}) {
|
|
820
820
|
const r = ue(() => {
|
|
821
|
-
const a = t?.alertsBaseUrl?.trim() ||
|
|
822
|
-
let o = t?.rulesBaseUrl?.trim() ||
|
|
821
|
+
const a = t?.alertsBaseUrl?.trim() || Lt[e]?.alerts || "";
|
|
822
|
+
let o = t?.rulesBaseUrl?.trim() || Lt[e]?.rules || "";
|
|
823
823
|
e === "snl" && (o = a);
|
|
824
824
|
const l = t?.headers;
|
|
825
825
|
return { tenant: e, alertsBaseUrl: a, rulesBaseUrl: o, headers: l };
|
|
@@ -832,10 +832,10 @@ function lr({
|
|
|
832
832
|
const a = r.tenant === "schools" ? ir({ baseUrl: r.alertsBaseUrl, headers: r.headers }) : Vs({ baseUrl: r.alertsBaseUrl, headers: r.headers }), o = r.tenant === "schools" ? or({ baseUrl: r.rulesBaseUrl, headers: r.headers }) : Xs({ baseUrl: r.alertsBaseUrl, headers: r.headers });
|
|
833
833
|
return { config: r, alerts: a, rules: o };
|
|
834
834
|
}, [r]);
|
|
835
|
-
return /* @__PURE__ */ i(
|
|
835
|
+
return /* @__PURE__ */ i(os.Provider, { value: n, children: s });
|
|
836
836
|
}
|
|
837
|
-
function
|
|
838
|
-
const e =
|
|
837
|
+
function xe() {
|
|
838
|
+
const e = Cs(os);
|
|
839
839
|
if (!e) throw new Error("useApi must be used inside ApiProvider");
|
|
840
840
|
return e;
|
|
841
841
|
}
|
|
@@ -849,9 +849,9 @@ const cr = {
|
|
|
849
849
|
High: "#FFB86A",
|
|
850
850
|
Medium: "#FFCC00",
|
|
851
851
|
Low: "#007AFF"
|
|
852
|
-
},
|
|
852
|
+
}, Nt = 6, wt = 7;
|
|
853
853
|
function dr(e, t, s) {
|
|
854
|
-
const r = e ===
|
|
854
|
+
const r = e === Nt, n = e === wt, a = t.isEmailSent, o = t.isSMSSent, l = r && a || n && o, h = r ? "Send Email" : n ? "Send SMS" : s, d = 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: d, tooltipTitle: c };
|
|
856
856
|
}
|
|
857
857
|
function hr(e) {
|
|
@@ -872,15 +872,15 @@ function fr(e) {
|
|
|
872
872
|
const s = Array.from(t).map((r) => ({ label: r, value: r }));
|
|
873
873
|
return [{ label: "All", value: "All" }, ...s];
|
|
874
874
|
}
|
|
875
|
-
function
|
|
875
|
+
function qt(e, t) {
|
|
876
876
|
return `${e}-${t ? "email" : "sms"}`;
|
|
877
877
|
}
|
|
878
|
-
function
|
|
879
|
-
return e ===
|
|
878
|
+
function _t(e) {
|
|
879
|
+
return e === Nt || e === wt;
|
|
880
880
|
}
|
|
881
|
-
function
|
|
881
|
+
function rt({ value: e, onChange: t, options: s, className: r, dropdownWidth: n }) {
|
|
882
882
|
return /* @__PURE__ */ i(
|
|
883
|
-
|
|
883
|
+
pe,
|
|
884
884
|
{
|
|
885
885
|
className: r,
|
|
886
886
|
options: s,
|
|
@@ -898,7 +898,7 @@ const mr = [
|
|
|
898
898
|
{ label: "Low", value: "Low" }
|
|
899
899
|
];
|
|
900
900
|
function pr({ value: e, onChange: t, options: s }) {
|
|
901
|
-
return /* @__PURE__ */ i(
|
|
901
|
+
return /* @__PURE__ */ i(rt, { className: "w-[140px]", value: e, onChange: t, options: s || mr });
|
|
902
902
|
}
|
|
903
903
|
const yr = [
|
|
904
904
|
{ label: "All Types", value: "All" },
|
|
@@ -907,10 +907,10 @@ const yr = [
|
|
|
907
907
|
{ label: "Aggressive Behavior", value: "Aggressive" }
|
|
908
908
|
];
|
|
909
909
|
function gr({ value: e, onChange: t, options: s }) {
|
|
910
|
-
return /* @__PURE__ */ i(
|
|
910
|
+
return /* @__PURE__ */ i(rt, { className: "w-[220px]", dropdownWidth: 280, value: e, onChange: t, options: s || yr });
|
|
911
911
|
}
|
|
912
912
|
function vr({ value: e, onChange: t, options: s }) {
|
|
913
|
-
return /* @__PURE__ */ i(
|
|
913
|
+
return /* @__PURE__ */ i(rt, { className: "w-[100px]", value: e, onChange: t, options: s || [] });
|
|
914
914
|
}
|
|
915
915
|
const br = [
|
|
916
916
|
{ label: "All", value: "All" },
|
|
@@ -921,7 +921,7 @@ const br = [
|
|
|
921
921
|
{ label: "Skydio", value: "Skydio" }
|
|
922
922
|
];
|
|
923
923
|
function Sr({ value: e, onChange: t, options: s }) {
|
|
924
|
-
return /* @__PURE__ */ i(
|
|
924
|
+
return /* @__PURE__ */ i(rt, { className: "w-[130px]", value: e, onChange: t, options: s || br });
|
|
925
925
|
}
|
|
926
926
|
function Ar({
|
|
927
927
|
columns: e,
|
|
@@ -935,7 +935,7 @@ function Ar({
|
|
|
935
935
|
return /* @__PURE__ */ u("div", { children: [
|
|
936
936
|
a,
|
|
937
937
|
/* @__PURE__ */ i(
|
|
938
|
-
|
|
938
|
+
bt,
|
|
939
939
|
{
|
|
940
940
|
rowKey: n,
|
|
941
941
|
dataSource: t,
|
|
@@ -952,50 +952,50 @@ function Ar({
|
|
|
952
952
|
)
|
|
953
953
|
] });
|
|
954
954
|
}
|
|
955
|
-
function
|
|
956
|
-
const [c,
|
|
955
|
+
function ls({ data: e, loading: t = !1, pageSize: s = 10, columns: r, severityOptions: n, spaceOptions: a, renderActions: o, onAlertIdClick: l, onRefetch: h, excludeCompleted: d = !0 }) {
|
|
956
|
+
const [c, A] = x("All"), [f, k] = x("All"), [N, y] = x("All"), [b, $] = x("All"), [M, B] = x(""), [U, V] = x([{ label: "All", value: "All" }]), [K, W] = x(/* @__PURE__ */ new Set()), { rules: Y, alerts: I } = xe(), C = {
|
|
957
957
|
6: { title: "Email", kind: "icon", icon: /* @__PURE__ */ i(Us, {}) },
|
|
958
958
|
7: { title: "SMS", kind: "icon", icon: /* @__PURE__ */ i(Ms, {}) }
|
|
959
|
-
},
|
|
960
|
-
|
|
961
|
-
let
|
|
959
|
+
}, T = ue(() => hr(e), [e]), Z = ue(() => fr(e), [e]);
|
|
960
|
+
fe(() => {
|
|
961
|
+
let g = !0;
|
|
962
962
|
return (async () => {
|
|
963
963
|
try {
|
|
964
|
-
const
|
|
964
|
+
const S = await Y.getLookups(), L = (Array.isArray(S.thirdParties) ? S.thirdParties : []).map((D) => ({
|
|
965
965
|
label: D.thirdPartyName,
|
|
966
966
|
value: String(D.thirdPartyId)
|
|
967
967
|
}));
|
|
968
|
-
|
|
969
|
-
} catch (
|
|
970
|
-
console.error("Error loading third party options",
|
|
968
|
+
g && V([{ label: "All", value: "All" }, ...L]);
|
|
969
|
+
} catch (S) {
|
|
970
|
+
console.error("Error loading third party options", S);
|
|
971
971
|
}
|
|
972
972
|
})(), () => {
|
|
973
|
-
|
|
973
|
+
g = !1;
|
|
974
974
|
};
|
|
975
|
-
}, [
|
|
976
|
-
const
|
|
977
|
-
() => (e || []).some((
|
|
975
|
+
}, [Y]);
|
|
976
|
+
const ee = ue(
|
|
977
|
+
() => (e || []).some((g) => ct(g).length > 0),
|
|
978
978
|
[e]
|
|
979
|
-
),
|
|
980
|
-
const
|
|
981
|
-
return
|
|
982
|
-
}), [e, c,
|
|
979
|
+
), R = ue(() => (e || []).filter((g) => {
|
|
980
|
+
const S = c === "All" || g.priority === c, O = `${g.id} ${g.description} ${g.statusType}`.toLowerCase(), L = !M || O.includes(M.toLowerCase()), D = f === "All" || (g.anomalyName || "").toLowerCase() === f.toLowerCase(), j = N === "All" || (g.spaceName || "").toLowerCase() === N.toLowerCase(), Q = !ee || b === "All" || ct(g).includes(Number(b)), z = !d || !["completed", "false positive"].includes(String(g.statusType || "").toLowerCase());
|
|
981
|
+
return S && L && D && j && Q && z;
|
|
982
|
+
}), [e, c, M, f, N, b, ee, d]), v = T, m = a && a.length ? a : Z, w = [
|
|
983
983
|
{
|
|
984
984
|
title: "Severity",
|
|
985
985
|
dataIndex: "priority",
|
|
986
986
|
key: "priority",
|
|
987
987
|
width: 120,
|
|
988
|
-
render: (
|
|
988
|
+
render: (g) => /* @__PURE__ */ i(Ze, { className: "px-[10px] py-[2px]", style: { border: `2px solid ${ur[g]}`, backgroundColor: cr[g] }, children: g })
|
|
989
989
|
},
|
|
990
990
|
{
|
|
991
991
|
title: "Tracker",
|
|
992
992
|
key: "tracker",
|
|
993
993
|
width: 140,
|
|
994
|
-
render: (
|
|
994
|
+
render: (g, S) => /* @__PURE__ */ i(
|
|
995
995
|
"a",
|
|
996
996
|
{
|
|
997
|
-
onClick: (
|
|
998
|
-
|
|
997
|
+
onClick: (O) => {
|
|
998
|
+
O.preventDefault(), l?.(S, { tab: "track", sourceTab: "active" });
|
|
999
999
|
},
|
|
1000
1000
|
className: "text-blue-600 hover:underline",
|
|
1001
1001
|
children: "Tracker"
|
|
@@ -1006,42 +1006,42 @@ function os({ data: e, loading: t = !1, pageSize: s = 10, columns: r, severityOp
|
|
|
1006
1006
|
title: "Call to action/Human in the loop",
|
|
1007
1007
|
key: "actions",
|
|
1008
1008
|
width: 320,
|
|
1009
|
-
render: (
|
|
1010
|
-
if (o) return /* @__PURE__ */ i(xs, { children: o(
|
|
1011
|
-
const
|
|
1012
|
-
if (!
|
|
1013
|
-
const
|
|
1014
|
-
const Q =
|
|
1015
|
-
|
|
1009
|
+
render: (g, S) => {
|
|
1010
|
+
if (o) return /* @__PURE__ */ i(xs, { children: o(S) });
|
|
1011
|
+
const O = ct(S);
|
|
1012
|
+
if (!O.length) return null;
|
|
1013
|
+
const L = async (D, j) => {
|
|
1014
|
+
const Q = qt(S.id, D);
|
|
1015
|
+
W((z) => new Set(z).add(Q));
|
|
1016
1016
|
try {
|
|
1017
|
-
const z = await
|
|
1017
|
+
const z = await I.sendSMSorEmailNotifications?.(S.id, D, j);
|
|
1018
1018
|
z?.responseStatus ? (ne.success(z.data || (D ? "Email sent successfully" : "SMS sent successfully")), h?.()) : ne.error(z?.data || z?.errorMessage || "Failed to send notification");
|
|
1019
1019
|
} catch (z) {
|
|
1020
1020
|
ne.error(z?.message || "Failed to send notification");
|
|
1021
1021
|
} finally {
|
|
1022
|
-
|
|
1022
|
+
W((z) => {
|
|
1023
1023
|
const ie = new Set(z);
|
|
1024
1024
|
return ie.delete(Q), ie;
|
|
1025
1025
|
});
|
|
1026
1026
|
}
|
|
1027
1027
|
};
|
|
1028
|
-
return /* @__PURE__ */ i(
|
|
1029
|
-
const j =
|
|
1028
|
+
return /* @__PURE__ */ i(we, { size: "middle", children: O.map((D) => {
|
|
1029
|
+
const j = C[D];
|
|
1030
1030
|
if (!j) return null;
|
|
1031
|
-
const Q = D ===
|
|
1032
|
-
|
|
1031
|
+
const Q = D === Nt, z = D === wt, { isDisabled: ie, buttonText: me, tooltipTitle: de } = dr(D, S, j.title), re = qt(S.id, Q), ae = _t(D) && K.has(re), be = () => {
|
|
1032
|
+
L(Q, z);
|
|
1033
1033
|
};
|
|
1034
|
-
return /* @__PURE__ */ i(ks, { title:
|
|
1035
|
-
|
|
1034
|
+
return /* @__PURE__ */ i(ks, { title: de, children: /* @__PURE__ */ i(
|
|
1035
|
+
ye,
|
|
1036
1036
|
{
|
|
1037
1037
|
size: "small",
|
|
1038
1038
|
disabled: ie,
|
|
1039
|
-
loading:
|
|
1040
|
-
onClick:
|
|
1041
|
-
icon: !
|
|
1039
|
+
loading: ae,
|
|
1040
|
+
onClick: _t(D) ? be : void 0,
|
|
1041
|
+
icon: !ae && (j.kind === "img" && j.src ? /* @__PURE__ */ i("img", { src: j.src, alt: j.alt || j.title }) : j.icon),
|
|
1042
1042
|
className: "flex flex-col items-center justify-center gap-1",
|
|
1043
1043
|
style: { height: "fit-content" },
|
|
1044
|
-
children:
|
|
1044
|
+
children: me
|
|
1045
1045
|
}
|
|
1046
1046
|
) }, D);
|
|
1047
1047
|
}) });
|
|
@@ -1052,17 +1052,17 @@ function os({ data: e, loading: t = !1, pageSize: s = 10, columns: r, severityOp
|
|
|
1052
1052
|
dataIndex: "timestamp",
|
|
1053
1053
|
key: "timestamp",
|
|
1054
1054
|
width: 220,
|
|
1055
|
-
render: (
|
|
1056
|
-
const
|
|
1055
|
+
render: (g, S) => {
|
|
1056
|
+
const O = S?.timeElapsed, L = S?.timeRemaining, D = O ? Ut(O) : 0, j = L ? Ut(L) : 0, Q = Math.round(D / (D + j) * 100);
|
|
1057
1057
|
return /* @__PURE__ */ u("div", { children: [
|
|
1058
1058
|
/* @__PURE__ */ u("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(Os, { percent: Q, showInfo: !1, size: "small", strokeColor: Gs(
|
|
1062
|
+
/* @__PURE__ */ i(Os, { percent: Q, showInfo: !1, size: "small", strokeColor: Gs(S.priority) }),
|
|
1063
1063
|
/* @__PURE__ */ u("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: L ?? "-" })
|
|
1066
1066
|
] })
|
|
1067
1067
|
] });
|
|
1068
1068
|
}
|
|
@@ -1077,45 +1077,45 @@ function os({ 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: (
|
|
1080
|
+
render: (g, S) => /* @__PURE__ */ u("div", { children: [
|
|
1081
1081
|
/* @__PURE__ */ i(
|
|
1082
1082
|
"a",
|
|
1083
1083
|
{
|
|
1084
|
-
onClick: (
|
|
1085
|
-
|
|
1084
|
+
onClick: (O) => {
|
|
1085
|
+
O.preventDefault(), l?.(S, { sourceTab: "active" });
|
|
1086
1086
|
},
|
|
1087
1087
|
className: "inline-block mb-1 text-blue-600",
|
|
1088
|
-
children:
|
|
1088
|
+
children: S.alertNumber
|
|
1089
1089
|
}
|
|
1090
1090
|
),
|
|
1091
|
-
/* @__PURE__ */ i("div", { className: "text-black/65", children:
|
|
1091
|
+
/* @__PURE__ */ i("div", { className: "text-black/65", children: g })
|
|
1092
1092
|
] })
|
|
1093
1093
|
}
|
|
1094
|
-
],
|
|
1094
|
+
], p = r && r.length ? r : w;
|
|
1095
1095
|
return /* @__PURE__ */ i("div", { children: /* @__PURE__ */ i(
|
|
1096
1096
|
Ar,
|
|
1097
1097
|
{
|
|
1098
1098
|
rowKey: "id",
|
|
1099
|
-
data:
|
|
1100
|
-
columns:
|
|
1099
|
+
data: R,
|
|
1100
|
+
columns: p,
|
|
1101
1101
|
loading: t,
|
|
1102
1102
|
pageSize: s,
|
|
1103
|
-
toolbar: /* @__PURE__ */ u(
|
|
1103
|
+
toolbar: /* @__PURE__ */ u(ge, { gutter: [12, 12], className: "mb-3", align: "middle", children: [
|
|
1104
1104
|
/* @__PURE__ */ i(H, { flex: "none", children: /* @__PURE__ */ u("div", { className: "flex items-center gap-2", children: [
|
|
1105
1105
|
/* @__PURE__ */ i("span", { children: "Severity" }),
|
|
1106
|
-
/* @__PURE__ */ i(pr, { value: c, onChange:
|
|
1106
|
+
/* @__PURE__ */ i(pr, { value: c, onChange: A, options: n })
|
|
1107
1107
|
] }) }),
|
|
1108
1108
|
/* @__PURE__ */ i(H, { flex: "none", children: /* @__PURE__ */ u("div", { className: "flex items-center gap-2", children: [
|
|
1109
1109
|
/* @__PURE__ */ i("span", { children: "Anomaly type" }),
|
|
1110
|
-
/* @__PURE__ */ i(gr, { value: f, onChange:
|
|
1110
|
+
/* @__PURE__ */ i(gr, { value: f, onChange: k, options: v })
|
|
1111
1111
|
] }) }),
|
|
1112
1112
|
/* @__PURE__ */ i(H, { flex: "none", children: /* @__PURE__ */ u("div", { className: "flex items-center gap-2", children: [
|
|
1113
1113
|
/* @__PURE__ */ i("span", { children: "Space" }),
|
|
1114
|
-
/* @__PURE__ */ i(vr, { value:
|
|
1114
|
+
/* @__PURE__ */ i(vr, { value: N, onChange: y, options: m })
|
|
1115
1115
|
] }) }),
|
|
1116
1116
|
/* @__PURE__ */ i(H, { flex: "none", children: /* @__PURE__ */ u("div", { className: "flex items-center gap-2", children: [
|
|
1117
1117
|
/* @__PURE__ */ i("span", { children: "Action Taken" }),
|
|
1118
|
-
/* @__PURE__ */ i(Sr, { value:
|
|
1118
|
+
/* @__PURE__ */ i(Sr, { value: b, onChange: $, options: U })
|
|
1119
1119
|
] }) }),
|
|
1120
1120
|
/* @__PURE__ */ i(H, { flex: "auto" }),
|
|
1121
1121
|
/* @__PURE__ */ i(H, { flex: "none", children: /* @__PURE__ */ i(
|
|
@@ -1124,7 +1124,7 @@ function os({ data: e, loading: t = !1, pageSize: s = 10, columns: r, severityOp
|
|
|
1124
1124
|
allowClear: !0,
|
|
1125
1125
|
placeholder: "Search",
|
|
1126
1126
|
onSearch: B,
|
|
1127
|
-
onChange: (
|
|
1127
|
+
onChange: (g) => B(g.target.value),
|
|
1128
1128
|
className: "w-[260px] ",
|
|
1129
1129
|
enterButton: !0
|
|
1130
1130
|
}
|
|
@@ -1133,7 +1133,7 @@ function os({ data: e, loading: t = !1, pageSize: s = 10, columns: r, severityOp
|
|
|
1133
1133
|
}
|
|
1134
1134
|
) });
|
|
1135
1135
|
}
|
|
1136
|
-
var
|
|
1136
|
+
var Qe = class {
|
|
1137
1137
|
constructor() {
|
|
1138
1138
|
this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
|
|
1139
1139
|
}
|
|
@@ -1191,29 +1191,29 @@ var Be = class {
|
|
|
1191
1191
|
clearInterval(e) {
|
|
1192
1192
|
this.#e.clearInterval(e);
|
|
1193
1193
|
}
|
|
1194
|
-
},
|
|
1194
|
+
}, Ue = new wr();
|
|
1195
1195
|
function xr(e) {
|
|
1196
1196
|
setTimeout(e, 0);
|
|
1197
1197
|
}
|
|
1198
|
-
var
|
|
1199
|
-
function
|
|
1198
|
+
var Le = typeof window > "u" || "Deno" in globalThis;
|
|
1199
|
+
function he() {
|
|
1200
1200
|
}
|
|
1201
|
-
function
|
|
1201
|
+
function Cr(e, t) {
|
|
1202
1202
|
return typeof e == "function" ? e(t) : e;
|
|
1203
1203
|
}
|
|
1204
|
-
function
|
|
1204
|
+
function dt(e) {
|
|
1205
1205
|
return typeof e == "number" && e >= 0 && e !== 1 / 0;
|
|
1206
1206
|
}
|
|
1207
|
-
function
|
|
1207
|
+
function cs(e, t) {
|
|
1208
1208
|
return Math.max(e + (t || 0) - Date.now(), 0);
|
|
1209
1209
|
}
|
|
1210
|
-
function
|
|
1210
|
+
function Fe(e, t) {
|
|
1211
1211
|
return typeof e == "function" ? e(t) : e;
|
|
1212
1212
|
}
|
|
1213
|
-
function
|
|
1213
|
+
function ve(e, t) {
|
|
1214
1214
|
return typeof e == "function" ? e(t) : e;
|
|
1215
1215
|
}
|
|
1216
|
-
function
|
|
1216
|
+
function Ht(e, t) {
|
|
1217
1217
|
const {
|
|
1218
1218
|
type: s = "all",
|
|
1219
1219
|
exact: r,
|
|
@@ -1224,9 +1224,9 @@ function _t(e, t) {
|
|
|
1224
1224
|
} = e;
|
|
1225
1225
|
if (o) {
|
|
1226
1226
|
if (r) {
|
|
1227
|
-
if (t.queryHash !==
|
|
1227
|
+
if (t.queryHash !== xt(o, t.options))
|
|
1228
1228
|
return !1;
|
|
1229
|
-
} else if (!
|
|
1229
|
+
} else if (!Ge(t.queryKey, o))
|
|
1230
1230
|
return !1;
|
|
1231
1231
|
}
|
|
1232
1232
|
if (s !== "all") {
|
|
@@ -1236,56 +1236,56 @@ function _t(e, t) {
|
|
|
1236
1236
|
}
|
|
1237
1237
|
return !(typeof l == "boolean" && t.isStale() !== l || n && n !== t.state.fetchStatus || a && !a(t));
|
|
1238
1238
|
}
|
|
1239
|
-
function
|
|
1239
|
+
function Gt(e, t) {
|
|
1240
1240
|
const { exact: s, status: r, predicate: n, mutationKey: a } = e;
|
|
1241
1241
|
if (a) {
|
|
1242
1242
|
if (!t.options.mutationKey)
|
|
1243
1243
|
return !1;
|
|
1244
1244
|
if (s) {
|
|
1245
|
-
if (
|
|
1245
|
+
if ($e(t.options.mutationKey) !== $e(a))
|
|
1246
1246
|
return !1;
|
|
1247
|
-
} else if (!
|
|
1247
|
+
} else if (!Ge(t.options.mutationKey, a))
|
|
1248
1248
|
return !1;
|
|
1249
1249
|
}
|
|
1250
1250
|
return !(r && t.state.status !== r || n && !n(t));
|
|
1251
1251
|
}
|
|
1252
|
-
function
|
|
1253
|
-
return (t?.queryKeyHashFn ||
|
|
1252
|
+
function xt(e, t) {
|
|
1253
|
+
return (t?.queryKeyHashFn || $e)(e);
|
|
1254
1254
|
}
|
|
1255
|
-
function
|
|
1255
|
+
function $e(e) {
|
|
1256
1256
|
return JSON.stringify(
|
|
1257
1257
|
e,
|
|
1258
|
-
(t, s) =>
|
|
1258
|
+
(t, s) => ft(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 Ge(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) => Ge(e[s], t[s])) : !1;
|
|
1263
1263
|
}
|
|
1264
|
-
var
|
|
1265
|
-
function
|
|
1264
|
+
var Ir = Object.prototype.hasOwnProperty;
|
|
1265
|
+
function ht(e, t, s = 0) {
|
|
1266
1266
|
if (e === t)
|
|
1267
1267
|
return e;
|
|
1268
1268
|
if (s > 500) return t;
|
|
1269
|
-
const r =
|
|
1270
|
-
if (!r && !(
|
|
1269
|
+
const r = Wt(e) && Wt(t);
|
|
1270
|
+
if (!r && !(ft(e) && ft(t))) return t;
|
|
1271
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 d = 0;
|
|
1273
1273
|
for (let c = 0; c < l; c++) {
|
|
1274
|
-
const
|
|
1275
|
-
if (f ===
|
|
1276
|
-
h[
|
|
1274
|
+
const A = r ? c : o[c], f = e[A], k = t[A];
|
|
1275
|
+
if (f === k) {
|
|
1276
|
+
h[A] = f, (r ? c < a : Ir.call(e, A)) && d++;
|
|
1277
1277
|
continue;
|
|
1278
1278
|
}
|
|
1279
|
-
if (f === null ||
|
|
1280
|
-
h[
|
|
1279
|
+
if (f === null || k === null || typeof f != "object" || typeof k != "object") {
|
|
1280
|
+
h[A] = k;
|
|
1281
1281
|
continue;
|
|
1282
1282
|
}
|
|
1283
|
-
const
|
|
1284
|
-
h[
|
|
1283
|
+
const N = ht(f, k, s + 1);
|
|
1284
|
+
h[A] = N, N === f && d++;
|
|
1285
1285
|
}
|
|
1286
1286
|
return a === l && d === a ? e : h;
|
|
1287
1287
|
}
|
|
1288
|
-
function
|
|
1288
|
+
function et(e, t) {
|
|
1289
1289
|
if (!t || Object.keys(e).length !== Object.keys(t).length)
|
|
1290
1290
|
return !1;
|
|
1291
1291
|
for (const s in e)
|
|
@@ -1293,39 +1293,39 @@ function Je(e, t) {
|
|
|
1293
1293
|
return !1;
|
|
1294
1294
|
return !0;
|
|
1295
1295
|
}
|
|
1296
|
-
function
|
|
1296
|
+
function Wt(e) {
|
|
1297
1297
|
return Array.isArray(e) && e.length === Object.keys(e).length;
|
|
1298
1298
|
}
|
|
1299
|
-
function
|
|
1300
|
-
if (!
|
|
1299
|
+
function ft(e) {
|
|
1300
|
+
if (!Yt(e))
|
|
1301
1301
|
return !1;
|
|
1302
1302
|
const t = e.constructor;
|
|
1303
1303
|
if (t === void 0)
|
|
1304
1304
|
return !0;
|
|
1305
1305
|
const s = t.prototype;
|
|
1306
|
-
return !(!
|
|
1306
|
+
return !(!Yt(s) || !s.hasOwnProperty("isPrototypeOf") || Object.getPrototypeOf(e) !== Object.prototype);
|
|
1307
1307
|
}
|
|
1308
|
-
function
|
|
1308
|
+
function Yt(e) {
|
|
1309
1309
|
return Object.prototype.toString.call(e) === "[object Object]";
|
|
1310
1310
|
}
|
|
1311
1311
|
function Tr(e) {
|
|
1312
1312
|
return new Promise((t) => {
|
|
1313
|
-
|
|
1313
|
+
Ue.setTimeout(t, e);
|
|
1314
1314
|
});
|
|
1315
1315
|
}
|
|
1316
|
-
function
|
|
1316
|
+
function mt(e, t, s) {
|
|
1317
1317
|
if (typeof s.structuralSharing == "function")
|
|
1318
1318
|
return s.structuralSharing(e, t);
|
|
1319
1319
|
if (s.structuralSharing !== !1) {
|
|
1320
1320
|
if (process.env.NODE_ENV !== "production")
|
|
1321
1321
|
try {
|
|
1322
|
-
return
|
|
1322
|
+
return ht(e, t);
|
|
1323
1323
|
} catch (r) {
|
|
1324
1324
|
throw console.error(
|
|
1325
1325
|
`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${s.queryHash}]: ${r}`
|
|
1326
1326
|
), r;
|
|
1327
1327
|
}
|
|
1328
|
-
return
|
|
1328
|
+
return ht(e, t);
|
|
1329
1329
|
}
|
|
1330
1330
|
return t;
|
|
1331
1331
|
}
|
|
@@ -1337,13 +1337,13 @@ function kr(e, t, s = 0) {
|
|
|
1337
1337
|
const r = [t, ...e];
|
|
1338
1338
|
return s && r.length > s ? r.slice(0, -1) : r;
|
|
1339
1339
|
}
|
|
1340
|
-
var
|
|
1341
|
-
function
|
|
1342
|
-
return process.env.NODE_ENV !== "production" && e.queryFn ===
|
|
1340
|
+
var tt = /* @__PURE__ */ Symbol();
|
|
1341
|
+
function us(e, t) {
|
|
1342
|
+
return process.env.NODE_ENV !== "production" && e.queryFn === tt && console.error(
|
|
1343
1343
|
`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`
|
|
1344
|
-
), !e.queryFn && t?.initialPromise ? () => t.initialPromise : !e.queryFn || e.queryFn ===
|
|
1344
|
+
), !e.queryFn && t?.initialPromise ? () => t.initialPromise : !e.queryFn || e.queryFn === tt ? () => Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)) : e.queryFn;
|
|
1345
1345
|
}
|
|
1346
|
-
function
|
|
1346
|
+
function Ct(e, t) {
|
|
1347
1347
|
return typeof e == "function" ? e(...t) : !!e;
|
|
1348
1348
|
}
|
|
1349
1349
|
function Or(e, t, s) {
|
|
@@ -1353,13 +1353,13 @@ function Or(e, t, s) {
|
|
|
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 Pr = class extends
|
|
1356
|
+
var Pr = class extends Qe {
|
|
1357
1357
|
#e;
|
|
1358
1358
|
#t;
|
|
1359
1359
|
#s;
|
|
1360
1360
|
constructor() {
|
|
1361
1361
|
super(), this.#s = (e) => {
|
|
1362
|
-
if (!
|
|
1362
|
+
if (!Le && window.addEventListener) {
|
|
1363
1363
|
const t = () => e();
|
|
1364
1364
|
return window.addEventListener("visibilitychange", t, !1), () => {
|
|
1365
1365
|
window.removeEventListener("visibilitychange", t);
|
|
@@ -1390,8 +1390,8 @@ var Pr = class extends Be {
|
|
|
1390
1390
|
isFocused() {
|
|
1391
1391
|
return typeof this.#e == "boolean" ? this.#e : globalThis.document?.visibilityState !== "hidden";
|
|
1392
1392
|
}
|
|
1393
|
-
},
|
|
1394
|
-
function
|
|
1393
|
+
}, It = new Pr();
|
|
1394
|
+
function pt() {
|
|
1395
1395
|
let e, t;
|
|
1396
1396
|
const s = new Promise((n, a) => {
|
|
1397
1397
|
e = n, t = a;
|
|
@@ -1473,13 +1473,13 @@ function Dr() {
|
|
|
1473
1473
|
}
|
|
1474
1474
|
};
|
|
1475
1475
|
}
|
|
1476
|
-
var
|
|
1476
|
+
var oe = Dr(), Fr = class extends Qe {
|
|
1477
1477
|
#e = !0;
|
|
1478
1478
|
#t;
|
|
1479
1479
|
#s;
|
|
1480
1480
|
constructor() {
|
|
1481
1481
|
super(), this.#s = (e) => {
|
|
1482
|
-
if (!
|
|
1482
|
+
if (!Le && window.addEventListener) {
|
|
1483
1483
|
const t = () => e(!0), s = () => e(!1);
|
|
1484
1484
|
return window.addEventListener("online", t, !1), window.addEventListener("offline", s, !1), () => {
|
|
1485
1485
|
window.removeEventListener("online", t), window.removeEventListener("offline", s);
|
|
@@ -1504,59 +1504,59 @@ var ae = Dr(), Fr = class extends Be {
|
|
|
1504
1504
|
isOnline() {
|
|
1505
1505
|
return this.#e;
|
|
1506
1506
|
}
|
|
1507
|
-
},
|
|
1507
|
+
}, st = new Fr();
|
|
1508
1508
|
function Mr(e) {
|
|
1509
1509
|
return Math.min(1e3 * 2 ** e, 3e4);
|
|
1510
1510
|
}
|
|
1511
|
-
function
|
|
1512
|
-
return (e ?? "online") === "online" ?
|
|
1511
|
+
function ds(e) {
|
|
1512
|
+
return (e ?? "online") === "online" ? st.isOnline() : !0;
|
|
1513
1513
|
}
|
|
1514
|
-
var
|
|
1514
|
+
var yt = class extends Error {
|
|
1515
1515
|
constructor(e) {
|
|
1516
1516
|
super("CancelledError"), this.revert = e?.revert, this.silent = e?.silent;
|
|
1517
1517
|
}
|
|
1518
1518
|
};
|
|
1519
|
-
function
|
|
1519
|
+
function hs(e) {
|
|
1520
1520
|
let t = !1, s = 0, r;
|
|
1521
|
-
const n =
|
|
1521
|
+
const n = pt(), a = () => n.status !== "pending", o = (y) => {
|
|
1522
1522
|
if (!a()) {
|
|
1523
|
-
const
|
|
1524
|
-
f(
|
|
1523
|
+
const b = new yt(y);
|
|
1524
|
+
f(b), e.onCancel?.(b);
|
|
1525
1525
|
}
|
|
1526
1526
|
}, l = () => {
|
|
1527
1527
|
t = !0;
|
|
1528
1528
|
}, h = () => {
|
|
1529
1529
|
t = !1;
|
|
1530
|
-
}, d = () =>
|
|
1531
|
-
a() || (r?.(), n.resolve(
|
|
1532
|
-
}, f = (
|
|
1533
|
-
a() || (r?.(), n.reject(
|
|
1534
|
-
},
|
|
1535
|
-
r = (
|
|
1536
|
-
(a() || d()) &&
|
|
1530
|
+
}, d = () => It.isFocused() && (e.networkMode === "always" || st.isOnline()) && e.canRun(), c = () => ds(e.networkMode) && e.canRun(), A = (y) => {
|
|
1531
|
+
a() || (r?.(), n.resolve(y));
|
|
1532
|
+
}, f = (y) => {
|
|
1533
|
+
a() || (r?.(), n.reject(y));
|
|
1534
|
+
}, k = () => new Promise((y) => {
|
|
1535
|
+
r = (b) => {
|
|
1536
|
+
(a() || d()) && y(b);
|
|
1537
1537
|
}, e.onPause?.();
|
|
1538
1538
|
}).then(() => {
|
|
1539
1539
|
r = void 0, a() || e.onContinue?.();
|
|
1540
|
-
}),
|
|
1540
|
+
}), N = () => {
|
|
1541
1541
|
if (a())
|
|
1542
1542
|
return;
|
|
1543
|
-
let
|
|
1544
|
-
const
|
|
1543
|
+
let y;
|
|
1544
|
+
const b = s === 0 ? e.initialPromise : void 0;
|
|
1545
1545
|
try {
|
|
1546
|
-
|
|
1546
|
+
y = b ?? e.fn();
|
|
1547
1547
|
} catch ($) {
|
|
1548
|
-
|
|
1548
|
+
y = Promise.reject($);
|
|
1549
1549
|
}
|
|
1550
|
-
Promise.resolve(
|
|
1550
|
+
Promise.resolve(y).then(A).catch(($) => {
|
|
1551
1551
|
if (a())
|
|
1552
1552
|
return;
|
|
1553
|
-
const
|
|
1554
|
-
if (t || !
|
|
1553
|
+
const M = e.retry ?? (Le ? 0 : 3), B = e.retryDelay ?? Mr, U = typeof B == "function" ? B(s, $) : B, V = M === !0 || typeof M == "number" && s < M || typeof M == "function" && M(s, $);
|
|
1554
|
+
if (t || !V) {
|
|
1555
1555
|
f($);
|
|
1556
1556
|
return;
|
|
1557
1557
|
}
|
|
1558
|
-
s++, e.onFail?.(s, $), Tr(U).then(() => d() ? void 0 :
|
|
1559
|
-
t ? f($) :
|
|
1558
|
+
s++, e.onFail?.(s, $), Tr(U).then(() => d() ? void 0 : k()).then(() => {
|
|
1559
|
+
t ? f($) : N();
|
|
1560
1560
|
});
|
|
1561
1561
|
});
|
|
1562
1562
|
};
|
|
@@ -1568,29 +1568,29 @@ function ds(e) {
|
|
|
1568
1568
|
cancelRetry: l,
|
|
1569
1569
|
continueRetry: h,
|
|
1570
1570
|
canStart: c,
|
|
1571
|
-
start: () => (c() ?
|
|
1571
|
+
start: () => (c() ? N() : k().then(N), n)
|
|
1572
1572
|
};
|
|
1573
1573
|
}
|
|
1574
|
-
var
|
|
1574
|
+
var fs = class {
|
|
1575
1575
|
#e;
|
|
1576
1576
|
destroy() {
|
|
1577
1577
|
this.clearGcTimeout();
|
|
1578
1578
|
}
|
|
1579
1579
|
scheduleGc() {
|
|
1580
|
-
this.clearGcTimeout(),
|
|
1580
|
+
this.clearGcTimeout(), dt(this.gcTime) && (this.#e = Ue.setTimeout(() => {
|
|
1581
1581
|
this.optionalRemove();
|
|
1582
1582
|
}, this.gcTime));
|
|
1583
1583
|
}
|
|
1584
1584
|
updateGcTime(e) {
|
|
1585
1585
|
this.gcTime = Math.max(
|
|
1586
1586
|
this.gcTime || 0,
|
|
1587
|
-
e ?? (
|
|
1587
|
+
e ?? (Le ? 1 / 0 : 300 * 1e3)
|
|
1588
1588
|
);
|
|
1589
1589
|
}
|
|
1590
1590
|
clearGcTimeout() {
|
|
1591
|
-
this.#e && (
|
|
1591
|
+
this.#e && (Ue.clearTimeout(this.#e), this.#e = void 0);
|
|
1592
1592
|
}
|
|
1593
|
-
}, Ur = class extends
|
|
1593
|
+
}, Ur = class extends fs {
|
|
1594
1594
|
#e;
|
|
1595
1595
|
#t;
|
|
1596
1596
|
#s;
|
|
@@ -1599,7 +1599,7 @@ var hs = class {
|
|
|
1599
1599
|
#a;
|
|
1600
1600
|
#o;
|
|
1601
1601
|
constructor(e) {
|
|
1602
|
-
super(), this.#o = !1, this.#a = e.defaultOptions, this.setOptions(e.options), this.observers = [], this.#n = e.client, this.#s = this.#n.getQueryCache(), this.queryKey = e.queryKey, this.queryHash = e.queryHash, this.#e =
|
|
1602
|
+
super(), this.#o = !1, this.#a = e.defaultOptions, this.setOptions(e.options), this.observers = [], this.#n = e.client, this.#s = this.#n.getQueryCache(), this.queryKey = e.queryKey, this.queryHash = e.queryHash, this.#e = zt(this.options), this.state = e.state ?? this.#e, this.scheduleGc();
|
|
1603
1603
|
}
|
|
1604
1604
|
get meta() {
|
|
1605
1605
|
return this.options.meta;
|
|
@@ -1609,9 +1609,9 @@ var hs = class {
|
|
|
1609
1609
|
}
|
|
1610
1610
|
setOptions(e) {
|
|
1611
1611
|
if (this.options = { ...this.#a, ...e }, this.updateGcTime(this.options.gcTime), this.state && this.state.data === void 0) {
|
|
1612
|
-
const t =
|
|
1612
|
+
const t = zt(this.options);
|
|
1613
1613
|
t.data !== void 0 && (this.setState(
|
|
1614
|
-
|
|
1614
|
+
Kt(t.data, t.dataUpdatedAt)
|
|
1615
1615
|
), this.#e = t);
|
|
1616
1616
|
}
|
|
1617
1617
|
}
|
|
@@ -1619,7 +1619,7 @@ var hs = class {
|
|
|
1619
1619
|
!this.observers.length && this.state.fetchStatus === "idle" && this.#s.remove(this);
|
|
1620
1620
|
}
|
|
1621
1621
|
setData(e, t) {
|
|
1622
|
-
const s =
|
|
1622
|
+
const s = mt(this.state.data, e, this.options);
|
|
1623
1623
|
return this.#i({
|
|
1624
1624
|
data: s,
|
|
1625
1625
|
type: "success",
|
|
@@ -1632,7 +1632,7 @@ var hs = 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(he).catch(he) : Promise.resolve();
|
|
1636
1636
|
}
|
|
1637
1637
|
destroy() {
|
|
1638
1638
|
super.destroy(), this.cancel({ silent: !0 });
|
|
@@ -1642,15 +1642,15 @@ var hs = class {
|
|
|
1642
1642
|
}
|
|
1643
1643
|
isActive() {
|
|
1644
1644
|
return this.observers.some(
|
|
1645
|
-
(e) =>
|
|
1645
|
+
(e) => ve(e.options.enabled, this) !== !1
|
|
1646
1646
|
);
|
|
1647
1647
|
}
|
|
1648
1648
|
isDisabled() {
|
|
1649
|
-
return this.getObserversCount() > 0 ? !this.isActive() : this.options.queryFn ===
|
|
1649
|
+
return this.getObserversCount() > 0 ? !this.isActive() : this.options.queryFn === tt || this.state.dataUpdateCount + this.state.errorUpdateCount === 0;
|
|
1650
1650
|
}
|
|
1651
1651
|
isStatic() {
|
|
1652
1652
|
return this.getObserversCount() > 0 ? this.observers.some(
|
|
1653
|
-
(e) =>
|
|
1653
|
+
(e) => Fe(e.options.staleTime, this) === "static"
|
|
1654
1654
|
) : !1;
|
|
1655
1655
|
}
|
|
1656
1656
|
isStale() {
|
|
@@ -1659,7 +1659,7 @@ var hs = class {
|
|
|
1659
1659
|
) : this.state.data === void 0 || this.state.isInvalidated;
|
|
1660
1660
|
}
|
|
1661
1661
|
isStaleByTime(e = 0) {
|
|
1662
|
-
return this.state.data === void 0 ? !0 : e === "static" ? !1 : this.state.isInvalidated ? !0 : !
|
|
1662
|
+
return this.state.data === void 0 ? !0 : e === "static" ? !1 : this.state.isInvalidated ? !0 : !cs(this.state.dataUpdatedAt, e);
|
|
1663
1663
|
}
|
|
1664
1664
|
onFocus() {
|
|
1665
1665
|
this.observers.find((t) => t.shouldFetchOnWindowFocus())?.refetch({ cancelRefetch: !1 }), this.#r?.continue();
|
|
@@ -1702,7 +1702,7 @@ var hs = class {
|
|
|
1702
1702
|
get: () => (this.#o = !0, s.signal)
|
|
1703
1703
|
});
|
|
1704
1704
|
}, n = () => {
|
|
1705
|
-
const l =
|
|
1705
|
+
const l = us(this.options, t), d = (() => {
|
|
1706
1706
|
const c = {
|
|
1707
1707
|
client: this.#n,
|
|
1708
1708
|
queryKey: this.queryKey,
|
|
@@ -1726,11 +1726,11 @@ var hs = class {
|
|
|
1726
1726
|
};
|
|
1727
1727
|
return r(l), l;
|
|
1728
1728
|
})();
|
|
1729
|
-
this.options.behavior?.onFetch(o, this), this.#t = this.state, (this.state.fetchStatus === "idle" || this.state.fetchMeta !== o.fetchOptions?.meta) && this.#i({ type: "fetch", meta: o.fetchOptions?.meta }), this.#r =
|
|
1729
|
+
this.options.behavior?.onFetch(o, this), this.#t = this.state, (this.state.fetchStatus === "idle" || this.state.fetchMeta !== o.fetchOptions?.meta) && this.#i({ type: "fetch", meta: o.fetchOptions?.meta }), this.#r = hs({
|
|
1730
1730
|
initialPromise: t?.initialPromise,
|
|
1731
1731
|
fn: o.fetchFn,
|
|
1732
1732
|
onCancel: (l) => {
|
|
1733
|
-
l instanceof
|
|
1733
|
+
l instanceof yt && l.revert && this.setState({
|
|
1734
1734
|
...this.#t,
|
|
1735
1735
|
fetchStatus: "idle"
|
|
1736
1736
|
}), s.abort();
|
|
@@ -1761,7 +1761,7 @@ var hs = class {
|
|
|
1761
1761
|
this
|
|
1762
1762
|
), l;
|
|
1763
1763
|
} catch (l) {
|
|
1764
|
-
if (l instanceof
|
|
1764
|
+
if (l instanceof yt) {
|
|
1765
1765
|
if (l.silent)
|
|
1766
1766
|
return this.#r.promise;
|
|
1767
1767
|
if (l.revert) {
|
|
@@ -1807,13 +1807,13 @@ var hs = class {
|
|
|
1807
1807
|
case "fetch":
|
|
1808
1808
|
return {
|
|
1809
1809
|
...s,
|
|
1810
|
-
...
|
|
1810
|
+
...ms(s.data, this.options),
|
|
1811
1811
|
fetchMeta: e.meta ?? null
|
|
1812
1812
|
};
|
|
1813
1813
|
case "success":
|
|
1814
1814
|
const r = {
|
|
1815
1815
|
...s,
|
|
1816
|
-
...
|
|
1816
|
+
...Kt(e.data, e.dataUpdatedAt),
|
|
1817
1817
|
dataUpdateCount: s.dataUpdateCount + 1,
|
|
1818
1818
|
...!e.manual && {
|
|
1819
1819
|
fetchStatus: "idle",
|
|
@@ -1849,25 +1849,25 @@ var hs = class {
|
|
|
1849
1849
|
};
|
|
1850
1850
|
}
|
|
1851
1851
|
};
|
|
1852
|
-
this.state = t(this.state),
|
|
1852
|
+
this.state = t(this.state), oe.batch(() => {
|
|
1853
1853
|
this.observers.forEach((s) => {
|
|
1854
1854
|
s.onQueryUpdate();
|
|
1855
1855
|
}), this.#s.notify({ query: this, type: "updated", action: e });
|
|
1856
1856
|
});
|
|
1857
1857
|
}
|
|
1858
1858
|
};
|
|
1859
|
-
function
|
|
1859
|
+
function ms(e, t) {
|
|
1860
1860
|
return {
|
|
1861
1861
|
fetchFailureCount: 0,
|
|
1862
1862
|
fetchFailureReason: null,
|
|
1863
|
-
fetchStatus:
|
|
1863
|
+
fetchStatus: ds(t.networkMode) ? "fetching" : "paused",
|
|
1864
1864
|
...e === void 0 && {
|
|
1865
1865
|
error: null,
|
|
1866
1866
|
status: "pending"
|
|
1867
1867
|
}
|
|
1868
1868
|
};
|
|
1869
1869
|
}
|
|
1870
|
-
function
|
|
1870
|
+
function Kt(e, t) {
|
|
1871
1871
|
return {
|
|
1872
1872
|
data: e,
|
|
1873
1873
|
dataUpdatedAt: t ?? Date.now(),
|
|
@@ -1876,7 +1876,7 @@ function Yt(e, t) {
|
|
|
1876
1876
|
status: "success"
|
|
1877
1877
|
};
|
|
1878
1878
|
}
|
|
1879
|
-
function
|
|
1879
|
+
function zt(e) {
|
|
1880
1880
|
const t = typeof e.initialData == "function" ? e.initialData() : e.initialData, s = t !== void 0, r = s ? typeof e.initialDataUpdatedAt == "function" ? e.initialDataUpdatedAt() : e.initialDataUpdatedAt : 0;
|
|
1881
1881
|
return {
|
|
1882
1882
|
data: t,
|
|
@@ -1893,9 +1893,9 @@ function Kt(e) {
|
|
|
1893
1893
|
fetchStatus: "idle"
|
|
1894
1894
|
};
|
|
1895
1895
|
}
|
|
1896
|
-
var Lr = class extends
|
|
1896
|
+
var Lr = class extends Qe {
|
|
1897
1897
|
constructor(e, t) {
|
|
1898
|
-
super(), this.options = t, this.#e = e, this.#i = null, this.#o =
|
|
1898
|
+
super(), this.options = t, this.#e = e, this.#i = null, this.#o = pt(), this.bindMethods(), this.setOptions(t);
|
|
1899
1899
|
}
|
|
1900
1900
|
#e;
|
|
1901
1901
|
#t = void 0;
|
|
@@ -1918,20 +1918,20 @@ var Lr = class extends Be {
|
|
|
1918
1918
|
this.refetch = this.refetch.bind(this);
|
|
1919
1919
|
}
|
|
1920
1920
|
onSubscribe() {
|
|
1921
|
-
this.listeners.size === 1 && (this.#t.addObserver(this),
|
|
1921
|
+
this.listeners.size === 1 && (this.#t.addObserver(this), Vt(this.#t, this.options) ? this.#d() : this.updateResult(), this.#b());
|
|
1922
1922
|
}
|
|
1923
1923
|
onUnsubscribe() {
|
|
1924
1924
|
this.hasListeners() || this.destroy();
|
|
1925
1925
|
}
|
|
1926
1926
|
shouldFetchOnReconnect() {
|
|
1927
|
-
return
|
|
1927
|
+
return gt(
|
|
1928
1928
|
this.#t,
|
|
1929
1929
|
this.options,
|
|
1930
1930
|
this.options.refetchOnReconnect
|
|
1931
1931
|
);
|
|
1932
1932
|
}
|
|
1933
1933
|
shouldFetchOnWindowFocus() {
|
|
1934
|
-
return
|
|
1934
|
+
return gt(
|
|
1935
1935
|
this.#t,
|
|
1936
1936
|
this.options,
|
|
1937
1937
|
this.options.refetchOnWindowFocus
|
|
@@ -1942,24 +1942,24 @@ var Lr = class extends Be {
|
|
|
1942
1942
|
}
|
|
1943
1943
|
setOptions(e) {
|
|
1944
1944
|
const t = this.options, s = this.#t;
|
|
1945
|
-
if (this.options = this.#e.defaultQueryOptions(e), this.options.enabled !== void 0 && typeof this.options.enabled != "boolean" && typeof this.options.enabled != "function" && typeof
|
|
1945
|
+
if (this.options = this.#e.defaultQueryOptions(e), this.options.enabled !== void 0 && typeof this.options.enabled != "boolean" && typeof this.options.enabled != "function" && typeof ve(this.options.enabled, this.#t) != "boolean")
|
|
1946
1946
|
throw new Error(
|
|
1947
1947
|
"Expected enabled to be a boolean or a callback that returns a boolean"
|
|
1948
1948
|
);
|
|
1949
|
-
this.#N(), this.#t.setOptions(this.options), t._defaulted && !
|
|
1949
|
+
this.#N(), this.#t.setOptions(this.options), t._defaulted && !et(this.options, t) && this.#e.getQueryCache().notify({
|
|
1950
1950
|
type: "observerOptionsUpdated",
|
|
1951
1951
|
query: this.#t,
|
|
1952
1952
|
observer: this
|
|
1953
1953
|
});
|
|
1954
1954
|
const r = this.hasListeners();
|
|
1955
|
-
r &&
|
|
1955
|
+
r && Jt(
|
|
1956
1956
|
this.#t,
|
|
1957
1957
|
s,
|
|
1958
1958
|
this.options,
|
|
1959
1959
|
t
|
|
1960
|
-
) && this.#d(), this.updateResult(), r && (this.#t !== s ||
|
|
1960
|
+
) && this.#d(), this.updateResult(), r && (this.#t !== s || ve(this.options.enabled, this.#t) !== ve(t.enabled, this.#t) || Fe(this.options.staleTime, this.#t) !== Fe(t.staleTime, this.#t)) && this.#y();
|
|
1961
1961
|
const n = this.#g();
|
|
1962
|
-
r && (this.#t !== s ||
|
|
1962
|
+
r && (this.#t !== s || ve(this.options.enabled, this.#t) !== ve(t.enabled, this.#t) || n !== this.#l) && this.#v(n);
|
|
1963
1963
|
}
|
|
1964
1964
|
getOptimisticResult(e) {
|
|
1965
1965
|
const t = this.#e.getQueryCache().build(this.#e, e), s = this.createResult(t, e);
|
|
@@ -2004,18 +2004,18 @@ var Lr = class extends Be {
|
|
|
2004
2004
|
this.options,
|
|
2005
2005
|
e
|
|
2006
2006
|
);
|
|
2007
|
-
return e?.throwOnError || (t = t.catch(
|
|
2007
|
+
return e?.throwOnError || (t = t.catch(he)), t;
|
|
2008
2008
|
}
|
|
2009
2009
|
#y() {
|
|
2010
2010
|
this.#S();
|
|
2011
|
-
const e =
|
|
2011
|
+
const e = Fe(
|
|
2012
2012
|
this.options.staleTime,
|
|
2013
2013
|
this.#t
|
|
2014
2014
|
);
|
|
2015
|
-
if (
|
|
2015
|
+
if (Le || this.#n.isStale || !dt(e))
|
|
2016
2016
|
return;
|
|
2017
|
-
const s =
|
|
2018
|
-
this.#c =
|
|
2017
|
+
const s = cs(this.#n.dataUpdatedAt, e) + 1;
|
|
2018
|
+
this.#c = Ue.setTimeout(() => {
|
|
2019
2019
|
this.#n.isStale || this.updateResult();
|
|
2020
2020
|
}, s);
|
|
2021
2021
|
}
|
|
@@ -2023,105 +2023,105 @@ var Lr = class extends Be {
|
|
|
2023
2023
|
return (typeof this.options.refetchInterval == "function" ? this.options.refetchInterval(this.#t) : this.options.refetchInterval) ?? !1;
|
|
2024
2024
|
}
|
|
2025
2025
|
#v(e) {
|
|
2026
|
-
this.#A(), this.#l = e, !(
|
|
2027
|
-
(this.options.refetchIntervalInBackground ||
|
|
2026
|
+
this.#A(), this.#l = e, !(Le || ve(this.options.enabled, this.#t) === !1 || !dt(this.#l) || this.#l === 0) && (this.#u = Ue.setInterval(() => {
|
|
2027
|
+
(this.options.refetchIntervalInBackground || It.isFocused()) && this.#d();
|
|
2028
2028
|
}, this.#l));
|
|
2029
2029
|
}
|
|
2030
2030
|
#b() {
|
|
2031
2031
|
this.#y(), this.#v(this.#g());
|
|
2032
2032
|
}
|
|
2033
2033
|
#S() {
|
|
2034
|
-
this.#c && (
|
|
2034
|
+
this.#c && (Ue.clearTimeout(this.#c), this.#c = void 0);
|
|
2035
2035
|
}
|
|
2036
2036
|
#A() {
|
|
2037
|
-
this.#u && (
|
|
2037
|
+
this.#u && (Ue.clearInterval(this.#u), this.#u = void 0);
|
|
2038
2038
|
}
|
|
2039
2039
|
createResult(e, t) {
|
|
2040
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: d } = e;
|
|
2041
|
-
let c = { ...d },
|
|
2041
|
+
let c = { ...d }, A = !1, f;
|
|
2042
2042
|
if (t._optimisticResults) {
|
|
2043
|
-
const
|
|
2044
|
-
(
|
|
2043
|
+
const Y = this.hasListeners(), I = !Y && Vt(e, t), C = Y && Jt(e, s, t, r);
|
|
2044
|
+
(I || C) && (c = {
|
|
2045
2045
|
...c,
|
|
2046
|
-
...
|
|
2046
|
+
...ms(d.data, e.options)
|
|
2047
2047
|
}), t._optimisticResults === "isRestoring" && (c.fetchStatus = "idle");
|
|
2048
2048
|
}
|
|
2049
|
-
let { error:
|
|
2049
|
+
let { error: k, errorUpdatedAt: N, status: y } = c;
|
|
2050
2050
|
f = c.data;
|
|
2051
|
-
let
|
|
2052
|
-
if (t.placeholderData !== void 0 && f === void 0 &&
|
|
2053
|
-
let
|
|
2054
|
-
n?.isPlaceholderData && t.placeholderData === o?.placeholderData ? (
|
|
2051
|
+
let b = !1;
|
|
2052
|
+
if (t.placeholderData !== void 0 && f === void 0 && y === "pending") {
|
|
2053
|
+
let Y;
|
|
2054
|
+
n?.isPlaceholderData && t.placeholderData === o?.placeholderData ? (Y = n.data, b = !0) : Y = typeof t.placeholderData == "function" ? t.placeholderData(
|
|
2055
2055
|
this.#f?.state.data,
|
|
2056
2056
|
this.#f
|
|
2057
|
-
) : t.placeholderData,
|
|
2057
|
+
) : t.placeholderData, Y !== void 0 && (y = "success", f = mt(
|
|
2058
2058
|
n?.data,
|
|
2059
|
-
|
|
2059
|
+
Y,
|
|
2060
2060
|
t
|
|
2061
|
-
),
|
|
2061
|
+
), A = !0);
|
|
2062
2062
|
}
|
|
2063
|
-
if (t.select && f !== void 0 && !
|
|
2063
|
+
if (t.select && f !== void 0 && !b)
|
|
2064
2064
|
if (n && f === a?.data && t.select === this.#p)
|
|
2065
2065
|
f = this.#h;
|
|
2066
2066
|
else
|
|
2067
2067
|
try {
|
|
2068
|
-
this.#p = t.select, f = t.select(f), f =
|
|
2069
|
-
} catch (
|
|
2070
|
-
this.#i =
|
|
2068
|
+
this.#p = t.select, f = t.select(f), f = mt(n?.data, f, t), this.#h = f, this.#i = null;
|
|
2069
|
+
} catch (Y) {
|
|
2070
|
+
this.#i = Y;
|
|
2071
2071
|
}
|
|
2072
|
-
this.#i && (
|
|
2073
|
-
const $ = c.fetchStatus === "fetching",
|
|
2074
|
-
status:
|
|
2072
|
+
this.#i && (k = this.#i, f = this.#h, N = Date.now(), y = "error");
|
|
2073
|
+
const $ = c.fetchStatus === "fetching", M = y === "pending", B = y === "error", U = M && $, V = f !== void 0, W = {
|
|
2074
|
+
status: y,
|
|
2075
2075
|
fetchStatus: c.fetchStatus,
|
|
2076
|
-
isPending:
|
|
2077
|
-
isSuccess:
|
|
2076
|
+
isPending: M,
|
|
2077
|
+
isSuccess: y === "success",
|
|
2078
2078
|
isError: B,
|
|
2079
2079
|
isInitialLoading: U,
|
|
2080
2080
|
isLoading: U,
|
|
2081
2081
|
data: f,
|
|
2082
2082
|
dataUpdatedAt: c.dataUpdatedAt,
|
|
2083
|
-
error:
|
|
2084
|
-
errorUpdatedAt:
|
|
2083
|
+
error: k,
|
|
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
2089
|
isFetchedAfterMount: c.dataUpdateCount > h.dataUpdateCount || c.errorUpdateCount > h.errorUpdateCount,
|
|
2090
2090
|
isFetching: $,
|
|
2091
|
-
isRefetching: $ && !
|
|
2092
|
-
isLoadingError: B && !
|
|
2091
|
+
isRefetching: $ && !M,
|
|
2092
|
+
isLoadingError: B && !V,
|
|
2093
2093
|
isPaused: c.fetchStatus === "paused",
|
|
2094
|
-
isPlaceholderData:
|
|
2095
|
-
isRefetchError: B &&
|
|
2096
|
-
isStale:
|
|
2094
|
+
isPlaceholderData: A,
|
|
2095
|
+
isRefetchError: B && V,
|
|
2096
|
+
isStale: Tt(e, t),
|
|
2097
2097
|
refetch: this.refetch,
|
|
2098
2098
|
promise: this.#o,
|
|
2099
|
-
isEnabled:
|
|
2099
|
+
isEnabled: ve(t.enabled, e) !== !1
|
|
2100
2100
|
};
|
|
2101
2101
|
if (this.options.experimental_prefetchInRender) {
|
|
2102
|
-
const
|
|
2103
|
-
|
|
2104
|
-
},
|
|
2105
|
-
const
|
|
2106
|
-
|
|
2107
|
-
},
|
|
2108
|
-
switch (
|
|
2102
|
+
const Y = W.data !== void 0, I = W.status === "error" && !Y, C = (ee) => {
|
|
2103
|
+
I ? ee.reject(W.error) : Y && ee.resolve(W.data);
|
|
2104
|
+
}, T = () => {
|
|
2105
|
+
const ee = this.#o = W.promise = pt();
|
|
2106
|
+
C(ee);
|
|
2107
|
+
}, Z = this.#o;
|
|
2108
|
+
switch (Z.status) {
|
|
2109
2109
|
case "pending":
|
|
2110
|
-
e.queryHash === s.queryHash &&
|
|
2110
|
+
e.queryHash === s.queryHash && C(Z);
|
|
2111
2111
|
break;
|
|
2112
2112
|
case "fulfilled":
|
|
2113
|
-
(
|
|
2113
|
+
(I || W.data !== Z.value) && T();
|
|
2114
2114
|
break;
|
|
2115
2115
|
case "rejected":
|
|
2116
|
-
(!
|
|
2116
|
+
(!I || W.error !== Z.reason) && T();
|
|
2117
2117
|
break;
|
|
2118
2118
|
}
|
|
2119
2119
|
}
|
|
2120
|
-
return
|
|
2120
|
+
return W;
|
|
2121
2121
|
}
|
|
2122
2122
|
updateResult() {
|
|
2123
2123
|
const e = this.#n, t = this.createResult(this.#t, this.options);
|
|
2124
|
-
if (this.#r = this.#t.state, this.#a = this.options, this.#r.data !== void 0 && (this.#f = this.#t),
|
|
2124
|
+
if (this.#r = this.#t.state, this.#a = this.options, this.#r.data !== void 0 && (this.#f = this.#t), et(t, e))
|
|
2125
2125
|
return;
|
|
2126
2126
|
this.#n = t;
|
|
2127
2127
|
const s = () => {
|
|
@@ -2151,7 +2151,7 @@ var Lr = class extends Be {
|
|
|
2151
2151
|
this.updateResult(), this.hasListeners() && this.#b();
|
|
2152
2152
|
}
|
|
2153
2153
|
#w(e) {
|
|
2154
|
-
|
|
2154
|
+
oe.batch(() => {
|
|
2155
2155
|
e.listeners && this.listeners.forEach((t) => {
|
|
2156
2156
|
t(this.#n);
|
|
2157
2157
|
}), this.#e.getQueryCache().notify({
|
|
@@ -2162,74 +2162,74 @@ var Lr = class extends Be {
|
|
|
2162
2162
|
}
|
|
2163
2163
|
};
|
|
2164
2164
|
function $r(e, t) {
|
|
2165
|
-
return
|
|
2165
|
+
return ve(t.enabled, e) !== !1 && e.state.data === void 0 && !(e.state.status === "error" && t.retryOnMount === !1);
|
|
2166
2166
|
}
|
|
2167
|
-
function
|
|
2168
|
-
return $r(e, t) || e.state.data !== void 0 &&
|
|
2167
|
+
function Vt(e, t) {
|
|
2168
|
+
return $r(e, t) || e.state.data !== void 0 && gt(e, t, t.refetchOnMount);
|
|
2169
2169
|
}
|
|
2170
|
-
function
|
|
2171
|
-
if (
|
|
2170
|
+
function gt(e, t, s) {
|
|
2171
|
+
if (ve(t.enabled, e) !== !1 && Fe(t.staleTime, e) !== "static") {
|
|
2172
2172
|
const r = typeof s == "function" ? s(e) : s;
|
|
2173
|
-
return r === "always" || r !== !1 &&
|
|
2173
|
+
return r === "always" || r !== !1 && Tt(e, t);
|
|
2174
2174
|
}
|
|
2175
2175
|
return !1;
|
|
2176
2176
|
}
|
|
2177
|
-
function
|
|
2178
|
-
return (e !== t ||
|
|
2177
|
+
function Jt(e, t, s, r) {
|
|
2178
|
+
return (e !== t || ve(r.enabled, e) === !1) && (!s.suspense || e.state.status !== "error") && Tt(e, s);
|
|
2179
2179
|
}
|
|
2180
|
-
function
|
|
2181
|
-
return
|
|
2180
|
+
function Tt(e, t) {
|
|
2181
|
+
return ve(t.enabled, e) !== !1 && e.isStaleByTime(Fe(t.staleTime, e));
|
|
2182
2182
|
}
|
|
2183
2183
|
function Br(e, t) {
|
|
2184
|
-
return !
|
|
2184
|
+
return !et(e.getCurrentResult(), t);
|
|
2185
2185
|
}
|
|
2186
|
-
function
|
|
2186
|
+
function Xt(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
2190
|
let l = { pages: [], pageParams: [] }, h = 0;
|
|
2191
2191
|
const d = async () => {
|
|
2192
2192
|
let c = !1;
|
|
2193
|
-
const
|
|
2193
|
+
const A = (N) => {
|
|
2194
2194
|
Or(
|
|
2195
|
-
|
|
2195
|
+
N,
|
|
2196
2196
|
() => t.signal,
|
|
2197
2197
|
() => c = !0
|
|
2198
2198
|
);
|
|
2199
|
-
}, f =
|
|
2199
|
+
}, f = us(t.options, t.fetchOptions), k = async (N, y, b) => {
|
|
2200
2200
|
if (c)
|
|
2201
2201
|
return Promise.reject();
|
|
2202
|
-
if (
|
|
2203
|
-
return Promise.resolve(
|
|
2204
|
-
const
|
|
2205
|
-
const
|
|
2202
|
+
if (y == null && N.pages.length)
|
|
2203
|
+
return Promise.resolve(N);
|
|
2204
|
+
const M = (() => {
|
|
2205
|
+
const K = {
|
|
2206
2206
|
client: t.client,
|
|
2207
2207
|
queryKey: t.queryKey,
|
|
2208
|
-
pageParam:
|
|
2209
|
-
direction:
|
|
2208
|
+
pageParam: y,
|
|
2209
|
+
direction: b ? "backward" : "forward",
|
|
2210
2210
|
meta: t.options.meta
|
|
2211
2211
|
};
|
|
2212
|
-
return
|
|
2213
|
-
})(), B = await f(
|
|
2212
|
+
return A(K), K;
|
|
2213
|
+
})(), B = await f(M), { maxPages: U } = t.options, V = b ? kr : Rr;
|
|
2214
2214
|
return {
|
|
2215
|
-
pages:
|
|
2216
|
-
pageParams:
|
|
2215
|
+
pages: V(N.pages, B, U),
|
|
2216
|
+
pageParams: V(N.pageParams, y, U)
|
|
2217
2217
|
};
|
|
2218
2218
|
};
|
|
2219
2219
|
if (n && a.length) {
|
|
2220
|
-
const
|
|
2220
|
+
const N = n === "backward", y = N ? jr : Zt, b = {
|
|
2221
2221
|
pages: a,
|
|
2222
2222
|
pageParams: o
|
|
2223
|
-
}, $ =
|
|
2224
|
-
l = await
|
|
2223
|
+
}, $ = y(r, b);
|
|
2224
|
+
l = await k(b, $, N);
|
|
2225
2225
|
} else {
|
|
2226
|
-
const
|
|
2226
|
+
const N = e ?? a.length;
|
|
2227
2227
|
do {
|
|
2228
|
-
const
|
|
2229
|
-
if (h > 0 &&
|
|
2228
|
+
const y = h === 0 ? o[0] ?? r.initialPageParam : Zt(r, l);
|
|
2229
|
+
if (h > 0 && y == null)
|
|
2230
2230
|
break;
|
|
2231
|
-
l = await
|
|
2232
|
-
} while (h <
|
|
2231
|
+
l = await k(l, y), h++;
|
|
2232
|
+
} while (h < N);
|
|
2233
2233
|
}
|
|
2234
2234
|
return l;
|
|
2235
2235
|
};
|
|
@@ -2246,7 +2246,7 @@ function Jt(e) {
|
|
|
2246
2246
|
}
|
|
2247
2247
|
};
|
|
2248
2248
|
}
|
|
2249
|
-
function
|
|
2249
|
+
function Zt(e, { pages: t, pageParams: s }) {
|
|
2250
2250
|
const r = t.length - 1;
|
|
2251
2251
|
return t.length > 0 ? e.getNextPageParam(
|
|
2252
2252
|
t[r],
|
|
@@ -2258,13 +2258,13 @@ function Xt(e, { pages: t, pageParams: s }) {
|
|
|
2258
2258
|
function jr(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 Qr = class extends
|
|
2261
|
+
var Qr = class extends fs {
|
|
2262
2262
|
#e;
|
|
2263
2263
|
#t;
|
|
2264
2264
|
#s;
|
|
2265
2265
|
#n;
|
|
2266
2266
|
constructor(e) {
|
|
2267
|
-
super(), this.#e = e.client, this.mutationId = e.mutationId, this.#s = e.mutationCache, this.#t = [], this.state = e.state ||
|
|
2267
|
+
super(), this.#e = e.client, this.mutationId = e.mutationId, this.#s = e.mutationCache, this.#t = [], this.state = e.state || ps(), this.setOptions(e.options), this.scheduleGc();
|
|
2268
2268
|
}
|
|
2269
2269
|
setOptions(e) {
|
|
2270
2270
|
this.options = e, this.updateGcTime(this.options.gcTime);
|
|
@@ -2301,7 +2301,7 @@ var Qr = class extends hs {
|
|
|
2301
2301
|
meta: this.options.meta,
|
|
2302
2302
|
mutationKey: this.options.mutationKey
|
|
2303
2303
|
};
|
|
2304
|
-
this.#n =
|
|
2304
|
+
this.#n = hs({
|
|
2305
2305
|
fn: () => this.options.mutationFn ? this.options.mutationFn(e, s) : Promise.reject(new Error("No mutationFn found")),
|
|
2306
2306
|
onFail: (a, o) => {
|
|
2307
2307
|
this.#r({ type: "failed", failureCount: a, error: o });
|
|
@@ -2320,7 +2320,7 @@ var Qr = class extends hs {
|
|
|
2320
2320
|
if (r)
|
|
2321
2321
|
t();
|
|
2322
2322
|
else {
|
|
2323
|
-
this.#r({ type: "pending", variables: e, isPaused: n }), await this.#s.config.onMutate
|
|
2323
|
+
this.#r({ type: "pending", variables: e, isPaused: n }), this.#s.config.onMutate && await this.#s.config.onMutate(
|
|
2324
2324
|
e,
|
|
2325
2325
|
this,
|
|
2326
2326
|
s
|
|
@@ -2466,7 +2466,7 @@ var Qr = class extends hs {
|
|
|
2466
2466
|
};
|
|
2467
2467
|
}
|
|
2468
2468
|
};
|
|
2469
|
-
this.state = t(this.state),
|
|
2469
|
+
this.state = t(this.state), oe.batch(() => {
|
|
2470
2470
|
this.#t.forEach((s) => {
|
|
2471
2471
|
s.onMutationUpdate(e);
|
|
2472
2472
|
}), this.#s.notify({
|
|
@@ -2477,7 +2477,7 @@ var Qr = class extends hs {
|
|
|
2477
2477
|
});
|
|
2478
2478
|
}
|
|
2479
2479
|
};
|
|
2480
|
-
function
|
|
2480
|
+
function ps() {
|
|
2481
2481
|
return {
|
|
2482
2482
|
context: void 0,
|
|
2483
2483
|
data: void 0,
|
|
@@ -2490,7 +2490,7 @@ function ms() {
|
|
|
2490
2490
|
submittedAt: 0
|
|
2491
2491
|
};
|
|
2492
2492
|
}
|
|
2493
|
-
var qr = class extends
|
|
2493
|
+
var qr = 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
|
}
|
|
@@ -2509,7 +2509,7 @@ var qr = class extends Be {
|
|
|
2509
2509
|
}
|
|
2510
2510
|
add(e) {
|
|
2511
2511
|
this.#e.add(e);
|
|
2512
|
-
const t =
|
|
2512
|
+
const t = Ve(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 qr = class extends Be {
|
|
|
2518
2518
|
}
|
|
2519
2519
|
remove(e) {
|
|
2520
2520
|
if (this.#e.delete(e)) {
|
|
2521
|
-
const t =
|
|
2521
|
+
const t = Ve(e);
|
|
2522
2522
|
if (typeof t == "string") {
|
|
2523
2523
|
const s = this.#t.get(t);
|
|
2524
2524
|
if (s)
|
|
@@ -2531,7 +2531,7 @@ var qr = class extends Be {
|
|
|
2531
2531
|
this.notify({ type: "removed", mutation: e });
|
|
2532
2532
|
}
|
|
2533
2533
|
canRun(e) {
|
|
2534
|
-
const t =
|
|
2534
|
+
const t = Ve(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 qr = class extends Be {
|
|
|
2541
2541
|
return !0;
|
|
2542
2542
|
}
|
|
2543
2543
|
runNext(e) {
|
|
2544
|
-
const t =
|
|
2544
|
+
const t = Ve(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
|
+
oe.batch(() => {
|
|
2549
2549
|
this.#e.forEach((e) => {
|
|
2550
2550
|
this.notify({ type: "removed", mutation: e });
|
|
2551
2551
|
}), this.#e.clear(), this.#t.clear();
|
|
@@ -2557,14 +2557,14 @@ var qr = class extends Be {
|
|
|
2557
2557
|
find(e) {
|
|
2558
2558
|
const t = { exact: !0, ...e };
|
|
2559
2559
|
return this.getAll().find(
|
|
2560
|
-
(s) =>
|
|
2560
|
+
(s) => Gt(t, s)
|
|
2561
2561
|
);
|
|
2562
2562
|
}
|
|
2563
2563
|
findAll(e = {}) {
|
|
2564
|
-
return this.getAll().filter((t) =>
|
|
2564
|
+
return this.getAll().filter((t) => Gt(e, t));
|
|
2565
2565
|
}
|
|
2566
2566
|
notify(e) {
|
|
2567
|
-
|
|
2567
|
+
oe.batch(() => {
|
|
2568
2568
|
this.listeners.forEach((t) => {
|
|
2569
2569
|
t(e);
|
|
2570
2570
|
});
|
|
@@ -2572,17 +2572,17 @@ var qr = class extends Be {
|
|
|
2572
2572
|
}
|
|
2573
2573
|
resumePausedMutations() {
|
|
2574
2574
|
const e = this.getAll().filter((t) => t.state.isPaused);
|
|
2575
|
-
return
|
|
2575
|
+
return oe.batch(
|
|
2576
2576
|
() => Promise.all(
|
|
2577
|
-
e.map((t) => t.continue().catch(
|
|
2577
|
+
e.map((t) => t.continue().catch(he))
|
|
2578
2578
|
)
|
|
2579
2579
|
);
|
|
2580
2580
|
}
|
|
2581
2581
|
};
|
|
2582
|
-
function
|
|
2582
|
+
function Ve(e) {
|
|
2583
2583
|
return e.options.scope?.id;
|
|
2584
2584
|
}
|
|
2585
|
-
var _r = class extends
|
|
2585
|
+
var _r = class extends Qe {
|
|
2586
2586
|
#e;
|
|
2587
2587
|
#t = void 0;
|
|
2588
2588
|
#s;
|
|
@@ -2595,11 +2595,11 @@ var _r = class extends Be {
|
|
|
2595
2595
|
}
|
|
2596
2596
|
setOptions(e) {
|
|
2597
2597
|
const t = this.options;
|
|
2598
|
-
this.options = this.#e.defaultMutationOptions(e),
|
|
2598
|
+
this.options = this.#e.defaultMutationOptions(e), et(this.options, t) || this.#e.getMutationCache().notify({
|
|
2599
2599
|
type: "observerOptionsUpdated",
|
|
2600
2600
|
mutation: this.#s,
|
|
2601
2601
|
observer: this
|
|
2602
|
-
}), t?.mutationKey && this.options.mutationKey &&
|
|
2602
|
+
}), t?.mutationKey && this.options.mutationKey && $e(t.mutationKey) !== $e(this.options.mutationKey) ? this.reset() : this.#s?.state.status === "pending" && this.#s.setOptions(this.options);
|
|
2603
2603
|
}
|
|
2604
2604
|
onUnsubscribe() {
|
|
2605
2605
|
this.hasListeners() || this.#s?.removeObserver(this);
|
|
@@ -2617,7 +2617,7 @@ var _r = class extends Be {
|
|
|
2617
2617
|
return this.#n = t, this.#s?.removeObserver(this), this.#s = this.#e.getMutationCache().build(this.#e, this.options), this.#s.addObserver(this), this.#s.execute(e);
|
|
2618
2618
|
}
|
|
2619
2619
|
#r() {
|
|
2620
|
-
const e = this.#s?.state ??
|
|
2620
|
+
const e = this.#s?.state ?? ps();
|
|
2621
2621
|
this.#t = {
|
|
2622
2622
|
...e,
|
|
2623
2623
|
isPending: e.status === "pending",
|
|
@@ -2629,7 +2629,7 @@ var _r = class extends Be {
|
|
|
2629
2629
|
};
|
|
2630
2630
|
}
|
|
2631
2631
|
#a(e) {
|
|
2632
|
-
|
|
2632
|
+
oe.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,13 +2687,13 @@ var _r = class extends Be {
|
|
|
2687
2687
|
});
|
|
2688
2688
|
});
|
|
2689
2689
|
}
|
|
2690
|
-
}, Hr = class extends
|
|
2690
|
+
}, Hr = class extends Qe {
|
|
2691
2691
|
constructor(e = {}) {
|
|
2692
2692
|
super(), this.config = e, this.#e = /* @__PURE__ */ new Map();
|
|
2693
2693
|
}
|
|
2694
2694
|
#e;
|
|
2695
2695
|
build(e, t, s) {
|
|
2696
|
-
const r = t.queryKey, n = t.queryHash ??
|
|
2696
|
+
const r = t.queryKey, n = t.queryHash ?? xt(r, t);
|
|
2697
2697
|
let a = this.get(n);
|
|
2698
2698
|
return a || (a = new Ur({
|
|
2699
2699
|
client: e,
|
|
@@ -2715,7 +2715,7 @@ var _r = class extends Be {
|
|
|
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
|
+
oe.batch(() => {
|
|
2719
2719
|
this.getAll().forEach((e) => {
|
|
2720
2720
|
this.remove(e);
|
|
2721
2721
|
});
|
|
@@ -2730,29 +2730,29 @@ var _r = class extends Be {
|
|
|
2730
2730
|
find(e) {
|
|
2731
2731
|
const t = { exact: !0, ...e };
|
|
2732
2732
|
return this.getAll().find(
|
|
2733
|
-
(s) =>
|
|
2733
|
+
(s) => Ht(t, s)
|
|
2734
2734
|
);
|
|
2735
2735
|
}
|
|
2736
2736
|
findAll(e = {}) {
|
|
2737
2737
|
const t = this.getAll();
|
|
2738
|
-
return Object.keys(e).length > 0 ? t.filter((s) =>
|
|
2738
|
+
return Object.keys(e).length > 0 ? t.filter((s) => Ht(e, s)) : t;
|
|
2739
2739
|
}
|
|
2740
2740
|
notify(e) {
|
|
2741
|
-
|
|
2741
|
+
oe.batch(() => {
|
|
2742
2742
|
this.listeners.forEach((t) => {
|
|
2743
2743
|
t(e);
|
|
2744
2744
|
});
|
|
2745
2745
|
});
|
|
2746
2746
|
}
|
|
2747
2747
|
onFocus() {
|
|
2748
|
-
|
|
2748
|
+
oe.batch(() => {
|
|
2749
2749
|
this.getAll().forEach((e) => {
|
|
2750
2750
|
e.onFocus();
|
|
2751
2751
|
});
|
|
2752
2752
|
});
|
|
2753
2753
|
}
|
|
2754
2754
|
onOnline() {
|
|
2755
|
-
|
|
2755
|
+
oe.batch(() => {
|
|
2756
2756
|
this.getAll().forEach((e) => {
|
|
2757
2757
|
e.onOnline();
|
|
2758
2758
|
});
|
|
@@ -2771,9 +2771,9 @@ var _r = class extends Be {
|
|
|
2771
2771
|
this.#e = e.queryCache || new Hr(), this.#t = e.mutationCache || new qr(), this.#s = e.defaultOptions || {}, this.#n = /* @__PURE__ */ new Map(), this.#r = /* @__PURE__ */ new Map(), this.#a = 0;
|
|
2772
2772
|
}
|
|
2773
2773
|
mount() {
|
|
2774
|
-
this.#a++, this.#a === 1 && (this.#o =
|
|
2774
|
+
this.#a++, this.#a === 1 && (this.#o = It.subscribe(async (e) => {
|
|
2775
2775
|
e && (await this.resumePausedMutations(), this.#e.onFocus());
|
|
2776
|
-
}), this.#i =
|
|
2776
|
+
}), this.#i = st.subscribe(async (e) => {
|
|
2777
2777
|
e && (await this.resumePausedMutations(), this.#e.onOnline());
|
|
2778
2778
|
}));
|
|
2779
2779
|
}
|
|
@@ -2799,7 +2799,7 @@ var _r = class extends Be {
|
|
|
2799
2799
|
}
|
|
2800
2800
|
ensureQueryData(e) {
|
|
2801
2801
|
const t = this.defaultQueryOptions(e), s = this.#e.build(this, t), r = s.state.data;
|
|
2802
|
-
return r === void 0 ? this.fetchQuery(e) : (e.revalidateIfStale && s.isStaleByTime(
|
|
2802
|
+
return r === void 0 ? this.fetchQuery(e) : (e.revalidateIfStale && s.isStaleByTime(Fe(t.staleTime, s)) && this.prefetchQuery(t), Promise.resolve(r));
|
|
2803
2803
|
}
|
|
2804
2804
|
getQueriesData(e) {
|
|
2805
2805
|
return this.#e.findAll(e).map(({ queryKey: t, state: s }) => {
|
|
@@ -2810,12 +2810,12 @@ var _r = class extends Be {
|
|
|
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 = Cr(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 oe.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 _r = class extends Be {
|
|
|
2830
2830
|
}
|
|
2831
2831
|
removeQueries(e) {
|
|
2832
2832
|
const t = this.#e;
|
|
2833
|
-
|
|
2833
|
+
oe.batch(() => {
|
|
2834
2834
|
t.findAll(e).forEach((s) => {
|
|
2835
2835
|
t.remove(s);
|
|
2836
2836
|
});
|
|
@@ -2838,7 +2838,7 @@ var _r = class extends Be {
|
|
|
2838
2838
|
}
|
|
2839
2839
|
resetQueries(e, t) {
|
|
2840
2840
|
const s = this.#e;
|
|
2841
|
-
return
|
|
2841
|
+
return oe.batch(() => (s.findAll(e).forEach((r) => {
|
|
2842
2842
|
r.reset();
|
|
2843
2843
|
}), this.refetchQueries(
|
|
2844
2844
|
{
|
|
@@ -2849,13 +2849,13 @@ var _r = class extends Be {
|
|
|
2849
2849
|
)));
|
|
2850
2850
|
}
|
|
2851
2851
|
cancelQueries(e, t = {}) {
|
|
2852
|
-
const s = { revert: !0, ...t }, r =
|
|
2852
|
+
const s = { revert: !0, ...t }, r = oe.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(he).catch(he);
|
|
2856
2856
|
}
|
|
2857
2857
|
invalidateQueries(e, t = {}) {
|
|
2858
|
-
return
|
|
2858
|
+
return oe.batch(() => (this.#e.findAll(e).forEach((s) => {
|
|
2859
2859
|
s.invalidate();
|
|
2860
2860
|
}), e?.refetchType === "none" ? Promise.resolve() : this.refetchQueries(
|
|
2861
2861
|
{
|
|
@@ -2869,36 +2869,36 @@ var _r = class extends Be {
|
|
|
2869
2869
|
const s = {
|
|
2870
2870
|
...t,
|
|
2871
2871
|
cancelRefetch: t.cancelRefetch ?? !0
|
|
2872
|
-
}, r =
|
|
2872
|
+
}, r = oe.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(he)), n.state.fetchStatus === "paused" ? Promise.resolve() : a;
|
|
2876
2876
|
})
|
|
2877
2877
|
);
|
|
2878
|
-
return Promise.all(r).then(
|
|
2878
|
+
return Promise.all(r).then(he);
|
|
2879
2879
|
}
|
|
2880
2880
|
fetchQuery(e) {
|
|
2881
2881
|
const t = this.defaultQueryOptions(e);
|
|
2882
2882
|
t.retry === void 0 && (t.retry = !1);
|
|
2883
2883
|
const s = this.#e.build(this, t);
|
|
2884
2884
|
return s.isStaleByTime(
|
|
2885
|
-
|
|
2885
|
+
Fe(t.staleTime, s)
|
|
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(he).catch(he);
|
|
2890
2890
|
}
|
|
2891
2891
|
fetchInfiniteQuery(e) {
|
|
2892
|
-
return e.behavior =
|
|
2892
|
+
return e.behavior = Xt(e.pages), this.fetchQuery(e);
|
|
2893
2893
|
}
|
|
2894
2894
|
prefetchInfiniteQuery(e) {
|
|
2895
|
-
return this.fetchInfiniteQuery(e).then(
|
|
2895
|
+
return this.fetchInfiniteQuery(e).then(he).catch(he);
|
|
2896
2896
|
}
|
|
2897
2897
|
ensureInfiniteQueryData(e) {
|
|
2898
|
-
return e.behavior =
|
|
2898
|
+
return e.behavior = Xt(e.pages), this.ensureQueryData(e);
|
|
2899
2899
|
}
|
|
2900
2900
|
resumePausedMutations() {
|
|
2901
|
-
return
|
|
2901
|
+
return st.isOnline() ? this.#t.resumePausedMutations() : Promise.resolve();
|
|
2902
2902
|
}
|
|
2903
2903
|
getQueryCache() {
|
|
2904
2904
|
return this.#e;
|
|
@@ -2913,7 +2913,7 @@ var _r = class extends Be {
|
|
|
2913
2913
|
this.#s = e;
|
|
2914
2914
|
}
|
|
2915
2915
|
setQueryDefaults(e, t) {
|
|
2916
|
-
this.#n.set(
|
|
2916
|
+
this.#n.set($e(e), {
|
|
2917
2917
|
queryKey: e,
|
|
2918
2918
|
defaultOptions: t
|
|
2919
2919
|
});
|
|
@@ -2921,11 +2921,11 @@ var _r = class extends Be {
|
|
|
2921
2921
|
getQueryDefaults(e) {
|
|
2922
2922
|
const t = [...this.#n.values()], s = {};
|
|
2923
2923
|
return t.forEach((r) => {
|
|
2924
|
-
|
|
2924
|
+
Ge(e, r.queryKey) && Object.assign(s, r.defaultOptions);
|
|
2925
2925
|
}), s;
|
|
2926
2926
|
}
|
|
2927
2927
|
setMutationDefaults(e, t) {
|
|
2928
|
-
this.#r.set(
|
|
2928
|
+
this.#r.set($e(e), {
|
|
2929
2929
|
mutationKey: e,
|
|
2930
2930
|
defaultOptions: t
|
|
2931
2931
|
});
|
|
@@ -2933,7 +2933,7 @@ var _r = class extends Be {
|
|
|
2933
2933
|
getMutationDefaults(e) {
|
|
2934
2934
|
const t = [...this.#r.values()], s = {};
|
|
2935
2935
|
return t.forEach((r) => {
|
|
2936
|
-
|
|
2936
|
+
Ge(e, r.mutationKey) && Object.assign(s, r.defaultOptions);
|
|
2937
2937
|
}), s;
|
|
2938
2938
|
}
|
|
2939
2939
|
defaultQueryOptions(e) {
|
|
@@ -2945,10 +2945,10 @@ var _r = class extends Be {
|
|
|
2945
2945
|
...e,
|
|
2946
2946
|
_defaulted: !0
|
|
2947
2947
|
};
|
|
2948
|
-
return t.queryHash || (t.queryHash =
|
|
2948
|
+
return t.queryHash || (t.queryHash = xt(
|
|
2949
2949
|
t.queryKey,
|
|
2950
2950
|
t
|
|
2951
|
-
)), t.refetchOnReconnect === void 0 && (t.refetchOnReconnect = t.networkMode !== "always"), t.throwOnError === void 0 && (t.throwOnError = !!t.suspense), !t.networkMode && t.persister && (t.networkMode = "offlineFirst"), t.queryFn ===
|
|
2951
|
+
)), t.refetchOnReconnect === void 0 && (t.refetchOnReconnect = t.networkMode !== "always"), t.throwOnError === void 0 && (t.throwOnError = !!t.suspense), !t.networkMode && t.persister && (t.networkMode = "offlineFirst"), t.queryFn === tt && (t.enabled = !1), t;
|
|
2952
2952
|
}
|
|
2953
2953
|
defaultMutationOptions(e) {
|
|
2954
2954
|
return e?._defaulted ? e : {
|
|
@@ -2961,10 +2961,10 @@ var _r = class extends Be {
|
|
|
2961
2961
|
clear() {
|
|
2962
2962
|
this.#e.clear(), this.#t.clear();
|
|
2963
2963
|
}
|
|
2964
|
-
},
|
|
2964
|
+
}, ys = ce.createContext(
|
|
2965
2965
|
void 0
|
|
2966
|
-
),
|
|
2967
|
-
const t = ce.useContext(
|
|
2966
|
+
), Rt = (e) => {
|
|
2967
|
+
const t = ce.useContext(ys);
|
|
2968
2968
|
if (!t)
|
|
2969
2969
|
throw new Error("No QueryClient set, use QueryClientProvider to set one");
|
|
2970
2970
|
return t;
|
|
@@ -2973,8 +2973,8 @@ var _r = class extends Be {
|
|
|
2973
2973
|
children: t
|
|
2974
2974
|
}) => (ce.useEffect(() => (e.mount(), () => {
|
|
2975
2975
|
e.unmount();
|
|
2976
|
-
}), [e]), /* @__PURE__ */ i(
|
|
2977
|
-
|
|
2976
|
+
}), [e]), /* @__PURE__ */ i(ys.Provider, { value: e, children: t })), gs = ce.createContext(!1), Yr = () => ce.useContext(gs);
|
|
2977
|
+
gs.Provider;
|
|
2978
2978
|
function Kr() {
|
|
2979
2979
|
let e = !1;
|
|
2980
2980
|
return {
|
|
@@ -2988,7 +2988,7 @@ function Kr() {
|
|
|
2988
2988
|
};
|
|
2989
2989
|
}
|
|
2990
2990
|
var zr = ce.createContext(Kr()), Vr = () => ce.useContext(zr), Jr = (e, t, s) => {
|
|
2991
|
-
const r = s?.state.error && typeof e.throwOnError == "function" ?
|
|
2991
|
+
const r = s?.state.error && typeof e.throwOnError == "function" ? Ct(e.throwOnError, [s.state.error, s]) : e.throwOnError;
|
|
2992
2992
|
(e.suspense || e.experimental_prefetchInRender || r) && (t.isReset() || (e.retryOnMount = !1));
|
|
2993
2993
|
}, Xr = (e) => {
|
|
2994
2994
|
ce.useEffect(() => {
|
|
@@ -3000,7 +3000,7 @@ var zr = ce.createContext(Kr()), Vr = () => ce.useContext(zr), Jr = (e, t, s) =>
|
|
|
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 ||
|
|
3003
|
+
}) => e.isError && !t.isReset() && !e.isFetching && r && (n && e.data === void 0 || Ct(s, [e.error, r])), en = (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,7 +3008,7 @@ var zr = ce.createContext(Kr()), Vr = () => ce.useContext(zr), Jr = (e, t, s) =>
|
|
|
3008
3008
|
1e3
|
|
3009
3009
|
));
|
|
3010
3010
|
}
|
|
3011
|
-
}, tn = (e, t) => e.isLoading && e.isFetching && !t, sn = (e, t) => e?.suspense && t.isPending,
|
|
3011
|
+
}, tn = (e, t) => e.isLoading && e.isFetching && !t, sn = (e, t) => e?.suspense && t.isPending, es = (e, t, s) => t.fetchOptimistic(e).catch(() => {
|
|
3012
3012
|
s.clearReset();
|
|
3013
3013
|
});
|
|
3014
3014
|
function rn(e, t, s) {
|
|
@@ -3016,7 +3016,7 @@ function rn(e, t, s) {
|
|
|
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 = Yr(), n = Vr(), a =
|
|
3019
|
+
const r = Yr(), n = Vr(), a = Rt(), o = a.defaultQueryOptions(e);
|
|
3020
3020
|
a.getDefaultOptions().queries?._experimental_beforeQuery?.(
|
|
3021
3021
|
o
|
|
3022
3022
|
);
|
|
@@ -3029,21 +3029,21 @@ function rn(e, t, s) {
|
|
|
3029
3029
|
a,
|
|
3030
3030
|
o
|
|
3031
3031
|
)
|
|
3032
|
-
), c = d.getOptimisticResult(o),
|
|
3032
|
+
), c = d.getOptimisticResult(o), A = !r && e.subscribed !== !1;
|
|
3033
3033
|
if (ce.useSyncExternalStore(
|
|
3034
3034
|
ce.useCallback(
|
|
3035
3035
|
(f) => {
|
|
3036
|
-
const
|
|
3037
|
-
return d.updateResult(),
|
|
3036
|
+
const k = A ? d.subscribe(oe.batchCalls(f)) : he;
|
|
3037
|
+
return d.updateResult(), k;
|
|
3038
3038
|
},
|
|
3039
|
-
[d,
|
|
3039
|
+
[d, A]
|
|
3040
3040
|
),
|
|
3041
3041
|
() => d.getCurrentResult(),
|
|
3042
3042
|
() => d.getCurrentResult()
|
|
3043
3043
|
), ce.useEffect(() => {
|
|
3044
3044
|
d.setOptions(o);
|
|
3045
3045
|
}, [o, d]), sn(o, c))
|
|
3046
|
-
throw
|
|
3046
|
+
throw es(o, d, n);
|
|
3047
3047
|
if (Zr({
|
|
3048
3048
|
result: c,
|
|
3049
3049
|
errorResetBoundary: n,
|
|
@@ -3055,21 +3055,21 @@ function rn(e, t, s) {
|
|
|
3055
3055
|
return a.getDefaultOptions().queries?._experimental_afterQuery?.(
|
|
3056
3056
|
o,
|
|
3057
3057
|
c
|
|
3058
|
-
), o.experimental_prefetchInRender && !
|
|
3058
|
+
), o.experimental_prefetchInRender && !Le && tn(c, r) && (h ? (
|
|
3059
3059
|
// Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted
|
|
3060
|
-
|
|
3060
|
+
es(o, d, 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(he).finally(() => {
|
|
3065
3065
|
d.updateResult();
|
|
3066
3066
|
}), o.notifyOnChangeProps ? c : d.trackResult(c);
|
|
3067
3067
|
}
|
|
3068
|
-
function
|
|
3068
|
+
function kt(e, t) {
|
|
3069
3069
|
return rn(e, Lr);
|
|
3070
3070
|
}
|
|
3071
3071
|
function nn(e, t) {
|
|
3072
|
-
const s =
|
|
3072
|
+
const s = Rt(), [r] = ce.useState(
|
|
3073
3073
|
() => new _r(
|
|
3074
3074
|
s,
|
|
3075
3075
|
e
|
|
@@ -3080,23 +3080,23 @@ function nn(e, t) {
|
|
|
3080
3080
|
}, [r, e]);
|
|
3081
3081
|
const n = ce.useSyncExternalStore(
|
|
3082
3082
|
ce.useCallback(
|
|
3083
|
-
(o) => r.subscribe(
|
|
3083
|
+
(o) => r.subscribe(oe.batchCalls(o)),
|
|
3084
3084
|
[r]
|
|
3085
3085
|
),
|
|
3086
3086
|
() => r.getCurrentResult(),
|
|
3087
3087
|
() => r.getCurrentResult()
|
|
3088
3088
|
), a = ce.useCallback(
|
|
3089
3089
|
(o, l) => {
|
|
3090
|
-
r.mutate(o, l).catch(
|
|
3090
|
+
r.mutate(o, l).catch(he);
|
|
3091
3091
|
},
|
|
3092
3092
|
[r]
|
|
3093
3093
|
);
|
|
3094
|
-
if (n.error &&
|
|
3094
|
+
if (n.error && Ct(r.options.throwOnError, [n.error]))
|
|
3095
3095
|
throw n.error;
|
|
3096
3096
|
return { ...n, mutate: a, mutateAsync: n.mutate };
|
|
3097
3097
|
}
|
|
3098
|
-
function
|
|
3099
|
-
const { alerts: e } =
|
|
3098
|
+
function vs() {
|
|
3099
|
+
const { alerts: e } = xe(), t = Rt();
|
|
3100
3100
|
return nn({
|
|
3101
3101
|
mutationFn: (s) => e.updateAlertStatus(s),
|
|
3102
3102
|
onSuccess: () => {
|
|
@@ -3136,7 +3136,7 @@ function ln(e) {
|
|
|
3136
3136
|
return "-";
|
|
3137
3137
|
}
|
|
3138
3138
|
}
|
|
3139
|
-
function
|
|
3139
|
+
function vt(e) {
|
|
3140
3140
|
if (!e) return "-";
|
|
3141
3141
|
try {
|
|
3142
3142
|
return new Date(e).toLocaleString("en-US", {
|
|
@@ -3171,21 +3171,21 @@ function dn({
|
|
|
3171
3171
|
spaceOptions: a,
|
|
3172
3172
|
onAlertIdClick: o
|
|
3173
3173
|
}) {
|
|
3174
|
-
const l =
|
|
3174
|
+
const l = vs(), h = ["completed", "false positive"], d = async (f) => {
|
|
3175
3175
|
try {
|
|
3176
|
-
const
|
|
3176
|
+
const k = 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
|
|
3185
|
-
ne.success(
|
|
3183
|
+
if (k?.responseStatus) {
|
|
3184
|
+
const N = k?.data || "Alert reopened successfully.";
|
|
3185
|
+
ne.success(N);
|
|
3186
3186
|
} else {
|
|
3187
|
-
const
|
|
3188
|
-
ne.error(
|
|
3187
|
+
const N = k?.errorMessage || "Failed to reopen alert";
|
|
3188
|
+
ne.error(N);
|
|
3189
3189
|
}
|
|
3190
3190
|
} catch {
|
|
3191
3191
|
ne.error("Failed to reopen alert. Please try again.");
|
|
@@ -3197,7 +3197,7 @@ function dn({
|
|
|
3197
3197
|
key: "priority",
|
|
3198
3198
|
width: 120,
|
|
3199
3199
|
render: (f) => /* @__PURE__ */ i(
|
|
3200
|
-
|
|
3200
|
+
Ze,
|
|
3201
3201
|
{
|
|
3202
3202
|
className: "px-[10px] py-[2px]",
|
|
3203
3203
|
style: {
|
|
@@ -3225,15 +3225,15 @@ function dn({
|
|
|
3225
3225
|
title: "Description",
|
|
3226
3226
|
dataIndex: "description",
|
|
3227
3227
|
key: "description",
|
|
3228
|
-
render: (f,
|
|
3228
|
+
render: (f, k) => /* @__PURE__ */ u("div", { children: [
|
|
3229
3229
|
/* @__PURE__ */ i(
|
|
3230
3230
|
"a",
|
|
3231
3231
|
{
|
|
3232
|
-
onClick: (
|
|
3233
|
-
|
|
3232
|
+
onClick: (N) => {
|
|
3233
|
+
N.preventDefault(), o?.(k, { sourceTab: "archived" });
|
|
3234
3234
|
},
|
|
3235
3235
|
className: "inline-block mb-1 text-blue-600",
|
|
3236
|
-
children:
|
|
3236
|
+
children: k.alertNumber
|
|
3237
3237
|
}
|
|
3238
3238
|
),
|
|
3239
3239
|
/* @__PURE__ */ i("div", { className: "text-black/65", children: f })
|
|
@@ -3244,7 +3244,7 @@ function dn({
|
|
|
3244
3244
|
key: "menu",
|
|
3245
3245
|
width: 60,
|
|
3246
3246
|
align: "right",
|
|
3247
|
-
render: (f,
|
|
3247
|
+
render: (f, k) => /* @__PURE__ */ i(
|
|
3248
3248
|
Ps,
|
|
3249
3249
|
{
|
|
3250
3250
|
trigger: ["click"],
|
|
@@ -3252,21 +3252,21 @@ function dn({
|
|
|
3252
3252
|
items: [
|
|
3253
3253
|
{ key: "reopen", label: "Reopen" }
|
|
3254
3254
|
],
|
|
3255
|
-
onClick: ({ key:
|
|
3256
|
-
|
|
3255
|
+
onClick: ({ key: N }) => {
|
|
3256
|
+
N === "reopen" && d(k);
|
|
3257
3257
|
}
|
|
3258
3258
|
},
|
|
3259
|
-
children: /* @__PURE__ */ i(
|
|
3259
|
+
children: /* @__PURE__ */ i(ye, { type: "text", icon: /* @__PURE__ */ i(Ls, {}) })
|
|
3260
3260
|
}
|
|
3261
3261
|
)
|
|
3262
3262
|
}
|
|
3263
|
-
],
|
|
3263
|
+
], A = (e || []).filter(
|
|
3264
3264
|
(f) => h.includes((f.statusType || "").toLowerCase())
|
|
3265
3265
|
);
|
|
3266
3266
|
return /* @__PURE__ */ i(
|
|
3267
|
-
|
|
3267
|
+
ls,
|
|
3268
3268
|
{
|
|
3269
|
-
data:
|
|
3269
|
+
data: A,
|
|
3270
3270
|
loading: t,
|
|
3271
3271
|
pageSize: s,
|
|
3272
3272
|
columns: c,
|
|
@@ -3285,7 +3285,7 @@ function hn({
|
|
|
3285
3285
|
timeZone: s = "America/New_York"
|
|
3286
3286
|
}) {
|
|
3287
3287
|
const { hours: r, minutes: n, seconds: a } = ue(() => {
|
|
3288
|
-
const
|
|
3288
|
+
const A = new Intl.DateTimeFormat("en-US", {
|
|
3289
3289
|
timeZone: s,
|
|
3290
3290
|
hour: "numeric",
|
|
3291
3291
|
minute: "numeric",
|
|
@@ -3293,9 +3293,9 @@ function hn({
|
|
|
3293
3293
|
hour12: !1
|
|
3294
3294
|
}).formatToParts(t);
|
|
3295
3295
|
return {
|
|
3296
|
-
hours: parseInt(
|
|
3297
|
-
minutes: parseInt(
|
|
3298
|
-
seconds: parseInt(
|
|
3296
|
+
hours: parseInt(A.find((f) => f.type === "hour")?.value || "0", 10),
|
|
3297
|
+
minutes: parseInt(A.find((f) => f.type === "minute")?.value || "0", 10),
|
|
3298
|
+
seconds: parseInt(A.find((f) => f.type === "second")?.value || "0", 10)
|
|
3299
3299
|
};
|
|
3300
3300
|
}, [t, s]), o = a * 6, l = n * 6 + a * 0.1, h = r % 12 * 30 + n * 0.5, d = e / 2;
|
|
3301
3301
|
return /* @__PURE__ */ u(
|
|
@@ -3306,8 +3306,8 @@ function hn({
|
|
|
3306
3306
|
role: "img",
|
|
3307
3307
|
"aria-label": "Analog Clock",
|
|
3308
3308
|
children: [
|
|
3309
|
-
[...Array(12)].map((c,
|
|
3310
|
-
const f =
|
|
3309
|
+
[...Array(12)].map((c, A) => {
|
|
3310
|
+
const f = A * 30, k = 6, N = d - 4, y = N - k, b = (f - 90) * (Math.PI / 180), $ = d + y * Math.cos(b), M = d + y * Math.sin(b), B = d + N * Math.cos(b), U = d + N * Math.sin(b);
|
|
3311
3311
|
return /* @__PURE__ */ i(
|
|
3312
3312
|
"svg",
|
|
3313
3313
|
{
|
|
@@ -3318,16 +3318,16 @@ function hn({
|
|
|
3318
3318
|
"line",
|
|
3319
3319
|
{
|
|
3320
3320
|
x1: $,
|
|
3321
|
-
y1:
|
|
3321
|
+
y1: M,
|
|
3322
3322
|
x2: B,
|
|
3323
3323
|
y2: U,
|
|
3324
3324
|
stroke: "#9CA3AF",
|
|
3325
|
-
strokeWidth:
|
|
3325
|
+
strokeWidth: A % 3 === 0 ? 2 : 1,
|
|
3326
3326
|
strokeLinecap: "round"
|
|
3327
3327
|
}
|
|
3328
3328
|
)
|
|
3329
3329
|
},
|
|
3330
|
-
|
|
3330
|
+
A
|
|
3331
3331
|
);
|
|
3332
3332
|
}),
|
|
3333
3333
|
/* @__PURE__ */ i(
|
|
@@ -3410,8 +3410,8 @@ function hn({
|
|
|
3410
3410
|
);
|
|
3411
3411
|
}
|
|
3412
3412
|
function fn({ label: e = "USA", timeZone: t = "America/New_York", updateIntervalMs: s = 1e3, className: r }) {
|
|
3413
|
-
const [n, a] =
|
|
3414
|
-
|
|
3413
|
+
const [n, a] = x(/* @__PURE__ */ new Date());
|
|
3414
|
+
fe(() => {
|
|
3415
3415
|
const d = setInterval(() => a(/* @__PURE__ */ new Date()), s);
|
|
3416
3416
|
return () => clearInterval(d);
|
|
3417
3417
|
}, [s]);
|
|
@@ -3428,17 +3428,17 @@ function fn({ label: e = "USA", timeZone: t = "America/New_York", updateInterval
|
|
|
3428
3428
|
] })
|
|
3429
3429
|
] });
|
|
3430
3430
|
}
|
|
3431
|
-
const mn = [{ 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 }], pn = [{ 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" }], yn = [{ 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" }],
|
|
3431
|
+
const mn = [{ 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 }], pn = [{ 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" }], yn = [{ 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" }], je = {
|
|
3432
3432
|
severities: mn,
|
|
3433
3433
|
rules: pn,
|
|
3434
3434
|
userRoles: yn
|
|
3435
|
-
}, { Text: gn } =
|
|
3435
|
+
}, { Text: gn } = We;
|
|
3436
3436
|
function vn({ sortBy: e, onChange: t, showActions: s, onSave: r, onClear: n, saving: a }) {
|
|
3437
|
-
return /* @__PURE__ */ u(
|
|
3438
|
-
/* @__PURE__ */ i(H, { xs: 24, md: 8, lg: 5, children: /* @__PURE__ */ u(
|
|
3437
|
+
return /* @__PURE__ */ u(ge, { gutter: [16, 16], align: "middle", children: [
|
|
3438
|
+
/* @__PURE__ */ i(H, { xs: 24, md: 8, lg: 5, children: /* @__PURE__ */ u(we, { className: "w-full items-center", direction: "horizontal", size: 12, children: [
|
|
3439
3439
|
/* @__PURE__ */ i(gn, { className: "text-gray-600 whitespace-nowrap", children: "Sort By:" }),
|
|
3440
3440
|
/* @__PURE__ */ i(
|
|
3441
|
-
|
|
3441
|
+
pe,
|
|
3442
3442
|
{
|
|
3443
3443
|
placeholder: "By Severity",
|
|
3444
3444
|
value: e,
|
|
@@ -3452,13 +3452,13 @@ function vn({ sortBy: e, onChange: t, showActions: s, onSave: r, onClear: n, sav
|
|
|
3452
3452
|
}
|
|
3453
3453
|
)
|
|
3454
3454
|
] }) }),
|
|
3455
|
-
/* @__PURE__ */ i(H, { xs: 24, md: 8, style: { alignSelf: "end" }, children: s ? /* @__PURE__ */ u(
|
|
3456
|
-
/* @__PURE__ */ i(
|
|
3457
|
-
/* @__PURE__ */ i(
|
|
3455
|
+
/* @__PURE__ */ i(H, { xs: 24, md: 8, style: { alignSelf: "end" }, children: s ? /* @__PURE__ */ u(we, { className: "w-full", direction: "horizontal", size: 8, children: [
|
|
3456
|
+
/* @__PURE__ */ i(ye, { onClick: n, disabled: a, children: "Clear" }),
|
|
3457
|
+
/* @__PURE__ */ i(ye, { type: "primary", onClick: r, loading: a, children: "Save" })
|
|
3458
3458
|
] }) : null })
|
|
3459
3459
|
] });
|
|
3460
3460
|
}
|
|
3461
|
-
const { Text:
|
|
3461
|
+
const { Text: Pe } = We;
|
|
3462
3462
|
function bn(e) {
|
|
3463
3463
|
const {
|
|
3464
3464
|
// escBasis, setEscBasis,
|
|
@@ -3473,51 +3473,51 @@ function bn(e) {
|
|
|
3473
3473
|
l1role: h,
|
|
3474
3474
|
setL1role: d,
|
|
3475
3475
|
l2mins: c,
|
|
3476
|
-
setL2mins:
|
|
3476
|
+
setL2mins: A,
|
|
3477
3477
|
l2role: f,
|
|
3478
|
-
setL2role:
|
|
3479
|
-
l3mins:
|
|
3480
|
-
setL3mins:
|
|
3481
|
-
l3role:
|
|
3478
|
+
setL2role: k,
|
|
3479
|
+
l3mins: N,
|
|
3480
|
+
setL3mins: y,
|
|
3481
|
+
l3role: b,
|
|
3482
3482
|
setL3role: $,
|
|
3483
|
-
actions:
|
|
3483
|
+
actions: M,
|
|
3484
3484
|
setActions: B,
|
|
3485
3485
|
thirdPartyIds: U,
|
|
3486
|
-
setThirdPartyIds:
|
|
3487
|
-
humanLoop:
|
|
3488
|
-
setHumanLoop:
|
|
3489
|
-
onClear:
|
|
3490
|
-
onSave:
|
|
3491
|
-
saving:
|
|
3492
|
-
onActionTypesLoaded:
|
|
3493
|
-
} = e, { rules:
|
|
3494
|
-
|
|
3495
|
-
let
|
|
3486
|
+
setThirdPartyIds: V,
|
|
3487
|
+
humanLoop: K,
|
|
3488
|
+
setHumanLoop: W,
|
|
3489
|
+
onClear: Y,
|
|
3490
|
+
onSave: I,
|
|
3491
|
+
saving: C,
|
|
3492
|
+
onActionTypesLoaded: T
|
|
3493
|
+
} = e, { rules: Z } = xe(), [ee, R] = x([]), [v, m] = x([]), [w, p] = x(!1);
|
|
3494
|
+
fe(() => {
|
|
3495
|
+
let O = !1;
|
|
3496
3496
|
return (async () => {
|
|
3497
3497
|
try {
|
|
3498
|
-
|
|
3499
|
-
const
|
|
3500
|
-
if (
|
|
3501
|
-
const D =
|
|
3502
|
-
|
|
3503
|
-
const j = Array.isArray(
|
|
3498
|
+
p(!0);
|
|
3499
|
+
const L = await Z.getLookups();
|
|
3500
|
+
if (O || !L || !Array.isArray(L.actionTypes)) return;
|
|
3501
|
+
const D = L.actionTypes.map((Q) => ({ label: Q.name, value: String(Q.actionTypeId) }));
|
|
3502
|
+
R(D), T && T(L.actionTypes);
|
|
3503
|
+
const j = Array.isArray(L.thirdParties) ? L.thirdParties.map((Q) => ({ label: Q.thirdPartyName, value: Q.thirdPartyId })) : [];
|
|
3504
3504
|
m(j);
|
|
3505
|
-
} catch (
|
|
3506
|
-
console.error("Error loading lookups",
|
|
3505
|
+
} catch (L) {
|
|
3506
|
+
console.error("Error loading lookups", L);
|
|
3507
3507
|
} finally {
|
|
3508
|
-
|
|
3508
|
+
O || p(!1);
|
|
3509
3509
|
}
|
|
3510
3510
|
})(), () => {
|
|
3511
|
-
|
|
3511
|
+
O = !0;
|
|
3512
3512
|
};
|
|
3513
3513
|
}, []);
|
|
3514
|
-
const
|
|
3515
|
-
return /* @__PURE__ */ u(
|
|
3516
|
-
/* @__PURE__ */ u(
|
|
3514
|
+
const g = typeof o == "number" || typeof h == "number" || typeof c == "number" || typeof f == "number" || typeof N == "number" || typeof b == "number" || Array.isArray(M) && M.length > 0 || Array.isArray(U) && U.length > 0 || !!K;
|
|
3515
|
+
return /* @__PURE__ */ u(St, { spinning: !!C || w, children: [
|
|
3516
|
+
/* @__PURE__ */ u(ge, { gutter: [16, 16], align: "bottom", children: [
|
|
3517
3517
|
/* @__PURE__ */ i(H, { xs: 24, sm: 12, md: 8, lg: 4, children: /* @__PURE__ */ u("div", { children: [
|
|
3518
|
-
/* @__PURE__ */ i(
|
|
3518
|
+
/* @__PURE__ */ i(Pe, { className: "text-gray-700 font-medium block mb-1", children: "Rules" }),
|
|
3519
3519
|
/* @__PURE__ */ i(
|
|
3520
|
-
|
|
3520
|
+
pe,
|
|
3521
3521
|
{
|
|
3522
3522
|
placeholder: "Rules",
|
|
3523
3523
|
value: t,
|
|
@@ -3528,13 +3528,13 @@ function bn(e) {
|
|
|
3528
3528
|
)
|
|
3529
3529
|
] }) }),
|
|
3530
3530
|
/* @__PURE__ */ i(H, { xs: 24, sm: 12, md: 8, lg: 4, children: /* @__PURE__ */ u("div", { children: [
|
|
3531
|
-
/* @__PURE__ */ u(
|
|
3532
|
-
/* @__PURE__ */ i(H, { span: 10, children: /* @__PURE__ */ i(
|
|
3533
|
-
/* @__PURE__ */ i(H, { span: 14, children: /* @__PURE__ */ i(
|
|
3531
|
+
/* @__PURE__ */ u(ge, { gutter: 8, children: [
|
|
3532
|
+
/* @__PURE__ */ i(H, { span: 10, children: /* @__PURE__ */ i(Pe, { className: "text-gray-700 font-medium block mb-1", children: "Level 1 (mins)" }) }),
|
|
3533
|
+
/* @__PURE__ */ i(H, { span: 14, children: /* @__PURE__ */ i(Pe, { className: "text-gray-700 font-medium block mb-1", children: "Escalate to" }) })
|
|
3534
3534
|
] }),
|
|
3535
|
-
/* @__PURE__ */ u(
|
|
3535
|
+
/* @__PURE__ */ u(ge, { gutter: 8, children: [
|
|
3536
3536
|
/* @__PURE__ */ i(H, { span: 10, children: /* @__PURE__ */ i(
|
|
3537
|
-
|
|
3537
|
+
pe,
|
|
3538
3538
|
{
|
|
3539
3539
|
className: "w-full",
|
|
3540
3540
|
placeholder: "Mins",
|
|
@@ -3544,7 +3544,7 @@ function bn(e) {
|
|
|
3544
3544
|
}
|
|
3545
3545
|
) }),
|
|
3546
3546
|
/* @__PURE__ */ i(H, { span: 14, children: /* @__PURE__ */ i(
|
|
3547
|
-
|
|
3547
|
+
pe,
|
|
3548
3548
|
{
|
|
3549
3549
|
placeholder: "Escalate to",
|
|
3550
3550
|
className: "w-full",
|
|
@@ -3556,55 +3556,55 @@ function bn(e) {
|
|
|
3556
3556
|
] })
|
|
3557
3557
|
] }) }),
|
|
3558
3558
|
/* @__PURE__ */ i(H, { xs: 24, sm: 12, md: 8, lg: 4, children: /* @__PURE__ */ u("div", { children: [
|
|
3559
|
-
/* @__PURE__ */ u(
|
|
3560
|
-
/* @__PURE__ */ i(H, { span: 10, children: /* @__PURE__ */ i(
|
|
3561
|
-
/* @__PURE__ */ i(H, { span: 14, children: /* @__PURE__ */ i(
|
|
3559
|
+
/* @__PURE__ */ u(ge, { gutter: 8, children: [
|
|
3560
|
+
/* @__PURE__ */ i(H, { span: 10, children: /* @__PURE__ */ i(Pe, { className: "text-gray-700 font-medium block mb-1", children: "Level 2 (mins)" }) }),
|
|
3561
|
+
/* @__PURE__ */ i(H, { span: 14, children: /* @__PURE__ */ i(Pe, { className: "text-gray-700 font-medium block mb-1", children: "Escalate to" }) })
|
|
3562
3562
|
] }),
|
|
3563
|
-
/* @__PURE__ */ u(
|
|
3563
|
+
/* @__PURE__ */ u(ge, { gutter: 8, children: [
|
|
3564
3564
|
/* @__PURE__ */ i(H, { span: 10, children: /* @__PURE__ */ i(
|
|
3565
|
-
|
|
3565
|
+
pe,
|
|
3566
3566
|
{
|
|
3567
3567
|
className: "w-full",
|
|
3568
3568
|
placeholder: "Mins",
|
|
3569
3569
|
value: c,
|
|
3570
|
-
onChange:
|
|
3570
|
+
onChange: A,
|
|
3571
3571
|
options: n
|
|
3572
3572
|
}
|
|
3573
3573
|
) }),
|
|
3574
3574
|
/* @__PURE__ */ i(H, { span: 14, children: /* @__PURE__ */ i(
|
|
3575
|
-
|
|
3575
|
+
pe,
|
|
3576
3576
|
{
|
|
3577
3577
|
placeholder: "Escalate to",
|
|
3578
3578
|
className: "w-full",
|
|
3579
3579
|
value: f,
|
|
3580
|
-
onChange:
|
|
3580
|
+
onChange: k,
|
|
3581
3581
|
options: a
|
|
3582
3582
|
}
|
|
3583
3583
|
) })
|
|
3584
3584
|
] })
|
|
3585
3585
|
] }) }),
|
|
3586
3586
|
/* @__PURE__ */ i(H, { xs: 24, sm: 12, md: 8, lg: 4, children: /* @__PURE__ */ u("div", { children: [
|
|
3587
|
-
/* @__PURE__ */ u(
|
|
3588
|
-
/* @__PURE__ */ i(H, { span: 10, children: /* @__PURE__ */ i(
|
|
3589
|
-
/* @__PURE__ */ i(H, { span: 14, children: /* @__PURE__ */ i(
|
|
3587
|
+
/* @__PURE__ */ u(ge, { gutter: 8, children: [
|
|
3588
|
+
/* @__PURE__ */ i(H, { span: 10, children: /* @__PURE__ */ i(Pe, { className: "text-gray-700 font-medium block mb-1", children: "Level 3 (mins)" }) }),
|
|
3589
|
+
/* @__PURE__ */ i(H, { span: 14, children: /* @__PURE__ */ i(Pe, { className: "text-gray-700 font-medium block mb-1", children: "Escalate to" }) })
|
|
3590
3590
|
] }),
|
|
3591
|
-
/* @__PURE__ */ u(
|
|
3591
|
+
/* @__PURE__ */ u(ge, { gutter: 8, children: [
|
|
3592
3592
|
/* @__PURE__ */ i(H, { span: 10, children: /* @__PURE__ */ i(
|
|
3593
|
-
|
|
3593
|
+
pe,
|
|
3594
3594
|
{
|
|
3595
3595
|
className: "w-full",
|
|
3596
3596
|
placeholder: "Mins",
|
|
3597
|
-
value:
|
|
3598
|
-
onChange:
|
|
3597
|
+
value: N,
|
|
3598
|
+
onChange: y,
|
|
3599
3599
|
options: n
|
|
3600
3600
|
}
|
|
3601
3601
|
) }),
|
|
3602
3602
|
/* @__PURE__ */ i(H, { span: 14, children: /* @__PURE__ */ i(
|
|
3603
|
-
|
|
3603
|
+
pe,
|
|
3604
3604
|
{
|
|
3605
3605
|
placeholder: "Escalate to",
|
|
3606
3606
|
className: "w-full",
|
|
3607
|
-
value:
|
|
3607
|
+
value: b,
|
|
3608
3608
|
onChange: $,
|
|
3609
3609
|
options: a
|
|
3610
3610
|
}
|
|
@@ -3612,39 +3612,39 @@ function bn(e) {
|
|
|
3612
3612
|
] })
|
|
3613
3613
|
] }) }),
|
|
3614
3614
|
/* @__PURE__ */ i(H, { xs: 24, sm: 12, md: 8, lg: 5, children: /* @__PURE__ */ u("div", { children: [
|
|
3615
|
-
/* @__PURE__ */ i(
|
|
3615
|
+
/* @__PURE__ */ i(Pe, { className: "text-gray-700 font-medium block mb-1", children: "Pick Actions" }),
|
|
3616
3616
|
/* @__PURE__ */ i(
|
|
3617
|
-
|
|
3617
|
+
pe,
|
|
3618
3618
|
{
|
|
3619
3619
|
mode: "multiple",
|
|
3620
3620
|
placeholder: "Select response actions",
|
|
3621
3621
|
className: "w-full",
|
|
3622
|
-
value:
|
|
3622
|
+
value: M,
|
|
3623
3623
|
onChange: B,
|
|
3624
|
-
options:
|
|
3624
|
+
options: ee
|
|
3625
3625
|
}
|
|
3626
3626
|
)
|
|
3627
3627
|
] }) }),
|
|
3628
|
-
/* @__PURE__ */ i(H, { xs: 24, sm: 12, md: 8, lg: 3, children: /* @__PURE__ */ i("div", { className: "flex items-end h-full", children: /* @__PURE__ */ i(
|
|
3628
|
+
/* @__PURE__ */ i(H, { xs: 24, sm: 12, md: 8, lg: 3, children: /* @__PURE__ */ i("div", { className: "flex items-end h-full", children: /* @__PURE__ */ i(_e, { checked: K, onChange: (O) => W(O.target.checked), children: "Human-In-The-Loop" }) }) })
|
|
3629
3629
|
] }),
|
|
3630
|
-
/* @__PURE__ */ u(
|
|
3630
|
+
/* @__PURE__ */ u(ge, { gutter: [16, 16], align: "bottom", className: "mt-4", children: [
|
|
3631
3631
|
/* @__PURE__ */ i(H, { xs: 24, sm: 12, md: 8, lg: 5, children: /* @__PURE__ */ u("div", { children: [
|
|
3632
|
-
/* @__PURE__ */ i(
|
|
3632
|
+
/* @__PURE__ */ i(Pe, { className: "text-gray-700 font-medium block mb-1", children: "Third Party App" }),
|
|
3633
3633
|
/* @__PURE__ */ i(
|
|
3634
|
-
|
|
3634
|
+
pe,
|
|
3635
3635
|
{
|
|
3636
3636
|
mode: "multiple",
|
|
3637
3637
|
placeholder: "Third Party app",
|
|
3638
3638
|
className: "w-full",
|
|
3639
3639
|
value: U,
|
|
3640
|
-
onChange:
|
|
3641
|
-
options:
|
|
3640
|
+
onChange: V,
|
|
3641
|
+
options: v
|
|
3642
3642
|
}
|
|
3643
3643
|
)
|
|
3644
3644
|
] }) }),
|
|
3645
3645
|
/* @__PURE__ */ i(H, { xs: 24, sm: 12, md: 8, children: /* @__PURE__ */ u("div", { className: "flex items-center gap-2", children: [
|
|
3646
|
-
/* @__PURE__ */ i(
|
|
3647
|
-
/* @__PURE__ */ i(
|
|
3646
|
+
/* @__PURE__ */ i(ye, { onClick: Y, children: "Clear" }),
|
|
3647
|
+
/* @__PURE__ */ i(ye, { type: "primary", onClick: I, loading: !!C, disabled: !(!!t && g && !C), children: "Save" })
|
|
3648
3648
|
] }) })
|
|
3649
3649
|
] })
|
|
3650
3650
|
] });
|
|
@@ -3652,7 +3652,7 @@ function bn(e) {
|
|
|
3652
3652
|
function Sn({ entries: e, userRoles: t, onEdit: s, loading: r }) {
|
|
3653
3653
|
const n = new Map(t.map((o) => [o.userRoleId, o.userRoleName])), a = (o) => o.map((l) => n.get(l) || String(l)).join(", ");
|
|
3654
3654
|
return /* @__PURE__ */ i(
|
|
3655
|
-
|
|
3655
|
+
bt,
|
|
3656
3656
|
{
|
|
3657
3657
|
rowKey: "id",
|
|
3658
3658
|
dataSource: e,
|
|
@@ -3702,59 +3702,59 @@ function Sn({ entries: e, userRoles: t, onEdit: s, loading: r }) {
|
|
|
3702
3702
|
{
|
|
3703
3703
|
title: "Actions",
|
|
3704
3704
|
key: "ops",
|
|
3705
|
-
render: (o, l) => /* @__PURE__ */ i(
|
|
3705
|
+
render: (o, l) => /* @__PURE__ */ i(ye, { type: "text", onClick: () => s(l.id), children: /* @__PURE__ */ i($s, {}) })
|
|
3706
3706
|
}
|
|
3707
3707
|
]
|
|
3708
3708
|
}
|
|
3709
3709
|
);
|
|
3710
3710
|
}
|
|
3711
|
-
const { Title: An } =
|
|
3711
|
+
const { Title: An } = We;
|
|
3712
3712
|
function Nn({ userRoles: e, rules: t, rawRules: s }) {
|
|
3713
|
-
const { rules: r } =
|
|
3714
|
-
() => (t || []).map((
|
|
3715
|
-
key:
|
|
3716
|
-
ruleName:
|
|
3717
|
-
ruleDesc:
|
|
3713
|
+
const { rules: r } = xe(), [n, a] = x(!1), [o, l] = x(s), [h, d] = x({}), c = ue(() => e.map((y) => ({ label: y.userRoleName, value: y.userRoleId })), [e]), A = ue(
|
|
3714
|
+
() => (t || []).map((y, b) => ({
|
|
3715
|
+
key: y.RuleId || y.Name || String(b),
|
|
3716
|
+
ruleName: y.Name || "-",
|
|
3717
|
+
ruleDesc: y.Description || ""
|
|
3718
3718
|
})),
|
|
3719
3719
|
[t]
|
|
3720
3720
|
);
|
|
3721
|
-
|
|
3722
|
-
let
|
|
3721
|
+
fe(() => {
|
|
3722
|
+
let y = !1;
|
|
3723
3723
|
return (async () => {
|
|
3724
3724
|
try {
|
|
3725
3725
|
a(!0);
|
|
3726
|
-
const
|
|
3727
|
-
|
|
3726
|
+
const b = await r.getRules();
|
|
3727
|
+
y || (l(Array.isArray(b) ? b : []), d({}));
|
|
3728
3728
|
} catch {
|
|
3729
|
-
!
|
|
3729
|
+
!y && Array.isArray(s) && l(s);
|
|
3730
3730
|
} finally {
|
|
3731
|
-
|
|
3731
|
+
y || a(!1);
|
|
3732
3732
|
}
|
|
3733
3733
|
})(), () => {
|
|
3734
|
-
|
|
3734
|
+
y = !0;
|
|
3735
3735
|
};
|
|
3736
|
-
}, []),
|
|
3736
|
+
}, []), fe(() => {
|
|
3737
3737
|
!o && Array.isArray(s) && l(s);
|
|
3738
3738
|
}, [s]);
|
|
3739
3739
|
const f = ue(() => {
|
|
3740
3740
|
if (!Array.isArray(o) || !o.length) return {};
|
|
3741
|
-
const
|
|
3742
|
-
for (const
|
|
3741
|
+
const y = {};
|
|
3742
|
+
for (const b of A) {
|
|
3743
3743
|
const $ = o.find(
|
|
3744
|
-
(B) => B?.ruleId ===
|
|
3745
|
-
B?.Name ===
|
|
3746
|
-
),
|
|
3747
|
-
|
|
3744
|
+
(B) => B?.ruleId === b.key || B?.ruleName === b.key || B?.RuleId === b.key || B?.ruleName === b.ruleName || // fallback by name
|
|
3745
|
+
B?.Name === b.ruleName
|
|
3746
|
+
), M = Array.isArray($?.userRoleIds) ? $.userRoleIds : [];
|
|
3747
|
+
M.length && (y[b.key] = M);
|
|
3748
3748
|
}
|
|
3749
|
-
return
|
|
3750
|
-
}, [o,
|
|
3749
|
+
return y;
|
|
3750
|
+
}, [o, A]);
|
|
3751
3751
|
return /* @__PURE__ */ u("div", { className: "w-full", children: [
|
|
3752
3752
|
/* @__PURE__ */ i("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ i(An, { level: 4, className: "!mb-4", children: "Alert Assignment" }) }),
|
|
3753
3753
|
/* @__PURE__ */ i(
|
|
3754
|
-
|
|
3754
|
+
bt,
|
|
3755
3755
|
{
|
|
3756
3756
|
rowKey: "key",
|
|
3757
|
-
dataSource:
|
|
3757
|
+
dataSource: A,
|
|
3758
3758
|
loading: n,
|
|
3759
3759
|
pagination: !1,
|
|
3760
3760
|
columns: [
|
|
@@ -3763,14 +3763,14 @@ function Nn({ userRoles: e, rules: t, rawRules: s }) {
|
|
|
3763
3763
|
{
|
|
3764
3764
|
title: "Alert Notification To",
|
|
3765
3765
|
key: "assign",
|
|
3766
|
-
render: (
|
|
3767
|
-
|
|
3766
|
+
render: (y, b) => /* @__PURE__ */ i(
|
|
3767
|
+
pe,
|
|
3768
3768
|
{
|
|
3769
3769
|
mode: "multiple",
|
|
3770
3770
|
placeholder: "Dropdown with Multi select",
|
|
3771
3771
|
className: "w-full",
|
|
3772
|
-
value: h[
|
|
3773
|
-
onChange: ($) => d((
|
|
3772
|
+
value: h[b.key] ?? f[b.key] ?? [],
|
|
3773
|
+
onChange: ($) => d((M) => ({ ...M, [b.key]: $ })),
|
|
3774
3774
|
options: c
|
|
3775
3775
|
}
|
|
3776
3776
|
)
|
|
@@ -3778,12 +3778,12 @@ function Nn({ userRoles: e, rules: t, rawRules: s }) {
|
|
|
3778
3778
|
]
|
|
3779
3779
|
}
|
|
3780
3780
|
),
|
|
3781
|
-
/* @__PURE__ */ u(
|
|
3782
|
-
/* @__PURE__ */ i(
|
|
3781
|
+
/* @__PURE__ */ u(we, { className: "mt-4", children: [
|
|
3782
|
+
/* @__PURE__ */ i(ye, { onClick: () => {
|
|
3783
3783
|
d({});
|
|
3784
3784
|
}, disabled: n, children: "Clear" }),
|
|
3785
3785
|
/* @__PURE__ */ i(
|
|
3786
|
-
|
|
3786
|
+
ye,
|
|
3787
3787
|
{
|
|
3788
3788
|
type: "primary",
|
|
3789
3789
|
onClick: async () => {
|
|
@@ -3793,24 +3793,24 @@ function Nn({ userRoles: e, rules: t, rawRules: s }) {
|
|
|
3793
3793
|
return;
|
|
3794
3794
|
}
|
|
3795
3795
|
a(!0);
|
|
3796
|
-
const
|
|
3797
|
-
const
|
|
3798
|
-
(
|
|
3799
|
-
), B = typeof
|
|
3800
|
-
if (!
|
|
3801
|
-
throw new Error(`Unable to find recordId for rule ${
|
|
3802
|
-
const U = Array.isArray($) ? $ : [],
|
|
3803
|
-
const
|
|
3796
|
+
const y = Object.entries(h).map(async ([b, $]) => {
|
|
3797
|
+
const M = o.find(
|
|
3798
|
+
(W) => W?.ruleId === b || W?.ruleName === b || W?.RuleId === b
|
|
3799
|
+
), B = typeof M?.recordId == "number" ? M.recordId : void 0;
|
|
3800
|
+
if (!M || typeof B != "number")
|
|
3801
|
+
throw new Error(`Unable to find recordId for rule ${b}`);
|
|
3802
|
+
const U = Array.isArray($) ? $ : [], V = U.map((W) => {
|
|
3803
|
+
const Y = e.find((I) => I.userRoleId === W);
|
|
3804
3804
|
return {
|
|
3805
|
-
id:
|
|
3806
|
-
name:
|
|
3805
|
+
id: W,
|
|
3806
|
+
name: Y?.userRoleName ?? String(W)
|
|
3807
3807
|
};
|
|
3808
|
-
}),
|
|
3809
|
-
...
|
|
3810
|
-
ruleId:
|
|
3808
|
+
}), K = {
|
|
3809
|
+
...M,
|
|
3810
|
+
ruleId: b,
|
|
3811
3811
|
// ensure ruleId matches the selected rule
|
|
3812
3812
|
userRoleIds: U,
|
|
3813
|
-
userRoles:
|
|
3813
|
+
userRoles: V,
|
|
3814
3814
|
actions: [
|
|
3815
3815
|
{
|
|
3816
3816
|
actionTypeId: 4,
|
|
@@ -3825,17 +3825,17 @@ function Nn({ userRoles: e, rules: t, rawRules: s }) {
|
|
|
3825
3825
|
}
|
|
3826
3826
|
]
|
|
3827
3827
|
};
|
|
3828
|
-
return r.updateRule(B,
|
|
3828
|
+
return r.updateRule(B, K);
|
|
3829
3829
|
});
|
|
3830
|
-
await Promise.all(
|
|
3830
|
+
await Promise.all(y), ne.success("Alert assignment saved");
|
|
3831
3831
|
try {
|
|
3832
|
-
const
|
|
3833
|
-
l(Array.isArray(
|
|
3834
|
-
} catch (
|
|
3835
|
-
console.error("Failed to refresh rules after save",
|
|
3832
|
+
const b = await r.getRules();
|
|
3833
|
+
l(Array.isArray(b) ? b : []), d({});
|
|
3834
|
+
} catch (b) {
|
|
3835
|
+
console.error("Failed to refresh rules after save", b);
|
|
3836
3836
|
}
|
|
3837
|
-
} catch (
|
|
3838
|
-
console.error("Failed to save alert assignment",
|
|
3837
|
+
} catch (y) {
|
|
3838
|
+
console.error("Failed to save alert assignment", y);
|
|
3839
3839
|
} finally {
|
|
3840
3840
|
a(!1);
|
|
3841
3841
|
}
|
|
@@ -3848,130 +3848,130 @@ function Nn({ userRoles: e, rules: t, rawRules: s }) {
|
|
|
3848
3848
|
] })
|
|
3849
3849
|
] });
|
|
3850
3850
|
}
|
|
3851
|
-
const { Title:
|
|
3851
|
+
const { Title: ts } = We;
|
|
3852
3852
|
function wn({ severities: e, rules: t, userRoles: s, rawRules: r, onSave: n }) {
|
|
3853
|
-
const { rules: a, alerts: o } =
|
|
3854
|
-
|
|
3855
|
-
r && r.length &&
|
|
3856
|
-
}, [r]),
|
|
3857
|
-
if (!
|
|
3858
|
-
const E = Object.keys(
|
|
3859
|
-
if (
|
|
3860
|
-
const
|
|
3861
|
-
const
|
|
3853
|
+
const { rules: a, alerts: o } = xe(), [l, h] = x("By Severity"), [d, c] = x("By severity"), [A, f] = x("By Severity"), [k, N] = x(!1), [y, b] = x(!1), [$, M] = x(!1), [B, U] = x(null), [V, K] = x("rules"), [W, Y] = x(), [I, C] = x(), [T, Z] = x(), [ee, R] = x(), [v, m] = x(), [w, p] = x(), [g, S] = x(), [O, L] = x(), [D, j] = x([]), [Q, z] = x([]), [ie, me] = x(!1), [de, re] = x({}), [ae, be] = x({}), [Se, nt] = x(s || []), [P, q] = x([]), [se, Ce] = x(!1), [Be, qe] = x(!1), [Ie, Ee] = x(r || []);
|
|
3854
|
+
fe(() => {
|
|
3855
|
+
r && r.length && Ee(r);
|
|
3856
|
+
}, [r]), fe(() => {
|
|
3857
|
+
if (!Ie || !Ie.length) return;
|
|
3858
|
+
const E = Object.keys(de).length > 0 || Object.keys(ae).length > 0;
|
|
3859
|
+
if (P.length && !E) return;
|
|
3860
|
+
const X = Ie.map((_, F) => {
|
|
3861
|
+
const J = t.find((Re) => Re.RuleId === (_.ruleId || _.ruleName))?.Name || _.ruleName || _.Name || "-", G = _.escalationSettings || {}, te = typeof G.level1UserRoleId == "number" && G.level1UserRoleId > 0 ? [G.level1UserRoleId] : [], Te = typeof G.level2UserRoleId == "number" && G.level2UserRoleId > 0 ? [G.level2UserRoleId] : [], at = typeof G.level3UserRoleId == "number" && G.level3UserRoleId > 0 ? [G.level3UserRoleId] : [], Pt = (Array.isArray(G.escalationSettingsActionTypeIds) ? G.escalationSettingsActionTypeIds : []).map((Re) => de[Re] || String(Re)), Dt = (Array.isArray(G.thirdPartyId) ? G.thirdPartyId : []).map((Re) => ae[Re] || String(Re)), ot = typeof G.humanLoop == "boolean" ? G.humanLoop : null;
|
|
3862
3862
|
return {
|
|
3863
|
-
id: String(
|
|
3864
|
-
ruleOrSeverityLabel:
|
|
3865
|
-
l1: { minutes:
|
|
3866
|
-
l2: { minutes:
|
|
3867
|
-
l3: { minutes:
|
|
3868
|
-
actions:
|
|
3869
|
-
notify:
|
|
3870
|
-
humanLoop:
|
|
3863
|
+
id: String(_.ruleId || _.ruleName || F),
|
|
3864
|
+
ruleOrSeverityLabel: J,
|
|
3865
|
+
l1: { minutes: G.level1PostAssistTime ?? void 0, roles: te },
|
|
3866
|
+
l2: { minutes: G.level2PostAssistTime ?? void 0, roles: Te },
|
|
3867
|
+
l3: { minutes: G.level3PostAssistTime ?? void 0, roles: at },
|
|
3868
|
+
actions: Pt,
|
|
3869
|
+
notify: Dt,
|
|
3870
|
+
humanLoop: ot
|
|
3871
3871
|
};
|
|
3872
3872
|
});
|
|
3873
|
-
|
|
3874
|
-
}, [
|
|
3875
|
-
const
|
|
3873
|
+
q(X);
|
|
3874
|
+
}, [Ie, t, de, ae]);
|
|
3875
|
+
const it = ue(
|
|
3876
3876
|
() => e.map((E) => ({ label: E.DisplayName, value: E.SeverityId })),
|
|
3877
3877
|
[e]
|
|
3878
3878
|
), Ss = ue(
|
|
3879
3879
|
() => t.map((E) => ({ label: E.Name, value: E.RuleId })),
|
|
3880
3880
|
[t]
|
|
3881
3881
|
), As = ue(
|
|
3882
|
-
() =>
|
|
3883
|
-
[
|
|
3882
|
+
() => Se.map((E) => ({ label: E.userRoleName, value: E.userRoleId })),
|
|
3883
|
+
[Se]
|
|
3884
3884
|
), Ns = ue(() => [1, 3, 5, 10, 15, 20, 30, 45, 60].map((E) => ({ label: `${E}`, value: E })), []);
|
|
3885
|
-
|
|
3885
|
+
fe(() => {
|
|
3886
3886
|
let E = !1;
|
|
3887
|
-
async function
|
|
3887
|
+
async function X() {
|
|
3888
3888
|
try {
|
|
3889
|
-
|
|
3890
|
-
const
|
|
3891
|
-
if (!E &&
|
|
3892
|
-
const F =
|
|
3893
|
-
h(F), f(F),
|
|
3889
|
+
M(!0), U(null);
|
|
3890
|
+
const _ = await o.getAdminSettings();
|
|
3891
|
+
if (!E && _) {
|
|
3892
|
+
const F = is(_.sortBy);
|
|
3893
|
+
h(F), f(F), N(!1);
|
|
3894
3894
|
}
|
|
3895
|
-
} catch (
|
|
3895
|
+
} catch (_) {
|
|
3896
3896
|
if (!E) {
|
|
3897
|
-
const F =
|
|
3897
|
+
const F = _ instanceof Error ? _.message : "Failed to load admin settings";
|
|
3898
3898
|
U(F);
|
|
3899
3899
|
}
|
|
3900
3900
|
} finally {
|
|
3901
|
-
E ||
|
|
3901
|
+
E || M(!1);
|
|
3902
3902
|
}
|
|
3903
3903
|
}
|
|
3904
|
-
return
|
|
3904
|
+
return X(), () => {
|
|
3905
3905
|
E = !0;
|
|
3906
3906
|
};
|
|
3907
|
-
}, []),
|
|
3908
|
-
if (!
|
|
3909
|
-
const E = (
|
|
3910
|
-
const
|
|
3911
|
-
return !isNaN(
|
|
3912
|
-
},
|
|
3913
|
-
const
|
|
3914
|
-
return !isNaN(
|
|
3915
|
-
}, F = (
|
|
3916
|
-
(
|
|
3907
|
+
}, []), fe(() => {
|
|
3908
|
+
if (!I) return;
|
|
3909
|
+
const E = (J) => {
|
|
3910
|
+
const G = Number(J);
|
|
3911
|
+
return !isNaN(G) && G > 0 ? G : void 0;
|
|
3912
|
+
}, X = (J) => {
|
|
3913
|
+
const G = Number(J);
|
|
3914
|
+
return !isNaN(G) && G > 0 ? G : void 0;
|
|
3915
|
+
}, F = (Ie || []).find(
|
|
3916
|
+
(J) => J?.ruleId === I || J?.ruleName === I || J?.RuleId === I
|
|
3917
3917
|
)?.escalationSettings;
|
|
3918
3918
|
if (F && typeof F == "object") {
|
|
3919
|
-
|
|
3920
|
-
const
|
|
3921
|
-
j(
|
|
3919
|
+
Z(X(F.level1PostAssistTime)), R(E(F.level1UserRoleId)), m(X(F.level2PostAssistTime)), p(E(F.level2UserRoleId)), S(X(F.level3PostAssistTime)), L(E(F.level3UserRoleId));
|
|
3920
|
+
const J = Array.isArray(F.escalationSettingsActionTypeIds) ? F.escalationSettingsActionTypeIds : [];
|
|
3921
|
+
j(J.map((G) => String(G))), z(Array.isArray(F.thirdPartyId) ? F.thirdPartyId : []), me(!!F.humanLoop);
|
|
3922
3922
|
}
|
|
3923
|
-
}, [
|
|
3923
|
+
}, [V, I, Ie]);
|
|
3924
3924
|
const ws = async () => {
|
|
3925
3925
|
try {
|
|
3926
|
-
|
|
3927
|
-
const E = await a.getRules(),
|
|
3928
|
-
|
|
3929
|
-
const
|
|
3930
|
-
const
|
|
3926
|
+
qe(!0);
|
|
3927
|
+
const E = await a.getRules(), X = Array.isArray(E) ? E : Array.isArray(E?.data) ? E.data : [];
|
|
3928
|
+
Ee(X);
|
|
3929
|
+
const _ = X.map((F, J) => {
|
|
3930
|
+
const G = t.find((Me) => Me.RuleId === (F.ruleId || F.ruleName))?.Name || F.ruleName || F.Name || "-", te = F.escalationSettings || {}, Te = typeof te.level1UserRoleId == "number" && te.level1UserRoleId > 0 ? [te.level1UserRoleId] : [], at = typeof te.level2UserRoleId == "number" && te.level2UserRoleId > 0 ? [te.level2UserRoleId] : [], Ot = typeof te.level3UserRoleId == "number" && te.level3UserRoleId > 0 ? [te.level3UserRoleId] : [], Et = (Array.isArray(te.escalationSettingsActionTypeIds) ? te.escalationSettingsActionTypeIds : []).map((Me) => de[Me] || String(Me)), ot = (Array.isArray(te.thirdPartyId) ? te.thirdPartyId : []).map((Me) => ae[Me] || String(Me)), Re = typeof te.humanLoop == "boolean" ? te.humanLoop : null;
|
|
3931
3931
|
return {
|
|
3932
|
-
id: String(F.ruleId || F.ruleName ||
|
|
3933
|
-
ruleOrSeverityLabel:
|
|
3934
|
-
l1: { minutes:
|
|
3935
|
-
l2: { minutes:
|
|
3936
|
-
l3: { minutes:
|
|
3937
|
-
actions:
|
|
3938
|
-
notify:
|
|
3939
|
-
humanLoop:
|
|
3932
|
+
id: String(F.ruleId || F.ruleName || J),
|
|
3933
|
+
ruleOrSeverityLabel: G,
|
|
3934
|
+
l1: { minutes: te.level1PostAssistTime ?? void 0, roles: Te },
|
|
3935
|
+
l2: { minutes: te.level2PostAssistTime ?? void 0, roles: at },
|
|
3936
|
+
l3: { minutes: te.level3PostAssistTime ?? void 0, roles: Ot },
|
|
3937
|
+
actions: Et,
|
|
3938
|
+
notify: ot,
|
|
3939
|
+
humanLoop: Re
|
|
3940
3940
|
};
|
|
3941
3941
|
});
|
|
3942
|
-
|
|
3942
|
+
q(_);
|
|
3943
3943
|
} catch (E) {
|
|
3944
3944
|
console.error("Failed to refetch entries", E);
|
|
3945
3945
|
} finally {
|
|
3946
|
-
|
|
3946
|
+
qe(!1);
|
|
3947
3947
|
}
|
|
3948
3948
|
};
|
|
3949
|
-
return
|
|
3949
|
+
return fe(() => {
|
|
3950
3950
|
let E = !1;
|
|
3951
3951
|
return (async () => {
|
|
3952
3952
|
try {
|
|
3953
|
-
const
|
|
3954
|
-
if (E || !
|
|
3955
|
-
const
|
|
3956
|
-
if (Array.isArray(
|
|
3957
|
-
for (const
|
|
3958
|
-
typeof
|
|
3959
|
-
_
|
|
3960
|
-
const F = Array.isArray(
|
|
3961
|
-
userRoleId:
|
|
3962
|
-
userRoleName:
|
|
3953
|
+
const X = await a.getLookups();
|
|
3954
|
+
if (E || !X) return;
|
|
3955
|
+
const _ = {};
|
|
3956
|
+
if (Array.isArray(X.thirdParties))
|
|
3957
|
+
for (const J of X.thirdParties)
|
|
3958
|
+
typeof J.thirdPartyId == "number" && (_[J.thirdPartyId] = J.thirdPartyName);
|
|
3959
|
+
be(_);
|
|
3960
|
+
const F = Array.isArray(X.userRoles) ? X.userRoles.map((J) => ({
|
|
3961
|
+
userRoleId: J.userRoleId ?? J.id,
|
|
3962
|
+
userRoleName: J.userRoleName ?? J.name
|
|
3963
3963
|
})) : [];
|
|
3964
|
-
E ||
|
|
3965
|
-
} catch (
|
|
3966
|
-
console.error("Error loading lookups",
|
|
3964
|
+
E || nt(F.length ? F : s || []);
|
|
3965
|
+
} catch (X) {
|
|
3966
|
+
console.error("Error loading lookups", X);
|
|
3967
3967
|
}
|
|
3968
3968
|
})(), () => {
|
|
3969
3969
|
E = !0;
|
|
3970
3970
|
};
|
|
3971
3971
|
}, []), /* @__PURE__ */ u("div", { className: "w-full", children: [
|
|
3972
3972
|
/* @__PURE__ */ u("div", { className: "mb-6", children: [
|
|
3973
|
-
/* @__PURE__ */ i(
|
|
3974
|
-
/* @__PURE__ */ u(
|
|
3973
|
+
/* @__PURE__ */ i(ts, { level: 4, className: "!mb-2", children: "Admin Settings" }),
|
|
3974
|
+
/* @__PURE__ */ u(St, { spinning: $, children: [
|
|
3975
3975
|
B ? /* @__PURE__ */ u("div", { className: "text-sm text-red-600 mb-2", children: [
|
|
3976
3976
|
"Failed to load settings: ",
|
|
3977
3977
|
B
|
|
@@ -3982,87 +3982,87 @@ function wn({ severities: e, rules: t, userRoles: s, rawRules: r, onSave: n }) {
|
|
|
3982
3982
|
sortBy: l,
|
|
3983
3983
|
groupBy: d,
|
|
3984
3984
|
onChange: (E) => {
|
|
3985
|
-
E.sortBy && (h(E.sortBy),
|
|
3985
|
+
E.sortBy && (h(E.sortBy), N(!0)), E.groupBy && (c(E.groupBy), N(!0));
|
|
3986
3986
|
},
|
|
3987
|
-
showActions:
|
|
3987
|
+
showActions: k,
|
|
3988
3988
|
onSave: async () => {
|
|
3989
|
-
|
|
3989
|
+
b(!0);
|
|
3990
3990
|
try {
|
|
3991
3991
|
const E = await o.setAdminSettings({ sortBy: l, groupBy: "string" });
|
|
3992
|
-
E?.responseStatus && E?.data && ne.success(E.data), f(l),
|
|
3992
|
+
E?.responseStatus && E?.data && ne.success(E.data), f(l), N(!1);
|
|
3993
3993
|
} catch (E) {
|
|
3994
3994
|
console.error("Error saving admin settings", E);
|
|
3995
3995
|
} finally {
|
|
3996
|
-
|
|
3996
|
+
b(!1);
|
|
3997
3997
|
}
|
|
3998
3998
|
},
|
|
3999
3999
|
onClear: () => {
|
|
4000
|
-
h(
|
|
4000
|
+
h(A), N(!1);
|
|
4001
4001
|
},
|
|
4002
|
-
saving:
|
|
4002
|
+
saving: y
|
|
4003
4003
|
}
|
|
4004
4004
|
)
|
|
4005
4005
|
] })
|
|
4006
4006
|
] }),
|
|
4007
|
-
/* @__PURE__ */ i(
|
|
4007
|
+
/* @__PURE__ */ i(He, { className: "my-6" }),
|
|
4008
4008
|
/* @__PURE__ */ u("div", { children: [
|
|
4009
|
-
/* @__PURE__ */ i(
|
|
4009
|
+
/* @__PURE__ */ i(ts, { level: 4, className: "!mb-4", children: "Escalation Settings" }),
|
|
4010
4010
|
/* @__PURE__ */ i(
|
|
4011
4011
|
bn,
|
|
4012
4012
|
{
|
|
4013
|
-
escBasis:
|
|
4014
|
-
setEscBasis:
|
|
4015
|
-
selectedSeverity:
|
|
4016
|
-
setSelectedSeverity:
|
|
4017
|
-
selectedRule:
|
|
4018
|
-
setSelectedRule:
|
|
4019
|
-
severityOptions:
|
|
4013
|
+
escBasis: V,
|
|
4014
|
+
setEscBasis: K,
|
|
4015
|
+
selectedSeverity: W,
|
|
4016
|
+
setSelectedSeverity: Y,
|
|
4017
|
+
selectedRule: I,
|
|
4018
|
+
setSelectedRule: C,
|
|
4019
|
+
severityOptions: it,
|
|
4020
4020
|
ruleOptions: Ss,
|
|
4021
4021
|
minsOptions: Ns,
|
|
4022
4022
|
roleOptions: As,
|
|
4023
|
-
l1mins:
|
|
4024
|
-
setL1mins:
|
|
4025
|
-
l1role:
|
|
4026
|
-
setL1role:
|
|
4027
|
-
l2mins:
|
|
4023
|
+
l1mins: T,
|
|
4024
|
+
setL1mins: Z,
|
|
4025
|
+
l1role: ee,
|
|
4026
|
+
setL1role: R,
|
|
4027
|
+
l2mins: v,
|
|
4028
4028
|
setL2mins: m,
|
|
4029
|
-
l2role:
|
|
4030
|
-
setL2role:
|
|
4031
|
-
l3mins:
|
|
4032
|
-
setL3mins:
|
|
4033
|
-
l3role:
|
|
4034
|
-
setL3role:
|
|
4029
|
+
l2role: w,
|
|
4030
|
+
setL2role: p,
|
|
4031
|
+
l3mins: g,
|
|
4032
|
+
setL3mins: S,
|
|
4033
|
+
l3role: O,
|
|
4034
|
+
setL3role: L,
|
|
4035
4035
|
actions: D,
|
|
4036
4036
|
setActions: j,
|
|
4037
4037
|
thirdPartyIds: Q,
|
|
4038
4038
|
setThirdPartyIds: z,
|
|
4039
4039
|
humanLoop: ie,
|
|
4040
|
-
setHumanLoop:
|
|
4040
|
+
setHumanLoop: me,
|
|
4041
4041
|
onClear: () => {
|
|
4042
|
-
h("By Severity"), c("By severity"),
|
|
4042
|
+
h("By Severity"), c("By severity"), K("rules"), Y(void 0), C(void 0), Z(void 0), R(void 0), m(void 0), p(void 0), S(void 0), L(void 0), j([]), z([]), me(!1);
|
|
4043
4043
|
},
|
|
4044
4044
|
onSave: async () => {
|
|
4045
|
-
|
|
4046
|
-
ruleId:
|
|
4045
|
+
Ce(!0), n?.({
|
|
4046
|
+
ruleId: I,
|
|
4047
4047
|
levels: [
|
|
4048
|
-
{ minutes:
|
|
4049
|
-
{ minutes:
|
|
4050
|
-
{ minutes:
|
|
4048
|
+
{ minutes: T, role: ee },
|
|
4049
|
+
{ minutes: v, role: w },
|
|
4050
|
+
{ minutes: g, role: O }
|
|
4051
4051
|
],
|
|
4052
4052
|
actions: D,
|
|
4053
4053
|
thirdPartyIds: Q,
|
|
4054
4054
|
humanLoop: ie
|
|
4055
4055
|
});
|
|
4056
4056
|
try {
|
|
4057
|
-
if (
|
|
4058
|
-
const
|
|
4059
|
-
(
|
|
4060
|
-
),
|
|
4061
|
-
if (!F || typeof
|
|
4057
|
+
if (I) {
|
|
4058
|
+
const _ = Array.isArray(D) ? D.map((Te) => Number(Te)) : [], F = (Ie || []).find(
|
|
4059
|
+
(Te) => Te?.ruleId === I || Te?.ruleName === I || Te?.RuleId === I
|
|
4060
|
+
), J = typeof F?.recordId == "number" ? F.recordId : void 0;
|
|
4061
|
+
if (!F || typeof J != "number") {
|
|
4062
4062
|
ne.error("Unable to find rule recordId for update");
|
|
4063
4063
|
return;
|
|
4064
4064
|
}
|
|
4065
|
-
const
|
|
4065
|
+
const G = {
|
|
4066
4066
|
...F,
|
|
4067
4067
|
actions: [
|
|
4068
4068
|
//this will definitely be remoed
|
|
@@ -4079,193 +4079,193 @@ function wn({ severities: e, rules: t, userRoles: s, rawRules: r, onSave: n }) {
|
|
|
4079
4079
|
}
|
|
4080
4080
|
],
|
|
4081
4081
|
escalationSettings: {
|
|
4082
|
-
level1UserRoleId:
|
|
4083
|
-
level1PostAssistTime:
|
|
4084
|
-
level2UserRoleId:
|
|
4085
|
-
level2PostAssistTime:
|
|
4086
|
-
level3UserRoleId:
|
|
4087
|
-
level3PostAssistTime:
|
|
4088
|
-
escalationSettingsActionTypeIds:
|
|
4082
|
+
level1UserRoleId: ee ?? 0,
|
|
4083
|
+
level1PostAssistTime: T ?? 0,
|
|
4084
|
+
level2UserRoleId: w ?? 0,
|
|
4085
|
+
level2PostAssistTime: v ?? 0,
|
|
4086
|
+
level3UserRoleId: O ?? 0,
|
|
4087
|
+
level3PostAssistTime: g ?? 0,
|
|
4088
|
+
escalationSettingsActionTypeIds: _,
|
|
4089
4089
|
thirdPartyId: Array.isArray(Q) ? Q : [],
|
|
4090
4090
|
humanLoop: ie
|
|
4091
4091
|
}
|
|
4092
|
-
},
|
|
4093
|
-
if (
|
|
4094
|
-
ne.success("Escalation settings saved"), await ws(),
|
|
4092
|
+
}, te = await a.updateRule(J, G);
|
|
4093
|
+
if (te?.responseStatus || te?.ok || te) {
|
|
4094
|
+
ne.success("Escalation settings saved"), await ws(), C(void 0), Z(void 0), R(void 0), m(void 0), p(void 0), S(void 0), L(void 0), j([]), z([]), me(!1);
|
|
4095
4095
|
return;
|
|
4096
4096
|
}
|
|
4097
4097
|
}
|
|
4098
|
-
} catch (
|
|
4099
|
-
console.error("Error saving escalation settings",
|
|
4098
|
+
} catch (_) {
|
|
4099
|
+
console.error("Error saving escalation settings", _);
|
|
4100
4100
|
} finally {
|
|
4101
|
-
|
|
4101
|
+
Ce(!1);
|
|
4102
4102
|
}
|
|
4103
|
-
const
|
|
4104
|
-
|
|
4105
|
-
...
|
|
4103
|
+
const X = t.find((_) => _.RuleId === I)?.Name || "-";
|
|
4104
|
+
q((_) => [
|
|
4105
|
+
..._,
|
|
4106
4106
|
{
|
|
4107
4107
|
id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
4108
|
-
ruleOrSeverityLabel:
|
|
4109
|
-
l1: { minutes:
|
|
4110
|
-
l2: { minutes:
|
|
4111
|
-
l3: { minutes:
|
|
4108
|
+
ruleOrSeverityLabel: X,
|
|
4109
|
+
l1: { minutes: T, roles: ee ? [ee] : [] },
|
|
4110
|
+
l2: { minutes: v, roles: w ? [w] : [] },
|
|
4111
|
+
l3: { minutes: g, roles: O ? [O] : [] },
|
|
4112
4112
|
actions: (Array.isArray(D) ? D : []).map((F) => {
|
|
4113
|
-
const
|
|
4114
|
-
return
|
|
4113
|
+
const J = Number(F);
|
|
4114
|
+
return de[J] || String(F);
|
|
4115
4115
|
}),
|
|
4116
|
-
notify: (Array.isArray(Q) ? Q : []).map((F) =>
|
|
4116
|
+
notify: (Array.isArray(Q) ? Q : []).map((F) => ae[F] || String(F)),
|
|
4117
4117
|
humanLoop: !!ie
|
|
4118
4118
|
}
|
|
4119
4119
|
]);
|
|
4120
4120
|
},
|
|
4121
|
-
saving:
|
|
4121
|
+
saving: se,
|
|
4122
4122
|
onActionTypesLoaded: (E) => {
|
|
4123
|
-
const
|
|
4124
|
-
for (const
|
|
4125
|
-
typeof
|
|
4126
|
-
re(
|
|
4123
|
+
const X = {};
|
|
4124
|
+
for (const _ of E)
|
|
4125
|
+
typeof _.actionTypeId == "number" && (X[_.actionTypeId] = _.name);
|
|
4126
|
+
re(X);
|
|
4127
4127
|
}
|
|
4128
4128
|
}
|
|
4129
4129
|
)
|
|
4130
4130
|
] }),
|
|
4131
|
-
/* @__PURE__ */ i(
|
|
4131
|
+
/* @__PURE__ */ i(He, { className: "my-6" }),
|
|
4132
4132
|
/* @__PURE__ */ i(
|
|
4133
4133
|
Sn,
|
|
4134
4134
|
{
|
|
4135
|
-
entries:
|
|
4136
|
-
userRoles:
|
|
4137
|
-
loading:
|
|
4135
|
+
entries: P,
|
|
4136
|
+
userRoles: Se,
|
|
4137
|
+
loading: Be,
|
|
4138
4138
|
onEdit: (E) => {
|
|
4139
|
-
|
|
4140
|
-
const
|
|
4141
|
-
|
|
4139
|
+
K("rules");
|
|
4140
|
+
const X = P.find((F) => F.id === E), _ = t.find((F) => F.RuleId === E) || (X ? t.find((F) => F.Name === X.ruleOrSeverityLabel) : void 0);
|
|
4141
|
+
C(_ ? _.RuleId : E);
|
|
4142
4142
|
}
|
|
4143
4143
|
}
|
|
4144
4144
|
),
|
|
4145
|
-
/* @__PURE__ */ i(
|
|
4146
|
-
/* @__PURE__ */ i(Nn, { userRoles:
|
|
4147
|
-
/* @__PURE__ */ i(
|
|
4145
|
+
/* @__PURE__ */ i(He, { className: "my-6" }),
|
|
4146
|
+
/* @__PURE__ */ i(Nn, { userRoles: Se, rules: t, rawRules: r }),
|
|
4147
|
+
/* @__PURE__ */ i(He, {})
|
|
4148
4148
|
] });
|
|
4149
4149
|
}
|
|
4150
|
-
const { Title:
|
|
4150
|
+
const { Title: ss, Text: Je } = We;
|
|
4151
4151
|
function xn({ severities: e, rules: t, onSave: s, onCancel: r }) {
|
|
4152
|
-
const { rules: n, alerts: a } =
|
|
4152
|
+
const { rules: n, alerts: a } = xe(), o = [
|
|
4153
4153
|
{ label: "By Severity", value: "By Severity" },
|
|
4154
4154
|
{ label: "By Created Date", value: "By Created Date" }
|
|
4155
|
-
], [l, h] =
|
|
4156
|
-
|
|
4157
|
-
let
|
|
4155
|
+
], [l, h] = x("By Severity"), [d, c] = x(/* @__PURE__ */ new Set()), [A, f] = x(null), [k, N] = x(null), [y, b] = x({ inApp: !1, sms: !1, email: !1 }), [$, M] = x([]), [B, U] = x(!0), [V, K] = x(!1);
|
|
4156
|
+
fe(() => {
|
|
4157
|
+
let I = !1;
|
|
4158
4158
|
return (async () => {
|
|
4159
4159
|
try {
|
|
4160
|
-
const
|
|
4161
|
-
if (
|
|
4162
|
-
|
|
4163
|
-
inApp: !!
|
|
4160
|
+
const C = await a.getPreferenceSettings();
|
|
4161
|
+
if (I || !C) return;
|
|
4162
|
+
b({
|
|
4163
|
+
inApp: !!C.inApp,
|
|
4164
4164
|
//convert to bool - as the resp is str
|
|
4165
|
-
sms: !!
|
|
4166
|
-
email: !!
|
|
4165
|
+
sms: !!C.sms,
|
|
4166
|
+
email: !!C.email
|
|
4167
4167
|
});
|
|
4168
|
-
const
|
|
4169
|
-
h(
|
|
4170
|
-
} catch (
|
|
4171
|
-
console.error("Error in loading my preferences: ",
|
|
4168
|
+
const T = is(C.sortBy);
|
|
4169
|
+
h(T === "By Created Date" ? "By Created Date" : "By Severity"), f(jt(C.doNotDisturbStart)), N(jt(C.doNotDisturbEnd)), Array.isArray(C.anomalyIds) && c(new Set(C.anomalyIds.map((Z) => String(Z))));
|
|
4170
|
+
} catch (C) {
|
|
4171
|
+
console.error("Error in loading my preferences: ", C);
|
|
4172
4172
|
}
|
|
4173
4173
|
})(), () => {
|
|
4174
|
-
|
|
4174
|
+
I = !0;
|
|
4175
4175
|
};
|
|
4176
|
-
}, []),
|
|
4177
|
-
let
|
|
4176
|
+
}, []), fe(() => {
|
|
4177
|
+
let I = !1;
|
|
4178
4178
|
return (async () => {
|
|
4179
4179
|
try {
|
|
4180
4180
|
U(!0);
|
|
4181
|
-
const
|
|
4182
|
-
if (
|
|
4183
|
-
const
|
|
4184
|
-
|
|
4185
|
-
} catch (
|
|
4186
|
-
console.error("Failed to load anomalies lookups",
|
|
4181
|
+
const C = await n.getLookups();
|
|
4182
|
+
if (I || !C) return;
|
|
4183
|
+
const T = Array.isArray(C.anomalies) ? C.anomalies : [];
|
|
4184
|
+
M(T);
|
|
4185
|
+
} catch (C) {
|
|
4186
|
+
console.error("Failed to load anomalies lookups", C);
|
|
4187
4187
|
} finally {
|
|
4188
|
-
|
|
4188
|
+
I || U(!1);
|
|
4189
4189
|
}
|
|
4190
4190
|
})(), () => {
|
|
4191
|
-
|
|
4191
|
+
I = !0;
|
|
4192
4192
|
};
|
|
4193
4193
|
}, []);
|
|
4194
|
-
const
|
|
4195
|
-
c((
|
|
4196
|
-
const
|
|
4197
|
-
return
|
|
4194
|
+
const W = (I) => {
|
|
4195
|
+
c((C) => {
|
|
4196
|
+
const T = new Set(C);
|
|
4197
|
+
return T.has(I) ? T.delete(I) : T.add(I), T;
|
|
4198
4198
|
});
|
|
4199
|
-
},
|
|
4199
|
+
}, Y = async () => {
|
|
4200
4200
|
s?.({
|
|
4201
4201
|
sortBy: l,
|
|
4202
4202
|
subscribedRuleIds: Array.from(d),
|
|
4203
4203
|
dnd: {
|
|
4204
|
-
from:
|
|
4205
|
-
to:
|
|
4204
|
+
from: A,
|
|
4205
|
+
to: k
|
|
4206
4206
|
},
|
|
4207
|
-
channels:
|
|
4207
|
+
channels: y
|
|
4208
4208
|
});
|
|
4209
4209
|
try {
|
|
4210
|
-
|
|
4211
|
-
const
|
|
4212
|
-
anomalyIds:
|
|
4213
|
-
doNotDisturbStart:
|
|
4214
|
-
doNotDisturbEnd:
|
|
4215
|
-
inApp: !!
|
|
4216
|
-
sms: !!
|
|
4217
|
-
email: !!
|
|
4210
|
+
K(!0);
|
|
4211
|
+
const I = A ? A.format?.("HH:mm:ss") ?? "00:00:00" : "00:00:00", C = k ? k.format?.("HH:mm:ss") ?? "00:00:00" : "00:00:00", T = Array.from(d).map((ee) => Number(ee)).filter((ee) => Number.isFinite(ee)), Z = await a.setPreferenceSettings({
|
|
4212
|
+
anomalyIds: T,
|
|
4213
|
+
doNotDisturbStart: I,
|
|
4214
|
+
doNotDisturbEnd: C,
|
|
4215
|
+
inApp: !!y.inApp,
|
|
4216
|
+
sms: !!y.sms,
|
|
4217
|
+
email: !!y.email,
|
|
4218
4218
|
sortBy: l
|
|
4219
4219
|
});
|
|
4220
|
-
|
|
4221
|
-
} catch (
|
|
4222
|
-
console.error("Error in saving my preferences: ",
|
|
4220
|
+
Z?.responseStatus && ne.success(Z?.data || "Preferences updated successfully.");
|
|
4221
|
+
} catch (I) {
|
|
4222
|
+
console.error("Error in saving my preferences: ", I);
|
|
4223
4223
|
} finally {
|
|
4224
|
-
|
|
4224
|
+
K(!1);
|
|
4225
4225
|
}
|
|
4226
4226
|
};
|
|
4227
4227
|
return /* @__PURE__ */ u("div", { className: "w-full", children: [
|
|
4228
|
-
/* @__PURE__ */ i(
|
|
4229
|
-
/* @__PURE__ */ i(
|
|
4230
|
-
/* @__PURE__ */ i(
|
|
4228
|
+
/* @__PURE__ */ i(ge, { gutter: [16, 16], align: "middle", className: "mb-4", children: /* @__PURE__ */ i(H, { xs: 24, md: 8, children: /* @__PURE__ */ u(we, { direction: "horizontal", size: 12, className: "w-full items-center", children: [
|
|
4229
|
+
/* @__PURE__ */ i(Je, { className: "text-gray-600", children: "Sort By:" }),
|
|
4230
|
+
/* @__PURE__ */ i(pe, { className: "w-[240px]", value: l, options: o, onChange: h })
|
|
4231
4231
|
] }) }) }),
|
|
4232
4232
|
/* @__PURE__ */ u("div", { className: "mb-4", children: [
|
|
4233
|
-
/* @__PURE__ */ i(
|
|
4234
|
-
B ? /* @__PURE__ */ i("div", { className: "py-4", children: /* @__PURE__ */ i(
|
|
4235
|
-
const
|
|
4236
|
-
return /* @__PURE__ */ i(
|
|
4233
|
+
/* @__PURE__ */ i(ss, { level: 5, className: "!mb-2", children: "Anomalies" }),
|
|
4234
|
+
B ? /* @__PURE__ */ i("div", { className: "py-4", children: /* @__PURE__ */ i(St, {}) }) : /* @__PURE__ */ i(we, { direction: "vertical", size: 10, className: "w-full", children: (Array.isArray($) ? $ : []).map((I) => {
|
|
4235
|
+
const C = String(I.recordId), T = I.anomalyName;
|
|
4236
|
+
return /* @__PURE__ */ i(_e, { checked: d.has(C), onChange: () => W(C), children: T }, C);
|
|
4237
4237
|
}) })
|
|
4238
4238
|
] }),
|
|
4239
4239
|
/* @__PURE__ */ u("div", { className: "mb-4", children: [
|
|
4240
|
-
/* @__PURE__ */ i(
|
|
4241
|
-
/* @__PURE__ */ i(
|
|
4242
|
-
/* @__PURE__ */ i(
|
|
4243
|
-
/* @__PURE__ */ u(
|
|
4244
|
-
/* @__PURE__ */ u(
|
|
4245
|
-
/* @__PURE__ */ i(
|
|
4246
|
-
/* @__PURE__ */ i(
|
|
4240
|
+
/* @__PURE__ */ i(ss, { level: 5, className: "!mb-2", children: "Notification Timing & Channels" }),
|
|
4241
|
+
/* @__PURE__ */ i(ge, { gutter: [16, 16], align: "middle", className: "mb-3", children: /* @__PURE__ */ i(H, { xs: 24, md: 12, children: /* @__PURE__ */ u(we, { direction: "horizontal", size: 12, className: "w-full items-center", children: [
|
|
4242
|
+
/* @__PURE__ */ i(Je, { children: "Do Not Disturb mode:" }),
|
|
4243
|
+
/* @__PURE__ */ u(we, { size: 12, className: "w-full", children: [
|
|
4244
|
+
/* @__PURE__ */ u(we, { direction: "horizontal", size: 8, className: "items-center", children: [
|
|
4245
|
+
/* @__PURE__ */ i(Je, { children: "From" }),
|
|
4246
|
+
/* @__PURE__ */ i(Ft, { value: A, onChange: (I) => f(I), format: "HH:mm" })
|
|
4247
4247
|
] }),
|
|
4248
|
-
/* @__PURE__ */ u(
|
|
4249
|
-
/* @__PURE__ */ i(
|
|
4250
|
-
/* @__PURE__ */ i(
|
|
4248
|
+
/* @__PURE__ */ u(we, { direction: "horizontal", size: 8, className: "items-center", children: [
|
|
4249
|
+
/* @__PURE__ */ i(Je, { children: "To" }),
|
|
4250
|
+
/* @__PURE__ */ i(Ft, { value: k, onChange: (I) => N(I), format: "HH:mm" })
|
|
4251
4251
|
] })
|
|
4252
4252
|
] })
|
|
4253
4253
|
] }) }) }),
|
|
4254
|
-
/* @__PURE__ */ u(
|
|
4255
|
-
/* @__PURE__ */ i(H, { children: /* @__PURE__ */ i(
|
|
4256
|
-
/* @__PURE__ */ i(H, { children: /* @__PURE__ */ i(
|
|
4257
|
-
/* @__PURE__ */ i(H, { children: /* @__PURE__ */ i(
|
|
4254
|
+
/* @__PURE__ */ u(ge, { gutter: [24, 12], children: [
|
|
4255
|
+
/* @__PURE__ */ i(H, { children: /* @__PURE__ */ i(_e, { checked: y.inApp, onChange: (I) => b({ ...y, inApp: I.target.checked }), children: "In-app" }) }),
|
|
4256
|
+
/* @__PURE__ */ i(H, { children: /* @__PURE__ */ i(_e, { checked: y.sms, onChange: (I) => b({ ...y, sms: I.target.checked }), children: "SMS" }) }),
|
|
4257
|
+
/* @__PURE__ */ i(H, { children: /* @__PURE__ */ i(_e, { checked: y.email, onChange: (I) => b({ ...y, email: I.target.checked }), children: "Email" }) })
|
|
4258
4258
|
] })
|
|
4259
4259
|
] }),
|
|
4260
|
-
/* @__PURE__ */ i(
|
|
4261
|
-
/* @__PURE__ */ u(
|
|
4262
|
-
/* @__PURE__ */ i(
|
|
4263
|
-
/* @__PURE__ */ i(
|
|
4260
|
+
/* @__PURE__ */ i(He, {}),
|
|
4261
|
+
/* @__PURE__ */ u(we, { className: "gap-3", children: [
|
|
4262
|
+
/* @__PURE__ */ i(ye, { onClick: r, disabled: V, children: "Cancel" }),
|
|
4263
|
+
/* @__PURE__ */ i(ye, { type: "primary", onClick: Y, loading: V, children: "Save" })
|
|
4264
4264
|
] })
|
|
4265
4265
|
] });
|
|
4266
4266
|
}
|
|
4267
|
-
function
|
|
4268
|
-
const [n, a] =
|
|
4267
|
+
function Cn({ severities: e, rules: t, userRoles: s, rawRules: r }) {
|
|
4268
|
+
const [n, a] = x("global");
|
|
4269
4269
|
return /* @__PURE__ */ u("div", { className: "w-full", children: [
|
|
4270
4270
|
/* @__PURE__ */ u("div", { className: "inline-flex rounded-xl overflow-hidden border border-gray-200 mb-4", children: [
|
|
4271
4271
|
/* @__PURE__ */ i(
|
|
@@ -4289,9 +4289,9 @@ function In({ severities: e, rules: t, userRoles: s, rawRules: r }) {
|
|
|
4289
4289
|
n === "global" ? /* @__PURE__ */ i(wn, { severities: e, rules: t, userRoles: s, rawRules: r }) : /* @__PURE__ */ i(xn, { severities: e, rules: t })
|
|
4290
4290
|
] });
|
|
4291
4291
|
}
|
|
4292
|
-
const
|
|
4292
|
+
const In = "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=", Tn = "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";
|
|
4293
4293
|
function Rn(e) {
|
|
4294
|
-
const t = (e.status || "").toLowerCase() === "completed" ? /* @__PURE__ */ i("img", { src:
|
|
4294
|
+
const t = (e.status || "").toLowerCase() === "completed" ? /* @__PURE__ */ i("img", { src: In, alt: "completed", style: { width: 20, height: 20 } }) : /* @__PURE__ */ i("img", { src: Tn, alt: "pending", style: { width: 20, height: 20 } });
|
|
4295
4295
|
return {
|
|
4296
4296
|
title: /* @__PURE__ */ u("div", { className: "flex flex-col gap-0 min-w-0", children: [
|
|
4297
4297
|
/* @__PURE__ */ u("div", { className: "flex flex-col", children: [
|
|
@@ -4306,7 +4306,7 @@ function Rn(e) {
|
|
|
4306
4306
|
}
|
|
4307
4307
|
function kn({ data: e }) {
|
|
4308
4308
|
return /* @__PURE__ */ i("div", { className: "w-full", children: /* @__PURE__ */ i(
|
|
4309
|
-
|
|
4309
|
+
At,
|
|
4310
4310
|
{
|
|
4311
4311
|
type: "card",
|
|
4312
4312
|
items: [
|
|
@@ -4314,7 +4314,7 @@ function kn({ data: e }) {
|
|
|
4314
4314
|
key: "action",
|
|
4315
4315
|
label: "Action Taken",
|
|
4316
4316
|
children: /* @__PURE__ */ u("div", { className: "w-full", children: [
|
|
4317
|
-
/* @__PURE__ */ i(
|
|
4317
|
+
/* @__PURE__ */ i(lt, { className: "mb-4 rounded-md p-4", bordered: !0, children: /* @__PURE__ */ u("div", { className: "grid grid-cols-4 gap-6 text-xs", children: [
|
|
4318
4318
|
/* @__PURE__ */ u("div", { className: "flex flex-col gap-1", children: [
|
|
4319
4319
|
/* @__PURE__ */ i("span", { className: "text-gray-500", children: "Alert ID" }),
|
|
4320
4320
|
/* @__PURE__ */ i("span", { className: "text-black", children: e.summary.alertNumber })
|
|
@@ -4332,7 +4332,7 @@ function kn({ data: e }) {
|
|
|
4332
4332
|
/* @__PURE__ */ i("span", { className: "text-black", children: e.summary.location })
|
|
4333
4333
|
] })
|
|
4334
4334
|
] }) }),
|
|
4335
|
-
/* @__PURE__ */ u(
|
|
4335
|
+
/* @__PURE__ */ u(lt, { className: "rounded-md p-4", bordered: !0, children: [
|
|
4336
4336
|
/* @__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" }) }),
|
|
4337
4337
|
/* @__PURE__ */ i("div", { className: "mt-2", children: /* @__PURE__ */ i(
|
|
4338
4338
|
Es,
|
|
@@ -4350,11 +4350,11 @@ function kn({ data: e }) {
|
|
|
4350
4350
|
key: "notification",
|
|
4351
4351
|
label: "Notification Sent",
|
|
4352
4352
|
children: /* @__PURE__ */ u("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
4353
|
-
(e.notifications || []).map((t, s) => /* @__PURE__ */ u(
|
|
4353
|
+
(e.notifications || []).map((t, s) => /* @__PURE__ */ u(lt, { className: "rounded-md p-4", bordered: !0, children: [
|
|
4354
4354
|
/* @__PURE__ */ u("div", { className: "flex items-start justify-between", children: [
|
|
4355
4355
|
/* @__PURE__ */ u("div", { className: "flex flex-col", children: [
|
|
4356
4356
|
/* @__PURE__ */ i("h4", { className: "text-sm text-black font-medium", children: t.channelLabel }),
|
|
4357
|
-
/* @__PURE__ */ i("span", { className: "text-xs text-gray-500 mt-1", children:
|
|
4357
|
+
/* @__PURE__ */ i("span", { className: "text-xs text-gray-500 mt-1", children: ns(t.sentAt)?.format("MM/DD/YYYY HH:mm:ss") })
|
|
4358
4358
|
] }),
|
|
4359
4359
|
/* @__PURE__ */ u("span", { className: "text-[11px] px-2 py-1 rounded-full bg-green-50 text-green-700 border border-green-200", children: [
|
|
4360
4360
|
t.delivered,
|
|
@@ -4437,9 +4437,9 @@ const On = ({
|
|
|
4437
4437
|
location: r || "",
|
|
4438
4438
|
alertNumber: n ?? ""
|
|
4439
4439
|
}, h = a?.length ? a.map((c) => {
|
|
4440
|
-
const
|
|
4440
|
+
const A = (c?.status || c?.eventStatus || "").toLowerCase() === "completed" ? "Completed" : "Inprogress", f = c?.createdDate ? vt(c.createdDate) : c?.timestamp ? vt(c.timestamp) : "";
|
|
4441
4441
|
return {
|
|
4442
|
-
status:
|
|
4442
|
+
status: A,
|
|
4443
4443
|
title: c?.status || c?.eventStatus || "Status Update",
|
|
4444
4444
|
description: c?.description || c?.actionNotes || "",
|
|
4445
4445
|
timestamp: f
|
|
@@ -4460,7 +4460,7 @@ function En(e) {
|
|
|
4460
4460
|
const t = (e?.mediaType || e?.type || "").toString().toLowerCase();
|
|
4461
4461
|
return t === "video" || t === "mp4" ? !0 : Pn(e?.mediaUrl || e);
|
|
4462
4462
|
}
|
|
4463
|
-
function
|
|
4463
|
+
function ut(e) {
|
|
4464
4464
|
const t = e;
|
|
4465
4465
|
return t ? Array.isArray(t) ? t : [t] : [];
|
|
4466
4466
|
}
|
|
@@ -4474,120 +4474,123 @@ const Dn = {
|
|
|
4474
4474
|
High: "#FF95004D",
|
|
4475
4475
|
Medium: "#FEF9C2",
|
|
4476
4476
|
Low: "#E0EDFF"
|
|
4477
|
-
}, Mn = ({ isModalOpen: e, handleModalClose: t, selectedRow: s, fetchAlertLogs: r, alertStatusList: n = [], alertStatusLoading: a = !1, initialTab: o = "details" }) => {
|
|
4478
|
-
const [
|
|
4479
|
-
eventName:
|
|
4480
|
-
alertId:
|
|
4481
|
-
timestamp:
|
|
4482
|
-
description:
|
|
4483
|
-
spaceName:
|
|
4484
|
-
assignTeam:
|
|
4485
|
-
priority:
|
|
4486
|
-
statusType:
|
|
4487
|
-
id:
|
|
4488
|
-
alertDetails:
|
|
4489
|
-
statusHistory:
|
|
4490
|
-
mediaDetails:
|
|
4491
|
-
alertNumber:
|
|
4492
|
-
} =
|
|
4493
|
-
const
|
|
4494
|
-
return
|
|
4495
|
-
},
|
|
4496
|
-
name:
|
|
4497
|
-
role:
|
|
4498
|
-
phone:
|
|
4499
|
-
status:
|
|
4500
|
-
notificationReceipientType:
|
|
4501
|
-
}),
|
|
4502
|
-
const
|
|
4477
|
+
}, Mn = ({ isModalOpen: e, handleModalClose: t, selectedRow: s, fetchAlertLogs: r, alertStatusList: n = [], alertStatusLoading: a = !1, initialTab: o = "details", sourceTab: l }) => {
|
|
4478
|
+
const [h, d] = x(), [c, A] = x(""), [f, k] = x(!1), N = Ts(null), [y, b] = x("details"), [$, M] = x(void 0), [B, U] = x(!1), V = vs(), { alerts: K, config: W } = xe(), Y = W?.tenant === "schools", I = s?.originalData || {}, {
|
|
4479
|
+
eventName: C,
|
|
4480
|
+
alertId: T,
|
|
4481
|
+
timestamp: Z,
|
|
4482
|
+
description: ee,
|
|
4483
|
+
spaceName: R,
|
|
4484
|
+
assignTeam: v,
|
|
4485
|
+
priority: m,
|
|
4486
|
+
statusType: w,
|
|
4487
|
+
id: p,
|
|
4488
|
+
alertDetails: g,
|
|
4489
|
+
statusHistory: S,
|
|
4490
|
+
mediaDetails: O,
|
|
4491
|
+
alertNumber: L
|
|
4492
|
+
} = I, D = !Y && typeof I?.anomalyName == "string" && String(I?.anomalyName || "").toLowerCase().includes("elopement"), j = (P) => {
|
|
4493
|
+
const q = String(P || "").toLowerCase();
|
|
4494
|
+
return q === "delivered" ? "Delivered" : q === "failed" ? "Failed" : "Queued";
|
|
4495
|
+
}, Q = (P) => ({
|
|
4496
|
+
name: P?.receipientName || P?.recipientName || "-",
|
|
4497
|
+
role: P?.receipientRoleName || "",
|
|
4498
|
+
phone: P?.receipentPhoneNumber || P?.recipientPhoneNumber || P?.receipientEmail || P?.recipientEmail || "",
|
|
4499
|
+
status: j(P?.messageStatus),
|
|
4500
|
+
notificationReceipientType: P?.notificationReceipientType || ""
|
|
4501
|
+
}), z = (P, q) => {
|
|
4502
|
+
const se = q.map(Q), Ce = se.filter((Ee) => Ee.status === "Delivered").length, Be = q.map((Ee) => Ee?.sentAt).filter(Boolean).sort((Ee, it) => new Date(it).getTime() - new Date(Ee).getTime())[0], qe = q[0] || {}, Ie = [qe?.severityName, qe?.anomalyName].filter(Boolean).join(" - ") || `${P} Notification`;
|
|
4503
4503
|
return {
|
|
4504
|
-
channelLabel: `${
|
|
4505
|
-
sentAt:
|
|
4506
|
-
messageTitle:
|
|
4504
|
+
channelLabel: `${P} Notification`,
|
|
4505
|
+
sentAt: Be || "",
|
|
4506
|
+
messageTitle: Ie,
|
|
4507
4507
|
messageBody: "",
|
|
4508
|
-
total:
|
|
4509
|
-
delivered:
|
|
4510
|
-
recipients:
|
|
4508
|
+
total: se.length,
|
|
4509
|
+
delivered: Ce,
|
|
4510
|
+
recipients: se
|
|
4511
4511
|
};
|
|
4512
|
-
},
|
|
4513
|
-
const
|
|
4514
|
-
return (
|
|
4515
|
-
const
|
|
4516
|
-
|
|
4517
|
-
}), Array.from(
|
|
4518
|
-
},
|
|
4512
|
+
}, ie = (P) => {
|
|
4513
|
+
const q = /* @__PURE__ */ new Map();
|
|
4514
|
+
return (P || []).forEach((se) => {
|
|
4515
|
+
const Ce = String(se?.notificationType || "Unknown"), Be = q.get(Ce) || [];
|
|
4516
|
+
Be.push(se), q.set(Ce, Be);
|
|
4517
|
+
}), Array.from(q.entries()).map(([se, Ce]) => z(se, Ce));
|
|
4518
|
+
}, me = async (P) => {
|
|
4519
4519
|
try {
|
|
4520
|
-
const
|
|
4521
|
-
|
|
4520
|
+
const q = await K.getAlertNotifications(P), se = ie(q);
|
|
4521
|
+
M(se);
|
|
4522
4522
|
} catch {
|
|
4523
|
-
|
|
4523
|
+
M(void 0);
|
|
4524
4524
|
}
|
|
4525
4525
|
};
|
|
4526
|
-
|
|
4527
|
-
if (
|
|
4528
|
-
let
|
|
4529
|
-
return
|
|
4530
|
-
|
|
4526
|
+
fe(() => {
|
|
4527
|
+
if (y !== "track" || !p) return;
|
|
4528
|
+
let P = !1;
|
|
4529
|
+
return me(p).then(() => {
|
|
4530
|
+
P && M(void 0);
|
|
4531
4531
|
}), () => {
|
|
4532
|
-
|
|
4532
|
+
P = !0;
|
|
4533
4533
|
};
|
|
4534
|
-
}, [
|
|
4535
|
-
e &&
|
|
4534
|
+
}, [y, p]), fe(() => {
|
|
4535
|
+
e && b(o);
|
|
4536
4536
|
}, [e, o]);
|
|
4537
|
-
const
|
|
4538
|
-
value
|
|
4539
|
-
|
|
4540
|
-
}
|
|
4537
|
+
const re = l === "archived" || ["completed", "false positive"].includes(String(w || "").toLowerCase()), ae = (P) => {
|
|
4538
|
+
const q = String(P?.value || "").toLowerCase(), se = String(P?.statusName || "").toLowerCase();
|
|
4539
|
+
return q.includes("reopen") || se.includes("reopen");
|
|
4540
|
+
}, be = (n || []).filter((P) => {
|
|
4541
|
+
const q = ae(P);
|
|
4542
|
+
return typeof l < "u" ? l === "archived" ? q : !q : re ? q : !q;
|
|
4543
|
+
}).map((P) => ({ value: P.value, label: P.statusName })), Se = async () => {
|
|
4541
4544
|
try {
|
|
4542
|
-
|
|
4543
|
-
const
|
|
4544
|
-
alertUniqueId:
|
|
4545
|
-
alertId:
|
|
4546
|
-
status:
|
|
4547
|
-
notes:
|
|
4545
|
+
k(!0);
|
|
4546
|
+
const P = {
|
|
4547
|
+
alertUniqueId: T,
|
|
4548
|
+
alertId: p,
|
|
4549
|
+
status: h ? String(h) : void 0,
|
|
4550
|
+
notes: c.trim(),
|
|
4548
4551
|
modifiedBy: 0
|
|
4549
|
-
},
|
|
4550
|
-
if (
|
|
4551
|
-
const
|
|
4552
|
-
ne.success(
|
|
4552
|
+
}, q = await V.mutateAsync(P);
|
|
4553
|
+
if (q?.responseStatus) {
|
|
4554
|
+
const se = q?.data || "Alert updated successfully.";
|
|
4555
|
+
ne.success(se, {
|
|
4553
4556
|
autoClose: 1500,
|
|
4554
4557
|
onClose: () => {
|
|
4555
4558
|
r(), t();
|
|
4556
4559
|
}
|
|
4557
|
-
}),
|
|
4560
|
+
}), d(void 0), A("");
|
|
4558
4561
|
} else {
|
|
4559
|
-
const
|
|
4560
|
-
ne.error(
|
|
4562
|
+
const se = q?.errorMessage || "Failed to update alert status";
|
|
4563
|
+
ne.error(se);
|
|
4561
4564
|
}
|
|
4562
|
-
} catch (
|
|
4563
|
-
console.error("Error updating alert status:",
|
|
4565
|
+
} catch (P) {
|
|
4566
|
+
console.error("Error updating alert status:", P), ne.error("Failed to update alert status. Please try again.");
|
|
4564
4567
|
} finally {
|
|
4565
|
-
|
|
4568
|
+
k(!1);
|
|
4566
4569
|
}
|
|
4567
|
-
},
|
|
4570
|
+
}, nt = async () => {
|
|
4568
4571
|
try {
|
|
4569
|
-
if (!
|
|
4572
|
+
if (!p) {
|
|
4570
4573
|
ne.error("Alert ID is missing.");
|
|
4571
4574
|
return;
|
|
4572
4575
|
}
|
|
4573
|
-
|
|
4574
|
-
const
|
|
4576
|
+
U(!0);
|
|
4577
|
+
const P = p;
|
|
4575
4578
|
if (!K.notifyFamilyMembers) {
|
|
4576
4579
|
ne.error("Notify Family is not supported.");
|
|
4577
4580
|
return;
|
|
4578
4581
|
}
|
|
4579
|
-
const
|
|
4580
|
-
if (
|
|
4581
|
-
const
|
|
4582
|
-
ne.success(
|
|
4582
|
+
const q = await K.notifyFamilyMembers(P);
|
|
4583
|
+
if (q?.responseStatus) {
|
|
4584
|
+
const se = q?.data || "Alert Notifications sent to Family Members.";
|
|
4585
|
+
ne.success(se);
|
|
4583
4586
|
} else {
|
|
4584
|
-
const
|
|
4585
|
-
ne.error(
|
|
4587
|
+
const se = q?.errorMessage || "Failed to send notifications.";
|
|
4588
|
+
ne.error(se);
|
|
4586
4589
|
}
|
|
4587
|
-
} catch (
|
|
4588
|
-
console.error("Error notifying family members:",
|
|
4590
|
+
} catch (P) {
|
|
4591
|
+
console.error("Error notifying family members:", P), ne.error("Failed to send notifications. Please try again.");
|
|
4589
4592
|
} finally {
|
|
4590
|
-
|
|
4593
|
+
U(!1);
|
|
4591
4594
|
}
|
|
4592
4595
|
};
|
|
4593
4596
|
return /* @__PURE__ */ i(
|
|
@@ -4602,91 +4605,91 @@ const Dn = {
|
|
|
4602
4605
|
overflowY: "auto"
|
|
4603
4606
|
}
|
|
4604
4607
|
},
|
|
4605
|
-
footer:
|
|
4606
|
-
/* @__PURE__ */ i(
|
|
4608
|
+
footer: y === "details" ? /* @__PURE__ */ u("div", { className: "flex flex-row gap-2 justify-start", children: [
|
|
4609
|
+
/* @__PURE__ */ i(ye, { onClick: t, className: "bg-[#6C757D] text-white", children: "Cancel" }),
|
|
4607
4610
|
/* @__PURE__ */ i(
|
|
4608
|
-
|
|
4611
|
+
ye,
|
|
4609
4612
|
{
|
|
4610
4613
|
type: "primary",
|
|
4611
|
-
onClick:
|
|
4612
|
-
loading:
|
|
4613
|
-
children:
|
|
4614
|
+
onClick: Se,
|
|
4615
|
+
loading: f,
|
|
4616
|
+
children: f ? "Saving..." : "Save Changes"
|
|
4614
4617
|
}
|
|
4615
4618
|
)
|
|
4616
4619
|
] }) : null,
|
|
4617
4620
|
children: s && /* @__PURE__ */ i(
|
|
4618
|
-
|
|
4621
|
+
At,
|
|
4619
4622
|
{
|
|
4620
|
-
activeKey:
|
|
4621
|
-
onChange: (
|
|
4623
|
+
activeKey: y,
|
|
4624
|
+
onChange: (P) => b(P),
|
|
4622
4625
|
items: [
|
|
4623
4626
|
{
|
|
4624
4627
|
key: "details",
|
|
4625
4628
|
label: "Alert Detail",
|
|
4626
4629
|
children: /* @__PURE__ */ u("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
4627
4630
|
/* @__PURE__ */ u("div", { className: "flex flex-col gap-2", children: [
|
|
4628
|
-
/* @__PURE__ */ i("div", { className: "text-sm font-bold", children:
|
|
4629
|
-
|
|
4631
|
+
/* @__PURE__ */ i("div", { className: "text-sm font-bold", children: C || "Alert Event" }),
|
|
4632
|
+
g?.firstName ? /* @__PURE__ */ u("div", { className: "text-sm text-gray-500", children: [
|
|
4630
4633
|
"Resident ID/Name: ",
|
|
4631
|
-
|
|
4634
|
+
g?.firstName,
|
|
4632
4635
|
" ",
|
|
4633
|
-
|
|
4636
|
+
g?.lastName || "",
|
|
4634
4637
|
" ",
|
|
4635
|
-
|
|
4638
|
+
g?.residentId || ""
|
|
4636
4639
|
] }) : null,
|
|
4637
4640
|
/* @__PURE__ */ u("div", { className: "text-sm text-gray-500", children: [
|
|
4638
4641
|
"Timestamp: ",
|
|
4639
|
-
|
|
4642
|
+
vt(Z)
|
|
4640
4643
|
] }),
|
|
4641
4644
|
/* @__PURE__ */ u("div", { className: "font-sm text-gray-500", children: [
|
|
4642
4645
|
/* @__PURE__ */ i("b", { className: "text-black text-sm/6", children: "Description:" }),
|
|
4643
4646
|
" ",
|
|
4644
|
-
|
|
4647
|
+
ee || "No description available"
|
|
4645
4648
|
] }),
|
|
4646
|
-
|
|
4649
|
+
R && /* @__PURE__ */ u("div", { className: "font-sm text-gray-500", children: [
|
|
4647
4650
|
"Space: ",
|
|
4648
|
-
|
|
4651
|
+
R
|
|
4649
4652
|
] }),
|
|
4650
|
-
|
|
4653
|
+
v && /* @__PURE__ */ u("div", { className: "font-sm text-gray-500", children: [
|
|
4651
4654
|
"Assigned to: ",
|
|
4652
|
-
|
|
4655
|
+
v
|
|
4653
4656
|
] }),
|
|
4654
4657
|
/* @__PURE__ */ u("div", { className: "flex gap-2 justify-start mt-3", children: [
|
|
4655
4658
|
/* @__PURE__ */ u(
|
|
4656
|
-
|
|
4659
|
+
Ze,
|
|
4657
4660
|
{
|
|
4658
4661
|
className: "font-sm text-gray-500 rounded-[8px] py-2 px-3",
|
|
4659
4662
|
style: {
|
|
4660
|
-
border: `2px solid ${Dn[String(
|
|
4661
|
-
backgroundColor: Fn[String(
|
|
4663
|
+
border: `2px solid ${Dn[String(m)] || "#DFE4EA"}`,
|
|
4664
|
+
backgroundColor: Fn[String(m)]
|
|
4662
4665
|
},
|
|
4663
4666
|
children: [
|
|
4664
4667
|
"Severity: ",
|
|
4665
|
-
|
|
4668
|
+
m || "N/A"
|
|
4666
4669
|
]
|
|
4667
4670
|
}
|
|
4668
4671
|
),
|
|
4669
4672
|
/* @__PURE__ */ u(
|
|
4670
|
-
|
|
4673
|
+
Ze,
|
|
4671
4674
|
{
|
|
4672
4675
|
className: "font-sm text-gray-500 rounded-[8px] py-2 px-3",
|
|
4673
|
-
style: String(
|
|
4676
|
+
style: String(w || "").toLowerCase() === "completed" ? { background: "#E7F6EC", border: "0.68px solid var(--Green, #34C759)" } : { background: "#E0EDFF", border: "1px solid var(--Grays-Gray-4, #D1D1D6)" },
|
|
4674
4677
|
children: [
|
|
4675
4678
|
"Status: ",
|
|
4676
|
-
|
|
4679
|
+
w || "N/A"
|
|
4677
4680
|
]
|
|
4678
4681
|
}
|
|
4679
4682
|
)
|
|
4680
4683
|
] }),
|
|
4681
4684
|
/* @__PURE__ */ i("div", { className: "w-full flex flex-col justify-start items-start mt-2 font-bold", children: /* @__PURE__ */ u("div", { className: "w-full mt-4", children: [
|
|
4682
4685
|
/* @__PURE__ */ i("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ i(
|
|
4683
|
-
|
|
4686
|
+
pe,
|
|
4684
4687
|
{
|
|
4685
4688
|
placeholder: "Change Status",
|
|
4686
4689
|
className: "w-full text-gray-500",
|
|
4687
|
-
onChange: (
|
|
4688
|
-
value:
|
|
4689
|
-
options:
|
|
4690
|
+
onChange: (P) => d(P),
|
|
4691
|
+
value: h,
|
|
4692
|
+
options: be,
|
|
4690
4693
|
loading: a
|
|
4691
4694
|
}
|
|
4692
4695
|
) }),
|
|
@@ -4698,19 +4701,19 @@ const Dn = {
|
|
|
4698
4701
|
id: "action-details-input",
|
|
4699
4702
|
placeholder: "Enter details...",
|
|
4700
4703
|
className: "w-full text-gray-500 h-20 border border-grey-500 rounded-md p-2",
|
|
4701
|
-
value:
|
|
4702
|
-
onChange: (
|
|
4704
|
+
value: c,
|
|
4705
|
+
onChange: (P) => A(P.target.value)
|
|
4703
4706
|
}
|
|
4704
4707
|
)
|
|
4705
4708
|
] }),
|
|
4706
|
-
|
|
4709
|
+
D && /* @__PURE__ */ u("div", { className: "border border-[#DFE4EA] rounded-md px-4 py-2 flex flex-row justify-between items-center mt-4 mb-8", children: [
|
|
4707
4710
|
/* @__PURE__ */ i("label", { htmlFor: "notify-family-button", className: "text-xs font-medium", children: "Alert notification will be sent to all Family Members." }),
|
|
4708
4711
|
/* @__PURE__ */ i(
|
|
4709
|
-
|
|
4712
|
+
ye,
|
|
4710
4713
|
{
|
|
4711
|
-
loading:
|
|
4712
|
-
onClick:
|
|
4713
|
-
disabled:
|
|
4714
|
+
loading: B,
|
|
4715
|
+
onClick: nt,
|
|
4716
|
+
disabled: B,
|
|
4714
4717
|
className: "bg-black text-white rounded-md px-4 py-2 text-xs disabled:opacity-60 disabled:cursor-not-allowed",
|
|
4715
4718
|
children: "Notify Family"
|
|
4716
4719
|
}
|
|
@@ -4721,12 +4724,12 @@ const Dn = {
|
|
|
4721
4724
|
/* @__PURE__ */ i("div", { className: "flex flex-col gap-4", children: /* @__PURE__ */ u("div", { className: "w-full mt-1", children: [
|
|
4722
4725
|
/* @__PURE__ */ u("div", { className: "w-full flex items-center justify-between", children: [
|
|
4723
4726
|
/* @__PURE__ */ i("h3", { className: "text-black font-bold text-sm", children: "Camera Footage" }),
|
|
4724
|
-
|
|
4727
|
+
ut(O).length ? /* @__PURE__ */ u("div", { className: "flex items-center gap-2", children: [
|
|
4725
4728
|
/* @__PURE__ */ i(
|
|
4726
4729
|
"button",
|
|
4727
4730
|
{
|
|
4728
4731
|
type: "button",
|
|
4729
|
-
onClick: () =>
|
|
4732
|
+
onClick: () => N.current?.prev?.(),
|
|
4730
4733
|
className: "w-6 h-6 flex items-center justify-center rounded-full bg-gray-200 hover:bg-gray-300 text-gray-600",
|
|
4731
4734
|
"aria-label": "Previous media",
|
|
4732
4735
|
children: /* @__PURE__ */ i(Bs, { style: { fontSize: 12 } })
|
|
@@ -4736,7 +4739,7 @@ const Dn = {
|
|
|
4736
4739
|
"button",
|
|
4737
4740
|
{
|
|
4738
4741
|
type: "button",
|
|
4739
|
-
onClick: () =>
|
|
4742
|
+
onClick: () => N.current?.next?.(),
|
|
4740
4743
|
className: "w-6 h-6 flex items-center justify-center rounded-full bg-gray-200 hover:bg-gray-300 text-gray-600",
|
|
4741
4744
|
"aria-label": "Next media",
|
|
4742
4745
|
children: /* @__PURE__ */ i(js, { style: { fontSize: 12 } })
|
|
@@ -4744,8 +4747,8 @@ const Dn = {
|
|
|
4744
4747
|
)
|
|
4745
4748
|
] }) : null
|
|
4746
4749
|
] }),
|
|
4747
|
-
|
|
4748
|
-
En(
|
|
4750
|
+
ut(O).length ? /* @__PURE__ */ i("div", { className: "w-full", children: /* @__PURE__ */ i(Fs, { ref: N, dots: !0, className: "w-full", children: ut(O).map((P, q) => /* @__PURE__ */ u("div", { className: "flex justify-center items-center", children: [
|
|
4751
|
+
En(P) ? /* @__PURE__ */ u(
|
|
4749
4752
|
"video",
|
|
4750
4753
|
{
|
|
4751
4754
|
width: "240",
|
|
@@ -4753,20 +4756,20 @@ const Dn = {
|
|
|
4753
4756
|
controls: !0,
|
|
4754
4757
|
className: "max-w-full max-h-[90vh] object-contain rounded-lg shadow-lg",
|
|
4755
4758
|
children: [
|
|
4756
|
-
/* @__PURE__ */ i("source", { src:
|
|
4759
|
+
/* @__PURE__ */ i("source", { src: P.mediaUrl || P }),
|
|
4757
4760
|
"Your browser does not support the video tag."
|
|
4758
4761
|
]
|
|
4759
4762
|
}
|
|
4760
4763
|
) : /* @__PURE__ */ i(
|
|
4761
4764
|
"img",
|
|
4762
4765
|
{
|
|
4763
|
-
src:
|
|
4764
|
-
alt:
|
|
4766
|
+
src: P.mediaUrl || P,
|
|
4767
|
+
alt: P.caption || `media-${q}`,
|
|
4765
4768
|
className: "max-w-full max-h-[90vh] object-contain rounded-lg shadow-lg"
|
|
4766
4769
|
}
|
|
4767
4770
|
),
|
|
4768
|
-
|
|
4769
|
-
] },
|
|
4771
|
+
P.caption && /* @__PURE__ */ i("p", { className: "text-xs text-gray-500 mt-1", children: P.caption })
|
|
4772
|
+
] }, q)) }) }) : null
|
|
4770
4773
|
] }) })
|
|
4771
4774
|
] })
|
|
4772
4775
|
},
|
|
@@ -4776,13 +4779,13 @@ const Dn = {
|
|
|
4776
4779
|
children: /* @__PURE__ */ i(
|
|
4777
4780
|
On,
|
|
4778
4781
|
{
|
|
4779
|
-
alertId:
|
|
4780
|
-
id:
|
|
4781
|
-
priority:
|
|
4782
|
-
spaceName:
|
|
4783
|
-
alertNumber:
|
|
4784
|
-
statusHistory:
|
|
4785
|
-
notifGroups:
|
|
4782
|
+
alertId: T,
|
|
4783
|
+
id: p,
|
|
4784
|
+
priority: m,
|
|
4785
|
+
spaceName: R,
|
|
4786
|
+
alertNumber: L,
|
|
4787
|
+
statusHistory: S,
|
|
4788
|
+
notifGroups: $
|
|
4786
4789
|
}
|
|
4787
4790
|
)
|
|
4788
4791
|
}
|
|
@@ -4793,7 +4796,7 @@ const Dn = {
|
|
|
4793
4796
|
);
|
|
4794
4797
|
};
|
|
4795
4798
|
function Un() {
|
|
4796
|
-
const { alerts: e } =
|
|
4799
|
+
const { alerts: e } = xe(), t = kt({
|
|
4797
4800
|
queryKey: ["alerts", "statusList"],
|
|
4798
4801
|
queryFn: () => e.getAlertStatusList(),
|
|
4799
4802
|
staleTime: 5 * 6e4
|
|
@@ -4805,15 +4808,15 @@ function Un() {
|
|
|
4805
4808
|
refetch: t.refetch
|
|
4806
4809
|
};
|
|
4807
4810
|
}
|
|
4808
|
-
function
|
|
4809
|
-
const [n, a] =
|
|
4810
|
-
function f(
|
|
4811
|
-
l(
|
|
4811
|
+
function bs({ alerts: e, loading: t = !1, columns: s, onRefetch: r }) {
|
|
4812
|
+
const [n, a] = x(!1), [o, l] = x(null), [h, d] = x("details"), { list: c, loading: A } = Un();
|
|
4813
|
+
function f($, M) {
|
|
4814
|
+
l($), d(M?.tab ?? "details"), y(M?.sourceTab ?? "active"), a(!0);
|
|
4812
4815
|
}
|
|
4813
|
-
function
|
|
4816
|
+
function k() {
|
|
4814
4817
|
a(!1);
|
|
4815
4818
|
}
|
|
4816
|
-
const
|
|
4819
|
+
const [N, y] = x("active"), b = o ? {
|
|
4817
4820
|
originalData: {
|
|
4818
4821
|
// include the full selected alert so alll modal fieldsare present
|
|
4819
4822
|
...o,
|
|
@@ -4828,19 +4831,19 @@ function vs({ alerts: e, loading: t = !1, columns: s, onRefetch: r }) {
|
|
|
4828
4831
|
/* @__PURE__ */ i(fn, { label: "USA", timeZone: "America/New_York" })
|
|
4829
4832
|
] }),
|
|
4830
4833
|
/* @__PURE__ */ i(
|
|
4831
|
-
|
|
4834
|
+
At,
|
|
4832
4835
|
{
|
|
4833
4836
|
defaultActiveKey: "active",
|
|
4834
4837
|
className: "w-full",
|
|
4835
4838
|
tabBarStyle: { fontSize: "medium" },
|
|
4836
|
-
onChange: (
|
|
4837
|
-
|
|
4839
|
+
onChange: ($) => {
|
|
4840
|
+
$ === "active" && r?.();
|
|
4838
4841
|
},
|
|
4839
4842
|
items: [
|
|
4840
4843
|
{
|
|
4841
4844
|
key: "active",
|
|
4842
4845
|
label: "Active",
|
|
4843
|
-
children: /* @__PURE__ */ i(
|
|
4846
|
+
children: /* @__PURE__ */ i(ls, { data: e, loading: t, pageSize: 10, columns: s || [], onAlertIdClick: f, onRefetch: r })
|
|
4844
4847
|
},
|
|
4845
4848
|
{
|
|
4846
4849
|
key: "archived",
|
|
@@ -4864,52 +4867,53 @@ function vs({ alerts: e, loading: t = !1, columns: s, onRefetch: r }) {
|
|
|
4864
4867
|
Mn,
|
|
4865
4868
|
{
|
|
4866
4869
|
isModalOpen: n,
|
|
4867
|
-
handleModalClose:
|
|
4868
|
-
selectedRow:
|
|
4870
|
+
handleModalClose: k,
|
|
4871
|
+
selectedRow: b,
|
|
4869
4872
|
fetchAlertLogs: () => {
|
|
4870
4873
|
},
|
|
4871
4874
|
alertStatusList: c,
|
|
4872
|
-
alertStatusLoading:
|
|
4873
|
-
initialTab: h
|
|
4875
|
+
alertStatusLoading: A,
|
|
4876
|
+
initialTab: h,
|
|
4877
|
+
sourceTab: N
|
|
4874
4878
|
}
|
|
4875
4879
|
)
|
|
4876
4880
|
] });
|
|
4877
4881
|
}
|
|
4878
4882
|
function Ln() {
|
|
4879
|
-
const [e, t] =
|
|
4880
|
-
return
|
|
4883
|
+
const [e, t] = x([]), [s, r] = x([]), [n, a] = x([]), { rules: o } = xe();
|
|
4884
|
+
return fe(() => {
|
|
4881
4885
|
let l = !0;
|
|
4882
4886
|
return (async () => {
|
|
4883
4887
|
try {
|
|
4884
4888
|
const h = await o.getRules();
|
|
4885
4889
|
if (!l) return;
|
|
4886
4890
|
a(Array.isArray(h) ? h : []);
|
|
4887
|
-
const d = (h || []).map((c,
|
|
4888
|
-
RuleId: c.ruleId || c.ruleName || String(
|
|
4891
|
+
const d = (h || []).map((c, A) => ({
|
|
4892
|
+
RuleId: c.ruleId || c.ruleName || String(A),
|
|
4889
4893
|
Name: c.ruleName || c.Name || "-",
|
|
4890
4894
|
Description: c.ruleDesc || c.Description || "",
|
|
4891
4895
|
SeverityId: 0
|
|
4892
4896
|
}));
|
|
4893
|
-
t(d.length ? d :
|
|
4897
|
+
t(d.length ? d : je.rules);
|
|
4894
4898
|
try {
|
|
4895
|
-
const c = await o.getLookups(),
|
|
4899
|
+
const c = await o.getLookups(), A = Array.isArray(c?.userRoles) ? c.userRoles.map((f) => ({
|
|
4896
4900
|
userRoleId: f.userRoleId ?? f.id,
|
|
4897
4901
|
userRoleName: f.userRoleName ?? f.name
|
|
4898
4902
|
})) : [];
|
|
4899
|
-
r(
|
|
4903
|
+
r(A.length ? A : je.userRoles);
|
|
4900
4904
|
} catch {
|
|
4901
|
-
r(
|
|
4905
|
+
r(je.userRoles);
|
|
4902
4906
|
}
|
|
4903
4907
|
} catch {
|
|
4904
|
-
t(
|
|
4908
|
+
t(je.rules), r(je.userRoles);
|
|
4905
4909
|
}
|
|
4906
4910
|
})(), () => {
|
|
4907
4911
|
l = !1;
|
|
4908
4912
|
};
|
|
4909
4913
|
}, []), /* @__PURE__ */ i(
|
|
4910
|
-
|
|
4914
|
+
Cn,
|
|
4911
4915
|
{
|
|
4912
|
-
severities:
|
|
4916
|
+
severities: je.severities,
|
|
4913
4917
|
rules: e,
|
|
4914
4918
|
userRoles: s,
|
|
4915
4919
|
rawRules: n
|
|
@@ -4917,7 +4921,7 @@ function Ln() {
|
|
|
4917
4921
|
);
|
|
4918
4922
|
}
|
|
4919
4923
|
function $n() {
|
|
4920
|
-
const { alerts: e } =
|
|
4924
|
+
const { alerts: e } = xe(), t = kt({
|
|
4921
4925
|
queryKey: ["alerts", "list"],
|
|
4922
4926
|
queryFn: () => e.listAlerts(),
|
|
4923
4927
|
staleTime: 3e4
|
|
@@ -4931,7 +4935,7 @@ function $n() {
|
|
|
4931
4935
|
}
|
|
4932
4936
|
function Bn(e) {
|
|
4933
4937
|
const { alerts: t, loading: s, refetch: r } = $n();
|
|
4934
|
-
return /* @__PURE__ */ i(
|
|
4938
|
+
return /* @__PURE__ */ i(bs, { alerts: t, loading: s, columns: e.columns, onRefetch: r });
|
|
4935
4939
|
}
|
|
4936
4940
|
function zn({
|
|
4937
4941
|
tenant: e,
|
|
@@ -4942,7 +4946,7 @@ function zn({
|
|
|
4942
4946
|
loading: a,
|
|
4943
4947
|
columns: o
|
|
4944
4948
|
}) {
|
|
4945
|
-
const [l] =
|
|
4949
|
+
const [l] = x(() => new Gr()), h = ue(
|
|
4946
4950
|
() => ({
|
|
4947
4951
|
alertsBaseUrl: t,
|
|
4948
4952
|
rulesBaseUrl: s || t,
|
|
@@ -4950,10 +4954,10 @@ function zn({
|
|
|
4950
4954
|
}),
|
|
4951
4955
|
[t, s, r]
|
|
4952
4956
|
);
|
|
4953
|
-
return /* @__PURE__ */ i(Wr, { client: l, children: /* @__PURE__ */ i(lr, { tenant: e, override: h, children: Array.isArray(n) ? /* @__PURE__ */ i(
|
|
4957
|
+
return /* @__PURE__ */ i(Wr, { client: l, children: /* @__PURE__ */ i(lr, { tenant: e, override: h, children: Array.isArray(n) ? /* @__PURE__ */ i(bs, { alerts: n, loading: !!a, columns: o }) : /* @__PURE__ */ i(Bn, { columns: o }) }) });
|
|
4954
4958
|
}
|
|
4955
4959
|
function Vn(e) {
|
|
4956
|
-
const { alerts: t } =
|
|
4960
|
+
const { alerts: t } = xe(), s = kt({
|
|
4957
4961
|
queryKey: ["alerts", "report", e],
|
|
4958
4962
|
queryFn: () => t.getAlertsReport(e),
|
|
4959
4963
|
staleTime: 6e4
|
|
@@ -4974,21 +4978,21 @@ const Jn = [
|
|
|
4974
4978
|
];
|
|
4975
4979
|
export {
|
|
4976
4980
|
Nn as AlertAssignment,
|
|
4977
|
-
|
|
4981
|
+
bs as AlertConsole,
|
|
4978
4982
|
zn as AlertConsoleWidget,
|
|
4979
|
-
|
|
4983
|
+
ls as AlertsTable,
|
|
4980
4984
|
lr as ApiProvider,
|
|
4981
4985
|
dn as ArchivedTable,
|
|
4982
4986
|
fn as Clock,
|
|
4983
4987
|
Ar as DataTable,
|
|
4984
4988
|
xn as MyPreferencesPanel,
|
|
4985
4989
|
wn as SettingsPanel,
|
|
4986
|
-
|
|
4990
|
+
Cn as SettingsTabs,
|
|
4987
4991
|
Jn as exampleAlertColumns,
|
|
4988
4992
|
Un as useAlertStatusList,
|
|
4989
4993
|
$n as useAlerts,
|
|
4990
4994
|
Vn as useAlertsReport,
|
|
4991
|
-
|
|
4992
|
-
|
|
4995
|
+
xe as useApi,
|
|
4996
|
+
vs as useUpdateAlertStatus
|
|
4993
4997
|
};
|
|
4994
4998
|
//# sourceMappingURL=index.es.js.map
|