@feedmepos/mf-connect 0.1.123-prod → 0.1.124-dev

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 (149) hide show
  1. package/dist/{App-BOQIQ8Jz.js → App-C7BnLHSt.js} +502 -493
  2. package/dist/AuditLogs-BPKQdFga.js +2016 -0
  3. package/dist/{Bin-BethwelP.js → Bin-Bq7yY0I2.js} +8 -8
  4. package/dist/{Broadcast-CHIXRBHf.js → Broadcast-D52rPmVl.js} +22 -21
  5. package/dist/{CampaignAnalytic-BaEeAhnr.js → CampaignAnalytic-DpiWtzIp.js} +7 -7
  6. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CYo7Rpes.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-B1eAAN64.js} +8 -9
  7. package/dist/{Card-C075nS85.js → Card-BQc7vud2.js} +22 -22
  8. package/dist/{Collections-BsQ_kcoJ.js → Collections--VzkneGp.js} +197 -185
  9. package/dist/{Credit-BsZlyp-x.js → Credit-DhfAcw-p.js} +21 -20
  10. package/dist/{DateRangeChip.vue_vue_type_script_setup_true_lang-CcytVckH.js → DateRangeChip.vue_vue_type_script_setup_true_lang-D2Csdg-3.js} +1 -1
  11. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-DFz_2GZ1.js +4439 -0
  12. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-Da4snauu.js → EffectSheet.vue_vue_type_style_index_0_lang-Cr2_XbyY.js} +16 -16
  13. package/dist/{Experience-B9iubxQ5.js → Experience-CUwbHfo5.js} +32 -31
  14. package/dist/{FileSaver.min-1XYUiJrd.js → FileSaver.min-DvZpiwMd.js} +1 -1
  15. package/dist/{Game-B3ZTJcjj.js → Game-CI5-y0JJ.js} +19 -18
  16. package/dist/{GiftCardSetup-DpLDBOS2.js → GiftCardSetup-CGacqQ0j.js} +31 -31
  17. package/dist/{GoalPickerPanel.vue_vue_type_script_setup_true_lang-hNbexVdE.js → GoalPickerPanel.vue_vue_type_script_setup_true_lang-B6POxDLJ.js} +7 -7
  18. package/dist/{Goals--dysejOz.js → Goals-fqJY9iMx.js} +4 -4
  19. package/dist/Grab-CAx1cCE4.js +301 -0
  20. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-BI1EQciE.js → ImageInput.vue_vue_type_script_setup_true_lang-DTKf7uR-.js} +1 -1
  21. package/dist/{Index-v2J17JTP.js → Index-CT1Gnjsv.js} +10 -10
  22. package/dist/{LocationPicker.vue_vue_type_script_setup_true_lang-B1vTvUTW.js → LocationPicker.vue_vue_type_script_setup_true_lang-BRQ12Yum.js} +1 -1
  23. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-Dz0VI7PT.js → LottieAnimation.vue_vue_type_script_setup_true_lang-BRzuWJ1Y.js} +1 -1
  24. package/dist/{LoyaltyDashboard-BI_khH0P.js → LoyaltyDashboard-IJIDEBWf.js} +15 -15
  25. package/dist/{MainLayout-On2p0hEA.js → MainLayout-BMghr-wf.js} +1 -1
  26. package/dist/{MainLayout.vue_vue_type_script_setup_true_lang-DSdJORyW.js → MainLayout.vue_vue_type_script_setup_true_lang-BitJKgvd.js} +3 -3
  27. package/dist/{Marketing-Pqa4USnd.js → Marketing-Ckr9cp3w.js} +4 -4
  28. package/dist/{MarketingMaterialEdit-IRRsEF8W.js → MarketingMaterialEdit-BIZnE8CY.js} +214 -211
  29. package/dist/{Member-p1zyrY20.js → Member-d1nPxr74.js} +7 -7
  30. package/dist/MemberDetailSheet.vue_vue_type_script_setup_true_lang-DI4XM_rJ.js +1281 -0
  31. package/dist/{MemberImportHistory-BwkJJj_u.js → MemberImportHistory-CxX9iYhV.js} +7 -7
  32. package/dist/{MemberList-Ci8K7HI4.js → MemberList-DUzYpxhj.js} +103 -105
  33. package/dist/{MemberTransactions-D8xLWGcw.js → MemberTransactions-BFM3ybeo.js} +1 -1
  34. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-CvCuVDR-.js → MessageInput.vue_vue_type_script_setup_true_lang-B5j0YBix.js} +12 -12
  35. package/dist/{MetricInfoTooltip.vue_vue_type_script_setup_true_lang-DzrAjDGZ.js → MetricInfoTooltip.vue_vue_type_script_setup_true_lang-DsSHSbBB.js} +1 -1
  36. package/dist/{Mission-JpI-0kHJ.js → Mission-De9BF5wb.js} +22 -21
  37. package/dist/{Overview-92S0hiOS.js → Overview-DeHo3gef.js} +145 -144
  38. package/dist/{Overview-BXCQnl4x.js → Overview-Pmxqv6qp.js} +20 -20
  39. package/dist/{Point-krrZWESo.js → Point-DE_Cc85N.js} +22 -21
  40. package/dist/{Promotion-BjlFWrMI.js → Promotion-cZDzgho4.js} +137 -131
  41. package/dist/{Queue-FW3I2guh.js → Queue-DmDbrtTk.js} +45 -45
  42. package/dist/{Record-Hj3_FQp6.js → Record-uxNNOvmK.js} +9 -9
  43. package/dist/{Review-CBL5Wga7.js → Review-CIIn_Bdx.js} +2 -2
  44. package/dist/ReviewFacebookCallback-CO6FxHzc.js +225 -0
  45. package/dist/{ReviewGoogleCallback-CAqc1gmT.js → ReviewGoogleCallback-B7kmGwb_.js} +5 -5
  46. package/dist/{Reward-UN-LYZPR.js → Reward-Bj1snFu8.js} +16 -16
  47. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-C4deW4H6.js → RewardGroup.vue_vue_type_script_setup_true_lang-BO-36dE4.js} +13 -13
  48. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-b7ZEMd4s.js +1923 -0
  49. package/dist/{Segment-D9ehFadR.js → Segment-BgJgWa6C.js} +303 -306
  50. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-D7PbDKI7.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-D2TDoZgQ.js} +14 -14
  51. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-DWXfOk-I.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-CEBH11hR.js} +4 -4
  52. package/dist/Setting-DpEI72mW.js +574 -0
  53. package/dist/{SettingAdvertisements-BNWTSQ14.js → SettingAdvertisements-vdUtIXwC.js} +12 -12
  54. package/dist/Settings-C6yJ1WEB.js +286 -0
  55. package/dist/{Store-vRzLqmIu.js → Store-DgltT0RA.js} +28 -28
  56. package/dist/{StoreRewards-DitATf4s.js → StoreRewards-BXH_5cYL.js} +15 -15
  57. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-DqlluwMB.js +1319 -0
  58. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-DjCO9U0c.js +7007 -0
  59. package/dist/{Tier-B0JGxXei.js → Tier-CqfHGUX0.js} +2575 -687
  60. package/dist/{Title-DBLK191p.js → Title-B5VnUNiS.js} +95 -94
  61. package/dist/{Transaction-CUthGjH1.js → Transaction-BZh1Q9Lj.js} +2 -2
  62. package/dist/Upselling-Cf24ub-9.js +1055 -0
  63. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-CUCR6aEY.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-Buj7CRlQ.js} +26 -26
  64. package/dist/{Voucher-DsyOteEs.js → Voucher-CZJdV2Ok.js} +19 -19
  65. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-Ddbutv4Y.js → VoucherEditor.vue_vue_type_script_setup_true_lang-65x2VrpD.js} +12 -12
  66. package/dist/{WhatsappAccount-PWKWg15w.js → WhatsappAccount-DsRilNC5.js} +6 -6
  67. package/dist/{WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-HUSiUfoc.js → WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-Bn26qwx5.js} +1 -1
  68. package/dist/{WhatsappBot-CMFcJj1b.js → WhatsappBot-CpzMaTss.js} +6 -6
  69. package/dist/{WhatsappBotLogs-CVOw3VxD.js → WhatsappBotLogs-DRF8VufQ.js} +6 -6
  70. package/dist/{WhatsappBotSettings-ouG9rSoI.js → WhatsappBotSettings-DSUPGC-p.js} +4 -4
  71. package/dist/{WhatsappLayout-CHtKQYog.js → WhatsappLayout-BCWYcQmD.js} +3 -3
  72. package/dist/{WhatsappNotificationGroupDialog.vue_vue_type_script_setup_true_lang-B0tpwJ9B.js → WhatsappNotificationGroupDialog.vue_vue_type_script_setup_true_lang-DyxyISRP.js} +3 -3
  73. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-CEytppMm.js → ZodTextField.vue_vue_type_script_setup_true_lang-Db-Z7cY_.js} +2 -2
  74. package/dist/{app-CZGZKKye.js → app-BQeODViN.js} +14861 -15017
  75. package/dist/app.js +4 -3
  76. package/dist/{base.export-Cxm_LrqA.js → base.export-kSFLDDoC.js} +2 -2
  77. package/dist/{business-CieIljvm.js → business-EP-Do3Ew.js} +1 -1
  78. package/dist/{campaign-DhN6zKES.js → campaign-BjnUPowX.js} +34 -28
  79. package/dist/{campaign-DWClF3jI.js → campaign-C8GgaCub.js} +121 -94
  80. package/dist/{campaign.enum-BqekIiiN.js → campaign.enum-Dx-Zo68Q.js} +2 -1
  81. package/dist/campaign.fn-DQ--gL4B.js +776 -0
  82. package/dist/{collection.fn-Cep8tuk5.js → collection.fn-BhXecwh5.js} +2 -2
  83. package/dist/{currency-DhwsYY32.js → currency-CGMNh1Q_.js} +1 -1
  84. package/dist/duplicateCampaign-icqF8Na9.js +51 -0
  85. package/dist/{effect-BwOOpJRh.js → effect-Bc6oGIWd.js} +1 -1
  86. package/dist/{email-addresses-DZB2oj9y.js → email-addresses-B3KWfUMk.js} +25 -25
  87. package/dist/{feature-flag-BSpbhSMn.js → feature-flag-HhjvSuDm.js} +171 -185
  88. package/dist/google-BQK68wbe.js +5 -0
  89. package/dist/{helper-D_4T4gbM.js → helper-D1BYvcED.js} +1 -1
  90. package/dist/{index-DgCpTG1m.js → index-BIBcfAw5.js} +1 -1
  91. package/dist/{index-BpnjNIh1.js → index-BkevK_Hp.js} +1 -1
  92. package/dist/{index-D5OOlgos.js → index-Br2SLVsn.js} +608 -251
  93. package/dist/{index-BYipoHQc.js → index-Bunp1bt_.js} +1 -1
  94. package/dist/{index-BDKVZZR0.js → index-C-46QHFh.js} +380 -234
  95. package/dist/{index-MCyDYhZI.js → index-C3MK8Twg.js} +1 -1
  96. package/dist/{index-DVir0ptH.js → index-CsYTLmPa.js} +4 -4
  97. package/dist/{index-Dh815w-7.js → index-D2TnjKPP.js} +23 -23
  98. package/dist/{index-CyYV4eem.js → index-DCC3pLug.js} +19 -6
  99. package/dist/{index-X5Gzu80O.js → index-DOSuhtdE.js} +1 -1
  100. package/dist/{index-FrOuWhLi.js → index-DeqpfWLa.js} +3 -3
  101. package/dist/{index-Df4ox2zj.js → index-DiCgGQoC.js} +2 -2
  102. package/dist/{index-tUxF4g8G.js → index-GQv1_jaJ.js} +2 -2
  103. package/dist/{index-rcMo_-nr.js → index-Ptcqv0W6.js} +2 -2
  104. package/dist/{index-CY88cQHU.js → index-VLFerh-X.js} +10 -10
  105. package/dist/{index-DcTRgcug.js → index-VyoufKYY.js} +1 -1
  106. package/dist/{index-BtN3vRvA.js → index-Yw4M7v7m.js} +2699 -2614
  107. package/dist/{index-DcO1O6fl.js → index-cPPWotJe.js} +10 -10
  108. package/dist/{index-FKxe6jKI.js → index-gMrtUwSD.js} +316 -316
  109. package/dist/{index-CIJKKs_J.js → index-oIo5Cful.js} +533 -462
  110. package/dist/{index.esm2017-DSF7lxrn.js → index.esm2017-DUZpLdEB.js} +93 -93
  111. package/dist/{loading-B4qq_74t.js → loading-DhpcQgdj.js} +1 -1
  112. package/dist/{lodash-BuScZ_TM.js → lodash-r4AR7GJC.js} +1 -1
  113. package/dist/{member-import-DyM1Xskc.js → member-import-CogEef9H.js} +1 -1
  114. package/dist/{membership-C77S6FIb.js → membership-BQFkjRjs.js} +2 -2
  115. package/dist/{money-Dcr44NhN.js → money-Ifqd4pyC.js} +1 -1
  116. package/dist/{number-C2u_79r4.js → number-C9Tw_Ncm.js} +1 -1
  117. package/dist/objectid-D7dqM1a3.js +145 -0
  118. package/dist/{onboarding-Chxkor1U.js → onboarding-D4dm_rxU.js} +36 -36
  119. package/dist/{onboardingSetup-BvL9lW9U.js → onboardingSetup-DtNZUoRr.js} +2 -2
  120. package/dist/{plugins-dnLWrrhC.js → plugins-DGI9Fkiu.js} +3 -3
  121. package/dist/{reward-DVHKTXQL.js → reward-DTtejZqM.js} +1 -1
  122. package/dist/{rule-IYgreBdC.js → rule-C4N3ce3c.js} +572 -492
  123. package/dist/style.css +1 -1
  124. package/dist/template-YhWRyNGp.js +227 -0
  125. package/dist/{timezone-Cdp7cU32.js → timezone-5rYhX7XZ.js} +1 -1
  126. package/dist/{transaction.fn-kl4EZybB.js → transaction.fn-Ba_U7HdT.js} +2 -2
  127. package/dist/{trigger-C1m8eupI.js → trigger-B8I1aO6Y.js} +9 -9
  128. package/dist/{useMarketingMaterialActions-m5OLWGoL.js → useMarketingMaterialActions-CTOFHmlL.js} +4 -4
  129. package/dist/{usePagination-DX82vEDi.js → usePagination-3wAPVCOp.js} +1 -1
  130. package/dist/{user-DBndrlMY.js → user-Ds4DW_-Y.js} +1 -1
  131. package/dist/vue-i18n-Bqlt_-jA.js +2365 -0
  132. package/dist/{xlsx-ColLmoRB.js → xlsx-xlOCvuAq.js} +166 -166
  133. package/dist/{zod-CHmP8TTi.js → zod-GVNjvrpT.js} +1 -1
  134. package/package.json +6 -2
  135. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-qX_uFelR.js +0 -3493
  136. package/dist/MemberDetailSheet.vue_vue_type_script_setup_true_lang-DyvEDRBE.js +0 -1308
  137. package/dist/ReviewFacebookCallback-31bFMGu3.js +0 -238
  138. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-BbzRH7BF.js +0 -1884
  139. package/dist/Setting-DGoNxCsO.js +0 -578
  140. package/dist/Settings-CQ67orRm.js +0 -179
  141. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-DEP0FuoM.js +0 -1297
  142. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-DndMZr1k.js +0 -142
  143. package/dist/Upselling-CZLmpsdx.js +0 -200
  144. package/dist/campaign.fn-CKTsVS5U.js +0 -776
  145. package/dist/google-C3S8u0mT.js +0 -4
  146. package/dist/objectid-nYLSIO_I.js +0 -145
  147. package/dist/rule-builder-QC_xPC4L.js +0 -102
  148. package/dist/template-COvkfF2w.js +0 -275
  149. package/dist/vue-i18n-FBUIkfn5.js +0 -2365
@@ -1,1297 +0,0 @@
1
- import { ref as k, defineComponent as oe, computed as O, h as c, resolveComponent as U, openBlock as A, createBlock as se, unref as l, isRef as me, withCtx as Z, createElementVNode as S, createVNode as D, createElementBlock as V, Fragment as j, renderList as ee, toDisplayString as B, createTextVNode as we, resolveDynamicComponent as Ce, watch as de, onBeforeMount as Re, onMounted as Ie } from "vue";
2
- import { components as C } from "@feedmepos/ui-library";
3
- import { o as pe } from "./index-CIJKKs_J.js";
4
- import "./index-FrOuWhLi.js";
5
- import { T as E } from "./transaction.fn-kl4EZybB.js";
6
- import { h as P } from "./moment-D7p2TMB-.js";
7
- import { _ as re } from "./FilterChip.vue_vue_type_script_setup_true_lang-3bH-tZAm.js";
8
- import { _ as fe } from "./DateRangeChip.vue_vue_type_script_setup_true_lang-CcytVckH.js";
9
- import { s as J } from "./index-CuvNtC_M.js";
10
- import { f as L, F as De } from "./number-C2u_79r4.js";
11
- import { u as ge } from "./business-CieIljvm.js";
12
- import { _ as ye, u as Fe } from "./usePagination-DX82vEDi.js";
13
- import { c as ie, p as Ne } from "./plugins-dnLWrrhC.js";
14
- import { g as ve } from "./user-DBndrlMY.js";
15
- import { B as he, e as Ae } from "./base.export-Cxm_LrqA.js";
16
- import { u as be } from "./campaign-DhN6zKES.js";
17
- import "./index-BpnjNIh1.js";
18
- import "./index-BtN3vRvA.js";
19
- import "./index-BDKVZZR0.js";
20
- import "./index-D5OOlgos.js";
21
- import "./index-rcMo_-nr.js";
22
- import "./index-I9lmcd2w.js";
23
- import "./index-X5Gzu80O.js";
24
- import { u as ne } from "./vue-i18n-FBUIkfn5.js";
25
- import { o as Y } from "./objectId-dwaoBfJX.js";
26
- import { u as xe } from "./loading-B4qq_74t.js";
27
- import { w as Pe } from "./xlsx-ColLmoRB.js";
28
- import { useRouter as ke } from "vue-router";
29
- import { t as te } from "./index-Dh815w-7.js";
30
- import { R as X } from "./app-CZGZKKye.js";
31
- import { useCoreStore as Me } from "@feedmepos/mf-common";
32
- import { c as K } from "./string-Gcy5IM_H.js";
33
- import { f as $e } from "./currency-DhwsYY32.js";
34
- import { m as Ve } from "./index-CyYV4eem.js";
35
- const Ee = (d) => {
36
- if (d.startsWith("_") || d.includes("."))
37
- return d;
38
- for (const g of ["pf_user_", "pf_collectible_"])
39
- if (d.startsWith(g))
40
- return `${g.slice(0, -1)}.${d.slice(g.length).replace(new RegExp("_", "g"), ".")}`;
41
- return d.replace(new RegExp("_", "g"), ".");
42
- };
43
- function Oe(d, g = { key: "_id", descending: !0 }) {
44
- const u = k({
45
- pageCount: 1,
46
- searchValue: "",
47
- pageIndex: 0,
48
- totalRows: 0,
49
- isLoading: !1,
50
- pageSize: 10,
51
- hasNext: !1
52
- }), m = k(g), R = k([]), T = k([void 0]);
53
- function N() {
54
- T.value = [void 0], u.value.pageIndex = 0, u.value.pageCount = 1, u.value.hasNext = !1;
55
- }
56
- const M = async (h = {}) => {
57
- const p = h.pageSize ?? u.value.pageSize, a = p !== u.value.pageSize;
58
- a && N();
59
- const o = a ? 0 : Math.max(h.pageIndex ?? u.value.pageIndex, 0), e = o === 0 || !!T.value[o] ? o : u.value.pageIndex, n = T.value[e];
60
- u.value.isLoading = !0, u.value.pageSize = p, R.value = [];
61
- try {
62
- const i = await d({
63
- limit: p,
64
- sortBy: m.value.key,
65
- descending: m.value.descending,
66
- search: u.value.searchValue,
67
- ...n ? { cursor: n } : {}
68
- });
69
- R.value = i.resources, u.value.pageIndex = e, u.value.totalRows = i.resources.length, u.value.hasNext = i.meta.hasNext, u.value.pageCount = e + (i.meta.hasNext ? 2 : 1), i.meta.nextCursor ? T.value[e + 1] = i.meta.nextCursor : T.value.splice(e + 1);
70
- } catch (i) {
71
- console.error("Error fetching data:", i), u.value.hasNext = !1;
72
- } finally {
73
- u.value.isLoading = !1;
74
- }
75
- };
76
- let I, f;
77
- const v = (h) => (I && clearTimeout(I), f && f(), new Promise((p) => {
78
- f = p, I = setTimeout(async () => {
79
- I = void 0, f = void 0, await M(h), p();
80
- }, 200);
81
- }));
82
- return {
83
- tableMeta: u,
84
- rowData: R,
85
- sortBy: m,
86
- pageCursors: T,
87
- resetCursorState: N,
88
- fetchData: M,
89
- debouncedFetchData: v,
90
- onSort: async (h) => {
91
- h.length ? m.value = {
92
- key: Ee(h[0].id),
93
- descending: h[0].desc
94
- } : m.value = g, N(), await v({
95
- pageIndex: 0,
96
- pageSize: u.value.pageSize
97
- });
98
- },
99
- onSearch: () => (N(), v({
100
- pageIndex: 0,
101
- pageSize: u.value.pageSize
102
- }))
103
- };
104
- }
105
- class ze extends he {
106
- }
107
- const Be = { class: "space-y-24 pr-12" }, Ue = { class: "w-full space-y-16" }, Ye = { class: "fm-typo-en-body-lg-600" }, Le = ["onClick"], Ge = { class: "fm-typo-en-body-lg-600" }, Ke = ["onClick"], je = { class: "flex items-center gap-8" }, We = /* @__PURE__ */ oe({
108
- __name: "TransactionDetailSheet",
109
- setup(d, { expose: g }) {
110
- ne();
111
- const u = k(!1), m = k(), R = be(), T = ge();
112
- function N(v, r) {
113
- u.value = v, m.value = r ?? null;
114
- }
115
- const M = O(() => {
116
- var v, r;
117
- return L(
118
- ((r = m.value) == null ? void 0 : r.expiryAmount.reduce(
119
- (x, h) => x + h.amount,
120
- ((v = m.value) == null ? void 0 : v.amount) ?? 0
121
- )) ?? 0,
122
- 2
123
- );
124
- }), I = O(() => {
125
- var v, r, x, h, p;
126
- return m.value ? [
127
- {
128
- label: "Transaction ID",
129
- value: (v = m.value) == null ? void 0 : v._id
130
- },
131
- {
132
- label: "Date/Time",
133
- value: P(Y(m.value._id.toString())).format(
134
- "D MMM YYYY, hh:mmA"
135
- )
136
- },
137
- {
138
- label: "Amount",
139
- component: () => c(
140
- "span",
141
- {
142
- class: [
143
- "pr-2",
144
- +M.value > 0 ? "text-fm-color-system-success-300" : "text-fm-color-system-error-300"
145
- ]
146
- },
147
- M.value
148
- )
149
- },
150
- {
151
- label: "Type",
152
- value: E.formattedType(m.value)
153
- },
154
- {
155
- label: "Source",
156
- value: J(E.getReason(m.value.source))
157
- },
158
- {
159
- label: "User",
160
- value: (x = (r = m.value) == null ? void 0 : r.pf_user) == null ? void 0 : x.name
161
- },
162
- {
163
- label: "Phone Number",
164
- value: (p = (h = m.value) == null ? void 0 : h.pf_user) == null ? void 0 : p.phoneNumber
165
- }
166
- ] : [];
167
- }), f = O(() => {
168
- var p, a, o, b;
169
- if (!m.value) return [];
170
- const v = [], r = (p = m.value) == null ? void 0 : p.metadata, x = m.value;
171
- if (r != null && r.campaign) {
172
- const e = R.campaigns.all.find(
173
- (n) => n._id === (r == null ? void 0 : r.campaign)
174
- );
175
- e && v.push({
176
- label: "Campaign",
177
- value: e.name
178
- });
179
- }
180
- const h = E.formattedRemark(x);
181
- return h && v.push({
182
- label: "Remark",
183
- value: h
184
- }), (a = m.value) != null && a.ref.startsWith("bill_") && v.push({
185
- label: "Bill Number",
186
- value: (o = m.value) == null ? void 0 : o.ref,
187
- copy: () => {
188
- var e;
189
- return ie((e = m.value) == null ? void 0 : e.ref);
190
- }
191
- }), r != null && r.location && v.push({
192
- label: "Location",
193
- value: (b = T.locations.find(
194
- (e) => e._id.toString() === (r == null ? void 0 : r.location)
195
- )) == null ? void 0 : b.name
196
- }), x.source === pe.enum.STORE && v.push({
197
- label: "Store Transaction",
198
- value: x.ref
199
- }), r != null && r.originTransaction && v.push({
200
- label: "Parent Transaction",
201
- value: r.originTransaction
202
- }), r != null && r.referral_count && v.push({
203
- label: "Referral Count",
204
- value: r.referral_count
205
- }), x.refundedFrom && v.push({
206
- label: "Refunded From",
207
- value: x.refundedFrom
208
- }), v;
209
- });
210
- return g({
211
- showSheet: N
212
- }), (v, r) => {
213
- const x = U("FmButton"), h = U("FmSideSheet");
214
- return A(), se(h, {
215
- "max-width": 560,
216
- modelValue: l(u),
217
- "onUpdate:modelValue": r[1] || (r[1] = (p) => me(u) ? u.value = p : null),
218
- header: "Transaction Details"
219
- }, {
220
- "side-sheet-footer": Z(() => [
221
- S("div", je, [
222
- D(x, {
223
- label: "Close",
224
- onClick: r[0] || (r[0] = (p) => N(!1)),
225
- variant: "tertiary"
226
- })
227
- ])
228
- ]),
229
- default: Z(() => [
230
- S("div", Be, [
231
- S("div", Ue, [
232
- (A(!0), V(j, null, ee(l(I), (p) => (A(), V("div", {
233
- key: p.label,
234
- class: "flex flex-col gap-4"
235
- }, [
236
- S("div", Ye, B(p.label), 1),
237
- S("div", {
238
- class: "text-fm-color-typo-secondary fm-typo-en-body-md-400 hover:underline",
239
- onClick: p.copy
240
- }, [
241
- we(B(p.accessorFn ? p.accessorFn() : p.value) + " ", 1),
242
- (A(), se(Ce(p.component)))
243
- ], 8, Le),
244
- r[2] || (r[2] = S("hr", { class: "mt-3" }, null, -1))
245
- ]))), 128)),
246
- (A(!0), V(j, null, ee(l(f), (p) => (A(), V("div", {
247
- key: p.label,
248
- class: "flex flex-col gap-4"
249
- }, [
250
- S("div", Ge, B(p.label), 1),
251
- S("div", {
252
- class: "text-fm-color-typo-secondary fm-typo-en-body-md-400 hover:underline",
253
- onClick: p.copy
254
- }, B(p.accessorFn ? p.accessorFn() : p.value), 9, Ke),
255
- r[3] || (r[3] = S("hr", { class: "mt-3" }, null, -1))
256
- ]))), 128))
257
- ])
258
- ])
259
- ]),
260
- _: 1
261
- }, 8, ["modelValue"]);
262
- };
263
- }
264
- }), qe = { class: "hidden xs:!flex items-center justify-end" }, He = { class: "flex items-center justify-between" }, Qe = { class: "flex gap-8 items-center w-full overflow-x-scroll" }, Xe = { class: "xs:hidden" }, Kt = /* @__PURE__ */ oe({
265
- __name: "CollectionTransactions",
266
- props: {
267
- user: {
268
- type: String
269
- }
270
- },
271
- setup(d) {
272
- const { t: g } = ne(), u = ge(), m = be(), R = ke(), T = d, N = k(!1), { minor: M } = xe, I = [
273
- {
274
- header: "Transaction ID",
275
- accessorKey: "_id",
276
- meta: {
277
- maxWidth: "100px"
278
- },
279
- cell(t) {
280
- return c("div", { class: "flex items-center" }, [
281
- c(C.FmIcon, {
282
- name: "content_copy",
283
- outline: !0,
284
- size: "sm",
285
- class: "cursor-pointer mr-4",
286
- onClick: (s) => {
287
- s.preventDefault(), s.stopPropagation(), ie(t.row.original._id.toString());
288
- }
289
- }),
290
- c(
291
- "div",
292
- { class: "pr-2 text-ellipsis overflow-hidden" },
293
- t.row.original._id.toString()
294
- )
295
- ]);
296
- },
297
- enableSorting: !1
298
- },
299
- {
300
- header: "Created at",
301
- accessorKey: "_id",
302
- accessorFn: (t) => P(Y(t._id.toString())),
303
- cell: (t) => P(Y(t.row.original._id.toString())).format(
304
- "D MMM YYYY, hh:mmA"
305
- ),
306
- enableSorting: !0
307
- },
308
- {
309
- header: "Amount",
310
- // accessorKey: 'totalAmount',
311
- enableSorting: !1,
312
- cell(t) {
313
- var _, y, z, G;
314
- const s = L(
315
- t.row.original.expiryAmount.reduce(
316
- (q, H) => q + H.amount,
317
- t.row.original.amount ?? 0
318
- ),
319
- 2
320
- ), w = (y = (_ = t.row.original.expiryAmount) == null ? void 0 : _[0]) != null && y.expiredAt ? P((G = (z = t.row.original.expiryAmount) == null ? void 0 : z[0]) == null ? void 0 : G.expiredAt).format(
321
- "D MMM YYYY"
322
- ) : "";
323
- return c("div", { class: "flex items-center" }, [
324
- c(
325
- "div",
326
- {
327
- class: [
328
- "pr-2",
329
- +s > 0 ? "text-fm-color-system-success-300" : "text-fm-color-system-error-300"
330
- ]
331
- },
332
- s
333
- ),
334
- c("div", { class: "flex items-center" }, [
335
- t.row.original.expiryAmount.length > 0 ? c(
336
- C.FmTooltip,
337
- {
338
- content: `Expired on ${w}`
339
- },
340
- [
341
- c(C.FmIcon, {
342
- name: "info",
343
- outline: !0,
344
- size: "sm"
345
- })
346
- ]
347
- ) : c("div")
348
- ])
349
- ]);
350
- }
351
- },
352
- {
353
- header: "Type",
354
- accessorKey: "pf_collectible.type",
355
- accessorFn: (t) => E.formattedType(t),
356
- meta: {
357
- maxWidth: "200px"
358
- },
359
- cell(t) {
360
- const s = E.formattedType(t.row.original);
361
- return c("div", { class: "flex items-center" }, [
362
- c("div", { class: "truncate text-ellipsis" }, s),
363
- s.length > 20 ? c(
364
- C.FmTooltip,
365
- {
366
- content: s
367
- },
368
- [
369
- c(C.FmIcon, {
370
- name: "info",
371
- color: "primary",
372
- outline: !0,
373
- size: "sm"
374
- })
375
- ]
376
- ) : null
377
- ]);
378
- }
379
- },
380
- {
381
- header: "Source",
382
- accessorKey: "source",
383
- cell(t) {
384
- var s;
385
- return c("div", { class: "flex items-center gap-4" }, [
386
- c(
387
- "div",
388
- { class: "truncate text-ellipsis" },
389
- J(E.getReason(t.row.original.source))
390
- ),
391
- ...(s = t.row.original.metadata) != null && s.campaign ? [
392
- c(
393
- C.FmTooltip,
394
- {
395
- get content() {
396
- var w;
397
- return (w = m.campaigns.all.find(
398
- (_) => {
399
- var y;
400
- return _._id === ((y = t.row.original.metadata) == null ? void 0 : y.campaign);
401
- }
402
- )) == null ? void 0 : w.name;
403
- }
404
- },
405
- [
406
- c(C.FmIcon, {
407
- name: "info",
408
- color: "primary",
409
- size: "sm",
410
- onClick: async (w) => {
411
- w.preventDefault(), w.stopPropagation();
412
- const _ = m.campaigns.all.find(
413
- (y) => {
414
- var z;
415
- return y._id === ((z = t.row.original.metadata) == null ? void 0 : z.campaign);
416
- }
417
- );
418
- if (_)
419
- switch (_.type) {
420
- case "VOUCHER":
421
- case "PROMOTION":
422
- case "BROADCAST":
423
- await R.push({
424
- name: X[`$connect-CAMPAIGN_${_.type}`]
425
- });
426
- break;
427
- case "GAME":
428
- case "CREDIT":
429
- case "MISSION":
430
- await R.push({
431
- name: X[`$connect-PROGRAM_${_.type}`]
432
- });
433
- break;
434
- case "POINT":
435
- await R.push({
436
- name: X["$connect-PROGRAM_EXPERIENCE"]
437
- });
438
- break;
439
- case "COIN":
440
- await R.push({
441
- name: X["$connect-PROGRAM_POINT"]
442
- });
443
- break;
444
- }
445
- }
446
- })
447
- ]
448
- )
449
- ] : []
450
- ]);
451
- }
452
- },
453
- {
454
- header: "User",
455
- accessorKey: "pf_user.name",
456
- cell(t) {
457
- return ve(t.row.original.pf_user);
458
- }
459
- },
460
- {
461
- header: "Phone No.",
462
- accessorKey: "pf_user.phoneNumber",
463
- accessorFn: (t) => {
464
- var s;
465
- return ((s = t == null ? void 0 : t.pf_user) == null ? void 0 : s.phoneNumber) || "";
466
- }
467
- },
468
- {
469
- header: "Status",
470
- id: "status",
471
- enableSorting: !1,
472
- cell(t) {
473
- const s = !!t.row.original.refunded;
474
- return c(C.FmChip, {
475
- label: g(s ? "connect.transaction.refunded" : "connect.transaction.completed"),
476
- variant: "plain",
477
- class: s ? "text-fm-color-typo-warning bg-fm-color-system-warning-100" : "text-fm-color-typo-success bg-fm-color-system-success-100"
478
- });
479
- }
480
- },
481
- {
482
- accessorFn: (t) => t.ref,
483
- header: "References",
484
- accessorKey: "ref",
485
- cell(t) {
486
- const s = E.formattedRemark(t.row.original);
487
- return c("div", { class: "flex items-center justify-between gap-4" }, [
488
- c("div", { class: "flex items-center" }, [
489
- s ? c(
490
- C.FmTooltip,
491
- {
492
- content: s
493
- },
494
- [
495
- c(C.FmIcon, {
496
- name: "info",
497
- class: "pl-2",
498
- outline: !0,
499
- size: "sm"
500
- })
501
- ]
502
- ) : c("div")
503
- ]),
504
- c("div", { class: "flex-1" }, t.row.original.ref)
505
- ]);
506
- }
507
- }
508
- // {
509
- // header: 'Actions',
510
- // cell(props) {
511
- // const transaction = props.row.original;
512
- // const blockReason = getReversalBlockReason(transaction);
513
- // return h(
514
- // components.FmTooltip,
515
- // {
516
- // get content() {
517
- // if (blockReason) return blockReason;
518
- // return transaction.pf_collectible?.type === 'STAMP'
519
- // ? 'Recalculate mission rewards'
520
- // : 'Revert transaction';
521
- // },
522
- // },
523
- // [
524
- // h(components.FmButton, {
525
- // variant: 'tertiary',
526
- // icon: 'amend',
527
- // iconColor: 'neutral-gray-400',
528
- // 'aria-label': blockReason
529
- // ? `Cannot reverse transaction ${transaction._id}: ${blockReason}`
530
- // : `${
531
- // transaction.pf_collectible?.type === 'STAMP'
532
- // ? 'Recalculate mission rewards for'
533
- // : 'Reverse'
534
- // } transaction ${transaction._id}`,
535
- // disabled: !!blockReason,
536
- // onClick: (e: Event) => {
537
- // e.stopPropagation();
538
- // onRevert(transaction);
539
- // },
540
- // }),
541
- // ]
542
- // );
543
- // },
544
- // },
545
- ], f = k({
546
- search: "",
547
- "pf_collectible.type": [],
548
- "metadata.location": [],
549
- dateRange: {
550
- startDate: P().subtract(7, "day").toISOString(),
551
- endDate: P().endOf("day").toISOString()
552
- },
553
- source: []
554
- }), v = () => ({
555
- ...f.value,
556
- user: T.user,
557
- dateRange: {
558
- start: new Date(f.value.dateRange.startDate).toISOString(),
559
- end: new Date(f.value.dateRange.endDate).toISOString()
560
- }
561
- }), { tableMeta: r, rowData: x, onSort: h, debouncedFetchData: p, resetCursorState: a } = Oe(async (t) => {
562
- const s = await te.readAllCursor(
563
- t,
564
- v()
565
- );
566
- return {
567
- resources: s.resources.map((w) => {
568
- const _ = o.value.find((y) => y._id === w.ref);
569
- return {
570
- ...w,
571
- ref: (_ == null ? void 0 : _.seqNumber) || w.ref
572
- };
573
- }),
574
- meta: s.meta
575
- };
576
- }), o = k([]), b = pe.options.map((t) => ({ label: J(E.getReason(t)), value: t })), e = O(
577
- () => u.locations.map((t) => ({ label: t.name, value: t._id }))
578
- );
579
- de(
580
- f,
581
- () => {
582
- a(), p({ pageIndex: 0 });
583
- },
584
- { deep: !0 }
585
- );
586
- async function n() {
587
- try {
588
- N.value = !0;
589
- const t = new ze(), s = v(), w = 1e3;
590
- await M(
591
- async () => {
592
- var z, G, q, H, ce, ue;
593
- let _, y = !0;
594
- for (; y; ) {
595
- const Q = await te.readAllCursor(
596
- {
597
- limit: w,
598
- sortBy: "_id",
599
- descending: !1,
600
- ..._ ? { cursor: _ } : {}
601
- },
602
- s
603
- );
604
- if (!Q.resources.length)
605
- break;
606
- for (const $ of Q.resources)
607
- t.addRecord({
608
- TransactionID: $._id,
609
- CreatedAt: P(Y($._id.toString())).format(
610
- "D MMM YYYY, hh:mmA"
611
- ),
612
- Amount: L(
613
- $.expiryAmount.reduce(
614
- (_e, Te) => _e + Te.amount,
615
- $.amount ?? 0
616
- ),
617
- 2
618
- ),
619
- ExpiredAt: (G = (z = $.expiryAmount) == null ? void 0 : z[0]) != null && G.expiredAt ? P((H = (q = $.expiryAmount) == null ? void 0 : q[0]) == null ? void 0 : H.expiredAt).format("D MMM YYYY") : "",
620
- Type: E.formattedType($),
621
- Source: J(E.getReason($.source)),
622
- User: ((ce = $.pf_user) == null ? void 0 : ce.name) || "",
623
- "Phone No.": ((ue = $.pf_user) == null ? void 0 : ue.phoneNumber) || "",
624
- References: $.ref,
625
- Remark: E.formattedRemark($)
626
- });
627
- _ = Q.meta.nextCursor ?? void 0, y = Q.meta.hasNext && !!_;
628
- }
629
- await Pe(
630
- t.buildExcel(),
631
- `transactions-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
632
- {
633
- bookType: "xlsx",
634
- bookSST: !1,
635
- type: "array"
636
- }
637
- );
638
- },
639
- {
640
- message: "Exporting transactions...",
641
- successMessage: "transactions exported successfully"
642
- }
643
- );
644
- } catch (t) {
645
- console.error(t);
646
- } finally {
647
- N.value = !1;
648
- }
649
- }
650
- const i = k(null);
651
- function F(t) {
652
- var s;
653
- console.log(t), (s = i.value) == null || s.showSheet(!0, t.original);
654
- }
655
- return Re(async () => {
656
- await u.readLocations(), await m.read(), await p();
657
- }), (t, s) => {
658
- const w = U("FmSearch"), _ = U("FmButton");
659
- return A(), V(j, null, [
660
- S("div", null, [
661
- S("div", qe, [
662
- D(w, {
663
- class: "hidden xs:!flex border-b border-fm-color-neutral-gray-100",
664
- modelValue: l(f).search,
665
- "onUpdate:modelValue": s[0] || (s[0] = (y) => l(f).search = y),
666
- placeholder: "Search",
667
- collapsible: ""
668
- }, null, 8, ["modelValue"]),
669
- D(_, {
670
- icon: "ios_share",
671
- variant: "tertiary",
672
- onClick: n
673
- })
674
- ]),
675
- S("div", He, [
676
- S("div", Qe, [
677
- D(re, {
678
- class: "cursor-pointer text-fm-color-neutral-gray-400",
679
- "right-icon": "keyboard_arrow_down",
680
- modelValue: l(f)["metadata.location"],
681
- "onUpdate:modelValue": s[1] || (s[1] = (y) => l(f)["metadata.location"] = y),
682
- icon: "storefront",
683
- "show-item-label": !0,
684
- items: l(e)
685
- }, null, 8, ["modelValue", "items"]),
686
- D(re, {
687
- class: "cursor-pointer text-fm-color-neutral-gray-400",
688
- "right-icon": "keyboard_arrow_down",
689
- modelValue: l(f)["pf_collectible.type"],
690
- "onUpdate:modelValue": s[2] || (s[2] = (y) => l(f)["pf_collectible.type"] = y),
691
- label: "Type: ",
692
- "show-item-label": !0,
693
- items: [
694
- { label: "Point", value: "COIN" },
695
- { label: "Credit", value: "CREDIT" },
696
- { label: "Voucher", value: "VOUCHER" },
697
- { label: "Experience", value: "POINT" },
698
- { label: "Tier", value: "TIER" },
699
- { label: "Title", value: "TITLE" },
700
- { label: "Game", value: "GAME" },
701
- { label: "Stamp", value: "STAMP" }
702
- ]
703
- }, null, 8, ["modelValue"]),
704
- D(re, {
705
- class: "cursor-pointer text-fm-color-neutral-gray-400",
706
- "right-icon": "keyboard_arrow_down",
707
- modelValue: l(f).source,
708
- "onUpdate:modelValue": s[3] || (s[3] = (y) => l(f).source = y),
709
- label: "Source: ",
710
- "show-item-label": !0,
711
- items: l(b)
712
- }, null, 8, ["modelValue", "items"]),
713
- D(fe, {
714
- "model-value": {
715
- startDate: l(f).dateRange.startDate,
716
- endDate: l(f).dateRange.endDate
717
- },
718
- "onUpdate:modelValue": s[4] || (s[4] = (y) => l(f).dateRange = {
719
- startDate: l(P)(y.startDate).startOf("d").toISOString(),
720
- endDate: l(P)(y.endDate).endOf("d").toISOString()
721
- })
722
- }, null, 8, ["model-value"])
723
- ]),
724
- D(w, {
725
- class: "xs:hidden",
726
- modelValue: l(f).search,
727
- "onUpdate:modelValue": s[5] || (s[5] = (y) => l(f).search = y),
728
- placeholder: "Search",
729
- collapsible: ""
730
- }, null, 8, ["modelValue"]),
731
- S("div", Xe, [
732
- D(_, {
733
- icon: "ios_share",
734
- variant: "tertiary",
735
- onClick: n
736
- })
737
- ])
738
- ]),
739
- D(ye, {
740
- loading: l(r).isLoading,
741
- "row-data": l(x),
742
- "row-count": l(r).totalRows,
743
- "column-defs": I.filter(
744
- (y) => !T.user || y.header !== "User" && y.header !== "Phone No."
745
- ),
746
- "page-count": l(r).pageCount,
747
- "page-index": l(r).pageIndex,
748
- "page-size": l(r).pageSize,
749
- "shrink-at": !1,
750
- "pagination-mode": "cursor",
751
- "has-next": l(r).hasNext,
752
- onSortChange: l(h),
753
- onPageChange: s[6] || (s[6] = (y) => l(p)({
754
- pageSize: y.pageSize,
755
- pageIndex: y.pageIndex
756
- })),
757
- onRowClick: F
758
- }, null, 8, ["loading", "row-data", "row-count", "column-defs", "page-count", "page-index", "page-size", "has-next", "onSortChange"])
759
- ]),
760
- D(We, {
761
- ref_key: "transactionDetailSheet",
762
- ref: i
763
- }, null, 512)
764
- ], 64);
765
- };
766
- }
767
- });
768
- class Je extends he {
769
- }
770
- function ae(d) {
771
- return d.quantity ?? 1;
772
- }
773
- function Se(d, g) {
774
- var u, m;
775
- switch ((u = d.paymentType) == null ? void 0 : u.type) {
776
- case "COIN":
777
- return g("connect.store.paymentType.point");
778
- case "CARD":
779
- return g("connect.store.paymentType.cardActivation");
780
- default:
781
- return ((m = d.paymentType) == null ? void 0 : m.type) ?? g("connect.store.paymentType.notAvailable");
782
- }
783
- }
784
- function W(d, g) {
785
- return $e({
786
- ...g,
787
- amount: g.amount * ae(d)
788
- });
789
- }
790
- function le(d) {
791
- var g;
792
- if (((g = d.paymentType) == null ? void 0 : g.type) === "COIN") {
793
- if (d.bundle.coinPrice == null) return "N/A";
794
- const u = d.bundle.coinPrice * ae(d);
795
- return `${L(u, 2, !0)} points`;
796
- }
797
- return W(
798
- d,
799
- d.bundle.priceWithTaxes ?? d.bundle.price
800
- );
801
- }
802
- function Ze(d) {
803
- return W(
804
- d,
805
- d.bundle.originalPrice ?? d.bundle.price
806
- );
807
- }
808
- function et(d) {
809
- const [g, ...u] = d.bundle.taxTotals ?? [];
810
- if (!g) return null;
811
- const m = u.reduce(
812
- (R, T) => R + T.total.amount,
813
- g.total.amount
814
- );
815
- return W(d, {
816
- ...g.total,
817
- amount: m
818
- });
819
- }
820
- const tt = { class: "space-y-24 pr-12" }, at = { class: "fm-typo-en-title-sm-800 mb-16" }, ot = {
821
- key: 0,
822
- class: "space-y-16"
823
- }, nt = { class: "fm-typo-en-body-lg-600" }, rt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary break-words" }, st = {
824
- key: 1,
825
- class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
826
- }, lt = /* @__PURE__ */ oe({
827
- __name: "StoreTransactionDetailSheet",
828
- setup(d, { expose: g }) {
829
- const u = k(!1), m = k(null), { t: R } = ne();
830
- function T(a, o) {
831
- u.value = a, m.value = o ?? null;
832
- }
833
- function N(a) {
834
- if (!a.location) return "Online Store";
835
- const o = Array.isArray(a.pf_location) ? a.pf_location[0] : a.pf_location;
836
- return (o == null ? void 0 : o.name) ?? a.location.toString();
837
- }
838
- function M(a) {
839
- return Array.isArray(a) ? a.flatMap((o) => typeof o != "object" || o === null || !("name" in o) || typeof o.name != "string" ? [] : [o.name]) : [];
840
- }
841
- function I(a, o, b, e) {
842
- if (a.length === o)
843
- return a.map((i) => b > 1 ? `${i} × ${b}` : i).join(", ");
844
- const n = o * b;
845
- return `${n} ${e}${n === 1 ? "" : "s"}`;
846
- }
847
- const f = O(() => {
848
- var e, n, i;
849
- const a = m.value;
850
- if (!a) return [];
851
- const o = a.pf_member, b = Se(a, R);
852
- return [
853
- { label: "Transaction ID", value: a._id.toString() },
854
- {
855
- label: "Date/Time",
856
- value: P(Y(a._id.toString())).format(
857
- "D MMM YYYY, hh:mmA"
858
- )
859
- },
860
- {
861
- label: "Status",
862
- value: K.title(a.refund ? "REFUNDED" : a.status)
863
- },
864
- {
865
- label: "Customer",
866
- value: (o == null ? void 0 : o.name) ?? (o == null ? void 0 : o.email) ?? (o == null ? void 0 : o.phoneNumber) ?? "Unknown"
867
- },
868
- { label: "Location", value: N(a) },
869
- {
870
- label: "Payment Type",
871
- value: ((e = a.paymentType) == null ? void 0 : e.type) === "COIN" || ((n = a.paymentType) == null ? void 0 : n.type) === "CARD" || !((i = a.paymentType) != null && i.type) ? b : K.title(b)
872
- },
873
- { label: "Reference", value: a.ref || "N/A" },
874
- ...a.paymentRef ? [{ label: "Payment Reference", value: a.paymentRef }] : [],
875
- {
876
- label: "Quantity",
877
- value: ae(a).toString()
878
- }
879
- ];
880
- }), v = O(() => {
881
- const a = m.value;
882
- return a ? [
883
- { label: "Bundle Name", value: a.bundle.name },
884
- {
885
- label: "Bundle Value",
886
- value: Ze(a)
887
- },
888
- {
889
- label: "Base Subtotal",
890
- value: W(a, a.bundle.price)
891
- },
892
- {
893
- label: "Selling Price",
894
- value: le(a)
895
- }
896
- ] : [];
897
- }), r = O(() => {
898
- var n;
899
- const a = m.value;
900
- if (!a) return [];
901
- const { bundle: o } = a, b = ae(a), e = [];
902
- if (o.credit.normal > 0 && e.push({
903
- label: "Credit",
904
- value: `${L(
905
- o.credit.normal * b,
906
- 2,
907
- !0
908
- )} credits`
909
- }), (n = o.credit.free) != null && n.amount) {
910
- const i = `${o.credit.free.day} day${o.credit.free.day === 1 ? "" : "s"}`;
911
- e.push({
912
- label: "Free Credit",
913
- value: `${L(
914
- o.credit.free.amount * b,
915
- 2,
916
- !0
917
- )} credits (${i})`
918
- });
919
- }
920
- return o.vouchers.length > 0 && e.push({
921
- label: "Vouchers",
922
- value: I(
923
- M(o.pf_vouchers),
924
- o.vouchers.length,
925
- b,
926
- "voucher"
927
- )
928
- }), o.titles.length > 0 && e.push({
929
- label: "Titles",
930
- value: I(
931
- M(o.pf_titles),
932
- o.titles.length,
933
- b,
934
- "title"
935
- )
936
- }), e;
937
- }), x = O(() => {
938
- const a = m.value;
939
- if (!a) return [];
940
- const o = (a.bundle.taxTotals ?? []).map((e) => {
941
- var i;
942
- const n = (i = a.bundle._inclusiveTaxes) == null ? void 0 : i.some(
943
- (F) => F.systemCode === e.systemCode && F.inclusive
944
- );
945
- return {
946
- label: `${e.name} (${De(e.rate)}%, ${n ? "Inclusive" : "Exclusive"})`,
947
- value: W(a, e.total)
948
- };
949
- }), b = et(a);
950
- return b ? [...o, { label: "Tax Total", value: b }] : o;
951
- }), h = O(() => {
952
- var o;
953
- const a = (o = m.value) == null ? void 0 : o.giftCard;
954
- return a ? [
955
- { label: "Movement", value: K.title(a.movement) },
956
- {
957
- label: "Serial Number",
958
- value: a.serialNumber ?? (a.movement === "PURCHASE" ? "Pending card issuance" : "Not available")
959
- }
960
- ] : [];
961
- }), p = O(() => [
962
- { title: "Transaction", items: f.value },
963
- { title: "Bundle & Pricing", items: v.value },
964
- { title: "Rewards", items: r.value, emptyText: "No rewards" },
965
- { title: "Taxes", items: x.value, emptyText: "No taxes" },
966
- ...h.value.length ? [{ title: "Gift Card", items: h.value }] : []
967
- ]);
968
- return g({ showSheet: T }), (a, o) => {
969
- const b = U("FmButton"), e = U("FmSideSheet");
970
- return A(), se(e, {
971
- modelValue: l(u),
972
- "onUpdate:modelValue": o[1] || (o[1] = (n) => me(u) ? u.value = n : null),
973
- "max-width": 560,
974
- header: "Store Transaction Details"
975
- }, {
976
- "side-sheet-footer": Z(() => [
977
- D(b, {
978
- label: "Close",
979
- variant: "tertiary",
980
- onClick: o[0] || (o[0] = (n) => T(!1))
981
- })
982
- ]),
983
- default: Z(() => [
984
- S("div", tt, [
985
- (A(!0), V(j, null, ee(l(p), (n) => (A(), V("section", {
986
- key: n.title
987
- }, [
988
- S("h3", at, B(n.title), 1),
989
- n.items.length ? (A(), V("div", ot, [
990
- (A(!0), V(j, null, ee(n.items, (i) => (A(), V("div", {
991
- key: i.label,
992
- class: "flex flex-col gap-4"
993
- }, [
994
- S("div", nt, B(i.label), 1),
995
- S("div", rt, B(i.value), 1),
996
- o[2] || (o[2] = S("hr", { class: "mt-3 border-fm-color-neutral-gray-100" }, null, -1))
997
- ]))), 128))
998
- ])) : (A(), V("div", st, B(n.emptyText), 1))
999
- ]))), 128))
1000
- ])
1001
- ]),
1002
- _: 1
1003
- }, 8, ["modelValue"]);
1004
- };
1005
- }
1006
- }), it = { class: "flex items-center justify-between" }, ct = { class: "flex gap-8 items-center" }, ut = { class: "flex gap-8 items-center xs:hidden" }, jt = /* @__PURE__ */ oe({
1007
- __name: "StoreTransactions",
1008
- props: {
1009
- user: {
1010
- type: String
1011
- }
1012
- },
1013
- setup(d) {
1014
- const g = d, { minor: u } = xe, { t: m } = ne();
1015
- function R(e) {
1016
- return Se(e, m);
1017
- }
1018
- function T(e) {
1019
- return P(Y(e._id.toString())).format(
1020
- "D MMM YYYY, hh:mmA"
1021
- );
1022
- }
1023
- function N(e) {
1024
- var n, i;
1025
- return e.location ? ((i = (n = e.pf_location) == null ? void 0 : n[0]) == null ? void 0 : i.name) ?? e.location.toString() : "Online Store";
1026
- }
1027
- const M = [
1028
- {
1029
- header: "Transaction ID",
1030
- meta: {
1031
- maxWidth: "150px"
1032
- },
1033
- cell(e) {
1034
- return c("div", { class: "flex items-center" }, [
1035
- c(C.FmIcon, {
1036
- name: "content_copy",
1037
- outline: !0,
1038
- size: "sm",
1039
- class: "cursor-pointer mr-4 shrink-0",
1040
- onClick: (n) => {
1041
- n.preventDefault(), n.stopPropagation(), ie(e.row.original._id.toString());
1042
- }
1043
- }),
1044
- c("div", { class: "truncate" }, e.row.original._id.toString())
1045
- ]);
1046
- }
1047
- },
1048
- {
1049
- header: "Created at",
1050
- accessorFn: T,
1051
- enableSorting: !0
1052
- },
1053
- {
1054
- header: "Bundle",
1055
- accessorFn: (e) => e.bundle.name
1056
- },
1057
- {
1058
- header: "Selling Price",
1059
- cell: (e) => le(e.row.original)
1060
- },
1061
- {
1062
- header: "Location",
1063
- accessorFn: N
1064
- },
1065
- {
1066
- header: "Payment Type",
1067
- accessorFn: R,
1068
- cell(e) {
1069
- var n;
1070
- return c("div", { class: "flex items-center gap-4" }, [
1071
- c("div", { class: "flex items-center" }, [
1072
- ((n = e.row.original.paymentType) == null ? void 0 : n.type) == "ONLINE" && e.row.original.paymentType.extra ? c(
1073
- C.FmTooltip,
1074
- {
1075
- content: e.row.original.paymentType.extra
1076
- },
1077
- [
1078
- c(C.FmIcon, {
1079
- name: "info",
1080
- outline: !0,
1081
- size: "sm"
1082
- })
1083
- ]
1084
- ) : c("div")
1085
- ]),
1086
- c("div", { class: "flex-1" }, R(e.row.original))
1087
- ]);
1088
- }
1089
- },
1090
- {
1091
- header: "User",
1092
- cell: (e) => ve(e.row.original.pf_member)
1093
- },
1094
- {
1095
- header: "Phone No.",
1096
- accessorFn: (e) => e.pf_member.phoneNumber
1097
- },
1098
- {
1099
- header: "Status",
1100
- // accessorFn: (u) => u.status,
1101
- cell(e) {
1102
- var F, t, s, w;
1103
- const n = e.row.original.status, i = {
1104
- COMPLETED: "text-fm-color-typo-success bg-fm-color-system-success-100",
1105
- REFUNDED: "text-fm-color-typo-warning bg-fm-color-system-warning-100"
1106
- };
1107
- return c("div", { class: "flex items-center gap-4" }, [
1108
- c(C.FmChip, {
1109
- label: K.title(n),
1110
- variant: "plain",
1111
- class: i[n] ?? ""
1112
- }),
1113
- (t = (F = e.row.original) == null ? void 0 : F.refund) != null && t.reason ? c(
1114
- C.FmTooltip,
1115
- {
1116
- content: (w = (s = e.row.original) == null ? void 0 : s.refund) == null ? void 0 : w.reason
1117
- },
1118
- [
1119
- c(C.FmIcon, {
1120
- name: "info",
1121
- color: "primary",
1122
- outline: !0,
1123
- size: "sm"
1124
- })
1125
- ]
1126
- ) : null
1127
- ]);
1128
- }
1129
- },
1130
- {
1131
- header: "Source",
1132
- accessorFn: (e) => e.source
1133
- },
1134
- {
1135
- header: "Ref",
1136
- accessorFn: (e) => e.ref
1137
- },
1138
- {
1139
- id: "action",
1140
- cell(e) {
1141
- const n = e.row.original, i = n.status === "COMPLETED" && !n.refund && n.source == "ADMIN";
1142
- return i ? c(
1143
- C.FmMenu,
1144
- {
1145
- placement: "bottom-end",
1146
- onClick: (F) => {
1147
- F.stopPropagation();
1148
- }
1149
- },
1150
- {
1151
- "menu-button": () => c(C.FmButton, {
1152
- icon: "settings",
1153
- variant: "tertiary",
1154
- if: i
1155
- }),
1156
- default: () => [
1157
- c(C.FmMenuItem, {
1158
- label: "Refund",
1159
- sublabel: "Refund this transaction",
1160
- onClick: async (F) => {
1161
- F.stopPropagation(), await p(n);
1162
- }
1163
- })
1164
- ]
1165
- }
1166
- ) : c("div");
1167
- }
1168
- }
1169
- ], I = k({
1170
- searchValue: "",
1171
- dateRange: {
1172
- startDate: P().subtract(7, "day").toISOString(),
1173
- endDate: P().toISOString()
1174
- }
1175
- }), { tableMeta: f, rowData: v, onSort: r, debouncedFetchData: x, onSearch: h } = Fe(async (e) => {
1176
- const n = {
1177
- ...I.value.dateRange,
1178
- user: g.user
1179
- };
1180
- return await te.readStoreTransactions(e, n);
1181
- });
1182
- async function p(e) {
1183
- await Ne.confirm(
1184
- "Are you sure you want to refund this transaction?",
1185
- "Refund Store Transaction",
1186
- "Confirm",
1187
- "Cancel"
1188
- ) && await u(
1189
- async () => {
1190
- var i;
1191
- await Ve.refundStoreTransaction({
1192
- id: e._id,
1193
- reason: `ADMIN:${(i = Me().sessionUser) == null ? void 0 : i.name}`
1194
- }), await x();
1195
- },
1196
- {
1197
- message: "Refunding transaction...",
1198
- successMessage: "Transaction refunded successfully"
1199
- }
1200
- );
1201
- }
1202
- de(
1203
- I,
1204
- () => {
1205
- x();
1206
- },
1207
- { deep: !0 }
1208
- ), Ie(async () => {
1209
- await x();
1210
- });
1211
- const a = async () => Ae({
1212
- exporter: new Je(),
1213
- readFunction: (e) => te.readStoreTransactions(e, {
1214
- ...I.value.dateRange,
1215
- user: g.user
1216
- }),
1217
- transformRecord: (e) => {
1218
- var n, i, F, t;
1219
- return {
1220
- "Transaction ID": e._id.toString(),
1221
- "Created at": T(e),
1222
- Bundle: e.bundle.name || "",
1223
- "Selling Price": le(e),
1224
- Location: N(e),
1225
- "Payment Type": R(e),
1226
- "Payment Extra": ((n = e.paymentType) == null ? void 0 : n.extra) || "",
1227
- User: ((i = e.pf_member) == null ? void 0 : i.name) || "",
1228
- "Phone No.": ((F = e.pf_member) == null ? void 0 : F.phoneNumber) || "",
1229
- Status: K.title(e.status),
1230
- "Refund Reason": ((t = e.refund) == null ? void 0 : t.reason) || "",
1231
- Source: e.source,
1232
- Ref: (e == null ? void 0 : e.ref) || ""
1233
- };
1234
- },
1235
- filename: "store-transactions"
1236
- }), o = k(null);
1237
- function b(e) {
1238
- var n;
1239
- (n = o.value) == null || n.showSheet(!0, e.original);
1240
- }
1241
- return (e, n) => {
1242
- const i = U("FmSearch"), F = U("FmButton");
1243
- return A(), V("div", null, [
1244
- S("div", it, [
1245
- S("div", ct, [
1246
- D(fe, {
1247
- modelValue: l(I).dateRange,
1248
- "onUpdate:modelValue": n[0] || (n[0] = (t) => l(I).dateRange = t)
1249
- }, null, 8, ["modelValue"])
1250
- ]),
1251
- S("div", ut, [
1252
- D(i, {
1253
- modelValue: l(f).searchValue,
1254
- "onUpdate:modelValue": [
1255
- n[1] || (n[1] = (t) => l(f).searchValue = t),
1256
- l(h)
1257
- ],
1258
- placeholder: "Search",
1259
- collapsible: ""
1260
- }, null, 8, ["modelValue", "onUpdate:modelValue"]),
1261
- D(F, {
1262
- icon: "ios_share",
1263
- variant: "tertiary",
1264
- onClick: a
1265
- })
1266
- ])
1267
- ]),
1268
- D(ye, {
1269
- loading: l(f).isLoading,
1270
- "row-data": l(v),
1271
- "row-count": l(f).totalRows,
1272
- "column-defs": M.filter(
1273
- (t) => !g.user || t.header !== "User" && t.header !== "Phone No."
1274
- ),
1275
- "page-count": l(f).pageCount,
1276
- "page-index": l(f).pageIndex,
1277
- "page-size": l(f).pageSize,
1278
- "shrink-at": !1,
1279
- onSortChange: l(r),
1280
- onRowClick: b,
1281
- onPageChange: n[2] || (n[2] = (t) => l(x)({
1282
- pageSize: t.pageSize,
1283
- pageIndex: t.pageIndex
1284
- }))
1285
- }, null, 8, ["loading", "row-data", "row-count", "column-defs", "page-count", "page-index", "page-size", "onSortChange"]),
1286
- D(lt, {
1287
- ref_key: "transactionDetailSheet",
1288
- ref: o
1289
- }, null, 512)
1290
- ]);
1291
- };
1292
- }
1293
- });
1294
- export {
1295
- Kt as _,
1296
- jt as a
1297
- };