@feedmepos/mf-hrm-portal 2.3.0-dev.5 → 2.3.0-dev.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/{ApprovalCodeList-DIqLkR-n.js → ApprovalCodeList-Cf1l-ult.js} +2 -2
  2. package/dist/AuditLogList-D1sMrERs.js +1951 -0
  3. package/dist/{ConditionBuilderForm.vue_vue_type_script_setup_true_lang-DtIAcKaZ.js → ConditionBuilderForm.vue_vue_type_script_setup_true_lang-BdbfGDI_.js} +2 -2
  4. package/dist/{EmployeeList-BcommHHe.js → EmployeeList-sc773luN.js} +4 -4
  5. package/dist/{GrantUserList-zYXWPBy8.js → GrantUserList-2XTroUF8.js} +3 -3
  6. package/dist/{Main-D8Uz1Mlf.js → Main-BIo4YcWF.js} +2 -2
  7. package/dist/{Main-BbLYXl-C.js → Main-BNCfG0Sg.js} +5 -5
  8. package/dist/{Main-D1Rc3l1L.js → Main-CCGYrZsD.js} +9 -9
  9. package/dist/{PermissionSetList-DB27fd5Q.js → PermissionSetList-7Ut1F99N.js} +5 -5
  10. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-B1l2xUpn.js +4167 -0
  11. package/dist/{RoleList-DqH-J2Di.js → RoleList-DMKdy74J.js} +7 -7
  12. package/dist/{ScheduleAddPositionModal.vue_vue_type_script_setup_true_lang-Dk5KTJmM.js → ScheduleAddPositionModal.vue_vue_type_script_setup_true_lang-CI94gSkp.js} +1 -1
  13. package/dist/{ScheduleGeneralPage-C6fHvARq.js → ScheduleGeneralPage-DGdnq7oV.js} +4 -4
  14. package/dist/{ScheduleModal.vue_vue_type_script_setup_true_lang-B-rR81nv.js → ScheduleModal.vue_vue_type_script_setup_true_lang-Cq-zMPW_.js} +1 -1
  15. package/dist/{SchedulePage-CqpoSfUn.js → SchedulePage-B7M5fPIA.js} +6 -6
  16. package/dist/{SchedulePositionPage-NMdwzGfm.js → SchedulePositionPage-DeorKiCc.js} +3 -3
  17. package/dist/{TeamMemberList-CX0qHVRT.js → TeamMemberList-CQswHBEk.js} +6 -6
  18. package/dist/{TimesheetList-DUK2sUEN.js → TimesheetList-lWsJuha_.js} +5 -5
  19. package/dist/{TimesheetList.vue_vue_type_style_index_0_scoped_63294af2_lang-m8Ml-b47.js → TimesheetList.vue_vue_type_style_index_0_scoped_63294af2_lang-CLgmz6LT.js} +2 -2
  20. package/dist/{app-CLTLqZhG.js → app-MTWSOw4U.js} +452 -216
  21. package/dist/app.js +1 -1
  22. package/dist/{dayjs.min-BFtQINpX.js → dayjs.min-9rM_szda.js} +1 -1
  23. package/dist/{employee-CWjZhmcu.js → employee-BvtW9sI6.js} +3 -3
  24. package/dist/{iteration-NQ4DY9De.js → iteration-Byna7hj1.js} +1 -1
  25. package/dist/{lodash-OAOy_WpD.js → lodash-CnwRhwQm.js} +1 -1
  26. package/dist/{role-DSSFv8cl.js → role-N_-ZZfhy.js} +1 -1
  27. package/dist/{rule-DY7yg9_a.js → rule-B9-ryqfq.js} +2 -2
  28. package/dist/src/api/audit-log/index.d.ts +4 -0
  29. package/dist/src/views/audit-log/constants.d.ts +9 -30
  30. package/dist/src/views/audit-log/locales/index.d.ts +236 -0
  31. package/dist/src/views/audit-log/pos-row.d.ts +27 -0
  32. package/dist/style.css +1 -1
  33. package/dist/tsconfig.app.tsbuildinfo +1 -1
  34. package/dist/{useReportPermissions-BRs-yhSQ.js → useReportPermissions-BSOsfpnM.js} +3 -3
  35. package/package.json +1 -1
  36. package/dist/AuditLogList-DOrq5WAM.js +0 -1779
  37. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-DtVJW54V.js +0 -4167
@@ -1,1779 +0,0 @@
1
- import { defineComponent as Mt, ref as S, computed as A, onMounted as Ao, onBeforeUnmount as Fo, watch as de, resolveComponent as N, createElementBlock as b, openBlock as v, createBlock as we, createCommentVNode as j, createElementVNode as a, Fragment as q, renderList as ae, withCtx as B, createVNode as m, toDisplayString as l, unref as c, nextTick as Mo, onUnmounted as Oo, createTextVNode as Ve, normalizeClass as Do } from "vue";
2
- import { d as D } from "./dayjs.min-BFtQINpX.js";
3
- import { useI18n as Ot, useCoreStore as jo } from "@feedmepos/mf-common";
4
- import { B as St, _ as Co } from "./app-CLTLqZhG.js";
5
- import { components as ue } from "@feedmepos/ui-library";
6
- import { g as Ze, b as et } from "./restaurant-D7PEQjPY.js";
7
- import { S as Pe } from "./SelectFilter-CG13h83-.js";
8
- import { _ as To } from "./PageLayout.vue_vue_type_script_setup_true_lang-HKK4cbW8.js";
9
- import { _ as Vo } from "./TableEmptyState.vue_vue_type_script_setup_true_lang-IfAZmWr0.js";
10
- import { t as Po, p as kt } from "./rule-DY7yg9_a.js";
11
- import { defineStore as Eo } from "pinia";
12
- import { u as $o } from "./useDebounce-B8ZPVS5C.js";
13
- import { n as No } from "./string-VNuQNweN.js";
14
- import { _ as Uo } from "./_plugin-vue_export-helper-CHgC5LLL.js";
15
- const Se = [
16
- { key: "all", label: "All", subjectPrefixes: [] },
17
- { key: "inventory", label: "Inventory", subjectPrefixes: ["business::inventory", "inventory"] },
18
- { key: "report", label: "Report", subjectPrefixes: ["business::report", "report"] },
19
- { key: "hrm", label: "HRM", subjectPrefixes: ["business::hrm", "hrm"] },
20
- { key: "payment", label: "Payment", subjectPrefixes: ["business::payment", "payment"] },
21
- { key: "menu", label: "Menu", subjectPrefixes: ["business::menu", "menu"] },
22
- { key: "crm", label: "CRM", subjectPrefixes: ["business::crm", "crm"] }
23
- // Add more as modules are revamped with new actionguard:
24
- // { key: 'restaurantOperation', label: 'Restaurant Operation', subjectPrefixes: ['restaurant'] },
25
- ], tt = "/audit-logs", Ee = {
26
- async count(t) {
27
- var r, d, g, p, h, i, C;
28
- const o = {
29
- ...t != null && t.from ? { from: t.from } : {},
30
- ...t != null && t.to ? { to: t.to } : {},
31
- ...(r = t == null ? void 0 : t.userIds) != null && r.length ? { userIds: t.userIds } : {},
32
- ...(d = t == null ? void 0 : t.subjects) != null && d.length ? { subjects: t.subjects } : {},
33
- ...(g = t == null ? void 0 : t.subjectPrefixes) != null && g.length ? { subjectPrefixes: t.subjectPrefixes } : {},
34
- ...(p = t == null ? void 0 : t.actions) != null && p.length ? { actions: t.actions } : {},
35
- ...(h = t == null ? void 0 : t.outcomes) != null && h.length ? { outcomes: t.outcomes } : {},
36
- ...t != null && t.feedmeAdminActors ? { feedmeAdminActors: !0 } : {},
37
- ...t != null && t.search ? { search: t.search } : {},
38
- ...(i = t == null ? void 0 : t.searchUserIds) != null && i.length ? { searchUserIds: t.searchUserIds } : {},
39
- ...(C = t == null ? void 0 : t.searchSubjects) != null && C.length ? { searchSubjects: t.searchSubjects } : {}
40
- };
41
- return (await Ze(
42
- await et().get(`${tt}/count`, {
43
- params: o,
44
- paramsSerializer: (O) => {
45
- const k = new URLSearchParams();
46
- for (const [V, L] of Object.entries(O))
47
- if (Array.isArray(L))
48
- for (const I of L) k.append(V, String(I));
49
- else L != null && k.append(V, String(L));
50
- return k.toString();
51
- }
52
- })
53
- )).total;
54
- },
55
- async read(t) {
56
- var n, r, d, g, p, h, i;
57
- const o = {
58
- limit: (t == null ? void 0 : t.limit) ?? 100,
59
- offset: (t == null ? void 0 : t.offset) ?? 0,
60
- ...t != null && t.from ? { from: t.from } : {},
61
- ...t != null && t.to ? { to: t.to } : {},
62
- ...(n = t == null ? void 0 : t.userIds) != null && n.length ? { userIds: t.userIds } : {},
63
- ...t != null && t.feedmeAdminActors ? { feedmeAdminActors: !0 } : {},
64
- ...(r = t == null ? void 0 : t.subjects) != null && r.length ? { subjects: t.subjects } : {},
65
- ...(d = t == null ? void 0 : t.subjectPrefixes) != null && d.length ? { subjectPrefixes: t.subjectPrefixes } : {},
66
- ...(g = t == null ? void 0 : t.actions) != null && g.length ? { actions: t.actions } : {},
67
- ...(p = t == null ? void 0 : t.outcomes) != null && p.length ? { outcomes: t.outcomes } : {},
68
- ...t != null && t.search ? { search: t.search } : {},
69
- ...(h = t == null ? void 0 : t.searchUserIds) != null && h.length ? { searchUserIds: t.searchUserIds } : {},
70
- ...(i = t == null ? void 0 : t.searchSubjects) != null && i.length ? { searchSubjects: t.searchSubjects } : {}
71
- };
72
- return Ze(
73
- await et().get(tt, {
74
- params: o,
75
- // Serialize arrays as repeated params: key=val1&key=val2
76
- // (NestJS @Query expects this; axios default adds brackets which break matching)
77
- paramsSerializer: (C) => {
78
- const O = new URLSearchParams();
79
- for (const [k, V] of Object.entries(C))
80
- if (Array.isArray(V))
81
- for (const L of V) O.append(k, String(L));
82
- else V != null && O.append(k, String(V));
83
- return O.toString();
84
- }
85
- })
86
- );
87
- },
88
- /**
89
- * FeedMe-admin options for the User filter. `actors` is the named admin list (internal
90
- * viewers only; empty for merchants). `showFeedmeAdminFilter` indicates whether to offer
91
- * the "FeedMe Admin" catch-all (only when the business has relevant admin activity).
92
- */
93
- async getFeedmeAdminFilter(t) {
94
- const o = {
95
- ...t != null && t.from ? { from: t.from } : {},
96
- ...t != null && t.to ? { to: t.to } : {}
97
- };
98
- return Ze(
99
- await et().get(`${tt}/actors`, { params: o })
100
- );
101
- }
102
- }, Ro = { class: "flex h-[46px] items-center gap-8 rounded-sm px-16 hover:bg-fm-color-opacity-sm" }, Ko = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Bo = {
103
- "data-more-measure": "",
104
- class: "flex h-[46px] items-center gap-8 rounded-sm px-16"
105
- }, Yo = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, zo = /* @__PURE__ */ Mt({
106
- __name: "AuditLogModuleTabs",
107
- props: {
108
- modelValue: {},
109
- items: {}
110
- },
111
- emits: ["update:modelValue"],
112
- setup(t, { emit: o }) {
113
- const n = t, r = o, { t: d } = Ot(), g = S(!1), p = S(null), h = S(null), i = S([]), C = S(0), O = S(0);
114
- let k = null;
115
- async function V() {
116
- if (await Mo(), !h.value) return;
117
- const _ = h.value.querySelectorAll("[data-tab-measure]");
118
- i.value = Array.from(_).map((E) => E.offsetWidth);
119
- const M = h.value.querySelector("[data-more-measure]");
120
- C.value = (M == null ? void 0 : M.offsetWidth) ?? 0;
121
- }
122
- const L = A(() => {
123
- const _ = n.items.length;
124
- if (_ === 0) return 0;
125
- if (!O.value || i.value.length !== _) return _;
126
- const M = i.value;
127
- if (M.reduce((w, ce) => w + ce, 0) <= O.value) return _;
128
- const T = C.value;
129
- let Y = 0, U = 0;
130
- for (let w = 0; w < _ && !(Y + M[w] + T > O.value); w++)
131
- Y += M[w], U++;
132
- return U;
133
- }), I = A(() => {
134
- const _ = L.value, M = n.items.length;
135
- if (_ >= M) return [...n.items];
136
- const E = n.items.slice(0, _), T = n.items.find((J) => J.value === n.modelValue);
137
- if (!T || E.some((J) => J.value === T.value)) return E;
138
- if (_ === 0) return [T];
139
- const Y = n.items.findIndex((J) => J.value === T.value), U = i.value, w = C.value, ce = U[Y] ?? 0;
140
- let ne = _, Ae = U.slice(0, ne - 1).reduce((J, he) => J + he, 0);
141
- for (; ne > 1 && Ae + ce + w > O.value; )
142
- ne--, Ae = U.slice(0, ne - 1).reduce((J, he) => J + he, 0);
143
- return [...n.items.slice(0, Math.max(ne - 1, 0)), T];
144
- }), K = A(() => {
145
- const _ = new Set(I.value.map((M) => M.value));
146
- return n.items.filter((M) => !_.has(M.value));
147
- });
148
- function W(_) {
149
- g.value = !1, r("update:modelValue", _);
150
- }
151
- return Ao(async () => {
152
- await V(), p.value && (O.value = p.value.clientWidth, k = new ResizeObserver(() => {
153
- p.value && (O.value = p.value.clientWidth);
154
- }), k.observe(p.value));
155
- }), Fo(() => {
156
- k == null || k.disconnect(), k = null;
157
- }), de(
158
- () => n.items,
159
- () => {
160
- V();
161
- },
162
- { deep: !0 }
163
- ), (_, M) => {
164
- const E = N("FmTab"), T = N("FmIcon"), Y = N("FmMenuItem"), U = N("FmMenu");
165
- return v(), b("div", {
166
- ref_key: "containerRef",
167
- ref: p,
168
- class: "relative flex w-full flex-row items-center"
169
- }, [
170
- (v(!0), b(q, null, ae(I.value, (w) => (v(), we(E, {
171
- key: w.value,
172
- "model-value": t.modelValue,
173
- label: w.label,
174
- badge: w.badge,
175
- disabled: w.disabled,
176
- value: w.value,
177
- "onUpdate:modelValue": W
178
- }, null, 8, ["model-value", "label", "badge", "disabled", "value"]))), 128)),
179
- K.value.length > 0 ? (v(), we(U, {
180
- key: 0,
181
- "show-menu": g.value,
182
- class: "max-w-[360px] min-w-[90px] rounded-sm",
183
- placement: "bottom-start",
184
- onMenuChanged: M[0] || (M[0] = (w) => g.value = w)
185
- }, {
186
- "menu-button": B(() => [
187
- a("div", Ro, [
188
- m(T, { name: "more_vert" }),
189
- a("span", Ko, l(c(d)("auditLog.modules.more")), 1)
190
- ])
191
- ]),
192
- default: B(() => [
193
- (v(!0), b(q, null, ae(K.value, (w) => (v(), we(Y, {
194
- key: w.value,
195
- "model-value": t.modelValue === w.value,
196
- label: w.label,
197
- disabled: w.disabled,
198
- onClick: (ce) => W(w.value)
199
- }, null, 8, ["model-value", "label", "disabled", "onClick"]))), 128))
200
- ]),
201
- _: 1
202
- }, 8, ["show-menu"])) : j("", !0),
203
- a("div", {
204
- ref_key: "measurerRef",
205
- ref: h,
206
- "aria-hidden": "true",
207
- class: "pointer-events-none invisible absolute -left-[9999px] -top-[9999px] flex flex-row items-center"
208
- }, [
209
- (v(!0), b(q, null, ae(t.items, (w) => (v(), b("div", {
210
- key: `measure-${w.value}`,
211
- "data-tab-measure": ""
212
- }, [
213
- m(E, {
214
- "model-value": t.modelValue,
215
- label: w.label,
216
- badge: w.badge,
217
- disabled: w.disabled,
218
- value: w.value
219
- }, null, 8, ["model-value", "label", "badge", "disabled", "value"])
220
- ]))), 128)),
221
- a("div", Bo, [
222
- m(T, { name: "more_vert" }),
223
- a("span", Yo, l(c(d)("auditLog.modules.more")), 1)
224
- ])
225
- ], 512)
226
- ], 512);
227
- };
228
- }
229
- }), qo = Eo("team", () => {
230
- const t = S([]), o = S(!1), n = S(!1), r = A(
231
- () => Object.fromEntries(t.value.map((h) => [h.doc.userId, h.name]))
232
- ), d = A(
233
- () => Object.fromEntries(t.value.map((h) => [h.doc.userId, h.email]))
234
- ), g = A(
235
- () => Object.fromEntries(t.value.map((h) => [h.doc.userId, h.phoneNumber]))
236
- );
237
- async function p({ force: h = !1 } = {}) {
238
- if (!(!h && t.value.length > 0))
239
- try {
240
- o.value = !0;
241
- const i = await Po.readTeamMembers();
242
- t.value = i.sort((C, O) => C.doc.isOwner ? -1 : C.name.localeCompare(O.name)), n.value = !0;
243
- } finally {
244
- o.value = !1;
245
- }
246
- }
247
- return {
248
- members: t,
249
- isLoading: o,
250
- hasLoaded: n,
251
- userIdToName: r,
252
- userIdToEmail: d,
253
- userIdToPhone: g,
254
- readTeamMembers: p
255
- };
256
- });
257
- function Jo(t) {
258
- const o = t.indexOf(".");
259
- return o <= 0 || o === t.length - 1 ? null : { entity: t.slice(0, o), verb: t.slice(o + 1) };
260
- }
261
- function wt(t) {
262
- const o = t.split("-").join(" ");
263
- return o.charAt(0).toUpperCase() + o.slice(1);
264
- }
265
- function Ho(t, o, n) {
266
- const r = t(o, n);
267
- return r === o ? null : r;
268
- }
269
- function st(t, o) {
270
- const { eventKey: n, params: r, operationLabel: d } = o;
271
- if (n) {
272
- const g = Ho(t, `auditLog.event.sentence.${n}`, r);
273
- if (g) return g;
274
- const p = Jo(n);
275
- if (p) {
276
- const h = `${wt(p.verb)} ${wt(p.entity)}`, i = (r == null ? void 0 : r.label) ?? (r == null ? void 0 : r.name);
277
- return i !== void 0 && i !== "" ? `${h} — ${i}` : h;
278
- }
279
- }
280
- return d ?? "";
281
- }
282
- function ge(t) {
283
- return typeof t == "object" && t !== null && !Array.isArray(t);
284
- }
285
- function Ie(t) {
286
- return Array.isArray(t);
287
- }
288
- function Ne(t) {
289
- if (t === null) return "null";
290
- if (typeof t == "object")
291
- try {
292
- return JSON.stringify(t);
293
- } catch {
294
- return String(t);
295
- }
296
- return String(t);
297
- }
298
- function Wo(t, o) {
299
- return t ? `${t}.${o}` : o;
300
- }
301
- function It(t) {
302
- if (typeof t != "string") return { ok: !1, value: void 0 };
303
- const o = t.trim();
304
- if (!o.startsWith("{") && !o.startsWith("[")) return { ok: !1, value: void 0 };
305
- try {
306
- const n = JSON.parse(o);
307
- return ge(n) || Ie(n) ? { ok: !0, value: n } : { ok: !1, value: void 0 };
308
- } catch {
309
- return { ok: !1, value: void 0 };
310
- }
311
- }
312
- const Go = ["_id", "id", "subject", "key", "name"];
313
- function Xo(t, o) {
314
- if (t.length === 0 || o.length === 0) return null;
315
- const n = (d, g) => d.every((p) => ge(p) && p[g] !== void 0), r = (d, g) => {
316
- const p = d.map((h) => h[g]);
317
- return p.length === new Set(p).size;
318
- };
319
- for (const d of Go)
320
- if (n(t, d) && n(o, d) && r(t, d) && r(o, d))
321
- return d;
322
- return null;
323
- }
324
- function Dt(t, o, n) {
325
- n.push({ path: t, type: "added", before: null, after: Ne(o) });
326
- }
327
- function jt(t, o, n) {
328
- n.push({ path: t, type: "removed", before: Ne(o), after: null });
329
- }
330
- function Qo(t, o, n, r) {
331
- const d = /* @__PURE__ */ new Set([...Object.keys(o), ...Object.keys(n)]);
332
- for (const g of Array.from(d)) {
333
- const p = Object.prototype.hasOwnProperty.call(o, g), h = Object.prototype.hasOwnProperty.call(n, g);
334
- Ue(Wo(t, g), o[g], p, n[g], h, r);
335
- }
336
- }
337
- function Zo(t, o, n, r) {
338
- const d = Xo(o, n);
339
- if (d) {
340
- const L = new Map(
341
- o.map((_) => [_[d], _])
342
- ), I = new Map(
343
- n.map((_) => [_[d], _])
344
- ), K = Array.from(L.keys()).concat(Array.from(I.keys())), W = Array.from(new Set(K));
345
- for (const _ of W) {
346
- const M = L.has(_), E = I.has(_), T = `${t}[${String(_)}]`;
347
- Ue(
348
- T,
349
- L.get(_),
350
- M,
351
- I.get(_),
352
- E,
353
- r
354
- );
355
- }
356
- return;
357
- }
358
- const g = o.map((L, I) => ({ sig: JSON.stringify(L), idx: I, item: L })), p = n.map((L, I) => ({ sig: JSON.stringify(L), idx: I, item: L })), h = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
359
- for (const L of g)
360
- h.has(L.sig) || h.set(L.sig, []), h.get(L.sig).push(L);
361
- for (const L of p)
362
- i.has(L.sig) || i.set(L.sig, []), i.get(L.sig).push(L);
363
- const C = [], O = [], k = Array.from(h.keys()).concat(Array.from(i.keys())), V = Array.from(new Set(k));
364
- for (const L of V) {
365
- const I = h.get(L) || [], K = i.get(L) || [], W = Math.min(I.length, K.length);
366
- for (let _ = W; _ < I.length; _++)
367
- C.push({ idx: I[_].idx, item: I[_].item });
368
- for (let _ = W; _ < K.length; _++)
369
- O.push({ idx: K[_].idx, item: K[_].item });
370
- }
371
- for (const { idx: L, item: I } of C)
372
- jt(`${t}[${L}]`, I, r);
373
- for (const { idx: L, item: I } of O)
374
- Dt(`${t}[${L}]`, I, r);
375
- }
376
- function Ue(t, o, n, r, d, g) {
377
- if (!n && !d) return;
378
- if (n && !d) {
379
- jt(t, o, g);
380
- return;
381
- }
382
- if (!n && d) {
383
- Dt(t, r, g);
384
- return;
385
- }
386
- if (JSON.stringify(o) === JSON.stringify(r)) return;
387
- if (ge(o) && ge(r)) {
388
- Qo(t, o, r, g);
389
- return;
390
- }
391
- if (Ie(o) && Ie(r)) {
392
- Zo(t, o, r, g);
393
- return;
394
- }
395
- const p = It(o), h = It(r);
396
- if (p.ok && h.ok) {
397
- Ue(t, p.value, !0, h.value, !0, g);
398
- return;
399
- }
400
- g.push({
401
- path: t,
402
- type: "changed",
403
- before: Ne(o),
404
- after: Ne(r)
405
- });
406
- }
407
- function es(t, o) {
408
- if (JSON.stringify(t) === JSON.stringify(o)) return [];
409
- const n = t == null, r = o == null;
410
- let d = t;
411
- n && (ge(o) ? d = {} : Ie(o) && (d = []));
412
- let g = o;
413
- r && (ge(t) ? g = {} : Ie(t) && (g = []));
414
- const p = [];
415
- return Ue("", d, !0, g, !0, p), p;
416
- }
417
- function At(t) {
418
- const o = t.operations;
419
- return !o || o.length === 0 ? !1 : o.some((n) => n.status === "failed");
420
- }
421
- function pe(t) {
422
- return t === void 0 ? "—" : Array.isArray(t) ? t.length > 0 ? t.join(", ") : "—" : t || "—";
423
- }
424
- function ts(t) {
425
- return {
426
- label: t.label,
427
- labelKey: t.labelKey,
428
- type: t.type,
429
- beforeDisplay: pe(t.before),
430
- afterDisplay: pe(t.after)
431
- };
432
- }
433
- function os(t) {
434
- return Array.isArray(t) && t.length > 0;
435
- }
436
- function Ct(t, o, n) {
437
- return n.labelKey && o(n.labelKey) ? t(n.labelKey) : n.label;
438
- }
439
- function Tt(t, o) {
440
- return st(t, o) || t("auditLog.operation.unlabeled");
441
- }
442
- function ss(t, o) {
443
- return !o || o.length === 0 ? "" : o.map((n) => {
444
- const r = Tt(t, n), d = t(`auditLog.outcome.${n.status}`);
445
- let g = `${r}: ${d}`;
446
- return n.status === "failed" && n.errorMessage && (g += ` — ${n.errorMessage}`), g;
447
- }).join(`
448
- `);
449
- }
450
- function as(t, o, n) {
451
- const r = Ct(t, o, n);
452
- return n.type === "add" ? `${r}: + ${pe(n.after)}` : n.type === "remove" ? `${r}: - ${pe(n.before)}` : `${r}: ${pe(n.before)} → ${pe(n.after)}`;
453
- }
454
- function ns(t, o, n) {
455
- if (!n || n.length === 0) return "";
456
- const r = n.filter((p) => p.changeNodes && p.changeNodes.length > 0);
457
- if (r.length === 0) return "";
458
- const d = r.length > 1;
459
- return r.map((p) => {
460
- const h = (p.changeNodes ?? []).map((i) => as(t, o, i));
461
- return d ? [`[${Tt(t, p)}]`, ...h].join(`
462
- `) : h.join(`
463
- `);
464
- }).join(`
465
- `);
466
- }
467
- const ls = {
468
- class: "flex flex-col gap-4 p-12 w-[260px]"
469
- }, rs = {
470
- class: "text-xs font-semibold text-fm-color-typo-secondary mb-4"
471
- }, is = {
472
- class: "flex min-h-0 flex-1 flex-col gap-16"
473
- }, us = {
474
- class: "space-y-16"
475
- }, ds = {
476
- class: "flex flex-wrap items-center gap-8"
477
- }, cs = {
478
- class: "w-fit"
479
- }, fs = {
480
- class: "w-fit"
481
- }, ms = {
482
- class: "w-fit"
483
- }, vs = {
484
- class: "w-fit"
485
- }, ps = {
486
- class: "flex h-full flex-col overflow-auto"
487
- }, gs = {
488
- key: 0,
489
- class: "space-y-12 p-4 text-sm"
490
- }, hs = {
491
- class: "flex items-start justify-between gap-8 rounded-lg border border-fm-color-border-default p-12"
492
- }, ys = {
493
- class: "min-w-0 flex-1"
494
- }, bs = {
495
- class: "audit-log-operation-label-detail text-base font-bold leading-snug text-fm-color-typo-primary"
496
- }, _s = {
497
- key: 0,
498
- class: "mt-4 break-all font-mono text-xs text-fm-color-typo-secondary"
499
- }, xs = {
500
- class: "flex items-center gap-4"
501
- }, Ls = {
502
- class: "rounded-lg border border-fm-color-border-default p-12"
503
- }, Ss = {
504
- class: "space-y-12"
505
- }, ks = {
506
- class: "text-xs text-fm-color-typo-secondary"
507
- }, ws = {
508
- class: "font-semibold"
509
- }, Is = {
510
- class: "text-xs text-fm-color-typo-secondary"
511
- }, As = {
512
- class: "font-semibold"
513
- }, Fs = {
514
- class: "text-xs text-fm-color-typo-secondary"
515
- }, Ms = {
516
- class: "break-all font-semibold"
517
- }, Os = {
518
- key: 0
519
- }, Ds = {
520
- class: "text-xs text-fm-color-typo-secondary"
521
- }, js = {
522
- class: "break-all font-mono text-xs font-semibold"
523
- }, Cs = {
524
- class: "text-xs text-fm-color-typo-secondary"
525
- }, Ts = {
526
- class: "break-all font-mono text-xs font-semibold"
527
- }, Vs = {
528
- class: "text-xs text-fm-color-typo-secondary"
529
- }, Ps = {
530
- class: "font-semibold"
531
- }, Es = {
532
- class: "rounded-lg border border-fm-color-border-default"
533
- }, $s = {
534
- class: "p-12"
535
- }, Ns = {
536
- class: "text-base font-bold text-fm-color-typo-primary"
537
- }, Us = {
538
- class: "space-y-12 p-12"
539
- }, Rs = {
540
- class: "text-xs text-fm-color-typo-secondary"
541
- }, Ks = {
542
- class: "font-semibold"
543
- }, Bs = {
544
- class: "rounded-lg border border-fm-color-border-default"
545
- }, Ys = {
546
- class: "p-12"
547
- }, zs = {
548
- class: "text-base font-bold text-fm-color-typo-primary"
549
- }, qs = {
550
- class: "space-y-12 p-12"
551
- }, Js = {
552
- class: "text-xs text-fm-color-typo-secondary"
553
- }, Hs = {
554
- class: "font-semibold"
555
- }, Ws = {
556
- key: 0
557
- }, Gs = {
558
- class: "text-xs text-fm-color-typo-secondary"
559
- }, Xs = {
560
- key: 0,
561
- class: "font-semibold"
562
- }, Qs = {
563
- key: 1,
564
- class: "break-all font-mono text-xs text-fm-color-typo-secondary"
565
- }, Zs = {
566
- key: 1
567
- }, ea = {
568
- class: "text-xs text-fm-color-typo-secondary"
569
- }, ta = {
570
- class: "font-semibold whitespace-pre-line"
571
- }, oa = {
572
- class: "text-xs text-fm-color-typo-secondary"
573
- }, sa = {
574
- class: "font-semibold"
575
- }, aa = {
576
- class: "text-xs text-fm-color-typo-secondary"
577
- }, na = {
578
- class: "break-all font-mono text-xs font-semibold"
579
- }, la = {
580
- key: 2
581
- }, ra = {
582
- class: "text-xs text-fm-color-typo-secondary"
583
- }, ia = {
584
- class: "mt-4 space-y-4"
585
- }, ua = {
586
- class: "flex h-16 w-16 shrink-0 items-center justify-center rounded-full bg-fm-color-primary-default text-xs font-bold text-white"
587
- }, da = {
588
- class: "text-xs font-semibold"
589
- }, ca = {
590
- key: 0,
591
- class: "text-fm-color-typo-secondary"
592
- }, fa = {
593
- key: 3
594
- }, ma = {
595
- class: "text-xs text-fm-color-typo-secondary"
596
- }, va = {
597
- class: "mt-4 max-h-[400px] overflow-auto rounded bg-gray-100 p-8 font-mono text-xs leading-relaxed shadow-inner whitespace-pre-wrap break-all"
598
- }, pa = {
599
- key: 0,
600
- class: "space-y-12 p-4 text-sm"
601
- }, ga = {
602
- class: "flex items-start justify-between gap-8 rounded-lg border border-fm-color-border-default p-12"
603
- }, ha = {
604
- class: "min-w-0 flex-1"
605
- }, ya = {
606
- class: "text-base font-bold leading-snug text-fm-color-typo-primary"
607
- }, ba = {
608
- key: 0,
609
- class: "text-xs text-fm-color-typo-secondary"
610
- }, _a = {
611
- class: "rounded-lg border border-fm-color-border-default p-12"
612
- }, xa = {
613
- class: "space-y-12"
614
- }, La = {
615
- class: "text-xs text-fm-color-typo-secondary"
616
- }, Sa = {
617
- class: "font-semibold"
618
- }, ka = {
619
- key: 0
620
- }, wa = {
621
- class: "text-xs text-fm-color-typo-secondary"
622
- }, Ia = {
623
- class: "font-semibold"
624
- }, Aa = {
625
- key: 1
626
- }, Fa = {
627
- class: "text-xs text-fm-color-typo-secondary"
628
- }, Ma = {
629
- class: "font-semibold"
630
- }, Oa = {
631
- key: 0,
632
- class: "rounded-lg border border-fm-color-border-default p-12"
633
- }, Da = {
634
- class: "text-xs text-fm-color-typo-secondary"
635
- }, ja = {
636
- class: "whitespace-pre-line font-semibold text-fm-color-typo-error"
637
- }, Ca = {
638
- class: "rounded-lg border border-fm-color-border-default"
639
- }, Ta = {
640
- class: "p-12"
641
- }, Va = {
642
- class: "text-base font-bold text-fm-color-typo-primary"
643
- }, Pa = {
644
- class: "p-12"
645
- }, Ea = {
646
- key: 0,
647
- class: "divide-y divide-fm-color-border-default"
648
- }, $a = {
649
- class: "flex flex-wrap items-center gap-8"
650
- }, Na = {
651
- class: "break-all text-xs"
652
- }, Ua = {
653
- class: "break-all font-mono text-xs"
654
- }, Ra = {
655
- key: 0,
656
- class: "text-fm-color-typo-success"
657
- }, Ka = {
658
- key: 1,
659
- class: "text-fm-color-typo-error"
660
- }, Ba = {
661
- class: "text-fm-color-typo-error"
662
- }, Ya = {
663
- class: "text-fm-color-typo-success"
664
- }, za = {
665
- key: 1,
666
- class: "divide-y divide-fm-color-border-default"
667
- }, qa = {
668
- class: "flex flex-wrap items-center gap-8"
669
- }, Ja = {
670
- class: "break-all font-mono text-xs"
671
- }, Ha = {
672
- class: "space-y-4"
673
- }, Wa = {
674
- key: 0,
675
- class: "text-fm-color-typo-success"
676
- }, Ga = {
677
- key: 1,
678
- class: "text-fm-color-typo-error"
679
- }, Xa = {
680
- class: "text-fm-color-typo-error"
681
- }, Qa = {
682
- class: "text-fm-color-typo-success"
683
- }, Za = {
684
- key: 2,
685
- class: "text-fm-color-typo-secondary"
686
- }, en = {
687
- key: 1,
688
- class: "rounded-lg border border-fm-color-border-default"
689
- }, tn = {
690
- class: "text-base font-bold text-fm-color-typo-primary"
691
- }, on = {
692
- class: "space-y-12 p-12"
693
- }, sn = {
694
- key: 0
695
- }, an = {
696
- class: "text-xs text-fm-color-typo-secondary"
697
- }, nn = {
698
- class: "mt-4 max-h-[400px] overflow-auto rounded bg-gray-100 p-8 font-mono text-xs leading-relaxed shadow-inner whitespace-pre-wrap break-all"
699
- }, ln = {
700
- key: 1
701
- }, rn = {
702
- class: "text-xs text-fm-color-typo-secondary"
703
- }, un = {
704
- class: "mt-4 max-h-[400px] overflow-auto rounded bg-gray-100 p-8 font-mono text-xs leading-relaxed shadow-inner whitespace-pre-wrap break-all"
705
- }, ke = 100, ot = 1e3, $e = "__feedmeAdmin__", dn = "D MMM YYYY h:mm A", cn = "YYYY-MM-DD HH:mm", R = "YYYY-MM-DD", Ft = "audit-log-export-fields-v3", fn = /* @__PURE__ */ Mt({
706
- __name: "AuditLogList",
707
- setup(t) {
708
- const {
709
- t: o,
710
- te: n
711
- } = Ot(), r = jo(), d = qo(), g = S(!1), p = S(!1), h = S([]), i = S(null), C = S(!1), O = S({}), k = S(null), V = S(!1);
712
- async function L(e) {
713
- const s = Uint8Array.from(atob(e), (x) => x.charCodeAt(0)), u = new DecompressionStream("gzip"), y = u.writable.getWriter();
714
- return await y.write(s), await y.close(), new Response(u.readable).text();
715
- }
716
- const I = S("");
717
- let K = 0;
718
- de(() => {
719
- var e, s;
720
- return (s = (e = i.value) == null ? void 0 : e.metadata) == null ? void 0 : s.requestBody;
721
- }, async (e) => {
722
- const s = ++K;
723
- if (!e) {
724
- I.value = "";
725
- return;
726
- }
727
- if (typeof e == "object") {
728
- I.value = JSON.stringify(e, null, 2);
729
- return;
730
- }
731
- if (e.startsWith("gzip:")) {
732
- try {
733
- const u = await L(e.slice(5));
734
- if (s !== K) return;
735
- I.value = JSON.stringify(JSON.parse(u), null, 2);
736
- } catch {
737
- if (s !== K) return;
738
- I.value = e;
739
- }
740
- return;
741
- }
742
- try {
743
- I.value = JSON.stringify(JSON.parse(e), null, 2);
744
- } catch {
745
- I.value = e;
746
- }
747
- }, {
748
- immediate: !0
749
- });
750
- async function W(e) {
751
- if (!e) return;
752
- let s = e;
753
- if (e.startsWith("gzip:"))
754
- try {
755
- s = await L(e.slice(5));
756
- } catch {
757
- return e;
758
- }
759
- try {
760
- return JSON.parse(s);
761
- } catch {
762
- return s;
763
- }
764
- }
765
- function _(e) {
766
- if (e === void 0) return "";
767
- if (typeof e == "object" && e !== null)
768
- try {
769
- return JSON.stringify(e, null, 2);
770
- } catch {
771
- return String(e);
772
- }
773
- return String(e);
774
- }
775
- const M = S([]), E = S([]), T = S(""), Y = S(""), U = S(!1);
776
- let w = 0;
777
- de(k, async (e) => {
778
- const s = ++w;
779
- if (M.value = [], E.value = [], T.value = "", Y.value = "", U.value = !1, !e) return;
780
- const [u, y] = await Promise.all([W(e.before), W(e.after)]);
781
- s === w && (os(e.changeNodes) ? E.value = e.changeNodes.map(ts) : M.value = es(u, y), T.value = _(u), Y.value = _(y));
782
- });
783
- function ce(e) {
784
- return e === "added" ? "success" : e === "removed" ? "critical" : "warning";
785
- }
786
- function ne(e) {
787
- return o(e === "added" ? "auditLog.operation.added" : e === "removed" ? "auditLog.operation.removed" : "auditLog.operation.updated");
788
- }
789
- function Ae(e) {
790
- return e.replace(/\[[^\]]*\]/g, "");
791
- }
792
- function at(e) {
793
- return e === "add" ? "success" : e === "remove" ? "critical" : "warning";
794
- }
795
- function J(e) {
796
- return o(e === "add" ? "auditLog.operation.added" : e === "remove" ? "auditLog.operation.removed" : "auditLog.operation.updated");
797
- }
798
- function he(e) {
799
- return Ct(o, n, e);
800
- }
801
- const nt = A(() => {
802
- const e = [], s = /* @__PURE__ */ new Map();
803
- for (const u of M.value) {
804
- const y = Ae(u.path), x = `${u.type}::${y}`;
805
- let F = s.get(x);
806
- F || (F = {
807
- groupKey: x,
808
- displayKey: y,
809
- type: u.type,
810
- rows: []
811
- }, s.set(x, F), e.push(F)), F.rows.push(u);
812
- }
813
- return e;
814
- }), Fe = S(1), Vt = S(!1), Re = S(0), lt = A(() => Math.max(1, Math.ceil(Re.value / ke))), rt = D().format("YYYY-MM-DD"), Q = S({
815
- startDate: `${rt} 00:00`,
816
- endDate: `${rt} 23:59`
817
- }), fe = S(), G = S(), Z = S(), ee = S(), le = S("all");
818
- function Pt(e) {
819
- return typeof e == "string" ? [e] : Array.isArray(e) ? e.filter((s) => typeof s == "string") : [];
820
- }
821
- const it = Se.filter((e) => e.key !== "all").map((e) => e.key);
822
- function Me(e) {
823
- const s = Se.find((u) => u.key !== "all" && u.subjectPrefixes.some((y) => e.startsWith(y)));
824
- return (s == null ? void 0 : s.key) ?? "other";
825
- }
826
- function ut(e) {
827
- const s = it.indexOf(e);
828
- return s === -1 ? it.length : s;
829
- }
830
- const Et = A(() => Se.map(({
831
- key: e
832
- }) => ({
833
- label: o(`auditLog.modules.${e}`),
834
- value: e
835
- }))), Ke = A(() => Se.find((e) => e.key === le.value) ?? Se[0]), $t = A(() => le.value === "all"), ye = S([]), Oe = S(!1), Nt = A(() => [...Oe.value ? [{
836
- label: o("auditLog.user.feedmeAdmin"),
837
- value: $e
838
- }] : [], ...d.members.map((e) => ({
839
- label: e.name,
840
- value: e.doc.userId
841
- })), ...ye.value.map((e) => ({
842
- label: `${e.name} (${o("auditLog.user.feedmeAdmin")})`,
843
- value: e.userId
844
- }))]), te = A(() => {
845
- const e = fe.value ?? [];
846
- return {
847
- userIds: e.filter((s) => s !== $e),
848
- feedmeAdminActors: e.includes($e)
849
- };
850
- }), Be = S(""), X = S(""), Ut = $o(Be, (e) => {
851
- X.value = e.trim();
852
- });
853
- Oo(Ut);
854
- const re = A(() => {
855
- const e = X.value.toLowerCase();
856
- if (!e) return [];
857
- const s = /* @__PURE__ */ new Set();
858
- for (const u of d.members) {
859
- const y = u.doc.userId;
860
- ((d.userIdToName[y] ?? "").toLowerCase().includes(e) || (d.userIdToEmail[y] ?? "").toLowerCase().includes(e) || (d.userIdToPhone[y] ?? "").toLowerCase().includes(e)) && s.add(y);
861
- }
862
- for (const u of ye.value)
863
- u.name.toLowerCase().includes(e) && s.add(u.userId);
864
- return [...s];
865
- }), Ye = A(() => {
866
- const e = kt.flatMap((x) => Pt(x.subject).map((F) => ({
867
- label: x.label,
868
- value: F
869
- }))), s = Object.entries(St).map(([x, F]) => ({
870
- label: F,
871
- value: x
872
- })), u = /* @__PURE__ */ new Set(), y = [];
873
- for (const x of [...e, ...s])
874
- if (!u.has(x.value)) {
875
- u.add(x.value);
876
- const F = Me(x.value);
877
- y.push({
878
- ...x,
879
- group: o(`auditLog.modules.${F}`)
880
- });
881
- }
882
- return y.sort((x, F) => ut(Me(x.value)) - ut(Me(F.value)));
883
- }), me = A(() => {
884
- const e = X.value.toLowerCase();
885
- if (!e) return [];
886
- const s = /* @__PURE__ */ new Set();
887
- for (const u of Ye.value)
888
- u.label.toLowerCase().includes(e) && s.add(u.value);
889
- return [...s];
890
- }), Rt = A(() => $t.value ? Ye.value : Ye.value.filter((e) => Me(e.value) === le.value));
891
- function Kt(e, s) {
892
- const u = s.toLowerCase();
893
- return e.label.toLowerCase().includes(u) || e.value.replace(/^business::/, "").toLowerCase().includes(u) ? !0 : e.value.toLowerCase().includes(u);
894
- }
895
- const H = A(() => ({
896
- manage: o("auditLog.action.manage"),
897
- create: o("auditLog.action.create"),
898
- read: o("auditLog.action.read"),
899
- update: o("auditLog.action.update"),
900
- delete: o("auditLog.action.delete")
901
- })), Bt = A(() => [{
902
- label: H.value.manage,
903
- value: "manage"
904
- }, {
905
- label: H.value.create,
906
- value: "create"
907
- }, {
908
- label: H.value.read,
909
- value: "read"
910
- }, {
911
- label: H.value.update,
912
- value: "update"
913
- }, {
914
- label: H.value.delete,
915
- value: "delete"
916
- }]), De = A(() => ({
917
- allowed: o("auditLog.outcome.success"),
918
- denied: o("auditLog.outcome.failed"),
919
- skipped: o("auditLog.outcome.skipped")
920
- })), ze = A(() => {
921
- var e;
922
- return ((e = r.sessionUser.value) == null ? void 0 : e.isInternal) ?? !1;
923
- });
924
- function dt(e) {
925
- return !ze.value && e === "skipped" ? "allowed" : e;
926
- }
927
- function qe(e) {
928
- return !(e != null && e.length) || ze.value ? e : e.includes("allowed") ? [.../* @__PURE__ */ new Set([...e, "skipped"])] : e;
929
- }
930
- const Yt = A(() => [{
931
- label: De.value.allowed,
932
- value: "allowed"
933
- }, {
934
- label: De.value.denied,
935
- value: "denied"
936
- }, ...ze.value ? [{
937
- label: De.value.skipped,
938
- value: "skipped"
939
- }] : []]), zt = A(() => ({
940
- admin: o("auditLog.detail.resolvedFromValue.admin"),
941
- staff: o("auditLog.detail.resolvedFromValue.staff"),
942
- permissionSet: o("auditLog.detail.resolvedFromValue.permissionSet"),
943
- systemPermissionSet: o("auditLog.detail.resolvedFromValue.systemPermissionSet"),
944
- custom: o("auditLog.detail.resolvedFromValue.custom"),
945
- "no-match": o("auditLog.detail.resolvedFromValue.noMatch"),
946
- unknown: o("auditLog.detail.resolvedFromValue.unknown")
947
- })), qt = A(() => ({
948
- GET: H.value.read,
949
- POST: H.value.create,
950
- PUT: H.value.update,
951
- PATCH: H.value.update,
952
- DELETE: H.value.delete
953
- })), Jt = {
954
- allowed: "success",
955
- denied: "critical",
956
- skipped: "warning"
957
- };
958
- function je(e) {
959
- return D(e).format(dn);
960
- }
961
- const Ht = A(() => {
962
- const {
963
- startDate: e,
964
- endDate: s
965
- } = Q.value;
966
- return e && s ? `${je(e)} – ${je(s)}` : e ? je(e) : s ? je(s) : o("auditLog.dateRange.placeholder");
967
- }), Wt = A(() => [{
968
- label: o("date.predefinedRanges.today"),
969
- value: {
970
- startDate: D().format(R),
971
- endDate: D().format(R)
972
- }
973
- }, {
974
- label: o("date.predefinedRanges.yesterday"),
975
- value: {
976
- startDate: D().subtract(1, "day").format(R),
977
- endDate: D().subtract(1, "day").format(R)
978
- }
979
- }, {
980
- label: o("date.predefinedRanges.thisWeek"),
981
- value: {
982
- startDate: D().startOf("week").format(R),
983
- endDate: D().endOf("week").format(R)
984
- }
985
- }, {
986
- label: o("date.predefinedRanges.lastWeek"),
987
- value: {
988
- startDate: D().subtract(1, "week").startOf("week").format(R),
989
- endDate: D().subtract(1, "week").endOf("week").format(R)
990
- }
991
- }, {
992
- label: o("date.predefinedRanges.last7Days"),
993
- value: {
994
- startDate: D().subtract(7, "day").format(R),
995
- endDate: D().subtract(1, "day").format(R)
996
- }
997
- }, {
998
- label: o("date.predefinedRanges.thisMonth"),
999
- value: {
1000
- startDate: D().startOf("month").format(R),
1001
- endDate: D().endOf("month").format(R)
1002
- }
1003
- }, {
1004
- label: o("date.predefinedRanges.lastMonth"),
1005
- value: {
1006
- startDate: D().subtract(1, "month").startOf("month").format(R),
1007
- endDate: D().subtract(1, "month").endOf("month").format(R)
1008
- }
1009
- }]);
1010
- function Je(e) {
1011
- var s;
1012
- return ((s = kt.find((u) => u.subject === e)) == null ? void 0 : s.label) ?? St[e];
1013
- }
1014
- function be(e) {
1015
- var u, y;
1016
- if (e.actorType === "portalUser")
1017
- return e.actorName ?? e.userId;
1018
- if (e.actorType === "feedmeAdmin")
1019
- return (u = r.sessionUser.value) != null && u.isInternal ? `${e.actorName ?? e.userId} (${o("auditLog.user.feedmeAdmin")})` : o("auditLog.user.feedmeAdmin");
1020
- const s = d.userIdToName[e.userId];
1021
- return s || (d.hasLoaded ? (y = r.sessionUser.value) != null && y.isInternal ? `${e.actorName ?? e.userId} (${o("auditLog.user.feedmeAdmin")})` : o("auditLog.user.feedmeAdmin") : e.userId);
1022
- }
1023
- function ct(e) {
1024
- return d.userIdToPhone[e.userId] || "-";
1025
- }
1026
- function Gt(e) {
1027
- return d.userIdToEmail[e.userId] || "-";
1028
- }
1029
- function ft(e) {
1030
- return D(e).format("DD MMM YYYY, HH:mm");
1031
- }
1032
- function mt(e) {
1033
- return D(e).format("DD MMM YYYY, HH:mm:ss").toUpperCase();
1034
- }
1035
- function vt(e) {
1036
- return H.value[e] ?? e;
1037
- }
1038
- function pt(e) {
1039
- return st(o, {
1040
- eventKey: e.eventKey,
1041
- params: e.params,
1042
- operationLabel: e.metadata.operationLabel ?? vt(e.action)
1043
- });
1044
- }
1045
- function gt(e) {
1046
- return st(o, e) || o("auditLog.operation.unlabeled");
1047
- }
1048
- function Xt(e) {
1049
- return Je(e.subject) ?? e.subject;
1050
- }
1051
- function He(e) {
1052
- return De.value[dt(e)];
1053
- }
1054
- function ht(e) {
1055
- return Jt[dt(e)] ?? "neutral";
1056
- }
1057
- function Qt(e) {
1058
- return zt.value[e] ?? e;
1059
- }
1060
- function Zt(e) {
1061
- return e.metadata.requestMethod ? qt.value[e.metadata.requestMethod] ?? e.metadata.requestMethod : vt(e.action);
1062
- }
1063
- function yt(e) {
1064
- const s = String(e ?? "");
1065
- return `"${(/^[=+\-@\t\r]/.test(s) ? `'${s}` : s).replace(/"/g, '""')}"`;
1066
- }
1067
- const We = [{
1068
- key: "timestamp",
1069
- labelKey: "auditLog.exportFields.timestamp",
1070
- getValue: (e) => ft(e.timestamp),
1071
- defaultSelected: !0
1072
- }, {
1073
- key: "userName",
1074
- labelKey: "auditLog.exportFields.userName",
1075
- getValue: (e) => be(e),
1076
- defaultSelected: !0
1077
- }, {
1078
- key: "userPhone",
1079
- labelKey: "auditLog.exportFields.userPhone",
1080
- getValue: (e) => ct(e),
1081
- defaultSelected: !0
1082
- }, {
1083
- key: "subject",
1084
- labelKey: "auditLog.exportFields.subject",
1085
- getValue: (e) => Je(e.subject) ?? e.subject,
1086
- defaultSelected: !0
1087
- }, {
1088
- key: "action",
1089
- labelKey: "auditLog.exportFields.action",
1090
- getValue: (e) => e.action,
1091
- defaultSelected: !0
1092
- }, {
1093
- key: "operation",
1094
- labelKey: "auditLog.exportFields.operation",
1095
- getValue: (e) => pt(e),
1096
- defaultSelected: !0
1097
- }, {
1098
- key: "outcome",
1099
- labelKey: "auditLog.exportFields.outcome",
1100
- getValue: (e) => He(e.outcome),
1101
- defaultSelected: !0
1102
- }, {
1103
- key: "operationEvents",
1104
- labelKey: "auditLog.exportFields.operationEvents",
1105
- getValue: (e) => ss(o, e.operations),
1106
- defaultSelected: !0
1107
- }, {
1108
- key: "changes",
1109
- labelKey: "auditLog.exportFields.changes",
1110
- getValue: (e) => ns(o, n, e.operations),
1111
- defaultSelected: !1
1112
- }, {
1113
- key: "businessId",
1114
- labelKey: "auditLog.exportFields.businessId",
1115
- getValue: (e) => e.businessId,
1116
- defaultSelected: !1
1117
- }, {
1118
- key: "restaurantId",
1119
- labelKey: "auditLog.exportFields.restaurantId",
1120
- getValue: (e) => e.restaurantId,
1121
- defaultSelected: !1
1122
- }, {
1123
- key: "country",
1124
- labelKey: "auditLog.exportFields.country",
1125
- getValue: (e) => e.country,
1126
- defaultSelected: !1
1127
- }, {
1128
- key: "resolvedFrom",
1129
- labelKey: "auditLog.exportFields.resolvedFrom",
1130
- getValue: (e) => {
1131
- var s;
1132
- return (s = e.metadata) == null ? void 0 : s.resolvedFrom;
1133
- },
1134
- defaultSelected: !1
1135
- }, {
1136
- key: "requestMethod",
1137
- labelKey: "auditLog.exportFields.requestMethod",
1138
- getValue: (e) => {
1139
- var s;
1140
- return (s = e.metadata) == null ? void 0 : s.requestMethod;
1141
- },
1142
- defaultSelected: !1
1143
- }, {
1144
- key: "requestPath",
1145
- labelKey: "auditLog.exportFields.requestPath",
1146
- getValue: (e) => {
1147
- var s;
1148
- return (s = e.metadata) == null ? void 0 : s.requestPath;
1149
- },
1150
- defaultSelected: !1
1151
- }, {
1152
- key: "traceId",
1153
- labelKey: "auditLog.exportFields.traceId",
1154
- getValue: (e) => e.traceId ?? "",
1155
- defaultSelected: !1
1156
- }];
1157
- function eo() {
1158
- try {
1159
- const e = localStorage.getItem(Ft);
1160
- if (e) {
1161
- const s = JSON.parse(e);
1162
- if (Array.isArray(s) && s.length > 0) return new Set(s);
1163
- }
1164
- } catch {
1165
- }
1166
- return new Set(We.filter((e) => e.defaultSelected).map((e) => e.key));
1167
- }
1168
- const ve = S(eo());
1169
- function to(e) {
1170
- const s = new Set(ve.value);
1171
- if (s.has(e)) {
1172
- if (s.size <= 1) return;
1173
- s.delete(e);
1174
- } else
1175
- s.add(e);
1176
- ve.value = s;
1177
- try {
1178
- localStorage.setItem(Ft, JSON.stringify([...s]));
1179
- } catch {
1180
- }
1181
- }
1182
- async function oo() {
1183
- var e, s, u, y, x;
1184
- if (!p.value) {
1185
- p.value = !0;
1186
- try {
1187
- const {
1188
- startDate: F,
1189
- endDate: $
1190
- } = Q.value, oe = Ke.value.subjectPrefixes, Ce = (/* @__PURE__ */ new Date()).toISOString().slice(0, 19).replace("T", " "), _e = $ ? se($) : null, Te = _e && _e < Ce ? _e : Ce, Xe = {
1191
- ...F ? {
1192
- from: se(F)
1193
- } : {},
1194
- to: Te,
1195
- ...te.value.userIds.length ? {
1196
- userIds: te.value.userIds
1197
- } : {},
1198
- ...te.value.feedmeAdminActors ? {
1199
- feedmeAdminActors: !0
1200
- } : {},
1201
- ...(e = G.value) != null && e.length ? {
1202
- subjects: G.value
1203
- } : {},
1204
- ...oe.length ? {
1205
- subjectPrefixes: [...oe]
1206
- } : {},
1207
- ...(s = ee.value) != null && s.length ? {
1208
- actions: ee.value
1209
- } : {},
1210
- ...(u = Z.value) != null && u.length ? {
1211
- outcomes: qe(Z.value)
1212
- } : {},
1213
- ...X.value ? {
1214
- search: X.value
1215
- } : {},
1216
- ...re.value.length ? {
1217
- searchUserIds: re.value
1218
- } : {},
1219
- ...me.value.length ? {
1220
- searchSubjects: me.value
1221
- } : {}
1222
- }, xe = [];
1223
- let f = 0;
1224
- for (; ; ) {
1225
- const z = await Ee.read({
1226
- ...Xe,
1227
- limit: ot,
1228
- offset: f
1229
- });
1230
- if (xe.push(...z), z.length < ot) break;
1231
- f += ot;
1232
- }
1233
- const P = We.filter((z) => ve.value.has(z.key)), go = P.map((z) => o(z.labelKey)), ho = xe.map((z) => P.map((Io) => Io.getValue(z) ?? "")), Qe = -(/* @__PURE__ */ new Date()).getTimezoneOffset(), yo = Qe >= 0 ? "+" : "-", bo = String(Math.floor(Math.abs(Qe) / 60)).padStart(2, "0"), _o = String(Math.abs(Qe) % 60).padStart(2, "0"), xo = `UTC${yo}${bo}:${_o}`, xt = ((y = r.currentBusiness.value) == null ? void 0 : y.name) || "", Lo = [F, $].filter(Boolean).join(" – "), So = [...[[o("auditLog.title")], [`${o("auditLog.frontMatter.date")}: ${Lo}`], ...xt ? [[`${o("auditLog.frontMatter.business")}: ${xt}`]] : [], [`${o("auditLog.frontMatter.generatedBy")}: ${D().format("DD MMM YYYY, HH:mm")} (${xo})`], []].map((z) => z.map(yt).join(",")), ...[go, ...ho].map((z) => z.map(yt).join(","))].join(`
1234
- `), ko = `audit-log_${(((x = r.currentBusiness.value) == null ? void 0 : x.name) || "business").replace(/[^a-z0-9_-]+/gi, "_")}_${D().format("YYYYMMDD_HHmmss")}.csv`, wo = new Blob([`\uFEFF${So}`], {
1235
- type: "text/csv;charset=utf-8;"
1236
- }), Lt = window.URL.createObjectURL(wo), Le = document.createElement("a");
1237
- Le.href = Lt, Le.download = ko, document.body.appendChild(Le), Le.click(), Le.remove(), window.URL.revokeObjectURL(Lt);
1238
- } finally {
1239
- p.value = !1;
1240
- }
1241
- }
1242
- }
1243
- function ie(e) {
1244
- return "status" in e;
1245
- }
1246
- function so(e) {
1247
- return At(e) ? m(ue.FmTooltip, {
1248
- variant: "plain",
1249
- placement: "top"
1250
- }, {
1251
- default: () => m(ue.FmIcon, {
1252
- name: "error",
1253
- size: "sm",
1254
- class: "cursor-help text-fm-color-typo-error"
1255
- }, null),
1256
- content: () => o("auditLog.operation.partialFailure")
1257
- }) : null;
1258
- }
1259
- function ao(e) {
1260
- var u;
1261
- const s = e.original;
1262
- return e.depth === 0 && !ie(s) && !!((u = s.operations) != null && u.length);
1263
- }
1264
- function no(e) {
1265
- return ie(e) ? void 0 : e.operations;
1266
- }
1267
- const lo = [{
1268
- accessorKey: "timestamp",
1269
- header: () => o("auditLog.columns.timestamp"),
1270
- cell(e) {
1271
- return ft(e.row.original.timestamp);
1272
- }
1273
- }, {
1274
- accessorKey: "userId",
1275
- header: () => o("auditLog.columns.user"),
1276
- enableSorting: !1,
1277
- size: 220,
1278
- cell(e) {
1279
- const s = e.row.original;
1280
- return ie(s) ? null : m("div", {
1281
- class: "flex items-center gap-8"
1282
- }, [m(ue.FmAvatar, {
1283
- name: be(s),
1284
- initials: No(be(s)),
1285
- size: "sm",
1286
- class: "shrink-0"
1287
- }, null), m("div", {
1288
- class: "min-w-0"
1289
- }, [m("p", {
1290
- class: "truncate font-semibold"
1291
- }, [be(s)]), m("p", {
1292
- class: "truncate text-fm-color-typo-secondary"
1293
- }, [ct(s)])])]);
1294
- }
1295
- }, {
1296
- accessorKey: "subject",
1297
- header: () => o("auditLog.columns.subject"),
1298
- cell(e) {
1299
- const s = e.row.original;
1300
- return ie(s) ? m("span", {
1301
- class: "text-fm-color-typo-secondary"
1302
- }, [o("auditLog.operation.rowHint")]) : Je(s.subject) ?? s.subject;
1303
- }
1304
- }, {
1305
- accessorKey: "action",
1306
- header: () => o("auditLog.columns.action"),
1307
- enableSorting: !1,
1308
- size: 280,
1309
- meta: {
1310
- cellSpanClass: "audit-log-action-label"
1311
- },
1312
- cell(e) {
1313
- var $;
1314
- const s = e.row.original;
1315
- if (ie(s))
1316
- return m("span", {
1317
- class: "audit-op-marker flex flex-wrap items-baseline gap-4"
1318
- }, [m("span", {
1319
- class: "text-fm-color-typo-secondary"
1320
- }, [Ve("↳")]), m("span", {
1321
- class: "font-semibold"
1322
- }, [gt(s)]), s.entityId ? m("span", {
1323
- class: "text-fm-color-typo-secondary"
1324
- }, [Ve("· "), s.entityId]) : null, s.status === "failed" && s.errorMessage ? m("span", {
1325
- class: "text-fm-color-typo-error"
1326
- }, [Ve("· "), s.errorMessage]) : null]);
1327
- const u = (($ = s.operations) == null ? void 0 : $.length) ?? 0, y = (oe) => {
1328
- oe.stopPropagation(), e.row.getToggleExpandedHandler()();
1329
- }, x = {
1330
- variant: "tertiary",
1331
- icon: e.row.getIsExpanded() ? "keyboard_arrow_up" : "keyboard_arrow_down",
1332
- "aria-label": o("auditLog.operation.toggle"),
1333
- class: "ml-auto shrink-0",
1334
- onClick: y
1335
- }, F = ue.FmButton;
1336
- return m("span", {
1337
- class: "flex items-center gap-8"
1338
- }, [m("span", null, [pt(s)]), u > 0 ? m("span", {
1339
- class: "cursor-pointer",
1340
- onClick: y
1341
- }, [m(ue.FmChip, {
1342
- variant: "neutral",
1343
- compact: !0,
1344
- label: o("auditLog.operation.badge", {
1345
- count: u
1346
- })
1347
- }, null)]) : null, e.row.getCanExpand() ? m(F, x, null) : null]);
1348
- }
1349
- }, {
1350
- accessorKey: "outcome",
1351
- header: () => o("auditLog.columns.outcome"),
1352
- enableSorting: !1,
1353
- cell(e) {
1354
- const s = e.row.original;
1355
- return ie(s) ? m(ue.FmChip, {
1356
- variant: s.status === "failed" ? "critical" : "success",
1357
- label: s.status === "failed" ? o("auditLog.outcome.failed") : o("auditLog.outcome.success"),
1358
- compact: !0
1359
- }, null) : m("span", {
1360
- class: "flex items-center gap-4"
1361
- }, [m(ue.FmChip, {
1362
- variant: ht(s.outcome),
1363
- label: He(s.outcome),
1364
- compact: !0
1365
- }, null), so(s)]);
1366
- }
1367
- }];
1368
- function se(e) {
1369
- const s = D(e, cn);
1370
- return new Date(s.year(), s.month(), s.date(), s.hour(), s.minute(), 0).toISOString().slice(0, 19).replace("T", " ");
1371
- }
1372
- async function bt() {
1373
- var e, s, u;
1374
- g.value = !0;
1375
- try {
1376
- const {
1377
- startDate: y,
1378
- endDate: x
1379
- } = Q.value, F = (Fe.value - 1) * ke, $ = Ke.value.subjectPrefixes, oe = await Ee.read({
1380
- limit: ke,
1381
- offset: F,
1382
- ...y ? {
1383
- from: se(y)
1384
- } : {},
1385
- ...x ? {
1386
- to: se(x)
1387
- } : {},
1388
- ...te.value.userIds.length ? {
1389
- userIds: te.value.userIds
1390
- } : {},
1391
- ...te.value.feedmeAdminActors ? {
1392
- feedmeAdminActors: !0
1393
- } : {},
1394
- ...(e = G.value) != null && e.length ? {
1395
- subjects: G.value
1396
- } : {},
1397
- ...$.length ? {
1398
- subjectPrefixes: [...$]
1399
- } : {},
1400
- ...(s = ee.value) != null && s.length ? {
1401
- actions: ee.value
1402
- } : {},
1403
- ...(u = Z.value) != null && u.length ? {
1404
- outcomes: qe(Z.value)
1405
- } : {},
1406
- ...X.value ? {
1407
- search: X.value
1408
- } : {},
1409
- ...re.value.length ? {
1410
- searchUserIds: re.value
1411
- } : {},
1412
- ...me.value.length ? {
1413
- searchSubjects: me.value
1414
- } : {}
1415
- });
1416
- h.value = oe, Vt.value = oe.length === ke, O.value = {};
1417
- } finally {
1418
- g.value = !1;
1419
- }
1420
- }
1421
- const _t = A(() => {
1422
- var e;
1423
- return JSON.stringify({
1424
- businessId: ((e = r.currentBusiness.value) == null ? void 0 : e._id) ?? "",
1425
- dateRange: Q.value,
1426
- users: [...fe.value ?? []].sort(),
1427
- subjects: [...G.value ?? []].sort(),
1428
- outcomes: [...Z.value ?? []].sort(),
1429
- actions: [...ee.value ?? []].sort(),
1430
- moduleKey: le.value,
1431
- search: X.value,
1432
- // Member/feedme-admin-actor lists resolve asynchronously (and actors refetch on
1433
- // every date-range change), so searchUserIds can change after the key above is
1434
- // computed — include it explicitly or a late-arriving match never refetches.
1435
- searchUserIds: [...re.value].sort()
1436
- });
1437
- });
1438
- async function ro() {
1439
- var y, x, F;
1440
- const {
1441
- startDate: e,
1442
- endDate: s
1443
- } = Q.value, u = Ke.value.subjectPrefixes;
1444
- Re.value = await Ee.count({
1445
- ...e ? {
1446
- from: se(e)
1447
- } : {},
1448
- ...s ? {
1449
- to: se(s)
1450
- } : {},
1451
- ...te.value.userIds.length ? {
1452
- userIds: te.value.userIds
1453
- } : {},
1454
- ...te.value.feedmeAdminActors ? {
1455
- feedmeAdminActors: !0
1456
- } : {},
1457
- ...(y = G.value) != null && y.length ? {
1458
- subjects: G.value
1459
- } : {},
1460
- ...u.length ? {
1461
- subjectPrefixes: [...u]
1462
- } : {},
1463
- ...(x = ee.value) != null && x.length ? {
1464
- actions: ee.value
1465
- } : {},
1466
- ...(F = Z.value) != null && F.length ? {
1467
- outcomes: qe(Z.value)
1468
- } : {},
1469
- ...X.value ? {
1470
- search: X.value
1471
- } : {},
1472
- ...re.value.length ? {
1473
- searchUserIds: re.value
1474
- } : {},
1475
- ...me.value.length ? {
1476
- searchSubjects: me.value
1477
- } : {}
1478
- });
1479
- }
1480
- de(_t, async () => {
1481
- var e;
1482
- Fe.value = 1, (e = r.currentBusiness.value) != null && e._id && await Promise.all([ro(), bt()]);
1483
- }, {
1484
- immediate: !0
1485
- }), de(le, () => {
1486
- G.value = void 0;
1487
- });
1488
- let Ge = !1;
1489
- async function io({
1490
- pageIndex: e
1491
- }) {
1492
- var s;
1493
- if ((s = r.currentBusiness.value) != null && s._id && !(e === 0 && Fe.value === 1) && !Ge) {
1494
- Ge = !0, Fe.value = e + 1;
1495
- try {
1496
- await bt();
1497
- } finally {
1498
- Ge = !1;
1499
- }
1500
- }
1501
- }
1502
- function uo(e) {
1503
- if (ie(e)) {
1504
- fo(e);
1505
- return;
1506
- }
1507
- i.value = e, C.value = !0;
1508
- }
1509
- function co() {
1510
- C.value = !1, i.value = null;
1511
- }
1512
- function fo(e) {
1513
- k.value = e, V.value = !0;
1514
- }
1515
- function mo() {
1516
- V.value = !1, k.value = null;
1517
- }
1518
- de(r.currentBusiness, (e) => {
1519
- e && d.readTeamMembers();
1520
- }, {
1521
- immediate: !0
1522
- });
1523
- function vo() {
1524
- const e = fe.value;
1525
- if (!(e != null && e.length)) return;
1526
- const s = new Set(ye.value.map((x) => x.userId)), u = new Set(d.members.map((x) => x.doc.userId)), y = e.filter((x) => x === $e ? Oe.value : d.hasLoaded ? u.has(x) || s.has(x) : !0);
1527
- y.length !== e.length && (fe.value = y.length ? y : void 0);
1528
- }
1529
- async function po() {
1530
- var u;
1531
- if (!((u = r.currentBusiness.value) != null && u._id)) return;
1532
- const {
1533
- startDate: e,
1534
- endDate: s
1535
- } = Q.value;
1536
- try {
1537
- const {
1538
- actors: y,
1539
- showFeedmeAdminFilter: x
1540
- } = await Ee.getFeedmeAdminFilter({
1541
- ...e ? {
1542
- from: se(e)
1543
- } : {},
1544
- ...s ? {
1545
- to: se(s)
1546
- } : {}
1547
- });
1548
- ye.value = y, Oe.value = x;
1549
- } catch {
1550
- ye.value = [], Oe.value = !1;
1551
- }
1552
- vo();
1553
- }
1554
- return de(() => {
1555
- var e;
1556
- return {
1557
- businessId: (e = r.currentBusiness.value) == null ? void 0 : e._id,
1558
- range: Q.value
1559
- };
1560
- }, () => po(), {
1561
- immediate: !0,
1562
- deep: !0
1563
- }), (e, s) => {
1564
- const u = N("FmSpacer"), y = N("FmButton"), x = N("FmMenuItem"), F = N("FmMenu"), $ = N("FmChip"), oe = N("FmDateRangePicker"), Ce = N("FmSearch"), _e = N("FmTable"), Te = N("FmIcon"), Xe = N("FmTooltip"), xe = N("FmSideSheet");
1565
- return v(), b(q, null, [m(To, {
1566
- heading: c(o)("auditLog.title")
1567
- }, {
1568
- "append-heading": B(() => [m(u), m(y, {
1569
- variant: "primary",
1570
- "prepend-icon": "upload",
1571
- label: c(o)("auditLog.export"),
1572
- disabled: h.value.length === 0 || p.value || c(d).isLoading || c(d).members.length === 0,
1573
- loading: p.value,
1574
- onClick: oo
1575
- }, null, 8, ["label", "disabled", "loading"]), m(F, {
1576
- "close-on-click": !1,
1577
- "z-index": 50
1578
- }, {
1579
- "menu-button": B(() => [m(y, {
1580
- variant: "tertiary",
1581
- icon: "settings",
1582
- "aria-label": c(o)("auditLog.exportSettings.title"),
1583
- disabled: p.value
1584
- }, null, 8, ["aria-label", "disabled"])]),
1585
- default: B(() => [a("div", ls, [a("p", rs, l(c(o)("auditLog.exportSettings.title")), 1), (v(), b(q, null, ae(We, (f) => m(x, {
1586
- key: f.key,
1587
- label: c(o)(f.labelKey),
1588
- "has-checkbox": "",
1589
- "model-value": ve.value.has(f.key),
1590
- disabled: ve.value.has(f.key) && ve.value.size === 1,
1591
- onClick: (P) => to(f.key)
1592
- }, null, 8, ["label", "model-value", "disabled", "onClick"])), 64))])]),
1593
- _: 1
1594
- })]),
1595
- default: B(() => [a("div", is, [a("div", us, [m(zo, {
1596
- modelValue: le.value,
1597
- "onUpdate:modelValue": s[0] || (s[0] = (f) => le.value = f),
1598
- items: Et.value
1599
- }, null, 8, ["modelValue", "items"]), a("div", ds, [m(oe, {
1600
- modelValue: Q.value,
1601
- "onUpdate:modelValue": s[1] || (s[1] = (f) => Q.value = f),
1602
- "show-predefined-range": "",
1603
- "show-time": "",
1604
- "predefined-range": Wt.value
1605
- }, {
1606
- "trigger-button": B(() => [m($, {
1607
- label: Ht.value,
1608
- icon: "calendar_month"
1609
- }, null, 8, ["label"])]),
1610
- _: 1
1611
- }, 8, ["modelValue", "predefined-range"]), a("div", cs, [m(Pe, {
1612
- modelValue: fe.value,
1613
- "onUpdate:modelValue": s[2] || (s[2] = (f) => fe.value = f),
1614
- items: Nt.value,
1615
- multiple: "",
1616
- variant: "dark",
1617
- placeholder: c(o)("auditLog.filter.user_placeholder"),
1618
- "selected-prefix": c(o)("auditLog.filter.selected_user_prefix"),
1619
- "chip-icon": "account_circle"
1620
- }, null, 8, ["modelValue", "items", "placeholder", "selected-prefix"])]), a("div", fs, [m(Pe, {
1621
- modelValue: G.value,
1622
- "onUpdate:modelValue": s[3] || (s[3] = (f) => G.value = f),
1623
- items: Rt.value,
1624
- "filter-fn": Kt,
1625
- multiple: "",
1626
- variant: "dark",
1627
- placeholder: c(o)("auditLog.filter.subject_placeholder"),
1628
- "selected-prefix": c(o)("auditLog.filter.selected_subject_prefix"),
1629
- "chip-icon": "badge"
1630
- }, null, 8, ["modelValue", "items", "placeholder", "selected-prefix"])]), a("div", ms, [m(Pe, {
1631
- modelValue: ee.value,
1632
- "onUpdate:modelValue": s[4] || (s[4] = (f) => ee.value = f),
1633
- items: Bt.value,
1634
- multiple: "",
1635
- variant: "dark",
1636
- placeholder: c(o)("auditLog.filter.action_placeholder"),
1637
- "selected-prefix": c(o)("auditLog.filter.selected_action_prefix"),
1638
- searchable: !1
1639
- }, null, 8, ["modelValue", "items", "placeholder", "selected-prefix"])]), a("div", vs, [m(Pe, {
1640
- modelValue: Z.value,
1641
- "onUpdate:modelValue": s[5] || (s[5] = (f) => Z.value = f),
1642
- items: Yt.value,
1643
- multiple: "",
1644
- variant: "dark",
1645
- placeholder: c(o)("auditLog.filter.status_placeholder"),
1646
- "selected-prefix": c(o)("auditLog.filter.selected_status_prefix"),
1647
- searchable: !1,
1648
- "chip-icon": "check_circle"
1649
- }, null, 8, ["modelValue", "items", "placeholder", "selected-prefix"])]), m(Ce, {
1650
- modelValue: Be.value,
1651
- "onUpdate:modelValue": s[6] || (s[6] = (f) => Be.value = f),
1652
- class: "ml-auto w-[280px]",
1653
- placeholder: c(o)("auditLog.search.placeholder")
1654
- }, null, 8, ["modelValue", "placeholder"])])]), m(Co, null, {
1655
- default: B(() => [a("div", ps, [m(Vo, {
1656
- "is-loading": g.value,
1657
- "is-empty": h.value.length === 0,
1658
- title: c(o)("auditLog.noData.title"),
1659
- subtitle: c(o)("auditLog.noData.subtitle")
1660
- }, {
1661
- default: B(() => [(v(), we(_e, {
1662
- key: _t.value,
1663
- "column-defs": lo,
1664
- "row-data": h.value,
1665
- "page-size": ke,
1666
- "page-count": lt.value,
1667
- "row-count": Re.value,
1668
- "fetch-fn": io,
1669
- "hide-footer": lt.value <= 1,
1670
- loading: g.value,
1671
- "expanded-state": O.value,
1672
- "get-row-can-expand": ao,
1673
- "get-sub-row": no,
1674
- "pin-header-row": "",
1675
- class: "audit-log-list-table cursor-pointer",
1676
- "onUpdate:expandedState": s[7] || (s[7] = (f) => O.value = f),
1677
- onRowClick: s[8] || (s[8] = (f) => uo(f.original))
1678
- }, null, 8, ["row-data", "page-count", "row-count", "hide-footer", "loading", "expanded-state"]))]),
1679
- _: 1
1680
- }, 8, ["is-loading", "is-empty", "title", "subtitle"])])]),
1681
- _: 1
1682
- })])]),
1683
- _: 1
1684
- }, 8, ["heading"]), m(xe, {
1685
- header: c(o)("auditLog.detail.header"),
1686
- "model-value": C.value,
1687
- "max-width": 768,
1688
- "dismiss-away": "",
1689
- "onUpdate:modelValue": s[9] || (s[9] = (f) => {
1690
- f || co();
1691
- })
1692
- }, {
1693
- default: B(() => [i.value ? (v(), b("div", gs, [a("div", hs, [a("div", ys, [a("p", bs, l(Xt(i.value)), 1), i.value.traceId ? (v(), b("p", _s, " Trace ID: " + l(i.value.traceId), 1)) : j("", !0)]), a("div", xs, [m($, {
1694
- variant: ht(i.value.outcome),
1695
- label: He(i.value.outcome),
1696
- compact: ""
1697
- }, null, 8, ["variant", "label"]), c(At)(i.value) ? (v(), we(Xe, {
1698
- key: 0,
1699
- variant: "plain",
1700
- placement: "top"
1701
- }, {
1702
- content: B(() => [Ve(l(c(o)("auditLog.operation.partialFailure")), 1)]),
1703
- default: B(() => [m(Te, {
1704
- name: "error",
1705
- size: "sm",
1706
- class: "cursor-help text-fm-color-typo-error"
1707
- })]),
1708
- _: 1
1709
- })) : j("", !0)])]), a("div", Ls, [a("div", Ss, [a("div", null, [a("p", ks, l(c(o)("auditLog.detail.date")), 1), a("p", ws, l(mt(i.value.timestamp)), 1)]), a("div", null, [a("p", Is, l(c(o)("auditLog.detail.user")), 1), a("p", As, l(be(i.value)), 1)]), a("div", null, [a("p", Fs, l(c(o)("auditLog.detail.email")), 1), a("p", Ms, l(Gt(i.value)), 1)]), i.value.field ? (v(), b("div", Os, [a("p", Ds, l(c(o)("auditLog.detail.field")), 1), a("p", js, l(i.value.field), 1)])) : j("", !0), a("div", null, [a("p", Cs, l(c(o)("auditLog.detail.business")), 1), a("p", Ts, l(i.value.businessId || "-"), 1)]), a("div", null, [a("p", Vs, l(c(o)("auditLog.detail.restaurant")), 1), a("p", Ps, l(i.value.restaurantId || "-"), 1)])])]), a("div", Es, [a("div", $s, [a("p", Ns, l(c(o)("auditLog.detail.eventDetails")), 1)]), s[12] || (s[12] = a("hr", {
1710
- class: "border-fm-color-border-default"
1711
- }, null, -1)), a("div", Us, [a("div", null, [a("p", Rs, l(c(o)("auditLog.detail.actionDescription")), 1), a("p", Ks, l(i.value.metadata.operationLabel || "-"), 1)])])]), a("div", Bs, [a("div", Ys, [a("p", zs, l(c(o)("auditLog.detail.metadata")), 1)]), s[13] || (s[13] = a("hr", {
1712
- class: "border-fm-color-border-default"
1713
- }, null, -1)), a("div", qs, [a("div", null, [a("p", Js, l(c(o)("auditLog.detail.resolvedFrom")), 1), a("p", Hs, l(Qt(i.value.metadata.resolvedFrom)), 1)]), (i.value.metadata.resolvedFrom === "permissionSet" || i.value.metadata.resolvedFrom === "systemPermissionSet") && (i.value.metadata.permissionSetName || i.value.metadata.permissionSetId) ? (v(), b("div", Ws, [a("p", Gs, l(c(o)("auditLog.detail.permissionSet")), 1), i.value.metadata.permissionSetName ? (v(), b("p", Xs, l(i.value.metadata.permissionSetName), 1)) : j("", !0), i.value.metadata.permissionSetId ? (v(), b("p", Qs, l(i.value.metadata.permissionSetId), 1)) : j("", !0)])) : j("", !0), i.value.metadata.reason ? (v(), b("div", Zs, [a("p", ea, l(c(o)("auditLog.detail.reason")), 1), a("p", ta, l(i.value.metadata.reason), 1)])) : j("", !0), a("div", null, [a("p", oa, l(c(o)("auditLog.detail.requestMethod")), 1), a("p", sa, l(Zt(i.value)), 1)]), a("div", null, [a("p", aa, l(c(o)("auditLog.detail.requestPath")), 1), a("p", na, l(i.value.metadata.requestPath || "-"), 1)]), i.value.metadata.trace && i.value.metadata.trace.length > 0 ? (v(), b("div", la, [a("p", ra, l(c(o)("auditLog.detail.permissionTrace")), 1), a("ol", ia, [(v(!0), b(q, null, ae(i.value.metadata.trace, (f, P) => (v(), b("li", {
1714
- key: P,
1715
- class: "flex items-center gap-6"
1716
- }, [a("span", ua, l(P + 1), 1), a("span", da, l(f), 1), P < i.value.metadata.trace.length - 1 ? (v(), b("span", ca, "→")) : j("", !0)]))), 128))])])) : j("", !0), I.value ? (v(), b("div", fa, [a("p", ma, l(c(o)("auditLog.detail.requestBody")), 1), a("pre", va, l(I.value), 1)])) : j("", !0)])])])) : j("", !0)]),
1717
- _: 1
1718
- }, 8, ["header", "model-value"]), m(xe, {
1719
- header: c(o)("auditLog.operation.sheetHeader"),
1720
- "model-value": V.value,
1721
- "max-width": 768,
1722
- "dismiss-away": "",
1723
- "onUpdate:modelValue": s[11] || (s[11] = (f) => {
1724
- f || mo();
1725
- })
1726
- }, {
1727
- default: B(() => [k.value ? (v(), b("div", pa, [a("div", ga, [a("div", ha, [a("p", ya, l(gt(k.value)), 1), k.value.entityId ? (v(), b("p", ba, l(k.value.entityId), 1)) : j("", !0)]), m($, {
1728
- variant: k.value.status === "failed" ? "critical" : "success",
1729
- label: k.value.status === "failed" ? c(o)("auditLog.outcome.failed") : c(o)("auditLog.outcome.success"),
1730
- compact: ""
1731
- }, null, 8, ["variant", "label"])]), a("div", _a, [a("div", xa, [a("div", null, [a("p", La, l(c(o)("auditLog.detail.date")), 1), a("p", Sa, l(mt(k.value.timestamp)), 1)]), k.value.entityId ? (v(), b("div", ka, [a("p", wa, l(c(o)("auditLog.operation.entity")), 1), a("p", Ia, l(k.value.entityId), 1)])) : j("", !0), k.value.durationMs !== void 0 ? (v(), b("div", Aa, [a("p", Fa, l(c(o)("auditLog.operation.duration")), 1), a("p", Ma, l(c(o)("auditLog.operation.durationValue", {
1732
- ms: k.value.durationMs
1733
- })), 1)])) : j("", !0)])]), k.value.status === "failed" ? (v(), b("div", Oa, [a("p", Da, l(c(o)("auditLog.operation.error")), 1), a("p", ja, l(k.value.errorMessage || "-"), 1)])) : j("", !0), a("div", Ca, [a("div", Ta, [a("p", Va, l(c(o)("auditLog.operation.changes")), 1)]), s[16] || (s[16] = a("hr", {
1734
- class: "border-fm-color-border-default"
1735
- }, null, -1)), a("div", Pa, [E.value.length ? (v(), b("div", Ea, [(v(!0), b(q, null, ae(E.value, (f, P) => (v(), b("div", {
1736
- key: P,
1737
- class: "space-y-4 py-8 first:pt-0 last:pb-0"
1738
- }, [a("div", $a, [m($, {
1739
- variant: at(f.type),
1740
- label: J(f.type),
1741
- compact: ""
1742
- }, null, 8, ["variant", "label"]), a("span", Na, l(he(f)), 1)]), a("p", Ua, [f.type === "add" ? (v(), b("span", Ra, l(f.afterDisplay), 1)) : f.type === "remove" ? (v(), b("span", Ka, l(f.beforeDisplay), 1)) : (v(), b(q, {
1743
- key: 2
1744
- }, [a("span", Ba, l(f.beforeDisplay), 1), s[14] || (s[14] = a("span", {
1745
- class: "text-fm-color-typo-secondary"
1746
- }, " → ", -1)), a("span", Ya, l(f.afterDisplay), 1)], 64))])]))), 128))])) : nt.value.length ? (v(), b("div", za, [(v(!0), b(q, null, ae(nt.value, (f) => (v(), b("div", {
1747
- key: f.groupKey,
1748
- class: "space-y-4 py-8 first:pt-0 last:pb-0"
1749
- }, [a("div", qa, [m($, {
1750
- variant: ce(f.type),
1751
- label: ne(f.type),
1752
- compact: ""
1753
- }, null, 8, ["variant", "label"]), a("span", Ja, l(f.displayKey), 1)]), a("div", Ha, [(v(!0), b(q, null, ae(f.rows, (P) => (v(), b("p", {
1754
- key: P.path,
1755
- class: "break-all font-mono text-xs"
1756
- }, [P.type === "added" ? (v(), b("span", Wa, l(P.after ?? "—"), 1)) : P.type === "removed" ? (v(), b("span", Ga, l(P.before ?? "—"), 1)) : (v(), b(q, {
1757
- key: 2
1758
- }, [a("span", Xa, l(P.before ?? "—"), 1), s[15] || (s[15] = a("span", {
1759
- class: "text-fm-color-typo-secondary"
1760
- }, " → ", -1)), a("span", Qa, l(P.after ?? "—"), 1)], 64))]))), 128))])]))), 128))])) : (v(), b("p", Za, l(c(o)("auditLog.operation.noChanges")), 1))])]), T.value || Y.value ? (v(), b("div", en, [a("button", {
1761
- type: "button",
1762
- class: "flex w-full items-center justify-between p-12 text-left",
1763
- onClick: s[10] || (s[10] = (f) => U.value = !U.value)
1764
- }, [a("p", tn, l(c(o)("auditLog.operation.showData")), 1), m(Te, {
1765
- name: "keyboard_arrow_down",
1766
- class: Do(["shrink-0 transition-transform", U.value ? "rotate-180" : ""])
1767
- }, null, 8, ["class"])]), U.value ? (v(), b(q, {
1768
- key: 0
1769
- }, [s[17] || (s[17] = a("hr", {
1770
- class: "border-fm-color-border-default"
1771
- }, null, -1)), a("div", on, [T.value ? (v(), b("div", sn, [a("p", an, l(c(o)("auditLog.operation.before")), 1), a("pre", nn, l(T.value), 1)])) : j("", !0), Y.value ? (v(), b("div", ln, [a("p", rn, l(c(o)("auditLog.operation.after")), 1), a("pre", un, l(Y.value), 1)])) : j("", !0)])], 64)) : j("", !0)])) : j("", !0)])) : j("", !0)]),
1772
- _: 1
1773
- }, 8, ["header", "model-value"])], 64);
1774
- };
1775
- }
1776
- }), Mn = /* @__PURE__ */ Uo(fn, [["__scopeId", "data-v-f7aebfad"]]);
1777
- export {
1778
- Mn as default
1779
- };