Skip to content

Releases: sendbird/sendbird-uikit-react

[v3.8.0] (Nov 3 2023)

03 Nov 08:25

Choose a tag to compare

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 DateSeparators and UnreadCount.
  • Exported the initialMessagesFetch callback from the hook to provide more flexibility in UIKit customization.

Fixes:

  • Removed duplicate UserProfileProvider in `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.

[v3.7.0] (Oct 23 2023)

23 Oct 09:45

Choose a tag to compare

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.

  1. App Component
import App from '@sendbird/uikit-react/App'

<App
  ...
  isMultipleFilesMessageEnabled
/>
  1. SendbirdProvider
import { SendbirdProvider } from '@sendbird/uikit-react/SendbirdProvider'

<SendbirdProvider
  ...
  isMultipleFilesMessageEnabled
>
  {...}
</SendbirdProvider>
  1. Channel
import Channel from '@sendbird/uikit-react/Channel';
import { ChannelProvider } from '@sendbird/uikit-react/Channel/context';

<Channel
  ...
  isMultipleFilesMessageEnabled
/>
<ChannelProvider
  ...
  isMultipleFilesMessageEnabled
>
  {...}
</ChannelProvider>
  1. 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 ChannelContext and ThreadContext has been changed little bit.
    • allMessages of the ChannelContext has been divided into allMessages and localMessages
    • allThreadMessages of the ThreadContext has been divided into allThreadMessages and localThreadMessages
    • Each local messages includes pending and failed messages, and the all messages will contain only succeeded messages
    • Please keep in mind, you have to migrate to using the local messages, IF you have used the local messages to draw your custom message components.
  • pubSub has been published
    • publishingModules has 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
    • quoteMessage of ChannelProviderInterface
    • useEditUserProfileProviderContext has been renamed to useEditUserProfileContext
      import { useEditUserProfileProviderContext } from '@sendbird/uikit-react/EditUserProfile/context'
      // to
      import { useEditUserProfileContext } from '@sendbird/uikit-react/EditUserProfile/context'

[v3.6.10] (Oct 11 2023)

11 Oct 08:46

Choose a tag to compare

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)

06 Oct 07:28

Choose a tag to compare

[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/MessageInput component
    interface 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={() => {}}
        />
    • 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={() => {}}
        />
    • 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}
        />
    • 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}
        />

[v3.6.8] (Sep 1 2023)

01 Sep 08:19
907d261

Choose a tag to compare

[v3.6.8] (Sep 1 2023)

Feats:

  • Update ui/FileViewer to 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;
  • Export misc. utils
    • Channel/utils/getMessagePartsInfo
    • Channel/utils/compareMessagesForGrouping
    • Message/hooks/useDirtyGetMentions
    • ui/MessageInput/hooks/usePaste

Fixes:

  • Apply some props which are related to the metadata to 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/FileViewer and Channel/component/FileViewer
    • Add some props that have been missed
  • Fix <ImageRenderer /> not converting number to pixel string
  • Modify the types on useChannelContext & useThreadContext
    • useChannelContext.setQuoteMessage should accept UserMessage | FileMessage
    • useThreadContext.sendMessage should be string

[v3.6.7] (Aug 11 2023)

11 Aug 08:06

Choose a tag to compare

Feats:

  • Added a new ImageGrid UI component (for internal use only) (#703)
  • Introduced fetchChannelList to the ChannelListContext.
    • Implemented a custom hook function useFetchChannelList.
    • Utilized this function to fetch the channel list within the ChannelListUI component.
    • 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>
        );
      };

Fixes:

  • Removed duplicated getEmoji API call from the useGetChannel hook (#705).
  • Fixed missing SEND_MESSAGE_FAILED event publishing (#704):
    • Addressed the failure state in sendbirdSelectors.getSendUserMessage and published the SEND_MESSAGE_FAILED event.
    • Corrected typo SEND_MESSAGEGE_FAILURE.

Chores:

  • Added a troubleshooting guide to the README. (#702)
  • Made minor improvements to the onboarding process. (#701)

[v3.6.6] (Aug 4 2023)

04 Aug 07:53

Choose a tag to compare

Feat:

  • Add customExtensionParams for sdk.addSendbirdExtensions (#698)
    The 3rd parameter customData to the sdk.addSendbirdExtension function, 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.addSendbirdExtensions during 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 like isUserMessage and isFileMessage
  • 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)

21 Jul 06:31

Choose a tag to compare

Feat:

  • Add a new prop sdkInitParams that allows passing custom parameters when sdk.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)

20 Jul 04:46

Choose a tag to compare

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 isUserIdUsedForNickname to 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)

07 Jul 05:19

Choose a tag to compare

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 UIKitConfig to type definition (#677)
    Reported by GitHub PR #650.