@feedmepos/mf-connect 0.1.0-beta.20 → 0.1.0-beta.21

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 (82) hide show
  1. package/dist/{Analytic-CRdCf6rP.js → Analytic-CZ8gfj2V.js} +8 -8
  2. package/dist/{App-CJ9oNLV2.js → App-Da9h7lhI.js} +58 -57
  3. package/dist/{Broadcast-CatMmvNa.js → Broadcast-m6ehTw7F.js} +8 -8
  4. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CYs2Sl5w.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BTKA2Ygl.js} +8 -8
  5. package/dist/{Card-C3D59N5q.js → Card-DqZveZ44.js} +15 -15
  6. package/dist/{Collections-BuCo1O9x.js → Collections-XIY6SLgQ.js} +4 -4
  7. package/dist/{Credit-Babu5EE5.js → Credit-B6Yg3_al.js} +8 -8
  8. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-DWJw6H-M.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-D1gub9ZP.js} +27 -27
  9. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-DSEvgx4z.js → EffectSheet.vue_vue_type_style_index_0_lang-tRUwA8zh.js} +6 -6
  10. package/dist/{Experience-XMGv8EGx.js → Experience-CsoneWLZ.js} +8 -8
  11. package/dist/{Game-Cz7YHbx1.js → Game-B029f9yE.js} +8 -8
  12. package/dist/Index-B2LvLfrR.js +226 -0
  13. package/dist/{Marketing-8E28mxPt.js → Marketing-DUTyDRXu.js} +5 -5
  14. package/dist/{Member-4y7vThK4.js → Member-CATybMaC.js} +4 -4
  15. package/dist/{MemberList-DFoEZqv5.js → MemberList-DxvQ7DnC.js} +14 -14
  16. package/dist/{MemberTransactions-CEud4gEU.js → MemberTransactions-fEZyBY9P.js} +1 -1
  17. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-SVX4fpOu.js → MessageInput.vue_vue_type_script_setup_true_lang-BCCEsJZj.js} +2 -2
  18. package/dist/{Mission-ChRlRXfM.js → Mission-Cl3O0ULj.js} +8 -8
  19. package/dist/Overview-BVI2xGvT.js +1014 -0
  20. package/dist/{Point-CLIcUoCI.js → Point-DSVn47pK.js} +8 -8
  21. package/dist/{Promotion-BAimCBQb.js → Promotion-C4HyMpPg.js} +9 -9
  22. package/dist/Record-BSKXwUu2.js +187 -0
  23. package/dist/{Reward-xaALJ6xT.js → Reward-Cus20Wq5.js} +10 -10
  24. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-BbpCY-d1.js → RewardGroup.vue_vue_type_script_setup_true_lang-Dm6Vgx8-.js} +12 -12
  25. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-wncxK2In.js → RuleGroup.vue_vue_type_script_setup_true_lang-CqMCdTsv.js} +14 -14
  26. package/dist/{Segment-BbholIXr.js → Segment-DAHJ2FYV.js} +13 -13
  27. package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-BiT1S0GE.js → SelectItems.vue_vue_type_script_setup_true_lang-DpkIgpqy.js} +2 -2
  28. package/dist/{Setting-CuZ3rq-3.js → Setting-D7dKlTiZ.js} +8 -8
  29. package/dist/{Store-C_BMTPfl.js → Store-DQdWn1Dw.js} +19 -19
  30. package/dist/{StoreRewards-D0W2z3Gq.js → StoreRewards-Cut9mJGn.js} +12 -12
  31. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-E-QcGATx.js → StoreTransactions.vue_vue_type_script_setup_true_lang-BQscw_Di.js} +10 -10
  32. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-C-ogUCbh.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-BVzz2Zkl.js} +1 -1
  33. package/dist/{Tier-BfST7Yfl.js → Tier-DGpNybHO.js} +15 -15
  34. package/dist/{Title-CEdQyyyg.js → Title-D5y8GEwE.js} +15 -15
  35. package/dist/{Transaction-CYbYZrpN.js → Transaction-CCnZouEv.js} +2 -2
  36. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-Bgdt5pzT.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-Cr9DV7hr.js} +6 -6
  37. package/dist/{Voucher-BGFUSHh3.js → Voucher-BJ6RC4SS.js} +11 -11
  38. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-jektdiG2.js → VoucherEditor.vue_vue_type_script_setup_true_lang-6751WdaT.js} +10 -10
  39. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-Cd752C-h.js → ZodTextField.vue_vue_type_script_setup_true_lang-aq-9V3Gc.js} +1 -1
  40. package/dist/{app-TsBYmI-P.js → app-D3chCumI.js} +31 -29
  41. package/dist/{app-DkwHJjXn.js → app-PfWyqx7U.js} +1 -1
  42. package/dist/app.js +1 -1
  43. package/dist/{business-ChsnaYdk.js → business-trsrJyHK.js} +1 -1
  44. package/dist/{campaign-PnS10H-F.js → campaign-B1rgdv77.js} +2 -2
  45. package/dist/{collectible.enum-BZIdjWua.js → collectible.enum-ZoD0ya1M.js} +1 -1
  46. package/dist/{collection.fn-9np7--Dl.js → collection.fn-CnQjdokW.js} +2 -2
  47. package/dist/{dto-IypAMCcg.js → dto-DuJumvC2.js} +9 -9
  48. package/dist/{effect-CCkvCD6X.js → effect-CFYktLyZ.js} +1 -1
  49. package/dist/{email-addresses-CMJLhz7p.js → email-addresses-BocLAqLt.js} +1 -1
  50. package/dist/{export-DkjOipRl.js → export-BDxbvd3c.js} +3 -3
  51. package/dist/{helper-Bu93Ya_g.js → helper-Bx6u7f_W.js} +1 -1
  52. package/dist/{index-JFWJNgz4.js → index-7QsBQpBM.js} +4 -4
  53. package/dist/{index-CUhBmJlv.js → index-AcoIUTDS.js} +51 -47
  54. package/dist/{index-Bzy8Sl5b.js → index-BAUe6Mqp.js} +1 -1
  55. package/dist/{index-DXAQcXA8.js → index-C20tnKDo.js} +1 -1
  56. package/dist/{index-Dx6gloTe.js → index-CDgSJNKm.js} +1 -1
  57. package/dist/{index-C-FIY2IU.js → index-CTnZ9dt0.js} +3 -3
  58. package/dist/{index-CBMl7QZF.js → index-CUMB0mpB.js} +3 -3
  59. package/dist/{index-BX1M0DCt.js → index-CsF6BSZU.js} +4 -4
  60. package/dist/{index-CZETB7DA.js → index-DwXHEi0X.js} +1 -1
  61. package/dist/{index-DLlCBYOm.js → index-ZXWgygOr.js} +2 -2
  62. package/dist/{index-BRaG-yBl.js → index-_v_LQTuR.js} +3 -3
  63. package/dist/{index-De3DoZV3.js → index-kLMiwwB-.js} +1 -1
  64. package/dist/{index-yNswuwm_.js → index-pRpTA8Kd.js} +1 -1
  65. package/dist/{index.esm2017-Df64qzkh.js → index.esm2017-DuOZ7nuk.js} +1 -1
  66. package/dist/{loading-CaxzDKHL.js → loading-BTEwnG5-.js} +4 -4
  67. package/dist/{membership-BArHVjNf.js → membership-DkH7qw6W.js} +3 -3
  68. package/dist/{money-B411u9Co.js → money-BfCdj0Ts.js} +1 -1
  69. package/dist/{number-Cqu4G1FZ.js → number-BKHcstZb.js} +1 -1
  70. package/dist/{objectid-O8aKbYqY.js → objectid-CumRza_j.js} +5 -5
  71. package/dist/{reward-ikGToGDQ.js → reward-DpR3xoxT.js} +1 -1
  72. package/dist/{rule-bi_56V_m.js → rule-Hb9_sJvP.js} +3 -3
  73. package/dist/{rule-builder-DqVWht9g.js → rule-builder-BhwlX4fv.js} +1 -1
  74. package/dist/style.css +1 -1
  75. package/dist/{template-CQVQWOPN.js → template-PkDFDppy.js} +4 -4
  76. package/dist/{trigger-BEOn5QSl.js → trigger-vLHrldAH.js} +4 -4
  77. package/dist/{vue-i18n-CVFB09Jw.js → vue-i18n-ComnFt3O.js} +2 -2
  78. package/dist/{xlsx-DA3tIqnW.js → xlsx-CsUJ1mq4.js} +1 -1
  79. package/package.json +1 -1
  80. package/dist/Index-CQ4S3D3g.js +0 -218
  81. package/dist/Overview-C2xrurYW.js +0 -879
  82. package/dist/Record-D9DGLK8k.js +0 -178
@@ -1,879 +0,0 @@
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-CVFB09Jw.js";
4
- import { p as z, u as se } from "./loading-CaxzDKHL.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-BbpCY-d1.js";
9
- import { u as ge } from "./reward-ikGToGDQ.js";
10
- import "./index-C-FIY2IU.js";
11
- import "./index-DLlCBYOm.js";
12
- import { l as oe, m as ye } from "./index-BX1M0DCt.js";
13
- import "./index-JFWJNgz4.js";
14
- import { a as _e, b as we } from "./index-CUhBmJlv.js";
15
- import "./index-DXAQcXA8.js";
16
- import "./index-BRaG-yBl.js";
17
- import { C as be } from "./membership-BArHVjNf.js";
18
- import { t as ae } from "./helper-Bu93Ya_g.js";
19
- import { c as M } from "./object-qECH92oz.js";
20
- import { useDialog as xe, components as ie } from "@feedmepos/ui-library";
21
- import { _ as Ce } from "./ZodTextField.vue_vue_type_script_setup_true_lang-Cd752C-h.js";
22
- import { a as Re, _ as Se } from "./trigger-BEOn5QSl.js";
23
- import { O as Fe } from "./objectid-O8aKbYqY.js";
24
- import { r as de } from "./index-De3DoZV3.js";
25
- 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({
26
- __name: "ReferralRewadGroupCard",
27
- props: {
28
- rewardGroup: {
29
- type: Object,
30
- required: !0
31
- },
32
- level: {
33
- type: Number,
34
- required: !0
35
- }
36
- },
37
- emits: ["edit", "addCount", "remove"],
38
- setup(x, { emit: f }) {
39
- const { t: $ } = H(), u = f;
40
- return (V, v) => {
41
- const l = b("FmButton"), m = b("FmListItem");
42
- return w(), A(j, null, [
43
- i(m, {
44
- onClick: v[4] || (v[4] = (d) => u("edit", x.level))
45
- }, {
46
- default: k(() => [
47
- a("div", ke, [
48
- a("div", $e, [
49
- a("div", Ie, [
50
- a("div", Pe, [
51
- a("div", Ve, L(x.rewardGroup.name), 1)
52
- ])
53
- ])
54
- ]),
55
- a("div", Te, [
56
- i(l, {
57
- variant: "secondary",
58
- label: e($)("connect.referral.reward.add_count"),
59
- icon: "add",
60
- onClick: v[0] || (v[0] = (d) => {
61
- d.stopPropagation(), u("addCount", x.level);
62
- })
63
- }, null, 8, ["label"]),
64
- i(l, {
65
- icon: "delete",
66
- onClick: v[1] || (v[1] = (d) => {
67
- d.stopPropagation(), u("remove", x.level);
68
- }),
69
- variant: "tertiary"
70
- })
71
- ])
72
- ]),
73
- a("div", Ae, [
74
- a("div", Ue, [
75
- a("div", Le, [
76
- a("div", Ee, [
77
- a("div", null, [
78
- a("div", Be, L(x.rewardGroup.name), 1)
79
- ])
80
- ])
81
- ]),
82
- i(l, {
83
- variant: "tertiary",
84
- icon: "delete",
85
- onClick: v[2] || (v[2] = (d) => (d.stopPropagation(), u("remove", x.level)))
86
- })
87
- ]),
88
- i(l, {
89
- class: "w-full",
90
- variant: "secondary",
91
- label: "Add count",
92
- disabled: !0,
93
- icon: "add",
94
- onClick: v[3] || (v[3] = (d) => (d.stopPropagation(), u("addCount", x.level)))
95
- })
96
- ])
97
- ]),
98
- _: 1
99
- }),
100
- ue(V.$slots, "default")
101
- ], 64);
102
- };
103
- }
104
- }), 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({
105
- __name: "EditReferralCountSheet",
106
- emits: ["update"],
107
- setup(x, { expose: f, emit: $ }) {
108
- const { t: u } = H(), V = $, v = S(!1), l = S({}), m = S(-1), d = S(-1), R = W(), T = _e.superRefine((t, o) => {
109
- var C, F, P, Q, X, ee, te;
110
- 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];
111
- _ && t.threshold.from < _.threshold.from + 1 && o.addIssue({
112
- code: "custom",
113
- message: `The min referral must be at least ${_.threshold.from + 1}`,
114
- path: ["option"]
115
- }), g && t.threshold.to && g.threshold.to && t.threshold.to > g.threshold.to - 1 && o.addIssue({
116
- code: "custom",
117
- message: `The max referral must be at most ${g.threshold.to - 2}`,
118
- path: ["option"]
119
- });
120
- }), I = O(() => {
121
- const t = T.safeParse(l.value);
122
- return t.success ? [] : t.error.errors;
123
- });
124
- function B() {
125
- const t = T.safeParse(l.value);
126
- t.success && V("update", {
127
- groupIndex: m.value,
128
- countIndex: d.value,
129
- referralCount: t.data
130
- });
131
- }
132
- async function G(t, o) {
133
- var h;
134
- 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(
135
- (h = R.referralProgram) == null ? void 0 : h.reward[o.groupIndex].rewards[o.countIndex]
136
- )) : (m.value = o.groupIndex, d.value = -1, l.value = {
137
- threshold: {
138
- from: 0,
139
- to: null
140
- },
141
- rewards: []
142
- }), c.value = [], c.value = r.value.map(
143
- (_) => l.value.rewards.includes(_.id)
144
- );
145
- }
146
- function U() {
147
- v.value = !1;
148
- }
149
- const y = [
150
- {
151
- header: "Reward title",
152
- accessorFn: (t) => t.name,
153
- enableSorting: !0
154
- },
155
- {
156
- id: "type",
157
- header: "Reward type",
158
- cell(t) {
159
- return be[t.row.original.collectibleConfig.type].chip();
160
- }
161
- },
162
- {
163
- header: "Description",
164
- accessorFn: (t) => t.description,
165
- cell(t) {
166
- const o = t.row.original;
167
- if (o.collectible.type == "VOUCHER" || o.selectedReward == null)
168
- return o.description;
169
- }
170
- }
171
- ], s = ge(), p = S([]), r = O(() => s.rewards.map((t) => {
172
- let o = "No expiry";
173
- switch (t.option.type) {
174
- case "VOUCHER":
175
- o = `${t.option.collectibleConfig.options.maxUse} use(s), ${ae(t.option.collectibleConfig.options.validityOption || {})}`;
176
- break;
177
- case "LOYALTY":
178
- o = `${t.option.earningOption.amount}, ${ae(t.option.validityOption || {})}`;
179
- break;
180
- }
181
- return {
182
- id: t._id,
183
- name: t.name,
184
- collectible: t.option,
185
- collectibleConfig: t.collectibleConfig,
186
- description: o
187
- };
188
- }));
189
- O(() => []);
190
- function n() {
191
- const t = r.value;
192
- for (let o = 0; o < t.length; o++) {
193
- const h = t[o], _ = c.value[o];
194
- _ && !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(
195
- (g) => g != h.id
196
- ));
197
- }
198
- }
199
- const c = S({});
200
- return me(c, n, { deep: !0 }), f({
201
- showSheet: G,
202
- hideSheet: U,
203
- data: l
204
- }), (t, o) => {
205
- const h = b("FmStepperField"), _ = b("FmHelperText"), g = b("FmTable"), C = b("FmButton"), F = b("FmSideSheet");
206
- return w(), D(F, {
207
- "max-width": 1e3,
208
- modelValue: e(v),
209
- "onUpdate:modelValue": o[4] || (o[4] = (P) => q(v) ? v.value = P : null),
210
- header: `${e(d) == -1 ? e(u)("connect.referral.editReferralCountSheet.add") : e(u)("connect.referral.editReferralCountSheet.edit")}`
211
- }, {
212
- "side-sheet-footer": k(() => [
213
- a("div", Me, [
214
- i(C, {
215
- label: e(u)("connect.editTierSheet.submit"),
216
- onClick: B,
217
- disabled: e(I).length > 0 || e(Y)().isLoading,
218
- loading: e(Y)().isLoading
219
- }, null, 8, ["label", "disabled", "loading"]),
220
- i(C, {
221
- label: e(u)("connect.editTierSheet.cancel"),
222
- onClick: o[3] || (o[3] = (P) => U()),
223
- variant: "tertiary"
224
- }, null, 8, ["label"])
225
- ])
226
- ]),
227
- default: k(() => [
228
- i(Z, { json: e(l) }, null, 8, ["json"]),
229
- i(Z, { json: e(I) }, null, 8, ["json"]),
230
- a("div", De, [
231
- a("div", null, [
232
- a("div", Ge, [
233
- i(h, {
234
- modelValue: e(l).threshold.from,
235
- "onUpdate:modelValue": o[0] || (o[0] = (P) => e(l).threshold.from = P),
236
- "show-steppers": !1,
237
- rules: [e(E).ruleAtPath(e(T), "threshold.from")]
238
- }, {
239
- label: k(() => [
240
- (w(), D(re(
241
- e(E).toInputLabel(
242
- e(E).typeAtPath(e(T), "threshold.from"),
243
- e(u)("connect.editTierSheet.minExperience")
244
- )
245
- )))
246
- ]),
247
- _: 1
248
- }, 8, ["modelValue", "rules"]),
249
- i(h, {
250
- modelValue: e(l).threshold.to,
251
- "onUpdate:modelValue": o[1] || (o[1] = (P) => e(l).threshold.to = P),
252
- "show-steppers": !1,
253
- rules: [e(E).ruleAtPath(e(T), "threshold.to")]
254
- }, {
255
- label: k(() => [
256
- (w(), D(re(
257
- e(E).toInputLabel(
258
- e(E).typeAtPath(e(T), "threshold.to"),
259
- e(u)("connect.editTierSheet.maxExperience")
260
- )
261
- )))
262
- ]),
263
- _: 1
264
- }, 8, ["modelValue", "rules"])
265
- ]),
266
- i(_, {
267
- text: e(E).helperText(e(I), "option"),
268
- state: e(E).helperState(e(I), "option")
269
- }, null, 8, ["text", "state"]),
270
- 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))
271
- ]),
272
- a("div", je, L(e(u)("connect.referral.editReferralCountSheet.referral_reward")), 1),
273
- i(g, {
274
- modelValue: e(c),
275
- "onUpdate:modelValue": o[2] || (o[2] = (P) => q(c) ? c.value = P : null),
276
- selection: "multiple",
277
- "column-filter": e(p),
278
- "column-defs": y,
279
- "row-data": e(r),
280
- "page-size": 10
281
- }, null, 8, ["modelValue", "column-filter", "row-data"])
282
- ])
283
- ]),
284
- _: 1
285
- }, 8, ["modelValue", "header"]);
286
- };
287
- }
288
- }), 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({
289
- __name: "CriteriaTriggerInput",
290
- props: {
291
- modelValue: {
292
- type: String
293
- },
294
- disabled: {
295
- type: Boolean,
296
- default: !1
297
- }
298
- },
299
- emits: ["update:model-value"],
300
- setup(x, { emit: f }) {
301
- const $ = x, u = f, V = O(() => [
302
- oe.enum.BILL_COMPLETED,
303
- oe.enum.FEEDBACK
304
- ].map((v) => Re[v]));
305
- return (v, l) => {
306
- const m = b("FmCard");
307
- return w(), A("div", ze, [
308
- 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)),
309
- a("div", He, [
310
- (w(!0), A(j, null, J(e(V), (d) => (w(), D(m, {
311
- key: d.name,
312
- variant: "outlined",
313
- disabled: $.disabled,
314
- class: ne(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
315
- "col-span-3": e(V).length == 1,
316
- "border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": x.modelValue == d.value,
317
- "hover:bg-fm-color-opacity-sm": x.modelValue != d.value
318
- }]),
319
- onClick: () => {
320
- $.modelValue != d.value && !$.disabled && u("update:model-value", d.value);
321
- }
322
- }, {
323
- default: k(() => [
324
- a("div", qe, L(d.name), 1),
325
- a("div", Ye, L(d.description), 1)
326
- ]),
327
- _: 2
328
- }, 1032, ["disabled", "class", "onClick"]))), 128))
329
- ])
330
- ]);
331
- };
332
- }
333
- }), Je = { class: "flex items-center gap-x-8" }, Ke = { class: "flex flex-col space-y-16 pr-12" }, Ze = {
334
- key: 0,
335
- class: "space-y-16"
336
- }, Qe = { class: "flex items-center gap-8" }, Xe = /* @__PURE__ */ N({
337
- __name: "EditCriteriaSheet",
338
- emits: ["update"],
339
- setup(x, { expose: f, emit: $ }) {
340
- const { t: u } = H(), V = $, v = S(!1), l = S(-1), m = S({}), d = W(), R = we.superRefine((y, s) => {
341
- y.name.length >= 50 && s.addIssue({
342
- code: "custom",
343
- message: "Name must be less than 50 characters"
344
- }), y.name.length < 1 && s.addIssue({
345
- code: "custom",
346
- message: "Name is required"
347
- });
348
- }), T = O(() => {
349
- const y = R.safeParse(m.value);
350
- return y.success ? [] : y.error.errors;
351
- });
352
- function I(y, s) {
353
- var p;
354
- v.value = y, y && typeof s == "number" && s >= 0 ? (l.value = s, m.value = M(
355
- (p = d.referralProgram) == null ? void 0 : p.criteria[s]
356
- )) : (l.value = -1, m.value = {
357
- _id: new Fe().toString(),
358
- name: "",
359
- type: "AUTO",
360
- event: { type: "BILL_COMPLETED" }
361
- });
362
- }
363
- function B() {
364
- v.value = !1;
365
- }
366
- function G() {
367
- const y = R.safeParse(m.value);
368
- y.success && V("update", l.value, y.data);
369
- }
370
- function U(y) {
371
- m.value.type = y, y == "AUTO" ? m.value.event = { type: "BILL_COMPLETED" } : m.value.event = void 0;
372
- }
373
- return f({
374
- showSheet: I,
375
- hideSheet: B,
376
- data: m
377
- }), (y, s) => {
378
- const p = b("FmButton"), r = b("FmRadio"), n = b("FmRadioGroup"), c = b("FmSideSheet");
379
- return w(), D(c, {
380
- "max-width": 768,
381
- modelValue: e(v),
382
- "onUpdate:modelValue": s[5] || (s[5] = (t) => q(v) ? v.value = t : null)
383
- }, {
384
- "side-sheet-header": k(() => [
385
- a("div", Je, [
386
- i(p, {
387
- icon: "arrow_back",
388
- variant: "tertiary",
389
- onClick: s[0] || (s[0] = (t) => I(!1))
390
- }),
391
- s[6] || (s[6] = fe("Add Criteria "))
392
- ])
393
- ]),
394
- "side-sheet-footer": k(() => [
395
- a("div", Qe, [
396
- i(p, {
397
- label: e(u)("connect.editTierSheet.submit"),
398
- onClick: G,
399
- disabled: e(T).length > 0 || e(Y)().isLoading,
400
- loading: e(Y)().isLoading
401
- }, null, 8, ["label", "disabled", "loading"]),
402
- i(p, {
403
- label: e(u)("connect.editTierSheet.cancel"),
404
- onClick: s[4] || (s[4] = (t) => I(!1)),
405
- variant: "tertiary"
406
- }, null, 8, ["label"])
407
- ])
408
- ]),
409
- default: k(() => [
410
- i(Z, { json: e(m) }, null, 8, ["json"]),
411
- a("div", Ke, [
412
- s[10] || (s[10] = a("div", { class: "fm-typo-en-title-sm-600" }, "Program Criteria", -1)),
413
- i(Ce, {
414
- modelValue: e(m).name,
415
- "onUpdate:modelValue": s[1] || (s[1] = (t) => e(m).name = t),
416
- label: e(u)("connect.referral.editReferralTierSheet.name"),
417
- schema: e(E).typeAtPath(e(R), "name")
418
- }, null, 8, ["modelValue", "label", "schema"]),
419
- s[11] || (s[11] = a("div", { class: "fm-typo-en-title-sm-600" }, "Configuration", -1)),
420
- i(n, {
421
- "model-value": e(m).type,
422
- label: "Verify status",
423
- "onUpdate:modelValue": U
424
- }, {
425
- default: k(() => [
426
- i(r, {
427
- value: "AUTO",
428
- label: "Auto",
429
- sublabel: "Verify based on rule configuration"
430
- }),
431
- i(r, {
432
- value: "MANUAL",
433
- label: "Manual",
434
- sublabel: "Verify based on manual inspection"
435
- })
436
- ]),
437
- _: 1
438
- }, 8, ["model-value"]),
439
- e(m).type == "AUTO" ? (w(), A(j, { key: 0 }, [
440
- s[8] || (s[8] = a("div", { class: "fm-typo-en-title-sm-600" }, "Trigger", -1)),
441
- s[9] || (s[9] = a("div", null, " Select trigger what referee need to complete in order for referral to earn reward ", -1)),
442
- i(We, {
443
- "model-value": e(m).event.type,
444
- "onUpdate:modelValue": s[2] || (s[2] = (t) => e(m).event.type = t)
445
- }, null, 8, ["model-value"]),
446
- e(m).event.type == e(ye).enum.BILL_COMPLETED ? (w(), A("div", Ze, [
447
- s[7] || (s[7] = a("div", { class: "fm-typo-en-title-sm-600" }, "Spending Criteria", -1)),
448
- i(Se, {
449
- "model-value": e(m).event.rule,
450
- "onUpdate:modelValue": s[3] || (s[3] = (t) => e(m).event.rule = t)
451
- }, null, 8, ["model-value"])
452
- ])) : K("", !0)
453
- ], 64)) : K("", !0)
454
- ])
455
- ]),
456
- _: 1
457
- }, 8, ["modelValue"]);
458
- };
459
- }
460
- });
461
- function ce() {
462
- const x = S(!1), f = xe();
463
- return {
464
- confirmUpdateReferralRecord: async () => {
465
- await new Promise((u) => {
466
- f.open({
467
- title: "Confirmation",
468
- message: "This will change all referral settings? Would you like to update previous referral record?",
469
- primaryActions: { text: "Update all", close: !0 },
470
- secondaryActions: { text: "Update future only", close: !0 }
471
- }).onPrimary(async () => {
472
- x.value = !0, u();
473
- }).onSecondary(async () => {
474
- x.value = !1, u();
475
- });
476
- });
477
- },
478
- updateReferralRecord: x
479
- };
480
- }
481
- const et = { class: "flex flex-col space-y-16 pr-12" }, tt = { class: "flex justify-between items-center" }, rt = /* @__PURE__ */ N({
482
- __name: "ManageCriteriaSheet",
483
- setup(x, { expose: f }) {
484
- const { t: $ } = H(), { minor: u } = se, { confirmUpdateReferralRecord: V, updateReferralRecord: v } = ce(), l = S(!1), m = S({}), d = W(), R = S(
485
- null
486
- ), T = O(() => {
487
- var p;
488
- return (p = d.referralProgram) == null ? void 0 : p.criteria;
489
- });
490
- async function I(p) {
491
- await V(), await u(async () => {
492
- await de.update({
493
- ...p,
494
- updateReferralRecord: v.value
495
- }), await d.readReferralProgram();
496
- });
497
- }
498
- async function B(p, r) {
499
- var t, o;
500
- const n = p == -1 ? ((t = d.referralProgram) == null ? void 0 : t.criteria.length) || 0 : p, c = M(d.referralProgram);
501
- c.criteria[n] = r, await I(c), (o = R.value) == null || o.showSheet(!1);
502
- }
503
- async function G(p) {
504
- var c, t;
505
- if (!await z.remove(
506
- "Are you sure to remove criteria",
507
- "Remove criteria",
508
- $("connect.prompt.confirm"),
509
- $("connect.prompt.cancel")
510
- ))
511
- return;
512
- const r = p == -1 ? ((c = d.referralProgram) == null ? void 0 : c.criteria.length) || 0 : p, n = M(d.referralProgram);
513
- n.criteria.splice(r, 1), await I(n), (t = R.value) == null || t.showSheet(!1);
514
- }
515
- const U = [
516
- {
517
- header: "Criteria title",
518
- accessorFn: (p) => p.name
519
- },
520
- {
521
- header: "Validity method",
522
- accessorFn: (p) => p.type
523
- },
524
- {
525
- header: "Actions",
526
- cell(p) {
527
- return [
528
- le(ie.FmButton, {
529
- variant: "tertiary",
530
- icon: "delete",
531
- iconColor: "neutral-gray-400",
532
- onClick: (r) => {
533
- r.stopPropagation(), G(p.row.index);
534
- }
535
- })
536
- ];
537
- }
538
- }
539
- ];
540
- function y(p) {
541
- l.value = p;
542
- }
543
- function s() {
544
- l.value = !1;
545
- }
546
- return f({
547
- showSheet: y,
548
- hideSheet: s,
549
- data: m
550
- }), (p, r) => {
551
- const n = b("FmButton"), c = b("FmTable"), t = b("FmSideSheet");
552
- return w(), A(j, null, [
553
- i(t, {
554
- "max-width": 768,
555
- modelValue: e(l),
556
- "onUpdate:modelValue": r[2] || (r[2] = (o) => q(l) ? l.value = o : null),
557
- header: "Manage Criteria"
558
- }, {
559
- default: k(() => [
560
- a("div", et, [
561
- a("div", tt, [
562
- r[3] || (r[3] = a("div", null, [
563
- a("div", { class: "fm-typo-en-title-sm-600" }, "Program Criteria"),
564
- a("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Set participation rules to start your referral program ")
565
- ], -1)),
566
- i(n, {
567
- label: "Add Criteria",
568
- icon: "add",
569
- variant: "secondary",
570
- onClick: r[0] || (r[0] = (o) => {
571
- var h;
572
- return (h = e(R)) == null ? void 0 : h.showSheet(!0);
573
- })
574
- })
575
- ]),
576
- i(c, {
577
- "row-data": e(T),
578
- "hide-footer": !0,
579
- "page-size": 100,
580
- "column-defs": U,
581
- onRowClick: r[1] || (r[1] = (o) => {
582
- var h;
583
- return (h = e(R)) == null ? void 0 : h.showSheet(!0, o.index);
584
- })
585
- }, null, 8, ["row-data"])
586
- ])
587
- ]),
588
- _: 1
589
- }, 8, ["modelValue"]),
590
- i(Xe, {
591
- ref_key: "editCriteriaSheetRef",
592
- ref: R,
593
- onUpdate: B
594
- }, null, 512)
595
- ], 64);
596
- };
597
- }
598
- }), 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 = {
599
- key: 0,
600
- class: "mb-40"
601
- }, dt = {
602
- key: 1,
603
- class: "flex flex-col items-center justify-center gap-y-16 p-24"
604
- }, 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" }, Bt = /* @__PURE__ */ N({
605
- __name: "Overview",
606
- setup(x) {
607
- const { t: f } = H(), { minor: $ } = se, u = W(), { confirmUpdateReferralRecord: V, updateReferralRecord: v } = ce(), l = O(() => {
608
- var r;
609
- return ((r = u.referralProgram) == null ? void 0 : r.reward) ?? [];
610
- }), m = S(null);
611
- S(null);
612
- const d = S(null), R = S(null), T = O(() => {
613
- var r, n;
614
- return [
615
- {
616
- label: "connect.referral.how_it_works.generate_link",
617
- sublabel: f("connect.referral.how_it_works.generate_link_for_member"),
618
- icon: "offline_share"
619
- },
620
- {
621
- label: "connect.referral.how_it_works.referee_join_reward",
622
- sublabel: "0 reward",
623
- action: f("connect.referral.actions.manage_reward"),
624
- icon: "group_add"
625
- },
626
- {
627
- label: "connect.referral.how_it_works.referee_meet_criteria",
628
- sublabel: `${(r = u.referralProgram) == null ? void 0 : r.criteria.length} criteria`,
629
- action: f("connect.referral.actions.manage_criteria"),
630
- onClick: () => {
631
- var c;
632
- return (c = R.value) == null ? void 0 : c.showSheet(!0);
633
- },
634
- icon: "checklist_rtl"
635
- },
636
- {
637
- label: "connect.referral.how_it_works.referer_get_reward",
638
- sublabel: `${(n = u.referralProgram) == null ? void 0 : n.reward.length} configured tier(s)`,
639
- icon: "featured_seasonal_and_gifts"
640
- }
641
- ];
642
- });
643
- function I(r) {
644
- var n;
645
- (n = m.value) == null || n.onManageRewardGroup(r);
646
- }
647
- function B(r) {
648
- var n;
649
- (n = d.value) == null || n.showSheet(!0, {
650
- groupIndex: r.groupIndex,
651
- countIndex: r.countIndex
652
- });
653
- }
654
- async function G(r) {
655
- var g, C, F, P;
656
- 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(
657
- u.referralProgram
658
- ), o = t.reward[r.groupIndex];
659
- o.rewards[n] = r.referralCount;
660
- const h = o.rewards[n - 1], _ = o.rewards[n + 1];
661
- if (h && h.threshold.to != c.threshold.from - 1) {
662
- if (!await z.confirm(
663
- f("connect.program.tier.update.range_discontinuous.previous", {
664
- name: h.threshold.from,
665
- from: h.threshold.from ?? 0,
666
- to: h.threshold.to ?? 1 / 0,
667
- newTo: c.threshold.from - 1
668
- }),
669
- f("connect.program.tier.title"),
670
- f("connect.program.tier.remove.next_range")
671
- ))
672
- return;
673
- h.threshold.to = c.threshold.from - 1;
674
- }
675
- if (_ && _.threshold.from - 1 != c.threshold.to) {
676
- if (!await z.confirm(
677
- f("connect.program.tier.update.range_discontinuous.next", {
678
- name: _.threshold.from,
679
- from: _.threshold.from ?? 0,
680
- to: _.threshold.to ?? 1 / 0,
681
- newFrom: c.threshold.to ?? 1
682
- }),
683
- f("connect.program.tier.title"),
684
- f("connect.program.tier.remove.next_range"),
685
- f("connect.prompt.cancel")
686
- ))
687
- return;
688
- _.threshold.from = (c.threshold.to ?? 0) + 1;
689
- }
690
- !_ && !((F = c.threshold) != null && F.to) && (c.threshold.to = void 0), await U(t), (P = d.value) == null || P.hideSheet();
691
- }
692
- async function U(r) {
693
- await V(), await $(async () => {
694
- await de.update({
695
- ...r,
696
- updateReferralRecord: v.value
697
- }), await u.readReferralProgram();
698
- });
699
- }
700
- async function y(r) {
701
- if (!await z.remove(
702
- "Are you sure to remove referral tier",
703
- "Remove referral tier",
704
- f("connect.prompt.confirm"),
705
- f("connect.prompt.cancel")
706
- ))
707
- return;
708
- const n = M(u.referralProgram);
709
- n.reward.splice(r, 1), await U(n);
710
- }
711
- async function s(r, n) {
712
- if (!await z.remove(
713
- "Are you sure to remove referral count",
714
- "Remove referral tier",
715
- f("connect.prompt.confirm"),
716
- f("connect.prompt.cancel")
717
- ))
718
- return;
719
- const c = M(u.referralProgram);
720
- c.reward[r].rewards.splice(n, 1), await U(c);
721
- }
722
- const p = [
723
- {
724
- header: "Referral Count",
725
- accessorFn: (r) => `${r.threshold.from} - ${r.threshold.to ?? "∞"}`
726
- },
727
- {
728
- header: "Rewards",
729
- accessorKey: "type",
730
- accessorFn: (r) => `${r.rewards.length} reward(s)`
731
- },
732
- {
733
- id: "actions",
734
- meta: {
735
- textAlign: "right"
736
- },
737
- cell(r) {
738
- return le(ie.FmButton, {
739
- variant: "tertiary",
740
- icon: "delete",
741
- iconColor: "neutral-gray-400",
742
- class: "ml-auto",
743
- onClick: (n) => {
744
- n.stopPropagation(), console.log(r.row), s(r.row.original.groupIndex, r.row.index);
745
- }
746
- });
747
- }
748
- }
749
- ];
750
- return pe(async () => {
751
- await u.readReferralProgram();
752
- }), (r, n) => {
753
- const c = b("FmCard"), t = b("FmIcon"), o = b("FmButton"), h = b("FmTable"), _ = b("FmList");
754
- return w(), A(j, null, [
755
- K("", !0),
756
- i(c, {
757
- variant: "outlined",
758
- class: "flex flex-col gap-16 p-16"
759
- }, {
760
- default: k(() => [
761
- a("div", ot, L(e(f)("connect.referral.how_it_works.title")), 1),
762
- a("div", at, [
763
- (w(!0), A(j, null, J(e(T), (g, C) => (w(), A("div", {
764
- key: C,
765
- class: ne(["px-8", { "xs:!border-r": C % 2 == 0 }])
766
- }, [
767
- a("div", nt, [
768
- i(t, {
769
- name: g.icon,
770
- color: "primary",
771
- class: "bg-fm-color-system-warning-100 p-8 fm-corner-radius-md max-h-40 max-w-40"
772
- }, null, 8, ["name"]),
773
- a("div", null, [
774
- a("div", lt, L(e(f)(g.label)), 1),
775
- a("div", st, L(g.sublabel), 1),
776
- i(o, {
777
- variant: "plain",
778
- label: g.action,
779
- size: "sm",
780
- class: "fm-typo-en-body-md-400",
781
- onClick: g.onClick
782
- }, null, 8, ["label", "onClick"])
783
- ])
784
- ])
785
- ], 2))), 128))
786
- ])
787
- ]),
788
- _: 1
789
- }),
790
- e(l) && e(l).length > 0 ? (w(), D(c, {
791
- key: 1,
792
- variant: "outlined",
793
- class: "flex flex-col gap-16 p-16"
794
- }, {
795
- default: k(() => [
796
- i(_, { separator: !0 }, {
797
- default: k(() => [
798
- (w(!0), A(j, null, J(e(l), (g, C) => (w(), D(Oe, {
799
- key: C,
800
- "reward-group": g,
801
- level: C,
802
- onEdit: (F) => I(C),
803
- onRemove: (F) => y(C),
804
- onAddCount: n[1] || (n[1] = (F) => {
805
- B({ groupIndex: F, countIndex: -1 });
806
- })
807
- }, {
808
- default: k(() => [
809
- g.rewards.length > 0 ? (w(), A("div", it, [
810
- i(h, {
811
- "row-data": g.rewards.map((F) => ({ ...F, groupIndex: C })),
812
- "column-defs": p,
813
- "hide-footer": !0,
814
- "page-size": 50,
815
- onRowClick: (F) => B({ groupIndex: C, countIndex: F.index })
816
- }, null, 8, ["row-data", "onRowClick"])
817
- ])) : (w(), A("div", dt, [
818
- n[4] || (n[4] = a("div", { class: "flex flex-col gap-16 text-center" }, [
819
- a("div", { class: "fm-typo-en-title-sm-800" }, "Create progressive reward"),
820
- 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 ")
821
- ], -1)),
822
- i(o, {
823
- variant: "secondary",
824
- label: "Add count",
825
- icon: "add",
826
- onClick: n[0] || (n[0] = (F) => I(-1))
827
- })
828
- ]))
829
- ]),
830
- _: 2
831
- }, 1032, ["reward-group", "level", "onEdit", "onRemove"]))), 128))
832
- ]),
833
- _: 1
834
- })
835
- ]),
836
- _: 1
837
- })) : (w(), D(c, {
838
- key: 2,
839
- variant: "outlined",
840
- class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
841
- }, {
842
- default: k(() => [
843
- n[5] || (n[5] = a("img", {
844
- src: ve,
845
- class: "aspect-square w-[150px]"
846
- }, null, -1)),
847
- a("div", ct, [
848
- a("div", ut, L(e(f)("connect.referral.referral_tier_title")), 1),
849
- a("div", mt, L(e(f)("connect.referral.referral_tier_description")), 1)
850
- ]),
851
- i(o, {
852
- variant: "primary",
853
- label: e(f)("connect.referral.add_referral_tier"),
854
- icon: "add",
855
- onClick: n[2] || (n[2] = (g) => I(-1))
856
- }, null, 8, ["label"])
857
- ]),
858
- _: 1
859
- })),
860
- i(he, {
861
- ref_key: "rewardGroupRef",
862
- ref: m
863
- }, null, 512),
864
- i(Ne, {
865
- ref_key: "editReferralCountSheetRef",
866
- ref: d,
867
- onUpdate: G
868
- }, null, 512),
869
- i(rt, {
870
- ref_key: "manageCriteriaSheetRef",
871
- ref: R
872
- }, null, 512)
873
- ], 64);
874
- };
875
- }
876
- });
877
- export {
878
- Bt as default
879
- };