@uipath/apollo-react 6.62.0 → 6.64.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.
Files changed (91) hide show
  1. package/dist/canvas/components/AgentCanvas/components/ToolResourceIcon/CreateFileIcon.cjs +54 -0
  2. package/dist/canvas/components/AgentCanvas/components/ToolResourceIcon/CreateFileIcon.d.ts +9 -0
  3. package/dist/canvas/components/AgentCanvas/components/ToolResourceIcon/CreateFileIcon.d.ts.map +1 -0
  4. package/dist/canvas/components/AgentCanvas/components/ToolResourceIcon/CreateFileIcon.js +20 -0
  5. package/dist/canvas/components/AgentCanvas/components/ToolResourceIcon/ToolResourceIcon.cjs +3 -0
  6. package/dist/canvas/components/AgentCanvas/components/ToolResourceIcon/ToolResourceIcon.d.ts.map +1 -1
  7. package/dist/canvas/components/AgentCanvas/components/ToolResourceIcon/ToolResourceIcon.js +3 -0
  8. package/dist/canvas/components/Guardrails/components/guardrail-evals-toggle.cjs +59 -0
  9. package/dist/canvas/components/Guardrails/components/guardrail-evals-toggle.d.ts +9 -0
  10. package/dist/canvas/components/Guardrails/components/guardrail-evals-toggle.d.ts.map +1 -0
  11. package/dist/canvas/components/Guardrails/components/guardrail-evals-toggle.js +25 -0
  12. package/dist/canvas/components/Guardrails/components/guardrail-name-fields.cjs +74 -0
  13. package/dist/canvas/components/Guardrails/components/guardrail-name-fields.d.ts +12 -0
  14. package/dist/canvas/components/Guardrails/components/guardrail-name-fields.d.ts.map +1 -0
  15. package/dist/canvas/components/Guardrails/components/guardrail-name-fields.js +40 -0
  16. package/dist/canvas/components/Guardrails/custom-builder-types.cjs +18 -0
  17. package/dist/canvas/components/Guardrails/custom-builder-types.d.ts +20 -0
  18. package/dist/canvas/components/Guardrails/custom-builder-types.d.ts.map +1 -0
  19. package/dist/canvas/components/Guardrails/custom-builder-types.js +0 -0
  20. package/dist/canvas/components/Guardrails/custom-builder-utils.cjs +89 -0
  21. package/dist/canvas/components/Guardrails/custom-builder-utils.d.ts +25 -0
  22. package/dist/canvas/components/Guardrails/custom-builder-utils.d.ts.map +1 -0
  23. package/dist/canvas/components/Guardrails/custom-builder-utils.js +49 -0
  24. package/dist/canvas/components/Guardrails/custom-guardrail-builder.cjs +273 -0
  25. package/dist/canvas/components/Guardrails/custom-guardrail-builder.d.ts +44 -0
  26. package/dist/canvas/components/Guardrails/custom-guardrail-builder.d.ts.map +1 -0
  27. package/dist/canvas/components/Guardrails/custom-guardrail-builder.js +239 -0
  28. package/dist/canvas/components/Guardrails/guardrail-builder.cjs +37 -85
  29. package/dist/canvas/components/Guardrails/guardrail-builder.d.ts.map +1 -1
  30. package/dist/canvas/components/Guardrails/guardrail-builder.js +38 -86
  31. package/dist/canvas/components/Guardrails/i18n.cjs +121 -17
  32. package/dist/canvas/components/Guardrails/i18n.d.ts +18 -0
  33. package/dist/canvas/components/Guardrails/i18n.d.ts.map +1 -1
  34. package/dist/canvas/components/Guardrails/i18n.js +103 -14
  35. package/dist/canvas/components/Guardrails/index.cjs +38 -9
  36. package/dist/canvas/components/Guardrails/index.d.ts +7 -2
  37. package/dist/canvas/components/Guardrails/index.d.ts.map +1 -1
  38. package/dist/canvas/components/Guardrails/index.js +4 -2
  39. package/dist/canvas/components/Guardrails/use-guardrail-form-errors.cjs +68 -0
  40. package/dist/canvas/components/Guardrails/use-guardrail-form-errors.d.ts +15 -0
  41. package/dist/canvas/components/Guardrails/use-guardrail-form-errors.d.ts.map +1 -0
  42. package/dist/canvas/components/Guardrails/use-guardrail-form-errors.js +34 -0
  43. package/dist/canvas/components/Guardrails/use-swallow-enter.cjs +51 -0
  44. package/dist/canvas/components/Guardrails/use-swallow-enter.d.ts +3 -0
  45. package/dist/canvas/components/Guardrails/use-swallow-enter.d.ts.map +1 -0
  46. package/dist/canvas/components/Guardrails/use-swallow-enter.js +17 -0
  47. package/dist/canvas/locales/de.cjs +1 -1
  48. package/dist/canvas/locales/de.d.ts.map +1 -1
  49. package/dist/canvas/locales/de.js +1 -1
  50. package/dist/canvas/locales/en.cjs +1 -1
  51. package/dist/canvas/locales/en.d.ts.map +1 -1
  52. package/dist/canvas/locales/en.js +1 -1
  53. package/dist/canvas/locales/es-MX.cjs +1 -1
  54. package/dist/canvas/locales/es-MX.d.ts.map +1 -1
  55. package/dist/canvas/locales/es-MX.js +1 -1
  56. package/dist/canvas/locales/es.cjs +1 -1
  57. package/dist/canvas/locales/es.d.ts.map +1 -1
  58. package/dist/canvas/locales/es.js +1 -1
  59. package/dist/canvas/locales/fr.cjs +1 -1
  60. package/dist/canvas/locales/fr.d.ts.map +1 -1
  61. package/dist/canvas/locales/fr.js +1 -1
  62. package/dist/canvas/locales/ja.cjs +1 -1
  63. package/dist/canvas/locales/ja.d.ts.map +1 -1
  64. package/dist/canvas/locales/ja.js +1 -1
  65. package/dist/canvas/locales/ko.cjs +1 -1
  66. package/dist/canvas/locales/ko.d.ts.map +1 -1
  67. package/dist/canvas/locales/ko.js +1 -1
  68. package/dist/canvas/locales/pt-BR.cjs +1 -1
  69. package/dist/canvas/locales/pt-BR.d.ts.map +1 -1
  70. package/dist/canvas/locales/pt-BR.js +1 -1
  71. package/dist/canvas/locales/pt.cjs +1 -1
  72. package/dist/canvas/locales/pt.d.ts.map +1 -1
  73. package/dist/canvas/locales/pt.js +1 -1
  74. package/dist/canvas/locales/ro.cjs +1 -1
  75. package/dist/canvas/locales/ro.d.ts.map +1 -1
  76. package/dist/canvas/locales/ro.js +1 -1
  77. package/dist/canvas/locales/tr.cjs +1 -1
  78. package/dist/canvas/locales/tr.d.ts.map +1 -1
  79. package/dist/canvas/locales/tr.js +1 -1
  80. package/dist/canvas/locales/zh-CN.cjs +1 -1
  81. package/dist/canvas/locales/zh-CN.d.ts.map +1 -1
  82. package/dist/canvas/locales/zh-CN.js +1 -1
  83. package/dist/canvas/locales/zh-TW.cjs +1 -1
  84. package/dist/canvas/locales/zh-TW.d.ts.map +1 -1
  85. package/dist/canvas/locales/zh-TW.js +1 -1
  86. package/dist/canvas/styles/tailwind.canvas.css +1 -1
  87. package/dist/canvas/types.cjs +1 -0
  88. package/dist/canvas/types.d.ts +1 -0
  89. package/dist/canvas/types.d.ts.map +1 -1
  90. package/dist/canvas/types.js +1 -0
  91. package/package.json +2 -2
@@ -33,14 +33,26 @@ const external_react_namespaceObject = require("react");
33
33
  const external_builder_types_cjs_namespaceObject = require("./builder-types.cjs");
34
34
  const external_builder_utils_cjs_namespaceObject = require("./builder-utils.cjs");
35
35
  const guardrail_action_section_cjs_namespaceObject = require("./components/guardrail-action-section.cjs");
36
+ const guardrail_evals_toggle_cjs_namespaceObject = require("./components/guardrail-evals-toggle.cjs");
37
+ const guardrail_name_fields_cjs_namespaceObject = require("./components/guardrail-name-fields.cjs");
36
38
  const guardrail_scope_selector_cjs_namespaceObject = require("./components/guardrail-scope-selector.cjs");
37
39
  const guardrail_status_banner_cjs_namespaceObject = require("./components/guardrail-status-banner.cjs");
38
40
  const mixed_scopes_banner_cjs_namespaceObject = require("./components/mixed-scopes-banner.cjs");
39
41
  const external_guardrail_form_layout_cjs_namespaceObject = require("./guardrail-form-layout.cjs");
40
42
  const external_guardrail_validator_form_cjs_namespaceObject = require("./guardrail-validator-form.cjs");
41
43
  const external_i18n_cjs_namespaceObject = require("./i18n.cjs");
44
+ const external_use_guardrail_form_errors_cjs_namespaceObject = require("./use-guardrail-form-errors.cjs");
45
+ const external_use_swallow_enter_cjs_namespaceObject = require("./use-swallow-enter.cjs");
42
46
  const external_utils_cjs_namespaceObject = require("./utils.cjs");
43
47
  const EMPTY_PARAM_IDS = new Set();
48
+ const BUILDER_ERROR_MERGES = {
49
+ parameters: {
50
+ merge: (internal, host)=>({
51
+ ...internal,
52
+ ...host
53
+ })
54
+ }
55
+ };
44
56
  function GuardrailBuilder({ open, definition, scope, guardrail, defaultName, existingNames, toolName, availableToolNames, onSave, onCancel, onSaveAsNew, otherAppliedScopes = null, inline = false, hideHeader = false, dialogMaxWidth, title, evalsTogglePlacement = 'form', renderRecipientSearch, renderStaticRecipient, renderAppPicker, escalateHelp, errors: hostErrors, renderParameter, overrideParameterIds, saveDisabled: hostSaveDisabled = false, labels: labelOverrides, className }) {
45
57
  const labels = (0, external_i18n_cjs_namespaceObject.useGuardrailBuilderLabels)(labelOverrides);
46
58
  const uid = (0, external_react_namespaceObject.useId)();
@@ -49,7 +61,6 @@ function GuardrailBuilder({ open, definition, scope, guardrail, defaultName, exi
49
61
  if (!guardrail && defaultName) data.name = defaultName;
50
62
  return data;
51
63
  });
52
- const [showErrors, setShowErrors] = (0, external_react_namespaceObject.useState)(false);
53
64
  const [editedParamIds, setEditedParamIds] = (0, external_react_namespaceObject.useState)(EMPTY_PARAM_IDS);
54
65
  (0, external_react_namespaceObject.useEffect)(()=>{
55
66
  setEditedParamIds(EMPTY_PARAM_IDS);
@@ -57,17 +68,7 @@ function GuardrailBuilder({ open, definition, scope, guardrail, defaultName, exi
57
68
  hostErrors
58
69
  ]);
59
70
  const rootRef = (0, external_react_namespaceObject.useRef)(null);
60
- (0, external_react_namespaceObject.useEffect)(()=>{
61
- const node = rootRef.current;
62
- if (!node) return;
63
- const swallowEnter = (event)=>{
64
- if ('Enter' !== event.key || event.defaultPrevented) return;
65
- const target = event.target;
66
- if (target instanceof HTMLInputElement && 'button' !== target.type) event.preventDefault();
67
- };
68
- node.addEventListener('keydown', swallowEnter);
69
- return ()=>node.removeEventListener('keydown', swallowEnter);
70
- }, []);
71
+ (0, external_use_swallow_enter_cjs_namespaceObject.useSwallowEnter)(rootRef);
71
72
  const showScopeSelector = 'Agent' === scope;
72
73
  const updateField = (0, external_react_namespaceObject.useCallback)((field, value)=>{
73
74
  setFormData((prev)=>({
@@ -137,50 +138,37 @@ function GuardrailBuilder({ open, definition, scope, guardrail, defaultName, exi
137
138
  hostErrors,
138
139
  editedParamIds
139
140
  ]);
140
- const displayErrors = (0, external_react_namespaceObject.useMemo)(()=>{
141
- const base = showErrors ? {
142
- ...internalErrors
143
- } : {};
144
- if (hostErrors) {
145
- for (const [key, value] of Object.entries(hostErrors))if (void 0 !== value) base[key] = 'parameters' === key ? {
146
- ...base.parameters,
147
- ...liveHostParameterErrors
148
- } : value;
149
- }
150
- return base;
151
- }, [
152
- showErrors,
153
- internalErrors,
141
+ const liveHostErrors = (0, external_react_namespaceObject.useMemo)(()=>hostErrors?.parameters === void 0 ? hostErrors : {
142
+ ...hostErrors,
143
+ parameters: liveHostParameterErrors
144
+ }, [
154
145
  hostErrors,
155
146
  liveHostParameterErrors
156
147
  ]);
157
- const hasHostErrors = Boolean(hostErrors && Object.entries(hostErrors).some(([key, v])=>{
158
- if (void 0 === v) return false;
159
- if ('parameters' === key) return Object.keys(liveHostParameterErrors).length > 0;
160
- return 'object' != typeof v || Object.keys(v).length > 0;
161
- }));
162
- const isValid = 0 === Object.keys(internalErrors).length && !hasHostErrors;
148
+ const { displayErrors, isValid, showErrors, revealErrors } = (0, external_use_guardrail_form_errors_cjs_namespaceObject.useGuardrailFormErrors)(internalErrors, liveHostErrors, BUILDER_ERROR_MERGES);
163
149
  const isDefinitionAvailable = 'Available' === definition.status;
164
150
  const handleSave = (0, external_react_namespaceObject.useCallback)(()=>{
165
151
  if (!isDefinitionAvailable) return;
166
- if (!isValid) return void setShowErrors(true);
152
+ if (!isValid) return void revealErrors();
167
153
  onSave(guardrailResult);
168
154
  }, [
169
155
  guardrailResult,
170
156
  onSave,
171
157
  isValid,
172
- isDefinitionAvailable
158
+ isDefinitionAvailable,
159
+ revealErrors
173
160
  ]);
174
161
  const handleSaveAsNew = (0, external_react_namespaceObject.useCallback)(()=>{
175
162
  if (!onSaveAsNew) return;
176
163
  if (!isDefinitionAvailable) return;
177
- if (!isValid) return void setShowErrors(true);
164
+ if (!isValid) return void revealErrors();
178
165
  onSaveAsNew(guardrailResult);
179
166
  }, [
180
167
  guardrailResult,
181
168
  onSaveAsNew,
182
169
  isValid,
183
- isDefinitionAvailable
170
+ isDefinitionAvailable,
171
+ revealErrors
184
172
  ]);
185
173
  const isByoConfigurationDisabled = void 0 !== definition.byoValidatorName && 'Disabled' === definition.status;
186
174
  const computedTitle = guardrail ? (0, external_i18n_cjs_namespaceObject.formatGuardrailFormMessage)(labels.editTitle, {
@@ -208,25 +196,11 @@ function GuardrailBuilder({ open, definition, scope, guardrail, defaultName, exi
208
196
  })
209
197
  ]
210
198
  }) : null;
211
- const evalsToggle = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
212
- className: "flex items-center gap-2",
213
- children: [
214
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Switch, {
215
- id: `${uid}-ootb-enable-evals`,
216
- checked: formData.enabledForEvals,
217
- onCheckedChange: (checked)=>updateField('enabledForEvals', checked)
218
- }),
219
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Label, {
220
- variant: "muted",
221
- htmlFor: `${uid}-ootb-enable-evals`,
222
- className: "cursor-pointer",
223
- children: labels.evalsLabel
224
- }),
225
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.InfoTooltip, {
226
- content: labels.evalsTooltip,
227
- "aria-label": labels.evalsInfoAriaLabel
228
- })
229
- ]
199
+ const evalsToggle = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(guardrail_evals_toggle_cjs_namespaceObject.GuardrailEvalsToggle, {
200
+ idPrefix: `${uid}-ootb`,
201
+ checked: formData.enabledForEvals,
202
+ onCheckedChange: (checked)=>updateField('enabledForEvals', checked),
203
+ labels: labels
230
204
  });
231
205
  const validatorFormErrors = displayErrors.parameters;
232
206
  const formBody = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
@@ -250,36 +224,14 @@ function GuardrailBuilder({ open, definition, scope, guardrail, defaultName, exi
250
224
  })
251
225
  ]
252
226
  }),
253
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(apollo_wind_namespaceObject.FormField, {
254
- children: [
255
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.FormFieldLabel, {
256
- htmlFor: `${uid}-ootb-name`,
257
- required: true,
258
- children: labels.nameLabel
259
- }),
260
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Input, {
261
- id: `${uid}-ootb-name`,
262
- value: formData.name,
263
- onChange: (e)=>updateField('name', e.target.value),
264
- placeholder: labels.namePlaceholder,
265
- error: displayErrors.name
266
- })
267
- ]
268
- }),
269
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(apollo_wind_namespaceObject.FormField, {
270
- children: [
271
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Label, {
272
- htmlFor: `${uid}-ootb-description`,
273
- children: labels.descriptionLabel
274
- }),
275
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Textarea, {
276
- id: `${uid}-ootb-description`,
277
- minRows: 1,
278
- value: formData.description,
279
- onChange: (e)=>updateField("description", e.target.value),
280
- placeholder: labels.descriptionPlaceholder
281
- })
282
- ]
227
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(guardrail_name_fields_cjs_namespaceObject.GuardrailNameFields, {
228
+ idPrefix: `${uid}-ootb`,
229
+ name: formData.name,
230
+ description: formData.description,
231
+ onNameChange: (name)=>updateField('name', name),
232
+ onDescriptionChange: (description)=>updateField("description", description),
233
+ nameError: displayErrors.name,
234
+ labels: labels
283
235
  }),
284
236
  definition.parameters.length > 0 && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
285
237
  className: "space-y-3",
@@ -1 +1 @@
1
- {"version":3,"file":"guardrail-builder.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/Guardrails/guardrail-builder.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,KAAK,SAAS,EAA4D,MAAM,OAAO,CAAC;AACjG,OAAO,EAEL,KAAK,yBAAyB,EAC9B,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,+BAA+B,EACpC,KAAK,cAAc,EAEnB,KAAK,+BAA+B,EACrC,MAAM,iBAAiB,CAAC;AAazB,OAAO,EAEL,KAAK,sBAAsB,EAE5B,MAAM,QAAQ,CAAC;AAChB,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAU3D,MAAM,WAAW,qBAAqB;IAKpC,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,EAAE,mBAAmB,CAAC;IAEhC,KAAK,EAAE,cAAc,CAAC;IAEtB,SAAS,CAAC,EAAE,qBAAqB,CAAC;IAElC,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IAEzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,MAAM,EAAE,CAAC,SAAS,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACnD,QAAQ,EAAE,MAAM,IAAI,CAAC;IAYrB,WAAW,CAAC,EAAE,CAAC,SAAS,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAEzD,kBAAkB,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,IAAI,CAAC;IAClE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,KAAK,CAAC,EAAE,SAAS,CAAC;IAElB,oBAAoB,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IACzC,qBAAqB,CAAC,EAAE,CAAC,GAAG,EAAE,+BAA+B,KAAK,SAAS,CAAC;IAK5E,qBAAqB,CAAC,EAAE,CAAC,GAAG,EAAE,+BAA+B,KAAK,SAAS,GAAG,SAAS,CAAC;IACxF,eAAe,CAAC,EAAE,CAAC,GAAG,EAAE,yBAAyB,KAAK,SAAS,CAAC;IAEhE,YAAY,CAAC,EAAE,SAAS,CAAC;IAKzB,MAAM,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAKzC,eAAe,CAAC,EAAE,2BAA2B,CAAC,iBAAiB,CAAC,CAAC;IAMjE,oBAAoB,CAAC,EAAE,2BAA2B,CAAC,sBAAsB,CAAC,CAAC;IAK3E,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,MAAM,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAYD,wBAAgB,gBAAgB,CAAC,EAC/B,IAAI,EACJ,UAAU,EACV,KAAK,EACL,SAAS,EACT,WAAW,EACX,aAAa,EACb,QAAQ,EACR,kBAAkB,EAClB,MAAM,EACN,QAAQ,EACR,WAAW,EACX,kBAAyB,EACzB,MAAc,EACd,UAAkB,EAClB,cAAc,EACd,KAAK,EACL,oBAA6B,EAC7B,qBAAqB,EACrB,qBAAqB,EACrB,eAAe,EACf,YAAY,EACZ,MAAM,EAAE,UAAU,EAClB,eAAe,EACf,oBAAoB,EACpB,YAAY,EAAE,gBAAwB,EACtC,MAAM,EAAE,cAAc,EACtB,SAAS,GACV,EAAE,qBAAqB,2CA8XvB;yBA1Ze,gBAAgB"}
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,yBAAyB,EAC9B,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,+BAA+B,EACpC,KAAK,cAAc,EAEnB,KAAK,+BAA+B,EACrC,MAAM,iBAAiB,CAAC;AAezB,OAAO,EAEL,KAAK,sBAAsB,EAE5B,MAAM,QAAQ,CAAC;AAChB,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAiB3D,MAAM,WAAW,qBAAqB;IAKpC,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,EAAE,mBAAmB,CAAC;IAEhC,KAAK,EAAE,cAAc,CAAC;IAEtB,SAAS,CAAC,EAAE,qBAAqB,CAAC;IAElC,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IAEzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,MAAM,EAAE,CAAC,SAAS,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACnD,QAAQ,EAAE,MAAM,IAAI,CAAC;IAYrB,WAAW,CAAC,EAAE,CAAC,SAAS,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAEzD,kBAAkB,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,IAAI,CAAC;IAClE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,KAAK,CAAC,EAAE,SAAS,CAAC;IAElB,oBAAoB,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IACzC,qBAAqB,CAAC,EAAE,CAAC,GAAG,EAAE,+BAA+B,KAAK,SAAS,CAAC;IAK5E,qBAAqB,CAAC,EAAE,CAAC,GAAG,EAAE,+BAA+B,KAAK,SAAS,GAAG,SAAS,CAAC;IACxF,eAAe,CAAC,EAAE,CAAC,GAAG,EAAE,yBAAyB,KAAK,SAAS,CAAC;IAEhE,YAAY,CAAC,EAAE,SAAS,CAAC;IAKzB,MAAM,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAKzC,eAAe,CAAC,EAAE,2BAA2B,CAAC,iBAAiB,CAAC,CAAC;IAMjE,oBAAoB,CAAC,EAAE,2BAA2B,CAAC,sBAAsB,CAAC,CAAC;IAK3E,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,MAAM,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAYD,wBAAgB,gBAAgB,CAAC,EAC/B,IAAI,EACJ,UAAU,EACV,KAAK,EACL,SAAS,EACT,WAAW,EACX,aAAa,EACb,QAAQ,EACR,kBAAkB,EAClB,MAAM,EACN,QAAQ,EACR,WAAW,EACX,kBAAyB,EACzB,MAAc,EACd,UAAkB,EAClB,cAAc,EACd,KAAK,EACL,oBAA6B,EAC7B,qBAAqB,EACrB,qBAAqB,EACrB,eAAe,EACf,YAAY,EACZ,MAAM,EAAE,UAAU,EAClB,eAAe,EACf,oBAAoB,EACpB,YAAY,EAAE,gBAAwB,EACtC,MAAM,EAAE,cAAc,EACtB,SAAS,GACV,EAAE,qBAAqB,2CA0UvB;yBAtWe,gBAAgB"}
@@ -1,18 +1,30 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { Alert, AlertDescription, FormField, FormFieldLabel, InfoTooltip, Input, Label, Separator, Switch, Textarea, cn } from "@uipath/apollo-wind";
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";
5
5
  import { GUARDRAIL_BYO_VALIDATOR_TYPE } from "./builder-types.js";
6
6
  import { getGuardrailActionErrorFields, getGuardrailSelectorErrorFields, initGuardrailBuilderFormData } from "./builder-utils.js";
7
7
  import { GuardrailActionSection } from "./components/guardrail-action-section.js";
8
+ import { GuardrailEvalsToggle } from "./components/guardrail-evals-toggle.js";
9
+ import { GuardrailNameFields } from "./components/guardrail-name-fields.js";
8
10
  import { GuardrailScopeSelector } from "./components/guardrail-scope-selector.js";
9
11
  import { GuardrailStatusBanner } from "./components/guardrail-status-banner.js";
10
12
  import { MixedScopesBanner } from "./components/mixed-scopes-banner.js";
11
13
  import { GuardrailFormLayout } from "./guardrail-form-layout.js";
12
14
  import { GuardrailValidatorForm } from "./guardrail-validator-form.js";
13
15
  import { formatGuardrailFormMessage, useGuardrailBuilderLabels } from "./i18n.js";
16
+ import { useGuardrailFormErrors } from "./use-guardrail-form-errors.js";
17
+ import { useSwallowEnter } from "./use-swallow-enter.js";
14
18
  import { dropEmptyOptionalParameters, getOutOfRangeParameterIds, getRequiredEmptyParameterIds, syncMapEnumParameters } from "./utils.js";
15
19
  const EMPTY_PARAM_IDS = new Set();
20
+ const BUILDER_ERROR_MERGES = {
21
+ parameters: {
22
+ merge: (internal, host)=>({
23
+ ...internal,
24
+ ...host
25
+ })
26
+ }
27
+ };
16
28
  function GuardrailBuilder({ open, definition, scope, guardrail, defaultName, existingNames, toolName, availableToolNames, onSave, onCancel, onSaveAsNew, otherAppliedScopes = null, inline = false, hideHeader = false, dialogMaxWidth, title, evalsTogglePlacement = 'form', renderRecipientSearch, renderStaticRecipient, renderAppPicker, escalateHelp, errors: hostErrors, renderParameter, overrideParameterIds, saveDisabled: hostSaveDisabled = false, labels: labelOverrides, className }) {
17
29
  const labels = useGuardrailBuilderLabels(labelOverrides);
18
30
  const uid = useId();
@@ -21,7 +33,6 @@ function GuardrailBuilder({ open, definition, scope, guardrail, defaultName, exi
21
33
  if (!guardrail && defaultName) data.name = defaultName;
22
34
  return data;
23
35
  });
24
- const [showErrors, setShowErrors] = useState(false);
25
36
  const [editedParamIds, setEditedParamIds] = useState(EMPTY_PARAM_IDS);
26
37
  useEffect(()=>{
27
38
  setEditedParamIds(EMPTY_PARAM_IDS);
@@ -29,17 +40,7 @@ function GuardrailBuilder({ open, definition, scope, guardrail, defaultName, exi
29
40
  hostErrors
30
41
  ]);
31
42
  const rootRef = useRef(null);
32
- useEffect(()=>{
33
- const node = rootRef.current;
34
- if (!node) return;
35
- const swallowEnter = (event)=>{
36
- if ('Enter' !== event.key || event.defaultPrevented) return;
37
- const target = event.target;
38
- if (target instanceof HTMLInputElement && 'button' !== target.type) event.preventDefault();
39
- };
40
- node.addEventListener('keydown', swallowEnter);
41
- return ()=>node.removeEventListener('keydown', swallowEnter);
42
- }, []);
43
+ useSwallowEnter(rootRef);
43
44
  const showScopeSelector = 'Agent' === scope;
44
45
  const updateField = useCallback((field, value)=>{
45
46
  setFormData((prev)=>({
@@ -109,50 +110,37 @@ function GuardrailBuilder({ open, definition, scope, guardrail, defaultName, exi
109
110
  hostErrors,
110
111
  editedParamIds
111
112
  ]);
112
- const displayErrors = useMemo(()=>{
113
- const base = showErrors ? {
114
- ...internalErrors
115
- } : {};
116
- if (hostErrors) {
117
- for (const [key, value] of Object.entries(hostErrors))if (void 0 !== value) base[key] = 'parameters' === key ? {
118
- ...base.parameters,
119
- ...liveHostParameterErrors
120
- } : value;
121
- }
122
- return base;
123
- }, [
124
- showErrors,
125
- internalErrors,
113
+ const liveHostErrors = useMemo(()=>hostErrors?.parameters === void 0 ? hostErrors : {
114
+ ...hostErrors,
115
+ parameters: liveHostParameterErrors
116
+ }, [
126
117
  hostErrors,
127
118
  liveHostParameterErrors
128
119
  ]);
129
- const hasHostErrors = Boolean(hostErrors && Object.entries(hostErrors).some(([key, v])=>{
130
- if (void 0 === v) return false;
131
- if ('parameters' === key) return Object.keys(liveHostParameterErrors).length > 0;
132
- return 'object' != typeof v || Object.keys(v).length > 0;
133
- }));
134
- const isValid = 0 === Object.keys(internalErrors).length && !hasHostErrors;
120
+ const { displayErrors, isValid, showErrors, revealErrors } = useGuardrailFormErrors(internalErrors, liveHostErrors, BUILDER_ERROR_MERGES);
135
121
  const isDefinitionAvailable = 'Available' === definition.status;
136
122
  const handleSave = useCallback(()=>{
137
123
  if (!isDefinitionAvailable) return;
138
- if (!isValid) return void setShowErrors(true);
124
+ if (!isValid) return void revealErrors();
139
125
  onSave(guardrailResult);
140
126
  }, [
141
127
  guardrailResult,
142
128
  onSave,
143
129
  isValid,
144
- isDefinitionAvailable
130
+ isDefinitionAvailable,
131
+ revealErrors
145
132
  ]);
146
133
  const handleSaveAsNew = useCallback(()=>{
147
134
  if (!onSaveAsNew) return;
148
135
  if (!isDefinitionAvailable) return;
149
- if (!isValid) return void setShowErrors(true);
136
+ if (!isValid) return void revealErrors();
150
137
  onSaveAsNew(guardrailResult);
151
138
  }, [
152
139
  guardrailResult,
153
140
  onSaveAsNew,
154
141
  isValid,
155
- isDefinitionAvailable
142
+ isDefinitionAvailable,
143
+ revealErrors
156
144
  ]);
157
145
  const isByoConfigurationDisabled = void 0 !== definition.byoValidatorName && 'Disabled' === definition.status;
158
146
  const computedTitle = guardrail ? formatGuardrailFormMessage(labels.editTitle, {
@@ -180,25 +168,11 @@ function GuardrailBuilder({ open, definition, scope, guardrail, defaultName, exi
180
168
  })
181
169
  ]
182
170
  }) : null;
183
- const evalsToggle = /*#__PURE__*/ jsxs("div", {
184
- className: "flex items-center gap-2",
185
- children: [
186
- /*#__PURE__*/ jsx(Switch, {
187
- id: `${uid}-ootb-enable-evals`,
188
- checked: formData.enabledForEvals,
189
- onCheckedChange: (checked)=>updateField('enabledForEvals', checked)
190
- }),
191
- /*#__PURE__*/ jsx(Label, {
192
- variant: "muted",
193
- htmlFor: `${uid}-ootb-enable-evals`,
194
- className: "cursor-pointer",
195
- children: labels.evalsLabel
196
- }),
197
- /*#__PURE__*/ jsx(InfoTooltip, {
198
- content: labels.evalsTooltip,
199
- "aria-label": labels.evalsInfoAriaLabel
200
- })
201
- ]
171
+ const evalsToggle = /*#__PURE__*/ jsx(GuardrailEvalsToggle, {
172
+ idPrefix: `${uid}-ootb`,
173
+ checked: formData.enabledForEvals,
174
+ onCheckedChange: (checked)=>updateField('enabledForEvals', checked),
175
+ labels: labels
202
176
  });
203
177
  const validatorFormErrors = displayErrors.parameters;
204
178
  const formBody = /*#__PURE__*/ jsxs("div", {
@@ -222,36 +196,14 @@ function GuardrailBuilder({ open, definition, scope, guardrail, defaultName, exi
222
196
  })
223
197
  ]
224
198
  }),
225
- /*#__PURE__*/ jsxs(FormField, {
226
- children: [
227
- /*#__PURE__*/ jsx(FormFieldLabel, {
228
- htmlFor: `${uid}-ootb-name`,
229
- required: true,
230
- children: labels.nameLabel
231
- }),
232
- /*#__PURE__*/ jsx(Input, {
233
- id: `${uid}-ootb-name`,
234
- value: formData.name,
235
- onChange: (e)=>updateField('name', e.target.value),
236
- placeholder: labels.namePlaceholder,
237
- error: displayErrors.name
238
- })
239
- ]
240
- }),
241
- /*#__PURE__*/ jsxs(FormField, {
242
- children: [
243
- /*#__PURE__*/ jsx(Label, {
244
- htmlFor: `${uid}-ootb-description`,
245
- children: labels.descriptionLabel
246
- }),
247
- /*#__PURE__*/ jsx(Textarea, {
248
- id: `${uid}-ootb-description`,
249
- minRows: 1,
250
- value: formData.description,
251
- onChange: (e)=>updateField("description", e.target.value),
252
- placeholder: labels.descriptionPlaceholder
253
- })
254
- ]
199
+ /*#__PURE__*/ jsx(GuardrailNameFields, {
200
+ idPrefix: `${uid}-ootb`,
201
+ name: formData.name,
202
+ description: formData.description,
203
+ onNameChange: (name)=>updateField('name', name),
204
+ onDescriptionChange: (description)=>updateField("description", description),
205
+ nameError: displayErrors.name,
206
+ labels: labels
255
207
  }),
256
208
  definition.parameters.length > 0 && /*#__PURE__*/ jsx("div", {
257
209
  className: "space-y-3",
@@ -26,15 +26,18 @@ __webpack_require__.r(__webpack_exports__);
26
26
  __webpack_require__.d(__webpack_exports__, {
27
27
  GUARDRAIL_BUILDER_EN_LABELS: ()=>GUARDRAIL_BUILDER_EN_LABELS,
28
28
  GUARDRAIL_FORM_EN_LABELS: ()=>GUARDRAIL_FORM_EN_LABELS,
29
- resolveGuardrailListLabels: ()=>resolveGuardrailListLabels,
29
+ resolveGuardrailPaletteLabels: ()=>resolveGuardrailPaletteLabels,
30
+ useGuardrailPaletteLabels: ()=>useGuardrailPaletteLabels,
30
31
  resolveGuardrailScopeSelectorLabels: ()=>resolveGuardrailScopeSelectorLabels,
31
32
  GUARDRAIL_ACTION_EN_LABELS: ()=>GUARDRAIL_ACTION_EN_LABELS,
33
+ CUSTOM_GUARDRAIL_BUILDER_EN_MESSAGES: ()=>CUSTOM_GUARDRAIL_BUILDER_EN_MESSAGES,
32
34
  GUARDRAIL_RULES_EN_MESSAGES: ()=>GUARDRAIL_RULES_EN_MESSAGES,
33
35
  GUARDRAIL_SCOPE_SELECTOR_EN_LABELS: ()=>GUARDRAIL_SCOPE_SELECTOR_EN_LABELS,
34
36
  useGuardrailFilterFieldSelectorLabels: ()=>useGuardrailFilterFieldSelectorLabels,
35
37
  resolveCentralizedGuardrailsLabels: ()=>resolveCentralizedGuardrailsLabels,
36
38
  GUARDRAIL_LIST_EN_MESSAGES: ()=>GUARDRAIL_LIST_EN_MESSAGES,
37
39
  GUARDRAIL_RULES_EN_LABELS: ()=>GUARDRAIL_RULES_EN_LABELS,
40
+ CUSTOM_GUARDRAIL_BUILDER_EN_LABELS: ()=>CUSTOM_GUARDRAIL_BUILDER_EN_LABELS,
38
41
  resolveGuardrailFormLabels: ()=>resolveGuardrailFormLabels,
39
42
  resolveGuardrailRemoveDialogLabels: ()=>resolveGuardrailRemoveDialogLabels,
40
43
  resolveGuardrailActionLabels: ()=>resolveGuardrailActionLabels,
@@ -46,6 +49,7 @@ __webpack_require__.d(__webpack_exports__, {
46
49
  GUARDRAIL_ACTION_LABEL_KEYS: ()=>GUARDRAIL_ACTION_LABEL_KEYS,
47
50
  GUARDRAIL_FILTER_FIELD_SELECTOR_EN_LABELS: ()=>GUARDRAIL_FILTER_FIELD_SELECTOR_EN_LABELS,
48
51
  useGuardrailRulesLabels: ()=>useGuardrailRulesLabels,
52
+ CUSTOM_GUARDRAIL_BUILDER_REUSED_LABEL_KEYS: ()=>CUSTOM_GUARDRAIL_BUILDER_REUSED_LABEL_KEYS,
49
53
  resolveGuardrailRulesLabels: ()=>resolveGuardrailRulesLabels,
50
54
  GUARDRAIL_SCOPE_SELECTOR_LABEL_KEYS: ()=>GUARDRAIL_SCOPE_SELECTOR_LABEL_KEYS,
51
55
  useGuardrailScopeSelectorLabels: ()=>useGuardrailScopeSelectorLabels,
@@ -55,14 +59,15 @@ __webpack_require__.d(__webpack_exports__, {
55
59
  useCentralizedGuardrailsLabels: ()=>useCentralizedGuardrailsLabels,
56
60
  GUARDRAIL_LIST_EN_LABELS: ()=>GUARDRAIL_LIST_EN_LABELS,
57
61
  useGuardrailRemoveDialogLabels: ()=>useGuardrailRemoveDialogLabels,
58
- useGuardrailFormLabels: ()=>useGuardrailFormLabels,
62
+ resolveCustomGuardrailBuilderLabels: ()=>resolveCustomGuardrailBuilderLabels,
59
63
  GUARDRAIL_PALETTE_EN_LABELS: ()=>GUARDRAIL_PALETTE_EN_LABELS,
60
- useGuardrailPaletteLabels: ()=>useGuardrailPaletteLabels,
64
+ useCustomGuardrailBuilderLabels: ()=>useCustomGuardrailBuilderLabels,
61
65
  resolveGuardrailFilterFieldSelectorLabels: ()=>resolveGuardrailFilterFieldSelectorLabels,
62
66
  useGuardrailBuilderLabels: ()=>useGuardrailBuilderLabels,
67
+ useGuardrailFormLabels: ()=>useGuardrailFormLabels,
63
68
  formatGuardrailFormMessage: ()=>formatGuardrailFormMessage,
64
69
  useGuardrailListLabels: ()=>useGuardrailListLabels,
65
- resolveGuardrailPaletteLabels: ()=>resolveGuardrailPaletteLabels
70
+ resolveGuardrailListLabels: ()=>resolveGuardrailListLabels
66
71
  });
67
72
  const external_react_namespaceObject = require("react");
68
73
  const index_cjs_namespaceObject = require("../../../i18n/index.cjs");
@@ -150,6 +155,11 @@ function mergeLabels(defaults, catalog, overrides) {
150
155
  function resolveGuardrailBuilderLabels(catalog, overrides) {
151
156
  return mergeLabels(GUARDRAIL_BUILDER_EN_LABELS, catalog, overrides);
152
157
  }
158
+ function pickGuardrailBuilderLabels(source, keys) {
159
+ const picked = {};
160
+ for (const key of keys)picked[key] = source[key];
161
+ return picked;
162
+ }
153
163
  const GUARDRAIL_ACTION_LABEL_KEYS = [
154
164
  'actionTypeLabel',
155
165
  'actionLogLabel',
@@ -175,12 +185,7 @@ const GUARDRAIL_ACTION_LABEL_KEYS = [
175
185
  'actionAppLabel',
176
186
  'appPickerUnavailable'
177
187
  ];
178
- function pickGuardrailActionLabels(source) {
179
- const picked = {};
180
- for (const key of GUARDRAIL_ACTION_LABEL_KEYS)picked[key] = source[key];
181
- return picked;
182
- }
183
- const GUARDRAIL_ACTION_EN_LABELS = pickGuardrailActionLabels(GUARDRAIL_BUILDER_EN_LABELS);
188
+ const GUARDRAIL_ACTION_EN_LABELS = pickGuardrailBuilderLabels(GUARDRAIL_BUILDER_EN_LABELS, GUARDRAIL_ACTION_LABEL_KEYS);
184
189
  function resolveGuardrailActionLabels(catalog, overrides) {
185
190
  return mergeLabels(GUARDRAIL_ACTION_EN_LABELS, catalog, overrides);
186
191
  }
@@ -198,7 +203,8 @@ const TEMPLATE_TOKENS = {
198
203
  max: '{{max}}',
199
204
  toolName: '{{toolName}}',
200
205
  policyName: '{{policyName}}',
201
- count: '{{count}}'
206
+ count: '{{count}}',
207
+ docsLink: '{{docsLink}}'
202
208
  };
203
209
  function useGuardrailFormLabels(overrides) {
204
210
  const { _ } = (0, index_cjs_namespaceObject.useSafeLingui)();
@@ -479,7 +485,7 @@ function useGuardrailBuilderLabels(overrides) {
479
485
  }
480
486
  function useGuardrailActionLabels(overrides) {
481
487
  const catalog = useGuardrailBuilderLabels();
482
- return (0, external_react_namespaceObject.useMemo)(()=>resolveGuardrailActionLabels(pickGuardrailActionLabels(catalog), overrides), [
488
+ return (0, external_react_namespaceObject.useMemo)(()=>resolveGuardrailActionLabels(pickGuardrailBuilderLabels(catalog, GUARDRAIL_ACTION_LABEL_KEYS), overrides), [
483
489
  catalog,
484
490
  overrides
485
491
  ]);
@@ -1115,11 +1121,6 @@ function useCentralizedGuardrailsLabels(overrides) {
1115
1121
  overrides
1116
1122
  ]);
1117
1123
  }
1118
- function pickGuardrailBuilderLabels(source, keys) {
1119
- const picked = {};
1120
- for (const key of keys)picked[key] = source[key];
1121
- return picked;
1122
- }
1123
1124
  const GUARDRAIL_SCOPE_SELECTOR_LABEL_KEYS = [
1124
1125
  'scopesLabel',
1125
1126
  'toolsLabel',
@@ -1138,8 +1139,104 @@ function useGuardrailScopeSelectorLabels(overrides) {
1138
1139
  overrides
1139
1140
  ]);
1140
1141
  }
1142
+ const CUSTOM_GUARDRAIL_BUILDER_REUSED_LABEL_KEYS = [
1143
+ 'nameLabel',
1144
+ 'namePlaceholder',
1145
+ "descriptionLabel",
1146
+ "descriptionPlaceholder",
1147
+ 'evalsLabel',
1148
+ 'evalsInfoAriaLabel',
1149
+ 'evalsTooltip',
1150
+ 'saveAsNew',
1151
+ 'cancel',
1152
+ 'save',
1153
+ 'mixedScopesAlsoApplied',
1154
+ 'mixedScopesSaveAsNewHint',
1155
+ 'nameRequiredError',
1156
+ 'nameDuplicateError',
1157
+ 'blockReasonRequiredError',
1158
+ 'filterFieldsRequiredError',
1159
+ 'recipientRequiredError',
1160
+ 'actionAppRequiredError'
1161
+ ];
1162
+ function buildCustomGuardrailBuilderLabels(_) {
1163
+ return {
1164
+ addTitle: _({
1165
+ id: 'guardrails.custom-builder.add-title',
1166
+ message: 'Add custom guardrail'
1167
+ }),
1168
+ editTitle: _({
1169
+ id: 'guardrails.custom-builder.edit-title',
1170
+ message: 'Edit custom guardrail'
1171
+ }),
1172
+ helpText: _({
1173
+ id: 'guardrails.custom-builder.help-text',
1174
+ message: 'Guardrail is a collection of rules and action that should happen when all of the rules are met.'
1175
+ }),
1176
+ helpDocs: _({
1177
+ id: 'guardrails.custom-builder.help-docs',
1178
+ message: 'Learn more about Guardrail rules and actions {docsLink}',
1179
+ values: TEMPLATE_TOKENS
1180
+ }),
1181
+ docsLink: _({
1182
+ id: 'guardrails.custom-builder.docs-link',
1183
+ message: 'here'
1184
+ }),
1185
+ rulesRequiredError: _({
1186
+ id: 'guardrails.custom-builder.rules-required-error',
1187
+ message: 'At least one rule is required'
1188
+ }),
1189
+ rulesInvalidError: _({
1190
+ id: 'guardrails.custom-builder.rules-invalid-error',
1191
+ message: 'One or more rules are invalid'
1192
+ }),
1193
+ rulesAlwaysCombinedError: _({
1194
+ id: 'guardrails.custom-builder.rules-always-combined-error',
1195
+ message: "You cannot combine an 'Always enforce guardrail' with any other rule type"
1196
+ }),
1197
+ ruleFieldsRequiredError: _({
1198
+ id: 'guardrails.custom-builder.rule-fields-required-error',
1199
+ message: 'Fields selection is required'
1200
+ }),
1201
+ ruleValueRequiredError: _({
1202
+ id: 'guardrails.custom-builder.rule-value-required-error',
1203
+ message: 'Value is required'
1204
+ })
1205
+ };
1206
+ }
1207
+ const englishCustomGuardrailBuilderTranslate = ({ message, values })=>values ? message.replace(/\{(\w+)\}/g, (match, token)=>values[token] ?? match) : message;
1208
+ const CUSTOM_GUARDRAIL_BUILDER_EN_LABELS = {
1209
+ ...pickGuardrailBuilderLabels(GUARDRAIL_BUILDER_EN_LABELS, CUSTOM_GUARDRAIL_BUILDER_REUSED_LABEL_KEYS),
1210
+ ...buildCustomGuardrailBuilderLabels(englishCustomGuardrailBuilderTranslate)
1211
+ };
1212
+ const CUSTOM_GUARDRAIL_BUILDER_EN_MESSAGES = Object.freeze((()=>{
1213
+ const messages = {};
1214
+ buildCustomGuardrailBuilderLabels((descriptor)=>{
1215
+ messages[descriptor.id] = descriptor.message;
1216
+ return descriptor.message;
1217
+ });
1218
+ return messages;
1219
+ })());
1220
+ function resolveCustomGuardrailBuilderLabels(catalog, overrides) {
1221
+ return mergeLabels(CUSTOM_GUARDRAIL_BUILDER_EN_LABELS, catalog, overrides);
1222
+ }
1223
+ function useCustomGuardrailBuilderLabels(overrides) {
1224
+ const { _ } = (0, index_cjs_namespaceObject.useSafeLingui)();
1225
+ const builder = useGuardrailBuilderLabels();
1226
+ return (0, external_react_namespaceObject.useMemo)(()=>resolveCustomGuardrailBuilderLabels({
1227
+ ...pickGuardrailBuilderLabels(builder, CUSTOM_GUARDRAIL_BUILDER_REUSED_LABEL_KEYS),
1228
+ ...buildCustomGuardrailBuilderLabels(_)
1229
+ }, overrides), [
1230
+ _,
1231
+ builder,
1232
+ overrides
1233
+ ]);
1234
+ }
1141
1235
  exports.CENTRALIZED_GUARDRAILS_EN_LABELS = __webpack_exports__.CENTRALIZED_GUARDRAILS_EN_LABELS;
1142
1236
  exports.CENTRALIZED_GUARDRAILS_EN_MESSAGES = __webpack_exports__.CENTRALIZED_GUARDRAILS_EN_MESSAGES;
1237
+ exports.CUSTOM_GUARDRAIL_BUILDER_EN_LABELS = __webpack_exports__.CUSTOM_GUARDRAIL_BUILDER_EN_LABELS;
1238
+ exports.CUSTOM_GUARDRAIL_BUILDER_EN_MESSAGES = __webpack_exports__.CUSTOM_GUARDRAIL_BUILDER_EN_MESSAGES;
1239
+ exports.CUSTOM_GUARDRAIL_BUILDER_REUSED_LABEL_KEYS = __webpack_exports__.CUSTOM_GUARDRAIL_BUILDER_REUSED_LABEL_KEYS;
1143
1240
  exports.GUARDRAIL_ACTION_EN_LABELS = __webpack_exports__.GUARDRAIL_ACTION_EN_LABELS;
1144
1241
  exports.GUARDRAIL_ACTION_LABEL_KEYS = __webpack_exports__.GUARDRAIL_ACTION_LABEL_KEYS;
1145
1242
  exports.GUARDRAIL_BUILDER_EN_LABELS = __webpack_exports__.GUARDRAIL_BUILDER_EN_LABELS;
@@ -1158,6 +1255,7 @@ exports.GUARDRAIL_SCOPE_SELECTOR_EN_LABELS = __webpack_exports__.GUARDRAIL_SCOPE
1158
1255
  exports.GUARDRAIL_SCOPE_SELECTOR_LABEL_KEYS = __webpack_exports__.GUARDRAIL_SCOPE_SELECTOR_LABEL_KEYS;
1159
1256
  exports.formatGuardrailFormMessage = __webpack_exports__.formatGuardrailFormMessage;
1160
1257
  exports.resolveCentralizedGuardrailsLabels = __webpack_exports__.resolveCentralizedGuardrailsLabels;
1258
+ exports.resolveCustomGuardrailBuilderLabels = __webpack_exports__.resolveCustomGuardrailBuilderLabels;
1161
1259
  exports.resolveGuardrailActionLabels = __webpack_exports__.resolveGuardrailActionLabels;
1162
1260
  exports.resolveGuardrailBuilderLabels = __webpack_exports__.resolveGuardrailBuilderLabels;
1163
1261
  exports.resolveGuardrailFilterFieldSelectorLabels = __webpack_exports__.resolveGuardrailFilterFieldSelectorLabels;
@@ -1168,6 +1266,7 @@ exports.resolveGuardrailRemoveDialogLabels = __webpack_exports__.resolveGuardrai
1168
1266
  exports.resolveGuardrailRulesLabels = __webpack_exports__.resolveGuardrailRulesLabels;
1169
1267
  exports.resolveGuardrailScopeSelectorLabels = __webpack_exports__.resolveGuardrailScopeSelectorLabels;
1170
1268
  exports.useCentralizedGuardrailsLabels = __webpack_exports__.useCentralizedGuardrailsLabels;
1269
+ exports.useCustomGuardrailBuilderLabels = __webpack_exports__.useCustomGuardrailBuilderLabels;
1171
1270
  exports.useGuardrailActionLabels = __webpack_exports__.useGuardrailActionLabels;
1172
1271
  exports.useGuardrailBuilderLabels = __webpack_exports__.useGuardrailBuilderLabels;
1173
1272
  exports.useGuardrailFilterFieldSelectorLabels = __webpack_exports__.useGuardrailFilterFieldSelectorLabels;
@@ -1180,6 +1279,9 @@ exports.useGuardrailScopeSelectorLabels = __webpack_exports__.useGuardrailScopeS
1180
1279
  for(var __rspack_i in __webpack_exports__)if (-1 === [
1181
1280
  "CENTRALIZED_GUARDRAILS_EN_LABELS",
1182
1281
  "CENTRALIZED_GUARDRAILS_EN_MESSAGES",
1282
+ "CUSTOM_GUARDRAIL_BUILDER_EN_LABELS",
1283
+ "CUSTOM_GUARDRAIL_BUILDER_EN_MESSAGES",
1284
+ "CUSTOM_GUARDRAIL_BUILDER_REUSED_LABEL_KEYS",
1183
1285
  "GUARDRAIL_ACTION_EN_LABELS",
1184
1286
  "GUARDRAIL_ACTION_LABEL_KEYS",
1185
1287
  "GUARDRAIL_BUILDER_EN_LABELS",
@@ -1198,6 +1300,7 @@ for(var __rspack_i in __webpack_exports__)if (-1 === [
1198
1300
  "GUARDRAIL_SCOPE_SELECTOR_LABEL_KEYS",
1199
1301
  "formatGuardrailFormMessage",
1200
1302
  "resolveCentralizedGuardrailsLabels",
1303
+ "resolveCustomGuardrailBuilderLabels",
1201
1304
  "resolveGuardrailActionLabels",
1202
1305
  "resolveGuardrailBuilderLabels",
1203
1306
  "resolveGuardrailFilterFieldSelectorLabels",
@@ -1208,6 +1311,7 @@ for(var __rspack_i in __webpack_exports__)if (-1 === [
1208
1311
  "resolveGuardrailRulesLabels",
1209
1312
  "resolveGuardrailScopeSelectorLabels",
1210
1313
  "useCentralizedGuardrailsLabels",
1314
+ "useCustomGuardrailBuilderLabels",
1211
1315
  "useGuardrailActionLabels",
1212
1316
  "useGuardrailBuilderLabels",
1213
1317
  "useGuardrailFilterFieldSelectorLabels",