@feedmepos/mf-connect 0.1.118-prod → 0.1.119-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/README.md +12 -8
  2. package/dist/{App-BHcTqLff.js → App-z-u6skb5.js} +349 -337
  3. package/dist/AuditLogs-J0UJ3HJW.js +2016 -0
  4. package/dist/{Bin-DWhXJmHo.js → Bin-Dh9RAgYi.js} +8 -8
  5. package/dist/{Broadcast-Ct1DL8Pd.js → Broadcast-Dg6azPS8.js} +22 -21
  6. package/dist/{CampaignAnalytic-BSEKCM-4.js → CampaignAnalytic-CVB4dstO.js} +7 -7
  7. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BxRg2Wu8.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DYgBeT23.js} +8 -9
  8. package/dist/{Card-B7DwrAPH.js → Card-CY736Ul0.js} +22 -22
  9. package/dist/{Collections-BJw4JJq_.js → Collections-CdTKWkZZ.js} +197 -185
  10. package/dist/{Credit-BteIGXkp.js → Credit-CUhEKlMI.js} +21 -20
  11. package/dist/{DateRangeChip.vue_vue_type_script_setup_true_lang-CSFwIzOS.js → DateRangeChip.vue_vue_type_script_setup_true_lang-CBwgeTXh.js} +1 -1
  12. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-BC4jTtVY.js +4439 -0
  13. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-BDZ21UHA.js → EffectSheet.vue_vue_type_style_index_0_lang-D5-EKqG9.js} +30 -30
  14. package/dist/{Experience-C_VQVfJX.js → Experience-CMp09U-6.js} +32 -31
  15. package/dist/{FileSaver.min-CMiQUZQE.js → FileSaver.min-Bq5McdmK.js} +1 -1
  16. package/dist/{Game-BiHMrMBF.js → Game-Dv5NvG-q.js} +19 -18
  17. package/dist/{GiftCardSetup-DtJIm6oI.js → GiftCardSetup-SO2Tk5In.js} +31 -31
  18. package/dist/{GoalPickerPanel.vue_vue_type_script_setup_true_lang-BKGnPAEj.js → GoalPickerPanel.vue_vue_type_script_setup_true_lang-CgG5vHCp.js} +7 -7
  19. package/dist/{Goals-B7VjLMDT.js → Goals-BEwQP4cY.js} +4 -4
  20. package/dist/Grab-npbL7p7S.js +301 -0
  21. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-C9ecPgpJ.js → ImageInput.vue_vue_type_script_setup_true_lang-BDGEqsWE.js} +1 -1
  22. package/dist/{Index-D_DIHKZG.js → Index-8F2LOWng.js} +10 -10
  23. package/dist/{LocationPicker.vue_vue_type_script_setup_true_lang-DSwB0Ubn.js → LocationPicker.vue_vue_type_script_setup_true_lang-BwAjki7Y.js} +1 -1
  24. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-dk8_eVwd.js → LottieAnimation.vue_vue_type_script_setup_true_lang-DK4C0Y9j.js} +1 -1
  25. package/dist/{LoyaltyDashboard-DOgHeJdK.js → LoyaltyDashboard-rWm0b8cm.js} +15 -15
  26. package/dist/{MainLayout-CfYgoXLS.js → MainLayout-ezbgp2IQ.js} +1 -1
  27. package/dist/{MainLayout.vue_vue_type_script_setup_true_lang-Bz2LGHUd.js → MainLayout.vue_vue_type_script_setup_true_lang-1QY5-U5y.js} +3 -3
  28. package/dist/{Marketing-B6TCrwaR.js → Marketing-DcWF4xVc.js} +4 -4
  29. package/dist/{MarketingMaterialEdit-Bu3a9NGj.js → MarketingMaterialEdit-C1bXj_hU.js} +214 -211
  30. package/dist/{Member-X51KrYXV.js → Member-CgDZqGsV.js} +7 -7
  31. package/dist/{MemberDetailSheet.vue_vue_type_script_setup_true_lang-CYU21JaO.js → MemberDetailSheet.vue_vue_type_script_setup_true_lang-Dh1_j06F.js} +39 -47
  32. package/dist/{MemberImportHistory-CHd9fx7E.js → MemberImportHistory-DT3QJ5se.js} +7 -7
  33. package/dist/{MemberList-D4L3bSlw.js → MemberList-Bm05jnbk.js} +103 -105
  34. package/dist/{MemberTransactions-CEgjfhnX.js → MemberTransactions-D90tTpdC.js} +1 -1
  35. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-zsaig_yK.js → MessageInput.vue_vue_type_script_setup_true_lang-jvgjOXXA.js} +12 -12
  36. package/dist/{MetricInfoTooltip.vue_vue_type_script_setup_true_lang-YZQkKG66.js → MetricInfoTooltip.vue_vue_type_script_setup_true_lang-CxL-Nh6i.js} +1 -1
  37. package/dist/{Mission-BEVtvY0-.js → Mission-D_l2eJI3.js} +22 -21
  38. package/dist/{Overview-DVoXXZ16.js → Overview-1AYfTeMD.js} +20 -20
  39. package/dist/{Overview-4QRkldza.js → Overview-BOZBnorP.js} +145 -144
  40. package/dist/{Point-BJmebaL9.js → Point-Cqy4XzeG.js} +22 -21
  41. package/dist/{Promotion-DWZZBofu.js → Promotion-9RDNbCgB.js} +137 -131
  42. package/dist/{Queue-DLdsyhCT.js → Queue-D2Eie_np.js} +45 -45
  43. package/dist/{Record-QOD3XELf.js → Record-e4B--FD8.js} +9 -9
  44. package/dist/{Review-CKmhyuqj.js → Review-DcUpSvc-.js} +2 -2
  45. package/dist/ReviewFacebookCallback-BhHdYb4X.js +225 -0
  46. package/dist/{ReviewGoogleCallback-CDriVQPZ.js → ReviewGoogleCallback-JPkamgo2.js} +5 -5
  47. package/dist/Reward-BQJw-R8V.js +444 -0
  48. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-ZgYX2QwC.js → RewardGroup.vue_vue_type_script_setup_true_lang-D_DSQ8q2.js} +13 -13
  49. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-DfWjXTx3.js +1923 -0
  50. package/dist/{Segment-URdB0lnl.js → Segment-Cjdqsqqg.js} +303 -306
  51. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-DmI2LAsz.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-g-CJUZBF.js} +14 -14
  52. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-BCEgZzA4.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-lbH0b170.js} +4 -4
  53. package/dist/{Setting-BDIHH2Wk.js → Setting-B3HK4mtx.js} +159 -148
  54. package/dist/{SettingAdvertisements-CkJYZnIN.js → SettingAdvertisements-BQFJpdIm.js} +12 -12
  55. package/dist/Settings-DKWkiRuA.js +286 -0
  56. package/dist/{Store-CV0kYncl.js → Store-mp1LyXwr.js} +28 -28
  57. package/dist/{StoreRewards-30kSkAZ_.js → StoreRewards-DiSB6d7_.js} +15 -15
  58. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-BAYKqf-Y.js +1319 -0
  59. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-be7ksTJw.js +7007 -0
  60. package/dist/{Tier-DiQSC3iv.js → Tier-CxaXh96q.js} +2575 -687
  61. package/dist/{Title-DixxpjAg.js → Title-Byz0TGpi.js} +95 -94
  62. package/dist/{Transaction-DQK4LUGD.js → Transaction-CNXulI3o.js} +2 -2
  63. package/dist/Upselling-Dto64bmE.js +1013 -0
  64. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-CL-GKkuD.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-C0bfVZf8.js} +26 -26
  65. package/dist/{Voucher-CSVlk_Hr.js → Voucher-CVw3E8Y4.js} +19 -19
  66. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-CiSoy0Ky.js → VoucherEditor.vue_vue_type_script_setup_true_lang-C0d3ktXA.js} +12 -12
  67. package/dist/{WhatsappAccount-CQYbv2Ew.js → WhatsappAccount-5vLzjaIV.js} +6 -6
  68. package/dist/{WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-DjgRo9iA.js → WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-CwGBRX-Q.js} +1 -1
  69. package/dist/{WhatsappBot-DdO9Bfvh.js → WhatsappBot-BWJbD7Gk.js} +6 -6
  70. package/dist/{WhatsappBotLogs-CjjWJGND.js → WhatsappBotLogs-C8gpmZyC.js} +6 -6
  71. package/dist/{WhatsappBotSettings-DYGx-kRr.js → WhatsappBotSettings-BvPnKHz-.js} +4 -4
  72. package/dist/WhatsappLayout-DJXhXeXf.js +21 -0
  73. package/dist/{WhatsappNotificationGroupDialog.vue_vue_type_script_setup_true_lang-DTUytfe5.js → WhatsappNotificationGroupDialog.vue_vue_type_script_setup_true_lang-BxUYjrWQ.js} +3 -3
  74. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-DdCUr_Zm.js → ZodTextField.vue_vue_type_script_setup_true_lang-CkjzVKif.js} +2 -2
  75. package/dist/{app-CqQeNnGq.js → app-BF1vds2J.js} +11496 -10741
  76. package/dist/app.js +4 -3
  77. package/dist/{base.export-Dls5LQeu.js → base.export-B7FU8J4P.js} +2 -2
  78. package/dist/{business-gvLSQklz.js → business-DkUMhys1.js} +1 -1
  79. package/dist/{campaign-Cd6GmA4U.js → campaign-0AgQP43B.js} +34 -28
  80. package/dist/{campaign-BqazvOUj.js → campaign-C9cVkGMF.js} +121 -94
  81. package/dist/{campaign.enum-BqekIiiN.js → campaign.enum-Dx-Zo68Q.js} +2 -1
  82. package/dist/campaign.fn-N6rJeDUx.js +776 -0
  83. package/dist/{collection.fn-CERMsFPh.js → collection.fn-B_QnW0e3.js} +2 -2
  84. package/dist/{currency-IkiKiNg1.js → currency-XQmondpC.js} +1 -1
  85. package/dist/duplicateCampaign-CvQRWP-Z.js +51 -0
  86. package/dist/{effect-j_T62HBN.js → effect-Mwn1x6qN.js} +1 -1
  87. package/dist/{email-addresses-CN1kPlEj.js → email-addresses-DQQAi6-l.js} +2 -2
  88. package/dist/{feature-flag-DDfyOLsv.js → feature-flag-B1VMMZMd.js} +144 -144
  89. package/dist/google-BQK68wbe.js +5 -0
  90. package/dist/{helper-DVUe13eh.js → helper-D1R8vyjc.js} +1 -1
  91. package/dist/{index-fNYUguDQ.js → index-BU6CU5MP.js} +389 -232
  92. package/dist/{index-DALsfLV7.js → index-Bm43wR8L.js} +2699 -2613
  93. package/dist/{index-jS16KX9p.js → index-Bym-ZIcv.js} +1 -1
  94. package/dist/{index-BvoOJdfc.js → index-C9Nbb7wc.js} +2 -2
  95. package/dist/{index-UJHdDEG1.js → index-CLlGMbnP.js} +1 -1
  96. package/dist/{index-BvkqHehI.js → index-CPB7j8Wn.js} +10 -10
  97. package/dist/{index-COuLtOaw.js → index-CRAuAyO3.js} +1 -1
  98. package/dist/{index-k7FFxt_M.js → index-Cg8Z5eYT.js} +2 -2
  99. package/dist/{index-CPyK4a5J.js → index-CzE9ZPDV.js} +4 -4
  100. package/dist/{index-Cjy0SXCn.js → index-D5BwAYuA.js} +197 -197
  101. package/dist/{index-ep_Kxxid.js → index-DMfCzjiA.js} +2 -2
  102. package/dist/{index-DMiaWY0s.js → index-DQnCdGWe.js} +682 -581
  103. package/dist/{index-D_1pnadB.js → index-DaUhJ6xV.js} +29 -15
  104. package/dist/{index-9RBtEPPj.js → index-P8DDRVa3.js} +1 -1
  105. package/dist/{index-C_SaKemI.js → index-Rs75lw-x.js} +1 -1
  106. package/dist/{index-C-IajuP1.js → index-ZYrey0SM.js} +10 -10
  107. package/dist/{index-CWGbeg5X.js → index-eR9mqPPV.js} +19 -6
  108. package/dist/{index-BmIfGArh.js → index-mOGrVzUV.js} +3 -3
  109. package/dist/{index-lzQ6ehOk.js → index-ug7pxPAX.js} +608 -251
  110. package/dist/{index-DzbVgUEP.js → index-ytSMcSMt.js} +1 -1
  111. package/dist/{index.esm2017-vJKhLfdu.js → index.esm2017-Gkctw9Mb.js} +111 -111
  112. package/dist/{loading-jZV2Dm--.js → loading-kUQqT44G.js} +1 -1
  113. package/dist/{lodash-C2pLek0l.js → lodash-B4AjV7YZ.js} +1 -1
  114. package/dist/{member-import-BKI7soRD.js → member-import-CwDUG5mj.js} +1 -1
  115. package/dist/{membership-smdlFpPr.js → membership-BI6U8-eM.js} +2 -2
  116. package/dist/{money-5XyTnYwW.js → money-Bum-AbB7.js} +1 -1
  117. package/dist/{number-DHU9qJJQ.js → number-uAoNqG-N.js} +1 -1
  118. package/dist/objectid-CPTCMH2h.js +145 -0
  119. package/dist/{onboarding-C_5pyGx-.js → onboarding-wtYzQipv.js} +36 -36
  120. package/dist/{onboardingSetup-Bd1V-Ipy.js → onboardingSetup-DlYM-oqd.js} +2 -2
  121. package/dist/{plugins-D1Ru-da5.js → plugins-BGyTPNfc.js} +3 -3
  122. package/dist/{reward-BqPl68Xk.js → reward-D0xtG-bp.js} +1 -1
  123. package/dist/{rule-WBrRXwL-.js → rule-BAA5-vRj.js} +572 -492
  124. package/dist/style.css +1 -1
  125. package/dist/template-DKgW9ul3.js +188 -0
  126. package/dist/{timezone-O4qrCDcK.js → timezone-Bbw2OeEP.js} +1 -1
  127. package/dist/{transaction.fn-CY_F8Nb8.js → transaction.fn-DZdNjP_E.js} +2 -2
  128. package/dist/{trigger-D-vySeIB.js → trigger-BpotFb7G.js} +9 -9
  129. package/dist/{useMarketingMaterialActions-kA6SLHy_.js → useMarketingMaterialActions-CQ1M0N9c.js} +4 -4
  130. package/dist/{usePagination-AYE_RJH2.js → usePagination-qALFI_Td.js} +1 -1
  131. package/dist/{user-DJcMkYXP.js → user-X_94TRIK.js} +1 -1
  132. package/dist/vue-i18n-CRFpVnMa.js +2365 -0
  133. package/dist/{xlsx--s3hBdDk.js → xlsx-DW48eXDT.js} +224 -224
  134. package/dist/{zod-IpHRbxaJ.js → zod-BAP9II5C.js} +1 -1
  135. package/package.json +8 -3
  136. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-BJotVIKM.js +0 -3496
  137. package/dist/ReviewFacebookCallback-C6DlaJ_j.js +0 -238
  138. package/dist/Reward-DftoZfPN.js +0 -442
  139. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-DHmBwLNP.js +0 -1884
  140. package/dist/Settings-9gaegvYJ.js +0 -179
  141. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-Dgwyk3NA.js +0 -1265
  142. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-CDUhH6wp.js +0 -142
  143. package/dist/WhatsappLayout-B6k_79Kl.js +0 -21
  144. package/dist/campaign.fn-C0oMb1fs.js +0 -776
  145. package/dist/google-C3S8u0mT.js +0 -4
  146. package/dist/objectid-jT5g6pGt.js +0 -145
  147. package/dist/rule-builder-DAlSbaWh.js +0 -102
  148. package/dist/template-DDquG4Xc.js +0 -236
  149. package/dist/vue-i18n-kXHiDb_1.js +0 -2365
@@ -1,1265 +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 { n as pe } from "./index-DMiaWY0s.js";
4
- import "./index-BmIfGArh.js";
5
- import { T as E } from "./transaction.fn-CY_F8Nb8.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-CSFwIzOS.js";
9
- import { s as J } from "./index-CuvNtC_M.js";
10
- import { f as L, F as De } from "./number-DHU9qJJQ.js";
11
- import { u as ge } from "./business-gvLSQklz.js";
12
- import { _ as ye, u as Fe } from "./usePagination-AYE_RJH2.js";
13
- import { c as ie, p as Ne } from "./plugins-D1Ru-da5.js";
14
- import { g as ve } from "./user-DJcMkYXP.js";
15
- import { B as he, e as Ae } from "./base.export-Dls5LQeu.js";
16
- import { u as be } from "./campaign-Cd6GmA4U.js";
17
- import "./index-jS16KX9p.js";
18
- import "./index-DALsfLV7.js";
19
- import "./index-fNYUguDQ.js";
20
- import "./index-lzQ6ehOk.js";
21
- import "./index-BvoOJdfc.js";
22
- import "./index-I9lmcd2w.js";
23
- import "./index-9RBtEPPj.js";
24
- import { u as ne } from "./vue-i18n-kXHiDb_1.js";
25
- import { o as Y } from "./objectId-dwaoBfJX.js";
26
- import { u as xe } from "./loading-jZV2Dm--.js";
27
- import { w as Pe } from "./xlsx--s3hBdDk.js";
28
- import { useRouter as ke } from "vue-router";
29
- import { t as te } from "./index-D_1pnadB.js";
30
- import { R as X } from "./app-CqQeNnGq.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-IkiKiNg1.js";
34
- import { m as Ve } from "./index-CWGbeg5X.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
- ], f = k({
509
- search: "",
510
- "pf_collectible.type": [],
511
- "metadata.location": [],
512
- dateRange: {
513
- startDate: P().subtract(7, "day").toISOString(),
514
- endDate: P().endOf("day").toISOString()
515
- },
516
- source: []
517
- }), v = () => ({
518
- ...f.value,
519
- user: T.user,
520
- dateRange: {
521
- start: new Date(f.value.dateRange.startDate).toISOString(),
522
- end: new Date(f.value.dateRange.endDate).toISOString()
523
- }
524
- }), {
525
- tableMeta: r,
526
- rowData: x,
527
- onSort: h,
528
- debouncedFetchData: p,
529
- resetCursorState: a
530
- } = Oe(async (t) => {
531
- const s = await te.readAllCursor(
532
- t,
533
- v()
534
- );
535
- return {
536
- resources: s.resources.map((w) => {
537
- const _ = o.value.find((y) => y._id === w.ref);
538
- return { ...w, ref: (_ == null ? void 0 : _.seqNumber) || w.ref };
539
- }),
540
- meta: s.meta
541
- };
542
- }), o = k([]), b = pe.options.map((t) => ({ label: J(E.getReason(t)), value: t })), e = O(
543
- () => u.locations.map((t) => ({ label: t.name, value: t._id }))
544
- );
545
- de(
546
- f,
547
- () => {
548
- a(), p({ pageIndex: 0 });
549
- },
550
- { deep: !0 }
551
- );
552
- async function n() {
553
- try {
554
- N.value = !0;
555
- const t = new ze(), s = v(), w = 1e3;
556
- await M(
557
- async () => {
558
- var z, G, q, H, ce, ue;
559
- let _, y = !0;
560
- for (; y; ) {
561
- const Q = await te.readAllCursor(
562
- {
563
- limit: w,
564
- sortBy: "_id",
565
- descending: !1,
566
- ..._ ? { cursor: _ } : {}
567
- },
568
- s
569
- );
570
- if (!Q.resources.length)
571
- break;
572
- for (const $ of Q.resources)
573
- t.addRecord({
574
- TransactionID: $._id,
575
- CreatedAt: P(Y($._id.toString())).format(
576
- "D MMM YYYY, hh:mmA"
577
- ),
578
- Amount: L(
579
- $.expiryAmount.reduce(
580
- (_e, Te) => _e + Te.amount,
581
- $.amount ?? 0
582
- ),
583
- 2
584
- ),
585
- 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(
586
- "D MMM YYYY"
587
- ) : "",
588
- Type: E.formattedType($),
589
- Source: J(E.getReason($.source)),
590
- User: ((ce = $.pf_user) == null ? void 0 : ce.name) || "",
591
- "Phone No.": ((ue = $.pf_user) == null ? void 0 : ue.phoneNumber) || "",
592
- References: $.ref,
593
- Remark: E.formattedRemark($)
594
- });
595
- _ = Q.meta.nextCursor ?? void 0, y = Q.meta.hasNext && !!_;
596
- }
597
- await Pe(
598
- t.buildExcel(),
599
- `transactions-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
600
- {
601
- bookType: "xlsx",
602
- bookSST: !1,
603
- type: "array"
604
- }
605
- );
606
- },
607
- {
608
- message: "Exporting transactions...",
609
- successMessage: "transactions exported successfully"
610
- }
611
- );
612
- } catch (t) {
613
- console.error(t);
614
- } finally {
615
- N.value = !1;
616
- }
617
- }
618
- const i = k(null);
619
- function F(t) {
620
- var s;
621
- console.log(t), (s = i.value) == null || s.showSheet(!0, t.original);
622
- }
623
- return Re(async () => {
624
- await u.readLocations(), await m.read(), await p();
625
- }), (t, s) => {
626
- const w = U("FmSearch"), _ = U("FmButton");
627
- return A(), V(j, null, [
628
- S("div", null, [
629
- S("div", qe, [
630
- D(w, {
631
- class: "hidden xs:!flex border-b border-fm-color-neutral-gray-100",
632
- modelValue: l(f).search,
633
- "onUpdate:modelValue": s[0] || (s[0] = (y) => l(f).search = y),
634
- placeholder: "Search",
635
- collapsible: ""
636
- }, null, 8, ["modelValue"]),
637
- D(_, {
638
- icon: "ios_share",
639
- variant: "tertiary",
640
- onClick: n
641
- })
642
- ]),
643
- S("div", He, [
644
- S("div", Qe, [
645
- D(re, {
646
- class: "cursor-pointer text-fm-color-neutral-gray-400",
647
- "right-icon": "keyboard_arrow_down",
648
- modelValue: l(f)["metadata.location"],
649
- "onUpdate:modelValue": s[1] || (s[1] = (y) => l(f)["metadata.location"] = y),
650
- icon: "storefront",
651
- "show-item-label": !0,
652
- items: l(e)
653
- }, null, 8, ["modelValue", "items"]),
654
- D(re, {
655
- class: "cursor-pointer text-fm-color-neutral-gray-400",
656
- "right-icon": "keyboard_arrow_down",
657
- modelValue: l(f)["pf_collectible.type"],
658
- "onUpdate:modelValue": s[2] || (s[2] = (y) => l(f)["pf_collectible.type"] = y),
659
- label: "Type: ",
660
- "show-item-label": !0,
661
- items: [
662
- { label: "Point", value: "COIN" },
663
- { label: "Credit", value: "CREDIT" },
664
- { label: "Voucher", value: "VOUCHER" },
665
- { label: "Experience", value: "POINT" },
666
- { label: "Tier", value: "TIER" },
667
- { label: "Title", value: "TITLE" },
668
- { label: "Game", value: "GAME" },
669
- { label: "Stamp", value: "STAMP" }
670
- ]
671
- }, null, 8, ["modelValue"]),
672
- D(re, {
673
- class: "cursor-pointer text-fm-color-neutral-gray-400",
674
- "right-icon": "keyboard_arrow_down",
675
- modelValue: l(f).source,
676
- "onUpdate:modelValue": s[3] || (s[3] = (y) => l(f).source = y),
677
- label: "Source: ",
678
- "show-item-label": !0,
679
- items: l(b)
680
- }, null, 8, ["modelValue", "items"]),
681
- D(fe, {
682
- "model-value": {
683
- startDate: l(f).dateRange.startDate,
684
- endDate: l(f).dateRange.endDate
685
- },
686
- "onUpdate:modelValue": s[4] || (s[4] = (y) => l(f).dateRange = {
687
- startDate: l(P)(y.startDate).startOf("d").toISOString(),
688
- endDate: l(P)(y.endDate).endOf("d").toISOString()
689
- })
690
- }, null, 8, ["model-value"])
691
- ]),
692
- D(w, {
693
- class: "xs:hidden",
694
- modelValue: l(f).search,
695
- "onUpdate:modelValue": s[5] || (s[5] = (y) => l(f).search = y),
696
- placeholder: "Search",
697
- collapsible: ""
698
- }, null, 8, ["modelValue"]),
699
- S("div", Xe, [
700
- D(_, {
701
- icon: "ios_share",
702
- variant: "tertiary",
703
- onClick: n
704
- })
705
- ])
706
- ]),
707
- D(ye, {
708
- loading: l(r).isLoading,
709
- "row-data": l(x),
710
- "row-count": l(r).totalRows,
711
- "column-defs": I.filter(
712
- (y) => !T.user || y.header !== "User" && y.header !== "Phone No."
713
- ),
714
- "page-count": l(r).pageCount,
715
- "page-index": l(r).pageIndex,
716
- "page-size": l(r).pageSize,
717
- "shrink-at": !1,
718
- "pagination-mode": "cursor",
719
- "has-next": l(r).hasNext,
720
- onSortChange: l(h),
721
- onPageChange: s[6] || (s[6] = (y) => l(p)({
722
- pageSize: y.pageSize,
723
- pageIndex: y.pageIndex
724
- })),
725
- onRowClick: F
726
- }, null, 8, ["loading", "row-data", "row-count", "column-defs", "page-count", "page-index", "page-size", "has-next", "onSortChange"])
727
- ]),
728
- D(We, {
729
- ref_key: "transactionDetailSheet",
730
- ref: i
731
- }, null, 512)
732
- ], 64);
733
- };
734
- }
735
- });
736
- class Je extends he {
737
- }
738
- function ae(d) {
739
- return d.quantity ?? 1;
740
- }
741
- function Se(d, g) {
742
- var u, m;
743
- switch ((u = d.paymentType) == null ? void 0 : u.type) {
744
- case "COIN":
745
- return g("connect.store.paymentType.point");
746
- case "CARD":
747
- return g("connect.store.paymentType.cardActivation");
748
- default:
749
- return ((m = d.paymentType) == null ? void 0 : m.type) ?? g("connect.store.paymentType.notAvailable");
750
- }
751
- }
752
- function W(d, g) {
753
- return $e({
754
- ...g,
755
- amount: g.amount * ae(d)
756
- });
757
- }
758
- function le(d) {
759
- var g;
760
- if (((g = d.paymentType) == null ? void 0 : g.type) === "COIN") {
761
- if (d.bundle.coinPrice == null) return "N/A";
762
- const u = d.bundle.coinPrice * ae(d);
763
- return `${L(u, 2, !0)} points`;
764
- }
765
- return W(
766
- d,
767
- d.bundle.priceWithTaxes ?? d.bundle.price
768
- );
769
- }
770
- function Ze(d) {
771
- return W(
772
- d,
773
- d.bundle.originalPrice ?? d.bundle.price
774
- );
775
- }
776
- function et(d) {
777
- const [g, ...u] = d.bundle.taxTotals ?? [];
778
- if (!g) return null;
779
- const m = u.reduce(
780
- (R, T) => R + T.total.amount,
781
- g.total.amount
782
- );
783
- return W(d, {
784
- ...g.total,
785
- amount: m
786
- });
787
- }
788
- const tt = { class: "space-y-24 pr-12" }, at = { class: "fm-typo-en-title-sm-800 mb-16" }, ot = {
789
- key: 0,
790
- class: "space-y-16"
791
- }, nt = { class: "fm-typo-en-body-lg-600" }, rt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary break-words" }, st = {
792
- key: 1,
793
- class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
794
- }, lt = /* @__PURE__ */ oe({
795
- __name: "StoreTransactionDetailSheet",
796
- setup(d, { expose: g }) {
797
- const u = k(!1), m = k(null), { t: R } = ne();
798
- function T(a, o) {
799
- u.value = a, m.value = o ?? null;
800
- }
801
- function N(a) {
802
- if (!a.location) return "Online Store";
803
- const o = Array.isArray(a.pf_location) ? a.pf_location[0] : a.pf_location;
804
- return (o == null ? void 0 : o.name) ?? a.location.toString();
805
- }
806
- function M(a) {
807
- return Array.isArray(a) ? a.flatMap((o) => typeof o != "object" || o === null || !("name" in o) || typeof o.name != "string" ? [] : [o.name]) : [];
808
- }
809
- function I(a, o, b, e) {
810
- if (a.length === o)
811
- return a.map((i) => b > 1 ? `${i} × ${b}` : i).join(", ");
812
- const n = o * b;
813
- return `${n} ${e}${n === 1 ? "" : "s"}`;
814
- }
815
- const f = O(() => {
816
- var e, n, i;
817
- const a = m.value;
818
- if (!a) return [];
819
- const o = a.pf_member, b = Se(a, R);
820
- return [
821
- { label: "Transaction ID", value: a._id.toString() },
822
- {
823
- label: "Date/Time",
824
- value: P(Y(a._id.toString())).format(
825
- "D MMM YYYY, hh:mmA"
826
- )
827
- },
828
- {
829
- label: "Status",
830
- value: K.title(a.refund ? "REFUNDED" : a.status)
831
- },
832
- {
833
- label: "Customer",
834
- value: (o == null ? void 0 : o.name) ?? (o == null ? void 0 : o.email) ?? (o == null ? void 0 : o.phoneNumber) ?? "Unknown"
835
- },
836
- { label: "Location", value: N(a) },
837
- {
838
- label: "Payment Type",
839
- 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)
840
- },
841
- { label: "Reference", value: a.ref || "N/A" },
842
- ...a.paymentRef ? [{ label: "Payment Reference", value: a.paymentRef }] : [],
843
- {
844
- label: "Quantity",
845
- value: ae(a).toString()
846
- }
847
- ];
848
- }), v = O(() => {
849
- const a = m.value;
850
- return a ? [
851
- { label: "Bundle Name", value: a.bundle.name },
852
- {
853
- label: "Bundle Value",
854
- value: Ze(a)
855
- },
856
- {
857
- label: "Base Subtotal",
858
- value: W(a, a.bundle.price)
859
- },
860
- {
861
- label: "Selling Price",
862
- value: le(a)
863
- }
864
- ] : [];
865
- }), r = O(() => {
866
- var n;
867
- const a = m.value;
868
- if (!a) return [];
869
- const { bundle: o } = a, b = ae(a), e = [];
870
- if (o.credit.normal > 0 && e.push({
871
- label: "Credit",
872
- value: `${L(
873
- o.credit.normal * b,
874
- 2,
875
- !0
876
- )} credits`
877
- }), (n = o.credit.free) != null && n.amount) {
878
- const i = `${o.credit.free.day} day${o.credit.free.day === 1 ? "" : "s"}`;
879
- e.push({
880
- label: "Free Credit",
881
- value: `${L(
882
- o.credit.free.amount * b,
883
- 2,
884
- !0
885
- )} credits (${i})`
886
- });
887
- }
888
- return o.vouchers.length > 0 && e.push({
889
- label: "Vouchers",
890
- value: I(
891
- M(o.pf_vouchers),
892
- o.vouchers.length,
893
- b,
894
- "voucher"
895
- )
896
- }), o.titles.length > 0 && e.push({
897
- label: "Titles",
898
- value: I(
899
- M(o.pf_titles),
900
- o.titles.length,
901
- b,
902
- "title"
903
- )
904
- }), e;
905
- }), x = O(() => {
906
- const a = m.value;
907
- if (!a) return [];
908
- const o = (a.bundle.taxTotals ?? []).map((e) => {
909
- var i;
910
- const n = (i = a.bundle._inclusiveTaxes) == null ? void 0 : i.some(
911
- (F) => F.systemCode === e.systemCode && F.inclusive
912
- );
913
- return {
914
- label: `${e.name} (${De(e.rate)}%, ${n ? "Inclusive" : "Exclusive"})`,
915
- value: W(a, e.total)
916
- };
917
- }), b = et(a);
918
- return b ? [...o, { label: "Tax Total", value: b }] : o;
919
- }), h = O(() => {
920
- var o;
921
- const a = (o = m.value) == null ? void 0 : o.giftCard;
922
- return a ? [
923
- { label: "Movement", value: K.title(a.movement) },
924
- {
925
- label: "Serial Number",
926
- value: a.serialNumber ?? (a.movement === "PURCHASE" ? "Pending card issuance" : "Not available")
927
- }
928
- ] : [];
929
- }), p = O(() => [
930
- { title: "Transaction", items: f.value },
931
- { title: "Bundle & Pricing", items: v.value },
932
- { title: "Rewards", items: r.value, emptyText: "No rewards" },
933
- { title: "Taxes", items: x.value, emptyText: "No taxes" },
934
- ...h.value.length ? [{ title: "Gift Card", items: h.value }] : []
935
- ]);
936
- return g({ showSheet: T }), (a, o) => {
937
- const b = U("FmButton"), e = U("FmSideSheet");
938
- return A(), se(e, {
939
- modelValue: l(u),
940
- "onUpdate:modelValue": o[1] || (o[1] = (n) => me(u) ? u.value = n : null),
941
- "max-width": 560,
942
- header: "Store Transaction Details"
943
- }, {
944
- "side-sheet-footer": Z(() => [
945
- D(b, {
946
- label: "Close",
947
- variant: "tertiary",
948
- onClick: o[0] || (o[0] = (n) => T(!1))
949
- })
950
- ]),
951
- default: Z(() => [
952
- S("div", tt, [
953
- (A(!0), V(j, null, ee(l(p), (n) => (A(), V("section", {
954
- key: n.title
955
- }, [
956
- S("h3", at, B(n.title), 1),
957
- n.items.length ? (A(), V("div", ot, [
958
- (A(!0), V(j, null, ee(n.items, (i) => (A(), V("div", {
959
- key: i.label,
960
- class: "flex flex-col gap-4"
961
- }, [
962
- S("div", nt, B(i.label), 1),
963
- S("div", rt, B(i.value), 1),
964
- o[2] || (o[2] = S("hr", { class: "mt-3 border-fm-color-neutral-gray-100" }, null, -1))
965
- ]))), 128))
966
- ])) : (A(), V("div", st, B(n.emptyText), 1))
967
- ]))), 128))
968
- ])
969
- ]),
970
- _: 1
971
- }, 8, ["modelValue"]);
972
- };
973
- }
974
- }), 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({
975
- __name: "StoreTransactions",
976
- props: {
977
- user: {
978
- type: String
979
- }
980
- },
981
- setup(d) {
982
- const g = d, { minor: u } = xe, { t: m } = ne();
983
- function R(e) {
984
- return Se(e, m);
985
- }
986
- function T(e) {
987
- return P(Y(e._id.toString())).format(
988
- "D MMM YYYY, hh:mmA"
989
- );
990
- }
991
- function N(e) {
992
- var n, i;
993
- return e.location ? ((i = (n = e.pf_location) == null ? void 0 : n[0]) == null ? void 0 : i.name) ?? e.location.toString() : "Online Store";
994
- }
995
- const M = [
996
- {
997
- header: "Transaction ID",
998
- meta: {
999
- maxWidth: "150px"
1000
- },
1001
- cell(e) {
1002
- return c("div", { class: "flex items-center" }, [
1003
- c(C.FmIcon, {
1004
- name: "content_copy",
1005
- outline: !0,
1006
- size: "sm",
1007
- class: "cursor-pointer mr-4 shrink-0",
1008
- onClick: (n) => {
1009
- n.preventDefault(), n.stopPropagation(), ie(e.row.original._id.toString());
1010
- }
1011
- }),
1012
- c("div", { class: "truncate" }, e.row.original._id.toString())
1013
- ]);
1014
- }
1015
- },
1016
- {
1017
- header: "Created at",
1018
- accessorFn: T,
1019
- enableSorting: !0
1020
- },
1021
- {
1022
- header: "Bundle",
1023
- accessorFn: (e) => e.bundle.name
1024
- },
1025
- {
1026
- header: "Selling Price",
1027
- cell: (e) => le(e.row.original)
1028
- },
1029
- {
1030
- header: "Location",
1031
- accessorFn: N
1032
- },
1033
- {
1034
- header: "Payment Type",
1035
- accessorFn: R,
1036
- cell(e) {
1037
- var n;
1038
- return c("div", { class: "flex items-center gap-4" }, [
1039
- c("div", { class: "flex items-center" }, [
1040
- ((n = e.row.original.paymentType) == null ? void 0 : n.type) == "ONLINE" && e.row.original.paymentType.extra ? c(
1041
- C.FmTooltip,
1042
- {
1043
- content: e.row.original.paymentType.extra
1044
- },
1045
- [
1046
- c(C.FmIcon, {
1047
- name: "info",
1048
- outline: !0,
1049
- size: "sm"
1050
- })
1051
- ]
1052
- ) : c("div")
1053
- ]),
1054
- c("div", { class: "flex-1" }, R(e.row.original))
1055
- ]);
1056
- }
1057
- },
1058
- {
1059
- header: "User",
1060
- cell: (e) => ve(e.row.original.pf_member)
1061
- },
1062
- {
1063
- header: "Phone No.",
1064
- accessorFn: (e) => e.pf_member.phoneNumber
1065
- },
1066
- {
1067
- header: "Status",
1068
- // accessorFn: (u) => u.status,
1069
- cell(e) {
1070
- var F, t, s, w;
1071
- const n = e.row.original.status, i = {
1072
- COMPLETED: "text-fm-color-typo-success bg-fm-color-system-success-100",
1073
- REFUNDED: "text-fm-color-typo-warning bg-fm-color-system-warning-100"
1074
- };
1075
- return c("div", { class: "flex items-center gap-4" }, [
1076
- c(C.FmChip, {
1077
- label: K.title(n),
1078
- variant: "plain",
1079
- class: i[n] ?? ""
1080
- }),
1081
- (t = (F = e.row.original) == null ? void 0 : F.refund) != null && t.reason ? c(
1082
- C.FmTooltip,
1083
- {
1084
- content: (w = (s = e.row.original) == null ? void 0 : s.refund) == null ? void 0 : w.reason
1085
- },
1086
- [
1087
- c(C.FmIcon, {
1088
- name: "info",
1089
- color: "primary",
1090
- outline: !0,
1091
- size: "sm"
1092
- })
1093
- ]
1094
- ) : null
1095
- ]);
1096
- }
1097
- },
1098
- {
1099
- header: "Source",
1100
- accessorFn: (e) => e.source
1101
- },
1102
- {
1103
- header: "Ref",
1104
- accessorFn: (e) => e.ref
1105
- },
1106
- {
1107
- id: "action",
1108
- cell(e) {
1109
- const n = e.row.original, i = n.status === "COMPLETED" && !n.refund && n.source == "ADMIN";
1110
- return i ? c(
1111
- C.FmMenu,
1112
- {
1113
- placement: "bottom-end",
1114
- onClick: (F) => {
1115
- F.stopPropagation();
1116
- }
1117
- },
1118
- {
1119
- "menu-button": () => c(C.FmButton, {
1120
- icon: "settings",
1121
- variant: "tertiary",
1122
- if: i
1123
- }),
1124
- default: () => [
1125
- c(C.FmMenuItem, {
1126
- label: "Refund",
1127
- sublabel: "Refund this transaction",
1128
- onClick: async (F) => {
1129
- F.stopPropagation(), await p(n);
1130
- }
1131
- })
1132
- ]
1133
- }
1134
- ) : c("div");
1135
- }
1136
- }
1137
- ], I = k({
1138
- searchValue: "",
1139
- dateRange: {
1140
- startDate: P().subtract(7, "day").toISOString(),
1141
- endDate: P().toISOString()
1142
- }
1143
- }), { tableMeta: f, rowData: v, onSort: r, debouncedFetchData: x, onSearch: h } = Fe(async (e) => {
1144
- const n = {
1145
- ...I.value.dateRange,
1146
- user: g.user
1147
- };
1148
- return await te.readStoreTransactions(e, n);
1149
- });
1150
- async function p(e) {
1151
- await Ne.confirm(
1152
- "Are you sure you want to refund this transaction?",
1153
- "Refund Store Transaction",
1154
- "Confirm",
1155
- "Cancel"
1156
- ) && await u(
1157
- async () => {
1158
- var i;
1159
- await Ve.refundStoreTransaction({
1160
- id: e._id,
1161
- reason: `ADMIN:${(i = Me().sessionUser) == null ? void 0 : i.name}`
1162
- }), await x();
1163
- },
1164
- {
1165
- message: "Refunding transaction...",
1166
- successMessage: "Transaction refunded successfully"
1167
- }
1168
- );
1169
- }
1170
- de(
1171
- I,
1172
- () => {
1173
- x();
1174
- },
1175
- { deep: !0 }
1176
- ), Ie(async () => {
1177
- await x();
1178
- });
1179
- const a = async () => Ae({
1180
- exporter: new Je(),
1181
- readFunction: (e) => te.readStoreTransactions(e, {
1182
- ...I.value.dateRange,
1183
- user: g.user
1184
- }),
1185
- transformRecord: (e) => {
1186
- var n, i, F, t;
1187
- return {
1188
- "Transaction ID": e._id.toString(),
1189
- "Created at": T(e),
1190
- Bundle: e.bundle.name || "",
1191
- "Selling Price": le(e),
1192
- Location: N(e),
1193
- "Payment Type": R(e),
1194
- "Payment Extra": ((n = e.paymentType) == null ? void 0 : n.extra) || "",
1195
- User: ((i = e.pf_member) == null ? void 0 : i.name) || "",
1196
- "Phone No.": ((F = e.pf_member) == null ? void 0 : F.phoneNumber) || "",
1197
- Status: K.title(e.status),
1198
- "Refund Reason": ((t = e.refund) == null ? void 0 : t.reason) || "",
1199
- Source: e.source,
1200
- Ref: (e == null ? void 0 : e.ref) || ""
1201
- };
1202
- },
1203
- filename: "store-transactions"
1204
- }), o = k(null);
1205
- function b(e) {
1206
- var n;
1207
- (n = o.value) == null || n.showSheet(!0, e.original);
1208
- }
1209
- return (e, n) => {
1210
- const i = U("FmSearch"), F = U("FmButton");
1211
- return A(), V("div", null, [
1212
- S("div", it, [
1213
- S("div", ct, [
1214
- D(fe, {
1215
- modelValue: l(I).dateRange,
1216
- "onUpdate:modelValue": n[0] || (n[0] = (t) => l(I).dateRange = t)
1217
- }, null, 8, ["modelValue"])
1218
- ]),
1219
- S("div", ut, [
1220
- D(i, {
1221
- modelValue: l(f).searchValue,
1222
- "onUpdate:modelValue": [
1223
- n[1] || (n[1] = (t) => l(f).searchValue = t),
1224
- l(h)
1225
- ],
1226
- placeholder: "Search",
1227
- collapsible: ""
1228
- }, null, 8, ["modelValue", "onUpdate:modelValue"]),
1229
- D(F, {
1230
- icon: "ios_share",
1231
- variant: "tertiary",
1232
- onClick: a
1233
- })
1234
- ])
1235
- ]),
1236
- D(ye, {
1237
- loading: l(f).isLoading,
1238
- "row-data": l(v),
1239
- "row-count": l(f).totalRows,
1240
- "column-defs": M.filter(
1241
- (t) => !g.user || t.header !== "User" && t.header !== "Phone No."
1242
- ),
1243
- "page-count": l(f).pageCount,
1244
- "page-index": l(f).pageIndex,
1245
- "page-size": l(f).pageSize,
1246
- "shrink-at": !1,
1247
- onSortChange: l(r),
1248
- onRowClick: b,
1249
- onPageChange: n[2] || (n[2] = (t) => l(x)({
1250
- pageSize: t.pageSize,
1251
- pageIndex: t.pageIndex
1252
- }))
1253
- }, null, 8, ["loading", "row-data", "row-count", "column-defs", "page-count", "page-index", "page-size", "onSortChange"]),
1254
- D(lt, {
1255
- ref_key: "transactionDetailSheet",
1256
- ref: o
1257
- }, null, 512)
1258
- ]);
1259
- };
1260
- }
1261
- });
1262
- export {
1263
- Kt as _,
1264
- jt as a
1265
- };