@feedmepos/mf-connect 0.1.37-prod → 0.1.38-beta.10

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