@feedmepos/mf-connect 0.1.9-prod → 0.1.10-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 (90) hide show
  1. package/dist/{Analytic-8Ew7y5t9.js → Analytic-CpSbitWV.js} +24 -23
  2. package/dist/{App-3BVNH3r-.js → App-BPT8XzjX.js} +56 -51
  3. package/dist/{Broadcast-CrsPUhLT.js → Broadcast-CJHpiQeN.js} +8 -8
  4. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DE300Y56.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DUPqWdIm.js} +7 -7
  5. package/dist/Card-Bvn36zqZ.js +895 -0
  6. package/dist/{Collections-djS9hLI8.js → Collections-Bq6OxsJC.js} +24 -29
  7. package/dist/{Credit-D4KEvIov.js → Credit-Dno_g7dW.js} +8 -8
  8. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-BjM81fmS.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-cGbwORhw.js} +648 -1284
  9. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-aEWfdpCg.js → EffectSheet.vue_vue_type_style_index_0_lang-Ho7zwlbb.js} +19 -19
  10. package/dist/{Experience-2FPLO7aV.js → Experience-BC1qSIGO.js} +8 -8
  11. package/dist/{Game-e_UjVJgU.js → Game-C_CKGMBW.js} +8 -8
  12. package/dist/Index-BXFaWTfw.js +255 -0
  13. package/dist/{Marketing-B2hCjZ2r.js → Marketing-Ni0WAie5.js} +5 -5
  14. package/dist/{Member-D_ykRIBb.js → Member-djnisrK1.js} +4 -4
  15. package/dist/{MemberList-LmzzYxEn.js → MemberList-CclU-3B7.js} +193 -189
  16. package/dist/{MemberTransactions-B2vqlKaP.js → MemberTransactions-DVVsv3Ux.js} +1 -1
  17. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-DQ2ubF0N.js → MessageInput.vue_vue_type_script_setup_true_lang-khyDg1m4.js} +2 -2
  18. package/dist/Mission-Z5somdo_.js +273 -0
  19. package/dist/Overview-BvMVz3lQ.js +1074 -0
  20. package/dist/{Point-DFriwWWY.js → Point-DdPukiTg.js} +8 -8
  21. package/dist/{Promotion-Db3IEs2F.js → Promotion-DCqdIwjG.js} +9 -9
  22. package/dist/Record-CvMxXm1B.js +337 -0
  23. package/dist/Reward-CiJHGXfQ.js +441 -0
  24. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-CrGCBRmH.js +150 -0
  25. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-tnT6i0Jq.js +1638 -0
  26. package/dist/{Segment-CE8q9JV2.js → Segment-CQb3j-o0.js} +13 -13
  27. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-B7YqIU5D.js +181 -0
  28. package/dist/{Setting-Vcz1S27V.js → Setting-91cK3ssU.js} +31 -31
  29. package/dist/Store-B-uldUKt.js +1744 -0
  30. package/dist/{StoreRewards-Dt30AkWo.js → StoreRewards-dDNeFlA9.js} +12 -12
  31. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-BVb1X0aq.js +1132 -0
  32. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-f59onlgt.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-Ds0WxGxr.js} +1 -1
  33. package/dist/{Tier-a6yXEtLd.js → Tier-_jMaLj3u.js} +19 -19
  34. package/dist/{Title-A3-2EI0w.js → Title-By7o67aT.js} +19 -19
  35. package/dist/{Transaction-DswABr2P.js → Transaction-BLpEgeI2.js} +2 -2
  36. package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-Bf_nO9zH.js +130 -0
  37. package/dist/{Voucher-DEoVgZYa.js → Voucher-CG5tfibn.js} +11 -11
  38. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-DpQUoXyQ.js +419 -0
  39. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-ccc1vxjS.js → ZodTextField.vue_vue_type_script_setup_true_lang-YwGR2En3.js} +1 -1
  40. package/dist/{app-C23GfQGq.js → app-DDmTqTb7.js} +1 -1
  41. package/dist/{app-C66C2KLW.js → app-vCqTQIeC.js} +424 -273
  42. package/dist/app.js +1 -1
  43. package/dist/{business-DNAVZOSH.js → business-Cz78KGF2.js} +1 -1
  44. package/dist/{campaign-Cv0HaUD1.js → campaign-BBd4o7F_.js} +2 -2
  45. package/dist/campaign.enum-CIhi0b-m.js +20 -0
  46. package/dist/campaign.fn-5silF1DK.js +758 -0
  47. package/dist/collectible.enum-cMIQ6ogq.js +19 -0
  48. package/dist/{collection.fn-Dxzr2oPt.js → collection.fn-BGc7Qeli.js} +2 -2
  49. package/dist/dto-i04OPJfW.js +2018 -0
  50. package/dist/{effect-CUuL8Tci.js → effect-D8UzkYRg.js} +1 -1
  51. package/dist/{email-addresses-Yt3s7i2b.js → email-addresses-u05o35hN.js} +1 -1
  52. package/dist/{export-CNg5YWMm.js → export-BEXuPYEd.js} +3 -3
  53. package/dist/{helper-DzmKNFue.js → helper-RptRJGv6.js} +1 -1
  54. package/dist/{index-Dnf7j71V.js → index-B8s-gucK.js} +9 -3
  55. package/dist/{index-B88e_9YI.js → index-BjHZUhiH.js} +1 -1
  56. package/dist/{index-O9lB54LY.js → index-Bpu2DYUc.js} +1348 -1342
  57. package/dist/{index-BK8X9RF6.js → index-C6-rCMhD.js} +3 -3
  58. package/dist/{index-D0obMrAS.js → index-Cq_ZIbRm.js} +173 -62
  59. package/dist/{index-CsCgQ8gt.js → index-DFAnoAe9.js} +1 -1
  60. package/dist/index-DbyJ6Nyn.js +54 -0
  61. package/dist/{index-yzH5eyKW.js → index-Dt6K2eG8.js} +1 -1
  62. package/dist/{index-9CXt2kbQ.js → index-DwzoqCt8.js} +293 -287
  63. package/dist/index-UfL5qRzR.js +1049 -0
  64. package/dist/index-g8EbRVnr.js +32 -0
  65. package/dist/{index-QuBsnXgx.js → index-hEE_ntHd.js} +1 -1
  66. package/dist/index-vh86FiIQ.js +10 -0
  67. package/dist/{index.esm2017-TpBElhnN.js → index.esm2017-BSzW_yaL.js} +1 -1
  68. package/dist/{loading-ChoC5E9d.js → loading-DjEdwdnj.js} +156 -153
  69. package/dist/{membership-CU-k0-Tf.js → membership-BL9Xs8lD.js} +52 -44
  70. package/dist/{money-DANmyTBj.js → money-D7lq0cx-.js} +1 -1
  71. package/dist/{number-DrocTWDD.js → number-BiDabTkI.js} +1 -1
  72. package/dist/objectid-CXf0jb1W.js +145 -0
  73. package/dist/reward-Cr8rbe5R.js +36 -0
  74. package/dist/{rule-builder-3YRdr18A.js → rule-builder-DPKFZ5UX.js} +1 -1
  75. package/dist/{rule-BQLmpER9.js → rule-vkYJij4h.js} +4 -3
  76. package/dist/{template-DOKU1QkY.js → template-Bep5Y5ch.js} +4 -4
  77. package/dist/trigger-fWhQ3bqv.js +144 -0
  78. package/dist/{usePagination-JGI7x0W7.js → usePagination-DSF5b4hM.js} +1 -1
  79. package/dist/user-9UiaP0xs.js +54 -0
  80. package/dist/{vue-i18n-Bch1JmhI.js → vue-i18n-BhiDOB1j.js} +232 -232
  81. package/package.json +2 -2
  82. package/dist/Card-DndggRLr.js +0 -1036
  83. package/dist/Mission-CsLdMq1M.js +0 -261
  84. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-_P2yImhi.js +0 -1804
  85. package/dist/Store-C8kT7JN5.js +0 -1531
  86. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-Cc2F_06x.js +0 -1065
  87. package/dist/dto-CcrufW2j.js +0 -2770
  88. package/dist/index-C7745kXl.js +0 -755
  89. package/dist/index-CZ28ywyB.js +0 -298
  90. package/dist/user-Bm4KttFq.js +0 -37
@@ -1,1804 +0,0 @@
1
- import { defineComponent as $, computed as _, resolveComponent as g, openBlock as n, createElementBlock as h, createElementVNode as U, createVNode as v, unref as e, createTextVNode as te, toDisplayString as W, withCtx as q, onMounted as K, createBlock as F, createCommentVNode as A, ref as P, Fragment as Y, renderList as N, normalizeClass as L, watch as ie, resolveDynamicComponent as ne, onBeforeMount as ue, isRef as me, createSlots as de } from "vue";
2
- import { c as pe, C as ce, d as ye, e as ve, f as fe } from "./index-O9lB54LY.js";
3
- import { R as I, a as be } from "./rule-builder-3YRdr18A.js";
4
- import { a as ge, R as C, S as ke, C as H, W as Ve, T as re, O as Ee } from "./rule-BQLmpER9.js";
5
- import { p as he } from "./loading-ChoC5E9d.js";
6
- import { useDialog as le, useDialogChild as se } from "@feedmepos/ui-library";
7
- import { h as J } from "./moment-BWErdI6_.js";
8
- import { z as Se } from "./app-C66C2KLW.js";
9
- import { u as z } from "./membership-CU-k0-Tf.js";
10
- import { u as X } from "./business-DNAVZOSH.js";
11
- import { _ as D } from "./CustomSelect.vue_vue_type_script_setup_true_lang-DLnvDVgf.js";
12
- import { c as oe } from "./object-qECH92oz.js";
13
- import { Z } from "./zod-Bg2FbC-D.js";
14
- import { e as Fe } from "./app-C23GfQGq.js";
15
- import "./index-9CXt2kbQ.js";
16
- import "./index-C7745kXl.js";
17
- import "./index-D0obMrAS.js";
18
- import "./index-CZ28ywyB.js";
19
- import "./index-QuBsnXgx.js";
20
- const Te = { class: "flex items-center justify-between" }, xe = { class: "flex items-center gap-8 xs:flex-wrap" }, Ce = /* @__PURE__ */ U("div", { class: "h-[26px] border-l-2 rounded-md border-fm-color-neutral-gray-100" }, null, -1), Ue = { class: "text-fm-color-primary line-clamp-1 text-ellipsis" }, we = /* @__PURE__ */ $({
21
- __name: "RuleEntry",
22
- props: {
23
- modelValue: {
24
- type: Object,
25
- required: !0
26
- }
27
- },
28
- emits: ["edit", "remove"],
29
- setup(a, { emit: w }) {
30
- const p = a, s = _(() => {
31
- const [i, u] = Object.entries(p.modelValue.conditions)[0];
32
- return {
33
- negated: p.modelValue.negated == !0,
34
- property: p.modelValue.property,
35
- operator: i,
36
- equator: u
37
- };
38
- }), l = w, f = _(
39
- () => ge(
40
- s.value.property,
41
- s.value.operator,
42
- s.value.equator,
43
- s.value.negated
44
- )
45
- );
46
- async function t(i) {
47
- i.stopPropagation(), await he.remove("Are you sure you want to remove this rule?") && l("remove", p.modelValue);
48
- }
49
- return (i, u) => {
50
- var V;
51
- const b = g("FmChip"), c = g("FmTooltip"), k = g("FmIcon");
52
- return n(), h("div", Te, [
53
- U("div", xe, [
54
- v(b, {
55
- label: (V = e(pe).find((S) => S.property === p.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
- Ce,
59
- U("div", {
60
- onClick: u[0] || (u[0] = (S) => l("edit", p.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
- te(W(e(f)[0]) + " ", 1),
64
- v(c, {
65
- "z-index": 1e3,
66
- content: e(f)[1]
67
- }, {
68
- default: q(() => [
69
- U("div", Ue, W(e(f)[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
- ], Re = { class: "flex flex-nowrap gap-x-4 items-center" }, Ye = /* @__PURE__ */ $({
281
- __name: "IsDayInput",
282
- props: {
283
- modelValue: {
284
- type: Object
285
- }
286
- },
287
- emits: ["update:model-value"],
288
- setup(a, { emit: w }) {
289
- const p = a, s = w;
290
- K(() => {
291
- p.modelValue || s("update:model-value", {
292
- op: "before",
293
- x: 1
294
- });
295
- });
296
- function l(f) {
297
- const t = oe(
298
- p.modelValue ?? {
299
- op: "before",
300
- x: 1
301
- }
302
- );
303
- s("update:model-value", {
304
- ...t,
305
- ...f
306
- });
307
- }
308
- return (f, t) => {
309
- var u, b, c;
310
- const i = g("FmStepperField");
311
- return n(), h("div", Re, [
312
- v(i, {
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(D, {
321
- "model-value": ((b = a.modelValue) == null ? void 0 : b.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(D, {
329
- "model-value": ((c = a.modelValue) == null ? void 0 : c.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
- }), De = { class: "grid grid-cols-4 gap-x-4 items-center" }, Ie = /* @__PURE__ */ $({
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: w }) {
354
- const p = a, s = w;
355
- K(() => {
356
- p.modelValue || s("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
- ], f = [
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, i) => {
383
- var b, c, k, V, S;
384
- const u = g("FmStepperField");
385
- return n(), h("div", De, [
386
- v(D, {
387
- "model-value": (b = a.modelValue) == null ? void 0 : b.op,
388
- label: "",
389
- items: f,
390
- required: !0,
391
- "onUpdate:modelValue": i[0] || (i[0] = (m) => s("update:model-value", { op: m, unit: "day", ignoreYear: !1 }))
392
- }, null, 8, ["model-value"]),
393
- ((c = a.modelValue) == null ? void 0 : c.op) != "this" ? (n(), F(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": i[1] || (i[1] = (m) => s("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"])) : A("", !0),
405
- v(D, {
406
- "model-value": (V = a.modelValue) == null ? void 0 : V.unit,
407
- label: "",
408
- items: l,
409
- required: !0,
410
- "onUpdate:modelValue": i[2] || (i[2] = (m) => s("update:model-value", { ...p.modelValue, unit: m }))
411
- }, null, 8, ["model-value"]),
412
- v(D, {
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": i[3] || (i[3] = (m) => s("update:model-value", {
421
- ...p.modelValue,
422
- ignoreYear: m == !0
423
- }))
424
- }, null, 8, ["model-value"])
425
- ]);
426
- };
427
- }
428
- }), _e = { class: "space-y-8" }, qe = { class: "text-fm-color-primary rounded-md border-dashed border-2 p-8" }, Me = {
429
- key: 0,
430
- class: "flex items-center gap-8"
431
- }, Be = /* @__PURE__ */ U("div", null, "Repeat every", -1), $e = /* @__PURE__ */ U("div", null, "Repeat on", -1), Ne = { class: "flex gap-4" }, Ae = {
432
- key: 0,
433
- class: "grid grid-cols-7 overflow-hidden rounded-md border-1"
434
- }, Pe = ["onClick"], Le = {
435
- key: 1,
436
- class: "flex items-center gap-8"
437
- }, He = { class: "flex gap-4 xs:gap-[2px]" }, We = /* @__PURE__ */ U("div", null, "Month", -1), je = { class: "grid grid-cols-6 gap-8" }, Ge = {
438
- key: 0,
439
- class: "grid grid-cols-7 overflow-hidden rounded-md border-1"
440
- }, Ke = ["onClick"], Qe = {
441
- key: 1,
442
- class: "grid grid-cols-2 items-center gap-8"
443
- }, ze = { class: "flex gap-4" }, Ze = {
444
- key: 4,
445
- class: "flex items-center justify-end gap-8"
446
- }, ee = /* @__PURE__ */ $({
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: w }) {
464
- const p = a, s = w, l = P(
465
- p.modelValue ? C.fromString(p.modelValue) : new C({
466
- dtstart: p.startDate,
467
- freq: C.DAILY,
468
- wkst: C.SU,
469
- interval: 1,
470
- byhour: 0,
471
- byminute: 0,
472
- bysecond: 0
473
- })
474
- );
475
- function f(t) {
476
- var i;
477
- if ("freq" in t)
478
- switch (t.freq) {
479
- case C.WEEKLY:
480
- l.value = new C({
481
- dtstart: p.startDate,
482
- freq: t.freq,
483
- interval: 1,
484
- byhour: 0,
485
- byminute: 0,
486
- bysecond: 0,
487
- wkst: C.SU,
488
- byweekday: [C.MO]
489
- });
490
- break;
491
- case C.MONTHLY:
492
- l.value = new C({
493
- dtstart: p.startDate,
494
- freq: t.freq,
495
- interval: 1,
496
- byhour: 0,
497
- byminute: 0,
498
- bysecond: 0,
499
- bymonthday: [(/* @__PURE__ */ new Date()).getDate()],
500
- wkst: C.SU
501
- });
502
- break;
503
- case C.YEARLY:
504
- l.value = new C({
505
- dtstart: p.startDate,
506
- freq: t.freq,
507
- interval: 1,
508
- byhour: 0,
509
- byminute: 0,
510
- bysecond: 0,
511
- wkst: C.SU,
512
- bymonth: [(/* @__PURE__ */ new Date()).getMonth() + 1],
513
- bymonthday: [(/* @__PURE__ */ new Date()).getDate()]
514
- });
515
- break;
516
- default:
517
- l.value = new C({
518
- dtstart: p.startDate,
519
- freq: t.freq,
520
- interval: 1,
521
- byhour: 0,
522
- byminute: 0,
523
- bysecond: 0,
524
- wkst: C.SU
525
- });
526
- }
527
- t.interval && t.interval > 0 && (l.value = new C({
528
- ...l.value.origOptions,
529
- dtstart: p.startDate,
530
- interval: t.interval
531
- })), "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({
532
- ...l.value.origOptions,
533
- dtstart: p.startDate,
534
- bymonthday: [],
535
- byweekday: t.byweekday
536
- })), "bysetpos" in t && t.bysetpos != null && (l.value = new C({
537
- ...l.value.origOptions,
538
- dtstart: p.startDate,
539
- bymonthday: [],
540
- bysetpos: t.bysetpos,
541
- byweekday: ((i = l.value.options.byweekday) == null ? void 0 : i.length) > 0 ? l.value.options.byweekday : [6]
542
- })), "bymonthday" in t && t.bymonthday && Array.isArray(t.bymonthday) && t.bymonthday.length > 0 && (l.value = new C({
543
- ...l.value.origOptions,
544
- dtstart: p.startDate,
545
- bysetpos: [],
546
- byweekday: [],
547
- bymonthday: t.bymonthday
548
- })), "bymonth" in t && t.bymonth && Array.isArray(t.bymonth) && t.bymonth.length > 0 && (l.value = new C({
549
- ...l.value.origOptions,
550
- dtstart: p.startDate,
551
- bysetpos: [],
552
- bymonth: t.bymonth
553
- })), "bynweekday" in t && t.bynweekday && (l.value = new C({
554
- ...l.value.origOptions,
555
- dtstart: p.startDate,
556
- bysetpos: [],
557
- byweekday: new Ve(
558
- t.bynweekday[0][0],
559
- t.bynweekday[0][1]
560
- )
561
- })), p.applyButton || s("update:model-value", l.value.toString());
562
- }
563
- return K(() => {
564
- p.modelValue || s(
565
- "update:model-value",
566
- new C({
567
- dtstart: p.startDate,
568
- freq: C.DAILY,
569
- wkst: C.SU,
570
- interval: 1,
571
- byhour: 0,
572
- byminute: 0,
573
- bysecond: 0
574
- }).toString()
575
- );
576
- }), (t, i) => {
577
- var V, S, m;
578
- const u = g("FmStepperField"), b = g("FmChip"), c = g("FmButtonGroup"), k = g("FmButton");
579
- return n(), h("div", _e, [
580
- U("div", qe, W(e(ke)(e(l).options)), 1),
581
- a.fixedFrequency ? A("", !0) : (n(), h("div", Me, [
582
- Be,
583
- v(u, {
584
- class: "w-[100px]",
585
- "model-value": e(l).options.interval,
586
- "onUpdate:modelValue": i[0] || (i[0] = (o) => f({ interval: o > 0 ? o : e(l).options.interval })),
587
- min: 1
588
- }, null, 8, ["model-value"]),
589
- v(D, {
590
- class: "w-min",
591
- items: e(H).frequencies,
592
- "model-value": e(l).origOptions.freq,
593
- "onUpdate:modelValue": i[1] || (i[1] = (o) => f({ freq: o }))
594
- }, null, 8, ["items", "model-value"])
595
- ])),
596
- e(l).options.freq === e(C).WEEKLY ? (n(), h(Y, { key: 1 }, [
597
- $e,
598
- U("div", Ne, [
599
- (n(!0), h(Y, null, N(e(H).weekdays, (o) => {
600
- var d;
601
- return n(), F(b, {
602
- 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"}`]),
603
- label: o.label[0],
604
- key: o.value,
605
- compact: !0,
606
- onClick: () => {
607
- var y, T;
608
- f({
609
- byweekday: (y = e(l).options.byweekday) != null && y.includes(o.value) ? ((T = e(l).options.byweekday) == null ? void 0 : T.filter((E) => E !== o.value)) || [] : [...e(l).options.byweekday || [], o.value]
610
- });
611
- }
612
- }, null, 8, ["class", "label", "onClick"]);
613
- }), 128))
614
- ])
615
- ], 64)) : A("", !0),
616
- e(l).options.freq == e(C).MONTHLY ? (n(), h(Y, { key: 2 }, [
617
- v(c, {
618
- "model-value": e(l).options.bymonthday.length ? { label: "Each" } : { label: "On the" },
619
- items: [
620
- {
621
- label: "Each"
622
- },
623
- {
624
- label: "On the"
625
- }
626
- ],
627
- "onUpdate:modelValue": i[2] || (i[2] = (o) => {
628
- o.label == "Each" ? f({ bymonthday: [1] }) : f({ bysetpos: 1 });
629
- })
630
- }, null, 8, ["model-value"]),
631
- e(l).options.bymonthday.length > 0 ? (n(), h("div", Ae, [
632
- (n(!0), h(Y, null, N(e(H).dates, (o) => (n(), h("div", {
633
- key: o.value,
634
- 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" : ""}`]),
635
- onClick: (d) => f({
636
- bymonthday: e(l).options.bymonthday.includes(o.value) ? e(l).options.bymonthday.filter((y) => y !== o.value) : [...e(l).options.bymonthday, o.value]
637
- })
638
- }, W(o.value), 11, Pe))), 128))
639
- ])) : (n(), h("div", Le, [
640
- v(D, {
641
- items: e(H).ordinals,
642
- "model-value": (V = e(l).options.bysetpos) == null ? void 0 : V[0],
643
- "onUpdate:modelValue": i[3] || (i[3] = (o) => f({ bysetpos: o }))
644
- }, null, 8, ["items", "model-value"]),
645
- U("div", He, [
646
- (n(!0), h(Y, null, N(e(H).weekdays, (o) => {
647
- var d;
648
- return n(), F(b, {
649
- 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"}`]),
650
- label: o.label[0],
651
- key: o.value,
652
- compact: !0,
653
- onClick: () => {
654
- f({
655
- byweekday: [o.value]
656
- });
657
- }
658
- }, null, 8, ["class", "label", "onClick"]);
659
- }), 128))
660
- ])
661
- ]))
662
- ], 64)) : A("", !0),
663
- e(l).options.freq == e(C).YEARLY ? (n(), h(Y, { key: 3 }, [
664
- We,
665
- U("div", je, [
666
- (n(!0), h(Y, null, N(e(H).months, (o) => {
667
- var d, y;
668
- return n(), F(b, {
669
- key: o.value,
670
- class: L(["cursor-pointer", {
671
- "bg-fm-color-primary text-white": (d = e(l).options.bymonth) == null ? void 0 : d.includes(
672
- o.value
673
- ),
674
- "bg-fm-color-gray-200 text-fm-color-gray-800": !((y = e(l).options.bymonth) != null && y.includes(o.value))
675
- }]),
676
- label: o.shortName,
677
- compact: !0,
678
- onClick: (T) => f({
679
- bymonth: (e(l).options.bymonth ?? []).includes(o.value) ? (e(l).options.bymonth ?? []).filter((E) => E !== o.value) : [...e(l).options.bymonth ?? [], o.value]
680
- })
681
- }, null, 8, ["class", "label", "onClick"]);
682
- }), 128))
683
- ]),
684
- v(c, {
685
- "model-value": e(l).options.bymonthday.length ? { label: "Each" } : { label: "On the" },
686
- items: [
687
- {
688
- label: "Each"
689
- },
690
- {
691
- label: "On the"
692
- }
693
- ],
694
- "onUpdate:modelValue": i[4] || (i[4] = (o) => {
695
- o.label == "Each" ? f({
696
- bymonthday: [1],
697
- bymonth: e(l).options.bymonth ?? [1]
698
- }) : f({
699
- byweekday: [e(C).SU.nth(1)],
700
- bymonth: e(l).options.bymonth ?? [1]
701
- });
702
- })
703
- }, null, 8, ["model-value"]),
704
- e(l).options.bymonthday.length > 0 ? (n(), h("div", Ge, [
705
- (n(!0), h(Y, null, N(Array(31).fill(null).map((o, d) => d + 1), (o) => (n(), h("div", {
706
- key: o,
707
- 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" : ""}`]),
708
- onClick: (d) => f({
709
- bymonthday: e(l).options.bymonthday.includes(o) ? e(l).options.bymonthday.filter((y) => y !== o) : [...e(l).options.bymonthday, o]
710
- })
711
- }, W(o), 11, Ke))), 128))
712
- ])) : (n(), h("div", Qe, [
713
- v(D, {
714
- items: e(H).ordinals,
715
- "model-value": (m = (S = e(l).options.bynweekday) == null ? void 0 : S[0]) == null ? void 0 : m[1],
716
- "onUpdate:modelValue": i[5] || (i[5] = (o) => {
717
- var d, y;
718
- return f({
719
- bynweekday: [[((y = (d = e(l).options.bynweekday) == null ? void 0 : d[0]) == null ? void 0 : y[0]) ?? 1, o]]
720
- });
721
- })
722
- }, null, 8, ["items", "model-value"]),
723
- U("div", ze, [
724
- (n(!0), h(Y, null, N(e(H).weekdays, (o) => {
725
- var d, y;
726
- return n(), F(b, {
727
- class: L(["cursor-pointer", `${((y = (d = e(l).options.bynweekday) == null ? void 0 : d[0]) == null ? void 0 : y[0]) === o.value ? "bg-fm-color-primary text-white" : "bg-fm-color-neutral-gray-200 text-black"}`]),
728
- label: o.label[0],
729
- key: o.value,
730
- compact: !0,
731
- onClick: () => {
732
- var T, E;
733
- f({
734
- bynweekday: [
735
- [o.value, ((E = (T = e(l).options.bynweekday) == null ? void 0 : T[0]) == null ? void 0 : E[1]) ?? 1]
736
- ]
737
- });
738
- }
739
- }, null, 8, ["class", "label", "onClick"]);
740
- }), 128))
741
- ])
742
- ]))
743
- ], 64)) : A("", !0),
744
- a.applyButton ? (n(), h("div", Ze, [
745
- v(k, {
746
- label: "Cancel",
747
- variant: "tertiary",
748
- onClick: i[6] || (i[6] = (o) => s("cancel"))
749
- }),
750
- v(k, {
751
- label: "Apply",
752
- onClick: i[7] || (i[7] = (o) => s("update:model-value", e(l).toString()))
753
- })
754
- ])) : A("", !0)
755
- ]);
756
- };
757
- }
758
- }), Je = { class: "grid grid-cols-4 gap-8 w-full flex-wrap py-16" }, Xe = /* @__PURE__ */ $({
759
- __name: "IsInMonthInput",
760
- props: {
761
- modelValue: {
762
- type: Object,
763
- required: !0
764
- }
765
- },
766
- emits: ["update:model-value"],
767
- setup(a, { emit: w }) {
768
- const p = a, s = w, l = J.months().map((f, t) => ({
769
- name: f,
770
- shortName: J().month(t).format("MMM"),
771
- value: t
772
- }));
773
- return K(() => {
774
- p.modelValue || s("update:model-value", []);
775
- }), (f, t) => {
776
- const i = g("FmChip");
777
- return n(), h("div", Je, [
778
- (n(!0), h(Y, null, N(e(l), (u) => {
779
- var b, c;
780
- return n(), F(i, {
781
- class: L(["cursor-pointer", {
782
- "bg-fm-color-primary text-white": (b = a.modelValue) == null ? void 0 : b.includes(u.value),
783
- "bg-fm-color-gray-200 text-fm-color-gray-800": !((c = a.modelValue) != null && c.includes(
784
- u.value
785
- ))
786
- }]),
787
- label: u.name,
788
- key: u.value,
789
- compact: !0,
790
- onClick: (k) => s(
791
- "update:model-value",
792
- a.modelValue.includes(u.value) ? a.modelValue.filter((V) => V !== u.value) : [...a.modelValue, u.value]
793
- )
794
- }, null, 8, ["class", "label", "onClick"]);
795
- }), 128))
796
- ]);
797
- };
798
- }
799
- }), et = { class: "flex flex-col flex-nowrap" }, tt = { class: "flex gap-16 items-center w-full" }, lt = { class: "flex grow items-center" }, ot = { class: "grow text-fm-color-typo-secondary" }, at = { key: 0 }, nt = { class: "px-16" }, rt = /* @__PURE__ */ $({
800
- __name: "SelectItems",
801
- props: {
802
- initialValue: {
803
- type: Array,
804
- default: () => []
805
- },
806
- filterItems: {
807
- type: Function,
808
- default: void 0
809
- },
810
- onComplete: {
811
- type: Function,
812
- required: !0
813
- },
814
- maxHeight: {
815
- type: [String, Number],
816
- default: 380
817
- }
818
- },
819
- setup(a, { expose: w }) {
820
- const p = a, s = Fe(), l = _(() => s.menu.value || {
821
- _id: "",
822
- modules: {
823
- catalog: [],
824
- category: [],
825
- item: [],
826
- variant: [],
827
- group: [],
828
- takeaway: [],
829
- scheduler: [],
830
- printDepartment: [],
831
- recipe: [],
832
- sku: [],
833
- unit: [],
834
- cookingGuide: [],
835
- serveSequence: []
836
- }
837
- }), f = _(() => {
838
- const o = p.filterItems ?? ((y) => !!y.category);
839
- return l.value.modules.item.filter(o).reduce((y, T) => {
840
- const E = {
841
- id: T._id,
842
- category: T.category,
843
- name: (T.name2 || T.name).trim()
844
- };
845
- return y = [...y, E], y;
846
- }, []);
847
- }), t = _(() => {
848
- const o = l.value.modules.category.reduce((d, y) => (d[y._id] = {
849
- id: y._id,
850
- name: y.name,
851
- items: {}
852
- }, d), {});
853
- return f.value.reduce(
854
- (d, y) => {
855
- const T = y.category ?? "";
856
- return d[T].items = {
857
- ...d[T].items,
858
- [y.id]: y
859
- }, d;
860
- },
861
- {
862
- ...o,
863
- "": {
864
- id: "",
865
- name: "Addons",
866
- items: {}
867
- }
868
- }
869
- );
870
- }), i = _(() => {
871
- const o = b.value.toLowerCase();
872
- return o ? Object.entries(t.value).reduce((d, [y, T]) => {
873
- if (T.name.toLowerCase().includes(o))
874
- return d[y] = T, d;
875
- const E = Object.entries(T.items).reduce((r, [M, O]) => (O.name.toLowerCase().includes(o) && (r[M] = O), r), {});
876
- return Object.keys(E).length > 0 && (d[y] = { ...T, items: E }), d;
877
- }, {}) : t.value;
878
- }), u = P({}), b = P(""), c = _(() => Object.values(u.value).filter((o) => !!o).length);
879
- function k(o) {
880
- u.value = f.value.reduce((d, y) => (d[y.id] = o.includes(y.id), d), {});
881
- }
882
- K(async () => {
883
- await s.getMenu(), k(p.initialValue);
884
- });
885
- function V(o) {
886
- const d = Object.keys(i.value[o].items), y = d.filter((T) => u.value[T]);
887
- return y.length ? y.length === d.length ? !0 : null : !1;
888
- }
889
- function S(o) {
890
- const d = Object.keys(i.value[o].items), y = V(o), T = oe(u.value);
891
- for (const E of d)
892
- T[E] = y !== !0;
893
- u.value = T;
894
- }
895
- function m(o) {
896
- u.value[o] = !u.value[o];
897
- }
898
- return w({
899
- onConfirm: () => {
900
- const o = Object.entries(u.value).filter(([, d]) => !!d).map(([d]) => d);
901
- p.onComplete(o);
902
- }
903
- }), (o, d) => {
904
- const y = g("fm-button"), T = g("FmTextField"), E = g("fm-list-item"), r = g("fm-checkbox"), M = g("fm-list");
905
- return n(), h("div", et, [
906
- v(E, {
907
- tag: "div",
908
- clickable: !1
909
- }, {
910
- default: q(() => [
911
- U("div", tt, [
912
- U("div", lt, [
913
- v(y, {
914
- icon: "sync",
915
- variant: "tertiary",
916
- onClick: d[0] || (d[0] = () => k([]))
917
- }),
918
- U("span", ot, W(c.value) + " product(s) selected ", 1)
919
- ]),
920
- v(T, {
921
- modelValue: b.value,
922
- "onUpdate:modelValue": d[1] || (d[1] = (O) => b.value = O),
923
- placeholder: "Search",
924
- "leading-icon": { name: "search", color: "" },
925
- style: { width: "200px", "min-width": "200px" }
926
- }, null, 8, ["modelValue"])
927
- ])
928
- ]),
929
- _: 1
930
- }),
931
- v(M, {
932
- class: L(["grow overflow-y-auto", `max-h-${p.maxHeight ? `[${p.maxHeight}px]` : "full"}`])
933
- }, {
934
- default: q(() => [
935
- (n(!0), h(Y, null, N(i.value, (O) => (n(), h(Y, {
936
- key: O.id
937
- }, [
938
- Object.keys(O.items).length > 0 ? (n(), h("div", at, [
939
- U("div", nt, [
940
- v(r, {
941
- "model-value": V(O.id) ?? !1,
942
- indeterminate: V(O.id) === null,
943
- label: O.name,
944
- value: "",
945
- name: "",
946
- sublabel: "",
947
- class: "w-full",
948
- "onUpdate:modelValue": () => S(O.id)
949
- }, null, 8, ["model-value", "indeterminate", "label", "onUpdate:modelValue"])
950
- ]),
951
- (n(!0), h(Y, null, N(O.items, (B) => (n(), h("div", {
952
- key: B.id,
953
- class: "pl-48"
954
- }, [
955
- v(r, {
956
- "model-value": u.value[B.id],
957
- label: B.name,
958
- value: B.id,
959
- name: B.name,
960
- class: "w-full",
961
- "onUpdate:modelValue": () => m(B.id)
962
- }, null, 8, ["model-value", "label", "value", "name", "onUpdate:modelValue"])
963
- ]))), 128))
964
- ])) : A("", !0)
965
- ], 64))), 128))
966
- ]),
967
- _: 1
968
- }, 8, ["class"])
969
- ]);
970
- };
971
- }
972
- }), ut = /* @__PURE__ */ U("div", null, "Select Item", -1), st = { class: "" }, it = { class: "flex justify-end gap-8 w-full" }, mt = /* @__PURE__ */ $({
973
- __name: "MenuDialog",
974
- props: {
975
- modelValue: { type: Boolean },
976
- initialValue: {},
977
- filterItems: { type: Function }
978
- },
979
- emits: ["update:model-value", "confirm"],
980
- setup(a, { emit: w }) {
981
- const p = a, s = P(), l = P(!1), f = w;
982
- function t() {
983
- var u;
984
- (u = s.value) == null || u.onConfirm(), f("update:model-value", !1);
985
- }
986
- function i() {
987
- f("update:model-value", !1);
988
- }
989
- return ie(
990
- () => p.modelValue,
991
- (u) => {
992
- l.value = u;
993
- }
994
- ), K(() => {
995
- l.value = p.modelValue;
996
- }), (u, b) => {
997
- const c = g("FmButton"), k = g("FmDialog");
998
- return n(), F(k, {
999
- "content-scrollable": !1,
1000
- contentClass: "pt-0",
1001
- modelValue: l.value,
1002
- "onUpdate:modelValue": b[0] || (b[0] = (V) => l.value = V),
1003
- title: "Select Items",
1004
- "close-button": !1
1005
- }, {
1006
- "dialog-header": q(() => [
1007
- ut
1008
- ]),
1009
- "dialog-footer": q(() => [
1010
- U("div", it, [
1011
- v(c, {
1012
- variant: "tertiary",
1013
- onClick: i,
1014
- label: "Cancel"
1015
- }),
1016
- v(c, {
1017
- variant: "primary",
1018
- onClick: t,
1019
- label: "Confirm"
1020
- })
1021
- ])
1022
- ]),
1023
- default: q(() => [
1024
- U("div", st, [
1025
- v(rt, {
1026
- ref_key: "selectItemRef",
1027
- ref: s,
1028
- "initial-value": u.initialValue,
1029
- "filter-items": u.filterItems,
1030
- "on-complete": (V) => {
1031
- f("confirm", V), i();
1032
- }
1033
- }, null, 8, ["initial-value", "filter-items", "on-complete"])
1034
- ])
1035
- ]),
1036
- _: 1
1037
- }, 8, ["modelValue"]);
1038
- };
1039
- }
1040
- }), dt = { id: "select-menu" }, pt = /* @__PURE__ */ $({
1041
- __name: "SelectMenu",
1042
- props: {
1043
- modelValue: {}
1044
- },
1045
- emits: ["update:model-value"],
1046
- setup(a, { emit: w }) {
1047
- const p = a, s = P(!1), l = _(() => {
1048
- var i;
1049
- return ((i = p.modelValue) == null ? void 0 : i.length) || 0;
1050
- }), f = w;
1051
- function t(i) {
1052
- f("update:model-value", i);
1053
- }
1054
- return (i, u) => {
1055
- const b = g("FmField");
1056
- return n(), h("div", dt, [
1057
- v(b, {
1058
- class: "text-fm-color-typo-tertiary",
1059
- onClick: u[0] || (u[0] = (c) => s.value = !0)
1060
- }, {
1061
- default: q(() => [
1062
- te(W(l.value) + " item(s) selected ", 1)
1063
- ]),
1064
- _: 1
1065
- }),
1066
- v(mt, {
1067
- modelValue: s.value,
1068
- "onUpdate:modelValue": [
1069
- u[1] || (u[1] = (c) => s.value = c),
1070
- u[2] || (u[2] = (c) => s.value = c)
1071
- ],
1072
- "initial-value": i.modelValue,
1073
- onConfirm: t
1074
- }, null, 8, ["modelValue", "initial-value"])
1075
- ]);
1076
- };
1077
- }
1078
- }), ct = {
1079
- key: 18,
1080
- class: "fm-typo-en-body-lg-600"
1081
- }, yt = /* @__PURE__ */ $({
1082
- __name: "RuleEquator",
1083
- props: {
1084
- type: {
1085
- type: String,
1086
- required: !0
1087
- },
1088
- operator: {
1089
- type: String,
1090
- required: !0
1091
- },
1092
- modelValue: {
1093
- type: Object
1094
- }
1095
- },
1096
- emits: ["update:model-value"],
1097
- setup(a, { emit: w }) {
1098
- const p = a, s = w, l = _(() => {
1099
- const f = ce[p.operator].safeParse(p.modelValue);
1100
- return f.success ? [] : f.error.errors;
1101
- });
1102
- return (f, t) => {
1103
- var m, o, d, y, T, E;
1104
- const i = g("FmTextField"), u = g("FmStepperField"), b = g("FmSimpleDatePicker"), c = g("FmSimpleDateRangePicker"), k = g("FmTimeRangePicker"), V = g("FmTimePicker"), S = g("FmHelperText");
1105
- return n(), h("div", {
1106
- class: L({ "pb-4": e(l).length })
1107
- }, [
1108
- a.type === "text" ? (n(), F(i, {
1109
- key: 0,
1110
- "model-value": a.modelValue,
1111
- "onUpdate:modelValue": t[0] || (t[0] = (r) => s("update:model-value", r))
1112
- }, null, 8, ["model-value"])) : a.type === "number" ? (n(), F(u, {
1113
- key: 1,
1114
- "model-value": a.modelValue,
1115
- "onUpdate:modelValue": t[1] || (t[1] = (r) => s("update:model-value", r))
1116
- }, null, 8, ["model-value"])) : a.operator == "_isDay" ? (n(), F(ne(Ye), {
1117
- key: 2,
1118
- "model-value": a.modelValue,
1119
- "onUpdate:modelValue": t[2] || (t[2] = (r) => s("update:model-value", r))
1120
- }, null, 8, ["model-value"])) : a.operator == "_isRange" ? (n(), F(ne(Ie), {
1121
- key: 3,
1122
- "model-value": a.modelValue,
1123
- "onUpdate:modelValue": t[3] || (t[3] = (r) => s("update:model-value", r))
1124
- }, null, 8, ["model-value"])) : a.operator == "_isOnDate" ? (n(), F(b, {
1125
- key: 4,
1126
- "model-value": a.modelValue,
1127
- "onUpdate:modelValue": t[4] || (t[4] = (r) => s("update:model-value", r))
1128
- }, null, 8, ["model-value"])) : a.operator == "_isBetween" ? (n(), F(c, {
1129
- key: 5,
1130
- "model-value": {
1131
- startDate: (m = a.modelValue) == null ? void 0 : m.start,
1132
- endDate: (o = a.modelValue) == null ? void 0 : o.end
1133
- },
1134
- "onUpdate:modelValue": t[5] || (t[5] = (r) => {
1135
- s("update:model-value", {
1136
- start: r.startDate,
1137
- end: r.endDate
1138
- });
1139
- })
1140
- }, null, 8, ["model-value"])) : a.operator == "_isInMonth" ? (n(), F(Xe, {
1141
- key: 6,
1142
- "model-value": a.modelValue,
1143
- "onUpdate:modelValue": t[6] || (t[6] = (r) => s("update:model-value", r))
1144
- }, null, 8, ["model-value"])) : a.operator == "_rrule" ? (n(), F(ee, {
1145
- key: 7,
1146
- "model-value": a.modelValue,
1147
- "onUpdate:modelValue": t[7] || (t[7] = (r) => s("update:model-value", r))
1148
- }, null, 8, ["model-value"])) : a.operator == "_isBetweenTime" ? (n(), F(k, {
1149
- key: 8,
1150
- "disable-time-check": !0,
1151
- "model-value": [(y = (d = a.modelValue) == null ? void 0 : d[0]) == null ? void 0 : y.start, (E = (T = a.modelValue) == null ? void 0 : T[0]) == null ? void 0 : E.end],
1152
- "onUpdate:modelValue": t[8] || (t[8] = (r) => s("update:model-value", [
1153
- {
1154
- start: r[0],
1155
- end: r[1]
1156
- }
1157
- ]))
1158
- }, null, 8, ["model-value"])) : a.operator == "_isOnTime" ? (n(), F(V, {
1159
- key: 9,
1160
- "model-value": a.modelValue,
1161
- "onUpdate:modelValue": t[9] || (t[9] = (r) => s("update:model-value", r))
1162
- }, null, 8, ["model-value"])) : a.type == "tier" ? (n(), F(D, {
1163
- key: 10,
1164
- items: (e(z)().sortedTiers ?? []).map((r, M) => ({
1165
- label: `Tier ${M + 1} - ${r.name}`,
1166
- value: M + 1
1167
- })),
1168
- "model-value": a.modelValue,
1169
- "onUpdate:modelValue": t[10] || (t[10] = (r) => s("update:model-value", r))
1170
- }, null, 8, ["items", "model-value"])) : a.type == "boolean" ? (n(), F(D, {
1171
- key: 11,
1172
- multiselect: !0,
1173
- items: [
1174
- { label: "true", value: !0 },
1175
- { label: "false", value: !1 }
1176
- ],
1177
- "model-value": a.modelValue ?? [],
1178
- "onUpdate:modelValue": t[11] || (t[11] = (r) => s("update:model-value", r))
1179
- }, null, 8, ["model-value"])) : a.type == "gender" ? (n(), F(D, {
1180
- key: 12,
1181
- multiselect: !0,
1182
- items: [
1183
- { label: "Male", value: "MALE" },
1184
- { label: "Female", value: "FEMALE" }
1185
- ],
1186
- "model-value": a.modelValue ?? [],
1187
- "onUpdate:modelValue": t[12] || (t[12] = (r) => s("update:model-value", r))
1188
- }, null, 8, ["model-value"])) : a.type == "collectible" ? (n(), F(D, {
1189
- key: 13,
1190
- multiselect: !0,
1191
- items: [],
1192
- "model-value": a.modelValue ?? [],
1193
- "onUpdate:modelValue": t[13] || (t[13] = (r) => s("update:model-value", r))
1194
- }, null, 8, ["model-value"])) : a.type == "segment" ? (n(), F(D, {
1195
- key: 14,
1196
- multiselect: !0,
1197
- items: e(z)().segmentOptions,
1198
- "model-value": a.modelValue ?? [],
1199
- "onUpdate:modelValue": t[14] || (t[14] = (r) => s("update:model-value", r)),
1200
- label: "Select segment(s) to match"
1201
- }, null, 8, ["items", "model-value"])) : a.type == "title" ? (n(), F(D, {
1202
- key: 15,
1203
- multiselect: !0,
1204
- items: (e(z)().sortedTitles ?? []).map((r) => ({
1205
- label: r.name,
1206
- value: r._id
1207
- })),
1208
- "model-value": a.modelValue ?? [],
1209
- "onUpdate:modelValue": t[15] || (t[15] = (r) => s("update:model-value", r))
1210
- }, null, 8, ["items", "model-value"])) : a.type == "product" ? (n(), F(pt, {
1211
- key: 16,
1212
- "model-value": a.modelValue,
1213
- "onUpdate:modelValue": t[16] || (t[16] = (r) => s("update:model-value", r))
1214
- }, null, 8, ["model-value"])) : a.type == "location" ? (n(), F(D, {
1215
- key: 17,
1216
- multiselect: !0,
1217
- items: e(X)().locations.map((r) => ({
1218
- label: r.name,
1219
- value: r._id
1220
- })),
1221
- "model-value": a.modelValue ?? [],
1222
- "onUpdate:modelValue": t[17] || (t[17] = (r) => s("update:model-value", r))
1223
- }, null, 8, ["items", "model-value"])) : (n(), h("div", ct, "Rule Not implemented")),
1224
- v(S, {
1225
- class: "items-end",
1226
- state: e(Z).helperState(e(l), ""),
1227
- text: e(Z).helperText(e(l), "")
1228
- }, null, 8, ["state", "text"])
1229
- ], 2);
1230
- };
1231
- }
1232
- }), vt = { class: "space-y-4" }, ft = /* @__PURE__ */ U("div", { class: "fm-typo-en-body-lg-400" }, "Property", -1), bt = /* @__PURE__ */ U("div", { class: "fm-typo-en-body-lg-400" }, "Check to perform", -1), gt = { class: "flex items-center gap-8" }, kt = /* @__PURE__ */ U("div", { class: "fm-typo-en-body-lg-400" }, "Criteria", -1), Vt = { class: "flex items-center justify-end gap-8 pt-16 w-full" }, Et = /* @__PURE__ */ $({
1233
- __name: "CustomRuleDialog",
1234
- props: {
1235
- triggerType: {
1236
- type: String,
1237
- required: !0
1238
- },
1239
- includeOnly: {
1240
- type: String
1241
- },
1242
- modelValue: {
1243
- type: Object,
1244
- default: () => {
1245
- }
1246
- }
1247
- },
1248
- setup(a) {
1249
- const w = le(), p = z(), { emitData: s, emitAction: l } = se(), f = a, t = _(
1250
- () => ye(f.triggerType, f.includeOnly)
1251
- ), i = (E) => re[t.value.find((r) => r.property === E).type], u = _(() => {
1252
- if (!V.value) return [];
1253
- const E = t.value.find(
1254
- (r) => r.property === V.value.property
1255
- );
1256
- return E ? re[E.type].map((r) => ({
1257
- label: Ee[r].name,
1258
- value: r
1259
- })) : [];
1260
- }), b = ve, c = _(() => {
1261
- const E = b.safeParse(V.value);
1262
- return E.success ? [] : E.error.errors;
1263
- }), k = P(!1), V = P(
1264
- oe(f.modelValue) ?? I.constructEntry(
1265
- t.value[0].property,
1266
- i(t.value[0].property)[0],
1267
- null
1268
- )
1269
- ), S = _(() => {
1270
- var j;
1271
- const { property: E, negated: r, conditions: M } = V.value, O = Object.keys(M || {})[0], B = Object.values(M || {})[0];
1272
- return {
1273
- property: E,
1274
- negated: r == !0,
1275
- type: (j = t.value.find((G) => G.property === E)) == null ? void 0 : j.type,
1276
- operator: O,
1277
- equator: B
1278
- };
1279
- });
1280
- function m(E) {
1281
- V.value = I.constructEntry(
1282
- E,
1283
- i(E)[0],
1284
- null
1285
- );
1286
- }
1287
- function o(E) {
1288
- V.value = { ...V.value, negated: E == !0 };
1289
- }
1290
- function d(E) {
1291
- V.value = {
1292
- ...V.value,
1293
- conditions: { [E]: null }
1294
- };
1295
- }
1296
- function y(E) {
1297
- V.value.conditions = {
1298
- [S.value.operator]: E
1299
- };
1300
- }
1301
- function T() {
1302
- s(V.value), l("primary"), w.close();
1303
- }
1304
- return ue(async () => {
1305
- await p.readMembership();
1306
- }), (E, r) => {
1307
- const M = g("FmIcon"), O = g("FmField"), B = g("FmPill"), j = g("FmMenuItem"), G = g("FmMenu"), Q = g("FmButton");
1308
- return n(), h("div", vt, [
1309
- ft,
1310
- v(G, {
1311
- shift: !0,
1312
- placement: "top-start",
1313
- modelValue: e(k),
1314
- "onUpdate:modelValue": r[0] || (r[0] = (R) => me(k) ? k.value = R : null),
1315
- onMenuChanged: r[1] || (r[1] = (R) => k.value = R)
1316
- }, {
1317
- "menu-button": q(() => [
1318
- v(O, null, {
1319
- append: q(() => [
1320
- v(M, {
1321
- name: e(k) ? "expand_less" : "expand_more"
1322
- }, null, 8, ["name"])
1323
- ]),
1324
- default: q(() => {
1325
- var R;
1326
- return [
1327
- te(W((R = e(t).find((x) => x.property == e(V).property)) == null ? void 0 : R.name) + " ", 1)
1328
- ];
1329
- }),
1330
- _: 1
1331
- })
1332
- ]),
1333
- default: q(() => [
1334
- (n(!0), h(Y, null, N(e(t), (R) => (n(), F(j, {
1335
- key: R.property,
1336
- "model-value": e(V).property == R.property,
1337
- label: R.name,
1338
- disabled: R.premium && !e(X)().isPremium,
1339
- onClick: (x) => R.premium && !e(X)().isPremium ? null : m(R.property)
1340
- }, de({ _: 2 }, [
1341
- R.premium ? {
1342
- name: "append",
1343
- fn: q(() => [
1344
- v(B, { variant: "premium" })
1345
- ]),
1346
- key: "0"
1347
- } : void 0
1348
- ]), 1032, ["model-value", "label", "disabled", "onClick"]))), 128))
1349
- ]),
1350
- _: 1
1351
- }, 8, ["modelValue"]),
1352
- bt,
1353
- U("div", gt, [
1354
- v(D, {
1355
- class: "w-1/4",
1356
- items: [
1357
- { label: "is", value: !1 },
1358
- { label: "is not", value: !0 }
1359
- ],
1360
- "model-value": e(V).negated ?? !1,
1361
- "onUpdate:modelValue": o
1362
- }, null, 8, ["model-value"]),
1363
- v(D, {
1364
- class: "flex-1",
1365
- items: e(u),
1366
- "model-value": e(S).operator,
1367
- "onUpdate:modelValue": d
1368
- }, null, 8, ["items", "model-value"])
1369
- ]),
1370
- U("div", null, [
1371
- kt,
1372
- e(S).type ? (n(), F(yt, {
1373
- key: 0,
1374
- type: e(S).type,
1375
- operator: e(S).operator,
1376
- "model-value": e(S).equator,
1377
- "onUpdate:modelValue": y
1378
- }, null, 8, ["type", "operator", "model-value"])) : A("", !0)
1379
- ]),
1380
- U("div", Vt, [
1381
- v(Q, {
1382
- onClick: r[2] || (r[2] = (R) => e(w).close()),
1383
- label: "Cancel",
1384
- variant: "tertiary"
1385
- }),
1386
- v(Q, {
1387
- onClick: r[3] || (r[3] = (R) => T()),
1388
- disabled: e(c).length > 0,
1389
- label: "Save"
1390
- }, null, 8, ["disabled"])
1391
- ])
1392
- ]);
1393
- };
1394
- }
1395
- }), ht = { class: "flex flex-col gap-8" }, St = { class: "grid grid-cols-2 items-center" }, Ft = { class: "flex items-center gap-8" }, Tt = { class: "pt-16 flex items-center self-end gap-8" }, xt = /* @__PURE__ */ $({
1396
- __name: "PresetRuleDialog",
1397
- props: {
1398
- preset: {
1399
- type: String,
1400
- required: !0
1401
- },
1402
- modelValue: {
1403
- type: Object
1404
- }
1405
- },
1406
- setup(a) {
1407
- const w = le(), { emitData: p, emitAction: s } = se(), l = z(), f = a;
1408
- function t() {
1409
- const { operator: S, equator: m } = b.value;
1410
- switch (f.preset) {
1411
- case "MIN_SPEND":
1412
- case "SPECIFIC_DATE":
1413
- case "SPECIFIC_TIMERANGE":
1414
- case "WEEKLY":
1415
- case "MONTHLY":
1416
- case "BIRTHDAY":
1417
- case "TIER":
1418
- return `Applies to ${l.sortedTiers.filter((d, y) => S == "_equal" ? y + 1 == m : S == "_moreThanOrEqual" ? y + 1 >= m : y + 1 <= m).map((d) => d.name).join(", ")}`;
1419
- }
1420
- }
1421
- function i() {
1422
- var S, m;
1423
- switch (f.preset) {
1424
- case "MIN_SPEND":
1425
- return I.constructEntry("bill.amount", "_moreThanOrEqual", 0);
1426
- case "SPECIFIC_DATE":
1427
- return I.constructEntry("trigger.date", "_isOnDate", "");
1428
- case "SPECIFIC_TIMERANGE":
1429
- return I.constructEntry("trigger.time", "_isBetweenTime", [
1430
- { start: "00:00", end: "23:59" }
1431
- ]);
1432
- case "WEEKLY":
1433
- return I.constructEntry(
1434
- "trigger.date",
1435
- "_rrule",
1436
- "RRULE:FREQ=WEEKLY;WKST=SU;BYDAY=SU;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
1437
- );
1438
- case "MONTHLY":
1439
- return I.constructEntry(
1440
- "trigger.date",
1441
- "_rrule",
1442
- "RRULE:FREQ=MONTHLY;WKST=SU;BYMONTHDAY=1;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
1443
- );
1444
- case "BIRTHDAY":
1445
- return I.constructEntry("user.birthday", "_isDay", {
1446
- op: "after",
1447
- x: 1,
1448
- ignoreYear: !0
1449
- });
1450
- case "TIER":
1451
- return I.constructEntry("user.tier", "_equal", 1);
1452
- case "TITLE":
1453
- return I.constructEntry("user.titles", "_hasAny", [
1454
- (m = (S = l.sortedTitles) == null ? void 0 : S[0]) == null ? void 0 : m._id
1455
- ]);
1456
- case "CUSTOM":
1457
- throw new Error("Not implemented");
1458
- }
1459
- }
1460
- const u = P(i()), b = _(() => {
1461
- const S = I.simplify(u.value);
1462
- return {
1463
- ...S,
1464
- equator: S.equator
1465
- };
1466
- });
1467
- function c(S, m) {
1468
- const o = b.value;
1469
- u.value = I.constructEntry(
1470
- o.property,
1471
- m ?? o.operator,
1472
- S,
1473
- u.value.name
1474
- );
1475
- }
1476
- function k() {
1477
- p(u.value), s("primary"), w.close();
1478
- }
1479
- const V = _(() => {
1480
- const S = fe.safeParse(u.value);
1481
- return S.success ? [] : S.error.errors;
1482
- });
1483
- return ue(async () => {
1484
- await l.readMembership();
1485
- }), (S, m) => {
1486
- var B, j, G, Q, R;
1487
- const o = g("FmStepperField"), d = g("FmDatePicker"), y = g("FmTimeRangePicker"), T = g("FmRadio"), E = g("FmSelect"), r = g("FmRadioGroup"), M = g("FmHelperText"), O = g("FmButton");
1488
- return n(), h("div", ht, [
1489
- a.preset == "MIN_SPEND" ? (n(), F(o, {
1490
- key: 0,
1491
- label: "Minimum spend",
1492
- "model-value": e(b).equator,
1493
- "onUpdate:modelValue": m[0] || (m[0] = (x) => c(x))
1494
- }, null, 8, ["model-value"])) : a.preset == "SPECIFIC_DATE" ? (n(), F(d, {
1495
- key: 1,
1496
- label: "Specific Date",
1497
- "model-value": e(b).equator,
1498
- "onUpdate:modelValue": m[1] || (m[1] = (x) => c(x))
1499
- }, null, 8, ["model-value"])) : a.preset == "SPECIFIC_TIMERANGE" ? (n(), F(y, {
1500
- key: 2,
1501
- label: "Time is between",
1502
- "disable-time-check": !0,
1503
- "model-value": [(j = (B = e(b).equator) == null ? void 0 : B[0]) == null ? void 0 : j.start, (Q = (G = e(b).equator) == null ? void 0 : G[0]) == null ? void 0 : Q.end],
1504
- "onUpdate:modelValue": m[2] || (m[2] = (x) => c([
1505
- {
1506
- start: x[0],
1507
- end: x[1]
1508
- }
1509
- ]))
1510
- }, null, 8, ["model-value"])) : a.preset == "WEEKLY" ? (n(), F(ee, {
1511
- key: 3,
1512
- label: "Weekly",
1513
- "fixed-frequency": !0,
1514
- "model-value": e(b).equator,
1515
- "onUpdate:modelValue": m[3] || (m[3] = (x) => c(x))
1516
- }, null, 8, ["model-value"])) : a.preset == "MONTHLY" ? (n(), F(ee, {
1517
- key: 4,
1518
- label: "Weekly",
1519
- "fixed-frequency": !0,
1520
- "model-value": e(b).equator,
1521
- "onUpdate:modelValue": m[4] || (m[4] = (x) => c(x))
1522
- }, null, 8, ["model-value"])) : a.preset == "BIRTHDAY" ? (n(), h(Y, { key: 5 }, [
1523
- U("div", St, [
1524
- v(T, {
1525
- label: "N days before birthday",
1526
- value: "_isDay",
1527
- "model-value": e(b).operator,
1528
- "onUpdate:modelValue": m[5] || (m[5] = () => {
1529
- c(
1530
- {
1531
- op: "after",
1532
- x: 1,
1533
- ignoreYear: !0
1534
- },
1535
- "_isDay"
1536
- );
1537
- })
1538
- }, null, 8, ["model-value"]),
1539
- U("div", Ft, [
1540
- v(T, {
1541
- label: "Is in this",
1542
- value: "_isRange",
1543
- "model-value": e(b).operator,
1544
- "onUpdate:modelValue": m[6] || (m[6] = () => {
1545
- c(
1546
- {
1547
- op: "this",
1548
- unit: "day",
1549
- ignoreYear: !0
1550
- },
1551
- "_isRange"
1552
- );
1553
- })
1554
- }, null, 8, ["model-value"]),
1555
- e(b).operator == "_isRange" ? (n(), F(E, {
1556
- key: 0,
1557
- items: ["day", "week", "month"].map((x) => ({ label: x, value: x })),
1558
- "model-value": e(b).equator.unit,
1559
- "onUpdate:modelValue": m[7] || (m[7] = (x) => c(
1560
- {
1561
- op: "this",
1562
- unit: x,
1563
- ignoreYear: !0
1564
- },
1565
- "_isRange"
1566
- ))
1567
- }, null, 8, ["items", "model-value"])) : A("", !0)
1568
- ])
1569
- ]),
1570
- e(b).operator == "_isDay" ? (n(), F(o, {
1571
- key: 0,
1572
- label: "Days before birthday",
1573
- "show-steppers": !1,
1574
- "model-value": e(b).equator.x,
1575
- "onUpdate:modelValue": m[8] || (m[8] = (x) => c({
1576
- op: "after",
1577
- x,
1578
- ignoreYear: !0
1579
- }))
1580
- }, null, 8, ["model-value"])) : A("", !0)
1581
- ], 64)) : a.preset == "TIER" ? (n(), h(Y, { key: 6 }, [
1582
- v(r, {
1583
- inline: !0,
1584
- "model-value": e(b).operator,
1585
- "onUpdate:modelValue": m[9] || (m[9] = (x) => c(e(b).equator, x))
1586
- }, {
1587
- default: q(() => [
1588
- v(T, {
1589
- value: "_moreThanOrEqual",
1590
- label: "At least"
1591
- }),
1592
- v(T, {
1593
- value: "_equal",
1594
- label: "Equal"
1595
- }),
1596
- v(T, {
1597
- value: "_lessThanOrEqual",
1598
- label: "At most"
1599
- })
1600
- ]),
1601
- _: 1
1602
- }, 8, ["model-value"]),
1603
- v(D, {
1604
- items: (e(l).sortedTiers ?? []).map((x, ae) => ({
1605
- label: `Tier ${ae + 1} - ${x.name}`,
1606
- value: ae + 1
1607
- })),
1608
- "model-value": e(b).equator,
1609
- "onUpdate:modelValue": m[10] || (m[10] = (x) => c(x))
1610
- }, null, 8, ["items", "model-value"]),
1611
- v(M, {
1612
- text: t()
1613
- }, null, 8, ["text"])
1614
- ], 64)) : a.preset == "TITLE" ? (n(), F(D, {
1615
- key: 7,
1616
- label: "User has title",
1617
- items: (e(l).sortedTitles ?? []).map((x) => ({
1618
- label: x.name,
1619
- value: x._id
1620
- })),
1621
- "model-value": (R = e(b).equator) == null ? void 0 : R[0],
1622
- "onUpdate:modelValue": m[11] || (m[11] = (x) => c([x]))
1623
- }, null, 8, ["items", "model-value"])) : A("", !0),
1624
- v(M, {
1625
- class: "mt-[-8px]",
1626
- text: e(Z).helperText(e(V), ""),
1627
- state: e(Z).helperState(e(V), "")
1628
- }, null, 8, ["text", "state"]),
1629
- U("div", Tt, [
1630
- v(O, {
1631
- onClick: m[12] || (m[12] = (x) => e(w).close()),
1632
- label: "Cancel",
1633
- variant: "tertiary"
1634
- }),
1635
- v(O, {
1636
- onClick: m[13] || (m[13] = (x) => k()),
1637
- disabled: e(V).length > 0,
1638
- label: "Save"
1639
- }, null, 8, ["disabled"])
1640
- ])
1641
- ]);
1642
- };
1643
- }
1644
- }), Ct = /* @__PURE__ */ $({
1645
- __name: "RuleConfigurator",
1646
- props: {
1647
- triggerType: {
1648
- type: String,
1649
- required: !0
1650
- },
1651
- includeOnly: {
1652
- type: String
1653
- },
1654
- modelValue: {
1655
- type: Object,
1656
- default: () => {
1657
- }
1658
- }
1659
- },
1660
- emits: ["update:model-value"],
1661
- setup(a, { expose: w, emit: p }) {
1662
- const s = a, l = p, f = le(), t = P();
1663
- function i(c) {
1664
- f.open({
1665
- title: c.name,
1666
- closeButton: !1,
1667
- dismissAway: !1,
1668
- contentComponent: xt,
1669
- contentComponentProps: {
1670
- preset: c.type,
1671
- modelValue: s.modelValue
1672
- }
1673
- }).onPrimary((k) => l("update:model-value", k));
1674
- }
1675
- function u(c) {
1676
- f.open({
1677
- title: "Edit rule",
1678
- closeButton: !1,
1679
- dismissAway: !1,
1680
- contentComponent: Et,
1681
- contentComponentProps: {
1682
- triggerType: s.triggerType,
1683
- includeOnly: s.includeOnly,
1684
- modelValue: c
1685
- }
1686
- }).onPrimary((k) => l("update:model-value", k));
1687
- }
1688
- function b(c) {
1689
- if (c.type == "CUSTOM") {
1690
- const [k] = c.rules;
1691
- return u(
1692
- I.constructEntry(k.property, k.operator, k.equator)
1693
- );
1694
- }
1695
- return i(c);
1696
- }
1697
- return w({
1698
- showCustomDialog: u
1699
- }), (c, k) => {
1700
- const V = g("FmButton"), S = g("FmMenuItem"), m = g("FmMenu");
1701
- return n(), F(m, {
1702
- shift: !0,
1703
- placement: "top-start"
1704
- }, {
1705
- "menu-button": q(() => [
1706
- v(V, {
1707
- label: "Add condition",
1708
- icon: "add",
1709
- class: "text-fm-color-primary border-fm-color-primary",
1710
- "icon-color": "primary",
1711
- variant: "secondary"
1712
- })
1713
- ]),
1714
- default: q(() => [
1715
- (n(!0), h(Y, null, N(e(Oe).filter(
1716
- (o) => !a.includeOnly || o.for.includes(a.includeOnly)
1717
- ), (o) => (n(), F(S, {
1718
- key: o.name,
1719
- "model-value": o.name == e(t),
1720
- label: o.name,
1721
- onClick: (d) => b(o)
1722
- }, null, 8, ["model-value", "label", "onClick"]))), 128))
1723
- ]),
1724
- _: 1
1725
- });
1726
- };
1727
- }
1728
- }), Ut = /* @__PURE__ */ U("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " When ", -1), Kt = /* @__PURE__ */ $({
1729
- __name: "RuleGroup",
1730
- props: {
1731
- triggerType: {
1732
- type: String,
1733
- required: !0
1734
- },
1735
- includeOnly: {
1736
- type: String
1737
- },
1738
- modelValue: {
1739
- type: Object
1740
- }
1741
- },
1742
- emits: ["update:model-value"],
1743
- setup(a, { emit: w }) {
1744
- const p = a, s = w, l = _(
1745
- () => p.modelValue ?? I.scaffoldGroup()
1746
- ), f = _(() => I.getLogic(l.value)), t = P();
1747
- return (i, u) => {
1748
- const b = g("FmButtonGroup"), c = g("FmCard");
1749
- return n(), F(c, { variant: "outlined" }, {
1750
- default: q(() => [
1751
- v(c, { class: "border-l-4 border-fm-color-primary p-16 space-y-16" }, {
1752
- default: q(() => [
1753
- Ut,
1754
- v(Ct, {
1755
- ref_key: "configuratorRef",
1756
- ref: t,
1757
- "include-only": a.includeOnly,
1758
- "trigger-type": a.triggerType,
1759
- "onUpdate:modelValue": u[0] || (u[0] = (k) => s("update:model-value", e(I).setRuleToGroup(e(l), k)))
1760
- }, null, 8, ["include-only", "trigger-type"]),
1761
- (n(!0), h(Y, null, N(e(l).rules, (k, V) => {
1762
- var S;
1763
- return n(), h(Y, null, [
1764
- e(be)(k) ? (n(), F(we, {
1765
- "model-value": k,
1766
- key: V,
1767
- onEdit: (S = e(t)) == null ? void 0 : S.showCustomDialog,
1768
- onRemove: u[1] || (u[1] = (m) => {
1769
- s(
1770
- "update:model-value",
1771
- e(I).removeEntry(e(l), m.name)
1772
- );
1773
- })
1774
- }, null, 8, ["model-value", "onEdit"])) : A("", !0),
1775
- v(b, {
1776
- class: "w-[200px]",
1777
- disabled: Object.keys(e(l).rules).length < 2,
1778
- items: [{ label: "And" }, { label: "Or" }],
1779
- "model-value": e(f) === "&&" ? { label: "And" } : { label: "Or" },
1780
- "onUpdate:modelValue": u[2] || (u[2] = (m) => s(
1781
- "update:model-value",
1782
- e(I).setRuleToGroup(
1783
- e(l),
1784
- [],
1785
- m.label === "And" ? "&&" : "||"
1786
- )
1787
- ))
1788
- }, null, 8, ["disabled", "model-value"])
1789
- ], 64);
1790
- }), 256))
1791
- ]),
1792
- _: 1
1793
- })
1794
- ]),
1795
- _: 1
1796
- });
1797
- };
1798
- }
1799
- });
1800
- export {
1801
- Kt as _,
1802
- ee as a,
1803
- rt as b
1804
- };