@feedmepos/mf-connect 0.1.114-prod → 0.1.115-dev

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