1- import SendbirdChat , { Emoji , EmojiCategory , EmojiContainer , User } from '@sendbird/chat' ;
2- import { GroupChannel , Member , SendbirdGroupChat , GroupChannelListQuery , GroupChannelListOrder } from '@sendbird/chat/groupChannel' ;
1+ import { Emoji , EmojiCategory , EmojiContainer , User } from '@sendbird/chat' ;
2+ import { GroupChannel , Member , GroupChannelListQuery , GroupChannelListOrder } from '@sendbird/chat/groupChannel' ;
33import {
44 AdminMessage ,
55 BaseMessage ,
@@ -10,7 +10,6 @@ import {
1010 UploadedFileInfo ,
1111 UserMessage ,
1212} from '@sendbird/chat/message' ;
13- import { OpenChannel , SendbirdOpenChat } from '@sendbird/chat/openChannel' ;
1413import { SendableMessage } from '@sendbird/chat/lib/__definition' ;
1514
1615import { getOutgoingMessageState , OutgoingMessageStates } from './exports/getOutgoingMessageState' ;
@@ -217,13 +216,6 @@ const SendingMessageStatus: SendingMessageStatus = {
217216export type CoreMessageType = AdminMessage | UserMessage | FileMessage | MultipleFilesMessage ;
218217export type SendableMessageType = UserMessage | FileMessage | MultipleFilesMessage ;
219218
220- export const isTextuallyNull = ( text : string ) : boolean => {
221- if ( text === '' || text === null ) {
222- return true ;
223- }
224- return false ;
225- } ;
226-
227219export const isMOVType = ( type : string ) : boolean => type === 'video/quicktime' ;
228220/**
229221 * @link : https://sendbird.atlassian.net/browse/SBISSUE-16031?focusedCommentId=270601
@@ -452,15 +444,6 @@ export const getClassName = (classNames: string | Array<string | Array<string>>)
452444 : classNames
453445) ;
454446
455- export const startsWithAtAndEndsWithBraces = ( str : string ) => {
456- const regex = / ^ \{ @ .* \} $ / ;
457- return regex . test ( str ) ;
458- } ;
459-
460- export const removeAtAndBraces = ( str : string ) => {
461- return str . replace ( / ^ \{ @ | } $ / g, '' ) ;
462- } ;
463-
464447export const isReactedBy = ( userId : string , reaction : Reaction ) : boolean => (
465448 reaction . userIds . some ( ( reactorUserId : string ) : boolean => reactorUserId === userId )
466449) ;
@@ -480,33 +463,6 @@ export const getEmojiTooltipString = (reaction: Reaction, userId: string, member
480463 . join ( ', ' ) } ${ you } `) ;
481464} ;
482465
483- // TODO: Use the interface after language tranlsatation of Sendbird.js
484- interface UIKitStore {
485- stores : {
486- sdkStore : {
487- sdk : SendbirdChat | SendbirdOpenChat | SendbirdGroupChat ,
488- } ,
489- userStore : {
490- user : User ,
491- } ,
492- } ,
493- config : {
494- isReactionEnabled : boolean ,
495- htmlTextDirection : HTMLTextDirection ,
496- forceLeftToRightMessageLayout : boolean ,
497- }
498- }
499- export const getCurrentUserId = ( store : UIKitStore ) : string => ( store ?. stores ?. userStore ?. user ?. userId ) ;
500- export const getUseReaction = ( store : UIKitStore , channel : GroupChannel | OpenChannel ) : boolean => {
501- if ( ! store ?. config ?. isReactionEnabled )
502- return false ;
503- if ( ! store ?. stores ?. sdkStore ?. sdk ?. appInfo ?. useReaction )
504- return false ;
505- if ( channel ?. isGroupChannel ( ) )
506- return ! ( ( channel as GroupChannel ) . isBroadcast || ( channel as GroupChannel ) . isSuper ) ;
507- return store ?. config ?. isReactionEnabled ;
508- } ;
509-
510466export function getSuggestedReplies ( message ?: BaseMessage ) : string [ ] {
511467 if ( message ?. extendedMessagePayload && Array . isArray ( message ?. extendedMessagePayload ?. suggested_replies ) ) {
512468 return message . extendedMessagePayload . suggested_replies ;
@@ -515,22 +471,12 @@ export function getSuggestedReplies(message?: BaseMessage): string[] {
515471 }
516472}
517473
518- export const isMessageSentByMe = (
519- userId : string ,
520- message : SendableMessageType ,
521- ) : boolean => (
522- ! ! ( userId && message ?. sender ?. userId && userId === message . sender . userId )
523- ) ;
524-
525474const URL_REG = / ^ ( ( h t t p | h t t p s ) : \/ \/ ) ? ( [ a - z \d - ] + \. ) + [ a - z ] { 2 , } ( \: [ 0 - 9 ] { 1 , 5 } ) ? ( \/ [ - a - z A - Z \d % _ . ~ + & = ] * ) * ( \? [ ; & a - z A - Z \d % _ . ~ + = - ] * ) ? ( # \S * ) ? $ / ;
526475/** @deprecated
527476 * URL detection in a message text will be handled in utils/tokens/tokenize.ts
528477 */
529478export const isUrl = ( text : string ) : boolean => URL_REG . test ( text ) ;
530479
531- const MENTION_TAG_REG = / \@ \{ .* ?\} / i;
532- export const isMentionedText = ( text : string ) : boolean => MENTION_TAG_REG . test ( text ) ;
533-
534480export const truncateString = ( fullStr : string , strLen ?: number ) : string => {
535481 if ( ! strLen ) strLen = 40 ;
536482 if ( fullStr === null || fullStr === undefined ) return '' ;
@@ -897,18 +843,6 @@ export const getChannelsWithUpsertedChannel = (
897843 return sortChannelList ( channels , order ?? GroupChannelListOrder . LATEST_LAST_MESSAGE ) ;
898844} ;
899845
900- export const getMatchedUserIds = ( word : string , users : Array < User > , _template ?: string ) : boolean => {
901- const template = _template || '@' ; // Use global variable
902- // const matchedUserIds = [];
903- // users.map((user) => user?.userId).forEach((userId) => {
904- // if (word.indexOf(`${template}{${userId}}`) > -1) {
905- // matchedUserIds.push(userId);
906- // }
907- // });
908- // return matchedUserIds;
909- return users . map ( ( user ) => user ?. userId ) . some ( ( userId ) => word . indexOf ( `${ template } {${ userId } }` ) > - 1 ) ;
910- } ;
911-
912846export enum StringObjType {
913847 normal = 'normal' ,
914848 mention = 'mention' ,
0 commit comments