@bigbinary/neeto-rules-frontend 2.7.27 → 2.7.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.ready +1 -1
- package/dist/NeetoRules.js +1 -1
- package/dist/NeetoRulesBuilder.js +2 -2
- package/dist/NeetoRulesForm.js +2 -2
- package/dist/RulePreview.js +1 -1
- package/dist/cjs/v2/NeetoRulesBuilder.js +485 -262
- package/dist/cjs/v2/NeetoRulesBuilder.js.map +1 -1
- package/dist/cjs/v2/NeetoRulesForm.js +1 -1
- package/dist/cjs/v2/index.js +1 -1
- package/dist/{index-DfYO62zW.js → index-B9wfLgdl.js} +4 -4
- package/dist/index-B9wfLgdl.js.map +1 -0
- package/dist/{index-BUcQsAbf.js → index-DnUyU-KI.js} +8 -2
- package/dist/index-DnUyU-KI.js.map +1 -0
- package/dist/{index-6HdKTEnP.js → index-DuotbpzE.js} +2 -2
- package/dist/{index-6HdKTEnP.js.map → index-DuotbpzE.js.map} +1 -1
- package/dist/index.js +2 -2
- package/dist/{utils-DeqHhpwQ.js → utils-Cp7CD4kh.js} +2 -2
- package/dist/{utils-DeqHhpwQ.js.map → utils-Cp7CD4kh.js.map} +1 -1
- package/dist/v2/NeetoRules.js +1 -1
- package/dist/v2/NeetoRulesBuilder.js +488 -265
- package/dist/v2/NeetoRulesBuilder.js.map +1 -1
- package/dist/v2/NeetoRulesForm.js +2 -2
- package/dist/v2/RulePreview.js +1 -1
- package/dist/v2/index.js +2 -2
- package/package.json +7 -7
- package/dist/index-BUcQsAbf.js.map +0 -1
- package/dist/index-DfYO62zW.js.map +0 -1
|
@@ -7,17 +7,17 @@ import { Button, Select, Input, Checkbox, Typography, RadioGroup, Textarea, Date
|
|
|
7
7
|
import { Input as Input$1, Select as Select$1, ActionBlock } from '@bigbinary/neeto-atoms/formik';
|
|
8
8
|
import classNames from 'classnames';
|
|
9
9
|
import { useFormikContext, getIn, useField, Formik, Form as Form$1 } from 'formik';
|
|
10
|
-
import { isNotEmpty, toLabelAndValue, removeBy, isNot, noop } from '@bigbinary/neeto-cist';
|
|
10
|
+
import { isNotEmpty, toLabelAndValue, removeBy, findBy, isPresent, isNot, noop } from '@bigbinary/neeto-cist';
|
|
11
11
|
import Container from '@bigbinary/neeto-molecules/v2/Container';
|
|
12
12
|
import Header from '@bigbinary/neeto-molecules/v2/Header';
|
|
13
13
|
import { useTranslation } from 'react-i18next';
|
|
14
|
-
import { r as
|
|
14
|
+
import { r as useHasFieldChanged, s as areValuesEqual, t as useResetSaveAsTemplateOnHide, v as SelectTemplateField, E as EditorAction, w as SaveAsTemplate, x as setEditorContent, y as ApiFields, L as ListField, o as Panel, z as ErrorCallout, B as SmsFields, M as MIN_DELAY_VALUE, C as MAX_DELAY_VALUE, G as PhoneNumberField, l as formatData, u as usePollRuleName, T as TouchErrors, n as ScrollToErrorField, p as getValidationSchema, q as DEFAULT_INITIAL_VALUE, m as buildPayload } from '../index-B9wfLgdl.js';
|
|
15
15
|
import { u as useCustomDataStore } from '../useCustomDataStore-CEbhXugO.js';
|
|
16
16
|
import { u as useUtilityStore } from '../useUtilityStore-BVCulMEC.js';
|
|
17
17
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
18
18
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
19
19
|
import Plus from '@bigbinary/neeto-icons/Plus';
|
|
20
|
-
import { isNil, isEmpty, assoc, mergeDeepRight, pluck } from 'ramda';
|
|
20
|
+
import { isNil, isEmpty, assoc, mergeDeepRight, pluck, F } from 'ramda';
|
|
21
21
|
import Delete from '@bigbinary/neeto-icons/Delete';
|
|
22
22
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
23
23
|
import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
@@ -28,10 +28,11 @@ import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
|
28
28
|
import useHotkeys from '@bigbinary/neeto-hotkeys';
|
|
29
29
|
import Search from '@bigbinary/neeto-icons/Search';
|
|
30
30
|
import { dayjs } from '@bigbinary/neeto-commons-frontend/v2/utils';
|
|
31
|
-
import { D as DATE_FORMAT } from '../utils-
|
|
31
|
+
import { D as DATE_FORMAT, b as getDateTimeValue, d as DATE_TIME_FORMAT, e as DATE_TIME_TYPES } from '../utils-Cp7CD4kh.js';
|
|
32
32
|
import Up from '@bigbinary/neeto-icons/Up';
|
|
33
33
|
import Down from '@bigbinary/neeto-icons/Down';
|
|
34
34
|
import Info from '@bigbinary/neeto-icons/Info';
|
|
35
|
+
import { globalProps } from '@bigbinary/neeto-commons-frontend/v2/initializers';
|
|
35
36
|
import '../useAutomationRulesApi-C9I3wUZ8.js';
|
|
36
37
|
import '@tanstack/react-query';
|
|
37
38
|
import '@bigbinary/neeto-commons-frontend/react-utils';
|
|
@@ -47,7 +48,6 @@ import '@babel/runtime/helpers/toArray';
|
|
|
47
48
|
import '@bigbinary/neeto-molecules/v2/PhoneNumber';
|
|
48
49
|
import 'react-select';
|
|
49
50
|
import '../constants-CYdcft3h.js';
|
|
50
|
-
import '@bigbinary/neeto-commons-frontend/v2/initializers';
|
|
51
51
|
import '@bigbinary/neeto-editor/v2/utils';
|
|
52
52
|
import 'zustand';
|
|
53
53
|
import '@bigbinary/neeto-commons-frontend/initializers';
|
|
@@ -251,8 +251,8 @@ var useReplayFlash = function useReplayFlash(flashSeq) {
|
|
|
251
251
|
};
|
|
252
252
|
|
|
253
253
|
var _excluded$1 = ["children", "state", "active", "invalid", "onClick", "className", "dataTestid"];
|
|
254
|
-
function ownKeys$
|
|
255
|
-
function _objectSpread$
|
|
254
|
+
function ownKeys$e(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
255
|
+
function _objectSpread$e(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$e(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$e(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
256
256
|
var Token = function Token(_ref) {
|
|
257
257
|
var children = _ref.children,
|
|
258
258
|
_ref$state = _ref.state,
|
|
@@ -267,7 +267,7 @@ var Token = function Token(_ref) {
|
|
|
267
267
|
rest = _objectWithoutProperties(_ref, _excluded$1);
|
|
268
268
|
var isInteractive = typeof onClick === "function" && state !== TOKEN_STATE.DISABLED;
|
|
269
269
|
var tokenRef = useReplayFlash(invalid);
|
|
270
|
-
return /*#__PURE__*/jsx("span", _objectSpread$
|
|
270
|
+
return /*#__PURE__*/jsx("span", _objectSpread$e(_objectSpread$e({
|
|
271
271
|
"data-testid": dataTestid,
|
|
272
272
|
ref: tokenRef,
|
|
273
273
|
role: isInteractive ? "button" : undefined,
|
|
@@ -305,8 +305,8 @@ var Values = function Values(_ref) {
|
|
|
305
305
|
});
|
|
306
306
|
};
|
|
307
307
|
|
|
308
|
-
function ownKeys$
|
|
309
|
-
function _objectSpread$
|
|
308
|
+
function ownKeys$d(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
309
|
+
function _objectSpread$d(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$d(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$d(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
310
310
|
var humanize = function humanize(value) {
|
|
311
311
|
return String(value !== null && value !== void 0 ? value : "").replace(/[._]/g, " ").trim();
|
|
312
312
|
};
|
|
@@ -752,7 +752,7 @@ var normalizeTriggers = function normalizeTriggers(triggers) {
|
|
|
752
752
|
};
|
|
753
753
|
var normalizeSchema = function normalizeSchema() {
|
|
754
754
|
var rawSchema = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
755
|
-
return mergeDeepRight(DEFAULT_SCHEMA, _objectSpread$
|
|
755
|
+
return mergeDeepRight(DEFAULT_SCHEMA, _objectSpread$d(_objectSpread$d({}, rawSchema), {}, {
|
|
756
756
|
triggers: normalizeTriggers(rawSchema.triggers)
|
|
757
757
|
}));
|
|
758
758
|
};
|
|
@@ -883,34 +883,69 @@ var setTriggers = function setTriggers(_ref33) {
|
|
|
883
883
|
value: triggers
|
|
884
884
|
};
|
|
885
885
|
};
|
|
886
|
-
|
|
886
|
+
|
|
887
|
+
// Removed saved triggers must be sent with _destroy, or the backend keeps them.
|
|
888
|
+
var replaceTriggers = function replaceTriggers(_ref34) {
|
|
887
889
|
var schema = _ref34.schema,
|
|
888
|
-
|
|
890
|
+
values = _ref34.values,
|
|
891
|
+
triggers = _ref34.triggers;
|
|
892
|
+
var fieldKey = fieldKeysFromSchema(schema).triggers;
|
|
893
|
+
var keptIds = triggers.map(function (trigger) {
|
|
894
|
+
return trigger === null || trigger === void 0 ? void 0 : trigger.id;
|
|
895
|
+
}).filter(Boolean);
|
|
896
|
+
var removed = asArray(valueAt({
|
|
897
|
+
values: values,
|
|
898
|
+
key: fieldKey
|
|
899
|
+
})).filter(function (trigger) {
|
|
900
|
+
return (trigger === null || trigger === void 0 ? void 0 : trigger.id) && !keptIds.includes(trigger.id);
|
|
901
|
+
}).map(function (trigger) {
|
|
902
|
+
return _objectSpread$d(_objectSpread$d({}, trigger), {}, {
|
|
903
|
+
_destroy: true
|
|
904
|
+
});
|
|
905
|
+
});
|
|
906
|
+
var edits = [setTriggers({
|
|
907
|
+
schema: schema,
|
|
908
|
+
triggers: triggers
|
|
909
|
+
})];
|
|
910
|
+
if (removed.length) {
|
|
911
|
+
var _values$fieldKey;
|
|
912
|
+
// eslint-disable-next-line security/detect-object-injection
|
|
913
|
+
var deleted = asArray(values === null || values === void 0 || (_values$fieldKey = values[fieldKey]) === null || _values$fieldKey === void 0 ? void 0 : _values$fieldKey.deleted);
|
|
914
|
+
edits.push({
|
|
915
|
+
path: "".concat(fieldKey, ".deleted"),
|
|
916
|
+
value: [].concat(_toConsumableArray(deleted), _toConsumableArray(removed))
|
|
917
|
+
});
|
|
918
|
+
}
|
|
919
|
+
return edits;
|
|
920
|
+
};
|
|
921
|
+
var setPerformer = function setPerformer(_ref35) {
|
|
922
|
+
var schema = _ref35.schema,
|
|
923
|
+
performer = _ref35.performer;
|
|
889
924
|
return {
|
|
890
925
|
path: "".concat(fieldKeysFromSchema(schema).performer, ".value"),
|
|
891
926
|
value: performer
|
|
892
927
|
};
|
|
893
928
|
};
|
|
894
|
-
var setActions = function setActions(
|
|
895
|
-
var schema =
|
|
896
|
-
actions =
|
|
929
|
+
var setActions = function setActions(_ref36) {
|
|
930
|
+
var schema = _ref36.schema,
|
|
931
|
+
actions = _ref36.actions;
|
|
897
932
|
return {
|
|
898
933
|
path: "".concat(fieldKeysFromSchema(schema).actions, ".value"),
|
|
899
934
|
value: actions
|
|
900
935
|
};
|
|
901
936
|
};
|
|
902
|
-
var setConditions = function setConditions(
|
|
903
|
-
var schema =
|
|
904
|
-
conditions =
|
|
937
|
+
var setConditions = function setConditions(_ref37) {
|
|
938
|
+
var schema = _ref37.schema,
|
|
939
|
+
conditions = _ref37.conditions;
|
|
905
940
|
return {
|
|
906
941
|
path: "".concat(fieldKeysFromSchema(schema).conditions, ".value"),
|
|
907
942
|
value: conditions
|
|
908
943
|
};
|
|
909
944
|
};
|
|
910
|
-
var setConditionMode = function setConditionMode(
|
|
911
|
-
var schema =
|
|
912
|
-
conditions =
|
|
913
|
-
joinType =
|
|
945
|
+
var setConditionMode = function setConditionMode(_ref38) {
|
|
946
|
+
var schema = _ref38.schema,
|
|
947
|
+
conditions = _ref38.conditions,
|
|
948
|
+
joinType = _ref38.joinType;
|
|
914
949
|
return setConditions({
|
|
915
950
|
schema: schema,
|
|
916
951
|
conditions: conditions.map(function (condition) {
|
|
@@ -918,34 +953,34 @@ var setConditionMode = function setConditionMode(_ref37) {
|
|
|
918
953
|
})
|
|
919
954
|
});
|
|
920
955
|
};
|
|
921
|
-
var setDelay = function setDelay(
|
|
922
|
-
var schema =
|
|
923
|
-
delay =
|
|
956
|
+
var setDelay = function setDelay(_ref39) {
|
|
957
|
+
var schema = _ref39.schema,
|
|
958
|
+
delay = _ref39.delay;
|
|
924
959
|
return {
|
|
925
960
|
path: "".concat(fieldKeysFromSchema(schema).delay, ".value"),
|
|
926
961
|
value: delay !== null && delay !== void 0 ? delay : {}
|
|
927
962
|
};
|
|
928
963
|
};
|
|
929
|
-
var setActive = function setActive(
|
|
930
|
-
var schema =
|
|
931
|
-
active =
|
|
964
|
+
var setActive = function setActive(_ref40) {
|
|
965
|
+
var schema = _ref40.schema,
|
|
966
|
+
active = _ref40.active;
|
|
932
967
|
return {
|
|
933
968
|
path: "".concat(fieldKeysFromSchema(schema).status, ".value"),
|
|
934
969
|
value: active ? STATUS_KEYS.ENABLED : STATUS_KEYS.DISABLED
|
|
935
970
|
};
|
|
936
971
|
};
|
|
937
|
-
var setScope = function setScope(
|
|
938
|
-
var schema =
|
|
939
|
-
scope =
|
|
972
|
+
var setScope = function setScope(_ref41) {
|
|
973
|
+
var schema = _ref41.schema,
|
|
974
|
+
scope = _ref41.scope;
|
|
940
975
|
return {
|
|
941
976
|
path: "".concat(fieldKeysFromSchema(schema).scope, ".value"),
|
|
942
977
|
value: scope
|
|
943
978
|
};
|
|
944
979
|
};
|
|
945
|
-
var removeArrayItem = function removeArrayItem(
|
|
946
|
-
var values =
|
|
947
|
-
fieldKey =
|
|
948
|
-
index =
|
|
980
|
+
var removeArrayItem = function removeArrayItem(_ref42) {
|
|
981
|
+
var values = _ref42.values,
|
|
982
|
+
fieldKey = _ref42.fieldKey,
|
|
983
|
+
index = _ref42.index;
|
|
949
984
|
var list = asArray(valueAt({
|
|
950
985
|
values: values,
|
|
951
986
|
key: fieldKey
|
|
@@ -960,21 +995,21 @@ var removeArrayItem = function removeArrayItem(_ref41) {
|
|
|
960
995
|
value: nextList
|
|
961
996
|
}];
|
|
962
997
|
if (removed !== null && removed !== void 0 && removed.id) {
|
|
963
|
-
var _values$
|
|
998
|
+
var _values$fieldKey2;
|
|
964
999
|
// eslint-disable-next-line security/detect-object-injection
|
|
965
|
-
var deleted = asArray(values === null || values === void 0 || (_values$
|
|
1000
|
+
var deleted = asArray(values === null || values === void 0 || (_values$fieldKey2 = values[fieldKey]) === null || _values$fieldKey2 === void 0 ? void 0 : _values$fieldKey2.deleted);
|
|
966
1001
|
result.push({
|
|
967
1002
|
path: "".concat(fieldKey, ".deleted"),
|
|
968
|
-
value: [].concat(_toConsumableArray(deleted), [_objectSpread$
|
|
1003
|
+
value: [].concat(_toConsumableArray(deleted), [_objectSpread$d(_objectSpread$d({}, removed), {}, {
|
|
969
1004
|
_destroy: true
|
|
970
1005
|
})])
|
|
971
1006
|
});
|
|
972
1007
|
}
|
|
973
1008
|
return result;
|
|
974
1009
|
};
|
|
975
|
-
var clearArrayItems = function clearArrayItems(
|
|
976
|
-
var values =
|
|
977
|
-
fieldKey =
|
|
1010
|
+
var clearArrayItems = function clearArrayItems(_ref43) {
|
|
1011
|
+
var values = _ref43.values,
|
|
1012
|
+
fieldKey = _ref43.fieldKey;
|
|
978
1013
|
var list = asArray(valueAt({
|
|
979
1014
|
values: values,
|
|
980
1015
|
key: fieldKey
|
|
@@ -982,7 +1017,7 @@ var clearArrayItems = function clearArrayItems(_ref42) {
|
|
|
982
1017
|
var removed = list.filter(function (item) {
|
|
983
1018
|
return item === null || item === void 0 ? void 0 : item.id;
|
|
984
1019
|
}).map(function (item) {
|
|
985
|
-
return _objectSpread$
|
|
1020
|
+
return _objectSpread$d(_objectSpread$d({}, item), {}, {
|
|
986
1021
|
_destroy: true
|
|
987
1022
|
});
|
|
988
1023
|
});
|
|
@@ -991,9 +1026,9 @@ var clearArrayItems = function clearArrayItems(_ref42) {
|
|
|
991
1026
|
value: []
|
|
992
1027
|
}];
|
|
993
1028
|
if (removed.length) {
|
|
994
|
-
var _values$
|
|
1029
|
+
var _values$fieldKey3;
|
|
995
1030
|
// eslint-disable-next-line security/detect-object-injection
|
|
996
|
-
var deleted = asArray(values === null || values === void 0 || (_values$
|
|
1031
|
+
var deleted = asArray(values === null || values === void 0 || (_values$fieldKey3 = values[fieldKey]) === null || _values$fieldKey3 === void 0 ? void 0 : _values$fieldKey3.deleted);
|
|
997
1032
|
result.push({
|
|
998
1033
|
path: "".concat(fieldKey, ".deleted"),
|
|
999
1034
|
value: [].concat(_toConsumableArray(deleted), _toConsumableArray(removed))
|
|
@@ -1002,8 +1037,8 @@ var clearArrayItems = function clearArrayItems(_ref42) {
|
|
|
1002
1037
|
return result;
|
|
1003
1038
|
};
|
|
1004
1039
|
|
|
1005
|
-
function ownKeys$
|
|
1006
|
-
function _objectSpread$
|
|
1040
|
+
function ownKeys$c(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1041
|
+
function _objectSpread$c(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$c(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$c(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1007
1042
|
var ConditionRow = function ConditionRow(_ref) {
|
|
1008
1043
|
var _schema$conditions;
|
|
1009
1044
|
var rule = _ref.rule,
|
|
@@ -1120,7 +1155,7 @@ var ConditionRow = function ConditionRow(_ref) {
|
|
|
1120
1155
|
index: index
|
|
1121
1156
|
});
|
|
1122
1157
|
},
|
|
1123
|
-
children: value ? /*#__PURE__*/jsx(Values, _objectSpread$
|
|
1158
|
+
children: value ? /*#__PURE__*/jsx(Values, _objectSpread$c({}, value)) : t("neetoRules.form.addValue")
|
|
1124
1159
|
})]
|
|
1125
1160
|
}) : /*#__PURE__*/jsx(Token, {
|
|
1126
1161
|
active: isActive({
|
|
@@ -1153,7 +1188,7 @@ var ConditionRow = function ConditionRow(_ref) {
|
|
|
1153
1188
|
position: "top"
|
|
1154
1189
|
},
|
|
1155
1190
|
onClick: handleAddCondition
|
|
1156
|
-
}), handleRemove && /*#__PURE__*/jsx(Button, _objectSpread$
|
|
1191
|
+
}), handleRemove && /*#__PURE__*/jsx(Button, _objectSpread$c({
|
|
1157
1192
|
"data-testid": "cond-remove-".concat(index),
|
|
1158
1193
|
icon: Delete,
|
|
1159
1194
|
size: "sm",
|
|
@@ -1192,8 +1227,8 @@ var Connector = function Connector(_ref) {
|
|
|
1192
1227
|
});
|
|
1193
1228
|
};
|
|
1194
1229
|
|
|
1195
|
-
function ownKeys$
|
|
1196
|
-
function _objectSpread$
|
|
1230
|
+
function ownKeys$b(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1231
|
+
function _objectSpread$b(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$b(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$b(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1197
1232
|
var DelayRow = function DelayRow(_ref) {
|
|
1198
1233
|
var rule = _ref.rule,
|
|
1199
1234
|
handleToken = _ref.onToken,
|
|
@@ -1245,7 +1280,7 @@ var DelayRow = function DelayRow(_ref) {
|
|
|
1245
1280
|
})]
|
|
1246
1281
|
}), handleRemove && /*#__PURE__*/jsx("div", {
|
|
1247
1282
|
className: "mb-row-actions",
|
|
1248
|
-
children: /*#__PURE__*/jsx(Button, _objectSpread$
|
|
1283
|
+
children: /*#__PURE__*/jsx(Button, _objectSpread$b({
|
|
1249
1284
|
"data-testid": "rule-delay-remove",
|
|
1250
1285
|
icon: Delete,
|
|
1251
1286
|
size: "sm",
|
|
@@ -1335,8 +1370,8 @@ var MetaBlock = function MetaBlock(_ref) {
|
|
|
1335
1370
|
});
|
|
1336
1371
|
};
|
|
1337
1372
|
|
|
1338
|
-
function ownKeys$
|
|
1339
|
-
function _objectSpread$
|
|
1373
|
+
function ownKeys$a(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1374
|
+
function _objectSpread$a(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$a(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$a(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1340
1375
|
var itemLabel = function itemLabel(item) {
|
|
1341
1376
|
return (item === null || item === void 0 ? void 0 : item.label) || (item === null || item === void 0 ? void 0 : item.name) || (item === null || item === void 0 ? void 0 : item.value) || String(item !== null && item !== void 0 ? item : "");
|
|
1342
1377
|
};
|
|
@@ -1498,7 +1533,7 @@ var ScopeRow = function ScopeRow(_ref2) {
|
|
|
1498
1533
|
type: BUILDER_ANCHORS.SCOPE
|
|
1499
1534
|
});
|
|
1500
1535
|
}
|
|
1501
|
-
}), handleRemoveScope && /*#__PURE__*/jsx(Button, _objectSpread$
|
|
1536
|
+
}), handleRemoveScope && /*#__PURE__*/jsx(Button, _objectSpread$a({
|
|
1502
1537
|
"data-testid": "scope-remove-".concat(index),
|
|
1503
1538
|
icon: Delete,
|
|
1504
1539
|
size: "sm",
|
|
@@ -1515,8 +1550,8 @@ var ScopeRow = function ScopeRow(_ref2) {
|
|
|
1515
1550
|
});
|
|
1516
1551
|
};
|
|
1517
1552
|
|
|
1518
|
-
function ownKeys$
|
|
1519
|
-
function _objectSpread$
|
|
1553
|
+
function ownKeys$9(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1554
|
+
function _objectSpread$9(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$9(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$9(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1520
1555
|
var ActionRow = function ActionRow(_ref) {
|
|
1521
1556
|
var schema = _ref.schema,
|
|
1522
1557
|
action = _ref.action,
|
|
@@ -1609,7 +1644,7 @@ var ActionRow = function ActionRow(_ref) {
|
|
|
1609
1644
|
index: index
|
|
1610
1645
|
});
|
|
1611
1646
|
},
|
|
1612
|
-
children: configValueParts ? /*#__PURE__*/jsx(Values, _objectSpread$
|
|
1647
|
+
children: configValueParts ? /*#__PURE__*/jsx(Values, _objectSpread$9({}, configValueParts)) : sentencify(configValuePlaceholder) || t("neetoRules.builder.selectFallback")
|
|
1613
1648
|
})]
|
|
1614
1649
|
}, "config") : null;
|
|
1615
1650
|
var recipientToken = needsRecipient ? /*#__PURE__*/jsxs(Fragment, {
|
|
@@ -1712,7 +1747,7 @@ var ActionRow = function ActionRow(_ref) {
|
|
|
1712
1747
|
index: index
|
|
1713
1748
|
});
|
|
1714
1749
|
},
|
|
1715
|
-
children: configValueParts ? /*#__PURE__*/jsx(Values, _objectSpread$
|
|
1750
|
+
children: configValueParts ? /*#__PURE__*/jsx(Values, _objectSpread$9({}, configValueParts)) : sentencify(configValuePlaceholder) || paramPlaceholder
|
|
1716
1751
|
}) : configLabel && /*#__PURE__*/jsxs(Token, {
|
|
1717
1752
|
className: "mb-tok-medium",
|
|
1718
1753
|
dataTestid: "action-config-".concat(index),
|
|
@@ -1748,7 +1783,7 @@ var ActionRow = function ActionRow(_ref) {
|
|
|
1748
1783
|
position: "top"
|
|
1749
1784
|
},
|
|
1750
1785
|
onClick: handleAddAction
|
|
1751
|
-
}), handleRemove && /*#__PURE__*/jsx(Button, _objectSpread$
|
|
1786
|
+
}), handleRemove && /*#__PURE__*/jsx(Button, _objectSpread$9({
|
|
1752
1787
|
"data-testid": "action-remove-".concat(index),
|
|
1753
1788
|
icon: Delete,
|
|
1754
1789
|
size: "sm",
|
|
@@ -1855,8 +1890,8 @@ var ThenBlock = function ThenBlock(_ref) {
|
|
|
1855
1890
|
});
|
|
1856
1891
|
};
|
|
1857
1892
|
|
|
1858
|
-
function ownKeys$
|
|
1859
|
-
function _objectSpread$
|
|
1893
|
+
function ownKeys$8(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1894
|
+
function _objectSpread$8(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$8(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$8(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1860
1895
|
var WhenBlock = function WhenBlock(_ref) {
|
|
1861
1896
|
var _schema$actor;
|
|
1862
1897
|
var rule = _ref.rule,
|
|
@@ -2011,7 +2046,7 @@ var WhenBlock = function WhenBlock(_ref) {
|
|
|
2011
2046
|
position: "top"
|
|
2012
2047
|
},
|
|
2013
2048
|
onClick: handleAddCondition
|
|
2014
|
-
}), handleClearTrigger && /*#__PURE__*/jsx(Button, _objectSpread$
|
|
2049
|
+
}), handleClearTrigger && /*#__PURE__*/jsx(Button, _objectSpread$8({
|
|
2015
2050
|
"data-testid": "trigger-clear",
|
|
2016
2051
|
icon: Delete,
|
|
2017
2052
|
size: "sm",
|
|
@@ -2030,8 +2065,8 @@ var WhenBlock = function WhenBlock(_ref) {
|
|
|
2030
2065
|
};
|
|
2031
2066
|
|
|
2032
2067
|
var _excluded = ["type"];
|
|
2033
|
-
function ownKeys$
|
|
2034
|
-
function _objectSpread$
|
|
2068
|
+
function ownKeys$7(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2069
|
+
function _objectSpread$7(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$7(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$7(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2035
2070
|
var usePaneCascade = function usePaneCascade(schema) {
|
|
2036
2071
|
var _useUtilityStore = useUtilityStore(useShallow(function (store) {
|
|
2037
2072
|
return {
|
|
@@ -2049,7 +2084,7 @@ var usePaneCascade = function usePaneCascade(schema) {
|
|
|
2049
2084
|
type: type,
|
|
2050
2085
|
variant: "builder",
|
|
2051
2086
|
size: LARGE_PANEL_TYPES.includes(type) ? "large" : "small",
|
|
2052
|
-
data: _objectSpread$
|
|
2087
|
+
data: _objectSpread$7({
|
|
2053
2088
|
schema: schema
|
|
2054
2089
|
}, data)
|
|
2055
2090
|
});
|
|
@@ -2061,7 +2096,7 @@ var usePaneCascade = function usePaneCascade(schema) {
|
|
|
2061
2096
|
rest = _objectWithoutProperties(token, _excluded);
|
|
2062
2097
|
openType({
|
|
2063
2098
|
type: type,
|
|
2064
|
-
data: _objectSpread$
|
|
2099
|
+
data: _objectSpread$7({
|
|
2065
2100
|
anchor: anchor
|
|
2066
2101
|
}, rest)
|
|
2067
2102
|
});
|
|
@@ -2094,9 +2129,10 @@ var useRuleModel = function useRuleModel(schema) {
|
|
|
2094
2129
|
return {
|
|
2095
2130
|
rule: rule,
|
|
2096
2131
|
fieldKeys: fieldKeysFromSchema(schema),
|
|
2097
|
-
setTriggers: function setTriggers
|
|
2098
|
-
return
|
|
2132
|
+
setTriggers: function setTriggers(triggers) {
|
|
2133
|
+
return applyAll(replaceTriggers({
|
|
2099
2134
|
schema: schema,
|
|
2135
|
+
values: values,
|
|
2100
2136
|
triggers: triggers
|
|
2101
2137
|
}));
|
|
2102
2138
|
},
|
|
@@ -2178,8 +2214,8 @@ var useRuleModel = function useRuleModel(schema) {
|
|
|
2178
2214
|
};
|
|
2179
2215
|
};
|
|
2180
2216
|
|
|
2181
|
-
function ownKeys$
|
|
2182
|
-
function _objectSpread$
|
|
2217
|
+
function ownKeys$6(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2218
|
+
function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$6(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$6(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2183
2219
|
var triggerValue = function triggerValue(option) {
|
|
2184
2220
|
var _ref, _option$eventValue;
|
|
2185
2221
|
return (_ref = (_option$eventValue = option.eventValue) !== null && _option$eventValue !== void 0 ? _option$eventValue : option.value) !== null && _ref !== void 0 ? _ref : option.id;
|
|
@@ -2353,11 +2389,42 @@ var recipientsFor = function recipientsFor(_ref11) {
|
|
|
2353
2389
|
if (option !== null && option !== void 0 && option.recipients) return option.recipients;
|
|
2354
2390
|
return ((_schema$actions8 = schema.actions) === null || _schema$actions8 === void 0 ? void 0 : _schema$actions8.recipients) || [];
|
|
2355
2391
|
};
|
|
2356
|
-
|
|
2357
|
-
|
|
2392
|
+
|
|
2393
|
+
// Each action runs once per rule, so hide recipients another row already uses.
|
|
2394
|
+
var availableRecipients = function availableRecipients(_ref12) {
|
|
2358
2395
|
var schema = _ref12.schema,
|
|
2359
2396
|
rule = _ref12.rule,
|
|
2360
|
-
|
|
2397
|
+
index = _ref12.index;
|
|
2398
|
+
var action = actionAt({
|
|
2399
|
+
rule: rule,
|
|
2400
|
+
index: index
|
|
2401
|
+
});
|
|
2402
|
+
var channel = channelOf({
|
|
2403
|
+
schema: schema,
|
|
2404
|
+
action: action
|
|
2405
|
+
});
|
|
2406
|
+
var usedNames = rule.actions.filter(function (_, position) {
|
|
2407
|
+
return position !== index;
|
|
2408
|
+
}).map(function (item) {
|
|
2409
|
+
return item.name;
|
|
2410
|
+
}).filter(Boolean);
|
|
2411
|
+
return recipientsFor({
|
|
2412
|
+
schema: schema,
|
|
2413
|
+
action: action
|
|
2414
|
+
}).filter(function (recipient) {
|
|
2415
|
+
var _schema$actions9, _schema$actions9$reso;
|
|
2416
|
+
var name = (_schema$actions9 = schema.actions) === null || _schema$actions9 === void 0 || (_schema$actions9$reso = _schema$actions9.resolveName) === null || _schema$actions9$reso === void 0 ? void 0 : _schema$actions9$reso.call(_schema$actions9, {
|
|
2417
|
+
channel: channel,
|
|
2418
|
+
recipient: optionValue(recipient)
|
|
2419
|
+
});
|
|
2420
|
+
return !name || !usedNames.includes(name);
|
|
2421
|
+
});
|
|
2422
|
+
};
|
|
2423
|
+
var nextTriggers = function nextTriggers(_ref13) {
|
|
2424
|
+
var _schema$triggers;
|
|
2425
|
+
var schema = _ref13.schema,
|
|
2426
|
+
rule = _ref13.rule,
|
|
2427
|
+
value = _ref13.value;
|
|
2361
2428
|
if ((_schema$triggers = schema.triggers) !== null && _schema$triggers !== void 0 && _schema$triggers.multi) {
|
|
2362
2429
|
var names = pluck("name", rule.triggers);
|
|
2363
2430
|
return names.includes(value) ? removeBy({
|
|
@@ -2366,16 +2433,16 @@ var nextTriggers = function nextTriggers(_ref12) {
|
|
|
2366
2433
|
name: value
|
|
2367
2434
|
}]);
|
|
2368
2435
|
}
|
|
2369
|
-
return [_objectSpread$
|
|
2436
|
+
return [_objectSpread$6(_objectSpread$6({}, rule.triggers[0]), {}, {
|
|
2370
2437
|
name: value
|
|
2371
2438
|
})];
|
|
2372
2439
|
};
|
|
2373
|
-
var nextConditionAt = function nextConditionAt(
|
|
2440
|
+
var nextConditionAt = function nextConditionAt(_ref14) {
|
|
2374
2441
|
var _field$allowMatching;
|
|
2375
|
-
var schema =
|
|
2376
|
-
rule =
|
|
2377
|
-
index =
|
|
2378
|
-
value =
|
|
2442
|
+
var schema = _ref14.schema,
|
|
2443
|
+
rule = _ref14.rule,
|
|
2444
|
+
index = _ref14.index,
|
|
2445
|
+
value = _ref14.value;
|
|
2379
2446
|
var field = findField({
|
|
2380
2447
|
schema: schema,
|
|
2381
2448
|
value: value
|
|
@@ -2387,20 +2454,20 @@ var nextConditionAt = function nextConditionAt(_ref13) {
|
|
|
2387
2454
|
var first = field === null || field === void 0 || (_field$allowMatching = field.allowMatching) === null || _field$allowMatching === void 0 ? void 0 : _field$allowMatching[0];
|
|
2388
2455
|
var defaultVerb = first && !((field === null || field === void 0 ? void 0 : field.noValueForVerbs) || []).includes(first) ? first : undefined;
|
|
2389
2456
|
var verb = ((field === null || field === void 0 ? void 0 : field.allowMatching) || []).includes(previous.verb) ? previous.verb : defaultVerb;
|
|
2390
|
-
return _objectSpread$
|
|
2457
|
+
return _objectSpread$6(_objectSpread$6({}, previous), {}, {
|
|
2391
2458
|
field: value,
|
|
2392
2459
|
kind: field === null || field === void 0 ? void 0 : field.kind,
|
|
2393
2460
|
verb: verb,
|
|
2394
2461
|
metadata: {}
|
|
2395
2462
|
});
|
|
2396
2463
|
};
|
|
2397
|
-
var nextActionAt = function nextActionAt(
|
|
2398
|
-
var _schema$
|
|
2399
|
-
var schema =
|
|
2400
|
-
rule =
|
|
2401
|
-
index =
|
|
2402
|
-
value =
|
|
2403
|
-
if (!((_schema$
|
|
2464
|
+
var nextActionAt = function nextActionAt(_ref15) {
|
|
2465
|
+
var _schema$actions0;
|
|
2466
|
+
var schema = _ref15.schema,
|
|
2467
|
+
rule = _ref15.rule,
|
|
2468
|
+
index = _ref15.index,
|
|
2469
|
+
value = _ref15.value;
|
|
2470
|
+
if (!((_schema$actions0 = schema.actions) !== null && _schema$actions0 !== void 0 && _schema$actions0.resolveName)) {
|
|
2404
2471
|
var option = findActionOption({
|
|
2405
2472
|
schema: schema,
|
|
2406
2473
|
name: value
|
|
@@ -2411,7 +2478,7 @@ var nextActionAt = function nextActionAt(_ref14) {
|
|
|
2411
2478
|
});
|
|
2412
2479
|
if (option !== null && option !== void 0 && option.recipients) {
|
|
2413
2480
|
var _channelChanged = _prev.channel !== value;
|
|
2414
|
-
return _objectSpread$
|
|
2481
|
+
return _objectSpread$6(_objectSpread$6({}, _prev), {}, {
|
|
2415
2482
|
channel: value,
|
|
2416
2483
|
recipient: _channelChanged ? undefined : _prev.recipient,
|
|
2417
2484
|
name: "",
|
|
@@ -2419,7 +2486,7 @@ var nextActionAt = function nextActionAt(_ref14) {
|
|
|
2419
2486
|
metadata: _channelChanged ? {} : _prev.metadata
|
|
2420
2487
|
});
|
|
2421
2488
|
}
|
|
2422
|
-
return _objectSpread$
|
|
2489
|
+
return _objectSpread$6(_objectSpread$6({}, _prev), {}, {
|
|
2423
2490
|
channel: undefined,
|
|
2424
2491
|
recipient: undefined,
|
|
2425
2492
|
name: value,
|
|
@@ -2438,16 +2505,16 @@ var nextActionAt = function nextActionAt(_ref14) {
|
|
|
2438
2505
|
var channelChanged = prevChannel !== value;
|
|
2439
2506
|
var recipient = channelChanged ? undefined : prev.recipient;
|
|
2440
2507
|
if (channelChanged) {
|
|
2441
|
-
var _schema$
|
|
2508
|
+
var _schema$actions1;
|
|
2442
2509
|
var channelRecipients =
|
|
2443
2510
|
// eslint-disable-next-line security/detect-object-injection
|
|
2444
|
-
((_schema$
|
|
2511
|
+
((_schema$actions1 = schema.actions) === null || _schema$actions1 === void 0 || (_schema$actions1 = _schema$actions1.recipientsByChannel) === null || _schema$actions1 === void 0 ? void 0 : _schema$actions1[value]) || [];
|
|
2445
2512
|
if (channelRecipients.length === 1) {
|
|
2446
2513
|
var _channelRecipients = _slicedToArray(channelRecipients, 1);
|
|
2447
2514
|
recipient = _channelRecipients[0];
|
|
2448
2515
|
}
|
|
2449
2516
|
}
|
|
2450
|
-
return _objectSpread$
|
|
2517
|
+
return _objectSpread$6(_objectSpread$6({}, prev), {}, {
|
|
2451
2518
|
channel: value,
|
|
2452
2519
|
recipient: recipient,
|
|
2453
2520
|
name: schema.actions.resolveName({
|
|
@@ -2457,11 +2524,11 @@ var nextActionAt = function nextActionAt(_ref14) {
|
|
|
2457
2524
|
metadata: channelChanged ? {} : prev.metadata
|
|
2458
2525
|
});
|
|
2459
2526
|
};
|
|
2460
|
-
var appendScopeItem = function appendScopeItem(
|
|
2527
|
+
var appendScopeItem = function appendScopeItem(_ref16) {
|
|
2461
2528
|
var _sc$requiresPhone;
|
|
2462
|
-
var schema =
|
|
2463
|
-
rule =
|
|
2464
|
-
value =
|
|
2529
|
+
var schema = _ref16.schema,
|
|
2530
|
+
rule = _ref16.rule,
|
|
2531
|
+
value = _ref16.value;
|
|
2465
2532
|
var sc = schema.scope || {};
|
|
2466
2533
|
var option = (sc.options || []).find(function (candidate) {
|
|
2467
2534
|
return optionValue(candidate) === value;
|
|
@@ -2474,16 +2541,16 @@ var appendScopeItem = function appendScopeItem(_ref15) {
|
|
|
2474
2541
|
schema: schema,
|
|
2475
2542
|
item: option
|
|
2476
2543
|
});
|
|
2477
|
-
return (phoneFields === null || phoneFields === void 0 ? void 0 : phoneFields.length) === 1 ? _objectSpread$
|
|
2544
|
+
return (phoneFields === null || phoneFields === void 0 ? void 0 : phoneFields.length) === 1 ? _objectSpread$6(_objectSpread$6({}, option), {}, {
|
|
2478
2545
|
phoneField: phoneFields[0].value
|
|
2479
2546
|
}) : option;
|
|
2480
2547
|
};
|
|
2481
|
-
var nextActionRecipientAt = function nextActionRecipientAt(
|
|
2482
|
-
var _schema$
|
|
2483
|
-
var schema =
|
|
2484
|
-
rule =
|
|
2485
|
-
index =
|
|
2486
|
-
value =
|
|
2548
|
+
var nextActionRecipientAt = function nextActionRecipientAt(_ref17) {
|
|
2549
|
+
var _schema$actions10;
|
|
2550
|
+
var schema = _ref17.schema,
|
|
2551
|
+
rule = _ref17.rule,
|
|
2552
|
+
index = _ref17.index,
|
|
2553
|
+
value = _ref17.value;
|
|
2487
2554
|
var prev = actionAt({
|
|
2488
2555
|
rule: rule,
|
|
2489
2556
|
index: index
|
|
@@ -2492,21 +2559,21 @@ var nextActionRecipientAt = function nextActionRecipientAt(_ref16) {
|
|
|
2492
2559
|
schema: schema,
|
|
2493
2560
|
action: prev
|
|
2494
2561
|
});
|
|
2495
|
-
return _objectSpread$
|
|
2562
|
+
return _objectSpread$6(_objectSpread$6({}, prev), {}, {
|
|
2496
2563
|
recipient: value,
|
|
2497
|
-
name: (_schema$
|
|
2564
|
+
name: (_schema$actions10 = schema.actions) !== null && _schema$actions10 !== void 0 && _schema$actions10.resolveName ? schema.actions.resolveName({
|
|
2498
2565
|
channel: channel,
|
|
2499
2566
|
recipient: value
|
|
2500
2567
|
}) : value
|
|
2501
2568
|
});
|
|
2502
2569
|
};
|
|
2503
|
-
var descriptorFor = function descriptorFor(
|
|
2570
|
+
var descriptorFor = function descriptorFor(_ref18) {
|
|
2504
2571
|
var _schema$actor2;
|
|
2505
|
-
var anchor =
|
|
2506
|
-
schema =
|
|
2507
|
-
rule =
|
|
2508
|
-
index =
|
|
2509
|
-
stepKey =
|
|
2572
|
+
var anchor = _ref18.anchor,
|
|
2573
|
+
schema = _ref18.schema,
|
|
2574
|
+
rule = _ref18.rule,
|
|
2575
|
+
index = _ref18.index,
|
|
2576
|
+
stepKey = _ref18.stepKey;
|
|
2510
2577
|
switch (anchor) {
|
|
2511
2578
|
case BUILDER_ANCHORS.TRIGGER_ADD:
|
|
2512
2579
|
case BUILDER_ANCHORS.TRIGGER_REPLACE:
|
|
@@ -2619,19 +2686,19 @@ var descriptorFor = function descriptorFor(_ref17) {
|
|
|
2619
2686
|
case BUILDER_ANCHORS.ACTION_ADD:
|
|
2620
2687
|
case BUILDER_ANCHORS.ACTION_CHANNEL:
|
|
2621
2688
|
{
|
|
2622
|
-
var _schema$
|
|
2689
|
+
var _schema$actions12, _channelOf;
|
|
2623
2690
|
var isSwap = anchor === BUILDER_ANCHORS.ACTION_CHANNEL;
|
|
2624
2691
|
var channelMetaFor = function channelMetaFor(value) {
|
|
2625
|
-
var _schema$
|
|
2692
|
+
var _schema$actions11;
|
|
2626
2693
|
return (
|
|
2627
2694
|
// eslint-disable-next-line security/detect-object-injection
|
|
2628
|
-
((_schema$
|
|
2695
|
+
((_schema$actions11 = schema.actions) === null || _schema$actions11 === void 0 || (_schema$actions11 = _schema$actions11.channelMeta) === null || _schema$actions11 === void 0 ? void 0 : _schema$actions11[value]) || {}
|
|
2629
2696
|
);
|
|
2630
2697
|
};
|
|
2631
2698
|
|
|
2632
2699
|
// Both panes list the host's actions in the order it declared them;
|
|
2633
2700
|
// re-ranking only the swap pane made the two disagree.
|
|
2634
|
-
var sourceOptions = ((_schema$
|
|
2701
|
+
var sourceOptions = ((_schema$actions12 = schema.actions) === null || _schema$actions12 === void 0 ? void 0 : _schema$actions12.options) || [];
|
|
2635
2702
|
return {
|
|
2636
2703
|
title: isSwap ? t("neetoRules.builder.panes.actionSwapTitle") : t("neetoRules.builder.panes.actionAddTitle"),
|
|
2637
2704
|
subtitle: isSwap ? t("neetoRules.builder.panes.actionSwapSubtitle") : t("neetoRules.builder.panes.actionAddSubtitle"),
|
|
@@ -2666,7 +2733,7 @@ var descriptorFor = function descriptorFor(_ref17) {
|
|
|
2666
2733
|
}
|
|
2667
2734
|
case BUILDER_ANCHORS.ACTION_RECIPIENT:
|
|
2668
2735
|
{
|
|
2669
|
-
var _schema$
|
|
2736
|
+
var _schema$actions13;
|
|
2670
2737
|
var action = actionAt({
|
|
2671
2738
|
rule: rule,
|
|
2672
2739
|
index: index
|
|
@@ -2676,7 +2743,7 @@ var descriptorFor = function descriptorFor(_ref17) {
|
|
|
2676
2743
|
action: action
|
|
2677
2744
|
});
|
|
2678
2745
|
// eslint-disable-next-line security/detect-object-injection
|
|
2679
|
-
var meta = ((_schema$
|
|
2746
|
+
var meta = ((_schema$actions13 = schema.actions) === null || _schema$actions13 === void 0 || (_schema$actions13 = _schema$actions13.channelMeta) === null || _schema$actions13 === void 0 ? void 0 : _schema$actions13[channel]) || {};
|
|
2680
2747
|
var option = findActionOption({
|
|
2681
2748
|
schema: schema,
|
|
2682
2749
|
name: channel
|
|
@@ -2684,9 +2751,10 @@ var descriptorFor = function descriptorFor(_ref17) {
|
|
|
2684
2751
|
return {
|
|
2685
2752
|
title: meta.recipientTitle || (option === null || option === void 0 ? void 0 : option.recipientTitle) || t("neetoRules.builder.panes.recipientTitle"),
|
|
2686
2753
|
subtitle: meta.recipientSubtitle || (option === null || option === void 0 ? void 0 : option.recipientSubtitle) || t("neetoRules.builder.panes.recipientSubtitle"),
|
|
2687
|
-
options:
|
|
2754
|
+
options: availableRecipients({
|
|
2688
2755
|
schema: schema,
|
|
2689
|
-
|
|
2756
|
+
rule: rule,
|
|
2757
|
+
index: index
|
|
2690
2758
|
}).map(function (recipient) {
|
|
2691
2759
|
return {
|
|
2692
2760
|
label: recipient.label,
|
|
@@ -2794,14 +2862,14 @@ var descriptorFor = function descriptorFor(_ref17) {
|
|
|
2794
2862
|
};
|
|
2795
2863
|
}
|
|
2796
2864
|
};
|
|
2797
|
-
var commitFor = function commitFor(
|
|
2798
|
-
var anchor =
|
|
2799
|
-
schema =
|
|
2800
|
-
rule =
|
|
2801
|
-
index =
|
|
2802
|
-
stepKey =
|
|
2803
|
-
value =
|
|
2804
|
-
helpers =
|
|
2865
|
+
var commitFor = function commitFor(_ref19) {
|
|
2866
|
+
var anchor = _ref19.anchor,
|
|
2867
|
+
schema = _ref19.schema,
|
|
2868
|
+
rule = _ref19.rule,
|
|
2869
|
+
index = _ref19.index,
|
|
2870
|
+
stepKey = _ref19.stepKey,
|
|
2871
|
+
value = _ref19.value,
|
|
2872
|
+
helpers = _ref19.helpers;
|
|
2805
2873
|
var setTriggers = helpers.setTriggers,
|
|
2806
2874
|
setPerformer = helpers.setPerformer,
|
|
2807
2875
|
setConditionMode = helpers.setConditionMode,
|
|
@@ -2821,7 +2889,7 @@ var commitFor = function commitFor(_ref18) {
|
|
|
2821
2889
|
}]));
|
|
2822
2890
|
return "stay";
|
|
2823
2891
|
}
|
|
2824
|
-
setTriggers([_objectSpread$
|
|
2892
|
+
setTriggers([_objectSpread$6(_objectSpread$6({}, rule.triggers[0]), {}, {
|
|
2825
2893
|
name: value
|
|
2826
2894
|
})]);
|
|
2827
2895
|
var leadTime = (_schema$triggers5 = schema.triggers) === null || _schema$triggers5 === void 0 ? void 0 : _schema$triggers5.leadTime;
|
|
@@ -2906,14 +2974,14 @@ var commitFor = function commitFor(_ref18) {
|
|
|
2906
2974
|
return "close";
|
|
2907
2975
|
}
|
|
2908
2976
|
};
|
|
2909
|
-
var continueTargetFor = function continueTargetFor(
|
|
2977
|
+
var continueTargetFor = function continueTargetFor(_ref20) {
|
|
2910
2978
|
var _schema$actor3;
|
|
2911
|
-
var anchor =
|
|
2912
|
-
schema =
|
|
2913
|
-
rule =
|
|
2914
|
-
index =
|
|
2915
|
-
stepKey =
|
|
2916
|
-
configPending =
|
|
2979
|
+
var anchor = _ref20.anchor,
|
|
2980
|
+
schema = _ref20.schema,
|
|
2981
|
+
rule = _ref20.rule,
|
|
2982
|
+
index = _ref20.index,
|
|
2983
|
+
stepKey = _ref20.stepKey,
|
|
2984
|
+
configPending = _ref20.configPending;
|
|
2917
2985
|
switch (anchor) {
|
|
2918
2986
|
case BUILDER_ANCHORS.TRIGGER_ADD:
|
|
2919
2987
|
case BUILDER_ANCHORS.TRIGGER_REPLACE:
|
|
@@ -3025,25 +3093,25 @@ var continueTargetFor = function continueTargetFor(_ref19) {
|
|
|
3025
3093
|
return null;
|
|
3026
3094
|
}
|
|
3027
3095
|
};
|
|
3028
|
-
var replaceAt = function replaceAt(
|
|
3029
|
-
var list =
|
|
3030
|
-
index =
|
|
3031
|
-
item =
|
|
3096
|
+
var replaceAt = function replaceAt(_ref21) {
|
|
3097
|
+
var list = _ref21.list,
|
|
3098
|
+
index = _ref21.index,
|
|
3099
|
+
item = _ref21.item;
|
|
3032
3100
|
var next = _toConsumableArray(list);
|
|
3033
3101
|
// eslint-disable-next-line security/detect-object-injection
|
|
3034
3102
|
next[index] = item;
|
|
3035
3103
|
return next;
|
|
3036
3104
|
};
|
|
3037
|
-
var applyPreview = function applyPreview(
|
|
3038
|
-
var rule =
|
|
3039
|
-
schema =
|
|
3040
|
-
anchor =
|
|
3041
|
-
index =
|
|
3042
|
-
value =
|
|
3105
|
+
var applyPreview = function applyPreview(_ref22) {
|
|
3106
|
+
var rule = _ref22.rule,
|
|
3107
|
+
schema = _ref22.schema,
|
|
3108
|
+
anchor = _ref22.anchor,
|
|
3109
|
+
index = _ref22.index,
|
|
3110
|
+
value = _ref22.value;
|
|
3043
3111
|
switch (anchor) {
|
|
3044
3112
|
case BUILDER_ANCHORS.TRIGGER_ADD:
|
|
3045
3113
|
case BUILDER_ANCHORS.TRIGGER_REPLACE:
|
|
3046
|
-
return _objectSpread$
|
|
3114
|
+
return _objectSpread$6(_objectSpread$6({}, rule), {}, {
|
|
3047
3115
|
triggers: Array.isArray(value) ? value.map(function (name) {
|
|
3048
3116
|
return {
|
|
3049
3117
|
name: name
|
|
@@ -3055,11 +3123,11 @@ var applyPreview = function applyPreview(_ref21) {
|
|
|
3055
3123
|
})
|
|
3056
3124
|
});
|
|
3057
3125
|
case BUILDER_ANCHORS.TRIGGER_ACTOR:
|
|
3058
|
-
return _objectSpread$
|
|
3126
|
+
return _objectSpread$6(_objectSpread$6({}, rule), {}, {
|
|
3059
3127
|
performer: value
|
|
3060
3128
|
});
|
|
3061
3129
|
case BUILDER_ANCHORS.COND_FIELD:
|
|
3062
|
-
return _objectSpread$
|
|
3130
|
+
return _objectSpread$6(_objectSpread$6({}, rule), {}, {
|
|
3063
3131
|
conditions: replaceAt({
|
|
3064
3132
|
list: rule.conditions,
|
|
3065
3133
|
index: index,
|
|
@@ -3072,11 +3140,11 @@ var applyPreview = function applyPreview(_ref21) {
|
|
|
3072
3140
|
})
|
|
3073
3141
|
});
|
|
3074
3142
|
case BUILDER_ANCHORS.COND_OP_TOGGLE:
|
|
3075
|
-
return _objectSpread$
|
|
3143
|
+
return _objectSpread$6(_objectSpread$6({}, rule), {}, {
|
|
3076
3144
|
conditions: replaceAt({
|
|
3077
3145
|
list: rule.conditions,
|
|
3078
3146
|
index: index,
|
|
3079
|
-
item: _objectSpread$
|
|
3147
|
+
item: _objectSpread$6(_objectSpread$6({}, conditionAt({
|
|
3080
3148
|
rule: rule,
|
|
3081
3149
|
index: index
|
|
3082
3150
|
})), {}, {
|
|
@@ -3085,12 +3153,12 @@ var applyPreview = function applyPreview(_ref21) {
|
|
|
3085
3153
|
})
|
|
3086
3154
|
});
|
|
3087
3155
|
case BUILDER_ANCHORS.COND_CONNECTOR:
|
|
3088
|
-
return _objectSpread$
|
|
3156
|
+
return _objectSpread$6(_objectSpread$6({}, rule), {}, {
|
|
3089
3157
|
conditionMode: value
|
|
3090
3158
|
});
|
|
3091
3159
|
case BUILDER_ANCHORS.ACTION_ADD:
|
|
3092
3160
|
case BUILDER_ANCHORS.ACTION_CHANNEL:
|
|
3093
|
-
return _objectSpread$
|
|
3161
|
+
return _objectSpread$6(_objectSpread$6({}, rule), {}, {
|
|
3094
3162
|
actions: replaceAt({
|
|
3095
3163
|
list: rule.actions,
|
|
3096
3164
|
index: index,
|
|
@@ -3103,7 +3171,7 @@ var applyPreview = function applyPreview(_ref21) {
|
|
|
3103
3171
|
})
|
|
3104
3172
|
});
|
|
3105
3173
|
case BUILDER_ANCHORS.ACTION_RECIPIENT:
|
|
3106
|
-
return _objectSpread$
|
|
3174
|
+
return _objectSpread$6(_objectSpread$6({}, rule), {}, {
|
|
3107
3175
|
actions: replaceAt({
|
|
3108
3176
|
list: rule.actions,
|
|
3109
3177
|
index: index,
|
|
@@ -3116,11 +3184,11 @@ var applyPreview = function applyPreview(_ref21) {
|
|
|
3116
3184
|
})
|
|
3117
3185
|
});
|
|
3118
3186
|
case BUILDER_ANCHORS.SCOPE_PHONE_FIELD:
|
|
3119
|
-
return _objectSpread$
|
|
3187
|
+
return _objectSpread$6(_objectSpread$6({}, rule), {}, {
|
|
3120
3188
|
scope: replaceAt({
|
|
3121
3189
|
list: rule.scope,
|
|
3122
3190
|
index: index,
|
|
3123
|
-
item: _objectSpread$
|
|
3191
|
+
item: _objectSpread$6(_objectSpread$6({}, scopeItemAt({
|
|
3124
3192
|
rule: rule,
|
|
3125
3193
|
index: index
|
|
3126
3194
|
})), {}, {
|
|
@@ -3133,8 +3201,8 @@ var applyPreview = function applyPreview(_ref21) {
|
|
|
3133
3201
|
}
|
|
3134
3202
|
};
|
|
3135
3203
|
|
|
3136
|
-
function ownKeys$
|
|
3137
|
-
function _objectSpread$
|
|
3204
|
+
function ownKeys$5(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3205
|
+
function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$5(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$5(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3138
3206
|
var Canvas = function Canvas(_ref) {
|
|
3139
3207
|
var _schema$actor2, _ref6, _actorOptions$0$value, _schema$scope, _schema$conditions, _schema$triggers, _schema$delay, _schema$meta$showName, _schema$meta;
|
|
3140
3208
|
var schema = _ref.schema;
|
|
@@ -3168,7 +3236,7 @@ var Canvas = function Canvas(_ref) {
|
|
|
3168
3236
|
builderPreview = _useUtilityStore.builderPreview,
|
|
3169
3237
|
panelState = _useUtilityStore.panelState;
|
|
3170
3238
|
var displayRule = useMemo(function () {
|
|
3171
|
-
return builderPreview ? applyPreview(_objectSpread$
|
|
3239
|
+
return builderPreview ? applyPreview(_objectSpread$5({
|
|
3172
3240
|
rule: rule,
|
|
3173
3241
|
schema: schema
|
|
3174
3242
|
}, builderPreview)) : rule;
|
|
@@ -3556,7 +3624,115 @@ var CONDITION_VALUE_TYPES = {
|
|
|
3556
3624
|
multiSelect: "multi-select",
|
|
3557
3625
|
multiSelectCreate: "multi-select-create",
|
|
3558
3626
|
number: "number",
|
|
3559
|
-
email: "email"
|
|
3627
|
+
email: "email",
|
|
3628
|
+
date: "date"
|
|
3629
|
+
};
|
|
3630
|
+
|
|
3631
|
+
function ownKeys$4(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3632
|
+
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$4(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3633
|
+
var EmailChannelFields = function EmailChannelFields(_ref) {
|
|
3634
|
+
var _getIn, _getIn2, _action$metadata;
|
|
3635
|
+
var name = _ref.name,
|
|
3636
|
+
option = _ref.option,
|
|
3637
|
+
action = _ref.action,
|
|
3638
|
+
options = _ref.options,
|
|
3639
|
+
hasRecipientField = _ref.hasRecipientField,
|
|
3640
|
+
hint = _ref.hint;
|
|
3641
|
+
var _useTranslation = useTranslation(),
|
|
3642
|
+
t = _useTranslation.t;
|
|
3643
|
+
var _useFormikContext = useFormikContext(),
|
|
3644
|
+
values = _useFormikContext.values,
|
|
3645
|
+
errors = _useFormikContext.errors,
|
|
3646
|
+
touched = _useFormikContext.touched,
|
|
3647
|
+
setFieldValue = _useFormikContext.setFieldValue,
|
|
3648
|
+
setFieldTouched = _useFormikContext.setFieldTouched;
|
|
3649
|
+
var editorRef = useRef(null);
|
|
3650
|
+
var _useUtilityStore = useUtilityStore(useShallow(function (store) {
|
|
3651
|
+
return {
|
|
3652
|
+
isSaveAsTemplateEnabled: store["isSaveAsTemplateEnabled"]
|
|
3653
|
+
};
|
|
3654
|
+
})),
|
|
3655
|
+
isSaveAsTemplateEnabled = _useUtilityStore.isSaveAsTemplateEnabled;
|
|
3656
|
+
var hasFieldChanged = useHasFieldChanged(name);
|
|
3657
|
+
var valuePath = "".concat(name, ".value");
|
|
3658
|
+
var subjectPath = "".concat(name, ".subject");
|
|
3659
|
+
var bodyPath = "".concat(name, ".body");
|
|
3660
|
+
var templates = option === null || option === void 0 ? void 0 : option.templates;
|
|
3661
|
+
// Hosts whose email action picks its recipient from a list keep that
|
|
3662
|
+
// choice in the same pane as the message.
|
|
3663
|
+
var hasRecipientList = isNotEmpty(options) && !hasRecipientField;
|
|
3664
|
+
var fieldError = function fieldError(path) {
|
|
3665
|
+
return getIn(touched, path) && getIn(errors, path);
|
|
3666
|
+
};
|
|
3667
|
+
var shouldShowSaveAsTemplate = useCallback(function () {
|
|
3668
|
+
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
3669
|
+
templateId = _ref2.templateId,
|
|
3670
|
+
subject = _ref2.subject,
|
|
3671
|
+
body = _ref2.body;
|
|
3672
|
+
var template = findBy({
|
|
3673
|
+
id: templateId
|
|
3674
|
+
}, templates);
|
|
3675
|
+
var hasContent = isPresent(subject) || isPresent(body);
|
|
3676
|
+
var isContentDifferentFromTemplate = !(areValuesEqual(template === null || template === void 0 ? void 0 : template.subject, subject) && (template === null || template === void 0 ? void 0 : template.body) === body);
|
|
3677
|
+
return hasContent && hasFieldChanged && isContentDifferentFromTemplate;
|
|
3678
|
+
}, [templates, hasFieldChanged]);
|
|
3679
|
+
var isSaveAsTemplateVisible = useResetSaveAsTemplateOnHide(name, isSaveAsTemplateEnabled ? shouldShowSaveAsTemplate : F);
|
|
3680
|
+
|
|
3681
|
+
// Formik validates each write on a stale snapshot, so write it all at once.
|
|
3682
|
+
var handleTemplateChange = function handleTemplateChange(template) {
|
|
3683
|
+
setFieldValue(name, _objectSpread$4(_objectSpread$4({}, getIn(values, name)), {}, {
|
|
3684
|
+
templateId: template.id,
|
|
3685
|
+
body: template.body
|
|
3686
|
+
}, option !== null && option !== void 0 && option.hideSubject ? {} : {
|
|
3687
|
+
subject: template.subject
|
|
3688
|
+
}));
|
|
3689
|
+
setEditorContent(editorRef, template.body);
|
|
3690
|
+
};
|
|
3691
|
+
return /*#__PURE__*/jsxs("div", {
|
|
3692
|
+
className: "flex flex-col gap-4",
|
|
3693
|
+
children: [hasRecipientList && /*#__PURE__*/jsx(Select, {
|
|
3694
|
+
options: options,
|
|
3695
|
+
required: true,
|
|
3696
|
+
error: fieldError(valuePath),
|
|
3697
|
+
placeholder: option === null || option === void 0 ? void 0 : option.valuePlaceholder,
|
|
3698
|
+
size: "large",
|
|
3699
|
+
value: (_getIn = getIn(values, valuePath)) !== null && _getIn !== void 0 ? _getIn : undefined,
|
|
3700
|
+
label: (option === null || option === void 0 ? void 0 : option.recipientLabel) || t("neetoRules.builder.config.recipient"),
|
|
3701
|
+
onBlur: function onBlur() {
|
|
3702
|
+
return setFieldTouched(valuePath, true);
|
|
3703
|
+
},
|
|
3704
|
+
onChange: function onChange(value) {
|
|
3705
|
+
return setFieldValue(valuePath, value);
|
|
3706
|
+
}
|
|
3707
|
+
}), isPresent(templates) && /*#__PURE__*/jsx(SelectTemplateField, {
|
|
3708
|
+
templates: templates,
|
|
3709
|
+
selectedField: option,
|
|
3710
|
+
onChange: handleTemplateChange
|
|
3711
|
+
}), !(option !== null && option !== void 0 && option.hideSubject) && /*#__PURE__*/jsx(Input, {
|
|
3712
|
+
required: true,
|
|
3713
|
+
error: fieldError(subjectPath),
|
|
3714
|
+
label: t("neetoRules.builder.config.subject"),
|
|
3715
|
+
placeholder: t("neetoRules.builder.config.subjectPlaceholder"),
|
|
3716
|
+
size: "large",
|
|
3717
|
+
value: (_getIn2 = getIn(values, subjectPath)) !== null && _getIn2 !== void 0 ? _getIn2 : "",
|
|
3718
|
+
onBlur: function onBlur() {
|
|
3719
|
+
return setFieldTouched(subjectPath, true);
|
|
3720
|
+
},
|
|
3721
|
+
onChange: function onChange(event) {
|
|
3722
|
+
return setFieldValue(subjectPath, event.target.value);
|
|
3723
|
+
}
|
|
3724
|
+
}), /*#__PURE__*/jsx(EditorAction, {
|
|
3725
|
+
editorRef: editorRef,
|
|
3726
|
+
required: true,
|
|
3727
|
+
label: t("neetoRules.builder.config.body"),
|
|
3728
|
+
name: bodyPath,
|
|
3729
|
+
placeholder: t("neetoRules.builder.config.bodyPlaceholder"),
|
|
3730
|
+
value: action === null || action === void 0 || (_action$metadata = action.metadata) === null || _action$metadata === void 0 ? void 0 : _action$metadata.body,
|
|
3731
|
+
variables: option === null || option === void 0 ? void 0 : option.variables
|
|
3732
|
+
}), hint, isSaveAsTemplateVisible && /*#__PURE__*/jsx(SaveAsTemplate, {
|
|
3733
|
+
name: name
|
|
3734
|
+
})]
|
|
3735
|
+
});
|
|
3560
3736
|
};
|
|
3561
3737
|
|
|
3562
3738
|
var restoreTokens = function restoreTokens(text) {
|
|
@@ -3618,49 +3794,13 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
|
|
|
3618
3794
|
});
|
|
3619
3795
|
}
|
|
3620
3796
|
if (type === ACTION_CONFIG_TYPES.emailChannel) {
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
className: "flex flex-col gap-4",
|
|
3629
|
-
children: [hasRecipientList && /*#__PURE__*/jsx(Select, {
|
|
3630
|
-
options: options,
|
|
3631
|
-
required: true,
|
|
3632
|
-
error: fieldError(valuePath),
|
|
3633
|
-
placeholder: option === null || option === void 0 ? void 0 : option.valuePlaceholder,
|
|
3634
|
-
size: "large",
|
|
3635
|
-
value: (_getIn = getIn(values, valuePath)) !== null && _getIn !== void 0 ? _getIn : undefined,
|
|
3636
|
-
label: (option === null || option === void 0 ? void 0 : option.recipientLabel) || t("neetoRules.builder.config.recipient"),
|
|
3637
|
-
onBlur: function onBlur() {
|
|
3638
|
-
return setFieldTouched(valuePath, true);
|
|
3639
|
-
},
|
|
3640
|
-
onChange: function onChange(value) {
|
|
3641
|
-
return setFieldValue(valuePath, value);
|
|
3642
|
-
}
|
|
3643
|
-
}), !(option !== null && option !== void 0 && option.hideSubject) && /*#__PURE__*/jsx(Input, {
|
|
3644
|
-
required: true,
|
|
3645
|
-
error: fieldError(subjectPath),
|
|
3646
|
-
label: t("neetoRules.builder.config.subject"),
|
|
3647
|
-
placeholder: t("neetoRules.builder.config.subjectPlaceholder"),
|
|
3648
|
-
size: "large",
|
|
3649
|
-
value: (_getIn2 = getIn(values, subjectPath)) !== null && _getIn2 !== void 0 ? _getIn2 : "",
|
|
3650
|
-
onBlur: function onBlur() {
|
|
3651
|
-
return setFieldTouched(subjectPath, true);
|
|
3652
|
-
},
|
|
3653
|
-
onChange: function onChange(event) {
|
|
3654
|
-
return setFieldValue(subjectPath, event.target.value);
|
|
3655
|
-
}
|
|
3656
|
-
}), /*#__PURE__*/jsx(EditorAction, {
|
|
3657
|
-
required: true,
|
|
3658
|
-
label: t("neetoRules.builder.config.body"),
|
|
3659
|
-
name: bodyPath,
|
|
3660
|
-
placeholder: t("neetoRules.builder.config.bodyPlaceholder"),
|
|
3661
|
-
value: action === null || action === void 0 || (_action$metadata = action.metadata) === null || _action$metadata === void 0 ? void 0 : _action$metadata.body,
|
|
3662
|
-
variables: option === null || option === void 0 ? void 0 : option.variables
|
|
3663
|
-
}), hintBlock]
|
|
3797
|
+
return /*#__PURE__*/jsx(EmailChannelFields, {
|
|
3798
|
+
action: action,
|
|
3799
|
+
hasRecipientField: hasRecipientField,
|
|
3800
|
+
name: name,
|
|
3801
|
+
option: option,
|
|
3802
|
+
options: options,
|
|
3803
|
+
hint: hintBlock
|
|
3664
3804
|
});
|
|
3665
3805
|
}
|
|
3666
3806
|
if (type === ACTION_CONFIG_TYPES.multiSelect) {
|
|
@@ -3721,7 +3861,7 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
|
|
|
3721
3861
|
});
|
|
3722
3862
|
}
|
|
3723
3863
|
if (type === ACTION_CONFIG_TYPES.note) {
|
|
3724
|
-
var _action$
|
|
3864
|
+
var _action$metadata;
|
|
3725
3865
|
return /*#__PURE__*/jsxs("div", {
|
|
3726
3866
|
className: "flex flex-col gap-2",
|
|
3727
3867
|
children: [/*#__PURE__*/jsx(EditorAction, {
|
|
@@ -3729,20 +3869,20 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
|
|
|
3729
3869
|
label: t("neetoRules.builder.config.note"),
|
|
3730
3870
|
name: valuePath,
|
|
3731
3871
|
placeholder: t("neetoRules.builder.config.bodyPlaceholder"),
|
|
3732
|
-
value: action === null || action === void 0 || (_action$
|
|
3872
|
+
value: action === null || action === void 0 || (_action$metadata = action.metadata) === null || _action$metadata === void 0 ? void 0 : _action$metadata.value,
|
|
3733
3873
|
variables: option === null || option === void 0 ? void 0 : option.variables
|
|
3734
3874
|
}), hintBlock]
|
|
3735
3875
|
});
|
|
3736
3876
|
}
|
|
3737
3877
|
if (type === ACTION_CONFIG_TYPES.textarea || type === ACTION_CONFIG_TYPES.number) {
|
|
3738
|
-
var
|
|
3878
|
+
var _getIn, _getIn2;
|
|
3739
3879
|
return type === ACTION_CONFIG_TYPES.number ? /*#__PURE__*/jsx(Input, {
|
|
3740
3880
|
required: true,
|
|
3741
3881
|
error: fieldError(valuePath),
|
|
3742
3882
|
label: t("neetoRules.builder.config.value"),
|
|
3743
3883
|
size: "large",
|
|
3744
3884
|
type: "number",
|
|
3745
|
-
value: (
|
|
3885
|
+
value: (_getIn = getIn(values, valuePath)) !== null && _getIn !== void 0 ? _getIn : "",
|
|
3746
3886
|
onBlur: function onBlur() {
|
|
3747
3887
|
return setFieldTouched(valuePath, true);
|
|
3748
3888
|
},
|
|
@@ -3755,7 +3895,7 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
|
|
|
3755
3895
|
label: t("neetoRules.builder.config.message"),
|
|
3756
3896
|
rows: 5,
|
|
3757
3897
|
size: "large",
|
|
3758
|
-
value: (
|
|
3898
|
+
value: (_getIn2 = getIn(values, valuePath)) !== null && _getIn2 !== void 0 ? _getIn2 : "",
|
|
3759
3899
|
onBlur: function onBlur() {
|
|
3760
3900
|
return setFieldTouched(valuePath, true);
|
|
3761
3901
|
},
|
|
@@ -3765,7 +3905,7 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
|
|
|
3765
3905
|
});
|
|
3766
3906
|
}
|
|
3767
3907
|
if (type === ACTION_CONFIG_TYPES.text || type === ACTION_CONFIG_TYPES.regex || type === ACTION_CONFIG_TYPES.decimal) {
|
|
3768
|
-
var
|
|
3908
|
+
var _getIn3;
|
|
3769
3909
|
return /*#__PURE__*/jsxs("div", {
|
|
3770
3910
|
className: "flex flex-col gap-2",
|
|
3771
3911
|
children: [/*#__PURE__*/jsx(Input, {
|
|
@@ -3774,7 +3914,7 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
|
|
|
3774
3914
|
label: t("neetoRules.builder.config.value"),
|
|
3775
3915
|
placeholder: option === null || option === void 0 ? void 0 : option.valuePlaceholder,
|
|
3776
3916
|
size: "large",
|
|
3777
|
-
value: (
|
|
3917
|
+
value: (_getIn3 = getIn(values, valuePath)) !== null && _getIn3 !== void 0 ? _getIn3 : "",
|
|
3778
3918
|
onBlur: function onBlur() {
|
|
3779
3919
|
return setFieldTouched(valuePath, true);
|
|
3780
3920
|
},
|
|
@@ -3810,8 +3950,8 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
|
|
|
3810
3950
|
});
|
|
3811
3951
|
};
|
|
3812
3952
|
|
|
3813
|
-
function _regenerator$
|
|
3814
|
-
function _regeneratorDefine2$
|
|
3953
|
+
function _regenerator$2() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2$2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = false, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = true, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), true), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2$2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2$2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2$2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2$2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2$2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2$2(u), _regeneratorDefine2$2(u, o, "Generator"), _regeneratorDefine2$2(u, n, function () { return this; }), _regeneratorDefine2$2(u, "toString", function () { return "[object Generator]"; }), (_regenerator$2 = function _regenerator() { return { w: i, m: f }; })(); }
|
|
3954
|
+
function _regeneratorDefine2$2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2$2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2$2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2$2(e, r, n, t); }
|
|
3815
3955
|
var keysUnder = function keysUnder(_ref) {
|
|
3816
3956
|
var obj = _ref.obj,
|
|
3817
3957
|
prefix = _ref.prefix,
|
|
@@ -3848,12 +3988,12 @@ var usePaneValidation = function usePaneValidation(prefix) {
|
|
|
3848
3988
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3849
3989
|
}, [prefix]);
|
|
3850
3990
|
var validate = /*#__PURE__*/function () {
|
|
3851
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator$
|
|
3991
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator$2().m(function _callee() {
|
|
3852
3992
|
var exclude,
|
|
3853
3993
|
nextErrors,
|
|
3854
3994
|
offending,
|
|
3855
3995
|
_args = arguments;
|
|
3856
|
-
return _regenerator$
|
|
3996
|
+
return _regenerator$2().w(function (_context) {
|
|
3857
3997
|
while (1) switch (_context.n) {
|
|
3858
3998
|
case 0:
|
|
3859
3999
|
exclude = _args.length > 0 && _args[0] !== undefined ? _args[0] : [];
|
|
@@ -3882,8 +4022,8 @@ var usePaneValidation = function usePaneValidation(prefix) {
|
|
|
3882
4022
|
};
|
|
3883
4023
|
};
|
|
3884
4024
|
|
|
3885
|
-
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 }; })(); }
|
|
3886
|
-
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
4025
|
+
function _regenerator$1() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2$1(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = false, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = true, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), true), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2$1(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2$1(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2$1(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2$1(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2$1(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2$1(u), _regeneratorDefine2$1(u, o, "Generator"), _regeneratorDefine2$1(u, n, function () { return this; }), _regeneratorDefine2$1(u, "toString", function () { return "[object Generator]"; }), (_regenerator$1 = function _regenerator() { return { w: i, m: f }; })(); }
|
|
4026
|
+
function _regeneratorDefine2$1(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2$1 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2$1(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2$1(e, r, n, t); }
|
|
3887
4027
|
var ConfigPane = function ConfigPane(_ref) {
|
|
3888
4028
|
var _schema$actions, _schema$actions$optio, _schema$actions2, _schema$actions2$opti, _action$recipient, _schema$actions3, _schema$actions3$acti, _concat$find, _schema$actions4, _schema$actions5, _schema$actions6, _schema$actions7, _schema$actions7$opti, _hostRenderConfig;
|
|
3889
4029
|
var schema = _ref.schema,
|
|
@@ -3971,9 +4111,9 @@ var ConfigPane = function ConfigPane(_ref) {
|
|
|
3971
4111
|
mediumLabel: mediumLabel
|
|
3972
4112
|
}) || (option === null || option === void 0 ? void 0 : option.label) || t("neetoRules.builder.setUpAction");
|
|
3973
4113
|
var handleContinue = /*#__PURE__*/function () {
|
|
3974
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
4114
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator$1().m(function _callee() {
|
|
3975
4115
|
var owned, next;
|
|
3976
|
-
return _regenerator().w(function (_context) {
|
|
4116
|
+
return _regenerator$1().w(function (_context) {
|
|
3977
4117
|
while (1) switch (_context.n) {
|
|
3978
4118
|
case 0:
|
|
3979
4119
|
// A pane only answers for what it renders: the recipient pane owns its
|
|
@@ -4152,15 +4292,17 @@ var DelayPane = function DelayPane(_ref) {
|
|
|
4152
4292
|
children: t("neetoRules.builder.waitFor")
|
|
4153
4293
|
}), /*#__PURE__*/jsxs("div", {
|
|
4154
4294
|
className: "flex items-start gap-x-2",
|
|
4155
|
-
children: [/*#__PURE__*/jsx(
|
|
4295
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
4156
4296
|
className: "w-44",
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4297
|
+
children: /*#__PURE__*/jsx(Input$1, {
|
|
4298
|
+
dataTestid: "delay-value",
|
|
4299
|
+
max: MAX_DELAY_VALUE,
|
|
4300
|
+
min: MIN_DELAY_VALUE,
|
|
4301
|
+
name: "".concat(name, ".value.value"),
|
|
4302
|
+
placeholder: t("neetoRules.placeholders.enterDelay"),
|
|
4303
|
+
size: "large",
|
|
4304
|
+
type: "number"
|
|
4305
|
+
})
|
|
4164
4306
|
}), /*#__PURE__*/jsx(Select$1, {
|
|
4165
4307
|
dataTestid: "delay-unit",
|
|
4166
4308
|
defaultValue: value === null || value === void 0 ? void 0 : value.unit,
|
|
@@ -4400,8 +4542,10 @@ var NamePane = function NamePane(_ref) {
|
|
|
4400
4542
|
});
|
|
4401
4543
|
};
|
|
4402
4544
|
|
|
4403
|
-
function ownKeys$
|
|
4404
|
-
function _objectSpread$
|
|
4545
|
+
function ownKeys$3(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4546
|
+
function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4547
|
+
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = false, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = true, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), true), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
4548
|
+
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
4405
4549
|
var OptionsPane = function OptionsPane(_ref) {
|
|
4406
4550
|
var schema = _ref.schema,
|
|
4407
4551
|
anchor = _ref.anchor,
|
|
@@ -4410,7 +4554,9 @@ var OptionsPane = function OptionsPane(_ref) {
|
|
|
4410
4554
|
_ref$belowContent = _ref.belowContent,
|
|
4411
4555
|
belowContent = _ref$belowContent === void 0 ? null : _ref$belowContent,
|
|
4412
4556
|
_ref$configPending = _ref.configPending,
|
|
4413
|
-
configPending = _ref$configPending === void 0 ? false : _ref$configPending
|
|
4557
|
+
configPending = _ref$configPending === void 0 ? false : _ref$configPending,
|
|
4558
|
+
_ref$validate = _ref.validate,
|
|
4559
|
+
validate = _ref$validate === void 0 ? null : _ref$validate;
|
|
4414
4560
|
var _useTranslation = useTranslation(),
|
|
4415
4561
|
t = _useTranslation.t;
|
|
4416
4562
|
var _useFormikContext = useFormikContext(),
|
|
@@ -4513,20 +4659,49 @@ var OptionsPane = function OptionsPane(_ref) {
|
|
|
4513
4659
|
}
|
|
4514
4660
|
};
|
|
4515
4661
|
};
|
|
4516
|
-
var handleContinue = function
|
|
4517
|
-
var
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
|
|
4662
|
+
var handleContinue = /*#__PURE__*/function () {
|
|
4663
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
4664
|
+
var target, _t;
|
|
4665
|
+
return _regenerator().w(function (_context) {
|
|
4666
|
+
while (1) switch (_context.n) {
|
|
4667
|
+
case 0:
|
|
4668
|
+
_t = validate;
|
|
4669
|
+
if (!_t) {
|
|
4670
|
+
_context.n = 2;
|
|
4671
|
+
break;
|
|
4672
|
+
}
|
|
4673
|
+
_context.n = 1;
|
|
4674
|
+
return validate();
|
|
4675
|
+
case 1:
|
|
4676
|
+
_t = !_context.v;
|
|
4677
|
+
case 2:
|
|
4678
|
+
if (!_t) {
|
|
4679
|
+
_context.n = 3;
|
|
4680
|
+
break;
|
|
4681
|
+
}
|
|
4682
|
+
return _context.a(2);
|
|
4683
|
+
case 3:
|
|
4684
|
+
target = continueTargetFor({
|
|
4685
|
+
anchor: anchor,
|
|
4686
|
+
schema: schema,
|
|
4687
|
+
rule: rule,
|
|
4688
|
+
index: index,
|
|
4689
|
+
stepKey: stepKey,
|
|
4690
|
+
configPending: configPending
|
|
4691
|
+
});
|
|
4692
|
+
if (target) openType({
|
|
4693
|
+
type: target.type,
|
|
4694
|
+
data: target.data
|
|
4695
|
+
});else closePane();
|
|
4696
|
+
case 4:
|
|
4697
|
+
return _context.a(2);
|
|
4698
|
+
}
|
|
4699
|
+
}, _callee);
|
|
4700
|
+
}));
|
|
4701
|
+
return function handleContinue() {
|
|
4702
|
+
return _ref2.apply(this, arguments);
|
|
4703
|
+
};
|
|
4704
|
+
}();
|
|
4530
4705
|
var canContinue = cascade && selectedValues.some(Boolean);
|
|
4531
4706
|
useHotkeys(SHORTCUTS["continue"].sequence, handleContinue, {
|
|
4532
4707
|
enabled: canContinue,
|
|
@@ -4566,7 +4741,7 @@ var OptionsPane = function OptionsPane(_ref) {
|
|
|
4566
4741
|
color: "muted",
|
|
4567
4742
|
variant: "body2",
|
|
4568
4743
|
children: popover.description
|
|
4569
|
-
}), popover.helpLinkProps && /*#__PURE__*/jsx(Button, _objectSpread$
|
|
4744
|
+
}), popover.helpLinkProps && /*#__PURE__*/jsx(Button, _objectSpread$3(_objectSpread$3({}, popover.helpLinkProps), {}, {
|
|
4570
4745
|
className: "h-auto self-start p-0",
|
|
4571
4746
|
size: "sm",
|
|
4572
4747
|
variant: "link"
|
|
@@ -4602,13 +4777,13 @@ var OptionsPane = function OptionsPane(_ref) {
|
|
|
4602
4777
|
if (multi) {
|
|
4603
4778
|
return /*#__PURE__*/jsx("div", {
|
|
4604
4779
|
className: "mb-pane-list flex flex-col",
|
|
4605
|
-
children: groups.map(function (
|
|
4606
|
-
var
|
|
4607
|
-
category =
|
|
4608
|
-
items =
|
|
4780
|
+
children: groups.map(function (_ref3) {
|
|
4781
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
4782
|
+
category = _ref4[0],
|
|
4783
|
+
items = _ref4[1];
|
|
4609
4784
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
4610
4785
|
children: [renderGroupHeader(category), items.map(function (option) {
|
|
4611
|
-
return /*#__PURE__*/jsx(Checkbox, _objectSpread$
|
|
4786
|
+
return /*#__PURE__*/jsx(Checkbox, _objectSpread$3(_objectSpread$3({
|
|
4612
4787
|
checked: isSelected(option.value),
|
|
4613
4788
|
disabled: option.disabled,
|
|
4614
4789
|
label: optionLabel(option),
|
|
@@ -4628,15 +4803,15 @@ var OptionsPane = function OptionsPane(_ref) {
|
|
|
4628
4803
|
orientation: "vertical",
|
|
4629
4804
|
value: (_selectedValues$ = selectedValues === null || selectedValues === void 0 ? void 0 : selectedValues[0]) !== null && _selectedValues$ !== void 0 ? _selectedValues$ : "",
|
|
4630
4805
|
onValueChange: handleSelect,
|
|
4631
|
-
children: groups.flatMap(function (
|
|
4632
|
-
var
|
|
4633
|
-
category =
|
|
4634
|
-
items =
|
|
4806
|
+
children: groups.flatMap(function (_ref5) {
|
|
4807
|
+
var _ref6 = _slicedToArray(_ref5, 2),
|
|
4808
|
+
category = _ref6[0],
|
|
4809
|
+
items = _ref6[1];
|
|
4635
4810
|
return [category ? /*#__PURE__*/jsx("div", {
|
|
4636
4811
|
className: "mb-pane-group",
|
|
4637
4812
|
children: category
|
|
4638
4813
|
}, "group-".concat(category)) : null].concat(_toConsumableArray(items.map(function (option) {
|
|
4639
|
-
return /*#__PURE__*/jsx(RadioGroup.Item, _objectSpread$
|
|
4814
|
+
return /*#__PURE__*/jsx(RadioGroup.Item, _objectSpread$3(_objectSpread$3({
|
|
4640
4815
|
disabled: option.disabled,
|
|
4641
4816
|
label: optionLabel(option),
|
|
4642
4817
|
labelProps: previewHandlers(option.value),
|
|
@@ -4774,8 +4949,16 @@ var RecipientPane = function RecipientPane(_ref) {
|
|
|
4774
4949
|
});
|
|
4775
4950
|
var flatOption = ((_schema$actions4 = schema.actions) === null || _schema$actions4 === void 0 || (_schema$actions4$opti = _schema$actions4.optionForName) === null || _schema$actions4$opti === void 0 ? void 0 : _schema$actions4$opti.call(_schema$actions4, action.name)) || ((_schema$actions5 = schema.actions) === null || _schema$actions5 === void 0 || (_schema$actions5$opti = _schema$actions5.optionForChannel) === null || _schema$actions5$opti === void 0 ? void 0 : _schema$actions5$opti.call(_schema$actions5, channel));
|
|
4776
4951
|
var isSmsToNumbers = (flatOption === null || flatOption === void 0 ? void 0 : flatOption.type) === SMS_TO_NUMBERS;
|
|
4777
|
-
var
|
|
4778
|
-
|
|
4952
|
+
var recipientConfig = (((_schema$actions6 = schema.actions) === null || _schema$actions6 === void 0 ? void 0 : _schema$actions6.options) || []).flatMap(function (option) {
|
|
4953
|
+
return option.recipients || [];
|
|
4954
|
+
}).concat(((_schema$actions7 = schema.actions) === null || _schema$actions7 === void 0 ? void 0 : _schema$actions7.recipients) || []).find(function (item) {
|
|
4955
|
+
var _item$value;
|
|
4956
|
+
return ((_item$value = item.value) !== null && _item$value !== void 0 ? _item$value : item.id) === recipient;
|
|
4957
|
+
});
|
|
4958
|
+
var recipientStorageField = recipientConfig !== null && recipientConfig !== void 0 && recipientConfig.field && recipientConfig.field !== RECIPIENT_STORAGE_FIELDS.emails ? RECIPIENT_STORAGE_FIELDS.value : RECIPIENT_STORAGE_FIELDS.emails;
|
|
4959
|
+
var recipientFieldPath = isSmsToNumbers ? "".concat(name, ".").concat(RECIPIENT_STORAGE_FIELDS.phoneNumbers) : "".concat(name, ".").concat(recipientStorageField);
|
|
4960
|
+
var _usePaneValidation = usePaneValidation(recipientFieldPath),
|
|
4961
|
+
validate = _usePaneValidation.validate;
|
|
4779
4962
|
useEffect(function () {
|
|
4780
4963
|
var _bodyRef$current;
|
|
4781
4964
|
if (!editor) return;
|
|
@@ -4786,12 +4969,6 @@ var RecipientPane = function RecipientPane(_ref) {
|
|
|
4786
4969
|
}, 0);
|
|
4787
4970
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4788
4971
|
}, [!editor]);
|
|
4789
|
-
var recipientConfig = (((_schema$actions6 = schema.actions) === null || _schema$actions6 === void 0 ? void 0 : _schema$actions6.options) || []).flatMap(function (option) {
|
|
4790
|
-
return option.recipients || [];
|
|
4791
|
-
}).concat(((_schema$actions7 = schema.actions) === null || _schema$actions7 === void 0 ? void 0 : _schema$actions7.recipients) || []).find(function (item) {
|
|
4792
|
-
var _item$value;
|
|
4793
|
-
return ((_item$value = item.value) !== null && _item$value !== void 0 ? _item$value : item.id) === recipient;
|
|
4794
|
-
});
|
|
4795
4972
|
var builtInRecipientField = recipientConfig !== null && recipientConfig !== void 0 && recipientConfig.field ? /*#__PURE__*/jsx(RecipientField, {
|
|
4796
4973
|
name: name,
|
|
4797
4974
|
dropdownOptions: recipientConfig.dropdownOptions,
|
|
@@ -4831,6 +5008,7 @@ var RecipientPane = function RecipientPane(_ref) {
|
|
|
4831
5008
|
configPending: configPending,
|
|
4832
5009
|
index: index,
|
|
4833
5010
|
schema: schema,
|
|
5011
|
+
validate: validate,
|
|
4834
5012
|
anchor: BUILDER_ANCHORS.ACTION_RECIPIENT
|
|
4835
5013
|
});
|
|
4836
5014
|
}
|
|
@@ -4860,6 +5038,8 @@ var RecipientPane = function RecipientPane(_ref) {
|
|
|
4860
5038
|
});
|
|
4861
5039
|
};
|
|
4862
5040
|
|
|
5041
|
+
function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5042
|
+
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4863
5043
|
var ConditionValueFields = function ConditionValueFields(_ref) {
|
|
4864
5044
|
var name = _ref.name,
|
|
4865
5045
|
field = _ref.field,
|
|
@@ -4965,6 +5145,42 @@ var ConditionValueFields = function ConditionValueFields(_ref) {
|
|
|
4965
5145
|
})
|
|
4966
5146
|
});
|
|
4967
5147
|
}
|
|
5148
|
+
if (type === CONDITION_VALUE_TYPES.date) {
|
|
5149
|
+
var metadataPath = "".concat(name, ".metadata");
|
|
5150
|
+
var metadata = getIn(values, metadataPath) || {};
|
|
5151
|
+
|
|
5152
|
+
// Formik validates each write on a stale snapshot, so write it all at once.
|
|
5153
|
+
var handleDateChange = function handleDateChange(date) {
|
|
5154
|
+
var _globalProps$user;
|
|
5155
|
+
var format = field !== null && field !== void 0 && field.showTime ? DATE_TIME_FORMAT : DATE_FORMAT;
|
|
5156
|
+
setFieldTouched(valuePath, true, false);
|
|
5157
|
+
setFieldValue(metadataPath, _objectSpread$2(_objectSpread$2({}, metadata), {}, {
|
|
5158
|
+
// eslint-disable-next-line @bigbinary/neeto/use-standard-date-time-formats
|
|
5159
|
+
value: date ? dayjs(date).format(format) : "",
|
|
5160
|
+
type: field !== null && field !== void 0 && field.showTime ? DATE_TIME_TYPES.datetime : DATE_TIME_TYPES.date,
|
|
5161
|
+
format: format,
|
|
5162
|
+
timezone: globalProps === null || globalProps === void 0 || (_globalProps$user = globalProps.user) === null || _globalProps$user === void 0 ? void 0 : _globalProps$user.timeZone
|
|
5163
|
+
}));
|
|
5164
|
+
};
|
|
5165
|
+
return /*#__PURE__*/jsx(DatePicker, {
|
|
5166
|
+
required: true,
|
|
5167
|
+
error: fieldError(valuePath),
|
|
5168
|
+
label: t("neetoRules.form.selectDate"),
|
|
5169
|
+
showTime: field === null || field === void 0 ? void 0 : field.showTime,
|
|
5170
|
+
timeFormat: "HH:mm",
|
|
5171
|
+
type: "date",
|
|
5172
|
+
value: getDateTimeValue({
|
|
5173
|
+
date: metadata.value,
|
|
5174
|
+
format: metadata.format,
|
|
5175
|
+
type: metadata.type,
|
|
5176
|
+
timezone: metadata.timezone
|
|
5177
|
+
}) || undefined,
|
|
5178
|
+
onBlur: function onBlur() {
|
|
5179
|
+
return setFieldTouched(valuePath, true);
|
|
5180
|
+
},
|
|
5181
|
+
onChange: handleDateChange
|
|
5182
|
+
});
|
|
5183
|
+
}
|
|
4968
5184
|
if (valueType === CONDITION_VALUE_TYPES.number) {
|
|
4969
5185
|
var _getIn;
|
|
4970
5186
|
return /*#__PURE__*/jsx(Input, {
|
|
@@ -5110,7 +5326,7 @@ var BUILDER_PANEL_TYPE_CONFIG_MAP = (_BUILDER_PANEL_TYPE_C = {}, _defineProperty
|
|
|
5110
5326
|
function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5111
5327
|
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5112
5328
|
var Form = function Form(_ref) {
|
|
5113
|
-
var _schema$meta$showName, _schema$meta;
|
|
5329
|
+
var _rawSchema$actions, _schema$meta$showName, _schema$meta;
|
|
5114
5330
|
var _ref$data = _ref.data,
|
|
5115
5331
|
data = _ref$data === void 0 ? {} : _ref$data,
|
|
5116
5332
|
_ref$schema = _ref.schema,
|
|
@@ -5143,17 +5359,24 @@ var Form = function Form(_ref) {
|
|
|
5143
5359
|
var _useUtilityStore = useUtilityStore(useShallow(function (store) {
|
|
5144
5360
|
return {
|
|
5145
5361
|
resetPanelState: store["resetPanelState"],
|
|
5146
|
-
errorFields: store["errorFields"]
|
|
5362
|
+
errorFields: store["errorFields"],
|
|
5363
|
+
setIsSaveAsTemplateEnabled: store["setIsSaveAsTemplateEnabled"]
|
|
5147
5364
|
};
|
|
5148
5365
|
})),
|
|
5149
5366
|
resetPanelState = _useUtilityStore.resetPanelState,
|
|
5150
|
-
errorFields = _useUtilityStore.errorFields
|
|
5367
|
+
errorFields = _useUtilityStore.errorFields,
|
|
5368
|
+
setIsSaveAsTemplateEnabled = _useUtilityStore.setIsSaveAsTemplateEnabled;
|
|
5151
5369
|
var initialValues = useMemo(function () {
|
|
5152
5370
|
return formatData(data);
|
|
5153
5371
|
}, [data]);
|
|
5154
5372
|
var schema = useMemo(function () {
|
|
5155
5373
|
return normalizeSchema(rawSchema);
|
|
5156
5374
|
}, [rawSchema]);
|
|
5375
|
+
var isSaveAsTemplateEnabled = !!((_rawSchema$actions = rawSchema.actions) !== null && _rawSchema$actions !== void 0 && _rawSchema$actions.isSaveAsTemplateEnabled);
|
|
5376
|
+
useEffect(function () {
|
|
5377
|
+
setIsSaveAsTemplateEnabled(isSaveAsTemplateEnabled);
|
|
5378
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5379
|
+
}, [isSaveAsTemplateEnabled]);
|
|
5157
5380
|
var isNameRequired = isNameGenerationDisabled || ((_schema$meta$showName = (_schema$meta = schema.meta) === null || _schema$meta === void 0 ? void 0 : _schema$meta.showName) !== null && _schema$meta$showName !== void 0 ? _schema$meta$showName : true);
|
|
5158
5381
|
var _usePollRuleName = usePollRuleName({
|
|
5159
5382
|
url: url,
|