@feedmepos/mf-connect 0.1.38-beta.2 → 0.1.39-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-D8WCDkga.js +427 -0
- package/dist/{App-D11A2JY1.js → App-CTnXtg1W.js} +352 -364
- package/dist/{Bin-9wV4Ah3M.js → Bin-BY6-bvFj.js} +8 -8
- package/dist/{Broadcast-I3BtSk8V.js → Broadcast-5VTEIQAr.js} +40 -40
- package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-XJqTXbKr.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BuAQxEM4.js} +18 -18
- package/dist/{Card-CqALG5RM.js → Card-8ivdV-Qz.js} +159 -159
- package/dist/{Collections-rg3SzoUb.js → Collections-CFszRHmE.js} +91 -103
- package/dist/{Credit-BNn1sYZv.js → Credit-DFslY__4.js} +74 -74
- package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-PJ8q72XH.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-BvCLYtJ3.js} +488 -489
- package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-Sww7KNle.js → EffectSheet.vue_vue_type_style_index_0_lang-Ci_bp7GH.js} +94 -94
- package/dist/{Experience-D_Qm8SUj.js → Experience-BxfiZNlY.js} +41 -41
- package/dist/{Game-CKXgXm6Q.js → Game-0FZJcLmj.js} +31 -31
- package/dist/ImageInput.vue_vue_type_script_setup_true_lang-ByhTB9Ie.js +144 -0
- package/dist/{Index-D4DGfUHd.js → Index-ByeKKbuM.js} +10 -10
- package/dist/Marketing-C7F4abzg.js +319 -0
- package/dist/{Member-B55vWHDd.js → Member-DP0fLSIV.js} +64 -64
- package/dist/MemberList-DFW2bMbr.js +1606 -0
- package/dist/MemberOverview-C2n9oJZh.js +58 -0
- package/dist/{MemberTransactions-CP5EI-W0.js → MemberTransactions-CW62fvgx.js} +1 -1
- package/dist/MessageInput.vue_vue_type_script_setup_true_lang-iJXNbgsB.js +455 -0
- package/dist/{Mission-CFvhROuB.js → Mission-DEgQHJw6.js} +21 -21
- package/dist/{Overview-4273yNwL.js → Overview-5jDtZKi8.js} +335 -335
- package/dist/{Point-B_-_C919.js → Point-D2lB1-xB.js} +41 -41
- package/dist/{Promotion-D2S3COxk.js → Promotion-Diz1gIa0.js} +42 -42
- package/dist/{Queue-BmS1Oi-C.js → Queue-DIAuq7HG.js} +51 -51
- package/dist/{Record-DRBl0M8g.js → Record-T608yda1.js} +9 -9
- package/dist/{Reward-8056NmfK.js → Reward-fZzHrHCW.js} +173 -173
- package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-CJ_WC2gV.js → RewardGroup.vue_vue_type_script_setup_true_lang-YOKVfimM.js} +11 -11
- package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-DqNQl_nz.js → RuleGroup.vue_vue_type_script_setup_true_lang-C3_lmBe5.js} +431 -431
- package/dist/Segment-DDQIzsrk.js +882 -0
- package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-4nNkkklE.js → SelectItems.vue_vue_type_script_setup_true_lang-B5oUf91Q.js} +2 -2
- package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-Dnf2oxOG.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-C2U6Kzvx.js} +11 -11
- package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-BLYP-5U9.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-BRmqgxES.js} +3 -3
- package/dist/{Setting-BrJfYoru.js → Setting-CQNyXmp4.js} +432 -432
- package/dist/{Store-Bpl_4yZW.js → Store-CIA1Rtsg.js} +210 -210
- package/dist/StoreRewards-D5zlE6cE.js +423 -0
- package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-BkTYngJ_.js +995 -0
- package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-QucRaI08.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-D8l3fQyz.js} +1 -1
- package/dist/{Tier-_LnXg3n6.js → Tier-jFXVOje_.js} +106 -106
- package/dist/{Title-B7AGStvx.js → Title-DVpZ1YMK.js} +131 -133
- package/dist/{Transaction-Chxv6V7u.js → Transaction-BF_wmok6.js} +2 -2
- package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-CzXNmobp.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-Cex1Z43W.js} +6 -6
- package/dist/{Voucher-C5z2kOq9.js → Voucher-CaBMU5w0.js} +37 -37
- package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-BXt2fLOD.js +419 -0
- package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-BlXzEWA6.js → ZodTextField.vue_vue_type_script_setup_true_lang-CtHjWpUe.js} +1 -1
- package/dist/{app-BVojNX0w.js → app-CPhyKlyf.js} +1 -1
- package/dist/{app-7cvPyHJ7.js → app-DuIzRGvb.js} +124 -161
- package/dist/app.js +3 -4
- package/dist/{business-CmxV69wT.js → business-TTvv3aTz.js} +1 -1
- package/dist/{campaign-Dq5C_no-.js → campaign-BiMCoAzx.js} +3 -5
- package/dist/{campaign-CT_cNJEL.js → campaign-CjEVStN1.js} +9 -9
- package/dist/{campaign.enum-dp7yHKzF.js → campaign.enum-DpYmj9jp.js} +1 -1
- package/dist/campaign.fn-DJ6J98jS.js +758 -0
- package/dist/{collectible.enum-DxbB4DxT.js → collectible.enum-Cgmm_s-C.js} +1 -1
- package/dist/{collection.fn-CNZRdUgy.js → collection.fn-BsYCNgfJ.js} +2 -2
- package/dist/{dto-CT9zZbv9.js → dto-DgmHIlZ2.js} +4 -4
- package/dist/{effect-FIlOEC4H.js → effect-DnAVIDFy.js} +1 -1
- package/dist/{email-addresses-Ba7xImfX.js → email-addresses-CMRgb6Uv.js} +1 -1
- package/dist/{export-uzjZFNF9.js → export-DtarK6IJ.js} +3 -3
- package/dist/{helper-D4sAZde0.js → helper-BKZghMbF.js} +1 -1
- package/dist/{index-l2F5MnLF.js → index-2OAcPmuQ.js} +1 -1
- package/dist/{index-BI3m1Ehv.js → index-B0YZKHyu.js} +3 -3
- package/dist/{index-CH3z92VV.js → index-B5oXFFlO.js} +1 -1
- package/dist/{index-CvBcve-r.js → index-BQ3KHJXX.js} +1 -1
- package/dist/{index-B9pl4zRZ.js → index-B_893fH7.js} +79 -179
- package/dist/{index-CNJLP3D5.js → index-BoR-BOFw.js} +1 -1
- package/dist/{index-DNxa8Rqx.js → index-C7rl1eHp.js} +449 -516
- package/dist/{index-BXz54M1s.js → index-CBcbwf0k.js} +1 -1
- package/dist/{index-CS3Jmojj.js → index-CIztuDE4.js} +2462 -2453
- package/dist/{index-D5rvMvzx.js → index-CK67enPK.js} +1 -1
- package/dist/index-CuvNtC_M.js +61 -0
- package/dist/index-D2uZzjpn.js +44 -0
- package/dist/{index-CUfS9Kp1.js → index-DWdAUovq.js} +9 -9
- package/dist/{index-CONvJfKv.js → index-DkWcEDHA.js} +1 -1
- package/dist/{index-BjU8LVUC.js → index-VHu8hYtE.js} +385 -376
- package/dist/{index.esm2017-ATcsD5N4.js → index.esm2017-DkwLmmR_.js} +127 -127
- package/dist/{loading-BWGQSrCB.js → loading-BFkEqWR6.js} +1 -1
- package/dist/{membership-Cc4OZ8-U.js → membership-D0eN3i_T.js} +3 -3
- package/dist/{money-D7p8nfun.js → money-DS9ZQwSP.js} +1 -1
- package/dist/{number-CMJjC4qz.js → number-C8Gt93v9.js} +1 -1
- package/dist/objectid-Cr99eTPd.js +145 -0
- package/dist/{plugins-eQis66QR.js → plugins-DK_ue6Xa.js} +2 -2
- package/dist/{reward-DrnzbG20.js → reward-CW2dSLDW.js} +1 -1
- package/dist/{rule-CtRxkYXB.js → rule-CebKyXSm.js} +3 -3
- package/dist/{rule-builder-Di9RIYHF.js → rule-builder-kQq14RfN.js} +17 -17
- package/dist/style.css +1 -1
- package/dist/{template-C3UfY0v5.js → template-CxUxlb6-.js} +64 -64
- package/dist/{trigger-C9U7Zgad.js → trigger-RqJo06KA.js} +4 -4
- package/dist/{usePagination-BeF5K3M7.js → usePagination-JoYaROkV.js} +85 -85
- package/dist/{user-D7n9yYmO.js → user-DhV5Iy52.js} +1 -1
- package/dist/{vue-i18n-Bz45zC04.js → vue-i18n-BtvUK9hI.js} +419 -419
- package/dist/{xlsx-D4S4qbcZ.js → xlsx-WnLDq4qn.js} +381 -381
- package/package.json +3 -9
- package/dist/Analytic-BjSfI2Ff.js +0 -761
- package/dist/AuditLogs-DWCFYoRg.js +0 -1887
- package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-BUzUIIUW.js +0 -58
- package/dist/ImageInput.vue_vue_type_script_setup_true_lang-rWUkV9gn.js +0 -144
- package/dist/Marketing-Dn9A1vgH.js +0 -20073
- package/dist/MemberList-BWTG9Ohy.js +0 -1606
- package/dist/MemberOverview-wL_ailso.js +0 -58
- package/dist/MessageInput.vue_vue_type_script_setup_true_lang-D--_An-f.js +0 -60279
- package/dist/Segment-Bzq-pyhc.js +0 -882
- package/dist/StoreRewards-Cu7n7Pjz.js +0 -423
- package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-T3Wo2maC.js +0 -1029
- package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-DdGMrk2C.js +0 -419
- package/dist/campaign.fn-BYZgKDN7.js +0 -758
- package/dist/index-CsaQJMAR.js +0 -66
- package/dist/index-CwsMG2cV.js +0 -56
- package/dist/objectid-D5T27iny.js +0 -145
- package/dist/remy-vue-client-Cpppk9h-.js +0 -1693
|
@@ -0,0 +1,882 @@
|
|
|
1
|
+
import { defineComponent as ee, ref as z, resolveComponent as b, openBlock as p, createElementBlock as C, createVNode as i, unref as t, createCommentVNode as le, createElementVNode as s, withCtx as E, Fragment as O, renderList as ie, createBlock as J, toDisplayString as D, 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 { p as $e } from "./plugins-DK_ue6Xa.js";
|
|
4
|
+
import { u as Re } from "./loading-BFkEqWR6.js";
|
|
5
|
+
import { FmButtonVariant as ae, useSnackbar as Ae, components as X } from "@feedmepos/ui-library";
|
|
6
|
+
import { u as xe, _ as be } from "./usePagination-JoYaROkV.js";
|
|
7
|
+
import { u as we } from "./vue-i18n-BtvUK9hI.js";
|
|
8
|
+
import { i as De, j as A, c as fe } from "./index-C7rl1eHp.js";
|
|
9
|
+
import "./index-DWdAUovq.js";
|
|
10
|
+
import "./index-B_893fH7.js";
|
|
11
|
+
import "./index-DkWcEDHA.js";
|
|
12
|
+
import "./index-B0YZKHyu.js";
|
|
13
|
+
import { u as ne, w as Fe } from "./xlsx-WnLDq4qn.js";
|
|
14
|
+
import { e as Pe, M as Ne } from "./email-addresses-CMRgb6Uv.js";
|
|
15
|
+
import { Z as Be } from "./zod-Bg2FbC-D.js";
|
|
16
|
+
import { u as Ve } from "./app-wDQR6dpb.js";
|
|
17
|
+
import { F as ye, z as Ye } from "./index-CIztuDE4.js";
|
|
18
|
+
import { R as ge } from "./rule-builder-kQq14RfN.js";
|
|
19
|
+
import { _ as Ue } from "./ZodTextField.vue_vue_type_script_setup_true_lang-CtHjWpUe.js";
|
|
20
|
+
import { _ as Le } from "./RuleGroup.vue_vue_type_script_setup_true_lang-C3_lmBe5.js";
|
|
21
|
+
import { u as ze, v as Oe, w as je } from "./index.esm2017-DkwLmmR_.js";
|
|
22
|
+
import { F as qe } from "./FileSaver.min-NlMItPOc.js";
|
|
23
|
+
import { h as G } from "./moment-BWErdI6_.js";
|
|
24
|
+
import { s as N, u as He } from "./membership-D0eN3i_T.js";
|
|
25
|
+
import { o as Ge } from "./objectId-dwaoBfJX.js";
|
|
26
|
+
import { u as ke } from "./business-TTvv3aTz.js";
|
|
27
|
+
import { f as Je } from "./number-C8Gt93v9.js";
|
|
28
|
+
import { t as Qe } from "./money-DS9ZQwSP.js";
|
|
29
|
+
import "./index-BoR-BOFw.js";
|
|
30
|
+
import { useRouter as We } from "vue-router";
|
|
31
|
+
import { m as ve } from "./index-BQ3KHJXX.js";
|
|
32
|
+
import { R as _e } from "./app-DuIzRGvb.js";
|
|
33
|
+
const Ke = De.extend({
|
|
34
|
+
_id: ye.optional(),
|
|
35
|
+
business: ye.optional(),
|
|
36
|
+
file: Ye.any().nullish()
|
|
37
|
+
});
|
|
38
|
+
var Ze = { 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 Xe = { class: "flex flex-col space-y-16" }, et = /* @__PURE__ */ s("div", { class: "fm-typo-en-title-sm-800" }, "Upload File", -1), 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, F = v, { t: m } = we(), y = z(null), f = z(null), w = ["Id"], l = [
|
|
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 n() {
|
|
74
|
+
if (_.importFile)
|
|
75
|
+
try {
|
|
76
|
+
const h = ze(void 0, Ze.importFilesBucketUrl), S = Oe(h, _.importFile), x = await je(S);
|
|
77
|
+
window.open(x, "_blank");
|
|
78
|
+
} catch (h) {
|
|
79
|
+
console.log(h);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
async function c(h) {
|
|
83
|
+
switch (h) {
|
|
84
|
+
case "csv":
|
|
85
|
+
const S = new Blob([w.join(",")], {
|
|
86
|
+
type: "text/csv;charset=utf-8;"
|
|
87
|
+
});
|
|
88
|
+
qe.saveAs(S, "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"), Fe(I, "ImportSegmentTemplate.xlsx");
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function k(h) {
|
|
97
|
+
y.value = h, F("update:file", y.value);
|
|
98
|
+
}
|
|
99
|
+
function $(h) {
|
|
100
|
+
var x, I;
|
|
101
|
+
const S = ((I = (x = h.target) == null ? void 0 : x.files) == null ? void 0 : I[0]) ?? null;
|
|
102
|
+
k(S);
|
|
103
|
+
}
|
|
104
|
+
return (h, S) => {
|
|
105
|
+
const x = b("FmButton"), I = b("FmMenuItem"), u = b("FmMenu"), r = b("FmDropField");
|
|
106
|
+
return p(), C("div", Xe, [
|
|
107
|
+
et,
|
|
108
|
+
h.importFile ? (p(), C("div", tt, [
|
|
109
|
+
i(x, {
|
|
110
|
+
label: t(m)("View uploaded file"),
|
|
111
|
+
variant: t(ae).Plain,
|
|
112
|
+
icon: "file_present",
|
|
113
|
+
onClick: n
|
|
114
|
+
}, null, 8, ["label", "variant"])
|
|
115
|
+
])) : le("", !0),
|
|
116
|
+
s("div", null, [
|
|
117
|
+
s("div", ot, [
|
|
118
|
+
i(u, { class: "" }, {
|
|
119
|
+
"menu-button": E(() => [
|
|
120
|
+
i(x, {
|
|
121
|
+
variant: "tertiary",
|
|
122
|
+
icon: "download",
|
|
123
|
+
label: "Download Template"
|
|
124
|
+
})
|
|
125
|
+
]),
|
|
126
|
+
default: E(() => [
|
|
127
|
+
(p(), C(O, null, ie(l, (g) => i(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
|
+
y.value ? (p(), C("div", at, [
|
|
139
|
+
i(x, {
|
|
140
|
+
variant: t(ae).Tertiary,
|
|
141
|
+
"prepend-icon": "attach_file"
|
|
142
|
+
}, null, 8, ["variant"]),
|
|
143
|
+
s("p", nt, D(y.value.name), 1),
|
|
144
|
+
s("label", {
|
|
145
|
+
ref_key: "fileLabelRef",
|
|
146
|
+
ref: f,
|
|
147
|
+
htmlFor: "file"
|
|
148
|
+
}, [
|
|
149
|
+
i(x, {
|
|
150
|
+
variant: t(ae).Plain,
|
|
151
|
+
label: t(m)("Replace File"),
|
|
152
|
+
onClick: S[1] || (S[1] = () => {
|
|
153
|
+
var g;
|
|
154
|
+
return (g = f.value) == null ? void 0 : g.click();
|
|
155
|
+
})
|
|
156
|
+
}, null, 8, ["variant", "label"]),
|
|
157
|
+
s("input", {
|
|
158
|
+
id: "file",
|
|
159
|
+
accept: ".csv",
|
|
160
|
+
class: "hidden",
|
|
161
|
+
type: "file",
|
|
162
|
+
multiple: "",
|
|
163
|
+
onChange: $
|
|
164
|
+
}, null, 32)
|
|
165
|
+
], 512)
|
|
166
|
+
])) : (p(), J(r, {
|
|
167
|
+
key: 0,
|
|
168
|
+
onFileUpload: S[0] || (S[0] = (g) => k(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__ */ s("div", null, "contacts in your segment", -1), pt = /* @__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: (n) => n.name
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
header: "Id",
|
|
190
|
+
accessorFn: (n) => n._id
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
header: "Customer Since",
|
|
194
|
+
accessorFn: (n) => G(Ge(n._id.toString())).format("DD MMM YYYY")
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
header: "Phone",
|
|
198
|
+
accessorFn: (n) => n.phoneNumber
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
header: "Birthday",
|
|
202
|
+
accessorFn: (n) => G(n.birthday).format("DD MMM YYYY")
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
header: "Last Visit",
|
|
206
|
+
accessorFn: (n) => G(n.stats.lastVisit).format("DD MMM YYYY")
|
|
207
|
+
}
|
|
208
|
+
];
|
|
209
|
+
async function F(n) {
|
|
210
|
+
return v.segment._id ? (console.log(n), await N.paginateSegmentUsers(
|
|
211
|
+
v.segment._id,
|
|
212
|
+
n
|
|
213
|
+
)) : {
|
|
214
|
+
resources: [],
|
|
215
|
+
meta: {
|
|
216
|
+
totalResources: 0,
|
|
217
|
+
totalPages: 0,
|
|
218
|
+
skip: n.skip,
|
|
219
|
+
limit: n.limit,
|
|
220
|
+
sortBy: n.sortBy
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
const { tableMeta: m, rowData: y, onSort: f, debouncedFetchData: w, onSearch: l } = xe(F);
|
|
225
|
+
return Se(async () => {
|
|
226
|
+
await w();
|
|
227
|
+
}), (n, c) => (p(), C("div", lt, [
|
|
228
|
+
s("div", it, D(v.title), 1),
|
|
229
|
+
s("div", rt, [
|
|
230
|
+
s("div", ct, D(n.segment.members.length), 1),
|
|
231
|
+
s("div", dt, [
|
|
232
|
+
ut,
|
|
233
|
+
s("div", null, "as of " + D(t(G)(n.segment.lastUpdated).format("DD MMM YYYY")), 1)
|
|
234
|
+
])
|
|
235
|
+
]),
|
|
236
|
+
i(be, {
|
|
237
|
+
loading: t(m).isLoading,
|
|
238
|
+
"row-data": t(y),
|
|
239
|
+
"row-count": t(m).totalRows,
|
|
240
|
+
"column-defs": _,
|
|
241
|
+
"page-size": t(m).pageSize,
|
|
242
|
+
"page-count": t(m).pageCount,
|
|
243
|
+
"page-index": t(m).pageIndex,
|
|
244
|
+
onSortChange: t(f),
|
|
245
|
+
onPageChange: c[0] || (c[0] = (k) => t(w)({ pageSize: k.pageSize, pageIndex: k.pageIndex }))
|
|
246
|
+
}, null, 8, ["loading", "row-data", "row-count", "page-size", "page-count", "page-index", "onSortChange"])
|
|
247
|
+
]));
|
|
248
|
+
}
|
|
249
|
+
}), mt = { class: "space-y-24" }, ft = { class: "grid grid-cols-2 gap-16" }, yt = { class: "fm-typo-en-title-sm-800" }, gt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, vt = /* @__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, F = v, m = [
|
|
258
|
+
{
|
|
259
|
+
label: "Dynamic",
|
|
260
|
+
sublabel: "Segment statistics are based on rules configured and will be recalculated automatically when rule changes.",
|
|
261
|
+
value: A.enum.DYNAMIC
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
label: "Static",
|
|
265
|
+
sublabel: "Segment statistics are based on imported data and will not be recalculated.",
|
|
266
|
+
value: A.enum.STATIC
|
|
267
|
+
}
|
|
268
|
+
];
|
|
269
|
+
function y(f) {
|
|
270
|
+
f !== _.modelValue && F("update:model-value", f);
|
|
271
|
+
}
|
|
272
|
+
return (f, w) => {
|
|
273
|
+
const l = b("FmCard"), n = b("FmHelperText");
|
|
274
|
+
return p(), C("div", mt, [
|
|
275
|
+
s("div", ft, [
|
|
276
|
+
(p(), C(O, null, ie(m, (c) => i(l, {
|
|
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": m.length == 1,
|
|
280
|
+
"border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": f.modelValue === c.value,
|
|
281
|
+
"hover:bg-fm-color-opacity-sm": f.modelValue !== c.value
|
|
282
|
+
}]),
|
|
283
|
+
onClick: (k) => y(c.value),
|
|
284
|
+
key: c.value
|
|
285
|
+
}, {
|
|
286
|
+
default: E(() => [
|
|
287
|
+
s("div", yt, D(c.label), 1),
|
|
288
|
+
s("div", gt, D(c.sublabel), 1)
|
|
289
|
+
]),
|
|
290
|
+
_: 2
|
|
291
|
+
}, 1032, ["class", "onClick"])), 64))
|
|
292
|
+
]),
|
|
293
|
+
f.errorText ? (p(), J(n, {
|
|
294
|
+
key: 0,
|
|
295
|
+
class: "!mt-4",
|
|
296
|
+
text: f.errorText,
|
|
297
|
+
state: "error"
|
|
298
|
+
}, null, 8, ["text"])) : le("", !0)
|
|
299
|
+
]);
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
}), _t = { class: "flex items-center gap-x-8" }, ht = /* @__PURE__ */ s("div", null, "Review segment", -1), St = {
|
|
303
|
+
key: 0,
|
|
304
|
+
class: "space-y-16 pr-12"
|
|
305
|
+
}, xt = { class: "flex flex-col space-y-16" }, bt = /* @__PURE__ */ s("div", { class: "fm-typo-en-title-sm-800" }, "Segment Type", -1), wt = {
|
|
306
|
+
key: 0,
|
|
307
|
+
class: "flex flex-col space-y-16"
|
|
308
|
+
}, Ft = /* @__PURE__ */ s("div", { class: "fm-typo-en-title-sm-800" }, "Segment Filter", -1), kt = {
|
|
309
|
+
key: 1,
|
|
310
|
+
class: "flex flex-col space-y-16"
|
|
311
|
+
}, Ct = {
|
|
312
|
+
key: 2,
|
|
313
|
+
class: "flex flex-col space-y-16"
|
|
314
|
+
}, It = /* @__PURE__ */ s("div", { class: "fm-typo-en-title-sm-800" }, "Segment Status", -1), Mt = { class: "flex items-center gap-8" }, Tt = /* @__PURE__ */ ee({
|
|
315
|
+
__name: "SegmentSheet",
|
|
316
|
+
emits: ["update:model-value"],
|
|
317
|
+
setup(e, { expose: v, emit: _ }) {
|
|
318
|
+
const F = Ve(), m = z(!1), y = z(!1), f = {
|
|
319
|
+
name: "",
|
|
320
|
+
isActive: !0,
|
|
321
|
+
type: A.enum.DYNAMIC,
|
|
322
|
+
rule: ge.scaffoldGroup(),
|
|
323
|
+
members: []
|
|
324
|
+
}, w = Ke, l = z(f), n = ce(() => {
|
|
325
|
+
const u = w.safeParse(l.value);
|
|
326
|
+
return u.success ? [] : u.error.errors;
|
|
327
|
+
});
|
|
328
|
+
function c(u) {
|
|
329
|
+
m.value = !0, y.value = !1, u ? l.value = {
|
|
330
|
+
...u,
|
|
331
|
+
isActive: u.isActive !== !1,
|
|
332
|
+
type: u.type ?? (u.importFile ? A.enum.STATIC : A.enum.DYNAMIC)
|
|
333
|
+
} : l.value = { ...f };
|
|
334
|
+
}
|
|
335
|
+
function k() {
|
|
336
|
+
m.value = !1;
|
|
337
|
+
}
|
|
338
|
+
async function $() {
|
|
339
|
+
w.safeParse(l.value).success && (y.value = !0);
|
|
340
|
+
}
|
|
341
|
+
function h() {
|
|
342
|
+
y.value = !1;
|
|
343
|
+
}
|
|
344
|
+
async function S() {
|
|
345
|
+
l.value.type === A.enum.STATIC ? (l.value.rule = ge.scaffoldGroup(), l.value.isActive = !0) : l.value.file = void 0, I("update:model-value", l.value);
|
|
346
|
+
}
|
|
347
|
+
async function x(u) {
|
|
348
|
+
l.value.type = u;
|
|
349
|
+
}
|
|
350
|
+
Se(async () => {
|
|
351
|
+
});
|
|
352
|
+
const I = _;
|
|
353
|
+
return v({
|
|
354
|
+
showSheet: c,
|
|
355
|
+
hideSheet: k
|
|
356
|
+
}), (u, r) => {
|
|
357
|
+
const g = b("FmButton"), U = b("FmSwitch"), o = b("FmSideSheet");
|
|
358
|
+
return p(), J(o, {
|
|
359
|
+
modelValue: t(m),
|
|
360
|
+
"onUpdate:modelValue": r[8] || (r[8] = (a) => Ie(m) ? m.value = a : null),
|
|
361
|
+
header: "Add segment",
|
|
362
|
+
"dismiss-away": "",
|
|
363
|
+
"close-button": !0,
|
|
364
|
+
"max-width": 1100
|
|
365
|
+
}, Me({
|
|
366
|
+
"side-sheet-footer": E(() => [
|
|
367
|
+
s("div", Mt, [
|
|
368
|
+
t(y) || t(l).type === t(A).enum.STATIC ? (p(), C(O, { key: 0 }, [
|
|
369
|
+
i(g, {
|
|
370
|
+
label: "Save Segment",
|
|
371
|
+
onClick: S,
|
|
372
|
+
loading: t(F).isLoading,
|
|
373
|
+
disabled: t(n).length > 0 || t(F).isLoading
|
|
374
|
+
}, null, 8, ["loading", "disabled"]),
|
|
375
|
+
i(g, {
|
|
376
|
+
label: "Cancel",
|
|
377
|
+
onClick: r[6] || (r[6] = (a) => h()),
|
|
378
|
+
variant: "tertiary"
|
|
379
|
+
})
|
|
380
|
+
], 64)) : (p(), C(O, { key: 1 }, [
|
|
381
|
+
i(g, {
|
|
382
|
+
label: "Review Segment",
|
|
383
|
+
disabled: t(n).length > 0 || t(F).isLoading,
|
|
384
|
+
onClick: $
|
|
385
|
+
}, null, 8, ["disabled"]),
|
|
386
|
+
i(g, {
|
|
387
|
+
label: "Cancel",
|
|
388
|
+
onClick: r[7] || (r[7] = (a) => k()),
|
|
389
|
+
variant: "tertiary"
|
|
390
|
+
})
|
|
391
|
+
], 64))
|
|
392
|
+
])
|
|
393
|
+
]),
|
|
394
|
+
default: E(() => {
|
|
395
|
+
var a;
|
|
396
|
+
return [
|
|
397
|
+
t(y) ? (p(), J(pt, {
|
|
398
|
+
key: 1,
|
|
399
|
+
title: t(l).name,
|
|
400
|
+
segment: t(l)
|
|
401
|
+
}, null, 8, ["title", "segment"])) : (p(), C("div", St, [
|
|
402
|
+
i(Ue, {
|
|
403
|
+
modelValue: t(l).name,
|
|
404
|
+
"onUpdate:modelValue": r[1] || (r[1] = (d) => t(l).name = d),
|
|
405
|
+
label: "Segment title",
|
|
406
|
+
schema: t(Be).typeAtPath(t(w), "name")
|
|
407
|
+
}, null, 8, ["modelValue", "schema"]),
|
|
408
|
+
s("div", xt, [
|
|
409
|
+
bt,
|
|
410
|
+
i(vt, {
|
|
411
|
+
"model-value": t(l).type,
|
|
412
|
+
"onUpdate:modelValue": r[2] || (r[2] = (d) => {
|
|
413
|
+
x(d);
|
|
414
|
+
})
|
|
415
|
+
}, null, 8, ["model-value"])
|
|
416
|
+
]),
|
|
417
|
+
t(l).type === t(A).enum.DYNAMIC ? (p(), C("div", wt, [
|
|
418
|
+
Ft,
|
|
419
|
+
i(Le, {
|
|
420
|
+
"trigger-type": "MEMBERSHIP_JOINED",
|
|
421
|
+
includeOnly: "user",
|
|
422
|
+
"model-value": (a = t(l)) == null ? void 0 : a.rule,
|
|
423
|
+
"onUpdate:modelValue": r[3] || (r[3] = (d) => {
|
|
424
|
+
t(l).rule = d;
|
|
425
|
+
})
|
|
426
|
+
}, null, 8, ["model-value"])
|
|
427
|
+
])) : (p(), C("div", kt, [
|
|
428
|
+
i(st, {
|
|
429
|
+
importFile: t(l).importFile,
|
|
430
|
+
"onUpdate:file": r[4] || (r[4] = (d) => {
|
|
431
|
+
t(l).file = d;
|
|
432
|
+
})
|
|
433
|
+
}, null, 8, ["importFile"])
|
|
434
|
+
])),
|
|
435
|
+
t(l).type === t(A).enum.DYNAMIC ? (p(), C("div", Ct, [
|
|
436
|
+
It,
|
|
437
|
+
i(U, {
|
|
438
|
+
"model-value": t(l).isActive ?? !0,
|
|
439
|
+
"onUpdate:modelValue": r[5] || (r[5] = (d) => t(l).isActive = d),
|
|
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(y) ? {
|
|
451
|
+
name: "side-sheet-header",
|
|
452
|
+
fn: E(() => [
|
|
453
|
+
s("div", _t, [
|
|
454
|
+
i(g, {
|
|
455
|
+
icon: "arrow_back",
|
|
456
|
+
variant: "tertiary",
|
|
457
|
+
onClick: r[0] || (r[0] = (a) => y.value = !1)
|
|
458
|
+
}),
|
|
459
|
+
ht
|
|
460
|
+
])
|
|
461
|
+
]),
|
|
462
|
+
key: "0"
|
|
463
|
+
} : void 0
|
|
464
|
+
]), 1032, ["modelValue"]);
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
}), he = He(), Et = ke();
|
|
468
|
+
function se(e) {
|
|
469
|
+
const v = G(e);
|
|
470
|
+
return v.isValid() ? v.format("DD/MM/YYYY") : "";
|
|
471
|
+
}
|
|
472
|
+
const $t = {
|
|
473
|
+
mapMemberExportRow: (e) => {
|
|
474
|
+
var n, c, k, $, h, S, x, I, u, r, g, U, o, a, d, P, R, B, V, j, q, H, te, M, Q, de, ue, pe;
|
|
475
|
+
const v = ce(() => Et.locations.map((T) => ({
|
|
476
|
+
label: T.name,
|
|
477
|
+
value: T._id
|
|
478
|
+
}))), _ = (n = Pe.parseOneAddress(
|
|
479
|
+
e == null ? void 0 : e.email
|
|
480
|
+
)) != null && n.domain.includes("feedmepos.com") ? void 0 : e.email, F = (k = ((c = e == null ? void 0 : e.collection) == null ? void 0 : c.TITLE) || []) == null ? void 0 : k.reduce(
|
|
481
|
+
(T, L) => {
|
|
482
|
+
var K, Z;
|
|
483
|
+
const W = (Z = (K = he.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
|
+
), m = (he.sortedTitles || []).reduce(
|
|
490
|
+
(T, L) => {
|
|
491
|
+
var K, Z, oe, me;
|
|
492
|
+
const W = (me = (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 : me.expiredAt;
|
|
495
|
+
return T[L.name] = W ? G(W).format("DD/MM/YYYY") : "", T;
|
|
496
|
+
},
|
|
497
|
+
{}
|
|
498
|
+
), y = ((S = (h = ($ = e.collection) == null ? void 0 : $.CREDIT) == null ? void 0 : h.at(0)) == null ? void 0 : S.balance) || 0, f = ((r = (u = (I = (x = e.collection) == null ? void 0 : x.CREDIT) == null ? void 0 : I.at(0)) == null ? void 0 : u.expiryBalance) == null ? void 0 : r.reduce(
|
|
499
|
+
(T, L) => T + L.amount,
|
|
500
|
+
0
|
|
501
|
+
)) || 0, w = Je(y, 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(f)).toFixed(2)),
|
|
511
|
+
FreeCredit: Number(f.toFixed(2)),
|
|
512
|
+
TotalCredit: Number(w),
|
|
513
|
+
Exp: e != null && e.collection ? ((d = (a = (o = e.collection) == null ? void 0 : o.POINT) == null ? void 0 : a.at(0)) == null ? void 0 : d.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: F.join(","),
|
|
518
|
+
...m,
|
|
519
|
+
TotalTransaction: e.stats.visitCount,
|
|
520
|
+
AvgSpent: Qe(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 && ((pe = v.value.find((T) => T.value == e.location)) == null ? void 0 : pe.label) || "-",
|
|
530
|
+
VisitFrequency: `${Number(
|
|
531
|
+
Math.ceil(e.stats.avgVisitFrequency).toFixed(0)
|
|
532
|
+
)}`
|
|
533
|
+
};
|
|
534
|
+
}
|
|
535
|
+
}, Rt = { class: "flex items-center" }, At = { class: "fm-typo-en-title-md-600 fm-step-title line-clamp-2 mr-8" }, Dt = { class: "px-24 flex flex-col gap-y-16" }, Pt = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, Nt = { class: "fm-typo-en-body-md-600" }, Bt = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, Vt = /* @__PURE__ */ s("img", {
|
|
536
|
+
src: Ee,
|
|
537
|
+
class: "aspect-square w-[150px]"
|
|
538
|
+
}, null, -1), Yt = /* @__PURE__ */ s("div", { class: "flex flex-col gap-16 text-center" }, [
|
|
539
|
+
/* @__PURE__ */ s("div", { class: "fm-typo-en-title-sm-800" }, "Create customer segments"),
|
|
540
|
+
/* @__PURE__ */ s("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Segments allow you to categorize your customers based on various criteria, enabling targeted marketing and personalized experiences. ")
|
|
541
|
+
], -1), ho = /* @__PURE__ */ ee({
|
|
542
|
+
__name: "Segment",
|
|
543
|
+
setup(e) {
|
|
544
|
+
const { minor: v } = Re, { t: _ } = we(), F = ke(), { mapMemberExportRow: m } = $t, y = Ae(), f = We(), w = z(0), l = [
|
|
545
|
+
{
|
|
546
|
+
header: _("connect.loyalty.segment.table.name"),
|
|
547
|
+
accessorFn: (o) => o.name
|
|
548
|
+
},
|
|
549
|
+
{
|
|
550
|
+
header: _("connect.loyalty.segment.table.status"),
|
|
551
|
+
enableSorting: !1,
|
|
552
|
+
cell(o) {
|
|
553
|
+
const a = o.row.original.isActive === !1 ? "Inactive" : "Active";
|
|
554
|
+
return Y(X.FmChip, {
|
|
555
|
+
class: o.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",
|
|
556
|
+
label: a,
|
|
557
|
+
compact: !0
|
|
558
|
+
});
|
|
559
|
+
}
|
|
560
|
+
},
|
|
561
|
+
{
|
|
562
|
+
header: _("connect.loyalty.segment.table.total_customers"),
|
|
563
|
+
accessorFn: (o) => o.memberCount ?? 0
|
|
564
|
+
},
|
|
565
|
+
{
|
|
566
|
+
header: _("connect.loyalty.segment.table.customer_percentage"),
|
|
567
|
+
accessorFn: (o) => ((o.memberCount ?? 0) * 100 / w.value).toFixed(2)
|
|
568
|
+
},
|
|
569
|
+
{
|
|
570
|
+
header: _("connect.loyalty.segment.table.actions"),
|
|
571
|
+
meta: {
|
|
572
|
+
maxWidth: "100px"
|
|
573
|
+
},
|
|
574
|
+
cell(o) {
|
|
575
|
+
return Y("div", { class: "flex items-center justify-end" }, [
|
|
576
|
+
Y(
|
|
577
|
+
X.FmMenu,
|
|
578
|
+
{
|
|
579
|
+
placement: "bottom-end",
|
|
580
|
+
onClick: (a) => {
|
|
581
|
+
a.stopPropagation();
|
|
582
|
+
}
|
|
583
|
+
},
|
|
584
|
+
{
|
|
585
|
+
"menu-button": () => Y(X.FmButton, {
|
|
586
|
+
icon: "more_vert",
|
|
587
|
+
iconColor: "neutral-gray-400",
|
|
588
|
+
variant: "tertiary"
|
|
589
|
+
}),
|
|
590
|
+
default: () => [
|
|
591
|
+
Y(
|
|
592
|
+
X.FmMenuItem,
|
|
593
|
+
{
|
|
594
|
+
onClick: async (a) => {
|
|
595
|
+
a.stopPropagation(), x(o.row.original);
|
|
596
|
+
}
|
|
597
|
+
},
|
|
598
|
+
{
|
|
599
|
+
label: Y(
|
|
600
|
+
"div",
|
|
601
|
+
{
|
|
602
|
+
class: "fm-typo-en-body-md-400"
|
|
603
|
+
},
|
|
604
|
+
"Export"
|
|
605
|
+
)
|
|
606
|
+
}
|
|
607
|
+
),
|
|
608
|
+
Y(
|
|
609
|
+
X.FmMenuItem,
|
|
610
|
+
{
|
|
611
|
+
onClick: async (a) => {
|
|
612
|
+
a.stopPropagation(), S(o.row.original);
|
|
613
|
+
}
|
|
614
|
+
},
|
|
615
|
+
{
|
|
616
|
+
label: Y(
|
|
617
|
+
"div",
|
|
618
|
+
{
|
|
619
|
+
class: "text-fm-color-typo-error fm-typo-en-body-md-400"
|
|
620
|
+
},
|
|
621
|
+
"Remove"
|
|
622
|
+
)
|
|
623
|
+
}
|
|
624
|
+
)
|
|
625
|
+
]
|
|
626
|
+
}
|
|
627
|
+
)
|
|
628
|
+
]);
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
], n = z(null), { tableMeta: c, rowData: k, debouncedFetchData: $ } = xe(
|
|
632
|
+
N.readAll
|
|
633
|
+
);
|
|
634
|
+
async function h() {
|
|
635
|
+
await v(
|
|
636
|
+
async () => {
|
|
637
|
+
await N.refreshSegments(), await $({ pageSize: 10, pageIndex: 0 });
|
|
638
|
+
},
|
|
639
|
+
{ message: "Refreshing segmentations" }
|
|
640
|
+
);
|
|
641
|
+
}
|
|
642
|
+
async function S(o) {
|
|
643
|
+
await $e.remove(`Are you sure you want to remove ${o.name}?`) && await v(
|
|
644
|
+
async () => {
|
|
645
|
+
await N.delete(o._id), await $({ pageSize: 10, pageIndex: 0 });
|
|
646
|
+
},
|
|
647
|
+
{
|
|
648
|
+
message: `Removing ${o.name}`,
|
|
649
|
+
successMessage: `Removed ${o.name} successfully`
|
|
650
|
+
}
|
|
651
|
+
);
|
|
652
|
+
}
|
|
653
|
+
async function x(o) {
|
|
654
|
+
const a = {
|
|
655
|
+
sortBy: "_id",
|
|
656
|
+
descending: !1,
|
|
657
|
+
rowsPerPage: 1e3,
|
|
658
|
+
page: 1,
|
|
659
|
+
rowsNumber: 0
|
|
660
|
+
}, d = new Ne(), P = (await ve.read({
|
|
661
|
+
limit: 1,
|
|
662
|
+
skip: 0,
|
|
663
|
+
sortBy: a.sortBy,
|
|
664
|
+
descending: a.descending
|
|
665
|
+
})).meta.totalResources ?? 0, R = a.rowsPerPage;
|
|
666
|
+
await v(
|
|
667
|
+
async () => {
|
|
668
|
+
for (let B = 0; B < P; B += R) {
|
|
669
|
+
const V = {
|
|
670
|
+
...a,
|
|
671
|
+
limit: R,
|
|
672
|
+
skip: a.page - 1,
|
|
673
|
+
sortBy: a.sortBy,
|
|
674
|
+
descending: a.descending
|
|
675
|
+
}, j = await N.paginateSegmentUsers(
|
|
676
|
+
o._id,
|
|
677
|
+
V
|
|
678
|
+
);
|
|
679
|
+
for (const q of j.resources) {
|
|
680
|
+
const H = m(q);
|
|
681
|
+
d.addRecord(H);
|
|
682
|
+
}
|
|
683
|
+
a.page++;
|
|
684
|
+
}
|
|
685
|
+
await Fe(
|
|
686
|
+
d.buildExcel(),
|
|
687
|
+
`[${o.name}]-members-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
|
|
688
|
+
{
|
|
689
|
+
bookType: "xlsx",
|
|
690
|
+
bookSST: !1,
|
|
691
|
+
type: "array"
|
|
692
|
+
}
|
|
693
|
+
), a.page = 1;
|
|
694
|
+
},
|
|
695
|
+
{
|
|
696
|
+
message: "Exporting member...",
|
|
697
|
+
successMessage: "Member exported successfully"
|
|
698
|
+
}
|
|
699
|
+
);
|
|
700
|
+
}
|
|
701
|
+
async function I(o) {
|
|
702
|
+
await v(
|
|
703
|
+
async () => {
|
|
704
|
+
var a;
|
|
705
|
+
if (o.type === A.enum.STATIC) {
|
|
706
|
+
const d = new FormData();
|
|
707
|
+
if (d.append("file", o.file), o._id) {
|
|
708
|
+
const { members: P, _id: R, file: B, ...V } = o;
|
|
709
|
+
d.append("segment", JSON.stringify(V)), await N.updateStatic(o._id, d);
|
|
710
|
+
} else {
|
|
711
|
+
const { file: P, ...R } = o;
|
|
712
|
+
d.append("segment", JSON.stringify(R)), await N.createStatic(d);
|
|
713
|
+
}
|
|
714
|
+
o.file && y.open({
|
|
715
|
+
type: "info",
|
|
716
|
+
title: "Import begins soon. Check Queue for updates.",
|
|
717
|
+
action: "View",
|
|
718
|
+
onAction: async () => {
|
|
719
|
+
await f.push({
|
|
720
|
+
name: _e["$connect-QUEUE"],
|
|
721
|
+
query: { type: [fe.enum.SEGMENTATION_IMPORTED] }
|
|
722
|
+
});
|
|
723
|
+
}
|
|
724
|
+
});
|
|
725
|
+
} else if (o._id) {
|
|
726
|
+
const { members: d, _id: P, ...R } = o;
|
|
727
|
+
await N.update(o._id, R);
|
|
728
|
+
} else
|
|
729
|
+
await N.create(o);
|
|
730
|
+
await $({ pageSize: 10, pageIndex: 0 }), (a = n.value) == null || a.hideSheet();
|
|
731
|
+
},
|
|
732
|
+
{
|
|
733
|
+
message: "Saving segment",
|
|
734
|
+
successMessage: "Segment saved"
|
|
735
|
+
}
|
|
736
|
+
);
|
|
737
|
+
}
|
|
738
|
+
function u(o) {
|
|
739
|
+
var a;
|
|
740
|
+
(a = n.value) == null || a.showSheet(o);
|
|
741
|
+
}
|
|
742
|
+
const r = {
|
|
743
|
+
label: _("connect.navigation.queue"),
|
|
744
|
+
value: "queue",
|
|
745
|
+
isPrimary: !1,
|
|
746
|
+
prependIcon: "work_history"
|
|
747
|
+
}, g = ce(() => F.isPremium ? [
|
|
748
|
+
r,
|
|
749
|
+
{
|
|
750
|
+
label: "Refresh segments",
|
|
751
|
+
value: "refresh",
|
|
752
|
+
prependIcon: "refresh"
|
|
753
|
+
},
|
|
754
|
+
{
|
|
755
|
+
label: "Add segment",
|
|
756
|
+
value: "add",
|
|
757
|
+
isPrimary: !0,
|
|
758
|
+
prependIcon: "add"
|
|
759
|
+
}
|
|
760
|
+
] : []);
|
|
761
|
+
function U(o) {
|
|
762
|
+
switch (o) {
|
|
763
|
+
case "add":
|
|
764
|
+
u();
|
|
765
|
+
break;
|
|
766
|
+
case "refresh":
|
|
767
|
+
h();
|
|
768
|
+
break;
|
|
769
|
+
case "queue":
|
|
770
|
+
f.push({
|
|
771
|
+
name: _e["$connect-QUEUE"],
|
|
772
|
+
query: { type: [fe.enum.SEGMENTATION_IMPORTED] }
|
|
773
|
+
});
|
|
774
|
+
break;
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
return Te(async () => {
|
|
778
|
+
const { meta: o } = await ve.read({
|
|
779
|
+
limit: 1,
|
|
780
|
+
skip: 0,
|
|
781
|
+
sortBy: "_id",
|
|
782
|
+
search: void 0,
|
|
783
|
+
descending: !1
|
|
784
|
+
});
|
|
785
|
+
w.value = o.totalResources ?? 0, await $({ pageSize: 10, pageIndex: 0 }), await F.readPremium(), await F.readLocations();
|
|
786
|
+
}), (o, a) => {
|
|
787
|
+
const d = b("FmPill"), P = b("FmPageHead"), R = b("FmIcon"), B = b("FmMenuItem"), V = b("FmMenu"), j = b("FmListItem"), q = b("FmList"), H = b("FmButton"), te = b("FmCard");
|
|
788
|
+
return p(), C(O, null, [
|
|
789
|
+
i(P, {
|
|
790
|
+
title: "Segments",
|
|
791
|
+
actions: t(g),
|
|
792
|
+
"onClick:action": a[0] || (a[0] = (M) => U(M))
|
|
793
|
+
}, {
|
|
794
|
+
title: E(() => [
|
|
795
|
+
s("div", Rt, [
|
|
796
|
+
s("span", At, D(t(_)("connect.loyalty.segment.title")), 1),
|
|
797
|
+
i(d, { variant: "premium" })
|
|
798
|
+
])
|
|
799
|
+
]),
|
|
800
|
+
_: 1
|
|
801
|
+
}, 8, ["actions"]),
|
|
802
|
+
s("div", Dt, [
|
|
803
|
+
t(k).length > 0 || t(c).searchValue || t(c).isLoading ? (p(), C(O, { key: 0 }, [
|
|
804
|
+
i(be, {
|
|
805
|
+
loading: t(c).isLoading,
|
|
806
|
+
"row-data": t(k),
|
|
807
|
+
"row-count": t(c).totalRows,
|
|
808
|
+
"column-defs": l,
|
|
809
|
+
"shrink-at": !1,
|
|
810
|
+
"page-count": t(c).pageCount,
|
|
811
|
+
"page-index": t(c).pageIndex,
|
|
812
|
+
"page-size": t(c).pageSize,
|
|
813
|
+
onRowClick: a[1] || (a[1] = (M) => {
|
|
814
|
+
u(M.original);
|
|
815
|
+
}),
|
|
816
|
+
onPageChange: t($)
|
|
817
|
+
}, null, 8, ["loading", "row-data", "row-count", "page-count", "page-index", "page-size", "onPageChange"]),
|
|
818
|
+
i(q, { class: "w-full hidden xs:block" }, {
|
|
819
|
+
default: E(() => [
|
|
820
|
+
(p(!0), C(O, null, ie(t(k), (M) => (p(), J(j, {
|
|
821
|
+
key: M._id.toString(),
|
|
822
|
+
tag: "label",
|
|
823
|
+
onClick: (Q) => u(M)
|
|
824
|
+
}, {
|
|
825
|
+
default: E(() => [
|
|
826
|
+
s("div", null, [
|
|
827
|
+
s("div", Pt, D((M.memberCount ?? 0).toLocaleString()) + " total customers ", 1),
|
|
828
|
+
s("div", Nt, D(M.name), 1),
|
|
829
|
+
s("div", Bt, D(((M.memberCount ?? 0) * 100 / t(w)).toFixed(2)) + "% of customers ", 1)
|
|
830
|
+
])
|
|
831
|
+
]),
|
|
832
|
+
append: E(() => [
|
|
833
|
+
i(V, { "stop-click-propagation": !0 }, {
|
|
834
|
+
"menu-button": E(() => [
|
|
835
|
+
i(R, { name: "more_vert" })
|
|
836
|
+
]),
|
|
837
|
+
default: E(() => [
|
|
838
|
+
i(B, {
|
|
839
|
+
class: "text-fm-color-typo-error fm-typo-en-body-md-400",
|
|
840
|
+
label: "Remove",
|
|
841
|
+
"onUpdate:modelValue": (Q) => Q && S(M)
|
|
842
|
+
}, null, 8, ["onUpdate:modelValue"])
|
|
843
|
+
]),
|
|
844
|
+
_: 2
|
|
845
|
+
}, 1024)
|
|
846
|
+
]),
|
|
847
|
+
_: 2
|
|
848
|
+
}, 1032, ["onClick"]))), 128))
|
|
849
|
+
]),
|
|
850
|
+
_: 1
|
|
851
|
+
})
|
|
852
|
+
], 64)) : (p(), J(te, {
|
|
853
|
+
key: 1,
|
|
854
|
+
variant: "outlined",
|
|
855
|
+
class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
|
|
856
|
+
}, {
|
|
857
|
+
default: E(() => [
|
|
858
|
+
Vt,
|
|
859
|
+
Yt,
|
|
860
|
+
i(H, {
|
|
861
|
+
variant: "primary",
|
|
862
|
+
label: "Create segment",
|
|
863
|
+
disabled: !t(F).isPremium,
|
|
864
|
+
icon: "add",
|
|
865
|
+
onClick: a[2] || (a[2] = (M) => u())
|
|
866
|
+
}, null, 8, ["disabled"])
|
|
867
|
+
]),
|
|
868
|
+
_: 1
|
|
869
|
+
})),
|
|
870
|
+
i(Tt, {
|
|
871
|
+
ref_key: "sheetRef",
|
|
872
|
+
ref: n,
|
|
873
|
+
"onUpdate:modelValue": I
|
|
874
|
+
}, null, 512)
|
|
875
|
+
])
|
|
876
|
+
], 64);
|
|
877
|
+
};
|
|
878
|
+
}
|
|
879
|
+
});
|
|
880
|
+
export {
|
|
881
|
+
ho as default
|
|
882
|
+
};
|