@feedmepos/mf-connect 0.1.98-beta.46 → 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 (122) hide show
  1. package/dist/{App-DX5hNYdq.js → App-DpEetYST.js} +8 -8
  2. package/dist/{AuditLogs-mHXQ564w.js → AuditLogs-Cmo803hX.js} +10 -10
  3. package/dist/{Bin-BJZ_BMNI.js → Bin-DJfXzuaK.js} +8 -8
  4. package/dist/{Broadcast-DIKGv1-A.js → Broadcast-CNgV44yY.js} +11 -11
  5. package/dist/{CampaignAnalytic-CRG3ys5S.js → CampaignAnalytic-B2Rn2EJg.js} +6 -6
  6. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DnSFhe_I.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-Bns7bxjM.js} +7 -7
  7. package/dist/{Card-B3gnDfS7.js → Card-B2VUzTu-.js} +20 -20
  8. package/dist/{Collections-Cv1vBVoX.js → Collections-CND1NP87.js} +8 -8
  9. package/dist/{Credit-BLShYSWf.js → Credit-DVwWQVhX.js} +12 -12
  10. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-u4meW2NQ.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-BAkLmXrV.js} +34 -35
  11. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-w-W78u2c.js → EffectSheet.vue_vue_type_style_index_0_lang-C_iJZVqp.js} +16 -16
  12. package/dist/{Experience-BwVJpeNX.js → Experience-byIWULhh.js} +12 -12
  13. package/dist/{FileSaver.min-DmEepxKi.js → FileSaver.min-CaXtjHRv.js} +1 -1
  14. package/dist/{Game-q1or_U4f.js → Game-tzliFFnf.js} +13 -13
  15. package/dist/{GiftCardSetup-CVwl7Xvu.js → GiftCardSetup-CUZn8cQ_.js} +9 -9
  16. package/dist/{Grab-BYxd3LMm.js → Grab-Bj955oc2.js} +9 -9
  17. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-C5UWFkZq.js → ImageInput.vue_vue_type_script_setup_true_lang-DM6s0VaT.js} +1 -1
  18. package/dist/{Index-qlVRiwB_.js → Index-qie7NJrQ.js} +10 -10
  19. package/dist/{LocationPicker.vue_vue_type_script_setup_true_lang-DiI_6s7R.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-DbqW78d2.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-CSwcQUla.js → MainLayout-B4LQ7fj3.js} +3 -3
  23. package/dist/{Marketing-DbJnSVzS.js → Marketing-BP2jjkGw.js} +4 -4
  24. package/dist/{MarketingMaterialEdit-CeQlZGni.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-CXq5k3za.js +187 -0
  28. package/dist/MemberList-DgQrAUhF.js +336 -0
  29. package/dist/{MemberTransactions-CdVatR9e.js → MemberTransactions-SD0EK9MQ.js} +1 -1
  30. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-BupsL_ri.js → MessageInput.vue_vue_type_script_setup_true_lang-B_P--gRo.js} +10 -10
  31. package/dist/{Mission-C9IqGiDI.js → Mission-Dcc8TywU.js} +13 -13
  32. package/dist/{Overview-XshwtoKB.js → Overview-2n-3zYgT.js} +3 -3
  33. package/dist/{Overview-DEp_GpnT.js → Overview-ClsCoDwC.js} +19 -19
  34. package/dist/{Point-CTgCH5ww.js → Point-yoPNIfen.js} +12 -12
  35. package/dist/{Promotion-Cz0ILEA5.js → Promotion-Bo8fwRxo.js} +13 -13
  36. package/dist/{Queue-BTB-C-m9.js → Queue-DOMCJIfy.js} +11 -11
  37. package/dist/{Record-BglzH9E_.js → Record-B_GFsmRS.js} +9 -9
  38. package/dist/{Review-CeG0VBlj.js → Review-D-UnLgKx.js} +2 -2
  39. package/dist/{ReviewFacebookCallback-k5luFa74.js → ReviewFacebookCallback-CSkzBR52.js} +5 -5
  40. package/dist/{ReviewGoogleCallback-BM8aUDcD.js → ReviewGoogleCallback-DXW6TAxP.js} +5 -5
  41. package/dist/{Reward-CosruSnZ.js → Reward-CqNDQ5fM.js} +16 -16
  42. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-gTKCJEDQ.js → RewardGroup.vue_vue_type_script_setup_true_lang-CZPtIroB.js} +12 -12
  43. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-sZDzblfZ.js → RuleGroup.vue_vue_type_script_setup_true_lang-xzJ738TT.js} +15 -15
  44. package/dist/{Segment-b0sjn0Ht.js → Segment-B3keIMfg.js} +33 -34
  45. package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-Dh06v51H.js → SelectItems.vue_vue_type_script_setup_true_lang-B1IbP3lO.js} +2 -2
  46. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-CYEzN-ja.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-BvrNFNDo.js} +13 -13
  47. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-Bvdzs94r.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-BtJyfV2S.js} +4 -4
  48. package/dist/{Setting-C1f9yHcb.js → Setting-CUf7r25C.js} +14 -14
  49. package/dist/{SettingAdvertisements-BSpiKy7v.js → SettingAdvertisements-BnfH2GWe.js} +12 -12
  50. package/dist/{Settings-h2K8CcjU.js → Settings-CVyEvBdL.js} +5 -5
  51. package/dist/{Store-C7qKJO1_.js → Store-yJsGBJjp.js} +24 -24
  52. package/dist/{StoreRewards-BhWbUnaP.js → StoreRewards-E009h_Ki.js} +15 -15
  53. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-C8dxa_j1.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-OEdu52e8.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-BWytuBNh.js} +2 -2
  55. package/dist/{Tier-kH0FTUdH.js → Tier-D6l8QcgM.js} +25 -25
  56. package/dist/{Title-B9fQWpgB.js → Title-CKdZ_ulb.js} +22 -22
  57. package/dist/{Transaction-CAtGFUZ8.js → Transaction-CHzWDrMp.js} +2 -2
  58. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-L2dPD3nb.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-D5-CNeZh.js} +6 -6
  59. package/dist/{Voucher-BDZmikj-.js → Voucher-g84i_O99.js} +14 -14
  60. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-BAOcPygI.js → VoucherEditor.vue_vue_type_script_setup_true_lang-HofDeLRx.js} +12 -12
  61. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-DaWuGWEn.js → ZodTextField.vue_vue_type_script_setup_true_lang-B2QIFX1P.js} +2 -2
  62. package/dist/{app-BIGPr1BQ.js → app-CVfoAVMp.js} +467 -447
  63. package/dist/app.js +1 -1
  64. package/dist/{business-C1ztrtzd.js → business-DZUUnIjL.js} +5 -5
  65. package/dist/{campaign-D17yaHo7.js → campaign-BIbDOJuM.js} +8 -8
  66. package/dist/{campaign-BFJC-o2t.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-6Ul0G_eo.js → campaign.fn-BSKTKKn_.js} +39 -39
  69. package/dist/{collectible.enum-Liy2wH3s.js → collectible.enum-Bpd7su_n.js} +1 -1
  70. package/dist/{collection.fn-CgJirF44.js → collection.fn-CGLzb4iJ.js} +2 -2
  71. package/dist/{duplicateCampaign-Bguk2VhU.js → duplicateCampaign-DvYTuIU-.js} +2 -2
  72. package/dist/{effect-Agn00g7v.js → effect-DeuwDSDb.js} +1 -1
  73. package/dist/{email-addresses--b6ZRMp5.js → email-addresses-CXSJ6d0R.js} +2 -2
  74. package/dist/{export-CZO7WdRK.js → export-DMrK_zVs.js} +3 -3
  75. package/dist/{helper-1LMLYuOT.js → helper-CuwR4Iok.js} +1 -1
  76. package/dist/{index-JlyOHqyG.js → index-BGM2LdBN.js} +3 -3
  77. package/dist/index-BIE7IDVs.js +137 -0
  78. package/dist/{index-a9a0E67J.js → index-BnF40VHU.js} +1 -1
  79. package/dist/{index-BjaSmxp0.js → index-Br-IwWs2.js} +7 -7
  80. package/dist/{index-u4XmN7tA.js → index-BsGpbfSM.js} +1 -1
  81. package/dist/{index-Bqah4gFm.js → index-BsL2fRDR.js} +82 -83
  82. package/dist/{index-DLUkLGMO.js → index-BtCff_X4.js} +14 -14
  83. package/dist/{index-ULSqCLHU.js → index-CVshuS9x.js} +5 -4
  84. package/dist/{index-BVvOGOL3.js → index-CmXN0dX2.js} +273 -273
  85. package/dist/{index-w-02c2Sb.js → index-CsKzQMVH.js} +10766 -8027
  86. package/dist/{index-Czli6YCc.js → index-D0RwTeSK.js} +7 -8
  87. package/dist/{index-C_F0JxFs.js → index-Di34zXvz.js} +1 -1
  88. package/dist/{index-BVls8ERM.js → index-DtlEsLvC.js} +1 -1
  89. package/dist/{index-DNSEyYgh.js → index-KJ9fWfKI.js} +2 -2
  90. package/dist/{index-Cd-tJwMs.js → index-Z1kANjy2.js} +1 -1
  91. package/dist/{index-q90FGGn5.js → index-mkULcMHp.js} +1 -1
  92. package/dist/{index-Bxp7-J4q.js → index-ux77Q19k.js} +24 -25
  93. package/dist/{index-B2HcSYJy.js → index-v0Wp7wZh.js} +11 -12
  94. package/dist/{index.esm2017-1tPNvAVS.js → index.esm2017-7ccdC84w.js} +132 -132
  95. package/dist/{loading-BnW9omqu.js → loading-CRmkbq3n.js} +1 -1
  96. package/dist/{lodash-CHIHYyCv.js → lodash-Bc-ryXNQ.js} +1 -1
  97. package/dist/member-import-DlkhFBuH.js +143 -0
  98. package/dist/{membership-ByX0MwV6.js → membership-B26RzkXD.js} +3 -3
  99. package/dist/{money-DT26h-9c.js → money-DQctndhn.js} +1 -1
  100. package/dist/{number-CLRlA2Ph.js → number-Bf6ikkos.js} +1 -1
  101. package/dist/objectid-rBYoX-d0.js +145 -0
  102. package/dist/{plugins-CqkgKVsK.js → plugins-C67nSbj6.js} +3 -3
  103. package/dist/{reward-DoYj0TRD.js → reward-C43tP4ms.js} +1 -1
  104. package/dist/{rule-builder-CnqLXEzT.js → rule-builder-C8VKx9qo.js} +1 -1
  105. package/dist/{rule-BfzfFw7G.js → rule-ferkW3Tn.js} +3 -3
  106. package/dist/{template-DOuh3jrd.js → template-6TQsSBnV.js} +6 -6
  107. package/dist/{timezone-CXUZ418k.js → timezone-CHLqfxGX.js} +1 -1
  108. package/dist/{transaction.fn-CpTfkivT.js → transaction.fn-Ck4GNkX8.js} +1 -1
  109. package/dist/{trigger-A20rfpV9.js → trigger-DW-HI3-m.js} +5 -5
  110. package/dist/{useMarketingMaterialActions-CCSX_Vu1.js → useMarketingMaterialActions-DgjXENGq.js} +3 -3
  111. package/dist/{usePagination-DElEO6kf.js → usePagination-DK5YxY0V.js} +1 -1
  112. package/dist/{user-DzTNLbUQ.js → user-CEgC8bHe.js} +1 -1
  113. package/dist/{vue-i18n-BxjnJjv4.js → vue-i18n-CVwaGWN7.js} +322 -322
  114. package/dist/{xlsx-B5E_HVo5.js → xlsx-BjSGml1D.js} +440 -440
  115. package/dist/{zod-DjcVp7VN.js → zod-CIM7JLfN.js} +1 -1
  116. package/package.json +3 -1
  117. package/dist/LoyaltyDashboard-gXkQ6yRd.js +0 -1345
  118. package/dist/Member-C0VVffcW.js +0 -281
  119. package/dist/MemberList-DKfVeadO.js +0 -1603
  120. package/dist/index-C_H8jFYf.js +0 -2743
  121. package/dist/index-DmBWoao-.js +0 -85
  122. package/dist/objectid-Bqi3tFbn.js +0 -145
@@ -0,0 +1,642 @@
1
+ import { defineComponent as J, resolveComponent as f, unref as t, openBlock as n, createElementBlock as d, normalizeClass as z, renderSlot as ae, createElementVNode as s, createVNode as u, ref as h, computed as P, onMounted as Ce, onBeforeUnmount as Ie, Fragment as B, createStaticVNode as Te, withCtx as S, renderList as q, createBlock as w, toDisplayString as r, createCommentVNode as c, createTextVNode as oe, isRef as xe, watch as Re, createSlots as Le } from "vue";
2
+ import "./index-BnF40VHU.js";
3
+ import { useDialog as ne } from "@feedmepos/ui-library";
4
+ import { u as le } from "./vue-i18n-CVwaGWN7.js";
5
+ import { useCoreStore as Se } from "@feedmepos/mf-common";
6
+ import { F as se } from "./FileSaver.min-CaXtjHRv.js";
7
+ import { u as j, w as Ne } from "./xlsx-BjSGml1D.js";
8
+ import { m as L } from "./index-BIE7IDVs.js";
9
+ import { useRouter as Ae } from "vue-router";
10
+ import { R as k } from "./app-CVfoAVMp.js";
11
+ const Fe = { class: "fm-typo-en-body-sm-400 justify-center flex items-center w-full" }, Pe = /* @__PURE__ */ J({
12
+ __name: "FmAdminBadge",
13
+ props: {
14
+ class: { default: void 0 },
15
+ selectable: { type: Boolean, default: !1 }
16
+ },
17
+ setup(H) {
18
+ const m = H, N = Se();
19
+ return (b, e) => {
20
+ var v;
21
+ const i = f("FmIcon");
22
+ return (v = t(N).sessionUser.value) != null && v.role.isAdmin ? (n(), d("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": !m.selectable }
27
+ ])
28
+ }, [
29
+ ae(b.$slots, "default"),
30
+ s("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
+ m.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
+ s("span", Fe, [
41
+ u(i, {
42
+ name: "support_agent",
43
+ size: "sm",
44
+ outline: ""
45
+ })
46
+ ])
47
+ ], 2)
48
+ ], 2)) : ae(b.$slots, "non-admin", { key: 1 });
49
+ };
50
+ }
51
+ }), De = { class: "w-[760px] max-w-full space-y-24 pb-16" }, Be = {
52
+ key: 0,
53
+ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
54
+ }, Me = { class: "flex justify-end" }, Ve = {
55
+ key: 1,
56
+ class: "flex items-center rounded-md border border-fm-color-neutral-gray-300 p-16"
57
+ }, Oe = { class: "fm-typo-en-body-lg-400 min-w-0 flex-1 truncate px-8" }, Ye = { for: "member-import-file" }, $e = { class: "flex items-center justify-between" }, Ue = { class: "fm-typo-en-title-sm-800" }, He = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Ge = {
58
+ key: 0,
59
+ class: "rounded-md bg-fm-color-system-error-100 p-16 fm-typo-en-body-sm-400"
60
+ }, qe = {
61
+ key: 1,
62
+ class: "rounded-md bg-fm-color-system-info-100 p-16 fm-typo-en-body-md-400"
63
+ }, je = {
64
+ key: 2,
65
+ class: "space-y-16"
66
+ }, ze = { class: "grid grid-cols-2 gap-8 md:grid-cols-4" }, Je = { class: "fm-typo-en-title-sm-800" }, Qe = { class: "fm-typo-en-title-sm-800" }, We = { class: "fm-typo-en-title-sm-800" }, Ke = { class: "fm-typo-en-title-sm-800" }, Xe = {
67
+ key: 0,
68
+ class: "rounded-md bg-fm-color-system-warning-100 p-16 fm-typo-en-body-sm-400"
69
+ }, Ze = {
70
+ key: 1,
71
+ class: "rounded-md bg-fm-color-system-warning-100 p-16 fm-typo-en-body-sm-400"
72
+ }, et = { class: "fm-typo-en-body-md-400" }, tt = { class: "fm-typo-en-body-md-600" }, at = { class: "rounded-md bg-fm-color-neutral-gray-100 p-12 fm-typo-en-body-sm-400" }, ot = {
73
+ key: 3,
74
+ class: "space-y-12"
75
+ }, st = { class: "rounded-md bg-fm-color-system-error-100 p-16" }, nt = { class: "fm-typo-en-body-sm-400" }, lt = {
76
+ key: 4,
77
+ class: "rounded-md bg-fm-color-system-error-100 p-16"
78
+ }, rt = { class: "fm-typo-en-body-sm-400" }, it = { class: "fm-typo-en-body-sm-400" }, dt = {
79
+ key: 5,
80
+ class: "rounded-md bg-fm-color-system-success-100 p-16"
81
+ }, ut = { class: "fm-typo-en-body-sm-400" }, ct = {
82
+ key: 6,
83
+ class: "rounded-md bg-fm-color-system-info-100 p-16"
84
+ }, mt = { class: "fm-typo-en-body-sm-400" }, pt = { class: "flex items-center justify-end gap-8" }, ft = /* @__PURE__ */ J({
85
+ __name: "ImportMemberDialog",
86
+ setup(H) {
87
+ const { t: m } = le(), N = ne(), b = h(null), e = h(null), i = h(""), v = h(""), C = h(!1), I = h(!1), T = h(!1), y = h(!1), O = h(!0);
88
+ let A, x = 0;
89
+ const _ = h({
90
+ mode: "UPSERT"
91
+ }), R = [
92
+ { label: "Create missing members only", value: "CREATE" },
93
+ { label: "Update existing members only", value: "UPDATE" },
94
+ { label: "Create and update members", value: "UPSERT" }
95
+ ], E = [
96
+ "Name",
97
+ "Phone",
98
+ "Email",
99
+ "Gender",
100
+ "CardNo",
101
+ "Birthday",
102
+ "Credit",
103
+ "CreditExpiryDate",
104
+ "Experience",
105
+ "Point",
106
+ "Tier",
107
+ "Titles",
108
+ "TitleExpiryDate",
109
+ "AvgSpent",
110
+ "LastVisit",
111
+ "Feedback",
112
+ "LastSeasonTierEarned",
113
+ "LastSeasonPointEarned",
114
+ "JoinedAt",
115
+ "JoinedAtLocation",
116
+ "VisitFrequency"
117
+ ], D = [
118
+ {
119
+ label: "CSV",
120
+ icon: "csv",
121
+ value: "csv"
122
+ /* csv */
123
+ },
124
+ {
125
+ label: "Excel",
126
+ icon: "description",
127
+ value: "xlsx"
128
+ /* xlsx */
129
+ }
130
+ ], M = P(
131
+ () => {
132
+ var a;
133
+ return ["UPLOADED", "VALIDATING", "QUEUED", "RUNNING", "CANCELLING"].includes(
134
+ ((a = e.value) == null ? void 0 : a.status) ?? ""
135
+ );
136
+ }
137
+ ), Y = P(() => {
138
+ var a;
139
+ return !(((a = e.value) == null ? void 0 : a.status) !== "READY" || !e.value.file || v.value !== e.value.businessName || e.value.summary.sharedProfiles > 0 && !I.value || e.value.summary.balanceRows > 0 && !T.value);
140
+ }), re = P(() => {
141
+ const a = e.value, o = a == null ? void 0 : a.summary, p = !!a && v.value === a.businessName;
142
+ return [
143
+ {
144
+ label: "Status is READY",
145
+ passed: (a == null ? void 0 : a.status) === "READY",
146
+ value: (a == null ? void 0 : a.status) ?? "missing"
147
+ },
148
+ {
149
+ label: "Uploaded file exists",
150
+ passed: !!(a != null && a.file),
151
+ value: a != null && a.file ? "yes" : "no"
152
+ },
153
+ {
154
+ label: "Business name matches exactly",
155
+ passed: p,
156
+ value: `entered "${v.value}" / expected "${(a == null ? void 0 : a.businessName) ?? ""}"`
157
+ },
158
+ {
159
+ label: "Shared-profile acknowledgement",
160
+ passed: !(o != null && o.sharedProfiles) || I.value,
161
+ value: o != null && o.sharedProfiles ? `${I.value ? "checked" : "required"} (${o.sharedProfiles} rows)` : "not required"
162
+ },
163
+ {
164
+ label: "Balance-replacement acknowledgement",
165
+ passed: !(o != null && o.balanceRows) || T.value,
166
+ value: o != null && o.balanceRows ? `${T.value ? "checked" : "required"} (${o.balanceRows} rows)` : "not required"
167
+ }
168
+ ];
169
+ });
170
+ function ie(a) {
171
+ var o, p;
172
+ b.value = ((p = (o = a.target) == null ? void 0 : o.files) == null ? void 0 : p[0]) ?? null;
173
+ }
174
+ function de(a) {
175
+ if (a === "csv") {
176
+ se.saveAs(
177
+ new Blob([E.join(",")], {
178
+ type: "text/csv;charset=utf-8;"
179
+ }),
180
+ "ImportMemberTemplate.csv"
181
+ );
182
+ return;
183
+ }
184
+ const o = j.aoa_to_sheet([E]), p = j.book_new();
185
+ j.book_append_sheet(p, o, "Members"), Ne(p, "ImportMemberTemplate.xlsx");
186
+ }
187
+ async function ue() {
188
+ if (!b.value) {
189
+ i.value = "Please upload a file.";
190
+ return;
191
+ }
192
+ if (!C.value) {
193
+ i.value = "Please read and acknowledge the import warnings.";
194
+ return;
195
+ }
196
+ y.value = !0, i.value = "";
197
+ try {
198
+ const a = new FormData();
199
+ a.append("file", b.value), a.append("config", JSON.stringify(_.value)), e.value = await L.import(a), await F();
200
+ } catch (a) {
201
+ i.value = a instanceof Error ? a.message : String(a);
202
+ } finally {
203
+ y.value = !1;
204
+ }
205
+ }
206
+ async function ce(a) {
207
+ var p, g;
208
+ if (!e.value) return !1;
209
+ const o = e.value._id.toString();
210
+ try {
211
+ const V = await L.readImport(o);
212
+ return a !== x || ((p = e.value) == null ? void 0 : p._id.toString()) !== o ? !1 : (e.value = V, !0);
213
+ } catch (V) {
214
+ if (a !== x || ((g = e.value) == null ? void 0 : g._id.toString()) !== o)
215
+ return !1;
216
+ throw V;
217
+ }
218
+ }
219
+ async function F() {
220
+ var o;
221
+ $();
222
+ const a = x;
223
+ try {
224
+ if (!await ce(a)) return;
225
+ } catch (p) {
226
+ if (a !== x) return;
227
+ i.value = p instanceof Error ? p.message : String(p), M.value && (A = setTimeout(F, 5e3));
228
+ return;
229
+ }
230
+ a === x && M.value && (A = setTimeout(F, ((o = e.value) == null ? void 0 : o.status) === "RUNNING" ? 5e3 : 1500));
231
+ }
232
+ async function me() {
233
+ try {
234
+ e.value = await L.resumableImport(), e.value && await F();
235
+ } catch (a) {
236
+ i.value = a instanceof Error ? a.message : String(a);
237
+ } finally {
238
+ O.value = !1;
239
+ }
240
+ }
241
+ function $() {
242
+ x += 1, A && clearTimeout(A), A = void 0;
243
+ }
244
+ function pe() {
245
+ $(), e.value = null, b.value = null, i.value = "";
246
+ }
247
+ async function fe() {
248
+ if (!(!e.value || !Y.value)) {
249
+ y.value = !0, i.value = "";
250
+ try {
251
+ e.value = await L.confirmImport(e.value._id.toString(), {
252
+ businessName: v.value,
253
+ fileHash: e.value.fileHash,
254
+ previewVersion: e.value.previewVersion,
255
+ acknowledgeSharedProfiles: I.value,
256
+ acknowledgeBalanceReplacement: T.value
257
+ }), await F();
258
+ } catch (a) {
259
+ i.value = a instanceof Error ? a.message : String(a);
260
+ } finally {
261
+ y.value = !1;
262
+ }
263
+ }
264
+ }
265
+ async function ve() {
266
+ if (e.value) {
267
+ y.value = !0, i.value = "";
268
+ try {
269
+ e.value = await L.retryImport(e.value._id.toString()), await F();
270
+ } catch (a) {
271
+ i.value = a instanceof Error ? a.message : String(a);
272
+ } finally {
273
+ y.value = !1;
274
+ }
275
+ }
276
+ }
277
+ async function ye() {
278
+ if (!e.value || ["COMPLETED", "CANCELLED", "INVALID"].includes(e.value.status)) {
279
+ N.close();
280
+ return;
281
+ }
282
+ if (e.value.status !== "CANCELLING") {
283
+ y.value = !0, i.value = "";
284
+ try {
285
+ const a = await L.cancelImport(e.value._id.toString());
286
+ $(), e.value = a, e.value.status === "CANCELLING" && await F();
287
+ } catch (a) {
288
+ i.value = a instanceof Error ? a.message : String(a);
289
+ } finally {
290
+ y.value = !1;
291
+ }
292
+ }
293
+ }
294
+ async function be() {
295
+ if (!e.value) return;
296
+ const a = await L.downloadImportResult(e.value._id.toString());
297
+ se.saveAs(a, `member-import-${e.value._id}.csv`);
298
+ }
299
+ return Ce(me), Ie($), (a, o) => {
300
+ var Q, W, K, X, Z, ee, te;
301
+ const p = f("FmSelect"), g = f("FmButton"), V = f("FmMenuItem"), _e = f("FmMenu"), ge = f("FmDropField"), G = f("FmCheckbox"), he = f("FmChip"), U = f("FmCard"), we = f("FmTextField"), Ee = f("FmHelperText"), ke = f("FmSpacer");
302
+ return n(), d("div", De, [
303
+ t(O) ? (n(), d("div", Be, " Checking for an unfinished import… ")) : t(e) ? (n(), d(B, { key: 2 }, [
304
+ s("div", $e, [
305
+ s("div", null, [
306
+ s("div", Ue, r(((Q = t(e).file) == null ? void 0 : Q.originalName) ?? "Unknown file"), 1),
307
+ s("div", He, " Import " + r(t(e)._id) + " · " + r(t(e).status), 1)
308
+ ]),
309
+ u(he, {
310
+ label: t(e).status,
311
+ compact: ""
312
+ }, null, 8, ["label"])
313
+ ]),
314
+ t(e).file ? c("", !0) : (n(), d("div", Ge, " The saved import is missing its uploaded file. Cancel it and upload the file again. ")),
315
+ t(M) ? (n(), d("div", qe, r(t(e).status === "RUNNING" ? "Importing members…" : t(e).status === "CANCELLING" ? "Cancelling import…" : "Preparing import preview…"), 1)) : c("", !0),
316
+ t(e).status === "READY" ? (n(), d("div", je, [
317
+ s("div", ze, [
318
+ u(U, {
319
+ variant: "outlined",
320
+ class: "p-12"
321
+ }, {
322
+ default: S(() => [
323
+ s("div", Je, r(t(e).summary.total), 1),
324
+ o[7] || (o[7] = s("div", { class: "fm-typo-en-body-sm-400" }, "Rows", -1))
325
+ ]),
326
+ _: 1
327
+ }),
328
+ u(U, {
329
+ variant: "outlined",
330
+ class: "p-12"
331
+ }, {
332
+ default: S(() => [
333
+ s("div", Qe, r(t(e).summary.create), 1),
334
+ o[8] || (o[8] = s("div", { class: "fm-typo-en-body-sm-400" }, "Create", -1))
335
+ ]),
336
+ _: 1
337
+ }),
338
+ u(U, {
339
+ variant: "outlined",
340
+ class: "p-12"
341
+ }, {
342
+ default: S(() => [
343
+ s("div", We, r(t(e).summary.update), 1),
344
+ o[9] || (o[9] = s("div", { class: "fm-typo-en-body-sm-400" }, "Update", -1))
345
+ ]),
346
+ _: 1
347
+ }),
348
+ u(U, {
349
+ variant: "outlined",
350
+ class: "p-12"
351
+ }, {
352
+ default: S(() => [
353
+ s("div", Ke, r(t(e).summary.balanceRows), 1),
354
+ o[10] || (o[10] = s("div", { class: "fm-typo-en-body-sm-400" }, "Balance rows", -1))
355
+ ]),
356
+ _: 1
357
+ })
358
+ ]),
359
+ t(e).summary.balanceRows ? (n(), d("div", Xe, " 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),
360
+ t(e).summary.sharedProfiles ? (n(), d("div", Ze, r(t(e).summary.sharedProfiles) + " rows can update a shared profile used by another business. ", 1)) : c("", !0),
361
+ s("div", et, [
362
+ o[11] || (o[11] = oe(" To confirm your action, type ", -1)),
363
+ s("span", tt, r(t(e).businessName), 1),
364
+ o[12] || (o[12] = oe(" in the text field ", -1))
365
+ ]),
366
+ u(we, {
367
+ modelValue: t(v),
368
+ "onUpdate:modelValue": o[3] || (o[3] = (l) => xe(v) ? v.value = l : null)
369
+ }, null, 8, ["modelValue"]),
370
+ t(e).summary.sharedProfiles ? (n(), w(G, {
371
+ key: 2,
372
+ "model-value": t(I),
373
+ value: "shared-profile",
374
+ label: "I understand that shared profile fields can affect other businesses.",
375
+ "onUpdate:modelValue": o[4] || (o[4] = (l) => I.value = l)
376
+ }, null, 8, ["model-value"])) : c("", !0),
377
+ t(e).summary.balanceRows ? (n(), w(G, {
378
+ key: 3,
379
+ "model-value": t(T),
380
+ value: "balance-replacement",
381
+ label: "I understand that populated balance cells replace final balances.",
382
+ "onUpdate:modelValue": o[5] || (o[5] = (l) => T.value = l)
383
+ }, null, 8, ["model-value"])) : c("", !0),
384
+ s("div", at, [
385
+ o[13] || (o[13] = s("div", { class: "fm-typo-en-body-sm-600" }, "Start import checks", -1)),
386
+ (n(!0), d(B, null, q(t(re), (l) => (n(), d("div", {
387
+ key: l.label,
388
+ class: "flex gap-8"
389
+ }, [
390
+ s("span", {
391
+ class: z(l.passed ? "text-green-600" : "text-red-600")
392
+ }, r(l.passed ? "✓" : "✗"), 3),
393
+ s("span", null, r(l.label) + ": " + r(l.value), 1)
394
+ ]))), 128))
395
+ ])
396
+ ])) : c("", !0),
397
+ t(e).status === "INVALID" ? (n(), d("div", ot, [
398
+ s("div", st, [
399
+ o[14] || (o[14] = s("div", { class: "fm-typo-en-body-md-600" }, "The file is not importable", -1)),
400
+ s("div", nt, r(t(e).error), 1)
401
+ ]),
402
+ (n(!0), d(B, null, q((W = t(e).rowErrors) == null ? void 0 : W.slice(0, 10), (l) => (n(), d("div", {
403
+ key: l.rowNumber,
404
+ class: "fm-typo-en-body-sm-400"
405
+ }, " Row " + r(l.rowNumber) + ": " + r(l.errors.join("; ")), 1))), 128))
406
+ ])) : c("", !0),
407
+ t(e).status === "STOPPED" ? (n(), d("div", lt, [
408
+ o[15] || (o[15] = s("div", { class: "fm-typo-en-body-md-600" }, "Import stopped", -1)),
409
+ s("div", rt, r(t(e).summary.completed) + " rows completed before the first runtime error. Fix the cause, then retry this same import safely. ", 1),
410
+ s("div", it, r(t(e).error), 1)
411
+ ])) : c("", !0),
412
+ t(e).status === "COMPLETED" ? (n(), d("div", dt, [
413
+ o[16] || (o[16] = s("div", { class: "fm-typo-en-body-md-600" }, "Import completed", -1)),
414
+ s("div", ut, r(t(e).summary.completed) + " members were processed. ", 1)
415
+ ])) : c("", !0),
416
+ t(e).status === "CANCELLED" ? (n(), d("div", ct, [
417
+ o[17] || (o[17] = s("div", { class: "fm-typo-en-body-md-600" }, "Import cancelled", -1)),
418
+ s("div", mt, r(t(e).summary.completed) + " rows were completed before cancellation. ", 1)
419
+ ])) : c("", !0)
420
+ ], 64)) : (n(), d(B, { key: 1 }, [
421
+ o[6] || (o[6] = Te('<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>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>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)),
422
+ u(p, {
423
+ modelValue: t(_).mode,
424
+ "onUpdate:modelValue": o[0] || (o[0] = (l) => t(_).mode = l),
425
+ label: "Import mode",
426
+ items: R
427
+ }, null, 8, ["modelValue"]),
428
+ s("div", Me, [
429
+ u(_e, null, {
430
+ "menu-button": S(() => [
431
+ u(g, {
432
+ variant: "tertiary",
433
+ icon: "download",
434
+ label: "Download template"
435
+ })
436
+ ]),
437
+ default: S(() => [
438
+ (n(), d(B, null, q(D, (l) => u(V, {
439
+ key: l.value,
440
+ icon: l.icon,
441
+ label: l.label,
442
+ selectable: "",
443
+ onClick: (yt) => de(l.value)
444
+ }, null, 8, ["icon", "label", "onClick"])), 64))
445
+ ]),
446
+ _: 1
447
+ })
448
+ ]),
449
+ t(b) ? (n(), d("div", Ve, [
450
+ u(g, {
451
+ variant: "tertiary",
452
+ "prepend-icon": "attach_file"
453
+ }),
454
+ s("p", Oe, r(t(b).name), 1),
455
+ s("label", Ye, [
456
+ u(g, {
457
+ variant: "plain",
458
+ label: t(m)("Replace File")
459
+ }, null, 8, ["label"]),
460
+ s("input", {
461
+ id: "member-import-file",
462
+ accept: ".csv, .xlsx",
463
+ class: "hidden",
464
+ type: "file",
465
+ onChange: ie
466
+ }, null, 32)
467
+ ])
468
+ ])) : (n(), w(ge, {
469
+ key: 0,
470
+ accept: ".csv, .xlsx",
471
+ "max-file-size": 5e6,
472
+ onFileUpload: o[1] || (o[1] = (l) => b.value = l)
473
+ })),
474
+ u(G, {
475
+ "model-value": t(C),
476
+ value: "import-warnings",
477
+ label: "I have read and understand these import rules.",
478
+ "onUpdate:modelValue": o[2] || (o[2] = (l) => C.value = l)
479
+ }, null, 8, ["model-value"])
480
+ ], 64)),
481
+ t(i) ? (n(), w(Ee, {
482
+ key: 3,
483
+ state: "error",
484
+ text: t(i)
485
+ }, null, 8, ["text"])) : c("", !0),
486
+ s("div", pt, [
487
+ t(e) && ["INVALID", "STOPPED", "COMPLETED", "CANCELLED"].includes(t(e).status) ? (n(), w(g, {
488
+ key: 0,
489
+ variant: "tertiary",
490
+ icon: "download",
491
+ label: "Download result",
492
+ disabled: t(e).summary.total === 0,
493
+ onClick: be
494
+ }, null, 8, ["disabled"])) : c("", !0),
495
+ ((K = t(e)) == null ? void 0 : K.status) === "INVALID" ? (n(), w(g, {
496
+ key: 1,
497
+ variant: "tertiary",
498
+ label: "Choose another file",
499
+ onClick: pe
500
+ })) : c("", !0),
501
+ u(ke),
502
+ u(g, {
503
+ variant: "secondary",
504
+ label: ((X = t(e)) == null ? void 0 : X.status) === "CANCELLING" ? "Cancelling…" : t(e) && ["COMPLETED", "CANCELLED", "INVALID"].includes(t(e).status) ? "Close" : "Cancel",
505
+ disabled: t(y) || ((Z = t(e)) == null ? void 0 : Z.status) === "CANCELLING",
506
+ onClick: ye
507
+ }, null, 8, ["label", "disabled"]),
508
+ t(e) ? c("", !0) : (n(), w(g, {
509
+ key: 2,
510
+ label: "Validate file",
511
+ disabled: !t(b) || !t(C) || t(y),
512
+ onClick: ue
513
+ }, null, 8, ["disabled"])),
514
+ ((ee = t(e)) == null ? void 0 : ee.status) === "READY" ? (n(), w(g, {
515
+ key: 3,
516
+ label: "Start import",
517
+ disabled: !t(Y) || t(y),
518
+ onClick: fe
519
+ }, null, 8, ["disabled"])) : c("", !0),
520
+ ((te = t(e)) == null ? void 0 : te.status) === "STOPPED" ? (n(), w(g, {
521
+ key: 4,
522
+ label: "Retry import",
523
+ disabled: t(y) || !t(e).file,
524
+ onClick: ve
525
+ }, null, 8, ["disabled"])) : c("", !0)
526
+ ])
527
+ ]);
528
+ };
529
+ }
530
+ }), vt = { class: "px-24 flex flex-col gap-y-16 pb-24" }, xt = /* @__PURE__ */ J({
531
+ __name: "Member",
532
+ setup(H) {
533
+ const m = Ae(), { t: N } = le(), b = ne(), e = [
534
+ {
535
+ label: N("connect.loyalty.member.tabs.member_list"),
536
+ value: k["$connect-LOYALTY_MEMBER_LIST"]
537
+ }
538
+ ], i = P(() => {
539
+ var R, E, D;
540
+ const _ = m.currentRoute.value.name;
541
+ return _ == k["$connect-LOYALTY_MEMBER_IMPORT_HISTORY"] ? {
542
+ title: "Import history",
543
+ description: void 0,
544
+ backButton: !0,
545
+ onBackButton: async () => {
546
+ await m.push({
547
+ name: k["$connect-LOYALTY_MEMBER_LIST"]
548
+ });
549
+ }
550
+ } : _ != k["$connect-LOYALTY_MEMBER_TRANSACTIONS"] ? {
551
+ title: v.value.label,
552
+ description: void 0
553
+ } : (v.value = e[1], {
554
+ backButton: !0,
555
+ title: N("connect.loyalty.member.title"),
556
+ description: `${(R = C.value) == null ? void 0 : R.name} (${(E = C.value) == null ? void 0 : E._id}) (${(D = C.value) == null ? void 0 : D.phoneNumber})`,
557
+ onBackButton: async () => {
558
+ await m.push({ name: k["$connect-LOYALTY_MEMBER_LIST"] });
559
+ }
560
+ });
561
+ }), v = h(
562
+ e.find((_) => _.value === m.currentRoute.value.name) ?? e[0]
563
+ ), C = h(), I = P(
564
+ () => m.currentRoute.value.name === k["$connect-LOYALTY_MEMBER_TRANSACTIONS"] || m.currentRoute.value.name === k["$connect-LOYALTY_MEMBER_IMPORT_HISTORY"]
565
+ ), T = P(
566
+ () => m.currentRoute.value.name !== k["$connect-LOYALTY_MEMBER_TRANSACTIONS"]
567
+ ), y = P(
568
+ () => m.currentRoute.value.name !== k["$connect-LOYALTY_MEMBER_IMPORT_HISTORY"]
569
+ );
570
+ async function O(_) {
571
+ await m.push({ name: _ });
572
+ }
573
+ async function A() {
574
+ b.open({
575
+ title: "Import members",
576
+ closeButton: !1,
577
+ dismissAway: !1,
578
+ contentComponent: ft
579
+ });
580
+ }
581
+ async function x() {
582
+ await m.push({
583
+ name: k["$connect-LOYALTY_MEMBER_IMPORT_HISTORY"]
584
+ });
585
+ }
586
+ return Re(
587
+ () => m.currentRoute.value.name,
588
+ async (_) => {
589
+ v.value = e.find((E) => E.value === _) ?? e[0];
590
+ const R = m.currentRoute.value.params.id;
591
+ R && (C.value = await L.readById(R));
592
+ },
593
+ { immediate: !0 }
594
+ ), (_, R) => {
595
+ const E = f("FmButton"), D = f("FmPageHead"), M = f("FmTabs"), Y = f("RouterView");
596
+ return n(), d(B, null, [
597
+ u(D, {
598
+ title: t(i).title,
599
+ description: t(i).description,
600
+ "back-button": t(i).backButton,
601
+ "onClick:back": t(i).onBackButton
602
+ }, Le({ _: 2 }, [
603
+ t(T) ? {
604
+ name: "append",
605
+ fn: S(() => [
606
+ u(Pe, null, {
607
+ default: S(() => [
608
+ t(y) ? (n(), w(E, {
609
+ key: 0,
610
+ label: "Import history",
611
+ "prepend-icon": "work_history",
612
+ variant: "tertiary",
613
+ onClick: x
614
+ })) : c("", !0),
615
+ u(E, {
616
+ label: t(N)("connect.loyalty.member.import"),
617
+ "prepend-icon": "download",
618
+ onClick: A
619
+ }, null, 8, ["label"])
620
+ ]),
621
+ _: 1
622
+ })
623
+ ]),
624
+ key: "0"
625
+ } : void 0
626
+ ]), 1032, ["title", "description", "back-button", "onClick:back"]),
627
+ s("div", vt, [
628
+ t(I) ? c("", !0) : (n(), w(M, {
629
+ key: 0,
630
+ "model-value": t(v).value,
631
+ items: e,
632
+ "onUpdate:modelValue": O
633
+ }, null, 8, ["model-value"])),
634
+ u(Y)
635
+ ])
636
+ ], 64);
637
+ };
638
+ }
639
+ });
640
+ export {
641
+ xt as default
642
+ };