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

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 (115) hide show
  1. package/dist/{App-BX2UE7QI.js → App-JFPlzU0L.js} +8 -8
  2. package/dist/{AuditLogs-Crhi9QVp.js → AuditLogs-Bk6QCZgp.js} +10 -10
  3. package/dist/{Bin-xPurvadn.js → Bin-CHi79olc.js} +8 -8
  4. package/dist/{Broadcast-CUYyGJY-.js → Broadcast-DSicPemE.js} +11 -11
  5. package/dist/{CampaignAnalytic-BfUdUO6Y.js → CampaignAnalytic-B3czdnvb.js} +6 -6
  6. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BoXhFyzX.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CkC0A-ix.js} +7 -7
  7. package/dist/{Card-CISdGnSl.js → Card-Begf7uD_.js} +20 -20
  8. package/dist/{Collections-N7QyYqC-.js → Collections-BSmTzG4a.js} +8 -8
  9. package/dist/{Credit-DpgSuzmF.js → Credit-BqZ9lr6S.js} +12 -12
  10. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-Ber_smZ-.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-qMqks3fR.js} +32 -32
  11. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-CoJVTW3E.js → EffectSheet.vue_vue_type_style_index_0_lang-Ck2PxSye.js} +6 -6
  12. package/dist/{Experience-DO7c3BW8.js → Experience-i0bu7uAI.js} +12 -12
  13. package/dist/{FileSaver.min-Bjq1OZ_L.js → FileSaver.min-Ck6lXfKM.js} +1 -1
  14. package/dist/{Game-BHtJD6LM.js → Game-Be02GnjR.js} +13 -13
  15. package/dist/GiftCardSetup-DPN3NhND.js +662 -0
  16. package/dist/{Grab-BOMxmAcZ.js → Grab-BKIYI2d-.js} +9 -9
  17. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-bEHeJol7.js → ImageInput.vue_vue_type_script_setup_true_lang-BqylTCHX.js} +1 -1
  18. package/dist/{Index-S2H2GVM8.js → Index-BD_l8T_M.js} +10 -10
  19. package/dist/{LocationPicker.vue_vue_type_script_setup_true_lang-cgXkx7R_.js → LocationPicker.vue_vue_type_script_setup_true_lang-Cch5RizQ.js} +1 -1
  20. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-CQQJuVCF.js → LottieAnimation.vue_vue_type_script_setup_true_lang-D3psJutm.js} +1 -1
  21. package/dist/{LoyaltyDashboard-CbwiKazp.js → LoyaltyDashboard-D0eq0Gaw.js} +7 -7
  22. package/dist/{MainLayout-CPS8NNOv.js → MainLayout-C96xSNND.js} +3 -3
  23. package/dist/{Marketing-zIfCm74o.js → Marketing-Bg6DFKg5.js} +4 -4
  24. package/dist/{MarketingMaterialEdit-D8Gj0bOa.js → MarketingMaterialEdit-BYbWgB2R.js} +6 -6
  25. package/dist/Member-B4NAFx8G.js +573 -0
  26. package/dist/MemberImportHistory-Bw-M3Zx-.js +185 -0
  27. package/dist/{MemberList-CzLYfaf5.js → MemberList-DXpa6_Rb.js} +26 -26
  28. package/dist/{MemberTransactions-CeaEuCte.js → MemberTransactions-DEzFrc9e.js} +1 -1
  29. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-BDqO9M6_.js → MessageInput.vue_vue_type_script_setup_true_lang-CFpMazFG.js} +9 -9
  30. package/dist/{Mission-B4UV0vB0.js → Mission-CWeWfTdC.js} +13 -13
  31. package/dist/{Overview-Ddua14pp.js → Overview-CPMN5kuM.js} +3 -3
  32. package/dist/{Overview-DIX5ot1i.js → Overview-De06lJt0.js} +19 -19
  33. package/dist/{Point-CIFEhEU0.js → Point-XfVYDIbj.js} +12 -12
  34. package/dist/{Promotion-DJRRCgsu.js → Promotion-Q646p6RE.js} +13 -13
  35. package/dist/{Queue-PxS_JYvd.js → Queue-BNfc0ySV.js} +11 -11
  36. package/dist/{Record-DbOoWfsG.js → Record-Dx5pZmpm.js} +9 -9
  37. package/dist/{Review-BmUzIF6a.js → Review-BX5Z5ivr.js} +2 -2
  38. package/dist/{ReviewFacebookCallback-ABDk27W_.js → ReviewFacebookCallback-B6GFP04-.js} +5 -5
  39. package/dist/{ReviewGoogleCallback-JiGhuvNs.js → ReviewGoogleCallback-BWgxTbuf.js} +5 -5
  40. package/dist/{Reward-C9JJh35t.js → Reward-DOImZVUL.js} +16 -16
  41. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-CoHS8BGv.js → RewardGroup.vue_vue_type_script_setup_true_lang-8fuZmrBK.js} +12 -12
  42. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-CH_hNR0X.js → RuleGroup.vue_vue_type_script_setup_true_lang-C9kWB5Zw.js} +15 -15
  43. package/dist/{Segment-BDF6homc.js → Segment-BndDCfLd.js} +25 -25
  44. package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-CotltnlA.js → SelectItems.vue_vue_type_script_setup_true_lang-DV1X7e-_.js} +2 -2
  45. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-Dm1Rm5yj.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-O9ohGQxg.js} +13 -13
  46. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-Bu3TFRAU.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-D2knZbHq.js} +4 -4
  47. package/dist/{Setting-I1UmwNUM.js → Setting-DPm0lJmq.js} +14 -14
  48. package/dist/{SettingAdvertisements-BTSCR7Ca.js → SettingAdvertisements-DdPGyRNI.js} +12 -12
  49. package/dist/{Settings-F8t7rjZL.js → Settings-BQPDUWyz.js} +5 -5
  50. package/dist/{Store-DH9SeWMt.js → Store-Cw-c2Wgl.js} +24 -24
  51. package/dist/{StoreRewards-EkAXltsf.js → StoreRewards-CYkHL-h6.js} +15 -15
  52. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-CXQyU9vZ.js → StoreTransactions.vue_vue_type_script_setup_true_lang-DClGeare.js} +21 -21
  53. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-lnEbqNTU.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-DekQ8_F8.js} +2 -2
  54. package/dist/{Tier-DuKpa1Ma.js → Tier-B7QmbFn8.js} +25 -25
  55. package/dist/{Title-DlupKRiB.js → Title-CRM_l4YE.js} +22 -22
  56. package/dist/{Transaction-jCh6b6-e.js → Transaction-C1jXS8Le.js} +2 -2
  57. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-DOvKneyI.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-yPF04Hth.js} +6 -6
  58. package/dist/{Voucher-QOyU02Mg.js → Voucher-Cfh_Wudx.js} +14 -14
  59. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-DH3SHPmi.js → VoucherEditor.vue_vue_type_script_setup_true_lang-BkiXzbFh.js} +12 -12
  60. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-DA98LDj7.js → ZodTextField.vue_vue_type_script_setup_true_lang-BEFynSZm.js} +2 -2
  61. package/dist/{app-CNi4ejgf.js → app-CEWVaJEZ.js} +502 -447
  62. package/dist/app.js +1 -1
  63. package/dist/{business-D_DxmzRi.js → business-DWLMb2lG.js} +5 -5
  64. package/dist/{campaign-CQOgVXhK.js → campaign-DRJO5ydK.js} +2 -2
  65. package/dist/{campaign-DgLtIuZl.js → campaign-DwYJGuSz.js} +7 -7
  66. package/dist/{campaign.fn-DaygvaVk.js → campaign.fn-CPfN51jT.js} +38 -38
  67. package/dist/{collection.fn-C2FPUyIL.js → collection.fn-j4_hDjjy.js} +2 -2
  68. package/dist/{duplicateCampaign-C1GvaB0K.js → duplicateCampaign-CQ-yfh9b.js} +2 -2
  69. package/dist/{effect-CZW6UzGQ.js → effect-DU8lcl8m.js} +1 -1
  70. package/dist/{email-addresses-C0rpNk69.js → email-addresses-DUpMDrGS.js} +2 -2
  71. package/dist/{export-BljjhGlT.js → export-BFMh5l4w.js} +3 -3
  72. package/dist/{helper-BNVm1awI.js → helper-DSvUKuiG.js} +1 -1
  73. package/dist/{index-BTMG_CZc.js → index--mkEqsYz.js} +5 -4
  74. package/dist/{index-B3VxErFJ.js → index-B-tBxRw2.js} +1 -1
  75. package/dist/{index-_RZ5EbvD.js → index-BVWwOMHO.js} +7 -7
  76. package/dist/{index-ChPTYhTe.js → index-C69TnizM.js} +1 -1
  77. package/dist/{index-BLcxRCDQ.js → index-CDyGueuB.js} +13 -13
  78. package/dist/{index-Bl2Io2q7.js → index-CWEtTfxy.js} +2 -2
  79. package/dist/index-CWbvBvE3.js +137 -0
  80. package/dist/{index-ClMqJYPu.js → index-CrKfbYDf.js} +1194 -1150
  81. package/dist/{index--l25G-H2.js → index-CuyxKvmh.js} +2 -2
  82. package/dist/{index-jN921Dx6.js → index-CvVrgPmm.js} +3 -3
  83. package/dist/{index-CuSyySq9.js → index-CvaF2wtX.js} +1 -1
  84. package/dist/{index-CP9JOHTI.js → index-D-swy6qD.js} +1 -1
  85. package/dist/{index-CTDIDrHN.js → index-D8_jwrSU.js} +14 -14
  86. package/dist/{index-20y5ETqa.js → index-DCbCuJXP.js} +1 -1
  87. package/dist/{index-C41OQn3b.js → index-DD3Jlx01.js} +1 -1
  88. package/dist/{index-IL6JQ0Uk.js → index-DLZ_cPwd.js} +1 -1
  89. package/dist/{index-aRRiC6b9.js → index-rZdY3BW8.js} +7 -7
  90. package/dist/{index.esm2017-D2J5P0Jx.js → index.esm2017-B2wpsz6n.js} +1 -1
  91. package/dist/{loading-fSLeqKr_.js → loading-BHHf9MeD.js} +1 -1
  92. package/dist/{lodash-CanxPAR4.js → lodash-zHycpMIs.js} +1 -1
  93. package/dist/member-import-MTwvl8TG.js +143 -0
  94. package/dist/{membership-BrdyfO2y.js → membership-Ctqa96gd.js} +2 -2
  95. package/dist/{money-W_YTwyxP.js → money-C9m7TfMA.js} +1 -1
  96. package/dist/{number-j1vVuQpy.js → number-ng88zCwj.js} +1 -1
  97. package/dist/{objectid-DhwxE2Ct.js → objectid-BTsufz4u.js} +6 -6
  98. package/dist/{plugins-2XgEvjxm.js → plugins-MY2whJpz.js} +3 -3
  99. package/dist/{reward-Bk3FZbGj.js → reward-DiiV8MQE.js} +1 -1
  100. package/dist/{rule-M9AijHS0.js → rule-C31n55fZ.js} +3 -3
  101. package/dist/{rule-builder-C4yj8l-c.js → rule-builder-BVEerrEc.js} +1 -1
  102. package/dist/{template-BguoWqRC.js → template-CtcRYRZb.js} +6 -6
  103. package/dist/{timezone-DdkTIxnK.js → timezone-Ck4iMIrt.js} +1 -1
  104. package/dist/{transaction.fn-BpfxFtTu.js → transaction.fn-BI0-LgQG.js} +1 -1
  105. package/dist/{trigger-C7MXRREg.js → trigger-_5hAtyky.js} +5 -5
  106. package/dist/{useMarketingMaterialActions-CgJpHDNv.js → useMarketingMaterialActions-CX9qJp_O.js} +3 -3
  107. package/dist/{usePagination-Csc19YZ0.js → usePagination-DZKDMzEh.js} +1 -1
  108. package/dist/{user-DCwNBNr2.js → user-C-Db5JiY.js} +1 -1
  109. package/dist/{vue-i18n-BIpsBqfV.js → vue-i18n-BbF7bmsx.js} +204 -204
  110. package/dist/{xlsx-Esg-74Jx.js → xlsx-CzpvTfCU.js} +1 -1
  111. package/dist/{zod-D9ri6sIU.js → zod-HtL78lno.js} +1 -1
  112. package/package.json +1 -1
  113. package/dist/GiftCardSetup-Dg-kNVsD.js +0 -633
  114. package/dist/Member-Wf4LUqGi.js +0 -281
  115. package/dist/index-sBl1JAut.js +0 -85
@@ -0,0 +1,573 @@
1
+ import { defineComponent as G, resolveComponent as p, unref as t, openBlock as s, createElementBlock as c, normalizeClass as Z, renderSlot as ee, createElementVNode as n, createVNode as i, ref as _, computed as B, onMounted as he, onBeforeUnmount as ke, Fragment as N, createTextVNode as P, withCtx as I, renderList as te, createBlock as g, toDisplayString as l, createCommentVNode as m, isRef as we, watch as Te, createSlots as Re } from "vue";
2
+ import "./index-DD3Jlx01.js";
3
+ import { useDialog as ne } from "@feedmepos/ui-library";
4
+ import { u as ae } from "./vue-i18n-BbF7bmsx.js";
5
+ import { useCoreStore as xe } from "@feedmepos/mf-common";
6
+ import { F as oe } from "./FileSaver.min-Ck6lXfKM.js";
7
+ import { u as j, w as Ee } from "./xlsx-CzpvTfCU.js";
8
+ import { m as E } from "./index-CWbvBvE3.js";
9
+ import { useRouter as Ie } from "vue-router";
10
+ import { R as k } from "./app-CEWVaJEZ.js";
11
+ const Se = { class: "fm-typo-en-body-sm-400 justify-center flex items-center w-full" }, Ce = /* @__PURE__ */ G({
12
+ __name: "FmAdminBadge",
13
+ props: {
14
+ class: { default: void 0 },
15
+ selectable: { type: Boolean, default: !1 }
16
+ },
17
+ setup(V) {
18
+ const d = V, R = xe();
19
+ return (f, e) => {
20
+ var y;
21
+ const r = p("FmIcon");
22
+ return (y = t(R).sessionUser.value) != null && y.role.isAdmin ? (s(), c("div", {
23
+ key: 0,
24
+ class: Z([
25
+ "group gap-8 inline-flex items-center relative border-1 border-dashed rounded-md border-red-500 hover:border-opacity-30 transition-opacity",
26
+ { "select-none": !d.selectable }
27
+ ])
28
+ }, [
29
+ ee(f.$slots, "default"),
30
+ n("div", {
31
+ class: Z([
32
+ "pointer-events-none opacity-90 flex items-center justify-center rounded-xxxl bg-red-500 text-white group-hover:opacity-20",
33
+ d.class,
34
+ {
35
+ absolute: !0,
36
+ "bottom-[-5px] right-[-8px] px-4 h-[25px] w-[25px] border-2 border-red-800": !0
37
+ }
38
+ ])
39
+ }, [
40
+ n("span", Se, [
41
+ i(r, {
42
+ name: "support_agent",
43
+ size: "sm",
44
+ outline: ""
45
+ })
46
+ ])
47
+ ], 2)
48
+ ], 2)) : ee(f.$slots, "non-admin", { key: 1 });
49
+ };
50
+ }
51
+ }), Fe = { class: "w-[720px] max-w-full space-y-24 pb-16" }, Ae = {
52
+ key: 0,
53
+ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
54
+ }, Be = { class: "flex justify-end" }, Le = {
55
+ key: 1,
56
+ class: "flex items-center rounded-md border border-fm-color-neutral-gray-300 p-16"
57
+ }, Me = { class: "fm-typo-en-body-lg-400 min-w-0 flex-1 truncate px-8" }, Pe = { for: "member-import-file" }, Ne = { class: "flex items-center justify-between" }, Oe = { class: "fm-typo-en-title-sm-800" }, De = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Ve = {
58
+ key: 0,
59
+ class: "rounded-md bg-fm-color-system-error-100 p-16 fm-typo-en-body-sm-400"
60
+ }, Ye = {
61
+ key: 1,
62
+ class: "rounded-md bg-fm-color-system-info-100 p-16 fm-typo-en-body-md-400"
63
+ }, Ue = {
64
+ key: 2,
65
+ class: "space-y-16"
66
+ }, $e = { class: "grid grid-cols-2 gap-8 md:grid-cols-4" }, He = { class: "fm-typo-en-title-sm-800" }, je = { class: "fm-typo-en-title-sm-800" }, Ge = { class: "fm-typo-en-title-sm-800" }, ze = { class: "fm-typo-en-title-sm-800" }, Je = {
67
+ key: 0,
68
+ class: "rounded-md bg-fm-color-system-warning-100 p-16 fm-typo-en-body-sm-400"
69
+ }, qe = {
70
+ key: 1,
71
+ class: "rounded-md bg-fm-color-system-warning-100 p-16 fm-typo-en-body-sm-400"
72
+ }, Qe = { class: "fm-typo-en-body-md-400" }, Ke = { class: "fm-typo-en-body-md-600" }, We = {
73
+ key: 3,
74
+ class: "space-y-12"
75
+ }, Xe = { class: "rounded-md bg-fm-color-system-error-100 p-16" }, Ze = { class: "fm-typo-en-body-sm-400" }, et = {
76
+ key: 4,
77
+ class: "rounded-md bg-fm-color-system-error-100 p-16"
78
+ }, tt = { class: "fm-typo-en-body-sm-400" }, ot = { class: "fm-typo-en-body-sm-400" }, nt = {
79
+ key: 5,
80
+ class: "rounded-md bg-fm-color-system-success-100 p-16"
81
+ }, at = { class: "fm-typo-en-body-sm-400" }, st = { class: "flex items-center justify-end gap-8" }, lt = /* @__PURE__ */ G({
82
+ __name: "ImportMemberDialog",
83
+ setup(V) {
84
+ const { t: d } = ae(), R = ne(), f = _(null), e = _(null), r = _(""), y = _(""), w = _(!1), F = _(!1), b = _(!1), O = _(!0);
85
+ let A;
86
+ const L = _({
87
+ mode: "UPSERT"
88
+ }), Y = [
89
+ { label: "Create missing members only", value: "CREATE" },
90
+ { label: "Update existing members only", value: "UPDATE" },
91
+ { label: "Create and update members", value: "UPSERT" }
92
+ ], v = [
93
+ "Id",
94
+ "Name",
95
+ "Phone",
96
+ "Email",
97
+ "Gender",
98
+ "CardNo",
99
+ "Birthday",
100
+ "Credit",
101
+ "CreditExpiryDate",
102
+ "Experience",
103
+ "Point",
104
+ "Tier",
105
+ "Titles",
106
+ "AvgSpent",
107
+ "LastVisit",
108
+ "Feedback",
109
+ "LastSeasonTierEarned",
110
+ "LastSeasonPointEarned",
111
+ "JoinedAt",
112
+ "JoinedAtLocation",
113
+ "VisitFrequency"
114
+ ], x = [
115
+ {
116
+ label: "CSV",
117
+ icon: "csv",
118
+ value: "csv"
119
+ /* csv */
120
+ },
121
+ {
122
+ label: "Excel",
123
+ icon: "description",
124
+ value: "xlsx"
125
+ /* xlsx */
126
+ }
127
+ ], h = B(
128
+ () => {
129
+ var a;
130
+ return ["UPLOADED", "VALIDATING", "QUEUED", "RUNNING"].includes(
131
+ ((a = e.value) == null ? void 0 : a.status) ?? ""
132
+ );
133
+ }
134
+ ), S = B(() => {
135
+ var a;
136
+ return !(((a = e.value) == null ? void 0 : a.status) !== "READY" || !e.value.file || y.value !== e.value.businessName || e.value.summary.sharedProfiles > 0 && !w.value || e.value.summary.balanceRows > 0 && !F.value);
137
+ });
138
+ function U(a) {
139
+ var o, C;
140
+ f.value = ((C = (o = a.target) == null ? void 0 : o.files) == null ? void 0 : C[0]) ?? null;
141
+ }
142
+ function $(a) {
143
+ if (a === "csv") {
144
+ oe.saveAs(
145
+ new Blob([v.join(",")], {
146
+ type: "text/csv;charset=utf-8;"
147
+ }),
148
+ "ImportMemberTemplate.csv"
149
+ );
150
+ return;
151
+ }
152
+ const o = j.aoa_to_sheet([v]), C = j.book_new();
153
+ j.book_append_sheet(C, o, "Members"), Ee(C, "ImportMemberTemplate.xlsx");
154
+ }
155
+ async function se() {
156
+ if (!f.value) {
157
+ r.value = "Please upload a file.";
158
+ return;
159
+ }
160
+ b.value = !0, r.value = "";
161
+ try {
162
+ const a = new FormData();
163
+ a.append("file", f.value), a.append("config", JSON.stringify(L.value)), e.value = await E.import(a), await M();
164
+ } catch (a) {
165
+ r.value = a instanceof Error ? a.message : String(a);
166
+ } finally {
167
+ b.value = !1;
168
+ }
169
+ }
170
+ async function le() {
171
+ e.value && (e.value = await E.readImport(e.value._id.toString()));
172
+ }
173
+ async function M() {
174
+ var a;
175
+ H();
176
+ try {
177
+ await le();
178
+ } catch (o) {
179
+ r.value = o instanceof Error ? o.message : String(o);
180
+ return;
181
+ }
182
+ h.value && (A = setTimeout(M, ((a = e.value) == null ? void 0 : a.status) === "RUNNING" ? 5e3 : 1500));
183
+ }
184
+ async function re() {
185
+ try {
186
+ e.value = await E.resumableImport(), e.value && await M();
187
+ } catch (a) {
188
+ r.value = a instanceof Error ? a.message : String(a);
189
+ } finally {
190
+ O.value = !1;
191
+ }
192
+ }
193
+ function H() {
194
+ A && clearTimeout(A), A = void 0;
195
+ }
196
+ function ie() {
197
+ H(), e.value = null, f.value = null, r.value = "";
198
+ }
199
+ async function ue() {
200
+ if (!(!e.value || !S.value)) {
201
+ b.value = !0, r.value = "";
202
+ try {
203
+ e.value = await E.confirmImport(e.value._id.toString(), {
204
+ businessName: y.value,
205
+ fileHash: e.value.fileHash,
206
+ previewVersion: e.value.previewVersion,
207
+ acknowledgeSharedProfiles: w.value,
208
+ acknowledgeBalanceReplacement: F.value
209
+ }), await M();
210
+ } catch (a) {
211
+ r.value = a instanceof Error ? a.message : String(a);
212
+ } finally {
213
+ b.value = !1;
214
+ }
215
+ }
216
+ }
217
+ async function ce() {
218
+ if (e.value) {
219
+ b.value = !0, r.value = "";
220
+ try {
221
+ e.value = await E.retryImport(e.value._id.toString()), await M();
222
+ } catch (a) {
223
+ r.value = a instanceof Error ? a.message : String(a);
224
+ } finally {
225
+ b.value = !1;
226
+ }
227
+ }
228
+ }
229
+ async function me() {
230
+ if (!e.value) {
231
+ R.close();
232
+ return;
233
+ }
234
+ try {
235
+ await E.cancelImport(e.value._id.toString());
236
+ } catch {
237
+ }
238
+ R.close();
239
+ }
240
+ async function de() {
241
+ if (!e.value) return;
242
+ const a = await E.downloadImportResult(e.value._id.toString());
243
+ oe.saveAs(a, `member-import-${e.value._id}.csv`);
244
+ }
245
+ return he(re), ke(H), (a, o) => {
246
+ var J, q, Q, K, W, X;
247
+ const C = p("FmSelect"), T = p("FmButton"), pe = p("FmMenuItem"), fe = p("FmMenu"), ye = p("FmDropField"), ve = p("FmChip"), D = p("FmCard"), be = p("FmTextField"), z = p("FmCheckbox"), _e = p("FmHelperText"), ge = p("FmSpacer");
248
+ return s(), c("div", Fe, [
249
+ t(O) ? (s(), c("div", Ae, " Checking for an unfinished import… ")) : t(e) ? (s(), c(N, { key: 2 }, [
250
+ n("div", Ne, [
251
+ n("div", null, [
252
+ n("div", Oe, l(((J = t(e).file) == null ? void 0 : J.originalName) ?? "Unknown file"), 1),
253
+ n("div", De, " Import " + l(t(e)._id) + " · " + l(t(e).status), 1)
254
+ ]),
255
+ i(ve, {
256
+ label: t(e).status,
257
+ compact: ""
258
+ }, null, 8, ["label"])
259
+ ]),
260
+ t(e).file ? m("", !0) : (s(), c("div", Ve, " The saved import is missing its uploaded file. Cancel it and upload the file again. ")),
261
+ t(h) ? (s(), c("div", Ye, l(t(e).status === "RUNNING" ? "Importing members…" : "Preparing import preview…"), 1)) : m("", !0),
262
+ t(e).status === "READY" ? (s(), c("div", Ue, [
263
+ n("div", $e, [
264
+ i(D, {
265
+ variant: "outlined",
266
+ class: "p-12"
267
+ }, {
268
+ default: I(() => [
269
+ n("div", He, l(t(e).summary.total), 1),
270
+ o[6] || (o[6] = n("div", { class: "fm-typo-en-body-sm-400" }, "Rows", -1))
271
+ ]),
272
+ _: 1
273
+ }),
274
+ i(D, {
275
+ variant: "outlined",
276
+ class: "p-12"
277
+ }, {
278
+ default: I(() => [
279
+ n("div", je, l(t(e).summary.create), 1),
280
+ o[7] || (o[7] = n("div", { class: "fm-typo-en-body-sm-400" }, "Create", -1))
281
+ ]),
282
+ _: 1
283
+ }),
284
+ i(D, {
285
+ variant: "outlined",
286
+ class: "p-12"
287
+ }, {
288
+ default: I(() => [
289
+ n("div", Ge, l(t(e).summary.update), 1),
290
+ o[8] || (o[8] = n("div", { class: "fm-typo-en-body-sm-400" }, "Update", -1))
291
+ ]),
292
+ _: 1
293
+ }),
294
+ i(D, {
295
+ variant: "outlined",
296
+ class: "p-12"
297
+ }, {
298
+ default: I(() => [
299
+ n("div", ze, l(t(e).summary.balanceRows), 1),
300
+ o[9] || (o[9] = n("div", { class: "fm-typo-en-body-sm-400" }, "Balance rows", -1))
301
+ ]),
302
+ _: 1
303
+ })
304
+ ]),
305
+ t(e).summary.balanceRows ? (s(), c("div", Je, " Final target totals — Credit: " + l(t(e).summary.creditTargetTotal) + ", Experience: " + l(t(e).summary.experienceTargetTotal) + ", Points: " + l(t(e).summary.pointTargetTotal) + ". Tier changes: " + l(t(e).summary.tierRows) + ". ", 1)) : m("", !0),
306
+ t(e).summary.sharedProfiles ? (s(), c("div", qe, l(t(e).summary.sharedProfiles) + " rows can update a shared profile used by another business. ", 1)) : m("", !0),
307
+ n("div", Qe, [
308
+ o[10] || (o[10] = P(" To confirm your action, type ", -1)),
309
+ n("span", Ke, l(t(e).businessName), 1),
310
+ o[11] || (o[11] = P(" in the text field ", -1))
311
+ ]),
312
+ i(be, {
313
+ modelValue: t(y),
314
+ "onUpdate:modelValue": o[2] || (o[2] = (u) => we(y) ? y.value = u : null)
315
+ }, null, 8, ["modelValue"]),
316
+ t(e).summary.sharedProfiles ? (s(), g(z, {
317
+ key: 2,
318
+ "model-value": t(w),
319
+ value: "shared-profile",
320
+ label: "I understand that shared profile fields can affect other businesses.",
321
+ "onUpdate:modelValue": o[3] || (o[3] = (u) => w.value = u)
322
+ }, null, 8, ["model-value"])) : m("", !0),
323
+ t(e).summary.balanceRows ? (s(), g(z, {
324
+ key: 3,
325
+ "model-value": t(F),
326
+ value: "balance-replacement",
327
+ label: "I understand that populated balance cells replace final balances.",
328
+ "onUpdate:modelValue": o[4] || (o[4] = (u) => F.value = u)
329
+ }, null, 8, ["model-value"])) : m("", !0)
330
+ ])) : m("", !0),
331
+ t(e).status === "INVALID" ? (s(), c("div", We, [
332
+ n("div", Xe, [
333
+ o[12] || (o[12] = n("div", { class: "fm-typo-en-body-md-600" }, "The file is not importable", -1)),
334
+ n("div", Ze, l(t(e).error), 1)
335
+ ]),
336
+ (s(!0), c(N, null, te((q = t(e).rowErrors) == null ? void 0 : q.slice(0, 10), (u) => (s(), c("div", {
337
+ key: u.rowNumber,
338
+ class: "fm-typo-en-body-sm-400"
339
+ }, " Row " + l(u.rowNumber) + ": " + l(u.errors.join("; ")), 1))), 128))
340
+ ])) : m("", !0),
341
+ t(e).status === "STOPPED" ? (s(), c("div", et, [
342
+ o[13] || (o[13] = n("div", { class: "fm-typo-en-body-md-600" }, "Import stopped", -1)),
343
+ n("div", tt, l(t(e).summary.completed) + " rows completed before the first runtime error. Fix the cause, then retry this same import safely. ", 1),
344
+ n("div", ot, l(t(e).error), 1)
345
+ ])) : m("", !0),
346
+ t(e).status === "COMPLETED" ? (s(), c("div", nt, [
347
+ o[14] || (o[14] = n("div", { class: "fm-typo-en-body-md-600" }, "Import completed", -1)),
348
+ n("div", at, l(t(e).summary.completed) + " members were processed. ", 1)
349
+ ])) : m("", !0)
350
+ ], 64)) : (s(), c(N, { key: 1 }, [
351
+ o[5] || (o[5] = n("div", { class: "rounded-md bg-fm-color-system-warning-100 p-16" }, [
352
+ n("div", { class: "fm-typo-en-body-md-600" }, "Import changes production data"),
353
+ n("div", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, [
354
+ P(" The file is fully validated before any member is changed. Blank cells keep existing values. Use "),
355
+ n("code", null, "__CLEAR__"),
356
+ P(" to clear supported fields. CSV title lists must be quoted, for example "),
357
+ n("code", null, '"VIP,VVIP,SVIP"'),
358
+ P(". ")
359
+ ])
360
+ ], -1)),
361
+ i(C, {
362
+ modelValue: t(L).mode,
363
+ "onUpdate:modelValue": o[0] || (o[0] = (u) => t(L).mode = u),
364
+ label: "Import mode",
365
+ items: Y
366
+ }, null, 8, ["modelValue"]),
367
+ n("div", Be, [
368
+ i(fe, null, {
369
+ "menu-button": I(() => [
370
+ i(T, {
371
+ variant: "tertiary",
372
+ icon: "download",
373
+ label: "Download template"
374
+ })
375
+ ]),
376
+ default: I(() => [
377
+ (s(), c(N, null, te(x, (u) => i(pe, {
378
+ key: u.value,
379
+ icon: u.icon,
380
+ label: u.label,
381
+ selectable: "",
382
+ onClick: (it) => $(u.value)
383
+ }, null, 8, ["icon", "label", "onClick"])), 64))
384
+ ]),
385
+ _: 1
386
+ })
387
+ ]),
388
+ t(f) ? (s(), c("div", Le, [
389
+ i(T, {
390
+ variant: "tertiary",
391
+ "prepend-icon": "attach_file"
392
+ }),
393
+ n("p", Me, l(t(f).name), 1),
394
+ n("label", Pe, [
395
+ i(T, {
396
+ variant: "plain",
397
+ label: t(d)("Replace File")
398
+ }, null, 8, ["label"]),
399
+ n("input", {
400
+ id: "member-import-file",
401
+ accept: ".csv, .xlsx",
402
+ class: "hidden",
403
+ type: "file",
404
+ onChange: U
405
+ }, null, 32)
406
+ ])
407
+ ])) : (s(), g(ye, {
408
+ key: 0,
409
+ accept: ".csv, .xlsx",
410
+ "max-file-size": 5e6,
411
+ onFileUpload: o[1] || (o[1] = (u) => f.value = u)
412
+ }))
413
+ ], 64)),
414
+ t(r) ? (s(), g(_e, {
415
+ key: 3,
416
+ state: "error",
417
+ text: t(r)
418
+ }, null, 8, ["text"])) : m("", !0),
419
+ n("div", st, [
420
+ t(e) && ["INVALID", "STOPPED", "COMPLETED"].includes(t(e).status) ? (s(), g(T, {
421
+ key: 0,
422
+ variant: "tertiary",
423
+ icon: "download",
424
+ label: "Download result",
425
+ onClick: de
426
+ })) : m("", !0),
427
+ ((Q = t(e)) == null ? void 0 : Q.status) === "INVALID" ? (s(), g(T, {
428
+ key: 1,
429
+ variant: "tertiary",
430
+ label: "Choose another file",
431
+ onClick: ie
432
+ })) : m("", !0),
433
+ i(ge),
434
+ i(T, {
435
+ variant: "secondary",
436
+ label: ((K = t(e)) == null ? void 0 : K.status) === "COMPLETED" ? "Close" : "Cancel",
437
+ onClick: me
438
+ }, null, 8, ["label"]),
439
+ t(e) ? m("", !0) : (s(), g(T, {
440
+ key: 2,
441
+ label: "Validate file",
442
+ disabled: !t(f) || t(b),
443
+ onClick: se
444
+ }, null, 8, ["disabled"])),
445
+ ((W = t(e)) == null ? void 0 : W.status) === "READY" ? (s(), g(T, {
446
+ key: 3,
447
+ label: "Start import",
448
+ disabled: !t(S) || t(b),
449
+ onClick: ue
450
+ }, null, 8, ["disabled"])) : m("", !0),
451
+ ((X = t(e)) == null ? void 0 : X.status) === "STOPPED" ? (s(), g(T, {
452
+ key: 4,
453
+ label: "Retry import",
454
+ disabled: t(b) || !t(e).file,
455
+ onClick: ce
456
+ }, null, 8, ["disabled"])) : m("", !0)
457
+ ])
458
+ ]);
459
+ };
460
+ }
461
+ }), rt = { class: "px-24 flex flex-col gap-y-16 pb-24" }, gt = /* @__PURE__ */ G({
462
+ __name: "Member",
463
+ setup(V) {
464
+ const d = Ie(), { t: R } = ae(), f = ne(), e = [
465
+ {
466
+ label: R("connect.loyalty.member.tabs.member_list"),
467
+ value: k["$connect-LOYALTY_MEMBER_LIST"]
468
+ }
469
+ ], r = B(() => {
470
+ var x, h, S;
471
+ const v = d.currentRoute.value.name;
472
+ return v == k["$connect-LOYALTY_MEMBER_IMPORT_HISTORY"] ? {
473
+ title: "Import history",
474
+ description: void 0,
475
+ backButton: !0,
476
+ onBackButton: async () => {
477
+ await d.push({
478
+ name: k["$connect-LOYALTY_MEMBER_LIST"]
479
+ });
480
+ }
481
+ } : v != k["$connect-LOYALTY_MEMBER_TRANSACTIONS"] ? {
482
+ title: y.value.label,
483
+ description: void 0
484
+ } : (y.value = e[1], {
485
+ backButton: !0,
486
+ title: R("connect.loyalty.member.title"),
487
+ description: `${(x = w.value) == null ? void 0 : x.name} (${(h = w.value) == null ? void 0 : h._id}) (${(S = w.value) == null ? void 0 : S.phoneNumber})`,
488
+ onBackButton: async () => {
489
+ await d.push({ name: k["$connect-LOYALTY_MEMBER_LIST"] });
490
+ }
491
+ });
492
+ }), y = _(
493
+ e.find((v) => v.value === d.currentRoute.value.name) ?? e[0]
494
+ ), w = _(), F = B(
495
+ () => d.currentRoute.value.name === k["$connect-LOYALTY_MEMBER_TRANSACTIONS"] || d.currentRoute.value.name === k["$connect-LOYALTY_MEMBER_IMPORT_HISTORY"]
496
+ ), b = B(
497
+ () => d.currentRoute.value.name !== k["$connect-LOYALTY_MEMBER_TRANSACTIONS"]
498
+ ), O = B(
499
+ () => d.currentRoute.value.name !== k["$connect-LOYALTY_MEMBER_IMPORT_HISTORY"]
500
+ );
501
+ async function A(v) {
502
+ await d.push({ name: v });
503
+ }
504
+ async function L() {
505
+ f.open({
506
+ title: "Import members",
507
+ closeButton: !1,
508
+ dismissAway: !1,
509
+ contentComponent: lt
510
+ });
511
+ }
512
+ async function Y() {
513
+ await d.push({
514
+ name: k["$connect-LOYALTY_MEMBER_IMPORT_HISTORY"]
515
+ });
516
+ }
517
+ return Te(
518
+ () => d.currentRoute.value.name,
519
+ async (v) => {
520
+ y.value = e.find((h) => h.value === v) ?? e[0];
521
+ const x = d.currentRoute.value.params.id;
522
+ x && (w.value = await E.readById(x));
523
+ },
524
+ { immediate: !0 }
525
+ ), (v, x) => {
526
+ const h = p("FmButton"), S = p("FmPageHead"), U = p("FmTabs"), $ = p("RouterView");
527
+ return s(), c(N, null, [
528
+ i(S, {
529
+ title: t(r).title,
530
+ description: t(r).description,
531
+ "back-button": t(r).backButton,
532
+ "onClick:back": t(r).onBackButton
533
+ }, Re({ _: 2 }, [
534
+ t(b) ? {
535
+ name: "append",
536
+ fn: I(() => [
537
+ i(Ce, null, {
538
+ default: I(() => [
539
+ t(O) ? (s(), g(h, {
540
+ key: 0,
541
+ label: "Import history",
542
+ "prepend-icon": "work_history",
543
+ variant: "tertiary",
544
+ onClick: Y
545
+ })) : m("", !0),
546
+ i(h, {
547
+ label: t(R)("connect.loyalty.member.import"),
548
+ "prepend-icon": "download",
549
+ onClick: L
550
+ }, null, 8, ["label"])
551
+ ]),
552
+ _: 1
553
+ })
554
+ ]),
555
+ key: "0"
556
+ } : void 0
557
+ ]), 1032, ["title", "description", "back-button", "onClick:back"]),
558
+ n("div", rt, [
559
+ t(F) ? m("", !0) : (s(), g(U, {
560
+ key: 0,
561
+ "model-value": t(y).value,
562
+ items: e,
563
+ "onUpdate:modelValue": A
564
+ }, null, 8, ["model-value"])),
565
+ i($)
566
+ ])
567
+ ], 64);
568
+ };
569
+ }
570
+ });
571
+ export {
572
+ gt as default
573
+ };