@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
@@ -2,7 +2,7 @@
2
2
 
3
3
  var _defineProperty = require('@babel/runtime/helpers/defineProperty');
4
4
  var _objectDestructuringEmpty = require('@babel/runtime/helpers/objectDestructuringEmpty');
5
- var keyboardShortcuts = require('../../keyboardShortcuts-CRInJJOU.js');
5
+ var keyboardShortcuts = require('../../keyboardShortcuts-CnEwhJom.js');
6
6
  var shallow = require('zustand/shallow');
7
7
  var react = require('react');
8
8
  var neetoAtoms = require('@bigbinary/neeto-atoms');
@@ -13,7 +13,7 @@ var neetoCist = require('@bigbinary/neeto-cist');
13
13
  var Container = require('@bigbinary/neeto-molecules/v2/Container');
14
14
  var Header = require('@bigbinary/neeto-molecules/v2/Header');
15
15
  var reactI18next = require('react-i18next');
16
- var index = require('../../index-D1PW24Zw.js');
16
+ var index = require('../../index-DvquzIBi.js');
17
17
  var useCustomDataStore = require('../../useCustomDataStore-DPmWkEhs.js');
18
18
  var useUtilityStore = require('../../useUtilityStore-gtPhFvpI.js');
19
19
  var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
@@ -23,6 +23,7 @@ var ramda = require('ramda');
23
23
  var Delete = require('@bigbinary/neeto-icons/Delete');
24
24
  var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
25
25
  var jsxRuntime = require('react/jsx-runtime');
26
+ var _typeof = require('@babel/runtime/helpers/typeof');
26
27
  var i18next = require('i18next');
27
28
  var yup = require('yup');
28
29
  var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
@@ -33,7 +34,7 @@ var utils$1 = require('../../utils-B3roKiff.js');
33
34
  var Up = require('@bigbinary/neeto-icons/Up');
34
35
  var Down = require('@bigbinary/neeto-icons/Down');
35
36
  var Info = require('@bigbinary/neeto-icons/Info');
36
- require('@babel/runtime/helpers/typeof');
37
+ var initializers = require('@bigbinary/neeto-commons-frontend/v2/initializers');
37
38
  require('../../useAutomationRulesApi-C1T2E1AN.js');
38
39
  require('@tanstack/react-query');
39
40
  require('@bigbinary/neeto-commons-frontend/react-utils');
@@ -49,7 +50,6 @@ require('@babel/runtime/helpers/toArray');
49
50
  require('@bigbinary/neeto-molecules/v2/PhoneNumber');
50
51
  require('react-select');
51
52
  require('../../constants-dLBadaIU.js');
52
- require('@bigbinary/neeto-commons-frontend/v2/initializers');
53
53
  require('@bigbinary/neeto-editor/v2/utils');
54
54
  require('zustand');
55
55
  require('@bigbinary/neeto-commons-frontend/initializers');
@@ -272,8 +272,8 @@ var useReplayFlash = function useReplayFlash(flashSeq) {
272
272
  };
273
273
 
274
274
  var _excluded$1 = ["children", "state", "active", "invalid", "onClick", "className", "dataTestid"];
275
- 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; }
276
- 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; }
275
+ 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; }
276
+ 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; }
277
277
  var Token = function Token(_ref) {
278
278
  var children = _ref.children,
279
279
  _ref$state = _ref.state,
@@ -288,7 +288,7 @@ var Token = function Token(_ref) {
288
288
  rest = _objectWithoutProperties(_ref, _excluded$1);
289
289
  var isInteractive = typeof onClick === "function" && state !== TOKEN_STATE.DISABLED;
290
290
  var tokenRef = useReplayFlash(invalid);
291
- return /*#__PURE__*/jsxRuntime.jsx("span", _objectSpread$c(_objectSpread$c({
291
+ return /*#__PURE__*/jsxRuntime.jsx("span", _objectSpread$e(_objectSpread$e({
292
292
  "data-testid": dataTestid,
293
293
  ref: tokenRef,
294
294
  role: isInteractive ? "button" : undefined,
@@ -310,8 +310,24 @@ var Token = function Token(_ref) {
310
310
  }));
311
311
  };
312
312
 
313
- 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; }
314
- 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; }
313
+ var Values = function Values(_ref) {
314
+ var _ref$values = _ref.values,
315
+ values = _ref$values === void 0 ? [] : _ref$values,
316
+ connector = _ref.connector;
317
+ return values.map(function (value, index) {
318
+ return /*#__PURE__*/jsxRuntime.jsxs(react.Fragment, {
319
+ children: [index > 0 && " ", index > 0 && connector && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
320
+ children: [/*#__PURE__*/jsxRuntime.jsx("span", {
321
+ className: "mb-tok-join",
322
+ children: connector
323
+ }), " "]
324
+ }), value]
325
+ }, "".concat(value, "-").concat(index));
326
+ });
327
+ };
328
+
329
+ 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; }
330
+ 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; }
315
331
  var humanize = function humanize(value) {
316
332
  return String(value !== null && value !== void 0 ? value : "").replace(/[._]/g, " ").trim();
317
333
  };
@@ -402,7 +418,32 @@ var conditionNeedsValue = function conditionNeedsValue(_ref7) {
402
418
  });
403
419
  return !((field === null || field === void 0 ? void 0 : field.noValueForVerbs) || []).includes(condition === null || condition === void 0 ? void 0 : condition.verb);
404
420
  };
405
- var conditionValueLabel = function conditionValueLabel(_ref8) {
421
+
422
+ // A multi-value token stays one clickable phrase, but its "and"/"or" is
423
+ // connective tissue rather than part of any value, so the canvas keeps the
424
+ // connector out of the token's own styling.
425
+ var valueParts = function valueParts(raw) {
426
+ if (ramda.isNil(raw) || raw === "") return null;
427
+ if (Array.isArray(raw)) {
428
+ return ramda.isEmpty(raw) ? null : {
429
+ values: raw.map(String)
430
+ };
431
+ }
432
+ if (_typeof(raw) === "object") {
433
+ var values = Array.isArray(raw.values) ? raw.values.map(String) : [];
434
+ return ramda.isEmpty(values) ? null : {
435
+ values: values,
436
+ connector: raw.connector
437
+ };
438
+ }
439
+ return {
440
+ values: [String(raw)]
441
+ };
442
+ };
443
+ var joinValues = function joinValues(parts) {
444
+ return (parts === null || parts === void 0 ? void 0 : parts.values.join(parts.connector ? " ".concat(parts.connector, " ") : " ")) || "";
445
+ };
446
+ var conditionValueParts = function conditionValueParts(_ref8) {
406
447
  var _ref9, _meta$value;
407
448
  var schema = _ref8.schema,
408
449
  condition = _ref8.condition;
@@ -422,23 +463,28 @@ var conditionValueLabel = function conditionValueLabel(_ref8) {
422
463
  return ((_candidate$value = candidate.value) !== null && _candidate$value !== void 0 ? _candidate$value : candidate.id) === value;
423
464
  });
424
465
  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;
425
- return isEnum ? String(label).toLowerCase() : label;
466
+ return isEnum ? String(label).toLowerCase() : String(label);
426
467
  };
427
468
  var connector = String((condition === null || condition === void 0 ? void 0 : condition.verb) || "").includes(CONDITION_VERBS.ALL_OF) ? i18next.t("neetoRules.operators.and") : i18next.t("neetoRules.operators.or");
428
- return Array.isArray(raw) ? raw.map(labelFor).join(" ".concat(connector, " ")) : String(labelFor(raw));
469
+ return Array.isArray(raw) ? {
470
+ values: raw.map(labelFor),
471
+ connector: connector
472
+ } : {
473
+ values: [labelFor(raw)]
474
+ };
429
475
  };
430
- var actionOption = function actionOption(_ref1) {
476
+ var actionOption = function actionOption(_ref10) {
431
477
  var _schema$actions;
432
- var schema = _ref1.schema,
433
- name = _ref1.name;
478
+ var schema = _ref10.schema,
479
+ name = _ref10.name;
434
480
  return ((schema === null || schema === void 0 || (_schema$actions = schema.actions) === null || _schema$actions === void 0 ? void 0 : _schema$actions.options) || []).find(function (option) {
435
481
  return option.value === name || option.id === name;
436
482
  });
437
483
  };
438
- var channelOption = function channelOption(_ref10) {
484
+ var channelOption = function channelOption(_ref11) {
439
485
  var _schema$actions2;
440
- var schema = _ref10.schema,
441
- channel = _ref10.channel;
486
+ var schema = _ref11.schema,
487
+ channel = _ref11.channel;
442
488
  return ((schema === null || schema === void 0 || (_schema$actions2 = schema.actions) === null || _schema$actions2 === void 0 ? void 0 : _schema$actions2.options) || []).find(function (option) {
443
489
  var _option$value;
444
490
  return ((_option$value = option.value) !== null && _option$value !== void 0 ? _option$value : option.id) === channel;
@@ -450,24 +496,24 @@ var channelOption = function channelOption(_ref10) {
450
496
  // Its key shares the action's metadata namespace, so declaring one is how a
451
497
  // host hands a field to the step: whoever declares it owns it, and the config
452
498
  // pane stops validating it.
453
- var actionStepsOf = function actionStepsOf(_ref11) {
454
- var schema = _ref11.schema,
455
- action = _ref11.action;
499
+ var actionStepsOf = function actionStepsOf(_ref12) {
500
+ var schema = _ref12.schema,
501
+ action = _ref12.action;
456
502
  return actionParts({
457
503
  schema: schema,
458
504
  action: action
459
505
  }).steps || [];
460
506
  };
461
- var stepValueOf = function stepValueOf(_ref12) {
507
+ var stepValueOf = function stepValueOf(_ref13) {
462
508
  var _action$metadata;
463
- var action = _ref12.action,
464
- step = _ref12.step;
509
+ var action = _ref13.action,
510
+ step = _ref13.step;
465
511
  return action === null || action === void 0 || (_action$metadata = action.metadata) === null || _action$metadata === void 0 ? void 0 : _action$metadata[step.key];
466
512
  };
467
- var stepLabelOf = function stepLabelOf(_ref13) {
513
+ var stepLabelOf = function stepLabelOf(_ref14) {
468
514
  var _find;
469
- var action = _ref13.action,
470
- step = _ref13.step;
515
+ var action = _ref14.action,
516
+ step = _ref14.step;
471
517
  var value = stepValueOf({
472
518
  action: action,
473
519
  step: step
@@ -477,10 +523,10 @@ var stepLabelOf = function stepLabelOf(_ref13) {
477
523
  return ((_option$value2 = option.value) !== null && _option$value2 !== void 0 ? _option$value2 : option.id) === value;
478
524
  })) === null || _find === void 0 ? void 0 : _find.label) || "";
479
525
  };
480
- var actionParts = function actionParts(_ref14) {
481
- var _actions$actionForNam, _action$recipient, _actions$channelMeta, _find2, _find3, _channelMeta$needsRec, _actions$configValueL;
482
- var schema = _ref14.schema,
483
- action = _ref14.action;
526
+ var actionParts = function actionParts(_ref15) {
527
+ var _actions$actionForNam, _action$recipient, _actions$channelMeta, _find2, _find3, _actions$configValueL, _channelMeta$needsRec;
528
+ var schema = _ref15.schema,
529
+ action = _ref15.action;
484
530
  var actions = (schema === null || schema === void 0 ? void 0 : schema.actions) || {};
485
531
  var resolved = action !== null && action !== void 0 && action.channel ? {
486
532
  channel: action.channel,
@@ -503,6 +549,10 @@ var actionParts = function actionParts(_ref14) {
503
549
  return ((_recipient$value = recipient.value) !== null && _recipient$value !== void 0 ? _recipient$value : recipient.id) === recipientValue;
504
550
  };
505
551
  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;
552
+
553
+ // A host may answer with a plain string or with { values, connector } when
554
+ // the value reads as a list.
555
+ var configValueParts = valueParts((_actions$configValueL = actions.configValueLabel) === null || _actions$configValueL === void 0 ? void 0 : _actions$configValueL.call(actions, action));
506
556
  return {
507
557
  option: option,
508
558
  channel: channel,
@@ -515,7 +565,8 @@ var actionParts = function actionParts(_ref14) {
515
565
  icon: channelMeta.icon || (option === null || option === void 0 ? void 0 : option.icon),
516
566
  needsRecipient: (_channelMeta$needsRec = channelMeta.needsRecipient) !== null && _channelMeta$needsRec !== void 0 ? _channelMeta$needsRec : option === null || option === void 0 ? void 0 : option.needsRecipient,
517
567
  separator: channelMeta.separator || (option === null || option === void 0 ? void 0 : option.separator),
518
- configValue: ((_actions$configValueL = actions.configValueLabel) === null || _actions$configValueL === void 0 ? void 0 : _actions$configValueL.call(actions, action)) || "",
568
+ configValueParts: configValueParts,
569
+ configValue: joinValues(configValueParts),
519
570
  configValuePlaceholder: channelMeta.valuePlaceholder || (option === null || option === void 0 ? void 0 : option.valuePlaceholder),
520
571
  recipient: recipientValue,
521
572
  recipientLabel: recipientLabel,
@@ -530,13 +581,13 @@ var actionParts = function actionParts(_ref14) {
530
581
  // Which condition fields a host offers can depend on the rule — a trigger may
531
582
  // only support a subset. Lookups deliberately keep using the full list so a
532
583
  // field already on the rule still resolves after the offer narrows.
533
- var offeredConditionFields = function offeredConditionFields(_ref15) {
534
- var _ref16, _schema$conditions$fi, _schema$conditions3, _schema$conditions3$f, _schema$conditions4;
535
- var schema = _ref15.schema,
536
- rule = _ref15.rule;
537
- 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, {
584
+ var offeredConditionFields = function offeredConditionFields(_ref16) {
585
+ var _ref17, _schema$conditions$fi, _schema$conditions3, _schema$conditions3$f, _schema$conditions4;
586
+ var schema = _ref16.schema,
587
+ rule = _ref16.rule;
588
+ 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, {
538
589
  rule: rule
539
- })) !== 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 : [];
590
+ })) !== 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 : [];
540
591
  };
541
592
  var hasTrigger = function hasTrigger(rule) {
542
593
  return !ramda.isEmpty((rule === null || rule === void 0 ? void 0 : rule.triggers) || []);
@@ -550,20 +601,20 @@ var isTriggerEnabled = function isTriggerEnabled(schema) {
550
601
  var _schema$triggers2;
551
602
  return (schema === null || schema === void 0 || (_schema$triggers2 = schema.triggers) === null || _schema$triggers2 === void 0 ? void 0 : _schema$triggers2.enabled) !== false;
552
603
  };
553
- var isTriggerSatisfied = function isTriggerSatisfied(_ref17) {
554
- var rule = _ref17.rule,
555
- schema = _ref17.schema;
556
- return !isTriggerEnabled(schema) || hasTrigger(rule);
557
- };
558
- var hasRequiredConditions = function hasRequiredConditions(_ref18) {
559
- var _schema$conditions5;
604
+ var isTriggerSatisfied = function isTriggerSatisfied(_ref18) {
560
605
  var rule = _ref18.rule,
561
606
  schema = _ref18.schema;
562
- return (schema === null || schema === void 0 || (_schema$conditions5 = schema.conditions) === null || _schema$conditions5 === void 0 ? void 0 : _schema$conditions5.allowEmpty) === false ? neetoCist.isNotEmpty((rule === null || rule === void 0 ? void 0 : rule.conditions) || []) : true;
607
+ return !isTriggerEnabled(schema) || hasTrigger(rule);
563
608
  };
564
- var hasUnansweredStep = function hasUnansweredStep(_ref19) {
609
+ var hasRequiredConditions = function hasRequiredConditions(_ref19) {
610
+ var _schema$conditions5;
565
611
  var rule = _ref19.rule,
566
612
  schema = _ref19.schema;
613
+ return (schema === null || schema === void 0 || (_schema$conditions5 = schema.conditions) === null || _schema$conditions5 === void 0 ? void 0 : _schema$conditions5.allowEmpty) === false ? neetoCist.isNotEmpty((rule === null || rule === void 0 ? void 0 : rule.conditions) || []) : true;
614
+ };
615
+ var hasUnansweredStep = function hasUnansweredStep(_ref20) {
616
+ var rule = _ref20.rule,
617
+ schema = _ref20.schema;
567
618
  return ((rule === null || rule === void 0 ? void 0 : rule.actions) || []).some(function (action) {
568
619
  return actionStepsOf({
569
620
  schema: schema,
@@ -576,9 +627,9 @@ var hasUnansweredStep = function hasUnansweredStep(_ref19) {
576
627
  });
577
628
  });
578
629
  };
579
- var isRuleComplete = function isRuleComplete(_ref20) {
580
- var rule = _ref20.rule,
581
- schema = _ref20.schema;
630
+ var isRuleComplete = function isRuleComplete(_ref21) {
631
+ var rule = _ref21.rule,
632
+ schema = _ref21.schema;
582
633
  return isTriggerSatisfied({
583
634
  rule: rule,
584
635
  schema: schema
@@ -590,28 +641,28 @@ var isRuleComplete = function isRuleComplete(_ref20) {
590
641
  schema: schema
591
642
  });
592
643
  };
593
- var scopeOptionFor = function scopeOptionFor(_ref21) {
644
+ var scopeOptionFor = function scopeOptionFor(_ref22) {
594
645
  var _item$value, _schema$scope;
595
- var schema = _ref21.schema,
596
- item = _ref21.item;
646
+ var schema = _ref22.schema,
647
+ item = _ref22.item;
597
648
  var value = (_item$value = item === null || item === void 0 ? void 0 : item.value) !== null && _item$value !== void 0 ? _item$value : item;
598
649
  return ((schema === null || schema === void 0 || (_schema$scope = schema.scope) === null || _schema$scope === void 0 ? void 0 : _schema$scope.options) || []).find(function (candidate) {
599
650
  var _candidate$value2;
600
651
  return ((_candidate$value2 = candidate.value) !== null && _candidate$value2 !== void 0 ? _candidate$value2 : candidate.id) === value;
601
652
  });
602
653
  };
603
- var scopePhoneFields = function scopePhoneFields(_ref22) {
604
- var _ref23, _item$phoneFields, _scopeOptionFor;
605
- var schema = _ref22.schema,
606
- item = _ref22.item;
607
- return (_ref23 = (_item$phoneFields = item === null || item === void 0 ? void 0 : item.phoneFields) !== null && _item$phoneFields !== void 0 ? _item$phoneFields : (_scopeOptionFor = scopeOptionFor({
654
+ var scopePhoneFields = function scopePhoneFields(_ref23) {
655
+ var _ref24, _item$phoneFields, _scopeOptionFor;
656
+ var schema = _ref23.schema,
657
+ item = _ref23.item;
658
+ return (_ref24 = (_item$phoneFields = item === null || item === void 0 ? void 0 : item.phoneFields) !== null && _item$phoneFields !== void 0 ? _item$phoneFields : (_scopeOptionFor = scopeOptionFor({
608
659
  schema: schema,
609
660
  item: item
610
- })) === null || _scopeOptionFor === void 0 ? void 0 : _scopeOptionFor.phoneFields) !== null && _ref23 !== void 0 ? _ref23 : null;
661
+ })) === null || _scopeOptionFor === void 0 ? void 0 : _scopeOptionFor.phoneFields) !== null && _ref24 !== void 0 ? _ref24 : null;
611
662
  };
612
- var effectiveScopePhoneField = function effectiveScopePhoneField(_ref24) {
613
- var schema = _ref24.schema,
614
- item = _ref24.item;
663
+ var effectiveScopePhoneField = function effectiveScopePhoneField(_ref25) {
664
+ var schema = _ref25.schema,
665
+ item = _ref25.item;
615
666
  if (item !== null && item !== void 0 && item.phoneField) return item.phoneField;
616
667
  var phoneFields = scopePhoneFields({
617
668
  schema: schema,
@@ -619,14 +670,14 @@ var effectiveScopePhoneField = function effectiveScopePhoneField(_ref24) {
619
670
  });
620
671
  return (phoneFields === null || phoneFields === void 0 ? void 0 : phoneFields.length) === 1 ? phoneFields[0].value : undefined;
621
672
  };
622
- var invalidScopeIndexes = function invalidScopeIndexes(_ref25) {
673
+ var invalidScopeIndexes = function invalidScopeIndexes(_ref26) {
623
674
  var _scope$requiresPhone;
624
- var rule = _ref25.rule,
625
- schema = _ref25.schema;
675
+ var rule = _ref26.rule,
676
+ schema = _ref26.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$requiresPhone = scope.requiresPhone) !== null && _scope$requiresPhone !== void 0 && _scope$requiresPhone.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) {
629
- var _ref26, _item$hasPhoneField;
680
+ var _ref27, _item$hasPhoneField;
630
681
  var option = scopeOptionFor({
631
682
  schema: schema,
632
683
  item: item
@@ -635,15 +686,15 @@ var invalidScopeIndexes = function invalidScopeIndexes(_ref25) {
635
686
  schema: schema,
636
687
  item: item
637
688
  });
638
- 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;
689
+ 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;
639
690
  if (hasPhoneField === false) indexes.push(index);
640
691
  return indexes;
641
692
  }, []);
642
693
  };
643
- var invalidScopePhoneFieldIndexes = function invalidScopePhoneFieldIndexes(_ref27) {
694
+ var invalidScopePhoneFieldIndexes = function invalidScopePhoneFieldIndexes(_ref28) {
644
695
  var _scope$requiresPhone2;
645
- var rule = _ref27.rule,
646
- schema = _ref27.schema;
696
+ var rule = _ref28.rule,
697
+ schema = _ref28.schema;
647
698
  var scope = schema === null || schema === void 0 ? void 0 : schema.scope;
648
699
  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 [];
649
700
  return ((rule === null || rule === void 0 ? void 0 : rule.scope) || []).reduce(function (indexes, item, index) {
@@ -680,9 +731,9 @@ var minutesToParts = function minutesToParts(minutes) {
680
731
  unit: "minutes"
681
732
  };
682
733
  };
683
- var partsToMinutes = function partsToMinutes(_ref28) {
684
- var value = _ref28.value,
685
- unit = _ref28.unit;
734
+ var partsToMinutes = function partsToMinutes(_ref29) {
735
+ var value = _ref29.value,
736
+ unit = _ref29.unit;
686
737
  return (
687
738
  // eslint-disable-next-line security/detect-object-injection
688
739
  (Number(value) || 0) * (UNIT_MINUTES[unit] || 1)
@@ -722,7 +773,7 @@ var normalizeTriggers = function normalizeTriggers(triggers) {
722
773
  };
723
774
  var normalizeSchema = function normalizeSchema() {
724
775
  var rawSchema = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
725
- return ramda.mergeDeepRight(DEFAULT_SCHEMA, _objectSpread$b(_objectSpread$b({}, rawSchema), {}, {
776
+ return ramda.mergeDeepRight(DEFAULT_SCHEMA, _objectSpread$d(_objectSpread$d({}, rawSchema), {}, {
726
777
  triggers: normalizeTriggers(rawSchema.triggers)
727
778
  }));
728
779
  };
@@ -736,11 +787,11 @@ var recipientStorageField = function recipientStorageField(field) {
736
787
  // Which metadata fields the recipient pane renders, and therefore owns: no
737
788
  // other pane may block Continue on them. Canvas and ConfigPane both ask here
738
789
  // so the two lists cannot drift apart.
739
- var recipientOwnedFields = function recipientOwnedFields(_ref29) {
790
+ var recipientOwnedFields = function recipientOwnedFields(_ref30) {
740
791
  var _actions$actionForNam2, _action$recipient2, _actions$renderRecipi, _actions$renderRecipi2, _actions$optionForNam, _actions$optionForCha;
741
- var schema = _ref29.schema,
742
- action = _ref29.action,
743
- name = _ref29.name;
792
+ var schema = _ref30.schema,
793
+ action = _ref30.action,
794
+ name = _ref30.name;
744
795
  var actions = (schema === null || schema === void 0 ? void 0 : schema.actions) || {};
745
796
  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)) || {};
746
797
  var channel = (action === null || action === void 0 ? void 0 : action.channel) || resolved.channel;
@@ -771,10 +822,10 @@ var modeFromJoinType = function modeFromJoinType(joinType) {
771
822
  };
772
823
 
773
824
  // eslint-disable-next-line security/detect-object-injection
774
- var valueAt = function valueAt(_ref30) {
825
+ var valueAt = function valueAt(_ref31) {
775
826
  var _values$key;
776
- var values = _ref30.values,
777
- key = _ref30.key;
827
+ var values = _ref31.values,
828
+ key = _ref31.key;
778
829
  return values === null || values === void 0 || (_values$key = values[key]) === null || _values$key === void 0 ? void 0 : _values$key.value;
779
830
  };
780
831
  var asArray = function asArray(maybeArray) {
@@ -797,11 +848,11 @@ var fieldKeysFromSchema = function fieldKeysFromSchema() {
797
848
  };
798
849
  var valuesToRuleModel = function valuesToRuleModel() {
799
850
  var _valueAt, _conditions$;
800
- var _ref31 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
801
- _ref31$values = _ref31.values,
802
- values = _ref31$values === void 0 ? {} : _ref31$values,
803
- _ref31$schema = _ref31.schema,
804
- schema = _ref31$schema === void 0 ? {} : _ref31$schema;
851
+ var _ref32 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
852
+ _ref32$values = _ref32.values,
853
+ values = _ref32$values === void 0 ? {} : _ref32$values,
854
+ _ref32$schema = _ref32.schema,
855
+ schema = _ref32$schema === void 0 ? {} : _ref32$schema;
805
856
  var keys = fieldKeysFromSchema(schema);
806
857
  var conditions = asArray(valueAt({
807
858
  values: values,
@@ -845,42 +896,77 @@ var valuesToRuleModel = function valuesToRuleModel() {
845
896
  }))
846
897
  };
847
898
  };
848
- var setTriggers = function setTriggers(_ref32) {
849
- var schema = _ref32.schema,
850
- triggers = _ref32.triggers;
899
+ var setTriggers = function setTriggers(_ref33) {
900
+ var schema = _ref33.schema,
901
+ triggers = _ref33.triggers;
851
902
  return {
852
903
  path: "".concat(fieldKeysFromSchema(schema).triggers, ".value"),
853
904
  value: triggers
854
905
  };
855
906
  };
856
- var setPerformer = function setPerformer(_ref33) {
857
- var schema = _ref33.schema,
858
- performer = _ref33.performer;
907
+
908
+ // Removed saved triggers must be sent with _destroy, or the backend keeps them.
909
+ var replaceTriggers = function replaceTriggers(_ref34) {
910
+ var schema = _ref34.schema,
911
+ values = _ref34.values,
912
+ triggers = _ref34.triggers;
913
+ var fieldKey = fieldKeysFromSchema(schema).triggers;
914
+ var keptIds = triggers.map(function (trigger) {
915
+ return trigger === null || trigger === void 0 ? void 0 : trigger.id;
916
+ }).filter(Boolean);
917
+ var removed = asArray(valueAt({
918
+ values: values,
919
+ key: fieldKey
920
+ })).filter(function (trigger) {
921
+ return (trigger === null || trigger === void 0 ? void 0 : trigger.id) && !keptIds.includes(trigger.id);
922
+ }).map(function (trigger) {
923
+ return _objectSpread$d(_objectSpread$d({}, trigger), {}, {
924
+ _destroy: true
925
+ });
926
+ });
927
+ var edits = [setTriggers({
928
+ schema: schema,
929
+ triggers: triggers
930
+ })];
931
+ if (removed.length) {
932
+ var _values$fieldKey;
933
+ // eslint-disable-next-line security/detect-object-injection
934
+ var deleted = asArray(values === null || values === void 0 || (_values$fieldKey = values[fieldKey]) === null || _values$fieldKey === void 0 ? void 0 : _values$fieldKey.deleted);
935
+ edits.push({
936
+ path: "".concat(fieldKey, ".deleted"),
937
+ value: [].concat(_toConsumableArray(deleted), _toConsumableArray(removed))
938
+ });
939
+ }
940
+ return edits;
941
+ };
942
+ var setPerformer = function setPerformer(_ref35) {
943
+ var schema = _ref35.schema,
944
+ performer = _ref35.performer;
859
945
  return {
860
946
  path: "".concat(fieldKeysFromSchema(schema).performer, ".value"),
861
947
  value: performer
862
948
  };
863
949
  };
864
- var setActions = function setActions(_ref34) {
865
- var schema = _ref34.schema,
866
- actions = _ref34.actions;
950
+ var setActions = function setActions(_ref36) {
951
+ var schema = _ref36.schema,
952
+ actions = _ref36.actions;
867
953
  return {
868
954
  path: "".concat(fieldKeysFromSchema(schema).actions, ".value"),
869
955
  value: actions
870
956
  };
871
957
  };
872
- var setConditions = function setConditions(_ref35) {
873
- var schema = _ref35.schema,
874
- conditions = _ref35.conditions;
958
+ var setConditions = function setConditions(_ref37) {
959
+ var schema = _ref37.schema,
960
+ conditions = _ref37.conditions;
875
961
  return {
876
962
  path: "".concat(fieldKeysFromSchema(schema).conditions, ".value"),
877
963
  value: conditions
878
964
  };
879
965
  };
880
- var setConditionMode = function setConditionMode(_ref36) {
881
- var schema = _ref36.schema,
882
- conditions = _ref36.conditions,
883
- joinType = _ref36.joinType;
966
+ var setConditionMode = function setConditionMode(_ref38) {
967
+ var schema = _ref38.schema,
968
+ conditions = _ref38.conditions,
969
+ joinType = _ref38.joinType;
884
970
  return setConditions({
885
971
  schema: schema,
886
972
  conditions: conditions.map(function (condition) {
@@ -888,34 +974,34 @@ var setConditionMode = function setConditionMode(_ref36) {
888
974
  })
889
975
  });
890
976
  };
891
- var setDelay = function setDelay(_ref37) {
892
- var schema = _ref37.schema,
893
- delay = _ref37.delay;
977
+ var setDelay = function setDelay(_ref39) {
978
+ var schema = _ref39.schema,
979
+ delay = _ref39.delay;
894
980
  return {
895
981
  path: "".concat(fieldKeysFromSchema(schema).delay, ".value"),
896
982
  value: delay !== null && delay !== void 0 ? delay : {}
897
983
  };
898
984
  };
899
- var setActive = function setActive(_ref38) {
900
- var schema = _ref38.schema,
901
- active = _ref38.active;
985
+ var setActive = function setActive(_ref40) {
986
+ var schema = _ref40.schema,
987
+ active = _ref40.active;
902
988
  return {
903
989
  path: "".concat(fieldKeysFromSchema(schema).status, ".value"),
904
990
  value: active ? STATUS_KEYS.ENABLED : STATUS_KEYS.DISABLED
905
991
  };
906
992
  };
907
- var setScope = function setScope(_ref39) {
908
- var schema = _ref39.schema,
909
- scope = _ref39.scope;
993
+ var setScope = function setScope(_ref41) {
994
+ var schema = _ref41.schema,
995
+ scope = _ref41.scope;
910
996
  return {
911
997
  path: "".concat(fieldKeysFromSchema(schema).scope, ".value"),
912
998
  value: scope
913
999
  };
914
1000
  };
915
- var removeArrayItem = function removeArrayItem(_ref40) {
916
- var values = _ref40.values,
917
- fieldKey = _ref40.fieldKey,
918
- index = _ref40.index;
1001
+ var removeArrayItem = function removeArrayItem(_ref42) {
1002
+ var values = _ref42.values,
1003
+ fieldKey = _ref42.fieldKey,
1004
+ index = _ref42.index;
919
1005
  var list = asArray(valueAt({
920
1006
  values: values,
921
1007
  key: fieldKey
@@ -930,21 +1016,21 @@ var removeArrayItem = function removeArrayItem(_ref40) {
930
1016
  value: nextList
931
1017
  }];
932
1018
  if (removed !== null && removed !== void 0 && removed.id) {
933
- var _values$fieldKey;
1019
+ var _values$fieldKey2;
934
1020
  // eslint-disable-next-line security/detect-object-injection
935
- var deleted = asArray(values === null || values === void 0 || (_values$fieldKey = values[fieldKey]) === null || _values$fieldKey === void 0 ? void 0 : _values$fieldKey.deleted);
1021
+ var deleted = asArray(values === null || values === void 0 || (_values$fieldKey2 = values[fieldKey]) === null || _values$fieldKey2 === void 0 ? void 0 : _values$fieldKey2.deleted);
936
1022
  result.push({
937
1023
  path: "".concat(fieldKey, ".deleted"),
938
- value: [].concat(_toConsumableArray(deleted), [_objectSpread$b(_objectSpread$b({}, removed), {}, {
1024
+ value: [].concat(_toConsumableArray(deleted), [_objectSpread$d(_objectSpread$d({}, removed), {}, {
939
1025
  _destroy: true
940
1026
  })])
941
1027
  });
942
1028
  }
943
1029
  return result;
944
1030
  };
945
- var clearArrayItems = function clearArrayItems(_ref41) {
946
- var values = _ref41.values,
947
- fieldKey = _ref41.fieldKey;
1031
+ var clearArrayItems = function clearArrayItems(_ref43) {
1032
+ var values = _ref43.values,
1033
+ fieldKey = _ref43.fieldKey;
948
1034
  var list = asArray(valueAt({
949
1035
  values: values,
950
1036
  key: fieldKey
@@ -952,7 +1038,7 @@ var clearArrayItems = function clearArrayItems(_ref41) {
952
1038
  var removed = list.filter(function (item) {
953
1039
  return item === null || item === void 0 ? void 0 : item.id;
954
1040
  }).map(function (item) {
955
- return _objectSpread$b(_objectSpread$b({}, item), {}, {
1041
+ return _objectSpread$d(_objectSpread$d({}, item), {}, {
956
1042
  _destroy: true
957
1043
  });
958
1044
  });
@@ -961,9 +1047,9 @@ var clearArrayItems = function clearArrayItems(_ref41) {
961
1047
  value: []
962
1048
  }];
963
1049
  if (removed.length) {
964
- var _values$fieldKey2;
1050
+ var _values$fieldKey3;
965
1051
  // eslint-disable-next-line security/detect-object-injection
966
- var deleted = asArray(values === null || values === void 0 || (_values$fieldKey2 = values[fieldKey]) === null || _values$fieldKey2 === void 0 ? void 0 : _values$fieldKey2.deleted);
1052
+ var deleted = asArray(values === null || values === void 0 || (_values$fieldKey3 = values[fieldKey]) === null || _values$fieldKey3 === void 0 ? void 0 : _values$fieldKey3.deleted);
967
1053
  result.push({
968
1054
  path: "".concat(fieldKey, ".deleted"),
969
1055
  value: [].concat(_toConsumableArray(deleted), _toConsumableArray(removed))
@@ -972,8 +1058,8 @@ var clearArrayItems = function clearArrayItems(_ref41) {
972
1058
  return result;
973
1059
  };
974
1060
 
975
- 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; }
976
- 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; }
1061
+ 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; }
1062
+ 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; }
977
1063
  var ConditionRow = function ConditionRow(_ref) {
978
1064
  var _schema$conditions;
979
1065
  var rule = _ref.rule,
@@ -1001,7 +1087,7 @@ var ConditionRow = function ConditionRow(_ref) {
1001
1087
  return ((_field$value = field.value) !== null && _field$value !== void 0 ? _field$value : field.id) === (condition === null || condition === void 0 ? void 0 : condition.field);
1002
1088
  });
1003
1089
  var operatorPlaceholder = (conditionField === null || conditionField === void 0 ? void 0 : conditionField.operatorPlaceholder) || t("neetoRules.builder.selectOperator");
1004
- var value = conditionValueLabel({
1090
+ var value = conditionValueParts({
1005
1091
  schema: schema,
1006
1092
  condition: condition
1007
1093
  });
@@ -1090,7 +1176,7 @@ var ConditionRow = function ConditionRow(_ref) {
1090
1176
  index: index
1091
1177
  });
1092
1178
  },
1093
- children: value || t("neetoRules.form.addValue")
1179
+ children: value ? /*#__PURE__*/jsxRuntime.jsx(Values, _objectSpread$c({}, value)) : t("neetoRules.form.addValue")
1094
1180
  })]
1095
1181
  }) : /*#__PURE__*/jsxRuntime.jsx(Token, {
1096
1182
  active: isActive({
@@ -1123,7 +1209,7 @@ var ConditionRow = function ConditionRow(_ref) {
1123
1209
  position: "top"
1124
1210
  },
1125
1211
  onClick: handleAddCondition
1126
- }), handleRemove && /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Button, _objectSpread$a({
1212
+ }), handleRemove && /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Button, _objectSpread$c({
1127
1213
  "data-testid": "cond-remove-".concat(index),
1128
1214
  icon: Delete,
1129
1215
  size: "sm",
@@ -1162,8 +1248,8 @@ var Connector = function Connector(_ref) {
1162
1248
  });
1163
1249
  };
1164
1250
 
1165
- 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; }
1166
- 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; }
1251
+ 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; }
1252
+ 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; }
1167
1253
  var DelayRow = function DelayRow(_ref) {
1168
1254
  var rule = _ref.rule,
1169
1255
  handleToken = _ref.onToken,
@@ -1215,7 +1301,7 @@ var DelayRow = function DelayRow(_ref) {
1215
1301
  })]
1216
1302
  }), handleRemove && /*#__PURE__*/jsxRuntime.jsx("div", {
1217
1303
  className: "mb-row-actions",
1218
- children: /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Button, _objectSpread$9({
1304
+ children: /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Button, _objectSpread$b({
1219
1305
  "data-testid": "rule-delay-remove",
1220
1306
  icon: Delete,
1221
1307
  size: "sm",
@@ -1305,8 +1391,8 @@ var MetaBlock = function MetaBlock(_ref) {
1305
1391
  });
1306
1392
  };
1307
1393
 
1308
- 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; }
1309
- 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; }
1394
+ 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; }
1395
+ 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; }
1310
1396
  var itemLabel = function itemLabel(item) {
1311
1397
  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 : "");
1312
1398
  };
@@ -1468,7 +1554,7 @@ var ScopeRow = function ScopeRow(_ref2) {
1468
1554
  type: BUILDER_ANCHORS.SCOPE
1469
1555
  });
1470
1556
  }
1471
- }), handleRemoveScope && /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Button, _objectSpread$8({
1557
+ }), handleRemoveScope && /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Button, _objectSpread$a({
1472
1558
  "data-testid": "scope-remove-".concat(index),
1473
1559
  icon: Delete,
1474
1560
  size: "sm",
@@ -1485,8 +1571,8 @@ var ScopeRow = function ScopeRow(_ref2) {
1485
1571
  });
1486
1572
  };
1487
1573
 
1488
- 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; }
1489
- 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; }
1574
+ 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; }
1575
+ 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; }
1490
1576
  var ActionRow = function ActionRow(_ref) {
1491
1577
  var schema = _ref.schema,
1492
1578
  action = _ref.action,
@@ -1519,6 +1605,7 @@ var ActionRow = function ActionRow(_ref) {
1519
1605
  recipientLabel = _actionParts.recipientLabel,
1520
1606
  separator = _actionParts.separator,
1521
1607
  configValue = _actionParts.configValue,
1608
+ configValueParts = _actionParts.configValueParts,
1522
1609
  configValuePlaceholder = _actionParts.configValuePlaceholder,
1523
1610
  paramKind = _actionParts.paramKind,
1524
1611
  valueNoun = _actionParts.valueNoun,
@@ -1553,7 +1640,7 @@ var ActionRow = function ActionRow(_ref) {
1553
1640
  configSeparator = _ref3[1];
1554
1641
  var isConfigured = neetoCist.isNotEmpty(action === null || action === void 0 ? void 0 : action.metadata);
1555
1642
  // A host that shows no value label still needs the token to read as filled.
1556
- var configState = configValue || isConfigured ? TOKEN_STATE.FILLED : TOKEN_STATE.MUTED;
1643
+ var configState = configValueParts || isConfigured ? TOKEN_STATE.FILLED : TOKEN_STATE.MUTED;
1557
1644
  var _useClearingHover = useClearingHover(),
1558
1645
  clearing = _useClearingHover.clearing,
1559
1646
  clearingHoverProps = _useClearingHover.clearingHoverProps;
@@ -1578,7 +1665,7 @@ var ActionRow = function ActionRow(_ref) {
1578
1665
  index: index
1579
1666
  });
1580
1667
  },
1581
- children: configValue || sentencify(configValuePlaceholder) || t("neetoRules.builder.selectFallback")
1668
+ children: configValueParts ? /*#__PURE__*/jsxRuntime.jsx(Values, _objectSpread$9({}, configValueParts)) : sentencify(configValuePlaceholder) || t("neetoRules.builder.selectFallback")
1582
1669
  })]
1583
1670
  }, "config") : null;
1584
1671
  var recipientToken = needsRecipient ? /*#__PURE__*/jsxRuntime.jsxs(react.Fragment, {
@@ -1681,7 +1768,7 @@ var ActionRow = function ActionRow(_ref) {
1681
1768
  index: index
1682
1769
  });
1683
1770
  },
1684
- children: configValue || sentencify(configValuePlaceholder) || paramPlaceholder
1771
+ children: configValueParts ? /*#__PURE__*/jsxRuntime.jsx(Values, _objectSpread$9({}, configValueParts)) : sentencify(configValuePlaceholder) || paramPlaceholder
1685
1772
  }) : configLabel && /*#__PURE__*/jsxRuntime.jsxs(Token, {
1686
1773
  className: "mb-tok-medium",
1687
1774
  dataTestid: "action-config-".concat(index),
@@ -1717,7 +1804,7 @@ var ActionRow = function ActionRow(_ref) {
1717
1804
  position: "top"
1718
1805
  },
1719
1806
  onClick: handleAddAction
1720
- }), handleRemove && /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Button, _objectSpread$7({
1807
+ }), handleRemove && /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Button, _objectSpread$9({
1721
1808
  "data-testid": "action-remove-".concat(index),
1722
1809
  icon: Delete,
1723
1810
  size: "sm",
@@ -1824,8 +1911,8 @@ var ThenBlock = function ThenBlock(_ref) {
1824
1911
  });
1825
1912
  };
1826
1913
 
1827
- 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; }
1828
- 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; }
1914
+ 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; }
1915
+ 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; }
1829
1916
  var WhenBlock = function WhenBlock(_ref) {
1830
1917
  var _schema$actor;
1831
1918
  var rule = _ref.rule,
@@ -1980,7 +2067,7 @@ var WhenBlock = function WhenBlock(_ref) {
1980
2067
  position: "top"
1981
2068
  },
1982
2069
  onClick: handleAddCondition
1983
- }), handleClearTrigger && /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Button, _objectSpread$6({
2070
+ }), handleClearTrigger && /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Button, _objectSpread$8({
1984
2071
  "data-testid": "trigger-clear",
1985
2072
  icon: Delete,
1986
2073
  size: "sm",
@@ -1999,8 +2086,8 @@ var WhenBlock = function WhenBlock(_ref) {
1999
2086
  };
2000
2087
 
2001
2088
  var _excluded = ["type"];
2002
- 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; }
2003
- 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; }
2089
+ 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; }
2090
+ 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; }
2004
2091
  var usePaneCascade = function usePaneCascade(schema) {
2005
2092
  var _useUtilityStore = useUtilityStore.useUtilityStore(shallow.useShallow(function (store) {
2006
2093
  return {
@@ -2018,7 +2105,7 @@ var usePaneCascade = function usePaneCascade(schema) {
2018
2105
  type: type,
2019
2106
  variant: "builder",
2020
2107
  size: LARGE_PANEL_TYPES.includes(type) ? "large" : "small",
2021
- data: _objectSpread$5({
2108
+ data: _objectSpread$7({
2022
2109
  schema: schema
2023
2110
  }, data)
2024
2111
  });
@@ -2030,7 +2117,7 @@ var usePaneCascade = function usePaneCascade(schema) {
2030
2117
  rest = _objectWithoutProperties(token, _excluded);
2031
2118
  openType({
2032
2119
  type: type,
2033
- data: _objectSpread$5({
2120
+ data: _objectSpread$7({
2034
2121
  anchor: anchor
2035
2122
  }, rest)
2036
2123
  });
@@ -2063,9 +2150,10 @@ var useRuleModel = function useRuleModel(schema) {
2063
2150
  return {
2064
2151
  rule: rule,
2065
2152
  fieldKeys: fieldKeysFromSchema(schema),
2066
- setTriggers: function setTriggers$1(triggers) {
2067
- return apply(setTriggers({
2153
+ setTriggers: function setTriggers(triggers) {
2154
+ return applyAll(replaceTriggers({
2068
2155
  schema: schema,
2156
+ values: values,
2069
2157
  triggers: triggers
2070
2158
  }));
2071
2159
  },
@@ -2147,8 +2235,8 @@ var useRuleModel = function useRuleModel(schema) {
2147
2235
  };
2148
2236
  };
2149
2237
 
2150
- 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; }
2151
- 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; }
2238
+ 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; }
2239
+ 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; }
2152
2240
  var triggerValue = function triggerValue(option) {
2153
2241
  var _ref, _option$eventValue;
2154
2242
  return (_ref = (_option$eventValue = option.eventValue) !== null && _option$eventValue !== void 0 ? _option$eventValue : option.value) !== null && _ref !== void 0 ? _ref : option.id;
@@ -2322,11 +2410,42 @@ var recipientsFor = function recipientsFor(_ref11) {
2322
2410
  if (option !== null && option !== void 0 && option.recipients) return option.recipients;
2323
2411
  return ((_schema$actions8 = schema.actions) === null || _schema$actions8 === void 0 ? void 0 : _schema$actions8.recipients) || [];
2324
2412
  };
2325
- var nextTriggers = function nextTriggers(_ref12) {
2326
- var _schema$triggers;
2413
+
2414
+ // Each action runs once per rule, so hide recipients another row already uses.
2415
+ var availableRecipients = function availableRecipients(_ref12) {
2327
2416
  var schema = _ref12.schema,
2328
2417
  rule = _ref12.rule,
2329
- value = _ref12.value;
2418
+ index = _ref12.index;
2419
+ var action = actionAt({
2420
+ rule: rule,
2421
+ index: index
2422
+ });
2423
+ var channel = channelOf({
2424
+ schema: schema,
2425
+ action: action
2426
+ });
2427
+ var usedNames = rule.actions.filter(function (_, position) {
2428
+ return position !== index;
2429
+ }).map(function (item) {
2430
+ return item.name;
2431
+ }).filter(Boolean);
2432
+ return recipientsFor({
2433
+ schema: schema,
2434
+ action: action
2435
+ }).filter(function (recipient) {
2436
+ var _schema$actions9, _schema$actions9$reso;
2437
+ 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, {
2438
+ channel: channel,
2439
+ recipient: optionValue(recipient)
2440
+ });
2441
+ return !name || !usedNames.includes(name);
2442
+ });
2443
+ };
2444
+ var nextTriggers = function nextTriggers(_ref13) {
2445
+ var _schema$triggers;
2446
+ var schema = _ref13.schema,
2447
+ rule = _ref13.rule,
2448
+ value = _ref13.value;
2330
2449
  if ((_schema$triggers = schema.triggers) !== null && _schema$triggers !== void 0 && _schema$triggers.multi) {
2331
2450
  var names = ramda.pluck("name", rule.triggers);
2332
2451
  return names.includes(value) ? neetoCist.removeBy({
@@ -2335,16 +2454,16 @@ var nextTriggers = function nextTriggers(_ref12) {
2335
2454
  name: value
2336
2455
  }]);
2337
2456
  }
2338
- return [_objectSpread$4(_objectSpread$4({}, rule.triggers[0]), {}, {
2457
+ return [_objectSpread$6(_objectSpread$6({}, rule.triggers[0]), {}, {
2339
2458
  name: value
2340
2459
  })];
2341
2460
  };
2342
- var nextConditionAt = function nextConditionAt(_ref13) {
2461
+ var nextConditionAt = function nextConditionAt(_ref14) {
2343
2462
  var _field$allowMatching;
2344
- var schema = _ref13.schema,
2345
- rule = _ref13.rule,
2346
- index = _ref13.index,
2347
- value = _ref13.value;
2463
+ var schema = _ref14.schema,
2464
+ rule = _ref14.rule,
2465
+ index = _ref14.index,
2466
+ value = _ref14.value;
2348
2467
  var field = findField({
2349
2468
  schema: schema,
2350
2469
  value: value
@@ -2356,20 +2475,20 @@ var nextConditionAt = function nextConditionAt(_ref13) {
2356
2475
  var first = field === null || field === void 0 || (_field$allowMatching = field.allowMatching) === null || _field$allowMatching === void 0 ? void 0 : _field$allowMatching[0];
2357
2476
  var defaultVerb = first && !((field === null || field === void 0 ? void 0 : field.noValueForVerbs) || []).includes(first) ? first : undefined;
2358
2477
  var verb = ((field === null || field === void 0 ? void 0 : field.allowMatching) || []).includes(previous.verb) ? previous.verb : defaultVerb;
2359
- return _objectSpread$4(_objectSpread$4({}, previous), {}, {
2478
+ return _objectSpread$6(_objectSpread$6({}, previous), {}, {
2360
2479
  field: value,
2361
2480
  kind: field === null || field === void 0 ? void 0 : field.kind,
2362
2481
  verb: verb,
2363
2482
  metadata: {}
2364
2483
  });
2365
2484
  };
2366
- var nextActionAt = function nextActionAt(_ref14) {
2367
- var _schema$actions9;
2368
- var schema = _ref14.schema,
2369
- rule = _ref14.rule,
2370
- index = _ref14.index,
2371
- value = _ref14.value;
2372
- if (!((_schema$actions9 = schema.actions) !== null && _schema$actions9 !== void 0 && _schema$actions9.resolveName)) {
2485
+ var nextActionAt = function nextActionAt(_ref15) {
2486
+ var _schema$actions0;
2487
+ var schema = _ref15.schema,
2488
+ rule = _ref15.rule,
2489
+ index = _ref15.index,
2490
+ value = _ref15.value;
2491
+ if (!((_schema$actions0 = schema.actions) !== null && _schema$actions0 !== void 0 && _schema$actions0.resolveName)) {
2373
2492
  var option = findActionOption({
2374
2493
  schema: schema,
2375
2494
  name: value
@@ -2380,7 +2499,7 @@ var nextActionAt = function nextActionAt(_ref14) {
2380
2499
  });
2381
2500
  if (option !== null && option !== void 0 && option.recipients) {
2382
2501
  var _channelChanged = _prev.channel !== value;
2383
- return _objectSpread$4(_objectSpread$4({}, _prev), {}, {
2502
+ return _objectSpread$6(_objectSpread$6({}, _prev), {}, {
2384
2503
  channel: value,
2385
2504
  recipient: _channelChanged ? undefined : _prev.recipient,
2386
2505
  name: "",
@@ -2388,7 +2507,7 @@ var nextActionAt = function nextActionAt(_ref14) {
2388
2507
  metadata: _channelChanged ? {} : _prev.metadata
2389
2508
  });
2390
2509
  }
2391
- return _objectSpread$4(_objectSpread$4({}, _prev), {}, {
2510
+ return _objectSpread$6(_objectSpread$6({}, _prev), {}, {
2392
2511
  channel: undefined,
2393
2512
  recipient: undefined,
2394
2513
  name: value,
@@ -2407,16 +2526,16 @@ var nextActionAt = function nextActionAt(_ref14) {
2407
2526
  var channelChanged = prevChannel !== value;
2408
2527
  var recipient = channelChanged ? undefined : prev.recipient;
2409
2528
  if (channelChanged) {
2410
- var _schema$actions0;
2529
+ var _schema$actions1;
2411
2530
  var channelRecipients =
2412
2531
  // eslint-disable-next-line security/detect-object-injection
2413
- ((_schema$actions0 = schema.actions) === null || _schema$actions0 === void 0 || (_schema$actions0 = _schema$actions0.recipientsByChannel) === null || _schema$actions0 === void 0 ? void 0 : _schema$actions0[value]) || [];
2532
+ ((_schema$actions1 = schema.actions) === null || _schema$actions1 === void 0 || (_schema$actions1 = _schema$actions1.recipientsByChannel) === null || _schema$actions1 === void 0 ? void 0 : _schema$actions1[value]) || [];
2414
2533
  if (channelRecipients.length === 1) {
2415
2534
  var _channelRecipients = _slicedToArray(channelRecipients, 1);
2416
2535
  recipient = _channelRecipients[0];
2417
2536
  }
2418
2537
  }
2419
- return _objectSpread$4(_objectSpread$4({}, prev), {}, {
2538
+ return _objectSpread$6(_objectSpread$6({}, prev), {}, {
2420
2539
  channel: value,
2421
2540
  recipient: recipient,
2422
2541
  name: schema.actions.resolveName({
@@ -2426,11 +2545,11 @@ var nextActionAt = function nextActionAt(_ref14) {
2426
2545
  metadata: channelChanged ? {} : prev.metadata
2427
2546
  });
2428
2547
  };
2429
- var appendScopeItem = function appendScopeItem(_ref15) {
2548
+ var appendScopeItem = function appendScopeItem(_ref16) {
2430
2549
  var _sc$requiresPhone;
2431
- var schema = _ref15.schema,
2432
- rule = _ref15.rule,
2433
- value = _ref15.value;
2550
+ var schema = _ref16.schema,
2551
+ rule = _ref16.rule,
2552
+ value = _ref16.value;
2434
2553
  var sc = schema.scope || {};
2435
2554
  var option = (sc.options || []).find(function (candidate) {
2436
2555
  return optionValue(candidate) === value;
@@ -2443,16 +2562,16 @@ var appendScopeItem = function appendScopeItem(_ref15) {
2443
2562
  schema: schema,
2444
2563
  item: option
2445
2564
  });
2446
- return (phoneFields === null || phoneFields === void 0 ? void 0 : phoneFields.length) === 1 ? _objectSpread$4(_objectSpread$4({}, option), {}, {
2565
+ return (phoneFields === null || phoneFields === void 0 ? void 0 : phoneFields.length) === 1 ? _objectSpread$6(_objectSpread$6({}, option), {}, {
2447
2566
  phoneField: phoneFields[0].value
2448
2567
  }) : option;
2449
2568
  };
2450
- var nextActionRecipientAt = function nextActionRecipientAt(_ref16) {
2451
- var _schema$actions1;
2452
- var schema = _ref16.schema,
2453
- rule = _ref16.rule,
2454
- index = _ref16.index,
2455
- value = _ref16.value;
2569
+ var nextActionRecipientAt = function nextActionRecipientAt(_ref17) {
2570
+ var _schema$actions10;
2571
+ var schema = _ref17.schema,
2572
+ rule = _ref17.rule,
2573
+ index = _ref17.index,
2574
+ value = _ref17.value;
2456
2575
  var prev = actionAt({
2457
2576
  rule: rule,
2458
2577
  index: index
@@ -2461,21 +2580,21 @@ var nextActionRecipientAt = function nextActionRecipientAt(_ref16) {
2461
2580
  schema: schema,
2462
2581
  action: prev
2463
2582
  });
2464
- return _objectSpread$4(_objectSpread$4({}, prev), {}, {
2583
+ return _objectSpread$6(_objectSpread$6({}, prev), {}, {
2465
2584
  recipient: value,
2466
- name: (_schema$actions1 = schema.actions) !== null && _schema$actions1 !== void 0 && _schema$actions1.resolveName ? schema.actions.resolveName({
2585
+ name: (_schema$actions10 = schema.actions) !== null && _schema$actions10 !== void 0 && _schema$actions10.resolveName ? schema.actions.resolveName({
2467
2586
  channel: channel,
2468
2587
  recipient: value
2469
2588
  }) : value
2470
2589
  });
2471
2590
  };
2472
- var descriptorFor = function descriptorFor(_ref17) {
2591
+ var descriptorFor = function descriptorFor(_ref18) {
2473
2592
  var _schema$actor2;
2474
- var anchor = _ref17.anchor,
2475
- schema = _ref17.schema,
2476
- rule = _ref17.rule,
2477
- index = _ref17.index,
2478
- stepKey = _ref17.stepKey;
2593
+ var anchor = _ref18.anchor,
2594
+ schema = _ref18.schema,
2595
+ rule = _ref18.rule,
2596
+ index = _ref18.index,
2597
+ stepKey = _ref18.stepKey;
2479
2598
  switch (anchor) {
2480
2599
  case BUILDER_ANCHORS.TRIGGER_ADD:
2481
2600
  case BUILDER_ANCHORS.TRIGGER_REPLACE:
@@ -2588,19 +2707,19 @@ var descriptorFor = function descriptorFor(_ref17) {
2588
2707
  case BUILDER_ANCHORS.ACTION_ADD:
2589
2708
  case BUILDER_ANCHORS.ACTION_CHANNEL:
2590
2709
  {
2591
- var _schema$actions11, _channelOf;
2710
+ var _schema$actions12, _channelOf;
2592
2711
  var isSwap = anchor === BUILDER_ANCHORS.ACTION_CHANNEL;
2593
2712
  var channelMetaFor = function channelMetaFor(value) {
2594
- var _schema$actions10;
2713
+ var _schema$actions11;
2595
2714
  return (
2596
2715
  // eslint-disable-next-line security/detect-object-injection
2597
- ((_schema$actions10 = schema.actions) === null || _schema$actions10 === void 0 || (_schema$actions10 = _schema$actions10.channelMeta) === null || _schema$actions10 === void 0 ? void 0 : _schema$actions10[value]) || {}
2716
+ ((_schema$actions11 = schema.actions) === null || _schema$actions11 === void 0 || (_schema$actions11 = _schema$actions11.channelMeta) === null || _schema$actions11 === void 0 ? void 0 : _schema$actions11[value]) || {}
2598
2717
  );
2599
2718
  };
2600
2719
 
2601
2720
  // Both panes list the host's actions in the order it declared them;
2602
2721
  // re-ranking only the swap pane made the two disagree.
2603
- var sourceOptions = ((_schema$actions11 = schema.actions) === null || _schema$actions11 === void 0 ? void 0 : _schema$actions11.options) || [];
2722
+ var sourceOptions = ((_schema$actions12 = schema.actions) === null || _schema$actions12 === void 0 ? void 0 : _schema$actions12.options) || [];
2604
2723
  return {
2605
2724
  title: isSwap ? i18next.t("neetoRules.builder.panes.actionSwapTitle") : i18next.t("neetoRules.builder.panes.actionAddTitle"),
2606
2725
  subtitle: isSwap ? i18next.t("neetoRules.builder.panes.actionSwapSubtitle") : i18next.t("neetoRules.builder.panes.actionAddSubtitle"),
@@ -2635,7 +2754,7 @@ var descriptorFor = function descriptorFor(_ref17) {
2635
2754
  }
2636
2755
  case BUILDER_ANCHORS.ACTION_RECIPIENT:
2637
2756
  {
2638
- var _schema$actions12;
2757
+ var _schema$actions13;
2639
2758
  var action = actionAt({
2640
2759
  rule: rule,
2641
2760
  index: index
@@ -2645,7 +2764,7 @@ var descriptorFor = function descriptorFor(_ref17) {
2645
2764
  action: action
2646
2765
  });
2647
2766
  // eslint-disable-next-line security/detect-object-injection
2648
- 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]) || {};
2767
+ 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]) || {};
2649
2768
  var option = findActionOption({
2650
2769
  schema: schema,
2651
2770
  name: channel
@@ -2653,9 +2772,10 @@ var descriptorFor = function descriptorFor(_ref17) {
2653
2772
  return {
2654
2773
  title: meta.recipientTitle || (option === null || option === void 0 ? void 0 : option.recipientTitle) || i18next.t("neetoRules.builder.panes.recipientTitle"),
2655
2774
  subtitle: meta.recipientSubtitle || (option === null || option === void 0 ? void 0 : option.recipientSubtitle) || i18next.t("neetoRules.builder.panes.recipientSubtitle"),
2656
- options: recipientsFor({
2775
+ options: availableRecipients({
2657
2776
  schema: schema,
2658
- action: action
2777
+ rule: rule,
2778
+ index: index
2659
2779
  }).map(function (recipient) {
2660
2780
  return {
2661
2781
  label: recipient.label,
@@ -2763,14 +2883,14 @@ var descriptorFor = function descriptorFor(_ref17) {
2763
2883
  };
2764
2884
  }
2765
2885
  };
2766
- var commitFor = function commitFor(_ref18) {
2767
- var anchor = _ref18.anchor,
2768
- schema = _ref18.schema,
2769
- rule = _ref18.rule,
2770
- index = _ref18.index,
2771
- stepKey = _ref18.stepKey,
2772
- value = _ref18.value,
2773
- helpers = _ref18.helpers;
2886
+ var commitFor = function commitFor(_ref19) {
2887
+ var anchor = _ref19.anchor,
2888
+ schema = _ref19.schema,
2889
+ rule = _ref19.rule,
2890
+ index = _ref19.index,
2891
+ stepKey = _ref19.stepKey,
2892
+ value = _ref19.value,
2893
+ helpers = _ref19.helpers;
2774
2894
  var setTriggers = helpers.setTriggers,
2775
2895
  setPerformer = helpers.setPerformer,
2776
2896
  setConditionMode = helpers.setConditionMode,
@@ -2790,7 +2910,7 @@ var commitFor = function commitFor(_ref18) {
2790
2910
  }]));
2791
2911
  return "stay";
2792
2912
  }
2793
- setTriggers([_objectSpread$4(_objectSpread$4({}, rule.triggers[0]), {}, {
2913
+ setTriggers([_objectSpread$6(_objectSpread$6({}, rule.triggers[0]), {}, {
2794
2914
  name: value
2795
2915
  })]);
2796
2916
  var leadTime = (_schema$triggers5 = schema.triggers) === null || _schema$triggers5 === void 0 ? void 0 : _schema$triggers5.leadTime;
@@ -2875,14 +2995,14 @@ var commitFor = function commitFor(_ref18) {
2875
2995
  return "close";
2876
2996
  }
2877
2997
  };
2878
- var continueTargetFor = function continueTargetFor(_ref19) {
2998
+ var continueTargetFor = function continueTargetFor(_ref20) {
2879
2999
  var _schema$actor3;
2880
- var anchor = _ref19.anchor,
2881
- schema = _ref19.schema,
2882
- rule = _ref19.rule,
2883
- index = _ref19.index,
2884
- stepKey = _ref19.stepKey,
2885
- configPending = _ref19.configPending;
3000
+ var anchor = _ref20.anchor,
3001
+ schema = _ref20.schema,
3002
+ rule = _ref20.rule,
3003
+ index = _ref20.index,
3004
+ stepKey = _ref20.stepKey,
3005
+ configPending = _ref20.configPending;
2886
3006
  switch (anchor) {
2887
3007
  case BUILDER_ANCHORS.TRIGGER_ADD:
2888
3008
  case BUILDER_ANCHORS.TRIGGER_REPLACE:
@@ -2994,25 +3114,25 @@ var continueTargetFor = function continueTargetFor(_ref19) {
2994
3114
  return null;
2995
3115
  }
2996
3116
  };
2997
- var replaceAt = function replaceAt(_ref20) {
2998
- var list = _ref20.list,
2999
- index = _ref20.index,
3000
- item = _ref20.item;
3117
+ var replaceAt = function replaceAt(_ref21) {
3118
+ var list = _ref21.list,
3119
+ index = _ref21.index,
3120
+ item = _ref21.item;
3001
3121
  var next = _toConsumableArray(list);
3002
3122
  // eslint-disable-next-line security/detect-object-injection
3003
3123
  next[index] = item;
3004
3124
  return next;
3005
3125
  };
3006
- var applyPreview = function applyPreview(_ref21) {
3007
- var rule = _ref21.rule,
3008
- schema = _ref21.schema,
3009
- anchor = _ref21.anchor,
3010
- index = _ref21.index,
3011
- value = _ref21.value;
3126
+ var applyPreview = function applyPreview(_ref22) {
3127
+ var rule = _ref22.rule,
3128
+ schema = _ref22.schema,
3129
+ anchor = _ref22.anchor,
3130
+ index = _ref22.index,
3131
+ value = _ref22.value;
3012
3132
  switch (anchor) {
3013
3133
  case BUILDER_ANCHORS.TRIGGER_ADD:
3014
3134
  case BUILDER_ANCHORS.TRIGGER_REPLACE:
3015
- return _objectSpread$4(_objectSpread$4({}, rule), {}, {
3135
+ return _objectSpread$6(_objectSpread$6({}, rule), {}, {
3016
3136
  triggers: Array.isArray(value) ? value.map(function (name) {
3017
3137
  return {
3018
3138
  name: name
@@ -3024,11 +3144,11 @@ var applyPreview = function applyPreview(_ref21) {
3024
3144
  })
3025
3145
  });
3026
3146
  case BUILDER_ANCHORS.TRIGGER_ACTOR:
3027
- return _objectSpread$4(_objectSpread$4({}, rule), {}, {
3147
+ return _objectSpread$6(_objectSpread$6({}, rule), {}, {
3028
3148
  performer: value
3029
3149
  });
3030
3150
  case BUILDER_ANCHORS.COND_FIELD:
3031
- return _objectSpread$4(_objectSpread$4({}, rule), {}, {
3151
+ return _objectSpread$6(_objectSpread$6({}, rule), {}, {
3032
3152
  conditions: replaceAt({
3033
3153
  list: rule.conditions,
3034
3154
  index: index,
@@ -3041,11 +3161,11 @@ var applyPreview = function applyPreview(_ref21) {
3041
3161
  })
3042
3162
  });
3043
3163
  case BUILDER_ANCHORS.COND_OP_TOGGLE:
3044
- return _objectSpread$4(_objectSpread$4({}, rule), {}, {
3164
+ return _objectSpread$6(_objectSpread$6({}, rule), {}, {
3045
3165
  conditions: replaceAt({
3046
3166
  list: rule.conditions,
3047
3167
  index: index,
3048
- item: _objectSpread$4(_objectSpread$4({}, conditionAt({
3168
+ item: _objectSpread$6(_objectSpread$6({}, conditionAt({
3049
3169
  rule: rule,
3050
3170
  index: index
3051
3171
  })), {}, {
@@ -3054,12 +3174,12 @@ var applyPreview = function applyPreview(_ref21) {
3054
3174
  })
3055
3175
  });
3056
3176
  case BUILDER_ANCHORS.COND_CONNECTOR:
3057
- return _objectSpread$4(_objectSpread$4({}, rule), {}, {
3177
+ return _objectSpread$6(_objectSpread$6({}, rule), {}, {
3058
3178
  conditionMode: value
3059
3179
  });
3060
3180
  case BUILDER_ANCHORS.ACTION_ADD:
3061
3181
  case BUILDER_ANCHORS.ACTION_CHANNEL:
3062
- return _objectSpread$4(_objectSpread$4({}, rule), {}, {
3182
+ return _objectSpread$6(_objectSpread$6({}, rule), {}, {
3063
3183
  actions: replaceAt({
3064
3184
  list: rule.actions,
3065
3185
  index: index,
@@ -3072,7 +3192,7 @@ var applyPreview = function applyPreview(_ref21) {
3072
3192
  })
3073
3193
  });
3074
3194
  case BUILDER_ANCHORS.ACTION_RECIPIENT:
3075
- return _objectSpread$4(_objectSpread$4({}, rule), {}, {
3195
+ return _objectSpread$6(_objectSpread$6({}, rule), {}, {
3076
3196
  actions: replaceAt({
3077
3197
  list: rule.actions,
3078
3198
  index: index,
@@ -3085,11 +3205,11 @@ var applyPreview = function applyPreview(_ref21) {
3085
3205
  })
3086
3206
  });
3087
3207
  case BUILDER_ANCHORS.SCOPE_PHONE_FIELD:
3088
- return _objectSpread$4(_objectSpread$4({}, rule), {}, {
3208
+ return _objectSpread$6(_objectSpread$6({}, rule), {}, {
3089
3209
  scope: replaceAt({
3090
3210
  list: rule.scope,
3091
3211
  index: index,
3092
- item: _objectSpread$4(_objectSpread$4({}, scopeItemAt({
3212
+ item: _objectSpread$6(_objectSpread$6({}, scopeItemAt({
3093
3213
  rule: rule,
3094
3214
  index: index
3095
3215
  })), {}, {
@@ -3102,8 +3222,8 @@ var applyPreview = function applyPreview(_ref21) {
3102
3222
  }
3103
3223
  };
3104
3224
 
3105
- 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; }
3106
- 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; }
3225
+ 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; }
3226
+ 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; }
3107
3227
  var Canvas = function Canvas(_ref) {
3108
3228
  var _schema$actor2, _ref6, _actorOptions$0$value, _schema$scope, _schema$conditions, _schema$triggers, _schema$delay, _schema$meta$showName, _schema$meta;
3109
3229
  var schema = _ref.schema;
@@ -3137,7 +3257,7 @@ var Canvas = function Canvas(_ref) {
3137
3257
  builderPreview = _useUtilityStore.builderPreview,
3138
3258
  panelState = _useUtilityStore.panelState;
3139
3259
  var displayRule = react.useMemo(function () {
3140
- return builderPreview ? applyPreview(_objectSpread$3({
3260
+ return builderPreview ? applyPreview(_objectSpread$5({
3141
3261
  rule: rule,
3142
3262
  schema: schema
3143
3263
  }, builderPreview)) : rule;
@@ -3525,7 +3645,115 @@ var CONDITION_VALUE_TYPES = {
3525
3645
  multiSelect: "multi-select",
3526
3646
  multiSelectCreate: "multi-select-create",
3527
3647
  number: "number",
3528
- email: "email"
3648
+ email: "email",
3649
+ date: "date"
3650
+ };
3651
+
3652
+ 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; }
3653
+ 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; }
3654
+ var EmailChannelFields = function EmailChannelFields(_ref) {
3655
+ var _getIn, _getIn2, _action$metadata;
3656
+ var name = _ref.name,
3657
+ option = _ref.option,
3658
+ action = _ref.action,
3659
+ options = _ref.options,
3660
+ hasRecipientField = _ref.hasRecipientField,
3661
+ hint = _ref.hint;
3662
+ var _useTranslation = reactI18next.useTranslation(),
3663
+ t = _useTranslation.t;
3664
+ var _useFormikContext = formik.useFormikContext(),
3665
+ values = _useFormikContext.values,
3666
+ errors = _useFormikContext.errors,
3667
+ touched = _useFormikContext.touched,
3668
+ setFieldValue = _useFormikContext.setFieldValue,
3669
+ setFieldTouched = _useFormikContext.setFieldTouched;
3670
+ var editorRef = react.useRef(null);
3671
+ var _useUtilityStore = useUtilityStore.useUtilityStore(shallow.useShallow(function (store) {
3672
+ return {
3673
+ isSaveAsTemplateEnabled: store["isSaveAsTemplateEnabled"]
3674
+ };
3675
+ })),
3676
+ isSaveAsTemplateEnabled = _useUtilityStore.isSaveAsTemplateEnabled;
3677
+ var hasFieldChanged = index.useHasFieldChanged(name);
3678
+ var valuePath = "".concat(name, ".value");
3679
+ var subjectPath = "".concat(name, ".subject");
3680
+ var bodyPath = "".concat(name, ".body");
3681
+ var templates = option === null || option === void 0 ? void 0 : option.templates;
3682
+ // Hosts whose email action picks its recipient from a list keep that
3683
+ // choice in the same pane as the message.
3684
+ var hasRecipientList = neetoCist.isNotEmpty(options) && !hasRecipientField;
3685
+ var fieldError = function fieldError(path) {
3686
+ return formik.getIn(touched, path) && formik.getIn(errors, path);
3687
+ };
3688
+ var shouldShowSaveAsTemplate = react.useCallback(function () {
3689
+ var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
3690
+ templateId = _ref2.templateId,
3691
+ subject = _ref2.subject,
3692
+ body = _ref2.body;
3693
+ var template = neetoCist.findBy({
3694
+ id: templateId
3695
+ }, templates);
3696
+ var hasContent = neetoCist.isPresent(subject) || neetoCist.isPresent(body);
3697
+ var isContentDifferentFromTemplate = !(index.areValuesEqual(template === null || template === void 0 ? void 0 : template.subject, subject) && (template === null || template === void 0 ? void 0 : template.body) === body);
3698
+ return hasContent && hasFieldChanged && isContentDifferentFromTemplate;
3699
+ }, [templates, hasFieldChanged]);
3700
+ var isSaveAsTemplateVisible = index.useResetSaveAsTemplateOnHide(name, isSaveAsTemplateEnabled ? shouldShowSaveAsTemplate : ramda.F);
3701
+
3702
+ // Formik validates each write on a stale snapshot, so write it all at once.
3703
+ var handleTemplateChange = function handleTemplateChange(template) {
3704
+ setFieldValue(name, _objectSpread$4(_objectSpread$4({}, formik.getIn(values, name)), {}, {
3705
+ templateId: template.id,
3706
+ body: template.body
3707
+ }, option !== null && option !== void 0 && option.hideSubject ? {} : {
3708
+ subject: template.subject
3709
+ }));
3710
+ index.setEditorContent(editorRef, template.body);
3711
+ };
3712
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
3713
+ className: "flex flex-col gap-4",
3714
+ children: [hasRecipientList && /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Select, {
3715
+ options: options,
3716
+ required: true,
3717
+ error: fieldError(valuePath),
3718
+ placeholder: option === null || option === void 0 ? void 0 : option.valuePlaceholder,
3719
+ size: "large",
3720
+ value: (_getIn = formik.getIn(values, valuePath)) !== null && _getIn !== void 0 ? _getIn : undefined,
3721
+ label: (option === null || option === void 0 ? void 0 : option.recipientLabel) || t("neetoRules.builder.config.recipient"),
3722
+ onBlur: function onBlur() {
3723
+ return setFieldTouched(valuePath, true);
3724
+ },
3725
+ onChange: function onChange(value) {
3726
+ return setFieldValue(valuePath, value);
3727
+ }
3728
+ }), neetoCist.isPresent(templates) && /*#__PURE__*/jsxRuntime.jsx(index.SelectTemplateField, {
3729
+ templates: templates,
3730
+ selectedField: option,
3731
+ onChange: handleTemplateChange
3732
+ }), !(option !== null && option !== void 0 && option.hideSubject) && /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Input, {
3733
+ required: true,
3734
+ error: fieldError(subjectPath),
3735
+ label: t("neetoRules.builder.config.subject"),
3736
+ placeholder: t("neetoRules.builder.config.subjectPlaceholder"),
3737
+ size: "large",
3738
+ value: (_getIn2 = formik.getIn(values, subjectPath)) !== null && _getIn2 !== void 0 ? _getIn2 : "",
3739
+ onBlur: function onBlur() {
3740
+ return setFieldTouched(subjectPath, true);
3741
+ },
3742
+ onChange: function onChange(event) {
3743
+ return setFieldValue(subjectPath, event.target.value);
3744
+ }
3745
+ }), /*#__PURE__*/jsxRuntime.jsx(index.EditorAction, {
3746
+ editorRef: editorRef,
3747
+ required: true,
3748
+ label: t("neetoRules.builder.config.body"),
3749
+ name: bodyPath,
3750
+ placeholder: t("neetoRules.builder.config.bodyPlaceholder"),
3751
+ value: action === null || action === void 0 || (_action$metadata = action.metadata) === null || _action$metadata === void 0 ? void 0 : _action$metadata.body,
3752
+ variables: option === null || option === void 0 ? void 0 : option.variables
3753
+ }), hint, isSaveAsTemplateVisible && /*#__PURE__*/jsxRuntime.jsx(index.SaveAsTemplate, {
3754
+ name: name
3755
+ })]
3756
+ });
3529
3757
  };
3530
3758
 
3531
3759
  var restoreTokens = function restoreTokens(text) {
@@ -3587,49 +3815,13 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
3587
3815
  });
3588
3816
  }
3589
3817
  if (type === ACTION_CONFIG_TYPES.emailChannel) {
3590
- var _getIn, _getIn2, _action$metadata;
3591
- var subjectPath = "".concat(name, ".subject");
3592
- var bodyPath = "".concat(name, ".body");
3593
- // Hosts whose email action picks its recipient from a list keep that
3594
- // choice in the same pane as the message.
3595
- var hasRecipientList = neetoCist.isNotEmpty(options) && !hasRecipientField;
3596
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
3597
- className: "flex flex-col gap-4",
3598
- children: [hasRecipientList && /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Select, {
3599
- options: options,
3600
- required: true,
3601
- error: fieldError(valuePath),
3602
- placeholder: option === null || option === void 0 ? void 0 : option.valuePlaceholder,
3603
- size: "large",
3604
- value: (_getIn = formik.getIn(values, valuePath)) !== null && _getIn !== void 0 ? _getIn : undefined,
3605
- label: (option === null || option === void 0 ? void 0 : option.recipientLabel) || t("neetoRules.builder.config.recipient"),
3606
- onBlur: function onBlur() {
3607
- return setFieldTouched(valuePath, true);
3608
- },
3609
- onChange: function onChange(value) {
3610
- return setFieldValue(valuePath, value);
3611
- }
3612
- }), !(option !== null && option !== void 0 && option.hideSubject) && /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Input, {
3613
- required: true,
3614
- error: fieldError(subjectPath),
3615
- label: t("neetoRules.builder.config.subject"),
3616
- placeholder: t("neetoRules.builder.config.subjectPlaceholder"),
3617
- size: "large",
3618
- value: (_getIn2 = formik.getIn(values, subjectPath)) !== null && _getIn2 !== void 0 ? _getIn2 : "",
3619
- onBlur: function onBlur() {
3620
- return setFieldTouched(subjectPath, true);
3621
- },
3622
- onChange: function onChange(event) {
3623
- return setFieldValue(subjectPath, event.target.value);
3624
- }
3625
- }), /*#__PURE__*/jsxRuntime.jsx(index.EditorAction, {
3626
- required: true,
3627
- label: t("neetoRules.builder.config.body"),
3628
- name: bodyPath,
3629
- placeholder: t("neetoRules.builder.config.bodyPlaceholder"),
3630
- value: action === null || action === void 0 || (_action$metadata = action.metadata) === null || _action$metadata === void 0 ? void 0 : _action$metadata.body,
3631
- variables: option === null || option === void 0 ? void 0 : option.variables
3632
- }), hintBlock]
3818
+ return /*#__PURE__*/jsxRuntime.jsx(EmailChannelFields, {
3819
+ action: action,
3820
+ hasRecipientField: hasRecipientField,
3821
+ name: name,
3822
+ option: option,
3823
+ options: options,
3824
+ hint: hintBlock
3633
3825
  });
3634
3826
  }
3635
3827
  if (type === ACTION_CONFIG_TYPES.multiSelect) {
@@ -3690,7 +3882,7 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
3690
3882
  });
3691
3883
  }
3692
3884
  if (type === ACTION_CONFIG_TYPES.note) {
3693
- var _action$metadata2;
3885
+ var _action$metadata;
3694
3886
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
3695
3887
  className: "flex flex-col gap-2",
3696
3888
  children: [/*#__PURE__*/jsxRuntime.jsx(index.EditorAction, {
@@ -3698,20 +3890,20 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
3698
3890
  label: t("neetoRules.builder.config.note"),
3699
3891
  name: valuePath,
3700
3892
  placeholder: t("neetoRules.builder.config.bodyPlaceholder"),
3701
- value: action === null || action === void 0 || (_action$metadata2 = action.metadata) === null || _action$metadata2 === void 0 ? void 0 : _action$metadata2.value,
3893
+ value: action === null || action === void 0 || (_action$metadata = action.metadata) === null || _action$metadata === void 0 ? void 0 : _action$metadata.value,
3702
3894
  variables: option === null || option === void 0 ? void 0 : option.variables
3703
3895
  }), hintBlock]
3704
3896
  });
3705
3897
  }
3706
3898
  if (type === ACTION_CONFIG_TYPES.textarea || type === ACTION_CONFIG_TYPES.number) {
3707
- var _getIn3, _getIn4;
3899
+ var _getIn, _getIn2;
3708
3900
  return type === ACTION_CONFIG_TYPES.number ? /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Input, {
3709
3901
  required: true,
3710
3902
  error: fieldError(valuePath),
3711
3903
  label: t("neetoRules.builder.config.value"),
3712
3904
  size: "large",
3713
3905
  type: "number",
3714
- value: (_getIn3 = formik.getIn(values, valuePath)) !== null && _getIn3 !== void 0 ? _getIn3 : "",
3906
+ value: (_getIn = formik.getIn(values, valuePath)) !== null && _getIn !== void 0 ? _getIn : "",
3715
3907
  onBlur: function onBlur() {
3716
3908
  return setFieldTouched(valuePath, true);
3717
3909
  },
@@ -3724,7 +3916,7 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
3724
3916
  label: t("neetoRules.builder.config.message"),
3725
3917
  rows: 5,
3726
3918
  size: "large",
3727
- value: (_getIn4 = formik.getIn(values, valuePath)) !== null && _getIn4 !== void 0 ? _getIn4 : "",
3919
+ value: (_getIn2 = formik.getIn(values, valuePath)) !== null && _getIn2 !== void 0 ? _getIn2 : "",
3728
3920
  onBlur: function onBlur() {
3729
3921
  return setFieldTouched(valuePath, true);
3730
3922
  },
@@ -3734,7 +3926,7 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
3734
3926
  });
3735
3927
  }
3736
3928
  if (type === ACTION_CONFIG_TYPES.text || type === ACTION_CONFIG_TYPES.regex || type === ACTION_CONFIG_TYPES.decimal) {
3737
- var _getIn5;
3929
+ var _getIn3;
3738
3930
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
3739
3931
  className: "flex flex-col gap-2",
3740
3932
  children: [/*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Input, {
@@ -3743,7 +3935,7 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
3743
3935
  label: t("neetoRules.builder.config.value"),
3744
3936
  placeholder: option === null || option === void 0 ? void 0 : option.valuePlaceholder,
3745
3937
  size: "large",
3746
- value: (_getIn5 = formik.getIn(values, valuePath)) !== null && _getIn5 !== void 0 ? _getIn5 : "",
3938
+ value: (_getIn3 = formik.getIn(values, valuePath)) !== null && _getIn3 !== void 0 ? _getIn3 : "",
3747
3939
  onBlur: function onBlur() {
3748
3940
  return setFieldTouched(valuePath, true);
3749
3941
  },
@@ -3779,8 +3971,8 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
3779
3971
  });
3780
3972
  };
3781
3973
 
3782
- 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 }; })(); }
3783
- 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); }
3974
+ 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 }; })(); }
3975
+ 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); }
3784
3976
  var keysUnder = function keysUnder(_ref) {
3785
3977
  var obj = _ref.obj,
3786
3978
  prefix = _ref.prefix,
@@ -3817,12 +4009,12 @@ var usePaneValidation = function usePaneValidation(prefix) {
3817
4009
  // eslint-disable-next-line react-hooks/exhaustive-deps
3818
4010
  }, [prefix]);
3819
4011
  var validate = /*#__PURE__*/function () {
3820
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator$1().m(function _callee() {
4012
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator$2().m(function _callee() {
3821
4013
  var exclude,
3822
4014
  nextErrors,
3823
4015
  offending,
3824
4016
  _args = arguments;
3825
- return _regenerator$1().w(function (_context) {
4017
+ return _regenerator$2().w(function (_context) {
3826
4018
  while (1) switch (_context.n) {
3827
4019
  case 0:
3828
4020
  exclude = _args.length > 0 && _args[0] !== undefined ? _args[0] : [];
@@ -3851,8 +4043,8 @@ var usePaneValidation = function usePaneValidation(prefix) {
3851
4043
  };
3852
4044
  };
3853
4045
 
3854
- 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 }; })(); }
3855
- 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); }
4046
+ 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 }; })(); }
4047
+ 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); }
3856
4048
  var ConfigPane = function ConfigPane(_ref) {
3857
4049
  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;
3858
4050
  var schema = _ref.schema,
@@ -3940,9 +4132,9 @@ var ConfigPane = function ConfigPane(_ref) {
3940
4132
  mediumLabel: mediumLabel
3941
4133
  }) || (option === null || option === void 0 ? void 0 : option.label) || t("neetoRules.builder.setUpAction");
3942
4134
  var handleContinue = /*#__PURE__*/function () {
3943
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
4135
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator$1().m(function _callee() {
3944
4136
  var owned, next;
3945
- return _regenerator().w(function (_context) {
4137
+ return _regenerator$1().w(function (_context) {
3946
4138
  while (1) switch (_context.n) {
3947
4139
  case 0:
3948
4140
  // A pane only answers for what it renders: the recipient pane owns its
@@ -4121,15 +4313,17 @@ var DelayPane = function DelayPane(_ref) {
4121
4313
  children: t("neetoRules.builder.waitFor")
4122
4314
  }), /*#__PURE__*/jsxRuntime.jsxs("div", {
4123
4315
  className: "flex items-start gap-x-2",
4124
- children: [/*#__PURE__*/jsxRuntime.jsx(formik$1.Input, {
4316
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
4125
4317
  className: "w-44",
4126
- dataTestid: "delay-value",
4127
- max: index.MAX_DELAY_VALUE,
4128
- min: index.MIN_DELAY_VALUE,
4129
- name: "".concat(name, ".value.value"),
4130
- placeholder: t("neetoRules.placeholders.enterDelay"),
4131
- size: "large",
4132
- type: "number"
4318
+ children: /*#__PURE__*/jsxRuntime.jsx(formik$1.Input, {
4319
+ dataTestid: "delay-value",
4320
+ max: index.MAX_DELAY_VALUE,
4321
+ min: index.MIN_DELAY_VALUE,
4322
+ name: "".concat(name, ".value.value"),
4323
+ placeholder: t("neetoRules.placeholders.enterDelay"),
4324
+ size: "large",
4325
+ type: "number"
4326
+ })
4133
4327
  }), /*#__PURE__*/jsxRuntime.jsx(formik$1.Select, {
4134
4328
  dataTestid: "delay-unit",
4135
4329
  defaultValue: value === null || value === void 0 ? void 0 : value.unit,
@@ -4369,8 +4563,10 @@ var NamePane = function NamePane(_ref) {
4369
4563
  });
4370
4564
  };
4371
4565
 
4372
- 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; }
4373
- 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; }
4566
+ 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; }
4567
+ 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; }
4568
+ 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 }; })(); }
4569
+ 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); }
4374
4570
  var OptionsPane = function OptionsPane(_ref) {
4375
4571
  var schema = _ref.schema,
4376
4572
  anchor = _ref.anchor,
@@ -4379,7 +4575,9 @@ var OptionsPane = function OptionsPane(_ref) {
4379
4575
  _ref$belowContent = _ref.belowContent,
4380
4576
  belowContent = _ref$belowContent === void 0 ? null : _ref$belowContent,
4381
4577
  _ref$configPending = _ref.configPending,
4382
- configPending = _ref$configPending === void 0 ? false : _ref$configPending;
4578
+ configPending = _ref$configPending === void 0 ? false : _ref$configPending,
4579
+ _ref$validate = _ref.validate,
4580
+ validate = _ref$validate === void 0 ? null : _ref$validate;
4383
4581
  var _useTranslation = reactI18next.useTranslation(),
4384
4582
  t = _useTranslation.t;
4385
4583
  var _useFormikContext = formik.useFormikContext(),
@@ -4482,20 +4680,49 @@ var OptionsPane = function OptionsPane(_ref) {
4482
4680
  }
4483
4681
  };
4484
4682
  };
4485
- var handleContinue = function handleContinue() {
4486
- var target = continueTargetFor({
4487
- anchor: anchor,
4488
- schema: schema,
4489
- rule: rule,
4490
- index: index$1,
4491
- stepKey: stepKey,
4492
- configPending: configPending
4493
- });
4494
- if (target) openType({
4495
- type: target.type,
4496
- data: target.data
4497
- });else closePane();
4498
- };
4683
+ var handleContinue = /*#__PURE__*/function () {
4684
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
4685
+ var target, _t;
4686
+ return _regenerator().w(function (_context) {
4687
+ while (1) switch (_context.n) {
4688
+ case 0:
4689
+ _t = validate;
4690
+ if (!_t) {
4691
+ _context.n = 2;
4692
+ break;
4693
+ }
4694
+ _context.n = 1;
4695
+ return validate();
4696
+ case 1:
4697
+ _t = !_context.v;
4698
+ case 2:
4699
+ if (!_t) {
4700
+ _context.n = 3;
4701
+ break;
4702
+ }
4703
+ return _context.a(2);
4704
+ case 3:
4705
+ target = continueTargetFor({
4706
+ anchor: anchor,
4707
+ schema: schema,
4708
+ rule: rule,
4709
+ index: index$1,
4710
+ stepKey: stepKey,
4711
+ configPending: configPending
4712
+ });
4713
+ if (target) openType({
4714
+ type: target.type,
4715
+ data: target.data
4716
+ });else closePane();
4717
+ case 4:
4718
+ return _context.a(2);
4719
+ }
4720
+ }, _callee);
4721
+ }));
4722
+ return function handleContinue() {
4723
+ return _ref2.apply(this, arguments);
4724
+ };
4725
+ }();
4499
4726
  var canContinue = cascade && selectedValues.some(Boolean);
4500
4727
  useHotkeys(keyboardShortcuts.SHORTCUTS["continue"].sequence, handleContinue, {
4501
4728
  enabled: canContinue,
@@ -4535,7 +4762,7 @@ var OptionsPane = function OptionsPane(_ref) {
4535
4762
  color: "muted",
4536
4763
  variant: "body2",
4537
4764
  children: popover.description
4538
- }), popover.helpLinkProps && /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Button, _objectSpread$2(_objectSpread$2({}, popover.helpLinkProps), {}, {
4765
+ }), popover.helpLinkProps && /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Button, _objectSpread$3(_objectSpread$3({}, popover.helpLinkProps), {}, {
4539
4766
  className: "h-auto self-start p-0",
4540
4767
  size: "sm",
4541
4768
  variant: "link"
@@ -4571,13 +4798,13 @@ var OptionsPane = function OptionsPane(_ref) {
4571
4798
  if (multi) {
4572
4799
  return /*#__PURE__*/jsxRuntime.jsx("div", {
4573
4800
  className: "mb-pane-list flex flex-col",
4574
- children: groups.map(function (_ref2) {
4575
- var _ref3 = _slicedToArray(_ref2, 2),
4576
- category = _ref3[0],
4577
- items = _ref3[1];
4801
+ children: groups.map(function (_ref3) {
4802
+ var _ref4 = _slicedToArray(_ref3, 2),
4803
+ category = _ref4[0],
4804
+ items = _ref4[1];
4578
4805
  return /*#__PURE__*/jsxRuntime.jsxs(react.Fragment, {
4579
4806
  children: [renderGroupHeader(category), items.map(function (option) {
4580
- return /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Checkbox, _objectSpread$2(_objectSpread$2({
4807
+ return /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Checkbox, _objectSpread$3(_objectSpread$3({
4581
4808
  checked: isSelected(option.value),
4582
4809
  disabled: option.disabled,
4583
4810
  label: optionLabel(option),
@@ -4597,15 +4824,15 @@ var OptionsPane = function OptionsPane(_ref) {
4597
4824
  orientation: "vertical",
4598
4825
  value: (_selectedValues$ = selectedValues === null || selectedValues === void 0 ? void 0 : selectedValues[0]) !== null && _selectedValues$ !== void 0 ? _selectedValues$ : "",
4599
4826
  onValueChange: handleSelect,
4600
- children: groups.flatMap(function (_ref4) {
4601
- var _ref5 = _slicedToArray(_ref4, 2),
4602
- category = _ref5[0],
4603
- items = _ref5[1];
4827
+ children: groups.flatMap(function (_ref5) {
4828
+ var _ref6 = _slicedToArray(_ref5, 2),
4829
+ category = _ref6[0],
4830
+ items = _ref6[1];
4604
4831
  return [category ? /*#__PURE__*/jsxRuntime.jsx("div", {
4605
4832
  className: "mb-pane-group",
4606
4833
  children: category
4607
4834
  }, "group-".concat(category)) : null].concat(_toConsumableArray(items.map(function (option) {
4608
- return /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.RadioGroup.Item, _objectSpread$2(_objectSpread$2({
4835
+ return /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.RadioGroup.Item, _objectSpread$3(_objectSpread$3({
4609
4836
  disabled: option.disabled,
4610
4837
  label: optionLabel(option),
4611
4838
  labelProps: previewHandlers(option.value),
@@ -4743,8 +4970,16 @@ var RecipientPane = function RecipientPane(_ref) {
4743
4970
  });
4744
4971
  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));
4745
4972
  var isSmsToNumbers = (flatOption === null || flatOption === void 0 ? void 0 : flatOption.type) === SMS_TO_NUMBERS;
4746
- var recipientFieldPath = isSmsToNumbers ? "".concat(name, ".").concat(RECIPIENT_STORAGE_FIELDS.phoneNumbers) : "".concat(name, ".").concat(RECIPIENT_STORAGE_FIELDS.emails);
4747
- usePaneValidation(recipientFieldPath);
4973
+ var recipientConfig = (((_schema$actions6 = schema.actions) === null || _schema$actions6 === void 0 ? void 0 : _schema$actions6.options) || []).flatMap(function (option) {
4974
+ return option.recipients || [];
4975
+ }).concat(((_schema$actions7 = schema.actions) === null || _schema$actions7 === void 0 ? void 0 : _schema$actions7.recipients) || []).find(function (item) {
4976
+ var _item$value;
4977
+ return ((_item$value = item.value) !== null && _item$value !== void 0 ? _item$value : item.id) === recipient;
4978
+ });
4979
+ var recipientStorageField = recipientConfig !== null && recipientConfig !== void 0 && recipientConfig.field && recipientConfig.field !== RECIPIENT_STORAGE_FIELDS.emails ? RECIPIENT_STORAGE_FIELDS.value : RECIPIENT_STORAGE_FIELDS.emails;
4980
+ var recipientFieldPath = isSmsToNumbers ? "".concat(name, ".").concat(RECIPIENT_STORAGE_FIELDS.phoneNumbers) : "".concat(name, ".").concat(recipientStorageField);
4981
+ var _usePaneValidation = usePaneValidation(recipientFieldPath),
4982
+ validate = _usePaneValidation.validate;
4748
4983
  react.useEffect(function () {
4749
4984
  var _bodyRef$current;
4750
4985
  if (!editor) return;
@@ -4755,12 +4990,6 @@ var RecipientPane = function RecipientPane(_ref) {
4755
4990
  }, 0);
4756
4991
  // eslint-disable-next-line react-hooks/exhaustive-deps
4757
4992
  }, [!editor]);
4758
- var recipientConfig = (((_schema$actions6 = schema.actions) === null || _schema$actions6 === void 0 ? void 0 : _schema$actions6.options) || []).flatMap(function (option) {
4759
- return option.recipients || [];
4760
- }).concat(((_schema$actions7 = schema.actions) === null || _schema$actions7 === void 0 ? void 0 : _schema$actions7.recipients) || []).find(function (item) {
4761
- var _item$value;
4762
- return ((_item$value = item.value) !== null && _item$value !== void 0 ? _item$value : item.id) === recipient;
4763
- });
4764
4993
  var builtInRecipientField = recipientConfig !== null && recipientConfig !== void 0 && recipientConfig.field ? /*#__PURE__*/jsxRuntime.jsx(RecipientField, {
4765
4994
  name: name,
4766
4995
  dropdownOptions: recipientConfig.dropdownOptions,
@@ -4800,6 +5029,7 @@ var RecipientPane = function RecipientPane(_ref) {
4800
5029
  configPending: configPending,
4801
5030
  index: index$1,
4802
5031
  schema: schema,
5032
+ validate: validate,
4803
5033
  anchor: BUILDER_ANCHORS.ACTION_RECIPIENT
4804
5034
  });
4805
5035
  }
@@ -4829,6 +5059,8 @@ var RecipientPane = function RecipientPane(_ref) {
4829
5059
  });
4830
5060
  };
4831
5061
 
5062
+ 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; }
5063
+ 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; }
4832
5064
  var ConditionValueFields = function ConditionValueFields(_ref) {
4833
5065
  var name = _ref.name,
4834
5066
  field = _ref.field,
@@ -4934,6 +5166,42 @@ var ConditionValueFields = function ConditionValueFields(_ref) {
4934
5166
  })
4935
5167
  });
4936
5168
  }
5169
+ if (type === CONDITION_VALUE_TYPES.date) {
5170
+ var metadataPath = "".concat(name, ".metadata");
5171
+ var metadata = formik.getIn(values, metadataPath) || {};
5172
+
5173
+ // Formik validates each write on a stale snapshot, so write it all at once.
5174
+ var handleDateChange = function handleDateChange(date) {
5175
+ var _globalProps$user;
5176
+ var format = field !== null && field !== void 0 && field.showTime ? utils$1.DATE_TIME_FORMAT : utils$1.DATE_FORMAT;
5177
+ setFieldTouched(valuePath, true, false);
5178
+ setFieldValue(metadataPath, _objectSpread$2(_objectSpread$2({}, metadata), {}, {
5179
+ // eslint-disable-next-line @bigbinary/neeto/use-standard-date-time-formats
5180
+ value: date ? utils.dayjs(date).format(format) : "",
5181
+ type: field !== null && field !== void 0 && field.showTime ? utils$1.DATE_TIME_TYPES.datetime : utils$1.DATE_TIME_TYPES.date,
5182
+ format: format,
5183
+ timezone: initializers.globalProps === null || initializers.globalProps === void 0 || (_globalProps$user = initializers.globalProps.user) === null || _globalProps$user === void 0 ? void 0 : _globalProps$user.timeZone
5184
+ }));
5185
+ };
5186
+ return /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.DatePicker, {
5187
+ required: true,
5188
+ error: fieldError(valuePath),
5189
+ label: t("neetoRules.form.selectDate"),
5190
+ showTime: field === null || field === void 0 ? void 0 : field.showTime,
5191
+ timeFormat: "HH:mm",
5192
+ type: "date",
5193
+ value: utils$1.getDateTimeValue({
5194
+ date: metadata.value,
5195
+ format: metadata.format,
5196
+ type: metadata.type,
5197
+ timezone: metadata.timezone
5198
+ }) || undefined,
5199
+ onBlur: function onBlur() {
5200
+ return setFieldTouched(valuePath, true);
5201
+ },
5202
+ onChange: handleDateChange
5203
+ });
5204
+ }
4937
5205
  if (valueType === CONDITION_VALUE_TYPES.number) {
4938
5206
  var _getIn;
4939
5207
  return /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Input, {
@@ -5079,7 +5347,7 @@ var BUILDER_PANEL_TYPE_CONFIG_MAP = (_BUILDER_PANEL_TYPE_C = {}, _defineProperty
5079
5347
  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; }
5080
5348
  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; }
5081
5349
  var Form = function Form(_ref) {
5082
- var _schema$meta$showName, _schema$meta;
5350
+ var _rawSchema$actions, _schema$meta$showName, _schema$meta;
5083
5351
  var _ref$data = _ref.data,
5084
5352
  data = _ref$data === void 0 ? {} : _ref$data,
5085
5353
  _ref$schema = _ref.schema,
@@ -5112,17 +5380,24 @@ var Form = function Form(_ref) {
5112
5380
  var _useUtilityStore = useUtilityStore.useUtilityStore(shallow.useShallow(function (store) {
5113
5381
  return {
5114
5382
  resetPanelState: store["resetPanelState"],
5115
- errorFields: store["errorFields"]
5383
+ errorFields: store["errorFields"],
5384
+ setIsSaveAsTemplateEnabled: store["setIsSaveAsTemplateEnabled"]
5116
5385
  };
5117
5386
  })),
5118
5387
  resetPanelState = _useUtilityStore.resetPanelState,
5119
- errorFields = _useUtilityStore.errorFields;
5388
+ errorFields = _useUtilityStore.errorFields,
5389
+ setIsSaveAsTemplateEnabled = _useUtilityStore.setIsSaveAsTemplateEnabled;
5120
5390
  var initialValues = react.useMemo(function () {
5121
5391
  return index.formatData(data);
5122
5392
  }, [data]);
5123
5393
  var schema = react.useMemo(function () {
5124
5394
  return normalizeSchema(rawSchema);
5125
5395
  }, [rawSchema]);
5396
+ var isSaveAsTemplateEnabled = !!((_rawSchema$actions = rawSchema.actions) !== null && _rawSchema$actions !== void 0 && _rawSchema$actions.isSaveAsTemplateEnabled);
5397
+ react.useEffect(function () {
5398
+ setIsSaveAsTemplateEnabled(isSaveAsTemplateEnabled);
5399
+ // eslint-disable-next-line react-hooks/exhaustive-deps
5400
+ }, [isSaveAsTemplateEnabled]);
5126
5401
  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);
5127
5402
  var _usePollRuleName = index.usePollRuleName({
5128
5403
  url: url,