@@ -27,12 +27,15 @@ import { LocalizationProvider } from './LocalizationContext';
2727import { MediaQueryProvider } from './MediaQueryContext' ;
2828import getStringSet from '../ui/Label/stringSet' ;
2929import { VOICE_RECORDER_DEFAULT_MAX , VOICE_RECORDER_DEFAULT_MIN } from '../utils/consts' ;
30+ import { uikitConfigMapper } from './utils/uikitConfigMapper' ;
31+
3032import { useMarkAsReadScheduler } from './hooks/useMarkAsReadScheduler' ;
3133import { ConfigureSessionTypes } from './hooks/useConnect/types' ;
3234import { useMarkAsDeliveredScheduler } from './hooks/useMarkAsDeliveredScheduler' ;
3335import { getCaseResolvedReplyType , getCaseResolvedThreadReplySelectType } from './utils/resolvedReplyType' ;
3436import { useUnmount } from '../hooks/useUnmount' ;
3537import { disconnectSdk } from './hooks/useConnect/disconnectSdk' ;
38+ import { UIKitOptions , CommonUIKitConfigProps } from './types' ;
3639
3740export type UserListQueryType = {
3841 hasNext ?: boolean ;
@@ -59,17 +62,6 @@ export interface SendbirdConfig {
5962 } ;
6063 isREMUnitEnabled ?: boolean ;
6164}
62-
63- interface CommonUIKitConfigProps {
64- replyType ?: 'NONE' | 'QUOTE_REPLY' | 'THREAD' ;
65- isMentionEnabled ?: boolean ;
66- isReactionEnabled ?: boolean ;
67- disableUserProfile ?: boolean ;
68- isVoiceMessageEnabled ?: boolean ;
69- isTypingIndicatorEnabledOnChannelList ?: boolean ;
70- isMessageReceiptStatusEnabledOnChannelList ?: boolean ;
71- }
72-
7365export interface SendbirdProviderProps extends CommonUIKitConfigProps {
7466 appId : string ;
7567 userId : string ;
@@ -90,46 +82,40 @@ export interface SendbirdProviderProps extends CommonUIKitConfigProps {
9082 imageCompression ?: ImageCompressionOptions ;
9183 allowProfileEdit ?: boolean ;
9284 disableMarkAsDelivered ?: boolean ;
93- showSearchIcon ?: boolean ;
9485 breakpoint ?: string | boolean ;
9586 renderUserProfile ?: ( ) => React . ReactElement ;
9687 onUserProfileMessage ?: ( ) => void ;
88+ uikitOptions ?: UIKitOptions ;
9789}
9890
9991function Sendbird ( props : SendbirdProviderProps ) {
100- const {
101- replyType,
102- isMentionEnabled,
103- isReactionEnabled,
104- disableUserProfile,
105- isVoiceMessageEnabled,
106- isTypingIndicatorEnabledOnChannelList,
107- isMessageReceiptStatusEnabledOnChannelList,
108- showSearchIcon,
109- } = props ;
92+ const localConfigs = uikitConfigMapper ( {
93+ legacyConfig : {
94+ replyType : props . replyType ,
95+ isMentionEnabled : props . isMentionEnabled ,
96+ isReactionEnabled : props . isReactionEnabled ,
97+ disableUserProfile : props . disableUserProfile ,
98+ isVoiceMessageEnabled : props . isVoiceMessageEnabled ,
99+ isTypingIndicatorEnabledOnChannelList :
100+ props . isTypingIndicatorEnabledOnChannelList ,
101+ isMessageReceiptStatusEnabledOnChannelList :
102+ props . isMessageReceiptStatusEnabledOnChannelList ,
103+ showSearchIcon : props . showSearchIcon ,
104+ } ,
105+ uikitOptions : props . uikitOptions ,
106+ } ) ;
110107
111108 return (
112109 < UIKitConfigProvider
113110 localConfigs = { {
114- common : {
115- enableUsingDefaultUserProfile : typeof disableUserProfile === 'boolean'
116- ? ! disableUserProfile
117- : undefined ,
118- } ,
111+ common : localConfigs ?. common ,
119112 groupChannel : {
120- channel : {
121- enableReactions : isReactionEnabled ,
122- enableMention : isMentionEnabled ,
123- enableVoiceMessage : isVoiceMessageEnabled ,
124- replyType : replyType != null ? getCaseResolvedReplyType ( replyType ) . lowerCase : undefined ,
125- } ,
126- channelList : {
127- enableTypingIndicator : isTypingIndicatorEnabledOnChannelList ,
128- enableMessageReceiptStatus : isMessageReceiptStatusEnabledOnChannelList ,
129- } ,
130- setting : {
131- enableMessageSearch : showSearchIcon ,
132- } ,
113+ channel : localConfigs ?. groupChannel ,
114+ channelList : localConfigs ?. groupChannelList ,
115+ setting : localConfigs ?. groupChannelSettings ,
116+ } ,
117+ openChannel : {
118+ channel : localConfigs ?. openChannel ,
133119 } ,
134120 } }
135121 >
0 commit comments