@feedmepos/mf-hrm-portal 2.3.0 → 2.3.1-dev.1

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