@commercelayer/app-elements 6.2.1 → 6.3.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-D4jDLyHV.js → InputDateComponent-Y5UIbT0E.js} +61 -61
- package/dist/{RuleEngineComponent-DH23EZ8v.js → RuleEngineComponent-CDGtF4ug.js} +1106 -920
- package/dist/{en-DnI-oLj-.js → en-Psn8u2uC.js} +9 -4
- package/dist/{it-9hWwbmiy.js → it-DsWhEkJp.js} +8 -3
- package/dist/locales/en.d.ts +8 -3
- package/dist/{main-L857O21K.js → main-Zwf-ZNBk.js} +5845 -5750
- package/dist/main.d.ts +7 -6
- package/dist/main.js +142 -141
- package/dist/{parseISO-CbJPLsTx.js → parseISO-DQvhbRdk.js} +1 -1
- package/dist/providers/I18NProvider.d.ts +2 -0
- package/dist/providers/TokenProvider/index.d.ts +1 -0
- package/dist/style.css +1 -1
- package/dist/ui/atoms/Avatar.d.ts +2 -2
- package/dist/ui/atoms/PageHeading/index.d.ts +1 -0
- package/dist/ui/composite/Modal.d.ts +18 -0
- package/dist/ui/composite/PageLayout.d.ts +2 -2
- package/dist/ui/forms/InputSelect/InputSelect.d.ts +4 -0
- package/dist/ui/forms/InputSelect/index.d.ts +1 -1
- package/dist/ui/forms/InputSelect/overrides.d.ts +2 -0
- package/dist/ui/forms/RuleEngine/Action/ActionListItem.d.ts +4 -0
- package/dist/ui/forms/RuleEngine/Condition/hooks.d.ts +5 -0
- package/dist/ui/forms/RuleEngine/InputResourcePath.d.ts +1 -2
- package/dist/ui/resources/useResourceFilters/index.d.ts +2 -1
- package/dist/vendor.css +1 -1
- package/package.json +1 -1
|
@@ -1,179 +1,183 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { t as
|
|
3
|
-
import
|
|
2
|
+
import { t as L, B as be, D as ye, E as ve, I as je, N as _e, O as Te, P as Ne, Z as R, b as Me, d as we, e as Se, f as Ce, g as $e, h as ke, i as Ee, j as Ve, k as Re, l as F, n as Ae, o as Ie, p as Ze, q as De, r as Oe, s as Pe, u as qe, v as Le, w as Fe, x as Ge, y as ze, z as Ue, A as We, C as Je, F as Be, G as Ye, H as Xe, J as He, K as Qe, L as Ke, M as et, Q as tt, R as at, S as st, T as nt, U as rt, V as lt, W as it, X as ot, Y as ct, _ as ut, $ as dt, a0 as mt, a1 as pt, a2 as ft, a3 as ht, a4 as gt, a5 as xt, a6 as bt, a7 as yt, a8 as vt, a9 as G, aa as jt, ab as _t, ac as Tt, ad as Nt, ae as Mt, af as wt, ag as St, ah as Ct, ai as $t, aj as kt, ak as Et, al as Vt, am as Rt, an as At, ao as It, ap as Zt, aq as Dt, ar as Ot, as as Pt, at as qt, au as Lt, av as Ft, aw as Gt, ax as zt, ay as Ut, az as Wt, aA as Jt, aB as Bt, aC as Yt, aD as Xt, aE as Ht, aF as Qt, aG as Kt, aH as ea, aI as ta, aJ as aa, aK as sa, aL as na, aM as ra, aN as la, aO as ia, aP as oa, aQ as ca, aR as ua, aS as da, aT as ma, aU as t, aV as Z, aW as z, aX as $, aY as pa, aZ as fa, a_ as ha, a$ as te, b0 as y, b1 as v, b2 as T, b3 as E, b4 as D, b5 as M, b6 as j, b7 as ae, b8 as N, b9 as se, ba as ga, bb as ne, bc as xa, bd as U, be as re, bf as ba, bg as ya, bh as le, bi as ie, bj as S, bk as va, bl as w, bm as ja, bn as _a, bo as Ta } from "./main-Zwf-ZNBk.js";
|
|
3
|
+
import W, { useReducer as Na, useCallback as C, useMemo as Ma, createContext as wa, useContext as Sa, useState as g, useEffect as _, useRef as O } from "react";
|
|
4
4
|
import "react-hook-form";
|
|
5
5
|
import "wouter";
|
|
6
|
-
import { p as
|
|
7
|
-
function
|
|
8
|
-
const
|
|
6
|
+
import { p as J } from "./parseISO-DQvhbRdk.js";
|
|
7
|
+
function B(e, a) {
|
|
8
|
+
const n = 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 n ? L(
|
|
12
12
|
Date.UTC(
|
|
13
|
-
+
|
|
14
|
-
+
|
|
15
|
-
+
|
|
16
|
-
+
|
|
17
|
-
+
|
|
18
|
-
+
|
|
19
|
-
+((
|
|
13
|
+
+n[1],
|
|
14
|
+
+n[2] - 1,
|
|
15
|
+
+n[3],
|
|
16
|
+
+n[4] - (+n[9] || 0) * (n[8] == "-" ? -1 : 1),
|
|
17
|
+
+n[5] - (+n[10] || 0) * (n[8] == "-" ? -1 : 1),
|
|
18
|
+
+n[6],
|
|
19
|
+
+((n[7] || "0") + "00").substring(0, 3)
|
|
20
20
|
),
|
|
21
|
-
|
|
22
|
-
) :
|
|
21
|
+
a?.in
|
|
22
|
+
) : L(NaN, a?.in);
|
|
23
23
|
}
|
|
24
|
-
const
|
|
24
|
+
const b = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
25
25
|
__proto__: null,
|
|
26
|
-
BRAND:
|
|
27
|
-
DIRTY:
|
|
28
|
-
EMPTY_PATH:
|
|
29
|
-
INVALID:
|
|
30
|
-
NEVER:
|
|
31
|
-
OK:
|
|
32
|
-
ParseStatus:
|
|
33
|
-
Schema:
|
|
34
|
-
ZodAny:
|
|
35
|
-
ZodArray:
|
|
36
|
-
ZodBigInt:
|
|
37
|
-
ZodBoolean:
|
|
38
|
-
ZodBranded:
|
|
39
|
-
ZodCatch:
|
|
40
|
-
ZodDate:
|
|
41
|
-
ZodDefault:
|
|
42
|
-
ZodDiscriminatedUnion:
|
|
43
|
-
ZodEffects:
|
|
44
|
-
ZodEnum:
|
|
45
|
-
ZodError:
|
|
26
|
+
BRAND: be,
|
|
27
|
+
DIRTY: ye,
|
|
28
|
+
EMPTY_PATH: ve,
|
|
29
|
+
INVALID: je,
|
|
30
|
+
NEVER: _e,
|
|
31
|
+
OK: Te,
|
|
32
|
+
ParseStatus: Ne,
|
|
33
|
+
Schema: R,
|
|
34
|
+
ZodAny: Me,
|
|
35
|
+
ZodArray: we,
|
|
36
|
+
ZodBigInt: Se,
|
|
37
|
+
ZodBoolean: Ce,
|
|
38
|
+
ZodBranded: $e,
|
|
39
|
+
ZodCatch: ke,
|
|
40
|
+
ZodDate: Ee,
|
|
41
|
+
ZodDefault: Ve,
|
|
42
|
+
ZodDiscriminatedUnion: Re,
|
|
43
|
+
ZodEffects: F,
|
|
44
|
+
ZodEnum: Ae,
|
|
45
|
+
ZodError: Ie,
|
|
46
46
|
get ZodFirstPartyTypeKind() {
|
|
47
|
-
return
|
|
47
|
+
return Ze;
|
|
48
48
|
},
|
|
49
|
-
ZodFunction:
|
|
50
|
-
ZodIntersection:
|
|
51
|
-
ZodIssueCode:
|
|
52
|
-
ZodLazy:
|
|
53
|
-
ZodLiteral:
|
|
54
|
-
ZodMap:
|
|
55
|
-
ZodNaN:
|
|
56
|
-
ZodNativeEnum:
|
|
57
|
-
ZodNever:
|
|
58
|
-
ZodNull:
|
|
59
|
-
ZodNullable:
|
|
60
|
-
ZodNumber:
|
|
61
|
-
ZodObject:
|
|
62
|
-
ZodOptional:
|
|
63
|
-
ZodParsedType:
|
|
64
|
-
ZodPipeline:
|
|
65
|
-
ZodPromise:
|
|
66
|
-
ZodReadonly:
|
|
67
|
-
ZodRecord:
|
|
68
|
-
ZodSchema:
|
|
69
|
-
ZodSet:
|
|
70
|
-
ZodString:
|
|
71
|
-
ZodSymbol:
|
|
72
|
-
ZodTransformer:
|
|
73
|
-
ZodTuple:
|
|
74
|
-
ZodType:
|
|
75
|
-
ZodUndefined:
|
|
76
|
-
ZodUnion:
|
|
77
|
-
ZodUnknown:
|
|
78
|
-
ZodVoid:
|
|
79
|
-
addIssueToContext:
|
|
80
|
-
any:
|
|
81
|
-
array:
|
|
82
|
-
bigint:
|
|
83
|
-
boolean:
|
|
84
|
-
coerce:
|
|
85
|
-
custom:
|
|
86
|
-
date:
|
|
87
|
-
datetimeRegex:
|
|
88
|
-
defaultErrorMap:
|
|
89
|
-
discriminatedUnion:
|
|
90
|
-
effect:
|
|
91
|
-
enum:
|
|
92
|
-
function:
|
|
93
|
-
getErrorMap:
|
|
94
|
-
getParsedType:
|
|
95
|
-
instanceof:
|
|
96
|
-
intersection:
|
|
97
|
-
isAborted:
|
|
98
|
-
isAsync:
|
|
99
|
-
isDirty:
|
|
100
|
-
isValid:
|
|
101
|
-
late:
|
|
102
|
-
lazy:
|
|
103
|
-
literal:
|
|
104
|
-
makeIssue:
|
|
105
|
-
map:
|
|
106
|
-
nan:
|
|
107
|
-
nativeEnum:
|
|
108
|
-
never:
|
|
109
|
-
null:
|
|
110
|
-
nullable:
|
|
111
|
-
number:
|
|
112
|
-
object:
|
|
49
|
+
ZodFunction: De,
|
|
50
|
+
ZodIntersection: Oe,
|
|
51
|
+
ZodIssueCode: Pe,
|
|
52
|
+
ZodLazy: qe,
|
|
53
|
+
ZodLiteral: Le,
|
|
54
|
+
ZodMap: Fe,
|
|
55
|
+
ZodNaN: Ge,
|
|
56
|
+
ZodNativeEnum: ze,
|
|
57
|
+
ZodNever: Ue,
|
|
58
|
+
ZodNull: We,
|
|
59
|
+
ZodNullable: Je,
|
|
60
|
+
ZodNumber: Be,
|
|
61
|
+
ZodObject: Ye,
|
|
62
|
+
ZodOptional: Xe,
|
|
63
|
+
ZodParsedType: He,
|
|
64
|
+
ZodPipeline: Qe,
|
|
65
|
+
ZodPromise: Ke,
|
|
66
|
+
ZodReadonly: et,
|
|
67
|
+
ZodRecord: tt,
|
|
68
|
+
ZodSchema: R,
|
|
69
|
+
ZodSet: at,
|
|
70
|
+
ZodString: st,
|
|
71
|
+
ZodSymbol: nt,
|
|
72
|
+
ZodTransformer: F,
|
|
73
|
+
ZodTuple: rt,
|
|
74
|
+
ZodType: R,
|
|
75
|
+
ZodUndefined: lt,
|
|
76
|
+
ZodUnion: it,
|
|
77
|
+
ZodUnknown: ot,
|
|
78
|
+
ZodVoid: ct,
|
|
79
|
+
addIssueToContext: ut,
|
|
80
|
+
any: dt,
|
|
81
|
+
array: mt,
|
|
82
|
+
bigint: pt,
|
|
83
|
+
boolean: ft,
|
|
84
|
+
coerce: ht,
|
|
85
|
+
custom: gt,
|
|
86
|
+
date: xt,
|
|
87
|
+
datetimeRegex: bt,
|
|
88
|
+
defaultErrorMap: yt,
|
|
89
|
+
discriminatedUnion: vt,
|
|
90
|
+
effect: G,
|
|
91
|
+
enum: jt,
|
|
92
|
+
function: _t,
|
|
93
|
+
getErrorMap: Tt,
|
|
94
|
+
getParsedType: Nt,
|
|
95
|
+
instanceof: Mt,
|
|
96
|
+
intersection: wt,
|
|
97
|
+
isAborted: St,
|
|
98
|
+
isAsync: Ct,
|
|
99
|
+
isDirty: $t,
|
|
100
|
+
isValid: kt,
|
|
101
|
+
late: Et,
|
|
102
|
+
lazy: Vt,
|
|
103
|
+
literal: Rt,
|
|
104
|
+
makeIssue: At,
|
|
105
|
+
map: It,
|
|
106
|
+
nan: Zt,
|
|
107
|
+
nativeEnum: Dt,
|
|
108
|
+
never: Ot,
|
|
109
|
+
null: Pt,
|
|
110
|
+
nullable: qt,
|
|
111
|
+
number: Lt,
|
|
112
|
+
object: Ft,
|
|
113
113
|
get objectUtil() {
|
|
114
|
-
return
|
|
114
|
+
return Gt;
|
|
115
115
|
},
|
|
116
|
-
oboolean:
|
|
117
|
-
onumber:
|
|
118
|
-
optional:
|
|
119
|
-
ostring:
|
|
120
|
-
pipeline:
|
|
121
|
-
preprocess:
|
|
122
|
-
promise:
|
|
123
|
-
quotelessJson:
|
|
124
|
-
record:
|
|
125
|
-
set:
|
|
126
|
-
setErrorMap:
|
|
127
|
-
strictObject:
|
|
128
|
-
string:
|
|
129
|
-
symbol:
|
|
130
|
-
transformer:
|
|
131
|
-
tuple:
|
|
132
|
-
undefined:
|
|
133
|
-
union:
|
|
134
|
-
unknown:
|
|
116
|
+
oboolean: zt,
|
|
117
|
+
onumber: Ut,
|
|
118
|
+
optional: Wt,
|
|
119
|
+
ostring: Jt,
|
|
120
|
+
pipeline: Bt,
|
|
121
|
+
preprocess: Yt,
|
|
122
|
+
promise: Xt,
|
|
123
|
+
quotelessJson: Ht,
|
|
124
|
+
record: Qt,
|
|
125
|
+
set: Kt,
|
|
126
|
+
setErrorMap: ea,
|
|
127
|
+
strictObject: ta,
|
|
128
|
+
string: aa,
|
|
129
|
+
symbol: sa,
|
|
130
|
+
transformer: G,
|
|
131
|
+
tuple: na,
|
|
132
|
+
undefined: ra,
|
|
133
|
+
union: la,
|
|
134
|
+
unknown: ia,
|
|
135
135
|
get util() {
|
|
136
|
-
return
|
|
136
|
+
return oa;
|
|
137
137
|
},
|
|
138
|
-
void:
|
|
138
|
+
void: ca
|
|
139
139
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
140
|
-
var
|
|
141
|
-
function
|
|
142
|
-
return
|
|
140
|
+
var Ca = 1, $a = 4;
|
|
141
|
+
function ka(e) {
|
|
142
|
+
return ua(e, Ca | $a);
|
|
143
143
|
}
|
|
144
|
-
function
|
|
145
|
-
return e == null ? e :
|
|
144
|
+
function A(e, a, n) {
|
|
145
|
+
return e == null ? e : da(e, a, n);
|
|
146
146
|
}
|
|
147
|
-
function
|
|
148
|
-
return e == null ? !0 :
|
|
147
|
+
function Y(e, a) {
|
|
148
|
+
return e == null ? !0 : ma(e, a);
|
|
149
149
|
}
|
|
150
|
-
const
|
|
150
|
+
const oe = wa(
|
|
151
151
|
void 0
|
|
152
152
|
);
|
|
153
|
-
function
|
|
154
|
-
switch (
|
|
153
|
+
function Ea(e, a) {
|
|
154
|
+
switch (a.type) {
|
|
155
155
|
case "SET_PATH": {
|
|
156
|
-
const
|
|
157
|
-
if (
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
156
|
+
const n = ka(e.value);
|
|
157
|
+
if (/actions\.\d\.[\w_]+$/.test(a.path)) {
|
|
158
|
+
const s = a.path.replace(/\.[\w_]+$/, "");
|
|
159
|
+
z(n, s)?.groups == null && A(n, `${s}.groups`, []);
|
|
160
|
+
}
|
|
161
|
+
if (a.value === null)
|
|
162
|
+
if (/\.\d+$/.test(a.path)) {
|
|
163
|
+
const s = a.path.replace(/\.\d+$/, ""), o = parseInt(a.path.match(/\d+$/)?.[0] ?? "0", 10), c = z(n, s);
|
|
164
|
+
Array.isArray(c) && (c.splice(o, 1), A(n, s, c), c.length === 0 && s.endsWith(".nested.conditions") && Y(n, s.replace(/\.conditions$/, "")));
|
|
161
165
|
} else
|
|
162
|
-
|
|
166
|
+
Y(n, a.path);
|
|
163
167
|
else
|
|
164
|
-
|
|
168
|
+
A(n, a.path, a.value);
|
|
165
169
|
return {
|
|
166
170
|
...e,
|
|
167
|
-
value:
|
|
171
|
+
value: n
|
|
168
172
|
};
|
|
169
173
|
}
|
|
170
174
|
case "SET_SELECTED_RULE_INDEX":
|
|
171
175
|
return {
|
|
172
176
|
...e,
|
|
173
|
-
selectedRuleIndex:
|
|
177
|
+
selectedRuleIndex: a.index
|
|
174
178
|
};
|
|
175
179
|
case "SET_VALUE":
|
|
176
|
-
return
|
|
180
|
+
return Z(e.value, a.value) ? e : (a.value.rules?.length ?? 0) === 0 ? {
|
|
177
181
|
selectedRuleIndex: 0,
|
|
178
182
|
value: {
|
|
179
183
|
rules: [
|
|
@@ -188,387 +192,54 @@ function Ma(e, s) {
|
|
|
188
192
|
}
|
|
189
193
|
} : {
|
|
190
194
|
...e,
|
|
191
|
-
value:
|
|
195
|
+
value: a.value
|
|
192
196
|
};
|
|
193
197
|
default:
|
|
194
198
|
return e;
|
|
195
199
|
}
|
|
196
200
|
}
|
|
197
|
-
function
|
|
201
|
+
function Va({
|
|
198
202
|
children: e,
|
|
199
|
-
initialValue:
|
|
203
|
+
initialValue: a
|
|
200
204
|
}) {
|
|
201
|
-
const [
|
|
202
|
-
value:
|
|
205
|
+
const [n, s] = Na(Ea, {
|
|
206
|
+
value: a.value,
|
|
203
207
|
selectedRuleIndex: 0
|
|
204
|
-
}),
|
|
205
|
-
|
|
206
|
-
}, []),
|
|
207
|
-
|
|
208
|
-
|
|
208
|
+
}), o = C((l, i) => {
|
|
209
|
+
s({ type: "SET_PATH", path: l, value: i });
|
|
210
|
+
}, []), c = C((l) => {
|
|
211
|
+
s({ type: "SET_SELECTED_RULE_INDEX", index: l }), l < 0 && setTimeout(() => {
|
|
212
|
+
s({ type: "SET_SELECTED_RULE_INDEX", index: 0 });
|
|
209
213
|
}, 50);
|
|
210
|
-
}, []), u =
|
|
211
|
-
|
|
212
|
-
}, []), r =
|
|
214
|
+
}, []), u = C((l) => {
|
|
215
|
+
s({ type: "SET_VALUE", value: l });
|
|
216
|
+
}, []), r = Ma(
|
|
213
217
|
() => ({
|
|
214
|
-
state:
|
|
215
|
-
setPath:
|
|
216
|
-
setSelectedRuleIndex:
|
|
218
|
+
state: n,
|
|
219
|
+
setPath: o,
|
|
220
|
+
setSelectedRuleIndex: c,
|
|
217
221
|
setValue: u,
|
|
218
|
-
availableActionTypes:
|
|
219
|
-
schemaType:
|
|
222
|
+
availableActionTypes: a.availableActionTypes,
|
|
223
|
+
schemaType: a.schemaType
|
|
220
224
|
}),
|
|
221
225
|
[
|
|
222
|
-
|
|
226
|
+
n,
|
|
227
|
+
o,
|
|
223
228
|
c,
|
|
224
|
-
i,
|
|
225
229
|
u,
|
|
226
|
-
|
|
227
|
-
|
|
230
|
+
a.availableActionTypes,
|
|
231
|
+
a.schemaType
|
|
228
232
|
]
|
|
229
233
|
);
|
|
230
|
-
return /* @__PURE__ */ t.jsx(
|
|
234
|
+
return /* @__PURE__ */ t.jsx(oe.Provider, { value: r, children: e });
|
|
231
235
|
}
|
|
232
236
|
function x() {
|
|
233
|
-
const e =
|
|
237
|
+
const e = Sa(oe);
|
|
234
238
|
if (e === void 0)
|
|
235
239
|
throw new Error("useRuleEngine must be used within a RuleEngineProvider");
|
|
236
240
|
return e;
|
|
237
241
|
}
|
|
238
|
-
|
|
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 = [
|
|
242
|
+
const ce = [
|
|
572
243
|
{
|
|
573
244
|
/** Matches if field value equals provided value
|
|
574
245
|
* @field Integer, String, Datetime, Boolean
|
|
@@ -870,94 +541,500 @@ const le = [
|
|
|
870
541
|
exactMatch: !0
|
|
871
542
|
}
|
|
872
543
|
];
|
|
873
|
-
function
|
|
544
|
+
function ue(e) {
|
|
874
545
|
if (typeof e == "string")
|
|
875
|
-
return
|
|
546
|
+
return $(B(e)) ? "datetime" : "string";
|
|
876
547
|
if (typeof e == "number")
|
|
877
548
|
return "integer";
|
|
878
549
|
if (typeof e == "boolean")
|
|
879
550
|
return "boolean";
|
|
880
551
|
if (Array.isArray(e)) {
|
|
881
552
|
if (typeof e[0] == "string")
|
|
882
|
-
return
|
|
553
|
+
return $(B(e[0])) ? "datetime" : "string";
|
|
883
554
|
if (typeof e[0] == "number")
|
|
884
555
|
return "integer";
|
|
885
556
|
}
|
|
886
557
|
return "string";
|
|
887
558
|
}
|
|
888
|
-
const
|
|
889
|
-
market: "markets",
|
|
890
|
-
tag: "tags",
|
|
891
|
-
sku: "skus",
|
|
892
|
-
sku_list: "sku_lists"
|
|
559
|
+
const de = {
|
|
560
|
+
market: "markets",
|
|
561
|
+
tag: "tags",
|
|
562
|
+
sku: "skus",
|
|
563
|
+
sku_list: "sku_lists"
|
|
564
|
+
};
|
|
565
|
+
function Ra(e) {
|
|
566
|
+
return de[e];
|
|
567
|
+
}
|
|
568
|
+
function P(e) {
|
|
569
|
+
const [a, n] = g(void 0);
|
|
570
|
+
return _(() => {
|
|
571
|
+
e?.field != null && pa(e.field).then((s) => {
|
|
572
|
+
const o = ce.find(
|
|
573
|
+
(c) => c.matcher === e.matcher
|
|
574
|
+
);
|
|
575
|
+
n({
|
|
576
|
+
...s,
|
|
577
|
+
matcherInfos: o,
|
|
578
|
+
resourceSelectorAvailable: s?.resource?.id != null && Object.keys(de).includes(s.resource.id) && s.path.endsWith(".id") && o?.exactMatch === !0
|
|
579
|
+
});
|
|
580
|
+
}).catch((s) => {
|
|
581
|
+
console.error("Error fetching field info:", s);
|
|
582
|
+
});
|
|
583
|
+
}, [e?.field, e?.matcher]), { infos: a };
|
|
584
|
+
}
|
|
585
|
+
function me(e) {
|
|
586
|
+
return e == null || e.length === 0 ? [] : fa(
|
|
587
|
+
ha(
|
|
588
|
+
e.flatMap((a) => [
|
|
589
|
+
a?.group,
|
|
590
|
+
...me(a?.nested?.conditions)
|
|
591
|
+
])
|
|
592
|
+
)
|
|
593
|
+
);
|
|
594
|
+
}
|
|
595
|
+
function pe() {
|
|
596
|
+
const {
|
|
597
|
+
state: { selectedRuleIndex: e, value: a }
|
|
598
|
+
} = x();
|
|
599
|
+
return me(
|
|
600
|
+
a.rules?.[e]?.conditions
|
|
601
|
+
);
|
|
602
|
+
}
|
|
603
|
+
function Aa({
|
|
604
|
+
item: e,
|
|
605
|
+
pathPrefix: a
|
|
606
|
+
}) {
|
|
607
|
+
const { setPath: n } = x();
|
|
608
|
+
if (e == null)
|
|
609
|
+
return null;
|
|
610
|
+
switch (e.type) {
|
|
611
|
+
case "buy_x_pay_y":
|
|
612
|
+
return /* @__PURE__ */ t.jsxs("div", { className: "w-36 flex items-center gap-0.5", children: [
|
|
613
|
+
/* @__PURE__ */ t.jsx(
|
|
614
|
+
y,
|
|
615
|
+
{
|
|
616
|
+
name: `${a}.value.x`,
|
|
617
|
+
type: "number",
|
|
618
|
+
suffix: "X",
|
|
619
|
+
defaultValue: e.value?.x,
|
|
620
|
+
onChange: (s) => {
|
|
621
|
+
n(
|
|
622
|
+
`${a}.value.x`,
|
|
623
|
+
parseInt(s.currentTarget.value, 10)
|
|
624
|
+
);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
),
|
|
628
|
+
/* @__PURE__ */ t.jsx(
|
|
629
|
+
y,
|
|
630
|
+
{
|
|
631
|
+
name: `${a}.value.y`,
|
|
632
|
+
type: "number",
|
|
633
|
+
suffix: "Y",
|
|
634
|
+
defaultValue: e.value?.y,
|
|
635
|
+
onChange: (s) => {
|
|
636
|
+
n(
|
|
637
|
+
`${a}.value.y`,
|
|
638
|
+
parseInt(s.currentTarget.value, 10)
|
|
639
|
+
);
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
)
|
|
643
|
+
] });
|
|
644
|
+
case "every_x_discount_y":
|
|
645
|
+
return /* @__PURE__ */ t.jsxs("div", { className: "w-36 flex items-center gap-0.5", children: [
|
|
646
|
+
/* @__PURE__ */ t.jsx(
|
|
647
|
+
y,
|
|
648
|
+
{
|
|
649
|
+
name: `${a}.value.x`,
|
|
650
|
+
type: "number",
|
|
651
|
+
suffix: "X",
|
|
652
|
+
defaultValue: e.value?.x,
|
|
653
|
+
onChange: (s) => {
|
|
654
|
+
n(
|
|
655
|
+
`${a}.value.x`,
|
|
656
|
+
parseInt(s.currentTarget.value, 10)
|
|
657
|
+
);
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
),
|
|
661
|
+
/* @__PURE__ */ t.jsx(
|
|
662
|
+
y,
|
|
663
|
+
{
|
|
664
|
+
name: `${a}.value.y`,
|
|
665
|
+
type: "number",
|
|
666
|
+
suffix: "Y",
|
|
667
|
+
defaultValue: e.value?.y,
|
|
668
|
+
onChange: (s) => {
|
|
669
|
+
n(
|
|
670
|
+
`${a}.value.y`,
|
|
671
|
+
parseInt(s.currentTarget.value, 10)
|
|
672
|
+
);
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
)
|
|
676
|
+
] });
|
|
677
|
+
case "fixed_amount":
|
|
678
|
+
case "fixed_price":
|
|
679
|
+
return /* @__PURE__ */ t.jsx("div", { className: "w-36", children: /* @__PURE__ */ t.jsx(
|
|
680
|
+
y,
|
|
681
|
+
{
|
|
682
|
+
name: `${a}.value`,
|
|
683
|
+
type: "number",
|
|
684
|
+
defaultValue: e.value,
|
|
685
|
+
min: 0,
|
|
686
|
+
suffix: "cents",
|
|
687
|
+
onChange: (s) => {
|
|
688
|
+
n(
|
|
689
|
+
`${a}.value`,
|
|
690
|
+
parseInt(s.currentTarget.value, 10)
|
|
691
|
+
);
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
) });
|
|
695
|
+
case "percentage": {
|
|
696
|
+
const s = (e.value * 100).toFixed(2);
|
|
697
|
+
return /* @__PURE__ */ t.jsx("div", { className: "w-24", children: /* @__PURE__ */ t.jsx(
|
|
698
|
+
y,
|
|
699
|
+
{
|
|
700
|
+
name: `${a}.value`,
|
|
701
|
+
type: "number",
|
|
702
|
+
defaultValue: s.endsWith(".00") ? s.slice(0, -3) : s,
|
|
703
|
+
min: 0,
|
|
704
|
+
max: 100,
|
|
705
|
+
suffix: "%",
|
|
706
|
+
onChange: (o) => {
|
|
707
|
+
n(
|
|
708
|
+
`${a}.value`,
|
|
709
|
+
parseFloat(o.currentTarget.value) / 100
|
|
710
|
+
);
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
) });
|
|
714
|
+
}
|
|
715
|
+
default:
|
|
716
|
+
return te();
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
function Ia({
|
|
720
|
+
item: e,
|
|
721
|
+
index: a,
|
|
722
|
+
onDelete: n
|
|
723
|
+
}) {
|
|
724
|
+
const {
|
|
725
|
+
setPath: s,
|
|
726
|
+
schemaType: o,
|
|
727
|
+
state: { selectedRuleIndex: c },
|
|
728
|
+
availableActionTypes: u
|
|
729
|
+
} = x(), r = pe(), l = {
|
|
730
|
+
percentage: "Percentage discount",
|
|
731
|
+
fixed_amount: "Fixed amount",
|
|
732
|
+
fixed_price: "Fixed price",
|
|
733
|
+
buy_x_pay_y: "Buy X, Pay Y",
|
|
734
|
+
every_x_discount_y: "Every X, Discount Y"
|
|
735
|
+
}, i = `rules.${c}.actions.${a}`;
|
|
736
|
+
return _(() => {
|
|
737
|
+
r.length === 0 && (e?.groups ?? []).length > 0 && s(`${i}.groups`, []);
|
|
738
|
+
}, [r]), /* @__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: [
|
|
739
|
+
/* @__PURE__ */ t.jsxs("div", { className: "flex flex-col grow", children: [
|
|
740
|
+
/* @__PURE__ */ t.jsxs("div", { className: "flex items-center justify-between gap-2 p-2", children: [
|
|
741
|
+
/* @__PURE__ */ t.jsx("div", { className: "flex-1", children: /* @__PURE__ */ t.jsx(
|
|
742
|
+
v,
|
|
743
|
+
{
|
|
744
|
+
name: `${i}.type`,
|
|
745
|
+
defaultValue: e != null ? {
|
|
746
|
+
label: l[e.type],
|
|
747
|
+
value: e.type
|
|
748
|
+
} : void 0,
|
|
749
|
+
initialValues: u.map((d) => ({
|
|
750
|
+
value: d,
|
|
751
|
+
label: l[d]
|
|
752
|
+
})),
|
|
753
|
+
onSelect: (d) => {
|
|
754
|
+
T(d) && s(`${i}.type`, d.value);
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
) }),
|
|
758
|
+
/* @__PURE__ */ t.jsx(Aa, { item: e, pathPrefix: i }),
|
|
759
|
+
/* @__PURE__ */ t.jsx("div", { className: "text-black font-bold text-sm", children: "ON" }),
|
|
760
|
+
/* @__PURE__ */ t.jsx("div", { className: "flex-1", children: /* @__PURE__ */ t.jsx(
|
|
761
|
+
Za,
|
|
762
|
+
{
|
|
763
|
+
value: e?.selector,
|
|
764
|
+
name: `${i}.selector`
|
|
765
|
+
}
|
|
766
|
+
) })
|
|
767
|
+
] }),
|
|
768
|
+
(r.length > 0 || (e?.groups ?? []).length > 0) && /* @__PURE__ */ t.jsxs("div", { className: "flex items-center justify-between gap-2 p-2", children: [
|
|
769
|
+
/* @__PURE__ */ t.jsx("div", { className: "text-black font-bold text-sm px-2", children: "GROUPS" }),
|
|
770
|
+
/* @__PURE__ */ t.jsx("div", { className: "flex-1", children: /* @__PURE__ */ t.jsx(
|
|
771
|
+
v,
|
|
772
|
+
{
|
|
773
|
+
name: `${i}.groups`,
|
|
774
|
+
isMulti: !0,
|
|
775
|
+
value: e?.groups?.map((d) => ({
|
|
776
|
+
label: r.includes(d) ? d : `⚠️ ${d}`,
|
|
777
|
+
value: d
|
|
778
|
+
})),
|
|
779
|
+
initialValues: r.map((d) => ({
|
|
780
|
+
value: d,
|
|
781
|
+
label: d
|
|
782
|
+
})),
|
|
783
|
+
onSelect: (d) => {
|
|
784
|
+
E(d) && (s(
|
|
785
|
+
`${i}.groups`,
|
|
786
|
+
d.map((h) => h.value)
|
|
787
|
+
), o === "order-rules" && d.length > 0 && s(`${i}.selector`, "order.line_items"));
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
) })
|
|
791
|
+
] })
|
|
792
|
+
] }),
|
|
793
|
+
n != null && /* @__PURE__ */ t.jsx(
|
|
794
|
+
D,
|
|
795
|
+
{
|
|
796
|
+
className: "w-8 border-l border-gray-100 flex items-center justify-center self-stretch",
|
|
797
|
+
dropdownLabel: /* @__PURE__ */ t.jsx(
|
|
798
|
+
"button",
|
|
799
|
+
{
|
|
800
|
+
type: "button",
|
|
801
|
+
className: "flex items-center justify-center self-stretch grow",
|
|
802
|
+
children: /* @__PURE__ */ t.jsx(j, { name: "dotsThreeVertical", size: 16, weight: "bold" })
|
|
803
|
+
}
|
|
804
|
+
),
|
|
805
|
+
dropdownItems: /* @__PURE__ */ t.jsx(
|
|
806
|
+
M,
|
|
807
|
+
{
|
|
808
|
+
label: "Delete",
|
|
809
|
+
onClick: () => {
|
|
810
|
+
s(`${i}`, null), n();
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
)
|
|
814
|
+
}
|
|
815
|
+
)
|
|
816
|
+
] }) });
|
|
817
|
+
}
|
|
818
|
+
function Za({
|
|
819
|
+
value: e,
|
|
820
|
+
name: a
|
|
821
|
+
}) {
|
|
822
|
+
const { setPath: n, schemaType: s } = x(), { t: o } = ae(), c = Da[s].map((u) => ({
|
|
823
|
+
value: u,
|
|
824
|
+
label: o(`resource_paths.${u}`).replace(
|
|
825
|
+
"resource_paths.",
|
|
826
|
+
""
|
|
827
|
+
)
|
|
828
|
+
}));
|
|
829
|
+
return /* @__PURE__ */ t.jsx(
|
|
830
|
+
v,
|
|
831
|
+
{
|
|
832
|
+
name: a,
|
|
833
|
+
isSearchable: !1,
|
|
834
|
+
initialValues: c,
|
|
835
|
+
value: c.find((u) => u.value === e),
|
|
836
|
+
onSelect: async (u) => {
|
|
837
|
+
T(u) && n(a, u.value);
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
);
|
|
841
|
+
}
|
|
842
|
+
const Da = {
|
|
843
|
+
"order-rules": [
|
|
844
|
+
"order",
|
|
845
|
+
"order.line_items",
|
|
846
|
+
"order.line_items.line_item_options",
|
|
847
|
+
"order.line_items.sku",
|
|
848
|
+
"order.line_items.bundle",
|
|
849
|
+
"order.line_items.shipment",
|
|
850
|
+
"order.line_items.payment_method",
|
|
851
|
+
"order.line_items.adjustment",
|
|
852
|
+
"order.line_items.gift_card"
|
|
853
|
+
],
|
|
854
|
+
"price-rules": ["price"]
|
|
893
855
|
};
|
|
894
|
-
function
|
|
895
|
-
|
|
856
|
+
function Oa({
|
|
857
|
+
actions: e
|
|
858
|
+
}) {
|
|
859
|
+
const [a, n] = g(0), {
|
|
860
|
+
setPath: s,
|
|
861
|
+
state: { selectedRuleIndex: o }
|
|
862
|
+
} = x();
|
|
863
|
+
return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
864
|
+
/* @__PURE__ */ t.jsx("div", { children: e?.map((c, u, r) => /* @__PURE__ */ t.jsx(
|
|
865
|
+
Ia,
|
|
866
|
+
{
|
|
867
|
+
item: c,
|
|
868
|
+
index: u,
|
|
869
|
+
onDelete: r.length > 1 ? () => {
|
|
870
|
+
n((l) => l + 1);
|
|
871
|
+
} : void 0
|
|
872
|
+
},
|
|
873
|
+
`${o}-${u}-${a}`
|
|
874
|
+
)) }),
|
|
875
|
+
/* @__PURE__ */ t.jsx("div", { className: "mt-6", children: /* @__PURE__ */ t.jsxs(
|
|
876
|
+
N,
|
|
877
|
+
{
|
|
878
|
+
size: "small",
|
|
879
|
+
variant: "secondary",
|
|
880
|
+
alignItems: "center",
|
|
881
|
+
onClick: () => {
|
|
882
|
+
s(
|
|
883
|
+
`rules.${o}.actions.${e?.length ?? 0}`,
|
|
884
|
+
void 0
|
|
885
|
+
);
|
|
886
|
+
},
|
|
887
|
+
children: [
|
|
888
|
+
/* @__PURE__ */ t.jsx(j, { name: "plusCircle" }),
|
|
889
|
+
" Add action"
|
|
890
|
+
]
|
|
891
|
+
}
|
|
892
|
+
) })
|
|
893
|
+
] });
|
|
896
894
|
}
|
|
897
|
-
function
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
)
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
895
|
+
function Pa({
|
|
896
|
+
value: e,
|
|
897
|
+
name: a
|
|
898
|
+
}) {
|
|
899
|
+
const { setPath: n, schemaType: s } = x(), { t: o } = ae(), c = O(null), u = s === "order-rules" ? "order" : s === "price-rules" ? "price" : void 0, r = se(
|
|
900
|
+
qa.filter(
|
|
901
|
+
(l) => u != null && l.startsWith(u)
|
|
902
|
+
).map((l) => ({
|
|
903
|
+
value: l,
|
|
904
|
+
label: o(`resource_paths.${l}`).replace(
|
|
905
|
+
"resource_paths.",
|
|
906
|
+
""
|
|
907
|
+
)
|
|
908
|
+
})),
|
|
909
|
+
"label"
|
|
910
|
+
);
|
|
911
|
+
return /* @__PURE__ */ t.jsx(
|
|
912
|
+
v,
|
|
913
|
+
{
|
|
914
|
+
ref: c,
|
|
915
|
+
name: a,
|
|
916
|
+
initialValues: r,
|
|
917
|
+
defaultValue: e != null ? r.find((l) => l.value === e) ?? {
|
|
918
|
+
value: e,
|
|
919
|
+
label: e
|
|
920
|
+
} : void 0,
|
|
921
|
+
asTextSearch: !0,
|
|
922
|
+
isCreatable: !0,
|
|
923
|
+
loadAsyncValues: async (l) => {
|
|
924
|
+
if (u == null)
|
|
925
|
+
return [];
|
|
926
|
+
const i = r.filter(
|
|
927
|
+
(m) => m.label.includes(l)
|
|
928
|
+
), d = (await ga([u], l)).filter((m) => m.value.startsWith(l)).map((m) => {
|
|
929
|
+
const f = m.type === "relationship" || m.value.endsWith(".metadata") ? `${m.value}.` : m.value;
|
|
930
|
+
return {
|
|
931
|
+
value: f,
|
|
932
|
+
label: f
|
|
933
|
+
};
|
|
934
|
+
}), h = l.includes(".metadata") ? [{ label: l, value: l }] : [];
|
|
935
|
+
return [...i, ...d, ...h];
|
|
936
|
+
},
|
|
937
|
+
onSelect: async (l) => {
|
|
938
|
+
T(l) && (n(a, l.value), l.value.toString().endsWith(".") && c.current?.openMenu("first"));
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
);
|
|
913
942
|
}
|
|
914
|
-
|
|
943
|
+
const qa = [
|
|
944
|
+
"order.billing_address.country_code",
|
|
945
|
+
"order.country_code",
|
|
946
|
+
"order.currency_code",
|
|
947
|
+
"order.customer_email",
|
|
948
|
+
"order.customer.email",
|
|
949
|
+
"order.customer.customer_group.id",
|
|
950
|
+
"order.customer.customer_group.name",
|
|
951
|
+
"order.customer.tags.id",
|
|
952
|
+
"order.customer.tags.name",
|
|
953
|
+
"order.line_items.item_type",
|
|
954
|
+
"order.line_items.line_item_options.sku_option.tags.name",
|
|
955
|
+
"order.line_items.options_amount_cents",
|
|
956
|
+
"order.line_items.quantity",
|
|
957
|
+
"order.line_items.reference",
|
|
958
|
+
"order.line_items.shipment.id",
|
|
959
|
+
"order.line_items.shipment.shipping_method.id",
|
|
960
|
+
"order.line_items.shipment.shipping_method.name",
|
|
961
|
+
"order.line_items.shipment.shipping_method.reference",
|
|
962
|
+
"order.line_items.sku_code",
|
|
963
|
+
"order.line_items.sku.code",
|
|
964
|
+
"order.line_items.sku.id",
|
|
965
|
+
"order.line_items.sku.inventory.quantity",
|
|
966
|
+
"order.line_items.sku.name",
|
|
967
|
+
"order.line_items.sku.shipping_category.id",
|
|
968
|
+
"order.line_items.sku.sku_lists.id",
|
|
969
|
+
"order.line_items.sku.sku_lists.name",
|
|
970
|
+
"order.line_items.sku.tags.id",
|
|
971
|
+
"order.line_items.sku.tags.name",
|
|
972
|
+
"order.line_items.unit_amount_cents",
|
|
973
|
+
"order.market.code",
|
|
974
|
+
"order.market.id",
|
|
975
|
+
"order.shipments_count",
|
|
976
|
+
"order.shipping_address.country_code",
|
|
977
|
+
"order.subtotal_amount_cents",
|
|
978
|
+
"order.tags.name",
|
|
979
|
+
"order.total_amount_cents",
|
|
980
|
+
"price.jwt_customer.email",
|
|
981
|
+
"price.jwt_customer.tags.id",
|
|
982
|
+
"price.jwt_customer.tags.name",
|
|
983
|
+
"price.sku.sku_list_items.sku_list.id",
|
|
984
|
+
"price.sku.sku_list_items.sku_list.name",
|
|
985
|
+
"price.sku.code",
|
|
986
|
+
"price.sku.id",
|
|
987
|
+
"price.sku.tags.id",
|
|
988
|
+
"price.sku.tags.name",
|
|
989
|
+
"price.processed_at",
|
|
990
|
+
"price.amount_cents"
|
|
991
|
+
];
|
|
992
|
+
function La({
|
|
915
993
|
item: e,
|
|
916
|
-
pathPrefix:
|
|
994
|
+
pathPrefix: a
|
|
917
995
|
}) {
|
|
918
|
-
const { setPath:
|
|
919
|
-
let
|
|
920
|
-
|
|
921
|
-
const
|
|
996
|
+
const { setPath: n } = x(), { infos: s } = P(e);
|
|
997
|
+
let o = s?.field?.type;
|
|
998
|
+
o == null && (o = ue(e?.value));
|
|
999
|
+
const c = s?.resource?.id, u = ["tag"], r = [
|
|
922
1000
|
"matches",
|
|
923
1001
|
"does_not_match",
|
|
924
1002
|
"array_match"
|
|
925
|
-
],
|
|
1003
|
+
], l = ce.filter(({ fieldTypes: i, visible: d }) => d !== !1 && i.includes(o)).filter(({ matcher: i }) => c == null || c != null && !u.includes(c) || r.includes(i)).map(({ matcher: i, label: d }) => ({ value: i, label: d }));
|
|
926
1004
|
return /* @__PURE__ */ t.jsx(
|
|
927
|
-
|
|
1005
|
+
v,
|
|
928
1006
|
{
|
|
929
|
-
name: `${
|
|
930
|
-
value: e != null ?
|
|
1007
|
+
name: `${a}.matcher`,
|
|
1008
|
+
value: e != null ? l.find((i) => i.value === e.matcher) ?? {
|
|
931
1009
|
label: e.matcher != null ? `⚠️ ${e.matcher}` : "",
|
|
932
1010
|
value: e.matcher
|
|
933
1011
|
} : void 0,
|
|
934
|
-
initialValues:
|
|
935
|
-
onSelect: (
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
) &&
|
|
1012
|
+
initialValues: l,
|
|
1013
|
+
onSelect: (i) => {
|
|
1014
|
+
T(i) && (n(`${a}.matcher`, i.value), ne.includes(
|
|
1015
|
+
i.value
|
|
1016
|
+
) && n(`${a}.value`, null));
|
|
939
1017
|
}
|
|
940
1018
|
}
|
|
941
1019
|
);
|
|
942
1020
|
}
|
|
943
|
-
const
|
|
944
|
-
const { sdkClient:
|
|
1021
|
+
const fe = ({ value: e, pathKey: a, infos: n }) => {
|
|
1022
|
+
const { sdkClient: s } = xa(), { setPath: o } = x(), c = n?.field?.name ?? "id", u = Ra(n?.resource?.id), { data: r, isLoading: l } = U(
|
|
945
1023
|
u,
|
|
946
1024
|
"list",
|
|
947
|
-
|
|
948
|
-
), { data:
|
|
1025
|
+
n?.resource?.id == null ? null : [I({ value: "" })]
|
|
1026
|
+
), { data: i, isLoading: d } = U(
|
|
949
1027
|
u,
|
|
950
1028
|
"list",
|
|
951
|
-
|
|
1029
|
+
n?.resource?.id == null ? null : [
|
|
952
1030
|
{
|
|
953
|
-
...
|
|
1031
|
+
...I({ value: "" }),
|
|
954
1032
|
filters: {
|
|
955
1033
|
id_in: Array.isArray(e) ? e : [e]
|
|
956
1034
|
}
|
|
957
1035
|
}
|
|
958
1036
|
]
|
|
959
|
-
), h =
|
|
960
|
-
u === "sku_lists" && (console.log("data", r), console.log("selectedData", l), console.log("initialValues", h));
|
|
1037
|
+
), h = se([...i ?? [], ...r ?? []], "id");
|
|
961
1038
|
function p(m) {
|
|
962
1039
|
return {
|
|
963
1040
|
label: h?.find((f) => f.id === m.toString())?.name ?? m.toString(),
|
|
@@ -965,29 +1042,29 @@ const ce = ({ value: e, pathKey: s, infos: a }) => {
|
|
|
965
1042
|
};
|
|
966
1043
|
}
|
|
967
1044
|
return /* @__PURE__ */ t.jsx(
|
|
968
|
-
|
|
1045
|
+
v,
|
|
969
1046
|
{
|
|
970
1047
|
placeholder: "Search...",
|
|
971
1048
|
isClearable: !1,
|
|
972
|
-
isMulti:
|
|
1049
|
+
isMulti: n?.matcherInfos?.isMulti,
|
|
973
1050
|
defaultValue: Array.isArray(e) ? e.map(p) : e != null ? p(e) : void 0,
|
|
974
1051
|
menuFooterText: r != null && r.meta.recordCount > 25 ? "Type to search for more options." : void 0,
|
|
975
|
-
initialValues:
|
|
1052
|
+
initialValues: X(h ?? [], c),
|
|
976
1053
|
loadAsyncValues: async (m) => {
|
|
977
|
-
const f = await
|
|
978
|
-
return
|
|
1054
|
+
const f = await s[u].list(I({ value: m }));
|
|
1055
|
+
return X(f, c);
|
|
979
1056
|
},
|
|
980
1057
|
onSelect: (m) => {
|
|
981
|
-
|
|
982
|
-
|
|
1058
|
+
E(m) ? o(
|
|
1059
|
+
a,
|
|
983
1060
|
m.map((f) => f.value).filter((f) => f != null)
|
|
984
|
-
) :
|
|
1061
|
+
) : T(m) && o(a, m.value);
|
|
985
1062
|
}
|
|
986
1063
|
},
|
|
987
|
-
`${
|
|
1064
|
+
`${n?.matcherInfos?.isMulti?.toString()}-${l}-${d}`
|
|
988
1065
|
);
|
|
989
1066
|
};
|
|
990
|
-
function
|
|
1067
|
+
function I({ value: e }) {
|
|
991
1068
|
return {
|
|
992
1069
|
pageSize: 25,
|
|
993
1070
|
sort: {
|
|
@@ -998,14 +1075,14 @@ function k({ value: e }) {
|
|
|
998
1075
|
}
|
|
999
1076
|
};
|
|
1000
1077
|
}
|
|
1001
|
-
function
|
|
1002
|
-
return e.map((
|
|
1003
|
-
label:
|
|
1078
|
+
function X(e, a) {
|
|
1079
|
+
return e.map((n) => ({
|
|
1080
|
+
label: n.name,
|
|
1004
1081
|
// @ts-expect-error TODO: fix this
|
|
1005
|
-
value: a
|
|
1082
|
+
value: n[a]
|
|
1006
1083
|
}));
|
|
1007
1084
|
}
|
|
1008
|
-
const
|
|
1085
|
+
const H = {
|
|
1009
1086
|
in_and: {
|
|
1010
1087
|
label: "all of"
|
|
1011
1088
|
},
|
|
@@ -1019,74 +1096,74 @@ const Y = {
|
|
|
1019
1096
|
label: "not at least one of"
|
|
1020
1097
|
}
|
|
1021
1098
|
};
|
|
1022
|
-
function
|
|
1099
|
+
function Q({
|
|
1023
1100
|
value: e,
|
|
1024
|
-
pathPrefix:
|
|
1025
|
-
hasResourceSelector:
|
|
1026
|
-
infos:
|
|
1101
|
+
pathPrefix: a,
|
|
1102
|
+
hasResourceSelector: n = !1,
|
|
1103
|
+
infos: s
|
|
1027
1104
|
}) {
|
|
1028
1105
|
return (typeof e != "object" || Array.isArray(e) || e === null) && (e = {
|
|
1029
1106
|
in_and: []
|
|
1030
|
-
}), /* @__PURE__ */ t.jsx("div", { children: Object.entries(e).map(([
|
|
1031
|
-
|
|
1107
|
+
}), /* @__PURE__ */ t.jsx("div", { children: Object.entries(e).map(([o, c], u) => /* @__PURE__ */ t.jsx(
|
|
1108
|
+
Fa,
|
|
1032
1109
|
{
|
|
1033
|
-
infos:
|
|
1034
|
-
hasResourceSelector:
|
|
1035
|
-
pathPrefix:
|
|
1036
|
-
defaultValue:
|
|
1037
|
-
initialMatcher:
|
|
1110
|
+
infos: s,
|
|
1111
|
+
hasResourceSelector: n,
|
|
1112
|
+
pathPrefix: a,
|
|
1113
|
+
defaultValue: c,
|
|
1114
|
+
initialMatcher: o
|
|
1038
1115
|
},
|
|
1039
|
-
`${
|
|
1116
|
+
`${a}.${// biome-ignore lint/suspicious/noArrayIndexKey: Using index as key is acceptable here since items are static
|
|
1040
1117
|
u}`
|
|
1041
1118
|
)) });
|
|
1042
1119
|
}
|
|
1043
|
-
function
|
|
1120
|
+
function Fa({
|
|
1044
1121
|
initialMatcher: e,
|
|
1045
|
-
defaultValue:
|
|
1046
|
-
pathPrefix:
|
|
1047
|
-
hasResourceSelector:
|
|
1048
|
-
infos:
|
|
1122
|
+
defaultValue: a,
|
|
1123
|
+
pathPrefix: n,
|
|
1124
|
+
hasResourceSelector: s,
|
|
1125
|
+
infos: o
|
|
1049
1126
|
}) {
|
|
1050
|
-
const [
|
|
1127
|
+
const [c, u] = g(e), [r, l] = g(e), [i, d] = g(a), { setPath: h } = x();
|
|
1051
1128
|
return _(() => {
|
|
1052
|
-
|
|
1053
|
-
}, [r,
|
|
1129
|
+
c !== r && (h(`${n}.${c}`, null), u(r)), h(`${n}.${r}`, i);
|
|
1130
|
+
}, [r, i, h]), /* @__PURE__ */ t.jsxs("div", { className: "flex gap-2 mt-2 first-of-type:mt-0", children: [
|
|
1054
1131
|
/* @__PURE__ */ t.jsx("div", { className: "shrink-0", children: /* @__PURE__ */ t.jsx(
|
|
1055
|
-
|
|
1132
|
+
v,
|
|
1056
1133
|
{
|
|
1057
1134
|
defaultValue: [
|
|
1058
|
-
{ value: r, label:
|
|
1135
|
+
{ value: r, label: H[r].label }
|
|
1059
1136
|
],
|
|
1060
|
-
initialValues: Object.entries(
|
|
1137
|
+
initialValues: Object.entries(H).map(
|
|
1061
1138
|
([p, { label: m }]) => ({
|
|
1062
1139
|
value: p,
|
|
1063
1140
|
label: m
|
|
1064
1141
|
})
|
|
1065
1142
|
),
|
|
1066
1143
|
onSelect: (p) => {
|
|
1067
|
-
|
|
1144
|
+
T(p) && l(p.value);
|
|
1068
1145
|
}
|
|
1069
1146
|
}
|
|
1070
1147
|
) }),
|
|
1071
|
-
/* @__PURE__ */ t.jsx("div", { className: "grow", children:
|
|
1072
|
-
|
|
1148
|
+
/* @__PURE__ */ t.jsx("div", { className: "grow", children: s ? /* @__PURE__ */ t.jsx(
|
|
1149
|
+
fe,
|
|
1073
1150
|
{
|
|
1074
|
-
infos:
|
|
1075
|
-
value:
|
|
1076
|
-
pathKey: `${
|
|
1151
|
+
infos: o,
|
|
1152
|
+
value: i,
|
|
1153
|
+
pathKey: `${n}.${r}`
|
|
1077
1154
|
}
|
|
1078
1155
|
) : /* @__PURE__ */ t.jsx(
|
|
1079
|
-
|
|
1156
|
+
v,
|
|
1080
1157
|
{
|
|
1081
1158
|
isMulti: !0,
|
|
1082
1159
|
isCreatable: !0,
|
|
1083
|
-
defaultValue: (Array.isArray(
|
|
1160
|
+
defaultValue: (Array.isArray(i) ? i : []).map((p) => ({
|
|
1084
1161
|
value: p,
|
|
1085
1162
|
label: p.toString()
|
|
1086
1163
|
})),
|
|
1087
1164
|
initialValues: [],
|
|
1088
1165
|
onSelect: (p) => {
|
|
1089
|
-
|
|
1166
|
+
E(p) && d(
|
|
1090
1167
|
p.map(
|
|
1091
1168
|
(m) => typeof m.value == "boolean" ? m.value.toString() : m.value
|
|
1092
1169
|
)
|
|
@@ -1096,142 +1173,142 @@ function Aa({
|
|
|
1096
1173
|
) })
|
|
1097
1174
|
] });
|
|
1098
1175
|
}
|
|
1099
|
-
function
|
|
1176
|
+
function Ga({
|
|
1100
1177
|
value: e,
|
|
1101
|
-
onChange:
|
|
1178
|
+
onChange: a
|
|
1102
1179
|
}) {
|
|
1103
|
-
const [
|
|
1180
|
+
const [n, s] = g(
|
|
1104
1181
|
Array.isArray(e) && typeof e[0] == "number" ? e[0] : null
|
|
1105
|
-
), [
|
|
1182
|
+
), [o, c] = g(
|
|
1106
1183
|
Array.isArray(e) && typeof e[1] == "number" ? e[1] : null
|
|
1107
1184
|
);
|
|
1108
1185
|
return /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-4", children: [
|
|
1109
1186
|
/* @__PURE__ */ t.jsx("div", { className: "grow", children: /* @__PURE__ */ t.jsx(
|
|
1110
|
-
|
|
1187
|
+
y,
|
|
1111
1188
|
{
|
|
1112
1189
|
type: "number",
|
|
1113
1190
|
placeholder: "Min",
|
|
1114
|
-
value:
|
|
1191
|
+
value: n ?? "",
|
|
1115
1192
|
onChange: (u) => {
|
|
1116
1193
|
const r = parseInt(u.currentTarget.value, 10);
|
|
1117
|
-
|
|
1194
|
+
s(Number.isNaN(r) ? null : r), a([Number.isNaN(r) ? null : r, o]);
|
|
1118
1195
|
}
|
|
1119
1196
|
}
|
|
1120
1197
|
) }),
|
|
1121
1198
|
/* @__PURE__ */ t.jsx("span", { className: "text-gray-300", children: "to" }),
|
|
1122
1199
|
/* @__PURE__ */ t.jsx("div", { className: "grow", children: /* @__PURE__ */ t.jsx(
|
|
1123
|
-
|
|
1200
|
+
y,
|
|
1124
1201
|
{
|
|
1125
1202
|
type: "number",
|
|
1126
1203
|
placeholder: "Max",
|
|
1127
|
-
value:
|
|
1204
|
+
value: o ?? "",
|
|
1128
1205
|
onChange: (u) => {
|
|
1129
1206
|
const r = parseInt(u.currentTarget.value, 10);
|
|
1130
|
-
|
|
1207
|
+
c(Number.isNaN(r) ? null : r), a([n, Number.isNaN(r) ? null : r]);
|
|
1131
1208
|
}
|
|
1132
1209
|
}
|
|
1133
1210
|
) })
|
|
1134
1211
|
] });
|
|
1135
1212
|
}
|
|
1136
|
-
function
|
|
1213
|
+
function za({
|
|
1137
1214
|
value: e,
|
|
1138
|
-
onChange:
|
|
1215
|
+
onChange: a
|
|
1139
1216
|
}) {
|
|
1140
|
-
const [
|
|
1217
|
+
const [n, s] = g(
|
|
1141
1218
|
Array.isArray(e) && typeof e[0] == "string" ? e[0] : null
|
|
1142
|
-
), [
|
|
1219
|
+
), [o, c] = g(
|
|
1143
1220
|
Array.isArray(e) && typeof e[1] == "string" ? e[1] : null
|
|
1144
1221
|
);
|
|
1145
1222
|
return /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-4", children: [
|
|
1146
1223
|
/* @__PURE__ */ t.jsx("div", { className: "grow", children: /* @__PURE__ */ t.jsx(
|
|
1147
|
-
|
|
1224
|
+
y,
|
|
1148
1225
|
{
|
|
1149
1226
|
type: "text",
|
|
1150
1227
|
placeholder: "Min",
|
|
1151
|
-
value:
|
|
1228
|
+
value: n ?? "",
|
|
1152
1229
|
onChange: (u) => {
|
|
1153
1230
|
const r = u.currentTarget.value;
|
|
1154
|
-
|
|
1231
|
+
s(r), a([r, o]);
|
|
1155
1232
|
}
|
|
1156
1233
|
}
|
|
1157
1234
|
) }),
|
|
1158
1235
|
/* @__PURE__ */ t.jsx("span", { className: "text-gray-300", children: "to" }),
|
|
1159
1236
|
/* @__PURE__ */ t.jsx("div", { className: "grow", children: /* @__PURE__ */ t.jsx(
|
|
1160
|
-
|
|
1237
|
+
y,
|
|
1161
1238
|
{
|
|
1162
1239
|
type: "text",
|
|
1163
1240
|
placeholder: "Max",
|
|
1164
|
-
value:
|
|
1241
|
+
value: o ?? "",
|
|
1165
1242
|
onChange: (u) => {
|
|
1166
1243
|
const r = u.currentTarget.value;
|
|
1167
|
-
|
|
1244
|
+
c(r), a([n, r]);
|
|
1168
1245
|
}
|
|
1169
1246
|
}
|
|
1170
1247
|
) })
|
|
1171
1248
|
] });
|
|
1172
1249
|
}
|
|
1173
|
-
function
|
|
1250
|
+
function Ua({
|
|
1174
1251
|
item: e,
|
|
1175
|
-
pathPrefix:
|
|
1252
|
+
pathPrefix: a
|
|
1176
1253
|
}) {
|
|
1177
|
-
const { setPath:
|
|
1254
|
+
const { setPath: n } = x(), { infos: s } = P(e), o = `${a}.value`, [c, u] = g(0), [r, l] = g(e?.matcher), i = e == null || ne.includes(
|
|
1178
1255
|
e.matcher
|
|
1179
1256
|
);
|
|
1180
|
-
let d =
|
|
1181
|
-
|
|
1182
|
-
const h =
|
|
1257
|
+
let d = s?.field?.type;
|
|
1258
|
+
he(e) && (d == null && (d = ue(e.value)), (typeof e.value == "string" && /^{{.*}}$/.test(e.value) || Array.isArray(e.value) && e.value.some((p) => typeof p == "string" && /^{{.*}}$/.test(p))) && (d = "string"));
|
|
1259
|
+
const h = Ja(d, e?.matcher, s);
|
|
1183
1260
|
return _(
|
|
1184
1261
|
function() {
|
|
1185
|
-
r !== e?.matcher && (
|
|
1262
|
+
r !== e?.matcher && (l(e?.matcher), n(o, null), u((m) => m + 1));
|
|
1186
1263
|
},
|
|
1187
1264
|
[h]
|
|
1188
|
-
),
|
|
1189
|
-
|
|
1265
|
+
), i ? null : /* @__PURE__ */ t.jsx("div", { children: /* @__PURE__ */ t.jsx(
|
|
1266
|
+
Wa,
|
|
1190
1267
|
{
|
|
1191
1268
|
item: e,
|
|
1192
1269
|
fieldType: d,
|
|
1193
1270
|
componentType: h,
|
|
1194
|
-
pathKey:
|
|
1271
|
+
pathKey: o
|
|
1195
1272
|
}
|
|
1196
|
-
) },
|
|
1273
|
+
) }, c);
|
|
1197
1274
|
}
|
|
1198
|
-
function
|
|
1275
|
+
function Wa({
|
|
1199
1276
|
item: e,
|
|
1200
|
-
fieldType:
|
|
1201
|
-
componentType:
|
|
1202
|
-
pathKey:
|
|
1277
|
+
fieldType: a,
|
|
1278
|
+
componentType: n,
|
|
1279
|
+
pathKey: s
|
|
1203
1280
|
}) {
|
|
1204
|
-
const { setPath:
|
|
1205
|
-
switch (
|
|
1281
|
+
const { setPath: o } = x(), { user: c } = re(), { infos: u } = P(e), r = he(e) ? e.value : void 0;
|
|
1282
|
+
switch (n) {
|
|
1206
1283
|
case "date": {
|
|
1207
|
-
const
|
|
1284
|
+
const l = J(typeof r == "string" ? r : "");
|
|
1208
1285
|
return /* @__PURE__ */ t.jsx(
|
|
1209
|
-
|
|
1286
|
+
ya,
|
|
1210
1287
|
{
|
|
1211
|
-
value:
|
|
1288
|
+
value: $(l) ? l : void 0,
|
|
1212
1289
|
showTimeSelect: !0,
|
|
1213
1290
|
placeholder: "Enter value",
|
|
1214
|
-
onChange: (
|
|
1215
|
-
|
|
1291
|
+
onChange: (i) => {
|
|
1292
|
+
o(s, i?.toJSON());
|
|
1216
1293
|
},
|
|
1217
|
-
timezone:
|
|
1294
|
+
timezone: c?.timezone
|
|
1218
1295
|
}
|
|
1219
1296
|
);
|
|
1220
1297
|
}
|
|
1221
1298
|
case "dateRange": {
|
|
1222
|
-
const
|
|
1223
|
-
const d =
|
|
1224
|
-
return
|
|
1299
|
+
const l = Array.isArray(r) ? r.map((i) => {
|
|
1300
|
+
const d = J(typeof i == "string" ? i : "");
|
|
1301
|
+
return $(d) ? d : null;
|
|
1225
1302
|
}) : [null, null];
|
|
1226
1303
|
return /* @__PURE__ */ t.jsx(
|
|
1227
|
-
|
|
1304
|
+
ba,
|
|
1228
1305
|
{
|
|
1229
|
-
value:
|
|
1306
|
+
value: l,
|
|
1230
1307
|
showTimeSelect: !0,
|
|
1231
|
-
onChange: (
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1308
|
+
onChange: (i) => {
|
|
1309
|
+
o(
|
|
1310
|
+
s,
|
|
1311
|
+
i.map((d) => d?.toJSON() ?? null)
|
|
1235
1312
|
);
|
|
1236
1313
|
}
|
|
1237
1314
|
}
|
|
@@ -1239,80 +1316,80 @@ function Oa({
|
|
|
1239
1316
|
}
|
|
1240
1317
|
case "numberRange":
|
|
1241
1318
|
return /* @__PURE__ */ t.jsx(
|
|
1242
|
-
|
|
1319
|
+
Ga,
|
|
1243
1320
|
{
|
|
1244
1321
|
value: r,
|
|
1245
|
-
onChange: (
|
|
1246
|
-
|
|
1322
|
+
onChange: (l) => {
|
|
1323
|
+
o(s, l);
|
|
1247
1324
|
}
|
|
1248
1325
|
}
|
|
1249
1326
|
);
|
|
1250
1327
|
case "textRange":
|
|
1251
1328
|
return /* @__PURE__ */ t.jsx(
|
|
1252
|
-
|
|
1329
|
+
za,
|
|
1253
1330
|
{
|
|
1254
1331
|
value: r,
|
|
1255
|
-
onChange: (
|
|
1256
|
-
|
|
1332
|
+
onChange: (l) => {
|
|
1333
|
+
o(s, l);
|
|
1257
1334
|
}
|
|
1258
1335
|
}
|
|
1259
1336
|
);
|
|
1260
1337
|
case "arrayMatch":
|
|
1261
|
-
return /* @__PURE__ */ t.jsx(
|
|
1338
|
+
return /* @__PURE__ */ t.jsx(Q, { infos: u, value: r, pathPrefix: s });
|
|
1262
1339
|
case "tag":
|
|
1263
1340
|
return /* @__PURE__ */ t.jsx(
|
|
1264
|
-
|
|
1341
|
+
v,
|
|
1265
1342
|
{
|
|
1266
1343
|
isMulti: !0,
|
|
1267
1344
|
isClearable: !1,
|
|
1268
1345
|
isCreatable: !0,
|
|
1269
|
-
defaultValue: Array.isArray(r) ? r.map((
|
|
1270
|
-
label:
|
|
1271
|
-
value:
|
|
1346
|
+
defaultValue: Array.isArray(r) ? r.map((l) => ({
|
|
1347
|
+
label: l.toString(),
|
|
1348
|
+
value: l
|
|
1272
1349
|
})) : [],
|
|
1273
1350
|
initialValues: [],
|
|
1274
|
-
onSelect: (
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
if (
|
|
1279
|
-
const d = parseInt(
|
|
1351
|
+
onSelect: (l) => {
|
|
1352
|
+
E(l) && o(
|
|
1353
|
+
s,
|
|
1354
|
+
l.map((i) => {
|
|
1355
|
+
if (a === "integer") {
|
|
1356
|
+
const d = parseInt(i.value.toString(), 10);
|
|
1280
1357
|
return Number.isNaN(d) ? null : d;
|
|
1281
1358
|
}
|
|
1282
|
-
return
|
|
1283
|
-
}).filter((
|
|
1359
|
+
return i.value;
|
|
1360
|
+
}).filter((i) => i != null)
|
|
1284
1361
|
);
|
|
1285
1362
|
}
|
|
1286
1363
|
}
|
|
1287
1364
|
);
|
|
1288
1365
|
case "resourceSelector":
|
|
1289
1366
|
return e?.matcher === "array_match" ? /* @__PURE__ */ t.jsx(
|
|
1290
|
-
|
|
1367
|
+
Q,
|
|
1291
1368
|
{
|
|
1292
1369
|
infos: u,
|
|
1293
1370
|
value: r,
|
|
1294
|
-
pathPrefix:
|
|
1371
|
+
pathPrefix: s,
|
|
1295
1372
|
hasResourceSelector: !0
|
|
1296
1373
|
}
|
|
1297
|
-
) : /* @__PURE__ */ t.jsx(
|
|
1374
|
+
) : /* @__PURE__ */ t.jsx(fe, { infos: u, value: r, pathKey: s });
|
|
1298
1375
|
case "number":
|
|
1299
1376
|
return /* @__PURE__ */ t.jsx(
|
|
1300
|
-
|
|
1377
|
+
y,
|
|
1301
1378
|
{
|
|
1302
|
-
name:
|
|
1379
|
+
name: s,
|
|
1303
1380
|
type: "number",
|
|
1304
1381
|
defaultValue: typeof r == "number" ? r : "",
|
|
1305
1382
|
placeholder: "Enter value",
|
|
1306
|
-
onChange: (
|
|
1307
|
-
|
|
1383
|
+
onChange: (l) => {
|
|
1384
|
+
o(s, parseInt(l.currentTarget.value, 10));
|
|
1308
1385
|
}
|
|
1309
1386
|
}
|
|
1310
1387
|
);
|
|
1311
1388
|
case "boolean":
|
|
1312
1389
|
return /* @__PURE__ */ t.jsx(
|
|
1313
|
-
|
|
1390
|
+
v,
|
|
1314
1391
|
{
|
|
1315
|
-
name:
|
|
1392
|
+
name: s,
|
|
1316
1393
|
defaultValue: typeof r == "boolean" ? {
|
|
1317
1394
|
label: r ? "Yes" : "No",
|
|
1318
1395
|
value: r
|
|
@@ -1321,50 +1398,50 @@ function Oa({
|
|
|
1321
1398
|
{ label: "Yes", value: !0 },
|
|
1322
1399
|
{ label: "No", value: !1 }
|
|
1323
1400
|
],
|
|
1324
|
-
onSelect: (
|
|
1325
|
-
|
|
1401
|
+
onSelect: (l) => {
|
|
1402
|
+
T(l) && o(s, l.value);
|
|
1326
1403
|
}
|
|
1327
1404
|
}
|
|
1328
1405
|
);
|
|
1329
1406
|
case "text":
|
|
1330
1407
|
case null:
|
|
1331
1408
|
return /* @__PURE__ */ t.jsx(
|
|
1332
|
-
|
|
1409
|
+
y,
|
|
1333
1410
|
{
|
|
1334
|
-
name:
|
|
1411
|
+
name: s,
|
|
1335
1412
|
type: "text",
|
|
1336
1413
|
defaultValue: typeof r == "string" ? r : JSON.stringify(r),
|
|
1337
1414
|
placeholder: "Enter value",
|
|
1338
|
-
onChange: (
|
|
1339
|
-
|
|
1415
|
+
onChange: (l) => {
|
|
1416
|
+
o(s, l.currentTarget.value);
|
|
1340
1417
|
}
|
|
1341
1418
|
}
|
|
1342
1419
|
);
|
|
1343
1420
|
default:
|
|
1344
|
-
return
|
|
1421
|
+
return te();
|
|
1345
1422
|
}
|
|
1346
1423
|
}
|
|
1347
|
-
function
|
|
1424
|
+
function he(e) {
|
|
1348
1425
|
return e != null && "value" in e;
|
|
1349
1426
|
}
|
|
1350
|
-
function
|
|
1351
|
-
let
|
|
1427
|
+
function Ja(e, a, n) {
|
|
1428
|
+
let s = null;
|
|
1352
1429
|
switch (e) {
|
|
1353
1430
|
case "datetime": {
|
|
1354
|
-
|
|
1431
|
+
s = "date";
|
|
1355
1432
|
break;
|
|
1356
1433
|
}
|
|
1357
1434
|
case "boolean": {
|
|
1358
|
-
|
|
1435
|
+
s = "boolean";
|
|
1359
1436
|
break;
|
|
1360
1437
|
}
|
|
1361
1438
|
case "string": {
|
|
1362
|
-
|
|
1439
|
+
s = "text";
|
|
1363
1440
|
break;
|
|
1364
1441
|
}
|
|
1365
1442
|
case "integer":
|
|
1366
1443
|
case "float": {
|
|
1367
|
-
|
|
1444
|
+
s = "number";
|
|
1368
1445
|
break;
|
|
1369
1446
|
}
|
|
1370
1447
|
case "array":
|
|
@@ -1372,11 +1449,11 @@ function qa(e, s, a) {
|
|
|
1372
1449
|
case "object":
|
|
1373
1450
|
break;
|
|
1374
1451
|
default: {
|
|
1375
|
-
|
|
1452
|
+
s = "text";
|
|
1376
1453
|
break;
|
|
1377
1454
|
}
|
|
1378
1455
|
}
|
|
1379
|
-
switch (
|
|
1456
|
+
switch (a) {
|
|
1380
1457
|
case "eq":
|
|
1381
1458
|
case "not_eq":
|
|
1382
1459
|
case "lt":
|
|
@@ -1396,179 +1473,260 @@ function qa(e, s, a) {
|
|
|
1396
1473
|
case "gteq_lt":
|
|
1397
1474
|
case "gt_lteq":
|
|
1398
1475
|
case "gteq_lteq": {
|
|
1399
|
-
|
|
1476
|
+
s === "number" && (s = "numberRange"), s === "text" && (s = "textRange"), s === "date" && (s = "dateRange");
|
|
1400
1477
|
break;
|
|
1401
1478
|
}
|
|
1402
1479
|
case "is_in":
|
|
1403
1480
|
case "is_not_in": {
|
|
1404
|
-
|
|
1481
|
+
s = "tag";
|
|
1405
1482
|
break;
|
|
1406
1483
|
}
|
|
1407
1484
|
case "array_match": {
|
|
1408
|
-
|
|
1485
|
+
s = "arrayMatch";
|
|
1409
1486
|
break;
|
|
1410
1487
|
}
|
|
1411
1488
|
}
|
|
1412
|
-
return
|
|
1489
|
+
return n?.resourceSelectorAvailable && (s = "resourceSelector"), s;
|
|
1413
1490
|
}
|
|
1414
|
-
function
|
|
1491
|
+
function Ba({
|
|
1415
1492
|
item: e,
|
|
1416
|
-
nestingLevel:
|
|
1417
|
-
pathPrefix:
|
|
1418
|
-
onDelete:
|
|
1493
|
+
nestingLevel: a,
|
|
1494
|
+
pathPrefix: n,
|
|
1495
|
+
onDelete: s
|
|
1419
1496
|
}) {
|
|
1420
|
-
const { setPath:
|
|
1421
|
-
return
|
|
1497
|
+
const { setPath: o } = x(), [c, u] = g(!1), r = [];
|
|
1498
|
+
return r[0] ??= [], r[0].push(
|
|
1499
|
+
/* @__PURE__ */ t.jsx(
|
|
1500
|
+
M,
|
|
1501
|
+
{
|
|
1502
|
+
label: "Set group",
|
|
1503
|
+
onClick: () => {
|
|
1504
|
+
u(!0);
|
|
1505
|
+
}
|
|
1506
|
+
}
|
|
1507
|
+
)
|
|
1508
|
+
), a < 2 && r[0].push(
|
|
1422
1509
|
/* @__PURE__ */ t.jsx(
|
|
1423
|
-
|
|
1510
|
+
M,
|
|
1424
1511
|
{
|
|
1425
1512
|
label: "Nest conditions",
|
|
1426
1513
|
onClick: () => {
|
|
1427
|
-
|
|
1428
|
-
`${
|
|
1514
|
+
o(
|
|
1515
|
+
`${n}.nested.conditions.${(e?.nested?.conditions ?? []).length}`,
|
|
1429
1516
|
void 0
|
|
1430
1517
|
);
|
|
1431
1518
|
}
|
|
1432
1519
|
}
|
|
1433
1520
|
)
|
|
1434
|
-
)
|
|
1521
|
+
), s != null && (r[1] ??= [], r[1].push(
|
|
1435
1522
|
/* @__PURE__ */ t.jsx(
|
|
1436
|
-
|
|
1523
|
+
M,
|
|
1437
1524
|
{
|
|
1438
1525
|
label: "Delete",
|
|
1439
1526
|
onClick: () => {
|
|
1440
|
-
|
|
1527
|
+
o(`${n}`, null), s();
|
|
1441
1528
|
}
|
|
1442
1529
|
}
|
|
1443
1530
|
)
|
|
1444
|
-
)), /* @__PURE__ */ t.jsxs("div", {
|
|
1445
|
-
/* @__PURE__ */ t.jsx(
|
|
1446
|
-
|
|
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,
|
|
1531
|
+
)), /* @__PURE__ */ t.jsxs("div", { children: [
|
|
1532
|
+
/* @__PURE__ */ t.jsx(
|
|
1533
|
+
Ya,
|
|
1461
1534
|
{
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
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
|
-
))
|
|
1535
|
+
onClose: () => u(!1),
|
|
1536
|
+
show: c,
|
|
1537
|
+
pathPrefix: n,
|
|
1538
|
+
item: e
|
|
1481
1539
|
}
|
|
1482
|
-
)
|
|
1540
|
+
),
|
|
1541
|
+
e?.group != null && /* @__PURE__ */ t.jsxs("div", { className: "text-xs pb-4", children: [
|
|
1542
|
+
"Group: ",
|
|
1543
|
+
/* @__PURE__ */ t.jsx(le, { weight: "bold", children: e.group })
|
|
1544
|
+
] }),
|
|
1545
|
+
/* @__PURE__ */ t.jsxs("div", { className: "bg-gray-50 rounded-md flex items-center", children: [
|
|
1546
|
+
/* @__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: [
|
|
1547
|
+
/* @__PURE__ */ t.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
1548
|
+
/* @__PURE__ */ t.jsx("div", { className: "flex-1", children: /* @__PURE__ */ t.jsx(
|
|
1549
|
+
Pa,
|
|
1550
|
+
{
|
|
1551
|
+
value: e?.field,
|
|
1552
|
+
name: `${n}.field`
|
|
1553
|
+
}
|
|
1554
|
+
) }),
|
|
1555
|
+
/* @__PURE__ */ t.jsx("div", { children: /* @__PURE__ */ t.jsx(La, { item: e, pathPrefix: n }) })
|
|
1556
|
+
] }),
|
|
1557
|
+
/* @__PURE__ */ t.jsx(Ua, { item: e, pathPrefix: n })
|
|
1558
|
+
] }) }),
|
|
1559
|
+
r.length > 0 && /* @__PURE__ */ t.jsx(
|
|
1560
|
+
D,
|
|
1561
|
+
{
|
|
1562
|
+
className: "w-8 border-l border-gray-100 flex items-center justify-center self-stretch shrink-0",
|
|
1563
|
+
dropdownLabel: /* @__PURE__ */ t.jsx(
|
|
1564
|
+
"button",
|
|
1565
|
+
{
|
|
1566
|
+
type: "button",
|
|
1567
|
+
className: "flex items-center justify-center self-stretch grow",
|
|
1568
|
+
children: /* @__PURE__ */ t.jsx(j, { name: "dotsThreeVertical", size: 16, weight: "bold" })
|
|
1569
|
+
}
|
|
1570
|
+
),
|
|
1571
|
+
dropdownItems: r.map((l, i, d) => (
|
|
1572
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: Using index as key is acceptable here since items are static
|
|
1573
|
+
/* @__PURE__ */ t.jsxs(W.Fragment, { children: [
|
|
1574
|
+
l.map((h, p) => (
|
|
1575
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: Using index as key is acceptable here since items are static
|
|
1576
|
+
/* @__PURE__ */ t.jsx(W.Fragment, { children: h }, p)
|
|
1577
|
+
)),
|
|
1578
|
+
i < d.length - 1 && /* @__PURE__ */ t.jsx(ie, {})
|
|
1579
|
+
] }, i)
|
|
1580
|
+
))
|
|
1581
|
+
}
|
|
1582
|
+
)
|
|
1583
|
+
] })
|
|
1483
1584
|
] });
|
|
1484
1585
|
}
|
|
1485
|
-
|
|
1586
|
+
const Ya = ({
|
|
1587
|
+
show: e,
|
|
1588
|
+
onClose: a,
|
|
1589
|
+
pathPrefix: n,
|
|
1590
|
+
item: s
|
|
1591
|
+
}) => {
|
|
1592
|
+
const o = O(null), { setPath: c } = x(), u = pe(), [r, l] = g(s?.group);
|
|
1593
|
+
return _(() => {
|
|
1594
|
+
l(s?.group);
|
|
1595
|
+
}, [s?.group, e]), /* @__PURE__ */ t.jsxs(S, { ref: o, show: e, onClose: a, size: "large", children: [
|
|
1596
|
+
/* @__PURE__ */ t.jsx(S.Header, { children: "Set group" }),
|
|
1597
|
+
/* @__PURE__ */ t.jsxs(S.Body, { children: [
|
|
1598
|
+
/* @__PURE__ */ t.jsx(
|
|
1599
|
+
v,
|
|
1600
|
+
{
|
|
1601
|
+
name: `${n}.group`,
|
|
1602
|
+
isCreatable: !0,
|
|
1603
|
+
isClearable: !0,
|
|
1604
|
+
menuPortalTarget: o.current,
|
|
1605
|
+
initialValues: u.map((i) => ({
|
|
1606
|
+
value: i,
|
|
1607
|
+
label: i
|
|
1608
|
+
})),
|
|
1609
|
+
value: r != null ? {
|
|
1610
|
+
value: r,
|
|
1611
|
+
label: r
|
|
1612
|
+
} : void 0,
|
|
1613
|
+
onSelect: (i) => {
|
|
1614
|
+
(i == null || T(i)) && l(i?.value.toString());
|
|
1615
|
+
},
|
|
1616
|
+
placeholder: "Select or create group…"
|
|
1617
|
+
}
|
|
1618
|
+
),
|
|
1619
|
+
/* @__PURE__ */ t.jsx(va, { top: "2", children: /* @__PURE__ */ t.jsx(le, { size: "small", variant: "info", children: "Choose an existing group or create a new one. Leave empty to remove." }) })
|
|
1620
|
+
] }),
|
|
1621
|
+
/* @__PURE__ */ t.jsx(S.Footer, { children: /* @__PURE__ */ t.jsx(
|
|
1622
|
+
N,
|
|
1623
|
+
{
|
|
1624
|
+
onClick: () => {
|
|
1625
|
+
c(`${n}.group`, r), a();
|
|
1626
|
+
},
|
|
1627
|
+
fullWidth: !0,
|
|
1628
|
+
children: "Save"
|
|
1629
|
+
}
|
|
1630
|
+
) })
|
|
1631
|
+
] });
|
|
1632
|
+
};
|
|
1633
|
+
function ge({
|
|
1486
1634
|
item: e,
|
|
1487
|
-
children:
|
|
1488
|
-
nestingLevel:
|
|
1489
|
-
pathPrefix:
|
|
1635
|
+
children: a,
|
|
1636
|
+
nestingLevel: n = 0,
|
|
1637
|
+
pathPrefix: s
|
|
1490
1638
|
}) {
|
|
1491
1639
|
const {
|
|
1492
|
-
state: { selectedRuleIndex:
|
|
1493
|
-
} = x(),
|
|
1640
|
+
state: { selectedRuleIndex: o }
|
|
1641
|
+
} = x(), c = e?.conditions_logic?.toLowerCase() ?? "and", { setPath: u } = x(), [r, l] = g(0), i = n > 0;
|
|
1494
1642
|
return /* @__PURE__ */ t.jsxs(
|
|
1495
1643
|
"div",
|
|
1496
1644
|
{
|
|
1497
|
-
className:
|
|
1498
|
-
"p-4 border border-gray-200 rounded-md":
|
|
1645
|
+
className: w("query-group", {
|
|
1646
|
+
"p-4 border border-gray-200 rounded-md": i
|
|
1499
1647
|
}),
|
|
1500
1648
|
children: [
|
|
1501
|
-
|
|
1649
|
+
a,
|
|
1502
1650
|
e != null && (e.conditions ?? []).length > 0 && /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
1503
|
-
/* @__PURE__ */ t.jsxs(
|
|
1651
|
+
i && /* @__PURE__ */ t.jsxs(
|
|
1504
1652
|
"select",
|
|
1505
1653
|
{
|
|
1506
1654
|
onChange: (d) => {
|
|
1507
1655
|
u(
|
|
1508
|
-
`${
|
|
1656
|
+
`${s}.conditions_logic`,
|
|
1509
1657
|
d.currentTarget.value
|
|
1510
1658
|
);
|
|
1511
1659
|
},
|
|
1512
|
-
defaultValue:
|
|
1660
|
+
defaultValue: c,
|
|
1513
1661
|
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
1662
|
children: [
|
|
1515
|
-
/* @__PURE__ */ t.
|
|
1516
|
-
|
|
1517
|
-
"AND"
|
|
1518
|
-
] }),
|
|
1519
|
-
/* @__PURE__ */ t.jsxs("option", { value: "or", children: [
|
|
1520
|
-
l ? "Nested in " : "",
|
|
1521
|
-
"OR"
|
|
1522
|
-
] })
|
|
1663
|
+
/* @__PURE__ */ t.jsx("option", { value: "and", children: "Nested in AND" }),
|
|
1664
|
+
/* @__PURE__ */ t.jsx("option", { value: "or", children: "Nested in OR" })
|
|
1523
1665
|
]
|
|
1524
1666
|
}
|
|
1525
1667
|
),
|
|
1526
|
-
/* @__PURE__ */ t.jsx(
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1668
|
+
/* @__PURE__ */ t.jsx(
|
|
1669
|
+
"div",
|
|
1670
|
+
{
|
|
1671
|
+
className: w({
|
|
1672
|
+
"border-l border-gray-200 ml-3 pt-3": i
|
|
1673
|
+
}),
|
|
1674
|
+
children: e?.conditions?.map((d, h, p) => {
|
|
1675
|
+
const m = h === p.length - 1;
|
|
1676
|
+
return /* @__PURE__ */ t.jsxs(
|
|
1677
|
+
"div",
|
|
1678
|
+
{
|
|
1679
|
+
className: "flex items-center mb-4 last:mb-0 relative",
|
|
1680
|
+
children: [
|
|
1681
|
+
i && /* @__PURE__ */ t.jsx(Xa, { rounded: m }),
|
|
1682
|
+
/* @__PURE__ */ t.jsx(
|
|
1541
1683
|
"div",
|
|
1542
1684
|
{
|
|
1543
|
-
className:
|
|
1544
|
-
"
|
|
1685
|
+
className: w("w-full", {
|
|
1686
|
+
"ml-4": i
|
|
1545
1687
|
}),
|
|
1546
1688
|
children: /* @__PURE__ */ t.jsx(
|
|
1547
|
-
|
|
1689
|
+
ge,
|
|
1548
1690
|
{
|
|
1549
|
-
item: d,
|
|
1550
|
-
nestingLevel:
|
|
1551
|
-
pathPrefix: `${
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1691
|
+
item: d?.nested ?? void 0,
|
|
1692
|
+
nestingLevel: d?.nested != null ? n + 1 : d?.group != null ? 1 : 0,
|
|
1693
|
+
pathPrefix: `${s}.conditions.${h}.nested`,
|
|
1694
|
+
children: /* @__PURE__ */ t.jsx(
|
|
1695
|
+
"div",
|
|
1696
|
+
{
|
|
1697
|
+
className: w({
|
|
1698
|
+
"mb-4": d?.nested != null
|
|
1699
|
+
}),
|
|
1700
|
+
children: /* @__PURE__ */ t.jsx(
|
|
1701
|
+
Ba,
|
|
1702
|
+
{
|
|
1703
|
+
item: d,
|
|
1704
|
+
nestingLevel: n,
|
|
1705
|
+
pathPrefix: `${s}.conditions.${h}`,
|
|
1706
|
+
onDelete: p.length > 1 || n > 0 ? () => {
|
|
1707
|
+
l((f) => f + 1);
|
|
1708
|
+
} : void 0
|
|
1709
|
+
}
|
|
1710
|
+
)
|
|
1711
|
+
}
|
|
1712
|
+
)
|
|
1555
1713
|
}
|
|
1556
1714
|
)
|
|
1557
1715
|
}
|
|
1558
1716
|
)
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1717
|
+
]
|
|
1718
|
+
},
|
|
1719
|
+
`${o}-${h}-${r}`
|
|
1720
|
+
);
|
|
1721
|
+
})
|
|
1722
|
+
}
|
|
1723
|
+
)
|
|
1566
1724
|
] })
|
|
1567
1725
|
]
|
|
1568
1726
|
}
|
|
1569
1727
|
);
|
|
1570
1728
|
}
|
|
1571
|
-
function
|
|
1729
|
+
function Xa({
|
|
1572
1730
|
rounded: e = !1
|
|
1573
1731
|
}) {
|
|
1574
1732
|
return e ? /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
@@ -1576,16 +1734,16 @@ function La({
|
|
|
1576
1734
|
/* @__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
1735
|
] }) : /* @__PURE__ */ t.jsx("div", { className: "absolute left-0 top-1/2 -translate-y-1/2 w-3.5 h-px bg-gray-200" });
|
|
1578
1736
|
}
|
|
1579
|
-
function
|
|
1737
|
+
function Ha() {
|
|
1580
1738
|
const {
|
|
1581
1739
|
setPath: e,
|
|
1582
|
-
state: { value:
|
|
1583
|
-
} = x(), [
|
|
1584
|
-
|
|
1740
|
+
state: { value: a, selectedRuleIndex: n }
|
|
1741
|
+
} = x(), [s, o] = g(
|
|
1742
|
+
a.rules?.[n]?.name ?? ""
|
|
1585
1743
|
);
|
|
1586
1744
|
return _(() => {
|
|
1587
|
-
|
|
1588
|
-
}, [
|
|
1745
|
+
o(a.rules?.[n]?.name ?? "");
|
|
1746
|
+
}, [n]), // <Input
|
|
1589
1747
|
// value={value.rules?.[selectedRuleIndex]?.name}
|
|
1590
1748
|
// onChange={(event) => {
|
|
1591
1749
|
// const target = event.currentTarget
|
|
@@ -1600,63 +1758,63 @@ function Fa() {
|
|
|
1600
1758
|
{
|
|
1601
1759
|
contentEditable: "plaintext-only",
|
|
1602
1760
|
suppressContentEditableWarning: !0,
|
|
1603
|
-
onInput: (
|
|
1604
|
-
const r =
|
|
1605
|
-
e(`rules.${
|
|
1761
|
+
onInput: (c) => {
|
|
1762
|
+
const r = c.currentTarget.innerText.replace(/[\n\s]+/g, " ").trim();
|
|
1763
|
+
e(`rules.${n}.name`, r);
|
|
1606
1764
|
},
|
|
1607
|
-
onKeyDown: (
|
|
1608
|
-
|
|
1765
|
+
onKeyDown: (c) => {
|
|
1766
|
+
c.key === "Enter" && (c.preventDefault(), c.currentTarget.blur());
|
|
1609
1767
|
},
|
|
1610
|
-
onBlur: (
|
|
1611
|
-
const u =
|
|
1768
|
+
onBlur: (c) => {
|
|
1769
|
+
const u = c.currentTarget;
|
|
1612
1770
|
u.innerText = u.innerText.replace(/[\n\s]+/g, " ").trim();
|
|
1613
1771
|
},
|
|
1614
|
-
children:
|
|
1772
|
+
children: s
|
|
1615
1773
|
},
|
|
1616
|
-
|
|
1774
|
+
n
|
|
1617
1775
|
);
|
|
1618
1776
|
}
|
|
1619
|
-
const
|
|
1777
|
+
const K = {
|
|
1620
1778
|
rules: []
|
|
1621
|
-
},
|
|
1779
|
+
}, k = (e) => {
|
|
1622
1780
|
try {
|
|
1623
|
-
return JSON.parse(e ?? JSON.stringify(
|
|
1781
|
+
return JSON.parse(e ?? JSON.stringify(K));
|
|
1624
1782
|
} catch {
|
|
1625
|
-
return
|
|
1783
|
+
return K;
|
|
1626
1784
|
}
|
|
1627
|
-
},
|
|
1785
|
+
}, Qa = (e) => {
|
|
1628
1786
|
try {
|
|
1629
1787
|
return JSON.parse(e ?? "{}"), !0;
|
|
1630
1788
|
} catch {
|
|
1631
1789
|
return !1;
|
|
1632
1790
|
}
|
|
1633
1791
|
};
|
|
1634
|
-
function
|
|
1792
|
+
function is(e) {
|
|
1635
1793
|
const {
|
|
1636
|
-
settings: { domain:
|
|
1637
|
-
} =
|
|
1638
|
-
|
|
1794
|
+
settings: { domain: a }
|
|
1795
|
+
} = re(), [n, s] = g([]), [o, c] = g(
|
|
1796
|
+
k(e.value ?? e.defaultValue)
|
|
1639
1797
|
);
|
|
1640
1798
|
return _(
|
|
1641
1799
|
function() {
|
|
1642
|
-
|
|
1800
|
+
o.rules?.length === 0 && c(k(e.value));
|
|
1643
1801
|
},
|
|
1644
1802
|
[e.value]
|
|
1645
1803
|
), _(
|
|
1646
1804
|
function() {
|
|
1647
|
-
|
|
1648
|
-
const
|
|
1649
|
-
properties:
|
|
1650
|
-
rules:
|
|
1651
|
-
items:
|
|
1652
|
-
properties:
|
|
1653
|
-
actions:
|
|
1654
|
-
items:
|
|
1655
|
-
anyOf:
|
|
1656
|
-
|
|
1657
|
-
properties:
|
|
1658
|
-
type:
|
|
1659
|
-
enum:
|
|
1805
|
+
ja(e.schemaType, a).then((r) => {
|
|
1806
|
+
const i = b.object({
|
|
1807
|
+
properties: b.object({
|
|
1808
|
+
rules: b.object({
|
|
1809
|
+
items: b.object({
|
|
1810
|
+
properties: b.object({
|
|
1811
|
+
actions: b.object({
|
|
1812
|
+
items: b.object({
|
|
1813
|
+
anyOf: b.array(
|
|
1814
|
+
b.object({
|
|
1815
|
+
properties: b.object({
|
|
1816
|
+
type: b.object({
|
|
1817
|
+
enum: b.string().array()
|
|
1660
1818
|
})
|
|
1661
1819
|
})
|
|
1662
1820
|
})
|
|
@@ -1670,46 +1828,46 @@ function Qa(e) {
|
|
|
1670
1828
|
}).parse(r).properties.rules.items.properties.actions.items.anyOf.flatMap(
|
|
1671
1829
|
(d) => d.properties.type.enum
|
|
1672
1830
|
);
|
|
1673
|
-
|
|
1831
|
+
s([...new Set(i)]);
|
|
1674
1832
|
});
|
|
1675
1833
|
},
|
|
1676
|
-
[
|
|
1834
|
+
[a]
|
|
1677
1835
|
), /* @__PURE__ */ t.jsx(
|
|
1678
|
-
|
|
1836
|
+
Va,
|
|
1679
1837
|
{
|
|
1680
1838
|
initialValue: {
|
|
1681
|
-
value: { rules:
|
|
1682
|
-
availableActionTypes:
|
|
1839
|
+
value: { rules: o.rules },
|
|
1840
|
+
availableActionTypes: n,
|
|
1683
1841
|
schemaType: e.schemaType
|
|
1684
1842
|
},
|
|
1685
|
-
children: /* @__PURE__ */ t.jsx(
|
|
1843
|
+
children: /* @__PURE__ */ t.jsx(Ka, { ...e })
|
|
1686
1844
|
}
|
|
1687
1845
|
);
|
|
1688
1846
|
}
|
|
1689
|
-
function
|
|
1847
|
+
function Ka(e) {
|
|
1690
1848
|
const {
|
|
1691
|
-
state: { value:
|
|
1692
|
-
setSelectedRuleIndex:
|
|
1693
|
-
setValue:
|
|
1694
|
-
setPath:
|
|
1849
|
+
state: { value: a, selectedRuleIndex: n },
|
|
1850
|
+
setSelectedRuleIndex: s,
|
|
1851
|
+
setValue: o,
|
|
1852
|
+
setPath: c
|
|
1695
1853
|
} = x(), [u, r] = g(
|
|
1696
1854
|
e.defaultCodeEditorVisible ?? !1
|
|
1697
|
-
),
|
|
1855
|
+
), l = a.rules?.[n], i = O(null), [d, h] = g(0);
|
|
1698
1856
|
_(
|
|
1699
1857
|
function() {
|
|
1700
|
-
|
|
1858
|
+
Z(k(i.current?.getValue()), a) || i.current?.setValue(JSON.stringify(a, null, 2)), e.onChange?.(a);
|
|
1701
1859
|
},
|
|
1702
|
-
[
|
|
1860
|
+
[a]
|
|
1703
1861
|
);
|
|
1704
|
-
const p =
|
|
1862
|
+
const p = C(
|
|
1705
1863
|
(m) => {
|
|
1706
|
-
const f =
|
|
1707
|
-
|
|
1864
|
+
const f = k(m);
|
|
1865
|
+
i.current?.hasTextFocus() && Qa(m) && !Z(f, a) && (o(f), h((V) => V + 1));
|
|
1708
1866
|
},
|
|
1709
|
-
[
|
|
1867
|
+
[a]
|
|
1710
1868
|
);
|
|
1711
1869
|
return /* @__PURE__ */ t.jsx(
|
|
1712
|
-
|
|
1870
|
+
_a,
|
|
1713
1871
|
{
|
|
1714
1872
|
hint: e.hint,
|
|
1715
1873
|
feedback: e.feedback,
|
|
@@ -1722,8 +1880,8 @@ function Ua(e) {
|
|
|
1722
1880
|
children: [
|
|
1723
1881
|
/* @__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
1882
|
/* @__PURE__ */ t.jsxs("div", { className: "flex items-center flex-wrap basis-full", children: [
|
|
1725
|
-
|
|
1726
|
-
const
|
|
1883
|
+
a.rules?.map((m, f, V) => {
|
|
1884
|
+
const xe = `#${(f + 1).toString().padStart(2, "0")}`;
|
|
1727
1885
|
return /* @__PURE__ */ t.jsxs(
|
|
1728
1886
|
"div",
|
|
1729
1887
|
{
|
|
@@ -1733,42 +1891,42 @@ function Ua(e) {
|
|
|
1733
1891
|
"button",
|
|
1734
1892
|
{
|
|
1735
1893
|
type: "button",
|
|
1736
|
-
className:
|
|
1737
|
-
"text-black":
|
|
1894
|
+
className: w("font-bold mr-2", {
|
|
1895
|
+
"text-black": n === f
|
|
1738
1896
|
}),
|
|
1739
1897
|
onClick: () => {
|
|
1740
|
-
|
|
1898
|
+
s(f);
|
|
1741
1899
|
},
|
|
1742
|
-
children:
|
|
1900
|
+
children: xe
|
|
1743
1901
|
}
|
|
1744
1902
|
),
|
|
1745
1903
|
/* @__PURE__ */ t.jsx(
|
|
1746
|
-
|
|
1904
|
+
D,
|
|
1747
1905
|
{
|
|
1748
1906
|
menuPosition: f === 0 ? "bottom-left" : "bottom-right",
|
|
1749
|
-
dropdownLabel: /* @__PURE__ */ t.jsx(
|
|
1907
|
+
dropdownLabel: /* @__PURE__ */ t.jsx(N, { variant: "circle", children: /* @__PURE__ */ t.jsx(j, { name: "dotsThreeVertical", size: 16 }) }),
|
|
1750
1908
|
dropdownItems: /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
1751
1909
|
/* @__PURE__ */ t.jsx(
|
|
1752
|
-
|
|
1910
|
+
M,
|
|
1753
1911
|
{
|
|
1754
1912
|
onClick: () => {
|
|
1755
|
-
const
|
|
1756
|
-
|
|
1913
|
+
const q = a.rules?.length ?? 0;
|
|
1914
|
+
c(`rules.${q}`, {
|
|
1757
1915
|
...m,
|
|
1758
1916
|
id: void 0,
|
|
1759
1917
|
name: `${m.name} (copy)`
|
|
1760
|
-
}),
|
|
1918
|
+
}), s(q);
|
|
1761
1919
|
},
|
|
1762
1920
|
label: "Duplicate"
|
|
1763
1921
|
}
|
|
1764
1922
|
),
|
|
1765
|
-
/* @__PURE__ */ t.jsx(
|
|
1923
|
+
/* @__PURE__ */ t.jsx(ie, {}),
|
|
1766
1924
|
/* @__PURE__ */ t.jsx(
|
|
1767
|
-
|
|
1925
|
+
M,
|
|
1768
1926
|
{
|
|
1769
|
-
disabled:
|
|
1927
|
+
disabled: V.length === 1,
|
|
1770
1928
|
onClick: () => {
|
|
1771
|
-
|
|
1929
|
+
c(`rules.${f}`, null), n >= f && s(n - 1);
|
|
1772
1930
|
},
|
|
1773
1931
|
label: "Delete"
|
|
1774
1932
|
}
|
|
@@ -1782,80 +1940,108 @@ function Ua(e) {
|
|
|
1782
1940
|
);
|
|
1783
1941
|
}),
|
|
1784
1942
|
/* @__PURE__ */ t.jsx("div", { className: "min-h-[49px] flex items-center", children: /* @__PURE__ */ t.jsx(
|
|
1785
|
-
|
|
1943
|
+
N,
|
|
1786
1944
|
{
|
|
1787
1945
|
variant: "circle",
|
|
1788
1946
|
className: "mx-4",
|
|
1789
1947
|
onClick: () => {
|
|
1790
|
-
|
|
1948
|
+
c(`rules.${a.rules?.length ?? 0}`, {
|
|
1791
1949
|
name: "Rule name",
|
|
1792
1950
|
actions: [null],
|
|
1793
1951
|
conditions: [null]
|
|
1794
|
-
}),
|
|
1952
|
+
}), s(a.rules?.length ?? 0);
|
|
1795
1953
|
},
|
|
1796
|
-
children: /* @__PURE__ */ t.jsx(
|
|
1954
|
+
children: /* @__PURE__ */ t.jsx(j, { name: "plus", size: 16, className: "shrink-0" })
|
|
1797
1955
|
}
|
|
1798
1956
|
) })
|
|
1799
1957
|
] }),
|
|
1800
1958
|
/* @__PURE__ */ t.jsx("div", { className: "grow flex justify-end", children: /* @__PURE__ */ t.jsx(
|
|
1801
|
-
|
|
1959
|
+
N,
|
|
1802
1960
|
{
|
|
1803
1961
|
variant: "circle",
|
|
1804
1962
|
onClick: () => {
|
|
1805
1963
|
r(!u);
|
|
1806
1964
|
},
|
|
1807
|
-
children: /* @__PURE__ */ t.jsx(
|
|
1965
|
+
children: /* @__PURE__ */ t.jsx(j, { name: "sidebarSimple", size: 16 })
|
|
1808
1966
|
}
|
|
1809
1967
|
) })
|
|
1810
1968
|
] }),
|
|
1811
|
-
/* @__PURE__ */ t.jsx(
|
|
1969
|
+
/* @__PURE__ */ t.jsx(ts, { children: l && /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
1812
1970
|
/* @__PURE__ */ t.jsxs("div", { className: "mb-8 flex items-center gap-2", children: [
|
|
1813
|
-
/* @__PURE__ */ t.jsx(
|
|
1814
|
-
/* @__PURE__ */ t.jsx(
|
|
1971
|
+
/* @__PURE__ */ t.jsx(Ha, {}),
|
|
1972
|
+
/* @__PURE__ */ t.jsx(j, { name: "pencilSimple", size: 16, className: "shrink-0" })
|
|
1815
1973
|
] }),
|
|
1816
|
-
/* @__PURE__ */ t.
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1974
|
+
/* @__PURE__ */ t.jsxs(
|
|
1975
|
+
ee,
|
|
1976
|
+
{
|
|
1977
|
+
title: /* @__PURE__ */ t.jsxs("div", { children: [
|
|
1978
|
+
"If",
|
|
1979
|
+
" ",
|
|
1980
|
+
/* @__PURE__ */ t.jsxs(
|
|
1981
|
+
"select",
|
|
1982
|
+
{
|
|
1983
|
+
onChange: (m) => {
|
|
1984
|
+
c(
|
|
1985
|
+
`rules.${n}.conditions_logic`,
|
|
1986
|
+
m.currentTarget.value
|
|
1987
|
+
);
|
|
1988
|
+
},
|
|
1989
|
+
value: l?.conditions_logic ?? "all",
|
|
1990
|
+
className: "font-bold py-1 pl-2 pr-6 bg-position-[right_center] focus:ring-0 focus:outline-hidden appearance-none border-0 rounded-md leading-4 ml-1 mr-1.5",
|
|
1991
|
+
children: [
|
|
1992
|
+
/* @__PURE__ */ t.jsx("option", { value: "and", children: "all" }),
|
|
1993
|
+
/* @__PURE__ */ t.jsx("option", { value: "or", children: "any" })
|
|
1994
|
+
]
|
|
1995
|
+
}
|
|
1996
|
+
),
|
|
1997
|
+
"conditions occur"
|
|
1998
|
+
] }),
|
|
1999
|
+
icon: "treeView",
|
|
2000
|
+
children: [
|
|
2001
|
+
/* @__PURE__ */ t.jsx(
|
|
2002
|
+
ge,
|
|
2003
|
+
{
|
|
2004
|
+
item: l,
|
|
2005
|
+
pathPrefix: `rules.${n}`
|
|
2006
|
+
}
|
|
2007
|
+
),
|
|
2008
|
+
/* @__PURE__ */ t.jsx("div", { className: "mt-6", children: /* @__PURE__ */ t.jsxs(
|
|
2009
|
+
N,
|
|
2010
|
+
{
|
|
2011
|
+
size: "small",
|
|
2012
|
+
variant: "secondary",
|
|
2013
|
+
alignItems: "center",
|
|
2014
|
+
onClick: () => {
|
|
2015
|
+
c(
|
|
2016
|
+
`rules.${n}.conditions.${l?.conditions?.length ?? 0}`,
|
|
2017
|
+
void 0
|
|
2018
|
+
);
|
|
2019
|
+
},
|
|
2020
|
+
children: [
|
|
2021
|
+
/* @__PURE__ */ t.jsx(j, { name: "plusCircle" }),
|
|
2022
|
+
" Add condition"
|
|
2023
|
+
]
|
|
2024
|
+
}
|
|
2025
|
+
) })
|
|
2026
|
+
]
|
|
2027
|
+
}
|
|
2028
|
+
),
|
|
2029
|
+
/* @__PURE__ */ t.jsx(es, { children: "do" }),
|
|
2030
|
+
/* @__PURE__ */ t.jsx(ee, { title: "Actions", icon: "lightning", children: /* @__PURE__ */ t.jsx(Oa, { actions: l?.actions }) })
|
|
1845
2031
|
] }) })
|
|
1846
2032
|
]
|
|
1847
2033
|
},
|
|
1848
2034
|
d
|
|
1849
2035
|
),
|
|
1850
2036
|
u && /* @__PURE__ */ t.jsx("div", { className: "shrink-0 basis-2/5", children: /* @__PURE__ */ t.jsx(
|
|
1851
|
-
|
|
2037
|
+
Ta,
|
|
1852
2038
|
{
|
|
1853
|
-
ref:
|
|
2039
|
+
ref: i,
|
|
1854
2040
|
name: e.id ?? e.name,
|
|
1855
2041
|
height: "100%",
|
|
1856
2042
|
language: "json",
|
|
1857
2043
|
jsonSchema: e.schemaType,
|
|
1858
|
-
defaultValue: JSON.stringify(
|
|
2044
|
+
defaultValue: JSON.stringify(a, null, 2),
|
|
1859
2045
|
noRounding: !0,
|
|
1860
2046
|
onChange: p
|
|
1861
2047
|
}
|
|
@@ -1864,31 +2050,31 @@ function Ua(e) {
|
|
|
1864
2050
|
}
|
|
1865
2051
|
);
|
|
1866
2052
|
}
|
|
1867
|
-
function
|
|
2053
|
+
function es({ children: e }) {
|
|
1868
2054
|
return /* @__PURE__ */ t.jsxs("div", { className: "text-gray-500 flex items-center justify-center flex-col", children: [
|
|
1869
2055
|
/* @__PURE__ */ t.jsx("div", { className: "h-6 w-[2px] bg-gray-200" }),
|
|
1870
2056
|
/* @__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
2057
|
/* @__PURE__ */ t.jsx("div", { className: "h-6 w-[2px] bg-gray-200" })
|
|
1872
2058
|
] });
|
|
1873
2059
|
}
|
|
1874
|
-
function
|
|
2060
|
+
function ee({
|
|
1875
2061
|
children: e,
|
|
1876
|
-
title:
|
|
1877
|
-
icon:
|
|
2062
|
+
title: a,
|
|
2063
|
+
icon: n
|
|
1878
2064
|
}) {
|
|
1879
2065
|
return /* @__PURE__ */ t.jsxs("div", { className: "rounded-md bg-white shadow-xs", children: [
|
|
1880
2066
|
/* @__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(
|
|
1882
|
-
/* @__PURE__ */ t.jsx("h2", { className: "
|
|
2067
|
+
/* @__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(j, { name: n }) }),
|
|
2068
|
+
/* @__PURE__ */ t.jsx("h2", { className: "font-semibold", children: a })
|
|
1883
2069
|
] }),
|
|
1884
2070
|
/* @__PURE__ */ t.jsx("div", { className: "p-6", children: e })
|
|
1885
2071
|
] });
|
|
1886
2072
|
}
|
|
1887
|
-
function
|
|
2073
|
+
function ts({
|
|
1888
2074
|
children: e
|
|
1889
2075
|
}) {
|
|
1890
2076
|
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
2077
|
}
|
|
1892
2078
|
export {
|
|
1893
|
-
|
|
2079
|
+
is as RuleEngine
|
|
1894
2080
|
};
|