@feedmepos/mf-connect 0.1.58-prod → 0.1.59-prod

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