@wallarm-org/design-system 4.8.0-rc-feat-parser.1 → 4.8.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/README.md +4 -2
- package/dist/components/BulkBar/index.d.ts +5 -0
- package/dist/components/Drawer/classes.js +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +0 -2
- package/dist/components/DropdownMenu/DropdownMenu.js +71 -84
- package/dist/components/DropdownMenu/DropdownMenuItemDescription.js +1 -1
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useFilterInputAutocomplete.js +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.d.ts +20 -0
- package/dist/components/NotificationCenter/NotificationCenter.js +65 -0
- package/dist/components/NotificationCenter/NotificationCenterBody.d.ts +18 -0
- package/dist/components/NotificationCenter/NotificationCenterBody.js +202 -0
- package/dist/components/NotificationCenter/NotificationCenterContent.d.ts +5 -0
- package/dist/components/NotificationCenter/NotificationCenterContent.js +42 -0
- package/dist/components/NotificationCenter/NotificationCenterHeader.d.ts +20 -0
- package/dist/components/NotificationCenter/NotificationCenterHeader.js +202 -0
- package/dist/components/NotificationCenter/NotificationCenterItem.d.ts +26 -0
- package/dist/components/NotificationCenter/NotificationCenterItem.js +211 -0
- package/dist/components/NotificationCenter/NotificationCenterItemTime.d.ts +9 -0
- package/dist/components/NotificationCenter/NotificationCenterItemTime.js +148 -0
- package/dist/components/NotificationCenter/NotificationCenterItemTitle.d.ts +14 -0
- package/dist/components/NotificationCenter/NotificationCenterItemTitle.js +115 -0
- package/dist/components/NotificationCenter/NotificationCenterTabs.d.ts +10 -0
- package/dist/components/NotificationCenter/NotificationCenterTabs.js +77 -0
- package/dist/components/NotificationCenter/NotificationCenterTrigger.d.ts +13 -0
- package/dist/components/NotificationCenter/NotificationCenterTrigger.js +138 -0
- package/dist/components/NotificationCenter/index.d.ts +9 -0
- package/dist/components/NotificationCenter/index.js +9 -0
- package/dist/components/Overlay/Overlay.js +1 -1
- package/dist/components/SearchInput/SearchInput.d.ts +7 -5
- package/dist/components/SearchInput/SearchInput.js +119 -101
- package/dist/components/Select/SelectSearchInput.d.ts +1 -1
- package/dist/components/Table/types.d.ts +1 -1
- package/dist/components/Tabs/Tabs.d.ts +1 -0
- package/dist/components/Tabs/Tabs.js +30 -28
- package/dist/components/Tabs/TabsList/index.d.ts +1 -1
- package/dist/components/Tabs/index.d.ts +2 -2
- package/dist/components/Tour/TourPositioner.d.ts +3 -0
- package/dist/components/Tour/TourPositioner.js +4 -4
- package/dist/guidelines/foundations/color.md +157 -0
- package/dist/guidelines/foundations/focus.md +122 -0
- package/dist/guidelines/foundations/layering.md +131 -0
- package/dist/guidelines/foundations/radius-elevation.md +111 -0
- package/dist/guidelines/foundations/spacing.md +117 -0
- package/dist/guidelines/foundations/typography.md +114 -0
- package/dist/guidelines/patterns/app-layout.md +1567 -0
- package/dist/guidelines/patterns/auth-page.md +668 -0
- package/dist/guidelines/patterns/confirmation-dialogs.md +605 -0
- package/dist/guidelines/patterns/create-edit-forms.md +768 -0
- package/dist/guidelines/patterns/detail-drawer.md +868 -0
- package/dist/guidelines/patterns/empty-states.md +461 -0
- package/dist/guidelines/patterns/entity-table.md +533 -0
- package/dist/guidelines/patterns/feedback-toasts.md +493 -0
- package/dist/guidelines/patterns/filtering.md +630 -0
- package/dist/guidelines/patterns/resource-list-page.md +558 -0
- package/dist/guidelines/patterns/settings-page.md +752 -0
- package/dist/guidelines/rules.md +25 -0
- package/dist/index.d.ts +2 -3
- package/dist/index.js +1 -2
- package/dist/metadata/components.json +12431 -9208
- package/dist/metadata/guidelines.json +1705 -0
- package/dist/theme/typography.css +5 -0
- package/dist/utils/formatDateTime.d.ts +6 -0
- package/dist/utils/formatDateTime.js +13 -1
- package/package.json +6 -4
- package/dist/components/Rules/PointSelector/KeyboardShortcutsDialog.d.ts +0 -14
- package/dist/components/Rules/PointSelector/KeyboardShortcutsDialog.js +0 -209
- package/dist/components/Rules/PointSelector/MatchStep.d.ts +0 -15
- package/dist/components/Rules/PointSelector/MatchStep.js +0 -186
- package/dist/components/Rules/PointSelector/MenuFooterHints.d.ts +0 -16
- package/dist/components/Rules/PointSelector/MenuFooterHints.js +0 -177
- package/dist/components/Rules/PointSelector/PointPreview.d.ts +0 -10
- package/dist/components/Rules/PointSelector/PointPreview.js +0 -88
- package/dist/components/Rules/PointSelector/PointSelector.d.ts +0 -17
- package/dist/components/Rules/PointSelector/PointSelector.js +0 -937
- package/dist/components/Rules/PointSelector/PointSelectorEmptyState.d.ts +0 -12
- package/dist/components/Rules/PointSelector/PointSelectorEmptyState.js +0 -173
- package/dist/components/Rules/PointSelector/PointSelectorError.d.ts +0 -31
- package/dist/components/Rules/PointSelector/PointSelectorError.js +0 -275
- package/dist/components/Rules/PointSelector/PointSelectorInput.d.ts +0 -20
- package/dist/components/Rules/PointSelector/PointSelectorInput.js +0 -130
- package/dist/components/Rules/PointSelector/PointSelectorMenu.d.ts +0 -31
- package/dist/components/Rules/PointSelector/PointSelectorMenu.js +0 -317
- package/dist/components/Rules/PointSelector/PointSelectorSkeleton.d.ts +0 -8
- package/dist/components/Rules/PointSelector/PointSelectorSkeleton.js +0 -73
- package/dist/components/Rules/PointSelector/SampleRequest.d.ts +0 -14
- package/dist/components/Rules/PointSelector/SampleRequest.js +0 -116
- package/dist/components/Rules/PointSelector/StepMenu.d.ts +0 -40
- package/dist/components/Rules/PointSelector/StepMenu.js +0 -210
- package/dist/components/Rules/PointSelector/VersionWarning.d.ts +0 -26
- package/dist/components/Rules/PointSelector/VersionWarning.js +0 -231
- package/dist/components/Rules/PointSelector/WhereBar.d.ts +0 -48
- package/dist/components/Rules/PointSelector/WhereBar.js +0 -263
- package/dist/components/Rules/PointSelector/classes.d.ts +0 -28
- package/dist/components/Rules/PointSelector/classes.js +0 -22
- package/dist/components/Rules/PointSelector/index.d.ts +0 -20
- package/dist/components/Rules/PointSelector/index.js +0 -18
- package/dist/components/Rules/PointSelector/liftLayer.d.ts +0 -8
- package/dist/components/Rules/PointSelector/liftLayer.js +0 -4
- package/dist/components/Rules/PointSelector/sampleValue.d.ts +0 -6
- package/dist/components/Rules/PointSelector/sampleValue.js +0 -51
- package/dist/components/Rules/PointSelector/sdkBridge.d.ts +0 -508
- package/dist/components/Rules/PointSelector/sdkBridge.js +0 -339
- package/dist/components/Rules/PointSelector/types.d.ts +0 -304
- package/dist/components/Rules/PointSelector/types.js +0 -0
- package/dist/components/Rules/PointSelector/usePointSelector.d.ts +0 -161
- package/dist/components/Rules/PointSelector/usePointSelector.js +0 -1088
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionEditor.d.ts +0 -28
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionEditor.js +0 -208
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionFields.d.ts +0 -23
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionFields.js +0 -950
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTargetPicker.d.ts +0 -21
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTargetPicker.js +0 -110
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTypeSelect.d.ts +0 -20
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTypeSelect.js +0 -31
- package/dist/components/Rules/RuleBuilder/ActionEditor/AttackTypeField.d.ts +0 -23
- package/dist/components/Rules/RuleBuilder/ActionEditor/AttackTypeField.js +0 -131
- package/dist/components/Rules/RuleBuilder/ActionEditor/classes.d.ts +0 -17
- package/dist/components/Rules/RuleBuilder/ActionEditor/classes.js +0 -14
- package/dist/components/Rules/RuleBuilder/ActionEditor/index.d.ts +0 -6
- package/dist/components/Rules/RuleBuilder/ActionEditor/index.js +0 -6
- package/dist/components/Rules/RuleBuilder/ConditionTree/AddConditionMenu.d.ts +0 -24
- package/dist/components/Rules/RuleBuilder/ConditionTree/AddConditionMenu.js +0 -245
- package/dist/components/Rules/RuleBuilder/ConditionTree/AttackCondition.d.ts +0 -15
- package/dist/components/Rules/RuleBuilder/ConditionTree/AttackCondition.js +0 -691
- package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionCard.d.ts +0 -19
- package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionCard.js +0 -72
- package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionTree.d.ts +0 -27
- package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionTree.js +0 -407
- package/dist/components/Rules/RuleBuilder/ConditionTree/FieldCondition.d.ts +0 -14
- package/dist/components/Rules/RuleBuilder/ConditionTree/FieldCondition.js +0 -269
- package/dist/components/Rules/RuleBuilder/ConditionTree/GroupCondition.d.ts +0 -25
- package/dist/components/Rules/RuleBuilder/ConditionTree/GroupCondition.js +0 -99
- package/dist/components/Rules/RuleBuilder/ConditionTree/SampleCondition.d.ts +0 -14
- package/dist/components/Rules/RuleBuilder/ConditionTree/SampleCondition.js +0 -118
- package/dist/components/Rules/RuleBuilder/ConditionTree/SignalCondition.d.ts +0 -14
- package/dist/components/Rules/RuleBuilder/ConditionTree/SignalCondition.js +0 -446
- package/dist/components/Rules/RuleBuilder/ConditionTree/TagCondition.d.ts +0 -14
- package/dist/components/Rules/RuleBuilder/ConditionTree/TagCondition.js +0 -266
- package/dist/components/Rules/RuleBuilder/ConditionTree/classes.d.ts +0 -35
- package/dist/components/Rules/RuleBuilder/ConditionTree/classes.js +0 -57
- package/dist/components/Rules/RuleBuilder/ConditionTree/index.d.ts +0 -15
- package/dist/components/Rules/RuleBuilder/ConditionTree/index.js +0 -10
- package/dist/components/Rules/RuleBuilder/RuleBuilder.d.ts +0 -67
- package/dist/components/Rules/RuleBuilder/RuleBuilder.js +0 -366
- package/dist/components/Rules/RuleBuilder/Summary/ActionSummary.d.ts +0 -32
- package/dist/components/Rules/RuleBuilder/Summary/ActionSummary.js +0 -420
- package/dist/components/Rules/RuleBuilder/Summary/ConditionSummary.d.ts +0 -27
- package/dist/components/Rules/RuleBuilder/Summary/ConditionSummary.js +0 -446
- package/dist/components/Rules/RuleBuilder/Summary/index.d.ts +0 -7
- package/dist/components/Rules/RuleBuilder/Summary/index.js +0 -2
- package/dist/components/Rules/RuleBuilder/classes.d.ts +0 -19
- package/dist/components/Rules/RuleBuilder/classes.js +0 -18
- package/dist/components/Rules/RuleBuilder/index.d.ts +0 -55
- package/dist/components/Rules/RuleBuilder/index.js +0 -11
- package/dist/components/Rules/RuleBuilder/models/actionModel.d.ts +0 -31
- package/dist/components/Rules/RuleBuilder/models/actionModel.js +0 -276
- package/dist/components/Rules/RuleBuilder/models/conditionModel.d.ts +0 -95
- package/dist/components/Rules/RuleBuilder/models/conditionModel.js +0 -418
- package/dist/components/Rules/RuleBuilder/models/index.d.ts +0 -3
- package/dist/components/Rules/RuleBuilder/models/index.js +0 -3
- package/dist/components/Rules/RuleBuilder/models/validation.d.ts +0 -176
- package/dist/components/Rules/RuleBuilder/models/validation.js +0 -242
- package/dist/components/Rules/RuleBuilder/shared/ChoiceSelect.d.ts +0 -27
- package/dist/components/Rules/RuleBuilder/shared/ChoiceSelect.js +0 -92
- package/dist/components/Rules/RuleBuilder/shared/index.d.ts +0 -1
- package/dist/components/Rules/RuleBuilder/shared/index.js +0 -1
- package/dist/components/Rules/RuleBuilder/types.d.ts +0 -384
- package/dist/components/Rules/RuleBuilder/types.js +0 -0
- package/dist/components/Rules/RuleBuilder/utils/constants.d.ts +0 -65
- package/dist/components/Rules/RuleBuilder/utils/constants.js +0 -356
- package/dist/components/Rules/RuleBuilder/utils/extractBindings.d.ts +0 -48
- package/dist/components/Rules/RuleBuilder/utils/extractBindings.js +0 -42
- package/dist/components/Rules/RuleBuilder/utils/helpers.d.ts +0 -92
- package/dist/components/Rules/RuleBuilder/utils/helpers.js +0 -54
- package/dist/components/Rules/RuleBuilder/utils/index.d.ts +0 -2
- package/dist/components/Rules/RuleBuilder/utils/index.js +0 -2
|
@@ -1,366 +0,0 @@
|
|
|
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 };
|
|
@@ -1,32 +0,0 @@
|
|
|
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>;
|