Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typo in Conversation types #1158

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/lemon-apricots-notice.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@signalwire/js': patch
---

CF SDK: Fix the Conversation types typo
16 changes: 9 additions & 7 deletions packages/js/src/fabric/Conversation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ import type {
SendConversationMessageResult,
GetConversationChatMessageParams,
GetConversationsResult,
CoversationSubscribeCallback,
ConversationSubscribeCallback,
ConversationChatMessagesSubscribeParams,
ConversationChatMessagesSubscribeResult,
GetConversationChatMessageResult,
JoinConversationParams,
JoinConversationResponse,
JoinConversationResult,
CoversationSubscribeResult,
ConversationSubscribeResult,
} from './types'
import { conversationWorker } from './workers'
import { buildPaginatedResult } from '../utils/paginatedResult'
Expand All @@ -40,9 +40,11 @@ interface ConversationOptions {
export class Conversation {
private httpClient: HTTPClient
private wsClient: WSClient
private callbacks = new Set<CoversationSubscribeCallback>()
private chatSubscriptions: Record<string, Set<CoversationSubscribeCallback>> =
{}
private callbacks = new Set<ConversationSubscribeCallback>()
private chatSubscriptions: Record<
string,
Set<ConversationSubscribeCallback>
> = {}

constructor(options: ConversationOptions) {
this.httpClient = options.httpClient
Expand Down Expand Up @@ -253,8 +255,8 @@ export class Conversation {
}

public async subscribe(
callback: CoversationSubscribeCallback
): Promise<CoversationSubscribeResult> {
callback: ConversationSubscribeCallback
): Promise<ConversationSubscribeResult> {
// Connect the websocket client first
await this.wsClient.connect()

Expand Down
9 changes: 5 additions & 4 deletions packages/js/src/fabric/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,20 +256,21 @@ export type GetConversationsResponse = PaginatedResponse<ConversationResponse>

export type GetConversationsResult = PaginatedResult<ConversationContract>

export type CoversationSubscribeCallback = (
export type ConversationSubscribeCallback = (
event: ConversationEventParams
) => unknown

export interface CoversationSubscribeResult {
export interface ConversationSubscribeResult {
unsubscribe: () => void
}

export interface ConversationChatMessagesSubscribeParams {
addressId: string
onMessage: CoversationSubscribeCallback
onMessage: ConversationSubscribeCallback
}

export type ConversationChatMessagesSubscribeResult = CoversationSubscribeResult
export type ConversationChatMessagesSubscribeResult =
ConversationSubscribeResult

export interface JoinConversationParams {
addressId: string
Expand Down
Loading