@bigbinary/neeto-slack-frontend 0.3.7 → 0.3.9
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 +42 -8
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +43 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/types.d.ts +2 -0
package/dist/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default, { useContext, useState, useRef, useEffect } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
-
import { Typography, Label
|
|
4
|
+
import { Button, Typography, Label } from '@bigbinary/neetoui';
|
|
5
5
|
import { Form, Select } from '@bigbinary/neetoui/formik';
|
|
6
6
|
import { not, is } from 'ramda';
|
|
7
|
+
import { Refresh } from '@bigbinary/neeto-icons';
|
|
7
8
|
import * as yup from 'yup';
|
|
8
9
|
import { Slack } from '@bigbinary/neeto-icons/misc';
|
|
9
10
|
import { isNotEmpty } from '@bigbinary/neeto-commons-frontend/pure';
|
|
@@ -3187,7 +3188,8 @@ var slack = {
|
|
|
3187
3188
|
configure: {
|
|
3188
3189
|
sendTo: "Send to",
|
|
3189
3190
|
sendToDescription: "Choose a Slack channel or contact to send the notifications",
|
|
3190
|
-
updateType: "Update type"
|
|
3191
|
+
updateType: "Update type",
|
|
3192
|
+
refreshSlackChannelList: "Refresh Slack Channel list"
|
|
3191
3193
|
},
|
|
3192
3194
|
finish: {
|
|
3193
3195
|
title: "Slack successfully connected",
|
|
@@ -3310,6 +3312,26 @@ function _slicedToArray(arr, i) {
|
|
|
3310
3312
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
3311
3313
|
}
|
|
3312
3314
|
|
|
3315
|
+
var SlackRefreshChannelListButton = function SlackRefreshChannelListButton(_ref) {
|
|
3316
|
+
var channelRefreshHandler = _ref.channelRefreshHandler,
|
|
3317
|
+
_ref$className = _ref.className,
|
|
3318
|
+
className = _ref$className === void 0 ? "" : _ref$className;
|
|
3319
|
+
var _useTranslation = useTranslation(),
|
|
3320
|
+
t = _useTranslation.t;
|
|
3321
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
3322
|
+
className: "relative top-0 flex justify-center"
|
|
3323
|
+
}, /*#__PURE__*/React__default.createElement(Button, {
|
|
3324
|
+
icon: Refresh,
|
|
3325
|
+
style: "secondary",
|
|
3326
|
+
className: classNames("border border-solid border-gray-400 bg-white", className),
|
|
3327
|
+
tooltipProps: {
|
|
3328
|
+
content: t("slack.configure.refreshSlackChannelList"),
|
|
3329
|
+
position: "top"
|
|
3330
|
+
},
|
|
3331
|
+
onClick: channelRefreshHandler
|
|
3332
|
+
}));
|
|
3333
|
+
};
|
|
3334
|
+
|
|
3313
3335
|
var CHANNEL_NAME_VALIDAITON_SCHEMA = {
|
|
3314
3336
|
selectedChannel: yup.object().shape({
|
|
3315
3337
|
label: yup.string(),
|
|
@@ -3337,7 +3359,8 @@ var Settings = function Settings(_ref) {
|
|
|
3337
3359
|
handleSubmit = _ref.handleSubmit,
|
|
3338
3360
|
isSubmitting = _ref.isSubmitting,
|
|
3339
3361
|
className = _ref.className,
|
|
3340
|
-
validationSchema = _ref.validationSchema
|
|
3362
|
+
validationSchema = _ref.validationSchema,
|
|
3363
|
+
channelRefreshHandler = _ref.channelRefreshHandler;
|
|
3341
3364
|
var _useState = useState(false),
|
|
3342
3365
|
_useState2 = _slicedToArray(_useState, 2),
|
|
3343
3366
|
isEditable = _useState2[0],
|
|
@@ -3377,14 +3400,18 @@ var Settings = function Settings(_ref) {
|
|
|
3377
3400
|
className: "neeto-ui-text-gray-700 neeto-ui-mb-3",
|
|
3378
3401
|
style: "body2",
|
|
3379
3402
|
weight: "normal"
|
|
3380
|
-
}, t("slack.configure.sendToDescription")), /*#__PURE__*/React__default.createElement(
|
|
3403
|
+
}, t("slack.configure.sendToDescription")), /*#__PURE__*/React__default.createElement("div", {
|
|
3404
|
+
className: "relative flex"
|
|
3405
|
+
}, /*#__PURE__*/React__default.createElement(Select, {
|
|
3381
3406
|
isSearchable: true,
|
|
3382
3407
|
isDisabled: not(isEditable),
|
|
3383
3408
|
name: "selectedChannel",
|
|
3384
3409
|
options: formikProps.values.channels,
|
|
3385
3410
|
placeholder: t("slack.placeholder"),
|
|
3386
3411
|
size: "large"
|
|
3387
|
-
})
|
|
3412
|
+
}), /*#__PURE__*/React__default.createElement(SlackRefreshChannelListButton, {
|
|
3413
|
+
channelRefreshHandler: channelRefreshHandler
|
|
3414
|
+
}))), is(Function, children) ? children(_objectSpread(_objectSpread({}, formikProps), {}, {
|
|
3388
3415
|
isDisabled: not(isEditable)
|
|
3389
3416
|
})) : children, /*#__PURE__*/React__default.createElement("div", {
|
|
3390
3417
|
className: "neeto-ui-mt-4"
|
|
@@ -3412,7 +3439,8 @@ var Configure = function Configure(_ref) {
|
|
|
3412
3439
|
handleSubmit = _ref.handleSubmit,
|
|
3413
3440
|
isSubmitting = _ref.isSubmitting,
|
|
3414
3441
|
className = _ref.className,
|
|
3415
|
-
validationSchema = _ref.validationSchema
|
|
3442
|
+
validationSchema = _ref.validationSchema,
|
|
3443
|
+
channelRefreshHandler = _ref.channelRefreshHandler;
|
|
3416
3444
|
var _useTranslation = useTranslation(),
|
|
3417
3445
|
t = _useTranslation.t;
|
|
3418
3446
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -3443,13 +3471,17 @@ var Configure = function Configure(_ref) {
|
|
|
3443
3471
|
className: "neeto-ui-text-gray-700 neeto-ui-mb-3",
|
|
3444
3472
|
style: "body2",
|
|
3445
3473
|
weight: "normal"
|
|
3446
|
-
}, t("slack.configure.sendToDescription")), /*#__PURE__*/React__default.createElement(
|
|
3474
|
+
}, t("slack.configure.sendToDescription")), /*#__PURE__*/React__default.createElement("div", {
|
|
3475
|
+
className: "relative flex"
|
|
3476
|
+
}, /*#__PURE__*/React__default.createElement(Select, {
|
|
3447
3477
|
isSearchable: true,
|
|
3448
3478
|
name: "selectedChannel",
|
|
3449
3479
|
options: formikProps.values.channels,
|
|
3450
3480
|
placeholder: t("slack.placeholder"),
|
|
3451
3481
|
size: "large"
|
|
3452
|
-
})
|
|
3482
|
+
}), /*#__PURE__*/React__default.createElement(SlackRefreshChannelListButton, {
|
|
3483
|
+
channelRefreshHandler: channelRefreshHandler
|
|
3484
|
+
}))), is(Function, children) ? children(formikProps) : children, /*#__PURE__*/React__default.createElement(Button, {
|
|
3453
3485
|
label: t("common.continue"),
|
|
3454
3486
|
loading: isSubmitting,
|
|
3455
3487
|
type: "submit"
|
|
@@ -3458,7 +3490,8 @@ var Configure = function Configure(_ref) {
|
|
|
3458
3490
|
};
|
|
3459
3491
|
|
|
3460
3492
|
var Connect = function Connect(_ref) {
|
|
3461
|
-
var handleRedirectToSlack = _ref.handleRedirectToSlack
|
|
3493
|
+
var handleRedirectToSlack = _ref.handleRedirectToSlack,
|
|
3494
|
+
isAuthorizeUrlFetching = _ref.isAuthorizeUrlFetching;
|
|
3462
3495
|
var _useTranslation = useTranslation(),
|
|
3463
3496
|
t = _useTranslation.t;
|
|
3464
3497
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -3475,6 +3508,7 @@ var Connect = function Connect(_ref) {
|
|
|
3475
3508
|
weight: "normal"
|
|
3476
3509
|
}, t("slack.connect.description")), /*#__PURE__*/React__default.createElement(Button, {
|
|
3477
3510
|
label: t("slack.connect.loginButton"),
|
|
3511
|
+
loading: isAuthorizeUrlFetching,
|
|
3478
3512
|
onClick: handleRedirectToSlack
|
|
3479
3513
|
}));
|
|
3480
3514
|
};
|