@feedmepos/mf-connect 0.1.46-prod → 0.1.48-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 (105) hide show
  1. package/dist/{Analytic--PTYdTCz.js → Analytic-DrjBaKmx.js} +113 -113
  2. package/dist/{App-CCFCux3P.js → App-eIaytGsZ.js} +632 -622
  3. package/dist/{Bin-D3mLTCYx.js → Bin-CVp0eFwl.js} +9 -9
  4. package/dist/{Broadcast-17Aiufxx.js → Broadcast-DBgBT6yz.js} +40 -40
  5. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CMVquBaq.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CugJWeBo.js} +18 -18
  6. package/dist/{Card-Bx26e5ll.js → Card-DkP6oJVn.js} +239 -239
  7. package/dist/{Collections-B_lm_p0s.js → Collections-DYb_aeTW.js} +31 -31
  8. package/dist/{Credit-Bfdh01Hf.js → Credit-WVv_PL5D.js} +74 -74
  9. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-DWNvRorl.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-Dt9c2kvf.js} +756 -753
  10. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-CkYlghNU.js → EffectSheet.vue_vue_type_style_index_0_lang-DT3y4k1C.js} +96 -96
  11. package/dist/{Experience-DScp4H4M.js → Experience-BdH44wBG.js} +41 -41
  12. package/dist/{Game-Cn2BXwaA.js → Game-C7jxRESY.js} +31 -31
  13. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-D1KQpDGg.js +144 -0
  14. package/dist/{Index-BATr5dcp.js → Index-DYr1p4sh.js} +54 -54
  15. package/dist/{Marketing-B6lhSaKk.js → Marketing-Djl27fez.js} +24 -24
  16. package/dist/{Member-Cr_Ehw_n.js → Member-CWXedfTG.js} +63 -63
  17. package/dist/MemberList-C2TvGi22.js +1606 -0
  18. package/dist/MemberOverview-wL_ailso.js +58 -0
  19. package/dist/{MemberTransactions-YlC-iE41.js → MemberTransactions-BSUocGg9.js} +1 -1
  20. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-nTBRadZx.js → MessageInput.vue_vue_type_script_setup_true_lang-D8xPA6jM.js} +2287 -2221
  21. package/dist/{Mission-Bddme86f.js → Mission-BVx9Cqi5.js} +20 -20
  22. package/dist/{Overview-BGOM1IKg.js → Overview-DyXF9zfB.js} +337 -337
  23. package/dist/{Point-vcnTW6lY.js → Point-ovkgTwZO.js} +41 -41
  24. package/dist/{Promotion-DuCvytdc.js → Promotion-B0Q6GItP.js} +42 -42
  25. package/dist/{Queue-Cuw7WTP_.js → Queue-BAWG1Hh-.js} +12 -12
  26. package/dist/{Record-Dc6BPAGi.js → Record-CTp80g4A.js} +10 -10
  27. package/dist/{Reward-8MFxn8we.js → Reward-_Jow1lJ7.js} +173 -173
  28. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-8k-usg9S.js → RewardGroup.vue_vue_type_script_setup_true_lang-BV8xCejA.js} +11 -11
  29. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-DkDAuGY0.js +1763 -0
  30. package/dist/Segment-CsdJ1SjK.js +882 -0
  31. package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-B2LYvXlN.js → SelectItems.vue_vue_type_script_setup_true_lang-DH3oIm2t.js} +14 -14
  32. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-CaFLnq7P.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-DvVrjpxR.js} +11 -11
  33. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-DLAqn-0P.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-D5gV89Xk.js} +3 -3
  34. package/dist/Setting-BZRA50LO.js +1936 -0
  35. package/dist/{Store-DdBnVwnq.js → Store-CFnCN_7-.js} +238 -238
  36. package/dist/StoreRewards-B_McpBz-.js +423 -0
  37. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-BPPoaGqc.js → StoreTransactions.vue_vue_type_script_setup_true_lang-vL0vr-Xn.js} +185 -185
  38. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-D0ae_2E5.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-C1ZlLdme.js} +1 -1
  39. package/dist/{Tier-BpQ8DXK4.js → Tier-CCYFu6kJ.js} +106 -106
  40. package/dist/{Title-D6jghz1v.js → Title-7Mg-Ml4z.js} +95 -95
  41. package/dist/{Transaction-BQWs-6G7.js → Transaction-BqZrbpZi.js} +2 -2
  42. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-C2dJuE64.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-C6ZwPUD4.js} +6 -6
  43. package/dist/{Voucher-DnL_66X2.js → Voucher-Yty_7SuS.js} +36 -36
  44. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-Bt12t3gB.js +419 -0
  45. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-yj2c4i_u.js → ZodTextField.vue_vue_type_script_setup_true_lang-C3NHrEIl.js} +1 -1
  46. package/dist/{app-Cemiie6P.js → app-2EJP4psh.js} +31 -31
  47. package/dist/app-Dzon--6x.js +57962 -0
  48. package/dist/app.js +1 -1
  49. package/dist/{business-BTJVFnrW.js → business-BehG4fR2.js} +1 -1
  50. package/dist/{campaign-XX6bwpYj.js → campaign-BpaiTG4f.js} +10 -10
  51. package/dist/{campaign-C34w0eci.js → campaign-CAcP56Sz.js} +2 -2
  52. package/dist/{campaign.enum-CTMwHgAV.js → campaign.enum-BWjI8Hop.js} +1 -1
  53. package/dist/{campaign.fn-nJl0vZum.js → campaign.fn-PVdB1-V1.js} +123 -123
  54. package/dist/{collectible.enum-DpJV0kLI.js → collectible.enum-BYmuqayi.js} +1 -1
  55. package/dist/{collection.fn-D5beOWlp.js → collection.fn-CbH8hbWW.js} +2 -2
  56. package/dist/{dto-CCxjvwZe.js → dto-Dd3Oc4QO.js} +4 -4
  57. package/dist/{effect-B9ryfTOn.js → effect-DvEQNEl0.js} +1 -1
  58. package/dist/{email-addresses-Bn80jSud.js → email-addresses-C-9JrAi8.js} +1 -1
  59. package/dist/{export-CLB408ho.js → export-RWE9Cn-d.js} +4 -4
  60. package/dist/{helper-DgoAVTVe.js → helper-Bl6LdWED.js} +1 -1
  61. package/dist/{index-D90Ba87K.js → index-1bU9cLqV.js} +1 -1
  62. package/dist/{index-DsgbkezN.js → index-BCQMVr1J.js} +1 -1
  63. package/dist/{index-Djq2lySj.js → index-Bgnrbk5x.js} +1 -1
  64. package/dist/{index-Blmkh0Ui.js → index-Bjf5Z2QE.js} +4 -4
  65. package/dist/{index-DUtQaOO2.js → index-CFW9ogow.js} +1 -1
  66. package/dist/{index-t_4aIo1w.js → index-CfgczUMX.js} +2 -2
  67. package/dist/{index-FMcRNPk_.js → index-CzCqc7ph.js} +1 -1
  68. package/dist/{index-B9wdSOIQ.js → index-DX1X6Owa.js} +1 -1
  69. package/dist/{index-KYo_FgI8.js → index-DZN5WWgq.js} +3 -3
  70. package/dist/{index-B2BKFdEy.js → index-DhUvELhc.js} +1023 -1023
  71. package/dist/{index-DCrV9spQ.js → index-DpoNuVc-.js} +6 -6
  72. package/dist/{index-JY8MjiBK.js → index-G_XSbrXB.js} +3 -3
  73. package/dist/{index-bkL81TwC.js → index-VVy4GPzJ.js} +1 -1
  74. package/dist/{index-eiHOH5QM.js → index-wOExBjGo.js} +1 -1
  75. package/dist/{index.esm2017-toVKAoKi.js → index.esm2017-DfgZFSqe.js} +1 -1
  76. package/dist/{loading-vrEcUlJa.js → loading-qlqqYGF3.js} +1 -1
  77. package/dist/{membership-ChiyKtoA.js → membership-Bh_1iu5v.js} +3 -3
  78. package/dist/{moment-BWErdI6_.js → moment-D7p2TMB-.js} +6 -1
  79. package/dist/{money-tOAuywfS.js → money-DvTB_Fek.js} +1 -1
  80. package/dist/{number-DiXSJR50.js → number-DJQ3gi1P.js} +1 -1
  81. package/dist/objectid-BKU0cEuv.js +145 -0
  82. package/dist/{plugins-p8ID0wqZ.js → plugins-DJpBrPbQ.js} +2 -2
  83. package/dist/{reward-Bo4HsVNH.js → reward-DZ4KlN9B.js} +1 -1
  84. package/dist/{rule-LDThYbT7.js → rule-DV0yCGlq.js} +4 -4
  85. package/dist/rule-builder-D6ihVPNO.js +93 -0
  86. package/dist/{template-C6cnCLah.js → template-ElP-JIFL.js} +63 -63
  87. package/dist/timezone-FaHjut_D.js +1150 -0
  88. package/dist/{trigger-ZyJEZVxL.js → trigger-D8wnJVTA.js} +4 -4
  89. package/dist/usePagination-Ds-cuHop.js +223 -0
  90. package/dist/{user-WDNaXiRu.js → user-NWV9KppR.js} +1 -1
  91. package/dist/{vue-i18n-BWI3POch.js → vue-i18n-CkbS-IDD.js} +157 -157
  92. package/dist/{xlsx-JDV04zZH.js → xlsx-CdQE5RZi.js} +226 -226
  93. package/package.json +5 -4
  94. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-ByhTB9Ie.js +0 -144
  95. package/dist/MemberList-B5ogB2E6.js +0 -1606
  96. package/dist/MemberOverview-C2n9oJZh.js +0 -58
  97. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-DRCwMmo5.js +0 -1752
  98. package/dist/Segment-BJm5XtlX.js +0 -882
  99. package/dist/Setting-CUyfrLYA.js +0 -1936
  100. package/dist/StoreRewards-B_yzVh4Z.js +0 -423
  101. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-naUCARDO.js +0 -419
  102. package/dist/app-Cwax62X-.js +0 -33357
  103. package/dist/objectid-C856JGM4.js +0 -145
  104. package/dist/rule-builder-7iBcFApT.js +0 -89
  105. package/dist/usePagination-JoYaROkV.js +0 -223
@@ -1,882 +0,0 @@
1
- import { defineComponent as ee, ref as z, resolveComponent as b, openBlock as p, createElementBlock as C, createVNode as i, unref as t, createCommentVNode as le, createElementVNode as s, withCtx as E, Fragment as O, renderList as ie, createBlock as J, toDisplayString as D, 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 { p as $e } from "./plugins-p8ID0wqZ.js";
4
- import { u as Re } from "./loading-vrEcUlJa.js";
5
- import { FmButtonVariant as ae, useSnackbar as Ae, components as X } from "@feedmepos/ui-library";
6
- import { u as xe, _ as be } from "./usePagination-JoYaROkV.js";
7
- import { u as we } from "./vue-i18n-BWI3POch.js";
8
- import { i as De, j as A, c as fe } from "./index-Blmkh0Ui.js";
9
- import "./index-t_4aIo1w.js";
10
- import "./index-DCrV9spQ.js";
11
- import "./index-DUtQaOO2.js";
12
- import "./index-KYo_FgI8.js";
13
- import { u as ne, w as Fe } from "./xlsx-JDV04zZH.js";
14
- import { e as Pe, M as Ne } from "./email-addresses-Bn80jSud.js";
15
- import { Z as Be } from "./zod-Bg2FbC-D.js";
16
- import { u as Ve } from "./app-wDQR6dpb.js";
17
- import { F as ye, z as Ye } from "./index-B2BKFdEy.js";
18
- import { R as ge } from "./rule-builder-7iBcFApT.js";
19
- import { _ as Ue } from "./ZodTextField.vue_vue_type_script_setup_true_lang-yj2c4i_u.js";
20
- import { _ as Le } from "./RuleGroup.vue_vue_type_script_setup_true_lang-DRCwMmo5.js";
21
- import { u as ze, v as Oe, w as je } from "./index.esm2017-toVKAoKi.js";
22
- import { F as qe } from "./FileSaver.min-NlMItPOc.js";
23
- import { h as G } from "./moment-BWErdI6_.js";
24
- import { s as N, u as He } from "./membership-ChiyKtoA.js";
25
- import { o as Ge } from "./objectId-dwaoBfJX.js";
26
- import { u as ke } from "./business-BTJVFnrW.js";
27
- import { f as Je } from "./number-DiXSJR50.js";
28
- import { t as Qe } from "./money-tOAuywfS.js";
29
- import "./index-D90Ba87K.js";
30
- import { useRouter as We } from "vue-router";
31
- import { m as ve } from "./index-FMcRNPk_.js";
32
- import { R as _e } from "./app-Cemiie6P.js";
33
- const Ke = De.extend({
34
- _id: ye.optional(),
35
- business: ye.optional(),
36
- file: Ye.any().nullish()
37
- });
38
- var Ze = { firebase: { apiKey: "AIzaSyA_isPR1-9bX7UmRiJIhsIRNNwdn6DdmW4", authDomain: "feedme-253402.firebaseapp.com", databaseURL: "https://feedme-253402.firebaseio.com", projectId: "feedme-253402", storageBucket: "image.feedme.cc", messagingSenderId: "128512026847", appId: "1:128512026847:web:7c5c8ab7e8b90502dc616a", measurementId: "G-LTKS7N2HQS" }, assetBucketUrl: "static.feedme.cc", importFilesBucketUrl: "feedme-253402.appspot.com", clientId: "d5f8840d63dbb758b6c4ee2a5e8b013d15dd25e242c457481326062b83962476" };
39
- const Xe = { class: "flex flex-col space-y-16" }, et = /* @__PURE__ */ s("div", { class: "fm-typo-en-title-sm-800" }, "Upload File", -1), tt = {
40
- key: 0,
41
- class: /* @__PURE__ */ re([
42
- "p-16 pl-24 space-x-8",
43
- "bg-fm-color-primary-oats rounded-lg",
44
- "flex items-center",
45
- "justify-between"
46
- ])
47
- }, ot = { class: "flex justify-end" }, at = {
48
- key: 1,
49
- class: /* @__PURE__ */ re([
50
- "flex items-center",
51
- "border border-fm-color-neutral-gray-300",
52
- "p-16 space-x-16 rounded-md"
53
- ])
54
- }, nt = { class: "fm-typo-en-body-lg-400 flex-1 truncate" }, st = /* @__PURE__ */ ee({
55
- __name: "ImportSegment",
56
- props: {
57
- importFile: {}
58
- },
59
- emits: ["update:file"],
60
- setup(e, { emit: v }) {
61
- const _ = e, F = v, { t: m } = we(), y = z(null), f = z(null), w = ["Id"], l = [
62
- {
63
- label: "CSV",
64
- icon: "csv",
65
- value: "csv"
66
- },
67
- {
68
- label: "Excel",
69
- icon: "description",
70
- value: "xlsx"
71
- }
72
- ];
73
- async function n() {
74
- if (_.importFile)
75
- try {
76
- const h = ze(void 0, Ze.importFilesBucketUrl), S = Oe(h, _.importFile), x = await je(S);
77
- window.open(x, "_blank");
78
- } catch (h) {
79
- console.log(h);
80
- }
81
- }
82
- async function c(h) {
83
- switch (h) {
84
- case "csv":
85
- const S = new Blob([w.join(",")], {
86
- type: "text/csv;charset=utf-8;"
87
- });
88
- qe.saveAs(S, "ImportSegmentTemplate.csv");
89
- break;
90
- case "xlsx":
91
- const x = ne.aoa_to_sheet([w]), I = ne.book_new();
92
- ne.book_append_sheet(I, x, "Sheet1"), Fe(I, "ImportSegmentTemplate.xlsx");
93
- break;
94
- }
95
- }
96
- function k(h) {
97
- y.value = h, F("update:file", y.value);
98
- }
99
- function $(h) {
100
- var x, I;
101
- const S = ((I = (x = h.target) == null ? void 0 : x.files) == null ? void 0 : I[0]) ?? null;
102
- k(S);
103
- }
104
- return (h, S) => {
105
- const x = b("FmButton"), I = b("FmMenuItem"), u = b("FmMenu"), r = b("FmDropField");
106
- return p(), C("div", Xe, [
107
- et,
108
- h.importFile ? (p(), C("div", tt, [
109
- i(x, {
110
- label: t(m)("View uploaded file"),
111
- variant: t(ae).Plain,
112
- icon: "file_present",
113
- onClick: n
114
- }, null, 8, ["label", "variant"])
115
- ])) : le("", !0),
116
- s("div", null, [
117
- s("div", ot, [
118
- i(u, { class: "" }, {
119
- "menu-button": E(() => [
120
- i(x, {
121
- variant: "tertiary",
122
- icon: "download",
123
- label: "Download Template"
124
- })
125
- ]),
126
- default: E(() => [
127
- (p(), C(O, null, ie(l, (g) => i(I, {
128
- key: g.value,
129
- icon: g.icon,
130
- label: g.label,
131
- onClick: (U) => c(g.value),
132
- selectable: ""
133
- }, null, 8, ["icon", "label", "onClick"])), 64))
134
- ]),
135
- _: 1
136
- })
137
- ]),
138
- y.value ? (p(), C("div", at, [
139
- i(x, {
140
- variant: t(ae).Tertiary,
141
- "prepend-icon": "attach_file"
142
- }, null, 8, ["variant"]),
143
- s("p", nt, D(y.value.name), 1),
144
- s("label", {
145
- ref_key: "fileLabelRef",
146
- ref: f,
147
- htmlFor: "file"
148
- }, [
149
- i(x, {
150
- variant: t(ae).Plain,
151
- label: t(m)("Replace File"),
152
- onClick: S[1] || (S[1] = () => {
153
- var g;
154
- return (g = f.value) == null ? void 0 : g.click();
155
- })
156
- }, null, 8, ["variant", "label"]),
157
- s("input", {
158
- id: "file",
159
- accept: ".csv",
160
- class: "hidden",
161
- type: "file",
162
- multiple: "",
163
- onChange: $
164
- }, null, 32)
165
- ], 512)
166
- ])) : (p(), J(r, {
167
- key: 0,
168
- onFileUpload: S[0] || (S[0] = (g) => k(g)),
169
- accept: ".csv, .xlsx",
170
- "max-file-size": 2e7
171
- }))
172
- ])
173
- ]);
174
- };
175
- }
176
- }), 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__ */ s("div", null, "contacts in your segment", -1), pt = /* @__PURE__ */ ee({
177
- __name: "ReviewSegment",
178
- props: {
179
- title: {},
180
- segment: {}
181
- },
182
- setup(e) {
183
- const v = e, _ = [
184
- {
185
- header: "Name",
186
- accessorFn: (n) => n.name
187
- },
188
- {
189
- header: "Id",
190
- accessorFn: (n) => n._id
191
- },
192
- {
193
- header: "Customer Since",
194
- accessorFn: (n) => G(Ge(n._id.toString())).format("DD MMM YYYY")
195
- },
196
- {
197
- header: "Phone",
198
- accessorFn: (n) => n.phoneNumber
199
- },
200
- {
201
- header: "Birthday",
202
- accessorFn: (n) => G(n.birthday).format("DD MMM YYYY")
203
- },
204
- {
205
- header: "Last Visit",
206
- accessorFn: (n) => G(n.stats.lastVisit).format("DD MMM YYYY")
207
- }
208
- ];
209
- async function F(n) {
210
- return v.segment._id ? (console.log(n), await N.paginateSegmentUsers(
211
- v.segment._id,
212
- n
213
- )) : {
214
- resources: [],
215
- meta: {
216
- totalResources: 0,
217
- totalPages: 0,
218
- skip: n.skip,
219
- limit: n.limit,
220
- sortBy: n.sortBy
221
- }
222
- };
223
- }
224
- const { tableMeta: m, rowData: y, onSort: f, debouncedFetchData: w, onSearch: l } = xe(F);
225
- return Se(async () => {
226
- await w();
227
- }), (n, c) => (p(), C("div", lt, [
228
- s("div", it, D(v.title), 1),
229
- s("div", rt, [
230
- s("div", ct, D(n.segment.members.length), 1),
231
- s("div", dt, [
232
- ut,
233
- s("div", null, "as of " + D(t(G)(n.segment.lastUpdated).format("DD MMM YYYY")), 1)
234
- ])
235
- ]),
236
- i(be, {
237
- loading: t(m).isLoading,
238
- "row-data": t(y),
239
- "row-count": t(m).totalRows,
240
- "column-defs": _,
241
- "page-size": t(m).pageSize,
242
- "page-count": t(m).pageCount,
243
- "page-index": t(m).pageIndex,
244
- onSortChange: t(f),
245
- onPageChange: c[0] || (c[0] = (k) => t(w)({ pageSize: k.pageSize, pageIndex: k.pageIndex }))
246
- }, null, 8, ["loading", "row-data", "row-count", "page-size", "page-count", "page-index", "onSortChange"])
247
- ]));
248
- }
249
- }), mt = { class: "space-y-24" }, ft = { class: "grid grid-cols-2 gap-16" }, yt = { class: "fm-typo-en-title-sm-800" }, gt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, vt = /* @__PURE__ */ ee({
250
- __name: "SegmentTypeOption",
251
- props: {
252
- modelValue: {},
253
- errorText: {}
254
- },
255
- emits: ["update:model-value"],
256
- setup(e, { emit: v }) {
257
- const _ = e, F = v, m = [
258
- {
259
- label: "Dynamic",
260
- sublabel: "Segment statistics are based on rules configured and will be recalculated automatically when rule changes.",
261
- value: A.enum.DYNAMIC
262
- },
263
- {
264
- label: "Static",
265
- sublabel: "Segment statistics are based on imported data and will not be recalculated.",
266
- value: A.enum.STATIC
267
- }
268
- ];
269
- function y(f) {
270
- f !== _.modelValue && F("update:model-value", f);
271
- }
272
- return (f, w) => {
273
- const l = b("FmCard"), n = b("FmHelperText");
274
- return p(), C("div", mt, [
275
- s("div", ft, [
276
- (p(), C(O, null, ie(m, (c) => i(l, {
277
- variant: "outlined",
278
- class: re(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-2", {
279
- "col-span-2": m.length == 1,
280
- "border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": f.modelValue === c.value,
281
- "hover:bg-fm-color-opacity-sm": f.modelValue !== c.value
282
- }]),
283
- onClick: (k) => y(c.value),
284
- key: c.value
285
- }, {
286
- default: E(() => [
287
- s("div", yt, D(c.label), 1),
288
- s("div", gt, D(c.sublabel), 1)
289
- ]),
290
- _: 2
291
- }, 1032, ["class", "onClick"])), 64))
292
- ]),
293
- f.errorText ? (p(), J(n, {
294
- key: 0,
295
- class: "!mt-4",
296
- text: f.errorText,
297
- state: "error"
298
- }, null, 8, ["text"])) : le("", !0)
299
- ]);
300
- };
301
- }
302
- }), _t = { class: "flex items-center gap-x-8" }, ht = /* @__PURE__ */ s("div", null, "Review segment", -1), St = {
303
- key: 0,
304
- class: "space-y-16 pr-12"
305
- }, xt = { class: "flex flex-col space-y-16" }, bt = /* @__PURE__ */ s("div", { class: "fm-typo-en-title-sm-800" }, "Segment Type", -1), wt = {
306
- key: 0,
307
- class: "flex flex-col space-y-16"
308
- }, Ft = /* @__PURE__ */ s("div", { class: "fm-typo-en-title-sm-800" }, "Segment Filter", -1), kt = {
309
- key: 1,
310
- class: "flex flex-col space-y-16"
311
- }, Ct = {
312
- key: 2,
313
- class: "flex flex-col space-y-16"
314
- }, It = /* @__PURE__ */ s("div", { class: "fm-typo-en-title-sm-800" }, "Segment Status", -1), Mt = { class: "flex items-center gap-8" }, Tt = /* @__PURE__ */ ee({
315
- __name: "SegmentSheet",
316
- emits: ["update:model-value"],
317
- setup(e, { expose: v, emit: _ }) {
318
- const F = Ve(), m = z(!1), y = z(!1), f = {
319
- name: "",
320
- isActive: !0,
321
- type: A.enum.DYNAMIC,
322
- rule: ge.scaffoldGroup(),
323
- members: []
324
- }, w = Ke, l = z(f), n = ce(() => {
325
- const u = w.safeParse(l.value);
326
- return u.success ? [] : u.error.errors;
327
- });
328
- function c(u) {
329
- m.value = !0, y.value = !1, u ? l.value = {
330
- ...u,
331
- isActive: u.isActive !== !1,
332
- type: u.type ?? (u.importFile ? A.enum.STATIC : A.enum.DYNAMIC)
333
- } : l.value = { ...f };
334
- }
335
- function k() {
336
- m.value = !1;
337
- }
338
- async function $() {
339
- w.safeParse(l.value).success && (y.value = !0);
340
- }
341
- function h() {
342
- y.value = !1;
343
- }
344
- async function S() {
345
- l.value.type === A.enum.STATIC ? (l.value.rule = ge.scaffoldGroup(), l.value.isActive = !0) : l.value.file = void 0, I("update:model-value", l.value);
346
- }
347
- async function x(u) {
348
- l.value.type = u;
349
- }
350
- Se(async () => {
351
- });
352
- const I = _;
353
- return v({
354
- showSheet: c,
355
- hideSheet: k
356
- }), (u, r) => {
357
- const g = b("FmButton"), U = b("FmSwitch"), o = b("FmSideSheet");
358
- return p(), J(o, {
359
- modelValue: t(m),
360
- "onUpdate:modelValue": r[8] || (r[8] = (a) => Ie(m) ? m.value = a : null),
361
- header: "Add segment",
362
- "dismiss-away": "",
363
- "close-button": !0,
364
- "max-width": 1100
365
- }, Me({
366
- "side-sheet-footer": E(() => [
367
- s("div", Mt, [
368
- t(y) || t(l).type === t(A).enum.STATIC ? (p(), C(O, { key: 0 }, [
369
- i(g, {
370
- label: "Save Segment",
371
- onClick: S,
372
- loading: t(F).isLoading,
373
- disabled: t(n).length > 0 || t(F).isLoading
374
- }, null, 8, ["loading", "disabled"]),
375
- i(g, {
376
- label: "Cancel",
377
- onClick: r[6] || (r[6] = (a) => h()),
378
- variant: "tertiary"
379
- })
380
- ], 64)) : (p(), C(O, { key: 1 }, [
381
- i(g, {
382
- label: "Review Segment",
383
- disabled: t(n).length > 0 || t(F).isLoading,
384
- onClick: $
385
- }, null, 8, ["disabled"]),
386
- i(g, {
387
- label: "Cancel",
388
- onClick: r[7] || (r[7] = (a) => k()),
389
- variant: "tertiary"
390
- })
391
- ], 64))
392
- ])
393
- ]),
394
- default: E(() => {
395
- var a;
396
- return [
397
- t(y) ? (p(), J(pt, {
398
- key: 1,
399
- title: t(l).name,
400
- segment: t(l)
401
- }, null, 8, ["title", "segment"])) : (p(), C("div", St, [
402
- i(Ue, {
403
- modelValue: t(l).name,
404
- "onUpdate:modelValue": r[1] || (r[1] = (d) => t(l).name = d),
405
- label: "Segment title",
406
- schema: t(Be).typeAtPath(t(w), "name")
407
- }, null, 8, ["modelValue", "schema"]),
408
- s("div", xt, [
409
- bt,
410
- i(vt, {
411
- "model-value": t(l).type,
412
- "onUpdate:modelValue": r[2] || (r[2] = (d) => {
413
- x(d);
414
- })
415
- }, null, 8, ["model-value"])
416
- ]),
417
- t(l).type === t(A).enum.DYNAMIC ? (p(), C("div", wt, [
418
- Ft,
419
- i(Le, {
420
- "trigger-type": "MEMBERSHIP_JOINED",
421
- includeOnly: "user",
422
- "model-value": (a = t(l)) == null ? void 0 : a.rule,
423
- "onUpdate:modelValue": r[3] || (r[3] = (d) => {
424
- t(l).rule = d;
425
- })
426
- }, null, 8, ["model-value"])
427
- ])) : (p(), C("div", kt, [
428
- i(st, {
429
- importFile: t(l).importFile,
430
- "onUpdate:file": r[4] || (r[4] = (d) => {
431
- t(l).file = d;
432
- })
433
- }, null, 8, ["importFile"])
434
- ])),
435
- t(l).type === t(A).enum.DYNAMIC ? (p(), C("div", Ct, [
436
- It,
437
- i(U, {
438
- "model-value": t(l).isActive ?? !0,
439
- "onUpdate:modelValue": r[5] || (r[5] = (d) => t(l).isActive = d),
440
- label: "Active",
441
- sublabel: "When enabled, this will recalculate the segment statistics daily.",
442
- "label-placement": "right"
443
- }, null, 8, ["model-value"])
444
- ])) : le("", !0)
445
- ]))
446
- ];
447
- }),
448
- _: 2
449
- }, [
450
- t(y) ? {
451
- name: "side-sheet-header",
452
- fn: E(() => [
453
- s("div", _t, [
454
- i(g, {
455
- icon: "arrow_back",
456
- variant: "tertiary",
457
- onClick: r[0] || (r[0] = (a) => y.value = !1)
458
- }),
459
- ht
460
- ])
461
- ]),
462
- key: "0"
463
- } : void 0
464
- ]), 1032, ["modelValue"]);
465
- };
466
- }
467
- }), he = He(), Et = ke();
468
- function se(e) {
469
- const v = G(e);
470
- return v.isValid() ? v.format("DD/MM/YYYY") : "";
471
- }
472
- const $t = {
473
- mapMemberExportRow: (e) => {
474
- var n, c, k, $, h, S, x, I, u, r, g, U, o, a, d, P, R, B, V, j, q, H, te, M, Q, de, ue, pe;
475
- const v = ce(() => Et.locations.map((T) => ({
476
- label: T.name,
477
- value: T._id
478
- }))), _ = (n = Pe.parseOneAddress(
479
- e == null ? void 0 : e.email
480
- )) != null && n.domain.includes("feedmepos.com") ? void 0 : e.email, F = (k = ((c = e == null ? void 0 : e.collection) == null ? void 0 : c.TITLE) || []) == null ? void 0 : k.reduce(
481
- (T, L) => {
482
- var K, Z;
483
- const W = (Z = (K = he.sortedTitles) == null ? void 0 : K.find(
484
- (oe) => oe._id === L.collectible
485
- )) == null ? void 0 : Z.name;
486
- return !W || L.balance <= 0 || T.push(W), T;
487
- },
488
- []
489
- ), m = (he.sortedTitles || []).reduce(
490
- (T, L) => {
491
- var K, Z, oe, me;
492
- const W = (me = (oe = (Z = (((K = e == null ? void 0 : e.collection) == null ? void 0 : K.TITLE) || []).find(
493
- (Ce) => Ce.collectible === L._id
494
- )) == null ? void 0 : Z.expiryBalance) == null ? void 0 : oe[0]) == null ? void 0 : me.expiredAt;
495
- return T[L.name] = W ? G(W).format("DD/MM/YYYY") : "", T;
496
- },
497
- {}
498
- ), y = ((S = (h = ($ = e.collection) == null ? void 0 : $.CREDIT) == null ? void 0 : h.at(0)) == null ? void 0 : S.balance) || 0, f = ((r = (u = (I = (x = e.collection) == null ? void 0 : x.CREDIT) == null ? void 0 : I.at(0)) == null ? void 0 : u.expiryBalance) == null ? void 0 : r.reduce(
499
- (T, L) => T + L.amount,
500
- 0
501
- )) || 0, w = Je(y, 2);
502
- return {
503
- ID: e._id.toString(),
504
- Name: ((g = e.name) == null ? void 0 : g.trim()) || "",
505
- Phone: ((U = e == null ? void 0 : e.phoneNumber) == null ? void 0 : U.trim()) || "",
506
- Email: _ || "",
507
- Gender: e.gender || "",
508
- CardNo: e.cardNo || "",
509
- Birthday: e != null && e.birthday ? se(e == null ? void 0 : e.birthday) : "",
510
- Credit: parseFloat((Number(w) - Number(f)).toFixed(2)),
511
- FreeCredit: Number(f.toFixed(2)),
512
- TotalCredit: Number(w),
513
- Exp: e != null && e.collection ? ((d = (a = (o = e.collection) == null ? void 0 : o.POINT) == null ? void 0 : a.at(0)) == null ? void 0 : d.balance) ?? 0 : 0,
514
- Point: e != null && e.collection ? ((B = (R = (P = e.collection) == null ? void 0 : P.COIN) == null ? void 0 : R.at(0)) == null ? void 0 : B.balance) ?? 0 : 0,
515
- 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,
516
- Tier: e != null && e.collection ? ((M = (te = (H = e.collection) == null ? void 0 : H.TIER) == null ? void 0 : te.at(0)) == null ? void 0 : M.balance) ?? 0 : 0,
517
- Titles: F.join(","),
518
- ...m,
519
- TotalTransaction: e.stats.visitCount,
520
- AvgSpent: Qe(Number(e.stats.avgBillSize || 0)).toFormat(
521
- !1
522
- ),
523
- TotalSpent: e.stats.avgBillSize * e.stats.visitCount,
524
- LastVisit: se(e.stats.lastVisit),
525
- Feedback: ((Q = e.stats) == null ? void 0 : Q.feedbackCount) || 0,
526
- LastSeasonTierEarned: ((de = e.stats) == null ? void 0 : de.lastSeasonTierEarned) || 0,
527
- LastSeasonPointEarned: ((ue = e.stats) == null ? void 0 : ue.lastSeasonPointEarned) || 0,
528
- JoinedAt: se(e.joinAt || void 0),
529
- JoinedAtLocation: e.location && ((pe = v.value.find((T) => T.value == e.location)) == null ? void 0 : pe.label) || "-",
530
- VisitFrequency: `${Number(
531
- Math.ceil(e.stats.avgVisitFrequency).toFixed(0)
532
- )}`
533
- };
534
- }
535
- }, Rt = { class: "flex items-center" }, At = { class: "fm-typo-en-title-md-600 fm-step-title line-clamp-2 mr-8" }, Dt = { class: "px-24 flex flex-col gap-y-16" }, Pt = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, Nt = { class: "fm-typo-en-body-md-600" }, Bt = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, Vt = /* @__PURE__ */ s("img", {
536
- src: Ee,
537
- class: "aspect-square w-[150px]"
538
- }, null, -1), Yt = /* @__PURE__ */ s("div", { class: "flex flex-col gap-16 text-center" }, [
539
- /* @__PURE__ */ s("div", { class: "fm-typo-en-title-sm-800" }, "Create customer segments"),
540
- /* @__PURE__ */ s("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. ")
541
- ], -1), ho = /* @__PURE__ */ ee({
542
- __name: "Segment",
543
- setup(e) {
544
- const { minor: v } = Re, { t: _ } = we(), F = ke(), { mapMemberExportRow: m } = $t, y = Ae(), f = We(), w = z(0), l = [
545
- {
546
- header: _("connect.loyalty.segment.table.name"),
547
- accessorFn: (o) => o.name
548
- },
549
- {
550
- header: _("connect.loyalty.segment.table.status"),
551
- enableSorting: !1,
552
- cell(o) {
553
- const a = o.row.original.isActive === !1 ? "Inactive" : "Active";
554
- return Y(X.FmChip, {
555
- class: o.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",
556
- label: a,
557
- compact: !0
558
- });
559
- }
560
- },
561
- {
562
- header: _("connect.loyalty.segment.table.total_customers"),
563
- accessorFn: (o) => o.memberCount ?? 0
564
- },
565
- {
566
- header: _("connect.loyalty.segment.table.customer_percentage"),
567
- accessorFn: (o) => ((o.memberCount ?? 0) * 100 / w.value).toFixed(2)
568
- },
569
- {
570
- header: _("connect.loyalty.segment.table.actions"),
571
- meta: {
572
- maxWidth: "100px"
573
- },
574
- cell(o) {
575
- return Y("div", { class: "flex items-center justify-end" }, [
576
- Y(
577
- X.FmMenu,
578
- {
579
- placement: "bottom-end",
580
- onClick: (a) => {
581
- a.stopPropagation();
582
- }
583
- },
584
- {
585
- "menu-button": () => Y(X.FmButton, {
586
- icon: "more_vert",
587
- iconColor: "neutral-gray-400",
588
- variant: "tertiary"
589
- }),
590
- default: () => [
591
- Y(
592
- X.FmMenuItem,
593
- {
594
- onClick: async (a) => {
595
- a.stopPropagation(), x(o.row.original);
596
- }
597
- },
598
- {
599
- label: Y(
600
- "div",
601
- {
602
- class: "fm-typo-en-body-md-400"
603
- },
604
- "Export"
605
- )
606
- }
607
- ),
608
- Y(
609
- X.FmMenuItem,
610
- {
611
- onClick: async (a) => {
612
- a.stopPropagation(), S(o.row.original);
613
- }
614
- },
615
- {
616
- label: Y(
617
- "div",
618
- {
619
- class: "text-fm-color-typo-error fm-typo-en-body-md-400"
620
- },
621
- "Remove"
622
- )
623
- }
624
- )
625
- ]
626
- }
627
- )
628
- ]);
629
- }
630
- }
631
- ], n = z(null), { tableMeta: c, rowData: k, debouncedFetchData: $ } = xe(
632
- N.readAll
633
- );
634
- async function h() {
635
- await v(
636
- async () => {
637
- await N.refreshSegments(), await $({ pageSize: 10, pageIndex: 0 });
638
- },
639
- { message: "Refreshing segmentations" }
640
- );
641
- }
642
- async function S(o) {
643
- await $e.remove(`Are you sure you want to remove ${o.name}?`) && await v(
644
- async () => {
645
- await N.delete(o._id), await $({ pageSize: 10, pageIndex: 0 });
646
- },
647
- {
648
- message: `Removing ${o.name}`,
649
- successMessage: `Removed ${o.name} successfully`
650
- }
651
- );
652
- }
653
- async function x(o) {
654
- const a = {
655
- sortBy: "_id",
656
- descending: !1,
657
- rowsPerPage: 1e3,
658
- page: 1,
659
- rowsNumber: 0
660
- }, d = new Ne(), P = (await ve.read({
661
- limit: 1,
662
- skip: 0,
663
- sortBy: a.sortBy,
664
- descending: a.descending
665
- })).meta.totalResources ?? 0, R = a.rowsPerPage;
666
- await v(
667
- async () => {
668
- for (let B = 0; B < P; B += R) {
669
- const V = {
670
- ...a,
671
- limit: R,
672
- skip: a.page - 1,
673
- sortBy: a.sortBy,
674
- descending: a.descending
675
- }, j = await N.paginateSegmentUsers(
676
- o._id,
677
- V
678
- );
679
- for (const q of j.resources) {
680
- const H = m(q);
681
- d.addRecord(H);
682
- }
683
- a.page++;
684
- }
685
- await Fe(
686
- d.buildExcel(),
687
- `[${o.name}]-members-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
688
- {
689
- bookType: "xlsx",
690
- bookSST: !1,
691
- type: "array"
692
- }
693
- ), a.page = 1;
694
- },
695
- {
696
- message: "Exporting member...",
697
- successMessage: "Member exported successfully"
698
- }
699
- );
700
- }
701
- async function I(o) {
702
- await v(
703
- async () => {
704
- var a;
705
- if (o.type === A.enum.STATIC) {
706
- const d = new FormData();
707
- if (d.append("file", o.file), o._id) {
708
- const { members: P, _id: R, file: B, ...V } = o;
709
- d.append("segment", JSON.stringify(V)), await N.updateStatic(o._id, d);
710
- } else {
711
- const { file: P, ...R } = o;
712
- d.append("segment", JSON.stringify(R)), await N.createStatic(d);
713
- }
714
- o.file && y.open({
715
- type: "info",
716
- title: "Import begins soon. Check Queue for updates.",
717
- action: "View",
718
- onAction: async () => {
719
- await f.push({
720
- name: _e["$connect-QUEUE"],
721
- query: { type: [fe.enum.SEGMENTATION_IMPORTED] }
722
- });
723
- }
724
- });
725
- } else if (o._id) {
726
- const { members: d, _id: P, ...R } = o;
727
- await N.update(o._id, R);
728
- } else
729
- await N.create(o);
730
- await $({ pageSize: 10, pageIndex: 0 }), (a = n.value) == null || a.hideSheet();
731
- },
732
- {
733
- message: "Saving segment",
734
- successMessage: "Segment saved"
735
- }
736
- );
737
- }
738
- function u(o) {
739
- var a;
740
- (a = n.value) == null || a.showSheet(o);
741
- }
742
- const r = {
743
- label: _("connect.navigation.queue"),
744
- value: "queue",
745
- isPrimary: !1,
746
- prependIcon: "work_history"
747
- }, g = ce(() => F.isPremium ? [
748
- r,
749
- {
750
- label: "Refresh segments",
751
- value: "refresh",
752
- prependIcon: "refresh"
753
- },
754
- {
755
- label: "Add segment",
756
- value: "add",
757
- isPrimary: !0,
758
- prependIcon: "add"
759
- }
760
- ] : []);
761
- function U(o) {
762
- switch (o) {
763
- case "add":
764
- u();
765
- break;
766
- case "refresh":
767
- h();
768
- break;
769
- case "queue":
770
- f.push({
771
- name: _e["$connect-QUEUE"],
772
- query: { type: [fe.enum.SEGMENTATION_IMPORTED] }
773
- });
774
- break;
775
- }
776
- }
777
- return Te(async () => {
778
- const { meta: o } = await ve.read({
779
- limit: 1,
780
- skip: 0,
781
- sortBy: "_id",
782
- search: void 0,
783
- descending: !1
784
- });
785
- w.value = o.totalResources ?? 0, await $({ pageSize: 10, pageIndex: 0 }), await F.readPremium(), await F.readLocations();
786
- }), (o, a) => {
787
- const d = b("FmPill"), P = b("FmPageHead"), R = b("FmIcon"), B = b("FmMenuItem"), V = b("FmMenu"), j = b("FmListItem"), q = b("FmList"), H = b("FmButton"), te = b("FmCard");
788
- return p(), C(O, null, [
789
- i(P, {
790
- title: "Segments",
791
- actions: t(g),
792
- "onClick:action": a[0] || (a[0] = (M) => U(M))
793
- }, {
794
- title: E(() => [
795
- s("div", Rt, [
796
- s("span", At, D(t(_)("connect.loyalty.segment.title")), 1),
797
- i(d, { variant: "premium" })
798
- ])
799
- ]),
800
- _: 1
801
- }, 8, ["actions"]),
802
- s("div", Dt, [
803
- t(k).length > 0 || t(c).searchValue || t(c).isLoading ? (p(), C(O, { key: 0 }, [
804
- i(be, {
805
- loading: t(c).isLoading,
806
- "row-data": t(k),
807
- "row-count": t(c).totalRows,
808
- "column-defs": l,
809
- "shrink-at": !1,
810
- "page-count": t(c).pageCount,
811
- "page-index": t(c).pageIndex,
812
- "page-size": t(c).pageSize,
813
- onRowClick: a[1] || (a[1] = (M) => {
814
- u(M.original);
815
- }),
816
- onPageChange: t($)
817
- }, null, 8, ["loading", "row-data", "row-count", "page-count", "page-index", "page-size", "onPageChange"]),
818
- i(q, { class: "w-full hidden xs:block" }, {
819
- default: E(() => [
820
- (p(!0), C(O, null, ie(t(k), (M) => (p(), J(j, {
821
- key: M._id.toString(),
822
- tag: "label",
823
- onClick: (Q) => u(M)
824
- }, {
825
- default: E(() => [
826
- s("div", null, [
827
- s("div", Pt, D((M.memberCount ?? 0).toLocaleString()) + " total customers ", 1),
828
- s("div", Nt, D(M.name), 1),
829
- s("div", Bt, D(((M.memberCount ?? 0) * 100 / t(w)).toFixed(2)) + "% of customers ", 1)
830
- ])
831
- ]),
832
- append: E(() => [
833
- i(V, { "stop-click-propagation": !0 }, {
834
- "menu-button": E(() => [
835
- i(R, { name: "more_vert" })
836
- ]),
837
- default: E(() => [
838
- i(B, {
839
- class: "text-fm-color-typo-error fm-typo-en-body-md-400",
840
- label: "Remove",
841
- "onUpdate:modelValue": (Q) => Q && S(M)
842
- }, null, 8, ["onUpdate:modelValue"])
843
- ]),
844
- _: 2
845
- }, 1024)
846
- ]),
847
- _: 2
848
- }, 1032, ["onClick"]))), 128))
849
- ]),
850
- _: 1
851
- })
852
- ], 64)) : (p(), J(te, {
853
- key: 1,
854
- variant: "outlined",
855
- class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
856
- }, {
857
- default: E(() => [
858
- Vt,
859
- Yt,
860
- i(H, {
861
- variant: "primary",
862
- label: "Create segment",
863
- disabled: !t(F).isPremium,
864
- icon: "add",
865
- onClick: a[2] || (a[2] = (M) => u())
866
- }, null, 8, ["disabled"])
867
- ]),
868
- _: 1
869
- })),
870
- i(Tt, {
871
- ref_key: "sheetRef",
872
- ref: n,
873
- "onUpdate:modelValue": I
874
- }, null, 512)
875
- ])
876
- ], 64);
877
- };
878
- }
879
- });
880
- export {
881
- ho as default
882
- };