@feedmepos/mf-connect 0.0.11-prod → 0.0.12-prod

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 (62) hide show
  1. package/dist/{Analytic-CpXLcGWV.js → Analytic-BM9j4mcq.js} +7 -7
  2. package/dist/{Broadcast-CEMQS5PI.js → Broadcast-5a7_nlK2.js} +7 -7
  3. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-D0Kvpl_V.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-B_Qo6Zw4.js} +8 -8
  4. package/dist/{Card-BqX-aRK9.js → Card-D2KXsf6D.js} +67 -67
  5. package/dist/{Collections-SRmluAj0.js → Collections-rsGMKAaE.js} +6 -6
  6. package/dist/{Credit-DdBKFsII.js → Credit-BnHW4aAx.js} +7 -7
  7. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-BYNpBySQ.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-CBbNUBWX.js} +960 -760
  8. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-Bj3dHqjH.js +344 -0
  9. package/dist/{Experience-CSfRrWqI.js → Experience-DZ3QmVqZ.js} +7 -7
  10. package/dist/{Game-BV--qn0e.js → Game-DKCrkTue.js} +7 -7
  11. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-DpYjrT3G.js → ImageInput.vue_vue_type_script_setup_true_lang-ChLUJK77.js} +1 -1
  12. package/dist/{MainLayout-B_ZXQrMD.js → MainLayout-C4tOUQYb.js} +1 -1
  13. package/dist/{Marketing-Bac3EbOu.js → Marketing-CgOPXO0b.js} +4 -4
  14. package/dist/{Member-CGMRVEuI.js → Member-DgJzz-qV.js} +2 -2
  15. package/dist/{MemberList-CSyb4bNE.js → MemberList-BNIpWj0x.js} +11 -11
  16. package/dist/{MemberTransactions-BdraBHg6.js → MemberTransactions-BEYEel4q.js} +2 -2
  17. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-BvAFOoym.js → MessageInput.vue_vue_type_script_setup_true_lang-BJ1wLWMO.js} +2 -2
  18. package/dist/{Mission-D8-D99g-.js → Mission-V53rL7XT.js} +7 -7
  19. package/dist/{Point-BOI4mT-K.js → Point-BE7sbUpv.js} +7 -7
  20. package/dist/{Promotion-D0MLMo9m.js → Promotion-A23HHyAW.js} +8 -8
  21. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-CzOiRmO3.js +1750 -0
  22. package/dist/{Segment-BeUbkVj7.js → Segment-OjThR8-l.js} +9 -9
  23. package/dist/{Setting-uM4iKdyM.js → Setting-Cv5FJWCG.js} +8 -8
  24. package/dist/{Store-BkccNTnM.js → Store-DQoSb0vC.js} +11 -11
  25. package/dist/{StoreRewards-BLgP6Mfv.js → StoreRewards-DHdtRsdr.js} +9 -9
  26. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-Z0nqQyi8.js → StoreTransactions.vue_vue_type_script_setup_true_lang-8BxMxOgb.js} +6 -6
  27. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-C771jjYx.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-B6DvQL2O.js} +1 -1
  28. package/dist/{Tier-DwKAfz6f.js → Tier-BWbAvEvT.js} +16 -16
  29. package/dist/{Title-B1_yd9pC.js → Title-DuMvJSeo.js} +15 -15
  30. package/dist/{Transaction-DcVCMUY4.js → Transaction-Dh9hUxxn.js} +1 -1
  31. package/dist/{Voucher-Djvai5vL.js → Voucher-CDj33EVW.js} +9 -9
  32. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-admNNBWu.js → app-C-JARJOh.js} +5596 -5934
  33. package/dist/{app-BvizV9z5.js → app-CJmGoLdT.js} +33 -33
  34. package/dist/app.js +1 -1
  35. package/dist/{campaign-BdSwq7MJ.js → campaign-0ym0cymh.js} +2 -2
  36. package/dist/{dto-CkH5Zama.js → dto-DHLYS7Rm.js} +196 -196
  37. package/dist/{effect-DT4ivttr.js → effect-lIau3gAr.js} +1 -1
  38. package/dist/{export-BAJL8_2G.js → export-C2z8mAAK.js} +3 -3
  39. package/dist/{helper-CiIZ1pUo.js → helper-Dk7nQLD9.js} +1 -1
  40. package/dist/{index-BLWw_MlC.js → index-BacICqbE.js} +503 -500
  41. package/dist/{index-C5N8jeJ1.js → index-BiKKeruN.js} +1 -1
  42. package/dist/{index-CjZxaXvZ.js → index-BifZnXOd.js} +2 -2
  43. package/dist/{index-DMyaEjMn.js → index-BuYuArTc.js} +2 -2
  44. package/dist/{index-C8dIiNQb.js → index-CoNWSPv-.js} +1 -1
  45. package/dist/{index-B5gJ6P15.js → index-CwRopfKJ.js} +10 -10
  46. package/dist/{index-Ccn7PGoB.js → index-DBs-f_OF.js} +3 -3
  47. package/dist/{index-7uOMMdXt.js → index-DrekSEPv.js} +6 -6
  48. package/dist/{index-DCs4-zXS.js → index-Dy-njFA-.js} +1 -1
  49. package/dist/{index-8nrxC9d5.js → index-jXbGzZIZ.js} +1 -1
  50. package/dist/{loading-C1IzY-n2.js → loading-C0Im7NLc.js} +1312 -1312
  51. package/dist/{lodash-BMQ4xbjY.js → lodash-DRiB9OLu.js} +1 -1
  52. package/dist/{membership-D3I4udu3.js → membership-BWDFt2D0.js} +3 -3
  53. package/dist/{money-BQEcWGhZ.js → money-CgXcfonm.js} +1 -1
  54. package/dist/{number-DGx2QPUy.js → number-B0SphtT-.js} +1 -1
  55. package/dist/{rule-CvlhLEGy.js → rule-CWGFyRio.js} +20 -13
  56. package/dist/{rule-builder-Di3qiIBb.js → rule-builder-C484wKRf.js} +1 -1
  57. package/dist/style.css +1 -1
  58. package/dist/{template-D6Abrya4.js → template-DDHe5agw.js} +5 -5
  59. package/dist/{usePagination-MhbjQgN7.js → usePagination-D0-ih-vZ.js} +1 -1
  60. package/dist/{xlsx-mL_3T1k3.js → xlsx-D9dXZPK6.js} +1 -1
  61. package/package.json +3 -2
  62. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-1L68zx5t.js +0 -1464
@@ -1,1464 +0,0 @@
1
- import { defineComponent as A, computed as B, resolveComponent as k, openBlock as r, createElementBlock as S, createElementVNode as x, createVNode as y, unref as e, createTextVNode as ee, toDisplayString as j, withCtx as M, onMounted as Z, createBlock as g, createCommentVNode as q, ref as K, Fragment as w, renderList as N, normalizeClass as P, resolveDynamicComponent as oe, onBeforeMount as ne, isRef as ie, createSlots as me } from "vue";
2
- import { c as de, C as pe, d as ye, e as ce, f as ve } from "./index-BLWw_MlC.js";
3
- import { R as h, a as be } from "./rule-builder-Di3qiIBb.js";
4
- import { a as fe, R as C, S as ge, C as $, W as ke, T as ae, O as Ee } from "./rule-CvlhLEGy.js";
5
- import { p as Te } from "./loading-C1IzY-n2.js";
6
- import { useDialog as te, useDialogChild as ue } from "@feedmepos/ui-library";
7
- import { h as J } from "./moment-BWErdI6_.js";
8
- import { z as Se, a as re } from "./app-BvizV9z5.js";
9
- import { u as Q } from "./membership-D3I4udu3.js";
10
- import { _ as O } from "./index-B5gJ6P15.js";
11
- import { c as se } from "./object-qECH92oz.js";
12
- import { Z as z } from "./ZodTextField.vue_vue_type_script_setup_true_lang-3LlSDiq0.js";
13
- import "./index-DMyaEjMn.js";
14
- import "./index-7uOMMdXt.js";
15
- import "./index-Ccn7PGoB.js";
16
- import "./index-CjZxaXvZ.js";
17
- import "./index-8nrxC9d5.js";
18
- const Ve = { class: "flex items-center justify-between" }, Fe = { class: "flex items-center gap-8 xs:flex-wrap" }, Ue = /* @__PURE__ */ x("div", { class: "h-[26px] border-l-2 rounded-md border-fm-color-neutral-gray-100" }, null, -1), xe = { class: "text-fm-color-primary line-clamp-1 text-ellipsis" }, Re = /* @__PURE__ */ A({
19
- __name: "RuleEntry",
20
- props: {
21
- modelValue: {
22
- type: Object,
23
- required: !0
24
- }
25
- },
26
- emits: ["edit", "remove"],
27
- setup(o, { emit: R }) {
28
- const c = o, s = B(() => {
29
- const [i, v] = Object.entries(c.modelValue.conditions)[0];
30
- return {
31
- negated: c.modelValue.negated == !0,
32
- property: c.modelValue.property,
33
- operator: i,
34
- equator: v
35
- };
36
- }), l = R, d = B(
37
- () => fe(
38
- s.value.property,
39
- s.value.operator,
40
- s.value.equator,
41
- s.value.negated
42
- )
43
- );
44
- async function t(i) {
45
- i.stopPropagation(), await Te.remove("Are you sure you want to remove this rule?") && l("remove", c.modelValue);
46
- }
47
- return (i, v) => {
48
- var E;
49
- const p = k("FmChip"), m = k("FmTooltip"), b = k("FmIcon");
50
- return r(), S("div", Ve, [
51
- x("div", Fe, [
52
- y(p, {
53
- label: (E = e(de).find((f) => f.property === c.modelValue.property)) == null ? void 0 : E.name,
54
- class: "!text-fm-color-typo-info !bg-fm-color-system-info-100"
55
- }, null, 8, ["label"]),
56
- Ue,
57
- x("div", {
58
- onClick: v[0] || (v[0] = (f) => l("edit", c.modelValue)),
59
- class: "inline-flex rounded-md items-center gap-4 justify-center h-[30px] px-8 py-4 text-fm-color-typo-primary !bg-transparent border-dashed border-2 fm-typo-en-body-md-600 cursor-pointer"
60
- }, [
61
- ee(j(e(d)[0]) + " ", 1),
62
- y(m, {
63
- "z-index": 1e3,
64
- content: e(d)[1]
65
- }, {
66
- default: M(() => [
67
- x("div", xe, j(e(d)[1]), 1)
68
- ]),
69
- _: 1
70
- }, 8, ["content"])
71
- ])
72
- ]),
73
- y(b, {
74
- name: "close",
75
- size: "md",
76
- class: "cursor-pointer hover:bg-neutral-300 rounded-lg",
77
- onClick: t
78
- })
79
- ]);
80
- };
81
- }
82
- });
83
- Se.enum([
84
- "MIN_SPEND",
85
- "SPECIFIC_DATE",
86
- "SPECIFIC_TIMERANGE",
87
- "WEEKLY",
88
- "MONTHLY",
89
- "BIRTHDAY",
90
- "TIER",
91
- "TITLE",
92
- "CUSTOM"
93
- ]);
94
- const Ce = [
95
- {
96
- type: "MIN_SPEND",
97
- name: "Minimum spend",
98
- for: ["bill"],
99
- rules: []
100
- },
101
- {
102
- type: "SPECIFIC_DATE",
103
- name: "Specific date",
104
- for: ["trigger"],
105
- rules: []
106
- },
107
- {
108
- type: "SPECIFIC_TIMERANGE",
109
- name: "Specific time range",
110
- for: ["trigger"],
111
- rules: []
112
- },
113
- {
114
- type: "WEEKLY",
115
- name: "Weekly",
116
- for: ["trigger"],
117
- rules: [
118
- {
119
- property: "trigger.date",
120
- operator: "_rrule",
121
- equator: "RRULE:FREQ=WEEKLY;WKST=SU;BYDAY=SU;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
122
- }
123
- ]
124
- },
125
- {
126
- type: "MONTHLY",
127
- name: "Monthly",
128
- for: ["trigger"],
129
- rules: [
130
- {
131
- property: "trigger.date",
132
- operator: "_rrule",
133
- equator: "RRULE:FREQ=MONTHLY;WKST=SU;BYMONTHDAY=1;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
134
- }
135
- ]
136
- },
137
- {
138
- type: "BIRTHDAY",
139
- name: "Birthday",
140
- for: ["user"],
141
- rules: [
142
- {
143
- property: "user.birthday",
144
- operator: "_isDay",
145
- equator: {
146
- op: "this",
147
- unit: "day",
148
- ignoreYear: !0
149
- }
150
- }
151
- ]
152
- },
153
- {
154
- type: "TIER",
155
- name: "Specific tier",
156
- for: ["user"],
157
- rules: [
158
- {
159
- property: "user.tier",
160
- operator: "_equal",
161
- equator: 1
162
- }
163
- ]
164
- },
165
- {
166
- type: "TITLE",
167
- name: "Specific title",
168
- for: ["user"],
169
- rules: [
170
- {
171
- property: "user.titles",
172
- operator: "_hasAny",
173
- equator: []
174
- }
175
- ]
176
- },
177
- {
178
- type: "CUSTOM",
179
- name: "Weekday special",
180
- for: ["trigger"],
181
- rules: [
182
- {
183
- property: "trigger.date",
184
- operator: "_rrule",
185
- equator: "RRULE:FREQ=WEEKLY;WKST=SU;BYDAY=MO,TU,WE,TH,FR;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
186
- }
187
- ]
188
- },
189
- {
190
- type: "CUSTOM",
191
- name: "Weekend special",
192
- for: ["trigger"],
193
- rules: [
194
- {
195
- property: "trigger.date",
196
- operator: "_rrule",
197
- equator: "RRULE:FREQ=WEEKLY;WKST=SU;BYDAY=SU,SA;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
198
- }
199
- ]
200
- },
201
- {
202
- type: "CUSTOM",
203
- name: "Happy hour",
204
- for: ["trigger"],
205
- rules: [
206
- {
207
- property: "trigger.time",
208
- operator: "_isBetweenTime",
209
- equator: [
210
- {
211
- start: "21:00",
212
- end: "23:59"
213
- }
214
- ]
215
- }
216
- ]
217
- },
218
- {
219
- type: "CUSTOM",
220
- name: "Mother's day special",
221
- for: ["trigger"],
222
- rules: [
223
- {
224
- property: "trigger.date",
225
- operator: "_rrule",
226
- equator: "RRULE:FREQ=YEARLY;WKST=SU;BYDAY=+2SU;BYMONTH=5;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
227
- }
228
- ]
229
- },
230
- {
231
- type: "CUSTOM",
232
- name: "Father's day special",
233
- for: ["trigger"],
234
- rules: [
235
- {
236
- property: "trigger.date",
237
- operator: "_rrule",
238
- equator: "RRULE:FREQ=YEARLY;WKST=SU;BYDAY=+3SU;BYMONTH=6;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
239
- }
240
- ]
241
- },
242
- {
243
- type: "CUSTOM",
244
- name: "Christmas",
245
- for: ["trigger"],
246
- rules: [
247
- {
248
- property: "trigger.date",
249
- operator: "_rrule",
250
- equator: "RRULE:FREQ=YEARLY;WKST=SU;BYMONTH=12;BYMONTHDAY=25;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
251
- }
252
- ]
253
- },
254
- {
255
- type: "CUSTOM",
256
- name: "Feedback rating",
257
- for: ["feedback"],
258
- rules: [
259
- {
260
- property: "feedback.rating",
261
- operator: "_lessThanOrEqual",
262
- equator: 5
263
- }
264
- ]
265
- },
266
- {
267
- type: "CUSTOM",
268
- name: "Custom",
269
- for: ["trigger", "user", "bill", "feedback"],
270
- rules: [
271
- {
272
- property: "trigger.date",
273
- operator: "_isOnDate",
274
- equator: J().format("YYYY-MM-DD")
275
- }
276
- ]
277
- }
278
- ], Ye = { class: "flex flex-nowrap gap-x-4 items-center" }, he = /* @__PURE__ */ A({
279
- __name: "IsDayInput",
280
- props: {
281
- modelValue: {
282
- type: Object
283
- }
284
- },
285
- emits: ["update:model-value"],
286
- setup(o, { emit: R }) {
287
- const c = o, s = R;
288
- Z(() => {
289
- c.modelValue || s("update:model-value", {
290
- op: "before",
291
- x: 1
292
- });
293
- });
294
- function l(d) {
295
- const t = se(
296
- c.modelValue ?? {
297
- op: "before",
298
- x: 1
299
- }
300
- );
301
- s("update:model-value", {
302
- ...t,
303
- ...d
304
- });
305
- }
306
- return (d, t) => {
307
- var v, p, m;
308
- const i = k("FmStepperField");
309
- return r(), S("div", Ye, [
310
- y(i, {
311
- class: "w-1/3",
312
- "model-value": ((v = o.modelValue) == null ? void 0 : v.x) ?? null,
313
- max: 365,
314
- "show-steppers": !1,
315
- "append-text": "days",
316
- "onUpdate:modelValue": t[0] || (t[0] = (b) => l({ x: b }))
317
- }, null, 8, ["model-value"]),
318
- y(O, {
319
- "model-value": ((p = o.modelValue) == null ? void 0 : p.op) ?? void 0,
320
- items: [
321
- { label: "before", value: "before" },
322
- { label: "after", value: "after" }
323
- ],
324
- "onUpdate:modelValue": t[1] || (t[1] = (b) => l({ op: b }))
325
- }, null, 8, ["model-value"]),
326
- y(O, {
327
- "model-value": ((m = o.modelValue) == null ? void 0 : m.ignoreYear) ?? !1,
328
- items: [
329
- { label: "same year", value: !1 },
330
- { label: "ignore year", value: !0 }
331
- ],
332
- required: !0,
333
- "onUpdate:modelValue": t[2] || (t[2] = (b) => l({ ignoreYear: b == !0 }))
334
- }, null, 8, ["model-value"])
335
- ]);
336
- };
337
- }
338
- }), Oe = { class: "grid grid-cols-4 gap-x-4 items-center" }, De = /* @__PURE__ */ A({
339
- __name: "IsRangeInput",
340
- props: {
341
- modelValue: {
342
- type: Object,
343
- default: () => ({
344
- op: "this",
345
- unit: "day",
346
- ignoreYear: !0
347
- })
348
- }
349
- },
350
- emits: ["update:model-value"],
351
- setup(o, { emit: R }) {
352
- const c = o, s = R;
353
- Z(() => {
354
- c.modelValue || s("update:model-value", {
355
- op: "this",
356
- unit: "day",
357
- ignoreYear: !0
358
- });
359
- });
360
- const l = [
361
- { label: "day", value: "day" },
362
- { label: "week", value: "week" },
363
- { label: "month", value: "month" },
364
- { label: "quarter", value: "quarter" },
365
- { label: "year", value: "year" }
366
- ], d = [
367
- {
368
- label: "this",
369
- value: "this"
370
- },
371
- {
372
- label: "last",
373
- value: "last"
374
- },
375
- {
376
- label: "next",
377
- value: "next"
378
- }
379
- ];
380
- return (t, i) => {
381
- var p, m, b, E, f;
382
- const v = k("FmStepperField");
383
- return r(), S("div", Oe, [
384
- y(O, {
385
- "model-value": (p = o.modelValue) == null ? void 0 : p.op,
386
- label: "",
387
- items: d,
388
- required: !0,
389
- "onUpdate:modelValue": i[0] || (i[0] = (n) => s("update:model-value", { op: n, unit: "day", ignoreYear: !1 }))
390
- }, null, 8, ["model-value"]),
391
- ((m = o.modelValue) == null ? void 0 : m.op) != "this" ? (r(), g(v, {
392
- key: 0,
393
- "model-value": ((b = o.modelValue) == null ? void 0 : b.x) || 0,
394
- max: 365,
395
- "show-steppers": !1,
396
- "onUpdate:modelValue": i[1] || (i[1] = (n) => s("update:model-value", {
397
- op: o.modelValue.op,
398
- unit: o.modelValue.unit,
399
- ignoreYear: o.modelValue.ignoreYear == !0,
400
- x: n
401
- }))
402
- }, null, 8, ["model-value"])) : q("", !0),
403
- y(O, {
404
- "model-value": (E = o.modelValue) == null ? void 0 : E.unit,
405
- label: "",
406
- items: l,
407
- required: !0,
408
- "onUpdate:modelValue": i[2] || (i[2] = (n) => s("update:model-value", { ...c.modelValue, unit: n }))
409
- }, null, 8, ["model-value"]),
410
- y(O, {
411
- label: "",
412
- "model-value": (f = o.modelValue) == null ? void 0 : f.ignoreYear,
413
- items: [
414
- { label: "same", value: !1 },
415
- { label: "ignore", value: !0 }
416
- ],
417
- required: !0,
418
- "onUpdate:modelValue": i[3] || (i[3] = (n) => s("update:model-value", {
419
- ...c.modelValue,
420
- ignoreYear: n == !0
421
- }))
422
- }, null, 8, ["model-value"])
423
- ]);
424
- };
425
- }
426
- }), we = { class: "space-y-8" }, Me = { class: "text-fm-color-primary rounded-md border-dashed border-2 p-8" }, qe = {
427
- key: 0,
428
- class: "flex items-center gap-8"
429
- }, Be = /* @__PURE__ */ x("div", null, "Repeat every", -1), Ie = /* @__PURE__ */ x("div", null, "Repeat on", -1), Ne = { class: "flex gap-4" }, Ae = {
430
- key: 0,
431
- class: "grid grid-cols-7 overflow-hidden rounded-md border-1"
432
- }, $e = ["onClick"], Pe = {
433
- key: 1,
434
- class: "flex items-center gap-8"
435
- }, _e = { class: "flex gap-4 xs:gap-[2px]" }, Le = /* @__PURE__ */ x("div", null, "Month", -1), He = { class: "grid grid-cols-6 gap-8" }, We = {
436
- key: 0,
437
- class: "grid grid-cols-7 overflow-hidden rounded-md border-1"
438
- }, je = ["onClick"], Ke = {
439
- key: 1,
440
- class: "grid grid-cols-2 items-center gap-8"
441
- }, Ge = { class: "flex gap-4" }, Qe = {
442
- key: 4,
443
- class: "flex items-center justify-end gap-8"
444
- }, X = /* @__PURE__ */ A({
445
- __name: "RruleInput",
446
- props: {
447
- modelValue: {
448
- type: String
449
- },
450
- startDate: {
451
- type: Object
452
- },
453
- applyButton: {
454
- type: Boolean
455
- },
456
- fixedFrequency: {
457
- type: Boolean
458
- }
459
- },
460
- emits: ["update:model-value", "cancel"],
461
- setup(o, { emit: R }) {
462
- const c = o, s = R, l = K(
463
- c.modelValue ? C.fromString(c.modelValue) : new C({
464
- dtstart: c.startDate,
465
- freq: C.DAILY,
466
- wkst: C.SU,
467
- interval: 1,
468
- byhour: 0,
469
- byminute: 0,
470
- bysecond: 0
471
- })
472
- );
473
- function d(t) {
474
- var i;
475
- "freq" in t && (l.value = new C({
476
- dtstart: c.startDate,
477
- freq: t.freq,
478
- interval: 1,
479
- byhour: 0,
480
- byminute: 0,
481
- bysecond: 0,
482
- wkst: C.SU
483
- })), t.interval && t.interval > 0 && (l.value = new C({
484
- ...l.value.origOptions,
485
- dtstart: c.startDate,
486
- interval: t.interval
487
- })), "byweekday" in t && t.byweekday && Array.isArray(t.byweekday) && t.byweekday.length > 0 && (l.value.options.bymonthday.length > 0 && l.value.options.freq == C.MONTHLY && (l.value.options.bymonthday = []), l.value = new C({
488
- ...l.value.origOptions,
489
- dtstart: c.startDate,
490
- bymonthday: [],
491
- byweekday: t.byweekday
492
- })), "bysetpos" in t && t.bysetpos != null && (l.value = new C({
493
- ...l.value.origOptions,
494
- dtstart: c.startDate,
495
- bymonthday: [],
496
- bysetpos: t.bysetpos,
497
- byweekday: ((i = l.value.options.byweekday) == null ? void 0 : i.length) > 0 ? l.value.options.byweekday : [6]
498
- })), "bymonthday" in t && t.bymonthday && Array.isArray(t.bymonthday) && t.bymonthday.length > 0 && (l.value = new C({
499
- ...l.value.origOptions,
500
- dtstart: c.startDate,
501
- bysetpos: [],
502
- byweekday: [],
503
- bymonthday: t.bymonthday
504
- })), "bymonth" in t && t.bymonth && Array.isArray(t.bymonth) && t.bymonth.length > 0 && (l.value = new C({
505
- ...l.value.origOptions,
506
- dtstart: c.startDate,
507
- bysetpos: [],
508
- bymonth: t.bymonth
509
- })), "bynweekday" in t && t.bynweekday && (l.value = new C({
510
- ...l.value.origOptions,
511
- dtstart: c.startDate,
512
- bysetpos: [],
513
- byweekday: new ke(
514
- t.bynweekday[0][0],
515
- t.bynweekday[0][1]
516
- )
517
- })), c.applyButton || s("update:model-value", l.value.toString());
518
- }
519
- return Z(() => {
520
- c.modelValue || s(
521
- "update:model-value",
522
- new C({
523
- dtstart: c.startDate,
524
- freq: C.DAILY,
525
- wkst: C.SU,
526
- interval: 1,
527
- byhour: 0,
528
- byminute: 0,
529
- bysecond: 0
530
- }).toString()
531
- );
532
- }), (t, i) => {
533
- var E, f, n;
534
- const v = k("FmStepperField"), p = k("FmChip"), m = k("FmButtonGroup"), b = k("FmButton");
535
- return r(), S("div", we, [
536
- x("div", Me, j(e(ge)(e(l).options)), 1),
537
- o.fixedFrequency ? q("", !0) : (r(), S("div", qe, [
538
- Be,
539
- y(v, {
540
- class: "w-[100px]",
541
- "model-value": e(l).options.interval,
542
- "onUpdate:modelValue": i[0] || (i[0] = (a) => d({ interval: a > 0 ? a : e(l).options.interval })),
543
- min: 1
544
- }, null, 8, ["model-value"]),
545
- y(O, {
546
- class: "w-min",
547
- items: e($).frequencies,
548
- "model-value": e(l).origOptions.freq,
549
- "onUpdate:modelValue": i[1] || (i[1] = (a) => d({ freq: a }))
550
- }, null, 8, ["items", "model-value"])
551
- ])),
552
- e(l).options.freq === e(C).WEEKLY ? (r(), S(w, { key: 1 }, [
553
- Ie,
554
- x("div", Ne, [
555
- (r(!0), S(w, null, N(e($).weekdays, (a) => {
556
- var F;
557
- return r(), g(p, {
558
- class: P(["cursor-pointer", `${(F = e(l).options.byweekday) != null && F.includes(a.value) ? "bg-fm-color-primary text-white" : "bg-fm-color-neutral-gray-200 text-black"}`]),
559
- label: a.label[0],
560
- key: a.value,
561
- compact: !0,
562
- onClick: () => {
563
- var U, D;
564
- d({
565
- byweekday: (U = e(l).options.byweekday) != null && U.includes(a.value) ? ((D = e(l).options.byweekday) == null ? void 0 : D.filter((V) => V !== a.value)) || [] : [...e(l).options.byweekday || [], a.value]
566
- });
567
- }
568
- }, null, 8, ["class", "label", "onClick"]);
569
- }), 128))
570
- ])
571
- ], 64)) : q("", !0),
572
- e(l).options.freq == e(C).MONTHLY ? (r(), S(w, { key: 2 }, [
573
- y(m, {
574
- "model-value": e(l).options.bymonthday.length ? { label: "Each" } : { label: "On the" },
575
- items: [
576
- {
577
- label: "Each"
578
- },
579
- {
580
- label: "On the"
581
- }
582
- ],
583
- "onUpdate:modelValue": i[2] || (i[2] = (a) => {
584
- a.label == "Each" ? d({ bymonthday: [1] }) : d({ bysetpos: 1 });
585
- })
586
- }, null, 8, ["model-value"]),
587
- e(l).options.bymonthday.length > 0 ? (r(), S("div", Ae, [
588
- (r(!0), S(w, null, N(e($).dates, (a) => (r(), S("div", {
589
- key: a.value,
590
- class: P(["cursor-pointer text-center outline-1 outline-fm-color-neutral-gray-100 outline", `${e(l).options.bymonthday.includes(a.value) ? "bg-fm-color-primary text-fm-color-typo-white outline-transparent" : "bg-transparent text-fm-color-typo-primary"} ${a.value == 31 ? "border-r" : ""}`]),
591
- onClick: (F) => d({
592
- bymonthday: e(l).options.bymonthday.includes(a.value) ? e(l).options.bymonthday.filter((U) => U !== a.value) : [...e(l).options.bymonthday, a.value]
593
- })
594
- }, j(a.value), 11, $e))), 128))
595
- ])) : (r(), S("div", Pe, [
596
- y(O, {
597
- items: e($).ordinals,
598
- "model-value": (E = e(l).options.bysetpos) == null ? void 0 : E[0],
599
- "onUpdate:modelValue": i[3] || (i[3] = (a) => d({ bysetpos: a }))
600
- }, null, 8, ["items", "model-value"]),
601
- x("div", _e, [
602
- (r(!0), S(w, null, N(e($).weekdays, (a) => {
603
- var F;
604
- return r(), g(p, {
605
- class: P(["cursor-pointer", `${(F = e(l).options.byweekday) != null && F.includes(a.value) ? "bg-fm-color-primary text-white" : "bg-fm-color-neutral-gray-200 text-black"}`]),
606
- label: a.label[0],
607
- key: a.value,
608
- compact: !0,
609
- onClick: () => {
610
- d({
611
- byweekday: [a.value]
612
- });
613
- }
614
- }, null, 8, ["class", "label", "onClick"]);
615
- }), 128))
616
- ])
617
- ]))
618
- ], 64)) : q("", !0),
619
- e(l).options.freq == e(C).YEARLY ? (r(), S(w, { key: 3 }, [
620
- Le,
621
- x("div", He, [
622
- (r(!0), S(w, null, N(e($).months, (a) => {
623
- var F, U;
624
- return r(), g(p, {
625
- key: a.value,
626
- class: P(["cursor-pointer", {
627
- "bg-fm-color-primary text-white": (F = e(l).options.bymonth) == null ? void 0 : F.includes(
628
- a.value
629
- ),
630
- "bg-fm-color-gray-200 text-fm-color-gray-800": !((U = e(l).options.bymonth) != null && U.includes(a.value))
631
- }]),
632
- label: a.shortName,
633
- compact: !0,
634
- onClick: (D) => d({
635
- bymonth: (e(l).options.bymonth ?? []).includes(a.value) ? (e(l).options.bymonth ?? []).filter((V) => V !== a.value) : [...e(l).options.bymonth ?? [], a.value]
636
- })
637
- }, null, 8, ["class", "label", "onClick"]);
638
- }), 128))
639
- ]),
640
- y(m, {
641
- "model-value": e(l).options.bymonthday.length ? { label: "Each" } : { label: "On the" },
642
- items: [
643
- {
644
- label: "Each"
645
- },
646
- {
647
- label: "On the"
648
- }
649
- ],
650
- "onUpdate:modelValue": i[4] || (i[4] = (a) => {
651
- a.label == "Each" ? d({
652
- bymonthday: [1],
653
- bymonth: e(l).options.bymonth ?? [1]
654
- }) : d({
655
- byweekday: [e(C).SU.nth(1)],
656
- bymonth: e(l).options.bymonth ?? [1]
657
- });
658
- })
659
- }, null, 8, ["model-value"]),
660
- e(l).options.bymonthday.length > 0 ? (r(), S("div", We, [
661
- (r(!0), S(w, null, N(Array(31).fill(null).map((a, F) => F + 1), (a) => (r(), S("div", {
662
- key: a,
663
- class: P(["cursor-pointer text-center outline-1 outline-fm-color-neutral-gray-100 outline", `${e(l).options.bymonthday.includes(a) ? "bg-fm-color-primary text-fm-color-typo-white outline-transparent" : "bg-transparent text-fm-color-typo-primary"} ${a == 31 ? "border-r" : ""}`]),
664
- onClick: (F) => d({
665
- bymonthday: e(l).options.bymonthday.includes(a) ? e(l).options.bymonthday.filter((U) => U !== a) : [...e(l).options.bymonthday, a]
666
- })
667
- }, j(a), 11, je))), 128))
668
- ])) : (r(), S("div", Ke, [
669
- y(O, {
670
- items: e($).ordinals,
671
- "model-value": (n = (f = e(l).options.bynweekday) == null ? void 0 : f[0]) == null ? void 0 : n[1],
672
- "onUpdate:modelValue": i[5] || (i[5] = (a) => {
673
- var F, U;
674
- return d({
675
- bynweekday: [[((U = (F = e(l).options.bynweekday) == null ? void 0 : F[0]) == null ? void 0 : U[0]) ?? 1, a]]
676
- });
677
- })
678
- }, null, 8, ["items", "model-value"]),
679
- x("div", Ge, [
680
- (r(!0), S(w, null, N(e($).weekdays, (a) => {
681
- var F, U;
682
- return r(), g(p, {
683
- class: P(["cursor-pointer", `${((U = (F = e(l).options.bynweekday) == null ? void 0 : F[0]) == null ? void 0 : U[0]) === a.value ? "bg-fm-color-primary text-white" : "bg-fm-color-neutral-gray-200 text-black"}`]),
684
- label: a.label[0],
685
- key: a.value,
686
- compact: !0,
687
- onClick: () => {
688
- var D, V;
689
- d({
690
- bynweekday: [
691
- [a.value, ((V = (D = e(l).options.bynweekday) == null ? void 0 : D[0]) == null ? void 0 : V[1]) ?? 1]
692
- ]
693
- });
694
- }
695
- }, null, 8, ["class", "label", "onClick"]);
696
- }), 128))
697
- ])
698
- ]))
699
- ], 64)) : q("", !0),
700
- o.applyButton ? (r(), S("div", Qe, [
701
- y(b, {
702
- label: "Cancel",
703
- variant: "tertiary",
704
- onClick: i[6] || (i[6] = (a) => s("cancel"))
705
- }),
706
- y(b, {
707
- label: "Apply",
708
- onClick: i[7] || (i[7] = (a) => s("update:model-value", e(l).toString()))
709
- })
710
- ])) : q("", !0)
711
- ]);
712
- };
713
- }
714
- }), ze = { class: "grid grid-cols-4 gap-8 w-full flex-wrap py-16" }, Ze = /* @__PURE__ */ A({
715
- __name: "IsInMonthInput",
716
- props: {
717
- modelValue: {
718
- type: Object,
719
- required: !0
720
- }
721
- },
722
- emits: ["update:model-value"],
723
- setup(o, { emit: R }) {
724
- const c = o, s = R, l = J.months().map((d, t) => ({
725
- name: d,
726
- shortName: J().month(t).format("MMM"),
727
- value: t
728
- }));
729
- return Z(() => {
730
- c.modelValue || s("update:model-value", []);
731
- }), (d, t) => {
732
- const i = k("FmChip");
733
- return r(), S("div", ze, [
734
- (r(!0), S(w, null, N(e(l), (v) => {
735
- var p, m;
736
- return r(), g(i, {
737
- class: P(["cursor-pointer", {
738
- "bg-fm-color-primary text-white": (p = o.modelValue) == null ? void 0 : p.includes(v.value),
739
- "bg-fm-color-gray-200 text-fm-color-gray-800": !((m = o.modelValue) != null && m.includes(
740
- v.value
741
- ))
742
- }]),
743
- label: v.name,
744
- key: v.value,
745
- compact: !0,
746
- onClick: (b) => s(
747
- "update:model-value",
748
- o.modelValue.includes(v.value) ? o.modelValue.filter((E) => E !== v.value) : [...o.modelValue, v.value]
749
- )
750
- }, null, 8, ["class", "label", "onClick"]);
751
- }), 128))
752
- ]);
753
- };
754
- }
755
- }), Je = /* @__PURE__ */ A({
756
- __name: "RuleEquator",
757
- props: {
758
- type: {
759
- type: String,
760
- required: !0
761
- },
762
- operator: {
763
- type: String,
764
- required: !0
765
- },
766
- modelValue: {
767
- type: Object
768
- }
769
- },
770
- emits: ["update:model-value"],
771
- setup(o, { emit: R }) {
772
- const c = o, s = R, l = B(() => {
773
- const d = pe[c.operator].safeParse(c.modelValue);
774
- return d.success ? [] : d.error.errors;
775
- });
776
- return (d, t) => {
777
- var n, a, F, U, D, V;
778
- const i = k("FmTextField"), v = k("FmStepperField"), p = k("FmSimpleDatePicker"), m = k("FmSimpleDateRangePicker"), b = k("FmTimeRangePicker"), E = k("FmTimePicker"), f = k("FmHelperText");
779
- return r(), S("div", {
780
- class: P({ "pb-4": e(l).length })
781
- }, [
782
- o.type === "text" ? (r(), g(i, {
783
- key: 0,
784
- "model-value": o.modelValue,
785
- "onUpdate:modelValue": t[0] || (t[0] = (u) => s("update:model-value", u))
786
- }, null, 8, ["model-value"])) : o.type === "number" ? (r(), g(v, {
787
- key: 1,
788
- "model-value": o.modelValue,
789
- "onUpdate:modelValue": t[1] || (t[1] = (u) => s("update:model-value", u))
790
- }, null, 8, ["model-value"])) : o.operator == "_isDay" ? (r(), g(oe(he), {
791
- key: 2,
792
- "model-value": o.modelValue,
793
- "onUpdate:modelValue": t[2] || (t[2] = (u) => s("update:model-value", u))
794
- }, null, 8, ["model-value"])) : o.operator == "_isRange" ? (r(), g(oe(De), {
795
- key: 3,
796
- "model-value": o.modelValue,
797
- "onUpdate:modelValue": t[3] || (t[3] = (u) => s("update:model-value", u))
798
- }, null, 8, ["model-value"])) : o.operator == "_isOnDate" ? (r(), g(p, {
799
- key: 4,
800
- "model-value": o.modelValue,
801
- "onUpdate:modelValue": t[4] || (t[4] = (u) => s("update:model-value", u))
802
- }, null, 8, ["model-value"])) : o.operator == "_isBetween" ? (r(), g(m, {
803
- key: 5,
804
- "model-value": {
805
- startDate: (n = o.modelValue) == null ? void 0 : n.start,
806
- endDate: (a = o.modelValue) == null ? void 0 : a.end
807
- },
808
- "onUpdate:modelValue": t[5] || (t[5] = (u) => {
809
- s("update:model-value", {
810
- start: u.startDate,
811
- end: u.endDate
812
- });
813
- })
814
- }, null, 8, ["model-value"])) : o.operator == "_isInMonth" ? (r(), g(Ze, {
815
- key: 6,
816
- "model-value": o.modelValue,
817
- "onUpdate:modelValue": t[6] || (t[6] = (u) => s("update:model-value", u))
818
- }, null, 8, ["model-value"])) : o.operator == "_rrule" ? (r(), g(X, {
819
- key: 7,
820
- "model-value": o.modelValue,
821
- "onUpdate:modelValue": t[7] || (t[7] = (u) => s("update:model-value", u))
822
- }, null, 8, ["model-value"])) : o.operator == "_isBetweenTime" ? (r(), g(b, {
823
- key: 8,
824
- "model-value": [(U = (F = o.modelValue) == null ? void 0 : F[0]) == null ? void 0 : U.start, (V = (D = o.modelValue) == null ? void 0 : D[0]) == null ? void 0 : V.end],
825
- "onUpdate:modelValue": t[8] || (t[8] = (u) => s("update:model-value", [
826
- {
827
- start: u[0],
828
- end: u[1]
829
- }
830
- ]))
831
- }, null, 8, ["model-value"])) : o.operator == "_isOnTime" ? (r(), g(E, {
832
- key: 9,
833
- "model-value": o.modelValue,
834
- "onUpdate:modelValue": t[9] || (t[9] = (u) => s("update:model-value", u))
835
- }, null, 8, ["model-value"])) : o.type == "tier" ? (r(), g(O, {
836
- key: 10,
837
- items: (e(Q)().sortedTiers ?? []).map((u, I) => ({
838
- label: `Tier ${I + 1} - ${u.name}`,
839
- value: I + 1
840
- })),
841
- "model-value": o.modelValue,
842
- "onUpdate:modelValue": t[10] || (t[10] = (u) => s("update:model-value", u))
843
- }, null, 8, ["items", "model-value"])) : o.type == "boolean" ? (r(), g(O, {
844
- key: 11,
845
- multiselect: !0,
846
- items: [
847
- { label: "true", value: !0 },
848
- { label: "false", value: !1 }
849
- ],
850
- "model-value": o.modelValue ?? [],
851
- "onUpdate:modelValue": t[11] || (t[11] = (u) => s("update:model-value", u))
852
- }, null, 8, ["model-value"])) : o.type == "gender" ? (r(), g(O, {
853
- key: 12,
854
- multiselect: !0,
855
- items: [
856
- { label: "Male", value: "MALE" },
857
- { label: "Female", value: "FEMALE" }
858
- ],
859
- "model-value": o.modelValue ?? [],
860
- "onUpdate:modelValue": t[12] || (t[12] = (u) => s("update:model-value", u))
861
- }, null, 8, ["model-value"])) : o.type == "collectible" ? (r(), g(O, {
862
- key: 13,
863
- multiselect: !0,
864
- items: [],
865
- "model-value": o.modelValue ?? [],
866
- "onUpdate:modelValue": t[13] || (t[13] = (u) => s("update:model-value", u))
867
- }, null, 8, ["model-value"])) : o.type == "segment" ? (r(), g(O, {
868
- key: 14,
869
- multiselect: !0,
870
- items: e(Q)().segmentOptions,
871
- "model-value": o.modelValue ?? [],
872
- "onUpdate:modelValue": t[14] || (t[14] = (u) => s("update:model-value", u)),
873
- label: "Select segment(s) to match"
874
- }, null, 8, ["items", "model-value"])) : o.type == "title" ? (r(), g(O, {
875
- key: 15,
876
- multiselect: !0,
877
- items: (e(Q)().sortedTitles ?? []).map((u) => ({
878
- label: u.name,
879
- value: u._id
880
- })),
881
- "model-value": o.modelValue ?? [],
882
- "onUpdate:modelValue": t[15] || (t[15] = (u) => s("update:model-value", u))
883
- }, null, 8, ["items", "model-value"])) : (r(), S(w, { key: 16 }, [
884
- ee(" Not implemented ")
885
- ], 64)),
886
- y(f, {
887
- class: "items-end",
888
- state: e(z).helperState(e(l), ""),
889
- text: e(z).helperText(e(l), "")
890
- }, null, 8, ["state", "text"])
891
- ], 2);
892
- };
893
- }
894
- }), Xe = { class: "space-y-4" }, et = /* @__PURE__ */ x("div", { class: "fm-typo-en-body-lg-400" }, "Property", -1), tt = /* @__PURE__ */ x("div", { class: "fm-typo-en-body-lg-400" }, "Check to perform", -1), lt = { class: "flex items-center gap-8" }, ot = /* @__PURE__ */ x("div", { class: "fm-typo-en-body-lg-400" }, "Criteria", -1), at = { class: "flex items-center justify-end gap-8 pt-16 w-full" }, rt = /* @__PURE__ */ A({
895
- __name: "CustomRuleDialog",
896
- props: {
897
- triggerType: {
898
- type: String,
899
- required: !0
900
- },
901
- includeOnly: {
902
- type: String
903
- },
904
- modelValue: {
905
- type: Object,
906
- default: () => {
907
- }
908
- }
909
- },
910
- setup(o) {
911
- const R = te(), c = Q(), { emitData: s, emitAction: l } = ue(), d = o, t = B(
912
- () => ye(d.triggerType, d.includeOnly)
913
- ), i = (V) => ae[t.value.find((u) => u.property === V).type], v = B(() => {
914
- if (!E.value) return [];
915
- const V = t.value.find(
916
- (u) => u.property === E.value.property
917
- );
918
- return V ? ae[V.type].map((u) => ({
919
- label: Ee[u].name,
920
- value: u
921
- })) : [];
922
- }), p = ce, m = B(() => {
923
- const V = p.safeParse(E.value);
924
- return V.success ? [] : V.error.errors;
925
- }), b = K(!1), E = K(
926
- se(d.modelValue) ?? h.constructEntry(
927
- t.value[0].property,
928
- i(t.value[0].property)[0],
929
- null
930
- )
931
- ), f = B(() => {
932
- var _;
933
- const { property: V, negated: u, conditions: I } = E.value, L = Object.keys(I || {})[0], H = Object.values(I || {})[0];
934
- return {
935
- property: V,
936
- negated: u == !0,
937
- type: (_ = t.value.find((W) => W.property === V)) == null ? void 0 : _.type,
938
- operator: L,
939
- equator: H
940
- };
941
- });
942
- function n(V) {
943
- E.value = h.constructEntry(
944
- V,
945
- i(V)[0],
946
- null
947
- );
948
- }
949
- function a(V) {
950
- E.value = { ...E.value, negated: V == !0 };
951
- }
952
- function F(V) {
953
- E.value = {
954
- ...E.value,
955
- conditions: { [V]: null }
956
- };
957
- }
958
- function U(V) {
959
- E.value.conditions = {
960
- [f.value.operator]: V
961
- };
962
- }
963
- function D() {
964
- s(E.value), l("primary"), R.close();
965
- }
966
- return ne(async () => {
967
- await c.readMembership();
968
- }), (V, u) => {
969
- const I = k("FmIcon"), L = k("FmField"), H = k("FmPill"), _ = k("FmMenuItem"), W = k("FmMenu"), G = k("FmButton");
970
- return r(), S("div", Xe, [
971
- et,
972
- y(W, {
973
- shift: !0,
974
- placement: "top-start",
975
- modelValue: e(b),
976
- "onUpdate:modelValue": u[0] || (u[0] = (Y) => ie(b) ? b.value = Y : null),
977
- onMenuChanged: u[1] || (u[1] = (Y) => b.value = Y)
978
- }, {
979
- "menu-button": M(() => [
980
- y(L, null, {
981
- append: M(() => [
982
- y(I, {
983
- name: e(b) ? "expand_less" : "expand_more"
984
- }, null, 8, ["name"])
985
- ]),
986
- default: M(() => {
987
- var Y;
988
- return [
989
- ee(j((Y = e(t).find((T) => T.property == e(E).property)) == null ? void 0 : Y.name) + " ", 1)
990
- ];
991
- }),
992
- _: 1
993
- })
994
- ]),
995
- default: M(() => [
996
- (r(!0), S(w, null, N(e(t), (Y) => (r(), g(_, {
997
- key: Y.property,
998
- "model-value": e(E).property == Y.property,
999
- label: Y.name,
1000
- disabled: Y.premium && !e(re)().isPremium,
1001
- onClick: (T) => Y.premium && !e(re)().isPremium ? null : n(Y.property)
1002
- }, me({ _: 2 }, [
1003
- Y.premium ? {
1004
- name: "append",
1005
- fn: M(() => [
1006
- y(H, { variant: "premium" })
1007
- ]),
1008
- key: "0"
1009
- } : void 0
1010
- ]), 1032, ["model-value", "label", "disabled", "onClick"]))), 128))
1011
- ]),
1012
- _: 1
1013
- }, 8, ["modelValue"]),
1014
- tt,
1015
- x("div", lt, [
1016
- y(O, {
1017
- class: "w-1/4",
1018
- items: [
1019
- { label: "is", value: !1 },
1020
- { label: "is not", value: !0 }
1021
- ],
1022
- "model-value": e(E).negated ?? !1,
1023
- "onUpdate:modelValue": a
1024
- }, null, 8, ["model-value"]),
1025
- y(O, {
1026
- class: "flex-1",
1027
- items: e(v),
1028
- "model-value": e(f).operator,
1029
- "onUpdate:modelValue": F
1030
- }, null, 8, ["items", "model-value"])
1031
- ]),
1032
- x("div", null, [
1033
- ot,
1034
- e(f).type ? (r(), g(Je, {
1035
- key: 0,
1036
- type: e(f).type,
1037
- operator: e(f).operator,
1038
- "model-value": e(f).equator,
1039
- "onUpdate:modelValue": U
1040
- }, null, 8, ["type", "operator", "model-value"])) : q("", !0)
1041
- ]),
1042
- x("div", at, [
1043
- y(G, {
1044
- onClick: u[2] || (u[2] = (Y) => e(R).close()),
1045
- label: "Cancel",
1046
- variant: "tertiary"
1047
- }),
1048
- y(G, {
1049
- onClick: u[3] || (u[3] = (Y) => D()),
1050
- disabled: e(m).length > 0,
1051
- label: "Save"
1052
- }, null, 8, ["disabled"])
1053
- ])
1054
- ]);
1055
- };
1056
- }
1057
- }), nt = { class: "flex flex-col gap-8" }, ut = { class: "grid grid-cols-2 items-center" }, st = { class: "flex items-center gap-8" }, it = { class: "pt-16 flex items-center self-end gap-8" }, mt = /* @__PURE__ */ A({
1058
- __name: "PresetRuleDialog",
1059
- props: {
1060
- preset: {
1061
- type: String,
1062
- required: !0
1063
- },
1064
- modelValue: {
1065
- type: Object
1066
- }
1067
- },
1068
- setup(o) {
1069
- const R = te(), { emitData: c, emitAction: s } = ue(), l = Q(), d = o;
1070
- function t() {
1071
- const { operator: f, equator: n } = p.value;
1072
- switch (d.preset) {
1073
- case "MIN_SPEND":
1074
- case "SPECIFIC_DATE":
1075
- case "SPECIFIC_TIMERANGE":
1076
- case "WEEKLY":
1077
- case "MONTHLY":
1078
- case "BIRTHDAY":
1079
- case "TIER":
1080
- return `Applies to ${l.sortedTiers.filter((F, U) => f == "_equal" ? U + 1 == n : f == "_moreThanOrEqual" ? U + 1 >= n : U + 1 <= n).map((F) => F.name).join(", ")}`;
1081
- }
1082
- }
1083
- function i() {
1084
- var f, n;
1085
- switch (d.preset) {
1086
- case "MIN_SPEND":
1087
- return h.constructEntry("bill.amount", "_moreThanOrEqual", 0);
1088
- case "SPECIFIC_DATE":
1089
- return h.constructEntry("trigger.date", "_isOnDate", "");
1090
- case "SPECIFIC_TIMERANGE":
1091
- return h.constructEntry("trigger.time", "_isBetweenTime", [
1092
- { start: "00:00", end: "23:59" }
1093
- ]);
1094
- case "WEEKLY":
1095
- return h.constructEntry(
1096
- "trigger.date",
1097
- "_rrule",
1098
- "RRULE:FREQ=WEEKLY;WKST=SU;BYDAY=SU;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
1099
- );
1100
- case "MONTHLY":
1101
- return h.constructEntry(
1102
- "trigger.date",
1103
- "_rrule",
1104
- "RRULE:FREQ=MONTHLY;WKST=SU;BYMONTHDAY=1;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
1105
- );
1106
- case "BIRTHDAY":
1107
- return h.constructEntry("user.birthday", "_isDay", {
1108
- op: "after",
1109
- x: 1,
1110
- ignoreYear: !0
1111
- });
1112
- case "TIER":
1113
- return h.constructEntry("user.tier", "_equal", 1);
1114
- case "TITLE":
1115
- return h.constructEntry("user.titles", "_hasAny", [
1116
- (n = (f = l.sortedTitles) == null ? void 0 : f[0]) == null ? void 0 : n._id
1117
- ]);
1118
- case "CUSTOM":
1119
- throw new Error("Not implemented");
1120
- }
1121
- }
1122
- const v = K(i()), p = B(() => {
1123
- const f = h.simplify(v.value);
1124
- return {
1125
- ...f,
1126
- equator: f.equator
1127
- };
1128
- });
1129
- function m(f, n) {
1130
- const a = p.value;
1131
- v.value = h.constructEntry(
1132
- a.property,
1133
- n ?? a.operator,
1134
- f,
1135
- v.value.name
1136
- );
1137
- }
1138
- function b() {
1139
- c(v.value), s("primary"), R.close();
1140
- }
1141
- const E = B(() => {
1142
- const f = ve.safeParse(v.value);
1143
- return f.success ? [] : f.error.errors;
1144
- });
1145
- return ne(async () => {
1146
- await l.readMembership();
1147
- }), (f, n) => {
1148
- var H, _, W, G, Y;
1149
- const a = k("FmStepperField"), F = k("FmDatePicker"), U = k("FmTimeRangePicker"), D = k("FmRadio"), V = k("FmSelect"), u = k("FmRadioGroup"), I = k("FmHelperText"), L = k("FmButton");
1150
- return r(), S("div", nt, [
1151
- o.preset == "MIN_SPEND" ? (r(), g(a, {
1152
- key: 0,
1153
- label: "Minimum spend",
1154
- "model-value": e(p).equator,
1155
- "onUpdate:modelValue": n[0] || (n[0] = (T) => m(T))
1156
- }, null, 8, ["model-value"])) : o.preset == "SPECIFIC_DATE" ? (r(), g(F, {
1157
- key: 1,
1158
- label: "Specific Date",
1159
- "model-value": e(p).equator,
1160
- "onUpdate:modelValue": n[1] || (n[1] = (T) => m(T))
1161
- }, null, 8, ["model-value"])) : o.preset == "SPECIFIC_TIMERANGE" ? (r(), g(U, {
1162
- key: 2,
1163
- label: "Time is between",
1164
- "model-value": [(_ = (H = e(p).equator) == null ? void 0 : H[0]) == null ? void 0 : _.start, (G = (W = e(p).equator) == null ? void 0 : W[0]) == null ? void 0 : G.end],
1165
- "onUpdate:modelValue": n[2] || (n[2] = (T) => m([
1166
- {
1167
- start: T[0],
1168
- end: T[1]
1169
- }
1170
- ]))
1171
- }, null, 8, ["model-value"])) : o.preset == "WEEKLY" ? (r(), g(X, {
1172
- key: 3,
1173
- label: "Weekly",
1174
- "fixed-frequency": !0,
1175
- "model-value": e(p).equator,
1176
- "onUpdate:modelValue": n[3] || (n[3] = (T) => m(T))
1177
- }, null, 8, ["model-value"])) : o.preset == "MONTHLY" ? (r(), g(X, {
1178
- key: 4,
1179
- label: "Weekly",
1180
- "fixed-frequency": !0,
1181
- "model-value": e(p).equator,
1182
- "onUpdate:modelValue": n[4] || (n[4] = (T) => m(T))
1183
- }, null, 8, ["model-value"])) : o.preset == "BIRTHDAY" ? (r(), S(w, { key: 5 }, [
1184
- x("div", ut, [
1185
- y(D, {
1186
- label: "N days before birthday",
1187
- value: "_isDay",
1188
- "model-value": e(p).operator,
1189
- "onUpdate:modelValue": n[5] || (n[5] = () => {
1190
- m(
1191
- {
1192
- op: "after",
1193
- x: 1,
1194
- ignoreYear: !0
1195
- },
1196
- "_isDay"
1197
- );
1198
- })
1199
- }, null, 8, ["model-value"]),
1200
- x("div", st, [
1201
- y(D, {
1202
- label: "Is in this",
1203
- value: "_isRange",
1204
- "model-value": e(p).operator,
1205
- "onUpdate:modelValue": n[6] || (n[6] = () => {
1206
- m(
1207
- {
1208
- op: "this",
1209
- unit: "day",
1210
- ignoreYear: !0
1211
- },
1212
- "_isRange"
1213
- );
1214
- })
1215
- }, null, 8, ["model-value"]),
1216
- e(p).operator == "_isRange" ? (r(), g(V, {
1217
- key: 0,
1218
- items: ["day", "week", "month"].map((T) => ({ label: T, value: T })),
1219
- "model-value": e(p).equator.unit,
1220
- "onUpdate:modelValue": n[7] || (n[7] = (T) => m(
1221
- {
1222
- op: "this",
1223
- unit: T,
1224
- ignoreYear: !0
1225
- },
1226
- "_isRange"
1227
- ))
1228
- }, null, 8, ["items", "model-value"])) : q("", !0)
1229
- ])
1230
- ]),
1231
- e(p).operator == "_isDay" ? (r(), g(a, {
1232
- key: 0,
1233
- label: "Days before birthday",
1234
- "show-steppers": !1,
1235
- "model-value": e(p).equator.x,
1236
- "onUpdate:modelValue": n[8] || (n[8] = (T) => m({
1237
- op: "after",
1238
- x: T,
1239
- ignoreYear: !0
1240
- }))
1241
- }, null, 8, ["model-value"])) : q("", !0)
1242
- ], 64)) : o.preset == "TIER" ? (r(), S(w, { key: 6 }, [
1243
- y(u, {
1244
- inline: !0,
1245
- "model-value": e(p).operator,
1246
- "onUpdate:modelValue": n[9] || (n[9] = (T) => m(e(p).equator, T))
1247
- }, {
1248
- default: M(() => [
1249
- y(D, {
1250
- value: "_moreThanOrEqual",
1251
- label: "At least"
1252
- }),
1253
- y(D, {
1254
- value: "_equal",
1255
- label: "Equal"
1256
- }),
1257
- y(D, {
1258
- value: "_lessThanOrEqual",
1259
- label: "At most"
1260
- })
1261
- ]),
1262
- _: 1
1263
- }, 8, ["model-value"]),
1264
- y(O, {
1265
- items: (e(l).sortedTiers ?? []).map((T, le) => ({
1266
- label: `Tier ${le + 1} - ${T.name}`,
1267
- value: le + 1
1268
- })),
1269
- "model-value": e(p).equator,
1270
- "onUpdate:modelValue": n[10] || (n[10] = (T) => m(T))
1271
- }, null, 8, ["items", "model-value"]),
1272
- y(I, {
1273
- text: t()
1274
- }, null, 8, ["text"])
1275
- ], 64)) : o.preset == "TITLE" ? (r(), g(O, {
1276
- key: 7,
1277
- label: "User has title",
1278
- items: (e(l).sortedTitles ?? []).map((T) => ({
1279
- label: T.name,
1280
- value: T._id
1281
- })),
1282
- "model-value": (Y = e(p).equator) == null ? void 0 : Y[0],
1283
- "onUpdate:modelValue": n[11] || (n[11] = (T) => m([T]))
1284
- }, null, 8, ["items", "model-value"])) : q("", !0),
1285
- y(I, {
1286
- class: "mt-[-8px]",
1287
- text: e(z).helperText(e(E), ""),
1288
- state: e(z).helperState(e(E), "")
1289
- }, null, 8, ["text", "state"]),
1290
- x("div", it, [
1291
- y(L, {
1292
- onClick: n[12] || (n[12] = (T) => e(R).close()),
1293
- label: "Cancel",
1294
- variant: "tertiary"
1295
- }),
1296
- y(L, {
1297
- onClick: n[13] || (n[13] = (T) => b()),
1298
- disabled: e(E).length > 0,
1299
- label: "Save"
1300
- }, null, 8, ["disabled"])
1301
- ])
1302
- ]);
1303
- };
1304
- }
1305
- }), dt = /* @__PURE__ */ A({
1306
- __name: "RuleConfigurator",
1307
- props: {
1308
- triggerType: {
1309
- type: String,
1310
- required: !0
1311
- },
1312
- includeOnly: {
1313
- type: String
1314
- },
1315
- modelValue: {
1316
- type: Object,
1317
- default: () => {
1318
- }
1319
- }
1320
- },
1321
- emits: ["update:model-value"],
1322
- setup(o, { expose: R, emit: c }) {
1323
- const s = o, l = c, d = te(), t = K();
1324
- function i(m) {
1325
- d.open({
1326
- title: m.name,
1327
- closeButton: !1,
1328
- dismissAway: !1,
1329
- contentComponent: mt,
1330
- contentComponentProps: {
1331
- preset: m.type,
1332
- modelValue: s.modelValue
1333
- }
1334
- }).onPrimary((b) => l("update:model-value", b));
1335
- }
1336
- function v(m) {
1337
- d.open({
1338
- title: "Edit rule",
1339
- closeButton: !1,
1340
- dismissAway: !1,
1341
- contentComponent: rt,
1342
- contentComponentProps: {
1343
- triggerType: s.triggerType,
1344
- includeOnly: s.includeOnly,
1345
- modelValue: m
1346
- }
1347
- }).onPrimary((b) => l("update:model-value", b));
1348
- }
1349
- function p(m) {
1350
- if (m.type == "CUSTOM") {
1351
- const [b] = m.rules;
1352
- return v(
1353
- h.constructEntry(b.property, b.operator, b.equator)
1354
- );
1355
- }
1356
- return i(m);
1357
- }
1358
- return R({
1359
- showCustomDialog: v
1360
- }), (m, b) => {
1361
- const E = k("FmButton"), f = k("FmMenuItem"), n = k("FmMenu");
1362
- return r(), g(n, {
1363
- shift: !0,
1364
- placement: "top-start"
1365
- }, {
1366
- "menu-button": M(() => [
1367
- y(E, {
1368
- label: "Add condition",
1369
- icon: "add",
1370
- class: "text-fm-color-primary border-fm-color-primary",
1371
- "icon-color": "primary",
1372
- variant: "secondary"
1373
- })
1374
- ]),
1375
- default: M(() => [
1376
- (r(!0), S(w, null, N(e(Ce).filter(
1377
- (a) => !o.includeOnly || a.for.includes(o.includeOnly)
1378
- ), (a) => (r(), g(f, {
1379
- key: a.name,
1380
- "model-value": a.name == e(t),
1381
- label: a.name,
1382
- onClick: (F) => p(a)
1383
- }, null, 8, ["model-value", "label", "onClick"]))), 128))
1384
- ]),
1385
- _: 1
1386
- });
1387
- };
1388
- }
1389
- }), pt = /* @__PURE__ */ x("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " When ", -1), ht = /* @__PURE__ */ A({
1390
- __name: "RuleGroup",
1391
- props: {
1392
- triggerType: {
1393
- type: String,
1394
- required: !0
1395
- },
1396
- includeOnly: {
1397
- type: String
1398
- },
1399
- modelValue: {
1400
- type: Object
1401
- }
1402
- },
1403
- emits: ["update:model-value"],
1404
- setup(o, { emit: R }) {
1405
- const c = o, s = R, l = B(
1406
- () => c.modelValue ?? h.scaffoldGroup()
1407
- ), d = B(() => h.getLogic(l.value)), t = K();
1408
- return (i, v) => {
1409
- const p = k("FmButtonGroup"), m = k("FmCard");
1410
- return r(), g(m, { variant: "outlined" }, {
1411
- default: M(() => [
1412
- y(m, { class: "border-l-4 border-fm-color-primary p-16 space-y-16" }, {
1413
- default: M(() => [
1414
- pt,
1415
- y(dt, {
1416
- ref_key: "configuratorRef",
1417
- ref: t,
1418
- "include-only": o.includeOnly,
1419
- "trigger-type": o.triggerType,
1420
- "onUpdate:modelValue": v[0] || (v[0] = (b) => s("update:model-value", e(h).setRuleToGroup(e(l), b)))
1421
- }, null, 8, ["include-only", "trigger-type"]),
1422
- (r(!0), S(w, null, N(e(l).rules, (b, E) => {
1423
- var f;
1424
- return r(), S(w, null, [
1425
- e(be)(b) ? (r(), g(Re, {
1426
- "model-value": b,
1427
- key: E,
1428
- onEdit: (f = e(t)) == null ? void 0 : f.showCustomDialog,
1429
- onRemove: v[1] || (v[1] = (n) => {
1430
- s(
1431
- "update:model-value",
1432
- e(h).removeEntry(e(l), n.name)
1433
- );
1434
- })
1435
- }, null, 8, ["model-value", "onEdit"])) : q("", !0),
1436
- y(p, {
1437
- class: "w-[200px]",
1438
- disabled: Object.keys(e(l).rules).length < 2,
1439
- items: [{ label: "And" }, { label: "Or" }],
1440
- "model-value": e(d) === "&&" ? { label: "And" } : { label: "Or" },
1441
- "onUpdate:modelValue": v[2] || (v[2] = (n) => s(
1442
- "update:model-value",
1443
- e(h).setRuleToGroup(
1444
- e(l),
1445
- [],
1446
- n.label === "And" ? "&&" : "||"
1447
- )
1448
- ))
1449
- }, null, 8, ["disabled", "model-value"])
1450
- ], 64);
1451
- }), 256))
1452
- ]),
1453
- _: 1
1454
- })
1455
- ]),
1456
- _: 1
1457
- });
1458
- };
1459
- }
1460
- });
1461
- export {
1462
- ht as _,
1463
- X as a
1464
- };