@feedmepos/mf-payment 1.10.7 → 1.10.8-dev

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/dist/{Actions.vue_vue_type_script_setup_true_lang-Cb4w7Its.js → Actions.vue_vue_type_script_setup_true_lang-DRF8W4tg.js} +1 -1
  2. package/dist/{AdminBusinessSelector.vue_vue_type_script_setup_true_lang-B_-olj-A.js → AdminBusinessSelector.vue_vue_type_script_setup_true_lang-4ApEVDHf.js} +3 -3
  3. package/dist/AdminRestaurantSelector.vue_vue_type_script_setup_true_lang-C4xRm0d0.js +135 -0
  4. package/dist/{Chargeback-B5MXERko.js → Chargeback-pnoHxJba.js} +5 -5
  5. package/dist/{DocumentViewer.vue_vue_type_script_setup_true_lang-DNrsl1TX.js → DocumentViewer.vue_vue_type_script_setup_true_lang-B4nIdf5-.js} +1 -1
  6. package/dist/{ExternalTerminal-bjMJ7qr-.js → ExternalTerminal-CqrRcbsp.js} +6 -6
  7. package/dist/{OnboardForm-BwFlXqV5.js → OnboardForm-BDv2pxL9.js} +6 -6
  8. package/dist/{OnboardForm-CE0weADC.js → OnboardForm-CYO3vK_8.js} +6 -6
  9. package/dist/{OnboardSubmission-C60-dPdV.js → OnboardSubmission-BUJZydpX.js} +6 -6
  10. package/dist/{OnboardSubmission-2s5PtLcm.js → OnboardSubmission-Cx_sPOVH.js} +3 -3
  11. package/dist/PaymentCheckout-DQM_kppH.js +1939 -0
  12. package/dist/{PayoutAccount-PGN4vUiE.js → PayoutAccount-DKWtIoTX.js} +7 -7
  13. package/dist/{PayoutAccount-DnE00Tpx.js → PayoutAccount-dwMtm1PL.js} +5 -5
  14. package/dist/{PayoutAccountSetting-UxgmC_It.js → PayoutAccountSetting-CWZD3Kwa.js} +6 -6
  15. package/dist/{Restaurant-DWs8l6IN.js → Restaurant-CV5n8389.js} +4 -4
  16. package/dist/{RestaurantSetting-CghN3Qij.js → RestaurantSetting-DsP4kGjM.js} +3 -3
  17. package/dist/{Settlement-DSAWgf1q.js → Settlement-58-ie3T1.js} +3 -3
  18. package/dist/{Settlement-BZG0nEhU.js → Settlement-Bt18kRNt.js} +4 -4
  19. package/dist/{SettlementTransactions-dSH6mKX9.js → SettlementTransactions-C7GhMTLQ.js} +5 -5
  20. package/dist/{SettlementTransactions-5l9xe_rQ.js → SettlementTransactions-Db1f9lYu.js} +5 -5
  21. package/dist/{Status.vue_vue_type_script_setup_true_lang-CSz0sfMv.js → Status.vue_vue_type_script_setup_true_lang-B9j6CfzS.js} +1 -1
  22. package/dist/{Terminal-CU70aAqI.js → Terminal-BuMIcbhv.js} +6 -6
  23. package/dist/TerminalSetting-2kwSwfKt.js +2779 -0
  24. package/dist/TerminalTemplate-aBZAYAKp.js +322 -0
  25. package/dist/TerminalTemplateSetting-BZlX7Xll.js +262 -0
  26. package/dist/{Transaction-9yHZiRAp.js → Transaction-Cy03QV60.js} +10 -10
  27. package/dist/{Transaction-CHL7HVtl.js → Transaction-lRZITPtN.js} +20 -19
  28. package/dist/{TransactionOld-Dk_5TVXm.js → TransactionOld-CmLbZyaP.js} +7 -7
  29. package/dist/{TransactionStatus.vue_vue_type_script_setup_true_lang-D4A7Hfk7.js → TransactionStatus.vue_vue_type_script_setup_true_lang-DSzil-ib.js} +1 -1
  30. package/dist/api/terminal/index.d.ts +1 -0
  31. package/dist/api/terminal-template/index.d.ts +15 -0
  32. package/dist/{app-WOQvK6eu.js → app-DKD_4d44.js} +389 -353
  33. package/dist/app.js +1 -1
  34. package/dist/assets-VX0DqpvG.js +96 -0
  35. package/dist/{grafana-BqnbcwyU.js → grafana-B_uCjmFj.js} +1 -1
  36. package/dist/{index-BRCt0Wjb.js → index-BpAx8sXI.js} +3073 -3030
  37. package/dist/{index-DiYIJH8n.js → index-C3AnskZH.js} +2 -2
  38. package/dist/index-CGmA3Z9Z.js +71 -0
  39. package/dist/{index-Jo4g2Fvl.js → index-Cf9xnlvp.js} +1 -1
  40. package/dist/{index-Cwbpxr-3.js → index-CnTRiFh5.js} +1 -1
  41. package/dist/{index-BSUOKl_R.js → index-DFNUFV3R.js} +1 -1
  42. package/dist/index-DFZ1vkMO.js +43 -0
  43. package/dist/{index-XucAJsGV.js → index-DO72hNKP.js} +1 -1
  44. package/dist/{index-BPTPINow.js → index-DZJaOOKJ.js} +1 -1
  45. package/dist/{index--Svzj_Uq.js → index-DbJwyim8.js} +1 -1
  46. package/dist/{index-Cc7BGx40.js → index-FScngz5X.js} +1 -1
  47. package/dist/{index.vue_vue_type_script_setup_true_lang-CQwRJloj.js → index.vue_vue_type_script_setup_true_lang-CH17wzq0.js} +1 -1
  48. package/dist/{onboard-submission-B7IRbUGm.js → onboard-submission-Cjp6Mugk.js} +1 -1
  49. package/dist/package.json +2 -2
  50. package/dist/{payout-account-v0EWhJ79.js → payout-account-CzCmFwEa.js} +3 -3
  51. package/dist/style.css +1 -1
  52. package/dist/tsconfig.app.tsbuildinfo +1 -1
  53. package/dist/useQuery-Cn_nXHMC.js +375 -0
  54. package/dist/views/admin/payout-account/tabs/PaymentChannel.vue.d.ts +4 -4
  55. package/dist/views/admin/payout-account/tabs/PaymentGateway.vue.d.ts +4 -4
  56. package/dist/views/admin/payout-account/tabs/TokenGateway.vue.d.ts +4 -4
  57. package/dist/views/admin/payout-account/tabs/gateway/AdyenGateway.vue.d.ts +4 -4
  58. package/dist/views/admin/payout-account/tabs/gateway/BeamGateway.vue.d.ts +2 -2
  59. package/dist/views/admin/payout-account/tabs/gateway/DigioGateway.vue.d.ts +2 -2
  60. package/dist/views/admin/payout-account/tabs/gateway/FiuuGateway.vue.d.ts +4 -4
  61. package/dist/views/admin/payout-account/tabs/gateway/KsherGateway.vue.d.ts +4 -4
  62. package/dist/views/admin/payout-account/tabs/gateway/MacauPassGateway.vue.d.ts +4 -4
  63. package/dist/views/admin/payout-account/tabs/gateway/TyroGateway.vue.d.ts +2 -2
  64. package/dist/views/admin/payout-account/tabs/token/ApplePayToken.vue.d.ts +2 -2
  65. package/dist/views/admin/payout-account/tabs/token/GooglePayToken.vue.d.ts +2 -2
  66. package/dist/views/admin/restaurant/tabs/gateway/AdyenGateway.vue.d.ts +4 -4
  67. package/dist/views/admin/restaurant/tabs/gateway/BeamGateway.vue.d.ts +4 -4
  68. package/dist/views/admin/restaurant/tabs/gateway/DigioGateway.vue.d.ts +4 -4
  69. package/dist/views/admin/restaurant/tabs/gateway/FiuuGateway.vue.d.ts +8 -8
  70. package/dist/views/admin/restaurant/tabs/gateway/GhlGateway.vue.d.ts +8 -8
  71. package/dist/views/admin/restaurant/tabs/gateway/GrabGateway.vue.d.ts +4 -4
  72. package/dist/views/admin/restaurant/tabs/gateway/KsherGateway.vue.d.ts +6 -6
  73. package/dist/views/admin/restaurant/tabs/gateway/MacauPassGateway.vue.d.ts +6 -6
  74. package/dist/views/admin/restaurant/tabs/gateway/MaybankGateway.vue.d.ts +6 -6
  75. package/dist/views/admin/restaurant/tabs/gateway/MonetapayGateway.vue.d.ts +6 -6
  76. package/dist/views/admin/restaurant/tabs/gateway/RevenueMonsterGateway.vue.d.ts +8 -8
  77. package/dist/views/admin/restaurant/tabs/gateway/SoftSpaceGateway.vue.d.ts +6 -6
  78. package/dist/views/admin/terminal/TerminalApplyTemplateDialog.vue.d.ts +6 -0
  79. package/dist/views/admin/terminal/TerminalSaveTemplateDialog.vue.d.ts +2 -0
  80. package/dist/views/admin/terminal-template/TerminalTemplate.vue.d.ts +2 -0
  81. package/dist/views/admin/terminal-template/TerminalTemplateSetting.vue.d.ts +12 -0
  82. package/dist/views/admin/terminal-template/TerminalTemplateSideSheet.vue.d.ts +174 -0
  83. package/dist/views/admin/terminal-template/cell/Actions.vue.d.ts +12 -0
  84. package/dist/views/admin/terminal-template/cell/Default.vue.d.ts +5 -0
  85. package/dist/views/admin/terminal-template/tabs/EcrGateways.vue.d.ts +104 -0
  86. package/dist/views/admin/terminal-template/tabs/Information.vue.d.ts +95 -0
  87. package/package.json +2 -2
  88. package/dist/AdminRestaurantSelector.vue_vue_type_script_setup_true_lang-KddyORH2.js +0 -505
  89. package/dist/TerminalSetting-Bc6HJqCW.js +0 -4521
  90. package/dist/assets-B_Ilda1K.js +0 -96
  91. package/dist/index-BR7n0dkV.js +0 -63
@@ -0,0 +1,2779 @@
1
+ import { defineComponent as h, openBlock as g, createElementBlock as S, Fragment as D, createElementVNode as I, createTextVNode as W, toDisplayString as z, ref as _, resolveComponent as f, createBlock as F, withCtx as O, createVNode as y, unref as N, computed as V, createCommentVNode as U, isRef as te, resolveDynamicComponent as le, normalizeProps as ne, mergeProps as oe, watch as A, onBeforeUnmount as _e, toRef as G, onMounted as q, renderList as L } from "vue";
2
+ import { u as J, p as pe, e as P } from "./index-BpAx8sXI.js";
3
+ import { useRouter as Te } from "vue-router";
4
+ import { t as j } from "./index-CGmA3Z9Z.js";
5
+ import { t as de } from "./index-DFZ1vkMO.js";
6
+ import { _ as Ie } from "./Layout.vue_vue_type_script_setup_true_lang-BKIvkgA_.js";
7
+ import { u as re } from "./index-Cf9xnlvp.js";
8
+ import { useDialogChild as ve, useSnackbar as me, useDialog as Fe } from "@feedmepos/ui-library";
9
+ import { w as we } from "./Modal-DB8M9o1T.js";
10
+ import { u as Q } from "./error-K1CakhA9.js";
11
+ import { useI18n as ie, useCoreStore as se } from "@feedmepos/mf-common";
12
+ import { z as X, a as Z } from "./validator-CTlVogBQ.js";
13
+ import { o as xe } from "./index-C3AnskZH.js";
14
+ import { c as Ce } from "./index-MdV54cWO.js";
15
+ import { e as ye } from "./index-DZJaOOKJ.js";
16
+ import { P as ke } from "./PaymentCheckout-DQM_kppH.js";
17
+ const Ne = /* @__PURE__ */ h({
18
+ __name: "Information",
19
+ props: {
20
+ terminal: {
21
+ type: Object,
22
+ required: !0
23
+ }
24
+ },
25
+ setup(T) {
26
+ return (p, a) => (g(), S(D, null, [
27
+ a[0] || (a[0] = I("b", null, "Name", -1)),
28
+ W(": " + z(T.terminal.name), 1),
29
+ a[1] || (a[1] = I("br", null, null, -1)),
30
+ a[2] || (a[2] = I("b", null, "Status", -1)),
31
+ W(": " + z(T.terminal.status), 1),
32
+ a[3] || (a[3] = I("br", null, null, -1)),
33
+ a[4] || (a[4] = I("b", null, "Device ID", -1)),
34
+ W(": " + z(T.terminal.deviceId ?? "-"), 1),
35
+ a[5] || (a[5] = I("br", null, null, -1)),
36
+ a[6] || (a[6] = I("b", null, "Device Type", -1)),
37
+ W(": " + z(T.terminal.deviceType ?? "-"), 1),
38
+ a[7] || (a[7] = I("br", null, null, -1))
39
+ ], 64));
40
+ }
41
+ }), Ve = { class: "flex items-center gap-8 rounded-md bg-fm-color-neutral-gray-100 px-16 py-12" }, Se = { class: "fm-typo-en-body-md-400" }, Ue = { class: "mt-auto pt-24 pb-24" }, he = /* @__PURE__ */ h({
42
+ __name: "TerminalSaveTemplateDialog",
43
+ setup(T) {
44
+ const p = ve(), { t: a } = ie(), b = _(), l = _(""), r = _(""), e = _(!1), d = () => {
45
+ p.emitData({
46
+ name: l.value,
47
+ description: r.value,
48
+ isDefault: e.value
49
+ }), p.emitAction("primary");
50
+ };
51
+ return (c, v) => {
52
+ const m = f("FmIcon"), s = f("FmTextField"), t = f("FmSwitch"), o = f("FmButton"), i = f("FmForm");
53
+ return g(), F(i, {
54
+ ref_key: "form",
55
+ ref: b,
56
+ class: "flex flex-col gap-16 min-h-[240px]",
57
+ onValidationSuccess: d
58
+ }, {
59
+ default: O(() => [
60
+ I("div", Ve, [
61
+ y(m, {
62
+ name: "info",
63
+ class: "shrink-0"
64
+ }),
65
+ I("span", Se, z(N(a)("payment.terminal_template.scope_info")), 1)
66
+ ]),
67
+ y(s, {
68
+ modelValue: l.value,
69
+ "onUpdate:modelValue": v[0] || (v[0] = (u) => l.value = u),
70
+ label: "Template Name",
71
+ "label-mark": "required",
72
+ rules: N(X)(N(Z).string().min(1, "Template name is required"))
73
+ }, null, 8, ["modelValue", "rules"]),
74
+ y(s, {
75
+ modelValue: r.value,
76
+ "onUpdate:modelValue": v[1] || (v[1] = (u) => r.value = u),
77
+ label: "Description",
78
+ "label-mark": "optional"
79
+ }, null, 8, ["modelValue"]),
80
+ y(t, {
81
+ modelValue: e.value,
82
+ "onUpdate:modelValue": v[2] || (v[2] = (u) => e.value = u),
83
+ label: "Set as default",
84
+ "label-info": "Applied automatically when a new device of this type binds for this business."
85
+ }, null, 8, ["modelValue"]),
86
+ I("div", Ue, [
87
+ y(o, {
88
+ class: "w-full",
89
+ type: "submit",
90
+ label: "Save"
91
+ })
92
+ ])
93
+ ]),
94
+ _: 1
95
+ }, 512);
96
+ };
97
+ }
98
+ }), Re = { class: "flex flex-col gap-16 min-h-[240px]" }, Pe = { class: "flex items-start gap-8 rounded-md bg-fm-color-neutral-gray-100 px-16 py-12" }, Be = { class: "fm-typo-en-body-md-400" }, Oe = {
99
+ key: 0,
100
+ class: "fm-typo-en-body-md-400 text-fm-color-neutral-gray-500"
101
+ }, Me = {
102
+ key: 2,
103
+ class: "mt-auto pt-24 pb-24"
104
+ }, Ae = /* @__PURE__ */ h({
105
+ __name: "TerminalApplyTemplateDialog",
106
+ props: {
107
+ templates: {}
108
+ },
109
+ setup(T) {
110
+ const p = T, a = ve(), { t: b } = ie(), l = _(""), r = V(
111
+ () => p.templates.map((d) => ({
112
+ label: d.isDefault ? `${d.name} (default)` : d.name,
113
+ value: d._id
114
+ }))
115
+ ), e = () => {
116
+ a.emitData({ templateId: l.value }), a.emitAction("primary");
117
+ };
118
+ return (d, c) => {
119
+ const v = f("FmIcon"), m = f("FmSelect"), s = f("FmButton");
120
+ return g(), S("div", Re, [
121
+ I("div", Pe, [
122
+ y(v, {
123
+ name: "info",
124
+ class: "mt-4 shrink-0"
125
+ }),
126
+ I("div", Be, z(N(b)("payment.terminal_template.scope_info")), 1)
127
+ ]),
128
+ r.value.length === 0 ? (g(), S("div", Oe, " No setting template exists for this business and device type yet. ")) : (g(), F(m, {
129
+ key: 1,
130
+ modelValue: l.value,
131
+ "onUpdate:modelValue": c[0] || (c[0] = (t) => l.value = t),
132
+ label: "Template",
133
+ items: r.value
134
+ }, null, 8, ["modelValue", "items"])),
135
+ r.value.length > 0 ? (g(), S("div", Me, [
136
+ y(s, {
137
+ class: "w-full",
138
+ label: "Apply",
139
+ disabled: !l.value,
140
+ onClick: e
141
+ }, null, 8, ["disabled"])
142
+ ])) : U("", !0)
143
+ ]);
144
+ };
145
+ }
146
+ }), qe = { key: 0 }, Ge = { class: "mt-6 space-x-6" }, De = /* @__PURE__ */ h({
147
+ __name: "KioskMode",
148
+ props: {
149
+ terminal: {
150
+ type: Object,
151
+ required: !0
152
+ }
153
+ },
154
+ setup(T) {
155
+ const { isLoading: p, startAsyncCall: a } = J(!1), b = me(), l = _({
156
+ enable: !1,
157
+ password: []
158
+ }), r = T;
159
+ function e() {
160
+ return l.value.enable && l.value.password.filter((d) => !!d).length !== 6 ? b.open({
161
+ type: "error",
162
+ message: "Unlock PIN is required when setting up kiosk mode for terminal."
163
+ }) : a(async () => {
164
+ const d = { enable: l.value.enable };
165
+ d.enable && Object.assign(d, {
166
+ password: l.value.password.join("")
167
+ });
168
+ const c = await j.kioskModeRequest(r.terminal._id, d);
169
+ if (c === "OK")
170
+ return b.open({ type: "info", message: "Kiosk mode applied successfully." });
171
+ let v = c;
172
+ return c === "client_not_connected" && (v = "Terminal not connected to the websocket server."), c.startsWith("terminal: ") && (v = c.replaceAll("terminal: ", "")), b.open({
173
+ type: "error",
174
+ message: v
175
+ });
176
+ });
177
+ }
178
+ return (d, c) => {
179
+ const v = f("FmSwitch"), m = f("FmPinField"), s = f("FmButton");
180
+ return g(), S(D, null, [
181
+ y(v, {
182
+ modelValue: l.value.enable,
183
+ "onUpdate:modelValue": c[0] || (c[0] = (t) => l.value.enable = t),
184
+ label: "Enable Kiosk Mode?"
185
+ }, null, 8, ["modelValue"]),
186
+ l.value.enable ? (g(), S("div", qe, [
187
+ c[2] || (c[2] = I("p", { class: "mt-6" }, "Unlock PIN: ", -1)),
188
+ y(m, {
189
+ modelValue: l.value.password,
190
+ "onUpdate:modelValue": c[1] || (c[1] = (t) => l.value.password = t)
191
+ }, null, 8, ["modelValue"])
192
+ ])) : U("", !0),
193
+ I("div", Ge, [
194
+ y(s, {
195
+ variant: "primary",
196
+ label: "Send",
197
+ icon: "send",
198
+ loading: N(p),
199
+ onclick: e
200
+ }, null, 8, ["loading"])
201
+ ])
202
+ ], 64);
203
+ };
204
+ }
205
+ }), $e = /* @__PURE__ */ h({
206
+ __name: "SettingRequest",
207
+ props: {
208
+ terminal: {
209
+ type: Object,
210
+ required: !0
211
+ }
212
+ },
213
+ setup(T) {
214
+ const { settingTab: p } = re({
215
+ settingTab: "kiosk_mode"
216
+ }), a = [
217
+ {
218
+ label: "Kiosk Mode",
219
+ value: "kiosk_mode",
220
+ render: De
221
+ }
222
+ ], b = T, l = V(() => a.find((r) => r.value === p.value));
223
+ return (r, e) => {
224
+ var c;
225
+ const d = f("FmTabs");
226
+ return g(), S(D, null, [
227
+ e[1] || (e[1] = I("p", { className: "mt-1 my-6 text-gray-600" }, [
228
+ I("b", null, "Note: "),
229
+ W(" Setting request will perform remotely without caching so make sure terminal is connected to the network also to our websocket as well. ")
230
+ ], -1)),
231
+ y(d, {
232
+ "model-value": N(p),
233
+ "onUpdate:modelValue": e[0] || (e[0] = (v) => te(p) ? p.value = v : null),
234
+ class: "mb-6",
235
+ items: a
236
+ }, null, 8, ["model-value"]),
237
+ N(p) ? (g(), F(le((c = l.value) == null ? void 0 : c.render), ne(oe({ key: 0 }, { terminal: b.terminal })), null, 16)) : U("", !0)
238
+ ], 64);
239
+ };
240
+ }
241
+ }), Ee = 2e3, Le = 12e4, Ye = "Timed out waiting for the Tyro reader to sync. Please try again.";
242
+ function je(T) {
243
+ const { isLoading: p, startLoading: a, stopLoading: b } = J(!1), { t: l } = ie(), r = me(), e = _(null), d = V(() => {
244
+ var k, B;
245
+ const w = (k = T.value.gateways) == null ? void 0 : k.find(
246
+ ($) => $.gateway === "Tyro"
247
+ );
248
+ return ((B = w == null ? void 0 : w.config) == null ? void 0 : B.uniqueId) || "";
249
+ }), c = V(() => !!d.value), v = V(() => {
250
+ var w;
251
+ return ((w = e.value) == null ? void 0 : w.status) === "ready";
252
+ }), m = V(() => {
253
+ var w, k;
254
+ return v.value && !!((k = (w = e.value) == null ? void 0 : w.fields) != null && k.tyroLocationId) && !!T.value.deviceId && !c.value;
255
+ }), s = V(() => !v.value && !c.value), t = V(
256
+ () => l("payment.onboard-submission.tyro.syncDisabledHint")
257
+ ), o = V(() => c.value ? "Synced" : "Sync");
258
+ async function i() {
259
+ if (!T.value.referenceId) {
260
+ e.value = null;
261
+ return;
262
+ }
263
+ try {
264
+ const w = await xe.getByRestaurant(
265
+ T.value.referenceId
266
+ );
267
+ e.value = w.find(
268
+ (k) => k.type === pe.FdoOnboardType.enum.tyro
269
+ ) ?? null;
270
+ } catch (w) {
271
+ e.value = null, r.open({
272
+ type: "error",
273
+ message: Q(w)
274
+ });
275
+ }
276
+ }
277
+ const u = Ce({
278
+ intervalMs: Ee,
279
+ timeoutMs: Le,
280
+ onTick: async ({ isCurrentRun: w, stop: k }) => {
281
+ var K, H;
282
+ const B = await j.readById(T.value._id);
283
+ if (!w())
284
+ return;
285
+ const $ = (K = B.gateways) == null ? void 0 : K.find((ee) => ee.gateway === "Tyro");
286
+ ($ == null ? void 0 : $.gateway) === "Tyro" && ((H = $ == null ? void 0 : $.config) != null && H.uniqueId) && (k({ invalidate: !1 }), b(), Object.assign(T.value, B), r.open({
287
+ type: "success",
288
+ message: "Tyro reader created successfully"
289
+ }));
290
+ },
291
+ onTimeout: () => {
292
+ b(), r.open({
293
+ type: "error",
294
+ message: Ye
295
+ });
296
+ },
297
+ onError: (w) => {
298
+ b(), r.open({
299
+ type: "error",
300
+ message: Q(w)
301
+ });
302
+ }
303
+ }), C = u.isPolling;
304
+ function n() {
305
+ u.stop(), b();
306
+ }
307
+ function x() {
308
+ n(), a(), u.start();
309
+ }
310
+ async function E() {
311
+ if (!m.value) {
312
+ r.open({
313
+ type: "error",
314
+ message: "Tyro reader sync is not available"
315
+ });
316
+ return;
317
+ }
318
+ try {
319
+ a(), await j.syncTyroReader(T.value._id), x();
320
+ } catch (w) {
321
+ n(), r.open({
322
+ type: "error",
323
+ message: Q(w)
324
+ });
325
+ }
326
+ }
327
+ return A(
328
+ () => T.value.referenceId,
329
+ async () => {
330
+ await i();
331
+ },
332
+ { immediate: !0 }
333
+ ), _e(() => {
334
+ n();
335
+ }), {
336
+ isLoading: p,
337
+ isPollingTyroReader: C,
338
+ uniqueId: d,
339
+ canSyncTyroReader: m,
340
+ showTyroSyncPopover: s,
341
+ tyroSyncPopoverMessage: t,
342
+ tyroSyncButtonLabel: o,
343
+ syncTyroReader: E
344
+ };
345
+ }
346
+ const Ke = {
347
+ key: 0,
348
+ class: "text-sm text-gray-500"
349
+ }, He = { class: "flex mt-6 space-x-6" }, ze = { class: "flex-1" }, Qe = /* @__PURE__ */ h({
350
+ __name: "SoftposGateway",
351
+ props: {
352
+ terminal: {
353
+ type: Object,
354
+ required: !0
355
+ },
356
+ onUpdate: {
357
+ type: Function,
358
+ required: !0
359
+ }
360
+ },
361
+ setup(T) {
362
+ const p = T, a = se().currentCountry, b = [
363
+ {
364
+ label: "Fiuu Malaysia",
365
+ value: "cc.feedme.payment.rms",
366
+ region: P.F_COUNTRY.enum.MY,
367
+ gateway: "Fiuu",
368
+ isLegacy: !0,
369
+ isOutdated: !0
370
+ },
371
+ {
372
+ label: "Fiuu Malaysia V2",
373
+ value: "cc.feedme.payment.fiuu_my",
374
+ region: P.F_COUNTRY.enum.MY,
375
+ gateway: "Fiuu",
376
+ isLegacy: !0
377
+ },
378
+ {
379
+ label: "Fiuu Singapore",
380
+ value: "cc.feedme.payment.fiuu_sg",
381
+ region: P.F_COUNTRY.enum.SG,
382
+ gateway: "Fiuu",
383
+ isLegacy: !0
384
+ },
385
+ {
386
+ label: "Softspace Malaysia",
387
+ value: "cc.feedme.payment.softspace_my",
388
+ gateway: "Softspace",
389
+ region: P.F_COUNTRY.enum.MY
390
+ },
391
+ {
392
+ label: "Digio Thailand",
393
+ value: "cc.feedme.payment.digio_th",
394
+ gateway: "Digio",
395
+ region: P.F_COUNTRY.enum.TH
396
+ },
397
+ {
398
+ label: "Tyro Australia",
399
+ value: "cc.feedme.payment.tyro_au",
400
+ gateway: "Tyro",
401
+ region: P.F_COUNTRY.enum.AU
402
+ }
403
+ ], l = G(() => p.terminal), r = _(), e = _({
404
+ packageId: "",
405
+ uniqueId: "",
406
+ developerId: "",
407
+ isUat: !1
408
+ }), d = () => {
409
+ e.value.uniqueId = "", e.value.packageId = "", e.value.developerId = "", e.value.isUat = !1;
410
+ }, c = V(() => b.filter((R) => R.region === a.value)), v = V(() => c.value.find(
411
+ (R) => R.value === e.value.packageId
412
+ )), m = V(
413
+ () => {
414
+ var R;
415
+ return ((R = v.value) == null ? void 0 : R.gateway) === "Tyro";
416
+ }
417
+ ), {
418
+ isLoading: s,
419
+ isPollingTyroReader: t,
420
+ uniqueId: o,
421
+ canSyncTyroReader: i,
422
+ showTyroSyncPopover: u,
423
+ tyroSyncPopoverMessage: C,
424
+ tyroSyncButtonLabel: n,
425
+ syncTyroReader: x
426
+ } = je(l), E = V(() => m.value ? "button" : "submit"), w = V(() => m.value ? n.value : "Save"), k = V(() => m.value ? s.value : !1), B = V(() => m.value ? !i.value || t.value : !1), $ = () => {
427
+ if (!l.value.gateways || l.value.gateways.length === 0)
428
+ return d();
429
+ const R = l.value.gateways[0];
430
+ if (!R.config)
431
+ return d();
432
+ if (R.gateway === "Tyro") {
433
+ e.value = {
434
+ packageId: R.config.packageId,
435
+ uniqueId: R.config.uniqueId,
436
+ developerId: "",
437
+ isUat: !1
438
+ };
439
+ return;
440
+ }
441
+ switch (R.gateway) {
442
+ case "Fiuu":
443
+ e.value = {
444
+ packageId: R.config.packageId,
445
+ uniqueId: R.config.uniqueId,
446
+ developerId: "",
447
+ isUat: !1
448
+ };
449
+ break;
450
+ case "Softspace":
451
+ case "Digio":
452
+ const M = JSON.parse(R.config.uniqueId);
453
+ e.value = {
454
+ packageId: R.config.packageId,
455
+ uniqueId: M.uniqueId,
456
+ developerId: M.developerId,
457
+ isUat: M.isUat
458
+ };
459
+ return;
460
+ }
461
+ };
462
+ A(l, $), q($);
463
+ async function K() {
464
+ const R = v.value;
465
+ if (!R)
466
+ return;
467
+ let M = e.value.uniqueId;
468
+ R.isLegacy || (M = JSON.stringify({
469
+ uniqueId: e.value.uniqueId,
470
+ developerId: e.value.developerId,
471
+ isUat: e.value.isUat
472
+ }));
473
+ const ue = {
474
+ gateway: R.gateway,
475
+ config: {
476
+ packageId: R.value,
477
+ uniqueId: M
478
+ }
479
+ };
480
+ (!l.value.gateways || l.value.gateways.length > 1) && (l.value.gateways = []), l.value.gateways[0] = ue, await p.onUpdate(l.value);
481
+ }
482
+ async function H(R) {
483
+ var M;
484
+ (M = l.value.gateways) == null || M.splice(R, 1), p.onUpdate(l.value);
485
+ }
486
+ function ee() {
487
+ m.value && x();
488
+ }
489
+ return (R, M) => {
490
+ const ue = f("FmSelect"), ae = f("FmTextField"), fe = f("FmCheckbox"), ce = f("FmButton"), ge = f("FmTooltip"), be = f("FmForm");
491
+ return g(), F(be, {
492
+ ref: r.value,
493
+ class: "flex flex-col gap-16 w-[500px]",
494
+ onValidationSuccess: K
495
+ }, {
496
+ default: O(() => [
497
+ y(ue, {
498
+ modelValue: e.value.packageId,
499
+ "onUpdate:modelValue": M[0] || (M[0] = (Y) => e.value.packageId = Y),
500
+ label: "Package ID",
501
+ items: c.value
502
+ }, null, 8, ["modelValue", "items"]),
503
+ v.value ? (g(), S(D, { key: 0 }, [
504
+ m.value ? (g(), F(ae, {
505
+ key: 0,
506
+ "model-value": N(o),
507
+ label: "Unique ID (Reader ID)",
508
+ disabled: ""
509
+ }, null, 8, ["model-value"])) : v.value && v.value.isLegacy ? (g(), S(D, { key: 1 }, [
510
+ y(ae, {
511
+ modelValue: e.value.uniqueId,
512
+ "onUpdate:modelValue": M[1] || (M[1] = (Y) => e.value.uniqueId = Y),
513
+ label: "Unique ID (TID)"
514
+ }, null, 8, ["modelValue"]),
515
+ v.value.isOutdated ? (g(), S("span", Ke, " Note: For outdated gateway is no longer continued development, please use the new gateway instead. ")) : U("", !0)
516
+ ], 64)) : (g(), S(D, { key: 2 }, [
517
+ y(ae, {
518
+ modelValue: e.value.developerId,
519
+ "onUpdate:modelValue": M[2] || (M[2] = (Y) => e.value.developerId = Y),
520
+ label: "Developer ID (MID)"
521
+ }, null, 8, ["modelValue"]),
522
+ y(ae, {
523
+ modelValue: e.value.uniqueId,
524
+ "onUpdate:modelValue": M[3] || (M[3] = (Y) => e.value.uniqueId = Y),
525
+ label: "Unique ID (TID)"
526
+ }, null, 8, ["modelValue"]),
527
+ y(fe, {
528
+ modelValue: e.value.isUat,
529
+ "onUpdate:modelValue": M[4] || (M[4] = (Y) => e.value.isUat = Y),
530
+ label: "Is UAT (Test)",
531
+ value: "1"
532
+ }, null, 8, ["modelValue"])
533
+ ], 64)),
534
+ I("div", He, [
535
+ l.value.gateways && l.value.gateways.length > 0 ? (g(), F(ce, {
536
+ key: 0,
537
+ class: "flex-1",
538
+ variant: "secondary",
539
+ label: "Delete",
540
+ onclick: () => H(0)
541
+ }, null, 8, ["onclick"])) : U("", !0),
542
+ m.value && N(u) && B.value ? (g(), F(ge, {
543
+ key: 1,
544
+ class: "flex-1",
545
+ variant: "plain",
546
+ placement: "top",
547
+ content: N(C)
548
+ }, {
549
+ default: O(() => [
550
+ I("div", ze, [
551
+ y(ce, {
552
+ type: E.value,
553
+ class: "w-full",
554
+ variant: "primary",
555
+ loading: k.value,
556
+ disabled: B.value,
557
+ label: w.value,
558
+ onClick: ee
559
+ }, null, 8, ["type", "loading", "disabled", "label"])
560
+ ])
561
+ ]),
562
+ _: 1
563
+ }, 8, ["content"])) : (g(), F(ce, {
564
+ key: 2,
565
+ type: E.value,
566
+ class: "flex-1",
567
+ variant: "primary",
568
+ loading: k.value,
569
+ disabled: B.value,
570
+ label: w.value,
571
+ onClick: ee
572
+ }, null, 8, ["type", "loading", "disabled", "label"]))
573
+ ])
574
+ ], 64)) : U("", !0)
575
+ ]),
576
+ _: 1
577
+ }, 512);
578
+ };
579
+ }
580
+ }), Je = {
581
+ key: 0,
582
+ class: "flex items-center justify-center min-h-[80vh]"
583
+ }, We = { class: "flex mt-6 space-x-6" }, Xe = /* @__PURE__ */ h({
584
+ __name: "TerminalGateway",
585
+ props: {
586
+ terminal: {
587
+ type: Object,
588
+ required: !0
589
+ },
590
+ onUpdate: {
591
+ type: Function,
592
+ required: !0
593
+ }
594
+ },
595
+ setup(T) {
596
+ const { isLoading: p, startAsyncCall: a } = J(), b = T, l = G(() => b.terminal), r = _(), e = _(), d = _(-1), c = _({
597
+ terminalId: ""
598
+ }), v = () => {
599
+ c.value.terminalId = "", d.value = -1;
600
+ }, m = () => {
601
+ if (a(async () => {
602
+ r.value = await j.getRestaurantTerminals(b.terminal.referenceId);
603
+ }), !b.terminal.ecrs)
604
+ return v();
605
+ const o = b.terminal.ecrs.findIndex((u) => u && u.gateway && u.gateway === "FeedMe");
606
+ if (o === -1)
607
+ return v();
608
+ d.value = o;
609
+ const i = b.terminal.ecrs.at(o);
610
+ i.gateway === "FeedMe" && i.config && (c.value = {
611
+ terminalId: i.config.terminalId
612
+ });
613
+ };
614
+ A(l, m), q(m);
615
+ const s = V(() => (r.value ?? []).map((o) => ({
616
+ label: o.name ?? o._id,
617
+ value: o._id
618
+ })));
619
+ async function t(o) {
620
+ var i;
621
+ (i = b.terminal.ecrs) == null || i.splice(o, 1), b.onUpdate(b.terminal);
622
+ }
623
+ return (o, i) => {
624
+ const u = f("FmCircularProgress"), C = f("FmSelect"), n = f("FmButton"), x = f("FmForm");
625
+ return N(p) ? (g(), S("div", Je, [
626
+ y(u, { size: "xxl" })
627
+ ])) : (g(), F(x, {
628
+ key: 1,
629
+ ref: e.value,
630
+ class: "flex flex-col gap-16 w-[500px]",
631
+ onValidationSuccess: i[1] || (i[1] = () => {
632
+ d.value > -1 ? l.value.ecrs[d.value] = { gateway: "FeedMe", config: c.value } : (l.value.ecrs || (l.value.ecrs = []), l.value.ecrs.push({ gateway: "FeedMe", config: c.value })), b.onUpdate(l.value);
633
+ })
634
+ }, {
635
+ default: O(() => [
636
+ y(C, {
637
+ modelValue: c.value.terminalId,
638
+ "onUpdate:modelValue": i[0] || (i[0] = (E) => c.value.terminalId = E),
639
+ label: "Terminal ID",
640
+ items: s.value,
641
+ rules: N(X)(N(Z).string())
642
+ }, null, 8, ["modelValue", "items", "rules"]),
643
+ I("div", We, [
644
+ d.value > -1 ? (g(), F(n, {
645
+ key: 0,
646
+ class: "flex-1",
647
+ variant: "secondary",
648
+ label: "Delete",
649
+ onclick: () => t(d.value)
650
+ }, null, 8, ["onclick"])) : U("", !0),
651
+ y(n, {
652
+ type: "submit",
653
+ class: "flex-1",
654
+ variant: "primary",
655
+ label: "Save"
656
+ })
657
+ ])
658
+ ]),
659
+ _: 1
660
+ }, 512));
661
+ };
662
+ }
663
+ }), Ze = { class: "flex mt-6 space-x-6" }, ea = /* @__PURE__ */ h({
664
+ __name: "GhlGateway",
665
+ props: {
666
+ terminal: {
667
+ type: Object,
668
+ required: !0
669
+ },
670
+ onUpdate: {
671
+ type: Function,
672
+ required: !0
673
+ }
674
+ },
675
+ setup(T) {
676
+ const p = T, a = G(() => p.terminal), b = _(), l = _(-1), r = _({
677
+ merchantId: "",
678
+ terminalId: "",
679
+ privateKey: ""
680
+ }), e = () => {
681
+ r.value.merchantId = "", r.value.terminalId = "", r.value.privateKey = "", l.value = -1;
682
+ }, d = () => {
683
+ if (!a.value.ecrs)
684
+ return e();
685
+ const v = a.value.ecrs.findIndex((s) => s && s.gateway && s.gateway === "Ghl");
686
+ if (v === -1)
687
+ return e();
688
+ l.value = v;
689
+ const m = a.value.ecrs.at(v);
690
+ m.gateway === "Ghl" && m.config && (r.value = {
691
+ merchantId: m.config.merchantId,
692
+ terminalId: m.config.terminalId,
693
+ privateKey: m.config.privateKey || ""
694
+ });
695
+ };
696
+ A(a, d), q(d);
697
+ async function c(v) {
698
+ var m;
699
+ (m = a.value.ecrs) == null || m.splice(v, 1), p.onUpdate(a.value);
700
+ }
701
+ return (v, m) => {
702
+ const s = f("FmTextField"), t = f("FmTextarea"), o = f("FmButton"), i = f("FmForm");
703
+ return g(), F(i, {
704
+ ref: b.value,
705
+ class: "flex flex-col gap-16 w-[500px]",
706
+ onValidationSuccess: m[3] || (m[3] = () => {
707
+ l.value > -1 ? a.value.ecrs[l.value] = { gateway: "Ghl", config: r.value } : (a.value.ecrs || (a.value.ecrs = []), a.value.ecrs.push({ gateway: "Ghl", config: r.value })), p.onUpdate(a.value);
708
+ })
709
+ }, {
710
+ default: O(() => [
711
+ y(s, {
712
+ modelValue: r.value.merchantId,
713
+ "onUpdate:modelValue": m[0] || (m[0] = (u) => r.value.merchantId = u),
714
+ label: "Merchant ID"
715
+ }, null, 8, ["modelValue"]),
716
+ y(s, {
717
+ modelValue: r.value.terminalId,
718
+ "onUpdate:modelValue": m[1] || (m[1] = (u) => r.value.terminalId = u),
719
+ label: "Terminal ID"
720
+ }, null, 8, ["modelValue"]),
721
+ y(t, {
722
+ modelValue: r.value.privateKey,
723
+ "onUpdate:modelValue": m[2] || (m[2] = (u) => r.value.privateKey = u),
724
+ label: "Private Key",
725
+ "label-mark": "optional",
726
+ "label-info": "Default will use FeedMe Private Key"
727
+ }, null, 8, ["modelValue"]),
728
+ I("div", Ze, [
729
+ l.value > -1 ? (g(), F(o, {
730
+ key: 0,
731
+ class: "flex-1",
732
+ variant: "secondary",
733
+ label: "Delete",
734
+ onclick: () => c(l.value)
735
+ }, null, 8, ["onclick"])) : U("", !0),
736
+ y(o, {
737
+ type: "submit",
738
+ class: "flex-1",
739
+ variant: "primary",
740
+ label: "Save"
741
+ })
742
+ ])
743
+ ]),
744
+ _: 1
745
+ }, 512);
746
+ };
747
+ }
748
+ }), aa = { class: "flex items-end" }, ta = { class: "flex flex-wrap gap-8 items-center mt-4" }, la = { class: "flex mt-6 space-x-6" }, na = /* @__PURE__ */ h({
749
+ __name: "MaybankGateway",
750
+ props: {
751
+ terminal: {
752
+ type: Object,
753
+ required: !0
754
+ },
755
+ onUpdate: {
756
+ type: Function,
757
+ required: !0
758
+ }
759
+ },
760
+ setup(T) {
761
+ const p = T, a = G(() => p.terminal), b = _(), l = _(-1), r = _(), e = _({
762
+ ip: "",
763
+ receiptName: "",
764
+ cardTypes: []
765
+ }), d = () => {
766
+ e.value.ip = "", e.value.receiptName = "", e.value.cardTypes = [], l.value = -1;
767
+ }, c = () => {
768
+ var i;
769
+ if (!a.value.ecrIntegrations)
770
+ return d();
771
+ const s = a.value.ecrIntegrations, t = s.findIndex((u) => u && u.gateway && u.gateway === "Maybank");
772
+ if (t === -1)
773
+ return d();
774
+ l.value = t;
775
+ const o = s.at(t);
776
+ o.gateway === "Maybank" && o.config && (e.value = {
777
+ ip: o.config.ip ?? "",
778
+ receiptName: o.receiptName ?? "",
779
+ cardTypes: ((i = o.dialogConfig) == null ? void 0 : i.cardTypes) ?? []
780
+ });
781
+ };
782
+ A(a, c), q(c);
783
+ async function v(s) {
784
+ var t;
785
+ (t = a.value.ecrIntegrations) == null || t.splice(s, 1), p.onUpdate(a.value);
786
+ }
787
+ async function m() {
788
+ e.value.cardTypes.push(r.value), r.value = "";
789
+ }
790
+ return (s, t) => {
791
+ const o = f("FmTextField"), i = f("FmButton"), u = f("FmChip"), C = f("FmForm");
792
+ return g(), F(C, {
793
+ ref: b.value,
794
+ class: "flex flex-col gap-16 w-[500px]",
795
+ onValidationSuccess: t[3] || (t[3] = () => {
796
+ var n, x;
797
+ l.value > -1 ? a.value.ecrIntegrations[l.value] = {
798
+ gateway: "Maybank",
799
+ config: { ip: e.value.ip },
800
+ receiptName: e.value.receiptName,
801
+ dialogConfig: {
802
+ ...(x = (n = a.value.ecrIntegrations) == null ? void 0 : n[l.value]) == null ? void 0 : x.dialogConfig,
803
+ cardTypes: e.value.cardTypes
804
+ }
805
+ } : (a.value.ecrIntegrations || (a.value.ecrIntegrations = []), a.value.ecrIntegrations.push({
806
+ gateway: "Maybank",
807
+ config: { ip: e.value.ip },
808
+ receiptName: e.value.receiptName,
809
+ dialogConfig: {
810
+ cardTypes: e.value.cardTypes
811
+ }
812
+ })), p.onUpdate(a.value);
813
+ })
814
+ }, {
815
+ default: O(() => [
816
+ y(o, {
817
+ modelValue: e.value.ip,
818
+ "onUpdate:modelValue": t[0] || (t[0] = (n) => e.value.ip = n),
819
+ label: "IP Address"
820
+ }, null, 8, ["modelValue"]),
821
+ y(o, {
822
+ modelValue: e.value.receiptName,
823
+ "onUpdate:modelValue": t[1] || (t[1] = (n) => e.value.receiptName = n),
824
+ label: "Receipt Payment Name",
825
+ "label-info": "Default receipt display will be 'TERMINAL_MAYBANK'"
826
+ }, null, 8, ["modelValue"]),
827
+ I("div", aa, [
828
+ y(o, {
829
+ modelValue: r.value,
830
+ "onUpdate:modelValue": t[2] || (t[2] = (n) => r.value = n),
831
+ label: "Fallback Card Types",
832
+ "label-info": "List of cards when fallback to reconcile dialog. Default VISA, MASTER"
833
+ }, null, 8, ["modelValue"]),
834
+ y(i, {
835
+ class: "ml-4",
836
+ icon: "add",
837
+ onClick: m
838
+ })
839
+ ]),
840
+ I("div", ta, [
841
+ (g(!0), S(D, null, L(e.value.cardTypes, (n) => (g(), F(u, {
842
+ key: n,
843
+ label: n,
844
+ removable: !0,
845
+ onChipClosed: () => e.value.cardTypes.splice(e.value.cardTypes.indexOf(n), 1)
846
+ }, null, 8, ["label", "onChipClosed"]))), 128))
847
+ ]),
848
+ I("div", la, [
849
+ l.value > -1 ? (g(), F(i, {
850
+ key: 0,
851
+ class: "flex-1",
852
+ variant: "secondary",
853
+ label: "Delete",
854
+ onclick: () => v(l.value)
855
+ }, null, 8, ["onclick"])) : U("", !0),
856
+ y(i, {
857
+ type: "submit",
858
+ class: "flex-1",
859
+ variant: "primary",
860
+ label: "Save"
861
+ })
862
+ ])
863
+ ]),
864
+ _: 1
865
+ }, 512);
866
+ };
867
+ }
868
+ }), oa = { class: "flex items-end" }, ra = { class: "flex flex-wrap gap-8 items-center mt-4" }, ia = { class: "flex mt-6 space-x-6" }, sa = /* @__PURE__ */ h({
869
+ __name: "Maybank2Gateway",
870
+ props: {
871
+ terminal: {
872
+ type: Object,
873
+ required: !0
874
+ },
875
+ onUpdate: {
876
+ type: Function,
877
+ required: !0
878
+ }
879
+ },
880
+ setup(T) {
881
+ const p = T, a = G(() => p.terminal), b = _(), l = _(-1), r = _(), e = _({
882
+ ip: "",
883
+ receiptName: "",
884
+ cardTypes: []
885
+ }), d = () => {
886
+ e.value.ip = "", e.value.receiptName = "", e.value.cardTypes = [], l.value = -1;
887
+ }, c = () => {
888
+ var i;
889
+ if (!a.value.ecrIntegrations)
890
+ return d();
891
+ const s = a.value.ecrIntegrations, t = s.findIndex((u) => u && u.gateway && u.gateway === "Maybank2");
892
+ if (t === -1)
893
+ return d();
894
+ l.value = t;
895
+ const o = s.at(t);
896
+ o.gateway === "Maybank2" && o.config && (e.value = {
897
+ ip: o.config.ip ?? "",
898
+ receiptName: o.receiptName ?? "",
899
+ cardTypes: ((i = o.dialogConfig) == null ? void 0 : i.cardTypes) ?? []
900
+ });
901
+ };
902
+ A(a, c), q(c);
903
+ async function v(s) {
904
+ var t;
905
+ (t = a.value.ecrIntegrations) == null || t.splice(s, 1), p.onUpdate(a.value);
906
+ }
907
+ async function m() {
908
+ e.value.cardTypes.push(r.value), r.value = "";
909
+ }
910
+ return (s, t) => {
911
+ const o = f("FmTextField"), i = f("FmButton"), u = f("FmChip"), C = f("FmForm");
912
+ return g(), F(C, {
913
+ ref: b.value,
914
+ class: "flex flex-col gap-16 w-[500px]",
915
+ onValidationSuccess: t[3] || (t[3] = () => {
916
+ var n, x;
917
+ l.value > -1 ? a.value.ecrIntegrations[l.value] = {
918
+ gateway: "Maybank2",
919
+ config: { ip: e.value.ip },
920
+ receiptName: e.value.receiptName,
921
+ dialogConfig: {
922
+ ...(x = (n = a.value.ecrIntegrations) == null ? void 0 : n[l.value]) == null ? void 0 : x.dialogConfig,
923
+ cardTypes: e.value.cardTypes
924
+ }
925
+ } : (a.value.ecrIntegrations || (a.value.ecrIntegrations = []), a.value.ecrIntegrations.push({
926
+ gateway: "Maybank2",
927
+ config: { ip: e.value.ip },
928
+ receiptName: e.value.receiptName,
929
+ dialogConfig: {
930
+ cardTypes: e.value.cardTypes
931
+ }
932
+ })), p.onUpdate(a.value);
933
+ })
934
+ }, {
935
+ default: O(() => [
936
+ y(o, {
937
+ modelValue: e.value.ip,
938
+ "onUpdate:modelValue": t[0] || (t[0] = (n) => e.value.ip = n),
939
+ label: "IP Address"
940
+ }, null, 8, ["modelValue"]),
941
+ y(o, {
942
+ modelValue: e.value.receiptName,
943
+ "onUpdate:modelValue": t[1] || (t[1] = (n) => e.value.receiptName = n),
944
+ label: "Receipt Payment Name",
945
+ "label-info": "Default receipt display will be 'TERMINAL_MAYBANK'"
946
+ }, null, 8, ["modelValue"]),
947
+ I("div", oa, [
948
+ y(o, {
949
+ modelValue: r.value,
950
+ "onUpdate:modelValue": t[2] || (t[2] = (n) => r.value = n),
951
+ label: "Fallback Card Types",
952
+ "label-info": "List of cards when fallback to reconcile dialog. Default VISA, MASTER"
953
+ }, null, 8, ["modelValue"]),
954
+ y(i, {
955
+ class: "ml-4",
956
+ icon: "add",
957
+ onClick: m
958
+ })
959
+ ]),
960
+ I("div", ra, [
961
+ (g(!0), S(D, null, L(e.value.cardTypes, (n) => (g(), F(u, {
962
+ key: n,
963
+ label: n,
964
+ removable: !0,
965
+ onChipClosed: () => e.value.cardTypes.splice(e.value.cardTypes.indexOf(n), 1)
966
+ }, null, 8, ["label", "onChipClosed"]))), 128))
967
+ ]),
968
+ I("div", ia, [
969
+ l.value > -1 ? (g(), F(i, {
970
+ key: 0,
971
+ class: "flex-1",
972
+ variant: "secondary",
973
+ label: "Delete",
974
+ onclick: () => v(l.value)
975
+ }, null, 8, ["onclick"])) : U("", !0),
976
+ y(i, {
977
+ type: "submit",
978
+ class: "flex-1",
979
+ variant: "primary",
980
+ label: "Save"
981
+ })
982
+ ])
983
+ ]),
984
+ _: 1
985
+ }, 512);
986
+ };
987
+ }
988
+ }), ua = { class: "flex items-end" }, ca = { class: "flex flex-wrap gap-8 items-center mt-4" }, ma = { class: "flex mt-6 space-x-6" }, da = /* @__PURE__ */ h({
989
+ __name: "Maybank3Gateway",
990
+ props: {
991
+ terminal: {
992
+ type: Object,
993
+ required: !0
994
+ },
995
+ onUpdate: {
996
+ type: Function,
997
+ required: !0
998
+ }
999
+ },
1000
+ setup(T) {
1001
+ const p = T, a = G(() => p.terminal), b = _(), l = _(-1), r = _(), e = _({
1002
+ receiptName: "",
1003
+ config: {},
1004
+ cardTypes: []
1005
+ }), d = () => {
1006
+ e.value.receiptName = "", e.value.cardTypes = [], l.value = -1;
1007
+ }, c = () => {
1008
+ var i;
1009
+ if (!a.value.ecrIntegrations)
1010
+ return d();
1011
+ const s = a.value.ecrIntegrations, t = s.findIndex((u) => u && u.gateway && u.gateway === "Maybank3");
1012
+ if (t === -1)
1013
+ return d();
1014
+ l.value = t;
1015
+ const o = s.at(t);
1016
+ o.gateway === "Maybank3" && o.config && (e.value = {
1017
+ config: o.config,
1018
+ receiptName: o.receiptName ?? "",
1019
+ cardTypes: ((i = o.dialogConfig) == null ? void 0 : i.cardTypes) ?? []
1020
+ });
1021
+ };
1022
+ A(a, c), q(c);
1023
+ async function v(s) {
1024
+ var t;
1025
+ (t = a.value.ecrIntegrations) == null || t.splice(s, 1), p.onUpdate(a.value);
1026
+ }
1027
+ async function m() {
1028
+ e.value.cardTypes.push(r.value), r.value = "";
1029
+ }
1030
+ return (s, t) => {
1031
+ const o = f("FmTextField"), i = f("FmButton"), u = f("FmChip"), C = f("FmForm");
1032
+ return g(), F(C, {
1033
+ ref: b.value,
1034
+ class: "flex flex-col gap-16 w-[500px]",
1035
+ onValidationSuccess: t[2] || (t[2] = () => {
1036
+ var n, x;
1037
+ l.value > -1 ? a.value.ecrIntegrations[l.value] = {
1038
+ gateway: "Maybank3",
1039
+ config: e.value.config,
1040
+ receiptName: e.value.receiptName,
1041
+ dialogConfig: {
1042
+ ...(x = (n = a.value.ecrIntegrations) == null ? void 0 : n[l.value]) == null ? void 0 : x.dialogConfig,
1043
+ cardTypes: e.value.cardTypes
1044
+ }
1045
+ } : (a.value.ecrIntegrations || (a.value.ecrIntegrations = []), a.value.ecrIntegrations.push({
1046
+ gateway: "Maybank3",
1047
+ config: e.value.config,
1048
+ receiptName: e.value.receiptName,
1049
+ dialogConfig: {
1050
+ cardTypes: e.value.cardTypes
1051
+ }
1052
+ })), p.onUpdate(a.value);
1053
+ })
1054
+ }, {
1055
+ default: O(() => [
1056
+ y(o, {
1057
+ modelValue: e.value.receiptName,
1058
+ "onUpdate:modelValue": t[0] || (t[0] = (n) => e.value.receiptName = n),
1059
+ label: "Receipt Payment Name",
1060
+ "label-info": "Default receipt display will be 'TERMINAL_MAYBANK'"
1061
+ }, null, 8, ["modelValue"]),
1062
+ I("div", ua, [
1063
+ y(o, {
1064
+ modelValue: r.value,
1065
+ "onUpdate:modelValue": t[1] || (t[1] = (n) => r.value = n),
1066
+ label: "Fallback Card Types",
1067
+ "label-info": "List of cards when fallback to reconcile dialog. Default VISA, MASTER"
1068
+ }, null, 8, ["modelValue"]),
1069
+ y(i, {
1070
+ class: "ml-4",
1071
+ icon: "add",
1072
+ onClick: m
1073
+ })
1074
+ ]),
1075
+ I("div", ca, [
1076
+ (g(!0), S(D, null, L(e.value.cardTypes, (n) => (g(), F(u, {
1077
+ key: n,
1078
+ label: n,
1079
+ removable: !0,
1080
+ onChipClosed: () => e.value.cardTypes.splice(e.value.cardTypes.indexOf(n), 1)
1081
+ }, null, 8, ["label", "onChipClosed"]))), 128))
1082
+ ]),
1083
+ I("div", ma, [
1084
+ l.value > -1 ? (g(), F(i, {
1085
+ key: 0,
1086
+ class: "flex-1",
1087
+ variant: "secondary",
1088
+ label: "Delete",
1089
+ onclick: () => v(l.value)
1090
+ }, null, 8, ["onclick"])) : U("", !0),
1091
+ y(i, {
1092
+ type: "submit",
1093
+ class: "flex-1",
1094
+ variant: "primary",
1095
+ label: "Save"
1096
+ })
1097
+ ])
1098
+ ]),
1099
+ _: 1
1100
+ }, 512);
1101
+ };
1102
+ }
1103
+ }), pa = { class: "flex items-end" }, va = { class: "flex flex-wrap gap-8 items-center mt-4" }, ya = { class: "flex mt-6 space-x-6" }, fa = /* @__PURE__ */ h({
1104
+ __name: "NetsGateway",
1105
+ props: {
1106
+ terminal: {
1107
+ type: Object,
1108
+ required: !0
1109
+ },
1110
+ onUpdate: {
1111
+ type: Function,
1112
+ required: !0
1113
+ }
1114
+ },
1115
+ setup(T) {
1116
+ const p = T, a = G(() => p.terminal), b = _(), l = _(-1), r = _(), e = _({
1117
+ ip: "",
1118
+ receiptName: "",
1119
+ cardTypes: []
1120
+ }), d = () => {
1121
+ e.value.ip = "", e.value.receiptName = "", e.value.cardTypes = [], l.value = -1;
1122
+ }, c = () => {
1123
+ var i;
1124
+ if (!a.value.ecrIntegrations)
1125
+ return d();
1126
+ const s = a.value.ecrIntegrations, t = s.findIndex((u) => u && u.gateway && u.gateway === "Nets");
1127
+ if (t === -1)
1128
+ return d();
1129
+ l.value = t;
1130
+ const o = s.at(t);
1131
+ o.gateway === "Nets" && o.config && (e.value = {
1132
+ ip: o.config.ip ?? "",
1133
+ receiptName: o.receiptName ?? "",
1134
+ cardTypes: ((i = o.dialogConfig) == null ? void 0 : i.cardTypes) ?? []
1135
+ });
1136
+ };
1137
+ A(a, c), q(c);
1138
+ async function v(s) {
1139
+ var t;
1140
+ (t = a.value.ecrIntegrations) == null || t.splice(s, 1), p.onUpdate(a.value);
1141
+ }
1142
+ async function m() {
1143
+ e.value.cardTypes.push(r.value), r.value = "";
1144
+ }
1145
+ return (s, t) => {
1146
+ const o = f("FmTextField"), i = f("FmButton"), u = f("FmChip"), C = f("FmForm");
1147
+ return g(), F(C, {
1148
+ ref: b.value,
1149
+ class: "flex flex-col gap-16 w-[500px]",
1150
+ onValidationSuccess: t[3] || (t[3] = () => {
1151
+ var n, x;
1152
+ l.value > -1 ? a.value.ecrIntegrations[l.value] = {
1153
+ gateway: "Nets",
1154
+ config: { ip: e.value.ip },
1155
+ receiptName: e.value.receiptName,
1156
+ dialogConfig: {
1157
+ ...(x = (n = a.value.ecrIntegrations) == null ? void 0 : n[l.value]) == null ? void 0 : x.dialogConfig,
1158
+ cardTypes: e.value.cardTypes
1159
+ }
1160
+ } : (a.value.ecrIntegrations || (a.value.ecrIntegrations = []), a.value.ecrIntegrations.push({
1161
+ gateway: "Nets",
1162
+ config: { ip: e.value.ip },
1163
+ receiptName: e.value.receiptName,
1164
+ dialogConfig: {
1165
+ cardTypes: e.value.cardTypes
1166
+ }
1167
+ })), p.onUpdate(a.value);
1168
+ })
1169
+ }, {
1170
+ default: O(() => [
1171
+ y(o, {
1172
+ modelValue: e.value.ip,
1173
+ "onUpdate:modelValue": t[0] || (t[0] = (n) => e.value.ip = n),
1174
+ label: "IP Address"
1175
+ }, null, 8, ["modelValue"]),
1176
+ y(o, {
1177
+ modelValue: e.value.receiptName,
1178
+ "onUpdate:modelValue": t[1] || (t[1] = (n) => e.value.receiptName = n),
1179
+ label: "Receipt Payment Name",
1180
+ "label-info": "Default receipt display will be 'TERMINAL_NETS'"
1181
+ }, null, 8, ["modelValue"]),
1182
+ I("div", pa, [
1183
+ y(o, {
1184
+ modelValue: r.value,
1185
+ "onUpdate:modelValue": t[2] || (t[2] = (n) => r.value = n),
1186
+ label: "Fallback Card Types",
1187
+ "label-info": "List of cards when fallback to reconcile dialog. Default VISA, MASTER"
1188
+ }, null, 8, ["modelValue"]),
1189
+ y(i, {
1190
+ class: "ml-4",
1191
+ icon: "add",
1192
+ onClick: m
1193
+ })
1194
+ ]),
1195
+ I("div", va, [
1196
+ (g(!0), S(D, null, L(e.value.cardTypes, (n) => (g(), F(u, {
1197
+ key: n,
1198
+ label: n,
1199
+ removable: !0,
1200
+ onChipClosed: () => e.value.cardTypes.splice(e.value.cardTypes.indexOf(n), 1)
1201
+ }, null, 8, ["label", "onChipClosed"]))), 128))
1202
+ ]),
1203
+ I("div", ya, [
1204
+ l.value > -1 ? (g(), F(i, {
1205
+ key: 0,
1206
+ class: "flex-1",
1207
+ variant: "secondary",
1208
+ label: "Delete",
1209
+ onclick: () => v(l.value)
1210
+ }, null, 8, ["onclick"])) : U("", !0),
1211
+ y(i, {
1212
+ type: "submit",
1213
+ class: "flex-1",
1214
+ variant: "primary",
1215
+ label: "Save"
1216
+ })
1217
+ ])
1218
+ ]),
1219
+ _: 1
1220
+ }, 512);
1221
+ };
1222
+ }
1223
+ }), ga = { class: "flex items-end" }, ba = { class: "flex flex-wrap gap-8 items-center mt-4" }, _a = { class: "flex mt-6 space-x-6" }, Ta = /* @__PURE__ */ h({
1224
+ __name: "KBankGateway",
1225
+ props: {
1226
+ terminal: {
1227
+ type: Object,
1228
+ required: !0
1229
+ },
1230
+ onUpdate: {
1231
+ type: Function,
1232
+ required: !0
1233
+ }
1234
+ },
1235
+ setup(T) {
1236
+ const p = T, a = G(() => p.terminal), b = _(), l = _(-1), r = _(), e = _({
1237
+ receiptName: "",
1238
+ cardTypes: []
1239
+ }), d = () => {
1240
+ e.value.receiptName = "", e.value.cardTypes = [], l.value = -1;
1241
+ }, c = () => {
1242
+ var i;
1243
+ if (!a.value.ecrIntegrations)
1244
+ return d();
1245
+ const s = a.value.ecrIntegrations, t = s.findIndex((u) => u && u.gateway && u.gateway === "Kbank");
1246
+ if (t === -1)
1247
+ return d();
1248
+ l.value = t;
1249
+ const o = s.at(t);
1250
+ o.gateway === "Kbank" && o.config && (e.value = {
1251
+ receiptName: o.receiptName ?? "",
1252
+ cardTypes: ((i = o.dialogConfig) == null ? void 0 : i.cardTypes) ?? []
1253
+ });
1254
+ };
1255
+ A(a, c), q(c);
1256
+ async function v(s) {
1257
+ var t;
1258
+ (t = a.value.ecrIntegrations) == null || t.splice(s, 1), p.onUpdate(a.value);
1259
+ }
1260
+ async function m() {
1261
+ e.value.cardTypes.push(r.value), r.value = "";
1262
+ }
1263
+ return (s, t) => {
1264
+ const o = f("FmTextField"), i = f("FmButton"), u = f("FmChip"), C = f("FmForm");
1265
+ return g(), F(C, {
1266
+ ref: b.value,
1267
+ class: "flex flex-col gap-16 w-[500px]",
1268
+ onValidationSuccess: t[2] || (t[2] = () => {
1269
+ var n, x;
1270
+ l.value > -1 ? a.value.ecrIntegrations[l.value] = {
1271
+ gateway: "Kbank",
1272
+ config: {},
1273
+ receiptName: e.value.receiptName,
1274
+ dialogConfig: {
1275
+ ...(x = (n = a.value.ecrIntegrations) == null ? void 0 : n[l.value]) == null ? void 0 : x.dialogConfig,
1276
+ cardTypes: e.value.cardTypes
1277
+ }
1278
+ } : (a.value.ecrIntegrations || (a.value.ecrIntegrations = []), a.value.ecrIntegrations.push({
1279
+ gateway: "Kbank",
1280
+ config: {},
1281
+ receiptName: e.value.receiptName,
1282
+ dialogConfig: {
1283
+ cardTypes: e.value.cardTypes
1284
+ }
1285
+ })), p.onUpdate(a.value);
1286
+ })
1287
+ }, {
1288
+ default: O(() => [
1289
+ y(o, {
1290
+ modelValue: e.value.receiptName,
1291
+ "onUpdate:modelValue": t[0] || (t[0] = (n) => e.value.receiptName = n),
1292
+ label: "Receipt Payment Name",
1293
+ "label-info": "Default receipt display will be 'TERMINAL_KBANK'"
1294
+ }, null, 8, ["modelValue"]),
1295
+ I("div", ga, [
1296
+ y(o, {
1297
+ modelValue: r.value,
1298
+ "onUpdate:modelValue": t[1] || (t[1] = (n) => r.value = n),
1299
+ label: "Fallback Card Types",
1300
+ "label-info": "List of cards when fallback to reconcile dialog. Default VISA, MASTER"
1301
+ }, null, 8, ["modelValue"]),
1302
+ y(i, {
1303
+ class: "ml-4",
1304
+ icon: "add",
1305
+ onClick: m
1306
+ })
1307
+ ]),
1308
+ I("div", ba, [
1309
+ (g(!0), S(D, null, L(e.value.cardTypes, (n) => (g(), F(u, {
1310
+ key: n,
1311
+ label: n,
1312
+ removable: !0,
1313
+ onChipClosed: () => e.value.cardTypes.splice(e.value.cardTypes.indexOf(n), 1)
1314
+ }, null, 8, ["label", "onChipClosed"]))), 128))
1315
+ ]),
1316
+ I("div", _a, [
1317
+ l.value > -1 ? (g(), F(i, {
1318
+ key: 0,
1319
+ class: "flex-1",
1320
+ variant: "secondary",
1321
+ label: "Delete",
1322
+ onclick: () => v(l.value)
1323
+ }, null, 8, ["onclick"])) : U("", !0),
1324
+ y(i, {
1325
+ type: "submit",
1326
+ class: "flex-1",
1327
+ variant: "primary",
1328
+ label: "Save"
1329
+ })
1330
+ ])
1331
+ ]),
1332
+ _: 1
1333
+ }, 512);
1334
+ };
1335
+ }
1336
+ }), Ia = { class: "flex mt-6 space-x-6" }, Fa = /* @__PURE__ */ h({
1337
+ __name: "Ghl2Gateway",
1338
+ props: {
1339
+ terminal: {
1340
+ type: Object,
1341
+ required: !0
1342
+ },
1343
+ onUpdate: {
1344
+ type: Function,
1345
+ required: !0
1346
+ }
1347
+ },
1348
+ setup(T) {
1349
+ const p = T, a = G(() => p.terminal), b = _(), l = _(-1), r = _({
1350
+ ip: "",
1351
+ receiptName: ""
1352
+ }), e = () => {
1353
+ r.value.ip = "", r.value.receiptName = "", l.value = -1;
1354
+ }, d = () => {
1355
+ if (!a.value.ecrIntegrations)
1356
+ return e();
1357
+ const v = a.value.ecrIntegrations, m = v.findIndex((t) => t && t.gateway && t.gateway === "Ghl2");
1358
+ if (m === -1)
1359
+ return e();
1360
+ l.value = m;
1361
+ const s = v.at(m);
1362
+ s.gateway === "Ghl2" && s.config && (r.value = {
1363
+ ip: s.config.ip ?? "",
1364
+ receiptName: s.receiptName ?? ""
1365
+ });
1366
+ };
1367
+ A(a, d), q(d);
1368
+ async function c(v) {
1369
+ var m;
1370
+ (m = a.value.ecrIntegrations) == null || m.splice(v, 1), p.onUpdate(a.value);
1371
+ }
1372
+ return (v, m) => {
1373
+ const s = f("FmTextField"), t = f("FmButton"), o = f("FmForm");
1374
+ return g(), F(o, {
1375
+ ref: b.value,
1376
+ class: "flex flex-col gap-16 w-[500px]",
1377
+ onValidationSuccess: m[2] || (m[2] = () => {
1378
+ a.value.ecrIntegrations || (a.value.ecrIntegrations = []), l.value > -1 ? a.value.ecrIntegrations[l.value] = {
1379
+ gateway: "Ghl2",
1380
+ config: { ip: r.value.ip },
1381
+ receiptName: r.value.receiptName
1382
+ } : a.value.ecrIntegrations.push({
1383
+ gateway: "Ghl2",
1384
+ config: { ip: r.value.ip },
1385
+ receiptName: r.value.receiptName
1386
+ }), p.onUpdate(a.value);
1387
+ })
1388
+ }, {
1389
+ default: O(() => [
1390
+ y(s, {
1391
+ modelValue: r.value.ip,
1392
+ "onUpdate:modelValue": m[0] || (m[0] = (i) => r.value.ip = i),
1393
+ label: "IP Address"
1394
+ }, null, 8, ["modelValue"]),
1395
+ y(s, {
1396
+ modelValue: r.value.receiptName,
1397
+ "onUpdate:modelValue": m[1] || (m[1] = (i) => r.value.receiptName = i),
1398
+ label: "Receipt Payment Name",
1399
+ "label-info": "Default receipt display will be 'TERMINAL_GHL_2'"
1400
+ }, null, 8, ["modelValue"]),
1401
+ I("div", Ia, [
1402
+ l.value > -1 ? (g(), F(t, {
1403
+ key: 0,
1404
+ class: "flex-1",
1405
+ variant: "secondary",
1406
+ label: "Delete",
1407
+ onclick: () => c(l.value)
1408
+ }, null, 8, ["onclick"])) : U("", !0),
1409
+ y(t, {
1410
+ type: "submit",
1411
+ class: "flex-1",
1412
+ variant: "primary",
1413
+ label: "Save"
1414
+ })
1415
+ ])
1416
+ ]),
1417
+ _: 1
1418
+ }, 512);
1419
+ };
1420
+ }
1421
+ }), wa = { class: "flex items-end" }, xa = { class: "flex flex-wrap gap-8 items-center mt-4" }, Ca = { class: "flex mt-6 space-x-6" }, ka = /* @__PURE__ */ h({
1422
+ __name: "Ghl3Gateway",
1423
+ props: {
1424
+ terminal: {
1425
+ type: Object,
1426
+ required: !0
1427
+ },
1428
+ onUpdate: {
1429
+ type: Function,
1430
+ required: !0
1431
+ }
1432
+ },
1433
+ setup(T) {
1434
+ const p = T, a = G(() => p.terminal), b = _(), l = _(-1), r = _(), e = _({
1435
+ receiptName: "",
1436
+ config: {},
1437
+ cardTypes: []
1438
+ }), d = () => {
1439
+ e.value.receiptName = "", e.value.cardTypes = [], l.value = -1;
1440
+ }, c = () => {
1441
+ var i;
1442
+ if (!a.value.ecrIntegrations)
1443
+ return d();
1444
+ const s = a.value.ecrIntegrations, t = s.findIndex(
1445
+ (u) => u && u.gateway && u.gateway === "Ghl3"
1446
+ );
1447
+ if (t === -1)
1448
+ return d();
1449
+ l.value = t;
1450
+ const o = s.at(t);
1451
+ o.gateway === "Ghl3" && o.config && (e.value = {
1452
+ config: o.config,
1453
+ receiptName: o.receiptName ?? "",
1454
+ cardTypes: ((i = o.dialogConfig) == null ? void 0 : i.cardTypes) ?? []
1455
+ });
1456
+ };
1457
+ A(a, c), q(c);
1458
+ async function v(s) {
1459
+ var t;
1460
+ (t = a.value.ecrIntegrations) == null || t.splice(s, 1), p.onUpdate(a.value);
1461
+ }
1462
+ async function m() {
1463
+ e.value.cardTypes.push(r.value), r.value = "";
1464
+ }
1465
+ return (s, t) => {
1466
+ const o = f("FmTextField"), i = f("FmButton"), u = f("FmChip"), C = f("FmForm");
1467
+ return g(), F(C, {
1468
+ ref: b.value,
1469
+ class: "flex flex-col gap-16 w-[500px]",
1470
+ onValidationSuccess: t[2] || (t[2] = () => {
1471
+ var n, x;
1472
+ l.value > -1 ? a.value.ecrIntegrations[l.value] = {
1473
+ gateway: "Ghl3",
1474
+ config: e.value.config,
1475
+ receiptName: e.value.receiptName,
1476
+ dialogConfig: {
1477
+ ...(x = (n = a.value.ecrIntegrations) == null ? void 0 : n[l.value]) == null ? void 0 : x.dialogConfig,
1478
+ cardTypes: e.value.cardTypes
1479
+ }
1480
+ } : (a.value.ecrIntegrations || (a.value.ecrIntegrations = []), a.value.ecrIntegrations.push({
1481
+ gateway: "Ghl3",
1482
+ config: e.value.config,
1483
+ receiptName: e.value.receiptName,
1484
+ dialogConfig: {
1485
+ cardTypes: e.value.cardTypes
1486
+ }
1487
+ })), p.onUpdate(a.value);
1488
+ })
1489
+ }, {
1490
+ default: O(() => [
1491
+ y(o, {
1492
+ modelValue: e.value.receiptName,
1493
+ "onUpdate:modelValue": t[0] || (t[0] = (n) => e.value.receiptName = n),
1494
+ label: "Receipt Payment Name",
1495
+ "label-info": "Default receipt display will be 'TERMINAL_GHL'"
1496
+ }, null, 8, ["modelValue"]),
1497
+ I("div", wa, [
1498
+ y(o, {
1499
+ modelValue: r.value,
1500
+ "onUpdate:modelValue": t[1] || (t[1] = (n) => r.value = n),
1501
+ label: "Fallback Card Types",
1502
+ "label-info": "List of cards when fallback to reconcile dialog. Default VISA, MASTER"
1503
+ }, null, 8, ["modelValue"]),
1504
+ y(i, {
1505
+ class: "ml-4",
1506
+ icon: "add",
1507
+ onClick: m
1508
+ })
1509
+ ]),
1510
+ I("div", xa, [
1511
+ (g(!0), S(D, null, L(e.value.cardTypes, (n) => (g(), F(u, {
1512
+ key: n,
1513
+ label: n,
1514
+ removable: !0,
1515
+ onChipClosed: () => e.value.cardTypes.splice(e.value.cardTypes.indexOf(n), 1)
1516
+ }, null, 8, ["label", "onChipClosed"]))), 128))
1517
+ ]),
1518
+ I("div", Ca, [
1519
+ l.value > -1 ? (g(), F(i, {
1520
+ key: 0,
1521
+ class: "flex-1",
1522
+ variant: "secondary",
1523
+ label: "Delete",
1524
+ onclick: () => v(l.value)
1525
+ }, null, 8, ["onclick"])) : U("", !0),
1526
+ y(i, {
1527
+ type: "submit",
1528
+ class: "flex-1",
1529
+ variant: "primary",
1530
+ label: "Save"
1531
+ })
1532
+ ])
1533
+ ]),
1534
+ _: 1
1535
+ }, 512);
1536
+ };
1537
+ }
1538
+ }), Na = { class: "flex items-end" }, Va = { class: "flex flex-wrap gap-8 items-center mt-4" }, Sa = { class: "flex mt-6 space-x-6" }, Ua = /* @__PURE__ */ h({
1539
+ __name: "HlbbGateway",
1540
+ props: {
1541
+ terminal: {
1542
+ type: Object,
1543
+ required: !0
1544
+ },
1545
+ onUpdate: {
1546
+ type: Function,
1547
+ required: !0
1548
+ }
1549
+ },
1550
+ setup(T) {
1551
+ const p = T, a = G(() => p.terminal), b = _(), l = _(-1), r = _(), e = _({
1552
+ receiptName: "",
1553
+ config: {},
1554
+ cardTypes: []
1555
+ }), d = () => {
1556
+ e.value.receiptName = "", e.value.cardTypes = [], l.value = -1;
1557
+ }, c = () => {
1558
+ var i;
1559
+ if (!a.value.ecrIntegrations)
1560
+ return d();
1561
+ const s = a.value.ecrIntegrations, t = s.findIndex(
1562
+ (u) => u && u.gateway && u.gateway === "Hlbb"
1563
+ );
1564
+ if (t === -1)
1565
+ return d();
1566
+ l.value = t;
1567
+ const o = s.at(t);
1568
+ o.gateway === "Hlbb" && o.config && (e.value = {
1569
+ config: o.config,
1570
+ receiptName: o.receiptName ?? "",
1571
+ cardTypes: ((i = o.dialogConfig) == null ? void 0 : i.cardTypes) ?? []
1572
+ });
1573
+ };
1574
+ A(a, c), q(c);
1575
+ async function v(s) {
1576
+ var t;
1577
+ (t = a.value.ecrIntegrations) == null || t.splice(s, 1), p.onUpdate(a.value);
1578
+ }
1579
+ async function m() {
1580
+ e.value.cardTypes.push(r.value), r.value = "";
1581
+ }
1582
+ return (s, t) => {
1583
+ const o = f("FmTextField"), i = f("FmButton"), u = f("FmChip"), C = f("FmForm");
1584
+ return g(), F(C, {
1585
+ ref: b.value,
1586
+ class: "flex flex-col gap-16 w-[500px]",
1587
+ onValidationSuccess: t[2] || (t[2] = () => {
1588
+ var n, x;
1589
+ l.value > -1 ? a.value.ecrIntegrations[l.value] = {
1590
+ gateway: "Hlbb",
1591
+ config: e.value.config,
1592
+ receiptName: e.value.receiptName,
1593
+ dialogConfig: {
1594
+ ...(x = (n = a.value.ecrIntegrations) == null ? void 0 : n[l.value]) == null ? void 0 : x.dialogConfig,
1595
+ cardTypes: e.value.cardTypes
1596
+ }
1597
+ } : (a.value.ecrIntegrations || (a.value.ecrIntegrations = []), a.value.ecrIntegrations.push({
1598
+ gateway: "Hlbb",
1599
+ config: e.value.config,
1600
+ receiptName: e.value.receiptName,
1601
+ dialogConfig: {
1602
+ cardTypes: e.value.cardTypes
1603
+ }
1604
+ })), p.onUpdate(a.value);
1605
+ })
1606
+ }, {
1607
+ default: O(() => [
1608
+ y(o, {
1609
+ modelValue: e.value.receiptName,
1610
+ "onUpdate:modelValue": t[0] || (t[0] = (n) => e.value.receiptName = n),
1611
+ label: "Receipt Payment Name",
1612
+ "label-info": "Default receipt display will be 'TERMINAL_MAYBANK'"
1613
+ }, null, 8, ["modelValue"]),
1614
+ I("div", Na, [
1615
+ y(o, {
1616
+ modelValue: r.value,
1617
+ "onUpdate:modelValue": t[1] || (t[1] = (n) => r.value = n),
1618
+ label: "Fallback Card Types",
1619
+ "label-info": "List of cards when fallback to reconcile dialog. Default VISA, MASTER"
1620
+ }, null, 8, ["modelValue"]),
1621
+ y(i, {
1622
+ class: "ml-4",
1623
+ icon: "add",
1624
+ onClick: m
1625
+ })
1626
+ ]),
1627
+ I("div", Va, [
1628
+ (g(!0), S(D, null, L(e.value.cardTypes, (n) => (g(), F(u, {
1629
+ key: n,
1630
+ label: n,
1631
+ removable: !0,
1632
+ onChipClosed: () => e.value.cardTypes.splice(e.value.cardTypes.indexOf(n), 1)
1633
+ }, null, 8, ["label", "onChipClosed"]))), 128))
1634
+ ]),
1635
+ I("div", Sa, [
1636
+ l.value > -1 ? (g(), F(i, {
1637
+ key: 0,
1638
+ class: "flex-1",
1639
+ variant: "secondary",
1640
+ label: "Delete",
1641
+ onclick: () => v(l.value)
1642
+ }, null, 8, ["onclick"])) : U("", !0),
1643
+ y(i, {
1644
+ type: "submit",
1645
+ class: "flex-1",
1646
+ variant: "primary",
1647
+ label: "Save"
1648
+ })
1649
+ ])
1650
+ ]),
1651
+ _: 1
1652
+ }, 512);
1653
+ };
1654
+ }
1655
+ }), ha = { class: "flex items-end" }, Ra = { class: "flex flex-wrap gap-8 items-center mt-4" }, Pa = { class: "flex mt-6 space-x-6" }, Ba = /* @__PURE__ */ h({
1656
+ __name: "GlobalPaymentsGateway",
1657
+ props: {
1658
+ terminal: {
1659
+ type: Object,
1660
+ required: !0
1661
+ },
1662
+ onUpdate: {
1663
+ type: Function,
1664
+ required: !0
1665
+ }
1666
+ },
1667
+ setup(T) {
1668
+ const p = T, a = G(() => p.terminal), b = _(), l = _(-1), r = _(), e = _({
1669
+ ip: "",
1670
+ receiptName: "",
1671
+ cardTypes: []
1672
+ }), d = () => {
1673
+ e.value.ip = "", e.value.receiptName = "", e.value.cardTypes = [], l.value = -1;
1674
+ }, c = () => {
1675
+ var i;
1676
+ if (!a.value.ecrIntegrations)
1677
+ return d();
1678
+ const s = a.value.ecrIntegrations, t = s.findIndex(
1679
+ (u) => u && u.gateway && u.gateway === "GlobalPayments"
1680
+ );
1681
+ if (t === -1)
1682
+ return d();
1683
+ l.value = t;
1684
+ const o = s.at(t);
1685
+ o.gateway === "GlobalPayments" && o.config && (e.value = {
1686
+ ip: o.config.ip ?? "",
1687
+ receiptName: o.receiptName ?? "",
1688
+ cardTypes: ((i = o.dialogConfig) == null ? void 0 : i.cardTypes) ?? []
1689
+ });
1690
+ };
1691
+ A(a, c), q(c);
1692
+ async function v(s) {
1693
+ var t;
1694
+ (t = a.value.ecrIntegrations) == null || t.splice(s, 1), p.onUpdate(a.value);
1695
+ }
1696
+ async function m() {
1697
+ e.value.cardTypes.push(r.value), r.value = "";
1698
+ }
1699
+ return (s, t) => {
1700
+ const o = f("FmTextField"), i = f("FmButton"), u = f("FmChip"), C = f("FmForm");
1701
+ return g(), F(C, {
1702
+ ref: b.value,
1703
+ class: "flex flex-col gap-16 w-[500px]",
1704
+ onValidationSuccess: t[3] || (t[3] = () => {
1705
+ var n, x;
1706
+ l.value > -1 ? a.value.ecrIntegrations[l.value] = {
1707
+ gateway: "GlobalPayments",
1708
+ config: { ip: e.value.ip },
1709
+ receiptName: e.value.receiptName,
1710
+ dialogConfig: {
1711
+ ...(x = (n = a.value.ecrIntegrations) == null ? void 0 : n[l.value]) == null ? void 0 : x.dialogConfig,
1712
+ cardTypes: e.value.cardTypes
1713
+ }
1714
+ } : (a.value.ecrIntegrations || (a.value.ecrIntegrations = []), a.value.ecrIntegrations.push({
1715
+ gateway: "GlobalPayments",
1716
+ config: { ip: e.value.ip },
1717
+ receiptName: e.value.receiptName,
1718
+ dialogConfig: {
1719
+ cardTypes: e.value.cardTypes
1720
+ }
1721
+ })), p.onUpdate(a.value);
1722
+ })
1723
+ }, {
1724
+ default: O(() => [
1725
+ y(o, {
1726
+ modelValue: e.value.ip,
1727
+ "onUpdate:modelValue": t[0] || (t[0] = (n) => e.value.ip = n),
1728
+ label: "IP Address"
1729
+ }, null, 8, ["modelValue"]),
1730
+ y(o, {
1731
+ modelValue: e.value.receiptName,
1732
+ "onUpdate:modelValue": t[1] || (t[1] = (n) => e.value.receiptName = n),
1733
+ label: "Receipt Payment Name",
1734
+ "label-info": "Default receipt display will be 'TERMINAL_GP'"
1735
+ }, null, 8, ["modelValue"]),
1736
+ I("div", ha, [
1737
+ y(o, {
1738
+ modelValue: r.value,
1739
+ "onUpdate:modelValue": t[2] || (t[2] = (n) => r.value = n),
1740
+ label: "Fallback Card Types",
1741
+ "label-info": "List of cards when fallback to reconcile dialog. Default VISA, MASTER"
1742
+ }, null, 8, ["modelValue"]),
1743
+ y(i, {
1744
+ class: "ml-4",
1745
+ icon: "add",
1746
+ onClick: m
1747
+ })
1748
+ ]),
1749
+ I("div", Ra, [
1750
+ (g(!0), S(D, null, L(e.value.cardTypes, (n) => (g(), F(u, {
1751
+ key: n,
1752
+ label: n,
1753
+ removable: !0,
1754
+ onChipClosed: () => e.value.cardTypes.splice(e.value.cardTypes.indexOf(n), 1)
1755
+ }, null, 8, ["label", "onChipClosed"]))), 128))
1756
+ ]),
1757
+ I("div", Pa, [
1758
+ l.value > -1 ? (g(), F(i, {
1759
+ key: 0,
1760
+ class: "flex-1",
1761
+ variant: "secondary",
1762
+ label: "Delete",
1763
+ onclick: () => v(l.value)
1764
+ }, null, 8, ["onclick"])) : U("", !0),
1765
+ y(i, {
1766
+ type: "submit",
1767
+ class: "flex-1",
1768
+ variant: "primary",
1769
+ label: "Save"
1770
+ })
1771
+ ])
1772
+ ]),
1773
+ _: 1
1774
+ }, 512);
1775
+ };
1776
+ }
1777
+ }), Oa = { class: "flex items-end" }, Ma = { class: "flex flex-wrap gap-8 items-center mt-4" }, Aa = { class: "flex mt-6 space-x-6" }, qa = /* @__PURE__ */ h({
1778
+ __name: "OmaGateway",
1779
+ props: {
1780
+ terminal: {
1781
+ type: Object,
1782
+ required: !0
1783
+ },
1784
+ onUpdate: {
1785
+ type: Function,
1786
+ required: !0
1787
+ }
1788
+ },
1789
+ setup(T) {
1790
+ const p = T, a = G(() => p.terminal), b = _(), l = _(-1), r = _(), e = _({
1791
+ receiptName: "",
1792
+ cardTypes: []
1793
+ }), d = () => {
1794
+ e.value.receiptName = "", e.value.cardTypes = [], l.value = -1;
1795
+ }, c = () => {
1796
+ var i;
1797
+ if (!a.value.ecrIntegrations)
1798
+ return d();
1799
+ const s = a.value.ecrIntegrations, t = s.findIndex(
1800
+ (u) => u && u.gateway && u.gateway === "Oma"
1801
+ );
1802
+ if (t === -1)
1803
+ return d();
1804
+ l.value = t;
1805
+ const o = s.at(t);
1806
+ o.gateway === "Oma" && o.config && (e.value = {
1807
+ receiptName: o.receiptName ?? "",
1808
+ cardTypes: ((i = o.dialogConfig) == null ? void 0 : i.cardTypes) ?? []
1809
+ });
1810
+ };
1811
+ A(a, c), q(c);
1812
+ async function v(s) {
1813
+ var t;
1814
+ (t = a.value.ecrIntegrations) == null || t.splice(s, 1), p.onUpdate(a.value);
1815
+ }
1816
+ async function m() {
1817
+ e.value.cardTypes.push(r.value), r.value = "";
1818
+ }
1819
+ return (s, t) => {
1820
+ const o = f("FmTextField"), i = f("FmButton"), u = f("FmChip"), C = f("FmForm");
1821
+ return g(), F(C, {
1822
+ ref: b.value,
1823
+ class: "flex flex-col gap-16 w-[500px]",
1824
+ onValidationSuccess: t[2] || (t[2] = () => {
1825
+ var n, x;
1826
+ l.value > -1 ? a.value.ecrIntegrations[l.value] = {
1827
+ gateway: "Oma",
1828
+ config: {},
1829
+ receiptName: e.value.receiptName,
1830
+ dialogConfig: {
1831
+ ...(x = (n = a.value.ecrIntegrations) == null ? void 0 : n[l.value]) == null ? void 0 : x.dialogConfig,
1832
+ cardTypes: e.value.cardTypes
1833
+ }
1834
+ } : (a.value.ecrIntegrations || (a.value.ecrIntegrations = []), a.value.ecrIntegrations.push({
1835
+ gateway: "Oma",
1836
+ config: {},
1837
+ receiptName: e.value.receiptName,
1838
+ dialogConfig: {
1839
+ cardTypes: e.value.cardTypes
1840
+ }
1841
+ })), p.onUpdate(a.value);
1842
+ })
1843
+ }, {
1844
+ default: O(() => [
1845
+ y(o, {
1846
+ modelValue: e.value.receiptName,
1847
+ "onUpdate:modelValue": t[0] || (t[0] = (n) => e.value.receiptName = n),
1848
+ label: "Receipt Payment Name",
1849
+ "label-info": "Default receipt display will be 'TERMINAL_OMA'"
1850
+ }, null, 8, ["modelValue"]),
1851
+ I("div", Oa, [
1852
+ y(o, {
1853
+ modelValue: r.value,
1854
+ "onUpdate:modelValue": t[1] || (t[1] = (n) => r.value = n),
1855
+ label: "Fallback Card Types",
1856
+ "label-info": "List of cards when fallback to reconcile dialog. Default VISA, MASTER"
1857
+ }, null, 8, ["modelValue"]),
1858
+ y(i, {
1859
+ class: "ml-4",
1860
+ icon: "add",
1861
+ onClick: m
1862
+ })
1863
+ ]),
1864
+ I("div", Ma, [
1865
+ (g(!0), S(D, null, L(e.value.cardTypes, (n) => (g(), F(u, {
1866
+ key: n,
1867
+ label: n,
1868
+ removable: !0,
1869
+ onChipClosed: () => e.value.cardTypes.splice(e.value.cardTypes.indexOf(n), 1)
1870
+ }, null, 8, ["label", "onChipClosed"]))), 128))
1871
+ ]),
1872
+ I("div", Aa, [
1873
+ l.value > -1 ? (g(), F(i, {
1874
+ key: 0,
1875
+ class: "flex-1",
1876
+ variant: "secondary",
1877
+ label: "Delete",
1878
+ onclick: () => v(l.value)
1879
+ }, null, 8, ["onclick"])) : U("", !0),
1880
+ y(i, {
1881
+ type: "submit",
1882
+ class: "flex-1",
1883
+ variant: "primary",
1884
+ label: "Save"
1885
+ })
1886
+ ])
1887
+ ]),
1888
+ _: 1
1889
+ }, 512);
1890
+ };
1891
+ }
1892
+ }), Ga = { class: "flex items-end" }, Da = { class: "flex flex-wrap gap-8 items-center mt-4" }, $a = { class: "flex mt-6 space-x-6" }, Ea = /* @__PURE__ */ h({
1893
+ __name: "RevenueGateway",
1894
+ props: {
1895
+ terminal: {
1896
+ type: Object,
1897
+ required: !0
1898
+ },
1899
+ onUpdate: {
1900
+ type: Function,
1901
+ required: !0
1902
+ }
1903
+ },
1904
+ setup(T) {
1905
+ const p = T, a = G(() => p.terminal), b = _(), l = _(-1), r = _(), e = _({
1906
+ receiptName: "",
1907
+ ip: "",
1908
+ cardTypes: []
1909
+ }), d = () => {
1910
+ e.value.receiptName = "", e.value.ip = "", e.value.cardTypes = [], l.value = -1;
1911
+ }, c = () => {
1912
+ var i;
1913
+ if (!a.value.ecrIntegrations)
1914
+ return d();
1915
+ const s = a.value.ecrIntegrations, t = s.findIndex(
1916
+ (u) => u && u.gateway && u.gateway === "Revenue"
1917
+ );
1918
+ if (t === -1)
1919
+ return d();
1920
+ l.value = t;
1921
+ const o = s.at(t);
1922
+ o.gateway === "Revenue" && o.config && (e.value = {
1923
+ receiptName: o.receiptName ?? "",
1924
+ ip: o.config.ip ?? "",
1925
+ cardTypes: ((i = o.dialogConfig) == null ? void 0 : i.cardTypes) ?? []
1926
+ });
1927
+ };
1928
+ A(a, c), q(c);
1929
+ async function v(s) {
1930
+ var t;
1931
+ (t = a.value.ecrIntegrations) == null || t.splice(s, 1), p.onUpdate(a.value);
1932
+ }
1933
+ async function m() {
1934
+ e.value.cardTypes.push(r.value), r.value = "";
1935
+ }
1936
+ return (s, t) => {
1937
+ const o = f("FmTextField"), i = f("FmButton"), u = f("FmChip"), C = f("FmForm");
1938
+ return g(), F(C, {
1939
+ ref: b.value,
1940
+ class: "flex flex-col gap-16 w-[500px]",
1941
+ onValidationSuccess: t[3] || (t[3] = () => {
1942
+ var x, E;
1943
+ const n = {
1944
+ type: "tcp",
1945
+ ip: e.value.ip
1946
+ };
1947
+ l.value > -1 ? a.value.ecrIntegrations[l.value] = {
1948
+ gateway: "Revenue",
1949
+ config: n,
1950
+ receiptName: e.value.receiptName,
1951
+ dialogConfig: {
1952
+ ...(E = (x = a.value.ecrIntegrations) == null ? void 0 : x[l.value]) == null ? void 0 : E.dialogConfig,
1953
+ cardTypes: e.value.cardTypes
1954
+ }
1955
+ } : (a.value.ecrIntegrations || (a.value.ecrIntegrations = []), a.value.ecrIntegrations.push({
1956
+ gateway: "Revenue",
1957
+ config: n,
1958
+ receiptName: e.value.receiptName,
1959
+ dialogConfig: {
1960
+ cardTypes: e.value.cardTypes
1961
+ }
1962
+ })), p.onUpdate(a.value);
1963
+ })
1964
+ }, {
1965
+ default: O(() => [
1966
+ y(o, {
1967
+ modelValue: e.value.ip,
1968
+ "onUpdate:modelValue": t[0] || (t[0] = (n) => e.value.ip = n),
1969
+ label: "Terminal IP Address",
1970
+ "label-info": "Terminal WiFi IP with optional port, e.g. 192.168.1.50:8080 (defaults to port 8080)",
1971
+ rules: N(X)(N(Z).string().min(1))
1972
+ }, null, 8, ["modelValue", "rules"]),
1973
+ y(o, {
1974
+ modelValue: e.value.receiptName,
1975
+ "onUpdate:modelValue": t[1] || (t[1] = (n) => e.value.receiptName = n),
1976
+ label: "Receipt Payment Name",
1977
+ "label-info": "Default receipt display will be 'TERMINAL_REVENUE'"
1978
+ }, null, 8, ["modelValue"]),
1979
+ I("div", Ga, [
1980
+ y(o, {
1981
+ modelValue: r.value,
1982
+ "onUpdate:modelValue": t[2] || (t[2] = (n) => r.value = n),
1983
+ label: "Fallback Card Types",
1984
+ "label-info": "List of cards when fallback to reconcile dialog. Default VISA, MASTER"
1985
+ }, null, 8, ["modelValue"]),
1986
+ y(i, {
1987
+ class: "ml-4",
1988
+ icon: "add",
1989
+ onClick: m
1990
+ })
1991
+ ]),
1992
+ I("div", Da, [
1993
+ (g(!0), S(D, null, L(e.value.cardTypes, (n) => (g(), F(u, {
1994
+ key: n,
1995
+ label: n,
1996
+ removable: !0,
1997
+ onChipClosed: () => e.value.cardTypes.splice(e.value.cardTypes.indexOf(n), 1)
1998
+ }, null, 8, ["label", "onChipClosed"]))), 128))
1999
+ ]),
2000
+ I("div", $a, [
2001
+ l.value > -1 ? (g(), F(i, {
2002
+ key: 0,
2003
+ class: "flex-1",
2004
+ variant: "secondary",
2005
+ label: "Delete",
2006
+ onclick: () => v(l.value)
2007
+ }, null, 8, ["onclick"])) : U("", !0),
2008
+ y(i, {
2009
+ type: "submit",
2010
+ class: "flex-1",
2011
+ variant: "primary",
2012
+ label: "Save"
2013
+ })
2014
+ ])
2015
+ ]),
2016
+ _: 1
2017
+ }, 512);
2018
+ };
2019
+ }
2020
+ }), La = {
2021
+ key: 0,
2022
+ class: "flex items-center justify-center min-h-[80vh]"
2023
+ }, Ya = { class: "flex mt-6 space-x-6" }, ja = /* @__PURE__ */ h({
2024
+ __name: "BeamGateway",
2025
+ props: {
2026
+ terminal: {
2027
+ type: Object,
2028
+ required: !0
2029
+ },
2030
+ onUpdate: {
2031
+ type: Function,
2032
+ required: !0
2033
+ }
2034
+ },
2035
+ setup(T) {
2036
+ const { isLoading: p, startAsyncCall: a } = J(), b = T, l = G(() => b.terminal), r = _(), e = _(), d = _(-1), c = _({
2037
+ externalTerminalId: ""
2038
+ }), v = () => {
2039
+ c.value.externalTerminalId = "", d.value = -1;
2040
+ }, m = () => {
2041
+ if (a(async () => {
2042
+ r.value = await ye.getRestaurantExternalTerminals(
2043
+ b.terminal.referenceId,
2044
+ "BEAM"
2045
+ );
2046
+ }), !b.terminal.ecrs)
2047
+ return v();
2048
+ const o = b.terminal.ecrs.findIndex((u) => u && u.gateway && u.gateway === "Beam");
2049
+ if (o === -1)
2050
+ return v();
2051
+ d.value = o;
2052
+ const i = b.terminal.ecrs.at(o);
2053
+ i.gateway === "Beam" && i.config && (c.value = {
2054
+ externalTerminalId: i.config.externalTerminalId
2055
+ });
2056
+ };
2057
+ A(l, m), q(m);
2058
+ const s = V(() => (r.value ?? []).map((o) => ({
2059
+ label: o.status === "READY" ? o.name : `${o.name} (unpaired)`,
2060
+ value: o._id
2061
+ })));
2062
+ async function t(o) {
2063
+ var i;
2064
+ (i = b.terminal.ecrs) == null || i.splice(o, 1), b.onUpdate(b.terminal);
2065
+ }
2066
+ return (o, i) => {
2067
+ const u = f("FmCircularProgress"), C = f("FmSelect"), n = f("FmButton"), x = f("FmForm");
2068
+ return N(p) ? (g(), S("div", La, [
2069
+ y(u, { size: "xxl" })
2070
+ ])) : (g(), F(x, {
2071
+ key: 1,
2072
+ ref: e.value,
2073
+ class: "flex flex-col gap-16 w-[500px]",
2074
+ onValidationSuccess: i[1] || (i[1] = () => {
2075
+ d.value > -1 ? l.value.ecrs[d.value] = { gateway: "Beam", config: c.value } : (l.value.ecrs || (l.value.ecrs = []), l.value.ecrs.push({ gateway: "Beam", config: c.value })), b.onUpdate(l.value);
2076
+ })
2077
+ }, {
2078
+ default: O(() => [
2079
+ y(C, {
2080
+ modelValue: c.value.externalTerminalId,
2081
+ "onUpdate:modelValue": i[0] || (i[0] = (E) => c.value.externalTerminalId = E),
2082
+ label: "External Terminal",
2083
+ items: s.value,
2084
+ rules: N(X)(N(Z).string().min(1, "External terminal is required"))
2085
+ }, null, 8, ["modelValue", "items", "rules"]),
2086
+ I("div", Ya, [
2087
+ d.value > -1 ? (g(), F(n, {
2088
+ key: 0,
2089
+ class: "flex-1",
2090
+ variant: "secondary",
2091
+ label: "Delete",
2092
+ onclick: () => t(d.value)
2093
+ }, null, 8, ["onclick"])) : U("", !0),
2094
+ y(n, {
2095
+ type: "submit",
2096
+ class: "flex-1",
2097
+ variant: "primary",
2098
+ label: "Save"
2099
+ })
2100
+ ])
2101
+ ]),
2102
+ _: 1
2103
+ }, 512));
2104
+ };
2105
+ }
2106
+ }), Ka = {
2107
+ key: 0,
2108
+ class: "flex items-center justify-center min-h-[80vh]"
2109
+ }, Ha = { class: "flex mt-6 space-x-6" }, za = /* @__PURE__ */ h({
2110
+ __name: "BriGateway",
2111
+ props: {
2112
+ terminal: {
2113
+ type: Object,
2114
+ required: !0
2115
+ },
2116
+ onUpdate: {
2117
+ type: Function,
2118
+ required: !0
2119
+ }
2120
+ },
2121
+ setup(T) {
2122
+ const { isLoading: p, startAsyncCall: a } = J(), b = T, l = G(() => b.terminal), r = _(), e = _(), d = _(-1), c = _({
2123
+ externalTerminalId: ""
2124
+ }), v = () => {
2125
+ c.value.externalTerminalId = "", d.value = -1;
2126
+ }, m = () => {
2127
+ if (a(async () => {
2128
+ r.value = await ye.getRestaurantExternalTerminals(
2129
+ b.terminal.referenceId,
2130
+ "BRI"
2131
+ );
2132
+ }), !b.terminal.ecrs)
2133
+ return v();
2134
+ const i = b.terminal.ecrs.findIndex((C) => C && C.gateway && C.gateway === "Bri");
2135
+ if (i === -1)
2136
+ return v();
2137
+ d.value = i;
2138
+ const u = b.terminal.ecrs.at(i);
2139
+ u.gateway === "Bri" && u.config && (c.value = {
2140
+ externalTerminalId: u.config.externalTerminalId
2141
+ });
2142
+ };
2143
+ A(l, m), q(m);
2144
+ const s = V(() => (r.value ?? []).filter((i) => i.status === "READY").map((i) => ({ label: i.name, value: i._id }))), t = V(() => {
2145
+ if (s.value.length === 0)
2146
+ return "Please pair one BRI terminal under External Terminals before applying here.";
2147
+ });
2148
+ async function o(i) {
2149
+ var u;
2150
+ (u = b.terminal.ecrs) == null || u.splice(i, 1), b.onUpdate(b.terminal);
2151
+ }
2152
+ return (i, u) => {
2153
+ const C = f("FmCircularProgress"), n = f("FmSelect"), x = f("FmButton"), E = f("FmForm");
2154
+ return N(p) ? (g(), S("div", Ka, [
2155
+ y(C, { size: "xxl" })
2156
+ ])) : (g(), F(E, {
2157
+ key: 1,
2158
+ ref: e.value,
2159
+ class: "flex flex-col gap-16 w-[500px]",
2160
+ onValidationSuccess: u[1] || (u[1] = () => {
2161
+ d.value > -1 ? l.value.ecrs[d.value] = { gateway: "Bri", config: c.value } : (l.value.ecrs || (l.value.ecrs = []), l.value.ecrs.push({ gateway: "Bri", config: c.value })), b.onUpdate(l.value);
2162
+ })
2163
+ }, {
2164
+ default: O(() => [
2165
+ y(n, {
2166
+ modelValue: c.value.externalTerminalId,
2167
+ "onUpdate:modelValue": u[0] || (u[0] = (w) => c.value.externalTerminalId = w),
2168
+ label: "External Terminal",
2169
+ items: s.value,
2170
+ "helper-text": t.value,
2171
+ rules: N(X)(N(Z).string().min(1, "External terminal is required"))
2172
+ }, null, 8, ["modelValue", "items", "helper-text", "rules"]),
2173
+ I("div", Ha, [
2174
+ d.value > -1 ? (g(), F(x, {
2175
+ key: 0,
2176
+ class: "flex-1",
2177
+ variant: "secondary",
2178
+ label: "Delete",
2179
+ onclick: () => o(d.value)
2180
+ }, null, 8, ["onclick"])) : U("", !0),
2181
+ y(x, {
2182
+ type: "submit",
2183
+ class: "flex-1",
2184
+ variant: "primary",
2185
+ label: "Save"
2186
+ })
2187
+ ])
2188
+ ]),
2189
+ _: 1
2190
+ }, 512));
2191
+ };
2192
+ }
2193
+ }), Qa = { class: "flex items-end" }, Ja = { class: "flex flex-wrap gap-8 items-center mt-4" }, Wa = { class: "flex mt-6 space-x-6" }, Xa = /* @__PURE__ */ h({
2194
+ __name: "PbbGateway",
2195
+ props: {
2196
+ terminal: {
2197
+ type: Object,
2198
+ required: !0
2199
+ },
2200
+ onUpdate: {
2201
+ type: Function,
2202
+ required: !0
2203
+ }
2204
+ },
2205
+ setup(T) {
2206
+ const p = T, a = G(() => p.terminal), b = _(), l = _(-1), r = _(), e = _({
2207
+ ip: "",
2208
+ receiptName: "",
2209
+ cardTypes: []
2210
+ }), d = () => {
2211
+ e.value.ip = "", e.value.receiptName = "", e.value.cardTypes = [], l.value = -1;
2212
+ }, c = () => {
2213
+ var i;
2214
+ if (!a.value.ecrIntegrations)
2215
+ return d();
2216
+ const s = a.value.ecrIntegrations, t = s.findIndex((u) => u && u.gateway && u.gateway === "Pbb");
2217
+ if (t === -1)
2218
+ return d();
2219
+ l.value = t;
2220
+ const o = s.at(t);
2221
+ o.gateway === "Pbb" && o.config && (e.value = {
2222
+ ip: o.config.ip ?? "",
2223
+ receiptName: o.receiptName ?? "",
2224
+ cardTypes: ((i = o.dialogConfig) == null ? void 0 : i.cardTypes) ?? []
2225
+ });
2226
+ };
2227
+ A(a, c), q(c);
2228
+ async function v(s) {
2229
+ var t;
2230
+ (t = a.value.ecrIntegrations) == null || t.splice(s, 1), p.onUpdate(a.value);
2231
+ }
2232
+ async function m() {
2233
+ e.value.cardTypes.push(r.value), r.value = "";
2234
+ }
2235
+ return (s, t) => {
2236
+ const o = f("FmTextField"), i = f("FmButton"), u = f("FmChip"), C = f("FmForm");
2237
+ return g(), F(C, {
2238
+ ref: b.value,
2239
+ class: "flex flex-col gap-16 w-[500px]",
2240
+ onValidationSuccess: t[3] || (t[3] = () => {
2241
+ var n, x;
2242
+ l.value > -1 ? a.value.ecrIntegrations[l.value] = {
2243
+ gateway: "Pbb",
2244
+ config: { ip: e.value.ip },
2245
+ receiptName: e.value.receiptName,
2246
+ dialogConfig: {
2247
+ ...(x = (n = a.value.ecrIntegrations) == null ? void 0 : n[l.value]) == null ? void 0 : x.dialogConfig,
2248
+ cardTypes: e.value.cardTypes
2249
+ }
2250
+ } : (a.value.ecrIntegrations || (a.value.ecrIntegrations = []), a.value.ecrIntegrations.push({
2251
+ gateway: "Pbb",
2252
+ config: { ip: e.value.ip },
2253
+ receiptName: e.value.receiptName,
2254
+ dialogConfig: {
2255
+ cardTypes: e.value.cardTypes
2256
+ }
2257
+ })), p.onUpdate(a.value);
2258
+ })
2259
+ }, {
2260
+ default: O(() => [
2261
+ y(o, {
2262
+ modelValue: e.value.ip,
2263
+ "onUpdate:modelValue": t[0] || (t[0] = (n) => e.value.ip = n),
2264
+ label: "IP Address"
2265
+ }, null, 8, ["modelValue"]),
2266
+ y(o, {
2267
+ modelValue: e.value.receiptName,
2268
+ "onUpdate:modelValue": t[1] || (t[1] = (n) => e.value.receiptName = n),
2269
+ label: "Receipt Payment Name",
2270
+ "label-info": "Default receipt display will be 'TERMINAL_PBB'"
2271
+ }, null, 8, ["modelValue"]),
2272
+ I("div", Qa, [
2273
+ y(o, {
2274
+ modelValue: r.value,
2275
+ "onUpdate:modelValue": t[2] || (t[2] = (n) => r.value = n),
2276
+ label: "Fallback Card Types",
2277
+ "label-info": "List of cards when fallback to reconcile dialog. Default VISA, MASTER"
2278
+ }, null, 8, ["modelValue"]),
2279
+ y(i, {
2280
+ class: "ml-4",
2281
+ icon: "add",
2282
+ onClick: m
2283
+ })
2284
+ ]),
2285
+ I("div", Ja, [
2286
+ (g(!0), S(D, null, L(e.value.cardTypes, (n) => (g(), F(u, {
2287
+ key: n,
2288
+ label: n,
2289
+ removable: !0,
2290
+ onChipClosed: () => e.value.cardTypes.splice(e.value.cardTypes.indexOf(n), 1)
2291
+ }, null, 8, ["label", "onChipClosed"]))), 128))
2292
+ ]),
2293
+ I("div", Wa, [
2294
+ l.value > -1 ? (g(), F(i, {
2295
+ key: 0,
2296
+ class: "flex-1",
2297
+ variant: "secondary",
2298
+ label: "Delete",
2299
+ onclick: () => v(l.value)
2300
+ }, null, 8, ["onclick"])) : U("", !0),
2301
+ y(i, {
2302
+ type: "submit",
2303
+ class: "flex-1",
2304
+ variant: "primary",
2305
+ label: "Save"
2306
+ })
2307
+ ])
2308
+ ]),
2309
+ _: 1
2310
+ }, 512);
2311
+ };
2312
+ }
2313
+ }), Za = { class: "flex items-center" }, et = { class: "w-[260px] self-start" }, at = { class: "flex-1" }, tt = /* @__PURE__ */ h({
2314
+ __name: "EcrGateway",
2315
+ props: {
2316
+ terminal: {
2317
+ type: Object,
2318
+ required: !0
2319
+ },
2320
+ onUpdate: {
2321
+ type: Function,
2322
+ required: !0
2323
+ }
2324
+ },
2325
+ setup(T) {
2326
+ var d;
2327
+ const p = T, a = [
2328
+ {
2329
+ label: "FeedMe Terminal",
2330
+ value: "terminal",
2331
+ render: Xe
2332
+ },
2333
+ {
2334
+ label: "GHL Terminal",
2335
+ value: "ghl",
2336
+ render: ea,
2337
+ region: [P.F_COUNTRY.enum.MY]
2338
+ },
2339
+ {
2340
+ label: "GHL2 Terminal",
2341
+ value: "ghl2",
2342
+ render: Fa,
2343
+ region: [P.F_COUNTRY.enum.MY]
2344
+ },
2345
+ {
2346
+ label: "ITB Maybank Terminal",
2347
+ value: "mb-itb",
2348
+ render: na,
2349
+ region: [P.F_COUNTRY.enum.MY]
2350
+ },
2351
+ {
2352
+ label: "PMA Maybank Terminal",
2353
+ value: "mb-pma",
2354
+ render: sa,
2355
+ region: [P.F_COUNTRY.enum.MY]
2356
+ },
2357
+ {
2358
+ label: "Paysys Maybank Terminal",
2359
+ value: "mb-paysys",
2360
+ render: da,
2361
+ region: [P.F_COUNTRY.enum.MY]
2362
+ },
2363
+ {
2364
+ label: "Nets Terminal",
2365
+ value: "nets",
2366
+ render: fa,
2367
+ region: [P.F_COUNTRY.enum.SG]
2368
+ },
2369
+ {
2370
+ label: "KBank Terminal",
2371
+ value: "kbank",
2372
+ render: Ta,
2373
+ region: [P.F_COUNTRY.enum.TH]
2374
+ },
2375
+ {
2376
+ label: "GHL Terminal",
2377
+ value: "ghl3",
2378
+ render: ka,
2379
+ region: [P.F_COUNTRY.enum.TH]
2380
+ },
2381
+ {
2382
+ label: "Paysys HLBB Terminal",
2383
+ value: "hlbb",
2384
+ render: Ua,
2385
+ region: [P.F_COUNTRY.enum.MY]
2386
+ },
2387
+ {
2388
+ label: "GPAP Terminal",
2389
+ value: "globalpayments",
2390
+ render: Ba,
2391
+ region: [P.F_COUNTRY.enum.SG]
2392
+ },
2393
+ {
2394
+ label: "OMA Terminal",
2395
+ value: "oma",
2396
+ render: qa,
2397
+ region: [P.F_COUNTRY.enum.PK]
2398
+ },
2399
+ {
2400
+ label: "Revenue PBB Terminal",
2401
+ value: "revenue",
2402
+ render: Ea,
2403
+ region: [P.F_COUNTRY.enum.MY]
2404
+ },
2405
+ {
2406
+ label: "PBB Terminal",
2407
+ value: "pbb",
2408
+ render: Xa,
2409
+ region: [P.F_COUNTRY.enum.MY]
2410
+ },
2411
+ {
2412
+ label: "Beam Terminal",
2413
+ value: "beam",
2414
+ render: ja,
2415
+ region: [P.F_COUNTRY.enum.TH]
2416
+ },
2417
+ {
2418
+ label: "BRI Terminal",
2419
+ value: "bri",
2420
+ render: za,
2421
+ region: [P.F_COUNTRY.enum.ID]
2422
+ }
2423
+ ], b = V(() => a.find((c) => c.value === e.value)), l = se().currentCountry, r = V(() => a.filter(
2424
+ (c) => !c.region || c.region.includes(l.value ?? P.F_COUNTRY.enum.MY)
2425
+ )), { gatewayTab: e } = re({
2426
+ gatewayTab: (d = r.value[0]) == null ? void 0 : d.value
2427
+ });
2428
+ return (c, v) => {
2429
+ var s;
2430
+ const m = f("FmTabs");
2431
+ return g(), S("div", Za, [
2432
+ I("div", et, [
2433
+ y(m, {
2434
+ "model-value": N(e),
2435
+ "onUpdate:modelValue": v[0] || (v[0] = (t) => te(e) ? e.value = t : null),
2436
+ class: "mb-6",
2437
+ vertical: !0,
2438
+ items: r.value,
2439
+ "show-more-at": Number.POSITIVE_INFINITY
2440
+ }, null, 8, ["model-value", "items", "show-more-at"])
2441
+ ]),
2442
+ I("div", at, [
2443
+ N(e) ? (g(), F(le((s = b.value) == null ? void 0 : s.render), ne(oe({ key: 0 }, {
2444
+ terminal: p.terminal,
2445
+ onUpdate: p.onUpdate
2446
+ })), null, 16)) : U("", !0)
2447
+ ])
2448
+ ]);
2449
+ };
2450
+ }
2451
+ }), lt = { class: "flex mt-6 space-x-6" }, nt = /* @__PURE__ */ h({
2452
+ __name: "PromptPayGateway",
2453
+ props: {
2454
+ terminal: {
2455
+ type: Object,
2456
+ required: !0
2457
+ },
2458
+ onUpdate: {
2459
+ type: Function,
2460
+ required: !0
2461
+ }
2462
+ },
2463
+ setup(T) {
2464
+ const p = T, a = G(() => p.terminal), b = _(), l = _(-1), r = _({
2465
+ account: "",
2466
+ receiptName: ""
2467
+ }), e = () => {
2468
+ r.value.account = "", r.value.receiptName = "", l.value = -1;
2469
+ }, d = () => {
2470
+ if (!a.value.qrIntegrations)
2471
+ return e();
2472
+ const v = a.value.qrIntegrations, m = v.findIndex((t) => t && t.gateway && t.gateway === "PROMPTPAY");
2473
+ if (m === -1)
2474
+ return e();
2475
+ l.value = m;
2476
+ const s = v.at(m);
2477
+ s.gateway === "PROMPTPAY" && s.config && (r.value = {
2478
+ account: s.config.account ?? "",
2479
+ receiptName: s.receiptName ?? ""
2480
+ });
2481
+ };
2482
+ A(a, d), q(d);
2483
+ async function c(v) {
2484
+ var m;
2485
+ (m = a.value.qrIntegrations) == null || m.splice(v, 1), p.onUpdate(a.value);
2486
+ }
2487
+ return (v, m) => {
2488
+ const s = f("FmTextField"), t = f("FmButton"), o = f("FmForm");
2489
+ return g(), F(o, {
2490
+ ref: b.value,
2491
+ class: "flex flex-col gap-16 w-[500px]",
2492
+ onValidationSuccess: m[2] || (m[2] = () => {
2493
+ l.value > -1 ? a.value.qrIntegrations[l.value] = { gateway: "PROMPTPAY", config: { account: r.value.account }, receiptName: r.value.receiptName } : (a.value.qrIntegrations || (a.value.qrIntegrations = []), a.value.qrIntegrations.push({ gateway: "PROMPTPAY", config: { account: r.value.account }, receiptName: r.value.receiptName })), p.onUpdate(a.value);
2494
+ })
2495
+ }, {
2496
+ default: O(() => [
2497
+ y(s, {
2498
+ modelValue: r.value.account,
2499
+ "onUpdate:modelValue": m[0] || (m[0] = (i) => r.value.account = i),
2500
+ label: "Thai Phone Number / Thai Naitonal ID",
2501
+ "label-info": "Thai Phone Number can be prefixed with 66 or 0 will be fine both will works well."
2502
+ }, null, 8, ["modelValue"]),
2503
+ y(s, {
2504
+ modelValue: r.value.receiptName,
2505
+ "onUpdate:modelValue": m[1] || (m[1] = (i) => r.value.receiptName = i),
2506
+ label: "Receipt Payment Name",
2507
+ "label-info": "Default receipt display will be 'TERMINAL_MAYBANK'"
2508
+ }, null, 8, ["modelValue"]),
2509
+ I("div", lt, [
2510
+ l.value > -1 ? (g(), F(t, {
2511
+ key: 0,
2512
+ class: "flex-1",
2513
+ variant: "secondary",
2514
+ label: "Delete",
2515
+ onclick: () => c(l.value)
2516
+ }, null, 8, ["onclick"])) : U("", !0),
2517
+ y(t, {
2518
+ type: "submit",
2519
+ class: "flex-1",
2520
+ variant: "primary",
2521
+ label: "Save"
2522
+ })
2523
+ ])
2524
+ ]),
2525
+ _: 1
2526
+ }, 512);
2527
+ };
2528
+ }
2529
+ }), ot = { class: "flex items-center" }, rt = { class: "w-[260px] self-start" }, it = { class: "flex-1" }, st = /* @__PURE__ */ h({
2530
+ __name: "QrGateway",
2531
+ props: {
2532
+ terminal: {
2533
+ type: Object,
2534
+ required: !0
2535
+ },
2536
+ onUpdate: {
2537
+ type: Function,
2538
+ required: !0
2539
+ }
2540
+ },
2541
+ setup(T) {
2542
+ var d;
2543
+ const p = T, a = [
2544
+ {
2545
+ label: "PromptPay",
2546
+ value: "promptpay",
2547
+ render: nt,
2548
+ region: [P.F_COUNTRY.enum.TH]
2549
+ }
2550
+ ], b = V(() => a.find((c) => c.value === e.value)), l = se().currentCountry, r = V(() => a.filter((c) => !c.region || c.region.includes(l.value ?? P.F_COUNTRY.enum.MY))), { gatewayTab: e } = re({
2551
+ gatewayTab: (d = r.value[0]) == null ? void 0 : d.value
2552
+ });
2553
+ return (c, v) => {
2554
+ var s;
2555
+ const m = f("FmTabs");
2556
+ return g(), S("div", ot, [
2557
+ I("div", rt, [
2558
+ y(m, {
2559
+ "model-value": N(e),
2560
+ "onUpdate:modelValue": v[0] || (v[0] = (t) => te(e) ? e.value = t : null),
2561
+ class: "mb-6",
2562
+ vertical: !0,
2563
+ items: r.value
2564
+ }, null, 8, ["model-value", "items"])
2565
+ ]),
2566
+ I("div", it, [
2567
+ N(e) ? (g(), F(le((s = b.value) == null ? void 0 : s.render), ne(oe({ key: 0 }, {
2568
+ terminal: p.terminal,
2569
+ onUpdate: p.onUpdate
2570
+ })), null, 16)) : U("", !0)
2571
+ ])
2572
+ ]);
2573
+ };
2574
+ }
2575
+ }), Ct = /* @__PURE__ */ h({
2576
+ __name: "TerminalSetting",
2577
+ props: {
2578
+ terminalId: {
2579
+ type: String,
2580
+ required: !0
2581
+ }
2582
+ },
2583
+ setup(T) {
2584
+ const p = T, { tab: a } = re({
2585
+ tab: "information"
2586
+ }), { isLoading: b, startAsyncCall: l } = J(!0), r = Te(), e = me(), d = Fe(), { t: c } = ie(), v = _();
2587
+ async function m(w, k) {
2588
+ l(async () => {
2589
+ try {
2590
+ await j.updateById(p.terminalId, {
2591
+ name: w.name,
2592
+ status: w.status,
2593
+ ecrs: w.ecrs ?? [],
2594
+ gateways: w.gateways ?? [],
2595
+ ecrIntegrations: w.ecrIntegrations ?? [],
2596
+ qrIntegrations: w.qrIntegrations ?? [],
2597
+ ...k ? { paymentCheckouts: k } : {}
2598
+ }), v.value = await j.readById(p.terminalId), e.open({
2599
+ type: "success",
2600
+ message: "Terminal updated successfully"
2601
+ });
2602
+ } catch (B) {
2603
+ e.open({
2604
+ type: "error",
2605
+ title: "Error occurs when update terminal",
2606
+ message: Q(B)
2607
+ });
2608
+ }
2609
+ });
2610
+ }
2611
+ const s = [
2612
+ {
2613
+ label: "Information",
2614
+ value: "information",
2615
+ icon: "overview",
2616
+ render: Ne
2617
+ },
2618
+ {
2619
+ label: "Setting Request",
2620
+ value: "settings",
2621
+ icon: "settings",
2622
+ render: $e,
2623
+ onlyFor: ["TERMINAL"]
2624
+ },
2625
+ {
2626
+ label: "SoftPos Gateway",
2627
+ value: "softpos",
2628
+ icon: "payment",
2629
+ render: Qe
2630
+ },
2631
+ {
2632
+ label: "ECR Gateway",
2633
+ value: "ecr",
2634
+ icon: "point_of_sale",
2635
+ render: tt,
2636
+ onlyFor: ["POS", "KIOSK"]
2637
+ },
2638
+ {
2639
+ label: "QR Gateway",
2640
+ value: "qr",
2641
+ icon: "qr_code",
2642
+ render: st,
2643
+ onlyFor: ["POS", "KIOSK"]
2644
+ },
2645
+ {
2646
+ label: "Payment Checkout",
2647
+ value: "payment-checkout",
2648
+ icon: "tune",
2649
+ render: ke,
2650
+ onlyFor: ["KIOSK", "POS"]
2651
+ }
2652
+ ], t = pe.FdoTerminalTemplateDeviceType.options, o = V(
2653
+ () => {
2654
+ var w;
2655
+ return t.includes(((w = v.value) == null ? void 0 : w.deviceType) ?? "");
2656
+ }
2657
+ );
2658
+ function i() {
2659
+ const w = v.value;
2660
+ d.open({
2661
+ title: "Save as Template",
2662
+ closeButton: !0,
2663
+ overlay: !0,
2664
+ contentComponent: he
2665
+ }).onPrimary(async (k) => {
2666
+ d.close();
2667
+ try {
2668
+ await de.create({
2669
+ name: k.name,
2670
+ description: k.description,
2671
+ businessId: w.restaurant.businessId,
2672
+ deviceType: w.deviceType,
2673
+ isDefault: k.isDefault,
2674
+ settings: {
2675
+ ecrs: (w.ecrs ?? []).map(({ gateway: B }) => ({ gateway: B })),
2676
+ ecrIntegrations: (w.ecrIntegrations ?? []).map(
2677
+ ({ gateway: B }) => ({ gateway: B })
2678
+ ),
2679
+ paymentCheckouts: w.paymentCheckouts ?? []
2680
+ }
2681
+ }), e.open({
2682
+ type: "success",
2683
+ message: "Setting template created successfully."
2684
+ });
2685
+ } catch (B) {
2686
+ e.open({
2687
+ type: "error",
2688
+ title: "Error occurs when create setting template",
2689
+ message: Q(B)
2690
+ });
2691
+ }
2692
+ });
2693
+ }
2694
+ async function u() {
2695
+ const w = v.value, k = await de.readByBusiness(
2696
+ w.restaurant.businessId,
2697
+ w.deviceType
2698
+ );
2699
+ d.open({
2700
+ title: "Apply Template",
2701
+ closeButton: !0,
2702
+ overlay: !0,
2703
+ contentComponent: Ae,
2704
+ contentComponentProps: { templates: k }
2705
+ }).onPrimary(async (B) => {
2706
+ d.close(), we(
2707
+ d,
2708
+ "Apply Template",
2709
+ c("payment.terminal_template.scope_info"),
2710
+ async () => {
2711
+ l(async () => {
2712
+ try {
2713
+ await j.applyTemplate(p.terminalId, B.templateId), v.value = await j.readById(p.terminalId), e.open({
2714
+ type: "success",
2715
+ message: "Setting template applied successfully."
2716
+ });
2717
+ } catch ($) {
2718
+ e.open({
2719
+ type: "error",
2720
+ title: "Error occurs when apply setting template",
2721
+ message: Q($)
2722
+ });
2723
+ }
2724
+ });
2725
+ }
2726
+ );
2727
+ });
2728
+ }
2729
+ const C = V(
2730
+ () => o.value ? [
2731
+ { label: "Save as Template", fn: i },
2732
+ { label: "Apply Template", fn: u }
2733
+ ] : []
2734
+ );
2735
+ se().currentCountry;
2736
+ const n = V(() => {
2737
+ var w;
2738
+ return (w = s.find((k) => k.value === a.value)) == null ? void 0 : w.render;
2739
+ });
2740
+ async function x() {
2741
+ l(async () => {
2742
+ v.value = await j.readById(p.terminalId);
2743
+ });
2744
+ }
2745
+ const E = V(() => s.filter(
2746
+ (w) => {
2747
+ var k;
2748
+ return !w.onlyFor || w.onlyFor.includes(((k = v.value) == null ? void 0 : k.deviceType) ?? "");
2749
+ }
2750
+ ));
2751
+ return q(x), (w, k) => {
2752
+ var $, K;
2753
+ const B = f("FmTabs");
2754
+ return g(), F(Ie, {
2755
+ title: `${($ = v.value) == null ? void 0 : $.deviceType} (${(K = v.value) == null ? void 0 : K._id})`,
2756
+ loading: N(b),
2757
+ actions: C.value,
2758
+ onBack: N(r).back
2759
+ }, {
2760
+ default: O(() => [
2761
+ y(B, {
2762
+ "model-value": N(a),
2763
+ "onUpdate:modelValue": k[0] || (k[0] = (H) => te(a) ? a.value = H : null),
2764
+ class: "mb-6",
2765
+ items: E.value
2766
+ }, null, 8, ["model-value", "items"]),
2767
+ N(a) ? (g(), F(le(n.value), ne(oe({ key: 0 }, {
2768
+ terminal: v.value,
2769
+ onUpdate: m
2770
+ })), null, 16)) : U("", !0)
2771
+ ]),
2772
+ _: 1
2773
+ }, 8, ["title", "loading", "actions", "onBack"]);
2774
+ };
2775
+ }
2776
+ });
2777
+ export {
2778
+ Ct as default
2779
+ };