@feedmepos/mf-connect 0.1.0-beta.7 → 0.1.0-beta.70
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-DEQUEGlq.js +427 -0
- package/dist/{App-DalxIjTu.js → App-CcoU2SAx.js} +445 -420
- package/dist/AuditLogs-CiB6u06w.js +1886 -0
- package/dist/Bin-C2_1m5RT.js +166 -0
- package/dist/{Broadcast-uMAvsC--.js → Broadcast-TotIXDuJ.js} +56 -54
- package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-JxbENan8.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CixQu3Pr.js} +6 -8
- package/dist/Card-Ce-_xMgS.js +896 -0
- package/dist/Collections-DKva6Doi.js +459 -0
- package/dist/{Credit-QlnatflM.js → Credit-BVUxIJ6C.js} +36 -34
- package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-DLnvDVgf.js +108 -0
- package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-BUzUIIUW.js +58 -0
- package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-BKEumoan.js +2181 -0
- package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-BE07lc4M.js → EffectSheet.vue_vue_type_style_index_0_lang-ah4bz-qR.js} +49 -49
- package/dist/{Experience-Czy41ifp.js → Experience-DV3384o0.js} +32 -30
- package/dist/FilterChip.vue_vue_type_script_setup_true_lang-BrPLkFX8.js +118 -0
- package/dist/Game-DY83ti52.js +278 -0
- package/dist/Index-DEIaZ-2H.js +259 -0
- package/dist/Marketing-C2RwIlrg.js +20071 -0
- package/dist/Member-D4fc-wzd.js +333 -0
- package/dist/MemberList-DSMI6t_D.js +1598 -0
- package/dist/MemberTransactions-wXUlbbRq.js +45 -0
- package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-CtM73bcN.js → MessageInput.vue_vue_type_script_setup_true_lang-DYS0klKm.js} +135 -120
- package/dist/Mission-P_KLDEpg.js +296 -0
- package/dist/Overview-8vc0f1D7.js +1078 -0
- package/dist/{Point-By6ogYy_.js → Point-B4Y0Pq60.js} +55 -53
- package/dist/{Promotion-DKcBr-RI.js → Promotion-C1CbesgZ.js} +65 -57
- package/dist/Queue-BlPA7PNH.js +244 -0
- package/dist/Record-Cl1qXSSk.js +340 -0
- package/dist/Reward-jy6-W1Eh.js +442 -0
- package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-d5JNNNHf.js +150 -0
- package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-DYul_Nu8.js +1640 -0
- package/dist/Segment-B36Nrvxs.js +568 -0
- package/dist/SelectItems.vue_vue_type_script_setup_true_lang-jN0xUFNR.js +181 -0
- package/dist/SendCollectionSheet.vue_vue_type_script_setup_true_lang-BLFTNooB.js +186 -0
- package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-H_Sehhgf.js +147 -0
- package/dist/Setting-AgQf2X4W.js +1931 -0
- package/dist/Store-D3Mm0pan.js +1841 -0
- package/dist/StoreRewards-L0VLWz8l.js +423 -0
- package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-Zl_cXXSD.js +1028 -0
- package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-nEdCD6la.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-b4mfueTj.js} +1 -1
- package/dist/{Tier-DvAs0-yx.js → Tier-DQq-375x.js} +327 -318
- package/dist/{Title-B_Trr39o.js → Title-OJxuBvaa.js} +224 -209
- package/dist/{Transaction-DCJw-b3H.js → Transaction-vgsYRfD7.js} +2 -2
- package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-Cwi0mvC3.js +130 -0
- package/dist/Voucher-BFwLaoxe.js +354 -0
- package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-DNUBaNtJ.js +419 -0
- package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-DXkhu8e9.js → ZodTextField.vue_vue_type_script_setup_true_lang-ms40eptZ.js} +1 -1
- package/dist/app-BQFTJ_hE.js +33357 -0
- package/dist/app-D7C3Fxfi.js +7077 -0
- package/dist/app.js +1 -1
- package/dist/{business-BC4-i1cU.js → business-vzpvmTdG.js} +1 -1
- package/dist/{campaign--0_yMbMV.js → campaign-BkxTDfsK.js} +2 -2
- package/dist/campaign-UQ8kMVeC.js +1810 -0
- package/dist/campaign.enum-BdT-e9h9.js +20 -0
- package/dist/campaign.fn-lc4ZhFCU.js +758 -0
- package/dist/collectible.enum-C8kd17Tz.js +19 -0
- package/dist/{collection.fn-3TwPe7aF.js → collection.fn-BIw1Y_tv.js} +2 -2
- package/dist/dto-CwzAhB8x.js +214 -0
- package/dist/{effect-BeR0LK61.js → effect-CJcvLlKG.js} +33 -16
- package/dist/email-addresses-BCJTQPT0.js +705 -0
- package/dist/{export-xeLLhqvh.js → export-URRwle1z.js} +5 -5
- package/dist/{helper-B5iqfKh8.js → helper-DccnE6zn.js} +1 -1
- package/dist/index-BiIZ7X6d.js +29556 -0
- package/dist/{index-CyKZ-SsN.js → index-BsRJ4kVb.js} +1 -1
- package/dist/{index-CU_d8jjU.js → index-C3lpXz_P.js} +1 -1
- package/dist/{index-Ct_wR519.js → index-CFA3EqId.js} +24 -21
- package/dist/{index-DP-dGMJC.js → index-CPRN3irj.js} +2230 -871
- package/dist/index-CaxFS90M.js +56 -0
- package/dist/index-CsaQJMAR.js +66 -0
- package/dist/index-D4MX9e5q.js +115 -0
- package/dist/index-DrE9VkxR.js +32 -0
- package/dist/index-EOPRlB9V.js +54 -0
- package/dist/{index-CAn5heDe.js → index-FcxOGFKj.js} +48 -4
- package/dist/{index-Bh-uaaBG.js → index-OScGm4mF.js} +1506 -1480
- package/dist/{index-BOdtpNkP.js → index-ghSGvG-m.js} +266 -173
- package/dist/index-vh86FiIQ.js +10 -0
- package/dist/{index.esm2017-5jeDA5Zo.js → index.esm2017-CE1CQHrP.js} +121 -121
- package/dist/loading-B8zghYbj.js +71 -0
- package/dist/{membership-D0nqqWNZ.js → membership-DoJMF2T6.js} +54 -46
- package/dist/money-CTR0rXZw.js +15 -0
- package/dist/number-Bhgz9eFP.js +12 -0
- package/dist/objectid-DdVJrRBw.js +145 -0
- package/dist/{loading-C-JDVajU.js → plugins-B5mQ7CHT.js} +3871 -3943
- package/dist/remy-vue-client-Cpppk9h-.js +1693 -0
- package/dist/reward-DicsEEHe.js +36 -0
- package/dist/{rule-builder-BXt29Es4.js → rule-builder-BWb4JTrd.js} +1 -1
- package/dist/{rule-Dn_GgBCe.js → rule-s8siRar1.js} +185 -178
- package/dist/style.css +1 -1
- package/dist/{template-D2Oi3dxP.js → template-Qb5ozfLa.js} +5 -5
- package/dist/trigger-Bsb3Kj35.js +144 -0
- package/dist/user-DJ8aHRaM.js +54 -0
- package/dist/{vue-i18n-Dud8fvmw.js → vue-i18n-BG2U7GtN.js} +282 -282
- package/dist/{xlsx-CCRCidY2.js → xlsx-2QxyDFwt.js} +1 -1
- package/package.json +11 -7
- package/dist/Analytic-BMpS6jWb.js +0 -622
- package/dist/Card-DV8-g69L.js +0 -825
- package/dist/Collections-DRafEHT1.js +0 -453
- package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-TDoMehSB.js +0 -2813
- package/dist/Game-CD3zSitz.js +0 -255
- package/dist/Marketing-NNes8z6Q.js +0 -316
- package/dist/Member-CTqBgYuV.js +0 -69
- package/dist/MemberList-B99tS5ce.js +0 -1733
- package/dist/MemberTransactions-D1YCXPOg.js +0 -38
- package/dist/Mission-XbBVKBiE.js +0 -261
- package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-D1ESqEFO.js +0 -1753
- package/dist/Segment-B8cszL-F.js +0 -437
- package/dist/Setting-aZYABlMW.js +0 -1901
- package/dist/Store-Bx2tyJwe.js +0 -1511
- package/dist/StoreRewards-DTp9G6gw.js +0 -401
- package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-B2W7ly5Z.js +0 -890
- package/dist/Voucher-jqv3ji90.js +0 -490
- package/dist/app-WlcUVbFb.js +0 -5764
- package/dist/app-_w0hjM7u.js +0 -53428
- package/dist/dto-Ns2dLn1B.js +0 -2770
- package/dist/index-BWb9vRCi.js +0 -29193
- package/dist/index-CpU9aqyW.js +0 -206
- package/dist/index-CqO_ZvtD.js +0 -99
- package/dist/index-CuvNtC_M.js +0 -61
- package/dist/index-DsNsA2uX.js +0 -298
- package/dist/index-WAMr3npT.js +0 -762
- package/dist/money-hdbrblud.js +0 -15
- package/dist/number-CRWGOZaW.js +0 -12
- package/dist/user-Bm4KttFq.js +0 -37
|
@@ -0,0 +1,568 @@
|
|
|
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 } from "./plugins-B5mQ7CHT.js";
|
|
4
|
+
import { u as we } from "./loading-B8zghYbj.js";
|
|
5
|
+
import { components as Z } from "@feedmepos/ui-library";
|
|
6
|
+
import { u as pe, _ as me } from "./usePagination-BeF5K3M7.js";
|
|
7
|
+
import { u as Fe } from "./vue-i18n-BG2U7GtN.js";
|
|
8
|
+
import { w as Ce } from "./xlsx-2QxyDFwt.js";
|
|
9
|
+
import { e as Me, M as ke } from "./email-addresses-BCJTQPT0.js";
|
|
10
|
+
import { Z as Ie } from "./zod-Bg2FbC-D.js";
|
|
11
|
+
import { h as Pe } from "./index-CPRN3irj.js";
|
|
12
|
+
import { u as Re } from "./app-wDQR6dpb.js";
|
|
13
|
+
import { R as Be } from "./rule-builder-BWb4JTrd.js";
|
|
14
|
+
import { _ as Ee } from "./ZodTextField.vue_vue_type_script_setup_true_lang-ms40eptZ.js";
|
|
15
|
+
import { _ as De } from "./RuleGroup.vue_vue_type_script_setup_true_lang-DYul_Nu8.js";
|
|
16
|
+
import { h as z } from "./moment-BWErdI6_.js";
|
|
17
|
+
import { s as E, u as Ye } from "./membership-DoJMF2T6.js";
|
|
18
|
+
import { o as $e } from "./objectId-dwaoBfJX.js";
|
|
19
|
+
import { u as ge } from "./business-vzpvmTdG.js";
|
|
20
|
+
import { f as be } from "./number-Bhgz9eFP.js";
|
|
21
|
+
import { t as Le } from "./money-CTR0rXZw.js";
|
|
22
|
+
import { m as ce } from "./index-CFA3EqId.js";
|
|
23
|
+
const Te = Pe.extend({
|
|
24
|
+
_id: re.optional(),
|
|
25
|
+
business: re.optional()
|
|
26
|
+
}), 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({
|
|
27
|
+
__name: "ReviewSegment",
|
|
28
|
+
props: {
|
|
29
|
+
title: {},
|
|
30
|
+
segment: {}
|
|
31
|
+
},
|
|
32
|
+
setup(e) {
|
|
33
|
+
const c = e, S = [
|
|
34
|
+
{
|
|
35
|
+
header: "Name",
|
|
36
|
+
accessorFn: (n) => n.name
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
header: "Id",
|
|
40
|
+
accessorFn: (n) => n._id
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
header: "Customer Since",
|
|
44
|
+
accessorFn: (n) => z($e(n._id.toString())).format("DD MMM YYYY")
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
header: "Phone",
|
|
48
|
+
accessorFn: (n) => n.phoneNumber
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
header: "Birthday",
|
|
52
|
+
accessorFn: (n) => z(n.birthday).format("DD MMM YYYY")
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
header: "Last Visit",
|
|
56
|
+
accessorFn: (n) => z(n.stats.lastVisit).format("DD MMM YYYY")
|
|
57
|
+
}
|
|
58
|
+
], v = async (n) => c.segment._id ? await E.paginateSegmentUsers(c.segment._id, {
|
|
59
|
+
limit: r.value.pageSize,
|
|
60
|
+
skip: n.pageIndex ?? 0,
|
|
61
|
+
sortBy: "_id",
|
|
62
|
+
search: n.searchValue,
|
|
63
|
+
descending: !0
|
|
64
|
+
}) : { resources: [], meta: { totalResources: 0, totalPages: 0 } }, { tableMeta: r, rowData: d, onSort: M, debouncedFetchData: f, onSearch: s } = pe(v);
|
|
65
|
+
return ue(async () => {
|
|
66
|
+
await f();
|
|
67
|
+
}), (n, u) => (h(), Y("div", Ve, [
|
|
68
|
+
i("div", Ne, D(c.title), 1),
|
|
69
|
+
i("div", ze, [
|
|
70
|
+
i("div", Ae, D(n.segment.members.length), 1),
|
|
71
|
+
i("div", Ue, [
|
|
72
|
+
u[1] || (u[1] = i("div", null, "contacts in your segment", -1)),
|
|
73
|
+
i("div", null, "as of " + D(a(z)(n.segment.lastUpdated).format("DD MMM YYYY")), 1)
|
|
74
|
+
])
|
|
75
|
+
]),
|
|
76
|
+
l(me, {
|
|
77
|
+
loading: a(r).isLoading,
|
|
78
|
+
"row-data": a(d),
|
|
79
|
+
"row-count": a(r).totalRows,
|
|
80
|
+
"column-defs": S,
|
|
81
|
+
"page-size": a(r).pageSize,
|
|
82
|
+
"page-count": a(r).pageCount,
|
|
83
|
+
"page-index": a(r).pageIndex,
|
|
84
|
+
onSortChange: a(M),
|
|
85
|
+
onPageChange: u[0] || (u[0] = (w) => a(f)({ pageSize: w.pageSize, pageIndex: w.pageIndex }))
|
|
86
|
+
}, null, 8, ["loading", "row-data", "row-count", "page-size", "page-count", "page-index", "onSortChange"])
|
|
87
|
+
]));
|
|
88
|
+
}
|
|
89
|
+
}), je = { class: "flex items-center gap-x-8" }, He = {
|
|
90
|
+
key: 0,
|
|
91
|
+
class: "space-y-16 pr-12"
|
|
92
|
+
}, qe = { class: "flex items-center gap-8" }, Je = /* @__PURE__ */ Q({
|
|
93
|
+
__name: "SegmentSheet",
|
|
94
|
+
emits: ["update:model-value"],
|
|
95
|
+
setup(e, { expose: c, emit: S }) {
|
|
96
|
+
const v = Re(), r = H(!1), d = H(!1), M = {
|
|
97
|
+
name: "",
|
|
98
|
+
rule: Be.scaffoldGroup(),
|
|
99
|
+
members: []
|
|
100
|
+
}, f = Te, s = H(M), n = X(() => {
|
|
101
|
+
const _ = f.safeParse(s.value);
|
|
102
|
+
return _.success ? [] : _.error.errors;
|
|
103
|
+
});
|
|
104
|
+
function u(_) {
|
|
105
|
+
r.value = !0, d.value = !1, _ ? s.value = { ..._ } : s.value = { ...M };
|
|
106
|
+
}
|
|
107
|
+
function w() {
|
|
108
|
+
r.value = !1;
|
|
109
|
+
}
|
|
110
|
+
async function I() {
|
|
111
|
+
f.safeParse(s.value).success && (d.value = !0);
|
|
112
|
+
}
|
|
113
|
+
function $() {
|
|
114
|
+
d.value = !1;
|
|
115
|
+
}
|
|
116
|
+
async function b() {
|
|
117
|
+
k("update:model-value", s.value);
|
|
118
|
+
}
|
|
119
|
+
ue(async () => {
|
|
120
|
+
});
|
|
121
|
+
const k = S;
|
|
122
|
+
return c({
|
|
123
|
+
showSheet: u,
|
|
124
|
+
hideSheet: w
|
|
125
|
+
}), (_, t) => {
|
|
126
|
+
const o = x("FmButton"), F = x("FmSideSheet");
|
|
127
|
+
return h(), W(F, {
|
|
128
|
+
modelValue: a(r),
|
|
129
|
+
"onUpdate:modelValue": t[5] || (t[5] = (p) => ye(r) ? r.value = p : null),
|
|
130
|
+
header: "Add segment",
|
|
131
|
+
"dismiss-away": "",
|
|
132
|
+
"close-button": !0,
|
|
133
|
+
"max-width": 1100
|
|
134
|
+
}, ve({
|
|
135
|
+
"side-sheet-footer": C(() => [
|
|
136
|
+
i("div", qe, [
|
|
137
|
+
a(d) ? (h(), Y(q, { key: 0 }, [
|
|
138
|
+
l(o, {
|
|
139
|
+
label: "Save Segment",
|
|
140
|
+
onClick: b,
|
|
141
|
+
loading: a(v).isLoading,
|
|
142
|
+
disabled: a(n).length > 0 || a(v).isLoading
|
|
143
|
+
}, null, 8, ["loading", "disabled"]),
|
|
144
|
+
l(o, {
|
|
145
|
+
label: "Cancel",
|
|
146
|
+
onClick: t[3] || (t[3] = (p) => $()),
|
|
147
|
+
variant: "tertiary"
|
|
148
|
+
})
|
|
149
|
+
], 64)) : (h(), Y(q, { key: 1 }, [
|
|
150
|
+
l(o, {
|
|
151
|
+
label: "Review Segment",
|
|
152
|
+
disabled: a(n).length > 0 || a(v).isLoading,
|
|
153
|
+
onClick: I
|
|
154
|
+
}, null, 8, ["disabled"]),
|
|
155
|
+
l(o, {
|
|
156
|
+
label: "Cancel",
|
|
157
|
+
onClick: t[4] || (t[4] = (p) => w()),
|
|
158
|
+
variant: "tertiary"
|
|
159
|
+
})
|
|
160
|
+
], 64))
|
|
161
|
+
])
|
|
162
|
+
]),
|
|
163
|
+
default: C(() => {
|
|
164
|
+
var p;
|
|
165
|
+
return [
|
|
166
|
+
a(d) ? (h(), W(Oe, {
|
|
167
|
+
key: 1,
|
|
168
|
+
title: a(s).name,
|
|
169
|
+
segment: a(s)
|
|
170
|
+
}, null, 8, ["title", "segment"])) : (h(), Y("div", He, [
|
|
171
|
+
l(Ee, {
|
|
172
|
+
modelValue: a(s).name,
|
|
173
|
+
"onUpdate:modelValue": t[1] || (t[1] = (y) => a(s).name = y),
|
|
174
|
+
label: "Segment title",
|
|
175
|
+
schema: a(Ie).typeAtPath(a(f), "name")
|
|
176
|
+
}, null, 8, ["modelValue", "schema"]),
|
|
177
|
+
t[7] || (t[7] = i("div", { class: "fm-typo-en-title-sm-800" }, "Segment Filter", -1)),
|
|
178
|
+
l(De, {
|
|
179
|
+
"trigger-type": "MEMBERSHIP_JOINED",
|
|
180
|
+
includeOnly: "user",
|
|
181
|
+
"model-value": (p = a(s)) == null ? void 0 : p.rule,
|
|
182
|
+
"onUpdate:modelValue": t[2] || (t[2] = (y) => {
|
|
183
|
+
a(s).rule = y;
|
|
184
|
+
})
|
|
185
|
+
}, null, 8, ["model-value"])
|
|
186
|
+
]))
|
|
187
|
+
];
|
|
188
|
+
}),
|
|
189
|
+
_: 2
|
|
190
|
+
}, [
|
|
191
|
+
a(d) ? {
|
|
192
|
+
name: "side-sheet-header",
|
|
193
|
+
fn: C(() => [
|
|
194
|
+
i("div", je, [
|
|
195
|
+
l(o, {
|
|
196
|
+
icon: "arrow_back",
|
|
197
|
+
variant: "tertiary",
|
|
198
|
+
onClick: t[0] || (t[0] = (p) => d.value = !1)
|
|
199
|
+
}),
|
|
200
|
+
t[6] || (t[6] = i("div", null, "Review segment", -1))
|
|
201
|
+
])
|
|
202
|
+
]),
|
|
203
|
+
key: "0"
|
|
204
|
+
} : void 0
|
|
205
|
+
]), 1032, ["modelValue"]);
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
}), de = Ye(), Ge = ge();
|
|
209
|
+
function K(e) {
|
|
210
|
+
const c = z(e);
|
|
211
|
+
return c.isValid() ? c.format("DD/MM/YYYY") : "";
|
|
212
|
+
}
|
|
213
|
+
const Ze = {
|
|
214
|
+
mapMemberExportRow: (e) => {
|
|
215
|
+
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;
|
|
216
|
+
const c = X(() => Ge.locations.map((g) => ({
|
|
217
|
+
label: g.name,
|
|
218
|
+
value: g._id
|
|
219
|
+
}))), S = (n = Me.parseOneAddress(
|
|
220
|
+
e == null ? void 0 : e.email
|
|
221
|
+
)) != 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(
|
|
222
|
+
(g, R) => {
|
|
223
|
+
var O, j;
|
|
224
|
+
const U = (j = (O = de.sortedTitles) == null ? void 0 : O.find(
|
|
225
|
+
(G) => G._id === R.collectible
|
|
226
|
+
)) == null ? void 0 : j.name;
|
|
227
|
+
return !U || R.balance <= 0 || g.push(U), g;
|
|
228
|
+
},
|
|
229
|
+
[]
|
|
230
|
+
), r = (de.sortedTitles || []).reduce(
|
|
231
|
+
(g, R) => {
|
|
232
|
+
var O, j, G, le;
|
|
233
|
+
const U = (le = (G = (j = (((O = e == null ? void 0 : e.collection) == null ? void 0 : O.TITLE) || []).find(
|
|
234
|
+
(fe) => fe.collectible === R._id
|
|
235
|
+
)) == null ? void 0 : j.expiryBalance) == null ? void 0 : G[0]) == null ? void 0 : le.expiredAt;
|
|
236
|
+
return g[R.name] = U ? z(U).format("DD/MM/YYYY") : "", g;
|
|
237
|
+
},
|
|
238
|
+
{}
|
|
239
|
+
), 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(
|
|
240
|
+
(g, R) => g + R.amount,
|
|
241
|
+
0
|
|
242
|
+
)) || 0, f = be(d, 2);
|
|
243
|
+
return {
|
|
244
|
+
ID: e._id.toString(),
|
|
245
|
+
Name: ((F = e.name) == null ? void 0 : F.trim()) || "",
|
|
246
|
+
Phone: ((p = e == null ? void 0 : e.phoneNumber) == null ? void 0 : p.trim()) || "",
|
|
247
|
+
Email: S || "",
|
|
248
|
+
Gender: e.gender || "",
|
|
249
|
+
CardNo: e.cardNo || "",
|
|
250
|
+
Birthday: e != null && e.birthday ? K(e == null ? void 0 : e.birthday) : "",
|
|
251
|
+
Credit: parseFloat((Number(f) - Number(M)).toFixed(2)),
|
|
252
|
+
FreeCredit: Number(M.toFixed(2)),
|
|
253
|
+
TotalCredit: Number(f),
|
|
254
|
+
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,
|
|
255
|
+
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,
|
|
256
|
+
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,
|
|
257
|
+
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,
|
|
258
|
+
Titles: v.join(","),
|
|
259
|
+
...r,
|
|
260
|
+
TotalTransaction: e.stats.visitCount,
|
|
261
|
+
AvgSpent: Le(Number(e.stats.avgBillSize || 0)).toFormat(
|
|
262
|
+
!1
|
|
263
|
+
),
|
|
264
|
+
TotalSpent: e.stats.avgBillSize * e.stats.visitCount,
|
|
265
|
+
LastVisit: K(e.stats.lastVisit),
|
|
266
|
+
Feedback: ((ae = e.stats) == null ? void 0 : ae.feedbackCount) || 0,
|
|
267
|
+
LastSeasonTierEarned: ((ne = e.stats) == null ? void 0 : ne.lastSeasonTierEarned) || 0,
|
|
268
|
+
LastSeasonPointEarned: ((se = e.stats) == null ? void 0 : se.lastSeasonPointEarned) || 0,
|
|
269
|
+
JoinedAt: K(e.joinAt || void 0),
|
|
270
|
+
JoinedAtLocation: e.location && ((ie = c.value.find((g) => g.value == e.location)) == null ? void 0 : ie.label) || "-",
|
|
271
|
+
VisitFrequency: `${Number(
|
|
272
|
+
Math.ceil(e.stats.avgVisitFrequency).toFixed(0)
|
|
273
|
+
)}`
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
}, 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" }, Ct = /* @__PURE__ */ Q({
|
|
277
|
+
__name: "Segment",
|
|
278
|
+
setup(e) {
|
|
279
|
+
const { minor: c } = we, { t: S } = Fe(), v = ge(), { mapMemberExportRow: r } = Ze, d = H(0), M = [
|
|
280
|
+
{
|
|
281
|
+
header: S("connect.loyalty.segment.table.name"),
|
|
282
|
+
accessorFn: (t) => t.name
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
header: S("connect.loyalty.segment.table.total_customers"),
|
|
286
|
+
accessorFn: (t) => t.memberCount ?? 0
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
header: S("connect.loyalty.segment.table.customer_percentage"),
|
|
290
|
+
accessorFn: (t) => ((t.memberCount ?? 0) * 100 / d.value).toFixed(2)
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
header: S("connect.loyalty.segment.table.actions"),
|
|
294
|
+
meta: {
|
|
295
|
+
maxWidth: "100px"
|
|
296
|
+
},
|
|
297
|
+
cell(t) {
|
|
298
|
+
return B("div", { class: "flex items-center justify-end" }, [
|
|
299
|
+
B(
|
|
300
|
+
Z.FmMenu,
|
|
301
|
+
{
|
|
302
|
+
placement: "bottom-end",
|
|
303
|
+
onClick: (o) => {
|
|
304
|
+
o.stopPropagation();
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
"menu-button": () => B(Z.FmButton, {
|
|
309
|
+
icon: "more_vert",
|
|
310
|
+
iconColor: "neutral-gray-400",
|
|
311
|
+
variant: "tertiary"
|
|
312
|
+
}),
|
|
313
|
+
default: () => [
|
|
314
|
+
B(
|
|
315
|
+
Z.FmMenuItem,
|
|
316
|
+
{
|
|
317
|
+
onClick: async (o) => {
|
|
318
|
+
o.stopPropagation(), $(t.row.original);
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
label: B(
|
|
323
|
+
"div",
|
|
324
|
+
{
|
|
325
|
+
class: "fm-typo-en-body-md-400"
|
|
326
|
+
},
|
|
327
|
+
"Export"
|
|
328
|
+
)
|
|
329
|
+
}
|
|
330
|
+
),
|
|
331
|
+
B(
|
|
332
|
+
Z.FmMenuItem,
|
|
333
|
+
{
|
|
334
|
+
onClick: async (o) => {
|
|
335
|
+
o.stopPropagation(), I(t.row.original);
|
|
336
|
+
}
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
label: B(
|
|
340
|
+
"div",
|
|
341
|
+
{
|
|
342
|
+
class: "text-fm-color-typo-error fm-typo-en-body-md-400"
|
|
343
|
+
},
|
|
344
|
+
"Remove"
|
|
345
|
+
)
|
|
346
|
+
}
|
|
347
|
+
)
|
|
348
|
+
]
|
|
349
|
+
}
|
|
350
|
+
)
|
|
351
|
+
]);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
], f = H(null), { tableMeta: s, rowData: n, debouncedFetchData: u } = pe(
|
|
355
|
+
E.readAll
|
|
356
|
+
);
|
|
357
|
+
async function w() {
|
|
358
|
+
await c(
|
|
359
|
+
async () => {
|
|
360
|
+
await E.refreshSegments(), await u({ pageSize: 10, pageIndex: 0 });
|
|
361
|
+
},
|
|
362
|
+
{ message: "Refreshing segmentations" }
|
|
363
|
+
);
|
|
364
|
+
}
|
|
365
|
+
async function I(t) {
|
|
366
|
+
await he.remove(`Are you sure you want to remove ${t.name}?`) && await c(
|
|
367
|
+
async () => {
|
|
368
|
+
await E.delete(t._id), await u({ pageSize: 10, pageIndex: 0 });
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
message: `Removing ${t.name}`,
|
|
372
|
+
successMessage: `Removed ${t.name} successfully`
|
|
373
|
+
}
|
|
374
|
+
);
|
|
375
|
+
}
|
|
376
|
+
async function $(t) {
|
|
377
|
+
const o = {
|
|
378
|
+
sortBy: "_id",
|
|
379
|
+
descending: !1,
|
|
380
|
+
rowsPerPage: 1e3,
|
|
381
|
+
page: 1,
|
|
382
|
+
rowsNumber: 0
|
|
383
|
+
}, F = new ke(), p = (await ce.read({
|
|
384
|
+
limit: 1,
|
|
385
|
+
skip: 0,
|
|
386
|
+
sortBy: o.sortBy,
|
|
387
|
+
descending: o.descending
|
|
388
|
+
})).meta.totalResources ?? 0, y = o.rowsPerPage;
|
|
389
|
+
await c(
|
|
390
|
+
async () => {
|
|
391
|
+
for (let P = 0; P < p; P += y) {
|
|
392
|
+
const L = {
|
|
393
|
+
...o,
|
|
394
|
+
limit: y,
|
|
395
|
+
skip: o.page - 1,
|
|
396
|
+
sortBy: o.sortBy,
|
|
397
|
+
descending: o.descending
|
|
398
|
+
}, T = await E.paginateSegmentUsers(
|
|
399
|
+
t._id,
|
|
400
|
+
L
|
|
401
|
+
);
|
|
402
|
+
for (const V of T.resources) {
|
|
403
|
+
const N = r(V);
|
|
404
|
+
F.addRecord(N);
|
|
405
|
+
}
|
|
406
|
+
o.page++;
|
|
407
|
+
}
|
|
408
|
+
await Ce(
|
|
409
|
+
F.buildExcel(),
|
|
410
|
+
`[${t.name}]-members-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
|
|
411
|
+
{
|
|
412
|
+
bookType: "xlsx",
|
|
413
|
+
bookSST: !1,
|
|
414
|
+
type: "array"
|
|
415
|
+
}
|
|
416
|
+
), o.page = 1;
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
message: "Exporting member...",
|
|
420
|
+
successMessage: "Member exported successfully"
|
|
421
|
+
}
|
|
422
|
+
);
|
|
423
|
+
}
|
|
424
|
+
async function b(t) {
|
|
425
|
+
await c(
|
|
426
|
+
async () => {
|
|
427
|
+
var o;
|
|
428
|
+
if (t._id) {
|
|
429
|
+
const { members: F, _id: p, ...y } = t;
|
|
430
|
+
await E.update(t._id, y);
|
|
431
|
+
} else
|
|
432
|
+
await E.create(t);
|
|
433
|
+
await u({ pageSize: 10, pageIndex: 0 }), (o = f.value) == null || o.hideSheet();
|
|
434
|
+
},
|
|
435
|
+
{
|
|
436
|
+
message: "Saving segment",
|
|
437
|
+
successMessage: "Segment saved"
|
|
438
|
+
}
|
|
439
|
+
);
|
|
440
|
+
}
|
|
441
|
+
function k(t) {
|
|
442
|
+
var o;
|
|
443
|
+
(o = f.value) == null || o.showSheet(t);
|
|
444
|
+
}
|
|
445
|
+
const _ = X(() => v.isPremium ? [
|
|
446
|
+
{
|
|
447
|
+
label: "Refresh segments",
|
|
448
|
+
value: "refresh"
|
|
449
|
+
},
|
|
450
|
+
{
|
|
451
|
+
label: "Add segment",
|
|
452
|
+
value: "add",
|
|
453
|
+
isPrimary: !0,
|
|
454
|
+
prependIcon: "add"
|
|
455
|
+
}
|
|
456
|
+
] : []);
|
|
457
|
+
return _e(async () => {
|
|
458
|
+
const { meta: t } = await ce.read({
|
|
459
|
+
limit: 1,
|
|
460
|
+
skip: 0,
|
|
461
|
+
sortBy: "_id",
|
|
462
|
+
search: void 0,
|
|
463
|
+
descending: !1
|
|
464
|
+
});
|
|
465
|
+
d.value = t.totalResources ?? 0, await u({ pageSize: 10, pageIndex: 0 }), await v.readPremium(), await v.readLocations();
|
|
466
|
+
}), (t, o) => {
|
|
467
|
+
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");
|
|
468
|
+
return h(), Y(q, null, [
|
|
469
|
+
l(p, {
|
|
470
|
+
title: "Segments",
|
|
471
|
+
actions: a(_),
|
|
472
|
+
"onClick:action": o[0] || (o[0] = (m) => m === "add" ? k() : w())
|
|
473
|
+
}, {
|
|
474
|
+
title: C(() => [
|
|
475
|
+
i("div", We, [
|
|
476
|
+
i("span", Ke, D(a(S)("connect.loyalty.segment.title")), 1),
|
|
477
|
+
l(F, { variant: "premium" })
|
|
478
|
+
])
|
|
479
|
+
]),
|
|
480
|
+
_: 1
|
|
481
|
+
}, 8, ["actions"]),
|
|
482
|
+
i("div", Qe, [
|
|
483
|
+
a(n).length > 0 || a(s).searchValue || a(s).isLoading ? (h(), Y(q, { key: 0 }, [
|
|
484
|
+
l(me, {
|
|
485
|
+
loading: a(s).isLoading,
|
|
486
|
+
"row-data": a(n),
|
|
487
|
+
"row-count": a(s).totalRows,
|
|
488
|
+
"column-defs": M,
|
|
489
|
+
"shrink-at": !1,
|
|
490
|
+
"page-count": a(s).pageCount,
|
|
491
|
+
"page-index": a(s).pageIndex,
|
|
492
|
+
"page-size": a(s).pageSize,
|
|
493
|
+
onRowClick: o[1] || (o[1] = (m) => {
|
|
494
|
+
k(m.original);
|
|
495
|
+
}),
|
|
496
|
+
onPageChange: a(u)
|
|
497
|
+
}, null, 8, ["loading", "row-data", "row-count", "page-count", "page-index", "page-size", "onPageChange"]),
|
|
498
|
+
l(V, { class: "w-full hidden xs:block" }, {
|
|
499
|
+
default: C(() => [
|
|
500
|
+
(h(!0), Y(q, null, Se(a(n), (m) => (h(), W(T, {
|
|
501
|
+
key: m._id.toString(),
|
|
502
|
+
tag: "label",
|
|
503
|
+
onClick: (A) => k(m)
|
|
504
|
+
}, {
|
|
505
|
+
default: C(() => [
|
|
506
|
+
i("div", null, [
|
|
507
|
+
i("div", Xe, D((m.memberCount ?? 0).toLocaleString()) + " total customers ", 1),
|
|
508
|
+
i("div", et, D(m.name), 1),
|
|
509
|
+
i("div", tt, D(((m.memberCount ?? 0) * 100 / a(d)).toFixed(2)) + "% of customers ", 1)
|
|
510
|
+
])
|
|
511
|
+
]),
|
|
512
|
+
append: C(() => [
|
|
513
|
+
l(L, { "stop-click-propagation": !0 }, {
|
|
514
|
+
"menu-button": C(() => [
|
|
515
|
+
l(y, { name: "more_vert" })
|
|
516
|
+
]),
|
|
517
|
+
default: C(() => [
|
|
518
|
+
l(P, {
|
|
519
|
+
class: "text-fm-color-typo-error fm-typo-en-body-md-400",
|
|
520
|
+
label: "Remove",
|
|
521
|
+
"onUpdate:modelValue": (A) => A && I(m)
|
|
522
|
+
}, null, 8, ["onUpdate:modelValue"])
|
|
523
|
+
]),
|
|
524
|
+
_: 2
|
|
525
|
+
}, 1024)
|
|
526
|
+
]),
|
|
527
|
+
_: 2
|
|
528
|
+
}, 1032, ["onClick"]))), 128))
|
|
529
|
+
]),
|
|
530
|
+
_: 1
|
|
531
|
+
})
|
|
532
|
+
], 64)) : (h(), W(J, {
|
|
533
|
+
key: 1,
|
|
534
|
+
variant: "outlined",
|
|
535
|
+
class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
|
|
536
|
+
}, {
|
|
537
|
+
default: C(() => [
|
|
538
|
+
o[3] || (o[3] = i("img", {
|
|
539
|
+
src: xe,
|
|
540
|
+
class: "aspect-square w-[150px]"
|
|
541
|
+
}, null, -1)),
|
|
542
|
+
o[4] || (o[4] = i("div", { class: "flex flex-col gap-16 text-center" }, [
|
|
543
|
+
i("div", { class: "fm-typo-en-title-sm-800" }, "Create customer segments"),
|
|
544
|
+
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. ")
|
|
545
|
+
], -1)),
|
|
546
|
+
l(N, {
|
|
547
|
+
variant: "primary",
|
|
548
|
+
label: "Create segment",
|
|
549
|
+
disabled: !a(v).isPremium,
|
|
550
|
+
icon: "add",
|
|
551
|
+
onClick: o[2] || (o[2] = (m) => k())
|
|
552
|
+
}, null, 8, ["disabled"])
|
|
553
|
+
]),
|
|
554
|
+
_: 1
|
|
555
|
+
})),
|
|
556
|
+
l(Je, {
|
|
557
|
+
ref_key: "sheetRef",
|
|
558
|
+
ref: f,
|
|
559
|
+
"onUpdate:modelValue": b
|
|
560
|
+
}, null, 512)
|
|
561
|
+
])
|
|
562
|
+
], 64);
|
|
563
|
+
};
|
|
564
|
+
}
|
|
565
|
+
});
|
|
566
|
+
export {
|
|
567
|
+
Ct as default
|
|
568
|
+
};
|