@commercelayer/app-elements 6.0.1 → 6.0.3
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/{InputDateComponent-CRYU-ypz.js → InputDateComponent-BT5dGoyh.js} +83 -83
- package/dist/{RuleEngineComponent-CtAd-_XC.js → RuleEngineComponent-CP1fRsbv.js} +619 -460
- package/dist/helpers/currencies.d.ts +155 -0
- package/dist/{main-os-TPFjB.js → main-CuXYh6yM.js} +7813 -7292
- package/dist/main.js +166 -166
- package/dist/{parseISO-B-vBXvVj.js → parseISO-Ccxkiq7f.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/tailwind.global.css +4 -4
- package/dist/ui/forms/CodeEditor/CodeEditorComponent.d.ts +3 -2
- package/dist/ui/forms/InputSelect/overrides.d.ts +3 -1
- package/dist/ui/forms/RuleEngine/RuleEngineComponent.d.ts +7 -5
- package/dist/ui/forms/RuleEngine/RuleEngineContext.d.ts +8 -4
- package/dist/ui/forms/RuleEngine/utils.d.ts +9 -6
- package/dist/vendor.css +1 -1
- package/package.json +1 -1
|
@@ -1,58 +1,174 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { t as
|
|
3
|
-
import
|
|
2
|
+
import { t as A, B as ee, D as ae, E as te, I as se, N as ne, O as le, P as re, Z as E, b as ie, d as oe, e as ue, f as ce, g as de, h as me, i as fe, j as pe, k as ye, l as Z, n as ge, o as be, p as he, q as xe, r as ve, s as je, u as Te, v as Ne, w as we, x as _e, y as $e, z as Ce, A as Ve, C as Ee, F as Se, G as Re, H as Ie, J as Ae, K as Ze, L as ke, M as Me, Q as De, R as qe, S as Oe, T as ze, U as Fe, V as Le, W as Ue, X as Je, Y as Ke, _ as Pe, $ as Be, a0 as Ye, a1 as We, a2 as Xe, a3 as He, a4 as Ge, a5 as Qe, a6 as ea, a7 as aa, a8 as ta, a9 as k, aa as sa, ab as na, ac as la, ad as ra, ae as ia, af as oa, ag as ua, ah as ca, ai as da, aj as ma, ak as fa, al as pa, am as ya, an as ga, ao as ba, ap as ha, aq as xa, ar as va, as as ja, at as Ta, au as Na, av as wa, aw as _a, ax as $a, ay as Ca, az as Va, aA as Ea, aB as Sa, aC as Ra, aD as Ia, aE as Aa, aF as Za, aG as ka, aH as Ma, aI as Da, aJ as qa, aK as Oa, aL as za, aM as Fa, aN as La, aO as Ua, aP as Ja, aQ as Ka, aR as Pa, aS as Ba, aT as e, aU as S, aV as Ya, aW as R, aX as p, aY as v, aZ as C, a_ as K, a$ as I, b0 as h, b1 as P, b2 as Wa, b3 as w, b4 as B, b5 as Y, b6 as W, b7 as Xa, b8 as Ha, b9 as Ga, ba as _, bb as Qa, bc as et, bd as at } from "./main-CuXYh6yM.js";
|
|
3
|
+
import M, { useReducer as tt, useCallback as N, useMemo as st, createContext as nt, useContext as lt, useState as f, useEffect as j, useRef as rt } from "react";
|
|
4
4
|
import "react-hook-form";
|
|
5
|
-
import { p as
|
|
6
|
-
function
|
|
7
|
-
const
|
|
5
|
+
import { p as D } from "./parseISO-Ccxkiq7f.js";
|
|
6
|
+
function q(a, t) {
|
|
7
|
+
const s = a.match(
|
|
8
8
|
/(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2}):(\d{2})(?:\.(\d{0,7}))?(?:Z|(.)(\d{2}):?(\d{2})?)?/
|
|
9
9
|
);
|
|
10
|
-
return
|
|
10
|
+
return s ? A(
|
|
11
11
|
Date.UTC(
|
|
12
|
-
+
|
|
13
|
-
+
|
|
14
|
-
+
|
|
15
|
-
+
|
|
16
|
-
+
|
|
17
|
-
+
|
|
18
|
-
+((
|
|
12
|
+
+s[1],
|
|
13
|
+
+s[2] - 1,
|
|
14
|
+
+s[3],
|
|
15
|
+
+s[4] - (+s[9] || 0) * (s[8] == "-" ? -1 : 1),
|
|
16
|
+
+s[5] - (+s[10] || 0) * (s[8] == "-" ? -1 : 1),
|
|
17
|
+
+s[6],
|
|
18
|
+
+((s[7] || "0") + "00").substring(0, 3)
|
|
19
19
|
),
|
|
20
|
-
|
|
21
|
-
) :
|
|
20
|
+
t?.in
|
|
21
|
+
) : A(NaN, t?.in);
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
const y = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
24
|
+
__proto__: null,
|
|
25
|
+
BRAND: ee,
|
|
26
|
+
DIRTY: ae,
|
|
27
|
+
EMPTY_PATH: te,
|
|
28
|
+
INVALID: se,
|
|
29
|
+
NEVER: ne,
|
|
30
|
+
OK: le,
|
|
31
|
+
ParseStatus: re,
|
|
32
|
+
Schema: E,
|
|
33
|
+
ZodAny: ie,
|
|
34
|
+
ZodArray: oe,
|
|
35
|
+
ZodBigInt: ue,
|
|
36
|
+
ZodBoolean: ce,
|
|
37
|
+
ZodBranded: de,
|
|
38
|
+
ZodCatch: me,
|
|
39
|
+
ZodDate: fe,
|
|
40
|
+
ZodDefault: pe,
|
|
41
|
+
ZodDiscriminatedUnion: ye,
|
|
42
|
+
ZodEffects: Z,
|
|
43
|
+
ZodEnum: ge,
|
|
44
|
+
ZodError: be,
|
|
45
|
+
get ZodFirstPartyTypeKind() {
|
|
46
|
+
return he;
|
|
47
|
+
},
|
|
48
|
+
ZodFunction: xe,
|
|
49
|
+
ZodIntersection: ve,
|
|
50
|
+
ZodIssueCode: je,
|
|
51
|
+
ZodLazy: Te,
|
|
52
|
+
ZodLiteral: Ne,
|
|
53
|
+
ZodMap: we,
|
|
54
|
+
ZodNaN: _e,
|
|
55
|
+
ZodNativeEnum: $e,
|
|
56
|
+
ZodNever: Ce,
|
|
57
|
+
ZodNull: Ve,
|
|
58
|
+
ZodNullable: Ee,
|
|
59
|
+
ZodNumber: Se,
|
|
60
|
+
ZodObject: Re,
|
|
61
|
+
ZodOptional: Ie,
|
|
62
|
+
ZodParsedType: Ae,
|
|
63
|
+
ZodPipeline: Ze,
|
|
64
|
+
ZodPromise: ke,
|
|
65
|
+
ZodReadonly: Me,
|
|
66
|
+
ZodRecord: De,
|
|
67
|
+
ZodSchema: E,
|
|
68
|
+
ZodSet: qe,
|
|
69
|
+
ZodString: Oe,
|
|
70
|
+
ZodSymbol: ze,
|
|
71
|
+
ZodTransformer: Z,
|
|
72
|
+
ZodTuple: Fe,
|
|
73
|
+
ZodType: E,
|
|
74
|
+
ZodUndefined: Le,
|
|
75
|
+
ZodUnion: Ue,
|
|
76
|
+
ZodUnknown: Je,
|
|
77
|
+
ZodVoid: Ke,
|
|
78
|
+
addIssueToContext: Pe,
|
|
79
|
+
any: Be,
|
|
80
|
+
array: Ye,
|
|
81
|
+
bigint: We,
|
|
82
|
+
boolean: Xe,
|
|
83
|
+
coerce: He,
|
|
84
|
+
custom: Ge,
|
|
85
|
+
date: Qe,
|
|
86
|
+
datetimeRegex: ea,
|
|
87
|
+
defaultErrorMap: aa,
|
|
88
|
+
discriminatedUnion: ta,
|
|
89
|
+
effect: k,
|
|
90
|
+
enum: sa,
|
|
91
|
+
function: na,
|
|
92
|
+
getErrorMap: la,
|
|
93
|
+
getParsedType: ra,
|
|
94
|
+
instanceof: ia,
|
|
95
|
+
intersection: oa,
|
|
96
|
+
isAborted: ua,
|
|
97
|
+
isAsync: ca,
|
|
98
|
+
isDirty: da,
|
|
99
|
+
isValid: ma,
|
|
100
|
+
late: fa,
|
|
101
|
+
lazy: pa,
|
|
102
|
+
literal: ya,
|
|
103
|
+
makeIssue: ga,
|
|
104
|
+
map: ba,
|
|
105
|
+
nan: ha,
|
|
106
|
+
nativeEnum: xa,
|
|
107
|
+
never: va,
|
|
108
|
+
null: ja,
|
|
109
|
+
nullable: Ta,
|
|
110
|
+
number: Na,
|
|
111
|
+
object: wa,
|
|
112
|
+
get objectUtil() {
|
|
113
|
+
return _a;
|
|
114
|
+
},
|
|
115
|
+
oboolean: $a,
|
|
116
|
+
onumber: Ca,
|
|
117
|
+
optional: Va,
|
|
118
|
+
ostring: Ea,
|
|
119
|
+
pipeline: Sa,
|
|
120
|
+
preprocess: Ra,
|
|
121
|
+
promise: Ia,
|
|
122
|
+
quotelessJson: Aa,
|
|
123
|
+
record: Za,
|
|
124
|
+
set: ka,
|
|
125
|
+
setErrorMap: Ma,
|
|
126
|
+
strictObject: Da,
|
|
127
|
+
string: qa,
|
|
128
|
+
symbol: Oa,
|
|
129
|
+
transformer: k,
|
|
130
|
+
tuple: za,
|
|
131
|
+
undefined: Fa,
|
|
132
|
+
union: La,
|
|
133
|
+
unknown: Ua,
|
|
134
|
+
get util() {
|
|
135
|
+
return Ja;
|
|
136
|
+
},
|
|
137
|
+
void: Ka
|
|
138
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
139
|
+
function O(a, t, s) {
|
|
140
|
+
return a == null ? a : Pa(a, t, s);
|
|
25
141
|
}
|
|
26
|
-
function
|
|
27
|
-
return
|
|
142
|
+
function z(a, t) {
|
|
143
|
+
return a == null ? !0 : Ba(a, t);
|
|
28
144
|
}
|
|
29
|
-
const
|
|
145
|
+
const X = nt(
|
|
30
146
|
void 0
|
|
31
147
|
);
|
|
32
|
-
function
|
|
33
|
-
switch (
|
|
148
|
+
function it(a, t) {
|
|
149
|
+
switch (t.type) {
|
|
34
150
|
case "SET_PATH": {
|
|
35
|
-
const
|
|
36
|
-
if (
|
|
37
|
-
if (/\.\d+$/.test(
|
|
38
|
-
const r =
|
|
39
|
-
Array.isArray(
|
|
151
|
+
const s = { ...a.value };
|
|
152
|
+
if (t.value === null)
|
|
153
|
+
if (/\.\d+$/.test(t.path)) {
|
|
154
|
+
const r = t.path.replace(/\.\d+$/, ""), o = parseInt(t.path.match(/\d+$/)?.[0] ?? "0", 10), l = Ya(s, r);
|
|
155
|
+
Array.isArray(l) && (l.splice(o, 1), O(s, r, l), l.length === 0 && r.endsWith(".nested.conditions") && z(s, r.replace(/\.conditions$/, "")));
|
|
40
156
|
} else
|
|
41
|
-
|
|
157
|
+
z(s, t.path);
|
|
42
158
|
else
|
|
43
|
-
|
|
159
|
+
O(s, t.path, t.value);
|
|
44
160
|
return {
|
|
45
|
-
...
|
|
46
|
-
value:
|
|
161
|
+
...a,
|
|
162
|
+
value: s
|
|
47
163
|
};
|
|
48
164
|
}
|
|
49
165
|
case "SET_SELECTED_RULE_INDEX":
|
|
50
166
|
return {
|
|
51
|
-
...
|
|
52
|
-
selectedRuleIndex:
|
|
167
|
+
...a,
|
|
168
|
+
selectedRuleIndex: t.index
|
|
53
169
|
};
|
|
54
170
|
case "SET_VALUE":
|
|
55
|
-
return
|
|
171
|
+
return S(a.value, t.value) ? a : t.value.rules.length === 0 ? {
|
|
56
172
|
selectedRuleIndex: 0,
|
|
57
173
|
value: {
|
|
58
174
|
rules: [
|
|
@@ -66,87 +182,85 @@ function de(t, n) {
|
|
|
66
182
|
]
|
|
67
183
|
}
|
|
68
184
|
} : {
|
|
69
|
-
...
|
|
70
|
-
value:
|
|
185
|
+
...a,
|
|
186
|
+
value: t.value
|
|
71
187
|
};
|
|
72
188
|
default:
|
|
73
|
-
return
|
|
189
|
+
return a;
|
|
74
190
|
}
|
|
75
191
|
}
|
|
76
|
-
function
|
|
77
|
-
children:
|
|
78
|
-
initialValue:
|
|
192
|
+
function ot({
|
|
193
|
+
children: a,
|
|
194
|
+
initialValue: t
|
|
79
195
|
}) {
|
|
80
|
-
const [
|
|
81
|
-
value:
|
|
196
|
+
const [s, r] = tt(it, {
|
|
197
|
+
value: t.value,
|
|
82
198
|
selectedRuleIndex: 0
|
|
83
|
-
}),
|
|
84
|
-
r({ type: "SET_PATH", path:
|
|
85
|
-
}, []),
|
|
86
|
-
r({ type: "SET_SELECTED_RULE_INDEX", index:
|
|
87
|
-
}, []),
|
|
88
|
-
r({ type: "SET_VALUE", value:
|
|
89
|
-
}, []), i =
|
|
199
|
+
}), o = N((c, u) => {
|
|
200
|
+
r({ type: "SET_PATH", path: c, value: u });
|
|
201
|
+
}, []), l = N((c) => {
|
|
202
|
+
r({ type: "SET_SELECTED_RULE_INDEX", index: c });
|
|
203
|
+
}, []), n = N((c) => {
|
|
204
|
+
r({ type: "SET_VALUE", value: c });
|
|
205
|
+
}, []), i = st(
|
|
90
206
|
() => ({
|
|
91
|
-
state:
|
|
92
|
-
setPath:
|
|
93
|
-
setSelectedRuleIndex:
|
|
94
|
-
setValue:
|
|
207
|
+
state: s,
|
|
208
|
+
setPath: o,
|
|
209
|
+
setSelectedRuleIndex: l,
|
|
210
|
+
setValue: n,
|
|
211
|
+
availableActionTypes: t.availableActionTypes
|
|
95
212
|
}),
|
|
96
|
-
[
|
|
213
|
+
[
|
|
214
|
+
s,
|
|
215
|
+
o,
|
|
216
|
+
l,
|
|
217
|
+
n,
|
|
218
|
+
t.availableActionTypes
|
|
219
|
+
]
|
|
97
220
|
);
|
|
98
|
-
return /* @__PURE__ */ e.jsx(
|
|
221
|
+
return /* @__PURE__ */ e.jsx(X.Provider, { value: i, children: a });
|
|
99
222
|
}
|
|
100
|
-
function
|
|
101
|
-
const
|
|
102
|
-
if (
|
|
223
|
+
function g() {
|
|
224
|
+
const a = lt(X);
|
|
225
|
+
if (a === void 0)
|
|
103
226
|
throw new Error("useRuleEngine must be used within a RuleEngineProvider");
|
|
104
|
-
return
|
|
105
|
-
}
|
|
106
|
-
const W = Q([
|
|
107
|
-
"blank",
|
|
108
|
-
"present",
|
|
109
|
-
"null",
|
|
110
|
-
"not_null"
|
|
111
|
-
]);
|
|
112
|
-
function E(t) {
|
|
113
|
-
return null;
|
|
227
|
+
return a;
|
|
114
228
|
}
|
|
115
|
-
function
|
|
116
|
-
item:
|
|
117
|
-
pathPrefix:
|
|
229
|
+
function ut({
|
|
230
|
+
item: a,
|
|
231
|
+
pathPrefix: t
|
|
118
232
|
}) {
|
|
119
|
-
const { setPath:
|
|
120
|
-
if (
|
|
233
|
+
const { setPath: s } = g();
|
|
234
|
+
if (a == null)
|
|
121
235
|
return null;
|
|
122
|
-
switch (
|
|
236
|
+
switch (a.type) {
|
|
123
237
|
case "buy_x_pay_y":
|
|
124
238
|
return /* @__PURE__ */ e.jsxs("div", { className: "w-36 flex items-center gap-0.5", children: [
|
|
125
239
|
/* @__PURE__ */ e.jsx(
|
|
126
|
-
|
|
240
|
+
p,
|
|
127
241
|
{
|
|
128
|
-
name: `${
|
|
242
|
+
name: `${t}.value.x`,
|
|
129
243
|
type: "number",
|
|
130
244
|
suffix: "X",
|
|
131
|
-
defaultValue:
|
|
245
|
+
defaultValue: a.value?.x,
|
|
132
246
|
onChange: (r) => {
|
|
133
|
-
|
|
134
|
-
`${
|
|
247
|
+
s(
|
|
248
|
+
`${t}.value.x`,
|
|
135
249
|
parseInt(r.currentTarget.value, 10)
|
|
136
250
|
);
|
|
137
251
|
}
|
|
138
252
|
}
|
|
139
253
|
),
|
|
140
254
|
/* @__PURE__ */ e.jsx(
|
|
141
|
-
|
|
255
|
+
p,
|
|
142
256
|
{
|
|
143
|
-
name: `${
|
|
257
|
+
name: `${t}.value.y`,
|
|
144
258
|
type: "number",
|
|
145
259
|
suffix: "Y",
|
|
146
|
-
defaultValue:
|
|
260
|
+
defaultValue: a.value?.y,
|
|
147
261
|
onChange: (r) => {
|
|
148
|
-
|
|
149
|
-
`${
|
|
262
|
+
s(
|
|
263
|
+
`${t}.value.y`,
|
|
150
264
|
parseInt(r.currentTarget.value, 10)
|
|
151
265
|
);
|
|
152
266
|
}
|
|
@@ -156,30 +270,30 @@ function fe({
|
|
|
156
270
|
case "every_x_discount_y":
|
|
157
271
|
return /* @__PURE__ */ e.jsxs("div", { className: "w-36 flex items-center gap-0.5", children: [
|
|
158
272
|
/* @__PURE__ */ e.jsx(
|
|
159
|
-
|
|
273
|
+
p,
|
|
160
274
|
{
|
|
161
|
-
name: `${
|
|
275
|
+
name: `${t}.value.x`,
|
|
162
276
|
type: "number",
|
|
163
277
|
suffix: "X",
|
|
164
|
-
defaultValue:
|
|
278
|
+
defaultValue: a.value?.x,
|
|
165
279
|
onChange: (r) => {
|
|
166
|
-
|
|
167
|
-
`${
|
|
280
|
+
s(
|
|
281
|
+
`${t}.value.x`,
|
|
168
282
|
parseInt(r.currentTarget.value, 10)
|
|
169
283
|
);
|
|
170
284
|
}
|
|
171
285
|
}
|
|
172
286
|
),
|
|
173
287
|
/* @__PURE__ */ e.jsx(
|
|
174
|
-
|
|
288
|
+
p,
|
|
175
289
|
{
|
|
176
|
-
name: `${
|
|
290
|
+
name: `${t}.value.y`,
|
|
177
291
|
type: "number",
|
|
178
292
|
suffix: "Y",
|
|
179
|
-
defaultValue:
|
|
293
|
+
defaultValue: a.value?.y,
|
|
180
294
|
onChange: (r) => {
|
|
181
|
-
|
|
182
|
-
`${
|
|
295
|
+
s(
|
|
296
|
+
`${t}.value.y`,
|
|
183
297
|
parseInt(r.currentTarget.value, 10)
|
|
184
298
|
);
|
|
185
299
|
}
|
|
@@ -189,94 +303,96 @@ function fe({
|
|
|
189
303
|
case "fixed_amount":
|
|
190
304
|
case "fixed_price":
|
|
191
305
|
return /* @__PURE__ */ e.jsx("div", { className: "w-36", children: /* @__PURE__ */ e.jsx(
|
|
192
|
-
|
|
306
|
+
p,
|
|
193
307
|
{
|
|
194
|
-
name: `${
|
|
308
|
+
name: `${t}.value`,
|
|
195
309
|
type: "number",
|
|
196
|
-
defaultValue:
|
|
310
|
+
defaultValue: a.value,
|
|
197
311
|
min: 0,
|
|
198
312
|
suffix: "cents",
|
|
199
313
|
onChange: (r) => {
|
|
200
|
-
|
|
201
|
-
`${
|
|
314
|
+
s(
|
|
315
|
+
`${t}.value`,
|
|
202
316
|
parseInt(r.currentTarget.value, 10)
|
|
203
317
|
);
|
|
204
318
|
}
|
|
205
319
|
}
|
|
206
320
|
) });
|
|
207
321
|
case "percentage": {
|
|
208
|
-
const r = (
|
|
322
|
+
const r = (a.value * 100).toFixed(2);
|
|
209
323
|
return /* @__PURE__ */ e.jsx("div", { className: "w-24", children: /* @__PURE__ */ e.jsx(
|
|
210
|
-
|
|
324
|
+
p,
|
|
211
325
|
{
|
|
212
|
-
name: `${
|
|
326
|
+
name: `${t}.value`,
|
|
213
327
|
type: "number",
|
|
214
328
|
defaultValue: r.endsWith(".00") ? r.slice(0, -3) : r,
|
|
215
329
|
min: 0,
|
|
216
330
|
max: 100,
|
|
217
331
|
suffix: "%",
|
|
218
|
-
onChange: (
|
|
219
|
-
|
|
220
|
-
`${
|
|
221
|
-
parseFloat(
|
|
332
|
+
onChange: (o) => {
|
|
333
|
+
s(
|
|
334
|
+
`${t}.value`,
|
|
335
|
+
parseFloat(o.currentTarget.value) / 100
|
|
222
336
|
);
|
|
223
337
|
}
|
|
224
338
|
}
|
|
225
339
|
) });
|
|
226
340
|
}
|
|
227
341
|
default:
|
|
228
|
-
return
|
|
342
|
+
return R();
|
|
229
343
|
}
|
|
230
344
|
}
|
|
231
|
-
function
|
|
232
|
-
item:
|
|
233
|
-
index:
|
|
234
|
-
onDelete:
|
|
345
|
+
function ct({
|
|
346
|
+
item: a,
|
|
347
|
+
index: t,
|
|
348
|
+
onDelete: s
|
|
235
349
|
}) {
|
|
236
350
|
const {
|
|
237
351
|
setPath: r,
|
|
238
|
-
state: { selectedRuleIndex:
|
|
239
|
-
|
|
352
|
+
state: { selectedRuleIndex: o },
|
|
353
|
+
availableActionTypes: l
|
|
354
|
+
} = g(), n = {
|
|
240
355
|
percentage: "Percentage discount",
|
|
241
356
|
fixed_amount: "Fixed amount",
|
|
242
357
|
fixed_price: "Fixed price",
|
|
243
358
|
buy_x_pay_y: "Buy X, Pay Y",
|
|
244
359
|
every_x_discount_y: "Every X, Discount Y"
|
|
245
|
-
},
|
|
360
|
+
}, i = `rules.${o}.actions.${t}`;
|
|
246
361
|
return /* @__PURE__ */ e.jsx("div", { className: "mb-4 last:mb-0", children: /* @__PURE__ */ e.jsxs("div", { className: "bg-gray-50 rounded-md flex items-center", children: [
|
|
247
362
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between gap-2 grow p-2", children: [
|
|
248
363
|
/* @__PURE__ */ e.jsx("div", { className: "flex-1", children: /* @__PURE__ */ e.jsx(
|
|
249
|
-
|
|
364
|
+
v,
|
|
250
365
|
{
|
|
251
|
-
name: `${
|
|
252
|
-
defaultValue:
|
|
253
|
-
label:
|
|
254
|
-
value:
|
|
366
|
+
name: `${i}.type`,
|
|
367
|
+
defaultValue: a != null ? {
|
|
368
|
+
label: n[a.type],
|
|
369
|
+
value: a.type
|
|
255
370
|
} : void 0,
|
|
256
|
-
initialValues:
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
371
|
+
initialValues: l.map((c) => ({
|
|
372
|
+
value: c,
|
|
373
|
+
label: n[c]
|
|
374
|
+
})),
|
|
375
|
+
onSelect: (c) => {
|
|
376
|
+
C(c) && r(`${i}.type`, c.value);
|
|
261
377
|
}
|
|
262
378
|
}
|
|
263
379
|
) }),
|
|
264
|
-
/* @__PURE__ */ e.jsx(
|
|
380
|
+
/* @__PURE__ */ e.jsx(ut, { item: a, pathPrefix: i }),
|
|
265
381
|
/* @__PURE__ */ e.jsx("div", { className: "text-black font-bold text-sm", children: "ON" }),
|
|
266
382
|
/* @__PURE__ */ e.jsx("div", { className: "flex-1", children: /* @__PURE__ */ e.jsx(
|
|
267
|
-
|
|
383
|
+
p,
|
|
268
384
|
{
|
|
269
|
-
name: `${
|
|
385
|
+
name: `${i}.selector`,
|
|
270
386
|
type: "text",
|
|
271
|
-
defaultValue:
|
|
272
|
-
onChange: (
|
|
273
|
-
r(`${
|
|
387
|
+
defaultValue: a?.selector,
|
|
388
|
+
onChange: (c) => {
|
|
389
|
+
r(`${i}.selector`, c.currentTarget.value);
|
|
274
390
|
}
|
|
275
391
|
}
|
|
276
392
|
) })
|
|
277
393
|
] }),
|
|
278
|
-
|
|
279
|
-
|
|
394
|
+
s != null && /* @__PURE__ */ e.jsx(
|
|
395
|
+
K,
|
|
280
396
|
{
|
|
281
397
|
className: "w-8 border-l border-gray-100 flex items-center justify-center self-stretch",
|
|
282
398
|
dropdownLabel: /* @__PURE__ */ e.jsx(
|
|
@@ -284,15 +400,15 @@ function ge({
|
|
|
284
400
|
{
|
|
285
401
|
type: "button",
|
|
286
402
|
className: "flex items-center justify-center self-stretch grow",
|
|
287
|
-
children: /* @__PURE__ */ e.jsx(
|
|
403
|
+
children: /* @__PURE__ */ e.jsx(h, { name: "dotsThreeVertical", size: 16, weight: "bold" })
|
|
288
404
|
}
|
|
289
405
|
),
|
|
290
406
|
dropdownItems: /* @__PURE__ */ e.jsx(
|
|
291
|
-
|
|
407
|
+
I,
|
|
292
408
|
{
|
|
293
409
|
label: "Delete",
|
|
294
410
|
onClick: () => {
|
|
295
|
-
r(`${
|
|
411
|
+
r(`${i}`, null), s();
|
|
296
412
|
}
|
|
297
413
|
}
|
|
298
414
|
)
|
|
@@ -300,94 +416,94 @@ function ge({
|
|
|
300
416
|
)
|
|
301
417
|
] }) });
|
|
302
418
|
}
|
|
303
|
-
function
|
|
304
|
-
actions:
|
|
419
|
+
function dt({
|
|
420
|
+
actions: a
|
|
305
421
|
}) {
|
|
306
|
-
const [
|
|
422
|
+
const [t, s] = f(0), {
|
|
307
423
|
setPath: r,
|
|
308
|
-
state: { selectedRuleIndex:
|
|
309
|
-
} =
|
|
424
|
+
state: { selectedRuleIndex: o }
|
|
425
|
+
} = g();
|
|
310
426
|
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
311
|
-
/* @__PURE__ */ e.jsx("div", { children:
|
|
312
|
-
|
|
427
|
+
/* @__PURE__ */ e.jsx("div", { children: a?.map((l, n, i) => /* @__PURE__ */ e.jsx(
|
|
428
|
+
ct,
|
|
313
429
|
{
|
|
314
|
-
item:
|
|
315
|
-
index:
|
|
430
|
+
item: l,
|
|
431
|
+
index: n,
|
|
316
432
|
onDelete: i.length > 1 ? () => {
|
|
317
|
-
|
|
433
|
+
s((c) => c + 1);
|
|
318
434
|
} : void 0
|
|
319
435
|
},
|
|
320
|
-
`${
|
|
436
|
+
`${o}-${n}-${t}`
|
|
321
437
|
)) }),
|
|
322
438
|
/* @__PURE__ */ e.jsx("div", { className: "mt-6", children: /* @__PURE__ */ e.jsxs(
|
|
323
|
-
|
|
439
|
+
P,
|
|
324
440
|
{
|
|
325
441
|
size: "small",
|
|
326
442
|
variant: "secondary",
|
|
327
443
|
alignItems: "center",
|
|
328
444
|
onClick: () => {
|
|
329
445
|
r(
|
|
330
|
-
`rules.${
|
|
446
|
+
`rules.${o}.actions.${a?.length ?? 0}`,
|
|
331
447
|
void 0
|
|
332
448
|
);
|
|
333
449
|
},
|
|
334
450
|
children: [
|
|
335
|
-
/* @__PURE__ */ e.jsx(
|
|
451
|
+
/* @__PURE__ */ e.jsx(h, { name: "plusCircle" }),
|
|
336
452
|
" Add action"
|
|
337
453
|
]
|
|
338
454
|
}
|
|
339
455
|
) })
|
|
340
456
|
] });
|
|
341
457
|
}
|
|
342
|
-
function
|
|
343
|
-
const [
|
|
344
|
-
return
|
|
345
|
-
|
|
346
|
-
|
|
458
|
+
function H(a) {
|
|
459
|
+
const [t, s] = f(void 0);
|
|
460
|
+
return j(() => {
|
|
461
|
+
a?.field != null && Wa(a.field).then((r) => {
|
|
462
|
+
s(r);
|
|
347
463
|
}).catch((r) => {
|
|
348
464
|
console.error("Error fetching field info:", r);
|
|
349
465
|
});
|
|
350
|
-
}, [
|
|
466
|
+
}, [a?.field]), { infos: t };
|
|
351
467
|
}
|
|
352
|
-
function
|
|
353
|
-
if (typeof
|
|
354
|
-
return w(
|
|
355
|
-
if (typeof
|
|
468
|
+
function G(a) {
|
|
469
|
+
if (typeof a == "string")
|
|
470
|
+
return w(q(a)) ? "datetime" : "string";
|
|
471
|
+
if (typeof a == "number")
|
|
356
472
|
return "integer";
|
|
357
|
-
if (typeof
|
|
473
|
+
if (typeof a == "boolean")
|
|
358
474
|
return "boolean";
|
|
359
|
-
if (Array.isArray(
|
|
360
|
-
if (typeof
|
|
361
|
-
return w(
|
|
362
|
-
if (typeof
|
|
475
|
+
if (Array.isArray(a)) {
|
|
476
|
+
if (typeof a[0] == "string")
|
|
477
|
+
return w(q(a[0])) ? "datetime" : "string";
|
|
478
|
+
if (typeof a[0] == "number")
|
|
363
479
|
return "integer";
|
|
364
480
|
}
|
|
365
481
|
return "string";
|
|
366
482
|
}
|
|
367
|
-
function
|
|
368
|
-
item:
|
|
369
|
-
pathPrefix:
|
|
483
|
+
function mt({
|
|
484
|
+
item: a,
|
|
485
|
+
pathPrefix: t
|
|
370
486
|
}) {
|
|
371
|
-
const { setPath:
|
|
372
|
-
let
|
|
373
|
-
return
|
|
374
|
-
|
|
487
|
+
const { setPath: s } = g(), { infos: r } = H(a);
|
|
488
|
+
let o = r?.field?.type;
|
|
489
|
+
return o == null && (o = G(a?.value)), /* @__PURE__ */ e.jsx(
|
|
490
|
+
v,
|
|
375
491
|
{
|
|
376
|
-
name: `${
|
|
377
|
-
value:
|
|
378
|
-
label:
|
|
379
|
-
value:
|
|
492
|
+
name: `${t}.matcher`,
|
|
493
|
+
value: a != null ? {
|
|
494
|
+
label: F.find((l) => l.matcher === a.matcher && (o != null && l.fieldTypes.includes(o) || o == null))?.label ?? (a.matcher != null ? `⚠️ ${a.matcher}` : ""),
|
|
495
|
+
value: a.matcher
|
|
380
496
|
} : void 0,
|
|
381
|
-
initialValues:
|
|
382
|
-
onSelect: (
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
) &&
|
|
497
|
+
initialValues: F.filter(({ fieldTypes: l, visible: n }) => n !== !1 && l.includes(o)).map(({ matcher: l, label: n }) => ({ value: l, label: n })),
|
|
498
|
+
onSelect: (l) => {
|
|
499
|
+
C(l) && (s(`${t}.matcher`, l.value), B.includes(
|
|
500
|
+
l.value
|
|
501
|
+
) && s(`${t}.value`, null));
|
|
386
502
|
}
|
|
387
503
|
}
|
|
388
504
|
);
|
|
389
505
|
}
|
|
390
|
-
const
|
|
506
|
+
const F = [
|
|
391
507
|
{
|
|
392
508
|
/** Matches if field value equals provided value
|
|
393
509
|
* @field Integer, String, Datetime, Boolean
|
|
@@ -632,7 +748,7 @@ const M = [
|
|
|
632
748
|
label: "is present",
|
|
633
749
|
fieldTypes: ["integer", "string", "datetime", "boolean"]
|
|
634
750
|
}
|
|
635
|
-
],
|
|
751
|
+
], L = {
|
|
636
752
|
in_and: {
|
|
637
753
|
label: "all of"
|
|
638
754
|
},
|
|
@@ -646,51 +762,51 @@ const M = [
|
|
|
646
762
|
label: "not at least one of"
|
|
647
763
|
}
|
|
648
764
|
};
|
|
649
|
-
function
|
|
650
|
-
value:
|
|
651
|
-
pathPrefix:
|
|
765
|
+
function ft({
|
|
766
|
+
value: a,
|
|
767
|
+
pathPrefix: t
|
|
652
768
|
}) {
|
|
653
|
-
return (typeof
|
|
769
|
+
return (typeof a != "object" || Array.isArray(a) || a === null) && (a = {
|
|
654
770
|
in_and: []
|
|
655
|
-
}), /* @__PURE__ */ e.jsx("div", { children: Object.entries(
|
|
656
|
-
|
|
771
|
+
}), /* @__PURE__ */ e.jsx("div", { children: Object.entries(a).map(([s, r], o) => /* @__PURE__ */ e.jsx(
|
|
772
|
+
pt,
|
|
657
773
|
{
|
|
658
|
-
pathPrefix:
|
|
774
|
+
pathPrefix: t,
|
|
659
775
|
defaultValue: r,
|
|
660
|
-
initialMatcher:
|
|
776
|
+
initialMatcher: s
|
|
661
777
|
},
|
|
662
|
-
`${
|
|
663
|
-
|
|
778
|
+
`${t}.${// biome-ignore lint/suspicious/noArrayIndexKey: Using index as key is acceptable here since items are static
|
|
779
|
+
o}`
|
|
664
780
|
)) });
|
|
665
781
|
}
|
|
666
|
-
function
|
|
667
|
-
initialMatcher:
|
|
668
|
-
defaultValue:
|
|
669
|
-
pathPrefix:
|
|
782
|
+
function pt({
|
|
783
|
+
initialMatcher: a,
|
|
784
|
+
defaultValue: t,
|
|
785
|
+
pathPrefix: s
|
|
670
786
|
}) {
|
|
671
|
-
const [r,
|
|
672
|
-
return
|
|
673
|
-
r !==
|
|
674
|
-
}, [
|
|
787
|
+
const [r, o] = f(a), [l, n] = f(a), [i, c] = f(t), { setPath: u } = g();
|
|
788
|
+
return j(() => {
|
|
789
|
+
r !== l && (u(`${s}.${r}`, null), o(l)), u(`${s}.${l}`, i);
|
|
790
|
+
}, [l, i, u]), /* @__PURE__ */ e.jsxs("div", { className: "flex gap-2 last-of-type:mt-2", children: [
|
|
675
791
|
/* @__PURE__ */ e.jsx("div", { className: "shrink-0", children: /* @__PURE__ */ e.jsx(
|
|
676
|
-
|
|
792
|
+
v,
|
|
677
793
|
{
|
|
678
794
|
defaultValue: [
|
|
679
|
-
{ value:
|
|
795
|
+
{ value: l, label: L[l].label }
|
|
680
796
|
],
|
|
681
|
-
initialValues: Object.entries(
|
|
797
|
+
initialValues: Object.entries(L).map(
|
|
682
798
|
([d, { label: m }]) => ({
|
|
683
799
|
value: d,
|
|
684
800
|
label: m
|
|
685
801
|
})
|
|
686
802
|
),
|
|
687
803
|
onSelect: (d) => {
|
|
688
|
-
|
|
804
|
+
C(d) && n(d.value);
|
|
689
805
|
}
|
|
690
806
|
}
|
|
691
807
|
) }),
|
|
692
808
|
/* @__PURE__ */ e.jsx("div", { className: "grow", children: /* @__PURE__ */ e.jsx(
|
|
693
|
-
|
|
809
|
+
v,
|
|
694
810
|
{
|
|
695
811
|
isMulti: !0,
|
|
696
812
|
isCreatable: !0,
|
|
@@ -700,7 +816,7 @@ function be({
|
|
|
700
816
|
})),
|
|
701
817
|
initialValues: [],
|
|
702
818
|
onSelect: (d) => {
|
|
703
|
-
|
|
819
|
+
Y(d) && c(
|
|
704
820
|
d.map(
|
|
705
821
|
(m) => typeof m.value == "boolean" ? m.value.toString() : m.value
|
|
706
822
|
)
|
|
@@ -710,111 +826,111 @@ function be({
|
|
|
710
826
|
) })
|
|
711
827
|
] });
|
|
712
828
|
}
|
|
713
|
-
function
|
|
714
|
-
value:
|
|
715
|
-
onChange:
|
|
829
|
+
function yt({
|
|
830
|
+
value: a,
|
|
831
|
+
onChange: t
|
|
716
832
|
}) {
|
|
717
|
-
const [
|
|
718
|
-
Array.isArray(
|
|
719
|
-
), [
|
|
720
|
-
Array.isArray(
|
|
833
|
+
const [s, r] = f(
|
|
834
|
+
Array.isArray(a) && typeof a[0] == "number" ? a[0] : null
|
|
835
|
+
), [o, l] = f(
|
|
836
|
+
Array.isArray(a) && typeof a[1] == "number" ? a[1] : null
|
|
721
837
|
);
|
|
722
838
|
return /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-4", children: [
|
|
723
839
|
/* @__PURE__ */ e.jsx("div", { className: "grow", children: /* @__PURE__ */ e.jsx(
|
|
724
|
-
|
|
840
|
+
p,
|
|
725
841
|
{
|
|
726
842
|
type: "number",
|
|
727
843
|
placeholder: "Min",
|
|
728
|
-
value:
|
|
729
|
-
onChange: (
|
|
730
|
-
const i = parseInt(
|
|
731
|
-
r(Number.isNaN(i) ? null : i),
|
|
844
|
+
value: s ?? "",
|
|
845
|
+
onChange: (n) => {
|
|
846
|
+
const i = parseInt(n.currentTarget.value, 10);
|
|
847
|
+
r(Number.isNaN(i) ? null : i), t([Number.isNaN(i) ? null : i, o]);
|
|
732
848
|
}
|
|
733
849
|
}
|
|
734
850
|
) }),
|
|
735
851
|
/* @__PURE__ */ e.jsx("span", { className: "text-gray-300", children: "to" }),
|
|
736
852
|
/* @__PURE__ */ e.jsx("div", { className: "grow", children: /* @__PURE__ */ e.jsx(
|
|
737
|
-
|
|
853
|
+
p,
|
|
738
854
|
{
|
|
739
855
|
type: "number",
|
|
740
856
|
placeholder: "Max",
|
|
741
|
-
value:
|
|
742
|
-
onChange: (
|
|
743
|
-
const i = parseInt(
|
|
744
|
-
|
|
857
|
+
value: o ?? "",
|
|
858
|
+
onChange: (n) => {
|
|
859
|
+
const i = parseInt(n.currentTarget.value, 10);
|
|
860
|
+
l(Number.isNaN(i) ? null : i), t([s, Number.isNaN(i) ? null : i]);
|
|
745
861
|
}
|
|
746
862
|
}
|
|
747
863
|
) })
|
|
748
864
|
] });
|
|
749
865
|
}
|
|
750
|
-
function
|
|
751
|
-
value:
|
|
752
|
-
onChange:
|
|
866
|
+
function gt({
|
|
867
|
+
value: a,
|
|
868
|
+
onChange: t
|
|
753
869
|
}) {
|
|
754
|
-
const [
|
|
755
|
-
Array.isArray(
|
|
756
|
-
), [
|
|
757
|
-
Array.isArray(
|
|
870
|
+
const [s, r] = f(
|
|
871
|
+
Array.isArray(a) && typeof a[0] == "string" ? a[0] : null
|
|
872
|
+
), [o, l] = f(
|
|
873
|
+
Array.isArray(a) && typeof a[1] == "string" ? a[1] : null
|
|
758
874
|
);
|
|
759
875
|
return /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-4", children: [
|
|
760
876
|
/* @__PURE__ */ e.jsx("div", { className: "grow", children: /* @__PURE__ */ e.jsx(
|
|
761
|
-
|
|
877
|
+
p,
|
|
762
878
|
{
|
|
763
879
|
type: "text",
|
|
764
880
|
placeholder: "Min",
|
|
765
|
-
value:
|
|
766
|
-
onChange: (
|
|
767
|
-
const i =
|
|
768
|
-
r(i),
|
|
881
|
+
value: s ?? "",
|
|
882
|
+
onChange: (n) => {
|
|
883
|
+
const i = n.currentTarget.value;
|
|
884
|
+
r(i), t([i, o]);
|
|
769
885
|
}
|
|
770
886
|
}
|
|
771
887
|
) }),
|
|
772
888
|
/* @__PURE__ */ e.jsx("span", { className: "text-gray-300", children: "to" }),
|
|
773
889
|
/* @__PURE__ */ e.jsx("div", { className: "grow", children: /* @__PURE__ */ e.jsx(
|
|
774
|
-
|
|
890
|
+
p,
|
|
775
891
|
{
|
|
776
892
|
type: "text",
|
|
777
893
|
placeholder: "Max",
|
|
778
|
-
value:
|
|
779
|
-
onChange: (
|
|
780
|
-
const i =
|
|
781
|
-
|
|
894
|
+
value: o ?? "",
|
|
895
|
+
onChange: (n) => {
|
|
896
|
+
const i = n.currentTarget.value;
|
|
897
|
+
l(i), t([s, i]);
|
|
782
898
|
}
|
|
783
899
|
}
|
|
784
900
|
) })
|
|
785
901
|
] });
|
|
786
902
|
}
|
|
787
|
-
function
|
|
788
|
-
item:
|
|
789
|
-
pathPrefix:
|
|
903
|
+
function bt({
|
|
904
|
+
item: a,
|
|
905
|
+
pathPrefix: t
|
|
790
906
|
}) {
|
|
791
|
-
const { setPath:
|
|
792
|
-
if (
|
|
793
|
-
|
|
907
|
+
const { setPath: s } = g(), { infos: r } = H(a), { user: o } = W(), l = `${t}.value`;
|
|
908
|
+
if (a == null || B.includes(
|
|
909
|
+
a.matcher
|
|
794
910
|
))
|
|
795
911
|
return null;
|
|
796
|
-
const
|
|
912
|
+
const n = a;
|
|
797
913
|
let i = r?.field?.type;
|
|
798
|
-
i == null && (i =
|
|
799
|
-
(
|
|
914
|
+
i == null && (i = G(n.value)), (typeof n.value == "string" && /^{{.*}}$/.test(n.value) || Array.isArray(n.value) && n.value.some(
|
|
915
|
+
(u) => typeof u == "string" && /^{{.*}}$/.test(u)
|
|
800
916
|
)) && (i = "string");
|
|
801
|
-
let
|
|
917
|
+
let c = null;
|
|
802
918
|
switch (i) {
|
|
803
919
|
case "datetime": {
|
|
804
|
-
|
|
920
|
+
c = "date";
|
|
805
921
|
break;
|
|
806
922
|
}
|
|
807
923
|
case "boolean": {
|
|
808
|
-
|
|
924
|
+
c = "boolean";
|
|
809
925
|
break;
|
|
810
926
|
}
|
|
811
927
|
case "string": {
|
|
812
|
-
|
|
928
|
+
c = "text";
|
|
813
929
|
break;
|
|
814
930
|
}
|
|
815
931
|
case "integer":
|
|
816
932
|
case "float": {
|
|
817
|
-
|
|
933
|
+
c = "number";
|
|
818
934
|
break;
|
|
819
935
|
}
|
|
820
936
|
case "array":
|
|
@@ -822,11 +938,11 @@ function je({
|
|
|
822
938
|
case "object":
|
|
823
939
|
break;
|
|
824
940
|
default: {
|
|
825
|
-
|
|
941
|
+
c = "text";
|
|
826
942
|
break;
|
|
827
943
|
}
|
|
828
944
|
}
|
|
829
|
-
switch (
|
|
945
|
+
switch (n.matcher) {
|
|
830
946
|
case "eq":
|
|
831
947
|
case "not_eq":
|
|
832
948
|
case "lt":
|
|
@@ -846,54 +962,54 @@ function je({
|
|
|
846
962
|
case "gteq_lt":
|
|
847
963
|
case "gt_lteq":
|
|
848
964
|
case "gteq_lteq": {
|
|
849
|
-
|
|
965
|
+
c === "number" && (c = "numberRange"), c === "text" && (c = "textRange"), c === "date" && (c = "dateRange");
|
|
850
966
|
break;
|
|
851
967
|
}
|
|
852
968
|
case "is_in":
|
|
853
969
|
case "is_not_in": {
|
|
854
|
-
|
|
970
|
+
c = "tag";
|
|
855
971
|
break;
|
|
856
972
|
}
|
|
857
973
|
case "array_match": {
|
|
858
|
-
|
|
974
|
+
c = "arrayMatch";
|
|
859
975
|
break;
|
|
860
976
|
}
|
|
861
977
|
default: {
|
|
862
|
-
|
|
978
|
+
R(n.matcher);
|
|
863
979
|
break;
|
|
864
980
|
}
|
|
865
981
|
}
|
|
866
|
-
switch (
|
|
982
|
+
switch (c) {
|
|
867
983
|
case "date": {
|
|
868
|
-
const
|
|
869
|
-
typeof
|
|
984
|
+
const u = D(
|
|
985
|
+
typeof n.value == "string" ? n.value : ""
|
|
870
986
|
);
|
|
871
987
|
return /* @__PURE__ */ e.jsx(
|
|
872
|
-
|
|
988
|
+
Ha,
|
|
873
989
|
{
|
|
874
|
-
value: w(
|
|
990
|
+
value: w(u) ? u : void 0,
|
|
875
991
|
showTimeSelect: !0,
|
|
876
992
|
placeholder: "Enter value",
|
|
877
993
|
onChange: (d) => {
|
|
878
|
-
|
|
994
|
+
s(l, d?.toJSON());
|
|
879
995
|
},
|
|
880
|
-
timezone:
|
|
996
|
+
timezone: o?.timezone
|
|
881
997
|
}
|
|
882
998
|
);
|
|
883
999
|
}
|
|
884
1000
|
case "dateRange": {
|
|
885
|
-
const
|
|
886
|
-
const m =
|
|
1001
|
+
const u = Array.isArray(n.value) ? n.value.map((d) => {
|
|
1002
|
+
const m = D(typeof d == "string" ? d : "");
|
|
887
1003
|
return w(m) ? m : null;
|
|
888
1004
|
}) : [null, null];
|
|
889
1005
|
return /* @__PURE__ */ e.jsx(
|
|
890
|
-
|
|
1006
|
+
Xa,
|
|
891
1007
|
{
|
|
892
|
-
value:
|
|
1008
|
+
value: u,
|
|
893
1009
|
showTimeSelect: !0,
|
|
894
1010
|
onChange: (d) => {
|
|
895
|
-
|
|
896
|
-
`${
|
|
1011
|
+
s(
|
|
1012
|
+
`${t}.value`,
|
|
897
1013
|
d.map((m) => m?.toJSON() ?? null)
|
|
898
1014
|
);
|
|
899
1015
|
}
|
|
@@ -902,48 +1018,48 @@ function je({
|
|
|
902
1018
|
}
|
|
903
1019
|
case "numberRange":
|
|
904
1020
|
return /* @__PURE__ */ e.jsx(
|
|
905
|
-
|
|
1021
|
+
yt,
|
|
906
1022
|
{
|
|
907
|
-
value:
|
|
908
|
-
onChange: (
|
|
909
|
-
|
|
1023
|
+
value: n.value,
|
|
1024
|
+
onChange: (u) => {
|
|
1025
|
+
s(l, u);
|
|
910
1026
|
}
|
|
911
1027
|
}
|
|
912
1028
|
);
|
|
913
1029
|
case "textRange":
|
|
914
1030
|
return /* @__PURE__ */ e.jsx(
|
|
915
|
-
|
|
1031
|
+
gt,
|
|
916
1032
|
{
|
|
917
|
-
value:
|
|
918
|
-
onChange: (
|
|
919
|
-
|
|
1033
|
+
value: n.value,
|
|
1034
|
+
onChange: (u) => {
|
|
1035
|
+
s(l, u);
|
|
920
1036
|
}
|
|
921
1037
|
}
|
|
922
1038
|
);
|
|
923
1039
|
case "arrayMatch":
|
|
924
1040
|
return /* @__PURE__ */ e.jsx(
|
|
925
|
-
|
|
1041
|
+
ft,
|
|
926
1042
|
{
|
|
927
|
-
value:
|
|
928
|
-
pathPrefix: `${
|
|
1043
|
+
value: n.value,
|
|
1044
|
+
pathPrefix: `${t}.value`
|
|
929
1045
|
}
|
|
930
1046
|
);
|
|
931
1047
|
case "tag":
|
|
932
1048
|
return /* @__PURE__ */ e.jsx(
|
|
933
|
-
|
|
1049
|
+
v,
|
|
934
1050
|
{
|
|
935
1051
|
isMulti: !0,
|
|
936
1052
|
isClearable: !1,
|
|
937
1053
|
isCreatable: !0,
|
|
938
|
-
defaultValue: Array.isArray(
|
|
939
|
-
label:
|
|
940
|
-
value:
|
|
1054
|
+
defaultValue: Array.isArray(n.value) ? n.value.map((u) => ({
|
|
1055
|
+
label: u.toString(),
|
|
1056
|
+
value: u
|
|
941
1057
|
})) : [],
|
|
942
1058
|
initialValues: [],
|
|
943
|
-
onSelect: (
|
|
944
|
-
|
|
945
|
-
`${
|
|
946
|
-
|
|
1059
|
+
onSelect: (u) => {
|
|
1060
|
+
Y(u) && s(
|
|
1061
|
+
`${t}.value`,
|
|
1062
|
+
u.map((d) => {
|
|
947
1063
|
if (i === "integer") {
|
|
948
1064
|
const m = parseInt(d.value.toString(), 10);
|
|
949
1065
|
return Number.isNaN(m) ? null : m;
|
|
@@ -956,83 +1072,83 @@ function je({
|
|
|
956
1072
|
);
|
|
957
1073
|
case "number":
|
|
958
1074
|
return /* @__PURE__ */ e.jsx(
|
|
959
|
-
|
|
1075
|
+
p,
|
|
960
1076
|
{
|
|
961
|
-
name: `${
|
|
1077
|
+
name: `${t}.value`,
|
|
962
1078
|
type: "number",
|
|
963
|
-
defaultValue: typeof
|
|
1079
|
+
defaultValue: typeof n.value == "number" ? n.value : "",
|
|
964
1080
|
placeholder: "Enter value",
|
|
965
|
-
onChange: (
|
|
966
|
-
|
|
967
|
-
`${
|
|
968
|
-
parseInt(
|
|
1081
|
+
onChange: (u) => {
|
|
1082
|
+
s(
|
|
1083
|
+
`${t}.value`,
|
|
1084
|
+
parseInt(u.currentTarget.value, 10)
|
|
969
1085
|
);
|
|
970
1086
|
}
|
|
971
1087
|
}
|
|
972
1088
|
);
|
|
973
1089
|
case "boolean":
|
|
974
1090
|
return /* @__PURE__ */ e.jsx(
|
|
975
|
-
|
|
1091
|
+
v,
|
|
976
1092
|
{
|
|
977
|
-
name: `${
|
|
978
|
-
defaultValue: typeof
|
|
979
|
-
label:
|
|
980
|
-
value:
|
|
1093
|
+
name: `${t}.value`,
|
|
1094
|
+
defaultValue: typeof n.value == "boolean" ? {
|
|
1095
|
+
label: n.value ? "Yes" : "No",
|
|
1096
|
+
value: n.value
|
|
981
1097
|
} : void 0,
|
|
982
1098
|
initialValues: [
|
|
983
1099
|
{ label: "Yes", value: !0 },
|
|
984
1100
|
{ label: "No", value: !1 }
|
|
985
1101
|
],
|
|
986
|
-
onSelect: (
|
|
987
|
-
|
|
1102
|
+
onSelect: (u) => {
|
|
1103
|
+
C(u) && s(l, u.value);
|
|
988
1104
|
}
|
|
989
1105
|
}
|
|
990
1106
|
);
|
|
991
1107
|
case "text":
|
|
992
1108
|
case null:
|
|
993
1109
|
return /* @__PURE__ */ e.jsx(
|
|
994
|
-
|
|
1110
|
+
p,
|
|
995
1111
|
{
|
|
996
|
-
name: `${
|
|
1112
|
+
name: `${t}.value`,
|
|
997
1113
|
type: "text",
|
|
998
|
-
defaultValue: typeof
|
|
1114
|
+
defaultValue: typeof n.value == "string" ? n.value : JSON.stringify(n.value),
|
|
999
1115
|
placeholder: "Enter value",
|
|
1000
|
-
onChange: (
|
|
1001
|
-
|
|
1116
|
+
onChange: (u) => {
|
|
1117
|
+
s(l, u.currentTarget.value);
|
|
1002
1118
|
}
|
|
1003
1119
|
}
|
|
1004
1120
|
);
|
|
1005
1121
|
default:
|
|
1006
|
-
return
|
|
1122
|
+
return R();
|
|
1007
1123
|
}
|
|
1008
1124
|
}
|
|
1009
|
-
function
|
|
1010
|
-
item:
|
|
1011
|
-
nestingLevel:
|
|
1012
|
-
pathPrefix:
|
|
1125
|
+
function ht({
|
|
1126
|
+
item: a,
|
|
1127
|
+
nestingLevel: t,
|
|
1128
|
+
pathPrefix: s,
|
|
1013
1129
|
onDelete: r
|
|
1014
1130
|
}) {
|
|
1015
|
-
const { setPath:
|
|
1016
|
-
return
|
|
1131
|
+
const { setPath: o } = g(), l = [];
|
|
1132
|
+
return t < 2 && (l[0] ??= [], l[0].push(
|
|
1017
1133
|
/* @__PURE__ */ e.jsx(
|
|
1018
|
-
|
|
1134
|
+
I,
|
|
1019
1135
|
{
|
|
1020
1136
|
label: "Nest conditions",
|
|
1021
1137
|
onClick: () => {
|
|
1022
|
-
|
|
1023
|
-
`${
|
|
1138
|
+
o(
|
|
1139
|
+
`${s}.nested.conditions.${(a?.nested?.conditions ?? []).length}`,
|
|
1024
1140
|
void 0
|
|
1025
1141
|
);
|
|
1026
1142
|
}
|
|
1027
1143
|
}
|
|
1028
1144
|
)
|
|
1029
|
-
)), r != null && (
|
|
1145
|
+
)), r != null && (l[1] ??= [], l[1].push(
|
|
1030
1146
|
/* @__PURE__ */ e.jsx(
|
|
1031
|
-
|
|
1147
|
+
I,
|
|
1032
1148
|
{
|
|
1033
1149
|
label: "Delete",
|
|
1034
1150
|
onClick: () => {
|
|
1035
|
-
|
|
1151
|
+
o(`${s}`, null), r();
|
|
1036
1152
|
}
|
|
1037
1153
|
}
|
|
1038
1154
|
)
|
|
@@ -1040,25 +1156,25 @@ function Ne({
|
|
|
1040
1156
|
/* @__PURE__ */ e.jsx("div", { className: "flex items-center justify-between gap-2 grow p-2", children: /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-2 grow", children: [
|
|
1041
1157
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
1042
1158
|
/* @__PURE__ */ e.jsx("div", { className: "flex-1", children: /* @__PURE__ */ e.jsx(
|
|
1043
|
-
|
|
1159
|
+
p,
|
|
1044
1160
|
{
|
|
1045
|
-
name: `${
|
|
1161
|
+
name: `${s}.field`,
|
|
1046
1162
|
type: "text",
|
|
1047
|
-
defaultValue:
|
|
1048
|
-
onChange: (
|
|
1049
|
-
|
|
1163
|
+
defaultValue: a?.field,
|
|
1164
|
+
onChange: (n) => {
|
|
1165
|
+
o(`${s}.field`, n.currentTarget.value);
|
|
1050
1166
|
},
|
|
1051
|
-
onBlur: (
|
|
1052
|
-
|
|
1167
|
+
onBlur: (n) => {
|
|
1168
|
+
o(`${s}.field`, n.currentTarget.value);
|
|
1053
1169
|
}
|
|
1054
1170
|
}
|
|
1055
1171
|
) }),
|
|
1056
|
-
/* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsx(
|
|
1172
|
+
/* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsx(mt, { item: a, pathPrefix: s }) })
|
|
1057
1173
|
] }),
|
|
1058
|
-
/* @__PURE__ */ e.jsx(
|
|
1174
|
+
/* @__PURE__ */ e.jsx(bt, { item: a, pathPrefix: s })
|
|
1059
1175
|
] }) }),
|
|
1060
|
-
|
|
1061
|
-
|
|
1176
|
+
l.length > 0 && /* @__PURE__ */ e.jsx(
|
|
1177
|
+
K,
|
|
1062
1178
|
{
|
|
1063
1179
|
className: "w-8 border-l border-gray-100 flex items-center justify-center self-stretch",
|
|
1064
1180
|
dropdownLabel: /* @__PURE__ */ e.jsx(
|
|
@@ -1066,77 +1182,77 @@ function Ne({
|
|
|
1066
1182
|
{
|
|
1067
1183
|
type: "button",
|
|
1068
1184
|
className: "flex items-center justify-center self-stretch grow",
|
|
1069
|
-
children: /* @__PURE__ */ e.jsx(
|
|
1185
|
+
children: /* @__PURE__ */ e.jsx(h, { name: "dotsThreeVertical", size: 16, weight: "bold" })
|
|
1070
1186
|
}
|
|
1071
1187
|
),
|
|
1072
|
-
dropdownItems:
|
|
1188
|
+
dropdownItems: l.map((n, i, c) => (
|
|
1073
1189
|
// biome-ignore lint/suspicious/noArrayIndexKey: Using index as key is acceptable here since items are static
|
|
1074
|
-
/* @__PURE__ */ e.jsxs(
|
|
1075
|
-
|
|
1190
|
+
/* @__PURE__ */ e.jsxs(M.Fragment, { children: [
|
|
1191
|
+
n.map((u, d) => (
|
|
1076
1192
|
// biome-ignore lint/suspicious/noArrayIndexKey: Using index as key is acceptable here since items are static
|
|
1077
|
-
/* @__PURE__ */ e.jsx(
|
|
1193
|
+
/* @__PURE__ */ e.jsx(M.Fragment, { children: u }, d)
|
|
1078
1194
|
)),
|
|
1079
|
-
i <
|
|
1195
|
+
i < c.length - 1 && /* @__PURE__ */ e.jsx(Ga, {})
|
|
1080
1196
|
] }, i)
|
|
1081
1197
|
))
|
|
1082
1198
|
}
|
|
1083
1199
|
)
|
|
1084
1200
|
] });
|
|
1085
1201
|
}
|
|
1086
|
-
function
|
|
1087
|
-
item:
|
|
1088
|
-
children:
|
|
1089
|
-
nestingLevel:
|
|
1202
|
+
function Q({
|
|
1203
|
+
item: a,
|
|
1204
|
+
children: t,
|
|
1205
|
+
nestingLevel: s = 0,
|
|
1090
1206
|
pathPrefix: r
|
|
1091
1207
|
}) {
|
|
1092
1208
|
const {
|
|
1093
|
-
state: { selectedRuleIndex:
|
|
1094
|
-
} =
|
|
1209
|
+
state: { selectedRuleIndex: o }
|
|
1210
|
+
} = g(), l = a?.conditions_logic?.toLowerCase() ?? "and", { setPath: n } = g(), [i, c] = f(0), u = s > 0;
|
|
1095
1211
|
return /* @__PURE__ */ e.jsxs(
|
|
1096
1212
|
"div",
|
|
1097
1213
|
{
|
|
1098
1214
|
className: _("query-group", {
|
|
1099
|
-
"p-4 border border-gray-200 rounded-md":
|
|
1215
|
+
"p-4 border border-gray-200 rounded-md": u
|
|
1100
1216
|
}),
|
|
1101
1217
|
children: [
|
|
1102
|
-
|
|
1103
|
-
|
|
1218
|
+
t,
|
|
1219
|
+
a != null && (a.conditions ?? []).length > 0 && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
1104
1220
|
/* @__PURE__ */ e.jsxs(
|
|
1105
1221
|
"select",
|
|
1106
1222
|
{
|
|
1107
1223
|
onChange: (d) => {
|
|
1108
|
-
|
|
1224
|
+
n(
|
|
1109
1225
|
`${r}.conditions_logic`,
|
|
1110
1226
|
d.currentTarget.value
|
|
1111
1227
|
);
|
|
1112
1228
|
},
|
|
1113
|
-
defaultValue:
|
|
1229
|
+
defaultValue: l,
|
|
1114
1230
|
className: "pl-4 pr-8 py-2 font-bold focus:ring-0 focus:outline-hidden appearance-none bg-gray-50 border border-gray-200 rounded-md text-sm leading-4",
|
|
1115
1231
|
children: [
|
|
1116
1232
|
/* @__PURE__ */ e.jsxs("option", { value: "and", children: [
|
|
1117
|
-
|
|
1233
|
+
u ? "Nested in " : "",
|
|
1118
1234
|
"AND"
|
|
1119
1235
|
] }),
|
|
1120
1236
|
/* @__PURE__ */ e.jsxs("option", { value: "or", children: [
|
|
1121
|
-
|
|
1237
|
+
u ? "Nested in " : "",
|
|
1122
1238
|
"OR"
|
|
1123
1239
|
] })
|
|
1124
1240
|
]
|
|
1125
1241
|
}
|
|
1126
1242
|
),
|
|
1127
|
-
/* @__PURE__ */ e.jsx("div", { className: "border-l border-gray-200 ml-3 pt-3", children:
|
|
1128
|
-
const
|
|
1243
|
+
/* @__PURE__ */ e.jsx("div", { className: "border-l border-gray-200 ml-3 pt-3", children: a?.conditions?.map((d, m, T) => {
|
|
1244
|
+
const x = m === T.length - 1;
|
|
1129
1245
|
return /* @__PURE__ */ e.jsxs(
|
|
1130
1246
|
"div",
|
|
1131
1247
|
{
|
|
1132
1248
|
className: "flex items-center mb-4 last:mb-0 relative",
|
|
1133
1249
|
children: [
|
|
1134
|
-
/* @__PURE__ */ e.jsx(
|
|
1250
|
+
/* @__PURE__ */ e.jsx(xt, { rounded: x }),
|
|
1135
1251
|
/* @__PURE__ */ e.jsx("div", { className: "ml-4 w-full", children: /* @__PURE__ */ e.jsx(
|
|
1136
|
-
|
|
1252
|
+
Q,
|
|
1137
1253
|
{
|
|
1138
1254
|
item: d?.nested ?? void 0,
|
|
1139
|
-
nestingLevel: d?.nested != null ?
|
|
1255
|
+
nestingLevel: d?.nested != null ? s + 1 : 0,
|
|
1140
1256
|
pathPrefix: `${r}.conditions.${m}.nested`,
|
|
1141
1257
|
children: /* @__PURE__ */ e.jsx(
|
|
1142
1258
|
"div",
|
|
@@ -1145,13 +1261,13 @@ function B({
|
|
|
1145
1261
|
"mb-4": d?.nested != null
|
|
1146
1262
|
}),
|
|
1147
1263
|
children: /* @__PURE__ */ e.jsx(
|
|
1148
|
-
|
|
1264
|
+
ht,
|
|
1149
1265
|
{
|
|
1150
1266
|
item: d,
|
|
1151
|
-
nestingLevel:
|
|
1267
|
+
nestingLevel: s,
|
|
1152
1268
|
pathPrefix: `${r}.conditions.${m}`,
|
|
1153
|
-
onDelete:
|
|
1154
|
-
|
|
1269
|
+
onDelete: T.length > 1 || s > 0 ? () => {
|
|
1270
|
+
c((b) => b + 1);
|
|
1155
1271
|
} : void 0
|
|
1156
1272
|
}
|
|
1157
1273
|
)
|
|
@@ -1161,7 +1277,7 @@ function B({
|
|
|
1161
1277
|
) })
|
|
1162
1278
|
]
|
|
1163
1279
|
},
|
|
1164
|
-
`${
|
|
1280
|
+
`${o}-${m}-${i}`
|
|
1165
1281
|
);
|
|
1166
1282
|
}) })
|
|
1167
1283
|
] })
|
|
@@ -1169,122 +1285,165 @@ function B({
|
|
|
1169
1285
|
}
|
|
1170
1286
|
);
|
|
1171
1287
|
}
|
|
1172
|
-
function
|
|
1173
|
-
rounded:
|
|
1288
|
+
function xt({
|
|
1289
|
+
rounded: a = !1
|
|
1174
1290
|
}) {
|
|
1175
|
-
return
|
|
1291
|
+
return a ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
1176
1292
|
/* @__PURE__ */ e.jsx("div", { className: "absolute -left-px top-1/2 w-px h-1/2 bg-white" }),
|
|
1177
1293
|
/* @__PURE__ */ e.jsx("div", { className: "absolute -left-px top-1/2 -translate-y-1/2 w-3.5 h-3.5 border-l border-b rounded-es-sm bg-white border-gray-200" })
|
|
1178
1294
|
] }) : /* @__PURE__ */ e.jsx("div", { className: "absolute left-0 top-1/2 -translate-y-1/2 w-3.5 h-px bg-gray-200" });
|
|
1179
1295
|
}
|
|
1180
|
-
function
|
|
1296
|
+
function vt() {
|
|
1181
1297
|
const {
|
|
1182
|
-
setPath:
|
|
1183
|
-
state: { value:
|
|
1184
|
-
} =
|
|
1185
|
-
|
|
1298
|
+
setPath: a,
|
|
1299
|
+
state: { value: t, selectedRuleIndex: s }
|
|
1300
|
+
} = g(), [r, o] = f(
|
|
1301
|
+
t.rules[s]?.name ?? ""
|
|
1186
1302
|
);
|
|
1187
|
-
return
|
|
1188
|
-
|
|
1189
|
-
}, [
|
|
1303
|
+
return j(() => {
|
|
1304
|
+
o(t.rules[s]?.name ?? "");
|
|
1305
|
+
}, [s]), // biome-ignore lint/a11y/noStaticElementInteractions: This <div> is used with contentEditable
|
|
1190
1306
|
/* @__PURE__ */ e.jsx(
|
|
1191
1307
|
"div",
|
|
1192
1308
|
{
|
|
1193
1309
|
contentEditable: "plaintext-only",
|
|
1194
1310
|
suppressContentEditableWarning: !0,
|
|
1195
|
-
onInput: (
|
|
1196
|
-
const i =
|
|
1197
|
-
|
|
1311
|
+
onInput: (l) => {
|
|
1312
|
+
const i = l.currentTarget.innerText.replace(/[\n\s]+/g, " ").trim();
|
|
1313
|
+
a(`rules.${s}.name`, i);
|
|
1198
1314
|
},
|
|
1199
|
-
onKeyDown: (
|
|
1200
|
-
|
|
1315
|
+
onKeyDown: (l) => {
|
|
1316
|
+
l.key === "Enter" && (l.preventDefault(), l.currentTarget.blur());
|
|
1201
1317
|
},
|
|
1202
|
-
onBlur: (
|
|
1203
|
-
const
|
|
1204
|
-
|
|
1318
|
+
onBlur: (l) => {
|
|
1319
|
+
const n = l.currentTarget;
|
|
1320
|
+
n.innerText = n.innerText.replace(/[\n\s]+/g, " ").trim();
|
|
1205
1321
|
},
|
|
1206
1322
|
children: r
|
|
1207
1323
|
},
|
|
1208
|
-
|
|
1324
|
+
s
|
|
1209
1325
|
);
|
|
1210
1326
|
}
|
|
1211
|
-
const
|
|
1327
|
+
const U = {
|
|
1212
1328
|
rules: []
|
|
1213
|
-
},
|
|
1329
|
+
}, $ = (a) => {
|
|
1214
1330
|
try {
|
|
1215
|
-
return JSON.parse(
|
|
1331
|
+
return JSON.parse(a ?? JSON.stringify(U));
|
|
1216
1332
|
} catch {
|
|
1217
|
-
return
|
|
1333
|
+
return U;
|
|
1218
1334
|
}
|
|
1219
|
-
},
|
|
1335
|
+
}, jt = (a) => {
|
|
1220
1336
|
try {
|
|
1221
|
-
return JSON.parse(
|
|
1337
|
+
return JSON.parse(a ?? "{}"), !0;
|
|
1222
1338
|
} catch {
|
|
1223
1339
|
return !1;
|
|
1224
1340
|
}
|
|
1225
1341
|
};
|
|
1226
|
-
function
|
|
1227
|
-
const
|
|
1228
|
-
|
|
1342
|
+
function Et(a) {
|
|
1343
|
+
const {
|
|
1344
|
+
settings: { domain: t }
|
|
1345
|
+
} = W(), [s, r] = f([]), [o, l] = f(
|
|
1346
|
+
$(a.value ?? a.defaultValue)
|
|
1229
1347
|
);
|
|
1230
|
-
return
|
|
1348
|
+
return j(
|
|
1349
|
+
function() {
|
|
1350
|
+
o.rules.length === 0 && l($(a.value));
|
|
1351
|
+
},
|
|
1352
|
+
[a.value]
|
|
1353
|
+
), j(
|
|
1231
1354
|
function() {
|
|
1232
|
-
|
|
1355
|
+
Qa(a.schemaType, t).then((i) => {
|
|
1356
|
+
const u = y.object({
|
|
1357
|
+
properties: y.object({
|
|
1358
|
+
rules: y.object({
|
|
1359
|
+
items: y.object({
|
|
1360
|
+
properties: y.object({
|
|
1361
|
+
actions: y.object({
|
|
1362
|
+
items: y.object({
|
|
1363
|
+
anyOf: y.array(
|
|
1364
|
+
y.object({
|
|
1365
|
+
properties: y.object({
|
|
1366
|
+
type: y.object({
|
|
1367
|
+
enum: y.string().array()
|
|
1368
|
+
})
|
|
1369
|
+
})
|
|
1370
|
+
})
|
|
1371
|
+
)
|
|
1372
|
+
})
|
|
1373
|
+
})
|
|
1374
|
+
})
|
|
1375
|
+
})
|
|
1376
|
+
})
|
|
1377
|
+
})
|
|
1378
|
+
}).parse(i).properties.rules.items.properties.actions.items.anyOf.flatMap(
|
|
1379
|
+
(d) => d.properties.type.enum
|
|
1380
|
+
);
|
|
1381
|
+
r([...new Set(u)]);
|
|
1382
|
+
});
|
|
1233
1383
|
},
|
|
1234
|
-
[t
|
|
1235
|
-
), /* @__PURE__ */ e.jsx(
|
|
1384
|
+
[t]
|
|
1385
|
+
), /* @__PURE__ */ e.jsx(
|
|
1386
|
+
ot,
|
|
1387
|
+
{
|
|
1388
|
+
initialValue: {
|
|
1389
|
+
value: { rules: o.rules },
|
|
1390
|
+
availableActionTypes: s
|
|
1391
|
+
},
|
|
1392
|
+
children: /* @__PURE__ */ e.jsx(Tt, { ...a })
|
|
1393
|
+
}
|
|
1394
|
+
);
|
|
1236
1395
|
}
|
|
1237
|
-
function
|
|
1396
|
+
function Tt(a) {
|
|
1238
1397
|
const {
|
|
1239
|
-
state: { value:
|
|
1398
|
+
state: { value: t, selectedRuleIndex: s },
|
|
1240
1399
|
setSelectedRuleIndex: r,
|
|
1241
|
-
setValue:
|
|
1242
|
-
setPath:
|
|
1243
|
-
} =
|
|
1244
|
-
|
|
1245
|
-
),
|
|
1246
|
-
|
|
1400
|
+
setValue: o,
|
|
1401
|
+
setPath: l
|
|
1402
|
+
} = g(), [n, i] = f(
|
|
1403
|
+
a.defaultCodeEditorVisible ?? !1
|
|
1404
|
+
), c = t.rules[s], u = rt(null), [d, m] = f(0);
|
|
1405
|
+
j(
|
|
1247
1406
|
function() {
|
|
1248
|
-
|
|
1407
|
+
S($(u.current?.getValue()), t) || u.current?.setValue(JSON.stringify(t, null, 2)), a.onChange?.(t);
|
|
1249
1408
|
},
|
|
1250
|
-
[
|
|
1409
|
+
[t]
|
|
1251
1410
|
);
|
|
1252
|
-
const
|
|
1253
|
-
(
|
|
1254
|
-
const
|
|
1255
|
-
|
|
1411
|
+
const T = N(
|
|
1412
|
+
(x) => {
|
|
1413
|
+
const b = $(x);
|
|
1414
|
+
u.current?.hasTextFocus() && jt(x) && !S(b, t) && (o(b), m((V) => V + 1));
|
|
1256
1415
|
},
|
|
1257
|
-
[
|
|
1416
|
+
[t]
|
|
1258
1417
|
);
|
|
1259
1418
|
return /* @__PURE__ */ e.jsx(
|
|
1260
|
-
|
|
1419
|
+
et,
|
|
1261
1420
|
{
|
|
1262
|
-
hint:
|
|
1263
|
-
feedback:
|
|
1421
|
+
hint: a.hint,
|
|
1422
|
+
feedback: a.feedback,
|
|
1264
1423
|
className: "h-full [&>div:first-of-type]:h-full",
|
|
1265
1424
|
children: /* @__PURE__ */ e.jsxs("section", { className: "flex h-full", children: [
|
|
1266
1425
|
/* @__PURE__ */ e.jsxs(
|
|
1267
1426
|
"div",
|
|
1268
1427
|
{
|
|
1269
|
-
className: `shrink-0 basis-3/5 overflow-x-auto relative flex flex-col ${
|
|
1428
|
+
className: `shrink-0 basis-3/5 overflow-x-auto relative flex flex-col ${n ? "" : "grow"}`,
|
|
1270
1429
|
children: [
|
|
1271
1430
|
/* @__PURE__ */ e.jsxs("header", { className: "w-full bg-white border-b border-gray-200 py-3 px-8 flex text-[13px] gap-4 text-gray-400 font-semibold items-center", children: [
|
|
1272
1431
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-4 flex-wrap", children: [
|
|
1273
|
-
|
|
1274
|
-
const
|
|
1432
|
+
t.rules.map((x, b) => {
|
|
1433
|
+
const V = `#${(b + 1).toString().padStart(2, "0")}`;
|
|
1275
1434
|
return /* @__PURE__ */ e.jsx(
|
|
1276
1435
|
"button",
|
|
1277
1436
|
{
|
|
1278
1437
|
type: "button",
|
|
1279
1438
|
className: _("font-bold", {
|
|
1280
|
-
"text-black":
|
|
1439
|
+
"text-black": s === b
|
|
1281
1440
|
}),
|
|
1282
1441
|
onClick: () => {
|
|
1283
|
-
r(
|
|
1442
|
+
r(b);
|
|
1284
1443
|
},
|
|
1285
|
-
children:
|
|
1444
|
+
children: V
|
|
1286
1445
|
},
|
|
1287
|
-
`${
|
|
1446
|
+
`${s}-${x.id}`
|
|
1288
1447
|
);
|
|
1289
1448
|
}),
|
|
1290
1449
|
/* @__PURE__ */ e.jsx(
|
|
@@ -1295,13 +1454,13 @@ function $e(t) {
|
|
|
1295
1454
|
"text-black": !0
|
|
1296
1455
|
}),
|
|
1297
1456
|
onClick: () => {
|
|
1298
|
-
|
|
1457
|
+
l(`rules.${t.rules.length}`, {
|
|
1299
1458
|
name: "Rule name",
|
|
1300
1459
|
actions: [null],
|
|
1301
1460
|
conditions: [null]
|
|
1302
|
-
}), r(
|
|
1461
|
+
}), r(t.rules.length);
|
|
1303
1462
|
},
|
|
1304
|
-
children: /* @__PURE__ */ e.jsx(
|
|
1463
|
+
children: /* @__PURE__ */ e.jsx(h, { name: "plus", size: 16, className: "shrink-0" })
|
|
1305
1464
|
}
|
|
1306
1465
|
)
|
|
1307
1466
|
] }),
|
|
@@ -1311,41 +1470,41 @@ function $e(t) {
|
|
|
1311
1470
|
type: "button",
|
|
1312
1471
|
className: "text-blue-600 hover:text-blue-700 focus:outline-hidden focus:ring-2 focus:ring-blue-500",
|
|
1313
1472
|
onClick: () => {
|
|
1314
|
-
i(!
|
|
1473
|
+
i(!n);
|
|
1315
1474
|
},
|
|
1316
|
-
children: /* @__PURE__ */ e.jsx(
|
|
1475
|
+
children: /* @__PURE__ */ e.jsx(h, { name: "sidebarSimple", size: 16, color: "#101111" })
|
|
1317
1476
|
}
|
|
1318
1477
|
) })
|
|
1319
1478
|
] }),
|
|
1320
|
-
/* @__PURE__ */ e.jsxs(
|
|
1479
|
+
/* @__PURE__ */ e.jsxs(wt, { children: [
|
|
1321
1480
|
/* @__PURE__ */ e.jsxs("div", { className: "mb-8 flex items-center gap-2", children: [
|
|
1322
|
-
/* @__PURE__ */ e.jsx(
|
|
1323
|
-
/* @__PURE__ */ e.jsx(
|
|
1481
|
+
/* @__PURE__ */ e.jsx(vt, {}),
|
|
1482
|
+
/* @__PURE__ */ e.jsx(h, { name: "pencilSimple", size: 16, className: "shrink-0" })
|
|
1324
1483
|
] }),
|
|
1325
|
-
/* @__PURE__ */ e.jsx(
|
|
1326
|
-
/* @__PURE__ */ e.jsx(
|
|
1327
|
-
/* @__PURE__ */ e.jsxs(
|
|
1484
|
+
/* @__PURE__ */ e.jsx(J, { title: "Actions", icon: "lightning", children: /* @__PURE__ */ e.jsx(dt, { actions: c?.actions }) }),
|
|
1485
|
+
/* @__PURE__ */ e.jsx(Nt, { children: "when" }),
|
|
1486
|
+
/* @__PURE__ */ e.jsxs(J, { title: "Conditions", icon: "treeView", children: [
|
|
1328
1487
|
/* @__PURE__ */ e.jsx(
|
|
1329
|
-
|
|
1488
|
+
Q,
|
|
1330
1489
|
{
|
|
1331
|
-
item:
|
|
1332
|
-
pathPrefix: `rules.${
|
|
1490
|
+
item: c,
|
|
1491
|
+
pathPrefix: `rules.${s}`
|
|
1333
1492
|
}
|
|
1334
1493
|
),
|
|
1335
1494
|
/* @__PURE__ */ e.jsx("div", { className: "mt-6", children: /* @__PURE__ */ e.jsxs(
|
|
1336
|
-
|
|
1495
|
+
P,
|
|
1337
1496
|
{
|
|
1338
1497
|
size: "small",
|
|
1339
1498
|
variant: "secondary",
|
|
1340
1499
|
alignItems: "center",
|
|
1341
1500
|
onClick: () => {
|
|
1342
|
-
|
|
1343
|
-
`rules.${
|
|
1501
|
+
l(
|
|
1502
|
+
`rules.${s}.conditions.${c?.conditions?.length ?? 0}`,
|
|
1344
1503
|
void 0
|
|
1345
1504
|
);
|
|
1346
1505
|
},
|
|
1347
1506
|
children: [
|
|
1348
|
-
/* @__PURE__ */ e.jsx(
|
|
1507
|
+
/* @__PURE__ */ e.jsx(h, { name: "plusCircle" }),
|
|
1349
1508
|
" Add condition"
|
|
1350
1509
|
]
|
|
1351
1510
|
}
|
|
@@ -1356,48 +1515,48 @@ function $e(t) {
|
|
|
1356
1515
|
},
|
|
1357
1516
|
d
|
|
1358
1517
|
),
|
|
1359
|
-
|
|
1360
|
-
|
|
1518
|
+
n && /* @__PURE__ */ e.jsx("div", { className: "shrink-0 basis-2/5", children: /* @__PURE__ */ e.jsx(
|
|
1519
|
+
at,
|
|
1361
1520
|
{
|
|
1362
|
-
ref:
|
|
1363
|
-
name:
|
|
1521
|
+
ref: u,
|
|
1522
|
+
name: a.id ?? a.name,
|
|
1364
1523
|
height: "100%",
|
|
1365
1524
|
language: "json",
|
|
1366
|
-
jsonSchema:
|
|
1367
|
-
defaultValue: JSON.stringify(
|
|
1525
|
+
jsonSchema: a.schemaType,
|
|
1526
|
+
defaultValue: JSON.stringify(t, null, 2),
|
|
1368
1527
|
noRounding: !0,
|
|
1369
|
-
onChange:
|
|
1528
|
+
onChange: T
|
|
1370
1529
|
}
|
|
1371
1530
|
) })
|
|
1372
1531
|
] })
|
|
1373
1532
|
}
|
|
1374
1533
|
);
|
|
1375
1534
|
}
|
|
1376
|
-
function
|
|
1535
|
+
function Nt({ children: a }) {
|
|
1377
1536
|
return /* @__PURE__ */ e.jsxs("div", { className: "text-gray-500 flex items-center justify-center flex-col", children: [
|
|
1378
1537
|
/* @__PURE__ */ e.jsx("div", { className: "h-6 w-[2px] bg-gray-200" }),
|
|
1379
|
-
/* @__PURE__ */ e.jsx("span", { className: "font-bold my-1 bg-gray-200 px-3 relative uppercase rounded h-[25px] items-center flex text-sm", children:
|
|
1538
|
+
/* @__PURE__ */ e.jsx("span", { className: "font-bold my-1 bg-gray-200 px-3 relative uppercase rounded h-[25px] items-center flex text-sm", children: a }),
|
|
1380
1539
|
/* @__PURE__ */ e.jsx("div", { className: "h-6 w-[2px] bg-gray-200" })
|
|
1381
1540
|
] });
|
|
1382
1541
|
}
|
|
1383
|
-
function
|
|
1384
|
-
children:
|
|
1385
|
-
title:
|
|
1386
|
-
icon:
|
|
1542
|
+
function J({
|
|
1543
|
+
children: a,
|
|
1544
|
+
title: t,
|
|
1545
|
+
icon: s
|
|
1387
1546
|
}) {
|
|
1388
1547
|
return /* @__PURE__ */ e.jsxs("div", { className: "rounded-md bg-white shadow-xs", children: [
|
|
1389
1548
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-4 py-4 border-b border-gray-100", children: [
|
|
1390
|
-
/* @__PURE__ */ e.jsx("div", { className: "w-8 h-8 -ml-4 bg-white rounded-full border border-gray-200 flex items-center justify-center shadow-xs shadow-primary-200", children: /* @__PURE__ */ e.jsx(
|
|
1391
|
-
/* @__PURE__ */ e.jsx("h2", { className: "text-lg font-semibold", children:
|
|
1549
|
+
/* @__PURE__ */ e.jsx("div", { className: "w-8 h-8 -ml-4 bg-white rounded-full border border-gray-200 flex items-center justify-center shadow-xs shadow-primary-200", children: /* @__PURE__ */ e.jsx(h, { name: s }) }),
|
|
1550
|
+
/* @__PURE__ */ e.jsx("h2", { className: "text-lg font-semibold", children: t })
|
|
1392
1551
|
] }),
|
|
1393
|
-
/* @__PURE__ */ e.jsx("div", { className: "p-6", children:
|
|
1552
|
+
/* @__PURE__ */ e.jsx("div", { className: "p-6", children: a })
|
|
1394
1553
|
] });
|
|
1395
1554
|
}
|
|
1396
|
-
function
|
|
1397
|
-
children:
|
|
1555
|
+
function wt({
|
|
1556
|
+
children: a
|
|
1398
1557
|
}) {
|
|
1399
|
-
return /* @__PURE__ */ e.jsx("div", { className: "h-full w-full bg-gray-50 p-8 bg-[radial-gradient(#d6d6d6_1px,transparent_1px)] bg-size-[16px_16px] overflow-auto", children: /* @__PURE__ */ e.jsx("div", { className: "max-w-[900px] mx-auto", children:
|
|
1558
|
+
return /* @__PURE__ */ e.jsx("div", { className: "h-full w-full bg-gray-50 p-8 bg-[radial-gradient(#d6d6d6_1px,transparent_1px)] bg-size-[16px_16px] overflow-auto", children: /* @__PURE__ */ e.jsx("div", { className: "max-w-[900px] mx-auto", children: a }) });
|
|
1400
1559
|
}
|
|
1401
1560
|
export {
|
|
1402
|
-
|
|
1561
|
+
Et as RuleEngine
|
|
1403
1562
|
};
|