@feedmepos/mf-hrm-portal 2.0.8-dev.15 → 2.0.8-dev.17

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