@bigbinary/neeto-rules-frontend 2.7.26 → 2.7.28

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 (36) hide show
  1. package/dist/.ready +1 -1
  2. package/dist/NeetoRules.js +1 -1
  3. package/dist/NeetoRulesBuilder.js +3 -3
  4. package/dist/NeetoRulesForm.js +3 -3
  5. package/dist/RulePreview.js +1 -1
  6. package/dist/cjs/NeetoRulesBuilder.js +2 -2
  7. package/dist/cjs/NeetoRulesForm.js +2 -2
  8. package/dist/cjs/index.js +2 -2
  9. package/dist/cjs/v2/NeetoRulesBuilder.js +621 -346
  10. package/dist/cjs/v2/NeetoRulesBuilder.js.map +1 -1
  11. package/dist/cjs/v2/NeetoRulesForm.js +2 -2
  12. package/dist/cjs/v2/index.js +2 -2
  13. package/dist/{index-Br0dDuGK.js → index-B4YtTKJ-.js} +4 -4
  14. package/dist/{index-Br0dDuGK.js.map → index-B4YtTKJ-.js.map} +1 -1
  15. package/dist/{index-D76EZ1AZ.js → index-DuotbpzE.js} +3 -3
  16. package/dist/{index-D76EZ1AZ.js.map → index-DuotbpzE.js.map} +1 -1
  17. package/dist/{index-D1PW24Zw.js → index-DvquzIBi.js} +8 -2
  18. package/dist/{index-D1PW24Zw.js.map → index-DvquzIBi.js.map} +1 -1
  19. package/dist/{index-25TjDISc.js → index-Omo1J36W.js} +2 -2
  20. package/dist/{index-25TjDISc.js.map → index-Omo1J36W.js.map} +1 -1
  21. package/dist/index.js +3 -3
  22. package/dist/keyboardShortcuts-CnEwhJom.js +96 -0
  23. package/dist/{keyboardShortcuts-CRInJJOU.js.map → keyboardShortcuts-CnEwhJom.js.map} +1 -1
  24. package/dist/keyboardShortcuts-CsMwT9YF.js +92 -0
  25. package/dist/{keyboardShortcuts-DwgF8Mcu.js.map → keyboardShortcuts-CsMwT9YF.js.map} +1 -1
  26. package/dist/{utils-DeqHhpwQ.js → utils-Cp7CD4kh.js} +2 -2
  27. package/dist/{utils-DeqHhpwQ.js.map → utils-Cp7CD4kh.js.map} +1 -1
  28. package/dist/v2/NeetoRules.js +1 -1
  29. package/dist/v2/NeetoRulesBuilder.js +645 -370
  30. package/dist/v2/NeetoRulesBuilder.js.map +1 -1
  31. package/dist/v2/NeetoRulesForm.js +3 -3
  32. package/dist/v2/RulePreview.js +1 -1
  33. package/dist/v2/index.js +3 -3
  34. package/package.json +7 -7
  35. package/dist/keyboardShortcuts-CRInJJOU.js +0 -96
  36. package/dist/keyboardShortcuts-DwgF8Mcu.js +0 -92
@@ -1,37 +1,38 @@
1
1
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
2
  import _objectDestructuringEmpty from '@babel/runtime/helpers/objectDestructuringEmpty';
3
- import { f as flatten, S as SHORTCUTS } from '../keyboardShortcuts-DwgF8Mcu.js';
3
+ import { f as flatten, S as SHORTCUTS } from '../keyboardShortcuts-CsMwT9YF.js';
4
4
  import { useShallow } from 'zustand/shallow';
5
- import { useState, useRef, useEffect, createElement, Fragment as Fragment$1, useCallback, useMemo, isValidElement } from 'react';
5
+ import { useState, useRef, useEffect, Fragment, createElement, useCallback, useMemo, isValidElement } from 'react';
6
6
  import { Button, Select, Input, Checkbox, Typography, RadioGroup, Textarea, DatePicker, Popover, Tooltip, MultiEmailInput, Spinner } from '@bigbinary/neeto-atoms';
7
7
  import { Input as Input$1, Select as Select$1, ActionBlock } from '@bigbinary/neeto-atoms/formik';
8
8
  import classNames from 'classnames';
9
9
  import { useFormikContext, getIn, useField, Formik, Form as Form$1 } from 'formik';
10
- import { isNotEmpty, toLabelAndValue, removeBy, isNot, noop } from '@bigbinary/neeto-cist';
10
+ import { isNotEmpty, toLabelAndValue, removeBy, findBy, isPresent, isNot, noop } from '@bigbinary/neeto-cist';
11
11
  import Container from '@bigbinary/neeto-molecules/v2/Container';
12
12
  import Header from '@bigbinary/neeto-molecules/v2/Header';
13
13
  import { useTranslation } from 'react-i18next';
14
- import { r as ApiFields, E as EditorAction, L as ListField, o as Panel, s as ErrorCallout, t as SmsFields, M as MIN_DELAY_VALUE, v as MAX_DELAY_VALUE, w as PhoneNumberField, l as formatData, u as usePollRuleName, T as TouchErrors, n as ScrollToErrorField, p as getValidationSchema, q as DEFAULT_INITIAL_VALUE, m as buildPayload } from '../index-Br0dDuGK.js';
14
+ import { r as useHasFieldChanged, s as areValuesEqual, t as useResetSaveAsTemplateOnHide, v as SelectTemplateField, E as EditorAction, w as SaveAsTemplate, x as setEditorContent, y as ApiFields, L as ListField, o as Panel, z as ErrorCallout, B as SmsFields, M as MIN_DELAY_VALUE, C as MAX_DELAY_VALUE, G as PhoneNumberField, l as formatData, u as usePollRuleName, T as TouchErrors, n as ScrollToErrorField, p as getValidationSchema, q as DEFAULT_INITIAL_VALUE, m as buildPayload } from '../index-B4YtTKJ-.js';
15
15
  import { u as useCustomDataStore } from '../useCustomDataStore-CEbhXugO.js';
16
16
  import { u as useUtilityStore } from '../useUtilityStore-BVCulMEC.js';
17
17
  import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
18
18
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
19
19
  import Plus from '@bigbinary/neeto-icons/Plus';
20
- import { isNil, isEmpty, assoc, mergeDeepRight, pluck } from 'ramda';
20
+ import { isNil, isEmpty, assoc, mergeDeepRight, pluck, F } from 'ramda';
21
21
  import Delete from '@bigbinary/neeto-icons/Delete';
22
22
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
23
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
23
+ import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
24
+ import _typeof from '@babel/runtime/helpers/typeof';
24
25
  import { t } from 'i18next';
25
26
  import * as yup from 'yup';
26
27
  import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
27
28
  import useHotkeys from '@bigbinary/neeto-hotkeys';
28
29
  import Search from '@bigbinary/neeto-icons/Search';
29
30
  import { dayjs } from '@bigbinary/neeto-commons-frontend/v2/utils';
30
- import { D as DATE_FORMAT } from '../utils-DeqHhpwQ.js';
31
+ import { D as DATE_FORMAT, b as getDateTimeValue, d as DATE_TIME_FORMAT, e as DATE_TIME_TYPES } from '../utils-Cp7CD4kh.js';
31
32
  import Up from '@bigbinary/neeto-icons/Up';
32
33
  import Down from '@bigbinary/neeto-icons/Down';
33
34
  import Info from '@bigbinary/neeto-icons/Info';
34
- import '@babel/runtime/helpers/typeof';
35
+ import { globalProps } from '@bigbinary/neeto-commons-frontend/v2/initializers';
35
36
  import '../useAutomationRulesApi-C9I3wUZ8.js';
36
37
  import '@tanstack/react-query';
37
38
  import '@bigbinary/neeto-commons-frontend/react-utils';
@@ -47,7 +48,6 @@ import '@babel/runtime/helpers/toArray';
47
48
  import '@bigbinary/neeto-molecules/v2/PhoneNumber';
48
49
  import 'react-select';
49
50
  import '../constants-CYdcft3h.js';
50
- import '@bigbinary/neeto-commons-frontend/v2/initializers';
51
51
  import '@bigbinary/neeto-editor/v2/utils';
52
52
  import 'zustand';
53
53
  import '@bigbinary/neeto-commons-frontend/initializers';
@@ -251,8 +251,8 @@ var useReplayFlash = function useReplayFlash(flashSeq) {
251
251
  };
252
252
 
253
253
  var _excluded$1 = ["children", "state", "active", "invalid", "onClick", "className", "dataTestid"];
254
- function ownKeys$c(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
255
- function _objectSpread$c(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$c(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$c(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
254
+ function ownKeys$e(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
255
+ function _objectSpread$e(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$e(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$e(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
256
256
  var Token = function Token(_ref) {
257
257
  var children = _ref.children,
258
258
  _ref$state = _ref.state,
@@ -267,7 +267,7 @@ var Token = function Token(_ref) {
267
267
  rest = _objectWithoutProperties(_ref, _excluded$1);
268
268
  var isInteractive = typeof onClick === "function" && state !== TOKEN_STATE.DISABLED;
269
269
  var tokenRef = useReplayFlash(invalid);
270
- return /*#__PURE__*/jsx("span", _objectSpread$c(_objectSpread$c({
270
+ return /*#__PURE__*/jsx("span", _objectSpread$e(_objectSpread$e({
271
271
  "data-testid": dataTestid,
272
272
  ref: tokenRef,
273
273
  role: isInteractive ? "button" : undefined,
@@ -289,8 +289,24 @@ var Token = function Token(_ref) {
289
289
  }));
290
290
  };
291
291
 
292
- function ownKeys$b(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
293
- function _objectSpread$b(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$b(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$b(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
292
+ var Values = function Values(_ref) {
293
+ var _ref$values = _ref.values,
294
+ values = _ref$values === void 0 ? [] : _ref$values,
295
+ connector = _ref.connector;
296
+ return values.map(function (value, index) {
297
+ return /*#__PURE__*/jsxs(Fragment, {
298
+ children: [index > 0 && " ", index > 0 && connector && /*#__PURE__*/jsxs(Fragment$1, {
299
+ children: [/*#__PURE__*/jsx("span", {
300
+ className: "mb-tok-join",
301
+ children: connector
302
+ }), " "]
303
+ }), value]
304
+ }, "".concat(value, "-").concat(index));
305
+ });
306
+ };
307
+
308
+ function ownKeys$d(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
309
+ function _objectSpread$d(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$d(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$d(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
294
310
  var humanize = function humanize(value) {
295
311
  return String(value !== null && value !== void 0 ? value : "").replace(/[._]/g, " ").trim();
296
312
  };
@@ -381,7 +397,32 @@ var conditionNeedsValue = function conditionNeedsValue(_ref7) {
381
397
  });
382
398
  return !((field === null || field === void 0 ? void 0 : field.noValueForVerbs) || []).includes(condition === null || condition === void 0 ? void 0 : condition.verb);
383
399
  };
384
- var conditionValueLabel = function conditionValueLabel(_ref8) {
400
+
401
+ // A multi-value token stays one clickable phrase, but its "and"/"or" is
402
+ // connective tissue rather than part of any value, so the canvas keeps the
403
+ // connector out of the token's own styling.
404
+ var valueParts = function valueParts(raw) {
405
+ if (isNil(raw) || raw === "") return null;
406
+ if (Array.isArray(raw)) {
407
+ return isEmpty(raw) ? null : {
408
+ values: raw.map(String)
409
+ };
410
+ }
411
+ if (_typeof(raw) === "object") {
412
+ var values = Array.isArray(raw.values) ? raw.values.map(String) : [];
413
+ return isEmpty(values) ? null : {
414
+ values: values,
415
+ connector: raw.connector
416
+ };
417
+ }
418
+ return {
419
+ values: [String(raw)]
420
+ };
421
+ };
422
+ var joinValues = function joinValues(parts) {
423
+ return (parts === null || parts === void 0 ? void 0 : parts.values.join(parts.connector ? " ".concat(parts.connector, " ") : " ")) || "";
424
+ };
425
+ var conditionValueParts = function conditionValueParts(_ref8) {
385
426
  var _ref9, _meta$value;
386
427
  var schema = _ref8.schema,
387
428
  condition = _ref8.condition;
@@ -401,23 +442,28 @@ var conditionValueLabel = function conditionValueLabel(_ref8) {
401
442
  return ((_candidate$value = candidate.value) !== null && _candidate$value !== void 0 ? _candidate$value : candidate.id) === value;
402
443
  });
403
444
  var label = option ? (_ref0 = (_option$label = option.label) !== null && _option$label !== void 0 ? _option$label : option.value) !== null && _ref0 !== void 0 ? _ref0 : option.id : value;
404
- return isEnum ? String(label).toLowerCase() : label;
445
+ return isEnum ? String(label).toLowerCase() : String(label);
405
446
  };
406
447
  var connector = String((condition === null || condition === void 0 ? void 0 : condition.verb) || "").includes(CONDITION_VERBS.ALL_OF) ? t("neetoRules.operators.and") : t("neetoRules.operators.or");
407
- return Array.isArray(raw) ? raw.map(labelFor).join(" ".concat(connector, " ")) : String(labelFor(raw));
448
+ return Array.isArray(raw) ? {
449
+ values: raw.map(labelFor),
450
+ connector: connector
451
+ } : {
452
+ values: [labelFor(raw)]
453
+ };
408
454
  };
409
- var actionOption = function actionOption(_ref1) {
455
+ var actionOption = function actionOption(_ref10) {
410
456
  var _schema$actions;
411
- var schema = _ref1.schema,
412
- name = _ref1.name;
457
+ var schema = _ref10.schema,
458
+ name = _ref10.name;
413
459
  return ((schema === null || schema === void 0 || (_schema$actions = schema.actions) === null || _schema$actions === void 0 ? void 0 : _schema$actions.options) || []).find(function (option) {
414
460
  return option.value === name || option.id === name;
415
461
  });
416
462
  };
417
- var channelOption = function channelOption(_ref10) {
463
+ var channelOption = function channelOption(_ref11) {
418
464
  var _schema$actions2;
419
- var schema = _ref10.schema,
420
- channel = _ref10.channel;
465
+ var schema = _ref11.schema,
466
+ channel = _ref11.channel;
421
467
  return ((schema === null || schema === void 0 || (_schema$actions2 = schema.actions) === null || _schema$actions2 === void 0 ? void 0 : _schema$actions2.options) || []).find(function (option) {
422
468
  var _option$value;
423
469
  return ((_option$value = option.value) !== null && _option$value !== void 0 ? _option$value : option.id) === channel;
@@ -429,24 +475,24 @@ var channelOption = function channelOption(_ref10) {
429
475
  // Its key shares the action's metadata namespace, so declaring one is how a
430
476
  // host hands a field to the step: whoever declares it owns it, and the config
431
477
  // pane stops validating it.
432
- var actionStepsOf = function actionStepsOf(_ref11) {
433
- var schema = _ref11.schema,
434
- action = _ref11.action;
478
+ var actionStepsOf = function actionStepsOf(_ref12) {
479
+ var schema = _ref12.schema,
480
+ action = _ref12.action;
435
481
  return actionParts({
436
482
  schema: schema,
437
483
  action: action
438
484
  }).steps || [];
439
485
  };
440
- var stepValueOf = function stepValueOf(_ref12) {
486
+ var stepValueOf = function stepValueOf(_ref13) {
441
487
  var _action$metadata;
442
- var action = _ref12.action,
443
- step = _ref12.step;
488
+ var action = _ref13.action,
489
+ step = _ref13.step;
444
490
  return action === null || action === void 0 || (_action$metadata = action.metadata) === null || _action$metadata === void 0 ? void 0 : _action$metadata[step.key];
445
491
  };
446
- var stepLabelOf = function stepLabelOf(_ref13) {
492
+ var stepLabelOf = function stepLabelOf(_ref14) {
447
493
  var _find;
448
- var action = _ref13.action,
449
- step = _ref13.step;
494
+ var action = _ref14.action,
495
+ step = _ref14.step;
450
496
  var value = stepValueOf({
451
497
  action: action,
452
498
  step: step
@@ -456,10 +502,10 @@ var stepLabelOf = function stepLabelOf(_ref13) {
456
502
  return ((_option$value2 = option.value) !== null && _option$value2 !== void 0 ? _option$value2 : option.id) === value;
457
503
  })) === null || _find === void 0 ? void 0 : _find.label) || "";
458
504
  };
459
- var actionParts = function actionParts(_ref14) {
460
- var _actions$actionForNam, _action$recipient, _actions$channelMeta, _find2, _find3, _channelMeta$needsRec, _actions$configValueL;
461
- var schema = _ref14.schema,
462
- action = _ref14.action;
505
+ var actionParts = function actionParts(_ref15) {
506
+ var _actions$actionForNam, _action$recipient, _actions$channelMeta, _find2, _find3, _actions$configValueL, _channelMeta$needsRec;
507
+ var schema = _ref15.schema,
508
+ action = _ref15.action;
463
509
  var actions = (schema === null || schema === void 0 ? void 0 : schema.actions) || {};
464
510
  var resolved = action !== null && action !== void 0 && action.channel ? {
465
511
  channel: action.channel,
@@ -482,6 +528,10 @@ var actionParts = function actionParts(_ref14) {
482
528
  return ((_recipient$value = recipient.value) !== null && _recipient$value !== void 0 ? _recipient$value : recipient.id) === recipientValue;
483
529
  };
484
530
  var recipientLabel = ((_find2 = (actions.recipients || []).find(matchesRecipient)) === null || _find2 === void 0 ? void 0 : _find2.label) || ((_find3 = ((option === null || option === void 0 ? void 0 : option.recipients) || []).find(matchesRecipient)) === null || _find3 === void 0 ? void 0 : _find3.label) || recipientValue;
531
+
532
+ // A host may answer with a plain string or with { values, connector } when
533
+ // the value reads as a list.
534
+ var configValueParts = valueParts((_actions$configValueL = actions.configValueLabel) === null || _actions$configValueL === void 0 ? void 0 : _actions$configValueL.call(actions, action));
485
535
  return {
486
536
  option: option,
487
537
  channel: channel,
@@ -494,7 +544,8 @@ var actionParts = function actionParts(_ref14) {
494
544
  icon: channelMeta.icon || (option === null || option === void 0 ? void 0 : option.icon),
495
545
  needsRecipient: (_channelMeta$needsRec = channelMeta.needsRecipient) !== null && _channelMeta$needsRec !== void 0 ? _channelMeta$needsRec : option === null || option === void 0 ? void 0 : option.needsRecipient,
496
546
  separator: channelMeta.separator || (option === null || option === void 0 ? void 0 : option.separator),
497
- configValue: ((_actions$configValueL = actions.configValueLabel) === null || _actions$configValueL === void 0 ? void 0 : _actions$configValueL.call(actions, action)) || "",
547
+ configValueParts: configValueParts,
548
+ configValue: joinValues(configValueParts),
498
549
  configValuePlaceholder: channelMeta.valuePlaceholder || (option === null || option === void 0 ? void 0 : option.valuePlaceholder),
499
550
  recipient: recipientValue,
500
551
  recipientLabel: recipientLabel,
@@ -509,13 +560,13 @@ var actionParts = function actionParts(_ref14) {
509
560
  // Which condition fields a host offers can depend on the rule — a trigger may
510
561
  // only support a subset. Lookups deliberately keep using the full list so a
511
562
  // field already on the rule still resolves after the offer narrows.
512
- var offeredConditionFields = function offeredConditionFields(_ref15) {
513
- var _ref16, _schema$conditions$fi, _schema$conditions3, _schema$conditions3$f, _schema$conditions4;
514
- var schema = _ref15.schema,
515
- rule = _ref15.rule;
516
- return (_ref16 = (_schema$conditions$fi = schema === null || schema === void 0 || (_schema$conditions3 = schema.conditions) === null || _schema$conditions3 === void 0 || (_schema$conditions3$f = _schema$conditions3.fieldsFor) === null || _schema$conditions3$f === void 0 ? void 0 : _schema$conditions3$f.call(_schema$conditions3, {
563
+ var offeredConditionFields = function offeredConditionFields(_ref16) {
564
+ var _ref17, _schema$conditions$fi, _schema$conditions3, _schema$conditions3$f, _schema$conditions4;
565
+ var schema = _ref16.schema,
566
+ rule = _ref16.rule;
567
+ return (_ref17 = (_schema$conditions$fi = schema === null || schema === void 0 || (_schema$conditions3 = schema.conditions) === null || _schema$conditions3 === void 0 || (_schema$conditions3$f = _schema$conditions3.fieldsFor) === null || _schema$conditions3$f === void 0 ? void 0 : _schema$conditions3$f.call(_schema$conditions3, {
517
568
  rule: rule
518
- })) !== null && _schema$conditions$fi !== void 0 ? _schema$conditions$fi : schema === null || schema === void 0 || (_schema$conditions4 = schema.conditions) === null || _schema$conditions4 === void 0 ? void 0 : _schema$conditions4.fields) !== null && _ref16 !== void 0 ? _ref16 : [];
569
+ })) !== null && _schema$conditions$fi !== void 0 ? _schema$conditions$fi : schema === null || schema === void 0 || (_schema$conditions4 = schema.conditions) === null || _schema$conditions4 === void 0 ? void 0 : _schema$conditions4.fields) !== null && _ref17 !== void 0 ? _ref17 : [];
519
570
  };
520
571
  var hasTrigger = function hasTrigger(rule) {
521
572
  return !isEmpty((rule === null || rule === void 0 ? void 0 : rule.triggers) || []);
@@ -529,20 +580,20 @@ var isTriggerEnabled = function isTriggerEnabled(schema) {
529
580
  var _schema$triggers2;
530
581
  return (schema === null || schema === void 0 || (_schema$triggers2 = schema.triggers) === null || _schema$triggers2 === void 0 ? void 0 : _schema$triggers2.enabled) !== false;
531
582
  };
532
- var isTriggerSatisfied = function isTriggerSatisfied(_ref17) {
533
- var rule = _ref17.rule,
534
- schema = _ref17.schema;
535
- return !isTriggerEnabled(schema) || hasTrigger(rule);
536
- };
537
- var hasRequiredConditions = function hasRequiredConditions(_ref18) {
538
- var _schema$conditions5;
583
+ var isTriggerSatisfied = function isTriggerSatisfied(_ref18) {
539
584
  var rule = _ref18.rule,
540
585
  schema = _ref18.schema;
541
- return (schema === null || schema === void 0 || (_schema$conditions5 = schema.conditions) === null || _schema$conditions5 === void 0 ? void 0 : _schema$conditions5.allowEmpty) === false ? isNotEmpty((rule === null || rule === void 0 ? void 0 : rule.conditions) || []) : true;
586
+ return !isTriggerEnabled(schema) || hasTrigger(rule);
542
587
  };
543
- var hasUnansweredStep = function hasUnansweredStep(_ref19) {
588
+ var hasRequiredConditions = function hasRequiredConditions(_ref19) {
589
+ var _schema$conditions5;
544
590
  var rule = _ref19.rule,
545
591
  schema = _ref19.schema;
592
+ return (schema === null || schema === void 0 || (_schema$conditions5 = schema.conditions) === null || _schema$conditions5 === void 0 ? void 0 : _schema$conditions5.allowEmpty) === false ? isNotEmpty((rule === null || rule === void 0 ? void 0 : rule.conditions) || []) : true;
593
+ };
594
+ var hasUnansweredStep = function hasUnansweredStep(_ref20) {
595
+ var rule = _ref20.rule,
596
+ schema = _ref20.schema;
546
597
  return ((rule === null || rule === void 0 ? void 0 : rule.actions) || []).some(function (action) {
547
598
  return actionStepsOf({
548
599
  schema: schema,
@@ -555,9 +606,9 @@ var hasUnansweredStep = function hasUnansweredStep(_ref19) {
555
606
  });
556
607
  });
557
608
  };
558
- var isRuleComplete = function isRuleComplete(_ref20) {
559
- var rule = _ref20.rule,
560
- schema = _ref20.schema;
609
+ var isRuleComplete = function isRuleComplete(_ref21) {
610
+ var rule = _ref21.rule,
611
+ schema = _ref21.schema;
561
612
  return isTriggerSatisfied({
562
613
  rule: rule,
563
614
  schema: schema
@@ -569,28 +620,28 @@ var isRuleComplete = function isRuleComplete(_ref20) {
569
620
  schema: schema
570
621
  });
571
622
  };
572
- var scopeOptionFor = function scopeOptionFor(_ref21) {
623
+ var scopeOptionFor = function scopeOptionFor(_ref22) {
573
624
  var _item$value, _schema$scope;
574
- var schema = _ref21.schema,
575
- item = _ref21.item;
625
+ var schema = _ref22.schema,
626
+ item = _ref22.item;
576
627
  var value = (_item$value = item === null || item === void 0 ? void 0 : item.value) !== null && _item$value !== void 0 ? _item$value : item;
577
628
  return ((schema === null || schema === void 0 || (_schema$scope = schema.scope) === null || _schema$scope === void 0 ? void 0 : _schema$scope.options) || []).find(function (candidate) {
578
629
  var _candidate$value2;
579
630
  return ((_candidate$value2 = candidate.value) !== null && _candidate$value2 !== void 0 ? _candidate$value2 : candidate.id) === value;
580
631
  });
581
632
  };
582
- var scopePhoneFields = function scopePhoneFields(_ref22) {
583
- var _ref23, _item$phoneFields, _scopeOptionFor;
584
- var schema = _ref22.schema,
585
- item = _ref22.item;
586
- return (_ref23 = (_item$phoneFields = item === null || item === void 0 ? void 0 : item.phoneFields) !== null && _item$phoneFields !== void 0 ? _item$phoneFields : (_scopeOptionFor = scopeOptionFor({
633
+ var scopePhoneFields = function scopePhoneFields(_ref23) {
634
+ var _ref24, _item$phoneFields, _scopeOptionFor;
635
+ var schema = _ref23.schema,
636
+ item = _ref23.item;
637
+ return (_ref24 = (_item$phoneFields = item === null || item === void 0 ? void 0 : item.phoneFields) !== null && _item$phoneFields !== void 0 ? _item$phoneFields : (_scopeOptionFor = scopeOptionFor({
587
638
  schema: schema,
588
639
  item: item
589
- })) === null || _scopeOptionFor === void 0 ? void 0 : _scopeOptionFor.phoneFields) !== null && _ref23 !== void 0 ? _ref23 : null;
640
+ })) === null || _scopeOptionFor === void 0 ? void 0 : _scopeOptionFor.phoneFields) !== null && _ref24 !== void 0 ? _ref24 : null;
590
641
  };
591
- var effectiveScopePhoneField = function effectiveScopePhoneField(_ref24) {
592
- var schema = _ref24.schema,
593
- item = _ref24.item;
642
+ var effectiveScopePhoneField = function effectiveScopePhoneField(_ref25) {
643
+ var schema = _ref25.schema,
644
+ item = _ref25.item;
594
645
  if (item !== null && item !== void 0 && item.phoneField) return item.phoneField;
595
646
  var phoneFields = scopePhoneFields({
596
647
  schema: schema,
@@ -598,14 +649,14 @@ var effectiveScopePhoneField = function effectiveScopePhoneField(_ref24) {
598
649
  });
599
650
  return (phoneFields === null || phoneFields === void 0 ? void 0 : phoneFields.length) === 1 ? phoneFields[0].value : undefined;
600
651
  };
601
- var invalidScopeIndexes = function invalidScopeIndexes(_ref25) {
652
+ var invalidScopeIndexes = function invalidScopeIndexes(_ref26) {
602
653
  var _scope$requiresPhone;
603
- var rule = _ref25.rule,
604
- schema = _ref25.schema;
654
+ var rule = _ref26.rule,
655
+ schema = _ref26.schema;
605
656
  var scope = schema === null || schema === void 0 ? void 0 : schema.scope;
606
657
  if (!(scope !== null && scope !== void 0 && scope.enabled) || !((_scope$requiresPhone = scope.requiresPhone) !== null && _scope$requiresPhone !== void 0 && _scope$requiresPhone.call(scope, (rule === null || rule === void 0 ? void 0 : rule.actions) || []))) return [];
607
658
  return ((rule === null || rule === void 0 ? void 0 : rule.scope) || []).reduce(function (indexes, item, index) {
608
- var _ref26, _item$hasPhoneField;
659
+ var _ref27, _item$hasPhoneField;
609
660
  var option = scopeOptionFor({
610
661
  schema: schema,
611
662
  item: item
@@ -614,15 +665,15 @@ var invalidScopeIndexes = function invalidScopeIndexes(_ref25) {
614
665
  schema: schema,
615
666
  item: item
616
667
  });
617
- var hasPhoneField = (_ref26 = (_item$hasPhoneField = item === null || item === void 0 ? void 0 : item.hasPhoneField) !== null && _item$hasPhoneField !== void 0 ? _item$hasPhoneField : option === null || option === void 0 ? void 0 : option.hasPhoneField) !== null && _ref26 !== void 0 ? _ref26 : phoneFields ? phoneFields.length > 0 : undefined;
668
+ var hasPhoneField = (_ref27 = (_item$hasPhoneField = item === null || item === void 0 ? void 0 : item.hasPhoneField) !== null && _item$hasPhoneField !== void 0 ? _item$hasPhoneField : option === null || option === void 0 ? void 0 : option.hasPhoneField) !== null && _ref27 !== void 0 ? _ref27 : phoneFields ? phoneFields.length > 0 : undefined;
618
669
  if (hasPhoneField === false) indexes.push(index);
619
670
  return indexes;
620
671
  }, []);
621
672
  };
622
- var invalidScopePhoneFieldIndexes = function invalidScopePhoneFieldIndexes(_ref27) {
673
+ var invalidScopePhoneFieldIndexes = function invalidScopePhoneFieldIndexes(_ref28) {
623
674
  var _scope$requiresPhone2;
624
- var rule = _ref27.rule,
625
- schema = _ref27.schema;
675
+ var rule = _ref28.rule,
676
+ schema = _ref28.schema;
626
677
  var scope = schema === null || schema === void 0 ? void 0 : schema.scope;
627
678
  if (!(scope !== null && scope !== void 0 && scope.enabled) || !((_scope$requiresPhone2 = scope.requiresPhone) !== null && _scope$requiresPhone2 !== void 0 && _scope$requiresPhone2.call(scope, (rule === null || rule === void 0 ? void 0 : rule.actions) || []))) return [];
628
679
  return ((rule === null || rule === void 0 ? void 0 : rule.scope) || []).reduce(function (indexes, item, index) {
@@ -659,9 +710,9 @@ var minutesToParts = function minutesToParts(minutes) {
659
710
  unit: "minutes"
660
711
  };
661
712
  };
662
- var partsToMinutes = function partsToMinutes(_ref28) {
663
- var value = _ref28.value,
664
- unit = _ref28.unit;
713
+ var partsToMinutes = function partsToMinutes(_ref29) {
714
+ var value = _ref29.value,
715
+ unit = _ref29.unit;
665
716
  return (
666
717
  // eslint-disable-next-line security/detect-object-injection
667
718
  (Number(value) || 0) * (UNIT_MINUTES[unit] || 1)
@@ -701,7 +752,7 @@ var normalizeTriggers = function normalizeTriggers(triggers) {
701
752
  };
702
753
  var normalizeSchema = function normalizeSchema() {
703
754
  var rawSchema = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
704
- return mergeDeepRight(DEFAULT_SCHEMA, _objectSpread$b(_objectSpread$b({}, rawSchema), {}, {
755
+ return mergeDeepRight(DEFAULT_SCHEMA, _objectSpread$d(_objectSpread$d({}, rawSchema), {}, {
705
756
  triggers: normalizeTriggers(rawSchema.triggers)
706
757
  }));
707
758
  };
@@ -715,11 +766,11 @@ var recipientStorageField = function recipientStorageField(field) {
715
766
  // Which metadata fields the recipient pane renders, and therefore owns: no
716
767
  // other pane may block Continue on them. Canvas and ConfigPane both ask here
717
768
  // so the two lists cannot drift apart.
718
- var recipientOwnedFields = function recipientOwnedFields(_ref29) {
769
+ var recipientOwnedFields = function recipientOwnedFields(_ref30) {
719
770
  var _actions$actionForNam2, _action$recipient2, _actions$renderRecipi, _actions$renderRecipi2, _actions$optionForNam, _actions$optionForCha;
720
- var schema = _ref29.schema,
721
- action = _ref29.action,
722
- name = _ref29.name;
771
+ var schema = _ref30.schema,
772
+ action = _ref30.action,
773
+ name = _ref30.name;
723
774
  var actions = (schema === null || schema === void 0 ? void 0 : schema.actions) || {};
724
775
  var resolved = ((_actions$actionForNam2 = actions.actionForName) === null || _actions$actionForNam2 === void 0 ? void 0 : _actions$actionForNam2.call(actions, action === null || action === void 0 ? void 0 : action.name)) || {};
725
776
  var channel = (action === null || action === void 0 ? void 0 : action.channel) || resolved.channel;
@@ -750,10 +801,10 @@ var modeFromJoinType = function modeFromJoinType(joinType) {
750
801
  };
751
802
 
752
803
  // eslint-disable-next-line security/detect-object-injection
753
- var valueAt = function valueAt(_ref30) {
804
+ var valueAt = function valueAt(_ref31) {
754
805
  var _values$key;
755
- var values = _ref30.values,
756
- key = _ref30.key;
806
+ var values = _ref31.values,
807
+ key = _ref31.key;
757
808
  return values === null || values === void 0 || (_values$key = values[key]) === null || _values$key === void 0 ? void 0 : _values$key.value;
758
809
  };
759
810
  var asArray = function asArray(maybeArray) {
@@ -776,11 +827,11 @@ var fieldKeysFromSchema = function fieldKeysFromSchema() {
776
827
  };
777
828
  var valuesToRuleModel = function valuesToRuleModel() {
778
829
  var _valueAt, _conditions$;
779
- var _ref31 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
780
- _ref31$values = _ref31.values,
781
- values = _ref31$values === void 0 ? {} : _ref31$values,
782
- _ref31$schema = _ref31.schema,
783
- schema = _ref31$schema === void 0 ? {} : _ref31$schema;
830
+ var _ref32 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
831
+ _ref32$values = _ref32.values,
832
+ values = _ref32$values === void 0 ? {} : _ref32$values,
833
+ _ref32$schema = _ref32.schema,
834
+ schema = _ref32$schema === void 0 ? {} : _ref32$schema;
784
835
  var keys = fieldKeysFromSchema(schema);
785
836
  var conditions = asArray(valueAt({
786
837
  values: values,
@@ -824,42 +875,77 @@ var valuesToRuleModel = function valuesToRuleModel() {
824
875
  }))
825
876
  };
826
877
  };
827
- var setTriggers = function setTriggers(_ref32) {
828
- var schema = _ref32.schema,
829
- triggers = _ref32.triggers;
878
+ var setTriggers = function setTriggers(_ref33) {
879
+ var schema = _ref33.schema,
880
+ triggers = _ref33.triggers;
830
881
  return {
831
882
  path: "".concat(fieldKeysFromSchema(schema).triggers, ".value"),
832
883
  value: triggers
833
884
  };
834
885
  };
835
- var setPerformer = function setPerformer(_ref33) {
836
- var schema = _ref33.schema,
837
- performer = _ref33.performer;
886
+
887
+ // Removed saved triggers must be sent with _destroy, or the backend keeps them.
888
+ var replaceTriggers = function replaceTriggers(_ref34) {
889
+ var schema = _ref34.schema,
890
+ values = _ref34.values,
891
+ triggers = _ref34.triggers;
892
+ var fieldKey = fieldKeysFromSchema(schema).triggers;
893
+ var keptIds = triggers.map(function (trigger) {
894
+ return trigger === null || trigger === void 0 ? void 0 : trigger.id;
895
+ }).filter(Boolean);
896
+ var removed = asArray(valueAt({
897
+ values: values,
898
+ key: fieldKey
899
+ })).filter(function (trigger) {
900
+ return (trigger === null || trigger === void 0 ? void 0 : trigger.id) && !keptIds.includes(trigger.id);
901
+ }).map(function (trigger) {
902
+ return _objectSpread$d(_objectSpread$d({}, trigger), {}, {
903
+ _destroy: true
904
+ });
905
+ });
906
+ var edits = [setTriggers({
907
+ schema: schema,
908
+ triggers: triggers
909
+ })];
910
+ if (removed.length) {
911
+ var _values$fieldKey;
912
+ // eslint-disable-next-line security/detect-object-injection
913
+ var deleted = asArray(values === null || values === void 0 || (_values$fieldKey = values[fieldKey]) === null || _values$fieldKey === void 0 ? void 0 : _values$fieldKey.deleted);
914
+ edits.push({
915
+ path: "".concat(fieldKey, ".deleted"),
916
+ value: [].concat(_toConsumableArray(deleted), _toConsumableArray(removed))
917
+ });
918
+ }
919
+ return edits;
920
+ };
921
+ var setPerformer = function setPerformer(_ref35) {
922
+ var schema = _ref35.schema,
923
+ performer = _ref35.performer;
838
924
  return {
839
925
  path: "".concat(fieldKeysFromSchema(schema).performer, ".value"),
840
926
  value: performer
841
927
  };
842
928
  };
843
- var setActions = function setActions(_ref34) {
844
- var schema = _ref34.schema,
845
- actions = _ref34.actions;
929
+ var setActions = function setActions(_ref36) {
930
+ var schema = _ref36.schema,
931
+ actions = _ref36.actions;
846
932
  return {
847
933
  path: "".concat(fieldKeysFromSchema(schema).actions, ".value"),
848
934
  value: actions
849
935
  };
850
936
  };
851
- var setConditions = function setConditions(_ref35) {
852
- var schema = _ref35.schema,
853
- conditions = _ref35.conditions;
937
+ var setConditions = function setConditions(_ref37) {
938
+ var schema = _ref37.schema,
939
+ conditions = _ref37.conditions;
854
940
  return {
855
941
  path: "".concat(fieldKeysFromSchema(schema).conditions, ".value"),
856
942
  value: conditions
857
943
  };
858
944
  };
859
- var setConditionMode = function setConditionMode(_ref36) {
860
- var schema = _ref36.schema,
861
- conditions = _ref36.conditions,
862
- joinType = _ref36.joinType;
945
+ var setConditionMode = function setConditionMode(_ref38) {
946
+ var schema = _ref38.schema,
947
+ conditions = _ref38.conditions,
948
+ joinType = _ref38.joinType;
863
949
  return setConditions({
864
950
  schema: schema,
865
951
  conditions: conditions.map(function (condition) {
@@ -867,34 +953,34 @@ var setConditionMode = function setConditionMode(_ref36) {
867
953
  })
868
954
  });
869
955
  };
870
- var setDelay = function setDelay(_ref37) {
871
- var schema = _ref37.schema,
872
- delay = _ref37.delay;
956
+ var setDelay = function setDelay(_ref39) {
957
+ var schema = _ref39.schema,
958
+ delay = _ref39.delay;
873
959
  return {
874
960
  path: "".concat(fieldKeysFromSchema(schema).delay, ".value"),
875
961
  value: delay !== null && delay !== void 0 ? delay : {}
876
962
  };
877
963
  };
878
- var setActive = function setActive(_ref38) {
879
- var schema = _ref38.schema,
880
- active = _ref38.active;
964
+ var setActive = function setActive(_ref40) {
965
+ var schema = _ref40.schema,
966
+ active = _ref40.active;
881
967
  return {
882
968
  path: "".concat(fieldKeysFromSchema(schema).status, ".value"),
883
969
  value: active ? STATUS_KEYS.ENABLED : STATUS_KEYS.DISABLED
884
970
  };
885
971
  };
886
- var setScope = function setScope(_ref39) {
887
- var schema = _ref39.schema,
888
- scope = _ref39.scope;
972
+ var setScope = function setScope(_ref41) {
973
+ var schema = _ref41.schema,
974
+ scope = _ref41.scope;
889
975
  return {
890
976
  path: "".concat(fieldKeysFromSchema(schema).scope, ".value"),
891
977
  value: scope
892
978
  };
893
979
  };
894
- var removeArrayItem = function removeArrayItem(_ref40) {
895
- var values = _ref40.values,
896
- fieldKey = _ref40.fieldKey,
897
- index = _ref40.index;
980
+ var removeArrayItem = function removeArrayItem(_ref42) {
981
+ var values = _ref42.values,
982
+ fieldKey = _ref42.fieldKey,
983
+ index = _ref42.index;
898
984
  var list = asArray(valueAt({
899
985
  values: values,
900
986
  key: fieldKey
@@ -909,21 +995,21 @@ var removeArrayItem = function removeArrayItem(_ref40) {
909
995
  value: nextList
910
996
  }];
911
997
  if (removed !== null && removed !== void 0 && removed.id) {
912
- var _values$fieldKey;
998
+ var _values$fieldKey2;
913
999
  // eslint-disable-next-line security/detect-object-injection
914
- var deleted = asArray(values === null || values === void 0 || (_values$fieldKey = values[fieldKey]) === null || _values$fieldKey === void 0 ? void 0 : _values$fieldKey.deleted);
1000
+ var deleted = asArray(values === null || values === void 0 || (_values$fieldKey2 = values[fieldKey]) === null || _values$fieldKey2 === void 0 ? void 0 : _values$fieldKey2.deleted);
915
1001
  result.push({
916
1002
  path: "".concat(fieldKey, ".deleted"),
917
- value: [].concat(_toConsumableArray(deleted), [_objectSpread$b(_objectSpread$b({}, removed), {}, {
1003
+ value: [].concat(_toConsumableArray(deleted), [_objectSpread$d(_objectSpread$d({}, removed), {}, {
918
1004
  _destroy: true
919
1005
  })])
920
1006
  });
921
1007
  }
922
1008
  return result;
923
1009
  };
924
- var clearArrayItems = function clearArrayItems(_ref41) {
925
- var values = _ref41.values,
926
- fieldKey = _ref41.fieldKey;
1010
+ var clearArrayItems = function clearArrayItems(_ref43) {
1011
+ var values = _ref43.values,
1012
+ fieldKey = _ref43.fieldKey;
927
1013
  var list = asArray(valueAt({
928
1014
  values: values,
929
1015
  key: fieldKey
@@ -931,7 +1017,7 @@ var clearArrayItems = function clearArrayItems(_ref41) {
931
1017
  var removed = list.filter(function (item) {
932
1018
  return item === null || item === void 0 ? void 0 : item.id;
933
1019
  }).map(function (item) {
934
- return _objectSpread$b(_objectSpread$b({}, item), {}, {
1020
+ return _objectSpread$d(_objectSpread$d({}, item), {}, {
935
1021
  _destroy: true
936
1022
  });
937
1023
  });
@@ -940,9 +1026,9 @@ var clearArrayItems = function clearArrayItems(_ref41) {
940
1026
  value: []
941
1027
  }];
942
1028
  if (removed.length) {
943
- var _values$fieldKey2;
1029
+ var _values$fieldKey3;
944
1030
  // eslint-disable-next-line security/detect-object-injection
945
- var deleted = asArray(values === null || values === void 0 || (_values$fieldKey2 = values[fieldKey]) === null || _values$fieldKey2 === void 0 ? void 0 : _values$fieldKey2.deleted);
1031
+ var deleted = asArray(values === null || values === void 0 || (_values$fieldKey3 = values[fieldKey]) === null || _values$fieldKey3 === void 0 ? void 0 : _values$fieldKey3.deleted);
946
1032
  result.push({
947
1033
  path: "".concat(fieldKey, ".deleted"),
948
1034
  value: [].concat(_toConsumableArray(deleted), _toConsumableArray(removed))
@@ -951,8 +1037,8 @@ var clearArrayItems = function clearArrayItems(_ref41) {
951
1037
  return result;
952
1038
  };
953
1039
 
954
- function ownKeys$a(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
955
- function _objectSpread$a(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$a(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$a(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1040
+ function ownKeys$c(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
1041
+ function _objectSpread$c(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$c(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$c(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
956
1042
  var ConditionRow = function ConditionRow(_ref) {
957
1043
  var _schema$conditions;
958
1044
  var rule = _ref.rule,
@@ -980,7 +1066,7 @@ var ConditionRow = function ConditionRow(_ref) {
980
1066
  return ((_field$value = field.value) !== null && _field$value !== void 0 ? _field$value : field.id) === (condition === null || condition === void 0 ? void 0 : condition.field);
981
1067
  });
982
1068
  var operatorPlaceholder = (conditionField === null || conditionField === void 0 ? void 0 : conditionField.operatorPlaceholder) || t("neetoRules.builder.selectOperator");
983
- var value = conditionValueLabel({
1069
+ var value = conditionValueParts({
984
1070
  schema: schema,
985
1071
  condition: condition
986
1072
  });
@@ -1014,7 +1100,7 @@ var ConditionRow = function ConditionRow(_ref) {
1014
1100
  });
1015
1101
  },
1016
1102
  children: rule.conditionMode === CONDITION_MODE.OR ? t("neetoRules.operators.or") : t("neetoRules.operators.and")
1017
- }), hasField ? /*#__PURE__*/jsxs(Fragment, {
1103
+ }), hasField ? /*#__PURE__*/jsxs(Fragment$1, {
1018
1104
  children: [/*#__PURE__*/jsx(Token, {
1019
1105
  active: isActive({
1020
1106
  type: BUILDER_ANCHORS.COND_FIELD,
@@ -1069,7 +1155,7 @@ var ConditionRow = function ConditionRow(_ref) {
1069
1155
  index: index
1070
1156
  });
1071
1157
  },
1072
- children: value || t("neetoRules.form.addValue")
1158
+ children: value ? /*#__PURE__*/jsx(Values, _objectSpread$c({}, value)) : t("neetoRules.form.addValue")
1073
1159
  })]
1074
1160
  }) : /*#__PURE__*/jsx(Token, {
1075
1161
  active: isActive({
@@ -1102,7 +1188,7 @@ var ConditionRow = function ConditionRow(_ref) {
1102
1188
  position: "top"
1103
1189
  },
1104
1190
  onClick: handleAddCondition
1105
- }), handleRemove && /*#__PURE__*/jsx(Button, _objectSpread$a({
1191
+ }), handleRemove && /*#__PURE__*/jsx(Button, _objectSpread$c({
1106
1192
  "data-testid": "cond-remove-".concat(index),
1107
1193
  icon: Delete,
1108
1194
  size: "sm",
@@ -1141,8 +1227,8 @@ var Connector = function Connector(_ref) {
1141
1227
  });
1142
1228
  };
1143
1229
 
1144
- function ownKeys$9(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
1145
- function _objectSpread$9(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$9(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$9(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1230
+ function ownKeys$b(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
1231
+ function _objectSpread$b(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$b(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$b(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1146
1232
  var DelayRow = function DelayRow(_ref) {
1147
1233
  var rule = _ref.rule,
1148
1234
  handleToken = _ref.onToken,
@@ -1194,7 +1280,7 @@ var DelayRow = function DelayRow(_ref) {
1194
1280
  })]
1195
1281
  }), handleRemove && /*#__PURE__*/jsx("div", {
1196
1282
  className: "mb-row-actions",
1197
- children: /*#__PURE__*/jsx(Button, _objectSpread$9({
1283
+ children: /*#__PURE__*/jsx(Button, _objectSpread$b({
1198
1284
  "data-testid": "rule-delay-remove",
1199
1285
  icon: Delete,
1200
1286
  size: "sm",
@@ -1284,8 +1370,8 @@ var MetaBlock = function MetaBlock(_ref) {
1284
1370
  });
1285
1371
  };
1286
1372
 
1287
- function ownKeys$8(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
1288
- function _objectSpread$8(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$8(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$8(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1373
+ function ownKeys$a(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
1374
+ function _objectSpread$a(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$a(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$a(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1289
1375
  var itemLabel = function itemLabel(item) {
1290
1376
  return (item === null || item === void 0 ? void 0 : item.label) || (item === null || item === void 0 ? void 0 : item.name) || (item === null || item === void 0 ? void 0 : item.value) || String(item !== null && item !== void 0 ? item : "");
1291
1377
  };
@@ -1407,7 +1493,7 @@ var ScopeRow = function ScopeRow(_ref2) {
1407
1493
  }), singlePhoneFieldLabel && /*#__PURE__*/jsxs("span", {
1408
1494
  className: "mb-fixed",
1409
1495
  children: [usingLabel, " ", singlePhoneFieldLabel]
1410
- }), hasPhoneFieldChoice && /*#__PURE__*/jsxs(Fragment, {
1496
+ }), hasPhoneFieldChoice && /*#__PURE__*/jsxs(Fragment$1, {
1411
1497
  children: [/*#__PURE__*/jsx("span", {
1412
1498
  className: "mb-fixed",
1413
1499
  children: usingLabel
@@ -1447,7 +1533,7 @@ var ScopeRow = function ScopeRow(_ref2) {
1447
1533
  type: BUILDER_ANCHORS.SCOPE
1448
1534
  });
1449
1535
  }
1450
- }), handleRemoveScope && /*#__PURE__*/jsx(Button, _objectSpread$8({
1536
+ }), handleRemoveScope && /*#__PURE__*/jsx(Button, _objectSpread$a({
1451
1537
  "data-testid": "scope-remove-".concat(index),
1452
1538
  icon: Delete,
1453
1539
  size: "sm",
@@ -1464,8 +1550,8 @@ var ScopeRow = function ScopeRow(_ref2) {
1464
1550
  });
1465
1551
  };
1466
1552
 
1467
- function ownKeys$7(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
1468
- function _objectSpread$7(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$7(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$7(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1553
+ function ownKeys$9(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
1554
+ function _objectSpread$9(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$9(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$9(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1469
1555
  var ActionRow = function ActionRow(_ref) {
1470
1556
  var schema = _ref.schema,
1471
1557
  action = _ref.action,
@@ -1498,6 +1584,7 @@ var ActionRow = function ActionRow(_ref) {
1498
1584
  recipientLabel = _actionParts.recipientLabel,
1499
1585
  separator = _actionParts.separator,
1500
1586
  configValue = _actionParts.configValue,
1587
+ configValueParts = _actionParts.configValueParts,
1501
1588
  configValuePlaceholder = _actionParts.configValuePlaceholder,
1502
1589
  paramKind = _actionParts.paramKind,
1503
1590
  valueNoun = _actionParts.valueNoun,
@@ -1532,11 +1619,11 @@ var ActionRow = function ActionRow(_ref) {
1532
1619
  configSeparator = _ref3[1];
1533
1620
  var isConfigured = isNotEmpty(action === null || action === void 0 ? void 0 : action.metadata);
1534
1621
  // A host that shows no value label still needs the token to read as filled.
1535
- var configState = configValue || isConfigured ? TOKEN_STATE.FILLED : TOKEN_STATE.MUTED;
1622
+ var configState = configValueParts || isConfigured ? TOKEN_STATE.FILLED : TOKEN_STATE.MUTED;
1536
1623
  var _useClearingHover = useClearingHover(),
1537
1624
  clearing = _useClearingHover.clearing,
1538
1625
  clearingHoverProps = _useClearingHover.clearingHoverProps;
1539
- var configToken = configSeparator ? /*#__PURE__*/jsxs(Fragment$1, {
1626
+ var configToken = configSeparator ? /*#__PURE__*/jsxs(Fragment, {
1540
1627
  children: [/*#__PURE__*/jsx("span", {
1541
1628
  className: "mb-fixed",
1542
1629
  children: configSeparator
@@ -1557,10 +1644,10 @@ var ActionRow = function ActionRow(_ref) {
1557
1644
  index: index
1558
1645
  });
1559
1646
  },
1560
- children: configValue || sentencify(configValuePlaceholder) || t("neetoRules.builder.selectFallback")
1647
+ children: configValueParts ? /*#__PURE__*/jsx(Values, _objectSpread$9({}, configValueParts)) : sentencify(configValuePlaceholder) || t("neetoRules.builder.selectFallback")
1561
1648
  })]
1562
1649
  }, "config") : null;
1563
- var recipientToken = needsRecipient ? /*#__PURE__*/jsxs(Fragment$1, {
1650
+ var recipientToken = needsRecipient ? /*#__PURE__*/jsxs(Fragment, {
1564
1651
  children: [/*#__PURE__*/jsx("span", {
1565
1652
  className: "mb-fixed",
1566
1653
  children: recipientSeparator || t("neetoRules.common.to")
@@ -1594,7 +1681,7 @@ var ActionRow = function ActionRow(_ref) {
1594
1681
  index: index,
1595
1682
  stepKey: step.key
1596
1683
  };
1597
- return /*#__PURE__*/jsxs(Fragment$1, {
1684
+ return /*#__PURE__*/jsxs(Fragment, {
1598
1685
  children: [step.separator && /*#__PURE__*/jsx("span", {
1599
1686
  className: "mb-fixed",
1600
1687
  children: step.separator
@@ -1632,7 +1719,7 @@ var ActionRow = function ActionRow(_ref) {
1632
1719
  children: [verbLabel, MediumIcon && /*#__PURE__*/jsx(MediumIcon, {
1633
1720
  size: 14
1634
1721
  }), configLabel]
1635
- }) : /*#__PURE__*/jsxs(Fragment, {
1722
+ }) : /*#__PURE__*/jsxs(Fragment$1, {
1636
1723
  children: [/*#__PURE__*/jsx(Token, {
1637
1724
  active: isVerbActive,
1638
1725
  dataTestid: "action-verb-".concat(index),
@@ -1660,7 +1747,7 @@ var ActionRow = function ActionRow(_ref) {
1660
1747
  index: index
1661
1748
  });
1662
1749
  },
1663
- children: configValue || sentencify(configValuePlaceholder) || paramPlaceholder
1750
+ children: configValueParts ? /*#__PURE__*/jsx(Values, _objectSpread$9({}, configValueParts)) : sentencify(configValuePlaceholder) || paramPlaceholder
1664
1751
  }) : configLabel && /*#__PURE__*/jsxs(Token, {
1665
1752
  className: "mb-tok-medium",
1666
1753
  dataTestid: "action-config-".concat(index),
@@ -1696,7 +1783,7 @@ var ActionRow = function ActionRow(_ref) {
1696
1783
  position: "top"
1697
1784
  },
1698
1785
  onClick: handleAddAction
1699
- }), handleRemove && /*#__PURE__*/jsx(Button, _objectSpread$7({
1786
+ }), handleRemove && /*#__PURE__*/jsx(Button, _objectSpread$9({
1700
1787
  "data-testid": "action-remove-".concat(index),
1701
1788
  icon: Delete,
1702
1789
  size: "sm",
@@ -1765,7 +1852,7 @@ var ThenBlock = function ThenBlock(_ref) {
1765
1852
  })
1766
1853
  });
1767
1854
  }
1768
- return /*#__PURE__*/jsxs(Fragment, {
1855
+ return /*#__PURE__*/jsxs(Fragment$1, {
1769
1856
  children: [named.map(function (_ref3, position) {
1770
1857
  var _action$id;
1771
1858
  var action = _ref3.action,
@@ -1803,8 +1890,8 @@ var ThenBlock = function ThenBlock(_ref) {
1803
1890
  });
1804
1891
  };
1805
1892
 
1806
- function ownKeys$6(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
1807
- function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$6(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$6(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1893
+ function ownKeys$8(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
1894
+ function _objectSpread$8(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$8(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$8(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1808
1895
  var WhenBlock = function WhenBlock(_ref) {
1809
1896
  var _schema$actor;
1810
1897
  var rule = _ref.rule,
@@ -1878,7 +1965,7 @@ var WhenBlock = function WhenBlock(_ref) {
1878
1965
  children: t("neetoRules.common.when")
1879
1966
  }), triggers.map(function (trigger, index) {
1880
1967
  var _trigger$id;
1881
- return /*#__PURE__*/jsxs(Fragment$1, {
1968
+ return /*#__PURE__*/jsxs(Fragment, {
1882
1969
  children: [index > 0 && /*#__PURE__*/jsx("span", {
1883
1970
  className: "mb-fixed",
1884
1971
  children: t("neetoRules.operators.or")
@@ -1921,7 +2008,7 @@ var WhenBlock = function WhenBlock(_ref) {
1921
2008
  })
1922
2009
  })]
1923
2010
  }, (_trigger$id = trigger.id) !== null && _trigger$id !== void 0 ? _trigger$id : index);
1924
- }), isActorEnabled && /*#__PURE__*/jsxs(Fragment, {
2011
+ }), isActorEnabled && /*#__PURE__*/jsxs(Fragment$1, {
1925
2012
  children: [/*#__PURE__*/jsx("span", {
1926
2013
  className: "mb-fixed",
1927
2014
  children: t("neetoRules.common.by")
@@ -1959,7 +2046,7 @@ var WhenBlock = function WhenBlock(_ref) {
1959
2046
  position: "top"
1960
2047
  },
1961
2048
  onClick: handleAddCondition
1962
- }), handleClearTrigger && /*#__PURE__*/jsx(Button, _objectSpread$6({
2049
+ }), handleClearTrigger && /*#__PURE__*/jsx(Button, _objectSpread$8({
1963
2050
  "data-testid": "trigger-clear",
1964
2051
  icon: Delete,
1965
2052
  size: "sm",
@@ -1978,8 +2065,8 @@ var WhenBlock = function WhenBlock(_ref) {
1978
2065
  };
1979
2066
 
1980
2067
  var _excluded = ["type"];
1981
- function ownKeys$5(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
1982
- function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$5(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$5(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
2068
+ function ownKeys$7(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2069
+ function _objectSpread$7(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$7(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$7(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1983
2070
  var usePaneCascade = function usePaneCascade(schema) {
1984
2071
  var _useUtilityStore = useUtilityStore(useShallow(function (store) {
1985
2072
  return {
@@ -1997,7 +2084,7 @@ var usePaneCascade = function usePaneCascade(schema) {
1997
2084
  type: type,
1998
2085
  variant: "builder",
1999
2086
  size: LARGE_PANEL_TYPES.includes(type) ? "large" : "small",
2000
- data: _objectSpread$5({
2087
+ data: _objectSpread$7({
2001
2088
  schema: schema
2002
2089
  }, data)
2003
2090
  });
@@ -2009,7 +2096,7 @@ var usePaneCascade = function usePaneCascade(schema) {
2009
2096
  rest = _objectWithoutProperties(token, _excluded);
2010
2097
  openType({
2011
2098
  type: type,
2012
- data: _objectSpread$5({
2099
+ data: _objectSpread$7({
2013
2100
  anchor: anchor
2014
2101
  }, rest)
2015
2102
  });
@@ -2042,9 +2129,10 @@ var useRuleModel = function useRuleModel(schema) {
2042
2129
  return {
2043
2130
  rule: rule,
2044
2131
  fieldKeys: fieldKeysFromSchema(schema),
2045
- setTriggers: function setTriggers$1(triggers) {
2046
- return apply(setTriggers({
2132
+ setTriggers: function setTriggers(triggers) {
2133
+ return applyAll(replaceTriggers({
2047
2134
  schema: schema,
2135
+ values: values,
2048
2136
  triggers: triggers
2049
2137
  }));
2050
2138
  },
@@ -2126,8 +2214,8 @@ var useRuleModel = function useRuleModel(schema) {
2126
2214
  };
2127
2215
  };
2128
2216
 
2129
- function ownKeys$4(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2130
- function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$4(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
2217
+ function ownKeys$6(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2218
+ function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$6(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$6(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
2131
2219
  var triggerValue = function triggerValue(option) {
2132
2220
  var _ref, _option$eventValue;
2133
2221
  return (_ref = (_option$eventValue = option.eventValue) !== null && _option$eventValue !== void 0 ? _option$eventValue : option.value) !== null && _ref !== void 0 ? _ref : option.id;
@@ -2301,11 +2389,42 @@ var recipientsFor = function recipientsFor(_ref11) {
2301
2389
  if (option !== null && option !== void 0 && option.recipients) return option.recipients;
2302
2390
  return ((_schema$actions8 = schema.actions) === null || _schema$actions8 === void 0 ? void 0 : _schema$actions8.recipients) || [];
2303
2391
  };
2304
- var nextTriggers = function nextTriggers(_ref12) {
2305
- var _schema$triggers;
2392
+
2393
+ // Each action runs once per rule, so hide recipients another row already uses.
2394
+ var availableRecipients = function availableRecipients(_ref12) {
2306
2395
  var schema = _ref12.schema,
2307
2396
  rule = _ref12.rule,
2308
- value = _ref12.value;
2397
+ index = _ref12.index;
2398
+ var action = actionAt({
2399
+ rule: rule,
2400
+ index: index
2401
+ });
2402
+ var channel = channelOf({
2403
+ schema: schema,
2404
+ action: action
2405
+ });
2406
+ var usedNames = rule.actions.filter(function (_, position) {
2407
+ return position !== index;
2408
+ }).map(function (item) {
2409
+ return item.name;
2410
+ }).filter(Boolean);
2411
+ return recipientsFor({
2412
+ schema: schema,
2413
+ action: action
2414
+ }).filter(function (recipient) {
2415
+ var _schema$actions9, _schema$actions9$reso;
2416
+ var name = (_schema$actions9 = schema.actions) === null || _schema$actions9 === void 0 || (_schema$actions9$reso = _schema$actions9.resolveName) === null || _schema$actions9$reso === void 0 ? void 0 : _schema$actions9$reso.call(_schema$actions9, {
2417
+ channel: channel,
2418
+ recipient: optionValue(recipient)
2419
+ });
2420
+ return !name || !usedNames.includes(name);
2421
+ });
2422
+ };
2423
+ var nextTriggers = function nextTriggers(_ref13) {
2424
+ var _schema$triggers;
2425
+ var schema = _ref13.schema,
2426
+ rule = _ref13.rule,
2427
+ value = _ref13.value;
2309
2428
  if ((_schema$triggers = schema.triggers) !== null && _schema$triggers !== void 0 && _schema$triggers.multi) {
2310
2429
  var names = pluck("name", rule.triggers);
2311
2430
  return names.includes(value) ? removeBy({
@@ -2314,16 +2433,16 @@ var nextTriggers = function nextTriggers(_ref12) {
2314
2433
  name: value
2315
2434
  }]);
2316
2435
  }
2317
- return [_objectSpread$4(_objectSpread$4({}, rule.triggers[0]), {}, {
2436
+ return [_objectSpread$6(_objectSpread$6({}, rule.triggers[0]), {}, {
2318
2437
  name: value
2319
2438
  })];
2320
2439
  };
2321
- var nextConditionAt = function nextConditionAt(_ref13) {
2440
+ var nextConditionAt = function nextConditionAt(_ref14) {
2322
2441
  var _field$allowMatching;
2323
- var schema = _ref13.schema,
2324
- rule = _ref13.rule,
2325
- index = _ref13.index,
2326
- value = _ref13.value;
2442
+ var schema = _ref14.schema,
2443
+ rule = _ref14.rule,
2444
+ index = _ref14.index,
2445
+ value = _ref14.value;
2327
2446
  var field = findField({
2328
2447
  schema: schema,
2329
2448
  value: value
@@ -2335,20 +2454,20 @@ var nextConditionAt = function nextConditionAt(_ref13) {
2335
2454
  var first = field === null || field === void 0 || (_field$allowMatching = field.allowMatching) === null || _field$allowMatching === void 0 ? void 0 : _field$allowMatching[0];
2336
2455
  var defaultVerb = first && !((field === null || field === void 0 ? void 0 : field.noValueForVerbs) || []).includes(first) ? first : undefined;
2337
2456
  var verb = ((field === null || field === void 0 ? void 0 : field.allowMatching) || []).includes(previous.verb) ? previous.verb : defaultVerb;
2338
- return _objectSpread$4(_objectSpread$4({}, previous), {}, {
2457
+ return _objectSpread$6(_objectSpread$6({}, previous), {}, {
2339
2458
  field: value,
2340
2459
  kind: field === null || field === void 0 ? void 0 : field.kind,
2341
2460
  verb: verb,
2342
2461
  metadata: {}
2343
2462
  });
2344
2463
  };
2345
- var nextActionAt = function nextActionAt(_ref14) {
2346
- var _schema$actions9;
2347
- var schema = _ref14.schema,
2348
- rule = _ref14.rule,
2349
- index = _ref14.index,
2350
- value = _ref14.value;
2351
- if (!((_schema$actions9 = schema.actions) !== null && _schema$actions9 !== void 0 && _schema$actions9.resolveName)) {
2464
+ var nextActionAt = function nextActionAt(_ref15) {
2465
+ var _schema$actions0;
2466
+ var schema = _ref15.schema,
2467
+ rule = _ref15.rule,
2468
+ index = _ref15.index,
2469
+ value = _ref15.value;
2470
+ if (!((_schema$actions0 = schema.actions) !== null && _schema$actions0 !== void 0 && _schema$actions0.resolveName)) {
2352
2471
  var option = findActionOption({
2353
2472
  schema: schema,
2354
2473
  name: value
@@ -2359,7 +2478,7 @@ var nextActionAt = function nextActionAt(_ref14) {
2359
2478
  });
2360
2479
  if (option !== null && option !== void 0 && option.recipients) {
2361
2480
  var _channelChanged = _prev.channel !== value;
2362
- return _objectSpread$4(_objectSpread$4({}, _prev), {}, {
2481
+ return _objectSpread$6(_objectSpread$6({}, _prev), {}, {
2363
2482
  channel: value,
2364
2483
  recipient: _channelChanged ? undefined : _prev.recipient,
2365
2484
  name: "",
@@ -2367,7 +2486,7 @@ var nextActionAt = function nextActionAt(_ref14) {
2367
2486
  metadata: _channelChanged ? {} : _prev.metadata
2368
2487
  });
2369
2488
  }
2370
- return _objectSpread$4(_objectSpread$4({}, _prev), {}, {
2489
+ return _objectSpread$6(_objectSpread$6({}, _prev), {}, {
2371
2490
  channel: undefined,
2372
2491
  recipient: undefined,
2373
2492
  name: value,
@@ -2386,16 +2505,16 @@ var nextActionAt = function nextActionAt(_ref14) {
2386
2505
  var channelChanged = prevChannel !== value;
2387
2506
  var recipient = channelChanged ? undefined : prev.recipient;
2388
2507
  if (channelChanged) {
2389
- var _schema$actions0;
2508
+ var _schema$actions1;
2390
2509
  var channelRecipients =
2391
2510
  // eslint-disable-next-line security/detect-object-injection
2392
- ((_schema$actions0 = schema.actions) === null || _schema$actions0 === void 0 || (_schema$actions0 = _schema$actions0.recipientsByChannel) === null || _schema$actions0 === void 0 ? void 0 : _schema$actions0[value]) || [];
2511
+ ((_schema$actions1 = schema.actions) === null || _schema$actions1 === void 0 || (_schema$actions1 = _schema$actions1.recipientsByChannel) === null || _schema$actions1 === void 0 ? void 0 : _schema$actions1[value]) || [];
2393
2512
  if (channelRecipients.length === 1) {
2394
2513
  var _channelRecipients = _slicedToArray(channelRecipients, 1);
2395
2514
  recipient = _channelRecipients[0];
2396
2515
  }
2397
2516
  }
2398
- return _objectSpread$4(_objectSpread$4({}, prev), {}, {
2517
+ return _objectSpread$6(_objectSpread$6({}, prev), {}, {
2399
2518
  channel: value,
2400
2519
  recipient: recipient,
2401
2520
  name: schema.actions.resolveName({
@@ -2405,11 +2524,11 @@ var nextActionAt = function nextActionAt(_ref14) {
2405
2524
  metadata: channelChanged ? {} : prev.metadata
2406
2525
  });
2407
2526
  };
2408
- var appendScopeItem = function appendScopeItem(_ref15) {
2527
+ var appendScopeItem = function appendScopeItem(_ref16) {
2409
2528
  var _sc$requiresPhone;
2410
- var schema = _ref15.schema,
2411
- rule = _ref15.rule,
2412
- value = _ref15.value;
2529
+ var schema = _ref16.schema,
2530
+ rule = _ref16.rule,
2531
+ value = _ref16.value;
2413
2532
  var sc = schema.scope || {};
2414
2533
  var option = (sc.options || []).find(function (candidate) {
2415
2534
  return optionValue(candidate) === value;
@@ -2422,16 +2541,16 @@ var appendScopeItem = function appendScopeItem(_ref15) {
2422
2541
  schema: schema,
2423
2542
  item: option
2424
2543
  });
2425
- return (phoneFields === null || phoneFields === void 0 ? void 0 : phoneFields.length) === 1 ? _objectSpread$4(_objectSpread$4({}, option), {}, {
2544
+ return (phoneFields === null || phoneFields === void 0 ? void 0 : phoneFields.length) === 1 ? _objectSpread$6(_objectSpread$6({}, option), {}, {
2426
2545
  phoneField: phoneFields[0].value
2427
2546
  }) : option;
2428
2547
  };
2429
- var nextActionRecipientAt = function nextActionRecipientAt(_ref16) {
2430
- var _schema$actions1;
2431
- var schema = _ref16.schema,
2432
- rule = _ref16.rule,
2433
- index = _ref16.index,
2434
- value = _ref16.value;
2548
+ var nextActionRecipientAt = function nextActionRecipientAt(_ref17) {
2549
+ var _schema$actions10;
2550
+ var schema = _ref17.schema,
2551
+ rule = _ref17.rule,
2552
+ index = _ref17.index,
2553
+ value = _ref17.value;
2435
2554
  var prev = actionAt({
2436
2555
  rule: rule,
2437
2556
  index: index
@@ -2440,21 +2559,21 @@ var nextActionRecipientAt = function nextActionRecipientAt(_ref16) {
2440
2559
  schema: schema,
2441
2560
  action: prev
2442
2561
  });
2443
- return _objectSpread$4(_objectSpread$4({}, prev), {}, {
2562
+ return _objectSpread$6(_objectSpread$6({}, prev), {}, {
2444
2563
  recipient: value,
2445
- name: (_schema$actions1 = schema.actions) !== null && _schema$actions1 !== void 0 && _schema$actions1.resolveName ? schema.actions.resolveName({
2564
+ name: (_schema$actions10 = schema.actions) !== null && _schema$actions10 !== void 0 && _schema$actions10.resolveName ? schema.actions.resolveName({
2446
2565
  channel: channel,
2447
2566
  recipient: value
2448
2567
  }) : value
2449
2568
  });
2450
2569
  };
2451
- var descriptorFor = function descriptorFor(_ref17) {
2570
+ var descriptorFor = function descriptorFor(_ref18) {
2452
2571
  var _schema$actor2;
2453
- var anchor = _ref17.anchor,
2454
- schema = _ref17.schema,
2455
- rule = _ref17.rule,
2456
- index = _ref17.index,
2457
- stepKey = _ref17.stepKey;
2572
+ var anchor = _ref18.anchor,
2573
+ schema = _ref18.schema,
2574
+ rule = _ref18.rule,
2575
+ index = _ref18.index,
2576
+ stepKey = _ref18.stepKey;
2458
2577
  switch (anchor) {
2459
2578
  case BUILDER_ANCHORS.TRIGGER_ADD:
2460
2579
  case BUILDER_ANCHORS.TRIGGER_REPLACE:
@@ -2567,19 +2686,19 @@ var descriptorFor = function descriptorFor(_ref17) {
2567
2686
  case BUILDER_ANCHORS.ACTION_ADD:
2568
2687
  case BUILDER_ANCHORS.ACTION_CHANNEL:
2569
2688
  {
2570
- var _schema$actions11, _channelOf;
2689
+ var _schema$actions12, _channelOf;
2571
2690
  var isSwap = anchor === BUILDER_ANCHORS.ACTION_CHANNEL;
2572
2691
  var channelMetaFor = function channelMetaFor(value) {
2573
- var _schema$actions10;
2692
+ var _schema$actions11;
2574
2693
  return (
2575
2694
  // eslint-disable-next-line security/detect-object-injection
2576
- ((_schema$actions10 = schema.actions) === null || _schema$actions10 === void 0 || (_schema$actions10 = _schema$actions10.channelMeta) === null || _schema$actions10 === void 0 ? void 0 : _schema$actions10[value]) || {}
2695
+ ((_schema$actions11 = schema.actions) === null || _schema$actions11 === void 0 || (_schema$actions11 = _schema$actions11.channelMeta) === null || _schema$actions11 === void 0 ? void 0 : _schema$actions11[value]) || {}
2577
2696
  );
2578
2697
  };
2579
2698
 
2580
2699
  // Both panes list the host's actions in the order it declared them;
2581
2700
  // re-ranking only the swap pane made the two disagree.
2582
- var sourceOptions = ((_schema$actions11 = schema.actions) === null || _schema$actions11 === void 0 ? void 0 : _schema$actions11.options) || [];
2701
+ var sourceOptions = ((_schema$actions12 = schema.actions) === null || _schema$actions12 === void 0 ? void 0 : _schema$actions12.options) || [];
2583
2702
  return {
2584
2703
  title: isSwap ? t("neetoRules.builder.panes.actionSwapTitle") : t("neetoRules.builder.panes.actionAddTitle"),
2585
2704
  subtitle: isSwap ? t("neetoRules.builder.panes.actionSwapSubtitle") : t("neetoRules.builder.panes.actionAddSubtitle"),
@@ -2614,7 +2733,7 @@ var descriptorFor = function descriptorFor(_ref17) {
2614
2733
  }
2615
2734
  case BUILDER_ANCHORS.ACTION_RECIPIENT:
2616
2735
  {
2617
- var _schema$actions12;
2736
+ var _schema$actions13;
2618
2737
  var action = actionAt({
2619
2738
  rule: rule,
2620
2739
  index: index
@@ -2624,7 +2743,7 @@ var descriptorFor = function descriptorFor(_ref17) {
2624
2743
  action: action
2625
2744
  });
2626
2745
  // eslint-disable-next-line security/detect-object-injection
2627
- var meta = ((_schema$actions12 = schema.actions) === null || _schema$actions12 === void 0 || (_schema$actions12 = _schema$actions12.channelMeta) === null || _schema$actions12 === void 0 ? void 0 : _schema$actions12[channel]) || {};
2746
+ var meta = ((_schema$actions13 = schema.actions) === null || _schema$actions13 === void 0 || (_schema$actions13 = _schema$actions13.channelMeta) === null || _schema$actions13 === void 0 ? void 0 : _schema$actions13[channel]) || {};
2628
2747
  var option = findActionOption({
2629
2748
  schema: schema,
2630
2749
  name: channel
@@ -2632,9 +2751,10 @@ var descriptorFor = function descriptorFor(_ref17) {
2632
2751
  return {
2633
2752
  title: meta.recipientTitle || (option === null || option === void 0 ? void 0 : option.recipientTitle) || t("neetoRules.builder.panes.recipientTitle"),
2634
2753
  subtitle: meta.recipientSubtitle || (option === null || option === void 0 ? void 0 : option.recipientSubtitle) || t("neetoRules.builder.panes.recipientSubtitle"),
2635
- options: recipientsFor({
2754
+ options: availableRecipients({
2636
2755
  schema: schema,
2637
- action: action
2756
+ rule: rule,
2757
+ index: index
2638
2758
  }).map(function (recipient) {
2639
2759
  return {
2640
2760
  label: recipient.label,
@@ -2742,14 +2862,14 @@ var descriptorFor = function descriptorFor(_ref17) {
2742
2862
  };
2743
2863
  }
2744
2864
  };
2745
- var commitFor = function commitFor(_ref18) {
2746
- var anchor = _ref18.anchor,
2747
- schema = _ref18.schema,
2748
- rule = _ref18.rule,
2749
- index = _ref18.index,
2750
- stepKey = _ref18.stepKey,
2751
- value = _ref18.value,
2752
- helpers = _ref18.helpers;
2865
+ var commitFor = function commitFor(_ref19) {
2866
+ var anchor = _ref19.anchor,
2867
+ schema = _ref19.schema,
2868
+ rule = _ref19.rule,
2869
+ index = _ref19.index,
2870
+ stepKey = _ref19.stepKey,
2871
+ value = _ref19.value,
2872
+ helpers = _ref19.helpers;
2753
2873
  var setTriggers = helpers.setTriggers,
2754
2874
  setPerformer = helpers.setPerformer,
2755
2875
  setConditionMode = helpers.setConditionMode,
@@ -2769,7 +2889,7 @@ var commitFor = function commitFor(_ref18) {
2769
2889
  }]));
2770
2890
  return "stay";
2771
2891
  }
2772
- setTriggers([_objectSpread$4(_objectSpread$4({}, rule.triggers[0]), {}, {
2892
+ setTriggers([_objectSpread$6(_objectSpread$6({}, rule.triggers[0]), {}, {
2773
2893
  name: value
2774
2894
  })]);
2775
2895
  var leadTime = (_schema$triggers5 = schema.triggers) === null || _schema$triggers5 === void 0 ? void 0 : _schema$triggers5.leadTime;
@@ -2854,14 +2974,14 @@ var commitFor = function commitFor(_ref18) {
2854
2974
  return "close";
2855
2975
  }
2856
2976
  };
2857
- var continueTargetFor = function continueTargetFor(_ref19) {
2977
+ var continueTargetFor = function continueTargetFor(_ref20) {
2858
2978
  var _schema$actor3;
2859
- var anchor = _ref19.anchor,
2860
- schema = _ref19.schema,
2861
- rule = _ref19.rule,
2862
- index = _ref19.index,
2863
- stepKey = _ref19.stepKey,
2864
- configPending = _ref19.configPending;
2979
+ var anchor = _ref20.anchor,
2980
+ schema = _ref20.schema,
2981
+ rule = _ref20.rule,
2982
+ index = _ref20.index,
2983
+ stepKey = _ref20.stepKey,
2984
+ configPending = _ref20.configPending;
2865
2985
  switch (anchor) {
2866
2986
  case BUILDER_ANCHORS.TRIGGER_ADD:
2867
2987
  case BUILDER_ANCHORS.TRIGGER_REPLACE:
@@ -2973,25 +3093,25 @@ var continueTargetFor = function continueTargetFor(_ref19) {
2973
3093
  return null;
2974
3094
  }
2975
3095
  };
2976
- var replaceAt = function replaceAt(_ref20) {
2977
- var list = _ref20.list,
2978
- index = _ref20.index,
2979
- item = _ref20.item;
3096
+ var replaceAt = function replaceAt(_ref21) {
3097
+ var list = _ref21.list,
3098
+ index = _ref21.index,
3099
+ item = _ref21.item;
2980
3100
  var next = _toConsumableArray(list);
2981
3101
  // eslint-disable-next-line security/detect-object-injection
2982
3102
  next[index] = item;
2983
3103
  return next;
2984
3104
  };
2985
- var applyPreview = function applyPreview(_ref21) {
2986
- var rule = _ref21.rule,
2987
- schema = _ref21.schema,
2988
- anchor = _ref21.anchor,
2989
- index = _ref21.index,
2990
- value = _ref21.value;
3105
+ var applyPreview = function applyPreview(_ref22) {
3106
+ var rule = _ref22.rule,
3107
+ schema = _ref22.schema,
3108
+ anchor = _ref22.anchor,
3109
+ index = _ref22.index,
3110
+ value = _ref22.value;
2991
3111
  switch (anchor) {
2992
3112
  case BUILDER_ANCHORS.TRIGGER_ADD:
2993
3113
  case BUILDER_ANCHORS.TRIGGER_REPLACE:
2994
- return _objectSpread$4(_objectSpread$4({}, rule), {}, {
3114
+ return _objectSpread$6(_objectSpread$6({}, rule), {}, {
2995
3115
  triggers: Array.isArray(value) ? value.map(function (name) {
2996
3116
  return {
2997
3117
  name: name
@@ -3003,11 +3123,11 @@ var applyPreview = function applyPreview(_ref21) {
3003
3123
  })
3004
3124
  });
3005
3125
  case BUILDER_ANCHORS.TRIGGER_ACTOR:
3006
- return _objectSpread$4(_objectSpread$4({}, rule), {}, {
3126
+ return _objectSpread$6(_objectSpread$6({}, rule), {}, {
3007
3127
  performer: value
3008
3128
  });
3009
3129
  case BUILDER_ANCHORS.COND_FIELD:
3010
- return _objectSpread$4(_objectSpread$4({}, rule), {}, {
3130
+ return _objectSpread$6(_objectSpread$6({}, rule), {}, {
3011
3131
  conditions: replaceAt({
3012
3132
  list: rule.conditions,
3013
3133
  index: index,
@@ -3020,11 +3140,11 @@ var applyPreview = function applyPreview(_ref21) {
3020
3140
  })
3021
3141
  });
3022
3142
  case BUILDER_ANCHORS.COND_OP_TOGGLE:
3023
- return _objectSpread$4(_objectSpread$4({}, rule), {}, {
3143
+ return _objectSpread$6(_objectSpread$6({}, rule), {}, {
3024
3144
  conditions: replaceAt({
3025
3145
  list: rule.conditions,
3026
3146
  index: index,
3027
- item: _objectSpread$4(_objectSpread$4({}, conditionAt({
3147
+ item: _objectSpread$6(_objectSpread$6({}, conditionAt({
3028
3148
  rule: rule,
3029
3149
  index: index
3030
3150
  })), {}, {
@@ -3033,12 +3153,12 @@ var applyPreview = function applyPreview(_ref21) {
3033
3153
  })
3034
3154
  });
3035
3155
  case BUILDER_ANCHORS.COND_CONNECTOR:
3036
- return _objectSpread$4(_objectSpread$4({}, rule), {}, {
3156
+ return _objectSpread$6(_objectSpread$6({}, rule), {}, {
3037
3157
  conditionMode: value
3038
3158
  });
3039
3159
  case BUILDER_ANCHORS.ACTION_ADD:
3040
3160
  case BUILDER_ANCHORS.ACTION_CHANNEL:
3041
- return _objectSpread$4(_objectSpread$4({}, rule), {}, {
3161
+ return _objectSpread$6(_objectSpread$6({}, rule), {}, {
3042
3162
  actions: replaceAt({
3043
3163
  list: rule.actions,
3044
3164
  index: index,
@@ -3051,7 +3171,7 @@ var applyPreview = function applyPreview(_ref21) {
3051
3171
  })
3052
3172
  });
3053
3173
  case BUILDER_ANCHORS.ACTION_RECIPIENT:
3054
- return _objectSpread$4(_objectSpread$4({}, rule), {}, {
3174
+ return _objectSpread$6(_objectSpread$6({}, rule), {}, {
3055
3175
  actions: replaceAt({
3056
3176
  list: rule.actions,
3057
3177
  index: index,
@@ -3064,11 +3184,11 @@ var applyPreview = function applyPreview(_ref21) {
3064
3184
  })
3065
3185
  });
3066
3186
  case BUILDER_ANCHORS.SCOPE_PHONE_FIELD:
3067
- return _objectSpread$4(_objectSpread$4({}, rule), {}, {
3187
+ return _objectSpread$6(_objectSpread$6({}, rule), {}, {
3068
3188
  scope: replaceAt({
3069
3189
  list: rule.scope,
3070
3190
  index: index,
3071
- item: _objectSpread$4(_objectSpread$4({}, scopeItemAt({
3191
+ item: _objectSpread$6(_objectSpread$6({}, scopeItemAt({
3072
3192
  rule: rule,
3073
3193
  index: index
3074
3194
  })), {}, {
@@ -3081,8 +3201,8 @@ var applyPreview = function applyPreview(_ref21) {
3081
3201
  }
3082
3202
  };
3083
3203
 
3084
- function ownKeys$3(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3085
- function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
3204
+ function ownKeys$5(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3205
+ function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$5(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$5(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
3086
3206
  var Canvas = function Canvas(_ref) {
3087
3207
  var _schema$actor2, _ref6, _actorOptions$0$value, _schema$scope, _schema$conditions, _schema$triggers, _schema$delay, _schema$meta$showName, _schema$meta;
3088
3208
  var schema = _ref.schema;
@@ -3116,7 +3236,7 @@ var Canvas = function Canvas(_ref) {
3116
3236
  builderPreview = _useUtilityStore.builderPreview,
3117
3237
  panelState = _useUtilityStore.panelState;
3118
3238
  var displayRule = useMemo(function () {
3119
- return builderPreview ? applyPreview(_objectSpread$3({
3239
+ return builderPreview ? applyPreview(_objectSpread$5({
3120
3240
  rule: rule,
3121
3241
  schema: schema
3122
3242
  }, builderPreview)) : rule;
@@ -3420,7 +3540,7 @@ var Canvas = function Canvas(_ref) {
3420
3540
  });
3421
3541
  }), renderSlot("afterConditions"), /*#__PURE__*/jsx(Connector, {
3422
3542
  active: isTriggerSet
3423
- }), isDelayEnabled && isTriggerSet && (rule.delay ? /*#__PURE__*/jsxs(Fragment$1, {
3543
+ }), isDelayEnabled && isTriggerSet && (rule.delay ? /*#__PURE__*/jsxs(Fragment, {
3424
3544
  children: [/*#__PURE__*/jsx(DelayRow, {
3425
3545
  isActive: isActive,
3426
3546
  isInvalid: isInvalid,
@@ -3454,7 +3574,7 @@ var Canvas = function Canvas(_ref) {
3454
3574
  onAddAction: handleAddAction,
3455
3575
  onRemoveAction: handleRemoveAction,
3456
3576
  onToken: openPane
3457
- }), renderSlot("afterActions"), isScopeEnabled && /*#__PURE__*/jsxs(Fragment$1, {
3577
+ }), renderSlot("afterActions"), isScopeEnabled && /*#__PURE__*/jsxs(Fragment, {
3458
3578
  children: [/*#__PURE__*/jsx(Connector, {
3459
3579
  active: true
3460
3580
  }), /*#__PURE__*/jsx(ScopeBlock, {
@@ -3504,7 +3624,115 @@ var CONDITION_VALUE_TYPES = {
3504
3624
  multiSelect: "multi-select",
3505
3625
  multiSelectCreate: "multi-select-create",
3506
3626
  number: "number",
3507
- email: "email"
3627
+ email: "email",
3628
+ date: "date"
3629
+ };
3630
+
3631
+ function ownKeys$4(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3632
+ function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$4(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
3633
+ var EmailChannelFields = function EmailChannelFields(_ref) {
3634
+ var _getIn, _getIn2, _action$metadata;
3635
+ var name = _ref.name,
3636
+ option = _ref.option,
3637
+ action = _ref.action,
3638
+ options = _ref.options,
3639
+ hasRecipientField = _ref.hasRecipientField,
3640
+ hint = _ref.hint;
3641
+ var _useTranslation = useTranslation(),
3642
+ t = _useTranslation.t;
3643
+ var _useFormikContext = useFormikContext(),
3644
+ values = _useFormikContext.values,
3645
+ errors = _useFormikContext.errors,
3646
+ touched = _useFormikContext.touched,
3647
+ setFieldValue = _useFormikContext.setFieldValue,
3648
+ setFieldTouched = _useFormikContext.setFieldTouched;
3649
+ var editorRef = useRef(null);
3650
+ var _useUtilityStore = useUtilityStore(useShallow(function (store) {
3651
+ return {
3652
+ isSaveAsTemplateEnabled: store["isSaveAsTemplateEnabled"]
3653
+ };
3654
+ })),
3655
+ isSaveAsTemplateEnabled = _useUtilityStore.isSaveAsTemplateEnabled;
3656
+ var hasFieldChanged = useHasFieldChanged(name);
3657
+ var valuePath = "".concat(name, ".value");
3658
+ var subjectPath = "".concat(name, ".subject");
3659
+ var bodyPath = "".concat(name, ".body");
3660
+ var templates = option === null || option === void 0 ? void 0 : option.templates;
3661
+ // Hosts whose email action picks its recipient from a list keep that
3662
+ // choice in the same pane as the message.
3663
+ var hasRecipientList = isNotEmpty(options) && !hasRecipientField;
3664
+ var fieldError = function fieldError(path) {
3665
+ return getIn(touched, path) && getIn(errors, path);
3666
+ };
3667
+ var shouldShowSaveAsTemplate = useCallback(function () {
3668
+ var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
3669
+ templateId = _ref2.templateId,
3670
+ subject = _ref2.subject,
3671
+ body = _ref2.body;
3672
+ var template = findBy({
3673
+ id: templateId
3674
+ }, templates);
3675
+ var hasContent = isPresent(subject) || isPresent(body);
3676
+ var isContentDifferentFromTemplate = !(areValuesEqual(template === null || template === void 0 ? void 0 : template.subject, subject) && (template === null || template === void 0 ? void 0 : template.body) === body);
3677
+ return hasContent && hasFieldChanged && isContentDifferentFromTemplate;
3678
+ }, [templates, hasFieldChanged]);
3679
+ var isSaveAsTemplateVisible = useResetSaveAsTemplateOnHide(name, isSaveAsTemplateEnabled ? shouldShowSaveAsTemplate : F);
3680
+
3681
+ // Formik validates each write on a stale snapshot, so write it all at once.
3682
+ var handleTemplateChange = function handleTemplateChange(template) {
3683
+ setFieldValue(name, _objectSpread$4(_objectSpread$4({}, getIn(values, name)), {}, {
3684
+ templateId: template.id,
3685
+ body: template.body
3686
+ }, option !== null && option !== void 0 && option.hideSubject ? {} : {
3687
+ subject: template.subject
3688
+ }));
3689
+ setEditorContent(editorRef, template.body);
3690
+ };
3691
+ return /*#__PURE__*/jsxs("div", {
3692
+ className: "flex flex-col gap-4",
3693
+ children: [hasRecipientList && /*#__PURE__*/jsx(Select, {
3694
+ options: options,
3695
+ required: true,
3696
+ error: fieldError(valuePath),
3697
+ placeholder: option === null || option === void 0 ? void 0 : option.valuePlaceholder,
3698
+ size: "large",
3699
+ value: (_getIn = getIn(values, valuePath)) !== null && _getIn !== void 0 ? _getIn : undefined,
3700
+ label: (option === null || option === void 0 ? void 0 : option.recipientLabel) || t("neetoRules.builder.config.recipient"),
3701
+ onBlur: function onBlur() {
3702
+ return setFieldTouched(valuePath, true);
3703
+ },
3704
+ onChange: function onChange(value) {
3705
+ return setFieldValue(valuePath, value);
3706
+ }
3707
+ }), isPresent(templates) && /*#__PURE__*/jsx(SelectTemplateField, {
3708
+ templates: templates,
3709
+ selectedField: option,
3710
+ onChange: handleTemplateChange
3711
+ }), !(option !== null && option !== void 0 && option.hideSubject) && /*#__PURE__*/jsx(Input, {
3712
+ required: true,
3713
+ error: fieldError(subjectPath),
3714
+ label: t("neetoRules.builder.config.subject"),
3715
+ placeholder: t("neetoRules.builder.config.subjectPlaceholder"),
3716
+ size: "large",
3717
+ value: (_getIn2 = getIn(values, subjectPath)) !== null && _getIn2 !== void 0 ? _getIn2 : "",
3718
+ onBlur: function onBlur() {
3719
+ return setFieldTouched(subjectPath, true);
3720
+ },
3721
+ onChange: function onChange(event) {
3722
+ return setFieldValue(subjectPath, event.target.value);
3723
+ }
3724
+ }), /*#__PURE__*/jsx(EditorAction, {
3725
+ editorRef: editorRef,
3726
+ required: true,
3727
+ label: t("neetoRules.builder.config.body"),
3728
+ name: bodyPath,
3729
+ placeholder: t("neetoRules.builder.config.bodyPlaceholder"),
3730
+ value: action === null || action === void 0 || (_action$metadata = action.metadata) === null || _action$metadata === void 0 ? void 0 : _action$metadata.body,
3731
+ variables: option === null || option === void 0 ? void 0 : option.variables
3732
+ }), hint, isSaveAsTemplateVisible && /*#__PURE__*/jsx(SaveAsTemplate, {
3733
+ name: name
3734
+ })]
3735
+ });
3508
3736
  };
3509
3737
 
3510
3738
  var restoreTokens = function restoreTokens(text) {
@@ -3566,49 +3794,13 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
3566
3794
  });
3567
3795
  }
3568
3796
  if (type === ACTION_CONFIG_TYPES.emailChannel) {
3569
- var _getIn, _getIn2, _action$metadata;
3570
- var subjectPath = "".concat(name, ".subject");
3571
- var bodyPath = "".concat(name, ".body");
3572
- // Hosts whose email action picks its recipient from a list keep that
3573
- // choice in the same pane as the message.
3574
- var hasRecipientList = isNotEmpty(options) && !hasRecipientField;
3575
- return /*#__PURE__*/jsxs("div", {
3576
- className: "flex flex-col gap-4",
3577
- children: [hasRecipientList && /*#__PURE__*/jsx(Select, {
3578
- options: options,
3579
- required: true,
3580
- error: fieldError(valuePath),
3581
- placeholder: option === null || option === void 0 ? void 0 : option.valuePlaceholder,
3582
- size: "large",
3583
- value: (_getIn = getIn(values, valuePath)) !== null && _getIn !== void 0 ? _getIn : undefined,
3584
- label: (option === null || option === void 0 ? void 0 : option.recipientLabel) || t("neetoRules.builder.config.recipient"),
3585
- onBlur: function onBlur() {
3586
- return setFieldTouched(valuePath, true);
3587
- },
3588
- onChange: function onChange(value) {
3589
- return setFieldValue(valuePath, value);
3590
- }
3591
- }), !(option !== null && option !== void 0 && option.hideSubject) && /*#__PURE__*/jsx(Input, {
3592
- required: true,
3593
- error: fieldError(subjectPath),
3594
- label: t("neetoRules.builder.config.subject"),
3595
- placeholder: t("neetoRules.builder.config.subjectPlaceholder"),
3596
- size: "large",
3597
- value: (_getIn2 = getIn(values, subjectPath)) !== null && _getIn2 !== void 0 ? _getIn2 : "",
3598
- onBlur: function onBlur() {
3599
- return setFieldTouched(subjectPath, true);
3600
- },
3601
- onChange: function onChange(event) {
3602
- return setFieldValue(subjectPath, event.target.value);
3603
- }
3604
- }), /*#__PURE__*/jsx(EditorAction, {
3605
- required: true,
3606
- label: t("neetoRules.builder.config.body"),
3607
- name: bodyPath,
3608
- placeholder: t("neetoRules.builder.config.bodyPlaceholder"),
3609
- value: action === null || action === void 0 || (_action$metadata = action.metadata) === null || _action$metadata === void 0 ? void 0 : _action$metadata.body,
3610
- variables: option === null || option === void 0 ? void 0 : option.variables
3611
- }), hintBlock]
3797
+ return /*#__PURE__*/jsx(EmailChannelFields, {
3798
+ action: action,
3799
+ hasRecipientField: hasRecipientField,
3800
+ name: name,
3801
+ option: option,
3802
+ options: options,
3803
+ hint: hintBlock
3612
3804
  });
3613
3805
  }
3614
3806
  if (type === ACTION_CONFIG_TYPES.multiSelect) {
@@ -3669,7 +3861,7 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
3669
3861
  });
3670
3862
  }
3671
3863
  if (type === ACTION_CONFIG_TYPES.note) {
3672
- var _action$metadata2;
3864
+ var _action$metadata;
3673
3865
  return /*#__PURE__*/jsxs("div", {
3674
3866
  className: "flex flex-col gap-2",
3675
3867
  children: [/*#__PURE__*/jsx(EditorAction, {
@@ -3677,20 +3869,20 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
3677
3869
  label: t("neetoRules.builder.config.note"),
3678
3870
  name: valuePath,
3679
3871
  placeholder: t("neetoRules.builder.config.bodyPlaceholder"),
3680
- value: action === null || action === void 0 || (_action$metadata2 = action.metadata) === null || _action$metadata2 === void 0 ? void 0 : _action$metadata2.value,
3872
+ value: action === null || action === void 0 || (_action$metadata = action.metadata) === null || _action$metadata === void 0 ? void 0 : _action$metadata.value,
3681
3873
  variables: option === null || option === void 0 ? void 0 : option.variables
3682
3874
  }), hintBlock]
3683
3875
  });
3684
3876
  }
3685
3877
  if (type === ACTION_CONFIG_TYPES.textarea || type === ACTION_CONFIG_TYPES.number) {
3686
- var _getIn3, _getIn4;
3878
+ var _getIn, _getIn2;
3687
3879
  return type === ACTION_CONFIG_TYPES.number ? /*#__PURE__*/jsx(Input, {
3688
3880
  required: true,
3689
3881
  error: fieldError(valuePath),
3690
3882
  label: t("neetoRules.builder.config.value"),
3691
3883
  size: "large",
3692
3884
  type: "number",
3693
- value: (_getIn3 = getIn(values, valuePath)) !== null && _getIn3 !== void 0 ? _getIn3 : "",
3885
+ value: (_getIn = getIn(values, valuePath)) !== null && _getIn !== void 0 ? _getIn : "",
3694
3886
  onBlur: function onBlur() {
3695
3887
  return setFieldTouched(valuePath, true);
3696
3888
  },
@@ -3703,7 +3895,7 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
3703
3895
  label: t("neetoRules.builder.config.message"),
3704
3896
  rows: 5,
3705
3897
  size: "large",
3706
- value: (_getIn4 = getIn(values, valuePath)) !== null && _getIn4 !== void 0 ? _getIn4 : "",
3898
+ value: (_getIn2 = getIn(values, valuePath)) !== null && _getIn2 !== void 0 ? _getIn2 : "",
3707
3899
  onBlur: function onBlur() {
3708
3900
  return setFieldTouched(valuePath, true);
3709
3901
  },
@@ -3713,7 +3905,7 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
3713
3905
  });
3714
3906
  }
3715
3907
  if (type === ACTION_CONFIG_TYPES.text || type === ACTION_CONFIG_TYPES.regex || type === ACTION_CONFIG_TYPES.decimal) {
3716
- var _getIn5;
3908
+ var _getIn3;
3717
3909
  return /*#__PURE__*/jsxs("div", {
3718
3910
  className: "flex flex-col gap-2",
3719
3911
  children: [/*#__PURE__*/jsx(Input, {
@@ -3722,7 +3914,7 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
3722
3914
  label: t("neetoRules.builder.config.value"),
3723
3915
  placeholder: option === null || option === void 0 ? void 0 : option.valuePlaceholder,
3724
3916
  size: "large",
3725
- value: (_getIn5 = getIn(values, valuePath)) !== null && _getIn5 !== void 0 ? _getIn5 : "",
3917
+ value: (_getIn3 = getIn(values, valuePath)) !== null && _getIn3 !== void 0 ? _getIn3 : "",
3726
3918
  onBlur: function onBlur() {
3727
3919
  return setFieldTouched(valuePath, true);
3728
3920
  },
@@ -3758,8 +3950,8 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
3758
3950
  });
3759
3951
  };
3760
3952
 
3761
- function _regenerator$1() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2$1(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = false, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = true, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), true), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2$1(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2$1(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2$1(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2$1(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2$1(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2$1(u), _regeneratorDefine2$1(u, o, "Generator"), _regeneratorDefine2$1(u, n, function () { return this; }), _regeneratorDefine2$1(u, "toString", function () { return "[object Generator]"; }), (_regenerator$1 = function _regenerator() { return { w: i, m: f }; })(); }
3762
- function _regeneratorDefine2$1(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2$1 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2$1(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2$1(e, r, n, t); }
3953
+ function _regenerator$2() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2$2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = false, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = true, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), true), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2$2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2$2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2$2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2$2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2$2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2$2(u), _regeneratorDefine2$2(u, o, "Generator"), _regeneratorDefine2$2(u, n, function () { return this; }), _regeneratorDefine2$2(u, "toString", function () { return "[object Generator]"; }), (_regenerator$2 = function _regenerator() { return { w: i, m: f }; })(); }
3954
+ function _regeneratorDefine2$2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2$2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2$2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2$2(e, r, n, t); }
3763
3955
  var keysUnder = function keysUnder(_ref) {
3764
3956
  var obj = _ref.obj,
3765
3957
  prefix = _ref.prefix,
@@ -3796,12 +3988,12 @@ var usePaneValidation = function usePaneValidation(prefix) {
3796
3988
  // eslint-disable-next-line react-hooks/exhaustive-deps
3797
3989
  }, [prefix]);
3798
3990
  var validate = /*#__PURE__*/function () {
3799
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator$1().m(function _callee() {
3991
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator$2().m(function _callee() {
3800
3992
  var exclude,
3801
3993
  nextErrors,
3802
3994
  offending,
3803
3995
  _args = arguments;
3804
- return _regenerator$1().w(function (_context) {
3996
+ return _regenerator$2().w(function (_context) {
3805
3997
  while (1) switch (_context.n) {
3806
3998
  case 0:
3807
3999
  exclude = _args.length > 0 && _args[0] !== undefined ? _args[0] : [];
@@ -3830,8 +4022,8 @@ var usePaneValidation = function usePaneValidation(prefix) {
3830
4022
  };
3831
4023
  };
3832
4024
 
3833
- function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = false, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = true, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), true), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
3834
- function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
4025
+ function _regenerator$1() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2$1(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = false, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = true, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), true), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2$1(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2$1(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2$1(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2$1(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2$1(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2$1(u), _regeneratorDefine2$1(u, o, "Generator"), _regeneratorDefine2$1(u, n, function () { return this; }), _regeneratorDefine2$1(u, "toString", function () { return "[object Generator]"; }), (_regenerator$1 = function _regenerator() { return { w: i, m: f }; })(); }
4026
+ function _regeneratorDefine2$1(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2$1 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2$1(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2$1(e, r, n, t); }
3835
4027
  var ConfigPane = function ConfigPane(_ref) {
3836
4028
  var _schema$actions, _schema$actions$optio, _schema$actions2, _schema$actions2$opti, _action$recipient, _schema$actions3, _schema$actions3$acti, _concat$find, _schema$actions4, _schema$actions5, _schema$actions6, _schema$actions7, _schema$actions7$opti, _hostRenderConfig;
3837
4029
  var schema = _ref.schema,
@@ -3919,9 +4111,9 @@ var ConfigPane = function ConfigPane(_ref) {
3919
4111
  mediumLabel: mediumLabel
3920
4112
  }) || (option === null || option === void 0 ? void 0 : option.label) || t("neetoRules.builder.setUpAction");
3921
4113
  var handleContinue = /*#__PURE__*/function () {
3922
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
4114
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator$1().m(function _callee() {
3923
4115
  var owned, next;
3924
- return _regenerator().w(function (_context) {
4116
+ return _regenerator$1().w(function (_context) {
3925
4117
  while (1) switch (_context.n) {
3926
4118
  case 0:
3927
4119
  // A pane only answers for what it renders: the recipient pane owns its
@@ -3966,7 +4158,7 @@ var ConfigPane = function ConfigPane(_ref) {
3966
4158
  useHotkeys(SHORTCUTS["continue"].sequence, handleContinue, {
3967
4159
  mode: "global"
3968
4160
  });
3969
- return /*#__PURE__*/jsxs(Fragment, {
4161
+ return /*#__PURE__*/jsxs(Fragment$1, {
3970
4162
  children: [/*#__PURE__*/jsx(Panel.Header, {
3971
4163
  children: /*#__PURE__*/jsxs("div", {
3972
4164
  className: "flex w-full flex-col gap-y-2",
@@ -4076,7 +4268,7 @@ var DelayPane = function DelayPane(_ref) {
4076
4268
  return first.focus();
4077
4269
  }, 0);
4078
4270
  }, []);
4079
- return /*#__PURE__*/jsxs(Fragment, {
4271
+ return /*#__PURE__*/jsxs(Fragment$1, {
4080
4272
  children: [/*#__PURE__*/jsx(Panel.Header, {
4081
4273
  children: /*#__PURE__*/jsxs("div", {
4082
4274
  className: "flex flex-col gap-y-1",
@@ -4100,15 +4292,17 @@ var DelayPane = function DelayPane(_ref) {
4100
4292
  children: t("neetoRules.builder.waitFor")
4101
4293
  }), /*#__PURE__*/jsxs("div", {
4102
4294
  className: "flex items-start gap-x-2",
4103
- children: [/*#__PURE__*/jsx(Input$1, {
4295
+ children: [/*#__PURE__*/jsx("div", {
4104
4296
  className: "w-44",
4105
- dataTestid: "delay-value",
4106
- max: MAX_DELAY_VALUE,
4107
- min: MIN_DELAY_VALUE,
4108
- name: "".concat(name, ".value.value"),
4109
- placeholder: t("neetoRules.placeholders.enterDelay"),
4110
- size: "large",
4111
- type: "number"
4297
+ children: /*#__PURE__*/jsx(Input$1, {
4298
+ dataTestid: "delay-value",
4299
+ max: MAX_DELAY_VALUE,
4300
+ min: MIN_DELAY_VALUE,
4301
+ name: "".concat(name, ".value.value"),
4302
+ placeholder: t("neetoRules.placeholders.enterDelay"),
4303
+ size: "large",
4304
+ type: "number"
4305
+ })
4112
4306
  }), /*#__PURE__*/jsx(Select$1, {
4113
4307
  dataTestid: "delay-unit",
4114
4308
  defaultValue: value === null || value === void 0 ? void 0 : value.unit,
@@ -4258,7 +4452,7 @@ var LeadTimePane = function LeadTimePane(_ref) {
4258
4452
  setFieldTouched(path, true, false);
4259
4453
  // eslint-disable-next-line react-hooks/exhaustive-deps
4260
4454
  }, [rule.leadTime]);
4261
- return /*#__PURE__*/jsxs(Fragment, {
4455
+ return /*#__PURE__*/jsxs(Fragment$1, {
4262
4456
  children: [/*#__PURE__*/jsx(Panel.Header, {
4263
4457
  children: /*#__PURE__*/jsxs("div", {
4264
4458
  className: "flex flex-col gap-y-1",
@@ -4321,7 +4515,7 @@ var NamePane = function NamePane(_ref) {
4321
4515
  t = _useTranslation.t;
4322
4516
  var _useRuleModel = useRuleModel(schema),
4323
4517
  fieldKeys = _useRuleModel.fieldKeys;
4324
- return /*#__PURE__*/jsxs(Fragment, {
4518
+ return /*#__PURE__*/jsxs(Fragment$1, {
4325
4519
  children: [/*#__PURE__*/jsx(Panel.Header, {
4326
4520
  children: /*#__PURE__*/jsxs("div", {
4327
4521
  className: "flex flex-col gap-y-1",
@@ -4348,8 +4542,10 @@ var NamePane = function NamePane(_ref) {
4348
4542
  });
4349
4543
  };
4350
4544
 
4351
- function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4352
- function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4545
+ function ownKeys$3(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4546
+ function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4547
+ function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = false, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = true, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), true), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
4548
+ function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
4353
4549
  var OptionsPane = function OptionsPane(_ref) {
4354
4550
  var schema = _ref.schema,
4355
4551
  anchor = _ref.anchor,
@@ -4358,7 +4554,9 @@ var OptionsPane = function OptionsPane(_ref) {
4358
4554
  _ref$belowContent = _ref.belowContent,
4359
4555
  belowContent = _ref$belowContent === void 0 ? null : _ref$belowContent,
4360
4556
  _ref$configPending = _ref.configPending,
4361
- configPending = _ref$configPending === void 0 ? false : _ref$configPending;
4557
+ configPending = _ref$configPending === void 0 ? false : _ref$configPending,
4558
+ _ref$validate = _ref.validate,
4559
+ validate = _ref$validate === void 0 ? null : _ref$validate;
4362
4560
  var _useTranslation = useTranslation(),
4363
4561
  t = _useTranslation.t;
4364
4562
  var _useFormikContext = useFormikContext(),
@@ -4461,20 +4659,49 @@ var OptionsPane = function OptionsPane(_ref) {
4461
4659
  }
4462
4660
  };
4463
4661
  };
4464
- var handleContinue = function handleContinue() {
4465
- var target = continueTargetFor({
4466
- anchor: anchor,
4467
- schema: schema,
4468
- rule: rule,
4469
- index: index,
4470
- stepKey: stepKey,
4471
- configPending: configPending
4472
- });
4473
- if (target) openType({
4474
- type: target.type,
4475
- data: target.data
4476
- });else closePane();
4477
- };
4662
+ var handleContinue = /*#__PURE__*/function () {
4663
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
4664
+ var target, _t;
4665
+ return _regenerator().w(function (_context) {
4666
+ while (1) switch (_context.n) {
4667
+ case 0:
4668
+ _t = validate;
4669
+ if (!_t) {
4670
+ _context.n = 2;
4671
+ break;
4672
+ }
4673
+ _context.n = 1;
4674
+ return validate();
4675
+ case 1:
4676
+ _t = !_context.v;
4677
+ case 2:
4678
+ if (!_t) {
4679
+ _context.n = 3;
4680
+ break;
4681
+ }
4682
+ return _context.a(2);
4683
+ case 3:
4684
+ target = continueTargetFor({
4685
+ anchor: anchor,
4686
+ schema: schema,
4687
+ rule: rule,
4688
+ index: index,
4689
+ stepKey: stepKey,
4690
+ configPending: configPending
4691
+ });
4692
+ if (target) openType({
4693
+ type: target.type,
4694
+ data: target.data
4695
+ });else closePane();
4696
+ case 4:
4697
+ return _context.a(2);
4698
+ }
4699
+ }, _callee);
4700
+ }));
4701
+ return function handleContinue() {
4702
+ return _ref2.apply(this, arguments);
4703
+ };
4704
+ }();
4478
4705
  var canContinue = cascade && selectedValues.some(Boolean);
4479
4706
  useHotkeys(SHORTCUTS["continue"].sequence, handleContinue, {
4480
4707
  enabled: canContinue,
@@ -4514,7 +4741,7 @@ var OptionsPane = function OptionsPane(_ref) {
4514
4741
  color: "muted",
4515
4742
  variant: "body2",
4516
4743
  children: popover.description
4517
- }), popover.helpLinkProps && /*#__PURE__*/jsx(Button, _objectSpread$2(_objectSpread$2({}, popover.helpLinkProps), {}, {
4744
+ }), popover.helpLinkProps && /*#__PURE__*/jsx(Button, _objectSpread$3(_objectSpread$3({}, popover.helpLinkProps), {}, {
4518
4745
  className: "h-auto self-start p-0",
4519
4746
  size: "sm",
4520
4747
  variant: "link"
@@ -4550,13 +4777,13 @@ var OptionsPane = function OptionsPane(_ref) {
4550
4777
  if (multi) {
4551
4778
  return /*#__PURE__*/jsx("div", {
4552
4779
  className: "mb-pane-list flex flex-col",
4553
- children: groups.map(function (_ref2) {
4554
- var _ref3 = _slicedToArray(_ref2, 2),
4555
- category = _ref3[0],
4556
- items = _ref3[1];
4557
- return /*#__PURE__*/jsxs(Fragment$1, {
4780
+ children: groups.map(function (_ref3) {
4781
+ var _ref4 = _slicedToArray(_ref3, 2),
4782
+ category = _ref4[0],
4783
+ items = _ref4[1];
4784
+ return /*#__PURE__*/jsxs(Fragment, {
4558
4785
  children: [renderGroupHeader(category), items.map(function (option) {
4559
- return /*#__PURE__*/jsx(Checkbox, _objectSpread$2(_objectSpread$2({
4786
+ return /*#__PURE__*/jsx(Checkbox, _objectSpread$3(_objectSpread$3({
4560
4787
  checked: isSelected(option.value),
4561
4788
  disabled: option.disabled,
4562
4789
  label: optionLabel(option),
@@ -4576,15 +4803,15 @@ var OptionsPane = function OptionsPane(_ref) {
4576
4803
  orientation: "vertical",
4577
4804
  value: (_selectedValues$ = selectedValues === null || selectedValues === void 0 ? void 0 : selectedValues[0]) !== null && _selectedValues$ !== void 0 ? _selectedValues$ : "",
4578
4805
  onValueChange: handleSelect,
4579
- children: groups.flatMap(function (_ref4) {
4580
- var _ref5 = _slicedToArray(_ref4, 2),
4581
- category = _ref5[0],
4582
- items = _ref5[1];
4806
+ children: groups.flatMap(function (_ref5) {
4807
+ var _ref6 = _slicedToArray(_ref5, 2),
4808
+ category = _ref6[0],
4809
+ items = _ref6[1];
4583
4810
  return [category ? /*#__PURE__*/jsx("div", {
4584
4811
  className: "mb-pane-group",
4585
4812
  children: category
4586
4813
  }, "group-".concat(category)) : null].concat(_toConsumableArray(items.map(function (option) {
4587
- return /*#__PURE__*/jsx(RadioGroup.Item, _objectSpread$2(_objectSpread$2({
4814
+ return /*#__PURE__*/jsx(RadioGroup.Item, _objectSpread$3(_objectSpread$3({
4588
4815
  disabled: option.disabled,
4589
4816
  label: optionLabel(option),
4590
4817
  labelProps: previewHandlers(option.value),
@@ -4596,7 +4823,7 @@ var OptionsPane = function OptionsPane(_ref) {
4596
4823
  }).filter(Boolean)
4597
4824
  });
4598
4825
  };
4599
- return /*#__PURE__*/jsxs(Fragment, {
4826
+ return /*#__PURE__*/jsxs(Fragment$1, {
4600
4827
  children: [/*#__PURE__*/jsx(Panel.Header, {
4601
4828
  children: /*#__PURE__*/jsxs("div", {
4602
4829
  className: "flex w-full flex-col gap-y-2",
@@ -4722,8 +4949,16 @@ var RecipientPane = function RecipientPane(_ref) {
4722
4949
  });
4723
4950
  var flatOption = ((_schema$actions4 = schema.actions) === null || _schema$actions4 === void 0 || (_schema$actions4$opti = _schema$actions4.optionForName) === null || _schema$actions4$opti === void 0 ? void 0 : _schema$actions4$opti.call(_schema$actions4, action.name)) || ((_schema$actions5 = schema.actions) === null || _schema$actions5 === void 0 || (_schema$actions5$opti = _schema$actions5.optionForChannel) === null || _schema$actions5$opti === void 0 ? void 0 : _schema$actions5$opti.call(_schema$actions5, channel));
4724
4951
  var isSmsToNumbers = (flatOption === null || flatOption === void 0 ? void 0 : flatOption.type) === SMS_TO_NUMBERS;
4725
- var recipientFieldPath = isSmsToNumbers ? "".concat(name, ".").concat(RECIPIENT_STORAGE_FIELDS.phoneNumbers) : "".concat(name, ".").concat(RECIPIENT_STORAGE_FIELDS.emails);
4726
- usePaneValidation(recipientFieldPath);
4952
+ var recipientConfig = (((_schema$actions6 = schema.actions) === null || _schema$actions6 === void 0 ? void 0 : _schema$actions6.options) || []).flatMap(function (option) {
4953
+ return option.recipients || [];
4954
+ }).concat(((_schema$actions7 = schema.actions) === null || _schema$actions7 === void 0 ? void 0 : _schema$actions7.recipients) || []).find(function (item) {
4955
+ var _item$value;
4956
+ return ((_item$value = item.value) !== null && _item$value !== void 0 ? _item$value : item.id) === recipient;
4957
+ });
4958
+ var recipientStorageField = recipientConfig !== null && recipientConfig !== void 0 && recipientConfig.field && recipientConfig.field !== RECIPIENT_STORAGE_FIELDS.emails ? RECIPIENT_STORAGE_FIELDS.value : RECIPIENT_STORAGE_FIELDS.emails;
4959
+ var recipientFieldPath = isSmsToNumbers ? "".concat(name, ".").concat(RECIPIENT_STORAGE_FIELDS.phoneNumbers) : "".concat(name, ".").concat(recipientStorageField);
4960
+ var _usePaneValidation = usePaneValidation(recipientFieldPath),
4961
+ validate = _usePaneValidation.validate;
4727
4962
  useEffect(function () {
4728
4963
  var _bodyRef$current;
4729
4964
  if (!editor) return;
@@ -4734,12 +4969,6 @@ var RecipientPane = function RecipientPane(_ref) {
4734
4969
  }, 0);
4735
4970
  // eslint-disable-next-line react-hooks/exhaustive-deps
4736
4971
  }, [!editor]);
4737
- var recipientConfig = (((_schema$actions6 = schema.actions) === null || _schema$actions6 === void 0 ? void 0 : _schema$actions6.options) || []).flatMap(function (option) {
4738
- return option.recipients || [];
4739
- }).concat(((_schema$actions7 = schema.actions) === null || _schema$actions7 === void 0 ? void 0 : _schema$actions7.recipients) || []).find(function (item) {
4740
- var _item$value;
4741
- return ((_item$value = item.value) !== null && _item$value !== void 0 ? _item$value : item.id) === recipient;
4742
- });
4743
4972
  var builtInRecipientField = recipientConfig !== null && recipientConfig !== void 0 && recipientConfig.field ? /*#__PURE__*/jsx(RecipientField, {
4744
4973
  name: name,
4745
4974
  dropdownOptions: recipientConfig.dropdownOptions,
@@ -4779,13 +5008,14 @@ var RecipientPane = function RecipientPane(_ref) {
4779
5008
  configPending: configPending,
4780
5009
  index: index,
4781
5010
  schema: schema,
5011
+ validate: validate,
4782
5012
  anchor: BUILDER_ANCHORS.ACTION_RECIPIENT
4783
5013
  });
4784
5014
  }
4785
5015
 
4786
5016
  // eslint-disable-next-line security/detect-object-injection
4787
5017
  var meta = ((_schema$actions9 = schema.actions) === null || _schema$actions9 === void 0 || (_schema$actions9 = _schema$actions9.channelMeta) === null || _schema$actions9 === void 0 ? void 0 : _schema$actions9[channel]) || {};
4788
- return /*#__PURE__*/jsxs(Fragment, {
5018
+ return /*#__PURE__*/jsxs(Fragment$1, {
4789
5019
  children: [/*#__PURE__*/jsx(Panel.Header, {
4790
5020
  children: /*#__PURE__*/jsxs("div", {
4791
5021
  className: "flex w-full flex-col gap-y-2",
@@ -4808,6 +5038,8 @@ var RecipientPane = function RecipientPane(_ref) {
4808
5038
  });
4809
5039
  };
4810
5040
 
5041
+ function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5042
+ function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4811
5043
  var ConditionValueFields = function ConditionValueFields(_ref) {
4812
5044
  var name = _ref.name,
4813
5045
  field = _ref.field,
@@ -4913,6 +5145,42 @@ var ConditionValueFields = function ConditionValueFields(_ref) {
4913
5145
  })
4914
5146
  });
4915
5147
  }
5148
+ if (type === CONDITION_VALUE_TYPES.date) {
5149
+ var metadataPath = "".concat(name, ".metadata");
5150
+ var metadata = getIn(values, metadataPath) || {};
5151
+
5152
+ // Formik validates each write on a stale snapshot, so write it all at once.
5153
+ var handleDateChange = function handleDateChange(date) {
5154
+ var _globalProps$user;
5155
+ var format = field !== null && field !== void 0 && field.showTime ? DATE_TIME_FORMAT : DATE_FORMAT;
5156
+ setFieldTouched(valuePath, true, false);
5157
+ setFieldValue(metadataPath, _objectSpread$2(_objectSpread$2({}, metadata), {}, {
5158
+ // eslint-disable-next-line @bigbinary/neeto/use-standard-date-time-formats
5159
+ value: date ? dayjs(date).format(format) : "",
5160
+ type: field !== null && field !== void 0 && field.showTime ? DATE_TIME_TYPES.datetime : DATE_TIME_TYPES.date,
5161
+ format: format,
5162
+ timezone: globalProps === null || globalProps === void 0 || (_globalProps$user = globalProps.user) === null || _globalProps$user === void 0 ? void 0 : _globalProps$user.timeZone
5163
+ }));
5164
+ };
5165
+ return /*#__PURE__*/jsx(DatePicker, {
5166
+ required: true,
5167
+ error: fieldError(valuePath),
5168
+ label: t("neetoRules.form.selectDate"),
5169
+ showTime: field === null || field === void 0 ? void 0 : field.showTime,
5170
+ timeFormat: "HH:mm",
5171
+ type: "date",
5172
+ value: getDateTimeValue({
5173
+ date: metadata.value,
5174
+ format: metadata.format,
5175
+ type: metadata.type,
5176
+ timezone: metadata.timezone
5177
+ }) || undefined,
5178
+ onBlur: function onBlur() {
5179
+ return setFieldTouched(valuePath, true);
5180
+ },
5181
+ onChange: handleDateChange
5182
+ });
5183
+ }
4916
5184
  if (valueType === CONDITION_VALUE_TYPES.number) {
4917
5185
  var _getIn;
4918
5186
  return /*#__PURE__*/jsx(Input, {
@@ -4985,7 +5253,7 @@ var ValuePane = function ValuePane(_ref) {
4985
5253
  name: base
4986
5254
  });
4987
5255
  };
4988
- return /*#__PURE__*/jsxs(Fragment, {
5256
+ return /*#__PURE__*/jsxs(Fragment$1, {
4989
5257
  children: [/*#__PURE__*/jsx(Panel.Header, {
4990
5258
  children: /*#__PURE__*/jsxs("div", {
4991
5259
  className: "flex w-full flex-col gap-y-2",
@@ -5058,7 +5326,7 @@ var BUILDER_PANEL_TYPE_CONFIG_MAP = (_BUILDER_PANEL_TYPE_C = {}, _defineProperty
5058
5326
  function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5059
5327
  function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5060
5328
  var Form = function Form(_ref) {
5061
- var _schema$meta$showName, _schema$meta;
5329
+ var _rawSchema$actions, _schema$meta$showName, _schema$meta;
5062
5330
  var _ref$data = _ref.data,
5063
5331
  data = _ref$data === void 0 ? {} : _ref$data,
5064
5332
  _ref$schema = _ref.schema,
@@ -5091,17 +5359,24 @@ var Form = function Form(_ref) {
5091
5359
  var _useUtilityStore = useUtilityStore(useShallow(function (store) {
5092
5360
  return {
5093
5361
  resetPanelState: store["resetPanelState"],
5094
- errorFields: store["errorFields"]
5362
+ errorFields: store["errorFields"],
5363
+ setIsSaveAsTemplateEnabled: store["setIsSaveAsTemplateEnabled"]
5095
5364
  };
5096
5365
  })),
5097
5366
  resetPanelState = _useUtilityStore.resetPanelState,
5098
- errorFields = _useUtilityStore.errorFields;
5367
+ errorFields = _useUtilityStore.errorFields,
5368
+ setIsSaveAsTemplateEnabled = _useUtilityStore.setIsSaveAsTemplateEnabled;
5099
5369
  var initialValues = useMemo(function () {
5100
5370
  return formatData(data);
5101
5371
  }, [data]);
5102
5372
  var schema = useMemo(function () {
5103
5373
  return normalizeSchema(rawSchema);
5104
5374
  }, [rawSchema]);
5375
+ var isSaveAsTemplateEnabled = !!((_rawSchema$actions = rawSchema.actions) !== null && _rawSchema$actions !== void 0 && _rawSchema$actions.isSaveAsTemplateEnabled);
5376
+ useEffect(function () {
5377
+ setIsSaveAsTemplateEnabled(isSaveAsTemplateEnabled);
5378
+ // eslint-disable-next-line react-hooks/exhaustive-deps
5379
+ }, [isSaveAsTemplateEnabled]);
5105
5380
  var isNameRequired = isNameGenerationDisabled || ((_schema$meta$showName = (_schema$meta = schema.meta) === null || _schema$meta === void 0 ? void 0 : _schema$meta.showName) !== null && _schema$meta$showName !== void 0 ? _schema$meta$showName : true);
5106
5381
  var _usePollRuleName = usePollRuleName({
5107
5382
  url: url,