@bigbinary/neeto-slack-frontend 2.0.1 → 2.1.0

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.js CHANGED
@@ -2,11 +2,10 @@ import * as React from 'react';
2
2
  import React__default, { useContext, useState, useRef, useEffect } from 'react';
3
3
  import classNames from 'classnames';
4
4
  import { noop as noop$1, isNotEmpty } from '@bigbinary/neeto-commons-frontend/pure';
5
- import { Typography, Button, Pane, Label } from '@bigbinary/neetoui';
5
+ import { Typography, Toastr, Button, Pane, Label } from '@bigbinary/neetoui';
6
6
  import * as yup from 'yup';
7
7
  import { Form, Select } from '@bigbinary/neetoui/formik';
8
8
  import { isEmpty, is } from 'ramda';
9
- import { Refresh } from '@bigbinary/neeto-icons';
10
9
  import { Slack } from '@bigbinary/neeto-icons/misc';
11
10
 
12
11
  function _typeof$2(obj) {
@@ -3605,21 +3604,19 @@ function useTranslation(ns) {
3605
3604
  }
3606
3605
 
3607
3606
  var common = {
3608
- saveChanges: "Save changes",
3609
- cancel: "Cancel",
3610
3607
  "continue": "Continue",
3611
3608
  save: "Save",
3612
3609
  edit: "Edit",
3613
- "delete": "Delete",
3610
+ done: "Done",
3614
3611
  required: "{{entity}} is required"
3615
3612
  };
3616
3613
  var slack = {
3617
3614
  placeholder: "Notification Channel",
3618
3615
  channelName: "Channel Name",
3619
3616
  editPane: "Edit slack integration",
3617
+ channelListRefreshToastr: "Slack channels list is updated",
3618
+ channelListRefreshButton: "Refresh channels list",
3620
3619
  steps: {
3621
- connect: "Connect",
3622
- configure: "Configure",
3623
3620
  finish: "Finish"
3624
3621
  },
3625
3622
  connect: {
@@ -3631,13 +3628,10 @@ var slack = {
3631
3628
  title: "You are connecting to <br/><strong>{{teamName}}</strong> workspace <br/>({{slackUrl}}).",
3632
3629
  sendTo: "Send to",
3633
3630
  sendToDescription: "Choose a Slack channel to send the notifications",
3634
- updateType: "Update type",
3635
3631
  refreshSlackChannelList: "Refresh Slack channel list"
3636
3632
  },
3637
3633
  finish: {
3638
- title: "Slack successfully connected to <br/><strong>{{teamName}}</strong> workspace.",
3639
- account: "Account",
3640
- channel: "Channel"
3634
+ title: "You are successfully connected to the <strong>{{teamName}}</strong> workspace."
3641
3635
  },
3642
3636
  settings: {
3643
3637
  title: "You are connected to <br/><strong>{{teamName}}</strong> workspace <br/>({{slackUrl}})."
@@ -3738,6 +3732,10 @@ var buildValidationSchema = function buildValidationSchema(customValidationSchem
3738
3732
  var toSlackUrl = function toSlackUrl(teamName) {
3739
3733
  return "".concat(teamName === null || teamName === void 0 ? void 0 : teamName.replace(/\s/g, "").toLowerCase(), ".slack.com");
3740
3734
  };
3735
+ var slackChannelRefresh = function slackChannelRefresh(channelRefreshHandler) {
3736
+ channelRefreshHandler();
3737
+ Toastr.success(t$2("slack.channelListRefreshToastr"));
3738
+ };
3741
3739
 
3742
3740
  function _extends$1() {
3743
3741
  _extends$1 = Object.assign ? Object.assign.bind() : function (target) {
@@ -3757,20 +3755,18 @@ function _extends$1() {
3757
3755
  var SlackRefreshChannelListButton = function SlackRefreshChannelListButton(_ref) {
3758
3756
  var channelRefreshHandler = _ref.channelRefreshHandler,
3759
3757
  _ref$className = _ref.className,
3760
- className = _ref$className === void 0 ? "" : _ref$className;
3758
+ className = _ref$className === void 0 ? "pl-1" : _ref$className;
3761
3759
  var _useTranslation = useTranslation(),
3762
3760
  t = _useTranslation.t;
3763
3761
  return /*#__PURE__*/React__default.createElement("div", {
3764
3762
  className: "relative top-0 flex justify-center"
3765
3763
  }, /*#__PURE__*/React__default.createElement(Button, {
3766
- icon: Refresh,
3767
- style: "secondary",
3768
- className: classNames("neeto-ui-border-gray-400 neeto-ui-bg-white border border-solid", className),
3769
- tooltipProps: {
3770
- content: t("slack.configure.refreshSlackChannelList"),
3771
- position: "top"
3772
- },
3773
- onClick: channelRefreshHandler
3764
+ className: className,
3765
+ label: t("slack.channelListRefreshButton"),
3766
+ style: "link",
3767
+ onClick: function onClick() {
3768
+ return slackChannelRefresh(channelRefreshHandler);
3769
+ }
3774
3770
  }));
3775
3771
  };
3776
3772
  var SlackRefreshChannelListButton$1 = /*#__PURE__*/React__default.memo(SlackRefreshChannelListButton);
@@ -3824,24 +3820,22 @@ var EditPane = function EditPane(_ref) {
3824
3820
  style: "body2",
3825
3821
  weight: "bold"
3826
3822
  }, t("slack.configure.sendToDescription"))), /*#__PURE__*/React__default.createElement("div", {
3827
- className: "relative flex"
3823
+ className: "relative flex flex-col items-start gap-y-3"
3828
3824
  }, /*#__PURE__*/React__default.createElement(Select, {
3829
3825
  isSearchable: true,
3830
- className: "pr-1",
3826
+ className: "w-full",
3831
3827
  name: "selectedChannel",
3832
3828
  options: formikProps.values.channels,
3833
3829
  placeholder: t("slack.placeholder"),
3834
3830
  size: "large"
3835
3831
  }), /*#__PURE__*/React__default.createElement(SlackRefreshChannelListButton$1, {
3836
3832
  channelRefreshHandler: channelRefreshHandler
3837
- }))), is(Function, children) ? children(_objectSpread({}, formikProps)) : children), /*#__PURE__*/React__default.createElement(Pane.Footer, null, /*#__PURE__*/React__default.createElement("div", {
3838
- className: "neeto-ui-mt-4"
3839
- }, /*#__PURE__*/React__default.createElement(Button, {
3833
+ }))), is(Function, children) ? children(_objectSpread({}, formikProps)) : children), /*#__PURE__*/React__default.createElement(Pane.Footer, null, /*#__PURE__*/React__default.createElement(Button, {
3840
3834
  disabled: isSubmitting || formikProps.isSubmitting,
3841
3835
  label: t("common.save"),
3842
3836
  loading: isSubmitting || formikProps.isSubmitting,
3843
3837
  type: "submit"
3844
- }))));
3838
+ })));
3845
3839
  }));
3846
3840
  };
3847
3841
 
@@ -3926,9 +3920,10 @@ var Configure = function Configure(_ref) {
3926
3920
  style: "body2",
3927
3921
  weight: "normal"
3928
3922
  }, isEmpty(channelSelectLabel) ? t("slack.configure.sendToDescription") : channelSelectLabel), /*#__PURE__*/React__default.createElement("div", {
3929
- className: "relative flex"
3923
+ className: "relative flex flex-col items-start gap-y-3"
3930
3924
  }, /*#__PURE__*/React__default.createElement(Select, {
3931
3925
  isSearchable: true,
3926
+ className: "w-full",
3932
3927
  name: "selectedChannel",
3933
3928
  options: formikProps.values.channels,
3934
3929
  placeholder: t("slack.placeholder"),
@@ -4033,7 +4028,7 @@ var Finish = function Finish(_ref) {
4033
4028
  className: "neeto-ui-flex neeto-ui-w-full neeto-ui-flex-row neeto-ui-mt-6"
4034
4029
  }, /*#__PURE__*/React__default.createElement(Button, _extends$1({
4035
4030
  className: "neeto-ui-my-1",
4036
- label: t("slack.steps.finish"),
4031
+ label: t("common.done"),
4037
4032
  onClick: onSuccess
4038
4033
  }, buttonProps)), isNotEmpty(secondaryButtonProps) && /*#__PURE__*/React__default.createElement(Button, _extends$1({
4039
4034
  className: "neeto-ui-my-1 neeto-ui-ml-2",