@feedmepos/mf-connect 0.1.0-beta.46 → 0.1.0-beta.48

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 (88) hide show
  1. package/dist/{Analytic-FUBu9S3z.js → Analytic-BiWBlCjy.js} +18 -17
  2. package/dist/{App-BTwI4KZc.js → App-D0EdXXhP.js} +10 -6
  3. package/dist/AuditLogs-B2Nld9Po.js +1856 -0
  4. package/dist/{Broadcast--MGo_2gm.js → Broadcast-D4PumMOO.js} +36 -35
  5. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-C32eEMKS.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-D5IhdwKy.js} +6 -6
  6. package/dist/{Card-_lhnaxgB.js → Card-B8r77l_c.js} +23 -21
  7. package/dist/{Collections-0tY22bQ1.js → Collections-DkNX0ENB.js} +11 -9
  8. package/dist/{Credit-C8TFWJfJ.js → Credit-us-DaVK_.js} +11 -10
  9. package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-CLFeMi0j.js +169 -0
  10. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-CAmn-C0f.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-DuE9a4wa.js} +28 -27
  11. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-BbWefC0X.js → EffectSheet.vue_vue_type_style_index_0_lang-DSPI2sPl.js} +6 -6
  12. package/dist/{Experience-B2Cs3kV_.js → Experience-B5xBVt9X.js} +26 -25
  13. package/dist/{Game-BjMEeTcC.js → Game-DZQngWps.js} +14 -13
  14. package/dist/{Index-CXenbxDR.js → Index-D6G1bPFk.js} +14 -13
  15. package/dist/{Marketing-sjviUACc.js → Marketing-BgVsJdkB.js} +8 -7
  16. package/dist/{Member-DhCu_i2m.js → Member-Cm0Dh1__.js} +4 -4
  17. package/dist/MemberList--liSD7XA.js +1598 -0
  18. package/dist/{MemberTransactions-JdAgL9A7.js → MemberTransactions-BBbIbY5M.js} +1 -1
  19. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-CWPPhyDI.js → MessageInput.vue_vue_type_script_setup_true_lang-B41VEr7k.js} +2 -2
  20. package/dist/{Mission-D96V1W9h.js → Mission-BjwPhMvr.js} +14 -13
  21. package/dist/{Overview-CtFzt4nG.js → Overview-ChHHbxMZ.js} +19 -18
  22. package/dist/{Point-DKS6TqWo.js → Point-DJOghScx.js} +11 -10
  23. package/dist/{Promotion-BNCoCICl.js → Promotion-CfaXu_lI.js} +16 -15
  24. package/dist/{Record-CWFW3doO.js → Record-Jgfc7mJg.js} +18 -16
  25. package/dist/{Reward--6seDEv8.js → Reward-AOM8CBLj.js} +33 -32
  26. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-Dmcr0wNX.js → RewardGroup.vue_vue_type_script_setup_true_lang-C8FwIGwQ.js} +13 -12
  27. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-BQos5vSk.js → RuleGroup.vue_vue_type_script_setup_true_lang-BKZdKB1T.js} +12 -12
  28. package/dist/{Segment-Cr89cfvW.js → Segment-duLNRLE3.js} +19 -17
  29. package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-C68x3EHV.js → SelectItems.vue_vue_type_script_setup_true_lang-DjdIb54T.js} +2 -2
  30. package/dist/{Setting-OPJw2EOa.js → Setting-O8ZQpi95.js} +131 -130
  31. package/dist/{Store-Chjs-gWh.js → Store-Dhec11BC.js} +24 -23
  32. package/dist/{StoreRewards-CaY3y82T.js → StoreRewards-B4wePYvY.js} +33 -32
  33. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-DbD2wugh.js +939 -0
  34. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-Cs6aAcMz.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-BNUxrEoR.js} +1 -1
  35. package/dist/{Tier-Dwf5hrcP.js → Tier-DZpvxsfn.js} +21 -20
  36. package/dist/{Title-Czj0Sokt.js → Title-3QqFZn_-.js} +28 -27
  37. package/dist/{Transaction-Do4zlaUZ.js → Transaction-B5iZ4MUu.js} +2 -2
  38. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-D0SOq2Cy.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-CQQ5HcAZ.js} +6 -6
  39. package/dist/{Voucher-DJ1JeAEz.js → Voucher-B-q9fB-f.js} +14 -13
  40. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-kgipRx1E.js → VoucherEditor.vue_vue_type_script_setup_true_lang-DL0eVHb3.js} +10 -10
  41. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-DK1RrLmn.js → ZodTextField.vue_vue_type_script_setup_true_lang-Deg2sdGO.js} +1 -1
  42. package/dist/{app-DDx8sR9s.js → app-3eroteiC.js} +1 -1
  43. package/dist/{app-Do17XyvO.js → app-BCsc9J-D.js} +121 -57
  44. package/dist/app.js +1 -1
  45. package/dist/{business-GwBNossl.js → business-Cp6db6DR.js} +1 -1
  46. package/dist/{campaign-G12OoMgD.js → campaign-BOGJy7S9.js} +2 -2
  47. package/dist/{campaign-4wHri0ck.js → campaign-D2yrg-Er.js} +9 -9
  48. package/dist/{campaign.enum-CWktQS4a.js → campaign.enum-CwF2Ajv3.js} +1 -1
  49. package/dist/{campaign.fn-C6hLLBEd.js → campaign.fn-Bp-ZzEJT.js} +41 -41
  50. package/dist/{collectible.enum-C0cNljB-.js → collectible.enum-B-71aP1r.js} +1 -1
  51. package/dist/{collection.fn-DXmHST47.js → collection.fn-DjSa_nTr.js} +2 -2
  52. package/dist/{dto-g42KsPJu.js → dto-LDNtfFmE.js} +4 -4
  53. package/dist/{effect-B_WAysaq.js → effect-BmYqIMsW.js} +1 -1
  54. package/dist/{email-addresses-DNx5SUjl.js → email-addresses-Di8hCXyI.js} +1 -1
  55. package/dist/{export-BVs2zCzA.js → export-DycH87nL.js} +5 -5
  56. package/dist/{helper-BYXE9o8R.js → helper-DFhx_pcj.js} +1 -1
  57. package/dist/{index-DrskJU4Z.js → index-BCbMOBB8.js} +101 -56
  58. package/dist/{index-BhDVH8vT.js → index-CpKBy2gq.js} +1 -1
  59. package/dist/{index-De9k8fnO.js → index-D0RI_RQG.js} +16 -5
  60. package/dist/{index-7Ua3jDRI.js → index-DHA2afdR.js} +1 -1
  61. package/dist/{index-BYKVuJLF.js → index-D_JGs1_m.js} +1 -1
  62. package/dist/{index-DQE4ktDO.js → index-DmF2UyFL.js} +1 -1
  63. package/dist/{index-D_Z1FCNe.js → index-Dvwi4GLz.js} +2 -2
  64. package/dist/{index-C7D5DHJq.js → index-Dw6vcUmt.js} +1 -1
  65. package/dist/{index-jNeR4MKb.js → index-EjX7PzTR.js} +3 -3
  66. package/dist/{index-BoQMvGk2.js → index-JDxeUUHy.js} +5 -5
  67. package/dist/{index-D1Ss53VQ.js → index-gsJpOkBA.js} +1 -1
  68. package/dist/{index-2BYEkY-x.js → index-zGjFnt2i.js} +4 -4
  69. package/dist/{index.esm2017-6PxeTVni.js → index.esm2017-Bx1gO_wH.js} +33 -33
  70. package/dist/loading-CkL5IkHw.js +100 -0
  71. package/dist/{membership-B8Ts8Dgq.js → membership-Bsr6Cvle.js} +3 -3
  72. package/dist/{money-CajYT1U_.js → money-DUBsxwt7.js} +1 -1
  73. package/dist/{number-DnQECWbC.js → number-D7RIsT0N.js} +1 -1
  74. package/dist/objectid-B-fcFN1Q.js +145 -0
  75. package/dist/{loading-CpdyLYxO.js → plugins-Dr9LdRza.js} +3764 -3860
  76. package/dist/{reward-BeIbbggX.js → reward-BkXDV7ND.js} +1 -1
  77. package/dist/{rule-BkWJ0Pz8.js → rule-Bq8z_m5L.js} +3 -3
  78. package/dist/{rule-builder-BKSDbKLq.js → rule-builder-BpUdiP64.js} +1 -1
  79. package/dist/{template-COxQB5fi.js → template-CKiPP35H.js} +4 -4
  80. package/dist/{trigger-WQCb5b4r.js → trigger-DCJmo6Nw.js} +4 -4
  81. package/dist/usePagination-BeF5K3M7.js +223 -0
  82. package/dist/{user-D-irYIrP.js → user-CjCy_BYx.js} +1 -1
  83. package/dist/{vue-i18n-BYw4xlLJ.js → vue-i18n-36uLpBY2.js} +326 -326
  84. package/dist/{usePagination-C4qRAmFC.js → xlsx-C7gDU4gE.js} +2962 -3183
  85. package/package.json +2 -1
  86. package/dist/MemberList-BgqTRkpc.js +0 -1554
  87. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-BLhLIubz.js +0 -1099
  88. package/dist/objectid-B7lDV6cM.js +0 -145
@@ -0,0 +1,939 @@
1
+ import { defineComponent as q, ref as A, computed as K, h as n, resolveComponent as k, openBlock as F, createBlock as X, unref as s, isRef as me, withCtx as J, createElementVNode as h, createVNode as S, createElementBlock as O, Fragment as H, renderList as Q, toDisplayString as $, createTextVNode as de, resolveDynamicComponent as pe, watch as Z, onBeforeMount as fe, onMounted as ge } from "vue";
2
+ import { components as v, useDialog as ye } from "@feedmepos/ui-library";
3
+ import { x as ee } from "./index-zGjFnt2i.js";
4
+ import { c as W, p as he } from "./plugins-Dr9LdRza.js";
5
+ import { s as ve } from "./index-Dbd4WA4r.js";
6
+ import { h as R } from "./moment-BWErdI6_.js";
7
+ import { _ as G, a as ae } from "./DateRangeChip.vue_vue_type_script_setup_true_lang-CLFeMi0j.js";
8
+ import { s as z } from "./index-CsaQJMAR.js";
9
+ import { f as j } from "./number-D7RIsT0N.js";
10
+ import { u as te } from "./business-Cp6db6DR.js";
11
+ import { u as oe, _ as ne } from "./usePagination-BeF5K3M7.js";
12
+ import { g as re } from "./user-CjCy_BYx.js";
13
+ import { B as se, e as le } from "./export-DycH87nL.js";
14
+ import { u as ie } from "./campaign-BOGJy7S9.js";
15
+ import "./index-gsJpOkBA.js";
16
+ import "./index-BCbMOBB8.js";
17
+ import "./index-Dvwi4GLz.js";
18
+ import "./index-DmF2UyFL.js";
19
+ import "./index-JDxeUUHy.js";
20
+ import { u as be } from "./vue-i18n-36uLpBY2.js";
21
+ import { o as V } from "./objectId-dwaoBfJX.js";
22
+ import { useRouter as _e } from "vue-router";
23
+ import { t as L } from "./index-Dw6vcUmt.js";
24
+ import { R as B } from "./app-BCsc9J-D.js";
25
+ import { c as Se, u as xe } from "./loading-CkL5IkHw.js";
26
+ import { useCoreStore as we } from "@feedmepos/mf-common";
27
+ import { m as Te } from "./index-D0RI_RQG.js";
28
+ function Re(m) {
29
+ let p = "";
30
+ switch (m) {
31
+ case "PORTAL":
32
+ p = "ADMIN";
33
+ break;
34
+ case "BENEFIT":
35
+ p = "MEMBERSHIP";
36
+ break;
37
+ case "ORDER":
38
+ p = "ORDER";
39
+ break;
40
+ case "BILL":
41
+ p = "SPENDING";
42
+ break;
43
+ case "CASHBACK":
44
+ p = "CASHBACK";
45
+ break;
46
+ case "CYCLE":
47
+ p = "EXPIRED";
48
+ break;
49
+ case "COUNTER_CONSUME":
50
+ p = "COUNTER REDEEM";
51
+ break;
52
+ default:
53
+ p = m;
54
+ break;
55
+ }
56
+ return p;
57
+ }
58
+ function Ce(m) {
59
+ var p, w, c, x, _, D;
60
+ switch ((p = m == null ? void 0 : m.pf_collectible) == null ? void 0 : p.type) {
61
+ case "VOUCHER":
62
+ return `${(w = m.pf_collectible) == null ? void 0 : w.type} (${(c = m.pf_collectible) == null ? void 0 : c.name})`;
63
+ case "TITLE":
64
+ return `${(x = m.pf_collectible) == null ? void 0 : x.type} (${(_ = m.pf_collectible) == null ? void 0 : _.name})`;
65
+ case "POINT":
66
+ return "Experience";
67
+ case "COIN":
68
+ return "Point";
69
+ default:
70
+ return ve((D = m == null ? void 0 : m.pf_collectible) == null ? void 0 : D.type);
71
+ }
72
+ }
73
+ function Ie(m) {
74
+ switch (m) {
75
+ case "ONLINE":
76
+ return "Online";
77
+ case "COIN":
78
+ return "Point";
79
+ default:
80
+ return m;
81
+ }
82
+ }
83
+ const E = {
84
+ getReason: Re,
85
+ formattedType: Ce,
86
+ formattedPaymentType: Ie
87
+ };
88
+ class De extends se {
89
+ }
90
+ const Fe = { class: "space-y-24 pr-12" }, Ee = { class: "w-full space-y-16" }, Ae = { class: "fm-typo-en-body-lg-600" }, Ne = ["onClick"], Oe = { class: "fm-typo-en-body-lg-600" }, ke = ["onClick"], Me = { class: "flex items-center gap-8" }, Pe = /* @__PURE__ */ q({
91
+ __name: "TransactionDetailSheet",
92
+ setup(m, { expose: p }) {
93
+ be();
94
+ const w = A(!1), c = A(), x = ie(), _ = te();
95
+ function D(d, t) {
96
+ w.value = d, c.value = t ?? null;
97
+ }
98
+ const u = K(() => {
99
+ var d, t;
100
+ return j(
101
+ ((t = c.value) == null ? void 0 : t.expiryAmount.reduce(
102
+ (e, l) => e + l.amount,
103
+ ((d = c.value) == null ? void 0 : d.amount) ?? 0
104
+ )) ?? 0,
105
+ 2
106
+ );
107
+ }), C = K(() => {
108
+ var d, t, e, l, r;
109
+ return c.value ? [
110
+ {
111
+ label: "Transaction ID",
112
+ value: (d = c.value) == null ? void 0 : d._id
113
+ },
114
+ {
115
+ label: "Date/Time",
116
+ value: R(V(c.value._id.toString())).format(
117
+ "D MMM YYYY, hh:mmA"
118
+ )
119
+ },
120
+ {
121
+ label: "Amount",
122
+ component: () => n(
123
+ "span",
124
+ {
125
+ class: [
126
+ "pr-2",
127
+ +u.value > 0 ? "text-fm-color-system-success-300" : "text-fm-color-system-error-300"
128
+ ]
129
+ },
130
+ u.value
131
+ )
132
+ },
133
+ {
134
+ label: "Type",
135
+ value: E.formattedType(c.value)
136
+ },
137
+ {
138
+ label: "Source",
139
+ value: z(E.getReason(c.value.source))
140
+ },
141
+ {
142
+ label: "User",
143
+ value: (e = (t = c.value) == null ? void 0 : t.pf_user) == null ? void 0 : e.name
144
+ },
145
+ {
146
+ label: "Phone Number",
147
+ value: (r = (l = c.value) == null ? void 0 : l.pf_user) == null ? void 0 : r.phoneNumber
148
+ }
149
+ ] : [];
150
+ }), M = K(() => {
151
+ var l, r, b, f;
152
+ if (!c.value) return [];
153
+ const d = [], t = (l = c.value) == null ? void 0 : l.metadata, e = c.value;
154
+ if (t != null && t.campaign) {
155
+ const T = x.campaigns.all.find(
156
+ (N) => N._id === (t == null ? void 0 : t.campaign)
157
+ );
158
+ if (!T) return;
159
+ d.push({
160
+ label: "Campaign",
161
+ value: T.name
162
+ });
163
+ }
164
+ return t != null && t.remark && d.push({
165
+ label: "Remark",
166
+ value: t.remark
167
+ }), (r = c.value) != null && r.ref.startsWith("bill_") && d.push({
168
+ label: "Bill Number",
169
+ value: (b = c.value) == null ? void 0 : b.ref,
170
+ copy: () => {
171
+ var T;
172
+ return W((T = c.value) == null ? void 0 : T.ref);
173
+ }
174
+ }), t != null && t.location && d.push({
175
+ label: "Location",
176
+ value: (f = _.locations.find(
177
+ (T) => T._id.toString() === (t == null ? void 0 : t.location)
178
+ )) == null ? void 0 : f.name
179
+ }), e.source === ee.enum.STORE && d.push({
180
+ label: "Store Transaction",
181
+ value: e.ref
182
+ }), t != null && t.originTransaction && d.push({
183
+ label: "Parent Transaction",
184
+ value: t.originTransaction
185
+ }), t != null && t.referral_count && d.push({
186
+ label: "Referral Count",
187
+ value: t.referral_count
188
+ }), e.refunded && d.push({
189
+ label: "Refunded From",
190
+ value: e.refundedFrom
191
+ }), d;
192
+ });
193
+ return p({
194
+ showSheet: D
195
+ }), (d, t) => {
196
+ const e = k("FmButton"), l = k("FmSideSheet");
197
+ return F(), X(l, {
198
+ "max-width": 560,
199
+ modelValue: s(w),
200
+ "onUpdate:modelValue": t[1] || (t[1] = (r) => me(w) ? w.value = r : null),
201
+ header: "Transaction Details"
202
+ }, {
203
+ "side-sheet-footer": J(() => [
204
+ h("div", Me, [
205
+ S(e, {
206
+ label: "Close",
207
+ onClick: t[0] || (t[0] = (r) => D(!1)),
208
+ variant: "tertiary"
209
+ })
210
+ ])
211
+ ]),
212
+ default: J(() => [
213
+ h("div", Fe, [
214
+ h("div", Ee, [
215
+ (F(!0), O(H, null, Q(s(C), (r) => (F(), O("div", {
216
+ key: r.label,
217
+ class: "flex flex-col gap-4"
218
+ }, [
219
+ h("div", Ae, $(r.label), 1),
220
+ h("div", {
221
+ class: "text-fm-color-typo-secondary fm-typo-en-body-md-400 hover:underline",
222
+ onClick: r.copy
223
+ }, [
224
+ de($(r.accessorFn ? r.accessorFn() : r.value) + " ", 1),
225
+ (F(), X(pe(r.component)))
226
+ ], 8, Ne),
227
+ t[2] || (t[2] = h("hr", { class: "mt-3" }, null, -1))
228
+ ]))), 128)),
229
+ (F(!0), O(H, null, Q(s(M), (r) => (F(), O("div", {
230
+ key: r.label,
231
+ class: "flex flex-col gap-4"
232
+ }, [
233
+ h("div", Oe, $(r.label), 1),
234
+ h("div", {
235
+ class: "text-fm-color-typo-secondary fm-typo-en-body-md-400 hover:underline",
236
+ onClick: r.copy
237
+ }, $(r.accessorFn ? r.accessorFn() : r.value), 9, ke),
238
+ t[3] || (t[3] = h("hr", { class: "mt-3" }, null, -1))
239
+ ]))), 128))
240
+ ])
241
+ ])
242
+ ]),
243
+ _: 1
244
+ }, 8, ["modelValue"]);
245
+ };
246
+ }
247
+ }), Ve = { class: "hidden xs:flex items-center justify-end" }, Ye = { class: "flex items-center justify-between" }, Ue = { class: "flex gap-8 items-center w-full overflow-x-scroll" }, $e = { class: "xs:hidden" }, va = /* @__PURE__ */ q({
248
+ __name: "CollectionTransactions",
249
+ props: {
250
+ user: {
251
+ type: String
252
+ }
253
+ },
254
+ setup(m) {
255
+ const p = te(), w = ie(), c = _e(), x = m, _ = A(!1), D = [
256
+ {
257
+ header: "Transaction ID",
258
+ accessorKey: "_id",
259
+ meta: {
260
+ maxWidth: "100px"
261
+ },
262
+ cell(o) {
263
+ return n("div", { class: "flex items-center" }, [
264
+ n(v.FmIcon, {
265
+ name: "content_copy",
266
+ outline: !0,
267
+ size: "sm",
268
+ class: "cursor-pointer mr-4",
269
+ onClick: (a) => {
270
+ a.preventDefault(), a.stopPropagation(), W(o.row.original._id.toString());
271
+ }
272
+ }),
273
+ n(
274
+ "div",
275
+ { class: "pr-2 text-ellipsis overflow-hidden" },
276
+ o.row.original._id.toString()
277
+ )
278
+ ]);
279
+ },
280
+ enableSorting: !1
281
+ },
282
+ {
283
+ header: "Created at",
284
+ accessorKey: "_id",
285
+ accessorFn: (o) => R(V(o._id.toString())).format("D MMM YYYY, hh:mmA"),
286
+ enableSorting: !0
287
+ },
288
+ {
289
+ header: "Amount",
290
+ // accessorKey: 'totalAmount',
291
+ enableSorting: !1,
292
+ cell(o) {
293
+ var y, i, I, P;
294
+ const a = j(
295
+ o.row.original.expiryAmount.reduce(
296
+ (Y, U) => Y + U.amount,
297
+ o.row.original.amount ?? 0
298
+ ),
299
+ 2
300
+ ), g = (i = (y = o.row.original.expiryAmount) == null ? void 0 : y[0]) != null && i.expiredAt ? R((P = (I = o.row.original.expiryAmount) == null ? void 0 : I[0]) == null ? void 0 : P.expiredAt).format(
301
+ "D MMM YYYY"
302
+ ) : "";
303
+ return n("div", { class: "flex items-center" }, [
304
+ n(
305
+ "div",
306
+ {
307
+ class: [
308
+ "pr-2",
309
+ +a > 0 ? "text-fm-color-system-success-300" : "text-fm-color-system-error-300"
310
+ ]
311
+ },
312
+ a
313
+ ),
314
+ n("div", { class: "flex items-center" }, [
315
+ o.row.original.expiryAmount.length > 0 ? n(
316
+ v.FmTooltip,
317
+ {
318
+ content: `Expired on ${g}`
319
+ },
320
+ [
321
+ n(v.FmIcon, {
322
+ name: "info",
323
+ outline: !0,
324
+ size: "sm"
325
+ })
326
+ ]
327
+ ) : n("div")
328
+ ])
329
+ ]);
330
+ }
331
+ },
332
+ {
333
+ header: "Type",
334
+ accessorKey: "pf_collectible.type",
335
+ accessorFn: (o) => E.formattedType(o),
336
+ meta: {
337
+ maxWidth: "200px"
338
+ },
339
+ cell(o) {
340
+ const a = E.formattedType(o.row.original);
341
+ return n("div", { class: "flex items-center" }, [
342
+ n("div", { class: "truncate text-ellipsis" }, a),
343
+ a.length > 20 ? n(
344
+ v.FmTooltip,
345
+ {
346
+ content: a
347
+ },
348
+ [
349
+ n(v.FmIcon, {
350
+ name: "info",
351
+ color: "primary",
352
+ outline: !0,
353
+ size: "sm"
354
+ })
355
+ ]
356
+ ) : null
357
+ ]);
358
+ }
359
+ },
360
+ {
361
+ header: "Source",
362
+ accessorKey: "source",
363
+ cell(o) {
364
+ var a;
365
+ return n("div", { class: "flex items-center gap-4" }, [
366
+ n(
367
+ "div",
368
+ { class: "truncate text-ellipsis" },
369
+ z(E.getReason(o.row.original.source))
370
+ ),
371
+ ...(a = o.row.original.metadata) != null && a.campaign ? [
372
+ n(
373
+ v.FmTooltip,
374
+ {
375
+ get content() {
376
+ var g;
377
+ return (g = w.campaigns.all.find(
378
+ (y) => {
379
+ var i;
380
+ return y._id === ((i = o.row.original.metadata) == null ? void 0 : i.campaign);
381
+ }
382
+ )) == null ? void 0 : g.name;
383
+ }
384
+ },
385
+ [
386
+ n(v.FmIcon, {
387
+ name: "info",
388
+ color: "primary",
389
+ size: "sm",
390
+ onClick: async (g) => {
391
+ g.preventDefault(), g.stopPropagation();
392
+ const y = w.campaigns.all.find(
393
+ (i) => {
394
+ var I;
395
+ return i._id === ((I = o.row.original.metadata) == null ? void 0 : I.campaign);
396
+ }
397
+ );
398
+ if (y)
399
+ switch (y.type) {
400
+ case "VOUCHER":
401
+ case "PROMOTION":
402
+ case "BROADCAST":
403
+ await c.push({
404
+ name: B[`$connect-CAMPAIGN_${y.type}`]
405
+ });
406
+ break;
407
+ case "GAME":
408
+ case "CREDIT":
409
+ case "MISSION":
410
+ await c.push({
411
+ name: B[`$connect-PROGRAM_${y.type}`]
412
+ });
413
+ break;
414
+ case "POINT":
415
+ await c.push({
416
+ name: B["$connect-PROGRAM_EXPERIENCE"]
417
+ });
418
+ break;
419
+ case "COIN":
420
+ await c.push({
421
+ name: B["$connect-PROGRAM_POINT"]
422
+ });
423
+ break;
424
+ }
425
+ }
426
+ })
427
+ ]
428
+ )
429
+ ] : []
430
+ ]);
431
+ }
432
+ },
433
+ {
434
+ header: "User",
435
+ accessorKey: "pf_user.name",
436
+ cell(o) {
437
+ return re(o.row.original.pf_user);
438
+ }
439
+ },
440
+ {
441
+ header: "Phone No.",
442
+ accessorKey: "pf_user.phoneNumber",
443
+ accessorFn: (o) => {
444
+ var a;
445
+ return ((a = o == null ? void 0 : o.pf_user) == null ? void 0 : a.phoneNumber) || "";
446
+ }
447
+ },
448
+ {
449
+ accessorFn: (o) => o.ref,
450
+ header: "References",
451
+ accessorKey: "ref",
452
+ cell(o) {
453
+ var a, g;
454
+ return n("div", { class: "flex items-center justify-between gap-4" }, [
455
+ n("div", { class: "flex items-center" }, [
456
+ (a = o.row.original.metadata) != null && a.remark ? n(
457
+ v.FmTooltip,
458
+ {
459
+ content: (g = o.row.original.metadata) == null ? void 0 : g.remark
460
+ },
461
+ [
462
+ n(v.FmIcon, {
463
+ name: "info",
464
+ class: "pl-2",
465
+ outline: !0,
466
+ size: "sm"
467
+ })
468
+ ]
469
+ ) : n("div")
470
+ ]),
471
+ n("div", { class: "flex-1" }, o.row.original.ref)
472
+ ]);
473
+ }
474
+ }
475
+ ], u = A({
476
+ search: "",
477
+ "pf_collectible.type": [],
478
+ "metadata.location": [],
479
+ dateRange: {
480
+ startDate: R().subtract(7, "day").toISOString(),
481
+ endDate: R().endOf("day").toISOString()
482
+ },
483
+ source: []
484
+ }), { tableMeta: C, rowData: M, onSort: d, debouncedFetchData: t, onSearch: e } = oe(async (o) => {
485
+ const a = {
486
+ ...u.value,
487
+ user: x.user,
488
+ dateRange: {
489
+ start: new Date(u.value.dateRange.startDate).toISOString(),
490
+ end: new Date(u.value.dateRange.endDate).toISOString()
491
+ }
492
+ }, g = await L.readAll(o, a);
493
+ return {
494
+ resources: g.resources.map((y) => {
495
+ const i = l.value.find((I) => I._id === y.ref);
496
+ return { ...y, ref: (i == null ? void 0 : i.seqNumber) || y.ref };
497
+ }),
498
+ meta: g.meta
499
+ };
500
+ }), l = A([]), r = ee.options.map((o) => ({ label: z(E.getReason(o)), value: o })), b = p.locations.map((o) => ({ label: o.name, value: o._id }));
501
+ Z(
502
+ u,
503
+ () => {
504
+ t();
505
+ },
506
+ { deep: !0 }
507
+ );
508
+ async function f() {
509
+ try {
510
+ _.value = !0;
511
+ const o = {
512
+ ...u.value,
513
+ user: x.user,
514
+ dateRange: {
515
+ start: new Date(u.value.dateRange.startDate).toISOString(),
516
+ end: new Date(u.value.dateRange.endDate).toISOString()
517
+ }
518
+ };
519
+ await le({
520
+ exporter: new De(),
521
+ readFunction: (a) => L.readAll(a, o),
522
+ transformRecord: (a) => {
523
+ var g, y, i, I, P, Y, U;
524
+ return {
525
+ TransactionID: a._id,
526
+ CreatedAt: R(V(a._id.toString())).format(
527
+ "D MMM YYYY, hh:mmA"
528
+ ),
529
+ Amount: j(
530
+ a.expiryAmount.reduce(
531
+ (ce, ue) => ce + ue.amount,
532
+ a.amount ?? 0
533
+ ),
534
+ 2
535
+ ),
536
+ ExpiredAt: (y = (g = a.expiryAmount) == null ? void 0 : g[0]) != null && y.expiredAt ? R((I = (i = a.expiryAmount) == null ? void 0 : i[0]) == null ? void 0 : I.expiredAt).format("D MMM YYYY") : "",
537
+ Type: E.formattedType(a),
538
+ Source: z(E.getReason(a.source)),
539
+ User: ((P = a.pf_user) == null ? void 0 : P.name) || "",
540
+ "Phone No.": ((Y = a.pf_user) == null ? void 0 : Y.phoneNumber) || "",
541
+ References: a.ref,
542
+ Remark: ((U = a.metadata) == null ? void 0 : U.remark) || ""
543
+ };
544
+ },
545
+ filename: "transactions"
546
+ });
547
+ } catch (o) {
548
+ console.error(o);
549
+ } finally {
550
+ _.value = !1;
551
+ }
552
+ }
553
+ const T = A(null);
554
+ function N(o) {
555
+ var a;
556
+ console.log(o), (a = T.value) == null || a.showSheet(!0, o.original);
557
+ }
558
+ return fe(async () => {
559
+ await p.readLocations(), await w.read(), await t();
560
+ }), (o, a) => {
561
+ const g = k("FmSearch"), y = k("FmButton");
562
+ return F(), O(H, null, [
563
+ h("div", null, [
564
+ h("div", Ve, [
565
+ S(g, {
566
+ class: "hidden xs:flex border-b border-fm-color-neutral-gray-100",
567
+ modelValue: s(u).search,
568
+ "onUpdate:modelValue": a[0] || (a[0] = (i) => s(u).search = i),
569
+ placeholder: "Search",
570
+ collapsible: ""
571
+ }, null, 8, ["modelValue"]),
572
+ S(y, {
573
+ icon: "ios_share",
574
+ variant: "tertiary",
575
+ onClick: f
576
+ })
577
+ ]),
578
+ h("div", Ye, [
579
+ h("div", Ue, [
580
+ S(G, {
581
+ class: "cursor-pointer text-fm-color-neutral-gray-400",
582
+ "right-icon": "keyboard_arrow_down",
583
+ modelValue: s(u)["metadata.location"],
584
+ "onUpdate:modelValue": a[1] || (a[1] = (i) => s(u)["metadata.location"] = i),
585
+ icon: "storefront",
586
+ "show-item-label": !0,
587
+ items: s(b)
588
+ }, null, 8, ["modelValue", "items"]),
589
+ S(G, {
590
+ class: "cursor-pointer text-fm-color-neutral-gray-400",
591
+ "right-icon": "keyboard_arrow_down",
592
+ modelValue: s(u)["pf_collectible.type"],
593
+ "onUpdate:modelValue": a[2] || (a[2] = (i) => s(u)["pf_collectible.type"] = i),
594
+ label: "Type: ",
595
+ "show-item-label": !0,
596
+ items: [
597
+ { label: "Point", value: "COIN" },
598
+ { label: "Credit", value: "CREDIT" },
599
+ { label: "Voucher", value: "VOUCHER" },
600
+ { label: "Experience", value: "POINT" },
601
+ { label: "Tier", value: "TIER" },
602
+ { label: "Title", value: "TITLE" },
603
+ { label: "Game", value: "GAME" },
604
+ { label: "Stamp", value: "STAMP" }
605
+ ]
606
+ }, null, 8, ["modelValue"]),
607
+ S(G, {
608
+ class: "cursor-pointer text-fm-color-neutral-gray-400",
609
+ "right-icon": "keyboard_arrow_down",
610
+ modelValue: s(u).source,
611
+ "onUpdate:modelValue": a[3] || (a[3] = (i) => s(u).source = i),
612
+ label: "Source: ",
613
+ "show-item-label": !0,
614
+ items: s(r)
615
+ }, null, 8, ["modelValue", "items"]),
616
+ S(ae, {
617
+ "model-value": {
618
+ startDate: s(u).dateRange.startDate,
619
+ endDate: s(u).dateRange.endDate
620
+ },
621
+ "onUpdate:modelValue": a[4] || (a[4] = (i) => s(u).dateRange = {
622
+ startDate: s(R)(i.startDate).startOf("d").toISOString(),
623
+ endDate: s(R)(i.endDate).endOf("d").toISOString()
624
+ })
625
+ }, null, 8, ["model-value"])
626
+ ]),
627
+ S(g, {
628
+ class: "xs:hidden",
629
+ modelValue: s(u).search,
630
+ "onUpdate:modelValue": a[5] || (a[5] = (i) => s(u).search = i),
631
+ placeholder: "Search",
632
+ collapsible: ""
633
+ }, null, 8, ["modelValue"]),
634
+ h("div", $e, [
635
+ S(y, {
636
+ icon: "ios_share",
637
+ variant: "tertiary",
638
+ onClick: f
639
+ })
640
+ ])
641
+ ]),
642
+ S(ne, {
643
+ loading: s(C).isLoading,
644
+ "row-data": s(M),
645
+ "row-count": s(C).totalRows,
646
+ "column-defs": D.filter(
647
+ (i) => !x.user || i.header !== "User" && i.header !== "Phone No."
648
+ ),
649
+ "page-count": s(C).pageCount,
650
+ "page-index": s(C).pageIndex,
651
+ "page-size": s(C).pageSize,
652
+ "shrink-at": !1,
653
+ onSortChange: s(d),
654
+ onPageChange: a[6] || (a[6] = (i) => s(t)({
655
+ pageSize: i.pageSize,
656
+ pageIndex: i.pageIndex
657
+ })),
658
+ onRowClick: N
659
+ }, null, 8, ["loading", "row-data", "row-count", "column-defs", "page-count", "page-index", "page-size", "onSortChange"])
660
+ ]),
661
+ S(Pe, {
662
+ ref_key: "transactionDetailSheet",
663
+ ref: T
664
+ }, null, 512)
665
+ ], 64);
666
+ };
667
+ }
668
+ });
669
+ class Be extends se {
670
+ }
671
+ const ze = { class: "flex items-center justify-between" }, Le = { class: "flex gap-8 items-center" }, Ke = { class: "flex gap-8 items-center xs:hidden" }, ba = /* @__PURE__ */ q({
672
+ __name: "StoreTransactions",
673
+ props: {
674
+ user: {
675
+ type: String
676
+ }
677
+ },
678
+ setup(m) {
679
+ const p = m, { minor: w } = xe;
680
+ ye();
681
+ const c = [
682
+ {
683
+ header: "Transaction ID",
684
+ meta: {
685
+ maxWidth: "150px"
686
+ },
687
+ cell(e) {
688
+ return n("div", { class: "flex items-center" }, [
689
+ n(v.FmIcon, {
690
+ name: "content_copy",
691
+ outline: !0,
692
+ size: "sm",
693
+ class: "cursor-pointer mr-4 shrink-0",
694
+ onClick: (l) => {
695
+ l.preventDefault(), l.stopPropagation(), W(e.row.original._id.toString());
696
+ }
697
+ }),
698
+ n("div", { class: "truncate" }, e.row.original._id.toString())
699
+ ]);
700
+ }
701
+ },
702
+ {
703
+ header: "Created at",
704
+ accessorFn: (e) => R(V(e._id.toString())).format("D MMM YYYY, hh:mmA"),
705
+ enableSorting: !0
706
+ },
707
+ {
708
+ header: "Bundle",
709
+ accessorFn: (e) => e.bundle.name
710
+ },
711
+ {
712
+ header: "Location",
713
+ accessorFn: (e) => e.location ? e.pf_location.name : "Online Store"
714
+ },
715
+ {
716
+ header: "Payment Type",
717
+ accessorFn: (e) => {
718
+ var l;
719
+ return ((l = e.paymentType) == null ? void 0 : l.type) ?? "N/A";
720
+ },
721
+ cell(e) {
722
+ var l, r;
723
+ return n("div", { class: "flex items-center gap-4" }, [
724
+ n("div", { class: "flex items-center" }, [
725
+ ((l = e.row.original.paymentType) == null ? void 0 : l.type) == "ONLINE" && e.row.original.paymentType.extra ? n(
726
+ v.FmTooltip,
727
+ {
728
+ content: e.row.original.paymentType.extra
729
+ },
730
+ [
731
+ n(v.FmIcon, {
732
+ name: "info",
733
+ outline: !0,
734
+ size: "sm"
735
+ })
736
+ ]
737
+ ) : n("div")
738
+ ]),
739
+ n(
740
+ "div",
741
+ { class: "flex-1" },
742
+ ((r = e.row.original.paymentType) == null ? void 0 : r.type) ?? "N/A"
743
+ )
744
+ ]);
745
+ }
746
+ },
747
+ {
748
+ header: "User",
749
+ cell: (e) => re(e.row.original.pf_member)
750
+ },
751
+ {
752
+ header: "Phone No.",
753
+ accessorFn: (e) => e.pf_member.phoneNumber
754
+ },
755
+ {
756
+ header: "Status",
757
+ // accessorFn: (u) => u.status,
758
+ cell(e) {
759
+ var l, r, b, f;
760
+ return n("div", { class: "flex items-center" }, [
761
+ n("div", Se.title(e.row.original.status)),
762
+ n("div", { class: "flex items-center" }, [
763
+ (r = (l = e.row.original) == null ? void 0 : l.refund) != null && r.reason ? n(
764
+ v.FmTooltip,
765
+ {
766
+ content: (f = (b = e.row.original) == null ? void 0 : b.refund) == null ? void 0 : f.reason
767
+ },
768
+ [
769
+ n(v.FmIcon, {
770
+ name: "info",
771
+ color: "primary",
772
+ outline: !0,
773
+ size: "sm",
774
+ class: "pl-2"
775
+ })
776
+ ]
777
+ ) : n("div")
778
+ ])
779
+ ]);
780
+ }
781
+ },
782
+ {
783
+ header: "Source",
784
+ accessorFn: (e) => e.source
785
+ },
786
+ {
787
+ header: "Ref",
788
+ accessorFn: (e) => e.ref
789
+ },
790
+ {
791
+ id: "action",
792
+ cell(e) {
793
+ const l = e.row.original, r = l.status === "COMPLETED" && !l.refund;
794
+ return r ? n(
795
+ v.FmMenu,
796
+ {
797
+ placement: "bottom-end",
798
+ onClick: (b) => {
799
+ b.stopPropagation();
800
+ }
801
+ },
802
+ {
803
+ "menu-button": () => n(v.FmButton, {
804
+ icon: "settings",
805
+ variant: "tertiary",
806
+ if: r
807
+ }),
808
+ default: () => [
809
+ n(v.FmMenuItem, {
810
+ label: "Refund",
811
+ sublabel: "Refund this transaction",
812
+ onClick: async (b) => {
813
+ b.stopPropagation(), await d(l);
814
+ }
815
+ })
816
+ ]
817
+ }
818
+ ) : n("div");
819
+ }
820
+ }
821
+ ], x = A({
822
+ searchValue: "",
823
+ dateRange: {
824
+ startDate: R().subtract(7, "day").toISOString(),
825
+ endDate: R().toISOString()
826
+ }
827
+ }), { tableMeta: _, rowData: D, onSort: u, debouncedFetchData: C, onSearch: M } = oe(async (e) => {
828
+ const l = {
829
+ ...x.value.dateRange,
830
+ user: p.user
831
+ };
832
+ return await L.readStoreTransactions(e, l);
833
+ });
834
+ async function d(e) {
835
+ await he.confirm(
836
+ "Are you sure you want to refund this transaction?",
837
+ "Refund Store Transaction",
838
+ "Confirm",
839
+ "Cancel"
840
+ ) && await w(
841
+ async () => {
842
+ var r;
843
+ await Te.refundStoreTransaction({
844
+ id: e._id,
845
+ reason: `ADMIN:${(r = we().sessionUser) == null ? void 0 : r.name}`
846
+ }), await C();
847
+ },
848
+ {
849
+ message: "Refunding transaction...",
850
+ successMessage: "Transaction refunded successfully"
851
+ }
852
+ );
853
+ }
854
+ Z(
855
+ x,
856
+ () => {
857
+ C();
858
+ },
859
+ { deep: !0 }
860
+ ), ge(async () => {
861
+ await C();
862
+ });
863
+ const t = async () => le({
864
+ exporter: new Be(),
865
+ readFunction: (e) => L.readStoreTransactions(e, {
866
+ ...x.value.dateRange,
867
+ user: p.user
868
+ }),
869
+ transformRecord: (e) => {
870
+ var l, r, b, f, T, N;
871
+ return {
872
+ TransactionId: ((l = e._id) == null ? void 0 : l.toString()) || "",
873
+ CreatedAt: R(V(e._id.toString())).format(
874
+ "DD/MM/YYYY HH:mm:ss"
875
+ ),
876
+ Bundle: e.bundle.name || "",
877
+ Location: e.location ? e.pf_location.name : "Online Store",
878
+ PaymentType: ((r = e.paymentType) == null ? void 0 : r.type) || "N/A",
879
+ PaymentExtra: ((b = e.paymentType) == null ? void 0 : b.extra) || "",
880
+ User: ((f = e.pf_member) == null ? void 0 : f.name) || "",
881
+ PhoneNumber: ((T = e.pf_member) == null ? void 0 : T.phoneNumber) || "",
882
+ Status: e.status || "",
883
+ RefundReason: ((N = e == null ? void 0 : e.refund) == null ? void 0 : N.reason) || ""
884
+ };
885
+ },
886
+ filename: "store-transactions"
887
+ });
888
+ return (e, l) => {
889
+ const r = k("FmSearch"), b = k("FmButton");
890
+ return F(), O("div", null, [
891
+ h("div", ze, [
892
+ h("div", Le, [
893
+ S(ae, {
894
+ modelValue: s(x).dateRange,
895
+ "onUpdate:modelValue": l[0] || (l[0] = (f) => s(x).dateRange = f)
896
+ }, null, 8, ["modelValue"])
897
+ ]),
898
+ h("div", Ke, [
899
+ S(r, {
900
+ modelValue: s(_).searchValue,
901
+ "onUpdate:modelValue": [
902
+ l[1] || (l[1] = (f) => s(_).searchValue = f),
903
+ s(M)
904
+ ],
905
+ placeholder: "Search",
906
+ collapsible: ""
907
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]),
908
+ S(b, {
909
+ icon: "ios_share",
910
+ variant: "tertiary",
911
+ onClick: t
912
+ })
913
+ ])
914
+ ]),
915
+ S(ne, {
916
+ loading: s(_).isLoading,
917
+ "row-data": s(D),
918
+ "row-count": s(_).totalRows,
919
+ "column-defs": c.filter(
920
+ (f) => !p.user || f.header !== "User" && f.header !== "Phone No."
921
+ ),
922
+ "page-count": s(_).pageCount,
923
+ "page-index": s(_).pageIndex,
924
+ "page-size": s(_).pageSize,
925
+ "shrink-at": !1,
926
+ onSortChange: s(u),
927
+ onPageChange: l[2] || (l[2] = (f) => s(C)({
928
+ pageSize: f.pageSize,
929
+ pageIndex: f.pageIndex
930
+ }))
931
+ }, null, 8, ["loading", "row-data", "row-count", "column-defs", "page-count", "page-index", "page-size", "onSortChange"])
932
+ ]);
933
+ };
934
+ }
935
+ });
936
+ export {
937
+ va as _,
938
+ ba as a
939
+ };