@bigbinary/neeto-rules-frontend 2.7.18 → 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.
Files changed (64) hide show
  1. package/app/javascript/src/translations/ar.json +1 -1
  2. package/app/javascript/src/translations/bg.json +1 -1
  3. package/app/javascript/src/translations/ca.json +1 -1
  4. package/app/javascript/src/translations/cs.json +1 -1
  5. package/app/javascript/src/translations/da.json +1 -1
  6. package/app/javascript/src/translations/en.json +2 -1
  7. package/app/javascript/src/translations/es-MX.json +1 -1
  8. package/app/javascript/src/translations/et.json +1 -1
  9. package/app/javascript/src/translations/fi.json +1 -1
  10. package/app/javascript/src/translations/fil.json +1 -1
  11. package/app/javascript/src/translations/fr.json +1 -1
  12. package/app/javascript/src/translations/he.json +1 -1
  13. package/app/javascript/src/translations/hi.json +1 -1
  14. package/app/javascript/src/translations/hr.json +1 -1
  15. package/app/javascript/src/translations/hu.json +1 -1
  16. package/app/javascript/src/translations/id.json +1 -1
  17. package/app/javascript/src/translations/it.json +1 -1
  18. package/app/javascript/src/translations/ja.json +1 -1
  19. package/app/javascript/src/translations/ko.json +1 -1
  20. package/app/javascript/src/translations/nl.json +1 -1
  21. package/app/javascript/src/translations/pl.json +1 -1
  22. package/app/javascript/src/translations/pt.json +1 -1
  23. package/app/javascript/src/translations/ro.json +1 -1
  24. package/app/javascript/src/translations/ru.json +1 -1
  25. package/app/javascript/src/translations/sk.json +1 -1
  26. package/app/javascript/src/translations/sl.json +1 -1
  27. package/app/javascript/src/translations/sv.json +1 -1
  28. package/app/javascript/src/translations/tr.json +1 -1
  29. package/app/javascript/src/translations/uk.json +1 -1
  30. package/app/javascript/src/translations/vi.json +1 -1
  31. package/app/javascript/src/translations/zh-CN.json +1 -1
  32. package/app/javascript/src/translations/zh-TW.json +1 -1
  33. package/dist/.ready +1 -1
  34. package/dist/NeetoRulesBuilder.js +51 -17
  35. package/dist/NeetoRulesBuilder.js.map +1 -1
  36. package/dist/NeetoRulesForm.js +2 -2
  37. package/dist/cjs/NeetoRulesBuilder.js +50 -16
  38. package/dist/cjs/NeetoRulesBuilder.js.map +1 -1
  39. package/dist/cjs/NeetoRulesForm.js +2 -2
  40. package/dist/cjs/index.js +2 -2
  41. package/dist/cjs/v2/NeetoRulesBuilder.js +50 -16
  42. package/dist/cjs/v2/NeetoRulesBuilder.js.map +1 -1
  43. package/dist/cjs/v2/NeetoRulesForm.js +2 -2
  44. package/dist/cjs/v2/index.js +2 -2
  45. package/dist/{index-k-eGkX-R.js → index-BXLCiV70.js} +2 -2
  46. package/dist/{index-k-eGkX-R.js.map → index-BXLCiV70.js.map} +1 -1
  47. package/dist/{index-DwGEK-_1.js → index-DMCgC01M.js} +2 -2
  48. package/dist/{index-DwGEK-_1.js.map → index-DMCgC01M.js.map} +1 -1
  49. package/dist/{index-ogJeZ752.js → index-D_dEe2Gg.js} +2 -2
  50. package/dist/{index-ogJeZ752.js.map → index-D_dEe2Gg.js.map} +1 -1
  51. package/dist/{index-Vt6GY_o0.js → index-hvuc6OIP.js} +2 -2
  52. package/dist/{index-Vt6GY_o0.js.map → index-hvuc6OIP.js.map} +1 -1
  53. package/dist/index.js +2 -2
  54. package/dist/keyboardShortcuts-DXP5YgeG.js +92 -0
  55. package/dist/{keyboardShortcuts-SAk712q8.js.map → keyboardShortcuts-DXP5YgeG.js.map} +1 -1
  56. package/dist/keyboardShortcuts-lX0oq49M.js +96 -0
  57. package/dist/{keyboardShortcuts-DNOhEY8h.js.map → keyboardShortcuts-lX0oq49M.js.map} +1 -1
  58. package/dist/v2/NeetoRulesBuilder.js +51 -17
  59. package/dist/v2/NeetoRulesBuilder.js.map +1 -1
  60. package/dist/v2/NeetoRulesForm.js +2 -2
  61. package/dist/v2/index.js +2 -2
  62. package/package.json +1 -1
  63. package/dist/keyboardShortcuts-DNOhEY8h.js +0 -88
  64. package/dist/keyboardShortcuts-SAk712q8.js +0 -92
@@ -1,8 +1,8 @@
1
1
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
2
  import _objectDestructuringEmpty from '@babel/runtime/helpers/objectDestructuringEmpty';
3
- import { f as flatten } from '../keyboardShortcuts-DNOhEY8h.js';
3
+ import { f as flatten, S as SHORTCUTS } from '../keyboardShortcuts-DXP5YgeG.js';
4
4
  import { useShallow } from 'zustand/shallow';
5
- import { useState, createElement, Fragment as Fragment$1, useCallback, useMemo, useRef, useEffect } from 'react';
5
+ import { useState, useRef, useEffect, createElement, Fragment as Fragment$1, useCallback, useMemo } from 'react';
6
6
  import { Button, Input, Checkbox, Typography, RadioGroup, Textarea, DatePicker, Select as Select$1, Tooltip, MultiEmailInput, Spinner } from '@bigbinary/neeto-atoms';
7
7
  import { Input as Input$1, Select, ActionBlock } from '@bigbinary/neeto-atoms/formik';
8
8
  import classNames from 'classnames';
@@ -11,7 +11,7 @@ import { isNotEmpty, toLabelAndValue, removeBy, isNot, noop } from '@bigbinary/n
11
11
  import Container from '@bigbinary/neeto-molecules/v2/Container';
12
12
  import Header from '@bigbinary/neeto-molecules/v2/Header';
13
13
  import { useTranslation } from 'react-i18next';
14
- import { E as EditorAction, m as Panel, p as ErrorCallout, q as SmsFields, r as PhoneNumberField, j as formatData, u as usePollRuleName, T as TouchErrors, l as ScrollToErrorField, n as getValidationSchema, o as DEFAULT_INITIAL_VALUE, k as buildPayload } from '../index-k-eGkX-R.js';
14
+ import { E as EditorAction, m as Panel, p as ErrorCallout, q as SmsFields, r as PhoneNumberField, j as formatData, u as usePollRuleName, T as TouchErrors, l as ScrollToErrorField, n as getValidationSchema, o as DEFAULT_INITIAL_VALUE, k as buildPayload } from '../index-BXLCiV70.js';
15
15
  import { u as useCustomDataStore } from '../useCustomDataStore-CU3KpyD4.js';
16
16
  import { u as useUtilityStore } from '../useUtilityStore-BBb39TOj.js';
17
17
  import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
@@ -22,8 +22,8 @@ import Delete from '@bigbinary/neeto-icons/Delete';
22
22
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
23
23
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
24
24
  import { t } from 'i18next';
25
- import { withT } from '@bigbinary/neeto-commons-frontend/v2/react-utils';
26
25
  import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
26
+ import useHotkeys from '@bigbinary/neeto-hotkeys';
27
27
  import Search from '@bigbinary/neeto-icons/Search';
28
28
  import { dayjs } from '@bigbinary/neeto-commons-frontend/v2/utils';
29
29
  import { D as DATE_FORMAT } from '../utils-DeqHhpwQ.js';
@@ -37,10 +37,10 @@ import 'axios';
37
37
  import '../index-9h4B7JZZ.js';
38
38
  import 'yup';
39
39
  import 'lucide-react';
40
+ import '@bigbinary/neeto-commons-frontend/v2/react-utils';
40
41
  import '@monaco-editor/react';
41
42
  import '@bigbinary/neeto-molecules/v2/DynamicVariables';
42
43
  import '@bigbinary/neeto-editor/v2/FormikEditor';
43
- import '@bigbinary/neeto-hotkeys';
44
44
  import 'react-select/creatable';
45
45
  import '@babel/runtime/helpers/toArray';
46
46
  import '@bigbinary/neeto-molecules/v2/PhoneNumber';
@@ -212,6 +212,21 @@ var TOKEN_STATE = {
212
212
  };
213
213
  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");
214
214
 
215
+ // The flash is a run-once CSS animation, so a repeat submit while it is still
216
+ // applied would not replay it on its own.
217
+ var useReplayFlash = function useReplayFlash(flashSeq) {
218
+ var ref = useRef(null);
219
+ useEffect(function () {
220
+ var _ref$current, _ref$current$getAnima;
221
+ if (!flashSeq) return;
222
+ (_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) {
223
+ animation.cancel();
224
+ animation.play();
225
+ });
226
+ }, [flashSeq]);
227
+ return ref;
228
+ };
229
+
215
230
  var _excluded = ["children", "state", "active", "invalid", "onClick", "className", "dataTestid"];
216
231
  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; }
217
232
  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; }
@@ -228,8 +243,10 @@ var Token = function Token(_ref) {
228
243
  dataTestid = _ref.dataTestid,
229
244
  rest = _objectWithoutProperties(_ref, _excluded);
230
245
  var isInteractive = typeof onClick === "function" && state !== TOKEN_STATE.DISABLED;
246
+ var tokenRef = useReplayFlash(invalid);
231
247
  return /*#__PURE__*/jsx("span", _objectSpread$c(_objectSpread$c({
232
248
  "data-testid": dataTestid,
249
+ ref: tokenRef,
233
250
  role: isInteractive ? "button" : undefined,
234
251
  tabIndex: isInteractive ? 0 : undefined,
235
252
  className: classNames(
@@ -992,15 +1009,17 @@ var DelayRow = function DelayRow(_ref) {
992
1009
  });
993
1010
  };
994
1011
 
995
- var MetaBlock = withT(function (_ref) {
996
- var t = _ref.t,
997
- rule = _ref.rule,
1012
+ var MetaBlock = function MetaBlock(_ref) {
1013
+ var rule = _ref.rule,
998
1014
  _ref$showName = _ref.showName,
999
1015
  showName = _ref$showName === void 0 ? true : _ref$showName,
1000
1016
  _ref$isInvalid = _ref.isInvalid,
1001
1017
  isInvalid = _ref$isInvalid === void 0 ? false : _ref$isInvalid,
1002
1018
  handleEditName = _ref.onEditName,
1003
1019
  handleToggleActive = _ref.onToggleActive;
1020
+ var _useTranslation = useTranslation(),
1021
+ t = _useTranslation.t;
1022
+ var nameRef = useReplayFlash(isInvalid);
1004
1023
  return /*#__PURE__*/jsxs("div", {
1005
1024
  className: "mb-meta",
1006
1025
  children: [showName && /*#__PURE__*/jsxs("div", {
@@ -1009,6 +1028,7 @@ var MetaBlock = withT(function (_ref) {
1009
1028
  className: "mb-meta-label",
1010
1029
  children: t("neetoRules.builder.automationName")
1011
1030
  }), /*#__PURE__*/jsxs("div", {
1031
+ ref: nameRef,
1012
1032
  role: handleEditName ? "button" : undefined,
1013
1033
  tabIndex: handleEditName ? 0 : undefined,
1014
1034
  className: classNames("mb-meta-input-wrap", {
@@ -1058,7 +1078,7 @@ var MetaBlock = withT(function (_ref) {
1058
1078
  }), t("neetoRules.builder.activateThisAutomation")]
1059
1079
  })]
1060
1080
  });
1061
- });
1081
+ };
1062
1082
 
1063
1083
  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; }
1064
1084
  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; }
@@ -2697,10 +2717,10 @@ var Canvas = function Canvas(_ref) {
2697
2717
  var flatErrors = useMemo(function () {
2698
2718
  return flatten(errors || {});
2699
2719
  }, [errors]);
2700
- var _useState = useState(false),
2720
+ var _useState = useState(0),
2701
2721
  _useState2 = _slicedToArray(_useState, 2),
2702
- flashing = _useState2[0],
2703
- setFlashing = _useState2[1];
2722
+ flashSeq = _useState2[0],
2723
+ setFlashSeq = _useState2[1];
2704
2724
  var lastSubmitCount = useRef(submitCount);
2705
2725
  useEffect(function () {
2706
2726
  if (submitCount <= lastSubmitCount.current) return undefined;
@@ -2714,9 +2734,9 @@ var Canvas = function Canvas(_ref) {
2714
2734
  }))) {
2715
2735
  return undefined;
2716
2736
  }
2717
- setFlashing(true);
2737
+ setFlashSeq(submitCount);
2718
2738
  var timer = setTimeout(function () {
2719
- return setFlashing(false);
2739
+ return setFlashSeq(0);
2720
2740
  }, 2200);
2721
2741
  return function () {
2722
2742
  return clearTimeout(timer);
@@ -2733,11 +2753,10 @@ var Canvas = function Canvas(_ref) {
2733
2753
  });
2734
2754
  });
2735
2755
  };
2736
- var isInvalid = function isInvalid(_ref4) {
2756
+ var matchesInvalid = function matchesInvalid(_ref4) {
2737
2757
  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;
2738
2758
  var type = _ref4.type,
2739
2759
  index = _ref4.index;
2740
- if (!flashing) return false;
2741
2760
  var conditionMeta = "".concat(fieldKeys.conditions, ".value.").concat(index, ".metadata");
2742
2761
  var actionMeta = "".concat(fieldKeys.actions, ".value.").concat(index, ".metadata");
2743
2762
  // eslint-disable-next-line security/detect-object-injection
@@ -2816,6 +2835,12 @@ var Canvas = function Canvas(_ref) {
2816
2835
  return false;
2817
2836
  }
2818
2837
  };
2838
+
2839
+ // Returns the submit generation, not a boolean, so consumers can replay the
2840
+ // flash animation when the same token is still invalid on a repeat submit.
2841
+ var isInvalid = function isInvalid(args) {
2842
+ return flashSeq && matchesInvalid(args) ? flashSeq : 0;
2843
+ };
2819
2844
  var closePaneIfTargeting = function closePaneIfTargeting(_ref5) {
2820
2845
  var anchors = _ref5.anchors,
2821
2846
  index = _ref5.index;
@@ -3437,6 +3462,10 @@ var ConfigPane = function ConfigPane(_ref) {
3437
3462
  return _ref2.apply(this, arguments);
3438
3463
  };
3439
3464
  }();
3465
+ useHotkeys(SHORTCUTS["continue"].sequence, handleContinue, {
3466
+ enabled: shouldAdvanceToRecipient,
3467
+ mode: "global"
3468
+ });
3440
3469
  return /*#__PURE__*/jsxs(Fragment, {
3441
3470
  children: [/*#__PURE__*/jsx(Panel.Header, {
3442
3471
  children: /*#__PURE__*/jsxs("div", {
@@ -3898,6 +3927,11 @@ var OptionsPane = function OptionsPane(_ref) {
3898
3927
  data: target.data
3899
3928
  });else closePane();
3900
3929
  };
3930
+ var canContinue = cascade && selectedValues.some(Boolean);
3931
+ useHotkeys(SHORTCUTS["continue"].sequence, handleContinue, {
3932
+ enabled: canContinue,
3933
+ mode: "global"
3934
+ });
3901
3935
  var optionLabel = function optionLabel(option) {
3902
3936
  var Icon = option.icon;
3903
3937
  if (!Icon && !option.disabledReason) return option.label;
@@ -4010,7 +4044,7 @@ var OptionsPane = function OptionsPane(_ref) {
4010
4044
  children: [renderBody(), belowContent]
4011
4045
  }), cascade && /*#__PURE__*/jsx(Panel.Footer, {
4012
4046
  children: /*#__PURE__*/jsx(Button, {
4013
- disabled: !selectedValues.some(Boolean),
4047
+ disabled: !canContinue,
4014
4048
  label: t("neetoRules.buttons.continue"),
4015
4049
  size: "lg",
4016
4050
  onClick: handleContinue