@commercelayer/app-elements 6.10.1 → 6.11.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-BtfnLD3Z.js → InputDateComponent-BwZ2boN8.js} +2 -2
- package/dist/{RuleEngineComponent-BA6J2HvG.js → RuleEngineComponent-CV2kt0w6.js} +1119 -924
- package/dist/{main-DR8vknzj.js → main-CIxAHy9U.js} +3365 -3362
- package/dist/main.js +29 -29
- package/dist/{parseISO-BZbwFj8_.js → parseISO-C3M0cm1w.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/ui/forms/RuleEngine/Condition/hooks.d.ts +1 -1
- package/dist/ui/forms/RuleEngine/InputResourceSelector.d.ts +12 -0
- package/dist/ui/forms/RuleEngine/Options/ActionOptions.d.ts +5 -0
- package/dist/ui/forms/RuleEngine/Options/ConditionOptions.d.ts +5 -0
- package/dist/ui/forms/RuleEngine/Options/common.d.ts +20 -0
- package/dist/ui/forms/RuleEngine/Options/index.d.ts +2 -5
- package/dist/ui/forms/RuleEngine/json_schema/order_rules.schema.d.ts +134 -6
- package/dist/ui/forms/RuleEngine/json_schema/price_rules.schema.d.ts +113 -3
- package/dist/ui/forms/RuleEngine/optionsConfig.d.ts +7 -3
- package/dist/vendor.css +1 -1
- package/package.json +8 -8
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { t as
|
|
3
|
-
import
|
|
2
|
+
import { t as W, b as Oe, d as Re, e as Ve, j as t, i as R, g as U, I as j, D as S, f as L, h as Ae, u as Me, k as Ee, l as Ie, n as Y, o as ae, p as x, q as k, T as C, r as $, s as _, v as y, w as re, x as E, y as z, B as O, z as oe, A as qe, C as ie, S as X, H as De, E as ue, F as Le, G as Fe, J as H, K as ze, L as Ge, M as Ue } from "./main-CIxAHy9U.js";
|
|
3
|
+
import K, { useReducer as Je, useCallback as A, useMemo as ce, createContext as Be, useContext as We, useState as v, useEffect as T, useRef as de } from "react";
|
|
4
4
|
import "react-hook-form";
|
|
5
5
|
import "wouter";
|
|
6
|
-
import { p as
|
|
7
|
-
function
|
|
6
|
+
import { p as Q } from "./parseISO-C3M0cm1w.js";
|
|
7
|
+
function Z(e, s) {
|
|
8
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 n ?
|
|
11
|
+
return n ? W(
|
|
12
12
|
Date.UTC(
|
|
13
13
|
+n[1],
|
|
14
14
|
+n[2] - 1,
|
|
@@ -19,52 +19,48 @@ function Q(e, s) {
|
|
|
19
19
|
+((n[7] || "0") + "00").substring(0, 3)
|
|
20
20
|
),
|
|
21
21
|
s?.in
|
|
22
|
-
) :
|
|
22
|
+
) : W(NaN, s?.in);
|
|
23
23
|
}
|
|
24
24
|
var Ye = 1, Xe = 4;
|
|
25
|
-
function
|
|
26
|
-
return
|
|
25
|
+
function P(e) {
|
|
26
|
+
return Oe(e, Ye | Xe);
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
return e == null ? e :
|
|
28
|
+
function q(e, s, n) {
|
|
29
|
+
return e == null ? e : Re(e, s, n);
|
|
30
30
|
}
|
|
31
31
|
function D(e, s) {
|
|
32
|
-
return e == null ? !0 :
|
|
32
|
+
return e == null ? !0 : Ve(e, s);
|
|
33
33
|
}
|
|
34
|
-
const pe =
|
|
34
|
+
const pe = Be(
|
|
35
35
|
void 0
|
|
36
36
|
);
|
|
37
37
|
function He(e, s) {
|
|
38
38
|
switch (s.type) {
|
|
39
39
|
case "SET_PATH": {
|
|
40
|
-
const n =
|
|
41
|
-
if (/actions\.\d\.[\w_]+$/.test(s.path)) {
|
|
42
|
-
const l = s.path.replace(/\.[\w_]+$/, "");
|
|
43
|
-
q(n, l)?.groups == null && O(n, `${l}.groups`, []);
|
|
44
|
-
}
|
|
40
|
+
const n = P(e.value);
|
|
45
41
|
if (s.value === null && s.allowNullValue === !1)
|
|
46
42
|
if (/\.\d+$/.test(s.path)) {
|
|
47
|
-
const l = s.path.replace(/\.\d+$/, ""),
|
|
48
|
-
Array.isArray(
|
|
43
|
+
const l = s.path.replace(/\.\d+$/, ""), r = parseInt(s.path.match(/\d+$/)?.[0] ?? "0", 10), o = U(n, l);
|
|
44
|
+
Array.isArray(o) && (o.splice(r, 1), q(n, l, o), o.length === 0 && l.endsWith(".nested.conditions") && D(n, l.replace(/\.conditions$/, "")));
|
|
49
45
|
} else
|
|
50
46
|
D(n, s.path);
|
|
51
47
|
else
|
|
52
|
-
|
|
48
|
+
q(n, s.path, s.value);
|
|
53
49
|
return {
|
|
54
50
|
...e,
|
|
55
51
|
value: n
|
|
56
52
|
};
|
|
57
53
|
}
|
|
58
54
|
case "SET_RENDER_OPTION": {
|
|
59
|
-
const n =
|
|
55
|
+
const n = P(e.renderOptions);
|
|
60
56
|
if (s.value === null)
|
|
61
57
|
if (/\.\d+$/.test(s.path)) {
|
|
62
|
-
const l = s.path.replace(/\.\d+$/, ""),
|
|
63
|
-
Array.isArray(
|
|
58
|
+
const l = s.path.replace(/\.\d+$/, ""), r = parseInt(s.path.match(/\d+$/)?.[0] ?? "0", 10), o = U(n, l);
|
|
59
|
+
Array.isArray(o) && (o.splice(r, 1), q(n, l, o), o.length === 0 && l.endsWith(".nested.conditions") && D(n, l.replace(/\.conditions$/, "")));
|
|
64
60
|
} else
|
|
65
61
|
D(n, s.path);
|
|
66
62
|
else
|
|
67
|
-
|
|
63
|
+
q(n, s.path, s.value);
|
|
68
64
|
return {
|
|
69
65
|
...e,
|
|
70
66
|
renderOptions: n
|
|
@@ -76,7 +72,7 @@ function He(e, s) {
|
|
|
76
72
|
selectedRuleIndex: s.index
|
|
77
73
|
};
|
|
78
74
|
case "SET_VALUE":
|
|
79
|
-
return
|
|
75
|
+
return R(e.value, s.value) ? e : (s.value.rules?.length ?? 0) === 0 ? {
|
|
80
76
|
selectedRuleIndex: 0,
|
|
81
77
|
value: {
|
|
82
78
|
rules: [
|
|
@@ -97,43 +93,43 @@ function He(e, s) {
|
|
|
97
93
|
return e;
|
|
98
94
|
}
|
|
99
95
|
}
|
|
100
|
-
function
|
|
96
|
+
function Ke({
|
|
101
97
|
children: e,
|
|
102
98
|
initialValue: s
|
|
103
99
|
}) {
|
|
104
|
-
const [n, l] =
|
|
100
|
+
const [n, l] = Je(He, {
|
|
105
101
|
value: s.value,
|
|
106
102
|
renderOptions: {},
|
|
107
103
|
selectedRuleIndex: 0
|
|
108
|
-
}),
|
|
104
|
+
}), r = A(
|
|
109
105
|
(c, d, m = !1) => {
|
|
110
106
|
l({ type: "SET_PATH", path: c, value: d, allowNullValue: m });
|
|
111
107
|
},
|
|
112
108
|
[]
|
|
113
|
-
),
|
|
109
|
+
), o = A((c) => {
|
|
114
110
|
l({ type: "SET_SELECTED_RULE_INDEX", index: c }), c < 0 && setTimeout(() => {
|
|
115
111
|
l({ type: "SET_SELECTED_RULE_INDEX", index: 0 });
|
|
116
112
|
}, 50);
|
|
117
|
-
}, []),
|
|
113
|
+
}, []), a = A((c) => {
|
|
118
114
|
l({ type: "SET_VALUE", value: c });
|
|
119
|
-
}, []),
|
|
115
|
+
}, []), i = A((c, d) => {
|
|
120
116
|
l({ type: "SET_RENDER_OPTION", path: c, value: d });
|
|
121
117
|
}, []), u = ce(
|
|
122
118
|
() => ({
|
|
123
119
|
state: n,
|
|
124
|
-
setPath:
|
|
125
|
-
setSelectedRuleIndex:
|
|
126
|
-
setValue:
|
|
127
|
-
setRenderOption:
|
|
120
|
+
setPath: r,
|
|
121
|
+
setSelectedRuleIndex: o,
|
|
122
|
+
setValue: a,
|
|
123
|
+
setRenderOption: i,
|
|
128
124
|
schemaType: s.schemaType,
|
|
129
125
|
optionsConfig: s.optionsConfig
|
|
130
126
|
}),
|
|
131
127
|
[
|
|
132
128
|
n,
|
|
129
|
+
r,
|
|
133
130
|
o,
|
|
134
131
|
a,
|
|
135
132
|
i,
|
|
136
|
-
r,
|
|
137
133
|
s.schemaType,
|
|
138
134
|
s.optionsConfig
|
|
139
135
|
]
|
|
@@ -141,12 +137,48 @@ function Pe({
|
|
|
141
137
|
return /* @__PURE__ */ t.jsx(pe.Provider, { value: u, children: e });
|
|
142
138
|
}
|
|
143
139
|
function f() {
|
|
144
|
-
const e =
|
|
140
|
+
const e = We(pe);
|
|
145
141
|
if (e === void 0)
|
|
146
142
|
throw new Error("useRuleEngine must be used within a RuleEngineProvider");
|
|
147
143
|
return e;
|
|
148
144
|
}
|
|
149
|
-
const me =
|
|
145
|
+
const Qe = ({ children: e }) => /* @__PURE__ */ t.jsx("div", { className: "bg-white rounded-md p-4 shadow-xs flex flex-col gap-2 empty:hidden", children: e }), me = ({ children: e, dropdownItems: s, options: n, pathPrefix: l }) => {
|
|
146
|
+
const { state: r, setRenderOption: o } = f(), a = `${l}.isOpen`, i = U(r.renderOptions, a) ?? !0;
|
|
147
|
+
return /* @__PURE__ */ t.jsx("div", { className: "bg-gray-50 rounded-md flex items-center", children: /* @__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: [
|
|
148
|
+
/* @__PURE__ */ t.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
149
|
+
e,
|
|
150
|
+
/* @__PURE__ */ t.jsxs("div", { className: "border border-gray-200 rounded self-stretch flex", children: [
|
|
151
|
+
/* @__PURE__ */ t.jsx(
|
|
152
|
+
"button",
|
|
153
|
+
{
|
|
154
|
+
type: "button",
|
|
155
|
+
onClick: () => {
|
|
156
|
+
o(`${a}`, !i);
|
|
157
|
+
},
|
|
158
|
+
className: "w-11 flex self-stretch justify-center items-center",
|
|
159
|
+
children: /* @__PURE__ */ t.jsx(j, { name: i ? "caretUp" : "caretDown", size: 16 })
|
|
160
|
+
}
|
|
161
|
+
),
|
|
162
|
+
s != null && /* @__PURE__ */ t.jsx(
|
|
163
|
+
S,
|
|
164
|
+
{
|
|
165
|
+
className: "flex self-stretch border-gray-100 border-l",
|
|
166
|
+
dropdownLabel: /* @__PURE__ */ t.jsx(
|
|
167
|
+
"button",
|
|
168
|
+
{
|
|
169
|
+
type: "button",
|
|
170
|
+
className: "w-11 flex self-stretch justify-center items-center",
|
|
171
|
+
children: /* @__PURE__ */ t.jsx(j, { name: "dotsThreeVertical", size: 16, weight: "bold" })
|
|
172
|
+
}
|
|
173
|
+
),
|
|
174
|
+
dropdownItems: s
|
|
175
|
+
}
|
|
176
|
+
)
|
|
177
|
+
] })
|
|
178
|
+
] }),
|
|
179
|
+
i && /* @__PURE__ */ t.jsx(Qe, { children: n })
|
|
180
|
+
] }) }) });
|
|
181
|
+
}, fe = [
|
|
150
182
|
{
|
|
151
183
|
/** Matches if field value equals provided value
|
|
152
184
|
* @field Integer, String, Datetime, Boolean
|
|
@@ -448,16 +480,16 @@ const me = [
|
|
|
448
480
|
exactMatch: !0
|
|
449
481
|
}
|
|
450
482
|
];
|
|
451
|
-
function
|
|
483
|
+
function ge(e) {
|
|
452
484
|
if (typeof e == "string")
|
|
453
|
-
return L(
|
|
485
|
+
return L(Z(e)) ? "datetime" : "string";
|
|
454
486
|
if (typeof e == "number")
|
|
455
487
|
return "integer";
|
|
456
488
|
if (typeof e == "boolean")
|
|
457
489
|
return "boolean";
|
|
458
490
|
if (Array.isArray(e)) {
|
|
459
491
|
if (typeof e[0] == "string")
|
|
460
|
-
return L(
|
|
492
|
+
return L(Z(e[0])) ? "datetime" : "string";
|
|
461
493
|
if (typeof e[0] == "number")
|
|
462
494
|
return "integer";
|
|
463
495
|
}
|
|
@@ -467,91 +499,138 @@ const he = {
|
|
|
467
499
|
market: "markets",
|
|
468
500
|
tag: "tags",
|
|
469
501
|
sku: "skus",
|
|
470
|
-
sku_list: "sku_lists"
|
|
502
|
+
sku_list: "sku_lists",
|
|
503
|
+
bundle: "bundles"
|
|
471
504
|
};
|
|
472
505
|
function Ze(e) {
|
|
473
506
|
return he[e];
|
|
474
507
|
}
|
|
475
|
-
function
|
|
476
|
-
const [s, n] =
|
|
477
|
-
return
|
|
478
|
-
e?.field != null &&
|
|
479
|
-
const
|
|
480
|
-
(
|
|
508
|
+
function J(e) {
|
|
509
|
+
const [s, n] = v(void 0);
|
|
510
|
+
return T(() => {
|
|
511
|
+
e?.field != null && Ae(e.field).then((l) => {
|
|
512
|
+
const r = fe.find(
|
|
513
|
+
(o) => o.matcher === e.matcher
|
|
481
514
|
);
|
|
482
515
|
n({
|
|
483
516
|
...l,
|
|
484
|
-
matcherInfos:
|
|
485
|
-
resourceSelectorAvailable: l?.resource?.id != null && Object.keys(he).includes(l.resource.id) && l.path.endsWith(".id") &&
|
|
517
|
+
matcherInfos: r,
|
|
518
|
+
resourceSelectorAvailable: l?.resource?.id != null && Object.keys(he).includes(l.resource.id) && l.path.endsWith(".id") && r?.exactMatch === !0
|
|
486
519
|
});
|
|
487
520
|
}).catch((l) => {
|
|
488
521
|
console.error("Error fetching field info:", l);
|
|
489
522
|
});
|
|
490
523
|
}, [e?.field, e?.matcher]), { infos: s };
|
|
491
524
|
}
|
|
492
|
-
function
|
|
493
|
-
return e == null || e.length === 0 ? [] :
|
|
525
|
+
function be(e) {
|
|
526
|
+
return e == null || e.length === 0 ? [] : Me(
|
|
494
527
|
Ee(
|
|
495
528
|
e.flatMap((s) => [
|
|
496
529
|
s?.group,
|
|
497
|
-
...
|
|
530
|
+
...be(s?.nested?.conditions)
|
|
498
531
|
])
|
|
499
532
|
)
|
|
500
533
|
);
|
|
501
534
|
}
|
|
502
|
-
function
|
|
535
|
+
function xe() {
|
|
503
536
|
const {
|
|
504
537
|
state: { selectedRuleIndex: e, value: s }
|
|
505
538
|
} = f();
|
|
506
|
-
return
|
|
539
|
+
return be(
|
|
507
540
|
s.rules?.[e]?.conditions
|
|
508
541
|
);
|
|
509
542
|
}
|
|
510
|
-
const
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
543
|
+
const ve = ({
|
|
544
|
+
value: e,
|
|
545
|
+
resource: s,
|
|
546
|
+
isDisabled: n,
|
|
547
|
+
resourceKey: l,
|
|
548
|
+
onSelect: r,
|
|
549
|
+
isMulti: o = !1
|
|
550
|
+
}) => {
|
|
551
|
+
const { sdkClient: a } = Ie(), { data: i } = Y(s, "list", [G({ value: "" })]), { data: u, isLoading: c } = Y(
|
|
552
|
+
s,
|
|
553
|
+
"list",
|
|
554
|
+
[
|
|
555
|
+
{
|
|
556
|
+
...G({ value: "" }),
|
|
557
|
+
filters: {
|
|
558
|
+
id_in: Array.isArray(e) ? e : [e]
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
]
|
|
562
|
+
), d = ae([...u ?? [], ...i ?? []], "id");
|
|
563
|
+
function m(h) {
|
|
564
|
+
return {
|
|
565
|
+
label: d?.find((p) => p.id === h.toString())?.name ?? `${c ? "" : "⚠️ "}${h.toString()}`,
|
|
566
|
+
value: h.toString()
|
|
567
|
+
};
|
|
568
|
+
}
|
|
569
|
+
return /* @__PURE__ */ t.jsx(
|
|
570
|
+
x,
|
|
571
|
+
{
|
|
572
|
+
placeholder: "Search...",
|
|
573
|
+
isClearable: !1,
|
|
574
|
+
isDisabled: n,
|
|
575
|
+
isMulti: o,
|
|
576
|
+
defaultValue: Array.isArray(e) ? e.map(m) : e != null ? m(e) : void 0,
|
|
577
|
+
menuFooterText: i != null && i.meta.recordCount > 25 ? "Type to search for more options." : void 0,
|
|
578
|
+
initialValues: ee(d ?? [], l),
|
|
579
|
+
loadAsyncValues: async (h) => {
|
|
580
|
+
const p = await a[s].list(G({ value: h }));
|
|
581
|
+
return ee(p, l);
|
|
582
|
+
},
|
|
583
|
+
onSelect: (h) => {
|
|
584
|
+
r?.(h);
|
|
585
|
+
}
|
|
586
|
+
},
|
|
587
|
+
`${o ? "multi" : "single"}-${c}-${JSON.stringify(d)}`
|
|
588
|
+
);
|
|
589
|
+
};
|
|
590
|
+
function G({ value: e }) {
|
|
591
|
+
return {
|
|
592
|
+
pageSize: 25,
|
|
593
|
+
sort: {
|
|
594
|
+
name: "asc"
|
|
595
|
+
},
|
|
596
|
+
filters: {
|
|
597
|
+
name_cont: e
|
|
598
|
+
}
|
|
599
|
+
};
|
|
600
|
+
}
|
|
601
|
+
function ee(e, s) {
|
|
602
|
+
return e.map((n) => ({
|
|
603
|
+
label: n.name,
|
|
604
|
+
// @ts-expect-error TODO: fix this
|
|
605
|
+
value: n[s]
|
|
606
|
+
}));
|
|
607
|
+
}
|
|
608
|
+
const I = ({ children: e, label: s, className: n }) => /* @__PURE__ */ t.jsxs("div", { className: k("flex gap-4 first-of-type:mt-0", n), children: [
|
|
609
|
+
/* @__PURE__ */ t.jsx("div", { className: "basis-45 shrink-0 h-11 flex items-center", children: s }),
|
|
548
610
|
/* @__PURE__ */ t.jsx("div", { className: "grow flex flex-col gap-2", children: e })
|
|
549
|
-
] }),
|
|
611
|
+
] }), ye = {
|
|
550
612
|
actions: {
|
|
551
613
|
"order-rules": {
|
|
614
|
+
"": {
|
|
615
|
+
selector: !0,
|
|
616
|
+
quantity: !0,
|
|
617
|
+
identifiers: [
|
|
618
|
+
{ label: "SKU", value: "order.line_items.sku.id" },
|
|
619
|
+
{ label: "Bundle", value: "order.line_items.bundle.id" },
|
|
620
|
+
{ label: "SKU list", value: "order.line_items.sku.sku_lists.id" }
|
|
621
|
+
]
|
|
622
|
+
},
|
|
552
623
|
order: {
|
|
624
|
+
selector: !0,
|
|
625
|
+
groups: !0,
|
|
553
626
|
round: !0,
|
|
627
|
+
quantity: !0,
|
|
554
628
|
discount_mode: !0,
|
|
629
|
+
identifiers: [
|
|
630
|
+
{ label: "SKU", value: "order.line_items.sku.id" },
|
|
631
|
+
{ label: "Bundle", value: "order.line_items.bundle.id" },
|
|
632
|
+
{ label: "SKU list", value: "order.line_items.sku.sku_lists.id" }
|
|
633
|
+
],
|
|
555
634
|
apply_on: [
|
|
556
635
|
{ label: "Subtotal amount", value: "subtotal_amount_cents" },
|
|
557
636
|
{ label: "Total amount", value: "total_amount_cents" }
|
|
@@ -594,7 +673,10 @@ const Qe = ({ children: e }) => /* @__PURE__ */ t.jsx("div", { className: "bg-wh
|
|
|
594
673
|
]
|
|
595
674
|
},
|
|
596
675
|
"order.line_items": {
|
|
676
|
+
selector: !0,
|
|
677
|
+
groups: !0,
|
|
597
678
|
round: !0,
|
|
679
|
+
quantity: !0,
|
|
598
680
|
discount_mode: !0,
|
|
599
681
|
apply_on: [
|
|
600
682
|
{ label: "Unit amount", value: "unit_amount_cents" },
|
|
@@ -637,16 +719,42 @@ const Qe = ({ children: e }) => /* @__PURE__ */ t.jsx("div", { className: "bg-wh
|
|
|
637
719
|
}
|
|
638
720
|
]
|
|
639
721
|
},
|
|
640
|
-
"order.line_items.line_item_options": {
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
"order.line_items.
|
|
645
|
-
|
|
646
|
-
|
|
722
|
+
"order.line_items.line_item_options": {
|
|
723
|
+
selector: !0,
|
|
724
|
+
groups: !0
|
|
725
|
+
},
|
|
726
|
+
"order.line_items.sku": {
|
|
727
|
+
selector: !0,
|
|
728
|
+
groups: !0
|
|
729
|
+
},
|
|
730
|
+
"order.line_items.bundle": {
|
|
731
|
+
selector: !0,
|
|
732
|
+
groups: !0
|
|
733
|
+
},
|
|
734
|
+
"order.line_items.shipment": {
|
|
735
|
+
selector: !0,
|
|
736
|
+
groups: !0
|
|
737
|
+
},
|
|
738
|
+
"order.line_items.payment_method": {
|
|
739
|
+
selector: !0,
|
|
740
|
+
groups: !0
|
|
741
|
+
},
|
|
742
|
+
"order.line_items.adjustment": {
|
|
743
|
+
selector: !0,
|
|
744
|
+
groups: !0
|
|
745
|
+
},
|
|
746
|
+
"order.line_items.gift_card": {
|
|
747
|
+
selector: !0,
|
|
748
|
+
groups: !0
|
|
749
|
+
}
|
|
647
750
|
},
|
|
648
751
|
"price-rules": {
|
|
752
|
+
"": {
|
|
753
|
+
selector: !0
|
|
754
|
+
},
|
|
649
755
|
price: {
|
|
756
|
+
selector: !0,
|
|
757
|
+
groups: !0,
|
|
650
758
|
apply_on: [
|
|
651
759
|
{ label: "Amount", value: "amount_cents" },
|
|
652
760
|
{ label: "Compare at amount", value: "compare_at_amount_cents" }
|
|
@@ -682,14 +790,20 @@ const Qe = ({ children: e }) => /* @__PURE__ */ t.jsx("div", { className: "bg-wh
|
|
|
682
790
|
scope: !0
|
|
683
791
|
}
|
|
684
792
|
}
|
|
685
|
-
},
|
|
793
|
+
}, Pe = [
|
|
794
|
+
"selector",
|
|
795
|
+
"groups",
|
|
686
796
|
"apply_on",
|
|
687
797
|
"round",
|
|
688
798
|
"limit",
|
|
689
799
|
"discount_mode",
|
|
690
800
|
"aggregation",
|
|
691
|
-
"bundle"
|
|
692
|
-
|
|
801
|
+
"bundle",
|
|
802
|
+
"quantity",
|
|
803
|
+
"identifiers"
|
|
804
|
+
], et = ["group", "scope", "aggregations"], je = {
|
|
805
|
+
selector: "Apply to",
|
|
806
|
+
groups: "Groups",
|
|
693
807
|
apply_on: "Apply on",
|
|
694
808
|
round: "Round",
|
|
695
809
|
limit: "Limit",
|
|
@@ -698,7 +812,9 @@ const Qe = ({ children: e }) => /* @__PURE__ */ t.jsx("div", { className: "bg-wh
|
|
|
698
812
|
bundle: "Bundle",
|
|
699
813
|
scope: "Scope",
|
|
700
814
|
aggregations: "Aggregations",
|
|
701
|
-
group: "Group"
|
|
815
|
+
group: "Group",
|
|
816
|
+
quantity: "Quantity",
|
|
817
|
+
identifiers: "Identifiers"
|
|
702
818
|
};
|
|
703
819
|
function tt(e, s) {
|
|
704
820
|
if (e == null || typeof e != "object")
|
|
@@ -715,18 +831,18 @@ function tt(e, s) {
|
|
|
715
831
|
function nt(e, s) {
|
|
716
832
|
const n = {};
|
|
717
833
|
try {
|
|
718
|
-
const l = e?.properties?.rules?.items?.properties?.actions?.items?.anyOf ?? [],
|
|
719
|
-
for (const [
|
|
720
|
-
const
|
|
721
|
-
n[
|
|
834
|
+
const l = e?.properties?.rules?.items?.properties?.actions?.items?.anyOf ?? [], r = lt(l);
|
|
835
|
+
for (const [o, a] of r.entries()) {
|
|
836
|
+
const i = _e(a, Pe), u = $e(i, a, e), c = ye.actions[s], d = Object.keys(c);
|
|
837
|
+
n[o] = {};
|
|
722
838
|
for (const m of d) {
|
|
723
839
|
const h = c[m];
|
|
724
|
-
h != null && (n[
|
|
725
|
-
const
|
|
840
|
+
h != null && (n[o][m] = u.filter((p) => h[p.name] != null).map((p) => {
|
|
841
|
+
const g = h[p.name];
|
|
726
842
|
return {
|
|
727
843
|
...p,
|
|
728
844
|
// Configuration values override schema-derived values
|
|
729
|
-
values: Array.isArray(
|
|
845
|
+
values: Array.isArray(g) ? g : p.values
|
|
730
846
|
};
|
|
731
847
|
}));
|
|
732
848
|
}
|
|
@@ -738,16 +854,18 @@ function nt(e, s) {
|
|
|
738
854
|
}
|
|
739
855
|
function st(e, s) {
|
|
740
856
|
try {
|
|
741
|
-
const n = e?.$defs?.conditions?.items?.anyOf ?? [], l =
|
|
857
|
+
const n = e?.$defs?.conditions?.items?.anyOf ?? [], l = _e(
|
|
742
858
|
n,
|
|
743
859
|
et
|
|
744
|
-
),
|
|
745
|
-
return
|
|
746
|
-
const
|
|
860
|
+
), r = $e(l, n, e), o = ye.conditions[s];
|
|
861
|
+
return r.filter((a) => o[a.name] != null).map((a) => {
|
|
862
|
+
const i = o[a.name];
|
|
747
863
|
return {
|
|
748
|
-
...
|
|
864
|
+
...a,
|
|
749
865
|
// Configuration values override schema-derived values
|
|
750
|
-
values: Array.isArray(
|
|
866
|
+
values: Array.isArray(i) ? i : a.values,
|
|
867
|
+
// Conditions are never required (only actions can be required)
|
|
868
|
+
required: !1
|
|
751
869
|
};
|
|
752
870
|
});
|
|
753
871
|
} catch (n) {
|
|
@@ -762,47 +880,48 @@ function lt(e) {
|
|
|
762
880
|
}
|
|
763
881
|
return s;
|
|
764
882
|
}
|
|
765
|
-
function
|
|
883
|
+
function _e(e, s) {
|
|
766
884
|
const n = /* @__PURE__ */ new Map();
|
|
767
|
-
return e.forEach((l,
|
|
768
|
-
const
|
|
769
|
-
for (const
|
|
770
|
-
s.includes(
|
|
885
|
+
return e.forEach((l, r) => {
|
|
886
|
+
const o = Object.keys(l.properties ?? {}), a = new Set(l.required ?? []);
|
|
887
|
+
for (const i of o)
|
|
888
|
+
s.includes(i) && (n.has(i) || n.set(i, {
|
|
771
889
|
appearsIn: /* @__PURE__ */ new Set(),
|
|
772
890
|
requiredIn: /* @__PURE__ */ new Set()
|
|
773
|
-
}), n.get(
|
|
891
|
+
}), n.get(i)?.appearsIn.add(r), a.has(i) && n.get(i)?.requiredIn.add(r));
|
|
774
892
|
}), n;
|
|
775
893
|
}
|
|
776
|
-
function
|
|
894
|
+
function $e(e, s, n) {
|
|
777
895
|
const l = [];
|
|
778
|
-
for (const [
|
|
896
|
+
for (const [r, { appearsIn: o, requiredIn: a }] of e.entries()) {
|
|
779
897
|
const i = at(
|
|
898
|
+
r,
|
|
780
899
|
o,
|
|
781
|
-
a,
|
|
782
900
|
e
|
|
783
901
|
);
|
|
784
|
-
let
|
|
785
|
-
for (const
|
|
786
|
-
const
|
|
787
|
-
if (
|
|
902
|
+
let u = {};
|
|
903
|
+
for (const c of s) {
|
|
904
|
+
const d = c.properties?.[r];
|
|
905
|
+
if (u = rt(d, n), u.values != null || u.valueType != null || u.description != null)
|
|
788
906
|
break;
|
|
789
907
|
}
|
|
790
908
|
l.push({
|
|
791
|
-
name:
|
|
792
|
-
label:
|
|
909
|
+
name: r,
|
|
910
|
+
label: je[r],
|
|
793
911
|
mutuallyExclusiveWith: i,
|
|
794
|
-
|
|
912
|
+
required: a.size > 0,
|
|
913
|
+
...u
|
|
795
914
|
});
|
|
796
915
|
}
|
|
797
916
|
return l;
|
|
798
917
|
}
|
|
799
918
|
function at(e, s, n) {
|
|
800
919
|
const l = [];
|
|
801
|
-
for (const [
|
|
802
|
-
if (
|
|
920
|
+
for (const [r, { appearsIn: o }] of n) {
|
|
921
|
+
if (r === e) continue;
|
|
803
922
|
new Set(
|
|
804
|
-
[...s].filter((
|
|
805
|
-
).size === 0 && s.size > 0 && l.push(
|
|
923
|
+
[...s].filter((i) => o.has(i))
|
|
924
|
+
).size === 0 && s.size > 0 && l.push(r);
|
|
806
925
|
}
|
|
807
926
|
return l;
|
|
808
927
|
}
|
|
@@ -810,156 +929,360 @@ function rt(e, s) {
|
|
|
810
929
|
const n = {};
|
|
811
930
|
let l = e;
|
|
812
931
|
if (e?.$ref != null && typeof e.$ref == "string") {
|
|
813
|
-
const
|
|
814
|
-
let
|
|
815
|
-
for (const
|
|
816
|
-
|
|
817
|
-
l =
|
|
932
|
+
const r = e.$ref.replace(/^#\//, "").split("/");
|
|
933
|
+
let o = s;
|
|
934
|
+
for (const a of r)
|
|
935
|
+
o = o?.[a];
|
|
936
|
+
l = o;
|
|
818
937
|
}
|
|
819
|
-
return l?.enum != null && Array.isArray(l.enum) && (n.values = l.enum.map((
|
|
820
|
-
label:
|
|
821
|
-
value:
|
|
938
|
+
return l?.enum != null && Array.isArray(l.enum) && (n.values = l.enum.map((r) => ({
|
|
939
|
+
label: r.charAt(0).toUpperCase() + r.slice(1),
|
|
940
|
+
value: r
|
|
822
941
|
}))), l?.type != null && (n.valueType = l.type), l?.description != null && typeof l.description == "string" && (n.description = l.description), n;
|
|
823
942
|
}
|
|
824
|
-
function
|
|
943
|
+
function Ne(e, s) {
|
|
825
944
|
if (e == null)
|
|
826
945
|
return {
|
|
827
946
|
available: [],
|
|
828
947
|
disabled: [],
|
|
829
|
-
current: []
|
|
948
|
+
current: [],
|
|
949
|
+
required: []
|
|
830
950
|
};
|
|
831
951
|
const n = s.map((a) => a.name).filter((a) => {
|
|
832
|
-
const i = a in e && e[a] !== void 0,
|
|
833
|
-
return Array.isArray(e[a]) ?
|
|
834
|
-
}), l =
|
|
952
|
+
const i = a in e && e[a] !== void 0, u = Array.isArray(e[a]) && e[a].length > 0;
|
|
953
|
+
return Array.isArray(e[a]) ? u : i;
|
|
954
|
+
}), l = s.filter(
|
|
955
|
+
(a) => a.required === !0 && !n.includes(a.name)
|
|
956
|
+
), r = [], o = [];
|
|
835
957
|
for (const a of s) {
|
|
836
|
-
if (n.includes(a.name))
|
|
958
|
+
if (n.includes(a.name) || a.required)
|
|
837
959
|
continue;
|
|
838
960
|
a.mutuallyExclusiveWith.some(
|
|
839
|
-
(
|
|
840
|
-
) ? o.push(a) :
|
|
961
|
+
(u) => n.includes(u)
|
|
962
|
+
) ? o.push(a) : r.push(a);
|
|
841
963
|
}
|
|
842
964
|
return {
|
|
843
|
-
available:
|
|
965
|
+
available: r,
|
|
844
966
|
disabled: o,
|
|
845
|
-
current: n
|
|
967
|
+
current: n,
|
|
968
|
+
required: l
|
|
846
969
|
};
|
|
847
970
|
}
|
|
848
|
-
function
|
|
971
|
+
function N({
|
|
972
|
+
item: e,
|
|
973
|
+
optionName: s,
|
|
974
|
+
pathPrefix: n
|
|
975
|
+
}) {
|
|
976
|
+
const { setPath: l, optionsConfig: r, schemaType: o } = f(), a = o === "order-rules" ? "order" : o === "price-rules" ? "price" : void 0, i = e != null && "selector" in e ? e.selector : "", u = "type" in e ? r.actions[e.type]?.[i]?.find((d) => d.name === s) : r.conditions.find((d) => d.name === s), c = A(
|
|
977
|
+
({ children: d }) => {
|
|
978
|
+
const m = u?.label ?? je[s];
|
|
979
|
+
return u?.required === !0 ? /* @__PURE__ */ t.jsx(
|
|
980
|
+
I,
|
|
981
|
+
{
|
|
982
|
+
label: /* @__PURE__ */ t.jsx(
|
|
983
|
+
C,
|
|
984
|
+
{
|
|
985
|
+
variant: "info",
|
|
986
|
+
size: "small",
|
|
987
|
+
className: "flex gap-2 items-center",
|
|
988
|
+
children: m
|
|
989
|
+
}
|
|
990
|
+
),
|
|
991
|
+
children: d
|
|
992
|
+
}
|
|
993
|
+
) : /* @__PURE__ */ t.jsx(
|
|
994
|
+
I,
|
|
995
|
+
{
|
|
996
|
+
label: /* @__PURE__ */ t.jsx(
|
|
997
|
+
S,
|
|
998
|
+
{
|
|
999
|
+
className: "inline-flex",
|
|
1000
|
+
menuPosition: "bottom-left",
|
|
1001
|
+
dropdownItems: [
|
|
1002
|
+
/* @__PURE__ */ t.jsx(
|
|
1003
|
+
$,
|
|
1004
|
+
{
|
|
1005
|
+
onClick: () => {
|
|
1006
|
+
l(`${n}.${s}`, null);
|
|
1007
|
+
},
|
|
1008
|
+
label: "Remove",
|
|
1009
|
+
disabled: u?.required === !0
|
|
1010
|
+
},
|
|
1011
|
+
"remove"
|
|
1012
|
+
)
|
|
1013
|
+
],
|
|
1014
|
+
dropdownLabel: /* @__PURE__ */ t.jsx("button", { type: "button", children: /* @__PURE__ */ t.jsxs(
|
|
1015
|
+
C,
|
|
1016
|
+
{
|
|
1017
|
+
variant: "info",
|
|
1018
|
+
size: "small",
|
|
1019
|
+
className: "flex gap-2 items-center",
|
|
1020
|
+
children: [
|
|
1021
|
+
m,
|
|
1022
|
+
/* @__PURE__ */ t.jsx(j, { name: "caretDown" })
|
|
1023
|
+
]
|
|
1024
|
+
}
|
|
1025
|
+
) })
|
|
1026
|
+
}
|
|
1027
|
+
),
|
|
1028
|
+
children: d
|
|
1029
|
+
}
|
|
1030
|
+
);
|
|
1031
|
+
},
|
|
1032
|
+
[n, s, u, l]
|
|
1033
|
+
);
|
|
1034
|
+
return !(s in e) && u == null || // (!(optionName in item) && optionConfig?.required === false) ||
|
|
1035
|
+
a == null ? null : {
|
|
1036
|
+
optionConfig: u,
|
|
1037
|
+
mainResourceId: a,
|
|
1038
|
+
OptionRow: c
|
|
1039
|
+
};
|
|
1040
|
+
}
|
|
1041
|
+
function we({
|
|
1042
|
+
aggregation: e,
|
|
1043
|
+
pathPrefix: s,
|
|
1044
|
+
optionConfig: n
|
|
1045
|
+
}) {
|
|
1046
|
+
const { setPath: l } = f(), r = n?.values?.find(
|
|
1047
|
+
(a) => R(e.field, a.meta?.field) && R(e.operator, a.meta?.operator)
|
|
1048
|
+
), o = [
|
|
1049
|
+
{ label: "=", value: "eq" },
|
|
1050
|
+
{ label: ">", value: "gt" },
|
|
1051
|
+
{ label: "<", value: "lt" },
|
|
1052
|
+
{ label: ">=", value: "gteq" },
|
|
1053
|
+
{ label: "<=", value: "lteq" },
|
|
1054
|
+
{ label: "≠", value: "not_eq" },
|
|
1055
|
+
{ label: "multiple", value: "multiple" }
|
|
1056
|
+
];
|
|
1057
|
+
return /* @__PURE__ */ t.jsxs("div", { className: "flex gap-2 grow", children: [
|
|
1058
|
+
/* @__PURE__ */ t.jsx(
|
|
1059
|
+
x,
|
|
1060
|
+
{
|
|
1061
|
+
className: "grow",
|
|
1062
|
+
defaultValue: r ?? (e.field == null || e.operator == null ? void 0 : {
|
|
1063
|
+
label: `${e.field} ${e.operator.toUpperCase()}`,
|
|
1064
|
+
value: JSON.stringify({
|
|
1065
|
+
field: e.field,
|
|
1066
|
+
operation: e.operator
|
|
1067
|
+
}),
|
|
1068
|
+
meta: {
|
|
1069
|
+
field: e.field,
|
|
1070
|
+
operation: e.operator
|
|
1071
|
+
}
|
|
1072
|
+
}),
|
|
1073
|
+
initialValues: n?.values?.map((a) => ({
|
|
1074
|
+
label: a.label,
|
|
1075
|
+
meta: a.meta,
|
|
1076
|
+
value: JSON.stringify(a.meta)
|
|
1077
|
+
})) ?? [],
|
|
1078
|
+
onSelect: (a) => {
|
|
1079
|
+
_(a) && (l(`${s}.field`, a.meta?.field), l(`${s}.operator`, a.meta?.operator));
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
),
|
|
1083
|
+
/* @__PURE__ */ t.jsx(
|
|
1084
|
+
x,
|
|
1085
|
+
{
|
|
1086
|
+
className: "w-34",
|
|
1087
|
+
defaultValue: e.matcher != null ? {
|
|
1088
|
+
label: o.find((a) => a.value === e.matcher)?.label ?? e.matcher,
|
|
1089
|
+
value: e.matcher
|
|
1090
|
+
} : void 0,
|
|
1091
|
+
initialValues: o,
|
|
1092
|
+
onSelect: (a) => {
|
|
1093
|
+
_(a) && l(`${s}.matcher`, a.value);
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
),
|
|
1097
|
+
/* @__PURE__ */ t.jsx(
|
|
1098
|
+
y,
|
|
1099
|
+
{
|
|
1100
|
+
type: "number",
|
|
1101
|
+
className: "basis-20",
|
|
1102
|
+
placeholder: "0",
|
|
1103
|
+
onChange: (a) => {
|
|
1104
|
+
const i = parseInt(a.currentTarget.value, 10);
|
|
1105
|
+
l(`${s}.value`, i);
|
|
1106
|
+
},
|
|
1107
|
+
defaultValue: e.value
|
|
1108
|
+
}
|
|
1109
|
+
)
|
|
1110
|
+
] });
|
|
1111
|
+
}
|
|
1112
|
+
function ot({
|
|
849
1113
|
item: e,
|
|
850
1114
|
pathPrefix: s
|
|
851
1115
|
}) {
|
|
852
1116
|
return e == null ? null : /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
853
|
-
/* @__PURE__ */ t.jsx(
|
|
1117
|
+
/* @__PURE__ */ t.jsx(it, { item: e, pathPrefix: s }),
|
|
1118
|
+
/* @__PURE__ */ t.jsx(ut, { item: e, pathPrefix: s }),
|
|
1119
|
+
/* @__PURE__ */ t.jsx(bt, { item: e, pathPrefix: s }),
|
|
1120
|
+
/* @__PURE__ */ t.jsx(dt, { item: e, pathPrefix: s }),
|
|
854
1121
|
/* @__PURE__ */ t.jsx(ht, { item: e, pathPrefix: s }),
|
|
1122
|
+
/* @__PURE__ */ t.jsx(gt, { item: e, pathPrefix: s }),
|
|
855
1123
|
/* @__PURE__ */ t.jsx(mt, { item: e, pathPrefix: s }),
|
|
856
|
-
/* @__PURE__ */ t.jsx(ct, { item: e, pathPrefix: s }),
|
|
857
|
-
/* @__PURE__ */ t.jsx(dt, { item: e, pathPrefix: s }),
|
|
858
|
-
/* @__PURE__ */ t.jsx(ut, { item: e, pathPrefix: s }),
|
|
859
1124
|
/* @__PURE__ */ t.jsx(pt, { item: e, pathPrefix: s }),
|
|
860
|
-
/* @__PURE__ */ t.jsx(
|
|
861
|
-
/* @__PURE__ */ t.jsx(
|
|
1125
|
+
/* @__PURE__ */ t.jsx(ft, { item: e, pathPrefix: s }),
|
|
1126
|
+
/* @__PURE__ */ t.jsx(ct, { item: e, pathPrefix: s })
|
|
862
1127
|
] });
|
|
863
1128
|
}
|
|
864
|
-
function
|
|
1129
|
+
function it({
|
|
865
1130
|
item: e,
|
|
866
1131
|
pathPrefix: s
|
|
867
1132
|
}) {
|
|
868
|
-
const n = "
|
|
869
|
-
|
|
870
|
-
|
|
1133
|
+
const n = "selector", { setPath: l, schemaType: r } = f(), { t: o } = re(), a = N({ item: e, optionName: n, pathPrefix: s });
|
|
1134
|
+
if (!(n in e) || a == null)
|
|
1135
|
+
return null;
|
|
1136
|
+
const i = xt[r].map((d) => ({
|
|
1137
|
+
value: d,
|
|
1138
|
+
label: o(`resource_paths.${d}`).replace(
|
|
1139
|
+
"resource_paths.",
|
|
1140
|
+
""
|
|
1141
|
+
)
|
|
1142
|
+
})), u = `${s}.${n}`, c = n in e ? e?.selector == null ? void 0 : i.find((d) => d.value === e.selector) ?? {
|
|
1143
|
+
value: e.selector,
|
|
1144
|
+
label: e.selector
|
|
1145
|
+
} : void 0;
|
|
1146
|
+
return /* @__PURE__ */ t.jsx(a.OptionRow, { children: /* @__PURE__ */ t.jsx(
|
|
1147
|
+
x,
|
|
871
1148
|
{
|
|
872
|
-
name:
|
|
873
|
-
|
|
874
|
-
initialValues:
|
|
875
|
-
|
|
876
|
-
|
|
1149
|
+
name: u,
|
|
1150
|
+
isSearchable: !1,
|
|
1151
|
+
initialValues: i,
|
|
1152
|
+
value: c,
|
|
1153
|
+
onSelect: async (d) => {
|
|
1154
|
+
_(d) && (l(u, d.value), l(`${s}.apply_on`, null));
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
) });
|
|
1158
|
+
}
|
|
1159
|
+
function ut({
|
|
1160
|
+
item: e,
|
|
1161
|
+
pathPrefix: s
|
|
1162
|
+
}) {
|
|
1163
|
+
const n = "groups", { setPath: l, schemaType: r } = f(), o = xe(), a = N({ item: e, optionName: n, pathPrefix: s });
|
|
1164
|
+
if (!(n in e) || a == null || o.length <= 0 && ("groups" in e && e.groups != null ? e.groups : []).length <= 0)
|
|
1165
|
+
return null;
|
|
1166
|
+
const i = "groups" in e ? e?.groups?.map((u) => ({
|
|
1167
|
+
label: o.includes(u) ? u : `⚠️ ${u}`,
|
|
1168
|
+
value: u
|
|
1169
|
+
})) : void 0;
|
|
1170
|
+
return /* @__PURE__ */ t.jsx(a.OptionRow, { children: /* @__PURE__ */ t.jsx(
|
|
1171
|
+
x,
|
|
1172
|
+
{
|
|
1173
|
+
name: `${s}.groups`,
|
|
1174
|
+
isMulti: !0,
|
|
1175
|
+
isClearable: !1,
|
|
1176
|
+
value: i,
|
|
1177
|
+
initialValues: o.map((u) => ({
|
|
1178
|
+
value: u,
|
|
1179
|
+
label: u
|
|
877
1180
|
})),
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
},
|
|
885
|
-
placeholder: "Select or create group…"
|
|
1181
|
+
onSelect: (u) => {
|
|
1182
|
+
E(u) && (l(
|
|
1183
|
+
`${s}.groups`,
|
|
1184
|
+
u.map((c) => c.value)
|
|
1185
|
+
), r === "order-rules" && u.length > 0 && l(`${s}.selector`, "order.line_items"));
|
|
1186
|
+
}
|
|
886
1187
|
}
|
|
887
1188
|
) });
|
|
888
1189
|
}
|
|
889
|
-
function
|
|
1190
|
+
function ct({
|
|
890
1191
|
item: e,
|
|
891
1192
|
pathPrefix: s
|
|
892
1193
|
}) {
|
|
893
|
-
const n = "round", { setPath: l } = f(),
|
|
894
|
-
if (!(n in e) ||
|
|
1194
|
+
const n = "round", { setPath: l } = f(), r = N({ item: e, optionName: n, pathPrefix: s });
|
|
1195
|
+
if (!(n in e) || r == null)
|
|
895
1196
|
return null;
|
|
896
|
-
const
|
|
1197
|
+
const o = [
|
|
897
1198
|
{ label: "Yes", value: !0 },
|
|
898
1199
|
{ label: "No", value: !1 }
|
|
899
|
-
],
|
|
900
|
-
return /* @__PURE__ */ t.jsx(
|
|
901
|
-
|
|
1200
|
+
], a = o.find((i) => i.value === e[n]);
|
|
1201
|
+
return /* @__PURE__ */ t.jsx(r.OptionRow, { children: /* @__PURE__ */ t.jsx(
|
|
1202
|
+
x,
|
|
902
1203
|
{
|
|
903
1204
|
name: `${s}.${n}`,
|
|
904
1205
|
isSearchable: !1,
|
|
905
|
-
defaultValue:
|
|
906
|
-
initialValues:
|
|
907
|
-
onSelect: (
|
|
908
|
-
|
|
1206
|
+
defaultValue: a,
|
|
1207
|
+
initialValues: o,
|
|
1208
|
+
onSelect: (i) => {
|
|
1209
|
+
_(i) && l(`${s}.${n}`, i.value);
|
|
909
1210
|
}
|
|
910
1211
|
}
|
|
911
1212
|
) });
|
|
912
1213
|
}
|
|
913
|
-
function
|
|
1214
|
+
function dt({
|
|
914
1215
|
item: e,
|
|
915
1216
|
pathPrefix: s
|
|
916
1217
|
}) {
|
|
917
|
-
const n = "
|
|
918
|
-
if (!(n in e) ||
|
|
1218
|
+
const n = "quantity", { setPath: l } = f(), r = N({ item: e, optionName: n, pathPrefix: s });
|
|
1219
|
+
if (!(n in e) || r == null)
|
|
919
1220
|
return null;
|
|
920
|
-
const
|
|
921
|
-
|
|
1221
|
+
const o = e[n];
|
|
1222
|
+
return /* @__PURE__ */ t.jsx(r.OptionRow, { children: /* @__PURE__ */ t.jsx(
|
|
1223
|
+
y,
|
|
1224
|
+
{
|
|
1225
|
+
type: "number",
|
|
1226
|
+
name: `${s}.${n}`,
|
|
1227
|
+
defaultValue: o,
|
|
1228
|
+
min: 1,
|
|
1229
|
+
onChange: (a) => {
|
|
1230
|
+
const i = parseInt(a.currentTarget.value, 10);
|
|
1231
|
+
l(`${s}.${n}`, i);
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
) });
|
|
1235
|
+
}
|
|
1236
|
+
function pt({
|
|
1237
|
+
item: e,
|
|
1238
|
+
pathPrefix: s
|
|
1239
|
+
}) {
|
|
1240
|
+
const n = "limit", { setPath: l } = f(), r = N({ item: e, optionName: n, pathPrefix: s });
|
|
1241
|
+
if (!(n in e) || r == null)
|
|
1242
|
+
return null;
|
|
1243
|
+
const o = r.optionConfig?.values?.find(
|
|
1244
|
+
(a) => R(e.limit?.sort, a.meta)
|
|
922
1245
|
);
|
|
923
|
-
return /* @__PURE__ */ t.jsx(
|
|
1246
|
+
return /* @__PURE__ */ t.jsx(r.OptionRow, { children: /* @__PURE__ */ t.jsxs("div", { className: "flex gap-2", children: [
|
|
924
1247
|
/* @__PURE__ */ t.jsx(
|
|
925
|
-
|
|
1248
|
+
y,
|
|
926
1249
|
{
|
|
927
1250
|
type: "number",
|
|
928
1251
|
className: "basis-20",
|
|
929
1252
|
placeholder: "1",
|
|
930
|
-
onChange: (
|
|
931
|
-
const
|
|
932
|
-
l(`${s}.${n}.value`,
|
|
1253
|
+
onChange: (a) => {
|
|
1254
|
+
const i = parseInt(a.currentTarget.value, 10);
|
|
1255
|
+
l(`${s}.${n}.value`, i);
|
|
933
1256
|
},
|
|
934
1257
|
defaultValue: e.limit?.value
|
|
935
1258
|
}
|
|
936
1259
|
),
|
|
937
1260
|
/* @__PURE__ */ t.jsx(
|
|
938
|
-
|
|
1261
|
+
x,
|
|
939
1262
|
{
|
|
940
1263
|
className: "grow",
|
|
941
|
-
defaultValue:
|
|
1264
|
+
defaultValue: o ?? (e.limit?.sort == null ? void 0 : {
|
|
942
1265
|
label: e.limit.sort.attribute != null && e.limit.sort.direction ? `${e.limit.sort.attribute} ${e.limit.sort.direction.toUpperCase()}` : "",
|
|
943
1266
|
value: JSON.stringify(e.limit.sort),
|
|
944
1267
|
meta: e.limit.sort
|
|
945
1268
|
}),
|
|
946
|
-
initialValues:
|
|
947
|
-
label:
|
|
948
|
-
meta:
|
|
949
|
-
value: JSON.stringify(
|
|
1269
|
+
initialValues: r.optionConfig?.values?.map((a) => ({
|
|
1270
|
+
label: a.label,
|
|
1271
|
+
meta: a.meta,
|
|
1272
|
+
value: JSON.stringify(a.meta)
|
|
950
1273
|
})) ?? [],
|
|
951
|
-
onSelect: (
|
|
952
|
-
|
|
1274
|
+
onSelect: (a) => {
|
|
1275
|
+
_(a) && l(`${s}.${n}.sort`, a.meta);
|
|
953
1276
|
}
|
|
954
1277
|
}
|
|
955
1278
|
)
|
|
956
1279
|
] }) });
|
|
957
1280
|
}
|
|
958
|
-
function
|
|
1281
|
+
function mt({
|
|
959
1282
|
item: e,
|
|
960
1283
|
pathPrefix: s
|
|
961
1284
|
}) {
|
|
962
|
-
const n = "aggregation", l =
|
|
1285
|
+
const n = "aggregation", l = N({ item: e, optionName: n, pathPrefix: s });
|
|
963
1286
|
return !(n in e) || l == null || e[n] == null ? null : /* @__PURE__ */ t.jsx(l.OptionRow, { children: /* @__PURE__ */ t.jsx(
|
|
964
1287
|
we,
|
|
965
1288
|
{
|
|
@@ -969,90 +1292,215 @@ function ct({
|
|
|
969
1292
|
}
|
|
970
1293
|
) });
|
|
971
1294
|
}
|
|
972
|
-
function
|
|
973
|
-
|
|
974
|
-
pathPrefix: s
|
|
975
|
-
optionConfig: n
|
|
1295
|
+
function ft({
|
|
1296
|
+
item: e,
|
|
1297
|
+
pathPrefix: s
|
|
976
1298
|
}) {
|
|
977
|
-
const { setPath: l } = f(),
|
|
978
|
-
|
|
1299
|
+
const n = "bundle", { setPath: l } = f(), r = N({ item: e, optionName: n, pathPrefix: s });
|
|
1300
|
+
if (!(n in e) || r == null)
|
|
1301
|
+
return null;
|
|
1302
|
+
const o = r.optionConfig?.values?.find(
|
|
1303
|
+
(i) => R(e.bundle?.sort, i.meta)
|
|
979
1304
|
), a = [
|
|
980
|
-
{ label: "
|
|
981
|
-
{ label: "
|
|
982
|
-
{ label: "<", value: "lt" },
|
|
983
|
-
{ label: ">=", value: "gteq" },
|
|
984
|
-
{ label: "<=", value: "lteq" },
|
|
985
|
-
{ label: "≠", value: "not_eq" },
|
|
986
|
-
{ label: "multiple", value: "multiple" }
|
|
1305
|
+
{ label: "Balanced", value: "balanced" },
|
|
1306
|
+
{ label: "Every", value: "every" }
|
|
987
1307
|
];
|
|
988
|
-
return /* @__PURE__ */ t.jsxs("div", { className: "flex gap-2
|
|
989
|
-
/* @__PURE__ */ t.jsx(
|
|
990
|
-
g,
|
|
991
|
-
{
|
|
992
|
-
className: "grow",
|
|
993
|
-
defaultValue: o ?? (e.field == null || e.operator == null ? void 0 : {
|
|
994
|
-
label: `${e.field} ${e.operator.toUpperCase()}`,
|
|
995
|
-
value: JSON.stringify({
|
|
996
|
-
field: e.field,
|
|
997
|
-
operation: e.operator
|
|
998
|
-
}),
|
|
999
|
-
meta: {
|
|
1000
|
-
field: e.field,
|
|
1001
|
-
operation: e.operator
|
|
1002
|
-
}
|
|
1003
|
-
}),
|
|
1004
|
-
initialValues: n?.values?.map((i) => ({
|
|
1005
|
-
label: i.label,
|
|
1006
|
-
meta: i.meta,
|
|
1007
|
-
value: JSON.stringify(i.meta)
|
|
1008
|
-
})) ?? [],
|
|
1009
|
-
onSelect: (i) => {
|
|
1010
|
-
y(i) && (l(`${s}.field`, i.meta?.field), l(`${s}.operator`, i.meta?.operator));
|
|
1011
|
-
}
|
|
1012
|
-
}
|
|
1013
|
-
),
|
|
1308
|
+
return /* @__PURE__ */ t.jsx(r.OptionRow, { children: /* @__PURE__ */ t.jsxs("div", { className: "flex gap-2", children: [
|
|
1014
1309
|
/* @__PURE__ */ t.jsx(
|
|
1015
|
-
|
|
1310
|
+
x,
|
|
1016
1311
|
{
|
|
1017
|
-
className: "w-34",
|
|
1018
|
-
defaultValue: e.matcher != null ? {
|
|
1019
|
-
label: a.find((i) => i.value === e.matcher)?.label ?? e.matcher,
|
|
1020
|
-
value: e.matcher
|
|
1021
|
-
} : void 0,
|
|
1022
1312
|
initialValues: a,
|
|
1313
|
+
defaultValue: e.bundle?.type == null ? void 0 : a.find((i) => i.value === e.bundle?.type) ?? {
|
|
1314
|
+
label: e.bundle.type,
|
|
1315
|
+
value: e.bundle.type
|
|
1316
|
+
},
|
|
1023
1317
|
onSelect: (i) => {
|
|
1024
|
-
|
|
1318
|
+
_(i) && (l(`${s}.${n}.type`, i.value), i.value === "balanced" && l(`${s}.${n}.value`, null));
|
|
1025
1319
|
}
|
|
1026
1320
|
}
|
|
1027
1321
|
),
|
|
1028
|
-
/* @__PURE__ */ t.jsx(
|
|
1029
|
-
|
|
1322
|
+
e.bundle?.type === "every" && /* @__PURE__ */ t.jsx(
|
|
1323
|
+
y,
|
|
1030
1324
|
{
|
|
1031
1325
|
type: "number",
|
|
1032
1326
|
className: "basis-20",
|
|
1033
|
-
placeholder: "
|
|
1327
|
+
placeholder: "1",
|
|
1034
1328
|
onChange: (i) => {
|
|
1035
|
-
const
|
|
1036
|
-
l(`${s}.value`,
|
|
1329
|
+
const u = parseInt(i.currentTarget.value, 10);
|
|
1330
|
+
l(`${s}.${n}.value`, u);
|
|
1037
1331
|
},
|
|
1038
|
-
defaultValue: e.value
|
|
1332
|
+
defaultValue: e.bundle?.value
|
|
1333
|
+
}
|
|
1334
|
+
),
|
|
1335
|
+
/* @__PURE__ */ t.jsx(
|
|
1336
|
+
x,
|
|
1337
|
+
{
|
|
1338
|
+
className: "grow",
|
|
1339
|
+
defaultValue: o ?? (e.bundle?.sort == null ? void 0 : {
|
|
1340
|
+
label: e.bundle.sort.attribute != null && e.bundle.sort.direction ? `${e.bundle.sort.attribute} ${e.bundle.sort.direction.toUpperCase()}` : "",
|
|
1341
|
+
value: JSON.stringify(e.bundle.sort),
|
|
1342
|
+
meta: e.bundle?.sort
|
|
1343
|
+
}),
|
|
1344
|
+
initialValues: r.optionConfig?.values?.map((i) => ({
|
|
1345
|
+
label: i.label,
|
|
1346
|
+
meta: i.meta,
|
|
1347
|
+
value: JSON.stringify(i.meta)
|
|
1348
|
+
})) ?? [],
|
|
1349
|
+
onSelect: (i) => {
|
|
1350
|
+
_(i) && l(`${s}.${n}.sort`, i.meta);
|
|
1351
|
+
}
|
|
1039
1352
|
}
|
|
1040
1353
|
)
|
|
1354
|
+
] }) });
|
|
1355
|
+
}
|
|
1356
|
+
function gt({
|
|
1357
|
+
item: e,
|
|
1358
|
+
pathPrefix: s
|
|
1359
|
+
}) {
|
|
1360
|
+
const n = "discount_mode", { setPath: l } = f(), r = N({ item: e, optionName: n, pathPrefix: s });
|
|
1361
|
+
return !(n in e) || r == null ? null : /* @__PURE__ */ t.jsx(r.OptionRow, { children: /* @__PURE__ */ t.jsx(
|
|
1362
|
+
x,
|
|
1363
|
+
{
|
|
1364
|
+
initialValues: r.optionConfig?.values ?? [],
|
|
1365
|
+
defaultValue: e[n] != null ? {
|
|
1366
|
+
label: r.optionConfig?.values?.find(
|
|
1367
|
+
(o) => o.value === e[n]
|
|
1368
|
+
)?.label ?? e[n],
|
|
1369
|
+
value: e[n]
|
|
1370
|
+
} : void 0,
|
|
1371
|
+
onSelect: (o) => {
|
|
1372
|
+
_(o) && l(`${s}.${n}`, o.value);
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
) });
|
|
1376
|
+
}
|
|
1377
|
+
function ht({
|
|
1378
|
+
item: e,
|
|
1379
|
+
pathPrefix: s
|
|
1380
|
+
}) {
|
|
1381
|
+
const n = "apply_on", { setPath: l } = f(), r = N({ item: e, optionName: n, pathPrefix: s });
|
|
1382
|
+
return !(n in e) || r == null ? null : /* @__PURE__ */ t.jsx(r.OptionRow, { children: /* @__PURE__ */ t.jsx(
|
|
1383
|
+
x,
|
|
1384
|
+
{
|
|
1385
|
+
initialValues: r.optionConfig?.values ?? [],
|
|
1386
|
+
isSearchable: !1,
|
|
1387
|
+
defaultValue: e[n] != null && e[n] !== "" ? {
|
|
1388
|
+
label: r.optionConfig?.values?.find(
|
|
1389
|
+
(o) => o.value === e[n]
|
|
1390
|
+
)?.label ?? e[n],
|
|
1391
|
+
value: e[n]
|
|
1392
|
+
} : void 0,
|
|
1393
|
+
onSelect: (o) => {
|
|
1394
|
+
_(o) && l(`${s}.${n}`, o.value);
|
|
1395
|
+
}
|
|
1396
|
+
}
|
|
1397
|
+
) });
|
|
1398
|
+
}
|
|
1399
|
+
function bt({
|
|
1400
|
+
item: e,
|
|
1401
|
+
pathPrefix: s
|
|
1402
|
+
}) {
|
|
1403
|
+
const n = "identifiers", { setPath: l } = f(), r = N({ item: e, optionName: n, pathPrefix: s });
|
|
1404
|
+
if (r == null || r.optionConfig?.required !== !0)
|
|
1405
|
+
return null;
|
|
1406
|
+
const o = n in e ? e.identifiers : {};
|
|
1407
|
+
return (r.optionConfig?.values ?? []).map(({ label: i, value: u }) => {
|
|
1408
|
+
const c = u === "order.line_items.sku.id" ? "skus" : u === "order.line_items.bundle.id" ? "bundles" : u === "order.line_items.sku.sku_lists.id" ? "sku_lists" : void 0;
|
|
1409
|
+
return c == null ? null : /* @__PURE__ */ t.jsx(
|
|
1410
|
+
I,
|
|
1411
|
+
{
|
|
1412
|
+
label: /* @__PURE__ */ t.jsxs(C, { variant: "info", size: "small", className: "flex gap-2 items-center", children: [
|
|
1413
|
+
"Free ",
|
|
1414
|
+
i
|
|
1415
|
+
] }),
|
|
1416
|
+
children: /* @__PURE__ */ t.jsx(
|
|
1417
|
+
ve,
|
|
1418
|
+
{
|
|
1419
|
+
resource: c,
|
|
1420
|
+
resourceKey: "id",
|
|
1421
|
+
isMulti: !0,
|
|
1422
|
+
value: o[u] ?? [],
|
|
1423
|
+
onSelect: (d) => {
|
|
1424
|
+
if (E(d))
|
|
1425
|
+
if (d.length > 0)
|
|
1426
|
+
l(`${s}.${n}`, {
|
|
1427
|
+
...o,
|
|
1428
|
+
[u]: d.map((m) => m.value).filter((m) => m != null)
|
|
1429
|
+
});
|
|
1430
|
+
else {
|
|
1431
|
+
const m = { ...o };
|
|
1432
|
+
delete m[u], l(`${s}.${n}`, m);
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
}
|
|
1436
|
+
)
|
|
1437
|
+
},
|
|
1438
|
+
u
|
|
1439
|
+
);
|
|
1440
|
+
});
|
|
1441
|
+
}
|
|
1442
|
+
const xt = {
|
|
1443
|
+
"order-rules": [
|
|
1444
|
+
"order",
|
|
1445
|
+
"order.line_items",
|
|
1446
|
+
"order.line_items.line_item_options",
|
|
1447
|
+
"order.line_items.sku",
|
|
1448
|
+
"order.line_items.bundle",
|
|
1449
|
+
"order.line_items.shipment",
|
|
1450
|
+
"order.line_items.payment_method",
|
|
1451
|
+
"order.line_items.adjustment",
|
|
1452
|
+
"order.line_items.gift_card"
|
|
1453
|
+
],
|
|
1454
|
+
"price-rules": ["price"]
|
|
1455
|
+
};
|
|
1456
|
+
function vt({
|
|
1457
|
+
item: e,
|
|
1458
|
+
pathPrefix: s
|
|
1459
|
+
}) {
|
|
1460
|
+
return e == null ? null : /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
1461
|
+
/* @__PURE__ */ t.jsx(yt, { item: e, pathPrefix: s }),
|
|
1462
|
+
/* @__PURE__ */ t.jsx(_t, { item: e, pathPrefix: s }),
|
|
1463
|
+
/* @__PURE__ */ t.jsx(jt, { item: e, pathPrefix: s })
|
|
1041
1464
|
] });
|
|
1042
1465
|
}
|
|
1043
|
-
function
|
|
1466
|
+
function yt({
|
|
1467
|
+
item: e,
|
|
1468
|
+
pathPrefix: s
|
|
1469
|
+
}) {
|
|
1470
|
+
const n = "group", { setPath: l } = f(), r = N({ item: e, optionName: n, pathPrefix: s }), o = xe();
|
|
1471
|
+
return !(n in e) || r == null || e.group === void 0 ? null : /* @__PURE__ */ t.jsx(r.OptionRow, { children: /* @__PURE__ */ t.jsx(
|
|
1472
|
+
x,
|
|
1473
|
+
{
|
|
1474
|
+
name: `${s}.group`,
|
|
1475
|
+
isCreatable: !0,
|
|
1476
|
+
initialValues: o.map((a) => ({
|
|
1477
|
+
value: a,
|
|
1478
|
+
label: a
|
|
1479
|
+
})),
|
|
1480
|
+
defaultValue: e.group != null ? {
|
|
1481
|
+
value: e.group,
|
|
1482
|
+
label: e.group
|
|
1483
|
+
} : void 0,
|
|
1484
|
+
onSelect: (a) => {
|
|
1485
|
+
(a == null || _(a)) && l(`${s}.group`, a?.value.toString());
|
|
1486
|
+
},
|
|
1487
|
+
placeholder: "Select or create group…"
|
|
1488
|
+
}
|
|
1489
|
+
) });
|
|
1490
|
+
}
|
|
1491
|
+
function jt({
|
|
1044
1492
|
item: e,
|
|
1045
1493
|
pathPrefix: s
|
|
1046
1494
|
}) {
|
|
1047
|
-
const n = "aggregations", { setPath: l } = f(), [
|
|
1048
|
-
return !(n in e) ||
|
|
1495
|
+
const n = "aggregations", { setPath: l } = f(), [r, o] = v(0), a = N({ item: e, optionName: n, pathPrefix: s });
|
|
1496
|
+
return !(n in e) || a == null || e[n] == null || e[n].length === 0 ? null : /* @__PURE__ */ t.jsx(a.OptionRow, { children: e.aggregations?.map((i, u) => {
|
|
1049
1497
|
const c = u.toString();
|
|
1050
1498
|
return /* @__PURE__ */ t.jsxs("div", { className: "flex justify-between gap-2", children: [
|
|
1051
1499
|
/* @__PURE__ */ t.jsx(
|
|
1052
1500
|
we,
|
|
1053
1501
|
{
|
|
1054
|
-
aggregation:
|
|
1055
|
-
optionConfig:
|
|
1502
|
+
aggregation: i,
|
|
1503
|
+
optionConfig: a.optionConfig,
|
|
1056
1504
|
pathPrefix: `${s}.${n}.${u}`
|
|
1057
1505
|
}
|
|
1058
1506
|
),
|
|
@@ -1060,10 +1508,10 @@ function dt({
|
|
|
1060
1508
|
S,
|
|
1061
1509
|
{
|
|
1062
1510
|
className: "grow-0",
|
|
1063
|
-
dropdownLabel: /* @__PURE__ */ t.jsx(
|
|
1511
|
+
dropdownLabel: /* @__PURE__ */ t.jsx(O, { variant: "input", className: "h-11 bg-gray-50", children: /* @__PURE__ */ t.jsx(j, { name: "dotsThreeVertical", size: 16, weight: "bold" }) }),
|
|
1064
1512
|
dropdownItems: [
|
|
1065
1513
|
/* @__PURE__ */ t.jsx(
|
|
1066
|
-
|
|
1514
|
+
$,
|
|
1067
1515
|
{
|
|
1068
1516
|
label: "Add aggregation",
|
|
1069
1517
|
onClick: () => {
|
|
@@ -1076,13 +1524,13 @@ function dt({
|
|
|
1076
1524
|
`${c}-"add-aggregation"`
|
|
1077
1525
|
),
|
|
1078
1526
|
/* @__PURE__ */ t.jsx(
|
|
1079
|
-
|
|
1527
|
+
$,
|
|
1080
1528
|
{
|
|
1081
1529
|
label: "Duplicate",
|
|
1082
1530
|
onClick: () => {
|
|
1083
1531
|
l(
|
|
1084
1532
|
`${s}.aggregations.${e.aggregations?.length}`,
|
|
1085
|
-
|
|
1533
|
+
i
|
|
1086
1534
|
);
|
|
1087
1535
|
}
|
|
1088
1536
|
},
|
|
@@ -1090,12 +1538,12 @@ function dt({
|
|
|
1090
1538
|
),
|
|
1091
1539
|
/* @__PURE__ */ t.jsx(z, {}, `${c}-"divider"`),
|
|
1092
1540
|
/* @__PURE__ */ t.jsx(
|
|
1093
|
-
|
|
1541
|
+
$,
|
|
1094
1542
|
{
|
|
1095
1543
|
label: "Remove",
|
|
1096
1544
|
disabled: e.aggregations?.length === 1,
|
|
1097
1545
|
onClick: () => {
|
|
1098
|
-
e.aggregations?.length === 1 ? l(`${s}.aggregations`, null) : l(`${s}.aggregations.${u}`, null),
|
|
1546
|
+
e.aggregations?.length === 1 ? l(`${s}.aggregations`, null) : l(`${s}.aggregations.${u}`, null), o((d) => d + 1);
|
|
1099
1547
|
}
|
|
1100
1548
|
},
|
|
1101
1549
|
`${c}-"remove-aggregation"`
|
|
@@ -1104,185 +1552,30 @@ function dt({
|
|
|
1104
1552
|
}
|
|
1105
1553
|
)
|
|
1106
1554
|
] }, c);
|
|
1107
|
-
}) },
|
|
1108
|
-
}
|
|
1109
|
-
function pt({
|
|
1110
|
-
item: e,
|
|
1111
|
-
pathPrefix: s
|
|
1112
|
-
}) {
|
|
1113
|
-
const n = "bundle", { setPath: l } = f(), o = T({ item: e, optionName: n, pathPrefix: s });
|
|
1114
|
-
if (!(n in e) || o == null)
|
|
1115
|
-
return null;
|
|
1116
|
-
const a = o.optionConfig?.values?.find(
|
|
1117
|
-
(r) => k(e.bundle?.sort, r.meta)
|
|
1118
|
-
), i = [
|
|
1119
|
-
{ label: "Balanced", value: "balanced" },
|
|
1120
|
-
{ label: "Every", value: "every" }
|
|
1121
|
-
];
|
|
1122
|
-
return /* @__PURE__ */ t.jsx(o.OptionRow, { children: /* @__PURE__ */ t.jsxs("div", { className: "flex gap-2", children: [
|
|
1123
|
-
/* @__PURE__ */ t.jsx(
|
|
1124
|
-
g,
|
|
1125
|
-
{
|
|
1126
|
-
initialValues: i,
|
|
1127
|
-
defaultValue: e.bundle?.type == null ? void 0 : i.find((r) => r.value === e.bundle?.type) ?? {
|
|
1128
|
-
label: e.bundle.type,
|
|
1129
|
-
value: e.bundle.type
|
|
1130
|
-
},
|
|
1131
|
-
onSelect: (r) => {
|
|
1132
|
-
y(r) && (l(`${s}.${n}.type`, r.value), r.value === "balanced" && l(`${s}.${n}.value`, null));
|
|
1133
|
-
}
|
|
1134
|
-
}
|
|
1135
|
-
),
|
|
1136
|
-
e.bundle?.type === "every" && /* @__PURE__ */ t.jsx(
|
|
1137
|
-
j,
|
|
1138
|
-
{
|
|
1139
|
-
type: "number",
|
|
1140
|
-
className: "basis-20",
|
|
1141
|
-
placeholder: "1",
|
|
1142
|
-
onChange: (r) => {
|
|
1143
|
-
const u = parseInt(r.currentTarget.value, 10);
|
|
1144
|
-
l(`${s}.${n}.value`, u);
|
|
1145
|
-
},
|
|
1146
|
-
defaultValue: e.bundle?.value
|
|
1147
|
-
}
|
|
1148
|
-
),
|
|
1149
|
-
/* @__PURE__ */ t.jsx(
|
|
1150
|
-
g,
|
|
1151
|
-
{
|
|
1152
|
-
className: "grow",
|
|
1153
|
-
defaultValue: a ?? (e.bundle?.sort == null ? void 0 : {
|
|
1154
|
-
label: e.bundle.sort.attribute != null && e.bundle.sort.direction ? `${e.bundle.sort.attribute} ${e.bundle.sort.direction.toUpperCase()}` : "",
|
|
1155
|
-
value: JSON.stringify(e.bundle.sort),
|
|
1156
|
-
meta: e.bundle?.sort
|
|
1157
|
-
}),
|
|
1158
|
-
initialValues: o.optionConfig?.values?.map((r) => ({
|
|
1159
|
-
label: r.label,
|
|
1160
|
-
meta: r.meta,
|
|
1161
|
-
value: JSON.stringify(r.meta)
|
|
1162
|
-
})) ?? [],
|
|
1163
|
-
onSelect: (r) => {
|
|
1164
|
-
y(r) && l(`${s}.${n}.sort`, r.meta);
|
|
1165
|
-
}
|
|
1166
|
-
}
|
|
1167
|
-
)
|
|
1168
|
-
] }) });
|
|
1169
|
-
}
|
|
1170
|
-
function mt({
|
|
1171
|
-
item: e,
|
|
1172
|
-
pathPrefix: s
|
|
1173
|
-
}) {
|
|
1174
|
-
const n = "discount_mode", { setPath: l } = f(), o = T({ item: e, optionName: n, pathPrefix: s });
|
|
1175
|
-
return !(n in e) || o == null ? null : /* @__PURE__ */ t.jsx(o.OptionRow, { children: /* @__PURE__ */ t.jsx(
|
|
1176
|
-
g,
|
|
1177
|
-
{
|
|
1178
|
-
initialValues: o.optionConfig?.values ?? [],
|
|
1179
|
-
defaultValue: e[n] != null ? {
|
|
1180
|
-
label: o.optionConfig?.values?.find(
|
|
1181
|
-
(a) => a.value === e[n]
|
|
1182
|
-
)?.label ?? e[n],
|
|
1183
|
-
value: e[n]
|
|
1184
|
-
} : void 0,
|
|
1185
|
-
onSelect: (a) => {
|
|
1186
|
-
y(a) && l(`${s}.${n}`, a.value);
|
|
1187
|
-
}
|
|
1188
|
-
}
|
|
1189
|
-
) });
|
|
1555
|
+
}) }, r);
|
|
1190
1556
|
}
|
|
1191
|
-
function
|
|
1557
|
+
function _t({
|
|
1192
1558
|
item: e,
|
|
1193
1559
|
pathPrefix: s
|
|
1194
1560
|
}) {
|
|
1195
|
-
const n = "scope", { setPath: l } = f(),
|
|
1196
|
-
return !(n in e) ||
|
|
1197
|
-
|
|
1561
|
+
const n = "scope", { setPath: l } = f(), r = N({ item: e, optionName: n, pathPrefix: s });
|
|
1562
|
+
return !(n in e) || r == null ? null : /* @__PURE__ */ t.jsx(r.OptionRow, { children: /* @__PURE__ */ t.jsx(
|
|
1563
|
+
x,
|
|
1198
1564
|
{
|
|
1199
|
-
initialValues:
|
|
1565
|
+
initialValues: r.optionConfig?.values ?? [],
|
|
1200
1566
|
defaultValue: e[n] != null ? {
|
|
1201
|
-
label:
|
|
1202
|
-
(
|
|
1203
|
-
)?.label ?? e[n],
|
|
1204
|
-
value: e[n]
|
|
1205
|
-
} : void 0,
|
|
1206
|
-
onSelect: (a) => {
|
|
1207
|
-
y(a) && l(`${s}.${n}`, a.value);
|
|
1208
|
-
}
|
|
1209
|
-
}
|
|
1210
|
-
) });
|
|
1211
|
-
}
|
|
1212
|
-
function ht({
|
|
1213
|
-
item: e,
|
|
1214
|
-
pathPrefix: s
|
|
1215
|
-
}) {
|
|
1216
|
-
const n = "apply_on", { setPath: l } = f(), o = T({ item: e, optionName: n, pathPrefix: s });
|
|
1217
|
-
return !(n in e) || o == null ? null : /* @__PURE__ */ t.jsx(o.OptionRow, { children: /* @__PURE__ */ t.jsx(
|
|
1218
|
-
g,
|
|
1219
|
-
{
|
|
1220
|
-
initialValues: o.optionConfig?.values ?? [],
|
|
1221
|
-
isSearchable: !1,
|
|
1222
|
-
defaultValue: e[n] != null && e[n] !== "" ? {
|
|
1223
|
-
label: o.optionConfig?.values?.find(
|
|
1224
|
-
(a) => a.value === e[n]
|
|
1567
|
+
label: r.optionConfig?.values?.find(
|
|
1568
|
+
(o) => o.value === e[n]
|
|
1225
1569
|
)?.label ?? e[n],
|
|
1226
1570
|
value: e[n]
|
|
1227
1571
|
} : void 0,
|
|
1228
|
-
onSelect: (
|
|
1229
|
-
|
|
1572
|
+
onSelect: (o) => {
|
|
1573
|
+
_(o) && l(`${s}.${n}`, o.value);
|
|
1230
1574
|
}
|
|
1231
1575
|
}
|
|
1232
1576
|
) });
|
|
1233
1577
|
}
|
|
1234
|
-
function
|
|
1235
|
-
item: e,
|
|
1236
|
-
optionName: s,
|
|
1237
|
-
pathPrefix: n
|
|
1238
|
-
}) {
|
|
1239
|
-
const { setPath: l, optionsConfig: o, schemaType: a } = f(), i = a === "order-rules" ? "order" : a === "price-rules" ? "price" : void 0, r = "type" in e && e.selector != null ? o.actions[e.type]?.[e.selector]?.find((c) => c.name === s) : o.conditions.find((c) => c.name === s), u = M(
|
|
1240
|
-
({ children: c }) => /* @__PURE__ */ t.jsx(
|
|
1241
|
-
I,
|
|
1242
|
-
{
|
|
1243
|
-
label: /* @__PURE__ */ t.jsx(
|
|
1244
|
-
S,
|
|
1245
|
-
{
|
|
1246
|
-
className: "inline-flex",
|
|
1247
|
-
menuPosition: "bottom-left",
|
|
1248
|
-
dropdownItems: [
|
|
1249
|
-
/* @__PURE__ */ t.jsx(
|
|
1250
|
-
_,
|
|
1251
|
-
{
|
|
1252
|
-
onClick: () => {
|
|
1253
|
-
l(`${n}.${s}`, null);
|
|
1254
|
-
},
|
|
1255
|
-
label: "Remove"
|
|
1256
|
-
},
|
|
1257
|
-
"remove"
|
|
1258
|
-
)
|
|
1259
|
-
],
|
|
1260
|
-
dropdownLabel: /* @__PURE__ */ t.jsx("button", { type: "button", children: /* @__PURE__ */ t.jsxs(
|
|
1261
|
-
$,
|
|
1262
|
-
{
|
|
1263
|
-
variant: "info",
|
|
1264
|
-
size: "small",
|
|
1265
|
-
className: "flex gap-2 items-center",
|
|
1266
|
-
children: [
|
|
1267
|
-
r?.label ?? ye[s],
|
|
1268
|
-
/* @__PURE__ */ t.jsx(v, { name: "caretDown" })
|
|
1269
|
-
]
|
|
1270
|
-
}
|
|
1271
|
-
) })
|
|
1272
|
-
}
|
|
1273
|
-
),
|
|
1274
|
-
children: c
|
|
1275
|
-
}
|
|
1276
|
-
),
|
|
1277
|
-
[n, s, r, l]
|
|
1278
|
-
);
|
|
1279
|
-
return !(s in e) || i == null ? null : {
|
|
1280
|
-
optionConfig: r,
|
|
1281
|
-
mainResourceId: i,
|
|
1282
|
-
OptionRow: u
|
|
1283
|
-
};
|
|
1284
|
-
}
|
|
1285
|
-
function gt({
|
|
1578
|
+
function $t({
|
|
1286
1579
|
item: e,
|
|
1287
1580
|
pathPrefix: s
|
|
1288
1581
|
}) {
|
|
@@ -1293,7 +1586,7 @@ function gt({
|
|
|
1293
1586
|
case "buy_x_pay_y":
|
|
1294
1587
|
return /* @__PURE__ */ t.jsxs("div", { className: "w-36 flex items-center gap-0.5", children: [
|
|
1295
1588
|
/* @__PURE__ */ t.jsx(
|
|
1296
|
-
|
|
1589
|
+
y,
|
|
1297
1590
|
{
|
|
1298
1591
|
name: `${s}.value.x`,
|
|
1299
1592
|
type: "number",
|
|
@@ -1305,10 +1598,11 @@ function gt({
|
|
|
1305
1598
|
parseInt(l.currentTarget.value, 10)
|
|
1306
1599
|
);
|
|
1307
1600
|
}
|
|
1308
|
-
}
|
|
1601
|
+
},
|
|
1602
|
+
`${e.type}-${s}.value.x`
|
|
1309
1603
|
),
|
|
1310
1604
|
/* @__PURE__ */ t.jsx(
|
|
1311
|
-
|
|
1605
|
+
y,
|
|
1312
1606
|
{
|
|
1313
1607
|
name: `${s}.value.y`,
|
|
1314
1608
|
type: "number",
|
|
@@ -1320,13 +1614,14 @@ function gt({
|
|
|
1320
1614
|
parseInt(l.currentTarget.value, 10)
|
|
1321
1615
|
);
|
|
1322
1616
|
}
|
|
1323
|
-
}
|
|
1617
|
+
},
|
|
1618
|
+
`${e.type}-${s}.value.y`
|
|
1324
1619
|
)
|
|
1325
1620
|
] });
|
|
1326
1621
|
case "every_x_discount_y":
|
|
1327
1622
|
return /* @__PURE__ */ t.jsxs("div", { className: "w-36 flex items-center gap-0.5", children: [
|
|
1328
1623
|
/* @__PURE__ */ t.jsx(
|
|
1329
|
-
|
|
1624
|
+
y,
|
|
1330
1625
|
{
|
|
1331
1626
|
name: `${s}.value.x`,
|
|
1332
1627
|
type: "number",
|
|
@@ -1338,10 +1633,11 @@ function gt({
|
|
|
1338
1633
|
parseInt(l.currentTarget.value, 10)
|
|
1339
1634
|
);
|
|
1340
1635
|
}
|
|
1341
|
-
}
|
|
1636
|
+
},
|
|
1637
|
+
`${e.type}-${s}.value.x`
|
|
1342
1638
|
),
|
|
1343
1639
|
/* @__PURE__ */ t.jsx(
|
|
1344
|
-
|
|
1640
|
+
y,
|
|
1345
1641
|
{
|
|
1346
1642
|
name: `${s}.value.y`,
|
|
1347
1643
|
type: "number",
|
|
@@ -1353,13 +1649,14 @@ function gt({
|
|
|
1353
1649
|
parseInt(l.currentTarget.value, 10)
|
|
1354
1650
|
);
|
|
1355
1651
|
}
|
|
1356
|
-
}
|
|
1652
|
+
},
|
|
1653
|
+
`${e.type}-${s}.value.y`
|
|
1357
1654
|
)
|
|
1358
1655
|
] });
|
|
1359
1656
|
case "fixed_amount":
|
|
1360
1657
|
case "fixed_price":
|
|
1361
1658
|
return /* @__PURE__ */ t.jsx("div", { className: "w-36", children: /* @__PURE__ */ t.jsx(
|
|
1362
|
-
|
|
1659
|
+
y,
|
|
1363
1660
|
{
|
|
1364
1661
|
name: `${s}.value`,
|
|
1365
1662
|
type: "number",
|
|
@@ -1372,12 +1669,13 @@ function gt({
|
|
|
1372
1669
|
parseInt(l.currentTarget.value, 10)
|
|
1373
1670
|
);
|
|
1374
1671
|
}
|
|
1375
|
-
}
|
|
1672
|
+
},
|
|
1673
|
+
`${e.type}-${s}.value`
|
|
1376
1674
|
) });
|
|
1377
1675
|
case "percentage": {
|
|
1378
1676
|
const l = (e.value * 100).toFixed(2);
|
|
1379
1677
|
return /* @__PURE__ */ t.jsx("div", { className: "w-24", children: /* @__PURE__ */ t.jsx(
|
|
1380
|
-
|
|
1678
|
+
y,
|
|
1381
1679
|
{
|
|
1382
1680
|
name: `${s}.value`,
|
|
1383
1681
|
type: "number",
|
|
@@ -1385,259 +1683,203 @@ function gt({
|
|
|
1385
1683
|
min: 0,
|
|
1386
1684
|
max: 100,
|
|
1387
1685
|
suffix: "%",
|
|
1388
|
-
onChange: (
|
|
1686
|
+
onChange: (r) => {
|
|
1389
1687
|
n(
|
|
1390
1688
|
`${s}.value`,
|
|
1391
|
-
parseFloat(
|
|
1689
|
+
parseFloat(r.currentTarget.value) / 100
|
|
1392
1690
|
);
|
|
1393
1691
|
}
|
|
1394
|
-
}
|
|
1692
|
+
},
|
|
1693
|
+
`${e.type}-${s}.value`
|
|
1395
1694
|
) });
|
|
1396
1695
|
}
|
|
1696
|
+
case "free_gift":
|
|
1697
|
+
return null;
|
|
1397
1698
|
default:
|
|
1398
|
-
return
|
|
1699
|
+
return oe();
|
|
1399
1700
|
}
|
|
1400
1701
|
}
|
|
1401
|
-
function
|
|
1702
|
+
function Nt({
|
|
1402
1703
|
item: e,
|
|
1403
1704
|
index: s,
|
|
1404
1705
|
onDelete: n
|
|
1405
1706
|
}) {
|
|
1406
1707
|
const {
|
|
1407
1708
|
setPath: l,
|
|
1408
|
-
setRenderOption:
|
|
1409
|
-
state: { selectedRuleIndex:
|
|
1410
|
-
optionsConfig:
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
), d = {
|
|
1709
|
+
setRenderOption: r,
|
|
1710
|
+
state: { selectedRuleIndex: o },
|
|
1711
|
+
optionsConfig: a,
|
|
1712
|
+
schemaType: i
|
|
1713
|
+
} = f(), u = Object.keys(
|
|
1714
|
+
a.actions
|
|
1715
|
+
), c = e != null && "selector" in e ? e.selector : "", d = e?.type != null ? a.actions?.[e.type]?.[c] ?? [] : [], { available: m, required: h } = Ne(e, d), p = {
|
|
1716
|
+
free_gift: "Free gift",
|
|
1417
1717
|
percentage: "Percentage discount",
|
|
1418
1718
|
fixed_amount: "Fixed amount",
|
|
1419
1719
|
fixed_price: "Fixed price",
|
|
1420
1720
|
buy_x_pay_y: "Buy X, Pay Y",
|
|
1421
1721
|
every_x_discount_y: "Every X, Discount Y"
|
|
1422
|
-
},
|
|
1423
|
-
|
|
1424
|
-
|
|
1722
|
+
}, g = `rules.${o}.actions.${s}`, w = (b) => {
|
|
1723
|
+
switch (b) {
|
|
1724
|
+
case "selector":
|
|
1725
|
+
l(
|
|
1726
|
+
`${g}.selector`,
|
|
1727
|
+
i === "order-rules" ? "order.line_items" : i === "price-rules" ? "price" : null,
|
|
1728
|
+
!0
|
|
1729
|
+
);
|
|
1730
|
+
break;
|
|
1731
|
+
case "groups":
|
|
1732
|
+
l(`${g}.groups`, []);
|
|
1733
|
+
break;
|
|
1734
|
+
case "round":
|
|
1735
|
+
l(`${g}.round`, !0);
|
|
1736
|
+
break;
|
|
1737
|
+
case "apply_on":
|
|
1738
|
+
l(`${g}.apply_on`, null, !0);
|
|
1739
|
+
break;
|
|
1740
|
+
case "discount_mode":
|
|
1741
|
+
l(`${g}.discount_mode`, "default");
|
|
1742
|
+
break;
|
|
1743
|
+
case "limit":
|
|
1744
|
+
l(`${g}.limit`, {});
|
|
1745
|
+
break;
|
|
1746
|
+
case "aggregation":
|
|
1747
|
+
l(`${g}.aggregation`, {});
|
|
1748
|
+
break;
|
|
1749
|
+
case "bundle":
|
|
1750
|
+
l(`${g}.bundle`, {
|
|
1751
|
+
type: "balanced"
|
|
1752
|
+
});
|
|
1753
|
+
break;
|
|
1754
|
+
case "quantity":
|
|
1755
|
+
l(`${g}.quantity`, null, !0);
|
|
1756
|
+
break;
|
|
1757
|
+
case "identifiers": {
|
|
1758
|
+
l(`${g}.identifiers`, {});
|
|
1759
|
+
break;
|
|
1760
|
+
}
|
|
1761
|
+
}
|
|
1762
|
+
};
|
|
1763
|
+
return T(
|
|
1764
|
+
function() {
|
|
1765
|
+
e != null && h.forEach((V) => {
|
|
1766
|
+
V.name in e || w(V.name);
|
|
1767
|
+
});
|
|
1768
|
+
},
|
|
1769
|
+
[e, h, g]
|
|
1770
|
+
), /* @__PURE__ */ t.jsx("div", { className: "mb-4 last:mb-0", children: /* @__PURE__ */ t.jsxs(
|
|
1771
|
+
me,
|
|
1425
1772
|
{
|
|
1426
|
-
pathPrefix:
|
|
1773
|
+
pathPrefix: g,
|
|
1427
1774
|
dropdownItems: n != null ? /* @__PURE__ */ t.jsx(
|
|
1428
|
-
|
|
1775
|
+
$,
|
|
1429
1776
|
{
|
|
1430
1777
|
label: "Delete",
|
|
1431
1778
|
onClick: () => {
|
|
1432
|
-
l(`${
|
|
1779
|
+
l(`${g}`, null), r(`${g}`, null), n();
|
|
1433
1780
|
}
|
|
1434
1781
|
}
|
|
1435
1782
|
) : void 0,
|
|
1436
1783
|
options: /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
1437
|
-
/* @__PURE__ */ t.jsx(
|
|
1438
|
-
/* @__PURE__ */ t.jsx(
|
|
1439
|
-
/* @__PURE__ */ t.jsx(Ne, { item: e, pathPrefix: m }),
|
|
1440
|
-
c.length > 0 && /* @__PURE__ */ t.jsx(
|
|
1784
|
+
/* @__PURE__ */ t.jsx(ot, { item: e, pathPrefix: g }),
|
|
1785
|
+
m.length > 0 && /* @__PURE__ */ t.jsx(
|
|
1441
1786
|
S,
|
|
1442
1787
|
{
|
|
1443
1788
|
className: "inline-flex mt-6",
|
|
1444
1789
|
menuPosition: "bottom-left",
|
|
1445
|
-
dropdownItems:
|
|
1446
|
-
|
|
1790
|
+
dropdownItems: m.map((b) => /* @__PURE__ */ t.jsx(
|
|
1791
|
+
$,
|
|
1447
1792
|
{
|
|
1448
1793
|
onClick: () => {
|
|
1449
|
-
|
|
1450
|
-
case "round":
|
|
1451
|
-
l(`${m}.round`, !0);
|
|
1452
|
-
break;
|
|
1453
|
-
case "apply_on":
|
|
1454
|
-
l(`${m}.apply_on`, null, !0);
|
|
1455
|
-
break;
|
|
1456
|
-
case "discount_mode":
|
|
1457
|
-
l(`${m}.discount_mode`, "default");
|
|
1458
|
-
break;
|
|
1459
|
-
case "limit":
|
|
1460
|
-
l(`${m}.limit`, {});
|
|
1461
|
-
break;
|
|
1462
|
-
case "aggregation":
|
|
1463
|
-
l(`${m}.aggregation`, {});
|
|
1464
|
-
break;
|
|
1465
|
-
case "bundle":
|
|
1466
|
-
l(`${m}.bundle`, {
|
|
1467
|
-
type: "balanced"
|
|
1468
|
-
});
|
|
1469
|
-
break;
|
|
1470
|
-
}
|
|
1794
|
+
w(b.name);
|
|
1471
1795
|
},
|
|
1472
|
-
label:
|
|
1796
|
+
label: b.label
|
|
1473
1797
|
},
|
|
1474
|
-
`option-${
|
|
1798
|
+
`option-${b.name}`
|
|
1475
1799
|
)),
|
|
1476
|
-
dropdownLabel: /* @__PURE__ */ t.jsx("button", { type: "button", children: /* @__PURE__ */ t.jsxs(
|
|
1477
|
-
/* @__PURE__ */ t.jsx(
|
|
1800
|
+
dropdownLabel: /* @__PURE__ */ t.jsx("button", { type: "button", children: /* @__PURE__ */ t.jsxs(C, { className: "flex gap-2 items-center", children: [
|
|
1801
|
+
/* @__PURE__ */ t.jsx(C, { weight: "bold", size: "small", children: "Add option" }),
|
|
1478
1802
|
" ",
|
|
1479
|
-
/* @__PURE__ */ t.jsx(
|
|
1803
|
+
/* @__PURE__ */ t.jsx(j, { name: "caretDown" })
|
|
1480
1804
|
] }) })
|
|
1481
1805
|
}
|
|
1482
1806
|
)
|
|
1483
1807
|
] }),
|
|
1484
1808
|
children: [
|
|
1485
1809
|
/* @__PURE__ */ t.jsx("div", { className: "flex-1", children: /* @__PURE__ */ t.jsx(
|
|
1486
|
-
|
|
1810
|
+
x,
|
|
1487
1811
|
{
|
|
1488
|
-
name: `${
|
|
1812
|
+
name: `${g}.type`,
|
|
1489
1813
|
defaultValue: e != null && e.type != null ? {
|
|
1490
|
-
label:
|
|
1814
|
+
label: p[e.type],
|
|
1491
1815
|
value: e.type
|
|
1492
1816
|
} : void 0,
|
|
1493
|
-
initialValues:
|
|
1494
|
-
value:
|
|
1495
|
-
label:
|
|
1817
|
+
initialValues: u.map((b) => ({
|
|
1818
|
+
value: b,
|
|
1819
|
+
label: p[b]
|
|
1496
1820
|
})),
|
|
1497
|
-
onSelect: (
|
|
1498
|
-
|
|
1821
|
+
onSelect: (b) => {
|
|
1822
|
+
_(b) && l(`${g}`, {
|
|
1823
|
+
type: b.value
|
|
1824
|
+
});
|
|
1499
1825
|
}
|
|
1500
1826
|
}
|
|
1501
1827
|
) }),
|
|
1502
|
-
/* @__PURE__ */ t.jsx(
|
|
1828
|
+
/* @__PURE__ */ t.jsx($t, { item: e, pathPrefix: g })
|
|
1503
1829
|
]
|
|
1504
1830
|
}
|
|
1505
1831
|
) });
|
|
1506
1832
|
}
|
|
1507
|
-
function
|
|
1508
|
-
item: e,
|
|
1509
|
-
pathPrefix: s
|
|
1510
|
-
}) {
|
|
1511
|
-
const { setPath: n, schemaType: l } = f(), { t: o } = re(), a = yt[l].map((r) => ({
|
|
1512
|
-
value: r,
|
|
1513
|
-
label: o(`resource_paths.${r}`).replace(
|
|
1514
|
-
"resource_paths.",
|
|
1515
|
-
""
|
|
1516
|
-
)
|
|
1517
|
-
})), i = `${s}.selector`;
|
|
1518
|
-
return /* @__PURE__ */ t.jsx(
|
|
1519
|
-
I,
|
|
1520
|
-
{
|
|
1521
|
-
label: /* @__PURE__ */ t.jsx($, { variant: "info", size: "small", children: "Apply to" }),
|
|
1522
|
-
children: /* @__PURE__ */ t.jsx(
|
|
1523
|
-
g,
|
|
1524
|
-
{
|
|
1525
|
-
name: i,
|
|
1526
|
-
isSearchable: !1,
|
|
1527
|
-
initialValues: a,
|
|
1528
|
-
value: e?.selector == null ? void 0 : a.find((r) => r.value === e.selector) ?? {
|
|
1529
|
-
value: e.selector,
|
|
1530
|
-
label: e.selector
|
|
1531
|
-
},
|
|
1532
|
-
onSelect: async (r) => {
|
|
1533
|
-
y(r) && (n(i, r.value), n(`${s}.apply_on`, null));
|
|
1534
|
-
}
|
|
1535
|
-
}
|
|
1536
|
-
)
|
|
1537
|
-
}
|
|
1538
|
-
);
|
|
1539
|
-
}
|
|
1540
|
-
function vt({
|
|
1541
|
-
item: e,
|
|
1542
|
-
pathPrefix: s
|
|
1543
|
-
}) {
|
|
1544
|
-
const { setPath: n, schemaType: l } = f(), o = be();
|
|
1545
|
-
return C(() => {
|
|
1546
|
-
o.length === 0 && (e?.groups ?? []).length > 0 && n(`${s}.groups`, []);
|
|
1547
|
-
}, [o]), o.length <= 0 && (e?.groups ?? []).length <= 0 ? null : /* @__PURE__ */ t.jsx(
|
|
1548
|
-
I,
|
|
1549
|
-
{
|
|
1550
|
-
label: /* @__PURE__ */ t.jsx($, { variant: "info", size: "small", children: "Groups" }),
|
|
1551
|
-
children: /* @__PURE__ */ t.jsx(
|
|
1552
|
-
g,
|
|
1553
|
-
{
|
|
1554
|
-
name: `${s}.groups`,
|
|
1555
|
-
isMulti: !0,
|
|
1556
|
-
isClearable: !1,
|
|
1557
|
-
value: e?.groups?.map((a) => ({
|
|
1558
|
-
label: o.includes(a) ? a : `⚠️ ${a}`,
|
|
1559
|
-
value: a
|
|
1560
|
-
})),
|
|
1561
|
-
initialValues: o.map((a) => ({
|
|
1562
|
-
value: a,
|
|
1563
|
-
label: a
|
|
1564
|
-
})),
|
|
1565
|
-
onSelect: (a) => {
|
|
1566
|
-
E(a) && (n(
|
|
1567
|
-
`${s}.groups`,
|
|
1568
|
-
a.map((i) => i.value)
|
|
1569
|
-
), l === "order-rules" && a.length > 0 && n(`${s}.selector`, "order.line_items"));
|
|
1570
|
-
}
|
|
1571
|
-
}
|
|
1572
|
-
)
|
|
1573
|
-
}
|
|
1574
|
-
);
|
|
1575
|
-
}
|
|
1576
|
-
const yt = {
|
|
1577
|
-
"order-rules": [
|
|
1578
|
-
"order",
|
|
1579
|
-
"order.line_items",
|
|
1580
|
-
"order.line_items.line_item_options",
|
|
1581
|
-
"order.line_items.sku",
|
|
1582
|
-
"order.line_items.bundle",
|
|
1583
|
-
"order.line_items.shipment",
|
|
1584
|
-
"order.line_items.payment_method",
|
|
1585
|
-
"order.line_items.adjustment",
|
|
1586
|
-
"order.line_items.gift_card"
|
|
1587
|
-
],
|
|
1588
|
-
"price-rules": ["price"]
|
|
1589
|
-
};
|
|
1590
|
-
function jt({
|
|
1833
|
+
function wt({
|
|
1591
1834
|
actions: e
|
|
1592
1835
|
}) {
|
|
1593
|
-
const [s, n] =
|
|
1836
|
+
const [s, n] = v(0), {
|
|
1594
1837
|
setPath: l,
|
|
1595
|
-
state: { selectedRuleIndex:
|
|
1838
|
+
state: { selectedRuleIndex: r }
|
|
1596
1839
|
} = f();
|
|
1597
1840
|
return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
1598
|
-
/* @__PURE__ */ t.jsx("div", { children: e?.map((a, i
|
|
1599
|
-
|
|
1841
|
+
/* @__PURE__ */ t.jsx("div", { children: e?.map((o, a, i) => /* @__PURE__ */ t.jsx(
|
|
1842
|
+
Nt,
|
|
1600
1843
|
{
|
|
1601
|
-
item:
|
|
1602
|
-
index:
|
|
1603
|
-
onDelete:
|
|
1844
|
+
item: o,
|
|
1845
|
+
index: a,
|
|
1846
|
+
onDelete: i.length > 1 ? () => {
|
|
1604
1847
|
n((u) => u + 1);
|
|
1605
1848
|
} : void 0
|
|
1606
1849
|
},
|
|
1607
|
-
`${
|
|
1850
|
+
`${r}-${a}-${s}`
|
|
1608
1851
|
)) }),
|
|
1609
1852
|
/* @__PURE__ */ t.jsx("div", { className: "mt-6", children: /* @__PURE__ */ t.jsxs(
|
|
1610
|
-
|
|
1853
|
+
O,
|
|
1611
1854
|
{
|
|
1612
1855
|
size: "small",
|
|
1613
1856
|
variant: "secondary",
|
|
1614
1857
|
alignItems: "center",
|
|
1615
1858
|
onClick: () => {
|
|
1616
1859
|
l(
|
|
1617
|
-
`rules.${
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
}
|
|
1860
|
+
`rules.${r}.actions.${e?.length ?? 0}`,
|
|
1861
|
+
null,
|
|
1862
|
+
!0
|
|
1621
1863
|
);
|
|
1622
1864
|
},
|
|
1623
1865
|
children: [
|
|
1624
|
-
/* @__PURE__ */ t.jsx(
|
|
1866
|
+
/* @__PURE__ */ t.jsx(j, { name: "plusCircle" }),
|
|
1625
1867
|
" Add action"
|
|
1626
1868
|
]
|
|
1627
1869
|
}
|
|
1628
1870
|
) })
|
|
1629
1871
|
] });
|
|
1630
1872
|
}
|
|
1631
|
-
function
|
|
1873
|
+
function Ct({
|
|
1632
1874
|
value: e,
|
|
1633
1875
|
name: s
|
|
1634
1876
|
}) {
|
|
1635
|
-
const { setPath: n, schemaType: l } = f(), { t:
|
|
1636
|
-
|
|
1637
|
-
(u) =>
|
|
1877
|
+
const { setPath: n, schemaType: l } = f(), { t: r } = re(), o = de(null), a = l === "order-rules" ? "order" : l === "price-rules" ? "price" : void 0, i = ae(
|
|
1878
|
+
Tt.filter(
|
|
1879
|
+
(u) => a != null && u.startsWith(a)
|
|
1638
1880
|
).map((u) => ({
|
|
1639
1881
|
value: u,
|
|
1640
|
-
label:
|
|
1882
|
+
label: r(`resource_paths.${u}`).replace(
|
|
1641
1883
|
"resource_paths.",
|
|
1642
1884
|
""
|
|
1643
1885
|
)
|
|
@@ -1645,38 +1887,38 @@ function _t({
|
|
|
1645
1887
|
"label"
|
|
1646
1888
|
);
|
|
1647
1889
|
return /* @__PURE__ */ t.jsx(
|
|
1648
|
-
|
|
1890
|
+
x,
|
|
1649
1891
|
{
|
|
1650
|
-
ref:
|
|
1892
|
+
ref: o,
|
|
1651
1893
|
name: s,
|
|
1652
|
-
initialValues:
|
|
1653
|
-
defaultValue: e != null ?
|
|
1894
|
+
initialValues: i,
|
|
1895
|
+
defaultValue: e != null ? i.find((u) => u.value === e) ?? {
|
|
1654
1896
|
value: e,
|
|
1655
1897
|
label: e
|
|
1656
1898
|
} : void 0,
|
|
1657
1899
|
asTextSearch: !0,
|
|
1658
1900
|
isCreatable: !0,
|
|
1659
1901
|
loadAsyncValues: async (u) => {
|
|
1660
|
-
if (
|
|
1902
|
+
if (a == null)
|
|
1661
1903
|
return [];
|
|
1662
|
-
const c =
|
|
1904
|
+
const c = i.filter(
|
|
1663
1905
|
(p) => p.label.includes(u)
|
|
1664
|
-
), d = (await
|
|
1665
|
-
const
|
|
1906
|
+
), d = (await qe([a], u)).filter((p) => p.value.startsWith(u)).map((p) => {
|
|
1907
|
+
const g = p.type === "relationship" || p.value.endsWith(".metadata") ? `${p.value}.` : p.value;
|
|
1666
1908
|
return {
|
|
1667
|
-
value:
|
|
1668
|
-
label:
|
|
1909
|
+
value: g,
|
|
1910
|
+
label: g
|
|
1669
1911
|
};
|
|
1670
1912
|
}), m = u.includes(".metadata") ? [{ label: u, value: u }] : [];
|
|
1671
1913
|
return [...c, ...d, ...m];
|
|
1672
1914
|
},
|
|
1673
1915
|
onSelect: async (u) => {
|
|
1674
|
-
|
|
1916
|
+
_(u) && (n(s, u.value), u.value.toString().endsWith(".") && o.current?.openMenu("first"));
|
|
1675
1917
|
}
|
|
1676
1918
|
}
|
|
1677
1919
|
);
|
|
1678
1920
|
}
|
|
1679
|
-
const
|
|
1921
|
+
const Tt = [
|
|
1680
1922
|
"order.billing_address.country_code",
|
|
1681
1923
|
"order.country_code",
|
|
1682
1924
|
"order.currency_code",
|
|
@@ -1725,20 +1967,20 @@ const $t = [
|
|
|
1725
1967
|
"price.processed_at",
|
|
1726
1968
|
"price.amount_cents"
|
|
1727
1969
|
];
|
|
1728
|
-
function
|
|
1970
|
+
function St({
|
|
1729
1971
|
item: e,
|
|
1730
1972
|
pathPrefix: s
|
|
1731
1973
|
}) {
|
|
1732
|
-
const { setPath: n } = f(), { infos: l } =
|
|
1733
|
-
let
|
|
1734
|
-
|
|
1735
|
-
const
|
|
1974
|
+
const { setPath: n } = f(), { infos: l } = J(e);
|
|
1975
|
+
let r = l?.field?.type;
|
|
1976
|
+
r == null && (r = ge(e?.value));
|
|
1977
|
+
const o = l?.resource?.id, a = ["tag"], i = [
|
|
1736
1978
|
"matches",
|
|
1737
1979
|
"does_not_match",
|
|
1738
1980
|
"array_match"
|
|
1739
|
-
], u =
|
|
1981
|
+
], u = fe.filter(({ fieldTypes: c, visible: d }) => d !== !1 && c.includes(r)).filter(({ matcher: c }) => o == null || o != null && !a.includes(o) || i.includes(c)).map(({ matcher: c, label: d }) => ({ value: c, label: d }));
|
|
1740
1982
|
return /* @__PURE__ */ t.jsx(
|
|
1741
|
-
|
|
1983
|
+
x,
|
|
1742
1984
|
{
|
|
1743
1985
|
className: "min-w-[175px]",
|
|
1744
1986
|
name: `${s}.matcher`,
|
|
@@ -1748,7 +1990,7 @@ function Nt({
|
|
|
1748
1990
|
} : void 0,
|
|
1749
1991
|
initialValues: u,
|
|
1750
1992
|
onSelect: (c) => {
|
|
1751
|
-
|
|
1993
|
+
_(c) && (n(`${s}.matcher`, c.value), ie.includes(
|
|
1752
1994
|
c.value
|
|
1753
1995
|
) && n(`${s}.value`, null));
|
|
1754
1996
|
}
|
|
@@ -1756,70 +1998,23 @@ function Nt({
|
|
|
1756
1998
|
);
|
|
1757
1999
|
}
|
|
1758
2000
|
const Ce = ({ value: e, pathKey: s, infos: n, onSelect: l }) => {
|
|
1759
|
-
const {
|
|
1760
|
-
r,
|
|
1761
|
-
"list",
|
|
1762
|
-
n?.resource?.id == null ? null : [J({ value: "" })]
|
|
1763
|
-
), { data: c, isLoading: d } = Y(
|
|
1764
|
-
r,
|
|
1765
|
-
"list",
|
|
1766
|
-
n?.resource?.id == null ? null : [
|
|
1767
|
-
{
|
|
1768
|
-
...J({ value: "" }),
|
|
1769
|
-
filters: {
|
|
1770
|
-
id_in: Array.isArray(e) ? e : [e]
|
|
1771
|
-
}
|
|
1772
|
-
}
|
|
1773
|
-
]
|
|
1774
|
-
), m = oe([...c ?? [], ...u ?? []], "id");
|
|
1775
|
-
function h(p) {
|
|
1776
|
-
return {
|
|
1777
|
-
label: m?.find((b) => b.id === p.toString())?.name ?? `${d ? "" : "⚠️ "}${p.toString()}`,
|
|
1778
|
-
value: p.toString()
|
|
1779
|
-
};
|
|
1780
|
-
}
|
|
2001
|
+
const { setPath: r } = f();
|
|
1781
2002
|
return /* @__PURE__ */ t.jsx(
|
|
1782
|
-
|
|
2003
|
+
ve,
|
|
1783
2004
|
{
|
|
1784
|
-
|
|
1785
|
-
|
|
2005
|
+
resourceKey: n?.field?.name ?? "id",
|
|
2006
|
+
resource: Ze(n?.resource?.id),
|
|
1786
2007
|
isMulti: n?.matcherInfos?.isMulti,
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
loadAsyncValues: async (p) => {
|
|
1791
|
-
const b = await o[r].list(J({ value: p }));
|
|
1792
|
-
return ee(b, i);
|
|
1793
|
-
},
|
|
1794
|
-
onSelect: (p) => {
|
|
1795
|
-
l?.(p), E(p) ? a(
|
|
2008
|
+
value: e,
|
|
2009
|
+
onSelect: (o) => {
|
|
2010
|
+
l?.(o), E(o) ? r(
|
|
1796
2011
|
s,
|
|
1797
|
-
|
|
1798
|
-
) :
|
|
2012
|
+
o.map((a) => a.value).filter((a) => a != null)
|
|
2013
|
+
) : _(o) && r(s, o.value);
|
|
1799
2014
|
}
|
|
1800
|
-
},
|
|
1801
|
-
`${n?.matcherInfos?.isMulti?.toString()}-${d}-${JSON.stringify(m)}`
|
|
1802
|
-
);
|
|
1803
|
-
};
|
|
1804
|
-
function J({ value: e }) {
|
|
1805
|
-
return {
|
|
1806
|
-
pageSize: 25,
|
|
1807
|
-
sort: {
|
|
1808
|
-
name: "asc"
|
|
1809
|
-
},
|
|
1810
|
-
filters: {
|
|
1811
|
-
name_cont: e
|
|
1812
2015
|
}
|
|
1813
|
-
|
|
1814
|
-
}
|
|
1815
|
-
function ee(e, s) {
|
|
1816
|
-
return e.map((n) => ({
|
|
1817
|
-
label: n.name,
|
|
1818
|
-
// @ts-expect-error TODO: fix this
|
|
1819
|
-
value: n[s]
|
|
1820
|
-
}));
|
|
1821
|
-
}
|
|
1822
|
-
const R = {
|
|
2016
|
+
);
|
|
2017
|
+
}, M = {
|
|
1823
2018
|
in_and: {
|
|
1824
2019
|
label: "All of"
|
|
1825
2020
|
},
|
|
@@ -1839,74 +2034,74 @@ function te({
|
|
|
1839
2034
|
hasResourceSelector: n = !1,
|
|
1840
2035
|
infos: l
|
|
1841
2036
|
}) {
|
|
1842
|
-
const { setPath:
|
|
1843
|
-
|
|
1844
|
-
)[0],
|
|
1845
|
-
[
|
|
2037
|
+
const { setPath: r } = f(), o = Object.keys(
|
|
2038
|
+
M
|
|
2039
|
+
)[0], a = ce(() => typeof e == "object" && e !== null && !Array.isArray(e) ? e : {
|
|
2040
|
+
[o]: []
|
|
1846
2041
|
}, [e]);
|
|
1847
|
-
|
|
1848
|
-
(typeof e != "object" || Array.isArray(e) || e === null) &&
|
|
1849
|
-
[
|
|
2042
|
+
T(() => {
|
|
2043
|
+
(typeof e != "object" || Array.isArray(e) || e === null) && r(s, {
|
|
2044
|
+
[o]: []
|
|
1850
2045
|
});
|
|
1851
2046
|
}, [e]);
|
|
1852
|
-
const
|
|
1853
|
-
(u) => !(u in
|
|
2047
|
+
const i = Object.keys(M).filter(
|
|
2048
|
+
(u) => !(u in a)
|
|
1854
2049
|
);
|
|
1855
2050
|
return /* @__PURE__ */ t.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
1856
|
-
Object.entries(
|
|
1857
|
-
|
|
2051
|
+
Object.entries(a).map(([u, c], d) => /* @__PURE__ */ t.jsx(
|
|
2052
|
+
kt,
|
|
1858
2053
|
{
|
|
1859
2054
|
infos: l,
|
|
1860
2055
|
hasResourceSelector: n,
|
|
1861
2056
|
pathPrefix: s,
|
|
1862
2057
|
defaultValue: c,
|
|
1863
2058
|
initialMatcher: u,
|
|
1864
|
-
remainingKeys:
|
|
2059
|
+
remainingKeys: i
|
|
1865
2060
|
},
|
|
1866
2061
|
`${s}.${// biome-ignore lint/suspicious/noArrayIndexKey: Using index as key is acceptable here since items are static
|
|
1867
2062
|
d}`
|
|
1868
2063
|
)),
|
|
1869
|
-
|
|
2064
|
+
i.length > 0 && /* @__PURE__ */ t.jsxs(X, { top: "4", children: [
|
|
1870
2065
|
/* @__PURE__ */ t.jsx(
|
|
1871
2066
|
S,
|
|
1872
2067
|
{
|
|
1873
2068
|
className: "inline-flex",
|
|
1874
2069
|
menuPosition: "bottom-left",
|
|
1875
2070
|
dropdownItems: [
|
|
1876
|
-
|
|
1877
|
-
|
|
2071
|
+
i.map((u) => /* @__PURE__ */ t.jsx(
|
|
2072
|
+
$,
|
|
1878
2073
|
{
|
|
1879
2074
|
onClick: () => {
|
|
1880
|
-
|
|
2075
|
+
r(`${s}.${u}`, []);
|
|
1881
2076
|
},
|
|
1882
|
-
label:
|
|
2077
|
+
label: M[u].label
|
|
1883
2078
|
},
|
|
1884
2079
|
u
|
|
1885
2080
|
))
|
|
1886
2081
|
],
|
|
1887
|
-
dropdownLabel: /* @__PURE__ */ t.jsx("button", { type: "button", children: /* @__PURE__ */ t.jsxs(
|
|
1888
|
-
/* @__PURE__ */ t.jsx(
|
|
2082
|
+
dropdownLabel: /* @__PURE__ */ t.jsx("button", { type: "button", children: /* @__PURE__ */ t.jsxs(C, { className: "flex gap-2 items-center", children: [
|
|
2083
|
+
/* @__PURE__ */ t.jsx(C, { weight: "bold", size: "small", children: "Add value" }),
|
|
1889
2084
|
" ",
|
|
1890
|
-
/* @__PURE__ */ t.jsx(
|
|
2085
|
+
/* @__PURE__ */ t.jsx(j, { name: "caretDown" })
|
|
1891
2086
|
] }) })
|
|
1892
2087
|
}
|
|
1893
2088
|
),
|
|
1894
|
-
/* @__PURE__ */ t.jsx(X, { top: "6", bottom: "2", children: /* @__PURE__ */ t.jsx(
|
|
2089
|
+
/* @__PURE__ */ t.jsx(X, { top: "6", bottom: "2", children: /* @__PURE__ */ t.jsx(De, { variant: "dashed" }) })
|
|
1895
2090
|
] })
|
|
1896
|
-
] },
|
|
2091
|
+
] }, i.join("-"));
|
|
1897
2092
|
}
|
|
1898
|
-
function
|
|
2093
|
+
function kt({
|
|
1899
2094
|
initialMatcher: e,
|
|
1900
2095
|
defaultValue: s,
|
|
1901
2096
|
pathPrefix: n,
|
|
1902
2097
|
hasResourceSelector: l,
|
|
1903
|
-
infos:
|
|
1904
|
-
remainingKeys:
|
|
2098
|
+
infos: r,
|
|
2099
|
+
remainingKeys: o
|
|
1905
2100
|
}) {
|
|
1906
|
-
const [
|
|
1907
|
-
return
|
|
1908
|
-
u(`${n}.${e}`,
|
|
1909
|
-
}, [
|
|
2101
|
+
const [a, i] = v(s), { setPath: u } = f();
|
|
2102
|
+
return T(() => {
|
|
2103
|
+
u(`${n}.${e}`, a);
|
|
2104
|
+
}, [a]), /* @__PURE__ */ t.jsx(
|
|
1910
2105
|
I,
|
|
1911
2106
|
{
|
|
1912
2107
|
label: /* @__PURE__ */ t.jsx(
|
|
@@ -1915,27 +2110,27 @@ function wt({
|
|
|
1915
2110
|
className: "inline-flex",
|
|
1916
2111
|
menuPosition: "bottom-left",
|
|
1917
2112
|
dropdownItems: [
|
|
1918
|
-
|
|
1919
|
-
|
|
2113
|
+
o.map((c) => /* @__PURE__ */ t.jsx(
|
|
2114
|
+
$,
|
|
1920
2115
|
{
|
|
1921
2116
|
onClick: () => {
|
|
1922
|
-
u(`${n}.${c}`,
|
|
2117
|
+
u(`${n}.${c}`, a), u(`${n}.${e}`, null);
|
|
1923
2118
|
},
|
|
1924
|
-
label:
|
|
2119
|
+
label: M[c].label
|
|
1925
2120
|
},
|
|
1926
2121
|
c
|
|
1927
2122
|
)),
|
|
1928
2123
|
/* @__PURE__ */ t.jsx(
|
|
1929
2124
|
z,
|
|
1930
2125
|
{
|
|
1931
|
-
hidden:
|
|
2126
|
+
hidden: o.length === 0
|
|
1932
2127
|
},
|
|
1933
2128
|
"divider"
|
|
1934
2129
|
),
|
|
1935
2130
|
/* @__PURE__ */ t.jsx(
|
|
1936
|
-
|
|
2131
|
+
$,
|
|
1937
2132
|
{
|
|
1938
|
-
disabled:
|
|
2133
|
+
disabled: o.length === Object.keys(M).length - 1,
|
|
1939
2134
|
onClick: () => {
|
|
1940
2135
|
u(`${n}.${e}`, null);
|
|
1941
2136
|
},
|
|
@@ -1945,15 +2140,15 @@ function wt({
|
|
|
1945
2140
|
)
|
|
1946
2141
|
],
|
|
1947
2142
|
dropdownLabel: /* @__PURE__ */ t.jsx("button", { type: "button", children: /* @__PURE__ */ t.jsxs(
|
|
1948
|
-
|
|
2143
|
+
C,
|
|
1949
2144
|
{
|
|
1950
2145
|
variant: "info",
|
|
1951
2146
|
size: "small",
|
|
1952
2147
|
className: "flex gap-2 items-center",
|
|
1953
2148
|
children: [
|
|
1954
|
-
|
|
2149
|
+
M[e].label,
|
|
1955
2150
|
" ",
|
|
1956
|
-
/* @__PURE__ */ t.jsx(
|
|
2151
|
+
/* @__PURE__ */ t.jsx(j, { name: "caretDown" })
|
|
1957
2152
|
]
|
|
1958
2153
|
}
|
|
1959
2154
|
) })
|
|
@@ -1962,11 +2157,11 @@ function wt({
|
|
|
1962
2157
|
children: l ? /* @__PURE__ */ t.jsx(
|
|
1963
2158
|
Ce,
|
|
1964
2159
|
{
|
|
1965
|
-
infos:
|
|
1966
|
-
value:
|
|
2160
|
+
infos: r,
|
|
2161
|
+
value: a,
|
|
1967
2162
|
pathKey: `${n}.${e}`,
|
|
1968
2163
|
onSelect: (c) => {
|
|
1969
|
-
E(c) &&
|
|
2164
|
+
E(c) && i(
|
|
1970
2165
|
c.map(
|
|
1971
2166
|
(d) => typeof d.value == "boolean" ? d.value.toString() : d.value
|
|
1972
2167
|
)
|
|
@@ -1974,18 +2169,18 @@ function wt({
|
|
|
1974
2169
|
}
|
|
1975
2170
|
}
|
|
1976
2171
|
) : /* @__PURE__ */ t.jsx(
|
|
1977
|
-
|
|
2172
|
+
x,
|
|
1978
2173
|
{
|
|
1979
2174
|
isMulti: !0,
|
|
1980
2175
|
isCreatable: !0,
|
|
1981
2176
|
placeholder: "Enter value",
|
|
1982
|
-
defaultValue: (Array.isArray(
|
|
2177
|
+
defaultValue: (Array.isArray(a) ? a : []).map((c) => ({
|
|
1983
2178
|
value: c,
|
|
1984
2179
|
label: c.toString()
|
|
1985
2180
|
})),
|
|
1986
2181
|
initialValues: [],
|
|
1987
2182
|
onSelect: (c) => {
|
|
1988
|
-
E(c) &&
|
|
2183
|
+
E(c) && i(
|
|
1989
2184
|
c.map(
|
|
1990
2185
|
(d) => typeof d.value == "boolean" ? d.value.toString() : d.value
|
|
1991
2186
|
)
|
|
@@ -1996,92 +2191,92 @@ function wt({
|
|
|
1996
2191
|
}
|
|
1997
2192
|
);
|
|
1998
2193
|
}
|
|
1999
|
-
function
|
|
2194
|
+
function Ot({
|
|
2000
2195
|
value: e,
|
|
2001
2196
|
onChange: s
|
|
2002
2197
|
}) {
|
|
2003
|
-
const [n, l] =
|
|
2198
|
+
const [n, l] = v(
|
|
2004
2199
|
Array.isArray(e) && typeof e[0] == "number" ? e[0] : null
|
|
2005
|
-
), [
|
|
2200
|
+
), [r, o] = v(
|
|
2006
2201
|
Array.isArray(e) && typeof e[1] == "number" ? e[1] : null
|
|
2007
2202
|
);
|
|
2008
2203
|
return /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-4", children: [
|
|
2009
2204
|
/* @__PURE__ */ t.jsx("div", { className: "grow", children: /* @__PURE__ */ t.jsx(
|
|
2010
|
-
|
|
2205
|
+
y,
|
|
2011
2206
|
{
|
|
2012
2207
|
type: "number",
|
|
2013
2208
|
placeholder: "Min",
|
|
2014
2209
|
value: n ?? "",
|
|
2015
|
-
onChange: (
|
|
2016
|
-
const
|
|
2017
|
-
l(Number.isNaN(
|
|
2210
|
+
onChange: (a) => {
|
|
2211
|
+
const i = parseInt(a.currentTarget.value, 10);
|
|
2212
|
+
l(Number.isNaN(i) ? null : i), s([Number.isNaN(i) ? null : i, r]);
|
|
2018
2213
|
}
|
|
2019
2214
|
}
|
|
2020
2215
|
) }),
|
|
2021
2216
|
/* @__PURE__ */ t.jsx("span", { className: "text-gray-300", children: "to" }),
|
|
2022
2217
|
/* @__PURE__ */ t.jsx("div", { className: "grow", children: /* @__PURE__ */ t.jsx(
|
|
2023
|
-
|
|
2218
|
+
y,
|
|
2024
2219
|
{
|
|
2025
2220
|
type: "number",
|
|
2026
2221
|
placeholder: "Max",
|
|
2027
|
-
value:
|
|
2028
|
-
onChange: (
|
|
2029
|
-
const
|
|
2030
|
-
|
|
2222
|
+
value: r ?? "",
|
|
2223
|
+
onChange: (a) => {
|
|
2224
|
+
const i = parseInt(a.currentTarget.value, 10);
|
|
2225
|
+
o(Number.isNaN(i) ? null : i), s([n, Number.isNaN(i) ? null : i]);
|
|
2031
2226
|
}
|
|
2032
2227
|
}
|
|
2033
2228
|
) })
|
|
2034
2229
|
] });
|
|
2035
2230
|
}
|
|
2036
|
-
function
|
|
2231
|
+
function Rt({
|
|
2037
2232
|
value: e,
|
|
2038
2233
|
onChange: s
|
|
2039
2234
|
}) {
|
|
2040
|
-
const [n, l] =
|
|
2235
|
+
const [n, l] = v(
|
|
2041
2236
|
Array.isArray(e) && typeof e[0] == "string" ? e[0] : null
|
|
2042
|
-
), [
|
|
2237
|
+
), [r, o] = v(
|
|
2043
2238
|
Array.isArray(e) && typeof e[1] == "string" ? e[1] : null
|
|
2044
2239
|
);
|
|
2045
2240
|
return /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-4", children: [
|
|
2046
2241
|
/* @__PURE__ */ t.jsx("div", { className: "grow", children: /* @__PURE__ */ t.jsx(
|
|
2047
|
-
|
|
2242
|
+
y,
|
|
2048
2243
|
{
|
|
2049
2244
|
type: "text",
|
|
2050
2245
|
placeholder: "Min",
|
|
2051
2246
|
value: n ?? "",
|
|
2052
|
-
onChange: (
|
|
2053
|
-
const
|
|
2054
|
-
l(
|
|
2247
|
+
onChange: (a) => {
|
|
2248
|
+
const i = a.currentTarget.value;
|
|
2249
|
+
l(i), s([i, r]);
|
|
2055
2250
|
}
|
|
2056
2251
|
}
|
|
2057
2252
|
) }),
|
|
2058
2253
|
/* @__PURE__ */ t.jsx("span", { className: "text-gray-300", children: "to" }),
|
|
2059
2254
|
/* @__PURE__ */ t.jsx("div", { className: "grow", children: /* @__PURE__ */ t.jsx(
|
|
2060
|
-
|
|
2255
|
+
y,
|
|
2061
2256
|
{
|
|
2062
2257
|
type: "text",
|
|
2063
2258
|
placeholder: "Max",
|
|
2064
|
-
value:
|
|
2065
|
-
onChange: (
|
|
2066
|
-
const
|
|
2067
|
-
|
|
2259
|
+
value: r ?? "",
|
|
2260
|
+
onChange: (a) => {
|
|
2261
|
+
const i = a.currentTarget.value;
|
|
2262
|
+
o(i), s([n, i]);
|
|
2068
2263
|
}
|
|
2069
2264
|
}
|
|
2070
2265
|
) })
|
|
2071
2266
|
] });
|
|
2072
2267
|
}
|
|
2073
|
-
function
|
|
2268
|
+
function Vt({
|
|
2074
2269
|
item: e,
|
|
2075
2270
|
pathPrefix: s
|
|
2076
2271
|
}) {
|
|
2077
|
-
const { setPath: n } = f(), { componentType: l, fieldType:
|
|
2272
|
+
const { setPath: n } = f(), { componentType: l, fieldType: r } = Mt(e), o = `${s}.value`, [a, i] = v(0), [u, c] = v({
|
|
2078
2273
|
componentType: l,
|
|
2079
2274
|
matcher: e?.matcher,
|
|
2080
2275
|
field: e?.field
|
|
2081
2276
|
}), d = e == null || ie.includes(
|
|
2082
2277
|
e.matcher
|
|
2083
2278
|
);
|
|
2084
|
-
return
|
|
2279
|
+
return T(
|
|
2085
2280
|
function() {
|
|
2086
2281
|
u.componentType !== l && (c((p) => ({
|
|
2087
2282
|
...p,
|
|
@@ -2089,35 +2284,35 @@ function St({
|
|
|
2089
2284
|
})), u.matcher !== e?.matcher && (c((p) => ({
|
|
2090
2285
|
...p,
|
|
2091
2286
|
matcher: e?.matcher
|
|
2092
|
-
})), e?.matcher === "array_match" ? n(
|
|
2287
|
+
})), e?.matcher === "array_match" ? n(o, { in_and: [] }) : n(o, null), i((p) => p + 1))), u.field !== e?.field && (c((p) => ({
|
|
2093
2288
|
...p,
|
|
2094
2289
|
field: e?.field
|
|
2095
|
-
})), n(
|
|
2290
|
+
})), n(o, null), i((p) => p + 1));
|
|
2096
2291
|
},
|
|
2097
2292
|
[e]
|
|
2098
2293
|
), d ? null : l === "arrayMatch" || l === "resourceSelector" && e?.matcher === "array_match" ? /* @__PURE__ */ t.jsx("div", { children: /* @__PURE__ */ t.jsx(
|
|
2099
2294
|
ne,
|
|
2100
2295
|
{
|
|
2101
2296
|
item: e,
|
|
2102
|
-
fieldType:
|
|
2297
|
+
fieldType: r,
|
|
2103
2298
|
componentType: l,
|
|
2104
|
-
pathKey:
|
|
2299
|
+
pathKey: o
|
|
2105
2300
|
}
|
|
2106
|
-
) },
|
|
2301
|
+
) }, a) : /* @__PURE__ */ t.jsx(
|
|
2107
2302
|
I,
|
|
2108
2303
|
{
|
|
2109
|
-
label: /* @__PURE__ */ t.jsx(
|
|
2304
|
+
label: /* @__PURE__ */ t.jsx(C, { variant: "info", size: "small", children: "Value" }),
|
|
2110
2305
|
children: /* @__PURE__ */ t.jsx(
|
|
2111
2306
|
ne,
|
|
2112
2307
|
{
|
|
2113
2308
|
item: e,
|
|
2114
|
-
fieldType:
|
|
2309
|
+
fieldType: r,
|
|
2115
2310
|
componentType: l,
|
|
2116
|
-
pathKey:
|
|
2311
|
+
pathKey: o
|
|
2117
2312
|
}
|
|
2118
2313
|
)
|
|
2119
2314
|
},
|
|
2120
|
-
|
|
2315
|
+
a
|
|
2121
2316
|
);
|
|
2122
2317
|
}
|
|
2123
2318
|
function ne({
|
|
@@ -2126,10 +2321,10 @@ function ne({
|
|
|
2126
2321
|
componentType: n,
|
|
2127
2322
|
pathKey: l
|
|
2128
2323
|
}) {
|
|
2129
|
-
const { setPath:
|
|
2324
|
+
const { setPath: r } = f(), { user: o } = ue(), { infos: a } = J(e), i = Te(e) ? e.value : void 0;
|
|
2130
2325
|
switch (n) {
|
|
2131
2326
|
case "date": {
|
|
2132
|
-
const u =
|
|
2327
|
+
const u = Q(typeof i == "string" ? i : "");
|
|
2133
2328
|
return /* @__PURE__ */ t.jsx(
|
|
2134
2329
|
Fe,
|
|
2135
2330
|
{
|
|
@@ -2137,15 +2332,15 @@ function ne({
|
|
|
2137
2332
|
showTimeSelect: !0,
|
|
2138
2333
|
placeholder: "Enter value",
|
|
2139
2334
|
onChange: (c) => {
|
|
2140
|
-
|
|
2335
|
+
r(l, c?.toJSON());
|
|
2141
2336
|
},
|
|
2142
|
-
timezone:
|
|
2337
|
+
timezone: o?.timezone
|
|
2143
2338
|
}
|
|
2144
2339
|
);
|
|
2145
2340
|
}
|
|
2146
2341
|
case "dateRange": {
|
|
2147
|
-
const u = Array.isArray(
|
|
2148
|
-
const d =
|
|
2342
|
+
const u = Array.isArray(i) ? i.map((c) => {
|
|
2343
|
+
const d = Q(typeof c == "string" ? c : "");
|
|
2149
2344
|
return L(d) ? d : null;
|
|
2150
2345
|
}) : [null, null];
|
|
2151
2346
|
return /* @__PURE__ */ t.jsx(
|
|
@@ -2154,7 +2349,7 @@ function ne({
|
|
|
2154
2349
|
value: u,
|
|
2155
2350
|
showTimeSelect: !0,
|
|
2156
2351
|
onChange: (c) => {
|
|
2157
|
-
|
|
2352
|
+
r(
|
|
2158
2353
|
l,
|
|
2159
2354
|
c.map((d) => d?.toJSON() ?? null)
|
|
2160
2355
|
);
|
|
@@ -2164,40 +2359,40 @@ function ne({
|
|
|
2164
2359
|
}
|
|
2165
2360
|
case "numberRange":
|
|
2166
2361
|
return /* @__PURE__ */ t.jsx(
|
|
2167
|
-
|
|
2362
|
+
Ot,
|
|
2168
2363
|
{
|
|
2169
|
-
value:
|
|
2364
|
+
value: i,
|
|
2170
2365
|
onChange: (u) => {
|
|
2171
|
-
|
|
2366
|
+
r(l, u);
|
|
2172
2367
|
}
|
|
2173
2368
|
}
|
|
2174
2369
|
);
|
|
2175
2370
|
case "textRange":
|
|
2176
2371
|
return /* @__PURE__ */ t.jsx(
|
|
2177
|
-
|
|
2372
|
+
Rt,
|
|
2178
2373
|
{
|
|
2179
|
-
value:
|
|
2374
|
+
value: i,
|
|
2180
2375
|
onChange: (u) => {
|
|
2181
|
-
|
|
2376
|
+
r(l, u);
|
|
2182
2377
|
}
|
|
2183
2378
|
}
|
|
2184
2379
|
);
|
|
2185
2380
|
case "arrayMatch":
|
|
2186
|
-
return /* @__PURE__ */ t.jsx(te, { infos:
|
|
2381
|
+
return /* @__PURE__ */ t.jsx(te, { infos: a, value: i, pathPrefix: l });
|
|
2187
2382
|
case "tag":
|
|
2188
2383
|
return /* @__PURE__ */ t.jsx(
|
|
2189
|
-
|
|
2384
|
+
x,
|
|
2190
2385
|
{
|
|
2191
2386
|
isMulti: !0,
|
|
2192
2387
|
isClearable: !1,
|
|
2193
2388
|
isCreatable: !0,
|
|
2194
|
-
defaultValue: Array.isArray(
|
|
2389
|
+
defaultValue: Array.isArray(i) ? i.map((u) => ({
|
|
2195
2390
|
label: u.toString(),
|
|
2196
2391
|
value: u
|
|
2197
2392
|
})) : [],
|
|
2198
2393
|
initialValues: [],
|
|
2199
2394
|
onSelect: (u) => {
|
|
2200
|
-
E(u) &&
|
|
2395
|
+
E(u) && r(
|
|
2201
2396
|
l,
|
|
2202
2397
|
u.map((c) => {
|
|
2203
2398
|
if (s === "integer") {
|
|
@@ -2214,59 +2409,59 @@ function ne({
|
|
|
2214
2409
|
return e?.matcher === "array_match" ? /* @__PURE__ */ t.jsx(
|
|
2215
2410
|
te,
|
|
2216
2411
|
{
|
|
2217
|
-
infos:
|
|
2218
|
-
value:
|
|
2412
|
+
infos: a,
|
|
2413
|
+
value: i,
|
|
2219
2414
|
pathPrefix: l,
|
|
2220
2415
|
hasResourceSelector: !0
|
|
2221
2416
|
}
|
|
2222
|
-
) : /* @__PURE__ */ t.jsx(Ce, { infos:
|
|
2417
|
+
) : /* @__PURE__ */ t.jsx(Ce, { infos: a, value: i, pathKey: l });
|
|
2223
2418
|
case "number":
|
|
2224
2419
|
return /* @__PURE__ */ t.jsx(
|
|
2225
|
-
|
|
2420
|
+
y,
|
|
2226
2421
|
{
|
|
2227
2422
|
name: l,
|
|
2228
2423
|
type: "number",
|
|
2229
|
-
defaultValue: typeof
|
|
2424
|
+
defaultValue: typeof i == "number" ? i : "",
|
|
2230
2425
|
placeholder: "Enter value",
|
|
2231
2426
|
onChange: (u) => {
|
|
2232
|
-
|
|
2427
|
+
r(l, parseInt(u.currentTarget.value, 10));
|
|
2233
2428
|
}
|
|
2234
2429
|
}
|
|
2235
2430
|
);
|
|
2236
2431
|
case "boolean":
|
|
2237
2432
|
return /* @__PURE__ */ t.jsx(
|
|
2238
|
-
|
|
2433
|
+
x,
|
|
2239
2434
|
{
|
|
2240
2435
|
name: l,
|
|
2241
|
-
defaultValue: typeof
|
|
2242
|
-
label:
|
|
2243
|
-
value:
|
|
2436
|
+
defaultValue: typeof i == "boolean" ? {
|
|
2437
|
+
label: i ? "Yes" : "No",
|
|
2438
|
+
value: i
|
|
2244
2439
|
} : void 0,
|
|
2245
2440
|
initialValues: [
|
|
2246
2441
|
{ label: "Yes", value: !0 },
|
|
2247
2442
|
{ label: "No", value: !1 }
|
|
2248
2443
|
],
|
|
2249
2444
|
onSelect: (u) => {
|
|
2250
|
-
|
|
2445
|
+
_(u) && r(l, u.value);
|
|
2251
2446
|
}
|
|
2252
2447
|
}
|
|
2253
2448
|
);
|
|
2254
2449
|
case "text":
|
|
2255
2450
|
case null:
|
|
2256
2451
|
return /* @__PURE__ */ t.jsx(
|
|
2257
|
-
|
|
2452
|
+
y,
|
|
2258
2453
|
{
|
|
2259
2454
|
name: l,
|
|
2260
2455
|
type: "text",
|
|
2261
|
-
defaultValue: typeof
|
|
2456
|
+
defaultValue: typeof i == "string" ? i : JSON.stringify(i),
|
|
2262
2457
|
placeholder: "Enter value",
|
|
2263
2458
|
onChange: (u) => {
|
|
2264
|
-
|
|
2459
|
+
r(l, u.currentTarget.value);
|
|
2265
2460
|
}
|
|
2266
2461
|
}
|
|
2267
2462
|
);
|
|
2268
2463
|
default:
|
|
2269
|
-
return
|
|
2464
|
+
return oe();
|
|
2270
2465
|
}
|
|
2271
2466
|
}
|
|
2272
2467
|
function Te(e) {
|
|
@@ -2336,30 +2531,30 @@ function At(e, s, n) {
|
|
|
2336
2531
|
}
|
|
2337
2532
|
return n?.resourceSelectorAvailable && (l = "resourceSelector"), l;
|
|
2338
2533
|
}
|
|
2339
|
-
function
|
|
2340
|
-
const { infos: s } =
|
|
2534
|
+
function Mt(e) {
|
|
2535
|
+
const { infos: s } = J(e);
|
|
2341
2536
|
let n = s?.field?.type;
|
|
2342
|
-
Te(e) && (n == null && (n =
|
|
2537
|
+
Te(e) && (n == null && (n = ge(e.value)), (typeof e.value == "string" && /^{{.*}}$/.test(e.value) || Array.isArray(e.value) && e.value.some((r) => typeof r == "string" && /^{{.*}}$/.test(r))) && (n = "string"));
|
|
2343
2538
|
const l = At(n, e?.matcher, s);
|
|
2344
2539
|
return { fieldType: n, componentType: l };
|
|
2345
2540
|
}
|
|
2346
|
-
function
|
|
2541
|
+
function Et({
|
|
2347
2542
|
item: e,
|
|
2348
2543
|
nestingLevel: s,
|
|
2349
2544
|
pathPrefix: n,
|
|
2350
2545
|
onDelete: l
|
|
2351
2546
|
}) {
|
|
2352
|
-
const { setPath:
|
|
2547
|
+
const { setPath: r, setRenderOption: o, optionsConfig: a } = f(), { available: i } = Ne(
|
|
2353
2548
|
e,
|
|
2354
|
-
|
|
2549
|
+
a.conditions
|
|
2355
2550
|
), u = [];
|
|
2356
2551
|
return s < 2 && (u[0] ??= [], u[0].push(
|
|
2357
2552
|
/* @__PURE__ */ t.jsx(
|
|
2358
|
-
|
|
2553
|
+
$,
|
|
2359
2554
|
{
|
|
2360
2555
|
label: "Nest conditions",
|
|
2361
2556
|
onClick: () => {
|
|
2362
|
-
|
|
2557
|
+
r(
|
|
2363
2558
|
`${n}.nested.conditions.${(e?.nested?.conditions ?? []).length}`,
|
|
2364
2559
|
void 0
|
|
2365
2560
|
);
|
|
@@ -2368,49 +2563,49 @@ function kt({
|
|
|
2368
2563
|
)
|
|
2369
2564
|
)), l != null && (u[1] ??= [], u[1].push(
|
|
2370
2565
|
/* @__PURE__ */ t.jsx(
|
|
2371
|
-
|
|
2566
|
+
$,
|
|
2372
2567
|
{
|
|
2373
2568
|
label: "Delete",
|
|
2374
2569
|
onClick: () => {
|
|
2375
|
-
|
|
2570
|
+
r(`${n}`, null), o(`${n}`, null), l();
|
|
2376
2571
|
}
|
|
2377
2572
|
}
|
|
2378
2573
|
)
|
|
2379
2574
|
)), /* @__PURE__ */ t.jsx("div", { children: /* @__PURE__ */ t.jsxs(
|
|
2380
|
-
|
|
2575
|
+
me,
|
|
2381
2576
|
{
|
|
2382
2577
|
pathPrefix: n,
|
|
2383
2578
|
dropdownItems: u.map((c, d, m) => (
|
|
2384
2579
|
// biome-ignore lint/suspicious/noArrayIndexKey: Using index as key is acceptable here since items are static
|
|
2385
|
-
/* @__PURE__ */ t.jsxs(
|
|
2580
|
+
/* @__PURE__ */ t.jsxs(K.Fragment, { children: [
|
|
2386
2581
|
c.map((h, p) => (
|
|
2387
2582
|
// biome-ignore lint/suspicious/noArrayIndexKey: Using index as key is acceptable here since items are static
|
|
2388
|
-
/* @__PURE__ */ t.jsx(
|
|
2583
|
+
/* @__PURE__ */ t.jsx(K.Fragment, { children: h }, p)
|
|
2389
2584
|
)),
|
|
2390
2585
|
d < m.length - 1 && /* @__PURE__ */ t.jsx(z, {})
|
|
2391
2586
|
] }, d)
|
|
2392
2587
|
)),
|
|
2393
2588
|
options: !H(e?.field) && !H(e?.matcher) && /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
2394
|
-
/* @__PURE__ */ t.jsx(
|
|
2395
|
-
/* @__PURE__ */ t.jsx(
|
|
2396
|
-
|
|
2589
|
+
/* @__PURE__ */ t.jsx(Vt, { item: e, pathPrefix: n }),
|
|
2590
|
+
/* @__PURE__ */ t.jsx(vt, { item: e, pathPrefix: n }),
|
|
2591
|
+
i.length > 0 && /* @__PURE__ */ t.jsx(
|
|
2397
2592
|
S,
|
|
2398
2593
|
{
|
|
2399
2594
|
className: "inline-flex mt-6",
|
|
2400
2595
|
menuPosition: "bottom-left",
|
|
2401
|
-
dropdownItems:
|
|
2402
|
-
|
|
2596
|
+
dropdownItems: i.map((c) => /* @__PURE__ */ t.jsx(
|
|
2597
|
+
$,
|
|
2403
2598
|
{
|
|
2404
2599
|
onClick: () => {
|
|
2405
2600
|
switch (c.name) {
|
|
2406
2601
|
case "scope":
|
|
2407
|
-
|
|
2602
|
+
r(`${n}.scope`, "any");
|
|
2408
2603
|
break;
|
|
2409
2604
|
case "aggregations":
|
|
2410
|
-
|
|
2605
|
+
r(`${n}.aggregations`, [{}]);
|
|
2411
2606
|
break;
|
|
2412
2607
|
case "group":
|
|
2413
|
-
|
|
2608
|
+
r(`${n}.group`, null, !0);
|
|
2414
2609
|
break;
|
|
2415
2610
|
}
|
|
2416
2611
|
},
|
|
@@ -2418,17 +2613,17 @@ function kt({
|
|
|
2418
2613
|
},
|
|
2419
2614
|
`option-${c.name}`
|
|
2420
2615
|
)),
|
|
2421
|
-
dropdownLabel: /* @__PURE__ */ t.jsx("button", { type: "button", children: /* @__PURE__ */ t.jsxs(
|
|
2422
|
-
/* @__PURE__ */ t.jsx(
|
|
2616
|
+
dropdownLabel: /* @__PURE__ */ t.jsx("button", { type: "button", children: /* @__PURE__ */ t.jsxs(C, { className: "flex gap-2 items-center", children: [
|
|
2617
|
+
/* @__PURE__ */ t.jsx(C, { weight: "bold", size: "small", children: "Add option" }),
|
|
2423
2618
|
" ",
|
|
2424
|
-
/* @__PURE__ */ t.jsx(
|
|
2619
|
+
/* @__PURE__ */ t.jsx(j, { name: "caretDown" })
|
|
2425
2620
|
] }) })
|
|
2426
2621
|
}
|
|
2427
2622
|
)
|
|
2428
2623
|
] }),
|
|
2429
2624
|
children: [
|
|
2430
|
-
/* @__PURE__ */ t.jsx("div", { className: "flex-1", children: /* @__PURE__ */ t.jsx(
|
|
2431
|
-
/* @__PURE__ */ t.jsx("div", { children: /* @__PURE__ */ t.jsx(
|
|
2625
|
+
/* @__PURE__ */ t.jsx("div", { className: "flex-1", children: /* @__PURE__ */ t.jsx(Ct, { value: e?.field, name: `${n}.field` }) }),
|
|
2626
|
+
/* @__PURE__ */ t.jsx("div", { children: /* @__PURE__ */ t.jsx(St, { item: e, pathPrefix: n }) })
|
|
2432
2627
|
]
|
|
2433
2628
|
}
|
|
2434
2629
|
) });
|
|
@@ -2440,12 +2635,12 @@ function Se({
|
|
|
2440
2635
|
pathPrefix: l
|
|
2441
2636
|
}) {
|
|
2442
2637
|
const {
|
|
2443
|
-
state: { selectedRuleIndex:
|
|
2444
|
-
} = f(),
|
|
2638
|
+
state: { selectedRuleIndex: r }
|
|
2639
|
+
} = f(), o = e?.conditions_logic?.toLowerCase() ?? "and", { setPath: a } = f(), [i, u] = v(0), c = n > 0;
|
|
2445
2640
|
return /* @__PURE__ */ t.jsxs(
|
|
2446
2641
|
"div",
|
|
2447
2642
|
{
|
|
2448
|
-
className:
|
|
2643
|
+
className: k("query-group", {
|
|
2449
2644
|
"p-4 border border-gray-200 rounded-md": c
|
|
2450
2645
|
}),
|
|
2451
2646
|
children: [
|
|
@@ -2455,12 +2650,12 @@ function Se({
|
|
|
2455
2650
|
"select",
|
|
2456
2651
|
{
|
|
2457
2652
|
onChange: (d) => {
|
|
2458
|
-
|
|
2653
|
+
a(
|
|
2459
2654
|
`${l}.conditions_logic`,
|
|
2460
2655
|
d.currentTarget.value
|
|
2461
2656
|
);
|
|
2462
2657
|
},
|
|
2463
|
-
defaultValue:
|
|
2658
|
+
defaultValue: o,
|
|
2464
2659
|
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",
|
|
2465
2660
|
children: [
|
|
2466
2661
|
/* @__PURE__ */ t.jsx("option", { value: "and", children: "Nested in AND" }),
|
|
@@ -2471,7 +2666,7 @@ function Se({
|
|
|
2471
2666
|
/* @__PURE__ */ t.jsx(
|
|
2472
2667
|
"div",
|
|
2473
2668
|
{
|
|
2474
|
-
className:
|
|
2669
|
+
className: k({
|
|
2475
2670
|
"border-l border-gray-200 ml-3 pt-3": c
|
|
2476
2671
|
}),
|
|
2477
2672
|
children: e?.conditions?.map((d, m, h) => {
|
|
@@ -2481,11 +2676,11 @@ function Se({
|
|
|
2481
2676
|
{
|
|
2482
2677
|
className: "flex items-center mb-4 last:mb-0 relative",
|
|
2483
2678
|
children: [
|
|
2484
|
-
c && /* @__PURE__ */ t.jsx(
|
|
2679
|
+
c && /* @__PURE__ */ t.jsx(It, { rounded: p }),
|
|
2485
2680
|
/* @__PURE__ */ t.jsx(
|
|
2486
2681
|
"div",
|
|
2487
2682
|
{
|
|
2488
|
-
className:
|
|
2683
|
+
className: k("w-full", {
|
|
2489
2684
|
"ml-4": c
|
|
2490
2685
|
}),
|
|
2491
2686
|
children: /* @__PURE__ */ t.jsx(
|
|
@@ -2497,17 +2692,17 @@ function Se({
|
|
|
2497
2692
|
children: /* @__PURE__ */ t.jsx(
|
|
2498
2693
|
"div",
|
|
2499
2694
|
{
|
|
2500
|
-
className:
|
|
2695
|
+
className: k({
|
|
2501
2696
|
"mb-4": d?.nested != null
|
|
2502
2697
|
}),
|
|
2503
2698
|
children: /* @__PURE__ */ t.jsx(
|
|
2504
|
-
|
|
2699
|
+
Et,
|
|
2505
2700
|
{
|
|
2506
2701
|
item: d,
|
|
2507
2702
|
nestingLevel: n,
|
|
2508
2703
|
pathPrefix: `${l}.conditions.${m}`,
|
|
2509
2704
|
onDelete: h.length > 1 || n > 0 ? () => {
|
|
2510
|
-
u((
|
|
2705
|
+
u((g) => g + 1);
|
|
2511
2706
|
} : void 0
|
|
2512
2707
|
}
|
|
2513
2708
|
)
|
|
@@ -2519,24 +2714,24 @@ function Se({
|
|
|
2519
2714
|
)
|
|
2520
2715
|
]
|
|
2521
2716
|
},
|
|
2522
|
-
`${
|
|
2717
|
+
`${r}-${m}-${i}`
|
|
2523
2718
|
);
|
|
2524
2719
|
})
|
|
2525
2720
|
}
|
|
2526
2721
|
),
|
|
2527
2722
|
c && /* @__PURE__ */ t.jsx(
|
|
2528
|
-
|
|
2723
|
+
O,
|
|
2529
2724
|
{
|
|
2530
2725
|
variant: "link",
|
|
2531
2726
|
className: "ml-7 mt-4 text-sm font-bold !no-underline",
|
|
2532
2727
|
onClick: () => {
|
|
2533
|
-
|
|
2728
|
+
a(
|
|
2534
2729
|
`${l}.conditions.${e?.conditions?.length ?? 0}`,
|
|
2535
2730
|
void 0
|
|
2536
2731
|
);
|
|
2537
2732
|
},
|
|
2538
|
-
children: /* @__PURE__ */ t.jsxs(
|
|
2539
|
-
/* @__PURE__ */ t.jsx(
|
|
2733
|
+
children: /* @__PURE__ */ t.jsxs(C, { className: "flex items-center gap-1", children: [
|
|
2734
|
+
/* @__PURE__ */ t.jsx(j, { name: "plus" }),
|
|
2540
2735
|
" Add condition"
|
|
2541
2736
|
] })
|
|
2542
2737
|
}
|
|
@@ -2546,7 +2741,7 @@ function Se({
|
|
|
2546
2741
|
}
|
|
2547
2742
|
);
|
|
2548
2743
|
}
|
|
2549
|
-
function
|
|
2744
|
+
function It({
|
|
2550
2745
|
rounded: e = !1
|
|
2551
2746
|
}) {
|
|
2552
2747
|
return e ? /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
@@ -2554,15 +2749,15 @@ function Mt({
|
|
|
2554
2749
|
/* @__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" })
|
|
2555
2750
|
] }) : /* @__PURE__ */ t.jsx("div", { className: "absolute left-0 top-1/2 -translate-y-1/2 w-3.5 h-px bg-gray-200" });
|
|
2556
2751
|
}
|
|
2557
|
-
function
|
|
2752
|
+
function qt() {
|
|
2558
2753
|
const {
|
|
2559
2754
|
setPath: e,
|
|
2560
2755
|
state: { value: s, selectedRuleIndex: n }
|
|
2561
|
-
} = f(), [l,
|
|
2756
|
+
} = f(), [l, r] = v(
|
|
2562
2757
|
s.rules?.[n]?.name ?? ""
|
|
2563
2758
|
);
|
|
2564
|
-
return
|
|
2565
|
-
|
|
2759
|
+
return T(() => {
|
|
2760
|
+
r(s.rules?.[n]?.name ?? "");
|
|
2566
2761
|
}, [n]), // <Input
|
|
2567
2762
|
// value={value.rules?.[selectedRuleIndex]?.name}
|
|
2568
2763
|
// onChange={(event) => {
|
|
@@ -2578,16 +2773,16 @@ function Rt() {
|
|
|
2578
2773
|
{
|
|
2579
2774
|
contentEditable: "plaintext-only",
|
|
2580
2775
|
suppressContentEditableWarning: !0,
|
|
2581
|
-
onInput: (
|
|
2582
|
-
const
|
|
2583
|
-
e(`rules.${n}.name`,
|
|
2776
|
+
onInput: (o) => {
|
|
2777
|
+
const i = o.currentTarget.innerText.replace(/[\n\s]+/g, " ").trim();
|
|
2778
|
+
e(`rules.${n}.name`, i);
|
|
2584
2779
|
},
|
|
2585
|
-
onKeyDown: (
|
|
2586
|
-
|
|
2780
|
+
onKeyDown: (o) => {
|
|
2781
|
+
o.key === "Enter" && (o.preventDefault(), o.currentTarget.blur());
|
|
2587
2782
|
},
|
|
2588
|
-
onBlur: (
|
|
2589
|
-
const
|
|
2590
|
-
|
|
2783
|
+
onBlur: (o) => {
|
|
2784
|
+
const a = o.currentTarget;
|
|
2785
|
+
a.innerText = a.innerText.replace(/[\n\s]+/g, " ").trim();
|
|
2591
2786
|
},
|
|
2592
2787
|
children: l
|
|
2593
2788
|
},
|
|
@@ -2602,32 +2797,32 @@ const se = {
|
|
|
2602
2797
|
} catch {
|
|
2603
2798
|
return se;
|
|
2604
2799
|
}
|
|
2605
|
-
},
|
|
2800
|
+
}, Dt = (e) => {
|
|
2606
2801
|
try {
|
|
2607
2802
|
return JSON.parse(e ?? "{}"), !0;
|
|
2608
2803
|
} catch {
|
|
2609
2804
|
return !1;
|
|
2610
2805
|
}
|
|
2611
2806
|
};
|
|
2612
|
-
function
|
|
2807
|
+
function Yt(e) {
|
|
2613
2808
|
const {
|
|
2614
2809
|
settings: { domain: s }
|
|
2615
|
-
} = ue(), [n, l] =
|
|
2810
|
+
} = ue(), [n, l] = v({
|
|
2616
2811
|
actions: {},
|
|
2617
2812
|
conditions: []
|
|
2618
|
-
}), [
|
|
2813
|
+
}), [r, o] = v(
|
|
2619
2814
|
F(e.value ?? e.defaultValue)
|
|
2620
2815
|
);
|
|
2621
|
-
return
|
|
2816
|
+
return T(
|
|
2622
2817
|
function() {
|
|
2623
|
-
|
|
2818
|
+
r.rules?.length === 0 && o(F(e.value));
|
|
2624
2819
|
},
|
|
2625
2820
|
[e.value]
|
|
2626
|
-
),
|
|
2821
|
+
), T(
|
|
2627
2822
|
function() {
|
|
2628
|
-
ze(e.schemaType, s).then((
|
|
2823
|
+
ze(e.schemaType, s).then((i) => {
|
|
2629
2824
|
const u = tt(
|
|
2630
|
-
|
|
2825
|
+
i,
|
|
2631
2826
|
e.schemaType
|
|
2632
2827
|
);
|
|
2633
2828
|
l(u);
|
|
@@ -2635,38 +2830,38 @@ function Jt(e) {
|
|
|
2635
2830
|
},
|
|
2636
2831
|
[s]
|
|
2637
2832
|
), /* @__PURE__ */ t.jsx(
|
|
2638
|
-
|
|
2833
|
+
Ke,
|
|
2639
2834
|
{
|
|
2640
2835
|
initialValue: {
|
|
2641
|
-
value: { rules:
|
|
2836
|
+
value: { rules: r.rules },
|
|
2642
2837
|
schemaType: e.schemaType,
|
|
2643
2838
|
optionsConfig: n
|
|
2644
2839
|
},
|
|
2645
|
-
children: /* @__PURE__ */ t.jsx(
|
|
2840
|
+
children: /* @__PURE__ */ t.jsx(Lt, { ...e })
|
|
2646
2841
|
}
|
|
2647
2842
|
);
|
|
2648
2843
|
}
|
|
2649
|
-
function
|
|
2844
|
+
function Lt(e) {
|
|
2650
2845
|
const {
|
|
2651
2846
|
state: { value: s, selectedRuleIndex: n },
|
|
2652
2847
|
setSelectedRuleIndex: l,
|
|
2653
|
-
setValue:
|
|
2654
|
-
setPath:
|
|
2655
|
-
} = f(), [
|
|
2848
|
+
setValue: r,
|
|
2849
|
+
setPath: o
|
|
2850
|
+
} = f(), [a, i] = v(!1), [u, c] = v(
|
|
2656
2851
|
e.defaultCodeEditorVisible ?? !1
|
|
2657
|
-
), d = s.rules?.[n], m = de(null), [h, p] =
|
|
2658
|
-
|
|
2852
|
+
), d = s.rules?.[n], m = de(null), [h, p] = v(0);
|
|
2853
|
+
T(
|
|
2659
2854
|
function() {
|
|
2660
|
-
!
|
|
2855
|
+
!a && !R(F(m.current?.getValue()), s) && (m.current?.setValue(JSON.stringify(s, null, 2)), e.onChange?.(s));
|
|
2661
2856
|
},
|
|
2662
2857
|
[s]
|
|
2663
2858
|
);
|
|
2664
|
-
const
|
|
2859
|
+
const g = A(
|
|
2665
2860
|
(w) => {
|
|
2666
|
-
const
|
|
2667
|
-
|
|
2861
|
+
const b = F(w);
|
|
2862
|
+
a && Dt(w) && !R(b, s) && (r(b), p((V) => V + 1), e.onChange?.(b));
|
|
2668
2863
|
},
|
|
2669
|
-
[s,
|
|
2864
|
+
[s, a]
|
|
2670
2865
|
);
|
|
2671
2866
|
return /* @__PURE__ */ t.jsx(
|
|
2672
2867
|
Ge,
|
|
@@ -2682,8 +2877,8 @@ function Et(e) {
|
|
|
2682
2877
|
children: [
|
|
2683
2878
|
/* @__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: [
|
|
2684
2879
|
/* @__PURE__ */ t.jsxs("div", { className: "flex items-center flex-wrap basis-full", children: [
|
|
2685
|
-
s.rules?.map((w,
|
|
2686
|
-
const
|
|
2880
|
+
s.rules?.map((w, b, V) => {
|
|
2881
|
+
const ke = `#${(b + 1).toString().padStart(2, "0")}`;
|
|
2687
2882
|
return /* @__PURE__ */ t.jsxs(
|
|
2688
2883
|
"div",
|
|
2689
2884
|
{
|
|
@@ -2693,42 +2888,42 @@ function Et(e) {
|
|
|
2693
2888
|
"button",
|
|
2694
2889
|
{
|
|
2695
2890
|
type: "button",
|
|
2696
|
-
className:
|
|
2697
|
-
"text-black": n ===
|
|
2891
|
+
className: k("font-bold mr-2", {
|
|
2892
|
+
"text-black": n === b
|
|
2698
2893
|
}),
|
|
2699
2894
|
onClick: () => {
|
|
2700
|
-
l(
|
|
2895
|
+
l(b);
|
|
2701
2896
|
},
|
|
2702
|
-
children:
|
|
2897
|
+
children: ke
|
|
2703
2898
|
}
|
|
2704
2899
|
),
|
|
2705
2900
|
/* @__PURE__ */ t.jsx(
|
|
2706
2901
|
S,
|
|
2707
2902
|
{
|
|
2708
|
-
menuPosition:
|
|
2709
|
-
dropdownLabel: /* @__PURE__ */ t.jsx(
|
|
2903
|
+
menuPosition: b === 0 ? "bottom-left" : "bottom-right",
|
|
2904
|
+
dropdownLabel: /* @__PURE__ */ t.jsx(O, { variant: "circle", children: /* @__PURE__ */ t.jsx(j, { name: "dotsThreeVertical", size: 16 }) }),
|
|
2710
2905
|
dropdownItems: /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
2711
2906
|
/* @__PURE__ */ t.jsx(
|
|
2712
|
-
|
|
2907
|
+
$,
|
|
2713
2908
|
{
|
|
2714
2909
|
onClick: () => {
|
|
2715
|
-
const
|
|
2716
|
-
|
|
2910
|
+
const B = s.rules?.length ?? 0;
|
|
2911
|
+
o(`rules.${B}`, {
|
|
2717
2912
|
...w,
|
|
2718
2913
|
id: void 0,
|
|
2719
2914
|
name: `${w.name} (copy)`
|
|
2720
|
-
}), l(
|
|
2915
|
+
}), l(B);
|
|
2721
2916
|
},
|
|
2722
2917
|
label: "Duplicate"
|
|
2723
2918
|
}
|
|
2724
2919
|
),
|
|
2725
2920
|
/* @__PURE__ */ t.jsx(z, {}),
|
|
2726
2921
|
/* @__PURE__ */ t.jsx(
|
|
2727
|
-
|
|
2922
|
+
$,
|
|
2728
2923
|
{
|
|
2729
|
-
disabled:
|
|
2924
|
+
disabled: V.length === 1,
|
|
2730
2925
|
onClick: () => {
|
|
2731
|
-
|
|
2926
|
+
o(`rules.${b}`, null), n >= b && l(n - 1);
|
|
2732
2927
|
},
|
|
2733
2928
|
label: "Delete"
|
|
2734
2929
|
}
|
|
@@ -2738,40 +2933,40 @@ function Et(e) {
|
|
|
2738
2933
|
)
|
|
2739
2934
|
]
|
|
2740
2935
|
},
|
|
2741
|
-
`${
|
|
2936
|
+
`${b}-${w.id}`
|
|
2742
2937
|
);
|
|
2743
2938
|
}),
|
|
2744
2939
|
/* @__PURE__ */ t.jsx("div", { className: "min-h-[49px] flex items-center", children: /* @__PURE__ */ t.jsx(
|
|
2745
|
-
|
|
2940
|
+
O,
|
|
2746
2941
|
{
|
|
2747
2942
|
variant: "circle",
|
|
2748
2943
|
className: "mx-4",
|
|
2749
2944
|
onClick: () => {
|
|
2750
|
-
|
|
2945
|
+
o(`rules.${s.rules?.length ?? 0}`, {
|
|
2751
2946
|
name: "Rule name",
|
|
2752
2947
|
actions: [null],
|
|
2753
2948
|
conditions: [null]
|
|
2754
2949
|
}), l(s.rules?.length ?? 0);
|
|
2755
2950
|
},
|
|
2756
|
-
children: /* @__PURE__ */ t.jsx(
|
|
2951
|
+
children: /* @__PURE__ */ t.jsx(j, { name: "plus", size: 16, className: "shrink-0" })
|
|
2757
2952
|
}
|
|
2758
2953
|
) })
|
|
2759
2954
|
] }),
|
|
2760
2955
|
/* @__PURE__ */ t.jsx("div", { className: "grow flex justify-end", children: /* @__PURE__ */ t.jsx(
|
|
2761
|
-
|
|
2956
|
+
O,
|
|
2762
2957
|
{
|
|
2763
2958
|
variant: "circle",
|
|
2764
2959
|
onClick: () => {
|
|
2765
2960
|
c(!u);
|
|
2766
2961
|
},
|
|
2767
|
-
children: /* @__PURE__ */ t.jsx(
|
|
2962
|
+
children: /* @__PURE__ */ t.jsx(j, { name: "sidebarSimple", size: 16 })
|
|
2768
2963
|
}
|
|
2769
2964
|
) })
|
|
2770
2965
|
] }),
|
|
2771
|
-
/* @__PURE__ */ t.jsx(
|
|
2966
|
+
/* @__PURE__ */ t.jsx(zt, { children: d && /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
2772
2967
|
/* @__PURE__ */ t.jsxs("div", { className: "mb-8 flex items-center gap-2", children: [
|
|
2773
|
-
/* @__PURE__ */ t.jsx(
|
|
2774
|
-
/* @__PURE__ */ t.jsx(
|
|
2968
|
+
/* @__PURE__ */ t.jsx(qt, {}),
|
|
2969
|
+
/* @__PURE__ */ t.jsx(j, { name: "pencilSimple", size: 16, className: "shrink-0" })
|
|
2775
2970
|
] }),
|
|
2776
2971
|
/* @__PURE__ */ t.jsxs(
|
|
2777
2972
|
le,
|
|
@@ -2783,13 +2978,13 @@ function Et(e) {
|
|
|
2783
2978
|
"select",
|
|
2784
2979
|
{
|
|
2785
2980
|
onChange: (w) => {
|
|
2786
|
-
|
|
2981
|
+
o(
|
|
2787
2982
|
`rules.${n}.conditions_logic`,
|
|
2788
2983
|
w.currentTarget.value
|
|
2789
2984
|
);
|
|
2790
2985
|
},
|
|
2791
2986
|
value: d?.conditions_logic ?? "all",
|
|
2792
|
-
className:
|
|
2987
|
+
className: k(
|
|
2793
2988
|
"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",
|
|
2794
2989
|
"ml-1 mr-1.5"
|
|
2795
2990
|
),
|
|
@@ -2811,19 +3006,19 @@ function Et(e) {
|
|
|
2811
3006
|
}
|
|
2812
3007
|
),
|
|
2813
3008
|
/* @__PURE__ */ t.jsx("div", { className: "mt-6", children: /* @__PURE__ */ t.jsxs(
|
|
2814
|
-
|
|
3009
|
+
O,
|
|
2815
3010
|
{
|
|
2816
3011
|
size: "small",
|
|
2817
3012
|
variant: "secondary",
|
|
2818
3013
|
alignItems: "center",
|
|
2819
3014
|
onClick: () => {
|
|
2820
|
-
|
|
3015
|
+
o(
|
|
2821
3016
|
`rules.${n}.conditions.${d?.conditions?.length ?? 0}`,
|
|
2822
3017
|
void 0
|
|
2823
3018
|
);
|
|
2824
3019
|
},
|
|
2825
3020
|
children: [
|
|
2826
|
-
/* @__PURE__ */ t.jsx(
|
|
3021
|
+
/* @__PURE__ */ t.jsx(j, { name: "plusCircle" }),
|
|
2827
3022
|
" Add condition"
|
|
2828
3023
|
]
|
|
2829
3024
|
}
|
|
@@ -2831,15 +3026,15 @@ function Et(e) {
|
|
|
2831
3026
|
]
|
|
2832
3027
|
}
|
|
2833
3028
|
),
|
|
2834
|
-
/* @__PURE__ */ t.jsx(
|
|
2835
|
-
/* @__PURE__ */ t.jsx(le, { title: "Actions", icon: "lightning", children: /* @__PURE__ */ t.jsx(
|
|
3029
|
+
/* @__PURE__ */ t.jsx(Ft, { children: "do" }),
|
|
3030
|
+
/* @__PURE__ */ t.jsx(le, { title: "Actions", icon: "lightning", children: /* @__PURE__ */ t.jsx(wt, { actions: d?.actions }) })
|
|
2836
3031
|
] }) })
|
|
2837
3032
|
]
|
|
2838
3033
|
},
|
|
2839
3034
|
h
|
|
2840
3035
|
),
|
|
2841
3036
|
u && /* @__PURE__ */ t.jsx("div", { className: "shrink-0 basis-2/5", children: /* @__PURE__ */ t.jsx(
|
|
2842
|
-
|
|
3037
|
+
Ue,
|
|
2843
3038
|
{
|
|
2844
3039
|
ref: m,
|
|
2845
3040
|
name: e.id ?? e.name,
|
|
@@ -2849,19 +3044,19 @@ function Et(e) {
|
|
|
2849
3044
|
defaultValue: JSON.stringify(s, null, 2),
|
|
2850
3045
|
noRounding: !0,
|
|
2851
3046
|
onFocus: () => {
|
|
2852
|
-
|
|
3047
|
+
i(!0);
|
|
2853
3048
|
},
|
|
2854
3049
|
onBlur: () => {
|
|
2855
|
-
|
|
3050
|
+
i(!1);
|
|
2856
3051
|
},
|
|
2857
|
-
onChange:
|
|
3052
|
+
onChange: g
|
|
2858
3053
|
}
|
|
2859
3054
|
) })
|
|
2860
3055
|
] })
|
|
2861
3056
|
}
|
|
2862
3057
|
);
|
|
2863
3058
|
}
|
|
2864
|
-
function
|
|
3059
|
+
function Ft({ children: e }) {
|
|
2865
3060
|
return /* @__PURE__ */ t.jsxs("div", { className: "text-gray-500 flex items-center justify-center flex-col", children: [
|
|
2866
3061
|
/* @__PURE__ */ t.jsx("div", { className: "h-6 w-[2px] bg-gray-200" }),
|
|
2867
3062
|
/* @__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 }),
|
|
@@ -2875,17 +3070,17 @@ function le({
|
|
|
2875
3070
|
}) {
|
|
2876
3071
|
return /* @__PURE__ */ t.jsxs("div", { className: "rounded-md bg-white shadow-xs", children: [
|
|
2877
3072
|
/* @__PURE__ */ t.jsxs("div", { className: "flex items-center space-x-4 py-4 border-b border-gray-100", children: [
|
|
2878
|
-
/* @__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(
|
|
3073
|
+
/* @__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 }) }),
|
|
2879
3074
|
/* @__PURE__ */ t.jsx("h2", { className: "font-semibold", children: s })
|
|
2880
3075
|
] }),
|
|
2881
3076
|
/* @__PURE__ */ t.jsx("div", { className: "p-6", children: e })
|
|
2882
3077
|
] });
|
|
2883
3078
|
}
|
|
2884
|
-
function
|
|
3079
|
+
function zt({
|
|
2885
3080
|
children: e
|
|
2886
3081
|
}) {
|
|
2887
3082
|
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 }) });
|
|
2888
3083
|
}
|
|
2889
3084
|
export {
|
|
2890
|
-
|
|
3085
|
+
Yt as RuleEngine
|
|
2891
3086
|
};
|