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