@feedmepos/mf-hrm-portal 2.4.0 → 2.4.2-dev
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/{ApprovalCodeList-D62tXKEd.js → ApprovalCodeList-DpNF0wL7.js} +14 -15
- package/dist/{AuditLogList-DQOdhFJm.js → AuditLogList-D2bUFsuK.js} +12 -12
- package/dist/ConditionBuilderForm.vue_vue_type_script_setup_true_lang-BjEJErcL.js +459 -0
- package/dist/EmployeeList-CBYU0R2j.js +896 -0
- package/dist/FormSection.vue_vue_type_script_setup_true_lang-DsPLbLwQ.js +90 -0
- package/dist/{GrantUserList-DaUUILOT.js → GrantUserList-ClliuQ8h.js} +15 -16
- package/dist/{Main-Dh3E2cEf.js → Main-CBuOW87D.js} +2274 -2280
- package/dist/Main-D9MQo2l1.js +101 -0
- package/dist/{Main-B95BdgQd.js → Main-DlPdGefL.js} +5 -5
- package/dist/MyPosProfile-IAPSqlBP.js +360 -0
- package/dist/PasscodePinField.vue_vue_type_script_setup_true_lang-TXPEqa46.js +126 -0
- package/dist/{PermissionSetList-BIzlo_EV.js → PermissionSetList-Dd0fkW0L.js} +107 -108
- package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-CjQCbJRu.js +4212 -0
- package/dist/PortalUserSearcher.vue_vue_type_style_index_0_scoped_827dfd60_lang-DJnIFlKq.js +1797 -0
- package/dist/RoleForm.vue_vue_type_script_setup_true_lang-hE2OZwfO.js +547 -0
- package/dist/RoleList-zZHpt079.js +274 -0
- package/dist/{ScheduleAddPositionModal.vue_vue_type_script_setup_true_lang-DsKfRa5Z.js → ScheduleAddPositionModal.vue_vue_type_script_setup_true_lang-yJwTtFyF.js} +1 -1
- package/dist/{ScheduleGeneralPage-D6NPsdrU.js → ScheduleGeneralPage-_cqIJY8R.js} +2 -2
- package/dist/{ScheduleModal.vue_vue_type_script_setup_true_lang-kYGNELLb.js → ScheduleModal.vue_vue_type_script_setup_true_lang-C6M76KUA.js} +187 -186
- package/dist/{SchedulePage-CO_ZP2QD.js → SchedulePage-DHkWe1KO.js} +16 -16
- package/dist/{SchedulePositionPage-DFjWfRwI.js → SchedulePositionPage-5JUJwlJc.js} +3 -3
- package/dist/{SelectFilter-B94Z_Fat.js → SelectFilter-DWRvb1Yl.js} +1 -1
- package/dist/TeamMemberList-C_4f5Djs.js +2082 -0
- package/dist/TimesheetList-B3Yx8cwt.js +408 -0
- package/dist/{TimesheetList.vue_vue_type_style_index_0_scoped_63294af2_lang-B97k3KNz.js → TimesheetList.vue_vue_type_style_index_0_scoped_ffd7f807_lang-Co2GtU1N.js} +7 -7
- package/dist/{app-BRlNuQIz.js → app-BA3UHSk0.js} +7688 -3881
- package/dist/app.js +3 -3
- package/dist/{approval-code-D6eLRwC7.js → approval-code-BR4FD3sx.js} +1 -1
- package/dist/{dayjs.min-BaLuYA95.js → dayjs.min-JyaQ6PUU.js} +34 -34
- package/dist/employee-n31b7QEp.js +237 -0
- package/dist/{grant-user-CdkuTYlZ.js → grant-user-DKUZdzrY.js} +1 -1
- package/dist/{iteration-t4kb_i13.js → index-CkC2sfPK.js} +573 -558
- package/dist/{lodash-Dv0NUeUP.js → lodash-BJMVlo9i.js} +1 -1
- package/dist/member-grant-B1V9g0Sb.js +54 -0
- package/dist/restaurant-BbSg6yOm.js +49 -0
- package/dist/role-iTqgtFqf.js +91 -0
- package/dist/rule-BJhti6BZ.js +845 -0
- package/dist/src/api/my-pos-profile/index.d.ts +3 -0
- package/dist/src/api/sso-provider/index.d.ts +5 -0
- package/dist/src/api/staff-invite/index.d.ts +16 -0
- package/dist/src/components/CollapsibleWrapper.vue.d.ts +11 -3
- package/dist/src/components/form/SegmentedTabs.vue.d.ts +23 -0
- package/dist/src/composables/useMenuAccess.d.ts +56 -0
- package/dist/src/composables/useSsoProviders.d.ts +19 -0
- package/dist/src/composables/useStaffInviteProviders.d.ts +8 -0
- package/dist/src/helpers/employee-merge.d.ts +33 -0
- package/dist/src/helpers/iteration.d.ts +9 -2
- package/dist/src/helpers/member-grant.d.ts +36 -0
- package/dist/src/helpers/my-pos-profile.d.ts +37 -0
- package/dist/src/helpers/permission-set.d.ts +1 -102
- package/dist/src/helpers/pos-assignment-rows.d.ts +28 -0
- package/dist/src/helpers/restaurant-lookup.d.ts +19 -0
- package/dist/src/helpers/role-merge.d.ts +11 -0
- package/dist/src/helpers/rule.d.ts +2 -2
- package/dist/src/helpers/staff-invite.d.ts +54 -0
- package/dist/src/helpers/string.d.ts +10 -1
- package/dist/src/router/menu-access-guard.d.ts +17 -0
- package/dist/src/router/shared.d.ts +3 -1
- package/dist/src/stores/restaurant.d.ts +7 -7
- package/dist/src/stores/team.d.ts +30 -0
- package/dist/src/types/my-pos-profile.d.ts +24 -0
- package/dist/src/types/sso-provider.d.ts +10 -0
- package/dist/src/types/staff-invite.d.ts +100 -0
- package/dist/src/types/team.d.ts +17 -1
- package/dist/src/views/audit-log/locales/index.d.ts +12 -0
- package/dist/src/views/hr/locales/index.d.ts +20 -0
- package/dist/src/views/hr/role/RoleForm.vue.d.ts +29 -2
- package/dist/src/views/hr/timesheet/timesheet-view.d.ts +29 -0
- package/dist/src/views/my-pos-profile/MyPosProfile.vue.d.ts +2 -0
- package/dist/src/views/my-pos-profile/components/PasscodeChangedDialog.vue.d.ts +4 -0
- package/dist/src/views/my-pos-profile/locales/index.d.ts +236 -0
- package/dist/src/views/scheduling/composables/useScheduleOnboardingAvailability.d.ts +1 -1
- package/dist/src/views/scheduling/composables/useScheduleOnboardingWizard.d.ts +1 -1
- package/dist/src/views/scheduling/composables/useScheduleShiftDraft.d.ts +1 -1
- package/dist/src/views/scheduling/composables/useScheduleShiftPopover.d.ts +1 -1
- package/dist/src/views/team/components/BasePermission.vue.d.ts +11 -0
- package/dist/src/views/team/components/ConditionPermission.vue.d.ts +11 -0
- package/dist/src/views/team/components/MemberGrantFields.vue.d.ts +51 -0
- package/dist/src/views/team/{member/MemberInfo.vue.d.ts → components/MemberStatusBadge.vue.d.ts} +2 -2
- package/dist/src/views/team/components/PortalPermissionEditor.vue.d.ts +21 -0
- package/dist/src/views/team/components/PosAssignmentRows.vue.d.ts +44 -0
- package/dist/src/views/team/components/PosRolePermission.vue.d.ts +11 -0
- package/dist/src/views/team/locales/index.d.ts +716 -0
- package/dist/src/views/team/member/AddMemberForm.vue.d.ts +48 -3
- package/dist/src/views/team/member/ExistingMemberNotice.vue.d.ts +11 -0
- package/dist/src/views/team/member/MemberDetailsCard.vue.d.ts +35 -0
- package/dist/src/views/team/member/MemberHeaderCard.vue.d.ts +19 -0
- package/dist/src/views/team/member/TeamMemberList.vue.d.ts +1 -0
- package/dist/string-DZQ1uNjn.js +22 -0
- package/dist/style.css +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{useAppStore-CIPpnfP7.js → useAppStore-DiGaOhje.js} +1 -1
- package/dist/{useLoading-BRCeBVXP.js → useLoading-DOcoObCD.js} +1 -1
- package/dist/{useReportPermissions-Bveud3kc.js → useReportPermissions-c9KGuXQq.js} +22 -22
- package/dist/useSsoProviders-CkhHtzRQ.js +41 -0
- package/package.json +2 -2
- package/dist/ConditionBuilderForm.vue_vue_type_script_setup_true_lang-BDT1AfXa.js +0 -438
- package/dist/EmployeeList-Bd211chl.js +0 -776
- package/dist/FormItem.vue_vue_type_script_setup_true_lang-CUBQnkkY.js +0 -45
- package/dist/FormSection.vue_vue_type_script_setup_true_lang-DknXTYiK.js +0 -49
- package/dist/Main-CvGjvEQL.js +0 -96
- package/dist/PasscodePinField.vue_vue_type_script_setup_true_lang-CqG0v0Sz.js +0 -243
- package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-BYYiW77c.js +0 -4181
- package/dist/PortalUserSearcher.vue_vue_type_style_index_0_scoped_827dfd60_lang-CSYNrTGr.js +0 -35
- package/dist/RoleList-QJV3cGvV.js +0 -740
- package/dist/TeamMemberList-BbGMw0jg.js +0 -1150
- package/dist/TimesheetList-DiTCj2H7.js +0 -402
- package/dist/employee-DF_QGtpu.js +0 -209
- package/dist/restaurant-D2q9eNtu.js +0 -2685
- package/dist/role-y253W1Ep.js +0 -91
- package/dist/rule-DaFOMP6z.js +0 -780
- package/dist/string-VNuQNweN.js +0 -15
|
@@ -0,0 +1,845 @@
|
|
|
1
|
+
import { a as re, s as K, c as ie, e as y } from "./index-CkC2sfPK.js";
|
|
2
|
+
import { D as B, k as h, j as V, E as oe, C as H, g, b, u as Q, F as L, H as ae, h as x, I as S, n as F } from "./app-BA3UHSk0.js";
|
|
3
|
+
import { s as ue } from "./utils-BZkjJbju.js";
|
|
4
|
+
import { ref as v, computed as C, toRaw as ce } from "vue";
|
|
5
|
+
import { defineStore as Y, storeToRefs as G } from "pinia";
|
|
6
|
+
import { u as le } from "./restaurant-BbSg6yOm.js";
|
|
7
|
+
function k(e) {
|
|
8
|
+
if (e) {
|
|
9
|
+
if (typeof e == "string") {
|
|
10
|
+
if (e === "{}") return;
|
|
11
|
+
try {
|
|
12
|
+
return JSON.parse(e);
|
|
13
|
+
} catch {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
if (typeof e == "object")
|
|
18
|
+
return Object.keys(e).length > 0 ? e : void 0;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function j(e) {
|
|
22
|
+
return e ? Object.values(e).every(
|
|
23
|
+
(t) => t !== null && typeof t == "object" && !Array.isArray(t) && Object.keys(t).length === 1 && Array.isArray(t.$in)
|
|
24
|
+
) : !0;
|
|
25
|
+
}
|
|
26
|
+
function X(e) {
|
|
27
|
+
const t = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = (s, n, o) => {
|
|
28
|
+
var u, c;
|
|
29
|
+
const a = k(n.conditions);
|
|
30
|
+
let l = `${n.subject}::${JSON.stringify([...n.actions].sort())}`;
|
|
31
|
+
j(a) || (l += `::${JSON.stringify(a)}`);
|
|
32
|
+
const m = s.get(l);
|
|
33
|
+
if (!m) {
|
|
34
|
+
s.set(l, { ...n, setNames: [o.name], setId: o._id });
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
m.setNames.push(o.name);
|
|
38
|
+
const d = k(m.conditions);
|
|
39
|
+
if (!d || !a) {
|
|
40
|
+
m.conditions = void 0;
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
for (const f in a)
|
|
44
|
+
(u = d[f]) != null && u.$in && (c = a[f]) != null && c.$in ? d[f].$in = Array.from(
|
|
45
|
+
/* @__PURE__ */ new Set([...d[f].$in, ...a[f].$in])
|
|
46
|
+
) : d[f] || (d[f] = a[f]);
|
|
47
|
+
m.conditions = JSON.stringify(d);
|
|
48
|
+
};
|
|
49
|
+
for (const s of e)
|
|
50
|
+
for (const n of s.permissions)
|
|
51
|
+
i(n.inverted ? r : t, n, s);
|
|
52
|
+
return [...Array.from(t.values()), ...Array.from(r.values())];
|
|
53
|
+
}
|
|
54
|
+
function E(e, t) {
|
|
55
|
+
return `${e}::${[...t].sort().join(",")}`;
|
|
56
|
+
}
|
|
57
|
+
function Z(e, t) {
|
|
58
|
+
const r = [...e], i = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
|
|
59
|
+
for (const u of e) {
|
|
60
|
+
const c = B(u.subject);
|
|
61
|
+
i.add(E(c, u.actions)), u.inverted && u.actions.includes("manage") && s.add(`set_${c}`), !u.inverted && u.actions.includes("manage") && n.add(c);
|
|
62
|
+
}
|
|
63
|
+
const o = [...e];
|
|
64
|
+
for (; o.length > 0; ) {
|
|
65
|
+
const u = o.shift(), c = `set_${B(u.subject)}`, a = t[c];
|
|
66
|
+
if (!a || s.has(c) || !u.actions.includes("manage") || u.inverted) continue;
|
|
67
|
+
s.add(c);
|
|
68
|
+
const l = de(u);
|
|
69
|
+
u.source && !u.source.trace && (u.source = { ...u.source, trace: l });
|
|
70
|
+
const m = [...l, `${a.name} (system)`];
|
|
71
|
+
for (const d of a.permissions ?? []) {
|
|
72
|
+
const f = B(d.subject), p = E(f, d.actions);
|
|
73
|
+
i.has(p) || n.has(f) || (i.add(p), r.push({
|
|
74
|
+
...d,
|
|
75
|
+
// FdoPermissionRule.fields is string[] | null; RawRule expects string[] | undefined
|
|
76
|
+
fields: d.fields ?? void 0,
|
|
77
|
+
source: {
|
|
78
|
+
type: "systemPermissionSet",
|
|
79
|
+
permissionSetId: a.key,
|
|
80
|
+
permissionSetName: a.name,
|
|
81
|
+
trace: m
|
|
82
|
+
}
|
|
83
|
+
}));
|
|
84
|
+
}
|
|
85
|
+
for (const d of a.permissionSets ?? []) {
|
|
86
|
+
const f = B(d), p = E(f, ["manage"]), w = {
|
|
87
|
+
subject: f,
|
|
88
|
+
actions: ["manage"],
|
|
89
|
+
source: {
|
|
90
|
+
type: "systemPermissionSet",
|
|
91
|
+
permissionSetId: a.key,
|
|
92
|
+
permissionSetName: a.name,
|
|
93
|
+
trace: m
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
i.has(p) || (i.add(p), r.push(w)), o.push(w);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return [...r.filter((u) => !u.inverted), ...r.filter((u) => u.inverted)];
|
|
100
|
+
}
|
|
101
|
+
function de(e) {
|
|
102
|
+
if (!e.source) return [];
|
|
103
|
+
const { type: t, trace: r, permissionSetName: i } = e.source;
|
|
104
|
+
if (r && r.length > 0) return r;
|
|
105
|
+
switch (t) {
|
|
106
|
+
case "permissionSet":
|
|
107
|
+
return i ? [i] : [];
|
|
108
|
+
case "custom":
|
|
109
|
+
return ["custom"];
|
|
110
|
+
default:
|
|
111
|
+
return [];
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
function q(e, t) {
|
|
115
|
+
return Array.isArray(e) ? e.includes(t) : e === t;
|
|
116
|
+
}
|
|
117
|
+
function me(e) {
|
|
118
|
+
return Array.isArray(e) ? e[0] : e;
|
|
119
|
+
}
|
|
120
|
+
function xe(e, t) {
|
|
121
|
+
const r = t.find((s) => q(s.subject, e));
|
|
122
|
+
if (!(r != null && r.category) || r.isCategoryCover) return;
|
|
123
|
+
const i = t.find((s) => s.category === r.category && s.isCategoryCover);
|
|
124
|
+
if (i)
|
|
125
|
+
return me(i.subject);
|
|
126
|
+
}
|
|
127
|
+
function ke(e, t) {
|
|
128
|
+
const r = t.find((i) => q(i.subject, e));
|
|
129
|
+
return !!(r != null && r.isCategoryCover);
|
|
130
|
+
}
|
|
131
|
+
function ee(e, t, r = /* @__PURE__ */ new Set()) {
|
|
132
|
+
var i;
|
|
133
|
+
const s = [];
|
|
134
|
+
for (const n of e) {
|
|
135
|
+
if (r.has(n)) continue;
|
|
136
|
+
r.add(n);
|
|
137
|
+
const o = t.find((u) => u.id === n);
|
|
138
|
+
o && (s.push(o), (i = o.permissionSetIds) != null && i.length && s.push(...ee(o.permissionSetIds, t, r)));
|
|
139
|
+
}
|
|
140
|
+
return s;
|
|
141
|
+
}
|
|
142
|
+
function fe(e) {
|
|
143
|
+
const t = X(e).map(
|
|
144
|
+
({ setNames: s, setId: n, ...o }) => o
|
|
145
|
+
), r = t.filter((s) => !s.inverted), i = t.filter((s) => s.inverted);
|
|
146
|
+
return T(r, i);
|
|
147
|
+
}
|
|
148
|
+
function pe(e, t) {
|
|
149
|
+
const r = (u, c) => {
|
|
150
|
+
const a = { ...u }, l = JSON.parse(a.conditions || "{}");
|
|
151
|
+
if (c)
|
|
152
|
+
if (c.length > 0) {
|
|
153
|
+
const m = Object.keys(l)[0];
|
|
154
|
+
l[m].$in = c;
|
|
155
|
+
} else
|
|
156
|
+
delete a.conditions;
|
|
157
|
+
return {
|
|
158
|
+
...a,
|
|
159
|
+
inverted: !0,
|
|
160
|
+
...a.conditions && { conditions: JSON.stringify(l) }
|
|
161
|
+
};
|
|
162
|
+
}, i = new Map(e.map((u) => [u.subject, u])), s = new Map(t.map((u) => [u.subject, u])), n = [], o = /* @__PURE__ */ new Set([...i.keys(), ...s.keys()]);
|
|
163
|
+
for (const u of o) {
|
|
164
|
+
const c = i.get(u), a = s.get(u);
|
|
165
|
+
if (c && a) {
|
|
166
|
+
if (c.conditions && a.conditions) {
|
|
167
|
+
const l = JSON.parse(c.conditions), m = JSON.parse(a.conditions);
|
|
168
|
+
if (!j(l) || !j(m)) {
|
|
169
|
+
JSON.stringify(l) !== JSON.stringify(m) && n.push(a);
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
const d = Object.keys(l)[0], f = l[d].$in.filter(
|
|
173
|
+
(p) => !m[d].$in.includes(p)
|
|
174
|
+
);
|
|
175
|
+
f.length > 0 && n.push(r(c, f)), m[d].$in.filter(
|
|
176
|
+
(p) => !l[d].$in.includes(p)
|
|
177
|
+
).length > 0 && n.push(a);
|
|
178
|
+
} else if (!c.conditions && a.conditions)
|
|
179
|
+
n.push(a);
|
|
180
|
+
else if (c.conditions && !a.conditions)
|
|
181
|
+
j(JSON.parse(c.conditions)) || n.push(a);
|
|
182
|
+
else if (!c.conditions && !a.conditions) {
|
|
183
|
+
const l = new Set(c.actions), m = new Set(a.actions), d = a.actions.some((p) => !l.has(p)), f = c.actions.filter((p) => !m.has(p));
|
|
184
|
+
if (d) {
|
|
185
|
+
const p = a.actions.filter((w) => !l.has(w));
|
|
186
|
+
n.push({
|
|
187
|
+
...a,
|
|
188
|
+
actions: p
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
f.length > 0 && n.push({
|
|
192
|
+
...c,
|
|
193
|
+
actions: f,
|
|
194
|
+
inverted: !0
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
if (c) {
|
|
200
|
+
n.push(
|
|
201
|
+
r(
|
|
202
|
+
c,
|
|
203
|
+
// If base has conditions, set diffIds to empty array, disallow all access to collection
|
|
204
|
+
// otherwise, invert directly
|
|
205
|
+
c.conditions && []
|
|
206
|
+
)
|
|
207
|
+
);
|
|
208
|
+
continue;
|
|
209
|
+
}
|
|
210
|
+
a && n.push(a);
|
|
211
|
+
}
|
|
212
|
+
return n;
|
|
213
|
+
}
|
|
214
|
+
function ge(e) {
|
|
215
|
+
const t = Z(
|
|
216
|
+
e,
|
|
217
|
+
H
|
|
218
|
+
), r = new Set(
|
|
219
|
+
t.filter((s) => {
|
|
220
|
+
var n;
|
|
221
|
+
return ((n = s.source) == null ? void 0 : n.type) === "systemPermissionSet" && !s.inverted;
|
|
222
|
+
}).map((s) => s.subject)
|
|
223
|
+
), i = new Set(
|
|
224
|
+
t.filter(
|
|
225
|
+
(s) => {
|
|
226
|
+
var n;
|
|
227
|
+
return ((n = s.source) == null ? void 0 : n.type) === "systemPermissionSet" && !s.inverted && s.actions.includes("manage");
|
|
228
|
+
}
|
|
229
|
+
).map((s) => s.subject)
|
|
230
|
+
);
|
|
231
|
+
return e.filter((s) => s.inverted ? !(r.has(s.subject) && !i.has(s.subject)) : !r.has(s.subject));
|
|
232
|
+
}
|
|
233
|
+
const be = "business::report::";
|
|
234
|
+
function he(e, t) {
|
|
235
|
+
const r = [], i = e.filter((s) => {
|
|
236
|
+
const n = s.subject;
|
|
237
|
+
return !n.startsWith(be) || t.has(n) ? !0 : (r.push(n), !1);
|
|
238
|
+
});
|
|
239
|
+
return r.length > 0 && console.warn("[filterStalePermissions] dropped stale report permissions:", r), i;
|
|
240
|
+
}
|
|
241
|
+
const ve = "business::report::reports::", Se = h.Subject.Business.report_reports_allDefaultReports, ye = h.Subject.Business.report_reports_allCustomReports;
|
|
242
|
+
function je(e, t) {
|
|
243
|
+
return e.conditions ? !!t.conditions && e.conditions === t.conditions : !t.conditions;
|
|
244
|
+
}
|
|
245
|
+
function we(e, t) {
|
|
246
|
+
const r = e.find(
|
|
247
|
+
(o) => !o.inverted && o.subject === Se
|
|
248
|
+
), i = e.find(
|
|
249
|
+
(o) => !o.inverted && o.subject === ye
|
|
250
|
+
);
|
|
251
|
+
if (!r && !i) return e;
|
|
252
|
+
const s = r ? new Set(r.actions) : null, n = i ? new Set(i.actions) : null;
|
|
253
|
+
return e.reduce((o, u) => {
|
|
254
|
+
if (u.inverted)
|
|
255
|
+
return o.push(u), o;
|
|
256
|
+
const c = u.subject;
|
|
257
|
+
if (!c.startsWith(ve))
|
|
258
|
+
return o.push(u), o;
|
|
259
|
+
const a = t.has(c), l = a ? s : n, m = a ? r : i;
|
|
260
|
+
if (!l || !m || !je(m, u))
|
|
261
|
+
return o.push(u), o;
|
|
262
|
+
if (l.has("manage")) return o;
|
|
263
|
+
const d = u.actions;
|
|
264
|
+
if (d.includes("manage"))
|
|
265
|
+
return o.push(u), o;
|
|
266
|
+
const f = new Set(d);
|
|
267
|
+
for (const p of l)
|
|
268
|
+
f.delete(p);
|
|
269
|
+
return f.size === 0 || o.push({ ...u, actions: Array.from(f) }), o;
|
|
270
|
+
}, []);
|
|
271
|
+
}
|
|
272
|
+
function T(e, t) {
|
|
273
|
+
var r, i;
|
|
274
|
+
const s = new Map(e.map((n) => [n.subject, n]));
|
|
275
|
+
for (const n of t) {
|
|
276
|
+
if (n.inverted) {
|
|
277
|
+
const u = s.get(n.subject);
|
|
278
|
+
if (n.conditions) {
|
|
279
|
+
if (u != null && u.conditions) {
|
|
280
|
+
const c = JSON.parse(u.conditions), a = JSON.parse(n.conditions);
|
|
281
|
+
if (!j(c) || !j(a)) {
|
|
282
|
+
s.delete(n.subject);
|
|
283
|
+
continue;
|
|
284
|
+
}
|
|
285
|
+
const l = Object.keys(a)[0], m = ((r = a[l]) == null ? void 0 : r.$in) ?? [], d = (((i = c[l]) == null ? void 0 : i.$in) ?? []).filter((f) => !m.includes(f));
|
|
286
|
+
d.length > 0 ? s.set(n.subject, {
|
|
287
|
+
...u,
|
|
288
|
+
conditions: JSON.stringify({ [l]: { $in: d } })
|
|
289
|
+
}) : s.delete(n.subject);
|
|
290
|
+
} else
|
|
291
|
+
s.delete(n.subject);
|
|
292
|
+
continue;
|
|
293
|
+
}
|
|
294
|
+
if (u) {
|
|
295
|
+
const c = new Set(n.actions), a = u.actions.filter((l) => !c.has(l));
|
|
296
|
+
a.length > 0 ? s.set(n.subject, { ...u, actions: a }) : s.delete(n.subject);
|
|
297
|
+
continue;
|
|
298
|
+
}
|
|
299
|
+
continue;
|
|
300
|
+
}
|
|
301
|
+
if (n.conditions) {
|
|
302
|
+
s.set(n.subject, n);
|
|
303
|
+
continue;
|
|
304
|
+
}
|
|
305
|
+
const o = s.get(n.subject);
|
|
306
|
+
if (o != null && o.conditions && !j(JSON.parse(o.conditions))) {
|
|
307
|
+
s.set(n.subject, n);
|
|
308
|
+
continue;
|
|
309
|
+
}
|
|
310
|
+
if (o) {
|
|
311
|
+
const u = [
|
|
312
|
+
.../* @__PURE__ */ new Set([...o.actions, ...n.actions])
|
|
313
|
+
];
|
|
314
|
+
s.set(n.subject, {
|
|
315
|
+
...o,
|
|
316
|
+
actions: u
|
|
317
|
+
});
|
|
318
|
+
} else
|
|
319
|
+
s.set(n.subject, n);
|
|
320
|
+
}
|
|
321
|
+
return Array.from(s.values());
|
|
322
|
+
}
|
|
323
|
+
function Pe(e, t) {
|
|
324
|
+
const r = T(e, t), i = new Set(e.map((n) => n.subject)), s = t.filter(
|
|
325
|
+
(n) => n.inverted && !i.has(n.subject)
|
|
326
|
+
);
|
|
327
|
+
return [...r, ...s];
|
|
328
|
+
}
|
|
329
|
+
const te = (e) => JSON.parse(JSON.stringify(e));
|
|
330
|
+
function se(e) {
|
|
331
|
+
const t = e.find(
|
|
332
|
+
(r) => r.subject === h.Subject.Restaurant.restaurant
|
|
333
|
+
);
|
|
334
|
+
return t ? t.conditions ? JSON.parse(t.conditions).restaurantId.$in : null : [];
|
|
335
|
+
}
|
|
336
|
+
function ne(e) {
|
|
337
|
+
const t = e.find((r) => r.subject === h.Subject.Business.role);
|
|
338
|
+
return t ? t.conditions ? JSON.parse(t.conditions).roleId.$in : null : [];
|
|
339
|
+
}
|
|
340
|
+
function $e(e, t) {
|
|
341
|
+
const r = te(
|
|
342
|
+
e.filter((i) => i.subject !== h.Subject.Business.role)
|
|
343
|
+
);
|
|
344
|
+
return t && t.length > 0 && r.push({
|
|
345
|
+
actions: [h.Action.manage],
|
|
346
|
+
subject: h.Subject.Business.role,
|
|
347
|
+
conditions: JSON.stringify({ roleId: { $in: t } })
|
|
348
|
+
}), r;
|
|
349
|
+
}
|
|
350
|
+
function De(e, t, { restaurantRoles: r, allRoleIds: i }) {
|
|
351
|
+
let s = te(
|
|
352
|
+
e.filter(
|
|
353
|
+
(n) => n.subject !== h.Subject.Business.restaurant && n.subject !== h.Subject.Restaurant.restaurant
|
|
354
|
+
)
|
|
355
|
+
);
|
|
356
|
+
if (!t || t.length > 0) {
|
|
357
|
+
const {
|
|
358
|
+
category: n,
|
|
359
|
+
showByFeatureFlag: o,
|
|
360
|
+
...u
|
|
361
|
+
} = V.restaurant;
|
|
362
|
+
s.push(u);
|
|
363
|
+
const c = {
|
|
364
|
+
actions: [h.Action.manage],
|
|
365
|
+
subject: h.Subject.Restaurant.restaurant
|
|
366
|
+
};
|
|
367
|
+
t && (c.conditions = JSON.stringify({ restaurantId: { $in: t } })), s.push(c);
|
|
368
|
+
}
|
|
369
|
+
if (t) {
|
|
370
|
+
const n = [
|
|
371
|
+
...new Set(t.map((o) => r[o] ?? []).flatMap((o) => o))
|
|
372
|
+
];
|
|
373
|
+
n.length !== i.length && (s = $e(
|
|
374
|
+
s,
|
|
375
|
+
(ne(e) || i).filter((o) => n.includes(o))
|
|
376
|
+
));
|
|
377
|
+
}
|
|
378
|
+
return s;
|
|
379
|
+
}
|
|
380
|
+
function We(e) {
|
|
381
|
+
let t = e.userPermissions;
|
|
382
|
+
return e.reportSubjects && (t = he(t, e.reportSubjects)), e.defaultReportSubjects && (t = we(t, e.defaultReportSubjects)), {
|
|
383
|
+
customPermissions: pe(
|
|
384
|
+
fe(e.inheritedPermissions),
|
|
385
|
+
ge(t)
|
|
386
|
+
),
|
|
387
|
+
permissions: t.filter((r) => !r.inverted).map((r) => ({ ...r, subject: oe(r.subject) }))
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
const U = "/permission-sets", J = {
|
|
391
|
+
async read() {
|
|
392
|
+
return g(await b().get(U));
|
|
393
|
+
},
|
|
394
|
+
async create(e) {
|
|
395
|
+
return g(await b().post(U, e));
|
|
396
|
+
},
|
|
397
|
+
async update(e, t) {
|
|
398
|
+
return g(await b().put(`${U}/${e}`, t));
|
|
399
|
+
},
|
|
400
|
+
async delete(e) {
|
|
401
|
+
return g(await b().delete(`${U}/${e}`));
|
|
402
|
+
}
|
|
403
|
+
}, Ie = Y("hrm-permission-set", () => {
|
|
404
|
+
const e = Q(), t = v([]), r = v(!1), i = v(null);
|
|
405
|
+
async function s() {
|
|
406
|
+
const a = e.id.value ?? null;
|
|
407
|
+
if (i.value !== a)
|
|
408
|
+
try {
|
|
409
|
+
r.value = !0;
|
|
410
|
+
const l = await J.read();
|
|
411
|
+
t.value = c(l), i.value = a;
|
|
412
|
+
} finally {
|
|
413
|
+
r.value = !1;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
async function n(a) {
|
|
417
|
+
const l = await J.create(a);
|
|
418
|
+
t.value = c([...t.value, l]);
|
|
419
|
+
}
|
|
420
|
+
async function o(a, l) {
|
|
421
|
+
const m = await J.update(a, l);
|
|
422
|
+
t.value = c(t.value.map((d) => d.id === a ? m : d));
|
|
423
|
+
}
|
|
424
|
+
async function u(a) {
|
|
425
|
+
await J.delete(a), t.value = c(t.value.filter((l) => l.id !== a));
|
|
426
|
+
}
|
|
427
|
+
function c(a) {
|
|
428
|
+
return a.sort((l, m) => l.name.localeCompare(m.name));
|
|
429
|
+
}
|
|
430
|
+
return {
|
|
431
|
+
permissionSets: t,
|
|
432
|
+
isLoading: r,
|
|
433
|
+
readPermissionSets: s,
|
|
434
|
+
createPermissionSet: n,
|
|
435
|
+
updatePermissionSet: o,
|
|
436
|
+
deletePermissionSet: u
|
|
437
|
+
};
|
|
438
|
+
}), Re = () => {
|
|
439
|
+
const e = Ie();
|
|
440
|
+
return {
|
|
441
|
+
...e,
|
|
442
|
+
...G(e)
|
|
443
|
+
};
|
|
444
|
+
}, P = "/permission-assignments", I = {
|
|
445
|
+
async readAll() {
|
|
446
|
+
return g(await b().get(P));
|
|
447
|
+
},
|
|
448
|
+
async readByUserId(e) {
|
|
449
|
+
return g(await b().get(`${P}/user/${e}`));
|
|
450
|
+
},
|
|
451
|
+
async readById(e) {
|
|
452
|
+
return g(await b().get(`${P}/${e}`));
|
|
453
|
+
},
|
|
454
|
+
async create(e) {
|
|
455
|
+
return g(await b().post(P, e));
|
|
456
|
+
},
|
|
457
|
+
async update(e, t) {
|
|
458
|
+
return g(await b().put(`${P}/${e}`, t));
|
|
459
|
+
},
|
|
460
|
+
async delete(e) {
|
|
461
|
+
return g(await b().delete(`${P}/${e}`));
|
|
462
|
+
},
|
|
463
|
+
async addReportManagePermission(e, t) {
|
|
464
|
+
return g(
|
|
465
|
+
await b().post("/my-permissions/report-manage", { permissionKey: e, label: t })
|
|
466
|
+
);
|
|
467
|
+
}
|
|
468
|
+
}, Oe = Y("hrm-permission-assignment", () => {
|
|
469
|
+
const e = v([]);
|
|
470
|
+
async function t() {
|
|
471
|
+
const c = await I.readAll();
|
|
472
|
+
e.value = c;
|
|
473
|
+
}
|
|
474
|
+
async function r(c) {
|
|
475
|
+
return await I.readByUserId(c);
|
|
476
|
+
}
|
|
477
|
+
async function i(c) {
|
|
478
|
+
const a = await I.create(c);
|
|
479
|
+
e.value = [...e.value, a];
|
|
480
|
+
}
|
|
481
|
+
async function s(c, a) {
|
|
482
|
+
const l = await I.update(c, a);
|
|
483
|
+
e.value = e.value.map((m) => m.id === c ? l : m);
|
|
484
|
+
}
|
|
485
|
+
async function n(c) {
|
|
486
|
+
await I.delete(c), e.value = e.value.filter((a) => a.id !== c);
|
|
487
|
+
}
|
|
488
|
+
const o = C(() => {
|
|
489
|
+
const c = /* @__PURE__ */ new Map();
|
|
490
|
+
for (const a of e.value)
|
|
491
|
+
c.has(a.userId) || c.set(a.userId, a);
|
|
492
|
+
return c;
|
|
493
|
+
});
|
|
494
|
+
function u(c) {
|
|
495
|
+
return o.value.get(c);
|
|
496
|
+
}
|
|
497
|
+
return {
|
|
498
|
+
permissionAssignments: e,
|
|
499
|
+
readPermissionAssignments: t,
|
|
500
|
+
readPermissionAssignmentByUserId: r,
|
|
501
|
+
createPermissionAssignment: i,
|
|
502
|
+
updatePermissionAssignment: s,
|
|
503
|
+
deletePermissionAssignment: n,
|
|
504
|
+
getPermissionAssignmentByUserId: u
|
|
505
|
+
};
|
|
506
|
+
}), Ae = () => {
|
|
507
|
+
const e = Oe();
|
|
508
|
+
return {
|
|
509
|
+
...e,
|
|
510
|
+
...G(e)
|
|
511
|
+
};
|
|
512
|
+
}, Ne = {
|
|
513
|
+
async fetchReportPermissions(e, t) {
|
|
514
|
+
const r = t ? { lang: t } : {};
|
|
515
|
+
return g(
|
|
516
|
+
await L().get(`/report-query/hrm/${e}/reports`, { params: r })
|
|
517
|
+
);
|
|
518
|
+
},
|
|
519
|
+
async fetchReportPermissionsForPortal(e, t) {
|
|
520
|
+
const r = t ? { isSupportPos: !1, lang: t } : { isSupportPos: !1 };
|
|
521
|
+
return g(
|
|
522
|
+
await L().get(`/report-query/hrm/${e}/reports`, { params: r })
|
|
523
|
+
);
|
|
524
|
+
}
|
|
525
|
+
}, R = v([]), _ = v(!1), O = v(!1), A = v(null), D = v(null), M = v(!1);
|
|
526
|
+
function Be() {
|
|
527
|
+
const e = Q();
|
|
528
|
+
async function t() {
|
|
529
|
+
const i = e.id.value;
|
|
530
|
+
if (!i) return;
|
|
531
|
+
const s = localStorage.getItem("locale");
|
|
532
|
+
if (A.value !== i && (R.value = [], _.value = !1, O.value = !1, A.value = i, M.value = !1), !(_.value && D.value === s)) {
|
|
533
|
+
if (O.value) {
|
|
534
|
+
M.value = !0;
|
|
535
|
+
return;
|
|
536
|
+
}
|
|
537
|
+
O.value = !0;
|
|
538
|
+
try {
|
|
539
|
+
const n = await Ne.fetchReportPermissionsForPortal(i, s);
|
|
540
|
+
if (A.value !== i) return;
|
|
541
|
+
R.value = n, _.value = !0, D.value = s;
|
|
542
|
+
} catch (n) {
|
|
543
|
+
if (A.value !== i) return;
|
|
544
|
+
console.warn("Failed to fetch custom report permissions:", n), R.value = [];
|
|
545
|
+
} finally {
|
|
546
|
+
A.value === i && (O.value = !1, M.value && (M.value = !1, await t()));
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
const r = C(() => (e.isFoodCourt.value ? R.value.filter((s) => !s.isDefault || ae.has(s.permissionKey)) : R.value).map(
|
|
551
|
+
(s) => s.isDefault ? {
|
|
552
|
+
label: s.name,
|
|
553
|
+
subject: `business::report::reports::${s.permissionKey}`,
|
|
554
|
+
actions: [S.manage, S.read, S.create],
|
|
555
|
+
category: x.reports
|
|
556
|
+
} : {
|
|
557
|
+
label: s.name,
|
|
558
|
+
subject: `business::report::reports::${s.permissionKey}`,
|
|
559
|
+
actions: [
|
|
560
|
+
S.manage,
|
|
561
|
+
S.read,
|
|
562
|
+
S.create,
|
|
563
|
+
S.update,
|
|
564
|
+
S.delete
|
|
565
|
+
],
|
|
566
|
+
category: x.customReports
|
|
567
|
+
}
|
|
568
|
+
));
|
|
569
|
+
return {
|
|
570
|
+
fetchCustomReportPermissions: t,
|
|
571
|
+
customReportPermissions: r,
|
|
572
|
+
isLoading: C(() => O.value),
|
|
573
|
+
isLoaded: C(() => _.value)
|
|
574
|
+
};
|
|
575
|
+
}
|
|
576
|
+
function N(e) {
|
|
577
|
+
const t = Re(), r = Ae(), i = le().restaurants, { customReportPermissions: s } = Be(), n = r.getPermissionAssignmentByUserId(e.id), o = ee(
|
|
578
|
+
(n == null ? void 0 : n.permissionSetIds) ?? e.permissionSetIds ?? [],
|
|
579
|
+
t.permissionSets.value
|
|
580
|
+
).map((p) => ce(p)), u = X(o).map(
|
|
581
|
+
({ setNames: p, ...w }) => w
|
|
582
|
+
), c = n == null ? void 0 : n.customPermissions, a = c ?? e.permissions.map((p) => ({
|
|
583
|
+
...p,
|
|
584
|
+
subject: B(p.subject)
|
|
585
|
+
})), l = T(u, a), m = Z(
|
|
586
|
+
Pe(u, a),
|
|
587
|
+
H
|
|
588
|
+
).filter((p) => !p.inverted), d = se(m), f = re(i.value);
|
|
589
|
+
return {
|
|
590
|
+
doc: e,
|
|
591
|
+
id: e.id,
|
|
592
|
+
// An invite's name is the admin's, or its sign-in key when it has none.
|
|
593
|
+
name: e.status === "invited" ? e.name || "-" : e.name && e.name !== e.email && e.name !== e.phoneNumber ? e.name : "-",
|
|
594
|
+
phoneNumber: e.phoneNumber,
|
|
595
|
+
email: e.email,
|
|
596
|
+
restaurants: d == null ? [...f.allNamesSorted] : K(d.map((p) => f.nameById.get(p) ?? "")),
|
|
597
|
+
managableRestaurantIds: d,
|
|
598
|
+
permissionLabels: _e(m, s.value),
|
|
599
|
+
permissions: l,
|
|
600
|
+
status: e.status ?? "active",
|
|
601
|
+
loginMethod: e.loginMethod ?? "feedme"
|
|
602
|
+
};
|
|
603
|
+
}
|
|
604
|
+
const Ue = Object.freeze(
|
|
605
|
+
Object.values(V)
|
|
606
|
+
), ze = {
|
|
607
|
+
async readTeamMembers() {
|
|
608
|
+
return g(
|
|
609
|
+
await b().get("/portal-users")
|
|
610
|
+
).map(N);
|
|
611
|
+
},
|
|
612
|
+
async readTeamMembersPage(e) {
|
|
613
|
+
var r, i, s, n, o;
|
|
614
|
+
const t = g(
|
|
615
|
+
await b().get("/portal-users/paged", {
|
|
616
|
+
params: {
|
|
617
|
+
limit: e.limit,
|
|
618
|
+
offset: e.offset,
|
|
619
|
+
search: e.search,
|
|
620
|
+
restaurantIds: (r = e.restaurantIds) != null && r.length ? e.restaurantIds : void 0,
|
|
621
|
+
permissionSubjects: (i = e.permissionSubjects) != null && i.length ? e.permissionSubjects : void 0,
|
|
622
|
+
permissionSetIds: (s = e.permissionSetIds) != null && s.length ? e.permissionSetIds : void 0,
|
|
623
|
+
statuses: (n = e.statuses) != null && n.length ? e.statuses : void 0,
|
|
624
|
+
loginMethods: (o = e.loginMethods) != null && o.length ? e.loginMethods : void 0
|
|
625
|
+
}
|
|
626
|
+
})
|
|
627
|
+
);
|
|
628
|
+
return {
|
|
629
|
+
items: t.items.map(N),
|
|
630
|
+
total: t.total
|
|
631
|
+
};
|
|
632
|
+
},
|
|
633
|
+
async readTeamMember(e) {
|
|
634
|
+
return N(
|
|
635
|
+
g(await b().get(`/portal-users/${e}`))
|
|
636
|
+
);
|
|
637
|
+
},
|
|
638
|
+
async createTeamMember(e) {
|
|
639
|
+
return N(
|
|
640
|
+
g(await b().post("/portal-users", e))
|
|
641
|
+
);
|
|
642
|
+
},
|
|
643
|
+
async updateTeamMember(e, t) {
|
|
644
|
+
return N(
|
|
645
|
+
g(await b().put(`/portal-users/${e}`, t))
|
|
646
|
+
);
|
|
647
|
+
},
|
|
648
|
+
async deleteTeamMember(e) {
|
|
649
|
+
return g(await b().delete(`/portal-users/${e}`));
|
|
650
|
+
},
|
|
651
|
+
async readTeamMemberPosUserIds() {
|
|
652
|
+
return g(await b().get("/portal-users")).map((t) => t.posUserId);
|
|
653
|
+
},
|
|
654
|
+
async generateMasterUserPasscode(e) {
|
|
655
|
+
return `${g(
|
|
656
|
+
await b().post("/portal-users/generate-passcode", {
|
|
657
|
+
restaurantIds: e.restaurantIds,
|
|
658
|
+
excludePosUserId: e.excludePosUserId
|
|
659
|
+
})
|
|
660
|
+
)}`;
|
|
661
|
+
}
|
|
662
|
+
};
|
|
663
|
+
function Ke(e, t, r) {
|
|
664
|
+
if (e.some((o) => o.subject === "all")) return "All";
|
|
665
|
+
const i = (r ?? F).filter(
|
|
666
|
+
(o) => o.subject === t
|
|
667
|
+
), s = new Set(i.map((o) => $(o).value)), n = e.filter((o) => o.subject === t).filter((o) => s.has($(o).value));
|
|
668
|
+
return n.length === i.length ? "All" : n.length === 0 ? "-" : `${n.length} permission allow`;
|
|
669
|
+
}
|
|
670
|
+
function $(e) {
|
|
671
|
+
const t = ie(e), r = t.subject;
|
|
672
|
+
return {
|
|
673
|
+
...t,
|
|
674
|
+
get conditions() {
|
|
675
|
+
if (typeof t.conditions != "string") return t.conditions;
|
|
676
|
+
try {
|
|
677
|
+
return JSON.parse(t.conditions);
|
|
678
|
+
} catch {
|
|
679
|
+
return;
|
|
680
|
+
}
|
|
681
|
+
},
|
|
682
|
+
get isDiscountOperation() {
|
|
683
|
+
var i;
|
|
684
|
+
return r === y.F_RULE_SUBJECT.enum.order && ((i = this.conditions) == null ? void 0 : i.operation) === y.F_RULE_ORDER_OPERATION.enum.discount;
|
|
685
|
+
},
|
|
686
|
+
get isOrderOperation() {
|
|
687
|
+
return r === y.F_RULE_SUBJECT.enum.order;
|
|
688
|
+
},
|
|
689
|
+
get isReportPermission() {
|
|
690
|
+
return r === y.F_RULE_SUBJECT.enum.report;
|
|
691
|
+
},
|
|
692
|
+
/**
|
|
693
|
+
* Order and report rules are only meaningful together with the condition
|
|
694
|
+
* that names them. A rule missing it cannot be rendered or matched against
|
|
695
|
+
* the available permission list, so callers must preserve it verbatim —
|
|
696
|
+
* see `splitRoleFormPermissions`, which routes it to `passthrough`, not
|
|
697
|
+
* `dropped`. Dropping it would silently revoke a grant the portal cannot
|
|
698
|
+
* display (HRM-0027).
|
|
699
|
+
*/
|
|
700
|
+
get isResolvable() {
|
|
701
|
+
return this.discriminator !== void 0;
|
|
702
|
+
},
|
|
703
|
+
/**
|
|
704
|
+
* The condition value that identifies this rule, if the subject needs one.
|
|
705
|
+
* An empty condition counts as missing: `{ name: '' }` is a known corrupted
|
|
706
|
+
* shape that used to resolve to the first hardcoded report permission on
|
|
707
|
+
* save (HRM-0027), so it must not look resolvable here either.
|
|
708
|
+
*/
|
|
709
|
+
get discriminator() {
|
|
710
|
+
var i, s;
|
|
711
|
+
return this.isOrderOperation ? ((i = this.conditions) == null ? void 0 : i.operation) || void 0 : this.isReportPermission ? ((s = this.conditions) == null ? void 0 : s.name) || void 0 : r.toString();
|
|
712
|
+
},
|
|
713
|
+
get formatted() {
|
|
714
|
+
const i = this.discriminator;
|
|
715
|
+
return i === void 0 ? r.toString() : i.endsWith("_") ? i.slice(0, i.length - 1) : i;
|
|
716
|
+
},
|
|
717
|
+
get label() {
|
|
718
|
+
return t.label || ue(this.formatted);
|
|
719
|
+
},
|
|
720
|
+
get value() {
|
|
721
|
+
const i = this.discriminator;
|
|
722
|
+
return this.isOrderOperation || this.isReportPermission ? i === void 0 ? r.toString() : `${r}:${i}` : r.toString();
|
|
723
|
+
}
|
|
724
|
+
};
|
|
725
|
+
}
|
|
726
|
+
function Ve(e) {
|
|
727
|
+
var i, s;
|
|
728
|
+
const t = e.map((n) => $(n)).find((n) => n.isDiscountOperation);
|
|
729
|
+
if (!t) return 100;
|
|
730
|
+
const r = Number((s = (i = t.conditions) == null ? void 0 : i.adjustment) == null ? void 0 : s.$lte);
|
|
731
|
+
return Number.isFinite(r) ? parseInt((r * 100).toFixed(0)) : 0;
|
|
732
|
+
}
|
|
733
|
+
function He(e, t) {
|
|
734
|
+
return t.isOwner ? { restaurantIds: null, roleIds: null } : { restaurantIds: se(e), roleIds: ne(e) };
|
|
735
|
+
}
|
|
736
|
+
function Qe(e) {
|
|
737
|
+
return (e == null ? void 0 : e.some((t) => t.subject === "all")) ?? !1;
|
|
738
|
+
}
|
|
739
|
+
function Ye(e) {
|
|
740
|
+
const t = $(e);
|
|
741
|
+
if (!t.isReportPermission) return;
|
|
742
|
+
const { name: r, ...i } = t.conditions ?? {};
|
|
743
|
+
return Object.keys(i).length > 0 ? i : void 0;
|
|
744
|
+
}
|
|
745
|
+
function Ge(e, t, r) {
|
|
746
|
+
return e.flatMap((i) => {
|
|
747
|
+
const s = Je(i);
|
|
748
|
+
if (!s) return [];
|
|
749
|
+
const n = s.isReportPermission ? r == null ? void 0 : r.get(i) : void 0;
|
|
750
|
+
return [
|
|
751
|
+
{
|
|
752
|
+
subject: s.subject,
|
|
753
|
+
actions: s.actions,
|
|
754
|
+
conditions: {
|
|
755
|
+
...s.conditions,
|
|
756
|
+
...n ?? {},
|
|
757
|
+
adjustment: s.isDiscountOperation ? { $lte: parseFloat((t / 100).toFixed(2)) } : void 0
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
];
|
|
761
|
+
});
|
|
762
|
+
}
|
|
763
|
+
function Je(e) {
|
|
764
|
+
const t = e.indexOf(":"), r = t === -1 ? e : e.slice(0, t), i = t === -1 ? void 0 : e.slice(t + 1);
|
|
765
|
+
if (t !== -1 && !i) return;
|
|
766
|
+
let s;
|
|
767
|
+
return i ? (s = F.find((n) => {
|
|
768
|
+
if (n.subject !== r) return !1;
|
|
769
|
+
const o = typeof n.conditions == "string" ? JSON.parse(n.conditions) : n.conditions;
|
|
770
|
+
return [o == null ? void 0 : o.operation, o == null ? void 0 : o.name].includes(i);
|
|
771
|
+
}), !s && r === y.F_RULE_SUBJECT.enum.report && (s = {
|
|
772
|
+
label: "",
|
|
773
|
+
subject: y.F_RULE_SUBJECT.enum.report,
|
|
774
|
+
actions: ["read"],
|
|
775
|
+
conditions: { name: i },
|
|
776
|
+
inverted: !1,
|
|
777
|
+
reason: ""
|
|
778
|
+
})) : s = F.find((n) => n.subject === r), s ? $(s) : void 0;
|
|
779
|
+
}
|
|
780
|
+
function Xe(e, t) {
|
|
781
|
+
const r = { values: [], passthrough: [], dropped: [] };
|
|
782
|
+
for (const i of e) {
|
|
783
|
+
const s = i == null ? void 0 : i.actions;
|
|
784
|
+
if (typeof (i == null ? void 0 : i.subject) != "string" || i.subject.trim().length === 0 || !Array.isArray(s) || s.length === 0 || s.some((c) => typeof c != "string" || c.trim().length === 0)) {
|
|
785
|
+
r.dropped.push(i);
|
|
786
|
+
continue;
|
|
787
|
+
}
|
|
788
|
+
const n = $(i).value, o = `${y.F_RULE_SUBJECT.enum.report}:`, u = n.startsWith(o) ? n.slice(o.length) : "";
|
|
789
|
+
t.has(n) || u && u !== "undefined" ? r.values.push(n) : r.passthrough.push(i);
|
|
790
|
+
}
|
|
791
|
+
return r;
|
|
792
|
+
}
|
|
793
|
+
function W(e) {
|
|
794
|
+
const t = /* @__PURE__ */ new Map();
|
|
795
|
+
for (const r of e)
|
|
796
|
+
t.has(r.subject) || t.set(r.subject, r);
|
|
797
|
+
return t;
|
|
798
|
+
}
|
|
799
|
+
let z;
|
|
800
|
+
function _e(e, t = []) {
|
|
801
|
+
z ?? (z = W(Ue));
|
|
802
|
+
const r = W(t), i = [];
|
|
803
|
+
for (const s of e) {
|
|
804
|
+
const n = z.get(s.subject), o = (n && s.actions.includes("manage") ? n : void 0) || r.get(s.subject);
|
|
805
|
+
if (o) {
|
|
806
|
+
const u = o.subject === h.Subject.Business.inventory_stock ? "Warehouse Management" : o.label;
|
|
807
|
+
i.push(u);
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
return K(i);
|
|
811
|
+
}
|
|
812
|
+
export {
|
|
813
|
+
be as $,
|
|
814
|
+
ne as A,
|
|
815
|
+
he as B,
|
|
816
|
+
$e as C,
|
|
817
|
+
De as D,
|
|
818
|
+
pe as E,
|
|
819
|
+
Pe as H,
|
|
820
|
+
Z as N,
|
|
821
|
+
ee as P,
|
|
822
|
+
se as Q,
|
|
823
|
+
fe as R,
|
|
824
|
+
ge as T,
|
|
825
|
+
xe as V,
|
|
826
|
+
ke as Y,
|
|
827
|
+
Be as a,
|
|
828
|
+
He as b,
|
|
829
|
+
Ae as c,
|
|
830
|
+
Ge as d,
|
|
831
|
+
Ye as e,
|
|
832
|
+
Ke as f,
|
|
833
|
+
Ve as g,
|
|
834
|
+
Qe as h,
|
|
835
|
+
Ne as i,
|
|
836
|
+
X as j,
|
|
837
|
+
_e as m,
|
|
838
|
+
Ue as p,
|
|
839
|
+
$ as r,
|
|
840
|
+
Xe as s,
|
|
841
|
+
ze as t,
|
|
842
|
+
Re as u,
|
|
843
|
+
we as x,
|
|
844
|
+
We as z
|
|
845
|
+
};
|