@@ -27,12 +27,15 @@ import { LocalizationProvider } from './LocalizationContext';
27
27
import { MediaQueryProvider } from './MediaQueryContext' ;
28
28
import getStringSet from '../ui/Label/stringSet' ;
29
29
import { VOICE_RECORDER_DEFAULT_MAX , VOICE_RECORDER_DEFAULT_MIN } from '../utils/consts' ;
30
+ import { uikitConfigMapper } from './utils/uikitConfigMapper' ;
31
+
30
32
import { useMarkAsReadScheduler } from './hooks/useMarkAsReadScheduler' ;
31
33
import { ConfigureSessionTypes } from './hooks/useConnect/types' ;
32
34
import { useMarkAsDeliveredScheduler } from './hooks/useMarkAsDeliveredScheduler' ;
33
35
import { getCaseResolvedReplyType , getCaseResolvedThreadReplySelectType } from './utils/resolvedReplyType' ;
34
36
import { useUnmount } from '../hooks/useUnmount' ;
35
37
import { disconnectSdk } from './hooks/useConnect/disconnectSdk' ;
38
+ import { UIKitOptions , CommonUIKitConfigProps } from './types' ;
36
39
37
40
export type UserListQueryType = {
38
41
hasNext ?: boolean ;
@@ -59,17 +62,6 @@ export interface SendbirdConfig {
59
62
} ;
60
63
isREMUnitEnabled ?: boolean ;
61
64
}
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
-
73
65
export interface SendbirdProviderProps extends CommonUIKitConfigProps {
74
66
appId : string ;
75
67
userId : string ;
@@ -90,46 +82,40 @@ export interface SendbirdProviderProps extends CommonUIKitConfigProps {
90
82
imageCompression ?: ImageCompressionOptions ;
91
83
allowProfileEdit ?: boolean ;
92
84
disableMarkAsDelivered ?: boolean ;
93
- showSearchIcon ?: boolean ;
94
85
breakpoint ?: string | boolean ;
95
86
renderUserProfile ?: ( ) => React . ReactElement ;
96
87
onUserProfileMessage ?: ( ) => void ;
88
+ uikitOptions ?: UIKitOptions ;
97
89
}
98
90
99
91
function 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
+ } ) ;
110
107
111
108
return (
112
109
< UIKitConfigProvider
113
110
localConfigs = { {
114
- common : {
115
- enableUsingDefaultUserProfile : typeof disableUserProfile === 'boolean'
116
- ? ! disableUserProfile
117
- : undefined ,
118
- } ,
111
+ common : localConfigs ?. common ,
119
112
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 ,
133
119
} ,
134
120
} }
135
121
>
0 commit comments