@feedmepos/mf-hrm-portal 2.0.8-dev.12 → 2.0.8-dev.13

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 (27) hide show
  1. package/dist/AuditLogList-Cj2xXdHG.js +735 -0
  2. package/dist/{EmployeeList-CVnIGntI.js → EmployeeList-CTei88Z-.js} +5 -5
  3. package/dist/{Main-CMiYmjMk.js → Main-UZKIBbhP.js} +9 -9
  4. package/dist/{Main-bmpvqNUB.js → Main-YOsPWA5i.js} +4 -4
  5. package/dist/{Main-q8IGKAH2.js → Main-ffhglNE6.js} +6 -6
  6. package/dist/{PermissionSetList-0kvdLTQ2.js → PermissionSetList-CDwUZEDC.js} +5 -5
  7. package/dist/{PortalPermissionEditor.vue_vue_type_script_setup_true_lang-DdwUIbD4.js → PortalPermissionEditor.vue_vue_type_script_setup_true_lang-CJB_D-js.js} +879 -879
  8. package/dist/{RoleList-DjxZzgZk.js → RoleList-D0eFBPPz.js} +7 -7
  9. package/dist/{TeamMemberList-PmbUeFns.js → TeamMemberList-CZt85DOo.js} +8 -8
  10. package/dist/{TimesheetList-Cs_8p1TE.js → TimesheetList-4q6a8LDx.js} +7 -7
  11. package/dist/{app-PYFafU8x.js → app-ToDa5jSo.js} +4 -4
  12. package/dist/app.js +1 -1
  13. package/dist/{dayjs.min-DjR87Y9e.js → dayjs.min-EReIS4rK.js} +1 -1
  14. package/dist/{employee-snwYlork.js → employee-B3EpasYr.js} +4 -4
  15. package/dist/{index-QNkZDIo5.js → index-DCuwuFh8.js} +2 -2
  16. package/dist/{index-DPEw4kQP.js → index-R4S96vIE.js} +1 -1
  17. package/dist/{iteration-BwzU2yPh.js → iteration-yUKJnIop.js} +1 -1
  18. package/dist/{lodash-8jIJCGdn.js → lodash-7RAXVJQB.js} +1 -1
  19. package/dist/src/api/audit-log/index.d.ts +1 -0
  20. package/dist/{team-Dl33dbDU.js → team-HoPvaH9h.js} +1 -1
  21. package/dist/{timesheet-BVMwsxuV.js → timesheet-BuTUEVgV.js} +3 -3
  22. package/dist/tsconfig.app.tsbuildinfo +1 -1
  23. package/dist/{useAppStore-gNcJGfxF.js → useAppStore-Ba_6tRe5.js} +1 -1
  24. package/dist/{useLoading-DuapEOya.js → useLoading-Bv16lZo3.js} +1 -1
  25. package/dist/{useReportPermissions-C-f7TyvQ.js → useReportPermissions-CJx0JVuf.js} +3 -3
  26. package/package.json +1 -1
  27. package/dist/AuditLogList-CZSE61OK.js +0 -708
@@ -0,0 +1,735 @@
1
+ import { defineComponent as Qe, ref as _, computed as b, watch as G, resolveComponent as w, createElementBlock as p, openBlock as m, Fragment as le, createVNode as u, unref as s, withCtx as M, createElementVNode as o, createBlock as ge, createCommentVNode as h, toDisplayString as n, renderList as _e } from "vue";
2
+ import { d as X } from "./dayjs.min-EReIS4rK.js";
3
+ import { useI18n as We, useCoreStore as et } from "@feedmepos/mf-common";
4
+ import { h as se, F as be, _ as tt } from "./app-ToDa5jSo.js";
5
+ import { components as he } from "@feedmepos/ui-library";
6
+ import { g as ot, b as at } from "./iteration-yUKJnIop.js";
7
+ import { S as Z } from "./SelectFilter-DUj7GBtT.js";
8
+ import { _ as lt } from "./PageLayout.vue_vue_type_script_setup_true_lang-HKK4cbW8.js";
9
+ import { _ as st } from "./index.vue_vue_type_script_setup_true_lang-Vc5ARO29.js";
10
+ import { p as ye } from "./index-DCuwuFh8.js";
11
+ import { u as nt } from "./team-HoPvaH9h.js";
12
+ const it = "/audit-logs", xe = {
13
+ async read(i) {
14
+ var R, x, P, k, F;
15
+ const a = {
16
+ limit: (i == null ? void 0 : i.limit) ?? 100,
17
+ offset: (i == null ? void 0 : i.offset) ?? 0,
18
+ ...i != null && i.from ? { from: i.from } : {},
19
+ ...i != null && i.to ? { to: i.to } : {},
20
+ ...(R = i == null ? void 0 : i.userIds) != null && R.length ? { userIds: i.userIds } : {},
21
+ ...(x = i == null ? void 0 : i.subjects) != null && x.length ? { subjects: i.subjects } : {},
22
+ ...(P = i == null ? void 0 : i.subjectPrefixes) != null && P.length ? { subjectPrefixes: i.subjectPrefixes } : {},
23
+ ...(k = i == null ? void 0 : i.actions) != null && k.length ? { actions: i.actions } : {},
24
+ ...(F = i == null ? void 0 : i.outcomes) != null && F.length ? { outcomes: i.outcomes } : {}
25
+ };
26
+ return console.log("[AuditLogAPI] request params:", a), ot(
27
+ await at().get(it, {
28
+ params: a,
29
+ // Serialize arrays as repeated params: key=val1&key=val2
30
+ // (NestJS @Query expects this; axios default adds brackets which break matching)
31
+ paramsSerializer: (l) => {
32
+ const I = new URLSearchParams();
33
+ for (const [g, L] of Object.entries(l))
34
+ if (Array.isArray(L))
35
+ for (const z of L) I.append(g, String(z));
36
+ else L != null && I.append(g, String(L));
37
+ return console.log("[AuditLogAPI] serialized query string:", I.toString()), I.toString();
38
+ }
39
+ })
40
+ );
41
+ }
42
+ }, dt = {
43
+ class: "flex flex-col gap-4 p-12 w-[260px]"
44
+ }, ut = {
45
+ class: "text-xs font-semibold text-fm-color-typo-secondary mb-4"
46
+ }, rt = {
47
+ class: "flex min-h-0 flex-1 flex-col gap-16"
48
+ }, ct = {
49
+ class: "space-y-16"
50
+ }, mt = {
51
+ class: "flex flex-wrap items-center gap-8"
52
+ }, ft = {
53
+ class: "w-fit"
54
+ }, pt = {
55
+ key: 0,
56
+ class: "w-fit"
57
+ }, vt = {
58
+ class: "w-fit"
59
+ }, gt = {
60
+ class: "w-fit"
61
+ }, _t = {
62
+ class: "flex h-full flex-col"
63
+ }, bt = {
64
+ key: 0,
65
+ class: "flex shrink-0 items-center justify-end border-t border-fm-color-border-default py-4"
66
+ }, ht = {
67
+ class: "text-sm text-fm-color-typo-secondary"
68
+ }, yt = {
69
+ key: 0,
70
+ class: "space-y-12 p-4 text-sm"
71
+ }, xt = {
72
+ class: "flex items-start justify-between gap-8 rounded-lg border border-fm-color-border-default p-12"
73
+ }, Lt = {
74
+ class: "min-w-0 flex-1"
75
+ }, St = {
76
+ class: "audit-log-operation-label-detail text-base font-bold leading-snug text-fm-color-typo-primary"
77
+ }, kt = {
78
+ class: "rounded-lg border border-fm-color-border-default p-12"
79
+ }, wt = {
80
+ class: "space-y-12"
81
+ }, Ft = {
82
+ class: "text-xs text-fm-color-typo-secondary"
83
+ }, It = {
84
+ class: "font-semibold"
85
+ }, Vt = {
86
+ class: "text-xs text-fm-color-typo-secondary"
87
+ }, Pt = {
88
+ class: "font-semibold"
89
+ }, Tt = {
90
+ class: "text-xs text-fm-color-typo-secondary"
91
+ }, Et = {
92
+ class: "break-all font-semibold"
93
+ }, Ot = {
94
+ class: "text-xs text-fm-color-typo-secondary"
95
+ }, Ct = {
96
+ class: "font-semibold"
97
+ }, jt = {
98
+ key: 0
99
+ }, Dt = {
100
+ class: "text-xs text-fm-color-typo-secondary"
101
+ }, Mt = {
102
+ class: "break-all font-mono text-xs font-semibold"
103
+ }, At = {
104
+ class: "text-xs text-fm-color-typo-secondary"
105
+ }, Ut = {
106
+ class: "break-all font-mono text-xs font-semibold"
107
+ }, Nt = {
108
+ class: "text-xs text-fm-color-typo-secondary"
109
+ }, Kt = {
110
+ class: "font-semibold"
111
+ }, Rt = {
112
+ key: 0,
113
+ class: "rounded-lg border border-fm-color-border-default"
114
+ }, qt = {
115
+ class: "p-12"
116
+ }, Bt = {
117
+ class: "text-base font-bold text-fm-color-typo-primary"
118
+ }, Yt = {
119
+ class: "space-y-12 p-12"
120
+ }, zt = {
121
+ class: "text-xs text-fm-color-typo-secondary"
122
+ }, $t = {
123
+ class: "font-semibold"
124
+ }, Ht = {
125
+ class: "rounded-lg border border-fm-color-border-default"
126
+ }, Jt = {
127
+ class: "p-12"
128
+ }, Gt = {
129
+ class: "text-base font-bold text-fm-color-typo-primary"
130
+ }, Xt = {
131
+ class: "space-y-12 p-12"
132
+ }, Zt = {
133
+ class: "text-xs text-fm-color-typo-secondary"
134
+ }, Qt = {
135
+ class: "font-semibold"
136
+ }, Wt = {
137
+ key: 0
138
+ }, eo = {
139
+ class: "text-xs text-fm-color-typo-secondary"
140
+ }, to = {
141
+ key: 0,
142
+ class: "font-semibold"
143
+ }, oo = {
144
+ key: 1,
145
+ class: "break-all font-mono text-xs text-fm-color-typo-secondary"
146
+ }, ao = {
147
+ key: 1
148
+ }, lo = {
149
+ class: "text-xs text-fm-color-typo-secondary"
150
+ }, so = {
151
+ class: "font-semibold whitespace-pre-line"
152
+ }, no = {
153
+ class: "text-xs text-fm-color-typo-secondary"
154
+ }, io = {
155
+ class: "font-semibold"
156
+ }, uo = {
157
+ class: "text-xs text-fm-color-typo-secondary"
158
+ }, ro = {
159
+ class: "break-all font-mono text-xs font-semibold"
160
+ }, co = {
161
+ key: 2
162
+ }, mo = {
163
+ class: "text-xs text-fm-color-typo-secondary"
164
+ }, fo = {
165
+ class: "mt-4 space-y-4"
166
+ }, po = {
167
+ 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"
168
+ }, vo = {
169
+ class: "text-xs font-semibold"
170
+ }, go = {
171
+ key: 0,
172
+ class: "text-fm-color-typo-secondary"
173
+ }, _o = {
174
+ key: 3
175
+ }, bo = {
176
+ class: "text-xs text-fm-color-typo-secondary"
177
+ }, ho = {
178
+ 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"
179
+ }, ne = 100, ie = 1e3, Le = "audit-log-export-fields", Oo = /* @__PURE__ */ Qe({
180
+ __name: "AuditLogList",
181
+ setup(i) {
182
+ const {
183
+ t: a
184
+ } = We(), R = et(), x = nt(), P = _(!1), k = _(!1), F = _([]), l = _(null), I = _(!1), g = _(1), L = _(!1), z = X().format("YYYY-MM-DD"), A = _({
185
+ startDate: z,
186
+ endDate: z
187
+ }), T = _(), E = _(), O = _(), C = _(), q = _("all");
188
+ function Se(e) {
189
+ return typeof e == "string" ? [e] : Array.isArray(e) ? e.filter((t) => typeof t == "string") : [];
190
+ }
191
+ const ke = b(() => se.map(({
192
+ key: e,
193
+ label: t
194
+ }) => ({
195
+ label: t,
196
+ value: e
197
+ }))), de = b(() => se.find((e) => e.key === q.value) ?? se[0]), Q = b(() => q.value === "all"), we = b(() => x.members.map((e) => ({
198
+ label: e.name,
199
+ value: e.doc.userId
200
+ }))), Fe = b(() => {
201
+ const e = ye.flatMap((c) => Se(c.subject).map((v) => ({
202
+ label: c.label,
203
+ value: v
204
+ }))), t = Object.entries(be).map(([c, v]) => ({
205
+ label: v,
206
+ value: c
207
+ })), r = /* @__PURE__ */ new Set(), f = [];
208
+ for (const c of [...e, ...t])
209
+ r.has(c.value) || (r.add(c.value), f.push(c));
210
+ return f;
211
+ });
212
+ function Ie(e, t) {
213
+ const r = t.toLowerCase();
214
+ return e.label.toLowerCase().includes(r) || e.value.replace(/^business::/, "").toLowerCase().includes(r) ? !0 : e.value.toLowerCase().includes(r);
215
+ }
216
+ const y = b(() => ({
217
+ manage: a("auditLog.action.manage"),
218
+ create: a("auditLog.action.create"),
219
+ read: a("auditLog.action.read"),
220
+ update: a("auditLog.action.update"),
221
+ delete: a("auditLog.action.delete")
222
+ })), Ve = b(() => [{
223
+ label: y.value.manage,
224
+ value: "manage"
225
+ }, {
226
+ label: y.value.create,
227
+ value: "create"
228
+ }, {
229
+ label: y.value.read,
230
+ value: "read"
231
+ }, {
232
+ label: y.value.update,
233
+ value: "update"
234
+ }, {
235
+ label: y.value.delete,
236
+ value: "delete"
237
+ }]), $ = b(() => ({
238
+ allowed: a("auditLog.outcome.success"),
239
+ denied: a("auditLog.outcome.failed"),
240
+ skipped: a("auditLog.outcome.skipped")
241
+ })), Pe = b(() => [{
242
+ label: $.value.allowed,
243
+ value: "allowed"
244
+ }, {
245
+ label: $.value.denied,
246
+ value: "denied"
247
+ }, {
248
+ label: $.value.skipped,
249
+ value: "skipped"
250
+ }]), Te = b(() => ({
251
+ admin: a("auditLog.detail.resolvedFromValue.admin"),
252
+ staff: a("auditLog.detail.resolvedFromValue.staff"),
253
+ permissionSet: a("auditLog.detail.resolvedFromValue.permissionSet"),
254
+ systemPermissionSet: a("auditLog.detail.resolvedFromValue.systemPermissionSet"),
255
+ custom: a("auditLog.detail.resolvedFromValue.custom"),
256
+ "no-match": a("auditLog.detail.resolvedFromValue.noMatch"),
257
+ unknown: a("auditLog.detail.resolvedFromValue.unknown")
258
+ })), Ee = b(() => ({
259
+ GET: y.value.read,
260
+ POST: y.value.create,
261
+ PUT: y.value.update,
262
+ PATCH: y.value.update,
263
+ DELETE: y.value.delete
264
+ })), ue = {
265
+ allowed: "success",
266
+ denied: "critical",
267
+ skipped: "warning"
268
+ }, Oe = b(() => {
269
+ const {
270
+ startDate: e,
271
+ endDate: t
272
+ } = A.value;
273
+ return e && t ? `${e} – ${t}` : e || t || a("auditLog.dateRange.placeholder");
274
+ });
275
+ function W(e) {
276
+ var t;
277
+ return ((t = ye.find((r) => r.subject === e)) == null ? void 0 : t.label) ?? be[e];
278
+ }
279
+ function H(e) {
280
+ return x.userIdToName[e.userId] || e.userId;
281
+ }
282
+ function re(e) {
283
+ return x.userIdToPhone[e.userId] || "-";
284
+ }
285
+ function Ce(e) {
286
+ return x.userIdToEmail[e.userId] || "-";
287
+ }
288
+ function ce(e) {
289
+ return X(e).format("DD MMM YYYY, HH:mm");
290
+ }
291
+ function je(e) {
292
+ return X(e).format("DD MMM YYYY, HH:mm:ss").toUpperCase();
293
+ }
294
+ function me(e) {
295
+ return y.value[e] ?? e;
296
+ }
297
+ function ee(e) {
298
+ return e.metadata.operationLabel ?? me(e.action);
299
+ }
300
+ function te(e) {
301
+ return $.value[e];
302
+ }
303
+ function De(e) {
304
+ return Te.value[e] ?? e;
305
+ }
306
+ function Me(e) {
307
+ return e.metadata.requestMethod ? Ee.value[e.metadata.requestMethod] ?? e.metadata.requestMethod : me(e.action);
308
+ }
309
+ function Ae(e) {
310
+ const t = String(e ?? "");
311
+ return `"${(/^[=+\-@\t\r]/.test(t) ? `'${t}` : t).replace(/"/g, '""')}"`;
312
+ }
313
+ const oe = [{
314
+ key: "timestamp",
315
+ labelKey: "auditLog.exportFields.timestamp",
316
+ getValue: (e) => ce(e.timestamp),
317
+ defaultSelected: !0
318
+ }, {
319
+ key: "userName",
320
+ labelKey: "auditLog.exportFields.userName",
321
+ getValue: (e) => H(e),
322
+ defaultSelected: !0
323
+ }, {
324
+ key: "userPhone",
325
+ labelKey: "auditLog.exportFields.userPhone",
326
+ getValue: (e) => re(e),
327
+ defaultSelected: !0
328
+ }, {
329
+ key: "subject",
330
+ labelKey: "auditLog.exportFields.subject",
331
+ getValue: (e) => W(e.subject) ?? e.subject,
332
+ defaultSelected: !0
333
+ }, {
334
+ key: "action",
335
+ labelKey: "auditLog.exportFields.action",
336
+ getValue: (e) => e.action,
337
+ defaultSelected: !0
338
+ }, {
339
+ key: "operation",
340
+ labelKey: "auditLog.exportFields.operation",
341
+ getValue: (e) => ee(e),
342
+ defaultSelected: !0
343
+ }, {
344
+ key: "outcome",
345
+ labelKey: "auditLog.exportFields.outcome",
346
+ getValue: (e) => te(e.outcome),
347
+ defaultSelected: !0
348
+ }, {
349
+ key: "businessId",
350
+ labelKey: "auditLog.exportFields.businessId",
351
+ getValue: (e) => e.businessId,
352
+ defaultSelected: !1
353
+ }, {
354
+ key: "restaurantId",
355
+ labelKey: "auditLog.exportFields.restaurantId",
356
+ getValue: (e) => e.restaurantId,
357
+ defaultSelected: !1
358
+ }, {
359
+ key: "country",
360
+ labelKey: "auditLog.exportFields.country",
361
+ getValue: (e) => e.country,
362
+ defaultSelected: !1
363
+ }, {
364
+ key: "resolvedFrom",
365
+ labelKey: "auditLog.exportFields.resolvedFrom",
366
+ getValue: (e) => {
367
+ var t;
368
+ return (t = e.metadata) == null ? void 0 : t.resolvedFrom;
369
+ },
370
+ defaultSelected: !1
371
+ }, {
372
+ key: "requestMethod",
373
+ labelKey: "auditLog.exportFields.requestMethod",
374
+ getValue: (e) => {
375
+ var t;
376
+ return (t = e.metadata) == null ? void 0 : t.requestMethod;
377
+ },
378
+ defaultSelected: !1
379
+ }, {
380
+ key: "requestPath",
381
+ labelKey: "auditLog.exportFields.requestPath",
382
+ getValue: (e) => {
383
+ var t;
384
+ return (t = e.metadata) == null ? void 0 : t.requestPath;
385
+ },
386
+ defaultSelected: !1
387
+ }];
388
+ function Ue() {
389
+ try {
390
+ const e = localStorage.getItem(Le);
391
+ if (e) {
392
+ const t = JSON.parse(e);
393
+ if (Array.isArray(t) && t.length > 0) return new Set(t);
394
+ }
395
+ } catch {
396
+ }
397
+ return new Set(oe.filter((e) => e.defaultSelected).map((e) => e.key));
398
+ }
399
+ const U = _(Ue());
400
+ function Ne(e) {
401
+ const t = new Set(U.value);
402
+ if (t.has(e)) {
403
+ if (t.size <= 1) return;
404
+ t.delete(e);
405
+ } else
406
+ t.add(e);
407
+ U.value = t;
408
+ try {
409
+ localStorage.setItem(Le, JSON.stringify([...t]));
410
+ } catch {
411
+ }
412
+ }
413
+ async function Ke() {
414
+ var e, t, r, f, c;
415
+ if (!k.value) {
416
+ k.value = !0;
417
+ try {
418
+ const {
419
+ startDate: v,
420
+ endDate: K
421
+ } = A.value, V = de.value.subjectPrefixes, j = (/* @__PURE__ */ new Date()).toISOString().slice(0, 19).replace("T", " "), B = K ? J(K, !0) : null, ae = B && B < j ? B : j, d = {
422
+ ...v ? {
423
+ from: J(v)
424
+ } : {},
425
+ to: ae,
426
+ ...(e = T.value) != null && e.length ? {
427
+ userIds: T.value
428
+ } : {},
429
+ ...Q.value && ((t = E.value) != null && t.length) ? {
430
+ subjects: E.value
431
+ } : {},
432
+ ...V.length ? {
433
+ subjectPrefixes: [...V]
434
+ } : {},
435
+ ...(r = C.value) != null && r.length ? {
436
+ actions: C.value
437
+ } : {},
438
+ ...(f = O.value) != null && f.length ? {
439
+ outcomes: O.value
440
+ } : {}
441
+ }, D = [];
442
+ let fe = 0;
443
+ for (; ; ) {
444
+ const S = await xe.read({
445
+ ...d,
446
+ limit: ie,
447
+ offset: fe
448
+ });
449
+ if (D.push(...S), S.length < ie) break;
450
+ fe += ie;
451
+ }
452
+ const pe = oe.filter((S) => U.value.has(S.key)), $e = pe.map((S) => a(S.labelKey)), He = D.map((S) => pe.map((Ze) => Ze.getValue(S) ?? "")), Je = [$e, ...He].map((S) => S.map(Ae).join(",")).join(`
453
+ `), Ge = `audit-log_${(((c = R.currentBusiness.value) == null ? void 0 : c.name) || "business").replace(/[^a-z0-9_-]+/gi, "_")}_${X().format("YYYYMMDD_HHmmss")}.csv`, Xe = new Blob([`\uFEFF${Je}`], {
454
+ type: "text/csv;charset=utf-8;"
455
+ }), ve = window.URL.createObjectURL(Xe), Y = document.createElement("a");
456
+ Y.href = ve, Y.download = Ge, document.body.appendChild(Y), Y.click(), Y.remove(), window.URL.revokeObjectURL(ve);
457
+ } finally {
458
+ k.value = !1;
459
+ }
460
+ }
461
+ }
462
+ const Re = [{
463
+ accessorKey: "timestamp",
464
+ header: () => a("auditLog.columns.timestamp"),
465
+ cell(e) {
466
+ return ce(e.row.original.timestamp);
467
+ }
468
+ }, {
469
+ accessorKey: "userId",
470
+ header: () => a("auditLog.columns.user"),
471
+ enableSorting: !1,
472
+ size: 220,
473
+ cell(e) {
474
+ const t = e.row.original;
475
+ return u("div", {
476
+ class: "flex items-center gap-8"
477
+ }, [u(he.FmAvatar, {
478
+ initials: H(t),
479
+ size: "sm",
480
+ class: "shrink-0"
481
+ }, null), u("div", {
482
+ class: "min-w-0"
483
+ }, [u("p", {
484
+ class: "truncate font-semibold"
485
+ }, [H(t)]), u("p", {
486
+ class: "truncate text-fm-color-typo-secondary"
487
+ }, [re(t)])])]);
488
+ }
489
+ }, {
490
+ accessorKey: "subject",
491
+ header: () => a("auditLog.columns.role"),
492
+ meta: {
493
+ cellClass: "text-left"
494
+ },
495
+ cell(e) {
496
+ const t = e.row.original;
497
+ return u("div", {
498
+ class: "text-left"
499
+ }, [W(t.subject) ?? t.subject]);
500
+ }
501
+ }, {
502
+ accessorKey: "action",
503
+ header: () => a("auditLog.columns.action"),
504
+ enableSorting: !1,
505
+ size: 280,
506
+ meta: {
507
+ cellSpanClass: "audit-log-action-label"
508
+ },
509
+ cell(e) {
510
+ return ee(e.row.original);
511
+ }
512
+ }, {
513
+ accessorKey: "outcome",
514
+ header: () => a("auditLog.columns.outcome"),
515
+ enableSorting: !1,
516
+ cell(e) {
517
+ const t = e.row.original;
518
+ return u(he.FmChip, {
519
+ variant: ue[t.outcome] ?? "neutral",
520
+ label: te(t.outcome),
521
+ compact: !0
522
+ }, null);
523
+ }
524
+ }];
525
+ function J(e, t = !1) {
526
+ const [r, f, c] = e.split("-").map(Number), v = new Date(r, f - 1, c);
527
+ return t && v.setDate(v.getDate() + 1), v.toISOString().slice(0, 19).replace("T", " ");
528
+ }
529
+ async function N() {
530
+ var e, t, r, f;
531
+ P.value = !0;
532
+ try {
533
+ const {
534
+ startDate: c,
535
+ endDate: v
536
+ } = A.value, K = (g.value - 1) * ne, V = de.value.subjectPrefixes, j = await xe.read({
537
+ limit: ne,
538
+ offset: K,
539
+ ...c ? {
540
+ from: J(c)
541
+ } : {},
542
+ ...v ? {
543
+ to: J(v, !0)
544
+ } : {},
545
+ ...(e = T.value) != null && e.length ? {
546
+ userIds: T.value
547
+ } : {},
548
+ ...Q.value && ((t = E.value) != null && t.length) ? {
549
+ subjects: E.value
550
+ } : {},
551
+ ...V.length ? {
552
+ subjectPrefixes: [...V]
553
+ } : {},
554
+ ...(r = C.value) != null && r.length ? {
555
+ actions: C.value
556
+ } : {},
557
+ ...(f = O.value) != null && f.length ? {
558
+ outcomes: O.value
559
+ } : {}
560
+ });
561
+ F.value = j, L.value = j.length === ne;
562
+ } finally {
563
+ P.value = !1;
564
+ }
565
+ }
566
+ G(A, () => {
567
+ g.value = 1, N();
568
+ }), G([T, E, O, C], () => {
569
+ g.value = 1, N();
570
+ }), G(q, () => {
571
+ g.value = 1, N();
572
+ });
573
+ async function qe() {
574
+ g.value > 1 && (g.value--, await N());
575
+ }
576
+ async function Be() {
577
+ L.value && (g.value++, await N());
578
+ }
579
+ function Ye(e) {
580
+ l.value = e, I.value = !0;
581
+ }
582
+ function ze() {
583
+ I.value = !1, l.value = null;
584
+ }
585
+ return G(R.currentBusiness, (e) => {
586
+ e && (g.value = 1, x.readTeamMembers(), N());
587
+ }, {
588
+ immediate: !0
589
+ }), (e, t) => {
590
+ const r = w("FmSpacer"), f = w("FmButton"), c = w("FmMenuItem"), v = w("FmMenu"), K = w("FmTabs"), V = w("FmChip"), j = w("FmDateRangePicker"), B = w("FmTable"), ae = w("FmSideSheet");
591
+ return m(), p(le, null, [u(lt, {
592
+ heading: s(a)("auditLog.title")
593
+ }, {
594
+ "append-heading": M(() => [u(r), u(f, {
595
+ variant: "primary",
596
+ "prepend-icon": "upload",
597
+ label: s(a)("auditLog.export"),
598
+ disabled: F.value.length === 0 || k.value || s(x).isLoading || s(x).members.length === 0,
599
+ loading: k.value,
600
+ onClick: Ke
601
+ }, null, 8, ["label", "disabled", "loading"]), u(v, {
602
+ "close-on-click": !1,
603
+ "z-index": 50
604
+ }, {
605
+ "menu-button": M(() => [u(f, {
606
+ variant: "tertiary",
607
+ icon: "settings",
608
+ "aria-label": s(a)("auditLog.exportSettings.title"),
609
+ disabled: k.value
610
+ }, null, 8, ["aria-label", "disabled"])]),
611
+ default: M(() => [o("div", dt, [o("p", ut, n(s(a)("auditLog.exportSettings.title")), 1), (m(), p(le, null, _e(oe, (d) => u(c, {
612
+ key: d.key,
613
+ label: s(a)(d.labelKey),
614
+ "has-checkbox": "",
615
+ "model-value": U.value.has(d.key),
616
+ disabled: U.value.has(d.key) && U.value.size === 1,
617
+ onClick: (D) => Ne(d.key)
618
+ }, null, 8, ["label", "model-value", "disabled", "onClick"])), 64))])]),
619
+ _: 1
620
+ })]),
621
+ default: M(() => [o("div", rt, [o("div", ct, [u(K, {
622
+ modelValue: q.value,
623
+ "onUpdate:modelValue": t[0] || (t[0] = (d) => q.value = d),
624
+ items: ke.value
625
+ }, null, 8, ["modelValue", "items"]), o("div", mt, [u(j, {
626
+ modelValue: A.value,
627
+ "onUpdate:modelValue": t[1] || (t[1] = (d) => A.value = d),
628
+ "show-predefined-range": ""
629
+ }, {
630
+ "trigger-button": M(() => [u(V, {
631
+ label: Oe.value,
632
+ icon: "calendar_month"
633
+ }, null, 8, ["label"])]),
634
+ _: 1
635
+ }, 8, ["modelValue"]), o("div", ft, [u(Z, {
636
+ modelValue: T.value,
637
+ "onUpdate:modelValue": t[2] || (t[2] = (d) => T.value = d),
638
+ items: we.value,
639
+ multiple: "",
640
+ variant: "dark",
641
+ placeholder: s(a)("auditLog.filter.user_placeholder"),
642
+ "selected-prefix": s(a)("auditLog.filter.selected_user_prefix"),
643
+ "chip-icon": "account_circle"
644
+ }, null, 8, ["modelValue", "items", "placeholder", "selected-prefix"])]), Q.value ? (m(), p("div", pt, [u(Z, {
645
+ modelValue: E.value,
646
+ "onUpdate:modelValue": t[3] || (t[3] = (d) => E.value = d),
647
+ items: Fe.value,
648
+ "filter-fn": Ie,
649
+ multiple: "",
650
+ variant: "dark",
651
+ placeholder: s(a)("auditLog.filter.subject_placeholder"),
652
+ "selected-prefix": s(a)("auditLog.filter.selected_subject_prefix"),
653
+ "chip-icon": "badge"
654
+ }, null, 8, ["modelValue", "items", "placeholder", "selected-prefix"])])) : h("", !0), o("div", vt, [u(Z, {
655
+ modelValue: C.value,
656
+ "onUpdate:modelValue": t[4] || (t[4] = (d) => C.value = d),
657
+ items: Ve.value,
658
+ multiple: "",
659
+ variant: "dark",
660
+ placeholder: s(a)("auditLog.filter.action_placeholder"),
661
+ "selected-prefix": s(a)("auditLog.filter.selected_action_prefix"),
662
+ searchable: !1
663
+ }, null, 8, ["modelValue", "items", "placeholder", "selected-prefix"])]), o("div", gt, [u(Z, {
664
+ modelValue: O.value,
665
+ "onUpdate:modelValue": t[5] || (t[5] = (d) => O.value = d),
666
+ items: Pe.value,
667
+ multiple: "",
668
+ variant: "dark",
669
+ placeholder: s(a)("auditLog.filter.status_placeholder"),
670
+ "selected-prefix": s(a)("auditLog.filter.selected_status_prefix"),
671
+ searchable: !1,
672
+ "chip-icon": "check_circle"
673
+ }, null, 8, ["modelValue", "items", "placeholder", "selected-prefix"])])])]), !P.value && F.value.length === 0 ? (m(), ge(s(st), {
674
+ key: 0,
675
+ title: s(a)("auditLog.noData.title"),
676
+ subtitle: s(a)("auditLog.noData.subtitle")
677
+ }, null, 8, ["title", "subtitle"])) : (m(), ge(tt, {
678
+ key: 1
679
+ }, {
680
+ default: M(() => [o("div", _t, [u(B, {
681
+ "column-defs": Re,
682
+ "row-data": F.value,
683
+ "page-size": F.value.length,
684
+ loading: P.value,
685
+ "pin-header-row": "",
686
+ "hide-footer": "",
687
+ class: "min-h-0 flex-1 cursor-pointer",
688
+ onRowClick: t[6] || (t[6] = (d) => Ye(d.original))
689
+ }, null, 8, ["row-data", "page-size", "loading"]), g.value > 1 || L.value ? (m(), p("div", bt, [u(f, {
690
+ variant: "tertiary",
691
+ icon: "chevron_left",
692
+ disabled: g.value === 1,
693
+ "aria-label": s(a)("auditLog.pagination.prevPage"),
694
+ onClick: qe
695
+ }, null, 8, ["disabled", "aria-label"]), o("span", ht, n(s(a)("auditLog.pagination.page", {
696
+ page: g.value
697
+ })), 1), u(f, {
698
+ variant: "tertiary",
699
+ icon: "chevron_right",
700
+ disabled: !L.value,
701
+ "aria-label": s(a)("auditLog.pagination.nextPage"),
702
+ onClick: Be
703
+ }, null, 8, ["disabled", "aria-label"])])) : h("", !0)])]),
704
+ _: 1
705
+ }))])]),
706
+ _: 1
707
+ }, 8, ["heading"]), u(ae, {
708
+ header: s(a)("auditLog.detail.header"),
709
+ "model-value": I.value,
710
+ "max-width": 480,
711
+ "dismiss-away": "",
712
+ "onUpdate:modelValue": t[7] || (t[7] = (d) => {
713
+ d || ze();
714
+ })
715
+ }, {
716
+ default: M(() => [l.value ? (m(), p("div", yt, [o("div", xt, [o("div", Lt, [o("p", St, n(ee(l.value)), 1)]), u(V, {
717
+ variant: ue[l.value.outcome] ?? "neutral",
718
+ label: te(l.value.outcome),
719
+ compact: ""
720
+ }, null, 8, ["variant", "label"])]), o("div", kt, [o("div", wt, [o("div", null, [o("p", Ft, n(s(a)("auditLog.detail.date")), 1), o("p", It, n(je(l.value.timestamp)), 1)]), o("div", null, [o("p", Vt, n(s(a)("auditLog.detail.user")), 1), o("p", Pt, n(H(l.value)), 1)]), o("div", null, [o("p", Tt, n(s(a)("auditLog.detail.email")), 1), o("p", Et, n(Ce(l.value)), 1)]), o("div", null, [o("p", Ot, n(s(a)("auditLog.detail.role")), 1), o("p", Ct, n(W(l.value.subject) || l.value.subject), 1)]), l.value.field ? (m(), p("div", jt, [o("p", Dt, n(s(a)("auditLog.detail.field")), 1), o("p", Mt, n(l.value.field), 1)])) : h("", !0), o("div", null, [o("p", At, n(s(a)("auditLog.detail.business")), 1), o("p", Ut, n(l.value.businessId || "-"), 1)]), o("div", null, [o("p", Nt, n(s(a)("auditLog.detail.restaurant")), 1), o("p", Kt, n(l.value.restaurantId || "-"), 1)])])]), l.value.metadata.operationLabel ? (m(), p("div", Rt, [o("div", qt, [o("p", Bt, n(s(a)("auditLog.detail.changeDetails")), 1)]), t[8] || (t[8] = o("hr", {
721
+ class: "border-fm-color-border-default"
722
+ }, null, -1)), o("div", Yt, [o("div", null, [o("p", zt, n(s(a)("auditLog.detail.eventType")), 1), o("p", $t, n(l.value.metadata.operationLabel), 1)])])])) : h("", !0), o("div", Ht, [o("div", Jt, [o("p", Gt, n(s(a)("auditLog.detail.metadata")), 1)]), t[9] || (t[9] = o("hr", {
723
+ class: "border-fm-color-border-default"
724
+ }, null, -1)), o("div", Xt, [o("div", null, [o("p", Zt, n(s(a)("auditLog.detail.resolvedFrom")), 1), o("p", Qt, n(De(l.value.metadata.resolvedFrom)), 1)]), (l.value.metadata.resolvedFrom === "permissionSet" || l.value.metadata.resolvedFrom === "systemPermissionSet") && (l.value.metadata.permissionSetName || l.value.metadata.permissionSetId) ? (m(), p("div", Wt, [o("p", eo, n(s(a)("auditLog.detail.permissionSet")), 1), l.value.metadata.permissionSetName ? (m(), p("p", to, n(l.value.metadata.permissionSetName), 1)) : h("", !0), l.value.metadata.permissionSetId ? (m(), p("p", oo, n(l.value.metadata.permissionSetId), 1)) : h("", !0)])) : h("", !0), l.value.metadata.reason ? (m(), p("div", ao, [o("p", lo, n(s(a)("auditLog.detail.reason")), 1), o("p", so, n(l.value.metadata.reason), 1)])) : h("", !0), o("div", null, [o("p", no, n(s(a)("auditLog.detail.requestMethod")), 1), o("p", io, n(Me(l.value)), 1)]), o("div", null, [o("p", uo, n(s(a)("auditLog.detail.requestPath")), 1), o("p", ro, n(l.value.metadata.requestPath || "-"), 1)]), l.value.metadata.trace && l.value.metadata.trace.length > 0 ? (m(), p("div", co, [o("p", mo, n(s(a)("auditLog.detail.permissionTrace")), 1), o("ol", fo, [(m(!0), p(le, null, _e(l.value.metadata.trace, (d, D) => (m(), p("li", {
725
+ key: D,
726
+ class: "flex items-center gap-6"
727
+ }, [o("span", po, n(D + 1), 1), o("span", vo, n(d), 1), D < l.value.metadata.trace.length - 1 ? (m(), p("span", go, "→")) : h("", !0)]))), 128))])])) : h("", !0), l.value.metadata.requestBody && Object.keys(l.value.metadata.requestBody).length > 0 ? (m(), p("div", _o, [o("p", bo, n(s(a)("auditLog.detail.requestBody")), 1), o("pre", ho, n(JSON.stringify(l.value.metadata.requestBody, null, 2)), 1)])) : h("", !0)])])])) : h("", !0)]),
728
+ _: 1
729
+ }, 8, ["header", "model-value"])], 64);
730
+ };
731
+ }
732
+ });
733
+ export {
734
+ Oo as default
735
+ };