@feedmepos/mf-payment 1.0.0-beta.7 → 1.0.0-beta.9

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feedmepos/mf-payment",
3
- "version": "1.0.0-beta.7",
3
+ "version": "1.0.0-beta.9",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -1,379 +0,0 @@
1
- import { defineComponent as x, openBlock as I, createElementBlock as M, Fragment as $, createElementVNode as v, createTextVNode as T, toDisplayString as V, ref as g, onMounted as C, computed as D, resolveComponent as f, unref as b, createVNode as F, createBlock as w, withCtx as G, createCommentVNode as q, isRef as P, resolveDynamicComponent as R, normalizeProps as Y, mergeProps as K } from "vue";
2
- import { u as _, e as U } from "./index-4meiCsRz.js";
3
- import { useRouter as L } from "vue-router";
4
- import { t as S } from "./index-CBa6eapm.js";
5
- import { _ as j } from "./Layout.vue_vue_type_script_setup_true_lang-DJm5br5a.js";
6
- import { u as E } from "./index-BwFHcZlm.js";
7
- import { useSnackbar as A } from "@feedmepos/ui-library";
8
- import { u as z } from "./error-K1CakhA9.js";
9
- import { useCoreStore as N } from "@feedmepos/mf-common";
10
- const h = /* @__PURE__ */ x({
11
- __name: "Information",
12
- props: {
13
- terminal: {
14
- type: Object,
15
- required: !0
16
- }
17
- },
18
- setup(t) {
19
- return (r, a) => (I(), M($, null, [
20
- a[0] || (a[0] = v("b", null, "Name", -1)),
21
- T(": " + V(t.terminal.name), 1),
22
- a[1] || (a[1] = v("br", null, null, -1)),
23
- a[2] || (a[2] = v("b", null, "Status", -1)),
24
- T(": " + V(t.terminal.status), 1),
25
- a[3] || (a[3] = v("br", null, null, -1)),
26
- a[4] || (a[4] = v("b", null, "Device ID", -1)),
27
- T(": " + V(t.terminal.deviceId ?? "-"), 1),
28
- a[5] || (a[5] = v("br", null, null, -1)),
29
- a[6] || (a[6] = v("b", null, "Device Type", -1)),
30
- T(": " + V(t.terminal.deviceType ?? "-"), 1),
31
- a[7] || (a[7] = v("br", null, null, -1))
32
- ], 64));
33
- }
34
- }), H = {
35
- key: 0,
36
- class: "flex items-center justify-center min-h-[80vh]"
37
- }, Q = { class: "flex mt-6 space-x-6" }, J = /* @__PURE__ */ x({
38
- __name: "TerminalGateway",
39
- props: {
40
- terminal: {
41
- type: Object,
42
- required: !0
43
- },
44
- onUpdate: {
45
- type: Function,
46
- required: !0
47
- }
48
- },
49
- setup(t) {
50
- const { isLoading: r, startAsyncCall: a } = _(), o = t, s = g(), p = g(), n = g(-1), e = g({
51
- terminalId: ""
52
- });
53
- C(() => {
54
- if (a(async () => {
55
- s.value = await S.getTerminals(o.terminal.referenceId);
56
- }), !o.terminal.ecrs)
57
- return;
58
- const i = o.terminal.ecrs.findIndex((c) => c && c.gateway && c.gateway === "FeedMe");
59
- if (i === -1)
60
- return;
61
- n.value = i;
62
- const m = o.terminal.ecrs.at(i);
63
- m.gateway === "FeedMe" && m.config && (e.value = {
64
- terminalId: m.config.terminalId
65
- });
66
- });
67
- const u = D(() => (s.value ?? []).map((i) => ({
68
- label: i.name ?? i._id,
69
- value: i._id
70
- })));
71
- async function l(i) {
72
- var m;
73
- (m = o.terminal.ecrs) == null || m.splice(i, 1), o.onUpdate(o.terminal);
74
- }
75
- return (i, m) => {
76
- const c = f("FmCircularProgress"), y = f("FmSelect"), d = f("FmButton"), B = f("FmForm");
77
- return b(r) ? (I(), M("div", H, [
78
- F(c, { size: "xxl" })
79
- ])) : (I(), w(B, {
80
- key: 1,
81
- ref: p.value,
82
- class: "flex flex-col gap-16 w-[500px]",
83
- onValidationSuccess: m[1] || (m[1] = () => {
84
- n.value > -1 ? t.terminal.ecrs[n.value] = { gateway: "FeedMe", config: e.value } : (t.terminal.ecrs || (t.terminal.ecrs = []), t.terminal.ecrs.push({ gateway: "FeedMe", config: e.value })), o.onUpdate(t.terminal);
85
- })
86
- }, {
87
- default: G(() => [
88
- F(y, {
89
- modelValue: e.value.terminalId,
90
- "onUpdate:modelValue": m[0] || (m[0] = (k) => e.value.terminalId = k),
91
- label: "Terminal ID",
92
- items: u.value
93
- }, null, 8, ["modelValue", "items"]),
94
- v("div", Q, [
95
- n.value > -1 ? (I(), w(d, {
96
- key: 0,
97
- class: "flex-1",
98
- variant: "secondary",
99
- label: "Delete",
100
- onclick: () => l(n.value)
101
- }, null, 8, ["onclick"])) : q("", !0),
102
- F(d, {
103
- type: "submit",
104
- class: "flex-1",
105
- variant: "primary",
106
- label: "Save"
107
- })
108
- ])
109
- ]),
110
- _: 1
111
- }, 512));
112
- };
113
- }
114
- }), W = { class: "flex mt-6 space-x-6" }, X = /* @__PURE__ */ x({
115
- __name: "FiuuGateway",
116
- props: {
117
- terminal: {
118
- type: Object,
119
- required: !0
120
- },
121
- onUpdate: {
122
- type: Function,
123
- required: !0
124
- }
125
- },
126
- setup(t) {
127
- const r = t, a = N().currentCountry, o = [
128
- {
129
- label: "Fiuu Malaysia",
130
- value: "cc.feedme.payment.rms",
131
- region: U.F_COUNTRY.enum.MY
132
- },
133
- {
134
- label: "Fiuu Malaysia V2",
135
- value: "cc.feedme.payment.fiuu_my",
136
- region: U.F_COUNTRY.enum.MY
137
- },
138
- {
139
- label: "Fiuu Singapore",
140
- value: "cc.feedme.payment.fiuu_sg",
141
- region: U.F_COUNTRY.enum.SG
142
- }
143
- ], s = g(), p = g(-1), n = g({
144
- packageId: "",
145
- uniqueId: ""
146
- });
147
- C(() => {
148
- if (!r.terminal.gateways)
149
- return;
150
- const u = r.terminal.gateways.findIndex((i) => i && i.gateway && i.gateway === "Fiuu");
151
- if (u === -1)
152
- return;
153
- p.value = u;
154
- const l = r.terminal.gateways.at(u);
155
- l.gateway === "Fiuu" && l.config && (n.value = {
156
- packageId: l.config.packageId,
157
- uniqueId: l.config.uniqueId
158
- });
159
- });
160
- async function e(u) {
161
- var l;
162
- (l = r.terminal.gateways) == null || l.splice(u, 1), r.onUpdate(r.terminal);
163
- }
164
- return (u, l) => {
165
- const i = f("FmSelect"), m = f("FmTextField"), c = f("FmButton"), y = f("FmForm");
166
- return I(), w(y, {
167
- ref: s.value,
168
- class: "flex flex-col gap-16 w-[500px]",
169
- onValidationSuccess: l[2] || (l[2] = () => {
170
- p.value > -1 ? t.terminal.gateways[p.value] = { gateway: "Fiuu", config: n.value } : (t.terminal.gateways || (t.terminal.gateways = []), t.terminal.gateways.push({ gateway: "Fiuu", config: n.value })), r.onUpdate(t.terminal);
171
- })
172
- }, {
173
- default: G(() => [
174
- F(i, {
175
- modelValue: n.value.packageId,
176
- "onUpdate:modelValue": l[0] || (l[0] = (d) => n.value.packageId = d),
177
- label: "Package ID",
178
- items: o.filter((d) => d.region === b(a))
179
- }, null, 8, ["modelValue", "items"]),
180
- F(m, {
181
- modelValue: n.value.uniqueId,
182
- "onUpdate:modelValue": l[1] || (l[1] = (d) => n.value.uniqueId = d),
183
- label: "Unique ID"
184
- }, null, 8, ["modelValue"]),
185
- v("div", W, [
186
- p.value > -1 ? (I(), w(c, {
187
- key: 0,
188
- class: "flex-1",
189
- variant: "secondary",
190
- label: "Delete",
191
- onclick: () => e(p.value)
192
- }, null, 8, ["onclick"])) : q("", !0),
193
- F(c, {
194
- type: "submit",
195
- class: "flex-1",
196
- variant: "primary",
197
- label: "Save"
198
- })
199
- ])
200
- ]),
201
- _: 1
202
- }, 512);
203
- };
204
- }
205
- }), Z = { class: "flex mt-6 space-x-6" }, ee = /* @__PURE__ */ x({
206
- __name: "GhlGateway",
207
- props: {
208
- terminal: {
209
- type: Object,
210
- required: !0
211
- },
212
- onUpdate: {
213
- type: Function,
214
- required: !0
215
- }
216
- },
217
- setup(t) {
218
- const r = t, a = g(), o = g(-1), s = g({
219
- merchantId: "",
220
- terminalId: "",
221
- privateKey: ""
222
- });
223
- C(() => {
224
- if (!r.terminal.ecrs)
225
- return;
226
- const n = r.terminal.ecrs.findIndex((u) => u && u.gateway && u.gateway === "Ghl");
227
- if (n === -1)
228
- return;
229
- o.value = n;
230
- const e = r.terminal.ecrs.at(n);
231
- e.gateway === "Ghl" && e.config && (s.value = {
232
- merchantId: e.config.merchantId,
233
- terminalId: e.config.terminalId,
234
- privateKey: e.config.privateKey
235
- });
236
- });
237
- async function p(n) {
238
- var e;
239
- (e = r.terminal.ecrs) == null || e.splice(n, 1), r.onUpdate(r.terminal);
240
- }
241
- return (n, e) => {
242
- const u = f("FmTextField"), l = f("FmTextarea"), i = f("FmButton"), m = f("FmForm");
243
- return I(), w(m, {
244
- ref: a.value,
245
- class: "flex flex-col gap-16 w-[500px]",
246
- onValidationSuccess: e[3] || (e[3] = () => {
247
- o.value > -1 ? t.terminal.ecrs[o.value] = { gateway: "Ghl", config: s.value } : (t.terminal.ecrs || (t.terminal.ecrs = []), t.terminal.ecrs.push({ gateway: "Ghl", config: s.value })), r.onUpdate(t.terminal);
248
- })
249
- }, {
250
- default: G(() => [
251
- F(u, {
252
- modelValue: s.value.merchantId,
253
- "onUpdate:modelValue": e[0] || (e[0] = (c) => s.value.merchantId = c),
254
- label: "Merchant ID"
255
- }, null, 8, ["modelValue"]),
256
- F(u, {
257
- modelValue: s.value.terminalId,
258
- "onUpdate:modelValue": e[1] || (e[1] = (c) => s.value.terminalId = c),
259
- label: "Terminal ID"
260
- }, null, 8, ["modelValue"]),
261
- F(l, {
262
- modelValue: s.value.privateKey,
263
- "onUpdate:modelValue": e[2] || (e[2] = (c) => s.value.privateKey = c),
264
- label: "Private Key"
265
- }, null, 8, ["modelValue"]),
266
- v("div", Z, [
267
- o.value > -1 ? (I(), w(i, {
268
- key: 0,
269
- class: "flex-1",
270
- variant: "secondary",
271
- label: "Delete",
272
- onclick: () => p(o.value)
273
- }, null, 8, ["onclick"])) : q("", !0),
274
- F(i, {
275
- type: "submit",
276
- class: "flex-1",
277
- variant: "primary",
278
- label: "Save"
279
- })
280
- ])
281
- ]),
282
- _: 1
283
- }, 512);
284
- };
285
- }
286
- }), se = /* @__PURE__ */ x({
287
- __name: "TerminalSetting",
288
- props: {
289
- terminalId: {
290
- type: String,
291
- required: !0
292
- }
293
- },
294
- setup(t) {
295
- const r = t, { tab: a } = E({
296
- tab: "information"
297
- }), { isLoading: o, startAsyncCall: s } = _(!0), p = L(), n = A(), e = g();
298
- async function u(y) {
299
- try {
300
- await S.updateById(
301
- r.terminalId,
302
- {
303
- name: y.name,
304
- status: y.status,
305
- ecrs: y.ecrs ?? [],
306
- gateways: y.gateways ?? []
307
- }
308
- ), e.value = await S.readById(r.terminalId), n.open({
309
- type: "success",
310
- message: "Terminal updated successfully"
311
- });
312
- } catch (d) {
313
- n.open({
314
- type: "error",
315
- title: "Error occurs when update terminal",
316
- message: z(d)
317
- });
318
- }
319
- }
320
- const l = [
321
- {
322
- label: "Information",
323
- value: "information",
324
- icon: "overview",
325
- render: h
326
- },
327
- {
328
- label: "Fiuu",
329
- value: "fiuu",
330
- icon: "payment",
331
- render: X
332
- }
333
- ], i = N().currentCountry, m = D(() => {
334
- var y;
335
- return (y = l.find((d) => d.value === a.value)) == null ? void 0 : y.render;
336
- });
337
- async function c() {
338
- s(async () => {
339
- e.value = await S.readById(r.terminalId), e.value.deviceType !== "TERMINAL" && (l.push({
340
- label: "FeedMe Terminal",
341
- value: "terminal",
342
- icon: "shopping_cart_checkout",
343
- render: J
344
- }), i.value === U.F_COUNTRY.enum.MY && l.push({
345
- label: "GHL Terminal (V2)",
346
- value: "ghl",
347
- icon: "shopping_cart_checkout",
348
- render: ee
349
- }));
350
- });
351
- }
352
- return C(c), (y, d) => {
353
- var k;
354
- const B = f("FmTabs");
355
- return I(), w(j, {
356
- title: `Terminal (${(k = e.value) == null ? void 0 : k._id})`,
357
- loading: b(o),
358
- onBack: b(p).back
359
- }, {
360
- default: G(() => [
361
- F(B, {
362
- "model-value": b(a),
363
- "onUpdate:modelValue": d[0] || (d[0] = (O) => P(a) ? a.value = O : null),
364
- class: "mb-6",
365
- items: l
366
- }, null, 8, ["model-value"]),
367
- b(a) ? (I(), w(R(m.value), Y(K({ key: 0 }, {
368
- terminal: e.value,
369
- onUpdate: u
370
- })), null, 16)) : q("", !0)
371
- ]),
372
- _: 1
373
- }, 8, ["title", "loading", "onBack"]);
374
- };
375
- }
376
- });
377
- export {
378
- se as default
379
- };