@commercelayer/app-elements 6.1.2 → 6.2.1
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-BaPBahOy.js → InputDateComponent-D4jDLyHV.js} +2083 -2018
- package/dist/RuleEngineComponent-DH23EZ8v.js +1894 -0
- package/dist/{en-zfMbz9a_.js → en-DnI-oLj-.js} +12 -8
- package/dist/{it-6Nhey2x1.js → it-9hWwbmiy.js} +10 -6
- package/dist/locales/en.d.ts +5 -1
- package/dist/{main-DHorNs6K.js → main-L857O21K.js} +5097 -5054
- package/dist/main.d.ts +1 -1
- package/dist/main.js +29 -29
- package/dist/{parseISO-asedr7hB.js → parseISO-CbJPLsTx.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/CodeEditor/fetchCoreResourcesSuggestions.d.ts +17 -0
- package/dist/ui/forms/RuleEngine/Condition/ValueComponents/InputArrayMatch.d.ts +5 -2
- package/dist/ui/forms/RuleEngine/Condition/ValueComponents/InputNumberRange.d.ts +1 -1
- package/dist/ui/forms/RuleEngine/Condition/ValueComponents/InputResourceSelector.d.ts +8 -0
- package/dist/ui/forms/RuleEngine/Condition/ValueComponents/InputTextRange.d.ts +1 -1
- package/dist/ui/forms/RuleEngine/Condition/hooks.d.ts +8 -1
- package/dist/ui/forms/RuleEngine/Condition/utils.d.ts +11 -1
- package/dist/vendor.css +2 -2
- package/package.json +23 -23
- package/dist/RuleEngineComponent-Bb5Hr0c6.js +0 -1715
|
@@ -0,0 +1,1894 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as O, B as fe, D as pe, E as he, I as ge, N as xe, O as ye, P as be, Z as $, b as ve, d as je, e as _e, f as Te, g as Ne, h as Me, i as we, j as Se, k as Ce, l as q, n as Ee, o as $e, p as ke, q as Re, r as Ve, s as Ae, u as Ie, v as Ze, w as De, x as Oe, y as qe, z as Pe, A as Le, C as Fe, F as ze, G as Ue, H as Je, J as We, K as Be, L as Ye, M as Ge, Q as Xe, R as He, S as Qe, T as Ke, U as et, V as tt, W as at, X as st, Y as nt, _ as rt, $ as lt, a0 as it, a1 as ot, a2 as ct, a3 as ut, a4 as dt, a5 as mt, a6 as ft, a7 as pt, a8 as ht, a9 as P, aa as gt, ab as xt, ac as yt, ad as bt, ae as vt, af as jt, ag as _t, ah as Tt, ai as Nt, aj as Mt, ak as wt, al as St, am as Ct, an as Et, ao as $t, ap as kt, aq as Rt, ar as Vt, as as At, at as It, au as Zt, av as Dt, aw as Ot, ax as qt, ay as Pt, az as Lt, aA as Ft, aB as zt, aC as Ut, aD as Jt, aE as Wt, aF as Bt, aG as Yt, aH as Gt, aI as Xt, aJ as Ht, aK as Qt, aL as Kt, aM as ea, aN as ta, aO as aa, aP as sa, aQ as na, aR as ra, aS as la, aT as ia, aU as t, aV as R, aW as oa, aX as ca, aY as Q, aZ as j, a_ as N, a$ as ua, b0 as K, b1 as b, b2 as A, b3 as w, b4 as v, b5 as M, b6 as C, b7 as da, b8 as ee, b9 as ma, ba as L, bb as I, bc as te, bd as fa, be as pa, bf as ae, bg as V, bh as ha, bi as ga, bj as xa } from "./main-L857O21K.js";
|
|
3
|
+
import F, { useReducer as ya, useCallback as S, useMemo as ba, createContext as va, useContext as ja, useRef as se, useState as g, useEffect as _ } from "react";
|
|
4
|
+
import "react-hook-form";
|
|
5
|
+
import "wouter";
|
|
6
|
+
import { p as z } from "./parseISO-CbJPLsTx.js";
|
|
7
|
+
function U(e, s) {
|
|
8
|
+
const a = e.match(
|
|
9
|
+
/(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2}):(\d{2})(?:\.(\d{0,7}))?(?:Z|(.)(\d{2}):?(\d{2})?)?/
|
|
10
|
+
);
|
|
11
|
+
return a ? O(
|
|
12
|
+
Date.UTC(
|
|
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
|
+
),
|
|
21
|
+
s?.in
|
|
22
|
+
) : O(NaN, s?.in);
|
|
23
|
+
}
|
|
24
|
+
const y = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
25
|
+
__proto__: null,
|
|
26
|
+
BRAND: fe,
|
|
27
|
+
DIRTY: pe,
|
|
28
|
+
EMPTY_PATH: he,
|
|
29
|
+
INVALID: ge,
|
|
30
|
+
NEVER: xe,
|
|
31
|
+
OK: ye,
|
|
32
|
+
ParseStatus: be,
|
|
33
|
+
Schema: $,
|
|
34
|
+
ZodAny: ve,
|
|
35
|
+
ZodArray: je,
|
|
36
|
+
ZodBigInt: _e,
|
|
37
|
+
ZodBoolean: Te,
|
|
38
|
+
ZodBranded: Ne,
|
|
39
|
+
ZodCatch: Me,
|
|
40
|
+
ZodDate: we,
|
|
41
|
+
ZodDefault: Se,
|
|
42
|
+
ZodDiscriminatedUnion: Ce,
|
|
43
|
+
ZodEffects: q,
|
|
44
|
+
ZodEnum: Ee,
|
|
45
|
+
ZodError: $e,
|
|
46
|
+
get ZodFirstPartyTypeKind() {
|
|
47
|
+
return ke;
|
|
48
|
+
},
|
|
49
|
+
ZodFunction: Re,
|
|
50
|
+
ZodIntersection: Ve,
|
|
51
|
+
ZodIssueCode: Ae,
|
|
52
|
+
ZodLazy: Ie,
|
|
53
|
+
ZodLiteral: Ze,
|
|
54
|
+
ZodMap: De,
|
|
55
|
+
ZodNaN: Oe,
|
|
56
|
+
ZodNativeEnum: qe,
|
|
57
|
+
ZodNever: Pe,
|
|
58
|
+
ZodNull: Le,
|
|
59
|
+
ZodNullable: Fe,
|
|
60
|
+
ZodNumber: ze,
|
|
61
|
+
ZodObject: Ue,
|
|
62
|
+
ZodOptional: Je,
|
|
63
|
+
ZodParsedType: We,
|
|
64
|
+
ZodPipeline: Be,
|
|
65
|
+
ZodPromise: Ye,
|
|
66
|
+
ZodReadonly: Ge,
|
|
67
|
+
ZodRecord: Xe,
|
|
68
|
+
ZodSchema: $,
|
|
69
|
+
ZodSet: He,
|
|
70
|
+
ZodString: Qe,
|
|
71
|
+
ZodSymbol: Ke,
|
|
72
|
+
ZodTransformer: q,
|
|
73
|
+
ZodTuple: et,
|
|
74
|
+
ZodType: $,
|
|
75
|
+
ZodUndefined: tt,
|
|
76
|
+
ZodUnion: at,
|
|
77
|
+
ZodUnknown: st,
|
|
78
|
+
ZodVoid: nt,
|
|
79
|
+
addIssueToContext: rt,
|
|
80
|
+
any: lt,
|
|
81
|
+
array: it,
|
|
82
|
+
bigint: ot,
|
|
83
|
+
boolean: ct,
|
|
84
|
+
coerce: ut,
|
|
85
|
+
custom: dt,
|
|
86
|
+
date: mt,
|
|
87
|
+
datetimeRegex: ft,
|
|
88
|
+
defaultErrorMap: pt,
|
|
89
|
+
discriminatedUnion: ht,
|
|
90
|
+
effect: P,
|
|
91
|
+
enum: gt,
|
|
92
|
+
function: xt,
|
|
93
|
+
getErrorMap: yt,
|
|
94
|
+
getParsedType: bt,
|
|
95
|
+
instanceof: vt,
|
|
96
|
+
intersection: jt,
|
|
97
|
+
isAborted: _t,
|
|
98
|
+
isAsync: Tt,
|
|
99
|
+
isDirty: Nt,
|
|
100
|
+
isValid: Mt,
|
|
101
|
+
late: wt,
|
|
102
|
+
lazy: St,
|
|
103
|
+
literal: Ct,
|
|
104
|
+
makeIssue: Et,
|
|
105
|
+
map: $t,
|
|
106
|
+
nan: kt,
|
|
107
|
+
nativeEnum: Rt,
|
|
108
|
+
never: Vt,
|
|
109
|
+
null: At,
|
|
110
|
+
nullable: It,
|
|
111
|
+
number: Zt,
|
|
112
|
+
object: Dt,
|
|
113
|
+
get objectUtil() {
|
|
114
|
+
return Ot;
|
|
115
|
+
},
|
|
116
|
+
oboolean: qt,
|
|
117
|
+
onumber: Pt,
|
|
118
|
+
optional: Lt,
|
|
119
|
+
ostring: Ft,
|
|
120
|
+
pipeline: zt,
|
|
121
|
+
preprocess: Ut,
|
|
122
|
+
promise: Jt,
|
|
123
|
+
quotelessJson: Wt,
|
|
124
|
+
record: Bt,
|
|
125
|
+
set: Yt,
|
|
126
|
+
setErrorMap: Gt,
|
|
127
|
+
strictObject: Xt,
|
|
128
|
+
string: Ht,
|
|
129
|
+
symbol: Qt,
|
|
130
|
+
transformer: P,
|
|
131
|
+
tuple: Kt,
|
|
132
|
+
undefined: ea,
|
|
133
|
+
union: ta,
|
|
134
|
+
unknown: aa,
|
|
135
|
+
get util() {
|
|
136
|
+
return sa;
|
|
137
|
+
},
|
|
138
|
+
void: na
|
|
139
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
140
|
+
var _a = 1, Ta = 4;
|
|
141
|
+
function Na(e) {
|
|
142
|
+
return ra(e, _a | Ta);
|
|
143
|
+
}
|
|
144
|
+
function J(e, s, a) {
|
|
145
|
+
return e == null ? e : la(e, s, a);
|
|
146
|
+
}
|
|
147
|
+
function W(e, s) {
|
|
148
|
+
return e == null ? !0 : ia(e, s);
|
|
149
|
+
}
|
|
150
|
+
const ne = va(
|
|
151
|
+
void 0
|
|
152
|
+
);
|
|
153
|
+
function Ma(e, s) {
|
|
154
|
+
switch (s.type) {
|
|
155
|
+
case "SET_PATH": {
|
|
156
|
+
const a = Na(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), i = oa(a, n);
|
|
160
|
+
Array.isArray(i) && (i.splice(c, 1), J(a, n, i), i.length === 0 && n.endsWith(".nested.conditions") && W(a, n.replace(/\.conditions$/, "")));
|
|
161
|
+
} else
|
|
162
|
+
W(a, s.path);
|
|
163
|
+
else
|
|
164
|
+
J(a, s.path, s.value);
|
|
165
|
+
return {
|
|
166
|
+
...e,
|
|
167
|
+
value: a
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
case "SET_SELECTED_RULE_INDEX":
|
|
171
|
+
return {
|
|
172
|
+
...e,
|
|
173
|
+
selectedRuleIndex: s.index
|
|
174
|
+
};
|
|
175
|
+
case "SET_VALUE":
|
|
176
|
+
return R(e.value, s.value) ? e : (s.value.rules?.length ?? 0) === 0 ? {
|
|
177
|
+
selectedRuleIndex: 0,
|
|
178
|
+
value: {
|
|
179
|
+
rules: [
|
|
180
|
+
{
|
|
181
|
+
name: "Rule name",
|
|
182
|
+
// @ts-expect-error Setting `null` is intentional for rendering an empty action
|
|
183
|
+
actions: [null],
|
|
184
|
+
// @ts-expect-error Setting `null` is intentional for rendering an empty condition
|
|
185
|
+
conditions: [null]
|
|
186
|
+
}
|
|
187
|
+
]
|
|
188
|
+
}
|
|
189
|
+
} : {
|
|
190
|
+
...e,
|
|
191
|
+
value: s.value
|
|
192
|
+
};
|
|
193
|
+
default:
|
|
194
|
+
return e;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
function wa({
|
|
198
|
+
children: e,
|
|
199
|
+
initialValue: s
|
|
200
|
+
}) {
|
|
201
|
+
const [a, n] = ya(Ma, {
|
|
202
|
+
value: s.value,
|
|
203
|
+
selectedRuleIndex: 0
|
|
204
|
+
}), c = S((o, l) => {
|
|
205
|
+
n({ type: "SET_PATH", path: o, value: l });
|
|
206
|
+
}, []), i = S((o) => {
|
|
207
|
+
n({ type: "SET_SELECTED_RULE_INDEX", index: o }), o < 0 && setTimeout(() => {
|
|
208
|
+
n({ type: "SET_SELECTED_RULE_INDEX", index: 0 });
|
|
209
|
+
}, 50);
|
|
210
|
+
}, []), u = S((o) => {
|
|
211
|
+
n({ type: "SET_VALUE", value: o });
|
|
212
|
+
}, []), r = ba(
|
|
213
|
+
() => ({
|
|
214
|
+
state: a,
|
|
215
|
+
setPath: c,
|
|
216
|
+
setSelectedRuleIndex: i,
|
|
217
|
+
setValue: u,
|
|
218
|
+
availableActionTypes: s.availableActionTypes,
|
|
219
|
+
schemaType: s.schemaType
|
|
220
|
+
}),
|
|
221
|
+
[
|
|
222
|
+
a,
|
|
223
|
+
c,
|
|
224
|
+
i,
|
|
225
|
+
u,
|
|
226
|
+
s.availableActionTypes,
|
|
227
|
+
s.schemaType
|
|
228
|
+
]
|
|
229
|
+
);
|
|
230
|
+
return /* @__PURE__ */ t.jsx(ne.Provider, { value: r, children: e });
|
|
231
|
+
}
|
|
232
|
+
function x() {
|
|
233
|
+
const e = ja(ne);
|
|
234
|
+
if (e === void 0)
|
|
235
|
+
throw new Error("useRuleEngine must be used within a RuleEngineProvider");
|
|
236
|
+
return e;
|
|
237
|
+
}
|
|
238
|
+
function re({
|
|
239
|
+
value: e,
|
|
240
|
+
name: s,
|
|
241
|
+
preset: a
|
|
242
|
+
}) {
|
|
243
|
+
const { setPath: n, schemaType: c } = x(), { t: i } = ca(), u = se(null), r = c === "order-rules" ? "order" : c === "price-rules" ? "price" : void 0, o = Q(
|
|
244
|
+
(a === "condition" ? Sa : a === "action" ? Ca : []).filter(
|
|
245
|
+
(l) => r != null && l.startsWith(r)
|
|
246
|
+
).map((l) => ({
|
|
247
|
+
value: l,
|
|
248
|
+
label: i(`resource_paths.${l}`).replace(
|
|
249
|
+
"resource_paths.",
|
|
250
|
+
""
|
|
251
|
+
)
|
|
252
|
+
})),
|
|
253
|
+
"label"
|
|
254
|
+
);
|
|
255
|
+
return /* @__PURE__ */ t.jsx(
|
|
256
|
+
j,
|
|
257
|
+
{
|
|
258
|
+
ref: u,
|
|
259
|
+
name: s,
|
|
260
|
+
initialValues: o,
|
|
261
|
+
defaultValue: e != null ? o.find((l) => l.value === e) ?? {
|
|
262
|
+
value: e,
|
|
263
|
+
label: e
|
|
264
|
+
} : void 0,
|
|
265
|
+
asTextSearch: a === "condition",
|
|
266
|
+
isCreatable: !0,
|
|
267
|
+
loadAsyncValues: async (l) => {
|
|
268
|
+
if (r == null)
|
|
269
|
+
return [];
|
|
270
|
+
const d = o.filter(
|
|
271
|
+
(f) => f.label.includes(l)
|
|
272
|
+
), h = a === "condition" ? (await ua(
|
|
273
|
+
[r],
|
|
274
|
+
l
|
|
275
|
+
)).filter((f) => f.value.startsWith(l)).map((f) => {
|
|
276
|
+
const T = f.type === "relationship" || f.value.endsWith(".metadata") ? `${f.value}.` : f.value;
|
|
277
|
+
return {
|
|
278
|
+
value: T,
|
|
279
|
+
label: T
|
|
280
|
+
};
|
|
281
|
+
}) : [], p = l.includes(".metadata") ? [{ label: l, value: l }] : [];
|
|
282
|
+
return [...d, ...h, ...p];
|
|
283
|
+
},
|
|
284
|
+
onSelect: async (l) => {
|
|
285
|
+
N(l) && (n(s, l.value), l.value.toString().endsWith(".") && u.current?.openMenu("first"));
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
);
|
|
289
|
+
}
|
|
290
|
+
const Sa = [
|
|
291
|
+
"order.billing_address.country_code",
|
|
292
|
+
"order.country_code",
|
|
293
|
+
"order.currency_code",
|
|
294
|
+
"order.customer_email",
|
|
295
|
+
"order.customer.email",
|
|
296
|
+
"order.customer.customer_group.id",
|
|
297
|
+
"order.customer.customer_group.name",
|
|
298
|
+
"order.customer.tags.id",
|
|
299
|
+
"order.customer.tags.name",
|
|
300
|
+
"order.line_items.item_type",
|
|
301
|
+
"order.line_items.line_item_options.sku_option.tags.name",
|
|
302
|
+
"order.line_items.options_amount_cents",
|
|
303
|
+
"order.line_items.quantity",
|
|
304
|
+
"order.line_items.reference",
|
|
305
|
+
"order.line_items.shipment.id",
|
|
306
|
+
"order.line_items.shipment.shipping_method.id",
|
|
307
|
+
"order.line_items.shipment.shipping_method.name",
|
|
308
|
+
"order.line_items.shipment.shipping_method.reference",
|
|
309
|
+
"order.line_items.sku_code",
|
|
310
|
+
"order.line_items.sku.code",
|
|
311
|
+
"order.line_items.sku.id",
|
|
312
|
+
"order.line_items.sku.inventory.quantity",
|
|
313
|
+
"order.line_items.sku.name",
|
|
314
|
+
"order.line_items.sku.shipping_category.id",
|
|
315
|
+
"order.line_items.sku.sku_lists.id",
|
|
316
|
+
"order.line_items.sku.sku_lists.name",
|
|
317
|
+
"order.line_items.sku.tags.name",
|
|
318
|
+
"order.line_items.unit_amount_cents",
|
|
319
|
+
"order.market.code",
|
|
320
|
+
"order.market.id",
|
|
321
|
+
"order.shipments_count",
|
|
322
|
+
"order.shipping_address.country_code",
|
|
323
|
+
"order.subtotal_amount_cents",
|
|
324
|
+
"order.tags.name",
|
|
325
|
+
"order.total_amount_cents",
|
|
326
|
+
"price.jwt_customer.email",
|
|
327
|
+
"price.jwt_customer.tags.name",
|
|
328
|
+
"price.sku.sku_list_items.sku_list.name",
|
|
329
|
+
"price.sku.code",
|
|
330
|
+
"price.sku.tags.name",
|
|
331
|
+
"price.processed_at",
|
|
332
|
+
"price.amount_cents"
|
|
333
|
+
], Ca = [
|
|
334
|
+
"order",
|
|
335
|
+
"order.line_items",
|
|
336
|
+
"order.line_items.line_item_options",
|
|
337
|
+
"order.line_items.sku",
|
|
338
|
+
"order.line_items.bundle",
|
|
339
|
+
"order.line_items.shipment",
|
|
340
|
+
"order.line_items.payment_method",
|
|
341
|
+
"order.line_items.adjustment",
|
|
342
|
+
"order.line_items.gift_card",
|
|
343
|
+
"price"
|
|
344
|
+
];
|
|
345
|
+
function Ea({
|
|
346
|
+
item: e,
|
|
347
|
+
pathPrefix: s
|
|
348
|
+
}) {
|
|
349
|
+
const { setPath: a } = x();
|
|
350
|
+
if (e == null)
|
|
351
|
+
return null;
|
|
352
|
+
switch (e.type) {
|
|
353
|
+
case "buy_x_pay_y":
|
|
354
|
+
return /* @__PURE__ */ t.jsxs("div", { className: "w-36 flex items-center gap-0.5", children: [
|
|
355
|
+
/* @__PURE__ */ t.jsx(
|
|
356
|
+
b,
|
|
357
|
+
{
|
|
358
|
+
name: `${s}.value.x`,
|
|
359
|
+
type: "number",
|
|
360
|
+
suffix: "X",
|
|
361
|
+
defaultValue: e.value?.x,
|
|
362
|
+
onChange: (n) => {
|
|
363
|
+
a(
|
|
364
|
+
`${s}.value.x`,
|
|
365
|
+
parseInt(n.currentTarget.value, 10)
|
|
366
|
+
);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
),
|
|
370
|
+
/* @__PURE__ */ t.jsx(
|
|
371
|
+
b,
|
|
372
|
+
{
|
|
373
|
+
name: `${s}.value.y`,
|
|
374
|
+
type: "number",
|
|
375
|
+
suffix: "Y",
|
|
376
|
+
defaultValue: e.value?.y,
|
|
377
|
+
onChange: (n) => {
|
|
378
|
+
a(
|
|
379
|
+
`${s}.value.y`,
|
|
380
|
+
parseInt(n.currentTarget.value, 10)
|
|
381
|
+
);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
)
|
|
385
|
+
] });
|
|
386
|
+
case "every_x_discount_y":
|
|
387
|
+
return /* @__PURE__ */ t.jsxs("div", { className: "w-36 flex items-center gap-0.5", children: [
|
|
388
|
+
/* @__PURE__ */ t.jsx(
|
|
389
|
+
b,
|
|
390
|
+
{
|
|
391
|
+
name: `${s}.value.x`,
|
|
392
|
+
type: "number",
|
|
393
|
+
suffix: "X",
|
|
394
|
+
defaultValue: e.value?.x,
|
|
395
|
+
onChange: (n) => {
|
|
396
|
+
a(
|
|
397
|
+
`${s}.value.x`,
|
|
398
|
+
parseInt(n.currentTarget.value, 10)
|
|
399
|
+
);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
),
|
|
403
|
+
/* @__PURE__ */ t.jsx(
|
|
404
|
+
b,
|
|
405
|
+
{
|
|
406
|
+
name: `${s}.value.y`,
|
|
407
|
+
type: "number",
|
|
408
|
+
suffix: "Y",
|
|
409
|
+
defaultValue: e.value?.y,
|
|
410
|
+
onChange: (n) => {
|
|
411
|
+
a(
|
|
412
|
+
`${s}.value.y`,
|
|
413
|
+
parseInt(n.currentTarget.value, 10)
|
|
414
|
+
);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
)
|
|
418
|
+
] });
|
|
419
|
+
case "fixed_amount":
|
|
420
|
+
case "fixed_price":
|
|
421
|
+
return /* @__PURE__ */ t.jsx("div", { className: "w-36", children: /* @__PURE__ */ t.jsx(
|
|
422
|
+
b,
|
|
423
|
+
{
|
|
424
|
+
name: `${s}.value`,
|
|
425
|
+
type: "number",
|
|
426
|
+
defaultValue: e.value,
|
|
427
|
+
min: 0,
|
|
428
|
+
suffix: "cents",
|
|
429
|
+
onChange: (n) => {
|
|
430
|
+
a(
|
|
431
|
+
`${s}.value`,
|
|
432
|
+
parseInt(n.currentTarget.value, 10)
|
|
433
|
+
);
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
) });
|
|
437
|
+
case "percentage": {
|
|
438
|
+
const n = (e.value * 100).toFixed(2);
|
|
439
|
+
return /* @__PURE__ */ t.jsx("div", { className: "w-24", children: /* @__PURE__ */ t.jsx(
|
|
440
|
+
b,
|
|
441
|
+
{
|
|
442
|
+
name: `${s}.value`,
|
|
443
|
+
type: "number",
|
|
444
|
+
defaultValue: n.endsWith(".00") ? n.slice(0, -3) : n,
|
|
445
|
+
min: 0,
|
|
446
|
+
max: 100,
|
|
447
|
+
suffix: "%",
|
|
448
|
+
onChange: (c) => {
|
|
449
|
+
a(
|
|
450
|
+
`${s}.value`,
|
|
451
|
+
parseFloat(c.currentTarget.value) / 100
|
|
452
|
+
);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
) });
|
|
456
|
+
}
|
|
457
|
+
default:
|
|
458
|
+
return K();
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
function $a({
|
|
462
|
+
item: e,
|
|
463
|
+
index: s,
|
|
464
|
+
onDelete: a
|
|
465
|
+
}) {
|
|
466
|
+
const {
|
|
467
|
+
setPath: n,
|
|
468
|
+
state: { selectedRuleIndex: c },
|
|
469
|
+
availableActionTypes: i
|
|
470
|
+
} = x(), u = {
|
|
471
|
+
percentage: "Percentage discount",
|
|
472
|
+
fixed_amount: "Fixed amount",
|
|
473
|
+
fixed_price: "Fixed price",
|
|
474
|
+
buy_x_pay_y: "Buy X, Pay Y",
|
|
475
|
+
every_x_discount_y: "Every X, Discount Y"
|
|
476
|
+
}, r = `rules.${c}.actions.${s}`;
|
|
477
|
+
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: [
|
|
478
|
+
/* @__PURE__ */ t.jsxs("div", { className: "flex items-center justify-between gap-2 grow p-2", children: [
|
|
479
|
+
/* @__PURE__ */ t.jsx("div", { className: "flex-1", children: /* @__PURE__ */ t.jsx(
|
|
480
|
+
j,
|
|
481
|
+
{
|
|
482
|
+
name: `${r}.type`,
|
|
483
|
+
defaultValue: e != null ? {
|
|
484
|
+
label: u[e.type],
|
|
485
|
+
value: e.type
|
|
486
|
+
} : void 0,
|
|
487
|
+
initialValues: i.map((o) => ({
|
|
488
|
+
value: o,
|
|
489
|
+
label: u[o]
|
|
490
|
+
})),
|
|
491
|
+
onSelect: (o) => {
|
|
492
|
+
N(o) && n(`${r}.type`, o.value);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
) }),
|
|
496
|
+
/* @__PURE__ */ t.jsx(Ea, { item: e, pathPrefix: r }),
|
|
497
|
+
/* @__PURE__ */ t.jsx("div", { className: "text-black font-bold text-sm", children: "ON" }),
|
|
498
|
+
/* @__PURE__ */ t.jsx("div", { className: "flex-1", children: /* @__PURE__ */ t.jsx(
|
|
499
|
+
re,
|
|
500
|
+
{
|
|
501
|
+
preset: "action",
|
|
502
|
+
value: e?.selector,
|
|
503
|
+
name: `${r}.selector`
|
|
504
|
+
}
|
|
505
|
+
) })
|
|
506
|
+
] }),
|
|
507
|
+
a != null && /* @__PURE__ */ t.jsx(
|
|
508
|
+
A,
|
|
509
|
+
{
|
|
510
|
+
className: "w-8 border-l border-gray-100 flex items-center justify-center self-stretch",
|
|
511
|
+
dropdownLabel: /* @__PURE__ */ t.jsx(
|
|
512
|
+
"button",
|
|
513
|
+
{
|
|
514
|
+
type: "button",
|
|
515
|
+
className: "flex items-center justify-center self-stretch grow",
|
|
516
|
+
children: /* @__PURE__ */ t.jsx(v, { name: "dotsThreeVertical", size: 16, weight: "bold" })
|
|
517
|
+
}
|
|
518
|
+
),
|
|
519
|
+
dropdownItems: /* @__PURE__ */ t.jsx(
|
|
520
|
+
w,
|
|
521
|
+
{
|
|
522
|
+
label: "Delete",
|
|
523
|
+
onClick: () => {
|
|
524
|
+
n(`${r}`, null), a();
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
)
|
|
528
|
+
}
|
|
529
|
+
)
|
|
530
|
+
] }) });
|
|
531
|
+
}
|
|
532
|
+
function ka({
|
|
533
|
+
actions: e
|
|
534
|
+
}) {
|
|
535
|
+
const [s, a] = g(0), {
|
|
536
|
+
setPath: n,
|
|
537
|
+
state: { selectedRuleIndex: c }
|
|
538
|
+
} = x();
|
|
539
|
+
return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
540
|
+
/* @__PURE__ */ t.jsx("div", { children: e?.map((i, u, r) => /* @__PURE__ */ t.jsx(
|
|
541
|
+
$a,
|
|
542
|
+
{
|
|
543
|
+
item: i,
|
|
544
|
+
index: u,
|
|
545
|
+
onDelete: r.length > 1 ? () => {
|
|
546
|
+
a((o) => o + 1);
|
|
547
|
+
} : void 0
|
|
548
|
+
},
|
|
549
|
+
`${c}-${u}-${s}`
|
|
550
|
+
)) }),
|
|
551
|
+
/* @__PURE__ */ t.jsx("div", { className: "mt-6", children: /* @__PURE__ */ t.jsxs(
|
|
552
|
+
M,
|
|
553
|
+
{
|
|
554
|
+
size: "small",
|
|
555
|
+
variant: "secondary",
|
|
556
|
+
alignItems: "center",
|
|
557
|
+
onClick: () => {
|
|
558
|
+
n(
|
|
559
|
+
`rules.${c}.actions.${e?.length ?? 0}`,
|
|
560
|
+
void 0
|
|
561
|
+
);
|
|
562
|
+
},
|
|
563
|
+
children: [
|
|
564
|
+
/* @__PURE__ */ t.jsx(v, { name: "plusCircle" }),
|
|
565
|
+
" Add action"
|
|
566
|
+
]
|
|
567
|
+
}
|
|
568
|
+
) })
|
|
569
|
+
] });
|
|
570
|
+
}
|
|
571
|
+
const le = [
|
|
572
|
+
{
|
|
573
|
+
/** Matches if field value equals provided value
|
|
574
|
+
* @field Integer, String, Datetime, Boolean
|
|
575
|
+
* @value Integer, String, Datetime, Boolean
|
|
576
|
+
*/
|
|
577
|
+
matcher: "eq",
|
|
578
|
+
label: "equals",
|
|
579
|
+
fieldTypes: ["integer", "string", "datetime", "boolean"],
|
|
580
|
+
isMulti: !1,
|
|
581
|
+
exactMatch: !0
|
|
582
|
+
},
|
|
583
|
+
{
|
|
584
|
+
/** Matches if field value is not equal to provided value
|
|
585
|
+
* @field Integer, String, Datetime, Boolean
|
|
586
|
+
* @value Integer, String, Datetime, Boolean
|
|
587
|
+
*/
|
|
588
|
+
matcher: "not_eq",
|
|
589
|
+
label: "not equals",
|
|
590
|
+
fieldTypes: ["integer", "string", "datetime", "boolean"],
|
|
591
|
+
isMulti: !1,
|
|
592
|
+
exactMatch: !0
|
|
593
|
+
},
|
|
594
|
+
{
|
|
595
|
+
/** Matches if field value is less than provided value
|
|
596
|
+
* @field Integer, Datetime
|
|
597
|
+
* @value Integer, Datetime
|
|
598
|
+
*/
|
|
599
|
+
matcher: "lt",
|
|
600
|
+
label: "<",
|
|
601
|
+
fieldTypes: ["integer", "datetime"],
|
|
602
|
+
isMulti: !1,
|
|
603
|
+
exactMatch: !0
|
|
604
|
+
},
|
|
605
|
+
{
|
|
606
|
+
/** Matches if field value is less than or equal to provided value
|
|
607
|
+
* @field Integer, Datetime
|
|
608
|
+
* @value Integer, Datetime
|
|
609
|
+
*/
|
|
610
|
+
matcher: "lteq",
|
|
611
|
+
label: "≤",
|
|
612
|
+
fieldTypes: ["integer", "datetime"],
|
|
613
|
+
isMulti: !1,
|
|
614
|
+
exactMatch: !0
|
|
615
|
+
},
|
|
616
|
+
{
|
|
617
|
+
/** Matches if field value is greater than provided value
|
|
618
|
+
* @field Integer, Datetime
|
|
619
|
+
* @value Integer, Datetime
|
|
620
|
+
*/
|
|
621
|
+
matcher: "gt",
|
|
622
|
+
label: ">",
|
|
623
|
+
fieldTypes: ["integer", "datetime"],
|
|
624
|
+
isMulti: !1,
|
|
625
|
+
exactMatch: !0
|
|
626
|
+
},
|
|
627
|
+
{
|
|
628
|
+
/** Matches if field value is greater than or equal to provided value
|
|
629
|
+
* @field Integer, Datetime
|
|
630
|
+
* @value Integer, Datetime
|
|
631
|
+
*/
|
|
632
|
+
matcher: "gteq",
|
|
633
|
+
label: "≥",
|
|
634
|
+
fieldTypes: ["integer", "datetime"],
|
|
635
|
+
isMulti: !1,
|
|
636
|
+
exactMatch: !0
|
|
637
|
+
},
|
|
638
|
+
{
|
|
639
|
+
/** Matches if field value is a multiple of provided value
|
|
640
|
+
* @field Integer
|
|
641
|
+
* @value Integer
|
|
642
|
+
*/
|
|
643
|
+
matcher: "multiple",
|
|
644
|
+
label: "is a multiple of",
|
|
645
|
+
fieldTypes: ["integer"],
|
|
646
|
+
isMulti: !1,
|
|
647
|
+
exactMatch: !0
|
|
648
|
+
},
|
|
649
|
+
{
|
|
650
|
+
/** Matches if field value matches regex pattern
|
|
651
|
+
* @field String
|
|
652
|
+
* @value String
|
|
653
|
+
*/
|
|
654
|
+
matcher: "matches",
|
|
655
|
+
label: "matches regex",
|
|
656
|
+
fieldTypes: ["string"],
|
|
657
|
+
isMulti: !1,
|
|
658
|
+
exactMatch: !1
|
|
659
|
+
},
|
|
660
|
+
{
|
|
661
|
+
/** Matches if field value does not match regex pattern
|
|
662
|
+
* @field String
|
|
663
|
+
* @value String
|
|
664
|
+
*/
|
|
665
|
+
matcher: "does_not_match",
|
|
666
|
+
label: "doesn't match regex",
|
|
667
|
+
fieldTypes: ["string"],
|
|
668
|
+
isMulti: !1,
|
|
669
|
+
exactMatch: !1
|
|
670
|
+
},
|
|
671
|
+
{
|
|
672
|
+
/** Matches if field value starts with provided string
|
|
673
|
+
* @field String
|
|
674
|
+
* @value String
|
|
675
|
+
*/
|
|
676
|
+
matcher: "start_with",
|
|
677
|
+
label: "starts with",
|
|
678
|
+
fieldTypes: ["string"],
|
|
679
|
+
isMulti: !1,
|
|
680
|
+
exactMatch: !1
|
|
681
|
+
},
|
|
682
|
+
{
|
|
683
|
+
/** Matches if field value does not start with provided string
|
|
684
|
+
* @field String
|
|
685
|
+
* @value String
|
|
686
|
+
*/
|
|
687
|
+
matcher: "not_start_with",
|
|
688
|
+
label: "doesn't start with",
|
|
689
|
+
fieldTypes: ["string"],
|
|
690
|
+
isMulti: !1,
|
|
691
|
+
exactMatch: !1
|
|
692
|
+
},
|
|
693
|
+
{
|
|
694
|
+
/** Matches if field value ends with provided string
|
|
695
|
+
* @field String
|
|
696
|
+
* @value String
|
|
697
|
+
*/
|
|
698
|
+
matcher: "end_with",
|
|
699
|
+
label: "ends with",
|
|
700
|
+
fieldTypes: ["string"],
|
|
701
|
+
isMulti: !1,
|
|
702
|
+
exactMatch: !1
|
|
703
|
+
},
|
|
704
|
+
{
|
|
705
|
+
/** Matches if field value does not end with provided string
|
|
706
|
+
* @field String
|
|
707
|
+
* @value String
|
|
708
|
+
*/
|
|
709
|
+
matcher: "not_end_with",
|
|
710
|
+
label: "doesn't end with",
|
|
711
|
+
fieldTypes: ["string"],
|
|
712
|
+
isMulti: !1,
|
|
713
|
+
exactMatch: !1
|
|
714
|
+
},
|
|
715
|
+
{
|
|
716
|
+
/** Matches if field value is between two values (exclusive)
|
|
717
|
+
* @field Integer, Datetime
|
|
718
|
+
* @value Array
|
|
719
|
+
*/
|
|
720
|
+
matcher: "gt_lt",
|
|
721
|
+
label: "> and <",
|
|
722
|
+
fieldTypes: ["integer"],
|
|
723
|
+
isMulti: !1,
|
|
724
|
+
exactMatch: !0
|
|
725
|
+
},
|
|
726
|
+
{
|
|
727
|
+
/** Matches if field value is between two values (inclusive start, exclusive end)
|
|
728
|
+
* @field Integer, Datetime
|
|
729
|
+
* @value Array
|
|
730
|
+
*/
|
|
731
|
+
matcher: "gteq_lt",
|
|
732
|
+
label: "≥ and <",
|
|
733
|
+
fieldTypes: ["integer"],
|
|
734
|
+
isMulti: !1,
|
|
735
|
+
exactMatch: !0
|
|
736
|
+
},
|
|
737
|
+
{
|
|
738
|
+
/** Matches if field value is greater than first and less than or equal to second
|
|
739
|
+
* @field Integer, Datetime
|
|
740
|
+
* @value Array
|
|
741
|
+
*/
|
|
742
|
+
matcher: "gt_lteq",
|
|
743
|
+
label: "> and ≤",
|
|
744
|
+
fieldTypes: ["integer"],
|
|
745
|
+
isMulti: !1,
|
|
746
|
+
exactMatch: !0
|
|
747
|
+
},
|
|
748
|
+
{
|
|
749
|
+
/** Matches if field value is between two values (inclusive)
|
|
750
|
+
* @field Integer, Datetime
|
|
751
|
+
* @value Array
|
|
752
|
+
*/
|
|
753
|
+
matcher: "gteq_lteq",
|
|
754
|
+
label: "≥ and ≤",
|
|
755
|
+
fieldTypes: ["integer"],
|
|
756
|
+
isMulti: !1,
|
|
757
|
+
exactMatch: !0
|
|
758
|
+
},
|
|
759
|
+
{
|
|
760
|
+
/** Matches if field value is between two values (exclusive)
|
|
761
|
+
* @field Integer, Datetime
|
|
762
|
+
* @value Array
|
|
763
|
+
*/
|
|
764
|
+
matcher: "gt_lt",
|
|
765
|
+
label: "date range",
|
|
766
|
+
visible: !1,
|
|
767
|
+
fieldTypes: ["datetime"],
|
|
768
|
+
isMulti: !1,
|
|
769
|
+
exactMatch: !0
|
|
770
|
+
},
|
|
771
|
+
{
|
|
772
|
+
/** Matches if field value is between two values (inclusive start, exclusive end)
|
|
773
|
+
* @field Integer, Datetime
|
|
774
|
+
* @value Array
|
|
775
|
+
*/
|
|
776
|
+
matcher: "gteq_lt",
|
|
777
|
+
label: "date range",
|
|
778
|
+
visible: !1,
|
|
779
|
+
fieldTypes: ["datetime"],
|
|
780
|
+
isMulti: !1,
|
|
781
|
+
exactMatch: !0
|
|
782
|
+
},
|
|
783
|
+
{
|
|
784
|
+
/** Matches if field value is greater than first and less than or equal to second
|
|
785
|
+
* @field Integer, Datetime
|
|
786
|
+
* @value Array
|
|
787
|
+
*/
|
|
788
|
+
matcher: "gt_lteq",
|
|
789
|
+
label: "date range",
|
|
790
|
+
visible: !1,
|
|
791
|
+
fieldTypes: ["datetime"],
|
|
792
|
+
isMulti: !1,
|
|
793
|
+
exactMatch: !0
|
|
794
|
+
},
|
|
795
|
+
{
|
|
796
|
+
/** Matches if field value is between two values (inclusive)
|
|
797
|
+
* @field Integer, Datetime
|
|
798
|
+
* @value Array
|
|
799
|
+
*/
|
|
800
|
+
matcher: "gteq_lteq",
|
|
801
|
+
label: "date range",
|
|
802
|
+
visible: !0,
|
|
803
|
+
fieldTypes: ["datetime"],
|
|
804
|
+
isMulti: !1,
|
|
805
|
+
exactMatch: !0
|
|
806
|
+
},
|
|
807
|
+
{
|
|
808
|
+
/** Matches if field value is in provided array
|
|
809
|
+
* @field Integer, String, Datetime
|
|
810
|
+
* @value Array
|
|
811
|
+
*/
|
|
812
|
+
matcher: "is_in",
|
|
813
|
+
label: "is one of",
|
|
814
|
+
fieldTypes: ["integer", "string", "datetime"],
|
|
815
|
+
isMulti: !0,
|
|
816
|
+
exactMatch: !0
|
|
817
|
+
},
|
|
818
|
+
{
|
|
819
|
+
/** Matches if field value is not in provided array
|
|
820
|
+
* @field Integer, String, Datetime
|
|
821
|
+
* @value Array
|
|
822
|
+
*/
|
|
823
|
+
matcher: "is_not_in",
|
|
824
|
+
label: "is not one of",
|
|
825
|
+
fieldTypes: ["integer", "string", "datetime"],
|
|
826
|
+
isMulti: !0,
|
|
827
|
+
exactMatch: !0
|
|
828
|
+
},
|
|
829
|
+
{
|
|
830
|
+
/** Matches objects within arrays that meet specified requirements
|
|
831
|
+
* @field Array
|
|
832
|
+
* @value Object
|
|
833
|
+
*/
|
|
834
|
+
matcher: "array_match",
|
|
835
|
+
label: "is",
|
|
836
|
+
fieldTypes: ["integer", "string", "datetime"],
|
|
837
|
+
isMulti: !0,
|
|
838
|
+
exactMatch: !0
|
|
839
|
+
},
|
|
840
|
+
{
|
|
841
|
+
/** Matches if field value is null or empty string */
|
|
842
|
+
matcher: "blank",
|
|
843
|
+
label: "is blank",
|
|
844
|
+
fieldTypes: ["integer", "string", "datetime", "boolean"],
|
|
845
|
+
isMulti: !1,
|
|
846
|
+
exactMatch: !0
|
|
847
|
+
},
|
|
848
|
+
{
|
|
849
|
+
/** Matches if field value is null */
|
|
850
|
+
matcher: "null",
|
|
851
|
+
label: "is null",
|
|
852
|
+
fieldTypes: ["integer", "string", "datetime", "boolean"],
|
|
853
|
+
isMulti: !1,
|
|
854
|
+
exactMatch: !0
|
|
855
|
+
},
|
|
856
|
+
{
|
|
857
|
+
/** Matches if field value is not null */
|
|
858
|
+
matcher: "not_null",
|
|
859
|
+
label: "is not null",
|
|
860
|
+
fieldTypes: ["integer", "string", "datetime", "boolean"],
|
|
861
|
+
isMulti: !1,
|
|
862
|
+
exactMatch: !0
|
|
863
|
+
},
|
|
864
|
+
{
|
|
865
|
+
/** Matches if field value is not null */
|
|
866
|
+
matcher: "present",
|
|
867
|
+
label: "is present",
|
|
868
|
+
fieldTypes: ["integer", "string", "datetime", "boolean"],
|
|
869
|
+
isMulti: !1,
|
|
870
|
+
exactMatch: !0
|
|
871
|
+
}
|
|
872
|
+
];
|
|
873
|
+
function ie(e) {
|
|
874
|
+
if (typeof e == "string")
|
|
875
|
+
return C(U(e)) ? "datetime" : "string";
|
|
876
|
+
if (typeof e == "number")
|
|
877
|
+
return "integer";
|
|
878
|
+
if (typeof e == "boolean")
|
|
879
|
+
return "boolean";
|
|
880
|
+
if (Array.isArray(e)) {
|
|
881
|
+
if (typeof e[0] == "string")
|
|
882
|
+
return C(U(e[0])) ? "datetime" : "string";
|
|
883
|
+
if (typeof e[0] == "number")
|
|
884
|
+
return "integer";
|
|
885
|
+
}
|
|
886
|
+
return "string";
|
|
887
|
+
}
|
|
888
|
+
const oe = {
|
|
889
|
+
market: "markets",
|
|
890
|
+
tag: "tags",
|
|
891
|
+
sku: "skus",
|
|
892
|
+
sku_list: "sku_lists"
|
|
893
|
+
};
|
|
894
|
+
function Ra(e) {
|
|
895
|
+
return oe[e];
|
|
896
|
+
}
|
|
897
|
+
function Z(e) {
|
|
898
|
+
const [s, a] = g(void 0);
|
|
899
|
+
return _(() => {
|
|
900
|
+
e?.field != null && da(e.field).then((n) => {
|
|
901
|
+
const c = le.find(
|
|
902
|
+
(i) => i.matcher === e.matcher
|
|
903
|
+
);
|
|
904
|
+
a({
|
|
905
|
+
...n,
|
|
906
|
+
matcherInfos: c,
|
|
907
|
+
resourceSelectorAvailable: n?.resource?.id != null && Object.keys(oe).includes(n.resource.id) && n.path.endsWith(".id") && c?.exactMatch === !0
|
|
908
|
+
});
|
|
909
|
+
}).catch((n) => {
|
|
910
|
+
console.error("Error fetching field info:", n);
|
|
911
|
+
});
|
|
912
|
+
}, [e?.field, e?.matcher]), { infos: s };
|
|
913
|
+
}
|
|
914
|
+
function Va({
|
|
915
|
+
item: e,
|
|
916
|
+
pathPrefix: s
|
|
917
|
+
}) {
|
|
918
|
+
const { setPath: a } = x(), { infos: n } = Z(e);
|
|
919
|
+
let c = n?.field?.type;
|
|
920
|
+
c == null && (c = ie(e?.value));
|
|
921
|
+
const i = n?.resource?.id, u = ["tag"], r = [
|
|
922
|
+
"matches",
|
|
923
|
+
"does_not_match",
|
|
924
|
+
"array_match"
|
|
925
|
+
], o = le.filter(({ fieldTypes: l, visible: d }) => d !== !1 && l.includes(c)).filter(({ matcher: l }) => i == null || i != null && !u.includes(i) || r.includes(l)).map(({ matcher: l, label: d }) => ({ value: l, label: d }));
|
|
926
|
+
return /* @__PURE__ */ t.jsx(
|
|
927
|
+
j,
|
|
928
|
+
{
|
|
929
|
+
name: `${s}.matcher`,
|
|
930
|
+
value: e != null ? o.find((l) => l.value === e.matcher) ?? {
|
|
931
|
+
label: e.matcher != null ? `⚠️ ${e.matcher}` : "",
|
|
932
|
+
value: e.matcher
|
|
933
|
+
} : void 0,
|
|
934
|
+
initialValues: o,
|
|
935
|
+
onSelect: (l) => {
|
|
936
|
+
N(l) && (a(`${s}.matcher`, l.value), ee.includes(
|
|
937
|
+
l.value
|
|
938
|
+
) && a(`${s}.value`, null));
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
);
|
|
942
|
+
}
|
|
943
|
+
const ce = ({ value: e, pathKey: s, infos: a }) => {
|
|
944
|
+
const { sdkClient: n } = ma(), { setPath: c } = x(), i = a?.field?.name ?? "id", u = Ra(a?.resource?.id), { data: r, isLoading: o } = L(
|
|
945
|
+
u,
|
|
946
|
+
"list",
|
|
947
|
+
a?.resource?.id == null ? null : [k({ value: "" })]
|
|
948
|
+
), { data: l, isLoading: d } = L(
|
|
949
|
+
u,
|
|
950
|
+
"list",
|
|
951
|
+
a?.resource?.id == null ? null : [
|
|
952
|
+
{
|
|
953
|
+
...k({ value: "" }),
|
|
954
|
+
filters: {
|
|
955
|
+
id_in: Array.isArray(e) ? e : [e]
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
]
|
|
959
|
+
), h = Q([...l ?? [], ...r ?? []], "id");
|
|
960
|
+
u === "sku_lists" && (console.log("data", r), console.log("selectedData", l), console.log("initialValues", h));
|
|
961
|
+
function p(m) {
|
|
962
|
+
return {
|
|
963
|
+
label: h?.find((f) => f.id === m.toString())?.name ?? m.toString(),
|
|
964
|
+
value: m.toString()
|
|
965
|
+
};
|
|
966
|
+
}
|
|
967
|
+
return /* @__PURE__ */ t.jsx(
|
|
968
|
+
j,
|
|
969
|
+
{
|
|
970
|
+
placeholder: "Search...",
|
|
971
|
+
isClearable: !1,
|
|
972
|
+
isMulti: a?.matcherInfos?.isMulti,
|
|
973
|
+
defaultValue: Array.isArray(e) ? e.map(p) : e != null ? p(e) : void 0,
|
|
974
|
+
menuFooterText: r != null && r.meta.recordCount > 25 ? "Type to search for more options." : void 0,
|
|
975
|
+
initialValues: B(h ?? [], i),
|
|
976
|
+
loadAsyncValues: async (m) => {
|
|
977
|
+
const f = await n[u].list(k({ value: m }));
|
|
978
|
+
return B(f, i);
|
|
979
|
+
},
|
|
980
|
+
onSelect: (m) => {
|
|
981
|
+
I(m) ? c(
|
|
982
|
+
s,
|
|
983
|
+
m.map((f) => f.value).filter((f) => f != null)
|
|
984
|
+
) : N(m) && c(s, m.value);
|
|
985
|
+
}
|
|
986
|
+
},
|
|
987
|
+
`${a?.matcherInfos?.isMulti?.toString()}-${o}-${d}`
|
|
988
|
+
);
|
|
989
|
+
};
|
|
990
|
+
function k({ value: e }) {
|
|
991
|
+
return {
|
|
992
|
+
pageSize: 25,
|
|
993
|
+
sort: {
|
|
994
|
+
name: "asc"
|
|
995
|
+
},
|
|
996
|
+
filters: {
|
|
997
|
+
name_cont: e
|
|
998
|
+
}
|
|
999
|
+
};
|
|
1000
|
+
}
|
|
1001
|
+
function B(e, s) {
|
|
1002
|
+
return e.map((a) => ({
|
|
1003
|
+
label: a.name,
|
|
1004
|
+
// @ts-expect-error TODO: fix this
|
|
1005
|
+
value: a[s]
|
|
1006
|
+
}));
|
|
1007
|
+
}
|
|
1008
|
+
const Y = {
|
|
1009
|
+
in_and: {
|
|
1010
|
+
label: "all of"
|
|
1011
|
+
},
|
|
1012
|
+
in_or: {
|
|
1013
|
+
label: "at least one of"
|
|
1014
|
+
},
|
|
1015
|
+
not_in_and: {
|
|
1016
|
+
label: "not any of"
|
|
1017
|
+
},
|
|
1018
|
+
not_in_or: {
|
|
1019
|
+
label: "not at least one of"
|
|
1020
|
+
}
|
|
1021
|
+
};
|
|
1022
|
+
function G({
|
|
1023
|
+
value: e,
|
|
1024
|
+
pathPrefix: s,
|
|
1025
|
+
hasResourceSelector: a = !1,
|
|
1026
|
+
infos: n
|
|
1027
|
+
}) {
|
|
1028
|
+
return (typeof e != "object" || Array.isArray(e) || e === null) && (e = {
|
|
1029
|
+
in_and: []
|
|
1030
|
+
}), /* @__PURE__ */ t.jsx("div", { children: Object.entries(e).map(([c, i], u) => /* @__PURE__ */ t.jsx(
|
|
1031
|
+
Aa,
|
|
1032
|
+
{
|
|
1033
|
+
infos: n,
|
|
1034
|
+
hasResourceSelector: a,
|
|
1035
|
+
pathPrefix: s,
|
|
1036
|
+
defaultValue: i,
|
|
1037
|
+
initialMatcher: c
|
|
1038
|
+
},
|
|
1039
|
+
`${s}.${// biome-ignore lint/suspicious/noArrayIndexKey: Using index as key is acceptable here since items are static
|
|
1040
|
+
u}`
|
|
1041
|
+
)) });
|
|
1042
|
+
}
|
|
1043
|
+
function Aa({
|
|
1044
|
+
initialMatcher: e,
|
|
1045
|
+
defaultValue: s,
|
|
1046
|
+
pathPrefix: a,
|
|
1047
|
+
hasResourceSelector: n,
|
|
1048
|
+
infos: c
|
|
1049
|
+
}) {
|
|
1050
|
+
const [i, u] = g(e), [r, o] = g(e), [l, d] = g(s), { setPath: h } = x();
|
|
1051
|
+
return _(() => {
|
|
1052
|
+
i !== r && (h(`${a}.${i}`, null), u(r)), h(`${a}.${r}`, l);
|
|
1053
|
+
}, [r, l, h]), /* @__PURE__ */ t.jsxs("div", { className: "flex gap-2 mt-2 first-of-type:mt-0", children: [
|
|
1054
|
+
/* @__PURE__ */ t.jsx("div", { className: "shrink-0", children: /* @__PURE__ */ t.jsx(
|
|
1055
|
+
j,
|
|
1056
|
+
{
|
|
1057
|
+
defaultValue: [
|
|
1058
|
+
{ value: r, label: Y[r].label }
|
|
1059
|
+
],
|
|
1060
|
+
initialValues: Object.entries(Y).map(
|
|
1061
|
+
([p, { label: m }]) => ({
|
|
1062
|
+
value: p,
|
|
1063
|
+
label: m
|
|
1064
|
+
})
|
|
1065
|
+
),
|
|
1066
|
+
onSelect: (p) => {
|
|
1067
|
+
N(p) && o(p.value);
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
) }),
|
|
1071
|
+
/* @__PURE__ */ t.jsx("div", { className: "grow", children: n ? /* @__PURE__ */ t.jsx(
|
|
1072
|
+
ce,
|
|
1073
|
+
{
|
|
1074
|
+
infos: c,
|
|
1075
|
+
value: l,
|
|
1076
|
+
pathKey: `${a}.${r}`
|
|
1077
|
+
}
|
|
1078
|
+
) : /* @__PURE__ */ t.jsx(
|
|
1079
|
+
j,
|
|
1080
|
+
{
|
|
1081
|
+
isMulti: !0,
|
|
1082
|
+
isCreatable: !0,
|
|
1083
|
+
defaultValue: (Array.isArray(l) ? l : []).map((p) => ({
|
|
1084
|
+
value: p,
|
|
1085
|
+
label: p.toString()
|
|
1086
|
+
})),
|
|
1087
|
+
initialValues: [],
|
|
1088
|
+
onSelect: (p) => {
|
|
1089
|
+
I(p) && d(
|
|
1090
|
+
p.map(
|
|
1091
|
+
(m) => typeof m.value == "boolean" ? m.value.toString() : m.value
|
|
1092
|
+
)
|
|
1093
|
+
);
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
) })
|
|
1097
|
+
] });
|
|
1098
|
+
}
|
|
1099
|
+
function Ia({
|
|
1100
|
+
value: e,
|
|
1101
|
+
onChange: s
|
|
1102
|
+
}) {
|
|
1103
|
+
const [a, n] = g(
|
|
1104
|
+
Array.isArray(e) && typeof e[0] == "number" ? e[0] : null
|
|
1105
|
+
), [c, i] = g(
|
|
1106
|
+
Array.isArray(e) && typeof e[1] == "number" ? e[1] : null
|
|
1107
|
+
);
|
|
1108
|
+
return /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-4", children: [
|
|
1109
|
+
/* @__PURE__ */ t.jsx("div", { className: "grow", children: /* @__PURE__ */ t.jsx(
|
|
1110
|
+
b,
|
|
1111
|
+
{
|
|
1112
|
+
type: "number",
|
|
1113
|
+
placeholder: "Min",
|
|
1114
|
+
value: a ?? "",
|
|
1115
|
+
onChange: (u) => {
|
|
1116
|
+
const r = parseInt(u.currentTarget.value, 10);
|
|
1117
|
+
n(Number.isNaN(r) ? null : r), s([Number.isNaN(r) ? null : r, c]);
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
) }),
|
|
1121
|
+
/* @__PURE__ */ t.jsx("span", { className: "text-gray-300", children: "to" }),
|
|
1122
|
+
/* @__PURE__ */ t.jsx("div", { className: "grow", children: /* @__PURE__ */ t.jsx(
|
|
1123
|
+
b,
|
|
1124
|
+
{
|
|
1125
|
+
type: "number",
|
|
1126
|
+
placeholder: "Max",
|
|
1127
|
+
value: c ?? "",
|
|
1128
|
+
onChange: (u) => {
|
|
1129
|
+
const r = parseInt(u.currentTarget.value, 10);
|
|
1130
|
+
i(Number.isNaN(r) ? null : r), s([a, Number.isNaN(r) ? null : r]);
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
) })
|
|
1134
|
+
] });
|
|
1135
|
+
}
|
|
1136
|
+
function Za({
|
|
1137
|
+
value: e,
|
|
1138
|
+
onChange: s
|
|
1139
|
+
}) {
|
|
1140
|
+
const [a, n] = g(
|
|
1141
|
+
Array.isArray(e) && typeof e[0] == "string" ? e[0] : null
|
|
1142
|
+
), [c, i] = g(
|
|
1143
|
+
Array.isArray(e) && typeof e[1] == "string" ? e[1] : null
|
|
1144
|
+
);
|
|
1145
|
+
return /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-4", children: [
|
|
1146
|
+
/* @__PURE__ */ t.jsx("div", { className: "grow", children: /* @__PURE__ */ t.jsx(
|
|
1147
|
+
b,
|
|
1148
|
+
{
|
|
1149
|
+
type: "text",
|
|
1150
|
+
placeholder: "Min",
|
|
1151
|
+
value: a ?? "",
|
|
1152
|
+
onChange: (u) => {
|
|
1153
|
+
const r = u.currentTarget.value;
|
|
1154
|
+
n(r), s([r, c]);
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
) }),
|
|
1158
|
+
/* @__PURE__ */ t.jsx("span", { className: "text-gray-300", children: "to" }),
|
|
1159
|
+
/* @__PURE__ */ t.jsx("div", { className: "grow", children: /* @__PURE__ */ t.jsx(
|
|
1160
|
+
b,
|
|
1161
|
+
{
|
|
1162
|
+
type: "text",
|
|
1163
|
+
placeholder: "Max",
|
|
1164
|
+
value: c ?? "",
|
|
1165
|
+
onChange: (u) => {
|
|
1166
|
+
const r = u.currentTarget.value;
|
|
1167
|
+
i(r), s([a, r]);
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
) })
|
|
1171
|
+
] });
|
|
1172
|
+
}
|
|
1173
|
+
function Da({
|
|
1174
|
+
item: e,
|
|
1175
|
+
pathPrefix: s
|
|
1176
|
+
}) {
|
|
1177
|
+
const { setPath: a } = x(), { infos: n } = Z(e), c = `${s}.value`, [i, u] = g(0), [r, o] = g(e?.matcher), l = e == null || ee.includes(
|
|
1178
|
+
e.matcher
|
|
1179
|
+
);
|
|
1180
|
+
let d = n?.field?.type;
|
|
1181
|
+
ue(e) && (d == null && (d = ie(e.value)), (typeof e.value == "string" && /^{{.*}}$/.test(e.value) || Array.isArray(e.value) && e.value.some((p) => typeof p == "string" && /^{{.*}}$/.test(p))) && (d = "string"));
|
|
1182
|
+
const h = qa(d, e?.matcher, n);
|
|
1183
|
+
return _(
|
|
1184
|
+
function() {
|
|
1185
|
+
r !== e?.matcher && (o(e?.matcher), a(c, null), u((m) => m + 1));
|
|
1186
|
+
},
|
|
1187
|
+
[h]
|
|
1188
|
+
), l ? null : /* @__PURE__ */ t.jsx("div", { children: /* @__PURE__ */ t.jsx(
|
|
1189
|
+
Oa,
|
|
1190
|
+
{
|
|
1191
|
+
item: e,
|
|
1192
|
+
fieldType: d,
|
|
1193
|
+
componentType: h,
|
|
1194
|
+
pathKey: c
|
|
1195
|
+
}
|
|
1196
|
+
) }, i);
|
|
1197
|
+
}
|
|
1198
|
+
function Oa({
|
|
1199
|
+
item: e,
|
|
1200
|
+
fieldType: s,
|
|
1201
|
+
componentType: a,
|
|
1202
|
+
pathKey: n
|
|
1203
|
+
}) {
|
|
1204
|
+
const { setPath: c } = x(), { user: i } = te(), { infos: u } = Z(e), r = ue(e) ? e.value : void 0;
|
|
1205
|
+
switch (a) {
|
|
1206
|
+
case "date": {
|
|
1207
|
+
const o = z(typeof r == "string" ? r : "");
|
|
1208
|
+
return /* @__PURE__ */ t.jsx(
|
|
1209
|
+
pa,
|
|
1210
|
+
{
|
|
1211
|
+
value: C(o) ? o : void 0,
|
|
1212
|
+
showTimeSelect: !0,
|
|
1213
|
+
placeholder: "Enter value",
|
|
1214
|
+
onChange: (l) => {
|
|
1215
|
+
c(n, l?.toJSON());
|
|
1216
|
+
},
|
|
1217
|
+
timezone: i?.timezone
|
|
1218
|
+
}
|
|
1219
|
+
);
|
|
1220
|
+
}
|
|
1221
|
+
case "dateRange": {
|
|
1222
|
+
const o = Array.isArray(r) ? r.map((l) => {
|
|
1223
|
+
const d = z(typeof l == "string" ? l : "");
|
|
1224
|
+
return C(d) ? d : null;
|
|
1225
|
+
}) : [null, null];
|
|
1226
|
+
return /* @__PURE__ */ t.jsx(
|
|
1227
|
+
fa,
|
|
1228
|
+
{
|
|
1229
|
+
value: o,
|
|
1230
|
+
showTimeSelect: !0,
|
|
1231
|
+
onChange: (l) => {
|
|
1232
|
+
c(
|
|
1233
|
+
n,
|
|
1234
|
+
l.map((d) => d?.toJSON() ?? null)
|
|
1235
|
+
);
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
);
|
|
1239
|
+
}
|
|
1240
|
+
case "numberRange":
|
|
1241
|
+
return /* @__PURE__ */ t.jsx(
|
|
1242
|
+
Ia,
|
|
1243
|
+
{
|
|
1244
|
+
value: r,
|
|
1245
|
+
onChange: (o) => {
|
|
1246
|
+
c(n, o);
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
);
|
|
1250
|
+
case "textRange":
|
|
1251
|
+
return /* @__PURE__ */ t.jsx(
|
|
1252
|
+
Za,
|
|
1253
|
+
{
|
|
1254
|
+
value: r,
|
|
1255
|
+
onChange: (o) => {
|
|
1256
|
+
c(n, o);
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
);
|
|
1260
|
+
case "arrayMatch":
|
|
1261
|
+
return /* @__PURE__ */ t.jsx(G, { infos: u, value: r, pathPrefix: n });
|
|
1262
|
+
case "tag":
|
|
1263
|
+
return /* @__PURE__ */ t.jsx(
|
|
1264
|
+
j,
|
|
1265
|
+
{
|
|
1266
|
+
isMulti: !0,
|
|
1267
|
+
isClearable: !1,
|
|
1268
|
+
isCreatable: !0,
|
|
1269
|
+
defaultValue: Array.isArray(r) ? r.map((o) => ({
|
|
1270
|
+
label: o.toString(),
|
|
1271
|
+
value: o
|
|
1272
|
+
})) : [],
|
|
1273
|
+
initialValues: [],
|
|
1274
|
+
onSelect: (o) => {
|
|
1275
|
+
I(o) && c(
|
|
1276
|
+
n,
|
|
1277
|
+
o.map((l) => {
|
|
1278
|
+
if (s === "integer") {
|
|
1279
|
+
const d = parseInt(l.value.toString(), 10);
|
|
1280
|
+
return Number.isNaN(d) ? null : d;
|
|
1281
|
+
}
|
|
1282
|
+
return l.value;
|
|
1283
|
+
}).filter((l) => l != null)
|
|
1284
|
+
);
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
);
|
|
1288
|
+
case "resourceSelector":
|
|
1289
|
+
return e?.matcher === "array_match" ? /* @__PURE__ */ t.jsx(
|
|
1290
|
+
G,
|
|
1291
|
+
{
|
|
1292
|
+
infos: u,
|
|
1293
|
+
value: r,
|
|
1294
|
+
pathPrefix: n,
|
|
1295
|
+
hasResourceSelector: !0
|
|
1296
|
+
}
|
|
1297
|
+
) : /* @__PURE__ */ t.jsx(ce, { infos: u, value: r, pathKey: n });
|
|
1298
|
+
case "number":
|
|
1299
|
+
return /* @__PURE__ */ t.jsx(
|
|
1300
|
+
b,
|
|
1301
|
+
{
|
|
1302
|
+
name: n,
|
|
1303
|
+
type: "number",
|
|
1304
|
+
defaultValue: typeof r == "number" ? r : "",
|
|
1305
|
+
placeholder: "Enter value",
|
|
1306
|
+
onChange: (o) => {
|
|
1307
|
+
c(n, parseInt(o.currentTarget.value, 10));
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
);
|
|
1311
|
+
case "boolean":
|
|
1312
|
+
return /* @__PURE__ */ t.jsx(
|
|
1313
|
+
j,
|
|
1314
|
+
{
|
|
1315
|
+
name: n,
|
|
1316
|
+
defaultValue: typeof r == "boolean" ? {
|
|
1317
|
+
label: r ? "Yes" : "No",
|
|
1318
|
+
value: r
|
|
1319
|
+
} : void 0,
|
|
1320
|
+
initialValues: [
|
|
1321
|
+
{ label: "Yes", value: !0 },
|
|
1322
|
+
{ label: "No", value: !1 }
|
|
1323
|
+
],
|
|
1324
|
+
onSelect: (o) => {
|
|
1325
|
+
N(o) && c(n, o.value);
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
);
|
|
1329
|
+
case "text":
|
|
1330
|
+
case null:
|
|
1331
|
+
return /* @__PURE__ */ t.jsx(
|
|
1332
|
+
b,
|
|
1333
|
+
{
|
|
1334
|
+
name: n,
|
|
1335
|
+
type: "text",
|
|
1336
|
+
defaultValue: typeof r == "string" ? r : JSON.stringify(r),
|
|
1337
|
+
placeholder: "Enter value",
|
|
1338
|
+
onChange: (o) => {
|
|
1339
|
+
c(n, o.currentTarget.value);
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
);
|
|
1343
|
+
default:
|
|
1344
|
+
return K();
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
function ue(e) {
|
|
1348
|
+
return e != null && "value" in e;
|
|
1349
|
+
}
|
|
1350
|
+
function qa(e, s, a) {
|
|
1351
|
+
let n = null;
|
|
1352
|
+
switch (e) {
|
|
1353
|
+
case "datetime": {
|
|
1354
|
+
n = "date";
|
|
1355
|
+
break;
|
|
1356
|
+
}
|
|
1357
|
+
case "boolean": {
|
|
1358
|
+
n = "boolean";
|
|
1359
|
+
break;
|
|
1360
|
+
}
|
|
1361
|
+
case "string": {
|
|
1362
|
+
n = "text";
|
|
1363
|
+
break;
|
|
1364
|
+
}
|
|
1365
|
+
case "integer":
|
|
1366
|
+
case "float": {
|
|
1367
|
+
n = "number";
|
|
1368
|
+
break;
|
|
1369
|
+
}
|
|
1370
|
+
case "array":
|
|
1371
|
+
case "json":
|
|
1372
|
+
case "object":
|
|
1373
|
+
break;
|
|
1374
|
+
default: {
|
|
1375
|
+
n = "text";
|
|
1376
|
+
break;
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
switch (s) {
|
|
1380
|
+
case "eq":
|
|
1381
|
+
case "not_eq":
|
|
1382
|
+
case "lt":
|
|
1383
|
+
case "lteq":
|
|
1384
|
+
case "gt":
|
|
1385
|
+
case "gteq":
|
|
1386
|
+
case "multiple":
|
|
1387
|
+
case "start_with":
|
|
1388
|
+
case "not_start_with":
|
|
1389
|
+
case "end_with":
|
|
1390
|
+
case "not_end_with":
|
|
1391
|
+
break;
|
|
1392
|
+
case "matches":
|
|
1393
|
+
case "does_not_match":
|
|
1394
|
+
break;
|
|
1395
|
+
case "gt_lt":
|
|
1396
|
+
case "gteq_lt":
|
|
1397
|
+
case "gt_lteq":
|
|
1398
|
+
case "gteq_lteq": {
|
|
1399
|
+
n === "number" && (n = "numberRange"), n === "text" && (n = "textRange"), n === "date" && (n = "dateRange");
|
|
1400
|
+
break;
|
|
1401
|
+
}
|
|
1402
|
+
case "is_in":
|
|
1403
|
+
case "is_not_in": {
|
|
1404
|
+
n = "tag";
|
|
1405
|
+
break;
|
|
1406
|
+
}
|
|
1407
|
+
case "array_match": {
|
|
1408
|
+
n = "arrayMatch";
|
|
1409
|
+
break;
|
|
1410
|
+
}
|
|
1411
|
+
}
|
|
1412
|
+
return a?.resourceSelectorAvailable && (n = "resourceSelector"), n;
|
|
1413
|
+
}
|
|
1414
|
+
function Pa({
|
|
1415
|
+
item: e,
|
|
1416
|
+
nestingLevel: s,
|
|
1417
|
+
pathPrefix: a,
|
|
1418
|
+
onDelete: n
|
|
1419
|
+
}) {
|
|
1420
|
+
const { setPath: c } = x(), i = [];
|
|
1421
|
+
return s < 2 && (i[0] ??= [], i[0].push(
|
|
1422
|
+
/* @__PURE__ */ t.jsx(
|
|
1423
|
+
w,
|
|
1424
|
+
{
|
|
1425
|
+
label: "Nest conditions",
|
|
1426
|
+
onClick: () => {
|
|
1427
|
+
c(
|
|
1428
|
+
`${a}.nested.conditions.${(e?.nested?.conditions ?? []).length}`,
|
|
1429
|
+
void 0
|
|
1430
|
+
);
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
)
|
|
1434
|
+
)), n != null && (i[1] ??= [], i[1].push(
|
|
1435
|
+
/* @__PURE__ */ t.jsx(
|
|
1436
|
+
w,
|
|
1437
|
+
{
|
|
1438
|
+
label: "Delete",
|
|
1439
|
+
onClick: () => {
|
|
1440
|
+
c(`${a}`, null), n();
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
)
|
|
1444
|
+
)), /* @__PURE__ */ t.jsxs("div", { className: "bg-gray-50 rounded-md flex items-center", children: [
|
|
1445
|
+
/* @__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: [
|
|
1446
|
+
/* @__PURE__ */ t.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
1447
|
+
/* @__PURE__ */ t.jsx("div", { className: "flex-1", children: /* @__PURE__ */ t.jsx(
|
|
1448
|
+
re,
|
|
1449
|
+
{
|
|
1450
|
+
preset: "condition",
|
|
1451
|
+
value: e?.field,
|
|
1452
|
+
name: `${a}.field`
|
|
1453
|
+
}
|
|
1454
|
+
) }),
|
|
1455
|
+
/* @__PURE__ */ t.jsx("div", { children: /* @__PURE__ */ t.jsx(Va, { item: e, pathPrefix: a }) })
|
|
1456
|
+
] }),
|
|
1457
|
+
/* @__PURE__ */ t.jsx(Da, { item: e, pathPrefix: a })
|
|
1458
|
+
] }) }),
|
|
1459
|
+
i.length > 0 && /* @__PURE__ */ t.jsx(
|
|
1460
|
+
A,
|
|
1461
|
+
{
|
|
1462
|
+
className: "w-8 border-l border-gray-100 flex items-center justify-center self-stretch",
|
|
1463
|
+
dropdownLabel: /* @__PURE__ */ t.jsx(
|
|
1464
|
+
"button",
|
|
1465
|
+
{
|
|
1466
|
+
type: "button",
|
|
1467
|
+
className: "flex items-center justify-center self-stretch grow",
|
|
1468
|
+
children: /* @__PURE__ */ t.jsx(v, { name: "dotsThreeVertical", size: 16, weight: "bold" })
|
|
1469
|
+
}
|
|
1470
|
+
),
|
|
1471
|
+
dropdownItems: i.map((u, r, o) => (
|
|
1472
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: Using index as key is acceptable here since items are static
|
|
1473
|
+
/* @__PURE__ */ t.jsxs(F.Fragment, { children: [
|
|
1474
|
+
u.map((l, d) => (
|
|
1475
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: Using index as key is acceptable here since items are static
|
|
1476
|
+
/* @__PURE__ */ t.jsx(F.Fragment, { children: l }, d)
|
|
1477
|
+
)),
|
|
1478
|
+
r < o.length - 1 && /* @__PURE__ */ t.jsx(ae, {})
|
|
1479
|
+
] }, r)
|
|
1480
|
+
))
|
|
1481
|
+
}
|
|
1482
|
+
)
|
|
1483
|
+
] });
|
|
1484
|
+
}
|
|
1485
|
+
function de({
|
|
1486
|
+
item: e,
|
|
1487
|
+
children: s,
|
|
1488
|
+
nestingLevel: a = 0,
|
|
1489
|
+
pathPrefix: n
|
|
1490
|
+
}) {
|
|
1491
|
+
const {
|
|
1492
|
+
state: { selectedRuleIndex: c }
|
|
1493
|
+
} = x(), i = e?.conditions_logic?.toLowerCase() ?? "and", { setPath: u } = x(), [r, o] = g(0), l = a > 0;
|
|
1494
|
+
return /* @__PURE__ */ t.jsxs(
|
|
1495
|
+
"div",
|
|
1496
|
+
{
|
|
1497
|
+
className: V("query-group", {
|
|
1498
|
+
"p-4 border border-gray-200 rounded-md": l
|
|
1499
|
+
}),
|
|
1500
|
+
children: [
|
|
1501
|
+
s,
|
|
1502
|
+
e != null && (e.conditions ?? []).length > 0 && /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
1503
|
+
/* @__PURE__ */ t.jsxs(
|
|
1504
|
+
"select",
|
|
1505
|
+
{
|
|
1506
|
+
onChange: (d) => {
|
|
1507
|
+
u(
|
|
1508
|
+
`${n}.conditions_logic`,
|
|
1509
|
+
d.currentTarget.value
|
|
1510
|
+
);
|
|
1511
|
+
},
|
|
1512
|
+
defaultValue: i,
|
|
1513
|
+
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",
|
|
1514
|
+
children: [
|
|
1515
|
+
/* @__PURE__ */ t.jsxs("option", { value: "and", children: [
|
|
1516
|
+
l ? "Nested in " : "",
|
|
1517
|
+
"AND"
|
|
1518
|
+
] }),
|
|
1519
|
+
/* @__PURE__ */ t.jsxs("option", { value: "or", children: [
|
|
1520
|
+
l ? "Nested in " : "",
|
|
1521
|
+
"OR"
|
|
1522
|
+
] })
|
|
1523
|
+
]
|
|
1524
|
+
}
|
|
1525
|
+
),
|
|
1526
|
+
/* @__PURE__ */ t.jsx("div", { className: "border-l border-gray-200 ml-3 pt-3", children: e?.conditions?.map((d, h, p) => {
|
|
1527
|
+
const m = h === p.length - 1;
|
|
1528
|
+
return /* @__PURE__ */ t.jsxs(
|
|
1529
|
+
"div",
|
|
1530
|
+
{
|
|
1531
|
+
className: "flex items-center mb-4 last:mb-0 relative",
|
|
1532
|
+
children: [
|
|
1533
|
+
/* @__PURE__ */ t.jsx(La, { rounded: m }),
|
|
1534
|
+
/* @__PURE__ */ t.jsx("div", { className: "ml-4 w-full", children: /* @__PURE__ */ t.jsx(
|
|
1535
|
+
de,
|
|
1536
|
+
{
|
|
1537
|
+
item: d?.nested ?? void 0,
|
|
1538
|
+
nestingLevel: d?.nested != null ? a + 1 : 0,
|
|
1539
|
+
pathPrefix: `${n}.conditions.${h}.nested`,
|
|
1540
|
+
children: /* @__PURE__ */ t.jsx(
|
|
1541
|
+
"div",
|
|
1542
|
+
{
|
|
1543
|
+
className: V({
|
|
1544
|
+
"mb-4": d?.nested != null
|
|
1545
|
+
}),
|
|
1546
|
+
children: /* @__PURE__ */ t.jsx(
|
|
1547
|
+
Pa,
|
|
1548
|
+
{
|
|
1549
|
+
item: d,
|
|
1550
|
+
nestingLevel: a,
|
|
1551
|
+
pathPrefix: `${n}.conditions.${h}`,
|
|
1552
|
+
onDelete: p.length > 1 || a > 0 ? () => {
|
|
1553
|
+
o((f) => f + 1);
|
|
1554
|
+
} : void 0
|
|
1555
|
+
}
|
|
1556
|
+
)
|
|
1557
|
+
}
|
|
1558
|
+
)
|
|
1559
|
+
}
|
|
1560
|
+
) })
|
|
1561
|
+
]
|
|
1562
|
+
},
|
|
1563
|
+
`${c}-${h}-${r}`
|
|
1564
|
+
);
|
|
1565
|
+
}) })
|
|
1566
|
+
] })
|
|
1567
|
+
]
|
|
1568
|
+
}
|
|
1569
|
+
);
|
|
1570
|
+
}
|
|
1571
|
+
function La({
|
|
1572
|
+
rounded: e = !1
|
|
1573
|
+
}) {
|
|
1574
|
+
return e ? /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
1575
|
+
/* @__PURE__ */ t.jsx("div", { className: "absolute -left-px top-1/2 w-px h-1/2 bg-white" }),
|
|
1576
|
+
/* @__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" })
|
|
1577
|
+
] }) : /* @__PURE__ */ t.jsx("div", { className: "absolute left-0 top-1/2 -translate-y-1/2 w-3.5 h-px bg-gray-200" });
|
|
1578
|
+
}
|
|
1579
|
+
function Fa() {
|
|
1580
|
+
const {
|
|
1581
|
+
setPath: e,
|
|
1582
|
+
state: { value: s, selectedRuleIndex: a }
|
|
1583
|
+
} = x(), [n, c] = g(
|
|
1584
|
+
s.rules?.[a]?.name ?? ""
|
|
1585
|
+
);
|
|
1586
|
+
return _(() => {
|
|
1587
|
+
c(s.rules?.[a]?.name ?? "");
|
|
1588
|
+
}, [a]), // <Input
|
|
1589
|
+
// value={value.rules?.[selectedRuleIndex]?.name}
|
|
1590
|
+
// onChange={(event) => {
|
|
1591
|
+
// const target = event.currentTarget
|
|
1592
|
+
// const value = target.value.replace(/[\n\s]+/g, " ").trim()
|
|
1593
|
+
// setPath(`rules.${selectedRuleIndex}.name`, value)
|
|
1594
|
+
// }}
|
|
1595
|
+
// className="bg-transparent border-0 shadow-none field-sizing-content"
|
|
1596
|
+
// />
|
|
1597
|
+
// biome-ignore lint/a11y/noStaticElementInteractions: This <div> is used with contentEditable
|
|
1598
|
+
/* @__PURE__ */ t.jsx(
|
|
1599
|
+
"div",
|
|
1600
|
+
{
|
|
1601
|
+
contentEditable: "plaintext-only",
|
|
1602
|
+
suppressContentEditableWarning: !0,
|
|
1603
|
+
onInput: (i) => {
|
|
1604
|
+
const r = i.currentTarget.innerText.replace(/[\n\s]+/g, " ").trim();
|
|
1605
|
+
e(`rules.${a}.name`, r);
|
|
1606
|
+
},
|
|
1607
|
+
onKeyDown: (i) => {
|
|
1608
|
+
i.key === "Enter" && (i.preventDefault(), i.currentTarget.blur());
|
|
1609
|
+
},
|
|
1610
|
+
onBlur: (i) => {
|
|
1611
|
+
const u = i.currentTarget;
|
|
1612
|
+
u.innerText = u.innerText.replace(/[\n\s]+/g, " ").trim();
|
|
1613
|
+
},
|
|
1614
|
+
children: n
|
|
1615
|
+
},
|
|
1616
|
+
a
|
|
1617
|
+
);
|
|
1618
|
+
}
|
|
1619
|
+
const X = {
|
|
1620
|
+
rules: []
|
|
1621
|
+
}, E = (e) => {
|
|
1622
|
+
try {
|
|
1623
|
+
return JSON.parse(e ?? JSON.stringify(X));
|
|
1624
|
+
} catch {
|
|
1625
|
+
return X;
|
|
1626
|
+
}
|
|
1627
|
+
}, za = (e) => {
|
|
1628
|
+
try {
|
|
1629
|
+
return JSON.parse(e ?? "{}"), !0;
|
|
1630
|
+
} catch {
|
|
1631
|
+
return !1;
|
|
1632
|
+
}
|
|
1633
|
+
};
|
|
1634
|
+
function Qa(e) {
|
|
1635
|
+
const {
|
|
1636
|
+
settings: { domain: s }
|
|
1637
|
+
} = te(), [a, n] = g([]), [c, i] = g(
|
|
1638
|
+
E(e.value ?? e.defaultValue)
|
|
1639
|
+
);
|
|
1640
|
+
return _(
|
|
1641
|
+
function() {
|
|
1642
|
+
c.rules?.length === 0 && i(E(e.value));
|
|
1643
|
+
},
|
|
1644
|
+
[e.value]
|
|
1645
|
+
), _(
|
|
1646
|
+
function() {
|
|
1647
|
+
ha(e.schemaType, s).then((r) => {
|
|
1648
|
+
const l = y.object({
|
|
1649
|
+
properties: y.object({
|
|
1650
|
+
rules: y.object({
|
|
1651
|
+
items: y.object({
|
|
1652
|
+
properties: y.object({
|
|
1653
|
+
actions: y.object({
|
|
1654
|
+
items: y.object({
|
|
1655
|
+
anyOf: y.array(
|
|
1656
|
+
y.object({
|
|
1657
|
+
properties: y.object({
|
|
1658
|
+
type: y.object({
|
|
1659
|
+
enum: y.string().array()
|
|
1660
|
+
})
|
|
1661
|
+
})
|
|
1662
|
+
})
|
|
1663
|
+
)
|
|
1664
|
+
})
|
|
1665
|
+
})
|
|
1666
|
+
})
|
|
1667
|
+
})
|
|
1668
|
+
})
|
|
1669
|
+
})
|
|
1670
|
+
}).parse(r).properties.rules.items.properties.actions.items.anyOf.flatMap(
|
|
1671
|
+
(d) => d.properties.type.enum
|
|
1672
|
+
);
|
|
1673
|
+
n([...new Set(l)]);
|
|
1674
|
+
});
|
|
1675
|
+
},
|
|
1676
|
+
[s]
|
|
1677
|
+
), /* @__PURE__ */ t.jsx(
|
|
1678
|
+
wa,
|
|
1679
|
+
{
|
|
1680
|
+
initialValue: {
|
|
1681
|
+
value: { rules: c.rules },
|
|
1682
|
+
availableActionTypes: a,
|
|
1683
|
+
schemaType: e.schemaType
|
|
1684
|
+
},
|
|
1685
|
+
children: /* @__PURE__ */ t.jsx(Ua, { ...e })
|
|
1686
|
+
}
|
|
1687
|
+
);
|
|
1688
|
+
}
|
|
1689
|
+
function Ua(e) {
|
|
1690
|
+
const {
|
|
1691
|
+
state: { value: s, selectedRuleIndex: a },
|
|
1692
|
+
setSelectedRuleIndex: n,
|
|
1693
|
+
setValue: c,
|
|
1694
|
+
setPath: i
|
|
1695
|
+
} = x(), [u, r] = g(
|
|
1696
|
+
e.defaultCodeEditorVisible ?? !1
|
|
1697
|
+
), o = s.rules?.[a], l = se(null), [d, h] = g(0);
|
|
1698
|
+
_(
|
|
1699
|
+
function() {
|
|
1700
|
+
R(E(l.current?.getValue()), s) || l.current?.setValue(JSON.stringify(s, null, 2)), e.onChange?.(s);
|
|
1701
|
+
},
|
|
1702
|
+
[s]
|
|
1703
|
+
);
|
|
1704
|
+
const p = S(
|
|
1705
|
+
(m) => {
|
|
1706
|
+
const f = E(m);
|
|
1707
|
+
l.current?.hasTextFocus() && za(m) && !R(f, s) && (c(f), h((T) => T + 1));
|
|
1708
|
+
},
|
|
1709
|
+
[s]
|
|
1710
|
+
);
|
|
1711
|
+
return /* @__PURE__ */ t.jsx(
|
|
1712
|
+
ga,
|
|
1713
|
+
{
|
|
1714
|
+
hint: e.hint,
|
|
1715
|
+
feedback: e.feedback,
|
|
1716
|
+
className: "h-full [&>div:first-of-type]:h-full",
|
|
1717
|
+
children: /* @__PURE__ */ t.jsxs("section", { className: "flex h-full", children: [
|
|
1718
|
+
/* @__PURE__ */ t.jsxs(
|
|
1719
|
+
"div",
|
|
1720
|
+
{
|
|
1721
|
+
className: `shrink-0 basis-3/5 overflow-x-auto relative flex flex-col ${u ? "" : "grow"}`,
|
|
1722
|
+
children: [
|
|
1723
|
+
/* @__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: [
|
|
1724
|
+
/* @__PURE__ */ t.jsxs("div", { className: "flex items-center flex-wrap basis-full", children: [
|
|
1725
|
+
s.rules?.map((m, f, T) => {
|
|
1726
|
+
const me = `#${(f + 1).toString().padStart(2, "0")}`;
|
|
1727
|
+
return /* @__PURE__ */ t.jsxs(
|
|
1728
|
+
"div",
|
|
1729
|
+
{
|
|
1730
|
+
className: "flex items-center py-3 pl-4 pr-2 border-r basis-[88px] justify-center",
|
|
1731
|
+
children: [
|
|
1732
|
+
/* @__PURE__ */ t.jsx(
|
|
1733
|
+
"button",
|
|
1734
|
+
{
|
|
1735
|
+
type: "button",
|
|
1736
|
+
className: V("font-bold mr-2", {
|
|
1737
|
+
"text-black": a === f
|
|
1738
|
+
}),
|
|
1739
|
+
onClick: () => {
|
|
1740
|
+
n(f);
|
|
1741
|
+
},
|
|
1742
|
+
children: me
|
|
1743
|
+
}
|
|
1744
|
+
),
|
|
1745
|
+
/* @__PURE__ */ t.jsx(
|
|
1746
|
+
A,
|
|
1747
|
+
{
|
|
1748
|
+
menuPosition: f === 0 ? "bottom-left" : "bottom-right",
|
|
1749
|
+
dropdownLabel: /* @__PURE__ */ t.jsx(M, { variant: "circle", children: /* @__PURE__ */ t.jsx(v, { name: "dotsThreeVertical", size: 16 }) }),
|
|
1750
|
+
dropdownItems: /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
1751
|
+
/* @__PURE__ */ t.jsx(
|
|
1752
|
+
w,
|
|
1753
|
+
{
|
|
1754
|
+
onClick: () => {
|
|
1755
|
+
const D = s.rules?.length ?? 0;
|
|
1756
|
+
i(`rules.${D}`, {
|
|
1757
|
+
...m,
|
|
1758
|
+
id: void 0,
|
|
1759
|
+
name: `${m.name} (copy)`
|
|
1760
|
+
}), n(D);
|
|
1761
|
+
},
|
|
1762
|
+
label: "Duplicate"
|
|
1763
|
+
}
|
|
1764
|
+
),
|
|
1765
|
+
/* @__PURE__ */ t.jsx(ae, {}),
|
|
1766
|
+
/* @__PURE__ */ t.jsx(
|
|
1767
|
+
w,
|
|
1768
|
+
{
|
|
1769
|
+
disabled: T.length === 1,
|
|
1770
|
+
onClick: () => {
|
|
1771
|
+
i(`rules.${f}`, null), a >= f && n(a - 1);
|
|
1772
|
+
},
|
|
1773
|
+
label: "Delete"
|
|
1774
|
+
}
|
|
1775
|
+
)
|
|
1776
|
+
] })
|
|
1777
|
+
}
|
|
1778
|
+
)
|
|
1779
|
+
]
|
|
1780
|
+
},
|
|
1781
|
+
`${f}-${m.id}`
|
|
1782
|
+
);
|
|
1783
|
+
}),
|
|
1784
|
+
/* @__PURE__ */ t.jsx("div", { className: "min-h-[49px] flex items-center", children: /* @__PURE__ */ t.jsx(
|
|
1785
|
+
M,
|
|
1786
|
+
{
|
|
1787
|
+
variant: "circle",
|
|
1788
|
+
className: "mx-4",
|
|
1789
|
+
onClick: () => {
|
|
1790
|
+
i(`rules.${s.rules?.length ?? 0}`, {
|
|
1791
|
+
name: "Rule name",
|
|
1792
|
+
actions: [null],
|
|
1793
|
+
conditions: [null]
|
|
1794
|
+
}), n(s.rules?.length ?? 0);
|
|
1795
|
+
},
|
|
1796
|
+
children: /* @__PURE__ */ t.jsx(v, { name: "plus", size: 16, className: "shrink-0" })
|
|
1797
|
+
}
|
|
1798
|
+
) })
|
|
1799
|
+
] }),
|
|
1800
|
+
/* @__PURE__ */ t.jsx("div", { className: "grow flex justify-end", children: /* @__PURE__ */ t.jsx(
|
|
1801
|
+
M,
|
|
1802
|
+
{
|
|
1803
|
+
variant: "circle",
|
|
1804
|
+
onClick: () => {
|
|
1805
|
+
r(!u);
|
|
1806
|
+
},
|
|
1807
|
+
children: /* @__PURE__ */ t.jsx(v, { name: "sidebarSimple", size: 16 })
|
|
1808
|
+
}
|
|
1809
|
+
) })
|
|
1810
|
+
] }),
|
|
1811
|
+
/* @__PURE__ */ t.jsx(Wa, { children: o && /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
1812
|
+
/* @__PURE__ */ t.jsxs("div", { className: "mb-8 flex items-center gap-2", children: [
|
|
1813
|
+
/* @__PURE__ */ t.jsx(Fa, {}),
|
|
1814
|
+
/* @__PURE__ */ t.jsx(v, { name: "pencilSimple", size: 16, className: "shrink-0" })
|
|
1815
|
+
] }),
|
|
1816
|
+
/* @__PURE__ */ t.jsx(H, { title: "Actions", icon: "lightning", children: /* @__PURE__ */ t.jsx(ka, { actions: o?.actions }) }),
|
|
1817
|
+
/* @__PURE__ */ t.jsx(Ja, { children: "when" }),
|
|
1818
|
+
/* @__PURE__ */ t.jsxs(H, { title: "Conditions", icon: "treeView", children: [
|
|
1819
|
+
/* @__PURE__ */ t.jsx(
|
|
1820
|
+
de,
|
|
1821
|
+
{
|
|
1822
|
+
item: o,
|
|
1823
|
+
pathPrefix: `rules.${a}`
|
|
1824
|
+
}
|
|
1825
|
+
),
|
|
1826
|
+
/* @__PURE__ */ t.jsx("div", { className: "mt-6", children: /* @__PURE__ */ t.jsxs(
|
|
1827
|
+
M,
|
|
1828
|
+
{
|
|
1829
|
+
size: "small",
|
|
1830
|
+
variant: "secondary",
|
|
1831
|
+
alignItems: "center",
|
|
1832
|
+
onClick: () => {
|
|
1833
|
+
i(
|
|
1834
|
+
`rules.${a}.conditions.${o?.conditions?.length ?? 0}`,
|
|
1835
|
+
void 0
|
|
1836
|
+
);
|
|
1837
|
+
},
|
|
1838
|
+
children: [
|
|
1839
|
+
/* @__PURE__ */ t.jsx(v, { name: "plusCircle" }),
|
|
1840
|
+
" Add condition"
|
|
1841
|
+
]
|
|
1842
|
+
}
|
|
1843
|
+
) })
|
|
1844
|
+
] })
|
|
1845
|
+
] }) })
|
|
1846
|
+
]
|
|
1847
|
+
},
|
|
1848
|
+
d
|
|
1849
|
+
),
|
|
1850
|
+
u && /* @__PURE__ */ t.jsx("div", { className: "shrink-0 basis-2/5", children: /* @__PURE__ */ t.jsx(
|
|
1851
|
+
xa,
|
|
1852
|
+
{
|
|
1853
|
+
ref: l,
|
|
1854
|
+
name: e.id ?? e.name,
|
|
1855
|
+
height: "100%",
|
|
1856
|
+
language: "json",
|
|
1857
|
+
jsonSchema: e.schemaType,
|
|
1858
|
+
defaultValue: JSON.stringify(s, null, 2),
|
|
1859
|
+
noRounding: !0,
|
|
1860
|
+
onChange: p
|
|
1861
|
+
}
|
|
1862
|
+
) })
|
|
1863
|
+
] })
|
|
1864
|
+
}
|
|
1865
|
+
);
|
|
1866
|
+
}
|
|
1867
|
+
function Ja({ children: e }) {
|
|
1868
|
+
return /* @__PURE__ */ t.jsxs("div", { className: "text-gray-500 flex items-center justify-center flex-col", children: [
|
|
1869
|
+
/* @__PURE__ */ t.jsx("div", { className: "h-6 w-[2px] bg-gray-200" }),
|
|
1870
|
+
/* @__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 }),
|
|
1871
|
+
/* @__PURE__ */ t.jsx("div", { className: "h-6 w-[2px] bg-gray-200" })
|
|
1872
|
+
] });
|
|
1873
|
+
}
|
|
1874
|
+
function H({
|
|
1875
|
+
children: e,
|
|
1876
|
+
title: s,
|
|
1877
|
+
icon: a
|
|
1878
|
+
}) {
|
|
1879
|
+
return /* @__PURE__ */ t.jsxs("div", { className: "rounded-md bg-white shadow-xs", children: [
|
|
1880
|
+
/* @__PURE__ */ t.jsxs("div", { className: "flex items-center space-x-4 py-4 border-b border-gray-100", children: [
|
|
1881
|
+
/* @__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 }) }),
|
|
1882
|
+
/* @__PURE__ */ t.jsx("h2", { className: "text-lg font-semibold", children: s })
|
|
1883
|
+
] }),
|
|
1884
|
+
/* @__PURE__ */ t.jsx("div", { className: "p-6", children: e })
|
|
1885
|
+
] });
|
|
1886
|
+
}
|
|
1887
|
+
function Wa({
|
|
1888
|
+
children: e
|
|
1889
|
+
}) {
|
|
1890
|
+
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 }) });
|
|
1891
|
+
}
|
|
1892
|
+
export {
|
|
1893
|
+
Qa as RuleEngine
|
|
1894
|
+
};
|