@bigbinary/neeto-rules-frontend 2.5.27 → 2.5.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,7 +9,7 @@ import { b as useUpdateAutomationRule, c as useCloneAutomationRule, d as useDele
9
9
  import { R as RulesReorder, I as INITIAL_RULES_DATA } from './index-C0i4jsZ5.js';
10
10
  import NeetoHeader from '@bigbinary/neeto-molecules/Header';
11
11
  import Button from '@bigbinary/neetoui/Button';
12
- import { c as createRoutes, u as useUtilityStore } from './useUtilityStore-C0O0N3Aq.js';
12
+ import { c as createRoutes, u as useUtilityStore } from './useUtilityStore-6TPs8A8Q.js';
13
13
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
14
14
  import { shallow } from 'zustand/shallow';
15
15
  import SubHeader from '@bigbinary/neeto-molecules/SubHeader';
@@ -5,13 +5,13 @@ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
5
5
  import { shallow } from 'zustand/shallow';
6
6
  import { useRef, useEffect, createElement, useCallback, forwardRef, useState, useMemo, memo, Fragment as Fragment$1 } from 'react';
7
7
  import { useFormikContext, useField, FieldArray, ErrorMessage, Formik, Form as Form$1 } from 'formik';
8
- import { findBy, noop, isNotEmpty, isPresent, hyphenate, renameKeys, notEqualsDeep, nullSafe, toLabelAndValue, removeBy, isNotPresent } from '@bigbinary/neeto-cist';
8
+ import { findBy, noop, isNotEmpty, isPresent, hyphenate, renameKeys, notEqualsDeep, nullSafe, toLabelAndValue, removeBy, isNotPresent, isNot } from '@bigbinary/neeto-cist';
9
9
  import Plus from '@bigbinary/neeto-icons/Plus';
10
10
  import Delete from '@bigbinary/neeto-icons/Delete';
11
11
  import Refresh from '@bigbinary/neeto-icons/Refresh';
12
12
  import Button from '@bigbinary/neetoui/Button';
13
13
  import { useTranslation, Trans } from 'react-i18next';
14
- import { u as useUtilityStore, g as getSeparator, d as dotPath$1, b as getDateTimeValue, a as getDateTimeFormattedValue, D as DATE_TIME_TYPES, e as DATE_TIME_FORMAT, f as DATE_FORMAT, T as TIME_FORMAT } from './useUtilityStore-C0O0N3Aq.js';
14
+ import { u as useUtilityStore, g as getSeparator, d as dotPath$1, b as getDateTimeValue, a as getDateTimeFormattedValue, D as DATE_TIME_TYPES, e as DATE_TIME_FORMAT, f as DATE_FORMAT, T as TIME_FORMAT } from './useUtilityStore-6TPs8A8Q.js';
15
15
  import classNames from 'classnames';
16
16
  import Typography from '@bigbinary/neetoui/Typography';
17
17
  import { assocPath, pluck, identity, isEmpty, mergeDeepLeft, isNotNil, whereAny, reject, equals, unless, path, omit, useWith, split, when, is, trim, eqBy, F, values, isNil, without, append, pipe, filter, uniq, join, map, assoc, mergeLeft, includes, test } from 'ramda';
@@ -2866,6 +2866,7 @@ var ActionSubItem = function ActionSubItem(_ref) {
2866
2866
  }
2867
2867
  }), /*#__PURE__*/jsx(EmailFields.Target, {
2868
2868
  action: action,
2869
+ hasError: hasError,
2869
2870
  index: index,
2870
2871
  name: name,
2871
2872
  selectedField: selectedField,
@@ -5219,10 +5220,12 @@ var ActionItem = function ActionItem(_ref) {
5219
5220
  setFieldActive = _useActiveField.setFieldActive;
5220
5221
  var _useUtilityStore = useUtilityStore(function (store) {
5221
5222
  return {
5222
- setPanelState: store["setPanelState"]
5223
+ setPanelState: store["setPanelState"],
5224
+ setErrorFields: store["setErrorFields"]
5223
5225
  };
5224
5226
  }, shallow),
5225
- setPanelState = _useUtilityStore.setPanelState;
5227
+ setPanelState = _useUtilityStore.setPanelState,
5228
+ setErrorFields = _useUtilityStore.setErrorFields;
5226
5229
  var _useUtilityStore2 = useUtilityStore(function (store) {
5227
5230
  var _store$panelState;
5228
5231
  return {
@@ -5309,6 +5312,22 @@ var ActionItem = function ActionItem(_ref) {
5309
5312
  });
5310
5313
  });
5311
5314
  }, [selectedField]);
5315
+ useEffect(function () {
5316
+ if (errorMessage) {
5317
+ setErrorFields(function (prev) {
5318
+ return prev.includes(name) ? prev : [].concat(_toConsumableArray(prev), [name]);
5319
+ });
5320
+ } else {
5321
+ setErrorFields(function (prev) {
5322
+ return prev.filter(isNot(name));
5323
+ });
5324
+ }
5325
+ return function () {
5326
+ setErrorFields(function (prev) {
5327
+ return prev.filter(isNot(name));
5328
+ });
5329
+ };
5330
+ }, [errorMessage, name, setErrorFields]);
5312
5331
  return /*#__PURE__*/jsx("div", {
5313
5332
  className: "flex flex-grow min-w-0 flex-wrap gap-x-1 gap-y-3",
5314
5333
  children: /*#__PURE__*/jsxs("div", {
@@ -5324,7 +5343,7 @@ var ActionItem = function ActionItem(_ref) {
5324
5343
  style: "link",
5325
5344
  className: classNames("neeto-ui-text-gray-800 neeto-ui-font-semibold underline", {
5326
5345
  "neeto-ui-text-accent-800": isFieldActive,
5327
- "neeto-ui-text-error-500": isActionSelected
5346
+ "neeto-ui-text-error-500": isActionSelected || !!errorMessage
5328
5347
  }),
5329
5348
  onClick: handleOnClick
5330
5349
  }), /*#__PURE__*/jsx(ActionSubItem$1, _objectSpread$d(_objectSpread$d({}, _objectSpread$d(_objectSpread$d({}, panelData), {}, {
@@ -6610,10 +6629,12 @@ var Form = function Form(_ref) {
6610
6629
  customData = _useCustomDataStore.customData;
6611
6630
  var _useUtilityStore = useUtilityStore(function (store) {
6612
6631
  return {
6613
- resetPanelState: store["resetPanelState"]
6632
+ resetPanelState: store["resetPanelState"],
6633
+ errorFields: store["errorFields"]
6614
6634
  };
6615
6635
  }, shallow),
6616
- resetPanelState = _useUtilityStore.resetPanelState;
6636
+ resetPanelState = _useUtilityStore.resetPanelState,
6637
+ errorFields = _useUtilityStore.errorFields;
6617
6638
  var initialValues = useMemo(function () {
6618
6639
  return formatData(data);
6619
6640
  }, [data]);
@@ -6633,6 +6654,10 @@ var Form = function Form(_ref) {
6633
6654
  };
6634
6655
  }, []);
6635
6656
  var submitForm = function submitForm(values, formikBag) {
6657
+ if (isNotEmpty(errorFields)) {
6658
+ formikBag.setSubmitting(false);
6659
+ return;
6660
+ }
6636
6661
  if (isCancelledNameGeneration) {
6637
6662
  saveRuleName(values);
6638
6663
  return;