@feedmepos/mf-connect 0.1.8-prod → 0.1.10-prod
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Analytic-C5DiiAlc.js → Analytic-CpSbitWV.js} +24 -22
- package/dist/{App-B3pHa-zu.js → App-BPT8XzjX.js} +56 -51
- package/dist/{Broadcast-BbKiYeZC.js → Broadcast-CJHpiQeN.js} +8 -8
- package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CusmGpDT.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DUPqWdIm.js} +7 -8
- package/dist/Card-Bvn36zqZ.js +895 -0
- package/dist/{Collections-DvZEXknp.js → Collections-Bq6OxsJC.js} +24 -29
- package/dist/{Credit-CqjSUWeG.js → Credit-Dno_g7dW.js} +8 -8
- package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-DLnvDVgf.js +108 -0
- package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-Bzd-9d8d.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-cGbwORhw.js} +649 -1284
- package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-C73wNCE4.js → EffectSheet.vue_vue_type_style_index_0_lang-Ho7zwlbb.js} +20 -20
- package/dist/{Experience-BmCrc4-K.js → Experience-BC1qSIGO.js} +8 -8
- package/dist/{Game-CU4AHASb.js → Game-C_CKGMBW.js} +8 -8
- package/dist/Index-BXFaWTfw.js +255 -0
- package/dist/{Marketing-PJO3M5Xy.js → Marketing-Ni0WAie5.js} +5 -5
- package/dist/{Member-DChbb26Z.js → Member-djnisrK1.js} +4 -4
- package/dist/{MemberList-Ckvxgme7.js → MemberList-CclU-3B7.js} +194 -191
- package/dist/{MemberTransactions-KNlKr1DE.js → MemberTransactions-DVVsv3Ux.js} +1 -1
- package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-CDX1qdOw.js → MessageInput.vue_vue_type_script_setup_true_lang-khyDg1m4.js} +2 -2
- package/dist/Mission-Z5somdo_.js +273 -0
- package/dist/Overview-BvMVz3lQ.js +1074 -0
- package/dist/{Point-B-Ot-ZXU.js → Point-DdPukiTg.js} +8 -8
- package/dist/{Promotion-CKEfuwo0.js → Promotion-DCqdIwjG.js} +9 -9
- package/dist/Record-CvMxXm1B.js +337 -0
- package/dist/Reward-CiJHGXfQ.js +441 -0
- package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-CrGCBRmH.js +150 -0
- package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-tnT6i0Jq.js +1638 -0
- package/dist/{Segment-B8JKn5_y.js → Segment-CQb3j-o0.js} +22 -21
- package/dist/SelectItems.vue_vue_type_script_setup_true_lang-B7YqIU5D.js +181 -0
- package/dist/{Setting-BcWDJ-63.js → Setting-91cK3ssU.js} +31 -31
- package/dist/Store-B-uldUKt.js +1744 -0
- package/dist/{StoreRewards-DyfFecSH.js → StoreRewards-dDNeFlA9.js} +15 -14
- package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-BVb1X0aq.js +1132 -0
- package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-CHrZ7pit.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-Ds0WxGxr.js} +1 -1
- package/dist/{Tier-iKOv9e2Y.js → Tier-_jMaLj3u.js} +185 -185
- package/dist/{Title-BRWnLlHd.js → Title-By7o67aT.js} +20 -20
- package/dist/{Transaction-BMnxATxc.js → Transaction-BLpEgeI2.js} +2 -2
- package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-Bf_nO9zH.js +130 -0
- package/dist/{Voucher-B_IwtXLW.js → Voucher-CG5tfibn.js} +11 -11
- package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-DpQUoXyQ.js +419 -0
- package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-YwGR2En3.js +56 -0
- package/dist/{app-Bs8TZeMP.js → app-DDmTqTb7.js} +1 -1
- package/dist/{app-CLPpu6jA.js → app-vCqTQIeC.js} +430 -276
- package/dist/app.js +1 -1
- package/dist/{business-Dg5T3krT.js → business-Cz78KGF2.js} +1 -1
- package/dist/{campaign-BMLeXfnZ.js → campaign-BBd4o7F_.js} +2 -2
- package/dist/campaign.enum-CIhi0b-m.js +20 -0
- package/dist/campaign.fn-5silF1DK.js +758 -0
- package/dist/collectible.enum-cMIQ6ogq.js +19 -0
- package/dist/{collection.fn-D4QJRMAS.js → collection.fn-BGc7Qeli.js} +2 -2
- package/dist/dto-i04OPJfW.js +2018 -0
- package/dist/{effect-BT6zDeUe.js → effect-D8UzkYRg.js} +1 -1
- package/dist/{email-addresses-DeUE8GFC.js → email-addresses-u05o35hN.js} +1 -1
- package/dist/{export-DWzBynN8.js → export-BEXuPYEd.js} +3 -3
- package/dist/{helper-Cs4YpYv9.js → helper-RptRJGv6.js} +1 -1
- package/dist/{index-aFNPEkUz.js → index-B8s-gucK.js} +13 -1
- package/dist/{index-B3GqF_vh.js → index-BjHZUhiH.js} +1 -1
- package/dist/{index-BUXB-qmB.js → index-Bpu2DYUc.js} +1348 -1342
- package/dist/{index-n-_5f43h.js → index-C6-rCMhD.js} +3 -3
- package/dist/{index-CjF0scjl.js → index-Cq_ZIbRm.js} +174 -168
- package/dist/{index-CiwzD983.js → index-DFAnoAe9.js} +1 -1
- package/dist/index-DbyJ6Nyn.js +54 -0
- package/dist/{index-BXs-tqST.js → index-Dt6K2eG8.js} +1 -1
- package/dist/{index-xCMvgFRa.js → index-DwzoqCt8.js} +989 -783
- package/dist/index-UfL5qRzR.js +1049 -0
- package/dist/index-g8EbRVnr.js +32 -0
- package/dist/{index-DfhJOhMY.js → index-hEE_ntHd.js} +1 -1
- package/dist/index-vh86FiIQ.js +10 -0
- package/dist/{index.esm2017-cme_1dHU.js → index.esm2017-BSzW_yaL.js} +1 -1
- package/dist/{loading-zw44FQ6v.js → loading-DjEdwdnj.js} +156 -153
- package/dist/{membership-Bg77E5Sx.js → membership-BL9Xs8lD.js} +52 -44
- package/dist/{money-BepQPzrc.js → money-D7lq0cx-.js} +1 -1
- package/dist/{number-BJ4XIfGj.js → number-BiDabTkI.js} +1 -1
- package/dist/objectid-CXf0jb1W.js +145 -0
- package/dist/reward-Cr8rbe5R.js +36 -0
- package/dist/{rule-builder-C1Jwhs7N.js → rule-builder-DPKFZ5UX.js} +1 -1
- package/dist/{rule-oDZ1Kic9.js → rule-vkYJij4h.js} +4 -3
- package/dist/{template-CSeRj8B2.js → template-Bep5Y5ch.js} +4 -4
- package/dist/trigger-fWhQ3bqv.js +144 -0
- package/dist/{usePagination-DUaGlE2s.js → usePagination-DSF5b4hM.js} +1 -1
- package/dist/user-9UiaP0xs.js +54 -0
- package/dist/{vue-i18n-4eZqYBzI.js → vue-i18n-BhiDOB1j.js} +112 -112
- package/dist/zod-Bg2FbC-D.js +90 -0
- package/package.json +2 -2
- package/dist/Card--Q4OMSRz.js +0 -824
- package/dist/Mission-B215NI_F.js +0 -261
- package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-C03bKqvg.js +0 -1804
- package/dist/Store-ada-EZLR.js +0 -1530
- package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-Ra4nMKvT.js +0 -890
- package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-vsgeD3mK.js +0 -141
- package/dist/dto-CQy53qRe.js +0 -2770
- package/dist/index-CvJ_6M8U.js +0 -298
- package/dist/index-QAuJWbpX.js +0 -756
- package/dist/index-sGtk4oiO.js +0 -207
- package/dist/user-Bm4KttFq.js +0 -37
|
@@ -0,0 +1,1074 @@
|
|
|
1
|
+
import { defineComponent as q, resolveComponent as w, openBlock as R, createElementBlock as B, Fragment as Y, createVNode as i, withCtx as V, createElementVNode as a, toDisplayString as O, unref as t, renderSlot as _e, ref as $, computed as G, watch as ie, createBlock as D, isRef as W, resolveDynamicComponent as ne, renderList as te, normalizeClass as de, createTextVNode as ce, createCommentVNode as z, h as re, onMounted as ve } from "vue";
|
|
2
|
+
import { _ as ge } from "./campaign-CpzFl8Vr.js";
|
|
3
|
+
import { u as Z } from "./vue-i18n-BhiDOB1j.js";
|
|
4
|
+
import { c as we, p as K, u as ue } from "./loading-DjEdwdnj.js";
|
|
5
|
+
import { J as X } from "./JsonViewer-v8_C7l5N.js";
|
|
6
|
+
import { Z as N } from "./zod-Bg2FbC-D.js";
|
|
7
|
+
import { u as J } from "./app-wDQR6dpb.js";
|
|
8
|
+
import { u as Q, _ as ye } from "./RewardGroup.vue_vue_type_script_setup_true_lang-CrGCBRmH.js";
|
|
9
|
+
import { u as me } from "./reward-Cr8rbe5R.js";
|
|
10
|
+
import "./index-DwzoqCt8.js";
|
|
11
|
+
import "./index-Bpu2DYUc.js";
|
|
12
|
+
import { k as le, l as se } from "./index-UfL5qRzR.js";
|
|
13
|
+
import { a as be, b as xe } from "./index-Cq_ZIbRm.js";
|
|
14
|
+
import "./index-hEE_ntHd.js";
|
|
15
|
+
import "./index-DbyJ6Nyn.js";
|
|
16
|
+
import { C as fe } from "./membership-BL9Xs8lD.js";
|
|
17
|
+
import { t as ee } from "./helper-RptRJGv6.js";
|
|
18
|
+
import { c as H } from "./object-qECH92oz.js";
|
|
19
|
+
import { useDialog as Re, components as oe } from "@feedmepos/ui-library";
|
|
20
|
+
import { _ as Ce } from "./ZodTextField.vue_vue_type_script_setup_true_lang-YwGR2En3.js";
|
|
21
|
+
import { b as Se, _ as $e, a as Fe } from "./trigger-fWhQ3bqv.js";
|
|
22
|
+
import { O as ke } from "./objectid-CXf0jb1W.js";
|
|
23
|
+
import { r as pe } from "./index-g8EbRVnr.js";
|
|
24
|
+
import { u as Pe } from "./business-Cz78KGF2.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" }, De = { class: "flex-1 space-y-4" }, je = { 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(F, { emit: u }) {
|
|
39
|
+
const { t: I } = Z(), p = u;
|
|
40
|
+
return (g, m) => {
|
|
41
|
+
const n = w("FmButton"), d = w("FmListItem");
|
|
42
|
+
return R(), B(Y, null, [
|
|
43
|
+
i(d, {
|
|
44
|
+
onClick: m[4] || (m[4] = (c) => p("edit", F.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(F.rewardGroup.name), 1)
|
|
53
|
+
])
|
|
54
|
+
])
|
|
55
|
+
]),
|
|
56
|
+
a("div", Le, [
|
|
57
|
+
i(n, {
|
|
58
|
+
variant: "secondary",
|
|
59
|
+
label: t(I)("connect.referral.reward.add_count"),
|
|
60
|
+
icon: "add",
|
|
61
|
+
onClick: m[0] || (m[0] = (c) => {
|
|
62
|
+
c.stopPropagation(), p("addCount", F.level);
|
|
63
|
+
})
|
|
64
|
+
}, null, 8, ["label"]),
|
|
65
|
+
i(n, {
|
|
66
|
+
icon: "delete",
|
|
67
|
+
onClick: m[1] || (m[1] = (c) => {
|
|
68
|
+
c.stopPropagation(), p("remove", F.level);
|
|
69
|
+
}),
|
|
70
|
+
variant: "tertiary"
|
|
71
|
+
})
|
|
72
|
+
])
|
|
73
|
+
]),
|
|
74
|
+
a("div", Ee, [
|
|
75
|
+
a("div", Be, [
|
|
76
|
+
a("div", Oe, [
|
|
77
|
+
a("div", De, [
|
|
78
|
+
a("div", null, [
|
|
79
|
+
a("div", je, O(F.rewardGroup.name), 1)
|
|
80
|
+
])
|
|
81
|
+
])
|
|
82
|
+
]),
|
|
83
|
+
i(n, {
|
|
84
|
+
variant: "tertiary",
|
|
85
|
+
icon: "delete",
|
|
86
|
+
onClick: m[2] || (m[2] = (c) => (c.stopPropagation(), p("remove", F.level)))
|
|
87
|
+
})
|
|
88
|
+
]),
|
|
89
|
+
i(n, {
|
|
90
|
+
class: "w-full",
|
|
91
|
+
variant: "secondary",
|
|
92
|
+
label: "Add count",
|
|
93
|
+
disabled: !0,
|
|
94
|
+
icon: "add",
|
|
95
|
+
onClick: m[3] || (m[3] = (c) => (c.stopPropagation(), p("addCount", F.level)))
|
|
96
|
+
})
|
|
97
|
+
])
|
|
98
|
+
]),
|
|
99
|
+
_: 1
|
|
100
|
+
}),
|
|
101
|
+
_e(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 = /* @__PURE__ */ 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), 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(F, { expose: u, emit: I }) {
|
|
109
|
+
const { t: p } = Z(), g = I, m = $(!1), n = $({}), d = $(-1), c = $(-1), C = Q(), A = be.superRefine((e, r) => {
|
|
110
|
+
var k, U, P, x, _, E, ae;
|
|
111
|
+
const s = c.value == -1 ? ((P = (U = (k = C.referralProgram) == null ? void 0 : k.reward[d.value]) == null ? void 0 : U.rewards) == null ? void 0 : P.length) || 0 : c.value, v = (_ = (x = C.referralProgram) == null ? void 0 : x.reward[d.value]) == null ? void 0 : _.rewards[s - 1], b = (ae = (E = C.referralProgram) == null ? void 0 : E.reward[d.value]) == null ? void 0 : ae.rewards[s + 1];
|
|
112
|
+
v && e.threshold.from < v.threshold.from + 1 && r.addIssue({
|
|
113
|
+
code: "custom",
|
|
114
|
+
message: `The min referral must be at least ${v.threshold.from + 1}`,
|
|
115
|
+
path: ["option"]
|
|
116
|
+
}), b && e.threshold.to && b.threshold.to && e.threshold.to > b.threshold.to - 1 && r.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(n.value);
|
|
123
|
+
return e.success ? [] : e.error.errors;
|
|
124
|
+
});
|
|
125
|
+
function M() {
|
|
126
|
+
const e = A.safeParse(n.value);
|
|
127
|
+
e.success && g("update", {
|
|
128
|
+
groupIndex: d.value,
|
|
129
|
+
countIndex: c.value,
|
|
130
|
+
referralCount: e.data
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
async function j(e, r) {
|
|
134
|
+
var s, v, b, k, U, P;
|
|
135
|
+
if (m.value = e, e && typeof (r == null ? void 0 : r.countIndex) == "number" && r.countIndex >= 0)
|
|
136
|
+
d.value = r.groupIndex, c.value = r.countIndex, n.value = H(
|
|
137
|
+
(s = C.referralProgram) == null ? void 0 : s.reward[r.groupIndex].rewards[r.countIndex]
|
|
138
|
+
);
|
|
139
|
+
else {
|
|
140
|
+
d.value = r.groupIndex, c.value = -1;
|
|
141
|
+
const x = c.value == -1 ? ((k = (b = (v = C.referralProgram) == null ? void 0 : v.reward[d.value]) == null ? void 0 : b.rewards) == null ? void 0 : k.length) || 0 : c.value, _ = (P = (U = C.referralProgram) == null ? void 0 : U.reward[d.value]) == null ? void 0 : P.rewards[x - 1];
|
|
142
|
+
n.value = {
|
|
143
|
+
threshold: {
|
|
144
|
+
from: _ != null && _.threshold ? _ != null && _.threshold.to ? _.threshold.to + 1 : (_ == null ? void 0 : _.threshold.from) + 1 : 1,
|
|
145
|
+
to: null
|
|
146
|
+
},
|
|
147
|
+
rewards: []
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
h.value = [], h.value = l.value.map(
|
|
151
|
+
(x) => n.value.rewards.includes(x.id)
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
function L() {
|
|
155
|
+
m.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 r = e.row.original;
|
|
175
|
+
if (r.collectible.type == "VOUCHER" || r.selectedReward == null)
|
|
176
|
+
return r.description;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
], f = me(), o = $([]), l = G(() => f.rewards.map((e) => {
|
|
180
|
+
let r = "No expiry";
|
|
181
|
+
switch (e.option.type) {
|
|
182
|
+
case "VOUCHER":
|
|
183
|
+
r = `${e.option.collectibleConfig.options.maxUse} use(s), ${ee(e.option.collectibleConfig.options.validityOption || {})}`;
|
|
184
|
+
break;
|
|
185
|
+
case "LOYALTY":
|
|
186
|
+
r = `${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: r
|
|
195
|
+
};
|
|
196
|
+
}));
|
|
197
|
+
G(() => []);
|
|
198
|
+
function S() {
|
|
199
|
+
const e = l.value;
|
|
200
|
+
for (let r = 0; r < e.length; r++) {
|
|
201
|
+
const s = e[r], v = h.value[r];
|
|
202
|
+
v && !n.value.rewards.includes(s.id) && n.value.rewards.push(s.id), !v && n.value.rewards.includes(s.id) && (n.value.rewards = n.value.rewards.filter(
|
|
203
|
+
(b) => b != s.id
|
|
204
|
+
));
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
const h = $({});
|
|
208
|
+
return ie(h, S, { deep: !0 }), u({
|
|
209
|
+
showSheet: j,
|
|
210
|
+
hideSheet: L,
|
|
211
|
+
data: n
|
|
212
|
+
}), (e, r) => {
|
|
213
|
+
const s = w("FmStepperField"), v = w("FmHelperText"), b = w("FmTable"), k = w("FmButton"), U = w("FmSideSheet");
|
|
214
|
+
return R(), D(U, {
|
|
215
|
+
"max-width": 1e3,
|
|
216
|
+
modelValue: t(m),
|
|
217
|
+
"onUpdate:modelValue": r[4] || (r[4] = (P) => W(m) ? m.value = P : null),
|
|
218
|
+
header: `${t(c) == -1 ? t(p)("connect.referral.editReferralCountSheet.add") : t(p)("connect.referral.editReferralCountSheet.edit")}`
|
|
219
|
+
}, {
|
|
220
|
+
"side-sheet-footer": V(() => [
|
|
221
|
+
a("div", Ye, [
|
|
222
|
+
i(k, {
|
|
223
|
+
label: t(p)("connect.editTierSheet.submit"),
|
|
224
|
+
onClick: M,
|
|
225
|
+
disabled: t(T).length > 0 || t(J)().isLoading,
|
|
226
|
+
loading: t(J)().isLoading
|
|
227
|
+
}, null, 8, ["label", "disabled", "loading"]),
|
|
228
|
+
i(k, {
|
|
229
|
+
label: t(p)("connect.editTierSheet.cancel"),
|
|
230
|
+
onClick: r[3] || (r[3] = (P) => L()),
|
|
231
|
+
variant: "tertiary"
|
|
232
|
+
}, null, 8, ["label"])
|
|
233
|
+
])
|
|
234
|
+
]),
|
|
235
|
+
default: V(() => [
|
|
236
|
+
i(X, { json: t(n) }, null, 8, ["json"]),
|
|
237
|
+
i(X, { json: t(T) }, null, 8, ["json"]),
|
|
238
|
+
a("div", Me, [
|
|
239
|
+
a("div", null, [
|
|
240
|
+
a("div", Ne, [
|
|
241
|
+
i(s, {
|
|
242
|
+
modelValue: t(n).threshold.from,
|
|
243
|
+
"onUpdate:modelValue": r[0] || (r[0] = (P) => t(n).threshold.from = P),
|
|
244
|
+
"show-steppers": !1,
|
|
245
|
+
rules: [t(N).ruleAtPath(t(A), "threshold.from")]
|
|
246
|
+
}, {
|
|
247
|
+
label: V(() => [
|
|
248
|
+
(R(), D(ne(
|
|
249
|
+
t(N).toInputLabel(
|
|
250
|
+
t(N).typeAtPath(t(A), "threshold.from"),
|
|
251
|
+
t(p)(
|
|
252
|
+
"connect.referral.editReferralCountSheet.min_referral_count"
|
|
253
|
+
)
|
|
254
|
+
)
|
|
255
|
+
)))
|
|
256
|
+
]),
|
|
257
|
+
_: 1
|
|
258
|
+
}, 8, ["modelValue", "rules"]),
|
|
259
|
+
i(s, {
|
|
260
|
+
modelValue: t(n).threshold.to,
|
|
261
|
+
"onUpdate:modelValue": r[1] || (r[1] = (P) => t(n).threshold.to = P),
|
|
262
|
+
"show-steppers": !1,
|
|
263
|
+
rules: [t(N).ruleAtPath(t(A), "threshold.to")]
|
|
264
|
+
}, {
|
|
265
|
+
label: V(() => [
|
|
266
|
+
(R(), D(ne(
|
|
267
|
+
t(N).toInputLabel(
|
|
268
|
+
t(N).typeAtPath(t(A), "threshold.to"),
|
|
269
|
+
t(p)(
|
|
270
|
+
"connect.referral.editReferralCountSheet.max_referral_count"
|
|
271
|
+
)
|
|
272
|
+
)
|
|
273
|
+
)))
|
|
274
|
+
]),
|
|
275
|
+
_: 1
|
|
276
|
+
}, 8, ["modelValue", "rules"])
|
|
277
|
+
]),
|
|
278
|
+
i(v, {
|
|
279
|
+
text: t(N).helperText(t(T), "threshold"),
|
|
280
|
+
state: t(N).helperState(t(T), "threshold")
|
|
281
|
+
}, null, 8, ["text", "state"]),
|
|
282
|
+
He
|
|
283
|
+
]),
|
|
284
|
+
a("div", ze, O(t(p)("connect.referral.editReferralCountSheet.referrer_reward")), 1),
|
|
285
|
+
i(b, {
|
|
286
|
+
modelValue: t(h),
|
|
287
|
+
"onUpdate:modelValue": r[2] || (r[2] = (P) => W(h) ? h.value = P : null),
|
|
288
|
+
selection: "multiple",
|
|
289
|
+
"column-filter": t(o),
|
|
290
|
+
"column-defs": y,
|
|
291
|
+
"row-data": t(l),
|
|
292
|
+
"page-size": 10
|
|
293
|
+
}, null, 8, ["modelValue", "column-filter", "row-data"])
|
|
294
|
+
])
|
|
295
|
+
]),
|
|
296
|
+
_: 1
|
|
297
|
+
}, 8, ["modelValue", "header"]);
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
}), Ke = { class: "space-y-16" }, We = /* @__PURE__ */ 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), Je = { class: "grid grid-cols-3 gap-16" }, Ze = { class: "fm-typo-en-title-sm-800" }, Qe = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Xe = /* @__PURE__ */ q({
|
|
301
|
+
__name: "CriteriaTriggerInput",
|
|
302
|
+
props: {
|
|
303
|
+
modelValue: {
|
|
304
|
+
type: String
|
|
305
|
+
},
|
|
306
|
+
disabled: {
|
|
307
|
+
type: Boolean,
|
|
308
|
+
default: !1
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
emits: ["update:model-value"],
|
|
312
|
+
setup(F, { emit: u }) {
|
|
313
|
+
const I = F, p = u, g = G(() => [
|
|
314
|
+
le.enum.BILL_COMPLETED,
|
|
315
|
+
le.enum.FEEDBACK
|
|
316
|
+
].map((m) => Se[m]));
|
|
317
|
+
return (m, n) => {
|
|
318
|
+
const d = w("FmCard");
|
|
319
|
+
return R(), B("div", Ke, [
|
|
320
|
+
We,
|
|
321
|
+
a("div", Je, [
|
|
322
|
+
(R(!0), B(Y, null, te(t(g), (c) => (R(), D(d, {
|
|
323
|
+
key: c.name,
|
|
324
|
+
variant: "outlined",
|
|
325
|
+
disabled: I.disabled,
|
|
326
|
+
class: de(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
|
|
327
|
+
"col-span-3": t(g).length == 1,
|
|
328
|
+
"border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": F.modelValue == c.value,
|
|
329
|
+
"hover:bg-fm-color-opacity-sm": F.modelValue != c.value
|
|
330
|
+
}]),
|
|
331
|
+
onClick: () => {
|
|
332
|
+
I.modelValue != c.value && !I.disabled && p("update:model-value", c.value);
|
|
333
|
+
}
|
|
334
|
+
}, {
|
|
335
|
+
default: V(() => [
|
|
336
|
+
a("div", Ze, O(c.name), 1),
|
|
337
|
+
a("div", Qe, O(c.description), 1)
|
|
338
|
+
]),
|
|
339
|
+
_: 2
|
|
340
|
+
}, 1032, ["disabled", "class", "onClick"]))), 128))
|
|
341
|
+
])
|
|
342
|
+
]);
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
}), et = { class: "flex items-center gap-x-8" }, tt = { class: "flex flex-col space-y-16 pr-12" }, rt = /* @__PURE__ */ a("div", { class: "fm-typo-en-title-sm-600" }, "Program Criteria", -1), ot = /* @__PURE__ */ a("div", { class: "fm-typo-en-title-sm-600" }, "Configuration", -1), at = /* @__PURE__ */ a("div", { class: "fm-typo-en-title-sm-600" }, "Trigger", -1), nt = /* @__PURE__ */ a("div", null, " Select trigger what referee need to complete in order for referral to earn reward ", -1), lt = {
|
|
346
|
+
key: 0,
|
|
347
|
+
class: "space-y-16"
|
|
348
|
+
}, st = /* @__PURE__ */ a("div", { class: "fm-typo-en-title-sm-600" }, "Spending Criteria", -1), it = {
|
|
349
|
+
key: 1,
|
|
350
|
+
class: "space-y-16"
|
|
351
|
+
}, dt = /* @__PURE__ */ a("div", { class: "fm-typo-en-title-sm-600" }, "Feedback Criteria", -1), ct = { class: "flex items-center gap-8" }, ut = /* @__PURE__ */ q({
|
|
352
|
+
__name: "EditCriteriaSheet",
|
|
353
|
+
emits: ["update"],
|
|
354
|
+
setup(F, { expose: u, emit: I }) {
|
|
355
|
+
const { t: p } = Z(), g = I, m = $(!1), n = $(-1), d = $({}), c = Q(), C = xe.superRefine((y, f) => {
|
|
356
|
+
y.name.length >= 50 && f.addIssue({
|
|
357
|
+
code: "custom",
|
|
358
|
+
message: "Name must be less than 50 characters"
|
|
359
|
+
}), y.name.length < 1 && f.addIssue({
|
|
360
|
+
code: "custom",
|
|
361
|
+
message: "Name is required"
|
|
362
|
+
});
|
|
363
|
+
}), A = G(() => {
|
|
364
|
+
const y = C.safeParse(d.value);
|
|
365
|
+
return y.success ? [] : y.error.errors;
|
|
366
|
+
});
|
|
367
|
+
function T(y, f) {
|
|
368
|
+
var o;
|
|
369
|
+
m.value = y, y && typeof f == "number" && f >= 0 ? (n.value = f, d.value = H(
|
|
370
|
+
(o = c.referralProgram) == null ? void 0 : o.criteria[f]
|
|
371
|
+
)) : (n.value = -1, d.value = {
|
|
372
|
+
_id: new ke().toString(),
|
|
373
|
+
name: "",
|
|
374
|
+
type: "AUTO",
|
|
375
|
+
event: { type: "BILL_COMPLETED" }
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
function M() {
|
|
379
|
+
m.value = !1;
|
|
380
|
+
}
|
|
381
|
+
function j() {
|
|
382
|
+
const y = C.safeParse(d.value);
|
|
383
|
+
y.success && g("update", n.value, y.data);
|
|
384
|
+
}
|
|
385
|
+
function L(y) {
|
|
386
|
+
d.value.type = y, y == "AUTO" ? d.value.event = { type: "BILL_COMPLETED" } : d.value.event = void 0;
|
|
387
|
+
}
|
|
388
|
+
return u({
|
|
389
|
+
showSheet: T,
|
|
390
|
+
hideSheet: M,
|
|
391
|
+
data: d
|
|
392
|
+
}), (y, f) => {
|
|
393
|
+
const o = w("FmButton"), l = w("FmRadio"), S = w("FmRadioGroup"), h = w("FmSideSheet");
|
|
394
|
+
return R(), D(h, {
|
|
395
|
+
"max-width": 768,
|
|
396
|
+
modelValue: t(m),
|
|
397
|
+
"onUpdate:modelValue": f[6] || (f[6] = (e) => W(m) ? m.value = e : null)
|
|
398
|
+
}, {
|
|
399
|
+
"side-sheet-header": V(() => [
|
|
400
|
+
a("div", et, [
|
|
401
|
+
i(o, {
|
|
402
|
+
icon: "arrow_back",
|
|
403
|
+
variant: "tertiary",
|
|
404
|
+
onClick: f[0] || (f[0] = (e) => T(!1))
|
|
405
|
+
}),
|
|
406
|
+
ce("Add Criteria ")
|
|
407
|
+
])
|
|
408
|
+
]),
|
|
409
|
+
"side-sheet-footer": V(() => [
|
|
410
|
+
a("div", ct, [
|
|
411
|
+
i(o, {
|
|
412
|
+
label: t(p)("connect.editTierSheet.submit"),
|
|
413
|
+
onClick: j,
|
|
414
|
+
disabled: t(A).length > 0 || t(J)().isLoading,
|
|
415
|
+
loading: t(J)().isLoading
|
|
416
|
+
}, null, 8, ["label", "disabled", "loading"]),
|
|
417
|
+
i(o, {
|
|
418
|
+
label: t(p)("connect.editTierSheet.cancel"),
|
|
419
|
+
onClick: f[5] || (f[5] = (e) => T(!1)),
|
|
420
|
+
variant: "tertiary"
|
|
421
|
+
}, null, 8, ["label"])
|
|
422
|
+
])
|
|
423
|
+
]),
|
|
424
|
+
default: V(() => [
|
|
425
|
+
i(X, { json: t(d) }, null, 8, ["json"]),
|
|
426
|
+
a("div", tt, [
|
|
427
|
+
rt,
|
|
428
|
+
i(Ce, {
|
|
429
|
+
modelValue: t(d).name,
|
|
430
|
+
"onUpdate:modelValue": f[1] || (f[1] = (e) => t(d).name = e),
|
|
431
|
+
label: t(p)("connect.referral.editReferralTierSheet.name"),
|
|
432
|
+
schema: t(N).typeAtPath(t(C), "name")
|
|
433
|
+
}, null, 8, ["modelValue", "label", "schema"]),
|
|
434
|
+
ot,
|
|
435
|
+
i(S, {
|
|
436
|
+
"model-value": t(d).type,
|
|
437
|
+
label: "Verify status",
|
|
438
|
+
"onUpdate:modelValue": L
|
|
439
|
+
}, {
|
|
440
|
+
default: V(() => [
|
|
441
|
+
i(l, {
|
|
442
|
+
value: "AUTO",
|
|
443
|
+
label: "Auto",
|
|
444
|
+
sublabel: "Verify based on rule configuration"
|
|
445
|
+
}),
|
|
446
|
+
i(l, {
|
|
447
|
+
value: "MANUAL",
|
|
448
|
+
label: "Manual",
|
|
449
|
+
sublabel: "Verify based on manual inspection"
|
|
450
|
+
})
|
|
451
|
+
]),
|
|
452
|
+
_: 1
|
|
453
|
+
}, 8, ["model-value"]),
|
|
454
|
+
t(d).type == "AUTO" ? (R(), B(Y, { key: 0 }, [
|
|
455
|
+
at,
|
|
456
|
+
nt,
|
|
457
|
+
i(Xe, {
|
|
458
|
+
"model-value": t(d).event.type,
|
|
459
|
+
"onUpdate:modelValue": f[2] || (f[2] = (e) => t(d).event.type = e)
|
|
460
|
+
}, null, 8, ["model-value"]),
|
|
461
|
+
t(d).event.type == t(se).enum.BILL_COMPLETED ? (R(), B("div", lt, [
|
|
462
|
+
st,
|
|
463
|
+
i($e, {
|
|
464
|
+
"model-value": t(d).event.rule,
|
|
465
|
+
"onUpdate:modelValue": f[3] || (f[3] = (e) => t(d).event.rule = e)
|
|
466
|
+
}, null, 8, ["model-value"])
|
|
467
|
+
])) : z("", !0),
|
|
468
|
+
t(d).event.type == t(se).enum.FEEDBACK ? (R(), B("div", it, [
|
|
469
|
+
dt,
|
|
470
|
+
i(Fe, {
|
|
471
|
+
"model-value": t(d).event.rule,
|
|
472
|
+
"onUpdate:modelValue": f[4] || (f[4] = (e) => t(d).event.rule = e)
|
|
473
|
+
}, null, 8, ["model-value"])
|
|
474
|
+
])) : z("", !0)
|
|
475
|
+
], 64)) : z("", !0)
|
|
476
|
+
])
|
|
477
|
+
]),
|
|
478
|
+
_: 1
|
|
479
|
+
}, 8, ["modelValue"]);
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
});
|
|
483
|
+
function he() {
|
|
484
|
+
const F = $(!1), u = Re();
|
|
485
|
+
return {
|
|
486
|
+
confirmUpdateReferralRecord: async () => {
|
|
487
|
+
await new Promise((p) => {
|
|
488
|
+
u.open({
|
|
489
|
+
title: "Confirmation",
|
|
490
|
+
message: "This will change all referral settings? Would you like to update previous referral record?",
|
|
491
|
+
primaryActions: { text: "Update all", close: !0 },
|
|
492
|
+
secondaryActions: { text: "Update future only", close: !0 }
|
|
493
|
+
}).onPrimary(async () => {
|
|
494
|
+
F.value = !0, p();
|
|
495
|
+
}).onSecondary(async () => {
|
|
496
|
+
F.value = !1, p();
|
|
497
|
+
});
|
|
498
|
+
});
|
|
499
|
+
},
|
|
500
|
+
updateReferralRecord: F
|
|
501
|
+
};
|
|
502
|
+
}
|
|
503
|
+
const mt = { class: "flex flex-col space-y-16 mt-24" }, ft = { class: "flex justify-between items-center" }, pt = /* @__PURE__ */ a("div", null, [
|
|
504
|
+
/* @__PURE__ */ a("div", { class: "fm-typo-en-title-sm-600" }, "Program Criteria"),
|
|
505
|
+
/* @__PURE__ */ a("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Set participation rules to start your referral program ")
|
|
506
|
+
], -1), ht = /* @__PURE__ */ q({
|
|
507
|
+
__name: "ManageCriteriaSheet",
|
|
508
|
+
setup(F, { expose: u }) {
|
|
509
|
+
const { t: I } = Z(), { minor: p } = ue, { confirmUpdateReferralRecord: g, updateReferralRecord: m } = he(), n = $(!1), d = $({}), c = Q(), C = $(
|
|
510
|
+
null
|
|
511
|
+
), A = G(() => {
|
|
512
|
+
var o;
|
|
513
|
+
return (o = c.referralProgram) == null ? void 0 : o.criteria;
|
|
514
|
+
});
|
|
515
|
+
async function T(o) {
|
|
516
|
+
await g(), await p(async () => {
|
|
517
|
+
await pe.update({
|
|
518
|
+
...o,
|
|
519
|
+
updateReferralRecord: m.value
|
|
520
|
+
}), await c.readReferralProgram();
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
async function M(o, l) {
|
|
524
|
+
var e, r;
|
|
525
|
+
const S = o == -1 ? ((e = c.referralProgram) == null ? void 0 : e.criteria.length) || 0 : o, h = H(c.referralProgram);
|
|
526
|
+
h.criteria[S] = l, await T(h), (r = C.value) == null || r.showSheet(!1);
|
|
527
|
+
}
|
|
528
|
+
async function j(o) {
|
|
529
|
+
var h, e;
|
|
530
|
+
if (!await K.remove(
|
|
531
|
+
"Are you sure to remove criteria",
|
|
532
|
+
"Remove criteria",
|
|
533
|
+
I("connect.prompt.confirm"),
|
|
534
|
+
I("connect.prompt.cancel")
|
|
535
|
+
))
|
|
536
|
+
return;
|
|
537
|
+
const l = o == -1 ? ((h = c.referralProgram) == null ? void 0 : h.criteria.length) || 0 : o, S = H(c.referralProgram);
|
|
538
|
+
S.criteria.splice(l, 1), await T(S), (e = C.value) == null || e.showSheet(!1);
|
|
539
|
+
}
|
|
540
|
+
const L = [
|
|
541
|
+
{
|
|
542
|
+
header: "Criteria title",
|
|
543
|
+
accessorFn: (o) => o.name
|
|
544
|
+
},
|
|
545
|
+
{
|
|
546
|
+
header: "Validity method",
|
|
547
|
+
cell(o) {
|
|
548
|
+
return re(oe.FmChip, {
|
|
549
|
+
label: we.title(o.row.original.type),
|
|
550
|
+
variant: "plain"
|
|
551
|
+
});
|
|
552
|
+
}
|
|
553
|
+
},
|
|
554
|
+
{
|
|
555
|
+
header: "Actions",
|
|
556
|
+
cell(o) {
|
|
557
|
+
return [
|
|
558
|
+
re(oe.FmButton, {
|
|
559
|
+
variant: "tertiary",
|
|
560
|
+
icon: "delete",
|
|
561
|
+
iconColor: "neutral-gray-400",
|
|
562
|
+
onClick: (l) => {
|
|
563
|
+
l.stopPropagation(), j(o.row.index);
|
|
564
|
+
}
|
|
565
|
+
})
|
|
566
|
+
];
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
];
|
|
570
|
+
function y(o) {
|
|
571
|
+
n.value = o;
|
|
572
|
+
}
|
|
573
|
+
function f() {
|
|
574
|
+
n.value = !1;
|
|
575
|
+
}
|
|
576
|
+
return u({
|
|
577
|
+
showSheet: y,
|
|
578
|
+
hideSheet: f,
|
|
579
|
+
data: d
|
|
580
|
+
}), (o, l) => {
|
|
581
|
+
const S = w("FmButton"), h = w("FmTable"), e = w("FmSideSheet");
|
|
582
|
+
return R(), B(Y, null, [
|
|
583
|
+
i(e, {
|
|
584
|
+
"max-width": 768,
|
|
585
|
+
modelValue: t(n),
|
|
586
|
+
"onUpdate:modelValue": l[2] || (l[2] = (r) => W(n) ? n.value = r : null),
|
|
587
|
+
header: "Manage Criteria"
|
|
588
|
+
}, {
|
|
589
|
+
default: V(() => [
|
|
590
|
+
a("div", mt, [
|
|
591
|
+
a("div", ft, [
|
|
592
|
+
pt,
|
|
593
|
+
i(S, {
|
|
594
|
+
label: "Add Criteria",
|
|
595
|
+
icon: "add",
|
|
596
|
+
variant: "secondary",
|
|
597
|
+
onClick: l[0] || (l[0] = (r) => {
|
|
598
|
+
var s;
|
|
599
|
+
return (s = t(C)) == null ? void 0 : s.showSheet(!0);
|
|
600
|
+
})
|
|
601
|
+
})
|
|
602
|
+
]),
|
|
603
|
+
i(h, {
|
|
604
|
+
"row-data": t(A),
|
|
605
|
+
"hide-footer": !0,
|
|
606
|
+
"page-size": 100,
|
|
607
|
+
"shrink-at": !1,
|
|
608
|
+
"column-defs": L,
|
|
609
|
+
onRowClick: l[1] || (l[1] = (r) => {
|
|
610
|
+
var s;
|
|
611
|
+
return (s = t(C)) == null ? void 0 : s.showSheet(!0, r.index);
|
|
612
|
+
})
|
|
613
|
+
}, null, 8, ["row-data"])
|
|
614
|
+
])
|
|
615
|
+
]),
|
|
616
|
+
_: 1
|
|
617
|
+
}, 8, ["modelValue"]),
|
|
618
|
+
i(ut, {
|
|
619
|
+
ref_key: "editCriteriaSheetRef",
|
|
620
|
+
ref: C,
|
|
621
|
+
onUpdate: M
|
|
622
|
+
}, null, 512)
|
|
623
|
+
], 64);
|
|
624
|
+
};
|
|
625
|
+
}
|
|
626
|
+
}), _t = { class: "flex flex-col space-y-16 pr-12" }, vt = { class: "fm-typo-en-title-sm-800" }, gt = { class: "flex items-center gap-8" }, wt = /* @__PURE__ */ q({
|
|
627
|
+
__name: "EditRefereeRewardSheet",
|
|
628
|
+
emits: ["update"],
|
|
629
|
+
setup(F, { expose: u, emit: I }) {
|
|
630
|
+
const { t: p } = Z(), g = I, m = $(!1), n = $([]), d = Q();
|
|
631
|
+
function c() {
|
|
632
|
+
g("update", n.value);
|
|
633
|
+
}
|
|
634
|
+
async function C(o) {
|
|
635
|
+
var l, S;
|
|
636
|
+
m.value = o, n.value = ((S = (l = d.referralProgram) == null ? void 0 : l.refereeReward) == null ? void 0 : S.map((h) => h.toString())) || [], f.value = L.value.map((h) => n.value.includes(h.id));
|
|
637
|
+
}
|
|
638
|
+
function A() {
|
|
639
|
+
m.value = !1;
|
|
640
|
+
}
|
|
641
|
+
const T = [
|
|
642
|
+
{
|
|
643
|
+
header: "Reward title",
|
|
644
|
+
accessorFn: (o) => o.name,
|
|
645
|
+
enableSorting: !0
|
|
646
|
+
},
|
|
647
|
+
{
|
|
648
|
+
id: "type",
|
|
649
|
+
header: "Reward type",
|
|
650
|
+
cell(o) {
|
|
651
|
+
return fe[o.row.original.collectibleConfig.type].chip();
|
|
652
|
+
}
|
|
653
|
+
},
|
|
654
|
+
{
|
|
655
|
+
header: "Description",
|
|
656
|
+
accessorFn: (o) => o.description,
|
|
657
|
+
cell(o) {
|
|
658
|
+
const l = o.row.original;
|
|
659
|
+
if (l.collectible.type == "VOUCHER" || l.selectedReward == null)
|
|
660
|
+
return l.description;
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
], M = me(), j = $([]), L = G(() => M.rewards.map((o) => {
|
|
664
|
+
let l = "No expiry";
|
|
665
|
+
switch (o.option.type) {
|
|
666
|
+
case "VOUCHER":
|
|
667
|
+
l = `${o.option.collectibleConfig.options.maxUse} use(s), ${ee(o.option.collectibleConfig.options.validityOption || {})}`;
|
|
668
|
+
break;
|
|
669
|
+
case "LOYALTY":
|
|
670
|
+
l = `${o.option.earningOption.amount}, ${ee(o.option.validityOption || {})}`;
|
|
671
|
+
break;
|
|
672
|
+
}
|
|
673
|
+
return {
|
|
674
|
+
id: o._id,
|
|
675
|
+
name: o.name,
|
|
676
|
+
collectible: o.option,
|
|
677
|
+
collectibleConfig: o.collectibleConfig,
|
|
678
|
+
description: l
|
|
679
|
+
};
|
|
680
|
+
}));
|
|
681
|
+
G(() => []);
|
|
682
|
+
function y() {
|
|
683
|
+
const o = L.value;
|
|
684
|
+
for (let l = 0; l < o.length; l++) {
|
|
685
|
+
const S = o[l], h = f.value[l];
|
|
686
|
+
h && !n.value.includes(S.id) && n.value.push(S.id), !h && n.value.includes(S.id) && (n.value = n.value.filter((e) => e != S.id));
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
const f = $({});
|
|
690
|
+
return ie(f, y, { deep: !0 }), u({
|
|
691
|
+
showSheet: C,
|
|
692
|
+
hideSheet: A,
|
|
693
|
+
data: n
|
|
694
|
+
}), (o, l) => {
|
|
695
|
+
const S = w("FmTable"), h = w("FmButton"), e = w("FmSideSheet");
|
|
696
|
+
return R(), D(e, {
|
|
697
|
+
"max-width": 1e3,
|
|
698
|
+
modelValue: t(m),
|
|
699
|
+
"onUpdate:modelValue": l[2] || (l[2] = (r) => W(m) ? m.value = r : null),
|
|
700
|
+
header: "Referee reward"
|
|
701
|
+
}, {
|
|
702
|
+
"side-sheet-footer": V(() => [
|
|
703
|
+
a("div", gt, [
|
|
704
|
+
i(h, {
|
|
705
|
+
label: t(p)("connect.common.save"),
|
|
706
|
+
onClick: c,
|
|
707
|
+
disabled: t(J)().isLoading,
|
|
708
|
+
loading: t(J)().isLoading
|
|
709
|
+
}, null, 8, ["label", "disabled", "loading"]),
|
|
710
|
+
i(h, {
|
|
711
|
+
label: t(p)("connect.common.cancel"),
|
|
712
|
+
onClick: l[1] || (l[1] = (r) => A()),
|
|
713
|
+
variant: "tertiary"
|
|
714
|
+
}, null, 8, ["label"])
|
|
715
|
+
])
|
|
716
|
+
]),
|
|
717
|
+
default: V(() => [
|
|
718
|
+
i(X, { json: t(n) }, null, 8, ["json"]),
|
|
719
|
+
a("div", _t, [
|
|
720
|
+
a("div", vt, O(t(p)("connect.referral.refereeRewardSheet.referee_reward")), 1),
|
|
721
|
+
i(S, {
|
|
722
|
+
modelValue: t(f),
|
|
723
|
+
"onUpdate:modelValue": l[0] || (l[0] = (r) => W(f) ? f.value = r : null),
|
|
724
|
+
selection: "multiple",
|
|
725
|
+
"column-filter": t(j),
|
|
726
|
+
"column-defs": T,
|
|
727
|
+
"row-data": t(L),
|
|
728
|
+
"page-size": 10
|
|
729
|
+
}, null, 8, ["modelValue", "column-filter", "row-data"])
|
|
730
|
+
])
|
|
731
|
+
]),
|
|
732
|
+
_: 1
|
|
733
|
+
}, 8, ["modelValue"]);
|
|
734
|
+
};
|
|
735
|
+
}
|
|
736
|
+
}), yt = { class: "fm-typo-en-title-sm-600" }, bt = { class: "grid grid-cols-4 xs:grid-cols-1 gap-4 divide-x xs:divide-x-0" }, xt = { class: "flex gap-x-8" }, Rt = { class: "fm-typo-body-lg-600 flex items-center gap-x-4" }, Ct = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, St = { class: "mb-40" }, $t = {
|
|
737
|
+
key: 0,
|
|
738
|
+
class: "flex flex-col items-center justify-center gap-y-16 p-24"
|
|
739
|
+
}, Ft = /* @__PURE__ */ a("div", { class: "flex flex-col gap-16 text-center" }, [
|
|
740
|
+
/* @__PURE__ */ a("div", { class: "fm-typo-en-title-sm-800" }, "Create progressive reward"),
|
|
741
|
+
/* @__PURE__ */ 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 ")
|
|
742
|
+
], -1), kt = /* @__PURE__ */ a("img", {
|
|
743
|
+
src: ge,
|
|
744
|
+
class: "aspect-square w-[150px]"
|
|
745
|
+
}, null, -1), Pt = { class: "flex flex-col gap-16 text-center" }, Vt = { class: "fm-typo-en-title-sm-800" }, It = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, rr = /* @__PURE__ */ q({
|
|
746
|
+
__name: "Overview",
|
|
747
|
+
setup(F) {
|
|
748
|
+
const { t: u } = Z(), { minor: I } = ue, p = Pe(), g = Q(), { confirmUpdateReferralRecord: m, updateReferralRecord: n } = he(), d = G(() => {
|
|
749
|
+
var e;
|
|
750
|
+
return ((e = g.referralProgram) == null ? void 0 : e.reward) ?? [];
|
|
751
|
+
}), c = $(null);
|
|
752
|
+
$(null);
|
|
753
|
+
const C = $(null), A = $(null), T = $(null), M = G(() => {
|
|
754
|
+
var e, r, s, v;
|
|
755
|
+
return [
|
|
756
|
+
{
|
|
757
|
+
label: "connect.referral.how_it_works.generate_link",
|
|
758
|
+
sublabel: u("connect.referral.how_it_works.generate_link_for_member"),
|
|
759
|
+
icon: "offline_share"
|
|
760
|
+
},
|
|
761
|
+
{
|
|
762
|
+
label: "connect.referral.how_it_works.referee_join_reward",
|
|
763
|
+
sublabel: `${((r = (e = g.referralProgram) == null ? void 0 : e.pf_refereeReward) == null ? void 0 : r.length) || 0} reward(s)`,
|
|
764
|
+
action: u("connect.referral.actions.manage_reward"),
|
|
765
|
+
onClick: () => {
|
|
766
|
+
var b;
|
|
767
|
+
return (b = T.value) == null ? void 0 : b.showSheet(!0);
|
|
768
|
+
},
|
|
769
|
+
helperText: "Referee will receive rewards after successfully competing all criteria",
|
|
770
|
+
icon: "group_add"
|
|
771
|
+
},
|
|
772
|
+
{
|
|
773
|
+
label: "connect.referral.how_it_works.referee_meet_criteria",
|
|
774
|
+
sublabel: `${(s = g.referralProgram) == null ? void 0 : s.criteria.length} criteria`,
|
|
775
|
+
action: u("connect.referral.actions.manage_criteria"),
|
|
776
|
+
onClick: () => {
|
|
777
|
+
var b;
|
|
778
|
+
return (b = A.value) == null ? void 0 : b.showSheet(!0);
|
|
779
|
+
},
|
|
780
|
+
icon: "checklist_rtl"
|
|
781
|
+
},
|
|
782
|
+
{
|
|
783
|
+
label: "connect.referral.how_it_works.referer_get_reward",
|
|
784
|
+
sublabel: `${(v = g.referralProgram) == null ? void 0 : v.reward.length} configured tier(s)`,
|
|
785
|
+
helperText: "Referer will receive rewards after referee completed all criteria",
|
|
786
|
+
icon: "featured_seasonal_and_gifts"
|
|
787
|
+
}
|
|
788
|
+
];
|
|
789
|
+
});
|
|
790
|
+
function j(e) {
|
|
791
|
+
var r;
|
|
792
|
+
(r = c.value) == null || r.onManageRewardGroup(e);
|
|
793
|
+
}
|
|
794
|
+
function L(e) {
|
|
795
|
+
var r;
|
|
796
|
+
(r = C.value) == null || r.showSheet(!0, {
|
|
797
|
+
groupIndex: e.groupIndex,
|
|
798
|
+
countIndex: e.countIndex
|
|
799
|
+
});
|
|
800
|
+
}
|
|
801
|
+
async function y(e) {
|
|
802
|
+
var P, x, _, E;
|
|
803
|
+
const r = e.countIndex == -1 ? ((x = (P = g.referralProgram) == null ? void 0 : P.reward[e.groupIndex]) == null ? void 0 : x.rewards.length) || 0 : e.countIndex || 0, s = e.referralCount, v = H(
|
|
804
|
+
g.referralProgram
|
|
805
|
+
), b = v.reward[e.groupIndex];
|
|
806
|
+
b.rewards[r] = e.referralCount;
|
|
807
|
+
const k = b.rewards[r - 1], U = b.rewards[r + 1];
|
|
808
|
+
if (k && k.threshold.to != s.threshold.from - 1) {
|
|
809
|
+
if (!await K.confirm(
|
|
810
|
+
u(
|
|
811
|
+
"connect.referral.referral_count.update.range_discontinuous.previous",
|
|
812
|
+
{
|
|
813
|
+
name: k.threshold.from,
|
|
814
|
+
from: k.threshold.from ?? 0,
|
|
815
|
+
to: k.threshold.to ?? 1 / 0,
|
|
816
|
+
newTo: s.threshold.from - 1
|
|
817
|
+
}
|
|
818
|
+
),
|
|
819
|
+
u("connect.referral.referral_count.title"),
|
|
820
|
+
u("connect.referral.referral_count.remove.next_range")
|
|
821
|
+
))
|
|
822
|
+
return;
|
|
823
|
+
k.threshold.to = s.threshold.from - 1;
|
|
824
|
+
}
|
|
825
|
+
if (U && U.threshold.from - 1 != s.threshold.to) {
|
|
826
|
+
if (!await K.confirm(
|
|
827
|
+
u("connect.program.tier.update.range_discontinuous.next", {
|
|
828
|
+
name: U.threshold.from,
|
|
829
|
+
from: U.threshold.from ?? 0,
|
|
830
|
+
to: U.threshold.to ?? 1 / 0,
|
|
831
|
+
newFrom: s.threshold.to ?? 1
|
|
832
|
+
}),
|
|
833
|
+
u("connect.program.tier.title"),
|
|
834
|
+
u("connect.program.tier.remove.next_range"),
|
|
835
|
+
u("connect.prompt.cancel")
|
|
836
|
+
))
|
|
837
|
+
return;
|
|
838
|
+
U.threshold.from = (s.threshold.to ?? 0) + 1;
|
|
839
|
+
}
|
|
840
|
+
!U && !((_ = s.threshold) != null && _.to) && (s.threshold.to = void 0), await o(v), (E = C.value) == null || E.hideSheet();
|
|
841
|
+
}
|
|
842
|
+
async function f(e) {
|
|
843
|
+
var s;
|
|
844
|
+
const r = H(g.referralProgram);
|
|
845
|
+
r.refereeReward = e, await o(r), (s = T.value) == null || s.hideSheet();
|
|
846
|
+
}
|
|
847
|
+
async function o(e) {
|
|
848
|
+
await m(), await I(
|
|
849
|
+
async () => {
|
|
850
|
+
await pe.update({
|
|
851
|
+
...e,
|
|
852
|
+
updateReferralRecord: n.value
|
|
853
|
+
}), await g.readReferralProgram();
|
|
854
|
+
},
|
|
855
|
+
{
|
|
856
|
+
message: "Updating referral program",
|
|
857
|
+
successMessage: "Referral program updated successfully"
|
|
858
|
+
}
|
|
859
|
+
);
|
|
860
|
+
}
|
|
861
|
+
async function l(e) {
|
|
862
|
+
if (!await K.remove(
|
|
863
|
+
"Are you sure to remove referral tier",
|
|
864
|
+
"Remove referral tier",
|
|
865
|
+
u("connect.prompt.confirm"),
|
|
866
|
+
u("connect.prompt.cancel")
|
|
867
|
+
))
|
|
868
|
+
return;
|
|
869
|
+
const r = H(g.referralProgram);
|
|
870
|
+
r.reward.splice(e, 1), await o(r);
|
|
871
|
+
}
|
|
872
|
+
async function S(e, r) {
|
|
873
|
+
if (!await K.remove(
|
|
874
|
+
"Are you sure to remove referral count",
|
|
875
|
+
"Remove referral tier",
|
|
876
|
+
u("connect.prompt.confirm"),
|
|
877
|
+
u("connect.prompt.cancel")
|
|
878
|
+
))
|
|
879
|
+
return;
|
|
880
|
+
const s = H(g.referralProgram), v = s.reward[e].rewards[r + 1];
|
|
881
|
+
if (v) {
|
|
882
|
+
if (!await K.confirm(
|
|
883
|
+
u("connect.referral.referral_count.update.range_discontinuous.next", {
|
|
884
|
+
from: v.threshold.from ?? 0,
|
|
885
|
+
to: v.threshold.to ?? 1 / 0,
|
|
886
|
+
newFrom: s.reward[e].rewards[r].threshold.from
|
|
887
|
+
}),
|
|
888
|
+
u("connect.referral.referral_count.remove.title"),
|
|
889
|
+
u("connect.referral.referral_count.remove.next_range"),
|
|
890
|
+
u("connect.prompt.cancel")
|
|
891
|
+
))
|
|
892
|
+
return;
|
|
893
|
+
v.threshold.from = s.reward[e].rewards[r].threshold.from;
|
|
894
|
+
}
|
|
895
|
+
s.reward[e].rewards.splice(r, 1), await o(s);
|
|
896
|
+
}
|
|
897
|
+
const h = [
|
|
898
|
+
{
|
|
899
|
+
header: "Referral Count",
|
|
900
|
+
accessorFn: (e) => e.threshold.from == e.threshold.to ? `${e.threshold.from}` : e.threshold.to ? `${e.threshold.from} - ${e.threshold.to ?? "∞"}` : `${e.threshold.from}+`
|
|
901
|
+
},
|
|
902
|
+
{
|
|
903
|
+
header: "Rewards",
|
|
904
|
+
accessorKey: "type",
|
|
905
|
+
accessorFn: (e) => {
|
|
906
|
+
var r;
|
|
907
|
+
return `${((r = e.pf_reward) == null ? void 0 : r.length) || 0} reward(s)`;
|
|
908
|
+
}
|
|
909
|
+
},
|
|
910
|
+
{
|
|
911
|
+
id: "actions",
|
|
912
|
+
meta: {
|
|
913
|
+
textAlign: "right"
|
|
914
|
+
},
|
|
915
|
+
cell(e) {
|
|
916
|
+
return re(oe.FmButton, {
|
|
917
|
+
variant: "tertiary",
|
|
918
|
+
icon: "delete",
|
|
919
|
+
iconColor: "neutral-gray-400",
|
|
920
|
+
class: "ml-auto",
|
|
921
|
+
onClick: (r) => {
|
|
922
|
+
r.stopPropagation(), console.log(e.row), S(e.row.original.groupIndex, e.row.index);
|
|
923
|
+
}
|
|
924
|
+
});
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
];
|
|
928
|
+
return ve(async () => {
|
|
929
|
+
await g.readReferralProgram();
|
|
930
|
+
}), (e, r) => {
|
|
931
|
+
const s = w("FmCard"), v = w("FmIcon"), b = w("FmTooltip"), k = w("FmButton"), U = w("FmTable"), P = w("FmList");
|
|
932
|
+
return R(), B(Y, null, [
|
|
933
|
+
z("", !0),
|
|
934
|
+
i(s, {
|
|
935
|
+
variant: "outlined",
|
|
936
|
+
class: "flex flex-col gap-16 p-16"
|
|
937
|
+
}, {
|
|
938
|
+
default: V(() => [
|
|
939
|
+
a("div", yt, O(t(u)("connect.referral.how_it_works.title")), 1),
|
|
940
|
+
a("div", bt, [
|
|
941
|
+
(R(!0), B(Y, null, te(t(M), (x, _) => (R(), B("div", {
|
|
942
|
+
key: _,
|
|
943
|
+
class: de(["px-8", { "xs:!border-r": _ % 2 == 0 }])
|
|
944
|
+
}, [
|
|
945
|
+
a("div", xt, [
|
|
946
|
+
i(v, {
|
|
947
|
+
name: x.icon,
|
|
948
|
+
color: "primary",
|
|
949
|
+
class: "bg-fm-color-system-warning-100 p-8 fm-corner-radius-md max-h-40 max-w-40"
|
|
950
|
+
}, null, 8, ["name"]),
|
|
951
|
+
a("div", null, [
|
|
952
|
+
a("div", Rt, [
|
|
953
|
+
ce(O(t(u)(x.label)) + " ", 1),
|
|
954
|
+
x.helperText ? (R(), D(b, {
|
|
955
|
+
key: 0,
|
|
956
|
+
content: x.helperText
|
|
957
|
+
}, {
|
|
958
|
+
default: V(() => [
|
|
959
|
+
i(v, {
|
|
960
|
+
name: "help",
|
|
961
|
+
size: "sm",
|
|
962
|
+
outline: !0
|
|
963
|
+
})
|
|
964
|
+
]),
|
|
965
|
+
_: 2
|
|
966
|
+
}, 1032, ["content"])) : z("", !0)
|
|
967
|
+
]),
|
|
968
|
+
a("div", Ct, O(x.sublabel), 1),
|
|
969
|
+
x.action ? (R(), D(k, {
|
|
970
|
+
key: 0,
|
|
971
|
+
variant: "plain",
|
|
972
|
+
label: x.action,
|
|
973
|
+
disabled: !t(p).isPremium,
|
|
974
|
+
class: "fm-typo-en-body-md-400 !p-0",
|
|
975
|
+
onClick: x.onClick
|
|
976
|
+
}, null, 8, ["label", "disabled", "onClick"])) : z("", !0)
|
|
977
|
+
])
|
|
978
|
+
])
|
|
979
|
+
], 2))), 128))
|
|
980
|
+
])
|
|
981
|
+
]),
|
|
982
|
+
_: 1
|
|
983
|
+
}),
|
|
984
|
+
t(d) && t(d).length > 0 ? (R(), D(s, {
|
|
985
|
+
key: 1,
|
|
986
|
+
variant: "outlined",
|
|
987
|
+
class: "flex flex-col gap-16 p-16"
|
|
988
|
+
}, {
|
|
989
|
+
default: V(() => [
|
|
990
|
+
i(P, { separator: !0 }, {
|
|
991
|
+
default: V(() => [
|
|
992
|
+
(R(!0), B(Y, null, te(t(d), (x, _) => (R(), D(Ge, {
|
|
993
|
+
key: _,
|
|
994
|
+
"reward-group": x,
|
|
995
|
+
level: _,
|
|
996
|
+
onEdit: (E) => j(_),
|
|
997
|
+
onRemove: (E) => l(_),
|
|
998
|
+
onAddCount: r[0] || (r[0] = (E) => {
|
|
999
|
+
L({ groupIndex: E, countIndex: -1 });
|
|
1000
|
+
})
|
|
1001
|
+
}, {
|
|
1002
|
+
default: V(() => [
|
|
1003
|
+
a("div", St, [
|
|
1004
|
+
i(U, {
|
|
1005
|
+
"row-data": x.rewards.map((E) => ({ ...E, groupIndex: _ })),
|
|
1006
|
+
"column-defs": h,
|
|
1007
|
+
"hide-footer": !0,
|
|
1008
|
+
"page-size": 50,
|
|
1009
|
+
onRowClick: (E) => L({ groupIndex: _, countIndex: E.index })
|
|
1010
|
+
}, null, 8, ["row-data", "onRowClick"])
|
|
1011
|
+
]),
|
|
1012
|
+
x.rewards.length ? z("", !0) : (R(), B("div", $t, [
|
|
1013
|
+
Ft,
|
|
1014
|
+
i(k, {
|
|
1015
|
+
variant: "secondary",
|
|
1016
|
+
label: "Add count",
|
|
1017
|
+
icon: "add",
|
|
1018
|
+
onClick: (E) => L({ groupIndex: _, countIndex: -1 })
|
|
1019
|
+
}, null, 8, ["onClick"])
|
|
1020
|
+
]))
|
|
1021
|
+
]),
|
|
1022
|
+
_: 2
|
|
1023
|
+
}, 1032, ["reward-group", "level", "onEdit", "onRemove"]))), 128))
|
|
1024
|
+
]),
|
|
1025
|
+
_: 1
|
|
1026
|
+
})
|
|
1027
|
+
]),
|
|
1028
|
+
_: 1
|
|
1029
|
+
})) : (R(), D(s, {
|
|
1030
|
+
key: 2,
|
|
1031
|
+
variant: "outlined",
|
|
1032
|
+
class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
|
|
1033
|
+
}, {
|
|
1034
|
+
default: V(() => [
|
|
1035
|
+
kt,
|
|
1036
|
+
a("div", Pt, [
|
|
1037
|
+
a("div", Vt, O(t(u)("connect.referral.referral_tier_title")), 1),
|
|
1038
|
+
a("div", It, O(t(u)("connect.referral.referral_tier_description")), 1)
|
|
1039
|
+
]),
|
|
1040
|
+
i(k, {
|
|
1041
|
+
variant: "primary",
|
|
1042
|
+
label: t(u)("connect.referral.add_referral_tier"),
|
|
1043
|
+
icon: "add",
|
|
1044
|
+
disabled: !t(p).isPremium,
|
|
1045
|
+
onClick: r[1] || (r[1] = (x) => j(-1))
|
|
1046
|
+
}, null, 8, ["label", "disabled"])
|
|
1047
|
+
]),
|
|
1048
|
+
_: 1
|
|
1049
|
+
})),
|
|
1050
|
+
i(ye, {
|
|
1051
|
+
ref_key: "rewardGroupRef",
|
|
1052
|
+
ref: c
|
|
1053
|
+
}, null, 512),
|
|
1054
|
+
i(qe, {
|
|
1055
|
+
ref_key: "editReferralCountSheetRef",
|
|
1056
|
+
ref: C,
|
|
1057
|
+
onUpdate: y
|
|
1058
|
+
}, null, 512),
|
|
1059
|
+
i(ht, {
|
|
1060
|
+
ref_key: "manageCriteriaSheetRef",
|
|
1061
|
+
ref: A
|
|
1062
|
+
}, null, 512),
|
|
1063
|
+
i(wt, {
|
|
1064
|
+
ref_key: "editRefereeRewardSheetRef",
|
|
1065
|
+
ref: T,
|
|
1066
|
+
onUpdate: f
|
|
1067
|
+
}, null, 512)
|
|
1068
|
+
], 64);
|
|
1069
|
+
};
|
|
1070
|
+
}
|
|
1071
|
+
});
|
|
1072
|
+
export {
|
|
1073
|
+
rr as default
|
|
1074
|
+
};
|