@bigbinary/neeto-slack-frontend 2.0.2 → 2.1.1

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: {
@@ -3630,14 +3627,11 @@ var slack = {
3630
3627
  configure: {
3631
3628
  title: "You are connecting to <br/><strong>{{teamName}}</strong> workspace <br/>({{slackUrl}}).",
3632
3629
  sendTo: "Send to",
3633
- sendToDescription: "Choose a Slack channel to send the notifications",
3634
- updateType: "Update type",
3630
+ sendToDescription: "Choose a Slack channel that will receive notifications",
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,9 +3820,10 @@ 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 gap-x-3"
3823
+ className: "relative flex flex-col items-start gap-y-3"
3828
3824
  }, /*#__PURE__*/React__default.createElement(Select, {
3829
3825
  isSearchable: true,
3826
+ className: "w-full",
3830
3827
  name: "selectedChannel",
3831
3828
  options: formikProps.values.channels,
3832
3829
  placeholder: t("slack.placeholder"),
@@ -3885,6 +3882,8 @@ Settings.EditPane = EditPane;
3885
3882
  var Configure = function Configure(_ref) {
3886
3883
  var children = _ref.children,
3887
3884
  teamName = _ref.teamName,
3885
+ _ref$slackUrl = _ref.slackUrl,
3886
+ slackUrl = _ref$slackUrl === void 0 ? "" : _ref$slackUrl,
3888
3887
  initialFormValues = _ref.initialFormValues,
3889
3888
  handleSubmit = _ref.handleSubmit,
3890
3889
  isSubmitting = _ref.isSubmitting,
@@ -3905,7 +3904,7 @@ var Configure = function Configure(_ref) {
3905
3904
  i18nKey: "slack.configure.title",
3906
3905
  values: {
3907
3906
  teamName: teamName,
3908
- slackUrl: toSlackUrl(teamName)
3907
+ slackUrl: isEmpty(slackUrl) ? toSlackUrl(teamName) : slackUrl
3909
3908
  }
3910
3909
  }))), /*#__PURE__*/React__default.createElement(Form, {
3911
3910
  className: "neeto-ui-w-full",
@@ -3923,9 +3922,10 @@ var Configure = function Configure(_ref) {
3923
3922
  style: "body2",
3924
3923
  weight: "normal"
3925
3924
  }, isEmpty(channelSelectLabel) ? t("slack.configure.sendToDescription") : channelSelectLabel), /*#__PURE__*/React__default.createElement("div", {
3926
- className: "relative flex gap-x-3"
3925
+ className: "relative flex flex-col items-start gap-y-3"
3927
3926
  }, /*#__PURE__*/React__default.createElement(Select, {
3928
3927
  isSearchable: true,
3928
+ className: "w-full",
3929
3929
  name: "selectedChannel",
3930
3930
  options: formikProps.values.channels,
3931
3931
  placeholder: t("slack.placeholder"),
@@ -4030,7 +4030,7 @@ var Finish = function Finish(_ref) {
4030
4030
  className: "neeto-ui-flex neeto-ui-w-full neeto-ui-flex-row neeto-ui-mt-6"
4031
4031
  }, /*#__PURE__*/React__default.createElement(Button, _extends$1({
4032
4032
  className: "neeto-ui-my-1",
4033
- label: t("slack.steps.finish"),
4033
+ label: t("common.done"),
4034
4034
  onClick: onSuccess
4035
4035
  }, buttonProps)), isNotEmpty(secondaryButtonProps) && /*#__PURE__*/React__default.createElement(Button, _extends$1({
4036
4036
  className: "neeto-ui-my-1 neeto-ui-ml-2",