@feedmepos/mf-payment 1.6.16-dev → 1.6.17-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 (51) hide show
  1. package/dist/{Actions.vue_vue_type_script_setup_true_lang-wXi4zlOF.js → Actions.vue_vue_type_script_setup_true_lang-DGfY2t-6.js} +1 -1
  2. package/dist/AdminRestaurantSelector.vue_vue_type_script_setup_true_lang-B3adh27R.js +890 -0
  3. package/dist/{Chargeback-CJqlNeMt.js → Chargeback-DAn-_ig0.js} +5 -5
  4. package/dist/{DocumentViewer.vue_vue_type_script_setup_true_lang-Ckul-6N5.js → DocumentViewer.vue_vue_type_script_setup_true_lang-BoYlG5gG.js} +1 -1
  5. package/dist/{OnboardForm-BXMmCslr.js → OnboardForm-CFmOBuJe.js} +5 -5
  6. package/dist/{OnboardForm-B4uFIDfL.js → OnboardForm-DHFAsJSI.js} +5 -5
  7. package/dist/{OnboardSubmission-DEdrkQIy.js → OnboardSubmission-BE9KwYCY.js} +2 -2
  8. package/dist/{OnboardSubmission-DTShUQzf.js → OnboardSubmission-DeB2CBUB.js} +5 -5
  9. package/dist/{PayoutAccount-3nq_6mVJ.js → PayoutAccount-C73lFaEx.js} +5 -5
  10. package/dist/{PayoutAccount-CPjDqMpd.js → PayoutAccount-DW9suPrv.js} +5 -5
  11. package/dist/{PayoutAccountSetting-BVgA9_0u.js → PayoutAccountSetting-LzIsoU_R.js} +6 -6
  12. package/dist/{Restaurant-DVj-b61o.js → Restaurant-CgxMZItP.js} +4 -4
  13. package/dist/{RestaurantSetting-7y0qkqkE.js → RestaurantSetting-COFAdaYk.js} +3 -3
  14. package/dist/{Settlement-Dg24FLXs.js → Settlement-CMUVS2mb.js} +3 -3
  15. package/dist/{Settlement-j77mmZXv.js → Settlement-CxSYpLHH.js} +4 -4
  16. package/dist/{SettlementTransactions-DqnFsNBQ.js → SettlementTransactions-BosItim0.js} +4 -4
  17. package/dist/{SettlementTransactions-PBQgs92s.js → SettlementTransactions-CP6daT2e.js} +4 -4
  18. package/dist/{Status.vue_vue_type_script_setup_true_lang-DhbTRCYM.js → Status.vue_vue_type_script_setup_true_lang-RGNNAi9t.js} +1 -1
  19. package/dist/{Terminal-BUDlYupd.js → Terminal-B1tijb4c.js} +5 -5
  20. package/dist/{TerminalSetting-CnfALKFc.js → TerminalSetting-cYSxA1sB.js} +4 -4
  21. package/dist/Transaction-A2Lryxwf.js +968 -0
  22. package/dist/{Transaction-Cvl6QATl.js → Transaction-CKAmdeTv.js} +10 -10
  23. package/dist/{TransactionOld-Cy2U8Hn4.js → TransactionOld-BxWF6sRD.js} +7 -7
  24. package/dist/api/business/index.d.ts +10 -0
  25. package/dist/api/restaurant/index.d.ts +7 -0
  26. package/dist/api/transaction/index.d.ts +5 -4
  27. package/dist/{app-Bv1eKatH.js → app-CKG0xR67.js} +29 -26
  28. package/dist/app.js +1 -1
  29. package/dist/{assets-DAh5KIbj.js → assets-Cfrp36Vb.js} +1 -1
  30. package/dist/components/AdminBusinessSelector.vue.d.ts +17 -0
  31. package/dist/components/AdminRestaurantSelector.vue.d.ts +1 -0
  32. package/dist/components/AdvancedFilter/AdvancedFilterPanel.vue.d.ts +21 -0
  33. package/dist/{grafana-CfbW-0Ri.js → grafana-EYkmncP1.js} +1 -1
  34. package/dist/{index-D_XLTy5p.js → index-Bs7nMxiZ.js} +1 -1
  35. package/dist/{index-FMXYkp6e.js → index-CTihFO70.js} +2 -2
  36. package/dist/{index-BP3lxBw_.js → index-CZqojfvs.js} +1 -1
  37. package/dist/{index-DyRqovBt.js → index-Cl0a8cQE.js} +1 -1
  38. package/dist/{index-BU3AY5BY.js → index-Cp6ofn99.js} +1 -1
  39. package/dist/{index-HB-taFPL.js → index-D20CJ8Ub.js} +1 -1
  40. package/dist/{index--DP2Qv9r.js → index-D7feQo05.js} +14 -5
  41. package/dist/{index-Ds4tJNkA.js → index-DNnQRgnm.js} +1 -1
  42. package/dist/index-Tu0z1D-j.js +27 -0
  43. package/dist/{index.vue_vue_type_script_setup_true_lang-BqUNz7vW.js → index.vue_vue_type_script_setup_true_lang-CKL7_NG8.js} +1 -1
  44. package/dist/package.json +2 -1
  45. package/dist/{payout-account-0jjiMCJQ.js → payout-account-C5nOcTf2.js} +3 -3
  46. package/dist/tsconfig.app.tsbuildinfo +1 -1
  47. package/dist/views/admin/transaction/composable/advancedFilter.d.ts +18 -0
  48. package/package.json +2 -1
  49. package/dist/AdminRestaurantSelector.vue_vue_type_script_setup_true_lang-CQSEq_3Z.js +0 -139
  50. package/dist/Transaction-C5oj2fA7.js +0 -690
  51. package/dist/index-AdfhP3iZ.js +0 -19
@@ -0,0 +1,968 @@
1
+ import { reactive as de, computed as S, defineComponent as $, useModel as me, ref as se, watch as q, resolveComponent as v, openBlock as f, createBlock as k, withCtx as D, createVNode as y, createElementVNode as I, unref as h, createElementBlock as N, Fragment as pe, renderList as fe, toDisplayString as J, createCommentVNode as ye, withModifiers as ge, mergeModels as oe, createTextVNode as ve, onMounted as be, onBeforeUnmount as he, isRef as L, h as E } from "vue";
2
+ import { t as B } from "./index-D7feQo05.js";
3
+ import { h as Y } from "./moment-h96o7c8I.js";
4
+ import { g as _e, b as re, p as R } from "./index-D20CJ8Ub.js";
5
+ import { g as Ie, a as Te, t as Se, _ as we, b as j } from "./assets-Cfrp36Vb.js";
6
+ import { u as Fe } from "./index-Cl0a8cQE.js";
7
+ import { _ as Ae } from "./AdminLayout.vue_vue_type_script_setup_true_lang-0Mf1MhAL.js";
8
+ import { _ as De } from "./AsyncButton.vue_vue_type_script_setup_true_lang-DcjzvYwT.js";
9
+ import { _ as xe } from "./SelectAll.vue_vue_type_script_setup_true_lang-BNZTqdoF.js";
10
+ import { useSnackbar as ke, useDialog as Ve } from "@feedmepos/ui-library";
11
+ import { w as le } from "./Modal-DB8M9o1T.js";
12
+ import { u as K } from "./error-K1CakhA9.js";
13
+ import { _ as Pe } from "./DateRangePicker.vue_vue_type_script_setup_true_lang-CDjdQf-E.js";
14
+ import { u as ae, k as Me, _ as Ne } from "./AdminRestaurantSelector.vue_vue_type_script_setup_true_lang-B3adh27R.js";
15
+ import { useI18n as $e, useCoreStore as Ce } from "@feedmepos/mf-common";
16
+ import { g as Ee } from "./grafana-EYkmncP1.js";
17
+ import { _ as Be } from "./index.vue_vue_type_script_setup_true_lang-CKL7_NG8.js";
18
+ import { _ as qe } from "./AutoCopyCell.vue_vue_type_script_setup_true_lang-DrBLdVka.js";
19
+ import { _ as ie } from "./TextInputDialog.vue_vue_type_script_setup_true_lang-BvGYVca0.js";
20
+ import { u as Oe, a as Re } from "./index-n58-Qewm.js";
21
+ import { h as ce } from "./app-CKG0xR67.js";
22
+ import { s as ue } from "./validator-CTlVogBQ.js";
23
+ const z = {
24
+ businessId: "",
25
+ restaurantId: "",
26
+ amount: null
27
+ };
28
+ function Ue() {
29
+ const n = de({ ...z }), a = S(() => {
30
+ let r = 0;
31
+ return n.businessId && r++, n.restaurantId && r++, n.amount !== null && n.amount !== void 0 && r++, r;
32
+ }), o = S(() => a.value > 0);
33
+ function m() {
34
+ Object.assign(n, { ...z });
35
+ }
36
+ function p(r) {
37
+ Object.assign(n, { ...r });
38
+ }
39
+ return {
40
+ filter: n,
41
+ activeCount: a,
42
+ hasActiveFilters: o,
43
+ reset: m,
44
+ apply: p,
45
+ defaultState: z
46
+ };
47
+ }
48
+ const ne = {
49
+ async readBusinessesWithPagination(n) {
50
+ return (await re().get("/payments/businesses", {
51
+ params: { ...n, limit: n.limit ?? 20 }
52
+ })).data;
53
+ },
54
+ async readBusinessById(n) {
55
+ return _e(
56
+ await re().get(`/payments/businesses/${n}`)
57
+ );
58
+ }
59
+ }, Ge = { class: "inline-flex rounded-md items-center gap-4 justify-center h-[30px] px-8 py-4 bg-fm-color-neutral-gray-100 cursor-pointer" }, Ke = { class: "fm-typo-en-body-md-600 select-none text-ellipsis overflow-hidden whitespace-nowrap" }, Le = { class: "relative min-w-[280px]" }, Ye = { class: "sticky top-0 py-8 bg-white translate-y-[-12px]" }, je = {
60
+ key: 0,
61
+ class: "px-8 py-12 text-center fm-typo-en-body-md-400 text-fm-color-neutral-gray-500"
62
+ }, ze = /* @__PURE__ */ $({
63
+ __name: "AdminBusinessSelector",
64
+ props: /* @__PURE__ */ oe({
65
+ label: {},
66
+ labelMark: {},
67
+ placeholder: {},
68
+ searchPlaceholder: {},
69
+ rules: {}
70
+ }, {
71
+ modelValue: { default: "" },
72
+ modelModifiers: {}
73
+ }),
74
+ emits: ["update:modelValue"],
75
+ setup(n) {
76
+ const a = n, o = me(n, "modelValue"), { t: m } = $e(), p = se(""), r = se("");
77
+ let V = null;
78
+ q(p, (c) => {
79
+ V && clearTimeout(V), V = setTimeout(() => r.value = c, 300);
80
+ });
81
+ const i = (c) => ({
82
+ label: c.name,
83
+ value: c._id
84
+ }), { data: x, isLoading: w } = ae({
85
+ queryKey: ["admin-businesses"],
86
+ queryFn: () => ne.readBusinessesWithPagination({ limit: 20 }).then((c) => c.data),
87
+ select: (c) => c.map(i)
88
+ }), { data: T, isLoading: u } = ae({
89
+ queryKey: S(() => [
90
+ "admin-businesses",
91
+ "search",
92
+ r.value
93
+ ]),
94
+ queryFn: () => ne.readBusinessesWithPagination({
95
+ limit: 20,
96
+ search: r.value
97
+ }).then((c) => c.data),
98
+ select: (c) => c.map(i),
99
+ enabled: S(() => r.value.length > 0),
100
+ placeholderData: Me
101
+ }), { data: P, isLoading: O } = ae({
102
+ queryKey: S(() => ["admin-businesses", o.value]),
103
+ queryFn: () => ne.readBusinessById(o.value).then((c) => c ? i(c) : null),
104
+ enabled: S(
105
+ () => !!o.value && !(x.value ?? []).some((c) => c.value === o.value)
106
+ )
107
+ }), d = S(() => x.value ?? []), F = S(
108
+ () => p.value ? T.value ?? [] : d.value
109
+ ), _ = S(
110
+ () => w.value || u.value || O.value
111
+ ), C = S(
112
+ () => d.value.find((c) => c.value === o.value) ?? P.value ?? void 0
113
+ ), U = S(
114
+ () => p.value && !_.value && F.value.length === 0
115
+ ), Q = (c) => {
116
+ o.value = c, p.value = "";
117
+ };
118
+ return (c, M) => {
119
+ const G = v("FmIcon"), W = v("FmCircularProgress"), H = v("FmSearch"), X = v("FmMenuItem"), Z = v("FmMenu"), ee = v("FmFormGroup");
120
+ return f(), k(ee, {
121
+ modelValue: o.value,
122
+ "onUpdate:modelValue": M[2] || (M[2] = (A) => o.value = A),
123
+ label: a.label ?? "Business",
124
+ "label-mark": a.labelMark,
125
+ rules: a.rules
126
+ }, {
127
+ default: D(() => [
128
+ y(Z, { "close-on-click": !0 }, {
129
+ "menu-button": D(() => {
130
+ var A;
131
+ return [
132
+ I("div", Ge, [
133
+ y(G, {
134
+ name: "business",
135
+ size: "sm"
136
+ }),
137
+ I("div", Ke, J(((A = C.value) == null ? void 0 : A.label) ?? a.placeholder ?? h(m)("payment.components.select")), 1),
138
+ _.value ? (f(), k(W, {
139
+ key: 0,
140
+ size: "md"
141
+ })) : C.value ? (f(), k(G, {
142
+ key: 1,
143
+ name: "close",
144
+ size: "sm",
145
+ onClick: M[0] || (M[0] = ge((te) => o.value = "", ["stop"]))
146
+ })) : (f(), k(G, {
147
+ key: 2,
148
+ name: "expand_more",
149
+ size: "sm"
150
+ }))
151
+ ])
152
+ ];
153
+ }),
154
+ default: D(() => [
155
+ I("div", Le, [
156
+ I("div", Ye, [
157
+ y(H, {
158
+ "model-value": p.value,
159
+ "onUpdate:modelValue": M[1] || (M[1] = (A) => p.value = A),
160
+ placeholder: a.searchPlaceholder ?? a.placeholder ?? h(m)("payment.components.select")
161
+ }, null, 8, ["model-value", "placeholder"])
162
+ ]),
163
+ (f(!0), N(pe, null, fe(F.value, (A) => (f(), k(X, {
164
+ key: A.value,
165
+ label: A.label,
166
+ sublabel: "Business",
167
+ onClick: (te) => Q(A.value)
168
+ }, null, 8, ["label", "onClick"]))), 128)),
169
+ U.value ? (f(), N("div", je, J(h(m)("payment.components.no_results")), 1)) : ye("", !0)
170
+ ])
171
+ ]),
172
+ _: 1
173
+ })
174
+ ]),
175
+ _: 1
176
+ }, 8, ["modelValue", "label", "label-mark", "rules"]);
177
+ };
178
+ }
179
+ }), Je = { class: "relative inline-flex" }, Qe = { class: "flex flex-col gap-6 px-4 py-6" }, We = { class: "flex gap-2 items-center justify-start" }, He = /* @__PURE__ */ $({
180
+ __name: "AdvancedFilterPanel",
181
+ props: /* @__PURE__ */ oe({
182
+ filter: {},
183
+ activeCount: {},
184
+ hasActiveFilters: { type: Boolean },
185
+ disable: { type: Boolean }
186
+ }, {
187
+ modelValue: { type: Boolean, default: !1 },
188
+ modelModifiers: {}
189
+ }),
190
+ emits: /* @__PURE__ */ oe(["apply", "reset"], ["update:modelValue"]),
191
+ setup(n, { emit: a }) {
192
+ const o = n, m = a, p = me(n, "modelValue"), r = de({ ...o.filter }), V = S({
193
+ get: () => r.amount != null ? String(r.amount) : "",
194
+ set: (T) => {
195
+ const u = Number(T);
196
+ r.amount = T === "" ? null : Number.isFinite(u) ? u : null;
197
+ }
198
+ });
199
+ q(p, (T) => {
200
+ T && Object.assign(r, { ...o.filter });
201
+ }), q(
202
+ () => r.businessId,
203
+ (T, u) => {
204
+ T !== u && (r.restaurantId = "");
205
+ }
206
+ );
207
+ function i() {
208
+ m("apply", { ...r }), p.value = !1;
209
+ }
210
+ function x() {
211
+ Object.assign(r, { ...z }), m("reset"), p.value = !1;
212
+ }
213
+ function w() {
214
+ p.value = !1;
215
+ }
216
+ return (T, u) => {
217
+ const P = v("FmButton"), O = v("FmBadge"), d = v("FmTextField"), F = v("FmSideSheet");
218
+ return f(), k(F, {
219
+ modelValue: p.value,
220
+ "onUpdate:modelValue": u[5] || (u[5] = (_) => p.value = _),
221
+ header: "Advanced filters",
222
+ "dismiss-away": "",
223
+ "onOn:clickedAway": w
224
+ }, {
225
+ "side-sheet-button": D(() => [
226
+ I("div", Je, [
227
+ y(P, {
228
+ variant: "plain",
229
+ size: "md",
230
+ "prepend-icon": "tune",
231
+ label: "Advanced filters"
232
+ }),
233
+ n.hasActiveFilters ? (f(), k(O, {
234
+ key: 0,
235
+ value: n.activeCount,
236
+ variant: "neutral",
237
+ class: "bg-fm-color-primary text-fm-color-typo-white"
238
+ }, null, 8, ["value"])) : ye("", !0)
239
+ ])
240
+ ]),
241
+ "side-sheet-footer": D(() => [
242
+ I("div", We, [
243
+ y(P, {
244
+ variant: "primary",
245
+ label: "Apply",
246
+ onClick: u[3] || (u[3] = (_) => i())
247
+ }),
248
+ y(P, {
249
+ variant: "secondary",
250
+ label: "Reset",
251
+ onClick: u[4] || (u[4] = (_) => x())
252
+ })
253
+ ])
254
+ ]),
255
+ default: D(() => [
256
+ I("div", Qe, [
257
+ y(ze, {
258
+ modelValue: r.businessId,
259
+ "onUpdate:modelValue": u[0] || (u[0] = (_) => r.businessId = _),
260
+ label: "Business",
261
+ placeholder: "All businesses",
262
+ "search-placeholder": "Search businesses"
263
+ }, null, 8, ["modelValue"]),
264
+ y(Ne, {
265
+ modelValue: r.restaurantId,
266
+ "onUpdate:modelValue": u[1] || (u[1] = (_) => r.restaurantId = _),
267
+ "business-id": r.businessId,
268
+ label: "Restaurant",
269
+ placeholder: "All restaurants",
270
+ "search-placeholder": "Search restaurants"
271
+ }, null, 8, ["modelValue", "business-id"]),
272
+ y(d, {
273
+ modelValue: V.value,
274
+ "onUpdate:modelValue": u[2] || (u[2] = (_) => V.value = _),
275
+ label: "Amount",
276
+ type: "number",
277
+ placeholder: "Exact amount",
278
+ disabled: n.disable
279
+ }, null, 8, ["modelValue", "disabled"])
280
+ ])
281
+ ]),
282
+ _: 1
283
+ }, 8, ["modelValue"]);
284
+ };
285
+ }
286
+ }), Xe = ["src"], Ze = /* @__PURE__ */ $({
287
+ __name: "Gateway",
288
+ props: {
289
+ row: {},
290
+ data: {}
291
+ },
292
+ setup(n) {
293
+ return (a, o) => {
294
+ const m = v("FmTooltip");
295
+ return f(), k(m, {
296
+ variant: "plain",
297
+ placement: "top",
298
+ content: n.row.original.gateway,
299
+ "hide-arrow": !0
300
+ }, {
301
+ default: D(() => [
302
+ I("img", {
303
+ class: "rounded-md m-auto border-transparent w-[32px] h-[32px]",
304
+ src: h(Ie)(n.row.original.gateway)
305
+ }, null, 8, Xe)
306
+ ]),
307
+ _: 1
308
+ }, 8, ["content"]);
309
+ };
310
+ }
311
+ }), et = ["src"], tt = /* @__PURE__ */ $({
312
+ __name: "Method",
313
+ props: {
314
+ row: {},
315
+ data: {}
316
+ },
317
+ setup(n) {
318
+ return (a, o) => {
319
+ const m = v("FmTooltip");
320
+ return f(), k(m, {
321
+ variant: "plain",
322
+ placement: "top",
323
+ content: n.row.original.method.issuer,
324
+ "hide-arrow": !0
325
+ }, {
326
+ default: D(() => [
327
+ I("img", {
328
+ class: "rounded-md m-auto border-transparent w-[32px] h-[32px]",
329
+ src: h(Te)(n.row.original.method.issuer, n.row.original.method.variant)
330
+ }, null, 8, et)
331
+ ]),
332
+ _: 1
333
+ }, 8, ["content"]);
334
+ };
335
+ }
336
+ }), at = /* @__PURE__ */ $({
337
+ __name: "Actions",
338
+ props: {
339
+ onAction: { type: Function },
340
+ transaction: {}
341
+ },
342
+ setup(n) {
343
+ const a = S(() => [
344
+ n.transaction.flags.query && {
345
+ label: "Query",
346
+ sublabel: "Perform transaction status inquriy",
347
+ icon: "question_answer",
348
+ action: "query"
349
+ },
350
+ n.transaction.flags.refund && {
351
+ label: "Refund",
352
+ sublabel: "Perform transaction refund request",
353
+ icon: "request_page",
354
+ action: "refund"
355
+ },
356
+ n.transaction.flags.notify && {
357
+ label: "Notify",
358
+ sublabel: "Perform webhook notification for transaction",
359
+ icon: "webhook",
360
+ action: "notify"
361
+ },
362
+ n.transaction.callbackResponse != null && {
363
+ label: "Show Transaction Metadata",
364
+ sublabel: "Display the transaction callback metadata in JSON.",
365
+ icon: "code",
366
+ action: "transactionMetadata"
367
+ },
368
+ {
369
+ label: "Log",
370
+ sublabel: "Inspect transaction historical actions, requests and responses.",
371
+ icon: "history",
372
+ action: "history"
373
+ },
374
+ {
375
+ label: "Set Pay ID",
376
+ sublabel: "Set a pay ID for this transaction",
377
+ icon: "receipt_long",
378
+ action: "setPayId"
379
+ },
380
+ {
381
+ label: "Set Gateway ID",
382
+ sublabel: "Set a gateway transaction ID",
383
+ icon: "link",
384
+ action: "setGatewayId"
385
+ }
386
+ ]);
387
+ return (o, m) => {
388
+ const p = v("FmIcon"), r = v("FmMenuItem"), V = v("FmMenu");
389
+ return f(), N("div", {
390
+ onClick: m[0] || (m[0] = (i) => {
391
+ i.stopPropagation();
392
+ })
393
+ }, [
394
+ y(V, null, {
395
+ "menu-button": D(() => [
396
+ y(p, { name: "settings" })
397
+ ]),
398
+ default: D(() => [
399
+ (f(!0), N(pe, null, fe(a.value.filter((i) => !!i), (i) => (f(), k(r, {
400
+ selectable: !0,
401
+ key: i.label,
402
+ sublabel: i.sublabel,
403
+ label: i.label,
404
+ icon: i.icon,
405
+ onclick: () => n.onAction(i.action)
406
+ }, null, 8, ["sublabel", "label", "icon", "onclick"]))), 128))
407
+ ]),
408
+ _: 1
409
+ })
410
+ ]);
411
+ };
412
+ }
413
+ }), nt = { class: "pb-24" }, st = {
414
+ key: 0,
415
+ class: "bg-gray-50 border border-gray-200 rounded-md p-16 text-xs font-mono overflow-auto max-h-[60vh]"
416
+ }, ot = {
417
+ key: 1,
418
+ class: "text-gray-500 text-sm"
419
+ }, rt = /* @__PURE__ */ $({
420
+ __name: "TransactionMetadataDialog",
421
+ props: {
422
+ transactionMetadata: {}
423
+ },
424
+ setup(n) {
425
+ const a = n, o = () => {
426
+ if (a.transactionMetadata == null)
427
+ return "No transaction metadata available.";
428
+ try {
429
+ return JSON.stringify(a.transactionMetadata, null, 2);
430
+ } catch {
431
+ return String(a.transactionMetadata);
432
+ }
433
+ };
434
+ return (m, p) => (f(), N("div", nt, [
435
+ a.transactionMetadata != null ? (f(), N("pre", st, J(o()), 1)) : (f(), N("div", ot, " No transaction metadata available for this transaction. "))
436
+ ]));
437
+ }
438
+ }), lt = { class: "flex items-center gap-1" }, it = /* @__PURE__ */ $({
439
+ __name: "BillSeqNumber",
440
+ props: {
441
+ row: {},
442
+ data: {}
443
+ },
444
+ setup(n) {
445
+ return (a, o) => {
446
+ const m = v("FmIcon");
447
+ return f(), N("span", lt, [
448
+ ve(J(n.row.original.seqNumber) + " ", 1),
449
+ y(m, {
450
+ size: "md",
451
+ name: "check",
452
+ color: "#16a34a"
453
+ })
454
+ ]);
455
+ };
456
+ }
457
+ }), ct = { class: "flex flex-row justify-between items-end mb-6" }, ut = { class: "flex flex-col" }, dt = { class: "flex items-start mb-2 gap-3" }, mt = { class: "flex gap-3" }, Ct = /* @__PURE__ */ $({
458
+ __name: "Transaction",
459
+ setup(n) {
460
+ const a = se(), { filter: o, activeCount: m, hasActiveFilters: p, reset: r, apply: V } = Ue(), { dateRange: i, searchKey: x, status: w, restaurantId: T, businessId: u } = Fe({
461
+ searchKey: "",
462
+ status: [R.F_PAYMENT_TRANSACTION_STATUS.Enum.SUCCESS],
463
+ dateRange: {
464
+ startDate: Y().startOf("day").format("YYYY-MM-DD"),
465
+ endDate: Y().endOf("day").format("YYYY-MM-DD")
466
+ },
467
+ restaurantId: "",
468
+ businessId: ""
469
+ }), P = [
470
+ {
471
+ label: "Success",
472
+ value: R.F_PAYMENT_TRANSACTION_STATUS.Enum.SUCCESS
473
+ },
474
+ {
475
+ label: "Refunded",
476
+ value: R.F_PAYMENT_TRANSACTION_STATUS.Enum.REFUNDED
477
+ },
478
+ {
479
+ label: "Process",
480
+ value: R.F_PAYMENT_TRANSACTION_STATUS.Enum.PENDING
481
+ },
482
+ {
483
+ label: "Pending Settlement",
484
+ value: R.F_PAYMENT_TRANSACTION_STATUS.Enum.PENDING_SETTLEMENT
485
+ },
486
+ {
487
+ label: "Failed",
488
+ value: R.F_PAYMENT_TRANSACTION_STATUS.Enum.FAILED
489
+ }
490
+ ], { sessionUser: O } = Ce(), d = ke(), F = Ve(), { getBillLink: _ } = Oe();
491
+ let C;
492
+ const U = () => {
493
+ C && (clearTimeout(C), C = void 0);
494
+ }, {
495
+ promptSuggestion: Q,
496
+ closeSuggestion: c
497
+ } = Re({
498
+ searchKey: x,
499
+ dateRange: i,
500
+ onBeforeApply: U
501
+ }), M = async (t, e) => {
502
+ const s = await B.readTransactions({
503
+ start: Y(i.value.startDate).startOf("day").toISOString(),
504
+ end: Y(i.value.endDate).endOf("day").toISOString(),
505
+ limit: t,
506
+ cursor: e,
507
+ status: w.value,
508
+ businessId: o.businessId || void 0,
509
+ restaurantId: o.restaurantId || void 0,
510
+ amount: o.amount ?? void 0,
511
+ search: x.value
512
+ });
513
+ return {
514
+ data: Se(s.data),
515
+ meta: s.meta
516
+ };
517
+ };
518
+ q([i, w], () => {
519
+ var t;
520
+ (t = a.value) == null || t.reset();
521
+ }), be(() => {
522
+ T.value && (o.restaurantId = T.value), u.value && (o.businessId = u.value);
523
+ }), q(() => o.restaurantId, (t) => {
524
+ T.value = t;
525
+ }), q(() => o.businessId, (t) => {
526
+ u.value = t;
527
+ }), q(x, () => {
528
+ U(), Q(), C = setTimeout(() => {
529
+ var t;
530
+ (t = a.value) == null || t.reset();
531
+ }, 700);
532
+ }), he(() => {
533
+ U(), c();
534
+ });
535
+ async function G(t) {
536
+ var s, g;
537
+ const e = (s = a.value) == null ? void 0 : s.pageData().at(t);
538
+ if (!e) {
539
+ d.open({
540
+ type: "error",
541
+ title: "Something went wrong",
542
+ message: "Fail to find transactions from the displayed transactions."
543
+ });
544
+ return;
545
+ }
546
+ try {
547
+ const l = await B.refetchTransaction({
548
+ transactionId: e.id
549
+ });
550
+ (g = a.value) == null || g.replaceData(t, j(l)), d.open({
551
+ type: "success",
552
+ title: "Transaction queried and updated successfully."
553
+ });
554
+ } catch (l) {
555
+ d.open({
556
+ type: "error",
557
+ title: "Fail to query transaction.",
558
+ message: K(l)
559
+ });
560
+ }
561
+ }
562
+ async function W(t) {
563
+ var s;
564
+ const e = (s = a.value) == null ? void 0 : s.pageData().at(t);
565
+ if (!e) {
566
+ d.open({
567
+ type: "error",
568
+ title: "Something went wrong",
569
+ message: "Fail to find transactions from the displayed transactions."
570
+ });
571
+ return;
572
+ }
573
+ le(
574
+ F,
575
+ "Refund Transaction",
576
+ "Are you sure to refund transaction? This action cannot be revert!",
577
+ async () => {
578
+ var g;
579
+ try {
580
+ const l = await B.refundTransaction({
581
+ transactionId: e.id,
582
+ reason: "portal transaction refund",
583
+ amount: e.fdoAmount
584
+ });
585
+ (g = a.value) == null || g.replaceData(t, j(l)), d.open({
586
+ type: "success",
587
+ title: "Transaction refund request initiated."
588
+ });
589
+ } catch (l) {
590
+ d.open({
591
+ type: "error",
592
+ title: "Fail to request refund transaction.",
593
+ message: K(l)
594
+ });
595
+ }
596
+ }
597
+ );
598
+ }
599
+ async function H(t) {
600
+ var s;
601
+ const e = (s = a.value) == null ? void 0 : s.pageData().at(t);
602
+ if (!e) {
603
+ d.open({
604
+ type: "error",
605
+ title: "Something went wrong",
606
+ message: "Fail to find transactions from the displayed transactions."
607
+ });
608
+ return;
609
+ }
610
+ le(
611
+ F,
612
+ "Notify Transaction",
613
+ "Are you sure to perform notify transaction?",
614
+ async () => {
615
+ try {
616
+ await B.renotifyTransaction(e.id), d.open({
617
+ type: "success",
618
+ title: "Transaction notify successfully."
619
+ });
620
+ } catch (g) {
621
+ d.open({
622
+ type: "error",
623
+ title: "Fail to notify transaction.",
624
+ message: K(g)
625
+ });
626
+ }
627
+ }
628
+ );
629
+ }
630
+ async function X(t) {
631
+ var g;
632
+ const e = (g = a.value) == null ? void 0 : g.pageData().at(t);
633
+ if (!e) {
634
+ d.open({
635
+ type: "error",
636
+ title: "Something went wrong",
637
+ message: "Fail to find transactions from the displayed transactions."
638
+ });
639
+ return;
640
+ }
641
+ const s = Ee(
642
+ [
643
+ {
644
+ type: "span",
645
+ queryKey: "transaction.id",
646
+ queryValue: e.id
647
+ }
648
+ ],
649
+ e.transactionAt
650
+ );
651
+ window.open(s, "_blank");
652
+ }
653
+ async function Z(t) {
654
+ var s;
655
+ const e = (s = a.value) == null ? void 0 : s.pageData().at(t);
656
+ if (!e) {
657
+ d.open({
658
+ type: "error",
659
+ title: "Something went wrong",
660
+ message: "Fail to find transactions from the displayed transactions."
661
+ });
662
+ return;
663
+ }
664
+ F.open({
665
+ title: "Set Pay ID",
666
+ closeButton: !0,
667
+ overlay: !0,
668
+ contentComponent: ie,
669
+ contentComponentProps: {
670
+ label: "Pay ID",
671
+ placeholder: "Enter Pay ID",
672
+ schema: ue().trim().min(1, "Pay ID is required")
673
+ }
674
+ }).onPrimary(async (g) => {
675
+ var l;
676
+ try {
677
+ const b = await B.bindPayId({
678
+ transactionId: e.id,
679
+ payId: g
680
+ });
681
+ (l = a.value) == null || l.replaceData(t, j(b)), d.open({
682
+ type: "success",
683
+ title: "Pay ID set successfully."
684
+ }), F.close();
685
+ } catch (b) {
686
+ d.open({
687
+ type: "error",
688
+ title: "Failed to set Pay ID.",
689
+ message: K(b)
690
+ });
691
+ }
692
+ });
693
+ }
694
+ async function ee(t) {
695
+ var s;
696
+ const e = (s = a.value) == null ? void 0 : s.pageData().at(t);
697
+ if (!e) {
698
+ d.open({
699
+ type: "error",
700
+ title: "Something went wrong",
701
+ message: "Fail to find transactions from the displayed transactions."
702
+ });
703
+ return;
704
+ }
705
+ F.open({
706
+ title: "Set Gateway ID",
707
+ closeButton: !0,
708
+ overlay: !0,
709
+ contentComponent: ie,
710
+ contentComponentProps: {
711
+ label: "Gateway Transaction ID",
712
+ placeholder: "Enter Gateway Transaction ID",
713
+ schema: ue().trim().min(1, "Gateway Transaction ID is required")
714
+ }
715
+ }).onPrimary(async (g) => {
716
+ var l;
717
+ try {
718
+ const b = await B.setGatewayId({
719
+ transactionId: e.id,
720
+ gatewayTransactionId: g
721
+ });
722
+ (l = a.value) == null || l.replaceData(t, j(b)), d.open({
723
+ type: "success",
724
+ title: "Gateway ID set successfully."
725
+ }), F.close();
726
+ } catch (b) {
727
+ d.open({
728
+ type: "error",
729
+ title: "Failed to set Gateway ID.",
730
+ message: K(b)
731
+ });
732
+ }
733
+ });
734
+ }
735
+ async function A(t) {
736
+ var s;
737
+ const e = (s = a.value) == null ? void 0 : s.pageData().at(t);
738
+ if (!e) {
739
+ d.open({
740
+ type: "error",
741
+ title: "Something went wrong",
742
+ message: "Fail to find transactions from the displayed transactions."
743
+ });
744
+ return;
745
+ }
746
+ F.open({
747
+ title: "Transaction Metadata",
748
+ closeButton: !0,
749
+ overlay: !0,
750
+ contentComponent: rt,
751
+ contentComponentProps: {
752
+ transactionMetadata: e.callbackResponse
753
+ }
754
+ });
755
+ }
756
+ const te = [
757
+ {
758
+ header: () => "Transaction ID",
759
+ accessorKey: "id",
760
+ cell: ({ cell: t }) => {
761
+ let e = "";
762
+ return ce(O.value) && t.row.original.transactionId && (e = `
763
+ ID: ${t.row.original.transactionId}`), E(qe, { data: t.getValue(), extra: e });
764
+ }
765
+ },
766
+ {
767
+ header: () => "Pay ID",
768
+ accessorKey: "payId",
769
+ cell: ({ cell: t, row: e }) => {
770
+ const s = _(e.original);
771
+ return s ? E(
772
+ "a",
773
+ {
774
+ href: s,
775
+ class: "text-blue-600 underline"
776
+ },
777
+ t.getValue()
778
+ ) : t.getValue();
779
+ }
780
+ },
781
+ {
782
+ header: () => "Bill",
783
+ accessorKey: "seqNumber",
784
+ cell: ({ cell: t, row: e }) => e.original.seqNumberBinded ? E(it, { row: e, data: t.getValue() }) : e.original.seqNumber
785
+ },
786
+ {
787
+ header: () => "Gateway",
788
+ accessorKey: "gateway",
789
+ meta: {
790
+ textAlign: "center"
791
+ },
792
+ cell: ({ cell: t, row: e }) => e.original.method ? E(Ze, { row: e, data: t.getValue() }) : ""
793
+ },
794
+ {
795
+ header: () => "Method",
796
+ accessorKey: "method",
797
+ meta: {
798
+ textAlign: "center"
799
+ },
800
+ cell: ({ cell: t, row: e }) => e.original.method ? E(tt, { row: e, data: t.getValue() }) : ""
801
+ },
802
+ {
803
+ header: () => "Gateway ID",
804
+ accessorKey: "gatewayTransactionId",
805
+ cell: ({ cell: t, row: e }) => e.original.status === "REFUNDED" ? e.original.gatewayRefundId : e.original.gatewayTransactionId
806
+ },
807
+ {
808
+ header: () => "Type",
809
+ accessorKey: "payFor",
810
+ meta: {
811
+ textAlign: "center"
812
+ }
813
+ },
814
+ {
815
+ header: () => "Status",
816
+ accessorKey: "status",
817
+ cell: ({ cell: t }) => E(we, { data: t.getValue() })
818
+ },
819
+ {
820
+ header: () => "Restaurant",
821
+ accessorKey: "restaurantId"
822
+ },
823
+ {
824
+ header: () => "Source",
825
+ accessorKey: "source",
826
+ cell: ({ cell: t, row: e }) => `(${e.original.sourceType}) ${e.original.source}`
827
+ },
828
+ {
829
+ header: () => "Transaction At",
830
+ accessorKey: "transactionAt",
831
+ meta: {
832
+ width: "180px"
833
+ }
834
+ },
835
+ {
836
+ header: () => "Sales Amount",
837
+ accessorKey: "amount",
838
+ cell: ({ cell: t, row: e }) => ce(O.value) && e.original.flags.isDelivery ? e.original.amount + "( " + e.original.gatewayAmount + ")" : e.original.amount
839
+ },
840
+ {
841
+ header: () => "Actions",
842
+ accessorKey: "actions",
843
+ cell: ({ row: t }) => {
844
+ var s;
845
+ const e = (s = a.value) == null ? void 0 : s.pageData().at(t.index);
846
+ if (!e) {
847
+ d.open({
848
+ type: "error",
849
+ title: "Something went wrong",
850
+ message: "Fail to find transactions from the displayed transactions."
851
+ });
852
+ return;
853
+ }
854
+ return E(at, {
855
+ transaction: e,
856
+ onAction: (g) => {
857
+ switch (g) {
858
+ case "notify":
859
+ return H(t.index);
860
+ case "query":
861
+ return G(t.index);
862
+ case "refund":
863
+ return W(t.index);
864
+ case "transactionMetadata":
865
+ return A(t.index);
866
+ case "history":
867
+ return X(t.index);
868
+ case "setPayId":
869
+ return Z(t.index);
870
+ case "setGatewayId":
871
+ return ee(t.index);
872
+ }
873
+ }
874
+ });
875
+ }
876
+ }
877
+ ];
878
+ return (t, e) => {
879
+ const s = v("FmSearch"), g = v("FmSelect");
880
+ return f(), k(Ae, {
881
+ title: "Transactions",
882
+ loading: !1
883
+ }, {
884
+ default: D(() => [
885
+ I("div", ct, [
886
+ I("div", ut, [
887
+ I("div", dt, [
888
+ y(s, {
889
+ "model-value": h(x),
890
+ "onUpdate:modelValue": e[0] || (e[0] = (l) => L(x) ? x.value = l : null),
891
+ class: "mr-8",
892
+ label: "Search",
893
+ "label-info": "Search by Transaction ID, Pay ID, Gateway Transaction ID, or Amount.",
894
+ placeholder: "Search Transactions ..."
895
+ }, null, 8, ["model-value"]),
896
+ y(g, {
897
+ modelValue: h(w),
898
+ "onUpdate:modelValue": e[2] || (e[2] = (l) => L(w) ? w.value = l : null),
899
+ class: "w-[300px]",
900
+ label: "Status",
901
+ "label-mark": "required",
902
+ multiselect: "",
903
+ items: P
904
+ }, {
905
+ "prepend-menu": D(() => [
906
+ y(xe, {
907
+ modelValue: h(w),
908
+ "onUpdate:modelValue": e[1] || (e[1] = (l) => L(w) ? w.value = l : null),
909
+ items: P
910
+ }, null, 8, ["modelValue"])
911
+ ]),
912
+ _: 1
913
+ }, 8, ["modelValue"])
914
+ ]),
915
+ I("div", mt, [
916
+ y(Pe, {
917
+ modelValue: h(i),
918
+ "onUpdate:modelValue": e[3] || (e[3] = (l) => L(i) ? i.value = l : null)
919
+ }, null, 8, ["modelValue"]),
920
+ y(He, {
921
+ filter: h(o),
922
+ "active-count": h(m),
923
+ "has-active-filters": h(p),
924
+ onApply: e[4] || (e[4] = (l) => {
925
+ var b;
926
+ h(V)(l), (b = a.value) == null || b.reset();
927
+ }),
928
+ onReset: e[5] || (e[5] = (l) => {
929
+ var b;
930
+ h(r)(), (b = a.value) == null || b.reset();
931
+ })
932
+ }, null, 8, ["filter", "active-count", "has-active-filters"])
933
+ ])
934
+ ]),
935
+ I("div", null, [
936
+ y(De, {
937
+ button: {
938
+ appendIcon: "file_download",
939
+ variant: "primary",
940
+ label: "Export"
941
+ },
942
+ handler: async () => {
943
+ var b;
944
+ const l = await ((b = a.value) == null ? void 0 : b.allData());
945
+ l != null && await h(B).downloadPortalTransactionReport(
946
+ h(i),
947
+ l
948
+ );
949
+ }
950
+ }, null, 8, ["handler"])
951
+ ])
952
+ ]),
953
+ y(Be, {
954
+ ref_key: "controller",
955
+ ref: a,
956
+ "column-defs": te,
957
+ "rows-defs": (l) => l,
958
+ paginate: M
959
+ }, null, 8, ["rows-defs"])
960
+ ]),
961
+ _: 1
962
+ });
963
+ };
964
+ }
965
+ });
966
+ export {
967
+ Ct as default
968
+ };