@commercelayer/app-elements 7.13.0 → 7.14.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/{CodeEditorComponent-aj99riRd.js → CodeEditorComponent-txM4ls17.js} +2 -2
- package/dist/{InputDateComponent-IsJB6qOP.js → InputDateComponent-C4QUlrmn.js} +2 -2
- package/dist/{RuleEngineComponent-DZhv94I7.js → RuleEngineComponent-dEe0FTBs.js} +266 -261
- package/dist/{en-Ccxurm3G.js → en-B-7ylwWx.js} +29 -1
- package/dist/{fetchCoreResourcesSuggestions-DuyGOmZK.js → fetchCoreResourcesSuggestions-DZuapPGj.js} +1 -1
- package/dist/helpers/numbers.d.ts +25 -0
- package/dist/helpers/numbers.test.d.ts +1 -0
- package/dist/hooks/useConfirmDialog.test.d.ts +1 -0
- package/dist/hooks/useOverlay.d.ts +9 -1
- package/dist/{it-C8-LXpKU.js → it-BXPKgQsm.js} +29 -1
- package/dist/locales/en.d.ts +28 -0
- package/dist/{main-DoRznkuw.js → main-Op1RV9MX.js} +14115 -12393
- package/dist/main.d.ts +8 -3
- package/dist/main.js +176 -166
- package/dist/mocks/data/core_schemas.d.ts +2 -0
- package/dist/mocks/data/event_stores.d.ts +2 -0
- package/dist/mocks/data/event_stores.test.d.ts +1 -0
- package/dist/{parseISO-Byyj1mNB.js → parseISO-C1OS0R6q.js} +1 -1
- package/dist/providers/TokenProvider/MockTokenProvider.d.ts +1 -1
- package/dist/providers/TokenProvider/TokenProvider.d.ts +1 -1
- package/dist/style.css +1 -1
- package/dist/tailwind.global.css +8 -4
- package/dist/ui/atoms/AvatarLetter/AvatarLetter.d.ts +6 -1
- package/dist/ui/atoms/PageHeading/PageHeading.d.ts +22 -4
- package/dist/ui/atoms/RadialProgress.d.ts +2 -2
- package/dist/ui/atoms/Section.d.ts +35 -0
- package/dist/ui/atoms/Spacer.d.ts +29 -4
- package/dist/ui/atoms/Stack.d.ts +48 -2
- package/dist/ui/atoms/Table/Table.d.ts +8 -0
- package/dist/ui/atoms/Tabs.d.ts +8 -0
- package/dist/ui/atoms/VisibilityTrigger.d.ts +19 -0
- package/dist/ui/atoms/VisibilityTrigger.test.d.ts +1 -0
- package/dist/ui/composite/Address.d.ts +9 -0
- package/dist/ui/composite/ListDetailsItem.d.ts +14 -1
- package/dist/ui/composite/PageLayout.d.ts +43 -24
- package/dist/ui/composite/PageLoading.d.ts +35 -0
- package/dist/ui/composite/PageLoading.test.d.ts +1 -0
- package/dist/ui/composite/PageSkeleton.d.ts +6 -0
- package/dist/ui/composite/Routes/LoadingPage.test.d.ts +1 -0
- package/dist/ui/forms/InputSelect/InputSelect.d.ts +8 -0
- package/dist/ui/internals/Overlay.test.d.ts +1 -0
- package/dist/ui/internals/bodyScrollLock.d.ts +2 -0
- package/dist/ui/internals/overlayContext.d.ts +36 -0
- package/dist/ui/resources/ResourceAddress/ResourceAddress.d.ts +12 -2
- package/dist/ui/resources/ResourceDetails/ResourceDetails.d.ts +9 -0
- package/dist/ui/resources/ResourceDetails/ResourceDetails.test.d.ts +1 -0
- package/dist/ui/resources/ResourceDetailsModal/ResourceAttributes.d.ts +11 -0
- package/dist/ui/resources/ResourceDetailsModal/ResourceDetailsContent.d.ts +43 -0
- package/dist/ui/resources/ResourceDetailsModal/ResourceDetailsContent.test.d.ts +1 -0
- package/dist/ui/resources/ResourceDetailsModal/ResourceEvents.d.ts +15 -0
- package/dist/ui/resources/ResourceDetailsModal/index.d.ts +2 -0
- package/dist/ui/resources/ResourceDetailsModal/resourceFields.d.ts +19 -0
- package/dist/ui/resources/ResourceDetailsModal/resourceFields.test.d.ts +1 -0
- package/dist/ui/resources/ResourceDetailsModal/useInfiniteScrollCursor.d.ts +39 -0
- package/dist/ui/resources/ResourceDetailsModal/useResourceDetailsModal.d.ts +23 -0
- package/dist/ui/resources/ResourceMetadata/ResourceMetadata.d.ts +9 -0
- package/dist/ui/resources/ResourceTags.d.ts +21 -1
- package/dist/ui/resources/ResourceTags.test.d.ts +1 -0
- package/dist/ui/resources/useResourceFilters/types.d.ts +26 -2
- package/dist/ui/resources/useResourceFilters/utils.d.ts +10 -0
- package/dist/ui/resources/useResourceList/index.d.ts +1 -0
- package/dist/ui/resources/useResourceList/resourceListSignals.d.ts +46 -0
- package/dist/ui/resources/useResourceList/resourceListSignals.integration.test.d.ts +1 -0
- package/dist/ui/resources/useResourceList/resourceListSignals.test.d.ts +1 -0
- package/dist/ui/resources/useResourceTable/types.d.ts +93 -23
- package/dist/ui/resources/useResourceTable/useResourceTable.test.d.ts +1 -0
- package/package.json +4 -3
- package/dist/ui/resources/useResourceList/VisibilityTrigger.d.ts +0 -8
- /package/dist/{ui/resources/useResourceList/VisibilityTrigger.test.d.ts → dictionaries/orders.test.d.ts} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { t as B, X as Oe, Y as Re, Z as Ve, j as t, _ as R, $ as U, a0 as j, a1 as S, E as L, a2 as Ae, a3 as Me, a4 as Ee, a5 as Y, a6 as ae, a7 as x, T as k, a8 as C, a9 as $, aa as _, ab as y, ac as re, ad as E, ae as z, af as O, ag as X, ah as Ie, u as oe, ai as qe, aj as De, ak as H, I as Le, al as Fe } from "./main-
|
|
2
|
+
import { t as B, X as Oe, Y as Re, Z as Ve, j as t, _ as R, $ as U, a0 as j, a1 as S, E as L, a2 as Ae, a3 as Me, a4 as Ee, a5 as Y, a6 as ae, a7 as x, T as k, a8 as C, a9 as $, aa as _, ab as y, ac as re, ad as E, ae as z, af as O, ag as X, ah as Ie, u as oe, ai as qe, aj as De, ak as H, I as Le, al as Fe } from "./main-Op1RV9MX.js";
|
|
3
3
|
import K, { useReducer as ze, useCallback as A, useMemo as ie, createContext as Ge, useContext as Ue, useState as v, useEffect as T, useRef as ue } from "react";
|
|
4
4
|
import "react-hook-form";
|
|
5
|
-
import { b as Je, e as ce, a as We, c as de, f as Be } from "./fetchCoreResourcesSuggestions-
|
|
5
|
+
import { b as Je, e as ce, a as We, c as de, f as Be } from "./fetchCoreResourcesSuggestions-DZuapPGj.js";
|
|
6
6
|
import "wouter";
|
|
7
|
-
import { p as Q } from "./parseISO-
|
|
7
|
+
import { p as Q } from "./parseISO-C1OS0R6q.js";
|
|
8
8
|
function Z(e, s) {
|
|
9
9
|
const n = e.match(
|
|
10
10
|
/(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2}):(\d{2})(?:\.(\d{0,7}))?(?:Z|(.)(\d{2}):?(\d{2})?)?/
|
|
@@ -41,8 +41,8 @@ function He(e, s) {
|
|
|
41
41
|
const n = P(e.value);
|
|
42
42
|
if (s.value === null && s.allowNullValue === !1)
|
|
43
43
|
if (/\.\d+$/.test(s.path)) {
|
|
44
|
-
const l = s.path.replace(/\.\d+$/, ""), r = parseInt(s.path.match(/\d+$/)?.[0] ?? "0", 10),
|
|
45
|
-
Array.isArray(
|
|
44
|
+
const l = s.path.replace(/\.\d+$/, ""), r = parseInt(s.path.match(/\d+$/)?.[0] ?? "0", 10), i = U(n, l);
|
|
45
|
+
Array.isArray(i) && (i.splice(r, 1), q(n, l, i), i.length === 0 && l.endsWith(".nested.conditions") && D(n, l.replace(/\.conditions$/, "")));
|
|
46
46
|
} else
|
|
47
47
|
D(n, s.path);
|
|
48
48
|
else
|
|
@@ -56,8 +56,8 @@ function He(e, s) {
|
|
|
56
56
|
const n = P(e.renderOptions);
|
|
57
57
|
if (s.value === null)
|
|
58
58
|
if (/\.\d+$/.test(s.path)) {
|
|
59
|
-
const l = s.path.replace(/\.\d+$/, ""), r = parseInt(s.path.match(/\d+$/)?.[0] ?? "0", 10),
|
|
60
|
-
Array.isArray(
|
|
59
|
+
const l = s.path.replace(/\.\d+$/, ""), r = parseInt(s.path.match(/\d+$/)?.[0] ?? "0", 10), i = U(n, l);
|
|
60
|
+
Array.isArray(i) && (i.splice(r, 1), q(n, l, i), i.length === 0 && l.endsWith(".nested.conditions") && D(n, l.replace(/\.conditions$/, "")));
|
|
61
61
|
} else
|
|
62
62
|
D(n, s.path);
|
|
63
63
|
else
|
|
@@ -103,48 +103,48 @@ function Ke({
|
|
|
103
103
|
renderOptions: {},
|
|
104
104
|
selectedRuleIndex: 0
|
|
105
105
|
}), r = A(
|
|
106
|
-
(c, d,
|
|
107
|
-
l({ type: "SET_PATH", path: c, value: d, allowNullValue:
|
|
106
|
+
(c, d, f = !1) => {
|
|
107
|
+
l({ type: "SET_PATH", path: c, value: d, allowNullValue: f });
|
|
108
108
|
},
|
|
109
109
|
[]
|
|
110
|
-
),
|
|
110
|
+
), i = A((c) => {
|
|
111
111
|
l({ type: "SET_SELECTED_RULE_INDEX", index: c }), c < 0 && setTimeout(() => {
|
|
112
112
|
l({ type: "SET_SELECTED_RULE_INDEX", index: 0 });
|
|
113
113
|
}, 50);
|
|
114
114
|
}, []), a = A((c) => {
|
|
115
115
|
l({ type: "SET_VALUE", value: c });
|
|
116
|
-
}, []),
|
|
116
|
+
}, []), o = A((c, d) => {
|
|
117
117
|
l({ type: "SET_RENDER_OPTION", path: c, value: d });
|
|
118
118
|
}, []), u = ie(
|
|
119
119
|
() => ({
|
|
120
120
|
state: n,
|
|
121
121
|
setPath: r,
|
|
122
|
-
setSelectedRuleIndex:
|
|
122
|
+
setSelectedRuleIndex: i,
|
|
123
123
|
setValue: a,
|
|
124
|
-
setRenderOption:
|
|
124
|
+
setRenderOption: o,
|
|
125
125
|
schemaType: s.schemaType,
|
|
126
126
|
optionsConfig: s.optionsConfig
|
|
127
127
|
}),
|
|
128
128
|
[
|
|
129
129
|
n,
|
|
130
130
|
r,
|
|
131
|
-
o,
|
|
132
|
-
a,
|
|
133
131
|
i,
|
|
132
|
+
a,
|
|
133
|
+
o,
|
|
134
134
|
s.schemaType,
|
|
135
135
|
s.optionsConfig
|
|
136
136
|
]
|
|
137
137
|
);
|
|
138
138
|
return /* @__PURE__ */ t.jsx(pe.Provider, { value: u, children: e });
|
|
139
139
|
}
|
|
140
|
-
function
|
|
140
|
+
function m() {
|
|
141
141
|
const e = Ue(pe);
|
|
142
142
|
if (e === void 0)
|
|
143
143
|
throw new Error("useRuleEngine must be used within a RuleEngineProvider");
|
|
144
144
|
return e;
|
|
145
145
|
}
|
|
146
|
-
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 }),
|
|
147
|
-
const { state: r, setRenderOption:
|
|
146
|
+
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 }), fe = ({ children: e, dropdownItems: s, options: n, pathPrefix: l }) => {
|
|
147
|
+
const { state: r, setRenderOption: i } = m(), a = `${l}.isOpen`, o = U(r.renderOptions, a) ?? !0;
|
|
148
148
|
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: [
|
|
149
149
|
/* @__PURE__ */ t.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
150
150
|
e,
|
|
@@ -154,10 +154,10 @@ const Qe = ({ children: e }) => /* @__PURE__ */ t.jsx("div", { className: "bg-wh
|
|
|
154
154
|
{
|
|
155
155
|
type: "button",
|
|
156
156
|
onClick: () => {
|
|
157
|
-
|
|
157
|
+
i(`${a}`, !o);
|
|
158
158
|
},
|
|
159
159
|
className: "w-11 flex self-stretch justify-center items-center",
|
|
160
|
-
children: /* @__PURE__ */ t.jsx(j, { name:
|
|
160
|
+
children: /* @__PURE__ */ t.jsx(j, { name: o ? "caretUp" : "caretDown", size: 16 })
|
|
161
161
|
}
|
|
162
162
|
),
|
|
163
163
|
s != null && /* @__PURE__ */ t.jsx(
|
|
@@ -177,9 +177,9 @@ const Qe = ({ children: e }) => /* @__PURE__ */ t.jsx("div", { className: "bg-wh
|
|
|
177
177
|
)
|
|
178
178
|
] })
|
|
179
179
|
] }),
|
|
180
|
-
|
|
180
|
+
o && /* @__PURE__ */ t.jsx(Qe, { children: n })
|
|
181
181
|
] }) }) });
|
|
182
|
-
},
|
|
182
|
+
}, me = [
|
|
183
183
|
{
|
|
184
184
|
/** Matches if field value equals provided value
|
|
185
185
|
* @field Integer, String, Datetime, Boolean
|
|
@@ -510,8 +510,8 @@ function J(e) {
|
|
|
510
510
|
const [s, n] = v(void 0);
|
|
511
511
|
return T(() => {
|
|
512
512
|
e?.field != null && Je(e.field).then((l) => {
|
|
513
|
-
const r =
|
|
514
|
-
(
|
|
513
|
+
const r = me.find(
|
|
514
|
+
(i) => i.matcher === e.matcher
|
|
515
515
|
);
|
|
516
516
|
n({
|
|
517
517
|
...l,
|
|
@@ -536,7 +536,7 @@ function be(e) {
|
|
|
536
536
|
function xe() {
|
|
537
537
|
const {
|
|
538
538
|
state: { selectedRuleIndex: e, value: s }
|
|
539
|
-
} =
|
|
539
|
+
} = m();
|
|
540
540
|
return be(
|
|
541
541
|
s.rules?.[e]?.conditions
|
|
542
542
|
);
|
|
@@ -547,9 +547,9 @@ const ve = ({
|
|
|
547
547
|
isDisabled: n,
|
|
548
548
|
resourceKey: l,
|
|
549
549
|
onSelect: r,
|
|
550
|
-
isMulti:
|
|
550
|
+
isMulti: i = !1
|
|
551
551
|
}) => {
|
|
552
|
-
const { sdkClient: a } = Ee(), { data:
|
|
552
|
+
const { sdkClient: a } = Ee(), { data: o } = Y(s, "list", [G({ value: "" })]), { data: u, isLoading: c } = Y(
|
|
553
553
|
s,
|
|
554
554
|
"list",
|
|
555
555
|
[
|
|
@@ -560,8 +560,8 @@ const ve = ({
|
|
|
560
560
|
}
|
|
561
561
|
}
|
|
562
562
|
]
|
|
563
|
-
), d = ae([...u ?? [], ...
|
|
564
|
-
function
|
|
563
|
+
), d = ae([...u ?? [], ...o ?? []], "id");
|
|
564
|
+
function f(h) {
|
|
565
565
|
return {
|
|
566
566
|
label: d?.find((p) => p.id === h.toString())?.name ?? `${c ? "" : "⚠️ "}${h.toString()}`,
|
|
567
567
|
value: h.toString()
|
|
@@ -573,9 +573,9 @@ const ve = ({
|
|
|
573
573
|
placeholder: "Search...",
|
|
574
574
|
isClearable: !1,
|
|
575
575
|
isDisabled: n,
|
|
576
|
-
isMulti:
|
|
577
|
-
defaultValue: Array.isArray(e) ? e.map(
|
|
578
|
-
menuFooterText:
|
|
576
|
+
isMulti: i,
|
|
577
|
+
defaultValue: Array.isArray(e) ? e.map(f) : e != null ? f(e) : void 0,
|
|
578
|
+
menuFooterText: o != null && o.meta.recordCount > 25 ? "Type to search for more options." : void 0,
|
|
579
579
|
initialValues: ee(d ?? [], l),
|
|
580
580
|
loadAsyncValues: async (h) => {
|
|
581
581
|
const p = await a[s].list(G({ value: h }));
|
|
@@ -585,7 +585,7 @@ const ve = ({
|
|
|
585
585
|
r?.(h);
|
|
586
586
|
}
|
|
587
587
|
},
|
|
588
|
-
`${
|
|
588
|
+
`${i ? "multi" : "single"}-${c}-${JSON.stringify(d)}`
|
|
589
589
|
);
|
|
590
590
|
};
|
|
591
591
|
function G({ value: e }) {
|
|
@@ -833,12 +833,12 @@ function nt(e, s) {
|
|
|
833
833
|
const n = {};
|
|
834
834
|
try {
|
|
835
835
|
const l = e?.properties?.rules?.items?.properties?.actions?.items?.anyOf ?? [], r = lt(l);
|
|
836
|
-
for (const [
|
|
837
|
-
const
|
|
838
|
-
n[
|
|
839
|
-
for (const
|
|
840
|
-
const h = c[
|
|
841
|
-
h != null && (n[
|
|
836
|
+
for (const [i, a] of r.entries()) {
|
|
837
|
+
const o = _e(a, Pe), u = $e(o, a, e), c = ye.actions[s], d = Object.keys(c);
|
|
838
|
+
n[i] = {};
|
|
839
|
+
for (const f of d) {
|
|
840
|
+
const h = c[f];
|
|
841
|
+
h != null && (n[i][f] = u.filter((p) => h[p.name] != null).map((p) => {
|
|
842
842
|
const g = h[p.name];
|
|
843
843
|
return {
|
|
844
844
|
...p,
|
|
@@ -858,13 +858,13 @@ function st(e, s) {
|
|
|
858
858
|
const n = e?.$defs?.conditions?.items?.anyOf ?? [], l = _e(
|
|
859
859
|
n,
|
|
860
860
|
et
|
|
861
|
-
), r = $e(l, n, e),
|
|
862
|
-
return r.filter((a) =>
|
|
863
|
-
const
|
|
861
|
+
), r = $e(l, n, e), i = ye.conditions[s];
|
|
862
|
+
return r.filter((a) => i[a.name] != null).map((a) => {
|
|
863
|
+
const o = i[a.name];
|
|
864
864
|
return {
|
|
865
865
|
...a,
|
|
866
866
|
// Configuration values override schema-derived values
|
|
867
|
-
values: Array.isArray(
|
|
867
|
+
values: Array.isArray(o) ? o : a.values,
|
|
868
868
|
// Conditions are never required (only actions can be required)
|
|
869
869
|
required: !1
|
|
870
870
|
};
|
|
@@ -884,20 +884,20 @@ function lt(e) {
|
|
|
884
884
|
function _e(e, s) {
|
|
885
885
|
const n = /* @__PURE__ */ new Map();
|
|
886
886
|
return e.forEach((l, r) => {
|
|
887
|
-
const
|
|
888
|
-
for (const
|
|
889
|
-
s.includes(
|
|
887
|
+
const i = Object.keys(l.properties ?? {}), a = new Set(l.required ?? []);
|
|
888
|
+
for (const o of i)
|
|
889
|
+
s.includes(o) && (n.has(o) || n.set(o, {
|
|
890
890
|
appearsIn: /* @__PURE__ */ new Set(),
|
|
891
891
|
requiredIn: /* @__PURE__ */ new Set()
|
|
892
|
-
}), n.get(
|
|
892
|
+
}), n.get(o)?.appearsIn.add(r), a.has(o) && n.get(o)?.requiredIn.add(r));
|
|
893
893
|
}), n;
|
|
894
894
|
}
|
|
895
895
|
function $e(e, s, n) {
|
|
896
896
|
const l = [];
|
|
897
|
-
for (const [r, { appearsIn:
|
|
898
|
-
const
|
|
897
|
+
for (const [r, { appearsIn: i, requiredIn: a }] of e.entries()) {
|
|
898
|
+
const o = at(
|
|
899
899
|
r,
|
|
900
|
-
|
|
900
|
+
i,
|
|
901
901
|
e
|
|
902
902
|
);
|
|
903
903
|
let u = {};
|
|
@@ -909,7 +909,7 @@ function $e(e, s, n) {
|
|
|
909
909
|
l.push({
|
|
910
910
|
name: r,
|
|
911
911
|
label: je[r],
|
|
912
|
-
mutuallyExclusiveWith:
|
|
912
|
+
mutuallyExclusiveWith: o,
|
|
913
913
|
required: a.size > 0,
|
|
914
914
|
...u
|
|
915
915
|
});
|
|
@@ -918,10 +918,10 @@ function $e(e, s, n) {
|
|
|
918
918
|
}
|
|
919
919
|
function at(e, s, n) {
|
|
920
920
|
const l = [];
|
|
921
|
-
for (const [r, { appearsIn:
|
|
921
|
+
for (const [r, { appearsIn: i }] of n) {
|
|
922
922
|
if (r === e) continue;
|
|
923
923
|
new Set(
|
|
924
|
-
[...s].filter((
|
|
924
|
+
[...s].filter((o) => i.has(o))
|
|
925
925
|
).size === 0 && s.size > 0 && l.push(r);
|
|
926
926
|
}
|
|
927
927
|
return l;
|
|
@@ -931,10 +931,10 @@ function rt(e, s) {
|
|
|
931
931
|
let l = e;
|
|
932
932
|
if (e?.$ref != null && typeof e.$ref == "string") {
|
|
933
933
|
const r = e.$ref.replace(/^#\//, "").split("/");
|
|
934
|
-
let
|
|
934
|
+
let i = s;
|
|
935
935
|
for (const a of r)
|
|
936
|
-
|
|
937
|
-
l =
|
|
936
|
+
i = i?.[a];
|
|
937
|
+
l = i;
|
|
938
938
|
}
|
|
939
939
|
return l?.enum != null && Array.isArray(l.enum) && (n.values = l.enum.map((r) => ({
|
|
940
940
|
label: r.charAt(0).toUpperCase() + r.slice(1),
|
|
@@ -950,21 +950,21 @@ function Ne(e, s) {
|
|
|
950
950
|
required: []
|
|
951
951
|
};
|
|
952
952
|
const n = s.map((a) => a.name).filter((a) => {
|
|
953
|
-
const
|
|
954
|
-
return Array.isArray(e[a]) ? u :
|
|
953
|
+
const o = a in e && e[a] !== void 0, u = Array.isArray(e[a]) && e[a].length > 0;
|
|
954
|
+
return Array.isArray(e[a]) ? u : o;
|
|
955
955
|
}), l = s.filter(
|
|
956
956
|
(a) => a.required === !0 && !n.includes(a.name)
|
|
957
|
-
), r = [],
|
|
957
|
+
), r = [], i = [];
|
|
958
958
|
for (const a of s) {
|
|
959
959
|
if (n.includes(a.name) || a.required)
|
|
960
960
|
continue;
|
|
961
961
|
a.mutuallyExclusiveWith.some(
|
|
962
962
|
(u) => n.includes(u)
|
|
963
|
-
) ?
|
|
963
|
+
) ? i.push(a) : r.push(a);
|
|
964
964
|
}
|
|
965
965
|
return {
|
|
966
966
|
available: r,
|
|
967
|
-
disabled:
|
|
967
|
+
disabled: i,
|
|
968
968
|
current: n,
|
|
969
969
|
required: l
|
|
970
970
|
};
|
|
@@ -974,9 +974,9 @@ function N({
|
|
|
974
974
|
optionName: s,
|
|
975
975
|
pathPrefix: n
|
|
976
976
|
}) {
|
|
977
|
-
const { setPath: l, optionsConfig: r, schemaType:
|
|
977
|
+
const { setPath: l, optionsConfig: r, schemaType: i } = m(), a = i === "order-rules" ? "order" : i === "price-rules" ? "price" : void 0, o = e != null && "selector" in e ? e.selector : "", u = "type" in e ? r.actions[e.type]?.[o]?.find((d) => d.name === s) : r.conditions.find((d) => d.name === s), c = A(
|
|
978
978
|
({ children: d }) => {
|
|
979
|
-
const
|
|
979
|
+
const f = u?.label ?? je[s];
|
|
980
980
|
return u?.required === !0 ? /* @__PURE__ */ t.jsx(
|
|
981
981
|
I,
|
|
982
982
|
{
|
|
@@ -986,7 +986,7 @@ function N({
|
|
|
986
986
|
variant: "info",
|
|
987
987
|
size: "small",
|
|
988
988
|
className: "flex gap-2 items-center",
|
|
989
|
-
children:
|
|
989
|
+
children: f
|
|
990
990
|
}
|
|
991
991
|
),
|
|
992
992
|
children: d
|
|
@@ -1019,7 +1019,7 @@ function N({
|
|
|
1019
1019
|
size: "small",
|
|
1020
1020
|
className: "flex gap-2 items-center",
|
|
1021
1021
|
children: [
|
|
1022
|
-
|
|
1022
|
+
f,
|
|
1023
1023
|
/* @__PURE__ */ t.jsx(j, { name: "caretDown" })
|
|
1024
1024
|
]
|
|
1025
1025
|
}
|
|
@@ -1044,9 +1044,9 @@ function we({
|
|
|
1044
1044
|
pathPrefix: s,
|
|
1045
1045
|
optionConfig: n
|
|
1046
1046
|
}) {
|
|
1047
|
-
const { setPath: l } =
|
|
1047
|
+
const { setPath: l } = m(), r = n?.values?.find(
|
|
1048
1048
|
(a) => R(e.field, a.meta?.field) && R(e.operator, a.meta?.operator)
|
|
1049
|
-
),
|
|
1049
|
+
), i = [
|
|
1050
1050
|
{ label: "=", value: "eq" },
|
|
1051
1051
|
{ label: ">", value: "gt" },
|
|
1052
1052
|
{ label: "<", value: "lt" },
|
|
@@ -1086,10 +1086,10 @@ function we({
|
|
|
1086
1086
|
{
|
|
1087
1087
|
className: "w-34",
|
|
1088
1088
|
defaultValue: e.matcher != null ? {
|
|
1089
|
-
label:
|
|
1089
|
+
label: i.find((a) => a.value === e.matcher)?.label ?? e.matcher,
|
|
1090
1090
|
value: e.matcher
|
|
1091
1091
|
} : void 0,
|
|
1092
|
-
initialValues:
|
|
1092
|
+
initialValues: i,
|
|
1093
1093
|
onSelect: (a) => {
|
|
1094
1094
|
_(a) && l(`${s}.matcher`, a.value);
|
|
1095
1095
|
}
|
|
@@ -1102,8 +1102,8 @@ function we({
|
|
|
1102
1102
|
className: "basis-20",
|
|
1103
1103
|
placeholder: "0",
|
|
1104
1104
|
onChange: (a) => {
|
|
1105
|
-
const
|
|
1106
|
-
l(`${s}.value`,
|
|
1105
|
+
const o = parseInt(a.currentTarget.value, 10);
|
|
1106
|
+
l(`${s}.value`, o);
|
|
1107
1107
|
},
|
|
1108
1108
|
defaultValue: e.value
|
|
1109
1109
|
}
|
|
@@ -1121,9 +1121,9 @@ function ot({
|
|
|
1121
1121
|
/* @__PURE__ */ t.jsx(dt, { item: e, pathPrefix: s }),
|
|
1122
1122
|
/* @__PURE__ */ t.jsx(ht, { item: e, pathPrefix: s }),
|
|
1123
1123
|
/* @__PURE__ */ t.jsx(gt, { item: e, pathPrefix: s }),
|
|
1124
|
-
/* @__PURE__ */ t.jsx(mt, { item: e, pathPrefix: s }),
|
|
1125
|
-
/* @__PURE__ */ t.jsx(pt, { item: e, pathPrefix: s }),
|
|
1126
1124
|
/* @__PURE__ */ t.jsx(ft, { item: e, pathPrefix: s }),
|
|
1125
|
+
/* @__PURE__ */ t.jsx(pt, { item: e, pathPrefix: s }),
|
|
1126
|
+
/* @__PURE__ */ t.jsx(mt, { item: e, pathPrefix: s }),
|
|
1127
1127
|
/* @__PURE__ */ t.jsx(ct, { item: e, pathPrefix: s })
|
|
1128
1128
|
] });
|
|
1129
1129
|
}
|
|
@@ -1131,16 +1131,16 @@ function it({
|
|
|
1131
1131
|
item: e,
|
|
1132
1132
|
pathPrefix: s
|
|
1133
1133
|
}) {
|
|
1134
|
-
const n = "selector", { setPath: l, schemaType: r } =
|
|
1134
|
+
const n = "selector", { setPath: l, schemaType: r } = m(), { t: i } = re(), a = N({ item: e, optionName: n, pathPrefix: s });
|
|
1135
1135
|
if (!(n in e) || a == null)
|
|
1136
1136
|
return null;
|
|
1137
|
-
const
|
|
1137
|
+
const o = xt[r].map((d) => ({
|
|
1138
1138
|
value: d,
|
|
1139
|
-
label:
|
|
1139
|
+
label: i(`resource_paths.${d}`).replace(
|
|
1140
1140
|
"resource_paths.",
|
|
1141
1141
|
""
|
|
1142
1142
|
)
|
|
1143
|
-
})), u = `${s}.${n}`, c = n in e ? e?.selector == null ? void 0 :
|
|
1143
|
+
})), u = `${s}.${n}`, c = n in e ? e?.selector == null ? void 0 : o.find((d) => d.value === e.selector) ?? {
|
|
1144
1144
|
value: e.selector,
|
|
1145
1145
|
label: e.selector
|
|
1146
1146
|
} : void 0;
|
|
@@ -1149,7 +1149,7 @@ function it({
|
|
|
1149
1149
|
{
|
|
1150
1150
|
name: u,
|
|
1151
1151
|
isSearchable: !1,
|
|
1152
|
-
initialValues:
|
|
1152
|
+
initialValues: o,
|
|
1153
1153
|
value: c,
|
|
1154
1154
|
onSelect: async (d) => {
|
|
1155
1155
|
_(d) && (l(u, d.value), l(`${s}.apply_on`, null));
|
|
@@ -1161,11 +1161,11 @@ function ut({
|
|
|
1161
1161
|
item: e,
|
|
1162
1162
|
pathPrefix: s
|
|
1163
1163
|
}) {
|
|
1164
|
-
const n = "groups", { setPath: l, schemaType: r } =
|
|
1165
|
-
if (!(n in e) || a == null ||
|
|
1164
|
+
const n = "groups", { setPath: l, schemaType: r } = m(), i = xe(), a = N({ item: e, optionName: n, pathPrefix: s });
|
|
1165
|
+
if (!(n in e) || a == null || i.length <= 0 && ("groups" in e && e.groups != null ? e.groups : []).length <= 0)
|
|
1166
1166
|
return null;
|
|
1167
|
-
const
|
|
1168
|
-
label:
|
|
1167
|
+
const o = "groups" in e ? e?.groups?.map((u) => ({
|
|
1168
|
+
label: i.includes(u) ? u : `⚠️ ${u}`,
|
|
1169
1169
|
value: u
|
|
1170
1170
|
})) : void 0;
|
|
1171
1171
|
return /* @__PURE__ */ t.jsx(a.OptionRow, { children: /* @__PURE__ */ t.jsx(
|
|
@@ -1174,8 +1174,8 @@ function ut({
|
|
|
1174
1174
|
name: `${s}.groups`,
|
|
1175
1175
|
isMulti: !0,
|
|
1176
1176
|
isClearable: !1,
|
|
1177
|
-
value:
|
|
1178
|
-
initialValues:
|
|
1177
|
+
value: o,
|
|
1178
|
+
initialValues: i.map((u) => ({
|
|
1179
1179
|
value: u,
|
|
1180
1180
|
label: u
|
|
1181
1181
|
})),
|
|
@@ -1192,22 +1192,22 @@ function ct({
|
|
|
1192
1192
|
item: e,
|
|
1193
1193
|
pathPrefix: s
|
|
1194
1194
|
}) {
|
|
1195
|
-
const n = "round", { setPath: l } =
|
|
1195
|
+
const n = "round", { setPath: l } = m(), r = N({ item: e, optionName: n, pathPrefix: s });
|
|
1196
1196
|
if (!(n in e) || r == null)
|
|
1197
1197
|
return null;
|
|
1198
|
-
const
|
|
1198
|
+
const i = [
|
|
1199
1199
|
{ label: "Yes", value: !0 },
|
|
1200
1200
|
{ label: "No", value: !1 }
|
|
1201
|
-
], a =
|
|
1201
|
+
], a = i.find((o) => o.value === e[n]);
|
|
1202
1202
|
return /* @__PURE__ */ t.jsx(r.OptionRow, { children: /* @__PURE__ */ t.jsx(
|
|
1203
1203
|
x,
|
|
1204
1204
|
{
|
|
1205
1205
|
name: `${s}.${n}`,
|
|
1206
1206
|
isSearchable: !1,
|
|
1207
1207
|
defaultValue: a,
|
|
1208
|
-
initialValues:
|
|
1209
|
-
onSelect: (
|
|
1210
|
-
_(
|
|
1208
|
+
initialValues: i,
|
|
1209
|
+
onSelect: (o) => {
|
|
1210
|
+
_(o) && l(`${s}.${n}`, o.value);
|
|
1211
1211
|
}
|
|
1212
1212
|
}
|
|
1213
1213
|
) });
|
|
@@ -1216,20 +1216,20 @@ function dt({
|
|
|
1216
1216
|
item: e,
|
|
1217
1217
|
pathPrefix: s
|
|
1218
1218
|
}) {
|
|
1219
|
-
const n = "quantity", { setPath: l } =
|
|
1219
|
+
const n = "quantity", { setPath: l } = m(), r = N({ item: e, optionName: n, pathPrefix: s });
|
|
1220
1220
|
if (!(n in e) || r == null)
|
|
1221
1221
|
return null;
|
|
1222
|
-
const
|
|
1222
|
+
const i = e[n];
|
|
1223
1223
|
return /* @__PURE__ */ t.jsx(r.OptionRow, { children: /* @__PURE__ */ t.jsx(
|
|
1224
1224
|
y,
|
|
1225
1225
|
{
|
|
1226
1226
|
type: "number",
|
|
1227
1227
|
name: `${s}.${n}`,
|
|
1228
|
-
defaultValue:
|
|
1228
|
+
defaultValue: i,
|
|
1229
1229
|
min: 1,
|
|
1230
1230
|
onChange: (a) => {
|
|
1231
|
-
const
|
|
1232
|
-
l(`${s}.${n}`,
|
|
1231
|
+
const o = parseInt(a.currentTarget.value, 10);
|
|
1232
|
+
l(`${s}.${n}`, o);
|
|
1233
1233
|
}
|
|
1234
1234
|
}
|
|
1235
1235
|
) });
|
|
@@ -1238,10 +1238,10 @@ function pt({
|
|
|
1238
1238
|
item: e,
|
|
1239
1239
|
pathPrefix: s
|
|
1240
1240
|
}) {
|
|
1241
|
-
const n = "limit", { setPath: l } =
|
|
1241
|
+
const n = "limit", { setPath: l } = m(), r = N({ item: e, optionName: n, pathPrefix: s });
|
|
1242
1242
|
if (!(n in e) || r == null)
|
|
1243
1243
|
return null;
|
|
1244
|
-
const
|
|
1244
|
+
const i = r.optionConfig?.values?.find(
|
|
1245
1245
|
(a) => R(e.limit?.sort, a.meta)
|
|
1246
1246
|
);
|
|
1247
1247
|
return /* @__PURE__ */ t.jsx(r.OptionRow, { children: /* @__PURE__ */ t.jsxs("div", { className: "flex gap-2", children: [
|
|
@@ -1252,8 +1252,8 @@ function pt({
|
|
|
1252
1252
|
className: "basis-20",
|
|
1253
1253
|
placeholder: "1",
|
|
1254
1254
|
onChange: (a) => {
|
|
1255
|
-
const
|
|
1256
|
-
l(`${s}.${n}.value`,
|
|
1255
|
+
const o = parseInt(a.currentTarget.value, 10);
|
|
1256
|
+
l(`${s}.${n}.value`, o);
|
|
1257
1257
|
},
|
|
1258
1258
|
defaultValue: e.limit?.value
|
|
1259
1259
|
}
|
|
@@ -1262,7 +1262,7 @@ function pt({
|
|
|
1262
1262
|
x,
|
|
1263
1263
|
{
|
|
1264
1264
|
className: "grow",
|
|
1265
|
-
defaultValue:
|
|
1265
|
+
defaultValue: i ?? (e.limit?.sort == null ? void 0 : {
|
|
1266
1266
|
label: e.limit.sort.attribute != null && e.limit.sort.direction ? `${e.limit.sort.attribute} ${e.limit.sort.direction.toUpperCase()}` : "",
|
|
1267
1267
|
value: JSON.stringify(e.limit.sort),
|
|
1268
1268
|
meta: e.limit.sort
|
|
@@ -1279,7 +1279,7 @@ function pt({
|
|
|
1279
1279
|
)
|
|
1280
1280
|
] }) });
|
|
1281
1281
|
}
|
|
1282
|
-
function
|
|
1282
|
+
function ft({
|
|
1283
1283
|
item: e,
|
|
1284
1284
|
pathPrefix: s
|
|
1285
1285
|
}) {
|
|
@@ -1293,15 +1293,15 @@ function mt({
|
|
|
1293
1293
|
}
|
|
1294
1294
|
) });
|
|
1295
1295
|
}
|
|
1296
|
-
function
|
|
1296
|
+
function mt({
|
|
1297
1297
|
item: e,
|
|
1298
1298
|
pathPrefix: s
|
|
1299
1299
|
}) {
|
|
1300
|
-
const n = "bundle", { setPath: l } =
|
|
1300
|
+
const n = "bundle", { setPath: l } = m(), r = N({ item: e, optionName: n, pathPrefix: s });
|
|
1301
1301
|
if (!(n in e) || r == null)
|
|
1302
1302
|
return null;
|
|
1303
|
-
const
|
|
1304
|
-
(
|
|
1303
|
+
const i = r.optionConfig?.values?.find(
|
|
1304
|
+
(o) => R(e.bundle?.sort, o.meta)
|
|
1305
1305
|
), a = [
|
|
1306
1306
|
{ label: "Balanced", value: "balanced" },
|
|
1307
1307
|
{ label: "Every", value: "every" }
|
|
@@ -1311,12 +1311,12 @@ function ft({
|
|
|
1311
1311
|
x,
|
|
1312
1312
|
{
|
|
1313
1313
|
initialValues: a,
|
|
1314
|
-
defaultValue: e.bundle?.type == null ? void 0 : a.find((
|
|
1314
|
+
defaultValue: e.bundle?.type == null ? void 0 : a.find((o) => o.value === e.bundle?.type) ?? {
|
|
1315
1315
|
label: e.bundle.type,
|
|
1316
1316
|
value: e.bundle.type
|
|
1317
1317
|
},
|
|
1318
|
-
onSelect: (
|
|
1319
|
-
_(
|
|
1318
|
+
onSelect: (o) => {
|
|
1319
|
+
_(o) && (l(`${s}.${n}.type`, o.value), o.value === "balanced" && l(`${s}.${n}.value`, null));
|
|
1320
1320
|
}
|
|
1321
1321
|
}
|
|
1322
1322
|
),
|
|
@@ -1326,8 +1326,8 @@ function ft({
|
|
|
1326
1326
|
type: "number",
|
|
1327
1327
|
className: "basis-20",
|
|
1328
1328
|
placeholder: "1",
|
|
1329
|
-
onChange: (
|
|
1330
|
-
const u = parseInt(
|
|
1329
|
+
onChange: (o) => {
|
|
1330
|
+
const u = parseInt(o.currentTarget.value, 10);
|
|
1331
1331
|
l(`${s}.${n}.value`, u);
|
|
1332
1332
|
},
|
|
1333
1333
|
defaultValue: e.bundle?.value
|
|
@@ -1337,18 +1337,18 @@ function ft({
|
|
|
1337
1337
|
x,
|
|
1338
1338
|
{
|
|
1339
1339
|
className: "grow",
|
|
1340
|
-
defaultValue:
|
|
1340
|
+
defaultValue: i ?? (e.bundle?.sort == null ? void 0 : {
|
|
1341
1341
|
label: e.bundle.sort.attribute != null && e.bundle.sort.direction ? `${e.bundle.sort.attribute} ${e.bundle.sort.direction.toUpperCase()}` : "",
|
|
1342
1342
|
value: JSON.stringify(e.bundle.sort),
|
|
1343
1343
|
meta: e.bundle?.sort
|
|
1344
1344
|
}),
|
|
1345
|
-
initialValues: r.optionConfig?.values?.map((
|
|
1346
|
-
label:
|
|
1347
|
-
meta:
|
|
1348
|
-
value: JSON.stringify(
|
|
1345
|
+
initialValues: r.optionConfig?.values?.map((o) => ({
|
|
1346
|
+
label: o.label,
|
|
1347
|
+
meta: o.meta,
|
|
1348
|
+
value: JSON.stringify(o.meta)
|
|
1349
1349
|
})) ?? [],
|
|
1350
|
-
onSelect: (
|
|
1351
|
-
_(
|
|
1350
|
+
onSelect: (o) => {
|
|
1351
|
+
_(o) && l(`${s}.${n}.sort`, o.meta);
|
|
1352
1352
|
}
|
|
1353
1353
|
}
|
|
1354
1354
|
)
|
|
@@ -1358,19 +1358,19 @@ function gt({
|
|
|
1358
1358
|
item: e,
|
|
1359
1359
|
pathPrefix: s
|
|
1360
1360
|
}) {
|
|
1361
|
-
const n = "discount_mode", { setPath: l } =
|
|
1361
|
+
const n = "discount_mode", { setPath: l } = m(), r = N({ item: e, optionName: n, pathPrefix: s });
|
|
1362
1362
|
return !(n in e) || r == null ? null : /* @__PURE__ */ t.jsx(r.OptionRow, { children: /* @__PURE__ */ t.jsx(
|
|
1363
1363
|
x,
|
|
1364
1364
|
{
|
|
1365
1365
|
initialValues: r.optionConfig?.values ?? [],
|
|
1366
1366
|
defaultValue: e[n] != null ? {
|
|
1367
1367
|
label: r.optionConfig?.values?.find(
|
|
1368
|
-
(
|
|
1368
|
+
(i) => i.value === e[n]
|
|
1369
1369
|
)?.label ?? e[n],
|
|
1370
1370
|
value: e[n]
|
|
1371
1371
|
} : void 0,
|
|
1372
|
-
onSelect: (
|
|
1373
|
-
_(
|
|
1372
|
+
onSelect: (i) => {
|
|
1373
|
+
_(i) && l(`${s}.${n}`, i.value);
|
|
1374
1374
|
}
|
|
1375
1375
|
}
|
|
1376
1376
|
) });
|
|
@@ -1379,7 +1379,7 @@ function ht({
|
|
|
1379
1379
|
item: e,
|
|
1380
1380
|
pathPrefix: s
|
|
1381
1381
|
}) {
|
|
1382
|
-
const n = "apply_on", { setPath: l } =
|
|
1382
|
+
const n = "apply_on", { setPath: l } = m(), r = N({ item: e, optionName: n, pathPrefix: s });
|
|
1383
1383
|
return !(n in e) || r == null ? null : /* @__PURE__ */ t.jsx(r.OptionRow, { children: /* @__PURE__ */ t.jsx(
|
|
1384
1384
|
x,
|
|
1385
1385
|
{
|
|
@@ -1387,12 +1387,12 @@ function ht({
|
|
|
1387
1387
|
isSearchable: !1,
|
|
1388
1388
|
defaultValue: e[n] != null && e[n] !== "" ? {
|
|
1389
1389
|
label: r.optionConfig?.values?.find(
|
|
1390
|
-
(
|
|
1390
|
+
(i) => i.value === e[n]
|
|
1391
1391
|
)?.label ?? e[n],
|
|
1392
1392
|
value: e[n]
|
|
1393
1393
|
} : void 0,
|
|
1394
|
-
onSelect: (
|
|
1395
|
-
_(
|
|
1394
|
+
onSelect: (i) => {
|
|
1395
|
+
_(i) && l(`${s}.${n}`, i.value);
|
|
1396
1396
|
}
|
|
1397
1397
|
}
|
|
1398
1398
|
) });
|
|
@@ -1401,18 +1401,18 @@ function bt({
|
|
|
1401
1401
|
item: e,
|
|
1402
1402
|
pathPrefix: s
|
|
1403
1403
|
}) {
|
|
1404
|
-
const n = "identifiers", { setPath: l } =
|
|
1404
|
+
const n = "identifiers", { setPath: l } = m(), r = N({ item: e, optionName: n, pathPrefix: s });
|
|
1405
1405
|
if (r == null || r.optionConfig?.required !== !0)
|
|
1406
1406
|
return null;
|
|
1407
|
-
const
|
|
1408
|
-
return (r.optionConfig?.values ?? []).map(({ label:
|
|
1407
|
+
const i = n in e ? e.identifiers : {};
|
|
1408
|
+
return (r.optionConfig?.values ?? []).map(({ label: o, value: u }) => {
|
|
1409
1409
|
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;
|
|
1410
1410
|
return c == null ? null : /* @__PURE__ */ t.jsx(
|
|
1411
1411
|
I,
|
|
1412
1412
|
{
|
|
1413
1413
|
label: /* @__PURE__ */ t.jsxs(C, { variant: "info", size: "small", className: "flex gap-2 items-center", children: [
|
|
1414
1414
|
"Free ",
|
|
1415
|
-
|
|
1415
|
+
o
|
|
1416
1416
|
] }),
|
|
1417
1417
|
children: /* @__PURE__ */ t.jsx(
|
|
1418
1418
|
ve,
|
|
@@ -1420,17 +1420,17 @@ function bt({
|
|
|
1420
1420
|
resource: c,
|
|
1421
1421
|
resourceKey: "id",
|
|
1422
1422
|
isMulti: !0,
|
|
1423
|
-
value:
|
|
1423
|
+
value: i[u] ?? [],
|
|
1424
1424
|
onSelect: (d) => {
|
|
1425
1425
|
if (E(d))
|
|
1426
1426
|
if (d.length > 0)
|
|
1427
1427
|
l(`${s}.${n}`, {
|
|
1428
|
-
...
|
|
1429
|
-
[u]: d.map((
|
|
1428
|
+
...i,
|
|
1429
|
+
[u]: d.map((f) => f.value).filter((f) => f != null)
|
|
1430
1430
|
});
|
|
1431
1431
|
else {
|
|
1432
|
-
const
|
|
1433
|
-
delete
|
|
1432
|
+
const f = { ...i };
|
|
1433
|
+
delete f[u], l(`${s}.${n}`, f);
|
|
1434
1434
|
}
|
|
1435
1435
|
}
|
|
1436
1436
|
}
|
|
@@ -1468,13 +1468,13 @@ function yt({
|
|
|
1468
1468
|
item: e,
|
|
1469
1469
|
pathPrefix: s
|
|
1470
1470
|
}) {
|
|
1471
|
-
const n = "group", { setPath: l } =
|
|
1471
|
+
const n = "group", { setPath: l } = m(), r = N({ item: e, optionName: n, pathPrefix: s }), i = xe();
|
|
1472
1472
|
return !(n in e) || r == null || e.group === void 0 ? null : /* @__PURE__ */ t.jsx(r.OptionRow, { children: /* @__PURE__ */ t.jsx(
|
|
1473
1473
|
x,
|
|
1474
1474
|
{
|
|
1475
1475
|
name: `${s}.group`,
|
|
1476
1476
|
isCreatable: !0,
|
|
1477
|
-
initialValues:
|
|
1477
|
+
initialValues: i.map((a) => ({
|
|
1478
1478
|
value: a,
|
|
1479
1479
|
label: a
|
|
1480
1480
|
})),
|
|
@@ -1493,14 +1493,14 @@ function jt({
|
|
|
1493
1493
|
item: e,
|
|
1494
1494
|
pathPrefix: s
|
|
1495
1495
|
}) {
|
|
1496
|
-
const n = "aggregations", { setPath: l } =
|
|
1497
|
-
return !(n in e) || a == null || e[n] == null || e[n].length === 0 ? null : /* @__PURE__ */ t.jsx(a.OptionRow, { children: e.aggregations?.map((
|
|
1496
|
+
const n = "aggregations", { setPath: l } = m(), [r, i] = v(0), a = N({ item: e, optionName: n, pathPrefix: s });
|
|
1497
|
+
return !(n in e) || a == null || e[n] == null || e[n].length === 0 ? null : /* @__PURE__ */ t.jsx(a.OptionRow, { children: e.aggregations?.map((o, u) => {
|
|
1498
1498
|
const c = u.toString();
|
|
1499
1499
|
return /* @__PURE__ */ t.jsxs("div", { className: "flex justify-between gap-2", children: [
|
|
1500
1500
|
/* @__PURE__ */ t.jsx(
|
|
1501
1501
|
we,
|
|
1502
1502
|
{
|
|
1503
|
-
aggregation:
|
|
1503
|
+
aggregation: o,
|
|
1504
1504
|
optionConfig: a.optionConfig,
|
|
1505
1505
|
pathPrefix: `${s}.${n}.${u}`
|
|
1506
1506
|
}
|
|
@@ -1531,7 +1531,7 @@ function jt({
|
|
|
1531
1531
|
onClick: () => {
|
|
1532
1532
|
l(
|
|
1533
1533
|
`${s}.aggregations.${e.aggregations?.length}`,
|
|
1534
|
-
|
|
1534
|
+
o
|
|
1535
1535
|
);
|
|
1536
1536
|
}
|
|
1537
1537
|
},
|
|
@@ -1544,7 +1544,7 @@ function jt({
|
|
|
1544
1544
|
label: "Remove",
|
|
1545
1545
|
disabled: e.aggregations?.length === 1,
|
|
1546
1546
|
onClick: () => {
|
|
1547
|
-
e.aggregations?.length === 1 ? l(`${s}.aggregations`, null) : l(`${s}.aggregations.${u}`, null),
|
|
1547
|
+
e.aggregations?.length === 1 ? l(`${s}.aggregations`, null) : l(`${s}.aggregations.${u}`, null), i((d) => d + 1);
|
|
1548
1548
|
}
|
|
1549
1549
|
},
|
|
1550
1550
|
`${c}-"remove-aggregation"`
|
|
@@ -1559,19 +1559,19 @@ function _t({
|
|
|
1559
1559
|
item: e,
|
|
1560
1560
|
pathPrefix: s
|
|
1561
1561
|
}) {
|
|
1562
|
-
const n = "scope", { setPath: l } =
|
|
1562
|
+
const n = "scope", { setPath: l } = m(), r = N({ item: e, optionName: n, pathPrefix: s });
|
|
1563
1563
|
return !(n in e) || r == null ? null : /* @__PURE__ */ t.jsx(r.OptionRow, { children: /* @__PURE__ */ t.jsx(
|
|
1564
1564
|
x,
|
|
1565
1565
|
{
|
|
1566
1566
|
initialValues: r.optionConfig?.values ?? [],
|
|
1567
1567
|
defaultValue: e[n] != null ? {
|
|
1568
1568
|
label: r.optionConfig?.values?.find(
|
|
1569
|
-
(
|
|
1569
|
+
(i) => i.value === e[n]
|
|
1570
1570
|
)?.label ?? e[n],
|
|
1571
1571
|
value: e[n]
|
|
1572
1572
|
} : void 0,
|
|
1573
|
-
onSelect: (
|
|
1574
|
-
_(
|
|
1573
|
+
onSelect: (i) => {
|
|
1574
|
+
_(i) && l(`${s}.${n}`, i.value);
|
|
1575
1575
|
}
|
|
1576
1576
|
}
|
|
1577
1577
|
) });
|
|
@@ -1580,7 +1580,7 @@ function $t({
|
|
|
1580
1580
|
item: e,
|
|
1581
1581
|
pathPrefix: s
|
|
1582
1582
|
}) {
|
|
1583
|
-
const { setPath: n } =
|
|
1583
|
+
const { setPath: n } = m();
|
|
1584
1584
|
if (e == null)
|
|
1585
1585
|
return null;
|
|
1586
1586
|
switch (e.type) {
|
|
@@ -1708,24 +1708,24 @@ function Nt({
|
|
|
1708
1708
|
const {
|
|
1709
1709
|
setPath: l,
|
|
1710
1710
|
setRenderOption: r,
|
|
1711
|
-
state: { selectedRuleIndex:
|
|
1711
|
+
state: { selectedRuleIndex: i },
|
|
1712
1712
|
optionsConfig: a,
|
|
1713
|
-
schemaType:
|
|
1714
|
-
} =
|
|
1713
|
+
schemaType: o
|
|
1714
|
+
} = m(), u = Object.keys(
|
|
1715
1715
|
a.actions
|
|
1716
|
-
), c = e != null && "selector" in e ? e.selector : "", d = e?.type != null ? a.actions?.[e.type]?.[c] ?? [] : [], { available:
|
|
1716
|
+
), c = e != null && "selector" in e ? e.selector : "", d = e?.type != null ? a.actions?.[e.type]?.[c] ?? [] : [], { available: f, required: h } = Ne(e, d), p = {
|
|
1717
1717
|
free_gift: "Free gift",
|
|
1718
1718
|
percentage: "Percentage discount",
|
|
1719
1719
|
fixed_amount: "Fixed amount",
|
|
1720
1720
|
fixed_price: "Fixed price",
|
|
1721
1721
|
buy_x_pay_y: "Buy X, Pay Y",
|
|
1722
1722
|
every_x_discount_y: "Every X, Discount Y"
|
|
1723
|
-
}, g = `rules.${
|
|
1723
|
+
}, g = `rules.${i}.actions.${s}`, w = (b) => {
|
|
1724
1724
|
switch (b) {
|
|
1725
1725
|
case "selector":
|
|
1726
1726
|
l(
|
|
1727
1727
|
`${g}.selector`,
|
|
1728
|
-
|
|
1728
|
+
o === "order-rules" ? "order.line_items" : o === "price-rules" ? "price" : null,
|
|
1729
1729
|
!0
|
|
1730
1730
|
);
|
|
1731
1731
|
break;
|
|
@@ -1769,7 +1769,7 @@ function Nt({
|
|
|
1769
1769
|
},
|
|
1770
1770
|
[e, h, g]
|
|
1771
1771
|
), /* @__PURE__ */ t.jsx("div", { className: "mb-4 last:mb-0", children: /* @__PURE__ */ t.jsxs(
|
|
1772
|
-
|
|
1772
|
+
fe,
|
|
1773
1773
|
{
|
|
1774
1774
|
pathPrefix: g,
|
|
1775
1775
|
dropdownItems: n != null ? /* @__PURE__ */ t.jsx(
|
|
@@ -1783,12 +1783,12 @@ function Nt({
|
|
|
1783
1783
|
) : void 0,
|
|
1784
1784
|
options: /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
1785
1785
|
/* @__PURE__ */ t.jsx(ot, { item: e, pathPrefix: g }),
|
|
1786
|
-
|
|
1786
|
+
f.length > 0 && /* @__PURE__ */ t.jsx(
|
|
1787
1787
|
S,
|
|
1788
1788
|
{
|
|
1789
1789
|
className: "inline-flex mt-6",
|
|
1790
1790
|
menuPosition: "bottom-left",
|
|
1791
|
-
dropdownItems:
|
|
1791
|
+
dropdownItems: f.map((b) => /* @__PURE__ */ t.jsx(
|
|
1792
1792
|
$,
|
|
1793
1793
|
{
|
|
1794
1794
|
onClick: () => {
|
|
@@ -1837,14 +1837,14 @@ function wt({
|
|
|
1837
1837
|
const [s, n] = v(0), {
|
|
1838
1838
|
setPath: l,
|
|
1839
1839
|
state: { selectedRuleIndex: r }
|
|
1840
|
-
} =
|
|
1840
|
+
} = m();
|
|
1841
1841
|
return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
1842
|
-
/* @__PURE__ */ t.jsx("div", { children: e?.map((
|
|
1842
|
+
/* @__PURE__ */ t.jsx("div", { children: e?.map((i, a, o) => /* @__PURE__ */ t.jsx(
|
|
1843
1843
|
Nt,
|
|
1844
1844
|
{
|
|
1845
|
-
item:
|
|
1845
|
+
item: i,
|
|
1846
1846
|
index: a,
|
|
1847
|
-
onDelete:
|
|
1847
|
+
onDelete: o.length > 1 ? () => {
|
|
1848
1848
|
n((u) => u + 1);
|
|
1849
1849
|
} : void 0
|
|
1850
1850
|
},
|
|
@@ -1875,7 +1875,7 @@ function Ct({
|
|
|
1875
1875
|
value: e,
|
|
1876
1876
|
name: s
|
|
1877
1877
|
}) {
|
|
1878
|
-
const { setPath: n, schemaType: l } =
|
|
1878
|
+
const { setPath: n, schemaType: l } = m(), { t: r } = re(), i = ue(null), a = l === "order-rules" ? "order" : l === "price-rules" ? "price" : void 0, o = ae(
|
|
1879
1879
|
Tt.filter(
|
|
1880
1880
|
(u) => a != null && u.startsWith(a)
|
|
1881
1881
|
).map((u) => ({
|
|
@@ -1890,10 +1890,10 @@ function Ct({
|
|
|
1890
1890
|
return /* @__PURE__ */ t.jsx(
|
|
1891
1891
|
x,
|
|
1892
1892
|
{
|
|
1893
|
-
ref:
|
|
1893
|
+
ref: i,
|
|
1894
1894
|
name: s,
|
|
1895
|
-
initialValues:
|
|
1896
|
-
defaultValue: e != null ?
|
|
1895
|
+
initialValues: o,
|
|
1896
|
+
defaultValue: e != null ? o.find((u) => u.value === e) ?? {
|
|
1897
1897
|
value: e,
|
|
1898
1898
|
label: e
|
|
1899
1899
|
} : void 0,
|
|
@@ -1902,7 +1902,7 @@ function Ct({
|
|
|
1902
1902
|
loadAsyncValues: async (u) => {
|
|
1903
1903
|
if (a == null)
|
|
1904
1904
|
return [];
|
|
1905
|
-
const c =
|
|
1905
|
+
const c = o.filter(
|
|
1906
1906
|
(p) => p.label.includes(u)
|
|
1907
1907
|
), d = (await We([a], u)).filter((p) => p.value.startsWith(u)).map((p) => {
|
|
1908
1908
|
const g = p.type === "relationship" || p.value.endsWith(".metadata") ? `${p.value}.` : p.value;
|
|
@@ -1910,11 +1910,11 @@ function Ct({
|
|
|
1910
1910
|
value: g,
|
|
1911
1911
|
label: g
|
|
1912
1912
|
};
|
|
1913
|
-
}),
|
|
1914
|
-
return [...c, ...d, ...
|
|
1913
|
+
}), f = u.includes(".metadata") ? [{ label: u, value: u }] : [];
|
|
1914
|
+
return [...c, ...d, ...f];
|
|
1915
1915
|
},
|
|
1916
1916
|
onSelect: async (u) => {
|
|
1917
|
-
_(u) && (n(s, u.value), u.value.toString().endsWith(".") &&
|
|
1917
|
+
_(u) && (n(s, u.value), u.value.toString().endsWith(".") && i.current?.openMenu("first"));
|
|
1918
1918
|
}
|
|
1919
1919
|
}
|
|
1920
1920
|
);
|
|
@@ -1972,14 +1972,14 @@ function St({
|
|
|
1972
1972
|
item: e,
|
|
1973
1973
|
pathPrefix: s
|
|
1974
1974
|
}) {
|
|
1975
|
-
const { setPath: n } =
|
|
1975
|
+
const { setPath: n } = m(), { infos: l } = J(e);
|
|
1976
1976
|
let r = l?.field?.type;
|
|
1977
1977
|
r == null && (r = ge(e?.value));
|
|
1978
|
-
const
|
|
1978
|
+
const i = l?.resource?.id, a = ["tag"], o = [
|
|
1979
1979
|
"matches",
|
|
1980
1980
|
"does_not_match",
|
|
1981
1981
|
"array_match"
|
|
1982
|
-
], u =
|
|
1982
|
+
], u = me.filter(({ fieldTypes: c, visible: d }) => d !== !1 && c.includes(r)).filter(({ matcher: c }) => i == null || i != null && !a.includes(i) || o.includes(c)).map(({ matcher: c, label: d }) => ({ value: c, label: d }));
|
|
1983
1983
|
return /* @__PURE__ */ t.jsx(
|
|
1984
1984
|
x,
|
|
1985
1985
|
{
|
|
@@ -1999,7 +1999,7 @@ function St({
|
|
|
1999
1999
|
);
|
|
2000
2000
|
}
|
|
2001
2001
|
const Ce = ({ value: e, pathKey: s, infos: n, onSelect: l }) => {
|
|
2002
|
-
const { setPath: r } =
|
|
2002
|
+
const { setPath: r } = m();
|
|
2003
2003
|
return /* @__PURE__ */ t.jsx(
|
|
2004
2004
|
ve,
|
|
2005
2005
|
{
|
|
@@ -2007,11 +2007,11 @@ const Ce = ({ value: e, pathKey: s, infos: n, onSelect: l }) => {
|
|
|
2007
2007
|
resource: Ze(n?.resource?.id),
|
|
2008
2008
|
isMulti: n?.matcherInfos?.isMulti,
|
|
2009
2009
|
value: e,
|
|
2010
|
-
onSelect: (
|
|
2011
|
-
l?.(
|
|
2010
|
+
onSelect: (i) => {
|
|
2011
|
+
l?.(i), E(i) ? r(
|
|
2012
2012
|
s,
|
|
2013
|
-
|
|
2014
|
-
) : _(
|
|
2013
|
+
i.map((a) => a.value).filter((a) => a != null)
|
|
2014
|
+
) : _(i) && r(s, i.value);
|
|
2015
2015
|
}
|
|
2016
2016
|
}
|
|
2017
2017
|
);
|
|
@@ -2035,17 +2035,17 @@ function te({
|
|
|
2035
2035
|
hasResourceSelector: n = !1,
|
|
2036
2036
|
infos: l
|
|
2037
2037
|
}) {
|
|
2038
|
-
const { setPath: r } =
|
|
2038
|
+
const { setPath: r } = m(), i = Object.keys(
|
|
2039
2039
|
M
|
|
2040
2040
|
)[0], a = ie(() => typeof e == "object" && e !== null && !Array.isArray(e) ? e : {
|
|
2041
|
-
[
|
|
2041
|
+
[i]: []
|
|
2042
2042
|
}, [e]);
|
|
2043
2043
|
T(() => {
|
|
2044
2044
|
(typeof e != "object" || Array.isArray(e) || e === null) && r(s, {
|
|
2045
|
-
[
|
|
2045
|
+
[i]: []
|
|
2046
2046
|
});
|
|
2047
2047
|
}, [e]);
|
|
2048
|
-
const
|
|
2048
|
+
const o = Object.keys(M).filter(
|
|
2049
2049
|
(u) => !(u in a)
|
|
2050
2050
|
);
|
|
2051
2051
|
return /* @__PURE__ */ t.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
@@ -2057,19 +2057,19 @@ function te({
|
|
|
2057
2057
|
pathPrefix: s,
|
|
2058
2058
|
defaultValue: c,
|
|
2059
2059
|
initialMatcher: u,
|
|
2060
|
-
remainingKeys:
|
|
2060
|
+
remainingKeys: o
|
|
2061
2061
|
},
|
|
2062
2062
|
`${s}.${// biome-ignore lint/suspicious/noArrayIndexKey: Using index as key is acceptable here since items are static
|
|
2063
2063
|
d}`
|
|
2064
2064
|
)),
|
|
2065
|
-
|
|
2065
|
+
o.length > 0 && /* @__PURE__ */ t.jsxs(X, { top: "4", children: [
|
|
2066
2066
|
/* @__PURE__ */ t.jsx(
|
|
2067
2067
|
S,
|
|
2068
2068
|
{
|
|
2069
2069
|
className: "inline-flex",
|
|
2070
2070
|
menuPosition: "bottom-left",
|
|
2071
2071
|
dropdownItems: [
|
|
2072
|
-
|
|
2072
|
+
o.map((u) => /* @__PURE__ */ t.jsx(
|
|
2073
2073
|
$,
|
|
2074
2074
|
{
|
|
2075
2075
|
onClick: () => {
|
|
@@ -2089,7 +2089,7 @@ function te({
|
|
|
2089
2089
|
),
|
|
2090
2090
|
/* @__PURE__ */ t.jsx(X, { top: "6", bottom: "2", children: /* @__PURE__ */ t.jsx(Ie, { variant: "dashed" }) })
|
|
2091
2091
|
] })
|
|
2092
|
-
] },
|
|
2092
|
+
] }, o.join("-"));
|
|
2093
2093
|
}
|
|
2094
2094
|
function kt({
|
|
2095
2095
|
initialMatcher: e,
|
|
@@ -2097,9 +2097,9 @@ function kt({
|
|
|
2097
2097
|
pathPrefix: n,
|
|
2098
2098
|
hasResourceSelector: l,
|
|
2099
2099
|
infos: r,
|
|
2100
|
-
remainingKeys:
|
|
2100
|
+
remainingKeys: i
|
|
2101
2101
|
}) {
|
|
2102
|
-
const [a,
|
|
2102
|
+
const [a, o] = v(s), { setPath: u } = m();
|
|
2103
2103
|
return T(() => {
|
|
2104
2104
|
u(`${n}.${e}`, a);
|
|
2105
2105
|
}, [a]), /* @__PURE__ */ t.jsx(
|
|
@@ -2111,7 +2111,7 @@ function kt({
|
|
|
2111
2111
|
className: "inline-flex",
|
|
2112
2112
|
menuPosition: "bottom-left",
|
|
2113
2113
|
dropdownItems: [
|
|
2114
|
-
|
|
2114
|
+
i.map((c) => /* @__PURE__ */ t.jsx(
|
|
2115
2115
|
$,
|
|
2116
2116
|
{
|
|
2117
2117
|
onClick: () => {
|
|
@@ -2124,14 +2124,14 @@ function kt({
|
|
|
2124
2124
|
/* @__PURE__ */ t.jsx(
|
|
2125
2125
|
z,
|
|
2126
2126
|
{
|
|
2127
|
-
hidden:
|
|
2127
|
+
hidden: i.length === 0
|
|
2128
2128
|
},
|
|
2129
2129
|
"divider"
|
|
2130
2130
|
),
|
|
2131
2131
|
/* @__PURE__ */ t.jsx(
|
|
2132
2132
|
$,
|
|
2133
2133
|
{
|
|
2134
|
-
disabled:
|
|
2134
|
+
disabled: i.length === Object.keys(M).length - 1,
|
|
2135
2135
|
onClick: () => {
|
|
2136
2136
|
u(`${n}.${e}`, null);
|
|
2137
2137
|
},
|
|
@@ -2162,7 +2162,7 @@ function kt({
|
|
|
2162
2162
|
value: a,
|
|
2163
2163
|
pathKey: `${n}.${e}`,
|
|
2164
2164
|
onSelect: (c) => {
|
|
2165
|
-
E(c) &&
|
|
2165
|
+
E(c) && o(
|
|
2166
2166
|
c.map(
|
|
2167
2167
|
(d) => typeof d.value == "boolean" ? d.value.toString() : d.value
|
|
2168
2168
|
)
|
|
@@ -2181,7 +2181,7 @@ function kt({
|
|
|
2181
2181
|
})),
|
|
2182
2182
|
initialValues: [],
|
|
2183
2183
|
onSelect: (c) => {
|
|
2184
|
-
E(c) &&
|
|
2184
|
+
E(c) && o(
|
|
2185
2185
|
c.map(
|
|
2186
2186
|
(d) => typeof d.value == "boolean" ? d.value.toString() : d.value
|
|
2187
2187
|
)
|
|
@@ -2198,7 +2198,7 @@ function Ot({
|
|
|
2198
2198
|
}) {
|
|
2199
2199
|
const [n, l] = v(
|
|
2200
2200
|
Array.isArray(e) && typeof e[0] == "number" ? e[0] : null
|
|
2201
|
-
), [r,
|
|
2201
|
+
), [r, i] = v(
|
|
2202
2202
|
Array.isArray(e) && typeof e[1] == "number" ? e[1] : null
|
|
2203
2203
|
);
|
|
2204
2204
|
return /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-4", children: [
|
|
@@ -2209,8 +2209,8 @@ function Ot({
|
|
|
2209
2209
|
placeholder: "Min",
|
|
2210
2210
|
value: n ?? "",
|
|
2211
2211
|
onChange: (a) => {
|
|
2212
|
-
const
|
|
2213
|
-
l(Number.isNaN(
|
|
2212
|
+
const o = parseInt(a.currentTarget.value, 10);
|
|
2213
|
+
l(Number.isNaN(o) ? null : o), s([Number.isNaN(o) ? null : o, r]);
|
|
2214
2214
|
}
|
|
2215
2215
|
}
|
|
2216
2216
|
) }),
|
|
@@ -2222,8 +2222,8 @@ function Ot({
|
|
|
2222
2222
|
placeholder: "Max",
|
|
2223
2223
|
value: r ?? "",
|
|
2224
2224
|
onChange: (a) => {
|
|
2225
|
-
const
|
|
2226
|
-
|
|
2225
|
+
const o = parseInt(a.currentTarget.value, 10);
|
|
2226
|
+
i(Number.isNaN(o) ? null : o), s([n, Number.isNaN(o) ? null : o]);
|
|
2227
2227
|
}
|
|
2228
2228
|
}
|
|
2229
2229
|
) })
|
|
@@ -2235,7 +2235,7 @@ function Rt({
|
|
|
2235
2235
|
}) {
|
|
2236
2236
|
const [n, l] = v(
|
|
2237
2237
|
Array.isArray(e) && typeof e[0] == "string" ? e[0] : null
|
|
2238
|
-
), [r,
|
|
2238
|
+
), [r, i] = v(
|
|
2239
2239
|
Array.isArray(e) && typeof e[1] == "string" ? e[1] : null
|
|
2240
2240
|
);
|
|
2241
2241
|
return /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-4", children: [
|
|
@@ -2246,8 +2246,8 @@ function Rt({
|
|
|
2246
2246
|
placeholder: "Min",
|
|
2247
2247
|
value: n ?? "",
|
|
2248
2248
|
onChange: (a) => {
|
|
2249
|
-
const
|
|
2250
|
-
l(
|
|
2249
|
+
const o = a.currentTarget.value;
|
|
2250
|
+
l(o), s([o, r]);
|
|
2251
2251
|
}
|
|
2252
2252
|
}
|
|
2253
2253
|
) }),
|
|
@@ -2259,8 +2259,8 @@ function Rt({
|
|
|
2259
2259
|
placeholder: "Max",
|
|
2260
2260
|
value: r ?? "",
|
|
2261
2261
|
onChange: (a) => {
|
|
2262
|
-
const
|
|
2263
|
-
o
|
|
2262
|
+
const o = a.currentTarget.value;
|
|
2263
|
+
i(o), s([n, o]);
|
|
2264
2264
|
}
|
|
2265
2265
|
}
|
|
2266
2266
|
) })
|
|
@@ -2270,7 +2270,7 @@ function Vt({
|
|
|
2270
2270
|
item: e,
|
|
2271
2271
|
pathPrefix: s
|
|
2272
2272
|
}) {
|
|
2273
|
-
const { setPath: n } =
|
|
2273
|
+
const { setPath: n } = m(), { componentType: l, fieldType: r } = Mt(e), i = `${s}.value`, [a, o] = v(0), [u, c] = v({
|
|
2274
2274
|
componentType: l,
|
|
2275
2275
|
matcher: e?.matcher,
|
|
2276
2276
|
field: e?.field
|
|
@@ -2285,10 +2285,10 @@ function Vt({
|
|
|
2285
2285
|
})), u.matcher !== e?.matcher && (c((p) => ({
|
|
2286
2286
|
...p,
|
|
2287
2287
|
matcher: e?.matcher
|
|
2288
|
-
})), e?.matcher === "array_match" ? n(
|
|
2288
|
+
})), e?.matcher === "array_match" ? n(i, { in_and: [] }) : n(i, null), o((p) => p + 1))), u.field !== e?.field && (c((p) => ({
|
|
2289
2289
|
...p,
|
|
2290
2290
|
field: e?.field
|
|
2291
|
-
})), n(
|
|
2291
|
+
})), n(i, null), o((p) => p + 1));
|
|
2292
2292
|
},
|
|
2293
2293
|
[e]
|
|
2294
2294
|
), d ? null : l === "arrayMatch" || l === "resourceSelector" && e?.matcher === "array_match" ? /* @__PURE__ */ t.jsx("div", { children: /* @__PURE__ */ t.jsx(
|
|
@@ -2297,7 +2297,7 @@ function Vt({
|
|
|
2297
2297
|
item: e,
|
|
2298
2298
|
fieldType: r,
|
|
2299
2299
|
componentType: l,
|
|
2300
|
-
pathKey:
|
|
2300
|
+
pathKey: i
|
|
2301
2301
|
}
|
|
2302
2302
|
) }, a) : /* @__PURE__ */ t.jsx(
|
|
2303
2303
|
I,
|
|
@@ -2309,7 +2309,7 @@ function Vt({
|
|
|
2309
2309
|
item: e,
|
|
2310
2310
|
fieldType: r,
|
|
2311
2311
|
componentType: l,
|
|
2312
|
-
pathKey:
|
|
2312
|
+
pathKey: i
|
|
2313
2313
|
}
|
|
2314
2314
|
)
|
|
2315
2315
|
},
|
|
@@ -2322,10 +2322,10 @@ function ne({
|
|
|
2322
2322
|
componentType: n,
|
|
2323
2323
|
pathKey: l
|
|
2324
2324
|
}) {
|
|
2325
|
-
const { setPath: r } =
|
|
2325
|
+
const { setPath: r } = m(), { user: i } = oe(), { infos: a } = J(e), o = Te(e) ? e.value : void 0;
|
|
2326
2326
|
switch (n) {
|
|
2327
2327
|
case "date": {
|
|
2328
|
-
const u = Q(typeof
|
|
2328
|
+
const u = Q(typeof o == "string" ? o : "");
|
|
2329
2329
|
return /* @__PURE__ */ t.jsx(
|
|
2330
2330
|
De,
|
|
2331
2331
|
{
|
|
@@ -2335,12 +2335,12 @@ function ne({
|
|
|
2335
2335
|
onChange: (c) => {
|
|
2336
2336
|
r(l, c?.toJSON());
|
|
2337
2337
|
},
|
|
2338
|
-
timezone:
|
|
2338
|
+
timezone: i?.timezone
|
|
2339
2339
|
}
|
|
2340
2340
|
);
|
|
2341
2341
|
}
|
|
2342
2342
|
case "dateRange": {
|
|
2343
|
-
const u = Array.isArray(
|
|
2343
|
+
const u = Array.isArray(o) ? o.map((c) => {
|
|
2344
2344
|
const d = Q(typeof c == "string" ? c : "");
|
|
2345
2345
|
return L(d) ? d : null;
|
|
2346
2346
|
}) : [null, null];
|
|
@@ -2362,7 +2362,7 @@ function ne({
|
|
|
2362
2362
|
return /* @__PURE__ */ t.jsx(
|
|
2363
2363
|
Ot,
|
|
2364
2364
|
{
|
|
2365
|
-
value:
|
|
2365
|
+
value: o,
|
|
2366
2366
|
onChange: (u) => {
|
|
2367
2367
|
r(l, u);
|
|
2368
2368
|
}
|
|
@@ -2372,14 +2372,14 @@ function ne({
|
|
|
2372
2372
|
return /* @__PURE__ */ t.jsx(
|
|
2373
2373
|
Rt,
|
|
2374
2374
|
{
|
|
2375
|
-
value:
|
|
2375
|
+
value: o,
|
|
2376
2376
|
onChange: (u) => {
|
|
2377
2377
|
r(l, u);
|
|
2378
2378
|
}
|
|
2379
2379
|
}
|
|
2380
2380
|
);
|
|
2381
2381
|
case "arrayMatch":
|
|
2382
|
-
return /* @__PURE__ */ t.jsx(te, { infos: a, value:
|
|
2382
|
+
return /* @__PURE__ */ t.jsx(te, { infos: a, value: o, pathPrefix: l });
|
|
2383
2383
|
case "tag":
|
|
2384
2384
|
return /* @__PURE__ */ t.jsx(
|
|
2385
2385
|
x,
|
|
@@ -2387,7 +2387,7 @@ function ne({
|
|
|
2387
2387
|
isMulti: !0,
|
|
2388
2388
|
isClearable: !1,
|
|
2389
2389
|
isCreatable: !0,
|
|
2390
|
-
defaultValue: Array.isArray(
|
|
2390
|
+
defaultValue: Array.isArray(o) ? o.map((u) => ({
|
|
2391
2391
|
label: u.toString(),
|
|
2392
2392
|
value: u
|
|
2393
2393
|
})) : [],
|
|
@@ -2411,18 +2411,18 @@ function ne({
|
|
|
2411
2411
|
te,
|
|
2412
2412
|
{
|
|
2413
2413
|
infos: a,
|
|
2414
|
-
value:
|
|
2414
|
+
value: o,
|
|
2415
2415
|
pathPrefix: l,
|
|
2416
2416
|
hasResourceSelector: !0
|
|
2417
2417
|
}
|
|
2418
|
-
) : /* @__PURE__ */ t.jsx(Ce, { infos: a, value:
|
|
2418
|
+
) : /* @__PURE__ */ t.jsx(Ce, { infos: a, value: o, pathKey: l });
|
|
2419
2419
|
case "number":
|
|
2420
2420
|
return /* @__PURE__ */ t.jsx(
|
|
2421
2421
|
y,
|
|
2422
2422
|
{
|
|
2423
2423
|
name: l,
|
|
2424
2424
|
type: "number",
|
|
2425
|
-
defaultValue: typeof
|
|
2425
|
+
defaultValue: typeof o == "number" ? o : "",
|
|
2426
2426
|
placeholder: "Enter value",
|
|
2427
2427
|
onChange: (u) => {
|
|
2428
2428
|
r(l, parseInt(u.currentTarget.value, 10));
|
|
@@ -2434,9 +2434,9 @@ function ne({
|
|
|
2434
2434
|
x,
|
|
2435
2435
|
{
|
|
2436
2436
|
name: l,
|
|
2437
|
-
defaultValue: typeof
|
|
2438
|
-
label:
|
|
2439
|
-
value:
|
|
2437
|
+
defaultValue: typeof o == "boolean" ? {
|
|
2438
|
+
label: o ? "Yes" : "No",
|
|
2439
|
+
value: o
|
|
2440
2440
|
} : void 0,
|
|
2441
2441
|
initialValues: [
|
|
2442
2442
|
{ label: "Yes", value: !0 },
|
|
@@ -2454,7 +2454,7 @@ function ne({
|
|
|
2454
2454
|
{
|
|
2455
2455
|
name: l,
|
|
2456
2456
|
type: "text",
|
|
2457
|
-
defaultValue: typeof
|
|
2457
|
+
defaultValue: typeof o == "string" ? o : JSON.stringify(o),
|
|
2458
2458
|
placeholder: "Enter value",
|
|
2459
2459
|
onChange: (u) => {
|
|
2460
2460
|
r(l, u.currentTarget.value);
|
|
@@ -2545,7 +2545,7 @@ function Et({
|
|
|
2545
2545
|
pathPrefix: n,
|
|
2546
2546
|
onDelete: l
|
|
2547
2547
|
}) {
|
|
2548
|
-
const { setPath: r, setRenderOption:
|
|
2548
|
+
const { setPath: r, setRenderOption: i, optionsConfig: a } = m(), { available: o } = Ne(
|
|
2549
2549
|
e,
|
|
2550
2550
|
a.conditions
|
|
2551
2551
|
), u = [];
|
|
@@ -2568,33 +2568,33 @@ function Et({
|
|
|
2568
2568
|
{
|
|
2569
2569
|
label: "Delete",
|
|
2570
2570
|
onClick: () => {
|
|
2571
|
-
r(`${n}`, null),
|
|
2571
|
+
r(`${n}`, null), i(`${n}`, null), l();
|
|
2572
2572
|
}
|
|
2573
2573
|
}
|
|
2574
2574
|
)
|
|
2575
2575
|
)), /* @__PURE__ */ t.jsx("div", { children: /* @__PURE__ */ t.jsxs(
|
|
2576
|
-
|
|
2576
|
+
fe,
|
|
2577
2577
|
{
|
|
2578
2578
|
pathPrefix: n,
|
|
2579
|
-
dropdownItems: u.map((c, d,
|
|
2579
|
+
dropdownItems: u.map((c, d, f) => (
|
|
2580
2580
|
// biome-ignore lint/suspicious/noArrayIndexKey: Using index as key is acceptable here since items are static
|
|
2581
2581
|
/* @__PURE__ */ t.jsxs(K.Fragment, { children: [
|
|
2582
2582
|
c.map((h, p) => (
|
|
2583
2583
|
// biome-ignore lint/suspicious/noArrayIndexKey: Using index as key is acceptable here since items are static
|
|
2584
2584
|
/* @__PURE__ */ t.jsx(K.Fragment, { children: h }, p)
|
|
2585
2585
|
)),
|
|
2586
|
-
d <
|
|
2586
|
+
d < f.length - 1 && /* @__PURE__ */ t.jsx(z, {})
|
|
2587
2587
|
] }, d)
|
|
2588
2588
|
)),
|
|
2589
2589
|
options: !H(e?.field) && !H(e?.matcher) && /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
2590
2590
|
/* @__PURE__ */ t.jsx(Vt, { item: e, pathPrefix: n }),
|
|
2591
2591
|
/* @__PURE__ */ t.jsx(vt, { item: e, pathPrefix: n }),
|
|
2592
|
-
|
|
2592
|
+
o.length > 0 && /* @__PURE__ */ t.jsx(
|
|
2593
2593
|
S,
|
|
2594
2594
|
{
|
|
2595
2595
|
className: "inline-flex mt-6",
|
|
2596
2596
|
menuPosition: "bottom-left",
|
|
2597
|
-
dropdownItems:
|
|
2597
|
+
dropdownItems: o.map((c) => /* @__PURE__ */ t.jsx(
|
|
2598
2598
|
$,
|
|
2599
2599
|
{
|
|
2600
2600
|
onClick: () => {
|
|
@@ -2637,7 +2637,7 @@ function Se({
|
|
|
2637
2637
|
}) {
|
|
2638
2638
|
const {
|
|
2639
2639
|
state: { selectedRuleIndex: r }
|
|
2640
|
-
} =
|
|
2640
|
+
} = m(), i = e?.conditions_logic?.toLowerCase() ?? "and", { setPath: a } = m(), [o, u] = v(0), c = n > 0;
|
|
2641
2641
|
return /* @__PURE__ */ t.jsxs(
|
|
2642
2642
|
"div",
|
|
2643
2643
|
{
|
|
@@ -2656,7 +2656,7 @@ function Se({
|
|
|
2656
2656
|
d.currentTarget.value
|
|
2657
2657
|
);
|
|
2658
2658
|
},
|
|
2659
|
-
defaultValue:
|
|
2659
|
+
defaultValue: i,
|
|
2660
2660
|
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",
|
|
2661
2661
|
children: [
|
|
2662
2662
|
/* @__PURE__ */ t.jsx("option", { value: "and", children: "Nested in AND" }),
|
|
@@ -2670,8 +2670,8 @@ function Se({
|
|
|
2670
2670
|
className: k({
|
|
2671
2671
|
"border-l border-gray-200 ml-3 pt-3": c
|
|
2672
2672
|
}),
|
|
2673
|
-
children: e?.conditions?.map((d,
|
|
2674
|
-
const p =
|
|
2673
|
+
children: e?.conditions?.map((d, f, h) => {
|
|
2674
|
+
const p = f === h.length - 1;
|
|
2675
2675
|
return /* @__PURE__ */ t.jsxs(
|
|
2676
2676
|
"div",
|
|
2677
2677
|
{
|
|
@@ -2689,7 +2689,7 @@ function Se({
|
|
|
2689
2689
|
{
|
|
2690
2690
|
item: d?.nested ?? void 0,
|
|
2691
2691
|
nestingLevel: d?.nested != null ? n + 1 : 0,
|
|
2692
|
-
pathPrefix: `${l}.conditions.${
|
|
2692
|
+
pathPrefix: `${l}.conditions.${f}.nested`,
|
|
2693
2693
|
children: /* @__PURE__ */ t.jsx(
|
|
2694
2694
|
"div",
|
|
2695
2695
|
{
|
|
@@ -2701,7 +2701,7 @@ function Se({
|
|
|
2701
2701
|
{
|
|
2702
2702
|
item: d,
|
|
2703
2703
|
nestingLevel: n,
|
|
2704
|
-
pathPrefix: `${l}.conditions.${
|
|
2704
|
+
pathPrefix: `${l}.conditions.${f}`,
|
|
2705
2705
|
onDelete: h.length > 1 || n > 0 ? () => {
|
|
2706
2706
|
u((g) => g + 1);
|
|
2707
2707
|
} : void 0
|
|
@@ -2715,7 +2715,7 @@ function Se({
|
|
|
2715
2715
|
)
|
|
2716
2716
|
]
|
|
2717
2717
|
},
|
|
2718
|
-
`${r}-${
|
|
2718
|
+
`${r}-${f}-${o}`
|
|
2719
2719
|
);
|
|
2720
2720
|
})
|
|
2721
2721
|
}
|
|
@@ -2754,7 +2754,7 @@ function qt() {
|
|
|
2754
2754
|
const {
|
|
2755
2755
|
setPath: e,
|
|
2756
2756
|
state: { value: s, selectedRuleIndex: n }
|
|
2757
|
-
} =
|
|
2757
|
+
} = m(), [l, r] = v(
|
|
2758
2758
|
s.rules?.[n]?.name ?? ""
|
|
2759
2759
|
);
|
|
2760
2760
|
return T(() => {
|
|
@@ -2774,15 +2774,15 @@ function qt() {
|
|
|
2774
2774
|
{
|
|
2775
2775
|
contentEditable: "plaintext-only",
|
|
2776
2776
|
suppressContentEditableWarning: !0,
|
|
2777
|
-
onInput: (
|
|
2778
|
-
const
|
|
2779
|
-
e(`rules.${n}.name`,
|
|
2777
|
+
onInput: (i) => {
|
|
2778
|
+
const o = i.currentTarget.innerText.replace(/[\n\s]+/g, " ").trim();
|
|
2779
|
+
e(`rules.${n}.name`, o);
|
|
2780
2780
|
},
|
|
2781
|
-
onKeyDown: (
|
|
2782
|
-
|
|
2781
|
+
onKeyDown: (i) => {
|
|
2782
|
+
i.key === "Enter" && (i.preventDefault(), i.currentTarget.blur());
|
|
2783
2783
|
},
|
|
2784
|
-
onBlur: (
|
|
2785
|
-
const a =
|
|
2784
|
+
onBlur: (i) => {
|
|
2785
|
+
const a = i.currentTarget;
|
|
2786
2786
|
a.innerText = a.innerText.replace(/[\n\s]+/g, " ").trim();
|
|
2787
2787
|
},
|
|
2788
2788
|
children: l
|
|
@@ -2811,23 +2811,28 @@ function Xt(e) {
|
|
|
2811
2811
|
} = oe(), [n, l] = v({
|
|
2812
2812
|
actions: {},
|
|
2813
2813
|
conditions: []
|
|
2814
|
-
}), [r,
|
|
2814
|
+
}), [r, i] = v(
|
|
2815
2815
|
F(e.value ?? e.defaultValue)
|
|
2816
2816
|
);
|
|
2817
2817
|
return T(
|
|
2818
2818
|
function() {
|
|
2819
|
-
r.rules?.length === 0 &&
|
|
2819
|
+
r.rules?.length === 0 && i(F(e.value));
|
|
2820
2820
|
},
|
|
2821
2821
|
[e.value]
|
|
2822
2822
|
), T(
|
|
2823
2823
|
function() {
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2824
|
+
let o = !1;
|
|
2825
|
+
return Be(e.schemaType, s).then((u) => {
|
|
2826
|
+
if (o)
|
|
2827
|
+
return;
|
|
2828
|
+
const c = tt(
|
|
2829
|
+
u,
|
|
2827
2830
|
e.schemaType
|
|
2828
2831
|
);
|
|
2829
|
-
l(
|
|
2830
|
-
})
|
|
2832
|
+
l(c);
|
|
2833
|
+
}), () => {
|
|
2834
|
+
o = !0;
|
|
2835
|
+
};
|
|
2831
2836
|
},
|
|
2832
2837
|
[s]
|
|
2833
2838
|
), /* @__PURE__ */ t.jsx(
|
|
@@ -2847,13 +2852,13 @@ function Lt(e) {
|
|
|
2847
2852
|
state: { value: s, selectedRuleIndex: n },
|
|
2848
2853
|
setSelectedRuleIndex: l,
|
|
2849
2854
|
setValue: r,
|
|
2850
|
-
setPath:
|
|
2851
|
-
} =
|
|
2855
|
+
setPath: i
|
|
2856
|
+
} = m(), [a, o] = v(!1), [u, c] = v(
|
|
2852
2857
|
e.defaultCodeEditorVisible ?? !1
|
|
2853
|
-
), d = s.rules?.[n],
|
|
2858
|
+
), d = s.rules?.[n], f = ue(null), [h, p] = v(0);
|
|
2854
2859
|
T(
|
|
2855
2860
|
function() {
|
|
2856
|
-
!a && !R(F(
|
|
2861
|
+
!a && !R(F(f.current?.getValue()), s) && (f.current?.setValue(JSON.stringify(s, null, 2)), e.onChange?.(s));
|
|
2857
2862
|
},
|
|
2858
2863
|
[s]
|
|
2859
2864
|
);
|
|
@@ -2909,7 +2914,7 @@ function Lt(e) {
|
|
|
2909
2914
|
{
|
|
2910
2915
|
onClick: () => {
|
|
2911
2916
|
const W = s.rules?.length ?? 0;
|
|
2912
|
-
|
|
2917
|
+
i(`rules.${W}`, {
|
|
2913
2918
|
...w,
|
|
2914
2919
|
id: void 0,
|
|
2915
2920
|
name: `${w.name} (copy)`
|
|
@@ -2924,7 +2929,7 @@ function Lt(e) {
|
|
|
2924
2929
|
{
|
|
2925
2930
|
disabled: V.length === 1,
|
|
2926
2931
|
onClick: () => {
|
|
2927
|
-
|
|
2932
|
+
i(`rules.${b}`, null), n >= b && l(n - 1);
|
|
2928
2933
|
},
|
|
2929
2934
|
label: "Delete"
|
|
2930
2935
|
}
|
|
@@ -2943,7 +2948,7 @@ function Lt(e) {
|
|
|
2943
2948
|
variant: "circle",
|
|
2944
2949
|
className: "mx-4",
|
|
2945
2950
|
onClick: () => {
|
|
2946
|
-
|
|
2951
|
+
i(`rules.${s.rules?.length ?? 0}`, {
|
|
2947
2952
|
name: "Rule name",
|
|
2948
2953
|
actions: [null],
|
|
2949
2954
|
conditions: [null]
|
|
@@ -2979,7 +2984,7 @@ function Lt(e) {
|
|
|
2979
2984
|
"select",
|
|
2980
2985
|
{
|
|
2981
2986
|
onChange: (w) => {
|
|
2982
|
-
|
|
2987
|
+
i(
|
|
2983
2988
|
`rules.${n}.conditions_logic`,
|
|
2984
2989
|
w.currentTarget.value
|
|
2985
2990
|
);
|
|
@@ -3013,7 +3018,7 @@ function Lt(e) {
|
|
|
3013
3018
|
variant: "secondary",
|
|
3014
3019
|
alignItems: "center",
|
|
3015
3020
|
onClick: () => {
|
|
3016
|
-
|
|
3021
|
+
i(
|
|
3017
3022
|
`rules.${n}.conditions.${d?.conditions?.length ?? 0}`,
|
|
3018
3023
|
void 0
|
|
3019
3024
|
);
|
|
@@ -3037,7 +3042,7 @@ function Lt(e) {
|
|
|
3037
3042
|
u && /* @__PURE__ */ t.jsx("div", { className: "shrink-0 basis-2/5", children: /* @__PURE__ */ t.jsx(
|
|
3038
3043
|
Fe,
|
|
3039
3044
|
{
|
|
3040
|
-
ref:
|
|
3045
|
+
ref: f,
|
|
3041
3046
|
name: e.id ?? e.name,
|
|
3042
3047
|
height: "100%",
|
|
3043
3048
|
language: "json",
|
|
@@ -3045,10 +3050,10 @@ function Lt(e) {
|
|
|
3045
3050
|
defaultValue: JSON.stringify(s, null, 2),
|
|
3046
3051
|
noRounding: !0,
|
|
3047
3052
|
onFocus: () => {
|
|
3048
|
-
|
|
3053
|
+
o(!0);
|
|
3049
3054
|
},
|
|
3050
3055
|
onBlur: () => {
|
|
3051
|
-
|
|
3056
|
+
o(!1);
|
|
3052
3057
|
},
|
|
3053
3058
|
onChange: g
|
|
3054
3059
|
}
|