@ssgc/alert-console 2.3.4 → 2.4.0
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 +752 -720
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { jsx as i, jsxs as d, Fragment as Ps } from "react/jsx-runtime";
|
|
2
2
|
import * as fe from "react";
|
|
3
|
-
import { useContext as Ms, useMemo as
|
|
4
|
-
import { Select as ve, Table as
|
|
3
|
+
import { useContext as Ms, useMemo as ue, createContext as Ds, useState as w, useEffect as de, forwardRef as ls, createElement as pt, useRef as Fs } from "react";
|
|
4
|
+
import { Select as ve, Table as xt, Row as Ae, Col as G, Input as Us, Tag as We, Space as Ie, Tooltip as Ls, Button as Se, Progress as $s, Dropdown as Bs, Typography as Ye, Spin as Ct, Checkbox as _e, Divider as Ge, TimePicker as $t, Tabs as Tt, Card as ht, Steps as js, Modal as qs, Carousel as _s } from "antd";
|
|
5
5
|
import { MessageOutlined as Qs, MailOutlined as Hs, MoreOutlined as Gs, PlusOutlined as Ws, EditOutlined as Ks, LeftOutlined as Ys, RightOutlined as zs } from "@ant-design/icons";
|
|
6
6
|
import { toast as ge } from "react-toastify";
|
|
7
|
-
const
|
|
8
|
-
critical:
|
|
9
|
-
high:
|
|
10
|
-
medium:
|
|
7
|
+
const Zs = "#FF3B30", Vs = "#FF9500", Js = "#FFCC00", Xs = "#34C759", Ze = {
|
|
8
|
+
critical: Zs,
|
|
9
|
+
high: Vs,
|
|
10
|
+
medium: Js,
|
|
11
11
|
low: Xs
|
|
12
12
|
}, Bt = {
|
|
13
|
-
Critical:
|
|
14
|
-
High:
|
|
15
|
-
Medium:
|
|
16
|
-
Low:
|
|
13
|
+
Critical: Ze.critical,
|
|
14
|
+
High: Ze.high,
|
|
15
|
+
Medium: Ze.medium,
|
|
16
|
+
Low: Ze.low
|
|
17
17
|
};
|
|
18
18
|
function er(e) {
|
|
19
19
|
return Bt[e] || Bt.Low;
|
|
@@ -25,7 +25,7 @@ function jt(e) {
|
|
|
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, u = Number.isFinite(o) ? o : 0, c = Number.isFinite(l) ? l : 0;
|
|
26
26
|
return h * 3600 + u * 60 + c;
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function ft(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,7 +33,7 @@ function ht(e) {
|
|
|
33
33
|
n.has(o) || (n.add(o), a.push(o));
|
|
34
34
|
}), a;
|
|
35
35
|
}
|
|
36
|
-
const cs = "", tr = cs, sr = "", rr = "",
|
|
36
|
+
const cs = "", tr = cs, sr = "", rr = "", qt = {
|
|
37
37
|
snl: {
|
|
38
38
|
alerts: cs,
|
|
39
39
|
rules: tr
|
|
@@ -43,7 +43,7 @@ const cs = "", tr = cs, sr = "", rr = "", _t = {
|
|
|
43
43
|
rules: rr
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
|
-
function
|
|
46
|
+
function Ne(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 nr() {
|
|
|
55
55
|
return {};
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function Ve(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 xe(e, t) {
|
|
66
66
|
const s = {
|
|
67
67
|
...t.headers,
|
|
68
68
|
...nr()
|
|
@@ -91,36 +91,36 @@ function ir(e) {
|
|
|
91
91
|
};
|
|
92
92
|
return {
|
|
93
93
|
async listAlerts() {
|
|
94
|
-
const s =
|
|
94
|
+
const s = Ne(e.baseUrl, "/api/Alert"), r = await xe(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 = Ne(e.baseUrl, "/api/Alert/AlertStatusList"), r = await xe(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 = Ne(e.baseUrl, "/Alerts/GetAlertsReport"), n = Ve(r, s), a = await xe(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 = Ne(e.baseUrl, "/api/Alert/status");
|
|
116
|
+
return xe(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 = Ne(e.baseUrl, "/api/Alert/GetAdminSettings"), r = await xe(s, {
|
|
124
124
|
method: "GET",
|
|
125
125
|
headers: t
|
|
126
126
|
});
|
|
@@ -131,20 +131,20 @@ function ir(e) {
|
|
|
131
131
|
return null;
|
|
132
132
|
},
|
|
133
133
|
async setAdminSettings(s) {
|
|
134
|
-
const r =
|
|
134
|
+
const r = Ne(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 xe(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 = Ne(e.baseUrl, "/api/Alert/GetPreferenceSettings"), r = await xe(s, {
|
|
148
148
|
method: "GET",
|
|
149
149
|
headers: t
|
|
150
150
|
});
|
|
@@ -155,7 +155,7 @@ function ir(e) {
|
|
|
155
155
|
return null;
|
|
156
156
|
},
|
|
157
157
|
async setPreferenceSettings(s) {
|
|
158
|
-
const r =
|
|
158
|
+
const r = Ne(e.baseUrl, "/api/Alert/SetPreferenceSettings"), n = await xe(r, {
|
|
159
159
|
method: "POST",
|
|
160
160
|
headers: t,
|
|
161
161
|
body: JSON.stringify(s ?? {})
|
|
@@ -168,29 +168,36 @@ function ir(e) {
|
|
|
168
168
|
};
|
|
169
169
|
},
|
|
170
170
|
async getAlertNotifications(s) {
|
|
171
|
-
const r =
|
|
171
|
+
const r = Ne(e.baseUrl, "/api/Alert/GetNotifications"), n = Ve(r, { alertId: s }), a = await xe(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 = Ne(e.baseUrl, "/api/Alert/NotificationToFamilyMembers"), n = Ve(r, { alertId: s });
|
|
179
|
+
return xe(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 = Ne(e.baseUrl, "/api/Alert/SendSMSorEmailNotifications"), o = Ve(a, { alertId: s, isEmail: r, isSMS: n });
|
|
186
|
+
return xe(o, {
|
|
187
187
|
method: "POST",
|
|
188
188
|
headers: t
|
|
189
189
|
});
|
|
190
|
+
},
|
|
191
|
+
async getTimeZoneMasters() {
|
|
192
|
+
const s = Ne(e.baseUrl, "/api/UserPreference/GetTimeZoneMasters"), r = await xe(s, {
|
|
193
|
+
method: "GET",
|
|
194
|
+
headers: t
|
|
195
|
+
});
|
|
196
|
+
return Array.isArray(r) ? r : r && typeof r == "object" && Array.isArray(r.data) ? r.data : [];
|
|
190
197
|
}
|
|
191
198
|
};
|
|
192
199
|
}
|
|
193
|
-
function
|
|
200
|
+
function _t(e, t) {
|
|
194
201
|
const s = (e || "").replace(/\/+$/, ""), r = t.startsWith("/") ? t : `/${t}`;
|
|
195
202
|
return `${s}${r}`;
|
|
196
203
|
}
|
|
@@ -202,7 +209,7 @@ function ar() {
|
|
|
202
209
|
return {};
|
|
203
210
|
}
|
|
204
211
|
}
|
|
205
|
-
async function
|
|
212
|
+
async function Je(e, t) {
|
|
206
213
|
const s = {
|
|
207
214
|
...t.headers,
|
|
208
215
|
...ar()
|
|
@@ -228,25 +235,25 @@ function or(e) {
|
|
|
228
235
|
const t = {
|
|
229
236
|
"Content-Type": "application/json",
|
|
230
237
|
...e.headers || {}
|
|
231
|
-
}, s =
|
|
238
|
+
}, s = _t(e.baseUrl, "/api/Rules"), r = _t(e.baseUrl, "/api/Rules/lookups");
|
|
232
239
|
return {
|
|
233
240
|
async getRules() {
|
|
234
|
-
const n = await
|
|
241
|
+
const n = await Je(s, { method: "GET", headers: t });
|
|
235
242
|
return Array.isArray(n) ? n : [];
|
|
236
243
|
},
|
|
237
244
|
async setEscalationSettings(n) {
|
|
238
|
-
return
|
|
245
|
+
return Je(s, {
|
|
239
246
|
method: "POST",
|
|
240
247
|
headers: t,
|
|
241
248
|
body: JSON.stringify(n ?? {})
|
|
242
249
|
});
|
|
243
250
|
},
|
|
244
251
|
async getLookups() {
|
|
245
|
-
return
|
|
252
|
+
return Je(r, { method: "GET", headers: t });
|
|
246
253
|
},
|
|
247
254
|
async updateRule(n, a) {
|
|
248
255
|
const o = `${s}/${n}`;
|
|
249
|
-
return
|
|
256
|
+
return Je(o, {
|
|
250
257
|
method: "PUT",
|
|
251
258
|
headers: t,
|
|
252
259
|
body: JSON.stringify(a ?? {})
|
|
@@ -263,15 +270,15 @@ function ur() {
|
|
|
263
270
|
(function(s, r) {
|
|
264
271
|
e.exports = r();
|
|
265
272
|
})(cr, (function() {
|
|
266
|
-
var s = 1e3, r = 6e4, n = 36e5, a = "millisecond", o = "second", l = "minute", h = "hour", u = "day", c = "week", S = "month", f = "quarter", R = "year", N = "date", m = "Invalid Date", A = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,
|
|
273
|
+
var s = 1e3, r = 6e4, n = 36e5, a = "millisecond", o = "second", l = "minute", h = "hour", u = "day", c = "week", S = "month", f = "quarter", R = "year", N = "date", m = "Invalid Date", A = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, j = /\[([^\]]+)]|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, L = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(E) {
|
|
267
274
|
var v = ["th", "st", "nd", "rd"], p = E % 100;
|
|
268
275
|
return "[" + E + (v[(p - 20) % 10] || v[p] || v[0]) + "]";
|
|
269
|
-
} },
|
|
276
|
+
} }, $ = function(E, v, p) {
|
|
270
277
|
var x = String(E);
|
|
271
278
|
return !x || x.length >= v ? E : "" + Array(v + 1 - x.length).join(p) + E;
|
|
272
|
-
},
|
|
279
|
+
}, O = { s: $, z: function(E) {
|
|
273
280
|
var v = -E.utcOffset(), p = Math.abs(v), x = Math.floor(p / 60), y = p % 60;
|
|
274
|
-
return (v <= 0 ? "+" : "-") +
|
|
281
|
+
return (v <= 0 ? "+" : "-") + $(x, 2, "0") + ":" + $(y, 2, "0");
|
|
275
282
|
}, m: function E(v, p) {
|
|
276
283
|
if (v.date() < p.date()) return -E(p, v);
|
|
277
284
|
var x = 12 * (p.year() - v.year()) + (p.month() - v.month()), y = v.clone().add(x, S), b = p - y < 0, g = v.clone().add(x + (b ? -1 : 1), S);
|
|
@@ -282,34 +289,34 @@ function ur() {
|
|
|
282
289
|
return { M: S, y: R, w: c, d: u, D: N, h, m: l, s: o, ms: a, Q: f }[E] || String(E || "").toLowerCase().replace(/s$/, "");
|
|
283
290
|
}, u: function(E) {
|
|
284
291
|
return E === void 0;
|
|
285
|
-
} },
|
|
286
|
-
|
|
287
|
-
var
|
|
288
|
-
return E instanceof
|
|
289
|
-
},
|
|
292
|
+
} }, Z = "en", W = {};
|
|
293
|
+
W[Z] = L;
|
|
294
|
+
var K = "$isDayjsObject", z = function(E) {
|
|
295
|
+
return E instanceof Y || !(!E || !E[K]);
|
|
296
|
+
}, I = function E(v, p, x) {
|
|
290
297
|
var y;
|
|
291
|
-
if (!v) return
|
|
298
|
+
if (!v) return Z;
|
|
292
299
|
if (typeof v == "string") {
|
|
293
300
|
var b = v.toLowerCase();
|
|
294
|
-
|
|
301
|
+
W[b] && (y = b), p && (W[b] = p, y = b);
|
|
295
302
|
var g = v.split("-");
|
|
296
303
|
if (!y && g.length > 1) return E(g[0]);
|
|
297
304
|
} else {
|
|
298
|
-
var
|
|
299
|
-
|
|
305
|
+
var P = v.name;
|
|
306
|
+
W[P] = v, y = P;
|
|
300
307
|
}
|
|
301
|
-
return !x && y && (
|
|
302
|
-
},
|
|
303
|
-
if (
|
|
308
|
+
return !x && y && (Z = y), y || !x && Z;
|
|
309
|
+
}, T = function(E, v) {
|
|
310
|
+
if (z(E)) return E.clone();
|
|
304
311
|
var p = typeof v == "object" ? v : {};
|
|
305
|
-
return p.date = E, p.args = arguments, new
|
|
306
|
-
}, k =
|
|
307
|
-
k.l =
|
|
308
|
-
return
|
|
312
|
+
return p.date = E, p.args = arguments, new Y(p);
|
|
313
|
+
}, k = O;
|
|
314
|
+
k.l = I, k.i = z, k.w = function(E, v) {
|
|
315
|
+
return T(E, { locale: v.$L, utc: v.$u, x: v.$x, $offset: v.$offset });
|
|
309
316
|
};
|
|
310
|
-
var
|
|
317
|
+
var Y = (function() {
|
|
311
318
|
function E(p) {
|
|
312
|
-
this.$L =
|
|
319
|
+
this.$L = I(p.locale, null, !0), this.parse(p), this.$x = this.$x || p.x || {}, this[K] = !0;
|
|
313
320
|
}
|
|
314
321
|
var v = E.prototype;
|
|
315
322
|
return v.parse = function(p) {
|
|
@@ -321,8 +328,8 @@ function ur() {
|
|
|
321
328
|
if (typeof y == "string" && !/Z$/i.test(y)) {
|
|
322
329
|
var g = y.match(A);
|
|
323
330
|
if (g) {
|
|
324
|
-
var
|
|
325
|
-
return b ? new Date(Date.UTC(g[1],
|
|
331
|
+
var P = g[2] - 1 || 0, B = (g[7] || "0").substring(0, 3);
|
|
332
|
+
return b ? new Date(Date.UTC(g[1], P, g[3] || 1, g[4] || 0, g[5] || 0, g[6] || 0, B)) : new Date(g[1], P, g[3] || 1, g[4] || 0, g[5] || 0, g[6] || 0, B);
|
|
326
333
|
}
|
|
327
334
|
}
|
|
328
335
|
return new Date(y);
|
|
@@ -335,12 +342,12 @@ function ur() {
|
|
|
335
342
|
}, v.isValid = function() {
|
|
336
343
|
return this.$d.toString() !== m;
|
|
337
344
|
}, v.isSame = function(p, x) {
|
|
338
|
-
var y =
|
|
345
|
+
var y = T(p);
|
|
339
346
|
return this.startOf(x) <= y && y <= this.endOf(x);
|
|
340
347
|
}, v.isAfter = function(p, x) {
|
|
341
|
-
return
|
|
348
|
+
return T(p) < this.startOf(x);
|
|
342
349
|
}, v.isBefore = function(p, x) {
|
|
343
|
-
return this.endOf(x) <
|
|
350
|
+
return this.endOf(x) < T(p);
|
|
344
351
|
}, v.$g = function(p, x, y) {
|
|
345
352
|
return k.u(p) ? this[x] : this.set(y, p);
|
|
346
353
|
}, v.unix = function() {
|
|
@@ -348,40 +355,40 @@ function ur() {
|
|
|
348
355
|
}, v.valueOf = function() {
|
|
349
356
|
return this.$d.getTime();
|
|
350
357
|
}, v.startOf = function(p, x) {
|
|
351
|
-
var y = this, b = !!k.u(x) || x, g = k.p(p),
|
|
352
|
-
var
|
|
353
|
-
return b ?
|
|
354
|
-
},
|
|
358
|
+
var y = this, b = !!k.u(x) || x, g = k.p(p), P = function(me, re) {
|
|
359
|
+
var le = k.w(y.$u ? Date.UTC(y.$y, re, me) : new Date(y.$y, re, me), y);
|
|
360
|
+
return b ? le : le.endOf(u);
|
|
361
|
+
}, B = function(me, re) {
|
|
355
362
|
return k.w(y.toDate()[me].apply(y.toDate("s"), (b ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(re)), y);
|
|
356
|
-
},
|
|
363
|
+
}, M = this.$W, U = this.$M, q = this.$D, V = "set" + (this.$u ? "UTC" : "");
|
|
357
364
|
switch (g) {
|
|
358
365
|
case R:
|
|
359
|
-
return b ?
|
|
366
|
+
return b ? P(1, 0) : P(31, 11);
|
|
360
367
|
case S:
|
|
361
|
-
return b ?
|
|
368
|
+
return b ? P(1, U) : P(0, U + 1);
|
|
362
369
|
case c:
|
|
363
|
-
var ne = this.$locale().weekStart || 0,
|
|
364
|
-
return
|
|
370
|
+
var ne = this.$locale().weekStart || 0, oe = (M < ne ? M + 7 : M) - ne;
|
|
371
|
+
return P(b ? q - oe : q + (6 - oe), U);
|
|
365
372
|
case u:
|
|
366
373
|
case N:
|
|
367
|
-
return
|
|
374
|
+
return B(V + "Hours", 0);
|
|
368
375
|
case h:
|
|
369
|
-
return
|
|
376
|
+
return B(V + "Minutes", 1);
|
|
370
377
|
case l:
|
|
371
|
-
return
|
|
378
|
+
return B(V + "Seconds", 2);
|
|
372
379
|
case o:
|
|
373
|
-
return
|
|
380
|
+
return B(V + "Milliseconds", 3);
|
|
374
381
|
default:
|
|
375
382
|
return this.clone();
|
|
376
383
|
}
|
|
377
384
|
}, v.endOf = function(p) {
|
|
378
385
|
return this.startOf(p, !1);
|
|
379
386
|
}, v.$set = function(p, x) {
|
|
380
|
-
var y, b = k.p(p), g = "set" + (this.$u ? "UTC" : ""),
|
|
387
|
+
var y, b = k.p(p), g = "set" + (this.$u ? "UTC" : ""), P = (y = {}, y[u] = g + "Date", y[N] = g + "Date", y[S] = g + "Month", y[R] = g + "FullYear", y[h] = g + "Hours", y[l] = g + "Minutes", y[o] = g + "Seconds", y[a] = g + "Milliseconds", y)[b], B = b === u ? this.$D + (x - this.$W) : x;
|
|
381
388
|
if (b === S || b === R) {
|
|
382
|
-
var
|
|
383
|
-
|
|
384
|
-
} else
|
|
389
|
+
var M = this.clone().set(N, 1);
|
|
390
|
+
M.$d[P](B), M.init(), this.$d = M.set(N, Math.min(this.$D, M.daysInMonth())).$d;
|
|
391
|
+
} else P && this.$d[P](B);
|
|
385
392
|
return this.init(), this;
|
|
386
393
|
}, v.set = function(p, x) {
|
|
387
394
|
return this.clone().$set(p, x);
|
|
@@ -390,44 +397,44 @@ function ur() {
|
|
|
390
397
|
}, v.add = function(p, x) {
|
|
391
398
|
var y, b = this;
|
|
392
399
|
p = Number(p);
|
|
393
|
-
var g = k.p(x),
|
|
394
|
-
var
|
|
395
|
-
return k.w(
|
|
400
|
+
var g = k.p(x), P = function(U) {
|
|
401
|
+
var q = T(b);
|
|
402
|
+
return k.w(q.date(q.date() + Math.round(U * p)), b);
|
|
396
403
|
};
|
|
397
404
|
if (g === S) return this.set(S, this.$M + p);
|
|
398
405
|
if (g === R) return this.set(R, this.$y + p);
|
|
399
|
-
if (g === u) return
|
|
400
|
-
if (g === c) return
|
|
401
|
-
var
|
|
402
|
-
return k.w(
|
|
406
|
+
if (g === u) return P(1);
|
|
407
|
+
if (g === c) return P(7);
|
|
408
|
+
var B = (y = {}, y[l] = r, y[h] = n, y[o] = s, y)[g] || 1, M = this.$d.getTime() + p * B;
|
|
409
|
+
return k.w(M, this);
|
|
403
410
|
}, v.subtract = function(p, x) {
|
|
404
411
|
return this.add(-1 * p, x);
|
|
405
412
|
}, v.format = function(p) {
|
|
406
413
|
var x = this, y = this.$locale();
|
|
407
414
|
if (!this.isValid()) return y.invalidDate || m;
|
|
408
|
-
var b = p || "YYYY-MM-DDTHH:mm:ssZ", g = k.z(this),
|
|
409
|
-
return re && (re[
|
|
410
|
-
},
|
|
411
|
-
return k.s(
|
|
412
|
-
}, me =
|
|
415
|
+
var b = p || "YYYY-MM-DDTHH:mm:ssZ", g = k.z(this), P = this.$H, B = this.$m, M = this.$M, U = y.weekdays, q = y.months, V = y.meridiem, ne = function(re, le, Re, we) {
|
|
416
|
+
return re && (re[le] || re(x, b)) || Re[le].slice(0, we);
|
|
417
|
+
}, oe = function(re) {
|
|
418
|
+
return k.s(P % 12 || 12, re, "0");
|
|
419
|
+
}, me = V || function(re, le, Re) {
|
|
413
420
|
var we = re < 12 ? "AM" : "PM";
|
|
414
421
|
return Re ? we.toLowerCase() : we;
|
|
415
422
|
};
|
|
416
|
-
return b.replace(
|
|
417
|
-
return
|
|
423
|
+
return b.replace(j, (function(re, le) {
|
|
424
|
+
return le || (function(Re) {
|
|
418
425
|
switch (Re) {
|
|
419
426
|
case "YY":
|
|
420
427
|
return String(x.$y).slice(-2);
|
|
421
428
|
case "YYYY":
|
|
422
429
|
return k.s(x.$y, 4, "0");
|
|
423
430
|
case "M":
|
|
424
|
-
return
|
|
431
|
+
return M + 1;
|
|
425
432
|
case "MM":
|
|
426
|
-
return k.s(
|
|
433
|
+
return k.s(M + 1, 2, "0");
|
|
427
434
|
case "MMM":
|
|
428
|
-
return ne(y.monthsShort,
|
|
435
|
+
return ne(y.monthsShort, M, q, 3);
|
|
429
436
|
case "MMMM":
|
|
430
|
-
return ne(
|
|
437
|
+
return ne(q, M);
|
|
431
438
|
case "D":
|
|
432
439
|
return x.$D;
|
|
433
440
|
case "DD":
|
|
@@ -435,27 +442,27 @@ function ur() {
|
|
|
435
442
|
case "d":
|
|
436
443
|
return String(x.$W);
|
|
437
444
|
case "dd":
|
|
438
|
-
return ne(y.weekdaysMin, x.$W,
|
|
445
|
+
return ne(y.weekdaysMin, x.$W, U, 2);
|
|
439
446
|
case "ddd":
|
|
440
|
-
return ne(y.weekdaysShort, x.$W,
|
|
447
|
+
return ne(y.weekdaysShort, x.$W, U, 3);
|
|
441
448
|
case "dddd":
|
|
442
|
-
return
|
|
449
|
+
return U[x.$W];
|
|
443
450
|
case "H":
|
|
444
|
-
return String(
|
|
451
|
+
return String(P);
|
|
445
452
|
case "HH":
|
|
446
|
-
return k.s(
|
|
453
|
+
return k.s(P, 2, "0");
|
|
447
454
|
case "h":
|
|
448
|
-
return
|
|
455
|
+
return oe(1);
|
|
449
456
|
case "hh":
|
|
450
|
-
return
|
|
457
|
+
return oe(2);
|
|
451
458
|
case "a":
|
|
452
|
-
return me(
|
|
459
|
+
return me(P, B, !0);
|
|
453
460
|
case "A":
|
|
454
|
-
return me(
|
|
461
|
+
return me(P, B, !1);
|
|
455
462
|
case "m":
|
|
456
|
-
return String(
|
|
463
|
+
return String(B);
|
|
457
464
|
case "mm":
|
|
458
|
-
return k.s(
|
|
465
|
+
return k.s(B, 2, "0");
|
|
459
466
|
case "s":
|
|
460
467
|
return String(x.$s);
|
|
461
468
|
case "ss":
|
|
@@ -471,45 +478,45 @@ function ur() {
|
|
|
471
478
|
}, v.utcOffset = function() {
|
|
472
479
|
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
|
|
473
480
|
}, v.diff = function(p, x, y) {
|
|
474
|
-
var b, g = this,
|
|
475
|
-
return k.m(g,
|
|
481
|
+
var b, g = this, P = k.p(x), B = T(p), M = (B.utcOffset() - this.utcOffset()) * r, U = this - B, q = function() {
|
|
482
|
+
return k.m(g, B);
|
|
476
483
|
};
|
|
477
|
-
switch (
|
|
484
|
+
switch (P) {
|
|
478
485
|
case R:
|
|
479
|
-
b =
|
|
486
|
+
b = q() / 12;
|
|
480
487
|
break;
|
|
481
488
|
case S:
|
|
482
|
-
b =
|
|
489
|
+
b = q();
|
|
483
490
|
break;
|
|
484
491
|
case f:
|
|
485
|
-
b =
|
|
492
|
+
b = q() / 3;
|
|
486
493
|
break;
|
|
487
494
|
case c:
|
|
488
|
-
b = (
|
|
495
|
+
b = (U - M) / 6048e5;
|
|
489
496
|
break;
|
|
490
497
|
case u:
|
|
491
|
-
b = (
|
|
498
|
+
b = (U - M) / 864e5;
|
|
492
499
|
break;
|
|
493
500
|
case h:
|
|
494
|
-
b =
|
|
501
|
+
b = U / n;
|
|
495
502
|
break;
|
|
496
503
|
case l:
|
|
497
|
-
b =
|
|
504
|
+
b = U / r;
|
|
498
505
|
break;
|
|
499
506
|
case o:
|
|
500
|
-
b =
|
|
507
|
+
b = U / s;
|
|
501
508
|
break;
|
|
502
509
|
default:
|
|
503
|
-
b =
|
|
510
|
+
b = U;
|
|
504
511
|
}
|
|
505
512
|
return y ? b : k.a(b);
|
|
506
513
|
}, v.daysInMonth = function() {
|
|
507
514
|
return this.endOf(S).$D;
|
|
508
515
|
}, v.$locale = function() {
|
|
509
|
-
return
|
|
516
|
+
return W[this.$L];
|
|
510
517
|
}, v.locale = function(p, x) {
|
|
511
518
|
if (!p) return this.$L;
|
|
512
|
-
var y = this.clone(), b =
|
|
519
|
+
var y = this.clone(), b = I(p, x, !0);
|
|
513
520
|
return b && (y.$L = b), y;
|
|
514
521
|
}, v.clone = function() {
|
|
515
522
|
return k.w(this.$d, this);
|
|
@@ -522,16 +529,16 @@ function ur() {
|
|
|
522
529
|
}, v.toString = function() {
|
|
523
530
|
return this.$d.toUTCString();
|
|
524
531
|
}, E;
|
|
525
|
-
})(), te =
|
|
526
|
-
return
|
|
532
|
+
})(), te = Y.prototype;
|
|
533
|
+
return T.prototype = te, [["$ms", a], ["$s", o], ["$m", l], ["$H", h], ["$W", u], ["$M", S], ["$y", R], ["$D", N]].forEach((function(E) {
|
|
527
534
|
te[E[1]] = function(v) {
|
|
528
535
|
return this.$g(v, E[0], E[1]);
|
|
529
536
|
};
|
|
530
|
-
})),
|
|
531
|
-
return E.$i || (E(v,
|
|
532
|
-
},
|
|
533
|
-
return
|
|
534
|
-
},
|
|
537
|
+
})), T.extend = function(E, v) {
|
|
538
|
+
return E.$i || (E(v, Y, T), E.$i = !0), T;
|
|
539
|
+
}, T.locale = I, T.isDayjs = z, T.unix = function(E) {
|
|
540
|
+
return T(1e3 * E);
|
|
541
|
+
}, T.en = W[Z], T.Ls = W, T.p = {}, T;
|
|
535
542
|
}));
|
|
536
543
|
})(tt)), tt.exports;
|
|
537
544
|
}
|
|
@@ -592,28 +599,31 @@ async function Pe(e, t) {
|
|
|
592
599
|
}
|
|
593
600
|
return a;
|
|
594
601
|
}
|
|
595
|
-
const
|
|
602
|
+
const ae = (...e) => e.find((t) => t != null);
|
|
596
603
|
function fr(e) {
|
|
597
604
|
return {
|
|
598
605
|
// 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:
|
|
606
|
+
id: String(ae(e?.AlertId, e?.alertId) ?? ""),
|
|
607
|
+
priority: ae(e?.Priority, e?.priority, "Low"),
|
|
608
|
+
timestamp: ae(e?.Timestamp, e?.timestamp, ""),
|
|
609
|
+
statusType: ae(e?.Status, e?.statusType, ""),
|
|
610
|
+
description: ae(e?.Description, e?.description, ""),
|
|
611
|
+
eventName: ae(e?.EventName, e?.eventName),
|
|
612
|
+
ruleName: ae(e?.RuleName, e?.ruleName),
|
|
613
|
+
spaceName: ae(e?.SpaceName, e?.spaceName),
|
|
614
|
+
assignTeam: ae(e?.AssignTeam, e?.assignTeam),
|
|
615
|
+
cameraName: ae(e?.CameraName, e?.cameraName),
|
|
616
|
+
type: ae(e?.Type, e?.type),
|
|
617
|
+
mediaDetails: ae(e?.MediaDetails, e?.mediaDetails),
|
|
618
|
+
additionalMedia: ae(e?.AdditionalMedia, e?.additionalMedia),
|
|
619
|
+
timeElapsed: ae(e?.TimeElapsed, e?.timeElapsed),
|
|
620
|
+
timeRemaining: ae(e?.TimeRemaining, e?.timeRemaining),
|
|
621
|
+
anomalyName: ae(e?.AnomalyName, e?.anomalyName),
|
|
622
|
+
alertDetails: ae(e?.AlertDetails, e?.alertDetails),
|
|
623
|
+
statusHistory: ae(e?.StatusHistory, e?.statusHistory),
|
|
624
|
+
isEmailSent: ae(e?.IsEmailSent, e?.isEmailSent),
|
|
625
|
+
isSMSSent: ae(e?.IsSMSSent, e?.isSMSSent),
|
|
626
|
+
timeZoneUniqueId: ae(e?.TimeZoneUniqueId, e?.timeZoneUniqueId)
|
|
617
627
|
};
|
|
618
628
|
}
|
|
619
629
|
function mr(e) {
|
|
@@ -773,7 +783,7 @@ function yr(e) {
|
|
|
773
783
|
});
|
|
774
784
|
},
|
|
775
785
|
async getLookups() {
|
|
776
|
-
const r = (
|
|
786
|
+
const r = (O) => new URL(O, e.baseUrl).toString(), n = [
|
|
777
787
|
De(r("/api/detectionpolicy/lookups/actiontypes"), { method: "GET", headers: t }),
|
|
778
788
|
De(r("/api/detectionpolicy/lookups/anomalies"), { method: "GET", headers: t }),
|
|
779
789
|
De(r("/api/detectionpolicy/lookups/thirdparty"), { method: "GET", headers: t }),
|
|
@@ -785,21 +795,21 @@ function yr(e) {
|
|
|
785
795
|
l,
|
|
786
796
|
h,
|
|
787
797
|
u
|
|
788
|
-
] = await Promise.allSettled(n), c = (
|
|
789
|
-
actionTypeId: Number(
|
|
790
|
-
name:
|
|
791
|
-
})),
|
|
792
|
-
recordId:
|
|
793
|
-
anomalyName:
|
|
794
|
-
})),
|
|
795
|
-
thirdPartyId: Number(
|
|
796
|
-
thirdPartyName:
|
|
797
|
-
})),
|
|
798
|
+
] = await Promise.allSettled(n), c = (O) => O.status === "fulfilled" && Array.isArray(O.value) ? O.value : [], S = c(a), f = c(o), R = c(l), N = c(h), m = c(u), A = S.map((O) => ({
|
|
799
|
+
actionTypeId: Number(O?.ActionTypeId),
|
|
800
|
+
name: O?.DisplayName ?? O?.Name ?? ""
|
|
801
|
+
})), j = f.map((O) => ({
|
|
802
|
+
recordId: O?.AnomalyId,
|
|
803
|
+
anomalyName: O?.DisplayName ?? O?.Name ?? ""
|
|
804
|
+
})), L = R.map((O) => ({
|
|
805
|
+
thirdPartyId: Number(O?.ThirdPartyId),
|
|
806
|
+
thirdPartyName: O?.ThirdPartyName ?? O?.Name ?? ""
|
|
807
|
+
})), $ = {
|
|
798
808
|
actionTypes: A,
|
|
799
|
-
anomalies:
|
|
800
|
-
thirdParties:
|
|
809
|
+
anomalies: j,
|
|
810
|
+
thirdParties: L
|
|
801
811
|
};
|
|
802
|
-
return N.length && (
|
|
812
|
+
return N.length && ($.severities = N), m.length && ($.scheduleTypes = m), $;
|
|
803
813
|
},
|
|
804
814
|
async updateRule(r, n) {
|
|
805
815
|
const a = `${s}/${r}`;
|
|
@@ -817,9 +827,9 @@ function gr({
|
|
|
817
827
|
override: t,
|
|
818
828
|
children: s
|
|
819
829
|
}) {
|
|
820
|
-
const r =
|
|
821
|
-
const a = t?.alertsBaseUrl?.trim() ||
|
|
822
|
-
let o = t?.rulesBaseUrl?.trim() ||
|
|
830
|
+
const r = ue(() => {
|
|
831
|
+
const a = t?.alertsBaseUrl?.trim() || qt[e]?.alerts || "";
|
|
832
|
+
let o = t?.rulesBaseUrl?.trim() || qt[e]?.rules || "";
|
|
823
833
|
e === "snl" && (o = a);
|
|
824
834
|
const l = t?.headers;
|
|
825
835
|
return { tenant: e, alertsBaseUrl: a, rulesBaseUrl: o, headers: l };
|
|
@@ -828,7 +838,7 @@ function gr({
|
|
|
828
838
|
t?.alertsBaseUrl,
|
|
829
839
|
t?.rulesBaseUrl,
|
|
830
840
|
JSON.stringify(t?.headers || {})
|
|
831
|
-
]), n =
|
|
841
|
+
]), n = ue(() => {
|
|
832
842
|
const a = r.tenant === "schools" ? mr({ baseUrl: r.alertsBaseUrl, headers: r.headers }) : ir({ baseUrl: r.alertsBaseUrl, headers: r.headers }), o = r.tenant === "schools" ? yr({ baseUrl: r.rulesBaseUrl, headers: r.headers }) : or({ baseUrl: r.alertsBaseUrl, headers: r.headers });
|
|
833
843
|
return { config: r, alerts: a, rules: o };
|
|
834
844
|
}, [r]);
|
|
@@ -849,9 +859,9 @@ const vr = {
|
|
|
849
859
|
High: "#FFB86A",
|
|
850
860
|
Medium: "#FFCC00",
|
|
851
861
|
Low: "#007AFF"
|
|
852
|
-
}, It = 6,
|
|
862
|
+
}, It = 6, Rt = 7;
|
|
853
863
|
function Ar(e, t, s) {
|
|
854
|
-
const r = e === It, n = e ===
|
|
864
|
+
const r = e === It, n = e === Rt, a = t.isEmailSent ?? !1, o = t.isSMSSent ?? !1, l = r && a || n && o, h = r ? "Send Email" : n ? "Send SMS" : s, u = r && a ? "Email sent" : n && o ? "SMS sent" : h, c = r && a ? "Email sent" : n && o ? "SMS sent" : `Click to ${h}`;
|
|
855
865
|
return { isDisabled: l, buttonText: u, tooltipTitle: c };
|
|
856
866
|
}
|
|
857
867
|
function Sr(e) {
|
|
@@ -876,7 +886,7 @@ function Wt(e, t) {
|
|
|
876
886
|
return `${e}-${t ? "email" : "sms"}`;
|
|
877
887
|
}
|
|
878
888
|
function Kt(e) {
|
|
879
|
-
return e === It || e ===
|
|
889
|
+
return e === It || e === Rt;
|
|
880
890
|
}
|
|
881
891
|
function it({ value: e, onChange: t, options: s, className: r, dropdownWidth: n }) {
|
|
882
892
|
return /* @__PURE__ */ i(
|
|
@@ -906,10 +916,10 @@ const Cr = [
|
|
|
906
916
|
{ label: "Unauthorized Access", value: "Unauthorized" },
|
|
907
917
|
{ label: "Aggressive Behavior", value: "Aggressive" }
|
|
908
918
|
];
|
|
909
|
-
function
|
|
919
|
+
function Tr({ value: e, onChange: t, options: s }) {
|
|
910
920
|
return /* @__PURE__ */ i(it, { className: "w-[220px]", dropdownWidth: 280, value: e, onChange: t, options: s || Cr });
|
|
911
921
|
}
|
|
912
|
-
function
|
|
922
|
+
function Ir({ value: e, onChange: t, options: s }) {
|
|
913
923
|
return /* @__PURE__ */ i(it, { className: "w-[100px]", value: e, onChange: t, options: s || [] });
|
|
914
924
|
}
|
|
915
925
|
const Rr = [
|
|
@@ -935,7 +945,7 @@ function Er({
|
|
|
935
945
|
return /* @__PURE__ */ d("div", { children: [
|
|
936
946
|
a,
|
|
937
947
|
/* @__PURE__ */ i(
|
|
938
|
-
|
|
948
|
+
xt,
|
|
939
949
|
{
|
|
940
950
|
rowKey: n,
|
|
941
951
|
dataSource: t,
|
|
@@ -953,33 +963,33 @@ function Er({
|
|
|
953
963
|
] });
|
|
954
964
|
}
|
|
955
965
|
function ms({ data: e, loading: t = !1, pageSize: s = 10, columns: r, severityOptions: n, spaceOptions: a, renderActions: o, onAlertIdClick: l, onRefetch: h, excludeCompleted: u = !0 }) {
|
|
956
|
-
const [c, S] = w("All"), [f, R] = w("All"), [N, m] = w("All"), [A,
|
|
966
|
+
const [c, S] = w("All"), [f, R] = w("All"), [N, m] = w("All"), [A, j] = w("All"), [L, $] = w(""), [O, Z] = w([{ label: "All", value: "All" }]), [W, K] = w(/* @__PURE__ */ new Set()), { rules: z, alerts: I } = Te(), T = {
|
|
957
967
|
6: { title: "Email", kind: "icon", icon: /* @__PURE__ */ i(Hs, {}) },
|
|
958
968
|
7: { title: "SMS", kind: "icon", icon: /* @__PURE__ */ i(Qs, {}) }
|
|
959
|
-
}, k =
|
|
960
|
-
|
|
969
|
+
}, k = ue(() => Sr(e), [e]), Y = ue(() => wr(e), [e]);
|
|
970
|
+
de(() => {
|
|
961
971
|
let b = !0;
|
|
962
972
|
return (async () => {
|
|
963
973
|
try {
|
|
964
|
-
const g = await
|
|
965
|
-
label:
|
|
966
|
-
value: String(
|
|
974
|
+
const g = await z.getLookups(), B = (Array.isArray(g.thirdParties) ? g.thirdParties : []).map((M) => ({
|
|
975
|
+
label: M.thirdPartyName,
|
|
976
|
+
value: String(M.thirdPartyId)
|
|
967
977
|
}));
|
|
968
|
-
b &&
|
|
978
|
+
b && Z([{ label: "All", value: "All" }, ...B]);
|
|
969
979
|
} catch (g) {
|
|
970
980
|
console.error("Error loading third party options", g);
|
|
971
981
|
}
|
|
972
982
|
})(), () => {
|
|
973
983
|
b = !1;
|
|
974
984
|
};
|
|
975
|
-
}, [
|
|
976
|
-
const te =
|
|
977
|
-
() => (e || []).some((b) =>
|
|
985
|
+
}, [z]);
|
|
986
|
+
const te = ue(
|
|
987
|
+
() => (e || []).some((b) => ft(b).length > 0),
|
|
978
988
|
[e]
|
|
979
|
-
), E =
|
|
980
|
-
const g = c === "All" || b.priority === c,
|
|
981
|
-
return g &&
|
|
982
|
-
}), [e, c,
|
|
989
|
+
), E = ue(() => (e || []).filter((b) => {
|
|
990
|
+
const g = c === "All" || b.priority === c, P = `${b.id} ${b.description} ${b.statusType}`.toLowerCase(), B = !L || P.includes(L.toLowerCase()), M = f === "All" || (b.anomalyName || "").toLowerCase() === f.toLowerCase(), U = N === "All" || (b.spaceName || "").toLowerCase() === N.toLowerCase(), q = !te || A === "All" || ft(b).includes(Number(A)), V = !u || !["completed", "false positive"].includes(String(b.statusType || "").toLowerCase());
|
|
991
|
+
return g && B && M && U && q && V;
|
|
992
|
+
}), [e, c, L, f, N, A, te, u]), v = k, p = a && a.length ? a : Y, x = [
|
|
983
993
|
{
|
|
984
994
|
title: "Severity",
|
|
985
995
|
dataIndex: "priority",
|
|
@@ -994,8 +1004,8 @@ function ms({ data: e, loading: t = !1, pageSize: s = 10, columns: r, severityOp
|
|
|
994
1004
|
render: (b, g) => /* @__PURE__ */ i(
|
|
995
1005
|
"a",
|
|
996
1006
|
{
|
|
997
|
-
onClick: (
|
|
998
|
-
|
|
1007
|
+
onClick: (P) => {
|
|
1008
|
+
P.preventDefault(), l?.(g, { tab: "track", sourceTab: "active" });
|
|
999
1009
|
},
|
|
1000
1010
|
className: "text-blue-600 hover:underline",
|
|
1001
1011
|
children: "Tracker"
|
|
@@ -1008,42 +1018,42 @@ function ms({ data: e, loading: t = !1, pageSize: s = 10, columns: r, severityOp
|
|
|
1008
1018
|
width: 320,
|
|
1009
1019
|
render: (b, g) => {
|
|
1010
1020
|
if (o) return /* @__PURE__ */ i(Ps, { children: o(g) });
|
|
1011
|
-
const
|
|
1012
|
-
if (!
|
|
1013
|
-
const
|
|
1014
|
-
const
|
|
1015
|
-
|
|
1021
|
+
const P = ft(g);
|
|
1022
|
+
if (!P.length) return null;
|
|
1023
|
+
const B = async (M, U) => {
|
|
1024
|
+
const q = Wt(g.id, M);
|
|
1025
|
+
K((V) => new Set(V).add(q));
|
|
1016
1026
|
try {
|
|
1017
|
-
const
|
|
1018
|
-
|
|
1019
|
-
} catch (
|
|
1020
|
-
ge.error(
|
|
1027
|
+
const V = await I.sendSMSorEmailNotifications?.(g.id, M, U);
|
|
1028
|
+
V?.responseStatus ? (ge.success(V.data || (M ? "Email sent successfully" : "SMS sent successfully")), h?.()) : ge.error(V?.data || V?.errorMessage || "Failed to send notification");
|
|
1029
|
+
} catch (V) {
|
|
1030
|
+
ge.error(V?.message || "Failed to send notification");
|
|
1021
1031
|
} finally {
|
|
1022
|
-
|
|
1023
|
-
const ne = new Set(
|
|
1024
|
-
return ne.delete(
|
|
1032
|
+
K((V) => {
|
|
1033
|
+
const ne = new Set(V);
|
|
1034
|
+
return ne.delete(q), ne;
|
|
1025
1035
|
});
|
|
1026
1036
|
}
|
|
1027
1037
|
};
|
|
1028
|
-
return /* @__PURE__ */ i(Ie, { size: "middle", children:
|
|
1029
|
-
const
|
|
1030
|
-
if (!
|
|
1031
|
-
const
|
|
1032
|
-
|
|
1038
|
+
return /* @__PURE__ */ i(Ie, { size: "middle", children: P.map((M) => {
|
|
1039
|
+
const U = T[M];
|
|
1040
|
+
if (!U) return null;
|
|
1041
|
+
const q = M === It, V = M === Rt, { isDisabled: ne, buttonText: oe, tooltipTitle: me } = Ar(M, g, U?.title), re = Wt(g.id, q), le = Kt(M) && W.has(re), Re = () => {
|
|
1042
|
+
B(q, V);
|
|
1033
1043
|
};
|
|
1034
1044
|
return /* @__PURE__ */ i(Ls, { title: me, children: /* @__PURE__ */ i(
|
|
1035
1045
|
Se,
|
|
1036
1046
|
{
|
|
1037
1047
|
size: "small",
|
|
1038
1048
|
disabled: ne,
|
|
1039
|
-
loading:
|
|
1040
|
-
onClick: Kt(
|
|
1041
|
-
icon: !
|
|
1049
|
+
loading: le,
|
|
1050
|
+
onClick: Kt(M) ? Re : void 0,
|
|
1051
|
+
icon: !le && (U.kind === "img" && U.src ? /* @__PURE__ */ i("img", { src: U.src, alt: U.alt || U.title }) : U.icon),
|
|
1042
1052
|
className: "flex flex-col items-center justify-center gap-1",
|
|
1043
1053
|
style: { height: "fit-content" },
|
|
1044
|
-
children:
|
|
1054
|
+
children: oe
|
|
1045
1055
|
}
|
|
1046
|
-
) },
|
|
1056
|
+
) }, M);
|
|
1047
1057
|
}) });
|
|
1048
1058
|
}
|
|
1049
1059
|
},
|
|
@@ -1053,16 +1063,16 @@ function ms({ data: e, loading: t = !1, pageSize: s = 10, columns: r, severityOp
|
|
|
1053
1063
|
key: "timestamp",
|
|
1054
1064
|
width: 220,
|
|
1055
1065
|
render: (b, g) => {
|
|
1056
|
-
const
|
|
1066
|
+
const P = g?.timeElapsed, B = g?.timeRemaining, M = P ? jt(P) : 0, U = B ? jt(B) : 0, q = Math.round(M / (M + U) * 100);
|
|
1057
1067
|
return /* @__PURE__ */ d("div", { children: [
|
|
1058
1068
|
/* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
|
|
1059
1069
|
/* @__PURE__ */ i("span", { className: "w-[70px]", children: "Elapsed:" }),
|
|
1060
|
-
/* @__PURE__ */ i("span", { className: "font-medium", children:
|
|
1070
|
+
/* @__PURE__ */ i("span", { className: "font-medium", children: P ?? "-" })
|
|
1061
1071
|
] }),
|
|
1062
|
-
/* @__PURE__ */ i($s, { percent:
|
|
1072
|
+
/* @__PURE__ */ i($s, { percent: q, showInfo: !1, size: "small", strokeColor: er(g.priority) }),
|
|
1063
1073
|
/* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
|
|
1064
1074
|
/* @__PURE__ */ i("span", { className: "w-[70px]", children: "Remaining" }),
|
|
1065
|
-
/* @__PURE__ */ i("span", { className: "font-medium", children:
|
|
1075
|
+
/* @__PURE__ */ i("span", { className: "font-medium", children: B ?? "-" })
|
|
1066
1076
|
] })
|
|
1067
1077
|
] });
|
|
1068
1078
|
}
|
|
@@ -1081,8 +1091,8 @@ function ms({ data: e, loading: t = !1, pageSize: s = 10, columns: r, severityOp
|
|
|
1081
1091
|
/* @__PURE__ */ i(
|
|
1082
1092
|
"a",
|
|
1083
1093
|
{
|
|
1084
|
-
onClick: (
|
|
1085
|
-
|
|
1094
|
+
onClick: (P) => {
|
|
1095
|
+
P.preventDefault(), l?.(g, { sourceTab: "active" });
|
|
1086
1096
|
},
|
|
1087
1097
|
className: "inline-block mb-1 text-blue-600",
|
|
1088
1098
|
children: g.alertNumber
|
|
@@ -1107,15 +1117,15 @@ function ms({ data: e, loading: t = !1, pageSize: s = 10, columns: r, severityOp
|
|
|
1107
1117
|
] }) }),
|
|
1108
1118
|
/* @__PURE__ */ i(G, { flex: "none", children: /* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
|
|
1109
1119
|
/* @__PURE__ */ i("span", { children: "Anomaly type" }),
|
|
1110
|
-
/* @__PURE__ */ i(
|
|
1120
|
+
/* @__PURE__ */ i(Tr, { value: f, onChange: R, options: v })
|
|
1111
1121
|
] }) }),
|
|
1112
1122
|
/* @__PURE__ */ i(G, { flex: "none", children: /* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
|
|
1113
1123
|
/* @__PURE__ */ i("span", { children: "Space" }),
|
|
1114
|
-
/* @__PURE__ */ i(
|
|
1124
|
+
/* @__PURE__ */ i(Ir, { value: N, onChange: m, options: p })
|
|
1115
1125
|
] }) }),
|
|
1116
1126
|
/* @__PURE__ */ i(G, { flex: "none", children: /* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
|
|
1117
1127
|
/* @__PURE__ */ i("span", { children: "Action Taken" }),
|
|
1118
|
-
/* @__PURE__ */ i(kr, { value: A, onChange:
|
|
1128
|
+
/* @__PURE__ */ i(kr, { value: A, onChange: j, options: O })
|
|
1119
1129
|
] }) }),
|
|
1120
1130
|
/* @__PURE__ */ i(G, { flex: "auto" }),
|
|
1121
1131
|
/* @__PURE__ */ i(G, { flex: "none", children: /* @__PURE__ */ i(
|
|
@@ -1123,8 +1133,8 @@ function ms({ data: e, loading: t = !1, pageSize: s = 10, columns: r, severityOp
|
|
|
1123
1133
|
{
|
|
1124
1134
|
allowClear: !0,
|
|
1125
1135
|
placeholder: "Search",
|
|
1126
|
-
onSearch:
|
|
1127
|
-
onChange: (b) =>
|
|
1136
|
+
onSearch: $,
|
|
1137
|
+
onChange: (b) => $(b.target.value),
|
|
1128
1138
|
className: "w-[260px] ",
|
|
1129
1139
|
enterButton: !0
|
|
1130
1140
|
}
|
|
@@ -1201,7 +1211,7 @@ function ye() {
|
|
|
1201
1211
|
function Dr(e, t) {
|
|
1202
1212
|
return typeof e == "function" ? e(t) : e;
|
|
1203
1213
|
}
|
|
1204
|
-
function
|
|
1214
|
+
function yt(e) {
|
|
1205
1215
|
return typeof e == "number" && e >= 0 && e !== 1 / 0;
|
|
1206
1216
|
}
|
|
1207
1217
|
function ps(e, t) {
|
|
@@ -1210,7 +1220,7 @@ function ps(e, t) {
|
|
|
1210
1220
|
function Fe(e, t) {
|
|
1211
1221
|
return typeof e == "function" ? e(t) : e;
|
|
1212
1222
|
}
|
|
1213
|
-
function
|
|
1223
|
+
function Ce(e, t) {
|
|
1214
1224
|
return typeof e == "function" ? e(t) : e;
|
|
1215
1225
|
}
|
|
1216
1226
|
function Yt(e, t) {
|
|
@@ -1224,7 +1234,7 @@ function Yt(e, t) {
|
|
|
1224
1234
|
} = e;
|
|
1225
1235
|
if (o) {
|
|
1226
1236
|
if (r) {
|
|
1227
|
-
if (t.queryHash !==
|
|
1237
|
+
if (t.queryHash !== kt(o, t.options))
|
|
1228
1238
|
return !1;
|
|
1229
1239
|
} else if (!Ke(t.queryKey, o))
|
|
1230
1240
|
return !1;
|
|
@@ -1249,25 +1259,25 @@ function zt(e, t) {
|
|
|
1249
1259
|
}
|
|
1250
1260
|
return !(r && t.state.status !== r || n && !n(t));
|
|
1251
1261
|
}
|
|
1252
|
-
function
|
|
1262
|
+
function kt(e, t) {
|
|
1253
1263
|
return (t?.queryKeyHashFn || Be)(e);
|
|
1254
1264
|
}
|
|
1255
1265
|
function Be(e) {
|
|
1256
1266
|
return JSON.stringify(
|
|
1257
1267
|
e,
|
|
1258
|
-
(t, s) =>
|
|
1268
|
+
(t, s) => vt(s) ? Object.keys(s).sort().reduce((r, n) => (r[n] = s[n], r), {}) : s
|
|
1259
1269
|
);
|
|
1260
1270
|
}
|
|
1261
1271
|
function Ke(e, t) {
|
|
1262
1272
|
return e === t ? !0 : typeof e != typeof t ? !1 : e && t && typeof e == "object" && typeof t == "object" ? Object.keys(t).every((s) => Ke(e[s], t[s])) : !1;
|
|
1263
1273
|
}
|
|
1264
1274
|
var Fr = Object.prototype.hasOwnProperty;
|
|
1265
|
-
function
|
|
1275
|
+
function gt(e, t, s = 0) {
|
|
1266
1276
|
if (e === t)
|
|
1267
1277
|
return e;
|
|
1268
1278
|
if (s > 500) return t;
|
|
1269
|
-
const r =
|
|
1270
|
-
if (!r && !(
|
|
1279
|
+
const r = Zt(e) && Zt(t);
|
|
1280
|
+
if (!r && !(vt(e) && vt(t))) return t;
|
|
1271
1281
|
const a = (r ? e : Object.keys(e)).length, o = r ? t : Object.keys(t), l = o.length, h = r ? new Array(l) : {};
|
|
1272
1282
|
let u = 0;
|
|
1273
1283
|
for (let c = 0; c < l; c++) {
|
|
@@ -1280,7 +1290,7 @@ function yt(e, t, s = 0) {
|
|
|
1280
1290
|
h[S] = R;
|
|
1281
1291
|
continue;
|
|
1282
1292
|
}
|
|
1283
|
-
const N =
|
|
1293
|
+
const N = gt(f, R, s + 1);
|
|
1284
1294
|
h[S] = N, N === f && u++;
|
|
1285
1295
|
}
|
|
1286
1296
|
return a === l && u === a ? e : h;
|
|
@@ -1293,19 +1303,19 @@ function st(e, t) {
|
|
|
1293
1303
|
return !1;
|
|
1294
1304
|
return !0;
|
|
1295
1305
|
}
|
|
1296
|
-
function
|
|
1306
|
+
function Zt(e) {
|
|
1297
1307
|
return Array.isArray(e) && e.length === Object.keys(e).length;
|
|
1298
1308
|
}
|
|
1299
|
-
function
|
|
1300
|
-
if (!
|
|
1309
|
+
function vt(e) {
|
|
1310
|
+
if (!Vt(e))
|
|
1301
1311
|
return !1;
|
|
1302
1312
|
const t = e.constructor;
|
|
1303
1313
|
if (t === void 0)
|
|
1304
1314
|
return !0;
|
|
1305
1315
|
const s = t.prototype;
|
|
1306
|
-
return !(!
|
|
1316
|
+
return !(!Vt(s) || !s.hasOwnProperty("isPrototypeOf") || Object.getPrototypeOf(e) !== Object.prototype);
|
|
1307
1317
|
}
|
|
1308
|
-
function
|
|
1318
|
+
function Vt(e) {
|
|
1309
1319
|
return Object.prototype.toString.call(e) === "[object Object]";
|
|
1310
1320
|
}
|
|
1311
1321
|
function Ur(e) {
|
|
@@ -1313,19 +1323,19 @@ function Ur(e) {
|
|
|
1313
1323
|
Le.setTimeout(t, e);
|
|
1314
1324
|
});
|
|
1315
1325
|
}
|
|
1316
|
-
function
|
|
1326
|
+
function bt(e, t, s) {
|
|
1317
1327
|
if (typeof s.structuralSharing == "function")
|
|
1318
1328
|
return s.structuralSharing(e, t);
|
|
1319
1329
|
if (s.structuralSharing !== !1) {
|
|
1320
1330
|
if (process.env.NODE_ENV !== "production")
|
|
1321
1331
|
try {
|
|
1322
|
-
return
|
|
1332
|
+
return gt(e, t);
|
|
1323
1333
|
} catch (r) {
|
|
1324
1334
|
throw console.error(
|
|
1325
1335
|
`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
1336
|
), r;
|
|
1327
1337
|
}
|
|
1328
|
-
return
|
|
1338
|
+
return gt(e, t);
|
|
1329
1339
|
}
|
|
1330
1340
|
return t;
|
|
1331
1341
|
}
|
|
@@ -1343,7 +1353,7 @@ function ys(e, t) {
|
|
|
1343
1353
|
`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`
|
|
1344
1354
|
), !e.queryFn && t?.initialPromise ? () => t.initialPromise : !e.queryFn || e.queryFn === rt ? () => Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)) : e.queryFn;
|
|
1345
1355
|
}
|
|
1346
|
-
function
|
|
1356
|
+
function Et(e, t) {
|
|
1347
1357
|
return typeof e == "function" ? e(...t) : !!e;
|
|
1348
1358
|
}
|
|
1349
1359
|
function Br(e, t, s) {
|
|
@@ -1390,8 +1400,8 @@ var jr = class extends Qe {
|
|
|
1390
1400
|
isFocused() {
|
|
1391
1401
|
return typeof this.#e == "boolean" ? this.#e : globalThis.document?.visibilityState !== "hidden";
|
|
1392
1402
|
}
|
|
1393
|
-
},
|
|
1394
|
-
function
|
|
1403
|
+
}, Ot = new jr();
|
|
1404
|
+
function At() {
|
|
1395
1405
|
let e, t;
|
|
1396
1406
|
const s = new Promise((n, a) => {
|
|
1397
1407
|
e = n, t = a;
|
|
@@ -1413,13 +1423,13 @@ function bt() {
|
|
|
1413
1423
|
}), t(n);
|
|
1414
1424
|
}, s;
|
|
1415
1425
|
}
|
|
1416
|
-
var
|
|
1417
|
-
function
|
|
1426
|
+
var qr = Mr;
|
|
1427
|
+
function _r() {
|
|
1418
1428
|
let e = [], t = 0, s = (l) => {
|
|
1419
1429
|
l();
|
|
1420
1430
|
}, r = (l) => {
|
|
1421
1431
|
l();
|
|
1422
|
-
}, n =
|
|
1432
|
+
}, n = qr;
|
|
1423
1433
|
const a = (l) => {
|
|
1424
1434
|
t ? e.push(l) : n(() => {
|
|
1425
1435
|
s(l);
|
|
@@ -1473,7 +1483,7 @@ function qr() {
|
|
|
1473
1483
|
}
|
|
1474
1484
|
};
|
|
1475
1485
|
}
|
|
1476
|
-
var
|
|
1486
|
+
var ce = _r(), Qr = class extends Qe {
|
|
1477
1487
|
#e = !0;
|
|
1478
1488
|
#t;
|
|
1479
1489
|
#s;
|
|
@@ -1511,23 +1521,23 @@ function Hr(e) {
|
|
|
1511
1521
|
function gs(e) {
|
|
1512
1522
|
return (e ?? "online") === "online" ? nt.isOnline() : !0;
|
|
1513
1523
|
}
|
|
1514
|
-
var
|
|
1524
|
+
var St = class extends Error {
|
|
1515
1525
|
constructor(e) {
|
|
1516
1526
|
super("CancelledError"), this.revert = e?.revert, this.silent = e?.silent;
|
|
1517
1527
|
}
|
|
1518
1528
|
};
|
|
1519
1529
|
function vs(e) {
|
|
1520
1530
|
let t = !1, s = 0, r;
|
|
1521
|
-
const n =
|
|
1531
|
+
const n = At(), a = () => n.status !== "pending", o = (m) => {
|
|
1522
1532
|
if (!a()) {
|
|
1523
|
-
const A = new
|
|
1533
|
+
const A = new St(m);
|
|
1524
1534
|
f(A), e.onCancel?.(A);
|
|
1525
1535
|
}
|
|
1526
1536
|
}, l = () => {
|
|
1527
1537
|
t = !0;
|
|
1528
1538
|
}, h = () => {
|
|
1529
1539
|
t = !1;
|
|
1530
|
-
}, u = () =>
|
|
1540
|
+
}, u = () => Ot.isFocused() && (e.networkMode === "always" || nt.isOnline()) && e.canRun(), c = () => gs(e.networkMode) && e.canRun(), S = (m) => {
|
|
1531
1541
|
a() || (r?.(), n.resolve(m));
|
|
1532
1542
|
}, f = (m) => {
|
|
1533
1543
|
a() || (r?.(), n.reject(m));
|
|
@@ -1544,19 +1554,19 @@ function vs(e) {
|
|
|
1544
1554
|
const A = s === 0 ? e.initialPromise : void 0;
|
|
1545
1555
|
try {
|
|
1546
1556
|
m = A ?? e.fn();
|
|
1547
|
-
} catch (
|
|
1548
|
-
m = Promise.reject(
|
|
1557
|
+
} catch (j) {
|
|
1558
|
+
m = Promise.reject(j);
|
|
1549
1559
|
}
|
|
1550
|
-
Promise.resolve(m).then(S).catch((
|
|
1560
|
+
Promise.resolve(m).then(S).catch((j) => {
|
|
1551
1561
|
if (a())
|
|
1552
1562
|
return;
|
|
1553
|
-
const
|
|
1554
|
-
if (t || !
|
|
1555
|
-
f(
|
|
1563
|
+
const L = e.retry ?? ($e ? 0 : 3), $ = e.retryDelay ?? Hr, O = typeof $ == "function" ? $(s, j) : $, Z = L === !0 || typeof L == "number" && s < L || typeof L == "function" && L(s, j);
|
|
1564
|
+
if (t || !Z) {
|
|
1565
|
+
f(j);
|
|
1556
1566
|
return;
|
|
1557
1567
|
}
|
|
1558
|
-
s++, e.onFail?.(s,
|
|
1559
|
-
t ? f(
|
|
1568
|
+
s++, e.onFail?.(s, j), Ur(O).then(() => u() ? void 0 : R()).then(() => {
|
|
1569
|
+
t ? f(j) : N();
|
|
1560
1570
|
});
|
|
1561
1571
|
});
|
|
1562
1572
|
};
|
|
@@ -1577,7 +1587,7 @@ var bs = class {
|
|
|
1577
1587
|
this.clearGcTimeout();
|
|
1578
1588
|
}
|
|
1579
1589
|
scheduleGc() {
|
|
1580
|
-
this.clearGcTimeout(),
|
|
1590
|
+
this.clearGcTimeout(), yt(this.gcTime) && (this.#e = Le.setTimeout(() => {
|
|
1581
1591
|
this.optionalRemove();
|
|
1582
1592
|
}, this.gcTime));
|
|
1583
1593
|
}
|
|
@@ -1611,7 +1621,7 @@ var bs = class {
|
|
|
1611
1621
|
if (this.options = { ...this.#a, ...e }, this.updateGcTime(this.options.gcTime), this.state && this.state.data === void 0) {
|
|
1612
1622
|
const t = Xt(this.options);
|
|
1613
1623
|
t.data !== void 0 && (this.setState(
|
|
1614
|
-
|
|
1624
|
+
Jt(t.data, t.dataUpdatedAt)
|
|
1615
1625
|
), this.#e = t);
|
|
1616
1626
|
}
|
|
1617
1627
|
}
|
|
@@ -1619,7 +1629,7 @@ var bs = class {
|
|
|
1619
1629
|
!this.observers.length && this.state.fetchStatus === "idle" && this.#s.remove(this);
|
|
1620
1630
|
}
|
|
1621
1631
|
setData(e, t) {
|
|
1622
|
-
const s =
|
|
1632
|
+
const s = bt(this.state.data, e, this.options);
|
|
1623
1633
|
return this.#i({
|
|
1624
1634
|
data: s,
|
|
1625
1635
|
type: "success",
|
|
@@ -1642,7 +1652,7 @@ var bs = class {
|
|
|
1642
1652
|
}
|
|
1643
1653
|
isActive() {
|
|
1644
1654
|
return this.observers.some(
|
|
1645
|
-
(e) =>
|
|
1655
|
+
(e) => Ce(e.options.enabled, this) !== !1
|
|
1646
1656
|
);
|
|
1647
1657
|
}
|
|
1648
1658
|
isDisabled() {
|
|
@@ -1730,7 +1740,7 @@ var bs = class {
|
|
|
1730
1740
|
initialPromise: t?.initialPromise,
|
|
1731
1741
|
fn: o.fetchFn,
|
|
1732
1742
|
onCancel: (l) => {
|
|
1733
|
-
l instanceof
|
|
1743
|
+
l instanceof St && l.revert && this.setState({
|
|
1734
1744
|
...this.#t,
|
|
1735
1745
|
fetchStatus: "idle"
|
|
1736
1746
|
}), s.abort();
|
|
@@ -1761,7 +1771,7 @@ var bs = class {
|
|
|
1761
1771
|
this
|
|
1762
1772
|
), l;
|
|
1763
1773
|
} catch (l) {
|
|
1764
|
-
if (l instanceof
|
|
1774
|
+
if (l instanceof St) {
|
|
1765
1775
|
if (l.silent)
|
|
1766
1776
|
return this.#r.promise;
|
|
1767
1777
|
if (l.revert) {
|
|
@@ -1813,7 +1823,7 @@ var bs = class {
|
|
|
1813
1823
|
case "success":
|
|
1814
1824
|
const r = {
|
|
1815
1825
|
...s,
|
|
1816
|
-
...
|
|
1826
|
+
...Jt(e.data, e.dataUpdatedAt),
|
|
1817
1827
|
dataUpdateCount: s.dataUpdateCount + 1,
|
|
1818
1828
|
...!e.manual && {
|
|
1819
1829
|
fetchStatus: "idle",
|
|
@@ -1849,7 +1859,7 @@ var bs = class {
|
|
|
1849
1859
|
};
|
|
1850
1860
|
}
|
|
1851
1861
|
};
|
|
1852
|
-
this.state = t(this.state),
|
|
1862
|
+
this.state = t(this.state), ce.batch(() => {
|
|
1853
1863
|
this.observers.forEach((s) => {
|
|
1854
1864
|
s.onQueryUpdate();
|
|
1855
1865
|
}), this.#s.notify({ query: this, type: "updated", action: e });
|
|
@@ -1867,7 +1877,7 @@ function As(e, t) {
|
|
|
1867
1877
|
}
|
|
1868
1878
|
};
|
|
1869
1879
|
}
|
|
1870
|
-
function
|
|
1880
|
+
function Jt(e, t) {
|
|
1871
1881
|
return {
|
|
1872
1882
|
data: e,
|
|
1873
1883
|
dataUpdatedAt: t ?? Date.now(),
|
|
@@ -1895,7 +1905,7 @@ function Xt(e) {
|
|
|
1895
1905
|
}
|
|
1896
1906
|
var Wr = class extends Qe {
|
|
1897
1907
|
constructor(e, t) {
|
|
1898
|
-
super(), this.options = t, this.#e = e, this.#i = null, this.#o =
|
|
1908
|
+
super(), this.options = t, this.#e = e, this.#i = null, this.#o = At(), this.bindMethods(), this.setOptions(t);
|
|
1899
1909
|
}
|
|
1900
1910
|
#e;
|
|
1901
1911
|
#t = void 0;
|
|
@@ -1924,14 +1934,14 @@ var Wr = class extends Qe {
|
|
|
1924
1934
|
this.hasListeners() || this.destroy();
|
|
1925
1935
|
}
|
|
1926
1936
|
shouldFetchOnReconnect() {
|
|
1927
|
-
return
|
|
1937
|
+
return wt(
|
|
1928
1938
|
this.#t,
|
|
1929
1939
|
this.options,
|
|
1930
1940
|
this.options.refetchOnReconnect
|
|
1931
1941
|
);
|
|
1932
1942
|
}
|
|
1933
1943
|
shouldFetchOnWindowFocus() {
|
|
1934
|
-
return
|
|
1944
|
+
return wt(
|
|
1935
1945
|
this.#t,
|
|
1936
1946
|
this.options,
|
|
1937
1947
|
this.options.refetchOnWindowFocus
|
|
@@ -1942,7 +1952,7 @@ var Wr = class extends Qe {
|
|
|
1942
1952
|
}
|
|
1943
1953
|
setOptions(e) {
|
|
1944
1954
|
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
|
|
1955
|
+
if (this.options = this.#e.defaultQueryOptions(e), this.options.enabled !== void 0 && typeof this.options.enabled != "boolean" && typeof this.options.enabled != "function" && typeof Ce(this.options.enabled, this.#t) != "boolean")
|
|
1946
1956
|
throw new Error(
|
|
1947
1957
|
"Expected enabled to be a boolean or a callback that returns a boolean"
|
|
1948
1958
|
);
|
|
@@ -1957,9 +1967,9 @@ var Wr = class extends Qe {
|
|
|
1957
1967
|
s,
|
|
1958
1968
|
this.options,
|
|
1959
1969
|
t
|
|
1960
|
-
) && this.#d(), this.updateResult(), r && (this.#t !== s ||
|
|
1970
|
+
) && this.#d(), this.updateResult(), r && (this.#t !== s || Ce(this.options.enabled, this.#t) !== Ce(t.enabled, this.#t) || Fe(this.options.staleTime, this.#t) !== Fe(t.staleTime, this.#t)) && this.#y();
|
|
1961
1971
|
const n = this.#g();
|
|
1962
|
-
r && (this.#t !== s ||
|
|
1972
|
+
r && (this.#t !== s || Ce(this.options.enabled, this.#t) !== Ce(t.enabled, this.#t) || n !== this.#l) && this.#v(n);
|
|
1963
1973
|
}
|
|
1964
1974
|
getOptimisticResult(e) {
|
|
1965
1975
|
const t = this.#e.getQueryCache().build(this.#e, e), s = this.createResult(t, e);
|
|
@@ -2012,7 +2022,7 @@ var Wr = class extends Qe {
|
|
|
2012
2022
|
this.options.staleTime,
|
|
2013
2023
|
this.#t
|
|
2014
2024
|
);
|
|
2015
|
-
if ($e || this.#n.isStale || !
|
|
2025
|
+
if ($e || this.#n.isStale || !yt(e))
|
|
2016
2026
|
return;
|
|
2017
2027
|
const s = ps(this.#n.dataUpdatedAt, e) + 1;
|
|
2018
2028
|
this.#c = Le.setTimeout(() => {
|
|
@@ -2023,8 +2033,8 @@ var Wr = class extends Qe {
|
|
|
2023
2033
|
return (typeof this.options.refetchInterval == "function" ? this.options.refetchInterval(this.#t) : this.options.refetchInterval) ?? !1;
|
|
2024
2034
|
}
|
|
2025
2035
|
#v(e) {
|
|
2026
|
-
this.#S(), this.#l = e, !($e ||
|
|
2027
|
-
(this.options.refetchIntervalInBackground ||
|
|
2036
|
+
this.#S(), this.#l = e, !($e || Ce(this.options.enabled, this.#t) === !1 || !yt(this.#l) || this.#l === 0) && (this.#u = Le.setInterval(() => {
|
|
2037
|
+
(this.options.refetchIntervalInBackground || Ot.isFocused()) && this.#d();
|
|
2028
2038
|
}, this.#l));
|
|
2029
2039
|
}
|
|
2030
2040
|
#b() {
|
|
@@ -2040,8 +2050,8 @@ var Wr = class extends Qe {
|
|
|
2040
2050
|
const s = this.#t, r = this.options, n = this.#n, a = this.#r, o = this.#a, h = e !== s ? e.state : this.#s, { state: u } = e;
|
|
2041
2051
|
let c = { ...u }, S = !1, f;
|
|
2042
2052
|
if (t._optimisticResults) {
|
|
2043
|
-
const
|
|
2044
|
-
(
|
|
2053
|
+
const z = this.hasListeners(), I = !z && es(e, t), T = z && ts(e, s, t, r);
|
|
2054
|
+
(I || T) && (c = {
|
|
2045
2055
|
...c,
|
|
2046
2056
|
...As(u.data, e.options)
|
|
2047
2057
|
}), t._optimisticResults === "isRestoring" && (c.fetchStatus = "idle");
|
|
@@ -2050,13 +2060,13 @@ var Wr = class extends Qe {
|
|
|
2050
2060
|
f = c.data;
|
|
2051
2061
|
let A = !1;
|
|
2052
2062
|
if (t.placeholderData !== void 0 && f === void 0 && m === "pending") {
|
|
2053
|
-
let
|
|
2054
|
-
n?.isPlaceholderData && t.placeholderData === o?.placeholderData ? (
|
|
2063
|
+
let z;
|
|
2064
|
+
n?.isPlaceholderData && t.placeholderData === o?.placeholderData ? (z = n.data, A = !0) : z = typeof t.placeholderData == "function" ? t.placeholderData(
|
|
2055
2065
|
this.#f?.state.data,
|
|
2056
2066
|
this.#f
|
|
2057
|
-
) : t.placeholderData,
|
|
2067
|
+
) : t.placeholderData, z !== void 0 && (m = "success", f = bt(
|
|
2058
2068
|
n?.data,
|
|
2059
|
-
|
|
2069
|
+
z,
|
|
2060
2070
|
t
|
|
2061
2071
|
), S = !0);
|
|
2062
2072
|
}
|
|
@@ -2065,19 +2075,19 @@ var Wr = class extends Qe {
|
|
|
2065
2075
|
f = this.#h;
|
|
2066
2076
|
else
|
|
2067
2077
|
try {
|
|
2068
|
-
this.#p = t.select, f = t.select(f), f =
|
|
2069
|
-
} catch (
|
|
2070
|
-
this.#i =
|
|
2078
|
+
this.#p = t.select, f = t.select(f), f = bt(n?.data, f, t), this.#h = f, this.#i = null;
|
|
2079
|
+
} catch (z) {
|
|
2080
|
+
this.#i = z;
|
|
2071
2081
|
}
|
|
2072
2082
|
this.#i && (R = this.#i, f = this.#h, N = Date.now(), m = "error");
|
|
2073
|
-
const
|
|
2083
|
+
const j = c.fetchStatus === "fetching", L = m === "pending", $ = m === "error", O = L && j, Z = f !== void 0, K = {
|
|
2074
2084
|
status: m,
|
|
2075
2085
|
fetchStatus: c.fetchStatus,
|
|
2076
|
-
isPending:
|
|
2086
|
+
isPending: L,
|
|
2077
2087
|
isSuccess: m === "success",
|
|
2078
|
-
isError:
|
|
2079
|
-
isInitialLoading:
|
|
2080
|
-
isLoading:
|
|
2088
|
+
isError: $,
|
|
2089
|
+
isInitialLoading: O,
|
|
2090
|
+
isLoading: O,
|
|
2081
2091
|
data: f,
|
|
2082
2092
|
dataUpdatedAt: c.dataUpdatedAt,
|
|
2083
2093
|
error: R,
|
|
@@ -2087,37 +2097,37 @@ var Wr = class extends Qe {
|
|
|
2087
2097
|
errorUpdateCount: c.errorUpdateCount,
|
|
2088
2098
|
isFetched: c.dataUpdateCount > 0 || c.errorUpdateCount > 0,
|
|
2089
2099
|
isFetchedAfterMount: c.dataUpdateCount > h.dataUpdateCount || c.errorUpdateCount > h.errorUpdateCount,
|
|
2090
|
-
isFetching:
|
|
2091
|
-
isRefetching:
|
|
2092
|
-
isLoadingError:
|
|
2100
|
+
isFetching: j,
|
|
2101
|
+
isRefetching: j && !L,
|
|
2102
|
+
isLoadingError: $ && !Z,
|
|
2093
2103
|
isPaused: c.fetchStatus === "paused",
|
|
2094
2104
|
isPlaceholderData: S,
|
|
2095
|
-
isRefetchError:
|
|
2096
|
-
isStale:
|
|
2105
|
+
isRefetchError: $ && Z,
|
|
2106
|
+
isStale: Pt(e, t),
|
|
2097
2107
|
refetch: this.refetch,
|
|
2098
2108
|
promise: this.#o,
|
|
2099
|
-
isEnabled:
|
|
2109
|
+
isEnabled: Ce(t.enabled, e) !== !1
|
|
2100
2110
|
};
|
|
2101
2111
|
if (this.options.experimental_prefetchInRender) {
|
|
2102
|
-
const
|
|
2103
|
-
|
|
2112
|
+
const z = K.data !== void 0, I = K.status === "error" && !z, T = (te) => {
|
|
2113
|
+
I ? te.reject(K.error) : z && te.resolve(K.data);
|
|
2104
2114
|
}, k = () => {
|
|
2105
|
-
const te = this.#o =
|
|
2106
|
-
|
|
2107
|
-
},
|
|
2108
|
-
switch (
|
|
2115
|
+
const te = this.#o = K.promise = At();
|
|
2116
|
+
T(te);
|
|
2117
|
+
}, Y = this.#o;
|
|
2118
|
+
switch (Y.status) {
|
|
2109
2119
|
case "pending":
|
|
2110
|
-
e.queryHash === s.queryHash &&
|
|
2120
|
+
e.queryHash === s.queryHash && T(Y);
|
|
2111
2121
|
break;
|
|
2112
2122
|
case "fulfilled":
|
|
2113
|
-
(
|
|
2123
|
+
(I || K.data !== Y.value) && k();
|
|
2114
2124
|
break;
|
|
2115
2125
|
case "rejected":
|
|
2116
|
-
(!
|
|
2126
|
+
(!I || K.error !== Y.reason) && k();
|
|
2117
2127
|
break;
|
|
2118
2128
|
}
|
|
2119
2129
|
}
|
|
2120
|
-
return
|
|
2130
|
+
return K;
|
|
2121
2131
|
}
|
|
2122
2132
|
updateResult() {
|
|
2123
2133
|
const e = this.#n, t = this.createResult(this.#t, this.options);
|
|
@@ -2151,7 +2161,7 @@ var Wr = class extends Qe {
|
|
|
2151
2161
|
this.updateResult(), this.hasListeners() && this.#b();
|
|
2152
2162
|
}
|
|
2153
2163
|
#N(e) {
|
|
2154
|
-
|
|
2164
|
+
ce.batch(() => {
|
|
2155
2165
|
e.listeners && this.listeners.forEach((t) => {
|
|
2156
2166
|
t(this.#n);
|
|
2157
2167
|
}), this.#e.getQueryCache().notify({
|
|
@@ -2162,23 +2172,23 @@ var Wr = class extends Qe {
|
|
|
2162
2172
|
}
|
|
2163
2173
|
};
|
|
2164
2174
|
function Kr(e, t) {
|
|
2165
|
-
return
|
|
2175
|
+
return Ce(t.enabled, e) !== !1 && e.state.data === void 0 && !(e.state.status === "error" && t.retryOnMount === !1);
|
|
2166
2176
|
}
|
|
2167
2177
|
function es(e, t) {
|
|
2168
|
-
return Kr(e, t) || e.state.data !== void 0 &&
|
|
2178
|
+
return Kr(e, t) || e.state.data !== void 0 && wt(e, t, t.refetchOnMount);
|
|
2169
2179
|
}
|
|
2170
|
-
function
|
|
2171
|
-
if (
|
|
2180
|
+
function wt(e, t, s) {
|
|
2181
|
+
if (Ce(t.enabled, e) !== !1 && Fe(t.staleTime, e) !== "static") {
|
|
2172
2182
|
const r = typeof s == "function" ? s(e) : s;
|
|
2173
|
-
return r === "always" || r !== !1 &&
|
|
2183
|
+
return r === "always" || r !== !1 && Pt(e, t);
|
|
2174
2184
|
}
|
|
2175
2185
|
return !1;
|
|
2176
2186
|
}
|
|
2177
2187
|
function ts(e, t, s, r) {
|
|
2178
|
-
return (e !== t ||
|
|
2188
|
+
return (e !== t || Ce(r.enabled, e) === !1) && (!s.suspense || e.state.status !== "error") && Pt(e, s);
|
|
2179
2189
|
}
|
|
2180
|
-
function
|
|
2181
|
-
return
|
|
2190
|
+
function Pt(e, t) {
|
|
2191
|
+
return Ce(t.enabled, e) !== !1 && e.isStaleByTime(Fe(t.staleTime, e));
|
|
2182
2192
|
}
|
|
2183
2193
|
function Yr(e, t) {
|
|
2184
2194
|
return !st(e.getCurrentResult(), t);
|
|
@@ -2201,27 +2211,27 @@ function ss(e) {
|
|
|
2201
2211
|
return Promise.reject();
|
|
2202
2212
|
if (m == null && N.pages.length)
|
|
2203
2213
|
return Promise.resolve(N);
|
|
2204
|
-
const
|
|
2205
|
-
const
|
|
2214
|
+
const L = (() => {
|
|
2215
|
+
const W = {
|
|
2206
2216
|
client: t.client,
|
|
2207
2217
|
queryKey: t.queryKey,
|
|
2208
2218
|
pageParam: m,
|
|
2209
2219
|
direction: A ? "backward" : "forward",
|
|
2210
2220
|
meta: t.options.meta
|
|
2211
2221
|
};
|
|
2212
|
-
return S(
|
|
2213
|
-
})(),
|
|
2222
|
+
return S(W), W;
|
|
2223
|
+
})(), $ = await f(L), { maxPages: O } = t.options, Z = A ? $r : Lr;
|
|
2214
2224
|
return {
|
|
2215
|
-
pages:
|
|
2216
|
-
pageParams:
|
|
2225
|
+
pages: Z(N.pages, $, O),
|
|
2226
|
+
pageParams: Z(N.pageParams, m, O)
|
|
2217
2227
|
};
|
|
2218
2228
|
};
|
|
2219
2229
|
if (n && a.length) {
|
|
2220
2230
|
const N = n === "backward", m = N ? zr : rs, A = {
|
|
2221
2231
|
pages: a,
|
|
2222
2232
|
pageParams: o
|
|
2223
|
-
},
|
|
2224
|
-
l = await R(A,
|
|
2233
|
+
}, j = m(r, A);
|
|
2234
|
+
l = await R(A, j, N);
|
|
2225
2235
|
} else {
|
|
2226
2236
|
const N = e ?? a.length;
|
|
2227
2237
|
do {
|
|
@@ -2258,7 +2268,7 @@ function rs(e, { pages: t, pageParams: s }) {
|
|
|
2258
2268
|
function zr(e, { pages: t, pageParams: s }) {
|
|
2259
2269
|
return t.length > 0 ? e.getPreviousPageParam?.(t[0], t, s[0], s) : void 0;
|
|
2260
2270
|
}
|
|
2261
|
-
var
|
|
2271
|
+
var Zr = class extends bs {
|
|
2262
2272
|
#e;
|
|
2263
2273
|
#t;
|
|
2264
2274
|
#s;
|
|
@@ -2466,7 +2476,7 @@ var Vr = class extends bs {
|
|
|
2466
2476
|
};
|
|
2467
2477
|
}
|
|
2468
2478
|
};
|
|
2469
|
-
this.state = t(this.state),
|
|
2479
|
+
this.state = t(this.state), ce.batch(() => {
|
|
2470
2480
|
this.#t.forEach((s) => {
|
|
2471
2481
|
s.onMutationUpdate(e);
|
|
2472
2482
|
}), this.#s.notify({
|
|
@@ -2490,7 +2500,7 @@ function Ss() {
|
|
|
2490
2500
|
submittedAt: 0
|
|
2491
2501
|
};
|
|
2492
2502
|
}
|
|
2493
|
-
var
|
|
2503
|
+
var Vr = class extends Qe {
|
|
2494
2504
|
constructor(e = {}) {
|
|
2495
2505
|
super(), this.config = e, this.#e = /* @__PURE__ */ new Set(), this.#t = /* @__PURE__ */ new Map(), this.#s = 0;
|
|
2496
2506
|
}
|
|
@@ -2498,7 +2508,7 @@ var Jr = class extends Qe {
|
|
|
2498
2508
|
#t;
|
|
2499
2509
|
#s;
|
|
2500
2510
|
build(e, t, s) {
|
|
2501
|
-
const r = new
|
|
2511
|
+
const r = new Zr({
|
|
2502
2512
|
client: e,
|
|
2503
2513
|
mutationCache: this,
|
|
2504
2514
|
mutationId: ++this.#s,
|
|
@@ -2545,7 +2555,7 @@ var Jr = class extends Qe {
|
|
|
2545
2555
|
return typeof t == "string" ? this.#t.get(t)?.find((r) => r !== e && r.state.isPaused)?.continue() ?? Promise.resolve() : Promise.resolve();
|
|
2546
2556
|
}
|
|
2547
2557
|
clear() {
|
|
2548
|
-
|
|
2558
|
+
ce.batch(() => {
|
|
2549
2559
|
this.#e.forEach((e) => {
|
|
2550
2560
|
this.notify({ type: "removed", mutation: e });
|
|
2551
2561
|
}), this.#e.clear(), this.#t.clear();
|
|
@@ -2564,7 +2574,7 @@ var Jr = class extends Qe {
|
|
|
2564
2574
|
return this.getAll().filter((t) => zt(e, t));
|
|
2565
2575
|
}
|
|
2566
2576
|
notify(e) {
|
|
2567
|
-
|
|
2577
|
+
ce.batch(() => {
|
|
2568
2578
|
this.listeners.forEach((t) => {
|
|
2569
2579
|
t(e);
|
|
2570
2580
|
});
|
|
@@ -2572,7 +2582,7 @@ var Jr = class extends Qe {
|
|
|
2572
2582
|
}
|
|
2573
2583
|
resumePausedMutations() {
|
|
2574
2584
|
const e = this.getAll().filter((t) => t.state.isPaused);
|
|
2575
|
-
return
|
|
2585
|
+
return ce.batch(
|
|
2576
2586
|
() => Promise.all(
|
|
2577
2587
|
e.map((t) => t.continue().catch(ye))
|
|
2578
2588
|
)
|
|
@@ -2582,7 +2592,7 @@ var Jr = class extends Qe {
|
|
|
2582
2592
|
function Xe(e) {
|
|
2583
2593
|
return e.options.scope?.id;
|
|
2584
2594
|
}
|
|
2585
|
-
var
|
|
2595
|
+
var Jr = class extends Qe {
|
|
2586
2596
|
#e;
|
|
2587
2597
|
#t = void 0;
|
|
2588
2598
|
#s;
|
|
@@ -2629,7 +2639,7 @@ var Zr = class extends Qe {
|
|
|
2629
2639
|
};
|
|
2630
2640
|
}
|
|
2631
2641
|
#a(e) {
|
|
2632
|
-
|
|
2642
|
+
ce.batch(() => {
|
|
2633
2643
|
if (this.#n && this.hasListeners()) {
|
|
2634
2644
|
const t = this.#t.variables, s = this.#t.context, r = {
|
|
2635
2645
|
client: this.#e,
|
|
@@ -2693,7 +2703,7 @@ var Zr = class extends Qe {
|
|
|
2693
2703
|
}
|
|
2694
2704
|
#e;
|
|
2695
2705
|
build(e, t, s) {
|
|
2696
|
-
const r = t.queryKey, n = t.queryHash ??
|
|
2706
|
+
const r = t.queryKey, n = t.queryHash ?? kt(r, t);
|
|
2697
2707
|
let a = this.get(n);
|
|
2698
2708
|
return a || (a = new Gr({
|
|
2699
2709
|
client: e,
|
|
@@ -2715,7 +2725,7 @@ var Zr = class extends Qe {
|
|
|
2715
2725
|
t && (e.destroy(), t === e && this.#e.delete(e.queryHash), this.notify({ type: "removed", query: e }));
|
|
2716
2726
|
}
|
|
2717
2727
|
clear() {
|
|
2718
|
-
|
|
2728
|
+
ce.batch(() => {
|
|
2719
2729
|
this.getAll().forEach((e) => {
|
|
2720
2730
|
this.remove(e);
|
|
2721
2731
|
});
|
|
@@ -2738,21 +2748,21 @@ var Zr = class extends Qe {
|
|
|
2738
2748
|
return Object.keys(e).length > 0 ? t.filter((s) => Yt(e, s)) : t;
|
|
2739
2749
|
}
|
|
2740
2750
|
notify(e) {
|
|
2741
|
-
|
|
2751
|
+
ce.batch(() => {
|
|
2742
2752
|
this.listeners.forEach((t) => {
|
|
2743
2753
|
t(e);
|
|
2744
2754
|
});
|
|
2745
2755
|
});
|
|
2746
2756
|
}
|
|
2747
2757
|
onFocus() {
|
|
2748
|
-
|
|
2758
|
+
ce.batch(() => {
|
|
2749
2759
|
this.getAll().forEach((e) => {
|
|
2750
2760
|
e.onFocus();
|
|
2751
2761
|
});
|
|
2752
2762
|
});
|
|
2753
2763
|
}
|
|
2754
2764
|
onOnline() {
|
|
2755
|
-
|
|
2765
|
+
ce.batch(() => {
|
|
2756
2766
|
this.getAll().forEach((e) => {
|
|
2757
2767
|
e.onOnline();
|
|
2758
2768
|
});
|
|
@@ -2768,10 +2778,10 @@ var Zr = class extends Qe {
|
|
|
2768
2778
|
#o;
|
|
2769
2779
|
#i;
|
|
2770
2780
|
constructor(e = {}) {
|
|
2771
|
-
this.#e = e.queryCache || new Xr(), this.#t = e.mutationCache || new
|
|
2781
|
+
this.#e = e.queryCache || new Xr(), this.#t = e.mutationCache || new Vr(), this.#s = e.defaultOptions || {}, this.#n = /* @__PURE__ */ new Map(), this.#r = /* @__PURE__ */ new Map(), this.#a = 0;
|
|
2772
2782
|
}
|
|
2773
2783
|
mount() {
|
|
2774
|
-
this.#a++, this.#a === 1 && (this.#o =
|
|
2784
|
+
this.#a++, this.#a === 1 && (this.#o = Ot.subscribe(async (e) => {
|
|
2775
2785
|
e && (await this.resumePausedMutations(), this.#e.onFocus());
|
|
2776
2786
|
}), this.#i = nt.subscribe(async (e) => {
|
|
2777
2787
|
e && (await this.resumePausedMutations(), this.#e.onOnline());
|
|
@@ -2815,7 +2825,7 @@ var Zr = class extends Qe {
|
|
|
2815
2825
|
return this.#e.build(this, r).setData(o, { ...s, manual: !0 });
|
|
2816
2826
|
}
|
|
2817
2827
|
setQueriesData(e, t, s) {
|
|
2818
|
-
return
|
|
2828
|
+
return ce.batch(
|
|
2819
2829
|
() => this.#e.findAll(e).map(({ queryKey: r }) => [
|
|
2820
2830
|
r,
|
|
2821
2831
|
this.setQueryData(r, t, s)
|
|
@@ -2830,7 +2840,7 @@ var Zr = class extends Qe {
|
|
|
2830
2840
|
}
|
|
2831
2841
|
removeQueries(e) {
|
|
2832
2842
|
const t = this.#e;
|
|
2833
|
-
|
|
2843
|
+
ce.batch(() => {
|
|
2834
2844
|
t.findAll(e).forEach((s) => {
|
|
2835
2845
|
t.remove(s);
|
|
2836
2846
|
});
|
|
@@ -2838,7 +2848,7 @@ var Zr = class extends Qe {
|
|
|
2838
2848
|
}
|
|
2839
2849
|
resetQueries(e, t) {
|
|
2840
2850
|
const s = this.#e;
|
|
2841
|
-
return
|
|
2851
|
+
return ce.batch(() => (s.findAll(e).forEach((r) => {
|
|
2842
2852
|
r.reset();
|
|
2843
2853
|
}), this.refetchQueries(
|
|
2844
2854
|
{
|
|
@@ -2849,13 +2859,13 @@ var Zr = class extends Qe {
|
|
|
2849
2859
|
)));
|
|
2850
2860
|
}
|
|
2851
2861
|
cancelQueries(e, t = {}) {
|
|
2852
|
-
const s = { revert: !0, ...t }, r =
|
|
2862
|
+
const s = { revert: !0, ...t }, r = ce.batch(
|
|
2853
2863
|
() => this.#e.findAll(e).map((n) => n.cancel(s))
|
|
2854
2864
|
);
|
|
2855
2865
|
return Promise.all(r).then(ye).catch(ye);
|
|
2856
2866
|
}
|
|
2857
2867
|
invalidateQueries(e, t = {}) {
|
|
2858
|
-
return
|
|
2868
|
+
return ce.batch(() => (this.#e.findAll(e).forEach((s) => {
|
|
2859
2869
|
s.invalidate();
|
|
2860
2870
|
}), e?.refetchType === "none" ? Promise.resolve() : this.refetchQueries(
|
|
2861
2871
|
{
|
|
@@ -2869,7 +2879,7 @@ var Zr = class extends Qe {
|
|
|
2869
2879
|
const s = {
|
|
2870
2880
|
...t,
|
|
2871
2881
|
cancelRefetch: t.cancelRefetch ?? !0
|
|
2872
|
-
}, r =
|
|
2882
|
+
}, r = ce.batch(
|
|
2873
2883
|
() => this.#e.findAll(e).filter((n) => !n.isDisabled() && !n.isStatic()).map((n) => {
|
|
2874
2884
|
let a = n.fetch(void 0, s);
|
|
2875
2885
|
return s.throwOnError || (a = a.catch(ye)), n.state.fetchStatus === "paused" ? Promise.resolve() : a;
|
|
@@ -2945,7 +2955,7 @@ var Zr = class extends Qe {
|
|
|
2945
2955
|
...e,
|
|
2946
2956
|
_defaulted: !0
|
|
2947
2957
|
};
|
|
2948
|
-
return t.queryHash || (t.queryHash =
|
|
2958
|
+
return t.queryHash || (t.queryHash = kt(
|
|
2949
2959
|
t.queryKey,
|
|
2950
2960
|
t
|
|
2951
2961
|
)), 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 === rt && (t.enabled = !1), t;
|
|
@@ -2963,7 +2973,7 @@ var Zr = class extends Qe {
|
|
|
2963
2973
|
}
|
|
2964
2974
|
}, ws = fe.createContext(
|
|
2965
2975
|
void 0
|
|
2966
|
-
),
|
|
2976
|
+
), Mt = (e) => {
|
|
2967
2977
|
const t = fe.useContext(ws);
|
|
2968
2978
|
if (!t)
|
|
2969
2979
|
throw new Error("No QueryClient set, use QueryClientProvider to set one");
|
|
@@ -2988,7 +2998,7 @@ function rn() {
|
|
|
2988
2998
|
};
|
|
2989
2999
|
}
|
|
2990
3000
|
var nn = fe.createContext(rn()), an = () => fe.useContext(nn), on = (e, t, s) => {
|
|
2991
|
-
const r = s?.state.error && typeof e.throwOnError == "function" ?
|
|
3001
|
+
const r = s?.state.error && typeof e.throwOnError == "function" ? Et(e.throwOnError, [s.state.error, s]) : e.throwOnError;
|
|
2992
3002
|
(e.suspense || e.experimental_prefetchInRender || r) && (t.isReset() || (e.retryOnMount = !1));
|
|
2993
3003
|
}, ln = (e) => {
|
|
2994
3004
|
fe.useEffect(() => {
|
|
@@ -3000,7 +3010,7 @@ var nn = fe.createContext(rn()), an = () => fe.useContext(nn), on = (e, t, s) =>
|
|
|
3000
3010
|
throwOnError: s,
|
|
3001
3011
|
query: r,
|
|
3002
3012
|
suspense: n
|
|
3003
|
-
}) => e.isError && !t.isReset() && !e.isFetching && r && (n && e.data === void 0 ||
|
|
3013
|
+
}) => e.isError && !t.isReset() && !e.isFetching && r && (n && e.data === void 0 || Et(s, [e.error, r])), un = (e) => {
|
|
3004
3014
|
if (e.suspense) {
|
|
3005
3015
|
const s = (n) => n === "static" ? n : Math.max(n ?? 1e3, 1e3), r = e.staleTime;
|
|
3006
3016
|
e.staleTime = typeof r == "function" ? (...n) => s(r(...n)) : s(r), typeof e.gcTime == "number" && (e.gcTime = Math.max(
|
|
@@ -3016,7 +3026,7 @@ function fn(e, t, s) {
|
|
|
3016
3026
|
throw new Error(
|
|
3017
3027
|
'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
3028
|
);
|
|
3019
|
-
const r = sn(), n = an(), a =
|
|
3029
|
+
const r = sn(), n = an(), a = Mt(), o = a.defaultQueryOptions(e);
|
|
3020
3030
|
a.getDefaultOptions().queries?._experimental_beforeQuery?.(
|
|
3021
3031
|
o
|
|
3022
3032
|
);
|
|
@@ -3033,7 +3043,7 @@ function fn(e, t, s) {
|
|
|
3033
3043
|
if (fe.useSyncExternalStore(
|
|
3034
3044
|
fe.useCallback(
|
|
3035
3045
|
(f) => {
|
|
3036
|
-
const R = S ? u.subscribe(
|
|
3046
|
+
const R = S ? u.subscribe(ce.batchCalls(f)) : ye;
|
|
3037
3047
|
return u.updateResult(), R;
|
|
3038
3048
|
},
|
|
3039
3049
|
[u, S]
|
|
@@ -3065,12 +3075,12 @@ function fn(e, t, s) {
|
|
|
3065
3075
|
u.updateResult();
|
|
3066
3076
|
}), o.notifyOnChangeProps ? c : u.trackResult(c);
|
|
3067
3077
|
}
|
|
3068
|
-
function
|
|
3078
|
+
function at(e, t) {
|
|
3069
3079
|
return fn(e, Wr);
|
|
3070
3080
|
}
|
|
3071
3081
|
function mn(e, t) {
|
|
3072
|
-
const s =
|
|
3073
|
-
() => new
|
|
3082
|
+
const s = Mt(), [r] = fe.useState(
|
|
3083
|
+
() => new Jr(
|
|
3074
3084
|
s,
|
|
3075
3085
|
e
|
|
3076
3086
|
)
|
|
@@ -3080,7 +3090,7 @@ function mn(e, t) {
|
|
|
3080
3090
|
}, [r, e]);
|
|
3081
3091
|
const n = fe.useSyncExternalStore(
|
|
3082
3092
|
fe.useCallback(
|
|
3083
|
-
(o) => r.subscribe(
|
|
3093
|
+
(o) => r.subscribe(ce.batchCalls(o)),
|
|
3084
3094
|
[r]
|
|
3085
3095
|
),
|
|
3086
3096
|
() => r.getCurrentResult(),
|
|
@@ -3091,12 +3101,12 @@ function mn(e, t) {
|
|
|
3091
3101
|
},
|
|
3092
3102
|
[r]
|
|
3093
3103
|
);
|
|
3094
|
-
if (n.error &&
|
|
3104
|
+
if (n.error && Et(r.options.throwOnError, [n.error]))
|
|
3095
3105
|
throw n.error;
|
|
3096
3106
|
return { ...n, mutate: a, mutateAsync: n.mutate };
|
|
3097
3107
|
}
|
|
3098
3108
|
function xs() {
|
|
3099
|
-
const { alerts: e } = Te(), t =
|
|
3109
|
+
const { alerts: e } = Te(), t = Mt();
|
|
3100
3110
|
return mn({
|
|
3101
3111
|
mutationFn: (s) => e.updateAlertStatus(s),
|
|
3102
3112
|
onSuccess: () => {
|
|
@@ -3136,7 +3146,7 @@ function gn(e) {
|
|
|
3136
3146
|
return "-";
|
|
3137
3147
|
}
|
|
3138
3148
|
}
|
|
3139
|
-
function
|
|
3149
|
+
function Nt(e) {
|
|
3140
3150
|
if (!e) return "-";
|
|
3141
3151
|
try {
|
|
3142
3152
|
return new Date(e).toLocaleString("en-US", {
|
|
@@ -3284,7 +3294,7 @@ function Sn({
|
|
|
3284
3294
|
time: t,
|
|
3285
3295
|
timeZone: s = "America/New_York"
|
|
3286
3296
|
}) {
|
|
3287
|
-
const { hours: r, minutes: n, seconds: a } =
|
|
3297
|
+
const { hours: r, minutes: n, seconds: a } = ue(() => {
|
|
3288
3298
|
const S = new Intl.DateTimeFormat("en-US", {
|
|
3289
3299
|
timeZone: s,
|
|
3290
3300
|
hour: "numeric",
|
|
@@ -3307,7 +3317,7 @@ function Sn({
|
|
|
3307
3317
|
"aria-label": "Analog Clock",
|
|
3308
3318
|
children: [
|
|
3309
3319
|
[...Array(12)].map((c, S) => {
|
|
3310
|
-
const f = S * 30, R = 6, N = u - 4, m = N - R, A = (f - 90) * (Math.PI / 180),
|
|
3320
|
+
const f = S * 30, R = 6, N = u - 4, m = N - R, A = (f - 90) * (Math.PI / 180), j = u + m * Math.cos(A), L = u + m * Math.sin(A), $ = u + N * Math.cos(A), O = u + N * Math.sin(A);
|
|
3311
3321
|
return /* @__PURE__ */ i(
|
|
3312
3322
|
"svg",
|
|
3313
3323
|
{
|
|
@@ -3317,10 +3327,10 @@ function Sn({
|
|
|
3317
3327
|
children: /* @__PURE__ */ i(
|
|
3318
3328
|
"line",
|
|
3319
3329
|
{
|
|
3320
|
-
x1:
|
|
3321
|
-
y1:
|
|
3322
|
-
x2:
|
|
3323
|
-
y2:
|
|
3330
|
+
x1: j,
|
|
3331
|
+
y1: L,
|
|
3332
|
+
x2: $,
|
|
3333
|
+
y2: O,
|
|
3324
3334
|
stroke: "#9CA3AF",
|
|
3325
3335
|
strokeWidth: S % 3 === 0 ? 2 : 1,
|
|
3326
3336
|
strokeLinecap: "round"
|
|
@@ -3411,11 +3421,11 @@ function Sn({
|
|
|
3411
3421
|
}
|
|
3412
3422
|
function wn({ label: e = "USA", timeZone: t = "America/New_York", updateIntervalMs: s = 1e3, className: r }) {
|
|
3413
3423
|
const [n, a] = w(/* @__PURE__ */ new Date());
|
|
3414
|
-
|
|
3424
|
+
de(() => {
|
|
3415
3425
|
const u = setInterval(() => a(/* @__PURE__ */ new Date()), s);
|
|
3416
3426
|
return () => clearInterval(u);
|
|
3417
3427
|
}, [s]);
|
|
3418
|
-
const o =
|
|
3428
|
+
const o = ue(() => pn(n, t), [n, t]), { abbr: l, offset: h } = ue(() => yn(n, t), [n, t]);
|
|
3419
3429
|
return /* @__PURE__ */ d("div", { className: `flex items-center gap-3 ${r || ""}`, children: [
|
|
3420
3430
|
/* @__PURE__ */ i(Sn, { time: n, timeZone: t, size: 80 }),
|
|
3421
3431
|
/* @__PURE__ */ d("div", { className: "flex flex-col items-baseline gap-1", children: [
|
|
@@ -3428,15 +3438,15 @@ function wn({ label: e = "USA", timeZone: t = "America/New_York", updateInterval
|
|
|
3428
3438
|
] })
|
|
3429
3439
|
] });
|
|
3430
3440
|
}
|
|
3431
|
-
const Nn = [{ SeverityId: 1, Code: "LOW", DisplayName: "Low", SortOrder: 10, IsActive: !0 }, { SeverityId: 2, Code: "MEDIUM", DisplayName: "Medium", SortOrder: 20, IsActive: !0 }, { SeverityId: 3, Code: "HIGH", DisplayName: "High", SortOrder: 30, IsActive: !0 }, { SeverityId: 4, Code: "CRITICAL", DisplayName: "Critical", SortOrder: 40, IsActive: !0 }], xn = [{ RuleId: "0938aa00-dfa7-4258-805a-67396366c776", RuleVersionId: "36d2d581-57c3-45c3-8705-8235935fdf96", Name: "License Plate Recognition", Description: "License Plate Recognition", VersionCount: 1, ActionCount: 0, ApplicabilityPeriodCount: 0, SuppressionCount: 0, AssignmentCount: 0, ExclusionCount: 0, IsDeleted: !1, SeverityId: 3, AnomalyId: "915976ef-4eb6-4f7b-bbe6-e53862517fc9", Level: "global" }, { RuleId: "2437286a-db6a-4d35-814e-9ac49f158dde", RuleVersionId: "00000000-0000-0000-0000-000000000000", Name: "Monitor And Track Onsite Vehicle timelog", Description: "Monitor And Track Onsite Vehicle timelog", VersionCount: 0, ActionCount: 0, ApplicabilityPeriodCount: 0, SuppressionCount: 0, AssignmentCount: 0, ExclusionCount: 0, IsDeleted: !1, SeverityId: 3, AnomalyId: "9fd651ab-4312-4826-84b6-94d735894477", Level: "global" }, { RuleId: "b99120ba-7a83-4ade-b5d9-a420550fe351", RuleVersionId: "d7b14dae-a7b1-474e-a357-199182c02ac3", Name: "Watchlist person detected", Description: "Watchlist person detected", VersionCount: 1, ActionCount: 0, ApplicabilityPeriodCount: 0, SuppressionCount: 0, AssignmentCount: 0, ExclusionCount: 0, IsDeleted: !1, SeverityId: 4, AnomalyId: "bb3a3d3a-73a3-4f5a-8804-1baadbd0d412", Level: "global" }, { RuleId: "ffc2c24f-adb7-4aba-ace7-f19c54e21530", RuleVersionId: "6ab3178f-bf77-4a1e-898d-1d5dbef749c5", Name: "Weapon Detection", Description: "Weapon Detection", VersionCount: 1, ActionCount: 0, ApplicabilityPeriodCount: 0, SuppressionCount: 0, AssignmentCount: 0, ExclusionCount: 0, IsDeleted: !1, SeverityId: 4, AnomalyId: "ac82c3a2-72e6-4f9c-88fb-851a3ca3c4de", Level: "global" }], Cn = [{ userRoleId: 1, userRoleName: "Super Admin" }, { userRoleId: 2, userRoleName: "Security Officer" }, { userRoleId: 3, userRoleName: "Security Admin" }, { userRoleId: 4, userRoleName: "Regulatory Officer/First Responder" }, { userRoleId: 5, userRoleName: "User" }],
|
|
3441
|
+
const Nn = [{ SeverityId: 1, Code: "LOW", DisplayName: "Low", SortOrder: 10, IsActive: !0 }, { SeverityId: 2, Code: "MEDIUM", DisplayName: "Medium", SortOrder: 20, IsActive: !0 }, { SeverityId: 3, Code: "HIGH", DisplayName: "High", SortOrder: 30, IsActive: !0 }, { SeverityId: 4, Code: "CRITICAL", DisplayName: "Critical", SortOrder: 40, IsActive: !0 }], xn = [{ RuleId: "0938aa00-dfa7-4258-805a-67396366c776", RuleVersionId: "36d2d581-57c3-45c3-8705-8235935fdf96", Name: "License Plate Recognition", Description: "License Plate Recognition", VersionCount: 1, ActionCount: 0, ApplicabilityPeriodCount: 0, SuppressionCount: 0, AssignmentCount: 0, ExclusionCount: 0, IsDeleted: !1, SeverityId: 3, AnomalyId: "915976ef-4eb6-4f7b-bbe6-e53862517fc9", Level: "global" }, { RuleId: "2437286a-db6a-4d35-814e-9ac49f158dde", RuleVersionId: "00000000-0000-0000-0000-000000000000", Name: "Monitor And Track Onsite Vehicle timelog", Description: "Monitor And Track Onsite Vehicle timelog", VersionCount: 0, ActionCount: 0, ApplicabilityPeriodCount: 0, SuppressionCount: 0, AssignmentCount: 0, ExclusionCount: 0, IsDeleted: !1, SeverityId: 3, AnomalyId: "9fd651ab-4312-4826-84b6-94d735894477", Level: "global" }, { RuleId: "b99120ba-7a83-4ade-b5d9-a420550fe351", RuleVersionId: "d7b14dae-a7b1-474e-a357-199182c02ac3", Name: "Watchlist person detected", Description: "Watchlist person detected", VersionCount: 1, ActionCount: 0, ApplicabilityPeriodCount: 0, SuppressionCount: 0, AssignmentCount: 0, ExclusionCount: 0, IsDeleted: !1, SeverityId: 4, AnomalyId: "bb3a3d3a-73a3-4f5a-8804-1baadbd0d412", Level: "global" }, { RuleId: "ffc2c24f-adb7-4aba-ace7-f19c54e21530", RuleVersionId: "6ab3178f-bf77-4a1e-898d-1d5dbef749c5", Name: "Weapon Detection", Description: "Weapon Detection", VersionCount: 1, ActionCount: 0, ApplicabilityPeriodCount: 0, SuppressionCount: 0, AssignmentCount: 0, ExclusionCount: 0, IsDeleted: !1, SeverityId: 4, AnomalyId: "ac82c3a2-72e6-4f9c-88fb-851a3ca3c4de", Level: "global" }], Cn = [{ userRoleId: 1, userRoleName: "Super Admin" }, { userRoleId: 2, userRoleName: "Security Officer" }, { userRoleId: 3, userRoleName: "Security Admin" }, { userRoleId: 4, userRoleName: "Regulatory Officer/First Responder" }, { userRoleId: 5, userRoleName: "User" }], qe = {
|
|
3432
3442
|
severities: Nn,
|
|
3433
3443
|
rules: xn,
|
|
3434
3444
|
userRoles: Cn
|
|
3435
|
-
}, { Text:
|
|
3436
|
-
function
|
|
3445
|
+
}, { Text: Tn } = Ye;
|
|
3446
|
+
function In({ sortBy: e, onChange: t, showActions: s, onSave: r, onClear: n, saving: a }) {
|
|
3437
3447
|
return /* @__PURE__ */ d(Ae, { gutter: [16, 16], align: "middle", children: [
|
|
3438
3448
|
/* @__PURE__ */ i(G, { xs: 24, md: 8, lg: 5, children: /* @__PURE__ */ d(Ie, { className: "w-full items-center", direction: "horizontal", size: 12, children: [
|
|
3439
|
-
/* @__PURE__ */ i(
|
|
3449
|
+
/* @__PURE__ */ i(Tn, { className: "text-gray-600 whitespace-nowrap", children: "Sort By:" }),
|
|
3440
3450
|
/* @__PURE__ */ i(
|
|
3441
3451
|
ve,
|
|
3442
3452
|
{
|
|
@@ -3479,47 +3489,47 @@ function Rn(e) {
|
|
|
3479
3489
|
l3mins: N,
|
|
3480
3490
|
setL3mins: m,
|
|
3481
3491
|
l3role: A,
|
|
3482
|
-
setL3role:
|
|
3483
|
-
actions:
|
|
3484
|
-
setActions:
|
|
3485
|
-
thirdPartyIds:
|
|
3486
|
-
setThirdPartyIds:
|
|
3487
|
-
humanLoop:
|
|
3488
|
-
setHumanLoop:
|
|
3489
|
-
isAutoExpire:
|
|
3490
|
-
setAutoExpire:
|
|
3491
|
-
onClear:
|
|
3492
|
+
setL3role: j,
|
|
3493
|
+
actions: L,
|
|
3494
|
+
setActions: $,
|
|
3495
|
+
thirdPartyIds: O,
|
|
3496
|
+
setThirdPartyIds: Z,
|
|
3497
|
+
humanLoop: W,
|
|
3498
|
+
setHumanLoop: K,
|
|
3499
|
+
isAutoExpire: z,
|
|
3500
|
+
setAutoExpire: I,
|
|
3501
|
+
onClear: T,
|
|
3492
3502
|
onSave: k,
|
|
3493
|
-
saving:
|
|
3503
|
+
saving: Y,
|
|
3494
3504
|
onActionTypesLoaded: te
|
|
3495
3505
|
} = e, { rules: E } = Te(), [v, p] = w([]), [x, y] = w([]), [b, g] = w(!1);
|
|
3496
|
-
|
|
3497
|
-
let
|
|
3506
|
+
de(() => {
|
|
3507
|
+
let U = !1;
|
|
3498
3508
|
return (async () => {
|
|
3499
3509
|
try {
|
|
3500
3510
|
g(!0);
|
|
3501
|
-
const
|
|
3502
|
-
if (
|
|
3503
|
-
const
|
|
3504
|
-
p(
|
|
3505
|
-
const ne = Array.isArray(
|
|
3511
|
+
const q = await E.getLookups();
|
|
3512
|
+
if (U || !q || !Array.isArray(q.actionTypes)) return;
|
|
3513
|
+
const V = q.actionTypes.map((oe) => ({ label: oe.name, value: String(oe.actionTypeId) }));
|
|
3514
|
+
p(V), te && te(q.actionTypes);
|
|
3515
|
+
const ne = Array.isArray(q.thirdParties) ? q.thirdParties.map((oe) => ({ label: oe.thirdPartyName, value: oe.thirdPartyId })) : [];
|
|
3506
3516
|
y(ne);
|
|
3507
|
-
} catch (
|
|
3508
|
-
console.error("Error loading lookups",
|
|
3517
|
+
} catch (q) {
|
|
3518
|
+
console.error("Error loading lookups", q);
|
|
3509
3519
|
} finally {
|
|
3510
|
-
|
|
3520
|
+
U || g(!1);
|
|
3511
3521
|
}
|
|
3512
3522
|
})(), () => {
|
|
3513
|
-
|
|
3523
|
+
U = !0;
|
|
3514
3524
|
};
|
|
3515
3525
|
}, []);
|
|
3516
|
-
const
|
|
3526
|
+
const P = (U) => /* @__PURE__ */ d(We, { children: [
|
|
3517
3527
|
/* @__PURE__ */ i(Ws, {}),
|
|
3518
3528
|
" ",
|
|
3519
|
-
|
|
3529
|
+
U.length,
|
|
3520
3530
|
" more"
|
|
3521
|
-
] }),
|
|
3522
|
-
return /* @__PURE__ */ d(
|
|
3531
|
+
] }), B = typeof o == "number" || typeof h == "number" || typeof c == "number" || typeof f == "number" || typeof N == "number" || typeof A == "number" || Array.isArray(L) && L.length > 0 || Array.isArray(O) && O.length > 0 || !!W || !!z;
|
|
3532
|
+
return /* @__PURE__ */ d(Ct, { spinning: !!Y || b, children: [
|
|
3523
3533
|
/* @__PURE__ */ d(Ae, { gutter: [16, 16], align: "bottom", children: [
|
|
3524
3534
|
/* @__PURE__ */ i(G, { xs: 24, sm: 12, md: 8, lg: 4, children: /* @__PURE__ */ d("div", { children: [
|
|
3525
3535
|
/* @__PURE__ */ i(Me, { className: "text-gray-700 font-medium block mb-1", children: "Rules" }),
|
|
@@ -3612,7 +3622,7 @@ function Rn(e) {
|
|
|
3612
3622
|
placeholder: "Escalate to",
|
|
3613
3623
|
className: "w-full",
|
|
3614
3624
|
value: A,
|
|
3615
|
-
onChange:
|
|
3625
|
+
onChange: j,
|
|
3616
3626
|
options: a
|
|
3617
3627
|
}
|
|
3618
3628
|
) })
|
|
@@ -3626,11 +3636,11 @@ function Rn(e) {
|
|
|
3626
3636
|
mode: "multiple",
|
|
3627
3637
|
placeholder: "Select response actions",
|
|
3628
3638
|
className: "w-full",
|
|
3629
|
-
value:
|
|
3630
|
-
onChange:
|
|
3639
|
+
value: L,
|
|
3640
|
+
onChange: $,
|
|
3631
3641
|
options: v,
|
|
3632
3642
|
maxTagCount: 1,
|
|
3633
|
-
maxTagPlaceholder:
|
|
3643
|
+
maxTagPlaceholder: P
|
|
3634
3644
|
}
|
|
3635
3645
|
)
|
|
3636
3646
|
] }) }),
|
|
@@ -3642,8 +3652,8 @@ function Rn(e) {
|
|
|
3642
3652
|
mode: "multiple",
|
|
3643
3653
|
placeholder: "Third Party app",
|
|
3644
3654
|
className: "w-full",
|
|
3645
|
-
value:
|
|
3646
|
-
onChange:
|
|
3655
|
+
value: O,
|
|
3656
|
+
onChange: Z,
|
|
3647
3657
|
options: x
|
|
3648
3658
|
}
|
|
3649
3659
|
)
|
|
@@ -3651,12 +3661,12 @@ function Rn(e) {
|
|
|
3651
3661
|
] }),
|
|
3652
3662
|
/* @__PURE__ */ d(Ae, { gutter: [16, 16], align: "bottom", className: "mt-4 items-center", children: [
|
|
3653
3663
|
/* @__PURE__ */ i(G, { xs: 24, sm: 12, md: 8, lg: 7, children: /* @__PURE__ */ d("div", { className: "flex items-center h-full gap-8", children: [
|
|
3654
|
-
/* @__PURE__ */ i(
|
|
3655
|
-
/* @__PURE__ */ i(
|
|
3664
|
+
/* @__PURE__ */ i(_e, { checked: W, onChange: (U) => K(U.target.checked), className: "w-full", children: "Human-In-The-Loop" }),
|
|
3665
|
+
/* @__PURE__ */ i(_e, { checked: z, onChange: (U) => I(U.target.checked), className: "w-full", children: "Auto-expire in 5 minutes" })
|
|
3656
3666
|
] }) }),
|
|
3657
3667
|
/* @__PURE__ */ i(G, { xs: 24, sm: 12, md: 8, children: /* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
|
|
3658
|
-
/* @__PURE__ */ i(Se, { onClick:
|
|
3659
|
-
/* @__PURE__ */ i(Se, { type: "primary", onClick: k, loading: !!
|
|
3668
|
+
/* @__PURE__ */ i(Se, { onClick: T, children: "Clear" }),
|
|
3669
|
+
/* @__PURE__ */ i(Se, { type: "primary", onClick: k, loading: !!Y, disabled: !(!!t && B && !Y), children: "Save" })
|
|
3660
3670
|
] }) })
|
|
3661
3671
|
] })
|
|
3662
3672
|
] });
|
|
@@ -3664,7 +3674,7 @@ function Rn(e) {
|
|
|
3664
3674
|
function kn({ entries: e, userRoles: t, onEdit: s, loading: r }) {
|
|
3665
3675
|
const n = new Map(t.map((o) => [o.userRoleId, o.userRoleName])), a = (o) => o.map((l) => n.get(l) || String(l)).join(", ");
|
|
3666
3676
|
return /* @__PURE__ */ i(
|
|
3667
|
-
|
|
3677
|
+
xt,
|
|
3668
3678
|
{
|
|
3669
3679
|
rowKey: "id",
|
|
3670
3680
|
dataSource: e,
|
|
@@ -3727,7 +3737,7 @@ function kn({ entries: e, userRoles: t, onEdit: s, loading: r }) {
|
|
|
3727
3737
|
}
|
|
3728
3738
|
const { Title: En } = Ye;
|
|
3729
3739
|
function On({ userRoles: e, rules: t, rawRules: s }) {
|
|
3730
|
-
const { rules: r } = Te(), [n, a] = w(!1), [o, l] = w(s), [h, u] = w({}), c =
|
|
3740
|
+
const { rules: r } = Te(), [n, a] = w(!1), [o, l] = w(s), [h, u] = w({}), c = ue(() => e.map((m) => ({ label: m.userRoleName, value: m.userRoleId })), [e]), S = ue(
|
|
3731
3741
|
() => (t || []).map((m, A) => ({
|
|
3732
3742
|
key: m.RuleId || m.Name || String(A),
|
|
3733
3743
|
ruleName: m.Name || "-",
|
|
@@ -3735,7 +3745,7 @@ function On({ userRoles: e, rules: t, rawRules: s }) {
|
|
|
3735
3745
|
})),
|
|
3736
3746
|
[t]
|
|
3737
3747
|
);
|
|
3738
|
-
|
|
3748
|
+
de(() => {
|
|
3739
3749
|
let m = !1;
|
|
3740
3750
|
return (async () => {
|
|
3741
3751
|
try {
|
|
@@ -3750,25 +3760,25 @@ function On({ userRoles: e, rules: t, rawRules: s }) {
|
|
|
3750
3760
|
})(), () => {
|
|
3751
3761
|
m = !0;
|
|
3752
3762
|
};
|
|
3753
|
-
}, []),
|
|
3763
|
+
}, []), de(() => {
|
|
3754
3764
|
!o && Array.isArray(s) && l(s);
|
|
3755
3765
|
}, [s]);
|
|
3756
|
-
const f =
|
|
3766
|
+
const f = ue(() => {
|
|
3757
3767
|
if (!Array.isArray(o) || !o.length) return {};
|
|
3758
3768
|
const m = {};
|
|
3759
3769
|
for (const A of S) {
|
|
3760
|
-
const
|
|
3761
|
-
(
|
|
3762
|
-
|
|
3763
|
-
),
|
|
3764
|
-
|
|
3770
|
+
const j = o.find(
|
|
3771
|
+
($) => $?.ruleId === A.key || $?.ruleName === A.key || $?.RuleId === A.key || $?.ruleName === A.ruleName || // fallback by name
|
|
3772
|
+
$?.Name === A.ruleName
|
|
3773
|
+
), L = Array.isArray(j?.userRoleIds) ? j.userRoleIds : [];
|
|
3774
|
+
L.length && (m[A.key] = L);
|
|
3765
3775
|
}
|
|
3766
3776
|
return m;
|
|
3767
3777
|
}, [o, S]);
|
|
3768
3778
|
return /* @__PURE__ */ d("div", { className: "w-full", children: [
|
|
3769
3779
|
/* @__PURE__ */ i("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ i(En, { level: 4, className: "!mb-4", children: "Alert Assignment" }) }),
|
|
3770
3780
|
/* @__PURE__ */ i(
|
|
3771
|
-
|
|
3781
|
+
xt,
|
|
3772
3782
|
{
|
|
3773
3783
|
rowKey: "key",
|
|
3774
3784
|
dataSource: S,
|
|
@@ -3787,7 +3797,7 @@ function On({ userRoles: e, rules: t, rawRules: s }) {
|
|
|
3787
3797
|
placeholder: "Dropdown with Multi select",
|
|
3788
3798
|
className: "w-full",
|
|
3789
3799
|
value: h[A.key] ?? f[A.key] ?? [],
|
|
3790
|
-
onChange: (
|
|
3800
|
+
onChange: (j) => u((L) => ({ ...L, [A.key]: j })),
|
|
3791
3801
|
options: c
|
|
3792
3802
|
}
|
|
3793
3803
|
)
|
|
@@ -3810,24 +3820,24 @@ function On({ userRoles: e, rules: t, rawRules: s }) {
|
|
|
3810
3820
|
return;
|
|
3811
3821
|
}
|
|
3812
3822
|
a(!0);
|
|
3813
|
-
const m = Object.entries(h).map(async ([A,
|
|
3814
|
-
const
|
|
3815
|
-
(
|
|
3816
|
-
),
|
|
3817
|
-
if (!
|
|
3823
|
+
const m = Object.entries(h).map(async ([A, j]) => {
|
|
3824
|
+
const L = o.find(
|
|
3825
|
+
(K) => K?.ruleId === A || K?.ruleName === A || K?.RuleId === A
|
|
3826
|
+
), $ = typeof L?.recordId == "number" ? L.recordId : void 0;
|
|
3827
|
+
if (!L || typeof $ != "number")
|
|
3818
3828
|
throw new Error(`Unable to find recordId for rule ${A}`);
|
|
3819
|
-
const
|
|
3820
|
-
const
|
|
3829
|
+
const O = Array.isArray(j) ? j : [], Z = O.map((K) => {
|
|
3830
|
+
const z = e.find((I) => I.userRoleId === K);
|
|
3821
3831
|
return {
|
|
3822
|
-
id:
|
|
3823
|
-
name:
|
|
3832
|
+
id: K,
|
|
3833
|
+
name: z?.userRoleName ?? String(K)
|
|
3824
3834
|
};
|
|
3825
|
-
}),
|
|
3826
|
-
...
|
|
3835
|
+
}), W = {
|
|
3836
|
+
...L,
|
|
3827
3837
|
ruleId: A,
|
|
3828
3838
|
// ensure ruleId matches the selected rule
|
|
3829
|
-
userRoleIds:
|
|
3830
|
-
userRoles:
|
|
3839
|
+
userRoleIds: O,
|
|
3840
|
+
userRoles: Z,
|
|
3831
3841
|
actions: [
|
|
3832
3842
|
{
|
|
3833
3843
|
actionTypeId: 4,
|
|
@@ -3842,7 +3852,7 @@ function On({ userRoles: e, rules: t, rawRules: s }) {
|
|
|
3842
3852
|
}
|
|
3843
3853
|
]
|
|
3844
3854
|
};
|
|
3845
|
-
return r.updateRule(
|
|
3855
|
+
return r.updateRule($, W);
|
|
3846
3856
|
});
|
|
3847
3857
|
await Promise.all(m), ge.success("Alert assignment saved");
|
|
3848
3858
|
try {
|
|
@@ -3867,149 +3877,149 @@ function On({ userRoles: e, rules: t, rawRules: s }) {
|
|
|
3867
3877
|
}
|
|
3868
3878
|
const { Title: is } = Ye;
|
|
3869
3879
|
function Pn({ severities: e, rules: t, userRoles: s, rawRules: r, onSave: n }) {
|
|
3870
|
-
const { rules: a, alerts: o } = Te(), [l, h] = w("By Severity"), [u, c] = w("By severity"), [S, f] = w("By Severity"), [R, N] = w(!1), [m, A] = w(!1), [
|
|
3871
|
-
|
|
3880
|
+
const { rules: a, alerts: o } = Te(), [l, h] = w("By Severity"), [u, c] = w("By severity"), [S, f] = w("By Severity"), [R, N] = w(!1), [m, A] = w(!1), [j, L] = w(!1), [$, O] = w(null), [Z, W] = w("rules"), [K, z] = w(), [I, T] = w(), [k, Y] = w(), [te, E] = w(), [v, p] = w(), [x, y] = w(), [b, g] = w(), [P, B] = w(), [M, U] = w([]), [q, V] = w([]), [ne, oe] = w(!1), [me, re] = w(!1), [le, Re] = w({}), [we, ot] = w({}), [je, Ue] = w(s || []), [ze, C] = w([]), [H, ie] = w(!1), [ke, X] = w(!1), [he, He] = w(r || []);
|
|
3881
|
+
de(() => {
|
|
3872
3882
|
r && r.length && He(r);
|
|
3873
|
-
}, [r]),
|
|
3883
|
+
}, [r]), de(() => {
|
|
3874
3884
|
if (!he || !he.length) return;
|
|
3875
|
-
const
|
|
3876
|
-
if (ze.length && !
|
|
3877
|
-
const ee = he.map((
|
|
3878
|
-
const
|
|
3885
|
+
const D = Object.keys(le).length > 0 || Object.keys(we).length > 0;
|
|
3886
|
+
if (ze.length && !D) return;
|
|
3887
|
+
const ee = he.map((_, F) => {
|
|
3888
|
+
const J = t.find((pe) => pe.RuleId === (_.ruleId || _.ruleName))?.Name || _.ruleName || _.Name || "-", Q = _.escalationSettings || {}, se = typeof Q.level1UserRoleId == "number" && Q.level1UserRoleId > 0 ? [Q.level1UserRoleId] : [], Ee = typeof Q.level2UserRoleId == "number" && Q.level2UserRoleId > 0 ? [Q.level2UserRoleId] : [], ct = typeof Q.level3UserRoleId == "number" && Q.level3UserRoleId > 0 ? [Q.level3UserRoleId] : [], Ft = (Array.isArray(Q.escalationSettingsActionTypeIds) ? Q.escalationSettingsActionTypeIds : []).map((pe) => le[pe] || String(pe)), Lt = (Array.isArray(Q.thirdPartyId) ? Q.thirdPartyId : []).map((pe) => we[pe] || String(pe)), ut = typeof Q.humanLoop == "boolean" ? Q.humanLoop : null, dt = typeof Q.isAutoExpire == "boolean" ? Q.isAutoExpire : null;
|
|
3879
3889
|
return {
|
|
3880
|
-
id: String(
|
|
3881
|
-
ruleOrSeverityLabel:
|
|
3890
|
+
id: String(_.ruleId || _.ruleName || F),
|
|
3891
|
+
ruleOrSeverityLabel: J,
|
|
3882
3892
|
l1: { minutes: Q.level1PostAssistTime ?? void 0, roles: se },
|
|
3883
3893
|
l2: { minutes: Q.level2PostAssistTime ?? void 0, roles: Ee },
|
|
3884
|
-
l3: { minutes: Q.level3PostAssistTime ?? void 0, roles:
|
|
3894
|
+
l3: { minutes: Q.level3PostAssistTime ?? void 0, roles: ct },
|
|
3885
3895
|
actions: Ft,
|
|
3886
3896
|
notify: Lt,
|
|
3887
|
-
humanLoop:
|
|
3888
|
-
isAutoExpire:
|
|
3897
|
+
humanLoop: ut,
|
|
3898
|
+
isAutoExpire: dt
|
|
3889
3899
|
};
|
|
3890
3900
|
});
|
|
3891
3901
|
C(ee);
|
|
3892
|
-
}, [he, t,
|
|
3893
|
-
const be =
|
|
3894
|
-
() => e.map((
|
|
3902
|
+
}, [he, t, le, we]);
|
|
3903
|
+
const be = ue(
|
|
3904
|
+
() => e.map((D) => ({ label: D.DisplayName, value: D.SeverityId })),
|
|
3895
3905
|
[e]
|
|
3896
|
-
),
|
|
3897
|
-
() => t.map((
|
|
3906
|
+
), lt = ue(
|
|
3907
|
+
() => t.map((D) => ({ label: D.Name, value: D.RuleId })),
|
|
3898
3908
|
[t]
|
|
3899
|
-
), ks =
|
|
3900
|
-
() => je.map((
|
|
3909
|
+
), ks = ue(
|
|
3910
|
+
() => je.map((D) => ({ label: D.userRoleName, value: D.userRoleId })),
|
|
3901
3911
|
[je]
|
|
3902
|
-
), Es =
|
|
3903
|
-
|
|
3904
|
-
let
|
|
3912
|
+
), Es = ue(() => [1, 3, 5, 10, 15, 20, 30, 45, 60].map((D) => ({ label: `${D}`, value: D })), []);
|
|
3913
|
+
de(() => {
|
|
3914
|
+
let D = !1;
|
|
3905
3915
|
async function ee() {
|
|
3906
3916
|
try {
|
|
3907
|
-
|
|
3908
|
-
const
|
|
3909
|
-
if (!
|
|
3910
|
-
const
|
|
3911
|
-
h(
|
|
3917
|
+
L(!0), O(null);
|
|
3918
|
+
const _ = await o.getAdminSettings();
|
|
3919
|
+
if (!D && _) {
|
|
3920
|
+
const F = ds(_.sortBy);
|
|
3921
|
+
h(F), f(F), N(!1);
|
|
3912
3922
|
}
|
|
3913
|
-
} catch (
|
|
3914
|
-
if (!
|
|
3915
|
-
const
|
|
3916
|
-
|
|
3923
|
+
} catch (_) {
|
|
3924
|
+
if (!D) {
|
|
3925
|
+
const F = _ instanceof Error ? _.message : "Failed to load admin settings";
|
|
3926
|
+
O(F);
|
|
3917
3927
|
}
|
|
3918
3928
|
} finally {
|
|
3919
|
-
|
|
3929
|
+
D || L(!1);
|
|
3920
3930
|
}
|
|
3921
3931
|
}
|
|
3922
3932
|
return ee(), () => {
|
|
3923
|
-
|
|
3933
|
+
D = !0;
|
|
3924
3934
|
};
|
|
3925
|
-
}, []),
|
|
3926
|
-
if (!
|
|
3927
|
-
const
|
|
3928
|
-
const Q = Number(
|
|
3935
|
+
}, []), de(() => {
|
|
3936
|
+
if (!I) return;
|
|
3937
|
+
const D = (J) => {
|
|
3938
|
+
const Q = Number(J);
|
|
3929
3939
|
return !isNaN(Q) && Q > 0 ? Q : void 0;
|
|
3930
|
-
}, ee = (
|
|
3931
|
-
const Q = Number(
|
|
3940
|
+
}, ee = (J) => {
|
|
3941
|
+
const Q = Number(J);
|
|
3932
3942
|
return !isNaN(Q) && Q > 0 ? Q : void 0;
|
|
3933
|
-
},
|
|
3934
|
-
(
|
|
3943
|
+
}, F = (he || []).find(
|
|
3944
|
+
(J) => J?.ruleId === I || J?.ruleName === I || J?.RuleId === I
|
|
3935
3945
|
)?.escalationSettings;
|
|
3936
|
-
if (
|
|
3937
|
-
|
|
3938
|
-
const
|
|
3939
|
-
|
|
3946
|
+
if (F && typeof F == "object") {
|
|
3947
|
+
Y(ee(F.level1PostAssistTime)), E(D(F.level1UserRoleId)), p(ee(F.level2PostAssistTime)), y(D(F.level2UserRoleId)), g(ee(F.level3PostAssistTime)), B(D(F.level3UserRoleId));
|
|
3948
|
+
const J = Array.isArray(F.escalationSettingsActionTypeIds) ? F.escalationSettingsActionTypeIds : [];
|
|
3949
|
+
U(J.map((Q) => String(Q))), V(Array.isArray(F.thirdPartyId) ? F.thirdPartyId : []), oe(!!F.humanLoop), re(!!F.isAutoExpire);
|
|
3940
3950
|
}
|
|
3941
|
-
}, [
|
|
3951
|
+
}, [Z, I, he]);
|
|
3942
3952
|
const Os = async () => {
|
|
3943
3953
|
try {
|
|
3944
3954
|
X(!0);
|
|
3945
|
-
const
|
|
3955
|
+
const D = await a.getRules(), ee = Array.isArray(D) ? D : Array.isArray(D?.data) ? D.data : [];
|
|
3946
3956
|
He(ee);
|
|
3947
|
-
const
|
|
3948
|
-
const Q = t.find((pe) => pe.RuleId === (
|
|
3957
|
+
const _ = ee.map((F, J) => {
|
|
3958
|
+
const Q = t.find((pe) => pe.RuleId === (F.ruleId || F.ruleName))?.Name || F.ruleName || F.Name || "-", se = F.escalationSettings || {}, Ee = typeof se.level1UserRoleId == "number" && se.level1UserRoleId > 0 ? [se.level1UserRoleId] : [], ct = typeof se.level2UserRoleId == "number" && se.level2UserRoleId > 0 ? [se.level2UserRoleId] : [], Dt = typeof se.level3UserRoleId == "number" && se.level3UserRoleId > 0 ? [se.level3UserRoleId] : [], Ut = (Array.isArray(se.escalationSettingsActionTypeIds) ? se.escalationSettingsActionTypeIds : []).map((pe) => le[pe] || String(pe)), ut = (Array.isArray(se.thirdPartyId) ? se.thirdPartyId : []).map((pe) => we[pe] || String(pe)), dt = typeof se.humanLoop == "boolean" ? se.humanLoop : null;
|
|
3949
3959
|
return {
|
|
3950
|
-
id: String(
|
|
3960
|
+
id: String(F.ruleId || F.ruleName || J),
|
|
3951
3961
|
ruleOrSeverityLabel: Q,
|
|
3952
3962
|
l1: { minutes: se.level1PostAssistTime ?? void 0, roles: Ee },
|
|
3953
|
-
l2: { minutes: se.level2PostAssistTime ?? void 0, roles:
|
|
3963
|
+
l2: { minutes: se.level2PostAssistTime ?? void 0, roles: ct },
|
|
3954
3964
|
l3: { minutes: se.level3PostAssistTime ?? void 0, roles: Dt },
|
|
3955
3965
|
actions: Ut,
|
|
3956
|
-
notify:
|
|
3957
|
-
humanLoop:
|
|
3966
|
+
notify: ut,
|
|
3967
|
+
humanLoop: dt
|
|
3958
3968
|
};
|
|
3959
3969
|
});
|
|
3960
|
-
C(
|
|
3961
|
-
} catch (
|
|
3962
|
-
console.error("Failed to refetch entries",
|
|
3970
|
+
C(_);
|
|
3971
|
+
} catch (D) {
|
|
3972
|
+
console.error("Failed to refetch entries", D);
|
|
3963
3973
|
} finally {
|
|
3964
3974
|
X(!1);
|
|
3965
3975
|
}
|
|
3966
3976
|
};
|
|
3967
|
-
return
|
|
3968
|
-
let
|
|
3977
|
+
return de(() => {
|
|
3978
|
+
let D = !1;
|
|
3969
3979
|
return (async () => {
|
|
3970
3980
|
try {
|
|
3971
3981
|
const ee = await a.getLookups();
|
|
3972
|
-
if (
|
|
3973
|
-
const
|
|
3982
|
+
if (D || !ee) return;
|
|
3983
|
+
const _ = {};
|
|
3974
3984
|
if (Array.isArray(ee.thirdParties))
|
|
3975
|
-
for (const
|
|
3976
|
-
typeof
|
|
3977
|
-
|
|
3978
|
-
const
|
|
3979
|
-
userRoleId:
|
|
3980
|
-
userRoleName:
|
|
3985
|
+
for (const J of ee.thirdParties)
|
|
3986
|
+
typeof J.thirdPartyId == "number" && (_[J.thirdPartyId] = J.thirdPartyName);
|
|
3987
|
+
ot(_);
|
|
3988
|
+
const F = Array.isArray(ee.userRoles) ? ee.userRoles.map((J) => ({
|
|
3989
|
+
userRoleId: J.userRoleId ?? J.id,
|
|
3990
|
+
userRoleName: J.userRoleName ?? J.name
|
|
3981
3991
|
})) : [];
|
|
3982
|
-
|
|
3992
|
+
D || Ue(F.length ? F : s || []);
|
|
3983
3993
|
} catch (ee) {
|
|
3984
3994
|
console.error("Error loading lookups", ee);
|
|
3985
3995
|
}
|
|
3986
3996
|
})(), () => {
|
|
3987
|
-
|
|
3997
|
+
D = !0;
|
|
3988
3998
|
};
|
|
3989
3999
|
}, []), /* @__PURE__ */ d("div", { className: "w-full", children: [
|
|
3990
4000
|
/* @__PURE__ */ d("div", { className: "mb-6", children: [
|
|
3991
4001
|
/* @__PURE__ */ i(is, { level: 4, className: "!mb-2", children: "Admin Settings" }),
|
|
3992
|
-
/* @__PURE__ */ d(
|
|
3993
|
-
|
|
4002
|
+
/* @__PURE__ */ d(Ct, { spinning: j, children: [
|
|
4003
|
+
$ ? /* @__PURE__ */ d("div", { className: "text-sm text-red-600 mb-2", children: [
|
|
3994
4004
|
"Failed to load settings: ",
|
|
3995
|
-
|
|
4005
|
+
$
|
|
3996
4006
|
] }) : null,
|
|
3997
4007
|
/* @__PURE__ */ i(
|
|
3998
|
-
|
|
4008
|
+
In,
|
|
3999
4009
|
{
|
|
4000
4010
|
sortBy: l,
|
|
4001
4011
|
groupBy: u,
|
|
4002
|
-
onChange: (
|
|
4003
|
-
|
|
4012
|
+
onChange: (D) => {
|
|
4013
|
+
D.sortBy && (h(D.sortBy), N(!0)), D.groupBy && (c(D.groupBy), N(!0));
|
|
4004
4014
|
},
|
|
4005
4015
|
showActions: R,
|
|
4006
4016
|
onSave: async () => {
|
|
4007
4017
|
A(!0);
|
|
4008
4018
|
try {
|
|
4009
|
-
const
|
|
4010
|
-
|
|
4011
|
-
} catch (
|
|
4012
|
-
console.error("Error saving admin settings",
|
|
4019
|
+
const D = await o.setAdminSettings({ sortBy: l, groupBy: "string" });
|
|
4020
|
+
D?.responseStatus && D?.data && ge.success(D.data), f(l), N(!1);
|
|
4021
|
+
} catch (D) {
|
|
4022
|
+
console.error("Error saving admin settings", D);
|
|
4013
4023
|
} finally {
|
|
4014
4024
|
A(!1);
|
|
4015
4025
|
}
|
|
@@ -4028,18 +4038,18 @@ function Pn({ severities: e, rules: t, userRoles: s, rawRules: r, onSave: n }) {
|
|
|
4028
4038
|
/* @__PURE__ */ i(
|
|
4029
4039
|
Rn,
|
|
4030
4040
|
{
|
|
4031
|
-
escBasis:
|
|
4032
|
-
setEscBasis:
|
|
4033
|
-
selectedSeverity:
|
|
4034
|
-
setSelectedSeverity:
|
|
4035
|
-
selectedRule:
|
|
4036
|
-
setSelectedRule:
|
|
4041
|
+
escBasis: Z,
|
|
4042
|
+
setEscBasis: W,
|
|
4043
|
+
selectedSeverity: K,
|
|
4044
|
+
setSelectedSeverity: z,
|
|
4045
|
+
selectedRule: I,
|
|
4046
|
+
setSelectedRule: T,
|
|
4037
4047
|
severityOptions: be,
|
|
4038
|
-
ruleOptions:
|
|
4048
|
+
ruleOptions: lt,
|
|
4039
4049
|
minsOptions: Es,
|
|
4040
4050
|
roleOptions: ks,
|
|
4041
4051
|
l1mins: k,
|
|
4042
|
-
setL1mins:
|
|
4052
|
+
setL1mins: Y,
|
|
4043
4053
|
l1role: te,
|
|
4044
4054
|
setL1role: E,
|
|
4045
4055
|
l2mins: v,
|
|
@@ -4048,41 +4058,41 @@ function Pn({ severities: e, rules: t, userRoles: s, rawRules: r, onSave: n }) {
|
|
|
4048
4058
|
setL2role: y,
|
|
4049
4059
|
l3mins: b,
|
|
4050
4060
|
setL3mins: g,
|
|
4051
|
-
l3role:
|
|
4052
|
-
setL3role:
|
|
4053
|
-
actions:
|
|
4054
|
-
setActions:
|
|
4055
|
-
thirdPartyIds:
|
|
4056
|
-
setThirdPartyIds:
|
|
4061
|
+
l3role: P,
|
|
4062
|
+
setL3role: B,
|
|
4063
|
+
actions: M,
|
|
4064
|
+
setActions: U,
|
|
4065
|
+
thirdPartyIds: q,
|
|
4066
|
+
setThirdPartyIds: V,
|
|
4057
4067
|
humanLoop: ne,
|
|
4058
|
-
setHumanLoop:
|
|
4068
|
+
setHumanLoop: oe,
|
|
4059
4069
|
onClear: () => {
|
|
4060
|
-
h("By Severity"), c("By severity"),
|
|
4070
|
+
h("By Severity"), c("By severity"), W("rules"), z(void 0), T(void 0), Y(void 0), E(void 0), p(void 0), y(void 0), g(void 0), B(void 0), U([]), V([]), oe(!1), re(!1);
|
|
4061
4071
|
},
|
|
4062
4072
|
onSave: async () => {
|
|
4063
4073
|
ie(!0), n?.({
|
|
4064
|
-
ruleId:
|
|
4074
|
+
ruleId: I,
|
|
4065
4075
|
levels: [
|
|
4066
4076
|
{ minutes: k, role: te },
|
|
4067
4077
|
{ minutes: v, role: x },
|
|
4068
|
-
{ minutes: b, role:
|
|
4078
|
+
{ minutes: b, role: P }
|
|
4069
4079
|
],
|
|
4070
|
-
actions:
|
|
4071
|
-
thirdPartyIds:
|
|
4080
|
+
actions: M,
|
|
4081
|
+
thirdPartyIds: q,
|
|
4072
4082
|
humanLoop: ne,
|
|
4073
4083
|
isAutoExpire: me
|
|
4074
4084
|
});
|
|
4075
4085
|
try {
|
|
4076
|
-
if (
|
|
4077
|
-
const
|
|
4078
|
-
(Ee) => Ee?.ruleId ===
|
|
4079
|
-
),
|
|
4080
|
-
if (!
|
|
4086
|
+
if (I) {
|
|
4087
|
+
const _ = Array.isArray(M) ? M.map((Ee) => Number(Ee)) : [], F = (he || []).find(
|
|
4088
|
+
(Ee) => Ee?.ruleId === I || Ee?.ruleName === I || Ee?.RuleId === I
|
|
4089
|
+
), J = typeof F?.recordId == "number" ? F.recordId : void 0;
|
|
4090
|
+
if (!F || typeof J != "number") {
|
|
4081
4091
|
ge.error("Unable to find rule recordId for update");
|
|
4082
4092
|
return;
|
|
4083
4093
|
}
|
|
4084
4094
|
const Q = {
|
|
4085
|
-
...
|
|
4095
|
+
...F,
|
|
4086
4096
|
actions: [
|
|
4087
4097
|
//this will definitely be remoed
|
|
4088
4098
|
{
|
|
@@ -4102,48 +4112,48 @@ function Pn({ severities: e, rules: t, userRoles: s, rawRules: r, onSave: n }) {
|
|
|
4102
4112
|
level1PostAssistTime: k ?? 0,
|
|
4103
4113
|
level2UserRoleId: x ?? 0,
|
|
4104
4114
|
level2PostAssistTime: v ?? 0,
|
|
4105
|
-
level3UserRoleId:
|
|
4115
|
+
level3UserRoleId: P ?? 0,
|
|
4106
4116
|
level3PostAssistTime: b ?? 0,
|
|
4107
|
-
escalationSettingsActionTypeIds:
|
|
4108
|
-
thirdPartyId: Array.isArray(
|
|
4117
|
+
escalationSettingsActionTypeIds: _,
|
|
4118
|
+
thirdPartyId: Array.isArray(q) ? q : [],
|
|
4109
4119
|
humanLoop: ne,
|
|
4110
4120
|
isAutoExpire: me
|
|
4111
4121
|
}
|
|
4112
|
-
}, se = await a.updateRule(
|
|
4122
|
+
}, se = await a.updateRule(J, Q);
|
|
4113
4123
|
if (se?.responseStatus || se?.ok || se) {
|
|
4114
|
-
ge.success("Escalation settings saved"), await Os(),
|
|
4124
|
+
ge.success("Escalation settings saved"), await Os(), T(void 0), Y(void 0), E(void 0), p(void 0), y(void 0), g(void 0), B(void 0), U([]), V([]), oe(!1), re(!1);
|
|
4115
4125
|
return;
|
|
4116
4126
|
}
|
|
4117
4127
|
}
|
|
4118
|
-
} catch (
|
|
4119
|
-
console.error("Error saving escalation settings",
|
|
4128
|
+
} catch (_) {
|
|
4129
|
+
console.error("Error saving escalation settings", _);
|
|
4120
4130
|
} finally {
|
|
4121
4131
|
ie(!1);
|
|
4122
4132
|
}
|
|
4123
|
-
const ee = t.find((
|
|
4124
|
-
C((
|
|
4125
|
-
...
|
|
4133
|
+
const ee = t.find((_) => _.RuleId === I)?.Name || "-";
|
|
4134
|
+
C((_) => [
|
|
4135
|
+
..._,
|
|
4126
4136
|
{
|
|
4127
4137
|
id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
4128
4138
|
ruleOrSeverityLabel: ee,
|
|
4129
4139
|
l1: { minutes: k, roles: te ? [te] : [] },
|
|
4130
4140
|
l2: { minutes: v, roles: x ? [x] : [] },
|
|
4131
|
-
l3: { minutes: b, roles:
|
|
4132
|
-
actions: (Array.isArray(
|
|
4133
|
-
const
|
|
4134
|
-
return
|
|
4141
|
+
l3: { minutes: b, roles: P ? [P] : [] },
|
|
4142
|
+
actions: (Array.isArray(M) ? M : []).map((F) => {
|
|
4143
|
+
const J = Number(F);
|
|
4144
|
+
return le[J] || String(F);
|
|
4135
4145
|
}),
|
|
4136
|
-
notify: (Array.isArray(
|
|
4146
|
+
notify: (Array.isArray(q) ? q : []).map((F) => we[F] || String(F)),
|
|
4137
4147
|
humanLoop: !!ne,
|
|
4138
4148
|
isAutoExpire: !!me
|
|
4139
4149
|
}
|
|
4140
4150
|
]);
|
|
4141
4151
|
},
|
|
4142
4152
|
saving: H,
|
|
4143
|
-
onActionTypesLoaded: (
|
|
4153
|
+
onActionTypesLoaded: (D) => {
|
|
4144
4154
|
const ee = {};
|
|
4145
|
-
for (const
|
|
4146
|
-
typeof
|
|
4155
|
+
for (const _ of D)
|
|
4156
|
+
typeof _.actionTypeId == "number" && (ee[_.actionTypeId] = _.name);
|
|
4147
4157
|
Re(ee);
|
|
4148
4158
|
},
|
|
4149
4159
|
isAutoExpire: me,
|
|
@@ -4158,10 +4168,10 @@ function Pn({ severities: e, rules: t, userRoles: s, rawRules: r, onSave: n }) {
|
|
|
4158
4168
|
entries: ze,
|
|
4159
4169
|
userRoles: je,
|
|
4160
4170
|
loading: ke,
|
|
4161
|
-
onEdit: (
|
|
4162
|
-
|
|
4163
|
-
const ee = ze.find((
|
|
4164
|
-
|
|
4171
|
+
onEdit: (D) => {
|
|
4172
|
+
W("rules");
|
|
4173
|
+
const ee = ze.find((F) => F.id === D), _ = t.find((F) => F.RuleId === D) || (ee ? t.find((F) => F.Name === ee.ruleOrSeverityLabel) : void 0);
|
|
4174
|
+
T(_ ? _.RuleId : D);
|
|
4165
4175
|
}
|
|
4166
4176
|
}
|
|
4167
4177
|
),
|
|
@@ -4175,51 +4185,51 @@ function Mn({ severities: e, rules: t, onSave: s, onCancel: r }) {
|
|
|
4175
4185
|
const { rules: n, alerts: a } = Te(), o = [
|
|
4176
4186
|
{ label: "By Severity", value: "By Severity" },
|
|
4177
4187
|
{ label: "By Created Date", value: "By Created Date" }
|
|
4178
|
-
], [l, h] = w("By Severity"), [u, c] = w(/* @__PURE__ */ new Set()), [S, f] = w(null), [R, N] = w(null), [m, A] = w({ inApp: !1, sms: !1, email: !1 }), [
|
|
4179
|
-
|
|
4180
|
-
let
|
|
4188
|
+
], [l, h] = w("By Severity"), [u, c] = w(/* @__PURE__ */ new Set()), [S, f] = w(null), [R, N] = w(null), [m, A] = w({ inApp: !1, sms: !1, email: !1 }), [j, L] = w([]), [$, O] = w(!0), [Z, W] = w(!1);
|
|
4189
|
+
de(() => {
|
|
4190
|
+
let I = !1;
|
|
4181
4191
|
return (async () => {
|
|
4182
4192
|
try {
|
|
4183
|
-
const
|
|
4184
|
-
if (
|
|
4193
|
+
const T = await a.getPreferenceSettings();
|
|
4194
|
+
if (I || !T) return;
|
|
4185
4195
|
A({
|
|
4186
|
-
inApp: !!
|
|
4196
|
+
inApp: !!T.inApp,
|
|
4187
4197
|
//convert to bool - as the resp is str
|
|
4188
|
-
sms: !!
|
|
4189
|
-
email: !!
|
|
4198
|
+
sms: !!T.sms,
|
|
4199
|
+
email: !!T.email
|
|
4190
4200
|
});
|
|
4191
|
-
const k = ds(
|
|
4192
|
-
h(k === "By Created Date" ? "By Created Date" : "By Severity"), f(Ht(
|
|
4193
|
-
} catch (
|
|
4194
|
-
console.error("Error in loading my preferences: ",
|
|
4201
|
+
const k = ds(T.sortBy);
|
|
4202
|
+
h(k === "By Created Date" ? "By Created Date" : "By Severity"), f(Ht(T.doNotDisturbStart)), N(Ht(T.doNotDisturbEnd)), Array.isArray(T.anomalyIds) && c(new Set(T.anomalyIds.map((Y) => String(Y))));
|
|
4203
|
+
} catch (T) {
|
|
4204
|
+
console.error("Error in loading my preferences: ", T);
|
|
4195
4205
|
}
|
|
4196
4206
|
})(), () => {
|
|
4197
|
-
|
|
4207
|
+
I = !0;
|
|
4198
4208
|
};
|
|
4199
|
-
}, []),
|
|
4200
|
-
let
|
|
4209
|
+
}, []), de(() => {
|
|
4210
|
+
let I = !1;
|
|
4201
4211
|
return (async () => {
|
|
4202
4212
|
try {
|
|
4203
|
-
|
|
4204
|
-
const
|
|
4205
|
-
if (
|
|
4206
|
-
const k = Array.isArray(
|
|
4207
|
-
|
|
4208
|
-
} catch (
|
|
4209
|
-
console.error("Failed to load anomalies lookups",
|
|
4213
|
+
O(!0);
|
|
4214
|
+
const T = await n.getLookups();
|
|
4215
|
+
if (I || !T) return;
|
|
4216
|
+
const k = Array.isArray(T.anomalies) ? T.anomalies : [];
|
|
4217
|
+
L(k);
|
|
4218
|
+
} catch (T) {
|
|
4219
|
+
console.error("Failed to load anomalies lookups", T);
|
|
4210
4220
|
} finally {
|
|
4211
|
-
|
|
4221
|
+
I || O(!1);
|
|
4212
4222
|
}
|
|
4213
4223
|
})(), () => {
|
|
4214
|
-
|
|
4224
|
+
I = !0;
|
|
4215
4225
|
};
|
|
4216
4226
|
}, []);
|
|
4217
|
-
const
|
|
4218
|
-
c((
|
|
4219
|
-
const k = new Set(
|
|
4220
|
-
return k.has(
|
|
4227
|
+
const K = (I) => {
|
|
4228
|
+
c((T) => {
|
|
4229
|
+
const k = new Set(T);
|
|
4230
|
+
return k.has(I) ? k.delete(I) : k.add(I), k;
|
|
4221
4231
|
});
|
|
4222
|
-
},
|
|
4232
|
+
}, z = async () => {
|
|
4223
4233
|
s?.({
|
|
4224
4234
|
sortBy: l,
|
|
4225
4235
|
subscribedRuleIds: Array.from(u),
|
|
@@ -4230,21 +4240,21 @@ function Mn({ severities: e, rules: t, onSave: s, onCancel: r }) {
|
|
|
4230
4240
|
channels: m
|
|
4231
4241
|
});
|
|
4232
4242
|
try {
|
|
4233
|
-
|
|
4234
|
-
const
|
|
4243
|
+
W(!0);
|
|
4244
|
+
const I = S ? S.format?.("HH:mm:ss") ?? "00:00:00" : "00:00:00", T = R ? R.format?.("HH:mm:ss") ?? "00:00:00" : "00:00:00", k = Array.from(u).map((te) => Number(te)).filter((te) => Number.isFinite(te)), Y = await a.setPreferenceSettings({
|
|
4235
4245
|
anomalyIds: k,
|
|
4236
|
-
doNotDisturbStart:
|
|
4237
|
-
doNotDisturbEnd:
|
|
4246
|
+
doNotDisturbStart: I,
|
|
4247
|
+
doNotDisturbEnd: T,
|
|
4238
4248
|
inApp: !!m.inApp,
|
|
4239
4249
|
sms: !!m.sms,
|
|
4240
4250
|
email: !!m.email,
|
|
4241
4251
|
sortBy: l
|
|
4242
4252
|
});
|
|
4243
|
-
|
|
4244
|
-
} catch (
|
|
4245
|
-
console.error("Error in saving my preferences: ",
|
|
4253
|
+
Y?.responseStatus && ge.success(Y?.data || "Preferences updated successfully.");
|
|
4254
|
+
} catch (I) {
|
|
4255
|
+
console.error("Error in saving my preferences: ", I);
|
|
4246
4256
|
} finally {
|
|
4247
|
-
|
|
4257
|
+
W(!1);
|
|
4248
4258
|
}
|
|
4249
4259
|
};
|
|
4250
4260
|
return /* @__PURE__ */ d("div", { className: "w-full", children: [
|
|
@@ -4254,9 +4264,9 @@ function Mn({ severities: e, rules: t, onSave: s, onCancel: r }) {
|
|
|
4254
4264
|
] }) }) }),
|
|
4255
4265
|
/* @__PURE__ */ d("div", { className: "mb-4", children: [
|
|
4256
4266
|
/* @__PURE__ */ i(as, { level: 5, className: "!mb-2", children: "Anomalies" }),
|
|
4257
|
-
|
|
4258
|
-
const
|
|
4259
|
-
return /* @__PURE__ */ i(
|
|
4267
|
+
$ ? /* @__PURE__ */ i("div", { className: "py-4", children: /* @__PURE__ */ i(Ct, {}) }) : /* @__PURE__ */ i(Ie, { direction: "vertical", size: 10, className: "w-full", children: (Array.isArray(j) ? j : []).map((I) => {
|
|
4268
|
+
const T = String(I.recordId), k = I.anomalyName;
|
|
4269
|
+
return /* @__PURE__ */ i(_e, { checked: u.has(T), onChange: () => K(T), children: k }, T);
|
|
4260
4270
|
}) })
|
|
4261
4271
|
] }),
|
|
4262
4272
|
/* @__PURE__ */ d("div", { className: "mb-4", children: [
|
|
@@ -4266,24 +4276,24 @@ function Mn({ severities: e, rules: t, onSave: s, onCancel: r }) {
|
|
|
4266
4276
|
/* @__PURE__ */ d(Ie, { size: 12, className: "w-full", children: [
|
|
4267
4277
|
/* @__PURE__ */ d(Ie, { direction: "horizontal", size: 8, className: "items-center", children: [
|
|
4268
4278
|
/* @__PURE__ */ i(et, { children: "From" }),
|
|
4269
|
-
/* @__PURE__ */ i($t, { value: S, onChange: (
|
|
4279
|
+
/* @__PURE__ */ i($t, { value: S, onChange: (I) => f(I), format: "HH:mm" })
|
|
4270
4280
|
] }),
|
|
4271
4281
|
/* @__PURE__ */ d(Ie, { direction: "horizontal", size: 8, className: "items-center", children: [
|
|
4272
4282
|
/* @__PURE__ */ i(et, { children: "To" }),
|
|
4273
|
-
/* @__PURE__ */ i($t, { value: R, onChange: (
|
|
4283
|
+
/* @__PURE__ */ i($t, { value: R, onChange: (I) => N(I), format: "HH:mm" })
|
|
4274
4284
|
] })
|
|
4275
4285
|
] })
|
|
4276
4286
|
] }) }) }),
|
|
4277
4287
|
/* @__PURE__ */ d(Ae, { gutter: [24, 12], children: [
|
|
4278
|
-
/* @__PURE__ */ i(G, { children: /* @__PURE__ */ i(
|
|
4279
|
-
/* @__PURE__ */ i(G, { children: /* @__PURE__ */ i(
|
|
4280
|
-
/* @__PURE__ */ i(G, { children: /* @__PURE__ */ i(
|
|
4288
|
+
/* @__PURE__ */ i(G, { children: /* @__PURE__ */ i(_e, { checked: m.inApp, onChange: (I) => A({ ...m, inApp: I.target.checked }), children: "In-app" }) }),
|
|
4289
|
+
/* @__PURE__ */ i(G, { children: /* @__PURE__ */ i(_e, { checked: m.sms, onChange: (I) => A({ ...m, sms: I.target.checked }), children: "SMS" }) }),
|
|
4290
|
+
/* @__PURE__ */ i(G, { children: /* @__PURE__ */ i(_e, { checked: m.email, onChange: (I) => A({ ...m, email: I.target.checked }), children: "Email" }) })
|
|
4281
4291
|
] })
|
|
4282
4292
|
] }),
|
|
4283
4293
|
/* @__PURE__ */ i(Ge, {}),
|
|
4284
4294
|
/* @__PURE__ */ d(Ie, { className: "gap-3", children: [
|
|
4285
|
-
/* @__PURE__ */ i(Se, { onClick: r, disabled:
|
|
4286
|
-
/* @__PURE__ */ i(Se, { type: "primary", onClick:
|
|
4295
|
+
/* @__PURE__ */ i(Se, { onClick: r, disabled: Z, children: "Cancel" }),
|
|
4296
|
+
/* @__PURE__ */ i(Se, { type: "primary", onClick: z, loading: Z, children: "Save" })
|
|
4287
4297
|
] })
|
|
4288
4298
|
] });
|
|
4289
4299
|
}
|
|
@@ -4329,7 +4339,7 @@ function Ln(e) {
|
|
|
4329
4339
|
}
|
|
4330
4340
|
function $n({ data: e }) {
|
|
4331
4341
|
return /* @__PURE__ */ i("div", { className: "w-full", children: /* @__PURE__ */ i(
|
|
4332
|
-
|
|
4342
|
+
Tt,
|
|
4333
4343
|
{
|
|
4334
4344
|
type: "card",
|
|
4335
4345
|
items: [
|
|
@@ -4337,7 +4347,7 @@ function $n({ data: e }) {
|
|
|
4337
4347
|
key: "action",
|
|
4338
4348
|
label: "Action Taken",
|
|
4339
4349
|
children: /* @__PURE__ */ d("div", { className: "w-full", children: [
|
|
4340
|
-
/* @__PURE__ */ i(
|
|
4350
|
+
/* @__PURE__ */ i(ht, { className: "mb-4 rounded-md p-4", bordered: !0, children: /* @__PURE__ */ d("div", { className: "grid grid-cols-4 gap-6 text-xs", children: [
|
|
4341
4351
|
/* @__PURE__ */ d("div", { className: "flex flex-col gap-1", children: [
|
|
4342
4352
|
/* @__PURE__ */ i("span", { className: "text-gray-500", children: "Alert ID" }),
|
|
4343
4353
|
/* @__PURE__ */ i("span", { className: "text-black", children: e.summary.alertNumber })
|
|
@@ -4351,7 +4361,7 @@ function $n({ data: e }) {
|
|
|
4351
4361
|
/* @__PURE__ */ i("span", { className: "text-black", children: e.summary.location })
|
|
4352
4362
|
] })
|
|
4353
4363
|
] }) }),
|
|
4354
|
-
/* @__PURE__ */ d(
|
|
4364
|
+
/* @__PURE__ */ d(ht, { className: "rounded-md p-4", bordered: !0, children: [
|
|
4355
4365
|
/* @__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" }) }),
|
|
4356
4366
|
/* @__PURE__ */ i("div", { className: "mt-2", children: /* @__PURE__ */ i(
|
|
4357
4367
|
js,
|
|
@@ -4369,7 +4379,7 @@ function $n({ data: e }) {
|
|
|
4369
4379
|
key: "notification",
|
|
4370
4380
|
label: "Notification Sent",
|
|
4371
4381
|
children: /* @__PURE__ */ d("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
4372
|
-
(e.notifications || []).map((t, s) => /* @__PURE__ */ d(
|
|
4382
|
+
(e.notifications || []).map((t, s) => /* @__PURE__ */ d(ht, { className: "rounded-md p-4", bordered: !0, children: [
|
|
4373
4383
|
/* @__PURE__ */ d("div", { className: "flex items-start justify-between", children: [
|
|
4374
4384
|
/* @__PURE__ */ d("div", { className: "flex flex-col", children: [
|
|
4375
4385
|
/* @__PURE__ */ i("h4", { className: "text-sm text-black font-medium", children: t.channelLabel }),
|
|
@@ -4456,7 +4466,7 @@ const Bn = ({
|
|
|
4456
4466
|
location: r || "",
|
|
4457
4467
|
alertNumber: n ?? ""
|
|
4458
4468
|
}, h = a?.length ? a.map((c) => {
|
|
4459
|
-
const S = (c?.status || c?.eventStatus || "").toLowerCase() === "completed" ? "Completed" : "Inprogress", f = c?.createdDate ?
|
|
4469
|
+
const S = (c?.status || c?.eventStatus || "").toLowerCase() === "completed" ? "Completed" : "Inprogress", f = c?.createdDate ? Nt(c.createdDate) : c?.timestamp ? Nt(c.timestamp) : "";
|
|
4460
4470
|
return {
|
|
4461
4471
|
status: S,
|
|
4462
4472
|
title: c?.status || c?.eventStatus || "Status Update",
|
|
@@ -4470,13 +4480,13 @@ const Bn = ({
|
|
|
4470
4480
|
notifications: o ?? []
|
|
4471
4481
|
} });
|
|
4472
4482
|
};
|
|
4473
|
-
const jn = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(),
|
|
4483
|
+
const jn = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), qn = (e) => e.replace(
|
|
4474
4484
|
/^([A-Z])|[\s-_]+(\w)/g,
|
|
4475
4485
|
(t, s, r) => r ? r.toUpperCase() : s.toLowerCase()
|
|
4476
4486
|
), os = (e) => {
|
|
4477
|
-
const t =
|
|
4487
|
+
const t = qn(e);
|
|
4478
4488
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
4479
|
-
}, Cs = (...e) => e.filter((t, s, r) => !!t && t.trim() !== "" && r.indexOf(t) === s).join(" ").trim(),
|
|
4489
|
+
}, Cs = (...e) => e.filter((t, s, r) => !!t && t.trim() !== "" && r.indexOf(t) === s).join(" ").trim(), _n = (e) => {
|
|
4480
4490
|
for (const t in e)
|
|
4481
4491
|
if (t.startsWith("aria-") || t === "role" || t === "title")
|
|
4482
4492
|
return !0;
|
|
@@ -4502,7 +4512,7 @@ const Hn = ls(
|
|
|
4502
4512
|
children: a,
|
|
4503
4513
|
iconNode: o,
|
|
4504
4514
|
...l
|
|
4505
|
-
}, h) =>
|
|
4515
|
+
}, h) => pt(
|
|
4506
4516
|
"svg",
|
|
4507
4517
|
{
|
|
4508
4518
|
ref: h,
|
|
@@ -4512,18 +4522,18 @@ const Hn = ls(
|
|
|
4512
4522
|
stroke: e,
|
|
4513
4523
|
strokeWidth: r ? Number(s) * 24 / Number(t) : s,
|
|
4514
4524
|
className: Cs("lucide", n),
|
|
4515
|
-
...!a && !
|
|
4525
|
+
...!a && !_n(l) && { "aria-hidden": "true" },
|
|
4516
4526
|
...l
|
|
4517
4527
|
},
|
|
4518
4528
|
[
|
|
4519
|
-
...o.map(([u, c]) =>
|
|
4529
|
+
...o.map(([u, c]) => pt(u, c)),
|
|
4520
4530
|
...Array.isArray(a) ? a : [a]
|
|
4521
4531
|
]
|
|
4522
4532
|
)
|
|
4523
4533
|
);
|
|
4524
|
-
const
|
|
4534
|
+
const Ts = (e, t) => {
|
|
4525
4535
|
const s = ls(
|
|
4526
|
-
({ className: r, ...n }, a) =>
|
|
4536
|
+
({ className: r, ...n }, a) => pt(Hn, {
|
|
4527
4537
|
ref: a,
|
|
4528
4538
|
iconNode: t,
|
|
4529
4539
|
className: Cs(
|
|
@@ -4541,17 +4551,17 @@ const Gn = [
|
|
|
4541
4551
|
["path", { d: "m21 3-7 7", key: "1l2asr" }],
|
|
4542
4552
|
["path", { d: "m3 21 7-7", key: "tjx5ai" }],
|
|
4543
4553
|
["path", { d: "M9 21H3v-6", key: "wtvkvv" }]
|
|
4544
|
-
],
|
|
4554
|
+
], Is = Ts("maximize-2", Gn);
|
|
4545
4555
|
const Wn = [
|
|
4546
4556
|
["path", { d: "m14 10 7-7", key: "oa77jy" }],
|
|
4547
4557
|
["path", { d: "M20 10h-6V4", key: "mjg0md" }],
|
|
4548
4558
|
["path", { d: "m3 21 7-7", key: "tjx5ai" }],
|
|
4549
4559
|
["path", { d: "M4 14h6v6", key: "rmj7iw" }]
|
|
4550
|
-
], Kn =
|
|
4560
|
+
], Kn = Ts("minimize-2", Wn), Yn = ({ isOpen: e, onClose: t, src: s, type: r = "image" }) => {
|
|
4551
4561
|
const [n, a] = w(!1), [o, l] = w(!1);
|
|
4552
|
-
return
|
|
4562
|
+
return de(() => {
|
|
4553
4563
|
e && l(!1);
|
|
4554
|
-
}, [e, s]),
|
|
4564
|
+
}, [e, s]), de(() => {
|
|
4555
4565
|
e && (!s || o) && t();
|
|
4556
4566
|
}, [e, s, o, t]), e ? /* @__PURE__ */ i(
|
|
4557
4567
|
"div",
|
|
@@ -4601,7 +4611,7 @@ const Wn = [
|
|
|
4601
4611
|
{
|
|
4602
4612
|
onClick: () => a(!n),
|
|
4603
4613
|
className: "absolute bottom-3 right-3 text-white bg-black/50 rounded-full p-2 hover:bg-black/70",
|
|
4604
|
-
children: n ? /* @__PURE__ */ i(Kn, { size: 20 }) : /* @__PURE__ */ i(
|
|
4614
|
+
children: n ? /* @__PURE__ */ i(Kn, { size: 20 }) : /* @__PURE__ */ i(Is, { size: 20 })
|
|
4605
4615
|
}
|
|
4606
4616
|
)
|
|
4607
4617
|
]
|
|
@@ -4615,26 +4625,26 @@ function zn(e) {
|
|
|
4615
4625
|
const t = e.split("?")[0].toLowerCase();
|
|
4616
4626
|
return t.endsWith(".mp4") || t.endsWith(".webm") || t.endsWith(".ogg") || t.endsWith(".m3u8");
|
|
4617
4627
|
}
|
|
4618
|
-
function
|
|
4628
|
+
function mt(e) {
|
|
4619
4629
|
const t = (e?.mediaType || e?.type || "").toString().toLowerCase();
|
|
4620
4630
|
return t === "video" || t === "mp4" ? !0 : zn(e?.mediaUrl || e);
|
|
4621
4631
|
}
|
|
4622
|
-
function
|
|
4632
|
+
function Zn(e) {
|
|
4623
4633
|
const t = e;
|
|
4624
4634
|
return t ? Array.isArray(t) ? t : [t] : [];
|
|
4625
4635
|
}
|
|
4626
|
-
const
|
|
4636
|
+
const Vn = {
|
|
4627
4637
|
Critical: "#FF3B30",
|
|
4628
4638
|
High: "#FFB86A",
|
|
4629
4639
|
Medium: "#FFCC00",
|
|
4630
4640
|
Low: "#007AFF"
|
|
4631
|
-
},
|
|
4641
|
+
}, Jn = {
|
|
4632
4642
|
Critical: "#FFE2E2",
|
|
4633
4643
|
High: "#FF95004D",
|
|
4634
4644
|
Medium: "#FEF9C2",
|
|
4635
4645
|
Low: "#E0EDFF"
|
|
4636
4646
|
}, Xn = ({ isModalOpen: e, handleModalClose: t, selectedRow: s, fetchAlertLogs: r, alertStatusList: n = [], alertStatusLoading: a = !1, initialTab: o = "details", sourceTab: l }) => {
|
|
4637
|
-
const [h, u] = w(), [c, S] = w(""), [f, R] = w(!1), N = Fs(null), [m, A] = w("details"), [
|
|
4647
|
+
const [h, u] = w(), [c, S] = w(""), [f, R] = w(!1), N = Fs(null), [m, A] = w("details"), [j, L] = w(void 0), $ = xs(), { alerts: O } = Te(), [Z, W] = w(!1), [K, z] = w(void 0), [I, T] = w(void 0), [k, Y] = w({}), te = s?.originalData || {}, {
|
|
4638
4648
|
eventName: E,
|
|
4639
4649
|
alertId: v,
|
|
4640
4650
|
timestamp: p,
|
|
@@ -4642,23 +4652,23 @@ const Jn = {
|
|
|
4642
4652
|
spaceName: y,
|
|
4643
4653
|
assignTeam: b,
|
|
4644
4654
|
priority: g,
|
|
4645
|
-
statusType:
|
|
4646
|
-
id:
|
|
4647
|
-
alertDetails:
|
|
4648
|
-
statusHistory:
|
|
4649
|
-
mediaDetails:
|
|
4650
|
-
alertNumber:
|
|
4655
|
+
statusType: P,
|
|
4656
|
+
id: B,
|
|
4657
|
+
alertDetails: M,
|
|
4658
|
+
statusHistory: U,
|
|
4659
|
+
mediaDetails: q,
|
|
4660
|
+
alertNumber: V
|
|
4651
4661
|
} = te, ne = (C) => {
|
|
4652
4662
|
const H = String(C || "").toLowerCase();
|
|
4653
4663
|
return H === "delivered" || H === "sent" ? "Delivered" : H === "failed" ? "Failed" : "Queued";
|
|
4654
|
-
},
|
|
4664
|
+
}, oe = (C) => ({
|
|
4655
4665
|
name: C?.receipientName || C?.recipientName || "-",
|
|
4656
4666
|
role: C?.receipientRoleName || "",
|
|
4657
4667
|
phone: C?.receipentPhoneNumber || C?.recipientPhoneNumber || C?.receipientEmail || C?.recipientEmail || "",
|
|
4658
4668
|
status: ne(C?.messageStatus),
|
|
4659
4669
|
notificationReceipientType: C?.notificationReceipientType || ""
|
|
4660
4670
|
}), me = (C, H) => {
|
|
4661
|
-
const ie = H.map(
|
|
4671
|
+
const ie = H.map(oe), ke = ie.filter((be) => be.status === "Delivered").length, X = H.map((be) => be?.sentAt).filter(Boolean).sort((be, lt) => new Date(lt).getTime() - new Date(be).getTime())[0], he = H[0] || {}, He = [he?.severityName, he?.anomalyName].filter(Boolean).join(" - ") || `${C} Notification`;
|
|
4662
4672
|
return {
|
|
4663
4673
|
channelLabel: `${C} Notification`,
|
|
4664
4674
|
sentAt: X || "",
|
|
@@ -4674,59 +4684,59 @@ const Jn = {
|
|
|
4674
4684
|
const ke = String(ie?.notificationType || "Unknown"), X = H.get(ke) || [];
|
|
4675
4685
|
X.push(ie), H.set(ke, X);
|
|
4676
4686
|
}), Array.from(H.entries()).map(([ie, ke]) => me(ie, ke));
|
|
4677
|
-
},
|
|
4687
|
+
}, le = async (C) => {
|
|
4678
4688
|
try {
|
|
4679
|
-
const H = await
|
|
4680
|
-
|
|
4689
|
+
const H = await O.getAlertNotifications(C), ie = re(H);
|
|
4690
|
+
L(ie);
|
|
4681
4691
|
} catch {
|
|
4682
|
-
|
|
4692
|
+
L(void 0);
|
|
4683
4693
|
}
|
|
4684
4694
|
};
|
|
4685
|
-
|
|
4686
|
-
if (m !== "track" ||
|
|
4695
|
+
de(() => {
|
|
4696
|
+
if (m !== "track" || !B) return;
|
|
4687
4697
|
let C = !1;
|
|
4688
|
-
return
|
|
4689
|
-
C &&
|
|
4698
|
+
return le(B).then(() => {
|
|
4699
|
+
C && L(void 0);
|
|
4690
4700
|
}), () => {
|
|
4691
4701
|
C = !0;
|
|
4692
4702
|
};
|
|
4693
|
-
}, [m,
|
|
4703
|
+
}, [m, B]), de(() => {
|
|
4694
4704
|
e && A(o);
|
|
4695
4705
|
}, [e, o]);
|
|
4696
|
-
const we = l === "archived" || ["completed", "false positive"].includes(String(
|
|
4706
|
+
const we = l === "archived" || ["completed", "false positive"].includes(String(P || "").toLowerCase()), ot = (C) => {
|
|
4697
4707
|
const H = String(C?.value || "").toLowerCase(), ie = String(C?.statusName || "").toLowerCase();
|
|
4698
4708
|
return H.includes("reopen") || ie.includes("reopen");
|
|
4699
4709
|
}, je = (n || []).filter((C) => {
|
|
4700
|
-
const H =
|
|
4710
|
+
const H = ot(C);
|
|
4701
4711
|
return typeof l < "u" ? l === "archived" ? H : !H : we ? H : !H;
|
|
4702
|
-
}).map((C) => ({ value: C.value, label: C.statusName })), Ue =
|
|
4703
|
-
return
|
|
4712
|
+
}).map((C) => ({ value: C.value, label: C.statusName })), Ue = ue(() => Zn(q), [q]);
|
|
4713
|
+
return de(() => {
|
|
4704
4714
|
let C = !1;
|
|
4705
4715
|
const H = new AbortController(), ie = async (X) => {
|
|
4706
4716
|
if (X) {
|
|
4707
|
-
C ||
|
|
4717
|
+
C || Y((he) => ({ ...he, [X]: !1 }));
|
|
4708
4718
|
try {
|
|
4709
4719
|
const he = await fetch(X, { method: "HEAD", signal: H.signal });
|
|
4710
4720
|
if (he.ok) {
|
|
4711
|
-
C ||
|
|
4721
|
+
C || Y((be) => ({ ...be, [X]: !0 }));
|
|
4712
4722
|
return;
|
|
4713
4723
|
}
|
|
4714
4724
|
if (he.status === 404) {
|
|
4715
|
-
C ||
|
|
4725
|
+
C || Y((be) => ({ ...be, [X]: !1 }));
|
|
4716
4726
|
return;
|
|
4717
4727
|
}
|
|
4718
4728
|
if (!(await fetch(X, { method: "GET", signal: H.signal })).ok) throw new Error("Media not available");
|
|
4719
|
-
C ||
|
|
4729
|
+
C || Y((be) => ({ ...be, [X]: !0 }));
|
|
4720
4730
|
} catch {
|
|
4721
|
-
C ||
|
|
4731
|
+
C || Y((he) => ({ ...he, [X]: !1 }));
|
|
4722
4732
|
}
|
|
4723
4733
|
}
|
|
4724
4734
|
};
|
|
4725
|
-
return
|
|
4735
|
+
return Y({}), Ue.filter((X) => !mt(X)).map((X) => X?.mediaUrl || X).filter((X) => typeof X == "string" && X.length > 0).forEach((X) => ie(X)), () => {
|
|
4726
4736
|
C = !0, H.abort();
|
|
4727
4737
|
};
|
|
4728
4738
|
}, [Ue]), /* @__PURE__ */ i(
|
|
4729
|
-
|
|
4739
|
+
qs,
|
|
4730
4740
|
{
|
|
4731
4741
|
open: e,
|
|
4732
4742
|
onCancel: t,
|
|
@@ -4748,11 +4758,11 @@ const Jn = {
|
|
|
4748
4758
|
R(!0);
|
|
4749
4759
|
const C = {
|
|
4750
4760
|
alertUniqueId: v,
|
|
4751
|
-
alertId:
|
|
4761
|
+
alertId: B,
|
|
4752
4762
|
status: h ? String(h) : void 0,
|
|
4753
4763
|
notes: c.trim(),
|
|
4754
4764
|
modifiedBy: 0
|
|
4755
|
-
}, H = await
|
|
4765
|
+
}, H = await $.mutateAsync(C);
|
|
4756
4766
|
if (H?.responseStatus) {
|
|
4757
4767
|
const ie = H?.data || "Alert updated successfully.";
|
|
4758
4768
|
ge.success(ie, {
|
|
@@ -4777,7 +4787,7 @@ const Jn = {
|
|
|
4777
4787
|
)
|
|
4778
4788
|
] }) : null,
|
|
4779
4789
|
children: s && /* @__PURE__ */ i(
|
|
4780
|
-
|
|
4790
|
+
Tt,
|
|
4781
4791
|
{
|
|
4782
4792
|
activeKey: m,
|
|
4783
4793
|
onChange: (C) => A(C),
|
|
@@ -4788,17 +4798,17 @@ const Jn = {
|
|
|
4788
4798
|
children: /* @__PURE__ */ d("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
4789
4799
|
/* @__PURE__ */ d("div", { className: "flex flex-col gap-2", children: [
|
|
4790
4800
|
/* @__PURE__ */ i("div", { className: "text-sm font-bold", children: E || "Alert Event" }),
|
|
4791
|
-
|
|
4801
|
+
M?.firstName ? /* @__PURE__ */ d("div", { className: "text-sm text-gray-500", children: [
|
|
4792
4802
|
"Resident ID/Name: ",
|
|
4793
|
-
|
|
4803
|
+
M?.firstName,
|
|
4794
4804
|
" ",
|
|
4795
|
-
|
|
4805
|
+
M?.lastName || "",
|
|
4796
4806
|
" ",
|
|
4797
|
-
|
|
4807
|
+
M?.residentId || ""
|
|
4798
4808
|
] }) : null,
|
|
4799
4809
|
/* @__PURE__ */ d("div", { className: "text-sm text-gray-500", children: [
|
|
4800
4810
|
"Timestamp: ",
|
|
4801
|
-
|
|
4811
|
+
Nt(p)
|
|
4802
4812
|
] }),
|
|
4803
4813
|
/* @__PURE__ */ d("div", { className: "font-sm text-gray-500", children: [
|
|
4804
4814
|
/* @__PURE__ */ i("b", { className: "text-black text-sm/6", children: "Description:" }),
|
|
@@ -4819,8 +4829,8 @@ const Jn = {
|
|
|
4819
4829
|
{
|
|
4820
4830
|
className: "font-sm text-gray-500 rounded-[8px] py-2 px-3",
|
|
4821
4831
|
style: {
|
|
4822
|
-
border: `2px solid ${
|
|
4823
|
-
backgroundColor:
|
|
4832
|
+
border: `2px solid ${Vn[String(g)] || "#DFE4EA"}`,
|
|
4833
|
+
backgroundColor: Jn[String(g)]
|
|
4824
4834
|
},
|
|
4825
4835
|
children: [
|
|
4826
4836
|
"Severity: ",
|
|
@@ -4832,10 +4842,10 @@ const Jn = {
|
|
|
4832
4842
|
We,
|
|
4833
4843
|
{
|
|
4834
4844
|
className: "font-sm text-gray-500 rounded-[8px] py-2 px-3",
|
|
4835
|
-
style: String(
|
|
4845
|
+
style: String(P || "").toLowerCase() === "completed" ? { background: "#E7F6EC", border: "0.68px solid var(--Green, #34C759)" } : { background: "#E0EDFF", border: "1px solid var(--Grays-Gray-4, #D1D1D6)" },
|
|
4836
4846
|
children: [
|
|
4837
4847
|
"Status: ",
|
|
4838
|
-
|
|
4848
|
+
P || "N/A"
|
|
4839
4849
|
]
|
|
4840
4850
|
}
|
|
4841
4851
|
)
|
|
@@ -4893,8 +4903,8 @@ const Jn = {
|
|
|
4893
4903
|
)
|
|
4894
4904
|
] }) : null
|
|
4895
4905
|
] }),
|
|
4896
|
-
Ue.length ? /* @__PURE__ */ i("div", { className: "w-full", children: /* @__PURE__ */ i(
|
|
4897
|
-
|
|
4906
|
+
Ue.length ? /* @__PURE__ */ i("div", { className: "w-full", children: /* @__PURE__ */ i(_s, { ref: N, dots: !0, className: "w-full", children: Ue.map((C, H) => /* @__PURE__ */ d("div", { className: "flex justify-center items-center", children: [
|
|
4907
|
+
mt(C) ? /* @__PURE__ */ d(
|
|
4898
4908
|
"video",
|
|
4899
4909
|
{
|
|
4900
4910
|
width: "240",
|
|
@@ -4915,14 +4925,14 @@ const Jn = {
|
|
|
4915
4925
|
}
|
|
4916
4926
|
),
|
|
4917
4927
|
C.caption && /* @__PURE__ */ i("p", { className: "text-xs text-gray-500 mt-1", children: C.caption }),
|
|
4918
|
-
!
|
|
4928
|
+
!mt(C) && k[String(C.mediaUrl || C)] ? /* @__PURE__ */ i(
|
|
4919
4929
|
"button",
|
|
4920
4930
|
{
|
|
4921
4931
|
onClick: () => {
|
|
4922
|
-
|
|
4932
|
+
W(!0), z(C.mediaUrl || C), T(C.type || "image");
|
|
4923
4933
|
},
|
|
4924
4934
|
className: "absolute bottom-3 right-3 text-white bg-black/50 rounded-full p-2 hover:bg-black/70",
|
|
4925
|
-
children: /* @__PURE__ */ i(
|
|
4935
|
+
children: /* @__PURE__ */ i(Is, { size: 20 })
|
|
4926
4936
|
}
|
|
4927
4937
|
) : null
|
|
4928
4938
|
] }, H)) }) }) : null
|
|
@@ -4930,10 +4940,10 @@ const Jn = {
|
|
|
4930
4940
|
/* @__PURE__ */ i(
|
|
4931
4941
|
Yn,
|
|
4932
4942
|
{
|
|
4933
|
-
isOpen:
|
|
4934
|
-
onClose: () =>
|
|
4935
|
-
src:
|
|
4936
|
-
type:
|
|
4943
|
+
isOpen: Z,
|
|
4944
|
+
onClose: () => W(!1),
|
|
4945
|
+
src: K || "",
|
|
4946
|
+
type: I || "image"
|
|
4937
4947
|
}
|
|
4938
4948
|
)
|
|
4939
4949
|
] })
|
|
@@ -4945,12 +4955,12 @@ const Jn = {
|
|
|
4945
4955
|
Bn,
|
|
4946
4956
|
{
|
|
4947
4957
|
alertId: v,
|
|
4948
|
-
id:
|
|
4958
|
+
id: B,
|
|
4949
4959
|
priority: g,
|
|
4950
4960
|
spaceName: y,
|
|
4951
|
-
alertNumber:
|
|
4952
|
-
statusHistory:
|
|
4953
|
-
notifGroups:
|
|
4961
|
+
alertNumber: V,
|
|
4962
|
+
statusHistory: U,
|
|
4963
|
+
notifGroups: j
|
|
4954
4964
|
}
|
|
4955
4965
|
)
|
|
4956
4966
|
}
|
|
@@ -4961,7 +4971,7 @@ const Jn = {
|
|
|
4961
4971
|
);
|
|
4962
4972
|
};
|
|
4963
4973
|
function ei() {
|
|
4964
|
-
const { alerts: e } = Te(), t =
|
|
4974
|
+
const { alerts: e } = Te(), t = at({
|
|
4965
4975
|
queryKey: ["alerts", "statusList"],
|
|
4966
4976
|
queryFn: () => e.getAlertStatusList(),
|
|
4967
4977
|
staleTime: 5 * 6e4
|
|
@@ -4973,15 +4983,37 @@ function ei() {
|
|
|
4973
4983
|
refetch: t.refetch
|
|
4974
4984
|
};
|
|
4975
4985
|
}
|
|
4986
|
+
function ti() {
|
|
4987
|
+
const { alerts: e } = Te(), t = at({
|
|
4988
|
+
queryKey: ["alerts", "timeZoneMasters"],
|
|
4989
|
+
queryFn: () => e.getTimeZoneMasters ? e.getTimeZoneMasters() : Promise.resolve([]),
|
|
4990
|
+
staleTime: 30 * 6e4,
|
|
4991
|
+
enabled: typeof e.getTimeZoneMasters == "function"
|
|
4992
|
+
});
|
|
4993
|
+
return {
|
|
4994
|
+
timeZoneMasters: t.data ?? [],
|
|
4995
|
+
loading: t.isLoading,
|
|
4996
|
+
error: t.error
|
|
4997
|
+
};
|
|
4998
|
+
}
|
|
4976
4999
|
function Rs({ alerts: e, loading: t = !1, columns: s, onRefetch: r }) {
|
|
4977
|
-
const [n, a] = w(!1), [o, l] = w(null), [h, u] = w("details"), { list: c, loading: S } = ei()
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
5000
|
+
const [n, a] = w(!1), [o, l] = w(null), [h, u] = w("details"), { list: c, loading: S } = ei(), { timeZoneMasters: f } = ti(), R = ue(() => {
|
|
5001
|
+
const O = "America/New_York";
|
|
5002
|
+
if (!e.length || !f.length)
|
|
5003
|
+
return { label: "USA", ianaTimeZoneId: O };
|
|
5004
|
+
const Z = e[0].timeZoneUniqueId;
|
|
5005
|
+
if (!Z)
|
|
5006
|
+
return { label: "USA", ianaTimeZoneId: O };
|
|
5007
|
+
const W = f.find((K) => K.timeZoneUniqueId === Z);
|
|
5008
|
+
return W ? { label: W.timeZoneName, ianaTimeZoneId: W.ianaTimeZoneId } : { label: "USA", ianaTimeZoneId: O };
|
|
5009
|
+
}, [e, f]);
|
|
5010
|
+
function N($, O) {
|
|
5011
|
+
l($), u(O?.tab ?? "details"), j(O?.sourceTab ?? "active"), a(!0);
|
|
5012
|
+
}
|
|
5013
|
+
function m() {
|
|
4982
5014
|
a(!1);
|
|
4983
5015
|
}
|
|
4984
|
-
const [
|
|
5016
|
+
const [A, j] = w("active"), L = o ? {
|
|
4985
5017
|
originalData: {
|
|
4986
5018
|
// include the full selected alert so alll modal fieldsare present
|
|
4987
5019
|
...o,
|
|
@@ -4993,32 +5025,32 @@ function Rs({ alerts: e, loading: t = !1, columns: s, onRefetch: r }) {
|
|
|
4993
5025
|
return /* @__PURE__ */ d("div", { className: "p-6 flex flex-col items-start justify-start min-h-screen w-full overflow-auto", children: [
|
|
4994
5026
|
/* @__PURE__ */ d("div", { className: "w-1/2 flex items-center justify-between mb-4", children: [
|
|
4995
5027
|
/* @__PURE__ */ i("h1", { className: "text-xl font-bold text-black", children: "Alert Console" }),
|
|
4996
|
-
/* @__PURE__ */ i(wn, { label:
|
|
5028
|
+
/* @__PURE__ */ i(wn, { label: R.label, timeZone: R.ianaTimeZoneId })
|
|
4997
5029
|
] }),
|
|
4998
5030
|
/* @__PURE__ */ i(
|
|
4999
|
-
|
|
5031
|
+
Tt,
|
|
5000
5032
|
{
|
|
5001
5033
|
defaultActiveKey: "active",
|
|
5002
5034
|
className: "w-full",
|
|
5003
5035
|
tabBarStyle: { fontSize: "medium" },
|
|
5004
|
-
onChange: (
|
|
5005
|
-
|
|
5036
|
+
onChange: ($) => {
|
|
5037
|
+
$ === "active" && r?.();
|
|
5006
5038
|
},
|
|
5007
5039
|
items: [
|
|
5008
5040
|
{
|
|
5009
5041
|
key: "active",
|
|
5010
5042
|
label: "Active",
|
|
5011
|
-
children: /* @__PURE__ */ i(ms, { data: e, loading: t, pageSize: 10, columns: s || [], onAlertIdClick:
|
|
5043
|
+
children: /* @__PURE__ */ i(ms, { data: e, loading: t, pageSize: 10, columns: s || [], onAlertIdClick: N, onRefetch: r })
|
|
5012
5044
|
},
|
|
5013
5045
|
{
|
|
5014
5046
|
key: "archived",
|
|
5015
5047
|
label: "Archived",
|
|
5016
|
-
children: /* @__PURE__ */ i(An, { alerts: e, loading: t, columns: s || [], onAlertIdClick:
|
|
5048
|
+
children: /* @__PURE__ */ i(An, { alerts: e, loading: t, columns: s || [], onAlertIdClick: N })
|
|
5017
5049
|
},
|
|
5018
5050
|
{
|
|
5019
5051
|
key: "settings",
|
|
5020
5052
|
label: "Settings",
|
|
5021
|
-
children: /* @__PURE__ */ i(
|
|
5053
|
+
children: /* @__PURE__ */ i(si, {})
|
|
5022
5054
|
}
|
|
5023
5055
|
// {
|
|
5024
5056
|
// key: "reports",
|
|
@@ -5032,21 +5064,21 @@ function Rs({ alerts: e, loading: t = !1, columns: s, onRefetch: r }) {
|
|
|
5032
5064
|
Xn,
|
|
5033
5065
|
{
|
|
5034
5066
|
isModalOpen: n,
|
|
5035
|
-
handleModalClose:
|
|
5036
|
-
selectedRow:
|
|
5067
|
+
handleModalClose: m,
|
|
5068
|
+
selectedRow: L,
|
|
5037
5069
|
fetchAlertLogs: () => {
|
|
5038
5070
|
},
|
|
5039
5071
|
alertStatusList: c,
|
|
5040
5072
|
alertStatusLoading: S,
|
|
5041
5073
|
initialTab: h,
|
|
5042
|
-
sourceTab:
|
|
5074
|
+
sourceTab: A
|
|
5043
5075
|
}
|
|
5044
5076
|
)
|
|
5045
5077
|
] });
|
|
5046
5078
|
}
|
|
5047
|
-
function
|
|
5079
|
+
function si() {
|
|
5048
5080
|
const [e, t] = w([]), [s, r] = w([]), [n, a] = w([]), { rules: o } = Te();
|
|
5049
|
-
return
|
|
5081
|
+
return de(() => {
|
|
5050
5082
|
let l = !0;
|
|
5051
5083
|
return (async () => {
|
|
5052
5084
|
try {
|
|
@@ -5059,18 +5091,18 @@ function ti() {
|
|
|
5059
5091
|
Description: c.ruleDesc || c.Description || "",
|
|
5060
5092
|
SeverityId: 0
|
|
5061
5093
|
}));
|
|
5062
|
-
t(u.length ? u :
|
|
5094
|
+
t(u.length ? u : qe.rules);
|
|
5063
5095
|
try {
|
|
5064
5096
|
const c = await o.getLookups(), S = Array.isArray(c?.userRoles) ? c.userRoles.map((f) => ({
|
|
5065
5097
|
userRoleId: f.userRoleId ?? f.id,
|
|
5066
5098
|
userRoleName: f.userRoleName ?? f.name
|
|
5067
5099
|
})) : [];
|
|
5068
|
-
r(S.length ? S :
|
|
5100
|
+
r(S.length ? S : qe.userRoles);
|
|
5069
5101
|
} catch {
|
|
5070
|
-
r(
|
|
5102
|
+
r(qe.userRoles);
|
|
5071
5103
|
}
|
|
5072
5104
|
} catch {
|
|
5073
|
-
t(
|
|
5105
|
+
t(qe.rules), r(qe.userRoles);
|
|
5074
5106
|
}
|
|
5075
5107
|
})(), () => {
|
|
5076
5108
|
l = !1;
|
|
@@ -5078,15 +5110,15 @@ function ti() {
|
|
|
5078
5110
|
}, []), /* @__PURE__ */ i(
|
|
5079
5111
|
Dn,
|
|
5080
5112
|
{
|
|
5081
|
-
severities:
|
|
5113
|
+
severities: qe.severities,
|
|
5082
5114
|
rules: e,
|
|
5083
5115
|
userRoles: s,
|
|
5084
5116
|
rawRules: n
|
|
5085
5117
|
}
|
|
5086
5118
|
);
|
|
5087
5119
|
}
|
|
5088
|
-
function
|
|
5089
|
-
const { alerts: e } = Te(), t =
|
|
5120
|
+
function ri() {
|
|
5121
|
+
const { alerts: e } = Te(), t = at({
|
|
5090
5122
|
queryKey: ["alerts", "list"],
|
|
5091
5123
|
queryFn: () => e.listAlerts(),
|
|
5092
5124
|
staleTime: 3e4
|
|
@@ -5098,11 +5130,11 @@ function si() {
|
|
|
5098
5130
|
refetch: t.refetch
|
|
5099
5131
|
};
|
|
5100
5132
|
}
|
|
5101
|
-
function
|
|
5102
|
-
const { alerts: t, loading: s, refetch: r } =
|
|
5133
|
+
function ni(e) {
|
|
5134
|
+
const { alerts: t, loading: s, refetch: r } = ri();
|
|
5103
5135
|
return /* @__PURE__ */ i(Rs, { alerts: t, loading: s, columns: e.columns, onRefetch: r });
|
|
5104
5136
|
}
|
|
5105
|
-
function
|
|
5137
|
+
function mi({
|
|
5106
5138
|
tenant: e,
|
|
5107
5139
|
apiDomain: t,
|
|
5108
5140
|
rulesDomain: s,
|
|
@@ -5111,7 +5143,7 @@ function fi({
|
|
|
5111
5143
|
loading: a,
|
|
5112
5144
|
columns: o
|
|
5113
5145
|
}) {
|
|
5114
|
-
const [l] = w(() => new en()), h =
|
|
5146
|
+
const [l] = w(() => new en()), h = ue(
|
|
5115
5147
|
() => ({
|
|
5116
5148
|
alertsBaseUrl: t,
|
|
5117
5149
|
rulesBaseUrl: s || t,
|
|
@@ -5119,10 +5151,10 @@ function fi({
|
|
|
5119
5151
|
}),
|
|
5120
5152
|
[t, s, r]
|
|
5121
5153
|
);
|
|
5122
|
-
return /* @__PURE__ */ i(tn, { client: l, children: /* @__PURE__ */ i(gr, { tenant: e, override: h, children: Array.isArray(n) ? /* @__PURE__ */ i(Rs, { alerts: n, loading: !!a, columns: o }) : /* @__PURE__ */ i(
|
|
5154
|
+
return /* @__PURE__ */ i(tn, { client: l, children: /* @__PURE__ */ i(gr, { tenant: e, override: h, children: Array.isArray(n) ? /* @__PURE__ */ i(Rs, { alerts: n, loading: !!a, columns: o }) : /* @__PURE__ */ i(ni, { columns: o }) }) });
|
|
5123
5155
|
}
|
|
5124
|
-
function
|
|
5125
|
-
const { alerts: t } = Te(), s =
|
|
5156
|
+
function pi(e) {
|
|
5157
|
+
const { alerts: t } = Te(), s = at({
|
|
5126
5158
|
queryKey: ["alerts", "report", e],
|
|
5127
5159
|
queryFn: () => t.getAlertsReport(e),
|
|
5128
5160
|
staleTime: 6e4
|
|
@@ -5134,7 +5166,7 @@ function mi(e) {
|
|
|
5134
5166
|
refetch: s.refetch
|
|
5135
5167
|
};
|
|
5136
5168
|
}
|
|
5137
|
-
const
|
|
5169
|
+
const yi = [
|
|
5138
5170
|
{ title: "ID", dataIndex: "id", key: "id", width: 120 },
|
|
5139
5171
|
{ title: "Priority", dataIndex: "priority", key: "priority", width: 120 },
|
|
5140
5172
|
{ title: "Timestamp", dataIndex: "timestamp", key: "timestamp", width: 220 },
|
|
@@ -5144,7 +5176,7 @@ const pi = [
|
|
|
5144
5176
|
export {
|
|
5145
5177
|
On as AlertAssignment,
|
|
5146
5178
|
Rs as AlertConsole,
|
|
5147
|
-
|
|
5179
|
+
mi as AlertConsoleWidget,
|
|
5148
5180
|
ms as AlertsTable,
|
|
5149
5181
|
gr as ApiProvider,
|
|
5150
5182
|
An as ArchivedTable,
|
|
@@ -5153,10 +5185,10 @@ export {
|
|
|
5153
5185
|
Mn as MyPreferencesPanel,
|
|
5154
5186
|
Pn as SettingsPanel,
|
|
5155
5187
|
Dn as SettingsTabs,
|
|
5156
|
-
|
|
5188
|
+
yi as exampleAlertColumns,
|
|
5157
5189
|
ei as useAlertStatusList,
|
|
5158
|
-
|
|
5159
|
-
|
|
5190
|
+
ri as useAlerts,
|
|
5191
|
+
pi as useAlertsReport,
|
|
5160
5192
|
Te as useApi,
|
|
5161
5193
|
xs as useUpdateAlertStatus
|
|
5162
5194
|
};
|