@feedmepos/mf-connect 0.1.102-prod → 0.1.104-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 (110) hide show
  1. package/dist/{Analytic-DuLC718S.js → Analytic-1rqyus1X.js} +15 -14
  2. package/dist/{App-UJnB9zcQ.js → App-B4UWz7ir.js} +7 -7
  3. package/dist/{Bin-DNTtfH3f.js → Bin-D_eSutW-.js} +8 -8
  4. package/dist/{Broadcast-CRAQM_k6.js → Broadcast-DDQE_RLR.js} +10 -10
  5. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DhUyx6oJ.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-D2cTNgaS.js} +6 -6
  6. package/dist/{Card-C8x7HK5E.js → Card-CPozdg3m.js} +18 -18
  7. package/dist/{Collections-Cc7swt3R.js → Collections-IrwF5bWH.js} +9 -9
  8. package/dist/{Credit-C6aPf5Nk.js → Credit-BVXpy5tw.js} +9 -9
  9. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-B0Yzpx63.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-CCe1rp0f.js} +32 -32
  10. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-CwhqFx6B.js → EffectSheet.vue_vue_type_style_index_0_lang-DwP64fmL.js} +6 -6
  11. package/dist/{Experience-CYDrnD2K.js → Experience-BR1JXdH5.js} +9 -9
  12. package/dist/{FileSaver.min-EhV8ssqD.js → FileSaver.min-CX-3gU49.js} +1 -1
  13. package/dist/{Game-BIyKyW7Y.js → Game-8nvdSkbi.js} +10 -10
  14. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-BR1U0gNv.js → ImageInput.vue_vue_type_script_setup_true_lang-q5fF5d7d.js} +1 -1
  15. package/dist/{Index-E4_i9pk-.js → Index--Xl_8CFP.js} +10 -10
  16. package/dist/{LocationPicker.vue_vue_type_script_setup_true_lang-Co9wcuDx.js → LocationPicker.vue_vue_type_script_setup_true_lang-C-xW5Tw8.js} +1 -1
  17. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-CVLo2BQx.js → LottieAnimation.vue_vue_type_script_setup_true_lang-DGVqQz1j.js} +1 -1
  18. package/dist/{MainLayout-DQ6ubq0V.js → MainLayout-DB_Y2C3K.js} +3 -3
  19. package/dist/{Marketing-DSWRkRdS.js → Marketing-CjAGzfL7.js} +4 -4
  20. package/dist/{MarketingMaterialEdit-DoXDb_15.js → MarketingMaterialEdit-BoF6kTOz.js} +6 -6
  21. package/dist/Member-DnypOK2I.js +649 -0
  22. package/dist/MemberImportHistory-BJSyT6Ys.js +187 -0
  23. package/dist/{MemberList-DXNFGOoa.js → MemberList-Bf_XyoxW.js} +28 -28
  24. package/dist/{MemberTransactions-DIWbn5pf.js → MemberTransactions-CbPxUrtd.js} +1 -1
  25. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-D3TNf3d4.js → MessageInput.vue_vue_type_script_setup_true_lang-CVzfjs9D.js} +10 -10
  26. package/dist/{Mission-BjbIgIBO.js → Mission-DE4O6XM6.js} +10 -10
  27. package/dist/{Overview-nOh09Nak.js → Overview-BW2_y1_7.js} +3 -3
  28. package/dist/{Overview-CbE-9ESn.js → Overview-DZxRuA5F.js} +53 -53
  29. package/dist/{Point-CDoAfQ9E.js → Point-BMEe6duo.js} +9 -9
  30. package/dist/{Promotion-oWqv5TcX.js → Promotion-lamxp48U.js} +10 -10
  31. package/dist/{Queue-CL5SbEDz.js → Queue-CSF9M_Lc.js} +13 -13
  32. package/dist/{Record-CEvLXNJU.js → Record-B-HdI5A4.js} +9 -9
  33. package/dist/{Review-CSfUXMcX.js → Review-D6RQbcP6.js} +2 -2
  34. package/dist/{ReviewFacebookCallback-CMvjz_jc.js → ReviewFacebookCallback-CkULwhF-.js} +5 -5
  35. package/dist/{ReviewGoogleCallback-CoeZ-ou6.js → ReviewGoogleCallback-DgPEXV_R.js} +5 -5
  36. package/dist/{Reward-BpbK_k4T.js → Reward-CZvM6GQ9.js} +16 -16
  37. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-DKgbMgI7.js → RewardGroup.vue_vue_type_script_setup_true_lang-C1y2_pHY.js} +11 -11
  38. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-ExVFtoAQ.js → RuleGroup.vue_vue_type_script_setup_true_lang-Cvo6a7Nw.js} +14 -14
  39. package/dist/{Segment-BzoGUM7i.js → Segment-D2bXEF1U.js} +24 -24
  40. package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-LjIepejX.js → SelectItems.vue_vue_type_script_setup_true_lang-BxOEEr9-.js} +2 -2
  41. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-8mv74I42.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-Ytimazjg.js} +12 -12
  42. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-D1RSndUC.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-Bn1IWAd_.js} +4 -4
  43. package/dist/{Setting-DaYfLDPg.js → Setting-DelduRrh.js} +14 -14
  44. package/dist/{SettingAdvertisements-BNrw_Pop.js → SettingAdvertisements-gTDg1C60.js} +12 -12
  45. package/dist/{Settings-V57JoEDz.js → Settings-VUEo9wwx.js} +5 -5
  46. package/dist/{Store-DmlPczX9.js → Store-CXQZirbg.js} +21 -21
  47. package/dist/{StoreRewards-CBQx2O-f.js → StoreRewards-BDuZPA8S.js} +15 -15
  48. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-YZfBG58B.js → StoreTransactions.vue_vue_type_script_setup_true_lang-C-yqZEn4.js} +20 -20
  49. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-DgNTGCoE.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-BayrgH7m.js} +2 -2
  50. package/dist/{Tier-pB8WRncc.js → Tier-DtPE4IJ5.js} +22 -22
  51. package/dist/{Title-BtROp4wQ.js → Title-DNCnQeeR.js} +21 -21
  52. package/dist/{Transaction-BkC9R9vd.js → Transaction-BkUaCGwl.js} +2 -2
  53. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-BLO9F29V.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-B7TY_AGp.js} +6 -6
  54. package/dist/{Voucher-vMdUCdb_.js → Voucher-BBuB9tf8.js} +13 -13
  55. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-DMmYF_fb.js → VoucherEditor.vue_vue_type_script_setup_true_lang-Bu09bIut.js} +12 -12
  56. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-BvKOLEvB.js → ZodTextField.vue_vue_type_script_setup_true_lang-BSKpAMJL.js} +2 -2
  57. package/dist/{app-fyW0rmyk.js → app-CSLQmdYA.js} +2527 -2500
  58. package/dist/app.js +1 -1
  59. package/dist/{business-DWoYVgg7.js → business-okSb42At.js} +5 -5
  60. package/dist/{campaign-C6t94wJ-.js → campaign-Ck9GwZdI.js} +2 -2
  61. package/dist/{campaign-Bhibz128.js → campaign-V7nlCdxR.js} +8 -8
  62. package/dist/{campaign.enum-BTowIvdN.js → campaign.enum-BQ5khvqI.js} +1 -1
  63. package/dist/{campaign.fn-CuRUFB1Y.js → campaign.fn-DMDpxVSZ.js} +158 -158
  64. package/dist/{collectible.enum-CUA9b6Fb.js → collectible.enum-lKz3vTQM.js} +1 -1
  65. package/dist/{collection.fn-C7ydtiu0.js → collection.fn-BH5cqMNy.js} +2 -2
  66. package/dist/{dto-DF3Pc6a5.js → dto-GksE6pni.js} +4 -4
  67. package/dist/{effect-CzYn8cNA.js → effect-pUpfqkCF.js} +1 -1
  68. package/dist/{email-addresses-BDl2kgyR.js → email-addresses-CzBv1fzv.js} +2 -2
  69. package/dist/{export-Bj9MXvOB.js → export-Du7ZAv-8.js} +3 -3
  70. package/dist/{helper-BfwJJYBa.js → helper-BpthZPU4.js} +1 -1
  71. package/dist/{index-BkPP9oOk.js → index--6uUWSMc.js} +1 -1
  72. package/dist/{index-BMiKfUmd.js → index-BhuD1NhH.js} +3 -3
  73. package/dist/{index-DOsgJcfs.js → index-C0JgU0Z2.js} +1 -1
  74. package/dist/{index-C25-Bv8o.js → index-CGK1kSCt.js} +3 -3
  75. package/dist/{index-CVmr6BUE.js → index-CN5Zoynf.js} +5 -4
  76. package/dist/{index-BW0x3DOp.js → index-CWAdNVKN.js} +6 -6
  77. package/dist/{index-2HE3rIOU.js → index-D7PksEV2.js} +40 -38
  78. package/dist/index-DCp9k5BB.js +137 -0
  79. package/dist/{index-ZHfcVGnN.js → index-DNdHiAXR.js} +2 -2
  80. package/dist/{index-DVLb_VbI.js → index-DPgGmpyL.js} +3 -3
  81. package/dist/{index-C6nsyGeh.js → index-DSltrIkA.js} +1 -1
  82. package/dist/{index-C8w_c72Y.js → index-OaZRtKP_.js} +3 -3
  83. package/dist/{index-DzkHJ4Xk.js → index-ZTYDfSkT.js} +1 -1
  84. package/dist/{index-CgmLk8G7.js → index-izVlVA8-.js} +1 -1
  85. package/dist/{index-CaVjRgMq.js → index-v8QQ-4ZP.js} +80 -75
  86. package/dist/{index.esm2017-CBNaydJe.js → index.esm2017-mpnkyDRb.js} +61 -61
  87. package/dist/{loading-Cp_CEKxJ.js → loading-BG3Pj6qz.js} +1 -1
  88. package/dist/{lodash-CKUwhSUJ.js → lodash-BfDdt-c9.js} +1 -1
  89. package/dist/member-import-BNFdZ3Df.js +187 -0
  90. package/dist/{membership-CeKp-ybu.js → membership-tNeaKAeS.js} +3 -3
  91. package/dist/{money-CygyVMxf.js → money-CRftC-F0.js} +1 -1
  92. package/dist/{number-CEHsNTbc.js → number-z7YZyGFS.js} +1 -1
  93. package/dist/objectid-BKMqp_oR.js +145 -0
  94. package/dist/{plugins-Dghf1pOO.js → plugins-CWeDGuzy.js} +3 -3
  95. package/dist/{reward-B4kUrpme.js → reward-BVTKTGi6.js} +1 -1
  96. package/dist/{rule-CVAWJk9B.js → rule-YhhCOals.js} +3 -3
  97. package/dist/{rule-builder-B3qq4o77.js → rule-builder-ae8A0qoi.js} +1 -1
  98. package/dist/{template-DMiHapr_.js → template-CQrM_0hz.js} +7 -7
  99. package/dist/{timezone-CiVQHxh_.js → timezone-DYWqfGTu.js} +2 -2
  100. package/dist/{trigger-D_sOEg5y.js → trigger-Clo3vSjw.js} +5 -5
  101. package/dist/{useMarketingMaterialActions-757RE_76.js → useMarketingMaterialActions-HyqIT94N.js} +3 -3
  102. package/dist/{usePagination-DXaBv1eS.js → usePagination-CWRrkbFL.js} +1 -1
  103. package/dist/{user-DeiXSSCt.js → user-MVk5s412.js} +1 -1
  104. package/dist/{vue-i18n-Thr4iiK6.js → vue-i18n-BN9KLJoz.js} +230 -230
  105. package/dist/{xlsx-BzwSbHEp.js → xlsx-s0BxKsa_.js} +440 -440
  106. package/dist/{zod-L6I3Pofo.js → zod-H4l78-by.js} +1 -1
  107. package/package.json +4 -2
  108. package/dist/Member-YyS4vcZV.js +0 -280
  109. package/dist/index-DyfE4Sn_.js +0 -85
  110. package/dist/objectid-QVxYq-ia.js +0 -145
@@ -0,0 +1,649 @@
1
+ import { defineComponent as J, resolveComponent as v, unref as t, openBlock as n, createElementBlock as i, normalizeClass as W, renderSlot as ne, createElementVNode as s, createVNode as u, ref as g, computed as P, onMounted as xe, onBeforeUnmount as Se, Fragment as O, createStaticVNode as Le, withCtx as N, renderList as Q, createBlock as E, toDisplayString as r, createCommentVNode as c, createTextVNode as le, isRef as Ae, watch as Ne, createSlots as Me } from "vue";
2
+ import "./index--6uUWSMc.js";
3
+ import { useDialog as ue } from "@feedmepos/ui-library";
4
+ import { u as de } from "./vue-i18n-BN9KLJoz.js";
5
+ import { useCoreStore as Fe } from "@feedmepos/mf-common";
6
+ import { F as re } from "./FileSaver.min-CX-3gU49.js";
7
+ import { u as V, w as Pe } from "./xlsx-s0BxKsa_.js";
8
+ import { u as De } from "./app-wDQR6dpb.js";
9
+ import { M as ie, a as Be } from "./member-import-BNFdZ3Df.js";
10
+ import { m as A } from "./index-DCp9k5BB.js";
11
+ import { useRouter as Oe } from "vue-router";
12
+ import { R as I } from "./app-CSLQmdYA.js";
13
+ const Ve = { class: "fm-typo-en-body-sm-400 justify-center flex items-center w-full" }, Ye = /* @__PURE__ */ J({
14
+ __name: "FmAdminBadge",
15
+ props: {
16
+ class: { default: void 0 },
17
+ selectable: { type: Boolean, default: !1 }
18
+ },
19
+ setup(G) {
20
+ const m = G, M = Fe();
21
+ return (D, f) => {
22
+ var e;
23
+ const k = v("FmIcon");
24
+ return (e = t(M).sessionUser.value) != null && e.role.isAdmin ? (n(), i("div", {
25
+ key: 0,
26
+ class: W([
27
+ "group gap-8 inline-flex items-center relative border-1 border-dashed rounded-md border-red-500 hover:border-opacity-30 transition-opacity",
28
+ { "select-none": !m.selectable }
29
+ ])
30
+ }, [
31
+ ne(D.$slots, "default"),
32
+ s("div", {
33
+ class: W([
34
+ "pointer-events-none opacity-90 flex items-center justify-center rounded-xxxl bg-red-500 text-white group-hover:opacity-20",
35
+ m.class,
36
+ {
37
+ absolute: !0,
38
+ "bottom-[-5px] right-[-8px] px-4 h-[25px] w-[25px] border-2 border-red-800": !0
39
+ }
40
+ ])
41
+ }, [
42
+ s("span", Ve, [
43
+ u(k, {
44
+ name: "support_agent",
45
+ size: "sm",
46
+ outline: ""
47
+ })
48
+ ])
49
+ ], 2)
50
+ ], 2)) : ne(D.$slots, "non-admin", { key: 1 });
51
+ };
52
+ }
53
+ }), $e = { class: "w-[800px] max-w-full space-y-24 pb-16" }, Ue = {
54
+ key: 0,
55
+ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
56
+ }, He = { class: "flex justify-end" }, Ge = {
57
+ key: 1,
58
+ class: "flex items-center rounded-md border border-fm-color-neutral-gray-300 p-16"
59
+ }, qe = { class: "fm-typo-en-body-lg-400 min-w-0 flex-1 truncate px-8" }, je = { class: "flex items-center justify-between" }, ze = { class: "fm-typo-en-title-sm-800" }, Qe = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, We = {
60
+ key: 0,
61
+ class: "rounded-md bg-fm-color-system-error-100 p-16 fm-typo-en-body-sm-400"
62
+ }, Je = {
63
+ key: 1,
64
+ class: "rounded-md bg-fm-color-system-info-100 p-16 fm-typo-en-body-md-400"
65
+ }, Ke = {
66
+ key: 2,
67
+ class: "space-y-16"
68
+ }, Xe = { class: "grid grid-cols-2 gap-8 md:grid-cols-4" }, Ze = { class: "fm-typo-en-title-sm-800" }, et = { class: "fm-typo-en-title-sm-800" }, tt = { class: "fm-typo-en-title-sm-800" }, at = { class: "fm-typo-en-title-sm-800" }, ot = {
69
+ key: 0,
70
+ class: "rounded-md bg-fm-color-system-warning-100 p-16 fm-typo-en-body-sm-400"
71
+ }, st = {
72
+ key: 1,
73
+ class: "rounded-md bg-fm-color-system-warning-100 p-16 fm-typo-en-body-sm-400"
74
+ }, nt = { class: "fm-typo-en-body-md-400" }, lt = { class: "fm-typo-en-body-md-600" }, rt = {
75
+ key: 4,
76
+ class: "rounded-md bg-fm-color-neutral-gray-100 p-12 fm-typo-en-body-sm-400"
77
+ }, it = {
78
+ key: 3,
79
+ class: "space-y-12"
80
+ }, ut = { class: "rounded-md bg-fm-color-system-error-100 p-16" }, dt = { class: "fm-typo-en-body-sm-400" }, ct = {
81
+ key: 4,
82
+ class: "rounded-md bg-fm-color-system-error-100 p-16"
83
+ }, mt = { class: "fm-typo-en-body-sm-400" }, pt = { class: "fm-typo-en-body-sm-400" }, ft = {
84
+ key: 5,
85
+ class: "rounded-md bg-fm-color-system-success-100 p-16"
86
+ }, vt = { class: "fm-typo-en-body-sm-400" }, yt = {
87
+ key: 6,
88
+ class: "rounded-md bg-fm-color-system-info-100 p-16"
89
+ }, bt = { class: "fm-typo-en-body-sm-400" }, _t = { class: "flex items-center justify-end gap-8" }, gt = /* @__PURE__ */ J({
90
+ __name: "ImportMemberDialog",
91
+ setup(G) {
92
+ const { t: m } = de(), M = ue(), D = De(), f = g(null), k = g(null), e = g(null), d = g(""), R = g(""), B = g(!1), T = g(!1), x = g(!1), S = g(!1), b = g(!1), h = g(!0);
93
+ let w, _ = 0;
94
+ const L = g({
95
+ mode: "UPSERT"
96
+ }), q = [
97
+ { label: "Create missing members only", value: "CREATE" },
98
+ { label: "Update existing members only", value: "UPDATE" },
99
+ { label: "Create and update members", value: "UPSERT" }
100
+ ], j = [
101
+ {
102
+ label: "CSV",
103
+ icon: "csv",
104
+ value: "csv"
105
+ /* csv */
106
+ },
107
+ {
108
+ label: "Excel",
109
+ icon: "description",
110
+ value: "xlsx"
111
+ /* xlsx */
112
+ }
113
+ ], z = P(
114
+ () => {
115
+ var a;
116
+ return ["UPLOADED", "VALIDATING", "QUEUED", "RUNNING", "CANCELLING"].includes(
117
+ ((a = e.value) == null ? void 0 : a.status) ?? ""
118
+ );
119
+ }
120
+ ), K = P(() => {
121
+ var a;
122
+ return !(((a = e.value) == null ? void 0 : a.status) !== "READY" || !e.value.file || R.value !== e.value.businessName || !S.value || e.value.summary.sharedProfiles > 0 && !T.value || e.value.summary.balanceRows > 0 && !x.value);
123
+ }), ce = P(() => {
124
+ const a = e.value, o = a == null ? void 0 : a.summary, p = !!a && R.value === a.businessName;
125
+ return [
126
+ {
127
+ label: "Status is READY",
128
+ passed: (a == null ? void 0 : a.status) === "READY",
129
+ value: (a == null ? void 0 : a.status) ?? "missing"
130
+ },
131
+ {
132
+ label: "Uploaded file exists",
133
+ passed: !!(a != null && a.file),
134
+ value: a != null && a.file ? "yes" : "no"
135
+ },
136
+ {
137
+ label: "Business name matches exactly",
138
+ passed: p,
139
+ value: `entered "${R.value}" / expected "${(a == null ? void 0 : a.businessName) ?? ""}"`
140
+ },
141
+ {
142
+ label: "Shared-profile acknowledgement",
143
+ passed: !(o != null && o.sharedProfiles) || T.value,
144
+ value: o != null && o.sharedProfiles ? `${T.value ? "checked" : "required"} (${o.sharedProfiles} rows)` : "not required"
145
+ },
146
+ {
147
+ label: "Balance-replacement acknowledgement",
148
+ passed: !(o != null && o.balanceRows) || x.value,
149
+ value: o != null && o.balanceRows ? `${x.value ? "checked" : "required"} (${o.balanceRows} rows)` : "not required"
150
+ },
151
+ {
152
+ label: "Import responsibility acknowledgement",
153
+ passed: S.value,
154
+ value: S.value ? "checked" : "required"
155
+ }
156
+ ];
157
+ });
158
+ function me(a) {
159
+ var o, p;
160
+ f.value = ((p = (o = a.target) == null ? void 0 : o.files) == null ? void 0 : p[0]) ?? null;
161
+ }
162
+ function pe() {
163
+ k.value && (k.value.value = "", k.value.click());
164
+ }
165
+ function fe(a) {
166
+ const o = [
167
+ [...ie],
168
+ [...Be]
169
+ ], p = V.aoa_to_sheet(o);
170
+ if (a === "csv") {
171
+ re.saveAs(
172
+ new Blob([V.sheet_to_csv(p)], {
173
+ type: "text/csv;charset=utf-8;"
174
+ }),
175
+ "ImportMemberTemplate.csv"
176
+ );
177
+ return;
178
+ }
179
+ const y = V.book_new();
180
+ for (let C = 0; C < ie.length; C++) {
181
+ const $ = p[V.encode_cell({ r: 1, c: C })];
182
+ $ && ($.z = "@");
183
+ }
184
+ V.book_append_sheet(y, p, "Members"), Pe(y, "ImportMemberTemplate.xlsx", { cellStyles: !0 });
185
+ }
186
+ async function ve() {
187
+ if (!f.value) {
188
+ d.value = "Please upload a file.";
189
+ return;
190
+ }
191
+ if (!B.value) {
192
+ d.value = "Please read and acknowledge the import warnings.";
193
+ return;
194
+ }
195
+ b.value = !0, d.value = "";
196
+ try {
197
+ const a = new FormData();
198
+ a.append("file", f.value), a.append("config", JSON.stringify(L.value)), e.value = await A.import(a), await F();
199
+ } catch (a) {
200
+ d.value = a instanceof Error ? a.message : String(a);
201
+ } finally {
202
+ b.value = !1;
203
+ }
204
+ }
205
+ async function ye(a) {
206
+ var p, y;
207
+ if (!e.value) return !1;
208
+ const o = e.value._id.toString();
209
+ try {
210
+ const C = await A.readImport(o);
211
+ return a !== _ || ((p = e.value) == null ? void 0 : p._id.toString()) !== o ? !1 : (e.value = C, !0);
212
+ } catch (C) {
213
+ if (a !== _ || ((y = e.value) == null ? void 0 : y._id.toString()) !== o)
214
+ return !1;
215
+ throw C;
216
+ }
217
+ }
218
+ async function F() {
219
+ var o;
220
+ Y();
221
+ const a = _;
222
+ try {
223
+ if (!await ye(a)) return;
224
+ } catch (p) {
225
+ if (a !== _) return;
226
+ d.value = p instanceof Error ? p.message : String(p), z.value && (w = setTimeout(F, 5e3));
227
+ return;
228
+ }
229
+ a === _ && z.value && (w = setTimeout(F, ((o = e.value) == null ? void 0 : o.status) === "RUNNING" ? 5e3 : 1500));
230
+ }
231
+ async function be() {
232
+ try {
233
+ e.value = await A.resumableImport(), e.value && await F();
234
+ } catch (a) {
235
+ d.value = a instanceof Error ? a.message : String(a);
236
+ } finally {
237
+ h.value = !1;
238
+ }
239
+ }
240
+ function Y() {
241
+ _ += 1, w && clearTimeout(w), w = void 0;
242
+ }
243
+ function _e() {
244
+ Y(), e.value = null, f.value = null, d.value = "", S.value = !1;
245
+ }
246
+ async function ge() {
247
+ if (!(!e.value || !K.value)) {
248
+ b.value = !0, d.value = "";
249
+ try {
250
+ e.value = await A.confirmImport(e.value._id.toString(), {
251
+ businessName: R.value,
252
+ fileHash: e.value.fileHash,
253
+ previewVersion: e.value.previewVersion,
254
+ acknowledgeSharedProfiles: T.value,
255
+ acknowledgeBalanceReplacement: x.value
256
+ }), await F();
257
+ } catch (a) {
258
+ d.value = a instanceof Error ? a.message : String(a);
259
+ } finally {
260
+ b.value = !1;
261
+ }
262
+ }
263
+ }
264
+ async function he() {
265
+ if (e.value) {
266
+ b.value = !0, d.value = "";
267
+ try {
268
+ e.value = await A.retryImport(e.value._id.toString()), await F();
269
+ } catch (a) {
270
+ d.value = a instanceof Error ? a.message : String(a);
271
+ } finally {
272
+ b.value = !1;
273
+ }
274
+ }
275
+ }
276
+ async function we() {
277
+ if (!e.value || ["COMPLETED", "CANCELLED", "INVALID"].includes(e.value.status)) {
278
+ M.close();
279
+ return;
280
+ }
281
+ if (e.value.status !== "CANCELLING") {
282
+ b.value = !0, d.value = "";
283
+ try {
284
+ const a = await A.cancelImport(e.value._id.toString());
285
+ Y(), e.value = a, e.value.status === "CANCELLING" && await F();
286
+ } catch (a) {
287
+ d.value = a instanceof Error ? a.message : String(a);
288
+ } finally {
289
+ b.value = !1;
290
+ }
291
+ }
292
+ }
293
+ async function ke() {
294
+ if (!e.value) return;
295
+ const a = await A.downloadImportResult(e.value._id.toString());
296
+ re.saveAs(a, `member-import-${e.value._id}.csv`);
297
+ }
298
+ return xe(be), Se(Y), (a, o) => {
299
+ var X, Z, ee, te, ae, oe, se;
300
+ const p = v("FmSelect"), y = v("FmButton"), C = v("FmMenuItem"), $ = v("FmMenu"), Ee = v("FmDropField"), U = v("FmCheckbox"), Ie = v("FmChip"), H = v("FmCard"), Re = v("FmTextField"), Ce = v("FmHelperText"), Te = v("FmSpacer");
301
+ return n(), i("div", $e, [
302
+ t(h) ? (n(), i("div", Ue, " Checking for an unfinished import… ")) : t(e) ? (n(), i(O, { key: 2 }, [
303
+ s("div", je, [
304
+ s("div", null, [
305
+ s("div", ze, r(((X = t(e).file) == null ? void 0 : X.originalName) ?? "Unknown file"), 1),
306
+ s("div", Qe, " Import " + r(t(e)._id) + " · " + r(t(e).status), 1)
307
+ ]),
308
+ u(Ie, {
309
+ label: t(e).status,
310
+ compact: ""
311
+ }, null, 8, ["label"])
312
+ ]),
313
+ t(e).file ? c("", !0) : (n(), i("div", We, " The saved import is missing its uploaded file. Cancel it and upload the file again. ")),
314
+ t(z) ? (n(), i("div", Je, r(t(e).status === "RUNNING" ? "Importing members…" : t(e).status === "CANCELLING" ? "Cancelling import…" : "Preparing import preview…"), 1)) : c("", !0),
315
+ t(e).status === "READY" ? (n(), i("div", Ke, [
316
+ s("div", Xe, [
317
+ u(H, {
318
+ variant: "outlined",
319
+ class: "p-12"
320
+ }, {
321
+ default: N(() => [
322
+ s("div", Ze, r(t(e).summary.total), 1),
323
+ o[8] || (o[8] = s("div", { class: "fm-typo-en-body-sm-400" }, "Rows", -1))
324
+ ]),
325
+ _: 1
326
+ }),
327
+ u(H, {
328
+ variant: "outlined",
329
+ class: "p-12"
330
+ }, {
331
+ default: N(() => [
332
+ s("div", et, r(t(e).summary.create), 1),
333
+ o[9] || (o[9] = s("div", { class: "fm-typo-en-body-sm-400" }, "Create", -1))
334
+ ]),
335
+ _: 1
336
+ }),
337
+ u(H, {
338
+ variant: "outlined",
339
+ class: "p-12"
340
+ }, {
341
+ default: N(() => [
342
+ s("div", tt, r(t(e).summary.update), 1),
343
+ o[10] || (o[10] = s("div", { class: "fm-typo-en-body-sm-400" }, "Update", -1))
344
+ ]),
345
+ _: 1
346
+ }),
347
+ u(H, {
348
+ variant: "outlined",
349
+ class: "p-12"
350
+ }, {
351
+ default: N(() => [
352
+ s("div", at, r(t(e).summary.balanceRows), 1),
353
+ o[11] || (o[11] = s("div", { class: "fm-typo-en-body-sm-400" }, "Balance rows", -1))
354
+ ]),
355
+ _: 1
356
+ })
357
+ ]),
358
+ t(e).summary.balanceRows ? (n(), i("div", ot, " Final target totals — Credit: " + r(t(e).summary.creditTargetTotal) + ", Experience: " + r(t(e).summary.experienceTargetTotal) + ", Points: " + r(t(e).summary.pointTargetTotal) + ". Tier changes: " + r(t(e).summary.tierRows) + ". ", 1)) : c("", !0),
359
+ t(e).summary.sharedProfiles ? (n(), i("div", st, r(t(e).summary.sharedProfiles) + " rows can update a shared profile used by another business. ", 1)) : c("", !0),
360
+ s("div", nt, [
361
+ o[12] || (o[12] = le(" To confirm your action, type ", -1)),
362
+ s("span", lt, r(t(e).businessName), 1),
363
+ o[13] || (o[13] = le(" in the text field ", -1))
364
+ ]),
365
+ u(Re, {
366
+ modelValue: t(R),
367
+ "onUpdate:modelValue": o[3] || (o[3] = (l) => Ae(R) ? R.value = l : null)
368
+ }, null, 8, ["modelValue"]),
369
+ t(e).summary.sharedProfiles ? (n(), E(U, {
370
+ key: 2,
371
+ "model-value": t(T),
372
+ value: "shared-profile",
373
+ label: "I understand that shared profile fields can affect other businesses.",
374
+ "onUpdate:modelValue": o[4] || (o[4] = (l) => T.value = l)
375
+ }, null, 8, ["model-value"])) : c("", !0),
376
+ t(e).summary.balanceRows ? (n(), E(U, {
377
+ key: 3,
378
+ "model-value": t(x),
379
+ value: "balance-replacement",
380
+ label: "I understand that populated balance cells replace final balances.",
381
+ "onUpdate:modelValue": o[5] || (o[5] = (l) => x.value = l)
382
+ }, null, 8, ["model-value"])) : c("", !0),
383
+ u(U, {
384
+ "model-value": t(S),
385
+ value: "import-responsibility",
386
+ label: "I acknowledge that I understand what data I import and will take the responsibility",
387
+ "onUpdate:modelValue": o[6] || (o[6] = (l) => S.value = l)
388
+ }, null, 8, ["model-value"]),
389
+ t(D).debugMode ? (n(), i("div", rt, [
390
+ o[14] || (o[14] = s("div", { class: "fm-typo-en-body-sm-600" }, "Start import checks", -1)),
391
+ (n(!0), i(O, null, Q(t(ce), (l) => (n(), i("div", {
392
+ key: l.label,
393
+ class: "flex gap-8"
394
+ }, [
395
+ s("span", {
396
+ class: W(l.passed ? "text-green-600" : "text-red-600")
397
+ }, r(l.passed ? "✓" : "✗"), 3),
398
+ s("span", null, r(l.label) + ": " + r(l.value), 1)
399
+ ]))), 128))
400
+ ])) : c("", !0)
401
+ ])) : c("", !0),
402
+ t(e).status === "INVALID" ? (n(), i("div", it, [
403
+ s("div", ut, [
404
+ o[15] || (o[15] = s("div", { class: "fm-typo-en-body-md-600" }, "The file is not importable", -1)),
405
+ s("div", dt, r(t(e).error), 1)
406
+ ]),
407
+ (n(!0), i(O, null, Q((Z = t(e).rowErrors) == null ? void 0 : Z.slice(0, 10), (l) => (n(), i("div", {
408
+ key: l.rowNumber,
409
+ class: "fm-typo-en-body-sm-400"
410
+ }, " Row " + r(l.rowNumber) + ": " + r(l.errors.join("; ")), 1))), 128))
411
+ ])) : c("", !0),
412
+ t(e).status === "STOPPED" ? (n(), i("div", ct, [
413
+ o[16] || (o[16] = s("div", { class: "fm-typo-en-body-md-600" }, "Import stopped", -1)),
414
+ s("div", mt, r(t(e).summary.completed) + " rows completed before the first runtime error. Fix the cause, then retry this same import safely. ", 1),
415
+ s("div", pt, r(t(e).error), 1)
416
+ ])) : c("", !0),
417
+ t(e).status === "COMPLETED" ? (n(), i("div", ft, [
418
+ o[17] || (o[17] = s("div", { class: "fm-typo-en-body-md-600" }, "Import completed", -1)),
419
+ s("div", vt, r(t(e).summary.completed) + " members were processed. ", 1)
420
+ ])) : c("", !0),
421
+ t(e).status === "CANCELLED" ? (n(), i("div", yt, [
422
+ o[18] || (o[18] = s("div", { class: "fm-typo-en-body-md-600" }, "Import cancelled", -1)),
423
+ s("div", bt, r(t(e).summary.completed) + " rows were completed before cancellation. ", 1)
424
+ ])) : c("", !0)
425
+ ], 64)) : (n(), i(O, { key: 1 }, [
426
+ o[7] || (o[7] = Le('<div class="rounded-md bg-fm-color-system-warning-100 p-16"><div class="fm-typo-en-title-sm-800"> Import changes production data </div><div class="fm-typo-en-body-md-400 text-fm-color-typo-secondary"><div class="grid grid-cols-[auto_1fr] gap-x-8 gap-y-8"><span aria-hidden="true">•</span><span>The file is fully validated before any member is changed.</span><span aria-hidden="true">•</span><span>Keep the sample row and paste your members from row 3 onward.</span><span aria-hidden="true">•</span><span>Blank cells keep existing values.</span><span aria-hidden="true">•</span><span>Use <code>__CLEAR__</code> to clear supported fields.</span><span aria-hidden="true">•</span><span>Use day/month/year for every date column; day and month may have one or two digits, for example <code>1/12/1989</code>. The sample row adds <code>(DD/MM/YYYY)</code> as a reminder; omit it in member rows.</span><span aria-hidden="true">•</span><span>Credit without CreditExpiryDate remains normal and non-expiring.</span><span aria-hidden="true">•</span><span> Each title requires one matching positional expiry. Quote both comma-separated fields in CSV, for example <code>&quot;VIP,VVIP,SVIP&quot;</code> and <code>&quot;05/09/2026,06/09/2026,07/09/2026&quot;</code>. </span></div></div></div>', 1)),
427
+ u(p, {
428
+ modelValue: t(L).mode,
429
+ "onUpdate:modelValue": o[0] || (o[0] = (l) => t(L).mode = l),
430
+ label: "Import mode",
431
+ items: q
432
+ }, null, 8, ["modelValue"]),
433
+ s("div", He, [
434
+ u($, null, {
435
+ "menu-button": N(() => [
436
+ u(y, {
437
+ variant: "tertiary",
438
+ icon: "download",
439
+ label: "Download template"
440
+ })
441
+ ]),
442
+ default: N(() => [
443
+ (n(), i(O, null, Q(j, (l) => u(C, {
444
+ key: l.value,
445
+ icon: l.icon,
446
+ label: l.label,
447
+ selectable: "",
448
+ onClick: (wt) => fe(l.value)
449
+ }, null, 8, ["icon", "label", "onClick"])), 64))
450
+ ]),
451
+ _: 1
452
+ })
453
+ ]),
454
+ t(f) ? (n(), i("div", Ge, [
455
+ u(y, {
456
+ variant: "tertiary",
457
+ "prepend-icon": "attach_file"
458
+ }),
459
+ s("p", qe, r(t(f).name), 1),
460
+ u(y, {
461
+ variant: "plain",
462
+ label: t(m)("Replace File"),
463
+ onClick: pe
464
+ }, null, 8, ["label"]),
465
+ s("input", {
466
+ ref_key: "replaceFileInput",
467
+ ref: k,
468
+ id: "member-import-file",
469
+ accept: ".csv, .xlsx",
470
+ class: "hidden",
471
+ type: "file",
472
+ onChange: me
473
+ }, null, 544)
474
+ ])) : (n(), E(Ee, {
475
+ key: 0,
476
+ accept: ".csv, .xlsx",
477
+ "max-file-size": 5e6,
478
+ onFileUpload: o[1] || (o[1] = (l) => f.value = l)
479
+ })),
480
+ u(U, {
481
+ "model-value": t(B),
482
+ value: "import-warnings",
483
+ label: "I have read and understand these import rules.",
484
+ "onUpdate:modelValue": o[2] || (o[2] = (l) => B.value = l)
485
+ }, null, 8, ["model-value"])
486
+ ], 64)),
487
+ t(d) ? (n(), E(Ce, {
488
+ key: 3,
489
+ state: "error",
490
+ text: t(d)
491
+ }, null, 8, ["text"])) : c("", !0),
492
+ s("div", _t, [
493
+ t(e) && ["INVALID", "STOPPED", "COMPLETED", "CANCELLED"].includes(t(e).status) ? (n(), E(y, {
494
+ key: 0,
495
+ variant: "tertiary",
496
+ icon: "download",
497
+ label: "Download result",
498
+ disabled: t(e).summary.total === 0,
499
+ onClick: ke
500
+ }, null, 8, ["disabled"])) : c("", !0),
501
+ ((ee = t(e)) == null ? void 0 : ee.status) === "INVALID" ? (n(), E(y, {
502
+ key: 1,
503
+ variant: "tertiary",
504
+ label: "Choose another file",
505
+ onClick: _e
506
+ })) : c("", !0),
507
+ u(Te),
508
+ u(y, {
509
+ variant: "secondary",
510
+ label: ((te = t(e)) == null ? void 0 : te.status) === "CANCELLING" ? "Cancelling…" : t(e) && ["COMPLETED", "CANCELLED", "INVALID"].includes(t(e).status) ? "Close" : "Cancel",
511
+ disabled: t(b) || ((ae = t(e)) == null ? void 0 : ae.status) === "CANCELLING",
512
+ onClick: we
513
+ }, null, 8, ["label", "disabled"]),
514
+ t(e) ? c("", !0) : (n(), E(y, {
515
+ key: 2,
516
+ label: "Validate file",
517
+ disabled: !t(f) || !t(B) || t(b),
518
+ onClick: ve
519
+ }, null, 8, ["disabled"])),
520
+ ((oe = t(e)) == null ? void 0 : oe.status) === "READY" ? (n(), E(y, {
521
+ key: 3,
522
+ label: "Start import",
523
+ disabled: !t(K) || t(b),
524
+ onClick: ge
525
+ }, null, 8, ["disabled"])) : c("", !0),
526
+ ((se = t(e)) == null ? void 0 : se.status) === "STOPPED" ? (n(), E(y, {
527
+ key: 4,
528
+ label: "Retry import",
529
+ disabled: t(b) || !t(e).file,
530
+ onClick: he
531
+ }, null, 8, ["disabled"])) : c("", !0)
532
+ ])
533
+ ]);
534
+ };
535
+ }
536
+ }), ht = { class: "px-24 flex flex-col gap-y-16 pb-24" }, Ft = /* @__PURE__ */ J({
537
+ __name: "Member",
538
+ setup(G) {
539
+ const m = Oe(), { t: M } = de(), D = ue(), f = [
540
+ {
541
+ label: M("connect.loyalty.member.tabs.member_list"),
542
+ value: I["$connect-LOYALTY_MEMBER_LIST"]
543
+ }
544
+ ], k = P(() => {
545
+ var w, _, L;
546
+ const h = m.currentRoute.value.name;
547
+ return h == I["$connect-LOYALTY_MEMBER_IMPORT_HISTORY"] ? {
548
+ title: "Import history",
549
+ description: void 0,
550
+ backButton: !0,
551
+ onBackButton: async () => {
552
+ await m.push({
553
+ name: I["$connect-LOYALTY_MEMBER_LIST"]
554
+ });
555
+ }
556
+ } : h != I["$connect-LOYALTY_MEMBER_TRANSACTIONS"] ? {
557
+ title: e.value.label,
558
+ description: void 0
559
+ } : (e.value = f[1], {
560
+ backButton: !0,
561
+ title: M("connect.loyalty.member.title"),
562
+ description: `${(w = d.value) == null ? void 0 : w.name} (${(_ = d.value) == null ? void 0 : _._id}) (${(L = d.value) == null ? void 0 : L.phoneNumber})`,
563
+ onBackButton: async () => {
564
+ await m.push({ name: I["$connect-LOYALTY_MEMBER_LIST"] });
565
+ }
566
+ });
567
+ }), e = g(
568
+ f.find((h) => h.value === m.currentRoute.value.name) ?? f[0]
569
+ ), d = g(), R = P(
570
+ () => m.currentRoute.value.name === I["$connect-LOYALTY_MEMBER_TRANSACTIONS"] || m.currentRoute.value.name === I["$connect-LOYALTY_MEMBER_IMPORT_HISTORY"]
571
+ ), B = P(
572
+ () => m.currentRoute.value.name !== I["$connect-LOYALTY_MEMBER_TRANSACTIONS"]
573
+ ), T = P(
574
+ () => m.currentRoute.value.name !== I["$connect-LOYALTY_MEMBER_IMPORT_HISTORY"]
575
+ );
576
+ async function x(h) {
577
+ await m.push({ name: h });
578
+ }
579
+ async function S() {
580
+ D.open({
581
+ title: "Import members",
582
+ closeButton: !1,
583
+ dismissAway: !1,
584
+ maxHeight: "90vh",
585
+ contentComponent: gt
586
+ });
587
+ }
588
+ async function b() {
589
+ await m.push({
590
+ name: I["$connect-LOYALTY_MEMBER_IMPORT_HISTORY"]
591
+ });
592
+ }
593
+ return Ne(
594
+ () => m.currentRoute.value.name,
595
+ async (h) => {
596
+ e.value = f.find((_) => _.value === h) ?? f[0];
597
+ const w = m.currentRoute.value.params.id;
598
+ w && (d.value = await A.readById(w));
599
+ },
600
+ { immediate: !0 }
601
+ ), (h, w) => {
602
+ const _ = v("FmButton"), L = v("FmPageHead"), q = v("FmTabs"), j = v("RouterView");
603
+ return n(), i(O, null, [
604
+ u(L, {
605
+ title: t(k).title,
606
+ description: t(k).description,
607
+ "back-button": t(k).backButton,
608
+ "onClick:back": t(k).onBackButton
609
+ }, Me({ _: 2 }, [
610
+ t(B) ? {
611
+ name: "append",
612
+ fn: N(() => [
613
+ u(Ye, null, {
614
+ default: N(() => [
615
+ t(T) ? (n(), E(_, {
616
+ key: 0,
617
+ label: "Import history",
618
+ "prepend-icon": "work_history",
619
+ variant: "tertiary",
620
+ onClick: b
621
+ })) : c("", !0),
622
+ u(_, {
623
+ label: t(M)("connect.loyalty.member.import"),
624
+ "prepend-icon": "download",
625
+ onClick: S
626
+ }, null, 8, ["label"])
627
+ ]),
628
+ _: 1
629
+ })
630
+ ]),
631
+ key: "0"
632
+ } : void 0
633
+ ]), 1032, ["title", "description", "back-button", "onClick:back"]),
634
+ s("div", ht, [
635
+ t(R) ? c("", !0) : (n(), E(q, {
636
+ key: 0,
637
+ "model-value": t(e).value,
638
+ items: f,
639
+ "onUpdate:modelValue": x
640
+ }, null, 8, ["model-value"])),
641
+ u(j)
642
+ ])
643
+ ], 64);
644
+ };
645
+ }
646
+ });
647
+ export {
648
+ Ft as default
649
+ };