@feedmepos/mf-connect 0.1.98-beta.47 → 0.1.98-beta.49

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 (121) hide show
  1. package/dist/{App-JFPlzU0L.js → App-DpEetYST.js} +8 -8
  2. package/dist/{AuditLogs-Bk6QCZgp.js → AuditLogs-Cmo803hX.js} +10 -10
  3. package/dist/{Bin-CHi79olc.js → Bin-DJfXzuaK.js} +8 -8
  4. package/dist/{Broadcast-DSicPemE.js → Broadcast-CNgV44yY.js} +11 -11
  5. package/dist/{CampaignAnalytic-B3czdnvb.js → CampaignAnalytic-B2Rn2EJg.js} +6 -6
  6. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CkC0A-ix.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-Bns7bxjM.js} +7 -7
  7. package/dist/{Card-Begf7uD_.js → Card-B2VUzTu-.js} +20 -20
  8. package/dist/{Collections-BSmTzG4a.js → Collections-CND1NP87.js} +8 -8
  9. package/dist/{Credit-BqZ9lr6S.js → Credit-DVwWQVhX.js} +12 -12
  10. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-qMqks3fR.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-BAkLmXrV.js} +34 -35
  11. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-Ck2PxSye.js → EffectSheet.vue_vue_type_style_index_0_lang-C_iJZVqp.js} +16 -16
  12. package/dist/{Experience-i0bu7uAI.js → Experience-byIWULhh.js} +12 -12
  13. package/dist/{FileSaver.min-Ck6lXfKM.js → FileSaver.min-CaXtjHRv.js} +1 -1
  14. package/dist/{Game-Be02GnjR.js → Game-tzliFFnf.js} +13 -13
  15. package/dist/{GiftCardSetup-DPN3NhND.js → GiftCardSetup-CUZn8cQ_.js} +9 -9
  16. package/dist/{Grab-BKIYI2d-.js → Grab-Bj955oc2.js} +9 -9
  17. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-BqylTCHX.js → ImageInput.vue_vue_type_script_setup_true_lang-DM6s0VaT.js} +1 -1
  18. package/dist/{Index-BD_l8T_M.js → Index-qie7NJrQ.js} +10 -10
  19. package/dist/{LocationPicker.vue_vue_type_script_setup_true_lang-Cch5RizQ.js → LocationPicker.vue_vue_type_script_setup_true_lang-DN_0AboA.js} +1 -1
  20. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-D3psJutm.js → LottieAnimation.vue_vue_type_script_setup_true_lang-CrDegDYa.js} +1 -1
  21. package/dist/LoyaltyDashboard-D_SjNwRv.js +2218 -0
  22. package/dist/{MainLayout-C96xSNND.js → MainLayout-B4LQ7fj3.js} +3 -3
  23. package/dist/{Marketing-Bg6DFKg5.js → Marketing-BP2jjkGw.js} +4 -4
  24. package/dist/{MarketingMaterialEdit-BYbWgB2R.js → MarketingMaterialEdit-BDP-tlCV.js} +6 -6
  25. package/dist/Member-BIT0lu05.js +642 -0
  26. package/dist/MemberDetailSheet.vue_vue_type_script_setup_true_lang-CmR5L_FZ.js +1287 -0
  27. package/dist/{MemberImportHistory-Bw-M3Zx-.js → MemberImportHistory-CXq5k3za.js} +26 -24
  28. package/dist/MemberList-DgQrAUhF.js +336 -0
  29. package/dist/{MemberTransactions-DEzFrc9e.js → MemberTransactions-SD0EK9MQ.js} +1 -1
  30. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-CFpMazFG.js → MessageInput.vue_vue_type_script_setup_true_lang-B_P--gRo.js} +10 -10
  31. package/dist/{Mission-CWeWfTdC.js → Mission-Dcc8TywU.js} +13 -13
  32. package/dist/{Overview-CPMN5kuM.js → Overview-2n-3zYgT.js} +3 -3
  33. package/dist/{Overview-De06lJt0.js → Overview-ClsCoDwC.js} +19 -19
  34. package/dist/{Point-XfVYDIbj.js → Point-yoPNIfen.js} +12 -12
  35. package/dist/{Promotion-Q646p6RE.js → Promotion-Bo8fwRxo.js} +13 -13
  36. package/dist/{Queue-BNfc0ySV.js → Queue-DOMCJIfy.js} +11 -11
  37. package/dist/{Record-Dx5pZmpm.js → Record-B_GFsmRS.js} +9 -9
  38. package/dist/{Review-BX5Z5ivr.js → Review-D-UnLgKx.js} +2 -2
  39. package/dist/{ReviewFacebookCallback-B6GFP04-.js → ReviewFacebookCallback-CSkzBR52.js} +5 -5
  40. package/dist/{ReviewGoogleCallback-BWgxTbuf.js → ReviewGoogleCallback-DXW6TAxP.js} +5 -5
  41. package/dist/{Reward-DOImZVUL.js → Reward-CqNDQ5fM.js} +16 -16
  42. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-8fuZmrBK.js → RewardGroup.vue_vue_type_script_setup_true_lang-CZPtIroB.js} +12 -12
  43. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-C9kWB5Zw.js → RuleGroup.vue_vue_type_script_setup_true_lang-xzJ738TT.js} +15 -15
  44. package/dist/{Segment-BndDCfLd.js → Segment-B3keIMfg.js} +33 -34
  45. package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-DV1X7e-_.js → SelectItems.vue_vue_type_script_setup_true_lang-B1IbP3lO.js} +2 -2
  46. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-O9ohGQxg.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-BvrNFNDo.js} +13 -13
  47. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-D2knZbHq.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-BtJyfV2S.js} +4 -4
  48. package/dist/{Setting-DPm0lJmq.js → Setting-CUf7r25C.js} +14 -14
  49. package/dist/{SettingAdvertisements-DdPGyRNI.js → SettingAdvertisements-BnfH2GWe.js} +12 -12
  50. package/dist/{Settings-BQPDUWyz.js → Settings-CVyEvBdL.js} +5 -5
  51. package/dist/{Store-Cw-c2Wgl.js → Store-yJsGBJjp.js} +24 -24
  52. package/dist/{StoreRewards-CYkHL-h6.js → StoreRewards-E009h_Ki.js} +15 -15
  53. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-DClGeare.js → StoreTransactions.vue_vue_type_script_setup_true_lang-dFIK3_9i.js} +22 -22
  54. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-DekQ8_F8.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-BWytuBNh.js} +2 -2
  55. package/dist/{Tier-B7QmbFn8.js → Tier-D6l8QcgM.js} +25 -25
  56. package/dist/{Title-CRM_l4YE.js → Title-CKdZ_ulb.js} +22 -22
  57. package/dist/{Transaction-C1jXS8Le.js → Transaction-CHzWDrMp.js} +2 -2
  58. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-yPF04Hth.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-D5-CNeZh.js} +6 -6
  59. package/dist/{Voucher-Cfh_Wudx.js → Voucher-g84i_O99.js} +14 -14
  60. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-BkiXzbFh.js → VoucherEditor.vue_vue_type_script_setup_true_lang-HofDeLRx.js} +12 -12
  61. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-BEFynSZm.js → ZodTextField.vue_vue_type_script_setup_true_lang-B2QIFX1P.js} +2 -2
  62. package/dist/{app-CEWVaJEZ.js → app-CVfoAVMp.js} +238 -238
  63. package/dist/app.js +1 -1
  64. package/dist/{business-DWLMb2lG.js → business-DZUUnIjL.js} +1 -1
  65. package/dist/{campaign-DwYJGuSz.js → campaign-BIbDOJuM.js} +8 -8
  66. package/dist/{campaign-DRJO5ydK.js → campaign-CI_rZpSy.js} +2 -2
  67. package/dist/{campaign.enum-Dx-Zo68Q.js → campaign.enum-BBJZPv79.js} +1 -1
  68. package/dist/{campaign.fn-CPfN51jT.js → campaign.fn-BSKTKKn_.js} +57 -57
  69. package/dist/{collectible.enum-Liy2wH3s.js → collectible.enum-Bpd7su_n.js} +1 -1
  70. package/dist/{collection.fn-j4_hDjjy.js → collection.fn-CGLzb4iJ.js} +2 -2
  71. package/dist/{duplicateCampaign-CQ-yfh9b.js → duplicateCampaign-DvYTuIU-.js} +2 -2
  72. package/dist/{effect-DU8lcl8m.js → effect-DeuwDSDb.js} +1 -1
  73. package/dist/{email-addresses-DUpMDrGS.js → email-addresses-CXSJ6d0R.js} +2 -2
  74. package/dist/{export-BFMh5l4w.js → export-DMrK_zVs.js} +3 -3
  75. package/dist/{helper-DSvUKuiG.js → helper-CuwR4Iok.js} +1 -1
  76. package/dist/{index-JlyOHqyG.js → index-BGM2LdBN.js} +3 -3
  77. package/dist/{index-CWbvBvE3.js → index-BIE7IDVs.js} +2 -2
  78. package/dist/{index-DD3Jlx01.js → index-BnF40VHU.js} +1 -1
  79. package/dist/{index-rZdY3BW8.js → index-Br-IwWs2.js} +7 -7
  80. package/dist/{index-C69TnizM.js → index-BsGpbfSM.js} +1 -1
  81. package/dist/{index-CDyGueuB.js → index-BsL2fRDR.js} +82 -83
  82. package/dist/{index-D8_jwrSU.js → index-BtCff_X4.js} +1 -1
  83. package/dist/{index--mkEqsYz.js → index-CVshuS9x.js} +2 -2
  84. package/dist/{index-CrKfbYDf.js → index-CmXN0dX2.js} +281 -283
  85. package/dist/{index-CvVrgPmm.js → index-CsKzQMVH.js} +10766 -8027
  86. package/dist/{index-CuyxKvmh.js → index-D0RwTeSK.js} +7 -8
  87. package/dist/{index-CvaF2wtX.js → index-Di34zXvz.js} +1 -1
  88. package/dist/{index-DCbCuJXP.js → index-DtlEsLvC.js} +1 -1
  89. package/dist/{index-B-tBxRw2.js → index-KJ9fWfKI.js} +2 -2
  90. package/dist/{index-DLZ_cPwd.js → index-Z1kANjy2.js} +1 -1
  91. package/dist/{index-D-swy6qD.js → index-mkULcMHp.js} +1 -1
  92. package/dist/{index-CWEtTfxy.js → index-ux77Q19k.js} +24 -25
  93. package/dist/{index-BVWwOMHO.js → index-v0Wp7wZh.js} +11 -12
  94. package/dist/{index.esm2017-B2wpsz6n.js → index.esm2017-7ccdC84w.js} +132 -132
  95. package/dist/{loading-BHHf9MeD.js → loading-CRmkbq3n.js} +1 -1
  96. package/dist/{lodash-zHycpMIs.js → lodash-Bc-ryXNQ.js} +1 -1
  97. package/dist/{member-import-MTwvl8TG.js → member-import-DlkhFBuH.js} +8 -8
  98. package/dist/{membership-Ctqa96gd.js → membership-B26RzkXD.js} +3 -3
  99. package/dist/{money-C9m7TfMA.js → money-DQctndhn.js} +1 -1
  100. package/dist/{number-ng88zCwj.js → number-Bf6ikkos.js} +1 -1
  101. package/dist/objectid-rBYoX-d0.js +145 -0
  102. package/dist/{plugins-MY2whJpz.js → plugins-C67nSbj6.js} +3 -3
  103. package/dist/{reward-DiiV8MQE.js → reward-C43tP4ms.js} +1 -1
  104. package/dist/{rule-builder-BVEerrEc.js → rule-builder-C8VKx9qo.js} +1 -1
  105. package/dist/{rule-C31n55fZ.js → rule-ferkW3Tn.js} +3 -3
  106. package/dist/{template-CtcRYRZb.js → template-6TQsSBnV.js} +6 -6
  107. package/dist/{timezone-Ck4iMIrt.js → timezone-CHLqfxGX.js} +1 -1
  108. package/dist/{transaction.fn-BI0-LgQG.js → transaction.fn-Ck4GNkX8.js} +1 -1
  109. package/dist/{trigger-_5hAtyky.js → trigger-DW-HI3-m.js} +5 -5
  110. package/dist/{useMarketingMaterialActions-CX9qJp_O.js → useMarketingMaterialActions-DgjXENGq.js} +3 -3
  111. package/dist/{usePagination-DZKDMzEh.js → usePagination-DK5YxY0V.js} +1 -1
  112. package/dist/{user-C-Db5JiY.js → user-CEgC8bHe.js} +1 -1
  113. package/dist/{vue-i18n-BbF7bmsx.js → vue-i18n-CVwaGWN7.js} +237 -237
  114. package/dist/{xlsx-CzpvTfCU.js → xlsx-BjSGml1D.js} +440 -440
  115. package/dist/{zod-HtL78lno.js → zod-CIM7JLfN.js} +1 -1
  116. package/package.json +3 -1
  117. package/dist/LoyaltyDashboard-D0eq0Gaw.js +0 -1345
  118. package/dist/Member-B4NAFx8G.js +0 -573
  119. package/dist/MemberList-DXpa6_Rb.js +0 -1603
  120. package/dist/index-C_H8jFYf.js +0 -2743
  121. package/dist/objectid-BTsufz4u.js +0 -145
@@ -0,0 +1,1287 @@
1
+ import { defineComponent as ae, computed as O, ref as j, resolveComponent as T, 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 Ae, 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-CVshuS9x.js";
4
+ import { u as $e, C as Se, s as Ne } from "./membership-B26RzkXD.js";
5
+ import { useDialog as Ce, components as we } from "@feedmepos/ui-library";
6
+ import { _ as Fe } from "./lodash-Bc-ryXNQ.js";
7
+ import { D as Oe } from "./type_drinks-D6jnpvwV.js";
8
+ import { b as Pe, c as Re, d as Le, e as je, f as qe } from "./index-CmXN0dX2.js";
9
+ import "./index-CsKzQMVH.js";
10
+ import { c as Me, f as ke } from "./string-Gcy5IM_H.js";
11
+ import { u as ze } from "./loading-CRmkbq3n.js";
12
+ import { p as Te } from "./plugins-C67nSbj6.js";
13
+ import { C as _e } from "./collection.fn-CGLzb4iJ.js";
14
+ import { u as Ge } from "./business-DZUUnIjL.js";
15
+ import { defineStore as He } from "pinia";
16
+ import { f as te } from "./number-Bf6ikkos.js";
17
+ import "./index-v0Wp7wZh.js";
18
+ import "./index-ux77Q19k.js";
19
+ import "./index-BsL2fRDR.js";
20
+ import "./index-D0RwTeSK.js";
21
+ import "./index-BnF40VHU.js";
22
+ import { s as Ke } from "./index-CuvNtC_M.js";
23
+ import { u as We, _ as Xe } from "./usePagination-DK5YxY0V.js";
24
+ import { B as Je, e as Qe } from "./export-DMrK_zVs.js";
25
+ import { m as ve } from "./index-DtlEsLvC.js";
26
+ import { o as ge } from "./objectId-dwaoBfJX.js";
27
+ import { F as he } from "./collectible.enum-Bpd7su_n.js";
28
+ import { a as Ze, c as et } from "./campaign-BIbDOJuM.js";
29
+ import { useRouter as tt } from "vue-router";
30
+ import { m as fe } from "./index-BIE7IDVs.js";
31
+ import { t as ot } from "./index-BtCff_X4.js";
32
+ import { R as rt } from "./app-CVfoAVMp.js";
33
+ 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({
34
+ __name: "MemberStatsDialog",
35
+ props: {
36
+ member: {
37
+ type: Object,
38
+ required: !0
39
+ },
40
+ onSubmit: {
41
+ type: Function,
42
+ required: !0
43
+ }
44
+ },
45
+ setup(m) {
46
+ var ie, re, q, ne;
47
+ const F = Ce(), f = $e(), y = m, s = O(
48
+ () => {
49
+ var p;
50
+ return (((p = y.member.collection) == null ? void 0 : p.TITLE) ?? []).reduce(
51
+ (l, S) => {
52
+ var P, z, N, D, H;
53
+ const _ = f.sortedTitles.find(
54
+ (Z) => Z._id.toString() === S.collectible
55
+ );
56
+ if (!_) return l;
57
+ const B = [...S.expiryBalance ?? []].sort(
58
+ (Z, R) => h(Z.expiredAt).isAfter(h(R.expiredAt)) ? -1 : 1
59
+ );
60
+ return (P = B[0]) != null && P.expiredAt && h((z = B[0]) == null ? void 0 : z.expiredAt).isBefore(h()) || l.push({
61
+ _id: _._id,
62
+ name: _.name,
63
+ expiredAt: (N = B[0]) != null && N.expiredAt ? h((D = B[0]) == null ? void 0 : D.expiredAt).toISOString() : "",
64
+ expiresIn: h((H = B[0]) == null ? void 0 : H.expiredAt).diff(h(), "days")
65
+ }), l;
66
+ },
67
+ []
68
+ );
69
+ }
70
+ ), o = j({
71
+ cardNo: y.member.cardNo,
72
+ experience: ((re = (ie = y.member.collection) == null ? void 0 : ie.POINT) == null ? void 0 : re[0].balance) ?? 0,
73
+ tier: ((ne = (q = y.member.collection) == null ? void 0 : q.TIER) == null ? void 0 : ne[0].balance) ?? -1,
74
+ titles: s.value.map((p) => ({ expiredAt: p.expiresIn, id: p._id })) ?? void 0
75
+ }), u = O(
76
+ () => (f.sortedTitles ?? []).map((p) => ({
77
+ label: p.name,
78
+ value: p._id.toString(),
79
+ sublabel: s.value.some((l) => l._id === p._id) ? "Owned" : void 0
80
+ }))
81
+ ), d = O(() => (f.sortedTiers ?? []).map((p, l) => ({
82
+ label: p.name,
83
+ sublabel: `${p.option.from} - ${p.option.to}`,
84
+ from: p.option.from,
85
+ to: p.option.to,
86
+ value: l + 1
87
+ })));
88
+ function x() {
89
+ var S, _;
90
+ 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;
91
+ o.value.experience = Math.min(
92
+ l ?? p,
93
+ Math.max(p, o.value.experience ?? 0)
94
+ );
95
+ }
96
+ const a = O(() => {
97
+ var S, _, B, P, z, N;
98
+ 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;
99
+ if (p != o.value.tier) return !0;
100
+ if (o.value.experience && o.value.experience != l) {
101
+ 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;
102
+ if (o.value.experience < D || H && o.value.experience > H)
103
+ return !0;
104
+ }
105
+ return !1;
106
+ });
107
+ function b(p) {
108
+ var l;
109
+ return (l = s.value.find((S) => S._id === p)) == null ? void 0 : l.expiresIn;
110
+ }
111
+ const k = O(() => {
112
+ const p = Pe.safeParse(o.value);
113
+ return p.success ? void 0 : p.error.errors;
114
+ });
115
+ function $(p) {
116
+ var l, S;
117
+ return (S = (l = k.value) == null ? void 0 : l.find((_) => _.path.join(".") === p)) == null ? void 0 : S.message;
118
+ }
119
+ function G(p) {
120
+ var l;
121
+ return (l = k.value) == null ? void 0 : l.filter((S) => S.path.join(".").startsWith(p)).map((S) => S.message);
122
+ }
123
+ async function U() {
124
+ await y.onSubmit(o.value), F.close();
125
+ }
126
+ return (p, l) => {
127
+ var Z, R;
128
+ const S = T("FmSelect"), _ = T("FmStepperField"), B = T("FmTextField"), P = T("FmField"), z = T("FmFormGroup"), N = T("FmButton"), D = T("FmHelperText"), H = T("FmSpacer");
129
+ return i(), w(Y, null, [
130
+ r("div", nt, [
131
+ l[6] || (l[6] = r("div", { class: "fm-typo-en-title-sm-800 mb-8" }, "Member tiering", -1)),
132
+ t(d).length ? (i(), I(S, {
133
+ key: 0,
134
+ modelValue: t(o).tier,
135
+ "onUpdate:modelValue": [
136
+ l[0] || (l[0] = (C) => t(o).tier = C),
137
+ x
138
+ ],
139
+ label: "Member Tier",
140
+ items: t(d),
141
+ "helper-text": $("tier"),
142
+ "helper-state": $("tier") ? "error" : void 0
143
+ }, null, 8, ["modelValue", "items", "helper-text", "helper-state"])) : oe("", !0),
144
+ g(_, {
145
+ "model-value": t(o).experience ?? 0,
146
+ "onUpdate:modelValue": l[1] || (l[1] = (C) => t(o).experience = C),
147
+ label: "Member Experience",
148
+ "max-fraction-digits": 0,
149
+ "helper-text": $("experience"),
150
+ "helper-state": $("experience") ? "error" : void 0
151
+ }, null, 8, ["model-value", "helper-text", "helper-state"]),
152
+ l[7] || (l[7] = r("div", { class: "fm-typo-en-title-sm-800 mt-16 mb-8" }, "Member Card", -1)),
153
+ g(B, {
154
+ modelValue: t(o).cardNo,
155
+ "onUpdate:modelValue": l[2] || (l[2] = (C) => t(o).cardNo = C),
156
+ label: "Card number",
157
+ "helper-text": $("cardNo"),
158
+ "helper-state": $("cardNo") ? "error" : void 0
159
+ }, null, 8, ["modelValue", "helper-text", "helper-state"]),
160
+ l[8] || (l[8] = r("div", { class: "fm-typo-en-title-sm-800 mt-16 mb-8" }, "Titles", -1)),
161
+ (Z = t(o).titles) != null && Z.length ? (i(), w("div", st, [...l[5] || (l[5] = [
162
+ r("div", { class: "flex flex-nowrap gap-4 items-center" }, [
163
+ r("div", { class: "flex-1" }, "Title"),
164
+ r("div", { class: "flex-1" }, "Expires in days"),
165
+ r("div", { class: "w-24 h-1" })
166
+ ], -1)
167
+ ])])) : oe("", !0),
168
+ (i(!0), w(Y, null, Q(t(o).titles ?? [], (C, K) => (i(), w("div", { key: K }, [
169
+ r("div", lt, [
170
+ t(s).some((n) => n._id === C.id) ? (i(), I(z, {
171
+ key: 1,
172
+ "model-value": "",
173
+ class: "flex-1"
174
+ }, {
175
+ default: se(() => [
176
+ g(P, {
177
+ disabled: !0,
178
+ class: "text-fm-color-typo-secondary"
179
+ }, {
180
+ default: se(() => {
181
+ var n;
182
+ return [
183
+ ye(M((n = t(u).find((e) => e.value === C.id)) == null ? void 0 : n.label), 1)
184
+ ];
185
+ }),
186
+ _: 2
187
+ }, 1024)
188
+ ]),
189
+ _: 2
190
+ }, 1024)) : (i(), I(S, {
191
+ key: 0,
192
+ modelValue: C.id,
193
+ "onUpdate:modelValue": [(n) => C.id = n, (n) => C.expiredAt = b(n) ?? 1],
194
+ class: "flex-1",
195
+ items: t(u).filter(
196
+ (n) => {
197
+ var e;
198
+ return !((e = t(o).titles) != null && e.map((c) => c.id).includes(n.value)) || C.id === n.value;
199
+ }
200
+ )
201
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "items"])),
202
+ g(_, {
203
+ modelValue: C.expiredAt,
204
+ "onUpdate:modelValue": (n) => C.expiredAt = n,
205
+ class: "flex-1",
206
+ label: "",
207
+ "max-fraction-digits": 0,
208
+ min: 0,
209
+ max: 9999,
210
+ step: 1
211
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]),
212
+ g(N, {
213
+ class: "w-24 h-24",
214
+ icon: "close",
215
+ variant: "tertiary",
216
+ onClick: (n) => {
217
+ var e;
218
+ return (e = t(o).titles) == null ? void 0 : e.splice(K, 1);
219
+ }
220
+ }, null, 8, ["onClick"])
221
+ ]),
222
+ (i(!0), w(Y, null, Q(G(`titles.${K}`), (n, e) => (i(), I(D, {
223
+ key: e,
224
+ class: "items-center",
225
+ state: "error",
226
+ text: n.toString()
227
+ }, null, 8, ["text"]))), 128))
228
+ ]))), 128)),
229
+ t(u).length && (((R = t(o).titles) == null ? void 0 : R.length) ?? 0) < t(u).length ? (i(), I(N, {
230
+ key: 2,
231
+ icon: "add",
232
+ label: "Give title",
233
+ variant: "plain",
234
+ onClick: l[3] || (l[3] = (C) => {
235
+ var K;
236
+ return t(o).titles = [
237
+ ...t(o).titles ?? [],
238
+ {
239
+ id: ((K = t(u).find(
240
+ (n) => {
241
+ var e;
242
+ return !((e = t(o).titles) != null && e.map((c) => c.id).includes(n.value));
243
+ }
244
+ )) == null ? void 0 : K.value) || t(u)[0].value,
245
+ expiredAt: 0
246
+ }
247
+ ];
248
+ })
249
+ })) : oe("", !0)
250
+ ]),
251
+ r("div", at, [
252
+ Ee(g(D, {
253
+ state: "warning",
254
+ text: "Updating member will cause tier to change"
255
+ }, null, 512), [
256
+ [Ve, t(a)]
257
+ ]),
258
+ g(H),
259
+ g(N, {
260
+ variant: "secondary",
261
+ label: "Cancel",
262
+ size: "md",
263
+ onClick: l[4] || (l[4] = (C) => t(F).close())
264
+ }),
265
+ g(N, {
266
+ disabled: !!t(k),
267
+ variant: "primary",
268
+ label: "Submit",
269
+ size: "md",
270
+ onClick: U
271
+ }, null, 8, ["disabled"])
272
+ ])
273
+ ], 64);
274
+ };
275
+ }
276
+ }), 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({
277
+ __name: "CreditCoinDialog",
278
+ props: {
279
+ type: { type: String, required: !0 },
280
+ action: { type: String, required: !0 },
281
+ onSubmit: {
282
+ type: Function,
283
+ required: !0
284
+ }
285
+ },
286
+ setup(m) {
287
+ const F = Ce(), f = m, y = j({
288
+ amount: 1,
289
+ day: 1,
290
+ remark: void 0
291
+ }), s = j(!0), o = O(() => _e.formattedType(f.type.toUpperCase()));
292
+ function u(a) {
293
+ s.value = a, !a && f.type === "coin" && (y.value.day = void 0);
294
+ }
295
+ async function d() {
296
+ if (f.action === "send") {
297
+ const a = y.value.day ? `, expire in ${y.value.day} days` : "";
298
+ Te.confirm(
299
+ `Are you sure to send ${y.value.amount} ${o.value.toLowerCase()}${a}? This action cannot be reversed.`
300
+ ).then(async (b) => {
301
+ b && await f.onSubmit(y.value);
302
+ });
303
+ } else
304
+ Te.confirm(
305
+ `Are you sure to deduct ${y.value.amount} ${o.value.toLowerCase()}? This action cannot be reversed.`
306
+ ).then(async (a) => {
307
+ a && await f.onSubmit(y.value);
308
+ });
309
+ }
310
+ const x = O(() => {
311
+ const b = (f.action === "send" ? f.type === "coin" ? Re : Le : f.type === "coin" ? je : qe).safeParse(y.value);
312
+ return b.success == !1 ? b.error.flatten().fieldErrors : void 0;
313
+ });
314
+ return (a, b) => {
315
+ const k = T("FmStepperField"), $ = T("FmSwitch"), G = T("FmTextarea"), U = T("FmButton"), ie = T("FmCard");
316
+ return i(), I(ie, { class: "flex flex-col gap-16 p-16" }, {
317
+ default: se(() => {
318
+ var re, q, ne, p, l, S;
319
+ return [
320
+ r("div", mt, M(f.action == "send" ? "Send" : "Deduct") + " " + M(t(Se)[f.type.toUpperCase()].name), 1),
321
+ ye(" " + M(t(x)) + " ", 1),
322
+ r("div", dt, [
323
+ g(k, {
324
+ modelValue: t(y).amount,
325
+ "onUpdate:modelValue": b[0] || (b[0] = (_) => t(y).amount = _),
326
+ label: `${t(Se)[f.type.toUpperCase()].name} amount`,
327
+ "is-currency": !0,
328
+ "max-fraction-digits": 2,
329
+ "helper-state": (re = t(x)) != null && re.amount ? "error" : void 0,
330
+ "helper-text": (ne = (q = t(x)) == null ? void 0 : q.amount) == null ? void 0 : ne[0]
331
+ }, null, 8, ["modelValue", "label", "helper-state", "helper-text"]),
332
+ m.action === "send" && f.type === "coin" ? (i(), I($, {
333
+ key: 0,
334
+ "model-value": t(s),
335
+ label: `${t(o)} expires`,
336
+ "label-placement": "right",
337
+ "onUpdate:modelValue": b[1] || (b[1] = (_) => u(_))
338
+ }, null, 8, ["model-value", "label"])) : oe("", !0),
339
+ m.action === "send" && t(s) ? (i(), I(k, {
340
+ key: 1,
341
+ modelValue: t(y).day,
342
+ "onUpdate:modelValue": b[2] || (b[2] = (_) => t(y).day = _),
343
+ label: `${t(o)} expires in`,
344
+ "max-fraction-digits": 0,
345
+ "append-text": "day(s)",
346
+ max: 9999,
347
+ min: 0,
348
+ "helper-state": (p = t(x)) != null && p.day ? "error" : void 0,
349
+ "helper-text": (S = (l = t(x)) == null ? void 0 : l.day) == null ? void 0 : S[0]
350
+ }, null, 8, ["modelValue", "label", "helper-state", "helper-text"])) : oe("", !0),
351
+ g(G, {
352
+ modelValue: t(y).remark,
353
+ "onUpdate:modelValue": b[3] || (b[3] = (_) => t(y).remark = _),
354
+ label: "Remark"
355
+ }, null, 8, ["modelValue"])
356
+ ]),
357
+ r("div", ct, [
358
+ g(U, {
359
+ variant: "secondary",
360
+ label: "Cancel",
361
+ size: "md",
362
+ onClick: b[4] || (b[4] = (_) => t(F).close())
363
+ }),
364
+ g(U, {
365
+ disabled: !!t(x),
366
+ variant: "primary",
367
+ label: "Submit",
368
+ size: "md",
369
+ onClick: b[5] || (b[5] = async () => d())
370
+ }, null, 8, ["disabled"])
371
+ ])
372
+ ];
373
+ }),
374
+ _: 1
375
+ });
376
+ };
377
+ }
378
+ }), pt = He("segment", () => {
379
+ const m = j([]);
380
+ async function F() {
381
+ const f = await Ne.readAll({
382
+ limit: 1e3,
383
+ skip: 0,
384
+ sortBy: "_id",
385
+ descending: !0
386
+ });
387
+ m.value = f.resources;
388
+ }
389
+ return {
390
+ segments: m,
391
+ read: F
392
+ };
393
+ });
394
+ class ft extends Je {
395
+ }
396
+ 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({
397
+ __name: "MemberCollectionTable",
398
+ props: {
399
+ member: {
400
+ type: Object,
401
+ required: !0
402
+ },
403
+ title: {
404
+ type: String,
405
+ default: ""
406
+ },
407
+ columns: {
408
+ type: Array,
409
+ default: [],
410
+ required: !0
411
+ },
412
+ filters: {
413
+ type: Object,
414
+ default: {}
415
+ },
416
+ withExport: {
417
+ type: Boolean,
418
+ default: !1
419
+ },
420
+ transformExportRecord: {
421
+ type: Function
422
+ }
423
+ },
424
+ setup(m) {
425
+ const F = m, f = j({
426
+ search: ""
427
+ }), y = j(!1), { tableMeta: s, rowData: o, onSort: u, debouncedFetchData: d, onSearch: x } = We(async (b) => {
428
+ const k = {
429
+ ...f.value,
430
+ ...F.filters
431
+ };
432
+ return await ve.readCollectionsByMemberId(
433
+ F.member._id.toString(),
434
+ b,
435
+ k
436
+ );
437
+ });
438
+ Ae(
439
+ f,
440
+ () => {
441
+ d();
442
+ },
443
+ { deep: !0 }
444
+ );
445
+ async function a() {
446
+ try {
447
+ y.value = !0;
448
+ const b = {
449
+ ...f.value,
450
+ ...F.filters
451
+ };
452
+ await Qe({
453
+ exporter: new ft(),
454
+ readFunction: (k) => ve.readCollectionsByMemberId(
455
+ F.member._id.toString(),
456
+ k,
457
+ b
458
+ ),
459
+ transformRecord: F.transformExportRecord,
460
+ filename: `${F.member._id.toString()}-${F.title.replace(" ", "-").toLowerCase()}`
461
+ });
462
+ } catch (b) {
463
+ console.error(b);
464
+ } finally {
465
+ y.value = !1;
466
+ }
467
+ }
468
+ return Ie(async () => {
469
+ await d();
470
+ }), (b, k) => {
471
+ const $ = T("FmSearch"), G = T("FmButton");
472
+ return i(), w("div", bt, [
473
+ r("div", yt, [
474
+ g($, {
475
+ class: "hidden xs:!flex",
476
+ modelValue: t(f).search,
477
+ "onUpdate:modelValue": [
478
+ k[0] || (k[0] = (U) => t(f).search = U),
479
+ t(x)
480
+ ],
481
+ placeholder: "Search",
482
+ collapsible: ""
483
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]),
484
+ m.withExport ? (i(), I(G, {
485
+ key: 0,
486
+ icon: "ios_share",
487
+ variant: "tertiary",
488
+ onClick: a
489
+ })) : oe("", !0)
490
+ ]),
491
+ r("div", vt, [
492
+ r("div", gt, [
493
+ r("div", xt, M(F.title), 1),
494
+ r("div", ht, M(t(s).totalRows), 1)
495
+ ]),
496
+ r("div", _t, [
497
+ g($, {
498
+ modelValue: t(f).search,
499
+ "onUpdate:modelValue": [
500
+ k[1] || (k[1] = (U) => t(f).search = U),
501
+ t(x)
502
+ ],
503
+ placeholder: "Search"
504
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]),
505
+ m.withExport ? (i(), I(G, {
506
+ key: 0,
507
+ icon: "ios_share",
508
+ variant: "tertiary",
509
+ onClick: a
510
+ })) : oe("", !0)
511
+ ])
512
+ ]),
513
+ g(Xe, {
514
+ loading: t(s).isLoading,
515
+ "row-data": t(o),
516
+ "row-count": t(s).totalRows,
517
+ "column-defs": m.columns,
518
+ "page-count": t(s).pageCount,
519
+ "page-index": t(s).pageIndex,
520
+ "page-size": t(s).pageSize,
521
+ "shrink-at": !1,
522
+ onSortChange: t(u),
523
+ onPageChange: k[2] || (k[2] = (U) => t(d)({
524
+ pageSize: U.pageSize,
525
+ pageIndex: U.pageIndex
526
+ }))
527
+ }, null, 8, ["loading", "row-data", "row-count", "column-defs", "page-count", "page-index", "page-size", "onSortChange"])
528
+ ]);
529
+ };
530
+ }
531
+ }), Ct = /* @__PURE__ */ ae({
532
+ __name: "MemberVouchers",
533
+ props: {
534
+ member: {
535
+ type: Object,
536
+ required: !0
537
+ }
538
+ },
539
+ setup(m) {
540
+ const F = m, f = [
541
+ {
542
+ header: "Voucher title",
543
+ meta: {
544
+ maxWidth: "300px"
545
+ },
546
+ cell(o) {
547
+ var u;
548
+ return le(
549
+ "div",
550
+ { class: "text-ellipsis truncate" },
551
+ ((u = o.row.original.pf_collectible) == null ? void 0 : u.name) || "-"
552
+ );
553
+ },
554
+ enableSorting: !1
555
+ },
556
+ {
557
+ header: "Claimed at",
558
+ accessorKey: "_id",
559
+ accessorFn: (o) => h(ge(o._id.toString())).format("D MMM YYYY"),
560
+ enableSorting: !1
561
+ },
562
+ {
563
+ header: "Expired at",
564
+ cell(o) {
565
+ var d, x, a, b;
566
+ 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(
567
+ "D MMM YYYY"
568
+ ) : "-";
569
+ return le("div", {}, u);
570
+ },
571
+ enableSorting: !0
572
+ },
573
+ {
574
+ header: "Transfer open",
575
+ accessorFn: (o) => {
576
+ var u, d, x;
577
+ return Ke((x = (d = (u = o.pf_collectible) == null ? void 0 : u.options) == null ? void 0 : d.enableTransfer) == null ? void 0 : x.toString());
578
+ },
579
+ enableSorting: !1
580
+ }
581
+ ], y = (o) => ({
582
+ type: he.enum.VOUCHER,
583
+ isActive: o
584
+ }), s = (o) => {
585
+ var u, d, x, a, b, k, $;
586
+ return {
587
+ CollectionID: o._id,
588
+ Title: (u = o.pf_collectible) == null ? void 0 : u.name,
589
+ ClaimedAt: h(ge(o._id.toString())).format(
590
+ "D MMM YYYY, hh:mmA"
591
+ ),
592
+ 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") : "",
593
+ TransferOpen: (($ = (k = o.pf_collectible) == null ? void 0 : k.options) == null ? void 0 : $.enableTransfer) || !1
594
+ };
595
+ };
596
+ return (o, u) => (i(), w(Y, null, [
597
+ u[0] || (u[0] = r("div", { class: "fm-typo-en-title-sm-600 mb-16" }, "Voucher Collections", -1)),
598
+ g(xe, {
599
+ member: F.member,
600
+ columns: f,
601
+ title: "Active voucher",
602
+ filters: y(!0),
603
+ withExport: !0,
604
+ transformExportRecord: s
605
+ }, null, 8, ["member", "filters"]),
606
+ g(xe, {
607
+ member: F.member,
608
+ columns: f,
609
+ title: "Past voucher",
610
+ filters: y(!1),
611
+ withExport: !0,
612
+ transformExportRecord: s
613
+ }, null, 8, ["member", "filters"])
614
+ ], 64));
615
+ }
616
+ }), St = /* @__PURE__ */ ae({
617
+ __name: "MemberMissions",
618
+ props: {
619
+ member: {
620
+ type: Object,
621
+ required: !0
622
+ }
623
+ },
624
+ setup(m) {
625
+ const F = m, f = [
626
+ {
627
+ header: "Mission title",
628
+ meta: {
629
+ maxWidth: "300px"
630
+ },
631
+ cell(s) {
632
+ var o;
633
+ return le(
634
+ "div",
635
+ { class: "text-ellipsis truncate" },
636
+ ((o = s.row.original.pf_campaign) == null ? void 0 : o.name) || "Deleted Campaign"
637
+ );
638
+ },
639
+ enableSorting: !1
640
+ },
641
+ {
642
+ header: "Type",
643
+ accessorFn: (s) => {
644
+ var o, u, d;
645
+ 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) || "-");
646
+ },
647
+ enableSorting: !1
648
+ },
649
+ {
650
+ header: "Status",
651
+ cell(s) {
652
+ var o;
653
+ if (s.row.original.pf_campaign) {
654
+ const u = {
655
+ active: "text-fm-color-typo-warning bg-fm-color-system-warning-100",
656
+ upcoming: "text-fm-color-typo-info bg-fm-color-system-info-100",
657
+ completed: "text-fm-color-typo-success bg-fm-color-system-success-100",
658
+ expired: "text-fm-color-typo-error bg-fm-color-system-error-100"
659
+ }, d = Ze(
660
+ s.row.original.pf_campaign
661
+ ), 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;
662
+ return le(we.FmChip, {
663
+ class: u[a],
664
+ label: Me.title(a),
665
+ compact: !0
666
+ });
667
+ }
668
+ return le(we.FmChip, {
669
+ class: "",
670
+ label: "-",
671
+ compact: !0
672
+ });
673
+ },
674
+ enableSorting: !1
675
+ },
676
+ {
677
+ header: "Summary",
678
+ accessorFn: (s) => s != null && s.pf_campaign ? et(s.pf_campaign) : "Deleted Campaign",
679
+ enableSorting: !1
680
+ },
681
+ {
682
+ header: "Current Step",
683
+ accessorKey: "balance",
684
+ enableSorting: !1
685
+ },
686
+ {
687
+ header: "Total Step",
688
+ accessorFn: (s) => {
689
+ var o, u, d;
690
+ 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;
691
+ },
692
+ enableSorting: !1
693
+ }
694
+ ], y = {
695
+ type: he.enum.STAMP
696
+ };
697
+ return (s, o) => (i(), w(Y, null, [
698
+ o[0] || (o[0] = r("div", { class: "fm-typo-en-title-sm-600 mb-16" }, "Mission", -1)),
699
+ g(xe, {
700
+ member: F.member,
701
+ columns: f,
702
+ title: "Mission",
703
+ filters: y
704
+ }, null, 8, ["member"])
705
+ ], 64));
706
+ }
707
+ }), wt = /* @__PURE__ */ ae({
708
+ __name: "MemberGames",
709
+ props: {
710
+ member: {
711
+ type: Object,
712
+ required: !0
713
+ }
714
+ },
715
+ setup(m) {
716
+ const F = m, f = [
717
+ {
718
+ header: "Game title",
719
+ meta: {
720
+ maxWidth: "300px"
721
+ },
722
+ cell(s) {
723
+ var o;
724
+ return le(
725
+ "div",
726
+ { class: "text-ellipsis truncate" },
727
+ ((o = s.row.original.pf_campaign) == null ? void 0 : o.name) || "-"
728
+ );
729
+ },
730
+ enableSorting: !1
731
+ },
732
+ {
733
+ header: "Claimed at",
734
+ accessorKey: "_id",
735
+ accessorFn: (s) => h(ge(s._id.toString())).format("D MMM YYYY"),
736
+ enableSorting: !1
737
+ },
738
+ {
739
+ header: "Expired at",
740
+ cell(s) {
741
+ var u, d, x, a;
742
+ 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(
743
+ "D MMM YYYY"
744
+ ) : "-";
745
+ return le("div", {}, o);
746
+ },
747
+ enableSorting: !1
748
+ },
749
+ {
750
+ header: "Token received",
751
+ accessorKey: "balance",
752
+ enableSorting: !1
753
+ }
754
+ ], y = (s) => ({
755
+ type: he.enum.GAME,
756
+ isActive: s
757
+ });
758
+ return (s, o) => (i(), w(Y, null, [
759
+ o[0] || (o[0] = r("div", { class: "fm-typo-en-title-sm-600 mb-16" }, "Game program", -1)),
760
+ g(xe, {
761
+ member: F.member,
762
+ columns: f,
763
+ title: "Active game token",
764
+ filters: y(!0)
765
+ }, null, 8, ["member", "filters"])
766
+ ], 64));
767
+ }
768
+ }), 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" }, Tt = { class: "flex gap-16 items-center" }, At = { 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-800" }, Yt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ut = { class: "fm-typo-en-body-md-600" }, 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" }, Lt = { class: "flex justify-between mb-16" }, jt = { 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 = {
769
+ key: 0,
770
+ class: "space-x-8"
771
+ }, Xt = {
772
+ key: 1,
773
+ class: "text-fm-color-typo-secondary"
774
+ }, 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 = {
775
+ key: 1,
776
+ class: "text-fm-color-typo-secondary"
777
+ }, oo = {
778
+ key: 1,
779
+ class: "space-y-24"
780
+ }, 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" }, Go = /* @__PURE__ */ ae({
781
+ __name: "MemberDetailSheet",
782
+ props: {
783
+ member: {
784
+ type: Object,
785
+ required: !0
786
+ }
787
+ },
788
+ emits: ["update:member"],
789
+ setup(m, { expose: F, emit: f }) {
790
+ const y = tt(), s = Ge(), o = $e(), u = pt(), d = Ce(), { minor: x } = ze, a = m, b = f, k = O(() => s.locations.map((n) => ({
791
+ label: n.name,
792
+ value: n._id
793
+ }))), $ = O(() => (a.member.segment || []).map((n) => {
794
+ var e;
795
+ return ((e = u.segments.find((c) => c._id === n)) == null ? void 0 : e.name) || "";
796
+ }).filter(Boolean)), G = [
797
+ {
798
+ label: "Loyalty",
799
+ stats: [
800
+ {
801
+ label: "Experiences",
802
+ getter: (n) => {
803
+ var e, c, A;
804
+ return te(((A = (c = (e = n.collection) == null ? void 0 : e.POINT) == null ? void 0 : c[0]) == null ? void 0 : A.balance) ?? 0, 2);
805
+ }
806
+ },
807
+ {
808
+ label: "Credits",
809
+ getter: (n) => {
810
+ var e, c, A;
811
+ return te(((A = (c = (e = n.collection) == null ? void 0 : e.CREDIT) == null ? void 0 : c[0]) == null ? void 0 : A.balance) ?? 0, 2);
812
+ }
813
+ }
814
+ ]
815
+ },
816
+ {
817
+ label: "Voucher",
818
+ stats: [
819
+ {
820
+ label: "Active vouchers",
821
+ getter: () => te(P.value.active, 0)
822
+ },
823
+ {
824
+ label: "Past vouchers",
825
+ getter: () => te(P.value.past, 0)
826
+ }
827
+ ]
828
+ },
829
+ {
830
+ label: "Mission",
831
+ stats: [
832
+ {
833
+ label: "Stamp missions",
834
+ getter: () => te(B.value.stamp, 0)
835
+ },
836
+ {
837
+ label: "Progress missions",
838
+ getter: () => te(B.value.progressive, 0)
839
+ }
840
+ ]
841
+ },
842
+ {
843
+ label: "Game",
844
+ stats: [
845
+ {
846
+ label: "Tokens",
847
+ getter: (n) => {
848
+ var e, c;
849
+ return te(
850
+ ((c = (e = n.collection) == null ? void 0 : e.GAME) == null ? void 0 : c.reduce(
851
+ (A, E) => A + E.balance,
852
+ 0
853
+ )) || 0,
854
+ 0
855
+ );
856
+ }
857
+ }
858
+ ]
859
+ },
860
+ {
861
+ label: "Store bundle",
862
+ stats: [
863
+ {
864
+ label: "Bundle purchased",
865
+ getter: () => te(N.value, 0)
866
+ }
867
+ ]
868
+ }
869
+ ], ie = (() => {
870
+ const e = [];
871
+ for (let c = 0; c < G.length; c += 3)
872
+ e.push(G.slice(c, c + 3));
873
+ return e;
874
+ })();
875
+ async function re(n, e) {
876
+ switch (n.stopPropagation(), e) {
877
+ case "Store bundle":
878
+ await y.push({
879
+ name: rt["$connect-LOYALTY_MEMBER_TRANSACTIONS"],
880
+ params: { id: a.member._id.toString() },
881
+ query: { tab: "store" }
882
+ });
883
+ break;
884
+ default:
885
+ C.value = R.find((c) => c.label === e) || R[0];
886
+ break;
887
+ }
888
+ }
889
+ async function q(n, e) {
890
+ d.open({
891
+ title: "",
892
+ dialogComponent: ut,
893
+ dialogComponentProps: {
894
+ type: n,
895
+ action: e,
896
+ onSubmit: async (c) => {
897
+ await x(
898
+ async () => {
899
+ const A = {
900
+ "credit-send": fe.sendCredit,
901
+ "credit-deduct": fe.deductCredit,
902
+ "coin-send": fe.sendCoin,
903
+ "coin-deduct": fe.deductCoin
904
+ }, E = `${n}-${e}`, W = A[E];
905
+ W && await W(a.member._id, c), b("update:member"), d.close();
906
+ },
907
+ {
908
+ message: `Adjusting ${_e.formattedType(
909
+ n.toUpperCase()
910
+ ).toLowerCase()}`,
911
+ successMessage: `${c.amount} ${_e.formattedType(
912
+ n.toUpperCase()
913
+ ).toLowerCase()} ${e} ${e == "send" ? "to" : "from"} ${a.member.phoneNumber}`
914
+ }
915
+ );
916
+ }
917
+ }
918
+ });
919
+ }
920
+ async function ne() {
921
+ d.open({
922
+ title: "Update member statistics",
923
+ contentComponent: it,
924
+ contentComponentProps: {
925
+ member: a.member,
926
+ onSubmit: async (n) => {
927
+ await x(
928
+ async () => {
929
+ await fe.updateMember(a.member._id, n), b("update:member"), d.close();
930
+ },
931
+ {
932
+ message: "Updating member stats",
933
+ successMessage: `Updated member ${a.member.phoneNumber} stats successfully`
934
+ }
935
+ );
936
+ }
937
+ }
938
+ });
939
+ }
940
+ const p = [
941
+ {
942
+ label: "Mobile No.",
943
+ key: "phoneNumber"
944
+ },
945
+ {
946
+ label: "Tier",
947
+ getter: (n) => {
948
+ var me, de, be, v, V;
949
+ 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, A = ((v = (be = n.collection) == null ? void 0 : be.POINT) == null ? void 0 : v[0].balance) ?? 0, E = o.sortedTiers[e + 1], W = ((V = E == null ? void 0 : E.option) == null ? void 0 : V.from) ?? 1 / 0;
950
+ return `${c} (${A}/${W})`;
951
+ }
952
+ },
953
+ {
954
+ label: "Email",
955
+ key: "email"
956
+ },
957
+ {
958
+ label: "Birthday",
959
+ getter: (n) => n.birthday ? h(n.birthday).format("D MMM YYYY") : "-"
960
+ }
961
+ ], l = [
962
+ {
963
+ label: "Customer since",
964
+ getter: (n) => h(ge(n._id.toString())).format("D MMM YYYY")
965
+ },
966
+ {
967
+ label: "Joined at location",
968
+ getter: (n) => {
969
+ var e;
970
+ return n != null && n.location && ((e = k.value.find((c) => c.value == n.location)) == null ? void 0 : e.label) || "-";
971
+ }
972
+ },
973
+ {
974
+ label: "Total visit(s)",
975
+ getter: (n) => ke.singularOrPlural(n.stats.visitCount, "bill")
976
+ },
977
+ {
978
+ label: "Last visit",
979
+ getter: (n) => h(n.stats.lastVisit).fromNow()
980
+ },
981
+ {
982
+ label: "Frequency",
983
+ getter: (n) => `Every ${ke.singularOrPlural(
984
+ Number(Math.ceil(n.stats.avgVisitFrequency).toFixed(0)),
985
+ "day"
986
+ )}`
987
+ },
988
+ {
989
+ label: "Average spend",
990
+ getter: (n) => Ue.Dinero.fromNumber({ number: Number(n.stats.avgBillSize || 0) }).toFormat(
991
+ !0
992
+ )
993
+ }
994
+ // {
995
+ // label: 'Feedback',
996
+ // key: 'feedbackCount',
997
+ // },
998
+ // {
999
+ // label: 'Tier Earned this season',
1000
+ // key: 'lastSeasonTierEarned',
1001
+ // },
1002
+ // {
1003
+ // label: 'Point Earned this season',
1004
+ // key: 'lastSeasonPointEarned',
1005
+ // },
1006
+ ], S = O(() => {
1007
+ var c, A;
1008
+ const n = (((A = Fe.first((c = a.member.collection) == null ? void 0 : c.TIER)) == null ? void 0 : A.balance) || 0) - 1, e = o.sortedTiers[n];
1009
+ return { name: (e == null ? void 0 : e.name) || "-", tier: n, config: e };
1010
+ }), _ = O(() => {
1011
+ var n;
1012
+ return (((n = a.member.collection) == null ? void 0 : n.TITLE) || []).map((e) => {
1013
+ var A, E, W;
1014
+ const c = (A = o.sortedTitles) == null ? void 0 : A.find(
1015
+ (me) => me._id == e.collectible
1016
+ );
1017
+ return {
1018
+ name: c == null ? void 0 : c.name,
1019
+ expiredAt: (W = (E = e.expiryBalance) == null ? void 0 : E.at(-1)) == null ? void 0 : W.expiredAt,
1020
+ collectible: c
1021
+ };
1022
+ }).filter(
1023
+ (e) => e.expiredAt ? h(e.expiredAt).isAfter(h()) : !0
1024
+ );
1025
+ }), B = j({ stamp: 0, progressive: 0 }), P = j({ active: 0, past: 0 }), z = j([]), N = O(
1026
+ () => z.value.reduce((n, e) => n + e.count, 0)
1027
+ ), D = j(!0);
1028
+ function H() {
1029
+ D.value = !0, C.value = R[0];
1030
+ }
1031
+ function Z() {
1032
+ D.value = !1;
1033
+ }
1034
+ const R = [
1035
+ {
1036
+ label: "Overview",
1037
+ value: "overview"
1038
+ },
1039
+ {
1040
+ label: "Loyalty",
1041
+ value: "loyalty"
1042
+ },
1043
+ {
1044
+ label: "Voucher",
1045
+ value: "voucher"
1046
+ },
1047
+ {
1048
+ label: "Mission",
1049
+ value: "mission"
1050
+ },
1051
+ {
1052
+ label: "Game",
1053
+ value: "game"
1054
+ }
1055
+ ], C = j(R[0]), K = async () => {
1056
+ P.value = await ve.readCollectionCountByMemberId(
1057
+ a.member._id.toString(),
1058
+ he.enum.VOUCHER
1059
+ ), z.value = await ot.readPurchaseCountByMember(
1060
+ a.member._id.toString()
1061
+ ), B.value = await ve.readMissionCountByMemberId(
1062
+ a.member._id.toString()
1063
+ );
1064
+ };
1065
+ return Be(async () => {
1066
+ await o.readMembership(), await K(), s.locations.length || await s.readLocations();
1067
+ }), Ae(D, async () => {
1068
+ await K();
1069
+ }), F({
1070
+ showSheet: H,
1071
+ hideSheet: Z
1072
+ }), (n, e) => {
1073
+ const c = T("FmTabs"), A = T("FmAvatar"), E = T("FmButton"), W = T("FmIcon"), me = T("FmChip"), de = T("FmCard"), be = T("FmSideSheet");
1074
+ return i(), I(be, {
1075
+ modelValue: t(D),
1076
+ "onUpdate:modelValue": e[5] || (e[5] = (v) => De(D) ? D.value = v : null),
1077
+ header: "Member Detail",
1078
+ "dismiss-away": "",
1079
+ "close-button": !0,
1080
+ "max-width": 1100
1081
+ }, {
1082
+ "side-sheet-footer": se(() => [...e[19] || (e[19] = [])]),
1083
+ default: se(() => [
1084
+ r("div", Ft, [
1085
+ r("div", null, [
1086
+ g(c, {
1087
+ "model-value": t(C).value,
1088
+ items: R,
1089
+ class: "overflow-x-auto",
1090
+ "onUpdate:modelValue": e[0] || (e[0] = (v) => C.value = R.find((V) => V.value === v))
1091
+ }, null, 8, ["model-value"])
1092
+ ]),
1093
+ t(C).value == "overview" ? (i(), w(Y, { key: 0 }, [
1094
+ r("div", Mt, [
1095
+ r("div", null, [
1096
+ e[9] || (e[9] = r("div", { class: "fm-typo-en-title-sm-800 mb-16" }, "Profile Information", -1)),
1097
+ r("div", kt, [
1098
+ r("div", Tt, [
1099
+ g(A, {
1100
+ name: m.member.photoUrl ? void 0 : m.member.name,
1101
+ src: m.member.photoUrl || void 0
1102
+ }, null, 8, ["name", "src"]),
1103
+ r("div", At, [
1104
+ e[8] || (e[8] = r("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Member Name ", -1)),
1105
+ r("div", $t, M(m.member.name), 1),
1106
+ r("div", Et, M(m.member._id), 1),
1107
+ r("div", Vt, [
1108
+ e[6] || (e[6] = ye(" Member Card: ", -1)),
1109
+ r("span", It, M(m.member.cardNo ? m.member.cardNo : "-"), 1)
1110
+ ]),
1111
+ r("div", Bt, [
1112
+ e[7] || (e[7] = ye(" Referral Code: ", -1)),
1113
+ r("span", Dt, M(m.member.referralCode ? m.member.referralCode : "-"), 1)
1114
+ ])
1115
+ ]),
1116
+ g(E, {
1117
+ variant: "tertiary",
1118
+ icon: "settings",
1119
+ onClick: ne
1120
+ })
1121
+ ]),
1122
+ (i(), w(Y, null, Q(p, (v, V) => r("div", { key: V }, [
1123
+ r("div", Yt, M(v.label), 1),
1124
+ r("div", Ut, M(v.key ? m.member[v.key] : v.getter(m.member)), 1)
1125
+ ])), 64))
1126
+ ])
1127
+ ]),
1128
+ r("div", null, [
1129
+ e[10] || (e[10] = r("div", { class: "fm-typo-en-title-sm-800 mb-16" }, "Activities", -1)),
1130
+ r("div", Nt, [
1131
+ (i(), w(Y, null, Q(l, (v) => r("div", {
1132
+ key: v.key
1133
+ }, [
1134
+ r("div", Ot, M(v.label), 1),
1135
+ r("div", Pt, M(v.key ? a.member.stats[v.key] || "-" : v.getter(m.member)), 1)
1136
+ ])), 64))
1137
+ ])
1138
+ ])
1139
+ ]),
1140
+ e[13] || (e[13] = r("div", { class: "border-fm-color-neutral-gray-100 rounded-sm border-t" }, null, -1)),
1141
+ (i(!0), w(Y, null, Q(t(ie), (v) => (i(), w("div", Rt, [
1142
+ (i(!0), w(Y, null, Q(v, (V, ee) => (i(), w("div", { key: ee }, [
1143
+ r("div", {
1144
+ class: Ye(ee !== 0 ? "pt-12 md:pt-0 lg:pt-0 md:pl-12 lg:pl-12" : "")
1145
+ }, [
1146
+ r("div", Lt, [
1147
+ r("div", jt, M(V.label), 1),
1148
+ r("button", {
1149
+ onClick: (L) => re(L, V.label)
1150
+ }, [
1151
+ g(W, {
1152
+ name: "chevron_right",
1153
+ outline: "",
1154
+ size: "md"
1155
+ })
1156
+ ], 8, qt)
1157
+ ]),
1158
+ r("div", zt, [
1159
+ (i(!0), w(Y, null, Q(V.stats, (L) => (i(), w("div", {
1160
+ key: L.key
1161
+ }, [
1162
+ r("div", Gt, M(L.label), 1),
1163
+ r("div", Ht, M(L.getter(m.member)), 1)
1164
+ ]))), 128))
1165
+ ])
1166
+ ], 2)
1167
+ ]))), 128))
1168
+ ]))), 256)),
1169
+ r("div", Kt, [
1170
+ e[11] || (e[11] = r("div", { class: "fm-typo-en-title-sm-800" }, "Segments", -1)),
1171
+ t($).length ? (i(), w("div", Wt, [
1172
+ (i(!0), w(Y, null, Q(t($), (v) => (i(), I(me, {
1173
+ label: v.toString()
1174
+ }, null, 8, ["label"]))), 256))
1175
+ ])) : (i(), w("div", Xt, "No titles"))
1176
+ ]),
1177
+ e[14] || (e[14] = r("div", { class: "border-fm-color-neutral-gray-100 rounded-sm border-t" }, null, -1)),
1178
+ r("div", Jt, [
1179
+ e[12] || (e[12] = r("div", { class: "fm-typo-en-title-sm-800" }, "Title badge", -1)),
1180
+ t(_).length ? (i(!0), w(Y, { key: 0 }, Q(t(_).filter((v) => v.collectible), (v) => (i(), w("div", {
1181
+ class: "flex items-center gap-x-8 h-48",
1182
+ key: v.name
1183
+ }, [
1184
+ r("img", {
1185
+ src: v.collectible.image || t(Oe),
1186
+ class: "aspect-square h-full object-contain"
1187
+ }, null, 8, Qt),
1188
+ r("div", null, [
1189
+ r("div", Zt, M(v.name), 1),
1190
+ r("div", eo, " Expired on " + M(t(h)(v.expiredAt).format("MMM D, Y")), 1)
1191
+ ])
1192
+ ]))), 128)) : (i(), w("div", to, "No titles"))
1193
+ ])
1194
+ ], 64)) : t(C).value == "loyalty" ? (i(), w("div", oo, [
1195
+ g(de, {
1196
+ class: "p-16 space-y-24",
1197
+ variant: "outlined"
1198
+ }, {
1199
+ default: se(() => {
1200
+ var v, V, ee, L, ce, ue, pe;
1201
+ return [
1202
+ r("div", ro, [
1203
+ e[15] || (e[15] = r("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Credit ", -1)),
1204
+ 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)
1205
+ ]),
1206
+ r("div", so, [
1207
+ 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)),
1208
+ r("div", lo, M(((pe = (ue = (ce = (L = m.member.collection) == null ? void 0 : L.CREDIT) == null ? void 0 : ce[0]) == null ? void 0 : ue.expiryBalance) == null ? void 0 : pe.reduce(
1209
+ (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,
1210
+ 0
1211
+ )) ?? 0), 1)
1212
+ ]),
1213
+ r("div", ao, [
1214
+ g(E, {
1215
+ label: "Add credit",
1216
+ icon: "add",
1217
+ variant: "plain",
1218
+ onClick: e[1] || (e[1] = (X) => q("credit", "send"))
1219
+ }),
1220
+ g(E, {
1221
+ label: "Deduct credit",
1222
+ icon: "remove",
1223
+ variant: "plain",
1224
+ onClick: e[2] || (e[2] = (X) => q("credit", "deduct"))
1225
+ })
1226
+ ])
1227
+ ];
1228
+ }),
1229
+ _: 1
1230
+ }),
1231
+ g(de, {
1232
+ class: "p-16 space-y-24",
1233
+ variant: "outlined"
1234
+ }, {
1235
+ default: se(() => {
1236
+ var v, V, ee, L, ce, ue, pe;
1237
+ return [
1238
+ r("div", io, [
1239
+ e[17] || (e[17] = r("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Point ", -1)),
1240
+ 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)
1241
+ ]),
1242
+ r("div", co, [
1243
+ 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)),
1244
+ r("div", uo, M(((pe = (ue = (ce = (L = m.member.collection) == null ? void 0 : L.COIN) == null ? void 0 : ce[0]) == null ? void 0 : ue.expiryBalance) == null ? void 0 : pe.reduce(
1245
+ (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,
1246
+ 0
1247
+ )) ?? 0), 1)
1248
+ ]),
1249
+ r("div", po, [
1250
+ g(E, {
1251
+ label: "Add point",
1252
+ icon: "add",
1253
+ variant: "plain",
1254
+ onClick: e[3] || (e[3] = (X) => q("coin", "send"))
1255
+ }),
1256
+ g(E, {
1257
+ label: "Deduct point",
1258
+ icon: "remove",
1259
+ variant: "plain",
1260
+ onClick: e[4] || (e[4] = (X) => q("coin", "deduct"))
1261
+ })
1262
+ ])
1263
+ ];
1264
+ }),
1265
+ _: 1
1266
+ })
1267
+ ])) : t(C).value == "voucher" ? (i(), I(Ct, {
1268
+ key: 2,
1269
+ member: a.member
1270
+ }, null, 8, ["member"])) : t(C).value == "mission" ? (i(), I(St, {
1271
+ key: 3,
1272
+ member: a.member
1273
+ }, null, 8, ["member"])) : t(C).value == "game" ? (i(), I(wt, {
1274
+ key: 4,
1275
+ member: a.member
1276
+ }, null, 8, ["member"])) : oe("", !0)
1277
+ ])
1278
+ ]),
1279
+ _: 1
1280
+ }, 8, ["modelValue"]);
1281
+ };
1282
+ }
1283
+ });
1284
+ export {
1285
+ Go as _,
1286
+ pt as u
1287
+ };