@feedmepos/mf-connect 0.1.46-prod → 0.1.48-prod
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Analytic--PTYdTCz.js → Analytic-DrjBaKmx.js} +113 -113
- package/dist/{App-CCFCux3P.js → App-eIaytGsZ.js} +632 -622
- package/dist/{Bin-D3mLTCYx.js → Bin-CVp0eFwl.js} +9 -9
- package/dist/{Broadcast-17Aiufxx.js → Broadcast-DBgBT6yz.js} +40 -40
- package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CMVquBaq.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CugJWeBo.js} +18 -18
- package/dist/{Card-Bx26e5ll.js → Card-DkP6oJVn.js} +239 -239
- package/dist/{Collections-B_lm_p0s.js → Collections-DYb_aeTW.js} +31 -31
- package/dist/{Credit-Bfdh01Hf.js → Credit-WVv_PL5D.js} +74 -74
- package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-DWNvRorl.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-Dt9c2kvf.js} +756 -753
- package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-CkYlghNU.js → EffectSheet.vue_vue_type_style_index_0_lang-DT3y4k1C.js} +96 -96
- package/dist/{Experience-DScp4H4M.js → Experience-BdH44wBG.js} +41 -41
- package/dist/{Game-Cn2BXwaA.js → Game-C7jxRESY.js} +31 -31
- package/dist/ImageInput.vue_vue_type_script_setup_true_lang-D1KQpDGg.js +144 -0
- package/dist/{Index-BATr5dcp.js → Index-DYr1p4sh.js} +54 -54
- package/dist/{Marketing-B6lhSaKk.js → Marketing-Djl27fez.js} +24 -24
- package/dist/{Member-Cr_Ehw_n.js → Member-CWXedfTG.js} +63 -63
- package/dist/MemberList-C2TvGi22.js +1606 -0
- package/dist/MemberOverview-wL_ailso.js +58 -0
- package/dist/{MemberTransactions-YlC-iE41.js → MemberTransactions-BSUocGg9.js} +1 -1
- package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-nTBRadZx.js → MessageInput.vue_vue_type_script_setup_true_lang-D8xPA6jM.js} +2287 -2221
- package/dist/{Mission-Bddme86f.js → Mission-BVx9Cqi5.js} +20 -20
- package/dist/{Overview-BGOM1IKg.js → Overview-DyXF9zfB.js} +337 -337
- package/dist/{Point-vcnTW6lY.js → Point-ovkgTwZO.js} +41 -41
- package/dist/{Promotion-DuCvytdc.js → Promotion-B0Q6GItP.js} +42 -42
- package/dist/{Queue-Cuw7WTP_.js → Queue-BAWG1Hh-.js} +12 -12
- package/dist/{Record-Dc6BPAGi.js → Record-CTp80g4A.js} +10 -10
- package/dist/{Reward-8MFxn8we.js → Reward-_Jow1lJ7.js} +173 -173
- package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-8k-usg9S.js → RewardGroup.vue_vue_type_script_setup_true_lang-BV8xCejA.js} +11 -11
- package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-DkDAuGY0.js +1763 -0
- package/dist/Segment-CsdJ1SjK.js +882 -0
- package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-B2LYvXlN.js → SelectItems.vue_vue_type_script_setup_true_lang-DH3oIm2t.js} +14 -14
- package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-CaFLnq7P.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-DvVrjpxR.js} +11 -11
- package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-DLAqn-0P.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-D5gV89Xk.js} +3 -3
- package/dist/Setting-BZRA50LO.js +1936 -0
- package/dist/{Store-DdBnVwnq.js → Store-CFnCN_7-.js} +238 -238
- package/dist/StoreRewards-B_McpBz-.js +423 -0
- package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-BPPoaGqc.js → StoreTransactions.vue_vue_type_script_setup_true_lang-vL0vr-Xn.js} +185 -185
- package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-D0ae_2E5.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-C1ZlLdme.js} +1 -1
- package/dist/{Tier-BpQ8DXK4.js → Tier-CCYFu6kJ.js} +106 -106
- package/dist/{Title-D6jghz1v.js → Title-7Mg-Ml4z.js} +95 -95
- package/dist/{Transaction-BQWs-6G7.js → Transaction-BqZrbpZi.js} +2 -2
- package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-C2dJuE64.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-C6ZwPUD4.js} +6 -6
- package/dist/{Voucher-DnL_66X2.js → Voucher-Yty_7SuS.js} +36 -36
- package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-Bt12t3gB.js +419 -0
- package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-yj2c4i_u.js → ZodTextField.vue_vue_type_script_setup_true_lang-C3NHrEIl.js} +1 -1
- package/dist/{app-Cemiie6P.js → app-2EJP4psh.js} +31 -31
- package/dist/app-Dzon--6x.js +57962 -0
- package/dist/app.js +1 -1
- package/dist/{business-BTJVFnrW.js → business-BehG4fR2.js} +1 -1
- package/dist/{campaign-XX6bwpYj.js → campaign-BpaiTG4f.js} +10 -10
- package/dist/{campaign-C34w0eci.js → campaign-CAcP56Sz.js} +2 -2
- package/dist/{campaign.enum-CTMwHgAV.js → campaign.enum-BWjI8Hop.js} +1 -1
- package/dist/{campaign.fn-nJl0vZum.js → campaign.fn-PVdB1-V1.js} +123 -123
- package/dist/{collectible.enum-DpJV0kLI.js → collectible.enum-BYmuqayi.js} +1 -1
- package/dist/{collection.fn-D5beOWlp.js → collection.fn-CbH8hbWW.js} +2 -2
- package/dist/{dto-CCxjvwZe.js → dto-Dd3Oc4QO.js} +4 -4
- package/dist/{effect-B9ryfTOn.js → effect-DvEQNEl0.js} +1 -1
- package/dist/{email-addresses-Bn80jSud.js → email-addresses-C-9JrAi8.js} +1 -1
- package/dist/{export-CLB408ho.js → export-RWE9Cn-d.js} +4 -4
- package/dist/{helper-DgoAVTVe.js → helper-Bl6LdWED.js} +1 -1
- package/dist/{index-D90Ba87K.js → index-1bU9cLqV.js} +1 -1
- package/dist/{index-DsgbkezN.js → index-BCQMVr1J.js} +1 -1
- package/dist/{index-Djq2lySj.js → index-Bgnrbk5x.js} +1 -1
- package/dist/{index-Blmkh0Ui.js → index-Bjf5Z2QE.js} +4 -4
- package/dist/{index-DUtQaOO2.js → index-CFW9ogow.js} +1 -1
- package/dist/{index-t_4aIo1w.js → index-CfgczUMX.js} +2 -2
- package/dist/{index-FMcRNPk_.js → index-CzCqc7ph.js} +1 -1
- package/dist/{index-B9wdSOIQ.js → index-DX1X6Owa.js} +1 -1
- package/dist/{index-KYo_FgI8.js → index-DZN5WWgq.js} +3 -3
- package/dist/{index-B2BKFdEy.js → index-DhUvELhc.js} +1023 -1023
- package/dist/{index-DCrV9spQ.js → index-DpoNuVc-.js} +6 -6
- package/dist/{index-JY8MjiBK.js → index-G_XSbrXB.js} +3 -3
- package/dist/{index-bkL81TwC.js → index-VVy4GPzJ.js} +1 -1
- package/dist/{index-eiHOH5QM.js → index-wOExBjGo.js} +1 -1
- package/dist/{index.esm2017-toVKAoKi.js → index.esm2017-DfgZFSqe.js} +1 -1
- package/dist/{loading-vrEcUlJa.js → loading-qlqqYGF3.js} +1 -1
- package/dist/{membership-ChiyKtoA.js → membership-Bh_1iu5v.js} +3 -3
- package/dist/{moment-BWErdI6_.js → moment-D7p2TMB-.js} +6 -1
- package/dist/{money-tOAuywfS.js → money-DvTB_Fek.js} +1 -1
- package/dist/{number-DiXSJR50.js → number-DJQ3gi1P.js} +1 -1
- package/dist/objectid-BKU0cEuv.js +145 -0
- package/dist/{plugins-p8ID0wqZ.js → plugins-DJpBrPbQ.js} +2 -2
- package/dist/{reward-Bo4HsVNH.js → reward-DZ4KlN9B.js} +1 -1
- package/dist/{rule-LDThYbT7.js → rule-DV0yCGlq.js} +4 -4
- package/dist/rule-builder-D6ihVPNO.js +93 -0
- package/dist/{template-C6cnCLah.js → template-ElP-JIFL.js} +63 -63
- package/dist/timezone-FaHjut_D.js +1150 -0
- package/dist/{trigger-ZyJEZVxL.js → trigger-D8wnJVTA.js} +4 -4
- package/dist/usePagination-Ds-cuHop.js +223 -0
- package/dist/{user-WDNaXiRu.js → user-NWV9KppR.js} +1 -1
- package/dist/{vue-i18n-BWI3POch.js → vue-i18n-CkbS-IDD.js} +157 -157
- package/dist/{xlsx-JDV04zZH.js → xlsx-CdQE5RZi.js} +226 -226
- package/package.json +5 -4
- package/dist/ImageInput.vue_vue_type_script_setup_true_lang-ByhTB9Ie.js +0 -144
- package/dist/MemberList-B5ogB2E6.js +0 -1606
- package/dist/MemberOverview-C2n9oJZh.js +0 -58
- package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-DRCwMmo5.js +0 -1752
- package/dist/Segment-BJm5XtlX.js +0 -882
- package/dist/Setting-CUyfrLYA.js +0 -1936
- package/dist/StoreRewards-B_yzVh4Z.js +0 -423
- package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-naUCARDO.js +0 -419
- package/dist/app-Cwax62X-.js +0 -33357
- package/dist/objectid-C856JGM4.js +0 -145
- package/dist/rule-builder-7iBcFApT.js +0 -89
- package/dist/usePagination-JoYaROkV.js +0 -223
|
@@ -0,0 +1,882 @@
|
|
|
1
|
+
import { defineComponent as ee, ref as z, resolveComponent as S, openBlock as m, createElementBlock as C, createElementVNode as l, createVNode as r, unref as t, createCommentVNode as le, withCtx as E, Fragment as O, renderList as ie, createBlock as J, toDisplayString as $, normalizeClass as re, onMounted as Se, computed as ce, isRef as Ie, createSlots as Me, h as Y, onBeforeMount as Te } from "vue";
|
|
2
|
+
import { _ as Ee } from "./campaign-CpzFl8Vr.js";
|
|
3
|
+
import { n as Ae, p as Re } from "./plugins-DJpBrPbQ.js";
|
|
4
|
+
import { u as De } from "./loading-qlqqYGF3.js";
|
|
5
|
+
import { FmButtonVariant as ae, useSnackbar as $e, components as X } from "@feedmepos/ui-library";
|
|
6
|
+
import { u as be, _ as we } from "./usePagination-Ds-cuHop.js";
|
|
7
|
+
import { u as Fe } from "./vue-i18n-CkbS-IDD.js";
|
|
8
|
+
import { i as Pe, j as D, c as fe } from "./index-Bjf5Z2QE.js";
|
|
9
|
+
import "./index-CfgczUMX.js";
|
|
10
|
+
import "./index-DpoNuVc-.js";
|
|
11
|
+
import "./index-CFW9ogow.js";
|
|
12
|
+
import "./index-DZN5WWgq.js";
|
|
13
|
+
import { u as ne, w as he } from "./xlsx-CdQE5RZi.js";
|
|
14
|
+
import { e as Ne, M as Be } from "./email-addresses-C-9JrAi8.js";
|
|
15
|
+
import { Z as Ve } from "./zod-Bg2FbC-D.js";
|
|
16
|
+
import { u as Ye } from "./app-wDQR6dpb.js";
|
|
17
|
+
import { F as ye, z as Ue } from "./index-DhUvELhc.js";
|
|
18
|
+
import { R as ge } from "./rule-builder-D6ihVPNO.js";
|
|
19
|
+
import { _ as Le } from "./ZodTextField.vue_vue_type_script_setup_true_lang-C3NHrEIl.js";
|
|
20
|
+
import { _ as ze } from "./RuleGroup.vue_vue_type_script_setup_true_lang-DkDAuGY0.js";
|
|
21
|
+
import { u as Oe, v as je, w as qe } from "./index.esm2017-DfgZFSqe.js";
|
|
22
|
+
import { F as He } from "./FileSaver.min-NlMItPOc.js";
|
|
23
|
+
import { h as G } from "./moment-D7p2TMB-.js";
|
|
24
|
+
import { s as N, u as Ge } from "./membership-Bh_1iu5v.js";
|
|
25
|
+
import { o as Je } from "./objectId-dwaoBfJX.js";
|
|
26
|
+
import { u as ke } from "./business-BehG4fR2.js";
|
|
27
|
+
import { f as Qe } from "./number-DJQ3gi1P.js";
|
|
28
|
+
import { t as We } from "./money-DvTB_Fek.js";
|
|
29
|
+
import "./index-1bU9cLqV.js";
|
|
30
|
+
import { useRouter as Ke } from "vue-router";
|
|
31
|
+
import { m as ve } from "./index-CzCqc7ph.js";
|
|
32
|
+
import { R as _e } from "./app-2EJP4psh.js";
|
|
33
|
+
const Ze = Pe.extend({
|
|
34
|
+
_id: ye.optional(),
|
|
35
|
+
business: ye.optional(),
|
|
36
|
+
file: Ue.any().nullish()
|
|
37
|
+
});
|
|
38
|
+
var Xe = { firebase: { apiKey: "AIzaSyA_isPR1-9bX7UmRiJIhsIRNNwdn6DdmW4", authDomain: "feedme-253402.firebaseapp.com", databaseURL: "https://feedme-253402.firebaseio.com", projectId: "feedme-253402", storageBucket: "image.feedme.cc", messagingSenderId: "128512026847", appId: "1:128512026847:web:7c5c8ab7e8b90502dc616a", measurementId: "G-LTKS7N2HQS" }, assetBucketUrl: "static.feedme.cc", importFilesBucketUrl: "feedme-253402.appspot.com", clientId: "d5f8840d63dbb758b6c4ee2a5e8b013d15dd25e242c457481326062b83962476" };
|
|
39
|
+
const et = { class: "flex flex-col space-y-16" }, tt = {
|
|
40
|
+
key: 0,
|
|
41
|
+
class: /* @__PURE__ */ re([
|
|
42
|
+
"p-16 pl-24 space-x-8",
|
|
43
|
+
"bg-fm-color-primary-oats rounded-lg",
|
|
44
|
+
"flex items-center",
|
|
45
|
+
"justify-between"
|
|
46
|
+
])
|
|
47
|
+
}, ot = { class: "flex justify-end" }, at = {
|
|
48
|
+
key: 1,
|
|
49
|
+
class: /* @__PURE__ */ re([
|
|
50
|
+
"flex items-center",
|
|
51
|
+
"border border-fm-color-neutral-gray-300",
|
|
52
|
+
"p-16 space-x-16 rounded-md"
|
|
53
|
+
])
|
|
54
|
+
}, nt = { class: "fm-typo-en-body-lg-400 flex-1 truncate" }, st = /* @__PURE__ */ ee({
|
|
55
|
+
__name: "ImportSegment",
|
|
56
|
+
props: {
|
|
57
|
+
importFile: {}
|
|
58
|
+
},
|
|
59
|
+
emits: ["update:file"],
|
|
60
|
+
setup(e, { emit: v }) {
|
|
61
|
+
const _ = e, k = v, { t: p } = Fe(), f = z(null), b = z(null), w = ["Id"], n = [
|
|
62
|
+
{
|
|
63
|
+
label: "CSV",
|
|
64
|
+
icon: "csv",
|
|
65
|
+
value: "csv"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
label: "Excel",
|
|
69
|
+
icon: "description",
|
|
70
|
+
value: "xlsx"
|
|
71
|
+
}
|
|
72
|
+
];
|
|
73
|
+
async function i() {
|
|
74
|
+
if (_.importFile)
|
|
75
|
+
try {
|
|
76
|
+
const h = Oe(void 0, Xe.importFilesBucketUrl), y = je(h, _.importFile), x = await qe(y);
|
|
77
|
+
window.open(x, "_blank");
|
|
78
|
+
} catch (h) {
|
|
79
|
+
console.log(h), Ae.error("Failed to download uploaded file");
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
async function c(h) {
|
|
83
|
+
switch (h) {
|
|
84
|
+
case "csv":
|
|
85
|
+
const y = new Blob([w.join(",")], {
|
|
86
|
+
type: "text/csv;charset=utf-8;"
|
|
87
|
+
});
|
|
88
|
+
He.saveAs(y, "ImportSegmentTemplate.csv");
|
|
89
|
+
break;
|
|
90
|
+
case "xlsx":
|
|
91
|
+
const x = ne.aoa_to_sheet([w]), I = ne.book_new();
|
|
92
|
+
ne.book_append_sheet(I, x, "Sheet1"), he(I, "ImportSegmentTemplate.xlsx");
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function F(h) {
|
|
97
|
+
f.value = h, k("update:file", f.value);
|
|
98
|
+
}
|
|
99
|
+
function A(h) {
|
|
100
|
+
var x, I;
|
|
101
|
+
const y = ((I = (x = h.target) == null ? void 0 : x.files) == null ? void 0 : I[0]) ?? null;
|
|
102
|
+
F(y);
|
|
103
|
+
}
|
|
104
|
+
return (h, y) => {
|
|
105
|
+
const x = S("FmButton"), I = S("FmMenuItem"), d = S("FmMenu"), s = S("FmDropField");
|
|
106
|
+
return m(), C("div", et, [
|
|
107
|
+
y[2] || (y[2] = l("div", { class: "fm-typo-en-title-sm-800" }, "Upload File", -1)),
|
|
108
|
+
e.importFile ? (m(), C("div", tt, [
|
|
109
|
+
r(x, {
|
|
110
|
+
label: t(p)("View uploaded file"),
|
|
111
|
+
variant: t(ae).Plain,
|
|
112
|
+
icon: "file_present",
|
|
113
|
+
onClick: i
|
|
114
|
+
}, null, 8, ["label", "variant"])
|
|
115
|
+
])) : le("", !0),
|
|
116
|
+
l("div", null, [
|
|
117
|
+
l("div", ot, [
|
|
118
|
+
r(d, { class: "" }, {
|
|
119
|
+
"menu-button": E(() => [
|
|
120
|
+
r(x, {
|
|
121
|
+
variant: "tertiary",
|
|
122
|
+
icon: "download",
|
|
123
|
+
label: "Download Template"
|
|
124
|
+
})
|
|
125
|
+
]),
|
|
126
|
+
default: E(() => [
|
|
127
|
+
(m(), C(O, null, ie(n, (g) => r(I, {
|
|
128
|
+
key: g.value,
|
|
129
|
+
icon: g.icon,
|
|
130
|
+
label: g.label,
|
|
131
|
+
onClick: (U) => c(g.value),
|
|
132
|
+
selectable: ""
|
|
133
|
+
}, null, 8, ["icon", "label", "onClick"])), 64))
|
|
134
|
+
]),
|
|
135
|
+
_: 1
|
|
136
|
+
})
|
|
137
|
+
]),
|
|
138
|
+
f.value ? (m(), C("div", at, [
|
|
139
|
+
r(x, {
|
|
140
|
+
variant: t(ae).Tertiary,
|
|
141
|
+
"prepend-icon": "attach_file"
|
|
142
|
+
}, null, 8, ["variant"]),
|
|
143
|
+
l("p", nt, $(f.value.name), 1),
|
|
144
|
+
l("label", {
|
|
145
|
+
ref_key: "fileLabelRef",
|
|
146
|
+
ref: b,
|
|
147
|
+
htmlFor: "file"
|
|
148
|
+
}, [
|
|
149
|
+
r(x, {
|
|
150
|
+
variant: t(ae).Plain,
|
|
151
|
+
label: t(p)("Replace File"),
|
|
152
|
+
onClick: y[1] || (y[1] = () => {
|
|
153
|
+
var g;
|
|
154
|
+
return (g = b.value) == null ? void 0 : g.click();
|
|
155
|
+
})
|
|
156
|
+
}, null, 8, ["variant", "label"]),
|
|
157
|
+
l("input", {
|
|
158
|
+
id: "file",
|
|
159
|
+
accept: ".csv",
|
|
160
|
+
class: "hidden",
|
|
161
|
+
type: "file",
|
|
162
|
+
multiple: "",
|
|
163
|
+
onChange: A
|
|
164
|
+
}, null, 32)
|
|
165
|
+
], 512)
|
|
166
|
+
])) : (m(), J(s, {
|
|
167
|
+
key: 0,
|
|
168
|
+
onFileUpload: y[0] || (y[0] = (g) => F(g)),
|
|
169
|
+
accept: ".csv, .xlsx",
|
|
170
|
+
"max-file-size": 2e7
|
|
171
|
+
}))
|
|
172
|
+
])
|
|
173
|
+
]);
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
}), lt = { class: "space-y-16 pr-12" }, it = { class: "fm-typo-en-title-md-800" }, rt = { class: "flex space-x-8" }, ct = { class: "fm-typo-en-title-md-800 text-fm-color-primary" }, dt = { class: "text-fm-color-typo-secondary" }, ut = /* @__PURE__ */ ee({
|
|
177
|
+
__name: "ReviewSegment",
|
|
178
|
+
props: {
|
|
179
|
+
title: {},
|
|
180
|
+
segment: {}
|
|
181
|
+
},
|
|
182
|
+
setup(e) {
|
|
183
|
+
const v = e, _ = [
|
|
184
|
+
{
|
|
185
|
+
header: "Name",
|
|
186
|
+
accessorFn: (i) => i.name
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
header: "Id",
|
|
190
|
+
accessorFn: (i) => i._id
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
header: "Customer Since",
|
|
194
|
+
accessorFn: (i) => G(Je(i._id.toString())).format("DD MMM YYYY")
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
header: "Phone",
|
|
198
|
+
accessorFn: (i) => i.phoneNumber
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
header: "Birthday",
|
|
202
|
+
accessorFn: (i) => G(i.birthday).format("DD MMM YYYY")
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
header: "Last Visit",
|
|
206
|
+
accessorFn: (i) => G(i.stats.lastVisit).format("DD MMM YYYY")
|
|
207
|
+
}
|
|
208
|
+
];
|
|
209
|
+
async function k(i) {
|
|
210
|
+
return v.segment._id ? (console.log(i), await N.paginateSegmentUsers(
|
|
211
|
+
v.segment._id,
|
|
212
|
+
i
|
|
213
|
+
)) : {
|
|
214
|
+
resources: [],
|
|
215
|
+
meta: {
|
|
216
|
+
totalResources: 0,
|
|
217
|
+
totalPages: 0,
|
|
218
|
+
skip: i.skip,
|
|
219
|
+
limit: i.limit,
|
|
220
|
+
sortBy: i.sortBy
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
const { tableMeta: p, rowData: f, onSort: b, debouncedFetchData: w, onSearch: n } = be(k);
|
|
225
|
+
return Se(async () => {
|
|
226
|
+
await w();
|
|
227
|
+
}), (i, c) => (m(), C("div", lt, [
|
|
228
|
+
l("div", it, $(v.title), 1),
|
|
229
|
+
l("div", rt, [
|
|
230
|
+
l("div", ct, $(e.segment.members.length), 1),
|
|
231
|
+
l("div", dt, [
|
|
232
|
+
c[1] || (c[1] = l("div", null, "contacts in your segment", -1)),
|
|
233
|
+
l("div", null, "as of " + $(t(G)(e.segment.lastUpdated).format("DD MMM YYYY")), 1)
|
|
234
|
+
])
|
|
235
|
+
]),
|
|
236
|
+
r(we, {
|
|
237
|
+
loading: t(p).isLoading,
|
|
238
|
+
"row-data": t(f),
|
|
239
|
+
"row-count": t(p).totalRows,
|
|
240
|
+
"column-defs": _,
|
|
241
|
+
"page-size": t(p).pageSize,
|
|
242
|
+
"page-count": t(p).pageCount,
|
|
243
|
+
"page-index": t(p).pageIndex,
|
|
244
|
+
onSortChange: t(b),
|
|
245
|
+
onPageChange: c[0] || (c[0] = (F) => t(w)({ pageSize: F.pageSize, pageIndex: F.pageIndex }))
|
|
246
|
+
}, null, 8, ["loading", "row-data", "row-count", "page-size", "page-count", "page-index", "onSortChange"])
|
|
247
|
+
]));
|
|
248
|
+
}
|
|
249
|
+
}), mt = { class: "space-y-24" }, pt = { class: "grid grid-cols-2 gap-16" }, ft = { class: "fm-typo-en-title-sm-800" }, yt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, gt = /* @__PURE__ */ ee({
|
|
250
|
+
__name: "SegmentTypeOption",
|
|
251
|
+
props: {
|
|
252
|
+
modelValue: {},
|
|
253
|
+
errorText: {}
|
|
254
|
+
},
|
|
255
|
+
emits: ["update:model-value"],
|
|
256
|
+
setup(e, { emit: v }) {
|
|
257
|
+
const _ = e, k = v, p = [
|
|
258
|
+
{
|
|
259
|
+
label: "Dynamic",
|
|
260
|
+
sublabel: "Segment statistics are based on rules configured and will be recalculated automatically when rule changes.",
|
|
261
|
+
value: D.enum.DYNAMIC
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
label: "Static",
|
|
265
|
+
sublabel: "Segment statistics are based on imported data and will not be recalculated.",
|
|
266
|
+
value: D.enum.STATIC
|
|
267
|
+
}
|
|
268
|
+
];
|
|
269
|
+
function f(b) {
|
|
270
|
+
b !== _.modelValue && k("update:model-value", b);
|
|
271
|
+
}
|
|
272
|
+
return (b, w) => {
|
|
273
|
+
const n = S("FmCard"), i = S("FmHelperText");
|
|
274
|
+
return m(), C("div", mt, [
|
|
275
|
+
l("div", pt, [
|
|
276
|
+
(m(), C(O, null, ie(p, (c) => r(n, {
|
|
277
|
+
variant: "outlined",
|
|
278
|
+
class: re(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-2", {
|
|
279
|
+
"col-span-2": p.length == 1,
|
|
280
|
+
"border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": e.modelValue === c.value,
|
|
281
|
+
"hover:bg-fm-color-opacity-sm": e.modelValue !== c.value
|
|
282
|
+
}]),
|
|
283
|
+
onClick: (F) => f(c.value),
|
|
284
|
+
key: c.value
|
|
285
|
+
}, {
|
|
286
|
+
default: E(() => [
|
|
287
|
+
l("div", ft, $(c.label), 1),
|
|
288
|
+
l("div", yt, $(c.sublabel), 1)
|
|
289
|
+
]),
|
|
290
|
+
_: 2
|
|
291
|
+
}, 1032, ["class", "onClick"])), 64))
|
|
292
|
+
]),
|
|
293
|
+
e.errorText ? (m(), J(i, {
|
|
294
|
+
key: 0,
|
|
295
|
+
class: "!mt-4",
|
|
296
|
+
text: e.errorText,
|
|
297
|
+
state: "error"
|
|
298
|
+
}, null, 8, ["text"])) : le("", !0)
|
|
299
|
+
]);
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
}), vt = { class: "flex items-center gap-x-8" }, _t = {
|
|
303
|
+
key: 0,
|
|
304
|
+
class: "space-y-16 pr-12"
|
|
305
|
+
}, xt = { class: "flex flex-col space-y-16" }, St = {
|
|
306
|
+
key: 0,
|
|
307
|
+
class: "flex flex-col space-y-16"
|
|
308
|
+
}, bt = {
|
|
309
|
+
key: 1,
|
|
310
|
+
class: "flex flex-col space-y-16"
|
|
311
|
+
}, wt = {
|
|
312
|
+
key: 2,
|
|
313
|
+
class: "flex flex-col space-y-16"
|
|
314
|
+
}, Ft = { class: "flex items-center gap-8" }, ht = /* @__PURE__ */ ee({
|
|
315
|
+
__name: "SegmentSheet",
|
|
316
|
+
emits: ["update:model-value"],
|
|
317
|
+
setup(e, { expose: v, emit: _ }) {
|
|
318
|
+
const k = Ye(), p = z(!1), f = z(!1), b = {
|
|
319
|
+
name: "",
|
|
320
|
+
isActive: !0,
|
|
321
|
+
type: D.enum.DYNAMIC,
|
|
322
|
+
rule: ge.scaffoldGroup(),
|
|
323
|
+
members: []
|
|
324
|
+
}, w = Ze, n = z(b), i = ce(() => {
|
|
325
|
+
const d = w.safeParse(n.value);
|
|
326
|
+
return d.success ? [] : d.error.errors;
|
|
327
|
+
});
|
|
328
|
+
function c(d) {
|
|
329
|
+
p.value = !0, f.value = !1, d ? n.value = {
|
|
330
|
+
...d,
|
|
331
|
+
isActive: d.isActive !== !1,
|
|
332
|
+
type: d.type ?? (d.importFile ? D.enum.STATIC : D.enum.DYNAMIC)
|
|
333
|
+
} : n.value = { ...b };
|
|
334
|
+
}
|
|
335
|
+
function F() {
|
|
336
|
+
p.value = !1;
|
|
337
|
+
}
|
|
338
|
+
async function A() {
|
|
339
|
+
w.safeParse(n.value).success && (f.value = !0);
|
|
340
|
+
}
|
|
341
|
+
function h(d) {
|
|
342
|
+
d === D.enum.STATIC ? F() : f.value = !1;
|
|
343
|
+
}
|
|
344
|
+
async function y() {
|
|
345
|
+
n.value.type === D.enum.STATIC ? (n.value.rule = ge.scaffoldGroup(), n.value.isActive = !0) : n.value.file = void 0, I("update:model-value", n.value);
|
|
346
|
+
}
|
|
347
|
+
async function x(d) {
|
|
348
|
+
n.value.type = d;
|
|
349
|
+
}
|
|
350
|
+
Se(async () => {
|
|
351
|
+
});
|
|
352
|
+
const I = _;
|
|
353
|
+
return v({
|
|
354
|
+
showSheet: c,
|
|
355
|
+
hideSheet: F
|
|
356
|
+
}), (d, s) => {
|
|
357
|
+
const g = S("FmButton"), U = S("FmSwitch"), a = S("FmSideSheet");
|
|
358
|
+
return m(), J(a, {
|
|
359
|
+
modelValue: t(p),
|
|
360
|
+
"onUpdate:modelValue": s[8] || (s[8] = (o) => Ie(p) ? p.value = o : null),
|
|
361
|
+
header: "Add segment",
|
|
362
|
+
"dismiss-away": "",
|
|
363
|
+
"close-button": !0,
|
|
364
|
+
"max-width": 1100
|
|
365
|
+
}, Me({
|
|
366
|
+
"side-sheet-footer": E(() => [
|
|
367
|
+
l("div", Ft, [
|
|
368
|
+
t(f) || t(n).type === t(D).enum.STATIC ? (m(), C(O, { key: 0 }, [
|
|
369
|
+
r(g, {
|
|
370
|
+
label: "Save Segment",
|
|
371
|
+
onClick: y,
|
|
372
|
+
loading: t(k).isLoading,
|
|
373
|
+
disabled: t(i).length > 0 || t(k).isLoading
|
|
374
|
+
}, null, 8, ["loading", "disabled"]),
|
|
375
|
+
r(g, {
|
|
376
|
+
label: "Cancel",
|
|
377
|
+
onClick: s[6] || (s[6] = (o) => h(t(n).type)),
|
|
378
|
+
variant: "tertiary"
|
|
379
|
+
})
|
|
380
|
+
], 64)) : (m(), C(O, { key: 1 }, [
|
|
381
|
+
r(g, {
|
|
382
|
+
label: "Review Segment",
|
|
383
|
+
disabled: t(i).length > 0 || t(k).isLoading,
|
|
384
|
+
onClick: A
|
|
385
|
+
}, null, 8, ["disabled"]),
|
|
386
|
+
r(g, {
|
|
387
|
+
label: "Cancel",
|
|
388
|
+
onClick: s[7] || (s[7] = (o) => F()),
|
|
389
|
+
variant: "tertiary"
|
|
390
|
+
})
|
|
391
|
+
], 64))
|
|
392
|
+
])
|
|
393
|
+
]),
|
|
394
|
+
default: E(() => {
|
|
395
|
+
var o;
|
|
396
|
+
return [
|
|
397
|
+
t(f) ? (m(), J(ut, {
|
|
398
|
+
key: 1,
|
|
399
|
+
title: t(n).name,
|
|
400
|
+
segment: t(n)
|
|
401
|
+
}, null, 8, ["title", "segment"])) : (m(), C("div", _t, [
|
|
402
|
+
r(Le, {
|
|
403
|
+
modelValue: t(n).name,
|
|
404
|
+
"onUpdate:modelValue": s[1] || (s[1] = (u) => t(n).name = u),
|
|
405
|
+
label: "Segment title",
|
|
406
|
+
schema: t(Ve).typeAtPath(t(w), "name")
|
|
407
|
+
}, null, 8, ["modelValue", "schema"]),
|
|
408
|
+
l("div", xt, [
|
|
409
|
+
s[10] || (s[10] = l("div", { class: "fm-typo-en-title-sm-800" }, "Segment Type", -1)),
|
|
410
|
+
r(gt, {
|
|
411
|
+
"model-value": t(n).type,
|
|
412
|
+
"onUpdate:modelValue": s[2] || (s[2] = (u) => {
|
|
413
|
+
x(u);
|
|
414
|
+
})
|
|
415
|
+
}, null, 8, ["model-value"])
|
|
416
|
+
]),
|
|
417
|
+
t(n).type === t(D).enum.DYNAMIC ? (m(), C("div", St, [
|
|
418
|
+
s[11] || (s[11] = l("div", { class: "fm-typo-en-title-sm-800" }, "Segment Filter", -1)),
|
|
419
|
+
r(ze, {
|
|
420
|
+
"trigger-type": "MEMBERSHIP_JOINED",
|
|
421
|
+
includeOnly: "user",
|
|
422
|
+
"model-value": (o = t(n)) == null ? void 0 : o.rule,
|
|
423
|
+
"onUpdate:modelValue": s[3] || (s[3] = (u) => {
|
|
424
|
+
t(n).rule = u;
|
|
425
|
+
})
|
|
426
|
+
}, null, 8, ["model-value"])
|
|
427
|
+
])) : (m(), C("div", bt, [
|
|
428
|
+
r(st, {
|
|
429
|
+
importFile: t(n).importFile,
|
|
430
|
+
"onUpdate:file": s[4] || (s[4] = (u) => {
|
|
431
|
+
t(n).file = u;
|
|
432
|
+
})
|
|
433
|
+
}, null, 8, ["importFile"])
|
|
434
|
+
])),
|
|
435
|
+
t(n).type === t(D).enum.DYNAMIC ? (m(), C("div", wt, [
|
|
436
|
+
s[12] || (s[12] = l("div", { class: "fm-typo-en-title-sm-800" }, "Segment Status", -1)),
|
|
437
|
+
r(U, {
|
|
438
|
+
"model-value": t(n).isActive ?? !0,
|
|
439
|
+
"onUpdate:modelValue": s[5] || (s[5] = (u) => t(n).isActive = u),
|
|
440
|
+
label: "Active",
|
|
441
|
+
sublabel: "When enabled, this will recalculate the segment statistics daily.",
|
|
442
|
+
"label-placement": "right"
|
|
443
|
+
}, null, 8, ["model-value"])
|
|
444
|
+
])) : le("", !0)
|
|
445
|
+
]))
|
|
446
|
+
];
|
|
447
|
+
}),
|
|
448
|
+
_: 2
|
|
449
|
+
}, [
|
|
450
|
+
t(f) ? {
|
|
451
|
+
name: "side-sheet-header",
|
|
452
|
+
fn: E(() => [
|
|
453
|
+
l("div", vt, [
|
|
454
|
+
r(g, {
|
|
455
|
+
icon: "arrow_back",
|
|
456
|
+
variant: "tertiary",
|
|
457
|
+
onClick: s[0] || (s[0] = (o) => f.value = !1)
|
|
458
|
+
}),
|
|
459
|
+
s[9] || (s[9] = l("div", null, "Review segment", -1))
|
|
460
|
+
])
|
|
461
|
+
]),
|
|
462
|
+
key: "0"
|
|
463
|
+
} : void 0
|
|
464
|
+
]), 1032, ["modelValue"]);
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
}), xe = Ge(), kt = ke();
|
|
468
|
+
function se(e) {
|
|
469
|
+
const v = G(e);
|
|
470
|
+
return v.isValid() ? v.format("DD/MM/YYYY") : "";
|
|
471
|
+
}
|
|
472
|
+
const Ct = {
|
|
473
|
+
mapMemberExportRow: (e) => {
|
|
474
|
+
var i, c, F, A, h, y, x, I, d, s, g, U, a, o, u, P, R, B, V, j, q, H, te, M, Q, de, ue, me;
|
|
475
|
+
const v = ce(() => kt.locations.map((T) => ({
|
|
476
|
+
label: T.name,
|
|
477
|
+
value: T._id
|
|
478
|
+
}))), _ = (i = Ne.parseOneAddress(
|
|
479
|
+
e == null ? void 0 : e.email
|
|
480
|
+
)) != null && i.domain.includes("feedmepos.com") ? void 0 : e.email, k = (F = ((c = e == null ? void 0 : e.collection) == null ? void 0 : c.TITLE) || []) == null ? void 0 : F.reduce(
|
|
481
|
+
(T, L) => {
|
|
482
|
+
var K, Z;
|
|
483
|
+
const W = (Z = (K = xe.sortedTitles) == null ? void 0 : K.find(
|
|
484
|
+
(oe) => oe._id === L.collectible
|
|
485
|
+
)) == null ? void 0 : Z.name;
|
|
486
|
+
return !W || L.balance <= 0 || T.push(W), T;
|
|
487
|
+
},
|
|
488
|
+
[]
|
|
489
|
+
), p = (xe.sortedTitles || []).reduce(
|
|
490
|
+
(T, L) => {
|
|
491
|
+
var K, Z, oe, pe;
|
|
492
|
+
const W = (pe = (oe = (Z = (((K = e == null ? void 0 : e.collection) == null ? void 0 : K.TITLE) || []).find(
|
|
493
|
+
(Ce) => Ce.collectible === L._id
|
|
494
|
+
)) == null ? void 0 : Z.expiryBalance) == null ? void 0 : oe[0]) == null ? void 0 : pe.expiredAt;
|
|
495
|
+
return T[L.name] = W ? G(W).format("DD/MM/YYYY") : "", T;
|
|
496
|
+
},
|
|
497
|
+
{}
|
|
498
|
+
), f = ((y = (h = (A = e.collection) == null ? void 0 : A.CREDIT) == null ? void 0 : h.at(0)) == null ? void 0 : y.balance) || 0, b = ((s = (d = (I = (x = e.collection) == null ? void 0 : x.CREDIT) == null ? void 0 : I.at(0)) == null ? void 0 : d.expiryBalance) == null ? void 0 : s.reduce(
|
|
499
|
+
(T, L) => T + L.amount,
|
|
500
|
+
0
|
|
501
|
+
)) || 0, w = Qe(f, 2);
|
|
502
|
+
return {
|
|
503
|
+
ID: e._id.toString(),
|
|
504
|
+
Name: ((g = e.name) == null ? void 0 : g.trim()) || "",
|
|
505
|
+
Phone: ((U = e == null ? void 0 : e.phoneNumber) == null ? void 0 : U.trim()) || "",
|
|
506
|
+
Email: _ || "",
|
|
507
|
+
Gender: e.gender || "",
|
|
508
|
+
CardNo: e.cardNo || "",
|
|
509
|
+
Birthday: e != null && e.birthday ? se(e == null ? void 0 : e.birthday) : "",
|
|
510
|
+
Credit: parseFloat((Number(w) - Number(b)).toFixed(2)),
|
|
511
|
+
FreeCredit: Number(b.toFixed(2)),
|
|
512
|
+
TotalCredit: Number(w),
|
|
513
|
+
Exp: e != null && e.collection ? ((u = (o = (a = e.collection) == null ? void 0 : a.POINT) == null ? void 0 : o.at(0)) == null ? void 0 : u.balance) ?? 0 : 0,
|
|
514
|
+
Point: e != null && e.collection ? ((B = (R = (P = e.collection) == null ? void 0 : P.COIN) == null ? void 0 : R.at(0)) == null ? void 0 : B.balance) ?? 0 : 0,
|
|
515
|
+
Level: e != null && e.collection ? ((q = (j = (V = e.collection) == null ? void 0 : V.TIER) == null ? void 0 : j.at(0)) == null ? void 0 : q.balance) ?? 0 : 0,
|
|
516
|
+
Tier: e != null && e.collection ? ((M = (te = (H = e.collection) == null ? void 0 : H.TIER) == null ? void 0 : te.at(0)) == null ? void 0 : M.balance) ?? 0 : 0,
|
|
517
|
+
Titles: k.join(","),
|
|
518
|
+
...p,
|
|
519
|
+
TotalTransaction: e.stats.visitCount,
|
|
520
|
+
AvgSpent: We(Number(e.stats.avgBillSize || 0)).toFormat(
|
|
521
|
+
!1
|
|
522
|
+
),
|
|
523
|
+
TotalSpent: e.stats.avgBillSize * e.stats.visitCount,
|
|
524
|
+
LastVisit: se(e.stats.lastVisit),
|
|
525
|
+
Feedback: ((Q = e.stats) == null ? void 0 : Q.feedbackCount) || 0,
|
|
526
|
+
LastSeasonTierEarned: ((de = e.stats) == null ? void 0 : de.lastSeasonTierEarned) || 0,
|
|
527
|
+
LastSeasonPointEarned: ((ue = e.stats) == null ? void 0 : ue.lastSeasonPointEarned) || 0,
|
|
528
|
+
JoinedAt: se(e.joinAt || void 0),
|
|
529
|
+
JoinedAtLocation: e.location && ((me = v.value.find((T) => T.value == e.location)) == null ? void 0 : me.label) || "-",
|
|
530
|
+
VisitFrequency: `${Number(
|
|
531
|
+
Math.ceil(e.stats.avgVisitFrequency).toFixed(0)
|
|
532
|
+
)}`
|
|
533
|
+
};
|
|
534
|
+
}
|
|
535
|
+
}, It = { class: "flex items-center" }, Mt = { class: "fm-typo-en-title-md-600 fm-step-title line-clamp-2 mr-8" }, Tt = { class: "px-24 flex flex-col gap-y-16" }, Et = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, At = { class: "fm-typo-en-body-md-600" }, Rt = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, mo = /* @__PURE__ */ ee({
|
|
536
|
+
__name: "Segment",
|
|
537
|
+
setup(e) {
|
|
538
|
+
const { minor: v } = De, { t: _ } = Fe(), k = ke(), { mapMemberExportRow: p } = Ct, f = $e(), b = Ke(), w = z(0), n = [
|
|
539
|
+
{
|
|
540
|
+
header: _("connect.loyalty.segment.table.name"),
|
|
541
|
+
accessorFn: (a) => a.name
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
header: _("connect.loyalty.segment.table.status"),
|
|
545
|
+
enableSorting: !1,
|
|
546
|
+
cell(a) {
|
|
547
|
+
const o = a.row.original.isActive === !1 ? "Inactive" : "Active";
|
|
548
|
+
return Y(X.FmChip, {
|
|
549
|
+
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",
|
|
550
|
+
label: o,
|
|
551
|
+
compact: !0
|
|
552
|
+
});
|
|
553
|
+
}
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
header: _("connect.loyalty.segment.table.total_customers"),
|
|
557
|
+
accessorFn: (a) => a.memberCount ?? 0
|
|
558
|
+
},
|
|
559
|
+
{
|
|
560
|
+
header: _("connect.loyalty.segment.table.customer_percentage"),
|
|
561
|
+
accessorFn: (a) => ((a.memberCount ?? 0) * 100 / w.value).toFixed(2)
|
|
562
|
+
},
|
|
563
|
+
{
|
|
564
|
+
header: _("connect.loyalty.segment.table.actions"),
|
|
565
|
+
meta: {
|
|
566
|
+
maxWidth: "100px"
|
|
567
|
+
},
|
|
568
|
+
cell(a) {
|
|
569
|
+
return Y("div", { class: "flex items-center justify-end" }, [
|
|
570
|
+
Y(
|
|
571
|
+
X.FmMenu,
|
|
572
|
+
{
|
|
573
|
+
placement: "bottom-end",
|
|
574
|
+
onClick: (o) => {
|
|
575
|
+
o.stopPropagation();
|
|
576
|
+
}
|
|
577
|
+
},
|
|
578
|
+
{
|
|
579
|
+
"menu-button": () => Y(X.FmButton, {
|
|
580
|
+
icon: "more_vert",
|
|
581
|
+
iconColor: "neutral-gray-400",
|
|
582
|
+
variant: "tertiary"
|
|
583
|
+
}),
|
|
584
|
+
default: () => [
|
|
585
|
+
Y(
|
|
586
|
+
X.FmMenuItem,
|
|
587
|
+
{
|
|
588
|
+
onClick: async (o) => {
|
|
589
|
+
o.stopPropagation(), x(a.row.original);
|
|
590
|
+
}
|
|
591
|
+
},
|
|
592
|
+
{
|
|
593
|
+
label: Y(
|
|
594
|
+
"div",
|
|
595
|
+
{
|
|
596
|
+
class: "fm-typo-en-body-md-400"
|
|
597
|
+
},
|
|
598
|
+
"Export"
|
|
599
|
+
)
|
|
600
|
+
}
|
|
601
|
+
),
|
|
602
|
+
Y(
|
|
603
|
+
X.FmMenuItem,
|
|
604
|
+
{
|
|
605
|
+
onClick: async (o) => {
|
|
606
|
+
o.stopPropagation(), y(a.row.original);
|
|
607
|
+
}
|
|
608
|
+
},
|
|
609
|
+
{
|
|
610
|
+
label: Y(
|
|
611
|
+
"div",
|
|
612
|
+
{
|
|
613
|
+
class: "text-fm-color-typo-error fm-typo-en-body-md-400"
|
|
614
|
+
},
|
|
615
|
+
"Remove"
|
|
616
|
+
)
|
|
617
|
+
}
|
|
618
|
+
)
|
|
619
|
+
]
|
|
620
|
+
}
|
|
621
|
+
)
|
|
622
|
+
]);
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
], i = z(null), { tableMeta: c, rowData: F, debouncedFetchData: A } = be(
|
|
626
|
+
N.readAll
|
|
627
|
+
);
|
|
628
|
+
async function h() {
|
|
629
|
+
await v(
|
|
630
|
+
async () => {
|
|
631
|
+
await N.refreshSegments(), await A({ pageSize: 10, pageIndex: 0 });
|
|
632
|
+
},
|
|
633
|
+
{ message: "Refreshing segmentations" }
|
|
634
|
+
);
|
|
635
|
+
}
|
|
636
|
+
async function y(a) {
|
|
637
|
+
await Re.remove(`Are you sure you want to remove ${a.name}?`) && await v(
|
|
638
|
+
async () => {
|
|
639
|
+
await N.delete(a._id), await A({ pageSize: 10, pageIndex: 0 });
|
|
640
|
+
},
|
|
641
|
+
{
|
|
642
|
+
message: `Removing ${a.name}`,
|
|
643
|
+
successMessage: `Removed ${a.name} successfully`
|
|
644
|
+
}
|
|
645
|
+
);
|
|
646
|
+
}
|
|
647
|
+
async function x(a) {
|
|
648
|
+
const o = {
|
|
649
|
+
sortBy: "_id",
|
|
650
|
+
descending: !1,
|
|
651
|
+
rowsPerPage: 1e3,
|
|
652
|
+
page: 1,
|
|
653
|
+
rowsNumber: 0
|
|
654
|
+
}, u = new Be(), P = (await ve.read({
|
|
655
|
+
limit: 1,
|
|
656
|
+
skip: 0,
|
|
657
|
+
sortBy: o.sortBy,
|
|
658
|
+
descending: o.descending
|
|
659
|
+
})).meta.totalResources ?? 0, R = o.rowsPerPage;
|
|
660
|
+
await v(
|
|
661
|
+
async () => {
|
|
662
|
+
for (let B = 0; B < P; B += R) {
|
|
663
|
+
const V = {
|
|
664
|
+
...o,
|
|
665
|
+
limit: R,
|
|
666
|
+
skip: o.page - 1,
|
|
667
|
+
sortBy: o.sortBy,
|
|
668
|
+
descending: o.descending
|
|
669
|
+
}, j = await N.paginateSegmentUsers(
|
|
670
|
+
a._id,
|
|
671
|
+
V
|
|
672
|
+
);
|
|
673
|
+
for (const q of j.resources) {
|
|
674
|
+
const H = p(q);
|
|
675
|
+
u.addRecord(H);
|
|
676
|
+
}
|
|
677
|
+
o.page++;
|
|
678
|
+
}
|
|
679
|
+
await he(
|
|
680
|
+
u.buildExcel(),
|
|
681
|
+
`[${a.name}]-members-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
|
|
682
|
+
{
|
|
683
|
+
bookType: "xlsx",
|
|
684
|
+
bookSST: !1,
|
|
685
|
+
type: "array"
|
|
686
|
+
}
|
|
687
|
+
), o.page = 1;
|
|
688
|
+
},
|
|
689
|
+
{
|
|
690
|
+
message: "Exporting member...",
|
|
691
|
+
successMessage: "Member exported successfully"
|
|
692
|
+
}
|
|
693
|
+
);
|
|
694
|
+
}
|
|
695
|
+
async function I(a) {
|
|
696
|
+
await v(
|
|
697
|
+
async () => {
|
|
698
|
+
var o;
|
|
699
|
+
if (a.type === D.enum.STATIC) {
|
|
700
|
+
const u = new FormData();
|
|
701
|
+
if (u.append("file", a.file), a._id) {
|
|
702
|
+
const { members: P, _id: R, file: B, ...V } = a;
|
|
703
|
+
u.append("segment", JSON.stringify(V)), await N.updateStatic(a._id, u);
|
|
704
|
+
} else {
|
|
705
|
+
const { file: P, ...R } = a;
|
|
706
|
+
u.append("segment", JSON.stringify(R)), await N.createStatic(u);
|
|
707
|
+
}
|
|
708
|
+
a.file && f.open({
|
|
709
|
+
type: "info",
|
|
710
|
+
title: "Import begins soon. Check Queue for updates.",
|
|
711
|
+
action: "View",
|
|
712
|
+
onAction: async () => {
|
|
713
|
+
await b.push({
|
|
714
|
+
name: _e["$connect-QUEUE"],
|
|
715
|
+
query: { type: [fe.enum.SEGMENTATION_IMPORTED] }
|
|
716
|
+
});
|
|
717
|
+
}
|
|
718
|
+
});
|
|
719
|
+
} else if (a._id) {
|
|
720
|
+
const { members: u, _id: P, ...R } = a;
|
|
721
|
+
await N.update(a._id, R);
|
|
722
|
+
} else
|
|
723
|
+
await N.create(a);
|
|
724
|
+
await A({ pageSize: 10, pageIndex: 0 }), (o = i.value) == null || o.hideSheet();
|
|
725
|
+
},
|
|
726
|
+
{
|
|
727
|
+
message: "Saving segment",
|
|
728
|
+
successMessage: "Segment saved"
|
|
729
|
+
}
|
|
730
|
+
);
|
|
731
|
+
}
|
|
732
|
+
function d(a) {
|
|
733
|
+
var o;
|
|
734
|
+
(o = i.value) == null || o.showSheet(a);
|
|
735
|
+
}
|
|
736
|
+
const s = {
|
|
737
|
+
label: _("connect.navigation.queue"),
|
|
738
|
+
value: "queue",
|
|
739
|
+
isPrimary: !1,
|
|
740
|
+
prependIcon: "work_history"
|
|
741
|
+
}, g = ce(() => k.isPremium ? [
|
|
742
|
+
s,
|
|
743
|
+
{
|
|
744
|
+
label: "Refresh segments",
|
|
745
|
+
value: "refresh",
|
|
746
|
+
prependIcon: "refresh"
|
|
747
|
+
},
|
|
748
|
+
{
|
|
749
|
+
label: "Add segment",
|
|
750
|
+
value: "add",
|
|
751
|
+
isPrimary: !0,
|
|
752
|
+
prependIcon: "add"
|
|
753
|
+
}
|
|
754
|
+
] : []);
|
|
755
|
+
function U(a) {
|
|
756
|
+
switch (a) {
|
|
757
|
+
case "add":
|
|
758
|
+
d();
|
|
759
|
+
break;
|
|
760
|
+
case "refresh":
|
|
761
|
+
h();
|
|
762
|
+
break;
|
|
763
|
+
case "queue":
|
|
764
|
+
b.push({
|
|
765
|
+
name: _e["$connect-QUEUE"],
|
|
766
|
+
query: { type: [fe.enum.SEGMENTATION_IMPORTED] }
|
|
767
|
+
});
|
|
768
|
+
break;
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
return Te(async () => {
|
|
772
|
+
const { meta: a } = await ve.read({
|
|
773
|
+
limit: 1,
|
|
774
|
+
skip: 0,
|
|
775
|
+
sortBy: "_id",
|
|
776
|
+
search: void 0,
|
|
777
|
+
descending: !1
|
|
778
|
+
});
|
|
779
|
+
w.value = a.totalResources ?? 0, await A({ pageSize: 10, pageIndex: 0 }), await k.readPremium(), await k.readLocations();
|
|
780
|
+
}), (a, o) => {
|
|
781
|
+
const u = S("FmPill"), P = S("FmPageHead"), R = S("FmIcon"), B = S("FmMenuItem"), V = S("FmMenu"), j = S("FmListItem"), q = S("FmList"), H = S("FmButton"), te = S("FmCard");
|
|
782
|
+
return m(), C(O, null, [
|
|
783
|
+
r(P, {
|
|
784
|
+
title: "Segments",
|
|
785
|
+
actions: t(g),
|
|
786
|
+
"onClick:action": o[0] || (o[0] = (M) => U(M))
|
|
787
|
+
}, {
|
|
788
|
+
title: E(() => [
|
|
789
|
+
l("div", It, [
|
|
790
|
+
l("span", Mt, $(t(_)("connect.loyalty.segment.title")), 1),
|
|
791
|
+
r(u, { variant: "premium" })
|
|
792
|
+
])
|
|
793
|
+
]),
|
|
794
|
+
_: 1
|
|
795
|
+
}, 8, ["actions"]),
|
|
796
|
+
l("div", Tt, [
|
|
797
|
+
t(F).length > 0 || t(c).searchValue || t(c).isLoading ? (m(), C(O, { key: 0 }, [
|
|
798
|
+
r(we, {
|
|
799
|
+
loading: t(c).isLoading,
|
|
800
|
+
"row-data": t(F),
|
|
801
|
+
"row-count": t(c).totalRows,
|
|
802
|
+
"column-defs": n,
|
|
803
|
+
"shrink-at": !1,
|
|
804
|
+
"page-count": t(c).pageCount,
|
|
805
|
+
"page-index": t(c).pageIndex,
|
|
806
|
+
"page-size": t(c).pageSize,
|
|
807
|
+
onRowClick: o[1] || (o[1] = (M) => {
|
|
808
|
+
d(M.original);
|
|
809
|
+
}),
|
|
810
|
+
onPageChange: t(A)
|
|
811
|
+
}, null, 8, ["loading", "row-data", "row-count", "page-count", "page-index", "page-size", "onPageChange"]),
|
|
812
|
+
r(q, { class: "w-full hidden xs:block" }, {
|
|
813
|
+
default: E(() => [
|
|
814
|
+
(m(!0), C(O, null, ie(t(F), (M) => (m(), J(j, {
|
|
815
|
+
key: M._id.toString(),
|
|
816
|
+
tag: "label",
|
|
817
|
+
onClick: (Q) => d(M)
|
|
818
|
+
}, {
|
|
819
|
+
default: E(() => [
|
|
820
|
+
l("div", null, [
|
|
821
|
+
l("div", Et, $((M.memberCount ?? 0).toLocaleString()) + " total customers ", 1),
|
|
822
|
+
l("div", At, $(M.name), 1),
|
|
823
|
+
l("div", Rt, $(((M.memberCount ?? 0) * 100 / t(w)).toFixed(2)) + "% of customers ", 1)
|
|
824
|
+
])
|
|
825
|
+
]),
|
|
826
|
+
append: E(() => [
|
|
827
|
+
r(V, { "stop-click-propagation": !0 }, {
|
|
828
|
+
"menu-button": E(() => [
|
|
829
|
+
r(R, { name: "more_vert" })
|
|
830
|
+
]),
|
|
831
|
+
default: E(() => [
|
|
832
|
+
r(B, {
|
|
833
|
+
class: "text-fm-color-typo-error fm-typo-en-body-md-400",
|
|
834
|
+
label: "Remove",
|
|
835
|
+
"onUpdate:modelValue": (Q) => Q && y(M)
|
|
836
|
+
}, null, 8, ["onUpdate:modelValue"])
|
|
837
|
+
]),
|
|
838
|
+
_: 2
|
|
839
|
+
}, 1024)
|
|
840
|
+
]),
|
|
841
|
+
_: 2
|
|
842
|
+
}, 1032, ["onClick"]))), 128))
|
|
843
|
+
]),
|
|
844
|
+
_: 1
|
|
845
|
+
})
|
|
846
|
+
], 64)) : (m(), J(te, {
|
|
847
|
+
key: 1,
|
|
848
|
+
variant: "outlined",
|
|
849
|
+
class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
|
|
850
|
+
}, {
|
|
851
|
+
default: E(() => [
|
|
852
|
+
o[3] || (o[3] = l("img", {
|
|
853
|
+
src: Ee,
|
|
854
|
+
class: "aspect-square w-[150px]"
|
|
855
|
+
}, null, -1)),
|
|
856
|
+
o[4] || (o[4] = l("div", { class: "flex flex-col gap-16 text-center" }, [
|
|
857
|
+
l("div", { class: "fm-typo-en-title-sm-800" }, "Create customer segments"),
|
|
858
|
+
l("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. ")
|
|
859
|
+
], -1)),
|
|
860
|
+
r(H, {
|
|
861
|
+
variant: "primary",
|
|
862
|
+
label: "Create segment",
|
|
863
|
+
disabled: !t(k).isPremium,
|
|
864
|
+
icon: "add",
|
|
865
|
+
onClick: o[2] || (o[2] = (M) => d())
|
|
866
|
+
}, null, 8, ["disabled"])
|
|
867
|
+
]),
|
|
868
|
+
_: 1
|
|
869
|
+
})),
|
|
870
|
+
r(ht, {
|
|
871
|
+
ref_key: "sheetRef",
|
|
872
|
+
ref: i,
|
|
873
|
+
"onUpdate:modelValue": I
|
|
874
|
+
}, null, 512)
|
|
875
|
+
])
|
|
876
|
+
], 64);
|
|
877
|
+
};
|
|
878
|
+
}
|
|
879
|
+
});
|
|
880
|
+
export {
|
|
881
|
+
mo as default
|
|
882
|
+
};
|