@feedmepos/mf-payment 1.10.6 → 1.10.7-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 (90) hide show
  1. package/dist/{Actions.vue_vue_type_script_setup_true_lang-CqJd1X0X.js → Actions.vue_vue_type_script_setup_true_lang-CDTMsbYv.js} +1 -1
  2. package/dist/{AdminBusinessSelector.vue_vue_type_script_setup_true_lang-Eu7ASW2o.js → AdminBusinessSelector.vue_vue_type_script_setup_true_lang-BXw-ZGes.js} +3 -3
  3. package/dist/AdminRestaurantSelector.vue_vue_type_script_setup_true_lang-DOSmgkgi.js +135 -0
  4. package/dist/{Chargeback-CMd35ws-.js → Chargeback-BqXwYiuk.js} +5 -5
  5. package/dist/{DocumentViewer.vue_vue_type_script_setup_true_lang-B1VBR6hm.js → DocumentViewer.vue_vue_type_script_setup_true_lang-BMBTecYJ.js} +1 -1
  6. package/dist/{ExternalTerminal--aTxkXzh.js → ExternalTerminal-CPqZXXJN.js} +6 -6
  7. package/dist/{OnboardForm-Cv-b3Skb.js → OnboardForm-CzW4p_2d.js} +6 -6
  8. package/dist/{OnboardForm-C3h1KO1O.js → OnboardForm-Dc99b9Y9.js} +6 -6
  9. package/dist/{OnboardSubmission-Ck3nezzM.js → OnboardSubmission-CW0mAt6g.js} +6 -6
  10. package/dist/{OnboardSubmission-CxeCT_G3.js → OnboardSubmission-DE1LorIG.js} +3 -3
  11. package/dist/PaymentCheckout-Dak0HEN-.js +1939 -0
  12. package/dist/{PayoutAccount-BGoBqwop.js → PayoutAccount-BaxlEkSz.js} +7 -7
  13. package/dist/{PayoutAccount-BYYsU904.js → PayoutAccount-CcxQG44I.js} +5 -5
  14. package/dist/{PayoutAccountSetting-Cb3qV2mD.js → PayoutAccountSetting-BjGT7oIq.js} +6 -6
  15. package/dist/{Restaurant-Fzvk7vXR.js → Restaurant-Dubtx0qm.js} +4 -4
  16. package/dist/{RestaurantSetting-DbUoc8oN.js → RestaurantSetting-CaV9iLhj.js} +3 -3
  17. package/dist/{Settlement-W01KavYf.js → Settlement-BpI9rV6S.js} +3 -3
  18. package/dist/{Settlement-BRIrYWpz.js → Settlement-Dk2vmfTC.js} +4 -4
  19. package/dist/{SettlementTransactions-DapiPPJF.js → SettlementTransactions-DUKUIBGb.js} +5 -5
  20. package/dist/{SettlementTransactions-mwlfQemB.js → SettlementTransactions-L1UnE3Dz.js} +5 -5
  21. package/dist/{Status.vue_vue_type_script_setup_true_lang-Ds_0bxtO.js → Status.vue_vue_type_script_setup_true_lang-CBq4EZkF.js} +1 -1
  22. package/dist/{Terminal-83TwJ7ie.js → Terminal-DA4Y3glc.js} +6 -6
  23. package/dist/TerminalSetting-ChWAOcmg.js +2779 -0
  24. package/dist/TerminalTemplate-CPL-E4c2.js +322 -0
  25. package/dist/TerminalTemplateSetting-BTZZ_5hn.js +262 -0
  26. package/dist/{Transaction-DHs4jxYL.js → Transaction-BoYZtvk4.js} +10 -10
  27. package/dist/{Transaction-cq5rmTfT.js → Transaction-eJhtXrtB.js} +20 -19
  28. package/dist/{TransactionOld-DaheibSS.js → TransactionOld-CpcwSOPc.js} +7 -7
  29. package/dist/{TransactionStatus.vue_vue_type_script_setup_true_lang-BoPXEI9q.js → TransactionStatus.vue_vue_type_script_setup_true_lang-uOyBTSIr.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-DUV0ashg.js → app-D6AC4Zp8.js} +389 -353
  33. package/dist/app.js +1 -1
  34. package/dist/{assets-BGnM7nin.js → assets-he2Gzvfg.js} +1 -1
  35. package/dist/{grafana-BoNOlJ9-.js → grafana-Ci9Ouxi7.js} +1 -1
  36. package/dist/{index-DQ9q6Ng_.js → index-B1Q7VAq8.js} +1 -1
  37. package/dist/index-BDQw2qyD.js +71 -0
  38. package/dist/{index-ChsCKiRb.js → index-BexuYVa4.js} +1 -1
  39. package/dist/{index-BaEy-M8O.js → index-C1rqQDv4.js} +1 -1
  40. package/dist/{index-cp0D_L8y.js → index-CQWvP-R5.js} +1 -1
  41. package/dist/{index-Dp9alEOk.js → index-DGXTnrw9.js} +1 -1
  42. package/dist/{index-D8-ut4k_.js → index-DJAcIsfC.js} +3073 -3030
  43. package/dist/{index-DJzgbPBh.js → index-Dyq-uY9m.js} +1 -1
  44. package/dist/{index-C15EF9Ej.js → index-UvQbjo9b.js} +1 -1
  45. package/dist/{index-BboUkfWO.js → index-YRTDpAkL.js} +2 -2
  46. package/dist/index-rlCqwp1w.js +43 -0
  47. package/dist/{index.vue_vue_type_script_setup_true_lang-D1bbu1bC.js → index.vue_vue_type_script_setup_true_lang-C1d0q7uA.js} +1 -1
  48. package/dist/{onboard-submission-CHqAHLM5.js → onboard-submission-Dfp-461W.js} +1 -1
  49. package/dist/package.json +3 -3
  50. package/dist/{payout-account-DLL_RAnN.js → payout-account-BziG4FgY.js} +3 -3
  51. package/dist/style.css +1 -1
  52. package/dist/tsconfig.app.tsbuildinfo +1 -1
  53. package/dist/useQuery-Bjhr1nB7.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-CRCrBun9.js +0 -505
  89. package/dist/TerminalSetting-DqQoSYrZ.js +0 -4521
  90. package/dist/index-DVQwRCIo.js +0 -63
@@ -1,4521 +0,0 @@
1
- import { defineComponent as X, openBlock as y, createElementBlock as E, Fragment as re, createElementVNode as x, createTextVNode as Ue, toDisplayString as pe, ref as T, resolveComponent as h, createVNode as b, createCommentVNode as R, unref as A, computed as K, isRef as Ae, createBlock as F, resolveDynamicComponent as bt, normalizeProps as ht, mergeProps as _t, watch as ne, onBeforeUnmount as Da, toRef as ue, onMounted as ie, withCtx as ae, renderList as ge, toRefs as Oa, reactive as Pa, h as Ua, getCurrentInstance as Gt, nextTick as ca, onUnmounted as Aa, normalizeClass as Ht, withModifiers as Ma, withKeys as Ra } from "vue";
2
- import { u as je, p as Ba, e as Q } from "./index-D8-ut4k_.js";
3
- import { useRouter as qa } from "vue-router";
4
- import { t as Me } from "./index-DVQwRCIo.js";
5
- import { _ as Ga } from "./Layout.vue_vue_type_script_setup_true_lang-BKIvkgA_.js";
6
- import { u as wt } from "./index-BaEy-M8O.js";
7
- import { useSnackbar as $t, useDialog as $a } from "@feedmepos/ui-library";
8
- import { u as rt } from "./error-K1CakhA9.js";
9
- import { useI18n as La, useCoreStore as xt } from "@feedmepos/mf-common";
10
- import { o as Ya } from "./index-BboUkfWO.js";
11
- import { c as ja } from "./index-MdV54cWO.js";
12
- import { z as Tt, a as It } from "./validator-CTlVogBQ.js";
13
- import { e as da } from "./index-ChsCKiRb.js";
14
- import { g as Ha } from "./assets-BGnM7nin.js";
15
- import { w as Ka } from "./Modal-DB8M9o1T.js";
16
- import { _ as Xa } from "./_plugin-vue_export-helper-CHgC5LLL.js";
17
- const Wa = /* @__PURE__ */ X({
18
- __name: "Information",
19
- props: {
20
- terminal: {
21
- type: Object,
22
- required: !0
23
- }
24
- },
25
- setup(e) {
26
- return (a, t) => (y(), E(re, null, [
27
- t[0] || (t[0] = x("b", null, "Name", -1)),
28
- Ue(": " + pe(e.terminal.name), 1),
29
- t[1] || (t[1] = x("br", null, null, -1)),
30
- t[2] || (t[2] = x("b", null, "Status", -1)),
31
- Ue(": " + pe(e.terminal.status), 1),
32
- t[3] || (t[3] = x("br", null, null, -1)),
33
- t[4] || (t[4] = x("b", null, "Device ID", -1)),
34
- Ue(": " + pe(e.terminal.deviceId ?? "-"), 1),
35
- t[5] || (t[5] = x("br", null, null, -1)),
36
- t[6] || (t[6] = x("b", null, "Device Type", -1)),
37
- Ue(": " + pe(e.terminal.deviceType ?? "-"), 1),
38
- t[7] || (t[7] = x("br", null, null, -1))
39
- ], 64));
40
- }
41
- }), za = { key: 0 }, Qa = { class: "mt-6 space-x-6" }, Ja = /* @__PURE__ */ X({
42
- __name: "KioskMode",
43
- props: {
44
- terminal: {
45
- type: Object,
46
- required: !0
47
- }
48
- },
49
- setup(e) {
50
- const { isLoading: a, startAsyncCall: t } = je(!1), l = $t(), o = T({
51
- enable: !1,
52
- password: []
53
- }), r = e;
54
- function n() {
55
- return o.value.enable && o.value.password.filter((c) => !!c).length !== 6 ? l.open({
56
- type: "error",
57
- message: "Unlock PIN is required when setting up kiosk mode for terminal."
58
- }) : t(async () => {
59
- const c = { enable: o.value.enable };
60
- c.enable && Object.assign(c, {
61
- password: o.value.password.join("")
62
- });
63
- const s = await Me.kioskModeRequest(r.terminal._id, c);
64
- if (s === "OK")
65
- return l.open({ type: "info", message: "Kiosk mode applied successfully." });
66
- let v = s;
67
- return s === "client_not_connected" && (v = "Terminal not connected to the websocket server."), s.startsWith("terminal: ") && (v = s.replaceAll("terminal: ", "")), l.open({
68
- type: "error",
69
- message: v
70
- });
71
- });
72
- }
73
- return (c, s) => {
74
- const v = h("FmSwitch"), f = h("FmPinField"), p = h("FmButton");
75
- return y(), E(re, null, [
76
- b(v, {
77
- modelValue: o.value.enable,
78
- "onUpdate:modelValue": s[0] || (s[0] = (i) => o.value.enable = i),
79
- label: "Enable Kiosk Mode?"
80
- }, null, 8, ["modelValue"]),
81
- o.value.enable ? (y(), E("div", za, [
82
- s[2] || (s[2] = x("p", { class: "mt-6" }, "Unlock PIN: ", -1)),
83
- b(f, {
84
- modelValue: o.value.password,
85
- "onUpdate:modelValue": s[1] || (s[1] = (i) => o.value.password = i)
86
- }, null, 8, ["modelValue"])
87
- ])) : R("", !0),
88
- x("div", Qa, [
89
- b(p, {
90
- variant: "primary",
91
- label: "Send",
92
- icon: "send",
93
- loading: A(a),
94
- onclick: n
95
- }, null, 8, ["loading"])
96
- ])
97
- ], 64);
98
- };
99
- }
100
- }), Za = /* @__PURE__ */ X({
101
- __name: "SettingRequest",
102
- props: {
103
- terminal: {
104
- type: Object,
105
- required: !0
106
- }
107
- },
108
- setup(e) {
109
- const { settingTab: a } = wt({
110
- settingTab: "kiosk_mode"
111
- }), t = [
112
- {
113
- label: "Kiosk Mode",
114
- value: "kiosk_mode",
115
- render: Ja
116
- }
117
- ], l = e, o = K(() => t.find((r) => r.value === a.value));
118
- return (r, n) => {
119
- var s;
120
- const c = h("FmTabs");
121
- return y(), E(re, null, [
122
- n[1] || (n[1] = x("p", { className: "mt-1 my-6 text-gray-600" }, [
123
- x("b", null, "Note: "),
124
- Ue(" Setting request will perform remotely without caching so make sure terminal is connected to the network also to our websocket as well. ")
125
- ], -1)),
126
- b(c, {
127
- "model-value": A(a),
128
- "onUpdate:modelValue": n[0] || (n[0] = (v) => Ae(a) ? a.value = v : null),
129
- class: "mb-6",
130
- items: t
131
- }, null, 8, ["model-value"]),
132
- A(a) ? (y(), F(bt((s = o.value) == null ? void 0 : s.render), ht(_t({ key: 0 }, { terminal: l.terminal })), null, 16)) : R("", !0)
133
- ], 64);
134
- };
135
- }
136
- }), en = 2e3, tn = 12e4, an = "Timed out waiting for the Tyro reader to sync. Please try again.";
137
- function nn(e) {
138
- const { isLoading: a, startLoading: t, stopLoading: l } = je(!1), { t: o } = La(), r = $t(), n = T(null), c = K(() => {
139
- var $, Z;
140
- const M = ($ = e.value.gateways) == null ? void 0 : $.find(
141
- (j) => j.gateway === "Tyro"
142
- );
143
- return ((Z = M == null ? void 0 : M.config) == null ? void 0 : Z.uniqueId) || "";
144
- }), s = K(() => !!c.value), v = K(() => {
145
- var M;
146
- return ((M = n.value) == null ? void 0 : M.status) === "ready";
147
- }), f = K(() => {
148
- var M, $;
149
- return v.value && !!(($ = (M = n.value) == null ? void 0 : M.fields) != null && $.tyroLocationId) && !!e.value.deviceId && !s.value;
150
- }), p = K(() => !v.value && !s.value), i = K(
151
- () => o("payment.onboard-submission.tyro.syncDisabledHint")
152
- ), u = K(() => s.value ? "Synced" : "Sync");
153
- async function m() {
154
- if (!e.value.referenceId) {
155
- n.value = null;
156
- return;
157
- }
158
- try {
159
- const M = await Ya.getByRestaurant(
160
- e.value.referenceId
161
- );
162
- n.value = M.find(
163
- ($) => $.type === Ba.FdoOnboardType.enum.tyro
164
- ) ?? null;
165
- } catch (M) {
166
- n.value = null, r.open({
167
- type: "error",
168
- message: rt(M)
169
- });
170
- }
171
- }
172
- const g = ja({
173
- intervalMs: en,
174
- timeoutMs: tn,
175
- onTick: async ({ isCurrentRun: M, stop: $ }) => {
176
- var me, ee;
177
- const Z = await Me.readById(e.value._id);
178
- if (!M())
179
- return;
180
- const j = (me = Z.gateways) == null ? void 0 : me.find((N) => N.gateway === "Tyro");
181
- (j == null ? void 0 : j.gateway) === "Tyro" && ((ee = j == null ? void 0 : j.config) != null && ee.uniqueId) && ($({ invalidate: !1 }), l(), Object.assign(e.value, Z), r.open({
182
- type: "success",
183
- message: "Tyro reader created successfully"
184
- }));
185
- },
186
- onTimeout: () => {
187
- l(), r.open({
188
- type: "error",
189
- message: an
190
- });
191
- },
192
- onError: (M) => {
193
- l(), r.open({
194
- type: "error",
195
- message: rt(M)
196
- });
197
- }
198
- }), k = g.isPolling;
199
- function d() {
200
- g.stop(), l();
201
- }
202
- function C() {
203
- d(), t(), g.start();
204
- }
205
- async function B() {
206
- if (!f.value) {
207
- r.open({
208
- type: "error",
209
- message: "Tyro reader sync is not available"
210
- });
211
- return;
212
- }
213
- try {
214
- t(), await Me.syncTyroReader(e.value._id), C();
215
- } catch (M) {
216
- d(), r.open({
217
- type: "error",
218
- message: rt(M)
219
- });
220
- }
221
- }
222
- return ne(
223
- () => e.value.referenceId,
224
- async () => {
225
- await m();
226
- },
227
- { immediate: !0 }
228
- ), Da(() => {
229
- d();
230
- }), {
231
- isLoading: a,
232
- isPollingTyroReader: k,
233
- uniqueId: c,
234
- canSyncTyroReader: f,
235
- showTyroSyncPopover: p,
236
- tyroSyncPopoverMessage: i,
237
- tyroSyncButtonLabel: u,
238
- syncTyroReader: B
239
- };
240
- }
241
- const ln = {
242
- key: 0,
243
- class: "text-sm text-gray-500"
244
- }, on = { class: "flex mt-6 space-x-6" }, rn = { class: "flex-1" }, sn = /* @__PURE__ */ X({
245
- __name: "SoftposGateway",
246
- props: {
247
- terminal: {
248
- type: Object,
249
- required: !0
250
- },
251
- onUpdate: {
252
- type: Function,
253
- required: !0
254
- }
255
- },
256
- setup(e) {
257
- const a = e, t = xt().currentCountry, l = [
258
- {
259
- label: "Fiuu Malaysia",
260
- value: "cc.feedme.payment.rms",
261
- region: Q.F_COUNTRY.enum.MY,
262
- gateway: "Fiuu",
263
- isLegacy: !0,
264
- isOutdated: !0
265
- },
266
- {
267
- label: "Fiuu Malaysia V2",
268
- value: "cc.feedme.payment.fiuu_my",
269
- region: Q.F_COUNTRY.enum.MY,
270
- gateway: "Fiuu",
271
- isLegacy: !0
272
- },
273
- {
274
- label: "Fiuu Singapore",
275
- value: "cc.feedme.payment.fiuu_sg",
276
- region: Q.F_COUNTRY.enum.SG,
277
- gateway: "Fiuu",
278
- isLegacy: !0
279
- },
280
- {
281
- label: "Softspace Malaysia",
282
- value: "cc.feedme.payment.softspace_my",
283
- gateway: "Softspace",
284
- region: Q.F_COUNTRY.enum.MY
285
- },
286
- {
287
- label: "Digio Thailand",
288
- value: "cc.feedme.payment.digio_th",
289
- gateway: "Digio",
290
- region: Q.F_COUNTRY.enum.TH
291
- },
292
- {
293
- label: "Tyro Australia",
294
- value: "cc.feedme.payment.tyro_au",
295
- gateway: "Tyro",
296
- region: Q.F_COUNTRY.enum.AU
297
- }
298
- ], o = ue(() => a.terminal), r = T(), n = T({
299
- packageId: "",
300
- uniqueId: "",
301
- developerId: "",
302
- isUat: !1
303
- }), c = () => {
304
- n.value.uniqueId = "", n.value.packageId = "", n.value.developerId = "", n.value.isUat = !1;
305
- }, s = K(() => l.filter((S) => S.region === t.value)), v = K(() => s.value.find(
306
- (S) => S.value === n.value.packageId
307
- )), f = K(
308
- () => {
309
- var S;
310
- return ((S = v.value) == null ? void 0 : S.gateway) === "Tyro";
311
- }
312
- ), {
313
- isLoading: p,
314
- isPollingTyroReader: i,
315
- uniqueId: u,
316
- canSyncTyroReader: m,
317
- showTyroSyncPopover: g,
318
- tyroSyncPopoverMessage: k,
319
- tyroSyncButtonLabel: d,
320
- syncTyroReader: C
321
- } = nn(o), B = K(() => f.value ? "button" : "submit"), M = K(() => f.value ? d.value : "Save"), $ = K(() => f.value ? p.value : !1), Z = K(() => f.value ? !m.value || i.value : !1), j = () => {
322
- if (!o.value.gateways || o.value.gateways.length === 0)
323
- return c();
324
- const S = o.value.gateways[0];
325
- if (!S.config)
326
- return c();
327
- if (S.gateway === "Tyro") {
328
- n.value = {
329
- packageId: S.config.packageId,
330
- uniqueId: S.config.uniqueId,
331
- developerId: "",
332
- isUat: !1
333
- };
334
- return;
335
- }
336
- switch (S.gateway) {
337
- case "Fiuu":
338
- n.value = {
339
- packageId: S.config.packageId,
340
- uniqueId: S.config.uniqueId,
341
- developerId: "",
342
- isUat: !1
343
- };
344
- break;
345
- case "Softspace":
346
- case "Digio":
347
- const w = JSON.parse(S.config.uniqueId);
348
- n.value = {
349
- packageId: S.config.packageId,
350
- uniqueId: w.uniqueId,
351
- developerId: w.developerId,
352
- isUat: w.isUat
353
- };
354
- return;
355
- }
356
- };
357
- ne(o, j), ie(j);
358
- async function me() {
359
- const S = v.value;
360
- if (!S)
361
- return;
362
- let w = n.value.uniqueId;
363
- S.isLegacy || (w = JSON.stringify({
364
- uniqueId: n.value.uniqueId,
365
- developerId: n.value.developerId,
366
- isUat: n.value.isUat
367
- }));
368
- const V = {
369
- gateway: S.gateway,
370
- config: {
371
- packageId: S.value,
372
- uniqueId: w
373
- }
374
- };
375
- (!o.value.gateways || o.value.gateways.length > 1) && (o.value.gateways = []), o.value.gateways[0] = V, await a.onUpdate(o.value);
376
- }
377
- async function ee(S) {
378
- var w;
379
- (w = o.value.gateways) == null || w.splice(S, 1), a.onUpdate(o.value);
380
- }
381
- function N() {
382
- f.value && C();
383
- }
384
- return (S, w) => {
385
- const V = h("FmSelect"), U = h("FmTextField"), L = h("FmCheckbox"), W = h("FmButton"), Y = h("FmTooltip"), _e = h("FmForm");
386
- return y(), F(_e, {
387
- ref: r.value,
388
- class: "flex flex-col gap-16 w-[500px]",
389
- onValidationSuccess: me
390
- }, {
391
- default: ae(() => [
392
- b(V, {
393
- modelValue: n.value.packageId,
394
- "onUpdate:modelValue": w[0] || (w[0] = (se) => n.value.packageId = se),
395
- label: "Package ID",
396
- items: s.value
397
- }, null, 8, ["modelValue", "items"]),
398
- v.value ? (y(), E(re, { key: 0 }, [
399
- f.value ? (y(), F(U, {
400
- key: 0,
401
- "model-value": A(u),
402
- label: "Unique ID (Reader ID)",
403
- disabled: ""
404
- }, null, 8, ["model-value"])) : v.value && v.value.isLegacy ? (y(), E(re, { key: 1 }, [
405
- b(U, {
406
- modelValue: n.value.uniqueId,
407
- "onUpdate:modelValue": w[1] || (w[1] = (se) => n.value.uniqueId = se),
408
- label: "Unique ID (TID)"
409
- }, null, 8, ["modelValue"]),
410
- v.value.isOutdated ? (y(), E("span", ln, " Note: For outdated gateway is no longer continued development, please use the new gateway instead. ")) : R("", !0)
411
- ], 64)) : (y(), E(re, { key: 2 }, [
412
- b(U, {
413
- modelValue: n.value.developerId,
414
- "onUpdate:modelValue": w[2] || (w[2] = (se) => n.value.developerId = se),
415
- label: "Developer ID (MID)"
416
- }, null, 8, ["modelValue"]),
417
- b(U, {
418
- modelValue: n.value.uniqueId,
419
- "onUpdate:modelValue": w[3] || (w[3] = (se) => n.value.uniqueId = se),
420
- label: "Unique ID (TID)"
421
- }, null, 8, ["modelValue"]),
422
- b(L, {
423
- modelValue: n.value.isUat,
424
- "onUpdate:modelValue": w[4] || (w[4] = (se) => n.value.isUat = se),
425
- label: "Is UAT (Test)",
426
- value: "1"
427
- }, null, 8, ["modelValue"])
428
- ], 64)),
429
- x("div", on, [
430
- o.value.gateways && o.value.gateways.length > 0 ? (y(), F(W, {
431
- key: 0,
432
- class: "flex-1",
433
- variant: "secondary",
434
- label: "Delete",
435
- onclick: () => ee(0)
436
- }, null, 8, ["onclick"])) : R("", !0),
437
- f.value && A(g) && Z.value ? (y(), F(Y, {
438
- key: 1,
439
- class: "flex-1",
440
- variant: "plain",
441
- placement: "top",
442
- content: A(k)
443
- }, {
444
- default: ae(() => [
445
- x("div", rn, [
446
- b(W, {
447
- type: B.value,
448
- class: "w-full",
449
- variant: "primary",
450
- loading: $.value,
451
- disabled: Z.value,
452
- label: M.value,
453
- onClick: N
454
- }, null, 8, ["type", "loading", "disabled", "label"])
455
- ])
456
- ]),
457
- _: 1
458
- }, 8, ["content"])) : (y(), F(W, {
459
- key: 2,
460
- type: B.value,
461
- class: "flex-1",
462
- variant: "primary",
463
- loading: $.value,
464
- disabled: Z.value,
465
- label: M.value,
466
- onClick: N
467
- }, null, 8, ["type", "loading", "disabled", "label"]))
468
- ])
469
- ], 64)) : R("", !0)
470
- ]),
471
- _: 1
472
- }, 512);
473
- };
474
- }
475
- }), un = {
476
- key: 0,
477
- class: "flex items-center justify-center min-h-[80vh]"
478
- }, cn = { class: "flex mt-6 space-x-6" }, dn = /* @__PURE__ */ X({
479
- __name: "TerminalGateway",
480
- props: {
481
- terminal: {
482
- type: Object,
483
- required: !0
484
- },
485
- onUpdate: {
486
- type: Function,
487
- required: !0
488
- }
489
- },
490
- setup(e) {
491
- const { isLoading: a, startAsyncCall: t } = je(), l = e, o = ue(() => l.terminal), r = T(), n = T(), c = T(-1), s = T({
492
- terminalId: ""
493
- }), v = () => {
494
- s.value.terminalId = "", c.value = -1;
495
- }, f = () => {
496
- if (t(async () => {
497
- r.value = await Me.getRestaurantTerminals(l.terminal.referenceId);
498
- }), !l.terminal.ecrs)
499
- return v();
500
- const u = l.terminal.ecrs.findIndex((g) => g && g.gateway && g.gateway === "FeedMe");
501
- if (u === -1)
502
- return v();
503
- c.value = u;
504
- const m = l.terminal.ecrs.at(u);
505
- m.gateway === "FeedMe" && m.config && (s.value = {
506
- terminalId: m.config.terminalId
507
- });
508
- };
509
- ne(o, f), ie(f);
510
- const p = K(() => (r.value ?? []).map((u) => ({
511
- label: u.name ?? u._id,
512
- value: u._id
513
- })));
514
- async function i(u) {
515
- var m;
516
- (m = l.terminal.ecrs) == null || m.splice(u, 1), l.onUpdate(l.terminal);
517
- }
518
- return (u, m) => {
519
- const g = h("FmCircularProgress"), k = h("FmSelect"), d = h("FmButton"), C = h("FmForm");
520
- return A(a) ? (y(), E("div", un, [
521
- b(g, { size: "xxl" })
522
- ])) : (y(), F(C, {
523
- key: 1,
524
- ref: n.value,
525
- class: "flex flex-col gap-16 w-[500px]",
526
- onValidationSuccess: m[1] || (m[1] = () => {
527
- c.value > -1 ? o.value.ecrs[c.value] = { gateway: "FeedMe", config: s.value } : (o.value.ecrs || (o.value.ecrs = []), o.value.ecrs.push({ gateway: "FeedMe", config: s.value })), l.onUpdate(o.value);
528
- })
529
- }, {
530
- default: ae(() => [
531
- b(k, {
532
- modelValue: s.value.terminalId,
533
- "onUpdate:modelValue": m[0] || (m[0] = (B) => s.value.terminalId = B),
534
- label: "Terminal ID",
535
- items: p.value,
536
- rules: A(Tt)(A(It).string())
537
- }, null, 8, ["modelValue", "items", "rules"]),
538
- x("div", cn, [
539
- c.value > -1 ? (y(), F(d, {
540
- key: 0,
541
- class: "flex-1",
542
- variant: "secondary",
543
- label: "Delete",
544
- onclick: () => i(c.value)
545
- }, null, 8, ["onclick"])) : R("", !0),
546
- b(d, {
547
- type: "submit",
548
- class: "flex-1",
549
- variant: "primary",
550
- label: "Save"
551
- })
552
- ])
553
- ]),
554
- _: 1
555
- }, 512));
556
- };
557
- }
558
- }), pn = { class: "flex mt-6 space-x-6" }, mn = /* @__PURE__ */ X({
559
- __name: "GhlGateway",
560
- props: {
561
- terminal: {
562
- type: Object,
563
- required: !0
564
- },
565
- onUpdate: {
566
- type: Function,
567
- required: !0
568
- }
569
- },
570
- setup(e) {
571
- const a = e, t = ue(() => a.terminal), l = T(), o = T(-1), r = T({
572
- merchantId: "",
573
- terminalId: "",
574
- privateKey: ""
575
- }), n = () => {
576
- r.value.merchantId = "", r.value.terminalId = "", r.value.privateKey = "", o.value = -1;
577
- }, c = () => {
578
- if (!t.value.ecrs)
579
- return n();
580
- const v = t.value.ecrs.findIndex((p) => p && p.gateway && p.gateway === "Ghl");
581
- if (v === -1)
582
- return n();
583
- o.value = v;
584
- const f = t.value.ecrs.at(v);
585
- f.gateway === "Ghl" && f.config && (r.value = {
586
- merchantId: f.config.merchantId,
587
- terminalId: f.config.terminalId,
588
- privateKey: f.config.privateKey || ""
589
- });
590
- };
591
- ne(t, c), ie(c);
592
- async function s(v) {
593
- var f;
594
- (f = t.value.ecrs) == null || f.splice(v, 1), a.onUpdate(t.value);
595
- }
596
- return (v, f) => {
597
- const p = h("FmTextField"), i = h("FmTextarea"), u = h("FmButton"), m = h("FmForm");
598
- return y(), F(m, {
599
- ref: l.value,
600
- class: "flex flex-col gap-16 w-[500px]",
601
- onValidationSuccess: f[3] || (f[3] = () => {
602
- o.value > -1 ? t.value.ecrs[o.value] = { gateway: "Ghl", config: r.value } : (t.value.ecrs || (t.value.ecrs = []), t.value.ecrs.push({ gateway: "Ghl", config: r.value })), a.onUpdate(t.value);
603
- })
604
- }, {
605
- default: ae(() => [
606
- b(p, {
607
- modelValue: r.value.merchantId,
608
- "onUpdate:modelValue": f[0] || (f[0] = (g) => r.value.merchantId = g),
609
- label: "Merchant ID"
610
- }, null, 8, ["modelValue"]),
611
- b(p, {
612
- modelValue: r.value.terminalId,
613
- "onUpdate:modelValue": f[1] || (f[1] = (g) => r.value.terminalId = g),
614
- label: "Terminal ID"
615
- }, null, 8, ["modelValue"]),
616
- b(i, {
617
- modelValue: r.value.privateKey,
618
- "onUpdate:modelValue": f[2] || (f[2] = (g) => r.value.privateKey = g),
619
- label: "Private Key",
620
- "label-mark": "optional",
621
- "label-info": "Default will use FeedMe Private Key"
622
- }, null, 8, ["modelValue"]),
623
- x("div", pn, [
624
- o.value > -1 ? (y(), F(u, {
625
- key: 0,
626
- class: "flex-1",
627
- variant: "secondary",
628
- label: "Delete",
629
- onclick: () => s(o.value)
630
- }, null, 8, ["onclick"])) : R("", !0),
631
- b(u, {
632
- type: "submit",
633
- class: "flex-1",
634
- variant: "primary",
635
- label: "Save"
636
- })
637
- ])
638
- ]),
639
- _: 1
640
- }, 512);
641
- };
642
- }
643
- }), fn = { class: "flex items-end" }, vn = { class: "flex flex-wrap gap-8 items-center mt-4" }, gn = { class: "flex mt-6 space-x-6" }, yn = /* @__PURE__ */ X({
644
- __name: "MaybankGateway",
645
- props: {
646
- terminal: {
647
- type: Object,
648
- required: !0
649
- },
650
- onUpdate: {
651
- type: Function,
652
- required: !0
653
- }
654
- },
655
- setup(e) {
656
- const a = e, t = ue(() => a.terminal), l = T(), o = T(-1), r = T(), n = T({
657
- ip: "",
658
- receiptName: "",
659
- cardTypes: []
660
- }), c = () => {
661
- n.value.ip = "", n.value.receiptName = "", n.value.cardTypes = [], o.value = -1;
662
- }, s = () => {
663
- var m;
664
- if (!t.value.ecrIntegrations)
665
- return c();
666
- const p = t.value.ecrIntegrations, i = p.findIndex((g) => g && g.gateway && g.gateway === "Maybank");
667
- if (i === -1)
668
- return c();
669
- o.value = i;
670
- const u = p.at(i);
671
- u.gateway === "Maybank" && u.config && (n.value = {
672
- ip: u.config.ip ?? "",
673
- receiptName: u.receiptName ?? "",
674
- cardTypes: ((m = u.dialogConfig) == null ? void 0 : m.cardTypes) ?? []
675
- });
676
- };
677
- ne(t, s), ie(s);
678
- async function v(p) {
679
- var i;
680
- (i = t.value.ecrIntegrations) == null || i.splice(p, 1), a.onUpdate(t.value);
681
- }
682
- async function f() {
683
- n.value.cardTypes.push(r.value), r.value = "";
684
- }
685
- return (p, i) => {
686
- const u = h("FmTextField"), m = h("FmButton"), g = h("FmChip"), k = h("FmForm");
687
- return y(), F(k, {
688
- ref: l.value,
689
- class: "flex flex-col gap-16 w-[500px]",
690
- onValidationSuccess: i[3] || (i[3] = () => {
691
- var d, C;
692
- o.value > -1 ? t.value.ecrIntegrations[o.value] = {
693
- gateway: "Maybank",
694
- config: { ip: n.value.ip },
695
- receiptName: n.value.receiptName,
696
- dialogConfig: {
697
- ...(C = (d = t.value.ecrIntegrations) == null ? void 0 : d[o.value]) == null ? void 0 : C.dialogConfig,
698
- cardTypes: n.value.cardTypes
699
- }
700
- } : (t.value.ecrIntegrations || (t.value.ecrIntegrations = []), t.value.ecrIntegrations.push({
701
- gateway: "Maybank",
702
- config: { ip: n.value.ip },
703
- receiptName: n.value.receiptName,
704
- dialogConfig: {
705
- cardTypes: n.value.cardTypes
706
- }
707
- })), a.onUpdate(t.value);
708
- })
709
- }, {
710
- default: ae(() => [
711
- b(u, {
712
- modelValue: n.value.ip,
713
- "onUpdate:modelValue": i[0] || (i[0] = (d) => n.value.ip = d),
714
- label: "IP Address"
715
- }, null, 8, ["modelValue"]),
716
- b(u, {
717
- modelValue: n.value.receiptName,
718
- "onUpdate:modelValue": i[1] || (i[1] = (d) => n.value.receiptName = d),
719
- label: "Receipt Payment Name",
720
- "label-info": "Default receipt display will be 'TERMINAL_MAYBANK'"
721
- }, null, 8, ["modelValue"]),
722
- x("div", fn, [
723
- b(u, {
724
- modelValue: r.value,
725
- "onUpdate:modelValue": i[2] || (i[2] = (d) => r.value = d),
726
- label: "Fallback Card Types",
727
- "label-info": "List of cards when fallback to reconcile dialog. Default VISA, MASTER"
728
- }, null, 8, ["modelValue"]),
729
- b(m, {
730
- class: "ml-4",
731
- icon: "add",
732
- onClick: f
733
- })
734
- ]),
735
- x("div", vn, [
736
- (y(!0), E(re, null, ge(n.value.cardTypes, (d) => (y(), F(g, {
737
- key: d,
738
- label: d,
739
- removable: !0,
740
- onChipClosed: () => n.value.cardTypes.splice(n.value.cardTypes.indexOf(d), 1)
741
- }, null, 8, ["label", "onChipClosed"]))), 128))
742
- ]),
743
- x("div", gn, [
744
- o.value > -1 ? (y(), F(m, {
745
- key: 0,
746
- class: "flex-1",
747
- variant: "secondary",
748
- label: "Delete",
749
- onclick: () => v(o.value)
750
- }, null, 8, ["onclick"])) : R("", !0),
751
- b(m, {
752
- type: "submit",
753
- class: "flex-1",
754
- variant: "primary",
755
- label: "Save"
756
- })
757
- ])
758
- ]),
759
- _: 1
760
- }, 512);
761
- };
762
- }
763
- }), bn = { class: "flex items-end" }, hn = { class: "flex flex-wrap gap-8 items-center mt-4" }, _n = { class: "flex mt-6 space-x-6" }, wn = /* @__PURE__ */ X({
764
- __name: "Maybank2Gateway",
765
- props: {
766
- terminal: {
767
- type: Object,
768
- required: !0
769
- },
770
- onUpdate: {
771
- type: Function,
772
- required: !0
773
- }
774
- },
775
- setup(e) {
776
- const a = e, t = ue(() => a.terminal), l = T(), o = T(-1), r = T(), n = T({
777
- ip: "",
778
- receiptName: "",
779
- cardTypes: []
780
- }), c = () => {
781
- n.value.ip = "", n.value.receiptName = "", n.value.cardTypes = [], o.value = -1;
782
- }, s = () => {
783
- var m;
784
- if (!t.value.ecrIntegrations)
785
- return c();
786
- const p = t.value.ecrIntegrations, i = p.findIndex((g) => g && g.gateway && g.gateway === "Maybank2");
787
- if (i === -1)
788
- return c();
789
- o.value = i;
790
- const u = p.at(i);
791
- u.gateway === "Maybank2" && u.config && (n.value = {
792
- ip: u.config.ip ?? "",
793
- receiptName: u.receiptName ?? "",
794
- cardTypes: ((m = u.dialogConfig) == null ? void 0 : m.cardTypes) ?? []
795
- });
796
- };
797
- ne(t, s), ie(s);
798
- async function v(p) {
799
- var i;
800
- (i = t.value.ecrIntegrations) == null || i.splice(p, 1), a.onUpdate(t.value);
801
- }
802
- async function f() {
803
- n.value.cardTypes.push(r.value), r.value = "";
804
- }
805
- return (p, i) => {
806
- const u = h("FmTextField"), m = h("FmButton"), g = h("FmChip"), k = h("FmForm");
807
- return y(), F(k, {
808
- ref: l.value,
809
- class: "flex flex-col gap-16 w-[500px]",
810
- onValidationSuccess: i[3] || (i[3] = () => {
811
- var d, C;
812
- o.value > -1 ? t.value.ecrIntegrations[o.value] = {
813
- gateway: "Maybank2",
814
- config: { ip: n.value.ip },
815
- receiptName: n.value.receiptName,
816
- dialogConfig: {
817
- ...(C = (d = t.value.ecrIntegrations) == null ? void 0 : d[o.value]) == null ? void 0 : C.dialogConfig,
818
- cardTypes: n.value.cardTypes
819
- }
820
- } : (t.value.ecrIntegrations || (t.value.ecrIntegrations = []), t.value.ecrIntegrations.push({
821
- gateway: "Maybank2",
822
- config: { ip: n.value.ip },
823
- receiptName: n.value.receiptName,
824
- dialogConfig: {
825
- cardTypes: n.value.cardTypes
826
- }
827
- })), a.onUpdate(t.value);
828
- })
829
- }, {
830
- default: ae(() => [
831
- b(u, {
832
- modelValue: n.value.ip,
833
- "onUpdate:modelValue": i[0] || (i[0] = (d) => n.value.ip = d),
834
- label: "IP Address"
835
- }, null, 8, ["modelValue"]),
836
- b(u, {
837
- modelValue: n.value.receiptName,
838
- "onUpdate:modelValue": i[1] || (i[1] = (d) => n.value.receiptName = d),
839
- label: "Receipt Payment Name",
840
- "label-info": "Default receipt display will be 'TERMINAL_MAYBANK'"
841
- }, null, 8, ["modelValue"]),
842
- x("div", bn, [
843
- b(u, {
844
- modelValue: r.value,
845
- "onUpdate:modelValue": i[2] || (i[2] = (d) => r.value = d),
846
- label: "Fallback Card Types",
847
- "label-info": "List of cards when fallback to reconcile dialog. Default VISA, MASTER"
848
- }, null, 8, ["modelValue"]),
849
- b(m, {
850
- class: "ml-4",
851
- icon: "add",
852
- onClick: f
853
- })
854
- ]),
855
- x("div", hn, [
856
- (y(!0), E(re, null, ge(n.value.cardTypes, (d) => (y(), F(g, {
857
- key: d,
858
- label: d,
859
- removable: !0,
860
- onChipClosed: () => n.value.cardTypes.splice(n.value.cardTypes.indexOf(d), 1)
861
- }, null, 8, ["label", "onChipClosed"]))), 128))
862
- ]),
863
- x("div", _n, [
864
- o.value > -1 ? (y(), F(m, {
865
- key: 0,
866
- class: "flex-1",
867
- variant: "secondary",
868
- label: "Delete",
869
- onclick: () => v(o.value)
870
- }, null, 8, ["onclick"])) : R("", !0),
871
- b(m, {
872
- type: "submit",
873
- class: "flex-1",
874
- variant: "primary",
875
- label: "Save"
876
- })
877
- ])
878
- ]),
879
- _: 1
880
- }, 512);
881
- };
882
- }
883
- }), xn = { class: "flex items-end" }, Tn = { class: "flex flex-wrap gap-8 items-center mt-4" }, In = { class: "flex mt-6 space-x-6" }, Cn = /* @__PURE__ */ X({
884
- __name: "Maybank3Gateway",
885
- props: {
886
- terminal: {
887
- type: Object,
888
- required: !0
889
- },
890
- onUpdate: {
891
- type: Function,
892
- required: !0
893
- }
894
- },
895
- setup(e) {
896
- const a = e, t = ue(() => a.terminal), l = T(), o = T(-1), r = T(), n = T({
897
- receiptName: "",
898
- config: {},
899
- cardTypes: []
900
- }), c = () => {
901
- n.value.receiptName = "", n.value.cardTypes = [], o.value = -1;
902
- }, s = () => {
903
- var m;
904
- if (!t.value.ecrIntegrations)
905
- return c();
906
- const p = t.value.ecrIntegrations, i = p.findIndex((g) => g && g.gateway && g.gateway === "Maybank3");
907
- if (i === -1)
908
- return c();
909
- o.value = i;
910
- const u = p.at(i);
911
- u.gateway === "Maybank3" && u.config && (n.value = {
912
- config: u.config,
913
- receiptName: u.receiptName ?? "",
914
- cardTypes: ((m = u.dialogConfig) == null ? void 0 : m.cardTypes) ?? []
915
- });
916
- };
917
- ne(t, s), ie(s);
918
- async function v(p) {
919
- var i;
920
- (i = t.value.ecrIntegrations) == null || i.splice(p, 1), a.onUpdate(t.value);
921
- }
922
- async function f() {
923
- n.value.cardTypes.push(r.value), r.value = "";
924
- }
925
- return (p, i) => {
926
- const u = h("FmTextField"), m = h("FmButton"), g = h("FmChip"), k = h("FmForm");
927
- return y(), F(k, {
928
- ref: l.value,
929
- class: "flex flex-col gap-16 w-[500px]",
930
- onValidationSuccess: i[2] || (i[2] = () => {
931
- var d, C;
932
- o.value > -1 ? t.value.ecrIntegrations[o.value] = {
933
- gateway: "Maybank3",
934
- config: n.value.config,
935
- receiptName: n.value.receiptName,
936
- dialogConfig: {
937
- ...(C = (d = t.value.ecrIntegrations) == null ? void 0 : d[o.value]) == null ? void 0 : C.dialogConfig,
938
- cardTypes: n.value.cardTypes
939
- }
940
- } : (t.value.ecrIntegrations || (t.value.ecrIntegrations = []), t.value.ecrIntegrations.push({
941
- gateway: "Maybank3",
942
- config: n.value.config,
943
- receiptName: n.value.receiptName,
944
- dialogConfig: {
945
- cardTypes: n.value.cardTypes
946
- }
947
- })), a.onUpdate(t.value);
948
- })
949
- }, {
950
- default: ae(() => [
951
- b(u, {
952
- modelValue: n.value.receiptName,
953
- "onUpdate:modelValue": i[0] || (i[0] = (d) => n.value.receiptName = d),
954
- label: "Receipt Payment Name",
955
- "label-info": "Default receipt display will be 'TERMINAL_MAYBANK'"
956
- }, null, 8, ["modelValue"]),
957
- x("div", xn, [
958
- b(u, {
959
- modelValue: r.value,
960
- "onUpdate:modelValue": i[1] || (i[1] = (d) => r.value = d),
961
- label: "Fallback Card Types",
962
- "label-info": "List of cards when fallback to reconcile dialog. Default VISA, MASTER"
963
- }, null, 8, ["modelValue"]),
964
- b(m, {
965
- class: "ml-4",
966
- icon: "add",
967
- onClick: f
968
- })
969
- ]),
970
- x("div", Tn, [
971
- (y(!0), E(re, null, ge(n.value.cardTypes, (d) => (y(), F(g, {
972
- key: d,
973
- label: d,
974
- removable: !0,
975
- onChipClosed: () => n.value.cardTypes.splice(n.value.cardTypes.indexOf(d), 1)
976
- }, null, 8, ["label", "onChipClosed"]))), 128))
977
- ]),
978
- x("div", In, [
979
- o.value > -1 ? (y(), F(m, {
980
- key: 0,
981
- class: "flex-1",
982
- variant: "secondary",
983
- label: "Delete",
984
- onclick: () => v(o.value)
985
- }, null, 8, ["onclick"])) : R("", !0),
986
- b(m, {
987
- type: "submit",
988
- class: "flex-1",
989
- variant: "primary",
990
- label: "Save"
991
- })
992
- ])
993
- ]),
994
- _: 1
995
- }, 512);
996
- };
997
- }
998
- }), Fn = { class: "flex items-end" }, Sn = { class: "flex flex-wrap gap-8 items-center mt-4" }, kn = { class: "flex mt-6 space-x-6" }, Nn = /* @__PURE__ */ X({
999
- __name: "NetsGateway",
1000
- props: {
1001
- terminal: {
1002
- type: Object,
1003
- required: !0
1004
- },
1005
- onUpdate: {
1006
- type: Function,
1007
- required: !0
1008
- }
1009
- },
1010
- setup(e) {
1011
- const a = e, t = ue(() => a.terminal), l = T(), o = T(-1), r = T(), n = T({
1012
- ip: "",
1013
- receiptName: "",
1014
- cardTypes: []
1015
- }), c = () => {
1016
- n.value.ip = "", n.value.receiptName = "", n.value.cardTypes = [], o.value = -1;
1017
- }, s = () => {
1018
- var m;
1019
- if (!t.value.ecrIntegrations)
1020
- return c();
1021
- const p = t.value.ecrIntegrations, i = p.findIndex((g) => g && g.gateway && g.gateway === "Nets");
1022
- if (i === -1)
1023
- return c();
1024
- o.value = i;
1025
- const u = p.at(i);
1026
- u.gateway === "Nets" && u.config && (n.value = {
1027
- ip: u.config.ip ?? "",
1028
- receiptName: u.receiptName ?? "",
1029
- cardTypes: ((m = u.dialogConfig) == null ? void 0 : m.cardTypes) ?? []
1030
- });
1031
- };
1032
- ne(t, s), ie(s);
1033
- async function v(p) {
1034
- var i;
1035
- (i = t.value.ecrIntegrations) == null || i.splice(p, 1), a.onUpdate(t.value);
1036
- }
1037
- async function f() {
1038
- n.value.cardTypes.push(r.value), r.value = "";
1039
- }
1040
- return (p, i) => {
1041
- const u = h("FmTextField"), m = h("FmButton"), g = h("FmChip"), k = h("FmForm");
1042
- return y(), F(k, {
1043
- ref: l.value,
1044
- class: "flex flex-col gap-16 w-[500px]",
1045
- onValidationSuccess: i[3] || (i[3] = () => {
1046
- var d, C;
1047
- o.value > -1 ? t.value.ecrIntegrations[o.value] = {
1048
- gateway: "Nets",
1049
- config: { ip: n.value.ip },
1050
- receiptName: n.value.receiptName,
1051
- dialogConfig: {
1052
- ...(C = (d = t.value.ecrIntegrations) == null ? void 0 : d[o.value]) == null ? void 0 : C.dialogConfig,
1053
- cardTypes: n.value.cardTypes
1054
- }
1055
- } : (t.value.ecrIntegrations || (t.value.ecrIntegrations = []), t.value.ecrIntegrations.push({
1056
- gateway: "Nets",
1057
- config: { ip: n.value.ip },
1058
- receiptName: n.value.receiptName,
1059
- dialogConfig: {
1060
- cardTypes: n.value.cardTypes
1061
- }
1062
- })), a.onUpdate(t.value);
1063
- })
1064
- }, {
1065
- default: ae(() => [
1066
- b(u, {
1067
- modelValue: n.value.ip,
1068
- "onUpdate:modelValue": i[0] || (i[0] = (d) => n.value.ip = d),
1069
- label: "IP Address"
1070
- }, null, 8, ["modelValue"]),
1071
- b(u, {
1072
- modelValue: n.value.receiptName,
1073
- "onUpdate:modelValue": i[1] || (i[1] = (d) => n.value.receiptName = d),
1074
- label: "Receipt Payment Name",
1075
- "label-info": "Default receipt display will be 'TERMINAL_NETS'"
1076
- }, null, 8, ["modelValue"]),
1077
- x("div", Fn, [
1078
- b(u, {
1079
- modelValue: r.value,
1080
- "onUpdate:modelValue": i[2] || (i[2] = (d) => r.value = d),
1081
- label: "Fallback Card Types",
1082
- "label-info": "List of cards when fallback to reconcile dialog. Default VISA, MASTER"
1083
- }, null, 8, ["modelValue"]),
1084
- b(m, {
1085
- class: "ml-4",
1086
- icon: "add",
1087
- onClick: f
1088
- })
1089
- ]),
1090
- x("div", Sn, [
1091
- (y(!0), E(re, null, ge(n.value.cardTypes, (d) => (y(), F(g, {
1092
- key: d,
1093
- label: d,
1094
- removable: !0,
1095
- onChipClosed: () => n.value.cardTypes.splice(n.value.cardTypes.indexOf(d), 1)
1096
- }, null, 8, ["label", "onChipClosed"]))), 128))
1097
- ]),
1098
- x("div", kn, [
1099
- o.value > -1 ? (y(), F(m, {
1100
- key: 0,
1101
- class: "flex-1",
1102
- variant: "secondary",
1103
- label: "Delete",
1104
- onclick: () => v(o.value)
1105
- }, null, 8, ["onclick"])) : R("", !0),
1106
- b(m, {
1107
- type: "submit",
1108
- class: "flex-1",
1109
- variant: "primary",
1110
- label: "Save"
1111
- })
1112
- ])
1113
- ]),
1114
- _: 1
1115
- }, 512);
1116
- };
1117
- }
1118
- }), Vn = { class: "flex items-end" }, En = { class: "flex flex-wrap gap-8 items-center mt-4" }, Dn = { class: "flex mt-6 space-x-6" }, On = /* @__PURE__ */ X({
1119
- __name: "KBankGateway",
1120
- props: {
1121
- terminal: {
1122
- type: Object,
1123
- required: !0
1124
- },
1125
- onUpdate: {
1126
- type: Function,
1127
- required: !0
1128
- }
1129
- },
1130
- setup(e) {
1131
- const a = e, t = ue(() => a.terminal), l = T(), o = T(-1), r = T(), n = T({
1132
- receiptName: "",
1133
- cardTypes: []
1134
- }), c = () => {
1135
- n.value.receiptName = "", n.value.cardTypes = [], o.value = -1;
1136
- }, s = () => {
1137
- var m;
1138
- if (!t.value.ecrIntegrations)
1139
- return c();
1140
- const p = t.value.ecrIntegrations, i = p.findIndex((g) => g && g.gateway && g.gateway === "Kbank");
1141
- if (i === -1)
1142
- return c();
1143
- o.value = i;
1144
- const u = p.at(i);
1145
- u.gateway === "Kbank" && u.config && (n.value = {
1146
- receiptName: u.receiptName ?? "",
1147
- cardTypes: ((m = u.dialogConfig) == null ? void 0 : m.cardTypes) ?? []
1148
- });
1149
- };
1150
- ne(t, s), ie(s);
1151
- async function v(p) {
1152
- var i;
1153
- (i = t.value.ecrIntegrations) == null || i.splice(p, 1), a.onUpdate(t.value);
1154
- }
1155
- async function f() {
1156
- n.value.cardTypes.push(r.value), r.value = "";
1157
- }
1158
- return (p, i) => {
1159
- const u = h("FmTextField"), m = h("FmButton"), g = h("FmChip"), k = h("FmForm");
1160
- return y(), F(k, {
1161
- ref: l.value,
1162
- class: "flex flex-col gap-16 w-[500px]",
1163
- onValidationSuccess: i[2] || (i[2] = () => {
1164
- var d, C;
1165
- o.value > -1 ? t.value.ecrIntegrations[o.value] = {
1166
- gateway: "Kbank",
1167
- config: {},
1168
- receiptName: n.value.receiptName,
1169
- dialogConfig: {
1170
- ...(C = (d = t.value.ecrIntegrations) == null ? void 0 : d[o.value]) == null ? void 0 : C.dialogConfig,
1171
- cardTypes: n.value.cardTypes
1172
- }
1173
- } : (t.value.ecrIntegrations || (t.value.ecrIntegrations = []), t.value.ecrIntegrations.push({
1174
- gateway: "Kbank",
1175
- config: {},
1176
- receiptName: n.value.receiptName,
1177
- dialogConfig: {
1178
- cardTypes: n.value.cardTypes
1179
- }
1180
- })), a.onUpdate(t.value);
1181
- })
1182
- }, {
1183
- default: ae(() => [
1184
- b(u, {
1185
- modelValue: n.value.receiptName,
1186
- "onUpdate:modelValue": i[0] || (i[0] = (d) => n.value.receiptName = d),
1187
- label: "Receipt Payment Name",
1188
- "label-info": "Default receipt display will be 'TERMINAL_KBANK'"
1189
- }, null, 8, ["modelValue"]),
1190
- x("div", Vn, [
1191
- b(u, {
1192
- modelValue: r.value,
1193
- "onUpdate:modelValue": i[1] || (i[1] = (d) => r.value = d),
1194
- label: "Fallback Card Types",
1195
- "label-info": "List of cards when fallback to reconcile dialog. Default VISA, MASTER"
1196
- }, null, 8, ["modelValue"]),
1197
- b(m, {
1198
- class: "ml-4",
1199
- icon: "add",
1200
- onClick: f
1201
- })
1202
- ]),
1203
- x("div", En, [
1204
- (y(!0), E(re, null, ge(n.value.cardTypes, (d) => (y(), F(g, {
1205
- key: d,
1206
- label: d,
1207
- removable: !0,
1208
- onChipClosed: () => n.value.cardTypes.splice(n.value.cardTypes.indexOf(d), 1)
1209
- }, null, 8, ["label", "onChipClosed"]))), 128))
1210
- ]),
1211
- x("div", Dn, [
1212
- o.value > -1 ? (y(), F(m, {
1213
- key: 0,
1214
- class: "flex-1",
1215
- variant: "secondary",
1216
- label: "Delete",
1217
- onclick: () => v(o.value)
1218
- }, null, 8, ["onclick"])) : R("", !0),
1219
- b(m, {
1220
- type: "submit",
1221
- class: "flex-1",
1222
- variant: "primary",
1223
- label: "Save"
1224
- })
1225
- ])
1226
- ]),
1227
- _: 1
1228
- }, 512);
1229
- };
1230
- }
1231
- }), Pn = { class: "flex mt-6 space-x-6" }, Un = /* @__PURE__ */ X({
1232
- __name: "Ghl2Gateway",
1233
- props: {
1234
- terminal: {
1235
- type: Object,
1236
- required: !0
1237
- },
1238
- onUpdate: {
1239
- type: Function,
1240
- required: !0
1241
- }
1242
- },
1243
- setup(e) {
1244
- const a = e, t = ue(() => a.terminal), l = T(), o = T(-1), r = T({
1245
- ip: "",
1246
- receiptName: ""
1247
- }), n = () => {
1248
- r.value.ip = "", r.value.receiptName = "", o.value = -1;
1249
- }, c = () => {
1250
- if (!t.value.ecrIntegrations)
1251
- return n();
1252
- const v = t.value.ecrIntegrations, f = v.findIndex((i) => i && i.gateway && i.gateway === "Ghl2");
1253
- if (f === -1)
1254
- return n();
1255
- o.value = f;
1256
- const p = v.at(f);
1257
- p.gateway === "Ghl2" && p.config && (r.value = {
1258
- ip: p.config.ip ?? "",
1259
- receiptName: p.receiptName ?? ""
1260
- });
1261
- };
1262
- ne(t, c), ie(c);
1263
- async function s(v) {
1264
- var f;
1265
- (f = t.value.ecrIntegrations) == null || f.splice(v, 1), a.onUpdate(t.value);
1266
- }
1267
- return (v, f) => {
1268
- const p = h("FmTextField"), i = h("FmButton"), u = h("FmForm");
1269
- return y(), F(u, {
1270
- ref: l.value,
1271
- class: "flex flex-col gap-16 w-[500px]",
1272
- onValidationSuccess: f[2] || (f[2] = () => {
1273
- t.value.ecrIntegrations || (t.value.ecrIntegrations = []), o.value > -1 ? t.value.ecrIntegrations[o.value] = {
1274
- gateway: "Ghl2",
1275
- config: { ip: r.value.ip },
1276
- receiptName: r.value.receiptName
1277
- } : t.value.ecrIntegrations.push({
1278
- gateway: "Ghl2",
1279
- config: { ip: r.value.ip },
1280
- receiptName: r.value.receiptName
1281
- }), a.onUpdate(t.value);
1282
- })
1283
- }, {
1284
- default: ae(() => [
1285
- b(p, {
1286
- modelValue: r.value.ip,
1287
- "onUpdate:modelValue": f[0] || (f[0] = (m) => r.value.ip = m),
1288
- label: "IP Address"
1289
- }, null, 8, ["modelValue"]),
1290
- b(p, {
1291
- modelValue: r.value.receiptName,
1292
- "onUpdate:modelValue": f[1] || (f[1] = (m) => r.value.receiptName = m),
1293
- label: "Receipt Payment Name",
1294
- "label-info": "Default receipt display will be 'TERMINAL_GHL_2'"
1295
- }, null, 8, ["modelValue"]),
1296
- x("div", Pn, [
1297
- o.value > -1 ? (y(), F(i, {
1298
- key: 0,
1299
- class: "flex-1",
1300
- variant: "secondary",
1301
- label: "Delete",
1302
- onclick: () => s(o.value)
1303
- }, null, 8, ["onclick"])) : R("", !0),
1304
- b(i, {
1305
- type: "submit",
1306
- class: "flex-1",
1307
- variant: "primary",
1308
- label: "Save"
1309
- })
1310
- ])
1311
- ]),
1312
- _: 1
1313
- }, 512);
1314
- };
1315
- }
1316
- }), An = { class: "flex items-end" }, Mn = { class: "flex flex-wrap gap-8 items-center mt-4" }, Rn = { class: "flex mt-6 space-x-6" }, Bn = /* @__PURE__ */ X({
1317
- __name: "Ghl3Gateway",
1318
- props: {
1319
- terminal: {
1320
- type: Object,
1321
- required: !0
1322
- },
1323
- onUpdate: {
1324
- type: Function,
1325
- required: !0
1326
- }
1327
- },
1328
- setup(e) {
1329
- const a = e, t = ue(() => a.terminal), l = T(), o = T(-1), r = T(), n = T({
1330
- receiptName: "",
1331
- config: {},
1332
- cardTypes: []
1333
- }), c = () => {
1334
- n.value.receiptName = "", n.value.cardTypes = [], o.value = -1;
1335
- }, s = () => {
1336
- var m;
1337
- if (!t.value.ecrIntegrations)
1338
- return c();
1339
- const p = t.value.ecrIntegrations, i = p.findIndex(
1340
- (g) => g && g.gateway && g.gateway === "Ghl3"
1341
- );
1342
- if (i === -1)
1343
- return c();
1344
- o.value = i;
1345
- const u = p.at(i);
1346
- u.gateway === "Ghl3" && u.config && (n.value = {
1347
- config: u.config,
1348
- receiptName: u.receiptName ?? "",
1349
- cardTypes: ((m = u.dialogConfig) == null ? void 0 : m.cardTypes) ?? []
1350
- });
1351
- };
1352
- ne(t, s), ie(s);
1353
- async function v(p) {
1354
- var i;
1355
- (i = t.value.ecrIntegrations) == null || i.splice(p, 1), a.onUpdate(t.value);
1356
- }
1357
- async function f() {
1358
- n.value.cardTypes.push(r.value), r.value = "";
1359
- }
1360
- return (p, i) => {
1361
- const u = h("FmTextField"), m = h("FmButton"), g = h("FmChip"), k = h("FmForm");
1362
- return y(), F(k, {
1363
- ref: l.value,
1364
- class: "flex flex-col gap-16 w-[500px]",
1365
- onValidationSuccess: i[2] || (i[2] = () => {
1366
- var d, C;
1367
- o.value > -1 ? t.value.ecrIntegrations[o.value] = {
1368
- gateway: "Ghl3",
1369
- config: n.value.config,
1370
- receiptName: n.value.receiptName,
1371
- dialogConfig: {
1372
- ...(C = (d = t.value.ecrIntegrations) == null ? void 0 : d[o.value]) == null ? void 0 : C.dialogConfig,
1373
- cardTypes: n.value.cardTypes
1374
- }
1375
- } : (t.value.ecrIntegrations || (t.value.ecrIntegrations = []), t.value.ecrIntegrations.push({
1376
- gateway: "Ghl3",
1377
- config: n.value.config,
1378
- receiptName: n.value.receiptName,
1379
- dialogConfig: {
1380
- cardTypes: n.value.cardTypes
1381
- }
1382
- })), a.onUpdate(t.value);
1383
- })
1384
- }, {
1385
- default: ae(() => [
1386
- b(u, {
1387
- modelValue: n.value.receiptName,
1388
- "onUpdate:modelValue": i[0] || (i[0] = (d) => n.value.receiptName = d),
1389
- label: "Receipt Payment Name",
1390
- "label-info": "Default receipt display will be 'TERMINAL_GHL'"
1391
- }, null, 8, ["modelValue"]),
1392
- x("div", An, [
1393
- b(u, {
1394
- modelValue: r.value,
1395
- "onUpdate:modelValue": i[1] || (i[1] = (d) => r.value = d),
1396
- label: "Fallback Card Types",
1397
- "label-info": "List of cards when fallback to reconcile dialog. Default VISA, MASTER"
1398
- }, null, 8, ["modelValue"]),
1399
- b(m, {
1400
- class: "ml-4",
1401
- icon: "add",
1402
- onClick: f
1403
- })
1404
- ]),
1405
- x("div", Mn, [
1406
- (y(!0), E(re, null, ge(n.value.cardTypes, (d) => (y(), F(g, {
1407
- key: d,
1408
- label: d,
1409
- removable: !0,
1410
- onChipClosed: () => n.value.cardTypes.splice(n.value.cardTypes.indexOf(d), 1)
1411
- }, null, 8, ["label", "onChipClosed"]))), 128))
1412
- ]),
1413
- x("div", Rn, [
1414
- o.value > -1 ? (y(), F(m, {
1415
- key: 0,
1416
- class: "flex-1",
1417
- variant: "secondary",
1418
- label: "Delete",
1419
- onclick: () => v(o.value)
1420
- }, null, 8, ["onclick"])) : R("", !0),
1421
- b(m, {
1422
- type: "submit",
1423
- class: "flex-1",
1424
- variant: "primary",
1425
- label: "Save"
1426
- })
1427
- ])
1428
- ]),
1429
- _: 1
1430
- }, 512);
1431
- };
1432
- }
1433
- }), qn = { class: "flex items-end" }, Gn = { class: "flex flex-wrap gap-8 items-center mt-4" }, $n = { class: "flex mt-6 space-x-6" }, Ln = /* @__PURE__ */ X({
1434
- __name: "HlbbGateway",
1435
- props: {
1436
- terminal: {
1437
- type: Object,
1438
- required: !0
1439
- },
1440
- onUpdate: {
1441
- type: Function,
1442
- required: !0
1443
- }
1444
- },
1445
- setup(e) {
1446
- const a = e, t = ue(() => a.terminal), l = T(), o = T(-1), r = T(), n = T({
1447
- receiptName: "",
1448
- config: {},
1449
- cardTypes: []
1450
- }), c = () => {
1451
- n.value.receiptName = "", n.value.cardTypes = [], o.value = -1;
1452
- }, s = () => {
1453
- var m;
1454
- if (!t.value.ecrIntegrations)
1455
- return c();
1456
- const p = t.value.ecrIntegrations, i = p.findIndex(
1457
- (g) => g && g.gateway && g.gateway === "Hlbb"
1458
- );
1459
- if (i === -1)
1460
- return c();
1461
- o.value = i;
1462
- const u = p.at(i);
1463
- u.gateway === "Hlbb" && u.config && (n.value = {
1464
- config: u.config,
1465
- receiptName: u.receiptName ?? "",
1466
- cardTypes: ((m = u.dialogConfig) == null ? void 0 : m.cardTypes) ?? []
1467
- });
1468
- };
1469
- ne(t, s), ie(s);
1470
- async function v(p) {
1471
- var i;
1472
- (i = t.value.ecrIntegrations) == null || i.splice(p, 1), a.onUpdate(t.value);
1473
- }
1474
- async function f() {
1475
- n.value.cardTypes.push(r.value), r.value = "";
1476
- }
1477
- return (p, i) => {
1478
- const u = h("FmTextField"), m = h("FmButton"), g = h("FmChip"), k = h("FmForm");
1479
- return y(), F(k, {
1480
- ref: l.value,
1481
- class: "flex flex-col gap-16 w-[500px]",
1482
- onValidationSuccess: i[2] || (i[2] = () => {
1483
- var d, C;
1484
- o.value > -1 ? t.value.ecrIntegrations[o.value] = {
1485
- gateway: "Hlbb",
1486
- config: n.value.config,
1487
- receiptName: n.value.receiptName,
1488
- dialogConfig: {
1489
- ...(C = (d = t.value.ecrIntegrations) == null ? void 0 : d[o.value]) == null ? void 0 : C.dialogConfig,
1490
- cardTypes: n.value.cardTypes
1491
- }
1492
- } : (t.value.ecrIntegrations || (t.value.ecrIntegrations = []), t.value.ecrIntegrations.push({
1493
- gateway: "Hlbb",
1494
- config: n.value.config,
1495
- receiptName: n.value.receiptName,
1496
- dialogConfig: {
1497
- cardTypes: n.value.cardTypes
1498
- }
1499
- })), a.onUpdate(t.value);
1500
- })
1501
- }, {
1502
- default: ae(() => [
1503
- b(u, {
1504
- modelValue: n.value.receiptName,
1505
- "onUpdate:modelValue": i[0] || (i[0] = (d) => n.value.receiptName = d),
1506
- label: "Receipt Payment Name",
1507
- "label-info": "Default receipt display will be 'TERMINAL_MAYBANK'"
1508
- }, null, 8, ["modelValue"]),
1509
- x("div", qn, [
1510
- b(u, {
1511
- modelValue: r.value,
1512
- "onUpdate:modelValue": i[1] || (i[1] = (d) => r.value = d),
1513
- label: "Fallback Card Types",
1514
- "label-info": "List of cards when fallback to reconcile dialog. Default VISA, MASTER"
1515
- }, null, 8, ["modelValue"]),
1516
- b(m, {
1517
- class: "ml-4",
1518
- icon: "add",
1519
- onClick: f
1520
- })
1521
- ]),
1522
- x("div", Gn, [
1523
- (y(!0), E(re, null, ge(n.value.cardTypes, (d) => (y(), F(g, {
1524
- key: d,
1525
- label: d,
1526
- removable: !0,
1527
- onChipClosed: () => n.value.cardTypes.splice(n.value.cardTypes.indexOf(d), 1)
1528
- }, null, 8, ["label", "onChipClosed"]))), 128))
1529
- ]),
1530
- x("div", $n, [
1531
- o.value > -1 ? (y(), F(m, {
1532
- key: 0,
1533
- class: "flex-1",
1534
- variant: "secondary",
1535
- label: "Delete",
1536
- onclick: () => v(o.value)
1537
- }, null, 8, ["onclick"])) : R("", !0),
1538
- b(m, {
1539
- type: "submit",
1540
- class: "flex-1",
1541
- variant: "primary",
1542
- label: "Save"
1543
- })
1544
- ])
1545
- ]),
1546
- _: 1
1547
- }, 512);
1548
- };
1549
- }
1550
- }), Yn = { class: "flex items-end" }, jn = { class: "flex flex-wrap gap-8 items-center mt-4" }, Hn = { class: "flex mt-6 space-x-6" }, Kn = /* @__PURE__ */ X({
1551
- __name: "GlobalPaymentsGateway",
1552
- props: {
1553
- terminal: {
1554
- type: Object,
1555
- required: !0
1556
- },
1557
- onUpdate: {
1558
- type: Function,
1559
- required: !0
1560
- }
1561
- },
1562
- setup(e) {
1563
- const a = e, t = ue(() => a.terminal), l = T(), o = T(-1), r = T(), n = T({
1564
- ip: "",
1565
- receiptName: "",
1566
- cardTypes: []
1567
- }), c = () => {
1568
- n.value.ip = "", n.value.receiptName = "", n.value.cardTypes = [], o.value = -1;
1569
- }, s = () => {
1570
- var m;
1571
- if (!t.value.ecrIntegrations)
1572
- return c();
1573
- const p = t.value.ecrIntegrations, i = p.findIndex(
1574
- (g) => g && g.gateway && g.gateway === "GlobalPayments"
1575
- );
1576
- if (i === -1)
1577
- return c();
1578
- o.value = i;
1579
- const u = p.at(i);
1580
- u.gateway === "GlobalPayments" && u.config && (n.value = {
1581
- ip: u.config.ip ?? "",
1582
- receiptName: u.receiptName ?? "",
1583
- cardTypes: ((m = u.dialogConfig) == null ? void 0 : m.cardTypes) ?? []
1584
- });
1585
- };
1586
- ne(t, s), ie(s);
1587
- async function v(p) {
1588
- var i;
1589
- (i = t.value.ecrIntegrations) == null || i.splice(p, 1), a.onUpdate(t.value);
1590
- }
1591
- async function f() {
1592
- n.value.cardTypes.push(r.value), r.value = "";
1593
- }
1594
- return (p, i) => {
1595
- const u = h("FmTextField"), m = h("FmButton"), g = h("FmChip"), k = h("FmForm");
1596
- return y(), F(k, {
1597
- ref: l.value,
1598
- class: "flex flex-col gap-16 w-[500px]",
1599
- onValidationSuccess: i[3] || (i[3] = () => {
1600
- var d, C;
1601
- o.value > -1 ? t.value.ecrIntegrations[o.value] = {
1602
- gateway: "GlobalPayments",
1603
- config: { ip: n.value.ip },
1604
- receiptName: n.value.receiptName,
1605
- dialogConfig: {
1606
- ...(C = (d = t.value.ecrIntegrations) == null ? void 0 : d[o.value]) == null ? void 0 : C.dialogConfig,
1607
- cardTypes: n.value.cardTypes
1608
- }
1609
- } : (t.value.ecrIntegrations || (t.value.ecrIntegrations = []), t.value.ecrIntegrations.push({
1610
- gateway: "GlobalPayments",
1611
- config: { ip: n.value.ip },
1612
- receiptName: n.value.receiptName,
1613
- dialogConfig: {
1614
- cardTypes: n.value.cardTypes
1615
- }
1616
- })), a.onUpdate(t.value);
1617
- })
1618
- }, {
1619
- default: ae(() => [
1620
- b(u, {
1621
- modelValue: n.value.ip,
1622
- "onUpdate:modelValue": i[0] || (i[0] = (d) => n.value.ip = d),
1623
- label: "IP Address"
1624
- }, null, 8, ["modelValue"]),
1625
- b(u, {
1626
- modelValue: n.value.receiptName,
1627
- "onUpdate:modelValue": i[1] || (i[1] = (d) => n.value.receiptName = d),
1628
- label: "Receipt Payment Name",
1629
- "label-info": "Default receipt display will be 'TERMINAL_GP'"
1630
- }, null, 8, ["modelValue"]),
1631
- x("div", Yn, [
1632
- b(u, {
1633
- modelValue: r.value,
1634
- "onUpdate:modelValue": i[2] || (i[2] = (d) => r.value = d),
1635
- label: "Fallback Card Types",
1636
- "label-info": "List of cards when fallback to reconcile dialog. Default VISA, MASTER"
1637
- }, null, 8, ["modelValue"]),
1638
- b(m, {
1639
- class: "ml-4",
1640
- icon: "add",
1641
- onClick: f
1642
- })
1643
- ]),
1644
- x("div", jn, [
1645
- (y(!0), E(re, null, ge(n.value.cardTypes, (d) => (y(), F(g, {
1646
- key: d,
1647
- label: d,
1648
- removable: !0,
1649
- onChipClosed: () => n.value.cardTypes.splice(n.value.cardTypes.indexOf(d), 1)
1650
- }, null, 8, ["label", "onChipClosed"]))), 128))
1651
- ]),
1652
- x("div", Hn, [
1653
- o.value > -1 ? (y(), F(m, {
1654
- key: 0,
1655
- class: "flex-1",
1656
- variant: "secondary",
1657
- label: "Delete",
1658
- onclick: () => v(o.value)
1659
- }, null, 8, ["onclick"])) : R("", !0),
1660
- b(m, {
1661
- type: "submit",
1662
- class: "flex-1",
1663
- variant: "primary",
1664
- label: "Save"
1665
- })
1666
- ])
1667
- ]),
1668
- _: 1
1669
- }, 512);
1670
- };
1671
- }
1672
- }), Xn = { class: "flex items-end" }, Wn = { class: "flex flex-wrap gap-8 items-center mt-4" }, zn = { class: "flex mt-6 space-x-6" }, Qn = /* @__PURE__ */ X({
1673
- __name: "OmaGateway",
1674
- props: {
1675
- terminal: {
1676
- type: Object,
1677
- required: !0
1678
- },
1679
- onUpdate: {
1680
- type: Function,
1681
- required: !0
1682
- }
1683
- },
1684
- setup(e) {
1685
- const a = e, t = ue(() => a.terminal), l = T(), o = T(-1), r = T(), n = T({
1686
- receiptName: "",
1687
- cardTypes: []
1688
- }), c = () => {
1689
- n.value.receiptName = "", n.value.cardTypes = [], o.value = -1;
1690
- }, s = () => {
1691
- var m;
1692
- if (!t.value.ecrIntegrations)
1693
- return c();
1694
- const p = t.value.ecrIntegrations, i = p.findIndex(
1695
- (g) => g && g.gateway && g.gateway === "Oma"
1696
- );
1697
- if (i === -1)
1698
- return c();
1699
- o.value = i;
1700
- const u = p.at(i);
1701
- u.gateway === "Oma" && u.config && (n.value = {
1702
- receiptName: u.receiptName ?? "",
1703
- cardTypes: ((m = u.dialogConfig) == null ? void 0 : m.cardTypes) ?? []
1704
- });
1705
- };
1706
- ne(t, s), ie(s);
1707
- async function v(p) {
1708
- var i;
1709
- (i = t.value.ecrIntegrations) == null || i.splice(p, 1), a.onUpdate(t.value);
1710
- }
1711
- async function f() {
1712
- n.value.cardTypes.push(r.value), r.value = "";
1713
- }
1714
- return (p, i) => {
1715
- const u = h("FmTextField"), m = h("FmButton"), g = h("FmChip"), k = h("FmForm");
1716
- return y(), F(k, {
1717
- ref: l.value,
1718
- class: "flex flex-col gap-16 w-[500px]",
1719
- onValidationSuccess: i[2] || (i[2] = () => {
1720
- var d, C;
1721
- o.value > -1 ? t.value.ecrIntegrations[o.value] = {
1722
- gateway: "Oma",
1723
- config: {},
1724
- receiptName: n.value.receiptName,
1725
- dialogConfig: {
1726
- ...(C = (d = t.value.ecrIntegrations) == null ? void 0 : d[o.value]) == null ? void 0 : C.dialogConfig,
1727
- cardTypes: n.value.cardTypes
1728
- }
1729
- } : (t.value.ecrIntegrations || (t.value.ecrIntegrations = []), t.value.ecrIntegrations.push({
1730
- gateway: "Oma",
1731
- config: {},
1732
- receiptName: n.value.receiptName,
1733
- dialogConfig: {
1734
- cardTypes: n.value.cardTypes
1735
- }
1736
- })), a.onUpdate(t.value);
1737
- })
1738
- }, {
1739
- default: ae(() => [
1740
- b(u, {
1741
- modelValue: n.value.receiptName,
1742
- "onUpdate:modelValue": i[0] || (i[0] = (d) => n.value.receiptName = d),
1743
- label: "Receipt Payment Name",
1744
- "label-info": "Default receipt display will be 'TERMINAL_OMA'"
1745
- }, null, 8, ["modelValue"]),
1746
- x("div", Xn, [
1747
- b(u, {
1748
- modelValue: r.value,
1749
- "onUpdate:modelValue": i[1] || (i[1] = (d) => r.value = d),
1750
- label: "Fallback Card Types",
1751
- "label-info": "List of cards when fallback to reconcile dialog. Default VISA, MASTER"
1752
- }, null, 8, ["modelValue"]),
1753
- b(m, {
1754
- class: "ml-4",
1755
- icon: "add",
1756
- onClick: f
1757
- })
1758
- ]),
1759
- x("div", Wn, [
1760
- (y(!0), E(re, null, ge(n.value.cardTypes, (d) => (y(), F(g, {
1761
- key: d,
1762
- label: d,
1763
- removable: !0,
1764
- onChipClosed: () => n.value.cardTypes.splice(n.value.cardTypes.indexOf(d), 1)
1765
- }, null, 8, ["label", "onChipClosed"]))), 128))
1766
- ]),
1767
- x("div", zn, [
1768
- o.value > -1 ? (y(), F(m, {
1769
- key: 0,
1770
- class: "flex-1",
1771
- variant: "secondary",
1772
- label: "Delete",
1773
- onclick: () => v(o.value)
1774
- }, null, 8, ["onclick"])) : R("", !0),
1775
- b(m, {
1776
- type: "submit",
1777
- class: "flex-1",
1778
- variant: "primary",
1779
- label: "Save"
1780
- })
1781
- ])
1782
- ]),
1783
- _: 1
1784
- }, 512);
1785
- };
1786
- }
1787
- }), Jn = { class: "flex items-end" }, Zn = { class: "flex flex-wrap gap-8 items-center mt-4" }, el = { class: "flex mt-6 space-x-6" }, tl = /* @__PURE__ */ X({
1788
- __name: "RevenueGateway",
1789
- props: {
1790
- terminal: {
1791
- type: Object,
1792
- required: !0
1793
- },
1794
- onUpdate: {
1795
- type: Function,
1796
- required: !0
1797
- }
1798
- },
1799
- setup(e) {
1800
- const a = e, t = ue(() => a.terminal), l = T(), o = T(-1), r = T(), n = T({
1801
- receiptName: "",
1802
- ip: "",
1803
- cardTypes: []
1804
- }), c = () => {
1805
- n.value.receiptName = "", n.value.ip = "", n.value.cardTypes = [], o.value = -1;
1806
- }, s = () => {
1807
- var m;
1808
- if (!t.value.ecrIntegrations)
1809
- return c();
1810
- const p = t.value.ecrIntegrations, i = p.findIndex(
1811
- (g) => g && g.gateway && g.gateway === "Revenue"
1812
- );
1813
- if (i === -1)
1814
- return c();
1815
- o.value = i;
1816
- const u = p.at(i);
1817
- u.gateway === "Revenue" && u.config && (n.value = {
1818
- receiptName: u.receiptName ?? "",
1819
- ip: u.config.ip ?? "",
1820
- cardTypes: ((m = u.dialogConfig) == null ? void 0 : m.cardTypes) ?? []
1821
- });
1822
- };
1823
- ne(t, s), ie(s);
1824
- async function v(p) {
1825
- var i;
1826
- (i = t.value.ecrIntegrations) == null || i.splice(p, 1), a.onUpdate(t.value);
1827
- }
1828
- async function f() {
1829
- n.value.cardTypes.push(r.value), r.value = "";
1830
- }
1831
- return (p, i) => {
1832
- const u = h("FmTextField"), m = h("FmButton"), g = h("FmChip"), k = h("FmForm");
1833
- return y(), F(k, {
1834
- ref: l.value,
1835
- class: "flex flex-col gap-16 w-[500px]",
1836
- onValidationSuccess: i[3] || (i[3] = () => {
1837
- var C, B;
1838
- const d = {
1839
- type: "tcp",
1840
- ip: n.value.ip
1841
- };
1842
- o.value > -1 ? t.value.ecrIntegrations[o.value] = {
1843
- gateway: "Revenue",
1844
- config: d,
1845
- receiptName: n.value.receiptName,
1846
- dialogConfig: {
1847
- ...(B = (C = t.value.ecrIntegrations) == null ? void 0 : C[o.value]) == null ? void 0 : B.dialogConfig,
1848
- cardTypes: n.value.cardTypes
1849
- }
1850
- } : (t.value.ecrIntegrations || (t.value.ecrIntegrations = []), t.value.ecrIntegrations.push({
1851
- gateway: "Revenue",
1852
- config: d,
1853
- receiptName: n.value.receiptName,
1854
- dialogConfig: {
1855
- cardTypes: n.value.cardTypes
1856
- }
1857
- })), a.onUpdate(t.value);
1858
- })
1859
- }, {
1860
- default: ae(() => [
1861
- b(u, {
1862
- modelValue: n.value.ip,
1863
- "onUpdate:modelValue": i[0] || (i[0] = (d) => n.value.ip = d),
1864
- label: "Terminal IP Address",
1865
- "label-info": "Terminal WiFi IP with optional port, e.g. 192.168.1.50:8080 (defaults to port 8080)",
1866
- rules: A(Tt)(A(It).string().min(1))
1867
- }, null, 8, ["modelValue", "rules"]),
1868
- b(u, {
1869
- modelValue: n.value.receiptName,
1870
- "onUpdate:modelValue": i[1] || (i[1] = (d) => n.value.receiptName = d),
1871
- label: "Receipt Payment Name",
1872
- "label-info": "Default receipt display will be 'TERMINAL_REVENUE'"
1873
- }, null, 8, ["modelValue"]),
1874
- x("div", Jn, [
1875
- b(u, {
1876
- modelValue: r.value,
1877
- "onUpdate:modelValue": i[2] || (i[2] = (d) => r.value = d),
1878
- label: "Fallback Card Types",
1879
- "label-info": "List of cards when fallback to reconcile dialog. Default VISA, MASTER"
1880
- }, null, 8, ["modelValue"]),
1881
- b(m, {
1882
- class: "ml-4",
1883
- icon: "add",
1884
- onClick: f
1885
- })
1886
- ]),
1887
- x("div", Zn, [
1888
- (y(!0), E(re, null, ge(n.value.cardTypes, (d) => (y(), F(g, {
1889
- key: d,
1890
- label: d,
1891
- removable: !0,
1892
- onChipClosed: () => n.value.cardTypes.splice(n.value.cardTypes.indexOf(d), 1)
1893
- }, null, 8, ["label", "onChipClosed"]))), 128))
1894
- ]),
1895
- x("div", el, [
1896
- o.value > -1 ? (y(), F(m, {
1897
- key: 0,
1898
- class: "flex-1",
1899
- variant: "secondary",
1900
- label: "Delete",
1901
- onclick: () => v(o.value)
1902
- }, null, 8, ["onclick"])) : R("", !0),
1903
- b(m, {
1904
- type: "submit",
1905
- class: "flex-1",
1906
- variant: "primary",
1907
- label: "Save"
1908
- })
1909
- ])
1910
- ]),
1911
- _: 1
1912
- }, 512);
1913
- };
1914
- }
1915
- }), al = {
1916
- key: 0,
1917
- class: "flex items-center justify-center min-h-[80vh]"
1918
- }, nl = { class: "flex mt-6 space-x-6" }, ll = /* @__PURE__ */ X({
1919
- __name: "BeamGateway",
1920
- props: {
1921
- terminal: {
1922
- type: Object,
1923
- required: !0
1924
- },
1925
- onUpdate: {
1926
- type: Function,
1927
- required: !0
1928
- }
1929
- },
1930
- setup(e) {
1931
- const { isLoading: a, startAsyncCall: t } = je(), l = e, o = ue(() => l.terminal), r = T(), n = T(), c = T(-1), s = T({
1932
- externalTerminalId: ""
1933
- }), v = () => {
1934
- s.value.externalTerminalId = "", c.value = -1;
1935
- }, f = () => {
1936
- if (t(async () => {
1937
- r.value = await da.getRestaurantExternalTerminals(
1938
- l.terminal.referenceId,
1939
- "BEAM"
1940
- );
1941
- }), !l.terminal.ecrs)
1942
- return v();
1943
- const u = l.terminal.ecrs.findIndex((g) => g && g.gateway && g.gateway === "Beam");
1944
- if (u === -1)
1945
- return v();
1946
- c.value = u;
1947
- const m = l.terminal.ecrs.at(u);
1948
- m.gateway === "Beam" && m.config && (s.value = {
1949
- externalTerminalId: m.config.externalTerminalId
1950
- });
1951
- };
1952
- ne(o, f), ie(f);
1953
- const p = K(() => (r.value ?? []).map((u) => ({
1954
- label: u.status === "READY" ? u.name : `${u.name} (unpaired)`,
1955
- value: u._id
1956
- })));
1957
- async function i(u) {
1958
- var m;
1959
- (m = l.terminal.ecrs) == null || m.splice(u, 1), l.onUpdate(l.terminal);
1960
- }
1961
- return (u, m) => {
1962
- const g = h("FmCircularProgress"), k = h("FmSelect"), d = h("FmButton"), C = h("FmForm");
1963
- return A(a) ? (y(), E("div", al, [
1964
- b(g, { size: "xxl" })
1965
- ])) : (y(), F(C, {
1966
- key: 1,
1967
- ref: n.value,
1968
- class: "flex flex-col gap-16 w-[500px]",
1969
- onValidationSuccess: m[1] || (m[1] = () => {
1970
- c.value > -1 ? o.value.ecrs[c.value] = { gateway: "Beam", config: s.value } : (o.value.ecrs || (o.value.ecrs = []), o.value.ecrs.push({ gateway: "Beam", config: s.value })), l.onUpdate(o.value);
1971
- })
1972
- }, {
1973
- default: ae(() => [
1974
- b(k, {
1975
- modelValue: s.value.externalTerminalId,
1976
- "onUpdate:modelValue": m[0] || (m[0] = (B) => s.value.externalTerminalId = B),
1977
- label: "External Terminal",
1978
- items: p.value,
1979
- rules: A(Tt)(A(It).string().min(1, "External terminal is required"))
1980
- }, null, 8, ["modelValue", "items", "rules"]),
1981
- x("div", nl, [
1982
- c.value > -1 ? (y(), F(d, {
1983
- key: 0,
1984
- class: "flex-1",
1985
- variant: "secondary",
1986
- label: "Delete",
1987
- onclick: () => i(c.value)
1988
- }, null, 8, ["onclick"])) : R("", !0),
1989
- b(d, {
1990
- type: "submit",
1991
- class: "flex-1",
1992
- variant: "primary",
1993
- label: "Save"
1994
- })
1995
- ])
1996
- ]),
1997
- _: 1
1998
- }, 512));
1999
- };
2000
- }
2001
- }), ol = {
2002
- key: 0,
2003
- class: "flex items-center justify-center min-h-[80vh]"
2004
- }, rl = { class: "flex mt-6 space-x-6" }, il = /* @__PURE__ */ X({
2005
- __name: "BriGateway",
2006
- props: {
2007
- terminal: {
2008
- type: Object,
2009
- required: !0
2010
- },
2011
- onUpdate: {
2012
- type: Function,
2013
- required: !0
2014
- }
2015
- },
2016
- setup(e) {
2017
- const { isLoading: a, startAsyncCall: t } = je(), l = e, o = ue(() => l.terminal), r = T(), n = T(), c = T(-1), s = T({
2018
- externalTerminalId: ""
2019
- }), v = () => {
2020
- s.value.externalTerminalId = "", c.value = -1;
2021
- }, f = () => {
2022
- if (t(async () => {
2023
- r.value = await da.getRestaurantExternalTerminals(
2024
- l.terminal.referenceId,
2025
- "BRI"
2026
- );
2027
- }), !l.terminal.ecrs)
2028
- return v();
2029
- const m = l.terminal.ecrs.findIndex((k) => k && k.gateway && k.gateway === "Bri");
2030
- if (m === -1)
2031
- return v();
2032
- c.value = m;
2033
- const g = l.terminal.ecrs.at(m);
2034
- g.gateway === "Bri" && g.config && (s.value = {
2035
- externalTerminalId: g.config.externalTerminalId
2036
- });
2037
- };
2038
- ne(o, f), ie(f);
2039
- const p = K(() => (r.value ?? []).filter((m) => m.status === "READY").map((m) => ({ label: m.name, value: m._id }))), i = K(() => {
2040
- if (p.value.length === 0)
2041
- return "Please pair one BRI terminal under External Terminals before applying here.";
2042
- });
2043
- async function u(m) {
2044
- var g;
2045
- (g = l.terminal.ecrs) == null || g.splice(m, 1), l.onUpdate(l.terminal);
2046
- }
2047
- return (m, g) => {
2048
- const k = h("FmCircularProgress"), d = h("FmSelect"), C = h("FmButton"), B = h("FmForm");
2049
- return A(a) ? (y(), E("div", ol, [
2050
- b(k, { size: "xxl" })
2051
- ])) : (y(), F(B, {
2052
- key: 1,
2053
- ref: n.value,
2054
- class: "flex flex-col gap-16 w-[500px]",
2055
- onValidationSuccess: g[1] || (g[1] = () => {
2056
- c.value > -1 ? o.value.ecrs[c.value] = { gateway: "Bri", config: s.value } : (o.value.ecrs || (o.value.ecrs = []), o.value.ecrs.push({ gateway: "Bri", config: s.value })), l.onUpdate(o.value);
2057
- })
2058
- }, {
2059
- default: ae(() => [
2060
- b(d, {
2061
- modelValue: s.value.externalTerminalId,
2062
- "onUpdate:modelValue": g[0] || (g[0] = (M) => s.value.externalTerminalId = M),
2063
- label: "External Terminal",
2064
- items: p.value,
2065
- "helper-text": i.value,
2066
- rules: A(Tt)(A(It).string().min(1, "External terminal is required"))
2067
- }, null, 8, ["modelValue", "items", "helper-text", "rules"]),
2068
- x("div", rl, [
2069
- c.value > -1 ? (y(), F(C, {
2070
- key: 0,
2071
- class: "flex-1",
2072
- variant: "secondary",
2073
- label: "Delete",
2074
- onclick: () => u(c.value)
2075
- }, null, 8, ["onclick"])) : R("", !0),
2076
- b(C, {
2077
- type: "submit",
2078
- class: "flex-1",
2079
- variant: "primary",
2080
- label: "Save"
2081
- })
2082
- ])
2083
- ]),
2084
- _: 1
2085
- }, 512));
2086
- };
2087
- }
2088
- }), sl = { class: "flex items-end" }, ul = { class: "flex flex-wrap gap-8 items-center mt-4" }, cl = { class: "flex mt-6 space-x-6" }, dl = /* @__PURE__ */ X({
2089
- __name: "PbbGateway",
2090
- props: {
2091
- terminal: {
2092
- type: Object,
2093
- required: !0
2094
- },
2095
- onUpdate: {
2096
- type: Function,
2097
- required: !0
2098
- }
2099
- },
2100
- setup(e) {
2101
- const a = e, t = ue(() => a.terminal), l = T(), o = T(-1), r = T(), n = T({
2102
- ip: "",
2103
- receiptName: "",
2104
- cardTypes: []
2105
- }), c = () => {
2106
- n.value.ip = "", n.value.receiptName = "", n.value.cardTypes = [], o.value = -1;
2107
- }, s = () => {
2108
- var m;
2109
- if (!t.value.ecrIntegrations)
2110
- return c();
2111
- const p = t.value.ecrIntegrations, i = p.findIndex((g) => g && g.gateway && g.gateway === "Pbb");
2112
- if (i === -1)
2113
- return c();
2114
- o.value = i;
2115
- const u = p.at(i);
2116
- u.gateway === "Pbb" && u.config && (n.value = {
2117
- ip: u.config.ip ?? "",
2118
- receiptName: u.receiptName ?? "",
2119
- cardTypes: ((m = u.dialogConfig) == null ? void 0 : m.cardTypes) ?? []
2120
- });
2121
- };
2122
- ne(t, s), ie(s);
2123
- async function v(p) {
2124
- var i;
2125
- (i = t.value.ecrIntegrations) == null || i.splice(p, 1), a.onUpdate(t.value);
2126
- }
2127
- async function f() {
2128
- n.value.cardTypes.push(r.value), r.value = "";
2129
- }
2130
- return (p, i) => {
2131
- const u = h("FmTextField"), m = h("FmButton"), g = h("FmChip"), k = h("FmForm");
2132
- return y(), F(k, {
2133
- ref: l.value,
2134
- class: "flex flex-col gap-16 w-[500px]",
2135
- onValidationSuccess: i[3] || (i[3] = () => {
2136
- var d, C;
2137
- o.value > -1 ? t.value.ecrIntegrations[o.value] = {
2138
- gateway: "Pbb",
2139
- config: { ip: n.value.ip },
2140
- receiptName: n.value.receiptName,
2141
- dialogConfig: {
2142
- ...(C = (d = t.value.ecrIntegrations) == null ? void 0 : d[o.value]) == null ? void 0 : C.dialogConfig,
2143
- cardTypes: n.value.cardTypes
2144
- }
2145
- } : (t.value.ecrIntegrations || (t.value.ecrIntegrations = []), t.value.ecrIntegrations.push({
2146
- gateway: "Pbb",
2147
- config: { ip: n.value.ip },
2148
- receiptName: n.value.receiptName,
2149
- dialogConfig: {
2150
- cardTypes: n.value.cardTypes
2151
- }
2152
- })), a.onUpdate(t.value);
2153
- })
2154
- }, {
2155
- default: ae(() => [
2156
- b(u, {
2157
- modelValue: n.value.ip,
2158
- "onUpdate:modelValue": i[0] || (i[0] = (d) => n.value.ip = d),
2159
- label: "IP Address"
2160
- }, null, 8, ["modelValue"]),
2161
- b(u, {
2162
- modelValue: n.value.receiptName,
2163
- "onUpdate:modelValue": i[1] || (i[1] = (d) => n.value.receiptName = d),
2164
- label: "Receipt Payment Name",
2165
- "label-info": "Default receipt display will be 'TERMINAL_PBB'"
2166
- }, null, 8, ["modelValue"]),
2167
- x("div", sl, [
2168
- b(u, {
2169
- modelValue: r.value,
2170
- "onUpdate:modelValue": i[2] || (i[2] = (d) => r.value = d),
2171
- label: "Fallback Card Types",
2172
- "label-info": "List of cards when fallback to reconcile dialog. Default VISA, MASTER"
2173
- }, null, 8, ["modelValue"]),
2174
- b(m, {
2175
- class: "ml-4",
2176
- icon: "add",
2177
- onClick: f
2178
- })
2179
- ]),
2180
- x("div", ul, [
2181
- (y(!0), E(re, null, ge(n.value.cardTypes, (d) => (y(), F(g, {
2182
- key: d,
2183
- label: d,
2184
- removable: !0,
2185
- onChipClosed: () => n.value.cardTypes.splice(n.value.cardTypes.indexOf(d), 1)
2186
- }, null, 8, ["label", "onChipClosed"]))), 128))
2187
- ]),
2188
- x("div", cl, [
2189
- o.value > -1 ? (y(), F(m, {
2190
- key: 0,
2191
- class: "flex-1",
2192
- variant: "secondary",
2193
- label: "Delete",
2194
- onclick: () => v(o.value)
2195
- }, null, 8, ["onclick"])) : R("", !0),
2196
- b(m, {
2197
- type: "submit",
2198
- class: "flex-1",
2199
- variant: "primary",
2200
- label: "Save"
2201
- })
2202
- ])
2203
- ]),
2204
- _: 1
2205
- }, 512);
2206
- };
2207
- }
2208
- }), pl = { class: "flex items-center" }, ml = { class: "w-[260px] self-start" }, fl = { class: "flex-1" }, vl = /* @__PURE__ */ X({
2209
- __name: "EcrGateway",
2210
- props: {
2211
- terminal: {
2212
- type: Object,
2213
- required: !0
2214
- },
2215
- onUpdate: {
2216
- type: Function,
2217
- required: !0
2218
- }
2219
- },
2220
- setup(e) {
2221
- var c;
2222
- const a = e, t = [
2223
- {
2224
- label: "FeedMe Terminal",
2225
- value: "terminal",
2226
- render: dn
2227
- },
2228
- {
2229
- label: "GHL Terminal",
2230
- value: "ghl",
2231
- render: mn,
2232
- region: [Q.F_COUNTRY.enum.MY]
2233
- },
2234
- {
2235
- label: "GHL2 Terminal",
2236
- value: "ghl2",
2237
- render: Un,
2238
- region: [Q.F_COUNTRY.enum.MY]
2239
- },
2240
- {
2241
- label: "ITB Maybank Terminal",
2242
- value: "mb-itb",
2243
- render: yn,
2244
- region: [Q.F_COUNTRY.enum.MY]
2245
- },
2246
- {
2247
- label: "PMA Maybank Terminal",
2248
- value: "mb-pma",
2249
- render: wn,
2250
- region: [Q.F_COUNTRY.enum.MY]
2251
- },
2252
- {
2253
- label: "Paysys Maybank Terminal",
2254
- value: "mb-paysys",
2255
- render: Cn,
2256
- region: [Q.F_COUNTRY.enum.MY]
2257
- },
2258
- {
2259
- label: "Nets Terminal",
2260
- value: "nets",
2261
- render: Nn,
2262
- region: [Q.F_COUNTRY.enum.SG]
2263
- },
2264
- {
2265
- label: "KBank Terminal",
2266
- value: "kbank",
2267
- render: On,
2268
- region: [Q.F_COUNTRY.enum.TH]
2269
- },
2270
- {
2271
- label: "GHL Terminal",
2272
- value: "ghl3",
2273
- render: Bn,
2274
- region: [Q.F_COUNTRY.enum.TH]
2275
- },
2276
- {
2277
- label: "Paysys HLBB Terminal",
2278
- value: "hlbb",
2279
- render: Ln,
2280
- region: [Q.F_COUNTRY.enum.MY]
2281
- },
2282
- {
2283
- label: "GPAP Terminal",
2284
- value: "globalpayments",
2285
- render: Kn,
2286
- region: [Q.F_COUNTRY.enum.SG]
2287
- },
2288
- {
2289
- label: "OMA Terminal",
2290
- value: "oma",
2291
- render: Qn,
2292
- region: [Q.F_COUNTRY.enum.PK]
2293
- },
2294
- {
2295
- label: "Revenue PBB Terminal",
2296
- value: "revenue",
2297
- render: tl,
2298
- region: [Q.F_COUNTRY.enum.MY]
2299
- },
2300
- {
2301
- label: "PBB Terminal",
2302
- value: "pbb",
2303
- render: dl,
2304
- region: [Q.F_COUNTRY.enum.MY]
2305
- },
2306
- {
2307
- label: "Beam Terminal",
2308
- value: "beam",
2309
- render: ll,
2310
- region: [Q.F_COUNTRY.enum.TH]
2311
- },
2312
- {
2313
- label: "BRI Terminal",
2314
- value: "bri",
2315
- render: il,
2316
- region: [Q.F_COUNTRY.enum.ID]
2317
- }
2318
- ], l = K(() => t.find((s) => s.value === n.value)), o = xt().currentCountry, r = K(() => t.filter(
2319
- (s) => !s.region || s.region.includes(o.value ?? Q.F_COUNTRY.enum.MY)
2320
- )), { gatewayTab: n } = wt({
2321
- gatewayTab: (c = r.value[0]) == null ? void 0 : c.value
2322
- });
2323
- return (s, v) => {
2324
- var p;
2325
- const f = h("FmTabs");
2326
- return y(), E("div", pl, [
2327
- x("div", ml, [
2328
- b(f, {
2329
- "model-value": A(n),
2330
- "onUpdate:modelValue": v[0] || (v[0] = (i) => Ae(n) ? n.value = i : null),
2331
- class: "mb-6",
2332
- vertical: !0,
2333
- items: r.value,
2334
- "show-more-at": Number.POSITIVE_INFINITY
2335
- }, null, 8, ["model-value", "items", "show-more-at"])
2336
- ]),
2337
- x("div", fl, [
2338
- A(n) ? (y(), F(bt((p = l.value) == null ? void 0 : p.render), ht(_t({ key: 0 }, {
2339
- terminal: a.terminal,
2340
- onUpdate: a.onUpdate
2341
- })), null, 16)) : R("", !0)
2342
- ])
2343
- ]);
2344
- };
2345
- }
2346
- }), gl = { class: "flex mt-6 space-x-6" }, yl = /* @__PURE__ */ X({
2347
- __name: "PromptPayGateway",
2348
- props: {
2349
- terminal: {
2350
- type: Object,
2351
- required: !0
2352
- },
2353
- onUpdate: {
2354
- type: Function,
2355
- required: !0
2356
- }
2357
- },
2358
- setup(e) {
2359
- const a = e, t = ue(() => a.terminal), l = T(), o = T(-1), r = T({
2360
- account: "",
2361
- receiptName: ""
2362
- }), n = () => {
2363
- r.value.account = "", r.value.receiptName = "", o.value = -1;
2364
- }, c = () => {
2365
- if (!t.value.qrIntegrations)
2366
- return n();
2367
- const v = t.value.qrIntegrations, f = v.findIndex((i) => i && i.gateway && i.gateway === "PROMPTPAY");
2368
- if (f === -1)
2369
- return n();
2370
- o.value = f;
2371
- const p = v.at(f);
2372
- p.gateway === "PROMPTPAY" && p.config && (r.value = {
2373
- account: p.config.account ?? "",
2374
- receiptName: p.receiptName ?? ""
2375
- });
2376
- };
2377
- ne(t, c), ie(c);
2378
- async function s(v) {
2379
- var f;
2380
- (f = t.value.qrIntegrations) == null || f.splice(v, 1), a.onUpdate(t.value);
2381
- }
2382
- return (v, f) => {
2383
- const p = h("FmTextField"), i = h("FmButton"), u = h("FmForm");
2384
- return y(), F(u, {
2385
- ref: l.value,
2386
- class: "flex flex-col gap-16 w-[500px]",
2387
- onValidationSuccess: f[2] || (f[2] = () => {
2388
- o.value > -1 ? t.value.qrIntegrations[o.value] = { gateway: "PROMPTPAY", config: { account: r.value.account }, receiptName: r.value.receiptName } : (t.value.qrIntegrations || (t.value.qrIntegrations = []), t.value.qrIntegrations.push({ gateway: "PROMPTPAY", config: { account: r.value.account }, receiptName: r.value.receiptName })), a.onUpdate(t.value);
2389
- })
2390
- }, {
2391
- default: ae(() => [
2392
- b(p, {
2393
- modelValue: r.value.account,
2394
- "onUpdate:modelValue": f[0] || (f[0] = (m) => r.value.account = m),
2395
- label: "Thai Phone Number / Thai Naitonal ID",
2396
- "label-info": "Thai Phone Number can be prefixed with 66 or 0 will be fine both will works well."
2397
- }, null, 8, ["modelValue"]),
2398
- b(p, {
2399
- modelValue: r.value.receiptName,
2400
- "onUpdate:modelValue": f[1] || (f[1] = (m) => r.value.receiptName = m),
2401
- label: "Receipt Payment Name",
2402
- "label-info": "Default receipt display will be 'TERMINAL_MAYBANK'"
2403
- }, null, 8, ["modelValue"]),
2404
- x("div", gl, [
2405
- o.value > -1 ? (y(), F(i, {
2406
- key: 0,
2407
- class: "flex-1",
2408
- variant: "secondary",
2409
- label: "Delete",
2410
- onclick: () => s(o.value)
2411
- }, null, 8, ["onclick"])) : R("", !0),
2412
- b(i, {
2413
- type: "submit",
2414
- class: "flex-1",
2415
- variant: "primary",
2416
- label: "Save"
2417
- })
2418
- ])
2419
- ]),
2420
- _: 1
2421
- }, 512);
2422
- };
2423
- }
2424
- }), bl = { class: "flex items-center" }, hl = { class: "w-[260px] self-start" }, _l = { class: "flex-1" }, wl = /* @__PURE__ */ X({
2425
- __name: "QrGateway",
2426
- props: {
2427
- terminal: {
2428
- type: Object,
2429
- required: !0
2430
- },
2431
- onUpdate: {
2432
- type: Function,
2433
- required: !0
2434
- }
2435
- },
2436
- setup(e) {
2437
- var c;
2438
- const a = e, t = [
2439
- {
2440
- label: "PromptPay",
2441
- value: "promptpay",
2442
- render: yl,
2443
- region: [Q.F_COUNTRY.enum.TH]
2444
- }
2445
- ], l = K(() => t.find((s) => s.value === n.value)), o = xt().currentCountry, r = K(() => t.filter((s) => !s.region || s.region.includes(o.value ?? Q.F_COUNTRY.enum.MY))), { gatewayTab: n } = wt({
2446
- gatewayTab: (c = r.value[0]) == null ? void 0 : c.value
2447
- });
2448
- return (s, v) => {
2449
- var p;
2450
- const f = h("FmTabs");
2451
- return y(), E("div", bl, [
2452
- x("div", hl, [
2453
- b(f, {
2454
- "model-value": A(n),
2455
- "onUpdate:modelValue": v[0] || (v[0] = (i) => Ae(n) ? n.value = i : null),
2456
- class: "mb-6",
2457
- vertical: !0,
2458
- items: r.value
2459
- }, null, 8, ["model-value", "items"])
2460
- ]),
2461
- x("div", _l, [
2462
- A(n) ? (y(), F(bt((p = l.value) == null ? void 0 : p.render), ht(_t({ key: 0 }, {
2463
- terminal: a.terminal,
2464
- onUpdate: a.onUpdate
2465
- })), null, 16)) : R("", !0)
2466
- ])
2467
- ]);
2468
- };
2469
- }
2470
- });
2471
- var xl = Object.defineProperty, pt = Object.getOwnPropertySymbols, pa = Object.prototype.hasOwnProperty, ma = Object.prototype.propertyIsEnumerable, Kt = (e, a, t) => a in e ? xl(e, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[a] = t, Ge = (e, a) => {
2472
- for (var t in a || (a = {}))
2473
- pa.call(a, t) && Kt(e, t, a[t]);
2474
- if (pt)
2475
- for (var t of pt(a))
2476
- ma.call(a, t) && Kt(e, t, a[t]);
2477
- return e;
2478
- }, fa = (e, a) => {
2479
- var t = {};
2480
- for (var l in e)
2481
- pa.call(e, l) && a.indexOf(l) < 0 && (t[l] = e[l]);
2482
- if (e != null && pt)
2483
- for (var l of pt(e))
2484
- a.indexOf(l) < 0 && ma.call(e, l) && (t[l] = e[l]);
2485
- return t;
2486
- };
2487
- const va = "[vue-draggable-plus]: ";
2488
- function Tl(e) {
2489
- console.warn(va + e);
2490
- }
2491
- function Il(e) {
2492
- console.error(va + e);
2493
- }
2494
- function Xt(e, a, t) {
2495
- return t >= 0 && t < e.length && e.splice(t, 0, e.splice(a, 1)[0]), e;
2496
- }
2497
- function Cl(e) {
2498
- return e.replace(/-(\w)/g, (a, t) => t ? t.toUpperCase() : "");
2499
- }
2500
- function Fl(e) {
2501
- return Object.keys(e).reduce((a, t) => (typeof e[t] < "u" && (a[Cl(t)] = e[t]), a), {});
2502
- }
2503
- function Wt(e, a) {
2504
- return Array.isArray(e) && e.splice(a, 1), e;
2505
- }
2506
- function zt(e, a, t) {
2507
- return Array.isArray(e) && e.splice(a, 0, t), e;
2508
- }
2509
- function Sl(e) {
2510
- return typeof e > "u";
2511
- }
2512
- function kl(e) {
2513
- return typeof e == "string";
2514
- }
2515
- function Qt(e, a, t) {
2516
- const l = e.children[t];
2517
- e.insertBefore(a, l);
2518
- }
2519
- function Ft(e) {
2520
- e.parentNode && e.parentNode.removeChild(e);
2521
- }
2522
- function Nl(e, a = document) {
2523
- var t;
2524
- let l = null;
2525
- return typeof (a == null ? void 0 : a.querySelector) == "function" ? l = (t = a == null ? void 0 : a.querySelector) == null ? void 0 : t.call(a, e) : l = document.querySelector(e), l || Tl(`Element not found: ${e}`), l;
2526
- }
2527
- function Vl(e, a, t = null) {
2528
- return function(...l) {
2529
- return e.apply(t, l), a.apply(t, l);
2530
- };
2531
- }
2532
- function El(e, a) {
2533
- const t = Ge({}, e);
2534
- return Object.keys(a).forEach((l) => {
2535
- t[l] ? t[l] = Vl(e[l], a[l]) : t[l] = a[l];
2536
- }), t;
2537
- }
2538
- function Dl(e) {
2539
- return e instanceof HTMLElement;
2540
- }
2541
- function Jt(e, a) {
2542
- Object.keys(e).forEach((t) => {
2543
- a(t, e[t]);
2544
- });
2545
- }
2546
- function Ol(e) {
2547
- return e.charCodeAt(0) === 111 && e.charCodeAt(1) === 110 && (e.charCodeAt(2) > 122 || e.charCodeAt(2) < 97);
2548
- }
2549
- const Pl = Object.assign;
2550
- /**!
2551
- * Sortable 1.15.2
2552
- * @author RubaXa <trash@rubaxa.org>
2553
- * @author owenm <owen23355@gmail.com>
2554
- * @license MIT
2555
- */
2556
- function Zt(e, a) {
2557
- var t = Object.keys(e);
2558
- if (Object.getOwnPropertySymbols) {
2559
- var l = Object.getOwnPropertySymbols(e);
2560
- a && (l = l.filter(function(o) {
2561
- return Object.getOwnPropertyDescriptor(e, o).enumerable;
2562
- })), t.push.apply(t, l);
2563
- }
2564
- return t;
2565
- }
2566
- function Ce(e) {
2567
- for (var a = 1; a < arguments.length; a++) {
2568
- var t = arguments[a] != null ? arguments[a] : {};
2569
- a % 2 ? Zt(Object(t), !0).forEach(function(l) {
2570
- Ul(e, l, t[l]);
2571
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : Zt(Object(t)).forEach(function(l) {
2572
- Object.defineProperty(e, l, Object.getOwnPropertyDescriptor(t, l));
2573
- });
2574
- }
2575
- return e;
2576
- }
2577
- function it(e) {
2578
- "@babel/helpers - typeof";
2579
- return typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? it = function(a) {
2580
- return typeof a;
2581
- } : it = function(a) {
2582
- return a && typeof Symbol == "function" && a.constructor === Symbol && a !== Symbol.prototype ? "symbol" : typeof a;
2583
- }, it(e);
2584
- }
2585
- function Ul(e, a, t) {
2586
- return a in e ? Object.defineProperty(e, a, {
2587
- value: t,
2588
- enumerable: !0,
2589
- configurable: !0,
2590
- writable: !0
2591
- }) : e[a] = t, e;
2592
- }
2593
- function Se() {
2594
- return Se = Object.assign || function(e) {
2595
- for (var a = 1; a < arguments.length; a++) {
2596
- var t = arguments[a];
2597
- for (var l in t)
2598
- Object.prototype.hasOwnProperty.call(t, l) && (e[l] = t[l]);
2599
- }
2600
- return e;
2601
- }, Se.apply(this, arguments);
2602
- }
2603
- function Al(e, a) {
2604
- if (e == null)
2605
- return {};
2606
- var t = {}, l = Object.keys(e), o, r;
2607
- for (r = 0; r < l.length; r++)
2608
- o = l[r], !(a.indexOf(o) >= 0) && (t[o] = e[o]);
2609
- return t;
2610
- }
2611
- function Ml(e, a) {
2612
- if (e == null)
2613
- return {};
2614
- var t = Al(e, a), l, o;
2615
- if (Object.getOwnPropertySymbols) {
2616
- var r = Object.getOwnPropertySymbols(e);
2617
- for (o = 0; o < r.length; o++)
2618
- l = r[o], !(a.indexOf(l) >= 0) && Object.prototype.propertyIsEnumerable.call(e, l) && (t[l] = e[l]);
2619
- }
2620
- return t;
2621
- }
2622
- var Rl = "1.15.2";
2623
- function Fe(e) {
2624
- if (typeof window < "u" && window.navigator)
2625
- return !!/* @__PURE__ */ navigator.userAgent.match(e);
2626
- }
2627
- var ke = Fe(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i), et = Fe(/Edge/i), ea = Fe(/firefox/i), We = Fe(/safari/i) && !Fe(/chrome/i) && !Fe(/android/i), ga = Fe(/iP(ad|od|hone)/i), ya = Fe(/chrome/i) && Fe(/android/i), ba = {
2628
- capture: !1,
2629
- passive: !1
2630
- };
2631
- function G(e, a, t) {
2632
- e.addEventListener(a, t, !ke && ba);
2633
- }
2634
- function q(e, a, t) {
2635
- e.removeEventListener(a, t, !ke && ba);
2636
- }
2637
- function mt(e, a) {
2638
- if (a) {
2639
- if (a[0] === ">" && (a = a.substring(1)), e)
2640
- try {
2641
- if (e.matches)
2642
- return e.matches(a);
2643
- if (e.msMatchesSelector)
2644
- return e.msMatchesSelector(a);
2645
- if (e.webkitMatchesSelector)
2646
- return e.webkitMatchesSelector(a);
2647
- } catch {
2648
- return !1;
2649
- }
2650
- return !1;
2651
- }
2652
- }
2653
- function Bl(e) {
2654
- return e.host && e !== document && e.host.nodeType ? e.host : e.parentNode;
2655
- }
2656
- function Te(e, a, t, l) {
2657
- if (e) {
2658
- t = t || document;
2659
- do {
2660
- if (a != null && (a[0] === ">" ? e.parentNode === t && mt(e, a) : mt(e, a)) || l && e === t)
2661
- return e;
2662
- if (e === t)
2663
- break;
2664
- } while (e = Bl(e));
2665
- }
2666
- return null;
2667
- }
2668
- var ta = /\s+/g;
2669
- function ye(e, a, t) {
2670
- if (e && a)
2671
- if (e.classList)
2672
- e.classList[t ? "add" : "remove"](a);
2673
- else {
2674
- var l = (" " + e.className + " ").replace(ta, " ").replace(" " + a + " ", " ");
2675
- e.className = (l + (t ? " " + a : "")).replace(ta, " ");
2676
- }
2677
- }
2678
- function D(e, a, t) {
2679
- var l = e && e.style;
2680
- if (l) {
2681
- if (t === void 0)
2682
- return document.defaultView && document.defaultView.getComputedStyle ? t = document.defaultView.getComputedStyle(e, "") : e.currentStyle && (t = e.currentStyle), a === void 0 ? t : t[a];
2683
- !(a in l) && a.indexOf("webkit") === -1 && (a = "-webkit-" + a), l[a] = t + (typeof t == "string" ? "" : "px");
2684
- }
2685
- }
2686
- function Le(e, a) {
2687
- var t = "";
2688
- if (typeof e == "string")
2689
- t = e;
2690
- else
2691
- do {
2692
- var l = D(e, "transform");
2693
- l && l !== "none" && (t = l + " " + t);
2694
- } while (!a && (e = e.parentNode));
2695
- var o = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix;
2696
- return o && new o(t);
2697
- }
2698
- function ha(e, a, t) {
2699
- if (e) {
2700
- var l = e.getElementsByTagName(a), o = 0, r = l.length;
2701
- if (t)
2702
- for (; o < r; o++)
2703
- t(l[o], o);
2704
- return l;
2705
- }
2706
- return [];
2707
- }
2708
- function Ie() {
2709
- var e = document.scrollingElement;
2710
- return e || document.documentElement;
2711
- }
2712
- function oe(e, a, t, l, o) {
2713
- if (!(!e.getBoundingClientRect && e !== window)) {
2714
- var r, n, c, s, v, f, p;
2715
- if (e !== window && e.parentNode && e !== Ie() ? (r = e.getBoundingClientRect(), n = r.top, c = r.left, s = r.bottom, v = r.right, f = r.height, p = r.width) : (n = 0, c = 0, s = window.innerHeight, v = window.innerWidth, f = window.innerHeight, p = window.innerWidth), (a || t) && e !== window && (o = o || e.parentNode, !ke))
2716
- do
2717
- if (o && o.getBoundingClientRect && (D(o, "transform") !== "none" || t && D(o, "position") !== "static")) {
2718
- var i = o.getBoundingClientRect();
2719
- n -= i.top + parseInt(D(o, "border-top-width")), c -= i.left + parseInt(D(o, "border-left-width")), s = n + r.height, v = c + r.width;
2720
- break;
2721
- }
2722
- while (o = o.parentNode);
2723
- if (l && e !== window) {
2724
- var u = Le(o || e), m = u && u.a, g = u && u.d;
2725
- u && (n /= g, c /= m, p /= m, f /= g, s = n + f, v = c + p);
2726
- }
2727
- return {
2728
- top: n,
2729
- left: c,
2730
- bottom: s,
2731
- right: v,
2732
- width: p,
2733
- height: f
2734
- };
2735
- }
2736
- }
2737
- function aa(e, a, t) {
2738
- for (var l = Ee(e, !0), o = oe(e)[a]; l; ) {
2739
- var r = oe(l)[t], n = void 0;
2740
- if (n = o >= r, !n)
2741
- return l;
2742
- if (l === Ie())
2743
- break;
2744
- l = Ee(l, !1);
2745
- }
2746
- return !1;
2747
- }
2748
- function Ye(e, a, t, l) {
2749
- for (var o = 0, r = 0, n = e.children; r < n.length; ) {
2750
- if (n[r].style.display !== "none" && n[r] !== O.ghost && (l || n[r] !== O.dragged) && Te(n[r], t.draggable, e, !1)) {
2751
- if (o === a)
2752
- return n[r];
2753
- o++;
2754
- }
2755
- r++;
2756
- }
2757
- return null;
2758
- }
2759
- function Lt(e, a) {
2760
- for (var t = e.lastElementChild; t && (t === O.ghost || D(t, "display") === "none" || a && !mt(t, a)); )
2761
- t = t.previousElementSibling;
2762
- return t || null;
2763
- }
2764
- function we(e, a) {
2765
- var t = 0;
2766
- if (!e || !e.parentNode)
2767
- return -1;
2768
- for (; e = e.previousElementSibling; )
2769
- e.nodeName.toUpperCase() !== "TEMPLATE" && e !== O.clone && (!a || mt(e, a)) && t++;
2770
- return t;
2771
- }
2772
- function na(e) {
2773
- var a = 0, t = 0, l = Ie();
2774
- if (e)
2775
- do {
2776
- var o = Le(e), r = o.a, n = o.d;
2777
- a += e.scrollLeft * r, t += e.scrollTop * n;
2778
- } while (e !== l && (e = e.parentNode));
2779
- return [a, t];
2780
- }
2781
- function ql(e, a) {
2782
- for (var t in e)
2783
- if (e.hasOwnProperty(t)) {
2784
- for (var l in a)
2785
- if (a.hasOwnProperty(l) && a[l] === e[t][l])
2786
- return Number(t);
2787
- }
2788
- return -1;
2789
- }
2790
- function Ee(e, a) {
2791
- if (!e || !e.getBoundingClientRect)
2792
- return Ie();
2793
- var t = e, l = !1;
2794
- do
2795
- if (t.clientWidth < t.scrollWidth || t.clientHeight < t.scrollHeight) {
2796
- var o = D(t);
2797
- if (t.clientWidth < t.scrollWidth && (o.overflowX == "auto" || o.overflowX == "scroll") || t.clientHeight < t.scrollHeight && (o.overflowY == "auto" || o.overflowY == "scroll")) {
2798
- if (!t.getBoundingClientRect || t === document.body)
2799
- return Ie();
2800
- if (l || a)
2801
- return t;
2802
- l = !0;
2803
- }
2804
- }
2805
- while (t = t.parentNode);
2806
- return Ie();
2807
- }
2808
- function Gl(e, a) {
2809
- if (e && a)
2810
- for (var t in a)
2811
- a.hasOwnProperty(t) && (e[t] = a[t]);
2812
- return e;
2813
- }
2814
- function St(e, a) {
2815
- return Math.round(e.top) === Math.round(a.top) && Math.round(e.left) === Math.round(a.left) && Math.round(e.height) === Math.round(a.height) && Math.round(e.width) === Math.round(a.width);
2816
- }
2817
- var ze;
2818
- function _a(e, a) {
2819
- return function() {
2820
- if (!ze) {
2821
- var t = arguments, l = this;
2822
- t.length === 1 ? e.call(l, t[0]) : e.apply(l, t), ze = setTimeout(function() {
2823
- ze = void 0;
2824
- }, a);
2825
- }
2826
- };
2827
- }
2828
- function $l() {
2829
- clearTimeout(ze), ze = void 0;
2830
- }
2831
- function wa(e, a, t) {
2832
- e.scrollLeft += a, e.scrollTop += t;
2833
- }
2834
- function xa(e) {
2835
- var a = window.Polymer, t = window.jQuery || window.Zepto;
2836
- return a && a.dom ? a.dom(e).cloneNode(!0) : t ? t(e).clone(!0)[0] : e.cloneNode(!0);
2837
- }
2838
- function Ta(e, a, t) {
2839
- var l = {};
2840
- return Array.from(e.children).forEach(function(o) {
2841
- var r, n, c, s;
2842
- if (!(!Te(o, a.draggable, e, !1) || o.animated || o === t)) {
2843
- var v = oe(o);
2844
- l.left = Math.min((r = l.left) !== null && r !== void 0 ? r : 1 / 0, v.left), l.top = Math.min((n = l.top) !== null && n !== void 0 ? n : 1 / 0, v.top), l.right = Math.max((c = l.right) !== null && c !== void 0 ? c : -1 / 0, v.right), l.bottom = Math.max((s = l.bottom) !== null && s !== void 0 ? s : -1 / 0, v.bottom);
2845
- }
2846
- }), l.width = l.right - l.left, l.height = l.bottom - l.top, l.x = l.left, l.y = l.top, l;
2847
- }
2848
- var he = "Sortable" + (/* @__PURE__ */ new Date()).getTime();
2849
- function Ll() {
2850
- var e = [], a;
2851
- return {
2852
- captureAnimationState: function() {
2853
- if (e = [], !!this.options.animation) {
2854
- var t = [].slice.call(this.el.children);
2855
- t.forEach(function(l) {
2856
- if (!(D(l, "display") === "none" || l === O.ghost)) {
2857
- e.push({
2858
- target: l,
2859
- rect: oe(l)
2860
- });
2861
- var o = Ce({}, e[e.length - 1].rect);
2862
- if (l.thisAnimationDuration) {
2863
- var r = Le(l, !0);
2864
- r && (o.top -= r.f, o.left -= r.e);
2865
- }
2866
- l.fromRect = o;
2867
- }
2868
- });
2869
- }
2870
- },
2871
- addAnimationState: function(t) {
2872
- e.push(t);
2873
- },
2874
- removeAnimationState: function(t) {
2875
- e.splice(ql(e, {
2876
- target: t
2877
- }), 1);
2878
- },
2879
- animateAll: function(t) {
2880
- var l = this;
2881
- if (!this.options.animation) {
2882
- clearTimeout(a), typeof t == "function" && t();
2883
- return;
2884
- }
2885
- var o = !1, r = 0;
2886
- e.forEach(function(n) {
2887
- var c = 0, s = n.target, v = s.fromRect, f = oe(s), p = s.prevFromRect, i = s.prevToRect, u = n.rect, m = Le(s, !0);
2888
- m && (f.top -= m.f, f.left -= m.e), s.toRect = f, s.thisAnimationDuration && St(p, f) && !St(v, f) && // Make sure animatingRect is on line between toRect & fromRect
2889
- (u.top - f.top) / (u.left - f.left) === (v.top - f.top) / (v.left - f.left) && (c = jl(u, p, i, l.options)), St(f, v) || (s.prevFromRect = v, s.prevToRect = f, c || (c = l.options.animation), l.animate(s, u, f, c)), c && (o = !0, r = Math.max(r, c), clearTimeout(s.animationResetTimer), s.animationResetTimer = setTimeout(function() {
2890
- s.animationTime = 0, s.prevFromRect = null, s.fromRect = null, s.prevToRect = null, s.thisAnimationDuration = null;
2891
- }, c), s.thisAnimationDuration = c);
2892
- }), clearTimeout(a), o ? a = setTimeout(function() {
2893
- typeof t == "function" && t();
2894
- }, r) : typeof t == "function" && t(), e = [];
2895
- },
2896
- animate: function(t, l, o, r) {
2897
- if (r) {
2898
- D(t, "transition", ""), D(t, "transform", "");
2899
- var n = Le(this.el), c = n && n.a, s = n && n.d, v = (l.left - o.left) / (c || 1), f = (l.top - o.top) / (s || 1);
2900
- t.animatingX = !!v, t.animatingY = !!f, D(t, "transform", "translate3d(" + v + "px," + f + "px,0)"), this.forRepaintDummy = Yl(t), D(t, "transition", "transform " + r + "ms" + (this.options.easing ? " " + this.options.easing : "")), D(t, "transform", "translate3d(0,0,0)"), typeof t.animated == "number" && clearTimeout(t.animated), t.animated = setTimeout(function() {
2901
- D(t, "transition", ""), D(t, "transform", ""), t.animated = !1, t.animatingX = !1, t.animatingY = !1;
2902
- }, r);
2903
- }
2904
- }
2905
- };
2906
- }
2907
- function Yl(e) {
2908
- return e.offsetWidth;
2909
- }
2910
- function jl(e, a, t, l) {
2911
- return Math.sqrt(Math.pow(a.top - e.top, 2) + Math.pow(a.left - e.left, 2)) / Math.sqrt(Math.pow(a.top - t.top, 2) + Math.pow(a.left - t.left, 2)) * l.animation;
2912
- }
2913
- var Re = [], kt = {
2914
- initializeByDefault: !0
2915
- }, tt = {
2916
- mount: function(e) {
2917
- for (var a in kt)
2918
- kt.hasOwnProperty(a) && !(a in e) && (e[a] = kt[a]);
2919
- Re.forEach(function(t) {
2920
- if (t.pluginName === e.pluginName)
2921
- throw "Sortable: Cannot mount plugin ".concat(e.pluginName, " more than once");
2922
- }), Re.push(e);
2923
- },
2924
- pluginEvent: function(e, a, t) {
2925
- var l = this;
2926
- this.eventCanceled = !1, t.cancel = function() {
2927
- l.eventCanceled = !0;
2928
- };
2929
- var o = e + "Global";
2930
- Re.forEach(function(r) {
2931
- a[r.pluginName] && (a[r.pluginName][o] && a[r.pluginName][o](Ce({
2932
- sortable: a
2933
- }, t)), a.options[r.pluginName] && a[r.pluginName][e] && a[r.pluginName][e](Ce({
2934
- sortable: a
2935
- }, t)));
2936
- });
2937
- },
2938
- initializePlugins: function(e, a, t, l) {
2939
- Re.forEach(function(n) {
2940
- var c = n.pluginName;
2941
- if (!(!e.options[c] && !n.initializeByDefault)) {
2942
- var s = new n(e, a, e.options);
2943
- s.sortable = e, s.options = e.options, e[c] = s, Se(t, s.defaults);
2944
- }
2945
- });
2946
- for (var o in e.options)
2947
- if (e.options.hasOwnProperty(o)) {
2948
- var r = this.modifyOption(e, o, e.options[o]);
2949
- typeof r < "u" && (e.options[o] = r);
2950
- }
2951
- },
2952
- getEventProperties: function(e, a) {
2953
- var t = {};
2954
- return Re.forEach(function(l) {
2955
- typeof l.eventProperties == "function" && Se(t, l.eventProperties.call(a[l.pluginName], e));
2956
- }), t;
2957
- },
2958
- modifyOption: function(e, a, t) {
2959
- var l;
2960
- return Re.forEach(function(o) {
2961
- e[o.pluginName] && o.optionListeners && typeof o.optionListeners[a] == "function" && (l = o.optionListeners[a].call(e[o.pluginName], t));
2962
- }), l;
2963
- }
2964
- };
2965
- function Hl(e) {
2966
- var a = e.sortable, t = e.rootEl, l = e.name, o = e.targetEl, r = e.cloneEl, n = e.toEl, c = e.fromEl, s = e.oldIndex, v = e.newIndex, f = e.oldDraggableIndex, p = e.newDraggableIndex, i = e.originalEvent, u = e.putSortable, m = e.extraEventProperties;
2967
- if (a = a || t && t[he], !!a) {
2968
- var g, k = a.options, d = "on" + l.charAt(0).toUpperCase() + l.substr(1);
2969
- window.CustomEvent && !ke && !et ? g = new CustomEvent(l, {
2970
- bubbles: !0,
2971
- cancelable: !0
2972
- }) : (g = document.createEvent("Event"), g.initEvent(l, !0, !0)), g.to = n || t, g.from = c || t, g.item = o || t, g.clone = r, g.oldIndex = s, g.newIndex = v, g.oldDraggableIndex = f, g.newDraggableIndex = p, g.originalEvent = i, g.pullMode = u ? u.lastPutMode : void 0;
2973
- var C = Ce(Ce({}, m), tt.getEventProperties(l, a));
2974
- for (var B in C)
2975
- g[B] = C[B];
2976
- t && t.dispatchEvent(g), k[d] && k[d].call(a, g);
2977
- }
2978
- }
2979
- var Kl = ["evt"], ve = function(e, a) {
2980
- var t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, l = t.evt, o = Ml(t, Kl);
2981
- tt.pluginEvent.bind(O)(e, a, Ce({
2982
- dragEl: _,
2983
- parentEl: te,
2984
- ghostEl: P,
2985
- rootEl: z,
2986
- nextEl: Pe,
2987
- lastDownEl: st,
2988
- cloneEl: J,
2989
- cloneHidden: Ve,
2990
- dragStarted: He,
2991
- putSortable: ce,
2992
- activeSortable: O.active,
2993
- originalEvent: l,
2994
- oldIndex: $e,
2995
- oldDraggableIndex: Qe,
2996
- newIndex: be,
2997
- newDraggableIndex: Ne,
2998
- hideGhostForTarget: Sa,
2999
- unhideGhostForTarget: ka,
3000
- cloneNowHidden: function() {
3001
- Ve = !0;
3002
- },
3003
- cloneNowShown: function() {
3004
- Ve = !1;
3005
- },
3006
- dispatchSortableEvent: function(r) {
3007
- fe({
3008
- sortable: a,
3009
- name: r,
3010
- originalEvent: l
3011
- });
3012
- }
3013
- }, o));
3014
- };
3015
- function fe(e) {
3016
- Hl(Ce({
3017
- putSortable: ce,
3018
- cloneEl: J,
3019
- targetEl: _,
3020
- rootEl: z,
3021
- oldIndex: $e,
3022
- oldDraggableIndex: Qe,
3023
- newIndex: be,
3024
- newDraggableIndex: Ne
3025
- }, e));
3026
- }
3027
- var _, te, P, z, Pe, st, J, Ve, $e, be, Qe, Ne, at, ce, qe = !1, ft = !1, vt = [], De, xe, Nt, Vt, la, oa, He, Be, Je, Ze = !1, nt = !1, ut, de, Et = [], At = !1, gt = [], Ct = typeof document < "u", lt = ga, ra = et || ke ? "cssFloat" : "float", Xl = Ct && !ya && !ga && "draggable" in document.createElement("div"), Ia = function() {
3028
- if (Ct) {
3029
- if (ke)
3030
- return !1;
3031
- var e = document.createElement("x");
3032
- return e.style.cssText = "pointer-events:auto", e.style.pointerEvents === "auto";
3033
- }
3034
- }(), Ca = function(e, a) {
3035
- var t = D(e), l = parseInt(t.width) - parseInt(t.paddingLeft) - parseInt(t.paddingRight) - parseInt(t.borderLeftWidth) - parseInt(t.borderRightWidth), o = Ye(e, 0, a), r = Ye(e, 1, a), n = o && D(o), c = r && D(r), s = n && parseInt(n.marginLeft) + parseInt(n.marginRight) + oe(o).width, v = c && parseInt(c.marginLeft) + parseInt(c.marginRight) + oe(r).width;
3036
- if (t.display === "flex")
3037
- return t.flexDirection === "column" || t.flexDirection === "column-reverse" ? "vertical" : "horizontal";
3038
- if (t.display === "grid")
3039
- return t.gridTemplateColumns.split(" ").length <= 1 ? "vertical" : "horizontal";
3040
- if (o && n.float && n.float !== "none") {
3041
- var f = n.float === "left" ? "left" : "right";
3042
- return r && (c.clear === "both" || c.clear === f) ? "vertical" : "horizontal";
3043
- }
3044
- return o && (n.display === "block" || n.display === "flex" || n.display === "table" || n.display === "grid" || s >= l && t[ra] === "none" || r && t[ra] === "none" && s + v > l) ? "vertical" : "horizontal";
3045
- }, Wl = function(e, a, t) {
3046
- var l = t ? e.left : e.top, o = t ? e.right : e.bottom, r = t ? e.width : e.height, n = t ? a.left : a.top, c = t ? a.right : a.bottom, s = t ? a.width : a.height;
3047
- return l === n || o === c || l + r / 2 === n + s / 2;
3048
- }, zl = function(e, a) {
3049
- var t;
3050
- return vt.some(function(l) {
3051
- var o = l[he].options.emptyInsertThreshold;
3052
- if (!(!o || Lt(l))) {
3053
- var r = oe(l), n = e >= r.left - o && e <= r.right + o, c = a >= r.top - o && a <= r.bottom + o;
3054
- if (n && c)
3055
- return t = l;
3056
- }
3057
- }), t;
3058
- }, Fa = function(e) {
3059
- function a(o, r) {
3060
- return function(n, c, s, v) {
3061
- var f = n.options.group.name && c.options.group.name && n.options.group.name === c.options.group.name;
3062
- if (o == null && (r || f))
3063
- return !0;
3064
- if (o == null || o === !1)
3065
- return !1;
3066
- if (r && o === "clone")
3067
- return o;
3068
- if (typeof o == "function")
3069
- return a(o(n, c, s, v), r)(n, c, s, v);
3070
- var p = (r ? n : c).options.group.name;
3071
- return o === !0 || typeof o == "string" && o === p || o.join && o.indexOf(p) > -1;
3072
- };
3073
- }
3074
- var t = {}, l = e.group;
3075
- (!l || it(l) != "object") && (l = {
3076
- name: l
3077
- }), t.name = l.name, t.checkPull = a(l.pull, !0), t.checkPut = a(l.put), t.revertClone = l.revertClone, e.group = t;
3078
- }, Sa = function() {
3079
- !Ia && P && D(P, "display", "none");
3080
- }, ka = function() {
3081
- !Ia && P && D(P, "display", "");
3082
- };
3083
- Ct && !ya && document.addEventListener("click", function(e) {
3084
- if (ft)
3085
- return e.preventDefault(), e.stopPropagation && e.stopPropagation(), e.stopImmediatePropagation && e.stopImmediatePropagation(), ft = !1, !1;
3086
- }, !0);
3087
- var Oe = function(e) {
3088
- if (_) {
3089
- e = e.touches ? e.touches[0] : e;
3090
- var a = zl(e.clientX, e.clientY);
3091
- if (a) {
3092
- var t = {};
3093
- for (var l in e)
3094
- e.hasOwnProperty(l) && (t[l] = e[l]);
3095
- t.target = t.rootEl = a, t.preventDefault = void 0, t.stopPropagation = void 0, a[he]._onDragOver(t);
3096
- }
3097
- }
3098
- }, Ql = function(e) {
3099
- _ && _.parentNode[he]._isOutsideThisEl(e.target);
3100
- };
3101
- function O(e, a) {
3102
- if (!(e && e.nodeType && e.nodeType === 1))
3103
- throw "Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(e));
3104
- this.el = e, this.options = a = Se({}, a), e[he] = this;
3105
- var t = {
3106
- group: null,
3107
- sort: !0,
3108
- disabled: !1,
3109
- store: null,
3110
- handle: null,
3111
- draggable: /^[uo]l$/i.test(e.nodeName) ? ">li" : ">*",
3112
- swapThreshold: 1,
3113
- // percentage; 0 <= x <= 1
3114
- invertSwap: !1,
3115
- // invert always
3116
- invertedSwapThreshold: null,
3117
- // will be set to same as swapThreshold if default
3118
- removeCloneOnHide: !0,
3119
- direction: function() {
3120
- return Ca(e, this.options);
3121
- },
3122
- ghostClass: "sortable-ghost",
3123
- chosenClass: "sortable-chosen",
3124
- dragClass: "sortable-drag",
3125
- ignore: "a, img",
3126
- filter: null,
3127
- preventOnFilter: !0,
3128
- animation: 0,
3129
- easing: null,
3130
- setData: function(r, n) {
3131
- r.setData("Text", n.textContent);
3132
- },
3133
- dropBubble: !1,
3134
- dragoverBubble: !1,
3135
- dataIdAttr: "data-id",
3136
- delay: 0,
3137
- delayOnTouchOnly: !1,
3138
- touchStartThreshold: (Number.parseInt ? Number : window).parseInt(window.devicePixelRatio, 10) || 1,
3139
- forceFallback: !1,
3140
- fallbackClass: "sortable-fallback",
3141
- fallbackOnBody: !1,
3142
- fallbackTolerance: 0,
3143
- fallbackOffset: {
3144
- x: 0,
3145
- y: 0
3146
- },
3147
- supportPointer: O.supportPointer !== !1 && "PointerEvent" in window && !We,
3148
- emptyInsertThreshold: 5
3149
- };
3150
- tt.initializePlugins(this, e, t);
3151
- for (var l in t)
3152
- !(l in a) && (a[l] = t[l]);
3153
- Fa(a);
3154
- for (var o in this)
3155
- o.charAt(0) === "_" && typeof this[o] == "function" && (this[o] = this[o].bind(this));
3156
- this.nativeDraggable = a.forceFallback ? !1 : Xl, this.nativeDraggable && (this.options.touchStartThreshold = 1), a.supportPointer ? G(e, "pointerdown", this._onTapStart) : (G(e, "mousedown", this._onTapStart), G(e, "touchstart", this._onTapStart)), this.nativeDraggable && (G(e, "dragover", this), G(e, "dragenter", this)), vt.push(this.el), a.store && a.store.get && this.sort(a.store.get(this) || []), Se(this, Ll());
3157
- }
3158
- O.prototype = /** @lends Sortable.prototype */
3159
- {
3160
- constructor: O,
3161
- _isOutsideThisEl: function(e) {
3162
- !this.el.contains(e) && e !== this.el && (Be = null);
3163
- },
3164
- _getDirection: function(e, a) {
3165
- return typeof this.options.direction == "function" ? this.options.direction.call(this, e, a, _) : this.options.direction;
3166
- },
3167
- _onTapStart: function(e) {
3168
- if (e.cancelable) {
3169
- var a = this, t = this.el, l = this.options, o = l.preventOnFilter, r = e.type, n = e.touches && e.touches[0] || e.pointerType && e.pointerType === "touch" && e, c = (n || e).target, s = e.target.shadowRoot && (e.path && e.path[0] || e.composedPath && e.composedPath()[0]) || c, v = l.filter;
3170
- if (oo(t), !_ && !(/mousedown|pointerdown/.test(r) && e.button !== 0 || l.disabled) && !s.isContentEditable && !(!this.nativeDraggable && We && c && c.tagName.toUpperCase() === "SELECT") && (c = Te(c, l.draggable, t, !1), !(c && c.animated) && st !== c)) {
3171
- if ($e = we(c), Qe = we(c, l.draggable), typeof v == "function") {
3172
- if (v.call(this, e, c, this)) {
3173
- fe({
3174
- sortable: a,
3175
- rootEl: s,
3176
- name: "filter",
3177
- targetEl: c,
3178
- toEl: t,
3179
- fromEl: t
3180
- }), ve("filter", a, {
3181
- evt: e
3182
- }), o && e.cancelable && e.preventDefault();
3183
- return;
3184
- }
3185
- } else if (v && (v = v.split(",").some(function(f) {
3186
- if (f = Te(s, f.trim(), t, !1), f)
3187
- return fe({
3188
- sortable: a,
3189
- rootEl: f,
3190
- name: "filter",
3191
- targetEl: c,
3192
- fromEl: t,
3193
- toEl: t
3194
- }), ve("filter", a, {
3195
- evt: e
3196
- }), !0;
3197
- }), v)) {
3198
- o && e.cancelable && e.preventDefault();
3199
- return;
3200
- }
3201
- l.handle && !Te(s, l.handle, t, !1) || this._prepareDragStart(e, n, c);
3202
- }
3203
- }
3204
- },
3205
- _prepareDragStart: function(e, a, t) {
3206
- var l = this, o = l.el, r = l.options, n = o.ownerDocument, c;
3207
- if (t && !_ && t.parentNode === o) {
3208
- var s = oe(t);
3209
- if (z = o, _ = t, te = _.parentNode, Pe = _.nextSibling, st = t, at = r.group, O.dragged = _, De = {
3210
- target: _,
3211
- clientX: (a || e).clientX,
3212
- clientY: (a || e).clientY
3213
- }, la = De.clientX - s.left, oa = De.clientY - s.top, this._lastX = (a || e).clientX, this._lastY = (a || e).clientY, _.style["will-change"] = "all", c = function() {
3214
- if (ve("delayEnded", l, {
3215
- evt: e
3216
- }), O.eventCanceled) {
3217
- l._onDrop();
3218
- return;
3219
- }
3220
- l._disableDelayedDragEvents(), !ea && l.nativeDraggable && (_.draggable = !0), l._triggerDragStart(e, a), fe({
3221
- sortable: l,
3222
- name: "choose",
3223
- originalEvent: e
3224
- }), ye(_, r.chosenClass, !0);
3225
- }, r.ignore.split(",").forEach(function(v) {
3226
- ha(_, v.trim(), Dt);
3227
- }), G(n, "dragover", Oe), G(n, "mousemove", Oe), G(n, "touchmove", Oe), G(n, "mouseup", l._onDrop), G(n, "touchend", l._onDrop), G(n, "touchcancel", l._onDrop), ea && this.nativeDraggable && (this.options.touchStartThreshold = 4, _.draggable = !0), ve("delayStart", this, {
3228
- evt: e
3229
- }), r.delay && (!r.delayOnTouchOnly || a) && (!this.nativeDraggable || !(et || ke))) {
3230
- if (O.eventCanceled) {
3231
- this._onDrop();
3232
- return;
3233
- }
3234
- G(n, "mouseup", l._disableDelayedDrag), G(n, "touchend", l._disableDelayedDrag), G(n, "touchcancel", l._disableDelayedDrag), G(n, "mousemove", l._delayedDragTouchMoveHandler), G(n, "touchmove", l._delayedDragTouchMoveHandler), r.supportPointer && G(n, "pointermove", l._delayedDragTouchMoveHandler), l._dragStartTimer = setTimeout(c, r.delay);
3235
- } else
3236
- c();
3237
- }
3238
- },
3239
- _delayedDragTouchMoveHandler: function(e) {
3240
- var a = e.touches ? e.touches[0] : e;
3241
- Math.max(Math.abs(a.clientX - this._lastX), Math.abs(a.clientY - this._lastY)) >= Math.floor(this.options.touchStartThreshold / (this.nativeDraggable && window.devicePixelRatio || 1)) && this._disableDelayedDrag();
3242
- },
3243
- _disableDelayedDrag: function() {
3244
- _ && Dt(_), clearTimeout(this._dragStartTimer), this._disableDelayedDragEvents();
3245
- },
3246
- _disableDelayedDragEvents: function() {
3247
- var e = this.el.ownerDocument;
3248
- q(e, "mouseup", this._disableDelayedDrag), q(e, "touchend", this._disableDelayedDrag), q(e, "touchcancel", this._disableDelayedDrag), q(e, "mousemove", this._delayedDragTouchMoveHandler), q(e, "touchmove", this._delayedDragTouchMoveHandler), q(e, "pointermove", this._delayedDragTouchMoveHandler);
3249
- },
3250
- _triggerDragStart: function(e, a) {
3251
- a = a || e.pointerType == "touch" && e, !this.nativeDraggable || a ? this.options.supportPointer ? G(document, "pointermove", this._onTouchMove) : a ? G(document, "touchmove", this._onTouchMove) : G(document, "mousemove", this._onTouchMove) : (G(_, "dragend", this), G(z, "dragstart", this._onDragStart));
3252
- try {
3253
- document.selection ? ct(function() {
3254
- document.selection.empty();
3255
- }) : window.getSelection().removeAllRanges();
3256
- } catch {
3257
- }
3258
- },
3259
- _dragStarted: function(e, a) {
3260
- if (qe = !1, z && _) {
3261
- ve("dragStarted", this, {
3262
- evt: a
3263
- }), this.nativeDraggable && G(document, "dragover", Ql);
3264
- var t = this.options;
3265
- !e && ye(_, t.dragClass, !1), ye(_, t.ghostClass, !0), O.active = this, e && this._appendGhost(), fe({
3266
- sortable: this,
3267
- name: "start",
3268
- originalEvent: a
3269
- });
3270
- } else
3271
- this._nulling();
3272
- },
3273
- _emulateDragOver: function() {
3274
- if (xe) {
3275
- this._lastX = xe.clientX, this._lastY = xe.clientY, Sa();
3276
- for (var e = document.elementFromPoint(xe.clientX, xe.clientY), a = e; e && e.shadowRoot && (e = e.shadowRoot.elementFromPoint(xe.clientX, xe.clientY), e !== a); )
3277
- a = e;
3278
- if (_.parentNode[he]._isOutsideThisEl(e), a)
3279
- do {
3280
- if (a[he]) {
3281
- var t = void 0;
3282
- if (t = a[he]._onDragOver({
3283
- clientX: xe.clientX,
3284
- clientY: xe.clientY,
3285
- target: e,
3286
- rootEl: a
3287
- }), t && !this.options.dragoverBubble)
3288
- break;
3289
- }
3290
- e = a;
3291
- } while (a = a.parentNode);
3292
- ka();
3293
- }
3294
- },
3295
- _onTouchMove: function(e) {
3296
- if (De) {
3297
- var a = this.options, t = a.fallbackTolerance, l = a.fallbackOffset, o = e.touches ? e.touches[0] : e, r = P && Le(P, !0), n = P && r && r.a, c = P && r && r.d, s = lt && de && na(de), v = (o.clientX - De.clientX + l.x) / (n || 1) + (s ? s[0] - Et[0] : 0) / (n || 1), f = (o.clientY - De.clientY + l.y) / (c || 1) + (s ? s[1] - Et[1] : 0) / (c || 1);
3298
- if (!O.active && !qe) {
3299
- if (t && Math.max(Math.abs(o.clientX - this._lastX), Math.abs(o.clientY - this._lastY)) < t)
3300
- return;
3301
- this._onDragStart(e, !0);
3302
- }
3303
- if (P) {
3304
- r ? (r.e += v - (Nt || 0), r.f += f - (Vt || 0)) : r = {
3305
- a: 1,
3306
- b: 0,
3307
- c: 0,
3308
- d: 1,
3309
- e: v,
3310
- f
3311
- };
3312
- var p = "matrix(".concat(r.a, ",").concat(r.b, ",").concat(r.c, ",").concat(r.d, ",").concat(r.e, ",").concat(r.f, ")");
3313
- D(P, "webkitTransform", p), D(P, "mozTransform", p), D(P, "msTransform", p), D(P, "transform", p), Nt = v, Vt = f, xe = o;
3314
- }
3315
- e.cancelable && e.preventDefault();
3316
- }
3317
- },
3318
- _appendGhost: function() {
3319
- if (!P) {
3320
- var e = this.options.fallbackOnBody ? document.body : z, a = oe(_, !0, lt, !0, e), t = this.options;
3321
- if (lt) {
3322
- for (de = e; D(de, "position") === "static" && D(de, "transform") === "none" && de !== document; )
3323
- de = de.parentNode;
3324
- de !== document.body && de !== document.documentElement ? (de === document && (de = Ie()), a.top += de.scrollTop, a.left += de.scrollLeft) : de = Ie(), Et = na(de);
3325
- }
3326
- P = _.cloneNode(!0), ye(P, t.ghostClass, !1), ye(P, t.fallbackClass, !0), ye(P, t.dragClass, !0), D(P, "transition", ""), D(P, "transform", ""), D(P, "box-sizing", "border-box"), D(P, "margin", 0), D(P, "top", a.top), D(P, "left", a.left), D(P, "width", a.width), D(P, "height", a.height), D(P, "opacity", "0.8"), D(P, "position", lt ? "absolute" : "fixed"), D(P, "zIndex", "100000"), D(P, "pointerEvents", "none"), O.ghost = P, e.appendChild(P), D(P, "transform-origin", la / parseInt(P.style.width) * 100 + "% " + oa / parseInt(P.style.height) * 100 + "%");
3327
- }
3328
- },
3329
- _onDragStart: function(e, a) {
3330
- var t = this, l = e.dataTransfer, o = t.options;
3331
- if (ve("dragStart", this, {
3332
- evt: e
3333
- }), O.eventCanceled) {
3334
- this._onDrop();
3335
- return;
3336
- }
3337
- ve("setupClone", this), O.eventCanceled || (J = xa(_), J.removeAttribute("id"), J.draggable = !1, J.style["will-change"] = "", this._hideClone(), ye(J, this.options.chosenClass, !1), O.clone = J), t.cloneId = ct(function() {
3338
- ve("clone", t), !O.eventCanceled && (t.options.removeCloneOnHide || z.insertBefore(J, _), t._hideClone(), fe({
3339
- sortable: t,
3340
- name: "clone"
3341
- }));
3342
- }), !a && ye(_, o.dragClass, !0), a ? (ft = !0, t._loopId = setInterval(t._emulateDragOver, 50)) : (q(document, "mouseup", t._onDrop), q(document, "touchend", t._onDrop), q(document, "touchcancel", t._onDrop), l && (l.effectAllowed = "move", o.setData && o.setData.call(t, l, _)), G(document, "drop", t), D(_, "transform", "translateZ(0)")), qe = !0, t._dragStartId = ct(t._dragStarted.bind(t, a, e)), G(document, "selectstart", t), He = !0, We && D(document.body, "user-select", "none");
3343
- },
3344
- // Returns true - if no further action is needed (either inserted or another condition)
3345
- _onDragOver: function(e) {
3346
- var a = this.el, t = e.target, l, o, r, n = this.options, c = n.group, s = O.active, v = at === c, f = n.sort, p = ce || s, i, u = this, m = !1;
3347
- if (At)
3348
- return;
3349
- function g(Y, _e) {
3350
- ve(Y, u, Ce({
3351
- evt: e,
3352
- isOwner: v,
3353
- axis: i ? "vertical" : "horizontal",
3354
- revert: r,
3355
- dragRect: l,
3356
- targetRect: o,
3357
- canSort: f,
3358
- fromSortable: p,
3359
- target: t,
3360
- completed: d,
3361
- onMove: function(se, I) {
3362
- return ot(z, a, _, l, se, oe(se), e, I);
3363
- },
3364
- changed: C
3365
- }, _e));
3366
- }
3367
- function k() {
3368
- g("dragOverAnimationCapture"), u.captureAnimationState(), u !== p && p.captureAnimationState();
3369
- }
3370
- function d(Y) {
3371
- return g("dragOverCompleted", {
3372
- insertion: Y
3373
- }), Y && (v ? s._hideClone() : s._showClone(u), u !== p && (ye(_, ce ? ce.options.ghostClass : s.options.ghostClass, !1), ye(_, n.ghostClass, !0)), ce !== u && u !== O.active ? ce = u : u === O.active && ce && (ce = null), p === u && (u._ignoreWhileAnimating = t), u.animateAll(function() {
3374
- g("dragOverAnimationComplete"), u._ignoreWhileAnimating = null;
3375
- }), u !== p && (p.animateAll(), p._ignoreWhileAnimating = null)), (t === _ && !_.animated || t === a && !t.animated) && (Be = null), !n.dragoverBubble && !e.rootEl && t !== document && (_.parentNode[he]._isOutsideThisEl(e.target), !Y && Oe(e)), !n.dragoverBubble && e.stopPropagation && e.stopPropagation(), m = !0;
3376
- }
3377
- function C() {
3378
- be = we(_), Ne = we(_, n.draggable), fe({
3379
- sortable: u,
3380
- name: "change",
3381
- toEl: a,
3382
- newIndex: be,
3383
- newDraggableIndex: Ne,
3384
- originalEvent: e
3385
- });
3386
- }
3387
- if (e.preventDefault !== void 0 && e.cancelable && e.preventDefault(), t = Te(t, n.draggable, a, !0), g("dragOver"), O.eventCanceled)
3388
- return m;
3389
- if (_.contains(e.target) || t.animated && t.animatingX && t.animatingY || u._ignoreWhileAnimating === t)
3390
- return d(!1);
3391
- if (ft = !1, s && !n.disabled && (v ? f || (r = te !== z) : ce === this || (this.lastPutMode = at.checkPull(this, s, _, e)) && c.checkPut(this, s, _, e))) {
3392
- if (i = this._getDirection(e, t) === "vertical", l = oe(_), g("dragOverValid"), O.eventCanceled)
3393
- return m;
3394
- if (r)
3395
- return te = z, k(), this._hideClone(), g("revert"), O.eventCanceled || (Pe ? z.insertBefore(_, Pe) : z.appendChild(_)), d(!0);
3396
- var B = Lt(a, n.draggable);
3397
- if (!B || to(e, i, this) && !B.animated) {
3398
- if (B === _)
3399
- return d(!1);
3400
- if (B && a === e.target && (t = B), t && (o = oe(t)), ot(z, a, _, l, t, o, e, !!t) !== !1)
3401
- return k(), B && B.nextSibling ? a.insertBefore(_, B.nextSibling) : a.appendChild(_), te = a, C(), d(!0);
3402
- } else if (B && eo(e, i, this)) {
3403
- var M = Ye(a, 0, n, !0);
3404
- if (M === _)
3405
- return d(!1);
3406
- if (t = M, o = oe(t), ot(z, a, _, l, t, o, e, !1) !== !1)
3407
- return k(), a.insertBefore(_, M), te = a, C(), d(!0);
3408
- } else if (t.parentNode === a) {
3409
- o = oe(t);
3410
- var $ = 0, Z, j = _.parentNode !== a, me = !Wl(_.animated && _.toRect || l, t.animated && t.toRect || o, i), ee = i ? "top" : "left", N = aa(t, "top", "top") || aa(_, "top", "top"), S = N ? N.scrollTop : void 0;
3411
- Be !== t && (Z = o[ee], Ze = !1, nt = !me && n.invertSwap || j), $ = ao(e, t, o, i, me ? 1 : n.swapThreshold, n.invertedSwapThreshold == null ? n.swapThreshold : n.invertedSwapThreshold, nt, Be === t);
3412
- var w;
3413
- if ($ !== 0) {
3414
- var V = we(_);
3415
- do
3416
- V -= $, w = te.children[V];
3417
- while (w && (D(w, "display") === "none" || w === P));
3418
- }
3419
- if ($ === 0 || w === t)
3420
- return d(!1);
3421
- Be = t, Je = $;
3422
- var U = t.nextElementSibling, L = !1;
3423
- L = $ === 1;
3424
- var W = ot(z, a, _, l, t, o, e, L);
3425
- if (W !== !1)
3426
- return (W === 1 || W === -1) && (L = W === 1), At = !0, setTimeout(Zl, 30), k(), L && !U ? a.appendChild(_) : t.parentNode.insertBefore(_, L ? U : t), N && wa(N, 0, S - N.scrollTop), te = _.parentNode, Z !== void 0 && !nt && (ut = Math.abs(Z - oe(t)[ee])), C(), d(!0);
3427
- }
3428
- if (a.contains(_))
3429
- return d(!1);
3430
- }
3431
- return !1;
3432
- },
3433
- _ignoreWhileAnimating: null,
3434
- _offMoveEvents: function() {
3435
- q(document, "mousemove", this._onTouchMove), q(document, "touchmove", this._onTouchMove), q(document, "pointermove", this._onTouchMove), q(document, "dragover", Oe), q(document, "mousemove", Oe), q(document, "touchmove", Oe);
3436
- },
3437
- _offUpEvents: function() {
3438
- var e = this.el.ownerDocument;
3439
- q(e, "mouseup", this._onDrop), q(e, "touchend", this._onDrop), q(e, "pointerup", this._onDrop), q(e, "touchcancel", this._onDrop), q(document, "selectstart", this);
3440
- },
3441
- _onDrop: function(e) {
3442
- var a = this.el, t = this.options;
3443
- if (be = we(_), Ne = we(_, t.draggable), ve("drop", this, {
3444
- evt: e
3445
- }), te = _ && _.parentNode, be = we(_), Ne = we(_, t.draggable), O.eventCanceled) {
3446
- this._nulling();
3447
- return;
3448
- }
3449
- qe = !1, nt = !1, Ze = !1, clearInterval(this._loopId), clearTimeout(this._dragStartTimer), Mt(this.cloneId), Mt(this._dragStartId), this.nativeDraggable && (q(document, "drop", this), q(a, "dragstart", this._onDragStart)), this._offMoveEvents(), this._offUpEvents(), We && D(document.body, "user-select", ""), D(_, "transform", ""), e && (He && (e.cancelable && e.preventDefault(), !t.dropBubble && e.stopPropagation()), P && P.parentNode && P.parentNode.removeChild(P), (z === te || ce && ce.lastPutMode !== "clone") && J && J.parentNode && J.parentNode.removeChild(J), _ && (this.nativeDraggable && q(_, "dragend", this), Dt(_), _.style["will-change"] = "", He && !qe && ye(_, ce ? ce.options.ghostClass : this.options.ghostClass, !1), ye(_, this.options.chosenClass, !1), fe({
3450
- sortable: this,
3451
- name: "unchoose",
3452
- toEl: te,
3453
- newIndex: null,
3454
- newDraggableIndex: null,
3455
- originalEvent: e
3456
- }), z !== te ? (be >= 0 && (fe({
3457
- rootEl: te,
3458
- name: "add",
3459
- toEl: te,
3460
- fromEl: z,
3461
- originalEvent: e
3462
- }), fe({
3463
- sortable: this,
3464
- name: "remove",
3465
- toEl: te,
3466
- originalEvent: e
3467
- }), fe({
3468
- rootEl: te,
3469
- name: "sort",
3470
- toEl: te,
3471
- fromEl: z,
3472
- originalEvent: e
3473
- }), fe({
3474
- sortable: this,
3475
- name: "sort",
3476
- toEl: te,
3477
- originalEvent: e
3478
- })), ce && ce.save()) : be !== $e && be >= 0 && (fe({
3479
- sortable: this,
3480
- name: "update",
3481
- toEl: te,
3482
- originalEvent: e
3483
- }), fe({
3484
- sortable: this,
3485
- name: "sort",
3486
- toEl: te,
3487
- originalEvent: e
3488
- })), O.active && ((be == null || be === -1) && (be = $e, Ne = Qe), fe({
3489
- sortable: this,
3490
- name: "end",
3491
- toEl: te,
3492
- originalEvent: e
3493
- }), this.save()))), this._nulling();
3494
- },
3495
- _nulling: function() {
3496
- ve("nulling", this), z = _ = te = P = Pe = J = st = Ve = De = xe = He = be = Ne = $e = Qe = Be = Je = ce = at = O.dragged = O.ghost = O.clone = O.active = null, gt.forEach(function(e) {
3497
- e.checked = !0;
3498
- }), gt.length = Nt = Vt = 0;
3499
- },
3500
- handleEvent: function(e) {
3501
- switch (e.type) {
3502
- case "drop":
3503
- case "dragend":
3504
- this._onDrop(e);
3505
- break;
3506
- case "dragenter":
3507
- case "dragover":
3508
- _ && (this._onDragOver(e), Jl(e));
3509
- break;
3510
- case "selectstart":
3511
- e.preventDefault();
3512
- break;
3513
- }
3514
- },
3515
- /**
3516
- * Serializes the item into an array of string.
3517
- * @returns {String[]}
3518
- */
3519
- toArray: function() {
3520
- for (var e = [], a, t = this.el.children, l = 0, o = t.length, r = this.options; l < o; l++)
3521
- a = t[l], Te(a, r.draggable, this.el, !1) && e.push(a.getAttribute(r.dataIdAttr) || lo(a));
3522
- return e;
3523
- },
3524
- /**
3525
- * Sorts the elements according to the array.
3526
- * @param {String[]} order order of the items
3527
- */
3528
- sort: function(e, a) {
3529
- var t = {}, l = this.el;
3530
- this.toArray().forEach(function(o, r) {
3531
- var n = l.children[r];
3532
- Te(n, this.options.draggable, l, !1) && (t[o] = n);
3533
- }, this), a && this.captureAnimationState(), e.forEach(function(o) {
3534
- t[o] && (l.removeChild(t[o]), l.appendChild(t[o]));
3535
- }), a && this.animateAll();
3536
- },
3537
- /**
3538
- * Save the current sorting
3539
- */
3540
- save: function() {
3541
- var e = this.options.store;
3542
- e && e.set && e.set(this);
3543
- },
3544
- /**
3545
- * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
3546
- * @param {HTMLElement} el
3547
- * @param {String} [selector] default: `options.draggable`
3548
- * @returns {HTMLElement|null}
3549
- */
3550
- closest: function(e, a) {
3551
- return Te(e, a || this.options.draggable, this.el, !1);
3552
- },
3553
- /**
3554
- * Set/get option
3555
- * @param {string} name
3556
- * @param {*} [value]
3557
- * @returns {*}
3558
- */
3559
- option: function(e, a) {
3560
- var t = this.options;
3561
- if (a === void 0)
3562
- return t[e];
3563
- var l = tt.modifyOption(this, e, a);
3564
- typeof l < "u" ? t[e] = l : t[e] = a, e === "group" && Fa(t);
3565
- },
3566
- /**
3567
- * Destroy
3568
- */
3569
- destroy: function() {
3570
- ve("destroy", this);
3571
- var e = this.el;
3572
- e[he] = null, q(e, "mousedown", this._onTapStart), q(e, "touchstart", this._onTapStart), q(e, "pointerdown", this._onTapStart), this.nativeDraggable && (q(e, "dragover", this), q(e, "dragenter", this)), Array.prototype.forEach.call(e.querySelectorAll("[draggable]"), function(a) {
3573
- a.removeAttribute("draggable");
3574
- }), this._onDrop(), this._disableDelayedDragEvents(), vt.splice(vt.indexOf(this.el), 1), this.el = e = null;
3575
- },
3576
- _hideClone: function() {
3577
- if (!Ve) {
3578
- if (ve("hideClone", this), O.eventCanceled)
3579
- return;
3580
- D(J, "display", "none"), this.options.removeCloneOnHide && J.parentNode && J.parentNode.removeChild(J), Ve = !0;
3581
- }
3582
- },
3583
- _showClone: function(e) {
3584
- if (e.lastPutMode !== "clone") {
3585
- this._hideClone();
3586
- return;
3587
- }
3588
- if (Ve) {
3589
- if (ve("showClone", this), O.eventCanceled)
3590
- return;
3591
- _.parentNode == z && !this.options.group.revertClone ? z.insertBefore(J, _) : Pe ? z.insertBefore(J, Pe) : z.appendChild(J), this.options.group.revertClone && this.animate(_, J), D(J, "display", ""), Ve = !1;
3592
- }
3593
- }
3594
- };
3595
- function Jl(e) {
3596
- e.dataTransfer && (e.dataTransfer.dropEffect = "move"), e.cancelable && e.preventDefault();
3597
- }
3598
- function ot(e, a, t, l, o, r, n, c) {
3599
- var s, v = e[he], f = v.options.onMove, p;
3600
- return window.CustomEvent && !ke && !et ? s = new CustomEvent("move", {
3601
- bubbles: !0,
3602
- cancelable: !0
3603
- }) : (s = document.createEvent("Event"), s.initEvent("move", !0, !0)), s.to = a, s.from = e, s.dragged = t, s.draggedRect = l, s.related = o || a, s.relatedRect = r || oe(a), s.willInsertAfter = c, s.originalEvent = n, e.dispatchEvent(s), f && (p = f.call(v, s, n)), p;
3604
- }
3605
- function Dt(e) {
3606
- e.draggable = !1;
3607
- }
3608
- function Zl() {
3609
- At = !1;
3610
- }
3611
- function eo(e, a, t) {
3612
- var l = oe(Ye(t.el, 0, t.options, !0)), o = Ta(t.el, t.options, P), r = 10;
3613
- return a ? e.clientX < o.left - r || e.clientY < l.top && e.clientX < l.right : e.clientY < o.top - r || e.clientY < l.bottom && e.clientX < l.left;
3614
- }
3615
- function to(e, a, t) {
3616
- var l = oe(Lt(t.el, t.options.draggable)), o = Ta(t.el, t.options, P), r = 10;
3617
- return a ? e.clientX > o.right + r || e.clientY > l.bottom && e.clientX > l.left : e.clientY > o.bottom + r || e.clientX > l.right && e.clientY > l.top;
3618
- }
3619
- function ao(e, a, t, l, o, r, n, c) {
3620
- var s = l ? e.clientY : e.clientX, v = l ? t.height : t.width, f = l ? t.top : t.left, p = l ? t.bottom : t.right, i = !1;
3621
- if (!n) {
3622
- if (c && ut < v * o) {
3623
- if (!Ze && (Je === 1 ? s > f + v * r / 2 : s < p - v * r / 2) && (Ze = !0), Ze)
3624
- i = !0;
3625
- else if (Je === 1 ? s < f + ut : s > p - ut)
3626
- return -Je;
3627
- } else if (s > f + v * (1 - o) / 2 && s < p - v * (1 - o) / 2)
3628
- return no(a);
3629
- }
3630
- return i = i || n, i && (s < f + v * r / 2 || s > p - v * r / 2) ? s > f + v / 2 ? 1 : -1 : 0;
3631
- }
3632
- function no(e) {
3633
- return we(_) < we(e) ? 1 : -1;
3634
- }
3635
- function lo(e) {
3636
- for (var a = e.tagName + e.className + e.src + e.href + e.textContent, t = a.length, l = 0; t--; )
3637
- l += a.charCodeAt(t);
3638
- return l.toString(36);
3639
- }
3640
- function oo(e) {
3641
- gt.length = 0;
3642
- for (var a = e.getElementsByTagName("input"), t = a.length; t--; ) {
3643
- var l = a[t];
3644
- l.checked && gt.push(l);
3645
- }
3646
- }
3647
- function ct(e) {
3648
- return setTimeout(e, 0);
3649
- }
3650
- function Mt(e) {
3651
- return clearTimeout(e);
3652
- }
3653
- Ct && G(document, "touchmove", function(e) {
3654
- (O.active || qe) && e.cancelable && e.preventDefault();
3655
- });
3656
- O.utils = {
3657
- on: G,
3658
- off: q,
3659
- css: D,
3660
- find: ha,
3661
- is: function(e, a) {
3662
- return !!Te(e, a, e, !1);
3663
- },
3664
- extend: Gl,
3665
- throttle: _a,
3666
- closest: Te,
3667
- toggleClass: ye,
3668
- clone: xa,
3669
- index: we,
3670
- nextTick: ct,
3671
- cancelNextTick: Mt,
3672
- detectDirection: Ca,
3673
- getChild: Ye
3674
- };
3675
- O.get = function(e) {
3676
- return e[he];
3677
- };
3678
- O.mount = function() {
3679
- for (var e = arguments.length, a = new Array(e), t = 0; t < e; t++)
3680
- a[t] = arguments[t];
3681
- a[0].constructor === Array && (a = a[0]), a.forEach(function(l) {
3682
- if (!l.prototype || !l.prototype.constructor)
3683
- throw "Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(l));
3684
- l.utils && (O.utils = Ce(Ce({}, O.utils), l.utils)), tt.mount(l);
3685
- });
3686
- };
3687
- O.create = function(e, a) {
3688
- return new O(e, a);
3689
- };
3690
- O.version = Rl;
3691
- var le = [], Ke, Rt, Bt = !1, Ot, Pt, yt, Xe;
3692
- function ro() {
3693
- function e() {
3694
- this.defaults = {
3695
- scroll: !0,
3696
- forceAutoScrollFallback: !1,
3697
- scrollSensitivity: 30,
3698
- scrollSpeed: 10,
3699
- bubbleScroll: !0
3700
- };
3701
- for (var a in this)
3702
- a.charAt(0) === "_" && typeof this[a] == "function" && (this[a] = this[a].bind(this));
3703
- }
3704
- return e.prototype = {
3705
- dragStarted: function(a) {
3706
- var t = a.originalEvent;
3707
- this.sortable.nativeDraggable ? G(document, "dragover", this._handleAutoScroll) : this.options.supportPointer ? G(document, "pointermove", this._handleFallbackAutoScroll) : t.touches ? G(document, "touchmove", this._handleFallbackAutoScroll) : G(document, "mousemove", this._handleFallbackAutoScroll);
3708
- },
3709
- dragOverCompleted: function(a) {
3710
- var t = a.originalEvent;
3711
- !this.options.dragOverBubble && !t.rootEl && this._handleAutoScroll(t);
3712
- },
3713
- drop: function() {
3714
- this.sortable.nativeDraggable ? q(document, "dragover", this._handleAutoScroll) : (q(document, "pointermove", this._handleFallbackAutoScroll), q(document, "touchmove", this._handleFallbackAutoScroll), q(document, "mousemove", this._handleFallbackAutoScroll)), ia(), dt(), $l();
3715
- },
3716
- nulling: function() {
3717
- yt = Rt = Ke = Bt = Xe = Ot = Pt = null, le.length = 0;
3718
- },
3719
- _handleFallbackAutoScroll: function(a) {
3720
- this._handleAutoScroll(a, !0);
3721
- },
3722
- _handleAutoScroll: function(a, t) {
3723
- var l = this, o = (a.touches ? a.touches[0] : a).clientX, r = (a.touches ? a.touches[0] : a).clientY, n = document.elementFromPoint(o, r);
3724
- if (yt = a, t || this.options.forceAutoScrollFallback || et || ke || We) {
3725
- Ut(a, this.options, n, t);
3726
- var c = Ee(n, !0);
3727
- Bt && (!Xe || o !== Ot || r !== Pt) && (Xe && ia(), Xe = setInterval(function() {
3728
- var s = Ee(document.elementFromPoint(o, r), !0);
3729
- s !== c && (c = s, dt()), Ut(a, l.options, s, t);
3730
- }, 10), Ot = o, Pt = r);
3731
- } else {
3732
- if (!this.options.bubbleScroll || Ee(n, !0) === Ie()) {
3733
- dt();
3734
- return;
3735
- }
3736
- Ut(a, this.options, Ee(n, !1), !1);
3737
- }
3738
- }
3739
- }, Se(e, {
3740
- pluginName: "scroll",
3741
- initializeByDefault: !0
3742
- });
3743
- }
3744
- function dt() {
3745
- le.forEach(function(e) {
3746
- clearInterval(e.pid);
3747
- }), le = [];
3748
- }
3749
- function ia() {
3750
- clearInterval(Xe);
3751
- }
3752
- var Ut = _a(function(e, a, t, l) {
3753
- if (a.scroll) {
3754
- var o = (e.touches ? e.touches[0] : e).clientX, r = (e.touches ? e.touches[0] : e).clientY, n = a.scrollSensitivity, c = a.scrollSpeed, s = Ie(), v = !1, f;
3755
- Rt !== t && (Rt = t, dt(), Ke = a.scroll, f = a.scrollFn, Ke === !0 && (Ke = Ee(t, !0)));
3756
- var p = 0, i = Ke;
3757
- do {
3758
- var u = i, m = oe(u), g = m.top, k = m.bottom, d = m.left, C = m.right, B = m.width, M = m.height, $ = void 0, Z = void 0, j = u.scrollWidth, me = u.scrollHeight, ee = D(u), N = u.scrollLeft, S = u.scrollTop;
3759
- u === s ? ($ = B < j && (ee.overflowX === "auto" || ee.overflowX === "scroll" || ee.overflowX === "visible"), Z = M < me && (ee.overflowY === "auto" || ee.overflowY === "scroll" || ee.overflowY === "visible")) : ($ = B < j && (ee.overflowX === "auto" || ee.overflowX === "scroll"), Z = M < me && (ee.overflowY === "auto" || ee.overflowY === "scroll"));
3760
- var w = $ && (Math.abs(C - o) <= n && N + B < j) - (Math.abs(d - o) <= n && !!N), V = Z && (Math.abs(k - r) <= n && S + M < me) - (Math.abs(g - r) <= n && !!S);
3761
- if (!le[p])
3762
- for (var U = 0; U <= p; U++)
3763
- le[U] || (le[U] = {});
3764
- (le[p].vx != w || le[p].vy != V || le[p].el !== u) && (le[p].el = u, le[p].vx = w, le[p].vy = V, clearInterval(le[p].pid), (w != 0 || V != 0) && (v = !0, le[p].pid = setInterval((function() {
3765
- l && this.layer === 0 && O.active._onTouchMove(yt);
3766
- var L = le[this.layer].vy ? le[this.layer].vy * c : 0, W = le[this.layer].vx ? le[this.layer].vx * c : 0;
3767
- typeof f == "function" && f.call(O.dragged.parentNode[he], W, L, e, yt, le[this.layer].el) !== "continue" || wa(le[this.layer].el, W, L);
3768
- }).bind({
3769
- layer: p
3770
- }), 24))), p++;
3771
- } while (a.bubbleScroll && i !== s && (i = Ee(i, !1)));
3772
- Bt = v;
3773
- }
3774
- }, 30), Na = function(e) {
3775
- var a = e.originalEvent, t = e.putSortable, l = e.dragEl, o = e.activeSortable, r = e.dispatchSortableEvent, n = e.hideGhostForTarget, c = e.unhideGhostForTarget;
3776
- if (a) {
3777
- var s = t || o;
3778
- n();
3779
- var v = a.changedTouches && a.changedTouches.length ? a.changedTouches[0] : a, f = document.elementFromPoint(v.clientX, v.clientY);
3780
- c(), s && !s.el.contains(f) && (r("spill"), this.onSpill({
3781
- dragEl: l,
3782
- putSortable: t
3783
- }));
3784
- }
3785
- };
3786
- function Yt() {
3787
- }
3788
- Yt.prototype = {
3789
- startIndex: null,
3790
- dragStart: function(e) {
3791
- var a = e.oldDraggableIndex;
3792
- this.startIndex = a;
3793
- },
3794
- onSpill: function(e) {
3795
- var a = e.dragEl, t = e.putSortable;
3796
- this.sortable.captureAnimationState(), t && t.captureAnimationState();
3797
- var l = Ye(this.sortable.el, this.startIndex, this.options);
3798
- l ? this.sortable.el.insertBefore(a, l) : this.sortable.el.appendChild(a), this.sortable.animateAll(), t && t.animateAll();
3799
- },
3800
- drop: Na
3801
- };
3802
- Se(Yt, {
3803
- pluginName: "revertOnSpill"
3804
- });
3805
- function jt() {
3806
- }
3807
- jt.prototype = {
3808
- onSpill: function(e) {
3809
- var a = e.dragEl, t = e.putSortable, l = t || this.sortable;
3810
- l.captureAnimationState(), a.parentNode && a.parentNode.removeChild(a), l.animateAll();
3811
- },
3812
- drop: Na
3813
- };
3814
- Se(jt, {
3815
- pluginName: "removeOnSpill"
3816
- });
3817
- O.mount(new ro());
3818
- O.mount(jt, Yt);
3819
- function io(e) {
3820
- return e == null ? e : JSON.parse(JSON.stringify(e));
3821
- }
3822
- function so(e) {
3823
- Gt() && Aa(e);
3824
- }
3825
- function uo(e) {
3826
- Gt() ? ie(e) : ca(e);
3827
- }
3828
- let Va = null, Ea = null;
3829
- function sa(e = null, a = null) {
3830
- Va = e, Ea = a;
3831
- }
3832
- function co() {
3833
- return {
3834
- data: Va,
3835
- clonedData: Ea
3836
- };
3837
- }
3838
- const ua = Symbol("cloneElement");
3839
- function po(...e) {
3840
- var a, t;
3841
- const l = (a = Gt()) == null ? void 0 : a.proxy;
3842
- let o = null;
3843
- const r = e[0];
3844
- let [, n, c] = e;
3845
- Array.isArray(A(n)) || (c = n, n = null);
3846
- let s = null;
3847
- const {
3848
- immediate: v = !0,
3849
- clone: f = io,
3850
- forceFallback: p,
3851
- fallbackOnBody: i,
3852
- customUpdate: u
3853
- } = (t = A(c)) != null ? t : {};
3854
- function m(N) {
3855
- var S;
3856
- const { from: w, oldIndex: V, item: U } = N, L = Array.from(w.childNodes);
3857
- o = p && !i ? L.slice(0, -1) : L;
3858
- const W = A((S = A(n)) == null ? void 0 : S[V]), Y = f(W);
3859
- sa(W, Y), U[ua] = Y;
3860
- }
3861
- function g(N) {
3862
- const S = N.item[ua];
3863
- if (!Sl(S)) {
3864
- if (Ft(N.item), Ae(n)) {
3865
- const w = [...A(n)];
3866
- n.value = zt(w, N.newDraggableIndex, S);
3867
- return;
3868
- }
3869
- zt(A(n), N.newDraggableIndex, S);
3870
- }
3871
- }
3872
- function k(N) {
3873
- const { from: S, item: w, oldIndex: V, oldDraggableIndex: U, pullMode: L, clone: W } = N;
3874
- if (Qt(S, w, V), L === "clone") {
3875
- Ft(W);
3876
- return;
3877
- }
3878
- if (Ae(n)) {
3879
- const Y = [...A(n)];
3880
- n.value = Wt(Y, U);
3881
- return;
3882
- }
3883
- Wt(A(n), U);
3884
- }
3885
- function d(N) {
3886
- if (u) {
3887
- u(N);
3888
- return;
3889
- }
3890
- const { from: S, item: w, oldIndex: V, oldDraggableIndex: U, newDraggableIndex: L } = N;
3891
- if (Ft(w), Qt(S, w, V), Ae(n)) {
3892
- const W = [...A(n)];
3893
- n.value = Xt(
3894
- W,
3895
- U,
3896
- L
3897
- );
3898
- return;
3899
- }
3900
- Xt(A(n), U, L);
3901
- }
3902
- function C(N) {
3903
- const { newIndex: S, oldIndex: w, from: V, to: U } = N;
3904
- let L = null;
3905
- const W = S === w && V === U;
3906
- try {
3907
- if (W) {
3908
- let Y = null;
3909
- o == null || o.some((_e, se) => {
3910
- if (Y && (o == null ? void 0 : o.length) !== U.childNodes.length)
3911
- return V.insertBefore(Y, _e.nextSibling), !0;
3912
- const I = U.childNodes[se];
3913
- Y = U == null ? void 0 : U.replaceChild(_e, I);
3914
- });
3915
- }
3916
- } catch (Y) {
3917
- L = Y;
3918
- } finally {
3919
- o = null;
3920
- }
3921
- ca(() => {
3922
- if (sa(), L)
3923
- throw L;
3924
- });
3925
- }
3926
- const B = {
3927
- onUpdate: d,
3928
- onStart: m,
3929
- onAdd: g,
3930
- onRemove: k,
3931
- onEnd: C
3932
- };
3933
- function M(N) {
3934
- const S = A(r);
3935
- return N || (N = kl(S) ? Nl(S, l == null ? void 0 : l.$el) : S), N && !Dl(N) && (N = N.$el), N || Il("Root element not found"), N;
3936
- }
3937
- function $() {
3938
- var N;
3939
- const S = (N = A(c)) != null ? N : {}, { immediate: w, clone: V } = S, U = fa(S, ["immediate", "clone"]);
3940
- return Jt(U, (L, W) => {
3941
- Ol(L) && (U[L] = (Y, ..._e) => {
3942
- const se = co();
3943
- return Pl(Y, se), W(Y, ..._e);
3944
- });
3945
- }), El(
3946
- n === null ? {} : B,
3947
- U
3948
- );
3949
- }
3950
- const Z = (N) => {
3951
- N = M(N), s && j.destroy(), s = new O(N, $());
3952
- };
3953
- ne(
3954
- () => c,
3955
- () => {
3956
- s && Jt($(), (N, S) => {
3957
- s == null || s.option(N, S);
3958
- });
3959
- },
3960
- { deep: !0 }
3961
- );
3962
- const j = {
3963
- option: (N, S) => s == null ? void 0 : s.option(N, S),
3964
- destroy: () => {
3965
- s == null || s.destroy(), s = null;
3966
- },
3967
- save: () => s == null ? void 0 : s.save(),
3968
- toArray: () => s == null ? void 0 : s.toArray(),
3969
- closest: (...N) => s == null ? void 0 : s.closest(...N)
3970
- }, me = () => j == null ? void 0 : j.option("disabled", !0), ee = () => j == null ? void 0 : j.option("disabled", !1);
3971
- return uo(() => {
3972
- v && Z();
3973
- }), so(j.destroy), Ge({ start: Z, pause: me, resume: ee }, j);
3974
- }
3975
- const qt = [
3976
- "update",
3977
- "start",
3978
- "add",
3979
- "remove",
3980
- "choose",
3981
- "unchoose",
3982
- "end",
3983
- "sort",
3984
- "filter",
3985
- "clone",
3986
- "move",
3987
- "change"
3988
- ], mo = [
3989
- "clone",
3990
- "animation",
3991
- "ghostClass",
3992
- "group",
3993
- "sort",
3994
- "disabled",
3995
- "store",
3996
- "handle",
3997
- "draggable",
3998
- "swapThreshold",
3999
- "invertSwap",
4000
- "invertedSwapThreshold",
4001
- "removeCloneOnHide",
4002
- "direction",
4003
- "chosenClass",
4004
- "dragClass",
4005
- "ignore",
4006
- "filter",
4007
- "preventOnFilter",
4008
- "easing",
4009
- "setData",
4010
- "dropBubble",
4011
- "dragoverBubble",
4012
- "dataIdAttr",
4013
- "delay",
4014
- "delayOnTouchOnly",
4015
- "touchStartThreshold",
4016
- "forceFallback",
4017
- "fallbackClass",
4018
- "fallbackOnBody",
4019
- "fallbackTolerance",
4020
- "fallbackOffset",
4021
- "supportPointer",
4022
- "emptyInsertThreshold",
4023
- "scroll",
4024
- "forceAutoScrollFallback",
4025
- "scrollSensitivity",
4026
- "scrollSpeed",
4027
- "bubbleScroll",
4028
- "modelValue",
4029
- "tag",
4030
- "target",
4031
- "customUpdate",
4032
- ...qt.map((e) => `on${e.replace(/^\S/, (a) => a.toUpperCase())}`)
4033
- ], fo = X({
4034
- name: "VueDraggable",
4035
- model: {
4036
- prop: "modelValue",
4037
- event: "update:modelValue"
4038
- },
4039
- props: mo,
4040
- emits: ["update:modelValue", ...qt],
4041
- setup(e, { slots: a, emit: t, expose: l, attrs: o }) {
4042
- const r = qt.reduce((f, p) => {
4043
- const i = `on${p.replace(/^\S/, (u) => u.toUpperCase())}`;
4044
- return f[i] = (...u) => t(p, ...u), f;
4045
- }, {}), n = K(() => {
4046
- const f = Oa(e), { modelValue: p } = f, i = fa(f, ["modelValue"]), u = Object.entries(i).reduce((m, [g, k]) => {
4047
- const d = A(k);
4048
- return d !== void 0 && (m[g] = d), m;
4049
- }, {});
4050
- return Ge(Ge({}, r), Fl(Ge(Ge({}, o), u)));
4051
- }), c = K({
4052
- get: () => e.modelValue,
4053
- set: (f) => t("update:modelValue", f)
4054
- }), s = T(), v = Pa(
4055
- po(e.target || s, c, n)
4056
- );
4057
- return l(v), () => {
4058
- var f;
4059
- return Ua(e.tag || "div", { ref: s }, (f = a == null ? void 0 : a.default) == null ? void 0 : f.call(a, v));
4060
- };
4061
- }
4062
- }), vo = { class: "flex flex-col gap-6" }, go = {
4063
- key: 0,
4064
- class: "text-sm text-gray-500 flex items-center gap-1.5 -mb-2"
4065
- }, yo = { class: "flex items-center justify-between" }, bo = ["onClick"], ho = ["src"], _o = { class: "text-xs font-semibold uppercase bg-gray-100 rounded px-2 py-1" }, wo = { class: "font-medium" }, xo = {
4066
- key: 0,
4067
- class: "flex gap-8 my-6"
4068
- }, To = { class: "flex-1 min-w-0 flex flex-col gap-6" }, Io = { class: "grid grid-cols-2 gap-6" }, Co = {
4069
- key: 0,
4070
- class: "flex flex-col gap-2"
4071
- }, Fo = { class: "flex items-end gap-3" }, So = {
4072
- key: 0,
4073
- class: "flex flex-wrap gap-2"
4074
- }, ko = { class: "w-[300px] flex-shrink-0 flex flex-col gap-4" }, No = {
4075
- key: 0,
4076
- class: "flex flex-col gap-2"
4077
- }, Vo = { class: "flex gap-1.5" }, Eo = ["onClick"], Do = { class: "bg-gray-50 rounded-lg flex items-center justify-center py-10 px-6 min-h-[160px]" }, Oo = {
4078
- key: 0,
4079
- class: "bg-white rounded-lg shadow-sm px-5 py-2.5 max-w-full"
4080
- }, Po = { class: "text-sm font-semibold text-indigo-500 text-center break-words block" }, Uo = {
4081
- key: 0,
4082
- class: "text-xs text-gray-400 text-center break-words block mt-0.5"
4083
- }, Ao = {
4084
- key: 1,
4085
- class: "bg-white rounded-2xl shadow-sm px-5 py-4 flex flex-col items-start gap-2 min-w-[140px] max-w-[200px]"
4086
- }, Mo = ["src"], Ro = { class: "text-sm font-medium text-gray-800 text-left break-words" }, Bo = {
4087
- key: 2,
4088
- class: "text-xs text-gray-400 text-left break-words"
4089
- }, qo = {
4090
- key: 2,
4091
- class: "bg-white rounded-2xl shadow-md px-6 py-5 flex flex-col items-center gap-2 min-w-[140px] max-w-[200px]"
4092
- }, Go = ["src"], $o = { class: "text-base font-bold text-orange-500 text-center break-words" }, Lo = {
4093
- key: 2,
4094
- class: "text-xs text-gray-400 text-center break-words"
4095
- }, Yo = {
4096
- key: 1,
4097
- class: "flex flex-col gap-2"
4098
- }, jo = { class: "bg-gray-50 border rounded-lg flex flex-col items-center gap-3 py-6 px-4" }, Ho = ["src"], Ko = {
4099
- key: 1,
4100
- class: "text-xs font-medium text-gray-400"
4101
- }, Xo = { class: "border-4 border-red-500 rounded-lg p-3 flex items-center justify-center bg-white" }, Wo = { class: "text-center text-sm font-bold text-gray-900" }, zo = {
4102
- key: 2,
4103
- class: "text-center text-xs text-gray-500"
4104
- }, Qo = {
4105
- key: 1,
4106
- class: "text-gray-500"
4107
- }, Jo = {
4108
- key: 2,
4109
- class: "mt-2 flex gap-3"
4110
- }, Zo = /* @__PURE__ */ X({
4111
- __name: "PaymentCheckout",
4112
- props: {
4113
- terminal: {
4114
- type: Object,
4115
- required: !0
4116
- },
4117
- onUpdate: {
4118
- type: Function,
4119
- required: !0
4120
- }
4121
- },
4122
- setup(e) {
4123
- const a = e, t = () => (a.terminal.paymentCheckouts ?? []).map((w) => ({ ...w })).sort((w, V) => (w.sortOrder ?? 0) - (V.sortOrder ?? 0)), l = T(t());
4124
- ne(
4125
- () => a.terminal.paymentCheckouts,
4126
- () => {
4127
- l.value = t(), d.value = /* @__PURE__ */ new Set();
4128
- }
4129
- );
4130
- function o() {
4131
- l.value.forEach((w, V) => {
4132
- w.sortOrder = V;
4133
- });
4134
- }
4135
- const r = (w) => w.type === "ecr" || w.type === "ecr_qr", n = /* @__PURE__ */ new Set(["qr", "ecr_qr"]), c = (w) => n.has(w.type), s = {
4136
- card: "credit_card",
4137
- ecr: "credit_card"
4138
- }, v = (w) => s[w.type] ?? null, f = [
4139
- { value: "pos_v7", label: "POS V7" },
4140
- { value: "pos_v8", label: "POS V8" }
4141
- ], p = [
4142
- { value: "kiosk_v2", label: "KIOSK V2" }
4143
- ], i = a.terminal.deviceType === "KIOSK" ? p : f, u = i[0].value, m = T({}), g = (w) => m.value[w.id] ?? u;
4144
- function k(w, V) {
4145
- m.value = { ...m.value, [w.id]: V };
4146
- }
4147
- const d = T(/* @__PURE__ */ new Set()), C = (w) => d.value.has(w.id);
4148
- function B(w) {
4149
- const V = new Set(d.value);
4150
- V.has(w.id) ? V.delete(w.id) : V.add(w.id), d.value = V;
4151
- }
4152
- const M = T({});
4153
- function $(w) {
4154
- const V = (M.value[w.id] ?? "").trim().toUpperCase();
4155
- if (!V) return;
4156
- const U = w.fallbackCardTypes ?? [];
4157
- U.includes(V) || (w.fallbackCardTypes = [...U, V]), M.value[w.id] = "";
4158
- }
4159
- function Z(w, V) {
4160
- const U = (w.fallbackCardTypes ?? []).filter((L) => L !== V);
4161
- w.fallbackCardTypes = U.length > 0 ? U : null;
4162
- }
4163
- const j = {
4164
- card: "Card",
4165
- ecr: "ECR",
4166
- ecr_qr: "ECR QR",
4167
- qr: "QR",
4168
- scanpay: "Scan Pay"
4169
- }, me = (w) => w.action ? `${w.gateway} (${w.action})` : w.gateway;
4170
- async function ee() {
4171
- await a.onUpdate(a.terminal, l.value);
4172
- }
4173
- const N = $a();
4174
- function S() {
4175
- Ka(
4176
- N,
4177
- "Reset Payment Checkout",
4178
- "This will clear all customizations (display name, subtitle, icon, payment description, payment tagline, receipt payment name, sort order, enabled state) for every payment method on this terminal and restore the defaults. This action cannot be undone.",
4179
- async () => {
4180
- await a.onUpdate(a.terminal, []);
4181
- }
4182
- );
4183
- }
4184
- return (w, V) => {
4185
- const U = h("FmIcon"), L = h("FmTooltip"), W = h("FmSwitch"), Y = h("FmTextField"), _e = h("FmButton"), se = h("FmChip");
4186
- return y(), E("div", vo, [
4187
- l.value.length > 0 ? (y(), E("p", go, [
4188
- V[2] || (V[2] = Ue(" Drag the ", -1)),
4189
- b(U, {
4190
- class: "text-gray-400 mx-0.5",
4191
- name: "drag_indicator"
4192
- }),
4193
- V[3] || (V[3] = Ue(" handle to reorder payment checkouts ", -1))
4194
- ])) : R("", !0),
4195
- b(A(fo), {
4196
- modelValue: l.value,
4197
- "onUpdate:modelValue": V[1] || (V[1] = (I) => l.value = I),
4198
- handle: ".checkout-drag-handle",
4199
- class: "flex flex-col gap-6",
4200
- "drag-class": "dragging-card",
4201
- "ghost-class": "sortable-ghost-card",
4202
- onEnd: o
4203
- }, {
4204
- default: ae(() => [
4205
- (y(!0), E(re, null, ge(l.value, (I) => (y(), E("div", {
4206
- key: I.id,
4207
- class: Ht(["border rounded-lg px-6 flex flex-col gap-4", C(I) ? "py-6" : "py-3"])
4208
- }, [
4209
- x("div", yo, [
4210
- x("div", {
4211
- class: "flex items-center gap-3 flex-1 cursor-pointer select-none",
4212
- onClick: (H) => B(I)
4213
- }, [
4214
- b(U, {
4215
- class: "checkout-drag-handle cursor-grab text-gray-400",
4216
- name: "drag_indicator",
4217
- onClick: V[0] || (V[0] = Ma(() => {
4218
- }, ["stop"]))
4219
- }),
4220
- b(U, {
4221
- class: "text-gray-400",
4222
- name: C(I) ? "expand_less" : "expand_more"
4223
- }, null, 8, ["name"]),
4224
- b(L, {
4225
- variant: "plain",
4226
- placement: "top",
4227
- content: I.gateway,
4228
- "hide-arrow": !0
4229
- }, {
4230
- default: ae(() => [
4231
- x("img", {
4232
- class: "rounded-md m-auto border-transparent w-[32px] h-[32px]",
4233
- src: A(Ha)(I.gateway.toUpperCase())
4234
- }, null, 8, ho)
4235
- ]),
4236
- _: 2
4237
- }, 1032, ["content"]),
4238
- x("span", _o, pe(j[I.type] ?? I.type), 1),
4239
- x("span", wo, pe(me(I)), 1)
4240
- ], 8, bo),
4241
- b(W, {
4242
- modelValue: I.enabled,
4243
- "onUpdate:modelValue": (H) => I.enabled = H,
4244
- label: "Enabled"
4245
- }, null, 8, ["modelValue", "onUpdate:modelValue"])
4246
- ]),
4247
- C(I) ? (y(), E("div", xo, [
4248
- x("div", To, [
4249
- x("div", Io, [
4250
- b(Y, {
4251
- modelValue: I.displayName,
4252
- "onUpdate:modelValue": (H) => I.displayName = H,
4253
- label: "Display Name"
4254
- }, null, 8, ["modelValue", "onUpdate:modelValue"]),
4255
- b(Y, {
4256
- modelValue: I.subtitle,
4257
- "onUpdate:modelValue": (H) => I.subtitle = H,
4258
- label: "Subtitle",
4259
- "label-mark": "optional"
4260
- }, null, 8, ["modelValue", "onUpdate:modelValue"]),
4261
- b(Y, {
4262
- modelValue: I.icon,
4263
- "onUpdate:modelValue": (H) => I.icon = H,
4264
- label: "Icon URL",
4265
- "label-mark": "optional"
4266
- }, null, 8, ["modelValue", "onUpdate:modelValue"]),
4267
- b(Y, {
4268
- modelValue: I.paymentDescription,
4269
- "onUpdate:modelValue": (H) => I.paymentDescription = H,
4270
- label: "Payment Description",
4271
- "label-mark": "optional"
4272
- }, null, 8, ["modelValue", "onUpdate:modelValue"]),
4273
- b(Y, {
4274
- modelValue: I.paymentTagline,
4275
- "onUpdate:modelValue": (H) => I.paymentTagline = H,
4276
- label: "Payment Tagline",
4277
- "label-mark": "optional"
4278
- }, null, 8, ["modelValue", "onUpdate:modelValue"]),
4279
- b(Y, {
4280
- modelValue: I.receiptPaymentName,
4281
- "onUpdate:modelValue": (H) => I.receiptPaymentName = H,
4282
- label: "Receipt Payment Name",
4283
- "label-info": "Name printed on the receipt. Leave blank to use the default for this payment method.",
4284
- "label-mark": "optional"
4285
- }, null, 8, ["modelValue", "onUpdate:modelValue"])
4286
- ]),
4287
- r(I) ? (y(), E("div", Co, [
4288
- x("div", Fo, [
4289
- b(Y, {
4290
- modelValue: M.value[I.id],
4291
- "onUpdate:modelValue": (H) => M.value[I.id] = H,
4292
- class: "flex-1",
4293
- label: "Fallback Card Types",
4294
- "label-info": "Cards offered when a transaction falls back to the reconcile dialog. Default VISA, MASTERCARD.",
4295
- "label-mark": "optional",
4296
- onKeyup: Ra((H) => $(I), ["enter"])
4297
- }, null, 8, ["modelValue", "onUpdate:modelValue", "onKeyup"]),
4298
- b(_e, {
4299
- icon: "add",
4300
- onClick: (H) => $(I)
4301
- }, null, 8, ["onClick"])
4302
- ]),
4303
- (I.fallbackCardTypes ?? []).length > 0 ? (y(), E("div", So, [
4304
- (y(!0), E(re, null, ge(I.fallbackCardTypes ?? [], (H) => (y(), F(se, {
4305
- key: H,
4306
- label: H,
4307
- removable: !0,
4308
- onChipClosed: () => Z(I, H)
4309
- }, null, 8, ["label", "onChipClosed"]))), 128))
4310
- ])) : R("", !0)
4311
- ])) : R("", !0)
4312
- ]),
4313
- x("div", ko, [
4314
- A(i).length > 1 ? (y(), E("div", No, [
4315
- V[4] || (V[4] = x("span", { class: "text-xs font-medium text-gray-500" }, "Preview on", -1)),
4316
- x("div", Vo, [
4317
- (y(!0), E(re, null, ge(A(i), (H) => (y(), E("button", {
4318
- key: H.value,
4319
- type: "button",
4320
- class: Ht([
4321
- "rounded-md px-2.5 py-1 text-xs font-medium transition-colors mb-2",
4322
- g(I) === H.value ? "bg-orange-500 text-white" : "bg-gray-100 text-gray-600 hover:bg-gray-200"
4323
- ]),
4324
- onClick: (tr) => k(I, H.value)
4325
- }, pe(H.label), 11, Eo))), 128))
4326
- ])
4327
- ])) : R("", !0),
4328
- x("div", Do, [
4329
- g(I) === "pos_v7" ? (y(), E("div", Oo, [
4330
- x("span", Po, pe(I.displayName || "Payment Method"), 1),
4331
- I.subtitle ? (y(), E("span", Uo, pe(I.subtitle), 1)) : R("", !0)
4332
- ])) : g(I) === "pos_v8" ? (y(), E("div", Ao, [
4333
- I.icon ? (y(), E("img", {
4334
- key: 0,
4335
- src: I.icon,
4336
- class: "w-9 h-9 object-contain"
4337
- }, null, 8, Mo)) : v(I) ? (y(), F(U, {
4338
- key: 1,
4339
- class: "text-gray-700 text-2xl",
4340
- name: v(I)
4341
- }, null, 8, ["name"])) : R("", !0),
4342
- x("span", Ro, pe(I.displayName || "Payment Method"), 1),
4343
- I.subtitle ? (y(), E("span", Bo, pe(I.subtitle), 1)) : R("", !0)
4344
- ])) : (y(), E("div", qo, [
4345
- I.icon ? (y(), E("img", {
4346
- key: 0,
4347
- src: I.icon,
4348
- class: "w-9 h-9 object-contain"
4349
- }, null, 8, Go)) : v(I) ? (y(), F(U, {
4350
- key: 1,
4351
- class: "text-orange-500 text-3xl",
4352
- name: v(I)
4353
- }, null, 8, ["name"])) : R("", !0),
4354
- x("span", $o, pe(I.displayName || "Payment Method"), 1),
4355
- I.subtitle ? (y(), E("span", Lo, pe(I.subtitle), 1)) : R("", !0)
4356
- ]))
4357
- ]),
4358
- c(I) ? (y(), E("div", Yo, [
4359
- V[5] || (V[5] = x("span", { class: "mt-2 text-xs font-medium text-gray-500" }, "Payment QR Screen", -1)),
4360
- x("div", jo, [
4361
- I.icon ? (y(), E("img", {
4362
- key: 0,
4363
- src: I.icon,
4364
- class: "h-6 object-contain"
4365
- }, null, 8, Ho)) : (y(), E("span", Ko, pe(I.gateway), 1)),
4366
- x("div", Xo, [
4367
- b(U, {
4368
- name: "qr_code_2",
4369
- class: "text-6xl text-gray-800"
4370
- })
4371
- ]),
4372
- x("p", Wo, pe(I.paymentDescription || "Payment description"), 1),
4373
- I.paymentTagline ? (y(), E("p", zo, pe(I.paymentTagline), 1)) : R("", !0)
4374
- ])
4375
- ])) : R("", !0)
4376
- ])
4377
- ])) : R("", !0)
4378
- ], 2))), 128))
4379
- ]),
4380
- _: 1
4381
- }, 8, ["modelValue"]),
4382
- l.value.length === 0 ? (y(), E("div", Qo, " No payment methods configured for this terminal. ")) : R("", !0),
4383
- l.value.length > 0 ? (y(), E("div", Jo, [
4384
- b(_e, {
4385
- variant: "secondary",
4386
- label: "Reset",
4387
- icon: "restart_alt",
4388
- onclick: S
4389
- }),
4390
- b(_e, {
4391
- variant: "primary",
4392
- label: "Save",
4393
- icon: "save",
4394
- onclick: ee
4395
- })
4396
- ])) : R("", !0)
4397
- ]);
4398
- };
4399
- }
4400
- }), er = /* @__PURE__ */ Xa(Zo, [["__scopeId", "data-v-936ac426"]]), br = /* @__PURE__ */ X({
4401
- __name: "TerminalSetting",
4402
- props: {
4403
- terminalId: {
4404
- type: String,
4405
- required: !0
4406
- }
4407
- },
4408
- setup(e) {
4409
- const a = e, { tab: t } = wt({
4410
- tab: "information"
4411
- }), { isLoading: l, startAsyncCall: o } = je(!0), r = qa(), n = $t(), c = T();
4412
- async function s(u, m) {
4413
- o(async () => {
4414
- try {
4415
- await Me.updateById(a.terminalId, {
4416
- name: u.name,
4417
- status: u.status,
4418
- ecrs: u.ecrs ?? [],
4419
- gateways: u.gateways ?? [],
4420
- ecrIntegrations: u.ecrIntegrations ?? [],
4421
- qrIntegrations: u.qrIntegrations ?? [],
4422
- ...m ? { paymentCheckouts: m } : {}
4423
- }), c.value = await Me.readById(a.terminalId), n.open({
4424
- type: "success",
4425
- message: "Terminal updated successfully"
4426
- });
4427
- } catch (g) {
4428
- n.open({
4429
- type: "error",
4430
- title: "Error occurs when update terminal",
4431
- message: rt(g)
4432
- });
4433
- }
4434
- });
4435
- }
4436
- const v = [
4437
- {
4438
- label: "Information",
4439
- value: "information",
4440
- icon: "overview",
4441
- render: Wa
4442
- },
4443
- {
4444
- label: "Setting Request",
4445
- value: "settings",
4446
- icon: "settings",
4447
- render: Za,
4448
- onlyFor: ["TERMINAL"]
4449
- },
4450
- {
4451
- label: "SoftPos Gateway",
4452
- value: "softpos",
4453
- icon: "payment",
4454
- render: sn
4455
- },
4456
- {
4457
- label: "ECR Gateway",
4458
- value: "ecr",
4459
- icon: "point_of_sale",
4460
- render: vl,
4461
- onlyFor: ["POS", "KIOSK"]
4462
- },
4463
- {
4464
- label: "QR Gateway",
4465
- value: "qr",
4466
- icon: "qr_code",
4467
- render: wl,
4468
- onlyFor: ["POS", "KIOSK"]
4469
- },
4470
- {
4471
- label: "Payment Checkout",
4472
- value: "payment-checkout",
4473
- icon: "tune",
4474
- render: er,
4475
- onlyFor: ["KIOSK", "POS"]
4476
- }
4477
- ];
4478
- xt().currentCountry;
4479
- const f = K(() => {
4480
- var u;
4481
- return (u = v.find((m) => m.value === t.value)) == null ? void 0 : u.render;
4482
- });
4483
- async function p() {
4484
- o(async () => {
4485
- c.value = await Me.readById(a.terminalId);
4486
- });
4487
- }
4488
- const i = K(() => v.filter(
4489
- (u) => {
4490
- var m;
4491
- return !u.onlyFor || u.onlyFor.includes(((m = c.value) == null ? void 0 : m.deviceType) ?? "");
4492
- }
4493
- ));
4494
- return ie(p), (u, m) => {
4495
- var k, d;
4496
- const g = h("FmTabs");
4497
- return y(), F(Ga, {
4498
- title: `${(k = c.value) == null ? void 0 : k.deviceType} (${(d = c.value) == null ? void 0 : d._id})`,
4499
- loading: A(l),
4500
- onBack: A(r).back
4501
- }, {
4502
- default: ae(() => [
4503
- b(g, {
4504
- "model-value": A(t),
4505
- "onUpdate:modelValue": m[0] || (m[0] = (C) => Ae(t) ? t.value = C : null),
4506
- class: "mb-6",
4507
- items: i.value
4508
- }, null, 8, ["model-value", "items"]),
4509
- A(t) ? (y(), F(bt(f.value), ht(_t({ key: 0 }, {
4510
- terminal: c.value,
4511
- onUpdate: s
4512
- })), null, 16)) : R("", !0)
4513
- ]),
4514
- _: 1
4515
- }, 8, ["title", "loading", "onBack"]);
4516
- };
4517
- }
4518
- });
4519
- export {
4520
- br as default
4521
- };