@feedmepos/mf-connect 0.1.0-beta.74 → 0.1.0-beta.75

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 (91) hide show
  1. package/dist/{Analytic-CmX1CjHI.js → Analytic-BjvuYiVe.js} +11 -11
  2. package/dist/{App-T0HK84dx.js → App-B59UFFR_.js} +6 -6
  3. package/dist/{AuditLogs-0ERaLqfa.js → AuditLogs-CtA8tyqv.js} +9 -9
  4. package/dist/{Bin-C7utgPUn.js → Bin-CxqyxMxm.js} +8 -8
  5. package/dist/{Broadcast-e2sHc8rv.js → Broadcast-BwO_p-C6.js} +9 -9
  6. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-mlnLZOdy.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DyxpFPoX.js} +6 -6
  7. package/dist/{Card-Bi1q3NGE.js → Card-DffYD6aP.js} +35 -35
  8. package/dist/{Collections-CJYy94Sc.js → Collections-BQy1iuLr.js} +12 -12
  9. package/dist/{Credit-Mbgev3fe.js → Credit-DaIwPkW2.js} +9 -9
  10. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-CCIj2_sx.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-CN3WDlGf.js} +29 -29
  11. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-CGiI-3HJ.js → EffectSheet.vue_vue_type_style_index_0_lang-B01mfS0B.js} +6 -6
  12. package/dist/{Experience-BE9onJDQ.js → Experience-Bz_pHAWN.js} +9 -9
  13. package/dist/FileSaver.min-NlMItPOc.js +74 -0
  14. package/dist/{Game-CxVwNVRg.js → Game-D5edK798.js} +10 -10
  15. package/dist/{Index-NdgHNGa3.js → Index-IstFiAHJ.js} +10 -10
  16. package/dist/{Marketing-Deds20Ye.js → Marketing-CQkuEJpz.js} +6 -6
  17. package/dist/Member-DivzZ91c.js +287 -0
  18. package/dist/{MemberList-DCR44Sk4.js → MemberList-C4VS9NUh.js} +25 -25
  19. package/dist/{MemberTransactions-CYPPTT9t.js → MemberTransactions-UqNAwlMQ.js} +1 -1
  20. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-j3cmjEyQ.js → MessageInput.vue_vue_type_script_setup_true_lang-CLjPB5Fx.js} +8 -8
  21. package/dist/{Mission-DYk_Vv35.js → Mission-BIU1n3Kq.js} +10 -10
  22. package/dist/{Overview-CsRent_o.js → Overview-UX39Gyg_.js} +53 -53
  23. package/dist/{Point-BV5qm3r7.js → Point-CDwTZVUM.js} +9 -9
  24. package/dist/{Promotion-ieE1dY52.js → Promotion-BjLLnek1.js} +10 -10
  25. package/dist/{Queue-DkIuyH5Y.js → Queue-NMym8jKY.js} +13 -13
  26. package/dist/{Record-BO4eYofF.js → Record-CO396riY.js} +8 -8
  27. package/dist/{Reward-DcoWW28K.js → Reward-Dz_pXOtZ.js} +15 -15
  28. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-6s4ElOcQ.js → RewardGroup.vue_vue_type_script_setup_true_lang-ZN5mwP8O.js} +11 -11
  29. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-l-qayOI8.js → RuleGroup.vue_vue_type_script_setup_true_lang-Fk8N3r8K.js} +13 -13
  30. package/dist/Segment--uEU_t9R.js +837 -0
  31. package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-Dei-K3cP.js → SelectItems.vue_vue_type_script_setup_true_lang-DqruveTr.js} +2 -2
  32. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-B0fwBafY.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-Cf8kL4wK.js} +11 -11
  33. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-Dl30f-41.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-CZ_RNT8I.js} +3 -3
  34. package/dist/{Setting-Cnv36Pu0.js → Setting-Bh7mlr2i.js} +38 -38
  35. package/dist/{Store-CTK5EtS1.js → Store-80fnSDSi.js} +19 -19
  36. package/dist/{StoreRewards-CnHiDS7A.js → StoreRewards-CDo3kQvj.js} +13 -13
  37. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-o8BduJhH.js → StoreTransactions.vue_vue_type_script_setup_true_lang-BvDQULQ_.js} +19 -19
  38. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-CDCQIDZh.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-C9oPzMCz.js} +1 -1
  39. package/dist/{Tier-CcN8habX.js → Tier-CnChpbAP.js} +20 -20
  40. package/dist/{Title-DtsvtR89.js → Title-DPEnOWJ4.js} +19 -19
  41. package/dist/{Transaction-NylYY_6m.js → Transaction-Cmbvmc91.js} +2 -2
  42. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-Book86tM.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-BIk7daH2.js} +6 -6
  43. package/dist/{Voucher-z6XGrJrc.js → Voucher-Ksr4yCA9.js} +12 -12
  44. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-C0TGO7Cl.js → VoucherEditor.vue_vue_type_script_setup_true_lang-DVhNNGM4.js} +10 -10
  45. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-Du4wOEBs.js → ZodTextField.vue_vue_type_script_setup_true_lang-CnOZAoED.js} +1 -1
  46. package/dist/{app-nEHwJezD.js → app-Bm2EB0kn.js} +427 -423
  47. package/dist/{app-Dew6WljN.js → app-DMZJB6n5.js} +1 -1
  48. package/dist/app.js +1 -1
  49. package/dist/{business-CXTuYix4.js → business-RCVpOGhZ.js} +1 -1
  50. package/dist/{campaign-C18IUOcO.js → campaign-2xFhapQA.js} +2 -2
  51. package/dist/{campaign-BZs7RPUJ.js → campaign-CQe4sZi3.js} +9 -9
  52. package/dist/{campaign.enum-C7o8B5Cf.js → campaign.enum-BFW4DlQi.js} +1 -1
  53. package/dist/{campaign.fn-CP0x2e6M.js → campaign.fn-jn5byV7K.js} +68 -68
  54. package/dist/{collectible.enum-QJSyw8dX.js → collectible.enum-36NDAm6r.js} +1 -1
  55. package/dist/{collection.fn-_9GY8WUr.js → collection.fn-Tm-glYmK.js} +2 -2
  56. package/dist/{dto-Cwr4tMef.js → dto-CkgQyqvh.js} +12 -12
  57. package/dist/{effect-C3dyQmVR.js → effect-9xJwRyTT.js} +1 -1
  58. package/dist/{email-addresses-DNwlAZV3.js → email-addresses-BSevcd1s.js} +1 -1
  59. package/dist/{export-C11NCFgO.js → export-C6NNy3VD.js} +3 -3
  60. package/dist/{helper-HHvZd4M_.js → helper-C6jcyBxj.js} +1 -1
  61. package/dist/{index-CCTd1lLH.js → index-B1WcRD2p.js} +189 -187
  62. package/dist/{index-DyfTL0NG.js → index-BGDXeXr8.js} +1 -1
  63. package/dist/{index-DJ-RhIDQ.js → index-BdvjEImc.js} +1 -1
  64. package/dist/{index-CyXkN89w.js → index-BmhqYexg.js} +2 -2
  65. package/dist/{index-CT4Hyf4w.js → index-BwaxudDP.js} +6 -6
  66. package/dist/{index-yrwLRgg0.js → index-C-co08N1.js} +3 -3
  67. package/dist/{index-B0zezW3E.js → index-CO-OulIR.js} +1 -1
  68. package/dist/{index-jdsxOVkp.js → index-CwNmmnDD.js} +3 -3
  69. package/dist/{index-BzIzz7cS.js → index-DLrnBs0d.js} +3 -3
  70. package/dist/{index-DM6Zvwcl.js → index-DayAM5ca.js} +1 -1
  71. package/dist/{index-CL0DvpMU.js → index-REJVA8tS.js} +1 -1
  72. package/dist/{index-CIKyf9ft.js → index-tV74UysB.js} +1 -1
  73. package/dist/{index-8MnjnTtN.js → index-uY4KbIOv.js} +1 -1
  74. package/dist/{index.esm2017-BMFlbxdx.js → index.esm2017-BqFEBS5T.js} +59 -59
  75. package/dist/{loading-ClVTDQc6.js → loading-CEMhV8o1.js} +1 -1
  76. package/dist/{membership-DqMQPgdF.js → membership-BQmk2NO_.js} +3 -3
  77. package/dist/{money-COS1BMzW.js → money-C-MUHPgR.js} +1 -1
  78. package/dist/{number-BuP5vRmO.js → number-ZqYa2VPD.js} +1 -1
  79. package/dist/{objectid-B3LrrWLD.js → objectid-m5eVUTKS.js} +6 -6
  80. package/dist/{plugins-DWMQmNXZ.js → plugins-CPTqOd-U.js} +2 -2
  81. package/dist/{reward-Dh8eazpS.js → reward-BQ67vXz7.js} +1 -1
  82. package/dist/{rule-CaiZcfw4.js → rule-GLbI8tc9.js} +3 -3
  83. package/dist/{rule-builder-DOHyUDI2.js → rule-builder-Kv000bdR.js} +1 -1
  84. package/dist/{template-BZCh-lEH.js → template-JSYful0r.js} +4 -4
  85. package/dist/{trigger-CUY_7-so.js → trigger-DsWgM26r.js} +4 -4
  86. package/dist/{user-DWsuhUnL.js → user-kPXx7B0k.js} +1 -1
  87. package/dist/{vue-i18n-BXjn2dYe.js → vue-i18n-CTzFvJGR.js} +144 -144
  88. package/dist/{xlsx-BGsRNT8x.js → xlsx-BeEGdbvi.js} +166 -166
  89. package/package.json +1 -1
  90. package/dist/Member-BiwCcUbl.js +0 -357
  91. package/dist/Segment-dTpsHadj.js +0 -794
@@ -1,794 +0,0 @@
1
- import { defineComponent as K, ref as N, resolveComponent as h, openBlock as f, createElementBlock as C, createElementVNode as i, createVNode as d, unref as t, createCommentVNode as ye, createBlock as G, toDisplayString as $, normalizeClass as ne, onMounted as ve, Fragment as H, renderList as _e, withCtx as R, computed as se, isRef as be, createSlots as Ce, h as V, onBeforeMount as ke } from "vue";
2
- import { _ as Me } from "./campaign-CpzFl8Vr.js";
3
- import { p as Ie } from "./plugins-DWMQmNXZ.js";
4
- import { u as Re } from "./loading-ClVTDQc6.js";
5
- import { FmButtonVariant as oe, useSnackbar as Ee, components as te } from "@feedmepos/ui-library";
6
- import { u as xe, _ as Se } from "./usePagination-BeF5K3M7.js";
7
- import { u as he } from "./vue-i18n-BXjn2dYe.js";
8
- import "./index-CT4Hyf4w.js";
9
- import { i as $e, c as de } from "./index-CCTd1lLH.js";
10
- import "./index-CyXkN89w.js";
11
- import "./index-CL0DvpMU.js";
12
- import "./index-yrwLRgg0.js";
13
- import { w as Te } from "./xlsx-BGsRNT8x.js";
14
- import { e as Pe, M as De } from "./email-addresses-DNwlAZV3.js";
15
- import { Z as Ae } from "./zod-Bg2FbC-D.js";
16
- import { u as Be } from "./app-wDQR6dpb.js";
17
- import { F as ue, z as Ve } from "./index-jdsxOVkp.js";
18
- import { R as pe } from "./rule-builder-DOHyUDI2.js";
19
- import { _ as Ne } from "./ZodTextField.vue_vue_type_script_setup_true_lang-Du4wOEBs.js";
20
- import { _ as Le } from "./RuleGroup.vue_vue_type_script_setup_true_lang-l-qayOI8.js";
21
- import { u as Ye, v as Ue, w as ze } from "./index.esm2017-BMFlbxdx.js";
22
- import { h as j } from "./moment-BWErdI6_.js";
23
- import { s as P, u as Oe } from "./membership-DqMQPgdF.js";
24
- import { o as qe } from "./objectId-dwaoBfJX.js";
25
- import { u as Fe } from "./business-CXTuYix4.js";
26
- import { f as je } from "./number-BuP5vRmO.js";
27
- import { t as He } from "./money-COS1BMzW.js";
28
- import "./index-8MnjnTtN.js";
29
- import { useRouter as Ge } from "vue-router";
30
- import { m as me } from "./index-DyfTL0NG.js";
31
- import { R as fe } from "./app-nEHwJezD.js";
32
- const Je = $e.extend({
33
- _id: ue.optional(),
34
- business: ue.optional(),
35
- file: Ve.any().nullish()
36
- }), Qe = { class: "flex flex-col space-y-16" }, Ze = {
37
- key: 0,
38
- class: /* @__PURE__ */ ne([
39
- "p-16 pl-24 space-x-8",
40
- "bg-fm-color-primary-oats rounded-lg",
41
- "flex items-center",
42
- "justify-between"
43
- ])
44
- }, We = {
45
- key: 2,
46
- class: /* @__PURE__ */ ne([
47
- "flex items-center",
48
- "border border-fm-color-neutral-gray-300",
49
- "p-16 space-x-16 rounded-md"
50
- ])
51
- }, Ke = { class: "fm-typo-en-body-lg-400 flex-1 truncate" }, Xe = /* @__PURE__ */ K({
52
- __name: "ImportSegment",
53
- props: {
54
- importFile: {}
55
- },
56
- emits: ["update:file"],
57
- setup(e, { emit: g }) {
58
- const _ = e, x = g, { t: u } = he(), m = N(null), p = N(null);
59
- async function S() {
60
- if (_.importFile)
61
- try {
62
- const n = Ye(), c = Ue(n, _.importFile), y = await ze(c);
63
- window.open(y, "_blank");
64
- } catch (n) {
65
- console.log(n);
66
- }
67
- }
68
- function l(n) {
69
- m.value = n, x("update:file", m.value);
70
- }
71
- function s(n) {
72
- var y, I;
73
- const c = ((I = (y = n.target) == null ? void 0 : y.files) == null ? void 0 : I[0]) ?? null;
74
- l(c);
75
- }
76
- return (n, c) => {
77
- const y = h("FmButton"), I = h("FmDropField");
78
- return f(), C("div", Qe, [
79
- c[2] || (c[2] = i("div", { class: "fm-typo-en-title-sm-800" }, "Upload File", -1)),
80
- n.importFile ? (f(), C("div", Ze, [
81
- d(y, {
82
- label: t(u)("View uploaded file"),
83
- variant: t(oe).Plain,
84
- icon: "file_present",
85
- onClick: S
86
- }, null, 8, ["label", "variant"])
87
- ])) : ye("", !0),
88
- m.value ? (f(), C("div", We, [
89
- d(y, {
90
- variant: t(oe).Tertiary,
91
- "prepend-icon": "attach_file"
92
- }, null, 8, ["variant"]),
93
- i("p", Ke, $(m.value.name), 1),
94
- i("label", {
95
- ref_key: "fileLabelRef",
96
- ref: p,
97
- htmlFor: "file"
98
- }, [
99
- d(y, {
100
- variant: t(oe).Plain,
101
- label: t(u)("Replace File"),
102
- onClick: c[1] || (c[1] = () => {
103
- var k;
104
- return (k = p.value) == null ? void 0 : k.click();
105
- })
106
- }, null, 8, ["variant", "label"]),
107
- i("input", {
108
- id: "file",
109
- accept: ".csv, .xlsx",
110
- class: "hidden",
111
- type: "file",
112
- multiple: "",
113
- onChange: s
114
- }, null, 32)
115
- ], 512)
116
- ])) : (f(), G(I, {
117
- key: 1,
118
- onFileUpload: c[0] || (c[0] = (k) => l(k)),
119
- accept: ".csv",
120
- "max-file-size": 2e7
121
- }))
122
- ]);
123
- };
124
- }
125
- }), et = { class: "space-y-16 pr-12" }, tt = { class: "fm-typo-en-title-md-800" }, ot = { class: "flex space-x-8" }, at = { class: "fm-typo-en-title-md-800 text-fm-color-primary" }, nt = { class: "text-fm-color-typo-secondary" }, st = /* @__PURE__ */ K({
126
- __name: "ReviewSegment",
127
- props: {
128
- title: {},
129
- segment: {}
130
- },
131
- setup(e) {
132
- const g = e, _ = [
133
- {
134
- header: "Name",
135
- accessorFn: (s) => s.name
136
- },
137
- {
138
- header: "Id",
139
- accessorFn: (s) => s._id
140
- },
141
- {
142
- header: "Customer Since",
143
- accessorFn: (s) => j(qe(s._id.toString())).format("DD MMM YYYY")
144
- },
145
- {
146
- header: "Phone",
147
- accessorFn: (s) => s.phoneNumber
148
- },
149
- {
150
- header: "Birthday",
151
- accessorFn: (s) => j(s.birthday).format("DD MMM YYYY")
152
- },
153
- {
154
- header: "Last Visit",
155
- accessorFn: (s) => j(s.stats.lastVisit).format("DD MMM YYYY")
156
- }
157
- ], x = async (s) => g.segment._id ? await P.paginateSegmentUsers(g.segment._id, {
158
- limit: u.value.pageSize,
159
- skip: s.pageIndex ?? 0,
160
- sortBy: "_id",
161
- search: s.searchValue,
162
- descending: !0
163
- }) : { resources: [], meta: { totalResources: 0, totalPages: 0 } }, { tableMeta: u, rowData: m, onSort: p, debouncedFetchData: S, onSearch: l } = xe(x);
164
- return ve(async () => {
165
- await S();
166
- }), (s, n) => (f(), C("div", et, [
167
- i("div", tt, $(g.title), 1),
168
- i("div", ot, [
169
- i("div", at, $(s.segment.members.length), 1),
170
- i("div", nt, [
171
- n[1] || (n[1] = i("div", null, "contacts in your segment", -1)),
172
- i("div", null, "as of " + $(t(j)(s.segment.lastUpdated).format("DD MMM YYYY")), 1)
173
- ])
174
- ]),
175
- d(Se, {
176
- loading: t(u).isLoading,
177
- "row-data": t(m),
178
- "row-count": t(u).totalRows,
179
- "column-defs": _,
180
- "page-size": t(u).pageSize,
181
- "page-count": t(u).pageCount,
182
- "page-index": t(u).pageIndex,
183
- onSortChange: t(p),
184
- onPageChange: n[0] || (n[0] = (c) => t(S)({ pageSize: c.pageSize, pageIndex: c.pageIndex }))
185
- }, null, 8, ["loading", "row-data", "row-count", "page-size", "page-count", "page-index", "onSortChange"])
186
- ]));
187
- }
188
- }), it = { class: "space-y-24" }, lt = { class: "grid grid-cols-2 gap-16" }, rt = { class: "fm-typo-en-title-sm-800" }, ct = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, dt = /* @__PURE__ */ K({
189
- __name: "SegmentRecalculationOption",
190
- props: {
191
- modelValue: { type: Boolean },
192
- errorText: {}
193
- },
194
- emits: ["update:model-value"],
195
- setup(e, { emit: g }) {
196
- const _ = e, x = g, u = [
197
- {
198
- label: "Active",
199
- sublabel: "Segment statistics are based on rules configured and will be recalculated automatically when rule changes.",
200
- value: !0
201
- },
202
- {
203
- label: "Inactive",
204
- sublabel: "Segment statistics are based on imported data and will not be recalculated.",
205
- value: !1
206
- }
207
- ];
208
- function m(p) {
209
- p !== _.modelValue && x("update:model-value", p);
210
- }
211
- return (p, S) => {
212
- const l = h("FmCard"), s = h("FmHelperText");
213
- return f(), C("div", it, [
214
- i("div", lt, [
215
- (f(), C(H, null, _e(u, (n) => d(l, {
216
- variant: "outlined",
217
- class: ne(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-2", {
218
- "col-span-2": u.length == 1,
219
- "border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": p.modelValue === n.value,
220
- "hover:bg-fm-color-opacity-sm": p.modelValue !== n.value
221
- }]),
222
- onClick: (c) => m(n.value),
223
- key: n.value
224
- }, {
225
- default: R(() => [
226
- i("div", rt, $(n.label), 1),
227
- i("div", ct, $(n.sublabel), 1)
228
- ]),
229
- _: 2
230
- }, 1032, ["class", "onClick"])), 64))
231
- ]),
232
- p.errorText ? (f(), G(s, {
233
- key: 0,
234
- class: "!mt-4",
235
- text: p.errorText,
236
- state: "error"
237
- }, null, 8, ["text"])) : ye("", !0)
238
- ]);
239
- };
240
- }
241
- }), ut = { class: "flex items-center gap-x-8" }, pt = {
242
- key: 0,
243
- class: "space-y-16 pr-12"
244
- }, mt = { class: "flex flex-col space-y-16" }, ft = {
245
- key: 0,
246
- class: "flex flex-col space-y-16"
247
- }, gt = {
248
- key: 1,
249
- class: "flex flex-col space-y-16"
250
- }, yt = { class: "flex items-center gap-8" }, vt = /* @__PURE__ */ K({
251
- __name: "SegmentSheet",
252
- emits: ["update:model-value"],
253
- setup(e, { expose: g, emit: _ }) {
254
- const x = Be(), u = N(!1), m = N(!1), p = {
255
- name: "",
256
- isActive: !0,
257
- rule: pe.scaffoldGroup(),
258
- members: []
259
- }, S = Je, l = N(p), s = se(() => {
260
- const v = S.safeParse(l.value);
261
- return v.success ? [] : v.error.errors;
262
- });
263
- function n(v) {
264
- u.value = !0, m.value = !1, v ? l.value = {
265
- ...v,
266
- isActive: v.isActive !== !1
267
- } : l.value = { ...p };
268
- }
269
- function c() {
270
- u.value = !1;
271
- }
272
- async function y() {
273
- S.safeParse(l.value).success && (m.value = !0);
274
- }
275
- function I() {
276
- m.value = !1;
277
- }
278
- async function k() {
279
- l.value.isActive === !1 ? l.value.rule = pe.scaffoldGroup() : l.value.file = void 0, Y("update:model-value", l.value);
280
- }
281
- async function L(v) {
282
- l.value.isActive = v;
283
- }
284
- ve(async () => {
285
- });
286
- const Y = _;
287
- return g({
288
- showSheet: n,
289
- hideSheet: c
290
- }), (v, r) => {
291
- const E = h("FmButton"), U = h("FmSideSheet");
292
- return f(), G(U, {
293
- modelValue: t(u),
294
- "onUpdate:modelValue": r[7] || (r[7] = (o) => be(u) ? u.value = o : null),
295
- header: "Add segment",
296
- "dismiss-away": "",
297
- "close-button": !0,
298
- "max-width": 1100
299
- }, Ce({
300
- "side-sheet-footer": R(() => [
301
- i("div", yt, [
302
- t(m) || !t(l).isActive ? (f(), C(H, { key: 0 }, [
303
- d(E, {
304
- label: "Save Segment",
305
- onClick: k,
306
- loading: t(x).isLoading,
307
- disabled: t(s).length > 0 || t(x).isLoading
308
- }, null, 8, ["loading", "disabled"]),
309
- d(E, {
310
- label: "Cancel",
311
- onClick: r[5] || (r[5] = (o) => I()),
312
- variant: "tertiary"
313
- })
314
- ], 64)) : (f(), C(H, { key: 1 }, [
315
- d(E, {
316
- label: "Review Segment",
317
- disabled: t(s).length > 0 || t(x).isLoading,
318
- onClick: y
319
- }, null, 8, ["disabled"]),
320
- d(E, {
321
- label: "Cancel",
322
- onClick: r[6] || (r[6] = (o) => c()),
323
- variant: "tertiary"
324
- })
325
- ], 64))
326
- ])
327
- ]),
328
- default: R(() => {
329
- var o;
330
- return [
331
- t(m) ? (f(), G(st, {
332
- key: 1,
333
- title: t(l).name,
334
- segment: t(l)
335
- }, null, 8, ["title", "segment"])) : (f(), C("div", pt, [
336
- d(Ne, {
337
- modelValue: t(l).name,
338
- "onUpdate:modelValue": r[1] || (r[1] = (a) => t(l).name = a),
339
- label: "Segment title",
340
- schema: t(Ae).typeAtPath(t(S), "name")
341
- }, null, 8, ["modelValue", "schema"]),
342
- i("div", mt, [
343
- r[9] || (r[9] = i("div", { class: "fm-typo-en-title-sm-800" }, "Segment Type", -1)),
344
- d(dt, {
345
- "model-value": t(l).isActive,
346
- "onUpdate:modelValue": r[2] || (r[2] = (a) => {
347
- L(a);
348
- })
349
- }, null, 8, ["model-value"])
350
- ]),
351
- t(l).isActive ? (f(), C("div", ft, [
352
- r[10] || (r[10] = i("div", { class: "fm-typo-en-title-sm-800" }, "Segment Filter", -1)),
353
- d(Le, {
354
- "trigger-type": "MEMBERSHIP_JOINED",
355
- includeOnly: "user",
356
- "model-value": (o = t(l)) == null ? void 0 : o.rule,
357
- "onUpdate:modelValue": r[3] || (r[3] = (a) => {
358
- t(l).rule = a;
359
- })
360
- }, null, 8, ["model-value"])
361
- ])) : (f(), C("div", gt, [
362
- d(Xe, {
363
- importFile: t(l).importFile,
364
- "onUpdate:file": r[4] || (r[4] = (a) => {
365
- t(l).file = a;
366
- })
367
- }, null, 8, ["importFile"])
368
- ]))
369
- ]))
370
- ];
371
- }),
372
- _: 2
373
- }, [
374
- t(m) ? {
375
- name: "side-sheet-header",
376
- fn: R(() => [
377
- i("div", ut, [
378
- d(E, {
379
- icon: "arrow_back",
380
- variant: "tertiary",
381
- onClick: r[0] || (r[0] = (o) => m.value = !1)
382
- }),
383
- r[8] || (r[8] = i("div", null, "Review segment", -1))
384
- ])
385
- ]),
386
- key: "0"
387
- } : void 0
388
- ]), 1032, ["modelValue"]);
389
- };
390
- }
391
- }), ge = Oe(), _t = Fe();
392
- function ae(e) {
393
- const g = j(e);
394
- return g.isValid() ? g.format("DD/MM/YYYY") : "";
395
- }
396
- const xt = {
397
- mapMemberExportRow: (e) => {
398
- var s, n, c, y, I, k, L, Y, v, r, E, U, o, a, F, T, M, D, A, z, O, q, X, w, J, ie, le, re;
399
- const g = se(() => _t.locations.map((b) => ({
400
- label: b.name,
401
- value: b._id
402
- }))), _ = (s = Pe.parseOneAddress(
403
- e == null ? void 0 : e.email
404
- )) != null && s.domain.includes("feedmepos.com") ? void 0 : e.email, x = (c = ((n = e == null ? void 0 : e.collection) == null ? void 0 : n.TITLE) || []) == null ? void 0 : c.reduce(
405
- (b, B) => {
406
- var Z, W;
407
- const Q = (W = (Z = ge.sortedTitles) == null ? void 0 : Z.find(
408
- (ee) => ee._id === B.collectible
409
- )) == null ? void 0 : W.name;
410
- return !Q || B.balance <= 0 || b.push(Q), b;
411
- },
412
- []
413
- ), u = (ge.sortedTitles || []).reduce(
414
- (b, B) => {
415
- var Z, W, ee, ce;
416
- const Q = (ce = (ee = (W = (((Z = e == null ? void 0 : e.collection) == null ? void 0 : Z.TITLE) || []).find(
417
- (we) => we.collectible === B._id
418
- )) == null ? void 0 : W.expiryBalance) == null ? void 0 : ee[0]) == null ? void 0 : ce.expiredAt;
419
- return b[B.name] = Q ? j(Q).format("DD/MM/YYYY") : "", b;
420
- },
421
- {}
422
- ), m = ((k = (I = (y = e.collection) == null ? void 0 : y.CREDIT) == null ? void 0 : I.at(0)) == null ? void 0 : k.balance) || 0, p = ((r = (v = (Y = (L = e.collection) == null ? void 0 : L.CREDIT) == null ? void 0 : Y.at(0)) == null ? void 0 : v.expiryBalance) == null ? void 0 : r.reduce(
423
- (b, B) => b + B.amount,
424
- 0
425
- )) || 0, S = je(m, 2);
426
- return {
427
- ID: e._id.toString(),
428
- Name: ((E = e.name) == null ? void 0 : E.trim()) || "",
429
- Phone: ((U = e == null ? void 0 : e.phoneNumber) == null ? void 0 : U.trim()) || "",
430
- Email: _ || "",
431
- Gender: e.gender || "",
432
- CardNo: e.cardNo || "",
433
- Birthday: e != null && e.birthday ? ae(e == null ? void 0 : e.birthday) : "",
434
- Credit: parseFloat((Number(S) - Number(p)).toFixed(2)),
435
- FreeCredit: Number(p.toFixed(2)),
436
- TotalCredit: Number(S),
437
- Exp: e != null && e.collection ? ((F = (a = (o = e.collection) == null ? void 0 : o.POINT) == null ? void 0 : a.at(0)) == null ? void 0 : F.balance) ?? 0 : 0,
438
- Point: e != null && e.collection ? ((D = (M = (T = e.collection) == null ? void 0 : T.COIN) == null ? void 0 : M.at(0)) == null ? void 0 : D.balance) ?? 0 : 0,
439
- Level: e != null && e.collection ? ((O = (z = (A = e.collection) == null ? void 0 : A.TIER) == null ? void 0 : z.at(0)) == null ? void 0 : O.balance) ?? 0 : 0,
440
- Tier: e != null && e.collection ? ((w = (X = (q = e.collection) == null ? void 0 : q.TIER) == null ? void 0 : X.at(0)) == null ? void 0 : w.balance) ?? 0 : 0,
441
- Titles: x.join(","),
442
- ...u,
443
- TotalTransaction: e.stats.visitCount,
444
- AvgSpent: He(Number(e.stats.avgBillSize || 0)).toFormat(
445
- !1
446
- ),
447
- TotalSpent: e.stats.avgBillSize * e.stats.visitCount,
448
- LastVisit: ae(e.stats.lastVisit),
449
- Feedback: ((J = e.stats) == null ? void 0 : J.feedbackCount) || 0,
450
- LastSeasonTierEarned: ((ie = e.stats) == null ? void 0 : ie.lastSeasonTierEarned) || 0,
451
- LastSeasonPointEarned: ((le = e.stats) == null ? void 0 : le.lastSeasonPointEarned) || 0,
452
- JoinedAt: ae(e.joinAt || void 0),
453
- JoinedAtLocation: e.location && ((re = g.value.find((b) => b.value == e.location)) == null ? void 0 : re.label) || "-",
454
- VisitFrequency: `${Number(
455
- Math.ceil(e.stats.avgVisitFrequency).toFixed(0)
456
- )}`
457
- };
458
- }
459
- }, St = { class: "flex items-center" }, ht = { class: "fm-typo-en-title-md-600 fm-step-title line-clamp-2 mr-8" }, Ft = { class: "px-24 flex flex-col gap-y-16" }, wt = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, bt = { class: "fm-typo-en-body-md-600" }, Ct = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, ao = /* @__PURE__ */ K({
460
- __name: "Segment",
461
- setup(e) {
462
- const { minor: g } = Re, { t: _ } = he(), x = Fe(), { mapMemberExportRow: u } = xt, m = Ee(), p = Ge(), S = N(0), l = [
463
- {
464
- header: _("connect.loyalty.segment.table.name"),
465
- accessorFn: (o) => o.name
466
- },
467
- {
468
- header: _("connect.loyalty.segment.table.total_customers"),
469
- accessorFn: (o) => o.memberCount ?? 0
470
- },
471
- {
472
- header: _("connect.loyalty.segment.table.customer_percentage"),
473
- accessorFn: (o) => ((o.memberCount ?? 0) * 100 / S.value).toFixed(2)
474
- },
475
- {
476
- header: _("connect.loyalty.segment.table.actions"),
477
- meta: {
478
- maxWidth: "100px"
479
- },
480
- cell(o) {
481
- return V("div", { class: "flex items-center justify-end" }, [
482
- V(
483
- te.FmMenu,
484
- {
485
- placement: "bottom-end",
486
- onClick: (a) => {
487
- a.stopPropagation();
488
- }
489
- },
490
- {
491
- "menu-button": () => V(te.FmButton, {
492
- icon: "more_vert",
493
- iconColor: "neutral-gray-400",
494
- variant: "tertiary"
495
- }),
496
- default: () => [
497
- V(
498
- te.FmMenuItem,
499
- {
500
- onClick: async (a) => {
501
- a.stopPropagation(), L(o.row.original);
502
- }
503
- },
504
- {
505
- label: V(
506
- "div",
507
- {
508
- class: "fm-typo-en-body-md-400"
509
- },
510
- "Export"
511
- )
512
- }
513
- ),
514
- V(
515
- te.FmMenuItem,
516
- {
517
- onClick: async (a) => {
518
- a.stopPropagation(), k(o.row.original);
519
- }
520
- },
521
- {
522
- label: V(
523
- "div",
524
- {
525
- class: "text-fm-color-typo-error fm-typo-en-body-md-400"
526
- },
527
- "Remove"
528
- )
529
- }
530
- )
531
- ]
532
- }
533
- )
534
- ]);
535
- }
536
- }
537
- ], s = N(null), { tableMeta: n, rowData: c, debouncedFetchData: y } = xe(
538
- P.readAll
539
- );
540
- async function I() {
541
- await g(
542
- async () => {
543
- await P.refreshSegments(), await y({ pageSize: 10, pageIndex: 0 });
544
- },
545
- { message: "Refreshing segmentations" }
546
- );
547
- }
548
- async function k(o) {
549
- await Ie.remove(`Are you sure you want to remove ${o.name}?`) && await g(
550
- async () => {
551
- await P.delete(o._id), await y({ pageSize: 10, pageIndex: 0 });
552
- },
553
- {
554
- message: `Removing ${o.name}`,
555
- successMessage: `Removed ${o.name} successfully`
556
- }
557
- );
558
- }
559
- async function L(o) {
560
- const a = {
561
- sortBy: "_id",
562
- descending: !1,
563
- rowsPerPage: 1e3,
564
- page: 1,
565
- rowsNumber: 0
566
- }, F = new De(), T = (await me.read({
567
- limit: 1,
568
- skip: 0,
569
- sortBy: a.sortBy,
570
- descending: a.descending
571
- })).meta.totalResources ?? 0, M = a.rowsPerPage;
572
- await g(
573
- async () => {
574
- for (let D = 0; D < T; D += M) {
575
- const A = {
576
- ...a,
577
- limit: M,
578
- skip: a.page - 1,
579
- sortBy: a.sortBy,
580
- descending: a.descending
581
- }, z = await P.paginateSegmentUsers(
582
- o._id,
583
- A
584
- );
585
- for (const O of z.resources) {
586
- const q = u(O);
587
- F.addRecord(q);
588
- }
589
- a.page++;
590
- }
591
- await Te(
592
- F.buildExcel(),
593
- `[${o.name}]-members-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
594
- {
595
- bookType: "xlsx",
596
- bookSST: !1,
597
- type: "array"
598
- }
599
- ), a.page = 1;
600
- },
601
- {
602
- message: "Exporting member...",
603
- successMessage: "Member exported successfully"
604
- }
605
- );
606
- }
607
- async function Y(o) {
608
- await g(
609
- async () => {
610
- var a;
611
- if (o.isActive === !1) {
612
- const F = new FormData();
613
- if (F.append("file", o.file), o._id) {
614
- const { members: T, _id: M, file: D, ...A } = o;
615
- F.append("segment", JSON.stringify(A)), await P.updateStatic(o._id, F);
616
- } else {
617
- const { file: T, ...M } = o;
618
- F.append("segment", JSON.stringify(M)), await P.createStatic(F);
619
- }
620
- o.file && m.open({
621
- type: "info",
622
- title: "Import begins soon. Check Queue for updates.",
623
- action: "View",
624
- onAction: async () => {
625
- await p.push({
626
- name: fe["$connect-QUEUE"],
627
- query: { type: [de.enum.SEGMENTATION_IMPORTED] }
628
- });
629
- }
630
- });
631
- } else if (o._id) {
632
- const { members: F, _id: T, ...M } = o;
633
- await P.update(o._id, M);
634
- } else
635
- await P.create(o);
636
- await y({ pageSize: 10, pageIndex: 0 }), (a = s.value) == null || a.hideSheet();
637
- },
638
- {
639
- message: "Saving segment",
640
- successMessage: "Segment saved"
641
- }
642
- );
643
- }
644
- function v(o) {
645
- var a;
646
- (a = s.value) == null || a.showSheet(o);
647
- }
648
- const r = {
649
- label: _("connect.navigation.queue"),
650
- value: "queue",
651
- isPrimary: !1,
652
- prependIcon: "work_history"
653
- }, E = se(() => x.isPremium ? [
654
- r,
655
- {
656
- label: "Refresh segments",
657
- value: "refresh",
658
- prependIcon: "refresh"
659
- },
660
- {
661
- label: "Add segment",
662
- value: "add",
663
- isPrimary: !0,
664
- prependIcon: "add"
665
- }
666
- ] : []);
667
- function U(o) {
668
- switch (o) {
669
- case "add":
670
- v();
671
- break;
672
- case "refresh":
673
- I();
674
- break;
675
- case "queue":
676
- p.push({
677
- name: fe["$connect-QUEUE"],
678
- query: { type: [de.enum.SEGMENTATION_IMPORTED] }
679
- });
680
- break;
681
- }
682
- }
683
- return ke(async () => {
684
- const { meta: o } = await me.read({
685
- limit: 1,
686
- skip: 0,
687
- sortBy: "_id",
688
- search: void 0,
689
- descending: !1
690
- });
691
- S.value = o.totalResources ?? 0, await y({ pageSize: 10, pageIndex: 0 }), await x.readPremium(), await x.readLocations();
692
- }), (o, a) => {
693
- const F = h("FmPill"), T = h("FmPageHead"), M = h("FmIcon"), D = h("FmMenuItem"), A = h("FmMenu"), z = h("FmListItem"), O = h("FmList"), q = h("FmButton"), X = h("FmCard");
694
- return f(), C(H, null, [
695
- d(T, {
696
- title: "Segments",
697
- actions: t(E),
698
- "onClick:action": a[0] || (a[0] = (w) => U(w))
699
- }, {
700
- title: R(() => [
701
- i("div", St, [
702
- i("span", ht, $(t(_)("connect.loyalty.segment.title")), 1),
703
- d(F, { variant: "premium" })
704
- ])
705
- ]),
706
- _: 1
707
- }, 8, ["actions"]),
708
- i("div", Ft, [
709
- t(c).length > 0 || t(n).searchValue || t(n).isLoading ? (f(), C(H, { key: 0 }, [
710
- d(Se, {
711
- loading: t(n).isLoading,
712
- "row-data": t(c),
713
- "row-count": t(n).totalRows,
714
- "column-defs": l,
715
- "shrink-at": !1,
716
- "page-count": t(n).pageCount,
717
- "page-index": t(n).pageIndex,
718
- "page-size": t(n).pageSize,
719
- onRowClick: a[1] || (a[1] = (w) => {
720
- v(w.original);
721
- }),
722
- onPageChange: t(y)
723
- }, null, 8, ["loading", "row-data", "row-count", "page-count", "page-index", "page-size", "onPageChange"]),
724
- d(O, { class: "w-full hidden xs:block" }, {
725
- default: R(() => [
726
- (f(!0), C(H, null, _e(t(c), (w) => (f(), G(z, {
727
- key: w._id.toString(),
728
- tag: "label",
729
- onClick: (J) => v(w)
730
- }, {
731
- default: R(() => [
732
- i("div", null, [
733
- i("div", wt, $((w.memberCount ?? 0).toLocaleString()) + " total customers ", 1),
734
- i("div", bt, $(w.name), 1),
735
- i("div", Ct, $(((w.memberCount ?? 0) * 100 / t(S)).toFixed(2)) + "% of customers ", 1)
736
- ])
737
- ]),
738
- append: R(() => [
739
- d(A, { "stop-click-propagation": !0 }, {
740
- "menu-button": R(() => [
741
- d(M, { name: "more_vert" })
742
- ]),
743
- default: R(() => [
744
- d(D, {
745
- class: "text-fm-color-typo-error fm-typo-en-body-md-400",
746
- label: "Remove",
747
- "onUpdate:modelValue": (J) => J && k(w)
748
- }, null, 8, ["onUpdate:modelValue"])
749
- ]),
750
- _: 2
751
- }, 1024)
752
- ]),
753
- _: 2
754
- }, 1032, ["onClick"]))), 128))
755
- ]),
756
- _: 1
757
- })
758
- ], 64)) : (f(), G(X, {
759
- key: 1,
760
- variant: "outlined",
761
- class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
762
- }, {
763
- default: R(() => [
764
- a[3] || (a[3] = i("img", {
765
- src: Me,
766
- class: "aspect-square w-[150px]"
767
- }, null, -1)),
768
- a[4] || (a[4] = i("div", { class: "flex flex-col gap-16 text-center" }, [
769
- i("div", { class: "fm-typo-en-title-sm-800" }, "Create customer segments"),
770
- i("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. ")
771
- ], -1)),
772
- d(q, {
773
- variant: "primary",
774
- label: "Create segment",
775
- disabled: !t(x).isPremium,
776
- icon: "add",
777
- onClick: a[2] || (a[2] = (w) => v())
778
- }, null, 8, ["disabled"])
779
- ]),
780
- _: 1
781
- })),
782
- d(vt, {
783
- ref_key: "sheetRef",
784
- ref: s,
785
- "onUpdate:modelValue": Y
786
- }, null, 512)
787
- ])
788
- ], 64);
789
- };
790
- }
791
- });
792
- export {
793
- ao as default
794
- };