@feedmepos/mf-connect 0.1.38-beta.52 → 0.1.38-beta.53

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