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