@feedmepos/mf-connect 0.1.0-beta.6 → 0.1.0-beta.60

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