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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/dist/{App-C7BnLHSt.js → App-DMh2xABv.js} +493 -502
  2. package/dist/{Bin-Bq7yY0I2.js → Bin-C_pkPgIo.js} +8 -8
  3. package/dist/{Broadcast-D52rPmVl.js → Broadcast-6ZJzdY0b.js} +21 -22
  4. package/dist/{CampaignAnalytic-DpiWtzIp.js → CampaignAnalytic-CLd5ecQe.js} +7 -7
  5. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-B1eAAN64.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-C4OWhhAx.js} +9 -8
  6. package/dist/{Card-BQc7vud2.js → Card-CkS8F43U.js} +22 -22
  7. package/dist/{Collections--VzkneGp.js → Collections-BA9I-dDz.js} +185 -197
  8. package/dist/{Credit-DhfAcw-p.js → Credit-CXm0A-qe.js} +20 -21
  9. package/dist/{DateRangeChip.vue_vue_type_script_setup_true_lang-D2Csdg-3.js → DateRangeChip.vue_vue_type_script_setup_true_lang-DzsHTlrN.js} +1 -1
  10. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-C5INV6R7.js +3493 -0
  11. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-Cr2_XbyY.js → EffectSheet.vue_vue_type_style_index_0_lang-zSPUBUSz.js} +16 -16
  12. package/dist/{Experience-CUwbHfo5.js → Experience-Bq4ykqTJ.js} +31 -32
  13. package/dist/{FileSaver.min-DvZpiwMd.js → FileSaver.min-BtBxrIBi.js} +1 -1
  14. package/dist/{Game-CI5-y0JJ.js → Game-DpLFmP-G.js} +18 -19
  15. package/dist/{GiftCardSetup-CGacqQ0j.js → GiftCardSetup-BqOqEUim.js} +31 -31
  16. package/dist/{GoalPickerPanel.vue_vue_type_script_setup_true_lang-B6POxDLJ.js → GoalPickerPanel.vue_vue_type_script_setup_true_lang-B06xj5q7.js} +7 -7
  17. package/dist/{Goals-fqJY9iMx.js → Goals-DMlNeiUc.js} +4 -4
  18. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-DTKf7uR-.js → ImageInput.vue_vue_type_script_setup_true_lang-DPWRgxG_.js} +1 -1
  19. package/dist/{Index-CT1Gnjsv.js → Index-Cw07jj0k.js} +10 -10
  20. package/dist/{LocationPicker.vue_vue_type_script_setup_true_lang-BRQ12Yum.js → LocationPicker.vue_vue_type_script_setup_true_lang-CLjjquVP.js} +1 -1
  21. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-BRzuWJ1Y.js → LottieAnimation.vue_vue_type_script_setup_true_lang-DHOShJQp.js} +1 -1
  22. package/dist/{LoyaltyDashboard-IJIDEBWf.js → LoyaltyDashboard-DzSiK6M7.js} +15 -15
  23. package/dist/{MainLayout-BMghr-wf.js → MainLayout-1EF680_j.js} +1 -1
  24. package/dist/{MainLayout.vue_vue_type_script_setup_true_lang-BitJKgvd.js → MainLayout.vue_vue_type_script_setup_true_lang-Df9pBgH9.js} +3 -3
  25. package/dist/{Marketing-Ckr9cp3w.js → Marketing-T-epFsvG.js} +4 -4
  26. package/dist/{MarketingMaterialEdit-BIZnE8CY.js → MarketingMaterialEdit-CVhPfyEp.js} +211 -214
  27. package/dist/{Member-d1nPxr74.js → Member-BUZOPyQR.js} +7 -7
  28. package/dist/MemberDetailSheet.vue_vue_type_script_setup_true_lang-zURjtl1z.js +1308 -0
  29. package/dist/{MemberImportHistory-CxX9iYhV.js → MemberImportHistory-DGz9i6L7.js} +7 -7
  30. package/dist/{MemberList-DUzYpxhj.js → MemberList-CNdSrzBa.js} +105 -103
  31. package/dist/{MemberTransactions-BFM3ybeo.js → MemberTransactions-CdQMuQsd.js} +1 -1
  32. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-B5j0YBix.js → MessageInput.vue_vue_type_script_setup_true_lang-CWKVXeCa.js} +12 -12
  33. package/dist/{MetricInfoTooltip.vue_vue_type_script_setup_true_lang-DsSHSbBB.js → MetricInfoTooltip.vue_vue_type_script_setup_true_lang-xZitIoXE.js} +1 -1
  34. package/dist/{Mission-De9BF5wb.js → Mission-CYxgMBPt.js} +21 -22
  35. package/dist/{Overview-Pmxqv6qp.js → Overview-DSm8AfDB.js} +20 -20
  36. package/dist/{Overview-DeHo3gef.js → Overview-qZ1KKw9D.js} +144 -145
  37. package/dist/{Point-DE_Cc85N.js → Point-BGlbT9OK.js} +21 -22
  38. package/dist/{Promotion-cZDzgho4.js → Promotion-CtlrUFa8.js} +131 -137
  39. package/dist/{Queue-DmDbrtTk.js → Queue-Dc_z9MKc.js} +45 -45
  40. package/dist/{Record-uxNNOvmK.js → Record-DVKrhFwJ.js} +9 -9
  41. package/dist/{Review-CIIn_Bdx.js → Review-Bh8Tw_QU.js} +2 -2
  42. package/dist/ReviewFacebookCallback-ZZ0pxplM.js +238 -0
  43. package/dist/{ReviewGoogleCallback-B7kmGwb_.js → ReviewGoogleCallback-CsSCz_C5.js} +5 -5
  44. package/dist/{Reward-Bj1snFu8.js → Reward-DY1Q3m1w.js} +16 -16
  45. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-BO-36dE4.js → RewardGroup.vue_vue_type_script_setup_true_lang-4A91EkSW.js} +13 -13
  46. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-JA0XIgqb.js +1884 -0
  47. package/dist/{Segment-BgJgWa6C.js → Segment-D6LchJFl.js} +306 -303
  48. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-D2TDoZgQ.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-CSAtkMnJ.js} +14 -14
  49. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-CEBH11hR.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-Co1MQoVq.js} +4 -4
  50. package/dist/Setting-UkdSKiUb.js +578 -0
  51. package/dist/{SettingAdvertisements-vdUtIXwC.js → SettingAdvertisements-DK97gcus.js} +12 -12
  52. package/dist/Settings-BFcVswDS.js +179 -0
  53. package/dist/{Store-DgltT0RA.js → Store-2VVStL5_.js} +28 -28
  54. package/dist/{StoreRewards-BXH_5cYL.js → StoreRewards-f3Pyb9hu.js} +15 -15
  55. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-BmnyPSVT.js +1297 -0
  56. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-CCWNzg4p.js +142 -0
  57. package/dist/{Tier-CqfHGUX0.js → Tier-D4Of9P17.js} +687 -2575
  58. package/dist/{Title-B5VnUNiS.js → Title-Cg6X9UkB.js} +94 -95
  59. package/dist/{Transaction-BZh1Q9Lj.js → Transaction-LJbjQnj_.js} +2 -2
  60. package/dist/Upselling-B-VwbtjT.js +214 -0
  61. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-Buj7CRlQ.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-DqH6Upx-.js} +26 -26
  62. package/dist/{Voucher-CZJdV2Ok.js → Voucher-BJG6VKXt.js} +19 -19
  63. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-65x2VrpD.js → VoucherEditor.vue_vue_type_script_setup_true_lang-7kYeJthi.js} +12 -12
  64. package/dist/{WhatsappAccount-DsRilNC5.js → WhatsappAccount-Dc1fJWWj.js} +6 -6
  65. package/dist/{WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-Bn26qwx5.js → WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-BV0Bsl7a.js} +1 -1
  66. package/dist/{WhatsappBot-CpzMaTss.js → WhatsappBot-Coq1WP96.js} +6 -6
  67. package/dist/{WhatsappBotLogs-DRF8VufQ.js → WhatsappBotLogs-EH9PQVn9.js} +6 -6
  68. package/dist/{WhatsappBotSettings-DSUPGC-p.js → WhatsappBotSettings-fNRFecJX.js} +4 -4
  69. package/dist/{WhatsappLayout-BCWYcQmD.js → WhatsappLayout-x9Ovpu6e.js} +3 -3
  70. package/dist/{WhatsappNotificationGroupDialog.vue_vue_type_script_setup_true_lang-DyxyISRP.js → WhatsappNotificationGroupDialog.vue_vue_type_script_setup_true_lang-DZlT0uLW.js} +3 -3
  71. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-Db-Z7cY_.js → ZodTextField.vue_vue_type_script_setup_true_lang-DSJncfI_.js} +2 -2
  72. package/dist/{app-BQeODViN.js → app-BMFxxLUm.js} +15017 -14861
  73. package/dist/app.js +3 -4
  74. package/dist/{base.export-kSFLDDoC.js → base.export-LmQ51u5f.js} +2 -2
  75. package/dist/{business-EP-Do3Ew.js → business-DZWViiMC.js} +1 -1
  76. package/dist/{campaign-BjnUPowX.js → campaign-C9xvGyrL.js} +28 -34
  77. package/dist/{campaign-C8GgaCub.js → campaign-DZDGbR4W.js} +94 -121
  78. package/dist/{campaign.enum-Dx-Zo68Q.js → campaign.enum-BqekIiiN.js} +1 -2
  79. package/dist/{campaign.fn-DQ--gL4B.js → campaign.fn-OVkj0QLu.js} +87 -87
  80. package/dist/{collection.fn-BhXecwh5.js → collection.fn-DrNrla0B.js} +2 -2
  81. package/dist/{currency-CGMNh1Q_.js → currency-BZv2gSlF.js} +1 -1
  82. package/dist/{effect-Bc6oGIWd.js → effect-CvumfBMY.js} +1 -1
  83. package/dist/{email-addresses-B3KWfUMk.js → email-addresses-79tPeI4j.js} +25 -25
  84. package/dist/{feature-flag-HhjvSuDm.js → feature-flag-CYXnrECh.js} +185 -171
  85. package/dist/google-C3S8u0mT.js +4 -0
  86. package/dist/{helper-D1BYvcED.js → helper-DFjsyjri.js} +1 -1
  87. package/dist/{index-GQv1_jaJ.js → index-B_8PAyia.js} +2 -2
  88. package/dist/{index-C-46QHFh.js → index-Ba1t5vQv.js} +234 -380
  89. package/dist/{index-Yw4M7v7m.js → index-BiPRZRyE.js} +2614 -2699
  90. package/dist/{index-BkevK_Hp.js → index-Bnane9cm.js} +1 -1
  91. package/dist/{index-VLFerh-X.js → index-Bt-n8QuD.js} +10 -10
  92. package/dist/{index-VyoufKYY.js → index-C-pVo6PI.js} +1 -1
  93. package/dist/{index-CsYTLmPa.js → index-C43KoLej.js} +4 -4
  94. package/dist/{index-DeqpfWLa.js → index-C5bC2n8X.js} +3 -3
  95. package/dist/{index-Br2SLVsn.js → index-C6Rx7pjc.js} +251 -608
  96. package/dist/{index-BIBcfAw5.js → index-C6ZTa-eq.js} +1 -1
  97. package/dist/{index-gMrtUwSD.js → index-CA7oIW_T.js} +316 -316
  98. package/dist/{index-Bunp1bt_.js → index-CAWnce4u.js} +1 -1
  99. package/dist/{index-cPPWotJe.js → index-CBd91xYU.js} +10 -10
  100. package/dist/{index-C3MK8Twg.js → index-CNzQ3FLi.js} +1 -1
  101. package/dist/{index-Ptcqv0W6.js → index-CW4rNV1_.js} +2 -2
  102. package/dist/{index-DOSuhtdE.js → index-CcCiEG6N.js} +1 -1
  103. package/dist/{index-DiCgGQoC.js → index-DWZzsJHU.js} +2 -2
  104. package/dist/{index-oIo5Cful.js → index-DZrX13oF.js} +462 -533
  105. package/dist/{index-D2TnjKPP.js → index-MhAbTpBy.js} +23 -23
  106. package/dist/{index-DCC3pLug.js → index-_-nCOZ1D.js} +6 -19
  107. package/dist/{index.esm2017-DUZpLdEB.js → index.esm2017-DtTjnHHc.js} +57 -57
  108. package/dist/{loading-DhpcQgdj.js → loading-DkqEFbrR.js} +1 -1
  109. package/dist/{lodash-r4AR7GJC.js → lodash-BxU_5gPB.js} +1 -1
  110. package/dist/{member-import-CogEef9H.js → member-import-B3NBqSF6.js} +1 -1
  111. package/dist/{membership-BQFkjRjs.js → membership-Dr5BxoL-.js} +2 -2
  112. package/dist/{money-Ifqd4pyC.js → money-D58xuACG.js} +1 -1
  113. package/dist/{number-C9Tw_Ncm.js → number-C9CiD5ci.js} +1 -1
  114. package/dist/objectid-CgTtbB6Q.js +145 -0
  115. package/dist/{onboarding-D4dm_rxU.js → onboarding-BssUSfGQ.js} +36 -36
  116. package/dist/{onboardingSetup-DtNZUoRr.js → onboardingSetup-Dc_lD-K8.js} +2 -2
  117. package/dist/{plugins-DGI9Fkiu.js → plugins-D7Xjefvk.js} +3 -3
  118. package/dist/{reward-DTtejZqM.js → reward-CACqYkQp.js} +1 -1
  119. package/dist/{rule-C4N3ce3c.js → rule-BRaTrwKz.js} +492 -572
  120. package/dist/rule-builder-DZOASGFD.js +102 -0
  121. package/dist/style.css +1 -1
  122. package/dist/template-DdeVPIBt.js +275 -0
  123. package/dist/{timezone-5rYhX7XZ.js → timezone-CgVEOC5i.js} +1 -1
  124. package/dist/{transaction.fn-Ba_U7HdT.js → transaction.fn-C64l_ja_.js} +2 -2
  125. package/dist/{trigger-B8I1aO6Y.js → trigger-d2RIqXLt.js} +9 -9
  126. package/dist/{useMarketingMaterialActions-CTOFHmlL.js → useMarketingMaterialActions-Drf2MY9h.js} +4 -4
  127. package/dist/{usePagination-3wAPVCOp.js → usePagination-IUw34YLE.js} +1 -1
  128. package/dist/{user-Ds4DW_-Y.js → user-ClGyYHyS.js} +1 -1
  129. package/dist/vue-i18n-Cby9s0nj.js +2365 -0
  130. package/dist/{xlsx-xlOCvuAq.js → xlsx-HvtVSofi.js} +166 -166
  131. package/dist/{zod-GVNjvrpT.js → zod-IPdjFU_b.js} +1 -1
  132. package/package.json +2 -6
  133. package/dist/AuditLogs-BPKQdFga.js +0 -2016
  134. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-DFz_2GZ1.js +0 -4439
  135. package/dist/Grab-CAx1cCE4.js +0 -301
  136. package/dist/MemberDetailSheet.vue_vue_type_script_setup_true_lang-DI4XM_rJ.js +0 -1281
  137. package/dist/ReviewFacebookCallback-CO6FxHzc.js +0 -225
  138. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-b7ZEMd4s.js +0 -1923
  139. package/dist/Setting-DpEI72mW.js +0 -574
  140. package/dist/Settings-C6yJ1WEB.js +0 -286
  141. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-DqlluwMB.js +0 -1319
  142. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-DjCO9U0c.js +0 -7007
  143. package/dist/Upselling-Cf24ub-9.js +0 -1055
  144. package/dist/duplicateCampaign-icqF8Na9.js +0 -51
  145. package/dist/google-BQK68wbe.js +0 -5
  146. package/dist/objectid-D7dqM1a3.js +0 -145
  147. package/dist/template-YhWRyNGp.js +0 -227
  148. package/dist/vue-i18n-Bqlt_-jA.js +0 -2365
@@ -0,0 +1,1297 @@
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-DZrX13oF.js";
4
+ import "./index-C5bC2n8X.js";
5
+ import { T as E } from "./transaction.fn-C64l_ja_.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-DzsHTlrN.js";
9
+ import { s as J } from "./index-CuvNtC_M.js";
10
+ import { f as L, F as De } from "./number-C9CiD5ci.js";
11
+ import { u as ge } from "./business-DZWViiMC.js";
12
+ import { _ as ye, u as Fe } from "./usePagination-IUw34YLE.js";
13
+ import { c as ie, p as Ne } from "./plugins-D7Xjefvk.js";
14
+ import { g as ve } from "./user-ClGyYHyS.js";
15
+ import { B as he, e as Ae } from "./base.export-LmQ51u5f.js";
16
+ import { u as be } from "./campaign-C9xvGyrL.js";
17
+ import "./index-Bnane9cm.js";
18
+ import "./index-BiPRZRyE.js";
19
+ import "./index-Ba1t5vQv.js";
20
+ import "./index-C6Rx7pjc.js";
21
+ import "./index-CW4rNV1_.js";
22
+ import "./index-I9lmcd2w.js";
23
+ import "./index-CcCiEG6N.js";
24
+ import { u as ne } from "./vue-i18n-Cby9s0nj.js";
25
+ import { o as Y } from "./objectId-dwaoBfJX.js";
26
+ import { u as xe } from "./loading-DkqEFbrR.js";
27
+ import { w as Pe } from "./xlsx-HvtVSofi.js";
28
+ import { useRouter as ke } from "vue-router";
29
+ import { t as te } from "./index-MhAbTpBy.js";
30
+ import { R as X } from "./app-BMFxxLUm.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-BZv2gSlF.js";
34
+ import { m as Ve } from "./index-_-nCOZ1D.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
+ };