@feedmepos/mf-connect 0.1.0-beta.8 → 0.1.0-beta.80

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