@feedmepos/mf-menu 0.31.40-prod → 0.31.41-prod

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 (90) hide show
  1. package/dist/{App-aWEH-ZEk.js → App-5Lzy8zHZ.js} +8 -8
  2. package/dist/{ApplyProduct.vue_vue_type_script_setup_true_lang-jJyinQZl.js → ApplyProduct.vue_vue_type_script_setup_true_lang-BnKXsQH-.js} +3 -3
  3. package/dist/{Catalog-BoFfFdn8.js → Catalog-s5b8V8nw.js} +8 -9
  4. package/dist/{Category-CWYbb3Jn.js → Category-BJzScJEY.js} +4 -4
  5. package/dist/{Category-DZ45uikR.js → Category-DZ-xqIMI.js} +6 -6
  6. package/dist/{CookingGuide-BU0PRWIQ.js → CookingGuide-Bkd6GPww.js} +4 -4
  7. package/dist/{CustomAttributeChip.vue_vue_type_script_setup_true_lang-Z5xsKDIE.js → CustomAttributeChip.vue_vue_type_script_setup_true_lang-B8tIjKOW.js} +1 -1
  8. package/dist/{Group-BMQDeqiS.js → Group-0b2Qiov3.js} +1 -1
  9. package/dist/{Group-C0T_uknK.js → Group-BOaCcKiI.js} +3 -3
  10. package/dist/{Group.vue_vue_type_script_setup_true_lang-DyfmY6F1.js → Group.vue_vue_type_script_setup_true_lang-DUlUfMAs.js} +8 -8
  11. package/dist/GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-CouimeC4.js +399 -0
  12. package/dist/{ImportProductDialog.vue_vue_type_script_setup_true_lang-Dl-Wvt3D.js → ImportProductDialog.vue_vue_type_script_setup_true_lang-DOvQmbrZ.js} +13 -14
  13. package/dist/{Ingredient-3lwDUQx_.js → Ingredient-ChcYUvOg.js} +3 -3
  14. package/dist/{InventoryBinding.vue_vue_type_script_setup_true_lang-VLrrTkSC.js → InventoryBinding.vue_vue_type_script_setup_true_lang-DE1HkipX.js} +2 -2
  15. package/dist/LinkProductSideSheet-BdzBGYxG.js +361 -0
  16. package/dist/MenuSetting-zAAttaoA.js +618 -0
  17. package/dist/{PrintRoute-DfJ-vUAb.js → PrintRoute-T-vuO5N8.js} +4 -4
  18. package/dist/{Product-F4PoLm9v.js → Product-B5q291VF.js} +1 -1
  19. package/dist/{Product.vue_vue_type_script_setup_true_lang-DT5gffpA.js → Product.vue_vue_type_script_setup_true_lang-DLRlT10W.js} +468 -465
  20. package/dist/{ProductInternalTools-DSGU-OqU.js → ProductInternalTools-BOlc0VUR.js} +5 -5
  21. package/dist/{Products-COzW2Z4g.js → Products-Cd4Mqhm3.js} +88 -85
  22. package/dist/{Publish-CDXVWCk2.js → Publish-SuRzt-_D.js} +3 -3
  23. package/dist/{Recipe-BZx4wrcP.js → Recipe-BKrjNs5g.js} +4 -4
  24. package/dist/{Scheduler-wHCWSeU2.js → Scheduler-DnDgImLC.js} +3 -3
  25. package/dist/{ServingSequence-BbYEhDYh.js → ServingSequence-D602bVnm.js} +3 -3
  26. package/dist/{Setting-C9Tlw1Iy.js → Setting-FMT4oBYH.js} +44 -45
  27. package/dist/{Subcategory-C8AwfrKb.js → Subcategory-CpYmjAvA.js} +4 -4
  28. package/dist/{Takeaway-t1053wg2.js → Takeaway-BXh3iuME.js} +1 -1
  29. package/dist/{Takeaway-DaEUn-yM.js → Takeaway-D4hjN5z5.js} +4 -4
  30. package/dist/{Takeaway.vue_vue_type_script_setup_true_lang-7XycP5fU.js → Takeaway.vue_vue_type_script_setup_true_lang-By1f-FCO.js} +5 -5
  31. package/dist/Thumbnail.vue_vue_type_script_setup_true_lang-CZUwa5C_.js +440 -0
  32. package/dist/{TreeEditorOpenner.vue_vue_type_script_setup_true_lang-Ci6iqOry.js → TreeEditorOpenner.vue_vue_type_script_setup_true_lang-DfjtfcCh.js} +604 -600
  33. package/dist/{Unit-CnqptGCz.js → Unit-CsjHkV-h.js} +2 -2
  34. package/dist/{Variant-DiOYOwJs.js → Variant-Djra14ZX.js} +3 -3
  35. package/dist/{_id_-BSfU16VO.js → _id_-BXkqoCzB.js} +78 -75
  36. package/dist/{app-Ddb81PNo.js → app-CVqWWV4x.js} +278 -278
  37. package/dist/{LinkProductSideSheet.vue_vue_type_style_index_0_scoped_97fa9d58_lang-DvG3mOom.js → app-CiBqmBzO.js} +2120 -2084
  38. package/dist/{app-Cou6qPF2.js → app-PhBJNss_.js} +1 -1
  39. package/dist/app.js +1 -1
  40. package/dist/apps/mf-menu/src/api/menu.d.ts +2 -1
  41. package/dist/apps/mf-menu/src/app.d.ts +144 -0
  42. package/dist/apps/mf-menu/src/components/feature/PriceTier/PriceTierRuleEditor.vue.d.ts +36 -0
  43. package/dist/apps/mf-menu/src/components/feature/RestaurantAttributesSelector.vue.d.ts +9 -3
  44. package/dist/apps/mf-menu/src/components/feature/TreeEditor/store/menuV2.d.ts +294 -4
  45. package/dist/apps/mf-menu/src/composable/attributes.d.ts +26 -0
  46. package/dist/apps/mf-menu/src/composable/linkProducts.d.ts +40 -0
  47. package/dist/apps/mf-menu/src/helper/import-export.d.ts +285 -0
  48. package/dist/apps/mf-menu/src/helper/menu.d.ts +285 -0
  49. package/dist/apps/mf-menu/src/manager/menu/item.d.ts +285 -0
  50. package/dist/apps/mf-menu/src/stores/menu.d.ts +293 -3
  51. package/dist/apps/mf-menu/src/utils/array.d.ts +1 -0
  52. package/dist/apps/mf-menu/src/utils/customAttributes.d.ts +12 -0
  53. package/dist/apps/mf-menu/src/views/MenuSetting/LinkProductRuleGroups.vue.d.ts +2 -0
  54. package/dist/apps/mf-menu/src/views/MenuSetting/RuleGroupSideSheet.vue.d.ts +176 -0
  55. package/dist/apps/mf-menu/src/views/Publish/UpdateCatalogDialog.vue.d.ts +166 -0
  56. package/dist/apps/mf-menu/tsconfig.app.tsbuildinfo +1 -1
  57. package/dist/assets/linked-status-WlVAcpRn.js +13 -0
  58. package/dist/assets/override-menu-__h4D7ac.js +13 -0
  59. package/dist/assets/validate-menu-DyPuzLRg.js +13 -0
  60. package/dist/{catalog-DSuJhsUb.js → catalog-C_TuQLxq.js} +1 -1
  61. package/dist/{catalogSetting-C3gEw9ov.js → catalogSetting-BUlJu6hG.js} +1 -1
  62. package/dist/{category-CwWq3KCE.js → category-CmVw1Kj-.js} +1 -1
  63. package/dist/{currency-g45Sh-t6.js → currency-OhOTnAqk.js} +1 -1
  64. package/dist/customAttributes-fpOfmGnw.js +180 -0
  65. package/dist/{dayjs.min-g3eN5z-V.js → dayjs.min-CDhP-7L5.js} +1 -1
  66. package/dist/{index-QsLFbxyG.js → index-BJZEWB5C.js} +4 -4
  67. package/dist/{index-BLQCYEc6.js → index-DHAYGEPp.js} +7 -8
  68. package/dist/{index-0yRUi7LL.js → index-DtwHmS38.js} +1 -1
  69. package/dist/index-N3cGc8ex.js +245 -0
  70. package/dist/{item-BvvQ9urP.js → item-BELLphR0.js} +16 -16
  71. package/dist/{jszip.min-DzdUiaR4.js → jszip.min-CZtcGb7A.js} +353 -353
  72. package/dist/{menu-QrVg2Ph7.js → menu-Csyr6W9A.js} +7 -7
  73. package/dist/{menu-DFNvhoNQ.js → menu-DS_ERmBf.js} +23355 -23206
  74. package/dist/{menuV2-Ezf_jW40.js → menuV2-DKzAZ4Ss.js} +151 -146
  75. package/dist/mf-menu.css +1 -1
  76. package/dist/{priceTier-zENsn3P_.js → priceTier-CYWS5lDS.js} +1 -1
  77. package/dist/{scheduler-BuwGSv6A.js → scheduler-DI5dXC7Y.js} +8 -8
  78. package/dist/{subcategory-O3L_zCJA.js → subcategory-D_ao-IV9.js} +2 -2
  79. package/dist/{toExcel-CpRy_4nG.js → toExcel-Cml-rkJQ.js} +2 -2
  80. package/dist/{unit-Ct_7Hfa2.js → unit-BWDp2LkV.js} +42 -41
  81. package/package.json +3 -3
  82. package/dist/FormSection.vue_vue_type_script_setup_true_lang-CO4YGYLB.js +0 -50
  83. package/dist/GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-D6qro5w_.js +0 -367
  84. package/dist/LinkProductSideSheet-LDZjKX95.js +0 -297
  85. package/dist/MenuSetting-AhutsCVy.js +0 -185
  86. package/dist/Thumbnail.vue_vue_type_script_setup_true_lang-B7oLH9cP.js +0 -431
  87. package/dist/assets/linked-status-B_crHhZH.js +0 -24
  88. package/dist/assets/override-menu-BmlCEpHH.js +0 -24
  89. package/dist/assets/validate-menu-CF-psoB-.js +0 -24
  90. package/dist/index-0Q5T9VZV.js +0 -214
@@ -1,21 +1,21 @@
1
- import { ao as G, H as k, D as I, A as J, ap as q, J as H, I as Y, a9 as w, c as x, X as E, aj as z, aq as Me, ar as Ee, B as ke, ab as Ie, as as Re, at as Te, a8 as Fe } from "./menu-DFNvhoNQ.js";
1
+ import { ao as L, H as R, D as k, A as J, ap as q, J as U, I as Y, a9 as w, c as N, X as E, aj as B, aq as Me, ar as Ee, B as Re, ab as ke, as as Ie, at as Te, a8 as Fe } from "./menu-DS_ERmBf.js";
2
2
  import { defineStore as Ae } from "pinia";
3
- import { shallowRef as X, ref as U, computed as h, shallowReactive as Ke, effectScope as Oe, watch as Ve } from "vue";
4
- import { useCoreStore as L } from "@feedmepos/mf-common";
5
- import { useSnackbar as Ne } from "@feedmepos/ui-library";
6
- const xe = "/assets/linked-status-B_crHhZH.js", $e = "/assets/override-menu-BmlCEpHH.js";
7
- function Pe(e) {
3
+ import { shallowRef as X, ref as D, computed as h, shallowReactive as Pe, effectScope as Ve, watch as Ke } from "vue";
4
+ import { useCoreStore as z } from "@feedmepos/mf-common";
5
+ import { useSnackbar as Oe } from "@feedmepos/ui-library";
6
+ const Ne = "/assets/linked-status-WlVAcpRn.js", xe = "/assets/override-menu-__h4D7ac.js";
7
+ function $e(e) {
8
8
  var a;
9
- const n = k(e), o = (a = n.variant) == null ? void 0 : a.variantCombinations;
9
+ const n = R(e), o = (a = n.variant) == null ? void 0 : a.variantCombinations;
10
10
  return delete n.variant, delete n.thumbnail, [n, ...o || []];
11
11
  }
12
- function He(e, n, o, a) {
13
- const r = k(n), l = o ? r.modules.catalog.find((g) => g._id === o) : null, d = a ? r.modules.scheduler.find((g) => g._id === a) : null, i = l ? k(l) : void 0, c = o ? r.modules.catalog.filter((g) => g._id !== o) : [], m = d ? k(d) : void 0, f = e.reduce((g, y) => (g[y._id] = Pe(y), g), {});
14
- function v(g = []) {
15
- const y = e.map((b) => b._id);
12
+ function Ue(e, n, o, a) {
13
+ const r = R(n), l = o ? r.modules.catalog.find((_) => _._id === o) : null, d = a ? r.modules.scheduler.find((_) => _._id === a) : null, i = l ? R(l) : void 0, c = o ? r.modules.catalog.filter((_) => _._id !== o) : [], m = d ? R(d) : void 0, f = e.reduce((_, y) => (_[y._id] = $e(y), _), {});
14
+ function v(_ = []) {
15
+ const y = e.map((C) => C._id);
16
16
  return [
17
- ...g.filter((b) => !y.includes(b._id)),
18
- ...Object.values(f).flatMap((b) => b)
17
+ ..._.filter((C) => !y.includes(C._id)),
18
+ ...Object.values(f).flatMap((C) => C)
19
19
  ];
20
20
  }
21
21
  return i && a ? (i.override.scheduler = {
@@ -23,8 +23,8 @@ function He(e, n, o, a) {
23
23
  [a]: {
24
24
  ...i.override.scheduler[a],
25
25
  _id: a,
26
- items: v(m == null ? void 0 : m.items).map((g) => ({
27
- ...g,
26
+ items: v(m == null ? void 0 : m.items).map((_) => ({
27
+ ..._,
28
28
  orderFrom: J.F_ORDER_FROM.enum.ALL
29
29
  }))
30
30
  }
@@ -32,7 +32,7 @@ function He(e, n, o, a) {
32
32
  ...i.override.items,
33
33
  ...f
34
34
  }, r.modules.catalog = [...c, i], r) : m ? (m.items = v(m.items), r.modules.scheduler = [
35
- ...r.modules.scheduler.filter((g) => g._id !== a),
35
+ ...r.modules.scheduler.filter((_) => _._id !== a),
36
36
  m
37
37
  ], r) : {
38
38
  ...q(),
@@ -54,15 +54,15 @@ function T(e, n, o) {
54
54
  throw new Error(`_insertItemOverriders - Item not found - ${e._id}`);
55
55
  const r = (l = a.groups) == null ? void 0 : l.map((d) => {
56
56
  var m, f, v;
57
- const i = (m = e == null ? void 0 : e.groups) == null ? void 0 : m.find((g) => g._id === d._id);
57
+ const i = (m = e == null ? void 0 : e.groups) == null ? void 0 : m.find((_) => _._id === d._id);
58
58
  let c;
59
- return i ? c = ((f = d.items) == null ? void 0 : f.map((g) => {
60
- var b;
61
- const y = (b = i.items) == null ? void 0 : b.find(
62
- (R) => R._id === g._id && R.combinationKey === g.combinationKey
59
+ return i ? c = ((f = d.items) == null ? void 0 : f.map((_) => {
60
+ var C;
61
+ const y = (C = i.items) == null ? void 0 : C.find(
62
+ (I) => I._id === _._id && I.combinationKey === _.combinationKey
63
63
  );
64
- return T(y || g, n, o + 1);
65
- })) ?? [] : c = ((v = d.items) == null ? void 0 : v.map((g) => T(g, n, o + 1))) ?? [], {
64
+ return T(y || _, n, o + 1);
65
+ })) ?? [] : c = ((v = d.items) == null ? void 0 : v.map((_) => T(_, n, o + 1))) ?? [], {
66
66
  ...d,
67
67
  items: c
68
68
  };
@@ -75,17 +75,17 @@ function T(e, n, o) {
75
75
  groups: r
76
76
  };
77
77
  }
78
- function Ue(e, n) {
78
+ function De(e, n) {
79
79
  const o = e.groups.map((l) => {
80
80
  const d = n.modules.group.find((c) => c._id === l._id), i = ((d == null ? void 0 : d.items) || []).map((c) => {
81
81
  var v;
82
82
  const m = (v = l.items) == null ? void 0 : v.find(
83
- (g) => g._id === c._id && g.combinationKey === c.combinationKey
83
+ (_) => _._id === c._id && _.combinationKey === c.combinationKey
84
84
  );
85
85
  if (m)
86
86
  return T(m, n, 1);
87
87
  const f = {
88
- ...I.generator.initMenuV4ItemOverrider(),
88
+ ...k.generator.initMenuV4ItemOverrider(),
89
89
  _id: c._id,
90
90
  combinationKey: c.combinationKey
91
91
  };
@@ -93,7 +93,7 @@ function Ue(e, n) {
93
93
  });
94
94
  return { ...l, items: i };
95
95
  }), a = e.variant ? e.variant.variantCombinations.map((l) => T(l, n, 1)) : [], r = {
96
- ...I.generator.initMenuV4ItemOverrider(),
96
+ ...k.generator.initMenuV4ItemOverrider(),
97
97
  _id: e._id,
98
98
  name: e.name,
99
99
  code: e.code,
@@ -101,7 +101,7 @@ function Ue(e, n) {
101
101
  };
102
102
  return [...a, r];
103
103
  }
104
- function D(e, n) {
104
+ function H(e, n) {
105
105
  var a;
106
106
  if (!n)
107
107
  return e;
@@ -114,11 +114,11 @@ function D(e, n) {
114
114
  const m = (f = l == null ? void 0 : l.items) == null ? void 0 : f.find(
115
115
  (v) => v._id === c._id && v.combinationKey === c.combinationKey
116
116
  );
117
- return D(c, m);
117
+ return H(c, m);
118
118
  }), r;
119
119
  }), o;
120
120
  }
121
- function De(e, n) {
121
+ function He(e, n) {
122
122
  const o = e.items[n._id];
123
123
  n.variant && (n.variant = {
124
124
  ...n.variant,
@@ -128,7 +128,7 @@ function De(e, n) {
128
128
  );
129
129
  if (!l)
130
130
  throw new Error(`Item overrider not found - ${r._id} - ${r.combinationKey}`);
131
- return D(l, r);
131
+ return H(l, r);
132
132
  })
133
133
  });
134
134
  const a = o.find((r) => !r.combinationKey);
@@ -142,7 +142,7 @@ function De(e, n) {
142
142
  const c = (m = l == null ? void 0 : l.items) == null ? void 0 : m.find(
143
143
  (f) => f._id === i._id && f.combinationKey === i.combinationKey
144
144
  );
145
- return D(i, c);
145
+ return H(i, c);
146
146
  }), r;
147
147
  }), {
148
148
  ...n,
@@ -150,19 +150,19 @@ function De(e, n) {
150
150
  };
151
151
  }
152
152
  async function et(e, n, o, a, r, l = !0) {
153
- const d = k(o), i = l ? He(n, d, a, r) : d, c = n.reduce((v, g) => (v[g._id] = i.modules.item.find((y) => y._id === g._id), v), {}), m = n.reduce((v, g) => {
154
- const y = g._id;
155
- return v[y] = Ue(c[y], e), v;
156
- }, {}), f = I.getFallbackPrices({
153
+ const d = R(o), i = l ? Ue(n, d, a, r) : d, c = n.reduce((v, _) => (v[_._id] = i.modules.item.find((y) => y._id === _._id), v), {}), m = n.reduce((v, _) => {
154
+ const y = _._id;
155
+ return v[y] = De(c[y], e), v;
156
+ }, {}), f = k.getFallbackPrices({
157
157
  rawMenu: i,
158
158
  items: m,
159
159
  catalogId: a || void 0,
160
160
  schedulerId: r
161
161
  });
162
162
  return n.map((v) => {
163
- const g = v._id, y = c[g];
163
+ const _ = v._id, y = c[_];
164
164
  return {
165
- ...De(f, y),
165
+ ...He(f, y),
166
166
  category: a || r ? y == null ? void 0 : y.category : null
167
167
  };
168
168
  });
@@ -180,22 +180,22 @@ function tt(e, n) {
180
180
  return r;
181
181
  }, [])) || []).join(" / ");
182
182
  }
183
- const $ = /* @__PURE__ */ new Map();
183
+ const x = /* @__PURE__ */ new Map();
184
184
  async function nt(e, n) {
185
185
  const o = `${e._id}-${e.updatedAt}-${n}`;
186
- if ($.has(o))
187
- return $.get(o);
188
- const a = await G(
189
- xe,
186
+ if (x.has(o))
187
+ return x.get(o);
188
+ const a = await L(
189
+ Ne,
190
190
  JSON.stringify({
191
191
  menu: e,
192
192
  itemId: n
193
193
  })
194
194
  );
195
- return $.set(o, a), a;
195
+ return x.set(o, a), a;
196
196
  }
197
- async function Z(e, n, o) {
198
- return await G($e, {
197
+ async function Q(e, n, o) {
198
+ return await L(xe, {
199
199
  menu: e,
200
200
  catalogId: n,
201
201
  schedulerId: o
@@ -231,18 +231,18 @@ function ot(e, n, o) {
231
231
  }
232
232
  return r(n, o);
233
233
  }
234
- const P = /* @__PURE__ */ new Map();
235
- async function Be(e, n, o) {
234
+ const $ = /* @__PURE__ */ new Map();
235
+ async function We(e, n, o) {
236
236
  const a = `${e._id}-${e.updatedAt}-${n || "null"}-${o || "null"}`;
237
- if (P.has(a))
238
- return P.get(a);
239
- const r = await Z(e, n, o);
240
- return P.set(a, r), r;
237
+ if ($.has(a))
238
+ return $.get(a);
239
+ const r = await Q(e, n, o);
240
+ return $.set(a, r), r;
241
241
  }
242
242
  async function st(e, n, o) {
243
243
  var d, i;
244
- const a = await Be(e, n, null), r = [], l = (c, m) => {
245
- const f = k(c);
244
+ const a = await We(e, n, null), r = [], l = (c, m) => {
245
+ const f = R(c);
246
246
  for (const v in m)
247
247
  m[v] && (f[v] = m[v]);
248
248
  return f;
@@ -250,25 +250,25 @@ async function st(e, n, o) {
250
250
  for (const c of a.modules.group) {
251
251
  const m = (d = c.items) == null ? void 0 : d.find((v) => v._id === o && !v.combinationKey), f = e.modules.item.find((v) => v._id === o);
252
252
  if (m) {
253
- const v = (i = c.items) == null ? void 0 : i.filter((y) => y._id === o && y.combinationKey), g = [m, ...v].map((y) => {
253
+ const v = (i = c.items) == null ? void 0 : i.filter((y) => y._id === o && y.combinationKey), _ = [m, ...v].map((y) => {
254
254
  var F, A;
255
- const b = y.combinationKey ? (A = (F = f == null ? void 0 : f.variant) == null ? void 0 : F.variantCombinations) == null ? void 0 : A.find(
256
- (K) => K.combinationKey === y.combinationKey
257
- ) : f, R = b && f ? l(f, b) : y;
258
- return l(R, y);
255
+ const C = y.combinationKey ? (A = (F = f == null ? void 0 : f.variant) == null ? void 0 : F.variantCombinations) == null ? void 0 : A.find(
256
+ (P) => P.combinationKey === y.combinationKey
257
+ ) : f, I = C && f ? l(f, C) : y;
258
+ return l(I, y);
259
259
  });
260
260
  r.push({
261
261
  group: c,
262
- items: g
262
+ items: _
263
263
  });
264
264
  }
265
265
  }
266
266
  return r;
267
267
  }
268
- function We({
268
+ function Ge({
269
269
  maxHistorySize: e = 50
270
270
  }) {
271
- const n = X([]), o = U(-1), a = h(() => o.value > 0), r = h(() => o.value < n.value.length - 1);
271
+ const n = X([]), o = D(-1), a = h(() => o.value > 0), r = h(() => o.value < n.value.length - 1);
272
272
  function l(m) {
273
273
  n.value.push(m), o.value++, n.value.length > e && (n.value.shift(), o.value--);
274
274
  }
@@ -294,7 +294,7 @@ function We({
294
294
  }
295
295
  const je = {
296
296
  async updateMenuModule(e, n) {
297
- const o = H.RequestRunner.operation(n, e.modules);
297
+ const o = U.RequestRunner.operation(n, e.modules);
298
298
  if (o.validateError.length > 0)
299
299
  throw new Error(o.validateError.join(`
300
300
  `));
@@ -306,7 +306,7 @@ const je = {
306
306
  return Y.cloneDeep({ menu: a, updateId: o.id ?? null });
307
307
  }
308
308
  };
309
- function Q() {
309
+ function Z() {
310
310
  return {
311
311
  _id: "",
312
312
  masterCatalogSetting: { inclusiveTaxes: [] },
@@ -332,22 +332,25 @@ function Q() {
332
332
  function qe() {
333
333
  return {
334
334
  restaurants: [],
335
- menu: { ...Q(), _rev: "" },
335
+ menu: { ...Z(), _rev: "" },
336
336
  currentCatalogId: null,
337
337
  currentCategoryIds: null,
338
338
  currentSchedulerId: "",
339
- currentRestaurantCustomAttributes: null
339
+ currentRestaurantAttrParams: {
340
+ restaurantCustomAttributes: null,
341
+ restaurantAttributes: null
342
+ }
340
343
  };
341
344
  }
342
345
  const at = Ae(
343
346
  "mf-menu-store-v2",
344
347
  () => {
345
- const e = Ke(qe()), n = L(), o = Ne(), a = h(() => e.menu.modules.serveSequence ? w(e.menu.modules.serveSequence, {
348
+ const e = Pe(qe()), n = z(), o = Oe(), a = h(() => e.menu.modules.serveSequence ? w(e.menu.modules.serveSequence, {
346
349
  selector: "position"
347
350
  }) : []), r = h(() => {
348
351
  var t;
349
- return ((t = n.currentBusiness.value) == null ? void 0 : t.menuVersion) || x.F_MENU_VERSION.v3;
350
- }), l = h(() => r.value === x.F_MENU_VERSION.v4), d = h(() => {
352
+ return ((t = n.currentBusiness.value) == null ? void 0 : t.menuVersion) || N.F_MENU_VERSION.v3;
353
+ }), l = h(() => r.value === N.F_MENU_VERSION.v4), d = h(() => {
351
354
  const t = e.menu.modules.catalog;
352
355
  return w(t, { selector: "name" });
353
356
  }), i = h(() => {
@@ -355,10 +358,11 @@ const at = Ae(
355
358
  let t = e.menu.modules.catalog.find(
356
359
  (u) => u._id === e.currentCatalogId
357
360
  );
358
- return t && ((s = t.linkItemRules) != null && s.length) && (t = I.populateCatalog({
361
+ return t && ((s = t.linkItemRules) != null && s.length) && (t = k.populateCatalog({
359
362
  catalog: t,
363
+ ruleGroupSettings: e.menu.ruleGroupSettings,
360
364
  items: e.menu.modules.item,
361
- restaurantCustomAttributes: e.currentRestaurantCustomAttributes || {}
365
+ ...e.currentRestaurantAttrParams ?? {}
362
366
  })), t;
363
367
  }), c = h(() => w(v.value.modules.scheduler, { selector: "name" })), m = h(() => e.menu.modules.scheduler.find(
364
368
  (t) => t._id === e.currentSchedulerId
@@ -366,20 +370,21 @@ const at = Ae(
366
370
  function f(t, s = !0) {
367
371
  e.menu = { ...t, _rev: e.menu._rev }, s && M.push(e.menu);
368
372
  }
369
- const v = X(Q()), g = U(!1), y = U(1);
370
- async function b() {
373
+ const v = X(Z()), _ = D(!1), y = D(1);
374
+ async function C() {
371
375
  var u;
372
- g.value = !0;
376
+ _.value = !0;
373
377
  let t = e.menu.modules.catalog;
374
378
  if (i.value && ((u = i.value.linkItemRules) != null && u.length)) {
375
- const p = I.populateCatalog({
379
+ const p = k.populateCatalog({
376
380
  catalog: i.value,
381
+ ruleGroupSettings: e.menu.ruleGroupSettings,
377
382
  items: e.menu.modules.item,
378
- restaurantCustomAttributes: e.currentRestaurantCustomAttributes || {}
383
+ ...e.currentRestaurantAttrParams ?? {}
379
384
  });
380
- t = e.menu.modules.catalog.map((_) => _._id === (p == null ? void 0 : p._id) ? p : _);
385
+ t = e.menu.modules.catalog.map((g) => g._id === (p == null ? void 0 : p._id) ? p : g);
381
386
  }
382
- const s = await Z(
387
+ const s = await Q(
383
388
  {
384
389
  ...e.menu,
385
390
  modules: {
@@ -392,24 +397,24 @@ const at = Ae(
392
397
  );
393
398
  if (e.currentSchedulerId != null) {
394
399
  const p = e.menu.modules.catalog.find(
395
- (S) => S._id === e.currentCatalogId
396
- ), _ = p ? p.override.scheduler[e.currentSchedulerId] : e.menu.modules.scheduler.find(
397
- (S) => S._id === e.currentSchedulerId
398
- ), C = new Set(((_ == null ? void 0 : _.items) || []).map((S) => S._id));
399
- s.modules.item = s.modules.item.filter((S) => C.has(S._id));
400
+ (b) => b._id === e.currentCatalogId
401
+ ), g = p ? p.override.scheduler[e.currentSchedulerId] : e.menu.modules.scheduler.find(
402
+ (b) => b._id === e.currentSchedulerId
403
+ ), S = new Set(((g == null ? void 0 : g.items) || []).map((b) => b._id));
404
+ s.modules.item = s.modules.item.filter((b) => S.has(b._id));
400
405
  }
401
- return v.value = s, g.value = !1, y.value = y.value + 1, s;
406
+ return v.value = s, _.value = !1, y.value = y.value + 1, s;
402
407
  }
403
- const F = Y.debounce(b, 200);
404
- Oe(!0).run(() => {
405
- Ve(
408
+ const F = Y.debounce(C, 200);
409
+ Ve(!0).run(() => {
410
+ Ke(
406
411
  () => [e.menu, e.currentCatalogId, e.currentSchedulerId],
407
412
  () => {
408
- g.value || F();
413
+ _.value || F();
409
414
  }
410
415
  );
411
416
  });
412
- const K = h(() => [
417
+ const P = h(() => [
413
418
  {
414
419
  label: "Main",
415
420
  value: null
@@ -418,10 +423,10 @@ const at = Ae(
418
423
  label: t.name,
419
424
  value: t._id
420
425
  }))
421
- ]), B = h(() => {
426
+ ]), W = h(() => {
422
427
  const t = v.value.modules.category;
423
428
  return [
424
- ...V.value.item.addon ? [
429
+ ...K.value.item.addon ? [
425
430
  {
426
431
  _id: e.currentCatalogId ? "" : null,
427
432
  name: "Addon",
@@ -433,31 +438,31 @@ const at = Ae(
433
438
  }), ee = h(() => {
434
439
  const t = v.value.modules.subCategory || [];
435
440
  return E(t, (s) => s.name);
436
- }), W = h(() => {
441
+ }), G = h(() => {
437
442
  var s;
438
443
  let t = v.value.modules.item;
439
444
  if (i.value) {
440
445
  const u = (s = i.value) == null ? void 0 : s.override.items;
441
446
  t = t.filter((p) => {
442
- var C;
443
- const _ = (C = u == null ? void 0 : u[p._id]) == null ? void 0 : C.find(
444
- (S) => !S.combinationKey
447
+ var S;
448
+ const g = (S = u == null ? void 0 : u[p._id]) == null ? void 0 : S.find(
449
+ (b) => !b.combinationKey
445
450
  );
446
- return (_ == null ? void 0 : _.orderFrom) !== J.F_ORDER_FROM.enum.NONE;
451
+ return (g == null ? void 0 : g.orderFrom) !== J.F_ORDER_FROM.enum.NONE;
447
452
  });
448
453
  }
449
454
  return E(t, (u) => u.code || u.name);
450
455
  }), te = h(() => {
451
456
  const t = e.menu.modules.category, s = E(t, (p) => p.name).reduce(
452
- (p, _, C) => (p[_._id] = C, p),
457
+ (p, g, S) => (p[g._id] = S, p),
453
458
  { "": 0 }
454
459
  ), u = e.menu.modules.item;
455
460
  return E(
456
461
  u,
457
462
  (p) => p.code || p.name
458
- ).reduce((p, _, C) => (p[_._id] = C + s[_.category || ""], p), {});
459
- }), ne = h(() => z(O.value, B.value, W.value)), re = h(() => {
460
- const t = V.value.item.addon ? [
463
+ ).reduce((p, g, S) => (p[g._id] = S + s[g.category || ""], p), {});
464
+ }), ne = h(() => B(V.value, W.value, G.value)), re = h(() => {
465
+ const t = K.value.item.addon ? [
461
466
  {
462
467
  _id: e.currentCatalogId ? "" : null,
463
468
  name: "Addon",
@@ -465,18 +470,18 @@ const at = Ae(
465
470
  },
466
471
  ...e.menu.modules.category
467
472
  ] : e.menu.modules.category;
468
- return z(
473
+ return B(
469
474
  e.menu.modules.variant,
470
475
  t,
471
476
  e.menu.modules.item
472
477
  );
473
- }), O = h(() => {
478
+ }), V = h(() => {
474
479
  const t = v.value.modules.variant;
475
480
  return w(t, { selector: "name" });
476
481
  });
477
482
  function oe(t = []) {
478
- const s = t.map((p) => O.value.find((_) => _._id === p)).filter((p) => !!p);
479
- return I.fullVariantCombination(s).reduce((p, _) => (p[_.combinationKey] = _.selectionName.join(" / "), p), {});
483
+ const s = t.map((p) => V.value.find((g) => g._id === p)).filter((p) => !!p);
484
+ return k.fullVariantCombination(s).reduce((p, g) => (p[g.combinationKey] = g.selectionName.join(" / "), p), {});
480
485
  }
481
486
  const se = h(() => E(v.value.modules.group, (t) => t.name)), ae = h(() => w(v.value.modules.takeaway, { selector: "name" })), ue = h(() => w(e.menu.modules.printDepartment || [], {
482
487
  selector: "name"
@@ -485,8 +490,8 @@ const at = Ae(
485
490
  })), le = h(() => e.menu.modules.cookingGuide), de = h(() => {
486
491
  const t = Ee(e.menu.modules.sku);
487
492
  return w(t, { selector: "code" });
488
- }), V = h(() => {
489
- const t = !e.currentCatalogId, s = r.value === x.F_MENU_VERSION.v4, u = !e.currentSchedulerId, p = {
493
+ }), K = h(() => {
494
+ const t = !e.currentCatalogId, s = r.value === N.F_MENU_VERSION.v4, u = !e.currentSchedulerId, p = {
490
495
  create: t && u,
491
496
  edit: t && u,
492
497
  delete: t && u
@@ -520,7 +525,7 @@ const at = Ae(
520
525
  bindToVariant: s,
521
526
  print: t && u,
522
527
  toRoot: s && u,
523
- takeaway: (_) => !!_ && (s || t) && u,
528
+ takeaway: (g) => !!g && (s || t) && u,
524
529
  multiScheduler: s,
525
530
  canRearrange: s,
526
531
  printConfig: s
@@ -554,7 +559,7 @@ const at = Ae(
554
559
  }
555
560
  };
556
561
  });
557
- function N(t) {
562
+ function O(t) {
558
563
  return `${t.systemCode}/${t.taxCode}`;
559
564
  }
560
565
  function me(t) {
@@ -562,27 +567,27 @@ const at = Ae(
562
567
  return { systemCode: s, taxCode: u };
563
568
  }
564
569
  function fe(t, s, u) {
565
- return (t ?? s ?? []).map((p) => N(p)).find((p) => u.some((_) => _.value === p));
570
+ return (t ?? s ?? []).map((p) => O(p)).find((p) => u.some((g) => g.value === p));
566
571
  }
567
572
  const pe = h(() => {
568
573
  var p;
569
- const t = ["SV5", "SV10"], s = ke.Country.getCountryFlattenTaxes(
570
- L().currentCountry.value
571
- ), u = s.filter((_) => l.value || !t.includes(_.taxCode)).map((_) => ({
572
- label: `${_.name} (${Ie(_.rate)}%)`,
573
- value: N(_),
574
+ const t = ["SV5", "SV10"], s = Re.Country.getCountryFlattenTaxes(
575
+ z().currentCountry.value
576
+ ), u = s.filter((g) => l.value || !t.includes(g.taxCode)).map((g) => ({
577
+ label: `${g.name} (${ke(g.rate)}%)`,
578
+ value: O(g),
574
579
  meta: {
575
- rate: _.rate
580
+ rate: g.rate
576
581
  }
577
582
  }));
578
- return u.sort((_, C) => _.label.localeCompare(C.label, void 0, { numeric: !0 })), {
583
+ return u.sort((g, S) => g.label.localeCompare(S.label, void 0, { numeric: !0 })), {
579
584
  systemCode: (p = s[0]) == null ? void 0 : p.systemCode,
580
585
  countryTaxOptions: u
581
586
  };
582
587
  }), ve = async () => {
583
588
  const t = await Fe.readMenu();
584
589
  e.menu = t ?? e.menu, j(null);
585
- }, _e = async () => {
590
+ }, ge = async () => {
586
591
  const { fetchAllRestaurants: t } = Te();
587
592
  await t({
588
593
  onBatchEnd: (s) => {
@@ -591,37 +596,37 @@ const at = Ae(
591
596
  });
592
597
  }, j = (t) => {
593
598
  e.currentCatalogId = t;
594
- }, ge = (t) => {
599
+ }, _e = (t) => {
595
600
  e.currentSchedulerId = t;
596
601
  }, ye = (t) => {
597
602
  e.currentCategoryIds = t;
598
603
  }, he = (t) => {
599
- e.currentRestaurantCustomAttributes = t;
600
- }, Ce = async (t, s) => {
604
+ e.currentRestaurantAttrParams = t;
605
+ }, Se = async (t, s) => {
601
606
  const u = Array.isArray(t) ? t : [t];
602
607
  if (!u.length) return;
603
- const p = u.map((_) => ({
604
- ..._,
608
+ const p = u.map((g) => ({
609
+ ...g,
605
610
  _id: e.menu._id,
606
611
  _rev: e.menu._rev
607
612
  }));
608
613
  try {
609
614
  if (s || p.some(
610
- (C) => [H.F_OPERATION_TYPE.delete, H.F_OPERATION_TYPE.deleteMany].includes(C.operation)
615
+ (S) => [U.F_OPERATION_TYPE.delete, U.F_OPERATION_TYPE.deleteMany].includes(S.operation)
611
616
  )) {
612
- const C = await Re(p, e.menu.modules);
613
- if (C !== !0) throw new Error(C);
617
+ const S = await Ie(p, e.menu.modules);
618
+ if (S !== !0) throw new Error(S);
614
619
  }
615
- const _ = await je.updateMenuModule(e.menu, p);
616
- return f(_.menu), _;
617
- } catch (_) {
620
+ const g = await je.updateMenuModule(e.menu, p);
621
+ return f(g.menu), g;
622
+ } catch (g) {
618
623
  o.open({
619
624
  type: "error",
620
625
  title: "Failed to update menu",
621
- message: _
626
+ message: g
622
627
  });
623
628
  }
624
- }, be = async (t) => {
629
+ }, Ce = async (t) => {
625
630
  const s = {
626
631
  ...e.menu,
627
632
  masterCatalogSetting: t.masterCatalogSetting,
@@ -629,11 +634,11 @@ const at = Ae(
629
634
  priceTierSettings: t.priceTierSettings
630
635
  };
631
636
  return f(s), s;
632
- }, M = We({ maxHistorySize: 50 }), Se = h(() => M.canUndo.value), we = h(() => M.canRedo.value);
637
+ }, M = Ge({ maxHistorySize: 50 }), be = h(() => M.canUndo.value), we = h(() => M.canRedo.value);
633
638
  return {
634
639
  state: e,
635
640
  // loading state
636
- workerIsComputing: g,
641
+ workerIsComputing: _,
637
642
  mergedMenuChangeId: y,
638
643
  // async computed state
639
644
  mergedMenu: v,
@@ -645,14 +650,14 @@ const at = Ae(
645
650
  currentCatalog: i,
646
651
  schedulers: c,
647
652
  currentScheduler: m,
648
- catalogOptions: K,
649
- categories: B,
653
+ catalogOptions: P,
654
+ categories: W,
650
655
  subcategories: ee,
651
- items: W,
656
+ items: G,
652
657
  sortedItems: te,
653
658
  categorizedItems: ne,
654
659
  categorizedRawMenuItems: re,
655
- variants: O,
660
+ variants: V,
656
661
  groups: se,
657
662
  takeaways: ae,
658
663
  printDepartments: ue,
@@ -660,26 +665,26 @@ const at = Ae(
660
665
  recipes: ce,
661
666
  cookingGuide: le,
662
667
  skus: de,
663
- rules: V,
668
+ rules: K,
664
669
  taxSetting: pe,
665
670
  // Action
666
671
  setMenu: f,
667
672
  readMenu: ve,
668
- readRestaurants: _e,
673
+ readRestaurants: ge,
669
674
  selectCatalog: j,
670
- selectScheduler: ge,
675
+ selectScheduler: _e,
671
676
  selectCategory: ye,
672
- setRestaurantCustomAttributes: he,
673
- updateMenu: Ce,
674
- updateMenuSetting: be,
675
- computeMergedMenu: b,
677
+ setRestaurantAttrParams: he,
678
+ updateMenu: Se,
679
+ updateMenuSetting: Ce,
680
+ computeMergedMenu: C,
676
681
  // helper
677
- encodeTax: N,
682
+ encodeTax: O,
678
683
  decodeTax: me,
679
684
  getSelectedTax: fe,
680
685
  mapVariant: oe,
681
686
  // history
682
- canUndoHistory: Se,
687
+ canUndoHistory: be,
683
688
  canRedoHistory: we,
684
689
  undoHistory: () => {
685
690
  const t = M.undo();
@@ -702,6 +707,6 @@ export {
702
707
  st as f,
703
708
  tt as g,
704
709
  et as m,
705
- Be as o,
710
+ We as o,
706
711
  at as u
707
712
  };