@feedmepos/mf-connect 0.1.0-beta.4 → 0.1.0-beta.41

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