@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
@@ -0,0 +1,1264 @@
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-IZRfmmde.js";
4
+ import "./index-BYI9ttxy.js";
5
+ import { T as E } from "./transaction.fn-BY0hzon0.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-DSqVY91w.js";
9
+ import { s as J } from "./index-CuvNtC_M.js";
10
+ import { f as L, F as De } from "./number-DJ6ncfT6.js";
11
+ import { u as ge } from "./business-Ce8vq3wQ.js";
12
+ import { _ as ye, u as Fe } from "./usePagination-QT552XyF.js";
13
+ import { c as ie, p as Ne } from "./plugins-DQNOWwRC.js";
14
+ import { g as ve } from "./user-CmAxNc7T.js";
15
+ import { B as he, e as Ae } from "./base.export-R97FrSQL.js";
16
+ import { u as be } from "./campaign-BTllt2LH.js";
17
+ import "./index-B8meeQoD.js";
18
+ import "./index-CPODug8b.js";
19
+ import "./index-CqOCJTeR.js";
20
+ import "./index-BW6eb3n6.js";
21
+ import "./index-D4d3l0gw.js";
22
+ import "./index-B8yWVB8P.js";
23
+ import { u as ne } from "./vue-i18n-Cze706-f.js";
24
+ import { o as Y } from "./objectId-dwaoBfJX.js";
25
+ import { u as xe } from "./loading-BvHm1m3K.js";
26
+ import { w as Pe } from "./xlsx-DAczoc8y.js";
27
+ import { useRouter as ke } from "vue-router";
28
+ import { t as te } from "./index-BVdYxi3l.js";
29
+ import { R as X } from "./app-DdNKsn2Q.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-DmlguGIM.js";
33
+ import { m as Ve } from "./index-BDPnyro2.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
+ };