@commercelayer/app-elements 6.1.1 → 6.2.0
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-CkXAs3q3.js → InputDateComponent-UwtWZIAZ.js} +2083 -2018
- package/dist/{RuleEngineComponent-Dg3KtMkk.js → RuleEngineComponent-Buq74QNO.js} +704 -688
- package/dist/{main-Dv_RZ0zk.js → main-3wm3lckW.js} +5078 -5037
- package/dist/main.js +1 -1
- package/dist/{parseISO-BVgVyT7w.js → parseISO-DFFsG4qz.js} +1 -1
- package/dist/providers/CoreSdkProvider/useCoreApi.d.ts +4 -2
- package/dist/style.css +1 -1
- package/dist/ui/atoms/Icon/icons.d.ts +1 -1
- package/dist/ui/forms/RuleEngine/Condition/ValueComponents/InputArrayMatch.d.ts +1 -1
- package/dist/ui/forms/RuleEngine/Condition/ValueComponents/InputNumberRange.d.ts +1 -1
- package/dist/ui/forms/RuleEngine/Condition/ValueComponents/InputTextRange.d.ts +1 -1
- package/dist/vendor.css +2 -2
- package/package.json +23 -23
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { t as
|
|
3
|
-
import O, { useReducer as ua, useCallback as C, useMemo as da, createContext as ma, useContext as pa, useRef as
|
|
2
|
+
import { t as Z, B as re, D as le, E as ie, I as oe, N as ce, O as ue, P as de, Z as R, b as me, d as pe, e as fe, f as he, g as ge, h as ye, i as be, j as xe, k as ve, l as D, n as je, o as _e, p as Te, q as Ne, r as we, s as Ee, u as Ce, v as $e, w as Se, x as Re, y as ke, z as Ve, A as Ae, C as Ie, F as Ze, G as De, H as Me, J as Oe, K as qe, L as Pe, M as Le, Q as Fe, R as Ue, S as ze, T as Je, U as We, V as Be, W as Ye, X as Ge, Y as Xe, _ as He, $ as Qe, a0 as Ke, a1 as et, a2 as tt, a3 as at, a4 as st, a5 as nt, a6 as rt, a7 as lt, a8 as it, a9 as M, aa as ot, ab as ct, ac as ut, ad as dt, ae as mt, af as pt, ag as ft, ah as ht, ai as gt, aj as yt, ak as bt, al as xt, am as vt, an as jt, ao as _t, ap as Tt, aq as Nt, ar as wt, as as Et, at as Ct, au as $t, av as St, aw as Rt, ax as kt, ay as Vt, az as At, aA as It, aB as Zt, aC as Dt, aD as Mt, aE as Ot, aF as qt, aG as Pt, aH as Lt, aI as Ft, aJ as Ut, aK as zt, aL as Jt, aM as Wt, aN as Bt, aO as Yt, aP as Gt, aQ as Xt, aR as Ht, aS as Qt, aT as Kt, aU as t, aV as k, aW as ea, aX as ta, aY as aa, aZ as j, a_ as E, a$ as sa, b0 as W, b1 as b, b2 as A, b3 as w, b4 as v, b5 as N, b6 as na, b7 as $, b8 as B, b9 as Y, ba as G, bb as ra, bc as la, bd as X, be as V, bf as ia, bg as oa, bh as ca } from "./main-3wm3lckW.js";
|
|
3
|
+
import O, { useReducer as ua, useCallback as C, useMemo as da, createContext as ma, useContext as pa, useRef as H, useState as f, useEffect as _ } from "react";
|
|
4
4
|
import "react-hook-form";
|
|
5
5
|
import "wouter";
|
|
6
|
-
import { p as
|
|
7
|
-
function
|
|
8
|
-
const
|
|
6
|
+
import { p as q } from "./parseISO-DFFsG4qz.js";
|
|
7
|
+
function P(e, s) {
|
|
8
|
+
const a = e.match(
|
|
9
9
|
/(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2}):(\d{2})(?:\.(\d{0,7}))?(?:Z|(.)(\d{2}):?(\d{2})?)?/
|
|
10
10
|
);
|
|
11
|
-
return
|
|
11
|
+
return a ? Z(
|
|
12
12
|
Date.UTC(
|
|
13
|
-
+
|
|
14
|
-
+
|
|
15
|
-
+
|
|
16
|
-
+
|
|
17
|
-
+
|
|
18
|
-
+
|
|
19
|
-
+((
|
|
13
|
+
+a[1],
|
|
14
|
+
+a[2] - 1,
|
|
15
|
+
+a[3],
|
|
16
|
+
+a[4] - (+a[9] || 0) * (a[8] == "-" ? -1 : 1),
|
|
17
|
+
+a[5] - (+a[10] || 0) * (a[8] == "-" ? -1 : 1),
|
|
18
|
+
+a[6],
|
|
19
|
+
+((a[7] || "0") + "00").substring(0, 3)
|
|
20
20
|
),
|
|
21
|
-
|
|
22
|
-
) :
|
|
21
|
+
s?.in
|
|
22
|
+
) : Z(NaN, s?.in);
|
|
23
23
|
}
|
|
24
24
|
const y = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
25
25
|
__proto__: null,
|
|
@@ -30,17 +30,17 @@ const y = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
30
30
|
NEVER: ce,
|
|
31
31
|
OK: ue,
|
|
32
32
|
ParseStatus: de,
|
|
33
|
-
Schema:
|
|
33
|
+
Schema: R,
|
|
34
34
|
ZodAny: me,
|
|
35
35
|
ZodArray: pe,
|
|
36
36
|
ZodBigInt: fe,
|
|
37
37
|
ZodBoolean: he,
|
|
38
|
-
ZodBranded:
|
|
39
|
-
ZodCatch:
|
|
38
|
+
ZodBranded: ge,
|
|
39
|
+
ZodCatch: ye,
|
|
40
40
|
ZodDate: be,
|
|
41
41
|
ZodDefault: xe,
|
|
42
42
|
ZodDiscriminatedUnion: ve,
|
|
43
|
-
ZodEffects:
|
|
43
|
+
ZodEffects: D,
|
|
44
44
|
ZodEnum: je,
|
|
45
45
|
ZodError: _e,
|
|
46
46
|
get ZodFirstPartyTypeKind() {
|
|
@@ -48,37 +48,37 @@ const y = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
48
48
|
},
|
|
49
49
|
ZodFunction: Ne,
|
|
50
50
|
ZodIntersection: we,
|
|
51
|
-
ZodIssueCode:
|
|
51
|
+
ZodIssueCode: Ee,
|
|
52
52
|
ZodLazy: Ce,
|
|
53
|
-
ZodLiteral:
|
|
54
|
-
ZodMap:
|
|
55
|
-
ZodNaN:
|
|
56
|
-
ZodNativeEnum:
|
|
57
|
-
ZodNever:
|
|
53
|
+
ZodLiteral: $e,
|
|
54
|
+
ZodMap: Se,
|
|
55
|
+
ZodNaN: Re,
|
|
56
|
+
ZodNativeEnum: ke,
|
|
57
|
+
ZodNever: Ve,
|
|
58
58
|
ZodNull: Ae,
|
|
59
59
|
ZodNullable: Ie,
|
|
60
60
|
ZodNumber: Ze,
|
|
61
61
|
ZodObject: De,
|
|
62
62
|
ZodOptional: Me,
|
|
63
|
-
ZodParsedType:
|
|
64
|
-
ZodPipeline:
|
|
65
|
-
ZodPromise:
|
|
66
|
-
ZodReadonly:
|
|
67
|
-
ZodRecord:
|
|
68
|
-
ZodSchema:
|
|
69
|
-
ZodSet:
|
|
70
|
-
ZodString:
|
|
63
|
+
ZodParsedType: Oe,
|
|
64
|
+
ZodPipeline: qe,
|
|
65
|
+
ZodPromise: Pe,
|
|
66
|
+
ZodReadonly: Le,
|
|
67
|
+
ZodRecord: Fe,
|
|
68
|
+
ZodSchema: R,
|
|
69
|
+
ZodSet: Ue,
|
|
70
|
+
ZodString: ze,
|
|
71
71
|
ZodSymbol: Je,
|
|
72
|
-
ZodTransformer:
|
|
72
|
+
ZodTransformer: D,
|
|
73
73
|
ZodTuple: We,
|
|
74
|
-
ZodType:
|
|
74
|
+
ZodType: R,
|
|
75
75
|
ZodUndefined: Be,
|
|
76
|
-
ZodUnion:
|
|
77
|
-
ZodUnknown:
|
|
76
|
+
ZodUnion: Ye,
|
|
77
|
+
ZodUnknown: Ge,
|
|
78
78
|
ZodVoid: Xe,
|
|
79
79
|
addIssueToContext: He,
|
|
80
|
-
any:
|
|
81
|
-
array:
|
|
80
|
+
any: Qe,
|
|
81
|
+
array: Ke,
|
|
82
82
|
bigint: et,
|
|
83
83
|
boolean: tt,
|
|
84
84
|
coerce: at,
|
|
@@ -87,7 +87,7 @@ const y = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
87
87
|
datetimeRegex: rt,
|
|
88
88
|
defaultErrorMap: lt,
|
|
89
89
|
discriminatedUnion: it,
|
|
90
|
-
effect:
|
|
90
|
+
effect: M,
|
|
91
91
|
enum: ot,
|
|
92
92
|
function: ct,
|
|
93
93
|
getErrorMap: ut,
|
|
@@ -96,8 +96,8 @@ const y = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
96
96
|
intersection: pt,
|
|
97
97
|
isAborted: ft,
|
|
98
98
|
isAsync: ht,
|
|
99
|
-
isDirty:
|
|
100
|
-
isValid:
|
|
99
|
+
isDirty: gt,
|
|
100
|
+
isValid: yt,
|
|
101
101
|
late: bt,
|
|
102
102
|
lazy: xt,
|
|
103
103
|
literal: vt,
|
|
@@ -106,74 +106,74 @@ const y = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
106
106
|
nan: Tt,
|
|
107
107
|
nativeEnum: Nt,
|
|
108
108
|
never: wt,
|
|
109
|
-
null:
|
|
109
|
+
null: Et,
|
|
110
110
|
nullable: Ct,
|
|
111
|
-
number:
|
|
112
|
-
object:
|
|
111
|
+
number: $t,
|
|
112
|
+
object: St,
|
|
113
113
|
get objectUtil() {
|
|
114
|
-
return
|
|
114
|
+
return Rt;
|
|
115
115
|
},
|
|
116
|
-
oboolean:
|
|
117
|
-
onumber:
|
|
116
|
+
oboolean: kt,
|
|
117
|
+
onumber: Vt,
|
|
118
118
|
optional: At,
|
|
119
119
|
ostring: It,
|
|
120
120
|
pipeline: Zt,
|
|
121
121
|
preprocess: Dt,
|
|
122
122
|
promise: Mt,
|
|
123
|
-
quotelessJson:
|
|
124
|
-
record:
|
|
125
|
-
set:
|
|
126
|
-
setErrorMap:
|
|
127
|
-
strictObject:
|
|
128
|
-
string:
|
|
129
|
-
symbol:
|
|
130
|
-
transformer:
|
|
123
|
+
quotelessJson: Ot,
|
|
124
|
+
record: qt,
|
|
125
|
+
set: Pt,
|
|
126
|
+
setErrorMap: Lt,
|
|
127
|
+
strictObject: Ft,
|
|
128
|
+
string: Ut,
|
|
129
|
+
symbol: zt,
|
|
130
|
+
transformer: M,
|
|
131
131
|
tuple: Jt,
|
|
132
132
|
undefined: Wt,
|
|
133
133
|
union: Bt,
|
|
134
|
-
unknown:
|
|
134
|
+
unknown: Yt,
|
|
135
135
|
get util() {
|
|
136
|
-
return
|
|
136
|
+
return Gt;
|
|
137
137
|
},
|
|
138
138
|
void: Xt
|
|
139
139
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
140
140
|
var fa = 1, ha = 4;
|
|
141
|
-
function
|
|
142
|
-
return Ht(
|
|
141
|
+
function ga(e) {
|
|
142
|
+
return Ht(e, fa | ha);
|
|
143
143
|
}
|
|
144
|
-
function
|
|
145
|
-
return
|
|
144
|
+
function L(e, s, a) {
|
|
145
|
+
return e == null ? e : Qt(e, s, a);
|
|
146
146
|
}
|
|
147
|
-
function
|
|
148
|
-
return
|
|
147
|
+
function F(e, s) {
|
|
148
|
+
return e == null ? !0 : Kt(e, s);
|
|
149
149
|
}
|
|
150
150
|
const Q = ma(
|
|
151
151
|
void 0
|
|
152
152
|
);
|
|
153
|
-
function
|
|
154
|
-
switch (
|
|
153
|
+
function ya(e, s) {
|
|
154
|
+
switch (s.type) {
|
|
155
155
|
case "SET_PATH": {
|
|
156
|
-
const
|
|
157
|
-
if (
|
|
158
|
-
if (/\.\d+$/.test(
|
|
159
|
-
const
|
|
160
|
-
Array.isArray(
|
|
156
|
+
const a = ga(e.value);
|
|
157
|
+
if (s.value === null)
|
|
158
|
+
if (/\.\d+$/.test(s.path)) {
|
|
159
|
+
const n = s.path.replace(/\.\d+$/, ""), c = parseInt(s.path.match(/\d+$/)?.[0] ?? "0", 10), o = ea(a, n);
|
|
160
|
+
Array.isArray(o) && (o.splice(c, 1), L(a, n, o), o.length === 0 && n.endsWith(".nested.conditions") && F(a, n.replace(/\.conditions$/, "")));
|
|
161
161
|
} else
|
|
162
|
-
|
|
162
|
+
F(a, s.path);
|
|
163
163
|
else
|
|
164
|
-
|
|
164
|
+
L(a, s.path, s.value);
|
|
165
165
|
return {
|
|
166
|
-
...
|
|
167
|
-
value:
|
|
166
|
+
...e,
|
|
167
|
+
value: a
|
|
168
168
|
};
|
|
169
169
|
}
|
|
170
170
|
case "SET_SELECTED_RULE_INDEX":
|
|
171
171
|
return {
|
|
172
|
-
...
|
|
173
|
-
selectedRuleIndex:
|
|
172
|
+
...e,
|
|
173
|
+
selectedRuleIndex: s.index
|
|
174
174
|
};
|
|
175
175
|
case "SET_VALUE":
|
|
176
|
-
return
|
|
176
|
+
return k(e.value, s.value) ? e : (s.value.rules?.length ?? 0) === 0 ? {
|
|
177
177
|
selectedRuleIndex: 0,
|
|
178
178
|
value: {
|
|
179
179
|
rules: [
|
|
@@ -187,99 +187,99 @@ function ga(t, a) {
|
|
|
187
187
|
]
|
|
188
188
|
}
|
|
189
189
|
} : {
|
|
190
|
-
...
|
|
191
|
-
value:
|
|
190
|
+
...e,
|
|
191
|
+
value: s.value
|
|
192
192
|
};
|
|
193
193
|
default:
|
|
194
|
-
return
|
|
194
|
+
return e;
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
function ba({
|
|
198
|
-
children:
|
|
199
|
-
initialValue:
|
|
198
|
+
children: e,
|
|
199
|
+
initialValue: s
|
|
200
200
|
}) {
|
|
201
|
-
const [
|
|
202
|
-
value:
|
|
201
|
+
const [a, n] = ua(ya, {
|
|
202
|
+
value: s.value,
|
|
203
203
|
selectedRuleIndex: 0
|
|
204
|
-
}), c = C((u,
|
|
205
|
-
|
|
206
|
-
}, []),
|
|
207
|
-
|
|
208
|
-
|
|
204
|
+
}), c = C((u, l) => {
|
|
205
|
+
n({ type: "SET_PATH", path: u, value: l });
|
|
206
|
+
}, []), o = C((u) => {
|
|
207
|
+
n({ type: "SET_SELECTED_RULE_INDEX", index: u }), u < 0 && setTimeout(() => {
|
|
208
|
+
n({ type: "SET_SELECTED_RULE_INDEX", index: 0 });
|
|
209
209
|
}, 50);
|
|
210
|
-
}, []),
|
|
211
|
-
|
|
212
|
-
}, []),
|
|
210
|
+
}, []), i = C((u) => {
|
|
211
|
+
n({ type: "SET_VALUE", value: u });
|
|
212
|
+
}, []), r = da(
|
|
213
213
|
() => ({
|
|
214
|
-
state:
|
|
214
|
+
state: a,
|
|
215
215
|
setPath: c,
|
|
216
|
-
setSelectedRuleIndex:
|
|
217
|
-
setValue:
|
|
218
|
-
availableActionTypes:
|
|
219
|
-
schemaType:
|
|
216
|
+
setSelectedRuleIndex: o,
|
|
217
|
+
setValue: i,
|
|
218
|
+
availableActionTypes: s.availableActionTypes,
|
|
219
|
+
schemaType: s.schemaType
|
|
220
220
|
}),
|
|
221
221
|
[
|
|
222
|
-
|
|
222
|
+
a,
|
|
223
223
|
c,
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
224
|
+
o,
|
|
225
|
+
i,
|
|
226
|
+
s.availableActionTypes,
|
|
227
|
+
s.schemaType
|
|
228
228
|
]
|
|
229
229
|
);
|
|
230
|
-
return /* @__PURE__ */
|
|
230
|
+
return /* @__PURE__ */ t.jsx(Q.Provider, { value: r, children: e });
|
|
231
231
|
}
|
|
232
|
-
function
|
|
233
|
-
const
|
|
234
|
-
if (
|
|
232
|
+
function g() {
|
|
233
|
+
const e = pa(Q);
|
|
234
|
+
if (e === void 0)
|
|
235
235
|
throw new Error("useRuleEngine must be used within a RuleEngineProvider");
|
|
236
|
-
return
|
|
236
|
+
return e;
|
|
237
237
|
}
|
|
238
|
-
function
|
|
239
|
-
value:
|
|
240
|
-
name:
|
|
241
|
-
preset:
|
|
238
|
+
function K({
|
|
239
|
+
value: e,
|
|
240
|
+
name: s,
|
|
241
|
+
preset: a
|
|
242
242
|
}) {
|
|
243
|
-
const { setPath:
|
|
244
|
-
(
|
|
245
|
-
(
|
|
246
|
-
).map((
|
|
247
|
-
value:
|
|
248
|
-
label:
|
|
243
|
+
const { setPath: n, schemaType: c } = g(), { t: o } = ta(), i = H(null), r = c === "order-rules" ? "order" : c === "price-rules" ? "price" : void 0, u = aa(
|
|
244
|
+
(a === "condition" ? xa : a === "action" ? va : []).filter(
|
|
245
|
+
(l) => r != null && l.startsWith(r)
|
|
246
|
+
).map((l) => ({
|
|
247
|
+
value: l,
|
|
248
|
+
label: o(`resource_paths.${l}`).replace(
|
|
249
249
|
"resource_paths.",
|
|
250
250
|
""
|
|
251
251
|
)
|
|
252
252
|
})),
|
|
253
253
|
"label"
|
|
254
254
|
);
|
|
255
|
-
return /* @__PURE__ */
|
|
256
|
-
|
|
255
|
+
return /* @__PURE__ */ t.jsx(
|
|
256
|
+
j,
|
|
257
257
|
{
|
|
258
|
-
ref:
|
|
259
|
-
name:
|
|
258
|
+
ref: i,
|
|
259
|
+
name: s,
|
|
260
260
|
initialValues: u,
|
|
261
|
-
defaultValue:
|
|
262
|
-
value:
|
|
263
|
-
label:
|
|
261
|
+
defaultValue: e != null ? u.find((l) => l.value === e) ?? {
|
|
262
|
+
value: e,
|
|
263
|
+
label: e
|
|
264
264
|
} : void 0,
|
|
265
265
|
asTextSearch: !0,
|
|
266
266
|
isCreatable: !0,
|
|
267
|
-
loadAsyncValues: async (
|
|
268
|
-
if (
|
|
267
|
+
loadAsyncValues: async (l) => {
|
|
268
|
+
if (r == null)
|
|
269
269
|
return [];
|
|
270
270
|
const d = u.filter(
|
|
271
|
-
(
|
|
272
|
-
),
|
|
273
|
-
const
|
|
271
|
+
(m) => m.label.includes(l)
|
|
272
|
+
), p = (await sa([r], l)).filter((m) => m.value.startsWith(l)).map((m) => {
|
|
273
|
+
const T = m.type === "relationship" || m.value.endsWith(".metadata") ? `${m.value}.` : m.value;
|
|
274
274
|
return {
|
|
275
|
-
value:
|
|
276
|
-
label:
|
|
275
|
+
value: T,
|
|
276
|
+
label: T
|
|
277
277
|
};
|
|
278
|
-
}),
|
|
278
|
+
}), x = l.includes(".metadata") ? [{ label: l, value: l }] : [], h = [...d, ...p, ...x];
|
|
279
279
|
return console.log("results", h), h;
|
|
280
280
|
},
|
|
281
|
-
onSelect: async (
|
|
282
|
-
|
|
281
|
+
onSelect: async (l) => {
|
|
282
|
+
E(l) && (n(s, l.value), l.value.toString().endsWith(".") && i.current?.openMenu("first"));
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
285
|
);
|
|
@@ -340,74 +340,74 @@ const xa = [
|
|
|
340
340
|
"price"
|
|
341
341
|
];
|
|
342
342
|
function ja({
|
|
343
|
-
item:
|
|
344
|
-
pathPrefix:
|
|
343
|
+
item: e,
|
|
344
|
+
pathPrefix: s
|
|
345
345
|
}) {
|
|
346
|
-
const { setPath:
|
|
347
|
-
if (
|
|
346
|
+
const { setPath: a } = g();
|
|
347
|
+
if (e == null)
|
|
348
348
|
return null;
|
|
349
|
-
switch (
|
|
349
|
+
switch (e.type) {
|
|
350
350
|
case "buy_x_pay_y":
|
|
351
|
-
return /* @__PURE__ */
|
|
352
|
-
/* @__PURE__ */
|
|
353
|
-
|
|
351
|
+
return /* @__PURE__ */ t.jsxs("div", { className: "w-36 flex items-center gap-0.5", children: [
|
|
352
|
+
/* @__PURE__ */ t.jsx(
|
|
353
|
+
b,
|
|
354
354
|
{
|
|
355
|
-
name: `${
|
|
355
|
+
name: `${s}.value.x`,
|
|
356
356
|
type: "number",
|
|
357
357
|
suffix: "X",
|
|
358
|
-
defaultValue:
|
|
359
|
-
onChange: (
|
|
360
|
-
|
|
361
|
-
`${
|
|
362
|
-
parseInt(
|
|
358
|
+
defaultValue: e.value?.x,
|
|
359
|
+
onChange: (n) => {
|
|
360
|
+
a(
|
|
361
|
+
`${s}.value.x`,
|
|
362
|
+
parseInt(n.currentTarget.value, 10)
|
|
363
363
|
);
|
|
364
364
|
}
|
|
365
365
|
}
|
|
366
366
|
),
|
|
367
|
-
/* @__PURE__ */
|
|
368
|
-
|
|
367
|
+
/* @__PURE__ */ t.jsx(
|
|
368
|
+
b,
|
|
369
369
|
{
|
|
370
|
-
name: `${
|
|
370
|
+
name: `${s}.value.y`,
|
|
371
371
|
type: "number",
|
|
372
372
|
suffix: "Y",
|
|
373
|
-
defaultValue:
|
|
374
|
-
onChange: (
|
|
375
|
-
|
|
376
|
-
`${
|
|
377
|
-
parseInt(
|
|
373
|
+
defaultValue: e.value?.y,
|
|
374
|
+
onChange: (n) => {
|
|
375
|
+
a(
|
|
376
|
+
`${s}.value.y`,
|
|
377
|
+
parseInt(n.currentTarget.value, 10)
|
|
378
378
|
);
|
|
379
379
|
}
|
|
380
380
|
}
|
|
381
381
|
)
|
|
382
382
|
] });
|
|
383
383
|
case "every_x_discount_y":
|
|
384
|
-
return /* @__PURE__ */
|
|
385
|
-
/* @__PURE__ */
|
|
386
|
-
|
|
384
|
+
return /* @__PURE__ */ t.jsxs("div", { className: "w-36 flex items-center gap-0.5", children: [
|
|
385
|
+
/* @__PURE__ */ t.jsx(
|
|
386
|
+
b,
|
|
387
387
|
{
|
|
388
|
-
name: `${
|
|
388
|
+
name: `${s}.value.x`,
|
|
389
389
|
type: "number",
|
|
390
390
|
suffix: "X",
|
|
391
|
-
defaultValue:
|
|
392
|
-
onChange: (
|
|
393
|
-
|
|
394
|
-
`${
|
|
395
|
-
parseInt(
|
|
391
|
+
defaultValue: e.value?.x,
|
|
392
|
+
onChange: (n) => {
|
|
393
|
+
a(
|
|
394
|
+
`${s}.value.x`,
|
|
395
|
+
parseInt(n.currentTarget.value, 10)
|
|
396
396
|
);
|
|
397
397
|
}
|
|
398
398
|
}
|
|
399
399
|
),
|
|
400
|
-
/* @__PURE__ */
|
|
401
|
-
|
|
400
|
+
/* @__PURE__ */ t.jsx(
|
|
401
|
+
b,
|
|
402
402
|
{
|
|
403
|
-
name: `${
|
|
403
|
+
name: `${s}.value.y`,
|
|
404
404
|
type: "number",
|
|
405
405
|
suffix: "Y",
|
|
406
|
-
defaultValue:
|
|
407
|
-
onChange: (
|
|
408
|
-
|
|
409
|
-
`${
|
|
410
|
-
parseInt(
|
|
406
|
+
defaultValue: e.value?.y,
|
|
407
|
+
onChange: (n) => {
|
|
408
|
+
a(
|
|
409
|
+
`${s}.value.y`,
|
|
410
|
+
parseInt(n.currentTarget.value, 10)
|
|
411
411
|
);
|
|
412
412
|
}
|
|
413
413
|
}
|
|
@@ -415,36 +415,36 @@ function ja({
|
|
|
415
415
|
] });
|
|
416
416
|
case "fixed_amount":
|
|
417
417
|
case "fixed_price":
|
|
418
|
-
return /* @__PURE__ */
|
|
419
|
-
|
|
418
|
+
return /* @__PURE__ */ t.jsx("div", { className: "w-36", children: /* @__PURE__ */ t.jsx(
|
|
419
|
+
b,
|
|
420
420
|
{
|
|
421
|
-
name: `${
|
|
421
|
+
name: `${s}.value`,
|
|
422
422
|
type: "number",
|
|
423
|
-
defaultValue:
|
|
423
|
+
defaultValue: e.value,
|
|
424
424
|
min: 0,
|
|
425
425
|
suffix: "cents",
|
|
426
|
-
onChange: (
|
|
427
|
-
|
|
428
|
-
`${
|
|
429
|
-
parseInt(
|
|
426
|
+
onChange: (n) => {
|
|
427
|
+
a(
|
|
428
|
+
`${s}.value`,
|
|
429
|
+
parseInt(n.currentTarget.value, 10)
|
|
430
430
|
);
|
|
431
431
|
}
|
|
432
432
|
}
|
|
433
433
|
) });
|
|
434
434
|
case "percentage": {
|
|
435
|
-
const
|
|
436
|
-
return /* @__PURE__ */
|
|
437
|
-
|
|
435
|
+
const n = (e.value * 100).toFixed(2);
|
|
436
|
+
return /* @__PURE__ */ t.jsx("div", { className: "w-24", children: /* @__PURE__ */ t.jsx(
|
|
437
|
+
b,
|
|
438
438
|
{
|
|
439
|
-
name: `${
|
|
439
|
+
name: `${s}.value`,
|
|
440
440
|
type: "number",
|
|
441
|
-
defaultValue:
|
|
441
|
+
defaultValue: n.endsWith(".00") ? n.slice(0, -3) : n,
|
|
442
442
|
min: 0,
|
|
443
443
|
max: 100,
|
|
444
444
|
suffix: "%",
|
|
445
445
|
onChange: (c) => {
|
|
446
|
-
|
|
447
|
-
`${
|
|
446
|
+
a(
|
|
447
|
+
`${s}.value`,
|
|
448
448
|
parseFloat(c.currentTarget.value) / 100
|
|
449
449
|
);
|
|
450
450
|
}
|
|
@@ -452,73 +452,73 @@ function ja({
|
|
|
452
452
|
) });
|
|
453
453
|
}
|
|
454
454
|
default:
|
|
455
|
-
return
|
|
455
|
+
return W();
|
|
456
456
|
}
|
|
457
457
|
}
|
|
458
458
|
function _a({
|
|
459
|
-
item:
|
|
460
|
-
index:
|
|
461
|
-
onDelete:
|
|
459
|
+
item: e,
|
|
460
|
+
index: s,
|
|
461
|
+
onDelete: a
|
|
462
462
|
}) {
|
|
463
463
|
const {
|
|
464
|
-
setPath:
|
|
464
|
+
setPath: n,
|
|
465
465
|
state: { selectedRuleIndex: c },
|
|
466
|
-
availableActionTypes:
|
|
467
|
-
} =
|
|
466
|
+
availableActionTypes: o
|
|
467
|
+
} = g(), i = {
|
|
468
468
|
percentage: "Percentage discount",
|
|
469
469
|
fixed_amount: "Fixed amount",
|
|
470
470
|
fixed_price: "Fixed price",
|
|
471
471
|
buy_x_pay_y: "Buy X, Pay Y",
|
|
472
472
|
every_x_discount_y: "Every X, Discount Y"
|
|
473
|
-
},
|
|
474
|
-
return /* @__PURE__ */
|
|
475
|
-
/* @__PURE__ */
|
|
476
|
-
/* @__PURE__ */
|
|
477
|
-
|
|
473
|
+
}, r = `rules.${c}.actions.${s}`;
|
|
474
|
+
return /* @__PURE__ */ t.jsx("div", { className: "mb-4 last:mb-0", children: /* @__PURE__ */ t.jsxs("div", { className: "bg-gray-50 rounded-md flex items-center", children: [
|
|
475
|
+
/* @__PURE__ */ t.jsxs("div", { className: "flex items-center justify-between gap-2 grow p-2", children: [
|
|
476
|
+
/* @__PURE__ */ t.jsx("div", { className: "flex-1", children: /* @__PURE__ */ t.jsx(
|
|
477
|
+
j,
|
|
478
478
|
{
|
|
479
|
-
name: `${
|
|
480
|
-
defaultValue:
|
|
481
|
-
label:
|
|
482
|
-
value:
|
|
479
|
+
name: `${r}.type`,
|
|
480
|
+
defaultValue: e != null ? {
|
|
481
|
+
label: i[e.type],
|
|
482
|
+
value: e.type
|
|
483
483
|
} : void 0,
|
|
484
|
-
initialValues:
|
|
484
|
+
initialValues: o.map((u) => ({
|
|
485
485
|
value: u,
|
|
486
|
-
label:
|
|
486
|
+
label: i[u]
|
|
487
487
|
})),
|
|
488
488
|
onSelect: (u) => {
|
|
489
|
-
|
|
489
|
+
E(u) && n(`${r}.type`, u.value);
|
|
490
490
|
}
|
|
491
491
|
}
|
|
492
492
|
) }),
|
|
493
|
-
/* @__PURE__ */
|
|
494
|
-
/* @__PURE__ */
|
|
495
|
-
/* @__PURE__ */
|
|
496
|
-
|
|
493
|
+
/* @__PURE__ */ t.jsx(ja, { item: e, pathPrefix: r }),
|
|
494
|
+
/* @__PURE__ */ t.jsx("div", { className: "text-black font-bold text-sm", children: "ON" }),
|
|
495
|
+
/* @__PURE__ */ t.jsx("div", { className: "flex-1", children: /* @__PURE__ */ t.jsx(
|
|
496
|
+
K,
|
|
497
497
|
{
|
|
498
498
|
preset: "action",
|
|
499
|
-
value:
|
|
500
|
-
name: `${
|
|
499
|
+
value: e?.selector,
|
|
500
|
+
name: `${r}.selector`
|
|
501
501
|
}
|
|
502
502
|
) })
|
|
503
503
|
] }),
|
|
504
|
-
|
|
505
|
-
|
|
504
|
+
a != null && /* @__PURE__ */ t.jsx(
|
|
505
|
+
A,
|
|
506
506
|
{
|
|
507
507
|
className: "w-8 border-l border-gray-100 flex items-center justify-center self-stretch",
|
|
508
|
-
dropdownLabel: /* @__PURE__ */
|
|
508
|
+
dropdownLabel: /* @__PURE__ */ t.jsx(
|
|
509
509
|
"button",
|
|
510
510
|
{
|
|
511
511
|
type: "button",
|
|
512
512
|
className: "flex items-center justify-center self-stretch grow",
|
|
513
|
-
children: /* @__PURE__ */
|
|
513
|
+
children: /* @__PURE__ */ t.jsx(v, { name: "dotsThreeVertical", size: 16, weight: "bold" })
|
|
514
514
|
}
|
|
515
515
|
),
|
|
516
|
-
dropdownItems: /* @__PURE__ */
|
|
516
|
+
dropdownItems: /* @__PURE__ */ t.jsx(
|
|
517
517
|
w,
|
|
518
518
|
{
|
|
519
519
|
label: "Delete",
|
|
520
520
|
onClick: () => {
|
|
521
|
-
|
|
521
|
+
n(`${r}`, null), a();
|
|
522
522
|
}
|
|
523
523
|
}
|
|
524
524
|
)
|
|
@@ -527,93 +527,99 @@ function _a({
|
|
|
527
527
|
] }) });
|
|
528
528
|
}
|
|
529
529
|
function Ta({
|
|
530
|
-
actions:
|
|
530
|
+
actions: e
|
|
531
531
|
}) {
|
|
532
|
-
const [
|
|
533
|
-
setPath:
|
|
532
|
+
const [s, a] = f(0), {
|
|
533
|
+
setPath: n,
|
|
534
534
|
state: { selectedRuleIndex: c }
|
|
535
|
-
} =
|
|
536
|
-
return /* @__PURE__ */
|
|
537
|
-
/* @__PURE__ */
|
|
535
|
+
} = g();
|
|
536
|
+
return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
537
|
+
/* @__PURE__ */ t.jsx("div", { children: e?.map((o, i, r) => /* @__PURE__ */ t.jsx(
|
|
538
538
|
_a,
|
|
539
539
|
{
|
|
540
|
-
item:
|
|
541
|
-
index:
|
|
542
|
-
onDelete:
|
|
543
|
-
|
|
540
|
+
item: o,
|
|
541
|
+
index: i,
|
|
542
|
+
onDelete: r.length > 1 ? () => {
|
|
543
|
+
a((u) => u + 1);
|
|
544
544
|
} : void 0
|
|
545
545
|
},
|
|
546
|
-
`${c}-${
|
|
546
|
+
`${c}-${i}-${s}`
|
|
547
547
|
)) }),
|
|
548
|
-
/* @__PURE__ */
|
|
548
|
+
/* @__PURE__ */ t.jsx("div", { className: "mt-6", children: /* @__PURE__ */ t.jsxs(
|
|
549
549
|
N,
|
|
550
550
|
{
|
|
551
551
|
size: "small",
|
|
552
552
|
variant: "secondary",
|
|
553
553
|
alignItems: "center",
|
|
554
554
|
onClick: () => {
|
|
555
|
-
|
|
556
|
-
`rules.${c}.actions.${
|
|
555
|
+
n(
|
|
556
|
+
`rules.${c}.actions.${e?.length ?? 0}`,
|
|
557
557
|
void 0
|
|
558
558
|
);
|
|
559
559
|
},
|
|
560
560
|
children: [
|
|
561
|
-
/* @__PURE__ */
|
|
561
|
+
/* @__PURE__ */ t.jsx(v, { name: "plusCircle" }),
|
|
562
562
|
" Add action"
|
|
563
563
|
]
|
|
564
564
|
}
|
|
565
565
|
) })
|
|
566
566
|
] });
|
|
567
567
|
}
|
|
568
|
-
function
|
|
569
|
-
const [
|
|
570
|
-
return
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
}).catch((
|
|
574
|
-
console.error("Error fetching field info:",
|
|
568
|
+
function ee(e) {
|
|
569
|
+
const [s, a] = f(void 0);
|
|
570
|
+
return _(() => {
|
|
571
|
+
e?.field != null && na(e.field).then((n) => {
|
|
572
|
+
a(n);
|
|
573
|
+
}).catch((n) => {
|
|
574
|
+
console.error("Error fetching field info:", n);
|
|
575
575
|
});
|
|
576
|
-
}, [
|
|
576
|
+
}, [e?.field]), { infos: s };
|
|
577
577
|
}
|
|
578
|
-
function
|
|
579
|
-
if (typeof
|
|
580
|
-
return
|
|
581
|
-
if (typeof
|
|
578
|
+
function te(e) {
|
|
579
|
+
if (typeof e == "string")
|
|
580
|
+
return $(P(e)) ? "datetime" : "string";
|
|
581
|
+
if (typeof e == "number")
|
|
582
582
|
return "integer";
|
|
583
|
-
if (typeof
|
|
583
|
+
if (typeof e == "boolean")
|
|
584
584
|
return "boolean";
|
|
585
|
-
if (Array.isArray(
|
|
586
|
-
if (typeof
|
|
587
|
-
return
|
|
588
|
-
if (typeof
|
|
585
|
+
if (Array.isArray(e)) {
|
|
586
|
+
if (typeof e[0] == "string")
|
|
587
|
+
return $(P(e[0])) ? "datetime" : "string";
|
|
588
|
+
if (typeof e[0] == "number")
|
|
589
589
|
return "integer";
|
|
590
590
|
}
|
|
591
591
|
return "string";
|
|
592
592
|
}
|
|
593
593
|
function Na({
|
|
594
|
-
item:
|
|
595
|
-
pathPrefix:
|
|
594
|
+
item: e,
|
|
595
|
+
pathPrefix: s
|
|
596
596
|
}) {
|
|
597
|
-
const { setPath:
|
|
598
|
-
let c =
|
|
599
|
-
|
|
600
|
-
|
|
597
|
+
const { setPath: a } = g(), { infos: n } = ee(e);
|
|
598
|
+
let c = n?.field?.type;
|
|
599
|
+
c == null && (c = te(e?.value));
|
|
600
|
+
const o = n?.resource?.id, i = ["tag"], r = [
|
|
601
|
+
"matches",
|
|
602
|
+
"does_not_match",
|
|
603
|
+
"array_match"
|
|
604
|
+
], u = wa.filter(({ fieldTypes: l, visible: d }) => d !== !1 && l.includes(c)).filter(({ matcher: l }) => o == null || o != null && !i.includes(o) || r.includes(l)).map(({ matcher: l, label: d }) => ({ value: l, label: d }));
|
|
605
|
+
return /* @__PURE__ */ t.jsx(
|
|
606
|
+
j,
|
|
601
607
|
{
|
|
602
|
-
name: `${
|
|
603
|
-
value:
|
|
604
|
-
label:
|
|
605
|
-
value:
|
|
608
|
+
name: `${s}.matcher`,
|
|
609
|
+
value: e != null ? u.find((l) => l.value === e.matcher) ?? {
|
|
610
|
+
label: e.matcher != null ? `⚠️ ${e.matcher}` : "",
|
|
611
|
+
value: e.matcher
|
|
606
612
|
} : void 0,
|
|
607
|
-
initialValues:
|
|
608
|
-
onSelect: (
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
) &&
|
|
613
|
+
initialValues: u,
|
|
614
|
+
onSelect: (l) => {
|
|
615
|
+
E(l) && (a(`${s}.matcher`, l.value), B.includes(
|
|
616
|
+
l.value
|
|
617
|
+
) && a(`${s}.value`, null));
|
|
612
618
|
}
|
|
613
619
|
}
|
|
614
620
|
);
|
|
615
621
|
}
|
|
616
|
-
const
|
|
622
|
+
const wa = [
|
|
617
623
|
{
|
|
618
624
|
/** Matches if field value equals provided value
|
|
619
625
|
* @field Integer, String, Datetime, Boolean
|
|
@@ -858,7 +864,7 @@ const U = [
|
|
|
858
864
|
label: "is present",
|
|
859
865
|
fieldTypes: ["integer", "string", "datetime", "boolean"]
|
|
860
866
|
}
|
|
861
|
-
],
|
|
867
|
+
], U = {
|
|
862
868
|
in_and: {
|
|
863
869
|
label: "all of"
|
|
864
870
|
},
|
|
@@ -872,55 +878,55 @@ const U = [
|
|
|
872
878
|
label: "not at least one of"
|
|
873
879
|
}
|
|
874
880
|
};
|
|
875
|
-
function
|
|
876
|
-
value:
|
|
877
|
-
pathPrefix:
|
|
881
|
+
function Ea({
|
|
882
|
+
value: e,
|
|
883
|
+
pathPrefix: s
|
|
878
884
|
}) {
|
|
879
|
-
return (typeof
|
|
885
|
+
return (typeof e != "object" || Array.isArray(e) || e === null) && (e = {
|
|
880
886
|
in_and: []
|
|
881
|
-
}), /* @__PURE__ */
|
|
882
|
-
|
|
887
|
+
}), /* @__PURE__ */ t.jsx("div", { children: Object.entries(e).map(([a, n], c) => /* @__PURE__ */ t.jsx(
|
|
888
|
+
Ca,
|
|
883
889
|
{
|
|
884
|
-
pathPrefix:
|
|
885
|
-
defaultValue:
|
|
886
|
-
initialMatcher:
|
|
890
|
+
pathPrefix: s,
|
|
891
|
+
defaultValue: n,
|
|
892
|
+
initialMatcher: a
|
|
887
893
|
},
|
|
888
|
-
`${
|
|
894
|
+
`${s}.${// biome-ignore lint/suspicious/noArrayIndexKey: Using index as key is acceptable here since items are static
|
|
889
895
|
c}`
|
|
890
896
|
)) });
|
|
891
897
|
}
|
|
892
|
-
function
|
|
893
|
-
initialMatcher:
|
|
894
|
-
defaultValue:
|
|
895
|
-
pathPrefix:
|
|
898
|
+
function Ca({
|
|
899
|
+
initialMatcher: e,
|
|
900
|
+
defaultValue: s,
|
|
901
|
+
pathPrefix: a
|
|
896
902
|
}) {
|
|
897
|
-
const [
|
|
898
|
-
return
|
|
899
|
-
|
|
900
|
-
}, [
|
|
901
|
-
/* @__PURE__ */
|
|
902
|
-
|
|
903
|
+
const [n, c] = f(e), [o, i] = f(e), [r, u] = f(s), { setPath: l } = g();
|
|
904
|
+
return _(() => {
|
|
905
|
+
n !== o && (l(`${a}.${n}`, null), c(o)), l(`${a}.${o}`, r);
|
|
906
|
+
}, [o, r, l]), /* @__PURE__ */ t.jsxs("div", { className: "flex gap-2 last-of-type:mt-2", children: [
|
|
907
|
+
/* @__PURE__ */ t.jsx("div", { className: "shrink-0", children: /* @__PURE__ */ t.jsx(
|
|
908
|
+
j,
|
|
903
909
|
{
|
|
904
910
|
defaultValue: [
|
|
905
|
-
{ value:
|
|
911
|
+
{ value: o, label: U[o].label }
|
|
906
912
|
],
|
|
907
|
-
initialValues: Object.entries(
|
|
908
|
-
([d, { label:
|
|
913
|
+
initialValues: Object.entries(U).map(
|
|
914
|
+
([d, { label: p }]) => ({
|
|
909
915
|
value: d,
|
|
910
|
-
label:
|
|
916
|
+
label: p
|
|
911
917
|
})
|
|
912
918
|
),
|
|
913
919
|
onSelect: (d) => {
|
|
914
|
-
|
|
920
|
+
E(d) && i(d.value);
|
|
915
921
|
}
|
|
916
922
|
}
|
|
917
923
|
) }),
|
|
918
|
-
/* @__PURE__ */
|
|
919
|
-
|
|
924
|
+
/* @__PURE__ */ t.jsx("div", { className: "grow", children: /* @__PURE__ */ t.jsx(
|
|
925
|
+
j,
|
|
920
926
|
{
|
|
921
927
|
isMulti: !0,
|
|
922
928
|
isCreatable: !0,
|
|
923
|
-
defaultValue: (Array.isArray(
|
|
929
|
+
defaultValue: (Array.isArray(r) ? r : []).map((d) => ({
|
|
924
930
|
value: d,
|
|
925
931
|
label: d.toString()
|
|
926
932
|
})),
|
|
@@ -928,7 +934,7 @@ function $a({
|
|
|
928
934
|
onSelect: (d) => {
|
|
929
935
|
Y(d) && u(
|
|
930
936
|
d.map(
|
|
931
|
-
(
|
|
937
|
+
(p) => typeof p.value == "boolean" ? p.value.toString() : p.value
|
|
932
938
|
)
|
|
933
939
|
);
|
|
934
940
|
}
|
|
@@ -936,442 +942,451 @@ function $a({
|
|
|
936
942
|
) })
|
|
937
943
|
] });
|
|
938
944
|
}
|
|
939
|
-
function
|
|
940
|
-
value:
|
|
941
|
-
onChange:
|
|
945
|
+
function $a({
|
|
946
|
+
value: e,
|
|
947
|
+
onChange: s
|
|
942
948
|
}) {
|
|
943
|
-
const [
|
|
944
|
-
Array.isArray(
|
|
945
|
-
), [c,
|
|
946
|
-
Array.isArray(
|
|
949
|
+
const [a, n] = f(
|
|
950
|
+
Array.isArray(e) && typeof e[0] == "number" ? e[0] : null
|
|
951
|
+
), [c, o] = f(
|
|
952
|
+
Array.isArray(e) && typeof e[1] == "number" ? e[1] : null
|
|
947
953
|
);
|
|
948
|
-
return /* @__PURE__ */
|
|
949
|
-
/* @__PURE__ */
|
|
950
|
-
|
|
954
|
+
return /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-4", children: [
|
|
955
|
+
/* @__PURE__ */ t.jsx("div", { className: "grow", children: /* @__PURE__ */ t.jsx(
|
|
956
|
+
b,
|
|
951
957
|
{
|
|
952
958
|
type: "number",
|
|
953
959
|
placeholder: "Min",
|
|
954
|
-
value:
|
|
955
|
-
onChange: (
|
|
956
|
-
const
|
|
957
|
-
|
|
960
|
+
value: a ?? "",
|
|
961
|
+
onChange: (i) => {
|
|
962
|
+
const r = parseInt(i.currentTarget.value, 10);
|
|
963
|
+
n(Number.isNaN(r) ? null : r), s([Number.isNaN(r) ? null : r, c]);
|
|
958
964
|
}
|
|
959
965
|
}
|
|
960
966
|
) }),
|
|
961
|
-
/* @__PURE__ */
|
|
962
|
-
/* @__PURE__ */
|
|
963
|
-
|
|
967
|
+
/* @__PURE__ */ t.jsx("span", { className: "text-gray-300", children: "to" }),
|
|
968
|
+
/* @__PURE__ */ t.jsx("div", { className: "grow", children: /* @__PURE__ */ t.jsx(
|
|
969
|
+
b,
|
|
964
970
|
{
|
|
965
971
|
type: "number",
|
|
966
972
|
placeholder: "Max",
|
|
967
973
|
value: c ?? "",
|
|
968
|
-
onChange: (
|
|
969
|
-
const
|
|
970
|
-
|
|
974
|
+
onChange: (i) => {
|
|
975
|
+
const r = parseInt(i.currentTarget.value, 10);
|
|
976
|
+
o(Number.isNaN(r) ? null : r), s([a, Number.isNaN(r) ? null : r]);
|
|
971
977
|
}
|
|
972
978
|
}
|
|
973
979
|
) })
|
|
974
980
|
] });
|
|
975
981
|
}
|
|
976
|
-
function
|
|
977
|
-
value:
|
|
978
|
-
onChange:
|
|
982
|
+
function Sa({
|
|
983
|
+
value: e,
|
|
984
|
+
onChange: s
|
|
979
985
|
}) {
|
|
980
|
-
const [
|
|
981
|
-
Array.isArray(
|
|
982
|
-
), [c,
|
|
983
|
-
Array.isArray(
|
|
986
|
+
const [a, n] = f(
|
|
987
|
+
Array.isArray(e) && typeof e[0] == "string" ? e[0] : null
|
|
988
|
+
), [c, o] = f(
|
|
989
|
+
Array.isArray(e) && typeof e[1] == "string" ? e[1] : null
|
|
984
990
|
);
|
|
985
|
-
return /* @__PURE__ */
|
|
986
|
-
/* @__PURE__ */
|
|
987
|
-
|
|
991
|
+
return /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-4", children: [
|
|
992
|
+
/* @__PURE__ */ t.jsx("div", { className: "grow", children: /* @__PURE__ */ t.jsx(
|
|
993
|
+
b,
|
|
988
994
|
{
|
|
989
995
|
type: "text",
|
|
990
996
|
placeholder: "Min",
|
|
991
|
-
value:
|
|
992
|
-
onChange: (
|
|
993
|
-
const
|
|
994
|
-
|
|
997
|
+
value: a ?? "",
|
|
998
|
+
onChange: (i) => {
|
|
999
|
+
const r = i.currentTarget.value;
|
|
1000
|
+
n(r), s([r, c]);
|
|
995
1001
|
}
|
|
996
1002
|
}
|
|
997
1003
|
) }),
|
|
998
|
-
/* @__PURE__ */
|
|
999
|
-
/* @__PURE__ */
|
|
1000
|
-
|
|
1004
|
+
/* @__PURE__ */ t.jsx("span", { className: "text-gray-300", children: "to" }),
|
|
1005
|
+
/* @__PURE__ */ t.jsx("div", { className: "grow", children: /* @__PURE__ */ t.jsx(
|
|
1006
|
+
b,
|
|
1001
1007
|
{
|
|
1002
1008
|
type: "text",
|
|
1003
1009
|
placeholder: "Max",
|
|
1004
1010
|
value: c ?? "",
|
|
1005
|
-
onChange: (
|
|
1006
|
-
const
|
|
1007
|
-
|
|
1011
|
+
onChange: (i) => {
|
|
1012
|
+
const r = i.currentTarget.value;
|
|
1013
|
+
o(r), s([a, r]);
|
|
1008
1014
|
}
|
|
1009
1015
|
}
|
|
1010
1016
|
) })
|
|
1011
1017
|
] });
|
|
1012
1018
|
}
|
|
1013
|
-
function
|
|
1014
|
-
item:
|
|
1015
|
-
pathPrefix:
|
|
1019
|
+
function Ra({
|
|
1020
|
+
item: e,
|
|
1021
|
+
pathPrefix: s
|
|
1016
1022
|
}) {
|
|
1017
|
-
const { setPath:
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
const
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
break;
|
|
1036
|
-
}
|
|
1037
|
-
case "string": {
|
|
1038
|
-
u = "text";
|
|
1039
|
-
break;
|
|
1040
|
-
}
|
|
1041
|
-
case "integer":
|
|
1042
|
-
case "float": {
|
|
1043
|
-
u = "number";
|
|
1044
|
-
break;
|
|
1045
|
-
}
|
|
1046
|
-
case "array":
|
|
1047
|
-
case "json":
|
|
1048
|
-
case "object":
|
|
1049
|
-
break;
|
|
1050
|
-
default: {
|
|
1051
|
-
u = "text";
|
|
1052
|
-
break;
|
|
1053
|
-
}
|
|
1054
|
-
}
|
|
1055
|
-
switch (r.matcher) {
|
|
1056
|
-
case "eq":
|
|
1057
|
-
case "not_eq":
|
|
1058
|
-
case "lt":
|
|
1059
|
-
case "lteq":
|
|
1060
|
-
case "gt":
|
|
1061
|
-
case "gteq":
|
|
1062
|
-
case "multiple":
|
|
1063
|
-
case "start_with":
|
|
1064
|
-
case "not_start_with":
|
|
1065
|
-
case "end_with":
|
|
1066
|
-
case "not_end_with":
|
|
1067
|
-
break;
|
|
1068
|
-
case "matches":
|
|
1069
|
-
case "does_not_match":
|
|
1070
|
-
break;
|
|
1071
|
-
case "gt_lt":
|
|
1072
|
-
case "gteq_lt":
|
|
1073
|
-
case "gt_lteq":
|
|
1074
|
-
case "gteq_lteq": {
|
|
1075
|
-
u === "number" && (u = "numberRange"), u === "text" && (u = "textRange"), u === "date" && (u = "dateRange");
|
|
1076
|
-
break;
|
|
1077
|
-
}
|
|
1078
|
-
case "is_in":
|
|
1079
|
-
case "is_not_in": {
|
|
1080
|
-
u = "tag";
|
|
1081
|
-
break;
|
|
1082
|
-
}
|
|
1083
|
-
case "array_match": {
|
|
1084
|
-
u = "arrayMatch";
|
|
1085
|
-
break;
|
|
1086
|
-
}
|
|
1087
|
-
default: {
|
|
1088
|
-
R(r.matcher);
|
|
1089
|
-
break;
|
|
1023
|
+
const { setPath: a } = g(), { infos: n } = ee(e), c = `${s}.value`, [o, i] = f(0), [r, u] = f(e?.matcher), l = e == null || B.includes(
|
|
1024
|
+
e.matcher
|
|
1025
|
+
);
|
|
1026
|
+
let d = n?.field?.type;
|
|
1027
|
+
ae(e) && (d == null && (d = te(e.value)), (typeof e.value == "string" && /^{{.*}}$/.test(e.value) || Array.isArray(e.value) && e.value.some((x) => typeof x == "string" && /^{{.*}}$/.test(x))) && (d = "string"));
|
|
1028
|
+
const p = Va(d, e?.matcher);
|
|
1029
|
+
return _(
|
|
1030
|
+
function() {
|
|
1031
|
+
r !== e?.matcher && (u(e?.matcher), a(c, null), i((h) => h + 1));
|
|
1032
|
+
},
|
|
1033
|
+
[p]
|
|
1034
|
+
), l ? null : /* @__PURE__ */ t.jsx("div", { children: /* @__PURE__ */ t.jsx(
|
|
1035
|
+
ka,
|
|
1036
|
+
{
|
|
1037
|
+
item: e,
|
|
1038
|
+
fieldType: d,
|
|
1039
|
+
componentType: p,
|
|
1040
|
+
pathKey: c
|
|
1090
1041
|
}
|
|
1091
|
-
}
|
|
1092
|
-
|
|
1042
|
+
) }, o);
|
|
1043
|
+
}
|
|
1044
|
+
function ka({
|
|
1045
|
+
item: e,
|
|
1046
|
+
fieldType: s,
|
|
1047
|
+
componentType: a,
|
|
1048
|
+
pathKey: n
|
|
1049
|
+
}) {
|
|
1050
|
+
const { setPath: c } = g(), { user: o } = G(), i = ae(e) ? e.value : void 0;
|
|
1051
|
+
switch (a) {
|
|
1093
1052
|
case "date": {
|
|
1094
|
-
const
|
|
1095
|
-
|
|
1096
|
-
);
|
|
1097
|
-
return /* @__PURE__ */ e.jsx(
|
|
1053
|
+
const r = q(typeof i == "string" ? i : "");
|
|
1054
|
+
return /* @__PURE__ */ t.jsx(
|
|
1098
1055
|
la,
|
|
1099
1056
|
{
|
|
1100
|
-
value:
|
|
1057
|
+
value: $(r) ? r : void 0,
|
|
1101
1058
|
showTimeSelect: !0,
|
|
1102
1059
|
placeholder: "Enter value",
|
|
1103
|
-
onChange: (
|
|
1104
|
-
|
|
1060
|
+
onChange: (u) => {
|
|
1061
|
+
c(n, u?.toJSON());
|
|
1105
1062
|
},
|
|
1106
|
-
timezone:
|
|
1063
|
+
timezone: o?.timezone
|
|
1107
1064
|
}
|
|
1108
1065
|
);
|
|
1109
1066
|
}
|
|
1110
1067
|
case "dateRange": {
|
|
1111
|
-
const
|
|
1112
|
-
const
|
|
1113
|
-
return
|
|
1068
|
+
const r = Array.isArray(i) ? i.map((u) => {
|
|
1069
|
+
const l = q(typeof u == "string" ? u : "");
|
|
1070
|
+
return $(l) ? l : null;
|
|
1114
1071
|
}) : [null, null];
|
|
1115
|
-
return /* @__PURE__ */
|
|
1072
|
+
return /* @__PURE__ */ t.jsx(
|
|
1116
1073
|
ra,
|
|
1117
1074
|
{
|
|
1118
|
-
value:
|
|
1075
|
+
value: r,
|
|
1119
1076
|
showTimeSelect: !0,
|
|
1120
|
-
onChange: (
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1077
|
+
onChange: (u) => {
|
|
1078
|
+
c(
|
|
1079
|
+
n,
|
|
1080
|
+
u.map((l) => l?.toJSON() ?? null)
|
|
1124
1081
|
);
|
|
1125
1082
|
}
|
|
1126
1083
|
}
|
|
1127
1084
|
);
|
|
1128
1085
|
}
|
|
1129
1086
|
case "numberRange":
|
|
1130
|
-
return /* @__PURE__ */
|
|
1131
|
-
|
|
1087
|
+
return /* @__PURE__ */ t.jsx(
|
|
1088
|
+
$a,
|
|
1132
1089
|
{
|
|
1133
|
-
value:
|
|
1134
|
-
onChange: (
|
|
1135
|
-
|
|
1090
|
+
value: i,
|
|
1091
|
+
onChange: (r) => {
|
|
1092
|
+
c(n, r);
|
|
1136
1093
|
}
|
|
1137
1094
|
}
|
|
1138
1095
|
);
|
|
1139
1096
|
case "textRange":
|
|
1140
|
-
return /* @__PURE__ */
|
|
1141
|
-
|
|
1097
|
+
return /* @__PURE__ */ t.jsx(
|
|
1098
|
+
Sa,
|
|
1142
1099
|
{
|
|
1143
|
-
value:
|
|
1144
|
-
onChange: (
|
|
1145
|
-
|
|
1100
|
+
value: i,
|
|
1101
|
+
onChange: (r) => {
|
|
1102
|
+
c(n, r);
|
|
1146
1103
|
}
|
|
1147
1104
|
}
|
|
1148
1105
|
);
|
|
1149
1106
|
case "arrayMatch":
|
|
1150
|
-
return /* @__PURE__ */
|
|
1151
|
-
wa,
|
|
1152
|
-
{
|
|
1153
|
-
value: r.value,
|
|
1154
|
-
pathPrefix: `${a}.value`
|
|
1155
|
-
}
|
|
1156
|
-
);
|
|
1107
|
+
return /* @__PURE__ */ t.jsx(Ea, { value: i, pathPrefix: n });
|
|
1157
1108
|
case "tag":
|
|
1158
|
-
return /* @__PURE__ */
|
|
1159
|
-
|
|
1109
|
+
return /* @__PURE__ */ t.jsx(
|
|
1110
|
+
j,
|
|
1160
1111
|
{
|
|
1161
1112
|
isMulti: !0,
|
|
1162
1113
|
isClearable: !1,
|
|
1163
1114
|
isCreatable: !0,
|
|
1164
|
-
defaultValue: Array.isArray(
|
|
1165
|
-
label:
|
|
1166
|
-
value:
|
|
1115
|
+
defaultValue: Array.isArray(i) ? i.map((r) => ({
|
|
1116
|
+
label: r.toString(),
|
|
1117
|
+
value: r
|
|
1167
1118
|
})) : [],
|
|
1168
1119
|
initialValues: [],
|
|
1169
|
-
onSelect: (
|
|
1170
|
-
Y(
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
if (
|
|
1174
|
-
const
|
|
1175
|
-
return Number.isNaN(
|
|
1120
|
+
onSelect: (r) => {
|
|
1121
|
+
Y(r) && c(
|
|
1122
|
+
n,
|
|
1123
|
+
r.map((u) => {
|
|
1124
|
+
if (s === "integer") {
|
|
1125
|
+
const l = parseInt(u.value.toString(), 10);
|
|
1126
|
+
return Number.isNaN(l) ? null : l;
|
|
1176
1127
|
}
|
|
1177
|
-
return
|
|
1178
|
-
}).filter((
|
|
1128
|
+
return u.value;
|
|
1129
|
+
}).filter((u) => u != null)
|
|
1179
1130
|
);
|
|
1180
1131
|
}
|
|
1181
1132
|
}
|
|
1182
1133
|
);
|
|
1183
1134
|
case "number":
|
|
1184
|
-
return /* @__PURE__ */
|
|
1185
|
-
|
|
1135
|
+
return /* @__PURE__ */ t.jsx(
|
|
1136
|
+
b,
|
|
1186
1137
|
{
|
|
1187
|
-
name:
|
|
1138
|
+
name: n,
|
|
1188
1139
|
type: "number",
|
|
1189
|
-
defaultValue: typeof
|
|
1140
|
+
defaultValue: typeof i == "number" ? i : "",
|
|
1190
1141
|
placeholder: "Enter value",
|
|
1191
|
-
onChange: (
|
|
1192
|
-
|
|
1193
|
-
`${a}.value`,
|
|
1194
|
-
parseInt(i.currentTarget.value, 10)
|
|
1195
|
-
);
|
|
1142
|
+
onChange: (r) => {
|
|
1143
|
+
c(n, parseInt(r.currentTarget.value, 10));
|
|
1196
1144
|
}
|
|
1197
1145
|
}
|
|
1198
1146
|
);
|
|
1199
1147
|
case "boolean":
|
|
1200
|
-
return /* @__PURE__ */
|
|
1201
|
-
|
|
1148
|
+
return /* @__PURE__ */ t.jsx(
|
|
1149
|
+
j,
|
|
1202
1150
|
{
|
|
1203
|
-
name:
|
|
1204
|
-
defaultValue: typeof
|
|
1205
|
-
label:
|
|
1206
|
-
value:
|
|
1151
|
+
name: n,
|
|
1152
|
+
defaultValue: typeof i == "boolean" ? {
|
|
1153
|
+
label: i ? "Yes" : "No",
|
|
1154
|
+
value: i
|
|
1207
1155
|
} : void 0,
|
|
1208
1156
|
initialValues: [
|
|
1209
1157
|
{ label: "Yes", value: !0 },
|
|
1210
1158
|
{ label: "No", value: !1 }
|
|
1211
1159
|
],
|
|
1212
|
-
onSelect: (
|
|
1213
|
-
|
|
1160
|
+
onSelect: (r) => {
|
|
1161
|
+
E(r) && c(n, r.value);
|
|
1214
1162
|
}
|
|
1215
1163
|
}
|
|
1216
1164
|
);
|
|
1217
1165
|
case "text":
|
|
1218
1166
|
case null:
|
|
1219
|
-
return /* @__PURE__ */
|
|
1220
|
-
|
|
1167
|
+
return /* @__PURE__ */ t.jsx(
|
|
1168
|
+
b,
|
|
1221
1169
|
{
|
|
1222
|
-
name:
|
|
1170
|
+
name: n,
|
|
1223
1171
|
type: "text",
|
|
1224
|
-
defaultValue: typeof
|
|
1172
|
+
defaultValue: typeof i == "string" ? i : JSON.stringify(i),
|
|
1225
1173
|
placeholder: "Enter value",
|
|
1226
|
-
onChange: (
|
|
1227
|
-
|
|
1174
|
+
onChange: (r) => {
|
|
1175
|
+
c(n, r.currentTarget.value);
|
|
1228
1176
|
}
|
|
1229
1177
|
}
|
|
1230
1178
|
);
|
|
1231
1179
|
default:
|
|
1232
|
-
return
|
|
1180
|
+
return W();
|
|
1233
1181
|
}
|
|
1234
1182
|
}
|
|
1235
|
-
function
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1183
|
+
function ae(e) {
|
|
1184
|
+
return e != null && "value" in e;
|
|
1185
|
+
}
|
|
1186
|
+
function Va(e, s) {
|
|
1187
|
+
let a = null;
|
|
1188
|
+
switch (e) {
|
|
1189
|
+
case "datetime": {
|
|
1190
|
+
a = "date";
|
|
1191
|
+
break;
|
|
1192
|
+
}
|
|
1193
|
+
case "boolean": {
|
|
1194
|
+
a = "boolean";
|
|
1195
|
+
break;
|
|
1196
|
+
}
|
|
1197
|
+
case "string": {
|
|
1198
|
+
a = "text";
|
|
1199
|
+
break;
|
|
1200
|
+
}
|
|
1201
|
+
case "integer":
|
|
1202
|
+
case "float": {
|
|
1203
|
+
a = "number";
|
|
1204
|
+
break;
|
|
1205
|
+
}
|
|
1206
|
+
case "array":
|
|
1207
|
+
case "json":
|
|
1208
|
+
case "object":
|
|
1209
|
+
break;
|
|
1210
|
+
default: {
|
|
1211
|
+
a = "text";
|
|
1212
|
+
break;
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
switch (s) {
|
|
1216
|
+
case "eq":
|
|
1217
|
+
case "not_eq":
|
|
1218
|
+
case "lt":
|
|
1219
|
+
case "lteq":
|
|
1220
|
+
case "gt":
|
|
1221
|
+
case "gteq":
|
|
1222
|
+
case "multiple":
|
|
1223
|
+
case "start_with":
|
|
1224
|
+
case "not_start_with":
|
|
1225
|
+
case "end_with":
|
|
1226
|
+
case "not_end_with":
|
|
1227
|
+
break;
|
|
1228
|
+
case "matches":
|
|
1229
|
+
case "does_not_match":
|
|
1230
|
+
break;
|
|
1231
|
+
case "gt_lt":
|
|
1232
|
+
case "gteq_lt":
|
|
1233
|
+
case "gt_lteq":
|
|
1234
|
+
case "gteq_lteq": {
|
|
1235
|
+
a === "number" && (a = "numberRange"), a === "text" && (a = "textRange"), a === "date" && (a = "dateRange");
|
|
1236
|
+
break;
|
|
1237
|
+
}
|
|
1238
|
+
case "is_in":
|
|
1239
|
+
case "is_not_in": {
|
|
1240
|
+
a = "tag";
|
|
1241
|
+
break;
|
|
1242
|
+
}
|
|
1243
|
+
case "array_match": {
|
|
1244
|
+
a = "arrayMatch";
|
|
1245
|
+
break;
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
return a;
|
|
1249
|
+
}
|
|
1250
|
+
function Aa({
|
|
1251
|
+
item: e,
|
|
1252
|
+
nestingLevel: s,
|
|
1253
|
+
pathPrefix: a,
|
|
1254
|
+
onDelete: n
|
|
1240
1255
|
}) {
|
|
1241
|
-
const { setPath: c } =
|
|
1242
|
-
return
|
|
1243
|
-
/* @__PURE__ */
|
|
1256
|
+
const { setPath: c } = g(), o = [];
|
|
1257
|
+
return s < 2 && (o[0] ??= [], o[0].push(
|
|
1258
|
+
/* @__PURE__ */ t.jsx(
|
|
1244
1259
|
w,
|
|
1245
1260
|
{
|
|
1246
1261
|
label: "Nest conditions",
|
|
1247
1262
|
onClick: () => {
|
|
1248
1263
|
c(
|
|
1249
|
-
`${
|
|
1264
|
+
`${a}.nested.conditions.${(e?.nested?.conditions ?? []).length}`,
|
|
1250
1265
|
void 0
|
|
1251
1266
|
);
|
|
1252
1267
|
}
|
|
1253
1268
|
}
|
|
1254
1269
|
)
|
|
1255
|
-
)),
|
|
1256
|
-
/* @__PURE__ */
|
|
1270
|
+
)), n != null && (o[1] ??= [], o[1].push(
|
|
1271
|
+
/* @__PURE__ */ t.jsx(
|
|
1257
1272
|
w,
|
|
1258
1273
|
{
|
|
1259
1274
|
label: "Delete",
|
|
1260
1275
|
onClick: () => {
|
|
1261
|
-
c(`${
|
|
1276
|
+
c(`${a}`, null), n();
|
|
1262
1277
|
}
|
|
1263
1278
|
}
|
|
1264
1279
|
)
|
|
1265
|
-
)), /* @__PURE__ */
|
|
1266
|
-
/* @__PURE__ */
|
|
1267
|
-
/* @__PURE__ */
|
|
1268
|
-
/* @__PURE__ */
|
|
1269
|
-
|
|
1280
|
+
)), /* @__PURE__ */ t.jsxs("div", { className: "bg-gray-50 rounded-md flex items-center", children: [
|
|
1281
|
+
/* @__PURE__ */ t.jsx("div", { className: "flex items-center justify-between gap-2 grow p-2", children: /* @__PURE__ */ t.jsxs("div", { className: "flex flex-col gap-2 grow", children: [
|
|
1282
|
+
/* @__PURE__ */ t.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
1283
|
+
/* @__PURE__ */ t.jsx("div", { className: "flex-1", children: /* @__PURE__ */ t.jsx(
|
|
1284
|
+
K,
|
|
1270
1285
|
{
|
|
1271
1286
|
preset: "condition",
|
|
1272
|
-
value:
|
|
1273
|
-
name: `${
|
|
1287
|
+
value: e?.field,
|
|
1288
|
+
name: `${a}.field`
|
|
1274
1289
|
}
|
|
1275
1290
|
) }),
|
|
1276
|
-
/* @__PURE__ */
|
|
1291
|
+
/* @__PURE__ */ t.jsx("div", { children: /* @__PURE__ */ t.jsx(Na, { item: e, pathPrefix: a }) })
|
|
1277
1292
|
] }),
|
|
1278
|
-
/* @__PURE__ */
|
|
1293
|
+
/* @__PURE__ */ t.jsx(Ra, { item: e, pathPrefix: a })
|
|
1279
1294
|
] }) }),
|
|
1280
|
-
|
|
1281
|
-
|
|
1295
|
+
o.length > 0 && /* @__PURE__ */ t.jsx(
|
|
1296
|
+
A,
|
|
1282
1297
|
{
|
|
1283
1298
|
className: "w-8 border-l border-gray-100 flex items-center justify-center self-stretch",
|
|
1284
|
-
dropdownLabel: /* @__PURE__ */
|
|
1299
|
+
dropdownLabel: /* @__PURE__ */ t.jsx(
|
|
1285
1300
|
"button",
|
|
1286
1301
|
{
|
|
1287
1302
|
type: "button",
|
|
1288
1303
|
className: "flex items-center justify-center self-stretch grow",
|
|
1289
|
-
children: /* @__PURE__ */
|
|
1304
|
+
children: /* @__PURE__ */ t.jsx(v, { name: "dotsThreeVertical", size: 16, weight: "bold" })
|
|
1290
1305
|
}
|
|
1291
1306
|
),
|
|
1292
|
-
dropdownItems:
|
|
1307
|
+
dropdownItems: o.map((i, r, u) => (
|
|
1293
1308
|
// biome-ignore lint/suspicious/noArrayIndexKey: Using index as key is acceptable here since items are static
|
|
1294
|
-
/* @__PURE__ */
|
|
1295
|
-
|
|
1309
|
+
/* @__PURE__ */ t.jsxs(O.Fragment, { children: [
|
|
1310
|
+
i.map((l, d) => (
|
|
1296
1311
|
// biome-ignore lint/suspicious/noArrayIndexKey: Using index as key is acceptable here since items are static
|
|
1297
|
-
/* @__PURE__ */
|
|
1312
|
+
/* @__PURE__ */ t.jsx(O.Fragment, { children: l }, d)
|
|
1298
1313
|
)),
|
|
1299
|
-
|
|
1300
|
-
] },
|
|
1314
|
+
r < u.length - 1 && /* @__PURE__ */ t.jsx(X, {})
|
|
1315
|
+
] }, r)
|
|
1301
1316
|
))
|
|
1302
1317
|
}
|
|
1303
1318
|
)
|
|
1304
1319
|
] });
|
|
1305
1320
|
}
|
|
1306
1321
|
function se({
|
|
1307
|
-
item:
|
|
1308
|
-
children:
|
|
1309
|
-
nestingLevel:
|
|
1310
|
-
pathPrefix:
|
|
1322
|
+
item: e,
|
|
1323
|
+
children: s,
|
|
1324
|
+
nestingLevel: a = 0,
|
|
1325
|
+
pathPrefix: n
|
|
1311
1326
|
}) {
|
|
1312
1327
|
const {
|
|
1313
1328
|
state: { selectedRuleIndex: c }
|
|
1314
|
-
} =
|
|
1315
|
-
return /* @__PURE__ */
|
|
1329
|
+
} = g(), o = e?.conditions_logic?.toLowerCase() ?? "and", { setPath: i } = g(), [r, u] = f(0), l = a > 0;
|
|
1330
|
+
return /* @__PURE__ */ t.jsxs(
|
|
1316
1331
|
"div",
|
|
1317
1332
|
{
|
|
1318
|
-
className:
|
|
1319
|
-
"p-4 border border-gray-200 rounded-md":
|
|
1333
|
+
className: V("query-group", {
|
|
1334
|
+
"p-4 border border-gray-200 rounded-md": l
|
|
1320
1335
|
}),
|
|
1321
1336
|
children: [
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
/* @__PURE__ */
|
|
1337
|
+
s,
|
|
1338
|
+
e != null && (e.conditions ?? []).length > 0 && /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
1339
|
+
/* @__PURE__ */ t.jsxs(
|
|
1325
1340
|
"select",
|
|
1326
1341
|
{
|
|
1327
1342
|
onChange: (d) => {
|
|
1328
|
-
|
|
1329
|
-
`${
|
|
1343
|
+
i(
|
|
1344
|
+
`${n}.conditions_logic`,
|
|
1330
1345
|
d.currentTarget.value
|
|
1331
1346
|
);
|
|
1332
1347
|
},
|
|
1333
|
-
defaultValue:
|
|
1348
|
+
defaultValue: o,
|
|
1334
1349
|
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",
|
|
1335
1350
|
children: [
|
|
1336
|
-
/* @__PURE__ */
|
|
1337
|
-
|
|
1351
|
+
/* @__PURE__ */ t.jsxs("option", { value: "and", children: [
|
|
1352
|
+
l ? "Nested in " : "",
|
|
1338
1353
|
"AND"
|
|
1339
1354
|
] }),
|
|
1340
|
-
/* @__PURE__ */
|
|
1341
|
-
|
|
1355
|
+
/* @__PURE__ */ t.jsxs("option", { value: "or", children: [
|
|
1356
|
+
l ? "Nested in " : "",
|
|
1342
1357
|
"OR"
|
|
1343
1358
|
] })
|
|
1344
1359
|
]
|
|
1345
1360
|
}
|
|
1346
1361
|
),
|
|
1347
|
-
/* @__PURE__ */
|
|
1348
|
-
const h =
|
|
1349
|
-
return /* @__PURE__ */
|
|
1362
|
+
/* @__PURE__ */ t.jsx("div", { className: "border-l border-gray-200 ml-3 pt-3", children: e?.conditions?.map((d, p, x) => {
|
|
1363
|
+
const h = p === x.length - 1;
|
|
1364
|
+
return /* @__PURE__ */ t.jsxs(
|
|
1350
1365
|
"div",
|
|
1351
1366
|
{
|
|
1352
1367
|
className: "flex items-center mb-4 last:mb-0 relative",
|
|
1353
1368
|
children: [
|
|
1354
|
-
/* @__PURE__ */
|
|
1355
|
-
/* @__PURE__ */
|
|
1369
|
+
/* @__PURE__ */ t.jsx(Ia, { rounded: h }),
|
|
1370
|
+
/* @__PURE__ */ t.jsx("div", { className: "ml-4 w-full", children: /* @__PURE__ */ t.jsx(
|
|
1356
1371
|
se,
|
|
1357
1372
|
{
|
|
1358
1373
|
item: d?.nested ?? void 0,
|
|
1359
|
-
nestingLevel: d?.nested != null ?
|
|
1360
|
-
pathPrefix: `${
|
|
1361
|
-
children: /* @__PURE__ */
|
|
1374
|
+
nestingLevel: d?.nested != null ? a + 1 : 0,
|
|
1375
|
+
pathPrefix: `${n}.conditions.${p}.nested`,
|
|
1376
|
+
children: /* @__PURE__ */ t.jsx(
|
|
1362
1377
|
"div",
|
|
1363
1378
|
{
|
|
1364
|
-
className:
|
|
1379
|
+
className: V({
|
|
1365
1380
|
"mb-4": d?.nested != null
|
|
1366
1381
|
}),
|
|
1367
|
-
children: /* @__PURE__ */
|
|
1368
|
-
|
|
1382
|
+
children: /* @__PURE__ */ t.jsx(
|
|
1383
|
+
Aa,
|
|
1369
1384
|
{
|
|
1370
1385
|
item: d,
|
|
1371
|
-
nestingLevel:
|
|
1372
|
-
pathPrefix: `${
|
|
1373
|
-
onDelete:
|
|
1374
|
-
u((
|
|
1386
|
+
nestingLevel: a,
|
|
1387
|
+
pathPrefix: `${n}.conditions.${p}`,
|
|
1388
|
+
onDelete: x.length > 1 || a > 0 ? () => {
|
|
1389
|
+
u((m) => m + 1);
|
|
1375
1390
|
} : void 0
|
|
1376
1391
|
}
|
|
1377
1392
|
)
|
|
@@ -1381,7 +1396,7 @@ function se({
|
|
|
1381
1396
|
) })
|
|
1382
1397
|
]
|
|
1383
1398
|
},
|
|
1384
|
-
`${c}-${
|
|
1399
|
+
`${c}-${p}-${r}`
|
|
1385
1400
|
);
|
|
1386
1401
|
}) })
|
|
1387
1402
|
] })
|
|
@@ -1389,24 +1404,24 @@ function se({
|
|
|
1389
1404
|
}
|
|
1390
1405
|
);
|
|
1391
1406
|
}
|
|
1392
|
-
function
|
|
1393
|
-
rounded:
|
|
1407
|
+
function Ia({
|
|
1408
|
+
rounded: e = !1
|
|
1394
1409
|
}) {
|
|
1395
|
-
return
|
|
1396
|
-
/* @__PURE__ */
|
|
1397
|
-
/* @__PURE__ */
|
|
1398
|
-
] }) : /* @__PURE__ */
|
|
1410
|
+
return e ? /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
1411
|
+
/* @__PURE__ */ t.jsx("div", { className: "absolute -left-px top-1/2 w-px h-1/2 bg-white" }),
|
|
1412
|
+
/* @__PURE__ */ t.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" })
|
|
1413
|
+
] }) : /* @__PURE__ */ t.jsx("div", { className: "absolute left-0 top-1/2 -translate-y-1/2 w-3.5 h-px bg-gray-200" });
|
|
1399
1414
|
}
|
|
1400
|
-
function
|
|
1415
|
+
function Za() {
|
|
1401
1416
|
const {
|
|
1402
|
-
setPath:
|
|
1403
|
-
state: { value:
|
|
1404
|
-
} =
|
|
1405
|
-
|
|
1417
|
+
setPath: e,
|
|
1418
|
+
state: { value: s, selectedRuleIndex: a }
|
|
1419
|
+
} = g(), [n, c] = f(
|
|
1420
|
+
s.rules?.[a]?.name ?? ""
|
|
1406
1421
|
);
|
|
1407
|
-
return
|
|
1408
|
-
c(
|
|
1409
|
-
}, [
|
|
1422
|
+
return _(() => {
|
|
1423
|
+
c(s.rules?.[a]?.name ?? "");
|
|
1424
|
+
}, [a]), // <Input
|
|
1410
1425
|
// value={value.rules?.[selectedRuleIndex]?.name}
|
|
1411
1426
|
// onChange={(event) => {
|
|
1412
1427
|
// const target = event.currentTarget
|
|
@@ -1416,57 +1431,57 @@ function Ra() {
|
|
|
1416
1431
|
// className="bg-transparent border-0 shadow-none field-sizing-content"
|
|
1417
1432
|
// />
|
|
1418
1433
|
// biome-ignore lint/a11y/noStaticElementInteractions: This <div> is used with contentEditable
|
|
1419
|
-
/* @__PURE__ */
|
|
1434
|
+
/* @__PURE__ */ t.jsx(
|
|
1420
1435
|
"div",
|
|
1421
1436
|
{
|
|
1422
1437
|
contentEditable: "plaintext-only",
|
|
1423
1438
|
suppressContentEditableWarning: !0,
|
|
1424
|
-
onInput: (
|
|
1425
|
-
const
|
|
1426
|
-
|
|
1439
|
+
onInput: (o) => {
|
|
1440
|
+
const r = o.currentTarget.innerText.replace(/[\n\s]+/g, " ").trim();
|
|
1441
|
+
e(`rules.${a}.name`, r);
|
|
1427
1442
|
},
|
|
1428
|
-
onKeyDown: (
|
|
1429
|
-
|
|
1443
|
+
onKeyDown: (o) => {
|
|
1444
|
+
o.key === "Enter" && (o.preventDefault(), o.currentTarget.blur());
|
|
1430
1445
|
},
|
|
1431
|
-
onBlur: (
|
|
1432
|
-
const
|
|
1433
|
-
|
|
1446
|
+
onBlur: (o) => {
|
|
1447
|
+
const i = o.currentTarget;
|
|
1448
|
+
i.innerText = i.innerText.replace(/[\n\s]+/g, " ").trim();
|
|
1434
1449
|
},
|
|
1435
|
-
children:
|
|
1450
|
+
children: n
|
|
1436
1451
|
},
|
|
1437
|
-
|
|
1452
|
+
a
|
|
1438
1453
|
);
|
|
1439
1454
|
}
|
|
1440
|
-
const
|
|
1455
|
+
const z = {
|
|
1441
1456
|
rules: []
|
|
1442
|
-
},
|
|
1457
|
+
}, S = (e) => {
|
|
1443
1458
|
try {
|
|
1444
|
-
return JSON.parse(
|
|
1459
|
+
return JSON.parse(e ?? JSON.stringify(z));
|
|
1445
1460
|
} catch {
|
|
1446
|
-
return
|
|
1461
|
+
return z;
|
|
1447
1462
|
}
|
|
1448
|
-
},
|
|
1463
|
+
}, Da = (e) => {
|
|
1449
1464
|
try {
|
|
1450
|
-
return JSON.parse(
|
|
1465
|
+
return JSON.parse(e ?? "{}"), !0;
|
|
1451
1466
|
} catch {
|
|
1452
1467
|
return !1;
|
|
1453
1468
|
}
|
|
1454
1469
|
};
|
|
1455
|
-
function
|
|
1470
|
+
function Ja(e) {
|
|
1456
1471
|
const {
|
|
1457
|
-
settings: { domain:
|
|
1458
|
-
} =
|
|
1459
|
-
|
|
1472
|
+
settings: { domain: s }
|
|
1473
|
+
} = G(), [a, n] = f([]), [c, o] = f(
|
|
1474
|
+
S(e.value ?? e.defaultValue)
|
|
1460
1475
|
);
|
|
1461
|
-
return
|
|
1476
|
+
return _(
|
|
1462
1477
|
function() {
|
|
1463
|
-
c.rules?.length === 0 &&
|
|
1478
|
+
c.rules?.length === 0 && o(S(e.value));
|
|
1464
1479
|
},
|
|
1465
|
-
[
|
|
1466
|
-
),
|
|
1480
|
+
[e.value]
|
|
1481
|
+
), _(
|
|
1467
1482
|
function() {
|
|
1468
|
-
ia(
|
|
1469
|
-
const
|
|
1483
|
+
ia(e.schemaType, s).then((r) => {
|
|
1484
|
+
const l = y.object({
|
|
1470
1485
|
properties: y.object({
|
|
1471
1486
|
rules: y.object({
|
|
1472
1487
|
items: y.object({
|
|
@@ -1488,107 +1503,108 @@ function Pa(t) {
|
|
|
1488
1503
|
})
|
|
1489
1504
|
})
|
|
1490
1505
|
})
|
|
1491
|
-
}).parse(
|
|
1506
|
+
}).parse(r).properties.rules.items.properties.actions.items.anyOf.flatMap(
|
|
1492
1507
|
(d) => d.properties.type.enum
|
|
1493
1508
|
);
|
|
1494
|
-
|
|
1509
|
+
n([...new Set(l)]);
|
|
1495
1510
|
});
|
|
1496
1511
|
},
|
|
1497
|
-
[
|
|
1498
|
-
), /* @__PURE__ */
|
|
1512
|
+
[s]
|
|
1513
|
+
), /* @__PURE__ */ t.jsx(
|
|
1499
1514
|
ba,
|
|
1500
1515
|
{
|
|
1501
1516
|
initialValue: {
|
|
1502
1517
|
value: { rules: c.rules },
|
|
1503
|
-
availableActionTypes:
|
|
1504
|
-
schemaType:
|
|
1518
|
+
availableActionTypes: a,
|
|
1519
|
+
schemaType: e.schemaType
|
|
1505
1520
|
},
|
|
1506
|
-
children: /* @__PURE__ */
|
|
1521
|
+
children: /* @__PURE__ */ t.jsx(Ma, { ...e })
|
|
1507
1522
|
}
|
|
1508
1523
|
);
|
|
1509
1524
|
}
|
|
1510
|
-
function
|
|
1525
|
+
function Ma(e) {
|
|
1511
1526
|
const {
|
|
1512
|
-
state: { value:
|
|
1513
|
-
setSelectedRuleIndex:
|
|
1527
|
+
state: { value: s, selectedRuleIndex: a },
|
|
1528
|
+
setSelectedRuleIndex: n,
|
|
1514
1529
|
setValue: c,
|
|
1515
|
-
setPath:
|
|
1516
|
-
} =
|
|
1517
|
-
|
|
1518
|
-
), u =
|
|
1519
|
-
|
|
1530
|
+
setPath: o
|
|
1531
|
+
} = g(), [i, r] = f(
|
|
1532
|
+
e.defaultCodeEditorVisible ?? !1
|
|
1533
|
+
), u = s.rules?.[a], l = H(null), [d, p] = f(0);
|
|
1534
|
+
_(
|
|
1520
1535
|
function() {
|
|
1521
|
-
|
|
1536
|
+
k(S(l.current?.getValue()), s) || l.current?.setValue(JSON.stringify(s, null, 2)), e.onChange?.(s);
|
|
1522
1537
|
},
|
|
1523
|
-
[
|
|
1538
|
+
[s]
|
|
1524
1539
|
);
|
|
1525
|
-
const
|
|
1540
|
+
const x = C(
|
|
1526
1541
|
(h) => {
|
|
1527
|
-
const
|
|
1528
|
-
|
|
1542
|
+
const m = S(h);
|
|
1543
|
+
l.current?.hasTextFocus() && Da(h) && !k(m, s) && (c(m), p((T) => T + 1));
|
|
1529
1544
|
},
|
|
1530
|
-
[
|
|
1545
|
+
[s]
|
|
1531
1546
|
);
|
|
1532
|
-
return /* @__PURE__ */
|
|
1547
|
+
return /* @__PURE__ */ t.jsx(
|
|
1533
1548
|
oa,
|
|
1534
1549
|
{
|
|
1535
|
-
hint:
|
|
1536
|
-
feedback:
|
|
1550
|
+
hint: e.hint,
|
|
1551
|
+
feedback: e.feedback,
|
|
1537
1552
|
className: "h-full [&>div:first-of-type]:h-full",
|
|
1538
|
-
children: /* @__PURE__ */
|
|
1539
|
-
/* @__PURE__ */
|
|
1553
|
+
children: /* @__PURE__ */ t.jsxs("section", { className: "flex h-full", children: [
|
|
1554
|
+
/* @__PURE__ */ t.jsxs(
|
|
1540
1555
|
"div",
|
|
1541
1556
|
{
|
|
1542
|
-
className: `shrink-0 basis-3/5 overflow-x-auto relative flex flex-col ${
|
|
1557
|
+
className: `shrink-0 basis-3/5 overflow-x-auto relative flex flex-col ${i ? "" : "grow"}`,
|
|
1543
1558
|
children: [
|
|
1544
|
-
/* @__PURE__ */
|
|
1545
|
-
/* @__PURE__ */
|
|
1546
|
-
|
|
1547
|
-
const ne = `#${(
|
|
1548
|
-
return /* @__PURE__ */
|
|
1559
|
+
/* @__PURE__ */ t.jsxs("header", { className: "w-full bg-white border-b border-gray-200 px-4 flex text-[13px] gap-4 text-gray-400 font-semibold items-center", children: [
|
|
1560
|
+
/* @__PURE__ */ t.jsxs("div", { className: "flex items-center flex-wrap basis-full", children: [
|
|
1561
|
+
s.rules?.map((h, m, T) => {
|
|
1562
|
+
const ne = `#${(m + 1).toString().padStart(2, "0")}`;
|
|
1563
|
+
return /* @__PURE__ */ t.jsxs(
|
|
1549
1564
|
"div",
|
|
1550
1565
|
{
|
|
1551
1566
|
className: "flex items-center py-3 pl-4 pr-2 border-r basis-[88px] justify-center",
|
|
1552
1567
|
children: [
|
|
1553
|
-
/* @__PURE__ */
|
|
1568
|
+
/* @__PURE__ */ t.jsx(
|
|
1554
1569
|
"button",
|
|
1555
1570
|
{
|
|
1556
1571
|
type: "button",
|
|
1557
|
-
className:
|
|
1558
|
-
"text-black":
|
|
1572
|
+
className: V("font-bold mr-2", {
|
|
1573
|
+
"text-black": a === m
|
|
1559
1574
|
}),
|
|
1560
1575
|
onClick: () => {
|
|
1561
|
-
|
|
1576
|
+
n(m);
|
|
1562
1577
|
},
|
|
1563
1578
|
children: ne
|
|
1564
1579
|
}
|
|
1565
1580
|
),
|
|
1566
|
-
/* @__PURE__ */
|
|
1567
|
-
|
|
1581
|
+
/* @__PURE__ */ t.jsx(
|
|
1582
|
+
A,
|
|
1568
1583
|
{
|
|
1569
|
-
menuPosition:
|
|
1570
|
-
dropdownLabel: /* @__PURE__ */
|
|
1571
|
-
dropdownItems: /* @__PURE__ */
|
|
1572
|
-
/* @__PURE__ */
|
|
1584
|
+
menuPosition: m === 0 ? "bottom-left" : "bottom-right",
|
|
1585
|
+
dropdownLabel: /* @__PURE__ */ t.jsx(N, { variant: "circle", children: /* @__PURE__ */ t.jsx(v, { name: "dotsThreeVertical", size: 16 }) }),
|
|
1586
|
+
dropdownItems: /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
1587
|
+
/* @__PURE__ */ t.jsx(
|
|
1573
1588
|
w,
|
|
1574
1589
|
{
|
|
1575
1590
|
onClick: () => {
|
|
1576
|
-
const
|
|
1577
|
-
|
|
1591
|
+
const I = s.rules?.length ?? 0;
|
|
1592
|
+
o(`rules.${I}`, {
|
|
1578
1593
|
...h,
|
|
1594
|
+
id: void 0,
|
|
1579
1595
|
name: `${h.name} (copy)`
|
|
1580
|
-
}),
|
|
1596
|
+
}), n(I);
|
|
1581
1597
|
},
|
|
1582
1598
|
label: "Duplicate"
|
|
1583
1599
|
}
|
|
1584
1600
|
),
|
|
1585
|
-
/* @__PURE__ */
|
|
1586
|
-
/* @__PURE__ */
|
|
1601
|
+
/* @__PURE__ */ t.jsx(X, {}),
|
|
1602
|
+
/* @__PURE__ */ t.jsx(
|
|
1587
1603
|
w,
|
|
1588
1604
|
{
|
|
1589
|
-
disabled:
|
|
1605
|
+
disabled: T.length === 1,
|
|
1590
1606
|
onClick: () => {
|
|
1591
|
-
|
|
1607
|
+
o(`rules.${m}`, null), a >= m && n(a - 1);
|
|
1592
1608
|
},
|
|
1593
1609
|
label: "Delete"
|
|
1594
1610
|
}
|
|
@@ -1598,65 +1614,65 @@ function Ia(t) {
|
|
|
1598
1614
|
)
|
|
1599
1615
|
]
|
|
1600
1616
|
},
|
|
1601
|
-
`${
|
|
1617
|
+
`${m}-${h.id}`
|
|
1602
1618
|
);
|
|
1603
1619
|
}),
|
|
1604
|
-
/* @__PURE__ */
|
|
1620
|
+
/* @__PURE__ */ t.jsx("div", { className: "min-h-[49px] flex items-center", children: /* @__PURE__ */ t.jsx(
|
|
1605
1621
|
N,
|
|
1606
1622
|
{
|
|
1607
1623
|
variant: "circle",
|
|
1608
1624
|
className: "mx-4",
|
|
1609
1625
|
onClick: () => {
|
|
1610
|
-
|
|
1626
|
+
o(`rules.${s.rules?.length ?? 0}`, {
|
|
1611
1627
|
name: "Rule name",
|
|
1612
1628
|
actions: [null],
|
|
1613
1629
|
conditions: [null]
|
|
1614
|
-
}),
|
|
1630
|
+
}), n(s.rules?.length ?? 0);
|
|
1615
1631
|
},
|
|
1616
|
-
children: /* @__PURE__ */
|
|
1632
|
+
children: /* @__PURE__ */ t.jsx(v, { name: "plus", size: 16, className: "shrink-0" })
|
|
1617
1633
|
}
|
|
1618
1634
|
) })
|
|
1619
1635
|
] }),
|
|
1620
|
-
/* @__PURE__ */
|
|
1636
|
+
/* @__PURE__ */ t.jsx("div", { className: "grow flex justify-end", children: /* @__PURE__ */ t.jsx(
|
|
1621
1637
|
N,
|
|
1622
1638
|
{
|
|
1623
1639
|
variant: "circle",
|
|
1624
1640
|
onClick: () => {
|
|
1625
|
-
|
|
1641
|
+
r(!i);
|
|
1626
1642
|
},
|
|
1627
|
-
children: /* @__PURE__ */
|
|
1643
|
+
children: /* @__PURE__ */ t.jsx(v, { name: "sidebarSimple", size: 16 })
|
|
1628
1644
|
}
|
|
1629
1645
|
) })
|
|
1630
1646
|
] }),
|
|
1631
|
-
/* @__PURE__ */
|
|
1632
|
-
/* @__PURE__ */
|
|
1633
|
-
/* @__PURE__ */
|
|
1634
|
-
/* @__PURE__ */
|
|
1647
|
+
/* @__PURE__ */ t.jsx(qa, { children: u && /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
1648
|
+
/* @__PURE__ */ t.jsxs("div", { className: "mb-8 flex items-center gap-2", children: [
|
|
1649
|
+
/* @__PURE__ */ t.jsx(Za, {}),
|
|
1650
|
+
/* @__PURE__ */ t.jsx(v, { name: "pencilSimple", size: 16, className: "shrink-0" })
|
|
1635
1651
|
] }),
|
|
1636
|
-
/* @__PURE__ */
|
|
1637
|
-
/* @__PURE__ */
|
|
1638
|
-
/* @__PURE__ */
|
|
1639
|
-
/* @__PURE__ */
|
|
1652
|
+
/* @__PURE__ */ t.jsx(J, { title: "Actions", icon: "lightning", children: /* @__PURE__ */ t.jsx(Ta, { actions: u?.actions }) }),
|
|
1653
|
+
/* @__PURE__ */ t.jsx(Oa, { children: "when" }),
|
|
1654
|
+
/* @__PURE__ */ t.jsxs(J, { title: "Conditions", icon: "treeView", children: [
|
|
1655
|
+
/* @__PURE__ */ t.jsx(
|
|
1640
1656
|
se,
|
|
1641
1657
|
{
|
|
1642
1658
|
item: u,
|
|
1643
|
-
pathPrefix: `rules.${
|
|
1659
|
+
pathPrefix: `rules.${a}`
|
|
1644
1660
|
}
|
|
1645
1661
|
),
|
|
1646
|
-
/* @__PURE__ */
|
|
1662
|
+
/* @__PURE__ */ t.jsx("div", { className: "mt-6", children: /* @__PURE__ */ t.jsxs(
|
|
1647
1663
|
N,
|
|
1648
1664
|
{
|
|
1649
1665
|
size: "small",
|
|
1650
1666
|
variant: "secondary",
|
|
1651
1667
|
alignItems: "center",
|
|
1652
1668
|
onClick: () => {
|
|
1653
|
-
|
|
1654
|
-
`rules.${
|
|
1669
|
+
o(
|
|
1670
|
+
`rules.${a}.conditions.${u?.conditions?.length ?? 0}`,
|
|
1655
1671
|
void 0
|
|
1656
1672
|
);
|
|
1657
1673
|
},
|
|
1658
1674
|
children: [
|
|
1659
|
-
/* @__PURE__ */
|
|
1675
|
+
/* @__PURE__ */ t.jsx(v, { name: "plusCircle" }),
|
|
1660
1676
|
" Add condition"
|
|
1661
1677
|
]
|
|
1662
1678
|
}
|
|
@@ -1667,48 +1683,48 @@ function Ia(t) {
|
|
|
1667
1683
|
},
|
|
1668
1684
|
d
|
|
1669
1685
|
),
|
|
1670
|
-
|
|
1686
|
+
i && /* @__PURE__ */ t.jsx("div", { className: "shrink-0 basis-2/5", children: /* @__PURE__ */ t.jsx(
|
|
1671
1687
|
ca,
|
|
1672
1688
|
{
|
|
1673
|
-
ref:
|
|
1674
|
-
name:
|
|
1689
|
+
ref: l,
|
|
1690
|
+
name: e.id ?? e.name,
|
|
1675
1691
|
height: "100%",
|
|
1676
1692
|
language: "json",
|
|
1677
|
-
jsonSchema:
|
|
1678
|
-
defaultValue: JSON.stringify(
|
|
1693
|
+
jsonSchema: e.schemaType,
|
|
1694
|
+
defaultValue: JSON.stringify(s, null, 2),
|
|
1679
1695
|
noRounding: !0,
|
|
1680
|
-
onChange:
|
|
1696
|
+
onChange: x
|
|
1681
1697
|
}
|
|
1682
1698
|
) })
|
|
1683
1699
|
] })
|
|
1684
1700
|
}
|
|
1685
1701
|
);
|
|
1686
1702
|
}
|
|
1687
|
-
function
|
|
1688
|
-
return /* @__PURE__ */
|
|
1689
|
-
/* @__PURE__ */
|
|
1690
|
-
/* @__PURE__ */
|
|
1691
|
-
/* @__PURE__ */
|
|
1703
|
+
function Oa({ children: e }) {
|
|
1704
|
+
return /* @__PURE__ */ t.jsxs("div", { className: "text-gray-500 flex items-center justify-center flex-col", children: [
|
|
1705
|
+
/* @__PURE__ */ t.jsx("div", { className: "h-6 w-[2px] bg-gray-200" }),
|
|
1706
|
+
/* @__PURE__ */ t.jsx("span", { className: "font-bold my-1 bg-gray-200 px-3 relative uppercase rounded h-[25px] items-center flex text-sm", children: e }),
|
|
1707
|
+
/* @__PURE__ */ t.jsx("div", { className: "h-6 w-[2px] bg-gray-200" })
|
|
1692
1708
|
] });
|
|
1693
1709
|
}
|
|
1694
|
-
function
|
|
1695
|
-
children:
|
|
1696
|
-
title:
|
|
1697
|
-
icon:
|
|
1710
|
+
function J({
|
|
1711
|
+
children: e,
|
|
1712
|
+
title: s,
|
|
1713
|
+
icon: a
|
|
1698
1714
|
}) {
|
|
1699
|
-
return /* @__PURE__ */
|
|
1700
|
-
/* @__PURE__ */
|
|
1701
|
-
/* @__PURE__ */
|
|
1702
|
-
/* @__PURE__ */
|
|
1715
|
+
return /* @__PURE__ */ t.jsxs("div", { className: "rounded-md bg-white shadow-xs", children: [
|
|
1716
|
+
/* @__PURE__ */ t.jsxs("div", { className: "flex items-center space-x-4 py-4 border-b border-gray-100", children: [
|
|
1717
|
+
/* @__PURE__ */ t.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__ */ t.jsx(v, { name: a }) }),
|
|
1718
|
+
/* @__PURE__ */ t.jsx("h2", { className: "text-lg font-semibold", children: s })
|
|
1703
1719
|
] }),
|
|
1704
|
-
/* @__PURE__ */
|
|
1720
|
+
/* @__PURE__ */ t.jsx("div", { className: "p-6", children: e })
|
|
1705
1721
|
] });
|
|
1706
1722
|
}
|
|
1707
|
-
function
|
|
1708
|
-
children:
|
|
1723
|
+
function qa({
|
|
1724
|
+
children: e
|
|
1709
1725
|
}) {
|
|
1710
|
-
return /* @__PURE__ */
|
|
1726
|
+
return /* @__PURE__ */ t.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__ */ t.jsx("div", { className: "max-w-[900px] mx-auto", children: e }) });
|
|
1711
1727
|
}
|
|
1712
1728
|
export {
|
|
1713
|
-
|
|
1729
|
+
Ja as RuleEngine
|
|
1714
1730
|
};
|