@bigbinary/neeto-rules-frontend 2.7.19 → 2.7.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/javascript/src/translations/en.json +2 -1
- package/dist/.ready +1 -1
- package/dist/NeetoRulesBuilder.js +51 -17
- package/dist/NeetoRulesBuilder.js.map +1 -1
- package/dist/NeetoRulesForm.js +2 -2
- package/dist/cjs/NeetoRulesBuilder.js +50 -16
- package/dist/cjs/NeetoRulesBuilder.js.map +1 -1
- package/dist/cjs/NeetoRulesForm.js +2 -2
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/v2/NeetoRulesBuilder.js +50 -16
- package/dist/cjs/v2/NeetoRulesBuilder.js.map +1 -1
- package/dist/cjs/v2/NeetoRulesForm.js +2 -2
- package/dist/cjs/v2/index.js +2 -2
- package/dist/{index-k-eGkX-R.js → index-BXLCiV70.js} +2 -2
- package/dist/{index-k-eGkX-R.js.map → index-BXLCiV70.js.map} +1 -1
- package/dist/{index-DwGEK-_1.js → index-DMCgC01M.js} +2 -2
- package/dist/{index-DwGEK-_1.js.map → index-DMCgC01M.js.map} +1 -1
- package/dist/{index-ogJeZ752.js → index-D_dEe2Gg.js} +2 -2
- package/dist/{index-ogJeZ752.js.map → index-D_dEe2Gg.js.map} +1 -1
- package/dist/{index-Vt6GY_o0.js → index-hvuc6OIP.js} +2 -2
- package/dist/{index-Vt6GY_o0.js.map → index-hvuc6OIP.js.map} +1 -1
- package/dist/index.js +2 -2
- package/dist/keyboardShortcuts-DXP5YgeG.js +92 -0
- package/dist/{keyboardShortcuts-SAk712q8.js.map → keyboardShortcuts-DXP5YgeG.js.map} +1 -1
- package/dist/keyboardShortcuts-lX0oq49M.js +96 -0
- package/dist/{keyboardShortcuts-DNOhEY8h.js.map → keyboardShortcuts-lX0oq49M.js.map} +1 -1
- package/dist/v2/NeetoRulesBuilder.js +51 -17
- package/dist/v2/NeetoRulesBuilder.js.map +1 -1
- package/dist/v2/NeetoRulesForm.js +2 -2
- package/dist/v2/index.js +2 -2
- package/package.json +1 -1
- package/dist/keyboardShortcuts-DNOhEY8h.js +0 -88
- package/dist/keyboardShortcuts-SAk712q8.js +0 -92
package/dist/NeetoRulesForm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
2
|
import _objectDestructuringEmpty from '@babel/runtime/helpers/objectDestructuringEmpty';
|
|
3
|
-
import './keyboardShortcuts-
|
|
3
|
+
import './keyboardShortcuts-DXP5YgeG.js';
|
|
4
4
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
5
5
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
6
6
|
import { useShallow } from 'zustand/shallow';
|
|
@@ -15,7 +15,7 @@ import { u as useUtilityStore } from './useUtilityStore-CCUYS1mS.js';
|
|
|
15
15
|
import classNames from 'classnames';
|
|
16
16
|
import Typography from '@bigbinary/neetoui/Typography';
|
|
17
17
|
import { isNotNil, isEmpty, pluck } from 'ramda';
|
|
18
|
-
import { g as getActionOptions, a as getFieldDetails, b as getSlackChannelErrors, c as getOptionsKey, d as getActionLabel, A as ActionSubItem, F as FIELDS_WITH_OPTIONS, P as PANEL_TYPES, D as DEFAULT_RULE_ACTION, e as getLogicalOperatorOptions, f as getFieldDetails$1, h as getVerbOptions, R as RadioField$1, S as SelectField$1, V as ValueField, i as DEFAULT_DELAY, j as getAllEvents, O as OPERATORS$1, k as STATUS_KEYS, l as formatData, u as usePollRuleName, T as TouchErrors, m as buildPayload, n as ScrollToErrorField, o as Panel, p as getValidationSchema, q as DEFAULT_INITIAL_VALUE } from './index-
|
|
18
|
+
import { g as getActionOptions, a as getFieldDetails, b as getSlackChannelErrors, c as getOptionsKey, d as getActionLabel, A as ActionSubItem, F as FIELDS_WITH_OPTIONS, P as PANEL_TYPES, D as DEFAULT_RULE_ACTION, e as getLogicalOperatorOptions, f as getFieldDetails$1, h as getVerbOptions, R as RadioField$1, S as SelectField$1, V as ValueField, i as DEFAULT_DELAY, j as getAllEvents, O as OPERATORS$1, k as STATUS_KEYS, l as formatData, u as usePollRuleName, T as TouchErrors, m as buildPayload, n as ScrollToErrorField, o as Panel, p as getValidationSchema, q as DEFAULT_INITIAL_VALUE } from './index-D_dEe2Gg.js';
|
|
19
19
|
import { a as useActiveField, u as useCustomDataStore } from './useCustomDataStore-BtKYtLVc.js';
|
|
20
20
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
21
21
|
import { joinHyphenCase } from '@bigbinary/neeto-commons-frontend/utils';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
4
4
|
var _objectDestructuringEmpty = require('@babel/runtime/helpers/objectDestructuringEmpty');
|
|
5
|
-
var keyboardShortcuts = require('../keyboardShortcuts-
|
|
5
|
+
var keyboardShortcuts = require('../keyboardShortcuts-lX0oq49M.js');
|
|
6
6
|
var shallow = require('zustand/shallow');
|
|
7
7
|
var react = require('react');
|
|
8
8
|
var classNames = require('classnames');
|
|
@@ -13,7 +13,7 @@ var Header = require('@bigbinary/neeto-molecules/Header');
|
|
|
13
13
|
var Spinner = require('@bigbinary/neetoui/Spinner');
|
|
14
14
|
var ActionBlock = require('@bigbinary/neetoui/formik/ActionBlock');
|
|
15
15
|
var reactI18next = require('react-i18next');
|
|
16
|
-
var index = require('../index-
|
|
16
|
+
var index = require('../index-DMCgC01M.js');
|
|
17
17
|
var useCustomDataStore = require('../useCustomDataStore-DxFx8aCf.js');
|
|
18
18
|
var useUtilityStore = require('../useUtilityStore-C_U20IMX.js');
|
|
19
19
|
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
|
|
@@ -26,8 +26,8 @@ var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProp
|
|
|
26
26
|
var jsxRuntime = require('react/jsx-runtime');
|
|
27
27
|
var i18next = require('i18next');
|
|
28
28
|
var yup = require('yup');
|
|
29
|
-
var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
|
|
30
29
|
var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
|
|
30
|
+
var useHotkeys = require('@bigbinary/neeto-hotkeys');
|
|
31
31
|
var Search = require('@bigbinary/neeto-icons/Search');
|
|
32
32
|
var Input = require('@bigbinary/neetoui/Input');
|
|
33
33
|
var Typography = require('@bigbinary/neetoui/Typography');
|
|
@@ -47,6 +47,7 @@ var MultiEmailInput = require('@bigbinary/neetoui/MultiEmailInput');
|
|
|
47
47
|
require('@babel/runtime/helpers/typeof');
|
|
48
48
|
require('../useAutomationRulesApi-C1T2E1AN.js');
|
|
49
49
|
require('@tanstack/react-query');
|
|
50
|
+
require('@bigbinary/neeto-commons-frontend/react-utils');
|
|
50
51
|
require('axios');
|
|
51
52
|
require('../index-DFwPrb81.js');
|
|
52
53
|
require('@bigbinary/neetoui/formik/Radio');
|
|
@@ -64,7 +65,6 @@ require('@bigbinary/neetoui/Label');
|
|
|
64
65
|
require('@bigbinary/neetoui/formik/MultiEmailInput');
|
|
65
66
|
require('@bigbinary/neeto-editor/FormikEditor');
|
|
66
67
|
require('@bigbinary/neeto-icons/Refresh');
|
|
67
|
-
require('@bigbinary/neeto-hotkeys');
|
|
68
68
|
require('@bigbinary/neeto-icons/Check');
|
|
69
69
|
require('react-select/creatable');
|
|
70
70
|
require('@babel/runtime/helpers/toArray');
|
|
@@ -277,6 +277,21 @@ var TOKEN_STATE = {
|
|
|
277
277
|
};
|
|
278
278
|
var STATE_CLASS = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, TOKEN_STATE.PLACEHOLDER, "mb-placeholder"), TOKEN_STATE.PLACEHOLDER_NEXT, "mb-placeholder mb-placeholder-next"), TOKEN_STATE.DISABLED, "mb-placeholder mb-placeholder-disabled"), TOKEN_STATE.FILLED, "mb-tok"), TOKEN_STATE.MUTED, "mb-tok mb-tok-muted");
|
|
279
279
|
|
|
280
|
+
// The flash is a run-once CSS animation, so a repeat submit while it is still
|
|
281
|
+
// applied would not replay it on its own.
|
|
282
|
+
var useReplayFlash = function useReplayFlash(flashSeq) {
|
|
283
|
+
var ref = react.useRef(null);
|
|
284
|
+
react.useEffect(function () {
|
|
285
|
+
var _ref$current, _ref$current$getAnima;
|
|
286
|
+
if (!flashSeq) return;
|
|
287
|
+
(_ref$current = ref.current) === null || _ref$current === void 0 || (_ref$current$getAnima = _ref$current.getAnimations) === null || _ref$current$getAnima === void 0 || _ref$current$getAnima.call(_ref$current).forEach(function (animation) {
|
|
288
|
+
animation.cancel();
|
|
289
|
+
animation.play();
|
|
290
|
+
});
|
|
291
|
+
}, [flashSeq]);
|
|
292
|
+
return ref;
|
|
293
|
+
};
|
|
294
|
+
|
|
280
295
|
var _excluded = ["children", "state", "active", "invalid", "onClick", "className", "dataTestid"];
|
|
281
296
|
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; }
|
|
282
297
|
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; }
|
|
@@ -293,8 +308,10 @@ var Token = function Token(_ref) {
|
|
|
293
308
|
dataTestid = _ref.dataTestid,
|
|
294
309
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
295
310
|
var isInteractive = typeof onClick === "function" && state !== TOKEN_STATE.DISABLED;
|
|
311
|
+
var tokenRef = useReplayFlash(invalid);
|
|
296
312
|
return /*#__PURE__*/jsxRuntime.jsx("span", _objectSpread$c(_objectSpread$c({
|
|
297
313
|
"data-testid": dataTestid,
|
|
314
|
+
ref: tokenRef,
|
|
298
315
|
role: isInteractive ? "button" : undefined,
|
|
299
316
|
tabIndex: isInteractive ? 0 : undefined,
|
|
300
317
|
className: classNames(
|
|
@@ -1108,15 +1125,17 @@ var DelayRow = function DelayRow(_ref) {
|
|
|
1108
1125
|
});
|
|
1109
1126
|
};
|
|
1110
1127
|
|
|
1111
|
-
var MetaBlock =
|
|
1112
|
-
var
|
|
1113
|
-
rule = _ref.rule,
|
|
1128
|
+
var MetaBlock = function MetaBlock(_ref) {
|
|
1129
|
+
var rule = _ref.rule,
|
|
1114
1130
|
_ref$showName = _ref.showName,
|
|
1115
1131
|
showName = _ref$showName === void 0 ? true : _ref$showName,
|
|
1116
1132
|
_ref$isInvalid = _ref.isInvalid,
|
|
1117
1133
|
isInvalid = _ref$isInvalid === void 0 ? false : _ref$isInvalid,
|
|
1118
1134
|
handleEditName = _ref.onEditName,
|
|
1119
1135
|
handleToggleActive = _ref.onToggleActive;
|
|
1136
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
1137
|
+
t = _useTranslation.t;
|
|
1138
|
+
var nameRef = useReplayFlash(isInvalid);
|
|
1120
1139
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1121
1140
|
className: "mb-meta",
|
|
1122
1141
|
children: [showName && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
@@ -1125,6 +1144,7 @@ var MetaBlock = reactUtils.withT(function (_ref) {
|
|
|
1125
1144
|
className: "mb-meta-label",
|
|
1126
1145
|
children: t("neetoRules.builder.automationName")
|
|
1127
1146
|
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1147
|
+
ref: nameRef,
|
|
1128
1148
|
role: handleEditName ? "button" : undefined,
|
|
1129
1149
|
tabIndex: handleEditName ? 0 : undefined,
|
|
1130
1150
|
className: classNames("mb-meta-input-wrap", {
|
|
@@ -1174,7 +1194,7 @@ var MetaBlock = reactUtils.withT(function (_ref) {
|
|
|
1174
1194
|
}), t("neetoRules.builder.activateThisAutomation")]
|
|
1175
1195
|
})]
|
|
1176
1196
|
});
|
|
1177
|
-
}
|
|
1197
|
+
};
|
|
1178
1198
|
|
|
1179
1199
|
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; }
|
|
1180
1200
|
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; }
|
|
@@ -2836,10 +2856,10 @@ var Canvas = function Canvas(_ref) {
|
|
|
2836
2856
|
var flatErrors = react.useMemo(function () {
|
|
2837
2857
|
return keyboardShortcuts.flatten(errors || {});
|
|
2838
2858
|
}, [errors]);
|
|
2839
|
-
var _useState = react.useState(
|
|
2859
|
+
var _useState = react.useState(0),
|
|
2840
2860
|
_useState2 = _slicedToArray(_useState, 2),
|
|
2841
|
-
|
|
2842
|
-
|
|
2861
|
+
flashSeq = _useState2[0],
|
|
2862
|
+
setFlashSeq = _useState2[1];
|
|
2843
2863
|
var lastSubmitCount = react.useRef(submitCount);
|
|
2844
2864
|
react.useEffect(function () {
|
|
2845
2865
|
if (submitCount <= lastSubmitCount.current) return undefined;
|
|
@@ -2853,9 +2873,9 @@ var Canvas = function Canvas(_ref) {
|
|
|
2853
2873
|
}))) {
|
|
2854
2874
|
return undefined;
|
|
2855
2875
|
}
|
|
2856
|
-
|
|
2876
|
+
setFlashSeq(submitCount);
|
|
2857
2877
|
var timer = setTimeout(function () {
|
|
2858
|
-
return
|
|
2878
|
+
return setFlashSeq(0);
|
|
2859
2879
|
}, FLASH_DURATION_MS);
|
|
2860
2880
|
return function () {
|
|
2861
2881
|
return clearTimeout(timer);
|
|
@@ -2872,11 +2892,10 @@ var Canvas = function Canvas(_ref) {
|
|
|
2872
2892
|
});
|
|
2873
2893
|
});
|
|
2874
2894
|
};
|
|
2875
|
-
var
|
|
2895
|
+
var matchesInvalid = function matchesInvalid(_ref4) {
|
|
2876
2896
|
var _schema$actions, _schema$actions$actio, _schema$actions2, _schema$actions2$rend, _schema$actions3, _schema$actions3$rend, _schema$actions4, _schema$actions4$opti, _schema$actions5, _schema$actions5$opti, _schema$actions6, _schema$actions7;
|
|
2877
2897
|
var type = _ref4.type,
|
|
2878
2898
|
index = _ref4.index;
|
|
2879
|
-
if (!flashing) return false;
|
|
2880
2899
|
var conditionMeta = "".concat(fieldKeys.conditions, ".value.").concat(index, ".metadata");
|
|
2881
2900
|
var actionMeta = "".concat(fieldKeys.actions, ".value.").concat(index, ".metadata");
|
|
2882
2901
|
// eslint-disable-next-line security/detect-object-injection
|
|
@@ -2967,6 +2986,12 @@ var Canvas = function Canvas(_ref) {
|
|
|
2967
2986
|
return false;
|
|
2968
2987
|
}
|
|
2969
2988
|
};
|
|
2989
|
+
|
|
2990
|
+
// Returns the submit generation, not a boolean, so consumers can replay the
|
|
2991
|
+
// flash animation when the same token is still invalid on a repeat submit.
|
|
2992
|
+
var isInvalid = function isInvalid(args) {
|
|
2993
|
+
return flashSeq && matchesInvalid(args) ? flashSeq : 0;
|
|
2994
|
+
};
|
|
2970
2995
|
var closePaneIfTargeting = function closePaneIfTargeting(_ref5) {
|
|
2971
2996
|
var anchors = _ref5.anchors,
|
|
2972
2997
|
index = _ref5.index;
|
|
@@ -3583,6 +3608,10 @@ var ConfigPane = function ConfigPane(_ref) {
|
|
|
3583
3608
|
return _ref2.apply(this, arguments);
|
|
3584
3609
|
};
|
|
3585
3610
|
}();
|
|
3611
|
+
useHotkeys(keyboardShortcuts.SHORTCUTS["continue"].sequence, handleContinue, {
|
|
3612
|
+
enabled: shouldAdvanceToRecipient,
|
|
3613
|
+
mode: "global"
|
|
3614
|
+
});
|
|
3586
3615
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
3587
3616
|
children: [/*#__PURE__*/jsxRuntime.jsx(index.Panel.Header, {
|
|
3588
3617
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
@@ -4080,6 +4109,11 @@ var OptionsPane = function OptionsPane(_ref) {
|
|
|
4080
4109
|
data: target.data
|
|
4081
4110
|
});else closePane();
|
|
4082
4111
|
};
|
|
4112
|
+
var canContinue = cascade && selectedValues.some(Boolean);
|
|
4113
|
+
useHotkeys(keyboardShortcuts.SHORTCUTS["continue"].sequence, handleContinue, {
|
|
4114
|
+
enabled: canContinue,
|
|
4115
|
+
mode: "global"
|
|
4116
|
+
});
|
|
4083
4117
|
var optionLabel = function optionLabel(option) {
|
|
4084
4118
|
var Icon = option.icon;
|
|
4085
4119
|
if (!Icon && !option.disabledReason) return option.label;
|
|
@@ -4194,7 +4228,7 @@ var OptionsPane = function OptionsPane(_ref) {
|
|
|
4194
4228
|
children: [renderBody(), belowContent]
|
|
4195
4229
|
}), cascade && /*#__PURE__*/jsxRuntime.jsx(index.Panel.Footer, {
|
|
4196
4230
|
children: /*#__PURE__*/jsxRuntime.jsx(Button, {
|
|
4197
|
-
disabled: !
|
|
4231
|
+
disabled: !canContinue,
|
|
4198
4232
|
label: t("neetoRules.buttons.continue"),
|
|
4199
4233
|
size: "large",
|
|
4200
4234
|
onClick: handleContinue
|