99 Channel as ChannelClass ,
1010 ChannelState ,
1111 Channel as ChannelType ,
12+ DeleteMessageOptions ,
1213 EventHandler ,
1314 LocalMessage ,
1415 localMessageToNewMessagePayload ,
@@ -324,6 +325,7 @@ export type ChannelPropsWithContext = Pick<ChannelContextValue, 'channel'> &
324325 | 'handleBan'
325326 | 'handleCopy'
326327 | 'handleDelete'
328+ | 'handleDeleteForMe'
327329 | 'handleEdit'
328330 | 'handleFlag'
329331 | 'handleMarkUnread'
@@ -582,6 +584,7 @@ const ChannelWithContext = (props: PropsWithChildren<ChannelPropsWithContext>) =
582584 handleBan,
583585 handleCopy,
584586 handleDelete,
587+ handleDeleteForMe,
585588 handleEdit,
586589 handleFlag,
587590 handleMarkUnread,
@@ -1515,7 +1518,15 @@ const ChannelWithContext = (props: PropsWithChildren<ChannelPropsWithContext>) =
15151518 } ) ;
15161519
15171520 const deleteMessage : MessagesContextValue [ 'deleteMessage' ] = useStableCallback (
1518- async ( message , hardDelete = false ) => {
1521+ async ( message , optionsOrHardDelete = false ) => {
1522+ let options : DeleteMessageOptions = { } ;
1523+ if ( typeof optionsOrHardDelete === 'boolean' ) {
1524+ options = optionsOrHardDelete ? { hardDelete : true } : { } ;
1525+ } else if ( optionsOrHardDelete ?. deleteForMe ) {
1526+ options = { deleteForMe : true } ;
1527+ } else if ( optionsOrHardDelete ?. hardDelete ) {
1528+ options = { hardDelete : true } ;
1529+ }
15191530 if ( ! channel . id ) {
15201531 throw new Error ( 'Channel has not been initialized yet' ) ;
15211532 }
@@ -1534,7 +1545,7 @@ const ChannelWithContext = (props: PropsWithChildren<ChannelPropsWithContext>) =
15341545
15351546 threadInstance ?. upsertReplyLocally ( { message : updatedMessage } ) ;
15361547
1537- const data = await client . deleteMessage ( message . id , hardDelete ) ;
1548+ const data = await client . deleteMessage ( message . id , options ) ;
15381549
15391550 if ( data ?. message ) {
15401551 updateMessage ( { ...data . message } ) ;
@@ -1845,6 +1856,7 @@ const ChannelWithContext = (props: PropsWithChildren<ChannelPropsWithContext>) =
18451856 handleBan,
18461857 handleCopy,
18471858 handleDelete,
1859+ handleDeleteForMe,
18481860 handleEdit,
18491861 handleFlag,
18501862 handleMarkUnread,
0 commit comments