@wallarm-org/design-system 4.9.0 → 4.10.0-rc-feat-parser.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +2 -0
- package/dist/components/DropdownMenu/DropdownMenu.js +84 -71
- package/dist/components/DropdownMenu/DropdownMenuItemDescription.js +1 -1
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useFilterInputAutocomplete.js +1 -1
- package/dist/components/Rules/PointSelector/KeyboardShortcutsDialog.d.ts +14 -0
- package/dist/components/Rules/PointSelector/KeyboardShortcutsDialog.js +209 -0
- package/dist/components/Rules/PointSelector/MatchStep.d.ts +15 -0
- package/dist/components/Rules/PointSelector/MatchStep.js +186 -0
- package/dist/components/Rules/PointSelector/MenuFooterHints.d.ts +16 -0
- package/dist/components/Rules/PointSelector/MenuFooterHints.js +177 -0
- package/dist/components/Rules/PointSelector/PointPreview.d.ts +10 -0
- package/dist/components/Rules/PointSelector/PointPreview.js +88 -0
- package/dist/components/Rules/PointSelector/PointSelector.d.ts +17 -0
- package/dist/components/Rules/PointSelector/PointSelector.js +937 -0
- package/dist/components/Rules/PointSelector/PointSelectorEmptyState.d.ts +12 -0
- package/dist/components/Rules/PointSelector/PointSelectorEmptyState.js +173 -0
- package/dist/components/Rules/PointSelector/PointSelectorError.d.ts +31 -0
- package/dist/components/Rules/PointSelector/PointSelectorError.js +275 -0
- package/dist/components/Rules/PointSelector/PointSelectorInput.d.ts +20 -0
- package/dist/components/Rules/PointSelector/PointSelectorInput.js +130 -0
- package/dist/components/Rules/PointSelector/PointSelectorMenu.d.ts +31 -0
- package/dist/components/Rules/PointSelector/PointSelectorMenu.js +317 -0
- package/dist/components/Rules/PointSelector/PointSelectorSkeleton.d.ts +8 -0
- package/dist/components/Rules/PointSelector/PointSelectorSkeleton.js +73 -0
- package/dist/components/Rules/PointSelector/SampleRequest.d.ts +14 -0
- package/dist/components/Rules/PointSelector/SampleRequest.js +116 -0
- package/dist/components/Rules/PointSelector/StepMenu.d.ts +40 -0
- package/dist/components/Rules/PointSelector/StepMenu.js +210 -0
- package/dist/components/Rules/PointSelector/VersionWarning.d.ts +26 -0
- package/dist/components/Rules/PointSelector/VersionWarning.js +231 -0
- package/dist/components/Rules/PointSelector/WhereBar.d.ts +48 -0
- package/dist/components/Rules/PointSelector/WhereBar.js +263 -0
- package/dist/components/Rules/PointSelector/classes.d.ts +28 -0
- package/dist/components/Rules/PointSelector/classes.js +22 -0
- package/dist/components/Rules/PointSelector/index.d.ts +20 -0
- package/dist/components/Rules/PointSelector/index.js +18 -0
- package/dist/components/Rules/PointSelector/liftLayer.d.ts +8 -0
- package/dist/components/Rules/PointSelector/liftLayer.js +4 -0
- package/dist/components/Rules/PointSelector/sampleValue.d.ts +6 -0
- package/dist/components/Rules/PointSelector/sampleValue.js +51 -0
- package/dist/components/Rules/PointSelector/sdkBridge.d.ts +508 -0
- package/dist/components/Rules/PointSelector/sdkBridge.js +339 -0
- package/dist/components/Rules/PointSelector/types.d.ts +304 -0
- package/dist/components/Rules/PointSelector/types.js +0 -0
- package/dist/components/Rules/PointSelector/usePointSelector.d.ts +161 -0
- package/dist/components/Rules/PointSelector/usePointSelector.js +1088 -0
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionEditor.d.ts +28 -0
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionEditor.js +208 -0
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionFields.d.ts +23 -0
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionFields.js +950 -0
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTargetPicker.d.ts +21 -0
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTargetPicker.js +110 -0
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTypeSelect.d.ts +20 -0
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTypeSelect.js +31 -0
- package/dist/components/Rules/RuleBuilder/ActionEditor/AttackTypeField.d.ts +23 -0
- package/dist/components/Rules/RuleBuilder/ActionEditor/AttackTypeField.js +131 -0
- package/dist/components/Rules/RuleBuilder/ActionEditor/classes.d.ts +17 -0
- package/dist/components/Rules/RuleBuilder/ActionEditor/classes.js +14 -0
- package/dist/components/Rules/RuleBuilder/ActionEditor/index.d.ts +6 -0
- package/dist/components/Rules/RuleBuilder/ActionEditor/index.js +6 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/AddConditionMenu.d.ts +24 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/AddConditionMenu.js +245 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/AttackCondition.d.ts +15 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/AttackCondition.js +691 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionCard.d.ts +19 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionCard.js +72 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionTree.d.ts +27 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionTree.js +407 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/FieldCondition.d.ts +14 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/FieldCondition.js +269 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/GroupCondition.d.ts +25 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/GroupCondition.js +99 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/SampleCondition.d.ts +14 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/SampleCondition.js +118 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/SignalCondition.d.ts +14 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/SignalCondition.js +446 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/TagCondition.d.ts +14 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/TagCondition.js +266 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/classes.d.ts +35 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/classes.js +57 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/index.d.ts +15 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/index.js +10 -0
- package/dist/components/Rules/RuleBuilder/RuleBuilder.d.ts +67 -0
- package/dist/components/Rules/RuleBuilder/RuleBuilder.js +366 -0
- package/dist/components/Rules/RuleBuilder/Summary/ActionSummary.d.ts +32 -0
- package/dist/components/Rules/RuleBuilder/Summary/ActionSummary.js +420 -0
- package/dist/components/Rules/RuleBuilder/Summary/ConditionSummary.d.ts +27 -0
- package/dist/components/Rules/RuleBuilder/Summary/ConditionSummary.js +446 -0
- package/dist/components/Rules/RuleBuilder/Summary/index.d.ts +7 -0
- package/dist/components/Rules/RuleBuilder/Summary/index.js +2 -0
- package/dist/components/Rules/RuleBuilder/classes.d.ts +19 -0
- package/dist/components/Rules/RuleBuilder/classes.js +18 -0
- package/dist/components/Rules/RuleBuilder/index.d.ts +55 -0
- package/dist/components/Rules/RuleBuilder/index.js +11 -0
- package/dist/components/Rules/RuleBuilder/models/actionModel.d.ts +31 -0
- package/dist/components/Rules/RuleBuilder/models/actionModel.js +276 -0
- package/dist/components/Rules/RuleBuilder/models/conditionModel.d.ts +95 -0
- package/dist/components/Rules/RuleBuilder/models/conditionModel.js +418 -0
- package/dist/components/Rules/RuleBuilder/models/index.d.ts +3 -0
- package/dist/components/Rules/RuleBuilder/models/index.js +3 -0
- package/dist/components/Rules/RuleBuilder/models/validation.d.ts +176 -0
- package/dist/components/Rules/RuleBuilder/models/validation.js +242 -0
- package/dist/components/Rules/RuleBuilder/shared/ChoiceSelect.d.ts +27 -0
- package/dist/components/Rules/RuleBuilder/shared/ChoiceSelect.js +92 -0
- package/dist/components/Rules/RuleBuilder/shared/index.d.ts +1 -0
- package/dist/components/Rules/RuleBuilder/shared/index.js +1 -0
- package/dist/components/Rules/RuleBuilder/types.d.ts +384 -0
- package/dist/components/Rules/RuleBuilder/types.js +0 -0
- package/dist/components/Rules/RuleBuilder/utils/constants.d.ts +65 -0
- package/dist/components/Rules/RuleBuilder/utils/constants.js +356 -0
- package/dist/components/Rules/RuleBuilder/utils/extractBindings.d.ts +48 -0
- package/dist/components/Rules/RuleBuilder/utils/extractBindings.js +42 -0
- package/dist/components/Rules/RuleBuilder/utils/helpers.d.ts +92 -0
- package/dist/components/Rules/RuleBuilder/utils/helpers.js +54 -0
- package/dist/components/Rules/RuleBuilder/utils/index.d.ts +2 -0
- package/dist/components/Rules/RuleBuilder/utils/index.js +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/metadata/components.json +100 -2
- package/dist/metadata/guidelines.json +1 -1
- package/package.json +4 -1
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { useEffect } from "react";
|
|
4
|
+
import { useProton } from "@wallarm-org/rules-lib";
|
|
5
|
+
import { cn } from "../../../utils/cn.js";
|
|
6
|
+
import { useTestId } from "../../../utils/testId.js";
|
|
7
|
+
import { Code } from "../../Code/index.js";
|
|
8
|
+
import { Text } from "../../Text/index.js";
|
|
9
|
+
import { checkPoint, needsRecanonalization } from "../PointSelector/sdkBridge.js";
|
|
10
|
+
import { ActionEditor } from "./ActionEditor/index.js";
|
|
11
|
+
import { ConditionTree } from "./ConditionTree/index.js";
|
|
12
|
+
import { ruleBuilderVariants } from "./classes.js";
|
|
13
|
+
import { toProtonAction } from "./models/actionModel.js";
|
|
14
|
+
import { conditionProblems, toProtonCondition } from "./models/conditionModel.js";
|
|
15
|
+
import { actionProblems, ruleMetaProblems, validateBindingRefs, validateBindingUniqueness } from "./models/validation.js";
|
|
16
|
+
const ALL_SECTIONS = [
|
|
17
|
+
"conditions",
|
|
18
|
+
"action",
|
|
19
|
+
"code"
|
|
20
|
+
];
|
|
21
|
+
const RuleBuilder = (t0)=>{
|
|
22
|
+
const $ = c(65);
|
|
23
|
+
const { ref, "data-testid": testIdProp, ruleId, ruleDescription, scope, condition, action, onConditionChange, onActionChange, attackTypes, showProblems: t1, sections: t2, afterConditions, className, proton: protonProp } = t0;
|
|
24
|
+
const showProblems = void 0 === t1 ? false : t1;
|
|
25
|
+
const sections = void 0 === t2 ? ALL_SECTIONS : t2;
|
|
26
|
+
const testId = useTestId("rule-builder");
|
|
27
|
+
const finalTestId = testIdProp ?? testId;
|
|
28
|
+
const protonFromHook = useProton()[0];
|
|
29
|
+
const proton = protonProp ?? protonFromHook;
|
|
30
|
+
let t3;
|
|
31
|
+
if ($[0] !== sections) {
|
|
32
|
+
t3 = (section)=>sections.includes(section);
|
|
33
|
+
$[0] = sections;
|
|
34
|
+
$[1] = t3;
|
|
35
|
+
} else t3 = $[1];
|
|
36
|
+
const shows = t3;
|
|
37
|
+
const showHeadings = sections.length > 1;
|
|
38
|
+
let t4;
|
|
39
|
+
if ($[2] !== ruleId || $[3] !== showProblems) {
|
|
40
|
+
t4 = showProblems ? ruleMetaProblems(ruleId) : [];
|
|
41
|
+
$[2] = ruleId;
|
|
42
|
+
$[3] = showProblems;
|
|
43
|
+
$[4] = t4;
|
|
44
|
+
} else t4 = $[4];
|
|
45
|
+
const metaIssues = t4;
|
|
46
|
+
let t5;
|
|
47
|
+
if ($[5] !== condition || $[6] !== showProblems) {
|
|
48
|
+
t5 = showProblems ? [
|
|
49
|
+
...conditionProblems(condition),
|
|
50
|
+
...validateBindingUniqueness(condition)
|
|
51
|
+
] : [];
|
|
52
|
+
$[5] = condition;
|
|
53
|
+
$[6] = showProblems;
|
|
54
|
+
$[7] = t5;
|
|
55
|
+
} else t5 = $[7];
|
|
56
|
+
const conditionIssues = t5;
|
|
57
|
+
let t6;
|
|
58
|
+
if ($[8] !== action || $[9] !== condition || $[10] !== proton || $[11] !== showProblems) {
|
|
59
|
+
t6 = showProblems ? [
|
|
60
|
+
...actionProblems(action),
|
|
61
|
+
...validateBindingRefs(action, condition, proton)
|
|
62
|
+
] : [];
|
|
63
|
+
$[8] = action;
|
|
64
|
+
$[9] = condition;
|
|
65
|
+
$[10] = proton;
|
|
66
|
+
$[11] = showProblems;
|
|
67
|
+
$[12] = t6;
|
|
68
|
+
} else t6 = $[12];
|
|
69
|
+
const actionIssues = t6;
|
|
70
|
+
let t7;
|
|
71
|
+
if ($[13] !== action || $[14] !== condition || $[15] !== onActionChange || $[16] !== onConditionChange || $[17] !== proton) {
|
|
72
|
+
t7 = ()=>{
|
|
73
|
+
if (!proton) return;
|
|
74
|
+
const currentVersion = proton.version().canonical;
|
|
75
|
+
let conditionUpdated = false;
|
|
76
|
+
const migrateCondition = (node)=>{
|
|
77
|
+
if ("group" === node.kind) {
|
|
78
|
+
const updatedChildren = node.children.map(migrateCondition);
|
|
79
|
+
return {
|
|
80
|
+
...node,
|
|
81
|
+
children: updatedChildren
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
if ("field" === node.kind) {
|
|
85
|
+
if (node.value.canonical && needsRecanonalization(currentVersion, node.value.canonicalVersion ?? void 0)) {
|
|
86
|
+
const result = checkPoint(proton, node.value.canonical, {
|
|
87
|
+
context: node.context,
|
|
88
|
+
profile: "tree"
|
|
89
|
+
});
|
|
90
|
+
if (result.canonical && result.canonical !== node.value.canonical) {
|
|
91
|
+
console.info("Condition point re-canonicalized due to SDK version change", {
|
|
92
|
+
old: node.value.canonical,
|
|
93
|
+
new: result.canonical,
|
|
94
|
+
oldVersion: node.value.canonicalVersion,
|
|
95
|
+
newVersion: currentVersion
|
|
96
|
+
});
|
|
97
|
+
conditionUpdated = true;
|
|
98
|
+
return {
|
|
99
|
+
...node,
|
|
100
|
+
value: {
|
|
101
|
+
...node.value,
|
|
102
|
+
canonical: result.canonical,
|
|
103
|
+
canonicalVersion: currentVersion
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return node;
|
|
109
|
+
}
|
|
110
|
+
if (("attack" === node.kind || "signal" === node.kind || "tag" === node.kind) && "flow" !== node.point) {
|
|
111
|
+
if (needsRecanonalization(currentVersion, node.canonicalVersion)) {
|
|
112
|
+
const result_0 = checkPoint(proton, node.point, {
|
|
113
|
+
context: "http_request",
|
|
114
|
+
profile: "tree"
|
|
115
|
+
});
|
|
116
|
+
if (result_0.canonical && result_0.canonical !== node.point) {
|
|
117
|
+
console.info(`${node.kind} condition point re-canonicalized due to SDK version change`, {
|
|
118
|
+
old: node.point,
|
|
119
|
+
new: result_0.canonical,
|
|
120
|
+
oldVersion: node.canonicalVersion,
|
|
121
|
+
newVersion: currentVersion
|
|
122
|
+
});
|
|
123
|
+
conditionUpdated = true;
|
|
124
|
+
if ("attack" === node.kind) return {
|
|
125
|
+
...node,
|
|
126
|
+
point: result_0.canonical,
|
|
127
|
+
canonicalVersion: currentVersion
|
|
128
|
+
};
|
|
129
|
+
if ("signal" === node.kind) return {
|
|
130
|
+
...node,
|
|
131
|
+
point: result_0.canonical,
|
|
132
|
+
canonicalVersion: currentVersion
|
|
133
|
+
};
|
|
134
|
+
if ("tag" === node.kind) return {
|
|
135
|
+
...node,
|
|
136
|
+
point: result_0.canonical,
|
|
137
|
+
canonicalVersion: currentVersion
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return node;
|
|
143
|
+
};
|
|
144
|
+
const updatedCondition = migrateCondition(condition);
|
|
145
|
+
if (conditionUpdated) onConditionChange(updatedCondition);
|
|
146
|
+
if (action.target && !action.target.whole && action.target.canonical && needsRecanonalization(currentVersion, action.target.canonicalVersion)) {
|
|
147
|
+
const result_1 = checkPoint(proton, action.target.canonical, {
|
|
148
|
+
context: action.target.context,
|
|
149
|
+
profile: "tree"
|
|
150
|
+
});
|
|
151
|
+
if (result_1.canonical && result_1.canonical !== action.target.canonical) {
|
|
152
|
+
console.info("Action target re-canonicalized due to SDK version change", {
|
|
153
|
+
old: action.target.canonical,
|
|
154
|
+
new: result_1.canonical,
|
|
155
|
+
oldVersion: action.target.canonicalVersion,
|
|
156
|
+
newVersion: currentVersion
|
|
157
|
+
});
|
|
158
|
+
onActionChange({
|
|
159
|
+
...action,
|
|
160
|
+
target: {
|
|
161
|
+
...action.target,
|
|
162
|
+
canonical: result_1.canonical,
|
|
163
|
+
canonicalVersion: currentVersion
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
$[13] = action;
|
|
170
|
+
$[14] = condition;
|
|
171
|
+
$[15] = onActionChange;
|
|
172
|
+
$[16] = onConditionChange;
|
|
173
|
+
$[17] = proton;
|
|
174
|
+
$[18] = t7;
|
|
175
|
+
} else t7 = $[18];
|
|
176
|
+
let t8;
|
|
177
|
+
if ($[19] !== proton) {
|
|
178
|
+
t8 = [
|
|
179
|
+
proton
|
|
180
|
+
];
|
|
181
|
+
$[19] = proton;
|
|
182
|
+
$[20] = t8;
|
|
183
|
+
} else t8 = $[20];
|
|
184
|
+
useEffect(t7, t8);
|
|
185
|
+
let t9;
|
|
186
|
+
if ($[21] !== action || $[22] !== condition || $[23] !== proton || $[24] !== ruleDescription || $[25] !== ruleId || $[26] !== scope) {
|
|
187
|
+
const protonCondition = toProtonCondition(condition, proton);
|
|
188
|
+
const protonAction = toProtonAction(action, proton);
|
|
189
|
+
let t10;
|
|
190
|
+
if ($[28] !== scope) {
|
|
191
|
+
t10 = scope && {
|
|
192
|
+
scope
|
|
193
|
+
};
|
|
194
|
+
$[28] = scope;
|
|
195
|
+
$[29] = t10;
|
|
196
|
+
} else t10 = $[29];
|
|
197
|
+
const ruleset = {
|
|
198
|
+
meta: {
|
|
199
|
+
format: "0.10.3",
|
|
200
|
+
revision: new Date().toISOString()
|
|
201
|
+
},
|
|
202
|
+
rules: [
|
|
203
|
+
{
|
|
204
|
+
meta: {
|
|
205
|
+
id: ruleId,
|
|
206
|
+
desc: ruleDescription ?? ""
|
|
207
|
+
},
|
|
208
|
+
...t10,
|
|
209
|
+
condition: protonCondition,
|
|
210
|
+
action: [
|
|
211
|
+
protonAction
|
|
212
|
+
]
|
|
213
|
+
}
|
|
214
|
+
]
|
|
215
|
+
};
|
|
216
|
+
t9 = JSON.stringify(ruleset, null, 2);
|
|
217
|
+
$[21] = action;
|
|
218
|
+
$[22] = condition;
|
|
219
|
+
$[23] = proton;
|
|
220
|
+
$[24] = ruleDescription;
|
|
221
|
+
$[25] = ruleId;
|
|
222
|
+
$[26] = scope;
|
|
223
|
+
$[27] = t9;
|
|
224
|
+
} else t9 = $[27];
|
|
225
|
+
const generatedJSON = t9;
|
|
226
|
+
let t10;
|
|
227
|
+
if ($[30] !== className) {
|
|
228
|
+
t10 = cn(ruleBuilderVariants(), className);
|
|
229
|
+
$[30] = className;
|
|
230
|
+
$[31] = t10;
|
|
231
|
+
} else t10 = $[31];
|
|
232
|
+
let t11;
|
|
233
|
+
if ($[32] !== metaIssues || $[33] !== showProblems) {
|
|
234
|
+
t11 = metaIssues.length > 0 && showProblems && /*#__PURE__*/ jsx("div", {
|
|
235
|
+
className: "flex flex-col gap-4 rounded-lg border border-border-danger bg-bg-danger-subtle p-12",
|
|
236
|
+
children: metaIssues.map(_temp)
|
|
237
|
+
});
|
|
238
|
+
$[32] = metaIssues;
|
|
239
|
+
$[33] = showProblems;
|
|
240
|
+
$[34] = t11;
|
|
241
|
+
} else t11 = $[34];
|
|
242
|
+
let t12;
|
|
243
|
+
if ($[35] !== afterConditions || $[36] !== attackTypes || $[37] !== condition || $[38] !== conditionIssues || $[39] !== onConditionChange || $[40] !== showHeadings || $[41] !== showProblems || $[42] !== shows) {
|
|
244
|
+
t12 = shows("conditions") && /*#__PURE__*/ jsxs("section", {
|
|
245
|
+
className: "flex flex-col gap-12",
|
|
246
|
+
children: [
|
|
247
|
+
showHeadings && /*#__PURE__*/ jsx("h3", {
|
|
248
|
+
className: "text-md font-medium",
|
|
249
|
+
children: "Conditions"
|
|
250
|
+
}),
|
|
251
|
+
/*#__PURE__*/ jsx(ConditionTree, {
|
|
252
|
+
condition: condition,
|
|
253
|
+
onChange: onConditionChange,
|
|
254
|
+
attackTypes: attackTypes,
|
|
255
|
+
isRoot: true,
|
|
256
|
+
showProblems: showProblems,
|
|
257
|
+
problems: conditionIssues
|
|
258
|
+
}),
|
|
259
|
+
conditionIssues.length > 0 && showProblems && /*#__PURE__*/ jsx("div", {
|
|
260
|
+
className: "flex flex-col gap-4",
|
|
261
|
+
children: conditionIssues.map(_temp2)
|
|
262
|
+
}),
|
|
263
|
+
afterConditions
|
|
264
|
+
]
|
|
265
|
+
});
|
|
266
|
+
$[35] = afterConditions;
|
|
267
|
+
$[36] = attackTypes;
|
|
268
|
+
$[37] = condition;
|
|
269
|
+
$[38] = conditionIssues;
|
|
270
|
+
$[39] = onConditionChange;
|
|
271
|
+
$[40] = showHeadings;
|
|
272
|
+
$[41] = showProblems;
|
|
273
|
+
$[42] = shows;
|
|
274
|
+
$[43] = t12;
|
|
275
|
+
} else t12 = $[43];
|
|
276
|
+
let t13;
|
|
277
|
+
if ($[44] !== action || $[45] !== actionIssues || $[46] !== attackTypes || $[47] !== condition || $[48] !== onActionChange || $[49] !== showHeadings || $[50] !== showProblems || $[51] !== shows) {
|
|
278
|
+
t13 = shows("action") && /*#__PURE__*/ jsxs("section", {
|
|
279
|
+
className: "flex flex-col gap-12",
|
|
280
|
+
children: [
|
|
281
|
+
showHeadings && /*#__PURE__*/ jsx("h3", {
|
|
282
|
+
className: "text-md font-medium",
|
|
283
|
+
children: "Action"
|
|
284
|
+
}),
|
|
285
|
+
/*#__PURE__*/ jsx(ActionEditor, {
|
|
286
|
+
value: action,
|
|
287
|
+
onChange: onActionChange,
|
|
288
|
+
attackTypes: attackTypes,
|
|
289
|
+
condition: condition,
|
|
290
|
+
problems: actionIssues,
|
|
291
|
+
showProblems: showProblems
|
|
292
|
+
})
|
|
293
|
+
]
|
|
294
|
+
});
|
|
295
|
+
$[44] = action;
|
|
296
|
+
$[45] = actionIssues;
|
|
297
|
+
$[46] = attackTypes;
|
|
298
|
+
$[47] = condition;
|
|
299
|
+
$[48] = onActionChange;
|
|
300
|
+
$[49] = showHeadings;
|
|
301
|
+
$[50] = showProblems;
|
|
302
|
+
$[51] = shows;
|
|
303
|
+
$[52] = t13;
|
|
304
|
+
} else t13 = $[52];
|
|
305
|
+
let t14;
|
|
306
|
+
if ($[53] !== generatedJSON || $[54] !== showHeadings || $[55] !== shows) {
|
|
307
|
+
t14 = shows("code") && /*#__PURE__*/ jsxs("section", {
|
|
308
|
+
className: "flex flex-col gap-12",
|
|
309
|
+
children: [
|
|
310
|
+
showHeadings && /*#__PURE__*/ jsx("h3", {
|
|
311
|
+
className: "text-md font-medium",
|
|
312
|
+
children: "Generated Rule"
|
|
313
|
+
}),
|
|
314
|
+
/*#__PURE__*/ jsx(Code, {
|
|
315
|
+
size: "m",
|
|
316
|
+
className: "max-h-[600px] overflow-auto",
|
|
317
|
+
children: generatedJSON
|
|
318
|
+
})
|
|
319
|
+
]
|
|
320
|
+
});
|
|
321
|
+
$[53] = generatedJSON;
|
|
322
|
+
$[54] = showHeadings;
|
|
323
|
+
$[55] = shows;
|
|
324
|
+
$[56] = t14;
|
|
325
|
+
} else t14 = $[56];
|
|
326
|
+
let t15;
|
|
327
|
+
if ($[57] !== finalTestId || $[58] !== ref || $[59] !== t10 || $[60] !== t11 || $[61] !== t12 || $[62] !== t13 || $[63] !== t14) {
|
|
328
|
+
t15 = /*#__PURE__*/ jsxs("div", {
|
|
329
|
+
ref: ref,
|
|
330
|
+
"data-slot": "rule-builder",
|
|
331
|
+
"data-testid": finalTestId,
|
|
332
|
+
className: t10,
|
|
333
|
+
children: [
|
|
334
|
+
t11,
|
|
335
|
+
t12,
|
|
336
|
+
t13,
|
|
337
|
+
t14
|
|
338
|
+
]
|
|
339
|
+
});
|
|
340
|
+
$[57] = finalTestId;
|
|
341
|
+
$[58] = ref;
|
|
342
|
+
$[59] = t10;
|
|
343
|
+
$[60] = t11;
|
|
344
|
+
$[61] = t12;
|
|
345
|
+
$[62] = t13;
|
|
346
|
+
$[63] = t14;
|
|
347
|
+
$[64] = t15;
|
|
348
|
+
} else t15 = $[64];
|
|
349
|
+
return t15;
|
|
350
|
+
};
|
|
351
|
+
RuleBuilder.displayName = "RuleBuilder";
|
|
352
|
+
function _temp(problem) {
|
|
353
|
+
return /*#__PURE__*/ jsx(Text, {
|
|
354
|
+
size: "sm",
|
|
355
|
+
color: "danger",
|
|
356
|
+
children: problem
|
|
357
|
+
}, problem);
|
|
358
|
+
}
|
|
359
|
+
function _temp2(problem_0) {
|
|
360
|
+
return /*#__PURE__*/ jsx(Text, {
|
|
361
|
+
size: "sm",
|
|
362
|
+
color: "danger",
|
|
363
|
+
children: problem_0
|
|
364
|
+
}, problem_0);
|
|
365
|
+
}
|
|
366
|
+
export { RuleBuilder };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ActionSummary - Read-only action display
|
|
3
|
+
*
|
|
4
|
+
* Displays an action configuration in a read-only format for review/confirmation.
|
|
5
|
+
* Shows action description, target, and all relevant fields based on action type.
|
|
6
|
+
*/
|
|
7
|
+
import type { FC, Ref } from 'react';
|
|
8
|
+
import { type TestableProps } from '../../../../utils/testId.js';
|
|
9
|
+
import type { ActionDraft, Choice } from '../types.js';
|
|
10
|
+
export interface ActionSummaryProps extends TestableProps {
|
|
11
|
+
ref?: Ref<HTMLDivElement>;
|
|
12
|
+
/** Action configuration to display */
|
|
13
|
+
action: ActionDraft;
|
|
14
|
+
/** Available attack types for label lookup */
|
|
15
|
+
attackTypes: Choice[];
|
|
16
|
+
/** Additional CSS class */
|
|
17
|
+
className?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* ActionSummary component.
|
|
21
|
+
*
|
|
22
|
+
* Displays an action configuration in read-only format for review/confirmation.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* <ActionSummary
|
|
27
|
+
* action={action}
|
|
28
|
+
* attackTypes={attackTypeChoices}
|
|
29
|
+
* />
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare const ActionSummary: FC<ActionSummaryProps>;
|