@feedmepos/mf-connect 0.1.0-beta.66 → 0.1.0-beta.67

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 (89) hide show
  1. package/dist/{Analytic-qA4z8oXA.js → Analytic-knY-Fody.js} +11 -11
  2. package/dist/{App-C7aTQumY.js → App-CaSjMnkY.js} +6 -6
  3. package/dist/{AuditLogs-CGNOBkHb.js → AuditLogs-DyJ0BWHt.js} +8 -8
  4. package/dist/{Bin-CG__7OUt.js → Bin-D73Ky2O3.js} +8 -8
  5. package/dist/{Broadcast-CLruasW_.js → Broadcast-BRMyf2ZA.js} +9 -9
  6. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CrcJck_6.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-D-0I_Pp2.js} +6 -6
  7. package/dist/{Card-B951ldXp.js → Card-BEgNn8SY.js} +15 -15
  8. package/dist/{Collections-BtlCNx3z.js → Collections-C0KqBg5k.js} +5 -5
  9. package/dist/{Credit-BZsoXFf2.js → Credit-D3Y1U0-i.js} +9 -9
  10. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-D45iEZB9.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-BJ7AzlQk.js} +28 -28
  11. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-DWVNiM12.js → EffectSheet.vue_vue_type_style_index_0_lang-C9JgRiyA.js} +6 -6
  12. package/dist/{Experience-CDopsRy4.js → Experience-B0LMRyXY.js} +9 -9
  13. package/dist/{Game-BAcfiQYQ.js → Game-Bz0eGUGe.js} +10 -10
  14. package/dist/{Index-pUUcfJG6.js → Index-DV7FO6TN.js} +10 -10
  15. package/dist/{Marketing-B2m2qaPW.js → Marketing-xdKdn8qo.js} +6 -6
  16. package/dist/{Member-f_0PDS3d.js → Member-CGDUgKb7.js} +5 -5
  17. package/dist/{MemberList-DzXksRbS.js → MemberList-D1OLQAcR.js} +24 -24
  18. package/dist/{MemberTransactions-BOz9RcNa.js → MemberTransactions-DO59eyLa.js} +1 -1
  19. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-9a5KeQZw.js → MessageInput.vue_vue_type_script_setup_true_lang-bBjpPoOo.js} +2 -2
  20. package/dist/{Mission-DfS_PBQh.js → Mission-CZvAG4ev.js} +10 -10
  21. package/dist/{Overview-CI_l3q96.js → Overview-DMCKeCar.js} +17 -17
  22. package/dist/{Point-C7PGnD6A.js → Point-BMyDzFyO.js} +9 -9
  23. package/dist/{Promotion-LQ3CcnKf.js → Promotion-D1nOUTxD.js} +10 -10
  24. package/dist/{Queue-B-5Htw8F.js → Queue-CGl0yzB4.js} +9 -9
  25. package/dist/{Record-tdoCC6Q2.js → Record-BGmigp0Z.js} +7 -7
  26. package/dist/{Reward-BLbrOk5l.js → Reward-ZYXuU6-e.js} +15 -15
  27. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-CE6LNYst.js → RewardGroup.vue_vue_type_script_setup_true_lang-C02Mj9a0.js} +11 -11
  28. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-BwDrUTBE.js → RuleGroup.vue_vue_type_script_setup_true_lang-DGS3_lis.js} +12 -12
  29. package/dist/{Segment-D_llTHgX.js → Segment-BXxgrHVs.js} +14 -14
  30. package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-D0_nxZt7.js → SelectItems.vue_vue_type_script_setup_true_lang-CSVXVt5K.js} +2 -2
  31. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-Cl42-qVq.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-D9dpqYTQ.js} +11 -11
  32. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-DzxHnXxH.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-CM9312dS.js} +3 -3
  33. package/dist/{Setting-Cwu5jYCw.js → Setting-B3HficZP.js} +10 -10
  34. package/dist/{Store-Cz9keX2h.js → Store-CWhmG8qW.js} +18 -18
  35. package/dist/{StoreRewards-CQoPI6q2.js → StoreRewards-6Cjh9q4d.js} +13 -13
  36. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-CTUT_564.js +1028 -0
  37. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-CQxAUR0g.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-B059fdPj.js} +1 -1
  38. package/dist/{Tier-DNhxAvgO.js → Tier-qm79T_vU.js} +19 -19
  39. package/dist/{Title-TU37yYD3.js → Title-DOWrRYW8.js} +19 -19
  40. package/dist/{Transaction-CXNdyrEw.js → Transaction-DW7bUI7j.js} +2 -2
  41. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-Bry9Cx63.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-38On7ek-.js} +6 -6
  42. package/dist/{Voucher-DWEHALVf.js → Voucher-BJBXjxZV.js} +12 -12
  43. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-_3vYdQ2o.js → VoucherEditor.vue_vue_type_script_setup_true_lang-DzdxjFhD.js} +10 -10
  44. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-CvauAsYH.js → ZodTextField.vue_vue_type_script_setup_true_lang-CJ_O28uk.js} +1 -1
  45. package/dist/{app-CBaOaB0Y.js → app-BLFTLZqS.js} +1 -1
  46. package/dist/{app-CafiCGL-.js → app-CHUmGvDF.js} +31 -31
  47. package/dist/app.js +1 -1
  48. package/dist/{business-BS3v6YTN.js → business-Dl7vGxa1.js} +1 -1
  49. package/dist/{campaign-BDy9rv65.js → campaign-DMIBFpmQ.js} +9 -9
  50. package/dist/{campaign-CpbtU65W.js → campaign-XH_j4bGc.js} +2 -2
  51. package/dist/{campaign.enum-CL-nppco.js → campaign.enum-UniuuBvU.js} +1 -1
  52. package/dist/{campaign.fn-vUFe-Ci_.js → campaign.fn-CDC2Cia7.js} +41 -41
  53. package/dist/{collectible.enum-xPy2ipsP.js → collectible.enum-Dx_pgMB9.js} +1 -1
  54. package/dist/{collection.fn-DqapwsNH.js → collection.fn-D0nutrYu.js} +2 -2
  55. package/dist/{dto-QGIgn68i.js → dto-BAPti0UX.js} +4 -4
  56. package/dist/{effect-CfOoWCqd.js → effect-By6CZhli.js} +1 -1
  57. package/dist/{email-addresses-U5r12yoQ.js → email-addresses-DPBu_l0s.js} +1 -1
  58. package/dist/{export-cpRpof7z.js → export-C6IKCW8q.js} +3 -3
  59. package/dist/{helper-CtL67QEh.js → helper-KCTyvhjf.js} +1 -1
  60. package/dist/{index-affW4TP6.js → index-BHB9VPNm.js} +1 -1
  61. package/dist/{index-DuQNcYf-.js → index-BVcdkWyy.js} +3 -3
  62. package/dist/{index-B83ld1mU.js → index-C-HL3cGP.js} +4 -4
  63. package/dist/{index-BvglqVyD.js → index-C9bN_nRJ.js} +1 -1
  64. package/dist/{index-C-vMl6Kr.js → index-D8dh7Th8.js} +1 -1
  65. package/dist/{index-DZuC2F0P.js → index-DDCO8cDG.js} +2 -2
  66. package/dist/{index-ZxKk7MYO.js → index-DQxldvxq.js} +447 -433
  67. package/dist/{index-Do2SoeRZ.js → index-DxT_ZaWI.js} +6 -6
  68. package/dist/index-Sw_FxWmd.js +56 -0
  69. package/dist/{index-BzRhALtt.js → index-VPs9NXB7.js} +3 -3
  70. package/dist/{index-CXvV3G36.js → index-_Fw2-H-c.js} +1 -1
  71. package/dist/{index-BsP-LQYt.js → index-e0vKYT8t.js} +1 -1
  72. package/dist/{index.esm2017-jpoP-yRM.js → index.esm2017-CiHGwLIY.js} +1 -1
  73. package/dist/{loading-DcGdfsoz.js → loading-CmczlXAc.js} +1 -1
  74. package/dist/{membership-DhCkKPOO.js → membership-D-uWTsu-.js} +3 -3
  75. package/dist/{money-DboCLxej.js → money-BhXbOy-4.js} +1 -1
  76. package/dist/{number-K1ji1IoW.js → number-CT16ZbSb.js} +1 -1
  77. package/dist/{objectid-Cc7E5d2n.js → objectid-BGQHcha_.js} +1 -1
  78. package/dist/{plugins-B5gL5isZ.js → plugins-uP-mKUTQ.js} +1189 -1189
  79. package/dist/{reward-CHe0ykFc.js → reward-D7tB215Q.js} +1 -1
  80. package/dist/{rule-DowxXd1h.js → rule-LLXbjCSc.js} +3 -3
  81. package/dist/{rule-builder-sLbnSXHF.js → rule-builder-yxSBBeW6.js} +1 -1
  82. package/dist/{template-lHBEbcoH.js → template-BRXG9AbZ.js} +4 -4
  83. package/dist/{trigger-RTj0D-17.js → trigger-BQTtyAtM.js} +4 -4
  84. package/dist/{user-BKgtbkUe.js → user-BzRp43jn.js} +1 -1
  85. package/dist/{vue-i18n-z4cJdBAC.js → vue-i18n-7zGNsm-H.js} +357 -357
  86. package/dist/{xlsx-CA2EAxRf.js → xlsx-mkBvYNNs.js} +1 -1
  87. package/package.json +1 -1
  88. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-OnkH5kCm.js +0 -943
  89. package/dist/index-CJ0XeRj5.js +0 -44
@@ -0,0 +1,1028 @@
1
+ import { defineComponent as Q, ref as N, computed as W, h as n, resolveComponent as $, openBlock as k, createBlock as ae, unref as l, isRef as ye, withCtx as oe, createElementVNode as h, createVNode as w, createElementBlock as B, Fragment as X, renderList as ne, toDisplayString as H, createTextVNode as he, resolveDynamicComponent as ve, watch as re, onBeforeMount as be, onMounted as _e } from "vue";
2
+ import { components as y, useDialog as Se } from "@feedmepos/ui-library";
3
+ import { q as z } from "./index-DQxldvxq.js";
4
+ import { a as Z, c as xe, p as we } from "./plugins-uP-mKUTQ.js";
5
+ import { s as Te } from "./index-Dbd4WA4r.js";
6
+ import { h as S } from "./moment-BWErdI6_.js";
7
+ import { _ as j } from "./FilterChip.vue_vue_type_script_setup_true_lang-BrPLkFX8.js";
8
+ import { _ as se } from "./DateRangeChip.vue_vue_type_script_setup_true_lang-BUzUIIUW.js";
9
+ import { s as G } from "./index-CsaQJMAR.js";
10
+ import { f as J } from "./number-CT16ZbSb.js";
11
+ import { u as le } from "./business-Dl7vGxa1.js";
12
+ import { u as ie, _ as ce } from "./usePagination-BeF5K3M7.js";
13
+ import { g as ue } from "./user-BzRp43jn.js";
14
+ import { B as me, e as de } from "./export-C6IKCW8q.js";
15
+ import { u as pe } from "./campaign-XH_j4bGc.js";
16
+ import "./index-_Fw2-H-c.js";
17
+ import "./index-DxT_ZaWI.js";
18
+ import "./index-DDCO8cDG.js";
19
+ import "./index-BHB9VPNm.js";
20
+ import "./index-BVcdkWyy.js";
21
+ import { u as Re } from "./vue-i18n-7zGNsm-H.js";
22
+ import { o as U } from "./objectId-dwaoBfJX.js";
23
+ import { u as fe } from "./loading-CmczlXAc.js";
24
+ import { useRouter as Ce } from "vue-router";
25
+ import { t as Y } from "./index-Sw_FxWmd.js";
26
+ import { R as K } from "./app-CHUmGvDF.js";
27
+ import { F as q } from "./collectible.enum-Dx_pgMB9.js";
28
+ import { useCoreStore as Ae } from "@feedmepos/mf-common";
29
+ import { m as Ie } from "./index-C-HL3cGP.js";
30
+ function De(m) {
31
+ let p = "";
32
+ switch (m) {
33
+ case "PORTAL":
34
+ p = "ADMIN";
35
+ break;
36
+ case "BENEFIT":
37
+ p = "MEMBERSHIP";
38
+ break;
39
+ case "ORDER":
40
+ p = "ORDER";
41
+ break;
42
+ case "BILL":
43
+ p = "SPENDING";
44
+ break;
45
+ case "CASHBACK":
46
+ p = "CASHBACK";
47
+ break;
48
+ case "CYCLE":
49
+ p = "EXPIRED";
50
+ break;
51
+ case "COUNTER_CONSUME":
52
+ p = "COUNTER REDEEM";
53
+ break;
54
+ default:
55
+ p = m;
56
+ break;
57
+ }
58
+ return p;
59
+ }
60
+ function Fe(m) {
61
+ var p, R, u, T, x, I;
62
+ switch ((p = m == null ? void 0 : m.pf_collectible) == null ? void 0 : p.type) {
63
+ case "VOUCHER":
64
+ return `${(R = m.pf_collectible) == null ? void 0 : R.type} (${(u = m.pf_collectible) == null ? void 0 : u.name})`;
65
+ case "TITLE":
66
+ return `${(T = m.pf_collectible) == null ? void 0 : T.type} (${(x = m.pf_collectible) == null ? void 0 : x.name})`;
67
+ case "POINT":
68
+ return "Experience";
69
+ case "COIN":
70
+ return "Point";
71
+ default:
72
+ return Te((I = m == null ? void 0 : m.pf_collectible) == null ? void 0 : I.type);
73
+ }
74
+ }
75
+ function Ee(m) {
76
+ switch (m) {
77
+ case "ONLINE":
78
+ return "Online";
79
+ case "COIN":
80
+ return "Point";
81
+ default:
82
+ return m;
83
+ }
84
+ }
85
+ const O = {
86
+ getReason: De,
87
+ formattedType: Fe,
88
+ formattedPaymentType: Ee
89
+ };
90
+ class ke extends me {
91
+ }
92
+ const Oe = { class: "space-y-24 pr-12" }, Ne = { class: "w-full space-y-16" }, Me = { class: "fm-typo-en-body-lg-600" }, Pe = ["onClick"], Ve = { class: "fm-typo-en-body-lg-600" }, Be = ["onClick"], Ye = { class: "flex items-center gap-8" }, Ue = /* @__PURE__ */ Q({
93
+ __name: "TransactionDetailSheet",
94
+ setup(m, { expose: p }) {
95
+ Re();
96
+ const R = N(!1), u = N(), T = pe(), x = le();
97
+ function I(d, o) {
98
+ R.value = d, u.value = o ?? null;
99
+ }
100
+ const M = W(() => {
101
+ var d, o;
102
+ return J(
103
+ ((o = u.value) == null ? void 0 : o.expiryAmount.reduce(
104
+ (e, i) => e + i.amount,
105
+ ((d = u.value) == null ? void 0 : d.amount) ?? 0
106
+ )) ?? 0,
107
+ 2
108
+ );
109
+ }), c = W(() => {
110
+ var d, o, e, i, s;
111
+ return u.value ? [
112
+ {
113
+ label: "Transaction ID",
114
+ value: (d = u.value) == null ? void 0 : d._id
115
+ },
116
+ {
117
+ label: "Date/Time",
118
+ value: S(U(u.value._id.toString())).format(
119
+ "D MMM YYYY, hh:mmA"
120
+ )
121
+ },
122
+ {
123
+ label: "Amount",
124
+ component: () => n(
125
+ "span",
126
+ {
127
+ class: [
128
+ "pr-2",
129
+ +M.value > 0 ? "text-fm-color-system-success-300" : "text-fm-color-system-error-300"
130
+ ]
131
+ },
132
+ M.value
133
+ )
134
+ },
135
+ {
136
+ label: "Type",
137
+ value: O.formattedType(u.value)
138
+ },
139
+ {
140
+ label: "Source",
141
+ value: G(O.getReason(u.value.source))
142
+ },
143
+ {
144
+ label: "User",
145
+ value: (e = (o = u.value) == null ? void 0 : o.pf_user) == null ? void 0 : e.name
146
+ },
147
+ {
148
+ label: "Phone Number",
149
+ value: (s = (i = u.value) == null ? void 0 : i.pf_user) == null ? void 0 : s.phoneNumber
150
+ }
151
+ ] : [];
152
+ }), D = W(() => {
153
+ var i, s, v, g;
154
+ if (!u.value) return [];
155
+ const d = [], o = (i = u.value) == null ? void 0 : i.metadata, e = u.value;
156
+ if (o != null && o.campaign) {
157
+ const C = T.campaigns.all.find(
158
+ (P) => P._id === (o == null ? void 0 : o.campaign)
159
+ );
160
+ if (!C) return;
161
+ d.push({
162
+ label: "Campaign",
163
+ value: C.name
164
+ });
165
+ }
166
+ return o != null && o.remark && d.push({
167
+ label: "Remark",
168
+ value: o.remark
169
+ }), (s = u.value) != null && s.ref.startsWith("bill_") && d.push({
170
+ label: "Bill Number",
171
+ value: (v = u.value) == null ? void 0 : v.ref,
172
+ copy: () => {
173
+ var C;
174
+ return Z((C = u.value) == null ? void 0 : C.ref);
175
+ }
176
+ }), o != null && o.location && d.push({
177
+ label: "Location",
178
+ value: (g = x.locations.find(
179
+ (C) => C._id.toString() === (o == null ? void 0 : o.location)
180
+ )) == null ? void 0 : g.name
181
+ }), e.source === z.enum.STORE && d.push({
182
+ label: "Store Transaction",
183
+ value: e.ref
184
+ }), o != null && o.originTransaction && d.push({
185
+ label: "Parent Transaction",
186
+ value: o.originTransaction
187
+ }), o != null && o.referral_count && d.push({
188
+ label: "Referral Count",
189
+ value: o.referral_count
190
+ }), e.refunded && d.push({
191
+ label: "Refunded From",
192
+ value: e.refundedFrom
193
+ }), d;
194
+ });
195
+ return p({
196
+ showSheet: I
197
+ }), (d, o) => {
198
+ const e = $("FmButton"), i = $("FmSideSheet");
199
+ return k(), ae(i, {
200
+ "max-width": 560,
201
+ modelValue: l(R),
202
+ "onUpdate:modelValue": o[1] || (o[1] = (s) => ye(R) ? R.value = s : null),
203
+ header: "Transaction Details"
204
+ }, {
205
+ "side-sheet-footer": oe(() => [
206
+ h("div", Ye, [
207
+ w(e, {
208
+ label: "Close",
209
+ onClick: o[0] || (o[0] = (s) => I(!1)),
210
+ variant: "tertiary"
211
+ })
212
+ ])
213
+ ]),
214
+ default: oe(() => [
215
+ h("div", Oe, [
216
+ h("div", Ne, [
217
+ (k(!0), B(X, null, ne(l(c), (s) => (k(), B("div", {
218
+ key: s.label,
219
+ class: "flex flex-col gap-4"
220
+ }, [
221
+ h("div", Me, H(s.label), 1),
222
+ h("div", {
223
+ class: "text-fm-color-typo-secondary fm-typo-en-body-md-400 hover:underline",
224
+ onClick: s.copy
225
+ }, [
226
+ he(H(s.accessorFn ? s.accessorFn() : s.value) + " ", 1),
227
+ (k(), ae(ve(s.component)))
228
+ ], 8, Pe),
229
+ o[2] || (o[2] = h("hr", { class: "mt-3" }, null, -1))
230
+ ]))), 128)),
231
+ (k(!0), B(X, null, ne(l(D), (s) => (k(), B("div", {
232
+ key: s.label,
233
+ class: "flex flex-col gap-4"
234
+ }, [
235
+ h("div", Ve, H(s.label), 1),
236
+ h("div", {
237
+ class: "text-fm-color-typo-secondary fm-typo-en-body-md-400 hover:underline",
238
+ onClick: s.copy
239
+ }, H(s.accessorFn ? s.accessorFn() : s.value), 9, Be),
240
+ o[3] || (o[3] = h("hr", { class: "mt-3" }, null, -1))
241
+ ]))), 128))
242
+ ])
243
+ ])
244
+ ]),
245
+ _: 1
246
+ }, 8, ["modelValue"]);
247
+ };
248
+ }
249
+ }), $e = { class: "hidden xs:flex items-center justify-end" }, Le = { class: "flex items-center justify-between" }, ze = { class: "flex gap-8 items-center w-full overflow-x-scroll" }, He = { class: "xs:hidden" }, Tt = /* @__PURE__ */ Q({
250
+ __name: "CollectionTransactions",
251
+ props: {
252
+ user: {
253
+ type: String
254
+ }
255
+ },
256
+ setup(m) {
257
+ const p = le(), R = pe(), u = Ce(), T = m, x = N(!1), { minor: I } = fe, M = [
258
+ {
259
+ header: "Transaction ID",
260
+ accessorKey: "_id",
261
+ meta: {
262
+ maxWidth: "100px"
263
+ },
264
+ cell(a) {
265
+ return n("div", { class: "flex items-center" }, [
266
+ n(y.FmIcon, {
267
+ name: "content_copy",
268
+ outline: !0,
269
+ size: "sm",
270
+ class: "cursor-pointer mr-4",
271
+ onClick: (t) => {
272
+ t.preventDefault(), t.stopPropagation(), Z(a.row.original._id.toString());
273
+ }
274
+ }),
275
+ n(
276
+ "div",
277
+ { class: "pr-2 text-ellipsis overflow-hidden" },
278
+ a.row.original._id.toString()
279
+ )
280
+ ]);
281
+ },
282
+ enableSorting: !1
283
+ },
284
+ {
285
+ header: "Created at",
286
+ accessorKey: "_id",
287
+ accessorFn: (a) => S(U(a._id.toString())),
288
+ cell: (a) => S(U(a.row.original._id.toString())).format(
289
+ "D MMM YYYY, hh:mmA"
290
+ ),
291
+ enableSorting: !0
292
+ },
293
+ {
294
+ header: "Amount",
295
+ // accessorKey: 'totalAmount',
296
+ enableSorting: !1,
297
+ cell(a) {
298
+ var b, r, _, F;
299
+ const t = J(
300
+ a.row.original.expiryAmount.reduce(
301
+ (A, L) => A + L.amount,
302
+ a.row.original.amount ?? 0
303
+ ),
304
+ 2
305
+ ), f = (r = (b = a.row.original.expiryAmount) == null ? void 0 : b[0]) != null && r.expiredAt ? S((F = (_ = a.row.original.expiryAmount) == null ? void 0 : _[0]) == null ? void 0 : F.expiredAt).format(
306
+ "D MMM YYYY"
307
+ ) : "";
308
+ return n("div", { class: "flex items-center" }, [
309
+ n(
310
+ "div",
311
+ {
312
+ class: [
313
+ "pr-2",
314
+ +t > 0 ? "text-fm-color-system-success-300" : "text-fm-color-system-error-300"
315
+ ]
316
+ },
317
+ t
318
+ ),
319
+ n("div", { class: "flex items-center" }, [
320
+ a.row.original.expiryAmount.length > 0 ? n(
321
+ y.FmTooltip,
322
+ {
323
+ content: `Expired on ${f}`
324
+ },
325
+ [
326
+ n(y.FmIcon, {
327
+ name: "info",
328
+ outline: !0,
329
+ size: "sm"
330
+ })
331
+ ]
332
+ ) : n("div")
333
+ ])
334
+ ]);
335
+ }
336
+ },
337
+ {
338
+ header: "Type",
339
+ accessorKey: "pf_collectible.type",
340
+ accessorFn: (a) => O.formattedType(a),
341
+ meta: {
342
+ maxWidth: "200px"
343
+ },
344
+ cell(a) {
345
+ const t = O.formattedType(a.row.original);
346
+ return n("div", { class: "flex items-center" }, [
347
+ n("div", { class: "truncate text-ellipsis" }, t),
348
+ t.length > 20 ? n(
349
+ y.FmTooltip,
350
+ {
351
+ content: t
352
+ },
353
+ [
354
+ n(y.FmIcon, {
355
+ name: "info",
356
+ color: "primary",
357
+ outline: !0,
358
+ size: "sm"
359
+ })
360
+ ]
361
+ ) : null
362
+ ]);
363
+ }
364
+ },
365
+ {
366
+ header: "Source",
367
+ accessorKey: "source",
368
+ cell(a) {
369
+ var t;
370
+ return n("div", { class: "flex items-center gap-4" }, [
371
+ n(
372
+ "div",
373
+ { class: "truncate text-ellipsis" },
374
+ G(O.getReason(a.row.original.source))
375
+ ),
376
+ ...(t = a.row.original.metadata) != null && t.campaign ? [
377
+ n(
378
+ y.FmTooltip,
379
+ {
380
+ get content() {
381
+ var f;
382
+ return (f = R.campaigns.all.find(
383
+ (b) => {
384
+ var r;
385
+ return b._id === ((r = a.row.original.metadata) == null ? void 0 : r.campaign);
386
+ }
387
+ )) == null ? void 0 : f.name;
388
+ }
389
+ },
390
+ [
391
+ n(y.FmIcon, {
392
+ name: "info",
393
+ color: "primary",
394
+ size: "sm",
395
+ onClick: async (f) => {
396
+ f.preventDefault(), f.stopPropagation();
397
+ const b = R.campaigns.all.find(
398
+ (r) => {
399
+ var _;
400
+ return r._id === ((_ = a.row.original.metadata) == null ? void 0 : _.campaign);
401
+ }
402
+ );
403
+ if (b)
404
+ switch (b.type) {
405
+ case "VOUCHER":
406
+ case "PROMOTION":
407
+ case "BROADCAST":
408
+ await u.push({
409
+ name: K[`$connect-CAMPAIGN_${b.type}`]
410
+ });
411
+ break;
412
+ case "GAME":
413
+ case "CREDIT":
414
+ case "MISSION":
415
+ await u.push({
416
+ name: K[`$connect-PROGRAM_${b.type}`]
417
+ });
418
+ break;
419
+ case "POINT":
420
+ await u.push({
421
+ name: K["$connect-PROGRAM_EXPERIENCE"]
422
+ });
423
+ break;
424
+ case "COIN":
425
+ await u.push({
426
+ name: K["$connect-PROGRAM_POINT"]
427
+ });
428
+ break;
429
+ }
430
+ }
431
+ })
432
+ ]
433
+ )
434
+ ] : []
435
+ ]);
436
+ }
437
+ },
438
+ {
439
+ header: "User",
440
+ accessorKey: "pf_user.name",
441
+ cell(a) {
442
+ return ue(a.row.original.pf_user);
443
+ }
444
+ },
445
+ {
446
+ header: "Phone No.",
447
+ accessorKey: "pf_user.phoneNumber",
448
+ accessorFn: (a) => {
449
+ var t;
450
+ return ((t = a == null ? void 0 : a.pf_user) == null ? void 0 : t.phoneNumber) || "";
451
+ }
452
+ },
453
+ {
454
+ accessorFn: (a) => a.ref,
455
+ header: "References",
456
+ accessorKey: "ref",
457
+ cell(a) {
458
+ var t, f;
459
+ return n("div", { class: "flex items-center justify-between gap-4" }, [
460
+ n("div", { class: "flex items-center" }, [
461
+ (t = a.row.original.metadata) != null && t.remark ? n(
462
+ y.FmTooltip,
463
+ {
464
+ content: (f = a.row.original.metadata) == null ? void 0 : f.remark
465
+ },
466
+ [
467
+ n(y.FmIcon, {
468
+ name: "info",
469
+ class: "pl-2",
470
+ outline: !0,
471
+ size: "sm"
472
+ })
473
+ ]
474
+ ) : n("div")
475
+ ]),
476
+ n("div", { class: "flex-1" }, a.row.original.ref)
477
+ ]);
478
+ }
479
+ },
480
+ {
481
+ header: "Actions",
482
+ cell(a) {
483
+ const t = a.row.original;
484
+ return n(
485
+ y.FmTooltip,
486
+ {
487
+ get content() {
488
+ return "Revert Transaction";
489
+ }
490
+ },
491
+ [
492
+ n(y.FmButton, {
493
+ variant: "tertiary",
494
+ icon: "amend",
495
+ iconColor: "neutral-gray-400",
496
+ disabled: !t.isRevertable,
497
+ onClick: (f) => {
498
+ f.stopPropagation(), P(t);
499
+ }
500
+ })
501
+ ]
502
+ );
503
+ }
504
+ }
505
+ ], c = N({
506
+ search: "",
507
+ "pf_collectible.type": [],
508
+ "metadata.location": [],
509
+ dateRange: {
510
+ startDate: S().subtract(7, "day").toISOString(),
511
+ endDate: S().endOf("day").toISOString()
512
+ },
513
+ source: []
514
+ }), { tableMeta: D, rowData: d, onSort: o, debouncedFetchData: e, onSearch: i } = ie(async (a) => {
515
+ const t = {
516
+ ...c.value,
517
+ user: T.user,
518
+ dateRange: {
519
+ start: new Date(c.value.dateRange.startDate).toISOString(),
520
+ end: new Date(c.value.dateRange.endDate).toISOString()
521
+ }
522
+ }, f = await Y.readAll(a, t);
523
+ return {
524
+ resources: await Promise.all(
525
+ f.resources.map(async (r) => {
526
+ let _;
527
+ if (r.source !== z.enum.BILL)
528
+ _ = !1;
529
+ else {
530
+ const A = r.refunded || !!r.refundedFrom;
531
+ if (r.expiryAmount.reduce(
532
+ (E, V) => E + V.amount,
533
+ r.amount ?? 0
534
+ ) > 0) {
535
+ let E = [];
536
+ switch (r.pf_collectible.type) {
537
+ case q.enum.STAMP:
538
+ E = await C(r.ref, [
539
+ z.enum.STAMP_REWARD
540
+ ]), _ = E.length === 0 && !A;
541
+ break;
542
+ case q.enum.POINT:
543
+ E = await C(r.ref, [
544
+ z.enum.STAMP_REWARD
545
+ ]), _ = E.length === 0 && !A;
546
+ break;
547
+ default:
548
+ _ = !A;
549
+ break;
550
+ }
551
+ } else
552
+ switch (r.pf_collectible.type) {
553
+ case q.enum.VOUCHER:
554
+ _ = r.expiryAmount.some(
555
+ (V) => !V.expiredAt || S(V.expiredAt).isAfter(S())
556
+ ) && !A;
557
+ break;
558
+ default:
559
+ _ = !A;
560
+ break;
561
+ }
562
+ }
563
+ const F = s.value.find((A) => A._id === r.ref);
564
+ return {
565
+ ...r,
566
+ ref: (F == null ? void 0 : F.seqNumber) || r.ref,
567
+ isRevertable: _
568
+ };
569
+ })
570
+ ),
571
+ meta: f.meta
572
+ };
573
+ }), s = N([]), v = z.options.map((a) => ({ label: G(O.getReason(a)), value: a })), g = p.locations.map((a) => ({ label: a.name, value: a._id }));
574
+ re(
575
+ c,
576
+ () => {
577
+ e();
578
+ },
579
+ { deep: !0 }
580
+ );
581
+ async function C(a, t) {
582
+ return await Y.readTransactionsByBill(a, t);
583
+ }
584
+ async function P(a) {
585
+ I(
586
+ async () => {
587
+ await Y.revertTransaction({
588
+ id: a._id.toString()
589
+ }), await e();
590
+ },
591
+ {
592
+ message: "Reverting transaction...",
593
+ successMessage: "Transaction reverted successfully"
594
+ }
595
+ );
596
+ }
597
+ async function ee() {
598
+ try {
599
+ x.value = !0;
600
+ const a = {
601
+ ...c.value,
602
+ user: T.user,
603
+ dateRange: {
604
+ start: new Date(c.value.dateRange.startDate).toISOString(),
605
+ end: new Date(c.value.dateRange.endDate).toISOString()
606
+ }
607
+ };
608
+ await de({
609
+ exporter: new ke(),
610
+ readFunction: (t) => Y.readAll(t, a),
611
+ transformRecord: (t) => {
612
+ var f, b, r, _, F, A, L;
613
+ return {
614
+ TransactionID: t._id,
615
+ CreatedAt: S(U(t._id.toString())).format(
616
+ "D MMM YYYY, hh:mmA"
617
+ ),
618
+ Amount: J(
619
+ t.expiryAmount.reduce(
620
+ (E, V) => E + V.amount,
621
+ t.amount ?? 0
622
+ ),
623
+ 2
624
+ ),
625
+ ExpiredAt: (b = (f = t.expiryAmount) == null ? void 0 : f[0]) != null && b.expiredAt ? S((_ = (r = t.expiryAmount) == null ? void 0 : r[0]) == null ? void 0 : _.expiredAt).format("D MMM YYYY") : "",
626
+ Type: O.formattedType(t),
627
+ Source: G(O.getReason(t.source)),
628
+ User: ((F = t.pf_user) == null ? void 0 : F.name) || "",
629
+ "Phone No.": ((A = t.pf_user) == null ? void 0 : A.phoneNumber) || "",
630
+ References: t.ref,
631
+ Remark: ((L = t.metadata) == null ? void 0 : L.remark) || ""
632
+ };
633
+ },
634
+ filename: "transactions"
635
+ });
636
+ } catch (a) {
637
+ console.error(a);
638
+ } finally {
639
+ x.value = !1;
640
+ }
641
+ }
642
+ const te = N(null);
643
+ function ge(a) {
644
+ var t;
645
+ console.log(a), (t = te.value) == null || t.showSheet(!0, a.original);
646
+ }
647
+ return be(async () => {
648
+ await p.readLocations(), await R.read(), await e();
649
+ }), (a, t) => {
650
+ const f = $("FmSearch"), b = $("FmButton");
651
+ return k(), B(X, null, [
652
+ h("div", null, [
653
+ h("div", $e, [
654
+ w(f, {
655
+ class: "hidden xs:flex border-b border-fm-color-neutral-gray-100",
656
+ modelValue: l(c).search,
657
+ "onUpdate:modelValue": t[0] || (t[0] = (r) => l(c).search = r),
658
+ placeholder: "Search",
659
+ collapsible: ""
660
+ }, null, 8, ["modelValue"]),
661
+ w(b, {
662
+ icon: "ios_share",
663
+ variant: "tertiary",
664
+ onClick: ee
665
+ })
666
+ ]),
667
+ h("div", Le, [
668
+ h("div", ze, [
669
+ w(j, {
670
+ class: "cursor-pointer text-fm-color-neutral-gray-400",
671
+ "right-icon": "keyboard_arrow_down",
672
+ modelValue: l(c)["metadata.location"],
673
+ "onUpdate:modelValue": t[1] || (t[1] = (r) => l(c)["metadata.location"] = r),
674
+ icon: "storefront",
675
+ "show-item-label": !0,
676
+ items: l(g)
677
+ }, null, 8, ["modelValue", "items"]),
678
+ w(j, {
679
+ class: "cursor-pointer text-fm-color-neutral-gray-400",
680
+ "right-icon": "keyboard_arrow_down",
681
+ modelValue: l(c)["pf_collectible.type"],
682
+ "onUpdate:modelValue": t[2] || (t[2] = (r) => l(c)["pf_collectible.type"] = r),
683
+ label: "Type: ",
684
+ "show-item-label": !0,
685
+ items: [
686
+ { label: "Point", value: "COIN" },
687
+ { label: "Credit", value: "CREDIT" },
688
+ { label: "Voucher", value: "VOUCHER" },
689
+ { label: "Experience", value: "POINT" },
690
+ { label: "Tier", value: "TIER" },
691
+ { label: "Title", value: "TITLE" },
692
+ { label: "Game", value: "GAME" },
693
+ { label: "Stamp", value: "STAMP" }
694
+ ]
695
+ }, null, 8, ["modelValue"]),
696
+ w(j, {
697
+ class: "cursor-pointer text-fm-color-neutral-gray-400",
698
+ "right-icon": "keyboard_arrow_down",
699
+ modelValue: l(c).source,
700
+ "onUpdate:modelValue": t[3] || (t[3] = (r) => l(c).source = r),
701
+ label: "Source: ",
702
+ "show-item-label": !0,
703
+ items: l(v)
704
+ }, null, 8, ["modelValue", "items"]),
705
+ w(se, {
706
+ "model-value": {
707
+ startDate: l(c).dateRange.startDate,
708
+ endDate: l(c).dateRange.endDate
709
+ },
710
+ "onUpdate:modelValue": t[4] || (t[4] = (r) => l(c).dateRange = {
711
+ startDate: l(S)(r.startDate).startOf("d").toISOString(),
712
+ endDate: l(S)(r.endDate).endOf("d").toISOString()
713
+ })
714
+ }, null, 8, ["model-value"])
715
+ ]),
716
+ w(f, {
717
+ class: "xs:hidden",
718
+ modelValue: l(c).search,
719
+ "onUpdate:modelValue": t[5] || (t[5] = (r) => l(c).search = r),
720
+ placeholder: "Search",
721
+ collapsible: ""
722
+ }, null, 8, ["modelValue"]),
723
+ h("div", He, [
724
+ w(b, {
725
+ icon: "ios_share",
726
+ variant: "tertiary",
727
+ onClick: ee
728
+ })
729
+ ])
730
+ ]),
731
+ w(ce, {
732
+ loading: l(D).isLoading,
733
+ "row-data": l(d),
734
+ "row-count": l(D).totalRows,
735
+ "column-defs": M.filter(
736
+ (r) => !T.user || r.header !== "User" && r.header !== "Phone No."
737
+ ),
738
+ "page-count": l(D).pageCount,
739
+ "page-index": l(D).pageIndex,
740
+ "page-size": l(D).pageSize,
741
+ "shrink-at": !1,
742
+ onSortChange: l(o),
743
+ onPageChange: t[6] || (t[6] = (r) => l(e)({
744
+ pageSize: r.pageSize,
745
+ pageIndex: r.pageIndex
746
+ })),
747
+ onRowClick: ge
748
+ }, null, 8, ["loading", "row-data", "row-count", "column-defs", "page-count", "page-index", "page-size", "onSortChange"])
749
+ ]),
750
+ w(Ue, {
751
+ ref_key: "transactionDetailSheet",
752
+ ref: te
753
+ }, null, 512)
754
+ ], 64);
755
+ };
756
+ }
757
+ });
758
+ class Ke extends me {
759
+ }
760
+ const Ge = { class: "flex items-center justify-between" }, We = { class: "flex gap-8 items-center" }, je = { class: "flex gap-8 items-center xs:hidden" }, Rt = /* @__PURE__ */ Q({
761
+ __name: "StoreTransactions",
762
+ props: {
763
+ user: {
764
+ type: String
765
+ }
766
+ },
767
+ setup(m) {
768
+ const p = m, { minor: R } = fe;
769
+ Se();
770
+ const u = [
771
+ {
772
+ header: "Transaction ID",
773
+ meta: {
774
+ maxWidth: "150px"
775
+ },
776
+ cell(e) {
777
+ return n("div", { class: "flex items-center" }, [
778
+ n(y.FmIcon, {
779
+ name: "content_copy",
780
+ outline: !0,
781
+ size: "sm",
782
+ class: "cursor-pointer mr-4 shrink-0",
783
+ onClick: (i) => {
784
+ i.preventDefault(), i.stopPropagation(), Z(e.row.original._id.toString());
785
+ }
786
+ }),
787
+ n("div", { class: "truncate" }, e.row.original._id.toString())
788
+ ]);
789
+ }
790
+ },
791
+ {
792
+ header: "Created at",
793
+ accessorFn: (e) => S(U(e._id.toString())).format("D MMM YYYY, hh:mmA"),
794
+ enableSorting: !0
795
+ },
796
+ {
797
+ header: "Bundle",
798
+ accessorFn: (e) => e.bundle.name
799
+ },
800
+ {
801
+ header: "Location",
802
+ accessorFn: (e) => e.location ? e.pf_location.name : "Online Store"
803
+ },
804
+ {
805
+ header: "Payment Type",
806
+ accessorFn: (e) => {
807
+ var i;
808
+ return ((i = e.paymentType) == null ? void 0 : i.type) ?? "N/A";
809
+ },
810
+ cell(e) {
811
+ var i, s;
812
+ return n("div", { class: "flex items-center gap-4" }, [
813
+ n("div", { class: "flex items-center" }, [
814
+ ((i = e.row.original.paymentType) == null ? void 0 : i.type) == "ONLINE" && e.row.original.paymentType.extra ? n(
815
+ y.FmTooltip,
816
+ {
817
+ content: e.row.original.paymentType.extra
818
+ },
819
+ [
820
+ n(y.FmIcon, {
821
+ name: "info",
822
+ outline: !0,
823
+ size: "sm"
824
+ })
825
+ ]
826
+ ) : n("div")
827
+ ]),
828
+ n(
829
+ "div",
830
+ { class: "flex-1" },
831
+ ((s = e.row.original.paymentType) == null ? void 0 : s.type) ?? "N/A"
832
+ )
833
+ ]);
834
+ }
835
+ },
836
+ {
837
+ header: "User",
838
+ cell: (e) => ue(e.row.original.pf_member)
839
+ },
840
+ {
841
+ header: "Phone No.",
842
+ accessorFn: (e) => e.pf_member.phoneNumber
843
+ },
844
+ {
845
+ header: "Status",
846
+ // accessorFn: (u) => u.status,
847
+ cell(e) {
848
+ var i, s, v, g;
849
+ return n("div", { class: "flex items-center" }, [
850
+ n("div", xe.title(e.row.original.status)),
851
+ n("div", { class: "flex items-center" }, [
852
+ (s = (i = e.row.original) == null ? void 0 : i.refund) != null && s.reason ? n(
853
+ y.FmTooltip,
854
+ {
855
+ content: (g = (v = e.row.original) == null ? void 0 : v.refund) == null ? void 0 : g.reason
856
+ },
857
+ [
858
+ n(y.FmIcon, {
859
+ name: "info",
860
+ color: "primary",
861
+ outline: !0,
862
+ size: "sm",
863
+ class: "pl-2"
864
+ })
865
+ ]
866
+ ) : n("div")
867
+ ])
868
+ ]);
869
+ }
870
+ },
871
+ {
872
+ header: "Source",
873
+ accessorFn: (e) => e.source
874
+ },
875
+ {
876
+ header: "Ref",
877
+ accessorFn: (e) => e.ref
878
+ },
879
+ {
880
+ id: "action",
881
+ cell(e) {
882
+ const i = e.row.original, s = i.status === "COMPLETED" && !i.refund;
883
+ return s ? n(
884
+ y.FmMenu,
885
+ {
886
+ placement: "bottom-end",
887
+ onClick: (v) => {
888
+ v.stopPropagation();
889
+ }
890
+ },
891
+ {
892
+ "menu-button": () => n(y.FmButton, {
893
+ icon: "settings",
894
+ variant: "tertiary",
895
+ if: s
896
+ }),
897
+ default: () => [
898
+ n(y.FmMenuItem, {
899
+ label: "Refund",
900
+ sublabel: "Refund this transaction",
901
+ onClick: async (v) => {
902
+ v.stopPropagation(), await d(i);
903
+ }
904
+ })
905
+ ]
906
+ }
907
+ ) : n("div");
908
+ }
909
+ }
910
+ ], T = N({
911
+ searchValue: "",
912
+ dateRange: {
913
+ startDate: S().subtract(7, "day").toISOString(),
914
+ endDate: S().toISOString()
915
+ }
916
+ }), { tableMeta: x, rowData: I, onSort: M, debouncedFetchData: c, onSearch: D } = ie(async (e) => {
917
+ const i = {
918
+ ...T.value.dateRange,
919
+ user: p.user
920
+ };
921
+ return await Y.readStoreTransactions(e, i);
922
+ });
923
+ async function d(e) {
924
+ await we.confirm(
925
+ "Are you sure you want to refund this transaction?",
926
+ "Refund Store Transaction",
927
+ "Confirm",
928
+ "Cancel"
929
+ ) && await R(
930
+ async () => {
931
+ var s;
932
+ await Ie.refundStoreTransaction({
933
+ id: e._id,
934
+ reason: `ADMIN:${(s = Ae().sessionUser) == null ? void 0 : s.name}`
935
+ }), await c();
936
+ },
937
+ {
938
+ message: "Refunding transaction...",
939
+ successMessage: "Transaction refunded successfully"
940
+ }
941
+ );
942
+ }
943
+ re(
944
+ T,
945
+ () => {
946
+ c();
947
+ },
948
+ { deep: !0 }
949
+ ), _e(async () => {
950
+ await c();
951
+ });
952
+ const o = async () => de({
953
+ exporter: new Ke(),
954
+ readFunction: (e) => Y.readStoreTransactions(e, {
955
+ ...T.value.dateRange,
956
+ user: p.user
957
+ }),
958
+ transformRecord: (e) => {
959
+ var i, s, v, g, C, P;
960
+ return {
961
+ TransactionId: ((i = e._id) == null ? void 0 : i.toString()) || "",
962
+ CreatedAt: S(U(e._id.toString())).format(
963
+ "DD/MM/YYYY HH:mm:ss"
964
+ ),
965
+ Bundle: e.bundle.name || "",
966
+ Location: e.location ? e.pf_location.name : "Online Store",
967
+ PaymentType: ((s = e.paymentType) == null ? void 0 : s.type) || "N/A",
968
+ PaymentExtra: ((v = e.paymentType) == null ? void 0 : v.extra) || "",
969
+ User: ((g = e.pf_member) == null ? void 0 : g.name) || "",
970
+ PhoneNumber: ((C = e.pf_member) == null ? void 0 : C.phoneNumber) || "",
971
+ Status: e.status || "",
972
+ RefundReason: ((P = e == null ? void 0 : e.refund) == null ? void 0 : P.reason) || ""
973
+ };
974
+ },
975
+ filename: "store-transactions"
976
+ });
977
+ return (e, i) => {
978
+ const s = $("FmSearch"), v = $("FmButton");
979
+ return k(), B("div", null, [
980
+ h("div", Ge, [
981
+ h("div", We, [
982
+ w(se, {
983
+ modelValue: l(T).dateRange,
984
+ "onUpdate:modelValue": i[0] || (i[0] = (g) => l(T).dateRange = g)
985
+ }, null, 8, ["modelValue"])
986
+ ]),
987
+ h("div", je, [
988
+ w(s, {
989
+ modelValue: l(x).searchValue,
990
+ "onUpdate:modelValue": [
991
+ i[1] || (i[1] = (g) => l(x).searchValue = g),
992
+ l(D)
993
+ ],
994
+ placeholder: "Search",
995
+ collapsible: ""
996
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]),
997
+ w(v, {
998
+ icon: "ios_share",
999
+ variant: "tertiary",
1000
+ onClick: o
1001
+ })
1002
+ ])
1003
+ ]),
1004
+ w(ce, {
1005
+ loading: l(x).isLoading,
1006
+ "row-data": l(I),
1007
+ "row-count": l(x).totalRows,
1008
+ "column-defs": u.filter(
1009
+ (g) => !p.user || g.header !== "User" && g.header !== "Phone No."
1010
+ ),
1011
+ "page-count": l(x).pageCount,
1012
+ "page-index": l(x).pageIndex,
1013
+ "page-size": l(x).pageSize,
1014
+ "shrink-at": !1,
1015
+ onSortChange: l(M),
1016
+ onPageChange: i[2] || (i[2] = (g) => l(c)({
1017
+ pageSize: g.pageSize,
1018
+ pageIndex: g.pageIndex
1019
+ }))
1020
+ }, null, 8, ["loading", "row-data", "row-count", "column-defs", "page-count", "page-index", "page-size", "onSortChange"])
1021
+ ]);
1022
+ };
1023
+ }
1024
+ });
1025
+ export {
1026
+ Tt as _,
1027
+ Rt as a
1028
+ };