@feedmepos/mf-connect 0.1.38-beta.73 → 0.1.38-beta.74

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 (133) hide show
  1. package/package.json +1 -1
  2. package/dist/Analytic-gGjm5ome.js +0 -761
  3. package/dist/App-BDz9mw-6.js +0 -4638
  4. package/dist/AuditLogs-4x90ZjjY.js +0 -1991
  5. package/dist/Bin-Bby2f42O.js +0 -166
  6. package/dist/Broadcast-eYN2AqFC.js +0 -267
  7. package/dist/CampaignTypeDialog.vue_vue_type_script_setup_true_lang-B-fO9-Hb.js +0 -121
  8. package/dist/Card-Cz-pLt7X.js +0 -909
  9. package/dist/ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js +0 -97
  10. package/dist/Collections-CgfXuVA1.js +0 -540
  11. package/dist/Credit-Lc6B2oQ9.js +0 -261
  12. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-Du7fRSZC.js +0 -128
  13. package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-eIoPtgO5.js +0 -58
  14. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-Bm7XTR7o.js +0 -3167
  15. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-Cp5nSLEX.js +0 -351
  16. package/dist/Experience-Ca94IJBt.js +0 -260
  17. package/dist/FileSaver.min-BThLVsSf.js +0 -74
  18. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js +0 -129
  19. package/dist/Game-BYLYDTU9.js +0 -331
  20. package/dist/GenerateMaterial-CUoG6uyI.js +0 -589
  21. package/dist/Grab-DZ_LkTly.js +0 -301
  22. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-CI4kP9ul.js +0 -145
  23. package/dist/Index-BZ2r8x0t.js +0 -259
  24. package/dist/JsonViewer-v8_C7l5N.js +0 -87
  25. package/dist/LottieAnimation.vue_vue_type_script_setup_true_lang-BLKlXW1b.js +0 -18737
  26. package/dist/MainLayout-BfGSSVMW.js +0 -41
  27. package/dist/Marketing-DYg0J1xG.js +0 -145
  28. package/dist/MarketingMaterialEdit-B--Kck7j.js +0 -746
  29. package/dist/Member-By5QEJxn.js +0 -280
  30. package/dist/MemberList-D49bMmGJ.js +0 -1600
  31. package/dist/MemberOverview-wL_ailso.js +0 -58
  32. package/dist/MemberTransactions-Cz9XENK1.js +0 -45
  33. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-IlFjM-Y5.js +0 -60798
  34. package/dist/Mission-Cvl-V7c8.js +0 -335
  35. package/dist/Overview-lu82lUJp.js +0 -1078
  36. package/dist/Point-C65YFhOB.js +0 -263
  37. package/dist/Promotion-DQCrKO6a.js +0 -397
  38. package/dist/Queue-DR5lfSMi.js +0 -259
  39. package/dist/Record-BCt42_VZ.js +0 -341
  40. package/dist/Reward-7aOnjmMm.js +0 -442
  41. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-BPgjr91S.js +0 -149
  42. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-Bp5jnlFr.js +0 -1912
  43. package/dist/Segment-DiYwfb8M.js +0 -881
  44. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-ydM5ypC0.js +0 -181
  45. package/dist/SendCollectionSheet.vue_vue_type_script_setup_true_lang-BRs7pw0l.js +0 -188
  46. package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-DU8AAPFD.js +0 -147
  47. package/dist/Setting-k6xShcs8.js +0 -1999
  48. package/dist/SettingAdvertisements-DQa_jXYM.js +0 -263
  49. package/dist/Store-B6lYBpsm.js +0 -1995
  50. package/dist/StoreRewards-Cqd399q8.js +0 -534
  51. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-Wv_SHwmo.js +0 -1128
  52. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-Bi1o4YAz.js +0 -7005
  53. package/dist/Tier-CXXImaDx.js +0 -969
  54. package/dist/Title-CTxNCmBW.js +0 -567
  55. package/dist/Transaction-DonaHVzF.js +0 -39
  56. package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-DbRVYccO.js +0 -130
  57. package/dist/Voucher-Bso_Mjlg.js +0 -422
  58. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-DNvmaJk9.js +0 -421
  59. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-KHZ3-THo.js +0 -56
  60. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +0 -9
  61. package/dist/app-DKrmktFJ.js +0 -59071
  62. package/dist/app-wDQR6dpb.js +0 -39
  63. package/dist/app.js +0 -7
  64. package/dist/business-Dd73TVX5.js +0 -82
  65. package/dist/campaign-BUQHH4KL.js +0 -100
  66. package/dist/campaign-CpzFl8Vr.js +0 -4
  67. package/dist/campaign-DkJOyF24.js +0 -253
  68. package/dist/campaign.enum-C8vJuDAq.js +0 -26
  69. package/dist/campaign.fn-DJSpfhZH.js +0 -776
  70. package/dist/collectible.enum-D3W0TwoJ.js +0 -19
  71. package/dist/collection.fn-YzgpOmG0.js +0 -26
  72. package/dist/dto-sceHHLGr.js +0 -222
  73. package/dist/duplicateCampaign-CDulKxgJ.js +0 -51
  74. package/dist/effect-BSgfR9iB.js +0 -89
  75. package/dist/email-addresses-D_fyxOof.js +0 -705
  76. package/dist/export-OxiqL1B7.js +0 -96
  77. package/dist/feedme.ico +0 -0
  78. package/dist/helper-CzurWUe4.js +0 -86
  79. package/dist/index-BF0hGAkO.js +0 -32
  80. package/dist/index-BGMhsZnB.js +0 -124
  81. package/dist/index-B_QGGlMD.js +0 -54
  82. package/dist/index-BbTHqh58.js +0 -31
  83. package/dist/index-BqQas5Sx.js +0 -2428
  84. package/dist/index-BtMmY44D.js +0 -36
  85. package/dist/index-CAUVTn1I.js +0 -67
  86. package/dist/index-Cg-sBBf_.js +0 -3419
  87. package/dist/index-CuvNtC_M.js +0 -61
  88. package/dist/index-Cyt6eKEF.js +0 -8912
  89. package/dist/index-Dw3ew6qN.js +0 -85
  90. package/dist/index-IBvUTxqC.js +0 -30289
  91. package/dist/index-pkwrUX33.js +0 -28897
  92. package/dist/index-tYmg4eyJ.js +0 -3
  93. package/dist/index-vh86FiIQ.js +0 -10
  94. package/dist/index.esm2017-5xGykkgL.js +0 -3069
  95. package/dist/loading-CvHPT80F.js +0 -215
  96. package/dist/lodash-Q-_FPkpI.js +0 -3678
  97. package/dist/membership-CU-wFWan.js +0 -235
  98. package/dist/moment-D7p2TMB-.js +0 -2583
  99. package/dist/money-CzlfhEoe.js +0 -15
  100. package/dist/number-Bee2M41N.js +0 -12
  101. package/dist/object-qECH92oz.js +0 -26
  102. package/dist/objectId-dwaoBfJX.js +0 -7
  103. package/dist/objectid-DRJQv7AY.js +0 -145
  104. package/dist/plugins-CAdlnev8.js +0 -1817
  105. package/dist/remy-D_Deb3ue.js +0 -13
  106. package/dist/reward-BhlYd0FB.js +0 -36
  107. package/dist/rule-Ccvu41A_.js +0 -1969
  108. package/dist/rule-builder-B968rIyS.js +0 -102
  109. package/dist/style.css +0 -13
  110. package/dist/template-OZfyPJVE.js +0 -188
  111. package/dist/tier-BJDhpH6X.js +0 -4
  112. package/dist/tiers/tier=1.png +0 -0
  113. package/dist/tiers/tier=2.png +0 -0
  114. package/dist/tiers/tier=3.png +0 -0
  115. package/dist/tiers/tier=4.png +0 -0
  116. package/dist/timezone-CopuRbDK.js +0 -1154
  117. package/dist/titles/type=diamond.png +0 -0
  118. package/dist/titles/type=drinks.png +0 -0
  119. package/dist/titles/type=food.png +0 -0
  120. package/dist/titles/type=heart.png +0 -0
  121. package/dist/titles/type=medal.png +0 -0
  122. package/dist/titles/type=spend.png +0 -0
  123. package/dist/titles/type=thank-you.png +0 -0
  124. package/dist/titles/type=thumbs-up.png +0 -0
  125. package/dist/titles/type=years.png +0 -0
  126. package/dist/trigger-BtQI81FL.js +0 -213
  127. package/dist/tslib.es6-BCqqvLQ_.js +0 -44
  128. package/dist/type_drinks-D6jnpvwV.js +0 -4
  129. package/dist/usePagination-Ciom38dd.js +0 -266
  130. package/dist/user-BOW0ixDK.js +0 -55
  131. package/dist/vue-i18n-jTYKTJq1.js +0 -2365
  132. package/dist/xlsx-YD3LYwip.js +0 -15491
  133. package/dist/zod-B_G9o5PC.js +0 -91
@@ -1,881 +0,0 @@
1
- import { defineComponent as ee, ref as z, resolveComponent as S, openBlock as p, createElementBlock as k, createElementVNode as l, createVNode as r, unref as t, createCommentVNode as le, withCtx as E, Fragment as O, renderList as ie, createBlock as J, toDisplayString as R, normalizeClass as re, onMounted as Se, computed as ce, isRef as Ie, createSlots as Me, h as Y, onBeforeMount as Te } from "vue";
2
- import { _ as Ee } from "./campaign-CpzFl8Vr.js";
3
- import { n as Ae, p as De } from "./plugins-CAdlnev8.js";
4
- import { u as $e } from "./loading-CvHPT80F.js";
5
- import { FmButtonVariant as ae, useSnackbar as Re, components as X } from "@feedmepos/ui-library";
6
- import { u as we, _ as Fe } from "./usePagination-Ciom38dd.js";
7
- import { u as be } from "./vue-i18n-jTYKTJq1.js";
8
- import "./index-BqQas5Sx.js";
9
- import { i as Pe, j as $, c as fe } from "./index-Cg-sBBf_.js";
10
- import "./index-Cyt6eKEF.js";
11
- import { F as ye, z as Be } from "./index-IBvUTxqC.js";
12
- import "./index-B_QGGlMD.js";
13
- import { u as ne, w as he } from "./xlsx-YD3LYwip.js";
14
- import { e as Ne, M as Ve } from "./email-addresses-D_fyxOof.js";
15
- import { Z as Ye } from "./zod-B_G9o5PC.js";
16
- import { u as Ue } from "./app-wDQR6dpb.js";
17
- import { R as ge } from "./rule-builder-B968rIyS.js";
18
- import { _ as Le } from "./ZodTextField.vue_vue_type_script_setup_true_lang-KHZ3-THo.js";
19
- import { _ as ze } from "./RuleGroup.vue_vue_type_script_setup_true_lang-Bp5jnlFr.js";
20
- import { u as Oe, v as je, w as qe } from "./index.esm2017-5xGykkgL.js";
21
- import { F as Ge } from "./FileSaver.min-BThLVsSf.js";
22
- import { h as H } from "./moment-D7p2TMB-.js";
23
- import { s as B, u as He } from "./membership-CU-wFWan.js";
24
- import { o as Je } from "./objectId-dwaoBfJX.js";
25
- import { u as Ce } from "./business-Dd73TVX5.js";
26
- import { f as Qe } from "./number-Bee2M41N.js";
27
- import { t as We } from "./money-CzlfhEoe.js";
28
- import "./index-tYmg4eyJ.js";
29
- import { useRouter as Ze } from "vue-router";
30
- import { m as ve } from "./index-Dw3ew6qN.js";
31
- import { R as _e } from "./app-DKrmktFJ.js";
32
- const Ke = Pe.extend({
33
- _id: ye.optional(),
34
- business: ye.optional(),
35
- file: Be.any().nullish()
36
- });
37
- var Xe = { firebase: { apiKey: "AIzaSyAj8JdCHtP0Vc5vZobCfgoLzWxPIn0WUG4", authDomain: "feedme-dev-4c3ef.firebaseapp.com", databaseURL: "https://feedme-dev-4c3ef.firebaseio.com", projectId: "feedme-dev-4c3ef", storageBucket: "feedme-dev-4c3ef.appspot.com", messagingSenderId: "458797803788", appId: "1:458797803788:web:37f2af2926a84288f0c129", measurementId: "G-J2QG09D2Q7" }, assetBucketUrl: "feedme-dev-4c3ef.appspot.com", importFilesBucketUrl: "feedme-dev-4c3ef.appspot.com", clientId: "1a362d621873497b277ea55258cc82594ba148d235257f7bd44ea2acc132d8a4" };
38
- const et = { class: "flex flex-col space-y-16" }, tt = {
39
- key: 0,
40
- class: /* @__PURE__ */ re([
41
- "p-16 pl-24 space-x-8",
42
- "bg-fm-color-primary-oats rounded-lg",
43
- "flex items-center",
44
- "justify-between"
45
- ])
46
- }, ot = { class: "flex justify-end" }, at = {
47
- key: 1,
48
- class: /* @__PURE__ */ re([
49
- "flex items-center",
50
- "border border-fm-color-neutral-gray-300",
51
- "p-16 space-x-16 rounded-md"
52
- ])
53
- }, nt = { class: "fm-typo-en-body-lg-400 flex-1 truncate" }, st = /* @__PURE__ */ ee({
54
- __name: "ImportSegment",
55
- props: {
56
- importFile: {}
57
- },
58
- emits: ["update:file"],
59
- setup(e, { emit: v }) {
60
- const _ = e, C = v, { t: m } = be(), f = z(null), w = z(null), F = ["Id"], n = [
61
- {
62
- label: "CSV",
63
- icon: "csv",
64
- value: "csv"
65
- },
66
- {
67
- label: "Excel",
68
- icon: "description",
69
- value: "xlsx"
70
- }
71
- ];
72
- async function i() {
73
- if (_.importFile)
74
- try {
75
- const h = Oe(void 0, Xe.importFilesBucketUrl), y = je(h, _.importFile), x = await qe(y);
76
- window.open(x, "_blank");
77
- } catch (h) {
78
- console.log(h), Ae.error("Failed to download uploaded file");
79
- }
80
- }
81
- async function c(h) {
82
- switch (h) {
83
- case "csv":
84
- const y = new Blob([F.join(",")], {
85
- type: "text/csv;charset=utf-8;"
86
- });
87
- Ge.saveAs(y, "ImportSegmentTemplate.csv");
88
- break;
89
- case "xlsx":
90
- const x = ne.aoa_to_sheet([F]), I = ne.book_new();
91
- ne.book_append_sheet(I, x, "Sheet1"), he(I, "ImportSegmentTemplate.xlsx");
92
- break;
93
- }
94
- }
95
- function b(h) {
96
- f.value = h, C("update:file", f.value);
97
- }
98
- function A(h) {
99
- var x, I;
100
- const y = ((I = (x = h.target) == null ? void 0 : x.files) == null ? void 0 : I[0]) ?? null;
101
- b(y);
102
- }
103
- return (h, y) => {
104
- const x = S("FmButton"), I = S("FmMenuItem"), d = S("FmMenu"), s = S("FmDropField");
105
- return p(), k("div", et, [
106
- y[2] || (y[2] = l("div", { class: "fm-typo-en-title-sm-800" }, "Upload File", -1)),
107
- e.importFile ? (p(), k("div", tt, [
108
- r(x, {
109
- label: t(m)("View uploaded file"),
110
- variant: t(ae).Plain,
111
- icon: "file_present",
112
- onClick: i
113
- }, null, 8, ["label", "variant"])
114
- ])) : le("", !0),
115
- l("div", null, [
116
- l("div", ot, [
117
- r(d, { class: "" }, {
118
- "menu-button": E(() => [
119
- r(x, {
120
- variant: "tertiary",
121
- icon: "download",
122
- label: "Download Template"
123
- })
124
- ]),
125
- default: E(() => [
126
- (p(), k(O, null, ie(n, (g) => r(I, {
127
- key: g.value,
128
- icon: g.icon,
129
- label: g.label,
130
- onClick: (U) => c(g.value),
131
- selectable: ""
132
- }, null, 8, ["icon", "label", "onClick"])), 64))
133
- ]),
134
- _: 1
135
- })
136
- ]),
137
- f.value ? (p(), k("div", at, [
138
- r(x, {
139
- variant: t(ae).Tertiary,
140
- "prepend-icon": "attach_file"
141
- }, null, 8, ["variant"]),
142
- l("p", nt, R(f.value.name), 1),
143
- l("label", {
144
- ref_key: "fileLabelRef",
145
- ref: w,
146
- htmlFor: "file"
147
- }, [
148
- r(x, {
149
- variant: t(ae).Plain,
150
- label: t(m)("Replace File"),
151
- onClick: y[1] || (y[1] = () => {
152
- var g;
153
- return (g = w.value) == null ? void 0 : g.click();
154
- })
155
- }, null, 8, ["variant", "label"]),
156
- l("input", {
157
- id: "file",
158
- accept: ".csv",
159
- class: "hidden",
160
- type: "file",
161
- multiple: "",
162
- onChange: A
163
- }, null, 32)
164
- ], 512)
165
- ])) : (p(), J(s, {
166
- key: 0,
167
- onFileUpload: y[0] || (y[0] = (g) => b(g)),
168
- accept: ".csv, .xlsx",
169
- "max-file-size": 2e7
170
- }))
171
- ])
172
- ]);
173
- };
174
- }
175
- }), lt = { class: "space-y-16 pr-12" }, it = { class: "fm-typo-en-title-md-800" }, rt = { class: "flex space-x-8" }, ct = { class: "fm-typo-en-title-md-800 text-fm-color-primary" }, dt = { class: "text-fm-color-typo-secondary" }, ut = /* @__PURE__ */ ee({
176
- __name: "ReviewSegment",
177
- props: {
178
- title: {},
179
- segment: {}
180
- },
181
- setup(e) {
182
- const v = e, _ = [
183
- {
184
- header: "Name",
185
- accessorFn: (i) => i.name
186
- },
187
- {
188
- header: "Id",
189
- accessorFn: (i) => i._id
190
- },
191
- {
192
- header: "Customer Since",
193
- accessorFn: (i) => H(Je(i._id.toString())).format("DD MMM YYYY")
194
- },
195
- {
196
- header: "Phone",
197
- accessorFn: (i) => i.phoneNumber
198
- },
199
- {
200
- header: "Birthday",
201
- accessorFn: (i) => H(i.birthday).format("DD MMM YYYY")
202
- },
203
- {
204
- header: "Last Visit",
205
- accessorFn: (i) => H(i.stats.lastVisit).format("DD MMM YYYY")
206
- }
207
- ];
208
- async function C(i) {
209
- return v.segment._id ? (console.log(i), await B.paginateSegmentUsers(
210
- v.segment._id,
211
- i
212
- )) : {
213
- resources: [],
214
- meta: {
215
- totalResources: 0,
216
- totalPages: 0,
217
- skip: i.skip,
218
- limit: i.limit,
219
- sortBy: i.sortBy
220
- }
221
- };
222
- }
223
- const { tableMeta: m, rowData: f, onSort: w, debouncedFetchData: F, onSearch: n } = we(C);
224
- return Se(async () => {
225
- await F();
226
- }), (i, c) => (p(), k("div", lt, [
227
- l("div", it, R(v.title), 1),
228
- l("div", rt, [
229
- l("div", ct, R(e.segment.members.length), 1),
230
- l("div", dt, [
231
- c[1] || (c[1] = l("div", null, "contacts in your segment", -1)),
232
- l("div", null, "as of " + R(t(H)(e.segment.lastUpdated).format("DD MMM YYYY")), 1)
233
- ])
234
- ]),
235
- r(Fe, {
236
- loading: t(m).isLoading,
237
- "row-data": t(f),
238
- "row-count": t(m).totalRows,
239
- "column-defs": _,
240
- "page-size": t(m).pageSize,
241
- "page-count": t(m).pageCount,
242
- "page-index": t(m).pageIndex,
243
- onSortChange: t(w),
244
- onPageChange: c[0] || (c[0] = (b) => t(F)({ pageSize: b.pageSize, pageIndex: b.pageIndex }))
245
- }, null, 8, ["loading", "row-data", "row-count", "page-size", "page-count", "page-index", "onSortChange"])
246
- ]));
247
- }
248
- }), pt = { class: "space-y-24" }, mt = { class: "grid grid-cols-2 gap-16" }, ft = { class: "fm-typo-en-title-sm-800" }, yt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, gt = /* @__PURE__ */ ee({
249
- __name: "SegmentTypeOption",
250
- props: {
251
- modelValue: {},
252
- errorText: {}
253
- },
254
- emits: ["update:model-value"],
255
- setup(e, { emit: v }) {
256
- const _ = e, C = v, m = [
257
- {
258
- label: "Dynamic",
259
- sublabel: "Segment statistics are based on rules configured and will be recalculated automatically when rule changes.",
260
- value: $.enum.DYNAMIC
261
- },
262
- {
263
- label: "Static",
264
- sublabel: "Segment statistics are based on imported data and will not be recalculated.",
265
- value: $.enum.STATIC
266
- }
267
- ];
268
- function f(w) {
269
- w !== _.modelValue && C("update:model-value", w);
270
- }
271
- return (w, F) => {
272
- const n = S("FmCard"), i = S("FmHelperText");
273
- return p(), k("div", pt, [
274
- l("div", mt, [
275
- (p(), k(O, null, ie(m, (c) => r(n, {
276
- variant: "outlined",
277
- class: re(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-2", {
278
- "col-span-2": m.length == 1,
279
- "border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": e.modelValue === c.value,
280
- "hover:bg-fm-color-opacity-sm": e.modelValue !== c.value
281
- }]),
282
- onClick: (b) => f(c.value),
283
- key: c.value
284
- }, {
285
- default: E(() => [
286
- l("div", ft, R(c.label), 1),
287
- l("div", yt, R(c.sublabel), 1)
288
- ]),
289
- _: 2
290
- }, 1032, ["class", "onClick"])), 64))
291
- ]),
292
- e.errorText ? (p(), J(i, {
293
- key: 0,
294
- class: "!mt-4",
295
- text: e.errorText,
296
- state: "error"
297
- }, null, 8, ["text"])) : le("", !0)
298
- ]);
299
- };
300
- }
301
- }), vt = { class: "flex items-center gap-x-8" }, _t = {
302
- key: 0,
303
- class: "space-y-16 pr-12"
304
- }, xt = { class: "flex flex-col space-y-16" }, St = {
305
- key: 0,
306
- class: "flex flex-col space-y-16"
307
- }, wt = {
308
- key: 1,
309
- class: "flex flex-col space-y-16"
310
- }, Ft = {
311
- key: 2,
312
- class: "flex flex-col space-y-16"
313
- }, bt = { class: "flex items-center gap-8" }, ht = /* @__PURE__ */ ee({
314
- __name: "SegmentSheet",
315
- emits: ["update:model-value"],
316
- setup(e, { expose: v, emit: _ }) {
317
- const C = Ue(), m = z(!1), f = z(!1), w = {
318
- name: "",
319
- isActive: !0,
320
- type: $.enum.DYNAMIC,
321
- rule: ge.scaffoldGroup(),
322
- members: []
323
- }, F = Ke, n = z(w), i = ce(() => {
324
- const d = F.safeParse(n.value);
325
- return d.success ? [] : d.error.errors;
326
- });
327
- function c(d) {
328
- m.value = !0, f.value = !1, d ? n.value = {
329
- ...d,
330
- isActive: d.isActive !== !1,
331
- type: d.type ?? (d.importFile ? $.enum.STATIC : $.enum.DYNAMIC)
332
- } : n.value = { ...w };
333
- }
334
- function b() {
335
- m.value = !1;
336
- }
337
- async function A() {
338
- F.safeParse(n.value).success && (f.value = !0);
339
- }
340
- function h(d) {
341
- d === $.enum.STATIC ? b() : f.value = !1;
342
- }
343
- async function y() {
344
- n.value.type === $.enum.STATIC ? (n.value.rule = ge.scaffoldGroup(), n.value.isActive = !0) : n.value.file = void 0, I("update:model-value", n.value);
345
- }
346
- async function x(d) {
347
- n.value.type = d;
348
- }
349
- Se(async () => {
350
- });
351
- const I = _;
352
- return v({
353
- showSheet: c,
354
- hideSheet: b
355
- }), (d, s) => {
356
- const g = S("FmButton"), U = S("FmSwitch"), a = S("FmSideSheet");
357
- return p(), J(a, {
358
- modelValue: t(m),
359
- "onUpdate:modelValue": s[8] || (s[8] = (o) => Ie(m) ? m.value = o : null),
360
- header: "Add segment",
361
- "dismiss-away": "",
362
- "close-button": !0,
363
- "max-width": 1100
364
- }, Me({
365
- "side-sheet-footer": E(() => [
366
- l("div", bt, [
367
- t(f) || t(n).type === t($).enum.STATIC ? (p(), k(O, { key: 0 }, [
368
- r(g, {
369
- label: "Save Segment",
370
- onClick: y,
371
- loading: t(C).isLoading,
372
- disabled: t(i).length > 0 || t(C).isLoading
373
- }, null, 8, ["loading", "disabled"]),
374
- r(g, {
375
- label: "Cancel",
376
- onClick: s[6] || (s[6] = (o) => h(t(n).type)),
377
- variant: "tertiary"
378
- })
379
- ], 64)) : (p(), k(O, { key: 1 }, [
380
- r(g, {
381
- label: "Review Segment",
382
- disabled: t(i).length > 0 || t(C).isLoading,
383
- onClick: A
384
- }, null, 8, ["disabled"]),
385
- r(g, {
386
- label: "Cancel",
387
- onClick: s[7] || (s[7] = (o) => b()),
388
- variant: "tertiary"
389
- })
390
- ], 64))
391
- ])
392
- ]),
393
- default: E(() => {
394
- var o;
395
- return [
396
- t(f) ? (p(), J(ut, {
397
- key: 1,
398
- title: t(n).name,
399
- segment: t(n)
400
- }, null, 8, ["title", "segment"])) : (p(), k("div", _t, [
401
- r(Le, {
402
- modelValue: t(n).name,
403
- "onUpdate:modelValue": s[1] || (s[1] = (u) => t(n).name = u),
404
- label: "Segment title",
405
- schema: t(Ye).typeAtPath(t(F), "name")
406
- }, null, 8, ["modelValue", "schema"]),
407
- l("div", xt, [
408
- s[10] || (s[10] = l("div", { class: "fm-typo-en-title-sm-800" }, "Segment Type", -1)),
409
- r(gt, {
410
- "model-value": t(n).type,
411
- "onUpdate:modelValue": s[2] || (s[2] = (u) => {
412
- x(u);
413
- })
414
- }, null, 8, ["model-value"])
415
- ]),
416
- t(n).type === t($).enum.DYNAMIC ? (p(), k("div", St, [
417
- s[11] || (s[11] = l("div", { class: "fm-typo-en-title-sm-800" }, "Segment Filter", -1)),
418
- r(ze, {
419
- "trigger-type": "MEMBERSHIP_JOINED",
420
- includeOnly: "user",
421
- "model-value": (o = t(n)) == null ? void 0 : o.rule,
422
- "onUpdate:modelValue": s[3] || (s[3] = (u) => {
423
- t(n).rule = u;
424
- })
425
- }, null, 8, ["model-value"])
426
- ])) : (p(), k("div", wt, [
427
- r(st, {
428
- importFile: t(n).importFile,
429
- "onUpdate:file": s[4] || (s[4] = (u) => {
430
- t(n).file = u;
431
- })
432
- }, null, 8, ["importFile"])
433
- ])),
434
- t(n).type === t($).enum.DYNAMIC ? (p(), k("div", Ft, [
435
- s[12] || (s[12] = l("div", { class: "fm-typo-en-title-sm-800" }, "Segment Status", -1)),
436
- r(U, {
437
- "model-value": t(n).isActive ?? !0,
438
- "onUpdate:modelValue": s[5] || (s[5] = (u) => t(n).isActive = u),
439
- label: "Active",
440
- sublabel: "When enabled, this will recalculate the segment statistics daily.",
441
- "label-placement": "right"
442
- }, null, 8, ["model-value"])
443
- ])) : le("", !0)
444
- ]))
445
- ];
446
- }),
447
- _: 2
448
- }, [
449
- t(f) ? {
450
- name: "side-sheet-header",
451
- fn: E(() => [
452
- l("div", vt, [
453
- r(g, {
454
- icon: "arrow_back",
455
- variant: "tertiary",
456
- onClick: s[0] || (s[0] = (o) => f.value = !1)
457
- }),
458
- s[9] || (s[9] = l("div", null, "Review segment", -1))
459
- ])
460
- ]),
461
- key: "0"
462
- } : void 0
463
- ]), 1032, ["modelValue"]);
464
- };
465
- }
466
- }), xe = He(), Ct = Ce();
467
- function se(e) {
468
- const v = H(e);
469
- return v.isValid() ? v.format("DD/MM/YYYY") : "";
470
- }
471
- const kt = {
472
- mapMemberExportRow: (e) => {
473
- var i, c, b, A, h, y, x, I, d, s, g, U, a, o, u, P, D, N, V, j, q, G, te, M, Q, de, ue, pe;
474
- const v = ce(() => Ct.locations.map((T) => ({
475
- label: T.name,
476
- value: T._id
477
- }))), _ = (i = Ne.parseOneAddress(
478
- e == null ? void 0 : e.email
479
- )) != null && i.domain.includes("feedmepos.com") ? void 0 : e.email, C = (b = ((c = e == null ? void 0 : e.collection) == null ? void 0 : c.TITLE) || []) == null ? void 0 : b.reduce(
480
- (T, L) => {
481
- var Z, K;
482
- const W = (K = (Z = xe.sortedTitles) == null ? void 0 : Z.find(
483
- (oe) => oe._id === L.collectible
484
- )) == null ? void 0 : K.name;
485
- return !W || L.balance <= 0 || T.push(W), T;
486
- },
487
- []
488
- ), m = (xe.sortedTitles || []).reduce(
489
- (T, L) => {
490
- var Z, K, oe, me;
491
- const W = (me = (oe = (K = (((Z = e == null ? void 0 : e.collection) == null ? void 0 : Z.TITLE) || []).find(
492
- (ke) => ke.collectible === L._id
493
- )) == null ? void 0 : K.expiryBalance) == null ? void 0 : oe[0]) == null ? void 0 : me.expiredAt;
494
- return T[L.name] = W ? H(W).format("DD/MM/YYYY") : "", T;
495
- },
496
- {}
497
- ), f = ((y = (h = (A = e.collection) == null ? void 0 : A.CREDIT) == null ? void 0 : h.at(0)) == null ? void 0 : y.balance) || 0, w = ((s = (d = (I = (x = e.collection) == null ? void 0 : x.CREDIT) == null ? void 0 : I.at(0)) == null ? void 0 : d.expiryBalance) == null ? void 0 : s.reduce(
498
- (T, L) => T + L.amount,
499
- 0
500
- )) || 0, F = Qe(f, 2);
501
- return {
502
- ID: e._id.toString(),
503
- Name: ((g = e.name) == null ? void 0 : g.trim()) || "",
504
- Phone: ((U = e == null ? void 0 : e.phoneNumber) == null ? void 0 : U.trim()) || "",
505
- Email: _ || "",
506
- Gender: e.gender || "",
507
- CardNo: e.cardNo || "",
508
- Birthday: e != null && e.birthday ? se(e == null ? void 0 : e.birthday) : "",
509
- Credit: parseFloat((Number(F) - Number(w)).toFixed(2)),
510
- FreeCredit: Number(w.toFixed(2)),
511
- TotalCredit: Number(F),
512
- Exp: e != null && e.collection ? ((u = (o = (a = e.collection) == null ? void 0 : a.POINT) == null ? void 0 : o.at(0)) == null ? void 0 : u.balance) ?? 0 : 0,
513
- Point: e != null && e.collection ? ((N = (D = (P = e.collection) == null ? void 0 : P.COIN) == null ? void 0 : D.at(0)) == null ? void 0 : N.balance) ?? 0 : 0,
514
- Level: e != null && e.collection ? ((q = (j = (V = e.collection) == null ? void 0 : V.TIER) == null ? void 0 : j.at(0)) == null ? void 0 : q.balance) ?? 0 : 0,
515
- Tier: e != null && e.collection ? ((M = (te = (G = e.collection) == null ? void 0 : G.TIER) == null ? void 0 : te.at(0)) == null ? void 0 : M.balance) ?? 0 : 0,
516
- Titles: C.join(","),
517
- ...m,
518
- TotalTransaction: e.stats.visitCount,
519
- AvgSpent: We(Number(e.stats.avgBillSize || 0)).toFormat(
520
- !1
521
- ),
522
- TotalSpent: e.stats.avgBillSize * e.stats.visitCount,
523
- LastVisit: se(e.stats.lastVisit),
524
- Feedback: ((Q = e.stats) == null ? void 0 : Q.feedbackCount) || 0,
525
- LastSeasonTierEarned: ((de = e.stats) == null ? void 0 : de.lastSeasonTierEarned) || 0,
526
- LastSeasonPointEarned: ((ue = e.stats) == null ? void 0 : ue.lastSeasonPointEarned) || 0,
527
- JoinedAt: se(e.joinAt || void 0),
528
- JoinedAtLocation: e.location && ((pe = v.value.find((T) => T.value == e.location)) == null ? void 0 : pe.label) || "-",
529
- VisitFrequency: `${Number(
530
- Math.ceil(e.stats.avgVisitFrequency).toFixed(0)
531
- )}`
532
- };
533
- }
534
- }, It = { class: "flex items-center" }, Mt = { class: "fm-typo-en-title-md-600 fm-step-title line-clamp-2 mr-8" }, Tt = { class: "px-24 flex flex-col gap-y-16" }, Et = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, At = { class: "fm-typo-en-body-md-600" }, Dt = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, uo = /* @__PURE__ */ ee({
535
- __name: "Segment",
536
- setup(e) {
537
- const { minor: v } = $e, { t: _ } = be(), C = Ce(), { mapMemberExportRow: m } = kt, f = Re(), w = Ze(), F = z(0), n = [
538
- {
539
- header: _("connect.loyalty.segment.table.name"),
540
- accessorFn: (a) => a.name
541
- },
542
- {
543
- header: _("connect.loyalty.segment.table.status"),
544
- enableSorting: !1,
545
- cell(a) {
546
- const o = a.row.original.isActive === !1 ? "Inactive" : "Active";
547
- return Y(X.FmChip, {
548
- class: a.row.original.isActive === !1 ? "text-fm-color-typo-error bg-fm-color-system-error-100" : "text-fm-color-typo-success bg-fm-color-system-success-100",
549
- label: o,
550
- compact: !0
551
- });
552
- }
553
- },
554
- {
555
- header: _("connect.loyalty.segment.table.total_customers"),
556
- accessorFn: (a) => a.memberCount ?? 0
557
- },
558
- {
559
- header: _("connect.loyalty.segment.table.customer_percentage"),
560
- accessorFn: (a) => ((a.memberCount ?? 0) * 100 / F.value).toFixed(2)
561
- },
562
- {
563
- header: _("connect.loyalty.segment.table.actions"),
564
- meta: {
565
- maxWidth: "100px"
566
- },
567
- cell(a) {
568
- return Y("div", { class: "flex items-center justify-end" }, [
569
- Y(
570
- X.FmMenu,
571
- {
572
- placement: "bottom-end",
573
- onClick: (o) => {
574
- o.stopPropagation();
575
- }
576
- },
577
- {
578
- "menu-button": () => Y(X.FmButton, {
579
- icon: "more_vert",
580
- iconColor: "neutral-gray-400",
581
- variant: "tertiary"
582
- }),
583
- default: () => [
584
- Y(
585
- X.FmMenuItem,
586
- {
587
- onClick: async (o) => {
588
- o.stopPropagation(), x(a.row.original);
589
- }
590
- },
591
- {
592
- label: Y(
593
- "div",
594
- {
595
- class: "fm-typo-en-body-md-400"
596
- },
597
- "Export"
598
- )
599
- }
600
- ),
601
- Y(
602
- X.FmMenuItem,
603
- {
604
- onClick: async (o) => {
605
- o.stopPropagation(), y(a.row.original);
606
- }
607
- },
608
- {
609
- label: Y(
610
- "div",
611
- {
612
- class: "text-fm-color-typo-error fm-typo-en-body-md-400"
613
- },
614
- "Remove"
615
- )
616
- }
617
- )
618
- ]
619
- }
620
- )
621
- ]);
622
- }
623
- }
624
- ], i = z(null), { tableMeta: c, rowData: b, debouncedFetchData: A } = we(
625
- B.readAll
626
- );
627
- async function h() {
628
- await v(
629
- async () => {
630
- await B.refreshSegments(), await A({ pageSize: 10, pageIndex: 0 });
631
- },
632
- { message: "Refreshing segmentations" }
633
- );
634
- }
635
- async function y(a) {
636
- await De.remove(`Are you sure you want to remove ${a.name}?`) && await v(
637
- async () => {
638
- await B.delete(a._id), await A({ pageSize: 10, pageIndex: 0 });
639
- },
640
- {
641
- message: `Removing ${a.name}`,
642
- successMessage: `Removed ${a.name} successfully`
643
- }
644
- );
645
- }
646
- async function x(a) {
647
- const o = {
648
- sortBy: "_id",
649
- descending: !1,
650
- rowsPerPage: 1e3,
651
- page: 1,
652
- rowsNumber: 0
653
- }, u = new Ve(), P = (await ve.read({
654
- limit: 1,
655
- skip: 0,
656
- sortBy: o.sortBy,
657
- descending: o.descending
658
- })).meta.totalResources ?? 0, D = o.rowsPerPage;
659
- await v(
660
- async () => {
661
- for (let N = 0; N < P; N += D) {
662
- const V = {
663
- ...o,
664
- limit: D,
665
- skip: o.page - 1,
666
- sortBy: o.sortBy,
667
- descending: o.descending
668
- }, j = await B.paginateSegmentUsers(
669
- a._id,
670
- V
671
- );
672
- for (const q of j.resources) {
673
- const G = m(q);
674
- u.addRecord(G);
675
- }
676
- o.page++;
677
- }
678
- await he(
679
- u.buildExcel(),
680
- `[${a.name}]-members-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
681
- {
682
- bookType: "xlsx",
683
- bookSST: !1,
684
- type: "array"
685
- }
686
- ), o.page = 1;
687
- },
688
- {
689
- message: "Exporting member...",
690
- successMessage: "Member exported successfully"
691
- }
692
- );
693
- }
694
- async function I(a) {
695
- await v(
696
- async () => {
697
- var o;
698
- if (a.type === $.enum.STATIC) {
699
- const u = new FormData();
700
- if (u.append("file", a.file), a._id) {
701
- const { members: P, _id: D, file: N, ...V } = a;
702
- u.append("segment", JSON.stringify(V)), await B.updateStatic(a._id, u);
703
- } else {
704
- const { file: P, ...D } = a;
705
- u.append("segment", JSON.stringify(D)), await B.createStatic(u);
706
- }
707
- a.file && f.open({
708
- type: "info",
709
- title: "Import begins soon. Check Queue for updates.",
710
- action: "View",
711
- onAction: async () => {
712
- await w.push({
713
- name: _e["$connect-QUEUE"],
714
- query: { type: [fe.enum.SEGMENTATION_IMPORTED] }
715
- });
716
- }
717
- });
718
- } else if (a._id) {
719
- const { members: u, _id: P, ...D } = a;
720
- await B.update(a._id, D);
721
- } else
722
- await B.create(a);
723
- await A({ pageSize: 10, pageIndex: 0 }), (o = i.value) == null || o.hideSheet();
724
- },
725
- {
726
- message: "Saving segment",
727
- successMessage: "Segment saved"
728
- }
729
- );
730
- }
731
- function d(a) {
732
- var o;
733
- (o = i.value) == null || o.showSheet(a);
734
- }
735
- const s = {
736
- label: _("connect.navigation.queue"),
737
- value: "queue",
738
- isPrimary: !1,
739
- prependIcon: "work_history"
740
- }, g = ce(() => C.isPremium ? [
741
- s,
742
- {
743
- label: "Refresh segments",
744
- value: "refresh",
745
- prependIcon: "refresh"
746
- },
747
- {
748
- label: "Add segment",
749
- value: "add",
750
- isPrimary: !0,
751
- prependIcon: "add"
752
- }
753
- ] : []);
754
- function U(a) {
755
- switch (a) {
756
- case "add":
757
- d();
758
- break;
759
- case "refresh":
760
- h();
761
- break;
762
- case "queue":
763
- w.push({
764
- name: _e["$connect-QUEUE"],
765
- query: { type: [fe.enum.SEGMENTATION_IMPORTED] }
766
- });
767
- break;
768
- }
769
- }
770
- return Te(async () => {
771
- const { meta: a } = await ve.read({
772
- limit: 1,
773
- skip: 0,
774
- sortBy: "_id",
775
- search: void 0,
776
- descending: !1
777
- });
778
- F.value = a.totalResources ?? 0, await A({ pageSize: 10, pageIndex: 0 }), await C.readPremium(), await C.readLocations();
779
- }), (a, o) => {
780
- const u = S("FmPill"), P = S("FmPageHead"), D = S("FmIcon"), N = S("FmMenuItem"), V = S("FmMenu"), j = S("FmListItem"), q = S("FmList"), G = S("FmButton"), te = S("FmCard");
781
- return p(), k(O, null, [
782
- r(P, {
783
- title: "Segments",
784
- actions: t(g),
785
- "onClick:action": o[0] || (o[0] = (M) => U(M))
786
- }, {
787
- title: E(() => [
788
- l("div", It, [
789
- l("span", Mt, R(t(_)("connect.loyalty.segment.title")), 1),
790
- r(u, { variant: "premium" })
791
- ])
792
- ]),
793
- _: 1
794
- }, 8, ["actions"]),
795
- l("div", Tt, [
796
- t(b).length > 0 || t(c).searchValue || t(c).isLoading ? (p(), k(O, { key: 0 }, [
797
- r(Fe, {
798
- loading: t(c).isLoading,
799
- "row-data": t(b),
800
- "row-count": t(c).totalRows,
801
- "column-defs": n,
802
- "shrink-at": !1,
803
- "page-count": t(c).pageCount,
804
- "page-index": t(c).pageIndex,
805
- "page-size": t(c).pageSize,
806
- onRowClick: o[1] || (o[1] = (M) => {
807
- d(M.original);
808
- }),
809
- onPageChange: t(A)
810
- }, null, 8, ["loading", "row-data", "row-count", "page-count", "page-index", "page-size", "onPageChange"]),
811
- r(q, { class: "w-full hidden xs:!block" }, {
812
- default: E(() => [
813
- (p(!0), k(O, null, ie(t(b), (M) => (p(), J(j, {
814
- key: M._id.toString(),
815
- tag: "label",
816
- onClick: (Q) => d(M)
817
- }, {
818
- default: E(() => [
819
- l("div", null, [
820
- l("div", Et, R((M.memberCount ?? 0).toLocaleString()) + " total customers ", 1),
821
- l("div", At, R(M.name), 1),
822
- l("div", Dt, R(((M.memberCount ?? 0) * 100 / t(F)).toFixed(2)) + "% of customers ", 1)
823
- ])
824
- ]),
825
- append: E(() => [
826
- r(V, { "stop-click-propagation": !0 }, {
827
- "menu-button": E(() => [
828
- r(D, { name: "more_vert" })
829
- ]),
830
- default: E(() => [
831
- r(N, {
832
- class: "text-fm-color-typo-error fm-typo-en-body-md-400",
833
- label: "Remove",
834
- "onUpdate:modelValue": (Q) => Q && y(M)
835
- }, null, 8, ["onUpdate:modelValue"])
836
- ]),
837
- _: 2
838
- }, 1024)
839
- ]),
840
- _: 2
841
- }, 1032, ["onClick"]))), 128))
842
- ]),
843
- _: 1
844
- })
845
- ], 64)) : (p(), J(te, {
846
- key: 1,
847
- variant: "outlined",
848
- class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
849
- }, {
850
- default: E(() => [
851
- o[3] || (o[3] = l("img", {
852
- src: Ee,
853
- class: "aspect-square w-[150px]"
854
- }, null, -1)),
855
- o[4] || (o[4] = l("div", { class: "flex flex-col gap-16 text-center" }, [
856
- l("div", { class: "fm-typo-en-title-sm-800" }, "Create customer segments"),
857
- l("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Segments allow you to categorize your customers based on various criteria, enabling targeted marketing and personalized experiences. ")
858
- ], -1)),
859
- r(G, {
860
- variant: "primary",
861
- label: "Create segment",
862
- disabled: !t(C).isPremium,
863
- icon: "add",
864
- onClick: o[2] || (o[2] = (M) => d())
865
- }, null, 8, ["disabled"])
866
- ]),
867
- _: 1
868
- })),
869
- r(ht, {
870
- ref_key: "sheetRef",
871
- ref: i,
872
- "onUpdate:modelValue": I
873
- }, null, 512)
874
- ])
875
- ], 64);
876
- };
877
- }
878
- });
879
- export {
880
- uo as default
881
- };