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