@feedmepos/mf-connect 0.1.119-dev → 0.1.119-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 (146) hide show
  1. package/dist/{App-z-u6skb5.js → App-BN2LKM3u.js} +135 -147
  2. package/dist/{Bin-Dh9RAgYi.js → Bin-DpQ1atb7.js} +8 -8
  3. package/dist/{Broadcast-Dg6azPS8.js → Broadcast-c1ZyYClI.js} +21 -22
  4. package/dist/{CampaignAnalytic-CVB4dstO.js → CampaignAnalytic-w1hIlc2r.js} +7 -7
  5. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DYgBeT23.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-D7U6evm1.js} +9 -8
  6. package/dist/{Card-CY736Ul0.js → Card-De53Xgbe.js} +22 -22
  7. package/dist/{Collections-CdTKWkZZ.js → Collections-BL2RD3FU.js} +185 -197
  8. package/dist/{Credit-CUhEKlMI.js → Credit-2KvFFcwR.js} +20 -21
  9. package/dist/{DateRangeChip.vue_vue_type_script_setup_true_lang-CBwgeTXh.js → DateRangeChip.vue_vue_type_script_setup_true_lang-CKSs2nYE.js} +1 -1
  10. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-BXb7v7wc.js +3493 -0
  11. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-D5-EKqG9.js → EffectSheet.vue_vue_type_style_index_0_lang-Jy7HkK5Z.js} +30 -30
  12. package/dist/{Experience-CMp09U-6.js → Experience-Cb0jHtVo.js} +31 -32
  13. package/dist/{FileSaver.min-Bq5McdmK.js → FileSaver.min-UDgZF_Cv.js} +1 -1
  14. package/dist/{Game-Dv5NvG-q.js → Game-BnysxSMs.js} +18 -19
  15. package/dist/{GiftCardSetup-SO2Tk5In.js → GiftCardSetup-s1OR6xQq.js} +31 -31
  16. package/dist/{GoalPickerPanel.vue_vue_type_script_setup_true_lang-CgG5vHCp.js → GoalPickerPanel.vue_vue_type_script_setup_true_lang-D108r20x.js} +7 -7
  17. package/dist/{Goals-BEwQP4cY.js → Goals-BAieLPzR.js} +4 -4
  18. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-BDGEqsWE.js → ImageInput.vue_vue_type_script_setup_true_lang-B9Jgq5Bp.js} +1 -1
  19. package/dist/{Index-8F2LOWng.js → Index-DnX16GAE.js} +10 -10
  20. package/dist/{LocationPicker.vue_vue_type_script_setup_true_lang-BwAjki7Y.js → LocationPicker.vue_vue_type_script_setup_true_lang-DeM-WG6m.js} +1 -1
  21. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-DK4C0Y9j.js → LottieAnimation.vue_vue_type_script_setup_true_lang-BAN69FOS.js} +1 -1
  22. package/dist/{LoyaltyDashboard-rWm0b8cm.js → LoyaltyDashboard-D8g6OSbC.js} +15 -15
  23. package/dist/{MainLayout-ezbgp2IQ.js → MainLayout-DWABjpQn.js} +1 -1
  24. package/dist/{MainLayout.vue_vue_type_script_setup_true_lang-1QY5-U5y.js → MainLayout.vue_vue_type_script_setup_true_lang-COp7iulq.js} +3 -3
  25. package/dist/{Marketing-DcWF4xVc.js → Marketing-Dagatr0y.js} +4 -4
  26. package/dist/{MarketingMaterialEdit-C1bXj_hU.js → MarketingMaterialEdit-DYVzNDpM.js} +211 -214
  27. package/dist/{Member-CgDZqGsV.js → Member-DAxdEF_Z.js} +7 -7
  28. package/dist/{MemberDetailSheet.vue_vue_type_script_setup_true_lang-Dh1_j06F.js → MemberDetailSheet.vue_vue_type_script_setup_true_lang-nBg7Hckj.js} +47 -39
  29. package/dist/{MemberImportHistory-DT3QJ5se.js → MemberImportHistory-2gx6FnLh.js} +7 -7
  30. package/dist/{MemberList-Bm05jnbk.js → MemberList-By_gGl-J.js} +105 -103
  31. package/dist/{MemberTransactions-D90tTpdC.js → MemberTransactions-BEF-4ZNp.js} +1 -1
  32. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-jvgjOXXA.js → MessageInput.vue_vue_type_script_setup_true_lang-Bs8wKx9B.js} +12 -12
  33. package/dist/{MetricInfoTooltip.vue_vue_type_script_setup_true_lang-CxL-Nh6i.js → MetricInfoTooltip.vue_vue_type_script_setup_true_lang-DN3mWfKj.js} +1 -1
  34. package/dist/{Mission-D_l2eJI3.js → Mission-jg15lBxo.js} +21 -22
  35. package/dist/{Overview-BOZBnorP.js → Overview-BFKLTAk1.js} +144 -145
  36. package/dist/{Overview-1AYfTeMD.js → Overview-C7WfdzfV.js} +20 -20
  37. package/dist/{Point-Cqy4XzeG.js → Point-dv9WgWTQ.js} +21 -22
  38. package/dist/{Promotion-9RDNbCgB.js → Promotion-mFPF_8jO.js} +131 -137
  39. package/dist/{Queue-D2Eie_np.js → Queue-BQoR_M5H.js} +45 -45
  40. package/dist/{Record-e4B--FD8.js → Record-1JZ1N5iX.js} +9 -9
  41. package/dist/{Review-DcUpSvc-.js → Review-B52AxCeT.js} +2 -2
  42. package/dist/ReviewFacebookCallback-ihTdiI8V.js +238 -0
  43. package/dist/{ReviewGoogleCallback-JPkamgo2.js → ReviewGoogleCallback-DO6SVFIC.js} +5 -5
  44. package/dist/{Reward-BQJw-R8V.js → Reward-Cp4jPAB0.js} +16 -16
  45. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-D_DSQ8q2.js → RewardGroup.vue_vue_type_script_setup_true_lang-DLD6X13Z.js} +13 -13
  46. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-pdHRjCt8.js +1884 -0
  47. package/dist/{Segment-Cjdqsqqg.js → Segment-DaKw0YXF.js} +306 -303
  48. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-g-CJUZBF.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-Bj3OQ_JJ.js} +14 -14
  49. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-lbH0b170.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-B1Otak97.js} +4 -4
  50. package/dist/{Setting-B3HK4mtx.js → Setting-DveUrt8J.js} +148 -159
  51. package/dist/{SettingAdvertisements-BQFJpdIm.js → SettingAdvertisements-QRXOMNnM.js} +12 -12
  52. package/dist/Settings-D9D-mkBa.js +179 -0
  53. package/dist/{Store-mp1LyXwr.js → Store-DjdXRw3V.js} +28 -28
  54. package/dist/{StoreRewards-DiSB6d7_.js → StoreRewards-CjlGrc9E.js} +15 -15
  55. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-DnwMpqzf.js +1265 -0
  56. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-I5-5BV4h.js +142 -0
  57. package/dist/{Tier-CxaXh96q.js → Tier-D74Oh2np.js} +687 -2575
  58. package/dist/{Title-Byz0TGpi.js → Title-CeeviOW8.js} +94 -95
  59. package/dist/{Transaction-CNXulI3o.js → Transaction-CWdw0ITl.js} +2 -2
  60. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-C0bfVZf8.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-B9nf-9s0.js} +26 -26
  61. package/dist/{Voucher-CVw3E8Y4.js → Voucher-C0nNXMtv.js} +19 -19
  62. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-C0d3ktXA.js → VoucherEditor.vue_vue_type_script_setup_true_lang-DxZLsQq9.js} +12 -12
  63. package/dist/{WhatsappAccount-5vLzjaIV.js → WhatsappAccount-CoLSjCQ2.js} +6 -6
  64. package/dist/{WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-CwGBRX-Q.js → WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-DkHPlGgT.js} +1 -1
  65. package/dist/{WhatsappBot-BWJbD7Gk.js → WhatsappBot-kLb3kUav.js} +6 -6
  66. package/dist/{WhatsappBotLogs-C8gpmZyC.js → WhatsappBotLogs-jcYaHs0t.js} +6 -6
  67. package/dist/{WhatsappBotSettings-BvPnKHz-.js → WhatsappBotSettings-B6jJD61h.js} +4 -4
  68. package/dist/{WhatsappLayout-DJXhXeXf.js → WhatsappLayout-C24bIjI2.js} +3 -3
  69. package/dist/{WhatsappNotificationGroupDialog.vue_vue_type_script_setup_true_lang-BxUYjrWQ.js → WhatsappNotificationGroupDialog.vue_vue_type_script_setup_true_lang-9a_grP76.js} +3 -3
  70. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-CkjzVKif.js → ZodTextField.vue_vue_type_script_setup_true_lang-i8Wc2mCr.js} +2 -2
  71. package/dist/{app-BF1vds2J.js → app-C06bAZj3.js} +10806 -11561
  72. package/dist/app.js +3 -4
  73. package/dist/{base.export-B7FU8J4P.js → base.export-CgNRhKu8.js} +2 -2
  74. package/dist/{business-DkUMhys1.js → business-D23Dt1x4.js} +1 -1
  75. package/dist/{campaign-C9cVkGMF.js → campaign-DfEvGigm.js} +94 -121
  76. package/dist/{campaign-0AgQP43B.js → campaign-FVcbXtrP.js} +28 -34
  77. package/dist/{campaign.enum-Dx-Zo68Q.js → campaign.enum-BqekIiiN.js} +1 -2
  78. package/dist/campaign.fn-0MNUj1fZ.js +776 -0
  79. package/dist/{collection.fn-B_QnW0e3.js → collection.fn-DC1AMI9o.js} +2 -2
  80. package/dist/{currency-XQmondpC.js → currency-Bra2RJK4.js} +1 -1
  81. package/dist/{effect-Mwn1x6qN.js → effect-EL4V3pAu.js} +1 -1
  82. package/dist/{email-addresses-DQQAi6-l.js → email-addresses-Ddtf1x_y.js} +2 -2
  83. package/dist/{feature-flag-B1VMMZMd.js → feature-flag-umACX47C.js} +70 -70
  84. package/dist/google-C3S8u0mT.js +4 -0
  85. package/dist/{helper-D1R8vyjc.js → helper-DqDOnLCf.js} +1 -1
  86. package/dist/{index-Rs75lw-x.js → index-B2lqC_hH.js} +1 -1
  87. package/dist/{index-C9Nbb7wc.js → index-B3U3KZl0.js} +2 -2
  88. package/dist/{index-CRAuAyO3.js → index-BTjhdlN_.js} +1 -1
  89. package/dist/{index-Bm43wR8L.js → index-B_BmgKrh.js} +2613 -2699
  90. package/dist/{index-DMfCzjiA.js → index-BkKu2G2c.js} +2 -2
  91. package/dist/{index-ug7pxPAX.js → index-BroF2fC8.js} +251 -608
  92. package/dist/{index-P8DDRVa3.js → index-Bvk61_w_.js} +1 -1
  93. package/dist/{index-DQnCdGWe.js → index-ByVPdKdB.js} +581 -682
  94. package/dist/{index-Bym-ZIcv.js → index-BzwwXWpZ.js} +1 -1
  95. package/dist/{index-DaUhJ6xV.js → index-C3hAzzS2.js} +15 -29
  96. package/dist/{index-CzE9ZPDV.js → index-C3lk4GHF.js} +4 -4
  97. package/dist/{index-CLlGMbnP.js → index-C6p9Lsvf.js} +1 -1
  98. package/dist/{index-eR9mqPPV.js → index-CEh6ryp2.js} +6 -19
  99. package/dist/{index-mOGrVzUV.js → index-DK9zxpDu.js} +3 -3
  100. package/dist/{index-ytSMcSMt.js → index-DuCJtx1m.js} +1 -1
  101. package/dist/{index-ZYrey0SM.js → index-LjoAs_nX.js} +10 -10
  102. package/dist/{index-BU6CU5MP.js → index-TDCPGtW3.js} +232 -389
  103. package/dist/{index-CPB7j8Wn.js → index-iVbjwKxc.js} +10 -10
  104. package/dist/{index-Cg8Z5eYT.js → index-pfmx-Gor.js} +2 -2
  105. package/dist/{index-D5BwAYuA.js → index-rcfcslIC.js} +197 -197
  106. package/dist/{index.esm2017-Gkctw9Mb.js → index.esm2017-DCuQPCX2.js} +111 -111
  107. package/dist/{loading-kUQqT44G.js → loading-CQm1DKWE.js} +1 -1
  108. package/dist/{lodash-B4AjV7YZ.js → lodash-C2wVbAap.js} +1 -1
  109. package/dist/{member-import-CwDUG5mj.js → member-import-BLEmTRso.js} +1 -1
  110. package/dist/{membership-BI6U8-eM.js → membership-XycnxPEW.js} +2 -2
  111. package/dist/{money-Bum-AbB7.js → money-DY_QGzd1.js} +1 -1
  112. package/dist/{number-uAoNqG-N.js → number-BHthf4qF.js} +1 -1
  113. package/dist/objectid-CPCAqIiC.js +145 -0
  114. package/dist/{onboarding-wtYzQipv.js → onboarding-BOJw54Fn.js} +36 -36
  115. package/dist/{onboardingSetup-DlYM-oqd.js → onboardingSetup-Cf2u1tXu.js} +2 -2
  116. package/dist/{plugins-BGyTPNfc.js → plugins-DKQeoL_e.js} +3 -3
  117. package/dist/{reward-D0xtG-bp.js → reward-D4RIYSpl.js} +1 -1
  118. package/dist/{rule-BAA5-vRj.js → rule-Ba-s0L_w.js} +492 -572
  119. package/dist/rule-builder-D0B0DPao.js +102 -0
  120. package/dist/style.css +1 -1
  121. package/dist/template-B40I16Yg.js +236 -0
  122. package/dist/{timezone-Bbw2OeEP.js → timezone-CAc8xi1h.js} +1 -1
  123. package/dist/{transaction.fn-DZdNjP_E.js → transaction.fn-Cp2hnhyU.js} +2 -2
  124. package/dist/{trigger-BpotFb7G.js → trigger-3ebhNBX7.js} +9 -9
  125. package/dist/{useMarketingMaterialActions-CQ1M0N9c.js → useMarketingMaterialActions-6URv8neP.js} +4 -4
  126. package/dist/{usePagination-qALFI_Td.js → usePagination-C-fyMmiy.js} +1 -1
  127. package/dist/{user-X_94TRIK.js → user-T-iXTrYV.js} +1 -1
  128. package/dist/vue-i18n-DzsxJorb.js +2365 -0
  129. package/dist/{xlsx-DW48eXDT.js → xlsx-B8OqaJfb.js} +224 -224
  130. package/dist/{zod-BAP9II5C.js → zod-DZkNj425.js} +1 -1
  131. package/package.json +3 -8
  132. package/dist/AuditLogs-J0UJ3HJW.js +0 -2016
  133. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-BC4jTtVY.js +0 -4439
  134. package/dist/Grab-npbL7p7S.js +0 -301
  135. package/dist/ReviewFacebookCallback-BhHdYb4X.js +0 -225
  136. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-DfWjXTx3.js +0 -1923
  137. package/dist/Settings-DKWkiRuA.js +0 -286
  138. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-BAYKqf-Y.js +0 -1319
  139. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-be7ksTJw.js +0 -7007
  140. package/dist/Upselling-Dto64bmE.js +0 -1013
  141. package/dist/campaign.fn-N6rJeDUx.js +0 -776
  142. package/dist/duplicateCampaign-CvQRWP-Z.js +0 -51
  143. package/dist/google-BQK68wbe.js +0 -5
  144. package/dist/objectid-CPTCMH2h.js +0 -145
  145. package/dist/template-DKgW9ul3.js +0 -188
  146. package/dist/vue-i18n-CRFpVnMa.js +0 -2365
@@ -0,0 +1,1265 @@
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-ByVPdKdB.js";
4
+ import "./index-DK9zxpDu.js";
5
+ import { T as E } from "./transaction.fn-Cp2hnhyU.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-CKSs2nYE.js";
9
+ import { s as J } from "./index-CuvNtC_M.js";
10
+ import { f as L, F as De } from "./number-BHthf4qF.js";
11
+ import { u as ge } from "./business-D23Dt1x4.js";
12
+ import { _ as ye, u as Fe } from "./usePagination-C-fyMmiy.js";
13
+ import { c as ie, p as Ne } from "./plugins-DKQeoL_e.js";
14
+ import { g as ve } from "./user-T-iXTrYV.js";
15
+ import { B as he, e as Ae } from "./base.export-CgNRhKu8.js";
16
+ import { u as be } from "./campaign-FVcbXtrP.js";
17
+ import "./index-BzwwXWpZ.js";
18
+ import "./index-B_BmgKrh.js";
19
+ import "./index-TDCPGtW3.js";
20
+ import "./index-BroF2fC8.js";
21
+ import "./index-B3U3KZl0.js";
22
+ import "./index-I9lmcd2w.js";
23
+ import "./index-Bvk61_w_.js";
24
+ import { u as ne } from "./vue-i18n-DzsxJorb.js";
25
+ import { o as Y } from "./objectId-dwaoBfJX.js";
26
+ import { u as xe } from "./loading-CQm1DKWE.js";
27
+ import { w as Pe } from "./xlsx-B8OqaJfb.js";
28
+ import { useRouter as ke } from "vue-router";
29
+ import { t as te } from "./index-C3hAzzS2.js";
30
+ import { R as X } from "./app-C06bAZj3.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-Bra2RJK4.js";
34
+ import { m as Ve } from "./index-CEh6ryp2.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
+ };