@feedmepos/mf-hrm-portal 2.2.2-dev.4 → 2.2.3
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-Dn8R6jgC.js → ApprovalCodeList-BnG3T_Lk.js} +5 -5
- package/dist/{AuditLogList-BdWELtlp.js → AuditLogList-CpK9-YkB.js} +759 -705
- package/dist/{ConditionBuilderForm.vue_vue_type_script_setup_true_lang-DbUdX_Qk.js → ConditionBuilderForm.vue_vue_type_script_setup_true_lang-CzKzq19d.js} +2 -2
- package/dist/{EmployeeList-Br4a6imR.js → EmployeeList-CUsRanu7.js} +6 -6
- package/dist/{GrantUserList-YpLuH3il.js → GrantUserList-BJoj3ZcO.js} +6 -6
- package/dist/{Main-eBobrTdz.js → Main-5QLhf80L.js} +8 -8
- package/dist/{Main-DPoPfzcK.js → Main-BEUu3Hba.js} +5 -5
- package/dist/{Main-DWv0oSH4.js → Main-FPpK9B70.js} +11 -11
- package/dist/{PermissionSetList-ttA1JLVy.js → PermissionSetList-DZGZ0Pm_.js} +7 -7
- package/dist/{PortalPermissionEditor.vue_vue_type_script_setup_true_lang-DQa3GK8B.js → PortalPermissionEditor.vue_vue_type_script_setup_true_lang-BHEW1_dv.js} +945 -945
- package/dist/{PortalUserSearcher.vue_vue_type_style_index_0_scoped_827dfd60_lang-XHuHin8t.js → PortalUserSearcher.vue_vue_type_style_index_0_scoped_827dfd60_lang-Z-DH7ouY.js} +1 -1
- package/dist/{RoleList-B790AV-j.js → RoleList-D5yToard.js} +43 -43
- package/dist/{TeamMemberList-B-vgWJw4.js → TeamMemberList-C4-AHxO4.js} +9 -9
- package/dist/{TimesheetList-C05Wl5Gw.js → TimesheetList-DMo8KXoU.js} +7 -7
- package/dist/{TimesheetList.vue_vue_type_style_index_0_scoped_2c7a177a_lang-CDxi-Gdu.js → TimesheetList.vue_vue_type_style_index_0_scoped_2c7a177a_lang-2KHu-f8U.js} +3 -3
- package/dist/{app-DzZ_hyHn.js → app-DlSD8S9A.js} +2625 -2217
- package/dist/app.js +1 -1
- package/dist/{approval-code-jIjkeVEb.js → approval-code-BRClD2HN.js} +1 -1
- package/dist/{dayjs.min-B-hCRyX9.js → dayjs.min-DcI2auGP.js} +1 -1
- package/dist/{employee-C2s088Kk.js → employee-C_cvCoHM.js} +4 -4
- package/dist/{grant-user-SNiDV22U.js → grant-user-Dhi3ilC_.js} +1 -1
- package/dist/{iteration-C2OwvCva.js → iteration-DSzPQ0fZ.js} +1 -1
- package/dist/{lodash-BQEjwNx9.js → lodash-Ce0IJ8Y3.js} +1 -1
- package/dist/{restaurant-BTpBmfBV.js → restaurant-DiYb0pCm.js} +2 -2
- package/dist/{role-Z9s80hOy.js → role-DkTkfUgR.js} +2 -2
- package/dist/rule-B-REsmVM.js +771 -0
- package/dist/src/views/audit-log/export-lines.d.ts +8 -0
- package/dist/src/views/audit-log/locales/index.d.ts +68 -12
- package/dist/style.css +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{useAppStore-DCwd8GWN.js → useAppStore-BGhlB1_1.js} +1 -1
- package/dist/{useLoading-CXzTpIVv.js → useLoading-CvgqVDbF.js} +1 -1
- package/dist/{useReportPermissions-VnFzkyAH.js → useReportPermissions-VCzAQXKz.js} +5 -5
- package/package.json +2 -2
- package/dist/rule-DpoKkvLa.js +0 -1121
package/dist/rule-DpoKkvLa.js
DELETED
|
@@ -1,1121 +0,0 @@
|
|
|
1
|
-
import { s as W, c as Z, e as h } from "./iteration-C2OwvCva.js";
|
|
2
|
-
import { h as O, P as V, e as _, b as F, n as j, d as q } from "./app-DzZ_hyHn.js";
|
|
3
|
-
import { s as ee } from "./utils-BZkjJbju.js";
|
|
4
|
-
import { g as b, b as v, q as x, u as te } from "./restaurant-BTpBmfBV.js";
|
|
5
|
-
import { defineStore as z, storeToRefs as K } from "pinia";
|
|
6
|
-
import { ref as S, computed as U } from "vue";
|
|
7
|
-
import { useCoreStore as X } from "@feedmepos/mf-common";
|
|
8
|
-
const L = [
|
|
9
|
-
{
|
|
10
|
-
label: "",
|
|
11
|
-
subject: "order",
|
|
12
|
-
actions: ["update"],
|
|
13
|
-
conditions: {
|
|
14
|
-
operation: "discount",
|
|
15
|
-
adjustment: {
|
|
16
|
-
$lte: 1
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
inverted: !1,
|
|
20
|
-
reason: null
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
label: "",
|
|
24
|
-
subject: "order",
|
|
25
|
-
actions: ["update"],
|
|
26
|
-
conditions: { operation: "changePrice" },
|
|
27
|
-
inverted: !1,
|
|
28
|
-
reason: null
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
label: "",
|
|
32
|
-
subject: "order",
|
|
33
|
-
actions: ["update"],
|
|
34
|
-
// 'void_' (not 'void') — POS saves role/ability data straight to CouchDB, and
|
|
35
|
-
// 'void' is a reserved word in the POS Flutter/Dart client, so the identifier
|
|
36
|
-
// POS actually evaluates against (and sends to the approval-code validate
|
|
37
|
-
// endpoint) is already 'void_'. Keep in sync with approval-code-rules.ts.
|
|
38
|
-
conditions: { operation: "void_" },
|
|
39
|
-
inverted: !1,
|
|
40
|
-
reason: null
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
label: "",
|
|
44
|
-
subject: "order",
|
|
45
|
-
actions: ["update"],
|
|
46
|
-
conditions: { operation: "waiveServiceCharge" },
|
|
47
|
-
inverted: !1,
|
|
48
|
-
reason: null
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
label: "",
|
|
52
|
-
subject: "order",
|
|
53
|
-
actions: ["update"],
|
|
54
|
-
conditions: { operation: "payment" },
|
|
55
|
-
inverted: !1,
|
|
56
|
-
reason: null
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
label: "",
|
|
60
|
-
subject: "order",
|
|
61
|
-
actions: ["update"],
|
|
62
|
-
conditions: { operation: "claimDeposit" },
|
|
63
|
-
inverted: !1,
|
|
64
|
-
reason: null
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
label: "",
|
|
68
|
-
subject: "order",
|
|
69
|
-
actions: ["update"],
|
|
70
|
-
conditions: { operation: "resend" },
|
|
71
|
-
inverted: !1,
|
|
72
|
-
reason: null
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
label: "",
|
|
76
|
-
subject: "order",
|
|
77
|
-
actions: ["update"],
|
|
78
|
-
conditions: { operation: "changePaymentType" },
|
|
79
|
-
inverted: !1,
|
|
80
|
-
reason: null
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
label: "",
|
|
84
|
-
subject: "refund",
|
|
85
|
-
actions: ["create"],
|
|
86
|
-
conditions: null,
|
|
87
|
-
inverted: !1,
|
|
88
|
-
reason: null
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
label: "",
|
|
92
|
-
subject: "counter",
|
|
93
|
-
actions: ["manage"],
|
|
94
|
-
conditions: null,
|
|
95
|
-
inverted: !1,
|
|
96
|
-
reason: null
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
label: "",
|
|
100
|
-
subject: "mallIntegration",
|
|
101
|
-
actions: ["manage"],
|
|
102
|
-
conditions: null,
|
|
103
|
-
inverted: !1,
|
|
104
|
-
reason: null
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
label: "",
|
|
108
|
-
subject: "drawer",
|
|
109
|
-
actions: ["manage"],
|
|
110
|
-
conditions: null,
|
|
111
|
-
inverted: !1,
|
|
112
|
-
reason: null
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
label: "",
|
|
116
|
-
subject: "menu",
|
|
117
|
-
actions: ["manage"],
|
|
118
|
-
conditions: null,
|
|
119
|
-
inverted: !1,
|
|
120
|
-
reason: null
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
label: "",
|
|
124
|
-
subject: "inventory",
|
|
125
|
-
actions: ["manage"],
|
|
126
|
-
conditions: null,
|
|
127
|
-
inverted: !1,
|
|
128
|
-
reason: null
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
label: "",
|
|
132
|
-
subject: "deposit",
|
|
133
|
-
actions: ["manage"],
|
|
134
|
-
conditions: null,
|
|
135
|
-
inverted: !1,
|
|
136
|
-
reason: null
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
label: "",
|
|
140
|
-
subject: "delivery",
|
|
141
|
-
actions: ["manage"],
|
|
142
|
-
conditions: null,
|
|
143
|
-
inverted: !1,
|
|
144
|
-
reason: null
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
label: "",
|
|
148
|
-
subject: "counterRecord",
|
|
149
|
-
actions: ["manage"],
|
|
150
|
-
conditions: null,
|
|
151
|
-
inverted: !1,
|
|
152
|
-
reason: null
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
label: "",
|
|
156
|
-
subject: "restaurantSetting",
|
|
157
|
-
actions: ["manage"],
|
|
158
|
-
conditions: null,
|
|
159
|
-
inverted: !1,
|
|
160
|
-
reason: null
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
label: "",
|
|
164
|
-
subject: "display",
|
|
165
|
-
actions: ["manage"],
|
|
166
|
-
conditions: null,
|
|
167
|
-
inverted: !1,
|
|
168
|
-
reason: null
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
label: "",
|
|
172
|
-
subject: "printer",
|
|
173
|
-
actions: ["manage"],
|
|
174
|
-
conditions: null,
|
|
175
|
-
inverted: !1,
|
|
176
|
-
reason: null
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
label: "",
|
|
180
|
-
subject: "table",
|
|
181
|
-
actions: ["manage"],
|
|
182
|
-
conditions: null,
|
|
183
|
-
inverted: !1,
|
|
184
|
-
reason: null
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
label: "",
|
|
188
|
-
subject: "employee",
|
|
189
|
-
actions: ["manage"],
|
|
190
|
-
conditions: null,
|
|
191
|
-
inverted: !1,
|
|
192
|
-
reason: null
|
|
193
|
-
},
|
|
194
|
-
{
|
|
195
|
-
label: "",
|
|
196
|
-
subject: "system",
|
|
197
|
-
actions: ["manage"],
|
|
198
|
-
conditions: null,
|
|
199
|
-
inverted: !1,
|
|
200
|
-
reason: null
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
label: "",
|
|
204
|
-
subject: "tax",
|
|
205
|
-
actions: ["manage"],
|
|
206
|
-
conditions: null,
|
|
207
|
-
inverted: !1,
|
|
208
|
-
reason: null
|
|
209
|
-
},
|
|
210
|
-
{
|
|
211
|
-
label: "",
|
|
212
|
-
subject: "paymentType",
|
|
213
|
-
actions: ["manage"],
|
|
214
|
-
conditions: null,
|
|
215
|
-
inverted: !1,
|
|
216
|
-
reason: null
|
|
217
|
-
},
|
|
218
|
-
{
|
|
219
|
-
label: "",
|
|
220
|
-
subject: "faceId",
|
|
221
|
-
actions: ["manage"],
|
|
222
|
-
conditions: null,
|
|
223
|
-
inverted: !1,
|
|
224
|
-
reason: null
|
|
225
|
-
},
|
|
226
|
-
{
|
|
227
|
-
label: "",
|
|
228
|
-
subject: "report",
|
|
229
|
-
actions: ["read"],
|
|
230
|
-
conditions: { name: "closeup" },
|
|
231
|
-
inverted: !1,
|
|
232
|
-
reason: ""
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
label: "",
|
|
236
|
-
subject: "report",
|
|
237
|
-
actions: ["read"],
|
|
238
|
-
conditions: { name: "counter" },
|
|
239
|
-
inverted: !1,
|
|
240
|
-
reason: ""
|
|
241
|
-
},
|
|
242
|
-
{
|
|
243
|
-
label: "",
|
|
244
|
-
subject: "report",
|
|
245
|
-
actions: ["read"],
|
|
246
|
-
conditions: { name: "hourlySales" },
|
|
247
|
-
inverted: !1,
|
|
248
|
-
reason: ""
|
|
249
|
-
},
|
|
250
|
-
{
|
|
251
|
-
label: "",
|
|
252
|
-
subject: "report",
|
|
253
|
-
actions: ["read"],
|
|
254
|
-
conditions: { name: "dailySales" },
|
|
255
|
-
inverted: !1,
|
|
256
|
-
reason: ""
|
|
257
|
-
},
|
|
258
|
-
{
|
|
259
|
-
label: "",
|
|
260
|
-
subject: "report",
|
|
261
|
-
actions: ["read"],
|
|
262
|
-
conditions: { name: "productSales" },
|
|
263
|
-
inverted: !1,
|
|
264
|
-
reason: ""
|
|
265
|
-
},
|
|
266
|
-
{
|
|
267
|
-
label: "",
|
|
268
|
-
subject: "report",
|
|
269
|
-
actions: ["read"],
|
|
270
|
-
conditions: { name: "sourceProductSales" },
|
|
271
|
-
inverted: !1,
|
|
272
|
-
reason: ""
|
|
273
|
-
},
|
|
274
|
-
{
|
|
275
|
-
label: "",
|
|
276
|
-
subject: "report",
|
|
277
|
-
actions: ["read"],
|
|
278
|
-
conditions: { name: "userProductSales" },
|
|
279
|
-
inverted: !1,
|
|
280
|
-
reason: ""
|
|
281
|
-
},
|
|
282
|
-
{
|
|
283
|
-
label: "",
|
|
284
|
-
subject: "report",
|
|
285
|
-
actions: ["read"],
|
|
286
|
-
conditions: { name: "categorySales" },
|
|
287
|
-
inverted: !1,
|
|
288
|
-
reason: ""
|
|
289
|
-
},
|
|
290
|
-
{
|
|
291
|
-
label: "",
|
|
292
|
-
subject: "report",
|
|
293
|
-
actions: ["read"],
|
|
294
|
-
conditions: { name: "addonSales" },
|
|
295
|
-
inverted: !1,
|
|
296
|
-
reason: ""
|
|
297
|
-
},
|
|
298
|
-
{
|
|
299
|
-
label: "",
|
|
300
|
-
subject: "report",
|
|
301
|
-
actions: ["read"],
|
|
302
|
-
conditions: { name: "slotSales" },
|
|
303
|
-
inverted: !1,
|
|
304
|
-
reason: ""
|
|
305
|
-
},
|
|
306
|
-
{
|
|
307
|
-
label: "",
|
|
308
|
-
subject: "report",
|
|
309
|
-
actions: ["read"],
|
|
310
|
-
conditions: { name: "drawer" },
|
|
311
|
-
inverted: !1,
|
|
312
|
-
reason: ""
|
|
313
|
-
},
|
|
314
|
-
{
|
|
315
|
-
label: "",
|
|
316
|
-
subject: "report",
|
|
317
|
-
actions: ["read"],
|
|
318
|
-
conditions: { name: "discount" },
|
|
319
|
-
inverted: !1,
|
|
320
|
-
reason: ""
|
|
321
|
-
},
|
|
322
|
-
{
|
|
323
|
-
label: "",
|
|
324
|
-
subject: "report",
|
|
325
|
-
actions: ["read"],
|
|
326
|
-
conditions: { name: "refund" },
|
|
327
|
-
inverted: !1,
|
|
328
|
-
reason: ""
|
|
329
|
-
},
|
|
330
|
-
{
|
|
331
|
-
label: "",
|
|
332
|
-
subject: "report",
|
|
333
|
-
actions: ["read"],
|
|
334
|
-
// 'void_' (not 'void') to match the report-query service's permissionKey and the
|
|
335
|
-
// value already persisted in CouchDB — 'void' is a reserved word in the POS
|
|
336
|
-
// Flutter/Dart client. See pos-role.service.ts / pos-role.helpers.ts.
|
|
337
|
-
conditions: { name: "void_" },
|
|
338
|
-
inverted: !1,
|
|
339
|
-
reason: ""
|
|
340
|
-
},
|
|
341
|
-
{
|
|
342
|
-
label: "",
|
|
343
|
-
subject: "report",
|
|
344
|
-
actions: ["read"],
|
|
345
|
-
conditions: { name: "timesheet" },
|
|
346
|
-
inverted: !1,
|
|
347
|
-
reason: ""
|
|
348
|
-
},
|
|
349
|
-
{
|
|
350
|
-
label: "",
|
|
351
|
-
subject: "report",
|
|
352
|
-
actions: ["read"],
|
|
353
|
-
conditions: { name: "counterPayment" },
|
|
354
|
-
inverted: !1,
|
|
355
|
-
reason: ""
|
|
356
|
-
}
|
|
357
|
-
], E = "/permission-sets", N = {
|
|
358
|
-
async read() {
|
|
359
|
-
return b(await v().get(E));
|
|
360
|
-
},
|
|
361
|
-
async create(e) {
|
|
362
|
-
return b(await v().post(E, e));
|
|
363
|
-
},
|
|
364
|
-
async update(e, t) {
|
|
365
|
-
return b(await v().put(`${E}/${e}`, t));
|
|
366
|
-
},
|
|
367
|
-
async delete(e) {
|
|
368
|
-
return b(await v().delete(`${E}/${e}`));
|
|
369
|
-
}
|
|
370
|
-
}, se = z("permissionSet", () => {
|
|
371
|
-
const { currentBusiness: e } = X(), t = S([]), o = S(!1), n = S(null);
|
|
372
|
-
async function r() {
|
|
373
|
-
var l;
|
|
374
|
-
const c = ((l = e.value) == null ? void 0 : l._id) ?? null;
|
|
375
|
-
if (n.value !== c)
|
|
376
|
-
try {
|
|
377
|
-
o.value = !0;
|
|
378
|
-
const d = await N.read();
|
|
379
|
-
t.value = u(d), n.value = c;
|
|
380
|
-
} finally {
|
|
381
|
-
o.value = !1;
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
async function s(c) {
|
|
385
|
-
const l = await N.create(c);
|
|
386
|
-
t.value = u([...t.value, l]);
|
|
387
|
-
}
|
|
388
|
-
async function a(c, l) {
|
|
389
|
-
const d = await N.update(c, l);
|
|
390
|
-
t.value = u(t.value.map((m) => m.id === c ? d : m));
|
|
391
|
-
}
|
|
392
|
-
async function i(c) {
|
|
393
|
-
await N.delete(c), t.value = u(t.value.filter((l) => l.id !== c));
|
|
394
|
-
}
|
|
395
|
-
function u(c) {
|
|
396
|
-
return c.sort((l, d) => l.name.localeCompare(d.name));
|
|
397
|
-
}
|
|
398
|
-
return {
|
|
399
|
-
permissionSets: t,
|
|
400
|
-
isLoading: o,
|
|
401
|
-
readPermissionSets: r,
|
|
402
|
-
createPermissionSet: s,
|
|
403
|
-
updatePermissionSet: a,
|
|
404
|
-
deletePermissionSet: i
|
|
405
|
-
};
|
|
406
|
-
}), ne = () => {
|
|
407
|
-
const e = se();
|
|
408
|
-
return {
|
|
409
|
-
...e,
|
|
410
|
-
...K(e)
|
|
411
|
-
};
|
|
412
|
-
};
|
|
413
|
-
function k(e) {
|
|
414
|
-
if (e) {
|
|
415
|
-
if (typeof e == "string") {
|
|
416
|
-
if (e === "{}") return;
|
|
417
|
-
try {
|
|
418
|
-
return JSON.parse(e);
|
|
419
|
-
} catch {
|
|
420
|
-
return;
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
if (typeof e == "object")
|
|
424
|
-
return Object.keys(e).length > 0 ? e : void 0;
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
function y(e) {
|
|
428
|
-
return e ? Object.values(e).every(
|
|
429
|
-
(t) => t !== null && typeof t == "object" && !Array.isArray(t) && Object.keys(t).length === 1 && Array.isArray(t.$in)
|
|
430
|
-
) : !0;
|
|
431
|
-
}
|
|
432
|
-
function Q(e) {
|
|
433
|
-
const t = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), n = (r, s, a) => {
|
|
434
|
-
var i, u;
|
|
435
|
-
const c = k(s.conditions);
|
|
436
|
-
let l = `${s.subject}::${JSON.stringify([...s.actions].sort())}`;
|
|
437
|
-
y(c) || (l += `::${JSON.stringify(c)}`);
|
|
438
|
-
const d = r.get(l);
|
|
439
|
-
if (!d) {
|
|
440
|
-
r.set(l, { ...s, setNames: [a.name], setId: a._id });
|
|
441
|
-
return;
|
|
442
|
-
}
|
|
443
|
-
d.setNames.push(a.name);
|
|
444
|
-
const m = k(d.conditions);
|
|
445
|
-
if (!m || !c) {
|
|
446
|
-
d.conditions = void 0;
|
|
447
|
-
return;
|
|
448
|
-
}
|
|
449
|
-
for (const f in c)
|
|
450
|
-
(i = m[f]) != null && i.$in && (u = c[f]) != null && u.$in ? m[f].$in = Array.from(
|
|
451
|
-
/* @__PURE__ */ new Set([...m[f].$in, ...c[f].$in])
|
|
452
|
-
) : m[f] || (m[f] = c[f]);
|
|
453
|
-
d.conditions = JSON.stringify(m);
|
|
454
|
-
};
|
|
455
|
-
for (const r of e)
|
|
456
|
-
for (const s of r.permissions)
|
|
457
|
-
n(s.inverted ? o : t, s, r);
|
|
458
|
-
return [...Array.from(t.values()), ...Array.from(o.values())];
|
|
459
|
-
}
|
|
460
|
-
function B(e, t) {
|
|
461
|
-
return `${e}::${[...t].sort().join(",")}`;
|
|
462
|
-
}
|
|
463
|
-
function G(e, t) {
|
|
464
|
-
const o = [...e], n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set();
|
|
465
|
-
for (const i of e) {
|
|
466
|
-
const u = O(i.subject);
|
|
467
|
-
n.add(B(u, i.actions)), i.inverted && i.actions.includes("manage") && r.add(`set_${u}`), !i.inverted && i.actions.includes("manage") && s.add(u);
|
|
468
|
-
}
|
|
469
|
-
const a = [...e];
|
|
470
|
-
for (; a.length > 0; ) {
|
|
471
|
-
const i = a.shift(), u = `set_${O(i.subject)}`, c = t[u];
|
|
472
|
-
if (!c || r.has(u) || !i.actions.includes("manage") || i.inverted) continue;
|
|
473
|
-
r.add(u);
|
|
474
|
-
const l = oe(i);
|
|
475
|
-
i.source && !i.source.trace && (i.source = { ...i.source, trace: l });
|
|
476
|
-
const d = [...l, `${c.name} (system)`];
|
|
477
|
-
for (const m of c.permissions ?? []) {
|
|
478
|
-
const f = O(m.subject), p = B(f, m.actions);
|
|
479
|
-
n.has(p) || s.has(f) || (n.add(p), o.push({
|
|
480
|
-
...m,
|
|
481
|
-
// FdoPermissionRule.fields is string[] | null; RawRule expects string[] | undefined
|
|
482
|
-
fields: m.fields ?? void 0,
|
|
483
|
-
source: {
|
|
484
|
-
type: "systemPermissionSet",
|
|
485
|
-
permissionSetId: c.key,
|
|
486
|
-
permissionSetName: c.name,
|
|
487
|
-
trace: d
|
|
488
|
-
}
|
|
489
|
-
}));
|
|
490
|
-
}
|
|
491
|
-
for (const m of c.permissionSets ?? []) {
|
|
492
|
-
const f = O(m), p = B(f, ["manage"]), g = {
|
|
493
|
-
subject: f,
|
|
494
|
-
actions: ["manage"],
|
|
495
|
-
source: {
|
|
496
|
-
type: "systemPermissionSet",
|
|
497
|
-
permissionSetId: c.key,
|
|
498
|
-
permissionSetName: c.name,
|
|
499
|
-
trace: d
|
|
500
|
-
}
|
|
501
|
-
};
|
|
502
|
-
n.has(p) || (n.add(p), o.push(g)), a.push(g);
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
return [...o.filter((i) => !i.inverted), ...o.filter((i) => i.inverted)];
|
|
506
|
-
}
|
|
507
|
-
function oe(e) {
|
|
508
|
-
if (!e.source) return [];
|
|
509
|
-
const { type: t, trace: o, permissionSetName: n } = e.source;
|
|
510
|
-
if (o && o.length > 0) return o;
|
|
511
|
-
switch (t) {
|
|
512
|
-
case "permissionSet":
|
|
513
|
-
return n ? [n] : [];
|
|
514
|
-
case "custom":
|
|
515
|
-
return ["custom"];
|
|
516
|
-
default:
|
|
517
|
-
return [];
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
function H(e, t, o = /* @__PURE__ */ new Set()) {
|
|
521
|
-
var r;
|
|
522
|
-
const n = [];
|
|
523
|
-
for (const s of e) {
|
|
524
|
-
if (o.has(s)) continue;
|
|
525
|
-
o.add(s);
|
|
526
|
-
const a = t.find((i) => i.id === s);
|
|
527
|
-
a && (n.push(a), (r = a.permissionSetIds) != null && r.length && n.push(...H(a.permissionSetIds, t, o)));
|
|
528
|
-
}
|
|
529
|
-
return n;
|
|
530
|
-
}
|
|
531
|
-
function Ie(e) {
|
|
532
|
-
const t = Q(e).map(
|
|
533
|
-
({ setNames: r, setId: s, ...a }) => a
|
|
534
|
-
), o = t.filter((r) => !r.inverted), n = t.filter((r) => r.inverted);
|
|
535
|
-
return M(o, n);
|
|
536
|
-
}
|
|
537
|
-
function Ae(e, t, o) {
|
|
538
|
-
const n = /* @__PURE__ */ new Map();
|
|
539
|
-
return e.forEach(
|
|
540
|
-
({ name: r, permissions: s }) => s.forEach(({ conditions: a, actions: i }) => {
|
|
541
|
-
var c, l;
|
|
542
|
-
const u = JSON.parse(a || "{}");
|
|
543
|
-
(c = u[t]) != null && c.$in ? (l = u[t]) == null || l.$in.forEach(
|
|
544
|
-
(d) => (n.get(d) ?? n.set(d, /* @__PURE__ */ new Set()).get(d)).add(r)
|
|
545
|
-
) : i[0] === "manage" && o.forEach((d) => {
|
|
546
|
-
(n.get(d) ?? n.set(d, /* @__PURE__ */ new Set()).get(d)).add(r);
|
|
547
|
-
});
|
|
548
|
-
})
|
|
549
|
-
), [...n].map(([r, s]) => ({
|
|
550
|
-
id: r,
|
|
551
|
-
setNames: [...s]
|
|
552
|
-
}));
|
|
553
|
-
}
|
|
554
|
-
function Oe(e, t) {
|
|
555
|
-
const o = (i, u) => {
|
|
556
|
-
const c = { ...i }, l = JSON.parse(c.conditions || "{}");
|
|
557
|
-
if (u)
|
|
558
|
-
if (u.length > 0) {
|
|
559
|
-
const d = Object.keys(l)[0];
|
|
560
|
-
l[d].$in = u;
|
|
561
|
-
} else
|
|
562
|
-
delete c.conditions;
|
|
563
|
-
return {
|
|
564
|
-
...c,
|
|
565
|
-
inverted: !0,
|
|
566
|
-
...c.conditions && { conditions: JSON.stringify(l) }
|
|
567
|
-
};
|
|
568
|
-
}, n = new Map(e.map((i) => [i.subject, i])), r = new Map(t.map((i) => [i.subject, i])), s = [], a = /* @__PURE__ */ new Set([...n.keys(), ...r.keys()]);
|
|
569
|
-
for (const i of a) {
|
|
570
|
-
const u = n.get(i), c = r.get(i);
|
|
571
|
-
if (u && c) {
|
|
572
|
-
if (u.conditions && c.conditions) {
|
|
573
|
-
const l = JSON.parse(u.conditions), d = JSON.parse(c.conditions);
|
|
574
|
-
if (!y(l) || !y(d)) {
|
|
575
|
-
JSON.stringify(l) !== JSON.stringify(d) && s.push(c);
|
|
576
|
-
continue;
|
|
577
|
-
}
|
|
578
|
-
const m = Object.keys(l)[0], f = l[m].$in.filter(
|
|
579
|
-
(g) => !d[m].$in.includes(g)
|
|
580
|
-
);
|
|
581
|
-
f.length > 0 && s.push(o(u, f)), d[m].$in.filter(
|
|
582
|
-
(g) => !l[m].$in.includes(g)
|
|
583
|
-
).length > 0 && s.push(c);
|
|
584
|
-
} else if (!u.conditions && c.conditions)
|
|
585
|
-
s.push(c);
|
|
586
|
-
else if (u.conditions && !c.conditions)
|
|
587
|
-
y(JSON.parse(u.conditions)) || s.push(c);
|
|
588
|
-
else if (!u.conditions && !c.conditions) {
|
|
589
|
-
const l = new Set(u.actions), d = new Set(c.actions), m = c.actions.some((p) => !l.has(p)), f = u.actions.filter((p) => !d.has(p));
|
|
590
|
-
if (m) {
|
|
591
|
-
const p = c.actions.filter((g) => !l.has(g));
|
|
592
|
-
s.push({
|
|
593
|
-
...c,
|
|
594
|
-
actions: p
|
|
595
|
-
});
|
|
596
|
-
}
|
|
597
|
-
f.length > 0 && s.push({
|
|
598
|
-
...u,
|
|
599
|
-
actions: f,
|
|
600
|
-
inverted: !0
|
|
601
|
-
});
|
|
602
|
-
}
|
|
603
|
-
continue;
|
|
604
|
-
}
|
|
605
|
-
if (u) {
|
|
606
|
-
s.push(
|
|
607
|
-
o(
|
|
608
|
-
u,
|
|
609
|
-
// If base has conditions, set diffIds to empty array, disallow all access to collection
|
|
610
|
-
// otherwise, invert directly
|
|
611
|
-
u.conditions && []
|
|
612
|
-
)
|
|
613
|
-
);
|
|
614
|
-
continue;
|
|
615
|
-
}
|
|
616
|
-
c && s.push(c);
|
|
617
|
-
}
|
|
618
|
-
return s;
|
|
619
|
-
}
|
|
620
|
-
function _e(e) {
|
|
621
|
-
const t = G(
|
|
622
|
-
e,
|
|
623
|
-
V
|
|
624
|
-
), o = new Set(
|
|
625
|
-
t.filter((r) => {
|
|
626
|
-
var s;
|
|
627
|
-
return ((s = r.source) == null ? void 0 : s.type) === "systemPermissionSet" && !r.inverted;
|
|
628
|
-
}).map((r) => r.subject)
|
|
629
|
-
), n = new Set(
|
|
630
|
-
t.filter(
|
|
631
|
-
(r) => {
|
|
632
|
-
var s;
|
|
633
|
-
return ((s = r.source) == null ? void 0 : s.type) === "systemPermissionSet" && !r.inverted && r.actions.includes("manage");
|
|
634
|
-
}
|
|
635
|
-
).map((r) => r.subject)
|
|
636
|
-
);
|
|
637
|
-
return e.filter((r) => r.inverted ? !(o.has(r.subject) && !n.has(r.subject)) : !o.has(r.subject));
|
|
638
|
-
}
|
|
639
|
-
const re = "business::report::";
|
|
640
|
-
function Ee(e, t) {
|
|
641
|
-
const o = [], n = e.filter((r) => {
|
|
642
|
-
const s = r.subject;
|
|
643
|
-
return !s.startsWith(re) || t.has(s) ? !0 : (o.push(s), !1);
|
|
644
|
-
});
|
|
645
|
-
return o.length > 0 && console.warn("[filterStalePermissions] dropped stale report permissions:", o), n;
|
|
646
|
-
}
|
|
647
|
-
const ie = "business::report::reports::", ae = _.Subject.Business.report_reports_allDefaultReports, ce = _.Subject.Business.report_reports_allCustomReports;
|
|
648
|
-
function ue(e, t) {
|
|
649
|
-
return e.conditions ? !!t.conditions && e.conditions === t.conditions : !t.conditions;
|
|
650
|
-
}
|
|
651
|
-
function Ne(e, t) {
|
|
652
|
-
const o = e.find(
|
|
653
|
-
(a) => !a.inverted && a.subject === ae
|
|
654
|
-
), n = e.find(
|
|
655
|
-
(a) => !a.inverted && a.subject === ce
|
|
656
|
-
);
|
|
657
|
-
if (!o && !n) return e;
|
|
658
|
-
const r = o ? new Set(o.actions) : null, s = n ? new Set(n.actions) : null;
|
|
659
|
-
return e.reduce((a, i) => {
|
|
660
|
-
if (i.inverted)
|
|
661
|
-
return a.push(i), a;
|
|
662
|
-
const u = i.subject;
|
|
663
|
-
if (!u.startsWith(ie))
|
|
664
|
-
return a.push(i), a;
|
|
665
|
-
const c = t.has(u), l = c ? r : s, d = c ? o : n;
|
|
666
|
-
if (!l || !d || !ue(d, i))
|
|
667
|
-
return a.push(i), a;
|
|
668
|
-
if (l.has("manage")) return a;
|
|
669
|
-
const m = i.actions;
|
|
670
|
-
if (m.includes("manage"))
|
|
671
|
-
return a.push(i), a;
|
|
672
|
-
const f = new Set(m);
|
|
673
|
-
for (const p of l)
|
|
674
|
-
f.delete(p);
|
|
675
|
-
return f.size === 0 || a.push({ ...i, actions: Array.from(f) }), a;
|
|
676
|
-
}, []);
|
|
677
|
-
}
|
|
678
|
-
function M(e, t) {
|
|
679
|
-
var n, r;
|
|
680
|
-
const o = new Map(e.map((s) => [s.subject, s]));
|
|
681
|
-
for (const s of t) {
|
|
682
|
-
if (s.inverted) {
|
|
683
|
-
const i = o.get(s.subject);
|
|
684
|
-
if (s.conditions) {
|
|
685
|
-
if (i != null && i.conditions) {
|
|
686
|
-
const u = JSON.parse(i.conditions), c = JSON.parse(s.conditions);
|
|
687
|
-
if (!y(u) || !y(c)) {
|
|
688
|
-
o.delete(s.subject);
|
|
689
|
-
continue;
|
|
690
|
-
}
|
|
691
|
-
const l = Object.keys(c)[0], d = ((n = c[l]) == null ? void 0 : n.$in) ?? [], f = (((r = u[l]) == null ? void 0 : r.$in) ?? []).filter((p) => !d.includes(p));
|
|
692
|
-
f.length > 0 ? o.set(s.subject, {
|
|
693
|
-
...i,
|
|
694
|
-
conditions: JSON.stringify({ [l]: { $in: f } })
|
|
695
|
-
}) : o.delete(s.subject);
|
|
696
|
-
} else
|
|
697
|
-
o.delete(s.subject);
|
|
698
|
-
continue;
|
|
699
|
-
}
|
|
700
|
-
if (i) {
|
|
701
|
-
const u = new Set(s.actions), c = i.actions.filter((l) => !u.has(l));
|
|
702
|
-
c.length > 0 ? o.set(s.subject, { ...i, actions: c }) : o.delete(s.subject);
|
|
703
|
-
continue;
|
|
704
|
-
}
|
|
705
|
-
continue;
|
|
706
|
-
}
|
|
707
|
-
if (s.conditions) {
|
|
708
|
-
o.set(s.subject, s);
|
|
709
|
-
continue;
|
|
710
|
-
}
|
|
711
|
-
const a = o.get(s.subject);
|
|
712
|
-
if (a != null && a.conditions && !y(JSON.parse(a.conditions))) {
|
|
713
|
-
o.set(s.subject, s);
|
|
714
|
-
continue;
|
|
715
|
-
}
|
|
716
|
-
if (a) {
|
|
717
|
-
const i = [
|
|
718
|
-
.../* @__PURE__ */ new Set([
|
|
719
|
-
...a.actions,
|
|
720
|
-
...s.actions
|
|
721
|
-
])
|
|
722
|
-
];
|
|
723
|
-
o.set(s.subject, { ...a, actions: i });
|
|
724
|
-
} else
|
|
725
|
-
o.set(s.subject, s);
|
|
726
|
-
}
|
|
727
|
-
return Array.from(o.values());
|
|
728
|
-
}
|
|
729
|
-
function le(e, t) {
|
|
730
|
-
const o = M(e, t), n = new Set(e.map((s) => s.subject)), r = t.filter(
|
|
731
|
-
(s) => s.inverted && !n.has(s.subject)
|
|
732
|
-
);
|
|
733
|
-
return [...o, ...r];
|
|
734
|
-
}
|
|
735
|
-
const P = "/permission-assignments", R = {
|
|
736
|
-
async readAll() {
|
|
737
|
-
return b(await v().get(P));
|
|
738
|
-
},
|
|
739
|
-
async readByUserId(e) {
|
|
740
|
-
return b(await v().get(`${P}/user/${e}`));
|
|
741
|
-
},
|
|
742
|
-
async readById(e) {
|
|
743
|
-
return b(await v().get(`${P}/${e}`));
|
|
744
|
-
},
|
|
745
|
-
async create(e) {
|
|
746
|
-
return b(await v().post(P, e));
|
|
747
|
-
},
|
|
748
|
-
async update(e, t) {
|
|
749
|
-
return b(await v().put(`${P}/${e}`, t));
|
|
750
|
-
},
|
|
751
|
-
async delete(e) {
|
|
752
|
-
return b(await v().delete(`${P}/${e}`));
|
|
753
|
-
},
|
|
754
|
-
async addReportManagePermission(e, t) {
|
|
755
|
-
return b(
|
|
756
|
-
await v().post("/my-permissions/report-manage", { permissionKey: e, label: t })
|
|
757
|
-
);
|
|
758
|
-
}
|
|
759
|
-
}, de = z("permissionAssignment", () => {
|
|
760
|
-
const e = S([]);
|
|
761
|
-
async function t() {
|
|
762
|
-
const i = await R.readAll();
|
|
763
|
-
e.value = i;
|
|
764
|
-
}
|
|
765
|
-
async function o(i) {
|
|
766
|
-
return await R.readByUserId(i);
|
|
767
|
-
}
|
|
768
|
-
async function n(i) {
|
|
769
|
-
const u = await R.create(i);
|
|
770
|
-
e.value = [...e.value, u];
|
|
771
|
-
}
|
|
772
|
-
async function r(i, u) {
|
|
773
|
-
const c = await R.update(i, u);
|
|
774
|
-
e.value = e.value.map((l) => l.id === i ? c : l);
|
|
775
|
-
}
|
|
776
|
-
async function s(i) {
|
|
777
|
-
await R.delete(i), e.value = e.value.filter((u) => u.id !== i);
|
|
778
|
-
}
|
|
779
|
-
function a(i) {
|
|
780
|
-
return e.value.find((u) => u.userId === i);
|
|
781
|
-
}
|
|
782
|
-
return {
|
|
783
|
-
permissionAssignments: e,
|
|
784
|
-
readPermissionAssignments: t,
|
|
785
|
-
readPermissionAssignmentByUserId: o,
|
|
786
|
-
createPermissionAssignment: n,
|
|
787
|
-
updatePermissionAssignment: r,
|
|
788
|
-
deletePermissionAssignment: s,
|
|
789
|
-
getPermissionAssignmentByUserId: a
|
|
790
|
-
};
|
|
791
|
-
}), me = () => {
|
|
792
|
-
const e = de();
|
|
793
|
-
return {
|
|
794
|
-
...e,
|
|
795
|
-
...K(e)
|
|
796
|
-
};
|
|
797
|
-
}, fe = {
|
|
798
|
-
async fetchReportPermissions(e, t) {
|
|
799
|
-
const o = t ? { lang: t } : {};
|
|
800
|
-
return b(
|
|
801
|
-
await x().get(`/report-query/hrm/${e}/reports`, { params: o })
|
|
802
|
-
);
|
|
803
|
-
},
|
|
804
|
-
async fetchReportPermissionsForPortal(e, t) {
|
|
805
|
-
const o = t ? { isSupportPos: !1, lang: t } : { isSupportPos: !1 };
|
|
806
|
-
return b(
|
|
807
|
-
await x().get(`/report-query/hrm/${e}/reports`, { params: o })
|
|
808
|
-
);
|
|
809
|
-
}
|
|
810
|
-
}, C = S([]), T = S(!1), $ = S(!1), I = S(null), D = S(null), J = S(!1);
|
|
811
|
-
function pe() {
|
|
812
|
-
const e = X();
|
|
813
|
-
async function t() {
|
|
814
|
-
var s;
|
|
815
|
-
const n = (s = e.currentBusiness.value) == null ? void 0 : s.id;
|
|
816
|
-
if (!n) return;
|
|
817
|
-
const r = localStorage.getItem("locale");
|
|
818
|
-
if (I.value !== n && (C.value = [], T.value = !1, $.value = !1, I.value = n, J.value = !1), !(T.value && D.value === r)) {
|
|
819
|
-
if ($.value) {
|
|
820
|
-
J.value = !0;
|
|
821
|
-
return;
|
|
822
|
-
}
|
|
823
|
-
$.value = !0;
|
|
824
|
-
try {
|
|
825
|
-
const a = await fe.fetchReportPermissionsForPortal(n, r);
|
|
826
|
-
if (I.value !== n) return;
|
|
827
|
-
C.value = a, T.value = !0, D.value = r;
|
|
828
|
-
} catch (a) {
|
|
829
|
-
if (I.value !== n) return;
|
|
830
|
-
console.warn("Failed to fetch custom report permissions:", a), C.value = [];
|
|
831
|
-
} finally {
|
|
832
|
-
I.value === n && ($.value = !1, J.value && (J.value = !1, await t()));
|
|
833
|
-
}
|
|
834
|
-
}
|
|
835
|
-
}
|
|
836
|
-
const o = U(() => C.value.map(
|
|
837
|
-
(n) => n.isDefault ? {
|
|
838
|
-
label: n.name,
|
|
839
|
-
subject: `business::report::reports::${n.permissionKey}`,
|
|
840
|
-
actions: [j.manage, j.read, j.create],
|
|
841
|
-
category: F.reports
|
|
842
|
-
} : {
|
|
843
|
-
label: n.name,
|
|
844
|
-
subject: `business::report::reports::${n.permissionKey}`,
|
|
845
|
-
actions: [
|
|
846
|
-
j.manage,
|
|
847
|
-
j.read,
|
|
848
|
-
j.create,
|
|
849
|
-
j.update,
|
|
850
|
-
j.delete
|
|
851
|
-
],
|
|
852
|
-
category: F.customReports
|
|
853
|
-
}
|
|
854
|
-
));
|
|
855
|
-
return {
|
|
856
|
-
fetchCustomReportPermissions: t,
|
|
857
|
-
customReportPermissions: o,
|
|
858
|
-
isLoading: U(() => $.value),
|
|
859
|
-
isLoaded: U(() => T.value)
|
|
860
|
-
};
|
|
861
|
-
}
|
|
862
|
-
function A(e) {
|
|
863
|
-
const t = ne(), o = me(), n = te().restaurants, { customReportPermissions: r } = pe(), s = o.getPermissionAssignmentByUserId(e.id), a = H(
|
|
864
|
-
(s == null ? void 0 : s.permissionSetIds) ?? [],
|
|
865
|
-
t.permissionSets.value
|
|
866
|
-
), i = Q(a).map(
|
|
867
|
-
({ setNames: p, ...g }) => g
|
|
868
|
-
), u = s == null ? void 0 : s.customPermissions, c = u ?? e.permissions.map((p) => ({
|
|
869
|
-
...p,
|
|
870
|
-
subject: O(p.subject)
|
|
871
|
-
})), l = M(i, c), d = G(
|
|
872
|
-
le(i, c),
|
|
873
|
-
V
|
|
874
|
-
).filter((p) => !p.inverted), m = ve(d), f = m ?? n.value.map((p) => p._id);
|
|
875
|
-
return {
|
|
876
|
-
doc: e,
|
|
877
|
-
id: e.id,
|
|
878
|
-
name: e.name && e.name !== e.email && e.name !== e.phoneNumber ? e.name : "-",
|
|
879
|
-
phoneNumber: e.phoneNumber,
|
|
880
|
-
email: e.email,
|
|
881
|
-
restaurants: W(
|
|
882
|
-
f.map((p) => {
|
|
883
|
-
var g;
|
|
884
|
-
return ((g = n.value.find((Y) => Y._id === p)) == null ? void 0 : g.profile.name) ?? "";
|
|
885
|
-
})
|
|
886
|
-
),
|
|
887
|
-
managableRestaurantIds: m,
|
|
888
|
-
permissionLabels: Se(d, r.value),
|
|
889
|
-
permissions: l
|
|
890
|
-
};
|
|
891
|
-
}
|
|
892
|
-
const be = Object.freeze(
|
|
893
|
-
Object.values(q)
|
|
894
|
-
), Ce = {
|
|
895
|
-
async readTeamMembers() {
|
|
896
|
-
return b(
|
|
897
|
-
await v().get("/portal-users")
|
|
898
|
-
).map(A);
|
|
899
|
-
},
|
|
900
|
-
async readTeamMembersPage(e) {
|
|
901
|
-
var o, n, r;
|
|
902
|
-
const t = b(
|
|
903
|
-
await v().get("/portal-users/paged", {
|
|
904
|
-
params: {
|
|
905
|
-
limit: e.limit,
|
|
906
|
-
offset: e.offset,
|
|
907
|
-
search: e.search,
|
|
908
|
-
restaurantIds: (o = e.restaurantIds) != null && o.length ? e.restaurantIds : void 0,
|
|
909
|
-
permissionSubjects: (n = e.permissionSubjects) != null && n.length ? e.permissionSubjects : void 0,
|
|
910
|
-
permissionSetIds: (r = e.permissionSetIds) != null && r.length ? e.permissionSetIds : void 0
|
|
911
|
-
}
|
|
912
|
-
})
|
|
913
|
-
);
|
|
914
|
-
return {
|
|
915
|
-
items: t.items.map(A),
|
|
916
|
-
total: t.total
|
|
917
|
-
};
|
|
918
|
-
},
|
|
919
|
-
async readTeamMember(e) {
|
|
920
|
-
return A(
|
|
921
|
-
b(await v().get(`/portal-users/${e}`))
|
|
922
|
-
);
|
|
923
|
-
},
|
|
924
|
-
async createTeamMember(e) {
|
|
925
|
-
return A(
|
|
926
|
-
b(await v().post("/portal-users", e))
|
|
927
|
-
);
|
|
928
|
-
},
|
|
929
|
-
async updateTeamMember(e, t) {
|
|
930
|
-
return A(
|
|
931
|
-
b(await v().put(`/portal-users/${e}`, t))
|
|
932
|
-
);
|
|
933
|
-
},
|
|
934
|
-
async deleteTeamMember(e) {
|
|
935
|
-
return b(await v().delete(`/portal-users/${e}`));
|
|
936
|
-
},
|
|
937
|
-
async readTeamMemberPosUserIds() {
|
|
938
|
-
return b(await v().get("/portal-users")).map((t) => t.posUserId);
|
|
939
|
-
}
|
|
940
|
-
};
|
|
941
|
-
function Te(e, t, o) {
|
|
942
|
-
if (e.some((a) => a.subject === "all")) return "All";
|
|
943
|
-
const n = (o ?? L).filter(
|
|
944
|
-
(a) => a.subject === t
|
|
945
|
-
), r = new Set(n.map((a) => w(a).value)), s = e.filter((a) => a.subject === t).filter((a) => r.has(w(a).value));
|
|
946
|
-
return s.length === n.length ? "All" : s.length === 0 ? "-" : `${s.length} permission allow`;
|
|
947
|
-
}
|
|
948
|
-
function w(e) {
|
|
949
|
-
const t = Z(e), o = t.subject;
|
|
950
|
-
return {
|
|
951
|
-
...t,
|
|
952
|
-
get conditions() {
|
|
953
|
-
if (typeof t.conditions != "string") return t.conditions;
|
|
954
|
-
try {
|
|
955
|
-
return JSON.parse(t.conditions);
|
|
956
|
-
} catch {
|
|
957
|
-
return;
|
|
958
|
-
}
|
|
959
|
-
},
|
|
960
|
-
get isDiscountOperation() {
|
|
961
|
-
var n;
|
|
962
|
-
return o === h.F_RULE_SUBJECT.enum.order && ((n = this.conditions) == null ? void 0 : n.operation) === h.F_RULE_ORDER_OPERATION.enum.discount;
|
|
963
|
-
},
|
|
964
|
-
get isOrderOperation() {
|
|
965
|
-
return o === h.F_RULE_SUBJECT.enum.order;
|
|
966
|
-
},
|
|
967
|
-
get isReportPermission() {
|
|
968
|
-
return o === h.F_RULE_SUBJECT.enum.report;
|
|
969
|
-
},
|
|
970
|
-
/**
|
|
971
|
-
* Order and report rules are only meaningful together with the condition
|
|
972
|
-
* that names them. A rule missing it cannot be rendered or matched against
|
|
973
|
-
* the available permission list, so callers must preserve it verbatim —
|
|
974
|
-
* see `splitRoleFormPermissions`, which routes it to `passthrough`, not
|
|
975
|
-
* `dropped`. Dropping it would silently revoke a grant the portal cannot
|
|
976
|
-
* display (HRM-0027).
|
|
977
|
-
*/
|
|
978
|
-
get isResolvable() {
|
|
979
|
-
return this.discriminator !== void 0;
|
|
980
|
-
},
|
|
981
|
-
/**
|
|
982
|
-
* The condition value that identifies this rule, if the subject needs one.
|
|
983
|
-
* An empty condition counts as missing: `{ name: '' }` is a known corrupted
|
|
984
|
-
* shape that used to resolve to the first hardcoded report permission on
|
|
985
|
-
* save (HRM-0027), so it must not look resolvable here either.
|
|
986
|
-
*/
|
|
987
|
-
get discriminator() {
|
|
988
|
-
var n, r;
|
|
989
|
-
return this.isOrderOperation ? ((n = this.conditions) == null ? void 0 : n.operation) || void 0 : this.isReportPermission ? ((r = this.conditions) == null ? void 0 : r.name) || void 0 : o.toString();
|
|
990
|
-
},
|
|
991
|
-
get formatted() {
|
|
992
|
-
const n = this.discriminator;
|
|
993
|
-
return n === void 0 ? o.toString() : n.endsWith("_") ? n.slice(0, n.length - 1) : n;
|
|
994
|
-
},
|
|
995
|
-
get label() {
|
|
996
|
-
return t.label || ee(this.formatted);
|
|
997
|
-
},
|
|
998
|
-
get value() {
|
|
999
|
-
const n = this.discriminator;
|
|
1000
|
-
return this.isOrderOperation || this.isReportPermission ? n === void 0 ? o.toString() : `${o}:${n}` : o.toString();
|
|
1001
|
-
}
|
|
1002
|
-
};
|
|
1003
|
-
}
|
|
1004
|
-
function Je(e) {
|
|
1005
|
-
var n, r;
|
|
1006
|
-
const t = e.map((s) => w(s)).find((s) => s.isDiscountOperation);
|
|
1007
|
-
if (!t) return 100;
|
|
1008
|
-
const o = Number((r = (n = t.conditions) == null ? void 0 : n.adjustment) == null ? void 0 : r.$lte);
|
|
1009
|
-
return Number.isFinite(o) ? parseInt((o * 100).toFixed(0)) : 0;
|
|
1010
|
-
}
|
|
1011
|
-
function ve(e) {
|
|
1012
|
-
const t = e.find(
|
|
1013
|
-
(o) => o.subject === _.Subject.Restaurant.restaurant
|
|
1014
|
-
);
|
|
1015
|
-
return t ? t.conditions ? JSON.parse(t.conditions).restaurantId.$in : null : [];
|
|
1016
|
-
}
|
|
1017
|
-
function Ue(e) {
|
|
1018
|
-
return (e == null ? void 0 : e.some((t) => t.subject === "all")) ?? !1;
|
|
1019
|
-
}
|
|
1020
|
-
function Be(e) {
|
|
1021
|
-
const t = e.find((o) => o.subject === _.Subject.Business.role);
|
|
1022
|
-
return t ? t.conditions ? JSON.parse(t.conditions).roleId.$in : null : [];
|
|
1023
|
-
}
|
|
1024
|
-
function Le(e) {
|
|
1025
|
-
const t = w(e);
|
|
1026
|
-
if (!t.isReportPermission) return;
|
|
1027
|
-
const { name: o, ...n } = t.conditions ?? {};
|
|
1028
|
-
return Object.keys(n).length > 0 ? n : void 0;
|
|
1029
|
-
}
|
|
1030
|
-
function Me(e, t, o) {
|
|
1031
|
-
return e.flatMap((n) => {
|
|
1032
|
-
const r = ge(n);
|
|
1033
|
-
if (!r) return [];
|
|
1034
|
-
const s = r.isReportPermission ? o == null ? void 0 : o.get(n) : void 0;
|
|
1035
|
-
return [
|
|
1036
|
-
{
|
|
1037
|
-
subject: r.subject,
|
|
1038
|
-
actions: r.actions,
|
|
1039
|
-
conditions: {
|
|
1040
|
-
...r.conditions,
|
|
1041
|
-
...s ?? {},
|
|
1042
|
-
adjustment: r.isDiscountOperation ? { $lte: parseFloat((t / 100).toFixed(2)) } : void 0
|
|
1043
|
-
}
|
|
1044
|
-
}
|
|
1045
|
-
];
|
|
1046
|
-
});
|
|
1047
|
-
}
|
|
1048
|
-
function ge(e) {
|
|
1049
|
-
const t = e.indexOf(":"), o = t === -1 ? e : e.slice(0, t), n = t === -1 ? void 0 : e.slice(t + 1);
|
|
1050
|
-
if (t !== -1 && !n) return;
|
|
1051
|
-
let r;
|
|
1052
|
-
return n ? (r = L.find((s) => {
|
|
1053
|
-
if (s.subject !== o) return !1;
|
|
1054
|
-
const a = typeof s.conditions == "string" ? JSON.parse(s.conditions) : s.conditions;
|
|
1055
|
-
return [a == null ? void 0 : a.operation, a == null ? void 0 : a.name].includes(n);
|
|
1056
|
-
}), !r && o === h.F_RULE_SUBJECT.enum.report && (r = {
|
|
1057
|
-
label: "",
|
|
1058
|
-
subject: h.F_RULE_SUBJECT.enum.report,
|
|
1059
|
-
actions: ["read"],
|
|
1060
|
-
conditions: { name: n },
|
|
1061
|
-
inverted: !1,
|
|
1062
|
-
reason: ""
|
|
1063
|
-
})) : r = L.find((s) => s.subject === o), r ? w(r) : void 0;
|
|
1064
|
-
}
|
|
1065
|
-
function Fe(e, t) {
|
|
1066
|
-
const o = { values: [], passthrough: [], dropped: [] };
|
|
1067
|
-
for (const n of e) {
|
|
1068
|
-
const r = n == null ? void 0 : n.actions;
|
|
1069
|
-
if (typeof (n == null ? void 0 : n.subject) != "string" || n.subject.trim().length === 0 || !Array.isArray(r) || r.length === 0 || r.some((u) => typeof u != "string" || u.trim().length === 0)) {
|
|
1070
|
-
o.dropped.push(n);
|
|
1071
|
-
continue;
|
|
1072
|
-
}
|
|
1073
|
-
const s = w(n).value, a = `${h.F_RULE_SUBJECT.enum.report}:`, i = s.startsWith(a) ? s.slice(a.length) : "";
|
|
1074
|
-
t.has(s) || i && i !== "undefined" ? o.values.push(s) : o.passthrough.push(n);
|
|
1075
|
-
}
|
|
1076
|
-
return o;
|
|
1077
|
-
}
|
|
1078
|
-
function Se(e, t = []) {
|
|
1079
|
-
return W(
|
|
1080
|
-
e.reduce((o, n) => {
|
|
1081
|
-
const r = be.find(
|
|
1082
|
-
(s) => s.subject === n.subject && n.actions.includes("manage")
|
|
1083
|
-
) || t.find((s) => s.subject === n.subject);
|
|
1084
|
-
if (r) {
|
|
1085
|
-
const s = r.subject === _.Subject.Business.inventory_stock ? "Warehouse Management" : r.label;
|
|
1086
|
-
o.push(s);
|
|
1087
|
-
}
|
|
1088
|
-
return o;
|
|
1089
|
-
}, [])
|
|
1090
|
-
);
|
|
1091
|
-
}
|
|
1092
|
-
export {
|
|
1093
|
-
G as N,
|
|
1094
|
-
Q as P,
|
|
1095
|
-
fe as R,
|
|
1096
|
-
Le as a,
|
|
1097
|
-
Te as b,
|
|
1098
|
-
H as c,
|
|
1099
|
-
le as d,
|
|
1100
|
-
L as e,
|
|
1101
|
-
Me as f,
|
|
1102
|
-
Je as g,
|
|
1103
|
-
Ue as h,
|
|
1104
|
-
pe as i,
|
|
1105
|
-
re as j,
|
|
1106
|
-
Be as k,
|
|
1107
|
-
ve as l,
|
|
1108
|
-
Ie as m,
|
|
1109
|
-
_e as n,
|
|
1110
|
-
Oe as o,
|
|
1111
|
-
be as p,
|
|
1112
|
-
Ee as q,
|
|
1113
|
-
w as r,
|
|
1114
|
-
Fe as s,
|
|
1115
|
-
Ce as t,
|
|
1116
|
-
ne as u,
|
|
1117
|
-
Ne as v,
|
|
1118
|
-
me as w,
|
|
1119
|
-
Se as x,
|
|
1120
|
-
Ae as y
|
|
1121
|
-
};
|