99 Channel as ChannelClass ,
1010 ChannelState ,
1111 Channel as ChannelType ,
12+ DeleteMessageOptions ,
1213 EventHandler ,
1314 LocalMessage ,
1415 localMessageToNewMessagePayload ,
@@ -322,6 +323,7 @@ export type ChannelPropsWithContext = Pick<ChannelContextValue, 'channel'> &
322323 | 'handleBan'
323324 | 'handleCopy'
324325 | 'handleDelete'
326+ | 'handleDeleteForMe'
325327 | 'handleEdit'
326328 | 'handleFlag'
327329 | 'handleMarkUnread'
@@ -580,6 +582,7 @@ const ChannelWithContext = (props: PropsWithChildren<ChannelPropsWithContext>) =
580582 handleBan,
581583 handleCopy,
582584 handleDelete,
585+ handleDeleteForMe,
583586 handleEdit,
584587 handleFlag,
585588 handleMarkUnread,
@@ -1509,7 +1512,15 @@ const ChannelWithContext = (props: PropsWithChildren<ChannelPropsWithContext>) =
15091512 } ) ;
15101513
15111514 const deleteMessage : MessagesContextValue [ 'deleteMessage' ] = useStableCallback (
1512- async ( message , hardDelete = false ) => {
1515+ async ( message , optionsOrHardDelete = false ) => {
1516+ let options : DeleteMessageOptions = { } ;
1517+ if ( typeof optionsOrHardDelete === 'boolean' ) {
1518+ options = optionsOrHardDelete ? { hardDelete : true } : { } ;
1519+ } else if ( optionsOrHardDelete ?. deleteForMe ) {
1520+ options = { deleteForMe : true } ;
1521+ } else if ( optionsOrHardDelete ?. hardDelete ) {
1522+ options = { hardDelete : true } ;
1523+ }
15131524 if ( ! channel . id ) {
15141525 throw new Error ( 'Channel has not been initialized yet' ) ;
15151526 }
@@ -1528,7 +1539,7 @@ const ChannelWithContext = (props: PropsWithChildren<ChannelPropsWithContext>) =
15281539
15291540 threadInstance ?. upsertReplyLocally ( { message : updatedMessage } ) ;
15301541
1531- const data = await client . deleteMessage ( message . id , hardDelete ) ;
1542+ const data = await client . deleteMessage ( message . id , options ) ;
15321543
15331544 if ( data ?. message ) {
15341545 updateMessage ( { ...data . message } ) ;
@@ -1837,6 +1848,7 @@ const ChannelWithContext = (props: PropsWithChildren<ChannelPropsWithContext>) =
18371848 handleBan,
18381849 handleCopy,
18391850 handleDelete,
1851+ handleDeleteForMe,
18401852 handleEdit,
18411853 handleFlag,
18421854 handleMarkUnread,
0 commit comments