@feedmepos/mf-connect 0.1.0-beta.17 → 0.1.0-beta.18

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 (83) hide show
  1. package/dist/{Analytic-BvsvVIaJ.js → Analytic-Cpbk-NKN.js} +8 -8
  2. package/dist/{App-B6i-kTvi.js → App-CSuWKpx9.js} +6 -6
  3. package/dist/{Broadcast-BMNY7jfz.js → Broadcast-0ZuJB2LN.js} +8 -8
  4. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-Cl-VwkQw.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BYeRznlh.js} +9 -9
  5. package/dist/{Card-BUxMxMv3.js → Card-OxKvWwWH.js} +16 -16
  6. package/dist/{Collections-fJ4dAA8O.js → Collections-BsyzZEMM.js} +4 -4
  7. package/dist/{Credit-DeLJMW7U.js → Credit-BrHz-837.js} +8 -8
  8. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-KB_zk3f0.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-B9BdGlxy.js} +28 -28
  9. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-Dy2q_1Kh.js → EffectSheet.vue_vue_type_style_index_0_lang-Dpl6tvDZ.js} +6 -6
  10. package/dist/{Experience-DNlf2fYa.js → Experience-BrngDPXy.js} +8 -8
  11. package/dist/{Game-BXj3DErV.js → Game-B2gmU0KP.js} +8 -8
  12. package/dist/{Index-FMFz2f9Z.js → Index-Dtv8pN8t.js} +7 -7
  13. package/dist/{Marketing-C8OjZOr2.js → Marketing-D-uobPZj.js} +5 -5
  14. package/dist/{Member-BgwbYQrK.js → Member-CFanAP9c.js} +4 -4
  15. package/dist/{MemberList-DMQUG_Kt.js → MemberList-Be9AkZx7.js} +14 -14
  16. package/dist/{MemberTransactions-CQO2cHn6.js → MemberTransactions-DZFzJjL1.js} +1 -1
  17. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-Ds_BwKa6.js → MessageInput.vue_vue_type_script_setup_true_lang-C9Hmp5AV.js} +2 -2
  18. package/dist/{Mission-rHomcJXG.js → Mission-C2LN6tmI.js} +8 -8
  19. package/dist/Overview-Dp5vZAD2.js +880 -0
  20. package/dist/{Point-Du07BO13.js → Point-LYWHAbfT.js} +8 -8
  21. package/dist/{Promotion-B1gbbfk2.js → Promotion-D9Uz3RVF.js} +9 -9
  22. package/dist/{Record-0GtBWXRO.js → Record-BQawMBFJ.js} +4 -4
  23. package/dist/Reward-DnOgjBmc.js +399 -0
  24. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-ClsXTutz.js +152 -0
  25. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-E7ADhGR7.js → RuleGroup.vue_vue_type_script_setup_true_lang-DzuiHZ4F.js} +15 -15
  26. package/dist/{Segment-Ci4BDnan.js → Segment-84pM7r21.js} +13 -13
  27. package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-I2KT0px7.js → SelectItems.vue_vue_type_script_setup_true_lang-PBG09_Xd.js} +2 -2
  28. package/dist/{Setting-Dc9rLPuI.js → Setting-DpI2EtLW.js} +8 -8
  29. package/dist/{Store-B94H-jff.js → Store-BuYCnY5B.js} +13 -13
  30. package/dist/{StoreRewards-Cho91MDd.js → StoreRewards-CoEqF7tq.js} +12 -12
  31. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-CDiZz1AW.js → StoreTransactions.vue_vue_type_script_setup_true_lang-C4GTSh2j.js} +9 -9
  32. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-BmEP5mI5.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-DSXJhgN5.js} +1 -1
  33. package/dist/{Tier-DO9pTl_C.js → Tier-ByFEVCB1.js} +15 -15
  34. package/dist/{Title-CgQD-_3y.js → Title-CixULZVV.js} +15 -15
  35. package/dist/{Transaction-DPmvpR7n.js → Transaction-C8O36Tic.js} +2 -2
  36. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-CJa-Tkws.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-DaFy1-0t.js} +7 -7
  37. package/dist/{Voucher-Bq5Ev_fv.js → Voucher-C17ZqMwt.js} +11 -11
  38. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-DeQTAvCe.js → VoucherEditor.vue_vue_type_script_setup_true_lang-DYBwXGNM.js} +10 -10
  39. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-DLFDd3Y3.js → ZodTextField.vue_vue_type_script_setup_true_lang-B6Y_0_0B.js} +1 -1
  40. package/dist/{app-CtaeuBcs.js → app-C4IiqNxo.js} +1 -1
  41. package/dist/{app-BT6qeigc.js → app-DWQ7FKR5.js} +28 -28
  42. package/dist/app.js +1 -1
  43. package/dist/{business-Db2WFn9o.js → business-Bo4XlSLO.js} +1 -1
  44. package/dist/{campaign-Bo2jmBiD.js → campaign-2GS-rWee.js} +2 -2
  45. package/dist/{collectible.enum-BR9zmyJv.js → collectible.enum-BTe7ThwY.js} +1 -1
  46. package/dist/{collection.fn-Drj_6HD1.js → collection.fn-HVdkty7e.js} +2 -2
  47. package/dist/{dto-BH8EtK7z.js → dto-Ddwu78pi.js} +51 -51
  48. package/dist/{effect-l8oNjQBm.js → effect-82Y4qyy9.js} +1 -1
  49. package/dist/{email-addresses-CBqWAs9Z.js → email-addresses-C7FOU34X.js} +1 -1
  50. package/dist/{export-D6S3dr04.js → export-BICOj_3Z.js} +3 -3
  51. package/dist/{helper-CS2Hx33Q.js → helper-DKlgiqoM.js} +1 -1
  52. package/dist/{index-C7kr1TMO.js → index-BU_p-Wxk.js} +97 -86
  53. package/dist/{index-XoOcBFvx.js → index-Bg2aYWbv.js} +4 -4
  54. package/dist/{index-DVryx2wz.js → index-BknjV1TY.js} +1 -1
  55. package/dist/{index-CATw-eQI.js → index-Bmd3L3d8.js} +2 -2
  56. package/dist/{index-5mZIFDhm.js → index-BywkQACO.js} +3 -3
  57. package/dist/{index-CXEJbUAO.js → index-C5V1DXJ3.js} +1 -1
  58. package/dist/{index-CVfN0Gmc.js → index-CAhgbG8r.js} +2 -2
  59. package/dist/{index-BfhjAqeE.js → index-CW8QD0w5.js} +3 -3
  60. package/dist/{index-Bj5M_at2.js → index-DKtYRLHP.js} +1 -1
  61. package/dist/{index-D2d2rTPz.js → index-DUg8bRnj.js} +1 -1
  62. package/dist/{index-Z61r-lWj.js → index-DYb8bAlK.js} +1 -1
  63. package/dist/{index-BsfC7C2D.js → index-NCYfGK0D.js} +1 -1
  64. package/dist/{index-CmN2dQk5.js → index-OpOMBjAq.js} +5 -5
  65. package/dist/index-vSDex5dq.js +53 -0
  66. package/dist/{index.esm2017-Dg7M2BO7.js → index.esm2017-OZYANK5V.js} +1 -1
  67. package/dist/{loading-DxWIhKJX.js → loading-CbuSa9Y3.js} +4 -4
  68. package/dist/{membership-Df7gtzWJ.js → membership-BpIwCoII.js} +3 -3
  69. package/dist/{money-Ck4ZGH4F.js → money-DPaFWGx6.js} +1 -1
  70. package/dist/{number-D8umDJ-5.js → number-BNn9X4rd.js} +1 -1
  71. package/dist/{objectid-BGnepAUg.js → objectid-DSfoThM2.js} +4 -4
  72. package/dist/{reward-5b5G4KYr.js → reward-BQFkCz55.js} +3 -3
  73. package/dist/{rule-BcLntzKp.js → rule-CGMa_mkm.js} +3 -3
  74. package/dist/{rule-builder-B_RDlrnZ.js → rule-builder-DOtc0rMB.js} +1 -1
  75. package/dist/{template-C-myFW3k.js → template-JT8E8lRm.js} +4 -4
  76. package/dist/{trigger-CAK3-5M9.js → trigger-D8chra-Q.js} +4 -4
  77. package/dist/{vue-i18n-BC0lAbnG.js → vue-i18n-CO7pDkoc.js} +248 -248
  78. package/dist/{xlsx-DNZb1t3l.js → xlsx-BGSVLeCK.js} +1 -1
  79. package/package.json +1 -1
  80. package/dist/Overview-CmwJjXeT.js +0 -864
  81. package/dist/Reward-aH7S8WL3.js +0 -375
  82. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-XdyqSqlC.js +0 -138
  83. package/dist/index-Ct847l9G.js +0 -50
@@ -0,0 +1,880 @@
1
+ import { defineComponent as N, resolveComponent as b, openBlock as w, createElementBlock as A, Fragment as j, createVNode as i, withCtx as k, createElementVNode as a, toDisplayString as L, unref as e, renderSlot as ue, ref as S, computed as O, watch as me, createBlock as D, isRef as q, resolveDynamicComponent as re, renderList as J, normalizeClass as ne, createTextVNode as fe, createCommentVNode as K, h as le, onMounted as pe } from "vue";
2
+ import { _ as ve } from "./campaign-CpzFl8Vr.js";
3
+ import { u as H } from "./vue-i18n-CO7pDkoc.js";
4
+ import { p as z, u as se } from "./loading-CbuSa9Y3.js";
5
+ import { J as Z } from "./JsonViewer-v8_C7l5N.js";
6
+ import { Z as E } from "./zod-Bg2FbC-D.js";
7
+ import { u as Y } from "./app-wDQR6dpb.js";
8
+ import { u as W, _ as he } from "./RewardGroup.vue_vue_type_script_setup_true_lang-ClsXTutz.js";
9
+ import { u as ge } from "./reward-BQFkCz55.js";
10
+ import "./index-BywkQACO.js";
11
+ import "./index-Bmd3L3d8.js";
12
+ import { l as oe, m as ye } from "./index-OpOMBjAq.js";
13
+ import "./index-Bg2aYWbv.js";
14
+ import { a as _e, b as we } from "./index-BU_p-Wxk.js";
15
+ import "./index-CAhgbG8r.js";
16
+ import "./index-DYb8bAlK.js";
17
+ import "./index-vSDex5dq.js";
18
+ import { C as be } from "./membership-BpIwCoII.js";
19
+ import { t as ae } from "./helper-DKlgiqoM.js";
20
+ import { c as M } from "./object-qECH92oz.js";
21
+ import { useDialog as xe, components as ie } from "@feedmepos/ui-library";
22
+ import { _ as Ce } from "./ZodTextField.vue_vue_type_script_setup_true_lang-B6Y_0_0B.js";
23
+ import { a as Re, _ as Se } from "./trigger-D8chra-Q.js";
24
+ import { O as Fe } from "./objectid-DSfoThM2.js";
25
+ import { r as de } from "./index-DUg8bRnj.js";
26
+ const ke = { class: "flex items-center justify-between flex-1 xs:hidden" }, $e = { class: "flex items-center gap-x-24 h-[80px] p-8 flex-1" }, Ie = { class: "flex-1" }, Pe = { class: "flex items-center gap-8" }, Ve = { class: "fm-typo-en-title-sm-800" }, Te = { class: "flex gap-8 items-center" }, Ae = { class: "space-y-4 hidden xs:block border-b border-fm-color-neutral-gray-100 px-16 flex-1" }, Ue = { class: "flex items-center justify-between" }, Le = { class: "flex items-center gap-x-24 h-[80px] p-8 flex-1" }, Ee = { class: "flex-1 space-y-4" }, Be = { class: "fm-typo-en-body-lg-600" }, Oe = /* @__PURE__ */ N({
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(x, { emit: f }) {
40
+ const { t: $ } = H(), u = f;
41
+ return (V, v) => {
42
+ const l = b("FmButton"), m = b("FmListItem");
43
+ return w(), A(j, null, [
44
+ i(m, {
45
+ onClick: v[4] || (v[4] = (d) => u("edit", x.level))
46
+ }, {
47
+ default: k(() => [
48
+ a("div", ke, [
49
+ a("div", $e, [
50
+ a("div", Ie, [
51
+ a("div", Pe, [
52
+ a("div", Ve, L(x.rewardGroup.name), 1)
53
+ ])
54
+ ])
55
+ ]),
56
+ a("div", Te, [
57
+ i(l, {
58
+ variant: "secondary",
59
+ label: e($)("connect.referral.reward.add_count"),
60
+ icon: "add",
61
+ onClick: v[0] || (v[0] = (d) => {
62
+ d.stopPropagation(), u("addCount", x.level);
63
+ })
64
+ }, null, 8, ["label"]),
65
+ i(l, {
66
+ icon: "delete",
67
+ onClick: v[1] || (v[1] = (d) => {
68
+ d.stopPropagation(), u("remove", x.level);
69
+ }),
70
+ variant: "tertiary"
71
+ })
72
+ ])
73
+ ]),
74
+ a("div", Ae, [
75
+ a("div", Ue, [
76
+ a("div", Le, [
77
+ a("div", Ee, [
78
+ a("div", null, [
79
+ a("div", Be, L(x.rewardGroup.name), 1)
80
+ ])
81
+ ])
82
+ ]),
83
+ i(l, {
84
+ variant: "tertiary",
85
+ icon: "delete",
86
+ onClick: v[2] || (v[2] = (d) => (d.stopPropagation(), u("remove", x.level)))
87
+ })
88
+ ]),
89
+ i(l, {
90
+ class: "w-full",
91
+ variant: "secondary",
92
+ label: "Add count",
93
+ disabled: !0,
94
+ icon: "add",
95
+ onClick: v[3] || (v[3] = (d) => (d.stopPropagation(), u("addCount", x.level)))
96
+ })
97
+ ])
98
+ ]),
99
+ _: 1
100
+ }),
101
+ ue(V.$slots, "default")
102
+ ], 64);
103
+ };
104
+ }
105
+ }), De = { class: "flex flex-col space-y-16 pr-12" }, Ge = { class: "flex gap-16 items-center" }, je = { class: "fm-typo-en-title-sm-800" }, Me = { class: "flex items-center gap-8" }, Ne = /* @__PURE__ */ N({
106
+ __name: "EditReferralCountSheet",
107
+ emits: ["update"],
108
+ setup(x, { expose: f, emit: $ }) {
109
+ const { t: u } = H(), V = $, v = S(!1), l = S({}), m = S(-1), d = S(-1), R = W(), T = _e.superRefine((t, o) => {
110
+ var C, F, P, Q, X, ee, te;
111
+ const h = d.value == -1 ? ((P = (F = (C = R.referralProgram) == null ? void 0 : C.reward[m.value]) == null ? void 0 : F.rewards) == null ? void 0 : P.length) || 0 : d.value, _ = (X = (Q = R.referralProgram) == null ? void 0 : Q.reward[m.value]) == null ? void 0 : X.rewards[h - 1], g = (te = (ee = R.referralProgram) == null ? void 0 : ee.reward[m.value]) == null ? void 0 : te.rewards[h + 1];
112
+ _ && t.threshold.from < _.threshold.from + 1 && o.addIssue({
113
+ code: "custom",
114
+ message: `The min referral must be at least ${_.threshold.from + 1}`,
115
+ path: ["option"]
116
+ }), g && t.threshold.to && g.threshold.to && t.threshold.to > g.threshold.to - 1 && o.addIssue({
117
+ code: "custom",
118
+ message: `The max referral must be at most ${g.threshold.to - 2}`,
119
+ path: ["option"]
120
+ });
121
+ }), I = O(() => {
122
+ const t = T.safeParse(l.value);
123
+ return t.success ? [] : t.error.errors;
124
+ });
125
+ function B() {
126
+ const t = T.safeParse(l.value);
127
+ t.success && V("update", {
128
+ groupIndex: m.value,
129
+ countIndex: d.value,
130
+ referralCount: t.data
131
+ });
132
+ }
133
+ async function G(t, o) {
134
+ var h;
135
+ v.value = t, t && typeof (o == null ? void 0 : o.countIndex) == "number" && o.countIndex >= 0 ? (m.value = o.groupIndex, d.value = o.countIndex, l.value = M(
136
+ (h = R.referralProgram) == null ? void 0 : h.reward[o.groupIndex].rewards[o.countIndex]
137
+ )) : (m.value = o.groupIndex, d.value = -1, l.value = {
138
+ threshold: {
139
+ from: 0,
140
+ to: null
141
+ },
142
+ rewards: []
143
+ }), c.value = [], c.value = r.value.map(
144
+ (_) => l.value.rewards.includes(_.id)
145
+ );
146
+ }
147
+ function U() {
148
+ v.value = !1;
149
+ }
150
+ const y = [
151
+ {
152
+ header: "Reward title",
153
+ accessorFn: (t) => t.name,
154
+ enableSorting: !0
155
+ },
156
+ {
157
+ id: "type",
158
+ header: "Reward type",
159
+ cell(t) {
160
+ return be[t.row.original.collectibleConfig.type].chip();
161
+ }
162
+ },
163
+ {
164
+ header: "Description",
165
+ accessorFn: (t) => t.description,
166
+ cell(t) {
167
+ const o = t.row.original;
168
+ if (o.collectible.type == "VOUCHER" || o.selectedReward == null)
169
+ return o.description;
170
+ }
171
+ }
172
+ ], s = ge(), p = S([]), r = O(() => s.rewards.map((t) => {
173
+ let o = "No expiry";
174
+ switch (t.option.type) {
175
+ case "VOUCHER":
176
+ o = `${t.option.collectibleConfig.options.maxUse} use(s), ${ae(t.option.collectibleConfig.options.validityOption || {})}`;
177
+ break;
178
+ case "LOYALTY":
179
+ o = `${t.option.earningOption.amount}, ${ae(t.option.validityOption || {})}`;
180
+ break;
181
+ }
182
+ return {
183
+ id: t._id,
184
+ name: t.name,
185
+ collectible: t.option,
186
+ collectibleConfig: t.collectibleConfig,
187
+ description: o
188
+ };
189
+ }));
190
+ O(() => []);
191
+ function n() {
192
+ const t = r.value;
193
+ for (let o = 0; o < t.length; o++) {
194
+ const h = t[o], _ = c.value[o];
195
+ _ && !l.value.rewards.includes(h.id) && l.value.rewards.push(h.id), !_ && l.value.rewards.includes(h.id) && (l.value.rewards = l.value.rewards.filter(
196
+ (g) => g != h.id
197
+ ));
198
+ }
199
+ }
200
+ const c = S({});
201
+ return me(c, n, { deep: !0 }), f({
202
+ showSheet: G,
203
+ hideSheet: U,
204
+ data: l
205
+ }), (t, o) => {
206
+ const h = b("FmStepperField"), _ = b("FmHelperText"), g = b("FmTable"), C = b("FmButton"), F = b("FmSideSheet");
207
+ return w(), D(F, {
208
+ "max-width": 1e3,
209
+ modelValue: e(v),
210
+ "onUpdate:modelValue": o[4] || (o[4] = (P) => q(v) ? v.value = P : null),
211
+ header: `${e(d) == -1 ? e(u)("connect.referral.editReferralCountSheet.add") : e(u)("connect.referral.editReferralCountSheet.edit")}`
212
+ }, {
213
+ "side-sheet-footer": k(() => [
214
+ a("div", Me, [
215
+ i(C, {
216
+ label: e(u)("connect.editTierSheet.submit"),
217
+ onClick: B,
218
+ disabled: e(I).length > 0 || e(Y)().isLoading,
219
+ loading: e(Y)().isLoading
220
+ }, null, 8, ["label", "disabled", "loading"]),
221
+ i(C, {
222
+ label: e(u)("connect.editTierSheet.cancel"),
223
+ onClick: o[3] || (o[3] = (P) => U()),
224
+ variant: "tertiary"
225
+ }, null, 8, ["label"])
226
+ ])
227
+ ]),
228
+ default: k(() => [
229
+ i(Z, { json: e(l) }, null, 8, ["json"]),
230
+ i(Z, { json: e(I) }, null, 8, ["json"]),
231
+ a("div", De, [
232
+ a("div", null, [
233
+ a("div", Ge, [
234
+ i(h, {
235
+ modelValue: e(l).threshold.from,
236
+ "onUpdate:modelValue": o[0] || (o[0] = (P) => e(l).threshold.from = P),
237
+ "show-steppers": !1,
238
+ rules: [e(E).ruleAtPath(e(T), "threshold.from")]
239
+ }, {
240
+ label: k(() => [
241
+ (w(), D(re(
242
+ e(E).toInputLabel(
243
+ e(E).typeAtPath(e(T), "threshold.from"),
244
+ e(u)("connect.editTierSheet.minExperience")
245
+ )
246
+ )))
247
+ ]),
248
+ _: 1
249
+ }, 8, ["modelValue", "rules"]),
250
+ i(h, {
251
+ modelValue: e(l).threshold.to,
252
+ "onUpdate:modelValue": o[1] || (o[1] = (P) => e(l).threshold.to = P),
253
+ "show-steppers": !1,
254
+ rules: [e(E).ruleAtPath(e(T), "threshold.to")]
255
+ }, {
256
+ label: k(() => [
257
+ (w(), D(re(
258
+ e(E).toInputLabel(
259
+ e(E).typeAtPath(e(T), "threshold.to"),
260
+ e(u)("connect.editTierSheet.maxExperience")
261
+ )
262
+ )))
263
+ ]),
264
+ _: 1
265
+ }, 8, ["modelValue", "rules"])
266
+ ]),
267
+ i(_, {
268
+ text: e(E).helperText(e(I), "option"),
269
+ state: e(E).helperState(e(I), "option")
270
+ }, null, 8, ["text", "state"]),
271
+ o[5] || (o[5] = a("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " When max. referral count is not set, it will default unlimited ", -1))
272
+ ]),
273
+ a("div", je, L(e(u)("connect.referral.editReferralCountSheet.referral_reward")), 1),
274
+ i(g, {
275
+ modelValue: e(c),
276
+ "onUpdate:modelValue": o[2] || (o[2] = (P) => q(c) ? c.value = P : null),
277
+ selection: "multiple",
278
+ "column-filter": e(p),
279
+ "column-defs": y,
280
+ "row-data": e(r),
281
+ "page-size": 10
282
+ }, null, 8, ["modelValue", "column-filter", "row-data"])
283
+ ])
284
+ ]),
285
+ _: 1
286
+ }, 8, ["modelValue", "header"]);
287
+ };
288
+ }
289
+ }), ze = { class: "space-y-16" }, He = { class: "grid grid-cols-3 gap-16" }, qe = { class: "fm-typo-en-title-sm-800" }, Ye = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, We = /* @__PURE__ */ N({
290
+ __name: "CriteriaTriggerInput",
291
+ props: {
292
+ modelValue: {
293
+ type: String
294
+ },
295
+ disabled: {
296
+ type: Boolean,
297
+ default: !1
298
+ }
299
+ },
300
+ emits: ["update:model-value"],
301
+ setup(x, { emit: f }) {
302
+ const $ = x, u = f, V = O(() => [
303
+ oe.enum.BILL_COMPLETED,
304
+ oe.enum.FEEDBACK
305
+ ].map((v) => Re[v]));
306
+ return (v, l) => {
307
+ const m = b("FmCard");
308
+ return w(), A("div", ze, [
309
+ l[0] || (l[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)),
310
+ a("div", He, [
311
+ (w(!0), A(j, null, J(e(V), (d) => (w(), D(m, {
312
+ key: d.name,
313
+ variant: "outlined",
314
+ disabled: $.disabled,
315
+ class: ne(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
316
+ "col-span-3": e(V).length == 1,
317
+ "border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": x.modelValue == d.value,
318
+ "hover:bg-fm-color-opacity-sm": x.modelValue != d.value
319
+ }]),
320
+ onClick: () => {
321
+ $.modelValue != d.value && !$.disabled && u("update:model-value", d.value);
322
+ }
323
+ }, {
324
+ default: k(() => [
325
+ a("div", qe, L(d.name), 1),
326
+ a("div", Ye, L(d.description), 1)
327
+ ]),
328
+ _: 2
329
+ }, 1032, ["disabled", "class", "onClick"]))), 128))
330
+ ])
331
+ ]);
332
+ };
333
+ }
334
+ }), Je = { class: "flex items-center gap-x-8" }, Ke = { class: "flex flex-col space-y-16 pr-12" }, Ze = {
335
+ key: 0,
336
+ class: "space-y-16"
337
+ }, Qe = { class: "flex items-center gap-8" }, Xe = /* @__PURE__ */ N({
338
+ __name: "EditCriteriaSheet",
339
+ emits: ["update"],
340
+ setup(x, { expose: f, emit: $ }) {
341
+ const { t: u } = H(), V = $, v = S(!1), l = S(-1), m = S({}), d = W(), R = we.superRefine((y, s) => {
342
+ y.name.length >= 50 && s.addIssue({
343
+ code: "custom",
344
+ message: "Name must be less than 50 characters"
345
+ }), y.name.length < 1 && s.addIssue({
346
+ code: "custom",
347
+ message: "Name is required"
348
+ });
349
+ }), T = O(() => {
350
+ const y = R.safeParse(m.value);
351
+ return y.success ? [] : y.error.errors;
352
+ });
353
+ function I(y, s) {
354
+ var p;
355
+ v.value = y, y && typeof s == "number" && s >= 0 ? (l.value = s, m.value = M(
356
+ (p = d.referralProgram) == null ? void 0 : p.criteria[s]
357
+ )) : (l.value = -1, m.value = {
358
+ _id: new Fe().toString(),
359
+ name: "",
360
+ type: "AUTO",
361
+ event: { type: "BILL_COMPLETED" }
362
+ });
363
+ }
364
+ function B() {
365
+ v.value = !1;
366
+ }
367
+ function G() {
368
+ const y = R.safeParse(m.value);
369
+ y.success && V("update", l.value, y.data);
370
+ }
371
+ function U(y) {
372
+ m.value.type = y, y == "AUTO" ? m.value.event = { type: "BILL_COMPLETED" } : m.value.event = void 0;
373
+ }
374
+ return f({
375
+ showSheet: I,
376
+ hideSheet: B,
377
+ data: m
378
+ }), (y, s) => {
379
+ const p = b("FmButton"), r = b("FmRadio"), n = b("FmRadioGroup"), c = b("FmSideSheet");
380
+ return w(), D(c, {
381
+ "max-width": 768,
382
+ modelValue: e(v),
383
+ "onUpdate:modelValue": s[5] || (s[5] = (t) => q(v) ? v.value = t : null)
384
+ }, {
385
+ "side-sheet-header": k(() => [
386
+ a("div", Je, [
387
+ i(p, {
388
+ icon: "arrow_back",
389
+ variant: "tertiary",
390
+ onClick: s[0] || (s[0] = (t) => I(!1))
391
+ }),
392
+ s[6] || (s[6] = fe("Add Criteria "))
393
+ ])
394
+ ]),
395
+ "side-sheet-footer": k(() => [
396
+ a("div", Qe, [
397
+ i(p, {
398
+ label: e(u)("connect.editTierSheet.submit"),
399
+ onClick: G,
400
+ disabled: e(T).length > 0 || e(Y)().isLoading,
401
+ loading: e(Y)().isLoading
402
+ }, null, 8, ["label", "disabled", "loading"]),
403
+ i(p, {
404
+ label: e(u)("connect.editTierSheet.cancel"),
405
+ onClick: s[4] || (s[4] = (t) => I(!1)),
406
+ variant: "tertiary"
407
+ }, null, 8, ["label"])
408
+ ])
409
+ ]),
410
+ default: k(() => [
411
+ i(Z, { json: e(m) }, null, 8, ["json"]),
412
+ a("div", Ke, [
413
+ s[10] || (s[10] = a("div", { class: "fm-typo-en-title-sm-600" }, "Program Criteria", -1)),
414
+ i(Ce, {
415
+ modelValue: e(m).name,
416
+ "onUpdate:modelValue": s[1] || (s[1] = (t) => e(m).name = t),
417
+ label: e(u)("connect.referral.editReferralTierSheet.name"),
418
+ schema: e(E).typeAtPath(e(R), "name")
419
+ }, null, 8, ["modelValue", "label", "schema"]),
420
+ s[11] || (s[11] = a("div", { class: "fm-typo-en-title-sm-600" }, "Configuration", -1)),
421
+ i(n, {
422
+ "model-value": e(m).type,
423
+ label: "Verify status",
424
+ "onUpdate:modelValue": U
425
+ }, {
426
+ default: k(() => [
427
+ i(r, {
428
+ value: "AUTO",
429
+ label: "Auto",
430
+ sublabel: "Verify based on rule configuration"
431
+ }),
432
+ i(r, {
433
+ value: "MANUAL",
434
+ label: "Manual",
435
+ sublabel: "Verify based on manual inspection"
436
+ })
437
+ ]),
438
+ _: 1
439
+ }, 8, ["model-value"]),
440
+ e(m).type == "AUTO" ? (w(), A(j, { key: 0 }, [
441
+ s[8] || (s[8] = a("div", { class: "fm-typo-en-title-sm-600" }, "Trigger", -1)),
442
+ s[9] || (s[9] = a("div", null, " Select trigger what referee need to complete in order for referral to earn reward ", -1)),
443
+ i(We, {
444
+ "model-value": e(m).event.type,
445
+ "onUpdate:modelValue": s[2] || (s[2] = (t) => e(m).event.type = t)
446
+ }, null, 8, ["model-value"]),
447
+ e(m).event.type == e(ye).enum.BILL_COMPLETED ? (w(), A("div", Ze, [
448
+ s[7] || (s[7] = a("div", { class: "fm-typo-en-title-sm-600" }, "Spending Criteria", -1)),
449
+ i(Se, {
450
+ "model-value": e(m).event.rule,
451
+ "onUpdate:modelValue": s[3] || (s[3] = (t) => e(m).event.rule = t)
452
+ }, null, 8, ["model-value"])
453
+ ])) : K("", !0)
454
+ ], 64)) : K("", !0)
455
+ ])
456
+ ]),
457
+ _: 1
458
+ }, 8, ["modelValue"]);
459
+ };
460
+ }
461
+ });
462
+ function ce() {
463
+ const x = S(!1), f = xe();
464
+ return {
465
+ confirmUpdateReferralRecord: async () => {
466
+ await new Promise((u) => {
467
+ f.open({
468
+ title: "Confirmation",
469
+ message: "This will change all referral settings? Would you like to update previous referral record?",
470
+ primaryActions: { text: "Update all", close: !0 },
471
+ secondaryActions: { text: "Update future only", close: !0 }
472
+ }).onPrimary(async () => {
473
+ x.value = !0, u();
474
+ }).onSecondary(async () => {
475
+ x.value = !1, u();
476
+ });
477
+ });
478
+ },
479
+ updateReferralRecord: x
480
+ };
481
+ }
482
+ const et = { class: "flex flex-col space-y-16 pr-12" }, tt = { class: "flex justify-between items-center" }, rt = /* @__PURE__ */ N({
483
+ __name: "ManageCriteriaSheet",
484
+ setup(x, { expose: f }) {
485
+ const { t: $ } = H(), { minor: u } = se, { confirmUpdateReferralRecord: V, updateReferralRecord: v } = ce(), l = S(!1), m = S({}), d = W(), R = S(
486
+ null
487
+ ), T = O(() => {
488
+ var p;
489
+ return (p = d.referralProgram) == null ? void 0 : p.criteria;
490
+ });
491
+ async function I(p) {
492
+ await V(), await u(async () => {
493
+ await de.update({
494
+ ...p,
495
+ updateReferralRecord: v.value
496
+ }), await d.readReferralProgram();
497
+ });
498
+ }
499
+ async function B(p, r) {
500
+ var t, o;
501
+ const n = p == -1 ? ((t = d.referralProgram) == null ? void 0 : t.criteria.length) || 0 : p, c = M(d.referralProgram);
502
+ c.criteria[n] = r, await I(c), (o = R.value) == null || o.showSheet(!1);
503
+ }
504
+ async function G(p) {
505
+ var c, t;
506
+ if (!await z.remove(
507
+ "Are you sure to remove criteria",
508
+ "Remove criteria",
509
+ $("connect.prompt.confirm"),
510
+ $("connect.prompt.cancel")
511
+ ))
512
+ return;
513
+ const r = p == -1 ? ((c = d.referralProgram) == null ? void 0 : c.criteria.length) || 0 : p, n = M(d.referralProgram);
514
+ n.criteria.splice(r, 1), await I(n), (t = R.value) == null || t.showSheet(!1);
515
+ }
516
+ const U = [
517
+ {
518
+ header: "Criteria title",
519
+ accessorFn: (p) => p.name
520
+ },
521
+ {
522
+ header: "Validity method",
523
+ accessorFn: (p) => p.type
524
+ },
525
+ {
526
+ header: "Actions",
527
+ cell(p) {
528
+ return [
529
+ le(ie.FmButton, {
530
+ variant: "tertiary",
531
+ icon: "delete",
532
+ iconColor: "neutral-gray-400",
533
+ onClick: (r) => {
534
+ r.stopPropagation(), G(p.row.index);
535
+ }
536
+ })
537
+ ];
538
+ }
539
+ }
540
+ ];
541
+ function y(p) {
542
+ l.value = p;
543
+ }
544
+ function s() {
545
+ l.value = !1;
546
+ }
547
+ return f({
548
+ showSheet: y,
549
+ hideSheet: s,
550
+ data: m
551
+ }), (p, r) => {
552
+ const n = b("FmButton"), c = b("FmTable"), t = b("FmSideSheet");
553
+ return w(), A(j, null, [
554
+ i(t, {
555
+ "max-width": 768,
556
+ modelValue: e(l),
557
+ "onUpdate:modelValue": r[2] || (r[2] = (o) => q(l) ? l.value = o : null),
558
+ header: "Manage Criteria"
559
+ }, {
560
+ default: k(() => [
561
+ a("div", et, [
562
+ a("div", tt, [
563
+ r[3] || (r[3] = a("div", null, [
564
+ a("div", { class: "fm-typo-en-title-sm-600" }, "Program Criteria"),
565
+ a("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Set participation rules to start your referral program ")
566
+ ], -1)),
567
+ i(n, {
568
+ label: "Add Criteria",
569
+ icon: "add",
570
+ variant: "secondary",
571
+ onClick: r[0] || (r[0] = (o) => {
572
+ var h;
573
+ return (h = e(R)) == null ? void 0 : h.showSheet(!0);
574
+ })
575
+ })
576
+ ]),
577
+ i(c, {
578
+ "row-data": e(T),
579
+ "hide-footer": !0,
580
+ "page-size": 100,
581
+ "column-defs": U,
582
+ onRowClick: r[1] || (r[1] = (o) => {
583
+ var h;
584
+ return (h = e(R)) == null ? void 0 : h.showSheet(!0, o.index);
585
+ })
586
+ }, null, 8, ["row-data"])
587
+ ])
588
+ ]),
589
+ _: 1
590
+ }, 8, ["modelValue"]),
591
+ i(Xe, {
592
+ ref_key: "editCriteriaSheetRef",
593
+ ref: R,
594
+ onUpdate: B
595
+ }, null, 512)
596
+ ], 64);
597
+ };
598
+ }
599
+ }), ot = { class: "fm-typo-en-title-sm-600" }, at = { class: "grid grid-cols-4 xs:grid-cols-2 gap-4 divide-x xs:divide-x-0" }, nt = { class: "flex gap-x-8" }, lt = { class: "fm-typo-body-lg-600" }, st = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, it = {
600
+ key: 0,
601
+ class: "mb-40"
602
+ }, dt = {
603
+ key: 1,
604
+ class: "flex flex-col items-center justify-center gap-y-16 p-24"
605
+ }, ct = { class: "flex flex-col gap-16 text-center" }, ut = { class: "fm-typo-en-title-sm-800" }, mt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ot = /* @__PURE__ */ N({
606
+ __name: "Overview",
607
+ setup(x) {
608
+ const { t: f } = H(), { minor: $ } = se, u = W(), { confirmUpdateReferralRecord: V, updateReferralRecord: v } = ce(), l = O(() => {
609
+ var r;
610
+ return ((r = u.referralProgram) == null ? void 0 : r.reward) ?? [];
611
+ }), m = S(null);
612
+ S(null);
613
+ const d = S(null), R = S(null), T = O(() => {
614
+ var r, n;
615
+ return [
616
+ {
617
+ label: "connect.referral.how_it_works.generate_link",
618
+ sublabel: f("connect.referral.how_it_works.generate_link_for_member"),
619
+ icon: "offline_share"
620
+ },
621
+ {
622
+ label: "connect.referral.how_it_works.referee_join_reward",
623
+ sublabel: "0 reward",
624
+ action: f("connect.referral.actions.manage_reward"),
625
+ icon: "group_add"
626
+ },
627
+ {
628
+ label: "connect.referral.how_it_works.referee_meet_criteria",
629
+ sublabel: `${(r = u.referralProgram) == null ? void 0 : r.criteria.length} criteria`,
630
+ action: f("connect.referral.actions.manage_criteria"),
631
+ onClick: () => {
632
+ var c;
633
+ return (c = R.value) == null ? void 0 : c.showSheet(!0);
634
+ },
635
+ icon: "checklist_rtl"
636
+ },
637
+ {
638
+ label: "connect.referral.how_it_works.referer_get_reward",
639
+ sublabel: `${(n = u.referralProgram) == null ? void 0 : n.reward.length} configured tier(s)`,
640
+ icon: "featured_seasonal_and_gifts"
641
+ }
642
+ ];
643
+ });
644
+ function I(r) {
645
+ var n;
646
+ (n = m.value) == null || n.onManageRewardGroup(r);
647
+ }
648
+ function B(r) {
649
+ var n;
650
+ (n = d.value) == null || n.showSheet(!0, {
651
+ groupIndex: r.groupIndex,
652
+ countIndex: r.countIndex
653
+ });
654
+ }
655
+ async function G(r) {
656
+ var g, C, F, P;
657
+ const n = r.countIndex == -1 ? ((C = (g = u.referralProgram) == null ? void 0 : g.reward[r.groupIndex]) == null ? void 0 : C.rewards.length) || 0 : r.countIndex || 0, c = r.referralCount, t = M(
658
+ u.referralProgram
659
+ ), o = t.reward[r.groupIndex];
660
+ o.rewards[n] = r.referralCount;
661
+ const h = o.rewards[n - 1], _ = o.rewards[n + 1];
662
+ if (h && h.threshold.to != c.threshold.from - 1) {
663
+ if (!await z.confirm(
664
+ f("connect.program.tier.update.range_discontinuous.previous", {
665
+ name: h.threshold.from,
666
+ from: h.threshold.from ?? 0,
667
+ to: h.threshold.to ?? 1 / 0,
668
+ newTo: c.threshold.from - 1
669
+ }),
670
+ f("connect.program.tier.title"),
671
+ f("connect.program.tier.remove.next_range")
672
+ ))
673
+ return;
674
+ h.threshold.to = c.threshold.from - 1;
675
+ }
676
+ if (_ && _.threshold.from - 1 != c.threshold.to) {
677
+ if (!await z.confirm(
678
+ f("connect.program.tier.update.range_discontinuous.next", {
679
+ name: _.threshold.from,
680
+ from: _.threshold.from ?? 0,
681
+ to: _.threshold.to ?? 1 / 0,
682
+ newFrom: c.threshold.to ?? 1
683
+ }),
684
+ f("connect.program.tier.title"),
685
+ f("connect.program.tier.remove.next_range"),
686
+ f("connect.prompt.cancel")
687
+ ))
688
+ return;
689
+ _.threshold.from = (c.threshold.to ?? 0) + 1;
690
+ }
691
+ !_ && !((F = c.threshold) != null && F.to) && (c.threshold.to = void 0), await U(t), (P = d.value) == null || P.hideSheet();
692
+ }
693
+ async function U(r) {
694
+ await V(), await $(async () => {
695
+ await de.update({
696
+ ...r,
697
+ updateReferralRecord: v.value
698
+ }), await u.readReferralProgram();
699
+ });
700
+ }
701
+ async function y(r) {
702
+ if (!await z.remove(
703
+ "Are you sure to remove referral tier",
704
+ "Remove referral tier",
705
+ f("connect.prompt.confirm"),
706
+ f("connect.prompt.cancel")
707
+ ))
708
+ return;
709
+ const n = M(u.referralProgram);
710
+ n.reward.splice(r, 1), await U(n);
711
+ }
712
+ async function s(r, n) {
713
+ if (!await z.remove(
714
+ "Are you sure to remove referral count",
715
+ "Remove referral tier",
716
+ f("connect.prompt.confirm"),
717
+ f("connect.prompt.cancel")
718
+ ))
719
+ return;
720
+ const c = M(u.referralProgram);
721
+ c.reward[r].rewards.splice(n, 1), await U(c);
722
+ }
723
+ const p = [
724
+ {
725
+ header: "Referral Count",
726
+ accessorFn: (r) => `${r.threshold.from} - ${r.threshold.to ?? "∞"}`
727
+ },
728
+ {
729
+ header: "Rewards",
730
+ accessorKey: "type",
731
+ accessorFn: (r) => `${r.rewards.length} reward(s)`
732
+ },
733
+ {
734
+ id: "actions",
735
+ meta: {
736
+ textAlign: "right"
737
+ },
738
+ cell(r) {
739
+ return le(ie.FmButton, {
740
+ variant: "tertiary",
741
+ icon: "delete",
742
+ iconColor: "neutral-gray-400",
743
+ class: "ml-auto",
744
+ onClick: (n) => {
745
+ n.stopPropagation(), console.log(r.row), s(r.row.original.groupIndex, r.row.index);
746
+ }
747
+ });
748
+ }
749
+ }
750
+ ];
751
+ return pe(async () => {
752
+ await u.readReferralProgram();
753
+ }), (r, n) => {
754
+ const c = b("FmCard"), t = b("FmIcon"), o = b("FmButton"), h = b("FmTable"), _ = b("FmList");
755
+ return w(), A(j, null, [
756
+ K("", !0),
757
+ i(c, {
758
+ variant: "outlined",
759
+ class: "flex flex-col gap-16 p-16"
760
+ }, {
761
+ default: k(() => [
762
+ a("div", ot, L(e(f)("connect.referral.how_it_works.title")), 1),
763
+ a("div", at, [
764
+ (w(!0), A(j, null, J(e(T), (g, C) => (w(), A("div", {
765
+ key: C,
766
+ class: ne(["px-8", { "xs:!border-r": C % 2 == 0 }])
767
+ }, [
768
+ a("div", nt, [
769
+ i(t, {
770
+ name: g.icon,
771
+ color: "primary",
772
+ class: "bg-fm-color-system-warning-100 p-8 fm-corner-radius-md max-h-40 max-w-40"
773
+ }, null, 8, ["name"]),
774
+ a("div", null, [
775
+ a("div", lt, L(e(f)(g.label)), 1),
776
+ a("div", st, L(g.sublabel), 1),
777
+ i(o, {
778
+ variant: "plain",
779
+ label: g.action,
780
+ size: "sm",
781
+ class: "fm-typo-en-body-md-400",
782
+ onClick: g.onClick
783
+ }, null, 8, ["label", "onClick"])
784
+ ])
785
+ ])
786
+ ], 2))), 128))
787
+ ])
788
+ ]),
789
+ _: 1
790
+ }),
791
+ e(l) && e(l).length > 0 ? (w(), D(c, {
792
+ key: 1,
793
+ variant: "outlined",
794
+ class: "flex flex-col gap-16 p-16"
795
+ }, {
796
+ default: k(() => [
797
+ i(_, { separator: !0 }, {
798
+ default: k(() => [
799
+ (w(!0), A(j, null, J(e(l), (g, C) => (w(), D(Oe, {
800
+ key: C,
801
+ "reward-group": g,
802
+ level: C,
803
+ onEdit: (F) => I(C),
804
+ onRemove: (F) => y(C),
805
+ onAddCount: n[1] || (n[1] = (F) => {
806
+ B({ groupIndex: F, countIndex: -1 });
807
+ })
808
+ }, {
809
+ default: k(() => [
810
+ g.rewards.length > 0 ? (w(), A("div", it, [
811
+ i(h, {
812
+ "row-data": g.rewards.map((F) => ({ ...F, groupIndex: C })),
813
+ "column-defs": p,
814
+ "hide-footer": !0,
815
+ "page-size": 50,
816
+ onRowClick: (F) => B({ groupIndex: C, countIndex: F.index })
817
+ }, null, 8, ["row-data", "onRowClick"])
818
+ ])) : (w(), A("div", dt, [
819
+ n[4] || (n[4] = a("div", { class: "flex flex-col gap-16 text-center" }, [
820
+ a("div", { class: "fm-typo-en-title-sm-800" }, "Create progressive reward"),
821
+ 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 ")
822
+ ], -1)),
823
+ i(o, {
824
+ variant: "secondary",
825
+ label: "Add count",
826
+ icon: "add",
827
+ onClick: n[0] || (n[0] = (F) => I(-1))
828
+ })
829
+ ]))
830
+ ]),
831
+ _: 2
832
+ }, 1032, ["reward-group", "level", "onEdit", "onRemove"]))), 128))
833
+ ]),
834
+ _: 1
835
+ })
836
+ ]),
837
+ _: 1
838
+ })) : (w(), D(c, {
839
+ key: 2,
840
+ variant: "outlined",
841
+ class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
842
+ }, {
843
+ default: k(() => [
844
+ n[5] || (n[5] = a("img", {
845
+ src: ve,
846
+ class: "aspect-square w-[150px]"
847
+ }, null, -1)),
848
+ a("div", ct, [
849
+ a("div", ut, L(e(f)("connect.referral.referral_tier_title")), 1),
850
+ a("div", mt, L(e(f)("connect.referral.referral_tier_description")), 1)
851
+ ]),
852
+ i(o, {
853
+ variant: "primary",
854
+ label: e(f)("connect.referral.add_referral_tier"),
855
+ icon: "add",
856
+ onClick: n[2] || (n[2] = (g) => I(-1))
857
+ }, null, 8, ["label"])
858
+ ]),
859
+ _: 1
860
+ })),
861
+ i(he, {
862
+ ref_key: "rewardGroupRef",
863
+ ref: m
864
+ }, null, 512),
865
+ i(Ne, {
866
+ ref_key: "editReferralCountSheetRef",
867
+ ref: d,
868
+ onUpdate: G
869
+ }, null, 512),
870
+ i(rt, {
871
+ ref_key: "manageCriteriaSheetRef",
872
+ ref: R
873
+ }, null, 512)
874
+ ], 64);
875
+ };
876
+ }
877
+ });
878
+ export {
879
+ Ot as default
880
+ };