@feedmepos/mf-hrm-portal 2.2.2 → 2.2.3

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