@uipath/apollo-react 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/canvas/components/Guardrails/guardrail-builder.cjs +29 -23
- package/dist/canvas/components/Guardrails/guardrail-builder.d.ts +3 -2
- package/dist/canvas/components/Guardrails/guardrail-builder.d.ts.map +1 -1
- package/dist/canvas/components/Guardrails/guardrail-builder.js +30 -24
- package/package.json +1 -1
|
@@ -56,7 +56,7 @@ const BUILDER_ERROR_MERGES = {
|
|
|
56
56
|
})
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
|
-
function GuardrailBuilder({ open, definition, scope, guardrail, defaultName, existingNames, toolName, availableToolNames, lockSingleScope, onSave, onCancel, onSaveAsNew, otherAppliedScopes = null, inline = false, hideHeader = false, dialogMaxWidth, title, byoDisplay = false, providerField = false, policyName, evalsTogglePlacement = 'form', allowedActionTypes, hideLogSeverity, renderRecipientSearch, renderStaticRecipient, renderAppPicker, escalateHelp, recipientTypeDisabled, errors: hostErrors, renderParameter, overrideParameterIds, saveDisabled: hostSaveDisabled = false, labels: labelOverrides, className }) {
|
|
59
|
+
function GuardrailBuilder({ open, definition, scope, guardrail, defaultName, existingNames, toolName, availableToolNames, lockSingleScope, onSave, onCancel, onSaveAsNew, otherAppliedScopes = null, inline = false, hideHeader = false, dialogMaxWidth, title, byoDisplay = false, providerField = false, policyName, evalsTogglePlacement = 'form', hideAction = false, allowedActionTypes, hideLogSeverity, renderRecipientSearch, renderStaticRecipient, renderAppPicker, escalateHelp, recipientTypeDisabled, errors: hostErrors, renderParameter, overrideParameterIds, saveDisabled: hostSaveDisabled = false, labels: labelOverrides, className }) {
|
|
60
60
|
const labels = (0, external_i18n_cjs_namespaceObject.useGuardrailBuilderLabels)(labelOverrides);
|
|
61
61
|
const uid = (0, external_react_namespaceObject.useId)();
|
|
62
62
|
const [formData, setFormData] = (0, external_react_namespaceObject.useState)(()=>{
|
|
@@ -129,7 +129,8 @@ function GuardrailBuilder({ open, definition, scope, guardrail, defaultName, exi
|
|
|
129
129
|
for (const id of (0, external_utils_cjs_namespaceObject.getRequiredEmptyParameterIds)(definition.parameters, reconciledParameters))parameterErrors[id] = labels.parameterRequiredError;
|
|
130
130
|
for (const id of (0, external_utils_cjs_namespaceObject.getOutOfRangeParameterIds)(definition.parameters, reconciledParameters))parameterErrors[id] ??= labels.parameterOutOfRangeError;
|
|
131
131
|
if (Object.keys(parameterErrors).length > 0) e.parameters = parameterErrors;
|
|
132
|
-
|
|
132
|
+
const actionErrorFields = hideAction ? [] : (0, external_builder_utils_cjs_namespaceObject.getGuardrailActionErrorFields)(formData.action);
|
|
133
|
+
for (const field of actionErrorFields)e[field] = ({
|
|
133
134
|
blockReason: labels.blockReasonRequiredError,
|
|
134
135
|
filterFields: labels.filterFieldsRequiredError,
|
|
135
136
|
recipient: labels.recipientRequiredError,
|
|
@@ -139,6 +140,7 @@ function GuardrailBuilder({ open, definition, scope, guardrail, defaultName, exi
|
|
|
139
140
|
}, [
|
|
140
141
|
formData,
|
|
141
142
|
showScopeSelector,
|
|
143
|
+
hideAction,
|
|
142
144
|
definition.parameters,
|
|
143
145
|
existingNames,
|
|
144
146
|
labels,
|
|
@@ -309,27 +311,31 @@ function GuardrailBuilder({ open, definition, scope, guardrail, defaultName, exi
|
|
|
309
311
|
},
|
|
310
312
|
labels: labels
|
|
311
313
|
}),
|
|
312
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
314
|
+
!hideAction && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
315
|
+
children: [
|
|
316
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Separator, {}),
|
|
317
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
318
|
+
className: "space-y-3",
|
|
319
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(guardrail_action_section_cjs_namespaceObject.GuardrailActionSection, {
|
|
320
|
+
action: formData.action,
|
|
321
|
+
onActionChange: (action)=>updateField('action', action),
|
|
322
|
+
allowedActionTypes: allowedActionTypes,
|
|
323
|
+
hideLogSeverity: hideLogSeverity,
|
|
324
|
+
errors: {
|
|
325
|
+
blockReason: displayErrors.blockReason,
|
|
326
|
+
filterFields: displayErrors.filterFields,
|
|
327
|
+
recipient: displayErrors.recipient,
|
|
328
|
+
actionApp: displayErrors.actionApp
|
|
329
|
+
},
|
|
330
|
+
labels: labels,
|
|
331
|
+
renderRecipientSearch: renderRecipientSearch,
|
|
332
|
+
renderStaticRecipient: renderStaticRecipient,
|
|
333
|
+
renderAppPicker: renderAppPicker,
|
|
334
|
+
escalateHelp: escalateHelp,
|
|
335
|
+
recipientTypeDisabled: recipientTypeDisabled
|
|
336
|
+
})
|
|
337
|
+
})
|
|
338
|
+
]
|
|
333
339
|
}),
|
|
334
340
|
'form' === evalsTogglePlacement && evalsToggle,
|
|
335
341
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(mixed_scopes_banner_cjs_namespaceObject.MixedScopesBanner, {
|
|
@@ -26,7 +26,8 @@ export interface GuardrailBuilderProps {
|
|
|
26
26
|
byoDisplay?: boolean;
|
|
27
27
|
providerField?: boolean;
|
|
28
28
|
policyName?: string;
|
|
29
|
-
evalsTogglePlacement?: 'form' | 'footer';
|
|
29
|
+
evalsTogglePlacement?: 'form' | 'footer' | 'none';
|
|
30
|
+
hideAction?: boolean;
|
|
30
31
|
allowedActionTypes?: ReadonlyArray<Exclude<GuardrailAction['$actionType'], 'filter'>>;
|
|
31
32
|
hideLogSeverity?: boolean;
|
|
32
33
|
renderRecipientSearch?: (ctx: GuardrailRecipientSearchContext) => ReactNode;
|
|
@@ -41,7 +42,7 @@ export interface GuardrailBuilderProps {
|
|
|
41
42
|
labels?: Partial<GuardrailBuilderLabels>;
|
|
42
43
|
className?: string;
|
|
43
44
|
}
|
|
44
|
-
export declare function GuardrailBuilder({ open, definition, scope, guardrail, defaultName, existingNames, toolName, availableToolNames, lockSingleScope, onSave, onCancel, onSaveAsNew, otherAppliedScopes, inline, hideHeader, dialogMaxWidth, title, byoDisplay, providerField, policyName, evalsTogglePlacement, allowedActionTypes, hideLogSeverity, renderRecipientSearch, renderStaticRecipient, renderAppPicker, escalateHelp, recipientTypeDisabled, errors: hostErrors, renderParameter, overrideParameterIds, saveDisabled: hostSaveDisabled, labels: labelOverrides, className, }: GuardrailBuilderProps): import("react/jsx-runtime").JSX.Element;
|
|
45
|
+
export declare function GuardrailBuilder({ open, definition, scope, guardrail, defaultName, existingNames, toolName, availableToolNames, lockSingleScope, onSave, onCancel, onSaveAsNew, otherAppliedScopes, inline, hideHeader, dialogMaxWidth, title, byoDisplay, providerField, policyName, evalsTogglePlacement, hideAction, allowedActionTypes, hideLogSeverity, renderRecipientSearch, renderStaticRecipient, renderAppPicker, escalateHelp, recipientTypeDisabled, errors: hostErrors, renderParameter, overrideParameterIds, saveDisabled: hostSaveDisabled, labels: labelOverrides, className, }: GuardrailBuilderProps): import("react/jsx-runtime").JSX.Element;
|
|
45
46
|
export declare namespace GuardrailBuilder {
|
|
46
47
|
var displayName: string;
|
|
47
48
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guardrail-builder.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/Guardrails/guardrail-builder.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,SAAS,EAA4D,MAAM,OAAO,CAAC;AACjG,OAAO,EAEL,KAAK,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L,UAAkB,EAClB,aAAqB,EACrB,UAAU,EACV,oBAA6B,EAC7B,UAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACrB,eAAe,EACf,YAAY,EACZ,qBAAqB,EACrB,MAAM,EAAE,UAAU,EAClB,eAAe,EACf,oBAAoB,EACpB,YAAY,EAAE,gBAAwB,EACtC,MAAM,EAAE,cAAc,EACtB,SAAS,GACV,EAAE,qBAAqB,2CAyZvB;yBA7be,gBAAgB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Alert, AlertDescription, FormField, Input, Label, Separator, cn } from "@uipath/apollo-wind";
|
|
3
3
|
import { Info } from "lucide-react";
|
|
4
4
|
import { useCallback, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
@@ -28,7 +28,7 @@ const BUILDER_ERROR_MERGES = {
|
|
|
28
28
|
})
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
|
-
function GuardrailBuilder({ open, definition, scope, guardrail, defaultName, existingNames, toolName, availableToolNames, lockSingleScope, onSave, onCancel, onSaveAsNew, otherAppliedScopes = null, inline = false, hideHeader = false, dialogMaxWidth, title, byoDisplay = false, providerField = false, policyName, evalsTogglePlacement = 'form', allowedActionTypes, hideLogSeverity, renderRecipientSearch, renderStaticRecipient, renderAppPicker, escalateHelp, recipientTypeDisabled, errors: hostErrors, renderParameter, overrideParameterIds, saveDisabled: hostSaveDisabled = false, labels: labelOverrides, className }) {
|
|
31
|
+
function GuardrailBuilder({ open, definition, scope, guardrail, defaultName, existingNames, toolName, availableToolNames, lockSingleScope, onSave, onCancel, onSaveAsNew, otherAppliedScopes = null, inline = false, hideHeader = false, dialogMaxWidth, title, byoDisplay = false, providerField = false, policyName, evalsTogglePlacement = 'form', hideAction = false, allowedActionTypes, hideLogSeverity, renderRecipientSearch, renderStaticRecipient, renderAppPicker, escalateHelp, recipientTypeDisabled, errors: hostErrors, renderParameter, overrideParameterIds, saveDisabled: hostSaveDisabled = false, labels: labelOverrides, className }) {
|
|
32
32
|
const labels = useGuardrailBuilderLabels(labelOverrides);
|
|
33
33
|
const uid = useId();
|
|
34
34
|
const [formData, setFormData] = useState(()=>{
|
|
@@ -101,7 +101,8 @@ function GuardrailBuilder({ open, definition, scope, guardrail, defaultName, exi
|
|
|
101
101
|
for (const id of getRequiredEmptyParameterIds(definition.parameters, reconciledParameters))parameterErrors[id] = labels.parameterRequiredError;
|
|
102
102
|
for (const id of getOutOfRangeParameterIds(definition.parameters, reconciledParameters))parameterErrors[id] ??= labels.parameterOutOfRangeError;
|
|
103
103
|
if (Object.keys(parameterErrors).length > 0) e.parameters = parameterErrors;
|
|
104
|
-
|
|
104
|
+
const actionErrorFields = hideAction ? [] : getGuardrailActionErrorFields(formData.action);
|
|
105
|
+
for (const field of actionErrorFields)e[field] = ({
|
|
105
106
|
blockReason: labels.blockReasonRequiredError,
|
|
106
107
|
filterFields: labels.filterFieldsRequiredError,
|
|
107
108
|
recipient: labels.recipientRequiredError,
|
|
@@ -111,6 +112,7 @@ function GuardrailBuilder({ open, definition, scope, guardrail, defaultName, exi
|
|
|
111
112
|
}, [
|
|
112
113
|
formData,
|
|
113
114
|
showScopeSelector,
|
|
115
|
+
hideAction,
|
|
114
116
|
definition.parameters,
|
|
115
117
|
existingNames,
|
|
116
118
|
labels,
|
|
@@ -281,27 +283,31 @@ function GuardrailBuilder({ open, definition, scope, guardrail, defaultName, exi
|
|
|
281
283
|
},
|
|
282
284
|
labels: labels
|
|
283
285
|
}),
|
|
284
|
-
/*#__PURE__*/
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
286
|
+
!hideAction && /*#__PURE__*/ jsxs(Fragment, {
|
|
287
|
+
children: [
|
|
288
|
+
/*#__PURE__*/ jsx(Separator, {}),
|
|
289
|
+
/*#__PURE__*/ jsx("div", {
|
|
290
|
+
className: "space-y-3",
|
|
291
|
+
children: /*#__PURE__*/ jsx(GuardrailActionSection, {
|
|
292
|
+
action: formData.action,
|
|
293
|
+
onActionChange: (action)=>updateField('action', action),
|
|
294
|
+
allowedActionTypes: allowedActionTypes,
|
|
295
|
+
hideLogSeverity: hideLogSeverity,
|
|
296
|
+
errors: {
|
|
297
|
+
blockReason: displayErrors.blockReason,
|
|
298
|
+
filterFields: displayErrors.filterFields,
|
|
299
|
+
recipient: displayErrors.recipient,
|
|
300
|
+
actionApp: displayErrors.actionApp
|
|
301
|
+
},
|
|
302
|
+
labels: labels,
|
|
303
|
+
renderRecipientSearch: renderRecipientSearch,
|
|
304
|
+
renderStaticRecipient: renderStaticRecipient,
|
|
305
|
+
renderAppPicker: renderAppPicker,
|
|
306
|
+
escalateHelp: escalateHelp,
|
|
307
|
+
recipientTypeDisabled: recipientTypeDisabled
|
|
308
|
+
})
|
|
309
|
+
})
|
|
310
|
+
]
|
|
305
311
|
}),
|
|
306
312
|
'form' === evalsTogglePlacement && evalsToggle,
|
|
307
313
|
/*#__PURE__*/ jsx(MixedScopesBanner, {
|