@feedmepos/mf-connect 0.1.115-dev → 0.1.115-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 (154) hide show
  1. package/README.md +1 -66
  2. package/dist/{App-43mZfFAr.js → App-CvtSY8ZO.js} +618 -652
  3. package/dist/{Bin-CA7v180Y.js → Bin-B3gS9QVZ.js} +8 -8
  4. package/dist/{Broadcast-qmdifF2Y.js → Broadcast-DAeb-HaN.js} +21 -22
  5. package/dist/{CampaignAnalytic-xnrDxqaH.js → CampaignAnalytic-BfTaHVem.js} +7 -7
  6. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-zjk-QdtX.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-zsei4OfG.js} +9 -9
  7. package/dist/{Card-D8icsk7L.js → Card-JFeVIwFs.js} +24 -25
  8. package/dist/{Collections--THcD-E_.js → Collections-xcDpEhIm.js} +185 -197
  9. package/dist/{Credit-JrbtVMBp.js → Credit-C9HJZjDS.js} +20 -21
  10. package/dist/{DateRangeChip.vue_vue_type_script_setup_true_lang-DrwKtnE5.js → DateRangeChip.vue_vue_type_script_setup_true_lang-DSqVY91w.js} +1 -1
  11. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-D_jXVE2I.js +3494 -0
  12. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-hVgqWdD0.js → EffectSheet.vue_vue_type_style_index_0_lang-C3J0rCTt.js} +32 -32
  13. package/dist/{Experience-CFeRqBoj.js → Experience-DszS8gto.js} +31 -32
  14. package/dist/{FileSaver.min-CCXIBm58.js → FileSaver.min-CFVQKaC-.js} +1 -1
  15. package/dist/{Game-CPxq6Ex3.js → Game-DhgeN7E2.js} +18 -19
  16. package/dist/{GiftCardSetup-D0esVZDp.js → GiftCardSetup-CWm6IhrS.js} +75 -75
  17. package/dist/{GoalPickerPanel.vue_vue_type_script_setup_true_lang-CJ1-vL-K.js → GoalPickerPanel.vue_vue_type_script_setup_true_lang-BuKADvmK.js} +7 -7
  18. package/dist/{Goals-DaKI6uXt.js → Goals-DtRVierH.js} +4 -4
  19. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-BOnL0GxM.js → ImageInput.vue_vue_type_script_setup_true_lang-DlEFyu6h.js} +1 -1
  20. package/dist/{Index-2kENoaZm.js → Index-DFRcu_qE.js} +10 -10
  21. package/dist/{LocationPicker.vue_vue_type_script_setup_true_lang-BtWnJKU_.js → LocationPicker.vue_vue_type_script_setup_true_lang-B3Br4Xvi.js} +1 -1
  22. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-CX_Sspu5.js → LottieAnimation.vue_vue_type_script_setup_true_lang-CjNJj3qj.js} +1 -1
  23. package/dist/{LoyaltyDashboard-CB93Fz8u.js → LoyaltyDashboard-BWHKDPzk.js} +15 -15
  24. package/dist/{MainLayout.vue_vue_type_script_setup_true_lang-Du8fw5v_.js → MainLayout-BmpNNAiE.js} +4 -5
  25. package/dist/Marketing-BKK45Eve.js +236 -0
  26. package/dist/{remy-icon-BhUGu2NI.js → MarketingMaterialEdit-x3c_N7Gs.js} +1031 -2
  27. package/dist/{Member-B--nYyr0.js → Member-xEzrBW_p.js} +7 -7
  28. package/dist/{MemberDetailSheet.vue_vue_type_script_setup_true_lang-BBlzO7Db.js → MemberDetailSheet.vue_vue_type_script_setup_true_lang-DRoC-I0t.js} +50 -43
  29. package/dist/{MemberImportHistory-D52Y4RTC.js → MemberImportHistory-CEQpBBF8.js} +7 -7
  30. package/dist/{MemberList-13Owa1fj.js → MemberList-CCvzkHv8.js} +105 -103
  31. package/dist/{MemberTransactions-CpXEWNbq.js → MemberTransactions-Bmh39J2W.js} +1 -1
  32. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-DlELjFM0.js → MessageInput.vue_vue_type_script_setup_true_lang-D3Pmk80l.js} +14 -14
  33. package/dist/{MetricInfoTooltip.vue_vue_type_script_setup_true_lang-C_y0rM8c.js → MetricInfoTooltip.vue_vue_type_script_setup_true_lang-DIBKAwHP.js} +1 -1
  34. package/dist/{Mission-Ci-UzXSu.js → Mission-CpUo2Bgw.js} +21 -22
  35. package/dist/{Overview-CKxSfAGF.js → Overview-CwQqQ1Tn.js} +144 -145
  36. package/dist/{Overview-CXen9Ram.js → Overview-DcDZmDXA.js} +22 -23
  37. package/dist/{Point-CR3YOaag.js → Point-CUNQsQIx.js} +21 -22
  38. package/dist/{Promotion-tw3J4ul-.js → Promotion-Cqdim7aW.js} +131 -137
  39. package/dist/{Queue-BZGA5ZXt.js → Queue-CNBVh1UG.js} +45 -46
  40. package/dist/{Record-BTevVXnT.js → Record-BYwz4l4o.js} +9 -9
  41. package/dist/{Review-BU7c8ZF0.js → Review-CqLcZFj8.js} +2 -2
  42. package/dist/ReviewFacebookCallback-DbSCILNN.js +238 -0
  43. package/dist/{ReviewGoogleCallback-xpdPHSdg.js → ReviewGoogleCallback-Dg8R7QlO.js} +5 -5
  44. package/dist/{Reward-jlA_7cxz.js → Reward-M8GZ8eHq.js} +29 -29
  45. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-D3z_n42G.js → RewardGroup.vue_vue_type_script_setup_true_lang-BkM9-Sx-.js} +15 -16
  46. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-CnaL93TF.js +1883 -0
  47. package/dist/{Segment-C1Bwm--Q.js → Segment-CrMi6xrp.js} +305 -304
  48. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-B6apgWTM.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-DKH5_9db.js} +30 -31
  49. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-B7m2F9UV.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-CyeAQ-hg.js} +4 -4
  50. package/dist/Setting-BnFRI0Se.js +2037 -0
  51. package/dist/{SettingAdvertisements-4XEAJzlL.js → SettingAdvertisements-Dh7v4c1D.js} +12 -12
  52. package/dist/Settings-BvT8_tkQ.js +179 -0
  53. package/dist/{Store-C56dXtc4.js → Store-CV-BmK5b.js} +30 -31
  54. package/dist/{StoreRewards-DQ1Q6WS6.js → StoreRewards-DPhSLvSZ.js} +15 -15
  55. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-CDu1QySl.js +1264 -0
  56. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-Dqz6jTlH.js +142 -0
  57. package/dist/{Tier-D4CPZqw7.js → Tier-ChvYps23.js} +687 -2576
  58. package/dist/{Title-DCbwhUic.js → Title-v-Ivswr1.js} +92 -94
  59. package/dist/{Transaction-C5LrasXr.js → Transaction-CRqE1Ix0.js} +2 -2
  60. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-Cl9b4mrK.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-B0Uh9iuj.js} +26 -26
  61. package/dist/{Voucher-rrVbNZKR.js → Voucher-Bg8FOuzD.js} +19 -19
  62. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-BIq227nz.js → VoucherEditor.vue_vue_type_script_setup_true_lang-HKxivQMF.js} +16 -16
  63. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-C39_95SZ.js → ZodTextField.vue_vue_type_script_setup_true_lang-8d290Dcp.js} +2 -2
  64. package/dist/{app-CgimGODl.js → app-DdNKsn2Q.js} +7107 -8874
  65. package/dist/app.js +3 -4
  66. package/dist/{base.export-D2P6HFvo.js → base.export-R97FrSQL.js} +2 -2
  67. package/dist/{business-Bu5TqSA0.js → business-Ce8vq3wQ.js} +1 -1
  68. package/dist/{campaign-zJxttSIk.js → campaign-BTllt2LH.js} +25 -31
  69. package/dist/{campaign-BFIXSgdJ.js → campaign-C19If7bW.js} +94 -121
  70. package/dist/{campaign.enum-Dx-Zo68Q.js → campaign.enum-9CCbalR4.js} +2 -3
  71. package/dist/{campaign.fn-gvjlcEfe.js → campaign.fn-B4g03h0A.js} +78 -78
  72. package/dist/{collectible.enum-Liy2wH3s.js → collectible.enum-MvqF7mSg.js} +1 -1
  73. package/dist/{collection.fn-DOm0HsSh.js → collection.fn-CR0bD33S.js} +2 -2
  74. package/dist/{currency-BpbQvbm8.js → currency-DmlguGIM.js} +1 -1
  75. package/dist/{effect-D-GtNB3n.js → effect-Dx3zfl28.js} +1 -1
  76. package/dist/{email-addresses-BKMoAtMi.js → email-addresses-De5PGOY4.js} +2 -2
  77. package/dist/{feature-flag-BJ_eyKsq.js → feature-flag-CD9V1V0h.js} +74 -74
  78. package/dist/google-C3S8u0mT.js +4 -0
  79. package/dist/{helper-CkfjBgMM.js → helper-CEiv7SaO.js} +1 -1
  80. package/dist/{index-zTvr2GR4.js → index-649OZ_e1.js} +2 -2
  81. package/dist/{index-feCrYhi6.js → index-B8meeQoD.js} +1 -1
  82. package/dist/{index-CIej31pF.js → index-B8yWVB8P.js} +3 -4
  83. package/dist/{index-BKsxIwbi.js → index-BAXKd9Gg.js} +198 -198
  84. package/dist/{index-BAtUrtqM.js → index-BDPnyro2.js} +6 -19
  85. package/dist/{index-DUAZOMVJ.js → index-BR9h5DTI.js} +1 -1
  86. package/dist/{index-DwU3fsLW.js → index-BVdYxi3l.js} +15 -29
  87. package/dist/{index-D0JK99Ko.js → index-BW6eb3n6.js} +252 -611
  88. package/dist/{index-LygS9WsG.js → index-BYI9ttxy.js} +10767 -8028
  89. package/dist/{index-BdEXUNoG.js → index-BquSqx6K.js} +4 -4
  90. package/dist/{index-BpTIulTX.js → index-CBJy9bxB.js} +1 -1
  91. package/dist/{index-B6kU3PkV.js → index-CPODug8b.js} +2613 -2700
  92. package/dist/{index-CfQuYqXn.js → index-CWUrODxL.js} +1 -1
  93. package/dist/{index-DKxN1mMS.js → index-CqOCJTeR.js} +232 -390
  94. package/dist/{index-CuREApMc.js → index-D4d3l0gw.js} +7 -8
  95. package/dist/{index-Bhl5IRXy.js → index-DT3S00_Y.js} +10 -11
  96. package/dist/{index-DqGs6RJG.js → index-IZRfmmde.js} +581 -683
  97. package/dist/{index-CQ8XFbBk.js → index-__UT3_Ey.js} +2 -2
  98. package/dist/{index-CCEXSPxk.js → index-xct3mnu8.js} +7 -7
  99. package/dist/{index.esm2017-DZi9IQPS.js → index.esm2017-AVbZ9btd.js} +177 -177
  100. package/dist/{loading-Brid2wnu.js → loading-BvHm1m3K.js} +1 -1
  101. package/dist/{lodash-C1epw3Kv.js → lodash-Dvrceo7x.js} +1 -1
  102. package/dist/{member-import-DAIxTIiu.js → member-import-c9avpiSS.js} +5 -6
  103. package/dist/{membership-BZmljFhF.js → membership-D-pZS634.js} +3 -3
  104. package/dist/{money-cLcyGcSZ.js → money-D4skwMkD.js} +1 -1
  105. package/dist/{number-C2jPLJr2.js → number-DJ6ncfT6.js} +1 -1
  106. package/dist/objectid-DEMM_jdR.js +145 -0
  107. package/dist/{onboarding-oRfy_g05.js → onboarding-t7R1d3h-.js} +25 -25
  108. package/dist/{onboardingSetup-BLD6m8HY.js → onboardingSetup-lTaJc0oT.js} +2 -2
  109. package/dist/{plugins-CUsr9vB0.js → plugins-DQNOWwRC.js} +3 -3
  110. package/dist/{reward-UOT03odb.js → reward-BK150pjm.js} +1 -1
  111. package/dist/{rule-BgJnPjkI.js → rule-COcdAnUu.js} +492 -572
  112. package/dist/rule-builder-Deufb6h_.js +102 -0
  113. package/dist/style.css +1 -1
  114. package/dist/template-DeebIqJ_.js +236 -0
  115. package/dist/{timezone-BXA4wq7Y.js → timezone-BP6UC4KL.js} +1 -1
  116. package/dist/{transaction.fn-CQ4fpRt3.js → transaction.fn-BY0hzon0.js} +2 -2
  117. package/dist/{trigger-DXJCGT0q.js → trigger-DVBjVPbN.js} +8 -8
  118. package/dist/useMarketingMaterialActions-DpQCQHFI.js +96 -0
  119. package/dist/{usePagination-Pp4okWr8.js → usePagination-QT552XyF.js} +1 -1
  120. package/dist/{user-B3gXcAIy.js → user-CmAxNc7T.js} +1 -1
  121. package/dist/vue-i18n-Cze706-f.js +2365 -0
  122. package/dist/{xlsx-CCaDUTgW.js → xlsx-DAczoc8y.js} +224 -224
  123. package/dist/{zod-CPwjOxvW.js → zod-Aj-GuVQL.js} +1 -1
  124. package/package.json +2 -6
  125. package/dist/AuditLogs-BPpdm96t.js +0 -2016
  126. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-DgdAlHU7.js +0 -4442
  127. package/dist/Grab-BWzdN_cd.js +0 -301
  128. package/dist/MainLayout-DwnjGXh6.js +0 -4
  129. package/dist/Marketing-DCco__2F.js +0 -273
  130. package/dist/MarketingMaterialEdit-BbgFtrYP.js +0 -1037
  131. package/dist/ReviewFacebookCallback-BnMF6Arh.js +0 -225
  132. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-CsHxqH9h.js +0 -1923
  133. package/dist/Setting-CDM4RhLW.js +0 -574
  134. package/dist/Settings-D-0tvZRr.js +0 -286
  135. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-LLD91Rz6.js +0 -1319
  136. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-Bvy4NJMd.js +0 -7007
  137. package/dist/WhatsappAccount-oJDo5zTr.js +0 -159
  138. package/dist/WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-aCQCYFYq.js +0 -39
  139. package/dist/WhatsappBot-Cl64wG_F.js +0 -876
  140. package/dist/WhatsappBotLogs-D3uT4EiB.js +0 -372
  141. package/dist/WhatsappBotSettings-Cs1lLxh-.js +0 -705
  142. package/dist/WhatsappLayout-C639d2HP.js +0 -21
  143. package/dist/WhatsappNotificationGroupDialog.vue_vue_type_script_setup_true_lang-DpPxWp2x.js +0 -253
  144. package/dist/browser-BSAOEeIM.js +0 -1478
  145. package/dist/duplicateCampaign-CvsvjRE9.js +0 -51
  146. package/dist/feature-flag-Bo-k5sIG.js +0 -50
  147. package/dist/google-BQK68wbe.js +0 -5
  148. package/dist/index-C-iwb2Ln.js +0 -109
  149. package/dist/index-C_H8jFYf.js +0 -2743
  150. package/dist/index-DQ8JJhxs.js +0 -74
  151. package/dist/objectid-C-wocWKI.js +0 -145
  152. package/dist/template-BZyFhr73.js +0 -188
  153. package/dist/useMarketingMaterialActions-B-Wib5ga.js +0 -125
  154. package/dist/vue-i18n-DWGiC_vs.js +0 -2365
@@ -1,1319 +0,0 @@
1
- import { ref as k, defineComponent as oe, computed as B, h as i, resolveComponent as Y, openBlock as P, createBlock as le, unref as c, isRef as de, withCtx as te, createElementVNode as w, createVNode as A, createElementBlock as E, Fragment as q, renderList as ae, toDisplayString as U, createTextVNode as Re, resolveDynamicComponent as Ie, watch as pe, onBeforeMount as Fe, onMounted as De } from "vue";
2
- import { components as T } from "@feedmepos/ui-library";
3
- import { s as fe } from "./index-DqGs6RJG.js";
4
- import "./index-LygS9WsG.js";
5
- import { T as O } from "./transaction.fn-CQ4fpRt3.js";
6
- import { h as M } from "./moment-D7p2TMB-.js";
7
- import { _ as se } from "./FilterChip.vue_vue_type_script_setup_true_lang-3bH-tZAm.js";
8
- import { _ as ge } from "./DateRangeChip.vue_vue_type_script_setup_true_lang-DrwKtnE5.js";
9
- import { s as ee } from "./index-CuvNtC_M.js";
10
- import { f as G, F as Ae } from "./number-C2jPLJr2.js";
11
- import { u as ye } from "./business-Bu5TqSA0.js";
12
- import { _ as ve, u as Ne } from "./usePagination-Pp4okWr8.js";
13
- import { c as ce, p as he } from "./plugins-CUsr9vB0.js";
14
- import { g as be } from "./user-B3gXcAIy.js";
15
- import { B as xe, e as Pe } from "./base.export-D2P6HFvo.js";
16
- import { u as Se } from "./campaign-zJxttSIk.js";
17
- import "./index-feCrYhi6.js";
18
- import "./index-D0JK99Ko.js";
19
- import "./index-B6kU3PkV.js";
20
- import "./index-DKxN1mMS.js";
21
- import "./index-CuREApMc.js";
22
- import "./index-C-iwb2Ln.js";
23
- import "./index-CIej31pF.js";
24
- import { u as re } from "./vue-i18n-DWGiC_vs.js";
25
- import { o as L } from "./objectId-dwaoBfJX.js";
26
- import { u as _e } from "./loading-Brid2wnu.js";
27
- import { w as Me } from "./xlsx-CCaDUTgW.js";
28
- import { useRouter as ke } from "vue-router";
29
- import { t as j } from "./index-DwU3fsLW.js";
30
- import { R as Z } from "./app-CgimGODl.js";
31
- import { useCoreStore as $e } from "@feedmepos/mf-common";
32
- import { c as W } from "./string-Gcy5IM_H.js";
33
- import { f as Ve } from "./currency-BpbQvbm8.js";
34
- import { m as Ee } from "./index-BAtUrtqM.js";
35
- const Oe = (l) => {
36
- if (l.startsWith("_") || l.includes("."))
37
- return l;
38
- for (const y of ["pf_user_", "pf_collectible_"])
39
- if (l.startsWith(y))
40
- return `${y.slice(0, -1)}.${l.slice(y.length).replace(new RegExp("_", "g"), ".")}`;
41
- return l.replace(new RegExp("_", "g"), ".");
42
- };
43
- function Be(l, y = { 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(y), R = k([]), C = k([void 0]);
53
- function N() {
54
- C.value = [void 0], u.value.pageIndex = 0, u.value.pageCount = 1, u.value.hasNext = !1;
55
- }
56
- const $ = async (b = {}) => {
57
- const p = b.pageSize ?? u.value.pageSize, t = p !== u.value.pageSize;
58
- t && N();
59
- const a = t ? 0 : Math.max(b.pageIndex ?? u.value.pageIndex, 0), e = a === 0 || !!C.value[a] ? a : u.value.pageIndex, o = C.value[e];
60
- u.value.isLoading = !0, u.value.pageSize = p, R.value = [];
61
- try {
62
- const d = await l({
63
- limit: p,
64
- sortBy: m.value.key,
65
- descending: m.value.descending,
66
- search: u.value.searchValue,
67
- ...o ? { cursor: o } : {}
68
- });
69
- R.value = d.resources, u.value.pageIndex = e, u.value.totalRows = d.resources.length, u.value.hasNext = d.meta.hasNext, u.value.pageCount = e + (d.meta.hasNext ? 2 : 1), d.meta.nextCursor ? C.value[e + 1] = d.meta.nextCursor : C.value.splice(e + 1);
70
- } catch (d) {
71
- console.error("Error fetching data:", d), u.value.hasNext = !1;
72
- } finally {
73
- u.value.isLoading = !1;
74
- }
75
- };
76
- let I, g;
77
- const v = (b) => (I && clearTimeout(I), g && g(), new Promise((p) => {
78
- g = p, I = setTimeout(async () => {
79
- I = void 0, g = void 0, await $(b), p();
80
- }, 200);
81
- }));
82
- return {
83
- tableMeta: u,
84
- rowData: R,
85
- sortBy: m,
86
- pageCursors: C,
87
- resetCursorState: N,
88
- fetchData: $,
89
- debouncedFetchData: v,
90
- onSort: async (b) => {
91
- b.length ? m.value = {
92
- key: Oe(b[0].id),
93
- descending: b[0].desc
94
- } : m.value = y, 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 xe {
106
- }
107
- const Ue = { class: "space-y-24 pr-12" }, Ye = { class: "w-full space-y-16" }, Le = { class: "fm-typo-en-body-lg-600" }, Ge = ["onClick"], Ke = { class: "fm-typo-en-body-lg-600" }, je = ["onClick"], We = { class: "flex items-center gap-8" }, qe = /* @__PURE__ */ oe({
108
- __name: "TransactionDetailSheet",
109
- setup(l, { expose: y }) {
110
- re();
111
- const u = k(!1), m = k(), R = Se(), C = ye();
112
- function N(v, s) {
113
- u.value = v, m.value = s ?? null;
114
- }
115
- const $ = B(() => {
116
- var v, s;
117
- return G(
118
- ((s = m.value) == null ? void 0 : s.expiryAmount.reduce(
119
- (_, b) => _ + b.amount,
120
- ((v = m.value) == null ? void 0 : v.amount) ?? 0
121
- )) ?? 0,
122
- 2
123
- );
124
- }), I = B(() => {
125
- var v, s, _, b, 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: M(L(m.value._id.toString())).format(
134
- "D MMM YYYY, hh:mmA"
135
- )
136
- },
137
- {
138
- label: "Amount",
139
- component: () => i(
140
- "span",
141
- {
142
- class: [
143
- "pr-2",
144
- +$.value > 0 ? "text-fm-color-system-success-300" : "text-fm-color-system-error-300"
145
- ]
146
- },
147
- $.value
148
- )
149
- },
150
- {
151
- label: "Type",
152
- value: O.formattedType(m.value)
153
- },
154
- {
155
- label: "Source",
156
- value: ee(O.getReason(m.value.source))
157
- },
158
- {
159
- label: "User",
160
- value: (_ = (s = m.value) == null ? void 0 : s.pf_user) == null ? void 0 : _.name
161
- },
162
- {
163
- label: "Phone Number",
164
- value: (p = (b = m.value) == null ? void 0 : b.pf_user) == null ? void 0 : p.phoneNumber
165
- }
166
- ] : [];
167
- }), g = B(() => {
168
- var p, t, a, x;
169
- if (!m.value) return [];
170
- const v = [], s = (p = m.value) == null ? void 0 : p.metadata, _ = m.value;
171
- if (s != null && s.campaign) {
172
- const e = R.campaigns.all.find(
173
- (o) => o._id === (s == null ? void 0 : s.campaign)
174
- );
175
- e && v.push({
176
- label: "Campaign",
177
- value: e.name
178
- });
179
- }
180
- const b = O.formattedRemark(_);
181
- return b && v.push({
182
- label: "Remark",
183
- value: b
184
- }), (t = m.value) != null && t.ref.startsWith("bill_") && v.push({
185
- label: "Bill Number",
186
- value: (a = m.value) == null ? void 0 : a.ref,
187
- copy: () => {
188
- var e;
189
- return ce((e = m.value) == null ? void 0 : e.ref);
190
- }
191
- }), s != null && s.location && v.push({
192
- label: "Location",
193
- value: (x = C.locations.find(
194
- (e) => e._id.toString() === (s == null ? void 0 : s.location)
195
- )) == null ? void 0 : x.name
196
- }), _.source === fe.enum.STORE && v.push({
197
- label: "Store Transaction",
198
- value: _.ref
199
- }), s != null && s.originTransaction && v.push({
200
- label: "Parent Transaction",
201
- value: s.originTransaction
202
- }), s != null && s.referral_count && v.push({
203
- label: "Referral Count",
204
- value: s.referral_count
205
- }), _.refundedFrom && v.push({
206
- label: "Refunded From",
207
- value: _.refundedFrom
208
- }), v;
209
- });
210
- return y({
211
- showSheet: N
212
- }), (v, s) => {
213
- const _ = Y("FmButton"), b = Y("FmSideSheet");
214
- return P(), le(b, {
215
- "max-width": 560,
216
- modelValue: c(u),
217
- "onUpdate:modelValue": s[1] || (s[1] = (p) => de(u) ? u.value = p : null),
218
- header: "Transaction Details"
219
- }, {
220
- "side-sheet-footer": te(() => [
221
- w("div", We, [
222
- A(_, {
223
- label: "Close",
224
- onClick: s[0] || (s[0] = (p) => N(!1)),
225
- variant: "tertiary"
226
- })
227
- ])
228
- ]),
229
- default: te(() => [
230
- w("div", Ue, [
231
- w("div", Ye, [
232
- (P(!0), E(q, null, ae(c(I), (p) => (P(), E("div", {
233
- key: p.label,
234
- class: "flex flex-col gap-4"
235
- }, [
236
- w("div", Le, U(p.label), 1),
237
- w("div", {
238
- class: "text-fm-color-typo-secondary fm-typo-en-body-md-400 hover:underline",
239
- onClick: p.copy
240
- }, [
241
- Re(U(p.accessorFn ? p.accessorFn() : p.value) + " ", 1),
242
- (P(), le(Ie(p.component)))
243
- ], 8, Ge),
244
- s[2] || (s[2] = w("hr", { class: "mt-3" }, null, -1))
245
- ]))), 128)),
246
- (P(!0), E(q, null, ae(c(g), (p) => (P(), E("div", {
247
- key: p.label,
248
- class: "flex flex-col gap-4"
249
- }, [
250
- w("div", Ke, U(p.label), 1),
251
- w("div", {
252
- class: "text-fm-color-typo-secondary fm-typo-en-body-md-400 hover:underline",
253
- onClick: p.copy
254
- }, U(p.accessorFn ? p.accessorFn() : p.value), 9, je),
255
- s[3] || (s[3] = w("hr", { class: "mt-3" }, null, -1))
256
- ]))), 128))
257
- ])
258
- ])
259
- ]),
260
- _: 1
261
- }, 8, ["modelValue"]);
262
- };
263
- }
264
- });
265
- function He(l) {
266
- if (l.source !== "BILL")
267
- return "Only bill transactions can be reversed";
268
- if (l.refundedFrom) return "Reversal entries cannot be reversed";
269
- if (l.refunded) return "Transaction already reversed or replaced";
270
- if (l.expiryAmount.reduce(
271
- (u, m) => u + m.amount,
272
- l.amount
273
- ) === 0) return "Transaction has no reward amount";
274
- }
275
- const Qe = { class: "hidden xs:!flex items-center justify-end" }, Xe = { class: "flex items-center justify-between" }, Je = { class: "flex gap-8 items-center w-full overflow-x-scroll" }, Ze = { class: "xs:hidden" }, Wt = /* @__PURE__ */ oe({
276
- __name: "CollectionTransactions",
277
- props: {
278
- user: {
279
- type: String
280
- }
281
- },
282
- setup(l) {
283
- const { t: y } = re(), u = ye(), m = Se(), R = ke(), C = l, N = k(!1), { minor: $ } = _e, I = [
284
- {
285
- header: "Transaction ID",
286
- accessorKey: "_id",
287
- meta: {
288
- maxWidth: "100px"
289
- },
290
- cell(r) {
291
- return i("div", { class: "flex items-center" }, [
292
- i(T.FmIcon, {
293
- name: "content_copy",
294
- outline: !0,
295
- size: "sm",
296
- class: "cursor-pointer mr-4",
297
- onClick: (n) => {
298
- n.preventDefault(), n.stopPropagation(), ce(r.row.original._id.toString());
299
- }
300
- }),
301
- i(
302
- "div",
303
- { class: "pr-2 text-ellipsis overflow-hidden" },
304
- r.row.original._id.toString()
305
- )
306
- ]);
307
- },
308
- enableSorting: !1
309
- },
310
- {
311
- header: "Created at",
312
- accessorKey: "_id",
313
- accessorFn: (r) => M(L(r._id.toString())),
314
- cell: (r) => M(L(r.row.original._id.toString())).format(
315
- "D MMM YYYY, hh:mmA"
316
- ),
317
- enableSorting: !0
318
- },
319
- {
320
- header: "Amount",
321
- // accessorKey: 'totalAmount',
322
- enableSorting: !1,
323
- cell(r) {
324
- var h, f, z, K;
325
- const n = G(
326
- r.row.original.expiryAmount.reduce(
327
- (Q, X) => Q + X.amount,
328
- r.row.original.amount ?? 0
329
- ),
330
- 2
331
- ), S = (f = (h = r.row.original.expiryAmount) == null ? void 0 : h[0]) != null && f.expiredAt ? M((K = (z = r.row.original.expiryAmount) == null ? void 0 : z[0]) == null ? void 0 : K.expiredAt).format(
332
- "D MMM YYYY"
333
- ) : "";
334
- return i("div", { class: "flex items-center" }, [
335
- i(
336
- "div",
337
- {
338
- class: [
339
- "pr-2",
340
- +n > 0 ? "text-fm-color-system-success-300" : "text-fm-color-system-error-300"
341
- ]
342
- },
343
- n
344
- ),
345
- i("div", { class: "flex items-center" }, [
346
- r.row.original.expiryAmount.length > 0 ? i(
347
- T.FmTooltip,
348
- {
349
- content: `Expired on ${S}`
350
- },
351
- [
352
- i(T.FmIcon, {
353
- name: "info",
354
- outline: !0,
355
- size: "sm"
356
- })
357
- ]
358
- ) : i("div")
359
- ])
360
- ]);
361
- }
362
- },
363
- {
364
- header: "Type",
365
- accessorKey: "pf_collectible.type",
366
- accessorFn: (r) => O.formattedType(r),
367
- meta: {
368
- maxWidth: "200px"
369
- },
370
- cell(r) {
371
- const n = O.formattedType(r.row.original);
372
- return i("div", { class: "flex items-center" }, [
373
- i("div", { class: "truncate text-ellipsis" }, n),
374
- n.length > 20 ? i(
375
- T.FmTooltip,
376
- {
377
- content: n
378
- },
379
- [
380
- i(T.FmIcon, {
381
- name: "info",
382
- color: "primary",
383
- outline: !0,
384
- size: "sm"
385
- })
386
- ]
387
- ) : null
388
- ]);
389
- }
390
- },
391
- {
392
- header: "Source",
393
- accessorKey: "source",
394
- cell(r) {
395
- var n;
396
- return i("div", { class: "flex items-center gap-4" }, [
397
- i(
398
- "div",
399
- { class: "truncate text-ellipsis" },
400
- ee(O.getReason(r.row.original.source))
401
- ),
402
- ...(n = r.row.original.metadata) != null && n.campaign ? [
403
- i(
404
- T.FmTooltip,
405
- {
406
- get content() {
407
- var S;
408
- return (S = m.campaigns.all.find(
409
- (h) => {
410
- var f;
411
- return h._id === ((f = r.row.original.metadata) == null ? void 0 : f.campaign);
412
- }
413
- )) == null ? void 0 : S.name;
414
- }
415
- },
416
- [
417
- i(T.FmIcon, {
418
- name: "info",
419
- color: "primary",
420
- size: "sm",
421
- onClick: async (S) => {
422
- S.preventDefault(), S.stopPropagation();
423
- const h = m.campaigns.all.find(
424
- (f) => {
425
- var z;
426
- return f._id === ((z = r.row.original.metadata) == null ? void 0 : z.campaign);
427
- }
428
- );
429
- if (h)
430
- switch (h.type) {
431
- case "VOUCHER":
432
- case "PROMOTION":
433
- case "BROADCAST":
434
- await R.push({
435
- name: Z[`$connect-CAMPAIGN_${h.type}`]
436
- });
437
- break;
438
- case "GAME":
439
- case "CREDIT":
440
- case "MISSION":
441
- await R.push({
442
- name: Z[`$connect-PROGRAM_${h.type}`]
443
- });
444
- break;
445
- case "POINT":
446
- await R.push({
447
- name: Z["$connect-PROGRAM_EXPERIENCE"]
448
- });
449
- break;
450
- case "COIN":
451
- await R.push({
452
- name: Z["$connect-PROGRAM_POINT"]
453
- });
454
- break;
455
- }
456
- }
457
- })
458
- ]
459
- )
460
- ] : []
461
- ]);
462
- }
463
- },
464
- {
465
- header: "User",
466
- accessorKey: "pf_user.name",
467
- cell(r) {
468
- return be(r.row.original.pf_user);
469
- }
470
- },
471
- {
472
- header: "Phone No.",
473
- accessorKey: "pf_user.phoneNumber",
474
- accessorFn: (r) => {
475
- var n;
476
- return ((n = r == null ? void 0 : r.pf_user) == null ? void 0 : n.phoneNumber) || "";
477
- }
478
- },
479
- {
480
- header: "Status",
481
- id: "status",
482
- enableSorting: !1,
483
- cell(r) {
484
- const n = !!r.row.original.refunded;
485
- return i(T.FmChip, {
486
- label: y(n ? "connect.transaction.refunded" : "connect.transaction.completed"),
487
- variant: "plain",
488
- class: n ? "text-fm-color-typo-warning bg-fm-color-system-warning-100" : "text-fm-color-typo-success bg-fm-color-system-success-100"
489
- });
490
- }
491
- },
492
- {
493
- accessorFn: (r) => r.ref,
494
- header: "References",
495
- accessorKey: "ref",
496
- cell(r) {
497
- const n = O.formattedRemark(r.row.original);
498
- return i("div", { class: "flex items-center justify-between gap-4" }, [
499
- i("div", { class: "flex items-center" }, [
500
- n ? i(
501
- T.FmTooltip,
502
- {
503
- content: n
504
- },
505
- [
506
- i(T.FmIcon, {
507
- name: "info",
508
- class: "pl-2",
509
- outline: !0,
510
- size: "sm"
511
- })
512
- ]
513
- ) : i("div")
514
- ]),
515
- i("div", { class: "flex-1" }, r.row.original.ref)
516
- ]);
517
- }
518
- },
519
- {
520
- header: "Actions",
521
- cell(r) {
522
- var h;
523
- const n = r.row.original, S = He(n);
524
- return i(
525
- T.FmTooltip,
526
- {
527
- get content() {
528
- var f;
529
- return S || (((f = n.pf_collectible) == null ? void 0 : f.type) === "STAMP" ? "Recalculate mission rewards" : "Revert transaction");
530
- }
531
- },
532
- [
533
- i(T.FmButton, {
534
- variant: "tertiary",
535
- icon: "amend",
536
- iconColor: "neutral-gray-400",
537
- "aria-label": S ? `Cannot reverse transaction ${n._id}: ${S}` : ((h = n.pf_collectible) == null ? void 0 : h.type) === "STAMP" ? `Recalculate mission rewards for transaction ${n._id}` : `Reverse transaction ${n._id}`,
538
- disabled: !!S,
539
- onClick: (f) => {
540
- f.stopPropagation(), o(n);
541
- }
542
- })
543
- ]
544
- );
545
- }
546
- }
547
- ], g = k({
548
- search: "",
549
- "pf_collectible.type": [],
550
- "metadata.location": [],
551
- dateRange: {
552
- startDate: M().subtract(7, "day").toISOString(),
553
- endDate: M().endOf("day").toISOString()
554
- },
555
- source: []
556
- }), v = () => ({
557
- ...g.value,
558
- user: C.user,
559
- dateRange: {
560
- start: new Date(g.value.dateRange.startDate).toISOString(),
561
- end: new Date(g.value.dateRange.endDate).toISOString()
562
- }
563
- }), { tableMeta: s, rowData: _, onSort: b, debouncedFetchData: p, resetCursorState: t } = Be(async (r) => {
564
- const n = await j.readAllCursor(
565
- r,
566
- v()
567
- );
568
- return {
569
- resources: n.resources.map((S) => {
570
- const h = a.value.find((f) => f._id === S.ref);
571
- return {
572
- ...S,
573
- ref: (h == null ? void 0 : h.seqNumber) || S.ref
574
- };
575
- }),
576
- meta: n.meta
577
- };
578
- }), a = k([]), x = fe.options.map((r) => ({ label: ee(O.getReason(r)), value: r })), e = B(
579
- () => u.locations.map((r) => ({ label: r.name, value: r._id }))
580
- );
581
- pe(
582
- g,
583
- () => {
584
- t(), p({ pageIndex: 0 });
585
- },
586
- { deep: !0 }
587
- );
588
- async function o(r) {
589
- var h;
590
- const n = ((h = r.pf_collectible) == null ? void 0 : h.type) === "STAMP";
591
- await he.confirm(
592
- n ? "This will remove this transaction's mission progress, revoke affected rewards, and recalculate later mission earnings. Continue?" : "Are you sure you want to revert this transaction?",
593
- n ? "Recalculate Mission Rewards" : "Revert Transaction",
594
- "Confirm",
595
- "Cancel"
596
- ) && await $(
597
- async () => {
598
- await j.revertTransaction({
599
- id: r._id.toString()
600
- }), await p();
601
- },
602
- {
603
- message: n ? "Recalculating mission rewards..." : "Reverting transaction...",
604
- successMessage: n ? "Mission rewards recalculated successfully" : "Transaction reverted successfully"
605
- }
606
- );
607
- }
608
- async function d() {
609
- try {
610
- N.value = !0;
611
- const r = new ze(), n = v(), S = 1e3;
612
- await $(
613
- async () => {
614
- var z, K, Q, X, ue, me;
615
- let h, f = !0;
616
- for (; f; ) {
617
- const J = await j.readAllCursor(
618
- {
619
- limit: S,
620
- sortBy: "_id",
621
- descending: !1,
622
- ...h ? { cursor: h } : {}
623
- },
624
- n
625
- );
626
- if (!J.resources.length)
627
- break;
628
- for (const V of J.resources)
629
- r.addRecord({
630
- TransactionID: V._id,
631
- CreatedAt: M(L(V._id.toString())).format(
632
- "D MMM YYYY, hh:mmA"
633
- ),
634
- Amount: G(
635
- V.expiryAmount.reduce(
636
- (Te, Ce) => Te + Ce.amount,
637
- V.amount ?? 0
638
- ),
639
- 2
640
- ),
641
- ExpiredAt: (K = (z = V.expiryAmount) == null ? void 0 : z[0]) != null && K.expiredAt ? M((X = (Q = V.expiryAmount) == null ? void 0 : Q[0]) == null ? void 0 : X.expiredAt).format("D MMM YYYY") : "",
642
- Type: O.formattedType(V),
643
- Source: ee(O.getReason(V.source)),
644
- User: ((ue = V.pf_user) == null ? void 0 : ue.name) || "",
645
- "Phone No.": ((me = V.pf_user) == null ? void 0 : me.phoneNumber) || "",
646
- References: V.ref,
647
- Remark: O.formattedRemark(V)
648
- });
649
- h = J.meta.nextCursor ?? void 0, f = J.meta.hasNext && !!h;
650
- }
651
- await Me(
652
- r.buildExcel(),
653
- `transactions-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
654
- {
655
- bookType: "xlsx",
656
- bookSST: !1,
657
- type: "array"
658
- }
659
- );
660
- },
661
- {
662
- message: "Exporting transactions...",
663
- successMessage: "transactions exported successfully"
664
- }
665
- );
666
- } catch (r) {
667
- console.error(r);
668
- } finally {
669
- N.value = !1;
670
- }
671
- }
672
- const F = k(null);
673
- function D(r) {
674
- var n;
675
- console.log(r), (n = F.value) == null || n.showSheet(!0, r.original);
676
- }
677
- return Fe(async () => {
678
- await u.readLocations(), await m.read(), await p();
679
- }), (r, n) => {
680
- const S = Y("FmSearch"), h = Y("FmButton");
681
- return P(), E(q, null, [
682
- w("div", null, [
683
- w("div", Qe, [
684
- A(S, {
685
- class: "hidden xs:!flex border-b border-fm-color-neutral-gray-100",
686
- modelValue: c(g).search,
687
- "onUpdate:modelValue": n[0] || (n[0] = (f) => c(g).search = f),
688
- placeholder: "Search",
689
- collapsible: ""
690
- }, null, 8, ["modelValue"]),
691
- A(h, {
692
- icon: "ios_share",
693
- variant: "tertiary",
694
- onClick: d
695
- })
696
- ]),
697
- w("div", Xe, [
698
- w("div", Je, [
699
- A(se, {
700
- class: "cursor-pointer text-fm-color-neutral-gray-400",
701
- "right-icon": "keyboard_arrow_down",
702
- modelValue: c(g)["metadata.location"],
703
- "onUpdate:modelValue": n[1] || (n[1] = (f) => c(g)["metadata.location"] = f),
704
- icon: "storefront",
705
- "show-item-label": !0,
706
- items: c(e)
707
- }, null, 8, ["modelValue", "items"]),
708
- A(se, {
709
- class: "cursor-pointer text-fm-color-neutral-gray-400",
710
- "right-icon": "keyboard_arrow_down",
711
- modelValue: c(g)["pf_collectible.type"],
712
- "onUpdate:modelValue": n[2] || (n[2] = (f) => c(g)["pf_collectible.type"] = f),
713
- label: "Type: ",
714
- "show-item-label": !0,
715
- items: [
716
- { label: "Point", value: "COIN" },
717
- { label: "Credit", value: "CREDIT" },
718
- { label: "Voucher", value: "VOUCHER" },
719
- { label: "Experience", value: "POINT" },
720
- { label: "Tier", value: "TIER" },
721
- { label: "Title", value: "TITLE" },
722
- { label: "Game", value: "GAME" },
723
- { label: "Stamp", value: "STAMP" }
724
- ]
725
- }, null, 8, ["modelValue"]),
726
- A(se, {
727
- class: "cursor-pointer text-fm-color-neutral-gray-400",
728
- "right-icon": "keyboard_arrow_down",
729
- modelValue: c(g).source,
730
- "onUpdate:modelValue": n[3] || (n[3] = (f) => c(g).source = f),
731
- label: "Source: ",
732
- "show-item-label": !0,
733
- items: c(x)
734
- }, null, 8, ["modelValue", "items"]),
735
- A(ge, {
736
- "model-value": {
737
- startDate: c(g).dateRange.startDate,
738
- endDate: c(g).dateRange.endDate
739
- },
740
- "onUpdate:modelValue": n[4] || (n[4] = (f) => c(g).dateRange = {
741
- startDate: c(M)(f.startDate).startOf("d").toISOString(),
742
- endDate: c(M)(f.endDate).endOf("d").toISOString()
743
- })
744
- }, null, 8, ["model-value"])
745
- ]),
746
- A(S, {
747
- class: "xs:hidden",
748
- modelValue: c(g).search,
749
- "onUpdate:modelValue": n[5] || (n[5] = (f) => c(g).search = f),
750
- placeholder: "Search",
751
- collapsible: ""
752
- }, null, 8, ["modelValue"]),
753
- w("div", Ze, [
754
- A(h, {
755
- icon: "ios_share",
756
- variant: "tertiary",
757
- onClick: d
758
- })
759
- ])
760
- ]),
761
- A(ve, {
762
- loading: c(s).isLoading,
763
- "row-data": c(_),
764
- "row-count": c(s).totalRows,
765
- "column-defs": I.filter(
766
- (f) => !C.user || f.header !== "User" && f.header !== "Phone No."
767
- ),
768
- "page-count": c(s).pageCount,
769
- "page-index": c(s).pageIndex,
770
- "page-size": c(s).pageSize,
771
- "shrink-at": !1,
772
- "pagination-mode": "cursor",
773
- "has-next": c(s).hasNext,
774
- onSortChange: c(b),
775
- onPageChange: n[6] || (n[6] = (f) => c(p)({
776
- pageSize: f.pageSize,
777
- pageIndex: f.pageIndex
778
- })),
779
- onRowClick: D
780
- }, null, 8, ["loading", "row-data", "row-count", "column-defs", "page-count", "page-index", "page-size", "has-next", "onSortChange"])
781
- ]),
782
- A(qe, {
783
- ref_key: "transactionDetailSheet",
784
- ref: F
785
- }, null, 512)
786
- ], 64);
787
- };
788
- }
789
- });
790
- class et extends xe {
791
- }
792
- function ne(l) {
793
- return l.quantity ?? 1;
794
- }
795
- function we(l, y) {
796
- var u, m;
797
- switch ((u = l.paymentType) == null ? void 0 : u.type) {
798
- case "COIN":
799
- return y("connect.store.paymentType.point");
800
- case "CARD":
801
- return y("connect.store.paymentType.cardActivation");
802
- default:
803
- return ((m = l.paymentType) == null ? void 0 : m.type) ?? y("connect.store.paymentType.notAvailable");
804
- }
805
- }
806
- function H(l, y) {
807
- return Ve({
808
- ...y,
809
- amount: y.amount * ne(l)
810
- });
811
- }
812
- function ie(l) {
813
- var y;
814
- if (((y = l.paymentType) == null ? void 0 : y.type) === "COIN") {
815
- if (l.bundle.coinPrice == null) return "N/A";
816
- const u = l.bundle.coinPrice * ne(l);
817
- return `${G(u, 2, !0)} points`;
818
- }
819
- return H(
820
- l,
821
- l.bundle.priceWithTaxes ?? l.bundle.price
822
- );
823
- }
824
- function tt(l) {
825
- return H(
826
- l,
827
- l.bundle.originalPrice ?? l.bundle.price
828
- );
829
- }
830
- function at(l) {
831
- const [y, ...u] = l.bundle.taxTotals ?? [];
832
- if (!y) return null;
833
- const m = u.reduce(
834
- (R, C) => R + C.total.amount,
835
- y.total.amount
836
- );
837
- return H(l, {
838
- ...y.total,
839
- amount: m
840
- });
841
- }
842
- const nt = { class: "space-y-24 pr-12" }, ot = { class: "fm-typo-en-title-sm-800 mb-16" }, rt = {
843
- key: 0,
844
- class: "space-y-16"
845
- }, st = { class: "fm-typo-en-body-lg-600" }, lt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary break-words" }, it = {
846
- key: 1,
847
- class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
848
- }, ct = /* @__PURE__ */ oe({
849
- __name: "StoreTransactionDetailSheet",
850
- setup(l, { expose: y }) {
851
- const u = k(!1), m = k(null), { t: R } = re();
852
- function C(t, a) {
853
- u.value = t, m.value = a ?? null;
854
- }
855
- function N(t) {
856
- if (!t.location) return "Online Store";
857
- const a = Array.isArray(t.pf_location) ? t.pf_location[0] : t.pf_location;
858
- return (a == null ? void 0 : a.name) ?? t.location.toString();
859
- }
860
- function $(t) {
861
- return Array.isArray(t) ? t.flatMap((a) => typeof a != "object" || a === null || !("name" in a) || typeof a.name != "string" ? [] : [a.name]) : [];
862
- }
863
- function I(t, a, x, e) {
864
- if (t.length === a)
865
- return t.map((d) => x > 1 ? `${d} × ${x}` : d).join(", ");
866
- const o = a * x;
867
- return `${o} ${e}${o === 1 ? "" : "s"}`;
868
- }
869
- const g = B(() => {
870
- var e, o, d;
871
- const t = m.value;
872
- if (!t) return [];
873
- const a = t.pf_member, x = we(t, R);
874
- return [
875
- { label: "Transaction ID", value: t._id.toString() },
876
- {
877
- label: "Date/Time",
878
- value: M(L(t._id.toString())).format(
879
- "D MMM YYYY, hh:mmA"
880
- )
881
- },
882
- {
883
- label: "Status",
884
- value: W.title(t.refund ? "REFUNDED" : t.status)
885
- },
886
- {
887
- label: "Customer",
888
- value: (a == null ? void 0 : a.name) ?? (a == null ? void 0 : a.email) ?? (a == null ? void 0 : a.phoneNumber) ?? "Unknown"
889
- },
890
- { label: "Location", value: N(t) },
891
- {
892
- label: "Payment Type",
893
- value: ((e = t.paymentType) == null ? void 0 : e.type) === "COIN" || ((o = t.paymentType) == null ? void 0 : o.type) === "CARD" || !((d = t.paymentType) != null && d.type) ? x : W.title(x)
894
- },
895
- { label: "Reference", value: t.ref || "N/A" },
896
- ...t.paymentRef ? [{ label: "Payment Reference", value: t.paymentRef }] : [],
897
- {
898
- label: "Quantity",
899
- value: ne(t).toString()
900
- }
901
- ];
902
- }), v = B(() => {
903
- const t = m.value;
904
- return t ? [
905
- { label: "Bundle Name", value: t.bundle.name },
906
- {
907
- label: "Bundle Value",
908
- value: tt(t)
909
- },
910
- {
911
- label: "Base Subtotal",
912
- value: H(t, t.bundle.price)
913
- },
914
- {
915
- label: "Selling Price",
916
- value: ie(t)
917
- }
918
- ] : [];
919
- }), s = B(() => {
920
- var o;
921
- const t = m.value;
922
- if (!t) return [];
923
- const { bundle: a } = t, x = ne(t), e = [];
924
- if (a.credit.normal > 0 && e.push({
925
- label: "Credit",
926
- value: `${G(
927
- a.credit.normal * x,
928
- 2,
929
- !0
930
- )} credits`
931
- }), (o = a.credit.free) != null && o.amount) {
932
- const d = `${a.credit.free.day} day${a.credit.free.day === 1 ? "" : "s"}`;
933
- e.push({
934
- label: "Free Credit",
935
- value: `${G(
936
- a.credit.free.amount * x,
937
- 2,
938
- !0
939
- )} credits (${d})`
940
- });
941
- }
942
- return a.vouchers.length > 0 && e.push({
943
- label: "Vouchers",
944
- value: I(
945
- $(a.pf_vouchers),
946
- a.vouchers.length,
947
- x,
948
- "voucher"
949
- )
950
- }), a.titles.length > 0 && e.push({
951
- label: "Titles",
952
- value: I(
953
- $(a.pf_titles),
954
- a.titles.length,
955
- x,
956
- "title"
957
- )
958
- }), e;
959
- }), _ = B(() => {
960
- const t = m.value;
961
- if (!t) return [];
962
- const a = (t.bundle.taxTotals ?? []).map((e) => {
963
- var d;
964
- const o = (d = t.bundle._inclusiveTaxes) == null ? void 0 : d.some(
965
- (F) => F.systemCode === e.systemCode && F.inclusive
966
- );
967
- return {
968
- label: `${e.name} (${Ae(e.rate)}%, ${o ? "Inclusive" : "Exclusive"})`,
969
- value: H(t, e.total)
970
- };
971
- }), x = at(t);
972
- return x ? [...a, { label: "Tax Total", value: x }] : a;
973
- }), b = B(() => {
974
- var a;
975
- const t = (a = m.value) == null ? void 0 : a.giftCard;
976
- return t ? [
977
- { label: "Movement", value: W.title(t.movement) },
978
- {
979
- label: "Serial Number",
980
- value: t.serialNumber ?? (t.movement === "PURCHASE" ? "Pending card issuance" : "Not available")
981
- }
982
- ] : [];
983
- }), p = B(() => [
984
- { title: "Transaction", items: g.value },
985
- { title: "Bundle & Pricing", items: v.value },
986
- { title: "Rewards", items: s.value, emptyText: "No rewards" },
987
- { title: "Taxes", items: _.value, emptyText: "No taxes" },
988
- ...b.value.length ? [{ title: "Gift Card", items: b.value }] : []
989
- ]);
990
- return y({ showSheet: C }), (t, a) => {
991
- const x = Y("FmButton"), e = Y("FmSideSheet");
992
- return P(), le(e, {
993
- modelValue: c(u),
994
- "onUpdate:modelValue": a[1] || (a[1] = (o) => de(u) ? u.value = o : null),
995
- "max-width": 560,
996
- header: "Store Transaction Details"
997
- }, {
998
- "side-sheet-footer": te(() => [
999
- A(x, {
1000
- label: "Close",
1001
- variant: "tertiary",
1002
- onClick: a[0] || (a[0] = (o) => C(!1))
1003
- })
1004
- ]),
1005
- default: te(() => [
1006
- w("div", nt, [
1007
- (P(!0), E(q, null, ae(c(p), (o) => (P(), E("section", {
1008
- key: o.title
1009
- }, [
1010
- w("h3", ot, U(o.title), 1),
1011
- o.items.length ? (P(), E("div", rt, [
1012
- (P(!0), E(q, null, ae(o.items, (d) => (P(), E("div", {
1013
- key: d.label,
1014
- class: "flex flex-col gap-4"
1015
- }, [
1016
- w("div", st, U(d.label), 1),
1017
- w("div", lt, U(d.value), 1),
1018
- a[2] || (a[2] = w("hr", { class: "mt-3 border-fm-color-neutral-gray-100" }, null, -1))
1019
- ]))), 128))
1020
- ])) : (P(), E("div", it, U(o.emptyText), 1))
1021
- ]))), 128))
1022
- ])
1023
- ]),
1024
- _: 1
1025
- }, 8, ["modelValue"]);
1026
- };
1027
- }
1028
- }), ut = { class: "flex items-center justify-between" }, mt = { class: "flex gap-8 items-center" }, dt = { class: "flex gap-8 items-center xs:hidden" }, qt = /* @__PURE__ */ oe({
1029
- __name: "StoreTransactions",
1030
- props: {
1031
- user: {
1032
- type: String
1033
- }
1034
- },
1035
- setup(l) {
1036
- const y = l, { minor: u } = _e, { t: m } = re();
1037
- function R(e) {
1038
- return we(e, m);
1039
- }
1040
- function C(e) {
1041
- return M(L(e._id.toString())).format(
1042
- "D MMM YYYY, hh:mmA"
1043
- );
1044
- }
1045
- function N(e) {
1046
- var o, d;
1047
- return e.location ? ((d = (o = e.pf_location) == null ? void 0 : o[0]) == null ? void 0 : d.name) ?? e.location.toString() : "Online Store";
1048
- }
1049
- const $ = [
1050
- {
1051
- header: "Transaction ID",
1052
- meta: {
1053
- maxWidth: "150px"
1054
- },
1055
- cell(e) {
1056
- return i("div", { class: "flex items-center" }, [
1057
- i(T.FmIcon, {
1058
- name: "content_copy",
1059
- outline: !0,
1060
- size: "sm",
1061
- class: "cursor-pointer mr-4 shrink-0",
1062
- onClick: (o) => {
1063
- o.preventDefault(), o.stopPropagation(), ce(e.row.original._id.toString());
1064
- }
1065
- }),
1066
- i("div", { class: "truncate" }, e.row.original._id.toString())
1067
- ]);
1068
- }
1069
- },
1070
- {
1071
- header: "Created at",
1072
- accessorFn: C,
1073
- enableSorting: !0
1074
- },
1075
- {
1076
- header: "Bundle",
1077
- accessorFn: (e) => e.bundle.name
1078
- },
1079
- {
1080
- header: "Selling Price",
1081
- cell: (e) => ie(e.row.original)
1082
- },
1083
- {
1084
- header: "Location",
1085
- accessorFn: N
1086
- },
1087
- {
1088
- header: "Payment Type",
1089
- accessorFn: R,
1090
- cell(e) {
1091
- var o;
1092
- return i("div", { class: "flex items-center gap-4" }, [
1093
- i("div", { class: "flex items-center" }, [
1094
- ((o = e.row.original.paymentType) == null ? void 0 : o.type) == "ONLINE" && e.row.original.paymentType.extra ? i(
1095
- T.FmTooltip,
1096
- {
1097
- content: e.row.original.paymentType.extra
1098
- },
1099
- [
1100
- i(T.FmIcon, {
1101
- name: "info",
1102
- outline: !0,
1103
- size: "sm"
1104
- })
1105
- ]
1106
- ) : i("div")
1107
- ]),
1108
- i("div", { class: "flex-1" }, R(e.row.original))
1109
- ]);
1110
- }
1111
- },
1112
- {
1113
- header: "User",
1114
- cell: (e) => be(e.row.original.pf_member)
1115
- },
1116
- {
1117
- header: "Phone No.",
1118
- accessorFn: (e) => e.pf_member.phoneNumber
1119
- },
1120
- {
1121
- header: "Status",
1122
- // accessorFn: (u) => u.status,
1123
- cell(e) {
1124
- var F, D, r, n;
1125
- const o = e.row.original.status, d = {
1126
- COMPLETED: "text-fm-color-typo-success bg-fm-color-system-success-100",
1127
- REFUNDED: "text-fm-color-typo-warning bg-fm-color-system-warning-100"
1128
- };
1129
- return i("div", { class: "flex items-center gap-4" }, [
1130
- i(T.FmChip, {
1131
- label: W.title(o),
1132
- variant: "plain",
1133
- class: d[o] ?? ""
1134
- }),
1135
- (D = (F = e.row.original) == null ? void 0 : F.refund) != null && D.reason ? i(
1136
- T.FmTooltip,
1137
- {
1138
- content: (n = (r = e.row.original) == null ? void 0 : r.refund) == null ? void 0 : n.reason
1139
- },
1140
- [
1141
- i(T.FmIcon, {
1142
- name: "info",
1143
- color: "primary",
1144
- outline: !0,
1145
- size: "sm"
1146
- })
1147
- ]
1148
- ) : null
1149
- ]);
1150
- }
1151
- },
1152
- {
1153
- header: "Source",
1154
- accessorFn: (e) => e.source
1155
- },
1156
- {
1157
- header: "Ref",
1158
- accessorFn: (e) => e.ref
1159
- },
1160
- {
1161
- id: "action",
1162
- cell(e) {
1163
- const o = e.row.original, d = o.status === "COMPLETED" && !o.refund && o.source == "ADMIN";
1164
- return d ? i(
1165
- T.FmMenu,
1166
- {
1167
- placement: "bottom-end",
1168
- onClick: (F) => {
1169
- F.stopPropagation();
1170
- }
1171
- },
1172
- {
1173
- "menu-button": () => i(T.FmButton, {
1174
- icon: "settings",
1175
- variant: "tertiary",
1176
- if: d
1177
- }),
1178
- default: () => [
1179
- i(T.FmMenuItem, {
1180
- label: "Refund",
1181
- sublabel: "Refund this transaction",
1182
- onClick: async (F) => {
1183
- F.stopPropagation(), await p(o);
1184
- }
1185
- })
1186
- ]
1187
- }
1188
- ) : i("div");
1189
- }
1190
- }
1191
- ], I = k({
1192
- searchValue: "",
1193
- dateRange: {
1194
- startDate: M().subtract(7, "day").toISOString(),
1195
- endDate: M().toISOString()
1196
- }
1197
- }), { tableMeta: g, rowData: v, onSort: s, debouncedFetchData: _, onSearch: b } = Ne(async (e) => {
1198
- const o = {
1199
- ...I.value.dateRange,
1200
- user: y.user
1201
- };
1202
- return await j.readStoreTransactions(e, o);
1203
- });
1204
- async function p(e) {
1205
- await he.confirm(
1206
- "Are you sure you want to refund this transaction?",
1207
- "Refund Store Transaction",
1208
- "Confirm",
1209
- "Cancel"
1210
- ) && await u(
1211
- async () => {
1212
- var d;
1213
- await Ee.refundStoreTransaction({
1214
- id: e._id,
1215
- reason: `ADMIN:${(d = $e().sessionUser) == null ? void 0 : d.name}`
1216
- }), await _();
1217
- },
1218
- {
1219
- message: "Refunding transaction...",
1220
- successMessage: "Transaction refunded successfully"
1221
- }
1222
- );
1223
- }
1224
- pe(
1225
- I,
1226
- () => {
1227
- _();
1228
- },
1229
- { deep: !0 }
1230
- ), De(async () => {
1231
- await _();
1232
- });
1233
- const t = async () => Pe({
1234
- exporter: new et(),
1235
- readFunction: (e) => j.readStoreTransactions(e, {
1236
- ...I.value.dateRange,
1237
- user: y.user
1238
- }),
1239
- transformRecord: (e) => {
1240
- var o, d, F, D;
1241
- return {
1242
- "Transaction ID": e._id.toString(),
1243
- "Created at": C(e),
1244
- Bundle: e.bundle.name || "",
1245
- "Selling Price": ie(e),
1246
- Location: N(e),
1247
- "Payment Type": R(e),
1248
- "Payment Extra": ((o = e.paymentType) == null ? void 0 : o.extra) || "",
1249
- User: ((d = e.pf_member) == null ? void 0 : d.name) || "",
1250
- "Phone No.": ((F = e.pf_member) == null ? void 0 : F.phoneNumber) || "",
1251
- Status: W.title(e.status),
1252
- "Refund Reason": ((D = e.refund) == null ? void 0 : D.reason) || "",
1253
- Source: e.source,
1254
- Ref: (e == null ? void 0 : e.ref) || ""
1255
- };
1256
- },
1257
- filename: "store-transactions"
1258
- }), a = k(null);
1259
- function x(e) {
1260
- var o;
1261
- (o = a.value) == null || o.showSheet(!0, e.original);
1262
- }
1263
- return (e, o) => {
1264
- const d = Y("FmSearch"), F = Y("FmButton");
1265
- return P(), E("div", null, [
1266
- w("div", ut, [
1267
- w("div", mt, [
1268
- A(ge, {
1269
- modelValue: c(I).dateRange,
1270
- "onUpdate:modelValue": o[0] || (o[0] = (D) => c(I).dateRange = D)
1271
- }, null, 8, ["modelValue"])
1272
- ]),
1273
- w("div", dt, [
1274
- A(d, {
1275
- modelValue: c(g).searchValue,
1276
- "onUpdate:modelValue": [
1277
- o[1] || (o[1] = (D) => c(g).searchValue = D),
1278
- c(b)
1279
- ],
1280
- placeholder: "Search",
1281
- collapsible: ""
1282
- }, null, 8, ["modelValue", "onUpdate:modelValue"]),
1283
- A(F, {
1284
- icon: "ios_share",
1285
- variant: "tertiary",
1286
- onClick: t
1287
- })
1288
- ])
1289
- ]),
1290
- A(ve, {
1291
- loading: c(g).isLoading,
1292
- "row-data": c(v),
1293
- "row-count": c(g).totalRows,
1294
- "column-defs": $.filter(
1295
- (D) => !y.user || D.header !== "User" && D.header !== "Phone No."
1296
- ),
1297
- "page-count": c(g).pageCount,
1298
- "page-index": c(g).pageIndex,
1299
- "page-size": c(g).pageSize,
1300
- "shrink-at": !1,
1301
- onSortChange: c(s),
1302
- onRowClick: x,
1303
- onPageChange: o[2] || (o[2] = (D) => c(_)({
1304
- pageSize: D.pageSize,
1305
- pageIndex: D.pageIndex
1306
- }))
1307
- }, null, 8, ["loading", "row-data", "row-count", "column-defs", "page-count", "page-index", "page-size", "onSortChange"]),
1308
- A(ct, {
1309
- ref_key: "transactionDetailSheet",
1310
- ref: a
1311
- }, null, 512)
1312
- ]);
1313
- };
1314
- }
1315
- });
1316
- export {
1317
- Wt as _,
1318
- qt as a
1319
- };