@feedmepos/mf-connect 0.1.38-beta.2 → 0.1.39-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 (110) hide show
  1. package/dist/Analytic-D8WCDkga.js +427 -0
  2. package/dist/{App-D11A2JY1.js → App-CTnXtg1W.js} +352 -364
  3. package/dist/{Bin-9wV4Ah3M.js → Bin-BY6-bvFj.js} +8 -8
  4. package/dist/{Broadcast-I3BtSk8V.js → Broadcast-5VTEIQAr.js} +40 -40
  5. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-XJqTXbKr.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BuAQxEM4.js} +18 -18
  6. package/dist/{Card-CqALG5RM.js → Card-8ivdV-Qz.js} +159 -159
  7. package/dist/{Collections-rg3SzoUb.js → Collections-CFszRHmE.js} +91 -103
  8. package/dist/{Credit-BNn1sYZv.js → Credit-DFslY__4.js} +74 -74
  9. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-PJ8q72XH.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-BvCLYtJ3.js} +488 -489
  10. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-Sww7KNle.js → EffectSheet.vue_vue_type_style_index_0_lang-Ci_bp7GH.js} +94 -94
  11. package/dist/{Experience-D_Qm8SUj.js → Experience-BxfiZNlY.js} +41 -41
  12. package/dist/{Game-CKXgXm6Q.js → Game-0FZJcLmj.js} +31 -31
  13. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-ByhTB9Ie.js +144 -0
  14. package/dist/{Index-D4DGfUHd.js → Index-ByeKKbuM.js} +10 -10
  15. package/dist/Marketing-C7F4abzg.js +319 -0
  16. package/dist/{Member-B55vWHDd.js → Member-DP0fLSIV.js} +64 -64
  17. package/dist/MemberList-DFW2bMbr.js +1606 -0
  18. package/dist/MemberOverview-C2n9oJZh.js +58 -0
  19. package/dist/{MemberTransactions-CP5EI-W0.js → MemberTransactions-CW62fvgx.js} +1 -1
  20. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-iJXNbgsB.js +455 -0
  21. package/dist/{Mission-CFvhROuB.js → Mission-DEgQHJw6.js} +21 -21
  22. package/dist/{Overview-4273yNwL.js → Overview-5jDtZKi8.js} +335 -335
  23. package/dist/{Point-B_-_C919.js → Point-D2lB1-xB.js} +41 -41
  24. package/dist/{Promotion-D2S3COxk.js → Promotion-Diz1gIa0.js} +42 -42
  25. package/dist/{Queue-BmS1Oi-C.js → Queue-DIAuq7HG.js} +51 -51
  26. package/dist/{Record-DRBl0M8g.js → Record-T608yda1.js} +9 -9
  27. package/dist/{Reward-8056NmfK.js → Reward-fZzHrHCW.js} +173 -173
  28. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-CJ_WC2gV.js → RewardGroup.vue_vue_type_script_setup_true_lang-YOKVfimM.js} +11 -11
  29. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-DqNQl_nz.js → RuleGroup.vue_vue_type_script_setup_true_lang-C3_lmBe5.js} +431 -431
  30. package/dist/Segment-DDQIzsrk.js +882 -0
  31. package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-4nNkkklE.js → SelectItems.vue_vue_type_script_setup_true_lang-B5oUf91Q.js} +2 -2
  32. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-Dnf2oxOG.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-C2U6Kzvx.js} +11 -11
  33. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-BLYP-5U9.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-BRmqgxES.js} +3 -3
  34. package/dist/{Setting-BrJfYoru.js → Setting-CQNyXmp4.js} +432 -432
  35. package/dist/{Store-Bpl_4yZW.js → Store-CIA1Rtsg.js} +210 -210
  36. package/dist/StoreRewards-D5zlE6cE.js +423 -0
  37. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-BkTYngJ_.js +995 -0
  38. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-QucRaI08.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-D8l3fQyz.js} +1 -1
  39. package/dist/{Tier-_LnXg3n6.js → Tier-jFXVOje_.js} +106 -106
  40. package/dist/{Title-B7AGStvx.js → Title-DVpZ1YMK.js} +131 -133
  41. package/dist/{Transaction-Chxv6V7u.js → Transaction-BF_wmok6.js} +2 -2
  42. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-CzXNmobp.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-Cex1Z43W.js} +6 -6
  43. package/dist/{Voucher-C5z2kOq9.js → Voucher-CaBMU5w0.js} +37 -37
  44. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-BXt2fLOD.js +419 -0
  45. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-BlXzEWA6.js → ZodTextField.vue_vue_type_script_setup_true_lang-CtHjWpUe.js} +1 -1
  46. package/dist/{app-BVojNX0w.js → app-CPhyKlyf.js} +1 -1
  47. package/dist/{app-7cvPyHJ7.js → app-DuIzRGvb.js} +124 -161
  48. package/dist/app.js +3 -4
  49. package/dist/{business-CmxV69wT.js → business-TTvv3aTz.js} +1 -1
  50. package/dist/{campaign-Dq5C_no-.js → campaign-BiMCoAzx.js} +3 -5
  51. package/dist/{campaign-CT_cNJEL.js → campaign-CjEVStN1.js} +9 -9
  52. package/dist/{campaign.enum-dp7yHKzF.js → campaign.enum-DpYmj9jp.js} +1 -1
  53. package/dist/campaign.fn-DJ6J98jS.js +758 -0
  54. package/dist/{collectible.enum-DxbB4DxT.js → collectible.enum-Cgmm_s-C.js} +1 -1
  55. package/dist/{collection.fn-CNZRdUgy.js → collection.fn-BsYCNgfJ.js} +2 -2
  56. package/dist/{dto-CT9zZbv9.js → dto-DgmHIlZ2.js} +4 -4
  57. package/dist/{effect-FIlOEC4H.js → effect-DnAVIDFy.js} +1 -1
  58. package/dist/{email-addresses-Ba7xImfX.js → email-addresses-CMRgb6Uv.js} +1 -1
  59. package/dist/{export-uzjZFNF9.js → export-DtarK6IJ.js} +3 -3
  60. package/dist/{helper-D4sAZde0.js → helper-BKZghMbF.js} +1 -1
  61. package/dist/{index-l2F5MnLF.js → index-2OAcPmuQ.js} +1 -1
  62. package/dist/{index-BI3m1Ehv.js → index-B0YZKHyu.js} +3 -3
  63. package/dist/{index-CH3z92VV.js → index-B5oXFFlO.js} +1 -1
  64. package/dist/{index-CvBcve-r.js → index-BQ3KHJXX.js} +1 -1
  65. package/dist/{index-B9pl4zRZ.js → index-B_893fH7.js} +79 -179
  66. package/dist/{index-CNJLP3D5.js → index-BoR-BOFw.js} +1 -1
  67. package/dist/{index-DNxa8Rqx.js → index-C7rl1eHp.js} +449 -516
  68. package/dist/{index-BXz54M1s.js → index-CBcbwf0k.js} +1 -1
  69. package/dist/{index-CS3Jmojj.js → index-CIztuDE4.js} +2462 -2453
  70. package/dist/{index-D5rvMvzx.js → index-CK67enPK.js} +1 -1
  71. package/dist/index-CuvNtC_M.js +61 -0
  72. package/dist/index-D2uZzjpn.js +44 -0
  73. package/dist/{index-CUfS9Kp1.js → index-DWdAUovq.js} +9 -9
  74. package/dist/{index-CONvJfKv.js → index-DkWcEDHA.js} +1 -1
  75. package/dist/{index-BjU8LVUC.js → index-VHu8hYtE.js} +385 -376
  76. package/dist/{index.esm2017-ATcsD5N4.js → index.esm2017-DkwLmmR_.js} +127 -127
  77. package/dist/{loading-BWGQSrCB.js → loading-BFkEqWR6.js} +1 -1
  78. package/dist/{membership-Cc4OZ8-U.js → membership-D0eN3i_T.js} +3 -3
  79. package/dist/{money-D7p8nfun.js → money-DS9ZQwSP.js} +1 -1
  80. package/dist/{number-CMJjC4qz.js → number-C8Gt93v9.js} +1 -1
  81. package/dist/objectid-Cr99eTPd.js +145 -0
  82. package/dist/{plugins-eQis66QR.js → plugins-DK_ue6Xa.js} +2 -2
  83. package/dist/{reward-DrnzbG20.js → reward-CW2dSLDW.js} +1 -1
  84. package/dist/{rule-CtRxkYXB.js → rule-CebKyXSm.js} +3 -3
  85. package/dist/{rule-builder-Di9RIYHF.js → rule-builder-kQq14RfN.js} +17 -17
  86. package/dist/style.css +1 -1
  87. package/dist/{template-C3UfY0v5.js → template-CxUxlb6-.js} +64 -64
  88. package/dist/{trigger-C9U7Zgad.js → trigger-RqJo06KA.js} +4 -4
  89. package/dist/{usePagination-BeF5K3M7.js → usePagination-JoYaROkV.js} +85 -85
  90. package/dist/{user-D7n9yYmO.js → user-DhV5Iy52.js} +1 -1
  91. package/dist/{vue-i18n-Bz45zC04.js → vue-i18n-BtvUK9hI.js} +419 -419
  92. package/dist/{xlsx-D4S4qbcZ.js → xlsx-WnLDq4qn.js} +381 -381
  93. package/package.json +3 -9
  94. package/dist/Analytic-BjSfI2Ff.js +0 -761
  95. package/dist/AuditLogs-DWCFYoRg.js +0 -1887
  96. package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-BUzUIIUW.js +0 -58
  97. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-rWUkV9gn.js +0 -144
  98. package/dist/Marketing-Dn9A1vgH.js +0 -20073
  99. package/dist/MemberList-BWTG9Ohy.js +0 -1606
  100. package/dist/MemberOverview-wL_ailso.js +0 -58
  101. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-D--_An-f.js +0 -60279
  102. package/dist/Segment-Bzq-pyhc.js +0 -882
  103. package/dist/StoreRewards-Cu7n7Pjz.js +0 -423
  104. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-T3Wo2maC.js +0 -1029
  105. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-DdGMrk2C.js +0 -419
  106. package/dist/campaign.fn-BYZgKDN7.js +0 -758
  107. package/dist/index-CsaQJMAR.js +0 -66
  108. package/dist/index-CwsMG2cV.js +0 -56
  109. package/dist/objectid-D5T27iny.js +0 -145
  110. package/dist/remy-vue-client-Cpppk9h-.js +0 -1693
@@ -1,1029 +0,0 @@
1
- import { defineComponent as Q, ref as O, computed as W, h as n, resolveComponent as $, openBlock as k, createBlock as ae, unref as l, isRef as ye, withCtx as oe, createElementVNode as h, createVNode as w, createElementBlock as B, Fragment as X, renderList as ne, toDisplayString as H, createTextVNode as he, resolveDynamicComponent as ve, watch as re, onBeforeMount as be, onMounted as _e } from "vue";
2
- import { components as y, useDialog as Se } from "@feedmepos/ui-library";
3
- import { r as z } from "./index-DNxa8Rqx.js";
4
- import "./index-CS3Jmojj.js";
5
- import { s as xe } from "./index-CH3z92VV.js";
6
- import { h as S } from "./moment-BWErdI6_.js";
7
- import { _ as j } from "./FilterChip.vue_vue_type_script_setup_true_lang-d8rh38tD.js";
8
- import { _ as se } from "./DateRangeChip.vue_vue_type_script_setup_true_lang-BUzUIIUW.js";
9
- import { s as G } from "./index-CsaQJMAR.js";
10
- import { f as J } from "./number-CMJjC4qz.js";
11
- import { u as le } from "./business-CmxV69wT.js";
12
- import { u as ie, _ as ce } from "./usePagination-BeF5K3M7.js";
13
- import { a as Z, c as we, p as Te } from "./plugins-eQis66QR.js";
14
- import { g as ue } from "./user-D7n9yYmO.js";
15
- import { B as me, e as de } from "./export-uzjZFNF9.js";
16
- import { u as pe } from "./campaign-Dq5C_no-.js";
17
- import "./index-CNJLP3D5.js";
18
- import "./index-B9pl4zRZ.js";
19
- import "./index-CUfS9Kp1.js";
20
- import "./index-CONvJfKv.js";
21
- import "./index-BI3m1Ehv.js";
22
- import { u as Re } from "./vue-i18n-Bz45zC04.js";
23
- import { o as U } from "./objectId-dwaoBfJX.js";
24
- import { u as fe } from "./loading-BWGQSrCB.js";
25
- import { useRouter as Ce } from "vue-router";
26
- import { t as Y } from "./index-CwsMG2cV.js";
27
- import { R as K } from "./app-7cvPyHJ7.js";
28
- import { F as q } from "./collectible.enum-DxbB4DxT.js";
29
- import { useCoreStore as Ae } from "@feedmepos/mf-common";
30
- import { m as Ie } from "./index-l2F5MnLF.js";
31
- function De(m) {
32
- let p = "";
33
- switch (m) {
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 = m;
57
- break;
58
- }
59
- return p;
60
- }
61
- function Fe(m) {
62
- var p, R, u, T, x, I;
63
- switch ((p = m == null ? void 0 : m.pf_collectible) == null ? void 0 : p.type) {
64
- case "VOUCHER":
65
- return `${(R = m.pf_collectible) == null ? void 0 : R.type} (${(u = m.pf_collectible) == null ? void 0 : u.name})`;
66
- case "TITLE":
67
- return `${(T = m.pf_collectible) == null ? void 0 : T.type} (${(x = m.pf_collectible) == null ? void 0 : x.name})`;
68
- case "POINT":
69
- return "Experience";
70
- case "COIN":
71
- return "Point";
72
- default:
73
- return xe((I = m == null ? void 0 : m.pf_collectible) == null ? void 0 : I.type);
74
- }
75
- }
76
- function Ee(m) {
77
- switch (m) {
78
- case "ONLINE":
79
- return "Online";
80
- case "COIN":
81
- return "Point";
82
- default:
83
- return m;
84
- }
85
- }
86
- const N = {
87
- getReason: De,
88
- formattedType: Fe,
89
- formattedPaymentType: Ee
90
- };
91
- class ke extends me {
92
- }
93
- const Ne = { class: "space-y-24 pr-12" }, Oe = { class: "w-full space-y-16" }, Me = { class: "fm-typo-en-body-lg-600" }, Pe = ["onClick"], Ve = { class: "fm-typo-en-body-lg-600" }, Be = ["onClick"], Ye = { class: "flex items-center gap-8" }, Ue = /* @__PURE__ */ Q({
94
- __name: "TransactionDetailSheet",
95
- setup(m, { expose: p }) {
96
- Re();
97
- const R = O(!1), u = O(), T = pe(), x = le();
98
- function I(d, o) {
99
- R.value = d, u.value = o ?? null;
100
- }
101
- const M = W(() => {
102
- var d, o;
103
- return J(
104
- ((o = u.value) == null ? void 0 : o.expiryAmount.reduce(
105
- (e, i) => e + i.amount,
106
- ((d = u.value) == null ? void 0 : d.amount) ?? 0
107
- )) ?? 0,
108
- 2
109
- );
110
- }), c = W(() => {
111
- var d, o, e, i, s;
112
- return u.value ? [
113
- {
114
- label: "Transaction ID",
115
- value: (d = u.value) == null ? void 0 : d._id
116
- },
117
- {
118
- label: "Date/Time",
119
- value: S(U(u.value._id.toString())).format(
120
- "D MMM YYYY, hh:mmA"
121
- )
122
- },
123
- {
124
- label: "Amount",
125
- component: () => n(
126
- "span",
127
- {
128
- class: [
129
- "pr-2",
130
- +M.value > 0 ? "text-fm-color-system-success-300" : "text-fm-color-system-error-300"
131
- ]
132
- },
133
- M.value
134
- )
135
- },
136
- {
137
- label: "Type",
138
- value: N.formattedType(u.value)
139
- },
140
- {
141
- label: "Source",
142
- value: G(N.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: (s = (i = u.value) == null ? void 0 : i.pf_user) == null ? void 0 : s.phoneNumber
151
- }
152
- ] : [];
153
- }), D = W(() => {
154
- var i, s, v, g;
155
- if (!u.value) return [];
156
- const d = [], o = (i = u.value) == null ? void 0 : i.metadata, e = u.value;
157
- if (o != null && o.campaign) {
158
- const C = T.campaigns.all.find(
159
- (P) => P._id === (o == null ? void 0 : o.campaign)
160
- );
161
- if (!C) return;
162
- d.push({
163
- label: "Campaign",
164
- value: C.name
165
- });
166
- }
167
- return o != null && o.remark && d.push({
168
- label: "Remark",
169
- value: o.remark
170
- }), (s = u.value) != null && s.ref.startsWith("bill_") && d.push({
171
- label: "Bill Number",
172
- value: (v = u.value) == null ? void 0 : v.ref,
173
- copy: () => {
174
- var C;
175
- return Z((C = u.value) == null ? void 0 : C.ref);
176
- }
177
- }), o != null && o.location && d.push({
178
- label: "Location",
179
- value: (g = x.locations.find(
180
- (C) => C._id.toString() === (o == null ? void 0 : o.location)
181
- )) == null ? void 0 : g.name
182
- }), e.source === z.enum.STORE && d.push({
183
- label: "Store Transaction",
184
- value: e.ref
185
- }), o != null && o.originTransaction && d.push({
186
- label: "Parent Transaction",
187
- value: o.originTransaction
188
- }), o != null && o.referral_count && d.push({
189
- label: "Referral Count",
190
- value: o.referral_count
191
- }), e.refunded && d.push({
192
- label: "Refunded From",
193
- value: e.refundedFrom
194
- }), d;
195
- });
196
- return p({
197
- showSheet: I
198
- }), (d, o) => {
199
- const e = $("FmButton"), i = $("FmSideSheet");
200
- return k(), ae(i, {
201
- "max-width": 560,
202
- modelValue: l(R),
203
- "onUpdate:modelValue": o[1] || (o[1] = (s) => ye(R) ? R.value = s : null),
204
- header: "Transaction Details"
205
- }, {
206
- "side-sheet-footer": oe(() => [
207
- h("div", Ye, [
208
- w(e, {
209
- label: "Close",
210
- onClick: o[0] || (o[0] = (s) => I(!1)),
211
- variant: "tertiary"
212
- })
213
- ])
214
- ]),
215
- default: oe(() => [
216
- h("div", Ne, [
217
- h("div", Oe, [
218
- (k(!0), B(X, null, ne(l(c), (s) => (k(), B("div", {
219
- key: s.label,
220
- class: "flex flex-col gap-4"
221
- }, [
222
- h("div", Me, H(s.label), 1),
223
- h("div", {
224
- class: "text-fm-color-typo-secondary fm-typo-en-body-md-400 hover:underline",
225
- onClick: s.copy
226
- }, [
227
- he(H(s.accessorFn ? s.accessorFn() : s.value) + " ", 1),
228
- (k(), ae(ve(s.component)))
229
- ], 8, Pe),
230
- o[2] || (o[2] = h("hr", { class: "mt-3" }, null, -1))
231
- ]))), 128)),
232
- (k(!0), B(X, null, ne(l(D), (s) => (k(), B("div", {
233
- key: s.label,
234
- class: "flex flex-col gap-4"
235
- }, [
236
- h("div", Ve, H(s.label), 1),
237
- h("div", {
238
- class: "text-fm-color-typo-secondary fm-typo-en-body-md-400 hover:underline",
239
- onClick: s.copy
240
- }, H(s.accessorFn ? s.accessorFn() : s.value), 9, Be),
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(m) {
258
- const p = le(), R = pe(), u = Ce(), T = m, x = O(!1), { minor: I } = fe, M = [
259
- {
260
- header: "Transaction ID",
261
- accessorKey: "_id",
262
- meta: {
263
- maxWidth: "100px"
264
- },
265
- cell(a) {
266
- return n("div", { class: "flex items-center" }, [
267
- n(y.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
- n(
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) => S(U(a._id.toString())),
289
- cell: (a) => S(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 b, r, _, F;
300
- const t = J(
301
- a.row.original.expiryAmount.reduce(
302
- (A, L) => A + L.amount,
303
- a.row.original.amount ?? 0
304
- ),
305
- 2
306
- ), f = (r = (b = a.row.original.expiryAmount) == null ? void 0 : b[0]) != null && r.expiredAt ? S((F = (_ = a.row.original.expiryAmount) == null ? void 0 : _[0]) == null ? void 0 : F.expiredAt).format(
307
- "D MMM YYYY"
308
- ) : "";
309
- return n("div", { class: "flex items-center" }, [
310
- n(
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
- n("div", { class: "flex items-center" }, [
321
- a.row.original.expiryAmount.length > 0 ? n(
322
- y.FmTooltip,
323
- {
324
- content: `Expired on ${f}`
325
- },
326
- [
327
- n(y.FmIcon, {
328
- name: "info",
329
- outline: !0,
330
- size: "sm"
331
- })
332
- ]
333
- ) : n("div")
334
- ])
335
- ]);
336
- }
337
- },
338
- {
339
- header: "Type",
340
- accessorKey: "pf_collectible.type",
341
- accessorFn: (a) => N.formattedType(a),
342
- meta: {
343
- maxWidth: "200px"
344
- },
345
- cell(a) {
346
- const t = N.formattedType(a.row.original);
347
- return n("div", { class: "flex items-center" }, [
348
- n("div", { class: "truncate text-ellipsis" }, t),
349
- t.length > 20 ? n(
350
- y.FmTooltip,
351
- {
352
- content: t
353
- },
354
- [
355
- n(y.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 n("div", { class: "flex items-center gap-4" }, [
372
- n(
373
- "div",
374
- { class: "truncate text-ellipsis" },
375
- G(N.getReason(a.row.original.source))
376
- ),
377
- ...(t = a.row.original.metadata) != null && t.campaign ? [
378
- n(
379
- y.FmTooltip,
380
- {
381
- get content() {
382
- var f;
383
- return (f = R.campaigns.all.find(
384
- (b) => {
385
- var r;
386
- return b._id === ((r = a.row.original.metadata) == null ? void 0 : r.campaign);
387
- }
388
- )) == null ? void 0 : f.name;
389
- }
390
- },
391
- [
392
- n(y.FmIcon, {
393
- name: "info",
394
- color: "primary",
395
- size: "sm",
396
- onClick: async (f) => {
397
- f.preventDefault(), f.stopPropagation();
398
- const b = R.campaigns.all.find(
399
- (r) => {
400
- var _;
401
- return r._id === ((_ = a.row.original.metadata) == null ? void 0 : _.campaign);
402
- }
403
- );
404
- if (b)
405
- switch (b.type) {
406
- case "VOUCHER":
407
- case "PROMOTION":
408
- case "BROADCAST":
409
- await u.push({
410
- name: K[`$connect-CAMPAIGN_${b.type}`]
411
- });
412
- break;
413
- case "GAME":
414
- case "CREDIT":
415
- case "MISSION":
416
- await u.push({
417
- name: K[`$connect-PROGRAM_${b.type}`]
418
- });
419
- break;
420
- case "POINT":
421
- await u.push({
422
- name: K["$connect-PROGRAM_EXPERIENCE"]
423
- });
424
- break;
425
- case "COIN":
426
- await u.push({
427
- name: K["$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
- accessorFn: (a) => a.ref,
456
- header: "References",
457
- accessorKey: "ref",
458
- cell(a) {
459
- var t, f;
460
- return n("div", { class: "flex items-center justify-between gap-4" }, [
461
- n("div", { class: "flex items-center" }, [
462
- (t = a.row.original.metadata) != null && t.remark ? n(
463
- y.FmTooltip,
464
- {
465
- content: (f = a.row.original.metadata) == null ? void 0 : f.remark
466
- },
467
- [
468
- n(y.FmIcon, {
469
- name: "info",
470
- class: "pl-2",
471
- outline: !0,
472
- size: "sm"
473
- })
474
- ]
475
- ) : n("div")
476
- ]),
477
- n("div", { class: "flex-1" }, a.row.original.ref)
478
- ]);
479
- }
480
- },
481
- {
482
- header: "Actions",
483
- cell(a) {
484
- const t = a.row.original;
485
- return n(
486
- y.FmTooltip,
487
- {
488
- get content() {
489
- return "Revert Transaction";
490
- }
491
- },
492
- [
493
- n(y.FmButton, {
494
- variant: "tertiary",
495
- icon: "amend",
496
- iconColor: "neutral-gray-400",
497
- disabled: !t.isRevertable,
498
- onClick: (f) => {
499
- f.stopPropagation(), P(t);
500
- }
501
- })
502
- ]
503
- );
504
- }
505
- }
506
- ], c = O({
507
- search: "",
508
- "pf_collectible.type": [],
509
- "metadata.location": [],
510
- dateRange: {
511
- startDate: S().subtract(7, "day").toISOString(),
512
- endDate: S().endOf("day").toISOString()
513
- },
514
- source: []
515
- }), { tableMeta: D, rowData: d, onSort: o, debouncedFetchData: e, onSearch: i } = ie(async (a) => {
516
- const t = {
517
- ...c.value,
518
- user: T.user,
519
- dateRange: {
520
- start: new Date(c.value.dateRange.startDate).toISOString(),
521
- end: new Date(c.value.dateRange.endDate).toISOString()
522
- }
523
- }, f = await Y.readAll(a, t);
524
- return {
525
- resources: await Promise.all(
526
- f.resources.map(async (r) => {
527
- let _;
528
- if (r.source !== z.enum.BILL)
529
- _ = !1;
530
- else {
531
- const A = r.refunded || !!r.refundedFrom;
532
- if (r.expiryAmount.reduce(
533
- (E, V) => E + V.amount,
534
- r.amount ?? 0
535
- ) > 0) {
536
- let E = [];
537
- switch (r.pf_collectible.type) {
538
- case q.enum.STAMP:
539
- E = await C(r.ref, [
540
- z.enum.STAMP_REWARD
541
- ]), _ = E.length === 0 && !A;
542
- break;
543
- case q.enum.POINT:
544
- E = await C(r.ref, [
545
- z.enum.STAMP_REWARD
546
- ]), _ = E.length === 0 && !A;
547
- break;
548
- default:
549
- _ = !A;
550
- break;
551
- }
552
- } else
553
- switch (r.pf_collectible.type) {
554
- case q.enum.VOUCHER:
555
- _ = r.expiryAmount.some(
556
- (V) => !V.expiredAt || S(V.expiredAt).isAfter(S())
557
- ) && !A;
558
- break;
559
- default:
560
- _ = !A;
561
- break;
562
- }
563
- }
564
- const F = s.value.find((A) => A._id === r.ref);
565
- return {
566
- ...r,
567
- ref: (F == null ? void 0 : F.seqNumber) || r.ref,
568
- isRevertable: _
569
- };
570
- })
571
- ),
572
- meta: f.meta
573
- };
574
- }), s = O([]), v = z.options.map((a) => ({ label: G(N.getReason(a)), value: a })), g = p.locations.map((a) => ({ label: a.name, value: a._id }));
575
- re(
576
- c,
577
- () => {
578
- e();
579
- },
580
- { deep: !0 }
581
- );
582
- async function C(a, t) {
583
- return await Y.readTransactionsByBill(a, t);
584
- }
585
- async function P(a) {
586
- I(
587
- async () => {
588
- await Y.revertTransaction({
589
- id: a._id.toString()
590
- }), await e();
591
- },
592
- {
593
- message: "Reverting transaction...",
594
- successMessage: "Transaction reverted successfully"
595
- }
596
- );
597
- }
598
- async function ee() {
599
- try {
600
- x.value = !0;
601
- const a = {
602
- ...c.value,
603
- user: T.user,
604
- dateRange: {
605
- start: new Date(c.value.dateRange.startDate).toISOString(),
606
- end: new Date(c.value.dateRange.endDate).toISOString()
607
- }
608
- };
609
- await de({
610
- exporter: new ke(),
611
- readFunction: (t) => Y.readAll(t, a),
612
- transformRecord: (t) => {
613
- var f, b, r, _, F, A, L;
614
- return {
615
- TransactionID: t._id,
616
- CreatedAt: S(U(t._id.toString())).format(
617
- "D MMM YYYY, hh:mmA"
618
- ),
619
- Amount: J(
620
- t.expiryAmount.reduce(
621
- (E, V) => E + V.amount,
622
- t.amount ?? 0
623
- ),
624
- 2
625
- ),
626
- ExpiredAt: (b = (f = t.expiryAmount) == null ? void 0 : f[0]) != null && b.expiredAt ? S((_ = (r = t.expiryAmount) == null ? void 0 : r[0]) == null ? void 0 : _.expiredAt).format("D MMM YYYY") : "",
627
- Type: N.formattedType(t),
628
- Source: G(N.getReason(t.source)),
629
- User: ((F = t.pf_user) == null ? void 0 : F.name) || "",
630
- "Phone No.": ((A = t.pf_user) == null ? void 0 : A.phoneNumber) || "",
631
- References: t.ref,
632
- Remark: ((L = t.metadata) == null ? void 0 : L.remark) || ""
633
- };
634
- },
635
- filename: "transactions"
636
- });
637
- } catch (a) {
638
- console.error(a);
639
- } finally {
640
- x.value = !1;
641
- }
642
- }
643
- const te = O(null);
644
- function ge(a) {
645
- var t;
646
- console.log(a), (t = te.value) == null || t.showSheet(!0, a.original);
647
- }
648
- return be(async () => {
649
- await p.readLocations(), await R.read(), await e();
650
- }), (a, t) => {
651
- const f = $("FmSearch"), b = $("FmButton");
652
- return k(), B(X, null, [
653
- h("div", null, [
654
- h("div", $e, [
655
- w(f, {
656
- class: "hidden xs:flex border-b border-fm-color-neutral-gray-100",
657
- modelValue: l(c).search,
658
- "onUpdate:modelValue": t[0] || (t[0] = (r) => l(c).search = r),
659
- placeholder: "Search",
660
- collapsible: ""
661
- }, null, 8, ["modelValue"]),
662
- w(b, {
663
- icon: "ios_share",
664
- variant: "tertiary",
665
- onClick: ee
666
- })
667
- ]),
668
- h("div", Le, [
669
- h("div", ze, [
670
- w(j, {
671
- class: "cursor-pointer text-fm-color-neutral-gray-400",
672
- "right-icon": "keyboard_arrow_down",
673
- modelValue: l(c)["metadata.location"],
674
- "onUpdate:modelValue": t[1] || (t[1] = (r) => l(c)["metadata.location"] = r),
675
- icon: "storefront",
676
- "show-item-label": !0,
677
- items: l(g)
678
- }, null, 8, ["modelValue", "items"]),
679
- w(j, {
680
- class: "cursor-pointer text-fm-color-neutral-gray-400",
681
- "right-icon": "keyboard_arrow_down",
682
- modelValue: l(c)["pf_collectible.type"],
683
- "onUpdate:modelValue": t[2] || (t[2] = (r) => l(c)["pf_collectible.type"] = r),
684
- label: "Type: ",
685
- "show-item-label": !0,
686
- items: [
687
- { label: "Point", value: "COIN" },
688
- { label: "Credit", value: "CREDIT" },
689
- { label: "Voucher", value: "VOUCHER" },
690
- { label: "Experience", value: "POINT" },
691
- { label: "Tier", value: "TIER" },
692
- { label: "Title", value: "TITLE" },
693
- { label: "Game", value: "GAME" },
694
- { label: "Stamp", value: "STAMP" }
695
- ]
696
- }, null, 8, ["modelValue"]),
697
- w(j, {
698
- class: "cursor-pointer text-fm-color-neutral-gray-400",
699
- "right-icon": "keyboard_arrow_down",
700
- modelValue: l(c).source,
701
- "onUpdate:modelValue": t[3] || (t[3] = (r) => l(c).source = r),
702
- label: "Source: ",
703
- "show-item-label": !0,
704
- items: l(v)
705
- }, null, 8, ["modelValue", "items"]),
706
- w(se, {
707
- "model-value": {
708
- startDate: l(c).dateRange.startDate,
709
- endDate: l(c).dateRange.endDate
710
- },
711
- "onUpdate:modelValue": t[4] || (t[4] = (r) => l(c).dateRange = {
712
- startDate: l(S)(r.startDate).startOf("d").toISOString(),
713
- endDate: l(S)(r.endDate).endOf("d").toISOString()
714
- })
715
- }, null, 8, ["model-value"])
716
- ]),
717
- w(f, {
718
- class: "xs:hidden",
719
- modelValue: l(c).search,
720
- "onUpdate:modelValue": t[5] || (t[5] = (r) => l(c).search = r),
721
- placeholder: "Search",
722
- collapsible: ""
723
- }, null, 8, ["modelValue"]),
724
- h("div", He, [
725
- w(b, {
726
- icon: "ios_share",
727
- variant: "tertiary",
728
- onClick: ee
729
- })
730
- ])
731
- ]),
732
- w(ce, {
733
- loading: l(D).isLoading,
734
- "row-data": l(d),
735
- "row-count": l(D).totalRows,
736
- "column-defs": M.filter(
737
- (r) => !T.user || r.header !== "User" && r.header !== "Phone No."
738
- ),
739
- "page-count": l(D).pageCount,
740
- "page-index": l(D).pageIndex,
741
- "page-size": l(D).pageSize,
742
- "shrink-at": !1,
743
- onSortChange: l(o),
744
- onPageChange: t[6] || (t[6] = (r) => l(e)({
745
- pageSize: r.pageSize,
746
- pageIndex: r.pageIndex
747
- })),
748
- onRowClick: ge
749
- }, null, 8, ["loading", "row-data", "row-count", "column-defs", "page-count", "page-index", "page-size", "onSortChange"])
750
- ]),
751
- w(Ue, {
752
- ref_key: "transactionDetailSheet",
753
- ref: te
754
- }, null, 512)
755
- ], 64);
756
- };
757
- }
758
- });
759
- class Ke extends me {
760
- }
761
- const Ge = { class: "flex items-center justify-between" }, We = { class: "flex gap-8 items-center" }, je = { class: "flex gap-8 items-center xs:hidden" }, Ct = /* @__PURE__ */ Q({
762
- __name: "StoreTransactions",
763
- props: {
764
- user: {
765
- type: String
766
- }
767
- },
768
- setup(m) {
769
- const p = m, { minor: R } = fe;
770
- Se();
771
- const u = [
772
- {
773
- header: "Transaction ID",
774
- meta: {
775
- maxWidth: "150px"
776
- },
777
- cell(e) {
778
- return n("div", { class: "flex items-center" }, [
779
- n(y.FmIcon, {
780
- name: "content_copy",
781
- outline: !0,
782
- size: "sm",
783
- class: "cursor-pointer mr-4 shrink-0",
784
- onClick: (i) => {
785
- i.preventDefault(), i.stopPropagation(), Z(e.row.original._id.toString());
786
- }
787
- }),
788
- n("div", { class: "truncate" }, e.row.original._id.toString())
789
- ]);
790
- }
791
- },
792
- {
793
- header: "Created at",
794
- accessorFn: (e) => S(U(e._id.toString())).format("D MMM YYYY, hh:mmA"),
795
- enableSorting: !0
796
- },
797
- {
798
- header: "Bundle",
799
- accessorFn: (e) => e.bundle.name
800
- },
801
- {
802
- header: "Location",
803
- accessorFn: (e) => e.location ? e.pf_location.name : "Online Store"
804
- },
805
- {
806
- header: "Payment Type",
807
- accessorFn: (e) => {
808
- var i;
809
- return ((i = e.paymentType) == null ? void 0 : i.type) ?? "N/A";
810
- },
811
- cell(e) {
812
- var i, s;
813
- return n("div", { class: "flex items-center gap-4" }, [
814
- n("div", { class: "flex items-center" }, [
815
- ((i = e.row.original.paymentType) == null ? void 0 : i.type) == "ONLINE" && e.row.original.paymentType.extra ? n(
816
- y.FmTooltip,
817
- {
818
- content: e.row.original.paymentType.extra
819
- },
820
- [
821
- n(y.FmIcon, {
822
- name: "info",
823
- outline: !0,
824
- size: "sm"
825
- })
826
- ]
827
- ) : n("div")
828
- ]),
829
- n(
830
- "div",
831
- { class: "flex-1" },
832
- ((s = e.row.original.paymentType) == null ? void 0 : s.type) ?? "N/A"
833
- )
834
- ]);
835
- }
836
- },
837
- {
838
- header: "User",
839
- cell: (e) => ue(e.row.original.pf_member)
840
- },
841
- {
842
- header: "Phone No.",
843
- accessorFn: (e) => e.pf_member.phoneNumber
844
- },
845
- {
846
- header: "Status",
847
- // accessorFn: (u) => u.status,
848
- cell(e) {
849
- var i, s, v, g;
850
- return n("div", { class: "flex items-center" }, [
851
- n("div", we.title(e.row.original.status)),
852
- n("div", { class: "flex items-center" }, [
853
- (s = (i = e.row.original) == null ? void 0 : i.refund) != null && s.reason ? n(
854
- y.FmTooltip,
855
- {
856
- content: (g = (v = e.row.original) == null ? void 0 : v.refund) == null ? void 0 : g.reason
857
- },
858
- [
859
- n(y.FmIcon, {
860
- name: "info",
861
- color: "primary",
862
- outline: !0,
863
- size: "sm",
864
- class: "pl-2"
865
- })
866
- ]
867
- ) : n("div")
868
- ])
869
- ]);
870
- }
871
- },
872
- {
873
- header: "Source",
874
- accessorFn: (e) => e.source
875
- },
876
- {
877
- header: "Ref",
878
- accessorFn: (e) => e.ref
879
- },
880
- {
881
- id: "action",
882
- cell(e) {
883
- const i = e.row.original, s = i.status === "COMPLETED" && !i.refund && i.source == "ADMIN";
884
- return s ? n(
885
- y.FmMenu,
886
- {
887
- placement: "bottom-end",
888
- onClick: (v) => {
889
- v.stopPropagation();
890
- }
891
- },
892
- {
893
- "menu-button": () => n(y.FmButton, {
894
- icon: "settings",
895
- variant: "tertiary",
896
- if: s
897
- }),
898
- default: () => [
899
- n(y.FmMenuItem, {
900
- label: "Refund",
901
- sublabel: "Refund this transaction",
902
- onClick: async (v) => {
903
- v.stopPropagation(), await d(i);
904
- }
905
- })
906
- ]
907
- }
908
- ) : n("div");
909
- }
910
- }
911
- ], T = O({
912
- searchValue: "",
913
- dateRange: {
914
- startDate: S().subtract(7, "day").toISOString(),
915
- endDate: S().toISOString()
916
- }
917
- }), { tableMeta: x, rowData: I, onSort: M, debouncedFetchData: c, onSearch: D } = ie(async (e) => {
918
- const i = {
919
- ...T.value.dateRange,
920
- user: p.user
921
- };
922
- return await Y.readStoreTransactions(e, i);
923
- });
924
- async function d(e) {
925
- await Te.confirm(
926
- "Are you sure you want to refund this transaction?",
927
- "Refund Store Transaction",
928
- "Confirm",
929
- "Cancel"
930
- ) && await R(
931
- async () => {
932
- var s;
933
- await Ie.refundStoreTransaction({
934
- id: e._id,
935
- reason: `ADMIN:${(s = Ae().sessionUser) == null ? void 0 : s.name}`
936
- }), await c();
937
- },
938
- {
939
- message: "Refunding transaction...",
940
- successMessage: "Transaction refunded successfully"
941
- }
942
- );
943
- }
944
- re(
945
- T,
946
- () => {
947
- c();
948
- },
949
- { deep: !0 }
950
- ), _e(async () => {
951
- await c();
952
- });
953
- const o = async () => de({
954
- exporter: new Ke(),
955
- readFunction: (e) => Y.readStoreTransactions(e, {
956
- ...T.value.dateRange,
957
- user: p.user
958
- }),
959
- transformRecord: (e) => {
960
- var i, s, v, g, C, P;
961
- return {
962
- TransactionId: ((i = e._id) == null ? void 0 : i.toString()) || "",
963
- CreatedAt: S(U(e._id.toString())).format(
964
- "DD/MM/YYYY HH:mm:ss"
965
- ),
966
- Bundle: e.bundle.name || "",
967
- Location: e.location ? e.pf_location.name : "Online Store",
968
- PaymentType: ((s = e.paymentType) == null ? void 0 : s.type) || "N/A",
969
- PaymentExtra: ((v = e.paymentType) == null ? void 0 : v.extra) || "",
970
- User: ((g = e.pf_member) == null ? void 0 : g.name) || "",
971
- PhoneNumber: ((C = e.pf_member) == null ? void 0 : C.phoneNumber) || "",
972
- Status: e.status || "",
973
- RefundReason: ((P = e == null ? void 0 : e.refund) == null ? void 0 : P.reason) || ""
974
- };
975
- },
976
- filename: "store-transactions"
977
- });
978
- return (e, i) => {
979
- const s = $("FmSearch"), v = $("FmButton");
980
- return k(), B("div", null, [
981
- h("div", Ge, [
982
- h("div", We, [
983
- w(se, {
984
- modelValue: l(T).dateRange,
985
- "onUpdate:modelValue": i[0] || (i[0] = (g) => l(T).dateRange = g)
986
- }, null, 8, ["modelValue"])
987
- ]),
988
- h("div", je, [
989
- w(s, {
990
- modelValue: l(x).searchValue,
991
- "onUpdate:modelValue": [
992
- i[1] || (i[1] = (g) => l(x).searchValue = g),
993
- l(D)
994
- ],
995
- placeholder: "Search",
996
- collapsible: ""
997
- }, null, 8, ["modelValue", "onUpdate:modelValue"]),
998
- w(v, {
999
- icon: "ios_share",
1000
- variant: "tertiary",
1001
- onClick: o
1002
- })
1003
- ])
1004
- ]),
1005
- w(ce, {
1006
- loading: l(x).isLoading,
1007
- "row-data": l(I),
1008
- "row-count": l(x).totalRows,
1009
- "column-defs": u.filter(
1010
- (g) => !p.user || g.header !== "User" && g.header !== "Phone No."
1011
- ),
1012
- "page-count": l(x).pageCount,
1013
- "page-index": l(x).pageIndex,
1014
- "page-size": l(x).pageSize,
1015
- "shrink-at": !1,
1016
- onSortChange: l(M),
1017
- onPageChange: i[2] || (i[2] = (g) => l(c)({
1018
- pageSize: g.pageSize,
1019
- pageIndex: g.pageIndex
1020
- }))
1021
- }, null, 8, ["loading", "row-data", "row-count", "column-defs", "page-count", "page-index", "page-size", "onSortChange"])
1022
- ]);
1023
- };
1024
- }
1025
- });
1026
- export {
1027
- Rt as _,
1028
- Ct as a
1029
- };