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

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 (43) hide show
  1. package/dist/AuditLogList-Rrg_dNYp.js +1149 -0
  2. package/dist/{ConditionFormHost.vue_vue_type_script_setup_true_lang-BYHKFwRm.js → ConditionFormHost.vue_vue_type_script_setup_true_lang-CJEkZVoJ.js} +104 -100
  3. package/dist/{EmployeeList-KvjoGI87.js → EmployeeList-CckyPQlP.js} +9 -10
  4. package/dist/{Main-Dn1TfDRj.js → Main-BUvX24j0.js} +9 -9
  5. package/dist/{Main-BLh16xRg.js → Main-BdPIZkik.js} +4 -4
  6. package/dist/{Main-D3TSdtSE.js → Main-C4cSWAts.js} +6 -6
  7. package/dist/{PermissionSetList-Ds69m9UU.js → PermissionSetList-CP8J9Prx.js} +6 -6
  8. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-C7X69eQq.js +4121 -0
  9. package/dist/{PortalUserSearcher.vue_vue_type_style_index_0_scoped_a439fdd8_lang-BHxCP_uW.js → PortalUserSearcher.vue_vue_type_style_index_0_scoped_79737e32_lang-ZAEcrK9Q.js} +2 -1
  10. package/dist/{RoleList-v8McRCnz.js → RoleList-BHvGGF82.js} +8 -8
  11. package/dist/TeamMemberList-DPkocw3U.js +1185 -0
  12. package/dist/{TimesheetList-C1OWa6kf.js → TimesheetList-mOWHmWwo.js} +6 -6
  13. package/dist/{TimesheetList.vue_vue_type_style_index_0_scoped_2c7a177a_lang-CLu9gzzi.js → TimesheetList.vue_vue_type_style_index_0_scoped_2c7a177a_lang-CpUHcGUj.js} +2 -2
  14. package/dist/{app-CJouCBgi.js → app-DnaRDAJY.js} +394 -674
  15. package/dist/app.js +1 -1
  16. package/dist/{dayjs.min-DUugkgDM.js → dayjs.min-NAaPKajp.js} +1 -1
  17. package/dist/{employee-D5rEVmge.js → employee-CILPIL-b.js} +3 -3
  18. package/dist/{iteration-QRRNYlps.js → iteration-B7PEDIWb.js} +3 -3
  19. package/dist/{lodash-BlZhpHhM.js → lodash-CgE5OnVa.js} +1 -1
  20. package/dist/{rule-Dy7eMChN.js → rule-BmSYQ3Op.js} +17 -13
  21. package/dist/src/api/audit-log/index.d.ts +0 -6
  22. package/dist/src/composables/useBasePermission.d.ts +1 -1
  23. package/dist/src/helpers/filter.d.ts +15 -0
  24. package/dist/src/helpers/permission-reconcile.d.ts +15 -0
  25. package/dist/src/helpers/permission-reconcile.test.d.ts +1 -0
  26. package/dist/src/helpers/permission-set.d.ts +4 -2
  27. package/dist/src/types/audit-log.d.ts +1 -1
  28. package/dist/src/views/audit-log/locales/index.d.ts +0 -296
  29. package/dist/src/views/team/locales/index.d.ts +4 -0
  30. package/dist/style.css +1 -1
  31. package/dist/tsconfig.app.tsbuildinfo +1 -1
  32. package/dist/{useAppStore-CtMoad7V.js → useAppStore-DMmL9JnJ.js} +1 -1
  33. package/dist/useDebounce-CWb5QR9G.js +28 -0
  34. package/dist/{useLoading-CNqlchYO.js → useLoading-D56E7ykF.js} +1 -1
  35. package/dist/{useReportPermissions-C5wGC9bf.js → useReportPermissions-BKj02rVj.js} +3 -3
  36. package/package.json +2 -2
  37. package/dist/AuditLogList-AGlAsWwd.js +0 -1608
  38. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-Bk6ub3Dv.js +0 -4030
  39. package/dist/Skeleton.vue_vue_type_script_setup_true_lang-B4PxNMwq.js +0 -16
  40. package/dist/TeamMemberList-BYQnNIhT.js +0 -1169
  41. package/dist/src/views/audit-log/event-line.d.ts +0 -13
  42. package/dist/src/views/audit-log/snapshot-diff.d.ts +0 -11
  43. package/dist/useDebounce-B8ZPVS5C.js +0 -15
@@ -0,0 +1,1149 @@
1
+ import { defineComponent as Xe, ref as f, computed as h, onMounted as Vt, onBeforeUnmount as Et, watch as Q, resolveComponent as C, createElementBlock as M, openBlock as y, createBlock as he, createCommentVNode as N, createElementVNode as a, Fragment as Z, renderList as ie, withCtx as Y, createVNode as b, toDisplayString as u, unref as i, nextTick as Rt } from "vue";
2
+ import { d as x } from "./dayjs.min-NAaPKajp.js";
3
+ import { useI18n as Qe, useCoreStore as Ct } from "@feedmepos/mf-common";
4
+ import { G as He, _ as Ut } from "./app-DnaRDAJY.js";
5
+ import { components as We } from "@feedmepos/ui-library";
6
+ import { g as Ae, b as Fe } from "./iteration-B7PEDIWb.js";
7
+ import { S as ge, _ as $t } from "./SelectFilter-ATOm0hdn.js";
8
+ import { _ as Nt } from "./PageLayout.vue_vue_type_script_setup_true_lang-HKK4cbW8.js";
9
+ import { _ as Yt } from "./TableEmptyState.vue_vue_type_script_setup_true_lang-Ci_MVqGK.js";
10
+ import { t as Bt, p as Je } from "./rule-BmSYQ3Op.js";
11
+ import { defineStore as Kt } from "pinia";
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
+ ], Me = "/audit-logs", be = {
23
+ async count(l) {
24
+ var L, j, I, w, s;
25
+ const o = {
26
+ ...l != null && l.from ? { from: l.from } : {},
27
+ ...l != null && l.to ? { to: l.to } : {},
28
+ ...(L = l == null ? void 0 : l.userIds) != null && L.length ? { userIds: l.userIds } : {},
29
+ ...(j = l == null ? void 0 : l.subjects) != null && j.length ? { subjects: l.subjects } : {},
30
+ ...(I = l == null ? void 0 : l.subjectPrefixes) != null && I.length ? { subjectPrefixes: l.subjectPrefixes } : {},
31
+ ...(w = l == null ? void 0 : l.actions) != null && w.length ? { actions: l.actions } : {},
32
+ ...(s = l == null ? void 0 : l.outcomes) != null && s.length ? { outcomes: l.outcomes } : {},
33
+ ...l != null && l.feedmeAdminActors ? { feedmeAdminActors: !0 } : {}
34
+ };
35
+ return (await Ae(
36
+ await Fe().get(`${Me}/count`, {
37
+ params: o,
38
+ paramsSerializer: (D) => {
39
+ const P = new URLSearchParams();
40
+ for (const [v, A] of Object.entries(D))
41
+ if (Array.isArray(A))
42
+ for (const B of A) P.append(v, String(B));
43
+ else A != null && P.append(v, String(A));
44
+ return P.toString();
45
+ }
46
+ })
47
+ )).total;
48
+ },
49
+ async read(l) {
50
+ var c, L, j, I, w;
51
+ const o = {
52
+ limit: (l == null ? void 0 : l.limit) ?? 100,
53
+ offset: (l == null ? void 0 : l.offset) ?? 0,
54
+ ...l != null && l.from ? { from: l.from } : {},
55
+ ...l != null && l.to ? { to: l.to } : {},
56
+ ...(c = l == null ? void 0 : l.userIds) != null && c.length ? { userIds: l.userIds } : {},
57
+ ...l != null && l.feedmeAdminActors ? { feedmeAdminActors: !0 } : {},
58
+ ...(L = l == null ? void 0 : l.subjects) != null && L.length ? { subjects: l.subjects } : {},
59
+ ...(j = l == null ? void 0 : l.subjectPrefixes) != null && j.length ? { subjectPrefixes: l.subjectPrefixes } : {},
60
+ ...(I = l == null ? void 0 : l.actions) != null && I.length ? { actions: l.actions } : {},
61
+ ...(w = l == null ? void 0 : l.outcomes) != null && w.length ? { outcomes: l.outcomes } : {}
62
+ };
63
+ return Ae(
64
+ await Fe().get(Me, {
65
+ params: o,
66
+ // Serialize arrays as repeated params: key=val1&key=val2
67
+ // (NestJS @Query expects this; axios default adds brackets which break matching)
68
+ paramsSerializer: (s) => {
69
+ const D = new URLSearchParams();
70
+ for (const [P, v] of Object.entries(s))
71
+ if (Array.isArray(v))
72
+ for (const A of v) D.append(P, String(A));
73
+ else v != null && D.append(P, String(v));
74
+ return D.toString();
75
+ }
76
+ })
77
+ );
78
+ },
79
+ /**
80
+ * FeedMe-admin options for the User filter. `actors` is the named admin list (internal
81
+ * viewers only; empty for merchants). `showFeedmeAdminFilter` indicates whether to offer
82
+ * the "FeedMe Admin" catch-all (only when the business has relevant admin activity).
83
+ */
84
+ async getFeedmeAdminFilter(l) {
85
+ const o = {
86
+ ...l != null && l.from ? { from: l.from } : {},
87
+ ...l != null && l.to ? { to: l.to } : {}
88
+ };
89
+ return Ae(
90
+ await Fe().get(`${Me}/actors`, { params: o })
91
+ );
92
+ }
93
+ }, zt = { class: "flex h-[46px] items-center gap-8 rounded-sm px-16 hover:bg-fm-color-opacity-sm" }, qt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Ht = {
94
+ "data-more-measure": "",
95
+ class: "flex h-[46px] items-center gap-8 rounded-sm px-16"
96
+ }, Wt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Jt = /* @__PURE__ */ Xe({
97
+ __name: "AuditLogModuleTabs",
98
+ props: {
99
+ modelValue: {},
100
+ items: {}
101
+ },
102
+ emits: ["update:modelValue"],
103
+ setup(l, { emit: o }) {
104
+ const c = l, L = o, { t: j } = Qe(), I = f(!1), w = f(null), s = f(null), D = f([]), P = f(0), v = f(0);
105
+ let A = null;
106
+ async function B() {
107
+ if (await Rt(), !s.value) return;
108
+ const m = s.value.querySelectorAll("[data-tab-measure]");
109
+ D.value = Array.from(m).map((k) => k.offsetWidth);
110
+ const _ = s.value.querySelector("[data-more-measure]");
111
+ P.value = (_ == null ? void 0 : _.offsetWidth) ?? 0;
112
+ }
113
+ const _e = h(() => {
114
+ const m = c.items.length;
115
+ if (m === 0) return 0;
116
+ if (!v.value || D.value.length !== m) return m;
117
+ const _ = D.value;
118
+ if (_.reduce((d, H) => d + H, 0) <= v.value) return m;
119
+ const S = P.value;
120
+ let O = 0, T = 0;
121
+ for (let d = 0; d < m && !(O + _[d] + S > v.value); d++)
122
+ O += _[d], T++;
123
+ return T;
124
+ }), J = h(() => {
125
+ const m = _e.value, _ = c.items.length;
126
+ if (m >= _) return [...c.items];
127
+ const k = c.items.slice(0, m), S = c.items.find((E) => E.value === c.modelValue);
128
+ if (!S || k.some((E) => E.value === S.value)) return k;
129
+ if (m === 0) return [S];
130
+ const O = c.items.findIndex((E) => E.value === S.value), T = D.value, d = P.value, H = T[O] ?? 0;
131
+ let $ = m, le = T.slice(0, $ - 1).reduce((E, oe) => E + oe, 0);
132
+ for (; $ > 1 && le + H + d > v.value; )
133
+ $--, le = T.slice(0, $ - 1).reduce((E, oe) => E + oe, 0);
134
+ return [...c.items.slice(0, Math.max($ - 1, 0)), S];
135
+ }), ee = h(() => {
136
+ const m = new Set(J.value.map((_) => _.value));
137
+ return c.items.filter((_) => !m.has(_.value));
138
+ });
139
+ function te(m) {
140
+ I.value = !1, L("update:modelValue", m);
141
+ }
142
+ return Vt(async () => {
143
+ await B(), w.value && (v.value = w.value.clientWidth, A = new ResizeObserver(() => {
144
+ w.value && (v.value = w.value.clientWidth);
145
+ }), A.observe(w.value));
146
+ }), Et(() => {
147
+ A == null || A.disconnect(), A = null;
148
+ }), Q(
149
+ () => c.items,
150
+ () => {
151
+ B();
152
+ },
153
+ { deep: !0 }
154
+ ), (m, _) => {
155
+ const k = C("FmTab"), S = C("FmIcon"), O = C("FmMenuItem"), T = C("FmMenu");
156
+ return y(), M("div", {
157
+ ref_key: "containerRef",
158
+ ref: w,
159
+ class: "relative flex w-full flex-row items-center"
160
+ }, [
161
+ (y(!0), M(Z, null, ie(J.value, (d) => (y(), he(k, {
162
+ key: d.value,
163
+ "model-value": l.modelValue,
164
+ label: d.label,
165
+ badge: d.badge,
166
+ disabled: d.disabled,
167
+ value: d.value,
168
+ "onUpdate:modelValue": te
169
+ }, null, 8, ["model-value", "label", "badge", "disabled", "value"]))), 128)),
170
+ ee.value.length > 0 ? (y(), he(T, {
171
+ key: 0,
172
+ "show-menu": I.value,
173
+ class: "max-w-[360px] min-w-[90px] rounded-sm",
174
+ placement: "bottom-start",
175
+ onMenuChanged: _[0] || (_[0] = (d) => I.value = d)
176
+ }, {
177
+ "menu-button": Y(() => [
178
+ a("div", zt, [
179
+ b(S, { name: "more_vert" }),
180
+ a("span", qt, u(i(j)("auditLog.modules.more")), 1)
181
+ ])
182
+ ]),
183
+ default: Y(() => [
184
+ (y(!0), M(Z, null, ie(ee.value, (d) => (y(), he(O, {
185
+ key: d.value,
186
+ "model-value": l.modelValue === d.value,
187
+ label: d.label,
188
+ disabled: d.disabled,
189
+ onClick: (H) => te(d.value)
190
+ }, null, 8, ["model-value", "label", "disabled", "onClick"]))), 128))
191
+ ]),
192
+ _: 1
193
+ }, 8, ["show-menu"])) : N("", !0),
194
+ a("div", {
195
+ ref_key: "measurerRef",
196
+ ref: s,
197
+ "aria-hidden": "true",
198
+ class: "pointer-events-none invisible absolute -left-[9999px] -top-[9999px] flex flex-row items-center"
199
+ }, [
200
+ (y(!0), M(Z, null, ie(l.items, (d) => (y(), M("div", {
201
+ key: `measure-${d.value}`,
202
+ "data-tab-measure": ""
203
+ }, [
204
+ b(k, {
205
+ "model-value": l.modelValue,
206
+ label: d.label,
207
+ badge: d.badge,
208
+ disabled: d.disabled,
209
+ value: d.value
210
+ }, null, 8, ["model-value", "label", "badge", "disabled", "value"])
211
+ ]))), 128)),
212
+ a("div", Ht, [
213
+ b(S, { name: "more_vert" }),
214
+ a("span", Wt, u(i(j)("auditLog.modules.more")), 1)
215
+ ])
216
+ ], 512)
217
+ ], 512);
218
+ };
219
+ }
220
+ }), Gt = Kt("team", () => {
221
+ const l = f([]), o = f(!1), c = f(!1), L = h(
222
+ () => Object.fromEntries(l.value.map((s) => [s.doc.userId, s.name]))
223
+ ), j = h(
224
+ () => Object.fromEntries(l.value.map((s) => [s.doc.userId, s.email]))
225
+ ), I = h(
226
+ () => Object.fromEntries(l.value.map((s) => [s.doc.userId, s.phoneNumber]))
227
+ );
228
+ async function w({ force: s = !1 } = {}) {
229
+ if (!(!s && l.value.length > 0))
230
+ try {
231
+ o.value = !0;
232
+ const D = await Bt.readTeamMembers();
233
+ l.value = D.sort((P, v) => P.doc.isOwner ? -1 : P.name.localeCompare(v.name)), c.value = !0;
234
+ } finally {
235
+ o.value = !1;
236
+ }
237
+ }
238
+ return {
239
+ members: l,
240
+ isLoading: o,
241
+ hasLoaded: c,
242
+ userIdToName: L,
243
+ userIdToEmail: j,
244
+ userIdToPhone: I,
245
+ readTeamMembers: w
246
+ };
247
+ }), Xt = {
248
+ class: "flex flex-col gap-4 p-12 w-[260px]"
249
+ }, Qt = {
250
+ class: "text-xs font-semibold text-fm-color-typo-secondary mb-4"
251
+ }, Zt = {
252
+ class: "flex min-h-0 flex-1 flex-col gap-16"
253
+ }, el = {
254
+ class: "space-y-16"
255
+ }, tl = {
256
+ class: "flex flex-wrap items-center gap-8"
257
+ }, ll = {
258
+ class: "w-fit"
259
+ }, ol = {
260
+ class: "w-fit"
261
+ }, al = {
262
+ class: "w-fit"
263
+ }, sl = {
264
+ class: "w-fit"
265
+ }, nl = {
266
+ class: "flex h-full flex-col overflow-auto"
267
+ }, ul = {
268
+ key: 0,
269
+ class: "space-y-12 p-4 text-sm"
270
+ }, il = {
271
+ class: "flex items-start justify-between gap-8 rounded-lg border border-fm-color-border-default p-12"
272
+ }, rl = {
273
+ class: "min-w-0 flex-1"
274
+ }, dl = {
275
+ class: "audit-log-operation-label-detail text-base font-bold leading-snug text-fm-color-typo-primary"
276
+ }, cl = {
277
+ class: "rounded-lg border border-fm-color-border-default p-12"
278
+ }, ml = {
279
+ class: "space-y-12"
280
+ }, fl = {
281
+ class: "text-xs text-fm-color-typo-secondary"
282
+ }, vl = {
283
+ class: "font-semibold"
284
+ }, gl = {
285
+ class: "text-xs text-fm-color-typo-secondary"
286
+ }, bl = {
287
+ class: "font-semibold"
288
+ }, pl = {
289
+ class: "text-xs text-fm-color-typo-secondary"
290
+ }, hl = {
291
+ class: "break-all font-semibold"
292
+ }, _l = {
293
+ key: 0
294
+ }, yl = {
295
+ class: "text-xs text-fm-color-typo-secondary"
296
+ }, xl = {
297
+ class: "break-all font-mono text-xs font-semibold"
298
+ }, Ll = {
299
+ class: "text-xs text-fm-color-typo-secondary"
300
+ }, Sl = {
301
+ class: "break-all font-mono text-xs font-semibold"
302
+ }, wl = {
303
+ class: "text-xs text-fm-color-typo-secondary"
304
+ }, kl = {
305
+ class: "font-semibold"
306
+ }, Il = {
307
+ class: "rounded-lg border border-fm-color-border-default"
308
+ }, Al = {
309
+ class: "p-12"
310
+ }, Fl = {
311
+ class: "text-base font-bold text-fm-color-typo-primary"
312
+ }, Ml = {
313
+ class: "space-y-12 p-12"
314
+ }, Dl = {
315
+ class: "text-xs text-fm-color-typo-secondary"
316
+ }, Ol = {
317
+ class: "font-semibold"
318
+ }, Tl = {
319
+ class: "rounded-lg border border-fm-color-border-default"
320
+ }, jl = {
321
+ class: "p-12"
322
+ }, Pl = {
323
+ class: "text-base font-bold text-fm-color-typo-primary"
324
+ }, Vl = {
325
+ class: "space-y-12 p-12"
326
+ }, El = {
327
+ class: "text-xs text-fm-color-typo-secondary"
328
+ }, Rl = {
329
+ class: "font-semibold"
330
+ }, Cl = {
331
+ key: 0
332
+ }, Ul = {
333
+ class: "text-xs text-fm-color-typo-secondary"
334
+ }, $l = {
335
+ key: 0,
336
+ class: "font-semibold"
337
+ }, Nl = {
338
+ key: 1,
339
+ class: "break-all font-mono text-xs text-fm-color-typo-secondary"
340
+ }, Yl = {
341
+ key: 1
342
+ }, Bl = {
343
+ class: "text-xs text-fm-color-typo-secondary"
344
+ }, Kl = {
345
+ class: "font-semibold whitespace-pre-line"
346
+ }, zl = {
347
+ class: "text-xs text-fm-color-typo-secondary"
348
+ }, ql = {
349
+ class: "font-semibold"
350
+ }, Hl = {
351
+ class: "text-xs text-fm-color-typo-secondary"
352
+ }, Wl = {
353
+ class: "break-all font-mono text-xs font-semibold"
354
+ }, Jl = {
355
+ key: 2
356
+ }, Gl = {
357
+ class: "text-xs text-fm-color-typo-secondary"
358
+ }, Xl = {
359
+ class: "mt-4 space-y-4"
360
+ }, Ql = {
361
+ 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"
362
+ }, Zl = {
363
+ class: "text-xs font-semibold"
364
+ }, eo = {
365
+ key: 0,
366
+ class: "text-fm-color-typo-secondary"
367
+ }, to = {
368
+ key: 3
369
+ }, lo = {
370
+ class: "text-xs text-fm-color-typo-secondary"
371
+ }, oo = {
372
+ 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"
373
+ }, ue = 100, De = 1e3, pe = "__feedmeAdmin__", ao = "D MMM YYYY h:mm A", so = "YYYY-MM-DD HH:mm", V = "YYYY-MM-DD", Ge = "audit-log-export-fields", no = /* @__PURE__ */ Xe({
374
+ __name: "AuditLogList",
375
+ setup(l) {
376
+ const {
377
+ t: o
378
+ } = Qe(), c = Ct(), L = Gt(), j = f(!1), I = f(!1), w = f([]), s = f(null), D = f(!1);
379
+ async function P(e) {
380
+ const t = Uint8Array.from(atob(e), (r) => r.charCodeAt(0)), n = new DecompressionStream("gzip"), g = n.writable.getWriter();
381
+ return await g.write(t), await g.close(), new Response(n.readable).text();
382
+ }
383
+ const v = f("");
384
+ let A = 0;
385
+ Q(() => {
386
+ var e, t;
387
+ return (t = (e = s.value) == null ? void 0 : e.metadata) == null ? void 0 : t.requestBody;
388
+ }, async (e) => {
389
+ const t = ++A;
390
+ if (!e) {
391
+ v.value = "";
392
+ return;
393
+ }
394
+ if (typeof e == "object") {
395
+ v.value = JSON.stringify(e, null, 2);
396
+ return;
397
+ }
398
+ if (e.startsWith("gzip:")) {
399
+ try {
400
+ const n = await P(e.slice(5));
401
+ if (t !== A) return;
402
+ v.value = JSON.stringify(JSON.parse(n), null, 2);
403
+ } catch {
404
+ if (t !== A) return;
405
+ v.value = e;
406
+ }
407
+ return;
408
+ }
409
+ try {
410
+ v.value = JSON.stringify(JSON.parse(e), null, 2);
411
+ } catch {
412
+ v.value = e;
413
+ }
414
+ }, {
415
+ immediate: !0
416
+ });
417
+ const B = f(1), _e = f(!1), J = f(0), ee = h(() => Math.max(1, Math.ceil(J.value / ue))), te = x().format("YYYY-MM-DD"), m = f({
418
+ startDate: `${te} 00:00`,
419
+ endDate: `${te} 23:59`
420
+ }), _ = f(), k = f(), S = f(), O = f(), T = f("all");
421
+ function d(e) {
422
+ return typeof e == "string" ? [e] : Array.isArray(e) ? e.filter((t) => typeof t == "string") : [];
423
+ }
424
+ const H = ne.filter((e) => e.key !== "all").map((e) => e.key);
425
+ function $(e) {
426
+ const t = ne.find((n) => n.key !== "all" && n.subjectPrefixes.some((g) => e.startsWith(g)));
427
+ return (t == null ? void 0 : t.key) ?? "other";
428
+ }
429
+ function le(e) {
430
+ const t = H.indexOf(e);
431
+ return t === -1 ? H.length : t;
432
+ }
433
+ const Oe = h(() => ne.map(({
434
+ key: e
435
+ }) => ({
436
+ label: o(`auditLog.modules.${e}`),
437
+ value: e
438
+ }))), E = h(() => ne.find((e) => e.key === T.value) ?? ne[0]), oe = h(() => T.value === "all"), re = f([]), de = f(!1), Ze = h(() => [...de.value ? [{
439
+ label: o("auditLog.user.feedmeAdmin"),
440
+ value: pe
441
+ }] : [], ...L.members.map((e) => ({
442
+ label: e.name,
443
+ value: e.doc.userId
444
+ })), ...re.value.map((e) => ({
445
+ label: `${e.name} (${o("auditLog.user.feedmeAdmin")})`,
446
+ value: e.userId
447
+ }))]), K = h(() => {
448
+ const e = _.value ?? [];
449
+ return {
450
+ userIds: e.filter((t) => t !== pe),
451
+ feedmeAdminActors: e.includes(pe)
452
+ };
453
+ }), Te = h(() => {
454
+ const e = Je.flatMap((r) => d(r.subject).map((F) => ({
455
+ label: r.label,
456
+ value: F
457
+ }))), t = Object.entries(He).map(([r, F]) => ({
458
+ label: F,
459
+ value: r
460
+ })), n = /* @__PURE__ */ new Set(), g = [];
461
+ for (const r of [...e, ...t])
462
+ if (!n.has(r.value)) {
463
+ n.add(r.value);
464
+ const F = $(r.value);
465
+ g.push({
466
+ ...r,
467
+ group: o(`auditLog.modules.${F}`)
468
+ });
469
+ }
470
+ return g.sort((r, F) => le($(r.value)) - le($(F.value)));
471
+ }), et = h(() => oe.value ? Te.value : Te.value.filter((e) => $(e.value) === T.value));
472
+ function tt(e, t) {
473
+ const n = t.toLowerCase();
474
+ return e.label.toLowerCase().includes(n) || e.value.replace(/^business::/, "").toLowerCase().includes(n) ? !0 : e.value.toLowerCase().includes(n);
475
+ }
476
+ const U = h(() => ({
477
+ manage: o("auditLog.action.manage"),
478
+ create: o("auditLog.action.create"),
479
+ read: o("auditLog.action.read"),
480
+ update: o("auditLog.action.update"),
481
+ delete: o("auditLog.action.delete")
482
+ })), lt = h(() => [{
483
+ label: U.value.manage,
484
+ value: "manage"
485
+ }, {
486
+ label: U.value.create,
487
+ value: "create"
488
+ }, {
489
+ label: U.value.read,
490
+ value: "read"
491
+ }, {
492
+ label: U.value.update,
493
+ value: "update"
494
+ }, {
495
+ label: U.value.delete,
496
+ value: "delete"
497
+ }]), ce = h(() => ({
498
+ allowed: o("auditLog.outcome.success"),
499
+ denied: o("auditLog.outcome.failed"),
500
+ skipped: o("auditLog.outcome.skipped")
501
+ })), ye = h(() => {
502
+ var e;
503
+ return ((e = c.sessionUser.value) == null ? void 0 : e.isInternal) ?? !1;
504
+ });
505
+ function je(e) {
506
+ return !ye.value && e === "skipped" ? "allowed" : e;
507
+ }
508
+ function xe(e) {
509
+ return !(e != null && e.length) || ye.value ? e : e.includes("allowed") ? [.../* @__PURE__ */ new Set([...e, "skipped"])] : e;
510
+ }
511
+ const ot = h(() => [{
512
+ label: ce.value.allowed,
513
+ value: "allowed"
514
+ }, {
515
+ label: ce.value.denied,
516
+ value: "denied"
517
+ }, ...ye.value ? [{
518
+ label: ce.value.skipped,
519
+ value: "skipped"
520
+ }] : []]), at = h(() => ({
521
+ admin: o("auditLog.detail.resolvedFromValue.admin"),
522
+ staff: o("auditLog.detail.resolvedFromValue.staff"),
523
+ permissionSet: o("auditLog.detail.resolvedFromValue.permissionSet"),
524
+ systemPermissionSet: o("auditLog.detail.resolvedFromValue.systemPermissionSet"),
525
+ custom: o("auditLog.detail.resolvedFromValue.custom"),
526
+ "no-match": o("auditLog.detail.resolvedFromValue.noMatch"),
527
+ unknown: o("auditLog.detail.resolvedFromValue.unknown")
528
+ })), st = h(() => ({
529
+ GET: U.value.read,
530
+ POST: U.value.create,
531
+ PUT: U.value.update,
532
+ PATCH: U.value.update,
533
+ DELETE: U.value.delete
534
+ })), nt = {
535
+ allowed: "success",
536
+ denied: "critical",
537
+ skipped: "warning"
538
+ };
539
+ function me(e) {
540
+ return x(e).format(ao);
541
+ }
542
+ const ut = h(() => {
543
+ const {
544
+ startDate: e,
545
+ endDate: t
546
+ } = m.value;
547
+ return e && t ? `${me(e)} – ${me(t)}` : e ? me(e) : t ? me(t) : o("auditLog.dateRange.placeholder");
548
+ }), it = h(() => [{
549
+ label: o("date.predefinedRanges.today"),
550
+ value: {
551
+ startDate: x().format(V),
552
+ endDate: x().format(V)
553
+ }
554
+ }, {
555
+ label: o("date.predefinedRanges.yesterday"),
556
+ value: {
557
+ startDate: x().subtract(1, "day").format(V),
558
+ endDate: x().subtract(1, "day").format(V)
559
+ }
560
+ }, {
561
+ label: o("date.predefinedRanges.thisWeek"),
562
+ value: {
563
+ startDate: x().startOf("week").format(V),
564
+ endDate: x().endOf("week").format(V)
565
+ }
566
+ }, {
567
+ label: o("date.predefinedRanges.lastWeek"),
568
+ value: {
569
+ startDate: x().subtract(1, "week").startOf("week").format(V),
570
+ endDate: x().subtract(1, "week").endOf("week").format(V)
571
+ }
572
+ }, {
573
+ label: o("date.predefinedRanges.last7Days"),
574
+ value: {
575
+ startDate: x().subtract(7, "day").format(V),
576
+ endDate: x().subtract(1, "day").format(V)
577
+ }
578
+ }, {
579
+ label: o("date.predefinedRanges.thisMonth"),
580
+ value: {
581
+ startDate: x().startOf("month").format(V),
582
+ endDate: x().endOf("month").format(V)
583
+ }
584
+ }, {
585
+ label: o("date.predefinedRanges.lastMonth"),
586
+ value: {
587
+ startDate: x().subtract(1, "month").startOf("month").format(V),
588
+ endDate: x().subtract(1, "month").endOf("month").format(V)
589
+ }
590
+ }]);
591
+ function Le(e) {
592
+ var t;
593
+ return ((t = Je.find((n) => n.subject === e)) == null ? void 0 : t.label) ?? He[e];
594
+ }
595
+ function fe(e) {
596
+ var n;
597
+ const t = L.userIdToName[e.userId];
598
+ return t || (L.hasLoaded ? (n = c.sessionUser.value) != null && n.isInternal ? `${e.actorName ?? e.userId} (${o("auditLog.user.feedmeAdmin")})` : o("auditLog.user.feedmeAdmin") : e.userId);
599
+ }
600
+ function Pe(e) {
601
+ return L.userIdToPhone[e.userId] || "-";
602
+ }
603
+ function rt(e) {
604
+ return L.userIdToEmail[e.userId] || "-";
605
+ }
606
+ function Ve(e) {
607
+ return x(e).format("DD MMM YYYY, HH:mm");
608
+ }
609
+ function dt(e) {
610
+ return x(e).format("DD MMM YYYY, HH:mm:ss").toUpperCase();
611
+ }
612
+ function Ee(e) {
613
+ return U.value[e] ?? e;
614
+ }
615
+ function Re(e) {
616
+ return e.metadata.operationLabel ?? Ee(e.action);
617
+ }
618
+ function ct(e) {
619
+ return Le(e.subject) ?? e.subject;
620
+ }
621
+ function Se(e) {
622
+ return ce.value[je(e)];
623
+ }
624
+ function Ce(e) {
625
+ return nt[je(e)] ?? "neutral";
626
+ }
627
+ function mt(e) {
628
+ return at.value[e] ?? e;
629
+ }
630
+ function ft(e) {
631
+ return e.metadata.requestMethod ? st.value[e.metadata.requestMethod] ?? e.metadata.requestMethod : Ee(e.action);
632
+ }
633
+ function Ue(e) {
634
+ const t = String(e ?? "");
635
+ return `"${(/^[=+\-@\t\r]/.test(t) ? `'${t}` : t).replace(/"/g, '""')}"`;
636
+ }
637
+ const we = [{
638
+ key: "timestamp",
639
+ labelKey: "auditLog.exportFields.timestamp",
640
+ getValue: (e) => Ve(e.timestamp),
641
+ defaultSelected: !0
642
+ }, {
643
+ key: "userName",
644
+ labelKey: "auditLog.exportFields.userName",
645
+ getValue: (e) => fe(e),
646
+ defaultSelected: !0
647
+ }, {
648
+ key: "userPhone",
649
+ labelKey: "auditLog.exportFields.userPhone",
650
+ getValue: (e) => Pe(e),
651
+ defaultSelected: !0
652
+ }, {
653
+ key: "subject",
654
+ labelKey: "auditLog.exportFields.subject",
655
+ getValue: (e) => Le(e.subject) ?? e.subject,
656
+ defaultSelected: !0
657
+ }, {
658
+ key: "action",
659
+ labelKey: "auditLog.exportFields.action",
660
+ getValue: (e) => e.action,
661
+ defaultSelected: !0
662
+ }, {
663
+ key: "operation",
664
+ labelKey: "auditLog.exportFields.operation",
665
+ getValue: (e) => Re(e),
666
+ defaultSelected: !0
667
+ }, {
668
+ key: "outcome",
669
+ labelKey: "auditLog.exportFields.outcome",
670
+ getValue: (e) => Se(e.outcome),
671
+ defaultSelected: !0
672
+ }, {
673
+ key: "businessId",
674
+ labelKey: "auditLog.exportFields.businessId",
675
+ getValue: (e) => e.businessId,
676
+ defaultSelected: !1
677
+ }, {
678
+ key: "restaurantId",
679
+ labelKey: "auditLog.exportFields.restaurantId",
680
+ getValue: (e) => e.restaurantId,
681
+ defaultSelected: !1
682
+ }, {
683
+ key: "country",
684
+ labelKey: "auditLog.exportFields.country",
685
+ getValue: (e) => e.country,
686
+ defaultSelected: !1
687
+ }, {
688
+ key: "resolvedFrom",
689
+ labelKey: "auditLog.exportFields.resolvedFrom",
690
+ getValue: (e) => {
691
+ var t;
692
+ return (t = e.metadata) == null ? void 0 : t.resolvedFrom;
693
+ },
694
+ defaultSelected: !1
695
+ }, {
696
+ key: "requestMethod",
697
+ labelKey: "auditLog.exportFields.requestMethod",
698
+ getValue: (e) => {
699
+ var t;
700
+ return (t = e.metadata) == null ? void 0 : t.requestMethod;
701
+ },
702
+ defaultSelected: !1
703
+ }, {
704
+ key: "requestPath",
705
+ labelKey: "auditLog.exportFields.requestPath",
706
+ getValue: (e) => {
707
+ var t;
708
+ return (t = e.metadata) == null ? void 0 : t.requestPath;
709
+ },
710
+ defaultSelected: !1
711
+ }];
712
+ function vt() {
713
+ try {
714
+ const e = localStorage.getItem(Ge);
715
+ if (e) {
716
+ const t = JSON.parse(e);
717
+ if (Array.isArray(t) && t.length > 0) return new Set(t);
718
+ }
719
+ } catch {
720
+ }
721
+ return new Set(we.filter((e) => e.defaultSelected).map((e) => e.key));
722
+ }
723
+ const G = f(vt());
724
+ function gt(e) {
725
+ const t = new Set(G.value);
726
+ if (t.has(e)) {
727
+ if (t.size <= 1) return;
728
+ t.delete(e);
729
+ } else
730
+ t.add(e);
731
+ G.value = t;
732
+ try {
733
+ localStorage.setItem(Ge, JSON.stringify([...t]));
734
+ } catch {
735
+ }
736
+ }
737
+ async function bt() {
738
+ var e, t, n, g, r;
739
+ if (!I.value) {
740
+ I.value = !0;
741
+ try {
742
+ const {
743
+ startDate: F,
744
+ endDate: z
745
+ } = m.value, W = E.value.subjectPrefixes, ve = (/* @__PURE__ */ new Date()).toISOString().slice(0, 19).replace("T", " "), ae = z ? q(z) : null, p = ae && ae < ve ? ae : ve, X = {
746
+ ...F ? {
747
+ from: q(F)
748
+ } : {},
749
+ to: p,
750
+ ...K.value.userIds.length ? {
751
+ userIds: K.value.userIds
752
+ } : {},
753
+ ...K.value.feedmeAdminActors ? {
754
+ feedmeAdminActors: !0
755
+ } : {},
756
+ ...(e = k.value) != null && e.length ? {
757
+ subjects: k.value
758
+ } : {},
759
+ ...W.length ? {
760
+ subjectPrefixes: [...W]
761
+ } : {},
762
+ ...(t = O.value) != null && t.length ? {
763
+ actions: O.value
764
+ } : {},
765
+ ...(n = S.value) != null && n.length ? {
766
+ outcomes: xe(S.value)
767
+ } : {}
768
+ }, Ye = [];
769
+ let Be = 0;
770
+ for (; ; ) {
771
+ const R = await be.read({
772
+ ...X,
773
+ limit: De,
774
+ offset: Be
775
+ });
776
+ if (Ye.push(...R), R.length < De) break;
777
+ Be += De;
778
+ }
779
+ const Ke = we.filter((R) => G.value.has(R.key)), wt = Ke.map((R) => o(R.labelKey)), kt = Ye.map((R) => Ke.map((Pt) => Pt.getValue(R) ?? "")), Ie = -(/* @__PURE__ */ new Date()).getTimezoneOffset(), It = Ie >= 0 ? "+" : "-", At = String(Math.floor(Math.abs(Ie) / 60)).padStart(2, "0"), Ft = String(Math.abs(Ie) % 60).padStart(2, "0"), Mt = `UTC${It}${At}:${Ft}`, ze = ((g = c.currentBusiness.value) == null ? void 0 : g.name) || "", Dt = [F, z].filter(Boolean).join(" – "), Ot = [...[[o("auditLog.title")], [`${o("auditLog.frontMatter.date")}: ${Dt}`], ...ze ? [[`${o("auditLog.frontMatter.business")}: ${ze}`]] : [], [`${o("auditLog.frontMatter.generatedBy")}: ${x().format("DD MMM YYYY, HH:mm")} (${Mt})`], []].map((R) => R.map(Ue).join(",")), ...[wt, ...kt].map((R) => R.map(Ue).join(","))].join(`
780
+ `), Tt = `audit-log_${(((r = c.currentBusiness.value) == null ? void 0 : r.name) || "business").replace(/[^a-z0-9_-]+/gi, "_")}_${x().format("YYYYMMDD_HHmmss")}.csv`, jt = new Blob([`\uFEFF${Ot}`], {
781
+ type: "text/csv;charset=utf-8;"
782
+ }), qe = window.URL.createObjectURL(jt), se = document.createElement("a");
783
+ se.href = qe, se.download = Tt, document.body.appendChild(se), se.click(), se.remove(), window.URL.revokeObjectURL(qe);
784
+ } finally {
785
+ I.value = !1;
786
+ }
787
+ }
788
+ }
789
+ const pt = [{
790
+ accessorKey: "timestamp",
791
+ header: () => o("auditLog.columns.timestamp"),
792
+ cell(e) {
793
+ return Ve(e.row.original.timestamp);
794
+ }
795
+ }, {
796
+ accessorKey: "userId",
797
+ header: () => o("auditLog.columns.user"),
798
+ enableSorting: !1,
799
+ size: 220,
800
+ cell(e) {
801
+ const t = e.row.original;
802
+ return b("div", {
803
+ class: "flex items-center gap-8"
804
+ }, [b(We.FmAvatar, {
805
+ name: fe(t),
806
+ size: "sm",
807
+ class: "shrink-0"
808
+ }, null), b("div", {
809
+ class: "min-w-0"
810
+ }, [b("p", {
811
+ class: "truncate font-semibold"
812
+ }, [fe(t)]), b("p", {
813
+ class: "truncate text-fm-color-typo-secondary"
814
+ }, [Pe(t)])])]);
815
+ }
816
+ }, {
817
+ accessorKey: "subject",
818
+ header: () => o("auditLog.columns.subject"),
819
+ cell(e) {
820
+ const t = e.row.original;
821
+ return Le(t.subject) ?? t.subject;
822
+ }
823
+ }, {
824
+ accessorKey: "action",
825
+ header: () => o("auditLog.columns.action"),
826
+ enableSorting: !1,
827
+ size: 280,
828
+ meta: {
829
+ cellSpanClass: "audit-log-action-label"
830
+ },
831
+ cell(e) {
832
+ return Re(e.row.original);
833
+ }
834
+ }, {
835
+ accessorKey: "outcome",
836
+ header: () => o("auditLog.columns.outcome"),
837
+ enableSorting: !1,
838
+ cell(e) {
839
+ const t = e.row.original;
840
+ return b(We.FmChip, {
841
+ variant: Ce(t.outcome),
842
+ label: Se(t.outcome),
843
+ compact: !0
844
+ }, null);
845
+ }
846
+ }];
847
+ function q(e) {
848
+ const t = x(e, so);
849
+ return new Date(t.year(), t.month(), t.date(), t.hour(), t.minute(), 0).toISOString().slice(0, 19).replace("T", " ");
850
+ }
851
+ async function $e() {
852
+ var e, t, n;
853
+ j.value = !0;
854
+ try {
855
+ const {
856
+ startDate: g,
857
+ endDate: r
858
+ } = m.value, F = (B.value - 1) * ue, z = E.value.subjectPrefixes, W = await be.read({
859
+ limit: ue,
860
+ offset: F,
861
+ ...g ? {
862
+ from: q(g)
863
+ } : {},
864
+ ...r ? {
865
+ to: q(r)
866
+ } : {},
867
+ ...K.value.userIds.length ? {
868
+ userIds: K.value.userIds
869
+ } : {},
870
+ ...K.value.feedmeAdminActors ? {
871
+ feedmeAdminActors: !0
872
+ } : {},
873
+ ...(e = k.value) != null && e.length ? {
874
+ subjects: k.value
875
+ } : {},
876
+ ...z.length ? {
877
+ subjectPrefixes: [...z]
878
+ } : {},
879
+ ...(t = O.value) != null && t.length ? {
880
+ actions: O.value
881
+ } : {},
882
+ ...(n = S.value) != null && n.length ? {
883
+ outcomes: xe(S.value)
884
+ } : {}
885
+ });
886
+ w.value = W, _e.value = W.length === ue;
887
+ } finally {
888
+ j.value = !1;
889
+ }
890
+ }
891
+ const Ne = h(() => {
892
+ var e;
893
+ return JSON.stringify({
894
+ businessId: ((e = c.currentBusiness.value) == null ? void 0 : e._id) ?? "",
895
+ dateRange: m.value,
896
+ users: [..._.value ?? []].sort(),
897
+ subjects: [...k.value ?? []].sort(),
898
+ outcomes: [...S.value ?? []].sort(),
899
+ actions: [...O.value ?? []].sort(),
900
+ moduleKey: T.value
901
+ });
902
+ });
903
+ async function ht() {
904
+ var g, r, F;
905
+ const {
906
+ startDate: e,
907
+ endDate: t
908
+ } = m.value, n = E.value.subjectPrefixes;
909
+ J.value = await be.count({
910
+ ...e ? {
911
+ from: q(e)
912
+ } : {},
913
+ ...t ? {
914
+ to: q(t)
915
+ } : {},
916
+ ...K.value.userIds.length ? {
917
+ userIds: K.value.userIds
918
+ } : {},
919
+ ...K.value.feedmeAdminActors ? {
920
+ feedmeAdminActors: !0
921
+ } : {},
922
+ ...(g = k.value) != null && g.length ? {
923
+ subjects: k.value
924
+ } : {},
925
+ ...n.length ? {
926
+ subjectPrefixes: [...n]
927
+ } : {},
928
+ ...(r = O.value) != null && r.length ? {
929
+ actions: O.value
930
+ } : {},
931
+ ...(F = S.value) != null && F.length ? {
932
+ outcomes: xe(S.value)
933
+ } : {}
934
+ });
935
+ }
936
+ Q(Ne, async () => {
937
+ var e;
938
+ B.value = 1, (e = c.currentBusiness.value) != null && e._id && await Promise.all([ht(), $e()]);
939
+ }, {
940
+ immediate: !0
941
+ }), Q(T, () => {
942
+ k.value = void 0;
943
+ });
944
+ let ke = !1;
945
+ async function _t({
946
+ pageIndex: e
947
+ }) {
948
+ var t;
949
+ if ((t = c.currentBusiness.value) != null && t._id && !(e === 0 && B.value === 1) && !ke) {
950
+ ke = !0, B.value = e + 1;
951
+ try {
952
+ await $e();
953
+ } finally {
954
+ ke = !1;
955
+ }
956
+ }
957
+ }
958
+ function yt(e) {
959
+ s.value = e, D.value = !0;
960
+ }
961
+ function xt() {
962
+ D.value = !1, s.value = null;
963
+ }
964
+ Q(c.currentBusiness, (e) => {
965
+ e && L.readTeamMembers();
966
+ }, {
967
+ immediate: !0
968
+ });
969
+ function Lt() {
970
+ const e = _.value;
971
+ if (!(e != null && e.length)) return;
972
+ const t = new Set(re.value.map((r) => r.userId)), n = new Set(L.members.map((r) => r.doc.userId)), g = e.filter((r) => r === pe ? de.value : L.hasLoaded ? n.has(r) || t.has(r) : !0);
973
+ g.length !== e.length && (_.value = g.length ? g : void 0);
974
+ }
975
+ async function St() {
976
+ var n;
977
+ if (!((n = c.currentBusiness.value) != null && n._id)) return;
978
+ const {
979
+ startDate: e,
980
+ endDate: t
981
+ } = m.value;
982
+ try {
983
+ const {
984
+ actors: g,
985
+ showFeedmeAdminFilter: r
986
+ } = await be.getFeedmeAdminFilter({
987
+ ...e ? {
988
+ from: q(e)
989
+ } : {},
990
+ ...t ? {
991
+ to: q(t)
992
+ } : {}
993
+ });
994
+ re.value = g, de.value = r;
995
+ } catch {
996
+ re.value = [], de.value = !1;
997
+ }
998
+ Lt();
999
+ }
1000
+ return Q(() => {
1001
+ var e;
1002
+ return {
1003
+ businessId: (e = c.currentBusiness.value) == null ? void 0 : e._id,
1004
+ range: m.value
1005
+ };
1006
+ }, () => St(), {
1007
+ immediate: !0,
1008
+ deep: !0
1009
+ }), (e, t) => {
1010
+ const n = C("FmSpacer"), g = C("FmButton"), r = C("FmMenuItem"), F = C("FmMenu"), z = C("FmChip"), W = C("FmDateRangePicker"), ve = C("FmTable"), ae = C("FmSideSheet");
1011
+ return y(), M(Z, null, [b(Nt, {
1012
+ heading: i(o)("auditLog.title")
1013
+ }, {
1014
+ "append-heading": Y(() => [b(n), b(g, {
1015
+ variant: "primary",
1016
+ "prepend-icon": "upload",
1017
+ label: i(o)("auditLog.export"),
1018
+ disabled: w.value.length === 0 || I.value || i(L).isLoading || i(L).members.length === 0,
1019
+ loading: I.value,
1020
+ onClick: bt
1021
+ }, null, 8, ["label", "disabled", "loading"]), b(F, {
1022
+ "close-on-click": !1,
1023
+ "z-index": 50
1024
+ }, {
1025
+ "menu-button": Y(() => [b(g, {
1026
+ variant: "tertiary",
1027
+ icon: "settings",
1028
+ "aria-label": i(o)("auditLog.exportSettings.title"),
1029
+ disabled: I.value
1030
+ }, null, 8, ["aria-label", "disabled"])]),
1031
+ default: Y(() => [a("div", Xt, [a("p", Qt, u(i(o)("auditLog.exportSettings.title")), 1), (y(), M(Z, null, ie(we, (p) => b(r, {
1032
+ key: p.key,
1033
+ label: i(o)(p.labelKey),
1034
+ "has-checkbox": "",
1035
+ "model-value": G.value.has(p.key),
1036
+ disabled: G.value.has(p.key) && G.value.size === 1,
1037
+ onClick: (X) => gt(p.key)
1038
+ }, null, 8, ["label", "model-value", "disabled", "onClick"])), 64))])]),
1039
+ _: 1
1040
+ })]),
1041
+ default: Y(() => [a("div", Zt, [a("div", el, [b(Jt, {
1042
+ modelValue: T.value,
1043
+ "onUpdate:modelValue": t[0] || (t[0] = (p) => T.value = p),
1044
+ items: Oe.value
1045
+ }, null, 8, ["modelValue", "items"]), a("div", tl, [b(W, {
1046
+ modelValue: m.value,
1047
+ "onUpdate:modelValue": t[1] || (t[1] = (p) => m.value = p),
1048
+ "show-predefined-range": "",
1049
+ "show-time": "",
1050
+ "predefined-range": it.value
1051
+ }, {
1052
+ "trigger-button": Y(() => [b(z, {
1053
+ label: ut.value,
1054
+ icon: "calendar_month"
1055
+ }, null, 8, ["label"])]),
1056
+ _: 1
1057
+ }, 8, ["modelValue", "predefined-range"]), a("div", ll, [b(ge, {
1058
+ modelValue: _.value,
1059
+ "onUpdate:modelValue": t[2] || (t[2] = (p) => _.value = p),
1060
+ items: Ze.value,
1061
+ multiple: "",
1062
+ variant: "dark",
1063
+ placeholder: i(o)("auditLog.filter.user_placeholder"),
1064
+ "selected-prefix": i(o)("auditLog.filter.selected_user_prefix"),
1065
+ "chip-icon": "account_circle"
1066
+ }, null, 8, ["modelValue", "items", "placeholder", "selected-prefix"])]), a("div", ol, [b(ge, {
1067
+ modelValue: k.value,
1068
+ "onUpdate:modelValue": t[3] || (t[3] = (p) => k.value = p),
1069
+ items: et.value,
1070
+ "filter-fn": tt,
1071
+ multiple: "",
1072
+ variant: "dark",
1073
+ placeholder: i(o)("auditLog.filter.subject_placeholder"),
1074
+ "selected-prefix": i(o)("auditLog.filter.selected_subject_prefix"),
1075
+ "chip-icon": "badge"
1076
+ }, null, 8, ["modelValue", "items", "placeholder", "selected-prefix"])]), a("div", al, [b(ge, {
1077
+ modelValue: O.value,
1078
+ "onUpdate:modelValue": t[4] || (t[4] = (p) => O.value = p),
1079
+ items: lt.value,
1080
+ multiple: "",
1081
+ variant: "dark",
1082
+ placeholder: i(o)("auditLog.filter.action_placeholder"),
1083
+ "selected-prefix": i(o)("auditLog.filter.selected_action_prefix"),
1084
+ searchable: !1
1085
+ }, null, 8, ["modelValue", "items", "placeholder", "selected-prefix"])]), a("div", sl, [b(ge, {
1086
+ modelValue: S.value,
1087
+ "onUpdate:modelValue": t[5] || (t[5] = (p) => S.value = p),
1088
+ items: ot.value,
1089
+ multiple: "",
1090
+ variant: "dark",
1091
+ placeholder: i(o)("auditLog.filter.status_placeholder"),
1092
+ "selected-prefix": i(o)("auditLog.filter.selected_status_prefix"),
1093
+ searchable: !1,
1094
+ "chip-icon": "check_circle"
1095
+ }, null, 8, ["modelValue", "items", "placeholder", "selected-prefix"])])])]), b(Ut, null, {
1096
+ default: Y(() => [a("div", nl, [b(Yt, {
1097
+ "is-loading": j.value,
1098
+ "is-empty": w.value.length === 0,
1099
+ title: i(o)("auditLog.noData.title"),
1100
+ subtitle: i(o)("auditLog.noData.subtitle")
1101
+ }, {
1102
+ default: Y(() => [(y(), he(ve, {
1103
+ key: Ne.value,
1104
+ "column-defs": pt,
1105
+ "row-data": w.value,
1106
+ "page-size": ue,
1107
+ "page-count": ee.value,
1108
+ "row-count": J.value,
1109
+ "fetch-fn": _t,
1110
+ "hide-footer": ee.value <= 1,
1111
+ loading: j.value,
1112
+ "pin-header-row": "",
1113
+ class: "audit-log-list-table cursor-pointer",
1114
+ onRowClick: t[6] || (t[6] = (p) => yt(p.original))
1115
+ }, null, 8, ["row-data", "page-count", "row-count", "hide-footer", "loading"]))]),
1116
+ _: 1
1117
+ }, 8, ["is-loading", "is-empty", "title", "subtitle"])])]),
1118
+ _: 1
1119
+ })])]),
1120
+ _: 1
1121
+ }, 8, ["heading"]), b(ae, {
1122
+ header: i(o)("auditLog.detail.header"),
1123
+ "model-value": D.value,
1124
+ "max-width": 480,
1125
+ "dismiss-away": "",
1126
+ "onUpdate:modelValue": t[7] || (t[7] = (p) => {
1127
+ p || xt();
1128
+ })
1129
+ }, {
1130
+ default: Y(() => [s.value ? (y(), M("div", ul, [a("div", il, [a("div", rl, [a("p", dl, u(ct(s.value)), 1)]), b(z, {
1131
+ variant: Ce(s.value.outcome),
1132
+ label: Se(s.value.outcome),
1133
+ compact: ""
1134
+ }, null, 8, ["variant", "label"])]), a("div", cl, [a("div", ml, [a("div", null, [a("p", fl, u(i(o)("auditLog.detail.date")), 1), a("p", vl, u(dt(s.value.timestamp)), 1)]), a("div", null, [a("p", gl, u(i(o)("auditLog.detail.user")), 1), a("p", bl, u(fe(s.value)), 1)]), a("div", null, [a("p", pl, u(i(o)("auditLog.detail.email")), 1), a("p", hl, u(rt(s.value)), 1)]), s.value.field ? (y(), M("div", _l, [a("p", yl, u(i(o)("auditLog.detail.field")), 1), a("p", xl, u(s.value.field), 1)])) : N("", !0), a("div", null, [a("p", Ll, u(i(o)("auditLog.detail.business")), 1), a("p", Sl, u(s.value.businessId || "-"), 1)]), a("div", null, [a("p", wl, u(i(o)("auditLog.detail.restaurant")), 1), a("p", kl, u(s.value.restaurantId || "-"), 1)])])]), a("div", Il, [a("div", Al, [a("p", Fl, u(i(o)("auditLog.detail.eventDetails")), 1)]), t[8] || (t[8] = a("hr", {
1135
+ class: "border-fm-color-border-default"
1136
+ }, null, -1)), a("div", Ml, [a("div", null, [a("p", Dl, u(i(o)("auditLog.detail.actionDescription")), 1), a("p", Ol, u(s.value.metadata.operationLabel || "-"), 1)])])]), a("div", Tl, [a("div", jl, [a("p", Pl, u(i(o)("auditLog.detail.metadata")), 1)]), t[9] || (t[9] = a("hr", {
1137
+ class: "border-fm-color-border-default"
1138
+ }, null, -1)), a("div", Vl, [a("div", null, [a("p", El, u(i(o)("auditLog.detail.resolvedFrom")), 1), a("p", Rl, u(mt(s.value.metadata.resolvedFrom)), 1)]), (s.value.metadata.resolvedFrom === "permissionSet" || s.value.metadata.resolvedFrom === "systemPermissionSet") && (s.value.metadata.permissionSetName || s.value.metadata.permissionSetId) ? (y(), M("div", Cl, [a("p", Ul, u(i(o)("auditLog.detail.permissionSet")), 1), s.value.metadata.permissionSetName ? (y(), M("p", $l, u(s.value.metadata.permissionSetName), 1)) : N("", !0), s.value.metadata.permissionSetId ? (y(), M("p", Nl, u(s.value.metadata.permissionSetId), 1)) : N("", !0)])) : N("", !0), s.value.metadata.reason ? (y(), M("div", Yl, [a("p", Bl, u(i(o)("auditLog.detail.reason")), 1), a("p", Kl, u(s.value.metadata.reason), 1)])) : N("", !0), a("div", null, [a("p", zl, u(i(o)("auditLog.detail.requestMethod")), 1), a("p", ql, u(ft(s.value)), 1)]), a("div", null, [a("p", Hl, u(i(o)("auditLog.detail.requestPath")), 1), a("p", Wl, u(s.value.metadata.requestPath || "-"), 1)]), s.value.metadata.trace && s.value.metadata.trace.length > 0 ? (y(), M("div", Jl, [a("p", Gl, u(i(o)("auditLog.detail.permissionTrace")), 1), a("ol", Xl, [(y(!0), M(Z, null, ie(s.value.metadata.trace, (p, X) => (y(), M("li", {
1139
+ key: X,
1140
+ class: "flex items-center gap-6"
1141
+ }, [a("span", Ql, u(X + 1), 1), a("span", Zl, u(p), 1), X < s.value.metadata.trace.length - 1 ? (y(), M("span", eo, "→")) : N("", !0)]))), 128))])])) : N("", !0), v.value ? (y(), M("div", to, [a("p", lo, u(i(o)("auditLog.detail.requestBody")), 1), a("pre", oo, u(v.value), 1)])) : N("", !0)])])])) : N("", !0)]),
1142
+ _: 1
1143
+ }, 8, ["header", "model-value"])], 64);
1144
+ };
1145
+ }
1146
+ }), xo = /* @__PURE__ */ $t(no, [["__scopeId", "data-v-ab237027"]]);
1147
+ export {
1148
+ xo as default
1149
+ };