@feedmepos/mf-connect 0.1.38-beta.70 → 0.1.38-beta.72

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/package.json +1 -1
  2. package/dist/Analytic-qVhEo_im.js +0 -761
  3. package/dist/App-Ixv1jrHc.js +0 -4638
  4. package/dist/AuditLogs-B2D62tMF.js +0 -1991
  5. package/dist/Bin-Lj7jtS9m.js +0 -166
  6. package/dist/Broadcast-BpP9VJsx.js +0 -267
  7. package/dist/CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BB43gKXv.js +0 -121
  8. package/dist/Card-CjArjpou.js +0 -909
  9. package/dist/ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js +0 -97
  10. package/dist/Collections-CFzUAHxz.js +0 -540
  11. package/dist/Credit-D43x-T3d.js +0 -261
  12. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-Du7fRSZC.js +0 -128
  13. package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-eIoPtgO5.js +0 -58
  14. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-DlgTeQLe.js +0 -3167
  15. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-9UhSzClJ.js +0 -351
  16. package/dist/Experience-BaUbRoHV.js +0 -260
  17. package/dist/FileSaver.min-BO_rbswB.js +0 -74
  18. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js +0 -129
  19. package/dist/Game-DaVqgPWQ.js +0 -331
  20. package/dist/GenerateMaterial-DJM8fZyl.js +0 -589
  21. package/dist/Grab-CykZDrWI.js +0 -301
  22. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-C51yGAp9.js +0 -145
  23. package/dist/Index-Do3WIIfM.js +0 -259
  24. package/dist/JsonViewer-v8_C7l5N.js +0 -87
  25. package/dist/LottieAnimation.vue_vue_type_script_setup_true_lang-BjdBaj4c.js +0 -18737
  26. package/dist/MainLayout-DD-OlYxZ.js +0 -41
  27. package/dist/Marketing-C9bsnUaQ.js +0 -145
  28. package/dist/MarketingMaterialEdit-CbSh8dpn.js +0 -746
  29. package/dist/Member-IcVRwAAS.js +0 -280
  30. package/dist/MemberList-C_A4PrQN.js +0 -1605
  31. package/dist/MemberOverview-wL_ailso.js +0 -58
  32. package/dist/MemberTransactions-CBoaY-gv.js +0 -45
  33. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-Dx28XNPi.js +0 -60798
  34. package/dist/Mission-COY_uhwz.js +0 -335
  35. package/dist/Overview-DDSz2R4K.js +0 -1078
  36. package/dist/Point-C-KEwgx4.js +0 -263
  37. package/dist/Promotion-BpW9qWzf.js +0 -397
  38. package/dist/Queue-CO32O8i6.js +0 -259
  39. package/dist/Record-BrT5DR9L.js +0 -341
  40. package/dist/Reward-CbrEw-If.js +0 -442
  41. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-CpNjlbjZ.js +0 -149
  42. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-BS5jsRiN.js +0 -1912
  43. package/dist/Segment-Cu9_qwXc.js +0 -881
  44. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-BH-hzxSs.js +0 -181
  45. package/dist/SendCollectionSheet.vue_vue_type_script_setup_true_lang-DGm3gujH.js +0 -188
  46. package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-DcUb8X-q.js +0 -147
  47. package/dist/Setting-CQKfb5b_.js +0 -1999
  48. package/dist/SettingAdvertisements-BxR6Gl-5.js +0 -263
  49. package/dist/Store-6TUpmqAr.js +0 -1995
  50. package/dist/StoreRewards-BOThAOWU.js +0 -534
  51. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-BYD229dz.js +0 -1034
  52. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-CAamZtdf.js +0 -7005
  53. package/dist/Tier-MF-ad-xm.js +0 -969
  54. package/dist/Title-MkjTHBzb.js +0 -567
  55. package/dist/Transaction-trYJwTrc.js +0 -39
  56. package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-DwlNK1TC.js +0 -130
  57. package/dist/Voucher-BD5dTdht.js +0 -422
  58. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-BhR_s48Q.js +0 -421
  59. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-CcTe5TJL.js +0 -56
  60. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +0 -9
  61. package/dist/app-CybjF-6Q.js +0 -59071
  62. package/dist/app-wDQR6dpb.js +0 -39
  63. package/dist/app.js +0 -7
  64. package/dist/business-2hCbD0JX.js +0 -82
  65. package/dist/campaign-Bv-8uM2S.js +0 -100
  66. package/dist/campaign-CpzFl8Vr.js +0 -4
  67. package/dist/campaign-h1J8NTAo.js +0 -253
  68. package/dist/campaign.enum-Dea0E4o1.js +0 -26
  69. package/dist/campaign.fn-DqxZMyu0.js +0 -776
  70. package/dist/collectible.enum-DOyAoz4F.js +0 -19
  71. package/dist/collection.fn-DU2HuZod.js +0 -26
  72. package/dist/dto-CT65-FHY.js +0 -222
  73. package/dist/duplicateCampaign-YJGHvOqb.js +0 -51
  74. package/dist/effect-XZ767UQ4.js +0 -89
  75. package/dist/email-addresses-DSgkxSnV.js +0 -705
  76. package/dist/export-4gx5C9s9.js +0 -96
  77. package/dist/feedme.ico +0 -0
  78. package/dist/helper-HOLsJca3.js +0 -86
  79. package/dist/index-BO7N-s4K.js +0 -8912
  80. package/dist/index-BfRa1sI3.js +0 -54
  81. package/dist/index-BnCtmlvU.js +0 -28897
  82. package/dist/index-C5VvGYtP.js +0 -56
  83. package/dist/index-CSzvYzf4.js +0 -3419
  84. package/dist/index-CrdkPXsx.js +0 -124
  85. package/dist/index-CuvNtC_M.js +0 -61
  86. package/dist/index-CxE-VVlL.js +0 -76
  87. package/dist/index-Djenbz3F.js +0 -3
  88. package/dist/index-IHteBJ_D.js +0 -32
  89. package/dist/index-dUhOAfj9.js +0 -2423
  90. package/dist/index-vh86FiIQ.js +0 -10
  91. package/dist/index-wm4nGBB_.js +0 -30289
  92. package/dist/index-xTrAj026.js +0 -31
  93. package/dist/index-yViT18i_.js +0 -36
  94. package/dist/index.esm2017-Wq4FUMEv.js +0 -3069
  95. package/dist/loading-D22xapd8.js +0 -215
  96. package/dist/lodash-HM6bxuWV.js +0 -3678
  97. package/dist/membership-CX464ZBI.js +0 -235
  98. package/dist/moment-D7p2TMB-.js +0 -2583
  99. package/dist/money-B3cPZAZu.js +0 -15
  100. package/dist/number-DT65dEZt.js +0 -12
  101. package/dist/object-qECH92oz.js +0 -26
  102. package/dist/objectId-dwaoBfJX.js +0 -7
  103. package/dist/objectid-DZWw4iLL.js +0 -145
  104. package/dist/plugins-D-4BlIGs.js +0 -1817
  105. package/dist/remy-D_Deb3ue.js +0 -13
  106. package/dist/reward-C6B-kn0X.js +0 -36
  107. package/dist/rule-B94SrDX1.js +0 -1969
  108. package/dist/rule-builder-CQ3uHeX4.js +0 -102
  109. package/dist/style.css +0 -13
  110. package/dist/template-CXB2Ez2S.js +0 -188
  111. package/dist/tier-BJDhpH6X.js +0 -4
  112. package/dist/tiers/tier=1.png +0 -0
  113. package/dist/tiers/tier=2.png +0 -0
  114. package/dist/tiers/tier=3.png +0 -0
  115. package/dist/tiers/tier=4.png +0 -0
  116. package/dist/timezone-D3NuV-rx.js +0 -1154
  117. package/dist/titles/type=diamond.png +0 -0
  118. package/dist/titles/type=drinks.png +0 -0
  119. package/dist/titles/type=food.png +0 -0
  120. package/dist/titles/type=heart.png +0 -0
  121. package/dist/titles/type=medal.png +0 -0
  122. package/dist/titles/type=spend.png +0 -0
  123. package/dist/titles/type=thank-you.png +0 -0
  124. package/dist/titles/type=thumbs-up.png +0 -0
  125. package/dist/titles/type=years.png +0 -0
  126. package/dist/trigger-BsCVC_nU.js +0 -213
  127. package/dist/tslib.es6-BCqqvLQ_.js +0 -44
  128. package/dist/type_drinks-D6jnpvwV.js +0 -4
  129. package/dist/usePagination-BOZ0-D67.js +0 -223
  130. package/dist/user-Dxp7kluY.js +0 -55
  131. package/dist/vue-i18n-DpCWu1gI.js +0 -2365
  132. package/dist/xlsx-Cc2a2IL9.js +0 -15491
  133. package/dist/zod-BCSHGdXs.js +0 -91
@@ -1,1034 +0,0 @@
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-CSzvYzf4.js";
4
- import "./index-wm4nGBB_.js";
5
- import { s as we } from "./index-xTrAj026.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-DT65dEZt.js";
11
- import { u as le } from "./business-2hCbD0JX.js";
12
- import { u as ie, _ as ce } from "./usePagination-BOZ0-D67.js";
13
- import { a as Z, c as Te, p as Re } from "./plugins-D-4BlIGs.js";
14
- import { g as ue } from "./user-Dxp7kluY.js";
15
- import { B as me, e as de } from "./export-4gx5C9s9.js";
16
- import { u as pe } from "./campaign-Bv-8uM2S.js";
17
- import "./index-Djenbz3F.js";
18
- import "./index-dUhOAfj9.js";
19
- import "./index-BO7N-s4K.js";
20
- import "./index-BfRa1sI3.js";
21
- import { u as fe } from "./vue-i18n-DpCWu1gI.js";
22
- import { o as U } from "./objectId-dwaoBfJX.js";
23
- import { u as ge, m as Ce } from "./loading-D22xapd8.js";
24
- import { useRouter as Ie } from "vue-router";
25
- import { t as L } from "./index-C5VvGYtP.js";
26
- import { R as H } from "./app-CybjF-6Q.js";
27
- import { F as q } from "./collectible.enum-DOyAoz4F.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
- };