@bigbinary/neeto-rules-frontend 0.4.4 → 0.4.5

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/index.cjs.js CHANGED
@@ -1524,7 +1524,8 @@ var DropdownField$1 = function DropdownField(_ref) {
1524
1524
  };
1525
1525
 
1526
1526
  var EditorAction = function EditorAction(_ref) {
1527
- var name = _ref.name,
1527
+ var autoFocus = _ref.autoFocus,
1528
+ name = _ref.name,
1528
1529
  _ref$value = _ref.value,
1529
1530
  value = _ref$value === void 0 ? "" : _ref$value,
1530
1531
  label = _ref.label,
@@ -1541,10 +1542,10 @@ var EditorAction = function EditorAction(_ref) {
1541
1542
  setFieldValue(name, editorData);
1542
1543
  }, [debouncedValue]);
1543
1544
  return /*#__PURE__*/React__default["default"].createElement(neetoEditor.FormikEditor, {
1545
+ autoFocus: autoFocus,
1544
1546
  label: label,
1545
1547
  name: name,
1546
1548
  variables: variables,
1547
- autoFocus: true,
1548
1549
  hideSlashCommands: true,
1549
1550
  addons: EDITOR_ADDONS,
1550
1551
  className: "w-full",
@@ -1627,7 +1628,7 @@ var InputField$2 = function InputField(_ref) {
1627
1628
  label: label,
1628
1629
  type: "text"
1629
1630
  }, field, {
1630
- error: meta.error,
1631
+ error: meta.touched ? meta.error : "",
1631
1632
  ref: initialFocusRef,
1632
1633
  value: text,
1633
1634
  onChange: function onChange(e) {
@@ -1654,12 +1655,14 @@ var EmailFields = function EmailFields(_ref) {
1654
1655
  showPane = _useState2[0],
1655
1656
  setShowPane = _useState2[1];
1656
1657
  var initialFocusRef = React.useRef(null);
1658
+ var _useTranslation = reactI18next.useTranslation(),
1659
+ t = _useTranslation.t;
1657
1660
  useOnButtonPressed(initialFocusRef, function () {
1658
1661
  return setShowPane(false);
1659
1662
  });
1660
1663
  var isValid = errors.actions && ramda.isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0 || (_errors$actions = _errors$actions.value) === null || _errors$actions === void 0 ? void 0 : _errors$actions[index]) && ramda.isNotNil((_touched$actions = touched.actions) === null || _touched$actions === void 0 || (_touched$actions = _touched$actions.value) === null || _touched$actions === void 0 ? void 0 : _touched$actions[index]);
1661
- var separator = (selectedField === null || selectedField === void 0 || (_selectedField$separa = selectedField.separator) === null || _selectedField$separa === void 0 ? void 0 : _selectedField$separa.toLowerCase()) || i18next.t("neetoRules.common.as");
1662
- var defaultLabel = (selectedField === null || selectedField === void 0 ? void 0 : selectedField.emailPlaceholder) || i18next.t("neetoRules.common.email");
1664
+ var separator = (selectedField === null || selectedField === void 0 || (_selectedField$separa = selectedField.separator) === null || _selectedField$separa === void 0 ? void 0 : _selectedField$separa.toLowerCase()) || t("neetoRules.common.as");
1665
+ var defaultLabel = (selectedField === null || selectedField === void 0 ? void 0 : selectedField.emailPlaceholder) || t("neetoRules.common.email");
1663
1666
  return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
1664
1667
  className: "neeto-ui-text-gray-700 mt-1",
1665
1668
  "data-cy": "action-email-seperator-text",
@@ -1700,10 +1703,11 @@ var EmailFields = function EmailFields(_ref) {
1700
1703
  className: "mb-4",
1701
1704
  "data-cy": "email-action-subject-text-field",
1702
1705
  initialFocusRef: isEmailIdField ? null : initialFocusRef,
1703
- label: i18next.t("neetoRules.labels.subject"),
1706
+ label: t("neetoRules.labels.subject"),
1704
1707
  name: "".concat(name, ".subject")
1705
1708
  }), /*#__PURE__*/React__default["default"].createElement(EditorAction, {
1706
- label: i18next.t("neetoRules.labels.body"),
1709
+ autoFocus: !isEmailIdField && selectedField.hideSubject,
1710
+ label: t("neetoRules.labels.body"),
1707
1711
  name: "".concat(name, ".body"),
1708
1712
  value: (_action$metadata = action.metadata) === null || _action$metadata === void 0 ? void 0 : _action$metadata.body,
1709
1713
  variables: selectedField === null || selectedField === void 0 ? void 0 : selectedField.variables
@@ -1711,12 +1715,12 @@ var EmailFields = function EmailFields(_ref) {
1711
1715
  className: "flex items-center space-x-2"
1712
1716
  }, /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
1713
1717
  "data-cy": "save-changes-button",
1714
- label: i18next.t("neetoRules.common.saveChange"),
1718
+ label: t("neetoRules.common.saveChange"),
1715
1719
  onClick: function onClick() {
1716
1720
  return setShowPane(false);
1717
1721
  }
1718
1722
  }), /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
1719
- label: i18next.t("neetoRules.buttons.cancel"),
1723
+ label: t("neetoRules.buttons.cancel"),
1720
1724
  style: "text",
1721
1725
  onClick: function onClick() {
1722
1726
  return setShowPane(false);