@@ -9,15 +9,60 @@ import Sendbird from 'sendbird';
99export as namespace SendbirdUIKit ;
1010export const App : React . FunctionComponent < AppProps >
1111export const SendBirdProvider : React . FunctionComponent < SendBirdProviderProps >
12- export const sendBirdSelectors : sendBirdSelectors ;
12+ export const sendBirdSelectors : sendBirdSelectorsInterface ;
1313export const ChannelSettings : React . FunctionComponent < ChannelSettingsProps >
1414export const ChannelList : React . FunctionComponent < ChannelListProps >
1515export const Channel : React . FunctionComponent < ChannelProps >
16- export function withSendBird (
16+ export function withSendBird (
1717 ChildComp : React . Component | React . ElementType ,
1818 mapStoreToProps ?: ( store : SendBirdState ) => unknown
19- ) : ( props : unknown ) => React . ReactNode ;
20-
19+ ) : React . ComponentType < unknown > ;
20+ export type SendBirdState = {
21+ config : SendBirdStateConfig ;
22+ stores : SendBirdStateStore ;
23+ }
24+ export namespace SendBirdSelectors {
25+ type GetSdk = Sendbird . SendBirdInstance | undefined ;
26+ type GetConnect = (
27+ userId : string ,
28+ accessToken ?: string
29+ ) => Promise < Sendbird . User > ;
30+ type GetDisconnect = ( ) => Promise < void > ;
31+ type GetUpdateUserInfo = (
32+ nickName : string ,
33+ profileUrl ?: string
34+ ) => Promise < Sendbird . User > ;
35+ type GetSendUserMessage = (
36+ channelUrl : string ,
37+ userMessageParams : Sendbird . UserMessageParams
38+ ) => Promise < Sendbird . UserMessage > ;
39+ type GetSendFileMessage = (
40+ channelUrl : string ,
41+ fileMessageParams : Sendbird . FileMessageParams
42+ ) => Promise < Sendbird . FileMessage > ;
43+ type GetUpdateUserMessage = (
44+ channelUrl : string ,
45+ messageId : string | number ,
46+ params : Sendbird . UserMessageParams
47+ ) => Promise < Sendbird . UserMessage > ;
48+ type GetDeleteMessage = (
49+ channelUrl : string ,
50+ message : SendBird . AdminMessage | SendBird . UserMessage | SendBird . FileMessage
51+ ) => Promise < void > ;
52+ type GetResendUserMessage = (
53+ channelUrl : string ,
54+ failedMessage : Sendbird . UserMessage
55+ ) => Promise < Sendbird . UserMessage > ;
56+ type GetResendFileMessage = (
57+ channelUrl : string ,
58+ failedMessage : Sendbird . FileMessage
59+ ) => Promise < Sendbird . FileMessage > ;
60+ type GetFreezeChannel = ( channelUrl : string ) => Promise < Sendbird . GroupChannel > ;
61+ type GetUnFreezeChannel = ( channelUrl : string ) => Promise < Sendbird . GroupChannel > ;
62+ type GetCreateChannel = ( channelParams : Sendbird . GroupChannelParams ) => Promise < Sendbird . GroupChannel > ;
63+ type GetLeaveChannel = ( channelUrl : string ) => Promise < Sendbird . GroupChannel > ;
64+ }
65+ export function getStringSet ( lang ?: string ) : { [ label : string ] : string }
2166
2267// to be used with Conversation.renderMessageInput
2368interface RenderMessageInputProps {
@@ -52,10 +97,6 @@ interface SendBirdStateStore {
5297 sdkStore : SdkStore ;
5398 userStore : UserStore ;
5499}
55- interface SendBirdState {
56- config : SendBirdStateConfig ;
57- store : SendBirdStateStore ;
58- }
59100interface RenderUserProfileProps {
60101 user : Sendbird . Member | Sendbird . User ;
61102 currentUserId : string ;
@@ -66,7 +107,7 @@ interface UserListQuery {
66107 next ( callback : unknown ) : void ;
67108}
68109interface SendBirdProviderConfig {
69- logLevel ?: 'debug' | 'warning' | 'error' | 'info' | 'all' | [ string ] ;
110+ logLevel ?: 'debug' | 'warning' | 'error' | 'info' | 'all' | string [ ] ;
70111}
71112interface RenderChannelProfileProps {
72113 channel : Sendbird . GroupChannel ;
@@ -78,9 +119,9 @@ interface RenderUserProfileProps {
78119}
79120interface ApplicationUserListQuery {
80121 limit ?: number ;
81- userIdsFilter ?: [ string ] ;
122+ userIdsFilter ?: string [ ] ;
82123 metaDataKeyFilter ?: string ;
83- metaDataValuesFilter ?: [ string ] ;
124+ metaDataValuesFilter ?: string [ ] ;
84125}
85126interface ChannelSettingsQueries {
86127 applicationUserListQuery ?: ApplicationUserListQuery ;
@@ -89,14 +130,14 @@ interface GroupChannelListQuery {
89130 limit ?: number ;
90131 includeEmpty ?: boolean ;
91132 order ?: 'latest_last_message' | 'chronological' | 'channel_name_alphabetical' | 'metadata_value_alphabetical' ;
92- userIdsExactFilter ?: [ string ] ;
93- userIdsIncludeFilter ?: [ string ] ;
133+ userIdsExactFilter ?: string [ ] ;
134+ userIdsIncludeFilter ?: string [ ] ;
94135 userIdsIncludeFilterQueryType ?: 'AND' | 'OR' ;
95136 nicknameContainsFilter ?: string ;
96137 channelNameContainsFilter ?: string ;
97- customTypesFilter ?: [ string ] ;
138+ customTypesFilter ?: string [ ] ;
98139 customTypeStartsWithFilter ?: string ;
99- channelUrlsFilter ?: [ string ] ;
140+ channelUrlsFilter ?: string [ ] ;
100141 superChannelFilter ?: 'all' | 'super' | 'nonsuper' ;
101142 publicChannelFilter ?: 'all' | 'public' | 'private' ;
102143 metadataOrderKeyFilter ?: string ;
@@ -112,7 +153,7 @@ interface MessageListParams {
112153 shouldReverse ?: boolean ;
113154 messageType ?: string ;
114155 customType ?: string ;
115- senderUserIds ?: [ string ] ;
156+ senderUserIds ?: string [ ] ;
116157 includeMetaArray ?: boolean ;
117158 includeReactions ?: boolean ;
118159 includeReplies ?: boolean ;
@@ -145,7 +186,7 @@ interface RenderChatItemProps {
145186 onDeleteCb : ( ) => void ,
146187 ) ;
147188 onUpdateMessage (
148- messageId : string ,
189+ messageId : string | number ,
149190 text : string ,
150191 onUpdateCb : (
151192 err : Sendbird . SendBirdError ,
@@ -161,7 +202,6 @@ interface RenderChatHeaderProps {
161202 channel : Sendbird . GroupChannel ;
162203 user : Sendbird . User ;
163204}
164-
165205interface SendBirdProviderProps {
166206 userId : string ;
167207 appId : string ;
@@ -175,13 +215,13 @@ interface SendBirdProviderProps {
175215 allowProfileEdit ?: boolean ;
176216 userListQuery ?( ) : UserListQuery ;
177217 config ?: SendBirdProviderConfig ;
218+ stringSet ?: Record < string , string > ;
178219 colorSet ?: Record < string , string > ;
179220}
180-
181221interface ChannelListProps {
182222 disableUserProfile ?: boolean ;
183223 allowProfileEdit ?: boolean ;
184- onBeforeCreateChannel ?( users : [ string ] ) : Sendbird . GroupChannelParams ;
224+ onBeforeCreateChannel ?( users : string [ ] ) : Sendbird . GroupChannelParams ;
185225 onThemeChange ?( theme : string ) : void ;
186226 onProfileEditSuccess ?( user : Sendbird . User ) : void ;
187227 onChannelSelect ?( channel : Sendbird . GroupChannel ) : void ;
@@ -190,7 +230,6 @@ interface ChannelListProps {
190230 renderHeader ?: ( props : void ) => React . ReactNode ;
191231 queries ?: ChannelListQueries ;
192232}
193-
194233interface ChannelProps {
195234 channelUrl : string ;
196235 disableUserProfile ?: boolean ,
@@ -206,50 +245,22 @@ interface ChannelProps {
206245 renderUserProfile ?: ( props : RenderUserProfileProps ) => React . ReactNode ;
207246 queries ?: ChannelQueries ;
208247}
209-
210- interface sendBirdSelectors {
211- getSdk : ( store : SendBirdState ) => Sendbird . SendBirdInstance ;
212- getConnect : ( store : SendBirdState )
213- => ( userId : string , accessToken ?: string )
214- => Promise < Sendbird . User > ;
215- getDisconnect : ( store : SendBirdState ) => ( ) => Promise < void > ;
216- getUpdateUserInfo : ( store : SendBirdState )
217- => ( nickName : string , profileUrl ?: string )
218- => Promise < Sendbird . User > ;
219- getSendUserMessage : ( store : SendBirdState )
220- => ( channelUrl : string , userMessageParams : Sendbird . UserMessageParams )
221- => Promise < Sendbird . UserMessage > ; // promise chain here
222- getSendFileMessage : ( store : SendBirdState )
223- => ( channelUrl : string , fileMessageParams : Sendbird . FileMessageParams )
224- => Promise < Sendbird . FileMessage > ; // promise chain here
225- getUpdateUserMessage : ( store : SendBirdState )
226- => ( channelUrl : string , messageId : string , params : Sendbird . UserMessageParams )
227- => Promise < Sendbird . UserMessage > ;
228- getDeleteMessage : ( store : SendBirdState )
229- => (
230- channelUrl : string ,
231- message : SendBird . AdminMessage | SendBird . UserMessage | SendBird . FileMessage
232- ) => Promise < void > ;
233- getResendUserMessage : ( store : SendBirdState )
234- => ( channelUrl : string , failedMessage : Sendbird . UserMessage )
235- => Promise < Sendbird . UserMessage > ;
236- getResendFileMessage : ( store : SendBirdState )
237- => ( channelUrl : string , failedMessage : Sendbird . FileMessage )
238- => Promise < Sendbird . FileMessage > ;
239- getFreezeChannel : ( store : SendBirdState )
240- => ( channelUrl : string )
241- => Promise < Sendbird . GroupChannel > ;
242- getUnFreezeChannel : ( store : SendBirdState )
243- => ( channelUrl : string )
244- => Promise < Sendbird . GroupChannel > ;
245- getCreateChannel : ( store : SendBirdState )
246- => ( channelParams : Sendbird . GroupChannelParams )
247- => Promise < Sendbird . GroupChannel > ;
248- getLeaveChannel : ( store : SendBirdState )
249- => ( channelUrl : string )
250- => Promise < Sendbird . GroupChannel > ;
248+ interface sendBirdSelectorsInterface {
249+ getSdk : ( store : SendBirdState ) => SendBirdSelectors . GetSdk ;
250+ getConnect : ( store : SendBirdState ) => SendBirdSelectors . GetConnect
251+ getDisconnect : ( store : SendBirdState ) => SendBirdSelectors . GetDisconnect ;
252+ getUpdateUserInfo : ( store : SendBirdState ) => SendBirdSelectors . GetUpdateUserInfo ;
253+ getSendUserMessage : ( store : SendBirdState ) => SendBirdSelectors . GetSendUserMessage ;
254+ getSendFileMessage : ( store : SendBirdState ) => SendBirdSelectors . GetSendFileMessage ;
255+ getUpdateUserMessage : ( store : SendBirdState ) => SendBirdSelectors . GetUpdateUserMessage ;
256+ getDeleteMessage : ( store : SendBirdState ) => SendBirdSelectors . GetDeleteMessage ;
257+ getResendUserMessage : ( store : SendBirdState ) => SendBirdSelectors . GetResendUserMessage ;
258+ getResendFileMessage : ( store : SendBirdState ) => SendBirdSelectors . GetResendFileMessage ;
259+ getFreezeChannel : ( store : SendBirdState ) => SendBirdSelectors . GetFreezeChannel ;
260+ getUnFreezeChannel : ( store : SendBirdState ) => SendBirdSelectors . GetUnFreezeChannel ;
261+ getCreateChannel : ( store : SendBirdState ) => SendBirdSelectors . GetCreateChannel ;
262+ getLeaveChannel : ( store : SendBirdState ) => SendBirdSelectors . GetLeaveChannel ;
251263}
252-
253264interface ChannelSettingsProps {
254265 channelUrl : string ;
255266 disableUserProfile ?: boolean ;
@@ -260,12 +271,11 @@ interface ChannelSettingsProps {
260271 renderUserProfile ?: ( props : RenderUserProfileProps ) => React . ReactNode ;
261272 queries ?: ChannelSettingsQueries ;
262273}
263-
264274interface AppProps {
265275 appId : string ;
266276 userId : string ;
267277 accessToken ?: string ;
268- theme ?: string ;
278+ theme ?: 'light' | 'dark' ;
269279 userListQuery ?( ) : UserListQuery ;
270280 nickname ?: string ;
271281 profileUrl ?: string ;
@@ -276,4 +286,6 @@ interface AppProps {
276286 config ?: SendBirdProviderConfig ;
277287 useReaction ?: boolean ;
278288 useMessageGrouping ?: boolean ;
289+ stringSet ?: Record < string , string > ;
290+ colorSet ?: Record < string , string > ;
279291}
0 commit comments