@feedmepos/mf-hrm-portal 2.1.1-dev.6 → 2.1.1-dev.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/dist/ApprovalCodeList-CQApO-t4.js +728 -0
  2. package/dist/{AuditLogList-DrrL4vf4.js → AuditLogList-DH2ZvAVE.js} +3 -3
  3. package/dist/{ConditionFormHost.vue_vue_type_script_setup_true_lang-CBjO1MZo.js → ConditionFormHost.vue_vue_type_script_setup_true_lang-B5OgqCR0.js} +2 -2
  4. package/dist/{EmployeeList-BMol4ah4.js → EmployeeList-B1Q4RH2r.js} +4 -4
  5. package/dist/{GrantUserList-CLBl7FZ-.js → GrantUserList-DURXYzRs.js} +3 -3
  6. package/dist/{Main-D_LwrBdZ.js → Main-B06aoNy1.js} +9 -9
  7. package/dist/{Main-DNOHZd3j.js → Main-BC7IPhbz.js} +5 -5
  8. package/dist/Main-BRrcfqXc.js +121 -0
  9. package/dist/{PermissionSetList-DLYrXFbz.js → PermissionSetList-CiVFvnlW.js} +5 -5
  10. package/dist/{PortalPermissionEditor.vue_vue_type_script_setup_true_lang-Drcx0tL_.js → PortalPermissionEditor.vue_vue_type_script_setup_true_lang-BAmLIGEn.js} +805 -805
  11. package/dist/{RoleList-g8PjH_k2.js → RoleList-BVFWURdS.js} +7 -7
  12. package/dist/{TeamMemberList-B9aCagSc.js → TeamMemberList-DlurP2WR.js} +6 -6
  13. package/dist/{TimesheetList-C1IJhOYE.js → TimesheetList-C4G2Va4m.js} +5 -5
  14. package/dist/{TimesheetList.vue_vue_type_style_index_0_scoped_2c7a177a_lang-CqtiVm1j.js → TimesheetList.vue_vue_type_style_index_0_scoped_2c7a177a_lang-BJujYg6e.js} +2 -2
  15. package/dist/{app-DnOYVjuj.js → app-CGL_lSgW.js} +50 -35
  16. package/dist/app.js +1 -1
  17. package/dist/{dayjs.min-Dxul0qTK.js → dayjs.min-BXDtus8O.js} +1 -1
  18. package/dist/{employee-sr65CZR7.js → employee-CVZUQI_y.js} +3 -3
  19. package/dist/{iteration-DIqDMvFa.js → iteration-BXcl549C.js} +1 -1
  20. package/dist/{lodash-CXlqXFmD.js → lodash-CmrNrQXn.js} +1 -1
  21. package/dist/{role-CE3NY-63.js → role-Ct8MPQeS.js} +1 -1
  22. package/dist/{rule-CEjrit6c.js → rule-M8SC_Jhl.js} +2 -2
  23. package/dist/src/types/approval-code.d.ts +29 -48
  24. package/dist/tsconfig.app.tsbuildinfo +1 -1
  25. package/dist/{useReportPermissions-FVW_HwcL.js → useReportPermissions-COONOIe1.js} +3 -3
  26. package/package.json +1 -1
  27. package/dist/ApprovalCodeList-B1XHbhum.js +0 -757
  28. package/dist/Main-auigiuVZ.js +0 -122
@@ -1,16 +1,16 @@
1
1
  import { computed as R, defineComponent as we, ref as D, watch as oe, onMounted as ke, resolveComponent as F, createBlock as j, openBlock as c, unref as o, withCtx as b, createElementVNode as n, createVNode as u, createElementBlock as C, Fragment as E, createCommentVNode as re, renderList as Q, toDisplayString as U, normalizeClass as ze, h as B, createTextVNode as pe, resolveDynamicComponent as xe, withModifiers as Ke, nextTick as Ce } from "vue";
2
- import { e as L } from "./iteration-DIqDMvFa.js";
2
+ import { e as L } from "./iteration-BXcl549C.js";
3
3
  import { useI18n as Ve } from "@feedmepos/mf-common";
4
4
  import { useSnackbar as Se, components as ve, useDialog as Ne, useBreakpoints as Oe, FmButtonColorThemeVariant as Je } from "@feedmepos/ui-library";
5
- import { k as qe, A as We, S as Ge, _ as He } from "./app-DnOYVjuj.js";
5
+ import { k as qe, A as We, S as Ge, _ as He } from "./app-CGL_lSgW.js";
6
6
  import { u as Qe, _ as Fe } from "./useDiscardConfirm-DPhEV6v0.js";
7
7
  import { _ as Xe } from "./TableEmptyState.vue_vue_type_script_setup_true_lang-IfAZmWr0.js";
8
- import { e as Ye, r as W, h as Ue, f as Ze, g as Re, a as es, b as ne } from "./rule-CEjrit6c.js";
8
+ import { e as Ye, r as W, h as Ue, f as Ze, g as Re, a as es, b as ne } from "./rule-M8SC_Jhl.js";
9
9
  import { u as _e } from "./restaurant-YOVMuuFY.js";
10
- import { u as $e } from "./role-CE3NY-63.js";
11
- import { u as Ee } from "./useReportPermissions-FVW_HwcL.js";
12
- import { l as ie } from "./lodash-CXlqXFmD.js";
13
- import { u as ss, _ as ts, a as as } from "./ConditionFormHost.vue_vue_type_script_setup_true_lang-CBjO1MZo.js";
10
+ import { u as $e } from "./role-Ct8MPQeS.js";
11
+ import { u as Ee } from "./useReportPermissions-COONOIe1.js";
12
+ import { l as ie } from "./lodash-CmrNrQXn.js";
13
+ import { u as ss, _ as ts, a as as } from "./ConditionFormHost.vue_vue_type_script_setup_true_lang-B5OgqCR0.js";
14
14
  import { _ as fe } from "./FormSection.vue_vue_type_script_setup_true_lang-DknXTYiK.js";
15
15
  import { u as ls } from "./useLoading-BH02lYns.js";
16
16
  function os() {
@@ -3,17 +3,17 @@ import { useI18n as Pe, useCoreStore as Ae, baseClientInstance as Ke } from "@fe
3
3
  import { useSnackbar as He, useDialog as es, useBreakpoints as ss, components as je } from "@feedmepos/ui-library";
4
4
  import { u as fs, _ as vs } from "./useDebounce-CWb5QR9G.js";
5
5
  import { _ as bs, S as ye } from "./SelectFilter-ATOm0hdn.js";
6
- import { v as ze, m as hs, b as ys, _ as _s, a as gs } from "./app-DnOYVjuj.js";
6
+ import { v as ze, m as hs, b as ys, _ as _s, a as gs } from "./app-CGL_lSgW.js";
7
7
  import { u as xs, _ as Us } from "./useDiscardConfirm-DPhEV6v0.js";
8
8
  import { _ as Ss } from "./TableEmptyState.vue_vue_type_script_setup_true_lang-IfAZmWr0.js";
9
9
  import { u as Fs } from "./useLoading-BH02lYns.js";
10
- import { l as Se } from "./lodash-CXlqXFmD.js";
11
- import { c as he } from "./iteration-DIqDMvFa.js";
12
- import { u as ts, c as Le, d as Ge, m as Me, i as as, p as We, j as Vs, k as Je, l as Xe, s as ws, n as Is, o as Ps, q as ks, v as Rs, t as Fe } from "./rule-CEjrit6c.js";
13
- import { u as ls } from "./role-CE3NY-63.js";
10
+ import { l as Se } from "./lodash-CmrNrQXn.js";
11
+ import { c as he } from "./iteration-BXcl549C.js";
12
+ import { u as ts, c as Le, d as Ge, m as Me, i as as, p as We, j as Vs, k as Je, l as Xe, s as ws, n as Is, o as Ps, q as ks, v as Rs, t as Fe } from "./rule-M8SC_Jhl.js";
13
+ import { u as ls } from "./role-Ct8MPQeS.js";
14
14
  import { u as os, i as $s } from "./PortalUserSearcher.vue_vue_type_style_index_0_scoped_827dfd60_lang-DVVSBIx2.js";
15
15
  import { g as Ze, u as rs } from "./restaurant-YOVMuuFY.js";
16
- import { _ as Cs } from "./PortalPermissionEditor.vue_vue_type_script_setup_true_lang-Drcx0tL_.js";
16
+ import { _ as Cs } from "./PortalPermissionEditor.vue_vue_type_script_setup_true_lang-BAmLIGEn.js";
17
17
  var ge = /* @__PURE__ */ ((i) => (i.Update = "Update", i.Remove = "Remove", i))(ge || {});
18
18
  const we = "__unassigned__";
19
19
  function Qe(i) {
@@ -1,16 +1,16 @@
1
1
  import { ref as d, computed as g, defineComponent as pe, onMounted as fe, watch as Z, resolveComponent as u, createElementBlock as P, openBlock as E, Fragment as ee, createVNode as l, createElementVNode as i, unref as r, withCtx as b, createCommentVNode as ve, toDisplayString as O, createTextVNode as he, isRef as ge, renderList as we, createBlock as te, nextTick as ye } from "vue";
2
- import { d as v } from "./dayjs.min-Dxul0qTK.js";
2
+ import { d as v } from "./dayjs.min-BXDtus8O.js";
3
3
  import { useI18n as _e } from "@feedmepos/mf-common";
4
4
  import { useSnackbar as be, components as xe } from "@feedmepos/ui-library";
5
5
  import { S as De, _ as Se } from "./SelectFilter-ATOm0hdn.js";
6
- import { _ as Ve } from "./app-DnOYVjuj.js";
6
+ import { _ as Ve } from "./app-CGL_lSgW.js";
7
7
  import { _ as ke } from "./TableEmptyState.vue_vue_type_script_setup_true_lang-IfAZmWr0.js";
8
8
  import { u as Ce } from "./useLoading-BH02lYns.js";
9
- import { g as Fe, s as Ye } from "./iteration-DIqDMvFa.js";
9
+ import { g as Fe, s as Ye } from "./iteration-BXcl549C.js";
10
10
  import { f as Le } from "./utils-BZkjJbju.js";
11
- import { u as Me } from "./employee-sr65CZR7.js";
11
+ import { u as Me } from "./employee-CVZUQI_y.js";
12
12
  import { u as Te } from "./restaurant-YOVMuuFY.js";
13
- import { u as Re } from "./TimesheetList.vue_vue_type_style_index_0_scoped_2c7a177a_lang-CqtiVm1j.js";
13
+ import { u as Re } from "./TimesheetList.vue_vue_type_style_index_0_scoped_2c7a177a_lang-BJujYg6e.js";
14
14
  function Ie(x, a) {
15
15
  return ["years", "months"].find((S) => {
16
16
  const V = x.startOf(S), m = x.endOf(S);
@@ -1,8 +1,8 @@
1
- import { d as i } from "./dayjs.min-Dxul0qTK.js";
1
+ import { d as i } from "./dayjs.min-BXDtus8O.js";
2
2
  import { defineStore as p, storeToRefs as T } from "pinia";
3
3
  import { ref as l } from "vue";
4
4
  import { b as c, g as y } from "./restaurant-YOVMuuFY.js";
5
- import { s as S } from "./iteration-DIqDMvFa.js";
5
+ import { s as S } from "./iteration-BXcl549C.js";
6
6
  import { i as f, f as g } from "./utils-BZkjJbju.js";
7
7
  const u = {
8
8
  async readTimesheets(t, e) {
@@ -113,7 +113,7 @@ const x = Z.arrayToEnum([
113
113
  "invalid_intersection_types",
114
114
  "not_multiple_of"
115
115
  ]), ea = (e) => JSON.stringify(e, null, 2).replace(/"([^"]+)":/g, "$1:");
116
- class Fe extends Error {
116
+ class qe extends Error {
117
117
  constructor(t) {
118
118
  super(), this.issues = [], this.addIssue = (r) => {
119
119
  this.issues = [...this.issues, r];
@@ -168,7 +168,7 @@ class Fe extends Error {
168
168
  return this.flatten();
169
169
  }
170
170
  }
171
- Fe.create = (e) => new Fe(e);
171
+ qe.create = (e) => new qe(e);
172
172
  const Bt = (e, t) => {
173
173
  let s;
174
174
  switch (e.code) {
@@ -317,7 +317,7 @@ const Ls = (e, t) => {
317
317
  return { success: !0, data: t.value };
318
318
  if (!e.common.issues.length)
319
319
  throw new Error("Validation failed but no issues detected.");
320
- return { success: !1, error: new Fe(e.common.issues) };
320
+ return { success: !1, error: new qe(e.common.issues) };
321
321
  };
322
322
  function Q(e) {
323
323
  if (!e)
@@ -1291,7 +1291,7 @@ class wt extends X {
1291
1291
  for (const l of a)
1292
1292
  if (l.result.status === "dirty")
1293
1293
  return s.common.issues.push(...l.ctx.common.issues), l.result;
1294
- const c = a.map((l) => new Fe(l.ctx.common.issues));
1294
+ const c = a.map((l) => new qe(l.ctx.common.issues));
1295
1295
  return Y(s, {
1296
1296
  code: C.invalid_union,
1297
1297
  unionErrors: c
@@ -1338,7 +1338,7 @@ class wt extends X {
1338
1338
  }
1339
1339
  if (a)
1340
1340
  return s.common.issues.push(...a.ctx.common.issues), a.result;
1341
- const l = c.map((y) => new Fe(y));
1341
+ const l = c.map((y) => new qe(y));
1342
1342
  return Y(s, {
1343
1343
  code: C.invalid_union,
1344
1344
  unionErrors: l
@@ -1713,7 +1713,7 @@ class Le extends X {
1713
1713
  }
1714
1714
  const a = { errorMap: s.common.contextualErrorMap }, c = s.data;
1715
1715
  return this._def.returns instanceof ot ? oe(async (...l) => {
1716
- const y = new Fe([]), h = await this._def.args.parseAsync(l, a).catch((N) => {
1716
+ const y = new qe([]), h = await this._def.args.parseAsync(l, a).catch((N) => {
1717
1717
  throw y.addIssue(r(l, N)), y;
1718
1718
  }), B = await c(...h);
1719
1719
  return await this._def.returns._def.type.parseAsync(B, a).catch((N) => {
@@ -1722,10 +1722,10 @@ class Le extends X {
1722
1722
  }) : oe((...l) => {
1723
1723
  const y = this._def.args.safeParse(l, a);
1724
1724
  if (!y.success)
1725
- throw new Fe([r(l, y.error)]);
1725
+ throw new qe([r(l, y.error)]);
1726
1726
  const h = c(...y.data), B = this._def.returns.safeParse(h, a);
1727
1727
  if (!B.success)
1728
- throw new Fe([n(h, B.error)]);
1728
+ throw new qe([n(h, B.error)]);
1729
1729
  return B.data;
1730
1730
  });
1731
1731
  }
@@ -2145,7 +2145,7 @@ var ft = /* @__PURE__ */ Object.freeze({
2145
2145
  void: ya,
2146
2146
  ZodIssueCode: C,
2147
2147
  quotelessJson: ea,
2148
- ZodError: Fe,
2148
+ ZodError: qe,
2149
2149
  defaultErrorMap: Bt,
2150
2150
  setErrorMap: ta,
2151
2151
  getErrorMap: Vt
@@ -7277,7 +7277,7 @@ const nc = {
7277
7277
  permissions: rc
7278
7278
  }
7279
7279
  };
7280
- var He = /* @__PURE__ */ ((e) => (e.hrm_posRole = "hrm::posRole", e.hrm_portalUsers = "hrm::portalUsers", e.hrm_restaurant = "hrm::restaurant", e))(He || {});
7280
+ var Fe = /* @__PURE__ */ ((e) => (e.hrm_posRole = "hrm::posRole", e.hrm_portalUsers = "hrm::portalUsers", e.hrm_restaurant = "hrm::restaurant", e))(Fe || {});
7281
7281
  const ac = {
7282
7282
  /**
7283
7283
  * Triggered by: hrm_teamMember:manage (portal toggle)
@@ -7290,7 +7290,7 @@ const ac = {
7290
7290
  permissions: [
7291
7291
  {
7292
7292
  label: "Portal Users",
7293
- subject: He.hrm_portalUsers,
7293
+ subject: Fe.hrm_portalUsers,
7294
7294
  actions: [o.manage]
7295
7295
  },
7296
7296
  {
@@ -7300,12 +7300,12 @@ const ac = {
7300
7300
  },
7301
7301
  {
7302
7302
  label: "Pos Role",
7303
- subject: He.hrm_posRole,
7303
+ subject: Fe.hrm_posRole,
7304
7304
  actions: [o.read]
7305
7305
  },
7306
7306
  {
7307
7307
  label: "Restaurant resource",
7308
- subject: He.hrm_restaurant,
7308
+ subject: Fe.hrm_restaurant,
7309
7309
  actions: [o.read]
7310
7310
  }
7311
7311
  ]
@@ -7320,17 +7320,17 @@ const ac = {
7320
7320
  permissions: [
7321
7321
  {
7322
7322
  label: "Portal Users",
7323
- subject: He.hrm_portalUsers,
7323
+ subject: Fe.hrm_portalUsers,
7324
7324
  actions: [o.read]
7325
7325
  },
7326
7326
  {
7327
7327
  label: "Restaurant resource",
7328
- subject: He.hrm_restaurant,
7328
+ subject: Fe.hrm_restaurant,
7329
7329
  actions: [o.read]
7330
7330
  },
7331
7331
  {
7332
7332
  label: "Pos Role",
7333
- subject: He.hrm_posRole,
7333
+ subject: Fe.hrm_posRole,
7334
7334
  actions: [o.manage]
7335
7335
  }
7336
7336
  ]
@@ -7347,7 +7347,22 @@ const ac = {
7347
7347
  permissions: [
7348
7348
  {
7349
7349
  label: "Portal Users",
7350
- subject: He.hrm_portalUsers,
7350
+ subject: Fe.hrm_portalUsers,
7351
+ actions: [o.read]
7352
+ }
7353
+ ]
7354
+ },
7355
+ /**
7356
+ * Triggered by: hrm_approvalCode:manage (portal toggle)
7357
+ * Injects: restaurant read — approval code management needs the restaurant list.
7358
+ */
7359
+ [`set_${d.hrm_approvalCode}`]: {
7360
+ key: "sys:approval_code_access",
7361
+ name: "Approval Code Access",
7362
+ permissions: [
7363
+ {
7364
+ label: "Restaurant resource",
7365
+ subject: Fe.hrm_restaurant,
7351
7366
  actions: [o.read]
7352
7367
  }
7353
7368
  ]
@@ -8335,10 +8350,10 @@ const Et = (e) => ({
8335
8350
  }
8336
8351
  ]
8337
8352
  }
8338
- }), al = Kt(we(() => import("./Main-D_LwrBdZ.js"))), ol = Kt(we(() => import("./Main-DNOHZd3j.js"))), il = Kt(
8339
- we(() => import("./AuditLogList-DrrL4vf4.js"))
8340
- ), cl = Kt(we(() => import("./Main-auigiuVZ.js"))), ll = we(() => import("./ApprovalCodeList-B1XHbhum.js")), ul = we(() => import("./GrantUserList-CLBl7FZ-.js")), Al = we(() => import("./EmployeeList-BMol4ah4.js")), dl = we(() => import("./RoleList-g8PjH_k2.js")), ml = we(() => import("./TimesheetList-C1IJhOYE.js")), gl = we(() => import("./TeamMemberList-B9aCagSc.js")), pl = we(
8341
- () => import("./PermissionSetList-DLYrXFbz.js")
8353
+ }), al = Kt(we(() => import("./Main-B06aoNy1.js"))), ol = Kt(we(() => import("./Main-BC7IPhbz.js"))), il = Kt(
8354
+ we(() => import("./AuditLogList-DH2ZvAVE.js"))
8355
+ ), cl = Kt(we(() => import("./Main-BRrcfqXc.js"))), ll = we(() => import("./ApprovalCodeList-CQApO-t4.js")), ul = we(() => import("./GrantUserList-DURXYzRs.js")), Al = we(() => import("./EmployeeList-B1Q4RH2r.js")), dl = we(() => import("./RoleList-BVFWURdS.js")), ml = we(() => import("./TimesheetList-C4G2Va4m.js")), gl = we(() => import("./TeamMemberList-DlurP2WR.js")), pl = we(
8356
+ () => import("./PermissionSetList-CiVFvnlW.js")
8342
8357
  ), Fl = [
8343
8358
  {
8344
8359
  path: "/",
@@ -8841,18 +8856,18 @@ var Vs = { exports: {} };
8841
8856
  ue.setLoadingState(n(n({}, ue.loadingState), { isFetching: !1, isLoading: !1, error: he })), Me == null || Me(he);
8842
8857
  }, this.enableLogs = fe || !1, this.cacheOptions = _e ? { skipAPI: !!_e.skipAPI, ttl: _e.ttl || 0, storageKey: _e.storageKey, loadStale: !!_e.loadStale } : this.cacheOptions, !this.cacheOptions.ttl && this.cacheOptions.skipAPI && console.warn("Flagsmith: you have set a cache ttl of 0 and are skipping API calls, this means the API will not be hit unless you clear local storage."), ve && (O = ve), this.enableAnalytics = dt || !1, this.flags = Object.assign({}, ge) || {}, this.datadogRum = ce || null, this.initialised = !0, this.ticks = 1e4, this.timer = this.enableLogs ? (/* @__PURE__ */ new Date()).valueOf() : null, this.cacheFlags = ne !== void 0 && !!U, be = "FLAGSMITH_EVENT_" + b.environment.apiKey, W && (ne = W), mt && typeof window < "u" && this.setupRealtime(le, b.environment.apiKey), Object.keys(this.flags).length && (this.loadingState = n(n({}, this.loadingState), { isLoading: !1, source: B.DEFAULT_FLAGS })), this.setState(Qs), this.log("Initialising with properties", u, this), Ce && (typeof dtrum > "u" ? console.error("You have attempted to enable dynatrace but dtrum is undefined, please check you have the Dynatrace RUM JavaScript API installed.") : this.dtrum = dtrum), $t && (O = /* @__PURE__ */ function(he) {
8843
8858
  return function(De, xe) {
8844
- var qe = xe.headers, K = xe.method, et = xe.body;
8859
+ var Ie = xe.headers, K = xe.method, et = xe.body;
8845
8860
  return new Promise(function(Ze) {
8846
8861
  switch (K) {
8847
8862
  case "GET":
8848
- return he.get(De, { headers: qe }).subscribe(function(Oe) {
8863
+ return he.get(De, { headers: Ie }).subscribe(function(Oe) {
8849
8864
  Ze({ ok: !0, text: function() {
8850
8865
  return Promise.resolve(Oe);
8851
8866
  } });
8852
8867
  });
8853
8868
  case "POST":
8854
8869
  case "PUT":
8855
- return he.post(De, et, { headers: qe }).subscribe(function(Oe) {
8870
+ return he.post(De, et, { headers: Ie }).subscribe(function(Oe) {
8856
8871
  Ze({ ok: !0, text: function() {
8857
8872
  return Promise.resolve(Oe);
8858
8873
  } });
@@ -8871,46 +8886,46 @@ var Vs = { exports: {} };
8871
8886
  if (De && ue.evaluationContext.environment) {
8872
8887
  var xe = JSON.parse(De);
8873
8888
  if (xe[ue.evaluationContext.environment.apiKey]) {
8874
- var qe = ue.getState();
8875
- ue.log("Retrieved events from cache", De), ue.setState(n(n({}, qe), { evaluationEvent: xe[ue.evaluationContext.environment.apiKey] }));
8889
+ var Ie = ue.getState();
8890
+ ue.log("Retrieved events from cache", De), ue.setState(n(n({}, Ie), { evaluationEvent: xe[ue.evaluationContext.environment.apiKey] }));
8876
8891
  }
8877
8892
  }
8878
8893
  })), !U) return [3, 9];
8879
8894
  if (!ne || !this.canUseStorage) return [3, 8];
8880
8895
  Ns = function(he, De) {
8881
8896
  return a(ue, void 0, void 0, function() {
8882
- var xe, qe, K, et, Ze, Oe, ss, Ss, rs, ns, as, os, is, cs, ls, us, As, ds, ms, gs, ps, fs, hs, ys, zs = this;
8883
- return c(this, function(Ie) {
8884
- switch (Ie.label) {
8897
+ var xe, Ie, K, et, Ze, Oe, ss, Ss, rs, ns, as, os, is, cs, ls, us, As, ds, ms, gs, ps, fs, hs, ys, zs = this;
8898
+ return c(this, function(He) {
8899
+ switch (He.label) {
8885
8900
  case 0:
8886
8901
  if (!De) return [3, 7];
8887
- xe = null, qe = null, Ie.label = 1;
8902
+ xe = null, Ie = null, He.label = 1;
8888
8903
  case 1:
8889
- return Ie.trys.push([1, 5, , 6]), K = JSON.parse(De), et = !1, Ze = !1, K && K.api === this.api && ((ns = (rs = K.evaluationContext) === null || rs === void 0 ? void 0 : rs.environment) === null || ns === void 0 ? void 0 : ns.apiKey) === ((as = this.evaluationContext.environment) === null || as === void 0 ? void 0 : as.apiKey) && (Oe = !0, this.evaluationContext.identity && ((is = (os = K.evaluationContext) === null || os === void 0 ? void 0 : os.identity) === null || is === void 0 ? void 0 : is.identifier) !== this.evaluationContext.identity.identifier && (this.log("Ignoring cache, identity has changed from " + ((ls = (cs = K.evaluationContext) === null || cs === void 0 ? void 0 : cs.identity) === null || ls === void 0 ? void 0 : ls.identifier) + " to " + this.evaluationContext.identity.identifier), Oe = !1), this.cacheOptions.ttl && (!K.ts || (/* @__PURE__ */ new Date()).valueOf() - K.ts > this.cacheOptions.ttl) && (K.ts && !this.cacheOptions.loadStale ? (this.log("Ignoring cache, timestamp is too old ts:" + K.ts + " ttl: " + this.cacheOptions.ttl + " time elapsed since cache: " + ((/* @__PURE__ */ new Date()).valueOf() - K.ts) + "ms"), Oe = !1) : K.ts && this.cacheOptions.loadStale && (this.log("Loading stale cache, timestamp ts:" + K.ts + " ttl: " + this.cacheOptions.ttl + " time elapsed since cache: " + ((/* @__PURE__ */ new Date()).valueOf() - K.ts) + "ms"), Ze = !0, Oe = !0)), Oe && (et = !0, qe = h((us = this.evaluationContext.identity) === null || us === void 0 ? void 0 : us.traits, (ds = (As = K.evaluationContext) === null || As === void 0 ? void 0 : As.identity) === null || ds === void 0 ? void 0 : ds.traits), xe = h(this.flags, K.flags), this.setState(n(n({}, K), { evaluationContext: re(n(n({}, K.evaluationContext), { identity: !((ms = K.evaluationContext) === null || ms === void 0) && ms.identity ? n(n({}, (gs = K.evaluationContext) === null || gs === void 0 ? void 0 : gs.identity), { traits: n(n({}, ((fs = (ps = K.evaluationContext) === null || ps === void 0 ? void 0 : ps.identity) === null || fs === void 0 ? void 0 : fs.traits) || {}), gt || {}) }) : void 0 })) })), this.log("Retrieved flags from cache", K))), et ? (ss = !pe && (!this.cacheOptions.skipAPI || Ze), this._onChange(null, { isFromServer: !1, flagsChanged: xe, traitsChanged: qe }, this._loadedState(null, B.CACHE, ss)), this.oldFlags = this.flags, this.cacheOptions.skipAPI && et && !Ze && this.log("Skipping API, using cache"), ss && this.getFlags().catch(function(Hn) {
8904
+ return He.trys.push([1, 5, , 6]), K = JSON.parse(De), et = !1, Ze = !1, K && K.api === this.api && ((ns = (rs = K.evaluationContext) === null || rs === void 0 ? void 0 : rs.environment) === null || ns === void 0 ? void 0 : ns.apiKey) === ((as = this.evaluationContext.environment) === null || as === void 0 ? void 0 : as.apiKey) && (Oe = !0, this.evaluationContext.identity && ((is = (os = K.evaluationContext) === null || os === void 0 ? void 0 : os.identity) === null || is === void 0 ? void 0 : is.identifier) !== this.evaluationContext.identity.identifier && (this.log("Ignoring cache, identity has changed from " + ((ls = (cs = K.evaluationContext) === null || cs === void 0 ? void 0 : cs.identity) === null || ls === void 0 ? void 0 : ls.identifier) + " to " + this.evaluationContext.identity.identifier), Oe = !1), this.cacheOptions.ttl && (!K.ts || (/* @__PURE__ */ new Date()).valueOf() - K.ts > this.cacheOptions.ttl) && (K.ts && !this.cacheOptions.loadStale ? (this.log("Ignoring cache, timestamp is too old ts:" + K.ts + " ttl: " + this.cacheOptions.ttl + " time elapsed since cache: " + ((/* @__PURE__ */ new Date()).valueOf() - K.ts) + "ms"), Oe = !1) : K.ts && this.cacheOptions.loadStale && (this.log("Loading stale cache, timestamp ts:" + K.ts + " ttl: " + this.cacheOptions.ttl + " time elapsed since cache: " + ((/* @__PURE__ */ new Date()).valueOf() - K.ts) + "ms"), Ze = !0, Oe = !0)), Oe && (et = !0, Ie = h((us = this.evaluationContext.identity) === null || us === void 0 ? void 0 : us.traits, (ds = (As = K.evaluationContext) === null || As === void 0 ? void 0 : As.identity) === null || ds === void 0 ? void 0 : ds.traits), xe = h(this.flags, K.flags), this.setState(n(n({}, K), { evaluationContext: re(n(n({}, K.evaluationContext), { identity: !((ms = K.evaluationContext) === null || ms === void 0) && ms.identity ? n(n({}, (gs = K.evaluationContext) === null || gs === void 0 ? void 0 : gs.identity), { traits: n(n({}, ((fs = (ps = K.evaluationContext) === null || ps === void 0 ? void 0 : ps.identity) === null || fs === void 0 ? void 0 : fs.traits) || {}), gt || {}) }) : void 0 })) })), this.log("Retrieved flags from cache", K))), et ? (ss = !pe && (!this.cacheOptions.skipAPI || Ze), this._onChange(null, { isFromServer: !1, flagsChanged: xe, traitsChanged: Ie }, this._loadedState(null, B.CACHE, ss)), this.oldFlags = this.flags, this.cacheOptions.skipAPI && et && !Ze && this.log("Skipping API, using cache"), ss && this.getFlags().catch(function(Hn) {
8890
8905
  var bs;
8891
8906
  (bs = zs.onError) === null || bs === void 0 || bs.call(zs, Hn);
8892
8907
  }), [3, 4]) : [3, 2];
8893
8908
  case 2:
8894
8909
  return pe ? [3, 4] : [4, this.getFlags()];
8895
8910
  case 3:
8896
- Ie.sent(), Ie.label = 4;
8911
+ He.sent(), He.label = 4;
8897
8912
  case 4:
8898
8913
  return [3, 6];
8899
8914
  case 5:
8900
- return Ss = Ie.sent(), this.log("Exception fetching cached logs", Ss), [3, 6];
8915
+ return Ss = He.sent(), this.log("Exception fetching cached logs", Ss), [3, 6];
8901
8916
  case 6:
8902
8917
  return [3, 10];
8903
8918
  case 7:
8904
8919
  return pe ? [3, 9] : [4, this.getFlags()];
8905
8920
  case 8:
8906
- return Ie.sent(), [3, 10];
8921
+ return He.sent(), [3, 10];
8907
8922
  case 9:
8908
8923
  if (ge) this._onChange(null, { isFromServer: !1, flagsChanged: h({}, this.flags), traitsChanged: h({}, (hs = this.evaluationContext.identity) === null || hs === void 0 ? void 0 : hs.traits) }, this._loadedState(null, B.DEFAULT_FLAGS));
8909
8924
  else {
8910
8925
  if (!this.flags) throw new Error(es);
8911
8926
  this._onChange(null, { isFromServer: !1, flagsChanged: h({}, this.flags), traitsChanged: h({}, (ys = this.evaluationContext.identity) === null || ys === void 0 ? void 0 : ys.traits) }, this._loadedState(null, B.DEFAULT_FLAGS));
8912
8927
  }
8913
- Ie.label = 10;
8928
+ He.label = 10;
8914
8929
  case 10:
8915
8930
  return [2];
8916
8931
  }
package/dist/app.js CHANGED
@@ -1,4 +1,4 @@
1
- import { j as e, i as r, r as o } from "./app-DnOYVjuj.js";
1
+ import { j as e, i as r, r as o } from "./app-CGL_lSgW.js";
2
2
  export {
3
3
  e as FmApp,
4
4
  r as i18nMessages,
@@ -1,4 +1,4 @@
1
- import { g as Q, c as K } from "./app-DnOYVjuj.js";
1
+ import { g as Q, c as K } from "./app-CGL_lSgW.js";
2
2
  var E = { exports: {} };
3
3
  (function(V, X) {
4
4
  (function(W, k) {
@@ -1,10 +1,10 @@
1
- import { d as g } from "./dayjs.min-Dxul0qTK.js";
1
+ import { d as g } from "./dayjs.min-BXDtus8O.js";
2
2
  import { defineStore as $, storeToRefs as T } from "pinia";
3
3
  import { ref as m } from "vue";
4
- import { s as E } from "./iteration-DIqDMvFa.js";
4
+ import { s as E } from "./iteration-BXcl549C.js";
5
5
  import { b as i, g as f, u as w } from "./restaurant-YOVMuuFY.js";
6
6
  import { i as v } from "./utils-BZkjJbju.js";
7
- import { u as _ } from "./role-CE3NY-63.js";
7
+ import { u as _ } from "./role-Ct8MPQeS.js";
8
8
  const o = {
9
9
  async readEmployees() {
10
10
  return f(await i().get("/pos-users"));
@@ -1,4 +1,4 @@
1
- import { c as B } from "./app-DnOYVjuj.js";
1
+ import { c as B } from "./app-CGL_lSgW.js";
2
2
  var ma = {}, Zt = {}, l = {}, ji = {}, Ei = {}, Ii = {}, Dn = {};
3
3
  (function(e) {
4
4
  Object.defineProperty(e, "__esModule", { value: !0 }), e.getParsedType = e.ZodParsedType = e.util = void 0;
@@ -1,4 +1,4 @@
1
- import { c as jt } from "./app-DnOYVjuj.js";
1
+ import { c as jt } from "./app-CGL_lSgW.js";
2
2
  var Jr = { exports: {} };
3
3
  /**
4
4
  * @license
@@ -1,7 +1,7 @@
1
1
  import { defineStore as S, storeToRefs as _ } from "pinia";
2
2
  import { ref as w } from "vue";
3
3
  import { useCoreStore as g } from "@feedmepos/mf-common";
4
- import { s as y } from "./iteration-DIqDMvFa.js";
4
+ import { s as y } from "./iteration-BXcl549C.js";
5
5
  import { g as d, b as f, u as I } from "./restaurant-YOVMuuFY.js";
6
6
  const R = {
7
7
  async readRoles() {
@@ -1,5 +1,5 @@
1
- import { s as W, c as Z, e as y } from "./iteration-DIqDMvFa.js";
2
- import { h as A, P as V, d as _, v as F, n as j, b as q } from "./app-DnOYVjuj.js";
1
+ import { s as W, c as Z, e as y } from "./iteration-BXcl549C.js";
2
+ import { h as A, P as V, d as _, v as F, n as j, b as q } from "./app-CGL_lSgW.js";
3
3
  import { s as ee } from "./utils-BZkjJbju.js";
4
4
  import { g as b, b as v, q as k, u as ne } from "./restaurant-YOVMuuFY.js";
5
5
  import { defineStore as z, storeToRefs as K } from "pinia";
@@ -5,7 +5,8 @@ export type ApprovalCodePermission = (typeof APPROVAL_CODE_PERMISSIONS)[number];
5
5
  * stored/returned by the backend. Mirrors `FdoApprovalCodeRule` from
6
6
  * `apps/hrm-backend/src/grant-user/grant-user.entity.ts`. `conditions` is
7
7
  * `null` (not just absent) for keys whose full-POS counterpart carries no
8
- * conditions at all (see `APPROVAL_CODE_RULE_TEMPLATES`).
8
+ * conditions at all (see `APPROVAL_CODE_RULE_TEMPLATES` at
9
+ * `apps/hrm-backend/src/grant-user/approval-code-rules.ts`).
9
10
  */
10
11
  export interface IFdtoApprovalCodeRule {
11
12
  key: ApprovalCodePermission;
@@ -13,41 +14,6 @@ export interface IFdtoApprovalCodeRule {
13
14
  actions: string[];
14
15
  conditions?: Record<string, unknown> | null;
15
16
  }
16
- /**
17
- * The rule template (subject/actions/conditions, minus `key`) for every
18
- * approval-code permission the portal can grant. The portal is now the
19
- * owner of these shapes (KDI-4982 Task A2) — the backend only validates the
20
- * shape of whatever rule it receives, it no longer composes rules itself.
21
- * These shapes are not arbitrary: they mirror `FullPosPermissions`
22
- * (`packages/permission/src/common/full-pos-permissions.ts`) exactly, entry
23
- * for entry, so a code granting one of these keys evaluates identically to
24
- * the corresponding rule a full-POS-permission staff member already has.
25
- * That's why `refund`/`openDrawer`/`counter` carry `conditions: null` — full
26
- * POS has no `operation` condition on those subjects — and why `discount`
27
- * always carries an `adjustment` condition (full POS's unbounded discount
28
- * rule is `adjustment: { $lte: 1 }`, i.e. "up to 100%", not "no adjustment
29
- * condition at all"). `counter` is a single key (not separate open/close
30
- * keys) because POS guards both opening and closing a counter with the same
31
- * `counterRecord`/`manage` permission — two identical rules would just be
32
- * redundant.
33
- */
34
- export declare const APPROVAL_CODE_RULE_TEMPLATES: Record<ApprovalCodePermission, {
35
- subject: string;
36
- actions: string[];
37
- conditions: Record<string, unknown> | null;
38
- }>;
39
- /**
40
- * Compose the full CASL-shaped rule for `key`, ready to send to the backend
41
- * as-is, saved shape-identical to the corresponding `FullPosPermissions`
42
- * entry. Keys whose template has `conditions: null` always return `null` —
43
- * there's nothing to clone. Only `discount` honors `params.maxPercentage`,
44
- * setting the `adjustment.$lte` fraction (defaulting to `1`, i.e. no
45
- * effective ceiling, matching full POS's unbounded discount rule) — every
46
- * other object-conditions key ignores `params` if passed.
47
- */
48
- export declare function buildApprovalCodeRule(key: ApprovalCodePermission, params?: {
49
- maxPercentage?: number;
50
- }): IFdtoApprovalCodeRule;
51
17
  export interface IFdtoApprovalCode {
52
18
  _id: string;
53
19
  businessId: string;
@@ -64,20 +30,15 @@ export interface IFdtoApprovalCode {
64
30
  createdAt: string;
65
31
  updatedAt: string;
66
32
  }
67
- export interface IFdtoCreateApprovalCodeReq {
68
- name: string;
69
- restaurantId: string;
70
- permissions: IFdtoApprovalCodeRule[];
71
- count: number;
72
- }
73
33
  /**
74
34
  * Read the discount ceiling back out of a rule's `conditions.adjustment.$lte`
75
35
  * fraction (0-1) as a whole percentage (1-100). Returns `undefined` when the
76
36
  * rule has no adjustment ceiling, when `conditions` is `null` (full-POS-style
77
37
  * null-condition rules never carry an adjustment), or when the ceiling is
78
38
  * 100% — `$lte: 1` is the unbounded/default form (see
79
- * `APPROVAL_CODE_RULE_TEMPLATES.discount`), so showing "≤100%" would be
80
- * meaningless noise on every plain discount grant.
39
+ * `APPROVAL_CODE_RULE_TEMPLATES.discount` at
40
+ * `apps/hrm-backend/src/grant-user/approval-code-rules.ts`), so showing
41
+ * "≤100%" would be meaningless noise on every plain discount grant.
81
42
  */
82
43
  export declare function getRuleAdjustmentCeilingPercentage(rule: IFdtoApprovalCodeRule): number | undefined;
83
44
  /**
@@ -110,15 +71,29 @@ export declare function validateMaxPercentage(value: number | string | undefined
110
71
  * Assumes the value has already passed `validateMaxPercentage`.
111
72
  */
112
73
  export declare function resolveMaxPercentage(value: number | string | undefined): number | undefined;
74
+ /** One requested permission on a new access code, matching the backend's
75
+ * `FdtoApprovalCodePermissionReq`: a rule key plus, for `discount` only, a
76
+ * whole-percentage ceiling (1-100). The backend composes the stored CASL rule
77
+ * from the key — the portal no longer sends rule shapes. */
78
+ export interface IFdtoApprovalCodePermissionReq {
79
+ key: ApprovalCodePermission;
80
+ maxPercentage?: number;
81
+ }
82
+ export interface IFdtoCreateApprovalCodeReq {
83
+ name: string;
84
+ restaurantId: string;
85
+ permissions: IFdtoApprovalCodePermissionReq[];
86
+ count: number;
87
+ }
113
88
  /**
114
89
  * A selectable action option in the create form / list filter (KDI-4982 UI
115
90
  * redesign). The 8 options mirror the POS v7 passcode prompts exactly:
116
91
  * `claimDeposit` and `payment` are not offered (neither has a passcode prompt
117
- * on POS v7) even though both have `APPROVAL_CODE_RULE_TEMPLATES` entries
118
- * matching full POS. `changePrice` is offered as "Input Custom Price" — POS
92
+ * on POS v7) even though both are valid `ApprovalCodePermission` keys the
93
+ * backend accepts. `changePrice` is offered as "Input Custom Price" — POS
119
94
  * prompts for a passcode when a custom price is keyed in. `counter` covers
120
- * both opening and closing a counter (one `counterRecord`/`manage` rule, see
121
- * `APPROVAL_CODE_RULE_TEMPLATES.counter`). `printReceipt` was dropped
95
+ * both opening and closing a counter (one `counterRecord`/`manage` rule on
96
+ * the backend). `printReceipt` was dropped
122
97
  * entirely (no full-POS counterpart, and this feature has no pre-existing
123
98
  * stored data to keep rendering) — there is a 1:1 mapping between every
124
99
  * option and its single `ApprovalCodePermission` rule key, so each option
@@ -131,6 +106,12 @@ export interface AccessCodeActionOption {
131
106
  }
132
107
  export type AccessCodeActionOptionKey = AccessCodeActionOption['key'];
133
108
  export declare const ACCESS_CODE_ACTION_OPTIONS: AccessCodeActionOption[];
109
+ /**
110
+ * Map the form's selected action options to permission-key requests.
111
+ * `maxPercentage` is the raw form input (see `resolveMaxPercentage`) and is
112
+ * attached to the `discount` key only — the backend rejects it elsewhere.
113
+ */
114
+ export declare function buildPermissionRequests(selected: AccessCodeActionOptionKey[], maxPercentage: number | string | undefined): IFdtoApprovalCodePermissionReq[];
134
115
  /** When a code stopped being usable: used wins over revoked (a code can only
135
116
  * be one or the other, but usedAt is the historically-populated field). */
136
117
  export declare function getResolvedAt(code: Pick<IFdtoApprovalCode, 'usedAt' | 'revokedAt'>): string | undefined;