@feedmepos/mf-connect 0.1.0-beta.74 → 0.1.0-beta.76
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-CmX1CjHI.js → Analytic-BEX0W26t.js} +11 -11
- package/dist/{App-T0HK84dx.js → App-B37shyio.js} +6 -6
- package/dist/{AuditLogs-0ERaLqfa.js → AuditLogs-CffLLmgR.js} +9 -9
- package/dist/{Bin-C7utgPUn.js → Bin-ByblUwUe.js} +8 -8
- package/dist/{Broadcast-e2sHc8rv.js → Broadcast-C2Bgkw6V.js} +9 -9
- package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-mlnLZOdy.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-jviTok84.js} +6 -6
- package/dist/{Card-Bi1q3NGE.js → Card-CmhjJrq4.js} +35 -35
- package/dist/{Collections-CJYy94Sc.js → Collections-DXwp81Z5.js} +12 -12
- package/dist/{Credit-Mbgev3fe.js → Credit-C7nVnyLE.js} +9 -9
- package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-CCIj2_sx.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-B8OetxD5.js} +29 -29
- package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-CGiI-3HJ.js → EffectSheet.vue_vue_type_style_index_0_lang-DSEbv2th.js} +6 -6
- package/dist/{Experience-BE9onJDQ.js → Experience-Dt7eS803.js} +9 -9
- package/dist/FileSaver.min-NlMItPOc.js +74 -0
- package/dist/{Game-CxVwNVRg.js → Game-D6Rd8EiP.js} +10 -10
- package/dist/{Index-NdgHNGa3.js → Index-Bwk3-hi7.js} +10 -10
- package/dist/{Marketing-Deds20Ye.js → Marketing-D7PGcgvf.js} +6 -6
- package/dist/Member-xLRDSRGX.js +287 -0
- package/dist/{MemberList-DCR44Sk4.js → MemberList-C2KTiNo8.js} +25 -25
- package/dist/{MemberTransactions-CYPPTT9t.js → MemberTransactions-DeSQj6Hb.js} +1 -1
- package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-j3cmjEyQ.js → MessageInput.vue_vue_type_script_setup_true_lang-BXowXpx5.js} +8 -8
- package/dist/{Mission-DYk_Vv35.js → Mission-C_oIC_Qy.js} +10 -10
- package/dist/{Overview-CsRent_o.js → Overview-k_S6Xw7W.js} +53 -53
- package/dist/{Point-BV5qm3r7.js → Point-Clh-RJDJ.js} +9 -9
- package/dist/{Promotion-ieE1dY52.js → Promotion-Bx8nrXaK.js} +10 -10
- package/dist/{Queue-DkIuyH5Y.js → Queue-CZKA5dNa.js} +13 -13
- package/dist/{Record-BO4eYofF.js → Record-f6MIjxW-.js} +8 -8
- package/dist/{Reward-DcoWW28K.js → Reward-BWPTRfzF.js} +15 -15
- package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-6s4ElOcQ.js → RewardGroup.vue_vue_type_script_setup_true_lang-Lm3CoKbR.js} +11 -11
- package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-l-qayOI8.js → RuleGroup.vue_vue_type_script_setup_true_lang-D--VbQVQ.js} +13 -13
- package/dist/Segment-nw3f_GaH.js +837 -0
- package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-Dei-K3cP.js → SelectItems.vue_vue_type_script_setup_true_lang-CS50BqbP.js} +2 -2
- package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-B0fwBafY.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-CQN3-f-u.js} +11 -11
- package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-Dl30f-41.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-61JEa7bb.js} +3 -3
- package/dist/{Setting-Cnv36Pu0.js → Setting-DvU5aYwQ.js} +38 -38
- package/dist/{Store-CTK5EtS1.js → Store-knOLFAwu.js} +19 -19
- package/dist/{StoreRewards-CnHiDS7A.js → StoreRewards-DzRm9fAd.js} +13 -13
- package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-o8BduJhH.js → StoreTransactions.vue_vue_type_script_setup_true_lang-DPb1uIuI.js} +19 -19
- package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-CDCQIDZh.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-DjbIKCPW.js} +1 -1
- package/dist/{Tier-CcN8habX.js → Tier-DaS2t5vf.js} +20 -20
- package/dist/{Title-DtsvtR89.js → Title-BmWVQAVd.js} +153 -145
- package/dist/{Transaction-NylYY_6m.js → Transaction-QQdDVX3d.js} +2 -2
- package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-Book86tM.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-mgx3WQkZ.js} +6 -6
- package/dist/{Voucher-z6XGrJrc.js → Voucher-e3fwsfzv.js} +12 -12
- package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-C0TGO7Cl.js → VoucherEditor.vue_vue_type_script_setup_true_lang-9_wK8PrL.js} +10 -10
- package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-Du4wOEBs.js → ZodTextField.vue_vue_type_script_setup_true_lang-CYegMpRN.js} +1 -1
- package/dist/{app-Dew6WljN.js → app-1i7mx0dZ.js} +1 -1
- package/dist/{app-nEHwJezD.js → app-BN77OXgS.js} +427 -423
- package/dist/app.js +1 -1
- package/dist/{business-CXTuYix4.js → business-DqRPnW29.js} +1 -1
- package/dist/{campaign-BZs7RPUJ.js → campaign-B-4_cJoI.js} +9 -9
- package/dist/{campaign-C18IUOcO.js → campaign-b9FvKigH.js} +2 -2
- package/dist/{campaign.enum-C7o8B5Cf.js → campaign.enum-CDVoZ8sM.js} +1 -1
- package/dist/{campaign.fn-CP0x2e6M.js → campaign.fn-C6FtAdXE.js} +18 -18
- package/dist/{collectible.enum-QJSyw8dX.js → collectible.enum-CjBbYd8r.js} +1 -1
- package/dist/{collection.fn-_9GY8WUr.js → collection.fn-DzvhTgvy.js} +2 -2
- package/dist/{dto-Cwr4tMef.js → dto-D9PkBV2m.js} +12 -12
- package/dist/{effect-C3dyQmVR.js → effect-gk-rwqTS.js} +1 -1
- package/dist/{email-addresses-DNwlAZV3.js → email-addresses-B6TJYRyi.js} +1 -1
- package/dist/{export-C11NCFgO.js → export-Dz6QgXPN.js} +3 -3
- package/dist/{helper-HHvZd4M_.js → helper-ChjpvgXI.js} +1 -1
- package/dist/{index-CyXkN89w.js → index-B91yws4l.js} +2 -2
- package/dist/{index-CL0DvpMU.js → index-BH2tnZva.js} +1 -1
- package/dist/{index-8MnjnTtN.js → index-BHRp97cP.js} +1 -1
- package/dist/{index-DJ-RhIDQ.js → index-BLdXv3F2.js} +1 -1
- package/dist/{index-DM6Zvwcl.js → index-CXBFjuZG.js} +1 -1
- package/dist/{index-DyfTL0NG.js → index-CdRq0mem.js} +1 -1
- package/dist/{index-jdsxOVkp.js → index-D1XWT8fK.js} +3 -3
- package/dist/{index-yrwLRgg0.js → index-D81rTS6w.js} +3 -3
- package/dist/{index-BzIzz7cS.js → index-DaiMhPcB.js} +3 -3
- package/dist/{index-B0zezW3E.js → index-HR-s-wxL.js} +1 -1
- package/dist/{index-CCTd1lLH.js → index-PgUO1aJB.js} +189 -187
- package/dist/{index-CT4Hyf4w.js → index-T5VJ7LOc.js} +6 -6
- package/dist/{index-CIKyf9ft.js → index-kV76DTQa.js} +1 -1
- package/dist/{index.esm2017-BMFlbxdx.js → index.esm2017-Cse5Z0VX.js} +59 -59
- package/dist/{loading-ClVTDQc6.js → loading-CTlOzqJl.js} +1 -1
- package/dist/{membership-DqMQPgdF.js → membership-BEHTbLlS.js} +3 -3
- package/dist/{money-COS1BMzW.js → money-qwQnNFuK.js} +1 -1
- package/dist/{number-BuP5vRmO.js → number-g3UEQ6sr.js} +1 -1
- package/dist/{objectid-B3LrrWLD.js → objectid-D3FHs3ZM.js} +9 -9
- package/dist/{plugins-DWMQmNXZ.js → plugins-C1KEHJqD.js} +2 -2
- package/dist/{reward-Dh8eazpS.js → reward-BKE2TAvZ.js} +1 -1
- package/dist/{rule-CaiZcfw4.js → rule-Bqmb5DjB.js} +3 -3
- package/dist/{rule-builder-DOHyUDI2.js → rule-builder-Cv6CdZ_v.js} +1 -1
- package/dist/{template-BZCh-lEH.js → template-DNmDTslz.js} +4 -4
- package/dist/{trigger-CUY_7-so.js → trigger-BJb8Msn3.js} +4 -4
- package/dist/{user-DWsuhUnL.js → user-D2PePZtI.js} +1 -1
- package/dist/{vue-i18n-BXjn2dYe.js → vue-i18n-DPPL08ue.js} +200 -200
- package/dist/{xlsx-BGsRNT8x.js → xlsx-DYWFGuKq.js} +1 -1
- package/package.json +1 -1
- package/dist/Member-BiwCcUbl.js +0 -357
- package/dist/Segment-dTpsHadj.js +0 -794
|
@@ -0,0 +1,837 @@
|
|
|
1
|
+
import { defineComponent as ee, ref as U, resolveComponent as h, openBlock as f, createElementBlock as C, createElementVNode as s, createVNode as c, unref as t, createCommentVNode as se, createBlock as J, toDisplayString as $, normalizeClass as le, onMounted as _e, Fragment as G, renderList as Se, withCtx as A, computed as ie, isRef as Ce, createSlots as ke, h as Y, onBeforeMount as Ie } from "vue";
|
|
2
|
+
import { _ as Me } from "./campaign-CpzFl8Vr.js";
|
|
3
|
+
import { p as Te } from "./plugins-C1KEHJqD.js";
|
|
4
|
+
import { u as Ee } from "./loading-CTlOzqJl.js";
|
|
5
|
+
import { FmButtonVariant as ae, useSnackbar as Ae, components as X } from "@feedmepos/ui-library";
|
|
6
|
+
import { u as xe, _ as we } from "./usePagination-BeF5K3M7.js";
|
|
7
|
+
import { u as Fe } from "./vue-i18n-DPPL08ue.js";
|
|
8
|
+
import "./index-T5VJ7LOc.js";
|
|
9
|
+
import { i as Re, j as D, c as pe } from "./index-PgUO1aJB.js";
|
|
10
|
+
import "./index-B91yws4l.js";
|
|
11
|
+
import "./index-BH2tnZva.js";
|
|
12
|
+
import "./index-D81rTS6w.js";
|
|
13
|
+
import { w as De } from "./xlsx-DYWFGuKq.js";
|
|
14
|
+
import { e as $e, M as Pe } from "./email-addresses-B6TJYRyi.js";
|
|
15
|
+
import { Z as Ne } from "./zod-Bg2FbC-D.js";
|
|
16
|
+
import { u as Ve } from "./app-wDQR6dpb.js";
|
|
17
|
+
import { F as me, z as Be } from "./index-D1XWT8fK.js";
|
|
18
|
+
import { R as fe } from "./rule-builder-Cv6CdZ_v.js";
|
|
19
|
+
import { _ as Ye } from "./ZodTextField.vue_vue_type_script_setup_true_lang-CYegMpRN.js";
|
|
20
|
+
import { _ as Le } from "./RuleGroup.vue_vue_type_script_setup_true_lang-D--VbQVQ.js";
|
|
21
|
+
import { u as Ue, v as ze, w as Oe } from "./index.esm2017-Cse5Z0VX.js";
|
|
22
|
+
import { F as je } from "./FileSaver.min-NlMItPOc.js";
|
|
23
|
+
import { h as H } from "./moment-BWErdI6_.js";
|
|
24
|
+
import { s as N, u as qe } from "./membership-BEHTbLlS.js";
|
|
25
|
+
import { o as He } from "./objectId-dwaoBfJX.js";
|
|
26
|
+
import { u as he } from "./business-DqRPnW29.js";
|
|
27
|
+
import { f as Ge } from "./number-g3UEQ6sr.js";
|
|
28
|
+
import { t as Je } from "./money-qwQnNFuK.js";
|
|
29
|
+
import "./index-BHRp97cP.js";
|
|
30
|
+
import { useRouter as Qe } from "vue-router";
|
|
31
|
+
import { m as ge } from "./index-CdRq0mem.js";
|
|
32
|
+
import { R as ye } from "./app-BN77OXgS.js";
|
|
33
|
+
const We = Re.extend({
|
|
34
|
+
_id: me.optional(),
|
|
35
|
+
business: me.optional(),
|
|
36
|
+
file: Be.any().nullish()
|
|
37
|
+
}), Ze = { class: "flex flex-col space-y-16" }, Ke = {
|
|
38
|
+
key: 0,
|
|
39
|
+
class: /* @__PURE__ */ le([
|
|
40
|
+
"p-16 pl-24 space-x-8",
|
|
41
|
+
"bg-fm-color-primary-oats rounded-lg",
|
|
42
|
+
"flex items-center",
|
|
43
|
+
"justify-between"
|
|
44
|
+
])
|
|
45
|
+
}, Xe = {
|
|
46
|
+
key: 1,
|
|
47
|
+
class: /* @__PURE__ */ le([
|
|
48
|
+
"flex items-center",
|
|
49
|
+
"border border-fm-color-neutral-gray-300",
|
|
50
|
+
"p-16 space-x-16 rounded-md"
|
|
51
|
+
])
|
|
52
|
+
}, et = { class: "fm-typo-en-body-lg-400 flex-1 truncate" }, tt = /* @__PURE__ */ ee({
|
|
53
|
+
__name: "ImportSegment",
|
|
54
|
+
props: {
|
|
55
|
+
importFile: {}
|
|
56
|
+
},
|
|
57
|
+
emits: ["update:file"],
|
|
58
|
+
setup(e, { emit: v }) {
|
|
59
|
+
const _ = e, w = v, { t: u } = Fe(), g = U(null), m = U(null), F = ["Id"];
|
|
60
|
+
async function n() {
|
|
61
|
+
if (_.importFile)
|
|
62
|
+
try {
|
|
63
|
+
const p = Ue(), S = ze(p, _.importFile), x = await Oe(S);
|
|
64
|
+
window.open(x, "_blank");
|
|
65
|
+
} catch (p) {
|
|
66
|
+
console.log(p);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
async function l() {
|
|
70
|
+
const p = new Blob([F.join(",")], {
|
|
71
|
+
type: "text/csv;charset=utf-8;"
|
|
72
|
+
});
|
|
73
|
+
je.saveAs(p, "ImportSegmentTemplate.csv");
|
|
74
|
+
}
|
|
75
|
+
function r(p) {
|
|
76
|
+
g.value = p, w("update:file", g.value);
|
|
77
|
+
}
|
|
78
|
+
function b(p) {
|
|
79
|
+
var x, T;
|
|
80
|
+
const S = ((T = (x = p.target) == null ? void 0 : x.files) == null ? void 0 : T[0]) ?? null;
|
|
81
|
+
r(S);
|
|
82
|
+
}
|
|
83
|
+
return (p, S) => {
|
|
84
|
+
const x = h("FmButton"), T = h("FmDropField");
|
|
85
|
+
return f(), C("div", Ze, [
|
|
86
|
+
S[2] || (S[2] = s("div", { class: "fm-typo-en-title-sm-800" }, "Upload File", -1)),
|
|
87
|
+
p.importFile ? (f(), C("div", Ke, [
|
|
88
|
+
c(x, {
|
|
89
|
+
label: t(u)("View uploaded file"),
|
|
90
|
+
variant: t(ae).Plain,
|
|
91
|
+
icon: "file_present",
|
|
92
|
+
onClick: n
|
|
93
|
+
}, null, 8, ["label", "variant"])
|
|
94
|
+
])) : se("", !0),
|
|
95
|
+
s("div", null, [
|
|
96
|
+
c(x, {
|
|
97
|
+
class: "ml-auto",
|
|
98
|
+
variant: "tertiary",
|
|
99
|
+
icon: "download",
|
|
100
|
+
label: "Download Template",
|
|
101
|
+
onClick: l
|
|
102
|
+
}),
|
|
103
|
+
g.value ? (f(), C("div", Xe, [
|
|
104
|
+
c(x, {
|
|
105
|
+
variant: t(ae).Tertiary,
|
|
106
|
+
"prepend-icon": "attach_file"
|
|
107
|
+
}, null, 8, ["variant"]),
|
|
108
|
+
s("p", et, $(g.value.name), 1),
|
|
109
|
+
s("label", {
|
|
110
|
+
ref_key: "fileLabelRef",
|
|
111
|
+
ref: m,
|
|
112
|
+
htmlFor: "file"
|
|
113
|
+
}, [
|
|
114
|
+
c(x, {
|
|
115
|
+
variant: t(ae).Plain,
|
|
116
|
+
label: t(u)("Replace File"),
|
|
117
|
+
onClick: S[1] || (S[1] = () => {
|
|
118
|
+
var E;
|
|
119
|
+
return (E = m.value) == null ? void 0 : E.click();
|
|
120
|
+
})
|
|
121
|
+
}, null, 8, ["variant", "label"]),
|
|
122
|
+
s("input", {
|
|
123
|
+
id: "file",
|
|
124
|
+
accept: ".csv",
|
|
125
|
+
class: "hidden",
|
|
126
|
+
type: "file",
|
|
127
|
+
multiple: "",
|
|
128
|
+
onChange: b
|
|
129
|
+
}, null, 32)
|
|
130
|
+
], 512)
|
|
131
|
+
])) : (f(), J(T, {
|
|
132
|
+
key: 0,
|
|
133
|
+
onFileUpload: S[0] || (S[0] = (E) => r(E)),
|
|
134
|
+
accept: ".csv",
|
|
135
|
+
"max-file-size": 2e7
|
|
136
|
+
}))
|
|
137
|
+
])
|
|
138
|
+
]);
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
}), ot = { class: "space-y-16 pr-12" }, at = { class: "fm-typo-en-title-md-800" }, nt = { class: "flex space-x-8" }, st = { class: "fm-typo-en-title-md-800 text-fm-color-primary" }, lt = { class: "text-fm-color-typo-secondary" }, it = /* @__PURE__ */ ee({
|
|
142
|
+
__name: "ReviewSegment",
|
|
143
|
+
props: {
|
|
144
|
+
title: {},
|
|
145
|
+
segment: {}
|
|
146
|
+
},
|
|
147
|
+
setup(e) {
|
|
148
|
+
const v = e, _ = [
|
|
149
|
+
{
|
|
150
|
+
header: "Name",
|
|
151
|
+
accessorFn: (l) => l.name
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
header: "Id",
|
|
155
|
+
accessorFn: (l) => l._id
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
header: "Customer Since",
|
|
159
|
+
accessorFn: (l) => H(He(l._id.toString())).format("DD MMM YYYY")
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
header: "Phone",
|
|
163
|
+
accessorFn: (l) => l.phoneNumber
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
header: "Birthday",
|
|
167
|
+
accessorFn: (l) => H(l.birthday).format("DD MMM YYYY")
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
header: "Last Visit",
|
|
171
|
+
accessorFn: (l) => H(l.stats.lastVisit).format("DD MMM YYYY")
|
|
172
|
+
}
|
|
173
|
+
], w = async (l) => v.segment._id ? await N.paginateSegmentUsers(v.segment._id, {
|
|
174
|
+
limit: u.value.pageSize,
|
|
175
|
+
skip: l.pageIndex ?? 0,
|
|
176
|
+
sortBy: "_id",
|
|
177
|
+
search: l.searchValue,
|
|
178
|
+
descending: !0
|
|
179
|
+
}) : { resources: [], meta: { totalResources: 0, totalPages: 0 } }, { tableMeta: u, rowData: g, onSort: m, debouncedFetchData: F, onSearch: n } = xe(w);
|
|
180
|
+
return _e(async () => {
|
|
181
|
+
await F();
|
|
182
|
+
}), (l, r) => (f(), C("div", ot, [
|
|
183
|
+
s("div", at, $(v.title), 1),
|
|
184
|
+
s("div", nt, [
|
|
185
|
+
s("div", st, $(l.segment.members.length), 1),
|
|
186
|
+
s("div", lt, [
|
|
187
|
+
r[1] || (r[1] = s("div", null, "contacts in your segment", -1)),
|
|
188
|
+
s("div", null, "as of " + $(t(H)(l.segment.lastUpdated).format("DD MMM YYYY")), 1)
|
|
189
|
+
])
|
|
190
|
+
]),
|
|
191
|
+
c(we, {
|
|
192
|
+
loading: t(u).isLoading,
|
|
193
|
+
"row-data": t(g),
|
|
194
|
+
"row-count": t(u).totalRows,
|
|
195
|
+
"column-defs": _,
|
|
196
|
+
"page-size": t(u).pageSize,
|
|
197
|
+
"page-count": t(u).pageCount,
|
|
198
|
+
"page-index": t(u).pageIndex,
|
|
199
|
+
onSortChange: t(m),
|
|
200
|
+
onPageChange: r[0] || (r[0] = (b) => t(F)({ pageSize: b.pageSize, pageIndex: b.pageIndex }))
|
|
201
|
+
}, null, 8, ["loading", "row-data", "row-count", "page-size", "page-count", "page-index", "onSortChange"])
|
|
202
|
+
]));
|
|
203
|
+
}
|
|
204
|
+
}), rt = { class: "space-y-24" }, ct = { class: "grid grid-cols-2 gap-16" }, dt = { class: "fm-typo-en-title-sm-800" }, ut = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, pt = /* @__PURE__ */ ee({
|
|
205
|
+
__name: "SegmentTypeOption",
|
|
206
|
+
props: {
|
|
207
|
+
modelValue: {},
|
|
208
|
+
errorText: {}
|
|
209
|
+
},
|
|
210
|
+
emits: ["update:model-value"],
|
|
211
|
+
setup(e, { emit: v }) {
|
|
212
|
+
const _ = e, w = v, u = [
|
|
213
|
+
{
|
|
214
|
+
label: "Dynamic",
|
|
215
|
+
sublabel: "Segment statistics are based on rules configured and will be recalculated automatically when rule changes.",
|
|
216
|
+
value: D.enum.DYNAMIC
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
label: "Static",
|
|
220
|
+
sublabel: "Segment statistics are based on imported data and will not be recalculated.",
|
|
221
|
+
value: D.enum.STATIC
|
|
222
|
+
}
|
|
223
|
+
];
|
|
224
|
+
function g(m) {
|
|
225
|
+
m !== _.modelValue && w("update:model-value", m);
|
|
226
|
+
}
|
|
227
|
+
return (m, F) => {
|
|
228
|
+
const n = h("FmCard"), l = h("FmHelperText");
|
|
229
|
+
return f(), C("div", rt, [
|
|
230
|
+
s("div", ct, [
|
|
231
|
+
(f(), C(G, null, Se(u, (r) => c(n, {
|
|
232
|
+
variant: "outlined",
|
|
233
|
+
class: le(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-2", {
|
|
234
|
+
"col-span-2": u.length == 1,
|
|
235
|
+
"border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": m.modelValue === r.value,
|
|
236
|
+
"hover:bg-fm-color-opacity-sm": m.modelValue !== r.value
|
|
237
|
+
}]),
|
|
238
|
+
onClick: (b) => g(r.value),
|
|
239
|
+
key: r.value
|
|
240
|
+
}, {
|
|
241
|
+
default: A(() => [
|
|
242
|
+
s("div", dt, $(r.label), 1),
|
|
243
|
+
s("div", ut, $(r.sublabel), 1)
|
|
244
|
+
]),
|
|
245
|
+
_: 2
|
|
246
|
+
}, 1032, ["class", "onClick"])), 64))
|
|
247
|
+
]),
|
|
248
|
+
m.errorText ? (f(), J(l, {
|
|
249
|
+
key: 0,
|
|
250
|
+
class: "!mt-4",
|
|
251
|
+
text: m.errorText,
|
|
252
|
+
state: "error"
|
|
253
|
+
}, null, 8, ["text"])) : se("", !0)
|
|
254
|
+
]);
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
}), mt = { class: "flex items-center gap-x-8" }, ft = {
|
|
258
|
+
key: 0,
|
|
259
|
+
class: "space-y-16 pr-12"
|
|
260
|
+
}, gt = { class: "flex flex-col space-y-16" }, yt = {
|
|
261
|
+
key: 0,
|
|
262
|
+
class: "flex flex-col space-y-16"
|
|
263
|
+
}, vt = {
|
|
264
|
+
key: 1,
|
|
265
|
+
class: "flex flex-col space-y-16"
|
|
266
|
+
}, _t = {
|
|
267
|
+
key: 2,
|
|
268
|
+
class: "flex flex-col space-y-16"
|
|
269
|
+
}, St = { class: "flex items-center gap-8" }, xt = /* @__PURE__ */ ee({
|
|
270
|
+
__name: "SegmentSheet",
|
|
271
|
+
emits: ["update:model-value"],
|
|
272
|
+
setup(e, { expose: v, emit: _ }) {
|
|
273
|
+
const w = Ve(), u = U(!1), g = U(!1), m = {
|
|
274
|
+
name: "",
|
|
275
|
+
isActive: !0,
|
|
276
|
+
type: D.enum.DYNAMIC,
|
|
277
|
+
rule: fe.scaffoldGroup(),
|
|
278
|
+
members: []
|
|
279
|
+
}, F = We, n = U(m), l = ie(() => {
|
|
280
|
+
const y = F.safeParse(n.value);
|
|
281
|
+
return y.success ? [] : y.error.errors;
|
|
282
|
+
});
|
|
283
|
+
function r(y) {
|
|
284
|
+
u.value = !0, g.value = !1, y ? n.value = {
|
|
285
|
+
...y,
|
|
286
|
+
isActive: y.isActive !== !1,
|
|
287
|
+
type: y.type ?? (y.importFile ? D.enum.STATIC : D.enum.DYNAMIC)
|
|
288
|
+
} : n.value = { ...m };
|
|
289
|
+
}
|
|
290
|
+
function b() {
|
|
291
|
+
u.value = !1;
|
|
292
|
+
}
|
|
293
|
+
async function p() {
|
|
294
|
+
F.safeParse(n.value).success && (g.value = !0);
|
|
295
|
+
}
|
|
296
|
+
function S() {
|
|
297
|
+
g.value = !1;
|
|
298
|
+
}
|
|
299
|
+
async function x() {
|
|
300
|
+
n.value.type === D.enum.STATIC ? (n.value.rule = fe.scaffoldGroup(), n.value.isActive = !1) : n.value.file = void 0, E("update:model-value", n.value);
|
|
301
|
+
}
|
|
302
|
+
async function T(y) {
|
|
303
|
+
n.value.type = y;
|
|
304
|
+
}
|
|
305
|
+
_e(async () => {
|
|
306
|
+
});
|
|
307
|
+
const E = _;
|
|
308
|
+
return v({
|
|
309
|
+
showSheet: r,
|
|
310
|
+
hideSheet: b
|
|
311
|
+
}), (y, i) => {
|
|
312
|
+
const R = h("FmButton"), z = h("FmSwitch"), a = h("FmSideSheet");
|
|
313
|
+
return f(), J(a, {
|
|
314
|
+
modelValue: t(u),
|
|
315
|
+
"onUpdate:modelValue": i[8] || (i[8] = (o) => Ce(u) ? u.value = o : null),
|
|
316
|
+
header: "Add segment",
|
|
317
|
+
"dismiss-away": "",
|
|
318
|
+
"close-button": !0,
|
|
319
|
+
"max-width": 1100
|
|
320
|
+
}, ke({
|
|
321
|
+
"side-sheet-footer": A(() => [
|
|
322
|
+
s("div", St, [
|
|
323
|
+
t(g) || t(n).type === t(D).enum.STATIC ? (f(), C(G, { key: 0 }, [
|
|
324
|
+
c(R, {
|
|
325
|
+
label: "Save Segment",
|
|
326
|
+
onClick: x,
|
|
327
|
+
loading: t(w).isLoading,
|
|
328
|
+
disabled: t(l).length > 0 || t(w).isLoading
|
|
329
|
+
}, null, 8, ["loading", "disabled"]),
|
|
330
|
+
c(R, {
|
|
331
|
+
label: "Cancel",
|
|
332
|
+
onClick: i[6] || (i[6] = (o) => S()),
|
|
333
|
+
variant: "tertiary"
|
|
334
|
+
})
|
|
335
|
+
], 64)) : (f(), C(G, { key: 1 }, [
|
|
336
|
+
c(R, {
|
|
337
|
+
label: "Review Segment",
|
|
338
|
+
disabled: t(l).length > 0 || t(w).isLoading,
|
|
339
|
+
onClick: p
|
|
340
|
+
}, null, 8, ["disabled"]),
|
|
341
|
+
c(R, {
|
|
342
|
+
label: "Cancel",
|
|
343
|
+
onClick: i[7] || (i[7] = (o) => b()),
|
|
344
|
+
variant: "tertiary"
|
|
345
|
+
})
|
|
346
|
+
], 64))
|
|
347
|
+
])
|
|
348
|
+
]),
|
|
349
|
+
default: A(() => {
|
|
350
|
+
var o;
|
|
351
|
+
return [
|
|
352
|
+
t(g) ? (f(), J(it, {
|
|
353
|
+
key: 1,
|
|
354
|
+
title: t(n).name,
|
|
355
|
+
segment: t(n)
|
|
356
|
+
}, null, 8, ["title", "segment"])) : (f(), C("div", ft, [
|
|
357
|
+
c(Ye, {
|
|
358
|
+
modelValue: t(n).name,
|
|
359
|
+
"onUpdate:modelValue": i[1] || (i[1] = (d) => t(n).name = d),
|
|
360
|
+
label: "Segment title",
|
|
361
|
+
schema: t(Ne).typeAtPath(t(F), "name")
|
|
362
|
+
}, null, 8, ["modelValue", "schema"]),
|
|
363
|
+
s("div", gt, [
|
|
364
|
+
i[10] || (i[10] = s("div", { class: "fm-typo-en-title-sm-800" }, "Segment Type", -1)),
|
|
365
|
+
c(pt, {
|
|
366
|
+
"model-value": t(n).type,
|
|
367
|
+
"onUpdate:modelValue": i[2] || (i[2] = (d) => {
|
|
368
|
+
T(d);
|
|
369
|
+
})
|
|
370
|
+
}, null, 8, ["model-value"])
|
|
371
|
+
]),
|
|
372
|
+
t(n).type === t(D).enum.DYNAMIC ? (f(), C("div", yt, [
|
|
373
|
+
i[11] || (i[11] = s("div", { class: "fm-typo-en-title-sm-800" }, "Segment Filter", -1)),
|
|
374
|
+
c(Le, {
|
|
375
|
+
"trigger-type": "MEMBERSHIP_JOINED",
|
|
376
|
+
includeOnly: "user",
|
|
377
|
+
"model-value": (o = t(n)) == null ? void 0 : o.rule,
|
|
378
|
+
"onUpdate:modelValue": i[3] || (i[3] = (d) => {
|
|
379
|
+
t(n).rule = d;
|
|
380
|
+
})
|
|
381
|
+
}, null, 8, ["model-value"])
|
|
382
|
+
])) : (f(), C("div", vt, [
|
|
383
|
+
c(tt, {
|
|
384
|
+
importFile: t(n).importFile,
|
|
385
|
+
"onUpdate:file": i[4] || (i[4] = (d) => {
|
|
386
|
+
t(n).file = d;
|
|
387
|
+
})
|
|
388
|
+
}, null, 8, ["importFile"])
|
|
389
|
+
])),
|
|
390
|
+
t(n).type === t(D).enum.DYNAMIC ? (f(), C("div", _t, [
|
|
391
|
+
i[12] || (i[12] = s("div", { class: "fm-typo-en-title-sm-800" }, "Segment Status", -1)),
|
|
392
|
+
c(z, {
|
|
393
|
+
"model-value": t(n).isActive ?? !0,
|
|
394
|
+
"onUpdate:modelValue": i[5] || (i[5] = (d) => t(n).isActive = d),
|
|
395
|
+
label: "Active",
|
|
396
|
+
sublabel: "When enabled, this will recalculate the segment statistics daily.",
|
|
397
|
+
"label-placement": "right"
|
|
398
|
+
}, null, 8, ["model-value"])
|
|
399
|
+
])) : se("", !0)
|
|
400
|
+
]))
|
|
401
|
+
];
|
|
402
|
+
}),
|
|
403
|
+
_: 2
|
|
404
|
+
}, [
|
|
405
|
+
t(g) ? {
|
|
406
|
+
name: "side-sheet-header",
|
|
407
|
+
fn: A(() => [
|
|
408
|
+
s("div", mt, [
|
|
409
|
+
c(R, {
|
|
410
|
+
icon: "arrow_back",
|
|
411
|
+
variant: "tertiary",
|
|
412
|
+
onClick: i[0] || (i[0] = (o) => g.value = !1)
|
|
413
|
+
}),
|
|
414
|
+
i[9] || (i[9] = s("div", null, "Review segment", -1))
|
|
415
|
+
])
|
|
416
|
+
]),
|
|
417
|
+
key: "0"
|
|
418
|
+
} : void 0
|
|
419
|
+
]), 1032, ["modelValue"]);
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
}), ve = qe(), wt = he();
|
|
423
|
+
function ne(e) {
|
|
424
|
+
const v = H(e);
|
|
425
|
+
return v.isValid() ? v.format("DD/MM/YYYY") : "";
|
|
426
|
+
}
|
|
427
|
+
const Ft = {
|
|
428
|
+
mapMemberExportRow: (e) => {
|
|
429
|
+
var l, r, b, p, S, x, T, E, y, i, R, z, a, o, d, P, M, V, B, O, j, q, te, k, Q, re, ce, de;
|
|
430
|
+
const v = ie(() => wt.locations.map((I) => ({
|
|
431
|
+
label: I.name,
|
|
432
|
+
value: I._id
|
|
433
|
+
}))), _ = (l = $e.parseOneAddress(
|
|
434
|
+
e == null ? void 0 : e.email
|
|
435
|
+
)) != null && l.domain.includes("feedmepos.com") ? void 0 : e.email, w = (b = ((r = e == null ? void 0 : e.collection) == null ? void 0 : r.TITLE) || []) == null ? void 0 : b.reduce(
|
|
436
|
+
(I, L) => {
|
|
437
|
+
var Z, K;
|
|
438
|
+
const W = (K = (Z = ve.sortedTitles) == null ? void 0 : Z.find(
|
|
439
|
+
(oe) => oe._id === L.collectible
|
|
440
|
+
)) == null ? void 0 : K.name;
|
|
441
|
+
return !W || L.balance <= 0 || I.push(W), I;
|
|
442
|
+
},
|
|
443
|
+
[]
|
|
444
|
+
), u = (ve.sortedTitles || []).reduce(
|
|
445
|
+
(I, L) => {
|
|
446
|
+
var Z, K, oe, ue;
|
|
447
|
+
const W = (ue = (oe = (K = (((Z = e == null ? void 0 : e.collection) == null ? void 0 : Z.TITLE) || []).find(
|
|
448
|
+
(be) => be.collectible === L._id
|
|
449
|
+
)) == null ? void 0 : K.expiryBalance) == null ? void 0 : oe[0]) == null ? void 0 : ue.expiredAt;
|
|
450
|
+
return I[L.name] = W ? H(W).format("DD/MM/YYYY") : "", I;
|
|
451
|
+
},
|
|
452
|
+
{}
|
|
453
|
+
), g = ((x = (S = (p = e.collection) == null ? void 0 : p.CREDIT) == null ? void 0 : S.at(0)) == null ? void 0 : x.balance) || 0, m = ((i = (y = (E = (T = e.collection) == null ? void 0 : T.CREDIT) == null ? void 0 : E.at(0)) == null ? void 0 : y.expiryBalance) == null ? void 0 : i.reduce(
|
|
454
|
+
(I, L) => I + L.amount,
|
|
455
|
+
0
|
|
456
|
+
)) || 0, F = Ge(g, 2);
|
|
457
|
+
return {
|
|
458
|
+
ID: e._id.toString(),
|
|
459
|
+
Name: ((R = e.name) == null ? void 0 : R.trim()) || "",
|
|
460
|
+
Phone: ((z = e == null ? void 0 : e.phoneNumber) == null ? void 0 : z.trim()) || "",
|
|
461
|
+
Email: _ || "",
|
|
462
|
+
Gender: e.gender || "",
|
|
463
|
+
CardNo: e.cardNo || "",
|
|
464
|
+
Birthday: e != null && e.birthday ? ne(e == null ? void 0 : e.birthday) : "",
|
|
465
|
+
Credit: parseFloat((Number(F) - Number(m)).toFixed(2)),
|
|
466
|
+
FreeCredit: Number(m.toFixed(2)),
|
|
467
|
+
TotalCredit: Number(F),
|
|
468
|
+
Exp: e != null && e.collection ? ((d = (o = (a = e.collection) == null ? void 0 : a.POINT) == null ? void 0 : o.at(0)) == null ? void 0 : d.balance) ?? 0 : 0,
|
|
469
|
+
Point: e != null && e.collection ? ((V = (M = (P = e.collection) == null ? void 0 : P.COIN) == null ? void 0 : M.at(0)) == null ? void 0 : V.balance) ?? 0 : 0,
|
|
470
|
+
Level: e != null && e.collection ? ((j = (O = (B = e.collection) == null ? void 0 : B.TIER) == null ? void 0 : O.at(0)) == null ? void 0 : j.balance) ?? 0 : 0,
|
|
471
|
+
Tier: e != null && e.collection ? ((k = (te = (q = e.collection) == null ? void 0 : q.TIER) == null ? void 0 : te.at(0)) == null ? void 0 : k.balance) ?? 0 : 0,
|
|
472
|
+
Titles: w.join(","),
|
|
473
|
+
...u,
|
|
474
|
+
TotalTransaction: e.stats.visitCount,
|
|
475
|
+
AvgSpent: Je(Number(e.stats.avgBillSize || 0)).toFormat(
|
|
476
|
+
!1
|
|
477
|
+
),
|
|
478
|
+
TotalSpent: e.stats.avgBillSize * e.stats.visitCount,
|
|
479
|
+
LastVisit: ne(e.stats.lastVisit),
|
|
480
|
+
Feedback: ((Q = e.stats) == null ? void 0 : Q.feedbackCount) || 0,
|
|
481
|
+
LastSeasonTierEarned: ((re = e.stats) == null ? void 0 : re.lastSeasonTierEarned) || 0,
|
|
482
|
+
LastSeasonPointEarned: ((ce = e.stats) == null ? void 0 : ce.lastSeasonPointEarned) || 0,
|
|
483
|
+
JoinedAt: ne(e.joinAt || void 0),
|
|
484
|
+
JoinedAtLocation: e.location && ((de = v.value.find((I) => I.value == e.location)) == null ? void 0 : de.label) || "-",
|
|
485
|
+
VisitFrequency: `${Number(
|
|
486
|
+
Math.ceil(e.stats.avgVisitFrequency).toFixed(0)
|
|
487
|
+
)}`
|
|
488
|
+
};
|
|
489
|
+
}
|
|
490
|
+
}, ht = { class: "flex items-center" }, bt = { class: "fm-typo-en-title-md-600 fm-step-title line-clamp-2 mr-8" }, Ct = { class: "px-24 flex flex-col gap-y-16" }, kt = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, It = { class: "fm-typo-en-body-md-600" }, Mt = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, io = /* @__PURE__ */ ee({
|
|
491
|
+
__name: "Segment",
|
|
492
|
+
setup(e) {
|
|
493
|
+
const { minor: v } = Ee, { t: _ } = Fe(), w = he(), { mapMemberExportRow: u } = Ft, g = Ae(), m = Qe(), F = U(0), n = [
|
|
494
|
+
{
|
|
495
|
+
header: _("connect.loyalty.segment.table.name"),
|
|
496
|
+
accessorFn: (a) => a.name
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
header: _("connect.loyalty.segment.table.status"),
|
|
500
|
+
enableSorting: !1,
|
|
501
|
+
cell(a) {
|
|
502
|
+
const o = a.row.original.isActive === !1 ? "Inactive" : "Active";
|
|
503
|
+
return Y(X.FmChip, {
|
|
504
|
+
class: a.row.original.isActive === !1 ? "text-fm-color-typo-error bg-fm-color-system-error-100" : "text-fm-color-typo-success bg-fm-color-system-success-100",
|
|
505
|
+
label: o,
|
|
506
|
+
compact: !0
|
|
507
|
+
});
|
|
508
|
+
}
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
header: _("connect.loyalty.segment.table.total_customers"),
|
|
512
|
+
accessorFn: (a) => a.memberCount ?? 0
|
|
513
|
+
},
|
|
514
|
+
{
|
|
515
|
+
header: _("connect.loyalty.segment.table.customer_percentage"),
|
|
516
|
+
accessorFn: (a) => ((a.memberCount ?? 0) * 100 / F.value).toFixed(2)
|
|
517
|
+
},
|
|
518
|
+
{
|
|
519
|
+
header: _("connect.loyalty.segment.table.actions"),
|
|
520
|
+
meta: {
|
|
521
|
+
maxWidth: "100px"
|
|
522
|
+
},
|
|
523
|
+
cell(a) {
|
|
524
|
+
return Y("div", { class: "flex items-center justify-end" }, [
|
|
525
|
+
Y(
|
|
526
|
+
X.FmMenu,
|
|
527
|
+
{
|
|
528
|
+
placement: "bottom-end",
|
|
529
|
+
onClick: (o) => {
|
|
530
|
+
o.stopPropagation();
|
|
531
|
+
}
|
|
532
|
+
},
|
|
533
|
+
{
|
|
534
|
+
"menu-button": () => Y(X.FmButton, {
|
|
535
|
+
icon: "more_vert",
|
|
536
|
+
iconColor: "neutral-gray-400",
|
|
537
|
+
variant: "tertiary"
|
|
538
|
+
}),
|
|
539
|
+
default: () => [
|
|
540
|
+
Y(
|
|
541
|
+
X.FmMenuItem,
|
|
542
|
+
{
|
|
543
|
+
onClick: async (o) => {
|
|
544
|
+
o.stopPropagation(), T(a.row.original);
|
|
545
|
+
}
|
|
546
|
+
},
|
|
547
|
+
{
|
|
548
|
+
label: Y(
|
|
549
|
+
"div",
|
|
550
|
+
{
|
|
551
|
+
class: "fm-typo-en-body-md-400"
|
|
552
|
+
},
|
|
553
|
+
"Export"
|
|
554
|
+
)
|
|
555
|
+
}
|
|
556
|
+
),
|
|
557
|
+
Y(
|
|
558
|
+
X.FmMenuItem,
|
|
559
|
+
{
|
|
560
|
+
onClick: async (o) => {
|
|
561
|
+
o.stopPropagation(), x(a.row.original);
|
|
562
|
+
}
|
|
563
|
+
},
|
|
564
|
+
{
|
|
565
|
+
label: Y(
|
|
566
|
+
"div",
|
|
567
|
+
{
|
|
568
|
+
class: "text-fm-color-typo-error fm-typo-en-body-md-400"
|
|
569
|
+
},
|
|
570
|
+
"Remove"
|
|
571
|
+
)
|
|
572
|
+
}
|
|
573
|
+
)
|
|
574
|
+
]
|
|
575
|
+
}
|
|
576
|
+
)
|
|
577
|
+
]);
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
], l = U(null), { tableMeta: r, rowData: b, debouncedFetchData: p } = xe(
|
|
581
|
+
N.readAll
|
|
582
|
+
);
|
|
583
|
+
async function S() {
|
|
584
|
+
await v(
|
|
585
|
+
async () => {
|
|
586
|
+
await N.refreshSegments(), await p({ pageSize: 10, pageIndex: 0 });
|
|
587
|
+
},
|
|
588
|
+
{ message: "Refreshing segmentations" }
|
|
589
|
+
);
|
|
590
|
+
}
|
|
591
|
+
async function x(a) {
|
|
592
|
+
await Te.remove(`Are you sure you want to remove ${a.name}?`) && await v(
|
|
593
|
+
async () => {
|
|
594
|
+
await N.delete(a._id), await p({ pageSize: 10, pageIndex: 0 });
|
|
595
|
+
},
|
|
596
|
+
{
|
|
597
|
+
message: `Removing ${a.name}`,
|
|
598
|
+
successMessage: `Removed ${a.name} successfully`
|
|
599
|
+
}
|
|
600
|
+
);
|
|
601
|
+
}
|
|
602
|
+
async function T(a) {
|
|
603
|
+
const o = {
|
|
604
|
+
sortBy: "_id",
|
|
605
|
+
descending: !1,
|
|
606
|
+
rowsPerPage: 1e3,
|
|
607
|
+
page: 1,
|
|
608
|
+
rowsNumber: 0
|
|
609
|
+
}, d = new Pe(), P = (await ge.read({
|
|
610
|
+
limit: 1,
|
|
611
|
+
skip: 0,
|
|
612
|
+
sortBy: o.sortBy,
|
|
613
|
+
descending: o.descending
|
|
614
|
+
})).meta.totalResources ?? 0, M = o.rowsPerPage;
|
|
615
|
+
await v(
|
|
616
|
+
async () => {
|
|
617
|
+
for (let V = 0; V < P; V += M) {
|
|
618
|
+
const B = {
|
|
619
|
+
...o,
|
|
620
|
+
limit: M,
|
|
621
|
+
skip: o.page - 1,
|
|
622
|
+
sortBy: o.sortBy,
|
|
623
|
+
descending: o.descending
|
|
624
|
+
}, O = await N.paginateSegmentUsers(
|
|
625
|
+
a._id,
|
|
626
|
+
B
|
|
627
|
+
);
|
|
628
|
+
for (const j of O.resources) {
|
|
629
|
+
const q = u(j);
|
|
630
|
+
d.addRecord(q);
|
|
631
|
+
}
|
|
632
|
+
o.page++;
|
|
633
|
+
}
|
|
634
|
+
await De(
|
|
635
|
+
d.buildExcel(),
|
|
636
|
+
`[${a.name}]-members-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
|
|
637
|
+
{
|
|
638
|
+
bookType: "xlsx",
|
|
639
|
+
bookSST: !1,
|
|
640
|
+
type: "array"
|
|
641
|
+
}
|
|
642
|
+
), o.page = 1;
|
|
643
|
+
},
|
|
644
|
+
{
|
|
645
|
+
message: "Exporting member...",
|
|
646
|
+
successMessage: "Member exported successfully"
|
|
647
|
+
}
|
|
648
|
+
);
|
|
649
|
+
}
|
|
650
|
+
async function E(a) {
|
|
651
|
+
await v(
|
|
652
|
+
async () => {
|
|
653
|
+
var o;
|
|
654
|
+
if (a.type === D.enum.STATIC) {
|
|
655
|
+
const d = new FormData();
|
|
656
|
+
if (d.append("file", a.file), a._id) {
|
|
657
|
+
const { members: P, _id: M, file: V, ...B } = a;
|
|
658
|
+
d.append("segment", JSON.stringify(B)), await N.updateStatic(a._id, d);
|
|
659
|
+
} else {
|
|
660
|
+
const { file: P, ...M } = a;
|
|
661
|
+
d.append("segment", JSON.stringify(M)), await N.createStatic(d);
|
|
662
|
+
}
|
|
663
|
+
a.file && g.open({
|
|
664
|
+
type: "info",
|
|
665
|
+
title: "Import begins soon. Check Queue for updates.",
|
|
666
|
+
action: "View",
|
|
667
|
+
onAction: async () => {
|
|
668
|
+
await m.push({
|
|
669
|
+
name: ye["$connect-QUEUE"],
|
|
670
|
+
query: { type: [pe.enum.SEGMENTATION_IMPORTED] }
|
|
671
|
+
});
|
|
672
|
+
}
|
|
673
|
+
});
|
|
674
|
+
} else if (a._id) {
|
|
675
|
+
const { members: d, _id: P, ...M } = a;
|
|
676
|
+
await N.update(a._id, M);
|
|
677
|
+
} else
|
|
678
|
+
await N.create(a);
|
|
679
|
+
await p({ pageSize: 10, pageIndex: 0 }), (o = l.value) == null || o.hideSheet();
|
|
680
|
+
},
|
|
681
|
+
{
|
|
682
|
+
message: "Saving segment",
|
|
683
|
+
successMessage: "Segment saved"
|
|
684
|
+
}
|
|
685
|
+
);
|
|
686
|
+
}
|
|
687
|
+
function y(a) {
|
|
688
|
+
var o;
|
|
689
|
+
(o = l.value) == null || o.showSheet(a);
|
|
690
|
+
}
|
|
691
|
+
const i = {
|
|
692
|
+
label: _("connect.navigation.queue"),
|
|
693
|
+
value: "queue",
|
|
694
|
+
isPrimary: !1,
|
|
695
|
+
prependIcon: "work_history"
|
|
696
|
+
}, R = ie(() => w.isPremium ? [
|
|
697
|
+
i,
|
|
698
|
+
{
|
|
699
|
+
label: "Refresh segments",
|
|
700
|
+
value: "refresh",
|
|
701
|
+
prependIcon: "refresh"
|
|
702
|
+
},
|
|
703
|
+
{
|
|
704
|
+
label: "Add segment",
|
|
705
|
+
value: "add",
|
|
706
|
+
isPrimary: !0,
|
|
707
|
+
prependIcon: "add"
|
|
708
|
+
}
|
|
709
|
+
] : []);
|
|
710
|
+
function z(a) {
|
|
711
|
+
switch (a) {
|
|
712
|
+
case "add":
|
|
713
|
+
y();
|
|
714
|
+
break;
|
|
715
|
+
case "refresh":
|
|
716
|
+
S();
|
|
717
|
+
break;
|
|
718
|
+
case "queue":
|
|
719
|
+
m.push({
|
|
720
|
+
name: ye["$connect-QUEUE"],
|
|
721
|
+
query: { type: [pe.enum.SEGMENTATION_IMPORTED] }
|
|
722
|
+
});
|
|
723
|
+
break;
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
return Ie(async () => {
|
|
727
|
+
const { meta: a } = await ge.read({
|
|
728
|
+
limit: 1,
|
|
729
|
+
skip: 0,
|
|
730
|
+
sortBy: "_id",
|
|
731
|
+
search: void 0,
|
|
732
|
+
descending: !1
|
|
733
|
+
});
|
|
734
|
+
F.value = a.totalResources ?? 0, await p({ pageSize: 10, pageIndex: 0 }), await w.readPremium(), await w.readLocations();
|
|
735
|
+
}), (a, o) => {
|
|
736
|
+
const d = h("FmPill"), P = h("FmPageHead"), M = h("FmIcon"), V = h("FmMenuItem"), B = h("FmMenu"), O = h("FmListItem"), j = h("FmList"), q = h("FmButton"), te = h("FmCard");
|
|
737
|
+
return f(), C(G, null, [
|
|
738
|
+
c(P, {
|
|
739
|
+
title: "Segments",
|
|
740
|
+
actions: t(R),
|
|
741
|
+
"onClick:action": o[0] || (o[0] = (k) => z(k))
|
|
742
|
+
}, {
|
|
743
|
+
title: A(() => [
|
|
744
|
+
s("div", ht, [
|
|
745
|
+
s("span", bt, $(t(_)("connect.loyalty.segment.title")), 1),
|
|
746
|
+
c(d, { variant: "premium" })
|
|
747
|
+
])
|
|
748
|
+
]),
|
|
749
|
+
_: 1
|
|
750
|
+
}, 8, ["actions"]),
|
|
751
|
+
s("div", Ct, [
|
|
752
|
+
t(b).length > 0 || t(r).searchValue || t(r).isLoading ? (f(), C(G, { key: 0 }, [
|
|
753
|
+
c(we, {
|
|
754
|
+
loading: t(r).isLoading,
|
|
755
|
+
"row-data": t(b),
|
|
756
|
+
"row-count": t(r).totalRows,
|
|
757
|
+
"column-defs": n,
|
|
758
|
+
"shrink-at": !1,
|
|
759
|
+
"page-count": t(r).pageCount,
|
|
760
|
+
"page-index": t(r).pageIndex,
|
|
761
|
+
"page-size": t(r).pageSize,
|
|
762
|
+
onRowClick: o[1] || (o[1] = (k) => {
|
|
763
|
+
y(k.original);
|
|
764
|
+
}),
|
|
765
|
+
onPageChange: t(p)
|
|
766
|
+
}, null, 8, ["loading", "row-data", "row-count", "page-count", "page-index", "page-size", "onPageChange"]),
|
|
767
|
+
c(j, { class: "w-full hidden xs:block" }, {
|
|
768
|
+
default: A(() => [
|
|
769
|
+
(f(!0), C(G, null, Se(t(b), (k) => (f(), J(O, {
|
|
770
|
+
key: k._id.toString(),
|
|
771
|
+
tag: "label",
|
|
772
|
+
onClick: (Q) => y(k)
|
|
773
|
+
}, {
|
|
774
|
+
default: A(() => [
|
|
775
|
+
s("div", null, [
|
|
776
|
+
s("div", kt, $((k.memberCount ?? 0).toLocaleString()) + " total customers ", 1),
|
|
777
|
+
s("div", It, $(k.name), 1),
|
|
778
|
+
s("div", Mt, $(((k.memberCount ?? 0) * 100 / t(F)).toFixed(2)) + "% of customers ", 1)
|
|
779
|
+
])
|
|
780
|
+
]),
|
|
781
|
+
append: A(() => [
|
|
782
|
+
c(B, { "stop-click-propagation": !0 }, {
|
|
783
|
+
"menu-button": A(() => [
|
|
784
|
+
c(M, { name: "more_vert" })
|
|
785
|
+
]),
|
|
786
|
+
default: A(() => [
|
|
787
|
+
c(V, {
|
|
788
|
+
class: "text-fm-color-typo-error fm-typo-en-body-md-400",
|
|
789
|
+
label: "Remove",
|
|
790
|
+
"onUpdate:modelValue": (Q) => Q && x(k)
|
|
791
|
+
}, null, 8, ["onUpdate:modelValue"])
|
|
792
|
+
]),
|
|
793
|
+
_: 2
|
|
794
|
+
}, 1024)
|
|
795
|
+
]),
|
|
796
|
+
_: 2
|
|
797
|
+
}, 1032, ["onClick"]))), 128))
|
|
798
|
+
]),
|
|
799
|
+
_: 1
|
|
800
|
+
})
|
|
801
|
+
], 64)) : (f(), J(te, {
|
|
802
|
+
key: 1,
|
|
803
|
+
variant: "outlined",
|
|
804
|
+
class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
|
|
805
|
+
}, {
|
|
806
|
+
default: A(() => [
|
|
807
|
+
o[3] || (o[3] = s("img", {
|
|
808
|
+
src: Me,
|
|
809
|
+
class: "aspect-square w-[150px]"
|
|
810
|
+
}, null, -1)),
|
|
811
|
+
o[4] || (o[4] = s("div", { class: "flex flex-col gap-16 text-center" }, [
|
|
812
|
+
s("div", { class: "fm-typo-en-title-sm-800" }, "Create customer segments"),
|
|
813
|
+
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. ")
|
|
814
|
+
], -1)),
|
|
815
|
+
c(q, {
|
|
816
|
+
variant: "primary",
|
|
817
|
+
label: "Create segment",
|
|
818
|
+
disabled: !t(w).isPremium,
|
|
819
|
+
icon: "add",
|
|
820
|
+
onClick: o[2] || (o[2] = (k) => y())
|
|
821
|
+
}, null, 8, ["disabled"])
|
|
822
|
+
]),
|
|
823
|
+
_: 1
|
|
824
|
+
})),
|
|
825
|
+
c(xt, {
|
|
826
|
+
ref_key: "sheetRef",
|
|
827
|
+
ref: l,
|
|
828
|
+
"onUpdate:modelValue": E
|
|
829
|
+
}, null, 512)
|
|
830
|
+
])
|
|
831
|
+
], 64);
|
|
832
|
+
};
|
|
833
|
+
}
|
|
834
|
+
});
|
|
835
|
+
export {
|
|
836
|
+
io as default
|
|
837
|
+
};
|