@feedmepos/mf-hrm-portal 2.1.0 → 2.1.1-dev.2

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