@feedmepos/mf-connect 0.1.1-prod → 0.1.3-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-DiPWt78u.js +423 -0
- package/dist/{App-DlRvkDpN.js → App-DvtYt9h5.js} +5 -5
- package/dist/{Broadcast-DpCGUS6r.js → Broadcast-Dv4XcvBh.js} +14 -14
- package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-Cj4IcH5D.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DoH4RX_Y.js} +8 -8
- package/dist/{Card-DjGC6jmq.js → Card-DDvwlZF0.js} +30 -30
- package/dist/{Collections-Q2pYWnJF.js → Collections-C5-k8WkG.js} +4 -4
- package/dist/{Credit-DOIq2VYW.js → Credit-BDQIr_FJ.js} +7 -7
- package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-D7ML8ePp.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-DCbvlp5V.js} +22 -22
- package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-CyxWG5I7.js → EffectSheet.vue_vue_type_style_index_0_lang-BQzgcn4V.js} +5 -5
- package/dist/{Experience-DUst4I0H.js → Experience-B9H3tOF0.js} +13 -13
- package/dist/{Game-CXnQR-wV.js → Game-cy3_ppLO.js} +15 -15
- package/dist/{Marketing-CZfHsMFC.js → Marketing-CWXV2n5F.js} +4 -4
- package/dist/{Member-CX5Ohgeg.js → Member-DyTX22Zk.js} +3 -3
- package/dist/{MemberList-D8I3SaAs.js → MemberList-CMefeirT.js} +84 -84
- package/dist/{MemberTransactions-DfZNbCHD.js → MemberTransactions-B9oYdzjR.js} +1 -1
- package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-BxFVEoBX.js → MessageInput.vue_vue_type_script_setup_true_lang-B0T7ze7r.js} +2 -2
- package/dist/{Mission-S1pwDbqp.js → Mission-DxSO3iES.js} +13 -13
- package/dist/{Point-BdLUcGZy.js → Point-C5UtlqkX.js} +7 -7
- package/dist/{Promotion-DWAeQGkU.js → Promotion-DhSGTj-R.js} +8 -8
- package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-Dux_NMO5.js → RuleGroup.vue_vue_type_script_setup_true_lang-BGM1doWM.js} +14 -14
- package/dist/Segment-BzI6Ykxp.js +564 -0
- package/dist/{Setting-CLuXuEId.js → Setting-SRUWwF9w.js} +7 -7
- package/dist/{Store-Be3cui0S.js → Store-CIrn_7Mh.js} +11 -11
- package/dist/{StoreRewards-zFy_w8p4.js → StoreRewards-BYc0vgnr.js} +10 -10
- package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-DxGJKgbc.js → StoreTransactions.vue_vue_type_script_setup_true_lang-JumDBZLs.js} +10 -10
- package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-Dreo45H1.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-BtBCggcN.js} +1 -1
- package/dist/{Tier-ChzcISYF.js → Tier-ms8r2E7c.js} +13 -13
- package/dist/{Title-DQSjhBkT.js → Title-BBKoBs46.js} +13 -13
- package/dist/{Transaction-CeWmWpN_.js → Transaction-IZL9-6fe.js} +1 -1
- package/dist/{Voucher-BkLIxiZN.js → Voucher-CIWulmcc.js} +10 -10
- package/dist/{app-CLNirPsB.js → app-BQvluJk_.js} +24 -24
- package/dist/{app-DuNsy0aC.js → app-CGgrMOc_.js} +1 -1
- package/dist/app.js +1 -1
- package/dist/{business-COGiTmLD.js → business-DeMUnCNX.js} +1 -1
- package/dist/{campaign-BHZMjQi5.js → campaign-CBszI6An.js} +2 -2
- package/dist/{collection.fn-sAxtYO_r.js → collection.fn-D4Qgx1aW.js} +2 -2
- package/dist/{dto-ndeeV_nc.js → dto-Dtvg93Bz.js} +40 -40
- package/dist/{effect-BQt0rkdT.js → effect-2p4_SGbQ.js} +1 -1
- package/dist/{email-addresses-B3PazwKs.js → email-addresses-Bc9od2gA.js} +1 -1
- package/dist/{export-D6r-xNji.js → export-BK6FgeQO.js} +3 -3
- package/dist/{helper-CrjQw_Et.js → helper-DUkKW7uc.js} +1 -1
- package/dist/{index-C3AAy__p.js → index-AZ8cKg9n.js} +1 -1
- package/dist/{index-CqpEhMr6.js → index-B9f-K1No.js} +2 -2
- package/dist/{index-CvHj-wYi.js → index-BFcrfL4W.js} +1 -1
- package/dist/{index-DXpd07G3.js → index-BWWnWRpt.js} +2 -2
- package/dist/{index-Btlj28Vg.js → index-CTmiZrHu.js} +1 -1
- package/dist/{index-Daax_BQa.js → index-Ci8tkzSn.js} +1 -1
- package/dist/{index-Buy-yvAZ.js → index-Cvbyv9Hx.js} +1 -1
- package/dist/{index-DGLmbBnE.js → index-D4HYMbSu.js} +3 -3
- package/dist/{index-DrLEuIe1.js → index-DRaETKbn.js} +5 -5
- package/dist/{index-tSEYvA-2.js → index-M1SmasnI.js} +3 -3
- package/dist/{index-CHAaFSD2.js → index-UR1Lxi0C.js} +1 -1
- package/dist/{index-Cg3RFxc9.js → index-g4L04WYz.js} +5 -5
- package/dist/{index.esm2017-a5BlZ76G.js → index.esm2017-kvuav0Sd.js} +1 -1
- package/dist/{loading-B3XGyQ8W.js → loading-MNCADfHc.js} +4 -4
- package/dist/{membership-GIOJ1ptN.js → membership-CsbTF-DX.js} +3 -3
- package/dist/{money-z7VwzhZP.js → money-Lo7kavmu.js} +1 -1
- package/dist/{number-DHYb2ua_.js → number-BviV2K5O.js} +1 -1
- package/dist/{rule-iIEblTE4.js → rule-DKrUrnrM.js} +3 -3
- package/dist/{rule-builder-CcsWd5r9.js → rule-builder-DjPniLk6.js} +1 -1
- package/dist/{template-DMRMDZOW.js → template-DteMEC9C.js} +4 -4
- package/dist/{usePagination-CNFe0T2B.js → usePagination-BKTq-UbV.js} +1 -1
- package/package.json +1 -1
- package/dist/Analytic-C2etD-eu.js +0 -620
- package/dist/Segment-CXSE8Bzf.js +0 -560
package/dist/Segment-CXSE8Bzf.js
DELETED
|
@@ -1,560 +0,0 @@
|
|
|
1
|
-
import { defineComponent as K, onMounted as re, openBlock as h, createElementBlock as E, createElementVNode as s, toDisplayString as L, unref as o, createVNode as c, ref as j, computed as ce, resolveComponent as v, createBlock as Z, isRef as me, createSlots as ge, withCtx as S, Fragment as H, onBeforeMount as fe, renderList as ye, h as P } from "vue";
|
|
2
|
-
import { _ as _e } from "./campaign-CpzFl8Vr.js";
|
|
3
|
-
import { F as se, p as ve, u as he } from "./loading-B3XGyQ8W.js";
|
|
4
|
-
import { components as J } from "@feedmepos/ui-library";
|
|
5
|
-
import { a as de, _ as ue, w as Se } from "./usePagination-CNFe0T2B.js";
|
|
6
|
-
import { e as xe, M as we } from "./email-addresses-B3PazwKs.js";
|
|
7
|
-
import { _ as Fe, Z as Ce } from "./ZodTextField.vue_vue_type_script_setup_true_lang-3LlSDiq0.js";
|
|
8
|
-
import { a as Me } from "./index-tSEYvA-2.js";
|
|
9
|
-
import { u as ke } from "./app-wDQR6dpb.js";
|
|
10
|
-
import { R as Ie } from "./rule-builder-CcsWd5r9.js";
|
|
11
|
-
import { _ as Pe } from "./RuleGroup.vue_vue_type_script_setup_true_lang-Dux_NMO5.js";
|
|
12
|
-
import { h as V } from "./moment-BWErdI6_.js";
|
|
13
|
-
import { s as R, u as Re } from "./membership-GIOJ1ptN.js";
|
|
14
|
-
import { o as Ee } from "./objectId-dwaoBfJX.js";
|
|
15
|
-
import { u as $e } from "./business-COGiTmLD.js";
|
|
16
|
-
import { f as Be } from "./number-DHYb2ua_.js";
|
|
17
|
-
import { t as De } from "./money-z7VwzhZP.js";
|
|
18
|
-
import { m as ie } from "./index-C3AAy__p.js";
|
|
19
|
-
const Ye = Me.extend({
|
|
20
|
-
_id: se.optional(),
|
|
21
|
-
business: se.optional()
|
|
22
|
-
}), be = { class: "space-y-16 pr-12" }, Te = { class: "fm-typo-en-title-md-800" }, Ne = { class: "flex space-x-8" }, Ve = { class: "fm-typo-en-title-md-800 text-fm-color-primary" }, Le = { class: "text-fm-color-typo-secondary" }, ze = /* @__PURE__ */ s("div", null, "contacts in your segment", -1), Ae = /* @__PURE__ */ K({
|
|
23
|
-
__name: "ReviewSegment",
|
|
24
|
-
props: {
|
|
25
|
-
title: {},
|
|
26
|
-
segment: {}
|
|
27
|
-
},
|
|
28
|
-
setup(e) {
|
|
29
|
-
const d = e, x = [
|
|
30
|
-
{
|
|
31
|
-
header: "Name",
|
|
32
|
-
accessorFn: (n) => n.name
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
header: "Id",
|
|
36
|
-
accessorFn: (n) => n._id
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
header: "Customer Since",
|
|
40
|
-
accessorFn: (n) => V(Ee(n._id.toString())).format("DD MMM YYYY")
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
header: "Phone",
|
|
44
|
-
accessorFn: (n) => n.phoneNumber
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
header: "Birthday",
|
|
48
|
-
accessorFn: (n) => V(n.birthday).format("DD MMM YYYY")
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
header: "Last Visit",
|
|
52
|
-
accessorFn: (n) => V(n.stats.lastVisit).format("DD MMM YYYY")
|
|
53
|
-
}
|
|
54
|
-
], w = async (n) => d.segment._id ? await R.paginateSegmentUsers(d.segment._id, {
|
|
55
|
-
limit: l.value.pageSize,
|
|
56
|
-
skip: n.pageIndex ?? 0,
|
|
57
|
-
sortBy: "_id",
|
|
58
|
-
search: n.searchValue,
|
|
59
|
-
descending: !0
|
|
60
|
-
}) : { resources: [], meta: { totalResources: 0, totalPages: 0 } }, { tableMeta: l, rowData: p, onSort: f, debouncedFetchData: u, onSearch: i } = de(w);
|
|
61
|
-
return re(async () => {
|
|
62
|
-
await u();
|
|
63
|
-
}), (n, F) => (h(), E("div", be, [
|
|
64
|
-
s("div", Te, L(d.title), 1),
|
|
65
|
-
s("div", Ne, [
|
|
66
|
-
s("div", Ve, L(n.segment.members.length), 1),
|
|
67
|
-
s("div", Le, [
|
|
68
|
-
ze,
|
|
69
|
-
s("div", null, "as of " + L(o(V)(n.segment.lastUpdated).format("DD MMM YYYY")), 1)
|
|
70
|
-
])
|
|
71
|
-
]),
|
|
72
|
-
c(ue, {
|
|
73
|
-
loading: o(l).isLoading,
|
|
74
|
-
"row-data": o(p),
|
|
75
|
-
"row-count": o(l).totalRows,
|
|
76
|
-
"column-defs": x,
|
|
77
|
-
"page-size": o(l).pageSize,
|
|
78
|
-
"page-count": o(l).pageCount,
|
|
79
|
-
"page-index": o(l).pageIndex,
|
|
80
|
-
onSortChange: o(f),
|
|
81
|
-
onPageChange: F[0] || (F[0] = (y) => o(u)({ pageSize: y.pageSize, pageIndex: y.pageIndex }))
|
|
82
|
-
}, null, 8, ["loading", "row-data", "row-count", "page-size", "page-count", "page-index", "onSortChange"])
|
|
83
|
-
]));
|
|
84
|
-
}
|
|
85
|
-
}), Ue = { class: "flex items-center gap-x-8" }, Oe = /* @__PURE__ */ s("div", null, "Review segment", -1), je = {
|
|
86
|
-
key: 0,
|
|
87
|
-
class: "space-y-16 pr-12"
|
|
88
|
-
}, He = /* @__PURE__ */ s("div", { class: "fm-typo-en-title-sm-800" }, "Segment Filter", -1), qe = { class: "flex items-center gap-8" }, Ge = /* @__PURE__ */ K({
|
|
89
|
-
__name: "SegmentSheet",
|
|
90
|
-
emits: ["update:model-value"],
|
|
91
|
-
setup(e, { expose: d, emit: x }) {
|
|
92
|
-
const w = ke(), l = j(!1), p = j(!1), f = {
|
|
93
|
-
name: "",
|
|
94
|
-
rule: Ie.scaffoldGroup(),
|
|
95
|
-
members: []
|
|
96
|
-
}, u = Ye, i = j(f), n = ce(() => {
|
|
97
|
-
const a = u.safeParse(i.value);
|
|
98
|
-
return a.success ? [] : a.error.errors;
|
|
99
|
-
});
|
|
100
|
-
function F(a) {
|
|
101
|
-
l.value = !0, p.value = !1, a ? i.value = { ...a } : i.value = { ...f };
|
|
102
|
-
}
|
|
103
|
-
function y() {
|
|
104
|
-
l.value = !1;
|
|
105
|
-
}
|
|
106
|
-
async function $() {
|
|
107
|
-
u.safeParse(i.value).success && (p.value = !0);
|
|
108
|
-
}
|
|
109
|
-
function B() {
|
|
110
|
-
p.value = !1;
|
|
111
|
-
}
|
|
112
|
-
async function C() {
|
|
113
|
-
D("update:model-value", i.value);
|
|
114
|
-
}
|
|
115
|
-
re(async () => {
|
|
116
|
-
});
|
|
117
|
-
const D = x;
|
|
118
|
-
return d({
|
|
119
|
-
showSheet: F,
|
|
120
|
-
hideSheet: y
|
|
121
|
-
}), (a, t) => {
|
|
122
|
-
const m = v("FmButton"), M = v("FmSideSheet");
|
|
123
|
-
return h(), Z(M, {
|
|
124
|
-
modelValue: o(l),
|
|
125
|
-
"onUpdate:modelValue": t[5] || (t[5] = (r) => me(l) ? l.value = r : null),
|
|
126
|
-
header: "Add segment",
|
|
127
|
-
"dismiss-away": "",
|
|
128
|
-
"close-button": !0,
|
|
129
|
-
"max-width": 1100
|
|
130
|
-
}, ge({
|
|
131
|
-
"side-sheet-footer": S(() => [
|
|
132
|
-
s("div", qe, [
|
|
133
|
-
o(p) ? (h(), E(H, { key: 0 }, [
|
|
134
|
-
c(m, {
|
|
135
|
-
label: "Save Segment",
|
|
136
|
-
onClick: C,
|
|
137
|
-
loading: o(w).isLoading,
|
|
138
|
-
disabled: o(n).length > 0 || o(w).isLoading
|
|
139
|
-
}, null, 8, ["loading", "disabled"]),
|
|
140
|
-
c(m, {
|
|
141
|
-
label: "Cancel",
|
|
142
|
-
onClick: t[3] || (t[3] = (r) => B()),
|
|
143
|
-
variant: "tertiary"
|
|
144
|
-
})
|
|
145
|
-
], 64)) : (h(), E(H, { key: 1 }, [
|
|
146
|
-
c(m, {
|
|
147
|
-
label: "Review Segment",
|
|
148
|
-
disabled: o(n).length > 0 || o(w).isLoading,
|
|
149
|
-
onClick: $
|
|
150
|
-
}, null, 8, ["disabled"]),
|
|
151
|
-
c(m, {
|
|
152
|
-
label: "Cancel",
|
|
153
|
-
onClick: t[4] || (t[4] = (r) => y()),
|
|
154
|
-
variant: "tertiary"
|
|
155
|
-
})
|
|
156
|
-
], 64))
|
|
157
|
-
])
|
|
158
|
-
]),
|
|
159
|
-
default: S(() => {
|
|
160
|
-
var r;
|
|
161
|
-
return [
|
|
162
|
-
o(p) ? (h(), Z(Ae, {
|
|
163
|
-
key: 1,
|
|
164
|
-
title: o(i).name,
|
|
165
|
-
segment: o(i)
|
|
166
|
-
}, null, 8, ["title", "segment"])) : (h(), E("div", je, [
|
|
167
|
-
c(Fe, {
|
|
168
|
-
modelValue: o(i).name,
|
|
169
|
-
"onUpdate:modelValue": t[1] || (t[1] = (_) => o(i).name = _),
|
|
170
|
-
label: "Segment title",
|
|
171
|
-
schema: o(Ce).typeAtPath(o(u), "name")
|
|
172
|
-
}, null, 8, ["modelValue", "schema"]),
|
|
173
|
-
He,
|
|
174
|
-
c(Pe, {
|
|
175
|
-
"trigger-type": "MEMBERSHIP_JOINED",
|
|
176
|
-
includeOnly: "user",
|
|
177
|
-
"model-value": (r = o(i)) == null ? void 0 : r.rule,
|
|
178
|
-
"onUpdate:modelValue": t[2] || (t[2] = (_) => {
|
|
179
|
-
o(i).rule = _;
|
|
180
|
-
})
|
|
181
|
-
}, null, 8, ["model-value"])
|
|
182
|
-
]))
|
|
183
|
-
];
|
|
184
|
-
}),
|
|
185
|
-
_: 2
|
|
186
|
-
}, [
|
|
187
|
-
o(p) ? {
|
|
188
|
-
name: "side-sheet-header",
|
|
189
|
-
fn: S(() => [
|
|
190
|
-
s("div", Ue, [
|
|
191
|
-
c(m, {
|
|
192
|
-
icon: "arrow_back",
|
|
193
|
-
variant: "tertiary",
|
|
194
|
-
onClick: t[0] || (t[0] = (r) => p.value = !1)
|
|
195
|
-
}),
|
|
196
|
-
Oe
|
|
197
|
-
])
|
|
198
|
-
]),
|
|
199
|
-
key: "0"
|
|
200
|
-
} : void 0
|
|
201
|
-
]), 1032, ["modelValue"]);
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
}), le = Re();
|
|
205
|
-
function W(e) {
|
|
206
|
-
const d = V(e);
|
|
207
|
-
return d.isValid() ? d.format("DD/MM/YYYY") : "";
|
|
208
|
-
}
|
|
209
|
-
const Je = {
|
|
210
|
-
mapMemberExportRow: (e) => {
|
|
211
|
-
var i, n, F, y, $, B, C, D, a, t, m, M, r, _, Y, b, T, N, q, g, z, Q, X, ee, te, oe, ae;
|
|
212
|
-
const d = (i = xe.parseOneAddress(
|
|
213
|
-
e == null ? void 0 : e.email
|
|
214
|
-
)) != null && i.domain.includes("feedmepos.com") ? void 0 : e.email, x = (F = ((n = e == null ? void 0 : e.collection) == null ? void 0 : n.TITLE) || []) == null ? void 0 : F.reduce(
|
|
215
|
-
(k, I) => {
|
|
216
|
-
var U, O;
|
|
217
|
-
const A = (O = (U = le.sortedTitles) == null ? void 0 : U.find(
|
|
218
|
-
(G) => G._id === I.collectible
|
|
219
|
-
)) == null ? void 0 : O.name;
|
|
220
|
-
return !A || I.balance <= 0 || k.push(A), k;
|
|
221
|
-
},
|
|
222
|
-
[]
|
|
223
|
-
), w = (le.sortedTitles || []).reduce(
|
|
224
|
-
(k, I) => {
|
|
225
|
-
var U, O, G, ne;
|
|
226
|
-
const A = (ne = (G = (O = (((U = e == null ? void 0 : e.collection) == null ? void 0 : U.TITLE) || []).find(
|
|
227
|
-
(pe) => pe.collectible === I._id
|
|
228
|
-
)) == null ? void 0 : O.expiryBalance) == null ? void 0 : G[0]) == null ? void 0 : ne.expiredAt;
|
|
229
|
-
return k[I.name] = A ? V(A).format("DD/MM/YYYY") : "", k;
|
|
230
|
-
},
|
|
231
|
-
{}
|
|
232
|
-
), l = ((B = ($ = (y = e.collection) == null ? void 0 : y.CREDIT) == null ? void 0 : $.at(0)) == null ? void 0 : B.balance) || 0, p = ((t = (a = (D = (C = e.collection) == null ? void 0 : C.CREDIT) == null ? void 0 : D.at(0)) == null ? void 0 : a.expiryBalance) == null ? void 0 : t.reduce(
|
|
233
|
-
(k, I) => k + I.amount,
|
|
234
|
-
0
|
|
235
|
-
)) || 0, f = Be(l, 2);
|
|
236
|
-
return {
|
|
237
|
-
ID: e._id.toString(),
|
|
238
|
-
Name: ((m = e.name) == null ? void 0 : m.trim()) || "",
|
|
239
|
-
Phone: ((M = e == null ? void 0 : e.phoneNumber) == null ? void 0 : M.trim()) || "",
|
|
240
|
-
Email: d || "",
|
|
241
|
-
Gender: e.gender || "",
|
|
242
|
-
CardNo: e.cardNo || "",
|
|
243
|
-
Birthday: W((e == null ? void 0 : e.birthday) || void 0),
|
|
244
|
-
Credit: parseFloat((Number(f) - Number(p)).toFixed(2)),
|
|
245
|
-
FreeCredit: Number(p.toFixed(2)),
|
|
246
|
-
TotalCredit: Number(f),
|
|
247
|
-
Exp: e != null && e.collection ? ((Y = (_ = (r = e.collection) == null ? void 0 : r.POINT) == null ? void 0 : _.at(0)) == null ? void 0 : Y.balance) ?? 0 : 0,
|
|
248
|
-
Point: e != null && e.collection ? ((N = (T = (b = e.collection) == null ? void 0 : b.COIN) == null ? void 0 : T.at(0)) == null ? void 0 : N.balance) ?? 0 : 0,
|
|
249
|
-
Level: e != null && e.collection ? ((z = (g = (q = e.collection) == null ? void 0 : q.TIER) == null ? void 0 : g.at(0)) == null ? void 0 : z.balance) ?? 0 : 0,
|
|
250
|
-
Tier: e != null && e.collection ? ((ee = (X = (Q = e.collection) == null ? void 0 : Q.TIER) == null ? void 0 : X.at(0)) == null ? void 0 : ee.balance) ?? 0 : 0,
|
|
251
|
-
Titles: x.join(","),
|
|
252
|
-
...w,
|
|
253
|
-
TotalTransaction: e.stats.visitCount,
|
|
254
|
-
AvgSpent: De(Number(e.stats.avgBillSize || 0)).toFormat(
|
|
255
|
-
!1
|
|
256
|
-
),
|
|
257
|
-
TotalSpent: e.stats.avgBillSize * e.stats.visitCount,
|
|
258
|
-
LastVisit: W(e.stats.lastVisit),
|
|
259
|
-
Feedback: ((te = e.stats) == null ? void 0 : te.feedbackCount) || 0,
|
|
260
|
-
LastSeasonTierEarned: ((oe = e.stats) == null ? void 0 : oe.lastSeasonTierEarned) || 0,
|
|
261
|
-
LastSeasonPointEarned: ((ae = e.stats) == null ? void 0 : ae.lastSeasonPointEarned) || 0,
|
|
262
|
-
JoinedAt: W(e.joinAt || void 0),
|
|
263
|
-
VisitFrequency: `${Number(
|
|
264
|
-
Math.ceil(e.stats.avgVisitFrequency).toFixed(0)
|
|
265
|
-
)}`
|
|
266
|
-
};
|
|
267
|
-
}
|
|
268
|
-
}, Ze = { class: "flex items-center" }, We = /* @__PURE__ */ s("span", { class: "fm-typo-en-title-md-600 fm-step-title line-clamp-2 mr-8" }, " Segments ", -1), Ke = { class: "px-24 flex flex-col gap-y-16" }, Qe = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, Xe = { class: "fm-typo-en-body-md-600" }, et = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, tt = /* @__PURE__ */ s("img", {
|
|
269
|
-
src: _e,
|
|
270
|
-
class: "aspect-square w-[150px]"
|
|
271
|
-
}, null, -1), ot = /* @__PURE__ */ s("div", { class: "flex flex-col gap-16 text-center" }, [
|
|
272
|
-
/* @__PURE__ */ s("div", { class: "fm-typo-en-title-sm-800" }, "Create customer segments"),
|
|
273
|
-
/* @__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. ")
|
|
274
|
-
], -1), xt = /* @__PURE__ */ K({
|
|
275
|
-
__name: "Segment",
|
|
276
|
-
setup(e) {
|
|
277
|
-
const { minor: d } = he, x = $e(), { mapMemberExportRow: w } = Je, l = j(0), p = [
|
|
278
|
-
{
|
|
279
|
-
header: "Name",
|
|
280
|
-
accessorFn: (a) => a.name
|
|
281
|
-
},
|
|
282
|
-
{
|
|
283
|
-
header: "Total Customers in this Segment",
|
|
284
|
-
accessorFn: (a) => a.memberCount ?? 0
|
|
285
|
-
},
|
|
286
|
-
{
|
|
287
|
-
header: "% of customers",
|
|
288
|
-
accessorFn: (a) => ((a.memberCount ?? 0) * 100 / l.value).toFixed(2)
|
|
289
|
-
},
|
|
290
|
-
{
|
|
291
|
-
header: "Actions",
|
|
292
|
-
meta: {
|
|
293
|
-
maxWidth: "100px"
|
|
294
|
-
},
|
|
295
|
-
cell(a) {
|
|
296
|
-
return P("div", { class: "flex items-center justify-end" }, [
|
|
297
|
-
P(
|
|
298
|
-
J.FmMenu,
|
|
299
|
-
{
|
|
300
|
-
placement: "bottom-end",
|
|
301
|
-
onClick: (t) => {
|
|
302
|
-
t.stopPropagation();
|
|
303
|
-
}
|
|
304
|
-
},
|
|
305
|
-
{
|
|
306
|
-
"menu-button": () => P(J.FmButton, {
|
|
307
|
-
icon: "more_vert",
|
|
308
|
-
iconColor: "neutral-gray-400",
|
|
309
|
-
variant: "tertiary"
|
|
310
|
-
}),
|
|
311
|
-
default: () => [
|
|
312
|
-
P(
|
|
313
|
-
J.FmMenuItem,
|
|
314
|
-
{
|
|
315
|
-
onClick: async (t) => {
|
|
316
|
-
t.stopPropagation(), $(a.row.original);
|
|
317
|
-
}
|
|
318
|
-
},
|
|
319
|
-
{
|
|
320
|
-
label: P(
|
|
321
|
-
"div",
|
|
322
|
-
{
|
|
323
|
-
class: "fm-typo-en-body-md-400"
|
|
324
|
-
},
|
|
325
|
-
"Export"
|
|
326
|
-
)
|
|
327
|
-
}
|
|
328
|
-
),
|
|
329
|
-
P(
|
|
330
|
-
J.FmMenuItem,
|
|
331
|
-
{
|
|
332
|
-
onClick: async (t) => {
|
|
333
|
-
t.stopPropagation(), y(a.row.original);
|
|
334
|
-
}
|
|
335
|
-
},
|
|
336
|
-
{
|
|
337
|
-
label: P(
|
|
338
|
-
"div",
|
|
339
|
-
{
|
|
340
|
-
class: "text-fm-color-typo-error fm-typo-en-body-md-400"
|
|
341
|
-
},
|
|
342
|
-
"Remove"
|
|
343
|
-
)
|
|
344
|
-
}
|
|
345
|
-
)
|
|
346
|
-
]
|
|
347
|
-
}
|
|
348
|
-
)
|
|
349
|
-
]);
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
], f = j(null), { tableMeta: u, rowData: i, debouncedFetchData: n } = de(
|
|
353
|
-
R.readAll
|
|
354
|
-
);
|
|
355
|
-
async function F() {
|
|
356
|
-
await d(
|
|
357
|
-
async () => {
|
|
358
|
-
await R.refreshSegments(), await n({ pageSize: 10, pageIndex: 0 });
|
|
359
|
-
},
|
|
360
|
-
{ message: "Refreshing segmentations" }
|
|
361
|
-
);
|
|
362
|
-
}
|
|
363
|
-
async function y(a) {
|
|
364
|
-
await ve.remove(`Are you sure you want to remove ${a.name}?`) && await d(
|
|
365
|
-
async () => {
|
|
366
|
-
await R.delete(a._id), await n({ pageSize: 10, pageIndex: 0 });
|
|
367
|
-
},
|
|
368
|
-
{
|
|
369
|
-
message: `Removing ${a.name}`,
|
|
370
|
-
successMessage: `Removed ${a.name} successfully`
|
|
371
|
-
}
|
|
372
|
-
);
|
|
373
|
-
}
|
|
374
|
-
async function $(a) {
|
|
375
|
-
const t = {
|
|
376
|
-
sortBy: "_id",
|
|
377
|
-
descending: !1,
|
|
378
|
-
rowsPerPage: 1e3,
|
|
379
|
-
page: 1,
|
|
380
|
-
rowsNumber: 0
|
|
381
|
-
}, m = new we(), M = (await ie.read({
|
|
382
|
-
limit: 1,
|
|
383
|
-
skip: 0,
|
|
384
|
-
sortBy: t.sortBy,
|
|
385
|
-
descending: t.descending
|
|
386
|
-
})).meta.totalResources ?? 0, r = t.rowsPerPage;
|
|
387
|
-
await d(
|
|
388
|
-
async () => {
|
|
389
|
-
for (let _ = 0; _ < M; _ += r) {
|
|
390
|
-
const Y = {
|
|
391
|
-
...t,
|
|
392
|
-
limit: r,
|
|
393
|
-
skip: t.page - 1,
|
|
394
|
-
sortBy: t.sortBy,
|
|
395
|
-
descending: t.descending
|
|
396
|
-
}, b = await R.paginateSegmentUsers(
|
|
397
|
-
a._id,
|
|
398
|
-
Y
|
|
399
|
-
);
|
|
400
|
-
for (const T of b.resources) {
|
|
401
|
-
const N = w(T);
|
|
402
|
-
m.addRecord(N);
|
|
403
|
-
}
|
|
404
|
-
t.page++;
|
|
405
|
-
}
|
|
406
|
-
await Se(
|
|
407
|
-
m.buildExcel(),
|
|
408
|
-
`[${a.name}]-members-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
|
|
409
|
-
{
|
|
410
|
-
bookType: "xlsx",
|
|
411
|
-
bookSST: !1,
|
|
412
|
-
type: "array"
|
|
413
|
-
}
|
|
414
|
-
), t.page = 1;
|
|
415
|
-
},
|
|
416
|
-
{
|
|
417
|
-
message: "Exporting member...",
|
|
418
|
-
successMessage: "Member exported successfully"
|
|
419
|
-
}
|
|
420
|
-
);
|
|
421
|
-
}
|
|
422
|
-
async function B(a) {
|
|
423
|
-
await d(
|
|
424
|
-
async () => {
|
|
425
|
-
var t;
|
|
426
|
-
if (a._id) {
|
|
427
|
-
const { members: m, _id: M, ...r } = a;
|
|
428
|
-
await R.update(a._id, r);
|
|
429
|
-
} else
|
|
430
|
-
await R.create(a);
|
|
431
|
-
await n({ pageSize: 10, pageIndex: 0 }), (t = f.value) == null || t.hideSheet();
|
|
432
|
-
},
|
|
433
|
-
{
|
|
434
|
-
message: "Saving segment",
|
|
435
|
-
successMessage: "Segment saved"
|
|
436
|
-
}
|
|
437
|
-
);
|
|
438
|
-
}
|
|
439
|
-
function C(a) {
|
|
440
|
-
var t;
|
|
441
|
-
(t = f.value) == null || t.showSheet(a);
|
|
442
|
-
}
|
|
443
|
-
const D = ce(() => x.isPremium ? [
|
|
444
|
-
{
|
|
445
|
-
label: "Refresh segments",
|
|
446
|
-
value: "refresh"
|
|
447
|
-
},
|
|
448
|
-
{
|
|
449
|
-
label: "Add segment",
|
|
450
|
-
value: "add",
|
|
451
|
-
isPrimary: !0,
|
|
452
|
-
prependIcon: "add"
|
|
453
|
-
}
|
|
454
|
-
] : []);
|
|
455
|
-
return fe(async () => {
|
|
456
|
-
const { meta: a } = await ie.read({
|
|
457
|
-
limit: 1,
|
|
458
|
-
skip: 0,
|
|
459
|
-
sortBy: "_id",
|
|
460
|
-
search: void 0,
|
|
461
|
-
descending: !1
|
|
462
|
-
});
|
|
463
|
-
l.value = a.totalResources ?? 0, await n({ pageSize: 10, pageIndex: 0 }), await x.readPremium();
|
|
464
|
-
}), (a, t) => {
|
|
465
|
-
const m = v("FmPill"), M = v("FmPageHead"), r = v("FmIcon"), _ = v("FmMenuItem"), Y = v("FmMenu"), b = v("FmListItem"), T = v("FmList"), N = v("FmButton"), q = v("FmCard");
|
|
466
|
-
return h(), E(H, null, [
|
|
467
|
-
c(M, {
|
|
468
|
-
title: "Segments",
|
|
469
|
-
actions: o(D),
|
|
470
|
-
"onClick:action": t[0] || (t[0] = (g) => g === "add" ? C() : F())
|
|
471
|
-
}, {
|
|
472
|
-
title: S(() => [
|
|
473
|
-
s("div", Ze, [
|
|
474
|
-
We,
|
|
475
|
-
c(m, { variant: "premium" })
|
|
476
|
-
])
|
|
477
|
-
]),
|
|
478
|
-
_: 1
|
|
479
|
-
}, 8, ["actions"]),
|
|
480
|
-
s("div", Ke, [
|
|
481
|
-
o(i).length > 0 || o(u).searchValue || o(u).isLoading ? (h(), E(H, { key: 0 }, [
|
|
482
|
-
c(ue, {
|
|
483
|
-
loading: o(u).isLoading,
|
|
484
|
-
"row-data": o(i),
|
|
485
|
-
"row-count": o(u).totalRows,
|
|
486
|
-
"column-defs": p,
|
|
487
|
-
"shrink-at": !1,
|
|
488
|
-
"page-count": o(u).pageCount,
|
|
489
|
-
"page-index": o(u).pageIndex,
|
|
490
|
-
"page-size": o(u).pageSize,
|
|
491
|
-
onRowClick: t[1] || (t[1] = (g) => {
|
|
492
|
-
C(g.original);
|
|
493
|
-
}),
|
|
494
|
-
onPageChange: o(n)
|
|
495
|
-
}, null, 8, ["loading", "row-data", "row-count", "page-count", "page-index", "page-size", "onPageChange"]),
|
|
496
|
-
c(T, { class: "w-full hidden xs:block" }, {
|
|
497
|
-
default: S(() => [
|
|
498
|
-
(h(!0), E(H, null, ye(o(i), (g) => (h(), Z(b, {
|
|
499
|
-
key: g._id.toString(),
|
|
500
|
-
tag: "label",
|
|
501
|
-
onClick: (z) => C(g)
|
|
502
|
-
}, {
|
|
503
|
-
default: S(() => [
|
|
504
|
-
s("div", null, [
|
|
505
|
-
s("div", Qe, L((g.memberCount ?? 0).toLocaleString()) + " total customers ", 1),
|
|
506
|
-
s("div", Xe, L(g.name), 1),
|
|
507
|
-
s("div", et, L(((g.memberCount ?? 0) * 100 / o(l)).toFixed(2)) + "% of customers ", 1)
|
|
508
|
-
])
|
|
509
|
-
]),
|
|
510
|
-
append: S(() => [
|
|
511
|
-
c(Y, { "stop-click-propagation": !0 }, {
|
|
512
|
-
"menu-button": S(() => [
|
|
513
|
-
c(r, { name: "more_vert" })
|
|
514
|
-
]),
|
|
515
|
-
default: S(() => [
|
|
516
|
-
c(_, {
|
|
517
|
-
class: "text-fm-color-typo-error fm-typo-en-body-md-400",
|
|
518
|
-
label: "Remove",
|
|
519
|
-
"onUpdate:modelValue": (z) => z && y(g)
|
|
520
|
-
}, null, 8, ["onUpdate:modelValue"])
|
|
521
|
-
]),
|
|
522
|
-
_: 2
|
|
523
|
-
}, 1024)
|
|
524
|
-
]),
|
|
525
|
-
_: 2
|
|
526
|
-
}, 1032, ["onClick"]))), 128))
|
|
527
|
-
]),
|
|
528
|
-
_: 1
|
|
529
|
-
})
|
|
530
|
-
], 64)) : (h(), Z(q, {
|
|
531
|
-
key: 1,
|
|
532
|
-
variant: "outlined",
|
|
533
|
-
class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
|
|
534
|
-
}, {
|
|
535
|
-
default: S(() => [
|
|
536
|
-
tt,
|
|
537
|
-
ot,
|
|
538
|
-
c(N, {
|
|
539
|
-
variant: "primary",
|
|
540
|
-
label: "Create segment",
|
|
541
|
-
disabled: !o(x).isPremium,
|
|
542
|
-
icon: "add",
|
|
543
|
-
onClick: t[2] || (t[2] = (g) => C())
|
|
544
|
-
}, null, 8, ["disabled"])
|
|
545
|
-
]),
|
|
546
|
-
_: 1
|
|
547
|
-
})),
|
|
548
|
-
c(Ge, {
|
|
549
|
-
ref_key: "sheetRef",
|
|
550
|
-
ref: f,
|
|
551
|
-
"onUpdate:modelValue": B
|
|
552
|
-
}, null, 512)
|
|
553
|
-
])
|
|
554
|
-
], 64);
|
|
555
|
-
};
|
|
556
|
-
}
|
|
557
|
-
});
|
|
558
|
-
export {
|
|
559
|
-
xt as default
|
|
560
|
-
};
|