@feedmepos/mf-connect 0.1.98-beta.39 → 0.1.98-beta.40

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/package.json +1 -1
  2. package/dist/App-DwjQisFZ.js +0 -4785
  3. package/dist/AuditLogs-DMGqmriL.js +0 -2014
  4. package/dist/Bin-4wvIqogM.js +0 -166
  5. package/dist/Broadcast-DPpuSZ8_.js +0 -269
  6. package/dist/CampaignAnalytic-CXFDo2X_.js +0 -1826
  7. package/dist/CampaignTypeDialog.vue_vue_type_script_setup_true_lang-SLoy1-Kd.js +0 -122
  8. package/dist/Card-C8SA6un0.js +0 -911
  9. package/dist/ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js +0 -97
  10. package/dist/Collections-BCpSiM_4.js +0 -541
  11. package/dist/Credit-C8RTBpP7.js +0 -286
  12. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-Du7fRSZC.js +0 -128
  13. package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-eIoPtgO5.js +0 -58
  14. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-0OI5QzpR.js +0 -3382
  15. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-CJTduNh3.js +0 -351
  16. package/dist/Experience-Bg3kFQQE.js +0 -285
  17. package/dist/FileSaver.min-DMUuMi9w.js +0 -74
  18. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js +0 -129
  19. package/dist/FmTableSelection.vue_vue_type_script_setup_true_lang-DzcUc0_w.js +0 -52
  20. package/dist/Game-D3DbkRUj.js +0 -356
  21. package/dist/GiftCardSetup-CxlMM4up.js +0 -542
  22. package/dist/Grab-DvEK8ixP.js +0 -301
  23. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-BBK-UrEe.js +0 -145
  24. package/dist/Index-Do_9DXuY.js +0 -259
  25. package/dist/JsonViewer-v8_C7l5N.js +0 -87
  26. package/dist/LocationPicker.vue_vue_type_script_setup_true_lang-BKPGBYiU.js +0 -48
  27. package/dist/LottieAnimation.vue_vue_type_script_setup_true_lang-D6wJN9Gj.js +0 -18737
  28. package/dist/LoyaltyDashboard-B4WqycGN.js +0 -1345
  29. package/dist/MainLayout-DdxLaufS.js +0 -143
  30. package/dist/Marketing-CcFEMwKB.js +0 -236
  31. package/dist/MarketingMaterialEdit-DoYFaMf7.js +0 -1036
  32. package/dist/Member-BussgBln.js +0 -281
  33. package/dist/MemberList-BXJxSsjo.js +0 -1603
  34. package/dist/MemberOverview-wL_ailso.js +0 -58
  35. package/dist/MemberTransactions-O-XY5nz3.js +0 -45
  36. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-DsxrIO0r.js +0 -60957
  37. package/dist/MetricInfoTooltip.vue_vue_type_script_setup_true_lang-Bg_0YlwG.js +0 -38
  38. package/dist/Mission-CPkM-8Ns.js +0 -360
  39. package/dist/Overview-BJjpYUJN.js +0 -1080
  40. package/dist/Overview-C5KF_Jxj.js +0 -1316
  41. package/dist/Point-FDFwR3Hk.js +0 -288
  42. package/dist/Promotion-qtucKxn0.js +0 -423
  43. package/dist/Queue-d91tocPX.js +0 -261
  44. package/dist/Record-CvkK2iLq.js +0 -342
  45. package/dist/Review-C_zLGtzU.js +0 -45
  46. package/dist/ReviewFacebookCallback-Bidg3P76.js +0 -238
  47. package/dist/ReviewGoogleCallback-DL0lxMBL.js +0 -213
  48. package/dist/Reward-BTsQaI-J.js +0 -442
  49. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-BjxA4eMX.js +0 -150
  50. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-D4NIDc-C.js +0 -1913
  51. package/dist/Segment-BgFyB3BK.js +0 -1017
  52. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-CkhjFNvZ.js +0 -181
  53. package/dist/SendCollectionSheet.vue_vue_type_script_setup_true_lang-HYbRyACe.js +0 -189
  54. package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-7dv3cAW3.js +0 -226
  55. package/dist/Setting-BxHoCSxw.js +0 -2047
  56. package/dist/SettingAdvertisements-WfvuE4fA.js +0 -264
  57. package/dist/Settings-B42SAvEx.js +0 -179
  58. package/dist/Store-BnvWfCy-.js +0 -2413
  59. package/dist/StoreRewards-BRzAMqR-.js +0 -540
  60. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-C3FJr1L5.js +0 -1075
  61. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-UZYzUcif.js +0 -7007
  62. package/dist/Tier-BrzLNat2.js +0 -972
  63. package/dist/Title-EnlaNXld.js +0 -569
  64. package/dist/Transaction-BiXNxUGX.js +0 -39
  65. package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-Db5_DKQ0.js +0 -130
  66. package/dist/Voucher-C2dyk-jj.js +0 -444
  67. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-DPE24a-J.js +0 -421
  68. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-CI1HM9HA.js +0 -56
  69. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +0 -9
  70. package/dist/app-Bt8HrAEr.js +0 -60740
  71. package/dist/app-wDQR6dpb.js +0 -39
  72. package/dist/app.js +0 -7
  73. package/dist/business-BwtQpfUr.js +0 -82
  74. package/dist/campaign-B6U9lwKi.js +0 -255
  75. package/dist/campaign-C6Cb9s3C.js +0 -100
  76. package/dist/campaign-CpzFl8Vr.js +0 -4
  77. package/dist/campaign.enum-Dx-Zo68Q.js +0 -26
  78. package/dist/campaign.fn-B0x2EGhw.js +0 -776
  79. package/dist/collectible.enum-Liy2wH3s.js +0 -19
  80. package/dist/collection.fn-DfoA9sJV.js +0 -26
  81. package/dist/duplicateCampaign-Cnq5N-V8.js +0 -51
  82. package/dist/effect-B2REbrv8.js +0 -89
  83. package/dist/email-addresses-BzmOsxLn.js +0 -705
  84. package/dist/export-jHpRhPQu.js +0 -97
  85. package/dist/feedme.ico +0 -0
  86. package/dist/google-C3S8u0mT.js +0 -4
  87. package/dist/helper-DQAHX1kX.js +0 -86
  88. package/dist/index-4GG-yjdN.js +0 -2963
  89. package/dist/index-BWgMbKOB.js +0 -85
  90. package/dist/index-BccUpf0U.js +0 -3
  91. package/dist/index-BkgkJkVs.js +0 -8919
  92. package/dist/index-C0PKVTf9.js +0 -32
  93. package/dist/index-C8cXXcLk.js +0 -45
  94. package/dist/index-CTTGf4TM.js +0 -151
  95. package/dist/index-C_H8jFYf.js +0 -2743
  96. package/dist/index-CuvNtC_M.js +0 -61
  97. package/dist/index-DJN4auwx.js +0 -146
  98. package/dist/index-DMr9ohGV.js +0 -1139
  99. package/dist/index-DQTo_ytu.js +0 -31
  100. package/dist/index-DW7-0rf_.js +0 -53
  101. package/dist/index-Da7J83jM.js +0 -2706
  102. package/dist/index-Di1Z4vLS.js +0 -27550
  103. package/dist/index-FoKZGh7Z.js +0 -67
  104. package/dist/index-N25Px7RQ.js +0 -72
  105. package/dist/index-PgblELTo.js +0 -897
  106. package/dist/index-STBMTK1u.js +0 -28900
  107. package/dist/index-hP3Mgc0u.js +0 -55
  108. package/dist/index-vh86FiIQ.js +0 -10
  109. package/dist/index.esm2017-DV56jzfJ.js +0 -3069
  110. package/dist/loading-D__sDcq1.js +0 -72
  111. package/dist/lodash-DgkDIHoV.js +0 -3678
  112. package/dist/membership-CBjt1MGx.js +0 -255
  113. package/dist/moment-D7p2TMB-.js +0 -2583
  114. package/dist/money-BFUbPKDM.js +0 -15
  115. package/dist/number-CJb8OUa3.js +0 -12
  116. package/dist/object-BYyQ0PZp.js +0 -18
  117. package/dist/objectId-dwaoBfJX.js +0 -7
  118. package/dist/objectid-BMUFNR9T.js +0 -145
  119. package/dist/plugins-D95ZeD-9.js +0 -1788
  120. package/dist/remy-Qz_pNsUS.js +0 -13
  121. package/dist/reward-CSfV_XFK.js +0 -36
  122. package/dist/rule-DIzVHy2z.js +0 -1969
  123. package/dist/rule-builder-DF7fCvec.js +0 -126
  124. package/dist/string-Gcy5IM_H.js +0 -32
  125. package/dist/style.css +0 -4
  126. package/dist/template-r3lAQP1B.js +0 -188
  127. package/dist/tier-BJDhpH6X.js +0 -4
  128. package/dist/tiers/tier=1.png +0 -0
  129. package/dist/tiers/tier=2.png +0 -0
  130. package/dist/tiers/tier=3.png +0 -0
  131. package/dist/tiers/tier=4.png +0 -0
  132. package/dist/timezone-D40qRUoz.js +0 -20
  133. package/dist/titles/type=diamond.png +0 -0
  134. package/dist/titles/type=drinks.png +0 -0
  135. package/dist/titles/type=food.png +0 -0
  136. package/dist/titles/type=heart.png +0 -0
  137. package/dist/titles/type=medal.png +0 -0
  138. package/dist/titles/type=spend.png +0 -0
  139. package/dist/titles/type=thank-you.png +0 -0
  140. package/dist/titles/type=thumbs-up.png +0 -0
  141. package/dist/titles/type=years.png +0 -0
  142. package/dist/transaction.fn-DV-cpfOj.js +0 -64
  143. package/dist/trigger-BEJaSv5R.js +0 -213
  144. package/dist/tslib.es6-BCqqvLQ_.js +0 -44
  145. package/dist/type_drinks-D6jnpvwV.js +0 -4
  146. package/dist/useMarketingMaterialActions-Bd5BDfE1.js +0 -96
  147. package/dist/usePagination-DLIo76-X.js +0 -220
  148. package/dist/user-DtEjuhyM.js +0 -55
  149. package/dist/vue-i18n-dQ1XCaUv.js +0 -2365
  150. package/dist/xlsx-BUMZsTov.js +0 -15491
  151. package/dist/zod-B_pVZhsV.js +0 -91
@@ -1,1080 +0,0 @@
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-dQ1XCaUv.js";
4
- import { u as ue } from "./loading-D__sDcq1.js";
5
- import { p as K } from "./plugins-D95ZeD-9.js";
6
- import { J as X } from "./JsonViewer-v8_C7l5N.js";
7
- import { Z as N } from "./zod-B_pVZhsV.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-BjxA4eMX.js";
10
- import { u as me } from "./reward-CSfV_XFK.js";
11
- import { a as ye, b as be } from "./index-Da7J83jM.js";
12
- import "./index-4GG-yjdN.js";
13
- import "./index-BkgkJkVs.js";
14
- import "./index-Di1Z4vLS.js";
15
- import { c as le, a as se } from "./index-PgblELTo.js";
16
- import "./index-hP3Mgc0u.js";
17
- import { C as fe } from "./membership-CBjt1MGx.js";
18
- import { t as ee } from "./helper-DQAHX1kX.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-CI1HM9HA.js";
22
- import { a as Re, _ as Se, b as Fe } from "./trigger-BEJaSv5R.js";
23
- import { O as ke } from "./objectid-BMUFNR9T.js";
24
- import { c as $e } from "./string-Gcy5IM_H.js";
25
- import { r as pe } from "./index-C0PKVTf9.js";
26
- import { u as Pe } from "./business-BwtQpfUr.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
- };