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

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