@feedmepos/mf-connect 0.0.16-beta.10 → 0.0.16-beta.12

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 (85) hide show
  1. package/dist/{Analytic-BVk0jPDU.js → Analytic-DIc9BYb0.js} +32 -20
  2. package/dist/{App-BbAalq1k.js → App-BzzL9_Jw.js} +33 -27
  3. package/dist/Broadcast-dVPgK5QV.js +223 -0
  4. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DiU3MnH0.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-TnEPvafD.js} +18 -11
  5. package/dist/{Card-B5in1RMa.js → Card-Bj2Yd2pr.js} +178 -158
  6. package/dist/ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js +97 -0
  7. package/dist/Collections-Fkb_zzqZ.js +453 -0
  8. package/dist/{Credit-Bc9EzdsC.js → Credit-DHn9OkE8.js} +78 -69
  9. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-C1ZXQski.js +2788 -0
  10. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-D6mWny8y.js +344 -0
  11. package/dist/{Experience-CgKak5ik.js → Experience-DX3aJihS.js} +64 -55
  12. package/dist/{Game-QhfKqrN_.js → Game-CcVQvETd.js} +54 -45
  13. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-rWUkV9gn.js +144 -0
  14. package/dist/JsonViewer-v8_C7l5N.js +87 -0
  15. package/dist/LottieAnimation.vue_vue_type_script_setup_true_lang-CyGJxUol.js +18737 -0
  16. package/dist/MainLayout-B1aJoR95.js +41 -0
  17. package/dist/{Marketing-CSx4N7UJ.js → Marketing-B9kykWEh.js} +79 -72
  18. package/dist/{Member-CY6WMD8D.js → Member-RoJSCSC5.js} +25 -22
  19. package/dist/{MemberList-8iRwm7Sz.js → MemberList-BUDxqMEK.js} +321 -307
  20. package/dist/{MemberTransactions-CknqkWO3.js → MemberTransactions-Bh_tT1Rp.js} +1 -1
  21. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-Cj3-JHOX.js +432 -0
  22. package/dist/{Mission-BTy1p7lU.js → Mission-DDvgCLy0.js} +50 -40
  23. package/dist/{Point-A6B_ggSy.js → Point-BbPkt4kF.js} +67 -58
  24. package/dist/Promotion-DEo-lxpX.js +221 -0
  25. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-BGjeTeqS.js +1751 -0
  26. package/dist/{Segment-CFVXtyEj.js → Segment-DAcpZWIN.js} +145 -130
  27. package/dist/{Setting-Jmtw-_DV.js → Setting-CgXohUPt.js} +167 -154
  28. package/dist/{Store-DQypT-7e.js → Store-BVyHbQ8o.js} +504 -489
  29. package/dist/{StoreRewards-M-utm0iI.js → StoreRewards-sccMDbkj.js} +124 -108
  30. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-B60mQ5kq.js → StoreTransactions.vue_vue_type_script_setup_true_lang--sdQ_l8g.js} +131 -123
  31. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-CXlkvt2u.js +139 -0
  32. package/dist/{Tier-D1jymeLK.js → Tier--P27XXbB.js} +144 -125
  33. package/dist/{Title-DN9DIP2k.js → Title-B27S3SxD.js} +107 -90
  34. package/dist/{Transaction-BAJvAoU6.js → Transaction-CYTtwwHY.js} +2 -2
  35. package/dist/Voucher-BZ8PKgO5.js +488 -0
  36. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-CWt4tVdk.js +55 -0
  37. package/dist/_commonjsHelpers-BkfeUUK-.js +28 -0
  38. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
  39. package/dist/app-CnKzqAcN.js +53428 -0
  40. package/dist/app-FfENBuoE.js +5381 -0
  41. package/dist/app-wDQR6dpb.js +39 -0
  42. package/dist/app.js +2 -1
  43. package/dist/business-CXyP9G7A.js +78 -0
  44. package/dist/campaign-0aM2KYOy.js +96 -0
  45. package/dist/campaign-CpzFl8Vr.js +4 -0
  46. package/dist/collection.fn-FicQhH1t.js +26 -0
  47. package/dist/dto-BiYLkVdL.js +1169 -0
  48. package/dist/effect-Cg-eNEjg.js +61 -0
  49. package/dist/{export-DjeNY5Pc.js → export-D7BuObOL.js} +19 -16
  50. package/dist/helper-DvD-D7c7.js +71 -0
  51. package/dist/index-B1Q0GAWp.js +95 -0
  52. package/dist/index-B4UZgSB-.js +28058 -0
  53. package/dist/index-B6c-fUij.js +203 -0
  54. package/dist/index-BP_5cfKa.js +38 -0
  55. package/dist/index-BRXg5Si1.js +2071 -0
  56. package/dist/index-BuDwICBJ.js +761 -0
  57. package/dist/index-CDMC-8iO.js +94 -0
  58. package/dist/index-CcZt3OrE.js +73 -0
  59. package/dist/index-CuvNtC_M.js +61 -0
  60. package/dist/index-DA-fzkRR.js +1737 -0
  61. package/dist/index-Dbd4WA4r.js +61 -0
  62. package/dist/index-Dkeb_9ER.js +8832 -0
  63. package/dist/index-DmdKoKk_.js +298 -0
  64. package/dist/index-G-88ujCM.js +3 -0
  65. package/dist/loading-uCNeZibp.js +32697 -0
  66. package/dist/lodash-B5I3zXaY.js +3678 -0
  67. package/dist/membership-DFRO9TyM.js +221 -0
  68. package/dist/moment-BWErdI6_.js +2578 -0
  69. package/dist/money-OtkT4Pzp.js +15 -0
  70. package/dist/number-Cg3NCouc.js +12 -0
  71. package/dist/object-qECH92oz.js +26 -0
  72. package/dist/objectId-dwaoBfJX.js +7 -0
  73. package/dist/rule-Ch2HRiGw.js +1973 -0
  74. package/dist/rule-builder-B_M9yvEe.js +89 -0
  75. package/dist/template-1o0LbOoJ.js +190 -0
  76. package/dist/usePagination-BeF5K3M7.js +223 -0
  77. package/dist/vue-i18n-AtGIa4qH.js +2365 -0
  78. package/dist/xlsx-pChq0adn.js +15491 -0
  79. package/dist/zod-W_PvIofQ.js +90 -0
  80. package/package.json +3 -3
  81. package/dist/Collections-CFCZ9YIG.js +0 -4
  82. package/dist/MainLayout-JbHzENFy.js +0 -4
  83. package/dist/app-BpzzygYP.js +0 -87765
  84. package/dist/money-DKGIIplY.js +0 -15
  85. package/dist/number-tPodRxTN.js +0 -12
@@ -0,0 +1,1751 @@
1
+ import { defineComponent as N, computed as M, resolveComponent as g, openBlock as n, createElementBlock as F, createElementVNode as U, createVNode as v, unref as e, createTextVNode as ee, toDisplayString as j, withCtx as B, onMounted as K, createBlock as T, createCommentVNode as _, ref as P, Fragment as Y, renderList as A, normalizeClass as L, watch as ie, resolveDynamicComponent as ae, onBeforeMount as ue, isRef as me, createSlots as de } from "vue";
2
+ import { c as pe, C as ye, d as ce, e as ve, f as fe } from "./index-Dkeb_9ER.js";
3
+ import { R as D, a as be } from "./rule-builder-B_M9yvEe.js";
4
+ import { a as ge, R as O, S as ke, C as H, W as Ve, T as ne, O as Ee } from "./rule-Ch2HRiGw.js";
5
+ import { p as Fe } from "./loading-uCNeZibp.js";
6
+ import { useDialog as te, useDialogChild as se } from "@feedmepos/ui-library";
7
+ import { h as J } from "./moment-BWErdI6_.js";
8
+ import { z as Se } from "./app-FfENBuoE.js";
9
+ import { u as z } from "./membership-DFRO9TyM.js";
10
+ import { u as re } from "./business-CXyP9G7A.js";
11
+ import { _ as I } from "./index-BRXg5Si1.js";
12
+ import { c as le } from "./object-qECH92oz.js";
13
+ import { Z } from "./zod-W_PvIofQ.js";
14
+ import { e as Te } from "./app-CnKzqAcN.js";
15
+ import "./index-B6c-fUij.js";
16
+ import "./index-BuDwICBJ.js";
17
+ import "./index-DA-fzkRR.js";
18
+ import "./index-DmdKoKk_.js";
19
+ import "./index-BP_5cfKa.js";
20
+ const xe = { class: "flex items-center justify-between" }, Ce = { class: "flex items-center gap-8 xs:flex-wrap" }, Ue = { class: "text-fm-color-primary line-clamp-1 text-ellipsis" }, Re = /* @__PURE__ */ N({
21
+ __name: "RuleEntry",
22
+ props: {
23
+ modelValue: {
24
+ type: Object,
25
+ required: !0
26
+ }
27
+ },
28
+ emits: ["edit", "remove"],
29
+ setup(a, { emit: R }) {
30
+ const f = a, i = M(() => {
31
+ const [s, u] = Object.entries(f.modelValue.conditions)[0];
32
+ return {
33
+ negated: f.modelValue.negated == !0,
34
+ property: f.modelValue.property,
35
+ operator: s,
36
+ equator: u
37
+ };
38
+ }), l = R, b = M(
39
+ () => ge(
40
+ i.value.property,
41
+ i.value.operator,
42
+ i.value.equator,
43
+ i.value.negated
44
+ )
45
+ );
46
+ async function t(s) {
47
+ s.stopPropagation(), await Fe.remove("Are you sure you want to remove this rule?") && l("remove", f.modelValue);
48
+ }
49
+ return (s, u) => {
50
+ var V;
51
+ const p = g("FmChip"), y = g("FmTooltip"), k = g("FmIcon");
52
+ return n(), F("div", xe, [
53
+ U("div", Ce, [
54
+ v(p, {
55
+ label: (V = e(pe).find((S) => S.property === f.modelValue.property)) == null ? void 0 : V.name,
56
+ class: "!text-fm-color-typo-info !bg-fm-color-system-info-100"
57
+ }, null, 8, ["label"]),
58
+ u[1] || (u[1] = U("div", { class: "h-[26px] border-l-2 rounded-md border-fm-color-neutral-gray-100" }, null, -1)),
59
+ U("div", {
60
+ onClick: u[0] || (u[0] = (S) => l("edit", f.modelValue)),
61
+ 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"
62
+ }, [
63
+ ee(j(e(b)[0]) + " ", 1),
64
+ v(y, {
65
+ "z-index": 1e3,
66
+ content: e(b)[1]
67
+ }, {
68
+ default: B(() => [
69
+ U("div", Ue, j(e(b)[1]), 1)
70
+ ]),
71
+ _: 1
72
+ }, 8, ["content"])
73
+ ])
74
+ ]),
75
+ v(k, {
76
+ name: "close",
77
+ size: "md",
78
+ class: "cursor-pointer hover:bg-neutral-300 rounded-lg",
79
+ onClick: t
80
+ })
81
+ ]);
82
+ };
83
+ }
84
+ });
85
+ Se.enum([
86
+ "MIN_SPEND",
87
+ "SPECIFIC_DATE",
88
+ "SPECIFIC_TIMERANGE",
89
+ "WEEKLY",
90
+ "MONTHLY",
91
+ "BIRTHDAY",
92
+ "TIER",
93
+ "TITLE",
94
+ "CUSTOM"
95
+ ]);
96
+ const Oe = [
97
+ {
98
+ type: "MIN_SPEND",
99
+ name: "Minimum spend",
100
+ for: ["bill"],
101
+ rules: []
102
+ },
103
+ {
104
+ type: "SPECIFIC_DATE",
105
+ name: "Specific date",
106
+ for: ["trigger"],
107
+ rules: []
108
+ },
109
+ {
110
+ type: "SPECIFIC_TIMERANGE",
111
+ name: "Specific time range",
112
+ for: ["trigger"],
113
+ rules: []
114
+ },
115
+ {
116
+ type: "WEEKLY",
117
+ name: "Weekly",
118
+ for: ["trigger"],
119
+ rules: [
120
+ {
121
+ property: "trigger.date",
122
+ operator: "_rrule",
123
+ equator: "RRULE:FREQ=WEEKLY;WKST=SU;BYDAY=SU;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
124
+ }
125
+ ]
126
+ },
127
+ {
128
+ type: "MONTHLY",
129
+ name: "Monthly",
130
+ for: ["trigger"],
131
+ rules: [
132
+ {
133
+ property: "trigger.date",
134
+ operator: "_rrule",
135
+ equator: "RRULE:FREQ=MONTHLY;WKST=SU;BYMONTHDAY=1;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
136
+ }
137
+ ]
138
+ },
139
+ {
140
+ type: "BIRTHDAY",
141
+ name: "Birthday",
142
+ for: ["user"],
143
+ rules: [
144
+ {
145
+ property: "user.birthday",
146
+ operator: "_isDay",
147
+ equator: {
148
+ op: "this",
149
+ unit: "day",
150
+ ignoreYear: !0
151
+ }
152
+ }
153
+ ]
154
+ },
155
+ {
156
+ type: "TIER",
157
+ name: "Specific tier",
158
+ for: ["user"],
159
+ rules: [
160
+ {
161
+ property: "user.tier",
162
+ operator: "_equal",
163
+ equator: 1
164
+ }
165
+ ]
166
+ },
167
+ {
168
+ type: "TITLE",
169
+ name: "Specific title",
170
+ for: ["user"],
171
+ rules: [
172
+ {
173
+ property: "user.titles",
174
+ operator: "_hasAny",
175
+ equator: []
176
+ }
177
+ ]
178
+ },
179
+ {
180
+ type: "CUSTOM",
181
+ name: "Weekday special",
182
+ for: ["trigger"],
183
+ rules: [
184
+ {
185
+ property: "trigger.date",
186
+ operator: "_rrule",
187
+ equator: "RRULE:FREQ=WEEKLY;WKST=SU;BYDAY=MO,TU,WE,TH,FR;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
188
+ }
189
+ ]
190
+ },
191
+ {
192
+ type: "CUSTOM",
193
+ name: "Weekend special",
194
+ for: ["trigger"],
195
+ rules: [
196
+ {
197
+ property: "trigger.date",
198
+ operator: "_rrule",
199
+ equator: "RRULE:FREQ=WEEKLY;WKST=SU;BYDAY=SU,SA;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
200
+ }
201
+ ]
202
+ },
203
+ {
204
+ type: "CUSTOM",
205
+ name: "Happy hour",
206
+ for: ["trigger"],
207
+ rules: [
208
+ {
209
+ property: "trigger.time",
210
+ operator: "_isBetweenTime",
211
+ equator: [
212
+ {
213
+ start: "21:00",
214
+ end: "23:59"
215
+ }
216
+ ]
217
+ }
218
+ ]
219
+ },
220
+ {
221
+ type: "CUSTOM",
222
+ name: "Mother's day special",
223
+ for: ["trigger"],
224
+ rules: [
225
+ {
226
+ property: "trigger.date",
227
+ operator: "_rrule",
228
+ equator: "RRULE:FREQ=YEARLY;WKST=SU;BYDAY=+2SU;BYMONTH=5;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
229
+ }
230
+ ]
231
+ },
232
+ {
233
+ type: "CUSTOM",
234
+ name: "Father's day special",
235
+ for: ["trigger"],
236
+ rules: [
237
+ {
238
+ property: "trigger.date",
239
+ operator: "_rrule",
240
+ equator: "RRULE:FREQ=YEARLY;WKST=SU;BYDAY=+3SU;BYMONTH=6;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
241
+ }
242
+ ]
243
+ },
244
+ {
245
+ type: "CUSTOM",
246
+ name: "Christmas",
247
+ for: ["trigger"],
248
+ rules: [
249
+ {
250
+ property: "trigger.date",
251
+ operator: "_rrule",
252
+ equator: "RRULE:FREQ=YEARLY;WKST=SU;BYMONTH=12;BYMONTHDAY=25;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
253
+ }
254
+ ]
255
+ },
256
+ {
257
+ type: "CUSTOM",
258
+ name: "Feedback rating",
259
+ for: ["feedback"],
260
+ rules: [
261
+ {
262
+ property: "feedback.rating",
263
+ operator: "_lessThanOrEqual",
264
+ equator: 5
265
+ }
266
+ ]
267
+ },
268
+ {
269
+ type: "CUSTOM",
270
+ name: "Custom",
271
+ for: ["trigger", "user", "bill", "feedback"],
272
+ rules: [
273
+ {
274
+ property: "trigger.date",
275
+ operator: "_isOnDate",
276
+ equator: J().format("YYYY-MM-DD")
277
+ }
278
+ ]
279
+ }
280
+ ], we = { class: "flex flex-nowrap gap-x-4 items-center" }, he = /* @__PURE__ */ N({
281
+ __name: "IsDayInput",
282
+ props: {
283
+ modelValue: {
284
+ type: Object
285
+ }
286
+ },
287
+ emits: ["update:model-value"],
288
+ setup(a, { emit: R }) {
289
+ const f = a, i = R;
290
+ K(() => {
291
+ f.modelValue || i("update:model-value", {
292
+ op: "before",
293
+ x: 1
294
+ });
295
+ });
296
+ function l(b) {
297
+ const t = le(
298
+ f.modelValue ?? {
299
+ op: "before",
300
+ x: 1
301
+ }
302
+ );
303
+ i("update:model-value", {
304
+ ...t,
305
+ ...b
306
+ });
307
+ }
308
+ return (b, t) => {
309
+ var u, p, y;
310
+ const s = g("FmStepperField");
311
+ return n(), F("div", we, [
312
+ v(s, {
313
+ class: "w-1/3",
314
+ "model-value": ((u = a.modelValue) == null ? void 0 : u.x) ?? null,
315
+ max: 365,
316
+ "show-steppers": !1,
317
+ "append-text": "days",
318
+ "onUpdate:modelValue": t[0] || (t[0] = (k) => l({ x: k }))
319
+ }, null, 8, ["model-value"]),
320
+ v(I, {
321
+ "model-value": ((p = a.modelValue) == null ? void 0 : p.op) ?? void 0,
322
+ items: [
323
+ { label: "before", value: "before" },
324
+ { label: "after", value: "after" }
325
+ ],
326
+ "onUpdate:modelValue": t[1] || (t[1] = (k) => l({ op: k }))
327
+ }, null, 8, ["model-value"]),
328
+ v(I, {
329
+ "model-value": ((y = a.modelValue) == null ? void 0 : y.ignoreYear) ?? !1,
330
+ items: [
331
+ { label: "same year", value: !1 },
332
+ { label: "ignore year", value: !0 }
333
+ ],
334
+ required: !0,
335
+ "onUpdate:modelValue": t[2] || (t[2] = (k) => l({ ignoreYear: k == !0 }))
336
+ }, null, 8, ["model-value"])
337
+ ]);
338
+ };
339
+ }
340
+ }), Ye = { class: "grid grid-cols-4 gap-x-4 items-center" }, De = /* @__PURE__ */ N({
341
+ __name: "IsRangeInput",
342
+ props: {
343
+ modelValue: {
344
+ type: Object,
345
+ default: () => ({
346
+ op: "this",
347
+ unit: "day",
348
+ ignoreYear: !0
349
+ })
350
+ }
351
+ },
352
+ emits: ["update:model-value"],
353
+ setup(a, { emit: R }) {
354
+ const f = a, i = R;
355
+ K(() => {
356
+ f.modelValue || i("update:model-value", {
357
+ op: "this",
358
+ unit: "day",
359
+ ignoreYear: !0
360
+ });
361
+ });
362
+ const l = [
363
+ { label: "day", value: "day" },
364
+ { label: "week", value: "week" },
365
+ { label: "month", value: "month" },
366
+ { label: "quarter", value: "quarter" },
367
+ { label: "year", value: "year" }
368
+ ], b = [
369
+ {
370
+ label: "this",
371
+ value: "this"
372
+ },
373
+ {
374
+ label: "last",
375
+ value: "last"
376
+ },
377
+ {
378
+ label: "next",
379
+ value: "next"
380
+ }
381
+ ];
382
+ return (t, s) => {
383
+ var p, y, k, V, S;
384
+ const u = g("FmStepperField");
385
+ return n(), F("div", Ye, [
386
+ v(I, {
387
+ "model-value": (p = a.modelValue) == null ? void 0 : p.op,
388
+ label: "",
389
+ items: b,
390
+ required: !0,
391
+ "onUpdate:modelValue": s[0] || (s[0] = (m) => i("update:model-value", { op: m, unit: "day", ignoreYear: !1 }))
392
+ }, null, 8, ["model-value"]),
393
+ ((y = a.modelValue) == null ? void 0 : y.op) != "this" ? (n(), T(u, {
394
+ key: 0,
395
+ "model-value": ((k = a.modelValue) == null ? void 0 : k.x) || 0,
396
+ max: 365,
397
+ "show-steppers": !1,
398
+ "onUpdate:modelValue": s[1] || (s[1] = (m) => i("update:model-value", {
399
+ op: a.modelValue.op,
400
+ unit: a.modelValue.unit,
401
+ ignoreYear: a.modelValue.ignoreYear == !0,
402
+ x: m
403
+ }))
404
+ }, null, 8, ["model-value"])) : _("", !0),
405
+ v(I, {
406
+ "model-value": (V = a.modelValue) == null ? void 0 : V.unit,
407
+ label: "",
408
+ items: l,
409
+ required: !0,
410
+ "onUpdate:modelValue": s[2] || (s[2] = (m) => i("update:model-value", { ...f.modelValue, unit: m }))
411
+ }, null, 8, ["model-value"]),
412
+ v(I, {
413
+ label: "",
414
+ "model-value": (S = a.modelValue) == null ? void 0 : S.ignoreYear,
415
+ items: [
416
+ { label: "same", value: !1 },
417
+ { label: "ignore", value: !0 }
418
+ ],
419
+ required: !0,
420
+ "onUpdate:modelValue": s[3] || (s[3] = (m) => i("update:model-value", {
421
+ ...f.modelValue,
422
+ ignoreYear: m == !0
423
+ }))
424
+ }, null, 8, ["model-value"])
425
+ ]);
426
+ };
427
+ }
428
+ }), Ie = { class: "space-y-8" }, Me = { class: "text-fm-color-primary rounded-md border-dashed border-2 p-8" }, Be = {
429
+ key: 0,
430
+ class: "flex items-center gap-8"
431
+ }, qe = { class: "flex gap-4" }, $e = {
432
+ key: 0,
433
+ class: "grid grid-cols-7 overflow-hidden rounded-md border-1"
434
+ }, Ne = ["onClick"], Ae = {
435
+ key: 1,
436
+ class: "flex items-center gap-8"
437
+ }, _e = { class: "flex gap-4 xs:gap-[2px]" }, Pe = { class: "grid grid-cols-6 gap-8" }, Le = {
438
+ key: 0,
439
+ class: "grid grid-cols-7 overflow-hidden rounded-md border-1"
440
+ }, He = ["onClick"], je = {
441
+ key: 1,
442
+ class: "grid grid-cols-2 items-center gap-8"
443
+ }, We = { class: "flex gap-4" }, Ge = {
444
+ key: 4,
445
+ class: "flex items-center justify-end gap-8"
446
+ }, X = /* @__PURE__ */ N({
447
+ __name: "RruleInput",
448
+ props: {
449
+ modelValue: {
450
+ type: String
451
+ },
452
+ startDate: {
453
+ type: Object
454
+ },
455
+ applyButton: {
456
+ type: Boolean
457
+ },
458
+ fixedFrequency: {
459
+ type: Boolean
460
+ }
461
+ },
462
+ emits: ["update:model-value", "cancel"],
463
+ setup(a, { emit: R }) {
464
+ const f = a, i = R, l = P(
465
+ f.modelValue ? O.fromString(f.modelValue) : new O({
466
+ dtstart: f.startDate,
467
+ freq: O.DAILY,
468
+ wkst: O.SU,
469
+ interval: 1,
470
+ byhour: 0,
471
+ byminute: 0,
472
+ bysecond: 0
473
+ })
474
+ );
475
+ function b(t) {
476
+ var s;
477
+ "freq" in t && (l.value = new O({
478
+ dtstart: f.startDate,
479
+ freq: t.freq,
480
+ interval: 1,
481
+ byhour: 0,
482
+ byminute: 0,
483
+ bysecond: 0,
484
+ wkst: O.SU
485
+ })), t.interval && t.interval > 0 && (l.value = new O({
486
+ ...l.value.origOptions,
487
+ dtstart: f.startDate,
488
+ interval: t.interval
489
+ })), "byweekday" in t && t.byweekday && Array.isArray(t.byweekday) && t.byweekday.length > 0 && (l.value.options.bymonthday.length > 0 && l.value.options.freq == O.MONTHLY && (l.value.options.bymonthday = []), l.value = new O({
490
+ ...l.value.origOptions,
491
+ dtstart: f.startDate,
492
+ bymonthday: [],
493
+ byweekday: t.byweekday
494
+ })), "bysetpos" in t && t.bysetpos != null && (l.value = new O({
495
+ ...l.value.origOptions,
496
+ dtstart: f.startDate,
497
+ bymonthday: [],
498
+ bysetpos: t.bysetpos,
499
+ byweekday: ((s = l.value.options.byweekday) == null ? void 0 : s.length) > 0 ? l.value.options.byweekday : [6]
500
+ })), "bymonthday" in t && t.bymonthday && Array.isArray(t.bymonthday) && t.bymonthday.length > 0 && (l.value = new O({
501
+ ...l.value.origOptions,
502
+ dtstart: f.startDate,
503
+ bysetpos: [],
504
+ byweekday: [],
505
+ bymonthday: t.bymonthday
506
+ })), "bymonth" in t && t.bymonth && Array.isArray(t.bymonth) && t.bymonth.length > 0 && (l.value = new O({
507
+ ...l.value.origOptions,
508
+ dtstart: f.startDate,
509
+ bysetpos: [],
510
+ bymonth: t.bymonth
511
+ })), "bynweekday" in t && t.bynweekday && (l.value = new O({
512
+ ...l.value.origOptions,
513
+ dtstart: f.startDate,
514
+ bysetpos: [],
515
+ byweekday: new Ve(
516
+ t.bynweekday[0][0],
517
+ t.bynweekday[0][1]
518
+ )
519
+ })), f.applyButton || i("update:model-value", l.value.toString());
520
+ }
521
+ return K(() => {
522
+ f.modelValue || i(
523
+ "update:model-value",
524
+ new O({
525
+ dtstart: f.startDate,
526
+ freq: O.DAILY,
527
+ wkst: O.SU,
528
+ interval: 1,
529
+ byhour: 0,
530
+ byminute: 0,
531
+ bysecond: 0
532
+ }).toString()
533
+ );
534
+ }), (t, s) => {
535
+ var V, S, m;
536
+ const u = g("FmStepperField"), p = g("FmChip"), y = g("FmButtonGroup"), k = g("FmButton");
537
+ return n(), F("div", Ie, [
538
+ U("div", Me, j(e(ke)(e(l).options)), 1),
539
+ a.fixedFrequency ? _("", !0) : (n(), F("div", Be, [
540
+ s[8] || (s[8] = U("div", null, "Repeat every", -1)),
541
+ v(u, {
542
+ class: "w-[100px]",
543
+ "model-value": e(l).options.interval,
544
+ "onUpdate:modelValue": s[0] || (s[0] = (o) => b({ interval: o > 0 ? o : e(l).options.interval })),
545
+ min: 1
546
+ }, null, 8, ["model-value"]),
547
+ v(I, {
548
+ class: "w-min",
549
+ items: e(H).frequencies,
550
+ "model-value": e(l).origOptions.freq,
551
+ "onUpdate:modelValue": s[1] || (s[1] = (o) => b({ freq: o }))
552
+ }, null, 8, ["items", "model-value"])
553
+ ])),
554
+ e(l).options.freq === e(O).WEEKLY ? (n(), F(Y, { key: 1 }, [
555
+ s[9] || (s[9] = U("div", null, "Repeat on", -1)),
556
+ U("div", qe, [
557
+ (n(!0), F(Y, null, A(e(H).weekdays, (o) => {
558
+ var d;
559
+ return n(), T(p, {
560
+ class: L(["cursor-pointer", `${(d = e(l).options.byweekday) != null && d.includes(o.value) ? "bg-fm-color-primary text-white" : "bg-fm-color-neutral-gray-200 text-black"}`]),
561
+ label: o.label[0],
562
+ key: o.value,
563
+ compact: !0,
564
+ onClick: () => {
565
+ var c, x;
566
+ b({
567
+ byweekday: (c = e(l).options.byweekday) != null && c.includes(o.value) ? ((x = e(l).options.byweekday) == null ? void 0 : x.filter((E) => E !== o.value)) || [] : [...e(l).options.byweekday || [], o.value]
568
+ });
569
+ }
570
+ }, null, 8, ["class", "label", "onClick"]);
571
+ }), 128))
572
+ ])
573
+ ], 64)) : _("", !0),
574
+ e(l).options.freq == e(O).MONTHLY ? (n(), F(Y, { key: 2 }, [
575
+ v(y, {
576
+ "model-value": e(l).options.bymonthday.length ? { label: "Each" } : { label: "On the" },
577
+ items: [
578
+ {
579
+ label: "Each"
580
+ },
581
+ {
582
+ label: "On the"
583
+ }
584
+ ],
585
+ "onUpdate:modelValue": s[2] || (s[2] = (o) => {
586
+ o.label == "Each" ? b({ bymonthday: [1] }) : b({ bysetpos: 1 });
587
+ })
588
+ }, null, 8, ["model-value"]),
589
+ e(l).options.bymonthday.length > 0 ? (n(), F("div", $e, [
590
+ (n(!0), F(Y, null, A(e(H).dates, (o) => (n(), F("div", {
591
+ key: o.value,
592
+ class: L(["cursor-pointer text-center outline-1 outline-fm-color-neutral-gray-100 outline", `${e(l).options.bymonthday.includes(o.value) ? "bg-fm-color-primary text-fm-color-typo-white outline-transparent" : "bg-transparent text-fm-color-typo-primary"} ${o.value == 31 ? "border-r" : ""}`]),
593
+ onClick: (d) => b({
594
+ bymonthday: e(l).options.bymonthday.includes(o.value) ? e(l).options.bymonthday.filter((c) => c !== o.value) : [...e(l).options.bymonthday, o.value]
595
+ })
596
+ }, j(o.value), 11, Ne))), 128))
597
+ ])) : (n(), F("div", Ae, [
598
+ v(I, {
599
+ items: e(H).ordinals,
600
+ "model-value": (V = e(l).options.bysetpos) == null ? void 0 : V[0],
601
+ "onUpdate:modelValue": s[3] || (s[3] = (o) => b({ bysetpos: o }))
602
+ }, null, 8, ["items", "model-value"]),
603
+ U("div", _e, [
604
+ (n(!0), F(Y, null, A(e(H).weekdays, (o) => {
605
+ var d;
606
+ return n(), T(p, {
607
+ class: L(["cursor-pointer", `${(d = e(l).options.byweekday) != null && d.includes(o.value) ? "bg-fm-color-primary text-white" : "bg-fm-color-neutral-gray-200 text-black"}`]),
608
+ label: o.label[0],
609
+ key: o.value,
610
+ compact: !0,
611
+ onClick: () => {
612
+ b({
613
+ byweekday: [o.value]
614
+ });
615
+ }
616
+ }, null, 8, ["class", "label", "onClick"]);
617
+ }), 128))
618
+ ])
619
+ ]))
620
+ ], 64)) : _("", !0),
621
+ e(l).options.freq == e(O).YEARLY ? (n(), F(Y, { key: 3 }, [
622
+ s[10] || (s[10] = U("div", null, "Month", -1)),
623
+ U("div", Pe, [
624
+ (n(!0), F(Y, null, A(e(H).months, (o) => {
625
+ var d, c;
626
+ return n(), T(p, {
627
+ key: o.value,
628
+ class: L(["cursor-pointer", {
629
+ "bg-fm-color-primary text-white": (d = e(l).options.bymonth) == null ? void 0 : d.includes(
630
+ o.value
631
+ ),
632
+ "bg-fm-color-gray-200 text-fm-color-gray-800": !((c = e(l).options.bymonth) != null && c.includes(o.value))
633
+ }]),
634
+ label: o.shortName,
635
+ compact: !0,
636
+ onClick: (x) => b({
637
+ bymonth: (e(l).options.bymonth ?? []).includes(o.value) ? (e(l).options.bymonth ?? []).filter((E) => E !== o.value) : [...e(l).options.bymonth ?? [], o.value]
638
+ })
639
+ }, null, 8, ["class", "label", "onClick"]);
640
+ }), 128))
641
+ ]),
642
+ v(y, {
643
+ "model-value": e(l).options.bymonthday.length ? { label: "Each" } : { label: "On the" },
644
+ items: [
645
+ {
646
+ label: "Each"
647
+ },
648
+ {
649
+ label: "On the"
650
+ }
651
+ ],
652
+ "onUpdate:modelValue": s[4] || (s[4] = (o) => {
653
+ o.label == "Each" ? b({
654
+ bymonthday: [1],
655
+ bymonth: e(l).options.bymonth ?? [1]
656
+ }) : b({
657
+ byweekday: [e(O).SU.nth(1)],
658
+ bymonth: e(l).options.bymonth ?? [1]
659
+ });
660
+ })
661
+ }, null, 8, ["model-value"]),
662
+ e(l).options.bymonthday.length > 0 ? (n(), F("div", Le, [
663
+ (n(!0), F(Y, null, A(Array(31).fill(null).map((o, d) => d + 1), (o) => (n(), F("div", {
664
+ key: o,
665
+ class: L(["cursor-pointer text-center outline-1 outline-fm-color-neutral-gray-100 outline", `${e(l).options.bymonthday.includes(o) ? "bg-fm-color-primary text-fm-color-typo-white outline-transparent" : "bg-transparent text-fm-color-typo-primary"} ${o == 31 ? "border-r" : ""}`]),
666
+ onClick: (d) => b({
667
+ bymonthday: e(l).options.bymonthday.includes(o) ? e(l).options.bymonthday.filter((c) => c !== o) : [...e(l).options.bymonthday, o]
668
+ })
669
+ }, j(o), 11, He))), 128))
670
+ ])) : (n(), F("div", je, [
671
+ v(I, {
672
+ items: e(H).ordinals,
673
+ "model-value": (m = (S = e(l).options.bynweekday) == null ? void 0 : S[0]) == null ? void 0 : m[1],
674
+ "onUpdate:modelValue": s[5] || (s[5] = (o) => {
675
+ var d, c;
676
+ return b({
677
+ bynweekday: [[((c = (d = e(l).options.bynweekday) == null ? void 0 : d[0]) == null ? void 0 : c[0]) ?? 1, o]]
678
+ });
679
+ })
680
+ }, null, 8, ["items", "model-value"]),
681
+ U("div", We, [
682
+ (n(!0), F(Y, null, A(e(H).weekdays, (o) => {
683
+ var d, c;
684
+ return n(), T(p, {
685
+ class: L(["cursor-pointer", `${((c = (d = e(l).options.bynweekday) == null ? void 0 : d[0]) == null ? void 0 : c[0]) === o.value ? "bg-fm-color-primary text-white" : "bg-fm-color-neutral-gray-200 text-black"}`]),
686
+ label: o.label[0],
687
+ key: o.value,
688
+ compact: !0,
689
+ onClick: () => {
690
+ var x, E;
691
+ b({
692
+ bynweekday: [
693
+ [o.value, ((E = (x = e(l).options.bynweekday) == null ? void 0 : x[0]) == null ? void 0 : E[1]) ?? 1]
694
+ ]
695
+ });
696
+ }
697
+ }, null, 8, ["class", "label", "onClick"]);
698
+ }), 128))
699
+ ])
700
+ ]))
701
+ ], 64)) : _("", !0),
702
+ a.applyButton ? (n(), F("div", Ge, [
703
+ v(k, {
704
+ label: "Cancel",
705
+ variant: "tertiary",
706
+ onClick: s[6] || (s[6] = (o) => i("cancel"))
707
+ }),
708
+ v(k, {
709
+ label: "Apply",
710
+ onClick: s[7] || (s[7] = (o) => i("update:model-value", e(l).toString()))
711
+ })
712
+ ])) : _("", !0)
713
+ ]);
714
+ };
715
+ }
716
+ }), Ke = { class: "grid grid-cols-4 gap-8 w-full flex-wrap py-16" }, Qe = /* @__PURE__ */ N({
717
+ __name: "IsInMonthInput",
718
+ props: {
719
+ modelValue: {
720
+ type: Object,
721
+ required: !0
722
+ }
723
+ },
724
+ emits: ["update:model-value"],
725
+ setup(a, { emit: R }) {
726
+ const f = a, i = R, l = J.months().map((b, t) => ({
727
+ name: b,
728
+ shortName: J().month(t).format("MMM"),
729
+ value: t
730
+ }));
731
+ return K(() => {
732
+ f.modelValue || i("update:model-value", []);
733
+ }), (b, t) => {
734
+ const s = g("FmChip");
735
+ return n(), F("div", Ke, [
736
+ (n(!0), F(Y, null, A(e(l), (u) => {
737
+ var p, y;
738
+ return n(), T(s, {
739
+ class: L(["cursor-pointer", {
740
+ "bg-fm-color-primary text-white": (p = a.modelValue) == null ? void 0 : p.includes(u.value),
741
+ "bg-fm-color-gray-200 text-fm-color-gray-800": !((y = a.modelValue) != null && y.includes(
742
+ u.value
743
+ ))
744
+ }]),
745
+ label: u.name,
746
+ key: u.value,
747
+ compact: !0,
748
+ onClick: (k) => i(
749
+ "update:model-value",
750
+ a.modelValue.includes(u.value) ? a.modelValue.filter((V) => V !== u.value) : [...a.modelValue, u.value]
751
+ )
752
+ }, null, 8, ["class", "label", "onClick"]);
753
+ }), 128))
754
+ ]);
755
+ };
756
+ }
757
+ }), ze = { class: "flex flex-col flex-nowrap" }, Ze = { class: "flex gap-16 items-center w-full" }, Je = { class: "flex grow items-center" }, Xe = { class: "grow text-fm-color-typo-secondary" }, et = { key: 0 }, tt = { class: "px-16" }, lt = /* @__PURE__ */ N({
758
+ __name: "SelectItems",
759
+ props: {
760
+ initialValue: {
761
+ type: Array,
762
+ default: () => []
763
+ },
764
+ filterItems: {
765
+ type: Function,
766
+ default: void 0
767
+ },
768
+ onComplete: {
769
+ type: Function,
770
+ required: !0
771
+ },
772
+ maxHeight: {
773
+ type: [String, Number],
774
+ default: 380
775
+ }
776
+ },
777
+ setup(a, { expose: R }) {
778
+ const f = a, i = Te(), l = M(() => i.menu.value || {
779
+ _id: "",
780
+ modules: {
781
+ catalog: [],
782
+ category: [],
783
+ item: [],
784
+ variant: [],
785
+ group: [],
786
+ takeaway: [],
787
+ scheduler: [],
788
+ printDepartment: [],
789
+ recipe: [],
790
+ sku: [],
791
+ unit: [],
792
+ cookingGuide: [],
793
+ serveSequence: []
794
+ }
795
+ }), b = M(() => {
796
+ const o = f.filterItems ?? ((c) => !!c.category);
797
+ return l.value.modules.item.filter(o).reduce((c, x) => {
798
+ const E = {
799
+ id: x._id,
800
+ category: x.category,
801
+ name: (x.name2 || x.name).trim()
802
+ };
803
+ return c = [...c, E], c;
804
+ }, []);
805
+ }), t = M(() => {
806
+ const o = l.value.modules.category.reduce((d, c) => (d[c._id] = {
807
+ id: c._id,
808
+ name: c.name,
809
+ items: {}
810
+ }, d), {});
811
+ return b.value.reduce(
812
+ (d, c) => {
813
+ const x = c.category ?? "";
814
+ return d[x].items = {
815
+ ...d[x].items,
816
+ [c.id]: c
817
+ }, d;
818
+ },
819
+ {
820
+ ...o,
821
+ "": {
822
+ id: "",
823
+ name: "Addons",
824
+ items: {}
825
+ }
826
+ }
827
+ );
828
+ }), s = M(() => {
829
+ const o = p.value.toLowerCase();
830
+ return o ? Object.entries(t.value).reduce((d, [c, x]) => {
831
+ if (x.name.toLowerCase().includes(o))
832
+ return d[c] = x, d;
833
+ const E = Object.entries(x.items).reduce((r, [q, w]) => (w.name.toLowerCase().includes(o) && (r[q] = w), r), {});
834
+ return Object.keys(E).length > 0 && (d[c] = { ...x, items: E }), d;
835
+ }, {}) : t.value;
836
+ }), u = P({}), p = P(""), y = M(() => Object.values(u.value).filter((o) => !!o).length);
837
+ function k(o) {
838
+ u.value = b.value.reduce((d, c) => (d[c.id] = o.includes(c.id), d), {});
839
+ }
840
+ K(async () => {
841
+ await i.getMenu(), k(f.initialValue);
842
+ });
843
+ function V(o) {
844
+ const d = Object.keys(s.value[o].items), c = d.filter((x) => u.value[x]);
845
+ return c.length ? c.length === d.length ? !0 : null : !1;
846
+ }
847
+ function S(o) {
848
+ const d = Object.keys(s.value[o].items), c = V(o), x = le(u.value);
849
+ for (const E of d)
850
+ x[E] = c !== !0;
851
+ u.value = x;
852
+ }
853
+ function m(o) {
854
+ u.value[o] = !u.value[o];
855
+ }
856
+ return R({
857
+ onConfirm: () => {
858
+ const o = Object.entries(u.value).filter(([, d]) => !!d).map(([d]) => d);
859
+ f.onComplete(o);
860
+ }
861
+ }), (o, d) => {
862
+ const c = g("fm-button"), x = g("FmTextField"), E = g("fm-list-item"), r = g("fm-checkbox"), q = g("fm-list");
863
+ return n(), F("div", ze, [
864
+ v(E, {
865
+ tag: "div",
866
+ clickable: !1
867
+ }, {
868
+ default: B(() => [
869
+ U("div", Ze, [
870
+ U("div", Je, [
871
+ v(c, {
872
+ icon: "sync",
873
+ variant: "tertiary",
874
+ onClick: d[0] || (d[0] = () => k([]))
875
+ }),
876
+ U("span", Xe, j(y.value) + " product(s) selected ", 1)
877
+ ]),
878
+ v(x, {
879
+ modelValue: p.value,
880
+ "onUpdate:modelValue": d[1] || (d[1] = (w) => p.value = w),
881
+ placeholder: "Search",
882
+ "leading-icon": { name: "search", color: "" },
883
+ style: { width: "200px", "min-width": "200px" }
884
+ }, null, 8, ["modelValue"])
885
+ ])
886
+ ]),
887
+ _: 1
888
+ }),
889
+ v(q, {
890
+ class: L(["grow overflow-y-auto", `max-h-${f.maxHeight ? `[${f.maxHeight}px]` : "full"}`])
891
+ }, {
892
+ default: B(() => [
893
+ (n(!0), F(Y, null, A(s.value, (w) => (n(), F(Y, {
894
+ key: w.id
895
+ }, [
896
+ Object.keys(w.items).length > 0 ? (n(), F("div", et, [
897
+ U("div", tt, [
898
+ v(r, {
899
+ "model-value": V(w.id) ?? !1,
900
+ indeterminate: V(w.id) === null,
901
+ label: w.name,
902
+ value: "",
903
+ name: "",
904
+ sublabel: "",
905
+ class: "w-full",
906
+ "onUpdate:modelValue": () => S(w.id)
907
+ }, null, 8, ["model-value", "indeterminate", "label", "onUpdate:modelValue"])
908
+ ]),
909
+ (n(!0), F(Y, null, A(w.items, ($) => (n(), F("div", {
910
+ key: $.id,
911
+ class: "pl-48"
912
+ }, [
913
+ v(r, {
914
+ "model-value": u.value[$.id],
915
+ label: $.name,
916
+ value: $.id,
917
+ name: $.name,
918
+ class: "w-full",
919
+ "onUpdate:modelValue": () => m($.id)
920
+ }, null, 8, ["model-value", "label", "value", "name", "onUpdate:modelValue"])
921
+ ]))), 128))
922
+ ])) : _("", !0)
923
+ ], 64))), 128))
924
+ ]),
925
+ _: 1
926
+ }, 8, ["class"])
927
+ ]);
928
+ };
929
+ }
930
+ }), ot = { class: "" }, at = { class: "flex justify-end gap-8 w-full" }, nt = /* @__PURE__ */ N({
931
+ __name: "MenuDialog",
932
+ props: {
933
+ modelValue: { type: Boolean },
934
+ initialValue: {},
935
+ filterItems: { type: Function }
936
+ },
937
+ emits: ["update:model-value", "confirm"],
938
+ setup(a, { emit: R }) {
939
+ const f = a, i = P(), l = P(!1), b = R;
940
+ function t() {
941
+ var u;
942
+ (u = i.value) == null || u.onConfirm(), b("update:model-value", !1);
943
+ }
944
+ function s() {
945
+ b("update:model-value", !1);
946
+ }
947
+ return ie(
948
+ () => f.modelValue,
949
+ (u) => {
950
+ l.value = u;
951
+ }
952
+ ), K(() => {
953
+ l.value = f.modelValue;
954
+ }), (u, p) => {
955
+ const y = g("FmButton"), k = g("FmDialog");
956
+ return n(), T(k, {
957
+ "content-scrollable": !1,
958
+ contentClass: "pt-0",
959
+ modelValue: l.value,
960
+ "onUpdate:modelValue": p[0] || (p[0] = (V) => l.value = V),
961
+ title: "Select Items",
962
+ "close-button": !1
963
+ }, {
964
+ "dialog-header": B(() => p[1] || (p[1] = [
965
+ U("div", null, "Select Item", -1)
966
+ ])),
967
+ "dialog-footer": B(() => [
968
+ U("div", at, [
969
+ v(y, {
970
+ variant: "tertiary",
971
+ onClick: s,
972
+ label: "Cancel"
973
+ }),
974
+ v(y, {
975
+ variant: "primary",
976
+ onClick: t,
977
+ label: "Confirm"
978
+ })
979
+ ])
980
+ ]),
981
+ default: B(() => [
982
+ U("div", ot, [
983
+ v(lt, {
984
+ ref_key: "selectItemRef",
985
+ ref: i,
986
+ "initial-value": u.initialValue,
987
+ "filter-items": u.filterItems,
988
+ "on-complete": (V) => {
989
+ b("confirm", V), s();
990
+ }
991
+ }, null, 8, ["initial-value", "filter-items", "on-complete"])
992
+ ])
993
+ ]),
994
+ _: 1
995
+ }, 8, ["modelValue"]);
996
+ };
997
+ }
998
+ }), rt = { id: "select-menu" }, ut = /* @__PURE__ */ N({
999
+ __name: "SelectMenu",
1000
+ props: {
1001
+ modelValue: {}
1002
+ },
1003
+ emits: ["update:model-value"],
1004
+ setup(a, { emit: R }) {
1005
+ const f = a, i = P(!1), l = M(() => {
1006
+ var s;
1007
+ return ((s = f.modelValue) == null ? void 0 : s.length) || 0;
1008
+ }), b = R;
1009
+ function t(s) {
1010
+ b("update:model-value", s);
1011
+ }
1012
+ return (s, u) => {
1013
+ const p = g("FmField");
1014
+ return n(), F("div", rt, [
1015
+ v(p, {
1016
+ class: "text-fm-color-typo-tertiary",
1017
+ onClick: u[0] || (u[0] = (y) => i.value = !0)
1018
+ }, {
1019
+ default: B(() => [
1020
+ ee(j(l.value) + " item(s) selected ", 1)
1021
+ ]),
1022
+ _: 1
1023
+ }),
1024
+ v(nt, {
1025
+ modelValue: i.value,
1026
+ "onUpdate:modelValue": [
1027
+ u[1] || (u[1] = (y) => i.value = y),
1028
+ u[2] || (u[2] = (y) => i.value = y)
1029
+ ],
1030
+ "initial-value": s.modelValue,
1031
+ onConfirm: t
1032
+ }, null, 8, ["modelValue", "initial-value"])
1033
+ ]);
1034
+ };
1035
+ }
1036
+ }), st = {
1037
+ key: 17,
1038
+ class: "fm-typo-en-body-lg-600"
1039
+ }, it = /* @__PURE__ */ N({
1040
+ __name: "RuleEquator",
1041
+ props: {
1042
+ type: {
1043
+ type: String,
1044
+ required: !0
1045
+ },
1046
+ operator: {
1047
+ type: String,
1048
+ required: !0
1049
+ },
1050
+ modelValue: {
1051
+ type: Object
1052
+ }
1053
+ },
1054
+ emits: ["update:model-value"],
1055
+ setup(a, { emit: R }) {
1056
+ const f = a, i = R, l = M(() => {
1057
+ const b = ye[f.operator].safeParse(f.modelValue);
1058
+ return b.success ? [] : b.error.errors;
1059
+ });
1060
+ return (b, t) => {
1061
+ var m, o, d, c, x, E;
1062
+ const s = g("FmTextField"), u = g("FmStepperField"), p = g("FmSimpleDatePicker"), y = g("FmSimpleDateRangePicker"), k = g("FmTimeRangePicker"), V = g("FmTimePicker"), S = g("FmHelperText");
1063
+ return n(), F("div", {
1064
+ class: L({ "pb-4": e(l).length })
1065
+ }, [
1066
+ a.type === "text" ? (n(), T(s, {
1067
+ key: 0,
1068
+ "model-value": a.modelValue,
1069
+ "onUpdate:modelValue": t[0] || (t[0] = (r) => i("update:model-value", r))
1070
+ }, null, 8, ["model-value"])) : a.type === "number" ? (n(), T(u, {
1071
+ key: 1,
1072
+ "model-value": a.modelValue,
1073
+ "onUpdate:modelValue": t[1] || (t[1] = (r) => i("update:model-value", r))
1074
+ }, null, 8, ["model-value"])) : a.operator == "_isDay" ? (n(), T(ae(he), {
1075
+ key: 2,
1076
+ "model-value": a.modelValue,
1077
+ "onUpdate:modelValue": t[2] || (t[2] = (r) => i("update:model-value", r))
1078
+ }, null, 8, ["model-value"])) : a.operator == "_isRange" ? (n(), T(ae(De), {
1079
+ key: 3,
1080
+ "model-value": a.modelValue,
1081
+ "onUpdate:modelValue": t[3] || (t[3] = (r) => i("update:model-value", r))
1082
+ }, null, 8, ["model-value"])) : a.operator == "_isOnDate" ? (n(), T(p, {
1083
+ key: 4,
1084
+ "model-value": a.modelValue,
1085
+ "onUpdate:modelValue": t[4] || (t[4] = (r) => i("update:model-value", r))
1086
+ }, null, 8, ["model-value"])) : a.operator == "_isBetween" ? (n(), T(y, {
1087
+ key: 5,
1088
+ "model-value": {
1089
+ startDate: (m = a.modelValue) == null ? void 0 : m.start,
1090
+ endDate: (o = a.modelValue) == null ? void 0 : o.end
1091
+ },
1092
+ "onUpdate:modelValue": t[5] || (t[5] = (r) => {
1093
+ i("update:model-value", {
1094
+ start: r.startDate,
1095
+ end: r.endDate
1096
+ });
1097
+ })
1098
+ }, null, 8, ["model-value"])) : a.operator == "_isInMonth" ? (n(), T(Qe, {
1099
+ key: 6,
1100
+ "model-value": a.modelValue,
1101
+ "onUpdate:modelValue": t[6] || (t[6] = (r) => i("update:model-value", r))
1102
+ }, null, 8, ["model-value"])) : a.operator == "_rrule" ? (n(), T(X, {
1103
+ key: 7,
1104
+ "model-value": a.modelValue,
1105
+ "onUpdate:modelValue": t[7] || (t[7] = (r) => i("update:model-value", r))
1106
+ }, null, 8, ["model-value"])) : a.operator == "_isBetweenTime" ? (n(), T(k, {
1107
+ key: 8,
1108
+ "model-value": [(c = (d = a.modelValue) == null ? void 0 : d[0]) == null ? void 0 : c.start, (E = (x = a.modelValue) == null ? void 0 : x[0]) == null ? void 0 : E.end],
1109
+ "onUpdate:modelValue": t[8] || (t[8] = (r) => i("update:model-value", [
1110
+ {
1111
+ start: r[0],
1112
+ end: r[1]
1113
+ }
1114
+ ]))
1115
+ }, null, 8, ["model-value"])) : a.operator == "_isOnTime" ? (n(), T(V, {
1116
+ key: 9,
1117
+ "model-value": a.modelValue,
1118
+ "onUpdate:modelValue": t[9] || (t[9] = (r) => i("update:model-value", r))
1119
+ }, null, 8, ["model-value"])) : a.type == "tier" ? (n(), T(I, {
1120
+ key: 10,
1121
+ items: (e(z)().sortedTiers ?? []).map((r, q) => ({
1122
+ label: `Tier ${q + 1} - ${r.name}`,
1123
+ value: q + 1
1124
+ })),
1125
+ "model-value": a.modelValue,
1126
+ "onUpdate:modelValue": t[10] || (t[10] = (r) => i("update:model-value", r))
1127
+ }, null, 8, ["items", "model-value"])) : a.type == "boolean" ? (n(), T(I, {
1128
+ key: 11,
1129
+ multiselect: !0,
1130
+ items: [
1131
+ { label: "true", value: !0 },
1132
+ { label: "false", value: !1 }
1133
+ ],
1134
+ "model-value": a.modelValue ?? [],
1135
+ "onUpdate:modelValue": t[11] || (t[11] = (r) => i("update:model-value", r))
1136
+ }, null, 8, ["model-value"])) : a.type == "gender" ? (n(), T(I, {
1137
+ key: 12,
1138
+ multiselect: !0,
1139
+ items: [
1140
+ { label: "Male", value: "MALE" },
1141
+ { label: "Female", value: "FEMALE" }
1142
+ ],
1143
+ "model-value": a.modelValue ?? [],
1144
+ "onUpdate:modelValue": t[12] || (t[12] = (r) => i("update:model-value", r))
1145
+ }, null, 8, ["model-value"])) : a.type == "collectible" ? (n(), T(I, {
1146
+ key: 13,
1147
+ multiselect: !0,
1148
+ items: [],
1149
+ "model-value": a.modelValue ?? [],
1150
+ "onUpdate:modelValue": t[13] || (t[13] = (r) => i("update:model-value", r))
1151
+ }, null, 8, ["model-value"])) : a.type == "segment" ? (n(), T(I, {
1152
+ key: 14,
1153
+ multiselect: !0,
1154
+ items: e(z)().segmentOptions,
1155
+ "model-value": a.modelValue ?? [],
1156
+ "onUpdate:modelValue": t[14] || (t[14] = (r) => i("update:model-value", r)),
1157
+ label: "Select segment(s) to match"
1158
+ }, null, 8, ["items", "model-value"])) : a.type == "title" ? (n(), T(I, {
1159
+ key: 15,
1160
+ multiselect: !0,
1161
+ items: (e(z)().sortedTitles ?? []).map((r) => ({
1162
+ label: r.name,
1163
+ value: r._id
1164
+ })),
1165
+ "model-value": a.modelValue ?? [],
1166
+ "onUpdate:modelValue": t[15] || (t[15] = (r) => i("update:model-value", r))
1167
+ }, null, 8, ["items", "model-value"])) : a.type == "product" ? (n(), T(ut, {
1168
+ key: 16,
1169
+ "model-value": a.modelValue,
1170
+ "onUpdate:modelValue": t[16] || (t[16] = (r) => i("update:model-value", r))
1171
+ }, null, 8, ["model-value"])) : (n(), F("div", st, "Rule Not implemented")),
1172
+ v(S, {
1173
+ class: "items-end",
1174
+ state: e(Z).helperState(e(l), ""),
1175
+ text: e(Z).helperText(e(l), "")
1176
+ }, null, 8, ["state", "text"])
1177
+ ], 2);
1178
+ };
1179
+ }
1180
+ }), mt = { class: "space-y-4" }, dt = { class: "flex items-center gap-8" }, pt = { class: "flex items-center justify-end gap-8 pt-16 w-full" }, yt = /* @__PURE__ */ N({
1181
+ __name: "CustomRuleDialog",
1182
+ props: {
1183
+ triggerType: {
1184
+ type: String,
1185
+ required: !0
1186
+ },
1187
+ includeOnly: {
1188
+ type: String
1189
+ },
1190
+ modelValue: {
1191
+ type: Object,
1192
+ default: () => {
1193
+ }
1194
+ }
1195
+ },
1196
+ setup(a) {
1197
+ const R = te(), f = z(), { emitData: i, emitAction: l } = se(), b = a, t = M(
1198
+ () => ce(b.triggerType, b.includeOnly)
1199
+ ), s = (E) => ne[t.value.find((r) => r.property === E).type], u = M(() => {
1200
+ if (!V.value) return [];
1201
+ const E = t.value.find(
1202
+ (r) => r.property === V.value.property
1203
+ );
1204
+ return E ? ne[E.type].map((r) => ({
1205
+ label: Ee[r].name,
1206
+ value: r
1207
+ })) : [];
1208
+ }), p = ve, y = M(() => {
1209
+ const E = p.safeParse(V.value);
1210
+ return E.success ? [] : E.error.errors;
1211
+ }), k = P(!1), V = P(
1212
+ le(b.modelValue) ?? D.constructEntry(
1213
+ t.value[0].property,
1214
+ s(t.value[0].property)[0],
1215
+ null
1216
+ )
1217
+ ), S = M(() => {
1218
+ var W;
1219
+ const { property: E, negated: r, conditions: q } = V.value, w = Object.keys(q || {})[0], $ = Object.values(q || {})[0];
1220
+ return {
1221
+ property: E,
1222
+ negated: r == !0,
1223
+ type: (W = t.value.find((G) => G.property === E)) == null ? void 0 : W.type,
1224
+ operator: w,
1225
+ equator: $
1226
+ };
1227
+ });
1228
+ function m(E) {
1229
+ V.value = D.constructEntry(
1230
+ E,
1231
+ s(E)[0],
1232
+ null
1233
+ );
1234
+ }
1235
+ function o(E) {
1236
+ V.value = { ...V.value, negated: E == !0 };
1237
+ }
1238
+ function d(E) {
1239
+ V.value = {
1240
+ ...V.value,
1241
+ conditions: { [E]: null }
1242
+ };
1243
+ }
1244
+ function c(E) {
1245
+ V.value.conditions = {
1246
+ [S.value.operator]: E
1247
+ };
1248
+ }
1249
+ function x() {
1250
+ i(V.value), l("primary"), R.close();
1251
+ }
1252
+ return ue(async () => {
1253
+ await f.readMembership();
1254
+ }), (E, r) => {
1255
+ const q = g("FmIcon"), w = g("FmField"), $ = g("FmPill"), W = g("FmMenuItem"), G = g("FmMenu"), Q = g("FmButton");
1256
+ return n(), F("div", mt, [
1257
+ r[5] || (r[5] = U("div", { class: "fm-typo-en-body-lg-400" }, "Property", -1)),
1258
+ v(G, {
1259
+ shift: !0,
1260
+ placement: "top-start",
1261
+ modelValue: e(k),
1262
+ "onUpdate:modelValue": r[0] || (r[0] = (h) => me(k) ? k.value = h : null),
1263
+ onMenuChanged: r[1] || (r[1] = (h) => k.value = h)
1264
+ }, {
1265
+ "menu-button": B(() => [
1266
+ v(w, null, {
1267
+ append: B(() => [
1268
+ v(q, {
1269
+ name: e(k) ? "expand_less" : "expand_more"
1270
+ }, null, 8, ["name"])
1271
+ ]),
1272
+ default: B(() => {
1273
+ var h;
1274
+ return [
1275
+ ee(j((h = e(t).find((C) => C.property == e(V).property)) == null ? void 0 : h.name) + " ", 1)
1276
+ ];
1277
+ }),
1278
+ _: 1
1279
+ })
1280
+ ]),
1281
+ default: B(() => [
1282
+ (n(!0), F(Y, null, A(e(t), (h) => (n(), T(W, {
1283
+ key: h.property,
1284
+ "model-value": e(V).property == h.property,
1285
+ label: h.name,
1286
+ disabled: h.premium && !e(re)().isPremium,
1287
+ onClick: (C) => h.premium && !e(re)().isPremium ? null : m(h.property)
1288
+ }, de({ _: 2 }, [
1289
+ h.premium ? {
1290
+ name: "append",
1291
+ fn: B(() => [
1292
+ v($, { variant: "premium" })
1293
+ ]),
1294
+ key: "0"
1295
+ } : void 0
1296
+ ]), 1032, ["model-value", "label", "disabled", "onClick"]))), 128))
1297
+ ]),
1298
+ _: 1
1299
+ }, 8, ["modelValue"]),
1300
+ r[6] || (r[6] = U("div", { class: "fm-typo-en-body-lg-400" }, "Check to perform", -1)),
1301
+ U("div", dt, [
1302
+ v(I, {
1303
+ class: "w-1/4",
1304
+ items: [
1305
+ { label: "is", value: !1 },
1306
+ { label: "is not", value: !0 }
1307
+ ],
1308
+ "model-value": e(V).negated ?? !1,
1309
+ "onUpdate:modelValue": o
1310
+ }, null, 8, ["model-value"]),
1311
+ v(I, {
1312
+ class: "flex-1",
1313
+ items: e(u),
1314
+ "model-value": e(S).operator,
1315
+ "onUpdate:modelValue": d
1316
+ }, null, 8, ["items", "model-value"])
1317
+ ]),
1318
+ U("div", null, [
1319
+ r[4] || (r[4] = U("div", { class: "fm-typo-en-body-lg-400" }, "Criteria", -1)),
1320
+ e(S).type ? (n(), T(it, {
1321
+ key: 0,
1322
+ type: e(S).type,
1323
+ operator: e(S).operator,
1324
+ "model-value": e(S).equator,
1325
+ "onUpdate:modelValue": c
1326
+ }, null, 8, ["type", "operator", "model-value"])) : _("", !0)
1327
+ ]),
1328
+ U("div", pt, [
1329
+ v(Q, {
1330
+ onClick: r[2] || (r[2] = (h) => e(R).close()),
1331
+ label: "Cancel",
1332
+ variant: "tertiary"
1333
+ }),
1334
+ v(Q, {
1335
+ onClick: r[3] || (r[3] = (h) => x()),
1336
+ disabled: e(y).length > 0,
1337
+ label: "Save"
1338
+ }, null, 8, ["disabled"])
1339
+ ])
1340
+ ]);
1341
+ };
1342
+ }
1343
+ }), ct = { class: "flex flex-col gap-8" }, vt = { class: "grid grid-cols-2 items-center" }, ft = { class: "flex items-center gap-8" }, bt = { class: "pt-16 flex items-center self-end gap-8" }, gt = /* @__PURE__ */ N({
1344
+ __name: "PresetRuleDialog",
1345
+ props: {
1346
+ preset: {
1347
+ type: String,
1348
+ required: !0
1349
+ },
1350
+ modelValue: {
1351
+ type: Object
1352
+ }
1353
+ },
1354
+ setup(a) {
1355
+ const R = te(), { emitData: f, emitAction: i } = se(), l = z(), b = a;
1356
+ function t() {
1357
+ const { operator: S, equator: m } = p.value;
1358
+ switch (b.preset) {
1359
+ case "MIN_SPEND":
1360
+ case "SPECIFIC_DATE":
1361
+ case "SPECIFIC_TIMERANGE":
1362
+ case "WEEKLY":
1363
+ case "MONTHLY":
1364
+ case "BIRTHDAY":
1365
+ case "TIER":
1366
+ return `Applies to ${l.sortedTiers.filter((d, c) => S == "_equal" ? c + 1 == m : S == "_moreThanOrEqual" ? c + 1 >= m : c + 1 <= m).map((d) => d.name).join(", ")}`;
1367
+ }
1368
+ }
1369
+ function s() {
1370
+ var S, m;
1371
+ switch (b.preset) {
1372
+ case "MIN_SPEND":
1373
+ return D.constructEntry("bill.amount", "_moreThanOrEqual", 0);
1374
+ case "SPECIFIC_DATE":
1375
+ return D.constructEntry("trigger.date", "_isOnDate", "");
1376
+ case "SPECIFIC_TIMERANGE":
1377
+ return D.constructEntry("trigger.time", "_isBetweenTime", [
1378
+ { start: "00:00", end: "23:59" }
1379
+ ]);
1380
+ case "WEEKLY":
1381
+ return D.constructEntry(
1382
+ "trigger.date",
1383
+ "_rrule",
1384
+ "RRULE:FREQ=WEEKLY;WKST=SU;BYDAY=SU;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
1385
+ );
1386
+ case "MONTHLY":
1387
+ return D.constructEntry(
1388
+ "trigger.date",
1389
+ "_rrule",
1390
+ "RRULE:FREQ=MONTHLY;WKST=SU;BYMONTHDAY=1;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
1391
+ );
1392
+ case "BIRTHDAY":
1393
+ return D.constructEntry("user.birthday", "_isDay", {
1394
+ op: "after",
1395
+ x: 1,
1396
+ ignoreYear: !0
1397
+ });
1398
+ case "TIER":
1399
+ return D.constructEntry("user.tier", "_equal", 1);
1400
+ case "TITLE":
1401
+ return D.constructEntry("user.titles", "_hasAny", [
1402
+ (m = (S = l.sortedTitles) == null ? void 0 : S[0]) == null ? void 0 : m._id
1403
+ ]);
1404
+ case "CUSTOM":
1405
+ throw new Error("Not implemented");
1406
+ }
1407
+ }
1408
+ const u = P(s()), p = M(() => {
1409
+ const S = D.simplify(u.value);
1410
+ return {
1411
+ ...S,
1412
+ equator: S.equator
1413
+ };
1414
+ });
1415
+ function y(S, m) {
1416
+ const o = p.value;
1417
+ u.value = D.constructEntry(
1418
+ o.property,
1419
+ m ?? o.operator,
1420
+ S,
1421
+ u.value.name
1422
+ );
1423
+ }
1424
+ function k() {
1425
+ f(u.value), i("primary"), R.close();
1426
+ }
1427
+ const V = M(() => {
1428
+ const S = fe.safeParse(u.value);
1429
+ return S.success ? [] : S.error.errors;
1430
+ });
1431
+ return ue(async () => {
1432
+ await l.readMembership();
1433
+ }), (S, m) => {
1434
+ var $, W, G, Q, h;
1435
+ const o = g("FmStepperField"), d = g("FmDatePicker"), c = g("FmTimeRangePicker"), x = g("FmRadio"), E = g("FmSelect"), r = g("FmRadioGroup"), q = g("FmHelperText"), w = g("FmButton");
1436
+ return n(), F("div", ct, [
1437
+ a.preset == "MIN_SPEND" ? (n(), T(o, {
1438
+ key: 0,
1439
+ label: "Minimum spend",
1440
+ "model-value": e(p).equator,
1441
+ "onUpdate:modelValue": m[0] || (m[0] = (C) => y(C))
1442
+ }, null, 8, ["model-value"])) : a.preset == "SPECIFIC_DATE" ? (n(), T(d, {
1443
+ key: 1,
1444
+ label: "Specific Date",
1445
+ "model-value": e(p).equator,
1446
+ "onUpdate:modelValue": m[1] || (m[1] = (C) => y(C))
1447
+ }, null, 8, ["model-value"])) : a.preset == "SPECIFIC_TIMERANGE" ? (n(), T(c, {
1448
+ key: 2,
1449
+ label: "Time is between",
1450
+ "model-value": [(W = ($ = e(p).equator) == null ? void 0 : $[0]) == null ? void 0 : W.start, (Q = (G = e(p).equator) == null ? void 0 : G[0]) == null ? void 0 : Q.end],
1451
+ "onUpdate:modelValue": m[2] || (m[2] = (C) => y([
1452
+ {
1453
+ start: C[0],
1454
+ end: C[1]
1455
+ }
1456
+ ]))
1457
+ }, null, 8, ["model-value"])) : a.preset == "WEEKLY" ? (n(), T(X, {
1458
+ key: 3,
1459
+ label: "Weekly",
1460
+ "fixed-frequency": !0,
1461
+ "model-value": e(p).equator,
1462
+ "onUpdate:modelValue": m[3] || (m[3] = (C) => y(C))
1463
+ }, null, 8, ["model-value"])) : a.preset == "MONTHLY" ? (n(), T(X, {
1464
+ key: 4,
1465
+ label: "Weekly",
1466
+ "fixed-frequency": !0,
1467
+ "model-value": e(p).equator,
1468
+ "onUpdate:modelValue": m[4] || (m[4] = (C) => y(C))
1469
+ }, null, 8, ["model-value"])) : a.preset == "BIRTHDAY" ? (n(), F(Y, { key: 5 }, [
1470
+ U("div", vt, [
1471
+ v(x, {
1472
+ label: "N days before birthday",
1473
+ value: "_isDay",
1474
+ "model-value": e(p).operator,
1475
+ "onUpdate:modelValue": m[5] || (m[5] = () => {
1476
+ y(
1477
+ {
1478
+ op: "after",
1479
+ x: 1,
1480
+ ignoreYear: !0
1481
+ },
1482
+ "_isDay"
1483
+ );
1484
+ })
1485
+ }, null, 8, ["model-value"]),
1486
+ U("div", ft, [
1487
+ v(x, {
1488
+ label: "Is in this",
1489
+ value: "_isRange",
1490
+ "model-value": e(p).operator,
1491
+ "onUpdate:modelValue": m[6] || (m[6] = () => {
1492
+ y(
1493
+ {
1494
+ op: "this",
1495
+ unit: "day",
1496
+ ignoreYear: !0
1497
+ },
1498
+ "_isRange"
1499
+ );
1500
+ })
1501
+ }, null, 8, ["model-value"]),
1502
+ e(p).operator == "_isRange" ? (n(), T(E, {
1503
+ key: 0,
1504
+ items: ["day", "week", "month"].map((C) => ({ label: C, value: C })),
1505
+ "model-value": e(p).equator.unit,
1506
+ "onUpdate:modelValue": m[7] || (m[7] = (C) => y(
1507
+ {
1508
+ op: "this",
1509
+ unit: C,
1510
+ ignoreYear: !0
1511
+ },
1512
+ "_isRange"
1513
+ ))
1514
+ }, null, 8, ["items", "model-value"])) : _("", !0)
1515
+ ])
1516
+ ]),
1517
+ e(p).operator == "_isDay" ? (n(), T(o, {
1518
+ key: 0,
1519
+ label: "Days before birthday",
1520
+ "show-steppers": !1,
1521
+ "model-value": e(p).equator.x,
1522
+ "onUpdate:modelValue": m[8] || (m[8] = (C) => y({
1523
+ op: "after",
1524
+ x: C,
1525
+ ignoreYear: !0
1526
+ }))
1527
+ }, null, 8, ["model-value"])) : _("", !0)
1528
+ ], 64)) : a.preset == "TIER" ? (n(), F(Y, { key: 6 }, [
1529
+ v(r, {
1530
+ inline: !0,
1531
+ "model-value": e(p).operator,
1532
+ "onUpdate:modelValue": m[9] || (m[9] = (C) => y(e(p).equator, C))
1533
+ }, {
1534
+ default: B(() => [
1535
+ v(x, {
1536
+ value: "_moreThanOrEqual",
1537
+ label: "At least"
1538
+ }),
1539
+ v(x, {
1540
+ value: "_equal",
1541
+ label: "Equal"
1542
+ }),
1543
+ v(x, {
1544
+ value: "_lessThanOrEqual",
1545
+ label: "At most"
1546
+ })
1547
+ ]),
1548
+ _: 1
1549
+ }, 8, ["model-value"]),
1550
+ v(I, {
1551
+ items: (e(l).sortedTiers ?? []).map((C, oe) => ({
1552
+ label: `Tier ${oe + 1} - ${C.name}`,
1553
+ value: oe + 1
1554
+ })),
1555
+ "model-value": e(p).equator,
1556
+ "onUpdate:modelValue": m[10] || (m[10] = (C) => y(C))
1557
+ }, null, 8, ["items", "model-value"]),
1558
+ v(q, {
1559
+ text: t()
1560
+ }, null, 8, ["text"])
1561
+ ], 64)) : a.preset == "TITLE" ? (n(), T(I, {
1562
+ key: 7,
1563
+ label: "User has title",
1564
+ items: (e(l).sortedTitles ?? []).map((C) => ({
1565
+ label: C.name,
1566
+ value: C._id
1567
+ })),
1568
+ "model-value": (h = e(p).equator) == null ? void 0 : h[0],
1569
+ "onUpdate:modelValue": m[11] || (m[11] = (C) => y([C]))
1570
+ }, null, 8, ["items", "model-value"])) : _("", !0),
1571
+ v(q, {
1572
+ class: "mt-[-8px]",
1573
+ text: e(Z).helperText(e(V), ""),
1574
+ state: e(Z).helperState(e(V), "")
1575
+ }, null, 8, ["text", "state"]),
1576
+ U("div", bt, [
1577
+ v(w, {
1578
+ onClick: m[12] || (m[12] = (C) => e(R).close()),
1579
+ label: "Cancel",
1580
+ variant: "tertiary"
1581
+ }),
1582
+ v(w, {
1583
+ onClick: m[13] || (m[13] = (C) => k()),
1584
+ disabled: e(V).length > 0,
1585
+ label: "Save"
1586
+ }, null, 8, ["disabled"])
1587
+ ])
1588
+ ]);
1589
+ };
1590
+ }
1591
+ }), kt = /* @__PURE__ */ N({
1592
+ __name: "RuleConfigurator",
1593
+ props: {
1594
+ triggerType: {
1595
+ type: String,
1596
+ required: !0
1597
+ },
1598
+ includeOnly: {
1599
+ type: String
1600
+ },
1601
+ modelValue: {
1602
+ type: Object,
1603
+ default: () => {
1604
+ }
1605
+ }
1606
+ },
1607
+ emits: ["update:model-value"],
1608
+ setup(a, { expose: R, emit: f }) {
1609
+ const i = a, l = f, b = te(), t = P();
1610
+ function s(y) {
1611
+ b.open({
1612
+ title: y.name,
1613
+ closeButton: !1,
1614
+ dismissAway: !1,
1615
+ contentComponent: gt,
1616
+ contentComponentProps: {
1617
+ preset: y.type,
1618
+ modelValue: i.modelValue
1619
+ }
1620
+ }).onPrimary((k) => l("update:model-value", k));
1621
+ }
1622
+ function u(y) {
1623
+ b.open({
1624
+ title: "Edit rule",
1625
+ closeButton: !1,
1626
+ dismissAway: !1,
1627
+ contentComponent: yt,
1628
+ contentComponentProps: {
1629
+ triggerType: i.triggerType,
1630
+ includeOnly: i.includeOnly,
1631
+ modelValue: y
1632
+ }
1633
+ }).onPrimary((k) => l("update:model-value", k));
1634
+ }
1635
+ function p(y) {
1636
+ if (y.type == "CUSTOM") {
1637
+ const [k] = y.rules;
1638
+ return u(
1639
+ D.constructEntry(k.property, k.operator, k.equator)
1640
+ );
1641
+ }
1642
+ return s(y);
1643
+ }
1644
+ return R({
1645
+ showCustomDialog: u
1646
+ }), (y, k) => {
1647
+ const V = g("FmButton"), S = g("FmMenuItem"), m = g("FmMenu");
1648
+ return n(), T(m, {
1649
+ shift: !0,
1650
+ placement: "top-start"
1651
+ }, {
1652
+ "menu-button": B(() => [
1653
+ v(V, {
1654
+ label: "Add condition",
1655
+ icon: "add",
1656
+ class: "text-fm-color-primary border-fm-color-primary",
1657
+ "icon-color": "primary",
1658
+ variant: "secondary"
1659
+ })
1660
+ ]),
1661
+ default: B(() => [
1662
+ (n(!0), F(Y, null, A(e(Oe).filter(
1663
+ (o) => !a.includeOnly || o.for.includes(a.includeOnly)
1664
+ ), (o) => (n(), T(S, {
1665
+ key: o.name,
1666
+ "model-value": o.name == e(t),
1667
+ label: o.name,
1668
+ onClick: (d) => p(o)
1669
+ }, null, 8, ["model-value", "label", "onClick"]))), 128))
1670
+ ]),
1671
+ _: 1
1672
+ });
1673
+ };
1674
+ }
1675
+ }), Nt = /* @__PURE__ */ N({
1676
+ __name: "RuleGroup",
1677
+ props: {
1678
+ triggerType: {
1679
+ type: String,
1680
+ required: !0
1681
+ },
1682
+ includeOnly: {
1683
+ type: String
1684
+ },
1685
+ modelValue: {
1686
+ type: Object
1687
+ }
1688
+ },
1689
+ emits: ["update:model-value"],
1690
+ setup(a, { emit: R }) {
1691
+ const f = a, i = R, l = M(
1692
+ () => f.modelValue ?? D.scaffoldGroup()
1693
+ ), b = M(() => D.getLogic(l.value)), t = P();
1694
+ return (s, u) => {
1695
+ const p = g("FmButtonGroup"), y = g("FmCard");
1696
+ return n(), T(y, { variant: "outlined" }, {
1697
+ default: B(() => [
1698
+ v(y, { class: "border-l-4 border-fm-color-primary p-16 space-y-16" }, {
1699
+ default: B(() => [
1700
+ u[3] || (u[3] = U("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " When ", -1)),
1701
+ v(kt, {
1702
+ ref_key: "configuratorRef",
1703
+ ref: t,
1704
+ "include-only": a.includeOnly,
1705
+ "trigger-type": a.triggerType,
1706
+ "onUpdate:modelValue": u[0] || (u[0] = (k) => i("update:model-value", e(D).setRuleToGroup(e(l), k)))
1707
+ }, null, 8, ["include-only", "trigger-type"]),
1708
+ (n(!0), F(Y, null, A(e(l).rules, (k, V) => {
1709
+ var S;
1710
+ return n(), F(Y, null, [
1711
+ e(be)(k) ? (n(), T(Re, {
1712
+ "model-value": k,
1713
+ key: V,
1714
+ onEdit: (S = e(t)) == null ? void 0 : S.showCustomDialog,
1715
+ onRemove: u[1] || (u[1] = (m) => {
1716
+ i(
1717
+ "update:model-value",
1718
+ e(D).removeEntry(e(l), m.name)
1719
+ );
1720
+ })
1721
+ }, null, 8, ["model-value", "onEdit"])) : _("", !0),
1722
+ v(p, {
1723
+ class: "w-[200px]",
1724
+ disabled: Object.keys(e(l).rules).length < 2,
1725
+ items: [{ label: "And" }, { label: "Or" }],
1726
+ "model-value": e(b) === "&&" ? { label: "And" } : { label: "Or" },
1727
+ "onUpdate:modelValue": u[2] || (u[2] = (m) => i(
1728
+ "update:model-value",
1729
+ e(D).setRuleToGroup(
1730
+ e(l),
1731
+ [],
1732
+ m.label === "And" ? "&&" : "||"
1733
+ )
1734
+ ))
1735
+ }, null, 8, ["disabled", "model-value"])
1736
+ ], 64);
1737
+ }), 256))
1738
+ ]),
1739
+ _: 1
1740
+ })
1741
+ ]),
1742
+ _: 1
1743
+ });
1744
+ };
1745
+ }
1746
+ });
1747
+ export {
1748
+ Nt as _,
1749
+ X as a,
1750
+ lt as b
1751
+ };