@feedmepos/mf-connect 0.1.0-beta.33 → 0.1.0-beta.35

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.
Files changed (83) hide show
  1. package/dist/{Analytic-COFvmYc_.js → Analytic-BMdB7x5F.js} +24 -23
  2. package/dist/{App-Di7kbEH7.js → App-AakWqQHx.js} +6 -6
  3. package/dist/{Broadcast-CAku3lNW.js → Broadcast-Bf5GOV7p.js} +8 -8
  4. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-B1Ozu6-2.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BBTBapxi.js} +7 -7
  5. package/dist/{Card-CcRmp6aK.js → Card-DmxekNts.js} +15 -15
  6. package/dist/{Collections-BRLR37TF.js → Collections-CL7hOycU.js} +4 -4
  7. package/dist/{Credit-BEViCbtH.js → Credit-0eGxacBN.js} +8 -8
  8. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-DDSSHrcX.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-BLWeJ73S.js} +27 -26
  9. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-CGBjH5AK.js → EffectSheet.vue_vue_type_style_index_0_lang-q7qJ9Ec5.js} +6 -6
  10. package/dist/{Experience-BL71InUh.js → Experience-NjmDx3_p.js} +8 -8
  11. package/dist/{Game-vmhBTg3f.js → Game-q19qmf8t.js} +8 -8
  12. package/dist/{Index-DGkT3yms.js → Index-BmzHphDm.js} +9 -9
  13. package/dist/{Marketing-BCqFnOrR.js → Marketing-BgL2CqkH.js} +5 -5
  14. package/dist/{Member-C7uOPBUa.js → Member-DXO7yer0.js} +4 -4
  15. package/dist/{MemberList-CaY2SRSx.js → MemberList-WGMopz-y.js} +14 -14
  16. package/dist/{MemberTransactions-v2sui0Sy.js → MemberTransactions-DmQgrLdy.js} +1 -1
  17. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-za7Jz9uG.js → MessageInput.vue_vue_type_script_setup_true_lang-DFiCQcTe.js} +2 -2
  18. package/dist/{Mission-DZG8d3vM.js → Mission-DOdkoytR.js} +8 -8
  19. package/dist/Overview-Bizp0BGu.js +1064 -0
  20. package/dist/{Point-DW_SHWMs.js → Point-Bvyg1zuh.js} +8 -8
  21. package/dist/{Promotion-C8tygVa7.js → Promotion-B75LcnHm.js} +9 -9
  22. package/dist/{Record-D7XgEVn_.js → Record-BjAbPbiI.js} +5 -5
  23. package/dist/Reward-l1gt8pwu.js +432 -0
  24. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-Dyj14jcj.js → RewardGroup.vue_vue_type_script_setup_true_lang-C76emk8A.js} +11 -11
  25. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-Cmv-8YZd.js → RuleGroup.vue_vue_type_script_setup_true_lang-B4ak1Gem.js} +13 -13
  26. package/dist/{Segment-DAYnubHq.js → Segment-DJSkWWH8.js} +13 -13
  27. package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-BviSuL4I.js → SelectItems.vue_vue_type_script_setup_true_lang-ByqgSxPo.js} +2 -2
  28. package/dist/{Setting-Dd-PlldV.js → Setting-DTV24iE5.js} +8 -8
  29. package/dist/{Store-DmBeTkdi.js → Store-C1obQwdr.js} +46 -46
  30. package/dist/{StoreRewards-VrmRII1r.js → StoreRewards-apMVv0Ca.js} +12 -12
  31. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-Bx1AwHhj.js → StoreTransactions.vue_vue_type_script_setup_true_lang-DBzA_4gb.js} +17 -17
  32. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-DanZYVUH.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-PxZ5Au5X.js} +1 -1
  33. package/dist/{Tier-h5t-OofQ.js → Tier-DSvMUZJG.js} +19 -19
  34. package/dist/{Title-BIGAZzv4.js → Title-CWoqOkd2.js} +19 -19
  35. package/dist/{Transaction-WfW0gCVl.js → Transaction-CaCsXoB5.js} +2 -2
  36. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-KB8LAOv_.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-DaT8PyWl.js} +6 -6
  37. package/dist/{Voucher-CzA0AnCo.js → Voucher-BBtDXr9q.js} +11 -11
  38. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-BbYPy9pR.js → VoucherEditor.vue_vue_type_script_setup_true_lang-BCSO2-oB.js} +10 -10
  39. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-BPHAIlP5.js → ZodTextField.vue_vue_type_script_setup_true_lang-BTm3pDid.js} +1 -1
  40. package/dist/{app-C2GiWW62.js → app-B8JBXu5M.js} +212 -186
  41. package/dist/{app-BhP-DVoF.js → app-D8kcy7_R.js} +1 -1
  42. package/dist/app.js +1 -1
  43. package/dist/{business-BjQMXRkL.js → business-DN4-BTel.js} +1 -1
  44. package/dist/{campaign-tqh1zOQn.js → campaign-Cf6jJz3e.js} +2 -2
  45. package/dist/campaign.enum-DVOwgVTa.js +20 -0
  46. package/dist/campaign.fn-D8apF_YE.js +758 -0
  47. package/dist/{collectible.enum-904x3SQw.js → collectible.enum-DPsEC03C.js} +1 -1
  48. package/dist/{collection.fn-B1wW3tQk.js → collection.fn-CzeGWVx2.js} +2 -2
  49. package/dist/dto-D94IgAXy.js +2018 -0
  50. package/dist/{effect-DlIXzIWd.js → effect-CDg44P_g.js} +1 -1
  51. package/dist/{email-addresses-bquAp7UR.js → email-addresses-CDozpvzz.js} +1 -1
  52. package/dist/{export-9ZU9HjO9.js → export-DQLXrn4F.js} +3 -3
  53. package/dist/{helper-D0S39he1.js → helper-DJMf--V-.js} +1 -1
  54. package/dist/{index-DN5WVCu6.js → index-B0n_PU3b.js} +1 -1
  55. package/dist/{index-BoJwjzpx.js → index-BUZR5Bkw.js} +1 -1
  56. package/dist/{index-kkystjJw.js → index-BbPavTej.js} +3 -3
  57. package/dist/{index-D4QKa9x3.js → index-BgXfVzZF.js} +7 -7
  58. package/dist/{index-l_74COL_.js → index-BmblCnlD.js} +1 -1
  59. package/dist/{index-DF3fzy-k.js → index-BnbkejyF.js} +1 -1
  60. package/dist/{index-Dszb1Xy-.js → index-CVV5I3bh.js} +1 -1
  61. package/dist/{index-B6SrZyMF.js → index-DFbITElv.js} +214 -228
  62. package/dist/{index-DTsmbmOR.js → index-Df84_Ww3.js} +3 -3
  63. package/dist/{index-DNa1m2cM.js → index-DrvefOT4.js} +3 -3
  64. package/dist/{index-DnGzf-f8.js → index-DvE5xL4s.js} +2 -2
  65. package/dist/{index-BwDwKkyV.js → index-V6yWwXYr.js} +1 -1
  66. package/dist/{index.esm2017-CNuwLU2a.js → index.esm2017-C90-ettH.js} +1 -1
  67. package/dist/{loading-CiI8Y9Fj.js → loading-B56wz_ef.js} +4 -4
  68. package/dist/{membership-CPNrhOk0.js → membership-CF1jgR11.js} +4 -4
  69. package/dist/{money-DnAxVjb7.js → money-BEEp2WdU.js} +1 -1
  70. package/dist/{number-B5VKL1Yu.js → number-u7HbwLPt.js} +1 -1
  71. package/dist/{objectid-C-IOC4JL.js → objectid-S3_nH1F7.js} +10 -10
  72. package/dist/{reward-D4RyiYb6.js → reward-BUY77BiP.js} +1 -1
  73. package/dist/{rule-DVMHVRWb.js → rule-BdAPBN8_.js} +3 -3
  74. package/dist/{rule-builder-CFUNraRE.js → rule-builder-z51VUtHk.js} +1 -1
  75. package/dist/{template-OBoSoTcO.js → template-B_J4Q9D6.js} +4 -4
  76. package/dist/{trigger-R6mF8LNa.js → trigger-CGrv0M0q.js} +4 -4
  77. package/dist/{user-BGP1BTAw.js → user-D02jOhtd.js} +1 -1
  78. package/dist/{vue-i18n-_ooGZZRG.js → vue-i18n-rCSjqg2P.js} +333 -333
  79. package/dist/{xlsx-ByJGlrKD.js → xlsx-CL102mzm.js} +1 -1
  80. package/package.json +1 -1
  81. package/dist/Overview-egVspSvq.js +0 -1023
  82. package/dist/Reward-DqP89Pqb.js +0 -413
  83. package/dist/dto-C9SOa-xs.js +0 -2770
@@ -0,0 +1,1064 @@
1
+ import { defineComponent as Y, resolveComponent as _, openBlock as S, createElementBlock as E, Fragment as z, createVNode as d, withCtx as V, createElementVNode as a, toDisplayString as O, unref as t, renderSlot as he, ref as F, computed as G, watch as se, createBlock as j, isRef as J, resolveDynamicComponent as ne, renderList as re, normalizeClass as ie, createTextVNode as de, createCommentVNode as W, h as te, onMounted as ve } from "vue";
2
+ import { _ as ge } from "./campaign-CpzFl8Vr.js";
3
+ import { u as Z } from "./vue-i18n-rCSjqg2P.js";
4
+ import { c as we, p as q, u as ce } from "./loading-B56wz_ef.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 K } from "./app-wDQR6dpb.js";
8
+ import { u as Q, _ as _e } from "./RewardGroup.vue_vue_type_script_setup_true_lang-C76emk8A.js";
9
+ import { u as ue } from "./reward-BUY77BiP.js";
10
+ import "./index-Df84_Ww3.js";
11
+ import "./index-DvE5xL4s.js";
12
+ import { j as le, k as ye } from "./index-DFbITElv.js";
13
+ import { a as be, b as xe } from "./index-BgXfVzZF.js";
14
+ import "./index-B0n_PU3b.js";
15
+ import "./index-BbPavTej.js";
16
+ import { C as me } from "./membership-CF1jgR11.js";
17
+ import { t as ee } from "./helper-DJMf--V-.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-BTm3pDid.js";
21
+ import { a as Se, _ as Fe } from "./trigger-CGrv0M0q.js";
22
+ import { O as ke } from "./objectid-S3_nH1F7.js";
23
+ import { r as fe } from "./index-BmblCnlD.js";
24
+ import { u as $e } from "./business-DN4-BTel.js";
25
+ const Pe = { class: "flex items-center justify-between flex-1 xs:hidden" }, Ve = { class: "flex items-center gap-x-24 h-[80px] p-8 flex-1" }, Ie = { class: "flex-1" }, Te = { class: "flex items-center gap-8" }, Ue = { class: "fm-typo-en-title-sm-800" }, Ae = { class: "flex gap-8 items-center" }, Le = { 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" }, Ee = { class: "flex items-center gap-x-24 h-[80px] p-8 flex-1" }, Oe = { class: "flex-1 space-y-4" }, je = { class: "fm-typo-en-body-lg-600" }, De = /* @__PURE__ */ Y({
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: m }) {
39
+ const { t: I } = Z(), p = m;
40
+ return (w, f) => {
41
+ const n = _("FmButton"), c = _("FmListItem");
42
+ return S(), E(z, null, [
43
+ d(c, {
44
+ onClick: f[4] || (f[4] = (u) => p("edit", k.level)),
45
+ class: "!p-0"
46
+ }, {
47
+ default: V(() => [
48
+ a("div", Pe, [
49
+ a("div", Ve, [
50
+ a("div", Ie, [
51
+ a("div", Te, [
52
+ a("div", Ue, O(k.rewardGroup.name), 1)
53
+ ])
54
+ ])
55
+ ]),
56
+ a("div", Ae, [
57
+ d(n, {
58
+ variant: "secondary",
59
+ label: t(I)("connect.referral.reward.add_count"),
60
+ icon: "add",
61
+ onClick: f[0] || (f[0] = (u) => {
62
+ u.stopPropagation(), p("addCount", k.level);
63
+ })
64
+ }, null, 8, ["label"]),
65
+ d(n, {
66
+ icon: "delete",
67
+ onClick: f[1] || (f[1] = (u) => {
68
+ u.stopPropagation(), p("remove", k.level);
69
+ }),
70
+ variant: "tertiary"
71
+ })
72
+ ])
73
+ ]),
74
+ a("div", Le, [
75
+ a("div", Be, [
76
+ a("div", Ee, [
77
+ a("div", Oe, [
78
+ a("div", null, [
79
+ a("div", je, O(k.rewardGroup.name), 1)
80
+ ])
81
+ ])
82
+ ]),
83
+ d(n, {
84
+ variant: "tertiary",
85
+ icon: "delete",
86
+ onClick: f[2] || (f[2] = (u) => (u.stopPropagation(), p("remove", k.level)))
87
+ })
88
+ ]),
89
+ d(n, {
90
+ class: "w-full",
91
+ variant: "secondary",
92
+ label: "Add count",
93
+ disabled: !0,
94
+ icon: "add",
95
+ onClick: f[3] || (f[3] = (u) => (u.stopPropagation(), p("addCount", k.level)))
96
+ })
97
+ ])
98
+ ]),
99
+ _: 1
100
+ }),
101
+ he(w.$slots, "default")
102
+ ], 64);
103
+ };
104
+ }
105
+ }), Ge = { class: "flex flex-col space-y-16 pr-12" }, Me = { class: "flex gap-16 items-center" }, Ne = { class: "fm-typo-en-title-sm-800" }, He = { class: "flex items-center gap-8" }, ze = /* @__PURE__ */ Y({
106
+ __name: "EditReferralCountSheet",
107
+ emits: ["update"],
108
+ setup(k, { expose: m, emit: I }) {
109
+ const { t: p } = Z(), w = I, f = F(!1), n = F({}), c = F(-1), u = F(-1), R = Q(), A = be.superRefine((e, r) => {
110
+ var $, U, P, x, v, B, ae;
111
+ const i = u.value == -1 ? ((P = (U = ($ = R.referralProgram) == null ? void 0 : $.reward[c.value]) == null ? void 0 : U.rewards) == null ? void 0 : P.length) || 0 : u.value, g = (v = (x = R.referralProgram) == null ? void 0 : x.reward[c.value]) == null ? void 0 : v.rewards[i - 1], b = (ae = (B = R.referralProgram) == null ? void 0 : B.reward[c.value]) == null ? void 0 : ae.rewards[i + 1];
112
+ g && e.threshold.from < g.threshold.from + 1 && r.addIssue({
113
+ code: "custom",
114
+ message: `The min referral must be at least ${g.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 && w("update", {
128
+ groupIndex: c.value,
129
+ countIndex: u.value,
130
+ referralCount: e.data
131
+ });
132
+ }
133
+ async function D(e, r) {
134
+ var i, g, b, $, U, P;
135
+ if (f.value = e, e && typeof (r == null ? void 0 : r.countIndex) == "number" && r.countIndex >= 0)
136
+ c.value = r.groupIndex, u.value = r.countIndex, n.value = H(
137
+ (i = R.referralProgram) == null ? void 0 : i.reward[r.groupIndex].rewards[r.countIndex]
138
+ );
139
+ else {
140
+ c.value = r.groupIndex, u.value = -1;
141
+ const x = u.value == -1 ? (($ = (b = (g = R.referralProgram) == null ? void 0 : g.reward[c.value]) == null ? void 0 : b.rewards) == null ? void 0 : $.length) || 0 : u.value, v = (P = (U = R.referralProgram) == null ? void 0 : U.reward[c.value]) == null ? void 0 : P.rewards[x - 1];
142
+ n.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 = l.value.map(
151
+ (x) => n.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 me[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
+ ], s = ue(), o = F([]), l = G(() => s.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 C() {
199
+ const e = l.value;
200
+ for (let r = 0; r < e.length; r++) {
201
+ const i = e[r], g = h.value[r];
202
+ g && !n.value.rewards.includes(i.id) && n.value.rewards.push(i.id), !g && n.value.rewards.includes(i.id) && (n.value.rewards = n.value.rewards.filter(
203
+ (b) => b != i.id
204
+ ));
205
+ }
206
+ }
207
+ const h = F({});
208
+ return se(h, C, { deep: !0 }), m({
209
+ showSheet: D,
210
+ hideSheet: L,
211
+ data: n
212
+ }), (e, r) => {
213
+ const i = _("FmStepperField"), g = _("FmHelperText"), b = _("FmTable"), $ = _("FmButton"), U = _("FmSideSheet");
214
+ return S(), j(U, {
215
+ "max-width": 1e3,
216
+ modelValue: t(f),
217
+ "onUpdate:modelValue": r[4] || (r[4] = (P) => J(f) ? f.value = P : null),
218
+ header: `${t(u) == -1 ? t(p)("connect.referral.editReferralCountSheet.add") : t(p)("connect.referral.editReferralCountSheet.edit")}`
219
+ }, {
220
+ "side-sheet-footer": V(() => [
221
+ a("div", He, [
222
+ d($, {
223
+ label: t(p)("connect.editTierSheet.submit"),
224
+ onClick: M,
225
+ disabled: t(T).length > 0 || t(K)().isLoading,
226
+ loading: t(K)().isLoading
227
+ }, null, 8, ["label", "disabled", "loading"]),
228
+ d($, {
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
+ d(X, { json: t(n) }, null, 8, ["json"]),
237
+ d(X, { json: t(T) }, null, 8, ["json"]),
238
+ a("div", Ge, [
239
+ a("div", null, [
240
+ a("div", Me, [
241
+ d(i, {
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
+ (S(), j(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
+ d(i, {
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
+ (S(), j(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
+ d(g, {
279
+ text: t(N).helperText(t(T), "option"),
280
+ state: t(N).helperState(t(T), "option")
281
+ }, null, 8, ["text", "state"]),
282
+ r[5] || (r[5] = a("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " When max. referral count is not set, it will default unlimited ", -1))
283
+ ]),
284
+ a("div", Ne, O(t(p)("connect.referral.editReferralCountSheet.referrer_reward")), 1),
285
+ d(b, {
286
+ modelValue: t(h),
287
+ "onUpdate:modelValue": r[2] || (r[2] = (P) => J(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
+ }), Ye = { class: "space-y-16" }, qe = { class: "grid grid-cols-3 gap-16" }, We = { class: "fm-typo-en-title-sm-800" }, Je = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Ke = /* @__PURE__ */ Y({
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(k, { emit: m }) {
313
+ const I = k, p = m, w = G(() => [
314
+ le.enum.BILL_COMPLETED,
315
+ le.enum.FEEDBACK
316
+ ].map((f) => Se[f]));
317
+ return (f, n) => {
318
+ const c = _("FmCard");
319
+ return S(), E("div", Ye, [
320
+ n[0] || (n[0] = a("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Define the conditions that must be met to activate a reward. ", -1)),
321
+ a("div", qe, [
322
+ (S(!0), E(z, null, re(t(w), (u) => (S(), j(c, {
323
+ key: u.name,
324
+ variant: "outlined",
325
+ disabled: I.disabled,
326
+ class: ie(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
327
+ "col-span-3": t(w).length == 1,
328
+ "border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": k.modelValue == u.value,
329
+ "hover:bg-fm-color-opacity-sm": k.modelValue != u.value
330
+ }]),
331
+ onClick: () => {
332
+ I.modelValue != u.value && !I.disabled && p("update:model-value", u.value);
333
+ }
334
+ }, {
335
+ default: V(() => [
336
+ a("div", We, O(u.name), 1),
337
+ a("div", Je, O(u.description), 1)
338
+ ]),
339
+ _: 2
340
+ }, 1032, ["disabled", "class", "onClick"]))), 128))
341
+ ])
342
+ ]);
343
+ };
344
+ }
345
+ }), Ze = { class: "flex items-center gap-x-8" }, Qe = { class: "flex flex-col space-y-16 pr-12" }, Xe = {
346
+ key: 0,
347
+ class: "space-y-16"
348
+ }, er = { class: "flex items-center gap-8" }, rr = /* @__PURE__ */ Y({
349
+ __name: "EditCriteriaSheet",
350
+ emits: ["update"],
351
+ setup(k, { expose: m, emit: I }) {
352
+ const { t: p } = Z(), w = I, f = F(!1), n = F(-1), c = F({}), u = Q(), R = xe.superRefine((y, s) => {
353
+ y.name.length >= 50 && s.addIssue({
354
+ code: "custom",
355
+ message: "Name must be less than 50 characters"
356
+ }), y.name.length < 1 && s.addIssue({
357
+ code: "custom",
358
+ message: "Name is required"
359
+ });
360
+ }), A = G(() => {
361
+ const y = R.safeParse(c.value);
362
+ return y.success ? [] : y.error.errors;
363
+ });
364
+ function T(y, s) {
365
+ var o;
366
+ f.value = y, y && typeof s == "number" && s >= 0 ? (n.value = s, c.value = H(
367
+ (o = u.referralProgram) == null ? void 0 : o.criteria[s]
368
+ )) : (n.value = -1, c.value = {
369
+ _id: new ke().toString(),
370
+ name: "",
371
+ type: "AUTO",
372
+ event: { type: "BILL_COMPLETED" }
373
+ });
374
+ }
375
+ function M() {
376
+ f.value = !1;
377
+ }
378
+ function D() {
379
+ const y = R.safeParse(c.value);
380
+ y.success && w("update", n.value, y.data);
381
+ }
382
+ function L(y) {
383
+ c.value.type = y, y == "AUTO" ? c.value.event = { type: "BILL_COMPLETED" } : c.value.event = void 0;
384
+ }
385
+ return m({
386
+ showSheet: T,
387
+ hideSheet: M,
388
+ data: c
389
+ }), (y, s) => {
390
+ const o = _("FmButton"), l = _("FmRadio"), C = _("FmRadioGroup"), h = _("FmSideSheet");
391
+ return S(), j(h, {
392
+ "max-width": 768,
393
+ modelValue: t(f),
394
+ "onUpdate:modelValue": s[5] || (s[5] = (e) => J(f) ? f.value = e : null)
395
+ }, {
396
+ "side-sheet-header": V(() => [
397
+ a("div", Ze, [
398
+ d(o, {
399
+ icon: "arrow_back",
400
+ variant: "tertiary",
401
+ onClick: s[0] || (s[0] = (e) => T(!1))
402
+ }),
403
+ s[6] || (s[6] = de("Add Criteria "))
404
+ ])
405
+ ]),
406
+ "side-sheet-footer": V(() => [
407
+ a("div", er, [
408
+ d(o, {
409
+ label: t(p)("connect.editTierSheet.submit"),
410
+ onClick: D,
411
+ disabled: t(A).length > 0 || t(K)().isLoading,
412
+ loading: t(K)().isLoading
413
+ }, null, 8, ["label", "disabled", "loading"]),
414
+ d(o, {
415
+ label: t(p)("connect.editTierSheet.cancel"),
416
+ onClick: s[4] || (s[4] = (e) => T(!1)),
417
+ variant: "tertiary"
418
+ }, null, 8, ["label"])
419
+ ])
420
+ ]),
421
+ default: V(() => [
422
+ d(X, { json: t(c) }, null, 8, ["json"]),
423
+ a("div", Qe, [
424
+ s[10] || (s[10] = a("div", { class: "fm-typo-en-title-sm-600" }, "Program Criteria", -1)),
425
+ d(Ce, {
426
+ modelValue: t(c).name,
427
+ "onUpdate:modelValue": s[1] || (s[1] = (e) => t(c).name = e),
428
+ label: t(p)("connect.referral.editReferralTierSheet.name"),
429
+ schema: t(N).typeAtPath(t(R), "name")
430
+ }, null, 8, ["modelValue", "label", "schema"]),
431
+ s[11] || (s[11] = a("div", { class: "fm-typo-en-title-sm-600" }, "Configuration", -1)),
432
+ d(C, {
433
+ "model-value": t(c).type,
434
+ label: "Verify status",
435
+ "onUpdate:modelValue": L
436
+ }, {
437
+ default: V(() => [
438
+ d(l, {
439
+ value: "AUTO",
440
+ label: "Auto",
441
+ sublabel: "Verify based on rule configuration"
442
+ }),
443
+ d(l, {
444
+ value: "MANUAL",
445
+ label: "Manual",
446
+ sublabel: "Verify based on manual inspection"
447
+ })
448
+ ]),
449
+ _: 1
450
+ }, 8, ["model-value"]),
451
+ t(c).type == "AUTO" ? (S(), E(z, { key: 0 }, [
452
+ s[8] || (s[8] = a("div", { class: "fm-typo-en-title-sm-600" }, "Trigger", -1)),
453
+ s[9] || (s[9] = a("div", null, " Select trigger what referee need to complete in order for referral to earn reward ", -1)),
454
+ d(Ke, {
455
+ "model-value": t(c).event.type,
456
+ "onUpdate:modelValue": s[2] || (s[2] = (e) => t(c).event.type = e)
457
+ }, null, 8, ["model-value"]),
458
+ t(c).event.type == t(ye).enum.BILL_COMPLETED ? (S(), E("div", Xe, [
459
+ s[7] || (s[7] = a("div", { class: "fm-typo-en-title-sm-600" }, "Spending Criteria", -1)),
460
+ d(Fe, {
461
+ "model-value": t(c).event.rule,
462
+ "onUpdate:modelValue": s[3] || (s[3] = (e) => t(c).event.rule = e)
463
+ }, null, 8, ["model-value"])
464
+ ])) : W("", !0)
465
+ ], 64)) : W("", !0)
466
+ ])
467
+ ]),
468
+ _: 1
469
+ }, 8, ["modelValue"]);
470
+ };
471
+ }
472
+ });
473
+ function pe() {
474
+ const k = F(!1), m = Re();
475
+ return {
476
+ confirmUpdateReferralRecord: async () => {
477
+ await new Promise((p) => {
478
+ m.open({
479
+ title: "Confirmation",
480
+ message: "This will change all referral settings? Would you like to update previous referral record?",
481
+ primaryActions: { text: "Update all", close: !0 },
482
+ secondaryActions: { text: "Update future only", close: !0 }
483
+ }).onPrimary(async () => {
484
+ k.value = !0, p();
485
+ }).onSecondary(async () => {
486
+ k.value = !1, p();
487
+ });
488
+ });
489
+ },
490
+ updateReferralRecord: k
491
+ };
492
+ }
493
+ const tr = { class: "flex flex-col space-y-16 mt-24" }, or = { class: "flex justify-between items-center" }, ar = /* @__PURE__ */ Y({
494
+ __name: "ManageCriteriaSheet",
495
+ setup(k, { expose: m }) {
496
+ const { t: I } = Z(), { minor: p } = ce, { confirmUpdateReferralRecord: w, updateReferralRecord: f } = pe(), n = F(!1), c = F({}), u = Q(), R = F(
497
+ null
498
+ ), A = G(() => {
499
+ var o;
500
+ return (o = u.referralProgram) == null ? void 0 : o.criteria;
501
+ });
502
+ async function T(o) {
503
+ await w(), await p(async () => {
504
+ await fe.update({
505
+ ...o,
506
+ updateReferralRecord: f.value
507
+ }), await u.readReferralProgram();
508
+ });
509
+ }
510
+ async function M(o, l) {
511
+ var e, r;
512
+ const C = o == -1 ? ((e = u.referralProgram) == null ? void 0 : e.criteria.length) || 0 : o, h = H(u.referralProgram);
513
+ h.criteria[C] = l, await T(h), (r = R.value) == null || r.showSheet(!1);
514
+ }
515
+ async function D(o) {
516
+ var h, e;
517
+ if (!await q.remove(
518
+ "Are you sure to remove criteria",
519
+ "Remove criteria",
520
+ I("connect.prompt.confirm"),
521
+ I("connect.prompt.cancel")
522
+ ))
523
+ return;
524
+ const l = o == -1 ? ((h = u.referralProgram) == null ? void 0 : h.criteria.length) || 0 : o, C = H(u.referralProgram);
525
+ C.criteria.splice(l, 1), await T(C), (e = R.value) == null || e.showSheet(!1);
526
+ }
527
+ const L = [
528
+ {
529
+ header: "Criteria title",
530
+ accessorFn: (o) => o.name
531
+ },
532
+ {
533
+ header: "Validity method",
534
+ cell(o) {
535
+ return te(oe.FmChip, {
536
+ label: we.title(o.row.original.type),
537
+ variant: "plain"
538
+ });
539
+ }
540
+ },
541
+ {
542
+ header: "Actions",
543
+ cell(o) {
544
+ return [
545
+ te(oe.FmButton, {
546
+ variant: "tertiary",
547
+ icon: "delete",
548
+ iconColor: "neutral-gray-400",
549
+ onClick: (l) => {
550
+ l.stopPropagation(), D(o.row.index);
551
+ }
552
+ })
553
+ ];
554
+ }
555
+ }
556
+ ];
557
+ function y(o) {
558
+ n.value = o;
559
+ }
560
+ function s() {
561
+ n.value = !1;
562
+ }
563
+ return m({
564
+ showSheet: y,
565
+ hideSheet: s,
566
+ data: c
567
+ }), (o, l) => {
568
+ const C = _("FmButton"), h = _("FmTable"), e = _("FmSideSheet");
569
+ return S(), E(z, null, [
570
+ d(e, {
571
+ "max-width": 768,
572
+ modelValue: t(n),
573
+ "onUpdate:modelValue": l[2] || (l[2] = (r) => J(n) ? n.value = r : null),
574
+ header: "Manage Criteria"
575
+ }, {
576
+ default: V(() => [
577
+ a("div", tr, [
578
+ a("div", or, [
579
+ l[3] || (l[3] = a("div", null, [
580
+ a("div", { class: "fm-typo-en-title-sm-600" }, "Program Criteria"),
581
+ a("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Set participation rules to start your referral program ")
582
+ ], -1)),
583
+ d(C, {
584
+ label: "Add Criteria",
585
+ icon: "add",
586
+ variant: "secondary",
587
+ onClick: l[0] || (l[0] = (r) => {
588
+ var i;
589
+ return (i = t(R)) == null ? void 0 : i.showSheet(!0);
590
+ })
591
+ })
592
+ ]),
593
+ d(h, {
594
+ "row-data": t(A),
595
+ "hide-footer": !0,
596
+ "page-size": 100,
597
+ "shrink-at": !1,
598
+ "column-defs": L,
599
+ onRowClick: l[1] || (l[1] = (r) => {
600
+ var i;
601
+ return (i = t(R)) == null ? void 0 : i.showSheet(!0, r.index);
602
+ })
603
+ }, null, 8, ["row-data"])
604
+ ])
605
+ ]),
606
+ _: 1
607
+ }, 8, ["modelValue"]),
608
+ d(rr, {
609
+ ref_key: "editCriteriaSheetRef",
610
+ ref: R,
611
+ onUpdate: M
612
+ }, null, 512)
613
+ ], 64);
614
+ };
615
+ }
616
+ }), nr = { class: "flex flex-col space-y-16 pr-12" }, lr = { class: "fm-typo-en-title-sm-800" }, sr = { class: "flex items-center gap-8" }, ir = /* @__PURE__ */ Y({
617
+ __name: "EditRefereeRewardSheet",
618
+ emits: ["update"],
619
+ setup(k, { expose: m, emit: I }) {
620
+ const { t: p } = Z(), w = I, f = F(!1), n = F([]), c = Q();
621
+ function u() {
622
+ w("update", n.value);
623
+ }
624
+ async function R(o) {
625
+ var l, C;
626
+ f.value = o, n.value = ((C = (l = c.referralProgram) == null ? void 0 : l.refereeReward) == null ? void 0 : C.map((h) => h.toString())) || [], s.value = L.value.map((h) => n.value.includes(h.id));
627
+ }
628
+ function A() {
629
+ f.value = !1;
630
+ }
631
+ const T = [
632
+ {
633
+ header: "Reward title",
634
+ accessorFn: (o) => o.name,
635
+ enableSorting: !0
636
+ },
637
+ {
638
+ id: "type",
639
+ header: "Reward type",
640
+ cell(o) {
641
+ return me[o.row.original.collectibleConfig.type].chip();
642
+ }
643
+ },
644
+ {
645
+ header: "Description",
646
+ accessorFn: (o) => o.description,
647
+ cell(o) {
648
+ const l = o.row.original;
649
+ if (l.collectible.type == "VOUCHER" || l.selectedReward == null)
650
+ return l.description;
651
+ }
652
+ }
653
+ ], M = ue(), D = F([]), L = G(() => M.rewards.map((o) => {
654
+ let l = "No expiry";
655
+ switch (o.option.type) {
656
+ case "VOUCHER":
657
+ l = `${o.option.collectibleConfig.options.maxUse} use(s), ${ee(o.option.collectibleConfig.options.validityOption || {})}`;
658
+ break;
659
+ case "LOYALTY":
660
+ l = `${o.option.earningOption.amount}, ${ee(o.option.validityOption || {})}`;
661
+ break;
662
+ }
663
+ return {
664
+ id: o._id,
665
+ name: o.name,
666
+ collectible: o.option,
667
+ collectibleConfig: o.collectibleConfig,
668
+ description: l
669
+ };
670
+ }));
671
+ G(() => []);
672
+ function y() {
673
+ const o = L.value;
674
+ for (let l = 0; l < o.length; l++) {
675
+ const C = o[l], h = s.value[l];
676
+ h && !n.value.includes(C.id) && n.value.push(C.id), !h && n.value.includes(C.id) && (n.value = n.value.filter((e) => e != C.id));
677
+ }
678
+ }
679
+ const s = F({});
680
+ return se(s, y, { deep: !0 }), m({
681
+ showSheet: R,
682
+ hideSheet: A,
683
+ data: n
684
+ }), (o, l) => {
685
+ const C = _("FmTable"), h = _("FmButton"), e = _("FmSideSheet");
686
+ return S(), j(e, {
687
+ "max-width": 1e3,
688
+ modelValue: t(f),
689
+ "onUpdate:modelValue": l[2] || (l[2] = (r) => J(f) ? f.value = r : null),
690
+ header: "Referee reward"
691
+ }, {
692
+ "side-sheet-footer": V(() => [
693
+ a("div", sr, [
694
+ d(h, {
695
+ label: t(p)("connect.common.save"),
696
+ onClick: u,
697
+ disabled: t(K)().isLoading,
698
+ loading: t(K)().isLoading
699
+ }, null, 8, ["label", "disabled", "loading"]),
700
+ d(h, {
701
+ label: t(p)("connect.common.cancel"),
702
+ onClick: l[1] || (l[1] = (r) => A()),
703
+ variant: "tertiary"
704
+ }, null, 8, ["label"])
705
+ ])
706
+ ]),
707
+ default: V(() => [
708
+ d(X, { json: t(n) }, null, 8, ["json"]),
709
+ a("div", nr, [
710
+ a("div", lr, O(t(p)("connect.referral.refereeRewardSheet.referee_reward")), 1),
711
+ d(C, {
712
+ modelValue: t(s),
713
+ "onUpdate:modelValue": l[0] || (l[0] = (r) => J(s) ? s.value = r : null),
714
+ selection: "multiple",
715
+ "column-filter": t(D),
716
+ "column-defs": T,
717
+ "row-data": t(L),
718
+ "page-size": 10
719
+ }, null, 8, ["modelValue", "column-filter", "row-data"])
720
+ ])
721
+ ]),
722
+ _: 1
723
+ }, 8, ["modelValue"]);
724
+ };
725
+ }
726
+ }), dr = { class: "fm-typo-en-title-sm-600" }, cr = { class: "grid grid-cols-4 xs:grid-cols-1 gap-4 divide-x xs:divide-x-0" }, ur = { class: "flex gap-x-8" }, mr = { class: "fm-typo-body-lg-600 flex items-center gap-x-4" }, fr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, pr = { class: "mb-40" }, hr = {
727
+ key: 0,
728
+ class: "flex flex-col items-center justify-center gap-y-16 p-24"
729
+ }, vr = { class: "flex flex-col gap-16 text-center" }, gr = { class: "fm-typo-en-title-sm-800" }, wr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Nr = /* @__PURE__ */ Y({
730
+ __name: "Overview",
731
+ setup(k) {
732
+ const { t: m } = Z(), { minor: I } = ce, p = $e(), w = Q(), { confirmUpdateReferralRecord: f, updateReferralRecord: n } = pe(), c = G(() => {
733
+ var e;
734
+ return ((e = w.referralProgram) == null ? void 0 : e.reward) ?? [];
735
+ }), u = F(null);
736
+ F(null);
737
+ const R = F(null), A = F(null), T = F(null), M = G(() => {
738
+ var e, r, i, g;
739
+ return [
740
+ {
741
+ label: "connect.referral.how_it_works.generate_link",
742
+ sublabel: m("connect.referral.how_it_works.generate_link_for_member"),
743
+ icon: "offline_share"
744
+ },
745
+ {
746
+ label: "connect.referral.how_it_works.referee_join_reward",
747
+ sublabel: `${((r = (e = w.referralProgram) == null ? void 0 : e.refereeReward) == null ? void 0 : r.length) || 0} reward(s)`,
748
+ action: m("connect.referral.actions.manage_reward"),
749
+ onClick: () => {
750
+ var b;
751
+ return (b = T.value) == null ? void 0 : b.showSheet(!0);
752
+ },
753
+ helperText: "Referee will receive rewards after successfully competing all criteria",
754
+ icon: "group_add"
755
+ },
756
+ {
757
+ label: "connect.referral.how_it_works.referee_meet_criteria",
758
+ sublabel: `${(i = w.referralProgram) == null ? void 0 : i.criteria.length} criteria`,
759
+ action: m("connect.referral.actions.manage_criteria"),
760
+ onClick: () => {
761
+ var b;
762
+ return (b = A.value) == null ? void 0 : b.showSheet(!0);
763
+ },
764
+ icon: "checklist_rtl"
765
+ },
766
+ {
767
+ label: "connect.referral.how_it_works.referer_get_reward",
768
+ sublabel: `${(g = w.referralProgram) == null ? void 0 : g.reward.length} configured tier(s)`,
769
+ helperText: "Referer will receive rewards after referee completed all criteria",
770
+ icon: "featured_seasonal_and_gifts"
771
+ }
772
+ ];
773
+ });
774
+ function D(e) {
775
+ var r;
776
+ (r = u.value) == null || r.onManageRewardGroup(e);
777
+ }
778
+ function L(e) {
779
+ var r;
780
+ (r = R.value) == null || r.showSheet(!0, {
781
+ groupIndex: e.groupIndex,
782
+ countIndex: e.countIndex
783
+ });
784
+ }
785
+ async function y(e) {
786
+ var P, x, v, B;
787
+ const r = e.countIndex == -1 ? ((x = (P = w.referralProgram) == null ? void 0 : P.reward[e.groupIndex]) == null ? void 0 : x.rewards.length) || 0 : e.countIndex || 0, i = e.referralCount, g = H(
788
+ w.referralProgram
789
+ ), b = g.reward[e.groupIndex];
790
+ b.rewards[r] = e.referralCount;
791
+ const $ = b.rewards[r - 1], U = b.rewards[r + 1];
792
+ if ($ && $.threshold.to != i.threshold.from - 1) {
793
+ if (!await q.confirm(
794
+ m(
795
+ "connect.referral.referral_count.update.range_discontinuous.previous",
796
+ {
797
+ name: $.threshold.from,
798
+ from: $.threshold.from ?? 0,
799
+ to: $.threshold.to ?? 1 / 0,
800
+ newTo: i.threshold.from - 1
801
+ }
802
+ ),
803
+ m("connect.referral.referral_count.title"),
804
+ m("connect.referral.referral_count.remove.next_range")
805
+ ))
806
+ return;
807
+ $.threshold.to = i.threshold.from - 1;
808
+ }
809
+ if (U && U.threshold.from - 1 != i.threshold.to) {
810
+ if (!await q.confirm(
811
+ m("connect.program.tier.update.range_discontinuous.next", {
812
+ name: U.threshold.from,
813
+ from: U.threshold.from ?? 0,
814
+ to: U.threshold.to ?? 1 / 0,
815
+ newFrom: i.threshold.to ?? 1
816
+ }),
817
+ m("connect.program.tier.title"),
818
+ m("connect.program.tier.remove.next_range"),
819
+ m("connect.prompt.cancel")
820
+ ))
821
+ return;
822
+ U.threshold.from = (i.threshold.to ?? 0) + 1;
823
+ }
824
+ !U && !((v = i.threshold) != null && v.to) && (i.threshold.to = void 0), await o(g), (B = R.value) == null || B.hideSheet();
825
+ }
826
+ async function s(e) {
827
+ var i;
828
+ const r = H(w.referralProgram);
829
+ r.refereeReward = e, await o(r), (i = T.value) == null || i.hideSheet();
830
+ }
831
+ async function o(e) {
832
+ await f(), await I(
833
+ async () => {
834
+ await fe.update({
835
+ ...e,
836
+ updateReferralRecord: n.value
837
+ }), await w.readReferralProgram();
838
+ },
839
+ {
840
+ message: "Updating referral program",
841
+ successMessage: "Referral program updated successfully"
842
+ }
843
+ );
844
+ }
845
+ async function l(e) {
846
+ if (!await q.remove(
847
+ "Are you sure to remove referral tier",
848
+ "Remove referral tier",
849
+ m("connect.prompt.confirm"),
850
+ m("connect.prompt.cancel")
851
+ ))
852
+ return;
853
+ const r = H(w.referralProgram);
854
+ r.reward.splice(e, 1), await o(r);
855
+ }
856
+ async function C(e, r) {
857
+ if (!await q.remove(
858
+ "Are you sure to remove referral count",
859
+ "Remove referral tier",
860
+ m("connect.prompt.confirm"),
861
+ m("connect.prompt.cancel")
862
+ ))
863
+ return;
864
+ const i = H(w.referralProgram), g = i.reward[e].rewards[r + 1];
865
+ if (g) {
866
+ if (!await q.confirm(
867
+ m("connect.referral.referral_count.update.range_discontinuous.next", {
868
+ from: g.threshold.from ?? 0,
869
+ to: g.threshold.to ?? 1 / 0,
870
+ newFrom: i.reward[e].rewards[r].threshold.from
871
+ }),
872
+ m("connect.referral.referral_count.remove.title"),
873
+ m("connect.referral.referral_count.remove.next_range"),
874
+ m("connect.prompt.cancel")
875
+ ))
876
+ return;
877
+ g.threshold.from = i.reward[e].rewards[r].threshold.from;
878
+ }
879
+ i.reward[e].rewards.splice(r, 1), await o(i);
880
+ }
881
+ const h = [
882
+ {
883
+ header: "Referral Count",
884
+ accessorFn: (e) => e.threshold.from == e.threshold.to ? `${e.threshold.from}` : e.threshold.to ? `${e.threshold.from} - ${e.threshold.to ?? "∞"}` : `${e.threshold.from}+`
885
+ },
886
+ {
887
+ header: "Rewards",
888
+ accessorKey: "type",
889
+ accessorFn: (e) => {
890
+ var r;
891
+ return `${((r = e.pf_reward) == null ? void 0 : r.length) || 0} reward(s)`;
892
+ }
893
+ },
894
+ {
895
+ id: "actions",
896
+ meta: {
897
+ textAlign: "right"
898
+ },
899
+ cell(e) {
900
+ return te(oe.FmButton, {
901
+ variant: "tertiary",
902
+ icon: "delete",
903
+ iconColor: "neutral-gray-400",
904
+ class: "ml-auto",
905
+ onClick: (r) => {
906
+ r.stopPropagation(), console.log(e.row), C(e.row.original.groupIndex, e.row.index);
907
+ }
908
+ });
909
+ }
910
+ }
911
+ ];
912
+ return ve(async () => {
913
+ await w.readReferralProgram();
914
+ }), (e, r) => {
915
+ const i = _("FmCard"), g = _("FmIcon"), b = _("FmTooltip"), $ = _("FmButton"), U = _("FmTable"), P = _("FmList");
916
+ return S(), E(z, null, [
917
+ W("", !0),
918
+ d(i, {
919
+ variant: "outlined",
920
+ class: "flex flex-col gap-16 p-16"
921
+ }, {
922
+ default: V(() => [
923
+ a("div", dr, O(t(m)("connect.referral.how_it_works.title")), 1),
924
+ a("div", cr, [
925
+ (S(!0), E(z, null, re(t(M), (x, v) => (S(), E("div", {
926
+ key: v,
927
+ class: ie(["px-8", { "xs:!border-r": v % 2 == 0 }])
928
+ }, [
929
+ a("div", ur, [
930
+ d(g, {
931
+ name: x.icon,
932
+ color: "primary",
933
+ class: "bg-fm-color-system-warning-100 p-8 fm-corner-radius-md max-h-40 max-w-40"
934
+ }, null, 8, ["name"]),
935
+ a("div", null, [
936
+ a("div", mr, [
937
+ de(O(t(m)(x.label)) + " ", 1),
938
+ x.helperText ? (S(), j(b, {
939
+ key: 0,
940
+ content: x.helperText
941
+ }, {
942
+ default: V(() => [
943
+ d(g, {
944
+ name: "help",
945
+ size: "sm",
946
+ outline: !0
947
+ })
948
+ ]),
949
+ _: 2
950
+ }, 1032, ["content"])) : W("", !0)
951
+ ]),
952
+ a("div", fr, O(x.sublabel), 1),
953
+ x.action ? (S(), j($, {
954
+ key: 0,
955
+ variant: "plain",
956
+ label: x.action,
957
+ disabled: !t(p).isPremium,
958
+ class: "fm-typo-en-body-md-400 !p-0",
959
+ onClick: x.onClick
960
+ }, null, 8, ["label", "disabled", "onClick"])) : W("", !0)
961
+ ])
962
+ ])
963
+ ], 2))), 128))
964
+ ])
965
+ ]),
966
+ _: 1
967
+ }),
968
+ t(c) && t(c).length > 0 ? (S(), j(i, {
969
+ key: 1,
970
+ variant: "outlined",
971
+ class: "flex flex-col gap-16 p-16"
972
+ }, {
973
+ default: V(() => [
974
+ d(P, { separator: !0 }, {
975
+ default: V(() => [
976
+ (S(!0), E(z, null, re(t(c), (x, v) => (S(), j(De, {
977
+ key: v,
978
+ "reward-group": x,
979
+ level: v,
980
+ onEdit: (B) => D(v),
981
+ onRemove: (B) => l(v),
982
+ onAddCount: r[0] || (r[0] = (B) => {
983
+ L({ groupIndex: B, countIndex: -1 });
984
+ })
985
+ }, {
986
+ default: V(() => [
987
+ a("div", pr, [
988
+ d(U, {
989
+ "row-data": x.rewards.map((B) => ({ ...B, groupIndex: v })),
990
+ "column-defs": h,
991
+ "hide-footer": !0,
992
+ "page-size": 50,
993
+ onRowClick: (B) => L({ groupIndex: v, countIndex: B.index })
994
+ }, null, 8, ["row-data", "onRowClick"])
995
+ ]),
996
+ x.rewards.length ? W("", !0) : (S(), E("div", hr, [
997
+ r[3] || (r[3] = a("div", { class: "flex flex-col gap-16 text-center" }, [
998
+ a("div", { class: "fm-typo-en-title-sm-800" }, "Create progressive reward"),
999
+ 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 ")
1000
+ ], -1)),
1001
+ d($, {
1002
+ variant: "secondary",
1003
+ label: "Add count",
1004
+ icon: "add",
1005
+ onClick: (B) => L({ groupIndex: v, countIndex: -1 })
1006
+ }, null, 8, ["onClick"])
1007
+ ]))
1008
+ ]),
1009
+ _: 2
1010
+ }, 1032, ["reward-group", "level", "onEdit", "onRemove"]))), 128))
1011
+ ]),
1012
+ _: 1
1013
+ })
1014
+ ]),
1015
+ _: 1
1016
+ })) : (S(), j(i, {
1017
+ key: 2,
1018
+ variant: "outlined",
1019
+ class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
1020
+ }, {
1021
+ default: V(() => [
1022
+ r[4] || (r[4] = a("img", {
1023
+ src: ge,
1024
+ class: "aspect-square w-[150px]"
1025
+ }, null, -1)),
1026
+ a("div", vr, [
1027
+ a("div", gr, O(t(m)("connect.referral.referral_tier_title")), 1),
1028
+ a("div", wr, O(t(m)("connect.referral.referral_tier_description")), 1)
1029
+ ]),
1030
+ d($, {
1031
+ variant: "primary",
1032
+ label: t(m)("connect.referral.add_referral_tier"),
1033
+ icon: "add",
1034
+ disabled: !t(p).isPremium,
1035
+ onClick: r[1] || (r[1] = (x) => D(-1))
1036
+ }, null, 8, ["label", "disabled"])
1037
+ ]),
1038
+ _: 1
1039
+ })),
1040
+ d(_e, {
1041
+ ref_key: "rewardGroupRef",
1042
+ ref: u
1043
+ }, null, 512),
1044
+ d(ze, {
1045
+ ref_key: "editReferralCountSheetRef",
1046
+ ref: R,
1047
+ onUpdate: y
1048
+ }, null, 512),
1049
+ d(ar, {
1050
+ ref_key: "manageCriteriaSheetRef",
1051
+ ref: A
1052
+ }, null, 512),
1053
+ d(ir, {
1054
+ ref_key: "editRefereeRewardSheetRef",
1055
+ ref: T,
1056
+ onUpdate: s
1057
+ }, null, 512)
1058
+ ], 64);
1059
+ };
1060
+ }
1061
+ });
1062
+ export {
1063
+ Nr as default
1064
+ };