@feedmepos/mf-connect 0.1.0-beta.2 → 0.1.0-beta.21
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-CZ8gfj2V.js +424 -0
- package/dist/{App-D8a5eW51.js → App-Da9h7lhI.js} +397 -384
- package/dist/{Broadcast-C8jgMe6g.js → Broadcast-m6ehTw7F.js} +32 -32
- package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-pG8WvV4I.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BTKA2Ygl.js} +8 -8
- package/dist/Card-DqZveZ44.js +685 -0
- package/dist/{Collections-lMrdPUuM.js → Collections-XIY6SLgQ.js} +4 -4
- package/dist/{Credit-CJfU5tP4.js → Credit-B6Yg3_al.js} +14 -14
- package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-DLnvDVgf.js +108 -0
- package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-D1gub9ZP.js +2198 -0
- package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-CzEtOmp0.js → EffectSheet.vue_vue_type_style_index_0_lang-tRUwA8zh.js} +8 -8
- package/dist/{Experience-Bp2ki8gU.js → Experience-CsoneWLZ.js} +8 -8
- package/dist/{Game-BpTf6ebE.js → Game-B029f9yE.js} +15 -15
- package/dist/Index-B2LvLfrR.js +226 -0
- package/dist/Marketing-DUTyDRXu.js +20070 -0
- package/dist/{Member-BSWyy32a.js → Member-CATybMaC.js} +4 -4
- package/dist/MemberList-DxvQ7DnC.js +1045 -0
- package/dist/{MemberTransactions-BzHiXCnp.js → MemberTransactions-fEZyBY9P.js} +1 -1
- package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-e-zWg08J.js → MessageInput.vue_vue_type_script_setup_true_lang-BCCEsJZj.js} +2 -2
- package/dist/{Mission-8IGT3T2C.js → Mission-Cl3O0ULj.js} +16 -16
- package/dist/Overview-BVI2xGvT.js +1014 -0
- package/dist/{Point-CbbJ6ohd.js → Point-DSVn47pK.js} +23 -23
- package/dist/{Promotion-BYXCJa_S.js → Promotion-C4HyMpPg.js} +53 -47
- package/dist/Record-BSKXwUu2.js +187 -0
- package/dist/Reward-Cus20Wq5.js +399 -0
- package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-Dm6Vgx8-.js +151 -0
- package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-CqMCdTsv.js +1597 -0
- package/dist/Segment-DAHJ2FYV.js +567 -0
- package/dist/SelectItems.vue_vue_type_script_setup_true_lang-DpkIgpqy.js +181 -0
- package/dist/{Setting-CLpvvZTv.js → Setting-D7dKlTiZ.js} +8 -8
- package/dist/Store-DQdWn1Dw.js +1745 -0
- package/dist/{StoreRewards-CUM2irXK.js → StoreRewards-Cut9mJGn.js} +12 -12
- package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-BQscw_Di.js +957 -0
- package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-DEb4OBcX.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-BVzz2Zkl.js} +1 -1
- package/dist/{Tier-DZTDxWBo.js → Tier-DGpNybHO.js} +15 -15
- package/dist/{Title-C2Dr5ceK.js → Title-D5y8GEwE.js} +15 -15
- package/dist/{Transaction-BL4mS29d.js → Transaction-CCnZouEv.js} +2 -2
- package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-Cr9DV7hr.js +130 -0
- package/dist/{Voucher-Cx0r2-df.js → Voucher-BJ6RC4SS.js} +31 -31
- package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-6751WdaT.js +419 -0
- package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-DWuAODUF.js → ZodTextField.vue_vue_type_script_setup_true_lang-aq-9V3Gc.js} +1 -1
- package/dist/{app-wE5HTF_Y.js → app-D3chCumI.js} +1279 -1282
- package/dist/{app-B_xuZ5HB.js → app-PfWyqx7U.js} +1 -1
- package/dist/app.js +1 -1
- package/dist/{business-DSv8zM8C.js → business-trsrJyHK.js} +1 -1
- package/dist/{campaign-7y5qquHZ.js → campaign-B1rgdv77.js} +2 -2
- package/dist/collectible.enum-ZoD0ya1M.js +19 -0
- package/dist/{collection.fn-BxVZQAx0.js → collection.fn-CnQjdokW.js} +2 -2
- package/dist/{dto-Ew1QwLci.js → dto-DuJumvC2.js} +12 -20
- package/dist/{effect-BzPh8fRI.js → effect-CFYktLyZ.js} +9 -9
- package/dist/email-addresses-BocLAqLt.js +705 -0
- package/dist/{export-C9tDplkA.js → export-BDxbvd3c.js} +3 -3
- package/dist/{helper-Sz7oQ0F4.js → helper-Bx6u7f_W.js} +1 -1
- package/dist/{index-DH_1nOJ_.js → index-7QsBQpBM.js} +39 -35
- package/dist/{index-z0IfdrZk.js → index-AcoIUTDS.js} +203 -195
- package/dist/{index-C3_4GUiI.js → index-BAUe6Mqp.js} +7 -1
- package/dist/{index-C0lpADCo.js → index-C20tnKDo.js} +1 -1
- package/dist/{index-C-SOz7jt.js → index-CDgSJNKm.js} +1 -1
- package/dist/{index-DBMaUGYI.js → index-CTnZ9dt0.js} +30 -26
- package/dist/index-CUMB0mpB.js +28997 -0
- package/dist/index-CsF6BSZU.js +1067 -0
- package/dist/index-CsaQJMAR.js +66 -0
- package/dist/{index-tv4t0Pnh.js → index-DwXHEi0X.js} +1 -1
- package/dist/{index-_3qBsogG.js → index-ZXWgygOr.js} +1500 -1479
- package/dist/index-_v_LQTuR.js +53 -0
- package/dist/index-kLMiwwB-.js +38 -0
- package/dist/{index-gIRszcHf.js → index-pRpTA8Kd.js} +1 -1
- package/dist/{index.esm2017-BnKJDxUo.js → index.esm2017-DuOZ7nuk.js} +33 -33
- package/dist/{loading-Ds-yFYhc.js → loading-BTEwnG5-.js} +591 -597
- package/dist/{membership-DaiVw9qF.js → membership-DkH7qw6W.js} +51 -43
- package/dist/money-BfCdj0Ts.js +15 -0
- package/dist/number-BKHcstZb.js +12 -0
- package/dist/objectid-CumRza_j.js +145 -0
- package/dist/remy-vue-client-Cpppk9h-.js +1693 -0
- package/dist/reward-DpR3xoxT.js +36 -0
- package/dist/{rule-Cd2M6Ri2.js → rule-Hb9_sJvP.js} +180 -177
- package/dist/{rule-builder-B6og27Q1.js → rule-builder-BhwlX4fv.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/{template-DouRWBpv.js → template-PkDFDppy.js} +5 -5
- package/dist/trigger-vLHrldAH.js +114 -0
- package/dist/{vue-i18n-BTlOChXs.js → vue-i18n-ComnFt3O.js} +2 -2
- package/dist/{xlsx-SahfXQ70.js → xlsx-CsUJ1mq4.js} +1 -1
- package/package.json +8 -7
- package/dist/Analytic-DSD9TsKr.js +0 -622
- package/dist/Card-C1K7ULPo.js +0 -825
- package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-BYoaa_-x.js +0 -2809
- package/dist/Marketing-BiKE2gxA.js +0 -316
- package/dist/MemberList-CHlGREyR.js +0 -1733
- package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-Bruh-umZ.js +0 -1753
- package/dist/Segment-DXDNM0yd.js +0 -437
- package/dist/Store-C6-P6bwc.js +0 -1511
- package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-JaRdmqif.js +0 -890
- package/dist/index-BQm0C3Jm.js +0 -298
- package/dist/index-CuvNtC_M.js +0 -61
- package/dist/index-D-2nFLsg.js +0 -762
- package/dist/index-Dy4pmQpt.js +0 -29193
- package/dist/money-BHtBdZoz.js +0 -15
- package/dist/number-CZhcB8ef.js +0 -12
|
@@ -0,0 +1,567 @@
|
|
|
1
|
+
import { defineComponent as Q, onMounted as ue, openBlock as h, createElementBlock as Y, createElementVNode as i, toDisplayString as D, unref as a, createVNode as l, ref as H, computed as X, resolveComponent as x, createBlock as W, isRef as ye, createSlots as ve, withCtx as C, Fragment as q, h as B, onBeforeMount as _e, renderList as Se } from "vue";
|
|
2
|
+
import { _ as xe } from "./campaign-CpzFl8Vr.js";
|
|
3
|
+
import { F as re, p as he, u as we } from "./loading-BTEwnG5-.js";
|
|
4
|
+
import { components as Z } from "@feedmepos/ui-library";
|
|
5
|
+
import { u as pe, _ as me } from "./usePagination-BeF5K3M7.js";
|
|
6
|
+
import { u as Fe } from "./vue-i18n-ComnFt3O.js";
|
|
7
|
+
import { w as Ce } from "./xlsx-CsUJ1mq4.js";
|
|
8
|
+
import { e as Me, M as ke } from "./email-addresses-BocLAqLt.js";
|
|
9
|
+
import { Z as Ie } from "./zod-Bg2FbC-D.js";
|
|
10
|
+
import { a as Pe } from "./index-7QsBQpBM.js";
|
|
11
|
+
import { u as Re } from "./app-wDQR6dpb.js";
|
|
12
|
+
import { R as Be } from "./rule-builder-BhwlX4fv.js";
|
|
13
|
+
import { _ as Ee } from "./ZodTextField.vue_vue_type_script_setup_true_lang-aq-9V3Gc.js";
|
|
14
|
+
import { _ as De } from "./RuleGroup.vue_vue_type_script_setup_true_lang-CqMCdTsv.js";
|
|
15
|
+
import { h as z } from "./moment-BWErdI6_.js";
|
|
16
|
+
import { s as E, u as Ye } from "./membership-DkH7qw6W.js";
|
|
17
|
+
import { o as $e } from "./objectId-dwaoBfJX.js";
|
|
18
|
+
import { u as ge } from "./business-trsrJyHK.js";
|
|
19
|
+
import { f as be } from "./number-BKHcstZb.js";
|
|
20
|
+
import { t as Le } from "./money-BfCdj0Ts.js";
|
|
21
|
+
import { m as ce } from "./index-DwXHEi0X.js";
|
|
22
|
+
const Te = Pe.extend({
|
|
23
|
+
_id: re.optional(),
|
|
24
|
+
business: re.optional()
|
|
25
|
+
}), 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__ */ Q({
|
|
26
|
+
__name: "ReviewSegment",
|
|
27
|
+
props: {
|
|
28
|
+
title: {},
|
|
29
|
+
segment: {}
|
|
30
|
+
},
|
|
31
|
+
setup(e) {
|
|
32
|
+
const c = e, S = [
|
|
33
|
+
{
|
|
34
|
+
header: "Name",
|
|
35
|
+
accessorFn: (n) => n.name
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
header: "Id",
|
|
39
|
+
accessorFn: (n) => n._id
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
header: "Customer Since",
|
|
43
|
+
accessorFn: (n) => z($e(n._id.toString())).format("DD MMM YYYY")
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
header: "Phone",
|
|
47
|
+
accessorFn: (n) => n.phoneNumber
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
header: "Birthday",
|
|
51
|
+
accessorFn: (n) => z(n.birthday).format("DD MMM YYYY")
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
header: "Last Visit",
|
|
55
|
+
accessorFn: (n) => z(n.stats.lastVisit).format("DD MMM YYYY")
|
|
56
|
+
}
|
|
57
|
+
], v = async (n) => c.segment._id ? await E.paginateSegmentUsers(c.segment._id, {
|
|
58
|
+
limit: r.value.pageSize,
|
|
59
|
+
skip: n.pageIndex ?? 0,
|
|
60
|
+
sortBy: "_id",
|
|
61
|
+
search: n.searchValue,
|
|
62
|
+
descending: !0
|
|
63
|
+
}) : { resources: [], meta: { totalResources: 0, totalPages: 0 } }, { tableMeta: r, rowData: d, onSort: M, debouncedFetchData: f, onSearch: s } = pe(v);
|
|
64
|
+
return ue(async () => {
|
|
65
|
+
await f();
|
|
66
|
+
}), (n, u) => (h(), Y("div", Ve, [
|
|
67
|
+
i("div", Ne, D(c.title), 1),
|
|
68
|
+
i("div", ze, [
|
|
69
|
+
i("div", Ae, D(n.segment.members.length), 1),
|
|
70
|
+
i("div", Ue, [
|
|
71
|
+
u[1] || (u[1] = i("div", null, "contacts in your segment", -1)),
|
|
72
|
+
i("div", null, "as of " + D(a(z)(n.segment.lastUpdated).format("DD MMM YYYY")), 1)
|
|
73
|
+
])
|
|
74
|
+
]),
|
|
75
|
+
l(me, {
|
|
76
|
+
loading: a(r).isLoading,
|
|
77
|
+
"row-data": a(d),
|
|
78
|
+
"row-count": a(r).totalRows,
|
|
79
|
+
"column-defs": S,
|
|
80
|
+
"page-size": a(r).pageSize,
|
|
81
|
+
"page-count": a(r).pageCount,
|
|
82
|
+
"page-index": a(r).pageIndex,
|
|
83
|
+
onSortChange: a(M),
|
|
84
|
+
onPageChange: u[0] || (u[0] = (w) => a(f)({ pageSize: w.pageSize, pageIndex: w.pageIndex }))
|
|
85
|
+
}, null, 8, ["loading", "row-data", "row-count", "page-size", "page-count", "page-index", "onSortChange"])
|
|
86
|
+
]));
|
|
87
|
+
}
|
|
88
|
+
}), je = { class: "flex items-center gap-x-8" }, He = {
|
|
89
|
+
key: 0,
|
|
90
|
+
class: "space-y-16 pr-12"
|
|
91
|
+
}, qe = { class: "flex items-center gap-8" }, Je = /* @__PURE__ */ Q({
|
|
92
|
+
__name: "SegmentSheet",
|
|
93
|
+
emits: ["update:model-value"],
|
|
94
|
+
setup(e, { expose: c, emit: S }) {
|
|
95
|
+
const v = Re(), r = H(!1), d = H(!1), M = {
|
|
96
|
+
name: "",
|
|
97
|
+
rule: Be.scaffoldGroup(),
|
|
98
|
+
members: []
|
|
99
|
+
}, f = Te, s = H(M), n = X(() => {
|
|
100
|
+
const _ = f.safeParse(s.value);
|
|
101
|
+
return _.success ? [] : _.error.errors;
|
|
102
|
+
});
|
|
103
|
+
function u(_) {
|
|
104
|
+
r.value = !0, d.value = !1, _ ? s.value = { ..._ } : s.value = { ...M };
|
|
105
|
+
}
|
|
106
|
+
function w() {
|
|
107
|
+
r.value = !1;
|
|
108
|
+
}
|
|
109
|
+
async function I() {
|
|
110
|
+
f.safeParse(s.value).success && (d.value = !0);
|
|
111
|
+
}
|
|
112
|
+
function $() {
|
|
113
|
+
d.value = !1;
|
|
114
|
+
}
|
|
115
|
+
async function b() {
|
|
116
|
+
k("update:model-value", s.value);
|
|
117
|
+
}
|
|
118
|
+
ue(async () => {
|
|
119
|
+
});
|
|
120
|
+
const k = S;
|
|
121
|
+
return c({
|
|
122
|
+
showSheet: u,
|
|
123
|
+
hideSheet: w
|
|
124
|
+
}), (_, t) => {
|
|
125
|
+
const o = x("FmButton"), F = x("FmSideSheet");
|
|
126
|
+
return h(), W(F, {
|
|
127
|
+
modelValue: a(r),
|
|
128
|
+
"onUpdate:modelValue": t[5] || (t[5] = (p) => ye(r) ? r.value = p : null),
|
|
129
|
+
header: "Add segment",
|
|
130
|
+
"dismiss-away": "",
|
|
131
|
+
"close-button": !0,
|
|
132
|
+
"max-width": 1100
|
|
133
|
+
}, ve({
|
|
134
|
+
"side-sheet-footer": C(() => [
|
|
135
|
+
i("div", qe, [
|
|
136
|
+
a(d) ? (h(), Y(q, { key: 0 }, [
|
|
137
|
+
l(o, {
|
|
138
|
+
label: "Save Segment",
|
|
139
|
+
onClick: b,
|
|
140
|
+
loading: a(v).isLoading,
|
|
141
|
+
disabled: a(n).length > 0 || a(v).isLoading
|
|
142
|
+
}, null, 8, ["loading", "disabled"]),
|
|
143
|
+
l(o, {
|
|
144
|
+
label: "Cancel",
|
|
145
|
+
onClick: t[3] || (t[3] = (p) => $()),
|
|
146
|
+
variant: "tertiary"
|
|
147
|
+
})
|
|
148
|
+
], 64)) : (h(), Y(q, { key: 1 }, [
|
|
149
|
+
l(o, {
|
|
150
|
+
label: "Review Segment",
|
|
151
|
+
disabled: a(n).length > 0 || a(v).isLoading,
|
|
152
|
+
onClick: I
|
|
153
|
+
}, null, 8, ["disabled"]),
|
|
154
|
+
l(o, {
|
|
155
|
+
label: "Cancel",
|
|
156
|
+
onClick: t[4] || (t[4] = (p) => w()),
|
|
157
|
+
variant: "tertiary"
|
|
158
|
+
})
|
|
159
|
+
], 64))
|
|
160
|
+
])
|
|
161
|
+
]),
|
|
162
|
+
default: C(() => {
|
|
163
|
+
var p;
|
|
164
|
+
return [
|
|
165
|
+
a(d) ? (h(), W(Oe, {
|
|
166
|
+
key: 1,
|
|
167
|
+
title: a(s).name,
|
|
168
|
+
segment: a(s)
|
|
169
|
+
}, null, 8, ["title", "segment"])) : (h(), Y("div", He, [
|
|
170
|
+
l(Ee, {
|
|
171
|
+
modelValue: a(s).name,
|
|
172
|
+
"onUpdate:modelValue": t[1] || (t[1] = (y) => a(s).name = y),
|
|
173
|
+
label: "Segment title",
|
|
174
|
+
schema: a(Ie).typeAtPath(a(f), "name")
|
|
175
|
+
}, null, 8, ["modelValue", "schema"]),
|
|
176
|
+
t[7] || (t[7] = i("div", { class: "fm-typo-en-title-sm-800" }, "Segment Filter", -1)),
|
|
177
|
+
l(De, {
|
|
178
|
+
"trigger-type": "MEMBERSHIP_JOINED",
|
|
179
|
+
includeOnly: "user",
|
|
180
|
+
"model-value": (p = a(s)) == null ? void 0 : p.rule,
|
|
181
|
+
"onUpdate:modelValue": t[2] || (t[2] = (y) => {
|
|
182
|
+
a(s).rule = y;
|
|
183
|
+
})
|
|
184
|
+
}, null, 8, ["model-value"])
|
|
185
|
+
]))
|
|
186
|
+
];
|
|
187
|
+
}),
|
|
188
|
+
_: 2
|
|
189
|
+
}, [
|
|
190
|
+
a(d) ? {
|
|
191
|
+
name: "side-sheet-header",
|
|
192
|
+
fn: C(() => [
|
|
193
|
+
i("div", je, [
|
|
194
|
+
l(o, {
|
|
195
|
+
icon: "arrow_back",
|
|
196
|
+
variant: "tertiary",
|
|
197
|
+
onClick: t[0] || (t[0] = (p) => d.value = !1)
|
|
198
|
+
}),
|
|
199
|
+
t[6] || (t[6] = i("div", null, "Review segment", -1))
|
|
200
|
+
])
|
|
201
|
+
]),
|
|
202
|
+
key: "0"
|
|
203
|
+
} : void 0
|
|
204
|
+
]), 1032, ["modelValue"]);
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
}), de = Ye(), Ge = ge();
|
|
208
|
+
function K(e) {
|
|
209
|
+
const c = z(e);
|
|
210
|
+
return c.isValid() ? c.format("DD/MM/YYYY") : "";
|
|
211
|
+
}
|
|
212
|
+
const Ze = {
|
|
213
|
+
mapMemberExportRow: (e) => {
|
|
214
|
+
var n, u, w, I, $, b, k, _, t, o, F, p, y, P, L, T, V, N, J, m, A, ee, te, oe, ae, ne, se, ie;
|
|
215
|
+
const c = X(() => Ge.locations.map((g) => ({
|
|
216
|
+
label: g.name,
|
|
217
|
+
value: g._id
|
|
218
|
+
}))), S = (n = Me.parseOneAddress(
|
|
219
|
+
e == null ? void 0 : e.email
|
|
220
|
+
)) != null && n.domain.includes("feedmepos.com") ? void 0 : e.email, v = (w = ((u = e == null ? void 0 : e.collection) == null ? void 0 : u.TITLE) || []) == null ? void 0 : w.reduce(
|
|
221
|
+
(g, R) => {
|
|
222
|
+
var O, j;
|
|
223
|
+
const U = (j = (O = de.sortedTitles) == null ? void 0 : O.find(
|
|
224
|
+
(G) => G._id === R.collectible
|
|
225
|
+
)) == null ? void 0 : j.name;
|
|
226
|
+
return !U || R.balance <= 0 || g.push(U), g;
|
|
227
|
+
},
|
|
228
|
+
[]
|
|
229
|
+
), r = (de.sortedTitles || []).reduce(
|
|
230
|
+
(g, R) => {
|
|
231
|
+
var O, j, G, le;
|
|
232
|
+
const U = (le = (G = (j = (((O = e == null ? void 0 : e.collection) == null ? void 0 : O.TITLE) || []).find(
|
|
233
|
+
(fe) => fe.collectible === R._id
|
|
234
|
+
)) == null ? void 0 : j.expiryBalance) == null ? void 0 : G[0]) == null ? void 0 : le.expiredAt;
|
|
235
|
+
return g[R.name] = U ? z(U).format("DD/MM/YYYY") : "", g;
|
|
236
|
+
},
|
|
237
|
+
{}
|
|
238
|
+
), d = ((b = ($ = (I = e.collection) == null ? void 0 : I.CREDIT) == null ? void 0 : $.at(0)) == null ? void 0 : b.balance) || 0, M = ((o = (t = (_ = (k = e.collection) == null ? void 0 : k.CREDIT) == null ? void 0 : _.at(0)) == null ? void 0 : t.expiryBalance) == null ? void 0 : o.reduce(
|
|
239
|
+
(g, R) => g + R.amount,
|
|
240
|
+
0
|
|
241
|
+
)) || 0, f = be(d, 2);
|
|
242
|
+
return {
|
|
243
|
+
ID: e._id.toString(),
|
|
244
|
+
Name: ((F = e.name) == null ? void 0 : F.trim()) || "",
|
|
245
|
+
Phone: ((p = e == null ? void 0 : e.phoneNumber) == null ? void 0 : p.trim()) || "",
|
|
246
|
+
Email: S || "",
|
|
247
|
+
Gender: e.gender || "",
|
|
248
|
+
CardNo: e.cardNo || "",
|
|
249
|
+
Birthday: e != null && e.birthday ? K(e == null ? void 0 : e.birthday) : "",
|
|
250
|
+
Credit: parseFloat((Number(f) - Number(M)).toFixed(2)),
|
|
251
|
+
FreeCredit: Number(M.toFixed(2)),
|
|
252
|
+
TotalCredit: Number(f),
|
|
253
|
+
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,
|
|
254
|
+
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,
|
|
255
|
+
Level: e != null && e.collection ? ((A = (m = (J = e.collection) == null ? void 0 : J.TIER) == null ? void 0 : m.at(0)) == null ? void 0 : A.balance) ?? 0 : 0,
|
|
256
|
+
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,
|
|
257
|
+
Titles: v.join(","),
|
|
258
|
+
...r,
|
|
259
|
+
TotalTransaction: e.stats.visitCount,
|
|
260
|
+
AvgSpent: Le(Number(e.stats.avgBillSize || 0)).toFormat(
|
|
261
|
+
!1
|
|
262
|
+
),
|
|
263
|
+
TotalSpent: e.stats.avgBillSize * e.stats.visitCount,
|
|
264
|
+
LastVisit: K(e.stats.lastVisit),
|
|
265
|
+
Feedback: ((ae = e.stats) == null ? void 0 : ae.feedbackCount) || 0,
|
|
266
|
+
LastSeasonTierEarned: ((ne = e.stats) == null ? void 0 : ne.lastSeasonTierEarned) || 0,
|
|
267
|
+
LastSeasonPointEarned: ((se = e.stats) == null ? void 0 : se.lastSeasonPointEarned) || 0,
|
|
268
|
+
JoinedAt: K(e.joinAt || void 0),
|
|
269
|
+
JoinedAtLocation: e.location && ((ie = c.value.find((g) => g.value == e.location)) == null ? void 0 : ie.label) || "-",
|
|
270
|
+
VisitFrequency: `${Number(
|
|
271
|
+
Math.ceil(e.stats.avgVisitFrequency).toFixed(0)
|
|
272
|
+
)}`
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
}, We = { class: "flex items-center" }, Ke = { class: "fm-typo-en-title-md-600 fm-step-title line-clamp-2 mr-8" }, Qe = { class: "px-24 flex flex-col gap-y-16" }, Xe = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, et = { class: "fm-typo-en-body-md-600" }, tt = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, Ft = /* @__PURE__ */ Q({
|
|
276
|
+
__name: "Segment",
|
|
277
|
+
setup(e) {
|
|
278
|
+
const { minor: c } = we, { t: S } = Fe(), v = ge(), { mapMemberExportRow: r } = Ze, d = H(0), M = [
|
|
279
|
+
{
|
|
280
|
+
header: S("connect.loyalty.segment.table.name"),
|
|
281
|
+
accessorFn: (t) => t.name
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
header: S("connect.loyalty.segment.table.total_customers"),
|
|
285
|
+
accessorFn: (t) => t.memberCount ?? 0
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
header: S("connect.loyalty.segment.table.customer_percentage"),
|
|
289
|
+
accessorFn: (t) => ((t.memberCount ?? 0) * 100 / d.value).toFixed(2)
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
header: S("connect.loyalty.segment.table.actions"),
|
|
293
|
+
meta: {
|
|
294
|
+
maxWidth: "100px"
|
|
295
|
+
},
|
|
296
|
+
cell(t) {
|
|
297
|
+
return B("div", { class: "flex items-center justify-end" }, [
|
|
298
|
+
B(
|
|
299
|
+
Z.FmMenu,
|
|
300
|
+
{
|
|
301
|
+
placement: "bottom-end",
|
|
302
|
+
onClick: (o) => {
|
|
303
|
+
o.stopPropagation();
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
"menu-button": () => B(Z.FmButton, {
|
|
308
|
+
icon: "more_vert",
|
|
309
|
+
iconColor: "neutral-gray-400",
|
|
310
|
+
variant: "tertiary"
|
|
311
|
+
}),
|
|
312
|
+
default: () => [
|
|
313
|
+
B(
|
|
314
|
+
Z.FmMenuItem,
|
|
315
|
+
{
|
|
316
|
+
onClick: async (o) => {
|
|
317
|
+
o.stopPropagation(), $(t.row.original);
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
label: B(
|
|
322
|
+
"div",
|
|
323
|
+
{
|
|
324
|
+
class: "fm-typo-en-body-md-400"
|
|
325
|
+
},
|
|
326
|
+
"Export"
|
|
327
|
+
)
|
|
328
|
+
}
|
|
329
|
+
),
|
|
330
|
+
B(
|
|
331
|
+
Z.FmMenuItem,
|
|
332
|
+
{
|
|
333
|
+
onClick: async (o) => {
|
|
334
|
+
o.stopPropagation(), I(t.row.original);
|
|
335
|
+
}
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
label: B(
|
|
339
|
+
"div",
|
|
340
|
+
{
|
|
341
|
+
class: "text-fm-color-typo-error fm-typo-en-body-md-400"
|
|
342
|
+
},
|
|
343
|
+
"Remove"
|
|
344
|
+
)
|
|
345
|
+
}
|
|
346
|
+
)
|
|
347
|
+
]
|
|
348
|
+
}
|
|
349
|
+
)
|
|
350
|
+
]);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
], f = H(null), { tableMeta: s, rowData: n, debouncedFetchData: u } = pe(
|
|
354
|
+
E.readAll
|
|
355
|
+
);
|
|
356
|
+
async function w() {
|
|
357
|
+
await c(
|
|
358
|
+
async () => {
|
|
359
|
+
await E.refreshSegments(), await u({ pageSize: 10, pageIndex: 0 });
|
|
360
|
+
},
|
|
361
|
+
{ message: "Refreshing segmentations" }
|
|
362
|
+
);
|
|
363
|
+
}
|
|
364
|
+
async function I(t) {
|
|
365
|
+
await he.remove(`Are you sure you want to remove ${t.name}?`) && await c(
|
|
366
|
+
async () => {
|
|
367
|
+
await E.delete(t._id), await u({ pageSize: 10, pageIndex: 0 });
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
message: `Removing ${t.name}`,
|
|
371
|
+
successMessage: `Removed ${t.name} successfully`
|
|
372
|
+
}
|
|
373
|
+
);
|
|
374
|
+
}
|
|
375
|
+
async function $(t) {
|
|
376
|
+
const o = {
|
|
377
|
+
sortBy: "_id",
|
|
378
|
+
descending: !1,
|
|
379
|
+
rowsPerPage: 1e3,
|
|
380
|
+
page: 1,
|
|
381
|
+
rowsNumber: 0
|
|
382
|
+
}, F = new ke(), p = (await ce.read({
|
|
383
|
+
limit: 1,
|
|
384
|
+
skip: 0,
|
|
385
|
+
sortBy: o.sortBy,
|
|
386
|
+
descending: o.descending
|
|
387
|
+
})).meta.totalResources ?? 0, y = o.rowsPerPage;
|
|
388
|
+
await c(
|
|
389
|
+
async () => {
|
|
390
|
+
for (let P = 0; P < p; P += y) {
|
|
391
|
+
const L = {
|
|
392
|
+
...o,
|
|
393
|
+
limit: y,
|
|
394
|
+
skip: o.page - 1,
|
|
395
|
+
sortBy: o.sortBy,
|
|
396
|
+
descending: o.descending
|
|
397
|
+
}, T = await E.paginateSegmentUsers(
|
|
398
|
+
t._id,
|
|
399
|
+
L
|
|
400
|
+
);
|
|
401
|
+
for (const V of T.resources) {
|
|
402
|
+
const N = r(V);
|
|
403
|
+
F.addRecord(N);
|
|
404
|
+
}
|
|
405
|
+
o.page++;
|
|
406
|
+
}
|
|
407
|
+
await Ce(
|
|
408
|
+
F.buildExcel(),
|
|
409
|
+
`[${t.name}]-members-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
|
|
410
|
+
{
|
|
411
|
+
bookType: "xlsx",
|
|
412
|
+
bookSST: !1,
|
|
413
|
+
type: "array"
|
|
414
|
+
}
|
|
415
|
+
), o.page = 1;
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
message: "Exporting member...",
|
|
419
|
+
successMessage: "Member exported successfully"
|
|
420
|
+
}
|
|
421
|
+
);
|
|
422
|
+
}
|
|
423
|
+
async function b(t) {
|
|
424
|
+
await c(
|
|
425
|
+
async () => {
|
|
426
|
+
var o;
|
|
427
|
+
if (t._id) {
|
|
428
|
+
const { members: F, _id: p, ...y } = t;
|
|
429
|
+
await E.update(t._id, y);
|
|
430
|
+
} else
|
|
431
|
+
await E.create(t);
|
|
432
|
+
await u({ pageSize: 10, pageIndex: 0 }), (o = f.value) == null || o.hideSheet();
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
message: "Saving segment",
|
|
436
|
+
successMessage: "Segment saved"
|
|
437
|
+
}
|
|
438
|
+
);
|
|
439
|
+
}
|
|
440
|
+
function k(t) {
|
|
441
|
+
var o;
|
|
442
|
+
(o = f.value) == null || o.showSheet(t);
|
|
443
|
+
}
|
|
444
|
+
const _ = X(() => v.isPremium ? [
|
|
445
|
+
{
|
|
446
|
+
label: "Refresh segments",
|
|
447
|
+
value: "refresh"
|
|
448
|
+
},
|
|
449
|
+
{
|
|
450
|
+
label: "Add segment",
|
|
451
|
+
value: "add",
|
|
452
|
+
isPrimary: !0,
|
|
453
|
+
prependIcon: "add"
|
|
454
|
+
}
|
|
455
|
+
] : []);
|
|
456
|
+
return _e(async () => {
|
|
457
|
+
const { meta: t } = await ce.read({
|
|
458
|
+
limit: 1,
|
|
459
|
+
skip: 0,
|
|
460
|
+
sortBy: "_id",
|
|
461
|
+
search: void 0,
|
|
462
|
+
descending: !1
|
|
463
|
+
});
|
|
464
|
+
d.value = t.totalResources ?? 0, await u({ pageSize: 10, pageIndex: 0 }), await v.readPremium(), await v.readLocations();
|
|
465
|
+
}), (t, o) => {
|
|
466
|
+
const F = x("FmPill"), p = x("FmPageHead"), y = x("FmIcon"), P = x("FmMenuItem"), L = x("FmMenu"), T = x("FmListItem"), V = x("FmList"), N = x("FmButton"), J = x("FmCard");
|
|
467
|
+
return h(), Y(q, null, [
|
|
468
|
+
l(p, {
|
|
469
|
+
title: "Segments",
|
|
470
|
+
actions: a(_),
|
|
471
|
+
"onClick:action": o[0] || (o[0] = (m) => m === "add" ? k() : w())
|
|
472
|
+
}, {
|
|
473
|
+
title: C(() => [
|
|
474
|
+
i("div", We, [
|
|
475
|
+
i("span", Ke, D(a(S)("connect.loyalty.segment.title")), 1),
|
|
476
|
+
l(F, { variant: "premium" })
|
|
477
|
+
])
|
|
478
|
+
]),
|
|
479
|
+
_: 1
|
|
480
|
+
}, 8, ["actions"]),
|
|
481
|
+
i("div", Qe, [
|
|
482
|
+
a(n).length > 0 || a(s).searchValue || a(s).isLoading ? (h(), Y(q, { key: 0 }, [
|
|
483
|
+
l(me, {
|
|
484
|
+
loading: a(s).isLoading,
|
|
485
|
+
"row-data": a(n),
|
|
486
|
+
"row-count": a(s).totalRows,
|
|
487
|
+
"column-defs": M,
|
|
488
|
+
"shrink-at": !1,
|
|
489
|
+
"page-count": a(s).pageCount,
|
|
490
|
+
"page-index": a(s).pageIndex,
|
|
491
|
+
"page-size": a(s).pageSize,
|
|
492
|
+
onRowClick: o[1] || (o[1] = (m) => {
|
|
493
|
+
k(m.original);
|
|
494
|
+
}),
|
|
495
|
+
onPageChange: a(u)
|
|
496
|
+
}, null, 8, ["loading", "row-data", "row-count", "page-count", "page-index", "page-size", "onPageChange"]),
|
|
497
|
+
l(V, { class: "w-full hidden xs:block" }, {
|
|
498
|
+
default: C(() => [
|
|
499
|
+
(h(!0), Y(q, null, Se(a(n), (m) => (h(), W(T, {
|
|
500
|
+
key: m._id.toString(),
|
|
501
|
+
tag: "label",
|
|
502
|
+
onClick: (A) => k(m)
|
|
503
|
+
}, {
|
|
504
|
+
default: C(() => [
|
|
505
|
+
i("div", null, [
|
|
506
|
+
i("div", Xe, D((m.memberCount ?? 0).toLocaleString()) + " total customers ", 1),
|
|
507
|
+
i("div", et, D(m.name), 1),
|
|
508
|
+
i("div", tt, D(((m.memberCount ?? 0) * 100 / a(d)).toFixed(2)) + "% of customers ", 1)
|
|
509
|
+
])
|
|
510
|
+
]),
|
|
511
|
+
append: C(() => [
|
|
512
|
+
l(L, { "stop-click-propagation": !0 }, {
|
|
513
|
+
"menu-button": C(() => [
|
|
514
|
+
l(y, { name: "more_vert" })
|
|
515
|
+
]),
|
|
516
|
+
default: C(() => [
|
|
517
|
+
l(P, {
|
|
518
|
+
class: "text-fm-color-typo-error fm-typo-en-body-md-400",
|
|
519
|
+
label: "Remove",
|
|
520
|
+
"onUpdate:modelValue": (A) => A && I(m)
|
|
521
|
+
}, null, 8, ["onUpdate:modelValue"])
|
|
522
|
+
]),
|
|
523
|
+
_: 2
|
|
524
|
+
}, 1024)
|
|
525
|
+
]),
|
|
526
|
+
_: 2
|
|
527
|
+
}, 1032, ["onClick"]))), 128))
|
|
528
|
+
]),
|
|
529
|
+
_: 1
|
|
530
|
+
})
|
|
531
|
+
], 64)) : (h(), W(J, {
|
|
532
|
+
key: 1,
|
|
533
|
+
variant: "outlined",
|
|
534
|
+
class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
|
|
535
|
+
}, {
|
|
536
|
+
default: C(() => [
|
|
537
|
+
o[3] || (o[3] = i("img", {
|
|
538
|
+
src: xe,
|
|
539
|
+
class: "aspect-square w-[150px]"
|
|
540
|
+
}, null, -1)),
|
|
541
|
+
o[4] || (o[4] = i("div", { class: "flex flex-col gap-16 text-center" }, [
|
|
542
|
+
i("div", { class: "fm-typo-en-title-sm-800" }, "Create customer segments"),
|
|
543
|
+
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. ")
|
|
544
|
+
], -1)),
|
|
545
|
+
l(N, {
|
|
546
|
+
variant: "primary",
|
|
547
|
+
label: "Create segment",
|
|
548
|
+
disabled: !a(v).isPremium,
|
|
549
|
+
icon: "add",
|
|
550
|
+
onClick: o[2] || (o[2] = (m) => k())
|
|
551
|
+
}, null, 8, ["disabled"])
|
|
552
|
+
]),
|
|
553
|
+
_: 1
|
|
554
|
+
})),
|
|
555
|
+
l(Je, {
|
|
556
|
+
ref_key: "sheetRef",
|
|
557
|
+
ref: f,
|
|
558
|
+
"onUpdate:modelValue": b
|
|
559
|
+
}, null, 512)
|
|
560
|
+
])
|
|
561
|
+
], 64);
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
});
|
|
565
|
+
export {
|
|
566
|
+
Ft as default
|
|
567
|
+
};
|