@feedmepos/mf-connect 0.1.98-beta.13 → 0.1.98-beta.15
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/package.json +1 -1
- package/dist/App-DQqZfak3.js +0 -4782
- package/dist/AuditLogs-C19m85wp.js +0 -2013
- package/dist/Bin-GjJ5Q2ae.js +0 -166
- package/dist/Broadcast-CVTBL0T0.js +0 -266
- package/dist/CampaignTypeDialog.vue_vue_type_script_setup_true_lang-B6BYvVmq.js +0 -120
- package/dist/Card-DzYit3v6.js +0 -910
- package/dist/ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js +0 -97
- package/dist/Collections-CaU7auvn.js +0 -540
- package/dist/Credit-B_eUMV0R.js +0 -260
- package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-Du7fRSZC.js +0 -128
- package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-eIoPtgO5.js +0 -58
- package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-Bgcm1S_g.js +0 -3377
- package/dist/EffectSheet.vue_vue_type_style_index_0_lang-CZLoCJM4.js +0 -351
- package/dist/Experience-B7kxE07l.js +0 -259
- package/dist/FileSaver.min-BBvy4uPh.js +0 -74
- package/dist/FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js +0 -129
- package/dist/FmTableSelection.vue_vue_type_script_setup_true_lang-DzcUc0_w.js +0 -52
- package/dist/Game-B98hcWvR.js +0 -330
- package/dist/Grab-RdxV7xhM.js +0 -300
- package/dist/ImageInput.vue_vue_type_script_setup_true_lang-BBYekrJp.js +0 -145
- package/dist/Index-CvMVxCY5.js +0 -259
- package/dist/JsonViewer-v8_C7l5N.js +0 -87
- package/dist/LocationPicker.vue_vue_type_script_setup_true_lang-D4-wjMg6.js +0 -48
- package/dist/LottieAnimation.vue_vue_type_script_setup_true_lang-Jir8zY8e.js +0 -18737
- package/dist/LoyaltyDashboard-B1OzFT4q.js +0 -1082
- package/dist/MainLayout-De_edc-D.js +0 -41
- package/dist/Marketing-B7-To3XF.js +0 -235
- package/dist/MarketingMaterialEdit-DGONncxn.js +0 -1035
- package/dist/Member-DEGCrqnh.js +0 -280
- package/dist/MemberList-vKYbpLVu.js +0 -1601
- package/dist/MemberOverview-wL_ailso.js +0 -58
- package/dist/MemberTransactions-CGC3vYKC.js +0 -45
- package/dist/MessageInput.vue_vue_type_script_setup_true_lang-BP9YtuPA.js +0 -60802
- package/dist/Mission-hxf_AIGL.js +0 -334
- package/dist/Overview-NvgUuMYp.js +0 -949
- package/dist/Overview-iRLMLoAo.js +0 -1079
- package/dist/Point-tkUTXOCe.js +0 -262
- package/dist/Promotion-DNUcMKJQ.js +0 -397
- package/dist/Queue-5XYiIuG8.js +0 -260
- package/dist/Record-B5aYp7eF.js +0 -342
- package/dist/Review-BqaHlzXV.js +0 -45
- package/dist/ReviewFacebookCallback-BqlFkSB7.js +0 -248
- package/dist/ReviewGoogleCallback-ssKL4jh4.js +0 -213
- package/dist/Reward-1xOMowTW.js +0 -442
- package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-Db3FSfIc.js +0 -149
- package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-Cmrp2Tia.js +0 -1911
- package/dist/Segment-BMBwsUug.js +0 -1014
- package/dist/SelectItems.vue_vue_type_script_setup_true_lang-DSfdei-h.js +0 -181
- package/dist/SendCollectionSheet.vue_vue_type_script_setup_true_lang-BJVeGJ5J.js +0 -188
- package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-OBZubKUy.js +0 -226
- package/dist/Setting-DWygYkHW.js +0 -2047
- package/dist/SettingAdvertisements-TYB1b7dB.js +0 -264
- package/dist/Settings-DynjmCPL.js +0 -220
- package/dist/Store-DRYkmigC.js +0 -1996
- package/dist/StoreRewards-DU8eWbXE.js +0 -540
- package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-BkqBjEFm.js +0 -1130
- package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-l6KmXVBZ.js +0 -7007
- package/dist/Tier-4k8SxKtl.js +0 -969
- package/dist/Title-B9lWQ_jl.js +0 -566
- package/dist/Transaction-C38Yd0tf.js +0 -39
- package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-D6tgpKpc.js +0 -130
- package/dist/Voucher-BQbqC7RV.js +0 -421
- package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-erwpbvYi.js +0 -421
- package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-Dt05b7fU.js +0 -56
- package/dist/_plugin-vue_export-helper-CHgC5LLL.js +0 -9
- package/dist/app-BTm9mz0r.js +0 -59940
- package/dist/app-wDQR6dpb.js +0 -39
- package/dist/app.js +0 -7
- package/dist/business-B7GwHLce.js +0 -82
- package/dist/campaign-BCdKDHgz.js +0 -277
- package/dist/campaign-CpzFl8Vr.js +0 -4
- package/dist/campaign-DWlsbsKQ.js +0 -219
- package/dist/campaign.enum-BgK4maXz.js +0 -26
- package/dist/campaign.fn-DxnwGCB2.js +0 -776
- package/dist/collectible.enum-CdOSUDwG.js +0 -19
- package/dist/duplicateCampaign-BSHe0P-g.js +0 -51
- package/dist/effect-C7wkN_13.js +0 -89
- package/dist/email-addresses-DJycNI7L.js +0 -705
- package/dist/export-uIHWDxuh.js +0 -97
- package/dist/feedme.ico +0 -0
- package/dist/google-BQK68wbe.js +0 -5
- package/dist/helper-czpAhAIw.js +0 -86
- package/dist/index-5Sa4xS2m.js +0 -151
- package/dist/index-5WGEWCcI.js +0 -3
- package/dist/index-B2C7kc4z.js +0 -31
- package/dist/index-B5eb6_bi.js +0 -3678
- package/dist/index-B7nE1Pb2.js +0 -67
- package/dist/index-BFAHLexA.js +0 -32
- package/dist/index-BanxlNli.js +0 -8910
- package/dist/index-ByHoFriu.js +0 -85
- package/dist/index-Ca2bBJuR.js +0 -54
- package/dist/index-CuvNtC_M.js +0 -61
- package/dist/index-D-kYrDAi.js +0 -30289
- package/dist/index-D2gAYMIp.js +0 -28900
- package/dist/index-DWxmK2NJ.js +0 -61
- package/dist/index-U_rwkNKU.js +0 -2819
- package/dist/index-knizSLfz.js +0 -1157
- package/dist/index-vh86FiIQ.js +0 -10
- package/dist/index.esm2017-DFVkiPjd.js +0 -3069
- package/dist/loading-B3OgwEC8.js +0 -72
- package/dist/lodash-CiRTkvui.js +0 -3678
- package/dist/membership-s2VKnu_8.js +0 -255
- package/dist/moment-D7p2TMB-.js +0 -2583
- package/dist/money-DqxOXYd0.js +0 -15
- package/dist/number-Bt4sacaM.js +0 -12
- package/dist/object-BYyQ0PZp.js +0 -18
- package/dist/objectId-dwaoBfJX.js +0 -7
- package/dist/objectid-CxCupSWP.js +0 -145
- package/dist/plugins-CQ1JAqJB.js +0 -1788
- package/dist/reward-pjbal-XX.js +0 -36
- package/dist/rule-CzU2GAur.js +0 -1969
- package/dist/string-Gcy5IM_H.js +0 -32
- package/dist/style.css +0 -4
- package/dist/template-7yiMSL1f.js +0 -188
- package/dist/tier-BJDhpH6X.js +0 -4
- package/dist/tiers/tier=1.png +0 -0
- package/dist/tiers/tier=2.png +0 -0
- package/dist/tiers/tier=3.png +0 -0
- package/dist/tiers/tier=4.png +0 -0
- package/dist/titles/type=diamond.png +0 -0
- package/dist/titles/type=drinks.png +0 -0
- package/dist/titles/type=food.png +0 -0
- package/dist/titles/type=heart.png +0 -0
- package/dist/titles/type=medal.png +0 -0
- package/dist/titles/type=spend.png +0 -0
- package/dist/titles/type=thank-you.png +0 -0
- package/dist/titles/type=thumbs-up.png +0 -0
- package/dist/titles/type=years.png +0 -0
- package/dist/trigger-C5bqlYHn.js +0 -213
- package/dist/tslib.es6-BCqqvLQ_.js +0 -44
- package/dist/type_drinks-D6jnpvwV.js +0 -4
- package/dist/useMarketingMaterialActions-CW_QRtQb.js +0 -107
- package/dist/usePagination-D2pke4vy.js +0 -220
- package/dist/user-BcXrT_t5.js +0 -55
- package/dist/vue-i18n-CFNkj6JK.js +0 -2365
- package/dist/xlsx-DyVY5_Qx.js +0 -15491
- package/dist/zod-BD_8DRqQ.js +0 -91
package/dist/Segment-BMBwsUug.js
DELETED
|
@@ -1,1014 +0,0 @@
|
|
|
1
|
-
import { defineComponent as le, ref as W, resolveComponent as S, openBlock as r, createElementBlock as k, createElementVNode as s, createVNode as d, unref as e, createCommentVNode as J, withCtx as $, Fragment as Z, renderList as me, createBlock as V, toDisplayString as D, normalizeClass as ce, computed as O, onMounted as we, isRef as Te, createSlots as Ee, h as B, onBeforeMount as De } from "vue";
|
|
2
|
-
import { _ as $e } from "./campaign-CpzFl8Vr.js";
|
|
3
|
-
import { n as Ae, p as Pe } from "./plugins-CQ1JAqJB.js";
|
|
4
|
-
import { u as Re } from "./loading-B3OgwEC8.js";
|
|
5
|
-
import { FmButtonVariant as re, useSnackbar as Ne, components as ae } from "@feedmepos/ui-library";
|
|
6
|
-
import { u as Fe, _ as Ce } from "./usePagination-D2pke4vy.js";
|
|
7
|
-
import { u as pe } from "./vue-i18n-CFNkj6JK.js";
|
|
8
|
-
import { R as ye } from "./index-U_rwkNKU.js";
|
|
9
|
-
import { i as Be, j as U, D as Ue, k as Ve, c as ge } from "./index-B5eb6_bi.js";
|
|
10
|
-
import "./index-BanxlNli.js";
|
|
11
|
-
import { F as ve, z as Le } from "./index-D-kYrDAi.js";
|
|
12
|
-
import "./index-Ca2bBJuR.js";
|
|
13
|
-
import { u as de, w as ke } from "./xlsx-DyVY5_Qx.js";
|
|
14
|
-
import { e as Ye, M as ze } from "./email-addresses-DJycNI7L.js";
|
|
15
|
-
import { Z as Oe } from "./zod-BD_8DRqQ.js";
|
|
16
|
-
import { u as je } from "./app-wDQR6dpb.js";
|
|
17
|
-
import { _ as qe } from "./ZodTextField.vue_vue_type_script_setup_true_lang-Dt05b7fU.js";
|
|
18
|
-
import { _ as Ge } from "./RuleGroup.vue_vue_type_script_setup_true_lang-Cmrp2Tia.js";
|
|
19
|
-
import { u as He, v as Je, w as Ke } from "./index.esm2017-DFVkiPjd.js";
|
|
20
|
-
import { F as Qe } from "./FileSaver.min-BBvy4uPh.js";
|
|
21
|
-
import { h as se } from "./moment-D7p2TMB-.js";
|
|
22
|
-
import { s as z, u as We } from "./membership-s2VKnu_8.js";
|
|
23
|
-
import { o as Ze } from "./objectId-dwaoBfJX.js";
|
|
24
|
-
import { J as Xe } from "./JsonViewer-v8_C7l5N.js";
|
|
25
|
-
import { u as Ie } from "./business-B7GwHLce.js";
|
|
26
|
-
import { f as et } from "./number-Bt4sacaM.js";
|
|
27
|
-
import { t as tt } from "./money-DqxOXYd0.js";
|
|
28
|
-
import "./index-5WGEWCcI.js";
|
|
29
|
-
import { useRouter as ot } from "vue-router";
|
|
30
|
-
import { m as _e } from "./index-ByHoFriu.js";
|
|
31
|
-
import { R as xe } from "./app-BTm9mz0r.js";
|
|
32
|
-
const nt = Be.extend({
|
|
33
|
-
_id: ve.optional(),
|
|
34
|
-
business: ve.optional(),
|
|
35
|
-
file: Le.any().nullish()
|
|
36
|
-
});
|
|
37
|
-
var at = { firebase: { apiKey: "AIzaSyAj8JdCHtP0Vc5vZobCfgoLzWxPIn0WUG4", authDomain: "feedme-dev-4c3ef.firebaseapp.com", databaseURL: "https://feedme-dev-4c3ef.firebaseio.com", projectId: "feedme-dev-4c3ef", storageBucket: "feedme-dev-4c3ef.appspot.com", messagingSenderId: "458797803788", appId: "1:458797803788:web:37f2af2926a84288f0c129", measurementId: "G-J2QG09D2Q7" }, assetBucketUrl: "feedme-dev-4c3ef.appspot.com", importFilesBucketUrl: "feedme-dev-4c3ef.appspot.com", clientId: "1a362d621873497b277ea55258cc82594ba148d235257f7bd44ea2acc132d8a4" };
|
|
38
|
-
const st = { class: "flex flex-col space-y-16" }, lt = {
|
|
39
|
-
key: 0,
|
|
40
|
-
class: /* @__PURE__ */ ce([
|
|
41
|
-
"p-16 pl-24 space-x-8",
|
|
42
|
-
"bg-fm-color-primary-oats rounded-lg",
|
|
43
|
-
"flex items-center",
|
|
44
|
-
"justify-between"
|
|
45
|
-
])
|
|
46
|
-
}, it = { class: "flex justify-end" }, ct = {
|
|
47
|
-
key: 1,
|
|
48
|
-
class: /* @__PURE__ */ ce([
|
|
49
|
-
"flex items-center",
|
|
50
|
-
"border border-fm-color-neutral-gray-300",
|
|
51
|
-
"p-16 space-x-16 rounded-md"
|
|
52
|
-
])
|
|
53
|
-
}, rt = { class: "fm-typo-en-body-lg-400 flex-1 truncate" }, dt = /* @__PURE__ */ le({
|
|
54
|
-
__name: "ImportSegment",
|
|
55
|
-
props: {
|
|
56
|
-
importFile: {}
|
|
57
|
-
},
|
|
58
|
-
emits: ["update:file"],
|
|
59
|
-
setup(t, { emit: f }) {
|
|
60
|
-
const c = t, M = f, { t: b } = pe(), _ = W(null), u = W(null), T = ["Id"], E = [
|
|
61
|
-
{
|
|
62
|
-
label: "CSV",
|
|
63
|
-
icon: "csv",
|
|
64
|
-
value: "csv"
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
label: "Excel",
|
|
68
|
-
icon: "description",
|
|
69
|
-
value: "xlsx"
|
|
70
|
-
}
|
|
71
|
-
];
|
|
72
|
-
async function a() {
|
|
73
|
-
if (c.importFile)
|
|
74
|
-
try {
|
|
75
|
-
const y = He(void 0, at.importFilesBucketUrl), p = Je(y, c.importFile), g = await Ke(p);
|
|
76
|
-
window.open(g, "_blank");
|
|
77
|
-
} catch (y) {
|
|
78
|
-
console.log(y), Ae.error("Failed to download uploaded file");
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
async function m(y) {
|
|
82
|
-
switch (y) {
|
|
83
|
-
case "csv":
|
|
84
|
-
const p = new Blob([T.join(",")], {
|
|
85
|
-
type: "text/csv;charset=utf-8;"
|
|
86
|
-
});
|
|
87
|
-
Qe.saveAs(p, "ImportSegmentTemplate.csv");
|
|
88
|
-
break;
|
|
89
|
-
case "xlsx":
|
|
90
|
-
const g = de.aoa_to_sheet([T]), x = de.book_new();
|
|
91
|
-
de.book_append_sheet(x, g, "Sheet1"), ke(x, "ImportSegmentTemplate.xlsx");
|
|
92
|
-
break;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
function i(y) {
|
|
96
|
-
_.value = y, M("update:file", _.value);
|
|
97
|
-
}
|
|
98
|
-
function A(y) {
|
|
99
|
-
var g, x;
|
|
100
|
-
const p = ((x = (g = y.target) == null ? void 0 : g.files) == null ? void 0 : x[0]) ?? null;
|
|
101
|
-
i(p);
|
|
102
|
-
}
|
|
103
|
-
return (y, p) => {
|
|
104
|
-
const g = S("FmButton"), x = S("FmMenuItem"), j = S("FmMenu"), q = S("FmDropField");
|
|
105
|
-
return r(), k("div", st, [
|
|
106
|
-
p[2] || (p[2] = s("div", { class: "fm-typo-en-title-sm-800" }, "Upload File", -1)),
|
|
107
|
-
t.importFile ? (r(), k("div", lt, [
|
|
108
|
-
d(g, {
|
|
109
|
-
label: e(b)("View uploaded file"),
|
|
110
|
-
variant: e(re).Plain,
|
|
111
|
-
icon: "file_present",
|
|
112
|
-
onClick: a
|
|
113
|
-
}, null, 8, ["label", "variant"])
|
|
114
|
-
])) : J("", !0),
|
|
115
|
-
s("div", null, [
|
|
116
|
-
s("div", it, [
|
|
117
|
-
d(j, { class: "" }, {
|
|
118
|
-
"menu-button": $(() => [
|
|
119
|
-
d(g, {
|
|
120
|
-
variant: "tertiary",
|
|
121
|
-
icon: "download",
|
|
122
|
-
label: "Download Template"
|
|
123
|
-
})
|
|
124
|
-
]),
|
|
125
|
-
default: $(() => [
|
|
126
|
-
(r(), k(Z, null, me(E, (I) => d(x, {
|
|
127
|
-
key: I.value,
|
|
128
|
-
icon: I.icon,
|
|
129
|
-
label: I.label,
|
|
130
|
-
onClick: (G) => m(I.value),
|
|
131
|
-
selectable: ""
|
|
132
|
-
}, null, 8, ["icon", "label", "onClick"])), 64))
|
|
133
|
-
]),
|
|
134
|
-
_: 1
|
|
135
|
-
})
|
|
136
|
-
]),
|
|
137
|
-
_.value ? (r(), k("div", ct, [
|
|
138
|
-
d(g, {
|
|
139
|
-
variant: e(re).Tertiary,
|
|
140
|
-
"prepend-icon": "attach_file"
|
|
141
|
-
}, null, 8, ["variant"]),
|
|
142
|
-
s("p", rt, D(_.value.name), 1),
|
|
143
|
-
s("label", {
|
|
144
|
-
ref_key: "fileLabelRef",
|
|
145
|
-
ref: u,
|
|
146
|
-
htmlFor: "file"
|
|
147
|
-
}, [
|
|
148
|
-
d(g, {
|
|
149
|
-
variant: e(re).Plain,
|
|
150
|
-
label: e(b)("Replace File"),
|
|
151
|
-
onClick: p[1] || (p[1] = () => {
|
|
152
|
-
var I;
|
|
153
|
-
return (I = u.value) == null ? void 0 : I.click();
|
|
154
|
-
})
|
|
155
|
-
}, null, 8, ["variant", "label"]),
|
|
156
|
-
s("input", {
|
|
157
|
-
id: "file",
|
|
158
|
-
accept: ".csv",
|
|
159
|
-
class: "hidden",
|
|
160
|
-
type: "file",
|
|
161
|
-
multiple: "",
|
|
162
|
-
onChange: A
|
|
163
|
-
}, null, 32)
|
|
164
|
-
], 512)
|
|
165
|
-
])) : (r(), V(q, {
|
|
166
|
-
key: 0,
|
|
167
|
-
onFileUpload: p[0] || (p[0] = (I) => i(I)),
|
|
168
|
-
accept: ".csv, .xlsx",
|
|
169
|
-
"max-file-size": 2e7
|
|
170
|
-
}))
|
|
171
|
-
])
|
|
172
|
-
]);
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
}), ut = { class: "space-y-16 pr-12" }, mt = { class: "fm-typo-en-title-md-800" }, pt = { class: "flex space-x-8" }, ft = { class: "fm-typo-en-title-md-800 text-fm-color-primary" }, yt = { class: "text-fm-color-typo-secondary" }, Se = /* @__PURE__ */ le({
|
|
176
|
-
__name: "ReviewSegment",
|
|
177
|
-
props: {
|
|
178
|
-
title: {},
|
|
179
|
-
segment: {}
|
|
180
|
-
},
|
|
181
|
-
setup(t) {
|
|
182
|
-
const f = t, c = O(
|
|
183
|
-
() => f.segment.memberCount ?? f.segment.members.length
|
|
184
|
-
), M = O(
|
|
185
|
-
() => f.segment.lastUpdated ? se(f.segment.lastUpdated).format("DD MMM YYYY") : "Not refreshed yet"
|
|
186
|
-
), b = [
|
|
187
|
-
{
|
|
188
|
-
header: "Name",
|
|
189
|
-
accessorFn: (i) => i.name
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
header: "Id",
|
|
193
|
-
accessorFn: (i) => i._id
|
|
194
|
-
},
|
|
195
|
-
{
|
|
196
|
-
header: "Customer Since",
|
|
197
|
-
accessorFn: (i) => se(Ze(i._id.toString())).format("DD MMM YYYY")
|
|
198
|
-
},
|
|
199
|
-
{
|
|
200
|
-
header: "Phone",
|
|
201
|
-
accessorFn: (i) => i.phoneNumber
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
header: "Birthday",
|
|
205
|
-
accessorFn: (i) => se(i.birthday).format("DD MMM YYYY")
|
|
206
|
-
},
|
|
207
|
-
{
|
|
208
|
-
header: "Last Visit",
|
|
209
|
-
accessorFn: (i) => se(i.stats.lastVisit).format("DD MMM YYYY")
|
|
210
|
-
}
|
|
211
|
-
];
|
|
212
|
-
async function _(i) {
|
|
213
|
-
return f.segment._id ? (console.log(i), await z.paginateSegmentUsers(
|
|
214
|
-
f.segment._id,
|
|
215
|
-
i
|
|
216
|
-
)) : {
|
|
217
|
-
resources: [],
|
|
218
|
-
meta: {
|
|
219
|
-
totalResources: 0,
|
|
220
|
-
totalPages: 0,
|
|
221
|
-
skip: i.skip,
|
|
222
|
-
limit: i.limit,
|
|
223
|
-
sortBy: i.sortBy
|
|
224
|
-
}
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
const { tableMeta: u, rowData: T, onSort: E, debouncedFetchData: a, onSearch: m } = Fe(_);
|
|
228
|
-
return we(async () => {
|
|
229
|
-
await a();
|
|
230
|
-
}), (i, A) => (r(), k("div", ut, [
|
|
231
|
-
s("div", mt, D(f.title), 1),
|
|
232
|
-
s("div", pt, [
|
|
233
|
-
s("div", ft, D(e(c)), 1),
|
|
234
|
-
s("div", yt, [
|
|
235
|
-
A[1] || (A[1] = s("div", null, "contacts in your segment", -1)),
|
|
236
|
-
s("div", null, "as of " + D(e(M)), 1)
|
|
237
|
-
])
|
|
238
|
-
]),
|
|
239
|
-
d(Ce, {
|
|
240
|
-
loading: e(u).isLoading,
|
|
241
|
-
"row-data": e(T),
|
|
242
|
-
"row-count": e(u).totalRows,
|
|
243
|
-
"column-defs": b,
|
|
244
|
-
"page-size": e(u).pageSize,
|
|
245
|
-
"page-count": e(u).pageCount,
|
|
246
|
-
"page-index": e(u).pageIndex,
|
|
247
|
-
onSortChange: e(E),
|
|
248
|
-
onPageChange: A[0] || (A[0] = (y) => e(a)({ pageSize: y.pageSize, pageIndex: y.pageIndex }))
|
|
249
|
-
}, null, 8, ["loading", "row-data", "row-count", "page-size", "page-count", "page-index", "onSortChange"])
|
|
250
|
-
]));
|
|
251
|
-
}
|
|
252
|
-
}), gt = { class: "space-y-24" }, vt = { class: "grid grid-cols-2 gap-16" }, _t = { class: "fm-typo-en-title-sm-800" }, xt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, St = /* @__PURE__ */ le({
|
|
253
|
-
__name: "SegmentTypeOption",
|
|
254
|
-
props: {
|
|
255
|
-
modelValue: {},
|
|
256
|
-
errorText: {}
|
|
257
|
-
},
|
|
258
|
-
emits: ["update:model-value"],
|
|
259
|
-
setup(t, { emit: f }) {
|
|
260
|
-
const c = t, M = f, b = [
|
|
261
|
-
{
|
|
262
|
-
label: "Dynamic",
|
|
263
|
-
sublabel: "Segment statistics are based on rules configured and will be recalculated automatically when rule changes.",
|
|
264
|
-
value: U.enum.DYNAMIC
|
|
265
|
-
},
|
|
266
|
-
{
|
|
267
|
-
label: "Static",
|
|
268
|
-
sublabel: "Segment statistics are based on imported data and will not be recalculated.",
|
|
269
|
-
value: U.enum.STATIC
|
|
270
|
-
}
|
|
271
|
-
];
|
|
272
|
-
function _(u) {
|
|
273
|
-
u !== c.modelValue && M("update:model-value", u);
|
|
274
|
-
}
|
|
275
|
-
return (u, T) => {
|
|
276
|
-
const E = S("FmCard"), a = S("FmHelperText");
|
|
277
|
-
return r(), k("div", gt, [
|
|
278
|
-
s("div", vt, [
|
|
279
|
-
(r(), k(Z, null, me(b, (m) => d(E, {
|
|
280
|
-
variant: "outlined",
|
|
281
|
-
class: ce(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-2", {
|
|
282
|
-
"col-span-2": b.length == 1,
|
|
283
|
-
"border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": t.modelValue === m.value,
|
|
284
|
-
"hover:bg-fm-color-opacity-sm": t.modelValue !== m.value
|
|
285
|
-
}]),
|
|
286
|
-
onClick: (i) => _(m.value),
|
|
287
|
-
key: m.value
|
|
288
|
-
}, {
|
|
289
|
-
default: $(() => [
|
|
290
|
-
s("div", _t, D(m.label), 1),
|
|
291
|
-
s("div", xt, D(m.sublabel), 1)
|
|
292
|
-
]),
|
|
293
|
-
_: 2
|
|
294
|
-
}, 1032, ["class", "onClick"])), 64))
|
|
295
|
-
]),
|
|
296
|
-
t.errorText ? (r(), V(a, {
|
|
297
|
-
key: 0,
|
|
298
|
-
class: "!mt-4",
|
|
299
|
-
text: t.errorText,
|
|
300
|
-
state: "error"
|
|
301
|
-
}, null, 8, ["text"])) : J("", !0)
|
|
302
|
-
]);
|
|
303
|
-
};
|
|
304
|
-
}
|
|
305
|
-
}), ht = { class: "flex items-center gap-x-8" }, bt = {
|
|
306
|
-
key: 0,
|
|
307
|
-
class: "space-y-16 pr-12"
|
|
308
|
-
}, wt = {
|
|
309
|
-
key: 0,
|
|
310
|
-
class: "flex flex-col gap-12"
|
|
311
|
-
}, Ft = { class: "flex flex-wrap items-center gap-8" }, Ct = { class: "fm-typo-en-title-sm-800" }, kt = { class: "flex flex-col gap-4" }, It = { class: "fm-typo-en-body-md-600 text-fm-color-typo-primary" }, Mt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Tt = {
|
|
312
|
-
key: 2,
|
|
313
|
-
class: "flex flex-col space-y-16"
|
|
314
|
-
}, Et = {
|
|
315
|
-
key: 3,
|
|
316
|
-
class: "flex flex-col space-y-16"
|
|
317
|
-
}, Dt = {
|
|
318
|
-
key: 4,
|
|
319
|
-
class: "flex flex-col space-y-16"
|
|
320
|
-
}, $t = {
|
|
321
|
-
key: 5,
|
|
322
|
-
class: "flex flex-col space-y-16"
|
|
323
|
-
}, At = { class: "flex items-center gap-8" }, Pt = /* @__PURE__ */ le({
|
|
324
|
-
__name: "SegmentSheet",
|
|
325
|
-
emits: ["update:model-value"],
|
|
326
|
-
setup(t, { expose: f, emit: c }) {
|
|
327
|
-
const M = je(), { t: b } = pe(), _ = W(!1), u = W(!1), T = {
|
|
328
|
-
name: "",
|
|
329
|
-
isActive: !0,
|
|
330
|
-
type: U.enum.DYNAMIC,
|
|
331
|
-
rule: ye.scaffoldGroup(),
|
|
332
|
-
members: []
|
|
333
|
-
}, E = nt, a = W(T), m = O(() => !!a.value.defaultKey), i = O(
|
|
334
|
-
() => a.value.defaultKey ? `connect.loyalty.segment.default_segments.${a.value.defaultKey.toLowerCase()}` : void 0
|
|
335
|
-
), A = O(
|
|
336
|
-
() => i.value ? b(`${i.value}.name`) : a.value.name
|
|
337
|
-
), y = O(() => {
|
|
338
|
-
const v = a.value.defaultKey;
|
|
339
|
-
return v ? b(Ue[v]) : a.value.description ?? "";
|
|
340
|
-
}), p = O(() => {
|
|
341
|
-
const v = E.safeParse(a.value);
|
|
342
|
-
return v.success ? [] : v.error.errors;
|
|
343
|
-
});
|
|
344
|
-
function g(v) {
|
|
345
|
-
_.value = !0, u.value = !1, v ? a.value = {
|
|
346
|
-
...v,
|
|
347
|
-
isActive: v.isActive !== !1,
|
|
348
|
-
type: v.type ?? (v.importFile ? U.enum.STATIC : U.enum.DYNAMIC)
|
|
349
|
-
} : a.value = { ...T };
|
|
350
|
-
}
|
|
351
|
-
function x() {
|
|
352
|
-
_.value = !1;
|
|
353
|
-
}
|
|
354
|
-
async function j() {
|
|
355
|
-
E.safeParse(a.value).success && (u.value = !0);
|
|
356
|
-
}
|
|
357
|
-
function q(v) {
|
|
358
|
-
v === U.enum.STATIC ? x() : u.value = !1;
|
|
359
|
-
}
|
|
360
|
-
async function I() {
|
|
361
|
-
a.value.type === U.enum.STATIC ? (a.value.rule = ye.scaffoldGroup(), a.value.isActive = !0) : a.value.file = void 0, K("update:model-value", a.value);
|
|
362
|
-
}
|
|
363
|
-
async function G(v) {
|
|
364
|
-
a.value.type = v;
|
|
365
|
-
}
|
|
366
|
-
we(async () => {
|
|
367
|
-
});
|
|
368
|
-
const K = c;
|
|
369
|
-
return f({
|
|
370
|
-
showSheet: g,
|
|
371
|
-
hideSheet: x
|
|
372
|
-
}), (v, l) => {
|
|
373
|
-
const P = S("FmButton"), X = S("FmChip"), ee = S("FmCard"), te = S("FmSwitch"), o = S("FmSideSheet");
|
|
374
|
-
return r(), V(o, {
|
|
375
|
-
modelValue: e(_),
|
|
376
|
-
"onUpdate:modelValue": l[9] || (l[9] = (n) => Te(_) ? _.value = n : null),
|
|
377
|
-
header: e(m) ? e(b)("connect.loyalty.segment.default_segments.default_segment") : e(a)._id ? "Edit segment" : "Add segment",
|
|
378
|
-
"dismiss-away": "",
|
|
379
|
-
"close-button": !0,
|
|
380
|
-
"max-width": 1100
|
|
381
|
-
}, Ee({
|
|
382
|
-
"side-sheet-footer": $(() => [
|
|
383
|
-
s("div", At, [
|
|
384
|
-
e(m) ? (r(), V(P, {
|
|
385
|
-
key: 0,
|
|
386
|
-
label: e(b)("connect.loyalty.segment.default_segments.close"),
|
|
387
|
-
onClick: l[6] || (l[6] = (n) => x()),
|
|
388
|
-
variant: "tertiary"
|
|
389
|
-
}, null, 8, ["label"])) : e(u) || e(a).type === e(U).enum.STATIC ? (r(), k(Z, { key: 1 }, [
|
|
390
|
-
d(P, {
|
|
391
|
-
label: "Save Segment",
|
|
392
|
-
onClick: I,
|
|
393
|
-
loading: e(M).isLoading,
|
|
394
|
-
disabled: e(p).length > 0 || e(M).isLoading
|
|
395
|
-
}, null, 8, ["loading", "disabled"]),
|
|
396
|
-
d(P, {
|
|
397
|
-
label: "Cancel",
|
|
398
|
-
onClick: l[7] || (l[7] = (n) => q(e(a).type)),
|
|
399
|
-
variant: "tertiary"
|
|
400
|
-
})
|
|
401
|
-
], 64)) : (r(), k(Z, { key: 2 }, [
|
|
402
|
-
d(P, {
|
|
403
|
-
label: "Review Segment",
|
|
404
|
-
disabled: e(p).length > 0 || e(M).isLoading,
|
|
405
|
-
onClick: j
|
|
406
|
-
}, null, 8, ["disabled"]),
|
|
407
|
-
d(P, {
|
|
408
|
-
label: "Cancel",
|
|
409
|
-
onClick: l[8] || (l[8] = (n) => x()),
|
|
410
|
-
variant: "tertiary"
|
|
411
|
-
})
|
|
412
|
-
], 64))
|
|
413
|
-
])
|
|
414
|
-
]),
|
|
415
|
-
default: $(() => {
|
|
416
|
-
var n, F;
|
|
417
|
-
return [
|
|
418
|
-
d(Xe, { json: e(a) }, null, 8, ["json"]),
|
|
419
|
-
e(u) ? (r(), V(Se, {
|
|
420
|
-
key: 1,
|
|
421
|
-
title: e(a).name,
|
|
422
|
-
segment: e(a)
|
|
423
|
-
}, null, 8, ["title", "segment"])) : (r(), k("div", bt, [
|
|
424
|
-
e(m) ? (r(), k("div", wt, [
|
|
425
|
-
s("div", Ft, [
|
|
426
|
-
s("div", Ct, D(e(A)), 1),
|
|
427
|
-
d(X, {
|
|
428
|
-
label: e(b)("connect.loyalty.segment.default_segments.system"),
|
|
429
|
-
compact: "",
|
|
430
|
-
class: "text-fm-color-typo-info bg-fm-color-system-info-100"
|
|
431
|
-
}, null, 8, ["label"])
|
|
432
|
-
]),
|
|
433
|
-
d(ee, {
|
|
434
|
-
variant: "outlined",
|
|
435
|
-
class: "p-16"
|
|
436
|
-
}, {
|
|
437
|
-
default: $(() => [
|
|
438
|
-
s("div", kt, [
|
|
439
|
-
s("div", It, D(e(b)("connect.loyalty.segment.default_segments.description")), 1),
|
|
440
|
-
s("div", Mt, D(e(y)), 1)
|
|
441
|
-
])
|
|
442
|
-
]),
|
|
443
|
-
_: 1
|
|
444
|
-
})
|
|
445
|
-
])) : (r(), V(qe, {
|
|
446
|
-
key: 1,
|
|
447
|
-
modelValue: e(a).name,
|
|
448
|
-
"onUpdate:modelValue": l[1] || (l[1] = (w) => e(a).name = w),
|
|
449
|
-
label: "Segment title",
|
|
450
|
-
schema: e(Oe).typeAtPath(e(E), "name")
|
|
451
|
-
}, null, 8, ["modelValue", "schema"])),
|
|
452
|
-
e(m) ? J("", !0) : (r(), k("div", Tt, [
|
|
453
|
-
l[11] || (l[11] = s("div", { class: "fm-typo-en-title-sm-800" }, "Segment Type", -1)),
|
|
454
|
-
d(St, {
|
|
455
|
-
"model-value": e(a).type,
|
|
456
|
-
"onUpdate:modelValue": l[2] || (l[2] = (w) => {
|
|
457
|
-
G(w);
|
|
458
|
-
})
|
|
459
|
-
}, null, 8, ["model-value"])
|
|
460
|
-
])),
|
|
461
|
-
e(a).type === e(U).enum.DYNAMIC && !e(m) ? (r(), k("div", Et, [
|
|
462
|
-
l[12] || (l[12] = s("div", { class: "fm-typo-en-title-sm-800" }, "Segment Filter", -1)),
|
|
463
|
-
d(Ge, {
|
|
464
|
-
"trigger-type": "MEMBERSHIP_JOINED",
|
|
465
|
-
includeOnly: "user",
|
|
466
|
-
"model-value": (n = e(a)) == null ? void 0 : n.rule,
|
|
467
|
-
"onUpdate:modelValue": l[3] || (l[3] = (w) => {
|
|
468
|
-
e(a).rule = w;
|
|
469
|
-
})
|
|
470
|
-
}, null, 8, ["model-value"])
|
|
471
|
-
])) : e(m) ? J("", !0) : (r(), k("div", Dt, [
|
|
472
|
-
d(dt, {
|
|
473
|
-
importFile: e(a).importFile,
|
|
474
|
-
"onUpdate:file": l[4] || (l[4] = (w) => {
|
|
475
|
-
e(a).file = w;
|
|
476
|
-
})
|
|
477
|
-
}, null, 8, ["importFile"])
|
|
478
|
-
])),
|
|
479
|
-
e(a).type === e(U).enum.DYNAMIC && !e(m) ? (r(), k("div", $t, [
|
|
480
|
-
l[13] || (l[13] = s("div", { class: "fm-typo-en-title-sm-800" }, "Segment Status", -1)),
|
|
481
|
-
d(te, {
|
|
482
|
-
"model-value": e(a).isActive ?? !0,
|
|
483
|
-
"onUpdate:modelValue": l[5] || (l[5] = (w) => e(a).isActive = w),
|
|
484
|
-
label: "Active",
|
|
485
|
-
sublabel: "When enabled, this will recalculate the segment statistics daily.",
|
|
486
|
-
"label-placement": "right"
|
|
487
|
-
}, null, 8, ["model-value"])
|
|
488
|
-
])) : J("", !0),
|
|
489
|
-
e(m) ? (r(), V(Se, {
|
|
490
|
-
key: (F = e(a)._id) == null ? void 0 : F.toString(),
|
|
491
|
-
title: e(b)("connect.loyalty.segment.default_segments.members"),
|
|
492
|
-
segment: e(a)
|
|
493
|
-
}, null, 8, ["title", "segment"])) : J("", !0)
|
|
494
|
-
]))
|
|
495
|
-
];
|
|
496
|
-
}),
|
|
497
|
-
_: 2
|
|
498
|
-
}, [
|
|
499
|
-
e(u) && !e(m) ? {
|
|
500
|
-
name: "side-sheet-header",
|
|
501
|
-
fn: $(() => [
|
|
502
|
-
s("div", ht, [
|
|
503
|
-
d(P, {
|
|
504
|
-
icon: "arrow_back",
|
|
505
|
-
variant: "tertiary",
|
|
506
|
-
onClick: l[0] || (l[0] = (n) => u.value = !1)
|
|
507
|
-
}),
|
|
508
|
-
l[10] || (l[10] = s("div", null, "Review segment", -1))
|
|
509
|
-
])
|
|
510
|
-
]),
|
|
511
|
-
key: "0"
|
|
512
|
-
} : void 0
|
|
513
|
-
]), 1032, ["modelValue", "header"]);
|
|
514
|
-
};
|
|
515
|
-
}
|
|
516
|
-
}), he = We(), Rt = Ie();
|
|
517
|
-
function ue(t) {
|
|
518
|
-
const f = se(t);
|
|
519
|
-
return f.isValid() ? f.format("DD/MM/YYYY") : "";
|
|
520
|
-
}
|
|
521
|
-
const Nt = {
|
|
522
|
-
mapMemberExportRow: (t) => {
|
|
523
|
-
var a, m, i, A, y, p, g, x, j, q, I, G, K, v, l, P, X, ee, te, o, n, F, w, R, H, L, oe, ne;
|
|
524
|
-
const f = O(() => Rt.locations.map((C) => ({
|
|
525
|
-
label: C.name,
|
|
526
|
-
value: C._id
|
|
527
|
-
}))), c = (a = Ye.parseOneAddress(
|
|
528
|
-
t == null ? void 0 : t.email
|
|
529
|
-
)) != null && a.domain.includes("feedmepos.com") ? void 0 : t.email, M = (i = ((m = t == null ? void 0 : t.collection) == null ? void 0 : m.TITLE) || []) == null ? void 0 : i.reduce(
|
|
530
|
-
(C, N) => {
|
|
531
|
-
var h, Y;
|
|
532
|
-
const Q = (Y = (h = he.sortedTitles) == null ? void 0 : h.find(
|
|
533
|
-
(ie) => ie._id === N.collectible
|
|
534
|
-
)) == null ? void 0 : Y.name;
|
|
535
|
-
return !Q || N.balance <= 0 || C.push(Q), C;
|
|
536
|
-
},
|
|
537
|
-
[]
|
|
538
|
-
), b = (he.sortedTitles || []).reduce(
|
|
539
|
-
(C, N) => {
|
|
540
|
-
var h, Y, ie, fe;
|
|
541
|
-
const Q = (fe = (ie = (Y = (((h = t == null ? void 0 : t.collection) == null ? void 0 : h.TITLE) || []).find(
|
|
542
|
-
(Me) => Me.collectible === N._id
|
|
543
|
-
)) == null ? void 0 : Y.expiryBalance) == null ? void 0 : ie[0]) == null ? void 0 : fe.expiredAt;
|
|
544
|
-
return C[N.name] = Q ? se(Q).format("DD/MM/YYYY") : "", C;
|
|
545
|
-
},
|
|
546
|
-
{}
|
|
547
|
-
), _ = ((p = (y = (A = t.collection) == null ? void 0 : A.CREDIT) == null ? void 0 : y.at(0)) == null ? void 0 : p.balance) || 0, u = ((q = (j = (x = (g = t.collection) == null ? void 0 : g.CREDIT) == null ? void 0 : x.at(0)) == null ? void 0 : j.expiryBalance) == null ? void 0 : q.reduce(
|
|
548
|
-
(C, N) => C + N.amount,
|
|
549
|
-
0
|
|
550
|
-
)) || 0, T = et(_, 2);
|
|
551
|
-
return {
|
|
552
|
-
ID: t._id.toString(),
|
|
553
|
-
Name: ((I = t.name) == null ? void 0 : I.trim()) || "",
|
|
554
|
-
Phone: ((G = t == null ? void 0 : t.phoneNumber) == null ? void 0 : G.trim()) || "",
|
|
555
|
-
Email: c || "",
|
|
556
|
-
Gender: t.gender || "",
|
|
557
|
-
CardNo: t.cardNo || "",
|
|
558
|
-
Birthday: t != null && t.birthday ? ue(t == null ? void 0 : t.birthday) : "",
|
|
559
|
-
Credit: parseFloat((Number(T) - Number(u)).toFixed(2)),
|
|
560
|
-
FreeCredit: Number(u.toFixed(2)),
|
|
561
|
-
TotalCredit: Number(T),
|
|
562
|
-
Exp: t != null && t.collection ? ((l = (v = (K = t.collection) == null ? void 0 : K.POINT) == null ? void 0 : v.at(0)) == null ? void 0 : l.balance) ?? 0 : 0,
|
|
563
|
-
Point: t != null && t.collection ? ((ee = (X = (P = t.collection) == null ? void 0 : P.COIN) == null ? void 0 : X.at(0)) == null ? void 0 : ee.balance) ?? 0 : 0,
|
|
564
|
-
Level: t != null && t.collection ? ((n = (o = (te = t.collection) == null ? void 0 : te.TIER) == null ? void 0 : o.at(0)) == null ? void 0 : n.balance) ?? 0 : 0,
|
|
565
|
-
Tier: t != null && t.collection ? ((R = (w = (F = t.collection) == null ? void 0 : F.TIER) == null ? void 0 : w.at(0)) == null ? void 0 : R.balance) ?? 0 : 0,
|
|
566
|
-
Titles: M.join(","),
|
|
567
|
-
...b,
|
|
568
|
-
TotalTransaction: t.stats.visitCount,
|
|
569
|
-
AvgSpent: tt(Number(t.stats.avgBillSize || 0)).toFormat(
|
|
570
|
-
!1
|
|
571
|
-
),
|
|
572
|
-
TotalSpent: t.stats.avgBillSize * t.stats.visitCount,
|
|
573
|
-
LastVisit: ue(t.stats.lastVisit),
|
|
574
|
-
Feedback: ((H = t.stats) == null ? void 0 : H.feedbackCount) || 0,
|
|
575
|
-
LastSeasonTierEarned: ((L = t.stats) == null ? void 0 : L.lastSeasonTierEarned) || 0,
|
|
576
|
-
LastSeasonPointEarned: ((oe = t.stats) == null ? void 0 : oe.lastSeasonPointEarned) || 0,
|
|
577
|
-
JoinedAt: ue(t.joinAt || void 0),
|
|
578
|
-
JoinedAtLocation: t.location && ((ne = f.value.find((C) => C.value == t.location)) == null ? void 0 : ne.label) || "-",
|
|
579
|
-
VisitFrequency: `${Number(
|
|
580
|
-
Math.ceil(t.stats.avgVisitFrequency).toFixed(0)
|
|
581
|
-
)}`
|
|
582
|
-
};
|
|
583
|
-
}
|
|
584
|
-
}, Bt = { class: "flex items-center" }, Ut = { class: "fm-typo-en-title-md-600 fm-step-title line-clamp-2 mr-8" }, Vt = { class: "px-24 flex flex-col gap-y-16" }, Lt = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, Yt = { class: "flex flex-wrap items-center gap-8" }, zt = { class: "fm-typo-en-body-md-600" }, Ot = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, jt = { class: "flex flex-col gap-16 text-center" }, qt = { class: "fm-typo-en-title-sm-800" }, Gt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, be = "text-fm-color-typo-info bg-fm-color-system-info-100", Co = /* @__PURE__ */ le({
|
|
585
|
-
__name: "Segment",
|
|
586
|
-
setup(t) {
|
|
587
|
-
const { minor: f } = Re, { t: c } = pe(), M = Ie(), { mapMemberExportRow: b } = Nt, _ = Ne(), u = ot(), T = W(0);
|
|
588
|
-
function E(o) {
|
|
589
|
-
return !!o.defaultKey;
|
|
590
|
-
}
|
|
591
|
-
function a(o) {
|
|
592
|
-
return o ? `connect.loyalty.segment.default_segments.${o.toLowerCase()}` : void 0;
|
|
593
|
-
}
|
|
594
|
-
function m(o) {
|
|
595
|
-
const n = a(o.defaultKey);
|
|
596
|
-
return n ? c(`${n}.name`) : o.name;
|
|
597
|
-
}
|
|
598
|
-
function i(o) {
|
|
599
|
-
return T.value <= 0 ? "0.00" : ((o ?? 0) * 100 / T.value).toFixed(2);
|
|
600
|
-
}
|
|
601
|
-
const A = [
|
|
602
|
-
{
|
|
603
|
-
header: c("connect.loyalty.segment.table.name"),
|
|
604
|
-
accessorFn: (o) => o.name,
|
|
605
|
-
cell(o) {
|
|
606
|
-
return B("div", { class: "flex flex-wrap items-center gap-8" }, [
|
|
607
|
-
B("span", m(o.row.original)),
|
|
608
|
-
...E(o.row.original) ? [
|
|
609
|
-
B(ae.FmChip, {
|
|
610
|
-
class: be,
|
|
611
|
-
label: c("connect.loyalty.segment.default_segments.system"),
|
|
612
|
-
compact: !0
|
|
613
|
-
})
|
|
614
|
-
] : []
|
|
615
|
-
]);
|
|
616
|
-
}
|
|
617
|
-
},
|
|
618
|
-
{
|
|
619
|
-
header: c("connect.loyalty.segment.table.status"),
|
|
620
|
-
enableSorting: !1,
|
|
621
|
-
cell(o) {
|
|
622
|
-
const n = o.row.original.isActive === !1 ? "Inactive" : "Active";
|
|
623
|
-
return B(ae.FmChip, {
|
|
624
|
-
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",
|
|
625
|
-
label: n,
|
|
626
|
-
compact: !0
|
|
627
|
-
});
|
|
628
|
-
}
|
|
629
|
-
},
|
|
630
|
-
{
|
|
631
|
-
header: c("connect.loyalty.segment.table.total_customers"),
|
|
632
|
-
accessorFn: (o) => o.memberCount ?? 0
|
|
633
|
-
},
|
|
634
|
-
{
|
|
635
|
-
header: c("connect.loyalty.segment.table.customer_percentage"),
|
|
636
|
-
accessorFn: (o) => i(o.memberCount)
|
|
637
|
-
},
|
|
638
|
-
{
|
|
639
|
-
header: c("connect.loyalty.segment.table.actions"),
|
|
640
|
-
meta: {
|
|
641
|
-
maxWidth: "100px"
|
|
642
|
-
},
|
|
643
|
-
cell(o) {
|
|
644
|
-
return B("div", { class: "flex items-center justify-end" }, [
|
|
645
|
-
B(
|
|
646
|
-
ae.FmMenu,
|
|
647
|
-
{
|
|
648
|
-
placement: "bottom-end",
|
|
649
|
-
onClick: (n) => {
|
|
650
|
-
n.stopPropagation();
|
|
651
|
-
}
|
|
652
|
-
},
|
|
653
|
-
{
|
|
654
|
-
"menu-button": () => B(ae.FmButton, {
|
|
655
|
-
icon: "more_vert",
|
|
656
|
-
iconColor: "neutral-gray-400",
|
|
657
|
-
variant: "tertiary"
|
|
658
|
-
}),
|
|
659
|
-
default: () => [
|
|
660
|
-
B(
|
|
661
|
-
ae.FmMenuItem,
|
|
662
|
-
{
|
|
663
|
-
onClick: async (n) => {
|
|
664
|
-
n.stopPropagation(), K(o.row.original);
|
|
665
|
-
}
|
|
666
|
-
},
|
|
667
|
-
{
|
|
668
|
-
label: B(
|
|
669
|
-
"div",
|
|
670
|
-
{
|
|
671
|
-
class: "fm-typo-en-body-md-400"
|
|
672
|
-
},
|
|
673
|
-
"Export"
|
|
674
|
-
)
|
|
675
|
-
}
|
|
676
|
-
),
|
|
677
|
-
...E(o.row.original) ? [] : [
|
|
678
|
-
B(
|
|
679
|
-
ae.FmMenuItem,
|
|
680
|
-
{
|
|
681
|
-
onClick: async (n) => {
|
|
682
|
-
n.stopPropagation(), G(o.row.original);
|
|
683
|
-
}
|
|
684
|
-
},
|
|
685
|
-
{
|
|
686
|
-
label: B(
|
|
687
|
-
"div",
|
|
688
|
-
{
|
|
689
|
-
class: "text-fm-color-typo-error fm-typo-en-body-md-400"
|
|
690
|
-
},
|
|
691
|
-
"Remove"
|
|
692
|
-
)
|
|
693
|
-
}
|
|
694
|
-
)
|
|
695
|
-
]
|
|
696
|
-
]
|
|
697
|
-
}
|
|
698
|
-
)
|
|
699
|
-
]);
|
|
700
|
-
}
|
|
701
|
-
}
|
|
702
|
-
], y = W(null), { tableMeta: p, rowData: g, debouncedFetchData: x } = Fe(
|
|
703
|
-
z.readAll
|
|
704
|
-
), j = O(() => g.value.length === 0 ? !1 : Ve.some(
|
|
705
|
-
(o) => !g.value.some((n) => n.defaultKey === o)
|
|
706
|
-
));
|
|
707
|
-
async function q() {
|
|
708
|
-
var o;
|
|
709
|
-
try {
|
|
710
|
-
await z.refreshSegments(), _.open({ type: "info", title: "Segment refresh queued" });
|
|
711
|
-
} catch (n) {
|
|
712
|
-
if (((n == null ? void 0 : n.status) ?? ((o = n == null ? void 0 : n.response) == null ? void 0 : o.status)) === 409) {
|
|
713
|
-
_.open({
|
|
714
|
-
type: "info",
|
|
715
|
-
title: "Segment refresh already in progress"
|
|
716
|
-
});
|
|
717
|
-
return;
|
|
718
|
-
}
|
|
719
|
-
_.open({
|
|
720
|
-
type: "error",
|
|
721
|
-
title: (n == null ? void 0 : n.message) ?? "Failed to queue segment refresh"
|
|
722
|
-
});
|
|
723
|
-
}
|
|
724
|
-
}
|
|
725
|
-
async function I() {
|
|
726
|
-
await f(
|
|
727
|
-
async () => {
|
|
728
|
-
await z.startDefaultSegments(), await x({ pageSize: 10, pageIndex: 0 });
|
|
729
|
-
},
|
|
730
|
-
{
|
|
731
|
-
message: c(
|
|
732
|
-
"connect.loyalty.segment.default_segments.get_started.loading"
|
|
733
|
-
),
|
|
734
|
-
successMessage: c(
|
|
735
|
-
"connect.loyalty.segment.default_segments.get_started.success"
|
|
736
|
-
)
|
|
737
|
-
}
|
|
738
|
-
);
|
|
739
|
-
}
|
|
740
|
-
async function G(o) {
|
|
741
|
-
await Pe.remove(`Are you sure you want to remove ${o.name}?`) && await f(
|
|
742
|
-
async () => {
|
|
743
|
-
await z.delete(o._id), await x({ pageSize: 10, pageIndex: 0 });
|
|
744
|
-
},
|
|
745
|
-
{
|
|
746
|
-
message: `Removing ${o.name}`,
|
|
747
|
-
successMessage: `Removed ${o.name} successfully`
|
|
748
|
-
}
|
|
749
|
-
);
|
|
750
|
-
}
|
|
751
|
-
async function K(o) {
|
|
752
|
-
const n = {
|
|
753
|
-
sortBy: "_id",
|
|
754
|
-
descending: !1,
|
|
755
|
-
rowsPerPage: 1e3,
|
|
756
|
-
page: 1,
|
|
757
|
-
rowsNumber: 0
|
|
758
|
-
}, F = new ze(), w = m(o), R = (await _e.read({
|
|
759
|
-
limit: 1,
|
|
760
|
-
skip: 0,
|
|
761
|
-
sortBy: n.sortBy,
|
|
762
|
-
descending: n.descending
|
|
763
|
-
})).meta.totalResources ?? 0, H = n.rowsPerPage;
|
|
764
|
-
await f(
|
|
765
|
-
async () => {
|
|
766
|
-
for (let L = 0; L < R; L += H) {
|
|
767
|
-
const oe = {
|
|
768
|
-
...n,
|
|
769
|
-
limit: H,
|
|
770
|
-
skip: n.page - 1,
|
|
771
|
-
sortBy: n.sortBy,
|
|
772
|
-
descending: n.descending
|
|
773
|
-
}, ne = await z.paginateSegmentUsers(
|
|
774
|
-
o._id,
|
|
775
|
-
oe
|
|
776
|
-
);
|
|
777
|
-
for (const C of ne.resources) {
|
|
778
|
-
const N = b(C);
|
|
779
|
-
F.addRecord(N);
|
|
780
|
-
}
|
|
781
|
-
n.page++;
|
|
782
|
-
}
|
|
783
|
-
await ke(
|
|
784
|
-
F.buildExcel(),
|
|
785
|
-
`[${w}]-members-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
|
|
786
|
-
{
|
|
787
|
-
bookType: "xlsx",
|
|
788
|
-
bookSST: !1,
|
|
789
|
-
type: "array"
|
|
790
|
-
}
|
|
791
|
-
), n.page = 1;
|
|
792
|
-
},
|
|
793
|
-
{
|
|
794
|
-
message: "Exporting member...",
|
|
795
|
-
successMessage: "Member exported successfully"
|
|
796
|
-
}
|
|
797
|
-
);
|
|
798
|
-
}
|
|
799
|
-
async function v(o) {
|
|
800
|
-
await f(
|
|
801
|
-
async () => {
|
|
802
|
-
var n;
|
|
803
|
-
if (o.type === U.enum.STATIC) {
|
|
804
|
-
const F = new FormData();
|
|
805
|
-
if (F.append("file", o.file), o._id) {
|
|
806
|
-
const { members: w, _id: R, file: H, ...L } = o;
|
|
807
|
-
F.append("segment", JSON.stringify(L)), await z.updateStatic(o._id, F);
|
|
808
|
-
} else {
|
|
809
|
-
const { file: w, ...R } = o;
|
|
810
|
-
F.append("segment", JSON.stringify(R)), await z.createStatic(F);
|
|
811
|
-
}
|
|
812
|
-
o.file && _.open({
|
|
813
|
-
type: "info",
|
|
814
|
-
title: "Import begins soon. Check Queue for updates.",
|
|
815
|
-
action: "View",
|
|
816
|
-
onAction: async () => {
|
|
817
|
-
await u.push({
|
|
818
|
-
name: xe["$connect-QUEUE"],
|
|
819
|
-
query: { type: [ge.enum.SEGMENTATION_IMPORTED] }
|
|
820
|
-
});
|
|
821
|
-
}
|
|
822
|
-
});
|
|
823
|
-
} else if (o._id) {
|
|
824
|
-
const { members: F, _id: w, ...R } = o;
|
|
825
|
-
await z.update(o._id, R);
|
|
826
|
-
} else
|
|
827
|
-
await z.create(o);
|
|
828
|
-
await x({ pageSize: 10, pageIndex: 0 }), (n = y.value) == null || n.hideSheet();
|
|
829
|
-
},
|
|
830
|
-
{
|
|
831
|
-
message: "Saving segment",
|
|
832
|
-
successMessage: "Segment saved"
|
|
833
|
-
}
|
|
834
|
-
);
|
|
835
|
-
}
|
|
836
|
-
function l(o) {
|
|
837
|
-
var n;
|
|
838
|
-
(n = y.value) == null || n.showSheet(o);
|
|
839
|
-
}
|
|
840
|
-
const P = {
|
|
841
|
-
label: c("connect.navigation.queue"),
|
|
842
|
-
value: "queue",
|
|
843
|
-
isPrimary: !1,
|
|
844
|
-
prependIcon: "work_history"
|
|
845
|
-
}, X = {
|
|
846
|
-
label: c("connect.loyalty.segment.default_segments.get_started.action"),
|
|
847
|
-
value: "start-default-segments",
|
|
848
|
-
isPrimary: !1,
|
|
849
|
-
prependIcon: "auto_awesome"
|
|
850
|
-
}, ee = O(() => {
|
|
851
|
-
if (!M.isPremium)
|
|
852
|
-
return [];
|
|
853
|
-
const o = [P];
|
|
854
|
-
return j.value && o.push(X), o.push(
|
|
855
|
-
{
|
|
856
|
-
label: c("connect.loyalty.segment.actions.refresh"),
|
|
857
|
-
value: "refresh",
|
|
858
|
-
prependIcon: "refresh"
|
|
859
|
-
},
|
|
860
|
-
{
|
|
861
|
-
label: c("connect.loyalty.segment.actions.add"),
|
|
862
|
-
value: "add",
|
|
863
|
-
isPrimary: !0,
|
|
864
|
-
prependIcon: "add"
|
|
865
|
-
}
|
|
866
|
-
), o;
|
|
867
|
-
});
|
|
868
|
-
function te(o) {
|
|
869
|
-
switch (o) {
|
|
870
|
-
case "add":
|
|
871
|
-
l();
|
|
872
|
-
break;
|
|
873
|
-
case "refresh":
|
|
874
|
-
q();
|
|
875
|
-
break;
|
|
876
|
-
case "queue":
|
|
877
|
-
u.push({
|
|
878
|
-
name: xe["$connect-QUEUE"],
|
|
879
|
-
query: { type: [ge.enum.SEGMENTATION_IMPORTED] }
|
|
880
|
-
});
|
|
881
|
-
break;
|
|
882
|
-
case "start-default-segments":
|
|
883
|
-
I();
|
|
884
|
-
break;
|
|
885
|
-
}
|
|
886
|
-
}
|
|
887
|
-
return De(async () => {
|
|
888
|
-
const { meta: o } = await _e.read({
|
|
889
|
-
limit: 1,
|
|
890
|
-
skip: 0,
|
|
891
|
-
sortBy: "_id",
|
|
892
|
-
search: void 0,
|
|
893
|
-
descending: !1
|
|
894
|
-
});
|
|
895
|
-
T.value = o.totalResources ?? 0, await x({ pageSize: 10, pageIndex: 0 }), await M.readPremium(), await M.readLocations();
|
|
896
|
-
}), (o, n) => {
|
|
897
|
-
const F = S("FmPill"), w = S("FmPageHead"), R = S("FmChip"), H = S("FmIcon"), L = S("FmMenuItem"), oe = S("FmMenu"), ne = S("FmListItem"), C = S("FmList"), N = S("FmButton"), Q = S("FmCard");
|
|
898
|
-
return r(), k(Z, null, [
|
|
899
|
-
d(w, {
|
|
900
|
-
title: "Segments",
|
|
901
|
-
actions: e(ee),
|
|
902
|
-
"onClick:action": n[0] || (n[0] = (h) => te(h))
|
|
903
|
-
}, {
|
|
904
|
-
title: $(() => [
|
|
905
|
-
s("div", Bt, [
|
|
906
|
-
s("span", Ut, D(e(c)("connect.loyalty.segment.title")), 1),
|
|
907
|
-
d(F, { variant: "premium" })
|
|
908
|
-
])
|
|
909
|
-
]),
|
|
910
|
-
_: 1
|
|
911
|
-
}, 8, ["actions"]),
|
|
912
|
-
s("div", Vt, [
|
|
913
|
-
e(g).length > 0 || e(p).searchValue || e(p).isLoading ? (r(), k(Z, { key: 0 }, [
|
|
914
|
-
d(Ce, {
|
|
915
|
-
loading: e(p).isLoading,
|
|
916
|
-
"row-data": e(g),
|
|
917
|
-
"row-count": e(p).totalRows,
|
|
918
|
-
"column-defs": A,
|
|
919
|
-
"shrink-at": !1,
|
|
920
|
-
"page-count": e(p).pageCount,
|
|
921
|
-
"page-index": e(p).pageIndex,
|
|
922
|
-
"page-size": e(p).pageSize,
|
|
923
|
-
onRowClick: n[1] || (n[1] = (h) => {
|
|
924
|
-
l(h.original);
|
|
925
|
-
}),
|
|
926
|
-
onPageChange: e(x)
|
|
927
|
-
}, null, 8, ["loading", "row-data", "row-count", "page-count", "page-index", "page-size", "onPageChange"]),
|
|
928
|
-
d(C, { class: "w-full hidden xs:!block" }, {
|
|
929
|
-
default: $(() => [
|
|
930
|
-
(r(!0), k(Z, null, me(e(g), (h) => (r(), V(ne, {
|
|
931
|
-
key: h._id.toString(),
|
|
932
|
-
tag: "label",
|
|
933
|
-
onClick: (Y) => l(h)
|
|
934
|
-
}, {
|
|
935
|
-
default: $(() => [
|
|
936
|
-
s("div", null, [
|
|
937
|
-
s("div", Lt, D((h.memberCount ?? 0).toLocaleString()) + " total customers ", 1),
|
|
938
|
-
s("div", Yt, [
|
|
939
|
-
s("span", zt, D(m(h)), 1),
|
|
940
|
-
E(h) ? (r(), V(R, {
|
|
941
|
-
key: 0,
|
|
942
|
-
class: ce(be),
|
|
943
|
-
label: e(c)("connect.loyalty.segment.default_segments.system"),
|
|
944
|
-
compact: ""
|
|
945
|
-
}, null, 8, ["label"])) : J("", !0)
|
|
946
|
-
]),
|
|
947
|
-
s("div", Ot, D(i(h.memberCount)) + "% of customers ", 1)
|
|
948
|
-
])
|
|
949
|
-
]),
|
|
950
|
-
append: $(() => [
|
|
951
|
-
d(oe, { "stop-click-propagation": !0 }, {
|
|
952
|
-
"menu-button": $(() => [
|
|
953
|
-
d(H, { name: "more_vert" })
|
|
954
|
-
]),
|
|
955
|
-
default: $(() => [
|
|
956
|
-
d(L, {
|
|
957
|
-
class: "fm-typo-en-body-md-400",
|
|
958
|
-
label: "Export",
|
|
959
|
-
"onUpdate:modelValue": (Y) => Y && K(h)
|
|
960
|
-
}, null, 8, ["onUpdate:modelValue"]),
|
|
961
|
-
E(h) ? J("", !0) : (r(), V(L, {
|
|
962
|
-
key: 0,
|
|
963
|
-
class: "text-fm-color-typo-error fm-typo-en-body-md-400",
|
|
964
|
-
label: "Remove",
|
|
965
|
-
"onUpdate:modelValue": (Y) => Y && G(h)
|
|
966
|
-
}, null, 8, ["onUpdate:modelValue"]))
|
|
967
|
-
]),
|
|
968
|
-
_: 2
|
|
969
|
-
}, 1024)
|
|
970
|
-
]),
|
|
971
|
-
_: 2
|
|
972
|
-
}, 1032, ["onClick"]))), 128))
|
|
973
|
-
]),
|
|
974
|
-
_: 1
|
|
975
|
-
})
|
|
976
|
-
], 64)) : (r(), V(Q, {
|
|
977
|
-
key: 1,
|
|
978
|
-
variant: "outlined",
|
|
979
|
-
class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
|
|
980
|
-
}, {
|
|
981
|
-
default: $(() => [
|
|
982
|
-
n[3] || (n[3] = s("img", {
|
|
983
|
-
src: $e,
|
|
984
|
-
class: "aspect-square w-[150px]"
|
|
985
|
-
}, null, -1)),
|
|
986
|
-
s("div", jt, [
|
|
987
|
-
s("div", qt, D(e(c)("connect.loyalty.segment.default_segments.get_started.title")), 1),
|
|
988
|
-
s("div", Gt, D(e(c)(
|
|
989
|
-
"connect.loyalty.segment.default_segments.get_started.description"
|
|
990
|
-
)), 1)
|
|
991
|
-
]),
|
|
992
|
-
d(N, {
|
|
993
|
-
variant: "primary",
|
|
994
|
-
label: e(c)("connect.loyalty.segment.default_segments.get_started.action"),
|
|
995
|
-
disabled: !e(M).isPremium,
|
|
996
|
-
icon: "auto_awesome",
|
|
997
|
-
onClick: n[2] || (n[2] = (h) => I())
|
|
998
|
-
}, null, 8, ["label", "disabled"])
|
|
999
|
-
]),
|
|
1000
|
-
_: 1
|
|
1001
|
-
})),
|
|
1002
|
-
d(Pt, {
|
|
1003
|
-
ref_key: "sheetRef",
|
|
1004
|
-
ref: y,
|
|
1005
|
-
"onUpdate:modelValue": v
|
|
1006
|
-
}, null, 512)
|
|
1007
|
-
])
|
|
1008
|
-
], 64);
|
|
1009
|
-
};
|
|
1010
|
-
}
|
|
1011
|
-
});
|
|
1012
|
-
export {
|
|
1013
|
-
Co as default
|
|
1014
|
-
};
|