Skip to content

Commit 2b629a7

Browse files
authored
Merge pull request #44 from notificationapi-com/7trSTLbA/3354-slack-frontend-sdk
Add SLACK channel support in Notifications and Preferences
2 parents 90fda98 + 205ca15 commit 2b629a7

File tree

5 files changed

+28
-11
lines changed

5 files changed

+28
-11
lines changed

lib/components/Notifications/interface.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ export enum Channels {
1414
SMS = 'SMS',
1515
CALL = 'CALL',
1616
PUSH = 'PUSH',
17-
WEB_PUSH = 'WEB_PUSH'
17+
WEB_PUSH = 'WEB_PUSH',
18+
SLACK = 'SLACK'
1819
}
1920

2021
export enum DeliveryOptions {

lib/components/Preferences/PreferenceInput.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,15 @@ import {
1717
} from '@mui/material';
1818

1919
const sortChannels = (a: Channels, b: Channels) => {
20-
const order = ['EMAIL', 'INAPP_WEB', 'SMS', 'CALL', 'PUSH', 'WEB_PUSH'];
20+
const order = [
21+
'EMAIL',
22+
'INAPP_WEB',
23+
'SMS',
24+
'CALL',
25+
'PUSH',
26+
'WEB_PUSH',
27+
'SLACK'
28+
];
2129
return order.indexOf(a) - order.indexOf(b);
2230
};
2331

lib/components/Preferences/channelUtils.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
PhoneIphone,
77
Sms
88
} from '@mui/icons-material';
9+
import { SvgIcon } from '@mui/material';
910
import { Channels } from '../Notifications/interface';
1011

1112
export const getChannelLabel = (c: Channels): string => {
@@ -15,7 +16,8 @@ export const getChannelLabel = (c: Channels): string => {
1516
SMS: 'Text',
1617
CALL: 'Automated Calling',
1718
PUSH: 'Mobile',
18-
WEB_PUSH: 'Browser'
19+
WEB_PUSH: 'Browser',
20+
SLACK: 'Slack'
1921
};
2022
return labels[c];
2123
};
@@ -34,6 +36,12 @@ export const getChannelIcon = (channel: Channels): React.ReactElement => {
3436
return <NotificationsOutlined fontSize="small" color="primary" />;
3537
case Channels.WEB_PUSH:
3638
return <MarkChatUnread fontSize="small" color="primary" />;
39+
case Channels.SLACK:
40+
return (
41+
<SvgIcon fontSize="small" color="primary">
42+
<path d="M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52zM6.313 15.165a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313zM8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zM8.834 6.313a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312zM18.956 8.834a2.528 2.528 0 0 1 2.521-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.523 2.521h-2.521V8.834zM17.688 8.834a2.528 2.528 0 0 1-2.523 2.521 2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.165 0a2.528 2.528 0 0 1 2.523 2.522v6.312zM15.165 18.956a2.528 2.528 0 0 1 2.523 2.521A2.528 2.528 0 0 1 15.165 24a2.527 2.527 0 0 1-2.52-2.523v-2.521h2.52zM15.165 17.688a2.527 2.527 0 0 1-2.52-2.523 2.526 2.526 0 0 1 2.52-2.52h6.313A2.527 2.527 0 0 1 24 15.165a2.528 2.528 0 0 1-2.522 2.523h-6.313z" />
43+
</SvgIcon>
44+
);
3745
default:
3846
return <EmailOutlined fontSize="small" color="primary" />;
3947
}

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@notificationapi/react",
33
"private": false,
4-
"version": "1.1.4",
4+
"version": "1.2.0",
55
"type": "module",
66
"overrides": {
77
"esbuild": "^0.25.0",
@@ -63,7 +63,7 @@
6363
"@fontsource/roboto": "^5.1.1",
6464
"@mui/icons-material": "^6.3.1",
6565
"@mui/material": "^6.3.1",
66-
"@notificationapi/core": "^0.0.15",
66+
"@notificationapi/core": "^0.0.16",
6767
"javascript-time-ago": "^2.5.10",
6868
"liquidjs": "^10.14.0",
6969
"rc-virtual-list": "^3.11.5",

0 commit comments

Comments
 (0)