@feedmepos/mf-connect 0.1.0-beta.2 → 0.1.0-beta.21
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-CZ8gfj2V.js +424 -0
- package/dist/{App-D8a5eW51.js → App-Da9h7lhI.js} +397 -384
- package/dist/{Broadcast-C8jgMe6g.js → Broadcast-m6ehTw7F.js} +32 -32
- package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-pG8WvV4I.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BTKA2Ygl.js} +8 -8
- package/dist/Card-DqZveZ44.js +685 -0
- package/dist/{Collections-lMrdPUuM.js → Collections-XIY6SLgQ.js} +4 -4
- package/dist/{Credit-CJfU5tP4.js → Credit-B6Yg3_al.js} +14 -14
- package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-DLnvDVgf.js +108 -0
- package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-D1gub9ZP.js +2198 -0
- package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-CzEtOmp0.js → EffectSheet.vue_vue_type_style_index_0_lang-tRUwA8zh.js} +8 -8
- package/dist/{Experience-Bp2ki8gU.js → Experience-CsoneWLZ.js} +8 -8
- package/dist/{Game-BpTf6ebE.js → Game-B029f9yE.js} +15 -15
- package/dist/Index-B2LvLfrR.js +226 -0
- package/dist/Marketing-DUTyDRXu.js +20070 -0
- package/dist/{Member-BSWyy32a.js → Member-CATybMaC.js} +4 -4
- package/dist/MemberList-DxvQ7DnC.js +1045 -0
- package/dist/{MemberTransactions-BzHiXCnp.js → MemberTransactions-fEZyBY9P.js} +1 -1
- package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-e-zWg08J.js → MessageInput.vue_vue_type_script_setup_true_lang-BCCEsJZj.js} +2 -2
- package/dist/{Mission-8IGT3T2C.js → Mission-Cl3O0ULj.js} +16 -16
- package/dist/Overview-BVI2xGvT.js +1014 -0
- package/dist/{Point-CbbJ6ohd.js → Point-DSVn47pK.js} +23 -23
- package/dist/{Promotion-BYXCJa_S.js → Promotion-C4HyMpPg.js} +53 -47
- package/dist/Record-BSKXwUu2.js +187 -0
- package/dist/Reward-Cus20Wq5.js +399 -0
- package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-Dm6Vgx8-.js +151 -0
- package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-CqMCdTsv.js +1597 -0
- package/dist/Segment-DAHJ2FYV.js +567 -0
- package/dist/SelectItems.vue_vue_type_script_setup_true_lang-DpkIgpqy.js +181 -0
- package/dist/{Setting-CLpvvZTv.js → Setting-D7dKlTiZ.js} +8 -8
- package/dist/Store-DQdWn1Dw.js +1745 -0
- package/dist/{StoreRewards-CUM2irXK.js → StoreRewards-Cut9mJGn.js} +12 -12
- package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-BQscw_Di.js +957 -0
- package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-DEb4OBcX.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-BVzz2Zkl.js} +1 -1
- package/dist/{Tier-DZTDxWBo.js → Tier-DGpNybHO.js} +15 -15
- package/dist/{Title-C2Dr5ceK.js → Title-D5y8GEwE.js} +15 -15
- package/dist/{Transaction-BL4mS29d.js → Transaction-CCnZouEv.js} +2 -2
- package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-Cr9DV7hr.js +130 -0
- package/dist/{Voucher-Cx0r2-df.js → Voucher-BJ6RC4SS.js} +31 -31
- package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-6751WdaT.js +419 -0
- package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-DWuAODUF.js → ZodTextField.vue_vue_type_script_setup_true_lang-aq-9V3Gc.js} +1 -1
- package/dist/{app-wE5HTF_Y.js → app-D3chCumI.js} +1279 -1282
- package/dist/{app-B_xuZ5HB.js → app-PfWyqx7U.js} +1 -1
- package/dist/app.js +1 -1
- package/dist/{business-DSv8zM8C.js → business-trsrJyHK.js} +1 -1
- package/dist/{campaign-7y5qquHZ.js → campaign-B1rgdv77.js} +2 -2
- package/dist/collectible.enum-ZoD0ya1M.js +19 -0
- package/dist/{collection.fn-BxVZQAx0.js → collection.fn-CnQjdokW.js} +2 -2
- package/dist/{dto-Ew1QwLci.js → dto-DuJumvC2.js} +12 -20
- package/dist/{effect-BzPh8fRI.js → effect-CFYktLyZ.js} +9 -9
- package/dist/email-addresses-BocLAqLt.js +705 -0
- package/dist/{export-C9tDplkA.js → export-BDxbvd3c.js} +3 -3
- package/dist/{helper-Sz7oQ0F4.js → helper-Bx6u7f_W.js} +1 -1
- package/dist/{index-DH_1nOJ_.js → index-7QsBQpBM.js} +39 -35
- package/dist/{index-z0IfdrZk.js → index-AcoIUTDS.js} +203 -195
- package/dist/{index-C3_4GUiI.js → index-BAUe6Mqp.js} +7 -1
- package/dist/{index-C0lpADCo.js → index-C20tnKDo.js} +1 -1
- package/dist/{index-C-SOz7jt.js → index-CDgSJNKm.js} +1 -1
- package/dist/{index-DBMaUGYI.js → index-CTnZ9dt0.js} +30 -26
- package/dist/index-CUMB0mpB.js +28997 -0
- package/dist/index-CsF6BSZU.js +1067 -0
- package/dist/index-CsaQJMAR.js +66 -0
- package/dist/{index-tv4t0Pnh.js → index-DwXHEi0X.js} +1 -1
- package/dist/{index-_3qBsogG.js → index-ZXWgygOr.js} +1500 -1479
- package/dist/index-_v_LQTuR.js +53 -0
- package/dist/index-kLMiwwB-.js +38 -0
- package/dist/{index-gIRszcHf.js → index-pRpTA8Kd.js} +1 -1
- package/dist/{index.esm2017-BnKJDxUo.js → index.esm2017-DuOZ7nuk.js} +33 -33
- package/dist/{loading-Ds-yFYhc.js → loading-BTEwnG5-.js} +591 -597
- package/dist/{membership-DaiVw9qF.js → membership-DkH7qw6W.js} +51 -43
- package/dist/money-BfCdj0Ts.js +15 -0
- package/dist/number-BKHcstZb.js +12 -0
- package/dist/objectid-CumRza_j.js +145 -0
- package/dist/remy-vue-client-Cpppk9h-.js +1693 -0
- package/dist/reward-DpR3xoxT.js +36 -0
- package/dist/{rule-Cd2M6Ri2.js → rule-Hb9_sJvP.js} +180 -177
- package/dist/{rule-builder-B6og27Q1.js → rule-builder-BhwlX4fv.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/{template-DouRWBpv.js → template-PkDFDppy.js} +5 -5
- package/dist/trigger-vLHrldAH.js +114 -0
- package/dist/{vue-i18n-BTlOChXs.js → vue-i18n-ComnFt3O.js} +2 -2
- package/dist/{xlsx-SahfXQ70.js → xlsx-CsUJ1mq4.js} +1 -1
- package/package.json +8 -7
- package/dist/Analytic-DSD9TsKr.js +0 -622
- package/dist/Card-C1K7ULPo.js +0 -825
- package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-BYoaa_-x.js +0 -2809
- package/dist/Marketing-BiKE2gxA.js +0 -316
- package/dist/MemberList-CHlGREyR.js +0 -1733
- package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-Bruh-umZ.js +0 -1753
- package/dist/Segment-DXDNM0yd.js +0 -437
- package/dist/Store-C6-P6bwc.js +0 -1511
- package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-JaRdmqif.js +0 -890
- package/dist/index-BQm0C3Jm.js +0 -298
- package/dist/index-CuvNtC_M.js +0 -61
- package/dist/index-D-2nFLsg.js +0 -762
- package/dist/index-Dy4pmQpt.js +0 -29193
- package/dist/money-BHtBdZoz.js +0 -15
- package/dist/number-CZhcB8ef.js +0 -12
|
@@ -0,0 +1,1014 @@
|
|
|
1
|
+
import { defineComponent as Y, resolveComponent as _, openBlock as S, createElementBlock as B, Fragment as H, createVNode as i, withCtx as $, createElementVNode as a, toDisplayString as E, unref as r, renderSlot as pe, ref as x, computed as j, watch as ne, createBlock as M, isRef as z, resolveDynamicComponent as oe, renderList as te, normalizeClass as le, createTextVNode as he, createCommentVNode as Q, h as se, onMounted as ve } from "vue";
|
|
2
|
+
import { _ as ge } from "./campaign-CpzFl8Vr.js";
|
|
3
|
+
import { u as W } from "./vue-i18n-ComnFt3O.js";
|
|
4
|
+
import { p as K, u as ie } from "./loading-BTEwnG5-.js";
|
|
5
|
+
import { J as X } from "./JsonViewer-v8_C7l5N.js";
|
|
6
|
+
import { Z as G } from "./zod-Bg2FbC-D.js";
|
|
7
|
+
import { u as q } from "./app-wDQR6dpb.js";
|
|
8
|
+
import { u as Z, _ as we } from "./RewardGroup.vue_vue_type_script_setup_true_lang-Dm6Vgx8-.js";
|
|
9
|
+
import { u as de } from "./reward-DpR3xoxT.js";
|
|
10
|
+
import "./index-CTnZ9dt0.js";
|
|
11
|
+
import "./index-ZXWgygOr.js";
|
|
12
|
+
import { l as ae, m as _e } from "./index-CsF6BSZU.js";
|
|
13
|
+
import "./index-7QsBQpBM.js";
|
|
14
|
+
import { a as ye, b as be } from "./index-AcoIUTDS.js";
|
|
15
|
+
import "./index-C20tnKDo.js";
|
|
16
|
+
import "./index-_v_LQTuR.js";
|
|
17
|
+
import { C as ce } from "./membership-DkH7qw6W.js";
|
|
18
|
+
import { t as ee } from "./helper-Bx6u7f_W.js";
|
|
19
|
+
import { c as N } from "./object-qECH92oz.js";
|
|
20
|
+
import { useDialog as xe, components as ue } from "@feedmepos/ui-library";
|
|
21
|
+
import { _ as Ce } from "./ZodTextField.vue_vue_type_script_setup_true_lang-aq-9V3Gc.js";
|
|
22
|
+
import { a as Re, _ as Se } from "./trigger-vLHrldAH.js";
|
|
23
|
+
import { O as Fe } from "./objectid-CumRza_j.js";
|
|
24
|
+
import { r as me } from "./index-kLMiwwB-.js";
|
|
25
|
+
import { u as $e } from "./business-trsrJyHK.js";
|
|
26
|
+
const ke = { class: "flex items-center justify-between flex-1 xs:hidden" }, Pe = { class: "flex items-center gap-x-24 h-[80px] p-8 flex-1" }, Ve = { class: "flex-1" }, Ie = { class: "flex items-center gap-8" }, Te = { class: "fm-typo-en-title-sm-800" }, Ue = { class: "flex gap-8 items-center" }, Ae = { class: "space-y-4 hidden xs:block border-b border-fm-color-neutral-gray-100 px-16 flex-1" }, Le = { class: "flex items-center justify-between" }, Be = { class: "flex items-center gap-x-24 h-[80px] p-8 flex-1" }, Ee = { class: "flex-1 space-y-4" }, Oe = { class: "fm-typo-en-body-lg-600" }, je = /* @__PURE__ */ Y({
|
|
27
|
+
__name: "ReferralRewadGroupCard",
|
|
28
|
+
props: {
|
|
29
|
+
rewardGroup: {
|
|
30
|
+
type: Object,
|
|
31
|
+
required: !0
|
|
32
|
+
},
|
|
33
|
+
level: {
|
|
34
|
+
type: Number,
|
|
35
|
+
required: !0
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
emits: ["edit", "addCount", "remove"],
|
|
39
|
+
setup(C, { emit: f }) {
|
|
40
|
+
const { t: k } = W(), p = f;
|
|
41
|
+
return (g, m) => {
|
|
42
|
+
const n = _("FmButton"), c = _("FmListItem");
|
|
43
|
+
return S(), B(H, null, [
|
|
44
|
+
i(c, {
|
|
45
|
+
onClick: m[4] || (m[4] = (u) => p("edit", C.level)),
|
|
46
|
+
class: "!p-0"
|
|
47
|
+
}, {
|
|
48
|
+
default: $(() => [
|
|
49
|
+
a("div", ke, [
|
|
50
|
+
a("div", Pe, [
|
|
51
|
+
a("div", Ve, [
|
|
52
|
+
a("div", Ie, [
|
|
53
|
+
a("div", Te, E(C.rewardGroup.name), 1)
|
|
54
|
+
])
|
|
55
|
+
])
|
|
56
|
+
]),
|
|
57
|
+
a("div", Ue, [
|
|
58
|
+
i(n, {
|
|
59
|
+
variant: "secondary",
|
|
60
|
+
label: r(k)("connect.referral.reward.add_count"),
|
|
61
|
+
icon: "add",
|
|
62
|
+
onClick: m[0] || (m[0] = (u) => {
|
|
63
|
+
u.stopPropagation(), p("addCount", C.level);
|
|
64
|
+
})
|
|
65
|
+
}, null, 8, ["label"]),
|
|
66
|
+
i(n, {
|
|
67
|
+
icon: "delete",
|
|
68
|
+
onClick: m[1] || (m[1] = (u) => {
|
|
69
|
+
u.stopPropagation(), p("remove", C.level);
|
|
70
|
+
}),
|
|
71
|
+
variant: "tertiary"
|
|
72
|
+
})
|
|
73
|
+
])
|
|
74
|
+
]),
|
|
75
|
+
a("div", Ae, [
|
|
76
|
+
a("div", Le, [
|
|
77
|
+
a("div", Be, [
|
|
78
|
+
a("div", Ee, [
|
|
79
|
+
a("div", null, [
|
|
80
|
+
a("div", Oe, E(C.rewardGroup.name), 1)
|
|
81
|
+
])
|
|
82
|
+
])
|
|
83
|
+
]),
|
|
84
|
+
i(n, {
|
|
85
|
+
variant: "tertiary",
|
|
86
|
+
icon: "delete",
|
|
87
|
+
onClick: m[2] || (m[2] = (u) => (u.stopPropagation(), p("remove", C.level)))
|
|
88
|
+
})
|
|
89
|
+
]),
|
|
90
|
+
i(n, {
|
|
91
|
+
class: "w-full",
|
|
92
|
+
variant: "secondary",
|
|
93
|
+
label: "Add count",
|
|
94
|
+
disabled: !0,
|
|
95
|
+
icon: "add",
|
|
96
|
+
onClick: m[3] || (m[3] = (u) => (u.stopPropagation(), p("addCount", C.level)))
|
|
97
|
+
})
|
|
98
|
+
])
|
|
99
|
+
]),
|
|
100
|
+
_: 1
|
|
101
|
+
}),
|
|
102
|
+
pe(g.$slots, "default")
|
|
103
|
+
], 64);
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
}), De = { class: "flex flex-col space-y-16 pr-12" }, Ge = { class: "flex gap-16 items-center" }, Me = { class: "fm-typo-en-title-sm-800" }, Ne = { class: "flex items-center gap-8" }, He = /* @__PURE__ */ Y({
|
|
107
|
+
__name: "EditReferralCountSheet",
|
|
108
|
+
emits: ["update"],
|
|
109
|
+
setup(C, { expose: f, emit: k }) {
|
|
110
|
+
const { t: p } = W(), g = k, m = x(!1), n = x({}), c = x(-1), u = x(-1), R = Z(), V = ye.superRefine((e, t) => {
|
|
111
|
+
var U, A, v, I, L, J, re;
|
|
112
|
+
const d = u.value == -1 ? ((v = (A = (U = R.referralProgram) == null ? void 0 : U.reward[c.value]) == null ? void 0 : A.rewards) == null ? void 0 : v.length) || 0 : u.value, F = (L = (I = R.referralProgram) == null ? void 0 : I.reward[c.value]) == null ? void 0 : L.rewards[d - 1], b = (re = (J = R.referralProgram) == null ? void 0 : J.reward[c.value]) == null ? void 0 : re.rewards[d + 1];
|
|
113
|
+
F && e.threshold.from < F.threshold.from + 1 && t.addIssue({
|
|
114
|
+
code: "custom",
|
|
115
|
+
message: `The min referral must be at least ${F.threshold.from + 1}`,
|
|
116
|
+
path: ["option"]
|
|
117
|
+
}), b && e.threshold.to && b.threshold.to && e.threshold.to > b.threshold.to - 1 && t.addIssue({
|
|
118
|
+
code: "custom",
|
|
119
|
+
message: `The max referral must be at most ${b.threshold.to - 2}`,
|
|
120
|
+
path: ["option"]
|
|
121
|
+
});
|
|
122
|
+
}), P = j(() => {
|
|
123
|
+
const e = V.safeParse(n.value);
|
|
124
|
+
return e.success ? [] : e.error.errors;
|
|
125
|
+
});
|
|
126
|
+
function D() {
|
|
127
|
+
const e = V.safeParse(n.value);
|
|
128
|
+
e.success && g("update", {
|
|
129
|
+
groupIndex: c.value,
|
|
130
|
+
countIndex: u.value,
|
|
131
|
+
referralCount: e.data
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
async function O(e, t) {
|
|
135
|
+
var d;
|
|
136
|
+
m.value = e, e && typeof (t == null ? void 0 : t.countIndex) == "number" && t.countIndex >= 0 ? (c.value = t.groupIndex, u.value = t.countIndex, n.value = N(
|
|
137
|
+
(d = R.referralProgram) == null ? void 0 : d.reward[t.groupIndex].rewards[t.countIndex]
|
|
138
|
+
)) : (c.value = t.groupIndex, u.value = -1, n.value = {
|
|
139
|
+
threshold: {
|
|
140
|
+
from: 0,
|
|
141
|
+
to: null
|
|
142
|
+
},
|
|
143
|
+
rewards: []
|
|
144
|
+
}), h.value = [], h.value = l.value.map(
|
|
145
|
+
(F) => n.value.rewards.includes(F.id)
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
function T() {
|
|
149
|
+
m.value = !1;
|
|
150
|
+
}
|
|
151
|
+
const w = [
|
|
152
|
+
{
|
|
153
|
+
header: "Reward title",
|
|
154
|
+
accessorFn: (e) => e.name,
|
|
155
|
+
enableSorting: !0
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
id: "type",
|
|
159
|
+
header: "Reward type",
|
|
160
|
+
cell(e) {
|
|
161
|
+
return ce[e.row.original.collectibleConfig.type].chip();
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
header: "Description",
|
|
166
|
+
accessorFn: (e) => e.description,
|
|
167
|
+
cell(e) {
|
|
168
|
+
const t = e.row.original;
|
|
169
|
+
if (t.collectible.type == "VOUCHER" || t.selectedReward == null)
|
|
170
|
+
return t.description;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
], s = de(), o = x([]), l = j(() => s.rewards.map((e) => {
|
|
174
|
+
let t = "No expiry";
|
|
175
|
+
switch (e.option.type) {
|
|
176
|
+
case "VOUCHER":
|
|
177
|
+
t = `${e.option.collectibleConfig.options.maxUse} use(s), ${ee(e.option.collectibleConfig.options.validityOption || {})}`;
|
|
178
|
+
break;
|
|
179
|
+
case "LOYALTY":
|
|
180
|
+
t = `${e.option.earningOption.amount}, ${ee(e.option.validityOption || {})}`;
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
return {
|
|
184
|
+
id: e._id,
|
|
185
|
+
name: e.name,
|
|
186
|
+
collectible: e.option,
|
|
187
|
+
collectibleConfig: e.collectibleConfig,
|
|
188
|
+
description: t
|
|
189
|
+
};
|
|
190
|
+
}));
|
|
191
|
+
j(() => []);
|
|
192
|
+
function y() {
|
|
193
|
+
const e = l.value;
|
|
194
|
+
for (let t = 0; t < e.length; t++) {
|
|
195
|
+
const d = e[t], F = h.value[t];
|
|
196
|
+
F && !n.value.rewards.includes(d.id) && n.value.rewards.push(d.id), !F && n.value.rewards.includes(d.id) && (n.value.rewards = n.value.rewards.filter(
|
|
197
|
+
(b) => b != d.id
|
|
198
|
+
));
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
const h = x({});
|
|
202
|
+
return ne(h, y, { deep: !0 }), f({
|
|
203
|
+
showSheet: O,
|
|
204
|
+
hideSheet: T,
|
|
205
|
+
data: n
|
|
206
|
+
}), (e, t) => {
|
|
207
|
+
const d = _("FmStepperField"), F = _("FmHelperText"), b = _("FmTable"), U = _("FmButton"), A = _("FmSideSheet");
|
|
208
|
+
return S(), M(A, {
|
|
209
|
+
"max-width": 1e3,
|
|
210
|
+
modelValue: r(m),
|
|
211
|
+
"onUpdate:modelValue": t[4] || (t[4] = (v) => z(m) ? m.value = v : null),
|
|
212
|
+
header: `${r(u) == -1 ? r(p)("connect.referral.editReferralCountSheet.add") : r(p)("connect.referral.editReferralCountSheet.edit")}`
|
|
213
|
+
}, {
|
|
214
|
+
"side-sheet-footer": $(() => [
|
|
215
|
+
a("div", Ne, [
|
|
216
|
+
i(U, {
|
|
217
|
+
label: r(p)("connect.editTierSheet.submit"),
|
|
218
|
+
onClick: D,
|
|
219
|
+
disabled: r(P).length > 0 || r(q)().isLoading,
|
|
220
|
+
loading: r(q)().isLoading
|
|
221
|
+
}, null, 8, ["label", "disabled", "loading"]),
|
|
222
|
+
i(U, {
|
|
223
|
+
label: r(p)("connect.editTierSheet.cancel"),
|
|
224
|
+
onClick: t[3] || (t[3] = (v) => T()),
|
|
225
|
+
variant: "tertiary"
|
|
226
|
+
}, null, 8, ["label"])
|
|
227
|
+
])
|
|
228
|
+
]),
|
|
229
|
+
default: $(() => [
|
|
230
|
+
i(X, { json: r(n) }, null, 8, ["json"]),
|
|
231
|
+
i(X, { json: r(P) }, null, 8, ["json"]),
|
|
232
|
+
a("div", De, [
|
|
233
|
+
a("div", null, [
|
|
234
|
+
a("div", Ge, [
|
|
235
|
+
i(d, {
|
|
236
|
+
modelValue: r(n).threshold.from,
|
|
237
|
+
"onUpdate:modelValue": t[0] || (t[0] = (v) => r(n).threshold.from = v),
|
|
238
|
+
"show-steppers": !1,
|
|
239
|
+
rules: [r(G).ruleAtPath(r(V), "threshold.from")]
|
|
240
|
+
}, {
|
|
241
|
+
label: $(() => [
|
|
242
|
+
(S(), M(oe(
|
|
243
|
+
r(G).toInputLabel(
|
|
244
|
+
r(G).typeAtPath(r(V), "threshold.from"),
|
|
245
|
+
r(p)(
|
|
246
|
+
"connect.referral.editReferralCountSheet.min_referral_count"
|
|
247
|
+
)
|
|
248
|
+
)
|
|
249
|
+
)))
|
|
250
|
+
]),
|
|
251
|
+
_: 1
|
|
252
|
+
}, 8, ["modelValue", "rules"]),
|
|
253
|
+
i(d, {
|
|
254
|
+
modelValue: r(n).threshold.to,
|
|
255
|
+
"onUpdate:modelValue": t[1] || (t[1] = (v) => r(n).threshold.to = v),
|
|
256
|
+
"show-steppers": !1,
|
|
257
|
+
rules: [r(G).ruleAtPath(r(V), "threshold.to")]
|
|
258
|
+
}, {
|
|
259
|
+
label: $(() => [
|
|
260
|
+
(S(), M(oe(
|
|
261
|
+
r(G).toInputLabel(
|
|
262
|
+
r(G).typeAtPath(r(V), "threshold.to"),
|
|
263
|
+
r(p)(
|
|
264
|
+
"connect.referral.editReferralCountSheet.max_referral_count"
|
|
265
|
+
)
|
|
266
|
+
)
|
|
267
|
+
)))
|
|
268
|
+
]),
|
|
269
|
+
_: 1
|
|
270
|
+
}, 8, ["modelValue", "rules"])
|
|
271
|
+
]),
|
|
272
|
+
i(F, {
|
|
273
|
+
text: r(G).helperText(r(P), "option"),
|
|
274
|
+
state: r(G).helperState(r(P), "option")
|
|
275
|
+
}, null, 8, ["text", "state"]),
|
|
276
|
+
t[5] || (t[5] = a("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " When max. referral count is not set, it will default unlimited ", -1))
|
|
277
|
+
]),
|
|
278
|
+
a("div", Me, E(r(p)("connect.referral.editReferralCountSheet.referrer_reward")), 1),
|
|
279
|
+
i(b, {
|
|
280
|
+
modelValue: r(h),
|
|
281
|
+
"onUpdate:modelValue": t[2] || (t[2] = (v) => z(h) ? h.value = v : null),
|
|
282
|
+
selection: "multiple",
|
|
283
|
+
"column-filter": r(o),
|
|
284
|
+
"column-defs": w,
|
|
285
|
+
"row-data": r(l),
|
|
286
|
+
"page-size": 10
|
|
287
|
+
}, null, 8, ["modelValue", "column-filter", "row-data"])
|
|
288
|
+
])
|
|
289
|
+
]),
|
|
290
|
+
_: 1
|
|
291
|
+
}, 8, ["modelValue", "header"]);
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
}), Ye = { class: "space-y-16" }, ze = { class: "grid grid-cols-3 gap-16" }, qe = { class: "fm-typo-en-title-sm-800" }, We = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Je = /* @__PURE__ */ Y({
|
|
295
|
+
__name: "CriteriaTriggerInput",
|
|
296
|
+
props: {
|
|
297
|
+
modelValue: {
|
|
298
|
+
type: String
|
|
299
|
+
},
|
|
300
|
+
disabled: {
|
|
301
|
+
type: Boolean,
|
|
302
|
+
default: !1
|
|
303
|
+
}
|
|
304
|
+
},
|
|
305
|
+
emits: ["update:model-value"],
|
|
306
|
+
setup(C, { emit: f }) {
|
|
307
|
+
const k = C, p = f, g = j(() => [
|
|
308
|
+
ae.enum.BILL_COMPLETED,
|
|
309
|
+
ae.enum.FEEDBACK
|
|
310
|
+
].map((m) => Re[m]));
|
|
311
|
+
return (m, n) => {
|
|
312
|
+
const c = _("FmCard");
|
|
313
|
+
return S(), B("div", Ye, [
|
|
314
|
+
n[0] || (n[0] = a("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Define the conditions that must be met to activate a reward. ", -1)),
|
|
315
|
+
a("div", ze, [
|
|
316
|
+
(S(!0), B(H, null, te(r(g), (u) => (S(), M(c, {
|
|
317
|
+
key: u.name,
|
|
318
|
+
variant: "outlined",
|
|
319
|
+
disabled: k.disabled,
|
|
320
|
+
class: le(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
|
|
321
|
+
"col-span-3": r(g).length == 1,
|
|
322
|
+
"border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": C.modelValue == u.value,
|
|
323
|
+
"hover:bg-fm-color-opacity-sm": C.modelValue != u.value
|
|
324
|
+
}]),
|
|
325
|
+
onClick: () => {
|
|
326
|
+
k.modelValue != u.value && !k.disabled && p("update:model-value", u.value);
|
|
327
|
+
}
|
|
328
|
+
}, {
|
|
329
|
+
default: $(() => [
|
|
330
|
+
a("div", qe, E(u.name), 1),
|
|
331
|
+
a("div", We, E(u.description), 1)
|
|
332
|
+
]),
|
|
333
|
+
_: 2
|
|
334
|
+
}, 1032, ["disabled", "class", "onClick"]))), 128))
|
|
335
|
+
])
|
|
336
|
+
]);
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
}), Ke = { class: "flex items-center gap-x-8" }, Ze = { class: "flex flex-col space-y-16 pr-12" }, Qe = {
|
|
340
|
+
key: 0,
|
|
341
|
+
class: "space-y-16"
|
|
342
|
+
}, Xe = { class: "flex items-center gap-8" }, et = /* @__PURE__ */ Y({
|
|
343
|
+
__name: "EditCriteriaSheet",
|
|
344
|
+
emits: ["update"],
|
|
345
|
+
setup(C, { expose: f, emit: k }) {
|
|
346
|
+
const { t: p } = W(), g = k, m = x(!1), n = x(-1), c = x({}), u = Z(), R = be.superRefine((w, s) => {
|
|
347
|
+
w.name.length >= 50 && s.addIssue({
|
|
348
|
+
code: "custom",
|
|
349
|
+
message: "Name must be less than 50 characters"
|
|
350
|
+
}), w.name.length < 1 && s.addIssue({
|
|
351
|
+
code: "custom",
|
|
352
|
+
message: "Name is required"
|
|
353
|
+
});
|
|
354
|
+
}), V = j(() => {
|
|
355
|
+
const w = R.safeParse(c.value);
|
|
356
|
+
return w.success ? [] : w.error.errors;
|
|
357
|
+
});
|
|
358
|
+
function P(w, s) {
|
|
359
|
+
var o;
|
|
360
|
+
m.value = w, w && typeof s == "number" && s >= 0 ? (n.value = s, c.value = N(
|
|
361
|
+
(o = u.referralProgram) == null ? void 0 : o.criteria[s]
|
|
362
|
+
)) : (n.value = -1, c.value = {
|
|
363
|
+
_id: new Fe().toString(),
|
|
364
|
+
name: "",
|
|
365
|
+
type: "AUTO",
|
|
366
|
+
event: { type: "BILL_COMPLETED" }
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
function D() {
|
|
370
|
+
m.value = !1;
|
|
371
|
+
}
|
|
372
|
+
function O() {
|
|
373
|
+
const w = R.safeParse(c.value);
|
|
374
|
+
w.success && g("update", n.value, w.data);
|
|
375
|
+
}
|
|
376
|
+
function T(w) {
|
|
377
|
+
c.value.type = w, w == "AUTO" ? c.value.event = { type: "BILL_COMPLETED" } : c.value.event = void 0;
|
|
378
|
+
}
|
|
379
|
+
return f({
|
|
380
|
+
showSheet: P,
|
|
381
|
+
hideSheet: D,
|
|
382
|
+
data: c
|
|
383
|
+
}), (w, s) => {
|
|
384
|
+
const o = _("FmButton"), l = _("FmRadio"), y = _("FmRadioGroup"), h = _("FmSideSheet");
|
|
385
|
+
return S(), M(h, {
|
|
386
|
+
"max-width": 768,
|
|
387
|
+
modelValue: r(m),
|
|
388
|
+
"onUpdate:modelValue": s[5] || (s[5] = (e) => z(m) ? m.value = e : null)
|
|
389
|
+
}, {
|
|
390
|
+
"side-sheet-header": $(() => [
|
|
391
|
+
a("div", Ke, [
|
|
392
|
+
i(o, {
|
|
393
|
+
icon: "arrow_back",
|
|
394
|
+
variant: "tertiary",
|
|
395
|
+
onClick: s[0] || (s[0] = (e) => P(!1))
|
|
396
|
+
}),
|
|
397
|
+
s[6] || (s[6] = he("Add Criteria "))
|
|
398
|
+
])
|
|
399
|
+
]),
|
|
400
|
+
"side-sheet-footer": $(() => [
|
|
401
|
+
a("div", Xe, [
|
|
402
|
+
i(o, {
|
|
403
|
+
label: r(p)("connect.editTierSheet.submit"),
|
|
404
|
+
onClick: O,
|
|
405
|
+
disabled: r(V).length > 0 || r(q)().isLoading,
|
|
406
|
+
loading: r(q)().isLoading
|
|
407
|
+
}, null, 8, ["label", "disabled", "loading"]),
|
|
408
|
+
i(o, {
|
|
409
|
+
label: r(p)("connect.editTierSheet.cancel"),
|
|
410
|
+
onClick: s[4] || (s[4] = (e) => P(!1)),
|
|
411
|
+
variant: "tertiary"
|
|
412
|
+
}, null, 8, ["label"])
|
|
413
|
+
])
|
|
414
|
+
]),
|
|
415
|
+
default: $(() => [
|
|
416
|
+
i(X, { json: r(c) }, null, 8, ["json"]),
|
|
417
|
+
a("div", Ze, [
|
|
418
|
+
s[10] || (s[10] = a("div", { class: "fm-typo-en-title-sm-600" }, "Program Criteria", -1)),
|
|
419
|
+
i(Ce, {
|
|
420
|
+
modelValue: r(c).name,
|
|
421
|
+
"onUpdate:modelValue": s[1] || (s[1] = (e) => r(c).name = e),
|
|
422
|
+
label: r(p)("connect.referral.editReferralTierSheet.name"),
|
|
423
|
+
schema: r(G).typeAtPath(r(R), "name")
|
|
424
|
+
}, null, 8, ["modelValue", "label", "schema"]),
|
|
425
|
+
s[11] || (s[11] = a("div", { class: "fm-typo-en-title-sm-600" }, "Configuration", -1)),
|
|
426
|
+
i(y, {
|
|
427
|
+
"model-value": r(c).type,
|
|
428
|
+
label: "Verify status",
|
|
429
|
+
"onUpdate:modelValue": T
|
|
430
|
+
}, {
|
|
431
|
+
default: $(() => [
|
|
432
|
+
i(l, {
|
|
433
|
+
value: "AUTO",
|
|
434
|
+
label: "Auto",
|
|
435
|
+
sublabel: "Verify based on rule configuration"
|
|
436
|
+
}),
|
|
437
|
+
i(l, {
|
|
438
|
+
value: "MANUAL",
|
|
439
|
+
label: "Manual",
|
|
440
|
+
sublabel: "Verify based on manual inspection"
|
|
441
|
+
})
|
|
442
|
+
]),
|
|
443
|
+
_: 1
|
|
444
|
+
}, 8, ["model-value"]),
|
|
445
|
+
r(c).type == "AUTO" ? (S(), B(H, { key: 0 }, [
|
|
446
|
+
s[8] || (s[8] = a("div", { class: "fm-typo-en-title-sm-600" }, "Trigger", -1)),
|
|
447
|
+
s[9] || (s[9] = a("div", null, " Select trigger what referee need to complete in order for referral to earn reward ", -1)),
|
|
448
|
+
i(Je, {
|
|
449
|
+
"model-value": r(c).event.type,
|
|
450
|
+
"onUpdate:modelValue": s[2] || (s[2] = (e) => r(c).event.type = e)
|
|
451
|
+
}, null, 8, ["model-value"]),
|
|
452
|
+
r(c).event.type == r(_e).enum.BILL_COMPLETED ? (S(), B("div", Qe, [
|
|
453
|
+
s[7] || (s[7] = a("div", { class: "fm-typo-en-title-sm-600" }, "Spending Criteria", -1)),
|
|
454
|
+
i(Se, {
|
|
455
|
+
"model-value": r(c).event.rule,
|
|
456
|
+
"onUpdate:modelValue": s[3] || (s[3] = (e) => r(c).event.rule = e)
|
|
457
|
+
}, null, 8, ["model-value"])
|
|
458
|
+
])) : Q("", !0)
|
|
459
|
+
], 64)) : Q("", !0)
|
|
460
|
+
])
|
|
461
|
+
]),
|
|
462
|
+
_: 1
|
|
463
|
+
}, 8, ["modelValue"]);
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
});
|
|
467
|
+
function fe() {
|
|
468
|
+
const C = x(!1), f = xe();
|
|
469
|
+
return {
|
|
470
|
+
confirmUpdateReferralRecord: async () => {
|
|
471
|
+
await new Promise((p) => {
|
|
472
|
+
f.open({
|
|
473
|
+
title: "Confirmation",
|
|
474
|
+
message: "This will change all referral settings? Would you like to update previous referral record?",
|
|
475
|
+
primaryActions: { text: "Update all", close: !0 },
|
|
476
|
+
secondaryActions: { text: "Update future only", close: !0 }
|
|
477
|
+
}).onPrimary(async () => {
|
|
478
|
+
C.value = !0, p();
|
|
479
|
+
}).onSecondary(async () => {
|
|
480
|
+
C.value = !1, p();
|
|
481
|
+
});
|
|
482
|
+
});
|
|
483
|
+
},
|
|
484
|
+
updateReferralRecord: C
|
|
485
|
+
};
|
|
486
|
+
}
|
|
487
|
+
const tt = { class: "flex flex-col space-y-16 pr-12" }, rt = { class: "flex justify-between items-center" }, ot = /* @__PURE__ */ Y({
|
|
488
|
+
__name: "ManageCriteriaSheet",
|
|
489
|
+
setup(C, { expose: f }) {
|
|
490
|
+
const { t: k } = W(), { minor: p } = ie, { confirmUpdateReferralRecord: g, updateReferralRecord: m } = fe(), n = x(!1), c = x({}), u = Z(), R = x(
|
|
491
|
+
null
|
|
492
|
+
), V = j(() => {
|
|
493
|
+
var o;
|
|
494
|
+
return (o = u.referralProgram) == null ? void 0 : o.criteria;
|
|
495
|
+
});
|
|
496
|
+
async function P(o) {
|
|
497
|
+
await g(), await p(async () => {
|
|
498
|
+
await me.update({
|
|
499
|
+
...o,
|
|
500
|
+
updateReferralRecord: m.value
|
|
501
|
+
}), await u.readReferralProgram();
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
async function D(o, l) {
|
|
505
|
+
var e, t;
|
|
506
|
+
const y = o == -1 ? ((e = u.referralProgram) == null ? void 0 : e.criteria.length) || 0 : o, h = N(u.referralProgram);
|
|
507
|
+
h.criteria[y] = l, await P(h), (t = R.value) == null || t.showSheet(!1);
|
|
508
|
+
}
|
|
509
|
+
async function O(o) {
|
|
510
|
+
var h, e;
|
|
511
|
+
if (!await K.remove(
|
|
512
|
+
"Are you sure to remove criteria",
|
|
513
|
+
"Remove criteria",
|
|
514
|
+
k("connect.prompt.confirm"),
|
|
515
|
+
k("connect.prompt.cancel")
|
|
516
|
+
))
|
|
517
|
+
return;
|
|
518
|
+
const l = o == -1 ? ((h = u.referralProgram) == null ? void 0 : h.criteria.length) || 0 : o, y = N(u.referralProgram);
|
|
519
|
+
y.criteria.splice(l, 1), await P(y), (e = R.value) == null || e.showSheet(!1);
|
|
520
|
+
}
|
|
521
|
+
const T = [
|
|
522
|
+
{
|
|
523
|
+
header: "Criteria title",
|
|
524
|
+
accessorFn: (o) => o.name
|
|
525
|
+
},
|
|
526
|
+
{
|
|
527
|
+
header: "Validity method",
|
|
528
|
+
accessorFn: (o) => o.type
|
|
529
|
+
},
|
|
530
|
+
{
|
|
531
|
+
header: "Actions",
|
|
532
|
+
cell(o) {
|
|
533
|
+
return [
|
|
534
|
+
se(ue.FmButton, {
|
|
535
|
+
variant: "tertiary",
|
|
536
|
+
icon: "delete",
|
|
537
|
+
iconColor: "neutral-gray-400",
|
|
538
|
+
onClick: (l) => {
|
|
539
|
+
l.stopPropagation(), O(o.row.index);
|
|
540
|
+
}
|
|
541
|
+
})
|
|
542
|
+
];
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
];
|
|
546
|
+
function w(o) {
|
|
547
|
+
n.value = o;
|
|
548
|
+
}
|
|
549
|
+
function s() {
|
|
550
|
+
n.value = !1;
|
|
551
|
+
}
|
|
552
|
+
return f({
|
|
553
|
+
showSheet: w,
|
|
554
|
+
hideSheet: s,
|
|
555
|
+
data: c
|
|
556
|
+
}), (o, l) => {
|
|
557
|
+
const y = _("FmButton"), h = _("FmTable"), e = _("FmSideSheet");
|
|
558
|
+
return S(), B(H, null, [
|
|
559
|
+
i(e, {
|
|
560
|
+
"max-width": 768,
|
|
561
|
+
modelValue: r(n),
|
|
562
|
+
"onUpdate:modelValue": l[2] || (l[2] = (t) => z(n) ? n.value = t : null),
|
|
563
|
+
header: "Manage Criteria"
|
|
564
|
+
}, {
|
|
565
|
+
default: $(() => [
|
|
566
|
+
a("div", tt, [
|
|
567
|
+
a("div", rt, [
|
|
568
|
+
l[3] || (l[3] = a("div", null, [
|
|
569
|
+
a("div", { class: "fm-typo-en-title-sm-600" }, "Program Criteria"),
|
|
570
|
+
a("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Set participation rules to start your referral program ")
|
|
571
|
+
], -1)),
|
|
572
|
+
i(y, {
|
|
573
|
+
label: "Add Criteria",
|
|
574
|
+
icon: "add",
|
|
575
|
+
variant: "secondary",
|
|
576
|
+
onClick: l[0] || (l[0] = (t) => {
|
|
577
|
+
var d;
|
|
578
|
+
return (d = r(R)) == null ? void 0 : d.showSheet(!0);
|
|
579
|
+
})
|
|
580
|
+
})
|
|
581
|
+
]),
|
|
582
|
+
i(h, {
|
|
583
|
+
"row-data": r(V),
|
|
584
|
+
"hide-footer": !0,
|
|
585
|
+
"page-size": 100,
|
|
586
|
+
"column-defs": T,
|
|
587
|
+
onRowClick: l[1] || (l[1] = (t) => {
|
|
588
|
+
var d;
|
|
589
|
+
return (d = r(R)) == null ? void 0 : d.showSheet(!0, t.index);
|
|
590
|
+
})
|
|
591
|
+
}, null, 8, ["row-data"])
|
|
592
|
+
])
|
|
593
|
+
]),
|
|
594
|
+
_: 1
|
|
595
|
+
}, 8, ["modelValue"]),
|
|
596
|
+
i(et, {
|
|
597
|
+
ref_key: "editCriteriaSheetRef",
|
|
598
|
+
ref: R,
|
|
599
|
+
onUpdate: D
|
|
600
|
+
}, null, 512)
|
|
601
|
+
], 64);
|
|
602
|
+
};
|
|
603
|
+
}
|
|
604
|
+
}), at = { class: "flex flex-col space-y-16 pr-12" }, nt = { class: "fm-typo-en-title-sm-800" }, lt = { class: "flex items-center gap-8" }, st = /* @__PURE__ */ Y({
|
|
605
|
+
__name: "EditRefereeRewardSheet",
|
|
606
|
+
emits: ["update"],
|
|
607
|
+
setup(C, { expose: f, emit: k }) {
|
|
608
|
+
const { t: p } = W(), g = k, m = x(!1), n = x([]), c = Z();
|
|
609
|
+
function u() {
|
|
610
|
+
g("update", n.value);
|
|
611
|
+
}
|
|
612
|
+
async function R(o) {
|
|
613
|
+
var l, y;
|
|
614
|
+
m.value = o, n.value = ((y = (l = c.referralProgram) == null ? void 0 : l.refereeReward) == null ? void 0 : y.map((h) => h.toString())) || [], s.value = T.value.map((h) => n.value.includes(h.id));
|
|
615
|
+
}
|
|
616
|
+
function V() {
|
|
617
|
+
m.value = !1;
|
|
618
|
+
}
|
|
619
|
+
const P = [
|
|
620
|
+
{
|
|
621
|
+
header: "Reward title",
|
|
622
|
+
accessorFn: (o) => o.name,
|
|
623
|
+
enableSorting: !0
|
|
624
|
+
},
|
|
625
|
+
{
|
|
626
|
+
id: "type",
|
|
627
|
+
header: "Reward type",
|
|
628
|
+
cell(o) {
|
|
629
|
+
return ce[o.row.original.collectibleConfig.type].chip();
|
|
630
|
+
}
|
|
631
|
+
},
|
|
632
|
+
{
|
|
633
|
+
header: "Description",
|
|
634
|
+
accessorFn: (o) => o.description,
|
|
635
|
+
cell(o) {
|
|
636
|
+
const l = o.row.original;
|
|
637
|
+
if (l.collectible.type == "VOUCHER" || l.selectedReward == null)
|
|
638
|
+
return l.description;
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
], D = de(), O = x([]), T = j(() => D.rewards.map((o) => {
|
|
642
|
+
let l = "No expiry";
|
|
643
|
+
switch (o.option.type) {
|
|
644
|
+
case "VOUCHER":
|
|
645
|
+
l = `${o.option.collectibleConfig.options.maxUse} use(s), ${ee(o.option.collectibleConfig.options.validityOption || {})}`;
|
|
646
|
+
break;
|
|
647
|
+
case "LOYALTY":
|
|
648
|
+
l = `${o.option.earningOption.amount}, ${ee(o.option.validityOption || {})}`;
|
|
649
|
+
break;
|
|
650
|
+
}
|
|
651
|
+
return {
|
|
652
|
+
id: o._id,
|
|
653
|
+
name: o.name,
|
|
654
|
+
collectible: o.option,
|
|
655
|
+
collectibleConfig: o.collectibleConfig,
|
|
656
|
+
description: l
|
|
657
|
+
};
|
|
658
|
+
}));
|
|
659
|
+
j(() => []);
|
|
660
|
+
function w() {
|
|
661
|
+
const o = T.value;
|
|
662
|
+
for (let l = 0; l < o.length; l++) {
|
|
663
|
+
const y = o[l], h = s.value[l];
|
|
664
|
+
h && !n.value.includes(y.id) && n.value.push(y.id), !h && n.value.includes(y.id) && (n.value = n.value.filter((e) => e != y.id));
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
const s = x({});
|
|
668
|
+
return ne(s, w, { deep: !0 }), f({
|
|
669
|
+
showSheet: R,
|
|
670
|
+
hideSheet: V,
|
|
671
|
+
data: n
|
|
672
|
+
}), (o, l) => {
|
|
673
|
+
const y = _("FmTable"), h = _("FmButton"), e = _("FmSideSheet");
|
|
674
|
+
return S(), M(e, {
|
|
675
|
+
"max-width": 1e3,
|
|
676
|
+
modelValue: r(m),
|
|
677
|
+
"onUpdate:modelValue": l[2] || (l[2] = (t) => z(m) ? m.value = t : null),
|
|
678
|
+
header: "Referee reward"
|
|
679
|
+
}, {
|
|
680
|
+
"side-sheet-footer": $(() => [
|
|
681
|
+
a("div", lt, [
|
|
682
|
+
i(h, {
|
|
683
|
+
label: r(p)("connect.editTierSheet.submit"),
|
|
684
|
+
onClick: u,
|
|
685
|
+
disabled: r(q)().isLoading,
|
|
686
|
+
loading: r(q)().isLoading
|
|
687
|
+
}, null, 8, ["label", "disabled", "loading"]),
|
|
688
|
+
i(h, {
|
|
689
|
+
label: r(p)("connect.editTierSheet.cancel"),
|
|
690
|
+
onClick: l[1] || (l[1] = (t) => V()),
|
|
691
|
+
variant: "tertiary"
|
|
692
|
+
}, null, 8, ["label"])
|
|
693
|
+
])
|
|
694
|
+
]),
|
|
695
|
+
default: $(() => [
|
|
696
|
+
i(X, { json: r(n) }, null, 8, ["json"]),
|
|
697
|
+
a("div", at, [
|
|
698
|
+
a("div", nt, E(r(p)("connect.referral.editReferralCountSheet.referrer_reward")), 1),
|
|
699
|
+
i(y, {
|
|
700
|
+
modelValue: r(s),
|
|
701
|
+
"onUpdate:modelValue": l[0] || (l[0] = (t) => z(s) ? s.value = t : null),
|
|
702
|
+
selection: "multiple",
|
|
703
|
+
"column-filter": r(O),
|
|
704
|
+
"column-defs": P,
|
|
705
|
+
"row-data": r(T),
|
|
706
|
+
"page-size": 10
|
|
707
|
+
}, null, 8, ["modelValue", "column-filter", "row-data"])
|
|
708
|
+
])
|
|
709
|
+
]),
|
|
710
|
+
_: 1
|
|
711
|
+
}, 8, ["modelValue"]);
|
|
712
|
+
};
|
|
713
|
+
}
|
|
714
|
+
}), it = { class: "fm-typo-en-title-sm-600" }, dt = { class: "grid grid-cols-4 xs:grid-cols-2 gap-4 divide-x xs:divide-x-0" }, ct = { class: "flex gap-x-8" }, ut = { class: "fm-typo-body-lg-600" }, mt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ft = { class: "mb-40" }, pt = {
|
|
715
|
+
key: 0,
|
|
716
|
+
class: "flex flex-col items-center justify-center gap-y-16 p-24"
|
|
717
|
+
}, ht = { class: "flex flex-col gap-16 text-center" }, vt = { class: "fm-typo-en-title-sm-800" }, gt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Nt = /* @__PURE__ */ Y({
|
|
718
|
+
__name: "Overview",
|
|
719
|
+
setup(C) {
|
|
720
|
+
const { t: f } = W(), { minor: k } = ie, p = $e(), g = Z(), { confirmUpdateReferralRecord: m, updateReferralRecord: n } = fe(), c = j(() => {
|
|
721
|
+
var e;
|
|
722
|
+
return ((e = g.referralProgram) == null ? void 0 : e.reward) ?? [];
|
|
723
|
+
}), u = x(null);
|
|
724
|
+
x(null);
|
|
725
|
+
const R = x(null), V = x(null), P = x(null), D = j(() => {
|
|
726
|
+
var e, t, d, F;
|
|
727
|
+
return [
|
|
728
|
+
{
|
|
729
|
+
label: "connect.referral.how_it_works.generate_link",
|
|
730
|
+
sublabel: f("connect.referral.how_it_works.generate_link_for_member"),
|
|
731
|
+
icon: "offline_share"
|
|
732
|
+
},
|
|
733
|
+
{
|
|
734
|
+
label: "connect.referral.how_it_works.referee_join_reward",
|
|
735
|
+
sublabel: `${((t = (e = g.referralProgram) == null ? void 0 : e.refereeReward) == null ? void 0 : t.length) || 0} reward(s)`,
|
|
736
|
+
action: f("connect.referral.actions.manage_reward"),
|
|
737
|
+
onClick: () => {
|
|
738
|
+
var b;
|
|
739
|
+
return (b = P.value) == null ? void 0 : b.showSheet(!0);
|
|
740
|
+
},
|
|
741
|
+
icon: "group_add"
|
|
742
|
+
},
|
|
743
|
+
{
|
|
744
|
+
label: "connect.referral.how_it_works.referee_meet_criteria",
|
|
745
|
+
sublabel: `${(d = g.referralProgram) == null ? void 0 : d.criteria.length} criteria`,
|
|
746
|
+
action: f("connect.referral.actions.manage_criteria"),
|
|
747
|
+
onClick: () => {
|
|
748
|
+
var b;
|
|
749
|
+
return (b = V.value) == null ? void 0 : b.showSheet(!0);
|
|
750
|
+
},
|
|
751
|
+
icon: "checklist_rtl"
|
|
752
|
+
},
|
|
753
|
+
{
|
|
754
|
+
label: "connect.referral.how_it_works.referer_get_reward",
|
|
755
|
+
sublabel: `${(F = g.referralProgram) == null ? void 0 : F.reward.length} configured tier(s)`,
|
|
756
|
+
icon: "featured_seasonal_and_gifts"
|
|
757
|
+
}
|
|
758
|
+
];
|
|
759
|
+
});
|
|
760
|
+
function O(e) {
|
|
761
|
+
var t;
|
|
762
|
+
(t = u.value) == null || t.onManageRewardGroup(e);
|
|
763
|
+
}
|
|
764
|
+
function T(e) {
|
|
765
|
+
var t;
|
|
766
|
+
(t = R.value) == null || t.showSheet(!0, {
|
|
767
|
+
groupIndex: e.groupIndex,
|
|
768
|
+
countIndex: e.countIndex
|
|
769
|
+
});
|
|
770
|
+
}
|
|
771
|
+
async function w(e) {
|
|
772
|
+
var v, I, L, J;
|
|
773
|
+
const t = e.countIndex == -1 ? ((I = (v = g.referralProgram) == null ? void 0 : v.reward[e.groupIndex]) == null ? void 0 : I.rewards.length) || 0 : e.countIndex || 0, d = e.referralCount, F = N(
|
|
774
|
+
g.referralProgram
|
|
775
|
+
), b = F.reward[e.groupIndex];
|
|
776
|
+
b.rewards[t] = e.referralCount;
|
|
777
|
+
const U = b.rewards[t - 1], A = b.rewards[t + 1];
|
|
778
|
+
if (U && U.threshold.to != d.threshold.from - 1) {
|
|
779
|
+
if (!await K.confirm(
|
|
780
|
+
f("connect.program.tier.update.range_discontinuous.previous", {
|
|
781
|
+
name: U.threshold.from,
|
|
782
|
+
from: U.threshold.from ?? 0,
|
|
783
|
+
to: U.threshold.to ?? 1 / 0,
|
|
784
|
+
newTo: d.threshold.from - 1
|
|
785
|
+
}),
|
|
786
|
+
f("connect.program.tier.title"),
|
|
787
|
+
f("connect.program.tier.remove.next_range")
|
|
788
|
+
))
|
|
789
|
+
return;
|
|
790
|
+
U.threshold.to = d.threshold.from - 1;
|
|
791
|
+
}
|
|
792
|
+
if (A && A.threshold.from - 1 != d.threshold.to) {
|
|
793
|
+
if (!await K.confirm(
|
|
794
|
+
f("connect.program.tier.update.range_discontinuous.next", {
|
|
795
|
+
name: A.threshold.from,
|
|
796
|
+
from: A.threshold.from ?? 0,
|
|
797
|
+
to: A.threshold.to ?? 1 / 0,
|
|
798
|
+
newFrom: d.threshold.to ?? 1
|
|
799
|
+
}),
|
|
800
|
+
f("connect.program.tier.title"),
|
|
801
|
+
f("connect.program.tier.remove.next_range"),
|
|
802
|
+
f("connect.prompt.cancel")
|
|
803
|
+
))
|
|
804
|
+
return;
|
|
805
|
+
A.threshold.from = (d.threshold.to ?? 0) + 1;
|
|
806
|
+
}
|
|
807
|
+
!A && !((L = d.threshold) != null && L.to) && (d.threshold.to = void 0), await o(F), (J = R.value) == null || J.hideSheet();
|
|
808
|
+
}
|
|
809
|
+
async function s(e) {
|
|
810
|
+
var d;
|
|
811
|
+
const t = N(g.referralProgram);
|
|
812
|
+
t.refereeReward = e, await o(t), (d = P.value) == null || d.hideSheet();
|
|
813
|
+
}
|
|
814
|
+
async function o(e) {
|
|
815
|
+
await m(), await k(
|
|
816
|
+
async () => {
|
|
817
|
+
await me.update({
|
|
818
|
+
...e,
|
|
819
|
+
updateReferralRecord: n.value
|
|
820
|
+
}), await g.readReferralProgram();
|
|
821
|
+
},
|
|
822
|
+
{
|
|
823
|
+
message: "Updating referral program",
|
|
824
|
+
successMessage: "Referral program updated successfully"
|
|
825
|
+
}
|
|
826
|
+
);
|
|
827
|
+
}
|
|
828
|
+
async function l(e) {
|
|
829
|
+
if (!await K.remove(
|
|
830
|
+
"Are you sure to remove referral tier",
|
|
831
|
+
"Remove referral tier",
|
|
832
|
+
f("connect.prompt.confirm"),
|
|
833
|
+
f("connect.prompt.cancel")
|
|
834
|
+
))
|
|
835
|
+
return;
|
|
836
|
+
const t = N(g.referralProgram);
|
|
837
|
+
t.reward.splice(e, 1), await o(t);
|
|
838
|
+
}
|
|
839
|
+
async function y(e, t) {
|
|
840
|
+
if (!await K.remove(
|
|
841
|
+
"Are you sure to remove referral count",
|
|
842
|
+
"Remove referral tier",
|
|
843
|
+
f("connect.prompt.confirm"),
|
|
844
|
+
f("connect.prompt.cancel")
|
|
845
|
+
))
|
|
846
|
+
return;
|
|
847
|
+
const d = N(g.referralProgram);
|
|
848
|
+
d.reward[e].rewards.splice(t, 1), await o(d);
|
|
849
|
+
}
|
|
850
|
+
const h = [
|
|
851
|
+
{
|
|
852
|
+
header: "Referral Count",
|
|
853
|
+
accessorFn: (e) => e.threshold.from == e.threshold.to ? `${e.threshold.from}` : e.threshold.to ? `${e.threshold.from} - ${e.threshold.to ?? "∞"}` : `${e.threshold.from}+`
|
|
854
|
+
},
|
|
855
|
+
{
|
|
856
|
+
header: "Rewards",
|
|
857
|
+
accessorKey: "type",
|
|
858
|
+
accessorFn: (e) => `${e.rewards.length} reward(s)`
|
|
859
|
+
},
|
|
860
|
+
{
|
|
861
|
+
id: "actions",
|
|
862
|
+
meta: {
|
|
863
|
+
textAlign: "right"
|
|
864
|
+
},
|
|
865
|
+
cell(e) {
|
|
866
|
+
return se(ue.FmButton, {
|
|
867
|
+
variant: "tertiary",
|
|
868
|
+
icon: "delete",
|
|
869
|
+
iconColor: "neutral-gray-400",
|
|
870
|
+
class: "ml-auto",
|
|
871
|
+
onClick: (t) => {
|
|
872
|
+
t.stopPropagation(), console.log(e.row), y(e.row.original.groupIndex, e.row.index);
|
|
873
|
+
}
|
|
874
|
+
});
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
];
|
|
878
|
+
return ve(async () => {
|
|
879
|
+
await g.readReferralProgram();
|
|
880
|
+
}), (e, t) => {
|
|
881
|
+
const d = _("FmCard"), F = _("FmIcon"), b = _("FmButton"), U = _("FmTable"), A = _("FmList");
|
|
882
|
+
return S(), B(H, null, [
|
|
883
|
+
Q("", !0),
|
|
884
|
+
i(d, {
|
|
885
|
+
variant: "outlined",
|
|
886
|
+
class: "flex flex-col gap-16 p-16"
|
|
887
|
+
}, {
|
|
888
|
+
default: $(() => [
|
|
889
|
+
a("div", it, E(r(f)("connect.referral.how_it_works.title")), 1),
|
|
890
|
+
a("div", dt, [
|
|
891
|
+
(S(!0), B(H, null, te(r(D), (v, I) => (S(), B("div", {
|
|
892
|
+
key: I,
|
|
893
|
+
class: le(["px-8", { "xs:!border-r": I % 2 == 0 }])
|
|
894
|
+
}, [
|
|
895
|
+
a("div", ct, [
|
|
896
|
+
i(F, {
|
|
897
|
+
name: v.icon,
|
|
898
|
+
color: "primary",
|
|
899
|
+
class: "bg-fm-color-system-warning-100 p-8 fm-corner-radius-md max-h-40 max-w-40"
|
|
900
|
+
}, null, 8, ["name"]),
|
|
901
|
+
a("div", null, [
|
|
902
|
+
a("div", ut, E(r(f)(v.label)), 1),
|
|
903
|
+
a("div", mt, E(v.sublabel), 1),
|
|
904
|
+
i(b, {
|
|
905
|
+
variant: "plain",
|
|
906
|
+
label: v.action,
|
|
907
|
+
disabled: !r(p).isPremium,
|
|
908
|
+
class: "fm-typo-en-body-md-400 !p-0",
|
|
909
|
+
onClick: v.onClick
|
|
910
|
+
}, null, 8, ["label", "disabled", "onClick"])
|
|
911
|
+
])
|
|
912
|
+
])
|
|
913
|
+
], 2))), 128))
|
|
914
|
+
])
|
|
915
|
+
]),
|
|
916
|
+
_: 1
|
|
917
|
+
}),
|
|
918
|
+
r(c) && r(c).length > 0 ? (S(), M(d, {
|
|
919
|
+
key: 1,
|
|
920
|
+
variant: "outlined",
|
|
921
|
+
class: "flex flex-col gap-16 p-16"
|
|
922
|
+
}, {
|
|
923
|
+
default: $(() => [
|
|
924
|
+
i(A, { separator: !0 }, {
|
|
925
|
+
default: $(() => [
|
|
926
|
+
(S(!0), B(H, null, te(r(c), (v, I) => (S(), M(je, {
|
|
927
|
+
key: I,
|
|
928
|
+
"reward-group": v,
|
|
929
|
+
level: I,
|
|
930
|
+
onEdit: (L) => O(I),
|
|
931
|
+
onRemove: (L) => l(I),
|
|
932
|
+
onAddCount: t[0] || (t[0] = (L) => {
|
|
933
|
+
T({ groupIndex: L, countIndex: -1 });
|
|
934
|
+
})
|
|
935
|
+
}, {
|
|
936
|
+
default: $(() => [
|
|
937
|
+
a("div", ft, [
|
|
938
|
+
i(U, {
|
|
939
|
+
"row-data": v.rewards.map((L) => ({ ...L, groupIndex: I })),
|
|
940
|
+
"column-defs": h,
|
|
941
|
+
"hide-footer": !0,
|
|
942
|
+
"page-size": 50,
|
|
943
|
+
onRowClick: (L) => T({ groupIndex: I, countIndex: L.index })
|
|
944
|
+
}, null, 8, ["row-data", "onRowClick"])
|
|
945
|
+
]),
|
|
946
|
+
v.rewards.length ? Q("", !0) : (S(), B("div", pt, [
|
|
947
|
+
t[3] || (t[3] = a("div", { class: "flex flex-col gap-16 text-center" }, [
|
|
948
|
+
a("div", { class: "fm-typo-en-title-sm-800" }, "Create progressive reward"),
|
|
949
|
+
a("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Add referral count to configure progression reward to the referral program ")
|
|
950
|
+
], -1)),
|
|
951
|
+
i(b, {
|
|
952
|
+
variant: "secondary",
|
|
953
|
+
label: "Add count",
|
|
954
|
+
icon: "add",
|
|
955
|
+
onClick: (L) => T({ groupIndex: I, countIndex: -1 })
|
|
956
|
+
}, null, 8, ["onClick"])
|
|
957
|
+
]))
|
|
958
|
+
]),
|
|
959
|
+
_: 2
|
|
960
|
+
}, 1032, ["reward-group", "level", "onEdit", "onRemove"]))), 128))
|
|
961
|
+
]),
|
|
962
|
+
_: 1
|
|
963
|
+
})
|
|
964
|
+
]),
|
|
965
|
+
_: 1
|
|
966
|
+
})) : (S(), M(d, {
|
|
967
|
+
key: 2,
|
|
968
|
+
variant: "outlined",
|
|
969
|
+
class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
|
|
970
|
+
}, {
|
|
971
|
+
default: $(() => [
|
|
972
|
+
t[4] || (t[4] = a("img", {
|
|
973
|
+
src: ge,
|
|
974
|
+
class: "aspect-square w-[150px]"
|
|
975
|
+
}, null, -1)),
|
|
976
|
+
a("div", ht, [
|
|
977
|
+
a("div", vt, E(r(f)("connect.referral.referral_tier_title")), 1),
|
|
978
|
+
a("div", gt, E(r(f)("connect.referral.referral_tier_description")), 1)
|
|
979
|
+
]),
|
|
980
|
+
i(b, {
|
|
981
|
+
variant: "primary",
|
|
982
|
+
label: r(f)("connect.referral.add_referral_tier"),
|
|
983
|
+
icon: "add",
|
|
984
|
+
disabled: !r(p).isPremium,
|
|
985
|
+
onClick: t[1] || (t[1] = (v) => O(-1))
|
|
986
|
+
}, null, 8, ["label", "disabled"])
|
|
987
|
+
]),
|
|
988
|
+
_: 1
|
|
989
|
+
})),
|
|
990
|
+
i(we, {
|
|
991
|
+
ref_key: "rewardGroupRef",
|
|
992
|
+
ref: u
|
|
993
|
+
}, null, 512),
|
|
994
|
+
i(He, {
|
|
995
|
+
ref_key: "editReferralCountSheetRef",
|
|
996
|
+
ref: R,
|
|
997
|
+
onUpdate: w
|
|
998
|
+
}, null, 512),
|
|
999
|
+
i(ot, {
|
|
1000
|
+
ref_key: "manageCriteriaSheetRef",
|
|
1001
|
+
ref: V
|
|
1002
|
+
}, null, 512),
|
|
1003
|
+
i(st, {
|
|
1004
|
+
ref_key: "editRefereeRewardSheetRef",
|
|
1005
|
+
ref: P,
|
|
1006
|
+
onUpdate: s
|
|
1007
|
+
}, null, 512)
|
|
1008
|
+
], 64);
|
|
1009
|
+
};
|
|
1010
|
+
}
|
|
1011
|
+
});
|
|
1012
|
+
export {
|
|
1013
|
+
Nt as default
|
|
1014
|
+
};
|