@feedmepos/mf-hrm-portal 2.3.2-dev.10 → 2.3.2-dev.12

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 (62) hide show
  1. package/dist/{ApprovalCodeList-RKU5B8SO.js → ApprovalCodeList-CCh9mNJh.js} +7 -7
  2. package/dist/AuditLogList-DCADUZ5s.js +2019 -0
  3. package/dist/{ConditionBuilderForm.vue_vue_type_script_setup_true_lang-pL2zRc67.js → ConditionBuilderForm.vue_vue_type_script_setup_true_lang-BZQNDOg7.js} +10 -10
  4. package/dist/{EmployeeList-nrYsS5uz.js → EmployeeList-CRI7XjzX.js} +8 -8
  5. package/dist/{FormSection.vue_vue_type_script_setup_true_lang-7S2w36aY.js → FormSection.vue_vue_type_script_setup_true_lang-y9_hxba6.js} +1 -1
  6. package/dist/{GrantUserList-BSjeC4MC.js → GrantUserList-DbMngkpK.js} +8 -8
  7. package/dist/{Main-DbdoVLCE.js → Main-BsFUfsmP.js} +29 -29
  8. package/dist/{Main-DtmCBbTR.js → Main-CrnM6wr8.js} +2168 -2169
  9. package/dist/{Main-CpuHaXU6.js → Main-D4Zq5AXi.js} +5 -5
  10. package/dist/{MyPosProfile-CsTCfGNT.js → MyPosProfile-B4cE47im.js} +1 -1
  11. package/dist/{PermissionSetList-B1c-uGZO.js → PermissionSetList-D_2x-mDD.js} +112 -113
  12. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-BM9Von-l.js +4212 -0
  13. package/dist/{PortalUserSearcher.vue_vue_type_style_index_0_scoped_827dfd60_lang-D6Z9z_Yt.js → PortalUserSearcher.vue_vue_type_style_index_0_scoped_827dfd60_lang-COX-N0k6.js} +414 -448
  14. package/dist/{RoleForm.vue_vue_type_script_setup_true_lang-TWTVo_9Y.js → RoleForm.vue_vue_type_script_setup_true_lang-D8V8KWiL.js} +41 -41
  15. package/dist/{RoleList-CwaGNsFy.js → RoleList-BC-c7fqn.js} +105 -96
  16. package/dist/{ScheduleAddPositionModal.vue_vue_type_script_setup_true_lang-C2ekVXdR.js → ScheduleAddPositionModal.vue_vue_type_script_setup_true_lang-DBbuSrXV.js} +1 -1
  17. package/dist/{ScheduleGeneralPage-BVtXmxtp.js → ScheduleGeneralPage-eytzOZQr.js} +2 -2
  18. package/dist/{ScheduleModal.vue_vue_type_script_setup_true_lang-DdsQ8v-5.js → ScheduleModal.vue_vue_type_script_setup_true_lang-CP-kToVO.js} +4 -4
  19. package/dist/{SchedulePage-3qksmT2I.js → SchedulePage-B0QirzAk.js} +17 -17
  20. package/dist/{SchedulePositionPage-DAU20KPZ.js → SchedulePositionPage-BAE-NQvL.js} +3 -3
  21. package/dist/{SelectFilter-BpzBwBmQ.js → SelectFilter-DrLJhxt6.js} +1 -1
  22. package/dist/TeamMemberList-CHkiL_q9.js +2083 -0
  23. package/dist/TimesheetList-BZuddmzy.js +402 -0
  24. package/dist/TimesheetList.vue_vue_type_style_index_0_scoped_63294af2_lang-LCUO-ogb.js +58 -0
  25. package/dist/{app-DEZT4wdV.js → app-B9qAxMj1.js} +3516 -3470
  26. package/dist/app.js +1 -1
  27. package/dist/{approval-code-BZTz5OXK.js → approval-code-CTgj9q6m.js} +1 -1
  28. package/dist/{dayjs.min-B55I-uhI.js → dayjs.min-giCSI3N8.js} +22 -22
  29. package/dist/employee-BD3NXG8h.js +210 -0
  30. package/dist/{grant-user-B2rYztyf.js → grant-user-jeTFzGU1.js} +1 -1
  31. package/dist/{index-Bfdseotz.js → iteration-Tyg43nH0.js} +726 -698
  32. package/dist/{lodash-B8bqa6a9.js → lodash-CZsDR_DU.js} +1 -1
  33. package/dist/{member-grant-BIpKkuu8.js → member-grant-DsEMLN1N.js} +2 -2
  34. package/dist/restaurant-CDJ3VjdH.js +49 -0
  35. package/dist/role-BDRWt87n.js +91 -0
  36. package/dist/{rule-Ccopk8R_.js → rule-EiO87cJJ.js} +309 -313
  37. package/dist/src/api/employee/index.d.ts +2 -1
  38. package/dist/src/api/timesheet/index.d.ts +1 -1
  39. package/dist/src/composables/useTenant.d.ts +11 -0
  40. package/dist/src/router/courtGuard.d.ts +4 -0
  41. package/dist/src/stores/employee.d.ts +7 -1
  42. package/dist/src/stores/restaurant.d.ts +1 -61
  43. package/dist/src/stores/team.d.ts +1 -1
  44. package/dist/src/stores/timesheet.d.ts +51 -66
  45. package/dist/src/types/timesheet.d.ts +0 -3
  46. package/dist/style.css +1 -1
  47. package/dist/tsconfig.app.tsbuildinfo +1 -1
  48. package/dist/{useAppStore-DfqsbhT2.js → useAppStore-CkUZ2H5h.js} +1 -1
  49. package/dist/{useLoading-CQnX5WjI.js → useLoading-DJHJM5E0.js} +1 -1
  50. package/dist/useReportPermissions-2dfIX21b.js +80 -0
  51. package/dist/useSsoProviders-BarGHndw.js +41 -0
  52. package/package.json +2 -2
  53. package/dist/AuditLogList-DuDCMjGR.js +0 -2026
  54. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-Toq6qrLx.js +0 -4208
  55. package/dist/TeamMemberList-Bdpm40i3.js +0 -2087
  56. package/dist/TimesheetList-CL_eJp2h.js +0 -437
  57. package/dist/employee-C6z5i6O4.js +0 -172
  58. package/dist/iteration-CcXrOMQe.js +0 -30
  59. package/dist/restaurant-ejyX2jEG.js +0 -52
  60. package/dist/role-C_t3DDlG.js +0 -98
  61. package/dist/timesheet-CZHcebqS.js +0 -76
  62. package/dist/useReportPermissions-kTjftFk7.js +0 -82
@@ -1,2026 +0,0 @@
1
- import { defineComponent as $t, ref as w, computed as A, onMounted as Uo, onBeforeUnmount as Ko, watch as oe, resolveComponent as N, createElementBlock as v, openBlock as f, createBlock as Ce, createCommentVNode as M, createElementVNode as a, Fragment as z, renderList as ce, withCtx as Y, createVNode as h, toDisplayString as l, unref as u, nextTick as Bo, onUnmounted as Yo, createTextVNode as ye, normalizeClass as zo } from "vue";
2
- import { d as j } from "./dayjs.min-B55I-uhI.js";
3
- import { defineStore as qo, storeToRefs as Jo } from "pinia";
4
- import { useI18n as dt, useCoreStore as Ho } from "@feedmepos/mf-common";
5
- import { g as st, b as at, G as Mt, _ as Wo, a as Go } from "./app-DEZT4wdV.js";
6
- import { components as ve } from "@feedmepos/ui-library";
7
- import { S as Fe } from "./SelectFilter-BpzBwBmQ.js";
8
- import { _ as Xo } from "./PageLayout.vue_vue_type_script_setup_true_lang-HKK4cbW8.js";
9
- import { _ as Qo } from "./TableEmptyState.vue_vue_type_script_setup_true_lang-IfAZmWr0.js";
10
- import { t as Zo, p as Dt } from "./rule-Ccopk8R_.js";
11
- import { u as es } from "./restaurant-ejyX2jEG.js";
12
- import { u as ts } from "./useDebounce-B8ZPVS5C.js";
13
- import { n as os } from "./string-DZQ1uNjn.js";
14
- import { useRoute as ss, useRouter as as } from "vue-router";
15
- import { u as ns } from "./useMessage-_ywT_N9X.js";
16
- const ls = {
17
- order: "Order",
18
- refund: "Refund",
19
- drawer: "Cash drawer",
20
- menu: "Menu",
21
- inventory: "Inventory",
22
- deposit: "Deposit",
23
- delivery: "Delivery",
24
- counterRecord: "Counter",
25
- counter: "Counter",
26
- setting: "Settings",
27
- display: "Display",
28
- printer: "Printer",
29
- table: "Table",
30
- employee: "Employee",
31
- system: "System",
32
- tax: "Tax",
33
- paymentType: "Payment type",
34
- faceId: "Face ID",
35
- mallIntegration: "Mall integration",
36
- report: "Report"
37
- }, Me = [
38
- { key: "all", label: "All", subjectPrefixes: [] },
39
- { key: "inventory", label: "Inventory", subjectPrefixes: ["business::inventory", "inventory"], sources: ["portal"] },
40
- { key: "report", label: "Report", subjectPrefixes: ["business::report", "report"], sources: ["portal"] },
41
- { key: "hrm", label: "HRM", subjectPrefixes: ["business::hrm", "hrm"], sources: ["portal"] },
42
- { key: "payment", label: "Payment", subjectPrefixes: ["business::payment", "payment"], sources: ["portal"] },
43
- { key: "menu", label: "Menu", subjectPrefixes: ["business::menu", "menu"], sources: ["portal"] },
44
- { key: "crm", label: "CRM", subjectPrefixes: ["business::crm", "crm"], sources: ["portal"] },
45
- { key: "pos", label: "POS", subjectPrefixes: [], sources: ["pos-v8", "hrm-validate"] }
46
- ], nt = "/audit-logs", Oe = {
47
- async count(t) {
48
- var r, d, y, _, g, S, O, i, V;
49
- const o = {
50
- ...t != null && t.from ? { from: t.from } : {},
51
- ...t != null && t.to ? { to: t.to } : {},
52
- ...(r = t == null ? void 0 : t.userIds) != null && r.length ? { userIds: t.userIds } : {},
53
- ...(d = t == null ? void 0 : t.subjects) != null && d.length ? { subjects: t.subjects } : {},
54
- ...(y = t == null ? void 0 : t.subjectPrefixes) != null && y.length ? { subjectPrefixes: t.subjectPrefixes } : {},
55
- ...(_ = t == null ? void 0 : t.actions) != null && _.length ? { actions: t.actions } : {},
56
- ...(g = t == null ? void 0 : t.outcomes) != null && g.length ? { outcomes: t.outcomes } : {},
57
- ...t != null && t.feedmeAdminActors ? { feedmeAdminActors: !0 } : {},
58
- ...t != null && t.search ? { search: t.search } : {},
59
- ...(S = t == null ? void 0 : t.searchUserIds) != null && S.length ? { searchUserIds: t.searchUserIds } : {},
60
- ...(O = t == null ? void 0 : t.searchSubjects) != null && O.length ? { searchSubjects: t.searchSubjects } : {},
61
- ...(i = t == null ? void 0 : t.sources) != null && i.length ? { sources: t.sources } : {},
62
- ...(V = t == null ? void 0 : t.restaurantIds) != null && V.length ? { restaurantIds: t.restaurantIds } : {},
63
- ...t != null && t.traceId ? { traceId: t.traceId } : {}
64
- };
65
- return (await st(
66
- await at().get(`${nt}/count`, {
67
- params: o,
68
- paramsSerializer: (P) => {
69
- const m = new URLSearchParams();
70
- for (const [x, D] of Object.entries(P))
71
- if (Array.isArray(D))
72
- for (const F of D) m.append(x, String(F));
73
- else D != null && m.append(x, String(D));
74
- return m.toString();
75
- }
76
- })
77
- )).total;
78
- },
79
- async read(t) {
80
- var n, r, d, y, _, g, S, O, i;
81
- const o = {
82
- limit: (t == null ? void 0 : t.limit) ?? 100,
83
- offset: (t == null ? void 0 : t.offset) ?? 0,
84
- ...t != null && t.from ? { from: t.from } : {},
85
- ...t != null && t.to ? { to: t.to } : {},
86
- ...(n = t == null ? void 0 : t.userIds) != null && n.length ? { userIds: t.userIds } : {},
87
- ...t != null && t.feedmeAdminActors ? { feedmeAdminActors: !0 } : {},
88
- ...(r = t == null ? void 0 : t.subjects) != null && r.length ? { subjects: t.subjects } : {},
89
- ...(d = t == null ? void 0 : t.subjectPrefixes) != null && d.length ? { subjectPrefixes: t.subjectPrefixes } : {},
90
- ...(y = t == null ? void 0 : t.actions) != null && y.length ? { actions: t.actions } : {},
91
- ...(_ = t == null ? void 0 : t.outcomes) != null && _.length ? { outcomes: t.outcomes } : {},
92
- ...t != null && t.search ? { search: t.search } : {},
93
- ...(g = t == null ? void 0 : t.searchUserIds) != null && g.length ? { searchUserIds: t.searchUserIds } : {},
94
- ...(S = t == null ? void 0 : t.searchSubjects) != null && S.length ? { searchSubjects: t.searchSubjects } : {},
95
- ...(O = t == null ? void 0 : t.sources) != null && O.length ? { sources: t.sources } : {},
96
- ...(i = t == null ? void 0 : t.restaurantIds) != null && i.length ? { restaurantIds: t.restaurantIds } : {},
97
- ...t != null && t.traceId ? { traceId: t.traceId } : {}
98
- };
99
- return st(
100
- await at().get(nt, {
101
- params: o,
102
- // Serialize arrays as repeated params: key=val1&key=val2
103
- // (NestJS @Query expects this; axios default adds brackets which break matching)
104
- paramsSerializer: (V) => {
105
- const P = new URLSearchParams();
106
- for (const [m, x] of Object.entries(V))
107
- if (Array.isArray(x))
108
- for (const D of x) P.append(m, String(D));
109
- else x != null && P.append(m, String(x));
110
- return P.toString();
111
- }
112
- })
113
- );
114
- },
115
- /**
116
- * FeedMe-admin options for the User filter. `actors` is the named admin list (internal
117
- * viewers only; empty for merchants). `showFeedmeAdminFilter` indicates whether to offer
118
- * the "FeedMe Admin" catch-all (only when the business has relevant admin activity).
119
- */
120
- async getFeedmeAdminFilter(t) {
121
- const o = {
122
- ...t != null && t.from ? { from: t.from } : {},
123
- ...t != null && t.to ? { to: t.to } : {}
124
- };
125
- return st(
126
- await at().get(`${nt}/actors`, { params: o })
127
- );
128
- }
129
- }, rs = { class: "flex h-[46px] items-center gap-8 rounded-sm px-16 hover:bg-fm-color-opacity-sm" }, is = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, us = {
130
- "data-more-measure": "",
131
- class: "flex h-[46px] items-center gap-8 rounded-sm px-16"
132
- }, ds = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, cs = /* @__PURE__ */ $t({
133
- __name: "AuditLogModuleTabs",
134
- props: {
135
- modelValue: {},
136
- items: {}
137
- },
138
- emits: ["update:modelValue"],
139
- setup(t, { emit: o }) {
140
- const n = t, r = o, { t: d } = dt(), y = w(!1), _ = w(null), g = w(null), S = w([]), O = w(0), i = w(0);
141
- let V = null;
142
- async function P() {
143
- if (await Bo(), !g.value) return;
144
- const b = g.value.querySelectorAll("[data-tab-measure]");
145
- S.value = Array.from(b).map((B) => B.offsetWidth);
146
- const T = g.value.querySelector("[data-more-measure]");
147
- O.value = (T == null ? void 0 : T.offsetWidth) ?? 0;
148
- }
149
- const m = A(() => {
150
- const b = n.items.length;
151
- if (b === 0) return 0;
152
- if (!i.value || S.value.length !== b) return b;
153
- const T = S.value;
154
- if (T.reduce((I, X) => I + X, 0) <= i.value) return b;
155
- const E = O.value;
156
- let H = 0, U = 0;
157
- for (let I = 0; I < b && !(H + T[I] + E > i.value); I++)
158
- H += T[I], U++;
159
- return U;
160
- }), x = A(() => {
161
- const b = m.value, T = n.items.length;
162
- if (b >= T) return [...n.items];
163
- const B = n.items.slice(0, b), E = n.items.find((W) => W.value === n.modelValue);
164
- if (!E || B.some((W) => W.value === E.value)) return B;
165
- if (b === 0) return [E];
166
- const H = n.items.findIndex((W) => W.value === E.value), U = S.value, I = O.value, X = U[H] ?? 0;
167
- let ue = b, je = U.slice(0, ue - 1).reduce((W, xe) => W + xe, 0);
168
- for (; ue > 1 && je + X + I > i.value; )
169
- ue--, je = U.slice(0, ue - 1).reduce((W, xe) => W + xe, 0);
170
- return [...n.items.slice(0, Math.max(ue - 1, 0)), E];
171
- }), D = A(() => {
172
- const b = new Set(x.value.map((T) => T.value));
173
- return n.items.filter((T) => !b.has(T.value));
174
- });
175
- function F(b) {
176
- y.value = !1, r("update:modelValue", b);
177
- }
178
- return Uo(async () => {
179
- await P(), _.value && (i.value = _.value.clientWidth, V = new ResizeObserver(() => {
180
- _.value && (i.value = _.value.clientWidth);
181
- }), V.observe(_.value));
182
- }), Ko(() => {
183
- V == null || V.disconnect(), V = null;
184
- }), oe(
185
- () => n.items,
186
- () => {
187
- P();
188
- },
189
- { deep: !0 }
190
- ), (b, T) => {
191
- const B = N("FmTab"), E = N("FmIcon"), H = N("FmMenuItem"), U = N("FmMenu");
192
- return f(), v("div", {
193
- ref_key: "containerRef",
194
- ref: _,
195
- class: "relative flex w-full flex-row items-center"
196
- }, [
197
- (f(!0), v(z, null, ce(x.value, (I) => (f(), Ce(B, {
198
- key: I.value,
199
- "model-value": t.modelValue,
200
- label: I.label,
201
- badge: I.badge,
202
- disabled: I.disabled,
203
- value: I.value,
204
- "onUpdate:modelValue": F
205
- }, null, 8, ["model-value", "label", "badge", "disabled", "value"]))), 128)),
206
- D.value.length > 0 ? (f(), Ce(U, {
207
- key: 0,
208
- "show-menu": y.value,
209
- class: "max-w-[360px] min-w-[90px] rounded-sm",
210
- placement: "bottom-start",
211
- onMenuChanged: T[0] || (T[0] = (I) => y.value = I)
212
- }, {
213
- "menu-button": Y(() => [
214
- a("div", rs, [
215
- h(E, { name: "more_vert" }),
216
- a("span", is, l(u(d)("auditLog.modules.more")), 1)
217
- ])
218
- ]),
219
- default: Y(() => [
220
- (f(!0), v(z, null, ce(D.value, (I) => (f(), Ce(H, {
221
- key: I.value,
222
- "model-value": t.modelValue === I.value,
223
- label: I.label,
224
- disabled: I.disabled,
225
- onClick: (X) => F(I.value)
226
- }, null, 8, ["model-value", "label", "disabled", "onClick"]))), 128))
227
- ]),
228
- _: 1
229
- }, 8, ["show-menu"])) : M("", !0),
230
- a("div", {
231
- ref_key: "measurerRef",
232
- ref: g,
233
- "aria-hidden": "true",
234
- class: "pointer-events-none invisible absolute -left-[9999px] -top-[9999px] flex flex-row items-center"
235
- }, [
236
- (f(!0), v(z, null, ce(t.items, (I) => (f(), v("div", {
237
- key: `measure-${I.value}`,
238
- "data-tab-measure": ""
239
- }, [
240
- h(B, {
241
- "model-value": t.modelValue,
242
- label: I.label,
243
- badge: I.badge,
244
- disabled: I.disabled,
245
- value: I.value
246
- }, null, 8, ["model-value", "label", "badge", "disabled", "value"])
247
- ]))), 128)),
248
- a("div", us, [
249
- h(E, { name: "more_vert" }),
250
- a("span", ds, l(u(d)("auditLog.modules.more")), 1)
251
- ])
252
- ], 512)
253
- ], 512);
254
- };
255
- }
256
- }), fs = qo("hrm-team", () => {
257
- const t = w([]), o = w(!1), n = w(!1), r = A(
258
- () => Object.fromEntries(t.value.map((g) => [g.doc.userId, g.name]))
259
- ), d = A(
260
- () => Object.fromEntries(t.value.map((g) => [g.doc.userId, g.email]))
261
- ), y = A(
262
- () => Object.fromEntries(t.value.map((g) => [g.doc.userId, g.phoneNumber]))
263
- );
264
- async function _({ force: g = !1 } = {}) {
265
- if (!(!g && t.value.length > 0))
266
- try {
267
- o.value = !0;
268
- const S = await Zo.readTeamMembers();
269
- t.value = S.sort((O, i) => O.doc.isOwner ? -1 : O.name.localeCompare(i.name)), n.value = !0;
270
- } finally {
271
- o.value = !1;
272
- }
273
- }
274
- return {
275
- members: t,
276
- isLoading: o,
277
- hasLoaded: n,
278
- userIdToName: r,
279
- userIdToEmail: d,
280
- userIdToPhone: y,
281
- readTeamMembers: _
282
- };
283
- });
284
- function ms(t) {
285
- const o = t.indexOf(".");
286
- return o <= 0 || o === t.length - 1 ? null : { entity: t.slice(0, o), verb: t.slice(o + 1) };
287
- }
288
- function Ot(t) {
289
- const o = t.split("-").join(" ");
290
- return o.charAt(0).toUpperCase() + o.slice(1);
291
- }
292
- function vs(t, o, n) {
293
- const r = t(o, n);
294
- return r === o ? null : r;
295
- }
296
- function ut(t, o) {
297
- const { eventKey: n, params: r, operationLabel: d } = o;
298
- if (n) {
299
- const y = vs(t, `auditLog.event.sentence.${n}`, r);
300
- if (y) return y;
301
- const _ = ms(n);
302
- if (_) {
303
- const g = `${Ot(_.verb)} ${Ot(_.entity)}`, S = (r == null ? void 0 : r.label) ?? (r == null ? void 0 : r.name);
304
- return S !== void 0 && S !== "" ? `${g} — ${S}` : g;
305
- }
306
- }
307
- return d ?? "";
308
- }
309
- function ps({ logs: t, selectedLog: o, isSheetOpen: n, businessId: r }) {
310
- const d = ss(), y = as(), { t: _ } = dt(), g = ns();
311
- let S = 0;
312
- function O(x) {
313
- const { traceId: D, ...F } = d.query;
314
- (D ?? void 0) !== x && y.replace({ query: x ? { ...F, traceId: x } : F });
315
- }
316
- function i(x) {
317
- O(x.traceId || void 0);
318
- }
319
- function V() {
320
- S++, O(void 0);
321
- }
322
- async function P(x) {
323
- var b;
324
- if (((b = o.value) == null ? void 0 : b.traceId) === x) return;
325
- const D = ++S;
326
- let F = t.value.find((T) => T.traceId === x);
327
- if (!F) {
328
- try {
329
- [F] = await Oe.read({ traceId: x, limit: 1 });
330
- } catch {
331
- D === S && g.error(_("auditLog.deepLink.loadFailed"));
332
- return;
333
- }
334
- if (D !== S) return;
335
- }
336
- if (!F) {
337
- g.error(_("auditLog.deepLink.notFound")), O(void 0);
338
- return;
339
- }
340
- o.value = F, n.value = !0;
341
- }
342
- oe(
343
- () => [d.query.traceId, r()],
344
- ([x, D], F) => {
345
- var b;
346
- if (F != null && F[1] && D !== F[1]) {
347
- S++, n.value = !1, o.value = null, O(void 0);
348
- return;
349
- }
350
- typeof x == "string" && x ? D && P(x) : (S++, (b = o.value) != null && b.traceId && n.value && (n.value = !1, o.value = null));
351
- },
352
- { immediate: !0 }
353
- );
354
- async function m() {
355
- try {
356
- await navigator.clipboard.writeText(window.location.href), g.success(_("auditLog.detail.linkCopied"));
357
- } catch {
358
- g.error(_("auditLog.detail.linkCopyFailed"));
359
- }
360
- }
361
- return { onSheetOpened: i, onSheetClosed: V, copyLink: m };
362
- }
363
- function _e(t) {
364
- return typeof t == "object" && t !== null && !Array.isArray(t);
365
- }
366
- function Te(t) {
367
- return Array.isArray(t);
368
- }
369
- function Be(t) {
370
- if (t === null) return "null";
371
- if (typeof t == "object")
372
- try {
373
- return JSON.stringify(t);
374
- } catch {
375
- return String(t);
376
- }
377
- return String(t);
378
- }
379
- function gs(t, o) {
380
- return t ? `${t}.${o}` : o;
381
- }
382
- function Ct(t) {
383
- if (typeof t != "string") return { ok: !1, value: void 0 };
384
- const o = t.trim();
385
- if (!o.startsWith("{") && !o.startsWith("[")) return { ok: !1, value: void 0 };
386
- try {
387
- const n = JSON.parse(o);
388
- return _e(n) || Te(n) ? { ok: !0, value: n } : { ok: !1, value: void 0 };
389
- } catch {
390
- return { ok: !1, value: void 0 };
391
- }
392
- }
393
- const hs = ["_id", "id", "subject", "key", "name"];
394
- function ys(t, o) {
395
- if (t.length === 0 || o.length === 0) return null;
396
- const n = (d, y) => d.every((_) => _e(_) && _[y] !== void 0), r = (d, y) => {
397
- const _ = d.map((g) => g[y]);
398
- return _.length === new Set(_).size;
399
- };
400
- for (const d of hs)
401
- if (n(t, d) && n(o, d) && r(t, d) && r(o, d))
402
- return d;
403
- return null;
404
- }
405
- function Pt(t, o, n) {
406
- n.push({ path: t, type: "added", before: null, after: Be(o) });
407
- }
408
- function Et(t, o, n) {
409
- n.push({ path: t, type: "removed", before: Be(o), after: null });
410
- }
411
- function bs(t, o, n, r) {
412
- const d = /* @__PURE__ */ new Set([...Object.keys(o), ...Object.keys(n)]);
413
- for (const y of Array.from(d)) {
414
- const _ = Object.prototype.hasOwnProperty.call(o, y), g = Object.prototype.hasOwnProperty.call(n, y);
415
- Ye(gs(t, y), o[y], _, n[y], g, r);
416
- }
417
- }
418
- function _s(t, o, n, r) {
419
- const d = ys(o, n);
420
- if (d) {
421
- const m = new Map(
422
- o.map((b) => [b[d], b])
423
- ), x = new Map(
424
- n.map((b) => [b[d], b])
425
- ), D = Array.from(m.keys()).concat(Array.from(x.keys())), F = Array.from(new Set(D));
426
- for (const b of F) {
427
- const T = m.has(b), B = x.has(b), E = `${t}[${String(b)}]`;
428
- Ye(
429
- E,
430
- m.get(b),
431
- T,
432
- x.get(b),
433
- B,
434
- r
435
- );
436
- }
437
- return;
438
- }
439
- const y = o.map((m, x) => ({ sig: JSON.stringify(m), idx: x, item: m })), _ = n.map((m, x) => ({ sig: JSON.stringify(m), idx: x, item: m })), g = /* @__PURE__ */ new Map(), S = /* @__PURE__ */ new Map();
440
- for (const m of y)
441
- g.has(m.sig) || g.set(m.sig, []), g.get(m.sig).push(m);
442
- for (const m of _)
443
- S.has(m.sig) || S.set(m.sig, []), S.get(m.sig).push(m);
444
- const O = [], i = [], V = Array.from(g.keys()).concat(Array.from(S.keys())), P = Array.from(new Set(V));
445
- for (const m of P) {
446
- const x = g.get(m) || [], D = S.get(m) || [], F = Math.min(x.length, D.length);
447
- for (let b = F; b < x.length; b++)
448
- O.push({ idx: x[b].idx, item: x[b].item });
449
- for (let b = F; b < D.length; b++)
450
- i.push({ idx: D[b].idx, item: D[b].item });
451
- }
452
- for (const { idx: m, item: x } of O)
453
- Et(`${t}[${m}]`, x, r);
454
- for (const { idx: m, item: x } of i)
455
- Pt(`${t}[${m}]`, x, r);
456
- }
457
- function Ye(t, o, n, r, d, y) {
458
- if (!n && !d) return;
459
- if (n && !d) {
460
- Et(t, o, y);
461
- return;
462
- }
463
- if (!n && d) {
464
- Pt(t, r, y);
465
- return;
466
- }
467
- if (JSON.stringify(o) === JSON.stringify(r)) return;
468
- if (_e(o) && _e(r)) {
469
- bs(t, o, r, y);
470
- return;
471
- }
472
- if (Te(o) && Te(r)) {
473
- _s(t, o, r, y);
474
- return;
475
- }
476
- const _ = Ct(o), g = Ct(r);
477
- if (_.ok && g.ok) {
478
- Ye(t, _.value, !0, g.value, !0, y);
479
- return;
480
- }
481
- y.push({
482
- path: t,
483
- type: "changed",
484
- before: Be(o),
485
- after: Be(r)
486
- });
487
- }
488
- function xs(t, o) {
489
- if (JSON.stringify(t) === JSON.stringify(o)) return [];
490
- const n = t == null, r = o == null;
491
- let d = t;
492
- n && (_e(o) ? d = {} : Te(o) && (d = []));
493
- let y = o;
494
- r && (_e(t) ? y = {} : Te(t) && (y = []));
495
- const _ = [];
496
- return Ye("", d, !0, y, !0, _), _;
497
- }
498
- function Tt(t) {
499
- const o = t.operations;
500
- return !o || o.length === 0 ? !1 : o.some((n) => n.status === "failed");
501
- }
502
- function lt(t, o) {
503
- var d, y;
504
- if (t.source === "hrm-validate") return o("auditLog.pos.device.posV7");
505
- const n = (y = (d = t.metadata) == null ? void 0 : d.pos) == null ? void 0 : y.posMode, r = t.deviceId || "-";
506
- return n ? `${r} · ${o(`auditLog.pos.mode.${n}`)}` : r;
507
- }
508
- function Ls(t, o) {
509
- var r;
510
- const n = t.actorName || t.userId || "-";
511
- return ((r = t.metadata) == null ? void 0 : r.actorKnown) === !1 ? `${n} (${o("auditLog.pos.unverified")})` : n;
512
- }
513
- function jt(t, o) {
514
- var d;
515
- const n = t.approverName || t.approverId;
516
- if (!n)
517
- return t.source === "hrm-validate" ? o("auditLog.pos.viaCode") : "-";
518
- const r = ((d = t.metadata) == null ? void 0 : d.approverKnown) === !1 ? `${n} (${o("auditLog.pos.unverified")})` : n;
519
- return t.source === "hrm-validate" ? `${r} · ${o("auditLog.pos.viaCode")}` : r;
520
- }
521
- function ks(t, o) {
522
- const n = t.approverName || t.approverId;
523
- return n ? ` · ${o("auditLog.pos.approverInline", { name: n })}` : "";
524
- }
525
- function Ss(t, o, n) {
526
- return o || !(t != null && t.length) ? { userIds: [], feedmeAdminActors: !1 } : {
527
- userIds: t.filter((r) => r !== n),
528
- feedmeAdminActors: t.includes(n)
529
- };
530
- }
531
- function be(t) {
532
- return t === void 0 ? "—" : Array.isArray(t) ? t.length > 0 ? t.join(", ") : "—" : t || "—";
533
- }
534
- function ws(t) {
535
- return {
536
- label: t.label,
537
- labelKey: t.labelKey,
538
- type: t.type,
539
- beforeDisplay: be(t.before),
540
- afterDisplay: be(t.after)
541
- };
542
- }
543
- function Is(t) {
544
- return Array.isArray(t) && t.length > 0;
545
- }
546
- function Rt(t, o, n) {
547
- return n.labelKey && o(n.labelKey) ? t(n.labelKey) : n.label;
548
- }
549
- function Nt(t, o) {
550
- return ut(t, o) || t("auditLog.operation.unlabeled");
551
- }
552
- function As(t, o) {
553
- return !o || o.length === 0 ? "" : o.map((n) => {
554
- const r = Nt(t, n), d = t(`auditLog.outcome.${n.status}`);
555
- let y = `${r}: ${d}`;
556
- return n.status === "failed" && n.errorMessage && (y += ` — ${n.errorMessage}`), y;
557
- }).join(`
558
- `);
559
- }
560
- function Fs(t, o, n) {
561
- const r = Rt(t, o, n);
562
- return n.type === "add" ? `${r}: + ${be(n.after)}` : n.type === "remove" ? `${r}: - ${be(n.before)}` : `${r}: ${be(n.before)} → ${be(n.after)}`;
563
- }
564
- function Ms(t, o, n) {
565
- if (!n || n.length === 0) return "";
566
- const r = n.filter((_) => _.changeNodes && _.changeNodes.length > 0);
567
- if (r.length === 0) return "";
568
- const d = r.length > 1;
569
- return r.map((_) => {
570
- const g = (_.changeNodes ?? []).map((S) => Fs(t, o, S));
571
- return d ? [`[${Nt(t, _)}]`, ...g].join(`
572
- `) : g.join(`
573
- `);
574
- }).join(`
575
- `);
576
- }
577
- const Ds = {
578
- class: "flex flex-col gap-4 p-12 w-[260px]"
579
- }, Os = {
580
- class: "text-xs font-semibold text-fm-color-typo-secondary mb-4"
581
- }, Cs = {
582
- class: "flex min-h-0 flex-1 flex-col gap-16"
583
- }, Ts = {
584
- class: "space-y-16"
585
- }, js = {
586
- class: "flex flex-wrap items-center gap-8"
587
- }, Vs = {
588
- key: 0,
589
- class: "w-fit"
590
- }, $s = {
591
- key: 1,
592
- class: "w-fit"
593
- }, Ps = {
594
- class: "w-fit"
595
- }, Es = {
596
- class: "w-fit"
597
- }, Rs = {
598
- key: 2,
599
- class: "w-fit"
600
- }, Ns = {
601
- class: "flex h-full flex-col overflow-auto"
602
- }, Us = {
603
- key: 0,
604
- class: "space-y-12 p-4 text-sm"
605
- }, Ks = {
606
- class: "flex items-start justify-between gap-8 rounded-lg border border-fm-color-border-default p-12"
607
- }, Bs = {
608
- class: "min-w-0 flex-1"
609
- }, Ys = {
610
- class: "audit-log-operation-label-detail text-base font-bold leading-snug text-fm-color-typo-primary"
611
- }, zs = {
612
- key: 0,
613
- class: "mt-4 break-all font-mono text-xs text-fm-color-typo-secondary"
614
- }, qs = {
615
- key: 1,
616
- class: "mt-2 break-all font-mono text-xs text-fm-color-typo-secondary"
617
- }, Js = {
618
- class: "flex items-center gap-4"
619
- }, Hs = {
620
- class: "rounded-lg border border-fm-color-border-default p-12"
621
- }, Ws = {
622
- class: "space-y-12"
623
- }, Gs = {
624
- class: "text-xs text-fm-color-typo-secondary"
625
- }, Xs = {
626
- class: "font-semibold"
627
- }, Qs = {
628
- class: "text-xs text-fm-color-typo-secondary"
629
- }, Zs = {
630
- class: "font-semibold"
631
- }, ea = {
632
- class: "text-xs text-fm-color-typo-secondary"
633
- }, ta = {
634
- class: "break-all font-semibold"
635
- }, oa = {
636
- key: 0
637
- }, sa = {
638
- class: "text-xs text-fm-color-typo-secondary"
639
- }, aa = {
640
- class: "break-all font-mono text-xs font-semibold"
641
- }, na = {
642
- class: "text-xs text-fm-color-typo-secondary"
643
- }, la = {
644
- class: "break-all font-mono text-xs font-semibold"
645
- }, ra = {
646
- class: "text-xs text-fm-color-typo-secondary"
647
- }, ia = {
648
- class: "font-semibold"
649
- }, ua = {
650
- class: "rounded-lg border border-fm-color-border-default"
651
- }, da = {
652
- class: "p-12"
653
- }, ca = {
654
- class: "text-base font-bold text-fm-color-typo-primary"
655
- }, fa = {
656
- class: "space-y-12 p-12"
657
- }, ma = {
658
- class: "text-xs text-fm-color-typo-secondary"
659
- }, va = {
660
- class: "font-semibold"
661
- }, pa = {
662
- class: "rounded-lg border border-fm-color-border-default"
663
- }, ga = {
664
- class: "p-12"
665
- }, ha = {
666
- class: "text-base font-bold text-fm-color-typo-primary"
667
- }, ya = {
668
- class: "space-y-12 p-12"
669
- }, ba = {
670
- class: "text-xs text-fm-color-typo-secondary"
671
- }, _a = {
672
- class: "font-semibold"
673
- }, xa = {
674
- key: 0
675
- }, La = {
676
- class: "text-xs text-fm-color-typo-secondary"
677
- }, ka = {
678
- key: 0,
679
- class: "font-semibold"
680
- }, Sa = {
681
- key: 1,
682
- class: "break-all font-mono text-xs text-fm-color-typo-secondary"
683
- }, wa = {
684
- key: 1
685
- }, Ia = {
686
- class: "text-xs text-fm-color-typo-secondary"
687
- }, Aa = {
688
- class: "font-semibold whitespace-pre-line"
689
- }, Fa = {
690
- class: "text-xs text-fm-color-typo-secondary"
691
- }, Ma = {
692
- class: "font-semibold"
693
- }, Da = {
694
- class: "text-xs text-fm-color-typo-secondary"
695
- }, Oa = {
696
- class: "break-all font-mono text-xs font-semibold"
697
- }, Ca = {
698
- class: "text-xs text-fm-color-typo-secondary"
699
- }, Ta = {
700
- class: "break-all font-mono text-xs font-semibold"
701
- }, ja = {
702
- class: "text-xs text-fm-color-typo-secondary"
703
- }, Va = {
704
- class: "font-semibold"
705
- }, $a = {
706
- key: 0,
707
- class: "break-all font-mono text-xs"
708
- }, Pa = {
709
- key: 0
710
- }, Ea = {
711
- class: "text-xs text-fm-color-typo-secondary"
712
- }, Ra = {
713
- class: "font-semibold"
714
- }, Na = {
715
- class: "text-xs text-fm-color-typo-secondary"
716
- }, Ua = {
717
- class: "font-semibold"
718
- }, Ka = {
719
- class: "text-xs text-fm-color-typo-secondary"
720
- }, Ba = {
721
- class: "font-semibold"
722
- }, Ya = {
723
- key: 0
724
- }, za = {
725
- key: 1
726
- }, qa = {
727
- class: "text-xs text-fm-color-typo-secondary"
728
- }, Ja = {
729
- class: "whitespace-pre-wrap break-all font-mono text-xs"
730
- }, Ha = {
731
- key: 3
732
- }, Wa = {
733
- class: "text-xs text-fm-color-typo-secondary"
734
- }, Ga = {
735
- class: "mt-4 space-y-4"
736
- }, Xa = {
737
- 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"
738
- }, Qa = {
739
- class: "text-xs font-semibold"
740
- }, Za = {
741
- key: 0,
742
- class: "text-fm-color-typo-secondary"
743
- }, en = {
744
- key: 4
745
- }, tn = {
746
- class: "text-xs text-fm-color-typo-secondary"
747
- }, on = {
748
- 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"
749
- }, sn = {
750
- key: 0,
751
- class: "space-y-12 p-4 text-sm"
752
- }, an = {
753
- class: "flex items-start justify-between gap-8 rounded-lg border border-fm-color-border-default p-12"
754
- }, nn = {
755
- class: "min-w-0 flex-1"
756
- }, ln = {
757
- class: "text-base font-bold leading-snug text-fm-color-typo-primary"
758
- }, rn = {
759
- key: 0,
760
- class: "text-xs text-fm-color-typo-secondary"
761
- }, un = {
762
- class: "rounded-lg border border-fm-color-border-default p-12"
763
- }, dn = {
764
- class: "space-y-12"
765
- }, cn = {
766
- class: "text-xs text-fm-color-typo-secondary"
767
- }, fn = {
768
- class: "font-semibold"
769
- }, mn = {
770
- key: 0
771
- }, vn = {
772
- class: "text-xs text-fm-color-typo-secondary"
773
- }, pn = {
774
- class: "font-semibold"
775
- }, gn = {
776
- key: 1
777
- }, hn = {
778
- class: "text-xs text-fm-color-typo-secondary"
779
- }, yn = {
780
- class: "font-semibold"
781
- }, bn = {
782
- key: 0,
783
- class: "rounded-lg border border-fm-color-border-default p-12"
784
- }, _n = {
785
- class: "text-xs text-fm-color-typo-secondary"
786
- }, xn = {
787
- class: "whitespace-pre-line font-semibold text-fm-color-typo-error"
788
- }, Ln = {
789
- class: "rounded-lg border border-fm-color-border-default"
790
- }, kn = {
791
- class: "p-12"
792
- }, Sn = {
793
- class: "text-base font-bold text-fm-color-typo-primary"
794
- }, wn = {
795
- class: "p-12"
796
- }, In = {
797
- key: 0,
798
- class: "divide-y divide-fm-color-border-default"
799
- }, An = {
800
- class: "flex flex-wrap items-center gap-8"
801
- }, Fn = {
802
- class: "break-all text-xs"
803
- }, Mn = {
804
- class: "break-all font-mono text-xs"
805
- }, Dn = {
806
- key: 0,
807
- class: "text-fm-color-typo-success"
808
- }, On = {
809
- key: 1,
810
- class: "text-fm-color-typo-error"
811
- }, Cn = {
812
- class: "text-fm-color-typo-error"
813
- }, Tn = {
814
- class: "text-fm-color-typo-success"
815
- }, jn = {
816
- key: 1,
817
- class: "divide-y divide-fm-color-border-default"
818
- }, Vn = {
819
- class: "flex flex-wrap items-center gap-8"
820
- }, $n = {
821
- class: "break-all font-mono text-xs"
822
- }, Pn = {
823
- class: "space-y-4"
824
- }, En = {
825
- key: 0,
826
- class: "text-fm-color-typo-success"
827
- }, Rn = {
828
- key: 1,
829
- class: "text-fm-color-typo-error"
830
- }, Nn = {
831
- class: "text-fm-color-typo-error"
832
- }, Un = {
833
- class: "text-fm-color-typo-success"
834
- }, Kn = {
835
- key: 2,
836
- class: "text-fm-color-typo-secondary"
837
- }, Bn = {
838
- key: 1,
839
- class: "rounded-lg border border-fm-color-border-default"
840
- }, Yn = {
841
- class: "text-base font-bold text-fm-color-typo-primary"
842
- }, zn = {
843
- class: "space-y-12 p-12"
844
- }, qn = {
845
- key: 0
846
- }, Jn = {
847
- class: "text-xs text-fm-color-typo-secondary"
848
- }, Hn = {
849
- 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"
850
- }, Wn = {
851
- key: 1
852
- }, Gn = {
853
- class: "text-xs text-fm-color-typo-secondary"
854
- }, Xn = {
855
- 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"
856
- }, De = 100, rt = 1e3, it = "__feedmeAdmin__", Qn = "D MMM YYYY h:mm A", Zn = "YYYY-MM-DD HH:mm", K = "YYYY-MM-DD", Vt = "audit-log-export-fields-v3", el = /* @__PURE__ */ $t({
857
- __name: "AuditLogList",
858
- setup(t) {
859
- const {
860
- t: o,
861
- te: n
862
- } = dt(), r = Ho(), d = fs(), y = es(), {
863
- restaurants: _
864
- } = Jo(y), g = w(!1), S = w(!1), O = w([]), i = w(null), V = w(!1), P = w({}), m = w(null), x = w(!1);
865
- async function D(e) {
866
- const s = Uint8Array.from(atob(e), (k) => k.charCodeAt(0)), c = new DecompressionStream("gzip"), L = c.writable.getWriter();
867
- return await L.write(s), await L.close(), new Response(c.readable).text();
868
- }
869
- const F = w("");
870
- let b = 0;
871
- oe(() => {
872
- var e, s;
873
- return (s = (e = i.value) == null ? void 0 : e.metadata) == null ? void 0 : s.requestBody;
874
- }, async (e) => {
875
- const s = ++b;
876
- if (!e) {
877
- F.value = "";
878
- return;
879
- }
880
- if (typeof e == "object") {
881
- F.value = JSON.stringify(e, null, 2);
882
- return;
883
- }
884
- if (e.startsWith("gzip:")) {
885
- try {
886
- const c = await D(e.slice(5));
887
- if (s !== b) return;
888
- F.value = JSON.stringify(JSON.parse(c), null, 2);
889
- } catch {
890
- if (s !== b) return;
891
- F.value = e;
892
- }
893
- return;
894
- }
895
- try {
896
- F.value = JSON.stringify(JSON.parse(e), null, 2);
897
- } catch {
898
- F.value = e;
899
- }
900
- }, {
901
- immediate: !0
902
- });
903
- async function T(e) {
904
- if (!e) return;
905
- let s = e;
906
- if (e.startsWith("gzip:"))
907
- try {
908
- s = await D(e.slice(5));
909
- } catch {
910
- return e;
911
- }
912
- try {
913
- return JSON.parse(s);
914
- } catch {
915
- return s;
916
- }
917
- }
918
- function B(e) {
919
- if (e === void 0) return "";
920
- if (typeof e == "object" && e !== null)
921
- try {
922
- return JSON.stringify(e, null, 2);
923
- } catch {
924
- return String(e);
925
- }
926
- return String(e);
927
- }
928
- const E = w([]), H = w([]), U = w(""), I = w(""), X = w(!1);
929
- let ue = 0;
930
- oe(m, async (e) => {
931
- const s = ++ue;
932
- if (E.value = [], H.value = [], U.value = "", I.value = "", X.value = !1, !e) return;
933
- const [c, L] = await Promise.all([T(e.before), T(e.after)]);
934
- s === ue && (Is(e.changeNodes) ? H.value = e.changeNodes.map(ws) : E.value = xs(c, L), U.value = B(c), I.value = B(L));
935
- });
936
- function je(e) {
937
- return e === "added" ? "success" : e === "removed" ? "critical" : "warning";
938
- }
939
- function ct(e) {
940
- return o(e === "added" ? "auditLog.operation.added" : e === "removed" ? "auditLog.operation.removed" : "auditLog.operation.updated");
941
- }
942
- function W(e) {
943
- return e.replace(/\[[^\]]*\]/g, "");
944
- }
945
- function xe(e) {
946
- return e === "add" ? "success" : e === "remove" ? "critical" : "warning";
947
- }
948
- function Ut(e) {
949
- return o(e === "add" ? "auditLog.operation.added" : e === "remove" ? "auditLog.operation.removed" : "auditLog.operation.updated");
950
- }
951
- function Kt(e) {
952
- return Rt(o, n, e);
953
- }
954
- const ft = A(() => {
955
- const e = [], s = /* @__PURE__ */ new Map();
956
- for (const c of E.value) {
957
- const L = W(c.path), k = `${c.type}::${L}`;
958
- let C = s.get(k);
959
- C || (C = {
960
- groupKey: k,
961
- displayKey: L,
962
- type: c.type,
963
- rows: []
964
- }, s.set(k, C), e.push(C)), C.rows.push(c);
965
- }
966
- return e;
967
- }), Ve = w(1), Bt = w(!1), ze = w(0), mt = A(() => Math.max(1, Math.ceil(ze.value / De))), vt = j().format("YYYY-MM-DD"), se = w({
968
- startDate: `${vt} 00:00`,
969
- endDate: `${vt} 23:59`
970
- }), fe = w(), Q = w(), ae = w(), ne = w(), le = w("all");
971
- function Yt(e) {
972
- return typeof e == "string" ? [e] : Array.isArray(e) ? e.filter((s) => typeof s == "string") : [];
973
- }
974
- const pt = Me.filter((e) => e.key !== "all").map((e) => e.key);
975
- function $e(e) {
976
- const s = Me.find((c) => c.key !== "all" && c.subjectPrefixes.some((L) => e.startsWith(L)));
977
- return (s == null ? void 0 : s.key) ?? "other";
978
- }
979
- function gt(e) {
980
- const s = pt.indexOf(e);
981
- return s === -1 ? pt.length : s;
982
- }
983
- const zt = A(() => Me.map(({
984
- key: e
985
- }) => ({
986
- label: o(`auditLog.modules.${e}`),
987
- value: e
988
- }))), Pe = A(() => Me.find((e) => e.key === le.value) ?? Me[0]), qt = A(() => le.value === "all"), q = A(() => le.value === "pos"), pe = A(() => Pe.value.sources ?? []);
989
- oe(q, (e) => {
990
- e && y.readRestaurants();
991
- }, {
992
- immediate: !0
993
- });
994
- const Z = w([]), Jt = A(() => _.value.map((e) => ({
995
- label: e.profile.name,
996
- value: String(e._id)
997
- }))), Ht = A(() => Object.fromEntries(_.value.map((e) => [String(e._id), e.profile.name])));
998
- oe(le, () => {
999
- Z.value = [];
1000
- });
1001
- const Le = w([]), Ee = w(!1), Wt = A(() => [...Ee.value ? [{
1002
- label: o("auditLog.user.feedmeAdmin"),
1003
- value: it
1004
- }] : [], ...d.members.map((e) => ({
1005
- label: e.name,
1006
- value: e.doc.userId
1007
- })), ...Le.value.map((e) => ({
1008
- label: `${e.name} (${o("auditLog.user.feedmeAdmin")})`,
1009
- value: e.userId
1010
- }))]), re = A(() => Ss(fe.value, q.value, it)), qe = w(""), ee = w(""), Gt = ts(qe, (e) => {
1011
- ee.value = e.trim();
1012
- });
1013
- Yo(Gt);
1014
- const {
1015
- onSheetOpened: Xt,
1016
- onSheetClosed: Qt,
1017
- copyLink: Zt
1018
- } = ps({
1019
- logs: O,
1020
- selectedLog: i,
1021
- isSheetOpen: V,
1022
- businessId: () => {
1023
- var e;
1024
- return (e = r.currentBusiness.value) == null ? void 0 : e._id;
1025
- }
1026
- }), me = A(() => {
1027
- const e = ee.value.toLowerCase();
1028
- if (!e) return [];
1029
- const s = /* @__PURE__ */ new Set();
1030
- for (const c of d.members) {
1031
- const L = c.doc.userId;
1032
- ((d.userIdToName[L] ?? "").toLowerCase().includes(e) || (d.userIdToEmail[L] ?? "").toLowerCase().includes(e) || (d.userIdToPhone[L] ?? "").toLowerCase().includes(e)) && s.add(L);
1033
- }
1034
- for (const c of Le.value)
1035
- c.name.toLowerCase().includes(e) && s.add(c.userId);
1036
- return [...s];
1037
- }), Je = A(() => {
1038
- const e = Dt.flatMap((k) => Yt(k.subject).map((C) => ({
1039
- label: k.label,
1040
- value: C
1041
- }))), s = Object.entries(Mt).map(([k, C]) => ({
1042
- label: C,
1043
- value: k
1044
- })), c = /* @__PURE__ */ new Set(), L = [];
1045
- for (const k of [...e, ...s])
1046
- if (!c.has(k.value)) {
1047
- c.add(k.value);
1048
- const C = $e(k.value);
1049
- L.push({
1050
- ...k,
1051
- group: o(`auditLog.modules.${C}`)
1052
- });
1053
- }
1054
- return L.sort((k, C) => gt($e(k.value)) - gt($e(C.value)));
1055
- }), ge = A(() => {
1056
- const e = ee.value.toLowerCase();
1057
- if (!e) return [];
1058
- const s = /* @__PURE__ */ new Set();
1059
- for (const c of Je.value)
1060
- c.label.toLowerCase().includes(e) && s.add(c.value);
1061
- return [...s];
1062
- }), eo = A(() => qt.value ? Je.value : Je.value.filter((e) => $e(e.value) === le.value));
1063
- function to(e, s) {
1064
- const c = s.toLowerCase();
1065
- return e.label.toLowerCase().includes(c) || e.value.replace(/^business::/, "").toLowerCase().includes(c) ? !0 : e.value.toLowerCase().includes(c);
1066
- }
1067
- const G = A(() => ({
1068
- manage: o("auditLog.action.manage"),
1069
- create: o("auditLog.action.create"),
1070
- read: o("auditLog.action.read"),
1071
- update: o("auditLog.action.update"),
1072
- delete: o("auditLog.action.delete")
1073
- })), oo = A(() => [{
1074
- label: G.value.manage,
1075
- value: "manage"
1076
- }, {
1077
- label: G.value.create,
1078
- value: "create"
1079
- }, {
1080
- label: G.value.read,
1081
- value: "read"
1082
- }, {
1083
- label: G.value.update,
1084
- value: "update"
1085
- }, {
1086
- label: G.value.delete,
1087
- value: "delete"
1088
- }]), Re = A(() => ({
1089
- allowed: o("auditLog.outcome.success"),
1090
- denied: o("auditLog.outcome.failed"),
1091
- skipped: o("auditLog.outcome.skipped")
1092
- })), He = A(() => {
1093
- var e;
1094
- return ((e = r.sessionUser.value) == null ? void 0 : e.isInternal) ?? !1;
1095
- });
1096
- function ht(e) {
1097
- return !He.value && e === "skipped" ? "allowed" : e;
1098
- }
1099
- function We(e) {
1100
- return !(e != null && e.length) || He.value ? e : e.includes("allowed") ? [.../* @__PURE__ */ new Set([...e, "skipped"])] : e;
1101
- }
1102
- const so = A(() => [{
1103
- label: Re.value.allowed,
1104
- value: "allowed"
1105
- }, {
1106
- label: Re.value.denied,
1107
- value: "denied"
1108
- }, ...He.value ? [{
1109
- label: Re.value.skipped,
1110
- value: "skipped"
1111
- }] : []]), ao = A(() => ({
1112
- admin: o("auditLog.detail.resolvedFromValue.admin"),
1113
- staff: o("auditLog.detail.resolvedFromValue.staff"),
1114
- permissionSet: o("auditLog.detail.resolvedFromValue.permissionSet"),
1115
- systemPermissionSet: o("auditLog.detail.resolvedFromValue.systemPermissionSet"),
1116
- custom: o("auditLog.detail.resolvedFromValue.custom"),
1117
- "no-match": o("auditLog.detail.resolvedFromValue.noMatch"),
1118
- unknown: o("auditLog.detail.resolvedFromValue.unknown")
1119
- })), no = A(() => ({
1120
- GET: G.value.read,
1121
- POST: G.value.create,
1122
- PUT: G.value.update,
1123
- PATCH: G.value.update,
1124
- DELETE: G.value.delete
1125
- })), lo = {
1126
- allowed: "success",
1127
- denied: "critical",
1128
- skipped: "warning"
1129
- };
1130
- function Ne(e) {
1131
- return j(e).format(Qn);
1132
- }
1133
- const ro = A(() => {
1134
- const {
1135
- startDate: e,
1136
- endDate: s
1137
- } = se.value;
1138
- return e && s ? `${Ne(e)} – ${Ne(s)}` : e ? Ne(e) : s ? Ne(s) : o("auditLog.dateRange.placeholder");
1139
- }), io = A(() => [{
1140
- label: o("date.predefinedRanges.today"),
1141
- value: {
1142
- startDate: j().format(K),
1143
- endDate: j().format(K)
1144
- }
1145
- }, {
1146
- label: o("date.predefinedRanges.yesterday"),
1147
- value: {
1148
- startDate: j().subtract(1, "day").format(K),
1149
- endDate: j().subtract(1, "day").format(K)
1150
- }
1151
- }, {
1152
- label: o("date.predefinedRanges.thisWeek"),
1153
- value: {
1154
- startDate: j().startOf("week").format(K),
1155
- endDate: j().endOf("week").format(K)
1156
- }
1157
- }, {
1158
- label: o("date.predefinedRanges.lastWeek"),
1159
- value: {
1160
- startDate: j().subtract(1, "week").startOf("week").format(K),
1161
- endDate: j().subtract(1, "week").endOf("week").format(K)
1162
- }
1163
- }, {
1164
- label: o("date.predefinedRanges.last7Days"),
1165
- value: {
1166
- startDate: j().subtract(7, "day").format(K),
1167
- endDate: j().subtract(1, "day").format(K)
1168
- }
1169
- }, {
1170
- label: o("date.predefinedRanges.thisMonth"),
1171
- value: {
1172
- startDate: j().startOf("month").format(K),
1173
- endDate: j().endOf("month").format(K)
1174
- }
1175
- }, {
1176
- label: o("date.predefinedRanges.lastMonth"),
1177
- value: {
1178
- startDate: j().subtract(1, "month").startOf("month").format(K),
1179
- endDate: j().subtract(1, "month").endOf("month").format(K)
1180
- }
1181
- }]);
1182
- function Ge(e) {
1183
- var s;
1184
- return ((s = Dt.find((c) => c.subject === e)) == null ? void 0 : s.label) ?? Mt[e] ?? ls[e];
1185
- }
1186
- function ke(e) {
1187
- var c, L;
1188
- if (e.actorType === "posUser")
1189
- return Ls(e, o);
1190
- if (e.actorType === "portalUser")
1191
- return e.actorName ?? e.userId;
1192
- if (e.actorType === "feedmeAdmin")
1193
- return (c = r.sessionUser.value) != null && c.isInternal ? `${e.actorName ?? e.userId} (${o("auditLog.user.feedmeAdmin")})` : o("auditLog.user.feedmeAdmin");
1194
- const s = d.userIdToName[e.userId];
1195
- return s || (d.hasLoaded ? (L = r.sessionUser.value) != null && L.isInternal ? `${e.actorName ?? e.userId} (${o("auditLog.user.feedmeAdmin")})` : o("auditLog.user.feedmeAdmin") : e.userId);
1196
- }
1197
- function yt(e) {
1198
- return e.actorType === "posUser" ? q.value ? "" : lt(e, o) : d.userIdToPhone[e.userId] || "-";
1199
- }
1200
- function uo(e) {
1201
- return d.userIdToEmail[e.userId] || "-";
1202
- }
1203
- function bt(e) {
1204
- return j(e).format("DD MMM YYYY, HH:mm");
1205
- }
1206
- function Xe(e) {
1207
- return j(e).format("DD MMM YYYY, HH:mm:ss").toUpperCase();
1208
- }
1209
- function _t(e) {
1210
- return G.value[e] ?? e;
1211
- }
1212
- function xt(e) {
1213
- const s = ut(o, {
1214
- eventKey: e.eventKey,
1215
- params: e.params,
1216
- operationLabel: e.metadata.operationLabel ?? _t(e.action)
1217
- });
1218
- return e.actorType === "posUser" && !q.value ? s + ks(e, o) : s;
1219
- }
1220
- function Lt(e) {
1221
- return ut(o, e) || o("auditLog.operation.unlabeled");
1222
- }
1223
- function co(e) {
1224
- return Ge(e.subject) ?? e.subject;
1225
- }
1226
- function Qe(e) {
1227
- return Re.value[ht(e)];
1228
- }
1229
- function kt(e) {
1230
- return lo[ht(e)] ?? "neutral";
1231
- }
1232
- function fo(e) {
1233
- return ao.value[e] ?? e;
1234
- }
1235
- function mo(e) {
1236
- return e.metadata.requestMethod ? no.value[e.metadata.requestMethod] ?? e.metadata.requestMethod : _t(e.action);
1237
- }
1238
- function St(e) {
1239
- const s = String(e ?? "");
1240
- return `"${(/^[=+\-@\t\r]/.test(s) ? `'${s}` : s).replace(/"/g, '""')}"`;
1241
- }
1242
- const Ze = [{
1243
- key: "timestamp",
1244
- labelKey: "auditLog.exportFields.timestamp",
1245
- getValue: (e) => bt(e.timestamp),
1246
- defaultSelected: !0
1247
- }, {
1248
- key: "userName",
1249
- labelKey: "auditLog.exportFields.userName",
1250
- getValue: (e) => ke(e),
1251
- defaultSelected: !0
1252
- }, {
1253
- key: "userPhone",
1254
- labelKey: "auditLog.exportFields.userPhone",
1255
- getValue: (e) => yt(e),
1256
- defaultSelected: !0
1257
- }, {
1258
- key: "subject",
1259
- labelKey: "auditLog.exportFields.subject",
1260
- getValue: (e) => Ge(e.subject) ?? e.subject,
1261
- defaultSelected: !0
1262
- }, {
1263
- key: "action",
1264
- labelKey: "auditLog.exportFields.action",
1265
- getValue: (e) => e.action,
1266
- defaultSelected: !0
1267
- }, {
1268
- key: "operation",
1269
- labelKey: "auditLog.exportFields.operation",
1270
- getValue: (e) => xt(e),
1271
- defaultSelected: !0
1272
- }, {
1273
- key: "outcome",
1274
- labelKey: "auditLog.exportFields.outcome",
1275
- getValue: (e) => Qe(e.outcome),
1276
- defaultSelected: !0
1277
- }, {
1278
- key: "operationEvents",
1279
- labelKey: "auditLog.exportFields.operationEvents",
1280
- getValue: (e) => As(o, e.operations),
1281
- defaultSelected: !0
1282
- }, {
1283
- key: "changes",
1284
- labelKey: "auditLog.exportFields.changes",
1285
- getValue: (e) => Ms(o, n, e.operations),
1286
- defaultSelected: !1
1287
- }, {
1288
- key: "businessId",
1289
- labelKey: "auditLog.exportFields.businessId",
1290
- getValue: (e) => e.businessId,
1291
- defaultSelected: !1
1292
- }, {
1293
- key: "restaurantId",
1294
- labelKey: "auditLog.exportFields.restaurantId",
1295
- getValue: (e) => e.restaurantId,
1296
- defaultSelected: !1
1297
- }, {
1298
- key: "country",
1299
- labelKey: "auditLog.exportFields.country",
1300
- getValue: (e) => e.country,
1301
- defaultSelected: !1
1302
- }, {
1303
- key: "resolvedFrom",
1304
- labelKey: "auditLog.exportFields.resolvedFrom",
1305
- getValue: (e) => {
1306
- var s;
1307
- return (s = e.metadata) == null ? void 0 : s.resolvedFrom;
1308
- },
1309
- defaultSelected: !1
1310
- }, {
1311
- key: "requestMethod",
1312
- labelKey: "auditLog.exportFields.requestMethod",
1313
- getValue: (e) => {
1314
- var s;
1315
- return (s = e.metadata) == null ? void 0 : s.requestMethod;
1316
- },
1317
- defaultSelected: !1
1318
- }, {
1319
- key: "requestPath",
1320
- labelKey: "auditLog.exportFields.requestPath",
1321
- getValue: (e) => {
1322
- var s;
1323
- return (s = e.metadata) == null ? void 0 : s.requestPath;
1324
- },
1325
- defaultSelected: !1
1326
- }, {
1327
- key: "traceId",
1328
- labelKey: "auditLog.exportFields.traceId",
1329
- getValue: (e) => e.traceId ?? "",
1330
- defaultSelected: !1
1331
- }];
1332
- function vo() {
1333
- try {
1334
- const e = localStorage.getItem(Vt);
1335
- if (e) {
1336
- const s = JSON.parse(e);
1337
- if (Array.isArray(s) && s.length > 0) return new Set(s);
1338
- }
1339
- } catch {
1340
- }
1341
- return new Set(Ze.filter((e) => e.defaultSelected).map((e) => e.key));
1342
- }
1343
- const he = w(vo());
1344
- function po(e) {
1345
- const s = new Set(he.value);
1346
- if (s.has(e)) {
1347
- if (s.size <= 1) return;
1348
- s.delete(e);
1349
- } else
1350
- s.add(e);
1351
- he.value = s;
1352
- try {
1353
- localStorage.setItem(Vt, JSON.stringify([...s]));
1354
- } catch {
1355
- }
1356
- }
1357
- async function go() {
1358
- var e, s, c, L, k;
1359
- if (!S.value) {
1360
- S.value = !0;
1361
- try {
1362
- const {
1363
- startDate: C,
1364
- endDate: R
1365
- } = se.value, ie = Pe.value.subjectPrefixes, Ue = (/* @__PURE__ */ new Date()).toISOString().slice(0, 19).replace("T", " "), we = R ? de(R) : null, Ke = we && we < Ue ? we : Ue, tt = {
1366
- ...C ? {
1367
- from: de(C)
1368
- } : {},
1369
- to: Ke,
1370
- ...re.value.userIds.length ? {
1371
- userIds: re.value.userIds
1372
- } : {},
1373
- ...re.value.feedmeAdminActors ? {
1374
- feedmeAdminActors: !0
1375
- } : {},
1376
- ...(e = Q.value) != null && e.length ? {
1377
- subjects: Q.value
1378
- } : {},
1379
- ...ie.length ? {
1380
- subjectPrefixes: [...ie]
1381
- } : {},
1382
- ...pe.value.length ? {
1383
- sources: [...pe.value]
1384
- } : {},
1385
- ...q.value && Z.value.length ? {
1386
- restaurantIds: [...Z.value]
1387
- } : {},
1388
- ...(s = ne.value) != null && s.length ? {
1389
- actions: ne.value
1390
- } : {},
1391
- ...(c = ae.value) != null && c.length ? {
1392
- outcomes: We(ae.value)
1393
- } : {},
1394
- ...ee.value ? {
1395
- search: ee.value
1396
- } : {},
1397
- ...me.value.length ? {
1398
- searchUserIds: me.value
1399
- } : {},
1400
- ...ge.value.length ? {
1401
- searchSubjects: ge.value
1402
- } : {}
1403
- }, Ie = [];
1404
- let p = 0;
1405
- for (; ; ) {
1406
- const J = await Oe.read({
1407
- ...tt,
1408
- limit: rt,
1409
- offset: p
1410
- });
1411
- if (Ie.push(...J), J.length < rt) break;
1412
- p += rt;
1413
- }
1414
- const $ = Ze.filter((J) => he.value.has(J.key)), Do = $.map((J) => o(J.labelKey)), Oo = Ie.map((J) => $.map((No) => No.getValue(J) ?? "")), ot = -(/* @__PURE__ */ new Date()).getTimezoneOffset(), Co = ot >= 0 ? "+" : "-", To = String(Math.floor(Math.abs(ot) / 60)).padStart(2, "0"), jo = String(Math.abs(ot) % 60).padStart(2, "0"), Vo = `UTC${Co}${To}:${jo}`, At = ((L = r.currentBusiness.value) == null ? void 0 : L.name) || "", $o = [C, R].filter(Boolean).join(" – "), Po = [...[[o("auditLog.title")], [`${o("auditLog.frontMatter.date")}: ${$o}`], ...At ? [[`${o("auditLog.frontMatter.business")}: ${At}`]] : [], [`${o("auditLog.frontMatter.generatedBy")}: ${j().format("DD MMM YYYY, HH:mm")} (${Vo})`], []].map((J) => J.map(St).join(",")), ...[Do, ...Oo].map((J) => J.map(St).join(","))].join(`
1415
- `), Eo = `audit-log_${(((k = r.currentBusiness.value) == null ? void 0 : k.name) || "business").replace(/[^a-z0-9_-]+/gi, "_")}_${j().format("YYYYMMDD_HHmmss")}.csv`, Ro = new Blob([`\uFEFF${Po}`], {
1416
- type: "text/csv;charset=utf-8;"
1417
- }), Ft = window.URL.createObjectURL(Ro), Ae = document.createElement("a");
1418
- Ae.href = Ft, Ae.download = Eo, document.body.appendChild(Ae), Ae.click(), Ae.remove(), window.URL.revokeObjectURL(Ft);
1419
- } finally {
1420
- S.value = !1;
1421
- }
1422
- }
1423
- }
1424
- function te(e) {
1425
- return "status" in e;
1426
- }
1427
- function ho(e) {
1428
- return Tt(e) ? h(ve.FmTooltip, {
1429
- variant: "plain",
1430
- placement: "top"
1431
- }, {
1432
- default: () => h(ve.FmIcon, {
1433
- name: "error",
1434
- size: "sm",
1435
- class: "cursor-help text-fm-color-typo-error"
1436
- }, null),
1437
- content: () => o("auditLog.operation.partialFailure")
1438
- }) : null;
1439
- }
1440
- function yo(e) {
1441
- var c;
1442
- const s = e.original;
1443
- return e.depth === 0 && !te(s) && !!((c = s.operations) != null && c.length);
1444
- }
1445
- function bo(e) {
1446
- return te(e) ? void 0 : e.operations;
1447
- }
1448
- const Se = [{
1449
- accessorKey: "timestamp",
1450
- header: () => o("auditLog.columns.timestamp"),
1451
- cell(e) {
1452
- return bt(e.row.original.timestamp);
1453
- }
1454
- }, {
1455
- accessorKey: "userId",
1456
- header: () => o("auditLog.columns.user"),
1457
- enableSorting: !1,
1458
- size: 220,
1459
- cell(e) {
1460
- const s = e.row.original;
1461
- return te(s) ? null : h("div", {
1462
- class: "flex items-center gap-8"
1463
- }, [h(ve.FmAvatar, {
1464
- name: ke(s),
1465
- initials: os(ke(s)),
1466
- size: "sm",
1467
- class: "shrink-0"
1468
- }, null), h("div", {
1469
- class: "min-w-0"
1470
- }, [h("p", {
1471
- class: "truncate font-semibold"
1472
- }, [ke(s)]), h("p", {
1473
- class: "truncate text-fm-color-typo-secondary"
1474
- }, [yt(s)])])]);
1475
- }
1476
- }, {
1477
- accessorKey: "subject",
1478
- header: () => o("auditLog.columns.subject"),
1479
- cell(e) {
1480
- const s = e.row.original;
1481
- return te(s) ? h("span", {
1482
- class: "text-fm-color-typo-secondary"
1483
- }, [o("auditLog.operation.rowHint")]) : Ge(s.subject) ?? s.subject;
1484
- }
1485
- }, {
1486
- accessorKey: "action",
1487
- header: () => o("auditLog.columns.action"),
1488
- enableSorting: !1,
1489
- size: 280,
1490
- meta: {
1491
- cellSpanClass: "audit-log-action-label"
1492
- },
1493
- cell(e) {
1494
- var R;
1495
- const s = e.row.original;
1496
- if (te(s))
1497
- return h("span", {
1498
- class: "audit-op-marker flex flex-wrap items-baseline gap-4"
1499
- }, [h("span", {
1500
- class: "text-fm-color-typo-secondary"
1501
- }, [ye("↳")]), h("span", {
1502
- class: "font-semibold"
1503
- }, [Lt(s)]), s.entityId ? h("span", {
1504
- class: "text-fm-color-typo-secondary"
1505
- }, [ye("· "), s.entityId]) : null, s.status === "failed" && s.errorMessage ? h("span", {
1506
- class: "text-fm-color-typo-error"
1507
- }, [ye("· "), s.errorMessage]) : null]);
1508
- const c = ((R = s.operations) == null ? void 0 : R.length) ?? 0, L = (ie) => {
1509
- ie.stopPropagation(), e.row.getToggleExpandedHandler()();
1510
- }, k = {
1511
- variant: "tertiary",
1512
- icon: e.row.getIsExpanded() ? "keyboard_arrow_up" : "keyboard_arrow_down",
1513
- "aria-label": o("auditLog.operation.toggle"),
1514
- class: "ml-auto shrink-0",
1515
- onClick: L
1516
- }, C = ve.FmButton;
1517
- return h("span", {
1518
- class: "flex items-center gap-8"
1519
- }, [h("span", null, [xt(s)]), c > 0 ? h("span", {
1520
- class: "cursor-pointer",
1521
- onClick: L
1522
- }, [h(ve.FmChip, {
1523
- variant: "neutral",
1524
- compact: !0,
1525
- label: o("auditLog.operation.badge", {
1526
- count: c
1527
- })
1528
- }, null)]) : null, e.row.getCanExpand() ? h(C, k, null) : null]);
1529
- }
1530
- }, {
1531
- accessorKey: "outcome",
1532
- header: () => o("auditLog.columns.outcome"),
1533
- enableSorting: !1,
1534
- cell(e) {
1535
- const s = e.row.original;
1536
- return te(s) ? h(ve.FmChip, {
1537
- variant: s.status === "failed" ? "critical" : "success",
1538
- label: s.status === "failed" ? o("auditLog.outcome.failed") : o("auditLog.outcome.success"),
1539
- compact: !0
1540
- }, null) : h("span", {
1541
- class: "flex items-center gap-4"
1542
- }, [h(ve.FmChip, {
1543
- variant: kt(s.outcome),
1544
- label: Qe(s.outcome),
1545
- compact: !0
1546
- }, null), ho(s)]);
1547
- }
1548
- }], _o = [
1549
- Se[0],
1550
- // timestamp: Date
1551
- Se.find((e) => e.accessorKey === "userId"),
1552
- // User: getUserName -> posActorLabel for posUser rows
1553
- {
1554
- accessorKey: "restaurantId",
1555
- header: () => o("auditLog.columns.restaurant"),
1556
- enableSorting: !1,
1557
- cell(e) {
1558
- const s = e.row.original;
1559
- return te(s) ? null : s.restaurantId && Ht.value[s.restaurantId] || s.restaurantId || "-";
1560
- }
1561
- },
1562
- {
1563
- accessorKey: "deviceId",
1564
- header: () => o("auditLog.columns.device"),
1565
- enableSorting: !1,
1566
- cell(e) {
1567
- const s = e.row.original;
1568
- return te(s) ? null : lt(s, o);
1569
- }
1570
- },
1571
- {
1572
- accessorKey: "approverName",
1573
- header: () => o("auditLog.columns.approver"),
1574
- enableSorting: !1,
1575
- cell(e) {
1576
- const s = e.row.original;
1577
- return te(s) ? null : jt(s, o);
1578
- }
1579
- },
1580
- Se.find((e) => e.accessorKey === "action"),
1581
- // Action Description: event line
1582
- Se.find((e) => e.accessorKey === "outcome")
1583
- // Status
1584
- ], xo = A(() => q.value ? _o : Se);
1585
- function de(e) {
1586
- const s = j(e, Zn);
1587
- return new Date(s.year(), s.month(), s.date(), s.hour(), s.minute(), 0).toISOString().slice(0, 19).replace("T", " ");
1588
- }
1589
- async function wt() {
1590
- var e, s, c;
1591
- g.value = !0;
1592
- try {
1593
- const {
1594
- startDate: L,
1595
- endDate: k
1596
- } = se.value, C = (Ve.value - 1) * De, R = Pe.value.subjectPrefixes, ie = await Oe.read({
1597
- limit: De,
1598
- offset: C,
1599
- ...L ? {
1600
- from: de(L)
1601
- } : {},
1602
- ...k ? {
1603
- to: de(k)
1604
- } : {},
1605
- ...re.value.userIds.length ? {
1606
- userIds: re.value.userIds
1607
- } : {},
1608
- ...re.value.feedmeAdminActors ? {
1609
- feedmeAdminActors: !0
1610
- } : {},
1611
- ...(e = Q.value) != null && e.length ? {
1612
- subjects: Q.value
1613
- } : {},
1614
- ...R.length ? {
1615
- subjectPrefixes: [...R]
1616
- } : {},
1617
- ...pe.value.length ? {
1618
- sources: [...pe.value]
1619
- } : {},
1620
- ...q.value && Z.value.length ? {
1621
- restaurantIds: [...Z.value]
1622
- } : {},
1623
- ...(s = ne.value) != null && s.length ? {
1624
- actions: ne.value
1625
- } : {},
1626
- ...(c = ae.value) != null && c.length ? {
1627
- outcomes: We(ae.value)
1628
- } : {},
1629
- ...ee.value ? {
1630
- search: ee.value
1631
- } : {},
1632
- ...me.value.length ? {
1633
- searchUserIds: me.value
1634
- } : {},
1635
- ...ge.value.length ? {
1636
- searchSubjects: ge.value
1637
- } : {}
1638
- });
1639
- O.value = ie, Bt.value = ie.length === De, P.value = {};
1640
- } finally {
1641
- g.value = !1;
1642
- }
1643
- }
1644
- const It = A(() => {
1645
- var e;
1646
- return JSON.stringify({
1647
- businessId: ((e = r.currentBusiness.value) == null ? void 0 : e._id) ?? "",
1648
- dateRange: se.value,
1649
- users: [...fe.value ?? []].sort(),
1650
- subjects: [...Q.value ?? []].sort(),
1651
- outcomes: [...ae.value ?? []].sort(),
1652
- actions: [...ne.value ?? []].sort(),
1653
- moduleKey: le.value,
1654
- restaurantIds: [...Z.value].sort(),
1655
- search: ee.value,
1656
- // Member/feedme-admin-actor lists resolve asynchronously (and actors refetch on
1657
- // every date-range change), so searchUserIds can change after the key above is
1658
- // computed — include it explicitly or a late-arriving match never refetches.
1659
- searchUserIds: [...me.value].sort()
1660
- });
1661
- });
1662
- async function Lo() {
1663
- var L, k, C;
1664
- const {
1665
- startDate: e,
1666
- endDate: s
1667
- } = se.value, c = Pe.value.subjectPrefixes;
1668
- ze.value = await Oe.count({
1669
- ...e ? {
1670
- from: de(e)
1671
- } : {},
1672
- ...s ? {
1673
- to: de(s)
1674
- } : {},
1675
- ...re.value.userIds.length ? {
1676
- userIds: re.value.userIds
1677
- } : {},
1678
- ...re.value.feedmeAdminActors ? {
1679
- feedmeAdminActors: !0
1680
- } : {},
1681
- ...(L = Q.value) != null && L.length ? {
1682
- subjects: Q.value
1683
- } : {},
1684
- ...c.length ? {
1685
- subjectPrefixes: [...c]
1686
- } : {},
1687
- ...pe.value.length ? {
1688
- sources: [...pe.value]
1689
- } : {},
1690
- ...q.value && Z.value.length ? {
1691
- restaurantIds: [...Z.value]
1692
- } : {},
1693
- ...(k = ne.value) != null && k.length ? {
1694
- actions: ne.value
1695
- } : {},
1696
- ...(C = ae.value) != null && C.length ? {
1697
- outcomes: We(ae.value)
1698
- } : {},
1699
- ...ee.value ? {
1700
- search: ee.value
1701
- } : {},
1702
- ...me.value.length ? {
1703
- searchUserIds: me.value
1704
- } : {},
1705
- ...ge.value.length ? {
1706
- searchSubjects: ge.value
1707
- } : {}
1708
- });
1709
- }
1710
- oe(It, async () => {
1711
- var e;
1712
- Ve.value = 1, (e = r.currentBusiness.value) != null && e._id && await Promise.all([Lo(), wt()]);
1713
- }, {
1714
- immediate: !0
1715
- }), oe(le, () => {
1716
- Q.value = void 0, q.value && (fe.value = void 0);
1717
- });
1718
- let et = !1;
1719
- async function ko({
1720
- pageIndex: e
1721
- }) {
1722
- var s;
1723
- if ((s = r.currentBusiness.value) != null && s._id && !(e === 0 && Ve.value === 1) && !et) {
1724
- et = !0, Ve.value = e + 1;
1725
- try {
1726
- await wt();
1727
- } finally {
1728
- et = !1;
1729
- }
1730
- }
1731
- }
1732
- function So(e) {
1733
- if (te(e)) {
1734
- Io(e);
1735
- return;
1736
- }
1737
- i.value = e, V.value = !0, Xt(e);
1738
- }
1739
- function wo() {
1740
- V.value = !1, i.value = null, Qt();
1741
- }
1742
- function Io(e) {
1743
- m.value = e, x.value = !0;
1744
- }
1745
- function Ao() {
1746
- x.value = !1, m.value = null;
1747
- }
1748
- oe(r.currentBusiness, (e) => {
1749
- e && d.readTeamMembers();
1750
- }, {
1751
- immediate: !0
1752
- });
1753
- function Fo() {
1754
- const e = fe.value;
1755
- if (!(e != null && e.length)) return;
1756
- const s = new Set(Le.value.map((k) => k.userId)), c = new Set(d.members.map((k) => k.doc.userId)), L = e.filter((k) => k === it ? Ee.value : d.hasLoaded ? c.has(k) || s.has(k) : !0);
1757
- L.length !== e.length && (fe.value = L.length ? L : void 0);
1758
- }
1759
- async function Mo() {
1760
- var c;
1761
- if (!((c = r.currentBusiness.value) != null && c._id)) return;
1762
- const {
1763
- startDate: e,
1764
- endDate: s
1765
- } = se.value;
1766
- try {
1767
- const {
1768
- actors: L,
1769
- showFeedmeAdminFilter: k
1770
- } = await Oe.getFeedmeAdminFilter({
1771
- ...e ? {
1772
- from: de(e)
1773
- } : {},
1774
- ...s ? {
1775
- to: de(s)
1776
- } : {}
1777
- });
1778
- Le.value = L, Ee.value = k;
1779
- } catch {
1780
- Le.value = [], Ee.value = !1;
1781
- }
1782
- Fo();
1783
- }
1784
- return oe(() => {
1785
- var e;
1786
- return {
1787
- businessId: (e = r.currentBusiness.value) == null ? void 0 : e._id,
1788
- range: se.value
1789
- };
1790
- }, () => Mo(), {
1791
- immediate: !0,
1792
- deep: !0
1793
- }), (e, s) => {
1794
- const c = N("FmSpacer"), L = N("FmButton"), k = N("FmMenuItem"), C = N("FmMenu"), R = N("FmChip"), ie = N("FmDateRangePicker"), Ue = N("FmSearch"), we = N("FmTable"), Ke = N("FmIcon"), tt = N("FmTooltip"), Ie = N("FmSideSheet");
1795
- return f(), v(z, null, [h(Xo, {
1796
- heading: u(o)("auditLog.title")
1797
- }, {
1798
- "append-heading": Y(() => [h(c), h(L, {
1799
- variant: "primary",
1800
- "prepend-icon": "upload",
1801
- label: u(o)("auditLog.export"),
1802
- disabled: O.value.length === 0 || S.value || u(d).isLoading || u(d).members.length === 0,
1803
- loading: S.value,
1804
- onClick: go
1805
- }, null, 8, ["label", "disabled", "loading"]), h(C, {
1806
- "close-on-click": !1,
1807
- "z-index": 50
1808
- }, {
1809
- "menu-button": Y(() => [h(L, {
1810
- variant: "tertiary",
1811
- icon: "settings",
1812
- "aria-label": u(o)("auditLog.exportSettings.title"),
1813
- disabled: S.value
1814
- }, null, 8, ["aria-label", "disabled"])]),
1815
- default: Y(() => [a("div", Ds, [a("p", Os, l(u(o)("auditLog.exportSettings.title")), 1), (f(), v(z, null, ce(Ze, (p) => h(k, {
1816
- key: p.key,
1817
- label: u(o)(p.labelKey),
1818
- "has-checkbox": "",
1819
- "model-value": he.value.has(p.key),
1820
- disabled: he.value.has(p.key) && he.value.size === 1,
1821
- onClick: ($) => po(p.key)
1822
- }, null, 8, ["label", "model-value", "disabled", "onClick"])), 64))])]),
1823
- _: 1
1824
- })]),
1825
- default: Y(() => [a("div", Cs, [a("div", Ts, [h(cs, {
1826
- modelValue: le.value,
1827
- "onUpdate:modelValue": s[0] || (s[0] = (p) => le.value = p),
1828
- items: zt.value
1829
- }, null, 8, ["modelValue", "items"]), a("div", js, [h(ie, {
1830
- modelValue: se.value,
1831
- "onUpdate:modelValue": s[1] || (s[1] = (p) => se.value = p),
1832
- "show-predefined-range": "",
1833
- "show-time": "",
1834
- "predefined-range": io.value
1835
- }, {
1836
- "trigger-button": Y(() => [h(R, {
1837
- label: ro.value,
1838
- icon: "calendar_month"
1839
- }, null, 8, ["label"])]),
1840
- _: 1
1841
- }, 8, ["modelValue", "predefined-range"]), q.value ? M("", !0) : (f(), v("div", Vs, [h(Fe, {
1842
- modelValue: fe.value,
1843
- "onUpdate:modelValue": s[2] || (s[2] = (p) => fe.value = p),
1844
- items: Wt.value,
1845
- multiple: "",
1846
- variant: "dark",
1847
- placeholder: u(o)("auditLog.filter.user_placeholder"),
1848
- "selected-prefix": u(o)("auditLog.filter.selected_user_prefix"),
1849
- "chip-icon": "account_circle"
1850
- }, null, 8, ["modelValue", "items", "placeholder", "selected-prefix"])])), q.value ? M("", !0) : (f(), v("div", $s, [h(Fe, {
1851
- modelValue: Q.value,
1852
- "onUpdate:modelValue": s[3] || (s[3] = (p) => Q.value = p),
1853
- items: eo.value,
1854
- "filter-fn": to,
1855
- multiple: "",
1856
- variant: "dark",
1857
- placeholder: u(o)("auditLog.filter.subject_placeholder"),
1858
- "selected-prefix": u(o)("auditLog.filter.selected_subject_prefix"),
1859
- "chip-icon": "badge"
1860
- }, null, 8, ["modelValue", "items", "placeholder", "selected-prefix"])])), a("div", Ps, [h(Fe, {
1861
- modelValue: ne.value,
1862
- "onUpdate:modelValue": s[4] || (s[4] = (p) => ne.value = p),
1863
- items: oo.value,
1864
- multiple: "",
1865
- variant: "dark",
1866
- placeholder: u(o)("auditLog.filter.action_placeholder"),
1867
- "selected-prefix": u(o)("auditLog.filter.selected_action_prefix"),
1868
- searchable: !1
1869
- }, null, 8, ["modelValue", "items", "placeholder", "selected-prefix"])]), a("div", Es, [h(Fe, {
1870
- modelValue: ae.value,
1871
- "onUpdate:modelValue": s[5] || (s[5] = (p) => ae.value = p),
1872
- items: so.value,
1873
- multiple: "",
1874
- variant: "dark",
1875
- placeholder: u(o)("auditLog.filter.status_placeholder"),
1876
- "selected-prefix": u(o)("auditLog.filter.selected_status_prefix"),
1877
- searchable: !1,
1878
- "chip-icon": "check_circle"
1879
- }, null, 8, ["modelValue", "items", "placeholder", "selected-prefix"])]), q.value ? (f(), v("div", Rs, [h(Fe, {
1880
- modelValue: Z.value,
1881
- "onUpdate:modelValue": s[6] || (s[6] = (p) => Z.value = p),
1882
- items: Jt.value,
1883
- multiple: "",
1884
- variant: "dark",
1885
- placeholder: u(o)("auditLog.filter.restaurant_placeholder"),
1886
- "selected-prefix": u(o)("auditLog.filter.selected_restaurant_prefix"),
1887
- "chip-icon": "storefront"
1888
- }, null, 8, ["modelValue", "items", "placeholder", "selected-prefix"])])) : M("", !0), h(Ue, {
1889
- modelValue: qe.value,
1890
- "onUpdate:modelValue": s[7] || (s[7] = (p) => qe.value = p),
1891
- class: "ml-auto w-[280px]",
1892
- placeholder: u(o)("auditLog.search.placeholder")
1893
- }, null, 8, ["modelValue", "placeholder"])])]), h(Wo, null, {
1894
- default: Y(() => [a("div", Ns, [h(Qo, {
1895
- "is-loading": g.value,
1896
- "is-empty": O.value.length === 0,
1897
- title: u(o)("auditLog.noData.title"),
1898
- subtitle: u(o)("auditLog.noData.subtitle")
1899
- }, {
1900
- default: Y(() => [(f(), Ce(we, {
1901
- key: It.value,
1902
- "column-defs": xo.value,
1903
- "row-data": O.value,
1904
- "page-size": De,
1905
- "page-count": mt.value,
1906
- "row-count": ze.value,
1907
- "fetch-fn": ko,
1908
- "hide-footer": mt.value <= 1,
1909
- loading: g.value,
1910
- "expanded-state": P.value,
1911
- "get-row-can-expand": yo,
1912
- "get-sub-row": bo,
1913
- "pin-header-row": "",
1914
- class: "audit-log-list-table cursor-pointer",
1915
- "onUpdate:expandedState": s[8] || (s[8] = (p) => P.value = p),
1916
- onRowClick: s[9] || (s[9] = (p) => So(p.original))
1917
- }, null, 8, ["column-defs", "row-data", "page-count", "row-count", "hide-footer", "loading", "expanded-state"]))]),
1918
- _: 1
1919
- }, 8, ["is-loading", "is-empty", "title", "subtitle"])])]),
1920
- _: 1
1921
- })])]),
1922
- _: 1
1923
- }, 8, ["heading"]), h(Ie, {
1924
- header: u(o)("auditLog.detail.header"),
1925
- "model-value": V.value,
1926
- "max-width": 768,
1927
- "dismiss-away": "",
1928
- "onUpdate:modelValue": s[10] || (s[10] = (p) => {
1929
- p || wo();
1930
- })
1931
- }, {
1932
- default: Y(() => [i.value ? (f(), v("div", Us, [a("div", Ks, [a("div", Bs, [a("p", Ys, l(co(i.value)), 1), i.value.traceId ? (f(), v("p", zs, [ye(" Trace ID: " + l(i.value.traceId) + " ", 1), h(L, {
1933
- variant: "tertiary",
1934
- icon: "link",
1935
- class: "ml-4 align-middle",
1936
- "aria-label": u(o)("auditLog.detail.copyLink"),
1937
- onClick: u(Zt)
1938
- }, null, 8, ["aria-label", "onClick"])])) : M("", !0), i.value.eventId ? (f(), v("p", qs, " Event ID: " + l(i.value.eventId), 1)) : M("", !0)]), a("div", Js, [h(R, {
1939
- variant: kt(i.value.outcome),
1940
- label: Qe(i.value.outcome),
1941
- compact: ""
1942
- }, null, 8, ["variant", "label"]), u(Tt)(i.value) ? (f(), Ce(tt, {
1943
- key: 0,
1944
- variant: "plain",
1945
- placement: "top"
1946
- }, {
1947
- content: Y(() => [ye(l(u(o)("auditLog.operation.partialFailure")), 1)]),
1948
- default: Y(() => [h(Ke, {
1949
- name: "error",
1950
- size: "sm",
1951
- class: "cursor-help text-fm-color-typo-error"
1952
- })]),
1953
- _: 1
1954
- })) : M("", !0)])]), a("div", Hs, [a("div", Ws, [a("div", null, [a("p", Gs, l(u(o)("auditLog.detail.date")), 1), a("p", Xs, l(Xe(i.value.timestamp)), 1)]), a("div", null, [a("p", Qs, l(u(o)("auditLog.detail.user")), 1), a("p", Zs, l(ke(i.value)), 1)]), a("div", null, [a("p", ea, l(u(o)("auditLog.detail.email")), 1), a("p", ta, l(uo(i.value)), 1)]), i.value.field ? (f(), v("div", oa, [a("p", sa, l(u(o)("auditLog.detail.field")), 1), a("p", aa, l(i.value.field), 1)])) : M("", !0), a("div", null, [a("p", na, l(u(o)("auditLog.detail.business")), 1), a("p", la, l(i.value.businessId || "-"), 1)]), a("div", null, [a("p", ra, l(u(o)("auditLog.detail.restaurant")), 1), a("p", ia, l(i.value.restaurantId || "-"), 1)])])]), a("div", ua, [a("div", da, [a("p", ca, l(u(o)("auditLog.detail.eventDetails")), 1)]), s[13] || (s[13] = a("hr", {
1955
- class: "border-fm-color-border-default"
1956
- }, null, -1)), a("div", fa, [a("div", null, [a("p", ma, l(u(o)("auditLog.detail.actionDescription")), 1), a("p", va, l(i.value.metadata.operationLabel || "-"), 1)])])]), a("div", pa, [a("div", ga, [a("p", ha, l(u(o)("auditLog.detail.metadata")), 1)]), s[14] || (s[14] = a("hr", {
1957
- class: "border-fm-color-border-default"
1958
- }, null, -1)), a("div", ya, [a("div", null, [a("p", ba, l(u(o)("auditLog.detail.resolvedFrom")), 1), a("p", _a, l(fo(i.value.metadata.resolvedFrom)), 1)]), (i.value.metadata.resolvedFrom === "permissionSet" || i.value.metadata.resolvedFrom === "systemPermissionSet") && (i.value.metadata.permissionSetName || i.value.metadata.permissionSetId) ? (f(), v("div", xa, [a("p", La, l(u(o)("auditLog.detail.permissionSet")), 1), i.value.metadata.permissionSetName ? (f(), v("p", ka, l(i.value.metadata.permissionSetName), 1)) : M("", !0), i.value.metadata.permissionSetId ? (f(), v("p", Sa, l(i.value.metadata.permissionSetId), 1)) : M("", !0)])) : M("", !0), i.value.metadata.reason ? (f(), v("div", wa, [a("p", Ia, l(u(o)("auditLog.detail.reason")), 1), a("p", Aa, l(i.value.metadata.reason), 1)])) : M("", !0), a("div", null, [a("p", Fa, l(u(o)("auditLog.detail.requestMethod")), 1), a("p", Ma, l(mo(i.value)), 1)]), a("div", null, [a("p", Da, l(u(o)("auditLog.detail.requestPath")), 1), a("p", Oa, l(i.value.metadata.requestPath || "-"), 1)]), i.value.metadata.pos ? (f(), v(z, {
1959
- key: 2
1960
- }, [a("div", null, [a("p", Ca, l(u(o)("auditLog.pos.details.eventKey")), 1), a("p", Ta, l(i.value.eventKey || "-"), 1)]), a("div", null, [a("p", ja, l(u(o)("auditLog.columns.device")), 1), a("p", Va, l(u(lt)(i.value, u(o))), 1), i.value.metadata.pos.machineId ? (f(), v("p", $a, l(i.value.metadata.pos.machineId), 1)) : M("", !0)]), i.value.metadata.pos.appVersion ? (f(), v("div", Pa, [a("p", Ea, l(u(o)("auditLog.pos.details.appVersion")), 1), a("p", Ra, l(i.value.metadata.pos.appVersion), 1)])) : M("", !0), a("div", null, [a("p", Na, l(u(o)("auditLog.columns.approver")), 1), a("p", Ua, l(u(jt)(i.value, u(o))), 1)]), a("div", null, [a("p", Ka, l(u(o)("auditLog.pos.details.clock")), 1), a("p", Ba, [ye(l(Xe(new Date(i.value.metadata.pos.occurredAt))) + " · " + l(i.value.metadata.pos.clockSkewMs) + " ms", 1), i.value.metadata.pos.clockClamped ? (f(), v("span", Ya, " · " + l(u(o)("auditLog.pos.details.clamped")), 1)) : M("", !0)])]), i.value.params ? (f(), v("div", za, [a("p", qa, l(u(o)("auditLog.pos.details.params")), 1), a("pre", Ja, l(i.value.params), 1)])) : M("", !0)], 64)) : M("", !0), i.value.metadata.trace && i.value.metadata.trace.length > 0 ? (f(), v("div", Ha, [a("p", Wa, l(u(o)("auditLog.detail.permissionTrace")), 1), a("ol", Ga, [(f(!0), v(z, null, ce(i.value.metadata.trace, (p, $) => (f(), v("li", {
1961
- key: $,
1962
- class: "flex items-center gap-6"
1963
- }, [a("span", Xa, l($ + 1), 1), a("span", Qa, l(p), 1), $ < i.value.metadata.trace.length - 1 ? (f(), v("span", Za, "→")) : M("", !0)]))), 128))])])) : M("", !0), F.value ? (f(), v("div", en, [a("p", tn, l(u(o)("auditLog.detail.requestBody")), 1), a("pre", on, l(F.value), 1)])) : M("", !0)])])])) : M("", !0)]),
1964
- _: 1
1965
- }, 8, ["header", "model-value"]), h(Ie, {
1966
- header: u(o)("auditLog.operation.sheetHeader"),
1967
- "model-value": x.value,
1968
- "max-width": 768,
1969
- "dismiss-away": "",
1970
- "onUpdate:modelValue": s[12] || (s[12] = (p) => {
1971
- p || Ao();
1972
- })
1973
- }, {
1974
- default: Y(() => [m.value ? (f(), v("div", sn, [a("div", an, [a("div", nn, [a("p", ln, l(Lt(m.value)), 1), m.value.entityId ? (f(), v("p", rn, l(m.value.entityId), 1)) : M("", !0)]), h(R, {
1975
- variant: m.value.status === "failed" ? "critical" : "success",
1976
- label: m.value.status === "failed" ? u(o)("auditLog.outcome.failed") : u(o)("auditLog.outcome.success"),
1977
- compact: ""
1978
- }, null, 8, ["variant", "label"])]), a("div", un, [a("div", dn, [a("div", null, [a("p", cn, l(u(o)("auditLog.detail.date")), 1), a("p", fn, l(Xe(m.value.timestamp)), 1)]), m.value.entityId ? (f(), v("div", mn, [a("p", vn, l(u(o)("auditLog.operation.entity")), 1), a("p", pn, l(m.value.entityId), 1)])) : M("", !0), m.value.durationMs !== void 0 ? (f(), v("div", gn, [a("p", hn, l(u(o)("auditLog.operation.duration")), 1), a("p", yn, l(u(o)("auditLog.operation.durationValue", {
1979
- ms: m.value.durationMs
1980
- })), 1)])) : M("", !0)])]), m.value.status === "failed" ? (f(), v("div", bn, [a("p", _n, l(u(o)("auditLog.operation.error")), 1), a("p", xn, l(m.value.errorMessage || "-"), 1)])) : M("", !0), a("div", Ln, [a("div", kn, [a("p", Sn, l(u(o)("auditLog.operation.changes")), 1)]), s[17] || (s[17] = a("hr", {
1981
- class: "border-fm-color-border-default"
1982
- }, null, -1)), a("div", wn, [H.value.length ? (f(), v("div", In, [(f(!0), v(z, null, ce(H.value, (p, $) => (f(), v("div", {
1983
- key: $,
1984
- class: "space-y-4 py-8 first:pt-0 last:pb-0"
1985
- }, [a("div", An, [h(R, {
1986
- variant: xe(p.type),
1987
- label: Ut(p.type),
1988
- compact: ""
1989
- }, null, 8, ["variant", "label"]), a("span", Fn, l(Kt(p)), 1)]), a("p", Mn, [p.type === "add" ? (f(), v("span", Dn, l(p.afterDisplay), 1)) : p.type === "remove" ? (f(), v("span", On, l(p.beforeDisplay), 1)) : (f(), v(z, {
1990
- key: 2
1991
- }, [a("span", Cn, l(p.beforeDisplay), 1), s[15] || (s[15] = a("span", {
1992
- class: "text-fm-color-typo-secondary"
1993
- }, " → ", -1)), a("span", Tn, l(p.afterDisplay), 1)], 64))])]))), 128))])) : ft.value.length ? (f(), v("div", jn, [(f(!0), v(z, null, ce(ft.value, (p) => (f(), v("div", {
1994
- key: p.groupKey,
1995
- class: "space-y-4 py-8 first:pt-0 last:pb-0"
1996
- }, [a("div", Vn, [h(R, {
1997
- variant: je(p.type),
1998
- label: ct(p.type),
1999
- compact: ""
2000
- }, null, 8, ["variant", "label"]), a("span", $n, l(p.displayKey), 1)]), a("div", Pn, [(f(!0), v(z, null, ce(p.rows, ($) => (f(), v("p", {
2001
- key: $.path,
2002
- class: "break-all font-mono text-xs"
2003
- }, [$.type === "added" ? (f(), v("span", En, l($.after ?? "—"), 1)) : $.type === "removed" ? (f(), v("span", Rn, l($.before ?? "—"), 1)) : (f(), v(z, {
2004
- key: 2
2005
- }, [a("span", Nn, l($.before ?? "—"), 1), s[16] || (s[16] = a("span", {
2006
- class: "text-fm-color-typo-secondary"
2007
- }, " → ", -1)), a("span", Un, l($.after ?? "—"), 1)], 64))]))), 128))])]))), 128))])) : (f(), v("p", Kn, l(u(o)("auditLog.operation.noChanges")), 1))])]), U.value || I.value ? (f(), v("div", Bn, [a("button", {
2008
- type: "button",
2009
- class: "flex w-full items-center justify-between p-12 text-left",
2010
- onClick: s[11] || (s[11] = (p) => X.value = !X.value)
2011
- }, [a("p", Yn, l(u(o)("auditLog.operation.showData")), 1), h(Ke, {
2012
- name: "keyboard_arrow_down",
2013
- class: zo(["shrink-0 transition-transform", X.value ? "rotate-180" : ""])
2014
- }, null, 8, ["class"])]), X.value ? (f(), v(z, {
2015
- key: 0
2016
- }, [s[18] || (s[18] = a("hr", {
2017
- class: "border-fm-color-border-default"
2018
- }, null, -1)), a("div", zn, [U.value ? (f(), v("div", qn, [a("p", Jn, l(u(o)("auditLog.operation.before")), 1), a("pre", Hn, l(U.value), 1)])) : M("", !0), I.value ? (f(), v("div", Wn, [a("p", Gn, l(u(o)("auditLog.operation.after")), 1), a("pre", Xn, l(I.value), 1)])) : M("", !0)])], 64)) : M("", !0)])) : M("", !0)])) : M("", !0)]),
2019
- _: 1
2020
- }, 8, ["header", "model-value"])], 64);
2021
- };
2022
- }
2023
- }), yl = /* @__PURE__ */ Go(el, [["__scopeId", "data-v-277a4ae7"]]);
2024
- export {
2025
- yl as default
2026
- };