@feedmepos/mf-connect 0.1.2-prod → 0.1.4-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.
- package/dist/Analytic-07T9poLx.js +423 -0
- package/dist/{App-CRTD0U-N.js → App-C6MukSCT.js} +276 -275
- package/dist/Broadcast-CzsgeZNO.js +223 -0
- package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-C5zUv0Zx.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BirunpzI.js} +8 -8
- package/dist/Card-DQnyWZZf.js +824 -0
- package/dist/{Collections-BgbWoLWI.js → Collections-BV7CSqRw.js} +4 -4
- package/dist/Credit-CxsbYGLZ.js +220 -0
- package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-C137bE1q.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-BKSZYxvb.js} +918 -901
- package/dist/EffectSheet.vue_vue_type_style_index_0_lang-DpsrI-Z3.js +345 -0
- package/dist/Experience-eMUbhq7h.js +221 -0
- package/dist/Game-CxAG2ViS.js +255 -0
- package/dist/Marketing-CozMj2Y5.js +316 -0
- package/dist/Member-DM1dj3F5.js +69 -0
- package/dist/{MemberList-ISy05wGZ.js → MemberList-DNjK9BbG.js} +14 -14
- package/dist/{MemberTransactions-CXvhJngX.js → MemberTransactions-CsjN3LZA.js} +1 -1
- package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-Ca1LO__F.js → MessageInput.vue_vue_type_script_setup_true_lang-DVQE9v2R.js} +2 -2
- package/dist/Mission-BugvTPPH.js +261 -0
- package/dist/Point-D8BjGtqT.js +222 -0
- package/dist/Promotion-mc9KBzoJ.js +253 -0
- package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-D1eQ3i5D.js → RuleGroup.vue_vue_type_script_setup_true_lang-B2H3D_kZ.js} +15 -15
- package/dist/Segment-DZRFA-Pb.js +565 -0
- package/dist/Setting-DxNhR44e.js +1871 -0
- package/dist/Store-CdkJWpjV.js +1530 -0
- package/dist/StoreRewards-Cdturia8.js +400 -0
- package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-nhS5Dhhk.js → StoreTransactions.vue_vue_type_script_setup_true_lang-D7GcOiUM.js} +10 -10
- package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-DWlpmE56.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-nuCOrrLE.js} +1 -1
- package/dist/{Tier-DLrOmrnK.js → Tier-I_MMd39Y.js} +470 -445
- package/dist/{Title-MHQuel7h.js → Title-DK5gmUvo.js} +298 -282
- package/dist/Transaction-BXpTIMS_.js +39 -0
- package/dist/Voucher-BQ5h2G0I.js +490 -0
- package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-eAP99wyg.js +141 -0
- package/dist/app-CL2Wxzv5.js +5639 -0
- package/dist/{app-BjOpRVdv.js → app-DTAyCT-G.js} +1 -1
- package/dist/app.js +4 -3
- package/dist/{business-DveMDDHY.js → business-B9OUlaFZ.js} +1 -1
- package/dist/{campaign-CMb05XLt.js → campaign-CNbUA51l.js} +2 -2
- package/dist/{collection.fn-BjaBPYMU.js → collection.fn-D_i45T4Q.js} +2 -2
- package/dist/dto-B4208_es.js +2770 -0
- package/dist/{effect-CxAdSlyD.js → effect-Ye_yr8et.js} +1 -1
- package/dist/{email-addresses-Dtr5OALQ.js → email-addresses-Gm7Dyaxy.js} +1 -1
- package/dist/{export-DuBekrcg.js → export-Buee5oUV.js} +3 -3
- package/dist/{helper-DL6hnmtJ.js → helper-BBlHhMFc.js} +1 -1
- package/dist/{index-raYm7Ew2.js → index-BxJgFvym.js} +2 -2
- package/dist/{index-gcsOy_cD.js → index-ByaM-yoc.js} +91 -86
- package/dist/{index-DISwCnfH.js → index-C0QHb5SL.js} +2 -2
- package/dist/{index-Cibwzgac.js → index-C363BG5A.js} +3 -3
- package/dist/{index-BZAlqAaJ.js → index-CLL3no-v.js} +1 -1
- package/dist/{index-CAQpU5Rv.js → index-ChSVaFk3.js} +1 -1
- package/dist/{index-BSIUoSG3.js → index-Co9n8I_5.js} +3 -3
- package/dist/index-CoGNKU8v.js +3 -0
- package/dist/{index-Dx4pkNRc.js → index-DHGcUMVN.js} +1 -1
- package/dist/{index-CgPlJqkX.js → index-DWWtZSrm.js} +1 -1
- package/dist/{index-CGHNWhkM.js → index-DdVZgYE4.js} +258 -256
- package/dist/{index-BBBytzpn.js → index-Dx3HwWcb.js} +1 -1
- package/dist/{index.esm2017-Bs9CWbrs.js → index.esm2017-Dd02dg_O.js} +38 -38
- package/dist/{loading-Dj5bx8fg.js → loading-Or1ZDzDS.js} +11 -11
- package/dist/{membership-B2avlZoN.js → membership-B8h5ku-v.js} +3 -3
- package/dist/{money-CNSWtAf-.js → money-CmsKAJBT.js} +1 -1
- package/dist/{number-BA58pjU6.js → number-iEhp7Uai.js} +1 -1
- package/dist/{rule-BWazFYuZ.js → rule-BORkgSMK.js} +3 -3
- package/dist/{rule-builder-RIloDQBn.js → rule-builder-DEfkSr68.js} +1 -1
- package/dist/{template-u01r84LY.js → template-C_Y7bhlI.js} +4 -4
- package/dist/{usePagination--B6Wt7C1.js → usePagination-Ci8-uZvb.js} +1 -1
- package/dist/vue-i18n-BXzrZRP6.js +2365 -0
- package/package.json +7 -4
- package/dist/Analytic-AqWU_lJy.js +0 -620
- package/dist/Broadcast-utWSrzP9.js +0 -216
- package/dist/Card-x6qnEaIt.js +0 -823
- package/dist/Credit-CojzmUnh.js +0 -214
- package/dist/EffectSheet.vue_vue_type_style_index_0_lang-8l3Dt_Lo.js +0 -344
- package/dist/Experience-CPjovKWF.js +0 -211
- package/dist/Game-DWcjPfZP.js +0 -250
- package/dist/Marketing-CwoI0pFF.js +0 -309
- package/dist/Member-oRcVGr20.js +0 -92
- package/dist/Mission-Y8s5MQIC.js +0 -248
- package/dist/Point-0Fw3qLIW.js +0 -220
- package/dist/Promotion-vqM23NPX.js +0 -244
- package/dist/Segment-lgzMRCyd.js +0 -564
- package/dist/Setting-CFGB53S0.js +0 -1870
- package/dist/Store-fJlew3HJ.js +0 -1533
- package/dist/StoreRewards-DWq34E4p.js +0 -429
- package/dist/Transaction-CYqMFEzc.js +0 -36
- package/dist/Voucher-B0QCX_nG.js +0 -485
- package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-3LlSDiq0.js +0 -140
- package/dist/app-SOHUUM08.js +0 -2974
- package/dist/dto-CY7JrHkZ.js +0 -1145
- package/dist/index-BMxu_XL-.js +0 -11
|
@@ -0,0 +1,565 @@
|
|
|
1
|
+
import { defineComponent as Q, onMounted as ue, openBlock as x, createElementBlock as $, createElementVNode as i, toDisplayString as E, unref as o, createVNode as l, ref as H, computed as X, resolveComponent as S, createBlock as W, isRef as ye, createSlots as _e, withCtx as C, Fragment as q, h as b, onBeforeMount as ve, renderList as he } from "vue";
|
|
2
|
+
import { _ as Se } from "./campaign-CpzFl8Vr.js";
|
|
3
|
+
import { F as re, p as xe, u as we } from "./loading-Or1ZDzDS.js";
|
|
4
|
+
import { components as Z } from "@feedmepos/ui-library";
|
|
5
|
+
import { a as pe, _ as me, w as Fe } from "./usePagination-Ci8-uZvb.js";
|
|
6
|
+
import { u as Ce } from "./vue-i18n-BXzrZRP6.js";
|
|
7
|
+
import { e as Me, M as ke } from "./email-addresses-Gm7Dyaxy.js";
|
|
8
|
+
import { _ as Ie, Z as Pe } from "./ZodTextField.vue_vue_type_script_setup_true_lang-eAP99wyg.js";
|
|
9
|
+
import { a as Re } from "./index-C363BG5A.js";
|
|
10
|
+
import { u as be } from "./app-wDQR6dpb.js";
|
|
11
|
+
import { R as Be } from "./rule-builder-DEfkSr68.js";
|
|
12
|
+
import { _ as Ee } from "./RuleGroup.vue_vue_type_script_setup_true_lang-B2H3D_kZ.js";
|
|
13
|
+
import { h as z } from "./moment-BWErdI6_.js";
|
|
14
|
+
import { s as B, u as $e } from "./membership-B8h5ku-v.js";
|
|
15
|
+
import { o as De } from "./objectId-dwaoBfJX.js";
|
|
16
|
+
import { u as ge } from "./business-B9OUlaFZ.js";
|
|
17
|
+
import { f as Ye } from "./number-iEhp7Uai.js";
|
|
18
|
+
import { t as Le } from "./money-CmsKAJBT.js";
|
|
19
|
+
import { m as ce } from "./index-Dx3HwWcb.js";
|
|
20
|
+
const Te = Re.extend({
|
|
21
|
+
_id: re.optional(),
|
|
22
|
+
business: re.optional()
|
|
23
|
+
}), Ve = { class: "space-y-16 pr-12" }, Ne = { class: "fm-typo-en-title-md-800" }, ze = { class: "flex space-x-8" }, Ae = { class: "fm-typo-en-title-md-800 text-fm-color-primary" }, Ue = { class: "text-fm-color-typo-secondary" }, Oe = /* @__PURE__ */ i("div", null, "contacts in your segment", -1), je = /* @__PURE__ */ Q({
|
|
24
|
+
__name: "ReviewSegment",
|
|
25
|
+
props: {
|
|
26
|
+
title: {},
|
|
27
|
+
segment: {}
|
|
28
|
+
},
|
|
29
|
+
setup(e) {
|
|
30
|
+
const c = e, h = [
|
|
31
|
+
{
|
|
32
|
+
header: "Name",
|
|
33
|
+
accessorFn: (n) => n.name
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
header: "Id",
|
|
37
|
+
accessorFn: (n) => n._id
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
header: "Customer Since",
|
|
41
|
+
accessorFn: (n) => z(De(n._id.toString())).format("DD MMM YYYY")
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
header: "Phone",
|
|
45
|
+
accessorFn: (n) => n.phoneNumber
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
header: "Birthday",
|
|
49
|
+
accessorFn: (n) => z(n.birthday).format("DD MMM YYYY")
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
header: "Last Visit",
|
|
53
|
+
accessorFn: (n) => z(n.stats.lastVisit).format("DD MMM YYYY")
|
|
54
|
+
}
|
|
55
|
+
], _ = async (n) => c.segment._id ? await B.paginateSegmentUsers(c.segment._id, {
|
|
56
|
+
limit: r.value.pageSize,
|
|
57
|
+
skip: n.pageIndex ?? 0,
|
|
58
|
+
sortBy: "_id",
|
|
59
|
+
search: n.searchValue,
|
|
60
|
+
descending: !0
|
|
61
|
+
}) : { resources: [], meta: { totalResources: 0, totalPages: 0 } }, { tableMeta: r, rowData: d, onSort: M, debouncedFetchData: g, onSearch: s } = pe(_);
|
|
62
|
+
return ue(async () => {
|
|
63
|
+
await g();
|
|
64
|
+
}), (n, f) => (x(), $("div", Ve, [
|
|
65
|
+
i("div", Ne, E(c.title), 1),
|
|
66
|
+
i("div", ze, [
|
|
67
|
+
i("div", Ae, E(n.segment.members.length), 1),
|
|
68
|
+
i("div", Ue, [
|
|
69
|
+
Oe,
|
|
70
|
+
i("div", null, "as of " + E(o(z)(n.segment.lastUpdated).format("DD MMM YYYY")), 1)
|
|
71
|
+
])
|
|
72
|
+
]),
|
|
73
|
+
l(me, {
|
|
74
|
+
loading: o(r).isLoading,
|
|
75
|
+
"row-data": o(d),
|
|
76
|
+
"row-count": o(r).totalRows,
|
|
77
|
+
"column-defs": h,
|
|
78
|
+
"page-size": o(r).pageSize,
|
|
79
|
+
"page-count": o(r).pageCount,
|
|
80
|
+
"page-index": o(r).pageIndex,
|
|
81
|
+
onSortChange: o(M),
|
|
82
|
+
onPageChange: f[0] || (f[0] = (w) => o(g)({ pageSize: w.pageSize, pageIndex: w.pageIndex }))
|
|
83
|
+
}, null, 8, ["loading", "row-data", "row-count", "page-size", "page-count", "page-index", "onSortChange"])
|
|
84
|
+
]));
|
|
85
|
+
}
|
|
86
|
+
}), He = { class: "flex items-center gap-x-8" }, qe = /* @__PURE__ */ i("div", null, "Review segment", -1), Je = {
|
|
87
|
+
key: 0,
|
|
88
|
+
class: "space-y-16 pr-12"
|
|
89
|
+
}, Ge = /* @__PURE__ */ i("div", { class: "fm-typo-en-title-sm-800" }, "Segment Filter", -1), Ze = { class: "flex items-center gap-8" }, We = /* @__PURE__ */ Q({
|
|
90
|
+
__name: "SegmentSheet",
|
|
91
|
+
emits: ["update:model-value"],
|
|
92
|
+
setup(e, { expose: c, emit: h }) {
|
|
93
|
+
const _ = be(), r = H(!1), d = H(!1), M = {
|
|
94
|
+
name: "",
|
|
95
|
+
rule: Be.scaffoldGroup(),
|
|
96
|
+
members: []
|
|
97
|
+
}, g = Te, s = H(M), n = X(() => {
|
|
98
|
+
const v = g.safeParse(s.value);
|
|
99
|
+
return v.success ? [] : v.error.errors;
|
|
100
|
+
});
|
|
101
|
+
function f(v) {
|
|
102
|
+
r.value = !0, d.value = !1, v ? s.value = { ...v } : s.value = { ...M };
|
|
103
|
+
}
|
|
104
|
+
function w() {
|
|
105
|
+
r.value = !1;
|
|
106
|
+
}
|
|
107
|
+
async function I() {
|
|
108
|
+
g.safeParse(s.value).success && (d.value = !0);
|
|
109
|
+
}
|
|
110
|
+
function D() {
|
|
111
|
+
d.value = !1;
|
|
112
|
+
}
|
|
113
|
+
async function Y() {
|
|
114
|
+
k("update:model-value", s.value);
|
|
115
|
+
}
|
|
116
|
+
ue(async () => {
|
|
117
|
+
});
|
|
118
|
+
const k = h;
|
|
119
|
+
return c({
|
|
120
|
+
showSheet: f,
|
|
121
|
+
hideSheet: w
|
|
122
|
+
}), (v, t) => {
|
|
123
|
+
const a = S("FmButton"), F = S("FmSideSheet");
|
|
124
|
+
return x(), W(F, {
|
|
125
|
+
modelValue: o(r),
|
|
126
|
+
"onUpdate:modelValue": t[5] || (t[5] = (u) => ye(r) ? r.value = u : null),
|
|
127
|
+
header: "Add segment",
|
|
128
|
+
"dismiss-away": "",
|
|
129
|
+
"close-button": !0,
|
|
130
|
+
"max-width": 1100
|
|
131
|
+
}, _e({
|
|
132
|
+
"side-sheet-footer": C(() => [
|
|
133
|
+
i("div", Ze, [
|
|
134
|
+
o(d) ? (x(), $(q, { key: 0 }, [
|
|
135
|
+
l(a, {
|
|
136
|
+
label: "Save Segment",
|
|
137
|
+
onClick: Y,
|
|
138
|
+
loading: o(_).isLoading,
|
|
139
|
+
disabled: o(n).length > 0 || o(_).isLoading
|
|
140
|
+
}, null, 8, ["loading", "disabled"]),
|
|
141
|
+
l(a, {
|
|
142
|
+
label: "Cancel",
|
|
143
|
+
onClick: t[3] || (t[3] = (u) => D()),
|
|
144
|
+
variant: "tertiary"
|
|
145
|
+
})
|
|
146
|
+
], 64)) : (x(), $(q, { key: 1 }, [
|
|
147
|
+
l(a, {
|
|
148
|
+
label: "Review Segment",
|
|
149
|
+
disabled: o(n).length > 0 || o(_).isLoading,
|
|
150
|
+
onClick: I
|
|
151
|
+
}, null, 8, ["disabled"]),
|
|
152
|
+
l(a, {
|
|
153
|
+
label: "Cancel",
|
|
154
|
+
onClick: t[4] || (t[4] = (u) => w()),
|
|
155
|
+
variant: "tertiary"
|
|
156
|
+
})
|
|
157
|
+
], 64))
|
|
158
|
+
])
|
|
159
|
+
]),
|
|
160
|
+
default: C(() => {
|
|
161
|
+
var u;
|
|
162
|
+
return [
|
|
163
|
+
o(d) ? (x(), W(je, {
|
|
164
|
+
key: 1,
|
|
165
|
+
title: o(s).name,
|
|
166
|
+
segment: o(s)
|
|
167
|
+
}, null, 8, ["title", "segment"])) : (x(), $("div", Je, [
|
|
168
|
+
l(Ie, {
|
|
169
|
+
modelValue: o(s).name,
|
|
170
|
+
"onUpdate:modelValue": t[1] || (t[1] = (y) => o(s).name = y),
|
|
171
|
+
label: "Segment title",
|
|
172
|
+
schema: o(Pe).typeAtPath(o(g), "name")
|
|
173
|
+
}, null, 8, ["modelValue", "schema"]),
|
|
174
|
+
Ge,
|
|
175
|
+
l(Ee, {
|
|
176
|
+
"trigger-type": "MEMBERSHIP_JOINED",
|
|
177
|
+
includeOnly: "user",
|
|
178
|
+
"model-value": (u = o(s)) == null ? void 0 : u.rule,
|
|
179
|
+
"onUpdate:modelValue": t[2] || (t[2] = (y) => {
|
|
180
|
+
o(s).rule = y;
|
|
181
|
+
})
|
|
182
|
+
}, null, 8, ["model-value"])
|
|
183
|
+
]))
|
|
184
|
+
];
|
|
185
|
+
}),
|
|
186
|
+
_: 2
|
|
187
|
+
}, [
|
|
188
|
+
o(d) ? {
|
|
189
|
+
name: "side-sheet-header",
|
|
190
|
+
fn: C(() => [
|
|
191
|
+
i("div", He, [
|
|
192
|
+
l(a, {
|
|
193
|
+
icon: "arrow_back",
|
|
194
|
+
variant: "tertiary",
|
|
195
|
+
onClick: t[0] || (t[0] = (u) => d.value = !1)
|
|
196
|
+
}),
|
|
197
|
+
qe
|
|
198
|
+
])
|
|
199
|
+
]),
|
|
200
|
+
key: "0"
|
|
201
|
+
} : void 0
|
|
202
|
+
]), 1032, ["modelValue"]);
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
}), de = $e(), Ke = ge();
|
|
206
|
+
function K(e) {
|
|
207
|
+
const c = z(e);
|
|
208
|
+
return c.isValid() ? c.format("DD/MM/YYYY") : "";
|
|
209
|
+
}
|
|
210
|
+
const Qe = {
|
|
211
|
+
mapMemberExportRow: (e) => {
|
|
212
|
+
var n, f, w, I, D, Y, k, v, t, a, F, u, y, P, L, T, V, N, J, p, A, ee, te, oe, ae, ne, se, ie;
|
|
213
|
+
const c = X(() => Ke.locations.map((m) => ({
|
|
214
|
+
label: m.name,
|
|
215
|
+
value: m._id
|
|
216
|
+
}))), h = (n = Me.parseOneAddress(
|
|
217
|
+
e == null ? void 0 : e.email
|
|
218
|
+
)) != null && n.domain.includes("feedmepos.com") ? void 0 : e.email, _ = (w = ((f = e == null ? void 0 : e.collection) == null ? void 0 : f.TITLE) || []) == null ? void 0 : w.reduce(
|
|
219
|
+
(m, R) => {
|
|
220
|
+
var O, j;
|
|
221
|
+
const U = (j = (O = de.sortedTitles) == null ? void 0 : O.find(
|
|
222
|
+
(G) => G._id === R.collectible
|
|
223
|
+
)) == null ? void 0 : j.name;
|
|
224
|
+
return !U || R.balance <= 0 || m.push(U), m;
|
|
225
|
+
},
|
|
226
|
+
[]
|
|
227
|
+
), r = (de.sortedTitles || []).reduce(
|
|
228
|
+
(m, R) => {
|
|
229
|
+
var O, j, G, le;
|
|
230
|
+
const U = (le = (G = (j = (((O = e == null ? void 0 : e.collection) == null ? void 0 : O.TITLE) || []).find(
|
|
231
|
+
(fe) => fe.collectible === R._id
|
|
232
|
+
)) == null ? void 0 : j.expiryBalance) == null ? void 0 : G[0]) == null ? void 0 : le.expiredAt;
|
|
233
|
+
return m[R.name] = U ? z(U).format("DD/MM/YYYY") : "", m;
|
|
234
|
+
},
|
|
235
|
+
{}
|
|
236
|
+
), d = ((Y = (D = (I = e.collection) == null ? void 0 : I.CREDIT) == null ? void 0 : D.at(0)) == null ? void 0 : Y.balance) || 0, M = ((a = (t = (v = (k = e.collection) == null ? void 0 : k.CREDIT) == null ? void 0 : v.at(0)) == null ? void 0 : t.expiryBalance) == null ? void 0 : a.reduce(
|
|
237
|
+
(m, R) => m + R.amount,
|
|
238
|
+
0
|
|
239
|
+
)) || 0, g = Ye(d, 2);
|
|
240
|
+
return {
|
|
241
|
+
ID: e._id.toString(),
|
|
242
|
+
Name: ((F = e.name) == null ? void 0 : F.trim()) || "",
|
|
243
|
+
Phone: ((u = e == null ? void 0 : e.phoneNumber) == null ? void 0 : u.trim()) || "",
|
|
244
|
+
Email: h || "",
|
|
245
|
+
Gender: e.gender || "",
|
|
246
|
+
CardNo: e.cardNo || "",
|
|
247
|
+
Birthday: K((e == null ? void 0 : e.birthday) || void 0),
|
|
248
|
+
Credit: parseFloat((Number(g) - Number(M)).toFixed(2)),
|
|
249
|
+
FreeCredit: Number(M.toFixed(2)),
|
|
250
|
+
TotalCredit: Number(g),
|
|
251
|
+
Exp: e != null && e.collection ? ((L = (P = (y = e.collection) == null ? void 0 : y.POINT) == null ? void 0 : P.at(0)) == null ? void 0 : L.balance) ?? 0 : 0,
|
|
252
|
+
Point: e != null && e.collection ? ((N = (V = (T = e.collection) == null ? void 0 : T.COIN) == null ? void 0 : V.at(0)) == null ? void 0 : N.balance) ?? 0 : 0,
|
|
253
|
+
Level: e != null && e.collection ? ((A = (p = (J = e.collection) == null ? void 0 : J.TIER) == null ? void 0 : p.at(0)) == null ? void 0 : A.balance) ?? 0 : 0,
|
|
254
|
+
Tier: e != null && e.collection ? ((oe = (te = (ee = e.collection) == null ? void 0 : ee.TIER) == null ? void 0 : te.at(0)) == null ? void 0 : oe.balance) ?? 0 : 0,
|
|
255
|
+
Titles: _.join(","),
|
|
256
|
+
...r,
|
|
257
|
+
TotalTransaction: e.stats.visitCount,
|
|
258
|
+
AvgSpent: Le(Number(e.stats.avgBillSize || 0)).toFormat(
|
|
259
|
+
!1
|
|
260
|
+
),
|
|
261
|
+
TotalSpent: e.stats.avgBillSize * e.stats.visitCount,
|
|
262
|
+
LastVisit: K(e.stats.lastVisit),
|
|
263
|
+
Feedback: ((ae = e.stats) == null ? void 0 : ae.feedbackCount) || 0,
|
|
264
|
+
LastSeasonTierEarned: ((ne = e.stats) == null ? void 0 : ne.lastSeasonTierEarned) || 0,
|
|
265
|
+
LastSeasonPointEarned: ((se = e.stats) == null ? void 0 : se.lastSeasonPointEarned) || 0,
|
|
266
|
+
JoinedAt: K(e.joinAt || void 0),
|
|
267
|
+
JoinedAtLocation: e.location && ((ie = c.value.find((m) => m.value == e.location)) == null ? void 0 : ie.label) || "-",
|
|
268
|
+
VisitFrequency: `${Number(
|
|
269
|
+
Math.ceil(e.stats.avgVisitFrequency).toFixed(0)
|
|
270
|
+
)}`
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
}, Xe = { class: "flex items-center" }, et = { 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" }, ot = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, at = { class: "fm-typo-en-body-md-600" }, nt = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, st = /* @__PURE__ */ i("img", {
|
|
274
|
+
src: Se,
|
|
275
|
+
class: "aspect-square w-[150px]"
|
|
276
|
+
}, null, -1), it = /* @__PURE__ */ i("div", { class: "flex flex-col gap-16 text-center" }, [
|
|
277
|
+
/* @__PURE__ */ i("div", { class: "fm-typo-en-title-sm-800" }, "Create customer segments"),
|
|
278
|
+
/* @__PURE__ */ 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. ")
|
|
279
|
+
], -1), kt = /* @__PURE__ */ Q({
|
|
280
|
+
__name: "Segment",
|
|
281
|
+
setup(e) {
|
|
282
|
+
const { minor: c } = we, { t: h } = Ce(), _ = ge(), { mapMemberExportRow: r } = Qe, d = H(0), M = [
|
|
283
|
+
{
|
|
284
|
+
header: h("connect.loyalty.segment.table.name"),
|
|
285
|
+
accessorFn: (t) => t.name
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
header: h("connect.loyalty.segment.table.total_customers"),
|
|
289
|
+
accessorFn: (t) => t.memberCount ?? 0
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
header: h("connect.loyalty.segment.table.customer_percentage"),
|
|
293
|
+
accessorFn: (t) => ((t.memberCount ?? 0) * 100 / d.value).toFixed(2)
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
header: h("connect.loyalty.segment.table.actions"),
|
|
297
|
+
meta: {
|
|
298
|
+
maxWidth: "100px"
|
|
299
|
+
},
|
|
300
|
+
cell(t) {
|
|
301
|
+
return b("div", { class: "flex items-center justify-end" }, [
|
|
302
|
+
b(
|
|
303
|
+
Z.FmMenu,
|
|
304
|
+
{
|
|
305
|
+
placement: "bottom-end",
|
|
306
|
+
onClick: (a) => {
|
|
307
|
+
a.stopPropagation();
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
"menu-button": () => b(Z.FmButton, {
|
|
312
|
+
icon: "more_vert",
|
|
313
|
+
iconColor: "neutral-gray-400",
|
|
314
|
+
variant: "tertiary"
|
|
315
|
+
}),
|
|
316
|
+
default: () => [
|
|
317
|
+
b(
|
|
318
|
+
Z.FmMenuItem,
|
|
319
|
+
{
|
|
320
|
+
onClick: async (a) => {
|
|
321
|
+
a.stopPropagation(), D(t.row.original);
|
|
322
|
+
}
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
label: b(
|
|
326
|
+
"div",
|
|
327
|
+
{
|
|
328
|
+
class: "fm-typo-en-body-md-400"
|
|
329
|
+
},
|
|
330
|
+
"Export"
|
|
331
|
+
)
|
|
332
|
+
}
|
|
333
|
+
),
|
|
334
|
+
b(
|
|
335
|
+
Z.FmMenuItem,
|
|
336
|
+
{
|
|
337
|
+
onClick: async (a) => {
|
|
338
|
+
a.stopPropagation(), I(t.row.original);
|
|
339
|
+
}
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
label: b(
|
|
343
|
+
"div",
|
|
344
|
+
{
|
|
345
|
+
class: "text-fm-color-typo-error fm-typo-en-body-md-400"
|
|
346
|
+
},
|
|
347
|
+
"Remove"
|
|
348
|
+
)
|
|
349
|
+
}
|
|
350
|
+
)
|
|
351
|
+
]
|
|
352
|
+
}
|
|
353
|
+
)
|
|
354
|
+
]);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
], g = H(null), { tableMeta: s, rowData: n, debouncedFetchData: f } = pe(
|
|
358
|
+
B.readAll
|
|
359
|
+
);
|
|
360
|
+
async function w() {
|
|
361
|
+
await c(
|
|
362
|
+
async () => {
|
|
363
|
+
await B.refreshSegments(), await f({ pageSize: 10, pageIndex: 0 });
|
|
364
|
+
},
|
|
365
|
+
{ message: "Refreshing segmentations" }
|
|
366
|
+
);
|
|
367
|
+
}
|
|
368
|
+
async function I(t) {
|
|
369
|
+
await xe.remove(`Are you sure you want to remove ${t.name}?`) && await c(
|
|
370
|
+
async () => {
|
|
371
|
+
await B.delete(t._id), await f({ pageSize: 10, pageIndex: 0 });
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
message: `Removing ${t.name}`,
|
|
375
|
+
successMessage: `Removed ${t.name} successfully`
|
|
376
|
+
}
|
|
377
|
+
);
|
|
378
|
+
}
|
|
379
|
+
async function D(t) {
|
|
380
|
+
const a = {
|
|
381
|
+
sortBy: "_id",
|
|
382
|
+
descending: !1,
|
|
383
|
+
rowsPerPage: 1e3,
|
|
384
|
+
page: 1,
|
|
385
|
+
rowsNumber: 0
|
|
386
|
+
}, F = new ke(), u = (await ce.read({
|
|
387
|
+
limit: 1,
|
|
388
|
+
skip: 0,
|
|
389
|
+
sortBy: a.sortBy,
|
|
390
|
+
descending: a.descending
|
|
391
|
+
})).meta.totalResources ?? 0, y = a.rowsPerPage;
|
|
392
|
+
await c(
|
|
393
|
+
async () => {
|
|
394
|
+
for (let P = 0; P < u; P += y) {
|
|
395
|
+
const L = {
|
|
396
|
+
...a,
|
|
397
|
+
limit: y,
|
|
398
|
+
skip: a.page - 1,
|
|
399
|
+
sortBy: a.sortBy,
|
|
400
|
+
descending: a.descending
|
|
401
|
+
}, T = await B.paginateSegmentUsers(
|
|
402
|
+
t._id,
|
|
403
|
+
L
|
|
404
|
+
);
|
|
405
|
+
for (const V of T.resources) {
|
|
406
|
+
const N = r(V);
|
|
407
|
+
F.addRecord(N);
|
|
408
|
+
}
|
|
409
|
+
a.page++;
|
|
410
|
+
}
|
|
411
|
+
await Fe(
|
|
412
|
+
F.buildExcel(),
|
|
413
|
+
`[${t.name}]-members-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
|
|
414
|
+
{
|
|
415
|
+
bookType: "xlsx",
|
|
416
|
+
bookSST: !1,
|
|
417
|
+
type: "array"
|
|
418
|
+
}
|
|
419
|
+
), a.page = 1;
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
message: "Exporting member...",
|
|
423
|
+
successMessage: "Member exported successfully"
|
|
424
|
+
}
|
|
425
|
+
);
|
|
426
|
+
}
|
|
427
|
+
async function Y(t) {
|
|
428
|
+
await c(
|
|
429
|
+
async () => {
|
|
430
|
+
var a;
|
|
431
|
+
if (t._id) {
|
|
432
|
+
const { members: F, _id: u, ...y } = t;
|
|
433
|
+
await B.update(t._id, y);
|
|
434
|
+
} else
|
|
435
|
+
await B.create(t);
|
|
436
|
+
await f({ pageSize: 10, pageIndex: 0 }), (a = g.value) == null || a.hideSheet();
|
|
437
|
+
},
|
|
438
|
+
{
|
|
439
|
+
message: "Saving segment",
|
|
440
|
+
successMessage: "Segment saved"
|
|
441
|
+
}
|
|
442
|
+
);
|
|
443
|
+
}
|
|
444
|
+
function k(t) {
|
|
445
|
+
var a;
|
|
446
|
+
(a = g.value) == null || a.showSheet(t);
|
|
447
|
+
}
|
|
448
|
+
const v = X(() => _.isPremium ? [
|
|
449
|
+
{
|
|
450
|
+
label: "Refresh segments",
|
|
451
|
+
value: "refresh"
|
|
452
|
+
},
|
|
453
|
+
{
|
|
454
|
+
label: "Add segment",
|
|
455
|
+
value: "add",
|
|
456
|
+
isPrimary: !0,
|
|
457
|
+
prependIcon: "add"
|
|
458
|
+
}
|
|
459
|
+
] : []);
|
|
460
|
+
return ve(async () => {
|
|
461
|
+
const { meta: t } = await ce.read({
|
|
462
|
+
limit: 1,
|
|
463
|
+
skip: 0,
|
|
464
|
+
sortBy: "_id",
|
|
465
|
+
search: void 0,
|
|
466
|
+
descending: !1
|
|
467
|
+
});
|
|
468
|
+
d.value = t.totalResources ?? 0, await f({ pageSize: 10, pageIndex: 0 }), await _.readPremium(), await _.readLocations();
|
|
469
|
+
}), (t, a) => {
|
|
470
|
+
const F = S("FmPill"), u = S("FmPageHead"), y = S("FmIcon"), P = S("FmMenuItem"), L = S("FmMenu"), T = S("FmListItem"), V = S("FmList"), N = S("FmButton"), J = S("FmCard");
|
|
471
|
+
return x(), $(q, null, [
|
|
472
|
+
l(u, {
|
|
473
|
+
title: "Segments",
|
|
474
|
+
actions: o(v),
|
|
475
|
+
"onClick:action": a[0] || (a[0] = (p) => p === "add" ? k() : w())
|
|
476
|
+
}, {
|
|
477
|
+
title: C(() => [
|
|
478
|
+
i("div", Xe, [
|
|
479
|
+
i("span", et, E(o(h)("connect.loyalty.segment.title")), 1),
|
|
480
|
+
l(F, { variant: "premium" })
|
|
481
|
+
])
|
|
482
|
+
]),
|
|
483
|
+
_: 1
|
|
484
|
+
}, 8, ["actions"]),
|
|
485
|
+
i("div", tt, [
|
|
486
|
+
o(n).length > 0 || o(s).searchValue || o(s).isLoading ? (x(), $(q, { key: 0 }, [
|
|
487
|
+
l(me, {
|
|
488
|
+
loading: o(s).isLoading,
|
|
489
|
+
"row-data": o(n),
|
|
490
|
+
"row-count": o(s).totalRows,
|
|
491
|
+
"column-defs": M,
|
|
492
|
+
"shrink-at": !1,
|
|
493
|
+
"page-count": o(s).pageCount,
|
|
494
|
+
"page-index": o(s).pageIndex,
|
|
495
|
+
"page-size": o(s).pageSize,
|
|
496
|
+
onRowClick: a[1] || (a[1] = (p) => {
|
|
497
|
+
k(p.original);
|
|
498
|
+
}),
|
|
499
|
+
onPageChange: o(f)
|
|
500
|
+
}, null, 8, ["loading", "row-data", "row-count", "page-count", "page-index", "page-size", "onPageChange"]),
|
|
501
|
+
l(V, { class: "w-full hidden xs:block" }, {
|
|
502
|
+
default: C(() => [
|
|
503
|
+
(x(!0), $(q, null, he(o(n), (p) => (x(), W(T, {
|
|
504
|
+
key: p._id.toString(),
|
|
505
|
+
tag: "label",
|
|
506
|
+
onClick: (A) => k(p)
|
|
507
|
+
}, {
|
|
508
|
+
default: C(() => [
|
|
509
|
+
i("div", null, [
|
|
510
|
+
i("div", ot, E((p.memberCount ?? 0).toLocaleString()) + " total customers ", 1),
|
|
511
|
+
i("div", at, E(p.name), 1),
|
|
512
|
+
i("div", nt, E(((p.memberCount ?? 0) * 100 / o(d)).toFixed(2)) + "% of customers ", 1)
|
|
513
|
+
])
|
|
514
|
+
]),
|
|
515
|
+
append: C(() => [
|
|
516
|
+
l(L, { "stop-click-propagation": !0 }, {
|
|
517
|
+
"menu-button": C(() => [
|
|
518
|
+
l(y, { name: "more_vert" })
|
|
519
|
+
]),
|
|
520
|
+
default: C(() => [
|
|
521
|
+
l(P, {
|
|
522
|
+
class: "text-fm-color-typo-error fm-typo-en-body-md-400",
|
|
523
|
+
label: "Remove",
|
|
524
|
+
"onUpdate:modelValue": (A) => A && I(p)
|
|
525
|
+
}, null, 8, ["onUpdate:modelValue"])
|
|
526
|
+
]),
|
|
527
|
+
_: 2
|
|
528
|
+
}, 1024)
|
|
529
|
+
]),
|
|
530
|
+
_: 2
|
|
531
|
+
}, 1032, ["onClick"]))), 128))
|
|
532
|
+
]),
|
|
533
|
+
_: 1
|
|
534
|
+
})
|
|
535
|
+
], 64)) : (x(), W(J, {
|
|
536
|
+
key: 1,
|
|
537
|
+
variant: "outlined",
|
|
538
|
+
class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
|
|
539
|
+
}, {
|
|
540
|
+
default: C(() => [
|
|
541
|
+
st,
|
|
542
|
+
it,
|
|
543
|
+
l(N, {
|
|
544
|
+
variant: "primary",
|
|
545
|
+
label: "Create segment",
|
|
546
|
+
disabled: !o(_).isPremium,
|
|
547
|
+
icon: "add",
|
|
548
|
+
onClick: a[2] || (a[2] = (p) => k())
|
|
549
|
+
}, null, 8, ["disabled"])
|
|
550
|
+
]),
|
|
551
|
+
_: 1
|
|
552
|
+
})),
|
|
553
|
+
l(We, {
|
|
554
|
+
ref_key: "sheetRef",
|
|
555
|
+
ref: g,
|
|
556
|
+
"onUpdate:modelValue": Y
|
|
557
|
+
}, null, 512)
|
|
558
|
+
])
|
|
559
|
+
], 64);
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
});
|
|
563
|
+
export {
|
|
564
|
+
kt as default
|
|
565
|
+
};
|