Build chat in minutes with Sendbird UIKit open source code.
MIT License
Published by HoonBaek over 1 year ago
Voice message is a new type of message and feature that you can use in group channel. You can record your voice on the message input and send it to the channel. Also the messages will be displayed as a new design of the voice message. You are able to use this feature from this version.
isVoiceMessageEnabled
on the and components. Here is an example.import App from '@sendbird/uikit-react/App'
import SendbirdProvider from '@sendbird/uikit-react/SendbirdProvider'
import { useEffect } from 'react'
const QuickStart = () => (<App isVoiceMessageEnabled />)
const CustomApp = () => {
const [useVoiceMessage, setUseVoiceMessage] = useEffect(true)
return (
<SendbirdProvider
isVoiceMessageEnabled={useVoiceMessage}
>
{/* Implement your custom app here */}
</SendbirdProvider>
)
}
You can identify the voice message to check if message.type
includes sbu_type=voice
. But you can use isVoiceMessage
util function to do that.
import Channel from '@sendbird/uikit-react/Channel'
import isVoiceMessage from '@sendbird/uikit-react/utils/message/isVoiceMessage'
const CustomChannel = () => {
return (
<Channel
renderMessage={({ message }) => {
if (isVoiceMessage(message)) {
// Return your custom voice message item component
}
return null
}}
/>
)
}
renderVoiceMessageIcon
props of MessageInput component.isVoiceMessageEnabled
and voiceRecord
props to the App, SendbirdProvider
, and MessageInput
components, to turn on/off the voice message recording feature
import SendbirdProvider from '@sendbird/uikit-react/SendbirdProvider'
const CustomApp = () => {
return (
<SendbirdProvider
isVoiceMessageEnabled
voiceRecord={{
maxRecordingTime: 60000,
minRecordingTime: 1000,
}}
>
{/* implement custom application */}
</SendbirdProvider>
)
}
onVoiceMessageIconClick
to the MessageInput
componentonBeforeSendVoiceMessage
to the Channel
componentMetaArray
in the Channel
and Thread
modulesAudioOnLined
& new IconColor Primary2
and OnBackground4
import SendbirdProvider from '@sendbird/uikit-react/SendbirdProvider'
const CustomApp = () => {
return (
<SendbirdProvider
stringSet={{
BUTTON__OK: 'OK',
VOICE_MESSAGE: 'Voice Message',
MODAL__VOICE_MESSAGE_INPUT_DISABLED__TITLE_MUTED: 'You\'re muted by the operator.',
MODAL__VOICE_MESSAGE_INPUT_DISABLED__TITLE_FROZEN: 'Channel is frozen.',
}}
>
{/* implement custom application */}
</SendbirdProvider>
)
}
BUTTON__OK
: 'OK' → Used on the submit button of pop up modalMODAL__VOICE_MESSAGE_INPUT_DISABLED__TITLE_MUTED
: 'You're muted by the operator.' → Used in an alert pop-up modalMODAL__VOICE_MESSAGE_INPUT_DISABLED__TITLE_FROZEN
: 'Channel is frozen.' → Used in an alert pop-up modalVOICE_MESSAGE
: 'Voice Message' → Used in ChannelPreviewItem, QuoteMessage, and MessageSearch to appear that the message type is the voice## External Contributionslamejs
to convert the audio file to mp3 (iOS support)import PlaybackTime from "@sendbird/uikit-react/ui/PlaybackTime"
import ProgressBar from "@sendbird/uikit-react/ui/ProgressBar"
import VoiceMessageInput from "@sendbird/uikit-react/ui/VoiceMessageInput"
import VoiceMessageItemBody from "@sendbird/uikit-react/ui/VoiceMessageItemBody"
import { VoiceRecorderProvider, useVoiceRecorderContext } from '@sendbird/uikit-react/VoiceRecorder/context'
import useVoiceRecorder from '@sendbird/uikit-react/VoiceRecorder/useVoiceRecorder'
start
, and stop
functionsrecordingLimit
, recordingTime
, recordingFile
, and recordingStatus
. Recommend using this hook in the customized components.import { VoicePlayerProvider, useVoicePlayerContext } from '@sendbird/uikit-react/VoicePlayer/context'
import useVoicePlayer from '@sendbird/uikit-react/VoicePlayer/useVoicePlayer'
play
, and pause
functionsplaybackTime
, duration
, and playingStatus
. Recommend using this hook in the customized components.import isVoiceMessage from '@sendbird/uikit-react/utils/message/isVoiceMessage'
const isVoiceMsg: boolean = isVoiceMessage(message);
Features:
renderFileUploadIcon
, renderVoiceMessageIcon
, and renderSendMessageIcon
into the Channel
, ChannelUI
, and MessageInput
component
interface MessageInputProps {
renderFileUploadIcon?: () => React.ReactElement;
renderVoiceMessageIcon?: () => React.ReactElement;
renderSendMessageIcon?: () => React.ReactElement;
}
Fixes:
.sendbird-og-message-item-body__og-thumbnail__empty {
display: none;
}
Full Changelog: https://github.com/sendbird/sendbird-uikit-react/compare/v3.3.7...v3.4.0
Published by HoonBaek over 1 year ago
Features:
activeChannelUrl
to ChannelList to give an option to pragmatically set a channel from a parent component router
const MyChannelList = () => {
const [myActiveChannel] = useState()
return (<ChannelList activeChannelUrl={myActiveChannel.url} />)
}
Fixes:
channel.invitedAt
value when trying to fetch MessageSearchQuery@sendbird/uikit-react/ui/CheckBox
as falsePublished by sravan-s over 1 year ago
Fixes:
Published by sravan-s over 1 year ago
A notification channel is a new group channel dedicated to receiving one way marketing and transactional messages. To allow users to view messages sent through Sendbird Message Builder with the correct rendering, you need to implement the notification channel view using <NotificationChannel>
Overview:
NotificationChannel
import NotificationChannel from '@sendbird/uikit-react/NotificationChannel'
example:
export const NotificationChannelComponenet = () => (
<Sendbird
appId={appId}
userId={userId}
accessToken={accessToken}
>
<div style={{ height: '960px', width: '360px' }}>
<NotificationChannel
channelUrl={`SENDBIRD_NOTIFICATION_CHANNEL_NOTIFICATION_${userId}`}
renderPlaceholderLoader={() => <MyBrandLogo />};
handleCustomAction={(event, action, message) => {
... implement custom action
}}
/>
</div>
</Sendbird>
);
import { NotficationChannelProvider useNotficationChannelContext } from '@sendbird/uikit-react/NotificationChannel/context'
import NotificationChannelUI from '@sendbird/uikit-react/NotificationChannel/components/NotificationChannelUI'
import NotificationMessageWrap from '@sendbird/uikit-react/NotificationChannel/components/NotificationMessageWrap'
import NotificationList from '@sendbird/uikit-react/NotificationChannel/components/NotificationList'
import { createMessageTemplate } from '@sendbird/react-message-template'
import { createParser } from '@sendbird/react-message-template'
import { createRenderer } from '@sendbird/react-message-template'
import { MessageProvider, useMessageContext } from '@sendbird/react-uikit-message-template-view';
import { MessageTemplateView } from '@sendbird/react-uikit-message-template-view';
Published by sravan-s over 1 year ago
Features:
Fix:
userIdsFilter
of ChannelListQuery doesn't work when receiving messages_searchFilter
and _userIdsFilter
to new things searchFilter
and `userIdsFilterPublished by HoonBaek almost 2 years ago
Fix:
Published by HoonBaek almost 2 years ago
Fix:
Published by HoonBaek almost 2 years ago
[v3.3.2] (Dec 8 2022)
Features:
Add props renderTitle
to the component
renderHeader
of will be deprecatedAdd interface overrideInviteUser
Add overrideInviteUser to ChannelList, CreateChannel and ChannelSettings
This interface overrides InviteMember functionality. Customer has to create the channel
and close the popup manually
export type OverrideInviteUserType = {
users: Array<string>;
onClose: () => void;
channelType: 'group' | 'supergroup' | 'broadcast';
};
export interface ChannelListProps {
overrideInviteUser?(params: OverrideInviteUserType): void;
}
export interface CreateChannelProps {
overrideInviteUser?(params: OverrideInviteUserType): void;
}
export type OverrideInviteMemberType = {
users: Array<string>;
onClose: () => void;
channel: GroupChannel;
};
ChannelSettings.overrideInviteUser?(params: OverrideInviteMemberType): void;
example:
<ChannelList
overrideInviteUser={({users, onClose, channelType}) => {
createMyChannel(users, channelType).then(() => {
onClose();
})
}}
/>
Fixes:
ThreadUIProps.renderMessage
.renderHeader
of .isMentionEnabled
of .messageSearchQuery
of to MessageSearchQueryParams.Full Changelog: https://github.com/sendbird/sendbird-uikit-react/compare/v3.3.0...v3.3.2
Published by HoonBaek almost 2 years ago
[v3.3.1] (Nov 23 2022)
Fixes:
useThreadContext
channelStatus
to channelState
parentMessageInfoStatus
to parentMessageState
threadListStatus
to threadListState
enum ChannelStateTypes {
NIL = 'NIL',
LOADING = 'LOADING',
INVALID = 'INVALID',
INITIALIZED = 'INITIALIZED',
}
enum ParentMessageStateTypes {
NIL = 'NIL',
LOADING = 'LOADING',
INVALID = 'INVALID',
INITIALIZED = 'INITIALIZED',
}
enum ThreadListStateTypes {
NIL = 'NIL',
LOADING = 'LOADING',
INVALID = 'INVALID',
INITIALIZED = 'INITIALIZED',
}
[v3.3.0] (Nov 23 2022)
Features:
Thread
. See the specific informations of this module on the Docs page
Thread
. Import it with
import Thread from "@sendbird/uikit-react/Thread"
ThreadProvider
and useThreadContext
for customization. Import it with
import { ThreadProvider, useThreadContext } from "@sendbird/uikit-react/Thread/context"
ThreadUI
, ThreadHeader
, ParentMessageInfo
, ParentMessageInfoItem
, ThreadList
, ThreadListItem
, and ThreadMessageInput
are itthreadReplySelectType
: Type of the value should be
enum ThreadReplySelectType { PARENT, THREAD }
You can see how to use it below
import { ThreadReplySelectType } from "@sendbird/uikit-react/Channel/context";
<Channel
...
threadReplySelectType={ThreadReplySelectType.PARENT}
/>
animatedMessage
: Type of the value should be number(messageId)onReplyInThread
: This function is called when user click the button "Reply in thread" on the message context menu
type onReplyInThread = ({ message: UserMessage | FileMessage }) => void
onQuoteMessageClick
: This function is called when user click the quote message on the message of Channel
type onQuoteMessageClick = ({ message: UserMessage | FileMessage }) => {}
onMessageAnimated
: This function is called after that message item is animated
type onMessageAnimated = () => void
onMessageHighlighted
: This function is called after that message item is highlighted
type onMessageHighlighted = () => void
ui/ThreadReplies
component
interface ThreadRepliesProps {
className?: string;
threadInfo: ThreadInfo;
onClick?: (e: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>) => void;
}
Fixes:
Published by HoonBaek almost 2 years ago
Features:
Thread
. See the specific informations of this module on the Docs page
Thread
. Import it with
import Thread from "@sendbird/uikit-react/Thread"
ThreadProvider
and useThreadContext
for customization. Import it with
import { ThreadProvider, useThreadContext } from "@sendbird/uikit-react/Thread/context"
ThreadUI
, ThreadHeader
, ParentMessageInfo
, ParentMessageInfoItem
, ThreadList
, ThreadListItem
, and ThreadMessageInput
are itthreadReplySelectType
: Type of the value should be
enum ThreadReplySelectType { PARENT, THREAD }
You can see how to use it below
import { ThreadReplySelectType } from "@sendbird/uikit-react/Channel/context";
<Channel
...
threadReplySelectType={ThreadReplySelectType.PARENT}
/>
animatedMessage
: Type of the value should be number(messageId)onReplyInThread
: This function is called when user click the button "Reply in thread" on the message context menu
type onReplyInThread = ({ message: UserMessage | FileMessage }) => void
onQuoteMessageClick
: This function is called when user click the quote message on the message of Channel
type onQuoteMessageClick = ({ message: UserMessage | FileMessage }) => {}
onMessageAnimated
: This function is called after that message item is animated
type onMessageAnimated = () => void
onMessageHighlighted
: This function is called after that message item is highlighted
type onMessageHighlighted = () => void
ui/ThreadReplies
component
interface ThreadRepliesProps {
className?: string;
threadInfo: ThreadInfo;
onClick?: (e: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>) => void;
}
Fixes:
Published by sravan-s almost 2 years ago
Fix:
Published by HoonBaek almost 2 years ago
Fix:
channel
to channelUrl
channel
to channelUrl
channel
to channelUrl
Published by sravan-s almost 2 years ago
Features:
<Channel channelUrl {currentChannelUrl} isLoading={!currentChannelUrl} />
Fixes:
Published by HoonBaek about 2 years ago
Feature:
disableMarkAsRead
into the Published by sravan-s about 2 years ago
Feature:
OutgoingMessageStates
enum OutgoingMessageStates { NONE, PENDING, SENT, FAILED, DELIVERED, READ }
getOutgoingMessageState
function getOutgoingMessageState(channel, message): OutgoingMessageStates
disableMarkAsDelivered
into the and Published by sravan-s about 2 years ago
Fixes:
Compiled UIKit code that is distributed through npm shouldnt have Chat SDK minified code included in it Chat SDK should be a dependency of UIKit
Advantages:
What caused the issue:
If you are usig rollup for bundling
in config.external you have to be specific
ie>
This works:
external: [
'@sendbird/chat',
'@sendbird/chat/groupChannel',
'@sendbird/chat/openChannel',
'@sendbird/chat/message',
]
This doesnt:
external: [ '@sendbird/chat', ]
For npm >= v7, npm autoinstall peerDependency packages According to https://docs.npmjs.com/cli/v8/configuring-npm/package-json#peerdependencies You want to express the compatibility of your package with a host tool or library while not necessarily doing a require of this host Even though react is required, its better to show that react is the host tool
Published by sravan-s about 2 years ago
Features:
Fixes:
o
penChannel casing in type defnDev. Env:
enzyme
and react-test-renderer
react
version to v18
storybook
version to v6.5.10
jest
and babel-jest
to v29
jsdom
to v20
jest-environment-jsdom
global-jsdom
testing-library
(@testing-library/react
and @testing-library/jest-dom
)testing-library
instead of the enzyme
and `react-test-rendererPublished by HoonBaek about 2 years ago
Features:
@sendbird/uikit-react/handlers/SessionHandler
import SessionHandler from '@sendbird/uikit-react/handlers/SessionHandler'
config.isREMUnitEnabled
-> true on SendbirdProviderFixes:
isReactionEnabled
to the <TextMessageItemBody />
isReactionEnabled
to the <OGMessageItemBody />
isReactionEnabled
to the <FileMessageItemBody />
isReactionEnabled
to the <ThumbnailMessageItemBody />
isReactionEnabled
to the <UnknownMessageItemBody />
Published by sravan-s about 2 years ago
Migrate UI components into TypeScript
This doesnt affect anyone, it a step in task to migrate the project source code into TS
Fixes:
Type defn: Change type of react elements to React.ReactElement
React.ReactNode
and React.Component
to React.ReactElement
'ts' as const
ReactNode could be string | number | null | undefined | ReactElement | portal
and this(expecting string or number) causes warning when we use it like <CustomComp />
// in the component
{ renderMessage } = props
const CustomMessage = useMemo(() => {
return renderMessage({ ... });
}, []);
return (
<div>
<CustomMessage />
</div>
);
so expecting ReactElement is better for our case
Fix message grouping:
Set isMessageGroupingEnabed to true(was set to false during v2 migration)
Published by sravan-s about 2 years ago
Features:
@sendbird/uikit-react/handlers
, this is a workaround@sendbird/uikit-react/handlers/ConnectionHandler
@sendbird/uikit-react/handlers/GroupChannelHandler
@sendbird/uikit-react/handlers/OpenChannelHandler
@sendbird/uikit-react/handlers/UserEventHandler
Fixes: