File tree Expand file tree Collapse file tree 2 files changed +8
-9
lines changed Expand file tree Collapse file tree 2 files changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -47,9 +47,7 @@ const isConversationChatEventParams = (
47
47
typeof event === 'object' &&
48
48
event !== null &&
49
49
'subtype' in event &&
50
- event . subtype === 'chat' &&
51
- 'user_name' in event &&
52
- 'text' in event
50
+ event . subtype === 'chat'
53
51
)
54
52
}
55
53
@@ -103,7 +101,7 @@ export class Conversation {
103
101
if ( chatCallbacks ?. size ) {
104
102
// the backend includes the user_name if is chat event
105
103
chatCallbacks . forEach ( ( cb ) =>
106
- cb ( event as unknown as ConversationChatEventParams )
104
+ cb ( event )
107
105
)
108
106
}
109
107
}
@@ -180,8 +178,7 @@ export class Conversation {
180
178
await this . httpClient . fetch < GetConversationMessagesResponse > (
181
179
makeQueryParamsUrls ( path , queryParams )
182
180
)
183
-
184
-
181
+
185
182
return buildPaginatedResult < ConversationMessage > (
186
183
body ,
187
184
this . httpClient . fetch
Original file line number Diff line number Diff line change @@ -9,19 +9,21 @@ export interface ConversationMessageEventParams {
9
9
id : string
10
10
kind ?: string
11
11
metadata : Record < string , unknown >
12
- subtype : string
13
- text ? : string
12
+ subtype : 'chat' | 'update'
13
+ text : string | null
14
14
ts : number
15
15
type : string
16
16
from_address_id : string
17
+ user_name : string
17
18
}
18
19
19
20
export type ConversationChatMessageEventParams = Omit <
20
21
ConversationMessageEventParams ,
21
- 'kind' | 'hidden' | 'metadata'
22
+ 'kind'
22
23
> & {
23
24
text : string
24
25
user_name : string
26
+ subtype : 'chat'
25
27
}
26
28
27
29
export interface ConversationMessageEvent extends SwEvent {
You can’t perform that action at this time.
0 commit comments