@feedmepos/mf-order-setting 0.0.102 → 0.0.103

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 (139) hide show
  1. package/dist/{DisplaySystemView-jnt6letY.js → DisplaySystemView-BBiZqcWq.js} +1497 -1468
  2. package/dist/{FoodCourtInvitationsView-DoynqFWB.js → FoodCourtInvitationsView-DwOkVs9m.js} +4 -4
  3. package/dist/{FoodCourtOrderSettingsView-DYZLhTHy.js → FoodCourtOrderSettingsView-C9Ag5Bsg.js} +1 -1
  4. package/dist/FoodCourtOrdersView-y4EwK3sn.js +1173 -0
  5. package/dist/{FoodCourtStallsView-CRMTt5BB.js → FoodCourtStallsView-Bi8H-yR7.js} +2 -2
  6. package/dist/{FoodCourtStatusView-C-b-eI-8.js → FoodCourtStatusView-jugAzTKg.js} +1 -1
  7. package/dist/KioskDevicesView-CYiew4X5.js +4 -0
  8. package/dist/KioskDevicesView.vue_vue_type_script_setup_true_lang-BCvbeo7R.js +1497 -0
  9. package/dist/KioskSettingView-AKBiij9a.js +1124 -0
  10. package/dist/KioskView-zKB6mC8I.js +765 -0
  11. package/dist/{OrderSettingsView-BBCnekaj.js → OrderSettingsView-CoV_yX3m.js} +22064 -21635
  12. package/dist/{RestaurantSelector.vue_vue_type_script_setup_true_lang-DjoTyV6m.js → RestaurantSelector.vue_vue_type_script_setup_true_lang-KSMU_jGl.js} +1 -1
  13. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
  14. package/dist/{app-Dvk30CIa.js → app-CmuI6uSl.js} +3589 -2902
  15. package/dist/app.js +1 -1
  16. package/dist/{dayjs.min-DUFHhM7O.js → dayjs.min-B3MssMma.js} +1 -1
  17. package/dist/{featureFlag-BvcirzHS.js → featureFlag-CWvkPOBY.js} +123 -130
  18. package/dist/frontend/mf-order/src/api/food-court/index.d.ts +51 -0
  19. package/dist/frontend/mf-order/src/api/kiosk/index.d.ts +4 -0
  20. package/dist/frontend/mf-order/src/api/payment/index.d.ts +8 -0
  21. package/dist/frontend/mf-order/src/api/queue/index.d.ts +13 -0
  22. package/dist/frontend/mf-order/src/api/restaurant-setting/index.d.ts +9 -1
  23. package/dist/frontend/mf-order/src/app.d.ts +687 -0
  24. package/dist/frontend/mf-order/src/main.d.ts +687 -0
  25. package/dist/frontend/mf-order/src/modules/display-system/interface.d.ts +5 -0
  26. package/dist/frontend/mf-order/src/modules/kiosk/interface.d.ts +4 -0
  27. package/dist/frontend/mf-order/src/modules/kiosk/license.d.ts +92 -0
  28. package/dist/frontend/mf-order/src/modules/kiosk/outletLoad.d.ts +15 -0
  29. package/dist/frontend/mf-order/src/modules/kiosk/settingsSections.d.ts +24 -0
  30. package/dist/frontend/mf-order/src/modules/kiosk/useKioskSettings.d.ts +29 -0
  31. package/dist/frontend/mf-order/src/modules/payment/paymentDevice.d.ts +58 -0
  32. package/dist/frontend/mf-order/src/stores/kiosk/index.d.ts +67 -1
  33. package/dist/frontend/mf-order/src/stores/order-setting/index.d.ts +19 -10
  34. package/dist/frontend/mf-order/src/stores/payment/index.d.ts +59 -1
  35. package/dist/frontend/mf-order/src/views/food-court/food-court-export.d.ts +38 -0
  36. package/dist/frontend/mf-order/src/views/kiosk/devices/KioskDeviceCard.vue.d.ts +3 -0
  37. package/dist/frontend/mf-order/src/views/kiosk/devices/KioskDevicesView.vue.d.ts +7 -0
  38. package/dist/frontend/mf-order/src/views/kiosk/devices/KioskLicenseSummary.vue.d.ts +7 -0
  39. package/dist/frontend/mf-order/src/views/kiosk/devices/KioskLicensesView.vue.d.ts +6 -0
  40. package/dist/frontend/mf-order/src/views/kiosk/devices/KioskOtpDialog.vue.d.ts +3 -0
  41. package/dist/frontend/mf-order/src/views/kiosk/devices/KioskPaymentDeviceCard.vue.d.ts +17 -0
  42. package/dist/frontend/mf-order/src/views/kiosk/settings/KioskSettingView.vue.d.ts +5 -2
  43. package/dist/frontend/mf-order/src/views/order-settings/pickup/PickUpSettingDialogContent.vue.d.ts +0 -9
  44. package/dist/frontend/mf-order/src/views/order-settings/pos-status/PosOrderingStatus.vue.d.ts +17 -0
  45. package/dist/frontend/mf-order/src/views/order-settings/pos-status/pos-status.d.ts +44 -0
  46. package/dist/frontend/mf-order/src/views/order-settings/queue/called-message.d.ts +1 -0
  47. package/dist/frontend/mf-order/src/views/order-settings/queue/phone-join-mode.d.ts +25 -0
  48. package/dist/frontend/mf-order/tsconfig.app.tsbuildinfo +1 -1
  49. package/dist/{index-C4n5H7t3.js → index-BQa8AudZ.js} +3 -3
  50. package/dist/index-CMOvrim4.js +147 -0
  51. package/dist/{index-CW4VlFWz.js → index-D5qh2_4b.js} +1 -1
  52. package/dist/{index-C5n6lil6.js → index-Dup6kWLX.js} +6 -6
  53. package/dist/{index-CGxCWKHB.js → index-wuFIsXHT.js} +188 -179
  54. package/dist/{order.dto-Cb_gh3iB.js → order.dto-BD9raQG5.js} +2782 -2735
  55. package/dist/package/entity/display/blocks.d.ts +12 -2
  56. package/dist/package/entity/marketing/marketing.dto.d.ts +18 -18
  57. package/dist/package/entity/order-platform/external/reconciliation/external-reconciliation.do.d.ts +24 -24
  58. package/dist/package/entity/order-platform/menu.dto.d.ts +20 -20
  59. package/dist/package/entity/order-setting/order-setting.do.d.ts +10 -0
  60. package/dist/package/entity/order-setting/order-setting.dto.d.ts +26 -0
  61. package/dist/package/entity/order-setting/queue/queue.do.d.ts +23 -0
  62. package/dist/package/entity/order-setting/queue/queue.dto.d.ts +14 -0
  63. package/dist/package/entity/queue/queue.do.d.ts +153 -0
  64. package/dist/package/entity/queue/queue.dto.d.ts +221 -2
  65. package/dist/package/entity/queue/queue.enum.d.ts +5 -0
  66. package/dist/package/entity/restaurant/restaurant.dto.d.ts +20 -0
  67. package/dist/style.css +1 -1
  68. package/dist/{index-ILnighyU.js → useInternalUser-CHtaur9A.js} +93 -81
  69. package/package.json +2 -1
  70. package/src/api/food-court/index.ts +63 -0
  71. package/src/api/kiosk/index.ts +8 -0
  72. package/src/api/payment/index.ts +18 -1
  73. package/src/api/queue/index.ts +39 -0
  74. package/src/api/restaurant-setting/index.ts +14 -0
  75. package/src/locales/en-US.json +197 -26
  76. package/src/locales/ja-JP.json +193 -23
  77. package/src/locales/th-TH.json +193 -21
  78. package/src/locales/zh-CN.json +197 -23
  79. package/src/modules/display-system/interface.spec.ts +26 -1
  80. package/src/modules/display-system/interface.ts +20 -0
  81. package/src/modules/kiosk/interface.ts +4 -0
  82. package/src/modules/kiosk/license.spec.ts +167 -0
  83. package/src/modules/kiosk/license.ts +175 -0
  84. package/src/modules/kiosk/outletLoad.spec.ts +25 -0
  85. package/src/modules/kiosk/outletLoad.ts +19 -0
  86. package/src/modules/kiosk/settingsSections.spec.ts +85 -0
  87. package/src/modules/kiosk/settingsSections.ts +82 -0
  88. package/src/modules/kiosk/useKioskSettings.spec.ts +157 -0
  89. package/src/modules/kiosk/useKioskSettings.ts +61 -0
  90. package/src/modules/payment/paymentDevice.spec.ts +175 -0
  91. package/src/modules/payment/paymentDevice.ts +156 -0
  92. package/src/stores/kiosk/index.ts +16 -1
  93. package/src/stores/kiosk/mapper.ts +2 -0
  94. package/src/stores/order-setting/index.spec.ts +83 -0
  95. package/src/stores/order-setting/index.ts +49 -27
  96. package/src/stores/payment/index.spec.ts +86 -0
  97. package/src/stores/payment/index.ts +48 -2
  98. package/src/views/display-system/DisplayInspector.vue +17 -8
  99. package/src/views/display-system/DisplayTemplateEditor.vue +3 -1
  100. package/src/views/food-court/FoodCourtOrdersView.vue +46 -1
  101. package/src/views/food-court/food-court-export.spec.ts +151 -0
  102. package/src/views/food-court/food-court-export.ts +283 -0
  103. package/src/views/kiosk/KioskStatePanel.vue +2 -2
  104. package/src/views/kiosk/KioskView.vue +219 -82
  105. package/src/views/kiosk/devices/KioskDeviceCard.vue +148 -23
  106. package/src/views/kiosk/devices/KioskDevicesView.vue +48 -10
  107. package/src/views/kiosk/devices/KioskLicenseSummary.vue +79 -0
  108. package/src/views/kiosk/devices/KioskLicensesView.vue +152 -0
  109. package/src/views/kiosk/devices/KioskOtpDialog.vue +41 -1
  110. package/src/views/kiosk/devices/KioskPaymentDeviceCard.spec.ts +97 -0
  111. package/src/views/kiosk/devices/KioskPaymentDeviceCard.vue +221 -0
  112. package/src/views/kiosk/settings/KioskPaymentTypeSection.vue +1 -1
  113. package/src/views/kiosk/settings/KioskSettingView.vue +702 -419
  114. package/src/views/order-settings/delivery/DeliverySetting.vue +4 -0
  115. package/src/views/order-settings/dine-in/DineInSetting.vue +4 -0
  116. package/src/views/order-settings/pickup/PickUpSetting.vue +4 -4
  117. package/src/views/order-settings/pickup/PickUpSettingDialogContent.vue +0 -23
  118. package/src/views/order-settings/pos-status/PosOrderingStatus.spec.ts +207 -0
  119. package/src/views/order-settings/pos-status/PosOrderingStatus.vue +209 -0
  120. package/src/views/order-settings/pos-status/pos-status.spec.ts +103 -0
  121. package/src/views/order-settings/pos-status/pos-status.ts +86 -0
  122. package/src/views/order-settings/queue/QueueSetting.source.spec.ts +43 -0
  123. package/src/views/order-settings/queue/QueueSetting.vue +289 -15
  124. package/src/views/order-settings/queue/called-message.spec.ts +29 -1
  125. package/src/views/order-settings/queue/called-message.ts +18 -0
  126. package/src/views/order-settings/queue/phone-join-mode.spec.ts +90 -0
  127. package/src/views/order-settings/queue/phone-join-mode.ts +49 -0
  128. package/dist/FoodCourtOrdersView-CAPOycT3.js +0 -544
  129. package/dist/KioskDevicesView-B0U9JxRl.js +0 -4
  130. package/dist/KioskDevicesView.vue_vue_type_script_setup_true_lang-V3ai4FVI.js +0 -937
  131. package/dist/KioskSettingView-rdom_aS8.js +0 -880
  132. package/dist/KioskView-DOON9zR6.js +0 -516
  133. package/dist/frontend/mf-order/src/views/kiosk/settings/KioskDisplayStandSection.vue.d.ts +0 -10
  134. package/dist/frontend/mf-order/src/views/kiosk/settings/KioskInstructionSection.vue.d.ts +0 -15
  135. package/dist/frontend/mf-order/src/views/kiosk/settings/KioskPickAtCounterSection.vue.d.ts +0 -10
  136. package/dist/index-CaHG3M7C.js +0 -135
  137. package/src/views/kiosk/settings/KioskDisplayStandSection.vue +0 -189
  138. package/src/views/kiosk/settings/KioskInstructionSection.vue +0 -40
  139. package/src/views/kiosk/settings/KioskPickAtCounterSection.vue +0 -68
@@ -0,0 +1,1497 @@
1
+ import { ref as K, defineComponent as H, resolveComponent as D, openBlock as i, createElementBlock as u, createElementVNode as s, toDisplayString as l, unref as o, createVNode as h, computed as k, createBlock as $, withCtx as U, createCommentVNode as x, Fragment as L, renderList as Y, createTextVNode as F, watch as Pe, normalizeClass as $e, renderSlot as nt } from "vue";
2
+ import { useI18n as Z, useCoreStore as at } from "@feedmepos/mf-common";
3
+ import { defineStore as Le } from "pinia";
4
+ import { r as ee, g as oe, S as Fe, p as Ke } from "./index-BQa8AudZ.js";
5
+ import "./order.dto-BD9raQG5.js";
6
+ import { useSnackbar as Me, useDialog as ot } from "@feedmepos/ui-library";
7
+ import { d as G } from "./dayjs.min-B3MssMma.js";
8
+ import { c as rt, g as st, a as Be } from "./app-CmuI6uSl.js";
9
+ import { s as Se, u as it } from "./useInternalUser-CHtaur9A.js";
10
+ async function lt() {
11
+ const e = await ee().get("/kiosk/otp");
12
+ return oe(e);
13
+ }
14
+ async function ct() {
15
+ const e = await ee().get("/kiosk/devices");
16
+ return oe(e);
17
+ }
18
+ async function dt() {
19
+ const e = await ee().get("/kiosk/licenses");
20
+ return oe(e);
21
+ }
22
+ async function ut(e) {
23
+ await ee().delete(`/kiosk/unbind/${e}`);
24
+ }
25
+ async function mt(e, t) {
26
+ await ee().put(`/kiosk/updateDevicePin/${t}`, { pinInfo: e });
27
+ }
28
+ async function pt(e, t) {
29
+ await ee().put(`/kiosk/updateDevicePin/${t}`, { remarkInfo: e });
30
+ }
31
+ const J = {
32
+ requestOtp: lt,
33
+ getDevices: ct,
34
+ getLicenses: dt,
35
+ unbind: ut,
36
+ updateDevicePin: mt,
37
+ updateDeviceRemark: pt
38
+ }, yt = (e) => ({
39
+ name: e.name ?? "N/A",
40
+ machineId: e.machineId,
41
+ config: {
42
+ scannerInfo: e.scannerInfo ?? void 0,
43
+ printerInfo: e.printerInfo ?? void 0,
44
+ terminalInfo: e.terminalInfo ?? void 0
45
+ },
46
+ activatedAt: vt(e.token),
47
+ deviceAppType: e.deviceAppType ?? void 0,
48
+ remarkInfo: e.remarkInfo ?? void 0,
49
+ slotInfo: e.slotInfo ?? void 0,
50
+ pinInfo: e.pinInfo ?? void 0,
51
+ deviceAppVersion: e.deviceAppVersion ?? void 0,
52
+ deviceAppOTAVersion: e.deviceAppOTAVersion ?? void 0,
53
+ webviewVersion: e.webviewVersion ?? void 0,
54
+ operatingSystem: e.operatingSystem ?? void 0,
55
+ osVersion: e.osVersion ?? void 0,
56
+ lastStartup: e.lastStartup ? new Date(e.lastStartup) : void 0,
57
+ licenseId: e.licenseId ?? void 0,
58
+ licenseExpiredAt: e.expiredAt ? new Date(e.expiredAt) : void 0
59
+ });
60
+ function vt(e) {
61
+ const t = e.substring(0, 8), r = parseInt(t, 16);
62
+ return new Date(r * 1e3);
63
+ }
64
+ const ft = {
65
+ toMfKioskDevice: yt
66
+ }, ht = Le("kiosk", () => {
67
+ const e = K({
68
+ otp: "",
69
+ devices: [],
70
+ licenses: null
71
+ });
72
+ async function t() {
73
+ const p = await J.requestOtp();
74
+ e.value.otp = p.otp;
75
+ }
76
+ async function r() {
77
+ const p = await J.getDevices();
78
+ e.value.devices = p.map((d) => ft.toMfKioskDevice(d));
79
+ }
80
+ async function v() {
81
+ try {
82
+ e.value.licenses = await J.getLicenses();
83
+ } catch (p) {
84
+ throw e.value.licenses = null, p;
85
+ }
86
+ }
87
+ async function m(p) {
88
+ await J.unbind(p), await Promise.all([r(), v().catch(() => {
89
+ })]);
90
+ }
91
+ async function f(p, d) {
92
+ await J.updateDevicePin(p, d), await r();
93
+ }
94
+ async function b(p, d) {
95
+ await J.updateDeviceRemark(p, d), await r();
96
+ }
97
+ return {
98
+ state: e.value,
99
+ requestOtp: t,
100
+ getDevices: r,
101
+ getLicenses: v,
102
+ unbind: m,
103
+ updateDevicePin: f,
104
+ updateDeviceRemark: b
105
+ };
106
+ });
107
+ var he = { exports: {} }, Ce;
108
+ function bt() {
109
+ return Ce || (Ce = 1, function(e, t) {
110
+ (function(r, v) {
111
+ e.exports = v();
112
+ })(rt, function() {
113
+ return function(r, v, m) {
114
+ r = r || {};
115
+ var f = v.prototype, b = { future: "in %s", past: "%s ago", s: "a few seconds", m: "a minute", mm: "%d minutes", h: "an hour", hh: "%d hours", d: "a day", dd: "%d days", M: "a month", MM: "%d months", y: "a year", yy: "%d years" };
116
+ function p(c, n, y, _) {
117
+ return f.fromToBase(c, n, y, _);
118
+ }
119
+ m.en.relativeTime = b, f.fromToBase = function(c, n, y, _, S) {
120
+ for (var T, g, M, O = y.$locale().relativeTime || b, B = r.thresholds || [{ l: "s", r: 44, d: "second" }, { l: "m", r: 89 }, { l: "mm", r: 44, d: "minute" }, { l: "h", r: 89 }, { l: "hh", r: 21, d: "hour" }, { l: "d", r: 35 }, { l: "dd", r: 25, d: "day" }, { l: "M", r: 45 }, { l: "MM", r: 10, d: "month" }, { l: "y", r: 17 }, { l: "yy", d: "year" }], q = B.length, z = 0; z < q; z += 1) {
121
+ var w = B[z];
122
+ w.d && (T = _ ? m(c).diff(y, w.d, !0) : y.diff(c, w.d, !0));
123
+ var N = (r.rounding || Math.round)(Math.abs(T));
124
+ if (M = T > 0, N <= w.r || !w.r) {
125
+ N <= 1 && z > 0 && (w = B[z - 1]);
126
+ var te = O[w.l];
127
+ S && (N = S("" + N)), g = typeof te == "string" ? te.replace("%d", N) : te(N, n, w.l, M);
128
+ break;
129
+ }
130
+ }
131
+ if (n) return g;
132
+ var W = M ? O.future : O.past;
133
+ return typeof W == "function" ? W(g) : W.replace("%s", g);
134
+ }, f.to = function(c, n) {
135
+ return p(c, n, this, !0);
136
+ }, f.from = function(c, n) {
137
+ return p(c, n, this);
138
+ };
139
+ var d = function(c) {
140
+ return c.$u ? m.utc() : m();
141
+ };
142
+ f.toNow = function(c) {
143
+ return this.to(d(this), c);
144
+ }, f.fromNow = function(c) {
145
+ return this.from(d(this), c);
146
+ };
147
+ };
148
+ });
149
+ }(he)), he.exports;
150
+ }
151
+ var gt = bt();
152
+ const kt = /* @__PURE__ */ st(gt), xt = /* @__PURE__ */ H({
153
+ __name: "KioskUnbindConfirm",
154
+ props: {
155
+ machineId: {}
156
+ },
157
+ emits: ["update:modelValue"],
158
+ setup(e, { emit: t }) {
159
+ const { t: r } = Z(), v = t, m = K("");
160
+ function f(b) {
161
+ v("update:modelValue", b);
162
+ }
163
+ return (b, p) => {
164
+ const d = D("FmTextField");
165
+ return i(), u("div", null, [
166
+ s("span", null, l(o(r)("order.unbindKioskDeviceWarning", { machineId: e.machineId })), 1),
167
+ h(d, {
168
+ "model-value": m.value,
169
+ "onUpdate:modelValue": f,
170
+ placeholder: e.machineId
171
+ }, null, 8, ["model-value", "placeholder"])
172
+ ]);
173
+ };
174
+ }
175
+ }), _t = {
176
+ key: 0,
177
+ class: "flex items-center gap-2 py-1 fm-typo-en-body-sm-400 text-fm-color-system-error-300"
178
+ }, It = {
179
+ key: 0,
180
+ class: "flex items-center gap-2 fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
181
+ }, Dt = { class: "grid grid-cols-1 gap-4" }, Tt = /* @__PURE__ */ H({
182
+ __name: "KioskPaymentCheckoutList",
183
+ props: {
184
+ checkouts: {},
185
+ loadError: { default: null }
186
+ },
187
+ setup(e) {
188
+ const { t } = Z(), r = e;
189
+ function v(d) {
190
+ return (d.action ?? "").replace(/[^a-z]/gi, "").toLowerCase();
191
+ }
192
+ function m(d) {
193
+ return d.type === "ecr" && v(d).includes("scanpay");
194
+ }
195
+ function f(d) {
196
+ return d.type === "ecr_qr" || d.type === "ecr" && v(d).includes("qr");
197
+ }
198
+ function b(d) {
199
+ const c = v(d);
200
+ return d.type === "ecr" && (c.includes("card") || c.includes("softpos"));
201
+ }
202
+ const p = k(() => {
203
+ const d = (n) => r.checkouts.some(n);
204
+ return [
205
+ {
206
+ key: "card",
207
+ label: t("order.bankCard"),
208
+ present: d((n) => n.type === "card")
209
+ },
210
+ {
211
+ key: "terminal-card",
212
+ label: t("order.terminalCard"),
213
+ present: d(b)
214
+ },
215
+ {
216
+ key: "qr-pay",
217
+ label: t("order.qrPay"),
218
+ present: d((n) => n.type === "qr")
219
+ },
220
+ {
221
+ key: "scan-pay",
222
+ label: t("order.scanPay"),
223
+ present: d((n) => n.type === "scanpay")
224
+ },
225
+ {
226
+ key: "terminal-scan-pay",
227
+ label: t("order.terminalScanPay"),
228
+ present: d(m)
229
+ },
230
+ {
231
+ key: "terminal-qr-pay",
232
+ label: t("order.terminalQrPay"),
233
+ present: d(f)
234
+ }
235
+ ];
236
+ });
237
+ return (d, c) => {
238
+ const n = D("FmIcon"), y = D("FmCheckbox"), _ = D("FmCardSection"), S = D("FmCard");
239
+ return e.loadError ? (i(), u("div", _t, [
240
+ h(n, {
241
+ name: "error_outline",
242
+ size: "sm",
243
+ class: "shrink-0"
244
+ }),
245
+ s("span", null, l(o(t)("order.paymentCheckoutLoadErrorTitle")), 1)
246
+ ])) : (i(), $(S, {
247
+ key: 1,
248
+ variant: "outlined"
249
+ }, {
250
+ default: U(() => [
251
+ h(_, { class: "flex flex-col gap-3" }, {
252
+ default: U(() => [
253
+ e.checkouts.length === 0 ? (i(), u("div", It, [
254
+ h(n, {
255
+ name: "credit_card_off",
256
+ size: "sm",
257
+ class: "shrink-0"
258
+ }),
259
+ s("span", null, l(o(t)("order.noPaymentCheckoutsTitle")), 1)
260
+ ])) : x("", !0),
261
+ s("div", Dt, [
262
+ (i(!0), u(L, null, Y(p.value, (T) => (i(), $(y, {
263
+ key: T.key,
264
+ "model-value": T.present,
265
+ value: T.key,
266
+ label: T.label,
267
+ disabled: ""
268
+ }, null, 8, ["model-value", "value", "label"]))), 128))
269
+ ])
270
+ ]),
271
+ _: 1
272
+ })
273
+ ]),
274
+ _: 1
275
+ }));
276
+ };
277
+ }
278
+ });
279
+ function ke(e) {
280
+ return typeof e == "object" && e !== null && !Array.isArray(e);
281
+ }
282
+ function R(e) {
283
+ return typeof e == "string" && e.trim() !== "" ? e : null;
284
+ }
285
+ function Re(e) {
286
+ return Array.isArray(e) ? e.filter(ke) : [];
287
+ }
288
+ function be(e) {
289
+ const t = Re(e).map((r) => R(r.gateway)).filter((r) => r !== null);
290
+ return [...new Set(t)];
291
+ }
292
+ function wt(e) {
293
+ const t = R(e.gateway);
294
+ if (!t) return null;
295
+ const r = ke(e.config) ? e.config : {};
296
+ return {
297
+ gateway: t,
298
+ merchantId: R(r.merchantId),
299
+ // FeedMe and GHL use terminalId; Beam and BRI use externalTerminalId.
300
+ terminalId: R(r.terminalId) ?? R(r.externalTerminalId)
301
+ };
302
+ }
303
+ function At(e) {
304
+ if (!ke(e)) return null;
305
+ const t = R(e._id), r = R(e.deviceId);
306
+ return !t || !r ? null : {
307
+ id: t,
308
+ name: R(e.name),
309
+ deviceId: r,
310
+ status: R(e.status),
311
+ softPosGateways: be(e.gateways),
312
+ ecrs: Re(e.ecrs).map(wt).filter((v) => v !== null),
313
+ ecrIntegrations: be(e.ecrIntegrations),
314
+ qrGateways: be(e.qrIntegrations)
315
+ };
316
+ }
317
+ function Pt(e) {
318
+ return Array.isArray(e) ? e.map(At).filter((t) => t !== null) : [];
319
+ }
320
+ function $t(e, t, r) {
321
+ const v = new URL(
322
+ `/payment/admin/terminal/kiosk/${encodeURIComponent(t)}`,
323
+ e
324
+ );
325
+ return r.country && v.searchParams.set("country", r.country), r.businessId && v.searchParams.set("businessId", r.businessId), r.restaurantId && v.searchParams.set("restaurantId", r.restaurantId), v.toString();
326
+ }
327
+ function St(e, t) {
328
+ return !e || !t ? !1 : !t.ecrs.some(
329
+ (r) => r.gateway.toLowerCase().startsWith("ghl") && r.merchantId === e.merchantId && r.terminalId === e.terminalId
330
+ );
331
+ }
332
+ const Ct = {
333
+ class: "w-full border p-[1.5rem] fm-corner-radius-lg flex flex-col gap-4",
334
+ "data-testid": "payment-device-card"
335
+ }, Et = { class: "flex items-center justify-between gap-2 flex-wrap" }, Lt = { class: "fm-typo-en-title-sm-600" }, Ft = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary" }, Kt = {
336
+ key: 0,
337
+ class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary",
338
+ "data-testid": "payment-device-loading"
339
+ }, Mt = {
340
+ key: 1,
341
+ class: "flex items-center justify-between gap-2 flex-wrap",
342
+ "data-testid": "payment-device-error"
343
+ }, Bt = { class: "flex items-center gap-2 fm-typo-en-body-sm-400 text-fm-color-system-error-300" }, Rt = {
344
+ key: 2,
345
+ class: "flex flex-col gap-2",
346
+ "data-testid": "payment-device-missing"
347
+ }, Ot = { class: "flex items-center gap-2 fm-typo-en-body-md-400 text-fm-color-typo-primary" }, Nt = { class: "flex flex-col gap-1" }, Vt = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Ut = ["title"], Yt = {
348
+ class: "grid grid-cols-1 md:grid-cols-2 gap-x-6 gap-y-4",
349
+ "data-testid": "payment-device-found"
350
+ }, qt = { class: "flex flex-col gap-1" }, zt = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, jt = { class: "flex flex-col gap-1" }, Gt = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Ht = { class: "fm-typo-en-body-md-600 text-fm-color-typo-primary break-all" }, Wt = { class: "flex flex-col gap-1" }, Qt = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Xt = { class: "fm-typo-en-body-md-600 text-fm-color-typo-primary break-all font-mono text-sm" }, Jt = { class: "flex flex-col gap-1" }, Zt = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, en = { class: "fm-typo-en-body-md-600 text-fm-color-typo-primary break-all font-mono text-sm" }, tn = {
351
+ class: "flex flex-col gap-3",
352
+ "data-testid": "payment-device-gateways"
353
+ }, nn = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, an = {
354
+ key: 0,
355
+ class: "fm-typo-en-body-md-400 text-fm-color-typo-tertiary"
356
+ }, on = ["href"], rn = {
357
+ key: 4,
358
+ class: "flex flex-col gap-2 border-t pt-4",
359
+ "data-testid": "payment-device-reported"
360
+ }, sn = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, ln = { class: "fm-typo-en-body-md-600 text-fm-color-typo-primary break-all" }, cn = { key: 0 }, dn = /* @__PURE__ */ H({
361
+ __name: "KioskPaymentDeviceCard",
362
+ props: {
363
+ paymentDevice: {},
364
+ loading: { type: Boolean },
365
+ loadError: { type: Boolean },
366
+ expectedDeviceId: {},
367
+ portalUrl: {},
368
+ reported: {}
369
+ },
370
+ emits: ["retry"],
371
+ setup(e, { emit: t }) {
372
+ const r = e, v = t, { t: m } = Z(), f = Me();
373
+ function b(n) {
374
+ const y = [n.gateway];
375
+ return n.merchantId && y.push(`${m("order.paymentDeviceMerchantId")} ${n.merchantId}`), n.terminalId && y.push(`${m("order.paymentDeviceTerminalId")} ${n.terminalId}`), y.join(" · ");
376
+ }
377
+ const p = k(() => {
378
+ const n = r.paymentDevice;
379
+ return n ? [
380
+ { key: "softpos", label: m("order.paymentDeviceSoftPos"), values: n.softPosGateways },
381
+ { key: "ecr", label: m("order.paymentDeviceEcr"), values: n.ecrs.map(b) },
382
+ {
383
+ key: "ecr-integrations",
384
+ label: m("order.paymentDeviceEcrIntegrations"),
385
+ values: n.ecrIntegrations
386
+ },
387
+ { key: "qr", label: m("order.paymentDeviceQr"), values: n.qrGateways }
388
+ ] : [];
389
+ }), d = k(
390
+ () => St(r.reported, r.paymentDevice)
391
+ );
392
+ async function c(n) {
393
+ try {
394
+ await navigator.clipboard.writeText(n), f.open({
395
+ type: "success",
396
+ message: m("order.paymentDeviceIdCopied"),
397
+ position: "bottom"
398
+ });
399
+ } catch {
400
+ f.open({
401
+ type: "error",
402
+ message: m("order.copyFailed"),
403
+ position: "bottom"
404
+ });
405
+ }
406
+ }
407
+ return (n, y) => {
408
+ const _ = D("FmIcon"), S = D("FmButton"), T = D("FmChip");
409
+ return i(), u("div", Ct, [
410
+ s("div", Et, [
411
+ s("span", Lt, l(o(m)("order.paymentDevice")), 1),
412
+ s("span", Ft, l(o(m)("order.paymentDeviceStaffOnly")), 1)
413
+ ]),
414
+ e.loading ? (i(), u("div", Kt, l(o(m)("order.paymentDeviceLoading")), 1)) : e.loadError ? (i(), u("div", Mt, [
415
+ s("span", Bt, [
416
+ h(_, {
417
+ name: "error_outline",
418
+ size: "sm",
419
+ class: "shrink-0"
420
+ }),
421
+ F(" " + l(o(m)("order.paymentDeviceLoadError")), 1)
422
+ ]),
423
+ h(S, {
424
+ variant: "tertiary",
425
+ size: "md",
426
+ label: o(m)("order.retry"),
427
+ onClick: y[0] || (y[0] = (g) => v("retry"))
428
+ }, null, 8, ["label"])
429
+ ])) : e.paymentDevice ? (i(), u(L, { key: 3 }, [
430
+ s("div", Yt, [
431
+ s("div", qt, [
432
+ s("span", zt, l(o(m)("order.paymentDeviceStatus")), 1),
433
+ s("span", null, [
434
+ h(T, {
435
+ compact: "",
436
+ variant: e.paymentDevice.status === "Active" ? "success" : "plain",
437
+ label: e.paymentDevice.status ?? o(m)("order.notSet")
438
+ }, null, 8, ["variant", "label"])
439
+ ])
440
+ ]),
441
+ s("div", jt, [
442
+ s("span", Gt, l(o(m)("order.paymentDeviceName")), 1),
443
+ s("span", Ht, l(e.paymentDevice.name ?? o(m)("order.notSet")), 1)
444
+ ]),
445
+ s("div", Wt, [
446
+ s("span", Qt, l(o(m)("order.paymentDeviceId")), 1),
447
+ s("span", Xt, l(e.paymentDevice.id), 1)
448
+ ]),
449
+ s("div", Jt, [
450
+ s("span", Zt, l(o(m)("order.paymentDeviceDeviceId")), 1),
451
+ s("span", en, l(e.paymentDevice.deviceId), 1)
452
+ ])
453
+ ]),
454
+ s("div", tn, [
455
+ (i(!0), u(L, null, Y(p.value, (g) => (i(), u("div", {
456
+ key: g.key,
457
+ class: "flex flex-col gap-1"
458
+ }, [
459
+ s("span", nn, l(g.label), 1),
460
+ g.values.length === 0 ? (i(), u("span", an, l(o(m)("order.paymentDeviceNone")), 1)) : x("", !0),
461
+ (i(!0), u(L, null, Y(g.values, (M) => (i(), u("span", {
462
+ key: M,
463
+ class: "fm-typo-en-body-md-600 text-fm-color-typo-primary break-all"
464
+ }, l(M), 1))), 128))
465
+ ]))), 128))
466
+ ]),
467
+ e.portalUrl ? (i(), u("a", {
468
+ key: 0,
469
+ href: e.portalUrl,
470
+ target: "_blank",
471
+ rel: "noopener noreferrer",
472
+ class: "self-start flex items-center gap-1 fm-typo-en-body-md-600 text-fm-color-primary underline",
473
+ "data-testid": "payment-device-portal-link"
474
+ }, [
475
+ F(l(o(m)("order.paymentDeviceOpenPortal")) + " ", 1),
476
+ h(_, {
477
+ name: "open_in_new",
478
+ size: "sm"
479
+ })
480
+ ], 8, on)) : x("", !0)
481
+ ], 64)) : (i(), u("div", Rt, [
482
+ s("span", Ot, [
483
+ h(_, {
484
+ name: "link_off",
485
+ size: "sm",
486
+ class: "shrink-0 text-fm-color-typo-secondary"
487
+ }),
488
+ F(" " + l(o(m)("order.paymentDeviceNotLinked")), 1)
489
+ ]),
490
+ s("div", Nt, [
491
+ s("span", Vt, l(o(m)("order.paymentDeviceExpectedId")), 1),
492
+ s("button", {
493
+ type: "button",
494
+ class: "text-left fm-typo-en-body-md-600 text-fm-color-typo-primary font-mono text-sm break-all flex items-center gap-1 group",
495
+ title: o(m)("order.clickToCopy"),
496
+ onClick: y[1] || (y[1] = (g) => c(e.expectedDeviceId))
497
+ }, [
498
+ F(l(e.expectedDeviceId) + " ", 1),
499
+ h(_, {
500
+ name: "content_copy",
501
+ size: "sm",
502
+ class: "shrink-0 text-fm-color-typo-tertiary opacity-0 group-hover:opacity-100 transition-opacity"
503
+ })
504
+ ], 8, Ut)
505
+ ])
506
+ ])),
507
+ e.reported ? (i(), u("div", rn, [
508
+ s("span", sn, l(o(m)("order.paymentDeviceReportedByKiosk")), 1),
509
+ s("span", ln, l(b({ gateway: e.reported.gateway, merchantId: e.reported.merchantId, terminalId: e.reported.terminalId })), 1),
510
+ d.value ? (i(), u("span", cn, [
511
+ h(T, {
512
+ compact: "",
513
+ variant: "warning",
514
+ icon: "warning",
515
+ label: o(m)("order.paymentDeviceReportedDiffers"),
516
+ "data-testid": "payment-device-reported-differs"
517
+ }, null, 8, ["label"])
518
+ ])) : x("", !0)
519
+ ])) : x("", !0)
520
+ ]);
521
+ };
522
+ }
523
+ }), un = (e) => `/portal/restaurants/${e}/kiosks`;
524
+ async function mn() {
525
+ const e = Fe.getRestaurantId();
526
+ if (!e) throw new Error("Invalid restaurant");
527
+ const t = await Ke().get(un(e));
528
+ return oe(t).filter((r) => !!r.deviceId).map((r) => ({
529
+ terminalId: r._id,
530
+ terminalName: r.name,
531
+ deviceId: r.deviceId,
532
+ checkouts: r.paymentCheckouts ?? []
533
+ }));
534
+ }
535
+ async function pn() {
536
+ const e = Fe.getRestaurantId();
537
+ if (!e) throw new Error("Invalid restaurant");
538
+ const t = await Ke().get(
539
+ `/portal/restaurants/${e}/terminals`,
540
+ { params: { deviceType: "KIOSK" } }
541
+ );
542
+ return Pt(oe(t));
543
+ }
544
+ const Ee = {
545
+ listTerminalCheckouts: mn,
546
+ listKioskPaymentDevices: pn
547
+ };
548
+ function ge(e, t) {
549
+ return `${e}-${t}`;
550
+ }
551
+ const yn = Le("payment", () => {
552
+ const e = K({
553
+ terminals: [],
554
+ loadError: null,
555
+ paymentDevices: null,
556
+ paymentDevicesLoading: !1,
557
+ paymentDevicesLoadError: null
558
+ });
559
+ async function t() {
560
+ e.value.loadError = null;
561
+ try {
562
+ const p = await Ee.listTerminalCheckouts();
563
+ e.value.terminals = p.map((d) => ({
564
+ ...d,
565
+ checkouts: [...d.checkouts].sort((c, n) => c.sortOrder - n.sortOrder)
566
+ }));
567
+ } catch {
568
+ e.value.terminals = [], e.value.loadError = "error";
569
+ }
570
+ }
571
+ function r(p, d) {
572
+ const c = ge(p, d);
573
+ return e.value.terminals.find((n) => n.deviceId === c) ?? null;
574
+ }
575
+ let v = 0;
576
+ async function m() {
577
+ const p = ++v;
578
+ e.value.paymentDevices = null, e.value.paymentDevicesLoadError = null, e.value.paymentDevicesLoading = !0;
579
+ try {
580
+ const d = await Ee.listKioskPaymentDevices();
581
+ if (p !== v) return;
582
+ e.value.paymentDevices = d;
583
+ } catch {
584
+ if (p !== v) return;
585
+ e.value.paymentDevicesLoadError = "error";
586
+ } finally {
587
+ p === v && (e.value.paymentDevicesLoading = !1);
588
+ }
589
+ }
590
+ function f() {
591
+ v++, e.value.paymentDevices = null, e.value.paymentDevicesLoading = !1, e.value.paymentDevicesLoadError = null;
592
+ }
593
+ function b(p, d) {
594
+ var n;
595
+ const c = ge(p, d);
596
+ return ((n = e.value.paymentDevices) == null ? void 0 : n.find((y) => y.deviceId === c)) ?? null;
597
+ }
598
+ return {
599
+ state: e.value,
600
+ loadCheckouts: t,
601
+ terminalForDevice: r,
602
+ loadPaymentDevices: m,
603
+ clearPaymentDevices: f,
604
+ paymentDeviceFor: b
605
+ };
606
+ }), vn = 30, fn = 24 * 60 * 60 * 1e3;
607
+ function Oe(e, t = /* @__PURE__ */ new Date()) {
608
+ if (!e.licenseId || !e.expiredAt) return { kind: "none" };
609
+ const r = e.expiredAt, v = r.getTime() - t.getTime();
610
+ if (v <= 0) return { kind: "expired", expiredAt: r };
611
+ const m = Math.ceil(v / fn);
612
+ return m <= vn ? { kind: "expiring", expiredAt: r, daysLeft: m } : { kind: "active", expiredAt: r };
613
+ }
614
+ function hn(e, t) {
615
+ switch (e.kind) {
616
+ case "active":
617
+ return {
618
+ variant: "success",
619
+ labelKey: "order.licenseActiveUntil",
620
+ params: { date: t(e.expiredAt) }
621
+ };
622
+ case "expiring":
623
+ return {
624
+ variant: "warning",
625
+ labelKey: e.daysLeft === 1 ? "order.licenseExpiresInOneDay" : "order.licenseExpiresInDays",
626
+ params: { days: e.daysLeft }
627
+ };
628
+ case "expired":
629
+ return { variant: "critical", labelKey: "order.licenseExpired", params: {} };
630
+ default:
631
+ return { variant: "plain", labelKey: "order.licenseNone", params: {} };
632
+ }
633
+ }
634
+ function Ua(e, t = /* @__PURE__ */ new Date()) {
635
+ return e.status === "EXPIRED" ? { variant: "critical", labelKey: "order.licenseExpired", params: {} } : e.status === "FREE" ? { variant: "info", labelKey: "order.licenseFree", params: {} } : Oe(
636
+ { licenseId: e.id, expiredAt: new Date(e.expiredAt) },
637
+ t
638
+ ).kind === "expiring" ? { variant: "warning", labelKey: "order.licenseInUseExpiringSoon", params: {} } : { variant: "success", labelKey: "order.licenseInUse", params: {} };
639
+ }
640
+ function bn(e, t) {
641
+ if (!t) return null;
642
+ const r = e === "TABLET_APP";
643
+ return r && t === "KIOSK" ? "order.licenseUsesKioskLicense" : !r && t === "TABLET" ? "order.licenseUsesTabletLicense" : null;
644
+ }
645
+ function le(e, t) {
646
+ const r = e.filter((f) => f.type === t && f.status !== "EXPIRED"), v = r.filter((f) => f.status === "IN_USE").length, m = r.reduce((f, b) => {
647
+ const p = new Date(b.expiredAt);
648
+ return !f || p < f ? p : f;
649
+ }, null);
650
+ return { type: t, total: r.length, used: v, free: r.length - v, nextExpiry: m };
651
+ }
652
+ function Ya(e) {
653
+ const t = le(e.licenses, "KIOSK").free, r = le(e.licenses, "TABLET").free;
654
+ return {
655
+ kiosk: t > 0 ? "KIOSK" : "none",
656
+ tablet: r > 0 ? "TABLET" : e.tabletMayUseKioskLicense && t > 0 ? "KIOSK" : "none"
657
+ };
658
+ }
659
+ function gn(e) {
660
+ return e.length > 6 ? `…${e.slice(-6)}` : e;
661
+ }
662
+ const kn = { class: "border fm-corner-radius-lg p-12 hover:bg-fm-color-neutral-gray-50 transition-colors" }, xn = { class: "flex items-center justify-between mb-2" }, _n = { class: "flex items-center gap-2" }, In = { class: "px-2 py-1 fm-corner-radius-md fm-typo-en-body-sm-600 uppercase bg-fm-color-neutral-gray-200 text-fm-color-typo-secondary" }, Dn = {
663
+ key: 0,
664
+ class: "fm-typo-en-body-md-600 text-fm-color-typo-primary"
665
+ }, Tn = { class: "flex items-center gap-1" }, wn = {
666
+ key: 0,
667
+ class: "py-[0.5rem] flex flex-col gap-[1.5rem] pr-2"
668
+ }, An = {
669
+ key: 0,
670
+ class: "w-full border p-[1.5rem] fm-corner-radius-lg flex flex-col gap-4"
671
+ }, Pn = { class: "fm-typo-en-title-sm-600 mb-3" }, $n = { class: "grid grid-cols-1 md:grid-cols-2 gap-x-6 gap-y-4" }, Sn = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Cn = { class: "flex flex-col gap-2" }, En = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Ln = { class: "flex items-center justify-between gap-2" }, Fn = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary" }, Kn = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary" }, Mn = {
672
+ key: 1,
673
+ class: "w-full border p-[1.5rem] fm-corner-radius-lg flex flex-col gap-4"
674
+ }, Bn = { class: "fm-typo-en-title-sm-600" }, Rn = { class: "fm-typo-en-body-md-600 text-fm-color-typo-primary" }, On = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Nn = { class: "fm-typo-en-body-md-600 text-fm-color-typo-primary break-all" }, Vn = {
675
+ key: 1,
676
+ class: "w-full border p-[1.5rem] fm-corner-radius-lg flex flex-col gap-4"
677
+ }, Un = { class: "fm-typo-en-title-sm-600" }, Yn = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, qn = { key: 1 }, zn = { class: "py-[1rem] flex flex-col gap-6 text-center items-center" }, jn = { class: "flex flex-col gap-1 mb-2" }, Gn = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Hn = { class: "mt-5 block" }, Wn = ["title"], Qn = ["title"], Xn = ["title"], Jn = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary font-mono" }, Zn = { class: "flex items-center gap-3 flex-wrap fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, ea = { class: "flex items-center gap-1" }, ta = {
678
+ key: 0,
679
+ class: "flex items-center gap-1"
680
+ }, na = { class: "flex items-center gap-1" }, aa = ["title"], oa = {
681
+ class: "flex items-center gap-2 flex-wrap mt-2",
682
+ "data-testid": "device-license-line"
683
+ }, ra = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, sa = { key: 0 }, ia = /* @__PURE__ */ H({
684
+ __name: "KioskDeviceCard",
685
+ props: {
686
+ device: {},
687
+ licenseType: {}
688
+ },
689
+ setup(e) {
690
+ G.extend(kt);
691
+ const { t } = Z(), { canManageDevices: r, canBindDevice: v } = Be(), m = ot(), f = Me(), b = ht(), p = at(), d = yn(), c = K(!1), n = e, y = k(
692
+ () => hn(
693
+ Oe({
694
+ licenseId: n.device.licenseId,
695
+ expiredAt: n.device.licenseExpiredAt
696
+ }),
697
+ (a) => G(a).format("DD MMM YYYY")
698
+ )
699
+ ), _ = k(
700
+ () => bn(n.device.deviceAppType, n.licenseType)
701
+ );
702
+ function S(a) {
703
+ return a === "TABLET" ? t("order.licenseTypeTablet") : a === "KIOSK" ? t("order.licenseTypeKiosk") : "-";
704
+ }
705
+ const T = K(""), g = k(
706
+ () => n.device.deviceAppType === "KIOSK_APP" && Se.gte(Se.coerce(n.device.deviceAppVersion ?? "") ?? "0.0.0", "2.4.0")
707
+ ), M = k(
708
+ () => {
709
+ var a;
710
+ return d.terminalForDevice(
711
+ ((a = p.currentRestaurant.value) == null ? void 0 : a._id) ?? "",
712
+ n.device.machineId
713
+ );
714
+ }
715
+ ), { isInternal: O } = it(), B = k(
716
+ () => O.value && n.device.deviceAppType === "KIOSK_APP"
717
+ ), q = k(() => g.value || B.value), z = k(
718
+ () => {
719
+ var a;
720
+ return ge(((a = p.currentRestaurant.value) == null ? void 0 : a._id) ?? "", n.device.machineId);
721
+ }
722
+ ), w = k(
723
+ () => {
724
+ var a;
725
+ return d.paymentDeviceFor(
726
+ ((a = p.currentRestaurant.value) == null ? void 0 : a._id) ?? "",
727
+ n.device.machineId
728
+ );
729
+ }
730
+ ), N = k(() => {
731
+ var a, I;
732
+ return w.value ? $t(window.location.origin, w.value.id, {
733
+ country: p.currentCountry.value,
734
+ businessId: (a = p.currentBusiness.value) == null ? void 0 : a._id,
735
+ restaurantId: (I = p.currentRestaurant.value) == null ? void 0 : I._id
736
+ }) : null;
737
+ }), te = k(() => {
738
+ var a;
739
+ return ((a = n.device) == null ? void 0 : a.deviceAppType) === "TABLET_APP" ? t("order.licenseTypeTablet") : t("order.licenseTypeKiosk");
740
+ }), W = k(() => {
741
+ const a = [], I = Ne(), C = Ve();
742
+ return I.length > 0 && a.push({
743
+ key: "scannerInfo",
744
+ title: t("order.scannerInfo"),
745
+ entries: I
746
+ }), C.length > 0 && a.push({
747
+ key: "printerInfo",
748
+ title: t("order.printerInfo"),
749
+ entries: C
750
+ }), a;
751
+ }), ce = k(() => W.value.length > 0);
752
+ function Ne() {
753
+ var C;
754
+ const a = n.device.config.scannerInfo;
755
+ if (!a || n.device.deviceAppType === "TABLET_APP")
756
+ return [];
757
+ const I = [
758
+ {
759
+ label: "Type",
760
+ value: Ue(a.type)
761
+ }
762
+ ];
763
+ return a.type === "CAPACITOR" && a.lensFacing && I.push({
764
+ label: "Lens Facing",
765
+ value: a.lensFacing === "FRONT" ? "Front" : "Back"
766
+ }), a.type === "SUNMI" && I.push({
767
+ label: "Connection",
768
+ value: ((C = a.connection) == null ? void 0 : C.type) ?? "-"
769
+ }), I;
770
+ }
771
+ function Ve() {
772
+ var ae, se;
773
+ const a = n.device.config.printerInfo;
774
+ if (!a)
775
+ return [];
776
+ const I = ((ae = a.id) == null ? void 0 : ae.trim()) ?? "", C = ((se = a.name) == null ? void 0 : se.trim()) ?? "";
777
+ if (!I || !C)
778
+ return [];
779
+ const A = [
780
+ { label: "Name", value: C },
781
+ { label: "Printer ID", value: I }
782
+ ], E = a.hardware;
783
+ switch (A.push({ label: "Connection Type", value: E.connection.type }), E.connection.type) {
784
+ case "IP":
785
+ case "BLUETOOTH":
786
+ case "DRIVER":
787
+ A.push({ label: "Path", value: E.connection.path });
788
+ break;
789
+ case "STAR":
790
+ A.push({ label: "Port Name", value: E.connection.portName }), A.push({ label: "Emulation Mode", value: E.connection.emulationMode });
791
+ break;
792
+ case "USB":
793
+ A.push({ label: "Vendor ID", value: E.connection.vendorId }), A.push({ label: "Product ID", value: E.connection.productId });
794
+ break;
795
+ }
796
+ return A.push({ label: "Encoder Type", value: E.encoderConfig.type }), A.push({ label: "DPI", value: String(E.encoderConfig.dpi) }), A.push({ label: "Paper Width (mm)", value: String(E.encoderConfig.paperWidthInMm) }), E.encoderConfig.type === "TSPL" && A.push({ label: "Paper Height (mm)", value: String(E.encoderConfig.paperHeightInMm) }), a.backup && (A.push({ label: "Backup Type", value: a.backup.type }), a.backup.type === "PRINTER_ID" && A.push({ label: "Backup Printer ID", value: a.backup.printerId })), A;
797
+ }
798
+ function Ue(a) {
799
+ switch (a) {
800
+ case "IMIN":
801
+ return "IMIN";
802
+ case "SUNMI":
803
+ return "SUNMI";
804
+ case "CAPACITOR":
805
+ return "Camera (Capacitor)";
806
+ case "KEYBOARD":
807
+ return "Keyboard";
808
+ default:
809
+ return a;
810
+ }
811
+ }
812
+ const de = k(() => {
813
+ var a;
814
+ return ((a = n.device) == null ? void 0 : a.deviceAppType) === "TABLET_APP";
815
+ }), Ye = k(() => {
816
+ const a = n.device.machineId;
817
+ return !a || a.length <= 16 ? a : `${a.slice(0, 8)}...${a.slice(-4)}`;
818
+ });
819
+ async function qe() {
820
+ try {
821
+ await navigator.clipboard.writeText(n.device.machineId), f.open({
822
+ type: "success",
823
+ message: t("order.machineIdCopied"),
824
+ position: "bottom"
825
+ });
826
+ } catch {
827
+ f.open({
828
+ type: "error",
829
+ message: t("order.copyFailed"),
830
+ position: "bottom"
831
+ });
832
+ }
833
+ }
834
+ function ze(a) {
835
+ return G(a).fromNow();
836
+ }
837
+ function ue(a) {
838
+ return G(a).format("DD MMM YYYY HH:mm:ss");
839
+ }
840
+ function je() {
841
+ T.value = "", m.open({
842
+ title: t("order.unbindKioskDevice"),
843
+ contentComponent: xt,
844
+ contentComponentProps: {
845
+ machineId: n.device.machineId,
846
+ "onUpdate:modelValue": (a) => {
847
+ T.value = a;
848
+ }
849
+ },
850
+ dismissAway: !1,
851
+ primaryActions: {
852
+ text: t("order.unbind"),
853
+ variant: "destructive",
854
+ close: !1
855
+ },
856
+ secondaryActions: {
857
+ text: t("order.cancel"),
858
+ variant: "tertiary",
859
+ close: !0
860
+ }
861
+ }).onPrimary(async () => {
862
+ T.value == n.device.machineId ? (await tt(), f.open({
863
+ type: "success",
864
+ message: t("order.unbindSuccess"),
865
+ position: "bottom"
866
+ }), m.close()) : f.open({
867
+ type: "warning",
868
+ message: t("order.unbindWarning"),
869
+ position: "bottom"
870
+ });
871
+ });
872
+ }
873
+ const xe = k(() => {
874
+ var a;
875
+ return (a = n.device) == null ? void 0 : a.pinInfo;
876
+ }), Ge = k(() => Q.value ? t("order.reEnterNewPin") : t("order.enterNewPin")), Q = K(!1), re = K(), me = K(), pe = K(!1), ne = K(n.device.remarkInfo ?? ""), V = K("app"), He = k(() => {
877
+ const a = [
878
+ {
879
+ label: t("order.deviceAppInfo"),
880
+ value: "app"
881
+ }
882
+ ];
883
+ return q.value && a.push({
884
+ label: t("order.paymentGateway"),
885
+ value: "payment-gateway"
886
+ }), ce.value && a.push({
887
+ label: t("order.other"),
888
+ value: "other"
889
+ }), a;
890
+ }), j = k(() => {
891
+ var a;
892
+ return ((a = n.device.remarkInfo) == null ? void 0 : a.trim()) ?? "";
893
+ }), We = k(() => {
894
+ const a = [
895
+ {
896
+ label: t("order.deviceType"),
897
+ value: te.value
898
+ },
899
+ {
900
+ label: t("order.machineId"),
901
+ value: n.device.machineId,
902
+ isMono: !0
903
+ },
904
+ {
905
+ label: t("order.version"),
906
+ value: n.device.deviceAppVersion ?? "Below 0.0.42"
907
+ },
908
+ {
909
+ label: t("order.deviceOtaVersion"),
910
+ value: n.device.deviceAppOTAVersion ?? t("order.notSet")
911
+ },
912
+ {
913
+ label: t("order.devicePinCode"),
914
+ value: xe.value ? t("order.pinSet") : t("order.noPin")
915
+ },
916
+ {
917
+ label: t("order.activatedDate"),
918
+ value: ue(n.device.activatedAt)
919
+ },
920
+ {
921
+ label: t("order.webviewVersion"),
922
+ value: n.device.webviewVersion || t("order.notSet")
923
+ },
924
+ {
925
+ label: t("order.operatingSystem"),
926
+ value: n.device.operatingSystem || t("order.notSet")
927
+ },
928
+ {
929
+ label: t("order.osVersion"),
930
+ value: n.device.osVersion || t("order.notSet")
931
+ }
932
+ ];
933
+ return de.value && a.push({
934
+ label: t("order.deviceSlot"),
935
+ value: n.device.slotInfo || t("order.notSet")
936
+ }), n.device.lastStartup && a.push({
937
+ label: t("order.lastStartupAt"),
938
+ value: ue(n.device.lastStartup)
939
+ }), n.device.licenseId ? a.push(
940
+ {
941
+ label: t("order.licenseType"),
942
+ value: S(n.licenseType)
943
+ },
944
+ { label: t("order.licenseId"), value: gn(n.device.licenseId), isMono: !0 },
945
+ {
946
+ label: t("order.licenseExpiry"),
947
+ // The chip text already carries the date when the licence is simply active.
948
+ value: n.device.licenseExpiredAt ? y.value.variant === "success" ? G(n.device.licenseExpiredAt).format("DD MMM YYYY") : `${G(n.device.licenseExpiredAt).format("DD MMM YYYY")} · ${t(y.value.labelKey, y.value.params)}` : t("order.notSet")
949
+ }
950
+ ) : a.push({ label: t("order.licenseType"), value: t("order.licenseNoneDetail") }), a;
951
+ }), ye = k(() => ne.value.trim()), _e = k(() => ye.value !== j.value);
952
+ Pe(
953
+ () => n.device.remarkInfo,
954
+ (a) => {
955
+ ne.value = a ?? "";
956
+ }
957
+ ), Pe(
958
+ () => ce.value,
959
+ (a) => {
960
+ !a && V.value === "other" && (V.value = "app");
961
+ }
962
+ );
963
+ function Qe() {
964
+ c.value = !0;
965
+ }
966
+ function ve() {
967
+ Q.value = !1, re.value = null, me.value = null, c.value = !1, V.value = "app";
968
+ }
969
+ function Ie(a) {
970
+ Q.value ? (me.value = a, Xe()) : (re.value = a, Q.value = !0);
971
+ }
972
+ async function Xe() {
973
+ re.value === me.value ? (await et(), f.open({
974
+ type: "success",
975
+ message: "Successfuly update device PIN",
976
+ position: "top"
977
+ })) : f.open({
978
+ type: "error",
979
+ message: "Entered PIN not the same, please try again",
980
+ position: "top"
981
+ }), ve();
982
+ }
983
+ function Je(a) {
984
+ ne.value = a.slice(0, 50);
985
+ }
986
+ async function Ze() {
987
+ if (_e.value) {
988
+ pe.value = !0;
989
+ try {
990
+ await b.updateDeviceRemark(ye.value === "" ? null : ye.value, n.device.machineId), f.open({
991
+ type: "success",
992
+ message: t("order.deviceRemarkUpdated"),
993
+ position: "top"
994
+ });
995
+ } catch {
996
+ f.open({
997
+ type: "error",
998
+ message: t("order.deviceRemarkUpdateFailed"),
999
+ position: "top"
1000
+ });
1001
+ } finally {
1002
+ pe.value = !1;
1003
+ }
1004
+ }
1005
+ }
1006
+ async function et() {
1007
+ await b.updateDevicePin(re.value, n.device.machineId);
1008
+ }
1009
+ async function tt() {
1010
+ await b.unbind(n.device.machineId);
1011
+ }
1012
+ return (a, I) => {
1013
+ var Te;
1014
+ const C = D("FmButton"), A = D("FmTabs"), E = D("FmTextField"), ae = D("FmPinField"), se = D("FmSideSheet"), X = D("FmIcon"), De = D("FmChip");
1015
+ return i(), u("div", kn, [
1016
+ s("div", xn, [
1017
+ s("div", _n, [
1018
+ s("span", In, l(de.value ? o(t)("order.licenseTypeTablet") : o(t)("order.licenseTypeKiosk")), 1),
1019
+ de.value && e.device.slotInfo ? (i(), u("span", Dn, l(e.device.slotInfo), 1)) : x("", !0)
1020
+ ]),
1021
+ s("div", Tn, [
1022
+ h(se, {
1023
+ header: j.value || e.device.name,
1024
+ "dismiss-away": "",
1025
+ maxWidth: 700,
1026
+ "onOn:clickedAway": ve
1027
+ }, {
1028
+ "side-sheet-button": U(() => [
1029
+ h(C, {
1030
+ variant: "tertiary",
1031
+ size: "md",
1032
+ label: o(t)("order.deviceDetails")
1033
+ }, null, 8, ["label"])
1034
+ ]),
1035
+ default: U(() => {
1036
+ var we, Ae;
1037
+ return [
1038
+ c.value ? (i(), u("div", qn, [
1039
+ s("div", zn, [
1040
+ s("div", jn, [
1041
+ s("span", Gn, l(Ge.value), 1),
1042
+ s("span", Hn, [
1043
+ Q.value ? x("", !0) : (i(), $(ae, {
1044
+ key: 0,
1045
+ length: 4,
1046
+ onComplete: I[2] || (I[2] = (P) => Ie(P))
1047
+ })),
1048
+ Q.value ? (i(), $(ae, {
1049
+ key: 1,
1050
+ length: 4,
1051
+ onComplete: I[3] || (I[3] = (P) => Ie(P))
1052
+ })) : x("", !0)
1053
+ ])
1054
+ ]),
1055
+ h(C, {
1056
+ class: "w-1/3",
1057
+ variant: "secondary",
1058
+ label: o(t)("order.cancelResetPin"),
1059
+ onClick: ve
1060
+ }, null, 8, ["label"])
1061
+ ])
1062
+ ])) : (i(), u("div", wn, [
1063
+ s("div", null, [
1064
+ h(A, {
1065
+ "model-value": V.value,
1066
+ "onUpdate:modelValue": I[0] || (I[0] = (P) => V.value = P),
1067
+ items: He.value,
1068
+ showMoreAt: 99
1069
+ }, null, 8, ["model-value", "items"])
1070
+ ]),
1071
+ V.value === "app" ? (i(), u("div", An, [
1072
+ s("span", Pn, l(o(t)("order.deviceAppInfo")), 1),
1073
+ s("div", $n, [
1074
+ (i(!0), u(L, null, Y(We.value, (P) => (i(), u("div", {
1075
+ key: P.label,
1076
+ class: "flex flex-col gap-1"
1077
+ }, [
1078
+ s("span", Sn, l(P.label), 1),
1079
+ s("span", {
1080
+ class: $e(["fm-typo-en-body-md-600 text-fm-color-typo-primary break-all", P.isMono ? "font-mono text-sm" : ""])
1081
+ }, l(P.value), 3)
1082
+ ]))), 128))
1083
+ ]),
1084
+ s("div", Cn, [
1085
+ s("span", En, l(o(t)("order.deviceRemark")), 1),
1086
+ h(E, {
1087
+ "model-value": ne.value,
1088
+ placeholder: o(t)("order.deviceRemarkPlaceholder"),
1089
+ "onUpdate:modelValue": Je
1090
+ }, null, 8, ["model-value", "placeholder"]),
1091
+ s("div", Ln, [
1092
+ s("span", Fn, l(ne.value.length) + "/50 ", 1),
1093
+ h(C, {
1094
+ class: "w-auto",
1095
+ variant: "secondary",
1096
+ label: o(t)("order.saveDeviceRemark"),
1097
+ disabled: !_e.value || pe.value,
1098
+ onClick: Ze
1099
+ }, null, 8, ["label", "disabled"])
1100
+ ]),
1101
+ s("span", Kn, l(o(t)("order.current")) + ": " + l(j.value || o(t)("order.notSet")), 1)
1102
+ ]),
1103
+ o(r) ? (i(), $(C, {
1104
+ key: 0,
1105
+ class: "w-full",
1106
+ variant: "primary",
1107
+ label: (we = e.device) != null && we.pinInfo ? o(t)("order.resetDevicePin") : o(t)("order.setDevicePin"),
1108
+ onClick: Qe
1109
+ }, null, 8, ["label"])) : x("", !0)
1110
+ ])) : V.value === "other" && ce.value ? (i(), u("div", Mn, [
1111
+ s("span", Bn, l(o(t)("order.other")), 1),
1112
+ (i(!0), u(L, null, Y(W.value, (P) => (i(), u("div", {
1113
+ key: P.key,
1114
+ class: "flex flex-col gap-2"
1115
+ }, [
1116
+ s("span", Rn, l(P.title), 1),
1117
+ (i(!0), u(L, null, Y(P.entries, (fe) => (i(), u("div", {
1118
+ key: fe.label,
1119
+ class: "flex flex-col gap-1"
1120
+ }, [
1121
+ s("span", On, l(fe.label), 1),
1122
+ s("span", Nn, l(fe.value), 1)
1123
+ ]))), 128))
1124
+ ]))), 128))
1125
+ ])) : V.value === "payment-gateway" && q.value ? (i(), u(L, { key: 2 }, [
1126
+ B.value ? (i(), $(dn, {
1127
+ key: 0,
1128
+ "payment-device": w.value,
1129
+ loading: o(d).state.paymentDevicesLoading,
1130
+ "load-error": o(d).state.paymentDevicesLoadError !== null,
1131
+ "expected-device-id": z.value,
1132
+ "portal-url": N.value,
1133
+ reported: e.device.config.terminalInfo ?? null,
1134
+ onRetry: I[1] || (I[1] = (P) => o(d).loadPaymentDevices())
1135
+ }, null, 8, ["payment-device", "loading", "load-error", "expected-device-id", "portal-url", "reported"])) : x("", !0),
1136
+ g.value ? (i(), u("div", Vn, [
1137
+ s("span", Un, l(o(t)("order.paymentGateway")), 1),
1138
+ s("span", Yn, l(o(t)("order.availablePaymentMethodsHint")), 1),
1139
+ h(Tt, {
1140
+ checkouts: ((Ae = M.value) == null ? void 0 : Ae.checkouts) ?? [],
1141
+ "load-error": o(d).state.loadError
1142
+ }, null, 8, ["checkouts", "load-error"])
1143
+ ])) : x("", !0)
1144
+ ], 64)) : x("", !0)
1145
+ ]))
1146
+ ];
1147
+ }),
1148
+ _: 1
1149
+ }, 8, ["header"]),
1150
+ o(v) ? (i(), $(C, {
1151
+ key: 0,
1152
+ variant: "plain",
1153
+ icon: "link_off",
1154
+ class: "text-fm-color-system-error-300",
1155
+ "aria-label": o(t)("order.unbindKioskDevice"),
1156
+ title: o(t)("order.unbindKioskDevice"),
1157
+ onClick: je
1158
+ }, null, 8, ["aria-label", "title"])) : x("", !0)
1159
+ ])
1160
+ ]),
1161
+ s("div", {
1162
+ class: "fm-typo-en-body-md-600 text-fm-color-typo-primary mb-1 overflow-hidden text-ellipsis whitespace-nowrap",
1163
+ title: j.value || e.device.name
1164
+ }, l(j.value || e.device.name), 9, Wn),
1165
+ s("div", {
1166
+ class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary mb-1 overflow-hidden text-ellipsis whitespace-nowrap",
1167
+ title: j.value ? e.device.name : o(t)("order.notSet")
1168
+ }, [
1169
+ j.value ? (i(), u(L, { key: 0 }, [
1170
+ F(l(e.device.name), 1)
1171
+ ], 64)) : (i(), u(L, { key: 1 }, [
1172
+ F(l(o(t)("order.deviceRemark")) + ": " + l(o(t)("order.notSet")), 1)
1173
+ ], 64))
1174
+ ], 8, Qn),
1175
+ s("div", {
1176
+ class: "flex items-center gap-1 mb-2 cursor-pointer group",
1177
+ onClick: qe,
1178
+ title: o(t)("order.clickToCopy")
1179
+ }, [
1180
+ s("span", Jn, l(Ye.value), 1),
1181
+ h(X, {
1182
+ name: "content_copy",
1183
+ class: "text-fm-color-typo-tertiary opacity-0 group-hover:opacity-100 transition-opacity"
1184
+ })
1185
+ ], 8, Xn),
1186
+ s("div", Zn, [
1187
+ s("span", ea, [
1188
+ h(X, { name: "smartphone" }),
1189
+ F(" v" + l(e.device.deviceAppVersion ?? "?"), 1)
1190
+ ]),
1191
+ e.device.deviceAppOTAVersion ? (i(), u("span", ta, [
1192
+ h(X, { name: "system_update" }),
1193
+ F(" " + l(e.device.deviceAppOTAVersion), 1)
1194
+ ])) : x("", !0),
1195
+ s("span", na, [
1196
+ h(X, { name: "lock" }),
1197
+ F(" " + l(xe.value ? o(t)("order.pinSet") : o(t)("order.noPin")), 1)
1198
+ ]),
1199
+ e.device.lastStartup ? (i(), u("span", {
1200
+ key: 1,
1201
+ class: "flex items-center gap-1",
1202
+ title: ue(e.device.lastStartup)
1203
+ }, [
1204
+ h(X, { name: "schedule" }),
1205
+ F(" " + l(ze(e.device.lastStartup)), 1)
1206
+ ], 8, aa)) : x("", !0)
1207
+ ]),
1208
+ s("div", oa, [
1209
+ s("span", ra, l(o(t)("order.licenseLabel")), 1),
1210
+ h(De, {
1211
+ compact: "",
1212
+ variant: y.value.variant,
1213
+ label: o(t)(y.value.labelKey, y.value.params)
1214
+ }, null, 8, ["variant", "label"]),
1215
+ _.value ? (i(), $(De, {
1216
+ key: 0,
1217
+ compact: "",
1218
+ variant: "warning",
1219
+ icon: "warning",
1220
+ label: o(t)(_.value)
1221
+ }, null, 8, ["label"])) : x("", !0)
1222
+ ]),
1223
+ B.value && o(d).state.paymentDevices ? (i(), u("div", {
1224
+ key: 0,
1225
+ class: $e(["flex items-center gap-1 mt-2 fm-typo-en-body-sm-400", w.value ? "text-fm-color-typo-secondary" : "text-fm-color-system-warning-300"]),
1226
+ "data-testid": "device-payment-line"
1227
+ }, [
1228
+ h(X, {
1229
+ name: w.value ? "point_of_sale" : "link_off",
1230
+ size: "sm"
1231
+ }, null, 8, ["name"]),
1232
+ s("span", null, l(w.value ? o(t)("order.paymentDeviceLinked") : o(t)("order.paymentDeviceMissingShort")), 1),
1233
+ (Te = w.value) != null && Te.status && w.value.status !== "Active" ? (i(), u("span", sa, "· " + l(w.value.status), 1)) : x("", !0)
1234
+ ], 2)) : x("", !0)
1235
+ ]);
1236
+ };
1237
+ }
1238
+ }), la = { class: "flex flex-col gap-2" }, ca = {
1239
+ key: 0,
1240
+ class: "border fm-corner-radius-lg p-12 flex items-center gap-2 fm-typo-en-body-md-400 text-fm-color-typo-secondary",
1241
+ "data-testid": "license-summary-error"
1242
+ }, da = {
1243
+ key: 1,
1244
+ class: "border fm-corner-radius-lg p-12 flex items-center gap-2 fm-typo-en-body-md-400 text-fm-color-typo-secondary",
1245
+ "data-testid": "license-summary-unlimited"
1246
+ }, ua = {
1247
+ key: 2,
1248
+ class: "grid grid-cols-2 xs:grid-cols-1 gap-8"
1249
+ }, ma = ["data-testid"], pa = { class: "flex items-center gap-2" }, ya = { class: "fm-typo-en-body-md-600 text-fm-color-typo-primary" }, va = { class: "fm-typo-en-body-md-400 text-fm-color-typo-primary" }, fa = {
1250
+ key: 0,
1251
+ class: "fm-typo-en-body-sm-400 text-fm-color-system-warning-400"
1252
+ }, ha = {
1253
+ key: 3,
1254
+ class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
1255
+ }, ba = /* @__PURE__ */ H({
1256
+ __name: "KioskLicenseSummary",
1257
+ props: {
1258
+ licenses: {}
1259
+ },
1260
+ setup(e) {
1261
+ const { t } = Z(), r = e, v = k(
1262
+ () => r.licenses ? [
1263
+ le(r.licenses.licenses, "KIOSK"),
1264
+ le(r.licenses.licenses, "TABLET")
1265
+ ] : []
1266
+ );
1267
+ function m(f) {
1268
+ return G(f).format("DD MMM YYYY");
1269
+ }
1270
+ return (f, b) => {
1271
+ var d;
1272
+ const p = D("FmIcon");
1273
+ return i(), u("div", la, [
1274
+ !e.licenses || !e.licenses.verified ? (i(), u("div", ca, [
1275
+ h(p, { name: "info" }),
1276
+ F(" " + l(o(t)("order.licenseLoadError")), 1)
1277
+ ])) : e.licenses.unlimited ? (i(), u("div", da, [
1278
+ h(p, { name: "all_inclusive" }),
1279
+ F(" " + l(o(t)("order.licenseSummaryUnlimited")), 1)
1280
+ ])) : (i(), u("div", ua, [
1281
+ (i(!0), u(L, null, Y(v.value, (c) => (i(), u("div", {
1282
+ key: c.type,
1283
+ class: "border fm-corner-radius-lg p-12 flex flex-col gap-1",
1284
+ "data-testid": `license-summary-${c.type.toLowerCase()}`
1285
+ }, [
1286
+ s("div", pa, [
1287
+ h(p, {
1288
+ name: c.type === "TABLET" ? "tablet" : "point_of_sale"
1289
+ }, null, 8, ["name"]),
1290
+ s("span", ya, l(o(t)(c.type === "TABLET" ? "order.licenseSummaryTablet" : "order.licenseSummaryKiosk")), 1)
1291
+ ]),
1292
+ s("span", va, [
1293
+ F(l(o(t)("order.licenseSummaryUsage", { used: c.used, total: c.total, free: c.free })) + " ", 1),
1294
+ c.nextExpiry ? (i(), u(L, { key: 0 }, [
1295
+ F(" · " + l(o(t)("order.licenseSummaryNextExpiry", { date: m(c.nextExpiry) })), 1)
1296
+ ], 64)) : x("", !0)
1297
+ ]),
1298
+ c.free === 0 ? (i(), u("span", fa, l(o(t)("order.licenseSummaryNoFree")), 1)) : x("", !0)
1299
+ ], 8, ma))), 128))
1300
+ ])),
1301
+ (d = e.licenses) != null && d.verified && !e.licenses.unlimited ? (i(), u("span", ha, l(o(t)("order.licenseSharedNote")), 1)) : x("", !0)
1302
+ ]);
1303
+ };
1304
+ }
1305
+ }), ga = { class: "flex flex-col items-center justify-center gap-3 py-16 text-center col-span-full" }, ka = { class: "flex items-center justify-center w-16 h-16 rounded-full bg-fm-color-surface-secondary" }, xa = { class: "fm-typo-en-title-sm-600 block" }, _a = { class: "fm-typo-en-body-md-400 block text-fm-color-typo-secondary max-w-[360px]" }, Ia = {
1306
+ key: 0,
1307
+ class: "pt-2"
1308
+ }, ie = /* @__PURE__ */ H({
1309
+ __name: "KioskStatePanel",
1310
+ props: {
1311
+ title: {},
1312
+ message: {},
1313
+ icon: { default: "info" }
1314
+ },
1315
+ setup(e) {
1316
+ return (t, r) => {
1317
+ const v = D("FmIcon");
1318
+ return i(), u("div", ga, [
1319
+ s("div", ka, [
1320
+ h(v, {
1321
+ name: e.icon,
1322
+ size: "xl",
1323
+ class: "text-fm-color-typo-tertiary"
1324
+ }, null, 8, ["name"])
1325
+ ]),
1326
+ s("span", xa, l(e.title), 1),
1327
+ s("span", _a, l(e.message), 1),
1328
+ t.$slots.default ? (i(), u("div", Ia, [
1329
+ nt(t.$slots, "default")
1330
+ ])) : x("", !0)
1331
+ ]);
1332
+ };
1333
+ }
1334
+ }), Da = { class: "flex flex-col gap-4" }, Ta = { class: "flex flex-row items-center justify-between gap-12 xs:flex-col xs:items-start" }, wa = { class: "flex flex-col gap-2" }, Aa = { class: "fm-typo-en-title-sm-600 block" }, Pa = { class: "fm-typo-en-body-md-400 block text-fm-color-typo-secondary" }, $a = { class: "flex items-center gap-3 flex-wrap" }, Sa = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary" }, Ca = { class: "grid grid-cols-2 xs:grid-cols-1 gap-8 py-8" }, Ea = {
1335
+ key: 0,
1336
+ class: "text-center py-8 text-fm-color-typo-secondary fm-typo-en-body-md-400 col-span-full"
1337
+ }, qa = /* @__PURE__ */ H({
1338
+ __name: "KioskDevicesView",
1339
+ props: {
1340
+ devices: {},
1341
+ licenses: { default: null },
1342
+ loadError: { default: null },
1343
+ loading: { type: Boolean, default: !1 }
1344
+ },
1345
+ emits: ["requestOtp", "retry"],
1346
+ setup(e) {
1347
+ const { t } = Z(), { canBindDevice: r } = Be(), v = e, m = k(
1348
+ () => {
1349
+ var c;
1350
+ return new Map(
1351
+ (((c = v.licenses) == null ? void 0 : c.licenses) ?? []).map((n) => [n.id, n.type])
1352
+ );
1353
+ }
1354
+ ), f = K(""), b = K("all"), p = k(() => {
1355
+ switch (b.value) {
1356
+ case "tablet":
1357
+ return t("order.tabletOnly");
1358
+ case "kiosk":
1359
+ return t("order.kioskOnly");
1360
+ default:
1361
+ return t("order.allTypes");
1362
+ }
1363
+ }), d = k(() => {
1364
+ let c = v.devices;
1365
+ b.value === "tablet" ? c = c.filter((y) => y.deviceAppType === "TABLET_APP") : b.value === "kiosk" && (c = c.filter((y) => y.deviceAppType !== "TABLET_APP"));
1366
+ const n = f.value.toLowerCase().trim();
1367
+ return n && (c = c.filter((y) => {
1368
+ var M, O, B, q;
1369
+ const _ = ((M = y.name) == null ? void 0 : M.toLowerCase()) || "", S = ((O = y.machineId) == null ? void 0 : O.toLowerCase()) || "", T = ((B = y.slotInfo) == null ? void 0 : B.toLowerCase()) || "", g = ((q = y.remarkInfo) == null ? void 0 : q.toLowerCase()) || "";
1370
+ return _.includes(n) || S.includes(n) || T.includes(n) || g.includes(n);
1371
+ })), c.sort((y, _) => y.deviceAppType === "TABLET_APP" && _.deviceAppType !== "TABLET_APP" ? -1 : y.deviceAppType !== "TABLET_APP" && _.deviceAppType === "TABLET_APP" ? 1 : y.deviceAppType === "TABLET_APP" && _.deviceAppType === "TABLET_APP" ? (y.slotInfo || "").localeCompare(_.slotInfo || "") : (y.name || "").localeCompare(_.name || ""));
1372
+ });
1373
+ return (c, n) => {
1374
+ const y = D("FmButton"), _ = D("FmSearch"), S = D("FmMenuItem"), T = D("FmMenu");
1375
+ return i(), u("div", null, [
1376
+ s("div", Da, [
1377
+ s("div", Ta, [
1378
+ s("div", wa, [
1379
+ s("span", Aa, l(o(t)("order.kioskDisplay")), 1),
1380
+ s("span", Pa, l(o(t)("order.kioskDisplayDescription")), 1)
1381
+ ]),
1382
+ o(r) ? (i(), $(y, {
1383
+ key: 0,
1384
+ class: "shrink-0",
1385
+ variant: "primary",
1386
+ label: o(t)("order.bindDevice"),
1387
+ size: "md",
1388
+ "prepend-icon": "link",
1389
+ onClick: n[0] || (n[0] = (g) => c.$emit("requestOtp"))
1390
+ }, null, 8, ["label"])) : x("", !0)
1391
+ ]),
1392
+ e.loadError === "forbidden" ? (i(), $(ie, {
1393
+ key: 0,
1394
+ icon: "lock",
1395
+ title: o(t)("order.deviceAccessDeniedTitle"),
1396
+ message: o(t)("order.deviceAccessDeniedMessage")
1397
+ }, null, 8, ["title", "message"])) : e.loading && e.devices.length === 0 ? (i(), $(ie, {
1398
+ key: 1,
1399
+ icon: "hourglass_empty",
1400
+ title: o(t)("order.devicesLoading"),
1401
+ message: ""
1402
+ }, null, 8, ["title"])) : e.loadError === "error" ? (i(), $(ie, {
1403
+ key: 2,
1404
+ icon: "error",
1405
+ title: o(t)("order.deviceLoadErrorTitle"),
1406
+ message: o(t)("order.deviceLoadErrorMessage")
1407
+ }, {
1408
+ default: U(() => [
1409
+ h(y, {
1410
+ variant: "secondary",
1411
+ label: o(t)("order.retry"),
1412
+ "prepend-icon": "refresh",
1413
+ onClick: n[1] || (n[1] = (g) => c.$emit("retry"))
1414
+ }, null, 8, ["label"])
1415
+ ]),
1416
+ _: 1
1417
+ }, 8, ["title", "message"])) : (i(), u(L, { key: 3 }, [
1418
+ h(ba, { licenses: e.licenses }, null, 8, ["licenses"]),
1419
+ s("div", $a, [
1420
+ h(_, {
1421
+ "model-value": f.value,
1422
+ "onUpdate:modelValue": n[2] || (n[2] = (g) => f.value = g),
1423
+ class: "flex-1 min-w-[200px] max-w-[400px]",
1424
+ placeholder: o(t)("order.searchDevices")
1425
+ }, null, 8, ["model-value", "placeholder"]),
1426
+ h(T, null, {
1427
+ "menu-button": U(() => [
1428
+ h(y, {
1429
+ variant: "tertiary",
1430
+ "prepend-icon": "filter_list",
1431
+ label: p.value,
1432
+ class: "fm-typo-en-body-md-600"
1433
+ }, null, 8, ["label"])
1434
+ ]),
1435
+ default: U(() => [
1436
+ h(S, {
1437
+ "model-value": b.value === "all",
1438
+ label: o(t)("order.allTypes"),
1439
+ onClick: n[3] || (n[3] = (g) => b.value = "all")
1440
+ }, null, 8, ["model-value", "label"]),
1441
+ h(S, {
1442
+ "model-value": b.value === "tablet",
1443
+ label: o(t)("order.tabletOnly"),
1444
+ onClick: n[4] || (n[4] = (g) => b.value = "tablet")
1445
+ }, null, 8, ["model-value", "label"]),
1446
+ h(S, {
1447
+ "model-value": b.value === "kiosk",
1448
+ label: o(t)("order.kioskOnly"),
1449
+ onClick: n[5] || (n[5] = (g) => b.value = "kiosk")
1450
+ }, null, 8, ["model-value", "label"])
1451
+ ]),
1452
+ _: 1
1453
+ }),
1454
+ s("span", Sa, l(o(t)("order.showingDevices", { count: d.value.length, total: e.devices.length })), 1)
1455
+ ]),
1456
+ s("div", Ca, [
1457
+ (i(!0), u(L, null, Y(d.value, (g) => (i(), $(ia, {
1458
+ key: g.machineId,
1459
+ device: g,
1460
+ "license-type": g.licenseId ? m.value.get(g.licenseId) : void 0
1461
+ }, null, 8, ["device", "license-type"]))), 128)),
1462
+ d.value.length === 0 && e.devices.length > 0 ? (i(), u("div", Ea, l(o(t)("order.noDevicesMatch")), 1)) : x("", !0),
1463
+ e.devices.length === 0 ? (i(), $(ie, {
1464
+ key: 1,
1465
+ icon: "devices",
1466
+ title: o(t)("order.noDevicesBoundTitle"),
1467
+ message: o(t)("order.noDevicesBound")
1468
+ }, {
1469
+ default: U(() => [
1470
+ o(r) ? (i(), $(y, {
1471
+ key: 0,
1472
+ variant: "primary",
1473
+ label: o(t)("order.bindDevice"),
1474
+ "prepend-icon": "link",
1475
+ onClick: n[6] || (n[6] = (g) => c.$emit("requestOtp"))
1476
+ }, null, 8, ["label"])) : x("", !0)
1477
+ ]),
1478
+ _: 1
1479
+ }, 8, ["title", "message"])) : x("", !0)
1480
+ ])
1481
+ ], 64))
1482
+ ])
1483
+ ]);
1484
+ };
1485
+ }
1486
+ });
1487
+ export {
1488
+ ba as _,
1489
+ bn as a,
1490
+ Ya as b,
1491
+ yn as c,
1492
+ qa as d,
1493
+ ie as e,
1494
+ Ua as l,
1495
+ gn as s,
1496
+ ht as u
1497
+ };