@feedmepos/mf-connect 0.1.38-beta.6 → 0.1.38-beta.60

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