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