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