@feedmepos/mf-connect 0.1.38-beta.15 → 0.1.38-beta.16

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 (92) hide show
  1. package/dist/{Analytic-_Qs02rgF.js → Analytic-jl4e3fVn.js} +13 -13
  2. package/dist/{App-CA7NhH1y.js → App-CEsDdjaM.js} +6 -6
  3. package/dist/{AuditLogs-QPGNfyVG.js → AuditLogs-BohQg038.js} +9 -9
  4. package/dist/{Bin-Dmcb45JL.js → Bin-BGXjJ5VW.js} +8 -8
  5. package/dist/{Broadcast-CSei_kLa.js → Broadcast-BSTi7-Yf.js} +9 -9
  6. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-HiKnYVBV.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-QH4HkXQY.js} +6 -6
  7. package/dist/{Card-41zs6oZh.js → Card-s7U7LRtB.js} +16 -16
  8. package/dist/{Collections-C8vsgwkt.js → Collections-BeS42GXZ.js} +6 -6
  9. package/dist/{Credit-BLHGI1hV.js → Credit-CGxTprTC.js} +9 -9
  10. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-BFFGEmOU.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-lz38Es-C.js} +29 -29
  11. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-Bgaa1YHj.js → EffectSheet.vue_vue_type_style_index_0_lang-zUBQmt9-.js} +6 -6
  12. package/dist/{Experience-ChhUGJPW.js → Experience-Bow06hgT.js} +9 -9
  13. package/dist/{Game-Ch8oZJnM.js → Game-CPiUwDCG.js} +10 -10
  14. package/dist/{Index-35wPfEMa.js → Index-xEglNJv0.js} +10 -10
  15. package/dist/{Marketing-W82IxcvU.js → Marketing-olGFS_aQ.js} +6 -6
  16. package/dist/{Member-Ckb9rn75.js → Member-7kHk77zW.js} +10 -10
  17. package/dist/{MemberList-DYzVosSi.js → MemberList-CuY78jb2.js} +25 -25
  18. package/dist/{MemberTransactions-DS2EJUm_.js → MemberTransactions-lFUeVg-f.js} +1 -1
  19. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-CkLF5DYI.js → MessageInput.vue_vue_type_script_setup_true_lang-DzYi9Gey.js} +7 -7
  20. package/dist/{Mission-CzZ5boPL.js → Mission-cg_SDs8B.js} +10 -10
  21. package/dist/{Overview-Bx-9rjwi.js → Overview-BF3M4Efy.js} +18 -18
  22. package/dist/{Point-BHwNvFxo.js → Point-dPxLCnUW.js} +9 -9
  23. package/dist/{Promotion-B8OC4egy.js → Promotion-BvsnY3RV.js} +10 -10
  24. package/dist/{Queue-Bvzu_MDZ.js → Queue-BXD5Ei0N.js} +10 -10
  25. package/dist/{Record-zA5eba99.js → Record-C_jv-HCY.js} +8 -8
  26. package/dist/{Reward-DN80RZ95.js → Reward-CcrtvAjb.js} +15 -15
  27. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-CQVztItQ.js → RewardGroup.vue_vue_type_script_setup_true_lang-R2OA9yvm.js} +11 -11
  28. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-CCRfPG2Y.js +1762 -0
  29. package/dist/{Segment-C1YJmvKv.js → Segment-SBguO8MM.js} +22 -22
  30. package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-DnekzpY5.js → SelectItems.vue_vue_type_script_setup_true_lang-CUKoS8se.js} +2 -2
  31. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-CpRgh1UA.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-CRr9VQgZ.js} +11 -11
  32. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-B-vrEYxe.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-CXk11Ojm.js} +3 -3
  33. package/dist/{Setting-DrdKN2eA.js → Setting-D4wlZbFs.js} +11 -11
  34. package/dist/{Store-B_rdDio7.js → Store-BfX4GTkG.js} +19 -19
  35. package/dist/{StoreRewards-D1POgZgH.js → StoreRewards-BYZmeh4-.js} +13 -13
  36. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-CBpmJEor.js → StoreTransactions.vue_vue_type_script_setup_true_lang-Bp03Bknt.js} +20 -20
  37. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-y6FKeDOi.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-CxGi5zoz.js} +1 -1
  38. package/dist/{Tier-BWWJVQ4K.js → Tier-DaXrwvpy.js} +20 -20
  39. package/dist/{Title-CyL-ECG5.js → Title-CWXFC8Ad.js} +19 -19
  40. package/dist/{Transaction-BTGJ8l7_.js → Transaction-Bt4c8H43.js} +2 -2
  41. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-clmXX6eo.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-C-b6FVcg.js} +6 -6
  42. package/dist/{Voucher-CEzQFe0l.js → Voucher-CprWj63F.js} +13 -13
  43. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-BRZ3VSSN.js → VoucherEditor.vue_vue_type_script_setup_true_lang-DnMbrxQ3.js} +10 -10
  44. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-BC5QzYur.js → ZodTextField.vue_vue_type_script_setup_true_lang-LxIB6lzj.js} +1 -1
  45. package/dist/{app-CpidKHrx.js → app-BhkW_J81.js} +31 -31
  46. package/dist/{app-CEphgf27.js → app-CyQ86XVQ.js} +1 -1
  47. package/dist/app.js +1 -1
  48. package/dist/{business-BazVvumh.js → business-BfZbJ92o.js} +1 -1
  49. package/dist/{campaign-Uv_vQSub.js → campaign-BhvQ60ym.js} +2 -2
  50. package/dist/{campaign-BBB-GyEH.js → campaign-DgChHt8b.js} +9 -9
  51. package/dist/{campaign.enum-BWsCFFS5.js → campaign.enum-DMdsiO_D.js} +1 -1
  52. package/dist/{campaign.fn-D0xmge7M.js → campaign.fn-lXfoRrX4.js} +45 -45
  53. package/dist/{collectible.enum-BZvflYtf.js → collectible.enum-D8W_mwNv.js} +1 -1
  54. package/dist/{collection.fn-D_ZzV2cB.js → collection.fn-BPyCHJ9Y.js} +2 -2
  55. package/dist/{dto-BczC1N1X.js → dto-D-3egLnS.js} +4 -4
  56. package/dist/{effect-CDlWLSlj.js → effect-Bcn2t-o4.js} +1 -1
  57. package/dist/{email-addresses-xYULl5r2.js → email-addresses-D7sHQ_HE.js} +1 -1
  58. package/dist/{export-DmMd0jpg.js → export-9p5TpFRL.js} +3 -3
  59. package/dist/{helper-Bz_oabQF.js → helper-BWsABAvV.js} +1 -1
  60. package/dist/{index-9EWs92m-.js → index-BXfqCqO8.js} +1 -1
  61. package/dist/{index-CfjVSXBm.js → index-BneK6ISF.js} +3 -3
  62. package/dist/{index-XwCy_lG2.js → index-C5JpGR9a.js} +1 -1
  63. package/dist/{index-5KrdIMtq.js → index-CF5XIOCF.js} +1 -1
  64. package/dist/{index-CsdW_3qs.js → index-CGL6urFd.js} +2 -2
  65. package/dist/{index-CML6mKMh.js → index-CNVFTP26.js} +3 -3
  66. package/dist/{index-ClEPG6XH.js → index-CnUsrYgA.js} +1 -1
  67. package/dist/{index-_Z66Z3ec.js → index-CsTO8f5N.js} +1 -1
  68. package/dist/{index-ZSIRmd6N.js → index-CyZh9WPs.js} +1 -1
  69. package/dist/{index-kk_D9FMz.js → index-DWWJyvx7.js} +3 -3
  70. package/dist/{index-Dy4Fsst6.js → index-DYJ5vd_u.js} +6 -6
  71. package/dist/{index-BDZ7SZia.js → index-DZvJmTdo.js} +1 -1
  72. package/dist/{index-CxRuDeHE.js → index-P4UhLKk0.js} +1 -1
  73. package/dist/{index-tr62qthJ.js → index-wF-tfDV7.js} +4 -4
  74. package/dist/{index.esm2017-E4Xm-84r.js → index.esm2017-l7PPB95r.js} +1 -1
  75. package/dist/{loading-CI4y6Y4v.js → loading-CUtudJld.js} +1 -1
  76. package/dist/{membership-CyV1oUpM.js → membership-BdxDrpPE.js} +3 -3
  77. package/dist/{money-6YBWiSoO.js → money-DyKE1yvB.js} +1 -1
  78. package/dist/{number-i_I-YMtC.js → number-DljJaEZ1.js} +1 -1
  79. package/dist/objectid-D4mUrhLD.js +145 -0
  80. package/dist/{plugins-fwyStp45.js → plugins-Dp_oAjMm.js} +2 -2
  81. package/dist/{reward-pbTE9P9F.js → reward-BT_pdnVx.js} +1 -1
  82. package/dist/{rule-CJwz71Ax.js → rule-DCCS2Vng.js} +3 -3
  83. package/dist/rule-builder-8sQPfoKy.js +91 -0
  84. package/dist/{template-BsGNlyBC.js → template-CO-NXr4M.js} +4 -4
  85. package/dist/{trigger-CnOrSzmt.js → trigger-CQ7-ukOK.js} +4 -4
  86. package/dist/{user-BW_bR5pQ.js → user-wRLz3X57.js} +1 -1
  87. package/dist/{vue-i18n-eL-D3xoL.js → vue-i18n-C37GGUIa.js} +2 -2
  88. package/dist/{xlsx-B39-L9KY.js → xlsx-Cax6Hzqr.js} +1 -1
  89. package/package.json +1 -1
  90. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-CNlpAbeT.js +0 -1751
  91. package/dist/objectid-BfTeCnKs.js +0 -145
  92. package/dist/rule-builder-qvel7XJ3.js +0 -89
@@ -1,1751 +0,0 @@
1
- import { defineComponent as A, computed as I, resolveComponent as V, openBlock as r, createElementBlock as S, createElementVNode as C, createVNode as v, unref as e, createTextVNode as te, toDisplayString as W, withCtx as q, onMounted as z, createBlock as k, createCommentVNode as M, ref as $, Fragment as h, renderList as N, normalizeClass as H, 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-CsdW_3qs.js";
3
- import { R as O, a as ge } from "./rule-builder-qvel7XJ3.js";
4
- import { a as ke, R as Y, S as Ve, C as L, W as Ee, T as re, O as ne } from "./rule-CJwz71Ax.js";
5
- import { p as Te } from "./plugins-fwyStp45.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-CpidKHrx.js";
9
- import { u as Q } from "./membership-CyV1oUpM.js";
10
- import { u as X } from "./business-BazVvumh.js";
11
- import "./index-CfjVSXBm.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-DnekzpY5.js";
16
- import "./index-Dy4Fsst6.js";
17
- import "./index-tr62qthJ.js";
18
- import "./index-BDZ7SZia.js";
19
- import "./index-kk_D9FMz.js";
20
- const Ue = { class: "flex items-center justify-between" }, Ye = { class: "flex items-center gap-8 xs:flex-wrap" }, Re = { class: "text-fm-color-primary line-clamp-1 text-ellipsis" }, Ce = /* @__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: R }) {
30
- const y = o, i = I(() => {
31
- const [u, m] = Object.entries(y.modelValue.conditions)[0];
32
- return {
33
- negated: y.modelValue.negated == !0,
34
- property: y.modelValue.property,
35
- operator: u,
36
- equator: m
37
- };
38
- }), l = R, d = I(
39
- () => ke(
40
- i.value.property,
41
- i.value.operator,
42
- i.value.equator,
43
- i.value.negated
44
- )
45
- );
46
- async function t(u) {
47
- u.stopPropagation(), await Te.remove("Are you sure you want to remove this rule?") && l("remove", y.modelValue);
48
- }
49
- return (u, m) => {
50
- var c;
51
- const p = V("FmChip"), b = V("FmTooltip"), f = V("FmIcon");
52
- return r(), S("div", Ue, [
53
- C("div", Ye, [
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
- m[1] || (m[1] = C("div", { class: "h-[26px] border-l-2 rounded-md border-fm-color-neutral-gray-100" }, null, -1)),
59
- C("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(W(e(d)[0]) + " ", 1),
64
- v(b, {
65
- "z-index": 1e3,
66
- content: e(d)[1]
67
- }, {
68
- default: q(() => [
69
- C("div", Re, W(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 xe = [
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: R }) {
356
- const y = o, i = R;
357
- z(() => {
358
- y.modelValue || i("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
- i("update:model-value", {
371
- ...t,
372
- ...d
373
- });
374
- }
375
- return (d, t) => {
376
- var m, p, b;
377
- const u = V("FmStepperField");
378
- return r(), S("div", De, [
379
- v(u, {
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" }, he = /* @__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: R }) {
421
- const y = o, i = R;
422
- z(() => {
423
- y.modelValue || i("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, u) => {
450
- var p, b, f, c, E;
451
- const m = V("FmStepperField");
452
- return r(), 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": u[0] || (u[0] = (s) => i("update:model-value", { op: s, unit: "day", ignoreYear: !1 }))
459
- }, null, 8, ["model-value"]),
460
- ((b = o.modelValue) == null ? void 0 : b.op) != "this" ? (r(), 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": u[1] || (u[1] = (s) => i("update:model-value", {
466
- op: o.modelValue.op,
467
- unit: o.modelValue.unit,
468
- ignoreYear: o.modelValue.ignoreYear == !0,
469
- x: s
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": u[2] || (u[2] = (s) => i("update:model-value", { ...y.modelValue, unit: s }))
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": u[3] || (u[3] = (s) => i("update:model-value", {
488
- ...y.modelValue,
489
- ignoreYear: s == !0
490
- }))
491
- }, null, 8, ["model-value"])
492
- ]);
493
- };
494
- }
495
- }), qe = { class: "space-y-8" }, Be = { class: "text-fm-color-primary rounded-md border-dashed border-2 p-8" }, Me = {
496
- key: 0,
497
- class: "flex items-center gap-8"
498
- }, Ie = { class: "flex gap-4" }, Ae = {
499
- key: 0,
500
- class: "grid grid-cols-7 overflow-hidden rounded-md border-1"
501
- }, Ne = ["onClick"], Pe = {
502
- key: 1,
503
- class: "flex items-center gap-8"
504
- }, $e = { class: "flex gap-4 xs:gap-[2px]" }, Le = { class: "grid grid-cols-6 gap-8" }, He = {
505
- key: 0,
506
- class: "grid grid-cols-7 overflow-hidden rounded-md border-1"
507
- }, We = ["onClick"], _e = {
508
- key: 1,
509
- class: "grid grid-cols-2 items-center gap-8"
510
- }, je = { class: "flex gap-4" }, Ke = {
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: R }) {
531
- const y = o, i = R, l = $(
532
- y.modelValue ? Y.fromString(y.modelValue) : new Y({
533
- dtstart: y.startDate,
534
- freq: Y.DAILY,
535
- wkst: Y.SU,
536
- interval: 1,
537
- byhour: 0,
538
- byminute: 0,
539
- bysecond: 0
540
- })
541
- );
542
- function d(t) {
543
- var u;
544
- if ("freq" in t)
545
- switch (t.freq) {
546
- case Y.WEEKLY:
547
- l.value = new Y({
548
- dtstart: y.startDate,
549
- freq: t.freq,
550
- interval: 1,
551
- byhour: 0,
552
- byminute: 0,
553
- bysecond: 0,
554
- wkst: Y.SU,
555
- byweekday: [Y.MO]
556
- });
557
- break;
558
- case Y.MONTHLY:
559
- l.value = new Y({
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: Y.SU
568
- });
569
- break;
570
- case Y.YEARLY:
571
- l.value = new Y({
572
- dtstart: y.startDate,
573
- freq: t.freq,
574
- interval: 1,
575
- byhour: 0,
576
- byminute: 0,
577
- bysecond: 0,
578
- wkst: Y.SU,
579
- bymonth: [(/* @__PURE__ */ new Date()).getMonth() + 1],
580
- bymonthday: [(/* @__PURE__ */ new Date()).getDate()]
581
- });
582
- break;
583
- default:
584
- l.value = new Y({
585
- dtstart: y.startDate,
586
- freq: t.freq,
587
- interval: 1,
588
- byhour: 0,
589
- byminute: 0,
590
- bysecond: 0,
591
- wkst: Y.SU
592
- });
593
- }
594
- t.interval && t.interval > 0 && (l.value = new Y({
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 == Y.MONTHLY && (l.value.options.bymonthday = []), l.value = new Y({
599
- ...l.value.origOptions,
600
- dtstart: y.startDate,
601
- bymonthday: [],
602
- byweekday: t.byweekday
603
- })), "bysetpos" in t && t.bysetpos != null && (l.value = new Y({
604
- ...l.value.origOptions,
605
- dtstart: y.startDate,
606
- bymonthday: [],
607
- bysetpos: t.bysetpos,
608
- byweekday: ((u = l.value.options.byweekday) == null ? void 0 : u.length) > 0 ? l.value.options.byweekday : [6]
609
- })), "bymonthday" in t && t.bymonthday && Array.isArray(t.bymonthday) && t.bymonthday.length > 0 && (l.value = new Y({
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 Y({
616
- ...l.value.origOptions,
617
- dtstart: y.startDate,
618
- bysetpos: [],
619
- bymonth: t.bymonth
620
- })), "bynweekday" in t && t.bynweekday && (l.value = new Y({
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 || i("update:model-value", l.value.toString());
629
- }
630
- return z(() => {
631
- y.modelValue || i(
632
- "update:model-value",
633
- new Y({
634
- dtstart: y.startDate,
635
- freq: Y.DAILY,
636
- wkst: Y.SU,
637
- interval: 1,
638
- byhour: 0,
639
- byminute: 0,
640
- bysecond: 0
641
- }).toString()
642
- );
643
- }), (t, u) => {
644
- var c, E, s;
645
- const m = V("FmStepperField"), p = V("FmChip"), b = V("FmButtonGroup"), f = V("FmButton");
646
- return r(), S("div", qe, [
647
- C("div", Be, W(e(Ve)(e(l).options)), 1),
648
- o.fixedFrequency ? M("", !0) : (r(), S("div", Me, [
649
- u[8] || (u[8] = C("div", null, "Repeat every", -1)),
650
- v(m, {
651
- class: "w-[100px]",
652
- "model-value": e(l).options.interval,
653
- "onUpdate:modelValue": u[0] || (u[0] = (n) => d({ interval: n > 0 ? n : e(l).options.interval })),
654
- min: 1
655
- }, null, 8, ["model-value"]),
656
- v(x, {
657
- class: "w-min",
658
- items: e(L).frequencies,
659
- "model-value": e(l).origOptions.freq,
660
- "onUpdate:modelValue": u[1] || (u[1] = (n) => d({ freq: n }))
661
- }, null, 8, ["items", "model-value"])
662
- ])),
663
- e(l).options.freq === e(Y).WEEKLY ? (r(), S(h, { key: 1 }, [
664
- u[9] || (u[9] = C("div", null, "Repeat on", -1)),
665
- C("div", Ie, [
666
- (r(!0), S(h, null, N(e(L).weekdays, (n) => {
667
- var U;
668
- return r(), k(p, {
669
- class: H(["cursor-pointer", `${(U = e(l).options.byweekday) != null && U.includes(n.value) ? "bg-fm-color-primary text-white" : "bg-fm-color-neutral-gray-200 text-black"}`]),
670
- label: n.label[0],
671
- key: n.value,
672
- compact: !0,
673
- onClick: () => {
674
- var g, w;
675
- d({
676
- byweekday: (g = e(l).options.byweekday) != null && g.includes(n.value) ? ((w = e(l).options.byweekday) == null ? void 0 : w.filter((F) => F !== n.value)) || [] : [...e(l).options.byweekday || [], n.value]
677
- });
678
- }
679
- }, null, 8, ["class", "label", "onClick"]);
680
- }), 128))
681
- ])
682
- ], 64)) : M("", !0),
683
- e(l).options.freq == e(Y).MONTHLY ? (r(), S(h, { 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": u[2] || (u[2] = (n) => {
695
- n.label == "Each" ? d({ bymonthday: [1] }) : d({ bysetpos: 1 });
696
- })
697
- }, null, 8, ["model-value"]),
698
- e(l).options.bymonthday.length > 0 ? (r(), S("div", Ae, [
699
- (r(!0), S(h, null, N(e(L).dates, (n) => (r(), S("div", {
700
- key: n.value,
701
- class: H(["cursor-pointer text-center outline-1 outline-fm-color-neutral-gray-100 outline", `${e(l).options.bymonthday.includes(n.value) ? "bg-fm-color-primary text-fm-color-typo-white outline-transparent" : "bg-transparent text-fm-color-typo-primary"} ${n.value == 31 ? "border-r" : ""}`]),
702
- onClick: (U) => d({
703
- bymonthday: e(l).options.bymonthday.includes(n.value) ? e(l).options.bymonthday.filter((g) => g !== n.value) : [...e(l).options.bymonthday, n.value]
704
- })
705
- }, W(n.value), 11, Ne))), 128))
706
- ])) : (r(), S("div", Pe, [
707
- v(x, {
708
- items: e(L).ordinals,
709
- "model-value": (c = e(l).options.bysetpos) == null ? void 0 : c[0],
710
- "onUpdate:modelValue": u[3] || (u[3] = (n) => d({ bysetpos: n }))
711
- }, null, 8, ["items", "model-value"]),
712
- C("div", $e, [
713
- (r(!0), S(h, null, N(e(L).weekdays, (n) => {
714
- var U;
715
- return r(), k(p, {
716
- class: H(["cursor-pointer", `${(U = e(l).options.byweekday) != null && U.includes(n.value) ? "bg-fm-color-primary text-white" : "bg-fm-color-neutral-gray-200 text-black"}`]),
717
- label: n.label[0],
718
- key: n.value,
719
- compact: !0,
720
- onClick: () => {
721
- d({
722
- byweekday: [n.value]
723
- });
724
- }
725
- }, null, 8, ["class", "label", "onClick"]);
726
- }), 128))
727
- ])
728
- ]))
729
- ], 64)) : M("", !0),
730
- e(l).options.freq == e(Y).YEARLY ? (r(), S(h, { key: 3 }, [
731
- u[10] || (u[10] = C("div", null, "Month", -1)),
732
- C("div", Le, [
733
- (r(!0), S(h, null, N(e(L).months, (n) => {
734
- var U, g;
735
- return r(), k(p, {
736
- key: n.value,
737
- class: H(["cursor-pointer", {
738
- "bg-fm-color-primary text-white": (U = e(l).options.bymonth) == null ? void 0 : U.includes(
739
- n.value
740
- ),
741
- "bg-fm-color-gray-200 text-fm-color-gray-800": !((g = e(l).options.bymonth) != null && g.includes(n.value))
742
- }]),
743
- label: n.shortName,
744
- compact: !0,
745
- onClick: (w) => d({
746
- bymonth: (e(l).options.bymonth ?? []).includes(n.value) ? (e(l).options.bymonth ?? []).filter((F) => F !== n.value) : [...e(l).options.bymonth ?? [], n.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": u[4] || (u[4] = (n) => {
762
- n.label == "Each" ? d({
763
- bymonthday: [1],
764
- bymonth: e(l).options.bymonth ?? [1]
765
- }) : d({
766
- byweekday: [e(Y).SU.nth(1)],
767
- bymonth: e(l).options.bymonth ?? [1]
768
- });
769
- })
770
- }, null, 8, ["model-value"]),
771
- e(l).options.bymonthday.length > 0 ? (r(), S("div", He, [
772
- (r(!0), S(h, null, N(Array(31).fill(null).map((n, U) => U + 1), (n) => (r(), S("div", {
773
- key: n,
774
- class: H(["cursor-pointer text-center outline-1 outline-fm-color-neutral-gray-100 outline", `${e(l).options.bymonthday.includes(n) ? "bg-fm-color-primary text-fm-color-typo-white outline-transparent" : "bg-transparent text-fm-color-typo-primary"} ${n == 31 ? "border-r" : ""}`]),
775
- onClick: (U) => d({
776
- bymonthday: e(l).options.bymonthday.includes(n) ? e(l).options.bymonthday.filter((g) => g !== n) : [...e(l).options.bymonthday, n]
777
- })
778
- }, W(n), 11, We))), 128))
779
- ])) : (r(), S("div", _e, [
780
- v(x, {
781
- items: e(L).ordinals,
782
- "model-value": (s = (E = e(l).options.bynweekday) == null ? void 0 : E[0]) == null ? void 0 : s[1],
783
- "onUpdate:modelValue": u[5] || (u[5] = (n) => {
784
- var U, g;
785
- return d({
786
- bynweekday: [[((g = (U = e(l).options.bynweekday) == null ? void 0 : U[0]) == null ? void 0 : g[0]) ?? 1, n]]
787
- });
788
- })
789
- }, null, 8, ["items", "model-value"]),
790
- C("div", je, [
791
- (r(!0), S(h, null, N(e(L).weekdays, (n) => {
792
- var U, g;
793
- return r(), k(p, {
794
- class: H(["cursor-pointer", `${((g = (U = e(l).options.bynweekday) == null ? void 0 : U[0]) == null ? void 0 : g[0]) === n.value ? "bg-fm-color-primary text-white" : "bg-fm-color-neutral-gray-200 text-black"}`]),
795
- label: n.label[0],
796
- key: n.value,
797
- compact: !0,
798
- onClick: () => {
799
- var w, F;
800
- d({
801
- bynweekday: [
802
- [n.value, ((F = (w = e(l).options.bynweekday) == null ? void 0 : w[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 ? (r(), S("div", Ke, [
812
- v(f, {
813
- label: "Cancel",
814
- variant: "tertiary",
815
- onClick: u[6] || (u[6] = (n) => i("cancel"))
816
- }),
817
- v(f, {
818
- label: "Apply",
819
- onClick: u[7] || (u[7] = (n) => i("update:model-value", e(l).toString()))
820
- })
821
- ])) : M("", !0)
822
- ]);
823
- };
824
- }
825
- }), Ge = { class: "grid grid-cols-4 gap-8 w-full flex-wrap py-16" }, Qe = /* @__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: R }) {
835
- const y = o, i = R, 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 || i("update:model-value", []);
842
- }), (d, t) => {
843
- const u = V("FmChip");
844
- return r(), S("div", Ge, [
845
- (r(!0), S(h, null, N(e(l), (m) => {
846
- var p, b;
847
- return r(), k(u, {
848
- class: H(["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) => i(
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
- }), ze = { class: "" }, Xe = { class: "flex justify-end gap-8 w-full" }, Ze = /* @__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: R }) {
875
- const y = o, i = $(), l = $(!1), d = R;
876
- function t() {
877
- var m;
878
- (m = i.value) == null || m.onConfirm(), d("update:model-value", !1);
879
- }
880
- function u() {
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 r(), 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(() => p[1] || (p[1] = [
901
- C("div", null, "Select Item", -1)
902
- ])),
903
- "dialog-footer": q(() => [
904
- C("div", Xe, [
905
- v(b, {
906
- variant: "tertiary",
907
- onClick: u,
908
- label: "Cancel"
909
- }),
910
- v(b, {
911
- variant: "primary",
912
- onClick: t,
913
- label: "Confirm"
914
- })
915
- ])
916
- ]),
917
- default: q(() => [
918
- C("div", ze, [
919
- v(Fe, {
920
- ref_key: "selectItemRef",
921
- ref: i,
922
- "initial-value": m.initialValue,
923
- "filter-items": m.filterItems,
924
- "on-complete": (c) => {
925
- d("confirm", c), u();
926
- }
927
- }, null, 8, ["initial-value", "filter-items", "on-complete"])
928
- ])
929
- ]),
930
- _: 1
931
- }, 8, ["modelValue"]);
932
- };
933
- }
934
- }), Je = { id: "select-menu" }, et = /* @__PURE__ */ A({
935
- __name: "SelectMenu",
936
- props: {
937
- modelValue: {}
938
- },
939
- emits: ["update:model-value"],
940
- setup(o, { emit: R }) {
941
- const y = o, i = $(!1), l = I(() => {
942
- var u;
943
- return ((u = y.modelValue) == null ? void 0 : u.length) || 0;
944
- }), d = R;
945
- function t(u) {
946
- d("update:model-value", u);
947
- }
948
- return (u, m) => {
949
- const p = V("FmField");
950
- return r(), S("div", Je, [
951
- v(p, {
952
- class: "text-fm-color-typo-tertiary",
953
- onClick: m[0] || (m[0] = (b) => i.value = !0)
954
- }, {
955
- default: q(() => [
956
- te(W(l.value) + " item(s) selected ", 1)
957
- ]),
958
- _: 1
959
- }),
960
- v(Ze, {
961
- modelValue: i.value,
962
- "onUpdate:modelValue": [
963
- m[1] || (m[1] = (b) => i.value = b),
964
- m[2] || (m[2] = (b) => i.value = b)
965
- ],
966
- "initial-value": u.modelValue,
967
- onConfirm: t
968
- }, null, 8, ["modelValue", "initial-value"])
969
- ]);
970
- };
971
- }
972
- }), tt = {
973
- key: 19,
974
- class: "fm-typo-en-body-lg-600"
975
- }, lt = /* @__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: R }) {
992
- const y = o, i = R, 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 s, n, U, g, w, F;
998
- const u = V("FmTextField"), m = V("FmStepperField"), p = V("FmSimpleDatePicker"), b = V("FmSimpleDateRangePicker"), f = V("FmTimeRangePicker"), c = V("FmTimePicker"), E = V("FmHelperText");
999
- return r(), S("div", {
1000
- class: H({ "pb-4": e(l).length })
1001
- }, [
1002
- o.type === "text" ? (r(), k(u, {
1003
- key: 0,
1004
- "model-value": o.modelValue,
1005
- "onUpdate:modelValue": t[0] || (t[0] = (a) => i("update:model-value", a))
1006
- }, null, 8, ["model-value"])) : o.type === "number" ? (r(), k(m, {
1007
- key: 1,
1008
- "model-value": o.modelValue,
1009
- "onUpdate:modelValue": t[1] || (t[1] = (a) => i("update:model-value", a))
1010
- }, null, 8, ["model-value"])) : o.operator == "_isDay" ? (r(), k(ae(Oe), {
1011
- key: 2,
1012
- "model-value": o.modelValue,
1013
- "onUpdate:modelValue": t[2] || (t[2] = (a) => i("update:model-value", a))
1014
- }, null, 8, ["model-value"])) : o.operator == "_isRange" ? (r(), k(ae(he), {
1015
- key: 3,
1016
- "model-value": o.modelValue,
1017
- "onUpdate:modelValue": t[3] || (t[3] = (a) => i("update:model-value", a))
1018
- }, null, 8, ["model-value"])) : o.operator == "_isOnDate" ? (r(), k(p, {
1019
- key: 4,
1020
- "model-value": o.modelValue,
1021
- "onUpdate:modelValue": t[4] || (t[4] = (a) => i("update:model-value", a))
1022
- }, null, 8, ["model-value"])) : o.operator == "_isBetween" ? (r(), k(b, {
1023
- key: 5,
1024
- "model-value": {
1025
- startDate: (s = o.modelValue) == null ? void 0 : s.start,
1026
- endDate: (n = o.modelValue) == null ? void 0 : n.end
1027
- },
1028
- "onUpdate:modelValue": t[5] || (t[5] = (a) => {
1029
- i("update:model-value", {
1030
- start: a.startDate,
1031
- end: a.endDate
1032
- });
1033
- })
1034
- }, null, 8, ["model-value"])) : o.operator == "_isInMonth" ? (r(), k(Qe, {
1035
- key: 6,
1036
- "model-value": o.modelValue,
1037
- "onUpdate:modelValue": t[6] || (t[6] = (a) => i("update:model-value", a))
1038
- }, null, 8, ["model-value"])) : o.operator == "_rrule" ? (r(), k(ee, {
1039
- key: 7,
1040
- "model-value": o.modelValue,
1041
- "onUpdate:modelValue": t[7] || (t[7] = (a) => i("update:model-value", a))
1042
- }, null, 8, ["model-value"])) : o.operator == "_isBetweenTime" ? (r(), k(f, {
1043
- key: 8,
1044
- "disable-time-check": !0,
1045
- "model-value": [(g = (U = o.modelValue) == null ? void 0 : U[0]) == null ? void 0 : g.start, (F = (w = o.modelValue) == null ? void 0 : w[0]) == null ? void 0 : F.end],
1046
- "onUpdate:modelValue": t[8] || (t[8] = (a) => i("update:model-value", [
1047
- {
1048
- start: a[0],
1049
- end: a[1]
1050
- }
1051
- ]))
1052
- }, null, 8, ["model-value"])) : o.operator == "_isOnTime" ? (r(), k(c, {
1053
- key: 9,
1054
- "model-value": o.modelValue,
1055
- "onUpdate:modelValue": t[9] || (t[9] = (a) => i("update:model-value", a))
1056
- }, null, 8, ["model-value"])) : o.type == "tier" ? (r(), k(x, {
1057
- key: 10,
1058
- items: (e(Q)().sortedTiers ?? []).map((a, B) => ({
1059
- label: `Tier ${B + 1} - ${a.name}`,
1060
- value: B + 1
1061
- })),
1062
- "model-value": o.modelValue,
1063
- "onUpdate:modelValue": t[10] || (t[10] = (a) => i("update:model-value", a))
1064
- }, null, 8, ["items", "model-value"])) : o.type == "boolean" ? (r(), 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] = (a) => i("update:model-value", a))
1073
- }, null, 8, ["model-value"])) : o.type == "exist" ? (r(), 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] = (a) => i("update:model-value", a))
1081
- }, null, 8, ["model-value"])) : o.type == "gender" ? (r(), 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] = (a) => i("update:model-value", a))
1090
- }, null, 8, ["model-value"])) : o.type == "collectible" ? (r(), k(x, {
1091
- key: 14,
1092
- multiselect: !0,
1093
- items: [],
1094
- "model-value": o.modelValue ?? [],
1095
- "onUpdate:modelValue": t[14] || (t[14] = (a) => i("update:model-value", a))
1096
- }, null, 8, ["model-value"])) : o.type == "segment" ? (r(), 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] = (a) => i("update:model-value", a)),
1102
- label: "Select segment(s) to match"
1103
- }, null, 8, ["items", "model-value"])) : o.type == "title" ? (r(), k(x, {
1104
- key: 16,
1105
- multiselect: !0,
1106
- items: (e(Q)().sortedTitles ?? []).map((a) => ({
1107
- label: a.name,
1108
- value: a._id
1109
- })),
1110
- "model-value": o.modelValue ?? [],
1111
- "onUpdate:modelValue": t[16] || (t[16] = (a) => i("update:model-value", a))
1112
- }, null, 8, ["items", "model-value"])) : o.type == "product" ? (r(), k(et, {
1113
- key: 17,
1114
- "model-value": o.modelValue,
1115
- "onUpdate:modelValue": t[17] || (t[17] = (a) => i("update:model-value", a))
1116
- }, null, 8, ["model-value"])) : o.type == "location" ? (r(), k(x, {
1117
- key: 18,
1118
- multiselect: !0,
1119
- items: e(X)().locations.map((a) => ({
1120
- label: a.name,
1121
- value: a._id
1122
- })),
1123
- "model-value": o.modelValue ?? [],
1124
- "onUpdate:modelValue": t[18] || (t[18] = (a) => i("update:model-value", a))
1125
- }, null, 8, ["items", "model-value"])) : (r(), S("div", tt, "Rule: " + W(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
- }), ot = { class: "space-y-4" }, at = { class: "flex items-center gap-8" }, rt = { class: "flex items-center justify-end gap-8 pt-16 w-full" }, nt = /* @__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 R = le(), y = Q(), { emitData: i, emitAction: l } = ie(), d = o, t = I(
1152
- () => ve(d.triggerType, d.includeOnly)
1153
- ), u = (F) => re[t.value.find((a) => a.property === F).type], m = I(() => {
1154
- if (!c.value) return [];
1155
- const F = t.value.find(
1156
- (a) => a.property === c.value.property
1157
- );
1158
- return F ? re[F.type].filter((a) => {
1159
- var B, P;
1160
- return !((P = (B = ne[a]) == null ? void 0 : B.exclude) != null && P.includes(c.value.property));
1161
- }).map((a) => ({
1162
- label: ne[a].name,
1163
- value: a
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) ?? O.constructEntry(
1170
- t.value[0].property,
1171
- u(t.value[0].property)[0],
1172
- null
1173
- )
1174
- ), E = I(() => {
1175
- var _;
1176
- const { property: F, negated: a, conditions: B } = c.value, P = Object.keys(B || {})[0], j = Object.values(B || {})[0];
1177
- return {
1178
- property: F,
1179
- negated: a == !0,
1180
- type: (_ = t.value.find((K) => K.property === F)) == null ? void 0 : _.type,
1181
- operator: P,
1182
- equator: j
1183
- };
1184
- });
1185
- function s(F) {
1186
- c.value = O.constructEntry(
1187
- F,
1188
- u(F)[0],
1189
- null
1190
- );
1191
- }
1192
- function n(F) {
1193
- c.value = { ...c.value, negated: F == !0 };
1194
- }
1195
- function U(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 w() {
1207
- i(c.value), l("primary"), R.close();
1208
- }
1209
- return ue(async () => {
1210
- await y.readMembership();
1211
- }), (F, a) => {
1212
- const B = V("FmIcon"), P = V("FmField"), j = V("FmPill"), _ = V("FmMenuItem"), K = V("FmMenu"), G = V("FmButton");
1213
- return r(), S("div", ot, [
1214
- a[5] || (a[5] = C("div", { class: "fm-typo-en-body-lg-400" }, "Property", -1)),
1215
- v(K, {
1216
- shift: !0,
1217
- placement: "top-start",
1218
- modelValue: e(f),
1219
- "onUpdate:modelValue": a[0] || (a[0] = (D) => pe(f) ? f.value = D : null),
1220
- onMenuChanged: a[1] || (a[1] = (D) => f.value = D)
1221
- }, {
1222
- "menu-button": q(() => [
1223
- v(P, null, {
1224
- append: q(() => [
1225
- v(B, {
1226
- name: e(f) ? "expand_less" : "expand_more"
1227
- }, null, 8, ["name"])
1228
- ]),
1229
- default: q(() => {
1230
- var D;
1231
- return [
1232
- te(W((D = e(t).find((T) => T.property == e(c).property)) == null ? void 0 : D.name) + " ", 1)
1233
- ];
1234
- }),
1235
- _: 1
1236
- })
1237
- ]),
1238
- default: q(() => [
1239
- (r(!0), S(h, null, N(e(t), (D) => (r(), k(_, {
1240
- key: D.property,
1241
- "model-value": e(c).property == D.property,
1242
- label: D.name,
1243
- disabled: D.premium && !e(X)().isPremium,
1244
- onClick: (T) => D.premium && !e(X)().isPremium ? null : s(D.property)
1245
- }, se({ _: 2 }, [
1246
- D.premium ? {
1247
- name: "append",
1248
- fn: q(() => [
1249
- v(j, { variant: "premium" })
1250
- ]),
1251
- key: "0"
1252
- } : void 0
1253
- ]), 1032, ["model-value", "label", "disabled", "onClick"]))), 128))
1254
- ]),
1255
- _: 1
1256
- }, 8, ["modelValue"]),
1257
- a[6] || (a[6] = C("div", { class: "fm-typo-en-body-lg-400" }, "Check to perform", -1)),
1258
- C("div", at, [
1259
- v(x, {
1260
- class: "w-1/4",
1261
- items: [
1262
- { label: "is", value: !1 },
1263
- { label: "is not", value: !0 }
1264
- ],
1265
- "model-value": e(c).negated ?? !1,
1266
- "onUpdate:modelValue": n
1267
- }, null, 8, ["model-value"]),
1268
- v(x, {
1269
- class: "flex-1",
1270
- items: e(m),
1271
- "model-value": e(E).operator,
1272
- "onUpdate:modelValue": U
1273
- }, null, 8, ["items", "model-value"])
1274
- ]),
1275
- C("div", null, [
1276
- a[4] || (a[4] = C("div", { class: "fm-typo-en-body-lg-400" }, "Criteria", -1)),
1277
- e(E).type ? (r(), k(lt, {
1278
- key: 0,
1279
- type: e(E).type,
1280
- operator: e(E).operator,
1281
- "model-value": e(E).equator,
1282
- "onUpdate:modelValue": g
1283
- }, null, 8, ["type", "operator", "model-value"])) : M("", !0)
1284
- ]),
1285
- C("div", rt, [
1286
- v(G, {
1287
- onClick: a[2] || (a[2] = (D) => e(R).close()),
1288
- label: "Cancel",
1289
- variant: "tertiary"
1290
- }),
1291
- v(G, {
1292
- onClick: a[3] || (a[3] = (D) => w()),
1293
- disabled: e(b).length > 0,
1294
- label: "Save"
1295
- }, null, 8, ["disabled"])
1296
- ])
1297
- ]);
1298
- };
1299
- }
1300
- }), ut = { class: "flex flex-col gap-8" }, st = { class: "grid grid-cols-2 items-center" }, it = { class: "flex items-center gap-8" }, mt = { class: "pt-16 flex items-center self-end gap-8" }, dt = /* @__PURE__ */ A({
1301
- __name: "PresetRuleDialog",
1302
- props: {
1303
- preset: {
1304
- type: String,
1305
- required: !0
1306
- },
1307
- defaultValue: {
1308
- type: Object
1309
- },
1310
- modelValue: {
1311
- type: Object
1312
- }
1313
- },
1314
- setup(o) {
1315
- const R = le(), { emitData: y, emitAction: i } = ie(), l = Q(), d = o;
1316
- function t() {
1317
- const { operator: E, equator: s } = p.value;
1318
- switch (d.preset) {
1319
- case "MIN_SPEND":
1320
- case "SPECIFIC_DATE":
1321
- case "SPECIFIC_TIMERANGE":
1322
- case "WEEKLY":
1323
- case "MONTHLY":
1324
- case "BIRTHDAY":
1325
- case "TIER":
1326
- return `Applies to ${l.sortedTiers.filter((U, g) => E == "_equal" ? g + 1 == s : E == "_moreThanOrEqual" ? g + 1 >= s : g + 1 <= s).map((U) => U.name).join(", ")}`;
1327
- }
1328
- }
1329
- function u() {
1330
- var E, s;
1331
- switch (d.preset) {
1332
- case "MIN_SPEND":
1333
- return O.constructEntry("bill.amount", "_moreThanOrEqual", 0);
1334
- case "SPECIFIC_DATE":
1335
- return O.constructEntry(
1336
- "trigger.date",
1337
- "_isOnDate",
1338
- (/* @__PURE__ */ new Date()).toISOString()
1339
- );
1340
- case "SPECIFIC_TIMERANGE":
1341
- return O.constructEntry("trigger.time", "_isBetweenTime", [
1342
- { start: "00:00", end: "23:59" }
1343
- ]);
1344
- case "WEEKLY":
1345
- return O.constructEntry(
1346
- "trigger.date",
1347
- "_rrule",
1348
- "RRULE:FREQ=WEEKLY;WKST=SU;BYDAY=SU;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
1349
- );
1350
- case "MONTHLY":
1351
- return O.constructEntry(
1352
- "trigger.date",
1353
- "_rrule",
1354
- "RRULE:FREQ=MONTHLY;WKST=SU;BYMONTHDAY=1;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
1355
- );
1356
- case "BIRTHDAY":
1357
- console.log("birthday", d);
1358
- const n = O.constructEntry(
1359
- d.defaultValue.property,
1360
- d.defaultValue.operator,
1361
- d.defaultValue.equator
1362
- );
1363
- return console.log(n), n;
1364
- case "TIER":
1365
- return O.constructEntry("user.tier", "_equal", 1);
1366
- case "TITLE":
1367
- return O.constructEntry("user.titles", "_hasAny", [
1368
- (s = (E = l.sortedTitles) == null ? void 0 : E[0]) == null ? void 0 : s._id
1369
- ]);
1370
- case "LAST_X_DAY":
1371
- return O.constructEntry("user.stats.lastVisit", "_isRange", {
1372
- op: "last",
1373
- unit: "day",
1374
- ignoreYear: !0,
1375
- x: 0
1376
- });
1377
- case "CUSTOM":
1378
- throw new Error("Not implemented");
1379
- }
1380
- }
1381
- const m = $(u()), p = I(() => {
1382
- const E = O.simplify(m.value);
1383
- return {
1384
- ...E,
1385
- equator: E.equator
1386
- };
1387
- });
1388
- function b(E, s) {
1389
- const n = p.value;
1390
- m.value = O.constructEntry(
1391
- n.property,
1392
- s ?? n.operator,
1393
- E,
1394
- m.value.name
1395
- );
1396
- }
1397
- function f() {
1398
- y(m.value), i("primary"), R.close();
1399
- }
1400
- const c = I(() => {
1401
- const E = fe.safeParse(m.value);
1402
- return E.success ? [] : E.error.errors;
1403
- });
1404
- return ue(async () => {
1405
- await l.readMembership();
1406
- }), (E, s) => {
1407
- var j, _, K, G, D;
1408
- const n = V("FmStepperField"), U = V("FmDatePicker"), g = V("FmTimeRangePicker"), w = V("FmRadio"), F = V("FmSelect"), a = V("FmRadioGroup"), B = V("FmHelperText"), P = V("FmButton");
1409
- return r(), S("div", ut, [
1410
- o.preset == "MIN_SPEND" ? (r(), k(n, {
1411
- key: 0,
1412
- label: "Minimum spend",
1413
- "model-value": e(p).equator,
1414
- "onUpdate:modelValue": s[0] || (s[0] = (T) => b(T))
1415
- }, null, 8, ["model-value"])) : M("", !0),
1416
- o.preset == "LAST_X_DAY" ? (r(), k(n, {
1417
- key: 1,
1418
- label: "",
1419
- min: 0,
1420
- prepent: "Day(s)",
1421
- "model-value": e(p).equator.x,
1422
- rules: [(T) => T >= 0 || "Value must be greater than 0"],
1423
- "onUpdate:modelValue": s[1] || (s[1] = (T) => b({
1424
- op: "last",
1425
- unit: "day",
1426
- ignoreYear: !0,
1427
- x: T
1428
- }))
1429
- }, null, 8, ["model-value", "rules"])) : o.preset == "SPECIFIC_DATE" ? (r(), k(U, {
1430
- key: 2,
1431
- label: "Specific Date",
1432
- "model-value": e(p).equator,
1433
- "onUpdate:modelValue": s[2] || (s[2] = (T) => b(T))
1434
- }, null, 8, ["model-value"])) : o.preset == "SPECIFIC_TIMERANGE" ? (r(), k(g, {
1435
- key: 3,
1436
- label: "Time is between",
1437
- "disable-time-check": !0,
1438
- "model-value": [(_ = (j = e(p).equator) == null ? void 0 : j[0]) == null ? void 0 : _.start, (G = (K = e(p).equator) == null ? void 0 : K[0]) == null ? void 0 : G.end],
1439
- "onUpdate:modelValue": s[3] || (s[3] = (T) => b([
1440
- {
1441
- start: T[0],
1442
- end: T[1]
1443
- }
1444
- ]))
1445
- }, null, 8, ["model-value"])) : o.preset == "WEEKLY" ? (r(), k(ee, {
1446
- key: 4,
1447
- label: "Weekly",
1448
- "fixed-frequency": !0,
1449
- "model-value": e(p).equator,
1450
- "onUpdate:modelValue": s[4] || (s[4] = (T) => b(T))
1451
- }, null, 8, ["model-value"])) : o.preset == "MONTHLY" ? (r(), k(ee, {
1452
- key: 5,
1453
- label: "Weekly",
1454
- "fixed-frequency": !0,
1455
- "model-value": e(p).equator,
1456
- "onUpdate:modelValue": s[5] || (s[5] = (T) => b(T))
1457
- }, null, 8, ["model-value"])) : o.preset == "BIRTHDAY" ? (r(), S(h, { key: 6 }, [
1458
- C("div", st, [
1459
- v(w, {
1460
- label: "N days before birthday",
1461
- value: "_isDay",
1462
- "model-value": e(p).operator,
1463
- "onUpdate:modelValue": s[6] || (s[6] = () => {
1464
- b(
1465
- {
1466
- op: "after",
1467
- x: 1,
1468
- ignoreYear: !0
1469
- },
1470
- "_isDay"
1471
- );
1472
- })
1473
- }, null, 8, ["model-value"]),
1474
- C("div", it, [
1475
- v(w, {
1476
- label: "Is in this",
1477
- value: "_isRange",
1478
- "model-value": e(p).operator,
1479
- "onUpdate:modelValue": s[7] || (s[7] = () => {
1480
- b(
1481
- {
1482
- op: "this",
1483
- unit: "day",
1484
- ignoreYear: !0
1485
- },
1486
- "_isRange"
1487
- );
1488
- })
1489
- }, null, 8, ["model-value"]),
1490
- e(p).operator == "_isRange" ? (r(), k(F, {
1491
- key: 0,
1492
- items: ["day", "week", "month"].map((T) => ({ label: T, value: T })),
1493
- "model-value": e(p).equator.unit,
1494
- "onUpdate:modelValue": s[8] || (s[8] = (T) => b(
1495
- {
1496
- op: "this",
1497
- unit: T,
1498
- ignoreYear: !0
1499
- },
1500
- "_isRange"
1501
- ))
1502
- }, null, 8, ["items", "model-value"])) : M("", !0)
1503
- ])
1504
- ]),
1505
- e(p).operator == "_isDay" ? (r(), k(n, {
1506
- key: 0,
1507
- label: "Days before birthday",
1508
- "show-steppers": !1,
1509
- "model-value": e(p).equator.x,
1510
- "onUpdate:modelValue": s[9] || (s[9] = (T) => b({
1511
- op: "after",
1512
- x: T,
1513
- ignoreYear: !0
1514
- }))
1515
- }, null, 8, ["model-value"])) : M("", !0)
1516
- ], 64)) : o.preset == "TIER" ? (r(), S(h, { key: 7 }, [
1517
- v(a, {
1518
- inline: !0,
1519
- "model-value": e(p).operator,
1520
- "onUpdate:modelValue": s[10] || (s[10] = (T) => b(e(p).equator, T))
1521
- }, {
1522
- default: q(() => [
1523
- v(w, {
1524
- value: "_moreThanOrEqual",
1525
- label: "At least"
1526
- }),
1527
- v(w, {
1528
- value: "_equal",
1529
- label: "Equal"
1530
- }),
1531
- v(w, {
1532
- value: "_lessThanOrEqual",
1533
- label: "At most"
1534
- })
1535
- ]),
1536
- _: 1
1537
- }, 8, ["model-value"]),
1538
- v(x, {
1539
- items: (e(l).sortedTiers ?? []).map((T, oe) => ({
1540
- label: `Tier ${oe + 1} - ${T.name}`,
1541
- value: oe + 1
1542
- })),
1543
- "model-value": e(p).equator,
1544
- "onUpdate:modelValue": s[11] || (s[11] = (T) => b(T))
1545
- }, null, 8, ["items", "model-value"]),
1546
- v(B, {
1547
- text: t()
1548
- }, null, 8, ["text"])
1549
- ], 64)) : o.preset == "TITLE" ? (r(), k(x, {
1550
- key: 8,
1551
- label: "User has title",
1552
- items: (e(l).sortedTitles ?? []).map((T) => ({
1553
- label: T.name,
1554
- value: T._id
1555
- })),
1556
- "model-value": (D = e(p).equator) == null ? void 0 : D[0],
1557
- "onUpdate:modelValue": s[12] || (s[12] = (T) => b([T]))
1558
- }, null, 8, ["items", "model-value"])) : M("", !0),
1559
- v(B, {
1560
- class: "mt-[-8px]",
1561
- text: e(Z).helperText(e(c), ""),
1562
- state: e(Z).helperState(e(c), "")
1563
- }, null, 8, ["text", "state"]),
1564
- C("div", mt, [
1565
- v(P, {
1566
- onClick: s[13] || (s[13] = (T) => e(R).close()),
1567
- label: "Cancel",
1568
- variant: "tertiary"
1569
- }),
1570
- v(P, {
1571
- onClick: s[14] || (s[14] = (T) => f()),
1572
- disabled: e(c).length > 0,
1573
- label: "Save"
1574
- }, null, 8, ["disabled"])
1575
- ])
1576
- ]);
1577
- };
1578
- }
1579
- }), pt = /* @__PURE__ */ A({
1580
- __name: "RuleConfigurator",
1581
- props: {
1582
- triggerType: {
1583
- type: String,
1584
- required: !0
1585
- },
1586
- includeOnly: {
1587
- type: String
1588
- },
1589
- modelValue: {
1590
- type: Object,
1591
- default: () => {
1592
- }
1593
- }
1594
- },
1595
- emits: ["update:model-value"],
1596
- setup(o, { expose: R, emit: y }) {
1597
- const i = X(), l = o, d = y, t = le(), u = $();
1598
- function m(f) {
1599
- const [c] = f.rules;
1600
- t.open({
1601
- title: f.name,
1602
- closeButton: !1,
1603
- dismissAway: !1,
1604
- contentComponent: dt,
1605
- contentComponentProps: {
1606
- preset: f.type,
1607
- defaultValue: c,
1608
- modelValue: l.modelValue
1609
- }
1610
- }).onPrimary((E) => d("update:model-value", E));
1611
- }
1612
- function p(f) {
1613
- t.open({
1614
- title: "Edit rule",
1615
- closeButton: !1,
1616
- dismissAway: !1,
1617
- contentComponent: nt,
1618
- contentComponentProps: {
1619
- triggerType: l.triggerType,
1620
- includeOnly: l.includeOnly,
1621
- modelValue: f
1622
- }
1623
- }).onPrimary((c) => d("update:model-value", c));
1624
- }
1625
- function b(f) {
1626
- if (f.type == "CUSTOM") {
1627
- const [c] = f.rules;
1628
- return p(
1629
- O.constructEntry(c.property, c.operator, c.equator)
1630
- );
1631
- }
1632
- return m(f);
1633
- }
1634
- return R({
1635
- showCustomDialog: p
1636
- }), (f, c) => {
1637
- const E = V("FmButton"), s = V("FmPill"), n = V("FmMenuItem"), U = V("FmMenu");
1638
- return r(), k(U, {
1639
- shift: !0,
1640
- placement: "top-start"
1641
- }, {
1642
- "menu-button": q(() => [
1643
- v(E, {
1644
- label: "Add condition",
1645
- icon: "add",
1646
- class: "text-fm-color-primary border-fm-color-primary",
1647
- "icon-color": "primary",
1648
- variant: "secondary"
1649
- })
1650
- ]),
1651
- default: q(() => [
1652
- (r(!0), S(h, null, N(e(xe).filter(
1653
- (g) => !o.includeOnly || g.for.includes(o.includeOnly)
1654
- ), (g) => (r(), k(n, {
1655
- key: g.name,
1656
- "model-value": g.name == e(u),
1657
- label: g.name,
1658
- onClick: () => {
1659
- g != null && g.premium && !e(i).isPremium || b(g);
1660
- },
1661
- disabled: (g == null ? void 0 : g.premium) && !e(i).isPremium
1662
- }, se({ _: 2 }, [
1663
- g != null && g.premium ? {
1664
- name: "append",
1665
- fn: q(() => [
1666
- v(s, { variant: "premium" })
1667
- ]),
1668
- key: "0"
1669
- } : void 0
1670
- ]), 1032, ["model-value", "label", "onClick", "disabled"]))), 128))
1671
- ]),
1672
- _: 1
1673
- });
1674
- };
1675
- }
1676
- }), wt = /* @__PURE__ */ A({
1677
- __name: "RuleGroup",
1678
- props: {
1679
- triggerType: {
1680
- type: String,
1681
- required: !0
1682
- },
1683
- includeOnly: {
1684
- type: String
1685
- },
1686
- modelValue: {
1687
- type: Object
1688
- }
1689
- },
1690
- emits: ["update:model-value"],
1691
- setup(o, { emit: R }) {
1692
- const y = o, i = R, l = I(
1693
- () => y.modelValue ?? O.scaffoldGroup()
1694
- ), d = I(() => O.getLogic(l.value)), t = $();
1695
- return (u, m) => {
1696
- const p = V("FmButtonGroup"), b = V("FmCard");
1697
- return r(), k(b, { variant: "outlined" }, {
1698
- default: q(() => [
1699
- v(b, { class: "border-l-4 border-fm-color-primary p-16 space-y-16" }, {
1700
- default: q(() => [
1701
- m[3] || (m[3] = C("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " When ", -1)),
1702
- v(pt, {
1703
- ref_key: "configuratorRef",
1704
- ref: t,
1705
- "include-only": o.includeOnly,
1706
- "trigger-type": o.triggerType,
1707
- "onUpdate:modelValue": m[0] || (m[0] = (f) => i("update:model-value", e(O).setRuleToGroup(e(l), f)))
1708
- }, null, 8, ["include-only", "trigger-type"]),
1709
- (r(!0), S(h, null, N(e(l).rules, (f, c) => {
1710
- var E;
1711
- return r(), S(h, null, [
1712
- e(ge)(f) ? (r(), k(Ce, {
1713
- "model-value": f,
1714
- key: c,
1715
- onEdit: (E = e(t)) == null ? void 0 : E.showCustomDialog,
1716
- onRemove: m[1] || (m[1] = (s) => {
1717
- i(
1718
- "update:model-value",
1719
- e(O).removeEntry(e(l), s.name)
1720
- );
1721
- })
1722
- }, null, 8, ["model-value", "onEdit"])) : M("", !0),
1723
- v(p, {
1724
- class: "w-[200px]",
1725
- disabled: Object.keys(e(l).rules).length < 2,
1726
- items: [{ label: "And" }, { label: "Or" }],
1727
- "model-value": e(d) === "&&" ? { label: "And" } : { label: "Or" },
1728
- "onUpdate:modelValue": m[2] || (m[2] = (s) => i(
1729
- "update:model-value",
1730
- e(O).setRuleToGroup(
1731
- e(l),
1732
- [],
1733
- s.label === "And" ? "&&" : "||"
1734
- )
1735
- ))
1736
- }, null, 8, ["disabled", "model-value"])
1737
- ], 64);
1738
- }), 256))
1739
- ]),
1740
- _: 1
1741
- })
1742
- ]),
1743
- _: 1
1744
- });
1745
- };
1746
- }
1747
- });
1748
- export {
1749
- wt as _,
1750
- ee as a
1751
- };