@feedmepos/mf-connect 0.1.104-prod → 0.1.105-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 (126) hide show
  1. package/dist/{App-B4UWz7ir.js → App-Bb5yBnOB.js} +10 -9
  2. package/dist/{Bin-D_eSutW-.js → Bin-DXIYjMm_.js} +8 -8
  3. package/dist/{Broadcast-DDQE_RLR.js → Broadcast-BpcvdGj_.js} +11 -11
  4. package/dist/CampaignAnalytic-BDqEZmHy.js +1830 -0
  5. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-D2cTNgaS.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BBiIrN0a.js} +6 -6
  6. package/dist/{Card-CPozdg3m.js → Card-D2sggPws.js} +19 -19
  7. package/dist/{Collections-IrwF5bWH.js → Collections-BdZU2wR5.js} +9 -9
  8. package/dist/{Credit-BVXpy5tw.js → Credit-DeDCjtcp.js} +118 -93
  9. package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-DEwMzs6L.js +53 -0
  10. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-CCe1rp0f.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-DbukUBK2.js} +815 -609
  11. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-DwP64fmL.js → EffectSheet.vue_vue_type_style_index_0_lang-BNOrfkpI.js} +12 -12
  12. package/dist/{Experience-BR1JXdH5.js → Experience-CT_3fZPR.js} +109 -84
  13. package/dist/{FileSaver.min-CX-3gU49.js → FileSaver.min-C3sYNQw3.js} +1 -1
  14. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-3bH-tZAm.js +138 -0
  15. package/dist/Game-C4v96zEu.js +355 -0
  16. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-q5fF5d7d.js → ImageInput.vue_vue_type_script_setup_true_lang-6PmRI47X.js} +1 -1
  17. package/dist/{Index--Xl_8CFP.js → Index-C5DRA08U.js} +10 -10
  18. package/dist/{LocationPicker.vue_vue_type_script_setup_true_lang-C-xW5Tw8.js → LocationPicker.vue_vue_type_script_setup_true_lang-BXcpCtHI.js} +1 -1
  19. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-DGVqQz1j.js → LottieAnimation.vue_vue_type_script_setup_true_lang-C8dm05l2.js} +1 -1
  20. package/dist/LoyaltyDashboard-BCPojLdm.js +2865 -0
  21. package/dist/{MainLayout-DB_Y2C3K.js → MainLayout-p92jJ4Mp.js} +3 -3
  22. package/dist/{Marketing-CjAGzfL7.js → Marketing-Z-TiSgs6.js} +4 -4
  23. package/dist/{MarketingMaterialEdit-BoF6kTOz.js → MarketingMaterialEdit-CS-hcbGU.js} +6 -6
  24. package/dist/{Member-DnypOK2I.js → Member-DwY0tXwr.js} +7 -7
  25. package/dist/MemberDetailSheet.vue_vue_type_script_setup_true_lang-DDSBw1sL.js +1286 -0
  26. package/dist/{MemberImportHistory-BJSyT6Ys.js → MemberImportHistory-BN85ZxpX.js} +8 -8
  27. package/dist/MemberList-DaIJCa_0.js +336 -0
  28. package/dist/{MemberTransactions-CbPxUrtd.js → MemberTransactions-DrgA6jX1.js} +1 -1
  29. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-CVzfjs9D.js → MessageInput.vue_vue_type_script_setup_true_lang-rl8Sr_zl.js} +11 -11
  30. package/dist/MetricInfoTooltip.vue_vue_type_script_setup_true_lang-lGB6WCj6.js +40 -0
  31. package/dist/Mission-BFBmJTjP.js +359 -0
  32. package/dist/{Overview-BW2_y1_7.js → Overview-DaZA6Oxr.js} +5 -5
  33. package/dist/{Overview-DZxRuA5F.js → Overview-DtiqH8iJ.js} +19 -19
  34. package/dist/Point-DeaTc_Gj.js +287 -0
  35. package/dist/Promotion-BBIylJxt.js +417 -0
  36. package/dist/{Queue-CSF9M_Lc.js → Queue-WsDiZkdN.js} +11 -11
  37. package/dist/{Record-B-HdI5A4.js → Record-CzD7sYYG.js} +10 -10
  38. package/dist/{Review-D6RQbcP6.js → Review-BkPHrt33.js} +2 -2
  39. package/dist/{ReviewFacebookCallback-CkULwhF-.js → ReviewFacebookCallback-Bu8j9CLF.js} +5 -5
  40. package/dist/{ReviewGoogleCallback-DgPEXV_R.js → ReviewGoogleCallback-Bh3R06MN.js} +5 -5
  41. package/dist/{Reward-CZvM6GQ9.js → Reward-BHe9y1VN.js} +17 -17
  42. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-C1y2_pHY.js → RewardGroup.vue_vue_type_script_setup_true_lang-DVNknaoM.js} +12 -12
  43. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-Cvo6a7Nw.js → RuleGroup.vue_vue_type_script_setup_true_lang-DAXfiO8F.js} +279 -286
  44. package/dist/{Segment-D2bXEF1U.js → Segment-CjaPWdMt.js} +24 -24
  45. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-Ytimazjg.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-srMHsTa6.js} +12 -12
  46. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-Bn1IWAd_.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-C5taZCvV.js} +4 -4
  47. package/dist/{Setting-DelduRrh.js → Setting-Dr_lawoc.js} +57 -57
  48. package/dist/{SettingAdvertisements-gTDg1C60.js → SettingAdvertisements-BXJd1btw.js} +13 -13
  49. package/dist/{Settings-VUEo9wwx.js → Settings-DPJq4qbw.js} +5 -5
  50. package/dist/{Store-CXQZirbg.js → Store-BNq7oK2B.js} +22 -22
  51. package/dist/{StoreRewards-BDuZPA8S.js → StoreRewards-WExx61kV.js} +16 -16
  52. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-C-yqZEn4.js → StoreTransactions.vue_vue_type_script_setup_true_lang-BaqyPTXc.js} +327 -386
  53. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-BayrgH7m.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-CnCHFZL3.js} +2 -2
  54. package/dist/{Tier-DtPE4IJ5.js → Tier-BSLPHzsj.js} +102 -102
  55. package/dist/{Title-DNCnQeeR.js → Title-BQ_CVnIN.js} +22 -22
  56. package/dist/{Transaction-BkUaCGwl.js → Transaction-CvyyRq8P.js} +2 -2
  57. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-B7TY_AGp.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-ByHFu7ry.js} +6 -6
  58. package/dist/{Voucher-BBuB9tf8.js → Voucher-DQ-yXZAC.js} +143 -121
  59. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-Bu09bIut.js → VoucherEditor.vue_vue_type_script_setup_true_lang-BB0n73WF.js} +115 -121
  60. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-BSKpAMJL.js → ZodTextField.vue_vue_type_script_setup_true_lang-nnWYrHgL.js} +2 -2
  61. package/dist/{app-CSLQmdYA.js → app-BxM9Ghdm.js} +27795 -25657
  62. package/dist/app.js +1 -1
  63. package/dist/{business-okSb42At.js → business-nbLS8l9h.js} +1 -1
  64. package/dist/{campaign-V7nlCdxR.js → campaign-C_IR2u8a.js} +49 -48
  65. package/dist/{campaign-Ck9GwZdI.js → campaign-Ki9WAmYl.js} +2 -2
  66. package/dist/{campaign.enum-BQ5khvqI.js → campaign.enum-CtgtWycO.js} +1 -1
  67. package/dist/{campaign.fn-DMDpxVSZ.js → campaign.fn-CJOfTzI6.js} +32 -32
  68. package/dist/{collectible.enum-lKz3vTQM.js → collectible.enum-a5dfnH3M.js} +1 -1
  69. package/dist/{collection.fn-BH5cqMNy.js → collection.fn-Cc-luweq.js} +2 -2
  70. package/dist/{effect-pUpfqkCF.js → effect-D66eImId.js} +1 -1
  71. package/dist/{email-addresses-CzBv1fzv.js → email-addresses-DNHwCrI5.js} +2 -2
  72. package/dist/{export-Du7ZAv-8.js → export-Bp-Fwp-h.js} +3 -3
  73. package/dist/{helper-BpthZPU4.js → helper-BpHRMtgf.js} +1 -1
  74. package/dist/{index-DSltrIkA.js → index-B8cXkkGF.js} +1 -1
  75. package/dist/{timezone-DYWqfGTu.js → index-BPV5Dkjl.js} +105 -122
  76. package/dist/{index-D7PksEV2.js → index-BdqanLnJ.js} +675 -677
  77. package/dist/{index-CWAdNVKN.js → index-BnH5UiZx.js} +6 -6
  78. package/dist/{index-v8QQ-4ZP.js → index-C1Bp0PPS.js} +10 -10
  79. package/dist/{index-BhuD1NhH.js → index-CA5atWo4.js} +1 -1
  80. package/dist/{index-ZTYDfSkT.js → index-CZ-SWULS.js} +4 -5
  81. package/dist/{index-CGK1kSCt.js → index-DB13tnmJ.js} +3 -3
  82. package/dist/{index-C0JgU0Z2.js → index-DFLwgFnq.js} +1 -1
  83. package/dist/{index-DCp9k5BB.js → index-DVcOSnAP.js} +2 -2
  84. package/dist/{index-DNdHiAXR.js → index-Dj3FzUo_.js} +18 -2
  85. package/dist/{index-CN5Zoynf.js → index-DyllcNwd.js} +2 -2
  86. package/dist/{index-OaZRtKP_.js → index-JU7Ed3Ex.js} +5 -5
  87. package/dist/{index--6uUWSMc.js → index-Oeiw4Epg.js} +1 -1
  88. package/dist/{index-izVlVA8-.js → index-VzLsGqcm.js} +1 -1
  89. package/dist/{index-DPgGmpyL.js → index-nUrA9Q7e.js} +9 -9
  90. package/dist/{index.esm2017-mpnkyDRb.js → index.esm2017-32NtkXiv.js} +34 -34
  91. package/dist/{loading-BG3Pj6qz.js → loading-CLZ5IFPe.js} +1 -1
  92. package/dist/{lodash-BfDdt-c9.js → lodash-k98YPjFm.js} +1 -1
  93. package/dist/{member-import-BNFdZ3Df.js → member-import-CxNPNPh5.js} +1 -1
  94. package/dist/membership-CjqXHl0l.js +274 -0
  95. package/dist/{money-CRftC-F0.js → money-zJomyMyN.js} +1 -1
  96. package/dist/{number-z7YZyGFS.js → number-BfHmokvl.js} +1 -1
  97. package/dist/object-BYyQ0PZp.js +18 -0
  98. package/dist/{objectid-BKMqp_oR.js → objectid-g-s-CuBk.js} +6 -6
  99. package/dist/{plugins-CWeDGuzy.js → plugins-DNZv50xL.js} +87 -87
  100. package/dist/{reward-BVTKTGi6.js → reward-BefNUdd_.js} +1 -1
  101. package/dist/{rule-YhhCOals.js → rule-DkLIl8GM.js} +3 -3
  102. package/dist/{rule-builder-ae8A0qoi.js → rule-builder-BVyNMiE8.js} +1 -1
  103. package/dist/style.css +1 -1
  104. package/dist/{template-CQrM_0hz.js → template-BmSOVHcp.js} +7 -7
  105. package/dist/timezone-DoX-vj_6.js +20 -0
  106. package/dist/transaction.fn-D15eS4nB.js +64 -0
  107. package/dist/{trigger-Clo3vSjw.js → trigger-BhReH6kZ.js} +5 -5
  108. package/dist/{useMarketingMaterialActions-HyqIT94N.js → useMarketingMaterialActions-DdcVqSlV.js} +3 -3
  109. package/dist/{usePagination-CWRrkbFL.js → usePagination-rx2JFS-5.js} +1 -1
  110. package/dist/{user-MVk5s412.js → user-B4gZia2L.js} +1 -1
  111. package/dist/{vue-i18n-BN9KLJoz.js → vue-i18n-JLM70-gr.js} +201 -201
  112. package/dist/{xlsx-s0BxKsa_.js → xlsx-CuKZcLfT.js} +440 -440
  113. package/dist/{zod-H4l78-by.js → zod-ByE_90T4.js} +1 -1
  114. package/package.json +3 -4
  115. package/dist/Analytic-1rqyus1X.js +0 -428
  116. package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-eIoPtgO5.js +0 -58
  117. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js +0 -129
  118. package/dist/Game-8nvdSkbi.js +0 -330
  119. package/dist/MemberList-Bf_XyoxW.js +0 -1602
  120. package/dist/Mission-DE4O6XM6.js +0 -334
  121. package/dist/Point-BMEe6duo.js +0 -262
  122. package/dist/Promotion-lamxp48U.js +0 -392
  123. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-BxOEEr9-.js +0 -181
  124. package/dist/dto-GksE6pni.js +0 -216
  125. package/dist/membership-tNeaKAeS.js +0 -255
  126. package/dist/object-qECH92oz.js +0 -26
@@ -0,0 +1,1286 @@
1
+ import { defineComponent as ae, computed as O, ref as L, resolveComponent as A, openBlock as i, createElementBlock as w, Fragment as Y, createElementVNode as r, unref as t, createBlock as I, createCommentVNode as oe, createVNode as g, renderList as Q, withCtx as se, createTextVNode as ye, toDisplayString as M, withDirectives as Ee, vShow as Ve, watch as Te, onBeforeMount as Ie, h as le, onMounted as Be, isRef as De, normalizeClass as Ye } from "vue";
2
+ import { h } from "./moment-D7p2TMB-.js";
3
+ import { c as Ue } from "./index-DyllcNwd.js";
4
+ import { u as $e, C as Se, s as Ne } from "./membership-CjqXHl0l.js";
5
+ import { useDialog as Ce, components as we } from "@feedmepos/ui-library";
6
+ import { _ as Fe } from "./lodash-k98YPjFm.js";
7
+ import { D as Oe } from "./type_drinks-D6jnpvwV.js";
8
+ import { c as Pe, d as Re, e as je, f as Le, g as qe } from "./index-BdqanLnJ.js";
9
+ import "./index-JU7Ed3Ex.js";
10
+ import { c as Me, f as ke } from "./string-Gcy5IM_H.js";
11
+ import { u as ze } from "./loading-CLZ5IFPe.js";
12
+ import { p as Ae } from "./plugins-DNZv50xL.js";
13
+ import { C as _e } from "./collection.fn-Cc-luweq.js";
14
+ import { defineStore as Ge } from "pinia";
15
+ import { u as He } from "./business-nbLS8l9h.js";
16
+ import { f as te } from "./number-BfHmokvl.js";
17
+ import "./index-nUrA9Q7e.js";
18
+ import "./index-C1Bp0PPS.js";
19
+ import "./index-DB13tnmJ.js";
20
+ import "./index-Oeiw4Epg.js";
21
+ import { s as Ke } from "./index-CuvNtC_M.js";
22
+ import { u as We, _ as Xe } from "./usePagination-rx2JFS-5.js";
23
+ import { B as Je, e as Qe } from "./export-Bp-Fwp-h.js";
24
+ import { m as ve } from "./index-CZ-SWULS.js";
25
+ import { o as ge } from "./objectId-dwaoBfJX.js";
26
+ import { F as he } from "./collectible.enum-a5dfnH3M.js";
27
+ import { g as Ze, b as et } from "./campaign-C_IR2u8a.js";
28
+ import { useRouter as tt } from "vue-router";
29
+ import { m as fe } from "./index-DVcOSnAP.js";
30
+ import { t as ot } from "./index-CA5atWo4.js";
31
+ import { R as rt } from "./app-BxM9Ghdm.js";
32
+ const nt = { class: "flex flex-col" }, st = { key: 1 }, lt = { class: "flex flex-nowrap gap-4 items-center my-[-4px]" }, at = { class: "flex flex-nowrap gap-8 items-center pt-24 w-full" }, it = /* @__PURE__ */ ae({
33
+ __name: "MemberStatsDialog",
34
+ props: {
35
+ member: {
36
+ type: Object,
37
+ required: !0
38
+ },
39
+ onSubmit: {
40
+ type: Function,
41
+ required: !0
42
+ }
43
+ },
44
+ setup(m) {
45
+ var ie, re, q, ne;
46
+ const F = Ce(), f = $e(), y = m, s = O(
47
+ () => {
48
+ var p;
49
+ return (((p = y.member.collection) == null ? void 0 : p.TITLE) ?? []).reduce(
50
+ (l, S) => {
51
+ var P, z, N, D, H;
52
+ const _ = f.sortedTitles.find(
53
+ (Z) => Z._id.toString() === S.collectible
54
+ );
55
+ if (!_) return l;
56
+ const B = [...S.expiryBalance ?? []].sort(
57
+ (Z, R) => h(Z.expiredAt).isAfter(h(R.expiredAt)) ? -1 : 1
58
+ );
59
+ return (P = B[0]) != null && P.expiredAt && h((z = B[0]) == null ? void 0 : z.expiredAt).isBefore(h()) || l.push({
60
+ _id: _._id,
61
+ name: _.name,
62
+ expiredAt: (N = B[0]) != null && N.expiredAt ? h((D = B[0]) == null ? void 0 : D.expiredAt).toISOString() : "",
63
+ expiresIn: h((H = B[0]) == null ? void 0 : H.expiredAt).diff(h(), "days")
64
+ }), l;
65
+ },
66
+ []
67
+ );
68
+ }
69
+ ), o = L({
70
+ cardNo: y.member.cardNo,
71
+ experience: ((re = (ie = y.member.collection) == null ? void 0 : ie.POINT) == null ? void 0 : re[0].balance) ?? 0,
72
+ tier: ((ne = (q = y.member.collection) == null ? void 0 : q.TIER) == null ? void 0 : ne[0].balance) ?? -1,
73
+ titles: s.value.map((p) => ({ expiredAt: p.expiresIn, id: p._id })) ?? void 0
74
+ }), u = O(
75
+ () => (f.sortedTitles ?? []).map((p) => ({
76
+ label: p.name,
77
+ value: p._id.toString(),
78
+ sublabel: s.value.some((l) => l._id === p._id) ? "Owned" : void 0
79
+ }))
80
+ ), d = O(() => (f.sortedTiers ?? []).map((p, l) => ({
81
+ label: p.name,
82
+ sublabel: `${p.option.from} - ${p.option.to}`,
83
+ from: p.option.from,
84
+ to: p.option.to,
85
+ value: l + 1
86
+ })));
87
+ function x() {
88
+ var S, _;
89
+ const p = ((S = d.value[(o.value.tier ?? 1) - 1]) == null ? void 0 : S.from) ?? 0, l = (_ = d.value[(o.value.tier ?? 1) - 1]) == null ? void 0 : _.to;
90
+ o.value.experience = Math.min(
91
+ l ?? p,
92
+ Math.max(p, o.value.experience ?? 0)
93
+ );
94
+ }
95
+ const a = O(() => {
96
+ var S, _, B, P, z, N;
97
+ const p = ((_ = (S = y.member.collection) == null ? void 0 : S.TIER) == null ? void 0 : _[0].balance) ?? -1, l = ((P = (B = y.member.collection) == null ? void 0 : B.POINT) == null ? void 0 : P[0].balance) ?? 0;
98
+ if (p != o.value.tier) return !0;
99
+ if (o.value.experience && o.value.experience != l) {
100
+ const D = ((z = d.value[p - 1]) == null ? void 0 : z.from) ?? 0, H = ((N = d.value[p - 1]) == null ? void 0 : N.to) ?? 0;
101
+ if (o.value.experience < D || H && o.value.experience > H)
102
+ return !0;
103
+ }
104
+ return !1;
105
+ });
106
+ function b(p) {
107
+ var l;
108
+ return (l = s.value.find((S) => S._id === p)) == null ? void 0 : l.expiresIn;
109
+ }
110
+ const k = O(() => {
111
+ const p = Pe.safeParse(o.value);
112
+ return p.success ? void 0 : p.error.errors;
113
+ });
114
+ function $(p) {
115
+ var l, S;
116
+ return (S = (l = k.value) == null ? void 0 : l.find((_) => _.path.join(".") === p)) == null ? void 0 : S.message;
117
+ }
118
+ function G(p) {
119
+ var l;
120
+ return (l = k.value) == null ? void 0 : l.filter((S) => S.path.join(".").startsWith(p)).map((S) => S.message);
121
+ }
122
+ async function U() {
123
+ await y.onSubmit(o.value), F.close();
124
+ }
125
+ return (p, l) => {
126
+ var Z, R;
127
+ const S = A("FmSelect"), _ = A("FmStepperField"), B = A("FmTextField"), P = A("FmField"), z = A("FmFormGroup"), N = A("FmButton"), D = A("FmHelperText"), H = A("FmSpacer");
128
+ return i(), w(Y, null, [
129
+ r("div", nt, [
130
+ l[6] || (l[6] = r("div", { class: "fm-typo-en-title-sm-800 mb-8" }, "Member tiering", -1)),
131
+ t(d).length ? (i(), I(S, {
132
+ key: 0,
133
+ modelValue: t(o).tier,
134
+ "onUpdate:modelValue": [
135
+ l[0] || (l[0] = (C) => t(o).tier = C),
136
+ x
137
+ ],
138
+ label: "Member Tier",
139
+ items: t(d),
140
+ "helper-text": $("tier"),
141
+ "helper-state": $("tier") ? "error" : void 0
142
+ }, null, 8, ["modelValue", "items", "helper-text", "helper-state"])) : oe("", !0),
143
+ g(_, {
144
+ "model-value": t(o).experience ?? 0,
145
+ "onUpdate:modelValue": l[1] || (l[1] = (C) => t(o).experience = C),
146
+ label: "Member Experience",
147
+ "max-fraction-digits": 0,
148
+ "helper-text": $("experience"),
149
+ "helper-state": $("experience") ? "error" : void 0
150
+ }, null, 8, ["model-value", "helper-text", "helper-state"]),
151
+ l[7] || (l[7] = r("div", { class: "fm-typo-en-title-sm-800 mt-16 mb-8" }, "Member Card", -1)),
152
+ g(B, {
153
+ modelValue: t(o).cardNo,
154
+ "onUpdate:modelValue": l[2] || (l[2] = (C) => t(o).cardNo = C),
155
+ label: "Card number",
156
+ "helper-text": $("cardNo"),
157
+ "helper-state": $("cardNo") ? "error" : void 0
158
+ }, null, 8, ["modelValue", "helper-text", "helper-state"]),
159
+ l[8] || (l[8] = r("div", { class: "fm-typo-en-title-sm-800 mt-16 mb-8" }, "Titles", -1)),
160
+ (Z = t(o).titles) != null && Z.length ? (i(), w("div", st, [...l[5] || (l[5] = [
161
+ r("div", { class: "flex flex-nowrap gap-4 items-center" }, [
162
+ r("div", { class: "flex-1" }, "Title"),
163
+ r("div", { class: "flex-1" }, "Expires in days"),
164
+ r("div", { class: "w-24 h-1" })
165
+ ], -1)
166
+ ])])) : oe("", !0),
167
+ (i(!0), w(Y, null, Q(t(o).titles ?? [], (C, K) => (i(), w("div", { key: K }, [
168
+ r("div", lt, [
169
+ t(s).some((n) => n._id === C.id) ? (i(), I(z, {
170
+ key: 1,
171
+ "model-value": "",
172
+ class: "flex-1"
173
+ }, {
174
+ default: se(() => [
175
+ g(P, {
176
+ disabled: !0,
177
+ class: "text-fm-color-typo-secondary"
178
+ }, {
179
+ default: se(() => {
180
+ var n;
181
+ return [
182
+ ye(M((n = t(u).find((e) => e.value === C.id)) == null ? void 0 : n.label), 1)
183
+ ];
184
+ }),
185
+ _: 2
186
+ }, 1024)
187
+ ]),
188
+ _: 2
189
+ }, 1024)) : (i(), I(S, {
190
+ key: 0,
191
+ modelValue: C.id,
192
+ "onUpdate:modelValue": [(n) => C.id = n, (n) => C.expiredAt = b(n) ?? 1],
193
+ class: "flex-1",
194
+ items: t(u).filter(
195
+ (n) => {
196
+ var e;
197
+ return !((e = t(o).titles) != null && e.map((c) => c.id).includes(n.value)) || C.id === n.value;
198
+ }
199
+ )
200
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "items"])),
201
+ g(_, {
202
+ modelValue: C.expiredAt,
203
+ "onUpdate:modelValue": (n) => C.expiredAt = n,
204
+ class: "flex-1",
205
+ label: "",
206
+ "max-fraction-digits": 0,
207
+ min: 0,
208
+ max: 9999,
209
+ step: 1
210
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]),
211
+ g(N, {
212
+ class: "w-24 h-24",
213
+ icon: "close",
214
+ variant: "tertiary",
215
+ onClick: (n) => {
216
+ var e;
217
+ return (e = t(o).titles) == null ? void 0 : e.splice(K, 1);
218
+ }
219
+ }, null, 8, ["onClick"])
220
+ ]),
221
+ (i(!0), w(Y, null, Q(G(`titles.${K}`), (n, e) => (i(), I(D, {
222
+ key: e,
223
+ class: "items-center",
224
+ state: "error",
225
+ text: n.toString()
226
+ }, null, 8, ["text"]))), 128))
227
+ ]))), 128)),
228
+ t(u).length && (((R = t(o).titles) == null ? void 0 : R.length) ?? 0) < t(u).length ? (i(), I(N, {
229
+ key: 2,
230
+ icon: "add",
231
+ label: "Give title",
232
+ variant: "plain",
233
+ onClick: l[3] || (l[3] = (C) => {
234
+ var K;
235
+ return t(o).titles = [
236
+ ...t(o).titles ?? [],
237
+ {
238
+ id: ((K = t(u).find(
239
+ (n) => {
240
+ var e;
241
+ return !((e = t(o).titles) != null && e.map((c) => c.id).includes(n.value));
242
+ }
243
+ )) == null ? void 0 : K.value) || t(u)[0].value,
244
+ expiredAt: 0
245
+ }
246
+ ];
247
+ })
248
+ })) : oe("", !0)
249
+ ]),
250
+ r("div", at, [
251
+ Ee(g(D, {
252
+ state: "warning",
253
+ text: "Updating member will cause tier to change"
254
+ }, null, 512), [
255
+ [Ve, t(a)]
256
+ ]),
257
+ g(H),
258
+ g(N, {
259
+ variant: "secondary",
260
+ label: "Cancel",
261
+ size: "md",
262
+ onClick: l[4] || (l[4] = (C) => t(F).close())
263
+ }),
264
+ g(N, {
265
+ disabled: !!t(k),
266
+ variant: "primary",
267
+ label: "Submit",
268
+ size: "md",
269
+ onClick: U
270
+ }, null, 8, ["disabled"])
271
+ ])
272
+ ], 64);
273
+ };
274
+ }
275
+ }), mt = { class: "fm-typo-en-title-sm-800" }, dt = { class: "space-y-16" }, ct = { class: "flex flex-nowrap gap-8 items-center justify-end pt-24 w-full" }, ut = /* @__PURE__ */ ae({
276
+ __name: "CreditCoinDialog",
277
+ props: {
278
+ type: { type: String, required: !0 },
279
+ action: { type: String, required: !0 },
280
+ onSubmit: {
281
+ type: Function,
282
+ required: !0
283
+ }
284
+ },
285
+ setup(m) {
286
+ const F = Ce(), f = m, y = L({
287
+ amount: 1,
288
+ day: 1,
289
+ remark: void 0
290
+ }), s = L(!0), o = O(() => _e.formattedType(f.type.toUpperCase()));
291
+ function u(a) {
292
+ s.value = a, !a && f.type === "coin" && (y.value.day = void 0);
293
+ }
294
+ async function d() {
295
+ if (f.action === "send") {
296
+ const a = y.value.day ? `, expire in ${y.value.day} days` : "";
297
+ Ae.confirm(
298
+ `Are you sure to send ${y.value.amount} ${o.value.toLowerCase()}${a}? This action cannot be reversed.`
299
+ ).then(async (b) => {
300
+ b && await f.onSubmit(y.value);
301
+ });
302
+ } else
303
+ Ae.confirm(
304
+ `Are you sure to deduct ${y.value.amount} ${o.value.toLowerCase()}? This action cannot be reversed.`
305
+ ).then(async (a) => {
306
+ a && await f.onSubmit(y.value);
307
+ });
308
+ }
309
+ const x = O(() => {
310
+ const b = (f.action === "send" ? f.type === "coin" ? Re : je : f.type === "coin" ? Le : qe).safeParse(y.value);
311
+ return b.success == !1 ? b.error.flatten().fieldErrors : void 0;
312
+ });
313
+ return (a, b) => {
314
+ const k = A("FmStepperField"), $ = A("FmSwitch"), G = A("FmTextarea"), U = A("FmButton"), ie = A("FmCard");
315
+ return i(), I(ie, { class: "flex flex-col gap-16 p-16" }, {
316
+ default: se(() => {
317
+ var re, q, ne, p, l, S;
318
+ return [
319
+ r("div", mt, M(f.action == "send" ? "Send" : "Deduct") + " " + M(t(Se)[f.type.toUpperCase()].name), 1),
320
+ ye(" " + M(t(x)) + " ", 1),
321
+ r("div", dt, [
322
+ g(k, {
323
+ modelValue: t(y).amount,
324
+ "onUpdate:modelValue": b[0] || (b[0] = (_) => t(y).amount = _),
325
+ label: `${t(Se)[f.type.toUpperCase()].name} amount`,
326
+ "is-currency": !0,
327
+ "max-fraction-digits": 2,
328
+ "helper-state": (re = t(x)) != null && re.amount ? "error" : void 0,
329
+ "helper-text": (ne = (q = t(x)) == null ? void 0 : q.amount) == null ? void 0 : ne[0]
330
+ }, null, 8, ["modelValue", "label", "helper-state", "helper-text"]),
331
+ m.action === "send" && f.type === "coin" ? (i(), I($, {
332
+ key: 0,
333
+ "model-value": t(s),
334
+ label: `${t(o)} expires`,
335
+ "label-placement": "right",
336
+ "onUpdate:modelValue": b[1] || (b[1] = (_) => u(_))
337
+ }, null, 8, ["model-value", "label"])) : oe("", !0),
338
+ m.action === "send" && t(s) ? (i(), I(k, {
339
+ key: 1,
340
+ modelValue: t(y).day,
341
+ "onUpdate:modelValue": b[2] || (b[2] = (_) => t(y).day = _),
342
+ label: `${t(o)} expires in`,
343
+ "max-fraction-digits": 0,
344
+ "append-text": "day(s)",
345
+ max: 9999,
346
+ min: 0,
347
+ "helper-state": (p = t(x)) != null && p.day ? "error" : void 0,
348
+ "helper-text": (S = (l = t(x)) == null ? void 0 : l.day) == null ? void 0 : S[0]
349
+ }, null, 8, ["modelValue", "label", "helper-state", "helper-text"])) : oe("", !0),
350
+ g(G, {
351
+ modelValue: t(y).remark,
352
+ "onUpdate:modelValue": b[3] || (b[3] = (_) => t(y).remark = _),
353
+ label: "Remark"
354
+ }, null, 8, ["modelValue"])
355
+ ]),
356
+ r("div", ct, [
357
+ g(U, {
358
+ variant: "secondary",
359
+ label: "Cancel",
360
+ size: "md",
361
+ onClick: b[4] || (b[4] = (_) => t(F).close())
362
+ }),
363
+ g(U, {
364
+ disabled: !!t(x),
365
+ variant: "primary",
366
+ label: "Submit",
367
+ size: "md",
368
+ onClick: b[5] || (b[5] = async () => d())
369
+ }, null, 8, ["disabled"])
370
+ ])
371
+ ];
372
+ }),
373
+ _: 1
374
+ });
375
+ };
376
+ }
377
+ }), pt = Ge("segment", () => {
378
+ const m = L([]);
379
+ async function F() {
380
+ const f = await Ne.readAll({
381
+ limit: 1e3,
382
+ skip: 0,
383
+ sortBy: "_id",
384
+ descending: !0
385
+ });
386
+ m.value = f.resources;
387
+ }
388
+ return {
389
+ segments: m,
390
+ read: F
391
+ };
392
+ });
393
+ class ft extends Je {
394
+ }
395
+ const bt = { class: "border border-fm-color-neutral-gray-100 rounded-lg p-16" }, yt = { class: "hidden xs:!flex items-center justify-end" }, vt = { class: "flex items-center justify-between mb-4" }, gt = { class: "flex items-center justify-between gap-x-8" }, xt = { class: "fm-typo-en-body-lg-600" }, ht = { class: "px-4 py-0.5 rounded-md bg-fm-color-neutral-gray-100 fm-typo-en-body-md-600" }, _t = { class: "xs:hidden flex justify-between gap-x-4" }, xe = /* @__PURE__ */ ae({
396
+ __name: "MemberCollectionTable",
397
+ props: {
398
+ member: {
399
+ type: Object,
400
+ required: !0
401
+ },
402
+ title: {
403
+ type: String,
404
+ default: ""
405
+ },
406
+ columns: {
407
+ type: Array,
408
+ default: [],
409
+ required: !0
410
+ },
411
+ filters: {
412
+ type: Object,
413
+ default: {}
414
+ },
415
+ withExport: {
416
+ type: Boolean,
417
+ default: !1
418
+ },
419
+ transformExportRecord: {
420
+ type: Function
421
+ }
422
+ },
423
+ setup(m) {
424
+ const F = m, f = L({
425
+ search: ""
426
+ }), y = L(!1), { tableMeta: s, rowData: o, onSort: u, debouncedFetchData: d, onSearch: x } = We(async (b) => {
427
+ const k = {
428
+ ...f.value,
429
+ ...F.filters
430
+ };
431
+ return await ve.readCollectionsByMemberId(
432
+ F.member._id.toString(),
433
+ b,
434
+ k
435
+ );
436
+ });
437
+ Te(
438
+ f,
439
+ () => {
440
+ d();
441
+ },
442
+ { deep: !0 }
443
+ );
444
+ async function a() {
445
+ try {
446
+ y.value = !0;
447
+ const b = {
448
+ ...f.value,
449
+ ...F.filters
450
+ };
451
+ await Qe({
452
+ exporter: new ft(),
453
+ readFunction: (k) => ve.readCollectionsByMemberId(
454
+ F.member._id.toString(),
455
+ k,
456
+ b
457
+ ),
458
+ transformRecord: F.transformExportRecord,
459
+ filename: `${F.member._id.toString()}-${F.title.replace(" ", "-").toLowerCase()}`
460
+ });
461
+ } catch (b) {
462
+ console.error(b);
463
+ } finally {
464
+ y.value = !1;
465
+ }
466
+ }
467
+ return Ie(async () => {
468
+ await d();
469
+ }), (b, k) => {
470
+ const $ = A("FmSearch"), G = A("FmButton");
471
+ return i(), w("div", bt, [
472
+ r("div", yt, [
473
+ g($, {
474
+ class: "hidden xs:!flex",
475
+ modelValue: t(f).search,
476
+ "onUpdate:modelValue": [
477
+ k[0] || (k[0] = (U) => t(f).search = U),
478
+ t(x)
479
+ ],
480
+ placeholder: "Search",
481
+ collapsible: ""
482
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]),
483
+ m.withExport ? (i(), I(G, {
484
+ key: 0,
485
+ icon: "ios_share",
486
+ variant: "tertiary",
487
+ onClick: a
488
+ })) : oe("", !0)
489
+ ]),
490
+ r("div", vt, [
491
+ r("div", gt, [
492
+ r("div", xt, M(F.title), 1),
493
+ r("div", ht, M(t(s).totalRows), 1)
494
+ ]),
495
+ r("div", _t, [
496
+ g($, {
497
+ modelValue: t(f).search,
498
+ "onUpdate:modelValue": [
499
+ k[1] || (k[1] = (U) => t(f).search = U),
500
+ t(x)
501
+ ],
502
+ placeholder: "Search"
503
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]),
504
+ m.withExport ? (i(), I(G, {
505
+ key: 0,
506
+ icon: "ios_share",
507
+ variant: "tertiary",
508
+ onClick: a
509
+ })) : oe("", !0)
510
+ ])
511
+ ]),
512
+ g(Xe, {
513
+ loading: t(s).isLoading,
514
+ "row-data": t(o),
515
+ "row-count": t(s).totalRows,
516
+ "column-defs": m.columns,
517
+ "page-count": t(s).pageCount,
518
+ "page-index": t(s).pageIndex,
519
+ "page-size": t(s).pageSize,
520
+ "shrink-at": !1,
521
+ onSortChange: t(u),
522
+ onPageChange: k[2] || (k[2] = (U) => t(d)({
523
+ pageSize: U.pageSize,
524
+ pageIndex: U.pageIndex
525
+ }))
526
+ }, null, 8, ["loading", "row-data", "row-count", "column-defs", "page-count", "page-index", "page-size", "onSortChange"])
527
+ ]);
528
+ };
529
+ }
530
+ }), Ct = /* @__PURE__ */ ae({
531
+ __name: "MemberVouchers",
532
+ props: {
533
+ member: {
534
+ type: Object,
535
+ required: !0
536
+ }
537
+ },
538
+ setup(m) {
539
+ const F = m, f = [
540
+ {
541
+ header: "Voucher title",
542
+ meta: {
543
+ maxWidth: "300px"
544
+ },
545
+ cell(o) {
546
+ var u;
547
+ return le(
548
+ "div",
549
+ { class: "text-ellipsis truncate" },
550
+ ((u = o.row.original.pf_collectible) == null ? void 0 : u.name) || "-"
551
+ );
552
+ },
553
+ enableSorting: !1
554
+ },
555
+ {
556
+ header: "Claimed at",
557
+ accessorKey: "_id",
558
+ accessorFn: (o) => h(ge(o._id.toString())).format("D MMM YYYY"),
559
+ enableSorting: !1
560
+ },
561
+ {
562
+ header: "Expired at",
563
+ cell(o) {
564
+ var d, x, a, b;
565
+ const u = (x = (d = o.row.original.expiryBalance) == null ? void 0 : d[0]) != null && x.expiredAt ? h((b = (a = o.row.original.expiryBalance) == null ? void 0 : a[0]) == null ? void 0 : b.expiredAt).format(
566
+ "D MMM YYYY"
567
+ ) : "-";
568
+ return le("div", {}, u);
569
+ },
570
+ enableSorting: !0
571
+ },
572
+ {
573
+ header: "Transfer open",
574
+ accessorFn: (o) => {
575
+ var u, d, x;
576
+ return Ke((x = (d = (u = o.pf_collectible) == null ? void 0 : u.options) == null ? void 0 : d.enableTransfer) == null ? void 0 : x.toString());
577
+ },
578
+ enableSorting: !1
579
+ }
580
+ ], y = (o) => ({
581
+ type: he.enum.VOUCHER,
582
+ isActive: o
583
+ }), s = (o) => {
584
+ var u, d, x, a, b, k, $;
585
+ return {
586
+ CollectionID: o._id,
587
+ Title: (u = o.pf_collectible) == null ? void 0 : u.name,
588
+ ClaimedAt: h(ge(o._id.toString())).format(
589
+ "D MMM YYYY, hh:mmA"
590
+ ),
591
+ ExpiredAt: (x = (d = o.expiryBalance) == null ? void 0 : d[0]) != null && x.expiredAt ? h((b = (a = o.expiryBalance) == null ? void 0 : a[0]) == null ? void 0 : b.expiredAt).format("D MMM YYYY") : "",
592
+ TransferOpen: (($ = (k = o.pf_collectible) == null ? void 0 : k.options) == null ? void 0 : $.enableTransfer) || !1
593
+ };
594
+ };
595
+ return (o, u) => (i(), w(Y, null, [
596
+ u[0] || (u[0] = r("div", { class: "fm-typo-en-title-sm-600 mb-16" }, "Voucher Collections", -1)),
597
+ g(xe, {
598
+ member: F.member,
599
+ columns: f,
600
+ title: "Active voucher",
601
+ filters: y(!0),
602
+ withExport: !0,
603
+ transformExportRecord: s
604
+ }, null, 8, ["member", "filters"]),
605
+ g(xe, {
606
+ member: F.member,
607
+ columns: f,
608
+ title: "Past voucher",
609
+ filters: y(!1),
610
+ withExport: !0,
611
+ transformExportRecord: s
612
+ }, null, 8, ["member", "filters"])
613
+ ], 64));
614
+ }
615
+ }), St = /* @__PURE__ */ ae({
616
+ __name: "MemberMissions",
617
+ props: {
618
+ member: {
619
+ type: Object,
620
+ required: !0
621
+ }
622
+ },
623
+ setup(m) {
624
+ const F = m, f = [
625
+ {
626
+ header: "Mission title",
627
+ meta: {
628
+ maxWidth: "300px"
629
+ },
630
+ cell(s) {
631
+ var o;
632
+ return le(
633
+ "div",
634
+ { class: "text-ellipsis truncate" },
635
+ ((o = s.row.original.pf_campaign) == null ? void 0 : o.name) || "Deleted Campaign"
636
+ );
637
+ },
638
+ enableSorting: !1
639
+ },
640
+ {
641
+ header: "Type",
642
+ accessorFn: (s) => {
643
+ var o, u, d;
644
+ return Me.title(((d = (u = (o = s == null ? void 0 : s.pf_collectible) == null ? void 0 : o.extras) == null ? void 0 : u.mission) == null ? void 0 : d.type) || "-");
645
+ },
646
+ enableSorting: !1
647
+ },
648
+ {
649
+ header: "Status",
650
+ cell(s) {
651
+ var o;
652
+ if (s.row.original.pf_campaign) {
653
+ const u = {
654
+ active: "text-fm-color-typo-warning bg-fm-color-system-warning-100",
655
+ upcoming: "text-fm-color-typo-info bg-fm-color-system-info-100",
656
+ completed: "text-fm-color-typo-success bg-fm-color-system-success-100",
657
+ expired: "text-fm-color-typo-error bg-fm-color-system-error-100"
658
+ }, d = Ze(
659
+ s.row.original.pf_campaign
660
+ ), a = s.row.original.balance === s.row.original.pf_collectible.extras.mission.end && d === "active" ? "completed" : (o = s.row.original) != null && o.deactivatedAt ? "expired" : d;
661
+ return le(we.FmChip, {
662
+ class: u[a],
663
+ label: Me.title(a),
664
+ compact: !0
665
+ });
666
+ }
667
+ return le(we.FmChip, {
668
+ class: "",
669
+ label: "-",
670
+ compact: !0
671
+ });
672
+ },
673
+ enableSorting: !1
674
+ },
675
+ {
676
+ header: "Summary",
677
+ accessorFn: (s) => s != null && s.pf_campaign ? et(s.pf_campaign) : "Deleted Campaign",
678
+ enableSorting: !1
679
+ },
680
+ {
681
+ header: "Current Step",
682
+ accessorKey: "balance",
683
+ enableSorting: !1
684
+ },
685
+ {
686
+ header: "Total Step",
687
+ accessorFn: (s) => {
688
+ var o, u, d;
689
+ return ((d = (u = (o = s == null ? void 0 : s.pf_collectible) == null ? void 0 : o.extras) == null ? void 0 : u.mission) == null ? void 0 : d.end) ?? 0;
690
+ },
691
+ enableSorting: !1
692
+ }
693
+ ], y = {
694
+ type: he.enum.STAMP
695
+ };
696
+ return (s, o) => (i(), w(Y, null, [
697
+ o[0] || (o[0] = r("div", { class: "fm-typo-en-title-sm-600 mb-16" }, "Mission", -1)),
698
+ g(xe, {
699
+ member: F.member,
700
+ columns: f,
701
+ title: "Mission",
702
+ filters: y
703
+ }, null, 8, ["member"])
704
+ ], 64));
705
+ }
706
+ }), wt = /* @__PURE__ */ ae({
707
+ __name: "MemberGames",
708
+ props: {
709
+ member: {
710
+ type: Object,
711
+ required: !0
712
+ }
713
+ },
714
+ setup(m) {
715
+ const F = m, f = [
716
+ {
717
+ header: "Game title",
718
+ meta: {
719
+ maxWidth: "300px"
720
+ },
721
+ cell(s) {
722
+ var o;
723
+ return le(
724
+ "div",
725
+ { class: "text-ellipsis truncate" },
726
+ ((o = s.row.original.pf_campaign) == null ? void 0 : o.name) || "-"
727
+ );
728
+ },
729
+ enableSorting: !1
730
+ },
731
+ {
732
+ header: "Claimed at",
733
+ accessorKey: "_id",
734
+ accessorFn: (s) => h(ge(s._id.toString())).format("D MMM YYYY"),
735
+ enableSorting: !1
736
+ },
737
+ {
738
+ header: "Expired at",
739
+ cell(s) {
740
+ var u, d, x, a;
741
+ const o = (d = (u = s.row.original.expiryBalance) == null ? void 0 : u[0]) != null && d.expiredAt ? h((a = (x = s.row.original.expiryBalance) == null ? void 0 : x[0]) == null ? void 0 : a.expiredAt).format(
742
+ "D MMM YYYY"
743
+ ) : "-";
744
+ return le("div", {}, o);
745
+ },
746
+ enableSorting: !1
747
+ },
748
+ {
749
+ header: "Token received",
750
+ accessorKey: "balance",
751
+ enableSorting: !1
752
+ }
753
+ ], y = (s) => ({
754
+ type: he.enum.GAME,
755
+ isActive: s
756
+ });
757
+ return (s, o) => (i(), w(Y, null, [
758
+ o[0] || (o[0] = r("div", { class: "fm-typo-en-title-sm-600 mb-16" }, "Game program", -1)),
759
+ g(xe, {
760
+ member: F.member,
761
+ columns: f,
762
+ title: "Active game token",
763
+ filters: y(!0)
764
+ }, null, 8, ["member", "filters"])
765
+ ], 64));
766
+ }
767
+ }), Ft = { class: "flex flex-col flex-nowrap gap-y-24 max-h-full" }, Mt = { class: "grid md:grid-cols-2 lg:grid-cols-2 gap-x-36 gap-y-24" }, kt = { class: "space-y-16" }, At = { class: "flex gap-16 items-center" }, Tt = { class: "flex-auto" }, $t = { class: "fm-typo-en-body-md-600" }, Et = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Vt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, It = { class: "fm-typo-en-body-md-800" }, Bt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Dt = { class: "fm-typo-en-body-md-600" }, Yt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ut = { class: "fm-typo-en-body-md-800" }, Nt = { class: "gap-16 grid grid-cols-1" }, Ot = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Pt = { class: "fm-typo-en-body-md-600" }, Rt = { class: "p-16 grid md:grid-cols-3 lg:grid-cols-3 border-2 border-fm-color-neutral-gray-100 rounded-lg gap-16 divide-y md:divide-y-0 lg:divide-y-0 md:divide-x lg:divide-x divide-fm-color-neutral-gray-100" }, jt = { class: "flex justify-between mb-16" }, Lt = { class: "fm-typo-en-title-sm-600" }, qt = ["onClick"], zt = { class: "flex flex-col gap-y-16" }, Gt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ht = { class: "fm-typo-en-body-md-600" }, Kt = { class: "space-y-8" }, Wt = {
768
+ key: 0,
769
+ class: "space-x-8"
770
+ }, Xt = {
771
+ key: 1,
772
+ class: "text-fm-color-typo-secondary"
773
+ }, Jt = { class: "space-y-8" }, Qt = ["src"], Zt = { class: "fm-typo-en-body-md-600" }, eo = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, to = {
774
+ key: 1,
775
+ class: "text-fm-color-typo-secondary"
776
+ }, oo = {
777
+ key: 1,
778
+ class: "space-y-24"
779
+ }, ro = { class: "space-y-8" }, no = { class: "fm-typo-en-title-md-800" }, so = { class: "space-y-4" }, lo = { class: "fm-typo-en-body-md-600" }, ao = { class: "flex gap-24 items-center xs:flex-col xs:items-start" }, io = { class: "space-y-8" }, mo = { class: "fm-typo-en-title-md-800" }, co = { class: "space-y-4" }, uo = { class: "fm-typo-en-body-md-600" }, po = { class: "flex gap-24 items-center xs:flex-col xs:items-start" }, zo = /* @__PURE__ */ ae({
780
+ __name: "MemberDetailSheet",
781
+ props: {
782
+ member: {
783
+ type: Object,
784
+ required: !0
785
+ }
786
+ },
787
+ emits: ["update:member"],
788
+ setup(m, { expose: F, emit: f }) {
789
+ const y = tt(), s = $e(), o = He(), u = pt(), d = Ce(), { minor: x } = ze, a = m, b = f, k = O(() => o.locations.map((n) => ({
790
+ label: n.name,
791
+ value: n._id
792
+ }))), $ = O(() => (a.member.segment || []).map((n) => {
793
+ var e;
794
+ return ((e = u.segments.find((c) => c._id === n)) == null ? void 0 : e.name) || "";
795
+ }).filter(Boolean)), G = [
796
+ {
797
+ label: "Loyalty",
798
+ stats: [
799
+ {
800
+ label: "Experiences",
801
+ getter: (n) => {
802
+ var e, c, T;
803
+ return te(((T = (c = (e = n.collection) == null ? void 0 : e.POINT) == null ? void 0 : c[0]) == null ? void 0 : T.balance) ?? 0, 2);
804
+ }
805
+ },
806
+ {
807
+ label: "Credits",
808
+ getter: (n) => {
809
+ var e, c, T;
810
+ return te(((T = (c = (e = n.collection) == null ? void 0 : e.CREDIT) == null ? void 0 : c[0]) == null ? void 0 : T.balance) ?? 0, 2);
811
+ }
812
+ }
813
+ ]
814
+ },
815
+ {
816
+ label: "Voucher",
817
+ stats: [
818
+ {
819
+ label: "Active vouchers",
820
+ getter: () => te(P.value.active, 0)
821
+ },
822
+ {
823
+ label: "Past vouchers",
824
+ getter: () => te(P.value.past, 0)
825
+ }
826
+ ]
827
+ },
828
+ {
829
+ label: "Mission",
830
+ stats: [
831
+ {
832
+ label: "Stamp missions",
833
+ getter: () => te(B.value.stamp, 0)
834
+ },
835
+ {
836
+ label: "Progress missions",
837
+ getter: () => te(B.value.progressive, 0)
838
+ }
839
+ ]
840
+ },
841
+ {
842
+ label: "Game",
843
+ stats: [
844
+ {
845
+ label: "Tokens",
846
+ getter: (n) => {
847
+ var e, c;
848
+ return te(
849
+ ((c = (e = n.collection) == null ? void 0 : e.GAME) == null ? void 0 : c.reduce(
850
+ (T, E) => T + E.balance,
851
+ 0
852
+ )) || 0,
853
+ 0
854
+ );
855
+ }
856
+ }
857
+ ]
858
+ },
859
+ {
860
+ label: "Store bundle",
861
+ stats: [
862
+ {
863
+ label: "Bundle purchased",
864
+ getter: () => te(N.value, 0)
865
+ }
866
+ ]
867
+ }
868
+ ], ie = (() => {
869
+ const e = [];
870
+ for (let c = 0; c < G.length; c += 3)
871
+ e.push(G.slice(c, c + 3));
872
+ return e;
873
+ })();
874
+ async function re(n, e) {
875
+ switch (n.stopPropagation(), e) {
876
+ case "Store bundle":
877
+ await y.push({
878
+ name: rt["$connect-LOYALTY_MEMBER_TRANSACTIONS"],
879
+ params: { id: a.member._id.toString() },
880
+ query: { tab: "store" }
881
+ });
882
+ break;
883
+ default:
884
+ C.value = R.find((c) => c.label === e) || R[0];
885
+ break;
886
+ }
887
+ }
888
+ async function q(n, e) {
889
+ d.open({
890
+ title: "",
891
+ dialogComponent: ut,
892
+ dialogComponentProps: {
893
+ type: n,
894
+ action: e,
895
+ onSubmit: async (c) => {
896
+ await x(
897
+ async () => {
898
+ const T = {
899
+ "credit-send": fe.sendCredit,
900
+ "credit-deduct": fe.deductCredit,
901
+ "coin-send": fe.sendCoin,
902
+ "coin-deduct": fe.deductCoin
903
+ }, E = `${n}-${e}`, W = T[E];
904
+ W && await W(a.member._id, c), b("update:member"), d.close();
905
+ },
906
+ {
907
+ message: `Adjusting ${_e.formattedType(
908
+ n.toUpperCase()
909
+ ).toLowerCase()}`,
910
+ successMessage: `${c.amount} ${_e.formattedType(
911
+ n.toUpperCase()
912
+ ).toLowerCase()} ${e} ${e == "send" ? "to" : "from"} ${a.member.phoneNumber}`
913
+ }
914
+ );
915
+ }
916
+ }
917
+ });
918
+ }
919
+ async function ne() {
920
+ d.open({
921
+ title: "Update member statistics",
922
+ contentComponent: it,
923
+ contentComponentProps: {
924
+ member: a.member,
925
+ onSubmit: async (n) => {
926
+ await x(
927
+ async () => {
928
+ await fe.updateMember(a.member._id, n), b("update:member"), d.close();
929
+ },
930
+ {
931
+ message: "Updating member stats",
932
+ successMessage: `Updated member ${a.member.phoneNumber} stats successfully`
933
+ }
934
+ );
935
+ }
936
+ }
937
+ });
938
+ }
939
+ const p = [
940
+ {
941
+ label: "Mobile No.",
942
+ key: "phoneNumber"
943
+ },
944
+ {
945
+ label: "Tier",
946
+ getter: (n) => {
947
+ var me, de, be, v, V;
948
+ const e = (((de = Fe.first((me = a.member.collection) == null ? void 0 : me.TIER)) == null ? void 0 : de.balance) || 0) - 1, c = S.value.name, T = ((v = (be = n.collection) == null ? void 0 : be.POINT) == null ? void 0 : v[0].balance) ?? 0, E = s.sortedTiers[e + 1], W = ((V = E == null ? void 0 : E.option) == null ? void 0 : V.from) ?? 1 / 0;
949
+ return `${c} (${T}/${W})`;
950
+ }
951
+ },
952
+ {
953
+ label: "Email",
954
+ key: "email"
955
+ },
956
+ {
957
+ label: "Birthday",
958
+ getter: (n) => n.birthday ? h(n.birthday).format("D MMM YYYY") : "-"
959
+ }
960
+ ], l = [
961
+ {
962
+ label: "Customer since",
963
+ getter: (n) => h(n.joinAt || ge(n._id.toString())).format("D MMM YYYY")
964
+ },
965
+ {
966
+ label: "Joined at location",
967
+ getter: (n) => {
968
+ var e;
969
+ return n != null && n.location && ((e = k.value.find((c) => c.value == n.location)) == null ? void 0 : e.label) || "-";
970
+ }
971
+ },
972
+ {
973
+ label: "Total visit(s)",
974
+ getter: (n) => ke.singularOrPlural(n.stats.visitCount, "bill")
975
+ },
976
+ {
977
+ label: "Last visit",
978
+ getter: (n) => h(n.stats.lastVisit).fromNow()
979
+ },
980
+ {
981
+ label: "Frequency",
982
+ getter: (n) => `Every ${ke.singularOrPlural(
983
+ Number(Math.ceil(n.stats.avgVisitFrequency).toFixed(0)),
984
+ "day"
985
+ )}`
986
+ },
987
+ {
988
+ label: "Average spend",
989
+ getter: (n) => Ue.Dinero.fromNumber({ number: Number(n.stats.avgBillSize || 0) }).toFormat(
990
+ !0
991
+ )
992
+ }
993
+ // {
994
+ // label: 'Feedback',
995
+ // key: 'feedbackCount',
996
+ // },
997
+ // {
998
+ // label: 'Tier Earned this season',
999
+ // key: 'lastSeasonTierEarned',
1000
+ // },
1001
+ // {
1002
+ // label: 'Point Earned this season',
1003
+ // key: 'lastSeasonPointEarned',
1004
+ // },
1005
+ ], S = O(() => {
1006
+ var c, T;
1007
+ const n = (((T = Fe.first((c = a.member.collection) == null ? void 0 : c.TIER)) == null ? void 0 : T.balance) || 0) - 1, e = s.sortedTiers[n];
1008
+ return { name: (e == null ? void 0 : e.name) || "-", tier: n, config: e };
1009
+ }), _ = O(() => {
1010
+ var n;
1011
+ return (((n = a.member.collection) == null ? void 0 : n.TITLE) || []).map((e) => {
1012
+ var T, E, W;
1013
+ const c = (T = s.sortedTitles) == null ? void 0 : T.find(
1014
+ (me) => me._id == e.collectible
1015
+ );
1016
+ return {
1017
+ name: c == null ? void 0 : c.name,
1018
+ expiredAt: (W = (E = e.expiryBalance) == null ? void 0 : E.at(-1)) == null ? void 0 : W.expiredAt,
1019
+ collectible: c
1020
+ };
1021
+ }).filter(
1022
+ (e) => e.expiredAt ? h(e.expiredAt).isAfter(h()) : !0
1023
+ );
1024
+ }), B = L({ stamp: 0, progressive: 0 }), P = L({ active: 0, past: 0 }), z = L([]), N = O(
1025
+ () => z.value.reduce((n, e) => n + e.count, 0)
1026
+ ), D = L(!0);
1027
+ function H() {
1028
+ D.value = !0, C.value = R[0];
1029
+ }
1030
+ function Z() {
1031
+ D.value = !1;
1032
+ }
1033
+ const R = [
1034
+ {
1035
+ label: "Overview",
1036
+ value: "overview"
1037
+ },
1038
+ {
1039
+ label: "Loyalty",
1040
+ value: "loyalty"
1041
+ },
1042
+ {
1043
+ label: "Voucher",
1044
+ value: "voucher"
1045
+ },
1046
+ {
1047
+ label: "Mission",
1048
+ value: "mission"
1049
+ },
1050
+ {
1051
+ label: "Game",
1052
+ value: "game"
1053
+ }
1054
+ ], C = L(R[0]), K = async () => {
1055
+ P.value = await ve.readCollectionCountByMemberId(
1056
+ a.member._id.toString(),
1057
+ he.enum.VOUCHER
1058
+ ), z.value = await ot.readPurchaseCountByMember(
1059
+ a.member._id.toString()
1060
+ ), B.value = await ve.readMissionCountByMemberId(
1061
+ a.member._id.toString()
1062
+ );
1063
+ };
1064
+ return Be(async () => {
1065
+ await s.readMembership(), await K(), o.locations.length || await o.readLocations();
1066
+ }), Te(D, async () => {
1067
+ await K();
1068
+ }), F({
1069
+ showSheet: H,
1070
+ hideSheet: Z
1071
+ }), (n, e) => {
1072
+ const c = A("FmTabs"), T = A("FmAvatar"), E = A("FmButton"), W = A("FmIcon"), me = A("FmChip"), de = A("FmCard"), be = A("FmSideSheet");
1073
+ return i(), I(be, {
1074
+ modelValue: t(D),
1075
+ "onUpdate:modelValue": e[5] || (e[5] = (v) => De(D) ? D.value = v : null),
1076
+ header: "Member Detail",
1077
+ "dismiss-away": "",
1078
+ "close-button": !0,
1079
+ "max-width": 1100
1080
+ }, {
1081
+ "side-sheet-footer": se(() => [...e[19] || (e[19] = [])]),
1082
+ default: se(() => [
1083
+ r("div", Ft, [
1084
+ r("div", null, [
1085
+ g(c, {
1086
+ "model-value": t(C).value,
1087
+ items: R,
1088
+ class: "overflow-x-auto",
1089
+ "onUpdate:modelValue": e[0] || (e[0] = (v) => C.value = R.find((V) => V.value === v))
1090
+ }, null, 8, ["model-value"])
1091
+ ]),
1092
+ t(C).value == "overview" ? (i(), w(Y, { key: 0 }, [
1093
+ r("div", Mt, [
1094
+ r("div", null, [
1095
+ e[9] || (e[9] = r("div", { class: "fm-typo-en-title-sm-800 mb-16" }, "Profile Information", -1)),
1096
+ r("div", kt, [
1097
+ r("div", At, [
1098
+ g(T, {
1099
+ name: m.member.photoUrl ? void 0 : m.member.name,
1100
+ src: m.member.photoUrl || void 0
1101
+ }, null, 8, ["name", "src"]),
1102
+ r("div", Tt, [
1103
+ e[7] || (e[7] = r("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Member Name ", -1)),
1104
+ r("div", $t, M(m.member.name), 1),
1105
+ r("div", Et, M(m.member._id), 1),
1106
+ r("div", Vt, [
1107
+ e[6] || (e[6] = ye(" Member Card: ", -1)),
1108
+ r("span", It, M(m.member.cardNo ? m.member.cardNo : "-"), 1)
1109
+ ])
1110
+ ]),
1111
+ g(E, {
1112
+ variant: "tertiary",
1113
+ icon: "settings",
1114
+ onClick: ne
1115
+ })
1116
+ ]),
1117
+ (i(), w(Y, null, Q(p, (v, V) => r("div", { key: V }, [
1118
+ r("div", Bt, M(v.label), 1),
1119
+ r("div", Dt, M(v.key ? m.member[v.key] : v.getter(m.member)), 1)
1120
+ ])), 64)),
1121
+ r("div", Yt, [
1122
+ e[8] || (e[8] = ye(" Referral Code: ", -1)),
1123
+ r("span", Ut, M(m.member.referralCode ? m.member.referralCode : "-"), 1)
1124
+ ])
1125
+ ])
1126
+ ]),
1127
+ r("div", null, [
1128
+ e[10] || (e[10] = r("div", { class: "fm-typo-en-title-sm-800 mb-16" }, "Activities", -1)),
1129
+ r("div", Nt, [
1130
+ (i(), w(Y, null, Q(l, (v) => r("div", {
1131
+ key: v.key
1132
+ }, [
1133
+ r("div", Ot, M(v.label), 1),
1134
+ r("div", Pt, M(v.key ? a.member.stats[v.key] || "-" : v.getter(m.member)), 1)
1135
+ ])), 64))
1136
+ ])
1137
+ ])
1138
+ ]),
1139
+ e[13] || (e[13] = r("div", { class: "border-fm-color-neutral-gray-100 rounded-sm border-t" }, null, -1)),
1140
+ (i(!0), w(Y, null, Q(t(ie), (v) => (i(), w("div", Rt, [
1141
+ (i(!0), w(Y, null, Q(v, (V, ee) => (i(), w("div", { key: ee }, [
1142
+ r("div", {
1143
+ class: Ye(ee !== 0 ? "pt-12 md:pt-0 lg:pt-0 md:pl-12 lg:pl-12" : "")
1144
+ }, [
1145
+ r("div", jt, [
1146
+ r("div", Lt, M(V.label), 1),
1147
+ r("button", {
1148
+ onClick: (j) => re(j, V.label)
1149
+ }, [
1150
+ g(W, {
1151
+ name: "chevron_right",
1152
+ outline: "",
1153
+ size: "md"
1154
+ })
1155
+ ], 8, qt)
1156
+ ]),
1157
+ r("div", zt, [
1158
+ (i(!0), w(Y, null, Q(V.stats, (j) => (i(), w("div", {
1159
+ key: j.key
1160
+ }, [
1161
+ r("div", Gt, M(j.label), 1),
1162
+ r("div", Ht, M(j.getter(m.member)), 1)
1163
+ ]))), 128))
1164
+ ])
1165
+ ], 2)
1166
+ ]))), 128))
1167
+ ]))), 256)),
1168
+ r("div", Kt, [
1169
+ e[11] || (e[11] = r("div", { class: "fm-typo-en-title-sm-800" }, "Segments", -1)),
1170
+ t($).length ? (i(), w("div", Wt, [
1171
+ (i(!0), w(Y, null, Q(t($), (v) => (i(), I(me, {
1172
+ label: v.toString()
1173
+ }, null, 8, ["label"]))), 256))
1174
+ ])) : (i(), w("div", Xt, "No titles"))
1175
+ ]),
1176
+ e[14] || (e[14] = r("div", { class: "border-fm-color-neutral-gray-100 rounded-sm border-t" }, null, -1)),
1177
+ r("div", Jt, [
1178
+ e[12] || (e[12] = r("div", { class: "fm-typo-en-title-sm-800" }, "Title badge", -1)),
1179
+ t(_).length ? (i(!0), w(Y, { key: 0 }, Q(t(_).filter((v) => v.collectible), (v) => (i(), w("div", {
1180
+ class: "flex items-center gap-x-8 h-48",
1181
+ key: v.name
1182
+ }, [
1183
+ r("img", {
1184
+ src: v.collectible.image || t(Oe),
1185
+ class: "aspect-square h-full object-contain"
1186
+ }, null, 8, Qt),
1187
+ r("div", null, [
1188
+ r("div", Zt, M(v.name), 1),
1189
+ r("div", eo, " Expired on " + M(t(h)(v.expiredAt).format("MMM D, Y")), 1)
1190
+ ])
1191
+ ]))), 128)) : (i(), w("div", to, "No titles"))
1192
+ ])
1193
+ ], 64)) : t(C).value == "loyalty" ? (i(), w("div", oo, [
1194
+ g(de, {
1195
+ class: "p-16 space-y-24",
1196
+ variant: "outlined"
1197
+ }, {
1198
+ default: se(() => {
1199
+ var v, V, ee, j, ce, ue, pe;
1200
+ return [
1201
+ r("div", ro, [
1202
+ e[15] || (e[15] = r("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Credit ", -1)),
1203
+ r("div", no, M(((ee = (V = (v = m.member.collection) == null ? void 0 : v.CREDIT) == null ? void 0 : V[0]) == null ? void 0 : ee.balance) ?? 0), 1)
1204
+ ]),
1205
+ r("div", so, [
1206
+ e[16] || (e[16] = r("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Credit(s) to be expired in 30 days ", -1)),
1207
+ r("div", lo, M(((pe = (ue = (ce = (j = m.member.collection) == null ? void 0 : j.CREDIT) == null ? void 0 : ce[0]) == null ? void 0 : ue.expiryBalance) == null ? void 0 : pe.reduce(
1208
+ (X, J) => J.expiredAt && t(h)(J.expiredAt).isAfter(t(h)()) && t(h)(J.expiredAt).isBefore(t(h)().add(30, "days")) ? X + J.amount : X,
1209
+ 0
1210
+ )) ?? 0), 1)
1211
+ ]),
1212
+ r("div", ao, [
1213
+ g(E, {
1214
+ label: "Add credit",
1215
+ icon: "add",
1216
+ variant: "plain",
1217
+ onClick: e[1] || (e[1] = (X) => q("credit", "send"))
1218
+ }),
1219
+ g(E, {
1220
+ label: "Deduct credit",
1221
+ icon: "remove",
1222
+ variant: "plain",
1223
+ onClick: e[2] || (e[2] = (X) => q("credit", "deduct"))
1224
+ })
1225
+ ])
1226
+ ];
1227
+ }),
1228
+ _: 1
1229
+ }),
1230
+ g(de, {
1231
+ class: "p-16 space-y-24",
1232
+ variant: "outlined"
1233
+ }, {
1234
+ default: se(() => {
1235
+ var v, V, ee, j, ce, ue, pe;
1236
+ return [
1237
+ r("div", io, [
1238
+ e[17] || (e[17] = r("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Point ", -1)),
1239
+ r("div", mo, M(((ee = (V = (v = m.member.collection) == null ? void 0 : v.COIN) == null ? void 0 : V[0]) == null ? void 0 : ee.balance) ?? 0), 1)
1240
+ ]),
1241
+ r("div", co, [
1242
+ e[18] || (e[18] = r("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Point(s) to be expired in 30 days ", -1)),
1243
+ r("div", uo, M(((pe = (ue = (ce = (j = m.member.collection) == null ? void 0 : j.COIN) == null ? void 0 : ce[0]) == null ? void 0 : ue.expiryBalance) == null ? void 0 : pe.reduce(
1244
+ (X, J) => J.expiredAt && t(h)(J.expiredAt).isAfter(t(h)()) && t(h)(J.expiredAt).isBefore(t(h)().add(30, "days")) ? X + J.amount : X,
1245
+ 0
1246
+ )) ?? 0), 1)
1247
+ ]),
1248
+ r("div", po, [
1249
+ g(E, {
1250
+ label: "Add point",
1251
+ icon: "add",
1252
+ variant: "plain",
1253
+ onClick: e[3] || (e[3] = (X) => q("coin", "send"))
1254
+ }),
1255
+ g(E, {
1256
+ label: "Deduct point",
1257
+ icon: "remove",
1258
+ variant: "plain",
1259
+ onClick: e[4] || (e[4] = (X) => q("coin", "deduct"))
1260
+ })
1261
+ ])
1262
+ ];
1263
+ }),
1264
+ _: 1
1265
+ })
1266
+ ])) : t(C).value == "voucher" ? (i(), I(Ct, {
1267
+ key: 2,
1268
+ member: a.member
1269
+ }, null, 8, ["member"])) : t(C).value == "mission" ? (i(), I(St, {
1270
+ key: 3,
1271
+ member: a.member
1272
+ }, null, 8, ["member"])) : t(C).value == "game" ? (i(), I(wt, {
1273
+ key: 4,
1274
+ member: a.member
1275
+ }, null, 8, ["member"])) : oe("", !0)
1276
+ ])
1277
+ ]),
1278
+ _: 1
1279
+ }, 8, ["modelValue"]);
1280
+ };
1281
+ }
1282
+ });
1283
+ export {
1284
+ zo as _,
1285
+ pt as u
1286
+ };