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

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