@feedmepos/mf-connect 0.1.98-beta.40 → 0.1.98-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 (151) hide show
  1. package/dist/App-C6JJ9uQ8.js +4785 -0
  2. package/dist/AuditLogs-CAlgtDgx.js +2014 -0
  3. package/dist/Bin-D8jwhwER.js +166 -0
  4. package/dist/Broadcast-CP8DRfkT.js +269 -0
  5. package/dist/CampaignAnalytic-MVjYBFvu.js +1826 -0
  6. package/dist/CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DeLURz87.js +122 -0
  7. package/dist/Card-QribXJwZ.js +911 -0
  8. package/dist/ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js +97 -0
  9. package/dist/Collections-X9xbt43V.js +541 -0
  10. package/dist/Credit-QmbsW1eb.js +286 -0
  11. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-Du7fRSZC.js +128 -0
  12. package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-eIoPtgO5.js +58 -0
  13. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-ClNieHSo.js +3382 -0
  14. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-CrGHTNhg.js +351 -0
  15. package/dist/Experience-CPGMg847.js +285 -0
  16. package/dist/FileSaver.min-CK67LsPG.js +74 -0
  17. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js +129 -0
  18. package/dist/FmTableSelection.vue_vue_type_script_setup_true_lang-DzcUc0_w.js +52 -0
  19. package/dist/Game-BrkiEFCS.js +356 -0
  20. package/dist/GiftCardSetup-DXNBHF1A.js +542 -0
  21. package/dist/Grab-BgtDzK1B.js +301 -0
  22. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-Dzv2AkKN.js +145 -0
  23. package/dist/Index-KJgzalOd.js +259 -0
  24. package/dist/JsonViewer-v8_C7l5N.js +87 -0
  25. package/dist/LocationPicker.vue_vue_type_script_setup_true_lang-C6SBLJGQ.js +48 -0
  26. package/dist/LottieAnimation.vue_vue_type_script_setup_true_lang-Dj74lJ7b.js +18737 -0
  27. package/dist/LoyaltyDashboard-B2JpbC01.js +1345 -0
  28. package/dist/MainLayout-DlfTKHQ-.js +143 -0
  29. package/dist/Marketing-Crx_JQpi.js +236 -0
  30. package/dist/MarketingMaterialEdit-BfsdcMXJ.js +1036 -0
  31. package/dist/Member-C50Nrsko.js +281 -0
  32. package/dist/MemberList-C9uUKw1o.js +1603 -0
  33. package/dist/MemberOverview-wL_ailso.js +58 -0
  34. package/dist/MemberTransactions-DZ7zPOHX.js +45 -0
  35. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-Du_ZGsbX.js +60957 -0
  36. package/dist/MetricInfoTooltip.vue_vue_type_script_setup_true_lang-Bg_0YlwG.js +38 -0
  37. package/dist/Mission-D_km8zi6.js +360 -0
  38. package/dist/Overview-BBieK6qQ.js +1080 -0
  39. package/dist/Overview-B_kmLOcc.js +1316 -0
  40. package/dist/Point-D0q9N7f9.js +288 -0
  41. package/dist/Promotion-DoFTy-NK.js +423 -0
  42. package/dist/Queue-Dh5sDRHW.js +261 -0
  43. package/dist/Record-0owEBKqN.js +342 -0
  44. package/dist/Review-DV2fnpOH.js +45 -0
  45. package/dist/ReviewFacebookCallback-D8mnAPzR.js +238 -0
  46. package/dist/ReviewGoogleCallback-CLzt_ox2.js +213 -0
  47. package/dist/Reward-Co20Xrss.js +442 -0
  48. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-0qU49c47.js +150 -0
  49. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-qdvaXPhJ.js +1913 -0
  50. package/dist/Segment-7dQKeHWK.js +1017 -0
  51. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-BUVrUifO.js +181 -0
  52. package/dist/SendCollectionSheet.vue_vue_type_script_setup_true_lang-DDsV9TD9.js +189 -0
  53. package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-DqPZpddc.js +226 -0
  54. package/dist/Setting-Bvahxs-y.js +2047 -0
  55. package/dist/SettingAdvertisements-fbXLRwfb.js +264 -0
  56. package/dist/Settings-C_HWDFN8.js +179 -0
  57. package/dist/Store-8yBKDR1b.js +2413 -0
  58. package/dist/StoreRewards-DKaJvoJs.js +540 -0
  59. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-D23XzJD7.js +1075 -0
  60. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-JaFhCK_L.js +7007 -0
  61. package/dist/Tier-CD-CjXC3.js +972 -0
  62. package/dist/Title-C_lcgye8.js +569 -0
  63. package/dist/Transaction-BvUYm-rT.js +39 -0
  64. package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-C3Yacz7K.js +130 -0
  65. package/dist/Voucher-CYaG0GLU.js +444 -0
  66. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-DF2JqzRe.js +421 -0
  67. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-B4UPqSNc.js +56 -0
  68. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
  69. package/dist/app-CE5hQ4Uq.js +60740 -0
  70. package/dist/app-wDQR6dpb.js +39 -0
  71. package/dist/app.js +7 -0
  72. package/dist/business-CE_4siXc.js +82 -0
  73. package/dist/campaign-BP6rvSpg.js +255 -0
  74. package/dist/campaign-CXQtKpeb.js +100 -0
  75. package/dist/campaign-CpzFl8Vr.js +4 -0
  76. package/dist/campaign.enum-Dx-Zo68Q.js +26 -0
  77. package/dist/campaign.fn-DKnBpE1N.js +776 -0
  78. package/dist/collectible.enum-Liy2wH3s.js +19 -0
  79. package/dist/collection.fn-Cg16QZSp.js +26 -0
  80. package/dist/duplicateCampaign-DbtVAGsT.js +51 -0
  81. package/dist/effect-CLI8NI4O.js +89 -0
  82. package/dist/email-addresses-DlLiZ1io.js +705 -0
  83. package/dist/export-6Hr34dBU.js +97 -0
  84. package/dist/feedme.ico +0 -0
  85. package/dist/google-C3S8u0mT.js +4 -0
  86. package/dist/helper-vkjFqj70.js +86 -0
  87. package/dist/index-BIyKgw4m.js +72 -0
  88. package/dist/index-BLQJ-rv3.js +31 -0
  89. package/dist/index-BbTIqReL.js +67 -0
  90. package/dist/index-BuMfQxMf.js +897 -0
  91. package/dist/index-C8cXXcLk.js +45 -0
  92. package/dist/index-CSVhIZSY.js +8919 -0
  93. package/dist/index-CVHacTbc.js +151 -0
  94. package/dist/index-C_H8jFYf.js +2743 -0
  95. package/dist/index-CmNsGhDf.js +2706 -0
  96. package/dist/index-CnTeeRyJ.js +53 -0
  97. package/dist/index-CuvNtC_M.js +61 -0
  98. package/dist/index-CzbNobLv.js +1139 -0
  99. package/dist/index-D06n1h1b.js +146 -0
  100. package/dist/index-D4SDAfbP.js +27550 -0
  101. package/dist/index-DVnYQ3Hs.js +85 -0
  102. package/dist/index-DcjnS5Sv.js +28900 -0
  103. package/dist/index-Dx9h0FNH.js +3 -0
  104. package/dist/index-YgP4ihQL.js +32 -0
  105. package/dist/index-kedErkLZ.js +2963 -0
  106. package/dist/index-lnQT4P3d.js +55 -0
  107. package/dist/index-vh86FiIQ.js +10 -0
  108. package/dist/index.esm2017-Jhv2lkrq.js +3069 -0
  109. package/dist/loading-NY-FPxVY.js +72 -0
  110. package/dist/lodash-BC_P6kLg.js +3678 -0
  111. package/dist/membership-BWaK-9FY.js +255 -0
  112. package/dist/moment-D7p2TMB-.js +2583 -0
  113. package/dist/money-COoh4GXK.js +15 -0
  114. package/dist/number-BX5OEXgq.js +12 -0
  115. package/dist/object-BYyQ0PZp.js +18 -0
  116. package/dist/objectId-dwaoBfJX.js +7 -0
  117. package/dist/objectid-1SUSRtmY.js +145 -0
  118. package/dist/plugins-ur-FAoye.js +1788 -0
  119. package/dist/remy-Qz_pNsUS.js +13 -0
  120. package/dist/reward-DSsylZ22.js +36 -0
  121. package/dist/rule-BM9GUd1C.js +1969 -0
  122. package/dist/rule-builder-gC9LH2AC.js +126 -0
  123. package/dist/string-Gcy5IM_H.js +32 -0
  124. package/dist/style.css +4 -0
  125. package/dist/template-CUV3AMFI.js +188 -0
  126. package/dist/tier-BJDhpH6X.js +4 -0
  127. package/dist/tiers/tier=1.png +0 -0
  128. package/dist/tiers/tier=2.png +0 -0
  129. package/dist/tiers/tier=3.png +0 -0
  130. package/dist/tiers/tier=4.png +0 -0
  131. package/dist/timezone-BFZhekOU.js +20 -0
  132. package/dist/titles/type=diamond.png +0 -0
  133. package/dist/titles/type=drinks.png +0 -0
  134. package/dist/titles/type=food.png +0 -0
  135. package/dist/titles/type=heart.png +0 -0
  136. package/dist/titles/type=medal.png +0 -0
  137. package/dist/titles/type=spend.png +0 -0
  138. package/dist/titles/type=thank-you.png +0 -0
  139. package/dist/titles/type=thumbs-up.png +0 -0
  140. package/dist/titles/type=years.png +0 -0
  141. package/dist/transaction.fn-C5MlkEIC.js +64 -0
  142. package/dist/trigger-CbjiuoSo.js +213 -0
  143. package/dist/tslib.es6-BCqqvLQ_.js +44 -0
  144. package/dist/type_drinks-D6jnpvwV.js +4 -0
  145. package/dist/useMarketingMaterialActions-BLisTieA.js +96 -0
  146. package/dist/usePagination-Caah4sJr.js +220 -0
  147. package/dist/user-BZC4P_jL.js +55 -0
  148. package/dist/vue-i18n-BYz7XAr_.js +2365 -0
  149. package/dist/xlsx-Bn7BqUFA.js +15491 -0
  150. package/dist/zod-DHH42rXG.js +91 -0
  151. package/package.json +1 -1
@@ -0,0 +1,1080 @@
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-BYz7XAr_.js";
4
+ import { u as ue } from "./loading-NY-FPxVY.js";
5
+ import { p as K } from "./plugins-ur-FAoye.js";
6
+ import { J as X } from "./JsonViewer-v8_C7l5N.js";
7
+ import { Z as N } from "./zod-DHH42rXG.js";
8
+ import { u as W } from "./app-wDQR6dpb.js";
9
+ import { u as Q, _ as we } from "./RewardGroup.vue_vue_type_script_setup_true_lang-0qU49c47.js";
10
+ import { u as me } from "./reward-DSsylZ22.js";
11
+ import { a as ye, b as be } from "./index-CmNsGhDf.js";
12
+ import "./index-kedErkLZ.js";
13
+ import "./index-CSVhIZSY.js";
14
+ import "./index-D4SDAfbP.js";
15
+ import { c as le, a as se } from "./index-BuMfQxMf.js";
16
+ import "./index-lnQT4P3d.js";
17
+ import { C as fe } from "./membership-BWaK-9FY.js";
18
+ import { t as ee } from "./helper-vkjFqj70.js";
19
+ import { c as H } from "./object-BYyQ0PZp.js";
20
+ import { useDialog as xe, components as oe } from "@feedmepos/ui-library";
21
+ import { _ as Ce } from "./ZodTextField.vue_vue_type_script_setup_true_lang-B4UPqSNc.js";
22
+ import { a as Re, _ as Se, b as Fe } from "./trigger-CbjiuoSo.js";
23
+ import { O as ke } from "./objectid-1SUSRtmY.js";
24
+ import { c as $e } from "./string-Gcy5IM_H.js";
25
+ import { r as pe } from "./index-YgP4ihQL.js";
26
+ import { u as Pe } from "./business-CE_4siXc.js";
27
+ 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({
28
+ __name: "ReferralRewadGroupCard",
29
+ props: {
30
+ rewardGroup: {
31
+ type: Object,
32
+ required: !0
33
+ },
34
+ level: {
35
+ type: Number,
36
+ required: !0
37
+ }
38
+ },
39
+ emits: ["edit", "addCount", "remove"],
40
+ setup(k, { emit: l }) {
41
+ const { t: I } = Z(), p = l;
42
+ return (g, f) => {
43
+ const s = w("FmButton"), u = w("FmListItem");
44
+ return C(), B(Y, null, [
45
+ c(u, {
46
+ onClick: f[4] || (f[4] = (m) => p("edit", k.level)),
47
+ class: "!p-0"
48
+ }, {
49
+ default: V(() => [
50
+ a("div", Ve, [
51
+ a("div", Ie, [
52
+ a("div", Te, [
53
+ a("div", Ue, [
54
+ a("div", Ae, O(k.rewardGroup.name), 1)
55
+ ])
56
+ ])
57
+ ]),
58
+ a("div", Le, [
59
+ c(s, {
60
+ variant: "secondary",
61
+ label: r(I)("connect.referral.reward.add_count"),
62
+ icon: "add",
63
+ onClick: f[0] || (f[0] = (m) => {
64
+ m.stopPropagation(), p("addCount", k.level);
65
+ })
66
+ }, null, 8, ["label"]),
67
+ c(s, {
68
+ icon: "delete",
69
+ onClick: f[1] || (f[1] = (m) => {
70
+ m.stopPropagation(), p("remove", k.level);
71
+ }),
72
+ variant: "tertiary"
73
+ })
74
+ ])
75
+ ]),
76
+ a("div", Ee, [
77
+ a("div", Be, [
78
+ a("div", Oe, [
79
+ a("div", je, [
80
+ a("div", null, [
81
+ a("div", De, O(k.rewardGroup.name), 1)
82
+ ])
83
+ ])
84
+ ]),
85
+ c(s, {
86
+ variant: "tertiary",
87
+ icon: "delete",
88
+ onClick: f[2] || (f[2] = (m) => (m.stopPropagation(), p("remove", k.level)))
89
+ })
90
+ ]),
91
+ c(s, {
92
+ class: "w-full",
93
+ variant: "secondary",
94
+ label: "Add count",
95
+ disabled: !0,
96
+ icon: "add",
97
+ onClick: f[3] || (f[3] = (m) => (m.stopPropagation(), p("addCount", k.level)))
98
+ })
99
+ ])
100
+ ]),
101
+ _: 1
102
+ }),
103
+ ve(g.$slots, "default")
104
+ ], 64);
105
+ };
106
+ }
107
+ }), 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({
108
+ __name: "EditReferralCountSheet",
109
+ emits: ["update"],
110
+ setup(k, { expose: l, emit: I }) {
111
+ const { t: p } = Z(), g = I, f = F(!1), s = F({}), u = F(-1), m = F(-1), R = Q(), A = ye.superRefine((e, t) => {
112
+ var $, U, P, x, v, E, ae;
113
+ 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];
114
+ _ && e.threshold.from < _.threshold.from + 1 && t.addIssue({
115
+ code: "custom",
116
+ message: `The min referral must be at least ${_.threshold.from + 1}`,
117
+ path: ["option"]
118
+ }), b && e.threshold.to && b.threshold.to && e.threshold.to > b.threshold.to - 1 && t.addIssue({
119
+ code: "custom",
120
+ message: `The max referral must be at most ${b.threshold.to - 2}`,
121
+ path: ["option"]
122
+ });
123
+ }), T = G(() => {
124
+ const e = A.safeParse(s.value);
125
+ return e.success ? [] : e.error.errors;
126
+ });
127
+ function M() {
128
+ const e = A.safeParse(s.value);
129
+ e.success && g("update", {
130
+ groupIndex: u.value,
131
+ countIndex: m.value,
132
+ referralCount: e.data
133
+ });
134
+ }
135
+ async function D(e, t) {
136
+ var d, _, b, $, U, P;
137
+ if (f.value = e, e && typeof (t == null ? void 0 : t.countIndex) == "number" && t.countIndex >= 0)
138
+ u.value = t.groupIndex, m.value = t.countIndex, s.value = H(
139
+ (d = R.referralProgram) == null ? void 0 : d.reward[t.groupIndex].rewards[t.countIndex]
140
+ );
141
+ else {
142
+ u.value = t.groupIndex, m.value = -1;
143
+ 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];
144
+ s.value = {
145
+ threshold: {
146
+ from: v != null && v.threshold ? v != null && v.threshold.to ? v.threshold.to + 1 : (v == null ? void 0 : v.threshold.from) + 1 : 1,
147
+ to: null
148
+ },
149
+ rewards: []
150
+ };
151
+ }
152
+ h.value = [], h.value = i.value.map(
153
+ (x) => s.value.rewards.includes(x.id)
154
+ );
155
+ }
156
+ function L() {
157
+ f.value = !1;
158
+ }
159
+ const y = [
160
+ {
161
+ header: "Reward title",
162
+ accessorFn: (e) => e.name,
163
+ enableSorting: !0
164
+ },
165
+ {
166
+ id: "type",
167
+ header: "Reward type",
168
+ cell(e) {
169
+ return fe[e.row.original.collectibleConfig.type].chip();
170
+ }
171
+ },
172
+ {
173
+ header: "Description",
174
+ accessorFn: (e) => e.description,
175
+ cell(e) {
176
+ const t = e.row.original;
177
+ if (t.collectible.type == "VOUCHER" || t.selectedReward == null)
178
+ return t.description;
179
+ }
180
+ }
181
+ ], n = me(), o = F([]), i = G(() => n.rewards.map((e) => {
182
+ let t = "No expiry";
183
+ switch (e.option.type) {
184
+ case "VOUCHER":
185
+ t = `${e.option.collectibleConfig.options.maxUse} use(s), ${ee(e.option.collectibleConfig.options.validityOption || {})}`;
186
+ break;
187
+ case "LOYALTY":
188
+ t = `${e.option.earningOption.amount}, ${ee(e.option.validityOption || {})}`;
189
+ break;
190
+ }
191
+ return {
192
+ id: e._id,
193
+ name: e.name,
194
+ collectible: e.option,
195
+ collectibleConfig: e.collectibleConfig,
196
+ description: t
197
+ };
198
+ }));
199
+ G(() => []);
200
+ function S() {
201
+ const e = i.value;
202
+ for (let t = 0; t < e.length; t++) {
203
+ const d = e[t], _ = h.value[t];
204
+ _ && !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(
205
+ (b) => b != d.id
206
+ ));
207
+ }
208
+ }
209
+ const h = F({});
210
+ return ie(h, S, { deep: !0 }), l({
211
+ showSheet: D,
212
+ hideSheet: L,
213
+ data: s
214
+ }), (e, t) => {
215
+ const d = w("FmStepperField"), _ = w("FmHelperText"), b = w("FmTable"), $ = w("FmButton"), U = w("FmSideSheet");
216
+ return C(), j(U, {
217
+ "max-width": 1e3,
218
+ modelValue: r(f),
219
+ "onUpdate:modelValue": t[4] || (t[4] = (P) => J(f) ? f.value = P : null),
220
+ header: `${r(m) == -1 ? r(p)("connect.referral.editReferralCountSheet.add") : r(p)("connect.referral.editReferralCountSheet.edit")}`
221
+ }, {
222
+ "side-sheet-footer": V(() => [
223
+ a("div", Ye, [
224
+ c($, {
225
+ label: r(p)("connect.editTierSheet.submit"),
226
+ onClick: M,
227
+ disabled: r(T).length > 0 || r(W)().isLoading,
228
+ loading: r(W)().isLoading
229
+ }, null, 8, ["label", "disabled", "loading"]),
230
+ c($, {
231
+ label: r(p)("connect.editTierSheet.cancel"),
232
+ onClick: t[3] || (t[3] = (P) => L()),
233
+ variant: "tertiary"
234
+ }, null, 8, ["label"])
235
+ ])
236
+ ]),
237
+ default: V(() => [
238
+ c(X, { json: r(s) }, null, 8, ["json"]),
239
+ c(X, { json: r(T) }, null, 8, ["json"]),
240
+ a("div", Me, [
241
+ a("div", null, [
242
+ a("div", Ne, [
243
+ c(d, {
244
+ modelValue: r(s).threshold.from,
245
+ "onUpdate:modelValue": t[0] || (t[0] = (P) => r(s).threshold.from = P),
246
+ "show-steppers": !1,
247
+ rules: [r(N).ruleAtPath(r(A), "threshold.from")]
248
+ }, {
249
+ label: V(() => [
250
+ (C(), j(ne(
251
+ r(N).toInputLabel(
252
+ r(N).typeAtPath(r(A), "threshold.from"),
253
+ r(p)(
254
+ "connect.referral.editReferralCountSheet.min_referral_count"
255
+ )
256
+ )
257
+ )))
258
+ ]),
259
+ _: 1
260
+ }, 8, ["modelValue", "rules"]),
261
+ c(d, {
262
+ modelValue: r(s).threshold.to,
263
+ "onUpdate:modelValue": t[1] || (t[1] = (P) => r(s).threshold.to = P),
264
+ "show-steppers": !1,
265
+ rules: [r(N).ruleAtPath(r(A), "threshold.to")]
266
+ }, {
267
+ label: V(() => [
268
+ (C(), j(ne(
269
+ r(N).toInputLabel(
270
+ r(N).typeAtPath(r(A), "threshold.to"),
271
+ r(p)(
272
+ "connect.referral.editReferralCountSheet.max_referral_count"
273
+ )
274
+ )
275
+ )))
276
+ ]),
277
+ _: 1
278
+ }, 8, ["modelValue", "rules"])
279
+ ]),
280
+ c(_, {
281
+ text: r(N).helperText(r(T), "threshold"),
282
+ state: r(N).helperState(r(T), "threshold")
283
+ }, null, 8, ["text", "state"]),
284
+ a("div", He, O(r(p)(
285
+ "connect.referral.editReferralCountSheet.max_referral_count_description"
286
+ )), 1)
287
+ ]),
288
+ a("div", ze, O(r(p)("connect.referral.editReferralCountSheet.referrer_reward")), 1),
289
+ c(b, {
290
+ modelValue: r(h),
291
+ "onUpdate:modelValue": t[2] || (t[2] = (P) => J(h) ? h.value = P : null),
292
+ selection: "multiple",
293
+ "column-filter": r(o),
294
+ "column-defs": y,
295
+ "row-data": r(i),
296
+ "page-size": 10
297
+ }, null, 8, ["modelValue", "column-filter", "row-data"])
298
+ ])
299
+ ]),
300
+ _: 1
301
+ }, 8, ["modelValue", "header"]);
302
+ };
303
+ }
304
+ }), 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({
305
+ __name: "CriteriaTriggerInput",
306
+ props: {
307
+ modelValue: {
308
+ type: String
309
+ },
310
+ disabled: {
311
+ type: Boolean,
312
+ default: !1
313
+ }
314
+ },
315
+ emits: ["update:model-value"],
316
+ setup(k, { emit: l }) {
317
+ const I = k, p = l, g = G(() => [
318
+ le.enum.BILL_COMPLETED,
319
+ le.enum.FEEDBACK
320
+ ].map((f) => Re[f]));
321
+ return (f, s) => {
322
+ const u = w("FmCard");
323
+ return C(), B("div", Ke, [
324
+ 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)),
325
+ a("div", Je, [
326
+ (C(!0), B(Y, null, re(r(g), (m) => (C(), j(u, {
327
+ key: m.name,
328
+ variant: "outlined",
329
+ disabled: I.disabled,
330
+ class: de(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
331
+ "col-span-3": r(g).length == 1,
332
+ "border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": k.modelValue == m.value,
333
+ "hover:bg-fm-color-opacity-sm": k.modelValue != m.value
334
+ }]),
335
+ onClick: () => {
336
+ I.modelValue != m.value && !I.disabled && p("update:model-value", m.value);
337
+ }
338
+ }, {
339
+ default: V(() => [
340
+ a("div", We, O(m.name), 1),
341
+ a("div", Ze, O(m.description), 1)
342
+ ]),
343
+ _: 2
344
+ }, 1032, ["disabled", "class", "onClick"]))), 128))
345
+ ])
346
+ ]);
347
+ };
348
+ }
349
+ }), Xe = { class: "flex items-center gap-x-8" }, er = { class: "flex flex-col space-y-16 pr-12" }, rr = {
350
+ key: 0,
351
+ class: "space-y-16"
352
+ }, tr = {
353
+ key: 1,
354
+ class: "space-y-16"
355
+ }, or = { class: "flex items-center gap-8" }, ar = /* @__PURE__ */ q({
356
+ __name: "EditCriteriaSheet",
357
+ emits: ["update"],
358
+ setup(k, { expose: l, emit: I }) {
359
+ const { t: p } = Z(), g = I, f = F(!1), s = F(-1), u = F({}), m = Q(), R = be.superRefine((y, n) => {
360
+ y.name.length >= 50 && n.addIssue({
361
+ code: "custom",
362
+ message: "Name must be less than 50 characters"
363
+ }), y.name.length < 1 && n.addIssue({
364
+ code: "custom",
365
+ message: "Name is required"
366
+ });
367
+ }), A = G(() => {
368
+ const y = R.safeParse(u.value);
369
+ return y.success ? [] : y.error.errors;
370
+ });
371
+ function T(y, n) {
372
+ var o;
373
+ f.value = y, y && typeof n == "number" && n >= 0 ? (s.value = n, u.value = H(
374
+ (o = m.referralProgram) == null ? void 0 : o.criteria[n]
375
+ )) : (s.value = -1, u.value = {
376
+ _id: new ke().toString(),
377
+ name: "",
378
+ type: "AUTO",
379
+ event: { type: "BILL_COMPLETED" }
380
+ });
381
+ }
382
+ function M() {
383
+ f.value = !1;
384
+ }
385
+ function D() {
386
+ const y = R.safeParse(u.value);
387
+ y.success && g("update", s.value, y.data);
388
+ }
389
+ function L(y) {
390
+ u.value.type = y, y == "AUTO" ? u.value.event = { type: "BILL_COMPLETED" } : u.value.event = void 0;
391
+ }
392
+ return l({
393
+ showSheet: T,
394
+ hideSheet: M,
395
+ data: u
396
+ }), (y, n) => {
397
+ const o = w("FmButton"), i = w("FmRadio"), S = w("FmRadioGroup"), h = w("FmSideSheet");
398
+ return C(), j(h, {
399
+ "max-width": 768,
400
+ modelValue: r(f),
401
+ "onUpdate:modelValue": n[6] || (n[6] = (e) => J(f) ? f.value = e : null)
402
+ }, {
403
+ "side-sheet-header": V(() => [
404
+ a("div", Xe, [
405
+ c(o, {
406
+ icon: "arrow_back",
407
+ variant: "tertiary",
408
+ onClick: n[0] || (n[0] = (e) => T(!1))
409
+ }),
410
+ n[7] || (n[7] = ce("Add Criteria ", -1))
411
+ ])
412
+ ]),
413
+ "side-sheet-footer": V(() => [
414
+ a("div", or, [
415
+ c(o, {
416
+ label: r(p)("connect.editTierSheet.submit"),
417
+ onClick: D,
418
+ disabled: r(A).length > 0 || r(W)().isLoading,
419
+ loading: r(W)().isLoading
420
+ }, null, 8, ["label", "disabled", "loading"]),
421
+ c(o, {
422
+ label: r(p)("connect.editTierSheet.cancel"),
423
+ onClick: n[5] || (n[5] = (e) => T(!1)),
424
+ variant: "tertiary"
425
+ }, null, 8, ["label"])
426
+ ])
427
+ ]),
428
+ default: V(() => [
429
+ c(X, { json: r(u) }, null, 8, ["json"]),
430
+ a("div", er, [
431
+ n[12] || (n[12] = a("div", { class: "fm-typo-en-title-sm-600" }, "Program Criteria", -1)),
432
+ c(Ce, {
433
+ modelValue: r(u).name,
434
+ "onUpdate:modelValue": n[1] || (n[1] = (e) => r(u).name = e),
435
+ label: r(p)("connect.referral.editReferralTierSheet.name"),
436
+ schema: r(N).typeAtPath(r(R), "name")
437
+ }, null, 8, ["modelValue", "label", "schema"]),
438
+ n[13] || (n[13] = a("div", { class: "fm-typo-en-title-sm-600" }, "Configuration", -1)),
439
+ c(S, {
440
+ "model-value": r(u).type,
441
+ label: "Verify status",
442
+ "onUpdate:modelValue": L
443
+ }, {
444
+ default: V(() => [
445
+ c(i, {
446
+ value: "AUTO",
447
+ label: "Auto",
448
+ sublabel: "Verify based on rule configuration"
449
+ }),
450
+ c(i, {
451
+ value: "MANUAL",
452
+ label: "Manual",
453
+ sublabel: "Verify based on manual inspection"
454
+ })
455
+ ]),
456
+ _: 1
457
+ }, 8, ["model-value"]),
458
+ r(u).type == "AUTO" ? (C(), B(Y, { key: 0 }, [
459
+ n[10] || (n[10] = a("div", { class: "fm-typo-en-title-sm-600" }, "Trigger", -1)),
460
+ n[11] || (n[11] = a("div", null, " Select trigger what referee need to complete in order for referral to earn reward ", -1)),
461
+ c(Qe, {
462
+ "model-value": r(u).event.type,
463
+ "onUpdate:modelValue": n[2] || (n[2] = (e) => r(u).event.type = e)
464
+ }, null, 8, ["model-value"]),
465
+ r(u).event.type == r(se).enum.BILL_COMPLETED ? (C(), B("div", rr, [
466
+ n[8] || (n[8] = a("div", { class: "fm-typo-en-title-sm-600" }, "Spending Criteria", -1)),
467
+ c(Se, {
468
+ "model-value": r(u).event.rule,
469
+ "onUpdate:modelValue": n[3] || (n[3] = (e) => r(u).event.rule = e)
470
+ }, null, 8, ["model-value"])
471
+ ])) : z("", !0),
472
+ r(u).event.type == r(se).enum.FEEDBACK ? (C(), B("div", tr, [
473
+ n[9] || (n[9] = a("div", { class: "fm-typo-en-title-sm-600" }, "Feedback Criteria", -1)),
474
+ c(Fe, {
475
+ "model-value": r(u).event.rule,
476
+ "onUpdate:modelValue": n[4] || (n[4] = (e) => r(u).event.rule = e)
477
+ }, null, 8, ["model-value"])
478
+ ])) : z("", !0)
479
+ ], 64)) : z("", !0)
480
+ ])
481
+ ]),
482
+ _: 1
483
+ }, 8, ["modelValue"]);
484
+ };
485
+ }
486
+ });
487
+ function he() {
488
+ const k = F(!1), l = xe();
489
+ return {
490
+ confirmUpdateReferralRecord: async () => {
491
+ await new Promise((p) => {
492
+ l.open({
493
+ title: "Confirmation",
494
+ message: "This will change all referral settings? Would you like to update previous referral record?",
495
+ primaryActions: { text: "Update all", close: !0 },
496
+ secondaryActions: { text: "Update future only", close: !0 }
497
+ }).onPrimary(async () => {
498
+ k.value = !0, p();
499
+ }).onSecondary(async () => {
500
+ k.value = !1, p();
501
+ });
502
+ });
503
+ },
504
+ updateReferralRecord: k
505
+ };
506
+ }
507
+ const nr = { class: "flex flex-col space-y-16 mt-24" }, lr = { class: "flex justify-between items-center" }, sr = /* @__PURE__ */ q({
508
+ __name: "ManageCriteriaSheet",
509
+ setup(k, { expose: l }) {
510
+ const { t: I } = Z(), { minor: p } = ue, { confirmUpdateReferralRecord: g, updateReferralRecord: f } = he(), s = F(!1), u = F({}), m = Q(), R = F(
511
+ null
512
+ ), A = G(() => {
513
+ var o;
514
+ return (o = m.referralProgram) == null ? void 0 : o.criteria;
515
+ });
516
+ async function T(o) {
517
+ await g(), await p(async () => {
518
+ await pe.update({
519
+ ...o,
520
+ updateReferralRecord: f.value
521
+ }), await m.readReferralProgram();
522
+ });
523
+ }
524
+ async function M(o, i) {
525
+ var e, t;
526
+ const S = o == -1 ? ((e = m.referralProgram) == null ? void 0 : e.criteria.length) || 0 : o, h = H(m.referralProgram);
527
+ h.criteria[S] = i, await T(h), (t = R.value) == null || t.showSheet(!1);
528
+ }
529
+ async function D(o) {
530
+ var h, e;
531
+ if (!await K.remove(
532
+ "Are you sure to remove criteria",
533
+ "Remove criteria",
534
+ I("connect.prompt.confirm"),
535
+ I("connect.prompt.cancel")
536
+ ))
537
+ return;
538
+ const i = o == -1 ? ((h = m.referralProgram) == null ? void 0 : h.criteria.length) || 0 : o, S = H(m.referralProgram);
539
+ S.criteria.splice(i, 1), await T(S), (e = R.value) == null || e.showSheet(!1);
540
+ }
541
+ const L = [
542
+ {
543
+ header: "Criteria title",
544
+ accessorFn: (o) => o.name
545
+ },
546
+ {
547
+ header: "Validity method",
548
+ cell(o) {
549
+ return te(oe.FmChip, {
550
+ label: $e.title(o.row.original.type),
551
+ variant: "plain"
552
+ });
553
+ }
554
+ },
555
+ {
556
+ header: "Actions",
557
+ cell(o) {
558
+ return [
559
+ te(oe.FmButton, {
560
+ variant: "tertiary",
561
+ icon: "delete",
562
+ iconColor: "neutral-gray-400",
563
+ onClick: (i) => {
564
+ i.stopPropagation(), D(o.row.index);
565
+ }
566
+ })
567
+ ];
568
+ }
569
+ }
570
+ ];
571
+ function y(o) {
572
+ s.value = o;
573
+ }
574
+ function n() {
575
+ s.value = !1;
576
+ }
577
+ return l({
578
+ showSheet: y,
579
+ hideSheet: n,
580
+ data: u
581
+ }), (o, i) => {
582
+ const S = w("FmButton"), h = w("FmTable"), e = w("FmSideSheet");
583
+ return C(), B(Y, null, [
584
+ c(e, {
585
+ "max-width": 768,
586
+ modelValue: r(s),
587
+ "onUpdate:modelValue": i[2] || (i[2] = (t) => J(s) ? s.value = t : null),
588
+ header: "Manage Criteria"
589
+ }, {
590
+ default: V(() => [
591
+ a("div", nr, [
592
+ a("div", lr, [
593
+ i[3] || (i[3] = a("div", null, [
594
+ a("div", { class: "fm-typo-en-title-sm-600" }, "Program Criteria"),
595
+ a("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Set participation rules to start your referral program ")
596
+ ], -1)),
597
+ c(S, {
598
+ label: "Add Criteria",
599
+ icon: "add",
600
+ variant: "secondary",
601
+ onClick: i[0] || (i[0] = (t) => {
602
+ var d;
603
+ return (d = r(R)) == null ? void 0 : d.showSheet(!0);
604
+ })
605
+ })
606
+ ]),
607
+ c(h, {
608
+ "row-data": r(A),
609
+ "hide-footer": !0,
610
+ "page-size": 100,
611
+ "shrink-at": !1,
612
+ "column-defs": L,
613
+ onRowClick: i[1] || (i[1] = (t) => {
614
+ var d;
615
+ return (d = r(R)) == null ? void 0 : d.showSheet(!0, t.index);
616
+ })
617
+ }, null, 8, ["row-data"])
618
+ ])
619
+ ]),
620
+ _: 1
621
+ }, 8, ["modelValue"]),
622
+ c(ar, {
623
+ ref_key: "editCriteriaSheetRef",
624
+ ref: R,
625
+ onUpdate: M
626
+ }, null, 512)
627
+ ], 64);
628
+ };
629
+ }
630
+ }), 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({
631
+ __name: "EditRefereeRewardSheet",
632
+ emits: ["update"],
633
+ setup(k, { expose: l, emit: I }) {
634
+ const { t: p } = Z(), g = I, f = F(!1), s = F([]), u = Q();
635
+ function m() {
636
+ g("update", s.value);
637
+ }
638
+ async function R(o) {
639
+ var i, S;
640
+ 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));
641
+ }
642
+ function A() {
643
+ f.value = !1;
644
+ }
645
+ const T = [
646
+ {
647
+ header: "Reward title",
648
+ accessorFn: (o) => o.name,
649
+ enableSorting: !0
650
+ },
651
+ {
652
+ id: "type",
653
+ header: "Reward type",
654
+ cell(o) {
655
+ return fe[o.row.original.collectibleConfig.type].chip();
656
+ }
657
+ },
658
+ {
659
+ header: "Description",
660
+ accessorFn: (o) => o.description,
661
+ cell(o) {
662
+ const i = o.row.original;
663
+ if (i.collectible.type == "VOUCHER" || i.selectedReward == null)
664
+ return i.description;
665
+ }
666
+ }
667
+ ], M = me(), D = F([]), L = G(() => M.rewards.map((o) => {
668
+ let i = "No expiry";
669
+ switch (o.option.type) {
670
+ case "VOUCHER":
671
+ i = `${o.option.collectibleConfig.options.maxUse} use(s), ${ee(o.option.collectibleConfig.options.validityOption || {})}`;
672
+ break;
673
+ case "LOYALTY":
674
+ i = `${o.option.earningOption.amount}, ${ee(o.option.validityOption || {})}`;
675
+ break;
676
+ }
677
+ return {
678
+ id: o._id,
679
+ name: o.name,
680
+ collectible: o.option,
681
+ collectibleConfig: o.collectibleConfig,
682
+ description: i
683
+ };
684
+ }));
685
+ G(() => []);
686
+ function y() {
687
+ const o = L.value;
688
+ for (let i = 0; i < o.length; i++) {
689
+ const S = o[i], h = n.value[i];
690
+ 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));
691
+ }
692
+ }
693
+ const n = F({});
694
+ return ie(n, y, { deep: !0 }), l({
695
+ showSheet: R,
696
+ hideSheet: A,
697
+ data: s
698
+ }), (o, i) => {
699
+ const S = w("FmTable"), h = w("FmButton"), e = w("FmSideSheet");
700
+ return C(), j(e, {
701
+ "max-width": 1e3,
702
+ modelValue: r(f),
703
+ "onUpdate:modelValue": i[2] || (i[2] = (t) => J(f) ? f.value = t : null),
704
+ header: "Referee reward"
705
+ }, {
706
+ "side-sheet-footer": V(() => [
707
+ a("div", cr, [
708
+ c(h, {
709
+ label: r(p)("connect.common.save"),
710
+ onClick: m,
711
+ disabled: r(W)().isLoading,
712
+ loading: r(W)().isLoading
713
+ }, null, 8, ["label", "disabled", "loading"]),
714
+ c(h, {
715
+ label: r(p)("connect.common.cancel"),
716
+ onClick: i[1] || (i[1] = (t) => A()),
717
+ variant: "tertiary"
718
+ }, null, 8, ["label"])
719
+ ])
720
+ ]),
721
+ default: V(() => [
722
+ c(X, { json: r(s) }, null, 8, ["json"]),
723
+ a("div", ir, [
724
+ a("div", dr, O(r(p)("connect.referral.refereeRewardSheet.referee_reward")), 1),
725
+ c(S, {
726
+ modelValue: r(n),
727
+ "onUpdate:modelValue": i[0] || (i[0] = (t) => J(n) ? n.value = t : null),
728
+ selection: "multiple",
729
+ "column-filter": r(D),
730
+ "column-defs": T,
731
+ "row-data": r(L),
732
+ "page-size": 10
733
+ }, null, 8, ["modelValue", "column-filter", "row-data"])
734
+ ])
735
+ ]),
736
+ _: 1
737
+ }, 8, ["modelValue"]);
738
+ };
739
+ }
740
+ }), 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 = {
741
+ key: 0,
742
+ class: "flex flex-col items-center justify-center gap-y-16 p-24"
743
+ }, 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" }, Kr = /* @__PURE__ */ q({
744
+ __name: "Overview",
745
+ setup(k) {
746
+ const { t: l } = Z(), { minor: I } = ue, p = Pe(), g = Q(), { confirmUpdateReferralRecord: f, updateReferralRecord: s } = he(), u = G(() => {
747
+ var e;
748
+ return ((e = g.referralProgram) == null ? void 0 : e.reward) ?? [];
749
+ }), m = F(null);
750
+ F(null);
751
+ const R = F(null), A = F(null), T = F(null), M = G(() => {
752
+ var e, t, d, _;
753
+ return [
754
+ {
755
+ label: "connect.referral.how_it_works.generate_link",
756
+ sublabel: l("connect.referral.how_it_works.generate_link_for_member"),
757
+ icon: "offline_share"
758
+ },
759
+ {
760
+ label: "connect.referral.how_it_works.referee_join_reward",
761
+ sublabel: `${((t = (e = g.referralProgram) == null ? void 0 : e.pf_refereeReward) == null ? void 0 : t.length) || 0} ${l("connect.referral.how_it_works.reward")}`,
762
+ action: l("connect.referral.actions.manage_reward"),
763
+ onClick: () => {
764
+ var b;
765
+ return (b = T.value) == null ? void 0 : b.showSheet(!0);
766
+ },
767
+ helperText: l(
768
+ "connect.referral.how_it_works.referee_join_reward_description"
769
+ ),
770
+ icon: "group_add"
771
+ },
772
+ {
773
+ label: "connect.referral.how_it_works.referee_meet_criteria",
774
+ sublabel: `${(d = g.referralProgram) == null ? void 0 : d.criteria.length} ${l("connect.referral.how_it_works.criteria")}`,
775
+ action: l("connect.referral.actions.manage_criteria"),
776
+ onClick: () => {
777
+ var b;
778
+ return (b = A.value) == null ? void 0 : b.showSheet(!0);
779
+ },
780
+ icon: "checklist_rtl"
781
+ },
782
+ {
783
+ label: "connect.referral.how_it_works.referer_get_reward",
784
+ sublabel: `${(_ = g.referralProgram) == null ? void 0 : _.reward.length} ${l("connect.referral.how_it_works.reward_tier")}`,
785
+ helperText: l("connect.referral.how_it_works.referral_tier_description"),
786
+ icon: "featured_seasonal_and_gifts"
787
+ }
788
+ ];
789
+ });
790
+ function D(e) {
791
+ var t;
792
+ (t = m.value) == null || t.onManageRewardGroup(e);
793
+ }
794
+ function L(e) {
795
+ var t;
796
+ (t = R.value) == null || t.showSheet(!0, {
797
+ groupIndex: e.groupIndex,
798
+ countIndex: e.countIndex
799
+ });
800
+ }
801
+ async function y(e) {
802
+ var P, x, v, E;
803
+ 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(
804
+ g.referralProgram
805
+ ), b = _.reward[e.groupIndex];
806
+ b.rewards[t] = e.referralCount;
807
+ const $ = b.rewards[t - 1], U = b.rewards[t + 1];
808
+ if ($ && $.threshold.to != d.threshold.from - 1) {
809
+ if (!await K.confirm(
810
+ l(
811
+ "connect.referral.referral_count.update.range_discontinuous.previous",
812
+ {
813
+ name: $.threshold.from,
814
+ from: $.threshold.from ?? 0,
815
+ to: $.threshold.to ?? 1 / 0,
816
+ newTo: d.threshold.from - 1
817
+ }
818
+ ),
819
+ l("connect.referral.referral_count.title"),
820
+ l("connect.referral.referral_count.remove.next_range")
821
+ ))
822
+ return;
823
+ $.threshold.to = d.threshold.from - 1;
824
+ }
825
+ if (U && U.threshold.from - 1 != d.threshold.to) {
826
+ if (!await K.confirm(
827
+ l("connect.program.tier.update.range_discontinuous.next", {
828
+ name: U.threshold.from,
829
+ from: U.threshold.from ?? 0,
830
+ to: U.threshold.to ?? 1 / 0,
831
+ newFrom: d.threshold.to ?? 1
832
+ }),
833
+ l("connect.program.tier.title"),
834
+ l("connect.program.tier.remove.next_range"),
835
+ l("connect.prompt.cancel")
836
+ ))
837
+ return;
838
+ U.threshold.from = (d.threshold.to ?? 0) + 1;
839
+ }
840
+ !U && !((v = d.threshold) != null && v.to) && (d.threshold.to = void 0), await o(_), (E = R.value) == null || E.hideSheet();
841
+ }
842
+ async function n(e) {
843
+ var d;
844
+ const t = H(g.referralProgram);
845
+ t.refereeReward = e, await o(t), (d = T.value) == null || d.hideSheet();
846
+ }
847
+ async function o(e) {
848
+ await f(), await I(
849
+ async () => {
850
+ await pe.update({
851
+ ...e,
852
+ updateReferralRecord: s.value
853
+ }), await g.readReferralProgram();
854
+ },
855
+ {
856
+ message: "Updating referral program",
857
+ successMessage: "Referral program updated successfully"
858
+ }
859
+ );
860
+ }
861
+ async function i(e) {
862
+ if (!await K.remove(
863
+ l("connect.referral.reward.confirm_remove_referral_tier"),
864
+ l("connect.referral.reward.remove_referral_tier"),
865
+ l("connect.prompt.confirm"),
866
+ l("connect.prompt.cancel")
867
+ ))
868
+ return;
869
+ const t = H(g.referralProgram);
870
+ t.reward.splice(e, 1), await o(t);
871
+ }
872
+ async function S(e, t) {
873
+ if (!await K.remove(
874
+ l("connect.referral.reward.confirm_remove_referral_count"),
875
+ l("connect.referral.reward.remove_referral_count"),
876
+ l("connect.prompt.confirm"),
877
+ l("connect.prompt.cancel")
878
+ ))
879
+ return;
880
+ const d = H(g.referralProgram), _ = d.reward[e].rewards[t + 1];
881
+ if (_) {
882
+ if (!await K.confirm(
883
+ l("connect.referral.referral_count.update.range_discontinuous.next", {
884
+ from: _.threshold.from ?? 0,
885
+ to: _.threshold.to ?? 1 / 0,
886
+ newFrom: d.reward[e].rewards[t].threshold.from
887
+ }),
888
+ l("connect.referral.referral_count.remove.title"),
889
+ l("connect.referral.referral_count.remove.next_range"),
890
+ l("connect.prompt.cancel")
891
+ ))
892
+ return;
893
+ _.threshold.from = d.reward[e].rewards[t].threshold.from;
894
+ }
895
+ d.reward[e].rewards.splice(t, 1), await o(d);
896
+ }
897
+ const h = [
898
+ {
899
+ header: l("connect.referral.reward.table.count"),
900
+ accessorFn: (e) => e.threshold.from == e.threshold.to ? `${e.threshold.from}` : e.threshold.to ? `${e.threshold.from} - ${e.threshold.to ?? "∞"}` : `${e.threshold.from}+`
901
+ },
902
+ {
903
+ header: l("connect.referral.reward.table.reward"),
904
+ accessorKey: "type",
905
+ accessorFn: (e) => {
906
+ var t;
907
+ return `${((t = e.pf_reward) == null ? void 0 : t.length) || 0} reward(s)`;
908
+ }
909
+ },
910
+ {
911
+ id: "actions",
912
+ meta: {
913
+ textAlign: "right"
914
+ },
915
+ cell(e) {
916
+ return te(oe.FmButton, {
917
+ variant: "tertiary",
918
+ icon: "delete",
919
+ iconColor: "neutral-gray-400",
920
+ class: "ml-auto",
921
+ onClick: (t) => {
922
+ t.stopPropagation(), console.log(e.row), S(e.row.original.groupIndex, e.row.index);
923
+ }
924
+ });
925
+ }
926
+ }
927
+ ];
928
+ return _e(async () => {
929
+ await g.readReferralProgram();
930
+ }), (e, t) => {
931
+ const d = w("FmCard"), _ = w("FmIcon"), b = w("FmTooltip"), $ = w("FmButton"), U = w("FmTable"), P = w("FmList");
932
+ return C(), B(Y, null, [
933
+ z("", !0),
934
+ c(d, {
935
+ variant: "outlined",
936
+ class: "flex flex-col gap-16 p-16"
937
+ }, {
938
+ default: V(() => [
939
+ a("div", mr, O(r(l)("connect.referral.how_it_works.title")), 1),
940
+ a("div", fr, [
941
+ (C(!0), B(Y, null, re(r(M), (x, v) => (C(), B("div", {
942
+ key: v,
943
+ class: de(["px-8", { "xs:!border-r": v % 2 == 0 }])
944
+ }, [
945
+ a("div", pr, [
946
+ c(_, {
947
+ name: x.icon,
948
+ color: "primary",
949
+ class: "bg-fm-color-system-warning-100 p-8 fm-corner-radius-md max-h-40 max-w-40"
950
+ }, null, 8, ["name"]),
951
+ a("div", null, [
952
+ a("div", hr, [
953
+ ce(O(r(l)(x.label)) + " ", 1),
954
+ x.helperText ? (C(), j(b, {
955
+ key: 0,
956
+ content: x.helperText
957
+ }, {
958
+ default: V(() => [
959
+ c(_, {
960
+ name: "help",
961
+ size: "sm",
962
+ outline: !0
963
+ })
964
+ ]),
965
+ _: 1
966
+ }, 8, ["content"])) : z("", !0)
967
+ ]),
968
+ a("div", vr, O(x.sublabel), 1),
969
+ x.action ? (C(), j($, {
970
+ key: 0,
971
+ variant: "plain",
972
+ label: x.action,
973
+ disabled: !r(p).isPremium,
974
+ class: "fm-typo-en-body-md-400 !p-0",
975
+ onClick: x.onClick
976
+ }, null, 8, ["label", "disabled", "onClick"])) : z("", !0)
977
+ ])
978
+ ])
979
+ ], 2))), 128))
980
+ ])
981
+ ]),
982
+ _: 1
983
+ }),
984
+ r(u) && r(u).length > 0 ? (C(), j(d, {
985
+ key: 1,
986
+ variant: "outlined",
987
+ class: "flex flex-col gap-16 p-16"
988
+ }, {
989
+ default: V(() => [
990
+ c(P, { separator: !0 }, {
991
+ default: V(() => [
992
+ (C(!0), B(Y, null, re(r(u), (x, v) => (C(), j(Ge, {
993
+ key: v,
994
+ "reward-group": x,
995
+ level: v,
996
+ onEdit: (E) => D(v),
997
+ onRemove: (E) => i(v),
998
+ onAddCount: t[0] || (t[0] = (E) => {
999
+ L({ groupIndex: E, countIndex: -1 });
1000
+ })
1001
+ }, {
1002
+ default: V(() => [
1003
+ a("div", _r, [
1004
+ c(U, {
1005
+ "row-data": x.rewards.map((E) => ({ ...E, groupIndex: v })),
1006
+ "column-defs": h,
1007
+ "hide-footer": !0,
1008
+ "page-size": 50,
1009
+ onRowClick: (E) => L({ groupIndex: v, countIndex: E.index })
1010
+ }, null, 8, ["row-data", "onRowClick"])
1011
+ ]),
1012
+ x.rewards.length ? z("", !0) : (C(), B("div", gr, [
1013
+ t[3] || (t[3] = a("div", { class: "flex flex-col gap-16 text-center" }, [
1014
+ a("div", { class: "fm-typo-en-title-sm-800" }, "Create progressive reward"),
1015
+ 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 ")
1016
+ ], -1)),
1017
+ c($, {
1018
+ variant: "secondary",
1019
+ label: "Add count",
1020
+ icon: "add",
1021
+ onClick: (E) => L({ groupIndex: v, countIndex: -1 })
1022
+ }, null, 8, ["onClick"])
1023
+ ]))
1024
+ ]),
1025
+ _: 2
1026
+ }, 1032, ["reward-group", "level", "onEdit", "onRemove"]))), 128))
1027
+ ]),
1028
+ _: 1
1029
+ })
1030
+ ]),
1031
+ _: 1
1032
+ })) : (C(), j(d, {
1033
+ key: 2,
1034
+ variant: "outlined",
1035
+ class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
1036
+ }, {
1037
+ default: V(() => [
1038
+ t[4] || (t[4] = a("img", {
1039
+ src: ge,
1040
+ class: "aspect-square w-[150px]"
1041
+ }, null, -1)),
1042
+ a("div", wr, [
1043
+ a("div", yr, O(r(l)("connect.referral.referral_tier_title")), 1),
1044
+ a("div", br, O(r(l)("connect.referral.referral_tier_description")), 1)
1045
+ ]),
1046
+ c($, {
1047
+ variant: "primary",
1048
+ label: r(l)("connect.referral.add_referral_tier"),
1049
+ icon: "add",
1050
+ disabled: !r(p).isPremium,
1051
+ onClick: t[1] || (t[1] = (x) => D(-1))
1052
+ }, null, 8, ["label", "disabled"])
1053
+ ]),
1054
+ _: 1
1055
+ })),
1056
+ c(we, {
1057
+ ref_key: "rewardGroupRef",
1058
+ ref: m
1059
+ }, null, 512),
1060
+ c(qe, {
1061
+ ref_key: "editReferralCountSheetRef",
1062
+ ref: R,
1063
+ onUpdate: y
1064
+ }, null, 512),
1065
+ c(sr, {
1066
+ ref_key: "manageCriteriaSheetRef",
1067
+ ref: A
1068
+ }, null, 512),
1069
+ c(ur, {
1070
+ ref_key: "editRefereeRewardSheetRef",
1071
+ ref: T,
1072
+ onUpdate: n
1073
+ }, null, 512)
1074
+ ], 64);
1075
+ };
1076
+ }
1077
+ });
1078
+ export {
1079
+ Kr as default
1080
+ };