Releases: sendbird/sendbird-uikit-react
Releases · sendbird/sendbird-uikit-react
[v3.8.0] (Nov 3 2023)
Feat:
- Added a feature to support predefined suggested reply options for AI chatbot trigger messages.
- Introduced custom date format string sets, allowing users to customize the date format for
DateSeparatorsandUnreadCount. - Exported the
initialMessagesFetchcallback from the hook to provide more flexibility in UIKit customization.
Fixes:
- Removed duplicate
UserProfileProviderin `OpenChannelSettings``. - Removed the logic blocking the addition of empty channels to the ChannelList.
- Fixed a runtime error in empty channels.
- Added precise object dependencies in effect hooks to prevent unnecessary re-renders in the Channel module.
Chores:
- Migrated the rest of modules & UI components to TypeScript from Javascript.
- Introduced new build settings:
- Changes have been made to export modules using the sub-path exports in the
package.json. If you were using the package in a Native CJS environment, this might have an impact.
In that case, you can migrate the path as follows:- const ChannelList = require('@sendbird/uikit-react/cjs/ChannelList'); + const ChannelList = require('@sendbird/uikit-react/ChannelList');
- TypeScript support also has been improved. Now, precise types based on the source code are used.
- Changes have been made to export modules using the sub-path exports in the
[v3.7.0] (Oct 23 2023)
Multiple Files Message
Now we are supporting Multiple Files Message feature!
You can select some multiple files in the message inputs, and send multiple images in one message.
If you select several types of files, only images will be combined in the message and the other files will be sent separately.
Also we have resolved many issues found during QA.
How to enable this feature?
You can turn it on in four places.
- App Component
import App from '@sendbird/uikit-react/App'
<App
...
isMultipleFilesMessageEnabled
/>- SendbirdProvider
import { SendbirdProvider } from '@sendbird/uikit-react/SendbirdProvider'
<SendbirdProvider
...
isMultipleFilesMessageEnabled
>
{...}
</SendbirdProvider>- Channel
import Channel from '@sendbird/uikit-react/Channel';
import { ChannelProvider } from '@sendbird/uikit-react/Channel/context';
<Channel
...
isMultipleFilesMessageEnabled
/>
<ChannelProvider
...
isMultipleFilesMessageEnabled
>
{...}
</ChannelProvider>- Thread
import Thread from '@sendbird/uikit-react/Thread';
import { ThreadProvider } from '@sendbird/uikit-react/Thread/context';
<Thread
...
isMultipleFilesMessageEnabled
/>
<ThreadProvider
...
isMultipleFilesMessageEnabled
>
{...}
</ThreadProvider>Interface change/publish
- The properties of the
ChannelContextandThreadContexthas been changed little bit.allMessagesof the ChannelContext has been divided intoallMessagesandlocalMessagesallThreadMessagesof the ThreadContext has been divided intoallThreadMessagesandlocalThreadMessages- Each local messages includes
pendingandfailedmessages, and the all messages will contain onlysucceededmessages - Please keep in mind, you have to migrate to using the local messages, IF you have used the
local messagesto draw your custom message components.
- pubSub has been published
publishingModuleshas been added to the payload of pubSub.publish
You can specify the particular modules that you propose for event publishing
import { useCallback } from 'react' import { SendbirdProvider, useSendbirdStateContext } from '@sendbird/uikit-react/SendbirdProvider' import { PUBSUB_TOPICS as topics, PublishingModuleTypes } from '@sendbird/uikit-react/pubSub/topics' const CustomApp = () => { const globalState = useSendbirdStateContext(); const { stores, config } = globalState; const { sdk, initialized } = stores.sdkStore; const { pubSub } = config; const onSendFileMessageOnlyInChannel = useCallback((channel, params) => { channel.sendFileMessage(params) .onPending((pendingMessage) => { pubSub.publish(topics.SEND_MESSAGE_START, { channel, message: pendingMessage, publishingModules: [PublishingModuleTypes.CHANNEL], }); }) .onFailed((failedMessage) => { pubSub.publish(topics.SEND_MESSAGE_FAILED, { channel, message: failedMessage, publishingModules: [PublishingModuleTypes.CHANNEL], }); }) .onSucceeded((succeededMessage) => { pubSub.publish(topics.SEND_FILE_MESSAGE, { channel, message: succeededMessage, publishingModules: [PublishingModuleTypes.CHANNEL], }); }) }, []); return (<>...</>) }; const App = () => ( <SendbirdProvider> <CustomApp /> </SendbirdProvider> );
Fixes:
- Improve the pubSub&dispatch logics
- Allow deleting failed messages
- Check applicationUserListQuery.isLoading before fetching user list
- Fix the error message: "Query in progress."
- Fix missed or wrong type definitions
quoteMessageof ChannelProviderInterfaceuseEditUserProfileProviderContexthas been renamed touseEditUserProfileContextimport { useEditUserProfileProviderContext } from '@sendbird/uikit-react/EditUserProfile/context' // to import { useEditUserProfileContext } from '@sendbird/uikit-react/EditUserProfile/context'
[v3.6.10] (Oct 11 2023)
Fixes:
- (in Safari) Display the placeholder of the MessageInput when the input text is cleared
- Remove duplicated CSS line
- (in iOS) fix focusing on the chat screen starts from the top in Mobile device
- Move to the top in the ChannelList when the current user but a different peer sends a message
[v3.6.9] (Oct 6 2023)
[v3.6.9] (Oct 6 2023)
Fixes:
- (in Safari) Display the placeholder of the MessageInput when the input text is cleared
- Remove duplicated CSS line
- Able to see the quoted messages regardless of the ReplyType
- Improve the types of the function props of
ui/MessageInputcomponentinterface MessageInputProps { ... onFileUpload?: (fileList: FileList) => void; onSendMessage?: (props: { message: string, mentionTemplate: string }) => void; onUpdateMessage?: (props: { messageId: string, message: string, mentionTemplate: string }) => void; }
- Move to the channel list when current user is banned or the channel is deleted in MobileLayout
- Add new iconColor: THUMBNAIL_ICON which doesn't change by theme
- Add some props types that we have missed in the public interface
- ChannelProvider
- Add
interface ChannelContextProps { onBeforeSendVoiceMessage?: (file: File, quotedMessage?: SendableMessageType) => FileMessageCreateParams; }
- Usage
import { ChannelProvider } from '@sendbird/uikit-react/Channel/context' <ChannelProvider onBeforeSendVoiceMessage={() => {}} />
- Add
- ThreadProvider
- Add
interface ThreadProviderProps { onBeforeSendUserMessage?: (message: string, quotedMessage?: SendableMessageType) => UserMessageCreateParams; onBeforeSendFileMessage?: (file: File, quotedMessage?: SendableMessageType) => FileMessageCreateParams; onBeforeSendVoiceMessage?: (file: File, quotedMessage?: SendableMessageType) => FileMessageCreateParams; }
- Usage
import { ThreadProvider } from '@sendbird/uikit-react/Thread/context' <ThreadProvider onBeforeSendUserMessage={() => {}} onBeforeSendFileMessage={() => {}} onBeforeSendVoiceMessage={() => {}} />
- Add
- ui/Button
- Add
enum ButtonTypes { PRIMARY = 'PRIMARY', SECONDARY = 'SECONDARY', DANGER = 'DANGER', DISABLED = 'DISABLED', } enum ButtonSizes { BIG = 'BIG', SMALL = 'SMALL', }
- Usage
import Button, { ButtonTypes, ButtonSizes } from '@sendbird/uikit-react/ui/Button' <Button type={ButtonTypes.PRIMARY} size={ButtonSizes.BIG} />
- Add
- ui/Icon
- Add
export enum IconTypes { ADD = 'ADD', ARROW_LEFT = 'ARROW_LEFT', ATTACH = 'ATTACH', AUDIO_ON_LINED = 'AUDIO_ON_LINED', BAN = 'BAN', BROADCAST = 'BROADCAST', CAMERA = 'CAMERA', CHANNELS = 'CHANNELS', CHAT = 'CHAT', CHAT_FILLED = 'CHAT_FILLED', CHEVRON_DOWN = 'CHEVRON_DOWN', CHEVRON_RIGHT = 'CHEVRON_RIGHT', CLOSE = 'CLOSE', COLLAPSE = 'COLLAPSE', COPY = 'COPY', CREATE = 'CREATE', DELETE = 'DELETE', DISCONNECTED = 'DISCONNECTED', DOCUMENT = 'DOCUMENT', DONE = 'DONE', DONE_ALL = 'DONE_ALL', DOWNLOAD = 'DOWNLOAD', EDIT = 'EDIT', EMOJI_MORE = 'EMOJI_MORE', ERROR = 'ERROR', EXPAND = 'EXPAND', FILE_AUDIO = 'FILE_AUDIO', FILE_DOCUMENT = 'FILE_DOCUMENT', FREEZE = 'FREEZE', GIF = 'GIF', INFO = 'INFO', LEAVE = 'LEAVE', MEMBERS = 'MEMBERS', MESSAGE = 'MESSAGE', MODERATIONS = 'MODERATIONS', MORE = 'MORE', MUTE = 'MUTE', NOTIFICATIONS = 'NOTIFICATIONS', NOTIFICATIONS_OFF_FILLED = 'NOTIFICATIONS_OFF_FILLED', OPERATOR = 'OPERATOR', PHOTO = 'PHOTO', PLAY = 'PLAY', PLUS = 'PLUS', QUESTION = 'QUESTION', REFRESH = 'REFRESH', REPLY = 'REPLY', REMOVE = 'REMOVE', SEARCH = 'SEARCH', SEND = 'SEND', SETTINGS_FILLED = 'SETTINGS_FILLED', SLIDE_LEFT = 'SLIDE_LEFT', SPINNER = 'SPINNER', SUPERGROUP = 'SUPERGROUP', THREAD = 'THREAD', THUMBNAIL_NONE = 'THUMBNAIL_NONE', TOGGLE_OFF = 'TOGGLE_OFF', TOGGLE_ON = 'TOGGLE_ON', USER = 'USER', } export enum IconColors { DEFAULT = 'DEFAULT', PRIMARY = 'PRIMARY', PRIMARY_2 = 'PRIMARY_2', SECONDARY = 'SECONDARY', CONTENT = 'CONTENT', CONTENT_INVERSE = 'CONTENT_INVERSE', WHITE = 'WHITE', GRAY = 'GRAY', THUMBNAIL_ICON = 'THUMBNAIL_ICON', SENT = 'SENT', READ = 'READ', ON_BACKGROUND_1 = 'ON_BACKGROUND_1', ON_BACKGROUND_2 = 'ON_BACKGROUND_2', ON_BACKGROUND_3 = 'ON_BACKGROUND_3', ON_BACKGROUND_4 = 'ON_BACKGROUND_4', BACKGROUND_3 = 'BACKGROUND_3', ERROR = 'ERROR', }
- Usage
import Icon, { IconTypes, IconColors } from '@sendbird/uikit-react/ui/Icon' <Icon type={IconTypes.INFO} fillColor={IconColors.PRIMARY} />
- Add
- ChannelProvider
[v3.6.8] (Sep 1 2023)
[v3.6.8] (Sep 1 2023)
Feats:
- Update
ui/FileViewerto support multiple images- Modify the props structure
export enum ViewerTypes { SINGLE = 'SINGLE', MULTI = 'MULTI', } interface SenderInfo { profileUrl: string; nickname: string; } interface FileInfo { name: string; type: string; url: string; } interface BaseViewer { onClose: (e: React.MouseEvent) => void; } interface SingleFileViewer extends SenderInfo, FileInfo, BaseViewer { viewerType?: typeof ViewerTypes.SINGLE; isByMe?: boolean; disableDelete?: boolean; onDelete: (e: React.MouseEvent) => void; } interface MultiFilesViewer extends SenderInfo, BaseViewer { viewerType: typeof ViewerTypes.MULTI; fileInfoList: FileInfo[]; currentIndex: number; onClickLeft: () => void; onClickRight: () => void; } export type FileViewerComponentProps = SingleFileViewer | MultiFilesViewer;
- Modify the props structure
- Export misc. utils
Channel/utils/getMessagePartsInfoChannel/utils/compareMessagesForGroupingMessage/hooks/useDirtyGetMentionsui/MessageInput/hooks/usePaste
Fixes:
- Apply some props which are related to the
metadatato the ChannelListQuery- Add metadataKey, metadataValues, and metadataStartsWith to the Channel.queries.channelListQuery
- How to use
<Channel or ChannelProvider queries={{ channelListQuery: { metadataKey: 'isMatching', metadataValues: ['true'], } }} />
- Improve types of
ui/FileViewerandChannel/component/FileViewer- Add some props that have been missed
- Fix
<ImageRenderer />not converting number to pixel string - Modify the types on useChannelContext & useThreadContext
useChannelContext.setQuoteMessageshould acceptUserMessage | FileMessageuseThreadContext.sendMessageshould bestring
[v3.6.7] (Aug 11 2023)
Feats:
- Added a new ImageGrid UI component (for internal use only) (#703)
- Introduced
fetchChannelListto theChannelListContext.- Implemented a custom hook function
useFetchChannelList. - Utilized this function to fetch the channel list within the
ChannelListUIcomponent. - Added relevant tests for this function.
- Provided the method through the
ChannelListContext:fetchChannelList.
Example Usage:import SendbirdProvider from '@sendbird/uikit-react/SendbirdProvider' import useSendbirdStateContext from '@sendbird/uikit-react/useSendbirdStateContext' import { ChannelListProvider, useChannelListContext } from '@sendbird/uikit-react/ChannelList/context' const isAboutSame = (a, b, px) => (Math.abs(a - b) <= px); const CustomChannelList = () => { const { allChannels, fetchChannelList, } = useChannelListContext(); return ( <div className="custom-channel-list" onScroll={(e) => { const target = e.target; if (isAboutSame(target.clientHeight + target.scrollTop, target.scrollHeight, 10)) { fetchChannelList(); } }} > {allChannels.map((channel) => { return // custom channel list item })} </div> ); }; const CustomApp = () => { return ( <div className="custom-app"> <SendbirdProvider ... > <ChannelListProvider ... > <CustomChannelList /> </ChannelListProvider> </SendbirdProvider> </div> ); };
- Implemented a custom hook function
Fixes:
- Removed duplicated getEmoji API call from the
useGetChannelhook (#705). - Fixed missing
SEND_MESSAGE_FAILEDevent publishing (#704):- Addressed the failure state in
sendbirdSelectors.getSendUserMessageand published theSEND_MESSAGE_FAILEDevent. - Corrected typo
SEND_MESSAGEGE_FAILURE.
- Addressed the failure state in
Chores:
[v3.6.6] (Aug 4 2023)
Feat:
- Add
customExtensionParamsforsdk.addSendbirdExtensions(#698)
The 3rd parameter customData to thesdk.addSendbirdExtensionfunction, allowing it to be delivered from outside of UIKit React.
e.g.<SendbirdProvider customExtensionParams={{ a: 'a', // the key-value set will be passed when sdk.addSendbirdExtensions is called }} /> - Call
sdk.addSendbirdExtensionsduring the connection process (#682)
Fixes:
- Change the MessageInput cursor style from disabled to not-allowed; Thanks @roderickhsiao (#697)
- PendingMsg is missing isUserMessage method (#695)
This resolves the issue where spreading the message object in the reducer loses some methods likeisUserMessageandisFileMessage - fix util functions logic of verifying message type. We updated logic in util functions to verify the message type. (#700)
Chore:
- Update Trunk-Based Development to Scaled Trunk-Based Development (#696)
It describes the flow with short-lived feature branches, code review, and build automation before integrating into main.
[v3.6.5] (July 21 2023)
Feat:
- Add a new prop
sdkInitParamsthat allows passing custom parameters whensdk.init(params)is called from outside of UIKit.
e.g.
<SendbirdProvider
sdkInitParams={{
appStateToggleEnabled: false,
debugMode: true,
// more options can be found here https://sendbird.com/docs/chat/v4/javascript/ref/interfaces/_sendbird_chat.SendbirdChatParams.html
}}
/>
[v3.6.4] (July 20 2023)
Feat:
- Create a separate package.json for CommonJS (cjs) module during build time. This package.json is located under dist/cjs directory. (#687)
- Add a new prop
isUserIdUsedForNicknameto the public interface. This prop allows using the userId as the nickname. (#683) - Add an option to the ChannelProvider:
reconnectOnIdle(default: true), which prevents data refresh in the background. (#690)
Fixes:
- Fix an issue where the server returns 32 messages even when requesting 31 messages in the Channel. Now, hasMorePrev will not be set to false when the result size is larger than the query. (#688)
- Verify the fetched message list size with the requested size of the MessageListParams. Added a test case for verifying the fetched message list size. (#686)
- Address the incorrect cjs path in package.json. The common js module path in the pacakge.json has been fixed. (#685)
[v3.6.3] (July 6 2023)
Feat:
- Add new scrollBehavior prop to Channel (#676)
The default option is set to "auto," preserving the existing scroll behavior.
Possible to set smooth for smooth scroll effect.
Fixes:
- Move message list scroll when the last message is edited (#674)
Added optional parameters to moveScroll to scroll only when the last message reaches the bottom.
Scroll is now moved only when the updatedAt property of the last message is changed. - Add missing
UIKitConfigto type definition (#677)
Reported by GitHub PR #650.