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

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