@feedmepos/mf-connect 0.0.7 → 0.0.8

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 (67) hide show
  1. package/dist/{Analytic-D-E67IbN.js → Analytic-BxRuK2P2.js} +8 -8
  2. package/dist/{Broadcast-NjpOa4PK.js → Broadcast-BqGojAWW.js} +8 -8
  3. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-7KnDJ-sV.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-B-VzcVMS.js} +8 -8
  4. package/dist/{Card-BOEkf7wo.js → Card-Dlj5jQp4.js} +54 -54
  5. package/dist/{Collections-sLYCpBxu.js → Collections-DvdDRozp.js} +181 -186
  6. package/dist/{Credit-DU2_9ex7.js → Credit-BeHm7_2S.js} +8 -8
  7. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-CBO6OHrM.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-BsbgHsah.js} +170 -160
  8. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-CTvGOX7T.js → EffectSheet.vue_vue_type_style_index_0_lang-hwXvdiut.js} +2999 -2978
  9. package/dist/{Experience-DGNdVxuU.js → Experience-CtDY9u4Y.js} +8 -8
  10. package/dist/{Game-B1i79HLc.js → Game-DjaYuqcb.js} +8 -8
  11. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-DzdMpEl_.js → ImageInput.vue_vue_type_script_setup_true_lang-Bq5-Gl9N.js} +1 -1
  12. package/dist/{MainLayout-CfgDdm6k.js → MainLayout-B-iAZM2k.js} +1 -1
  13. package/dist/{Marketing-CBre7DEM.js → Marketing-BJJltAh-.js} +6 -6
  14. package/dist/{Member-BfvuL8GL.js → Member-eJ9Pdi5w.js} +2 -2
  15. package/dist/{MemberList-CQ17Q4V7.js → MemberList-CrhMqUfJ.js} +12 -12
  16. package/dist/{MemberTransactions-Cviim4GX.js → MemberTransactions-DRET8mSQ.js} +2 -2
  17. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-j31pc2Wx.js → MessageInput.vue_vue_type_script_setup_true_lang-D-ttMwn2.js} +2 -2
  18. package/dist/{Point-9ta-6dJv.js → Point-DPTOgJbC.js} +8 -8
  19. package/dist/{Promotion-CBmH5FNG.js → Promotion-wzkRuNqO.js} +9 -9
  20. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-r9Q-pOrs.js → RuleGroup.vue_vue_type_script_setup_true_lang-Z06eB5i5.js} +12 -12
  21. package/dist/{Segment-ZUtFZM5W.js → Segment-DnsPrP7Q.js} +10 -10
  22. package/dist/{Setting-TQdqaKPQ.js → Setting-CXuZu0-m.js} +9 -9
  23. package/dist/{Store-DX1ALcTQ.js → Store-4Um9keEp.js} +12 -12
  24. package/dist/{StoreRewards-Bd1ZFUQM.js → StoreRewards-B-UFeyQM.js} +10 -10
  25. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-D0L-LkOm.js → StoreTransactions.vue_vue_type_script_setup_true_lang-BAyotuXd.js} +5 -5
  26. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-C0xL6Ua_.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-I_XFpctY.js} +1 -1
  27. package/dist/Tier-C6KVsxGO.js +818 -0
  28. package/dist/{Title-YJtGygMA.js → Title-DuN1ahIM.js} +236 -236
  29. package/dist/{Transaction-DmvmaPk6.js → Transaction-DdfX7Xfe.js} +1 -1
  30. package/dist/{Voucher-D88gJYa3.js → Voucher-DarXrxZr.js} +99 -94
  31. package/dist/{app-g6ra_l_x.js → app-CxBTTB31.js} +1266 -1251
  32. package/dist/app.js +1 -1
  33. package/dist/{campaign-DdY0vnwY.js → campaign-B0aXkadj.js} +7 -7
  34. package/dist/dto-BtdVC-Ab.js +1093 -0
  35. package/dist/{effect-CghM-w8z.js → effect-BUN6rkQM.js} +1 -1
  36. package/dist/{helper-xWsMhdHl.js → helper-Cpq3x8K5.js} +1 -1
  37. package/dist/{index-CVSXd2FW.js → index-0GYrZr4L.js} +138 -132
  38. package/dist/{index-Dz8i7yJ_.js → index-8clzk3uX.js} +1 -1
  39. package/dist/{index-D71HFulf.js → index-BTntbYTS.js} +1 -1
  40. package/dist/{index-B4ootZIL.js → index-BvnZdJBY.js} +2 -2
  41. package/dist/{index-Cl-b6jYW.js → index-C6NgUSl2.js} +1 -1
  42. package/dist/{index-Bp8rb1uM.js → index-CK9yJMj7.js} +34 -34
  43. package/dist/{index-BSF_A6Bx.js → index-D2Juhkdw.js} +2 -2
  44. package/dist/{index-C5UTq5_2.js → index-DDSLx7vu.js} +2 -2
  45. package/dist/{index-gLwPyXKM.js → index-Dg-PMgXV.js} +1 -1
  46. package/dist/index-DysVCkrx.js +1735 -0
  47. package/dist/libs/packages/core/src/campaign/campaign.enum.d.ts +6 -0
  48. package/dist/libs/packages/core/src/campaign/campaign.fn.d.ts +2 -0
  49. package/dist/libs/packages/core/src/template/templates.d.ts +7 -0
  50. package/dist/{loading-DClM7b3o.js → loading-Cxp7sI5p.js} +2 -2
  51. package/dist/{lodash-wTDGx83S.js → lodash-DsT1nK-T.js} +1 -1
  52. package/dist/{membership-BEDm55VI.js → membership-DtD45RXh.js} +4 -4
  53. package/dist/{money-CPy2C0LJ.js → money-CFI1TMCS.js} +1 -1
  54. package/dist/{number-ROACK3bi.js → number-BBtf4fYz.js} +1 -1
  55. package/dist/packages/connect/src/api/index.d.ts +3 -0
  56. package/dist/packages/connect/src/api/settings/index.d.ts +1 -1
  57. package/dist/packages/connect/src/main.d.ts +1 -1
  58. package/dist/{plugins-CJou3ejy.js → plugins-B_d-WFtN.js} +4 -4
  59. package/dist/{rule-Cp7qN96m.js → rule-CB9Qlcx1.js} +2 -2
  60. package/dist/{rule-builder-OR4oX_mq.js → rule-builder-BIKcA4Bg.js} +1 -1
  61. package/dist/{template-Dk2sky27.js → template-qlb46PGl.js} +5 -5
  62. package/dist/{usePagination-DRHXkOF-.js → usePagination-CX66ab1Y.js} +1 -1
  63. package/dist/{xlsx-C5St1Lch.js → xlsx-DMaFso0k.js} +1 -1
  64. package/package.json +2 -2
  65. package/dist/Tier-DAUABM7F.js +0 -818
  66. package/dist/dto-BQHDb7XC.js +0 -353
  67. package/dist/index-CPU_mtDw.js +0 -1742
@@ -1,818 +0,0 @@
1
- import { defineComponent as q, resolveComponent as $, openBlock as b, createElementBlock as A, Fragment as K, createVNode as u, withCtx as T, createElementVNode as a, toDisplayString as U, renderSlot as re, computed as Y, createBlock as V, unref as e, ref as R, onMounted as ee, isRef as se, resolveDynamicComponent as W, createCommentVNode as G, renderList as te } from "vue";
2
- import { _ as ue } from "./tier-BJDhpH6X.js";
3
- import { useDialog as me } from "@feedmepos/ui-library";
4
- import { c as oe, u as le } from "./loading-DClM7b3o.js";
5
- import { u as L } from "./membership-BEDm55VI.js";
6
- import { u as de } from "./campaign-DdY0vnwY.js";
7
- import { c as Q } from "./object-qECH92oz.js";
8
- import { p as J, f as Z } from "./plugins-CJou3ejy.js";
9
- import { R as I, i as ce, a as pe } from "./rule-builder-OR4oX_mq.js";
10
- import "./index-BSF_A6Bx.js";
11
- import { v as fe, _ as ge } from "./CampaignTypeDialog.vue_vue_type_script_setup_true_lang-7KnDJ-sV.js";
12
- import { g as ne, C as ye, b as ve } from "./dto-BQHDb7XC.js";
13
- import { e as _e } from "./effect-CghM-w8z.js";
14
- import { F as be } from "./index-CVSXd2FW.js";
15
- import { u as z, J as he } from "./app-g6ra_l_x.js";
16
- import { _ as xe, Z as B } from "./ZodTextField.vue_vue_type_script_setup_true_lang-3LlSDiq0.js";
17
- import { _ as $e } from "./ImageInput.vue_vue_type_script_setup_true_lang-DzdMpEl_.js";
18
- import { _ as Se, a as we } from "./RuleGroup.vue_vue_type_script_setup_true_lang-r9Q-pOrs.js";
19
- import { _ as Fe } from "./EditCampaignSheet.vue_vue_type_script_setup_true_lang-CBO6OHrM.js";
20
- import { _ as ie } from "./lodash-wTDGx83S.js";
21
- import { m as X } from "./index-Cl-b6jYW.js";
22
- import { c as Ce } from "./index-D71HFulf.js";
23
- const Te = { class: "flex items-center justify-between flex-1 xs:hidden" }, Ve = { class: "flex items-center gap-x-24 h-[80px] p-8 flex-1" }, ke = ["src"], Ie = { class: "flex-1" }, Re = { class: "flex items-center gap-8" }, je = { class: "fm-typo-en-title-sm-800" }, Be = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-1 text-ellipsis" }, Ee = { class: "flex gap-8 items-center" }, Ue = { 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" }, Me = { class: "flex items-center gap-x-24 h-[80px] p-8 flex-1" }, Pe = ["src"], Le = { class: "flex-1 space-y-4" }, Oe = { class: "fm-typo-en-body-lg-600" }, De = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-1 text-ellipsis" }, Ne = /* @__PURE__ */ q({
24
- __name: "TierCard",
25
- props: {
26
- tier: {
27
- type: Object,
28
- required: !0
29
- },
30
- level: {
31
- type: Number,
32
- required: !0
33
- }
34
- },
35
- emits: ["edit", "addBenefit", "remove"],
36
- setup(d, { emit: E }) {
37
- const S = E;
38
- return (h, n) => {
39
- const F = $("FmChip"), c = $("FmButton"), o = $("FmListItem");
40
- return b(), A(K, null, [
41
- u(o, {
42
- onClick: n[4] || (n[4] = (v) => S("edit", d.level))
43
- }, {
44
- default: T(() => {
45
- var v, s;
46
- return [
47
- a("div", Te, [
48
- a("div", Ve, [
49
- a("img", {
50
- src: ((v = d.tier) == null ? void 0 : v.image) || `/tiers/tier=${(d.level - 1) % 4 + 1}.png`,
51
- class: "aspect-square h-full object-contain"
52
- }, null, 8, ke),
53
- a("div", Ie, [
54
- a("div", Re, [
55
- a("div", je, U(d.tier.name), 1),
56
- u(F, {
57
- class: "text-fm-color-typo-secondary",
58
- label: `${d.tier.member_count ?? 0} members`,
59
- compact: !0
60
- }, null, 8, ["label"])
61
- ]),
62
- a("div", Be, U(d.tier.option.from) + " - " + U(d.tier.option.to ?? 1 / 0) + " experience ", 1)
63
- ])
64
- ]),
65
- a("div", Ee, [
66
- u(c, {
67
- variant: "secondary",
68
- label: "Add benefit",
69
- icon: "add",
70
- onClick: n[0] || (n[0] = (m) => {
71
- m.stopPropagation(), S("addBenefit", d.level);
72
- })
73
- }),
74
- u(c, {
75
- icon: "delete",
76
- onClick: n[1] || (n[1] = (m) => {
77
- m.stopPropagation(), S("remove", d.level);
78
- }),
79
- variant: "tertiary"
80
- })
81
- ])
82
- ]),
83
- a("div", Ue, [
84
- a("div", Ae, [
85
- a("div", Me, [
86
- a("img", {
87
- src: ((s = d.tier) == null ? void 0 : s.image) || "/tiers/type=drinks.png",
88
- class: "aspect-square h-full object-contain"
89
- }, null, 8, Pe),
90
- a("div", Le, [
91
- u(F, {
92
- label: `${d.tier.member_count ?? 0} members`
93
- }, null, 8, ["label"]),
94
- a("div", null, [
95
- a("div", Oe, U(d.tier.name), 1),
96
- a("div", De, U(d.tier.option.from) + " - " + U(d.tier.option.to ?? 1 / 0) + " experience ", 1)
97
- ])
98
- ])
99
- ]),
100
- u(c, {
101
- variant: "tertiary",
102
- icon: "delete",
103
- onClick: n[2] || (n[2] = (m) => (m.stopPropagation(), S("remove", d.level)))
104
- })
105
- ]),
106
- u(c, {
107
- class: "w-full",
108
- variant: "secondary",
109
- label: "Add benefit",
110
- disabled: !0,
111
- icon: "add",
112
- onClick: n[3] || (n[3] = (m) => (m.stopPropagation(), S("addBenefit", d.level)))
113
- })
114
- ])
115
- ];
116
- }),
117
- _: 1
118
- }),
119
- re(h.$slots, "default")
120
- ], 64);
121
- };
122
- }
123
- });
124
- function Ge(d) {
125
- return {
126
- name: "",
127
- option: {
128
- from: d ?? 0
129
- },
130
- cycleOptions: [
131
- {
132
- rule: I.scaffoldGroup(),
133
- expExpression: "original - 0",
134
- tierExpression: "original - 0"
135
- }
136
- ]
137
- };
138
- }
139
- const qe = { class: "fm-typo-en-body-lg-600" }, ae = /* @__PURE__ */ q({
140
- __name: "TierExpression",
141
- props: {
142
- tier: {
143
- type: Number,
144
- required: !0
145
- },
146
- type: {
147
- type: String,
148
- required: !0
149
- },
150
- modelValue: {
151
- type: String,
152
- required: !0
153
- }
154
- },
155
- emits: ["update:model-value"],
156
- setup(d, { emit: E }) {
157
- const S = d, h = E, n = Y(() => F(S.modelValue));
158
- function F(s) {
159
- if (s.includes("*")) {
160
- const m = s.split(" * ").pop();
161
- return {
162
- adjustment: "deduct_percentage",
163
- value: Number((Number(m) * 100).toFixed(4))
164
- };
165
- }
166
- return s.includes("-") ? {
167
- adjustment: "deduct",
168
- value: Number(s.split(" - ").pop())
169
- } : {
170
- adjustment: "change_to",
171
- value: Number(s)
172
- };
173
- }
174
- function c(s) {
175
- if (s.adjustment != "change_to") {
176
- const m = s.adjustment == "deduct_percentage" ? `original * ${(Math.round(s.value * 100) / 1e4).toFixed(4)}` : Math.floor(s.value);
177
- return h("update:model-value", `original - ${m}`);
178
- }
179
- return h("update:model-value", `${Math.floor(s.value)}`);
180
- }
181
- const o = [
182
- {
183
- label: "Change to",
184
- value: "change_to"
185
- },
186
- {
187
- label: "Deduct by",
188
- value: "deduct"
189
- },
190
- {
191
- label: "Deduct percentage",
192
- value: "deduct_percentage"
193
- }
194
- ], v = Y(() => {
195
- const s = [
196
- (w) => w != null && w >= 0 || "Value must be greater than or equal to 0"
197
- ];
198
- return n.value.adjustment == "deduct_percentage" && s.push(
199
- (w) => w <= 100 || "Value must be less than or equal 100"
200
- ), L().sortedTiers[S.tier - 1] && S.type === "tier" && (n.value.adjustment == "deduct" ? s.push(
201
- (w) => w >= 0 && w < S.tier - 1 || `Value must be less than ${S.tier - 1}`
202
- ) : s.push(
203
- (w) => w > 0 && w <= L().sortedTiers.length || `Value must be in between 1 to ${L().sortedTiers.length}`
204
- )), s;
205
- });
206
- return (s, m) => {
207
- const w = $("FmButtonGroup"), j = $("FmButton"), x = $("FmStepperField"), t = $("FmCard");
208
- return b(), V(t, {
209
- variant: "outlined",
210
- class: "p-16 space-y-8"
211
- }, {
212
- default: T(() => {
213
- var p;
214
- return [
215
- a("div", qe, U(e(oe).title(d.type)), 1),
216
- u(w, {
217
- items: [o[0], o[1]],
218
- "model-value": o.find((f) => e(n).adjustment.startsWith(f.value)),
219
- "onUpdate:modelValue": m[0] || (m[0] = (f) => {
220
- const C = f.value;
221
- c({ adjustment: C, value: 1 });
222
- })
223
- }, null, 8, ["items", "model-value"]),
224
- u(x, {
225
- label: "Value",
226
- "model-value": e(n).value,
227
- class: "mt-[-4px]",
228
- "helper-text": `${e(oe).title(d.type)} ${(p = o.find((f) => f.value == e(n).adjustment)) == null ? void 0 : p.label.toLowerCase()} ${e(n).adjustment == "deduct_percentage" ? `${e(n).value.toFixed(2)}%` : e(n).value.toFixed(0)}`,
229
- min: 0,
230
- max: S.type == "tier" ? e(L)().sortedTiers.length : e(n).adjustment === "deduct_percentage" ? 100 : void 0,
231
- inputmode: "decimal",
232
- "is-currency": !0,
233
- "max-fraction-digits": e(n).adjustment === "deduct_percentage" ? 2 : 0,
234
- rules: e(v),
235
- "onUpdate:modelValue": m[2] || (m[2] = (f) => {
236
- isNaN(parseFloat(f == null ? void 0 : f.toString())) || c({
237
- ...e(n),
238
- value: f
239
- });
240
- })
241
- }, {
242
- append: T(() => [
243
- u(j, {
244
- disabled: d.type == "tier",
245
- onClick: m[1] || (m[1] = (f) => c({
246
- adjustment: e(n).adjustment == "deduct_percentage" ? "deduct" : "deduct_percentage",
247
- value: 1
248
- })),
249
- variant: "plain",
250
- label: e(n).adjustment == "deduct_percentage" ? "%" : S.type,
251
- class: "mr-[24px] min-w-min"
252
- }, null, 8, ["disabled", "label"])
253
- ]),
254
- _: 1
255
- }, 8, ["model-value", "helper-text", "max", "max-fraction-digits", "rules"])
256
- ];
257
- }),
258
- _: 1
259
- });
260
- };
261
- }
262
- }), He = {
263
- key: 0,
264
- class: "flex flex-col space-y-16 pr-12"
265
- }, Je = /* @__PURE__ */ a("div", { class: "fm-typo-en-title-sm-800 !mb-[-8px]" }, "Basic information", -1), Ze = /* @__PURE__ */ a("div", { class: "fm-typo-en-title-sm-800 !mb-[-8px]" }, "Experience threshold", -1), Ke = { class: "flex gap-16 items-center" }, We = /* @__PURE__ */ a("div", { class: "fm-typo-en-title-sm-800 !mb-[-8px]" }, "Tier expiration rule", -1), Ye = /* @__PURE__ */ a("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " To set up membership tier experience rules when expired ", -1), ze = {
266
- key: 0,
267
- class: "fm-typo-en-title-sm-800 !mb-[-8px]"
268
- }, Qe = { class: "flex items-center gap-8" }, Xe = /* @__PURE__ */ q({
269
- __name: "EditTierSheet",
270
- emits: ["update"],
271
- setup(d, { expose: E, emit: S }) {
272
- const h = S, n = L(), F = R(!1), c = R(-1), o = R(), v = R(), s = be.superRefine((x, t) => {
273
- const p = c.value == -1 ? n.sortedTiers.length : c.value - 1, f = n.sortedTiers[p - 1], C = n.sortedTiers[p + 1];
274
- f && x.option.from < f.option.from + 1 && t.addIssue({
275
- code: "custom",
276
- message: `The min experience must be at least ${f.option.from + 1}`,
277
- path: ["option"]
278
- }), C && x.option.to && C.option.to && x.option.to > C.option.to - 1 && t.addIssue({
279
- code: "custom",
280
- message: `The max experience must be at most ${C.option.to - 2}`,
281
- path: ["option"]
282
- });
283
- }), m = Y(() => {
284
- const x = s.safeParse(o.value);
285
- return x.success ? [] : x.error.errors;
286
- });
287
- function w() {
288
- const x = s.safeParse(o.value);
289
- x.success && h("update", c.value || -1, x.data);
290
- }
291
- function j(x, t) {
292
- var p, f;
293
- if (F.value = x, x && t != null) {
294
- c.value = t, v.value = void 0;
295
- const C = t == -1 ? (f = (p = n.sortedTiers.slice(t == -1 ? t : t - 2)) == null ? void 0 : p[0]) == null ? void 0 : f.option.to : void 0;
296
- o.value = t == -1 ? Ge(C ? C + 1 : void 0) : Q(n.sortedTiers[t - 1]);
297
- }
298
- }
299
- return ee(async () => {
300
- await n.readMembership();
301
- }), E({
302
- showSheet: j,
303
- data: o,
304
- tierImage: v
305
- }), (x, t) => {
306
- const p = $("FmStepperField"), f = $("FmHelperText"), C = $("FmButton"), D = $("FmSideSheet");
307
- return b(), V(D, {
308
- "max-width": 560,
309
- modelValue: e(F),
310
- "onUpdate:modelValue": t[8] || (t[8] = (k) => se(F) ? F.value = k : null),
311
- header: `${e(c) == -1 ? "Add" : "Create"} tier`
312
- }, {
313
- "side-sheet-footer": T(() => [
314
- a("div", Qe, [
315
- u(C, {
316
- label: "Submit",
317
- onClick: w,
318
- disabled: e(m).length > 0 || e(z)().isLoading,
319
- loading: e(z)().isLoading
320
- }, null, 8, ["disabled", "loading"]),
321
- u(C, {
322
- label: "Cancel",
323
- onClick: t[7] || (t[7] = (k) => j(!1)),
324
- variant: "tertiary"
325
- })
326
- ])
327
- ]),
328
- default: T(() => {
329
- var k, l, i, g, y;
330
- return [
331
- e(o) ? (b(), A("div", He, [
332
- Je,
333
- u(xe, {
334
- modelValue: e(o).name,
335
- "onUpdate:modelValue": t[0] || (t[0] = (r) => e(o).name = r),
336
- label: "Tier name",
337
- schema: e(B).typeAtPath(e(s), "name")
338
- }, null, 8, ["modelValue", "schema"]),
339
- u($e, {
340
- class: "w-1/2",
341
- "aspect-ratio": "16/9",
342
- file: e(v) ?? void 0,
343
- thumbnail: e(o).image ?? void 0,
344
- "onUpdate:file": t[1] || (t[1] = async (r) => {
345
- v.value = r, r || (e(o).image = null);
346
- })
347
- }, {
348
- label: T(() => [
349
- (b(), V(W(
350
- e(B).toInputLabel(
351
- e(B).typeAtPath(e(s), "image"),
352
- "Tier image"
353
- )
354
- )))
355
- ]),
356
- _: 1
357
- }, 8, ["file", "thumbnail"]),
358
- Ze,
359
- a("div", null, [
360
- a("div", Ke, [
361
- u(p, {
362
- modelValue: e(o).option.from,
363
- "onUpdate:modelValue": t[2] || (t[2] = (r) => e(o).option.from = r),
364
- "show-steppers": !1,
365
- rules: [e(B).ruleAtPath(e(s), "option.from")]
366
- }, {
367
- label: T(() => [
368
- (b(), V(W(
369
- e(B).toInputLabel(
370
- e(B).typeAtPath(e(s), "option.from"),
371
- "Min experience"
372
- )
373
- )))
374
- ]),
375
- _: 1
376
- }, 8, ["modelValue", "rules"]),
377
- u(p, {
378
- modelValue: e(o).option.to,
379
- "onUpdate:modelValue": t[3] || (t[3] = (r) => e(o).option.to = r),
380
- "show-steppers": !1,
381
- rules: [e(B).ruleAtPath(e(s), "option.to")]
382
- }, {
383
- label: T(() => [
384
- (b(), V(W(
385
- e(B).toInputLabel(
386
- e(B).typeAtPath(e(s), "option.to"),
387
- "Max experience"
388
- )
389
- )))
390
- ]),
391
- _: 1
392
- }, 8, ["modelValue", "rules"])
393
- ]),
394
- u(f, {
395
- text: e(B).helperText(e(m), "option"),
396
- state: e(B).helperState(e(m), "option")
397
- }, null, 8, ["text", "state"])
398
- ]),
399
- We,
400
- Ye,
401
- u(Se, {
402
- "trigger-type": "MEMBERSHIP_JOINED",
403
- "model-value": (l = (k = e(o).cycleOptions) == null ? void 0 : k[0]) == null ? void 0 : l.rule,
404
- includeOnly: "user",
405
- "onUpdate:modelValue": t[4] || (t[4] = (r) => {
406
- var _, M;
407
- e(o).cycleOptions = [
408
- { ...((M = (_ = e(o)) == null ? void 0 : _.cycleOptions) == null ? void 0 : M[0]) ?? {}, rule: r }
409
- ];
410
- })
411
- }, null, 8, ["model-value"]),
412
- (i = e(o).cycleOptions) != null && i[0] ? (b(), A("div", ze, " Actions ")) : G("", !0),
413
- (g = e(o).cycleOptions) != null && g[0] ? (b(), V(ae, {
414
- key: 1,
415
- tier: e(c),
416
- "model-value": e(o).cycleOptions[0].tierExpression ?? "",
417
- type: "tier",
418
- "onUpdate:modelValue": t[5] || (t[5] = (r) => e(o).cycleOptions[0].tierExpression = r)
419
- }, null, 8, ["tier", "model-value"])) : G("", !0),
420
- (y = e(o).cycleOptions) != null && y[0] ? (b(), V(ae, {
421
- key: 2,
422
- tier: e(c),
423
- "model-value": e(o).cycleOptions[0].expExpression ?? "",
424
- type: "experience",
425
- "onUpdate:modelValue": t[6] || (t[6] = (r) => e(o).cycleOptions[0].expExpression = r)
426
- }, null, 8, ["tier", "model-value"])) : G("", !0)
427
- ])) : G("", !0)
428
- ];
429
- }),
430
- _: 1
431
- }, 8, ["modelValue", "header"]);
432
- };
433
- }
434
- }), et = { class: "flex flex-col space-y-16 pr-12" }, tt = /* @__PURE__ */ a("div", { class: "fm-typo-en-title-sm-800 !mb-[-8px]" }, "Basic information", -1), ot = { class: "flex items-center gap-8" }, nt = /* @__PURE__ */ q({
435
- __name: "SeasonSettingSheet",
436
- emits: ["update"],
437
- setup(d, { expose: E, emit: S }) {
438
- const h = R(), n = L(), F = R(), c = R(!1), o = R(), v = R(!1), { minor: s } = le;
439
- async function m() {
440
- await s(async () => {
441
- var t;
442
- (t = h.value) != null && t.tierCycleEnable && F.value ? ie.set(h.value, "tierCycle", w()) : h.value.tierCycle = null, await X.update(h.value), c.value = !1;
443
- });
444
- }
445
- function w() {
446
- return I.setRuleToGroup(I.scaffoldGroup("g_tierCycle"), [
447
- I.constructEntry(
448
- "trigger.date",
449
- "_rrule",
450
- F.value,
451
- "r_triggerDate"
452
- ),
453
- I.constructEntry(
454
- "trigger.time",
455
- "_isOnTime",
456
- "00:00",
457
- "r_triggerTime"
458
- )
459
- ]);
460
- }
461
- function j(t) {
462
- c.value = t;
463
- }
464
- function x(t) {
465
- F.value = t.date;
466
- }
467
- return ee(async () => {
468
- await n.readMembership(), h.value = n.membershipInfo, F.value = ie.get(
469
- h.value,
470
- "tierCycle.rules.r_triggerDate.conditions._rrule"
471
- );
472
- }), E({
473
- showSheet: j,
474
- data: o
475
- }), (t, p) => {
476
- const f = $("FmSwitch"), C = $("FmButton"), D = $("FmSideSheet");
477
- return b(), V(D, {
478
- "max-width": 560,
479
- modelValue: e(c),
480
- "onUpdate:modelValue": p[4] || (p[4] = (k) => se(c) ? c.value = k : null),
481
- header: "Season Setting"
482
- }, {
483
- "side-sheet-footer": T(() => [
484
- a("div", ot, [
485
- u(C, {
486
- label: "Submit",
487
- onClick: m,
488
- disabled: e(z)().isLoading,
489
- loading: e(z)().isLoading
490
- }, null, 8, ["disabled", "loading"]),
491
- u(C, {
492
- label: "Cancel",
493
- onClick: p[3] || (p[3] = (k) => j(!1)),
494
- variant: "tertiary"
495
- })
496
- ])
497
- ]),
498
- default: T(() => {
499
- var k, l;
500
- return [
501
- a("div", et, [
502
- tt,
503
- u(f, {
504
- "model-value": ((k = e(h)) == null ? void 0 : k.tierCycleEnable) == !0,
505
- label: "Season",
506
- sublabel: "Periodic reset on Tier, Experience",
507
- "label-placement": "right",
508
- value: "",
509
- "onUpdate:modelValue": p[0] || (p[0] = (i) => e(h).tierCycleEnable = i)
510
- }, null, 8, ["model-value"]),
511
- (l = e(h)) != null && l.tierCycleEnable ? (b(), V(we, {
512
- key: 0,
513
- "model-value": e(F) || "",
514
- onCancel: p[1] || (p[1] = (i) => v.value = !1),
515
- "onUpdate:modelValue": p[2] || (p[2] = (i) => (x({ date: i }), v.value = !1))
516
- }, null, 8, ["model-value"])) : G("", !0)
517
- ])
518
- ];
519
- }),
520
- _: 1
521
- }, 8, ["modelValue"]);
522
- };
523
- }
524
- }), it = { class: "px-24 flex flex-col gap-y-16 xs:p-0" }, at = {
525
- key: 0,
526
- class: "mb-40"
527
- }, st = { class: "space-y-4" }, lt = { class: "flex items-center gap-4" }, rt = { class: "fm-typo-en-body-lg-600" }, ut = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, mt = {
528
- key: 1,
529
- class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary text-center w-full py-8"
530
- }, dt = /* @__PURE__ */ a("img", {
531
- src: ue,
532
- class: "aspect-square w-[150px]"
533
- }, null, -1), ct = /* @__PURE__ */ a("div", { class: "flex flex-col gap-16 text-center" }, [
534
- /* @__PURE__ */ a("div", { class: "fm-typo-en-title-sm-800" }, "Create tier program"),
535
- /* @__PURE__ */ a("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Give your member exclusive benefits and rewards by joining your membership campaign. You can choose what you want your loyalty tier to offer. ")
536
- ], -1), Ut = /* @__PURE__ */ q({
537
- __name: "Tier",
538
- setup(d) {
539
- const E = [
540
- {
541
- label: "Add tier",
542
- value: "create",
543
- isPrimary: !0,
544
- prependIcon: "add"
545
- },
546
- {
547
- label: "Season Setting",
548
- value: "setting",
549
- isPrimary: !0
550
- // prependIcon: 'settings',
551
- }
552
- ], S = me(), h = L(), n = de(), { global: F, minor: c } = le, o = Y(() => h.sortedTiers ?? []), v = R(null), s = R(
553
- null
554
- ), m = R(null), w = [
555
- {
556
- header: "Title",
557
- accessorFn: (l) => l.name
558
- },
559
- {
560
- header: "Status",
561
- cell(l) {
562
- return ne(l.row.original);
563
- }
564
- },
565
- {
566
- header: "Type",
567
- accessorKey: "type",
568
- accessorFn: (l) => l.type,
569
- cell(l) {
570
- return ye[l.row.original.type].chip();
571
- },
572
- enableSorting: !0
573
- },
574
- {
575
- header: "Summary",
576
- accessorFn: (l) => ve(l)
577
- }
578
- ];
579
- function j(l) {
580
- return n.campaigns.all.filter((g) => {
581
- var r;
582
- if (!g.event.rule || !ce(g.event.rule) || !g.event.rule.rules.g_user)
583
- return !1;
584
- const y = (r = I.getRules(
585
- g.event.rule.rules.g_user
586
- )) == null ? void 0 : r.find((_) => pe(_) && _.property == "user.tier");
587
- return I.getRules(g.event.rule.rules.g_user).some(
588
- (_) => I.simplify(_).property == "user.tier"
589
- ) && fe(
590
- {
591
- user: {
592
- tier: l,
593
- member: !0
594
- }
595
- },
596
- I.setRuleToGroup(
597
- I.scaffoldGroup(),
598
- I.setRuleToGroup(
599
- I.scaffoldGroup("g_user"),
600
- [y],
601
- "&&"
602
- )
603
- ),
604
- /* @__PURE__ */ new Date()
605
- );
606
- });
607
- }
608
- function x(l) {
609
- var i;
610
- (i = v.value) == null || i.showSheet(!0, l);
611
- }
612
- function t() {
613
- var l;
614
- (l = m.value) == null || l.showSheet(!0);
615
- }
616
- async function p(l, i) {
617
- const g = l == -1 ? o.value.length : l - 1, y = Q(o.value);
618
- y[g] = i;
619
- const r = y[g - 1], _ = y[g + 1];
620
- if (r && r.option.to != i.option.from - 1) {
621
- if (!await J.confirm(
622
- `The tier range is not continuous.
623
- Previous range: ${r.name} [${r.option.from ?? 0} - ${r.option.to ?? 1 / 0}].
624
- Do you want to update the previous range to [${r.option.from} - ${i.option.from - 1}]?`,
625
- "Update tier",
626
- "Update next range"
627
- ))
628
- return;
629
- r.option.to = i.option.from - 1;
630
- }
631
- if (_ && _.option.from - 1 != i.option.to) {
632
- if (!await J.confirm(
633
- `The tier range is not continuous.
634
- Next range: ${_.name} [${_.option.from ?? 0} - ${_.option.to ?? 1 / 0}].
635
- Do you want to update the next range to [${i.option.to ?? 1} - ${_.option.to ?? 1 / 0}]?`,
636
- "Update tier",
637
- "Update next range"
638
- ))
639
- return;
640
- _.option.from = (i.option.to ?? 0) + 1;
641
- }
642
- !_ && !y[g].option.to && (y[g].option.to = void 0), await c(
643
- async () => {
644
- var M, H, P;
645
- ((M = v.value) == null ? void 0 : M.tierImage) === null && i.image ? await Z.delete(i.image) : (H = v.value) != null && H.tierImage && (i.image = await Z.update(
646
- i.image || Z.tierImagePath(void 0, v.value.tierImage),
647
- v.value.tierImage
648
- )), await X.updateTiers(y), await h.readMembership(), (P = v.value) == null || P.showSheet(!1);
649
- },
650
- {
651
- message: `${l == -1 ? "Creating" : "Updating"} tier`,
652
- successMessage: `Tier ${l == -1 ? "created" : "updated"} successfully`
653
- }
654
- );
655
- }
656
- async function f(l) {
657
- if (!await J.remove(
658
- "Are you sure you want to remove this tier?",
659
- "Remove tier"
660
- ))
661
- return;
662
- const i = Q(o.value), g = l - 1, y = i[g + 1];
663
- if (y) {
664
- if (!await J.confirm(
665
- `The tier range is not continuous.
666
- Next range: ${y.name} [${y.option.from ?? 0} - ${y.option.to ?? 1 / 0}].
667
- Do you want to update the next range to [${i[g].option.from} - ${y.option.to ?? 1 / 0}]?`,
668
- "Remove tier",
669
- "Update next range"
670
- ))
671
- return;
672
- y.option.from = i[g].option.from;
673
- }
674
- const [r] = i.splice(g, 1);
675
- await c(
676
- async () => {
677
- var _;
678
- r.image && await Z.delete(r.image), await X.updateTiers(i), await h.readMembership(), (_ = v.value) == null || _.showSheet(!1);
679
- },
680
- {
681
- message: "Removing tier",
682
- successMessage: "Tier removed successfully"
683
- }
684
- );
685
- }
686
- async function C(l) {
687
- S.open({
688
- title: "Add benefit",
689
- dialogComponent: ge,
690
- dialogComponentProps: {
691
- onSelect: (i) => {
692
- D(i);
693
- }
694
- }
695
- });
696
- }
697
- async function D(l) {
698
- await i();
699
- async function i(g) {
700
- var y;
701
- (y = s.value) == null || y.showSheet(!0, l, void 0, g);
702
- }
703
- }
704
- async function k(l) {
705
- await c(
706
- async () => {
707
- await Ce.create(l), await n.read();
708
- },
709
- {
710
- message: "Updating benefit",
711
- successMessage: "Benefit created successfully"
712
- }
713
- );
714
- }
715
- return ee(async () => {
716
- await F(async () => {
717
- await h.readMembership(), await n.read();
718
- });
719
- }), (l, i) => {
720
- const g = $("FmPageHead"), y = $("FmTable"), r = $("FmListItem"), _ = $("FmList"), M = $("FmButton"), H = $("FmCard");
721
- return b(), A(K, null, [
722
- u(g, {
723
- title: "Tier",
724
- actions: e(o).length > 0 ? E : [],
725
- "onClick:action": i[0] || (i[0] = (P) => P === "create" ? x(-1) : t())
726
- }, null, 8, ["actions"]),
727
- a("div", it, [
728
- u(he, {
729
- json: e(o),
730
- expand: !0
731
- }, null, 8, ["json"]),
732
- e(o) && e(o).length ? (b(), V(_, {
733
- key: 0,
734
- separator: !0
735
- }, {
736
- default: T(() => [
737
- (b(!0), A(K, null, te(e(o), (P, O) => (b(), V(Ne, {
738
- key: O,
739
- level: O + 1,
740
- tier: P,
741
- onEdit: (N) => x(O + 1),
742
- onRemove: f,
743
- onAddBenefit: C
744
- }, {
745
- default: T(() => [
746
- j(O + 1).length > 0 ? (b(), A("div", at, [
747
- u(y, {
748
- class: "xs:hidden",
749
- "row-data": j(O + 1),
750
- "hide-footer": !0,
751
- "column-defs": w
752
- }, null, 8, ["row-data"]),
753
- u(_, { class: "hidden xs:block" }, {
754
- default: T(() => [
755
- (b(!0), A(K, null, te(j(O + 1), (N) => (b(), V(r, {
756
- key: N._id.toString()
757
- }, {
758
- default: T(() => [
759
- a("div", st, [
760
- a("div", lt, [
761
- (b(), V(W(e(ne)(N))))
762
- ]),
763
- a("div", rt, U(N.name), 1),
764
- a("div", ut, U(e(_e)(
765
- N.effect
766
- )), 1)
767
- ])
768
- ]),
769
- _: 2
770
- }, 1024))), 128))
771
- ]),
772
- _: 2
773
- }, 1024)
774
- ])) : (b(), A("div", mt, " No linked benefits "))
775
- ]),
776
- _: 2
777
- }, 1032, ["level", "tier", "onEdit"]))), 128))
778
- ]),
779
- _: 1
780
- })) : (b(), V(H, {
781
- key: 1,
782
- variant: "outlined",
783
- class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
784
- }, {
785
- default: T(() => [
786
- dt,
787
- ct,
788
- u(M, {
789
- variant: "primary",
790
- label: "Add tier",
791
- icon: "add",
792
- onClick: i[1] || (i[1] = (P) => x(-1))
793
- })
794
- ]),
795
- _: 1
796
- })),
797
- u(Xe, {
798
- ref_key: "sheetRef",
799
- ref: v,
800
- onUpdate: p
801
- }, null, 512),
802
- u(nt, {
803
- ref_key: "seasonSettingSheetRef",
804
- ref: m
805
- }, null, 512),
806
- u(Fe, {
807
- ref_key: "campaignSheetRef",
808
- ref: s,
809
- "onSubmit:modelValue": k
810
- }, null, 512)
811
- ])
812
- ], 64);
813
- };
814
- }
815
- });
816
- export {
817
- Ut as default
818
- };