@feedmepos/mf-payment 1.10.11-dev → 1.10.12-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 (53) hide show
  1. package/dist/{Actions.vue_vue_type_script_setup_true_lang-Ba62JNtX.js → Actions.vue_vue_type_script_setup_true_lang-DQ6b6ka6.js} +1 -1
  2. package/dist/{AdminBusinessSelector.vue_vue_type_script_setup_true_lang-CiC7BFU6.js → AdminBusinessSelector.vue_vue_type_script_setup_true_lang-o9d1MbP6.js} +3 -3
  3. package/dist/{AdminRestaurantSelector.vue_vue_type_script_setup_true_lang-ZMDAWdlD.js → AdminRestaurantSelector.vue_vue_type_script_setup_true_lang-DPX2tK6O.js} +3 -3
  4. package/dist/{Chargeback-hL9l4t6X.js → Chargeback-BK3Knpvw.js} +5 -5
  5. package/dist/{DocumentViewer.vue_vue_type_script_setup_true_lang-DaV-qIsZ.js → DocumentViewer.vue_vue_type_script_setup_true_lang-BHjfNVE1.js} +1 -1
  6. package/dist/ExternalTerminal-CjJ1_NWZ.js +611 -0
  7. package/dist/{OnboardForm-Cup1eGMr.js → OnboardForm-CC9evxPa.js} +6 -6
  8. package/dist/{OnboardForm-B33onChm.js → OnboardForm-fd3VsDJx.js} +6 -6
  9. package/dist/{OnboardSubmission-CjJwfCnB.js → OnboardSubmission-Bq17sJEw.js} +3 -3
  10. package/dist/{OnboardSubmission-D8pTRJIH.js → OnboardSubmission-Q3TFyj7q.js} +6 -6
  11. package/dist/{PaymentCheckout-DeByKvzM.js → PaymentCheckout-DuBWXJ7J.js} +2 -2
  12. package/dist/{PayoutAccount-Bep0AWo0.js → PayoutAccount-BtpxwPIL.js} +7 -7
  13. package/dist/{PayoutAccount-DPAlxhYF.js → PayoutAccount-JuYzRI09.js} +5 -5
  14. package/dist/{PayoutAccountSetting-CIhJDWMZ.js → PayoutAccountSetting-BUxg8C3e.js} +6 -6
  15. package/dist/{Restaurant-DuoRyfRM.js → Restaurant-CUXKmf5_.js} +4 -4
  16. package/dist/{RestaurantSetting-CKWhOYD_.js → RestaurantSetting-ahYgoZQu.js} +3 -3
  17. package/dist/{Settlement-D4mk_Dh_.js → Settlement-CUV-HfVC.js} +3 -3
  18. package/dist/{Settlement-BYlJL-Qf.js → Settlement-DPb549PU.js} +4 -4
  19. package/dist/{SettlementTransactions-BtoqmKaF.js → SettlementTransactions-DNNLmFfY.js} +5 -5
  20. package/dist/{SettlementTransactions-BDp7Mvyl.js → SettlementTransactions-l3b8YO2c.js} +5 -5
  21. package/dist/{Status.vue_vue_type_script_setup_true_lang-CFZkTn0t.js → Status.vue_vue_type_script_setup_true_lang-v7piP5aI.js} +1 -1
  22. package/dist/{Terminal-DNjey0vJ.js → Terminal-C8jwG3Cv.js} +6 -6
  23. package/dist/{TerminalSetting-D97s6Z9H.js → TerminalSetting-wW8AIAGH.js} +7 -7
  24. package/dist/{TerminalTemplate-BRMTKxoI.js → TerminalTemplate-DHiugzSC.js} +5 -5
  25. package/dist/{TerminalTemplateSetting-BlgjPfgJ.js → TerminalTemplateSetting-DA50VCKg.js} +5 -5
  26. package/dist/{Transaction-ColgVz3T.js → Transaction-CZRCv-3t.js} +12 -12
  27. package/dist/{Transaction-O6y_17OB.js → Transaction-CzTTkQri.js} +10 -10
  28. package/dist/{TransactionOld-CzSIxUvp.js → TransactionOld-D-4iUrDw.js} +7 -7
  29. package/dist/{TransactionStatus.vue_vue_type_script_setup_true_lang-ShIUJR66.js → TransactionStatus.vue_vue_type_script_setup_true_lang-CHcGrTSW.js} +1 -1
  30. package/dist/{app-BAWMgPng.js → app-BmFJOd-Z.js} +26 -26
  31. package/dist/app.js +1 -1
  32. package/dist/{assets-DpRHIHUV.js → assets-CTtKWVYg.js} +1 -1
  33. package/dist/{grafana-i9TOnOp3.js → grafana-DhemMHSo.js} +1 -1
  34. package/dist/{index-37hg7W-U.js → index-3wP84h0B.js} +1 -1
  35. package/dist/{index-USsjFRRS.js → index-BSmZ1Vyk.js} +1 -1
  36. package/dist/{index-DAwCO9gU.js → index-C8AxHnhC.js} +1 -1
  37. package/dist/{index-BkEELUbU.js → index-CUSLUawv.js} +2 -2
  38. package/dist/{index-Clo2fGK8.js → index-CVCyz5Yi.js} +1 -1
  39. package/dist/{index-D5iciXir.js → index-D4pYdk0h.js} +1 -1
  40. package/dist/{index-3_rp9LTo.js → index-DjHETHgh.js} +1 -1
  41. package/dist/{index-DJuBCXeS.js → index-Dtk_lPn7.js} +1 -1
  42. package/dist/{index-DklMuxhc.js → index-RC1zD9dC.js} +1 -1
  43. package/dist/{index-pGidyjmA.js → index-_O7z64Rk.js} +1 -1
  44. package/dist/{index-B3xfWJMG.js → index-fs6f3Sbe.js} +1 -1
  45. package/dist/{index.vue_vue_type_script_setup_true_lang-C4eHeaUk.js → index.vue_vue_type_script_setup_true_lang-DuAmnioV.js} +1 -1
  46. package/dist/{onboard-submission-VFceX0ZD.js → onboard-submission-D66nrLNT.js} +1 -1
  47. package/dist/package.json +1 -1
  48. package/dist/{payout-account-BvZ0kIU7.js → payout-account-DZIq3q35.js} +3 -3
  49. package/dist/tsconfig.app.tsbuildinfo +1 -1
  50. package/dist/{useQuery-CLUas412.js → useQuery-D4qzUQ-g.js} +1 -1
  51. package/dist/views/admin/external-terminal/config/BRITerminal.vue.d.ts +8 -0
  52. package/package.json +1 -1
  53. package/dist/ExternalTerminal-Dhc1VJjE.js +0 -596
@@ -3,7 +3,7 @@ var ft = (i) => {
3
3
  };
4
4
  var $ = (i, t, s) => t.has(i) || ft("Cannot " + s);
5
5
  var e = (i, t, s) => ($(i, t, "read from private field"), s ? s.call(i) : t.get(i)), f = (i, t, s) => t.has(i) ? ft("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(i) : t.set(i, s), u = (i, t, s, r) => ($(i, t, "write to private field"), r ? r.call(i, s) : t.set(i, s), s), c = (i, t, s) => ($(i, t, "access private method"), s);
6
- import { S as St, p as pt, r as g, s as q, a as W, n as Qt, e as bt, i as vt, t as It, b as J, f as Et, c as Dt, d as yt, g as Tt, j as Ft, l as Ut, u as mt, m as gt } from "./app-BAWMgPng.js";
6
+ import { S as St, p as pt, r as g, s as q, a as W, n as Qt, e as bt, i as vt, t as It, b as J, f as Et, c as Dt, d as yt, g as Tt, j as Ft, l as Ut, u as mt, m as gt } from "./app-BmFJOd-Z.js";
7
7
  import { hasInjectionContext as xt, inject as Mt, getCurrentScope as Pt, computed as jt, shallowReactive as kt, reactive as Lt, watch as X, onScopeDispose as _t, shallowReadonly as At, readonly as Vt, toRefs as Wt } from "vue";
8
8
  var v, n, z, b, T, M, w, Q, B, P, j, F, U, I, k, h, V, tt, et, st, it, nt, rt, at, wt, Ct, zt = (Ct = class extends St {
9
9
  constructor(t, s) {
@@ -1,14 +1,22 @@
1
1
  import { type PropType } from 'vue';
2
+ type BriConfigType = 'ZUS' | 'CUSTOM';
2
3
  declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
3
4
  initial: {
4
5
  type: PropType<Record<string, string>>;
5
6
  };
6
7
  }>, {
7
8
  values: () => {
9
+ configType: BriConfigType;
8
10
  wsUrl: string;
9
11
  mid: string;
10
12
  apiKey: string;
11
13
  privateKey: string;
14
+ } | {
15
+ configType: BriConfigType;
16
+ wsUrl?: undefined;
17
+ mid?: undefined;
18
+ apiKey?: undefined;
19
+ privateKey?: undefined;
12
20
  };
13
21
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
14
22
  initial: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feedmepos/mf-payment",
3
- "version": "1.10.11-dev",
3
+ "version": "1.10.12-dev",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -1,596 +0,0 @@
1
- import { defineComponent as E, openBlock as g, createElementBlock as O, toDisplayString as Y, resolveComponent as p, createBlock as V, withCtx as D, createElementVNode as w, unref as u, computed as S, normalizeClass as Z, createVNode as d, createCommentVNode as M, ref as c, Fragment as ee, useModel as te, watch as L, resolveDynamicComponent as W, mergeModels as H, createTextVNode as N, normalizeProps as ae, guardReactiveProps as re, isRef as ne, h as q } from "vue";
2
- import { h as le } from "./moment-h96o7c8I.js";
3
- import { useCoreStore as G } from "@feedmepos/mf-common";
4
- import { u as oe } from "./index-Clo2fGK8.js";
5
- import { _ as ie } from "./index.vue_vue_type_script_setup_true_lang-C4eHeaUk.js";
6
- import { _ as se } from "./AdminLayout.vue_vue_type_script_setup_true_lang-0Mf1MhAL.js";
7
- import { useSnackbar as Q, useDialogChild as ue, useDialog as me } from "@feedmepos/ui-library";
8
- import { e as R } from "./index-USsjFRRS.js";
9
- import { c as de } from "./clipboard-4jh1WteU.js";
10
- import { g as ce } from "./assets-DpRHIHUV.js";
11
- import { z as T, a as C } from "./validator-CTlVogBQ.js";
12
- import { _ as pe } from "./AdminRestaurantSelector.vue_vue_type_script_setup_true_lang-ZMDAWdlD.js";
13
- import { e as j, p as ve } from "./index-DAwCO9gU.js";
14
- import { u as z } from "./error-K1CakhA9.js";
15
- import { w as fe } from "./Modal-DB8M9o1T.js";
16
- const ye = /* @__PURE__ */ E({
17
- __name: "ID",
18
- props: {
19
- data: {}
20
- },
21
- setup(i) {
22
- const o = i, n = Q();
23
- function t() {
24
- try {
25
- de(o.data), n.open({ title: "Text copied to clipboard." }, 1e3);
26
- } catch {
27
- n.open({ title: "Clipboard API incompatible." }, 1e3);
28
- }
29
- }
30
- return (s, r) => (g(), O("div", {
31
- onClick: r[0] || (r[0] = (a) => {
32
- a.stopPropagation(), t();
33
- })
34
- }, Y(i.data), 1));
35
- }
36
- }), _e = ["src"], xe = /* @__PURE__ */ E({
37
- __name: "Provider",
38
- props: {
39
- row: {},
40
- data: {}
41
- },
42
- setup(i) {
43
- return (o, n) => {
44
- const t = p("FmTooltip");
45
- return g(), V(t, {
46
- variant: "plain",
47
- placement: "top",
48
- content: i.data ?? i.row.original.type,
49
- "hide-arrow": !0
50
- }, {
51
- default: D(() => [
52
- w("img", {
53
- class: "rounded-md border-transparent w-[32px] h-[32px]",
54
- src: u(ce)(i.data ?? i.row.original.type)
55
- }, null, 8, _e)
56
- ]),
57
- _: 1
58
- }, 8, ["content"]);
59
- };
60
- }
61
- }), ge = { class: "flex items-center gap-2" }, Fe = /* @__PURE__ */ E({
62
- __name: "Status",
63
- props: {
64
- data: {}
65
- },
66
- setup(i) {
67
- const o = i, n = S(
68
- () => o.data === "READY" ? "bg-green-400" : "bg-amber-400"
69
- );
70
- return (t, s) => (g(), O("div", ge, [
71
- w("div", {
72
- class: Z(["w-[8px] h-[8px] rounded-full shrink-0", n.value])
73
- }, null, 2),
74
- w("div", null, Y(i.data), 1)
75
- ]));
76
- }
77
- }), be = { class: "flex items-center justify-center" }, Ve = /* @__PURE__ */ E({
78
- __name: "Actions",
79
- props: {
80
- data: {}
81
- },
82
- emits: ["pair", "edit", "delete"],
83
- setup(i, { emit: o }) {
84
- const n = o;
85
- return (t, s) => {
86
- const r = p("FmButton"), a = p("FmTooltip");
87
- return g(), O("div", be, [
88
- i.data.status === "NEW" ? (g(), V(a, {
89
- key: 0,
90
- variant: "plain",
91
- placement: "top",
92
- content: "Pair",
93
- "hide-arrow": !0
94
- }, {
95
- default: D(() => [
96
- d(r, {
97
- variant: "plain",
98
- "prepend-icon": "link",
99
- onClick: s[0] || (s[0] = (m) => {
100
- m.stopPropagation(), n("pair");
101
- })
102
- })
103
- ]),
104
- _: 1
105
- })) : M("", !0),
106
- d(r, {
107
- variant: "plain",
108
- "prepend-icon": "edit",
109
- onClick: s[1] || (s[1] = (m) => {
110
- m.stopPropagation(), n("edit");
111
- })
112
- }),
113
- d(r, {
114
- variant: "plain",
115
- "prepend-icon": "delete",
116
- onClick: s[2] || (s[2] = (m) => {
117
- m.stopPropagation(), n("delete");
118
- })
119
- })
120
- ]);
121
- };
122
- }
123
- }), Te = /* @__PURE__ */ E({
124
- __name: "BRITerminal",
125
- props: {
126
- initial: {
127
- type: Object
128
- }
129
- },
130
- setup(i, { expose: o }) {
131
- var m, f, _, x;
132
- const n = i, t = c(((m = n.initial) == null ? void 0 : m.wsUrl) ?? ""), s = c(((f = n.initial) == null ? void 0 : f.mid) ?? ""), r = c(((_ = n.initial) == null ? void 0 : _.apiKey) ?? ""), a = c(((x = n.initial) == null ? void 0 : x.privateKey) ?? "");
133
- return o({
134
- values: () => ({
135
- wsUrl: t.value,
136
- mid: s.value,
137
- apiKey: r.value,
138
- privateKey: a.value
139
- })
140
- }), (I, b) => {
141
- const P = p("FmTextField"), h = p("FmTextarea");
142
- return g(), O(ee, null, [
143
- d(P, {
144
- modelValue: t.value,
145
- "onUpdate:modelValue": b[0] || (b[0] = (e) => t.value = e),
146
- label: "PVS WebSocket URL",
147
- placeholder: "wss://...",
148
- rules: u(T)(u(C).string().min(1, "WebSocket URL is required"))
149
- }, null, 8, ["modelValue", "rules"]),
150
- d(P, {
151
- modelValue: s.value,
152
- "onUpdate:modelValue": b[1] || (b[1] = (e) => s.value = e),
153
- label: "Merchant ID (MID)",
154
- rules: u(T)(u(C).string().min(1, "MID is required"))
155
- }, null, 8, ["modelValue", "rules"]),
156
- d(P, {
157
- modelValue: r.value,
158
- "onUpdate:modelValue": b[2] || (b[2] = (e) => r.value = e),
159
- label: "API Key",
160
- rules: u(T)(u(C).string().min(1, "API key is required"))
161
- }, null, 8, ["modelValue", "rules"]),
162
- d(h, {
163
- modelValue: a.value,
164
- "onUpdate:modelValue": b[3] || (b[3] = (e) => a.value = e),
165
- label: "Private Key",
166
- rows: 3,
167
- placeholder: "PEM, or base64 of the PEM",
168
- rules: u(T)(u(C).string().min(1, "Private key is required"))
169
- }, null, 8, ["modelValue", "rules"])
170
- ], 64);
171
- };
172
- }
173
- }), Ce = /* @__PURE__ */ E({
174
- __name: "ExternalTerminalSideSheet",
175
- props: /* @__PURE__ */ H({
176
- terminal: {
177
- type: Object
178
- }
179
- }, {
180
- modelValue: { type: Boolean, default: !1 },
181
- modelModifiers: {}
182
- }),
183
- emits: /* @__PURE__ */ H(["submit"], ["update:modelValue"]),
184
- setup(i, { emit: o }) {
185
- const n = G(), t = i, s = o, r = te(i, "modelValue"), a = c(), m = c(), f = c(""), _ = c(""), x = c(), I = c({}), b = {
186
- BEAM: [j.F_COUNTRY.enum.TH],
187
- BRI: [j.F_COUNTRY.enum.ID]
188
- }, P = {
189
- BRI: Te
190
- }, h = n.currentCountry, e = S(
191
- () => ve.FdoExternalTerminalProvider.options.filter(
192
- (v) => b[v].includes(h.value ?? j.F_COUNTRY.enum.MY)
193
- ).map((v) => ({
194
- label: v,
195
- value: v
196
- }))
197
- ), l = S(() => {
198
- var v;
199
- return ((v = t.terminal) == null ? void 0 : v.type) ?? x.value;
200
- }), y = S(
201
- () => l.value ? P[l.value] : void 0
202
- );
203
- L(r, (v) => {
204
- var F, U, A, $;
205
- v && (f.value = ((F = t.terminal) == null ? void 0 : F.name) ?? "", _.value = ((U = t.terminal) == null ? void 0 : U.restaurantId) ?? "", x.value = (A = t.terminal) == null ? void 0 : A.type, I.value = { ...(($ = t.terminal) == null ? void 0 : $.providerData) ?? {} });
206
- });
207
- function B() {
208
- s("submit", {
209
- name: f.value,
210
- restaurantId: _.value,
211
- type: x.value,
212
- providerData: m.value ? { ...I.value, ...m.value.values() } : void 0
213
- }), r.value = !1;
214
- }
215
- return (v, F) => {
216
- const U = p("FmSelect"), A = p("FmTextField"), $ = p("FmButton"), J = p("FmForm"), X = p("FmSideSheet");
217
- return g(), V(X, {
218
- modelValue: r.value,
219
- "onUpdate:modelValue": F[3] || (F[3] = (K) => r.value = K),
220
- header: t.terminal ? "Update External Terminal" : "Create New External Terminal",
221
- "close-button": ""
222
- }, {
223
- default: D(() => [
224
- d(J, {
225
- ref: a.value,
226
- class: "flex flex-col gap-16 px-4 py-6",
227
- onValidationSuccess: B
228
- }, {
229
- default: D(() => {
230
- var K;
231
- return [
232
- t.terminal ? M("", !0) : (g(), V(U, {
233
- key: 0,
234
- modelValue: x.value,
235
- "onUpdate:modelValue": F[0] || (F[0] = (k) => x.value = k),
236
- label: "Provider",
237
- items: e.value,
238
- rules: u(T)(u(C).string().min(1, "Provider is required"))
239
- }, null, 8, ["modelValue", "items", "rules"])),
240
- t.terminal ? M("", !0) : (g(), V(pe, {
241
- key: 1,
242
- modelValue: _.value,
243
- "onUpdate:modelValue": F[1] || (F[1] = (k) => _.value = k),
244
- label: "Restaurant",
245
- "search-placeholder": "Search restaurants",
246
- rules: u(T)(u(C).string().min(1, "Restaurant is required"))
247
- }, null, 8, ["modelValue", "rules"])),
248
- d(A, {
249
- modelValue: f.value,
250
- "onUpdate:modelValue": F[2] || (F[2] = (k) => f.value = k),
251
- label: "Terminal Name",
252
- rules: u(T)(u(C).string().min(1))
253
- }, null, 8, ["modelValue", "rules"]),
254
- y.value ? (g(), V(W(y.value), {
255
- key: `${((K = t.terminal) == null ? void 0 : K._id) ?? "new"}-${l.value}`,
256
- ref_key: "configForm",
257
- ref: m,
258
- initial: I.value
259
- }, null, 8, ["initial"])) : M("", !0),
260
- d($, {
261
- type: "submit",
262
- label: t.terminal ? "Update" : "Create"
263
- }, null, 8, ["label"])
264
- ];
265
- }),
266
- _: 1
267
- }, 512)
268
- ]),
269
- _: 1
270
- }, 8, ["modelValue", "header"]);
271
- };
272
- }
273
- }), we = { class: "t-caption" }, Ee = /* @__PURE__ */ E({
274
- __name: "BeamTerminal",
275
- props: {
276
- terminal: {
277
- type: Object,
278
- required: !0
279
- },
280
- onPair: {
281
- type: Function,
282
- required: !0
283
- }
284
- },
285
- setup(i) {
286
- const o = i, n = c(), t = c("");
287
- return (s, r) => {
288
- const a = p("FmTextField"), m = p("FmButton"), f = p("FmForm");
289
- return g(), V(f, {
290
- ref: n.value,
291
- class: "flex flex-col gap-16 mb-6",
292
- onValidationSuccess: r[1] || (r[1] = () => o.onPair({ type: "BEAM", pairCode: t.value }))
293
- }, {
294
- default: D(() => [
295
- w("div", we, [
296
- r[2] || (r[2] = N(" Enter the pairing code shown on ", -1)),
297
- w("b", null, Y(o.terminal.name), 1),
298
- r[3] || (r[3] = N(" to register it with Bolt Connect. ", -1))
299
- ]),
300
- d(a, {
301
- modelValue: t.value,
302
- "onUpdate:modelValue": r[0] || (r[0] = (_) => t.value = _),
303
- label: "Pair Code",
304
- "label-mark": "required",
305
- rules: u(T)(u(C).string().min(1, "Pair code is required"))
306
- }, null, 8, ["modelValue", "rules"]),
307
- d(m, {
308
- type: "submit",
309
- label: "Pair"
310
- })
311
- ]),
312
- _: 1
313
- }, 512);
314
- };
315
- }
316
- }), Pe = { class: "t-caption" }, Be = /* @__PURE__ */ E({
317
- __name: "BRITerminal",
318
- props: {
319
- terminal: {
320
- type: Object,
321
- required: !0
322
- },
323
- onPair: {
324
- type: Function,
325
- required: !0
326
- }
327
- },
328
- setup(i) {
329
- const o = i, n = c(), t = c(""), s = c("");
330
- return (r, a) => {
331
- const m = p("FmTextField"), f = p("FmButton"), _ = p("FmForm");
332
- return g(), V(_, {
333
- ref: n.value,
334
- class: "flex flex-col gap-16 mb-6",
335
- onValidationSuccess: a[2] || (a[2] = () => o.onPair({ type: "BRI", pairCode: t.value, edcId: s.value }))
336
- }, {
337
- default: D(() => [
338
- w("div", Pe, [
339
- a[3] || (a[3] = N(" Enter the pairing code and EDC ID shown on ", -1)),
340
- w("b", null, Y(o.terminal.name), 1),
341
- a[4] || (a[4] = N(" to register it with BRI. ", -1))
342
- ]),
343
- d(m, {
344
- modelValue: t.value,
345
- "onUpdate:modelValue": a[0] || (a[0] = (x) => t.value = x),
346
- label: "Pair Code",
347
- "label-mark": "required",
348
- rules: u(T)(u(C).string().min(1, "Pair code is required"))
349
- }, null, 8, ["modelValue", "rules"]),
350
- d(m, {
351
- modelValue: s.value,
352
- "onUpdate:modelValue": a[1] || (a[1] = (x) => s.value = x),
353
- label: "EDC ID",
354
- "label-mark": "required",
355
- rules: u(T)(u(C).string().min(1, "EDC ID is required"))
356
- }, null, 8, ["modelValue", "rules"]),
357
- d(f, {
358
- type: "submit",
359
- label: "Pair"
360
- })
361
- ]),
362
- _: 1
363
- }, 512);
364
- };
365
- }
366
- }), De = /* @__PURE__ */ E({
367
- __name: "ExternalTerminalPairDialog",
368
- props: {
369
- terminal: {
370
- type: Object,
371
- required: !0
372
- }
373
- },
374
- setup(i) {
375
- const o = i, n = ue(), t = {
376
- BEAM: Ee,
377
- BRI: Be
378
- }, s = S(() => t[o.terminal.type]);
379
- function r(a) {
380
- n.emitData(a), n.emitAction("primary");
381
- }
382
- return (a, m) => (g(), V(W(s.value), ae(re({
383
- terminal: o.terminal,
384
- onPair: r
385
- })), null, 16));
386
- }
387
- }), Ie = { class: "flex justify-between mb-6 items-center" }, Se = { class: "flex space-x-4" }, he = { class: "flex space-x-4" }, We = /* @__PURE__ */ E({
388
- __name: "ExternalTerminal",
389
- setup(i) {
390
- const o = c(), { searchKey: n } = oe({
391
- searchKey: ""
392
- });
393
- let t;
394
- L(n, async () => {
395
- t && clearTimeout(t), t = setTimeout(() => {
396
- var e;
397
- return (e = o.value) == null ? void 0 : e.reset();
398
- }, 700);
399
- });
400
- const s = G(), r = me(), a = Q();
401
- S(
402
- () => new Map(s.restaurants.value.map((e) => [e._id, e.profile.name]))
403
- );
404
- const m = c(!1), f = c();
405
- function _(e) {
406
- f.value = e, m.value = !0;
407
- }
408
- async function x(e) {
409
- var y;
410
- const l = f.value;
411
- try {
412
- l ? await R.updateById(
413
- l._id,
414
- e.type === "BRI" ? {
415
- type: "BRI",
416
- name: e.name,
417
- providerData: e.providerData
418
- } : { type: "BEAM", name: e.name }
419
- ) : await R.create(e), (y = o.value) == null || y.reset(), a.open({
420
- type: "success",
421
- message: l ? "External terminal updated successfully." : "External terminal created successfully."
422
- });
423
- } catch (B) {
424
- a.open({
425
- type: "error",
426
- title: l ? "Error occurs when update external terminal" : "Error occurs when create external terminal",
427
- message: z(B)
428
- });
429
- }
430
- }
431
- async function I(e) {
432
- r.open({
433
- title: "Pair External Terminal",
434
- closeButton: !0,
435
- overlay: !0,
436
- contentComponent: De,
437
- contentComponentProps: { terminal: e }
438
- }).onPrimary(async (l) => {
439
- var y;
440
- r.close();
441
- try {
442
- await R.pair(e._id, l), (y = o.value) == null || y.reset(), a.open({
443
- type: "success",
444
- message: "External terminal paired successfully."
445
- });
446
- } catch (B) {
447
- a.open({
448
- type: "error",
449
- title: "Error occurs when pair external terminal",
450
- message: z(B)
451
- });
452
- }
453
- });
454
- }
455
- async function b(e) {
456
- fe(
457
- r,
458
- "Delete External Terminal",
459
- "Are you sure to delete this external terminal? This action cannot be revert!",
460
- async () => {
461
- var l;
462
- try {
463
- await R.delete(e), (l = o.value) == null || l.reset(), a.open({
464
- type: "success",
465
- message: "External terminal deleted successfully."
466
- });
467
- } catch (y) {
468
- a.open({
469
- type: "error",
470
- title: "Error occurs when delete external terminal",
471
- message: z(y)
472
- });
473
- }
474
- }
475
- );
476
- }
477
- const P = function(e) {
478
- return {
479
- id: e._id,
480
- status: e.status,
481
- name: e.name,
482
- type: e.type,
483
- restaurant: e.restaurantId,
484
- updatedAt: le(e.updatedAt).format("YYYY-MM-DD HH:mm:ss")
485
- };
486
- }, h = [
487
- {
488
- accessorKey: "id",
489
- header: () => "Terminal ID",
490
- meta: {
491
- textAlign: "right"
492
- },
493
- cell: ({ cell: e }) => q(ye, { data: e.getValue() })
494
- },
495
- {
496
- accessorKey: "name",
497
- header: () => "Name",
498
- meta: {
499
- textAlign: "left"
500
- }
501
- },
502
- {
503
- accessorKey: "type",
504
- header: () => "Provider",
505
- meta: {
506
- textAlign: "left"
507
- },
508
- cell: ({ cell: e, row: l }) => q(xe, { row: l, data: e.getValue() })
509
- },
510
- {
511
- accessorKey: "restaurant",
512
- header: () => "Restaurant",
513
- meta: {
514
- textAlign: "left"
515
- }
516
- },
517
- {
518
- accessorKey: "status",
519
- header: () => "Status",
520
- meta: {
521
- textAlign: "left"
522
- },
523
- cell: ({ cell: e }) => q(Fe, { data: e.getValue() })
524
- },
525
- {
526
- accessorKey: "updatedAt",
527
- header: () => "Last Updated",
528
- meta: {
529
- textAlign: "left"
530
- }
531
- },
532
- {
533
- accessorKey: "id",
534
- header: () => "Actions",
535
- meta: {
536
- textAlign: "center"
537
- },
538
- cell: ({ row: e }) => {
539
- var y;
540
- const l = (y = o.value) == null ? void 0 : y.pageData().at(e.index);
541
- return q(Ve, {
542
- data: l,
543
- onPair: () => I(l),
544
- onEdit: () => _(l),
545
- onDelete: () => b(l._id)
546
- });
547
- }
548
- }
549
- ];
550
- return (e, l) => {
551
- const y = p("FmSearch"), B = p("FmButton");
552
- return g(), V(se, {
553
- title: "External Terminals",
554
- loading: !1
555
- }, {
556
- default: D(() => [
557
- w("div", Ie, [
558
- w("div", Se, [
559
- d(y, {
560
- "model-value": u(n),
561
- "onUpdate:modelValue": l[0] || (l[0] = (v) => ne(n) ? n.value = v : null),
562
- class: "mr-8",
563
- label: "Search",
564
- placeholder: "Search ..."
565
- }, null, 8, ["model-value"])
566
- ]),
567
- w("div", he, [
568
- d(B, {
569
- label: "Create",
570
- icon: "add",
571
- onClick: l[1] || (l[1] = () => _())
572
- })
573
- ])
574
- ]),
575
- d(ie, {
576
- ref_key: "controller",
577
- ref: o,
578
- "column-defs": h,
579
- "rows-defs": P,
580
- paginate: (v, F) => u(R).read({ searchKey: u(n), limit: v, cursor: F })
581
- }, null, 8, ["paginate"]),
582
- d(Ce, {
583
- modelValue: m.value,
584
- "onUpdate:modelValue": l[2] || (l[2] = (v) => m.value = v),
585
- terminal: f.value,
586
- onSubmit: x
587
- }, null, 8, ["modelValue", "terminal"])
588
- ]),
589
- _: 1
590
- });
591
- };
592
- }
593
- });
594
- export {
595
- We as default
596
- };