@feedmepos/mf-hrm-portal 2.0.8-dev.16 → 2.0.8-dev.18

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