@feedmepos/mf-connect 0.1.0-beta.5 → 0.1.0-beta.50
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-D-yp03jJ.js +427 -0
- package/dist/{App-C8Qfnkhz.js → App-CeQWTGNK.js} +441 -420
- package/dist/AuditLogs-2qzwcMXR.js +1885 -0
- package/dist/Bin-D1b2NbbA.js +191 -0
- package/dist/{Broadcast-BK-1MQkL.js → Broadcast-bKF9mIns.js} +13 -12
- package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BLzpFQoc.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-B_q5K-cx.js} +6 -8
- package/dist/Card-BCAyfBLi.js +896 -0
- package/dist/{Collections-TA4iW1r0.js → Collections-Yz3F55bv.js} +27 -31
- package/dist/{Credit-Df9iFQjZ.js → Credit-Ceptt_g_.js} +17 -16
- package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-DLnvDVgf.js +108 -0
- package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-CLFeMi0j.js +169 -0
- package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-TjNinQ8e.js +2181 -0
- package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-BCRVyPwl.js → EffectSheet.vue_vue_type_style_index_0_lang-D3Bt-Vuu.js} +6 -6
- package/dist/{Experience-ByLFXKn6.js → Experience-DskHKzfo.js} +26 -25
- package/dist/{Game-B6Ez0pfW.js → Game-IJ6X0AXM.js} +21 -20
- package/dist/Index-CEl2y9X6.js +259 -0
- package/dist/Marketing-CWekLb4c.js +20071 -0
- package/dist/{Member-TobP1ISp.js → Member-BUZPQ5Lb.js} +4 -4
- package/dist/MemberList-BmVNqvbm.js +1598 -0
- package/dist/MemberTransactions-B3XhEOK_.js +45 -0
- package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-CZ-w6iZi.js → MessageInput.vue_vue_type_script_setup_true_lang-C6YIbQtM.js} +6 -6
- package/dist/{Mission-D9uTVo0G.js → Mission-Ci9ed_ph.js} +97 -84
- package/dist/Overview-CU9uhC-k.js +1078 -0
- package/dist/{Point-4rDr-53e.js → Point-wuuR7AEb.js} +26 -25
- package/dist/{Promotion-BKO_dtQk.js → Promotion-BMi3kyE8.js} +55 -48
- package/dist/Record-Wmh-g8WY.js +340 -0
- package/dist/Reward-BL4lxhIB.js +442 -0
- package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-CqXuTxun.js +150 -0
- package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-Dbik0PEw.js +1637 -0
- package/dist/Segment-DObdjyYi.js +568 -0
- package/dist/SelectItems.vue_vue_type_script_setup_true_lang-BAuM6qP5.js +181 -0
- package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-BfyRVxWM.js +147 -0
- package/dist/{Setting-B7oISD0D.js → Setting-Dqgnd7TR.js} +610 -586
- package/dist/Store--Z4So__g.js +1744 -0
- package/dist/{StoreRewards-AMxIYhjZ.js → StoreRewards-DPFVXWwm.js} +33 -32
- package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-CNsdA106.js +939 -0
- package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-B2szciPk.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-CGOmGozY.js} +1 -1
- package/dist/{Tier-DkxdNj-K.js → Tier-36IfhsnP.js} +327 -318
- package/dist/{Title-VFpCOsMO.js → Title-XH56OOug.js} +199 -184
- package/dist/{Transaction-BgKD8n2L.js → Transaction-BUQcSmBs.js} +2 -2
- package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-BVCfeG5T.js +130 -0
- package/dist/Voucher-CvmH0kcF.js +353 -0
- package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-BQOD6uEf.js +419 -0
- package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-B2FGvyza.js → ZodTextField.vue_vue_type_script_setup_true_lang-CcIcCt4N.js} +1 -1
- package/dist/{app-DUl5dav5.js → app-DeW5_DB0.js} +1754 -1496
- package/dist/{app-DA-t-2Zt.js → app-TN8KEPMu.js} +1 -1
- package/dist/app.js +1 -1
- package/dist/{business-CeCitOY4.js → business-D1mLhSME.js} +1 -1
- package/dist/campaign-0tnkhu78.js +1810 -0
- package/dist/{campaign-CcLM6e4s.js → campaign-B-12Im0w.js} +2 -2
- package/dist/campaign.enum-C8m-HHZE.js +20 -0
- package/dist/campaign.fn-CxkhbK9i.js +758 -0
- package/dist/collectible.enum-6Syq-vQ6.js +19 -0
- package/dist/{collection.fn-CAEP7YxB.js → collection.fn-BUj75Jp2.js} +2 -2
- package/dist/dto-8wODhIIC.js +214 -0
- package/dist/{effect-Dt7rXOBy.js → effect-BEZEjcJu.js} +9 -9
- package/dist/email-addresses-PwjkdYYD.js +705 -0
- package/dist/{export-CyioiboQ.js → export-BB-0vgwy.js} +5 -5
- package/dist/{helper-FA_9AhGV.js → helper-DOt8-wns.js} +1 -1
- package/dist/{index-DLN4Kzz_.js → index-B1qUjniH.js} +1 -1
- package/dist/index-BTMIZz4v.js +44 -0
- package/dist/{index-igxrd5jC.js → index-By-GlmG7.js} +1500 -1479
- package/dist/index-C7zBkoZ4.js +115 -0
- package/dist/{index-CyNdsVrw.js → index-CNlHabtk.js} +1 -1
- package/dist/{index-DbbO3wip.js → index-CXGiIgdK.js} +48 -4
- package/dist/{index-C20XBD7G.js → index-Cjn1LVjC.js} +2192 -931
- package/dist/index-CpfUrdgw.js +29000 -0
- package/dist/index-CsaQJMAR.js +66 -0
- package/dist/index-DZuEmMyY.js +54 -0
- package/dist/{index-CCdXvb92.js → index-D_zwqIhq.js} +1 -1
- package/dist/index-DabUEw_c.js +32 -0
- package/dist/{index-BiFueJiF.js → index-X-FfC49l.js} +258 -192
- package/dist/index-vh86FiIQ.js +10 -0
- package/dist/{index.esm2017-Dl_CdTcK.js → index.esm2017-DJOUiVjR.js} +33 -33
- package/dist/loading-aCWVsOPY.js +71 -0
- package/dist/{membership-DFiY8aVd.js → membership-1etsHC5G.js} +54 -46
- package/dist/money-DzWRURZ5.js +15 -0
- package/dist/number-BxIQO1i3.js +12 -0
- package/dist/objectid-DjhmYkn-.js +145 -0
- package/dist/{loading-CZ0fiViM.js → plugins-CSPFAU50.js} +2990 -3062
- package/dist/remy-vue-client-Cpppk9h-.js +1693 -0
- package/dist/reward-Bh4Li9f0.js +36 -0
- package/dist/{rule-C3e1xTqN.js → rule-CHTTTUFB.js} +180 -177
- package/dist/{rule-builder-MEVb_AiZ.js → rule-builder-OHfUJTIA.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/{template-C2OKWd_e.js → template-ZGxXqkaC.js} +5 -5
- package/dist/trigger-Ogu5FDs0.js +144 -0
- package/dist/user-DBuU81tO.js +54 -0
- package/dist/{vue-i18n-CjxDUnX6.js → vue-i18n-CKpKQ6iE.js} +216 -216
- package/dist/{xlsx-CtXdl3ls.js → xlsx-DJDZBIeg.js} +1 -1
- package/package.json +9 -7
- package/dist/Analytic-C_ZFR5jh.js +0 -622
- package/dist/Card-C7dUFJKe.js +0 -825
- package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-Bgl90veU.js +0 -2813
- package/dist/Marketing-BaqZUeVI.js +0 -316
- package/dist/MemberList-B9cutmEh.js +0 -1733
- package/dist/MemberTransactions-DRHA7AOF.js +0 -38
- package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-BHCoDSTg.js +0 -1753
- package/dist/Segment-Dj8nc3AE.js +0 -437
- package/dist/Store-CJ3wcohQ.js +0 -1511
- package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-wXUTfQQF.js +0 -890
- package/dist/Voucher-BbTLt8Pt.js +0 -490
- package/dist/dto-CRJma6eX.js +0 -2770
- package/dist/index-B1e0LtDe.js +0 -99
- package/dist/index-Be2ZYDy_.js +0 -298
- package/dist/index-CDkITvze.js +0 -762
- package/dist/index-CuvNtC_M.js +0 -61
- package/dist/index-DPP5F3bT.js +0 -206
- package/dist/index-Dbo3DDwp.js +0 -29193
- package/dist/money-D8hUEfP4.js +0 -15
- package/dist/number-DL3GAeVt.js +0 -12
- package/dist/user-Bm4KttFq.js +0 -37
|
@@ -0,0 +1,1078 @@
|
|
|
1
|
+
import { defineComponent as q, resolveComponent as w, openBlock as C, createElementBlock as B, Fragment as Y, createVNode as c, withCtx as V, createElementVNode as a, toDisplayString as O, unref as r, renderSlot as ve, ref as F, computed as G, watch as ie, createBlock as j, isRef as J, resolveDynamicComponent as ne, renderList as re, normalizeClass as de, createTextVNode as ce, createCommentVNode as z, h as te, onMounted as _e } from "vue";
|
|
2
|
+
import { _ as ge } from "./campaign-CpzFl8Vr.js";
|
|
3
|
+
import { u as Z } from "./vue-i18n-CKpKQ6iE.js";
|
|
4
|
+
import { u as ue } from "./loading-aCWVsOPY.js";
|
|
5
|
+
import { c as we, p as K } from "./plugins-CSPFAU50.js";
|
|
6
|
+
import { J as X } from "./JsonViewer-v8_C7l5N.js";
|
|
7
|
+
import { Z as N } from "./zod-Bg2FbC-D.js";
|
|
8
|
+
import { u as W } from "./app-wDQR6dpb.js";
|
|
9
|
+
import { u as Q, _ as ye } from "./RewardGroup.vue_vue_type_script_setup_true_lang-CqXuTxun.js";
|
|
10
|
+
import { u as me } from "./reward-Bh4Li9f0.js";
|
|
11
|
+
import { a as be, b as xe } from "./index-X-FfC49l.js";
|
|
12
|
+
import { i as le, j as se } from "./index-Cjn1LVjC.js";
|
|
13
|
+
import "./index-By-GlmG7.js";
|
|
14
|
+
import "./index-B1qUjniH.js";
|
|
15
|
+
import "./index-DZuEmMyY.js";
|
|
16
|
+
import { C as fe } from "./membership-1etsHC5G.js";
|
|
17
|
+
import { t as ee } from "./helper-DOt8-wns.js";
|
|
18
|
+
import { c as H } from "./object-qECH92oz.js";
|
|
19
|
+
import { useDialog as Ce, components as oe } from "@feedmepos/ui-library";
|
|
20
|
+
import { _ as Re } from "./ZodTextField.vue_vue_type_script_setup_true_lang-CcIcCt4N.js";
|
|
21
|
+
import { T as Se, _ as Fe, a as ke } from "./trigger-Ogu5FDs0.js";
|
|
22
|
+
import { O as $e } from "./objectid-DjhmYkn-.js";
|
|
23
|
+
import { r as pe } from "./index-DabUEw_c.js";
|
|
24
|
+
import { u as Pe } from "./business-D1mLhSME.js";
|
|
25
|
+
const Ve = { class: "flex items-center justify-between flex-1 xs:hidden" }, Ie = { class: "flex items-center gap-x-24 h-[80px] p-8 flex-1" }, Te = { class: "flex-1" }, Ue = { class: "flex items-center gap-8" }, Ae = { class: "fm-typo-en-title-sm-800" }, Le = { class: "flex gap-8 items-center" }, Ee = { class: "space-y-4 hidden xs:block border-b border-fm-color-neutral-gray-100 px-16 flex-1 pb-24" }, Be = { class: "flex items-center justify-between" }, Oe = { class: "flex items-center gap-x-24 h-[80px] p-8 flex-1" }, je = { class: "flex-1 space-y-4" }, De = { class: "fm-typo-en-body-lg-600" }, Ge = /* @__PURE__ */ q({
|
|
26
|
+
__name: "ReferralRewadGroupCard",
|
|
27
|
+
props: {
|
|
28
|
+
rewardGroup: {
|
|
29
|
+
type: Object,
|
|
30
|
+
required: !0
|
|
31
|
+
},
|
|
32
|
+
level: {
|
|
33
|
+
type: Number,
|
|
34
|
+
required: !0
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
emits: ["edit", "addCount", "remove"],
|
|
38
|
+
setup(k, { emit: l }) {
|
|
39
|
+
const { t: I } = Z(), p = l;
|
|
40
|
+
return (g, f) => {
|
|
41
|
+
const s = w("FmButton"), u = w("FmListItem");
|
|
42
|
+
return C(), B(Y, null, [
|
|
43
|
+
c(u, {
|
|
44
|
+
onClick: f[4] || (f[4] = (m) => p("edit", k.level)),
|
|
45
|
+
class: "!p-0"
|
|
46
|
+
}, {
|
|
47
|
+
default: V(() => [
|
|
48
|
+
a("div", Ve, [
|
|
49
|
+
a("div", Ie, [
|
|
50
|
+
a("div", Te, [
|
|
51
|
+
a("div", Ue, [
|
|
52
|
+
a("div", Ae, O(k.rewardGroup.name), 1)
|
|
53
|
+
])
|
|
54
|
+
])
|
|
55
|
+
]),
|
|
56
|
+
a("div", Le, [
|
|
57
|
+
c(s, {
|
|
58
|
+
variant: "secondary",
|
|
59
|
+
label: r(I)("connect.referral.reward.add_count"),
|
|
60
|
+
icon: "add",
|
|
61
|
+
onClick: f[0] || (f[0] = (m) => {
|
|
62
|
+
m.stopPropagation(), p("addCount", k.level);
|
|
63
|
+
})
|
|
64
|
+
}, null, 8, ["label"]),
|
|
65
|
+
c(s, {
|
|
66
|
+
icon: "delete",
|
|
67
|
+
onClick: f[1] || (f[1] = (m) => {
|
|
68
|
+
m.stopPropagation(), p("remove", k.level);
|
|
69
|
+
}),
|
|
70
|
+
variant: "tertiary"
|
|
71
|
+
})
|
|
72
|
+
])
|
|
73
|
+
]),
|
|
74
|
+
a("div", Ee, [
|
|
75
|
+
a("div", Be, [
|
|
76
|
+
a("div", Oe, [
|
|
77
|
+
a("div", je, [
|
|
78
|
+
a("div", null, [
|
|
79
|
+
a("div", De, O(k.rewardGroup.name), 1)
|
|
80
|
+
])
|
|
81
|
+
])
|
|
82
|
+
]),
|
|
83
|
+
c(s, {
|
|
84
|
+
variant: "tertiary",
|
|
85
|
+
icon: "delete",
|
|
86
|
+
onClick: f[2] || (f[2] = (m) => (m.stopPropagation(), p("remove", k.level)))
|
|
87
|
+
})
|
|
88
|
+
]),
|
|
89
|
+
c(s, {
|
|
90
|
+
class: "w-full",
|
|
91
|
+
variant: "secondary",
|
|
92
|
+
label: "Add count",
|
|
93
|
+
disabled: !0,
|
|
94
|
+
icon: "add",
|
|
95
|
+
onClick: f[3] || (f[3] = (m) => (m.stopPropagation(), p("addCount", k.level)))
|
|
96
|
+
})
|
|
97
|
+
])
|
|
98
|
+
]),
|
|
99
|
+
_: 1
|
|
100
|
+
}),
|
|
101
|
+
ve(g.$slots, "default")
|
|
102
|
+
], 64);
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
}), Me = { class: "flex flex-col space-y-16 pr-12" }, Ne = { class: "flex gap-16 items-center" }, He = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ze = { class: "fm-typo-en-title-sm-800" }, Ye = { class: "flex items-center gap-8" }, qe = /* @__PURE__ */ q({
|
|
106
|
+
__name: "EditReferralCountSheet",
|
|
107
|
+
emits: ["update"],
|
|
108
|
+
setup(k, { expose: l, emit: I }) {
|
|
109
|
+
const { t: p } = Z(), g = I, f = F(!1), s = F({}), u = F(-1), m = F(-1), R = Q(), A = be.superRefine((e, t) => {
|
|
110
|
+
var $, U, P, x, v, E, ae;
|
|
111
|
+
const d = m.value == -1 ? ((P = (U = ($ = R.referralProgram) == null ? void 0 : $.reward[u.value]) == null ? void 0 : U.rewards) == null ? void 0 : P.length) || 0 : m.value, _ = (v = (x = R.referralProgram) == null ? void 0 : x.reward[u.value]) == null ? void 0 : v.rewards[d - 1], b = (ae = (E = R.referralProgram) == null ? void 0 : E.reward[u.value]) == null ? void 0 : ae.rewards[d + 1];
|
|
112
|
+
_ && e.threshold.from < _.threshold.from + 1 && t.addIssue({
|
|
113
|
+
code: "custom",
|
|
114
|
+
message: `The min referral must be at least ${_.threshold.from + 1}`,
|
|
115
|
+
path: ["option"]
|
|
116
|
+
}), b && e.threshold.to && b.threshold.to && e.threshold.to > b.threshold.to - 1 && t.addIssue({
|
|
117
|
+
code: "custom",
|
|
118
|
+
message: `The max referral must be at most ${b.threshold.to - 2}`,
|
|
119
|
+
path: ["option"]
|
|
120
|
+
});
|
|
121
|
+
}), T = G(() => {
|
|
122
|
+
const e = A.safeParse(s.value);
|
|
123
|
+
return e.success ? [] : e.error.errors;
|
|
124
|
+
});
|
|
125
|
+
function M() {
|
|
126
|
+
const e = A.safeParse(s.value);
|
|
127
|
+
e.success && g("update", {
|
|
128
|
+
groupIndex: u.value,
|
|
129
|
+
countIndex: m.value,
|
|
130
|
+
referralCount: e.data
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
async function D(e, t) {
|
|
134
|
+
var d, _, b, $, U, P;
|
|
135
|
+
if (f.value = e, e && typeof (t == null ? void 0 : t.countIndex) == "number" && t.countIndex >= 0)
|
|
136
|
+
u.value = t.groupIndex, m.value = t.countIndex, s.value = H(
|
|
137
|
+
(d = R.referralProgram) == null ? void 0 : d.reward[t.groupIndex].rewards[t.countIndex]
|
|
138
|
+
);
|
|
139
|
+
else {
|
|
140
|
+
u.value = t.groupIndex, m.value = -1;
|
|
141
|
+
const x = m.value == -1 ? (($ = (b = (_ = R.referralProgram) == null ? void 0 : _.reward[u.value]) == null ? void 0 : b.rewards) == null ? void 0 : $.length) || 0 : m.value, v = (P = (U = R.referralProgram) == null ? void 0 : U.reward[u.value]) == null ? void 0 : P.rewards[x - 1];
|
|
142
|
+
s.value = {
|
|
143
|
+
threshold: {
|
|
144
|
+
from: v != null && v.threshold ? v != null && v.threshold.to ? v.threshold.to + 1 : (v == null ? void 0 : v.threshold.from) + 1 : 1,
|
|
145
|
+
to: null
|
|
146
|
+
},
|
|
147
|
+
rewards: []
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
h.value = [], h.value = i.value.map(
|
|
151
|
+
(x) => s.value.rewards.includes(x.id)
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
function L() {
|
|
155
|
+
f.value = !1;
|
|
156
|
+
}
|
|
157
|
+
const y = [
|
|
158
|
+
{
|
|
159
|
+
header: "Reward title",
|
|
160
|
+
accessorFn: (e) => e.name,
|
|
161
|
+
enableSorting: !0
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
id: "type",
|
|
165
|
+
header: "Reward type",
|
|
166
|
+
cell(e) {
|
|
167
|
+
return fe[e.row.original.collectibleConfig.type].chip();
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
header: "Description",
|
|
172
|
+
accessorFn: (e) => e.description,
|
|
173
|
+
cell(e) {
|
|
174
|
+
const t = e.row.original;
|
|
175
|
+
if (t.collectible.type == "VOUCHER" || t.selectedReward == null)
|
|
176
|
+
return t.description;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
], n = me(), o = F([]), i = G(() => n.rewards.map((e) => {
|
|
180
|
+
let t = "No expiry";
|
|
181
|
+
switch (e.option.type) {
|
|
182
|
+
case "VOUCHER":
|
|
183
|
+
t = `${e.option.collectibleConfig.options.maxUse} use(s), ${ee(e.option.collectibleConfig.options.validityOption || {})}`;
|
|
184
|
+
break;
|
|
185
|
+
case "LOYALTY":
|
|
186
|
+
t = `${e.option.earningOption.amount}, ${ee(e.option.validityOption || {})}`;
|
|
187
|
+
break;
|
|
188
|
+
}
|
|
189
|
+
return {
|
|
190
|
+
id: e._id,
|
|
191
|
+
name: e.name,
|
|
192
|
+
collectible: e.option,
|
|
193
|
+
collectibleConfig: e.collectibleConfig,
|
|
194
|
+
description: t
|
|
195
|
+
};
|
|
196
|
+
}));
|
|
197
|
+
G(() => []);
|
|
198
|
+
function S() {
|
|
199
|
+
const e = i.value;
|
|
200
|
+
for (let t = 0; t < e.length; t++) {
|
|
201
|
+
const d = e[t], _ = h.value[t];
|
|
202
|
+
_ && !s.value.rewards.includes(d.id) && s.value.rewards.push(d.id), !_ && s.value.rewards.includes(d.id) && (s.value.rewards = s.value.rewards.filter(
|
|
203
|
+
(b) => b != d.id
|
|
204
|
+
));
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
const h = F({});
|
|
208
|
+
return ie(h, S, { deep: !0 }), l({
|
|
209
|
+
showSheet: D,
|
|
210
|
+
hideSheet: L,
|
|
211
|
+
data: s
|
|
212
|
+
}), (e, t) => {
|
|
213
|
+
const d = w("FmStepperField"), _ = w("FmHelperText"), b = w("FmTable"), $ = w("FmButton"), U = w("FmSideSheet");
|
|
214
|
+
return C(), j(U, {
|
|
215
|
+
"max-width": 1e3,
|
|
216
|
+
modelValue: r(f),
|
|
217
|
+
"onUpdate:modelValue": t[4] || (t[4] = (P) => J(f) ? f.value = P : null),
|
|
218
|
+
header: `${r(m) == -1 ? r(p)("connect.referral.editReferralCountSheet.add") : r(p)("connect.referral.editReferralCountSheet.edit")}`
|
|
219
|
+
}, {
|
|
220
|
+
"side-sheet-footer": V(() => [
|
|
221
|
+
a("div", Ye, [
|
|
222
|
+
c($, {
|
|
223
|
+
label: r(p)("connect.editTierSheet.submit"),
|
|
224
|
+
onClick: M,
|
|
225
|
+
disabled: r(T).length > 0 || r(W)().isLoading,
|
|
226
|
+
loading: r(W)().isLoading
|
|
227
|
+
}, null, 8, ["label", "disabled", "loading"]),
|
|
228
|
+
c($, {
|
|
229
|
+
label: r(p)("connect.editTierSheet.cancel"),
|
|
230
|
+
onClick: t[3] || (t[3] = (P) => L()),
|
|
231
|
+
variant: "tertiary"
|
|
232
|
+
}, null, 8, ["label"])
|
|
233
|
+
])
|
|
234
|
+
]),
|
|
235
|
+
default: V(() => [
|
|
236
|
+
c(X, { json: r(s) }, null, 8, ["json"]),
|
|
237
|
+
c(X, { json: r(T) }, null, 8, ["json"]),
|
|
238
|
+
a("div", Me, [
|
|
239
|
+
a("div", null, [
|
|
240
|
+
a("div", Ne, [
|
|
241
|
+
c(d, {
|
|
242
|
+
modelValue: r(s).threshold.from,
|
|
243
|
+
"onUpdate:modelValue": t[0] || (t[0] = (P) => r(s).threshold.from = P),
|
|
244
|
+
"show-steppers": !1,
|
|
245
|
+
rules: [r(N).ruleAtPath(r(A), "threshold.from")]
|
|
246
|
+
}, {
|
|
247
|
+
label: V(() => [
|
|
248
|
+
(C(), j(ne(
|
|
249
|
+
r(N).toInputLabel(
|
|
250
|
+
r(N).typeAtPath(r(A), "threshold.from"),
|
|
251
|
+
r(p)(
|
|
252
|
+
"connect.referral.editReferralCountSheet.min_referral_count"
|
|
253
|
+
)
|
|
254
|
+
)
|
|
255
|
+
)))
|
|
256
|
+
]),
|
|
257
|
+
_: 1
|
|
258
|
+
}, 8, ["modelValue", "rules"]),
|
|
259
|
+
c(d, {
|
|
260
|
+
modelValue: r(s).threshold.to,
|
|
261
|
+
"onUpdate:modelValue": t[1] || (t[1] = (P) => r(s).threshold.to = P),
|
|
262
|
+
"show-steppers": !1,
|
|
263
|
+
rules: [r(N).ruleAtPath(r(A), "threshold.to")]
|
|
264
|
+
}, {
|
|
265
|
+
label: V(() => [
|
|
266
|
+
(C(), j(ne(
|
|
267
|
+
r(N).toInputLabel(
|
|
268
|
+
r(N).typeAtPath(r(A), "threshold.to"),
|
|
269
|
+
r(p)(
|
|
270
|
+
"connect.referral.editReferralCountSheet.max_referral_count"
|
|
271
|
+
)
|
|
272
|
+
)
|
|
273
|
+
)))
|
|
274
|
+
]),
|
|
275
|
+
_: 1
|
|
276
|
+
}, 8, ["modelValue", "rules"])
|
|
277
|
+
]),
|
|
278
|
+
c(_, {
|
|
279
|
+
text: r(N).helperText(r(T), "threshold"),
|
|
280
|
+
state: r(N).helperState(r(T), "threshold")
|
|
281
|
+
}, null, 8, ["text", "state"]),
|
|
282
|
+
a("div", He, O(r(p)(
|
|
283
|
+
"connect.referral.editReferralCountSheet.max_referral_count_description"
|
|
284
|
+
)), 1)
|
|
285
|
+
]),
|
|
286
|
+
a("div", ze, O(r(p)("connect.referral.editReferralCountSheet.referrer_reward")), 1),
|
|
287
|
+
c(b, {
|
|
288
|
+
modelValue: r(h),
|
|
289
|
+
"onUpdate:modelValue": t[2] || (t[2] = (P) => J(h) ? h.value = P : null),
|
|
290
|
+
selection: "multiple",
|
|
291
|
+
"column-filter": r(o),
|
|
292
|
+
"column-defs": y,
|
|
293
|
+
"row-data": r(i),
|
|
294
|
+
"page-size": 10
|
|
295
|
+
}, null, 8, ["modelValue", "column-filter", "row-data"])
|
|
296
|
+
])
|
|
297
|
+
]),
|
|
298
|
+
_: 1
|
|
299
|
+
}, 8, ["modelValue", "header"]);
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
}), Ke = { class: "space-y-16" }, Je = { class: "grid grid-cols-3 gap-16" }, We = { class: "fm-typo-en-title-sm-800" }, Ze = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Qe = /* @__PURE__ */ q({
|
|
303
|
+
__name: "CriteriaTriggerInput",
|
|
304
|
+
props: {
|
|
305
|
+
modelValue: {
|
|
306
|
+
type: String
|
|
307
|
+
},
|
|
308
|
+
disabled: {
|
|
309
|
+
type: Boolean,
|
|
310
|
+
default: !1
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
emits: ["update:model-value"],
|
|
314
|
+
setup(k, { emit: l }) {
|
|
315
|
+
const I = k, p = l, g = G(() => [
|
|
316
|
+
le.enum.BILL_COMPLETED,
|
|
317
|
+
le.enum.FEEDBACK
|
|
318
|
+
].map((f) => Se[f]));
|
|
319
|
+
return (f, s) => {
|
|
320
|
+
const u = w("FmCard");
|
|
321
|
+
return C(), B("div", Ke, [
|
|
322
|
+
s[0] || (s[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)),
|
|
323
|
+
a("div", Je, [
|
|
324
|
+
(C(!0), B(Y, null, re(r(g), (m) => (C(), j(u, {
|
|
325
|
+
key: m.name,
|
|
326
|
+
variant: "outlined",
|
|
327
|
+
disabled: I.disabled,
|
|
328
|
+
class: de(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
|
|
329
|
+
"col-span-3": r(g).length == 1,
|
|
330
|
+
"border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": k.modelValue == m.value,
|
|
331
|
+
"hover:bg-fm-color-opacity-sm": k.modelValue != m.value
|
|
332
|
+
}]),
|
|
333
|
+
onClick: () => {
|
|
334
|
+
I.modelValue != m.value && !I.disabled && p("update:model-value", m.value);
|
|
335
|
+
}
|
|
336
|
+
}, {
|
|
337
|
+
default: V(() => [
|
|
338
|
+
a("div", We, O(m.name), 1),
|
|
339
|
+
a("div", Ze, O(m.description), 1)
|
|
340
|
+
]),
|
|
341
|
+
_: 2
|
|
342
|
+
}, 1032, ["disabled", "class", "onClick"]))), 128))
|
|
343
|
+
])
|
|
344
|
+
]);
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
}), Xe = { class: "flex items-center gap-x-8" }, er = { class: "flex flex-col space-y-16 pr-12" }, rr = {
|
|
348
|
+
key: 0,
|
|
349
|
+
class: "space-y-16"
|
|
350
|
+
}, tr = {
|
|
351
|
+
key: 1,
|
|
352
|
+
class: "space-y-16"
|
|
353
|
+
}, or = { class: "flex items-center gap-8" }, ar = /* @__PURE__ */ q({
|
|
354
|
+
__name: "EditCriteriaSheet",
|
|
355
|
+
emits: ["update"],
|
|
356
|
+
setup(k, { expose: l, emit: I }) {
|
|
357
|
+
const { t: p } = Z(), g = I, f = F(!1), s = F(-1), u = F({}), m = Q(), R = xe.superRefine((y, n) => {
|
|
358
|
+
y.name.length >= 50 && n.addIssue({
|
|
359
|
+
code: "custom",
|
|
360
|
+
message: "Name must be less than 50 characters"
|
|
361
|
+
}), y.name.length < 1 && n.addIssue({
|
|
362
|
+
code: "custom",
|
|
363
|
+
message: "Name is required"
|
|
364
|
+
});
|
|
365
|
+
}), A = G(() => {
|
|
366
|
+
const y = R.safeParse(u.value);
|
|
367
|
+
return y.success ? [] : y.error.errors;
|
|
368
|
+
});
|
|
369
|
+
function T(y, n) {
|
|
370
|
+
var o;
|
|
371
|
+
f.value = y, y && typeof n == "number" && n >= 0 ? (s.value = n, u.value = H(
|
|
372
|
+
(o = m.referralProgram) == null ? void 0 : o.criteria[n]
|
|
373
|
+
)) : (s.value = -1, u.value = {
|
|
374
|
+
_id: new $e().toString(),
|
|
375
|
+
name: "",
|
|
376
|
+
type: "AUTO",
|
|
377
|
+
event: { type: "BILL_COMPLETED" }
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
function M() {
|
|
381
|
+
f.value = !1;
|
|
382
|
+
}
|
|
383
|
+
function D() {
|
|
384
|
+
const y = R.safeParse(u.value);
|
|
385
|
+
y.success && g("update", s.value, y.data);
|
|
386
|
+
}
|
|
387
|
+
function L(y) {
|
|
388
|
+
u.value.type = y, y == "AUTO" ? u.value.event = { type: "BILL_COMPLETED" } : u.value.event = void 0;
|
|
389
|
+
}
|
|
390
|
+
return l({
|
|
391
|
+
showSheet: T,
|
|
392
|
+
hideSheet: M,
|
|
393
|
+
data: u
|
|
394
|
+
}), (y, n) => {
|
|
395
|
+
const o = w("FmButton"), i = w("FmRadio"), S = w("FmRadioGroup"), h = w("FmSideSheet");
|
|
396
|
+
return C(), j(h, {
|
|
397
|
+
"max-width": 768,
|
|
398
|
+
modelValue: r(f),
|
|
399
|
+
"onUpdate:modelValue": n[6] || (n[6] = (e) => J(f) ? f.value = e : null)
|
|
400
|
+
}, {
|
|
401
|
+
"side-sheet-header": V(() => [
|
|
402
|
+
a("div", Xe, [
|
|
403
|
+
c(o, {
|
|
404
|
+
icon: "arrow_back",
|
|
405
|
+
variant: "tertiary",
|
|
406
|
+
onClick: n[0] || (n[0] = (e) => T(!1))
|
|
407
|
+
}),
|
|
408
|
+
n[7] || (n[7] = ce("Add Criteria "))
|
|
409
|
+
])
|
|
410
|
+
]),
|
|
411
|
+
"side-sheet-footer": V(() => [
|
|
412
|
+
a("div", or, [
|
|
413
|
+
c(o, {
|
|
414
|
+
label: r(p)("connect.editTierSheet.submit"),
|
|
415
|
+
onClick: D,
|
|
416
|
+
disabled: r(A).length > 0 || r(W)().isLoading,
|
|
417
|
+
loading: r(W)().isLoading
|
|
418
|
+
}, null, 8, ["label", "disabled", "loading"]),
|
|
419
|
+
c(o, {
|
|
420
|
+
label: r(p)("connect.editTierSheet.cancel"),
|
|
421
|
+
onClick: n[5] || (n[5] = (e) => T(!1)),
|
|
422
|
+
variant: "tertiary"
|
|
423
|
+
}, null, 8, ["label"])
|
|
424
|
+
])
|
|
425
|
+
]),
|
|
426
|
+
default: V(() => [
|
|
427
|
+
c(X, { json: r(u) }, null, 8, ["json"]),
|
|
428
|
+
a("div", er, [
|
|
429
|
+
n[12] || (n[12] = a("div", { class: "fm-typo-en-title-sm-600" }, "Program Criteria", -1)),
|
|
430
|
+
c(Re, {
|
|
431
|
+
modelValue: r(u).name,
|
|
432
|
+
"onUpdate:modelValue": n[1] || (n[1] = (e) => r(u).name = e),
|
|
433
|
+
label: r(p)("connect.referral.editReferralTierSheet.name"),
|
|
434
|
+
schema: r(N).typeAtPath(r(R), "name")
|
|
435
|
+
}, null, 8, ["modelValue", "label", "schema"]),
|
|
436
|
+
n[13] || (n[13] = a("div", { class: "fm-typo-en-title-sm-600" }, "Configuration", -1)),
|
|
437
|
+
c(S, {
|
|
438
|
+
"model-value": r(u).type,
|
|
439
|
+
label: "Verify status",
|
|
440
|
+
"onUpdate:modelValue": L
|
|
441
|
+
}, {
|
|
442
|
+
default: V(() => [
|
|
443
|
+
c(i, {
|
|
444
|
+
value: "AUTO",
|
|
445
|
+
label: "Auto",
|
|
446
|
+
sublabel: "Verify based on rule configuration"
|
|
447
|
+
}),
|
|
448
|
+
c(i, {
|
|
449
|
+
value: "MANUAL",
|
|
450
|
+
label: "Manual",
|
|
451
|
+
sublabel: "Verify based on manual inspection"
|
|
452
|
+
})
|
|
453
|
+
]),
|
|
454
|
+
_: 1
|
|
455
|
+
}, 8, ["model-value"]),
|
|
456
|
+
r(u).type == "AUTO" ? (C(), B(Y, { key: 0 }, [
|
|
457
|
+
n[10] || (n[10] = a("div", { class: "fm-typo-en-title-sm-600" }, "Trigger", -1)),
|
|
458
|
+
n[11] || (n[11] = a("div", null, " Select trigger what referee need to complete in order for referral to earn reward ", -1)),
|
|
459
|
+
c(Qe, {
|
|
460
|
+
"model-value": r(u).event.type,
|
|
461
|
+
"onUpdate:modelValue": n[2] || (n[2] = (e) => r(u).event.type = e)
|
|
462
|
+
}, null, 8, ["model-value"]),
|
|
463
|
+
r(u).event.type == r(se).enum.BILL_COMPLETED ? (C(), B("div", rr, [
|
|
464
|
+
n[8] || (n[8] = a("div", { class: "fm-typo-en-title-sm-600" }, "Spending Criteria", -1)),
|
|
465
|
+
c(Fe, {
|
|
466
|
+
"model-value": r(u).event.rule,
|
|
467
|
+
"onUpdate:modelValue": n[3] || (n[3] = (e) => r(u).event.rule = e)
|
|
468
|
+
}, null, 8, ["model-value"])
|
|
469
|
+
])) : z("", !0),
|
|
470
|
+
r(u).event.type == r(se).enum.FEEDBACK ? (C(), B("div", tr, [
|
|
471
|
+
n[9] || (n[9] = a("div", { class: "fm-typo-en-title-sm-600" }, "Feedback Criteria", -1)),
|
|
472
|
+
c(ke, {
|
|
473
|
+
"model-value": r(u).event.rule,
|
|
474
|
+
"onUpdate:modelValue": n[4] || (n[4] = (e) => r(u).event.rule = e)
|
|
475
|
+
}, null, 8, ["model-value"])
|
|
476
|
+
])) : z("", !0)
|
|
477
|
+
], 64)) : z("", !0)
|
|
478
|
+
])
|
|
479
|
+
]),
|
|
480
|
+
_: 1
|
|
481
|
+
}, 8, ["modelValue"]);
|
|
482
|
+
};
|
|
483
|
+
}
|
|
484
|
+
});
|
|
485
|
+
function he() {
|
|
486
|
+
const k = F(!1), l = Ce();
|
|
487
|
+
return {
|
|
488
|
+
confirmUpdateReferralRecord: async () => {
|
|
489
|
+
await new Promise((p) => {
|
|
490
|
+
l.open({
|
|
491
|
+
title: "Confirmation",
|
|
492
|
+
message: "This will change all referral settings? Would you like to update previous referral record?",
|
|
493
|
+
primaryActions: { text: "Update all", close: !0 },
|
|
494
|
+
secondaryActions: { text: "Update future only", close: !0 }
|
|
495
|
+
}).onPrimary(async () => {
|
|
496
|
+
k.value = !0, p();
|
|
497
|
+
}).onSecondary(async () => {
|
|
498
|
+
k.value = !1, p();
|
|
499
|
+
});
|
|
500
|
+
});
|
|
501
|
+
},
|
|
502
|
+
updateReferralRecord: k
|
|
503
|
+
};
|
|
504
|
+
}
|
|
505
|
+
const nr = { class: "flex flex-col space-y-16 mt-24" }, lr = { class: "flex justify-between items-center" }, sr = /* @__PURE__ */ q({
|
|
506
|
+
__name: "ManageCriteriaSheet",
|
|
507
|
+
setup(k, { expose: l }) {
|
|
508
|
+
const { t: I } = Z(), { minor: p } = ue, { confirmUpdateReferralRecord: g, updateReferralRecord: f } = he(), s = F(!1), u = F({}), m = Q(), R = F(
|
|
509
|
+
null
|
|
510
|
+
), A = G(() => {
|
|
511
|
+
var o;
|
|
512
|
+
return (o = m.referralProgram) == null ? void 0 : o.criteria;
|
|
513
|
+
});
|
|
514
|
+
async function T(o) {
|
|
515
|
+
await g(), await p(async () => {
|
|
516
|
+
await pe.update({
|
|
517
|
+
...o,
|
|
518
|
+
updateReferralRecord: f.value
|
|
519
|
+
}), await m.readReferralProgram();
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
async function M(o, i) {
|
|
523
|
+
var e, t;
|
|
524
|
+
const S = o == -1 ? ((e = m.referralProgram) == null ? void 0 : e.criteria.length) || 0 : o, h = H(m.referralProgram);
|
|
525
|
+
h.criteria[S] = i, await T(h), (t = R.value) == null || t.showSheet(!1);
|
|
526
|
+
}
|
|
527
|
+
async function D(o) {
|
|
528
|
+
var h, e;
|
|
529
|
+
if (!await K.remove(
|
|
530
|
+
"Are you sure to remove criteria",
|
|
531
|
+
"Remove criteria",
|
|
532
|
+
I("connect.prompt.confirm"),
|
|
533
|
+
I("connect.prompt.cancel")
|
|
534
|
+
))
|
|
535
|
+
return;
|
|
536
|
+
const i = o == -1 ? ((h = m.referralProgram) == null ? void 0 : h.criteria.length) || 0 : o, S = H(m.referralProgram);
|
|
537
|
+
S.criteria.splice(i, 1), await T(S), (e = R.value) == null || e.showSheet(!1);
|
|
538
|
+
}
|
|
539
|
+
const L = [
|
|
540
|
+
{
|
|
541
|
+
header: "Criteria title",
|
|
542
|
+
accessorFn: (o) => o.name
|
|
543
|
+
},
|
|
544
|
+
{
|
|
545
|
+
header: "Validity method",
|
|
546
|
+
cell(o) {
|
|
547
|
+
return te(oe.FmChip, {
|
|
548
|
+
label: we.title(o.row.original.type),
|
|
549
|
+
variant: "plain"
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
},
|
|
553
|
+
{
|
|
554
|
+
header: "Actions",
|
|
555
|
+
cell(o) {
|
|
556
|
+
return [
|
|
557
|
+
te(oe.FmButton, {
|
|
558
|
+
variant: "tertiary",
|
|
559
|
+
icon: "delete",
|
|
560
|
+
iconColor: "neutral-gray-400",
|
|
561
|
+
onClick: (i) => {
|
|
562
|
+
i.stopPropagation(), D(o.row.index);
|
|
563
|
+
}
|
|
564
|
+
})
|
|
565
|
+
];
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
];
|
|
569
|
+
function y(o) {
|
|
570
|
+
s.value = o;
|
|
571
|
+
}
|
|
572
|
+
function n() {
|
|
573
|
+
s.value = !1;
|
|
574
|
+
}
|
|
575
|
+
return l({
|
|
576
|
+
showSheet: y,
|
|
577
|
+
hideSheet: n,
|
|
578
|
+
data: u
|
|
579
|
+
}), (o, i) => {
|
|
580
|
+
const S = w("FmButton"), h = w("FmTable"), e = w("FmSideSheet");
|
|
581
|
+
return C(), B(Y, null, [
|
|
582
|
+
c(e, {
|
|
583
|
+
"max-width": 768,
|
|
584
|
+
modelValue: r(s),
|
|
585
|
+
"onUpdate:modelValue": i[2] || (i[2] = (t) => J(s) ? s.value = t : null),
|
|
586
|
+
header: "Manage Criteria"
|
|
587
|
+
}, {
|
|
588
|
+
default: V(() => [
|
|
589
|
+
a("div", nr, [
|
|
590
|
+
a("div", lr, [
|
|
591
|
+
i[3] || (i[3] = a("div", null, [
|
|
592
|
+
a("div", { class: "fm-typo-en-title-sm-600" }, "Program Criteria"),
|
|
593
|
+
a("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Set participation rules to start your referral program ")
|
|
594
|
+
], -1)),
|
|
595
|
+
c(S, {
|
|
596
|
+
label: "Add Criteria",
|
|
597
|
+
icon: "add",
|
|
598
|
+
variant: "secondary",
|
|
599
|
+
onClick: i[0] || (i[0] = (t) => {
|
|
600
|
+
var d;
|
|
601
|
+
return (d = r(R)) == null ? void 0 : d.showSheet(!0);
|
|
602
|
+
})
|
|
603
|
+
})
|
|
604
|
+
]),
|
|
605
|
+
c(h, {
|
|
606
|
+
"row-data": r(A),
|
|
607
|
+
"hide-footer": !0,
|
|
608
|
+
"page-size": 100,
|
|
609
|
+
"shrink-at": !1,
|
|
610
|
+
"column-defs": L,
|
|
611
|
+
onRowClick: i[1] || (i[1] = (t) => {
|
|
612
|
+
var d;
|
|
613
|
+
return (d = r(R)) == null ? void 0 : d.showSheet(!0, t.index);
|
|
614
|
+
})
|
|
615
|
+
}, null, 8, ["row-data"])
|
|
616
|
+
])
|
|
617
|
+
]),
|
|
618
|
+
_: 1
|
|
619
|
+
}, 8, ["modelValue"]),
|
|
620
|
+
c(ar, {
|
|
621
|
+
ref_key: "editCriteriaSheetRef",
|
|
622
|
+
ref: R,
|
|
623
|
+
onUpdate: M
|
|
624
|
+
}, null, 512)
|
|
625
|
+
], 64);
|
|
626
|
+
};
|
|
627
|
+
}
|
|
628
|
+
}), ir = { class: "flex flex-col space-y-16 pr-12" }, dr = { class: "fm-typo-en-title-sm-800" }, cr = { class: "flex items-center gap-8" }, ur = /* @__PURE__ */ q({
|
|
629
|
+
__name: "EditRefereeRewardSheet",
|
|
630
|
+
emits: ["update"],
|
|
631
|
+
setup(k, { expose: l, emit: I }) {
|
|
632
|
+
const { t: p } = Z(), g = I, f = F(!1), s = F([]), u = Q();
|
|
633
|
+
function m() {
|
|
634
|
+
g("update", s.value);
|
|
635
|
+
}
|
|
636
|
+
async function R(o) {
|
|
637
|
+
var i, S;
|
|
638
|
+
f.value = o, s.value = ((S = (i = u.referralProgram) == null ? void 0 : i.refereeReward) == null ? void 0 : S.map((h) => h.toString())) || [], n.value = L.value.map((h) => s.value.includes(h.id));
|
|
639
|
+
}
|
|
640
|
+
function A() {
|
|
641
|
+
f.value = !1;
|
|
642
|
+
}
|
|
643
|
+
const T = [
|
|
644
|
+
{
|
|
645
|
+
header: "Reward title",
|
|
646
|
+
accessorFn: (o) => o.name,
|
|
647
|
+
enableSorting: !0
|
|
648
|
+
},
|
|
649
|
+
{
|
|
650
|
+
id: "type",
|
|
651
|
+
header: "Reward type",
|
|
652
|
+
cell(o) {
|
|
653
|
+
return fe[o.row.original.collectibleConfig.type].chip();
|
|
654
|
+
}
|
|
655
|
+
},
|
|
656
|
+
{
|
|
657
|
+
header: "Description",
|
|
658
|
+
accessorFn: (o) => o.description,
|
|
659
|
+
cell(o) {
|
|
660
|
+
const i = o.row.original;
|
|
661
|
+
if (i.collectible.type == "VOUCHER" || i.selectedReward == null)
|
|
662
|
+
return i.description;
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
], M = me(), D = F([]), L = G(() => M.rewards.map((o) => {
|
|
666
|
+
let i = "No expiry";
|
|
667
|
+
switch (o.option.type) {
|
|
668
|
+
case "VOUCHER":
|
|
669
|
+
i = `${o.option.collectibleConfig.options.maxUse} use(s), ${ee(o.option.collectibleConfig.options.validityOption || {})}`;
|
|
670
|
+
break;
|
|
671
|
+
case "LOYALTY":
|
|
672
|
+
i = `${o.option.earningOption.amount}, ${ee(o.option.validityOption || {})}`;
|
|
673
|
+
break;
|
|
674
|
+
}
|
|
675
|
+
return {
|
|
676
|
+
id: o._id,
|
|
677
|
+
name: o.name,
|
|
678
|
+
collectible: o.option,
|
|
679
|
+
collectibleConfig: o.collectibleConfig,
|
|
680
|
+
description: i
|
|
681
|
+
};
|
|
682
|
+
}));
|
|
683
|
+
G(() => []);
|
|
684
|
+
function y() {
|
|
685
|
+
const o = L.value;
|
|
686
|
+
for (let i = 0; i < o.length; i++) {
|
|
687
|
+
const S = o[i], h = n.value[i];
|
|
688
|
+
h && !s.value.includes(S.id) && s.value.push(S.id), !h && s.value.includes(S.id) && (s.value = s.value.filter((e) => e != S.id));
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
const n = F({});
|
|
692
|
+
return ie(n, y, { deep: !0 }), l({
|
|
693
|
+
showSheet: R,
|
|
694
|
+
hideSheet: A,
|
|
695
|
+
data: s
|
|
696
|
+
}), (o, i) => {
|
|
697
|
+
const S = w("FmTable"), h = w("FmButton"), e = w("FmSideSheet");
|
|
698
|
+
return C(), j(e, {
|
|
699
|
+
"max-width": 1e3,
|
|
700
|
+
modelValue: r(f),
|
|
701
|
+
"onUpdate:modelValue": i[2] || (i[2] = (t) => J(f) ? f.value = t : null),
|
|
702
|
+
header: "Referee reward"
|
|
703
|
+
}, {
|
|
704
|
+
"side-sheet-footer": V(() => [
|
|
705
|
+
a("div", cr, [
|
|
706
|
+
c(h, {
|
|
707
|
+
label: r(p)("connect.common.save"),
|
|
708
|
+
onClick: m,
|
|
709
|
+
disabled: r(W)().isLoading,
|
|
710
|
+
loading: r(W)().isLoading
|
|
711
|
+
}, null, 8, ["label", "disabled", "loading"]),
|
|
712
|
+
c(h, {
|
|
713
|
+
label: r(p)("connect.common.cancel"),
|
|
714
|
+
onClick: i[1] || (i[1] = (t) => A()),
|
|
715
|
+
variant: "tertiary"
|
|
716
|
+
}, null, 8, ["label"])
|
|
717
|
+
])
|
|
718
|
+
]),
|
|
719
|
+
default: V(() => [
|
|
720
|
+
c(X, { json: r(s) }, null, 8, ["json"]),
|
|
721
|
+
a("div", ir, [
|
|
722
|
+
a("div", dr, O(r(p)("connect.referral.refereeRewardSheet.referee_reward")), 1),
|
|
723
|
+
c(S, {
|
|
724
|
+
modelValue: r(n),
|
|
725
|
+
"onUpdate:modelValue": i[0] || (i[0] = (t) => J(n) ? n.value = t : null),
|
|
726
|
+
selection: "multiple",
|
|
727
|
+
"column-filter": r(D),
|
|
728
|
+
"column-defs": T,
|
|
729
|
+
"row-data": r(L),
|
|
730
|
+
"page-size": 10
|
|
731
|
+
}, null, 8, ["modelValue", "column-filter", "row-data"])
|
|
732
|
+
])
|
|
733
|
+
]),
|
|
734
|
+
_: 1
|
|
735
|
+
}, 8, ["modelValue"]);
|
|
736
|
+
};
|
|
737
|
+
}
|
|
738
|
+
}), mr = { class: "fm-typo-en-title-sm-600" }, fr = { class: "grid grid-cols-4 xs:grid-cols-1 gap-4 divide-x xs:divide-x-0" }, pr = { class: "flex gap-x-8" }, hr = { class: "fm-typo-body-lg-600 flex items-center gap-x-4" }, vr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, _r = { class: "mb-40" }, gr = {
|
|
739
|
+
key: 0,
|
|
740
|
+
class: "flex flex-col items-center justify-center gap-y-16 p-24"
|
|
741
|
+
}, wr = { class: "flex flex-col gap-16 text-center" }, yr = { class: "fm-typo-en-title-sm-800" }, br = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Yr = /* @__PURE__ */ q({
|
|
742
|
+
__name: "Overview",
|
|
743
|
+
setup(k) {
|
|
744
|
+
const { t: l } = Z(), { minor: I } = ue, p = Pe(), g = Q(), { confirmUpdateReferralRecord: f, updateReferralRecord: s } = he(), u = G(() => {
|
|
745
|
+
var e;
|
|
746
|
+
return ((e = g.referralProgram) == null ? void 0 : e.reward) ?? [];
|
|
747
|
+
}), m = F(null);
|
|
748
|
+
F(null);
|
|
749
|
+
const R = F(null), A = F(null), T = F(null), M = G(() => {
|
|
750
|
+
var e, t, d, _;
|
|
751
|
+
return [
|
|
752
|
+
{
|
|
753
|
+
label: "connect.referral.how_it_works.generate_link",
|
|
754
|
+
sublabel: l("connect.referral.how_it_works.generate_link_for_member"),
|
|
755
|
+
icon: "offline_share"
|
|
756
|
+
},
|
|
757
|
+
{
|
|
758
|
+
label: "connect.referral.how_it_works.referee_join_reward",
|
|
759
|
+
sublabel: `${((t = (e = g.referralProgram) == null ? void 0 : e.pf_refereeReward) == null ? void 0 : t.length) || 0} ${l("connect.referral.how_it_works.reward")}`,
|
|
760
|
+
action: l("connect.referral.actions.manage_reward"),
|
|
761
|
+
onClick: () => {
|
|
762
|
+
var b;
|
|
763
|
+
return (b = T.value) == null ? void 0 : b.showSheet(!0);
|
|
764
|
+
},
|
|
765
|
+
helperText: l(
|
|
766
|
+
"connect.referral.how_it_works.referee_join_reward_description"
|
|
767
|
+
),
|
|
768
|
+
icon: "group_add"
|
|
769
|
+
},
|
|
770
|
+
{
|
|
771
|
+
label: "connect.referral.how_it_works.referee_meet_criteria",
|
|
772
|
+
sublabel: `${(d = g.referralProgram) == null ? void 0 : d.criteria.length} ${l("connect.referral.how_it_works.criteria")}`,
|
|
773
|
+
action: l("connect.referral.actions.manage_criteria"),
|
|
774
|
+
onClick: () => {
|
|
775
|
+
var b;
|
|
776
|
+
return (b = A.value) == null ? void 0 : b.showSheet(!0);
|
|
777
|
+
},
|
|
778
|
+
icon: "checklist_rtl"
|
|
779
|
+
},
|
|
780
|
+
{
|
|
781
|
+
label: "connect.referral.how_it_works.referer_get_reward",
|
|
782
|
+
sublabel: `${(_ = g.referralProgram) == null ? void 0 : _.reward.length} ${l("connect.referral.how_it_works.reward_tier")}`,
|
|
783
|
+
helperText: l("connect.referral.how_it_works.referral_tier_description"),
|
|
784
|
+
icon: "featured_seasonal_and_gifts"
|
|
785
|
+
}
|
|
786
|
+
];
|
|
787
|
+
});
|
|
788
|
+
function D(e) {
|
|
789
|
+
var t;
|
|
790
|
+
(t = m.value) == null || t.onManageRewardGroup(e);
|
|
791
|
+
}
|
|
792
|
+
function L(e) {
|
|
793
|
+
var t;
|
|
794
|
+
(t = R.value) == null || t.showSheet(!0, {
|
|
795
|
+
groupIndex: e.groupIndex,
|
|
796
|
+
countIndex: e.countIndex
|
|
797
|
+
});
|
|
798
|
+
}
|
|
799
|
+
async function y(e) {
|
|
800
|
+
var P, x, v, E;
|
|
801
|
+
const t = e.countIndex == -1 ? ((x = (P = g.referralProgram) == null ? void 0 : P.reward[e.groupIndex]) == null ? void 0 : x.rewards.length) || 0 : e.countIndex || 0, d = e.referralCount, _ = H(
|
|
802
|
+
g.referralProgram
|
|
803
|
+
), b = _.reward[e.groupIndex];
|
|
804
|
+
b.rewards[t] = e.referralCount;
|
|
805
|
+
const $ = b.rewards[t - 1], U = b.rewards[t + 1];
|
|
806
|
+
if ($ && $.threshold.to != d.threshold.from - 1) {
|
|
807
|
+
if (!await K.confirm(
|
|
808
|
+
l(
|
|
809
|
+
"connect.referral.referral_count.update.range_discontinuous.previous",
|
|
810
|
+
{
|
|
811
|
+
name: $.threshold.from,
|
|
812
|
+
from: $.threshold.from ?? 0,
|
|
813
|
+
to: $.threshold.to ?? 1 / 0,
|
|
814
|
+
newTo: d.threshold.from - 1
|
|
815
|
+
}
|
|
816
|
+
),
|
|
817
|
+
l("connect.referral.referral_count.title"),
|
|
818
|
+
l("connect.referral.referral_count.remove.next_range")
|
|
819
|
+
))
|
|
820
|
+
return;
|
|
821
|
+
$.threshold.to = d.threshold.from - 1;
|
|
822
|
+
}
|
|
823
|
+
if (U && U.threshold.from - 1 != d.threshold.to) {
|
|
824
|
+
if (!await K.confirm(
|
|
825
|
+
l("connect.program.tier.update.range_discontinuous.next", {
|
|
826
|
+
name: U.threshold.from,
|
|
827
|
+
from: U.threshold.from ?? 0,
|
|
828
|
+
to: U.threshold.to ?? 1 / 0,
|
|
829
|
+
newFrom: d.threshold.to ?? 1
|
|
830
|
+
}),
|
|
831
|
+
l("connect.program.tier.title"),
|
|
832
|
+
l("connect.program.tier.remove.next_range"),
|
|
833
|
+
l("connect.prompt.cancel")
|
|
834
|
+
))
|
|
835
|
+
return;
|
|
836
|
+
U.threshold.from = (d.threshold.to ?? 0) + 1;
|
|
837
|
+
}
|
|
838
|
+
!U && !((v = d.threshold) != null && v.to) && (d.threshold.to = void 0), await o(_), (E = R.value) == null || E.hideSheet();
|
|
839
|
+
}
|
|
840
|
+
async function n(e) {
|
|
841
|
+
var d;
|
|
842
|
+
const t = H(g.referralProgram);
|
|
843
|
+
t.refereeReward = e, await o(t), (d = T.value) == null || d.hideSheet();
|
|
844
|
+
}
|
|
845
|
+
async function o(e) {
|
|
846
|
+
await f(), await I(
|
|
847
|
+
async () => {
|
|
848
|
+
await pe.update({
|
|
849
|
+
...e,
|
|
850
|
+
updateReferralRecord: s.value
|
|
851
|
+
}), await g.readReferralProgram();
|
|
852
|
+
},
|
|
853
|
+
{
|
|
854
|
+
message: "Updating referral program",
|
|
855
|
+
successMessage: "Referral program updated successfully"
|
|
856
|
+
}
|
|
857
|
+
);
|
|
858
|
+
}
|
|
859
|
+
async function i(e) {
|
|
860
|
+
if (!await K.remove(
|
|
861
|
+
l("connect.referral.reward.confirm_remove_referral_tier"),
|
|
862
|
+
l("connect.referral.reward.remove_referral_tier"),
|
|
863
|
+
l("connect.prompt.confirm"),
|
|
864
|
+
l("connect.prompt.cancel")
|
|
865
|
+
))
|
|
866
|
+
return;
|
|
867
|
+
const t = H(g.referralProgram);
|
|
868
|
+
t.reward.splice(e, 1), await o(t);
|
|
869
|
+
}
|
|
870
|
+
async function S(e, t) {
|
|
871
|
+
if (!await K.remove(
|
|
872
|
+
l("connect.referral.reward.confirm_remove_referral_count"),
|
|
873
|
+
l("connect.referral.reward.remove_referral_count"),
|
|
874
|
+
l("connect.prompt.confirm"),
|
|
875
|
+
l("connect.prompt.cancel")
|
|
876
|
+
))
|
|
877
|
+
return;
|
|
878
|
+
const d = H(g.referralProgram), _ = d.reward[e].rewards[t + 1];
|
|
879
|
+
if (_) {
|
|
880
|
+
if (!await K.confirm(
|
|
881
|
+
l("connect.referral.referral_count.update.range_discontinuous.next", {
|
|
882
|
+
from: _.threshold.from ?? 0,
|
|
883
|
+
to: _.threshold.to ?? 1 / 0,
|
|
884
|
+
newFrom: d.reward[e].rewards[t].threshold.from
|
|
885
|
+
}),
|
|
886
|
+
l("connect.referral.referral_count.remove.title"),
|
|
887
|
+
l("connect.referral.referral_count.remove.next_range"),
|
|
888
|
+
l("connect.prompt.cancel")
|
|
889
|
+
))
|
|
890
|
+
return;
|
|
891
|
+
_.threshold.from = d.reward[e].rewards[t].threshold.from;
|
|
892
|
+
}
|
|
893
|
+
d.reward[e].rewards.splice(t, 1), await o(d);
|
|
894
|
+
}
|
|
895
|
+
const h = [
|
|
896
|
+
{
|
|
897
|
+
header: l("connect.referral.reward.table.count"),
|
|
898
|
+
accessorFn: (e) => e.threshold.from == e.threshold.to ? `${e.threshold.from}` : e.threshold.to ? `${e.threshold.from} - ${e.threshold.to ?? "∞"}` : `${e.threshold.from}+`
|
|
899
|
+
},
|
|
900
|
+
{
|
|
901
|
+
header: l("connect.referral.reward.table.reward"),
|
|
902
|
+
accessorKey: "type",
|
|
903
|
+
accessorFn: (e) => {
|
|
904
|
+
var t;
|
|
905
|
+
return `${((t = e.pf_reward) == null ? void 0 : t.length) || 0} reward(s)`;
|
|
906
|
+
}
|
|
907
|
+
},
|
|
908
|
+
{
|
|
909
|
+
id: "actions",
|
|
910
|
+
meta: {
|
|
911
|
+
textAlign: "right"
|
|
912
|
+
},
|
|
913
|
+
cell(e) {
|
|
914
|
+
return te(oe.FmButton, {
|
|
915
|
+
variant: "tertiary",
|
|
916
|
+
icon: "delete",
|
|
917
|
+
iconColor: "neutral-gray-400",
|
|
918
|
+
class: "ml-auto",
|
|
919
|
+
onClick: (t) => {
|
|
920
|
+
t.stopPropagation(), console.log(e.row), S(e.row.original.groupIndex, e.row.index);
|
|
921
|
+
}
|
|
922
|
+
});
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
];
|
|
926
|
+
return _e(async () => {
|
|
927
|
+
await g.readReferralProgram();
|
|
928
|
+
}), (e, t) => {
|
|
929
|
+
const d = w("FmCard"), _ = w("FmIcon"), b = w("FmTooltip"), $ = w("FmButton"), U = w("FmTable"), P = w("FmList");
|
|
930
|
+
return C(), B(Y, null, [
|
|
931
|
+
z("", !0),
|
|
932
|
+
c(d, {
|
|
933
|
+
variant: "outlined",
|
|
934
|
+
class: "flex flex-col gap-16 p-16"
|
|
935
|
+
}, {
|
|
936
|
+
default: V(() => [
|
|
937
|
+
a("div", mr, O(r(l)("connect.referral.how_it_works.title")), 1),
|
|
938
|
+
a("div", fr, [
|
|
939
|
+
(C(!0), B(Y, null, re(r(M), (x, v) => (C(), B("div", {
|
|
940
|
+
key: v,
|
|
941
|
+
class: de(["px-8", { "xs:!border-r": v % 2 == 0 }])
|
|
942
|
+
}, [
|
|
943
|
+
a("div", pr, [
|
|
944
|
+
c(_, {
|
|
945
|
+
name: x.icon,
|
|
946
|
+
color: "primary",
|
|
947
|
+
class: "bg-fm-color-system-warning-100 p-8 fm-corner-radius-md max-h-40 max-w-40"
|
|
948
|
+
}, null, 8, ["name"]),
|
|
949
|
+
a("div", null, [
|
|
950
|
+
a("div", hr, [
|
|
951
|
+
ce(O(r(l)(x.label)) + " ", 1),
|
|
952
|
+
x.helperText ? (C(), j(b, {
|
|
953
|
+
key: 0,
|
|
954
|
+
content: x.helperText
|
|
955
|
+
}, {
|
|
956
|
+
default: V(() => [
|
|
957
|
+
c(_, {
|
|
958
|
+
name: "help",
|
|
959
|
+
size: "sm",
|
|
960
|
+
outline: !0
|
|
961
|
+
})
|
|
962
|
+
]),
|
|
963
|
+
_: 2
|
|
964
|
+
}, 1032, ["content"])) : z("", !0)
|
|
965
|
+
]),
|
|
966
|
+
a("div", vr, O(x.sublabel), 1),
|
|
967
|
+
x.action ? (C(), j($, {
|
|
968
|
+
key: 0,
|
|
969
|
+
variant: "plain",
|
|
970
|
+
label: x.action,
|
|
971
|
+
disabled: !r(p).isPremium,
|
|
972
|
+
class: "fm-typo-en-body-md-400 !p-0",
|
|
973
|
+
onClick: x.onClick
|
|
974
|
+
}, null, 8, ["label", "disabled", "onClick"])) : z("", !0)
|
|
975
|
+
])
|
|
976
|
+
])
|
|
977
|
+
], 2))), 128))
|
|
978
|
+
])
|
|
979
|
+
]),
|
|
980
|
+
_: 1
|
|
981
|
+
}),
|
|
982
|
+
r(u) && r(u).length > 0 ? (C(), j(d, {
|
|
983
|
+
key: 1,
|
|
984
|
+
variant: "outlined",
|
|
985
|
+
class: "flex flex-col gap-16 p-16"
|
|
986
|
+
}, {
|
|
987
|
+
default: V(() => [
|
|
988
|
+
c(P, { separator: !0 }, {
|
|
989
|
+
default: V(() => [
|
|
990
|
+
(C(!0), B(Y, null, re(r(u), (x, v) => (C(), j(Ge, {
|
|
991
|
+
key: v,
|
|
992
|
+
"reward-group": x,
|
|
993
|
+
level: v,
|
|
994
|
+
onEdit: (E) => D(v),
|
|
995
|
+
onRemove: (E) => i(v),
|
|
996
|
+
onAddCount: t[0] || (t[0] = (E) => {
|
|
997
|
+
L({ groupIndex: E, countIndex: -1 });
|
|
998
|
+
})
|
|
999
|
+
}, {
|
|
1000
|
+
default: V(() => [
|
|
1001
|
+
a("div", _r, [
|
|
1002
|
+
c(U, {
|
|
1003
|
+
"row-data": x.rewards.map((E) => ({ ...E, groupIndex: v })),
|
|
1004
|
+
"column-defs": h,
|
|
1005
|
+
"hide-footer": !0,
|
|
1006
|
+
"page-size": 50,
|
|
1007
|
+
onRowClick: (E) => L({ groupIndex: v, countIndex: E.index })
|
|
1008
|
+
}, null, 8, ["row-data", "onRowClick"])
|
|
1009
|
+
]),
|
|
1010
|
+
x.rewards.length ? z("", !0) : (C(), B("div", gr, [
|
|
1011
|
+
t[3] || (t[3] = a("div", { class: "flex flex-col gap-16 text-center" }, [
|
|
1012
|
+
a("div", { class: "fm-typo-en-title-sm-800" }, "Create progressive reward"),
|
|
1013
|
+
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 ")
|
|
1014
|
+
], -1)),
|
|
1015
|
+
c($, {
|
|
1016
|
+
variant: "secondary",
|
|
1017
|
+
label: "Add count",
|
|
1018
|
+
icon: "add",
|
|
1019
|
+
onClick: (E) => L({ groupIndex: v, countIndex: -1 })
|
|
1020
|
+
}, null, 8, ["onClick"])
|
|
1021
|
+
]))
|
|
1022
|
+
]),
|
|
1023
|
+
_: 2
|
|
1024
|
+
}, 1032, ["reward-group", "level", "onEdit", "onRemove"]))), 128))
|
|
1025
|
+
]),
|
|
1026
|
+
_: 1
|
|
1027
|
+
})
|
|
1028
|
+
]),
|
|
1029
|
+
_: 1
|
|
1030
|
+
})) : (C(), j(d, {
|
|
1031
|
+
key: 2,
|
|
1032
|
+
variant: "outlined",
|
|
1033
|
+
class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
|
|
1034
|
+
}, {
|
|
1035
|
+
default: V(() => [
|
|
1036
|
+
t[4] || (t[4] = a("img", {
|
|
1037
|
+
src: ge,
|
|
1038
|
+
class: "aspect-square w-[150px]"
|
|
1039
|
+
}, null, -1)),
|
|
1040
|
+
a("div", wr, [
|
|
1041
|
+
a("div", yr, O(r(l)("connect.referral.referral_tier_title")), 1),
|
|
1042
|
+
a("div", br, O(r(l)("connect.referral.referral_tier_description")), 1)
|
|
1043
|
+
]),
|
|
1044
|
+
c($, {
|
|
1045
|
+
variant: "primary",
|
|
1046
|
+
label: r(l)("connect.referral.add_referral_tier"),
|
|
1047
|
+
icon: "add",
|
|
1048
|
+
disabled: !r(p).isPremium,
|
|
1049
|
+
onClick: t[1] || (t[1] = (x) => D(-1))
|
|
1050
|
+
}, null, 8, ["label", "disabled"])
|
|
1051
|
+
]),
|
|
1052
|
+
_: 1
|
|
1053
|
+
})),
|
|
1054
|
+
c(ye, {
|
|
1055
|
+
ref_key: "rewardGroupRef",
|
|
1056
|
+
ref: m
|
|
1057
|
+
}, null, 512),
|
|
1058
|
+
c(qe, {
|
|
1059
|
+
ref_key: "editReferralCountSheetRef",
|
|
1060
|
+
ref: R,
|
|
1061
|
+
onUpdate: y
|
|
1062
|
+
}, null, 512),
|
|
1063
|
+
c(sr, {
|
|
1064
|
+
ref_key: "manageCriteriaSheetRef",
|
|
1065
|
+
ref: A
|
|
1066
|
+
}, null, 512),
|
|
1067
|
+
c(ur, {
|
|
1068
|
+
ref_key: "editRefereeRewardSheetRef",
|
|
1069
|
+
ref: T,
|
|
1070
|
+
onUpdate: n
|
|
1071
|
+
}, null, 512)
|
|
1072
|
+
], 64);
|
|
1073
|
+
};
|
|
1074
|
+
}
|
|
1075
|
+
});
|
|
1076
|
+
export {
|
|
1077
|
+
Yr as default
|
|
1078
|
+
};
|