@feedmepos/mf-connect 0.0.8 → 0.0.9
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-BxRuK2P2.js → Analytic-CwaN0mge.js} +68 -69
- package/dist/{Broadcast-BqGojAWW.js → Broadcast-Cjx5xzUC.js} +27 -28
- package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-B-VzcVMS.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-D4mO5aik.js} +34 -34
- package/dist/Card-DbY6YaXk.js +827 -0
- package/dist/{Collections-DvdDRozp.js → Collections-DRN2gzwh.js} +158 -168
- package/dist/{Credit-BeHm7_2S.js → Credit-DOcrzykJ.js} +11 -12
- package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-BsbgHsah.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-CUxfXaro.js} +359 -333
- package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-hwXvdiut.js → EffectSheet.vue_vue_type_style_index_0_lang-EF_rHfwT.js} +5 -5
- package/dist/{Experience-CtDY9u4Y.js → Experience-aQj-3H2Y.js} +11 -12
- package/dist/{Game-DjaYuqcb.js → Game-Cnje-m_M.js} +22 -23
- package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-Bq5-Gl9N.js → ImageInput.vue_vue_type_script_setup_true_lang-CG-GBVMP.js} +8 -8
- package/dist/{MainLayout-B-iAZM2k.js → MainLayout-Cxl9yLPs.js} +1 -1
- package/dist/{Marketing-BJJltAh-.js → Marketing-BYUcbcMU.js} +19 -20
- package/dist/{Member-eJ9Pdi5w.js → Member-D7K9fm_Q.js} +2 -2
- package/dist/MemberList-DbXkxUzF.js +1717 -0
- package/dist/{MemberTransactions-DRET8mSQ.js → MemberTransactions-DED1SYwX.js} +4 -4
- package/dist/MessageInput.vue_vue_type_script_setup_true_lang-CLqIp5wR.js +203 -0
- package/dist/{Point-DPTOgJbC.js → Point-CQm8whVQ.js} +11 -12
- package/dist/{Promotion-wzkRuNqO.js → Promotion-DzVXy_C9.js} +42 -44
- package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-Z06eB5i5.js → RuleGroup.vue_vue_type_script_setup_true_lang-CeS6KlhP.js} +12 -12
- package/dist/Segment-D3o0D3Uv.js +407 -0
- package/dist/{Setting-CXuZu0-m.js → Setting-pCzenLoL.js} +17 -18
- package/dist/{Store-4Um9keEp.js → Store-DEwEIFYD.js} +18 -19
- package/dist/{StoreRewards-B-UFeyQM.js → StoreRewards-D7vnZN4f.js} +86 -87
- package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-ALzQU3th.js +793 -0
- package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-I_XFpctY.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-GMIztWCj.js} +1 -1
- package/dist/{Tier-C6KVsxGO.js → Tier-BJbX5CPB.js} +401 -377
- package/dist/{Title-DuN1ahIM.js → Title-C9xV6rBg.js} +274 -248
- package/dist/Transaction-C8OHlhzR.js +36 -0
- package/dist/Voucher-eZwm7N1D.js +481 -0
- package/dist/{app-CxBTTB31.js → app-DgbDbhL-.js} +34 -34
- package/dist/app.js +1 -1
- package/dist/{campaign-B0aXkadj.js → campaign-BkvrUTEJ.js} +2 -2
- package/dist/{dto-BtdVC-Ab.js → dto-YYVhW73A.js} +52 -53
- package/dist/{effect-BUN6rkQM.js → effect-f7DAPYC8.js} +1 -1
- package/dist/export-BXbCXTfd.js +97 -0
- package/dist/{helper-Cpq3x8K5.js → helper-BhvQ9m6d.js} +1 -1
- package/dist/{index-D2Juhkdw.js → index-BhacKx5B.js} +85 -83
- package/dist/{index-DDSLx7vu.js → index-BsEqtUmY.js} +2 -2
- package/dist/{index-0GYrZr4L.js → index-CdtrQ9tR.js} +5 -5
- package/dist/{index-8clzk3uX.js → index-Cfo2A0Se.js} +1 -1
- package/dist/index-Cz5RZlYh.js +73 -0
- package/dist/{index-BTntbYTS.js → index-DQC_1tRF.js} +1 -1
- package/dist/{index-DysVCkrx.js → index-Dd3hrFcQ.js} +3 -3
- package/dist/{index-CK9yJMj7.js → index-FWp9M1yS.js} +5 -5
- package/dist/{index-C6NgUSl2.js → index-VmFlM704.js} +1 -1
- package/dist/{index-BvnZdJBY.js → index-oQLJE4Uw.js} +2 -2
- package/dist/libs/packages/core/src/collectible/collectible.dto.d.ts +6 -0
- package/dist/{plugins-B_d-WFtN.js → loading-DQaawbHE.js} +8204 -8108
- package/dist/{lodash-DsT1nK-T.js → lodash-DzdmTD20.js} +1 -1
- package/dist/{membership-DtD45RXh.js → membership-Dq2-b-S_.js} +3 -3
- package/dist/{money-CFI1TMCS.js → money-vzwOUBrp.js} +1 -1
- package/dist/{number-BBtf4fYz.js → number-CBzs6rfW.js} +1 -1
- package/dist/packages/connect/src/components/campaign/CampaignSummary.vue.d.ts +13 -0
- package/dist/packages/connect/src/composables/export.d.ts +11 -0
- package/dist/packages/connect/src/export/base.export.d.ts +7 -0
- package/dist/packages/connect/src/export/card.export.d.ts +5 -6
- package/dist/packages/connect/src/export/collection-transaction.export.d.ts +14 -0
- package/dist/packages/connect/src/export/index.d.ts +1 -0
- package/dist/packages/connect/src/export/store-transaction.export.d.ts +14 -0
- package/dist/packages/connect/src/helpers/user.d.ts +6 -0
- package/dist/{rule-CB9Qlcx1.js → rule-BR5rrmUV.js} +2 -2
- package/dist/{rule-builder-BIKcA4Bg.js → rule-builder-7GBNrPXt.js} +1 -1
- package/dist/{template-qlb46PGl.js → template-CETJ6lkf.js} +5 -5
- package/dist/{usePagination-CX66ab1Y.js → usePagination-DdZeE4Tt.js} +57 -56
- package/dist/user-Bm4KttFq.js +37 -0
- package/dist/{xlsx-DMaFso0k.js → xlsx-CDAKxZE_.js} +1 -1
- package/package.json +1 -1
- package/dist/Card-Dlj5jQp4.js +0 -792
- package/dist/MemberList-CrhMqUfJ.js +0 -1664
- package/dist/MessageInput.vue_vue_type_script_setup_true_lang-D-ttMwn2.js +0 -166
- package/dist/Segment-DnsPrP7Q.js +0 -371
- package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-BAyotuXd.js +0 -660
- package/dist/Transaction-DdfX7Xfe.js +0 -34
- package/dist/Voucher-DarXrxZr.js +0 -454
- package/dist/index-Dg-PMgXV.js +0 -64
- package/dist/loading-Cxp7sI5p.js +0 -100
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { defineComponent as _, ref as d, resolveComponent as c, openBlock as o, createElementBlock as v, Fragment as f, createVNode as s, createElementVNode as b, unref as t, createBlock as a, KeepAlive as k, resolveDynamicComponent as m, createCommentVNode as x } from "vue";
|
|
2
|
+
import { _ as C, a as F } from "./StoreTransactions.vue_vue_type_script_setup_true_lang-ALzQU3th.js";
|
|
3
|
+
const T = { class: "px-24 flex flex-col gap-y-32 pb-24" }, N = /* @__PURE__ */ _({
|
|
4
|
+
__name: "Transaction",
|
|
5
|
+
setup(g) {
|
|
6
|
+
const l = [
|
|
7
|
+
{
|
|
8
|
+
label: "Collection",
|
|
9
|
+
value: "collection"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
label: "Store",
|
|
13
|
+
value: "store"
|
|
14
|
+
}
|
|
15
|
+
], e = d(l[0]);
|
|
16
|
+
return (y, n) => {
|
|
17
|
+
const r = c("FmPageHead"), u = c("FmTabs");
|
|
18
|
+
return o(), v(f, null, [
|
|
19
|
+
s(r, { title: "Transactions" }),
|
|
20
|
+
b("div", T, [
|
|
21
|
+
s(u, {
|
|
22
|
+
"model-value": t(e).value,
|
|
23
|
+
items: l,
|
|
24
|
+
"onUpdate:modelValue": n[0] || (n[0] = (i) => e.value = l.find((p) => p.value === i))
|
|
25
|
+
}, null, 8, ["model-value"]),
|
|
26
|
+
(o(), a(k, null, [
|
|
27
|
+
t(e).value == "collection" ? (o(), a(m(C), { key: 0 })) : t(e).value == "store" ? (o(), a(m(F), { key: 1 })) : x("", !0)
|
|
28
|
+
], 1024))
|
|
29
|
+
])
|
|
30
|
+
], 64);
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
export {
|
|
35
|
+
N as default
|
|
36
|
+
};
|
|
@@ -0,0 +1,481 @@
|
|
|
1
|
+
import { defineComponent as X, ref as y, watch as N, onMounted as J, resolveComponent as p, openBlock as g, createBlock as V, unref as t, isRef as j, withCtx as I, createElementVNode as s, createVNode as r, toDisplayString as M, computed as ee, createElementBlock as O, Fragment as T, renderList as ae, resolveDynamicComponent as te, createCommentVNode as K, h as v } from "vue";
|
|
2
|
+
import { _ as oe } from "./campaign-CpzFl8Vr.js";
|
|
3
|
+
import { useDialog as ne, components as x } from "@feedmepos/ui-library";
|
|
4
|
+
import { u as Q, p as z, a as se } from "./loading-DQaawbHE.js";
|
|
5
|
+
import { useCoreStore as le } from "@feedmepos/mf-common";
|
|
6
|
+
import { u as ie, J as re, a as ce, R as ue, b as D } from "./app-DgbDbhL-.js";
|
|
7
|
+
import { u as me } from "./campaign-BkvrUTEJ.js";
|
|
8
|
+
import { g as q, b as G } from "./dto-YYVhW73A.js";
|
|
9
|
+
import { u as de } from "./template-CETJ6lkf.js";
|
|
10
|
+
import { _ as pe } from "./EditCampaignSheet.vue_vue_type_script_setup_true_lang-CUxfXaro.js";
|
|
11
|
+
import { _ as fe } from "./ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js";
|
|
12
|
+
import { l as he } from "./lodash-DzdmTD20.js";
|
|
13
|
+
import { m as ge } from "./index-Cz5RZlYh.js";
|
|
14
|
+
import { c as F } from "./index-DQC_1tRF.js";
|
|
15
|
+
import { useRouter as ye } from "vue-router";
|
|
16
|
+
const ve = { class: "space-y-16" }, _e = { class: "fm-typo-en-body-md-600" }, Ce = { class: "flex items-center justify-end" }, be = { class: "flex items-center gap-8" }, we = /* @__PURE__ */ X({
|
|
17
|
+
__name: "SendVoucherSheet",
|
|
18
|
+
emits: ["success"],
|
|
19
|
+
setup(W, { expose: U, emit: L }) {
|
|
20
|
+
const { minor: P } = Q, R = y(""), i = y({}), E = L, f = y(!1), u = y([]);
|
|
21
|
+
function m(e) {
|
|
22
|
+
f.value = !0, R.value = e.campaignId, u.value = [];
|
|
23
|
+
}
|
|
24
|
+
function _() {
|
|
25
|
+
f.value = !1;
|
|
26
|
+
}
|
|
27
|
+
const A = [
|
|
28
|
+
{
|
|
29
|
+
header: "Name",
|
|
30
|
+
accessorFn: (e) => e.name || "No Profile"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
header: "Phone",
|
|
34
|
+
accessorFn: (e) => e.phoneNumber || "-"
|
|
35
|
+
}
|
|
36
|
+
], l = y({
|
|
37
|
+
searchValue: "",
|
|
38
|
+
pageSize: 10,
|
|
39
|
+
pageCount: 0,
|
|
40
|
+
pageIndex: 0,
|
|
41
|
+
totalRows: 0,
|
|
42
|
+
isLoading: !1
|
|
43
|
+
}), d = y([]), C = async (e) => {
|
|
44
|
+
l.value.isLoading = !0, d.value = [];
|
|
45
|
+
const a = await ge.read({
|
|
46
|
+
limit: e.pageSize,
|
|
47
|
+
skip: e.pageIndex,
|
|
48
|
+
sortBy: "_id",
|
|
49
|
+
search: l.value.searchValue,
|
|
50
|
+
descending: !1
|
|
51
|
+
});
|
|
52
|
+
d.value = a.resources, l.value.totalRows = a.meta.totalResources ?? 0, l.value.pageCount = a.meta.totalPages ?? 0, l.value.isLoading = !1, i.value = {}, u.value.forEach((o) => {
|
|
53
|
+
const c = d.value.findIndex((w) => w._id == o);
|
|
54
|
+
c > -1 && (console.log(c, "fetch member index"), i.value[c] = !0);
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
function b() {
|
|
58
|
+
d.value.length > 0 && (u.value = u.value.filter(
|
|
59
|
+
(e) => !d.value.some((a) => a._id === e) || // Keep if not in current page
|
|
60
|
+
Object.entries(i.value).some(
|
|
61
|
+
([a, o]) => o && d.value[a]._id === e
|
|
62
|
+
// Keep if selected in current page
|
|
63
|
+
)
|
|
64
|
+
));
|
|
65
|
+
for (const [e, a] of Object.entries(i.value))
|
|
66
|
+
if (a) {
|
|
67
|
+
const o = d.value[e]._id;
|
|
68
|
+
u.value.includes(o) || u.value.push(o);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
async function $(e) {
|
|
72
|
+
u.value.length < 1 || await P(
|
|
73
|
+
async () => {
|
|
74
|
+
await F.sendCollection(R.value, {
|
|
75
|
+
memberId: u.value
|
|
76
|
+
}), await E("success"), _();
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
message: "Sending claim(s)",
|
|
80
|
+
successMessage: "Claim(s) created"
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
return N(i, b, { deep: !0 }), N(
|
|
85
|
+
() => l.value.searchValue,
|
|
86
|
+
he.debounce(async () => {
|
|
87
|
+
await C({ pageSize: 10, pageIndex: 0 });
|
|
88
|
+
}, 500)
|
|
89
|
+
), U({
|
|
90
|
+
showSheet: m,
|
|
91
|
+
hideSheet: _
|
|
92
|
+
}), J(async () => {
|
|
93
|
+
await C(l.value);
|
|
94
|
+
}), (e, a) => {
|
|
95
|
+
const o = p("FmSearch"), c = p("FmTable"), w = p("FmButton"), S = p("FmSideSheet");
|
|
96
|
+
return g(), V(S, {
|
|
97
|
+
"max-width": 560,
|
|
98
|
+
"dismiss-away": !0,
|
|
99
|
+
header: "Send voucher to",
|
|
100
|
+
modelValue: t(f),
|
|
101
|
+
"onUpdate:modelValue": [
|
|
102
|
+
a[3] || (a[3] = (h) => j(f) ? f.value = h : null),
|
|
103
|
+
a[4] || (a[4] = (h) => f.value = h)
|
|
104
|
+
]
|
|
105
|
+
}, {
|
|
106
|
+
"side-sheet-footer": I(() => [
|
|
107
|
+
s("div", be, [
|
|
108
|
+
r(w, {
|
|
109
|
+
label: "Send",
|
|
110
|
+
loading: t(ie)().isLoading,
|
|
111
|
+
onClick: $
|
|
112
|
+
}, null, 8, ["loading"]),
|
|
113
|
+
r(w, {
|
|
114
|
+
label: "Cancel",
|
|
115
|
+
type: "button",
|
|
116
|
+
variant: "tertiary",
|
|
117
|
+
onClick: a[2] || (a[2] = (h) => f.value = !1)
|
|
118
|
+
})
|
|
119
|
+
])
|
|
120
|
+
]),
|
|
121
|
+
default: I(() => [
|
|
122
|
+
r(re, { json: t(u) }, null, 8, ["json"]),
|
|
123
|
+
s("div", ve, [
|
|
124
|
+
s("div", _e, M(t(u).length) + " members selected ", 1),
|
|
125
|
+
s("div", Ce, [
|
|
126
|
+
r(o, {
|
|
127
|
+
class: "mt-4",
|
|
128
|
+
modelValue: t(l).searchValue,
|
|
129
|
+
"onUpdate:modelValue": a[0] || (a[0] = (h) => t(l).searchValue = h),
|
|
130
|
+
placeholder: "Search Member",
|
|
131
|
+
collapsible: ""
|
|
132
|
+
}, null, 8, ["modelValue"])
|
|
133
|
+
]),
|
|
134
|
+
r(c, {
|
|
135
|
+
modelValue: t(i),
|
|
136
|
+
"onUpdate:modelValue": a[1] || (a[1] = (h) => j(i) ? i.value = h : null),
|
|
137
|
+
selection: "multiple",
|
|
138
|
+
loading: t(l).isLoading,
|
|
139
|
+
"row-data": t(d),
|
|
140
|
+
"column-defs": A,
|
|
141
|
+
"page-size": t(l).pageSize,
|
|
142
|
+
"page-count": t(l).pageCount,
|
|
143
|
+
"hide-footer": t(l).totalRows <= t(l).pageSize,
|
|
144
|
+
"fetch-fn": C
|
|
145
|
+
}, null, 8, ["modelValue", "loading", "row-data", "page-size", "page-count", "hide-footer"])
|
|
146
|
+
])
|
|
147
|
+
]),
|
|
148
|
+
_: 1
|
|
149
|
+
}, 8, ["modelValue"]);
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
var Se = { authUrl: "https://portal-v2-dev.feedmeapi.com/", slackWebhookUrl: "https://hooks.slack.com/services/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", appUrl: "member.feedmedev.cc", crmUrl: "crm.feedmedev.cc", marketingV1Portal: "https://marketing-v1.feedmedev.cc" };
|
|
154
|
+
const xe = { class: "px-24 flex flex-col gap-y-16" }, Ve = { class: "flex items-center justify-between w-full" }, ke = { class: "flex gap-8 overflow-x-auto" }, Fe = { class: "space-y-8" }, Ie = { class: "flex w-full gap-4 items-center" }, Le = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Re = { class: "space-y-4" }, Me = { class: "fm-typo-en-body-lg-600" }, Ue = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Pe = { class: "flex gap-8 items-center" }, Ee = /* @__PURE__ */ s("img", {
|
|
155
|
+
src: oe,
|
|
156
|
+
class: "aspect-square w-[150px]"
|
|
157
|
+
}, null, -1), Ae = /* @__PURE__ */ s("div", { class: "flex flex-col gap-16 text-center" }, [
|
|
158
|
+
/* @__PURE__ */ s("div", { class: "fm-typo-en-title-sm-800" }, "Create voucher campaign"),
|
|
159
|
+
/* @__PURE__ */ s("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " A digital coupon that users can redeem for discounts on future purchases. Users usually need to claim and apply the voucher to benefit from the discount. ")
|
|
160
|
+
], -1), We = /* @__PURE__ */ X({
|
|
161
|
+
__name: "Voucher",
|
|
162
|
+
setup(W) {
|
|
163
|
+
const U = {
|
|
164
|
+
label: "Create campaign",
|
|
165
|
+
value: "create",
|
|
166
|
+
isPrimary: !0,
|
|
167
|
+
prependIcon: "add"
|
|
168
|
+
}, L = ne(), P = de("VOUCHER", L), R = ce(), i = me(), { global: E, minor: f } = Q, u = ye(), m = y({
|
|
169
|
+
searchKey: "",
|
|
170
|
+
location: null
|
|
171
|
+
}), _ = ee(
|
|
172
|
+
() => i.campaigns.voucher.filter(
|
|
173
|
+
(e) => !m.value.location || !e.targetLocation || e.targetLocation.includes(m.value.location)
|
|
174
|
+
)
|
|
175
|
+
), A = [
|
|
176
|
+
{
|
|
177
|
+
header: "Voucher title",
|
|
178
|
+
accessorFn: (e) => e.name
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
header: "Status",
|
|
182
|
+
cell(e) {
|
|
183
|
+
return q(e.row.original);
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
header: "Summary",
|
|
188
|
+
accessorFn: (e) => G(e)
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
header: "Quota",
|
|
192
|
+
accessorFn: (e) => {
|
|
193
|
+
var a;
|
|
194
|
+
return ((a = e.pf_collectible) == null ? void 0 : a.options.maxReceive) ?? "Unlimited";
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
header: "Claimed",
|
|
199
|
+
accessorFn: (e) => {
|
|
200
|
+
var a;
|
|
201
|
+
return ((a = e == null ? void 0 : e.pf_collectible) == null ? void 0 : a.currentReceive) ?? 0;
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
header: "Actions",
|
|
206
|
+
cell(e) {
|
|
207
|
+
return v("div", { class: "flex items-center justify-end" }, [
|
|
208
|
+
v(x.FmButton, {
|
|
209
|
+
icon: "visibility",
|
|
210
|
+
variant: "tertiary",
|
|
211
|
+
iconColor: "neutral-gray-400",
|
|
212
|
+
onClick: async (a) => {
|
|
213
|
+
a.stopPropagation(), await u.push({
|
|
214
|
+
name: D["$connect-CAMPAIGN_VOUCHER_COLLECTIONS"],
|
|
215
|
+
params: { id: e.row.original._id }
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
}),
|
|
219
|
+
v(
|
|
220
|
+
x.FmMenu,
|
|
221
|
+
{
|
|
222
|
+
placement: "bottom-end",
|
|
223
|
+
onClick: (a) => {
|
|
224
|
+
a.stopPropagation();
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"menu-button": () => v(x.FmButton, {
|
|
229
|
+
icon: "more_vert",
|
|
230
|
+
iconColor: "neutral-gray-400",
|
|
231
|
+
variant: "tertiary"
|
|
232
|
+
}),
|
|
233
|
+
default: () => {
|
|
234
|
+
const a = [
|
|
235
|
+
v(
|
|
236
|
+
x.FmMenuItem,
|
|
237
|
+
{
|
|
238
|
+
onClick: async (o) => {
|
|
239
|
+
o.stopPropagation(), C(e.row.original);
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
label: v(
|
|
244
|
+
"div",
|
|
245
|
+
{
|
|
246
|
+
class: "text-fm-color-typo-error fm-typo-en-body-md-400"
|
|
247
|
+
},
|
|
248
|
+
"Remove"
|
|
249
|
+
)
|
|
250
|
+
}
|
|
251
|
+
)
|
|
252
|
+
];
|
|
253
|
+
return e.row.original.event.type === "SIMPLE_CLAIM" && (a.unshift(
|
|
254
|
+
v(x.FmMenuItem, {
|
|
255
|
+
label: "Send",
|
|
256
|
+
onClick: async (o) => {
|
|
257
|
+
var c;
|
|
258
|
+
o.stopPropagation(), (c = d.value) == null || c.showSheet({
|
|
259
|
+
campaignId: e.row.original._id
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
})
|
|
263
|
+
), a.unshift(
|
|
264
|
+
v(x.FmMenuItem, {
|
|
265
|
+
label: "Share",
|
|
266
|
+
onClick: async (o) => {
|
|
267
|
+
if (o.stopPropagation(), e.row.original.event.type !== "SIMPLE_CLAIM")
|
|
268
|
+
return await z.confirm(
|
|
269
|
+
"Cannot share a voucher that is not a simple claim.",
|
|
270
|
+
"Share Voucher",
|
|
271
|
+
"OK"
|
|
272
|
+
);
|
|
273
|
+
await se(
|
|
274
|
+
`https://${le().currentBusiness.value._id}.${Se.appUrl}/vouchers/${e.row.original._id}`,
|
|
275
|
+
{
|
|
276
|
+
successMessage: "Voucher link copied to clipboard"
|
|
277
|
+
}
|
|
278
|
+
);
|
|
279
|
+
}
|
|
280
|
+
})
|
|
281
|
+
)), a;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
)
|
|
285
|
+
]);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
], l = y(), d = y();
|
|
289
|
+
async function C(e) {
|
|
290
|
+
await z.remove(`Are you sure you want to remove ${e.name}?`) && await f(
|
|
291
|
+
async () => {
|
|
292
|
+
await F.delete(e._id), await i.read("VOUCHER");
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
message: `Removing ${e.name}`,
|
|
296
|
+
successMessage: `Removed ${e.name} successfully`
|
|
297
|
+
}
|
|
298
|
+
);
|
|
299
|
+
}
|
|
300
|
+
async function b(e) {
|
|
301
|
+
e ? await a() : P.open(async (o) => {
|
|
302
|
+
await a(o);
|
|
303
|
+
});
|
|
304
|
+
async function a(o) {
|
|
305
|
+
var c;
|
|
306
|
+
(c = l.value) == null || c.showSheet(
|
|
307
|
+
!0,
|
|
308
|
+
"VOUCHER",
|
|
309
|
+
e ? await F.readById(e._id) : void 0,
|
|
310
|
+
o
|
|
311
|
+
);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
async function $(e) {
|
|
315
|
+
e.campaign._id && await new Promise((a) => {
|
|
316
|
+
L.open({
|
|
317
|
+
title: "Confirmation",
|
|
318
|
+
message: "This will change all future vouchers? Would you like to update previous claimed vouchers expiry date and discount?",
|
|
319
|
+
primaryActions: { text: "Update all", close: !0 },
|
|
320
|
+
secondaryActions: { text: "Update future only", close: !0 }
|
|
321
|
+
}).onPrimary(async () => {
|
|
322
|
+
var o;
|
|
323
|
+
e.updateCollections = !0, (o = window.top) == null || o.postMessage("updateAllVoucher", "*"), a();
|
|
324
|
+
}).onSecondary(async () => {
|
|
325
|
+
a();
|
|
326
|
+
});
|
|
327
|
+
}), await f(
|
|
328
|
+
async () => {
|
|
329
|
+
e.campaign._id ? await F.update(e.campaign._id, e) : await F.create(e), await i.read("VOUCHER");
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
message: `${e.campaign._id ? "Updating" : "Creating"} voucher`,
|
|
333
|
+
successMessage: `Voucher ${e.campaign._id ? "updated" : "created"} successfully`
|
|
334
|
+
}
|
|
335
|
+
);
|
|
336
|
+
}
|
|
337
|
+
return J(async () => {
|
|
338
|
+
await E(async () => {
|
|
339
|
+
await i.read("VOUCHER");
|
|
340
|
+
});
|
|
341
|
+
}), (e, a) => {
|
|
342
|
+
const o = p("FmPageHead"), c = p("FmSearch"), w = p("FmTable"), S = p("FmButton"), h = p("FmListItem"), Z = p("FmList"), Y = p("FmCard");
|
|
343
|
+
return g(), O(T, null, [
|
|
344
|
+
r(o, {
|
|
345
|
+
title: "Voucher",
|
|
346
|
+
actions: t(_).length > 0 ? [U] : [],
|
|
347
|
+
"onClick:action": a[0] || (a[0] = () => b())
|
|
348
|
+
}, null, 8, ["actions"]),
|
|
349
|
+
s("div", xe, [
|
|
350
|
+
r(c, {
|
|
351
|
+
modelValue: t(m).searchKey,
|
|
352
|
+
"onUpdate:modelValue": a[1] || (a[1] = (n) => t(m).searchKey = n),
|
|
353
|
+
class: "hidden xs:block border-b-2 border-fm-color-neutral-gray-100",
|
|
354
|
+
placeholder: "search",
|
|
355
|
+
collapsible: ""
|
|
356
|
+
}, null, 8, ["modelValue"]),
|
|
357
|
+
t(i).campaigns.voucher && t(i).campaigns.voucher.length > 0 ? (g(), O(T, { key: 0 }, [
|
|
358
|
+
s("div", Ve, [
|
|
359
|
+
s("div", ke, [
|
|
360
|
+
r(fe, {
|
|
361
|
+
modelValue: t(m).location,
|
|
362
|
+
"onUpdate:modelValue": a[2] || (a[2] = (n) => t(m).location = n),
|
|
363
|
+
label: "Location: ",
|
|
364
|
+
"show-item-label": !0,
|
|
365
|
+
icon: "storefront",
|
|
366
|
+
placement: "bottom-start",
|
|
367
|
+
items: t(R).locationItems
|
|
368
|
+
}, null, 8, ["modelValue", "items"])
|
|
369
|
+
]),
|
|
370
|
+
r(c, {
|
|
371
|
+
modelValue: t(m).searchKey,
|
|
372
|
+
"onUpdate:modelValue": a[3] || (a[3] = (n) => t(m).searchKey = n),
|
|
373
|
+
class: "xs:hidden",
|
|
374
|
+
placeholder: "search",
|
|
375
|
+
collapsible: ""
|
|
376
|
+
}, null, 8, ["modelValue"])
|
|
377
|
+
]),
|
|
378
|
+
r(w, {
|
|
379
|
+
class: "xs:hidden",
|
|
380
|
+
"row-data": t(_),
|
|
381
|
+
"column-defs": A,
|
|
382
|
+
"search-value": t(m).searchKey,
|
|
383
|
+
"column-filter": [],
|
|
384
|
+
onRowClick: a[4] || (a[4] = (n) => b(n.original)),
|
|
385
|
+
"hide-footer": t(_).length < 10
|
|
386
|
+
}, null, 8, ["row-data", "search-value", "hide-footer"]),
|
|
387
|
+
r(Z, { class: "hidden xs:flex flex-col mx-[-24px]" }, {
|
|
388
|
+
default: I(() => [
|
|
389
|
+
(g(!0), O(T, null, ae(t(_).filter(
|
|
390
|
+
(n) => n.name.toLowerCase().includes(t(m).searchKey.toLowerCase())
|
|
391
|
+
), (n) => (g(), V(h, {
|
|
392
|
+
key: n._id.toString(),
|
|
393
|
+
onClick: (B) => b(n),
|
|
394
|
+
class: "py-12 px-16 flex items-center justify-between border-b border-fm-color-neutral-gray-100"
|
|
395
|
+
}, {
|
|
396
|
+
default: I(() => {
|
|
397
|
+
var B;
|
|
398
|
+
return [
|
|
399
|
+
s("div", Fe, [
|
|
400
|
+
s("div", Ie, [
|
|
401
|
+
(g(), V(te(t(q)(n)))),
|
|
402
|
+
s("div", Le, M(((B = n.pf_collectible) == null ? void 0 : B.currentReceive) ?? 0) + " claimed ", 1)
|
|
403
|
+
]),
|
|
404
|
+
s("div", Re, [
|
|
405
|
+
s("div", Me, M(n.name), 1),
|
|
406
|
+
s("div", Ue, M(t(G)(n)), 1)
|
|
407
|
+
])
|
|
408
|
+
]),
|
|
409
|
+
s("div", Pe, [
|
|
410
|
+
n.event.type === "SIMPLE_CLAIM" ? (g(), V(S, {
|
|
411
|
+
key: 0,
|
|
412
|
+
icon: "visibility",
|
|
413
|
+
"icon-color": "neutral-gray-400",
|
|
414
|
+
variant: "tertiary",
|
|
415
|
+
onClick: async (k) => {
|
|
416
|
+
k.stopPropagation(), await t(ue).push({
|
|
417
|
+
name: t(D)["mf-connect-CAMPAIGN_VOUCHER_COLLECTIONS"],
|
|
418
|
+
params: { id: n._id }
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
}, null, 8, ["onClick"])) : K("", !0),
|
|
422
|
+
n.event.type === "SIMPLE_CLAIM" ? (g(), V(S, {
|
|
423
|
+
key: 1,
|
|
424
|
+
icon: "send",
|
|
425
|
+
"icon-color": "neutral-gray-400",
|
|
426
|
+
variant: "tertiary",
|
|
427
|
+
onClick: (k) => {
|
|
428
|
+
var H;
|
|
429
|
+
k.stopPropagation(), (H = t(d)) == null || H.showSheet({
|
|
430
|
+
campaignId: n._id
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
}, null, 8, ["onClick"])) : K("", !0),
|
|
434
|
+
r(S, {
|
|
435
|
+
icon: "delete",
|
|
436
|
+
"icon-color": "neutral-gray-400",
|
|
437
|
+
variant: "tertiary",
|
|
438
|
+
onClick: (k) => (k.stopPropagation(), C(n))
|
|
439
|
+
}, null, 8, ["onClick"])
|
|
440
|
+
])
|
|
441
|
+
];
|
|
442
|
+
}),
|
|
443
|
+
_: 2
|
|
444
|
+
}, 1032, ["onClick"]))), 128))
|
|
445
|
+
]),
|
|
446
|
+
_: 1
|
|
447
|
+
})
|
|
448
|
+
], 64)) : (g(), V(Y, {
|
|
449
|
+
key: 1,
|
|
450
|
+
variant: "outlined",
|
|
451
|
+
class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
|
|
452
|
+
}, {
|
|
453
|
+
default: I(() => [
|
|
454
|
+
Ee,
|
|
455
|
+
Ae,
|
|
456
|
+
r(S, {
|
|
457
|
+
variant: "primary",
|
|
458
|
+
label: "Create voucher campaign",
|
|
459
|
+
icon: "add",
|
|
460
|
+
onClick: a[5] || (a[5] = (n) => b())
|
|
461
|
+
})
|
|
462
|
+
]),
|
|
463
|
+
_: 1
|
|
464
|
+
})),
|
|
465
|
+
r(pe, {
|
|
466
|
+
ref_key: "sheetRef",
|
|
467
|
+
ref: l,
|
|
468
|
+
"onSubmit:modelValue": $
|
|
469
|
+
}, null, 512),
|
|
470
|
+
r(we, {
|
|
471
|
+
ref_key: "sendVoucherSheetRef",
|
|
472
|
+
ref: d
|
|
473
|
+
}, null, 512)
|
|
474
|
+
])
|
|
475
|
+
], 64);
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
});
|
|
479
|
+
export {
|
|
480
|
+
We as default
|
|
481
|
+
};
|