@feedmepos/mf-connect 0.0.16-beta.1 → 0.0.16-beta.11
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-C-zZmF5N.js → Analytic-Gq7PoNer.js} +368 -365
- package/dist/App-Cikl5jnp.js +177 -0
- package/dist/Broadcast-DU3JnBwZ.js +223 -0
- package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-VWLBlxy1.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-D0I8IZIR.js} +20 -20
- package/dist/Card-hIeQ5XUH.js +825 -0
- package/dist/Collections-B1SC1rr7.js +453 -0
- package/dist/Credit-BgwI8DR3.js +216 -0
- package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-Bz6TSmbW.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-D9VR3P2d.js} +1026 -1022
- package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-AhWnHG02.js → EffectSheet.vue_vue_type_style_index_0_lang-DPgu45MD.js} +29 -29
- package/dist/Experience-C2Q-zqV6.js +221 -0
- package/dist/Game-DU2pZDGk.js +255 -0
- package/dist/ImageInput.vue_vue_type_script_setup_true_lang-rWUkV9gn.js +144 -0
- package/dist/JsonViewer-v8_C7l5N.js +87 -0
- package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-DykNOOFD.js → LottieAnimation.vue_vue_type_script_setup_true_lang-CyGJxUol.js} +1 -1
- package/dist/{MainLayout-D0AoA1tk.js → MainLayout-B1aJoR95.js} +2 -2
- package/dist/Marketing-DWiTQp9I.js +316 -0
- package/dist/Member-BEXKBFry.js +69 -0
- package/dist/MemberList-DzMdajIf.js +1733 -0
- package/dist/MemberOverview-wL_ailso.js +58 -0
- package/dist/{MemberTransactions-CTAx5jIV.js → MemberTransactions-Bciankuu.js} +1 -1
- package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-C-BtHxSc.js → MessageInput.vue_vue_type_script_setup_true_lang-DH25Hfk3.js} +46 -46
- package/dist/Mission-KzwRlaA5.js +259 -0
- package/dist/Point-CSKvZXHc.js +222 -0
- package/dist/Promotion-IiwPhx8p.js +221 -0
- package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-CrpJySSp.js → RuleGroup.vue_vue_type_script_setup_true_lang-4zIO3oCr.js} +545 -544
- package/dist/Segment-2Q0PonBb.js +447 -0
- package/dist/{Setting-Zrj5P_4m.js → Setting-Df5vVRt4.js} +600 -598
- package/dist/Store-C0WXCKs6.js +1503 -0
- package/dist/StoreRewards-eSSIO0nk.js +401 -0
- package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-DS4APaHw.js → StoreTransactions.vue_vue_type_script_setup_true_lang-BjnCRKGX.js} +106 -108
- package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-ZYjWlDJ1.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-b0xTcoEp.js} +1 -1
- package/dist/{Tier-DVWJyQ9S.js → Tier-v-1FkRU-.js} +464 -449
- package/dist/{Title-B5kX64vs.js → Title-CQ2JWqBW.js} +315 -299
- package/dist/Transaction-0OouN_6s.js +39 -0
- package/dist/Voucher-CL0cgogx.js +488 -0
- package/dist/_commonjsHelpers-BkfeUUK-.js +28 -0
- package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
- package/dist/app-Bd19eW7X.js +5381 -0
- package/dist/app-CfS25Z66.js +34797 -0
- package/dist/app-wDQR6dpb.js +39 -0
- package/dist/app.js +5 -3
- package/dist/business-dQh3AEot.js +78 -0
- package/dist/{campaign-BZJuknWK.js → campaign-BOl8AgKA.js} +12 -12
- package/dist/{collection.fn-DoCkZ6z4.js → collection.fn-B_YsXmrP.js} +2 -2
- package/dist/dto-B8NfyVPG.js +1169 -0
- package/dist/{effect-B8kmnKvY.js → effect-C2jCStXO.js} +1 -1
- package/dist/{export-Dm6LYnWo.js → export-BtZc3Yzh.js} +3 -3
- package/dist/{helper-DR4XK3nv.js → helper-8oGsrM56.js} +1 -1
- package/dist/{index-DcUrk07Q.js → index-6FkKY3q0.js} +3 -3
- package/dist/{index-Bu4_26qI.js → index-C7oeXRUl.js} +1 -1
- package/dist/{index-CuL5-ORK.js → index-CZKYIefW.js} +6 -7
- package/dist/{index-yxJMhfxj.js → index-C_0IFnwi.js} +5 -5
- package/dist/{index-BryrRq8O.js → index-DCixRRvz.js} +36 -30
- package/dist/{index-CkiYkbXb.js → index-DFgt4-VW.js} +1 -1
- package/dist/{index-CWf0mh3a.js → index-DYDhH9bi.js} +177 -168
- package/dist/{index-boor8e80.js → index-Di-kWSmf.js} +3 -3
- package/dist/{app-DkI7dYRN.js → index-Dn0jdj0o.js} +9665 -13024
- package/dist/index-DwKqFNF6.js +3 -0
- package/dist/{index-BobRgQrE.js → index-HoacsZDk.js} +2 -2
- package/dist/{index-BxkxVtgm.js → index-UTQHDUdW.js} +1 -1
- package/dist/{loading-BzV5acUX.js → loading-D_AN6p24.js} +6807 -6805
- package/dist/{lodash-mg4435Qq.js → lodash-B5I3zXaY.js} +1 -1
- package/dist/{membership-CqbsLHqx.js → membership-Ccrx9R6r.js} +3 -3
- package/dist/{money-DA_gtp3q.js → money-waD-f-Zz.js} +1 -1
- package/dist/{number-C388eyOu.js → number-CwTGGsh9.js} +1 -1
- package/dist/{rule-Clmr5y4j.js → rule-DJ07h3Gh.js} +2 -2
- package/dist/{rule-builder-BgqNbM-P.js → rule-builder-DJ-acvVD.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/template-clxvNnbF.js +190 -0
- package/dist/{usePagination-o5fgsZwU.js → usePagination-BeF5K3M7.js} +86 -86
- package/dist/vue-i18n-BxwiXSkp.js +2365 -0
- package/dist/{xlsx-BRdh9e2p.js → xlsx-BB366cdN.js} +1945 -1945
- package/package.json +9 -5
- package/dist/Broadcast-X69Mtv3b.js +0 -216
- package/dist/Card-D0X3v1UF.js +0 -822
- package/dist/Collections-umR6Ehqf.js +0 -452
- package/dist/Credit-C1EWF7R0.js +0 -214
- package/dist/Experience-CqL8wyPm.js +0 -211
- package/dist/Game--kYe64EV.js +0 -250
- package/dist/ImageInput.vue_vue_type_script_setup_true_lang-BjOJ3XSL.js +0 -144
- package/dist/Marketing-CTCQ5ZmZ.js +0 -308
- package/dist/Member-DCduX7zP.js +0 -91
- package/dist/MemberList-B0EkXZJu.js +0 -1729
- package/dist/MemberOverview-C2n9oJZh.js +0 -58
- package/dist/Mission-CVr9rS_D.js +0 -248
- package/dist/Point-BnZ6M74y.js +0 -220
- package/dist/Promotion-B0PUve5S.js +0 -218
- package/dist/Segment-B-XpkyM5.js +0 -445
- package/dist/Store-B2gywCt2.js +0 -1503
- package/dist/StoreRewards-D8410Q_-.js +0 -434
- package/dist/Transaction-CZBO4v4d.js +0 -36
- package/dist/Voucher-se-4JF9B.js +0 -481
- package/dist/app-B2ImSO3V.js +0 -53382
- package/dist/dto-BWpvRpK2.js +0 -1151
- package/dist/template-Dwp7heBA.js +0 -190
|
@@ -0,0 +1,447 @@
|
|
|
1
|
+
import { defineComponent as A, onMounted as N, openBlock as u, createElementBlock as b, createElementVNode as a, toDisplayString as x, unref as t, createVNode as l, createCommentVNode as G, ref as w, computed as j, resolveComponent as c, createBlock as B, isRef as J, createSlots as W, withCtx as g, Fragment as I, h as R, reactive as Q, watch as X, onBeforeMount as ee, renderList as te } from "vue";
|
|
2
|
+
import { _ as oe } from "./campaign-CpzFl8Vr.js";
|
|
3
|
+
import { F as E, p as ae, u as ne } from "./loading-D_AN6p24.js";
|
|
4
|
+
import { components as L } from "@feedmepos/ui-library";
|
|
5
|
+
import { l as se } from "./lodash-B5I3zXaY.js";
|
|
6
|
+
import { u as le } from "./vue-i18n-BxwiXSkp.js";
|
|
7
|
+
import { Z as re } from "./zod-W_PvIofQ.js";
|
|
8
|
+
import { a as ie } from "./index-Di-kWSmf.js";
|
|
9
|
+
import { u as me } from "./app-wDQR6dpb.js";
|
|
10
|
+
import { R as de } from "./rule-builder-DJ-acvVD.js";
|
|
11
|
+
import { _ as ce } from "./ZodTextField.vue_vue_type_script_setup_true_lang-CWt4tVdk.js";
|
|
12
|
+
import { _ as ue } from "./RuleGroup.vue_vue_type_script_setup_true_lang-4zIO3oCr.js";
|
|
13
|
+
import { h as P } from "./moment-BWErdI6_.js";
|
|
14
|
+
import { u as pe, _ as fe } from "./usePagination-BeF5K3M7.js";
|
|
15
|
+
import { s as k } from "./membership-Ccrx9R6r.js";
|
|
16
|
+
import { o as ge } from "./objectId-dwaoBfJX.js";
|
|
17
|
+
import { u as ye } from "./business-dQh3AEot.js";
|
|
18
|
+
import { m as ve } from "./index-6FkKY3q0.js";
|
|
19
|
+
const _e = ie.extend({
|
|
20
|
+
_id: E.optional(),
|
|
21
|
+
business: E.optional()
|
|
22
|
+
}), he = { class: "space-y-16 pr-12" }, be = { class: "fm-typo-en-title-md-800" }, Se = { class: "flex space-x-8" }, xe = { class: "fm-typo-en-title-md-800 text-fm-color-primary" }, we = { class: "text-fm-color-typo-secondary" }, Fe = {
|
|
23
|
+
key: 0,
|
|
24
|
+
class: "w-full flex flex-col gap-16 items-center pt-16"
|
|
25
|
+
}, Ce = /* @__PURE__ */ A({
|
|
26
|
+
__name: "ReviewSegment",
|
|
27
|
+
props: {
|
|
28
|
+
title: {},
|
|
29
|
+
segment: {}
|
|
30
|
+
},
|
|
31
|
+
setup(D) {
|
|
32
|
+
const y = D, v = [
|
|
33
|
+
{
|
|
34
|
+
header: "Name",
|
|
35
|
+
accessorFn: (n) => n.name
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
header: "Customer Since",
|
|
39
|
+
accessorFn: (n) => P(ge(n._id.toString())).format("DD MMM YYYY")
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
header: "Birthday",
|
|
43
|
+
accessorFn: (n) => P(n.birthday).format("DD MMM YYYY")
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
header: "Last Visit",
|
|
47
|
+
accessorFn: (n) => P(n.stats.lastVisit).format("DD MMM YYYY")
|
|
48
|
+
}
|
|
49
|
+
], _ = async (n) => y.segment._id ? await k.paginateSegmentUsers(y.segment._id, {
|
|
50
|
+
limit: r.value.pageSize,
|
|
51
|
+
skip: n.pageIndex ?? 0,
|
|
52
|
+
sortBy: "_id",
|
|
53
|
+
search: n.searchValue,
|
|
54
|
+
descending: !0
|
|
55
|
+
}) : { resources: [], meta: { totalResources: 0, totalPages: 0 } }, { tableMeta: r, rowData: d, onSort: F, debouncedFetchData: i, onSearch: s } = pe(_);
|
|
56
|
+
return N(async () => {
|
|
57
|
+
await i();
|
|
58
|
+
}), (n, m) => (u(), b("div", he, [
|
|
59
|
+
a("div", be, x(y.title), 1),
|
|
60
|
+
a("div", Se, [
|
|
61
|
+
a("div", xe, x(n.segment.members.length), 1),
|
|
62
|
+
a("div", we, [
|
|
63
|
+
m[1] || (m[1] = a("div", null, "contacts in your segment", -1)),
|
|
64
|
+
a("div", null, "as of " + x(t(P)(n.segment.lastUpdated).format("DD MMM YYYY")), 1)
|
|
65
|
+
])
|
|
66
|
+
]),
|
|
67
|
+
l(fe, {
|
|
68
|
+
loading: t(r).isLoading,
|
|
69
|
+
"row-data": t(d),
|
|
70
|
+
"row-count": t(r).totalRows,
|
|
71
|
+
"column-defs": v,
|
|
72
|
+
"page-size": t(r).pageSize,
|
|
73
|
+
"page-count": t(r).pageCount,
|
|
74
|
+
"page-index": t(r).pageIndex,
|
|
75
|
+
onSortChange: t(F),
|
|
76
|
+
onPageChange: m[0] || (m[0] = (S) => t(i)({ pageSize: S.pageSize, pageIndex: S.pageIndex }))
|
|
77
|
+
}, null, 8, ["loading", "row-data", "row-count", "page-size", "page-count", "page-index", "onSortChange"]),
|
|
78
|
+
t(d).length == 0 ? (u(), b("div", Fe, m[2] || (m[2] = [
|
|
79
|
+
a("div", { class: "fm-typo-en-body-lg-600" }, "No data found", -1),
|
|
80
|
+
a("div", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " No data to show at the current moment. ", -1)
|
|
81
|
+
]))) : G("", !0)
|
|
82
|
+
]));
|
|
83
|
+
}
|
|
84
|
+
}), ke = { class: "flex items-center gap-x-8" }, Me = {
|
|
85
|
+
key: 0,
|
|
86
|
+
class: "space-y-16 pr-12"
|
|
87
|
+
}, Re = { class: "flex items-center gap-8" }, Ie = /* @__PURE__ */ A({
|
|
88
|
+
__name: "SegmentSheet",
|
|
89
|
+
emits: ["update:model-value"],
|
|
90
|
+
setup(D, { expose: y, emit: v }) {
|
|
91
|
+
const _ = me(), r = w(!1), d = w(!1), F = {
|
|
92
|
+
name: "",
|
|
93
|
+
rule: de.scaffoldGroup(),
|
|
94
|
+
members: []
|
|
95
|
+
}, i = _e, s = w(F), n = j(() => {
|
|
96
|
+
const o = i.safeParse(s.value);
|
|
97
|
+
return o.success ? [] : o.error.errors;
|
|
98
|
+
});
|
|
99
|
+
function m(o) {
|
|
100
|
+
r.value = !0, d.value = !1, o ? s.value = { ...o } : s.value = { ...F };
|
|
101
|
+
}
|
|
102
|
+
function S() {
|
|
103
|
+
r.value = !1;
|
|
104
|
+
}
|
|
105
|
+
async function $() {
|
|
106
|
+
i.safeParse(s.value).success && (d.value = !0);
|
|
107
|
+
}
|
|
108
|
+
function Y() {
|
|
109
|
+
d.value = !1;
|
|
110
|
+
}
|
|
111
|
+
async function C() {
|
|
112
|
+
z("update:model-value", s.value);
|
|
113
|
+
}
|
|
114
|
+
N(async () => {
|
|
115
|
+
});
|
|
116
|
+
const z = v;
|
|
117
|
+
return y({
|
|
118
|
+
showSheet: m,
|
|
119
|
+
hideSheet: S
|
|
120
|
+
}), (o, e) => {
|
|
121
|
+
const h = c("FmButton"), V = c("FmSideSheet");
|
|
122
|
+
return u(), B(V, {
|
|
123
|
+
modelValue: t(r),
|
|
124
|
+
"onUpdate:modelValue": e[5] || (e[5] = (p) => J(r) ? r.value = p : null),
|
|
125
|
+
header: "Add segment",
|
|
126
|
+
"dismiss-away": "",
|
|
127
|
+
"close-button": !0,
|
|
128
|
+
"max-width": 1100
|
|
129
|
+
}, W({
|
|
130
|
+
"side-sheet-footer": g(() => [
|
|
131
|
+
a("div", Re, [
|
|
132
|
+
t(d) ? (u(), b(I, { key: 0 }, [
|
|
133
|
+
l(h, {
|
|
134
|
+
label: "Save Segment",
|
|
135
|
+
onClick: C,
|
|
136
|
+
loading: t(_).isLoading,
|
|
137
|
+
disabled: t(n).length > 0 || t(_).isLoading
|
|
138
|
+
}, null, 8, ["loading", "disabled"]),
|
|
139
|
+
l(h, {
|
|
140
|
+
label: "Cancel",
|
|
141
|
+
onClick: e[3] || (e[3] = (p) => Y()),
|
|
142
|
+
variant: "tertiary"
|
|
143
|
+
})
|
|
144
|
+
], 64)) : (u(), b(I, { key: 1 }, [
|
|
145
|
+
l(h, {
|
|
146
|
+
label: "Review Segment",
|
|
147
|
+
disabled: t(n).length > 0 || t(_).isLoading,
|
|
148
|
+
onClick: $
|
|
149
|
+
}, null, 8, ["disabled"]),
|
|
150
|
+
l(h, {
|
|
151
|
+
label: "Cancel",
|
|
152
|
+
onClick: e[4] || (e[4] = (p) => S()),
|
|
153
|
+
variant: "tertiary"
|
|
154
|
+
})
|
|
155
|
+
], 64))
|
|
156
|
+
])
|
|
157
|
+
]),
|
|
158
|
+
default: g(() => {
|
|
159
|
+
var p;
|
|
160
|
+
return [
|
|
161
|
+
t(d) ? (u(), B(Ce, {
|
|
162
|
+
key: 1,
|
|
163
|
+
title: t(s).name,
|
|
164
|
+
segment: t(s)
|
|
165
|
+
}, null, 8, ["title", "segment"])) : (u(), b("div", Me, [
|
|
166
|
+
l(ce, {
|
|
167
|
+
modelValue: t(s).name,
|
|
168
|
+
"onUpdate:modelValue": e[1] || (e[1] = (M) => t(s).name = M),
|
|
169
|
+
label: "Segment title",
|
|
170
|
+
schema: t(re).typeAtPath(t(i), "name")
|
|
171
|
+
}, null, 8, ["modelValue", "schema"]),
|
|
172
|
+
e[7] || (e[7] = a("div", { class: "fm-typo-en-title-sm-800" }, "Segment Filter", -1)),
|
|
173
|
+
l(ue, {
|
|
174
|
+
"trigger-type": "MEMBERSHIP_JOINED",
|
|
175
|
+
includeOnly: "user",
|
|
176
|
+
"model-value": (p = t(s)) == null ? void 0 : p.rule,
|
|
177
|
+
"onUpdate:modelValue": e[2] || (e[2] = (M) => {
|
|
178
|
+
t(s).rule = M;
|
|
179
|
+
})
|
|
180
|
+
}, null, 8, ["model-value"])
|
|
181
|
+
]))
|
|
182
|
+
];
|
|
183
|
+
}),
|
|
184
|
+
_: 2
|
|
185
|
+
}, [
|
|
186
|
+
t(d) ? {
|
|
187
|
+
name: "side-sheet-header",
|
|
188
|
+
fn: g(() => [
|
|
189
|
+
a("div", ke, [
|
|
190
|
+
l(h, {
|
|
191
|
+
icon: "arrow_back",
|
|
192
|
+
variant: "tertiary",
|
|
193
|
+
onClick: e[0] || (e[0] = (p) => d.value = !1)
|
|
194
|
+
}),
|
|
195
|
+
e[6] || (e[6] = a("div", null, "Review segment", -1))
|
|
196
|
+
])
|
|
197
|
+
]),
|
|
198
|
+
key: "0"
|
|
199
|
+
} : void 0
|
|
200
|
+
]), 1032, ["modelValue"]);
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
}), $e = { class: "flex items-center" }, Ve = { class: "fm-typo-en-title-md-600 fm-step-title line-clamp-2 mr-8" }, Pe = { class: "px-24 flex flex-col gap-y-16" }, Be = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, De = { class: "fm-typo-en-body-md-600" }, Ye = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, et = /* @__PURE__ */ A({
|
|
204
|
+
__name: "Segment",
|
|
205
|
+
setup(D) {
|
|
206
|
+
const { minor: y } = ne, { t: v } = le(), _ = ye(), r = w(0), d = [
|
|
207
|
+
{
|
|
208
|
+
header: v("connect.loyalty.segment.table.name"),
|
|
209
|
+
accessorFn: (o) => o.name
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
header: v("connect.loyalty.segment.table.total_customers"),
|
|
213
|
+
accessorFn: (o) => o.memberCount ?? 0
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
header: v("connect.loyalty.segment.table.customer_percentage"),
|
|
217
|
+
accessorFn: (o) => ((o.memberCount ?? 0) * 100 / r.value).toFixed(2)
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
header: v("connect.loyalty.segment.table.actions"),
|
|
221
|
+
meta: {
|
|
222
|
+
maxWidth: "100px"
|
|
223
|
+
},
|
|
224
|
+
cell(o) {
|
|
225
|
+
return R("div", { class: "flex items-center justify-end" }, [
|
|
226
|
+
R(
|
|
227
|
+
L.FmMenu,
|
|
228
|
+
{
|
|
229
|
+
placement: "bottom-end",
|
|
230
|
+
onClick: (e) => {
|
|
231
|
+
e.stopPropagation();
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
"menu-button": () => R(L.FmButton, {
|
|
236
|
+
icon: "more_vert",
|
|
237
|
+
iconColor: "neutral-gray-400",
|
|
238
|
+
variant: "tertiary"
|
|
239
|
+
}),
|
|
240
|
+
default: () => [
|
|
241
|
+
R(
|
|
242
|
+
L.FmMenuItem,
|
|
243
|
+
{
|
|
244
|
+
onClick: async (e) => {
|
|
245
|
+
e.stopPropagation(), $(o.row.original);
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
label: R(
|
|
250
|
+
"div",
|
|
251
|
+
{
|
|
252
|
+
class: "text-fm-color-typo-error fm-typo-en-body-md-400"
|
|
253
|
+
},
|
|
254
|
+
"Remove"
|
|
255
|
+
)
|
|
256
|
+
}
|
|
257
|
+
)
|
|
258
|
+
]
|
|
259
|
+
}
|
|
260
|
+
)
|
|
261
|
+
]);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
], F = Q({ searchKey: "", columnFilters: [] }), i = w({
|
|
265
|
+
searchValue: "",
|
|
266
|
+
pageSize: 10,
|
|
267
|
+
pageCount: 0,
|
|
268
|
+
pageIndex: 0,
|
|
269
|
+
totalRows: 0,
|
|
270
|
+
isLoading: !1
|
|
271
|
+
}), s = w([]), n = w(null), m = async (o) => {
|
|
272
|
+
s.value = [], i.value.isLoading = !0;
|
|
273
|
+
const e = await k.readAll({
|
|
274
|
+
limit: o.pageSize,
|
|
275
|
+
skip: o.pageIndex ?? 0,
|
|
276
|
+
sortBy: "_id",
|
|
277
|
+
search: i.value.searchValue,
|
|
278
|
+
descending: !0
|
|
279
|
+
});
|
|
280
|
+
s.value = e.resources, i.value.totalRows = e.meta.totalResources ?? 0, i.value.pageCount = e.meta.totalPages ?? 0, i.value.isLoading = !1;
|
|
281
|
+
};
|
|
282
|
+
async function S() {
|
|
283
|
+
await y(
|
|
284
|
+
async () => {
|
|
285
|
+
await k.refreshSegments(), await m({ pageSize: 10, pageIndex: 0 });
|
|
286
|
+
},
|
|
287
|
+
{ message: "Refreshing segmentations" }
|
|
288
|
+
);
|
|
289
|
+
}
|
|
290
|
+
async function $(o) {
|
|
291
|
+
await ae.remove(`Are you sure you want to remove ${o.name}?`) && await y(
|
|
292
|
+
async () => {
|
|
293
|
+
await k.delete(o._id), await m({ pageSize: 10, pageIndex: 0 });
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
message: `Removing ${o.name}`,
|
|
297
|
+
successMessage: `Removed ${o.name} successfully`
|
|
298
|
+
}
|
|
299
|
+
);
|
|
300
|
+
}
|
|
301
|
+
async function Y(o) {
|
|
302
|
+
await y(
|
|
303
|
+
async () => {
|
|
304
|
+
var e;
|
|
305
|
+
if (o._id) {
|
|
306
|
+
const { members: h, _id: V, ...p } = o;
|
|
307
|
+
await k.update(o._id, p);
|
|
308
|
+
} else
|
|
309
|
+
await k.create(o);
|
|
310
|
+
await m({ pageSize: 10, pageIndex: 0 }), (e = n.value) == null || e.hideSheet();
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
message: "Saving segment",
|
|
314
|
+
successMessage: "Segment saved"
|
|
315
|
+
}
|
|
316
|
+
);
|
|
317
|
+
}
|
|
318
|
+
function C(o) {
|
|
319
|
+
var e;
|
|
320
|
+
(e = n.value) == null || e.showSheet(o);
|
|
321
|
+
}
|
|
322
|
+
const z = j(() => _.isPremium ? [
|
|
323
|
+
{
|
|
324
|
+
label: "Refresh segments",
|
|
325
|
+
value: "refresh"
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
label: "Add segment",
|
|
329
|
+
value: "add",
|
|
330
|
+
isPrimary: !0,
|
|
331
|
+
prependIcon: "add"
|
|
332
|
+
}
|
|
333
|
+
] : []);
|
|
334
|
+
return X(
|
|
335
|
+
() => i.value.searchValue,
|
|
336
|
+
se.debounce(() => {
|
|
337
|
+
m({ pageSize: 10, pageIndex: 0 });
|
|
338
|
+
}, 500)
|
|
339
|
+
), ee(async () => {
|
|
340
|
+
const { meta: o } = await ve.read({
|
|
341
|
+
limit: 1,
|
|
342
|
+
skip: 0,
|
|
343
|
+
sortBy: "_id",
|
|
344
|
+
search: i.value.searchValue,
|
|
345
|
+
descending: !1
|
|
346
|
+
});
|
|
347
|
+
r.value = o.totalResources ?? 0, await m({ pageSize: 10, pageIndex: 0 }), await _.readPremium();
|
|
348
|
+
}), (o, e) => {
|
|
349
|
+
const h = c("FmPill"), V = c("FmPageHead"), p = c("FmTable"), M = c("FmIcon"), H = c("FmMenuItem"), O = c("FmMenu"), T = c("FmListItem"), K = c("FmList"), Z = c("FmButton"), q = c("FmCard");
|
|
350
|
+
return u(), b(I, null, [
|
|
351
|
+
l(V, {
|
|
352
|
+
title: "Segments",
|
|
353
|
+
actions: t(z),
|
|
354
|
+
"onClick:action": e[0] || (e[0] = (f) => f === "add" ? C() : S())
|
|
355
|
+
}, {
|
|
356
|
+
title: g(() => [
|
|
357
|
+
a("div", $e, [
|
|
358
|
+
a("span", Ve, x(t(v)("connect.loyalty.segment.title")), 1),
|
|
359
|
+
l(h, { variant: "premium" })
|
|
360
|
+
])
|
|
361
|
+
]),
|
|
362
|
+
_: 1
|
|
363
|
+
}, 8, ["actions"]),
|
|
364
|
+
a("div", Pe, [
|
|
365
|
+
t(s).length > 0 || t(i).searchValue ? (u(), b(I, { key: 0 }, [
|
|
366
|
+
l(p, {
|
|
367
|
+
class: "xs:hidden",
|
|
368
|
+
"row-data": t(s),
|
|
369
|
+
"column-defs": d,
|
|
370
|
+
"search-value": t(F).searchKey,
|
|
371
|
+
"column-filter": [],
|
|
372
|
+
"hide-footer": !0,
|
|
373
|
+
onRowClick: e[1] || (e[1] = (f) => {
|
|
374
|
+
C(f.original);
|
|
375
|
+
})
|
|
376
|
+
}, null, 8, ["row-data", "search-value"]),
|
|
377
|
+
l(K, { class: "w-full hidden xs:block" }, {
|
|
378
|
+
default: g(() => [
|
|
379
|
+
(u(!0), b(I, null, te(t(s), (f) => (u(), B(T, {
|
|
380
|
+
key: f._id.toString(),
|
|
381
|
+
tag: "label",
|
|
382
|
+
onClick: (U) => C(f)
|
|
383
|
+
}, {
|
|
384
|
+
default: g(() => [
|
|
385
|
+
a("div", null, [
|
|
386
|
+
a("div", Be, x((f.memberCount ?? 0).toLocaleString()) + " total customers ", 1),
|
|
387
|
+
a("div", De, x(f.name), 1),
|
|
388
|
+
a("div", Ye, x(((f.memberCount ?? 0) * 100 / t(r)).toFixed(2)) + "% of customers ", 1)
|
|
389
|
+
])
|
|
390
|
+
]),
|
|
391
|
+
append: g(() => [
|
|
392
|
+
l(O, { "stop-click-propagation": !0 }, {
|
|
393
|
+
"menu-button": g(() => [
|
|
394
|
+
l(M, { name: "more_vert" })
|
|
395
|
+
]),
|
|
396
|
+
default: g(() => [
|
|
397
|
+
l(H, {
|
|
398
|
+
class: "text-fm-color-typo-error fm-typo-en-body-md-400",
|
|
399
|
+
label: "Remove",
|
|
400
|
+
"onUpdate:modelValue": (U) => U && $(f)
|
|
401
|
+
}, null, 8, ["onUpdate:modelValue"])
|
|
402
|
+
]),
|
|
403
|
+
_: 2
|
|
404
|
+
}, 1024)
|
|
405
|
+
]),
|
|
406
|
+
_: 2
|
|
407
|
+
}, 1032, ["onClick"]))), 128))
|
|
408
|
+
]),
|
|
409
|
+
_: 1
|
|
410
|
+
})
|
|
411
|
+
], 64)) : (u(), B(q, {
|
|
412
|
+
key: 1,
|
|
413
|
+
variant: "outlined",
|
|
414
|
+
class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
|
|
415
|
+
}, {
|
|
416
|
+
default: g(() => [
|
|
417
|
+
e[3] || (e[3] = a("img", {
|
|
418
|
+
src: oe,
|
|
419
|
+
class: "aspect-square w-[150px]"
|
|
420
|
+
}, null, -1)),
|
|
421
|
+
e[4] || (e[4] = a("div", { class: "flex flex-col gap-16 text-center" }, [
|
|
422
|
+
a("div", { class: "fm-typo-en-title-sm-800" }, "Create customer segments"),
|
|
423
|
+
a("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. ")
|
|
424
|
+
], -1)),
|
|
425
|
+
l(Z, {
|
|
426
|
+
variant: "primary",
|
|
427
|
+
label: "Create segment",
|
|
428
|
+
disabled: !t(_).isPremium,
|
|
429
|
+
icon: "add",
|
|
430
|
+
onClick: e[2] || (e[2] = (f) => C())
|
|
431
|
+
}, null, 8, ["disabled"])
|
|
432
|
+
]),
|
|
433
|
+
_: 1
|
|
434
|
+
})),
|
|
435
|
+
l(Ie, {
|
|
436
|
+
ref_key: "sheetRef",
|
|
437
|
+
ref: n,
|
|
438
|
+
"onUpdate:modelValue": Y
|
|
439
|
+
}, null, 512)
|
|
440
|
+
])
|
|
441
|
+
], 64);
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
});
|
|
445
|
+
export {
|
|
446
|
+
et as default
|
|
447
|
+
};
|