@bigbinary/neeto-rules-frontend 2.7.22 → 2.7.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/javascript/src/translations/en.json +1 -0
- package/dist/.ready +1 -1
- package/dist/NeetoRulesBuilder.js +2 -2
- package/dist/NeetoRulesForm.js +2 -2
- package/dist/cjs/NeetoRulesBuilder.js +2 -2
- package/dist/cjs/NeetoRulesForm.js +2 -2
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/v2/NeetoRulesBuilder.js +343 -170
- package/dist/cjs/v2/NeetoRulesBuilder.js.map +1 -1
- package/dist/cjs/v2/NeetoRulesForm.js +2 -2
- package/dist/cjs/v2/index.js +3 -2
- package/dist/cjs/v2/index.js.map +1 -1
- package/dist/{index-49edM85x.js → index-25TjDISc.js} +2 -2
- package/dist/{index-49edM85x.js.map → index-25TjDISc.js.map} +1 -1
- package/dist/{index-CcbW7H2S.js → index-CvpoP63h.js} +3 -3
- package/dist/{index-CcbW7H2S.js.map → index-CvpoP63h.js.map} +1 -1
- package/dist/{index-BZYwFjcS.js → index-D76EZ1AZ.js} +2 -2
- package/dist/{index-BZYwFjcS.js.map → index-D76EZ1AZ.js.map} +1 -1
- package/dist/{index-Fukq1VSN.js → index-puRtNWZV.js} +3 -2
- package/dist/{index-Fukq1VSN.js.map → index-puRtNWZV.js.map} +1 -1
- package/dist/index.js +2 -2
- package/dist/keyboardShortcuts-CRInJJOU.js +96 -0
- package/dist/{keyboardShortcuts-DtnjcivY.js.map → keyboardShortcuts-CRInJJOU.js.map} +1 -1
- package/dist/keyboardShortcuts-DwgF8Mcu.js +92 -0
- package/dist/{keyboardShortcuts-_OrtgF0A.js.map → keyboardShortcuts-DwgF8Mcu.js.map} +1 -1
- package/dist/v2/NeetoRulesBuilder.js +350 -177
- package/dist/v2/NeetoRulesBuilder.js.map +1 -1
- package/dist/v2/NeetoRulesForm.js +2 -2
- package/dist/v2/index.js +3 -2
- package/dist/v2/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/keyboardShortcuts-DtnjcivY.js +0 -96
- package/dist/keyboardShortcuts-_OrtgF0A.js +0 -92
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
2
|
import _objectDestructuringEmpty from '@babel/runtime/helpers/objectDestructuringEmpty';
|
|
3
|
-
import { f as flatten, S as SHORTCUTS } from '../keyboardShortcuts-
|
|
3
|
+
import { f as flatten, S as SHORTCUTS } from '../keyboardShortcuts-DwgF8Mcu.js';
|
|
4
4
|
import { useShallow } from 'zustand/shallow';
|
|
5
|
-
import { useState, useRef, useEffect, createElement, Fragment as Fragment$1, useCallback, useMemo } from 'react';
|
|
6
|
-
import { Button, Input, Checkbox, Typography, RadioGroup, Textarea, DatePicker,
|
|
7
|
-
import { Input as Input$1, Select, ActionBlock } from '@bigbinary/neeto-atoms/formik';
|
|
5
|
+
import { useState, useRef, useEffect, createElement, Fragment as Fragment$1, useCallback, useMemo, isValidElement } from 'react';
|
|
6
|
+
import { Button, Select, Input, Checkbox, Typography, RadioGroup, Textarea, DatePicker, Popover, Tooltip, MultiEmailInput, Spinner } from '@bigbinary/neeto-atoms';
|
|
7
|
+
import { Input as Input$1, Select as Select$1, ActionBlock } from '@bigbinary/neeto-atoms/formik';
|
|
8
8
|
import classNames from 'classnames';
|
|
9
9
|
import { useFormikContext, getIn, useField, Formik, Form as Form$1 } from 'formik';
|
|
10
10
|
import { isNotEmpty, toLabelAndValue, removeBy, isNot, noop } from '@bigbinary/neeto-cist';
|
|
11
11
|
import Container from '@bigbinary/neeto-molecules/v2/Container';
|
|
12
12
|
import Header from '@bigbinary/neeto-molecules/v2/Header';
|
|
13
13
|
import { useTranslation } from 'react-i18next';
|
|
14
|
-
import { E as EditorAction, L as ListField, o as Panel,
|
|
14
|
+
import { r as ApiFields, E as EditorAction, L as ListField, o as Panel, s as ErrorCallout, t as SmsFields, M as MIN_DELAY_VALUE, v as MAX_DELAY_VALUE, w as PhoneNumberField, l as formatData, u as usePollRuleName, T as TouchErrors, n as ScrollToErrorField, p as getValidationSchema, q as DEFAULT_INITIAL_VALUE, m as buildPayload } from '../index-CvpoP63h.js';
|
|
15
15
|
import { u as useCustomDataStore } from '../useCustomDataStore-CEbhXugO.js';
|
|
16
16
|
import { u as useUtilityStore } from '../useUtilityStore-BVCulMEC.js';
|
|
17
17
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
@@ -30,6 +30,7 @@ import { dayjs } from '@bigbinary/neeto-commons-frontend/v2/utils';
|
|
|
30
30
|
import { D as DATE_FORMAT } from '../utils-DeqHhpwQ.js';
|
|
31
31
|
import Up from '@bigbinary/neeto-icons/Up';
|
|
32
32
|
import Down from '@bigbinary/neeto-icons/Down';
|
|
33
|
+
import Info from '@bigbinary/neeto-icons/Info';
|
|
33
34
|
import '@babel/runtime/helpers/typeof';
|
|
34
35
|
import '../useAutomationRulesApi-C9I3wUZ8.js';
|
|
35
36
|
import '@tanstack/react-query';
|
|
@@ -483,31 +484,54 @@ var hasAction = function hasAction(rule) {
|
|
|
483
484
|
return action === null || action === void 0 ? void 0 : action.name;
|
|
484
485
|
});
|
|
485
486
|
};
|
|
486
|
-
var
|
|
487
|
-
|
|
487
|
+
var isTriggerEnabled = function isTriggerEnabled(schema) {
|
|
488
|
+
var _schema$triggers2;
|
|
489
|
+
return (schema === null || schema === void 0 || (_schema$triggers2 = schema.triggers) === null || _schema$triggers2 === void 0 ? void 0 : _schema$triggers2.enabled) !== false;
|
|
490
|
+
};
|
|
491
|
+
var isTriggerSatisfied = function isTriggerSatisfied(_ref14) {
|
|
492
|
+
var rule = _ref14.rule,
|
|
493
|
+
schema = _ref14.schema;
|
|
494
|
+
return !isTriggerEnabled(schema) || hasTrigger(rule);
|
|
495
|
+
};
|
|
496
|
+
var hasRequiredConditions = function hasRequiredConditions(_ref15) {
|
|
497
|
+
var _schema$conditions5;
|
|
498
|
+
var rule = _ref15.rule,
|
|
499
|
+
schema = _ref15.schema;
|
|
500
|
+
return (schema === null || schema === void 0 || (_schema$conditions5 = schema.conditions) === null || _schema$conditions5 === void 0 ? void 0 : _schema$conditions5.allowEmpty) === false ? isNotEmpty((rule === null || rule === void 0 ? void 0 : rule.conditions) || []) : true;
|
|
501
|
+
};
|
|
502
|
+
var isRuleComplete = function isRuleComplete(_ref16) {
|
|
503
|
+
var rule = _ref16.rule,
|
|
504
|
+
schema = _ref16.schema;
|
|
505
|
+
return isTriggerSatisfied({
|
|
506
|
+
rule: rule,
|
|
507
|
+
schema: schema
|
|
508
|
+
}) && hasRequiredConditions({
|
|
509
|
+
rule: rule,
|
|
510
|
+
schema: schema
|
|
511
|
+
}) && hasAction(rule);
|
|
488
512
|
};
|
|
489
|
-
var scopeOptionFor = function scopeOptionFor(
|
|
513
|
+
var scopeOptionFor = function scopeOptionFor(_ref17) {
|
|
490
514
|
var _item$value, _schema$scope;
|
|
491
|
-
var schema =
|
|
492
|
-
item =
|
|
515
|
+
var schema = _ref17.schema,
|
|
516
|
+
item = _ref17.item;
|
|
493
517
|
var value = (_item$value = item === null || item === void 0 ? void 0 : item.value) !== null && _item$value !== void 0 ? _item$value : item;
|
|
494
518
|
return ((schema === null || schema === void 0 || (_schema$scope = schema.scope) === null || _schema$scope === void 0 ? void 0 : _schema$scope.options) || []).find(function (candidate) {
|
|
495
519
|
var _candidate$value2;
|
|
496
520
|
return ((_candidate$value2 = candidate.value) !== null && _candidate$value2 !== void 0 ? _candidate$value2 : candidate.id) === value;
|
|
497
521
|
});
|
|
498
522
|
};
|
|
499
|
-
var scopePhoneFields = function scopePhoneFields(
|
|
500
|
-
var
|
|
501
|
-
var schema =
|
|
502
|
-
item =
|
|
503
|
-
return (
|
|
523
|
+
var scopePhoneFields = function scopePhoneFields(_ref18) {
|
|
524
|
+
var _ref19, _item$phoneFields, _scopeOptionFor;
|
|
525
|
+
var schema = _ref18.schema,
|
|
526
|
+
item = _ref18.item;
|
|
527
|
+
return (_ref19 = (_item$phoneFields = item === null || item === void 0 ? void 0 : item.phoneFields) !== null && _item$phoneFields !== void 0 ? _item$phoneFields : (_scopeOptionFor = scopeOptionFor({
|
|
504
528
|
schema: schema,
|
|
505
529
|
item: item
|
|
506
|
-
})) === null || _scopeOptionFor === void 0 ? void 0 : _scopeOptionFor.phoneFields) !== null &&
|
|
530
|
+
})) === null || _scopeOptionFor === void 0 ? void 0 : _scopeOptionFor.phoneFields) !== null && _ref19 !== void 0 ? _ref19 : null;
|
|
507
531
|
};
|
|
508
|
-
var effectiveScopePhoneField = function effectiveScopePhoneField(
|
|
509
|
-
var schema =
|
|
510
|
-
item =
|
|
532
|
+
var effectiveScopePhoneField = function effectiveScopePhoneField(_ref20) {
|
|
533
|
+
var schema = _ref20.schema,
|
|
534
|
+
item = _ref20.item;
|
|
511
535
|
if (item !== null && item !== void 0 && item.phoneField) return item.phoneField;
|
|
512
536
|
var phoneFields = scopePhoneFields({
|
|
513
537
|
schema: schema,
|
|
@@ -515,14 +539,14 @@ var effectiveScopePhoneField = function effectiveScopePhoneField(_ref17) {
|
|
|
515
539
|
});
|
|
516
540
|
return (phoneFields === null || phoneFields === void 0 ? void 0 : phoneFields.length) === 1 ? phoneFields[0].value : undefined;
|
|
517
541
|
};
|
|
518
|
-
var invalidScopeIndexes = function invalidScopeIndexes(
|
|
542
|
+
var invalidScopeIndexes = function invalidScopeIndexes(_ref21) {
|
|
519
543
|
var _scope$requiresPhone;
|
|
520
|
-
var rule =
|
|
521
|
-
schema =
|
|
544
|
+
var rule = _ref21.rule,
|
|
545
|
+
schema = _ref21.schema;
|
|
522
546
|
var scope = schema === null || schema === void 0 ? void 0 : schema.scope;
|
|
523
547
|
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 [];
|
|
524
548
|
return ((rule === null || rule === void 0 ? void 0 : rule.scope) || []).reduce(function (indexes, item, index) {
|
|
525
|
-
var
|
|
549
|
+
var _ref22, _item$hasPhoneField;
|
|
526
550
|
var option = scopeOptionFor({
|
|
527
551
|
schema: schema,
|
|
528
552
|
item: item
|
|
@@ -531,15 +555,15 @@ var invalidScopeIndexes = function invalidScopeIndexes(_ref18) {
|
|
|
531
555
|
schema: schema,
|
|
532
556
|
item: item
|
|
533
557
|
});
|
|
534
|
-
var hasPhoneField = (
|
|
558
|
+
var hasPhoneField = (_ref22 = (_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 && _ref22 !== void 0 ? _ref22 : phoneFields ? phoneFields.length > 0 : undefined;
|
|
535
559
|
if (hasPhoneField === false) indexes.push(index);
|
|
536
560
|
return indexes;
|
|
537
561
|
}, []);
|
|
538
562
|
};
|
|
539
|
-
var invalidScopePhoneFieldIndexes = function invalidScopePhoneFieldIndexes(
|
|
563
|
+
var invalidScopePhoneFieldIndexes = function invalidScopePhoneFieldIndexes(_ref23) {
|
|
540
564
|
var _scope$requiresPhone2;
|
|
541
|
-
var rule =
|
|
542
|
-
schema =
|
|
565
|
+
var rule = _ref23.rule,
|
|
566
|
+
schema = _ref23.schema;
|
|
543
567
|
var scope = schema === null || schema === void 0 ? void 0 : schema.scope;
|
|
544
568
|
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 [];
|
|
545
569
|
return ((rule === null || rule === void 0 ? void 0 : rule.scope) || []).reduce(function (indexes, item, index) {
|
|
@@ -576,9 +600,9 @@ var minutesToParts = function minutesToParts(minutes) {
|
|
|
576
600
|
unit: "minutes"
|
|
577
601
|
};
|
|
578
602
|
};
|
|
579
|
-
var partsToMinutes = function partsToMinutes(
|
|
580
|
-
var value =
|
|
581
|
-
unit =
|
|
603
|
+
var partsToMinutes = function partsToMinutes(_ref24) {
|
|
604
|
+
var value = _ref24.value,
|
|
605
|
+
unit = _ref24.unit;
|
|
582
606
|
return (
|
|
583
607
|
// eslint-disable-next-line security/detect-object-injection
|
|
584
608
|
(Number(value) || 0) * (UNIT_MINUTES[unit] || 1)
|
|
@@ -588,8 +612,8 @@ var leadTimeExceedsMax = function leadTimeExceedsMax(minutes) {
|
|
|
588
612
|
return minutesToParts(minutes).value > MAX_LEAD_TIME_VALUE;
|
|
589
613
|
};
|
|
590
614
|
var leadTimeValidationSchema = function leadTimeValidationSchema(schema) {
|
|
591
|
-
var _schema$
|
|
592
|
-
var fieldKey = schema === null || schema === void 0 || (_schema$
|
|
615
|
+
var _schema$triggers3;
|
|
616
|
+
var fieldKey = schema === null || schema === void 0 || (_schema$triggers3 = schema.triggers) === null || _schema$triggers3 === void 0 || (_schema$triggers3 = _schema$triggers3.leadTime) === null || _schema$triggers3 === void 0 ? void 0 : _schema$triggers3.fieldKey;
|
|
593
617
|
if (!fieldKey) return yup.object();
|
|
594
618
|
return yup.object().shape(_defineProperty({}, fieldKey, yup.object().shape({
|
|
595
619
|
// yup 0.32 can only concat schemas of the same type, and the host's
|
|
@@ -633,25 +657,25 @@ var modeFromJoinType = function modeFromJoinType(joinType) {
|
|
|
633
657
|
};
|
|
634
658
|
|
|
635
659
|
// eslint-disable-next-line security/detect-object-injection
|
|
636
|
-
var valueAt = function valueAt(
|
|
660
|
+
var valueAt = function valueAt(_ref25) {
|
|
637
661
|
var _values$key;
|
|
638
|
-
var values =
|
|
639
|
-
key =
|
|
662
|
+
var values = _ref25.values,
|
|
663
|
+
key = _ref25.key;
|
|
640
664
|
return values === null || values === void 0 || (_values$key = values[key]) === null || _values$key === void 0 ? void 0 : _values$key.value;
|
|
641
665
|
};
|
|
642
666
|
var asArray = function asArray(maybeArray) {
|
|
643
667
|
return Array.isArray(maybeArray) ? maybeArray : [];
|
|
644
668
|
};
|
|
645
669
|
var fieldKeysFromSchema = function fieldKeysFromSchema() {
|
|
646
|
-
var _schema$
|
|
670
|
+
var _schema$triggers4, _schema$actor2, _schema$conditions6, _schema$actions3, _schema$delay, _schema$triggers5, _schema$scope2;
|
|
647
671
|
var schema = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
648
672
|
return {
|
|
649
|
-
triggers: ((_schema$
|
|
673
|
+
triggers: ((_schema$triggers4 = schema.triggers) === null || _schema$triggers4 === void 0 ? void 0 : _schema$triggers4.fieldKey) || "events",
|
|
650
674
|
performer: ((_schema$actor2 = schema.actor) === null || _schema$actor2 === void 0 ? void 0 : _schema$actor2.fieldKey) || "performer",
|
|
651
|
-
conditions: ((_schema$
|
|
675
|
+
conditions: ((_schema$conditions6 = schema.conditions) === null || _schema$conditions6 === void 0 ? void 0 : _schema$conditions6.fieldKey) || "conditions",
|
|
652
676
|
actions: ((_schema$actions3 = schema.actions) === null || _schema$actions3 === void 0 ? void 0 : _schema$actions3.fieldKey) || "actions",
|
|
653
677
|
delay: ((_schema$delay = schema.delay) === null || _schema$delay === void 0 ? void 0 : _schema$delay.fieldKey) || "execution_delay",
|
|
654
|
-
leadTime: (_schema$
|
|
678
|
+
leadTime: (_schema$triggers5 = schema.triggers) === null || _schema$triggers5 === void 0 || (_schema$triggers5 = _schema$triggers5.leadTime) === null || _schema$triggers5 === void 0 ? void 0 : _schema$triggers5.fieldKey,
|
|
655
679
|
scope: ((_schema$scope2 = schema.scope) === null || _schema$scope2 === void 0 ? void 0 : _schema$scope2.fieldKey) || "meetingIds",
|
|
656
680
|
status: "status",
|
|
657
681
|
name: "name"
|
|
@@ -659,11 +683,11 @@ var fieldKeysFromSchema = function fieldKeysFromSchema() {
|
|
|
659
683
|
};
|
|
660
684
|
var valuesToRuleModel = function valuesToRuleModel() {
|
|
661
685
|
var _valueAt, _conditions$;
|
|
662
|
-
var
|
|
663
|
-
|
|
664
|
-
values =
|
|
665
|
-
|
|
666
|
-
schema =
|
|
686
|
+
var _ref26 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
687
|
+
_ref26$values = _ref26.values,
|
|
688
|
+
values = _ref26$values === void 0 ? {} : _ref26$values,
|
|
689
|
+
_ref26$schema = _ref26.schema,
|
|
690
|
+
schema = _ref26$schema === void 0 ? {} : _ref26$schema;
|
|
667
691
|
var keys = fieldKeysFromSchema(schema);
|
|
668
692
|
var conditions = asArray(valueAt({
|
|
669
693
|
values: values,
|
|
@@ -707,42 +731,42 @@ var valuesToRuleModel = function valuesToRuleModel() {
|
|
|
707
731
|
}))
|
|
708
732
|
};
|
|
709
733
|
};
|
|
710
|
-
var setTriggers = function setTriggers(
|
|
711
|
-
var schema =
|
|
712
|
-
triggers =
|
|
734
|
+
var setTriggers = function setTriggers(_ref27) {
|
|
735
|
+
var schema = _ref27.schema,
|
|
736
|
+
triggers = _ref27.triggers;
|
|
713
737
|
return {
|
|
714
738
|
path: "".concat(fieldKeysFromSchema(schema).triggers, ".value"),
|
|
715
739
|
value: triggers
|
|
716
740
|
};
|
|
717
741
|
};
|
|
718
|
-
var setPerformer = function setPerformer(
|
|
719
|
-
var schema =
|
|
720
|
-
performer =
|
|
742
|
+
var setPerformer = function setPerformer(_ref28) {
|
|
743
|
+
var schema = _ref28.schema,
|
|
744
|
+
performer = _ref28.performer;
|
|
721
745
|
return {
|
|
722
746
|
path: "".concat(fieldKeysFromSchema(schema).performer, ".value"),
|
|
723
747
|
value: performer
|
|
724
748
|
};
|
|
725
749
|
};
|
|
726
|
-
var setActions = function setActions(
|
|
727
|
-
var schema =
|
|
728
|
-
actions =
|
|
750
|
+
var setActions = function setActions(_ref29) {
|
|
751
|
+
var schema = _ref29.schema,
|
|
752
|
+
actions = _ref29.actions;
|
|
729
753
|
return {
|
|
730
754
|
path: "".concat(fieldKeysFromSchema(schema).actions, ".value"),
|
|
731
755
|
value: actions
|
|
732
756
|
};
|
|
733
757
|
};
|
|
734
|
-
var setConditions = function setConditions(
|
|
735
|
-
var schema =
|
|
736
|
-
conditions =
|
|
758
|
+
var setConditions = function setConditions(_ref30) {
|
|
759
|
+
var schema = _ref30.schema,
|
|
760
|
+
conditions = _ref30.conditions;
|
|
737
761
|
return {
|
|
738
762
|
path: "".concat(fieldKeysFromSchema(schema).conditions, ".value"),
|
|
739
763
|
value: conditions
|
|
740
764
|
};
|
|
741
765
|
};
|
|
742
|
-
var setConditionMode = function setConditionMode(
|
|
743
|
-
var schema =
|
|
744
|
-
conditions =
|
|
745
|
-
joinType =
|
|
766
|
+
var setConditionMode = function setConditionMode(_ref31) {
|
|
767
|
+
var schema = _ref31.schema,
|
|
768
|
+
conditions = _ref31.conditions,
|
|
769
|
+
joinType = _ref31.joinType;
|
|
746
770
|
return setConditions({
|
|
747
771
|
schema: schema,
|
|
748
772
|
conditions: conditions.map(function (condition) {
|
|
@@ -750,34 +774,34 @@ var setConditionMode = function setConditionMode(_ref28) {
|
|
|
750
774
|
})
|
|
751
775
|
});
|
|
752
776
|
};
|
|
753
|
-
var setDelay = function setDelay(
|
|
754
|
-
var schema =
|
|
755
|
-
delay =
|
|
777
|
+
var setDelay = function setDelay(_ref32) {
|
|
778
|
+
var schema = _ref32.schema,
|
|
779
|
+
delay = _ref32.delay;
|
|
756
780
|
return {
|
|
757
781
|
path: "".concat(fieldKeysFromSchema(schema).delay, ".value"),
|
|
758
782
|
value: delay !== null && delay !== void 0 ? delay : {}
|
|
759
783
|
};
|
|
760
784
|
};
|
|
761
|
-
var setActive = function setActive(
|
|
762
|
-
var schema =
|
|
763
|
-
active =
|
|
785
|
+
var setActive = function setActive(_ref33) {
|
|
786
|
+
var schema = _ref33.schema,
|
|
787
|
+
active = _ref33.active;
|
|
764
788
|
return {
|
|
765
789
|
path: "".concat(fieldKeysFromSchema(schema).status, ".value"),
|
|
766
790
|
value: active ? STATUS_KEYS.ENABLED : STATUS_KEYS.DISABLED
|
|
767
791
|
};
|
|
768
792
|
};
|
|
769
|
-
var setScope = function setScope(
|
|
770
|
-
var schema =
|
|
771
|
-
scope =
|
|
793
|
+
var setScope = function setScope(_ref34) {
|
|
794
|
+
var schema = _ref34.schema,
|
|
795
|
+
scope = _ref34.scope;
|
|
772
796
|
return {
|
|
773
797
|
path: "".concat(fieldKeysFromSchema(schema).scope, ".value"),
|
|
774
798
|
value: scope
|
|
775
799
|
};
|
|
776
800
|
};
|
|
777
|
-
var removeArrayItem = function removeArrayItem(
|
|
778
|
-
var values =
|
|
779
|
-
fieldKey =
|
|
780
|
-
index =
|
|
801
|
+
var removeArrayItem = function removeArrayItem(_ref35) {
|
|
802
|
+
var values = _ref35.values,
|
|
803
|
+
fieldKey = _ref35.fieldKey,
|
|
804
|
+
index = _ref35.index;
|
|
781
805
|
var list = asArray(valueAt({
|
|
782
806
|
values: values,
|
|
783
807
|
key: fieldKey
|
|
@@ -804,9 +828,9 @@ var removeArrayItem = function removeArrayItem(_ref32) {
|
|
|
804
828
|
}
|
|
805
829
|
return result;
|
|
806
830
|
};
|
|
807
|
-
var clearArrayItems = function clearArrayItems(
|
|
808
|
-
var values =
|
|
809
|
-
fieldKey =
|
|
831
|
+
var clearArrayItems = function clearArrayItems(_ref36) {
|
|
832
|
+
var values = _ref36.values,
|
|
833
|
+
fieldKey = _ref36.fieldKey;
|
|
810
834
|
var list = asArray(valueAt({
|
|
811
835
|
values: values,
|
|
812
836
|
key: fieldKey
|
|
@@ -882,13 +906,13 @@ var ConditionRow = function ConditionRow(_ref) {
|
|
|
882
906
|
className: "mb-sentence",
|
|
883
907
|
children: [isFirst ? /*#__PURE__*/jsx("span", {
|
|
884
908
|
className: "mb-fixed",
|
|
885
|
-
children: t("neetoRules.operators.and")
|
|
909
|
+
children: isTriggerEnabled(schema) ? t("neetoRules.operators.and") : t("neetoRules.common.when")
|
|
886
910
|
}) : /*#__PURE__*/jsx(Token, {
|
|
887
911
|
active: isActive({
|
|
888
912
|
type: BUILDER_ANCHORS.COND_CONNECTOR,
|
|
889
913
|
index: index
|
|
890
914
|
}),
|
|
891
|
-
className: "mb-tok-
|
|
915
|
+
className: "mb-tok-connector",
|
|
892
916
|
dataTestid: "cond-connector-".concat(index),
|
|
893
917
|
onClick: handleToken && function () {
|
|
894
918
|
return handleToken({
|
|
@@ -1111,8 +1135,8 @@ var MetaBlock = function MetaBlock(_ref) {
|
|
|
1111
1135
|
className: "mb-meta-label",
|
|
1112
1136
|
children: t("neetoRules.builder.automationName")
|
|
1113
1137
|
}), /*#__PURE__*/jsxs("div", {
|
|
1114
|
-
ref: nameRef,
|
|
1115
1138
|
"data-testid": "rule-name-edit",
|
|
1139
|
+
ref: nameRef,
|
|
1116
1140
|
role: handleEditName ? "button" : undefined,
|
|
1117
1141
|
tabIndex: handleEditName ? 0 : undefined,
|
|
1118
1142
|
className: classNames("mb-meta-input-wrap", {
|
|
@@ -1385,7 +1409,10 @@ var ActionRow = function ActionRow(_ref) {
|
|
|
1385
1409
|
paramKind = _actionParts.paramKind,
|
|
1386
1410
|
valueNoun = _actionParts.valueNoun,
|
|
1387
1411
|
valueNounPlural = _actionParts.valueNounPlural;
|
|
1388
|
-
|
|
1412
|
+
|
|
1413
|
+
// A separator-less action still needs a value slot when the host declares a
|
|
1414
|
+
// placeholder for it, otherwise its chosen value never reaches the canvas.
|
|
1415
|
+
var hasParamTail = paramKind === PARAM_KIND.ENUM_SINGLE || paramKind === PARAM_KIND.ENUM_MULTI || !!configValuePlaceholder || !!configValue;
|
|
1389
1416
|
var multiPlaceholder = valueNounPlural ? t("neetoRules.builder.selectNoun", {
|
|
1390
1417
|
noun: valueNounPlural
|
|
1391
1418
|
}) : t("neetoRules.form.selectValues");
|
|
@@ -1403,12 +1430,66 @@ var ActionRow = function ActionRow(_ref) {
|
|
|
1403
1430
|
index: index
|
|
1404
1431
|
});
|
|
1405
1432
|
var configLabel = mediumLabel || sentencify(option === null || option === void 0 ? void 0 : option.placeholder);
|
|
1433
|
+
// A host may declare two separators: the first introduces the recipient
|
|
1434
|
+
// ("whose email is"), the second the configured value ("with the following").
|
|
1435
|
+
var _ref2 = Array.isArray(separator) ? separator : [null, separator],
|
|
1436
|
+
_ref3 = _slicedToArray(_ref2, 2),
|
|
1437
|
+
recipientSeparator = _ref3[0],
|
|
1438
|
+
configSeparator = _ref3[1];
|
|
1406
1439
|
var isConfigured = isNotEmpty(action === null || action === void 0 ? void 0 : action.metadata);
|
|
1407
1440
|
// A host that shows no value label still needs the token to read as filled.
|
|
1408
1441
|
var configState = configValue || isConfigured ? TOKEN_STATE.FILLED : TOKEN_STATE.MUTED;
|
|
1409
1442
|
var _useClearingHover = useClearingHover(),
|
|
1410
1443
|
clearing = _useClearingHover.clearing,
|
|
1411
1444
|
clearingHoverProps = _useClearingHover.clearingHoverProps;
|
|
1445
|
+
var configToken = configSeparator ? /*#__PURE__*/jsxs(Fragment$1, {
|
|
1446
|
+
children: [/*#__PURE__*/jsx("span", {
|
|
1447
|
+
className: "mb-fixed",
|
|
1448
|
+
children: configSeparator
|
|
1449
|
+
}), /*#__PURE__*/jsx(Token, {
|
|
1450
|
+
active: isActive({
|
|
1451
|
+
type: BUILDER_ANCHORS.ACTION_CONFIG,
|
|
1452
|
+
index: index
|
|
1453
|
+
}),
|
|
1454
|
+
dataTestid: "action-config-value-".concat(index),
|
|
1455
|
+
state: configState,
|
|
1456
|
+
invalid: isInvalid({
|
|
1457
|
+
type: BUILDER_ANCHORS.ACTION_CONFIG,
|
|
1458
|
+
index: index
|
|
1459
|
+
}),
|
|
1460
|
+
onClick: handleToken && function () {
|
|
1461
|
+
return handleToken({
|
|
1462
|
+
type: BUILDER_ANCHORS.ACTION_CONFIG,
|
|
1463
|
+
index: index
|
|
1464
|
+
});
|
|
1465
|
+
},
|
|
1466
|
+
children: configValue || sentencify(configValuePlaceholder) || t("neetoRules.builder.selectFallback")
|
|
1467
|
+
})]
|
|
1468
|
+
}, "config") : null;
|
|
1469
|
+
var recipientToken = needsRecipient ? /*#__PURE__*/jsxs(Fragment$1, {
|
|
1470
|
+
children: [/*#__PURE__*/jsx("span", {
|
|
1471
|
+
className: "mb-fixed",
|
|
1472
|
+
children: recipientSeparator || t("neetoRules.common.to")
|
|
1473
|
+
}), /*#__PURE__*/jsx(Token, {
|
|
1474
|
+
dataTestid: "action-recipient-".concat(index),
|
|
1475
|
+
state: recipient ? TOKEN_STATE.FILLED : TOKEN_STATE.MUTED,
|
|
1476
|
+
active: isActive({
|
|
1477
|
+
type: BUILDER_ANCHORS.ACTION_RECIPIENT,
|
|
1478
|
+
index: index
|
|
1479
|
+
}),
|
|
1480
|
+
invalid: isInvalid({
|
|
1481
|
+
type: BUILDER_ANCHORS.ACTION_RECIPIENT,
|
|
1482
|
+
index: index
|
|
1483
|
+
}),
|
|
1484
|
+
onClick: handleToken && function () {
|
|
1485
|
+
return handleToken({
|
|
1486
|
+
type: BUILDER_ANCHORS.ACTION_RECIPIENT,
|
|
1487
|
+
index: index
|
|
1488
|
+
});
|
|
1489
|
+
},
|
|
1490
|
+
children: recipient ? String(recipientLabel).toLowerCase() : t("neetoRules.builder.selectRecipient")
|
|
1491
|
+
})]
|
|
1492
|
+
}, "recipient") : null;
|
|
1412
1493
|
return /*#__PURE__*/jsxs("div", {
|
|
1413
1494
|
className: classNames("mb-row mb-row-draggable", {
|
|
1414
1495
|
clearing: clearing
|
|
@@ -1418,7 +1499,7 @@ var ActionRow = function ActionRow(_ref) {
|
|
|
1418
1499
|
children: [/*#__PURE__*/jsx("span", {
|
|
1419
1500
|
className: "mb-fixed",
|
|
1420
1501
|
children: connector
|
|
1421
|
-
}),
|
|
1502
|
+
}), configSeparator ? /*#__PURE__*/jsxs(Token, {
|
|
1422
1503
|
active: isVerbActive,
|
|
1423
1504
|
className: "mb-tok-medium",
|
|
1424
1505
|
dataTestid: "action-verb-".concat(index),
|
|
@@ -1459,7 +1540,7 @@ var ActionRow = function ActionRow(_ref) {
|
|
|
1459
1540
|
index: index
|
|
1460
1541
|
});
|
|
1461
1542
|
},
|
|
1462
|
-
children: configValue || paramPlaceholder
|
|
1543
|
+
children: configValue || sentencify(configValuePlaceholder) || paramPlaceholder
|
|
1463
1544
|
}) : configLabel && /*#__PURE__*/jsxs(Token, {
|
|
1464
1545
|
className: "mb-tok-medium",
|
|
1465
1546
|
dataTestid: "action-config-".concat(index),
|
|
@@ -1482,53 +1563,7 @@ var ActionRow = function ActionRow(_ref) {
|
|
|
1482
1563
|
size: 14
|
|
1483
1564
|
}), configLabel]
|
|
1484
1565
|
})]
|
|
1485
|
-
}),
|
|
1486
|
-
children: [/*#__PURE__*/jsx("span", {
|
|
1487
|
-
className: "mb-fixed",
|
|
1488
|
-
children: separator
|
|
1489
|
-
}), /*#__PURE__*/jsx(Token, {
|
|
1490
|
-
active: isActive({
|
|
1491
|
-
type: BUILDER_ANCHORS.ACTION_CONFIG,
|
|
1492
|
-
index: index
|
|
1493
|
-
}),
|
|
1494
|
-
dataTestid: "action-config-value-".concat(index),
|
|
1495
|
-
state: configState,
|
|
1496
|
-
invalid: isInvalid({
|
|
1497
|
-
type: BUILDER_ANCHORS.ACTION_CONFIG,
|
|
1498
|
-
index: index
|
|
1499
|
-
}),
|
|
1500
|
-
onClick: handleToken && function () {
|
|
1501
|
-
return handleToken({
|
|
1502
|
-
type: BUILDER_ANCHORS.ACTION_CONFIG,
|
|
1503
|
-
index: index
|
|
1504
|
-
});
|
|
1505
|
-
},
|
|
1506
|
-
children: configValue || sentencify(configValuePlaceholder) || t("neetoRules.builder.selectFallback")
|
|
1507
|
-
})]
|
|
1508
|
-
}), needsRecipient && /*#__PURE__*/jsxs(Fragment, {
|
|
1509
|
-
children: [/*#__PURE__*/jsx("span", {
|
|
1510
|
-
className: "mb-fixed",
|
|
1511
|
-
children: t("neetoRules.common.to")
|
|
1512
|
-
}), /*#__PURE__*/jsx(Token, {
|
|
1513
|
-
dataTestid: "action-recipient-".concat(index),
|
|
1514
|
-
state: recipient ? TOKEN_STATE.FILLED : TOKEN_STATE.MUTED,
|
|
1515
|
-
active: isActive({
|
|
1516
|
-
type: BUILDER_ANCHORS.ACTION_RECIPIENT,
|
|
1517
|
-
index: index
|
|
1518
|
-
}),
|
|
1519
|
-
invalid: isInvalid({
|
|
1520
|
-
type: BUILDER_ANCHORS.ACTION_RECIPIENT,
|
|
1521
|
-
index: index
|
|
1522
|
-
}),
|
|
1523
|
-
onClick: handleToken && function () {
|
|
1524
|
-
return handleToken({
|
|
1525
|
-
type: BUILDER_ANCHORS.ACTION_RECIPIENT,
|
|
1526
|
-
index: index
|
|
1527
|
-
});
|
|
1528
|
-
},
|
|
1529
|
-
children: recipient ? String(recipientLabel).toLowerCase() : t("neetoRules.builder.selectRecipient")
|
|
1530
|
-
})]
|
|
1531
|
-
})]
|
|
1566
|
+
}), recipientSeparator ? [recipientToken, configToken] : [configToken, recipientToken]]
|
|
1532
1567
|
}), /*#__PURE__*/jsxs("div", {
|
|
1533
1568
|
className: "mb-row-actions",
|
|
1534
1569
|
children: [handleAddAction && /*#__PURE__*/jsx(Button, {
|
|
@@ -1584,7 +1619,10 @@ var ThenBlock = function ThenBlock(_ref) {
|
|
|
1584
1619
|
return (action === null || action === void 0 ? void 0 : action.channel) || (action === null || action === void 0 ? void 0 : action.name);
|
|
1585
1620
|
});
|
|
1586
1621
|
if (isEmpty(named)) {
|
|
1587
|
-
var isTriggerSet =
|
|
1622
|
+
var isTriggerSet = isTriggerSatisfied({
|
|
1623
|
+
rule: rule,
|
|
1624
|
+
schema: schema
|
|
1625
|
+
});
|
|
1588
1626
|
return /*#__PURE__*/jsx("div", {
|
|
1589
1627
|
className: "mb-row",
|
|
1590
1628
|
children: /*#__PURE__*/jsx("div", {
|
|
@@ -1676,6 +1714,21 @@ var WhenBlock = function WhenBlock(_ref) {
|
|
|
1676
1714
|
var _schema$triggers;
|
|
1677
1715
|
return ((schema === null || schema === void 0 || (_schema$triggers = schema.triggers) === null || _schema$triggers === void 0 || (_schema$triggers = _schema$triggers.leadTime) === null || _schema$triggers === void 0 ? void 0 : _schema$triggers.appliesTo) || []).includes(name);
|
|
1678
1716
|
};
|
|
1717
|
+
if (!isTriggerEnabled(schema)) {
|
|
1718
|
+
if (!isEmpty(rule.conditions)) return null;
|
|
1719
|
+
return /*#__PURE__*/jsx("div", {
|
|
1720
|
+
className: "mb-row",
|
|
1721
|
+
children: /*#__PURE__*/jsx("div", {
|
|
1722
|
+
className: "mb-sentence",
|
|
1723
|
+
children: /*#__PURE__*/jsx(Token, {
|
|
1724
|
+
dataTestid: "condition-add",
|
|
1725
|
+
state: TOKEN_STATE.PLACEHOLDER_NEXT,
|
|
1726
|
+
onClick: handleAddCondition || undefined,
|
|
1727
|
+
children: t("neetoRules.builder.whenThisIsTrue")
|
|
1728
|
+
})
|
|
1729
|
+
})
|
|
1730
|
+
});
|
|
1731
|
+
}
|
|
1679
1732
|
if (isEmpty(triggers)) {
|
|
1680
1733
|
return /*#__PURE__*/jsx("div", {
|
|
1681
1734
|
className: "mb-row",
|
|
@@ -2363,13 +2416,18 @@ var descriptorFor = function descriptorFor(_ref15) {
|
|
|
2363
2416
|
subtitle: isSwap ? t("neetoRules.builder.panes.actionSwapSubtitle") : t("neetoRules.builder.panes.actionAddSubtitle"),
|
|
2364
2417
|
cascade: true,
|
|
2365
2418
|
options: sourceOptions.map(function (option) {
|
|
2419
|
+
var _option$disabled;
|
|
2366
2420
|
var value = optionValue(option);
|
|
2367
2421
|
var meta = channelMetaFor(value);
|
|
2368
2422
|
return {
|
|
2369
2423
|
label: isSwap ? meta.channelLabel || option.label : option.label,
|
|
2370
2424
|
value: value,
|
|
2371
2425
|
category: option.category,
|
|
2372
|
-
|
|
2426
|
+
// Hosts mark unavailable actions with isDisabled; without carrying
|
|
2427
|
+
// the reason across, the picker disables them with no explanation.
|
|
2428
|
+
disabled: !!((_option$disabled = option.disabled) !== null && _option$disabled !== void 0 ? _option$disabled : option.isDisabled),
|
|
2429
|
+
disabledReason: option.disabledReason,
|
|
2430
|
+
disabledPopover: option.disabledPopover,
|
|
2373
2431
|
icon: (isSwap ? meta.icon : option.icon) || option.icon
|
|
2374
2432
|
};
|
|
2375
2433
|
}),
|
|
@@ -2417,7 +2475,10 @@ var descriptorFor = function descriptorFor(_ref15) {
|
|
|
2417
2475
|
selectedValues: [recipientOf({
|
|
2418
2476
|
schema: schema,
|
|
2419
2477
|
action: action
|
|
2420
|
-
})]
|
|
2478
|
+
})],
|
|
2479
|
+
// Confirming a recipient always offers Continue; whether that chains
|
|
2480
|
+
// onward or just closes is decided by continueTargetFor.
|
|
2481
|
+
cascade: true
|
|
2421
2482
|
};
|
|
2422
2483
|
}
|
|
2423
2484
|
case BUILDER_ANCHORS.SCOPE:
|
|
@@ -2434,14 +2495,16 @@ var descriptorFor = function descriptorFor(_ref15) {
|
|
|
2434
2495
|
subtitle: sc.paneSubtitle || t("neetoRules.builder.panes.scopeSubtitle"),
|
|
2435
2496
|
multi: true,
|
|
2436
2497
|
options: (sc.options || []).map(function (option) {
|
|
2498
|
+
var _option$disabled2;
|
|
2437
2499
|
var value = optionValue(option);
|
|
2438
2500
|
var blockedNoPhone = requiresPhone && option.hasPhoneField === false;
|
|
2439
2501
|
var isSelected = selected.includes(value);
|
|
2440
2502
|
return {
|
|
2441
2503
|
label: option.label,
|
|
2442
2504
|
value: value,
|
|
2443
|
-
disabled: (!!option.disabled || blockedNoPhone) && !isSelected,
|
|
2444
|
-
disabledReason: blockedNoPhone
|
|
2505
|
+
disabled: (!!((_option$disabled2 = option.disabled) !== null && _option$disabled2 !== void 0 ? _option$disabled2 : option.isDisabled) || blockedNoPhone) && !isSelected,
|
|
2506
|
+
disabledReason: blockedNoPhone ? sc.disabledReason : option.disabledReason,
|
|
2507
|
+
disabledPopover: option.disabledPopover,
|
|
2445
2508
|
disabledTooltip: blockedNoPhone && sc.disabledTooltip
|
|
2446
2509
|
};
|
|
2447
2510
|
}),
|
|
@@ -2598,7 +2661,8 @@ var continueTargetFor = function continueTargetFor(_ref17) {
|
|
|
2598
2661
|
var anchor = _ref17.anchor,
|
|
2599
2662
|
schema = _ref17.schema,
|
|
2600
2663
|
rule = _ref17.rule,
|
|
2601
|
-
index = _ref17.index
|
|
2664
|
+
index = _ref17.index,
|
|
2665
|
+
configPending = _ref17.configPending;
|
|
2602
2666
|
switch (anchor) {
|
|
2603
2667
|
case BUILDER_ANCHORS.TRIGGER_ADD:
|
|
2604
2668
|
case BUILDER_ANCHORS.TRIGGER_REPLACE:
|
|
@@ -2654,6 +2718,9 @@ var continueTargetFor = function continueTargetFor(_ref17) {
|
|
|
2654
2718
|
}
|
|
2655
2719
|
};
|
|
2656
2720
|
}
|
|
2721
|
+
|
|
2722
|
+
// Reached here only because the action has no config yet — its name is
|
|
2723
|
+
// still unresolved — so the recipient pane owes us that step afterwards.
|
|
2657
2724
|
return channelMetaOf({
|
|
2658
2725
|
schema: schema,
|
|
2659
2726
|
action: action
|
|
@@ -2661,12 +2728,30 @@ var continueTargetFor = function continueTargetFor(_ref17) {
|
|
|
2661
2728
|
type: BUILDER_PANEL_TYPES.RECIPIENT,
|
|
2662
2729
|
data: {
|
|
2663
2730
|
index: index,
|
|
2664
|
-
anchor: BUILDER_ANCHORS.ACTION_RECIPIENT
|
|
2731
|
+
anchor: BUILDER_ANCHORS.ACTION_RECIPIENT,
|
|
2732
|
+
configPending: true
|
|
2665
2733
|
}
|
|
2666
2734
|
} : null;
|
|
2667
2735
|
}
|
|
2668
2736
|
case BUILDER_ANCHORS.ACTION_RECIPIENT:
|
|
2669
|
-
|
|
2737
|
+
{
|
|
2738
|
+
// Only chain onward when config was skipped on the way in; arriving from
|
|
2739
|
+
// the config pane or from the token means this is the last step.
|
|
2740
|
+
var _action = actionAt({
|
|
2741
|
+
rule: rule,
|
|
2742
|
+
index: index
|
|
2743
|
+
});
|
|
2744
|
+
return configPending && actionHasConfig({
|
|
2745
|
+
schema: schema,
|
|
2746
|
+
action: _action
|
|
2747
|
+
}) ? {
|
|
2748
|
+
type: BUILDER_PANEL_TYPES.ACTION_CONFIG,
|
|
2749
|
+
data: {
|
|
2750
|
+
index: index,
|
|
2751
|
+
anchor: BUILDER_ANCHORS.ACTION_CONFIG
|
|
2752
|
+
}
|
|
2753
|
+
} : null;
|
|
2754
|
+
}
|
|
2670
2755
|
default:
|
|
2671
2756
|
return null;
|
|
2672
2757
|
}
|
|
@@ -2782,7 +2867,7 @@ var applyPreview = function applyPreview(_ref19) {
|
|
|
2782
2867
|
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; }
|
|
2783
2868
|
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; }
|
|
2784
2869
|
var Canvas = function Canvas(_ref) {
|
|
2785
|
-
var _schema$scope, _schema$triggers, _schema$delay, _schema$meta$showName, _schema$meta;
|
|
2870
|
+
var _schema$actor2, _ref6, _actorOptions$0$value, _schema$scope, _schema$conditions, _schema$triggers, _schema$delay, _schema$meta$showName, _schema$meta;
|
|
2786
2871
|
var schema = _ref.schema;
|
|
2787
2872
|
var _useTranslation = useTranslation(),
|
|
2788
2873
|
t = _useTranslation.t;
|
|
@@ -2837,7 +2922,10 @@ var Canvas = function Canvas(_ref) {
|
|
|
2837
2922
|
useEffect(function () {
|
|
2838
2923
|
if (submitCount <= lastSubmitCount.current) return undefined;
|
|
2839
2924
|
lastSubmitCount.current = submitCount;
|
|
2840
|
-
if (isEmpty(flatErrors) && isRuleComplete(
|
|
2925
|
+
if (isEmpty(flatErrors) && isRuleComplete({
|
|
2926
|
+
rule: rule,
|
|
2927
|
+
schema: schema
|
|
2928
|
+
}) && isEmpty(invalidScopeIndexes({
|
|
2841
2929
|
rule: rule,
|
|
2842
2930
|
schema: schema
|
|
2843
2931
|
})) && isEmpty(invalidScopePhoneFieldIndexes({
|
|
@@ -3001,7 +3089,15 @@ var Canvas = function Canvas(_ref) {
|
|
|
3001
3089
|
});
|
|
3002
3090
|
setDelay(null);
|
|
3003
3091
|
};
|
|
3004
|
-
|
|
3092
|
+
|
|
3093
|
+
// An actor with a single choice is not a choice; leaving it unset only makes
|
|
3094
|
+
// the user open a one-option pane to say the obvious.
|
|
3095
|
+
var actorOptions = schema !== null && schema !== void 0 && (_schema$actor2 = schema.actor) !== null && _schema$actor2 !== void 0 && _schema$actor2.enabled ? schema.actor.options || [] : [];
|
|
3096
|
+
var soleActorOption = actorOptions.length === 1 ? (_ref6 = (_actorOptions$0$value = actorOptions[0].value) !== null && _actorOptions$0$value !== void 0 ? _actorOptions$0$value : actorOptions[0].id) !== null && _ref6 !== void 0 ? _ref6 : actorOptions[0] : null;
|
|
3097
|
+
var isTriggerSet = isTriggerSatisfied({
|
|
3098
|
+
rule: rule,
|
|
3099
|
+
schema: schema
|
|
3100
|
+
});
|
|
3005
3101
|
var hasAction = rule.actions.some(function (action) {
|
|
3006
3102
|
return (action === null || action === void 0 ? void 0 : action.channel) || (action === null || action === void 0 ? void 0 : action.name);
|
|
3007
3103
|
});
|
|
@@ -3020,11 +3116,16 @@ var Canvas = function Canvas(_ref) {
|
|
|
3020
3116
|
rule: rule
|
|
3021
3117
|
});
|
|
3022
3118
|
var canAddCondition = isNotEmpty(conditionFields);
|
|
3119
|
+
var canRemoveCondition = (schema === null || schema === void 0 || (_schema$conditions = schema.conditions) === null || _schema$conditions === void 0 ? void 0 : _schema$conditions.allowEmpty) !== false || displayRule.conditions.length > 1;
|
|
3023
3120
|
var leadTimeAppliesTo = (schema === null || schema === void 0 || (_schema$triggers = schema.triggers) === null || _schema$triggers === void 0 || (_schema$triggers = _schema$triggers.leadTime) === null || _schema$triggers === void 0 ? void 0 : _schema$triggers.appliesTo) || [];
|
|
3024
3121
|
var hasLeadTimeTrigger = rule.triggers.some(function (trigger) {
|
|
3025
3122
|
return leadTimeAppliesTo.includes(trigger.name);
|
|
3026
3123
|
});
|
|
3027
3124
|
var isDelayEnabled = (schema === null || schema === void 0 || (_schema$delay = schema.delay) === null || _schema$delay === void 0 ? void 0 : _schema$delay.enabled) && !hasLeadTimeTrigger;
|
|
3125
|
+
useEffect(function () {
|
|
3126
|
+
if (soleActorOption && !rule.performer) setPerformer(soleActorOption);
|
|
3127
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3128
|
+
}, [soleActorOption, rule.performer]);
|
|
3028
3129
|
useEffect(function () {
|
|
3029
3130
|
if (hasLeadTimeTrigger && rule.delay) setDelay(null);
|
|
3030
3131
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -3041,10 +3142,10 @@ var Canvas = function Canvas(_ref) {
|
|
|
3041
3142
|
});
|
|
3042
3143
|
};
|
|
3043
3144
|
var handleClearTrigger = function handleClearTrigger() {
|
|
3044
|
-
var _schema$
|
|
3145
|
+
var _schema$actor3;
|
|
3045
3146
|
clearTriggers();
|
|
3046
3147
|
// Hosts without an actor pane can never re-set it, and null fails its validation.
|
|
3047
|
-
if ((_schema$
|
|
3148
|
+
if ((_schema$actor3 = schema.actor) !== null && _schema$actor3 !== void 0 && _schema$actor3.enabled) setPerformer(soleActorOption);
|
|
3048
3149
|
clearConditions();
|
|
3049
3150
|
setDelay(null);
|
|
3050
3151
|
clearActions();
|
|
@@ -3072,7 +3173,7 @@ var Canvas = function Canvas(_ref) {
|
|
|
3072
3173
|
className: "neeto-rules-builder nrb-atoms",
|
|
3073
3174
|
children: /*#__PURE__*/jsxs("div", {
|
|
3074
3175
|
className: "mb-canvas neeto-rules-main-card",
|
|
3075
|
-
children: [/*#__PURE__*/jsx(WhenBlock, {
|
|
3176
|
+
children: [renderSlot("beforeWhen"), /*#__PURE__*/jsx(WhenBlock, {
|
|
3076
3177
|
isActive: isActive,
|
|
3077
3178
|
isInvalid: isInvalid,
|
|
3078
3179
|
schema: schema,
|
|
@@ -3090,11 +3191,11 @@ var Canvas = function Canvas(_ref) {
|
|
|
3090
3191
|
schema: schema,
|
|
3091
3192
|
key: (_condition$id = condition.id) !== null && _condition$id !== void 0 ? _condition$id : index,
|
|
3092
3193
|
rule: displayRule,
|
|
3093
|
-
onRemove: function onRemove() {
|
|
3094
|
-
return handleRemoveCondition(index);
|
|
3095
|
-
},
|
|
3096
3194
|
onToken: openPane,
|
|
3097
|
-
onAddCondition: canAddCondition && index === displayRule.conditions.length - 1 && handleAddCondition
|
|
3195
|
+
onAddCondition: canAddCondition && index === displayRule.conditions.length - 1 && handleAddCondition,
|
|
3196
|
+
onRemove: canRemoveCondition && function () {
|
|
3197
|
+
return handleRemoveCondition(index);
|
|
3198
|
+
}
|
|
3098
3199
|
});
|
|
3099
3200
|
}), renderSlot("afterConditions"), /*#__PURE__*/jsx(Connector, {
|
|
3100
3201
|
active: isTriggerSet
|
|
@@ -3166,6 +3267,7 @@ var Canvas = function Canvas(_ref) {
|
|
|
3166
3267
|
|
|
3167
3268
|
var ACTION_CONFIG_TYPES = {
|
|
3168
3269
|
emailChannel: "emailChannel",
|
|
3270
|
+
sendToApi: "sendToApi",
|
|
3169
3271
|
multiSelect: "multiSelect",
|
|
3170
3272
|
dropdown: "dropdown",
|
|
3171
3273
|
note: "note",
|
|
@@ -3192,7 +3294,9 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
|
|
|
3192
3294
|
option = _ref.option,
|
|
3193
3295
|
action = _ref.action,
|
|
3194
3296
|
_ref$searchTerm = _ref.searchTerm,
|
|
3195
|
-
searchTerm = _ref$searchTerm === void 0 ? "" : _ref$searchTerm
|
|
3297
|
+
searchTerm = _ref$searchTerm === void 0 ? "" : _ref$searchTerm,
|
|
3298
|
+
_ref$hasRecipientFiel = _ref.hasRecipientField,
|
|
3299
|
+
hasRecipientField = _ref$hasRecipientFiel === void 0 ? false : _ref$hasRecipientFiel;
|
|
3196
3300
|
var _useTranslation = useTranslation(),
|
|
3197
3301
|
t = _useTranslation.t;
|
|
3198
3302
|
var _useFormikContext = useFormikContext(),
|
|
@@ -3234,19 +3338,42 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
|
|
|
3234
3338
|
"data-testid": "pane-no-matches",
|
|
3235
3339
|
children: t("neetoRules.builder.noMatches")
|
|
3236
3340
|
});
|
|
3341
|
+
if (type === ACTION_CONFIG_TYPES.sendToApi) {
|
|
3342
|
+
return /*#__PURE__*/jsx(ApiFields, {
|
|
3343
|
+
name: name,
|
|
3344
|
+
selectedField: option
|
|
3345
|
+
});
|
|
3346
|
+
}
|
|
3237
3347
|
if (type === ACTION_CONFIG_TYPES.emailChannel) {
|
|
3238
|
-
var _getIn, _action$metadata;
|
|
3348
|
+
var _getIn, _getIn2, _action$metadata;
|
|
3239
3349
|
var subjectPath = "".concat(name, ".subject");
|
|
3240
3350
|
var bodyPath = "".concat(name, ".body");
|
|
3351
|
+
// Hosts whose email action picks its recipient from a list keep that
|
|
3352
|
+
// choice in the same pane as the message.
|
|
3353
|
+
var hasRecipientList = isNotEmpty(options) && !hasRecipientField;
|
|
3241
3354
|
return /*#__PURE__*/jsxs("div", {
|
|
3242
3355
|
className: "flex flex-col gap-4",
|
|
3243
|
-
children: [
|
|
3356
|
+
children: [hasRecipientList && /*#__PURE__*/jsx(Select, {
|
|
3357
|
+
options: options,
|
|
3358
|
+
required: true,
|
|
3359
|
+
error: fieldError(valuePath),
|
|
3360
|
+
placeholder: option === null || option === void 0 ? void 0 : option.valuePlaceholder,
|
|
3361
|
+
size: "large",
|
|
3362
|
+
value: (_getIn = getIn(values, valuePath)) !== null && _getIn !== void 0 ? _getIn : undefined,
|
|
3363
|
+
label: (option === null || option === void 0 ? void 0 : option.recipientLabel) || t("neetoRules.builder.config.recipient"),
|
|
3364
|
+
onBlur: function onBlur() {
|
|
3365
|
+
return setFieldTouched(valuePath, true);
|
|
3366
|
+
},
|
|
3367
|
+
onChange: function onChange(value) {
|
|
3368
|
+
return setFieldValue(valuePath, value);
|
|
3369
|
+
}
|
|
3370
|
+
}), !(option !== null && option !== void 0 && option.hideSubject) && /*#__PURE__*/jsx(Input, {
|
|
3244
3371
|
required: true,
|
|
3245
3372
|
error: fieldError(subjectPath),
|
|
3246
3373
|
label: t("neetoRules.builder.config.subject"),
|
|
3247
3374
|
placeholder: t("neetoRules.builder.config.subjectPlaceholder"),
|
|
3248
3375
|
size: "large",
|
|
3249
|
-
value: (
|
|
3376
|
+
value: (_getIn2 = getIn(values, subjectPath)) !== null && _getIn2 !== void 0 ? _getIn2 : "",
|
|
3250
3377
|
onBlur: function onBlur() {
|
|
3251
3378
|
return setFieldTouched(subjectPath, true);
|
|
3252
3379
|
},
|
|
@@ -3298,9 +3425,6 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
|
|
|
3298
3425
|
error: fieldError(valuePath),
|
|
3299
3426
|
orientation: "vertical",
|
|
3300
3427
|
value: String(_current !== null && _current !== void 0 ? _current : ""),
|
|
3301
|
-
onBlur: function onBlur() {
|
|
3302
|
-
return setFieldTouched(valuePath, true);
|
|
3303
|
-
},
|
|
3304
3428
|
onValueChange: function onValueChange(value) {
|
|
3305
3429
|
var picked = options.find(function (item) {
|
|
3306
3430
|
return String(item.value) === value;
|
|
@@ -3338,14 +3462,14 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
|
|
|
3338
3462
|
});
|
|
3339
3463
|
}
|
|
3340
3464
|
if (type === ACTION_CONFIG_TYPES.textarea || type === ACTION_CONFIG_TYPES.number) {
|
|
3341
|
-
var
|
|
3465
|
+
var _getIn3, _getIn4;
|
|
3342
3466
|
return type === ACTION_CONFIG_TYPES.number ? /*#__PURE__*/jsx(Input, {
|
|
3343
3467
|
required: true,
|
|
3344
3468
|
error: fieldError(valuePath),
|
|
3345
3469
|
label: t("neetoRules.builder.config.value"),
|
|
3346
3470
|
size: "large",
|
|
3347
3471
|
type: "number",
|
|
3348
|
-
value: (
|
|
3472
|
+
value: (_getIn3 = getIn(values, valuePath)) !== null && _getIn3 !== void 0 ? _getIn3 : "",
|
|
3349
3473
|
onBlur: function onBlur() {
|
|
3350
3474
|
return setFieldTouched(valuePath, true);
|
|
3351
3475
|
},
|
|
@@ -3358,7 +3482,7 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
|
|
|
3358
3482
|
label: t("neetoRules.builder.config.message"),
|
|
3359
3483
|
rows: 5,
|
|
3360
3484
|
size: "large",
|
|
3361
|
-
value: (
|
|
3485
|
+
value: (_getIn4 = getIn(values, valuePath)) !== null && _getIn4 !== void 0 ? _getIn4 : "",
|
|
3362
3486
|
onBlur: function onBlur() {
|
|
3363
3487
|
return setFieldTouched(valuePath, true);
|
|
3364
3488
|
},
|
|
@@ -3368,7 +3492,7 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
|
|
|
3368
3492
|
});
|
|
3369
3493
|
}
|
|
3370
3494
|
if (type === ACTION_CONFIG_TYPES.text || type === ACTION_CONFIG_TYPES.regex || type === ACTION_CONFIG_TYPES.decimal) {
|
|
3371
|
-
var
|
|
3495
|
+
var _getIn5;
|
|
3372
3496
|
return /*#__PURE__*/jsxs("div", {
|
|
3373
3497
|
className: "flex flex-col gap-2",
|
|
3374
3498
|
children: [/*#__PURE__*/jsx(Input, {
|
|
@@ -3377,7 +3501,7 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
|
|
|
3377
3501
|
label: t("neetoRules.builder.config.value"),
|
|
3378
3502
|
placeholder: option === null || option === void 0 ? void 0 : option.valuePlaceholder,
|
|
3379
3503
|
size: "large",
|
|
3380
|
-
value: (
|
|
3504
|
+
value: (_getIn5 = getIn(values, valuePath)) !== null && _getIn5 !== void 0 ? _getIn5 : "",
|
|
3381
3505
|
onBlur: function onBlur() {
|
|
3382
3506
|
return setFieldTouched(valuePath, true);
|
|
3383
3507
|
},
|
|
@@ -3488,7 +3612,7 @@ var usePaneValidation = function usePaneValidation(prefix) {
|
|
|
3488
3612
|
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 }; })(); }
|
|
3489
3613
|
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); }
|
|
3490
3614
|
var ConfigPane = function ConfigPane(_ref) {
|
|
3491
|
-
var _schema$actions, _schema$actions$optio, _schema$actions2, _schema$actions2$opti, _schema$actions3, _schema$
|
|
3615
|
+
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;
|
|
3492
3616
|
var schema = _ref.schema,
|
|
3493
3617
|
index = _ref.index;
|
|
3494
3618
|
var _useTranslation = useTranslation(),
|
|
@@ -3523,14 +3647,24 @@ var ConfigPane = function ConfigPane(_ref) {
|
|
|
3523
3647
|
configSubtitle = _actionParts.configSubtitle;
|
|
3524
3648
|
var name = "".concat(base, ".metadata");
|
|
3525
3649
|
var flatOption = ((_schema$actions = schema.actions) === null || _schema$actions === void 0 || (_schema$actions$optio = _schema$actions.optionForName) === null || _schema$actions$optio === void 0 ? void 0 : _schema$actions$optio.call(_schema$actions, action.name)) || ((_schema$actions2 = schema.actions) === null || _schema$actions2 === void 0 || (_schema$actions2$opti = _schema$actions2.optionForChannel) === null || _schema$actions2$opti === void 0 ? void 0 : _schema$actions2$opti.call(_schema$actions2, channel)) || option;
|
|
3650
|
+
|
|
3651
|
+
// When the chosen recipient declares its own field, the recipient pane
|
|
3652
|
+
// renders it; showing the same picker here too would just duplicate it.
|
|
3653
|
+
var recipientValue = (_action$recipient = action.recipient) !== null && _action$recipient !== void 0 ? _action$recipient : (_schema$actions3 = schema.actions) === null || _schema$actions3 === void 0 || (_schema$actions3$acti = _schema$actions3.actionForName) === null || _schema$actions3$acti === void 0 || (_schema$actions3$acti = _schema$actions3$acti.call(_schema$actions3, action.name)) === null || _schema$actions3$acti === void 0 ? void 0 : _schema$actions3$acti.recipient;
|
|
3654
|
+
var hasRecipientField = !!((_concat$find = (((_schema$actions4 = schema.actions) === null || _schema$actions4 === void 0 ? void 0 : _schema$actions4.recipients) || []).concat((((_schema$actions5 = schema.actions) === null || _schema$actions5 === void 0 ? void 0 : _schema$actions5.options) || []).flatMap(function (o) {
|
|
3655
|
+
return o.recipients || [];
|
|
3656
|
+
})).find(function (item) {
|
|
3657
|
+
var _item$value;
|
|
3658
|
+
return ((_item$value = item.value) !== null && _item$value !== void 0 ? _item$value : item.id) === recipientValue;
|
|
3659
|
+
})) !== null && _concat$find !== void 0 && _concat$find.field);
|
|
3526
3660
|
var isSms = SMS_TYPES.includes(flatOption === null || flatOption === void 0 ? void 0 : flatOption.type);
|
|
3527
3661
|
var disabledReason = (flatOption === null || flatOption === void 0 ? void 0 : flatOption.isDisabled) && flatOption.disabledReason;
|
|
3528
|
-
var hostRenderConfig = (flatOption === null || flatOption === void 0 ? void 0 : flatOption.renderConfig) || (flatOption === null || flatOption === void 0 ? void 0 : flatOption.component) || ((_schema$
|
|
3662
|
+
var hostRenderConfig = (flatOption === null || flatOption === void 0 ? void 0 : flatOption.renderConfig) || (flatOption === null || flatOption === void 0 ? void 0 : flatOption.component) || ((_schema$actions6 = schema.actions) === null || _schema$actions6 === void 0 ? void 0 : _schema$actions6.renderConfig);
|
|
3529
3663
|
var showSearch = normalizeOptions(flatOption === null || flatOption === void 0 ? void 0 : flatOption.dropdownOptions).length >= PANE_SEARCH_THRESHOLD;
|
|
3530
3664
|
var shouldAdvanceToRecipient = !!needsRecipient;
|
|
3531
3665
|
var _usePaneValidation = usePaneValidation(name),
|
|
3532
3666
|
validate = _usePaneValidation.validate;
|
|
3533
|
-
var channelRepName = (_schema$
|
|
3667
|
+
var channelRepName = (_schema$actions7 = schema.actions) === null || _schema$actions7 === void 0 || (_schema$actions7$opti = _schema$actions7.optionForChannel) === null || _schema$actions7$opti === void 0 || (_schema$actions7$opti = _schema$actions7$opti.call(_schema$actions7, channel)) === null || _schema$actions7$opti === void 0 ? void 0 : _schema$actions7$opti.value;
|
|
3534
3668
|
var unnamedOnOpen = useRef(!action.name);
|
|
3535
3669
|
useEffect(function () {
|
|
3536
3670
|
if (!unnamedOnOpen.current || !channelRepName) return undefined;
|
|
@@ -3649,6 +3783,7 @@ var ConfigPane = function ConfigPane(_ref) {
|
|
|
3649
3783
|
searchTerm: searchTerm
|
|
3650
3784
|
})) !== null && _hostRenderConfig !== void 0 ? _hostRenderConfig : /*#__PURE__*/jsx(ActionConfigFields, {
|
|
3651
3785
|
action: action,
|
|
3786
|
+
hasRecipientField: hasRecipientField,
|
|
3652
3787
|
name: name,
|
|
3653
3788
|
searchTerm: searchTerm,
|
|
3654
3789
|
option: flatOption
|
|
@@ -3741,7 +3876,7 @@ var DelayPane = function DelayPane(_ref) {
|
|
|
3741
3876
|
placeholder: t("neetoRules.placeholders.enterDelay"),
|
|
3742
3877
|
size: "large",
|
|
3743
3878
|
type: "number"
|
|
3744
|
-
}), /*#__PURE__*/jsx(Select, {
|
|
3879
|
+
}), /*#__PURE__*/jsx(Select$1, {
|
|
3745
3880
|
dataTestid: "delay-unit",
|
|
3746
3881
|
defaultValue: value === null || value === void 0 ? void 0 : value.unit,
|
|
3747
3882
|
name: "".concat(name, ".value.unit"),
|
|
@@ -3928,7 +4063,7 @@ var LeadTimePane = function LeadTimePane(_ref) {
|
|
|
3928
4063
|
})
|
|
3929
4064
|
}), /*#__PURE__*/jsx("div", {
|
|
3930
4065
|
className: "w-32 shrink-0",
|
|
3931
|
-
children: /*#__PURE__*/jsx(Select
|
|
4066
|
+
children: /*#__PURE__*/jsx(Select, {
|
|
3932
4067
|
dataTestid: "lead-time-unit",
|
|
3933
4068
|
isSearchable: false,
|
|
3934
4069
|
options: LEAD_TIME_UNITS,
|
|
@@ -3987,7 +4122,9 @@ var OptionsPane = function OptionsPane(_ref) {
|
|
|
3987
4122
|
anchor = _ref.anchor,
|
|
3988
4123
|
index = _ref.index,
|
|
3989
4124
|
_ref$belowContent = _ref.belowContent,
|
|
3990
|
-
belowContent = _ref$belowContent === void 0 ? null : _ref$belowContent
|
|
4125
|
+
belowContent = _ref$belowContent === void 0 ? null : _ref$belowContent,
|
|
4126
|
+
_ref$configPending = _ref.configPending,
|
|
4127
|
+
configPending = _ref$configPending === void 0 ? false : _ref$configPending;
|
|
3991
4128
|
var _useTranslation = useTranslation(),
|
|
3992
4129
|
t = _useTranslation.t;
|
|
3993
4130
|
var _useFormikContext = useFormikContext(),
|
|
@@ -4093,7 +4230,8 @@ var OptionsPane = function OptionsPane(_ref) {
|
|
|
4093
4230
|
anchor: anchor,
|
|
4094
4231
|
schema: schema,
|
|
4095
4232
|
rule: rule,
|
|
4096
|
-
index: index
|
|
4233
|
+
index: index,
|
|
4234
|
+
configPending: configPending
|
|
4097
4235
|
});
|
|
4098
4236
|
if (target) openType({
|
|
4099
4237
|
type: target.type,
|
|
@@ -4107,21 +4245,53 @@ var OptionsPane = function OptionsPane(_ref) {
|
|
|
4107
4245
|
});
|
|
4108
4246
|
var optionLabel = function optionLabel(option) {
|
|
4109
4247
|
var Icon = option.icon;
|
|
4110
|
-
|
|
4248
|
+
// Short text sits inline as a pill; anything needing more room is a
|
|
4249
|
+
// standard popover behind an info icon.
|
|
4250
|
+
var reason = typeof option.disabledReason === "function" ? option.disabledReason() : option.disabledReason;
|
|
4251
|
+
var isTextReason = typeof reason === "string";
|
|
4252
|
+
// Only a node can be rendered as popover content; a host handing back a
|
|
4253
|
+
// plain object would otherwise crash the pane.
|
|
4254
|
+
var isNodeReason = /*#__PURE__*/isValidElement(reason) || Array.isArray(reason);
|
|
4255
|
+
var popover = option.disabledPopover || (isNodeReason ? {
|
|
4256
|
+
description: reason
|
|
4257
|
+
} : null);
|
|
4258
|
+
if (!Icon && !isTextReason && !popover) return option.label;
|
|
4111
4259
|
return /*#__PURE__*/jsxs("span", {
|
|
4112
4260
|
className: "mb-pane-option",
|
|
4113
4261
|
children: [Icon && /*#__PURE__*/jsx(Icon, {
|
|
4114
4262
|
size: 20
|
|
4115
|
-
}), option.label,
|
|
4263
|
+
}), option.label, popover && /*#__PURE__*/jsxs(Popover, {
|
|
4264
|
+
position: "top",
|
|
4265
|
+
trigger: /*#__PURE__*/jsx("span", {
|
|
4266
|
+
className: "mb-pane-info",
|
|
4267
|
+
onClick: function onClick(event) {
|
|
4268
|
+
return event.preventDefault();
|
|
4269
|
+
},
|
|
4270
|
+
children: /*#__PURE__*/jsx(Info, {
|
|
4271
|
+
size: 14
|
|
4272
|
+
})
|
|
4273
|
+
}),
|
|
4274
|
+
children: [popover.title && /*#__PURE__*/jsx(Popover.Title, {
|
|
4275
|
+
children: popover.title
|
|
4276
|
+
}), /*#__PURE__*/jsx(Typography, {
|
|
4277
|
+
color: "muted",
|
|
4278
|
+
variant: "body2",
|
|
4279
|
+
children: popover.description
|
|
4280
|
+
}), popover.helpLinkProps && /*#__PURE__*/jsx(Button, _objectSpread$2(_objectSpread$2({}, popover.helpLinkProps), {}, {
|
|
4281
|
+
className: "h-auto self-start p-0",
|
|
4282
|
+
size: "sm",
|
|
4283
|
+
variant: "link"
|
|
4284
|
+
}))]
|
|
4285
|
+
}), !popover && reason && isTextReason && (option.disabledTooltip ? /*#__PURE__*/jsx(Tooltip, {
|
|
4116
4286
|
content: option.disabledTooltip,
|
|
4117
4287
|
position: "top",
|
|
4118
4288
|
children: /*#__PURE__*/jsx("span", {
|
|
4119
4289
|
className: "mb-pane-warn",
|
|
4120
|
-
children:
|
|
4290
|
+
children: reason
|
|
4121
4291
|
})
|
|
4122
4292
|
}) : /*#__PURE__*/jsx("span", {
|
|
4123
4293
|
className: "mb-pane-warn",
|
|
4124
|
-
children:
|
|
4294
|
+
children: reason
|
|
4125
4295
|
}))]
|
|
4126
4296
|
});
|
|
4127
4297
|
};
|
|
@@ -4272,7 +4442,7 @@ var RecipientField = function RecipientField(_ref) {
|
|
|
4272
4442
|
var path = "".concat(name, ".").concat(RECIPIENT_STORAGE_FIELDS.value);
|
|
4273
4443
|
var current = getIn(values, path);
|
|
4274
4444
|
var options = normalizeOptions(dropdownOptions);
|
|
4275
|
-
return /*#__PURE__*/jsx(Select
|
|
4445
|
+
return /*#__PURE__*/jsx(Select, {
|
|
4276
4446
|
options: options,
|
|
4277
4447
|
placeholder: placeholder,
|
|
4278
4448
|
required: true,
|
|
@@ -4292,7 +4462,9 @@ var RecipientField = function RecipientField(_ref) {
|
|
|
4292
4462
|
var RecipientPane = function RecipientPane(_ref) {
|
|
4293
4463
|
var _schema$actions, _schema$actions$actio, _action$recipient, _schema$actions2, _schema$actions2$acti, _schema$actions3, _schema$actions3$rend, _schema$actions4, _schema$actions4$opti, _schema$actions5, _schema$actions5$opti, _schema$actions6, _schema$actions7, _schema$actions$rende, _schema$actions8, _schema$actions8$rend, _action$metadata, _schema$actions9;
|
|
4294
4464
|
var schema = _ref.schema,
|
|
4295
|
-
index = _ref.index
|
|
4465
|
+
index = _ref.index,
|
|
4466
|
+
_ref$configPending = _ref.configPending,
|
|
4467
|
+
configPending = _ref$configPending === void 0 ? false : _ref$configPending;
|
|
4296
4468
|
var _useTranslation = useTranslation(),
|
|
4297
4469
|
t = _useTranslation.t;
|
|
4298
4470
|
var _useRuleModel = useRuleModel(schema),
|
|
@@ -4367,6 +4539,7 @@ var RecipientPane = function RecipientPane(_ref) {
|
|
|
4367
4539
|
if (!editor) {
|
|
4368
4540
|
return /*#__PURE__*/jsx(OptionsPane, {
|
|
4369
4541
|
belowContent: belowContent,
|
|
4542
|
+
configPending: configPending,
|
|
4370
4543
|
index: index,
|
|
4371
4544
|
schema: schema,
|
|
4372
4545
|
anchor: BUILDER_ANCHORS.ACTION_RECIPIENT
|
|
@@ -4466,7 +4639,7 @@ var ConditionValueFields = function ConditionValueFields(_ref) {
|
|
|
4466
4639
|
}
|
|
4467
4640
|
if (type === CONDITION_VALUE_TYPES.multiSelectCreate) {
|
|
4468
4641
|
var _current = getIn(values, valuesPath) || [];
|
|
4469
|
-
return /*#__PURE__*/jsx(Select
|
|
4642
|
+
return /*#__PURE__*/jsx(Select, {
|
|
4470
4643
|
autoFocus: true,
|
|
4471
4644
|
isCreatable: true,
|
|
4472
4645
|
isMulti: true,
|
|
@@ -4492,9 +4665,6 @@ var ConditionValueFields = function ConditionValueFields(_ref) {
|
|
|
4492
4665
|
error: fieldError(valuePath),
|
|
4493
4666
|
orientation: "vertical",
|
|
4494
4667
|
value: String(_current2 !== null && _current2 !== void 0 ? _current2 : ""),
|
|
4495
|
-
onBlur: function onBlur() {
|
|
4496
|
-
return setFieldTouched(valuePath, true);
|
|
4497
|
-
},
|
|
4498
4668
|
onValueChange: function onValueChange(value) {
|
|
4499
4669
|
return setFieldValue(valuePath, value);
|
|
4500
4670
|
},
|
|
@@ -4719,7 +4889,10 @@ var Form = function Form(_ref) {
|
|
|
4719
4889
|
values: values,
|
|
4720
4890
|
schema: schema
|
|
4721
4891
|
});
|
|
4722
|
-
if (!isRuleComplete(
|
|
4892
|
+
if (!isRuleComplete({
|
|
4893
|
+
rule: rule,
|
|
4894
|
+
schema: schema
|
|
4895
|
+
}) || invalidScopeIndexes({
|
|
4723
4896
|
rule: rule,
|
|
4724
4897
|
schema: schema
|
|
4725
4898
|
}).length || invalidScopePhoneFieldIndexes({
|