@feedmepos/mf-connect 0.1.58-prod → 0.1.60-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 (129) hide show
  1. package/dist/Analytic-CB0xAr9Q.js +427 -0
  2. package/dist/App-fp_3oll7.js +4630 -0
  3. package/dist/Bin-CPEbn14A.js +166 -0
  4. package/dist/Broadcast-jKp2iB8c.js +233 -0
  5. package/dist/CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CmJG893h.js +121 -0
  6. package/dist/Card-BaPJkgd2.js +911 -0
  7. package/dist/ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js +97 -0
  8. package/dist/Collections-Bqsg-ON3.js +458 -0
  9. package/dist/Credit-C9zIva1h.js +228 -0
  10. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-Du7fRSZC.js +128 -0
  11. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-CSMV8OwA.js +2194 -0
  12. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-Doyw0pvU.js +348 -0
  13. package/dist/Experience-CCI_oesa.js +229 -0
  14. package/dist/FileSaver.min-NlMItPOc.js +74 -0
  15. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js +129 -0
  16. package/dist/Game-CRMVz1JP.js +284 -0
  17. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-D1KQpDGg.js +144 -0
  18. package/dist/Index-szNiSnjR.js +259 -0
  19. package/dist/JsonViewer-v8_C7l5N.js +87 -0
  20. package/dist/LottieAnimation.vue_vue_type_script_setup_true_lang-CyGJxUol.js +18737 -0
  21. package/dist/MainLayout-B1aJoR95.js +41 -0
  22. package/dist/Marketing-AvEiNiD9.js +319 -0
  23. package/dist/Member-DIZwt6Hh.js +279 -0
  24. package/dist/MemberList-dxteIRWn.js +1607 -0
  25. package/dist/MemberOverview-wL_ailso.js +58 -0
  26. package/dist/MemberTransactions-Q3phmXfI.js +45 -0
  27. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-BLk8rX-T.js +60553 -0
  28. package/dist/Mission-CZjySlcS.js +302 -0
  29. package/dist/Overview-BXbWEDy3.js +1079 -0
  30. package/dist/Point-CgjNc_Qn.js +232 -0
  31. package/dist/Promotion-COYo3qLi.js +289 -0
  32. package/dist/Queue-BLIStJth.js +260 -0
  33. package/dist/Record-BWoTvVEE.js +341 -0
  34. package/dist/Reward-Dq6GxHMP.js +442 -0
  35. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-CR1feHth.js +150 -0
  36. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-DuYYfbOH.js +1763 -0
  37. package/dist/Segment-CUfn6k5R.js +882 -0
  38. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-CxycOqNJ.js +181 -0
  39. package/dist/SendCollectionSheet.vue_vue_type_script_setup_true_lang-C7jqrfEj.js +188 -0
  40. package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-CMmdbYH4.js +147 -0
  41. package/dist/Setting-CC5AiQSy.js +1928 -0
  42. package/dist/SettingAdvertisements-DHQTaMC1.js +262 -0
  43. package/dist/Store-CEgv5aOD.js +1842 -0
  44. package/dist/StoreRewards-Dtzk_YG2.js +423 -0
  45. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-Cwt8pmoM.js +995 -0
  46. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-BEU2u1-a.js +139 -0
  47. package/dist/Tier-1xqQvWzc.js +895 -0
  48. package/dist/Title-Da-G8plz.js +566 -0
  49. package/dist/Transaction-B0vuVZFZ.js +39 -0
  50. package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-e4-wNfrg.js +130 -0
  51. package/dist/Voucher-DLFjkXLu.js +384 -0
  52. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-5X7dGFD9.js +419 -0
  53. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-BPTrvEwa.js +56 -0
  54. package/dist/_commonjsHelpers-BkfeUUK-.js +28 -0
  55. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
  56. package/dist/app-Do_C3F_N.js +7094 -0
  57. package/dist/app-o7Kvv5aK.js +57962 -0
  58. package/dist/app-wDQR6dpb.js +39 -0
  59. package/dist/app.js +6 -0
  60. package/dist/business-BDi-QTa5.js +82 -0
  61. package/dist/campaign-BHqizYy6.js +1810 -0
  62. package/dist/campaign-CpzFl8Vr.js +4 -0
  63. package/dist/campaign-DNXI3K9c.js +94 -0
  64. package/dist/campaign.enum-BXDwYoeA.js +20 -0
  65. package/dist/campaign.fn-Rws4mJa5.js +758 -0
  66. package/dist/collectible.enum-cMc4fL1T.js +19 -0
  67. package/dist/collection.fn-F8FZ7Dnr.js +26 -0
  68. package/dist/dto-CAtf1jq0.js +216 -0
  69. package/dist/effect-Dhg1ZIrL.js +78 -0
  70. package/dist/email-addresses-BZJZwglQ.js +705 -0
  71. package/dist/export-B6yvRuct.js +97 -0
  72. package/dist/feedme.ico +0 -0
  73. package/dist/helper-VoErinsY.js +71 -0
  74. package/dist/index-B0Pzwzkd.js +31 -0
  75. package/dist/index-Bq6FwMwW.js +32 -0
  76. package/dist/index-BvE6Sbog.js +3 -0
  77. package/dist/index-BysJoGFD.js +146 -0
  78. package/dist/index-C8m_F_I4.js +121 -0
  79. package/dist/index-CQZinjc9.js +54 -0
  80. package/dist/index-Cq7s1Pk2.js +76 -0
  81. package/dist/index-CuvNtC_M.js +61 -0
  82. package/dist/index-DOGrOlB8.js +8859 -0
  83. package/dist/index-Di23nMJ7.js +38 -0
  84. package/dist/index-Dkyb4P6T.js +30076 -0
  85. package/dist/index-DvZiQOtl.js +3077 -0
  86. package/dist/index-Ved5V90A.js +2155 -0
  87. package/dist/index-d4A3r8kv.js +32269 -0
  88. package/dist/index-vh86FiIQ.js +10 -0
  89. package/dist/index-y7IqG-tl.js +44 -0
  90. package/dist/index.esm2017-CRTpUsW5.js +3069 -0
  91. package/dist/loading-CoUrS63J.js +71 -0
  92. package/dist/lodash-B5I3zXaY.js +3678 -0
  93. package/dist/membership-BiQwBHAA.js +235 -0
  94. package/dist/moment-D7p2TMB-.js +2583 -0
  95. package/dist/money-CA3gpWD3.js +15 -0
  96. package/dist/number-CgmVpwHm.js +12 -0
  97. package/dist/object-qECH92oz.js +26 -0
  98. package/dist/objectId-dwaoBfJX.js +7 -0
  99. package/dist/objectid-C80eoTvt.js +145 -0
  100. package/dist/plugins-BkWtR_R5.js +208 -0
  101. package/dist/reward-D7SKofYj.js +36 -0
  102. package/dist/rule-Cpxty5PH.js +1951 -0
  103. package/dist/rule-builder-d_TMgXEC.js +102 -0
  104. package/dist/style.css +4 -0
  105. package/dist/template-BB7bab5R.js +190 -0
  106. package/dist/tier-BJDhpH6X.js +4 -0
  107. package/dist/tiers/tier=1.png +0 -0
  108. package/dist/tiers/tier=2.png +0 -0
  109. package/dist/tiers/tier=3.png +0 -0
  110. package/dist/tiers/tier=4.png +0 -0
  111. package/dist/timezone-Dj3UaenF.js +1151 -0
  112. package/dist/titles/type=diamond.png +0 -0
  113. package/dist/titles/type=drinks.png +0 -0
  114. package/dist/titles/type=food.png +0 -0
  115. package/dist/titles/type=heart.png +0 -0
  116. package/dist/titles/type=medal.png +0 -0
  117. package/dist/titles/type=spend.png +0 -0
  118. package/dist/titles/type=thank-you.png +0 -0
  119. package/dist/titles/type=thumbs-up.png +0 -0
  120. package/dist/titles/type=years.png +0 -0
  121. package/dist/trigger-ZVR5eR1H.js +144 -0
  122. package/dist/tslib.es6-BCqqvLQ_.js +44 -0
  123. package/dist/type_drinks-D6jnpvwV.js +4 -0
  124. package/dist/usePagination-Ds-cuHop.js +223 -0
  125. package/dist/user-DjRqnFsC.js +54 -0
  126. package/dist/vue-i18n-BlCNfIcP.js +2365 -0
  127. package/dist/xlsx-CtNr_GAa.js +15491 -0
  128. package/dist/zod-Bg2FbC-D.js +90 -0
  129. package/package.json +1 -1
@@ -0,0 +1,41 @@
1
+ import { defineComponent as n, openBlock as o, createElementBlock as a, createVNode as c, unref as e, ref as m, resolveComponent as u, normalizeClass as _, createBlock as p, createCommentVNode as h, withDirectives as f, createElementVNode as d, vShow as w } from "vue";
2
+ import { _ as v, S as x } from "./LottieAnimation.vue_vue_type_script_setup_true_lang-CyGJxUol.js";
3
+ import { u as r } from "./app-wDQR6dpb.js";
4
+ import { useRoute as g } from "vue-router";
5
+ const S = { class: "bg-white w-full flex min-h-[calc(100svh-56px)] items-center" }, V = /* @__PURE__ */ n({
6
+ __name: "Splash",
7
+ setup(l) {
8
+ return (s, t) => (o(), a("div", S, [
9
+ c(v, {
10
+ class: "flex-1",
11
+ json: e(x),
12
+ width: 100,
13
+ height: 100
14
+ }, null, 8, ["json"])
15
+ ]));
16
+ }
17
+ }), N = /* @__PURE__ */ n({
18
+ __name: "MainLayout",
19
+ setup(l) {
20
+ const s = g(), t = m(s.query.showHeader !== "false");
21
+ return (b, k) => {
22
+ const i = u("RouterView");
23
+ return o(), a("div", {
24
+ class: _([
25
+ "bg-fm-color-neutral-white w-full xs:overflow-y-scroll",
26
+ e(t) ? "min-h-[calc(100svh-56px)] xs:h-[calc(100svh-56px)]" : "min-h-screen"
27
+ ])
28
+ }, [
29
+ e(r)().isGlobalLoading == !0 ? (o(), p(V, { key: 0 })) : h("", !0),
30
+ f(d("div", null, [
31
+ c(i)
32
+ ], 512), [
33
+ [w, e(r)().isGlobalLoading == !1]
34
+ ])
35
+ ], 2);
36
+ };
37
+ }
38
+ });
39
+ export {
40
+ N as default
41
+ };
@@ -0,0 +1,319 @@
1
+ import { openBlock as m, createElementBlock as p, defineComponent as z, ref as S, onMounted as Y, computed as H, h as J, resolveComponent as c, Fragment as x, createVNode as i, unref as r, createElementVNode as s, withCtx as F, renderList as $, createBlock as B, toDisplayString as f, createCommentVNode as j } from "vue";
2
+ import { _ as q } from "./campaign-CpzFl8Vr.js";
3
+ import { components as G } from "@feedmepos/ui-library";
4
+ import { p as X } from "./plugins-BkWtR_R5.js";
5
+ import { u as Q } from "./loading-CoUrS63J.js";
6
+ import { defineStore as W } from "pinia";
7
+ import { F as C } from "./index-Di23nMJ7.js";
8
+ import { useCoreStore as Z } from "@feedmepos/mf-common";
9
+ import { g as y, S as ee, b as te } from "./index-Dkyb4P6T.js";
10
+ import { _ as ne } from "./_plugin-vue_export-helper-CHgC5LLL.js";
11
+ import { u as ae } from "./campaign-DNXI3K9c.js";
12
+ import { h as oe } from "./moment-D7p2TMB-.js";
13
+ import { u as re } from "./vue-i18n-BlCNfIcP.js";
14
+ var se = { authUrl: "https://portal-v2.feedmeapi.com/", slackWebhookUrl: "https://hooks.slack.com/services/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", appUrl: "member.feedme.cc", crmUrl: "crm.feedme.cc", paymentPortalUrl: "https://portal.feedme.cc/payment/payout-account", licensePortalUrl: "https://license.feedme.cc/", marketingV1Portal: "https://marketing-v1.feedme.cc" };
15
+ const h = () => {
16
+ const o = ee.getBusinessId();
17
+ if (!o) throw new Error("Invalid business ID");
18
+ return te(`businesses/${o}/marketing-materials/`, {
19
+ url: se.backendUrl,
20
+ noIdRequired: !0
21
+ });
22
+ }, L = {
23
+ async read() {
24
+ return y(await h().get(""));
25
+ },
26
+ async createMarketing(o) {
27
+ return y(await h().post("", o));
28
+ },
29
+ // add id
30
+ async updateMarketing(o, t) {
31
+ return y(
32
+ await h().put(o, t)
33
+ );
34
+ },
35
+ async deleteMarketing(o) {
36
+ return y(await h().delete(o));
37
+ }
38
+ }, I = W("mf-connect-marketing", {
39
+ state: () => {
40
+ var o, t;
41
+ return {
42
+ marketing: [],
43
+ defaultMarketing: {
44
+ _id: void 0,
45
+ business: ((t = (o = Z().currentBusiness) == null ? void 0 : o.value) == null ? void 0 : t._id) ?? "",
46
+ name: "",
47
+ campaign: null,
48
+ keywords: "",
49
+ image: "",
50
+ headline: {
51
+ content: "",
52
+ key: void 0
53
+ },
54
+ assets: [
55
+ {
56
+ platform: C.enum.FACEBOOK,
57
+ contents: [
58
+ {
59
+ type: "POST",
60
+ size: {
61
+ width: 1920,
62
+ height: 1080
63
+ },
64
+ images: []
65
+ },
66
+ {
67
+ type: "STORY",
68
+ size: {
69
+ width: 1080,
70
+ height: 1920
71
+ },
72
+ images: []
73
+ }
74
+ ]
75
+ },
76
+ {
77
+ platform: C.enum.INSTAGRAM,
78
+ contents: [
79
+ {
80
+ type: "POST",
81
+ size: {
82
+ width: 1080,
83
+ height: 1080
84
+ },
85
+ images: []
86
+ },
87
+ {
88
+ type: "STORY",
89
+ size: {
90
+ width: 1080,
91
+ height: 1920
92
+ },
93
+ images: []
94
+ },
95
+ {
96
+ type: "REEL",
97
+ size: {
98
+ width: 1080,
99
+ height: 1920
100
+ },
101
+ images: []
102
+ }
103
+ ]
104
+ },
105
+ {
106
+ platform: C.enum.BRAND_APP,
107
+ contents: [
108
+ {
109
+ type: "IMAGE",
110
+ size: {
111
+ width: 1080,
112
+ height: 1920
113
+ },
114
+ images: []
115
+ }
116
+ ]
117
+ }
118
+ ],
119
+ captions: [{ language: "en", content: "" }]
120
+ }
121
+ };
122
+ },
123
+ actions: {
124
+ async readMarketingMaterial() {
125
+ const o = await L.read();
126
+ this.marketing = o;
127
+ }
128
+ },
129
+ getters: {
130
+ state(o) {
131
+ return o;
132
+ }
133
+ }
134
+ }), ie = {};
135
+ function le(o, t) {
136
+ return m(), p("div");
137
+ }
138
+ const ce = /* @__PURE__ */ ne(ie, [["render", le]]), me = { class: "px-24 flex flex-col gap-y-16" }, de = { class: "flex items-center justify-between w-full" }, pe = { class: "space-y-8" }, ue = { class: "fm-typo-en-body-lg-600" }, ge = { class: "fm-typo-en-body-lg-600" }, fe = { key: 0 }, ye = { class: "fm-typo-en-title-sm-800" }, he = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary w-4/6 text-center" }, Ve = /* @__PURE__ */ z({
139
+ __name: "Marketing",
140
+ setup(o) {
141
+ const { t } = re(), O = {
142
+ label: t("connect.marketing.create"),
143
+ value: "create",
144
+ isPrimary: !0,
145
+ prependIcon: "add"
146
+ }, k = S(!1), _ = I(), b = ae(), { global: N, minor: U } = Q;
147
+ Y(async () => {
148
+ await N(async () => {
149
+ await b.read(), await _.readMarketingMaterial();
150
+ });
151
+ });
152
+ const d = H(() => _.marketing.filter(
153
+ (n) => n.name.includes(l.value.searchKey.toLowerCase())
154
+ )), u = S(
155
+ I().defaultMarketing
156
+ ), D = [
157
+ {
158
+ header: t("connect.marketing.table.name"),
159
+ accessorFn: (n) => n.name
160
+ },
161
+ {
162
+ header: t("connect.marketing.table.campaign"),
163
+ accessorFn: (n) => {
164
+ var e;
165
+ return n.campaign === null || n.campaign === void 0 ? "-" : (e = b.campaigns.all.find(
166
+ (v) => v._id === n.campaign
167
+ )) == null ? void 0 : e.name;
168
+ }
169
+ },
170
+ {
171
+ header: t("connect.marketing.table.createdDate"),
172
+ accessorFn: (n) => {
173
+ const e = new Date(
174
+ parseInt(n._id.toString().substring(0, 8), 16) * 1e3
175
+ );
176
+ return oe(e).format("DD MMM YYYY");
177
+ }
178
+ },
179
+ {
180
+ header: t("connect.marketing.table.actions"),
181
+ cell(n) {
182
+ return J(G.FmButton, {
183
+ variant: "tertiary",
184
+ icon: "delete",
185
+ iconColor: "neutral-gray-400",
186
+ onClick: (e) => {
187
+ e.stopPropagation(), P(n.row.original);
188
+ }
189
+ });
190
+ }
191
+ }
192
+ ];
193
+ async function P(n) {
194
+ await X.remove(
195
+ t("connect.marketing.delete.confirm", { name: n.name })
196
+ ) && await U(
197
+ async () => {
198
+ await L.deleteMarketing(n._id), await _.readMarketingMaterial();
199
+ },
200
+ {
201
+ message: t("connect.marketing.delete.removing", { name: n.name }),
202
+ successMessage: t("connect.marketing.delete.success", {
203
+ name: n.name
204
+ })
205
+ }
206
+ );
207
+ }
208
+ async function g(n) {
209
+ n ? u.value = JSON.parse(JSON.stringify(n)) : u.value = JSON.parse(
210
+ JSON.stringify(I().defaultMarketing)
211
+ ), k.value = !0;
212
+ }
213
+ const l = S({
214
+ searchKey: ""
215
+ });
216
+ return (n, e) => {
217
+ const v = c("FmPageHead"), V = c("FmSearch"), E = c("FmTable"), T = c("FmButton"), K = c("FmListItem"), A = c("FmList"), R = c("FmCard");
218
+ return m(), p(x, null, [
219
+ i(v, {
220
+ title: r(t)("connect.marketing.title"),
221
+ class: "xs:hidden",
222
+ actions: r(d).length > 0 ? [O] : [],
223
+ "onClick:action": e[0] || (e[0] = () => g())
224
+ }, null, 8, ["title", "actions"]),
225
+ s("div", me, [
226
+ i(V, {
227
+ modelValue: l.value.searchKey,
228
+ "onUpdate:modelValue": e[1] || (e[1] = (a) => l.value.searchKey = a),
229
+ placeholder: r(t)("connect.marketing.search"),
230
+ class: "hidden xs:block border-b-2 border-fm-color-neutral-gray-100",
231
+ collapsible: ""
232
+ }, null, 8, ["modelValue", "placeholder"]),
233
+ i(ce, {
234
+ modelValue: u.value,
235
+ "onUpdate:modelValue": e[2] || (e[2] = (a) => u.value = a),
236
+ "is-open": k.value,
237
+ "onUpdate:isOpen": e[3] || (e[3] = (a) => k.value = a)
238
+ }, null, 8, ["modelValue", "is-open"]),
239
+ r(d).length > 0 ? (m(), p(x, { key: 0 }, [
240
+ s("div", de, [
241
+ i(V, {
242
+ modelValue: l.value.searchKey,
243
+ "onUpdate:modelValue": e[4] || (e[4] = (a) => l.value.searchKey = a),
244
+ class: "xs:hidden",
245
+ placeholder: r(t)("connect.marketing.search"),
246
+ collapsible: ""
247
+ }, null, 8, ["modelValue", "placeholder"])
248
+ ]),
249
+ i(E, {
250
+ class: "xs:hidden",
251
+ "row-data": r(d),
252
+ "column-defs": D,
253
+ "search-value": l.value.searchKey,
254
+ "column-filter": [],
255
+ onRowClick: e[5] || (e[5] = (a) => g(a.original)),
256
+ "hide-footer": !0
257
+ }, null, 8, ["row-data", "search-value"]),
258
+ i(A, { class: "hidden xs:flex flex-col mx-[-24px]" }, {
259
+ default: F(() => [
260
+ (m(!0), p(x, null, $(r(d).filter(
261
+ (a) => a.name.toLowerCase().includes(l.value.searchKey.toLowerCase())
262
+ ), (a) => (m(), B(K, {
263
+ key: a._id.toString(),
264
+ onClick: (w) => g(a),
265
+ class: "py-12 px-16 flex items-center justify-between border-b border-fm-color-neutral-gray-100"
266
+ }, {
267
+ default: F(() => {
268
+ var w;
269
+ return [
270
+ s("div", pe, [
271
+ s("div", ue, f(a.name), 1),
272
+ s("div", ge, f(a.campaign === null || a.campaign === void 0 ? "-" : (w = r(b).campaigns.all.find(
273
+ (M) => M._id === a.campaign
274
+ )) == null ? void 0 : w.name), 1)
275
+ ]),
276
+ i(T, {
277
+ icon: "delete",
278
+ "icon-color": "neutral-gray-400",
279
+ variant: "tertiary",
280
+ onClick: (M) => (M.stopPropagation(), P(a))
281
+ }, null, 8, ["onClick"])
282
+ ];
283
+ }),
284
+ _: 2
285
+ }, 1032, ["onClick"]))), 128))
286
+ ]),
287
+ _: 1
288
+ }),
289
+ r(d).length == 0 ? (m(), p("div", fe, [...e[7] || (e[7] = [
290
+ s("div", { class: "text-fm-color-typo-secondary fm-typo-en-body-md-600" }, " No results found ", -1)
291
+ ])])) : j("", !0)
292
+ ], 64)) : (m(), B(R, {
293
+ key: 1,
294
+ variant: "outlined",
295
+ class: "w-full justify-center items-center flex flex-col p-[24px] gap-[24px]"
296
+ }, {
297
+ default: F(() => [
298
+ e[8] || (e[8] = s("img", {
299
+ src: q,
300
+ class: "w-[150px]"
301
+ }, null, -1)),
302
+ s("p", ye, f(r(t)("connect.marketing.emptyState.title")), 1),
303
+ s("p", he, f(r(t)("connect.marketing.emptyState.description")), 1),
304
+ i(T, {
305
+ label: r(t)("connect.marketing.emptyState.action"),
306
+ "prepend-icon": "add",
307
+ onClick: e[6] || (e[6] = (a) => g())
308
+ }, null, 8, ["label"])
309
+ ]),
310
+ _: 1
311
+ }))
312
+ ])
313
+ ], 64);
314
+ };
315
+ }
316
+ });
317
+ export {
318
+ Ve as default
319
+ };
@@ -0,0 +1,279 @@
1
+ import { defineComponent as L, ref as F, watch as P, resolveComponent as m, openBlock as x, createElementBlock as h, Fragment as R, createElementVNode as b, createVNode as u, unref as n, withCtx as M, renderList as $, createBlock as D, toDisplayString as O, normalizeClass as U, computed as Y, createCommentVNode as q } from "vue";
2
+ import "./index-BvE6Sbog.js";
3
+ import { useDialogChild as H, FmButtonVariant as S, useDialog as J, useSnackbar as Q } from "@feedmepos/ui-library";
4
+ import { u as N } from "./vue-i18n-BlCNfIcP.js";
5
+ import { c as A } from "./index-DvZiQOtl.js";
6
+ import "./index-DOGrOlB8.js";
7
+ import "./index-Ved5V90A.js";
8
+ import "./index-Di23nMJ7.js";
9
+ import "./index-CQZinjc9.js";
10
+ import { u as g, w as j } from "./xlsx-CtNr_GAa.js";
11
+ import { F as z } from "./FileSaver.min-NlMItPOc.js";
12
+ import { useCoreStore as G } from "@feedmepos/mf-common";
13
+ import { useRouter as W } from "vue-router";
14
+ import { m as I } from "./index-Cq7s1Pk2.js";
15
+ import { R as E } from "./app-Do_C3F_N.js";
16
+ const K = { class: "space-y-8 mb-10" }, X = { class: "flex justify-end" }, Z = {
17
+ key: 1,
18
+ class: /* @__PURE__ */ U([
19
+ "flex items-center",
20
+ "border border-fm-color-neutral-gray-300",
21
+ "p-16 space-x-16 rounded-md"
22
+ ])
23
+ }, ee = { class: "fm-typo-en-body-lg-400 flex-1 truncate" }, te = /* @__PURE__ */ L({
24
+ __name: "ImportMemberDialog",
25
+ setup(V) {
26
+ const { t: a } = N(), { emitData: _ } = H(), c = F(null), v = F(null), w = F({
27
+ resetCollectionExpiryBalance: !0
28
+ }), s = [
29
+ "Id",
30
+ "Name",
31
+ "Phone",
32
+ "Email",
33
+ "Gender",
34
+ "CardNo",
35
+ "Birthday",
36
+ "Credit",
37
+ "CreditExpiryDate",
38
+ "Exp",
39
+ "Point",
40
+ "Tier",
41
+ // 'Titles',
42
+ "TotalTransaction",
43
+ "AvgSpent",
44
+ "TotalSpent",
45
+ "LastVisit",
46
+ "Feedback",
47
+ "LastSeasonTierEarned",
48
+ "LastSeasonPointEarned",
49
+ "JoinedAt",
50
+ "JoinedAtLocation",
51
+ "VisitFrequency"
52
+ ], p = [
53
+ {
54
+ label: "CSV",
55
+ icon: "csv",
56
+ value: "csv"
57
+ /* csv */
58
+ },
59
+ {
60
+ label: "Excel",
61
+ icon: "description",
62
+ value: "xlsx"
63
+ /* xlsx */
64
+ }
65
+ ];
66
+ async function d(i) {
67
+ var t, f;
68
+ c.value = ((f = (t = i.target) == null ? void 0 : t.files) == null ? void 0 : f[0]) ?? null;
69
+ }
70
+ async function y(i) {
71
+ switch (i) {
72
+ case "csv":
73
+ C();
74
+ break;
75
+ case "xlsx":
76
+ T();
77
+ break;
78
+ }
79
+ }
80
+ function C() {
81
+ const i = new Blob([s.join(",")], {
82
+ type: "text/csv;charset=utf-8;"
83
+ });
84
+ z.saveAs(i, "ImportMemberTemplate.csv");
85
+ }
86
+ function T() {
87
+ const i = g.aoa_to_sheet([s]), t = g.book_new();
88
+ g.book_append_sheet(t, i, "Sheet1"), j(t, "ImportMemberTemplate.xlsx");
89
+ }
90
+ return P(c, () => {
91
+ _({ file: c.value, config: w.value });
92
+ }), (i, t) => {
93
+ const f = m("FmSwitch"), k = m("FmButton"), o = m("FmMenuItem"), l = m("FmMenu"), r = m("FmDropField");
94
+ return x(), h(R, null, [
95
+ b("div", K, [
96
+ t[3] || (t[3] = b("div", { class: "fm-typo-en-body-lg-600" }, "Advanced Setting", -1)),
97
+ u(f, {
98
+ "model-value": n(w).resetCollectionExpiryBalance ?? !0,
99
+ "onUpdate:modelValue": t[0] || (t[0] = (e) => n(w).resetCollectionExpiryBalance = e),
100
+ label: "Replace Existing Free Credit",
101
+ sublabel: "When enabled, this will clear existing free credit and replace with new values from the import.",
102
+ "label-placement": "right"
103
+ }, null, 8, ["model-value"])
104
+ ]),
105
+ b("div", X, [
106
+ u(l, null, {
107
+ "menu-button": M(() => [
108
+ u(k, {
109
+ variant: "tertiary",
110
+ icon: "download",
111
+ label: "Download Template"
112
+ })
113
+ ]),
114
+ default: M(() => [
115
+ (x(), h(R, null, $(p, (e) => u(o, {
116
+ key: e.value,
117
+ icon: e.icon,
118
+ label: e.label,
119
+ onClick: (B) => y(e.value),
120
+ selectable: ""
121
+ }, null, 8, ["icon", "label", "onClick"])), 64))
122
+ ]),
123
+ _: 1
124
+ })
125
+ ]),
126
+ n(c) ? (x(), h("div", Z, [
127
+ u(k, {
128
+ variant: n(S).Tertiary,
129
+ "prepend-icon": "attach_file"
130
+ }, null, 8, ["variant"]),
131
+ b("p", ee, O(n(c).name), 1),
132
+ b("label", {
133
+ ref_key: "fileLabelRef",
134
+ ref: v,
135
+ htmlFor: "file"
136
+ }, [
137
+ u(k, {
138
+ variant: n(S).Plain,
139
+ label: n(a)("Replace File"),
140
+ onClick: t[2] || (t[2] = () => {
141
+ var e;
142
+ return (e = n(v)) == null ? void 0 : e.click();
143
+ })
144
+ }, null, 8, ["variant", "label"]),
145
+ b("input", {
146
+ id: "file",
147
+ accept: ".csv, .xlsx",
148
+ class: "hidden",
149
+ type: "file",
150
+ multiple: "",
151
+ onChange: d
152
+ }, null, 32)
153
+ ], 512)
154
+ ])) : (x(), D(r, {
155
+ key: 0,
156
+ onFileUpload: t[1] || (t[1] = (e) => c.value = e),
157
+ accept: ".csv, .xlsx",
158
+ "max-file-size": 5e6
159
+ }))
160
+ ], 64);
161
+ };
162
+ }
163
+ }), ne = { class: "px-24 flex flex-col gap-y-16 pb-24" }, ye = /* @__PURE__ */ L({
164
+ __name: "Member",
165
+ setup(V) {
166
+ var t, f, k;
167
+ const a = W(), { t: _ } = N(), c = J(), v = Q(), w = G();
168
+ _("connect.loyalty.member.import"), _("connect.navigation.queue");
169
+ const s = [
170
+ {
171
+ label: _("connect.loyalty.member.tabs.member_list"),
172
+ value: E["$connect-LOYALTY_MEMBER_LIST"],
173
+ actions: (k = (f = (t = w.sessionUser) == null ? void 0 : t.value) == null ? void 0 : f.role) != null && k.isAdmin ? [] : []
174
+ }
175
+ ], p = Y(() => {
176
+ var l, r, e;
177
+ return a.currentRoute.value.name != E["$connect-LOYALTY_MEMBER_TRANSACTIONS"] ? {
178
+ title: d.value.label,
179
+ actions: d.value.actions,
180
+ description: void 0
181
+ } : (d.value = s[1], {
182
+ backButton: !0,
183
+ title: _("connect.loyalty.member.title"),
184
+ actions: [],
185
+ description: `${(l = y.value) == null ? void 0 : l.name} (${(r = y.value) == null ? void 0 : r._id}) (${(e = y.value) == null ? void 0 : e.phoneNumber})`,
186
+ onBackButton: async () => {
187
+ await a.push({ name: E["$connect-LOYALTY_MEMBER_LIST"] });
188
+ }
189
+ });
190
+ }), d = F(
191
+ s.find((o) => o.value === a.currentRoute.value.name) ?? s[0]
192
+ ), y = F();
193
+ async function C(o) {
194
+ await a.push({ name: o });
195
+ }
196
+ async function T() {
197
+ c.open({
198
+ title: "Upload File",
199
+ closeButton: !0,
200
+ dismissAway: !1,
201
+ contentComponent: te,
202
+ primaryActions: { text: "Import", close: !1 }
203
+ }).onPrimary(async (o) => {
204
+ if (!o) {
205
+ v.open({
206
+ type: "error",
207
+ title: "Please upload a file"
208
+ });
209
+ return;
210
+ }
211
+ const { file: l, config: r } = o;
212
+ if (!l)
213
+ v.open({
214
+ type: "error",
215
+ title: "Please upload a file"
216
+ });
217
+ else {
218
+ const e = new FormData();
219
+ e.append("file", l), e.append("config", JSON.stringify(r)), await I.import(e), v.open({
220
+ type: "info",
221
+ title: "Import begins soon. Check Queue for updates.",
222
+ action: "View",
223
+ onAction: async () => {
224
+ await a.push({
225
+ name: E["$connect-QUEUE"],
226
+ query: { type: [A.enum.MEMBER_IMPORTED] }
227
+ });
228
+ }
229
+ }), c.close();
230
+ }
231
+ });
232
+ }
233
+ function i(o) {
234
+ switch (o) {
235
+ case "import":
236
+ T();
237
+ break;
238
+ case "queue":
239
+ a.push({
240
+ name: E["$connect-QUEUE"],
241
+ query: { type: [A.enum.MEMBER_IMPORTED] }
242
+ });
243
+ break;
244
+ }
245
+ }
246
+ return P(
247
+ () => a.currentRoute.value.name,
248
+ async (o) => {
249
+ d.value = s.find((r) => r.value === o) ?? s[0];
250
+ const l = a.currentRoute.value.params.id;
251
+ l && (y.value = await I.readById(l)), await a.push({ name: o });
252
+ }
253
+ ), (o, l) => {
254
+ const r = m("FmPageHead"), e = m("FmTabs"), B = m("RouterView");
255
+ return x(), h(R, null, [
256
+ u(r, {
257
+ actions: n(p).actions,
258
+ title: n(p).title,
259
+ description: n(p).description,
260
+ "back-button": n(p).backButton,
261
+ "onClick:back": n(p).onBackButton,
262
+ "onClick:action": i
263
+ }, null, 8, ["actions", "title", "description", "back-button", "onClick:back"]),
264
+ b("div", ne, [
265
+ n(a).currentRoute.value.name != n(E)["$connect-LOYALTY_MEMBER_TRANSACTIONS"] ? (x(), D(e, {
266
+ key: 0,
267
+ "model-value": n(d).value,
268
+ items: s,
269
+ "onUpdate:modelValue": C
270
+ }, null, 8, ["model-value"])) : q("", !0),
271
+ u(B)
272
+ ])
273
+ ], 64);
274
+ };
275
+ }
276
+ });
277
+ export {
278
+ ye as default
279
+ };