diff --git a/calls/javascript/migrating-from-legacy-ringing.mdx b/calls/javascript/migrating-from-legacy-ringing.mdx index 4accd28cc..6741e7ada 100644 --- a/calls/javascript/migrating-from-legacy-ringing.mdx +++ b/calls/javascript/migrating-from-legacy-ringing.mdx @@ -12,8 +12,10 @@ This page is the diff. For the full description of the current flow see [Ringing ## Before you start Ringing with the Calls SDK is opt-in on the client: update your app to the APIs below. While some of your users are still on legacy ringing, one dashboard setting lets the two flows call each other; see [While some users are still on legacy ringing](#while-some-users-are-still-on-legacy-ringing). -This page is for apps that use the SDKs directly. If you use the CometChat UI Kit, its -support for this flow comes with a coming UI Kit release; keep legacy ringing until then. +This page is for apps that use the SDKs directly. The web UI Kits ring 1:1 calls on this flow themselves from +React UI Kit 7.4.0 and Angular UI Kit 5.4.0, so if you use one, update the kit instead of following this page. See +How calls ring for the [React UI Kit](/ui-kit/react/call-features#how-calls-ring) and the +[Angular UI Kit](/ui-kit/angular/call-features#how-calls-ring). Earlier kit versions stay on legacy ringing. Web and mobile apps ring each other on this flow when the mobile app also rings with the Calls SDK 5.1 and the Push Notifications SDK 2.0. Calls between an app on legacy ringing and an app on this flow ring once **Connect legacy ringing** is on in the dashboard; see [While some users are still on legacy ringing](#while-some-users-are-still-on-legacy-ringing). @@ -71,7 +73,7 @@ sequenceDiagram ## Step 1: Update dependencies ```bash -npm install @cometchat/calls-sdk-javascript@5.1.0 +npm install @cometchat/calls-sdk-javascript@5.1.1 # @cometchat/chat-sdk-javascript (4.2.1 or later) stays: chat, and incoming calls on the web ``` diff --git a/calls/javascript/ringing.mdx b/calls/javascript/ringing.mdx index add2ee214..04a115ae6 100644 --- a/calls/javascript/ringing.mdx +++ b/calls/javascript/ringing.mdx @@ -68,7 +68,7 @@ The Calls SDK does not report why a ring ended. `endCall` records the status on - HTTPS in production, for camera and microphone access. ```bash -npm install @cometchat/calls-sdk-javascript@5.1.0 @cometchat/chat-sdk-javascript@^4.2.1 +npm install @cometchat/calls-sdk-javascript@5.1.1 @cometchat/chat-sdk-javascript@^4.2.1 ``` ## Start a call diff --git a/calls/javascript/setup.mdx b/calls/javascript/setup.mdx index 18eadee57..f746083f0 100644 --- a/calls/javascript/setup.mdx +++ b/calls/javascript/setup.mdx @@ -15,6 +15,8 @@ If you're using CometChat UI Kits, voice and video calling can be quickly integr ๐Ÿ‘‰ [React UI Kit Calling Integration](/ui-kit/react/calling-integration) +๐Ÿ‘‰ [Angular UI Kit Call Features](/ui-kit/angular/call-features) + Use this Calls SDK directly only if you need custom call UI or advanced control. @@ -27,12 +29,12 @@ Install the CometChat Calls SDK using npm or yarn: ```bash -npm install @cometchat/calls-sdk-javascript@5.1.0 +npm install @cometchat/calls-sdk-javascript@5.1.1 ``` ```bash -yarn add @cometchat/calls-sdk-javascript@5.1.0 +yarn add @cometchat/calls-sdk-javascript@5.1.1 ``` diff --git a/docs.json b/docs.json index 75e48e794..c4a314d8c 100644 --- a/docs.json +++ b/docs.json @@ -551,7 +551,8 @@ "ui-kit/react/guide-custom-text-formatter", "ui-kit/react/guide-search-messages", "ui-kit/react/guide-new-chat-creation", - "ui-kit/react/guide-message-privately" + "ui-kit/react/guide-message-privately", + "ui-kit/react/guide-custom-call-screens" ] }, { @@ -2686,6 +2687,7 @@ "group": "Calls", "pages": [ "ui-kit/angular/components/cometchat-call-buttons", + "ui-kit/angular/components/cometchat-call-host", "ui-kit/angular/components/cometchat-incoming-call", "ui-kit/angular/components/cometchat-outgoing-call", "ui-kit/angular/components/cometchat-call-logs" diff --git a/ui-kit/angular/api-reference/introduction.mdx b/ui-kit/angular/api-reference/introduction.mdx index 56bb29146..5711c9f25 100644 --- a/ui-kit/angular/api-reference/introduction.mdx +++ b/ui-kit/angular/api-reference/introduction.mdx @@ -72,14 +72,15 @@ const uiKitSettings = new UIKitSettingsBuilder() | `subscribePresenceForFriends()` | โ€” | โ€” | Subscribe to presence updates for friends only | | `subscribePresenceForRoles(roles)` | `string[]` | โ€” | Subscribe to presence updates for specific roles | | `setAutoEstablishSocketConnection(auto)` | `boolean` | `true` | Auto-establish WebSocket connection on init | -| `setCallingEnabled(enabled)` | `boolean` | `false` | Enable voice/video calling. When `true`, the Calls SDK is initialized after login and call buttons become visible in MessageHeader, CallButtons, and CallLogs. When `false` (default), call buttons are hidden and the Calls SDK is not initialized | +| `setCallingEnabled(enabled)` | `boolean` | `false` | Enable voice/video calling. When `true`, the Calls SDK is initialized after login and call buttons become visible in MessageHeader, CallButtons, and CallLogs. The Calls SDK reads the logged-in user from the Chat SDK, so the app doesn't log in to it. When `false` (default), call buttons are hidden and the Calls SDK is not initialized | | `setCallAppSettings(settings)` | `any` | โ€” | Custom `CallAppSettings` for the Calls SDK. Built via `CometChatUIKitCalls.CallAppSettingsBuilder`. If not set, the UIKit builds default settings from `appId` and `region` | -| `setStorageMode(mode)` | `CometChat.StorageMode` | `LOCAL` | Storage mode for the SDK | +| `setStorageMode(mode)` | `CometChat.StorageMode` | `LOCAL` | Storage mode for the Chat SDK and the Calls SDK. The kit passes it to the Calls SDK too, unless your `CallAppSettings` sets its own `storageMode` | | `setAdminHost(host)` | `string` | โ€” | Override the admin host URL | | `setClientHost(host)` | `string` | โ€” | Override the client host URL | + - `setCallingEnabled(true)` requires `@cometchat/calls-sdk-javascript` to be installed. Without the Calls SDK package, calling features will not activate even when enabled. + `setCallingEnabled(true)` requires `@cometchat/calls-sdk-javascript` 5.1.1 or later to be installed. Without the Calls SDK package, calling features will not activate even when enabled. On 5.0.x, every 1:1 call fails with the error `CALLS_SDK_UNAVAILABLE`. ## Services diff --git a/ui-kit/angular/call-features.mdx b/ui-kit/angular/call-features.mdx index 3e8ff40a6..4d429b71a 100644 --- a/ui-kit/angular/call-features.mdx +++ b/ui-kit/angular/call-features.mdx @@ -16,9 +16,13 @@ Ensure `CometChatUIKit.init()` has completed and the user is logged in before us Install the Calls SDK: ```bash -npm install @cometchat/calls-sdk-javascript +npm install @cometchat/calls-sdk-javascript@^5.1.1 ``` + +1:1 calls need the Calls SDK 5.1.1 or later. On 5.0.x, every 1:1 call fails with the error `CALLS_SDK_UNAVAILABLE`. + + Then enable calling in your `UIKitSettingsBuilder`: ```typescript @@ -36,6 +40,18 @@ const settings = new UIKitSettingsBuilder() When enabled, [cometchat-call-buttons](/ui-kit/angular/components/cometchat-call-buttons) renders in [cometchat-message-header](/ui-kit/angular/components/cometchat-message-header) and the trailing call button appears in [cometchat-call-logs](/ui-kit/angular/components/cometchat-call-logs). +### Add the incoming call card and the call host + +Put [cometchat-incoming-call](/ui-kit/angular/components/cometchat-incoming-call) and [cometchat-call-host](/ui-kit/angular/components/cometchat-call-host) once in your root component, next to the router outlet, and add `RouterOutlet`, `CometChatIncomingCallComponent` and `CometChatCallHostComponent` to its `imports`: + +```html + + + +``` + +The incoming call card rings for calls to the logged-in user. The call host draws the screens of every call, so a call carries on when the user opens another chat. Without it, the call buttons draw the screens themselves, and a call ends when the call buttons that placed it are destroyed. + ### Custom Call App Settings By default the UIKit builds `CallAppSettings` from your `appId` and `region`. If you need custom configuration (e.g. a different region for the Calls SDK or additional settings), pass your own `CallAppSettings`: @@ -65,6 +81,24 @@ const settings = new UIKitSettingsBuilder() +## How calls ring + +From UI Kit 5.4.0, 1:1 calls ring through the Calls SDK, on its [ringing flow](/calls/javascript/ringing). The kit places, answers, declines and cancels them, so the app writes no ringing code: + +- The caller's screen reads "Calling...", then "Ringing..." once the callee's device rings. +- The callee sees the [cometchat-incoming-call](/ui-kit/angular/components/cometchat-incoming-call) card. When one of the callee's tabs or devices answers or declines, the others stop ringing. +- If nobody answers within 45 seconds, the caller's kit ends the call as unanswered. +- A tab that is already in a call, placing one or showing an incoming call answers a new 1:1 call busy, without showing it. + +Group calls that the kit places don't ring. The kit sends a meeting message to the group, and members join the call from it. + +### The Connect legacy ringing setting + +**Connect legacy ringing**, in the dashboard under **Voice & Video Calls โ†’ Settings**, also sends calls on this flow as legacy call events. Turn it on while some of your users are on apps on legacy ringing, such as an older UI Kit or a mobile app that doesn't ring with the Calls SDK 5.1 and the Push Notifications SDK 2.0; see [While some users are still on legacy ringing](/calls/javascript/migrating-from-legacy-ringing#while-some-users-are-still-on-legacy-ringing). While it's off: + +- An app on legacy ringing that is called keeps ringing after the caller cancels. +- A decline, a cancel or no answer shows on the other side a few seconds late. The kit learns of it by reading the call's status every 3 seconds while the call rings, and from the call's messages once it ends. + ## Features ### Incoming Call diff --git a/ui-kit/angular/components/cometchat-call-buttons.mdx b/ui-kit/angular/components/cometchat-call-buttons.mdx index 9a25620a5..3f08192a6 100644 --- a/ui-kit/angular/components/cometchat-call-buttons.mdx +++ b/ui-kit/angular/components/cometchat-call-buttons.mdx @@ -16,7 +16,7 @@ description: "A standalone Angular component that provides voice and video call | Primary output | `(error)` โ€” call initiation failures | | Prerequisites | `CometChatUIKit.initFromSettings()` resolved **and** `login()` complete before render โ€” see [Integration](/ui-kit/angular/integration) | | Stitching | Bind `[user]`/`[group]`. The message header already renders call buttons, so check before adding a second set. | -| Automatic behaviour | Call initiation and permission prompts are internal | +| Automatic behaviour | Call initiation and permission prompts are internal. 1:1 calls ring through the Calls SDK; group calls send a meeting message. See [How calls ring](/ui-kit/angular/call-features#how-calls-ring) | | Sizing | Fills its container โ€” an ancestor without a resolved height collapses it to 0px | | Full props | See [Properties](#properties) | | Events | See [Events](#events) | @@ -27,7 +27,7 @@ description: "A standalone Angular component that provides voice and video call ## Overview -The CometChatCallButtons component renders voice and video call buttons for initiating calls to a user or group. It delegates call state management and initiation logic to an internal service, and displays the outgoing call overlay and ongoing call screen automatically when a call is in progress. +The CometChatCallButtons component renders voice and video call buttons for initiating calls to a user or group. It delegates call state management and initiation logic to an internal service, and displays the outgoing call overlay and ongoing call screen automatically when a call is in progress. With a [cometchat-call-host](/ui-kit/angular/components/cometchat-call-host) at the root of the app, the host draws those screens instead, so they stay up when this component is destroyed. Without one, destroying the last call buttons that draw the screens ends the call: a ringing call is cancelled, and an answered call is left. ### Key Features @@ -95,7 +95,8 @@ export class CallButtonsDemoComponent { | `onError` | `((error: CometChat.CometChatException) => void) \| null` | `null` | Error callback invoked for any error during call operations. | | `outgoingCallDisableSoundForCalls` | `boolean` | `false` | Disables sound for the outgoing call overlay. Supports global config override. | | `outgoingCallCustomSoundForCalls` | `string` | `''` | Custom sound URL for the outgoing call overlay. Supports global config override. | -| `callSettingsBuilder` | `SessionSettings` | `undefined` | A plain v5 `SessionSettings` object used to override the default call settings in the ongoing call screen. Pass a built `SessionSettings` object โ€” the kit does **not** call `.build()` internally. Follows the three-tier priority: @Input > [GlobalConfig](/ui-kit/angular/customization/global-config) > default. | +| `callSettingsBuilder` | `SessionSettings` | `undefined` | A plain v5 `SessionSettings` object for the call screen. It is laid over the kit's defaults, with `sessionType` from the button pressed. See [Custom Call Settings](#custom-call-settings). Follows the three-tier priority: @Input > [GlobalConfig](/ui-kit/angular/customization/global-config) > default. | +| `hideOverlays` | `boolean` | `false` | When `true`, these buttons don't draw the outgoing and ongoing call screens for the calls they place. A [cometchat-call-host](/ui-kit/angular/components/cometchat-call-host) still draws them. | | `voiceCallButtonView` | `TemplateRef \| null` | `null` | Replaces the default voice call button with a custom template. | | `videoCallButtonView` | `TemplateRef \| null` | `null` | Replaces the default video call button with a custom template. | @@ -137,12 +138,12 @@ cometchat-call-buttons { ### Custom Call Settings -Pass a plain v5 `SessionSettings` object to customize the call UI. Build the object yourself with `.build()` โ€” the kit does **not** call `.build()` internally: +Pass a plain v5 `SessionSettings` object to customize the call screen. It isn't a builder: the kit lays the object over its own defaults, so you set only what you change. ```typescript expandable -import { Component, OnInit } from '@angular/core'; +import { Component } from '@angular/core'; import { CometChat } from '@cometchat/chat-sdk-javascript'; -import { CometChatCalls } from '@cometchat/calls-sdk-javascript'; +import type { SessionSettings } from '@cometchat/calls-sdk-javascript'; import { CometChatCallButtonsComponent } from '@cometchat/chat-uikit-angular'; @Component({ @@ -156,20 +157,19 @@ import { CometChatCallButtonsComponent } from '@cometchat/chat-uikit-angular'; ` }) -export class CustomCallSettingsComponent implements OnInit { +export class CustomCallSettingsComponent { activeUser!: CometChat.User; - customCallSettings: any; - - ngOnInit(): void { - // Build the SessionSettings object yourself โ€” the kit does not call .build(). - this.customCallSettings = new CometChatCalls.CallSettingsBuilder() - .enableDefaultLayout(true) - .setIsAudioOnlyCall(false) - .build(); - } + + customCallSettings: SessionSettings = { + layout: 'SIDEBAR', + startAudioMuted: true, + hideRecordingButton: false, + }; } ``` +The kit lays the object over its own defaults, and `sessionType` comes from the button pressed (voice or video). A 1:1 call's settings are fixed when the call is placed, so a change made while it rings or runs doesn't reach that call; `isPeerCall` is always on for it, so hanging up ends the call for both people. + You can also set `callSettingsBuilder` globally via [GlobalConfig](/ui-kit/angular/customization/global-config) so all call components use the same settings without passing the input to each one. @@ -191,6 +191,7 @@ export class CustomCallSettingsComponent implements OnInit { ## Related Components +- [CometChatCallHost](/ui-kit/angular/components/cometchat-call-host) โ€” Draws the call screens instead of this component, so they outlive it - [CometChatOutgoingCall](/ui-kit/angular/components/cometchat-outgoing-call) โ€” Displayed automatically when a call is initiated - [CometChatOngoingCall](/ui-kit/angular/components/cometchat-outgoing-call) โ€” Displayed automatically when a call is accepted - [CometChatMessageHeader](/ui-kit/angular/components/cometchat-message-header) โ€” Typically hosts the call buttons diff --git a/ui-kit/angular/components/cometchat-call-host.mdx b/ui-kit/angular/components/cometchat-call-host.mdx new file mode 100644 index 000000000..289ed56d9 --- /dev/null +++ b/ui-kit/angular/components/cometchat-call-host.mdx @@ -0,0 +1,71 @@ +--- +title: "Call Host" +description: "A standalone Angular component, placed once at the root of the app, that draws the screens of a call so they stay up when the call buttons that placed it are destroyed" +--- + + + +| Field | Value | +| --- | --- | +| Component | `CometChatCallHostComponent` | +| Package | `@cometchat/chat-uikit-angular` v5.x | +| Import | `import { CometChatCallHostComponent } from "@cometchat/chat-uikit-angular";` | +| Selector | `` โ€” the class name is NOT a valid tag | +| Standalone | Add `CometChatCallHostComponent` to the consuming component's `imports: []` or it renders **nothing**, silently | +| Inputs and outputs | None. The screens take their settings from the call buttons that placed the call | +| Prerequisites | `CometChatUIKit.initFromSettings()` resolved **and** `login()` complete, and calling enabled โ€” see [Call Features](/ui-kit/angular/call-features) | +| Stitching | Mount **once** at the app root, next to `` and `` | +| Automatic behaviour | Draws the outgoing call screen while a 1:1 call rings, and the ongoing call screen once a call is answered or a group call starts | +| Related | [Components overview](/ui-kit/angular/components/components-overview) ยท [LLM index](/ui-kit/angular/llms-angular-v5) | + + + +## Overview + +The CometChatCallHost component draws the screens of a call: the outgoing call screen while a 1:1 call rings, and the ongoing call screen once it is answered or a group call starts. It draws them for calls placed from [cometchat-call-buttons](/ui-kit/angular/components/cometchat-call-buttons) (including the buttons in [cometchat-message-header](/ui-kit/angular/components/cometchat-message-header)) and [cometchat-call-logs](/ui-kit/angular/components/cometchat-call-logs), and for calls answered from [cometchat-incoming-call](/ui-kit/angular/components/cometchat-incoming-call). + +Put one `` at the root of your app. While it is mounted, the call buttons leave the screens to it, so a call carries on when the user opens another chat or leaves the page the call was placed from. + +Without a call host, each call buttons component draws the screens itself, inside the component. When the last call buttons component that draws them is destroyed, the call ends with them: a call that is still ringing is cancelled, and an answered call is left. That way the other person is never left ringing, or talking to nobody, while this user sees no call. + +### Key Features + +- **Screens that outlive the buttons**: A call goes on when the call buttons that placed it are destroyed +- **One place for every call**: Draws the screens of calls from the call buttons, the message header, the call logs and the incoming call card +- **Ringing status**: The outgoing call screen says "Ringing..." once the callee's device rings +- **Settings from the call buttons**: Uses the `callSettingsBuilder`, sound settings and `onError` of the call buttons that placed the call, then the [GlobalConfig](/ui-kit/angular/customization/global-config) + +## Basic Usage + +Add it next to your router outlet, in the root component: + +```typescript expandable +import { Component } from '@angular/core'; +import { RouterOutlet } from '@angular/router'; +import { + CometChatCallHostComponent, + CometChatIncomingCallComponent, +} from '@cometchat/chat-uikit-angular'; + +@Component({ + selector: 'app-root', + standalone: true, + imports: [RouterOutlet, CometChatCallHostComponent, CometChatIncomingCallComponent], + template: ` + + + + `, +}) +export class App {} +``` + + +Mount only one call host. It has no inputs or outputs: the screens it draws take their settings from the call buttons that placed the call. + + +## Related Components + +- [CometChatCallButtons](/ui-kit/angular/components/cometchat-call-buttons) โ€” Places the calls whose screens the host draws +- [CometChatIncomingCall](/ui-kit/angular/components/cometchat-incoming-call) โ€” Answers incoming calls; the host draws the answered call's screen +- [CometChatOutgoingCall](/ui-kit/angular/components/cometchat-outgoing-call) โ€” The outgoing call screen the host draws while a call rings diff --git a/ui-kit/angular/components/cometchat-call-logs.mdx b/ui-kit/angular/components/cometchat-call-logs.mdx index 0d06062cc..3a19ef797 100644 --- a/ui-kit/angular/components/cometchat-call-logs.mdx +++ b/ui-kit/angular/components/cometchat-call-logs.mdx @@ -28,6 +28,8 @@ description: "A comprehensive Angular component for displaying call history with The CometChatCallLogs component displays a paginated, scrollable list of call history records for the logged-in user. Each call log entry shows the other party's avatar and name, the call direction (incoming, outgoing, or missed), the call type (audio or video), and the timestamp. Users can initiate new calls directly from the list and view real-time call overlays for outgoing and ongoing calls. +A call placed from the call logs rings through the Calls SDK, as one placed from the call buttons does; see [How calls ring](/ui-kit/angular/call-features#how-calls-ring). With a [cometchat-call-host](/ui-kit/angular/components/cometchat-call-host) at the root of the app, the host draws the call's screens. Without one, the call logs draw them, and destroying the call logs ends the call: a ringing call is cancelled, and an answered call is left. + The component follows a **Service-based Architecture** where: - **CallLogsService** handles call log fetching, pagination, call initiation, call lifecycle listeners, and state management via Angular signals - **Component** manages UI rendering, template overrides, and user interactions @@ -153,7 +155,7 @@ When `callButtonClicked` has no observers, clicking the trailing call button aut | `callLogRequestBuilder` | `any` | `null` | Custom `CallLogRequestBuilder` from `CometChatCalls`. When provided, overrides the default builder (limit 30, category "call"). | | `callInitiatedDateTimeFormat` | `CalendarObject \| null` | `null` | Custom date format for the call initiation timestamp. Merged with global and default `CalendarObject` formats (component-level wins). | | `showScrollbar` | `boolean` | `false` | Whether to show the scrollbar on the call logs list. | -| `callSettingsBuilder` | `CallSettingsBuilder` | `undefined` | Custom `CallSettingsBuilder` to override the default call settings used in the ongoing call overlay. Follows the three-tier priority: @Input > [GlobalConfig](/ui-kit/angular/customization/global-config) > default. | +| `callSettingsBuilder` | `SessionSettings` | `undefined` | A plain v5 `SessionSettings` object for the calls placed from the call logs. It is laid over the kit's defaults, with `sessionType` from the call's type. See [Custom Call Settings](#custom-call-settings). Follows the three-tier priority: @Input > [GlobalConfig](/ui-kit/angular/customization/global-config) > default. | | `onError` | `((error: CometChat.CometChatException) => void) \| null` | `null` | Error callback invoked when any error occurs during operations such as fetching call logs or initiating calls. | ### Template Properties @@ -320,11 +322,11 @@ export class ActiveCallLogsComponent { ### Custom Call Settings -Override the default `CallSettingsBuilder` used in the ongoing call overlay when a call is initiated from the call logs: +Pass a plain v5 `SessionSettings` object for calls placed from the call logs. It isn't a builder: the kit lays the object over its own defaults, so you set only what you change. ```typescript expandable -import { Component, OnInit } from '@angular/core'; -import { CometChatCalls } from '@cometchat/calls-sdk-javascript'; +import { Component } from '@angular/core'; +import type { SessionSettings } from '@cometchat/calls-sdk-javascript'; import { CometChatCallLogsComponent } from '@cometchat/chat-uikit-angular'; @Component({ @@ -338,14 +340,11 @@ import { CometChatCallLogsComponent } from '@cometchat/chat-uikit-angular'; ` }) -export class CustomCallSettingsLogsComponent implements OnInit { - customCallSettings: any; - - ngOnInit(): void { - this.customCallSettings = new CometChatCalls.CallSettingsBuilder() - .enableDefaultLayout(true) - .setIsAudioOnlyCall(false); - } +export class CustomCallSettingsLogsComponent { + customCallSettings: SessionSettings = { + layout: 'SIDEBAR', + startAudioMuted: true, + }; onCallLogClick(callLog: any): void { console.log('Call log clicked:', callLog); @@ -353,6 +352,8 @@ export class CustomCallSettingsLogsComponent implements OnInit { } ``` +Calls from the call logs are 1:1 calls, so the object is laid over the kit's defaults, and you set only what you change. `sessionType` comes from the call log's type, and the settings are fixed when the call is placed. + You can also set `callSettingsBuilder` globally via [GlobalConfig](/ui-kit/angular/customization/global-config) so all call components use the same settings without passing the input to each one. diff --git a/ui-kit/angular/components/cometchat-incoming-call.mdx b/ui-kit/angular/components/cometchat-incoming-call.mdx index e31d26864..dde317c52 100644 --- a/ui-kit/angular/components/cometchat-incoming-call.mdx +++ b/ui-kit/angular/components/cometchat-incoming-call.mdx @@ -3,6 +3,7 @@ title: "Incoming Call" description: "A standalone Angular component that displays an incoming call notification with accept and decline actions" --- + | Field | Value | @@ -15,8 +16,8 @@ description: "A standalone Angular component that displays an incoming call noti | Standalone | Add `CometChatIncomingCallComponent` to the consuming component's `imports: []` or it renders **nothing**, silently | | Primary output | `(callAccepted)` โ€” emits the accepted call | | Prerequisites | `CometChatUIKit.initFromSettings()` resolved **and** `login()` complete before render โ€” see [Integration](/ui-kit/angular/integration) | -| Stitching | Mount at **app root**, not inside the chat route, or calls stop ringing on every other route. Requires `@cometchat/calls-sdk-javascript` and calling enabled in the dashboard. | -| Automatic behaviour | Ringing, decline and the ongoing-call handoff are internal | +| Stitching | Mount at **app root**, not inside the chat route, or calls stop ringing on every other route. Put [``](/ui-kit/angular/components/cometchat-call-host) next to it. Requires `@cometchat/calls-sdk-javascript` 5.1.1 or later and calling enabled in the dashboard. | +| Automatic behaviour | Ringing through the Calls SDK, decline, the busy reply and the ongoing-call handoff are internal. See [How calls ring](/ui-kit/angular/call-features#how-calls-ring) | | Sizing | Fills its container โ€” an ancestor without a resolved height collapses it to 0px | | Full props | See [Properties](#properties) | | Events | See [Events](#events) | @@ -27,7 +28,9 @@ description: "A standalone Angular component that displays an incoming call noti ## Overview -The CometChatIncomingCall component renders an incoming call notification card when a user receives a voice or video call. It displays the caller's name, avatar, and call type icon using a `CometChatListItem`, along with Accept and Decline buttons. After accepting, it automatically renders the ongoing call screen. +The CometChatIncomingCall component renders an incoming call notification card when a user receives a voice or video call. It displays the caller's name, avatar, and call type icon using a `CometChatListItem`, along with Accept and Decline buttons. After accepting, the ongoing call screen opens: the [call host](/ui-kit/angular/components/cometchat-call-host) draws it, or the card itself when no call host is mounted. + +A 1:1 call rings through the Calls SDK. While the card rings, the kit prepares the call's session, so Accept joins at once. A tab that is already in a call, placing one or showing an incoming call answers a new 1:1 call busy, and the card never shows it. See [How calls ring](/ui-kit/angular/call-features#how-calls-ring). ### Key Features @@ -94,9 +97,9 @@ export class IncomingCallDemoComponent { | `call` | `CometChat.Call \| null` | `null` | The incoming call object. Overrides service state when provided. | | `disableSoundForCalls` | `boolean` | `false` | Disables the incoming call ringtone when `true`. Supports global config override. | | `customSoundForCalls` | `string` | `''` | Custom sound URL for the incoming call ringtone. Supports global config override. | -| `onAccept` | `((call: CometChat.Call) => void) \| null` | `null` | Custom accept handler. Overrides default SDK `CometChat.acceptCall()`. | -| `onDecline` | `((call: CometChat.Call) => void) \| null` | `null` | Custom decline handler. Overrides default SDK `CometChat.rejectCall()`. | -| `onError` | `((error: CometChat.CometChatException) => void) \| null` | `null` | Error callback invoked for any error during sound, accept, or decline. | +| `onAccept` | `((call: CometChat.Call) => void) \| null` | `null` | Custom accept handler, called instead of the kit's answer. See [Custom Accept and Decline](#custom-accept-and-decline). | +| `onDecline` | `((call: CometChat.Call) => void) \| null` | `null` | Custom decline handler, called instead of the kit's decline. See [Custom Accept and Decline](#custom-accept-and-decline). | +| `onError` | `((error: CometChat.CometChatException) => void) \| null` | `null` | Error callback invoked for any error during sound, accept, or decline. Accepting a call that is no longer ringing (the caller just cancelled) reports `CALL_NOT_RINGING`, and nothing joins. | | `itemView` | `TemplateRef<{ $implicit: IncomingCallTemplateContext }> \| null` | `null` | Replaces the entire ListItem with a custom template. | | `titleView` | `TemplateRef<{ $implicit: IncomingCallTemplateContext }> \| null` | `null` | Replaces the default caller name title in the ListItem. | | `subtitleView` | `TemplateRef<{ $implicit: IncomingCallTemplateContext }> \| null` | `null` | Replaces the default call type icon and "Incoming Call" subtitle. | @@ -111,7 +114,58 @@ export class IncomingCallDemoComponent { |-------|-------------|-------------| | `callAccepted` | `CometChat.Call` | Emitted when the user accepts the incoming call. | | `callDeclined` | `CometChat.Call` | Emitted when the user declines the incoming call. | -| `error` | `CometChat.CometChatException` | Emitted on any error during sound playback, accept, or decline. | +| `error` | `CometChat.CometChatException` | Emitted on any error during sound playback, accept, or decline, including `CALL_NOT_RINGING` when the call stopped ringing before Accept. | + +## Custom Accept and Decline + +`onAccept` and `onDecline` run instead of the kit's own answer and decline: + +- **`onAccept`, for a 1:1 call:** the kit stops ringing and keeps the session it prepared while the call rang. Your handler joins it with `CometChatCalls.getActiveSession()?.join(container)`; see [Join the session](/calls/javascript/ringing#join-the-session). The kit doesn't read the call's status before you join, so a call the caller has just cancelled can still be joined. +- **`onDecline`, for a 1:1 call:** the kit still leaves the session it prepared. Nothing declines the call, but leaving the prepared session closes a 1:1 call's room, so the call ends for the caller and the user's other devices too, recorded as unanswered. +- **For a call from an app on legacy ringing**, they replace `CometChat.acceptCall()` and `CometChat.rejectCall()`, as before. + +Either way, the card stays up until your app closes it with `IncomingCallService.setIncomingCall(null)`. Until then, later 1:1 calls are answered busy. + +```typescript expandable +import { Component, ElementRef, ViewChild, inject } from '@angular/core'; +import { CometChat } from '@cometchat/chat-sdk-javascript'; +import { CometChatCalls } from '@cometchat/calls-sdk-javascript'; +import { CometChatIncomingCallComponent, IncomingCallService } from '@cometchat/chat-uikit-angular'; + +@Component({ + selector: 'app-custom-incoming-call', + standalone: true, + imports: [CometChatIncomingCallComponent], + template: ` + +
+ ` +}) +export class CustomIncomingCallComponent { + @ViewChild('callContainer') callContainer!: ElementRef; + private incomingCallService = inject(IncomingCallService); + + accept = (call: CometChat.Call): void => { + // Close the card, or later calls are answered busy. + this.incomingCallService.setIncomingCall(null); + // Join the session the kit prepared while the call rang. + void CometChatCalls.getActiveSession()?.join(this.callContainer.nativeElement); + }; +} +``` + + +**Coming from 5.3 or earlier?** `onAccept` used to receive a call still to be answered, so apps answered it before joining: + +```typescript +// Up to 5.3 +accept = (call: CometChat.Call): void => { + CometChat.acceptCall(call.getSessionId()).then((accepted) => this.startCall(accepted)); +}; +``` + +From 5.4, joining the session the kit prepared answers the call. Remove the `CometChat.acceptCall` call and join the session, as in the example above. A call from an app still on legacy ringing arrives unanswered, as before. + ## Customization @@ -130,23 +184,32 @@ cometchat-incoming-call { ### Custom Templates ```html expandable - - - {{ ctx.callType === 'video' ? '๐Ÿ“น Video Call' : '๐Ÿ“ž Audio Call' }} - - + - ``` +A custom Accept or Decline button replaces the card's own, so its handler answers the call itself. Answer through `IncomingCallService`, which answers a 1:1 call on the Calls SDK as the card's own button does: + +```typescript +import { inject } from '@angular/core'; +import { CometChat } from '@cometchat/chat-sdk-javascript'; +import { IncomingCallService } from '@cometchat/chat-uikit-angular'; + +// In the component whose template holds the card: +private incomingCallService = inject(IncomingCallService); + +acceptCall(call: CometChat.Call): void { + this.incomingCallService.acceptCall(call.getSessionId()).catch(error => console.error(error)); +} +``` + +`IncomingCallService.declineCall(sessionId)` declines the same way. + ## Accessibility ### Keyboard Navigation @@ -174,4 +237,5 @@ cometchat-incoming-call { - [CometChatOngoingCall](/ui-kit/angular/components/cometchat-outgoing-call) โ€” Rendered automatically after accepting a call - [CometChatCallButtons](/ui-kit/angular/components/cometchat-call-buttons) โ€” Initiates outgoing calls +- [CometChatCallHost](/ui-kit/angular/components/cometchat-call-host) โ€” Draws the answered call's screen - [CometChatListItem](/ui-kit/angular/components/cometchat-user-item) โ€” Used internally to render the caller information diff --git a/ui-kit/angular/components/cometchat-message-header.mdx b/ui-kit/angular/components/cometchat-message-header.mdx index 4b4936c4b..e4eed7aaf 100644 --- a/ui-kit/angular/components/cometchat-message-header.mdx +++ b/ui-kit/angular/components/cometchat-message-header.mdx @@ -160,7 +160,7 @@ export class GroupChatComponent { | `showSearchOption` | `boolean` | `false` | Show the search option in the header | | `showConversationSummaryButton` | `boolean` | `false` | Show the AI conversation summary button | | `showPinnedMessagesOption` | `boolean` | `false` | Add a "Pinned messages" entry to the overflow menu. The header only asks for the panel โ€” the host opens it. See [Pinned Messages](#pinned-messages) | -| `callSettingsBuilder` | `CallSettingsBuilder` | `undefined` | Custom `CallSettingsBuilder` forwarded to the call buttons and ongoing call screen. Follows the three-tier priority: @Input > [GlobalConfig](/ui-kit/angular/customization/global-config) > default. | +| `callSettingsBuilder` | `SessionSettings` | `undefined` | A plain v5 `SessionSettings` object, forwarded to the call buttons. It is laid over the kit's defaults, with `sessionType` from the button pressed. See [Custom Call Settings](#custom-call-settings). Follows the three-tier priority: @Input > [GlobalConfig](/ui-kit/angular/customization/global-config) > default. | ### AI Configuration Properties @@ -397,12 +397,12 @@ When both search and summary options are enabled, they appear in an overflow men ### Custom Call Settings -Override the default `CallSettingsBuilder` used when calls are initiated from the message header: +Pass a plain v5 `SessionSettings` object for calls placed from the message header. It isn't a builder: the kit lays the object over its own defaults, so you set only what you change. ```typescript expandable -import { Component, OnInit } from '@angular/core'; +import { Component } from '@angular/core'; import { CometChat } from '@cometchat/chat-sdk-javascript'; -import { CometChatCalls } from '@cometchat/calls-sdk-javascript'; +import type { SessionSettings } from '@cometchat/calls-sdk-javascript'; import { CometChatMessageHeaderComponent } from '@cometchat/chat-uikit-angular'; @Component({ @@ -416,18 +416,18 @@ import { CometChatMessageHeaderComponent } from '@cometchat/chat-uikit-angular'; ` }) -export class CustomCallHeaderComponent implements OnInit { +export class CustomCallHeaderComponent { selectedUser!: CometChat.User; - customCallSettings: any; - ngOnInit(): void { - this.customCallSettings = new CometChatCalls.CallSettingsBuilder() - .enableDefaultLayout(true) - .setIsAudioOnlyCall(false); - } + customCallSettings: SessionSettings = { + layout: 'SIDEBAR', + startAudioMuted: true, + }; } ``` +For every call, the object is laid over the kit's defaults, so set only what you want to change. A 1:1 call's settings are fixed when the call is placed. See [Custom Call Settings](/ui-kit/angular/components/cometchat-call-buttons#custom-call-settings) on the call buttons page. + You can also set `callSettingsBuilder` globally via [GlobalConfig](/ui-kit/angular/customization/global-config) so all call components use the same settings without passing the input to each one. diff --git a/ui-kit/angular/components/cometchat-outgoing-call.mdx b/ui-kit/angular/components/cometchat-outgoing-call.mdx index 1369204c0..b688aa7cb 100644 --- a/ui-kit/angular/components/cometchat-outgoing-call.mdx +++ b/ui-kit/angular/components/cometchat-outgoing-call.mdx @@ -27,6 +27,8 @@ description: "A standalone Angular component that displays an outgoing call over The CometChatOutgoingCall component renders a full-screen outgoing call overlay when a user initiates a voice or video call. It displays the receiver's name, a "Calling..." subtitle, the receiver's avatar, and a cancel button. The component plays an outgoing ringtone and provides focus-trapped dialog behavior. +1:1 calls ring through the Calls SDK. In the screens the kit draws (from [cometchat-call-buttons](/ui-kit/angular/components/cometchat-call-buttons), [cometchat-call-logs](/ui-kit/angular/components/cometchat-call-logs) and [cometchat-call-host](/ui-kit/angular/components/cometchat-call-host)), the subtitle changes to "Ringing..." once the callee's device rings. Used on its own, the component shows "Calling..." unless you pass `subtitleView`. See [How calls ring](/ui-kit/angular/call-features#how-calls-ring). + ### Key Features - **Receiver Information**: Displays receiver name and avatar for both user and group calls @@ -53,41 +55,11 @@ The CometChatOutgoingCall component renders a full-screen outgoing call overlay ## Basic Usage - - When `` is used **standalone**, it is purely presentational. Its default cancel action only stops the local ringtone and emits `(callCanceled)` โ€” it does **not** call the Chat SDK cancellation API. Your `(callCanceled)` handler must cancel the outgoing call itself via the Chat SDK (see the example below). - - When the component is rendered inside ``, the buttons component performs the SDK cancellation for you, so you should **not** cancel the call again in your own handler. - - -```typescript expandable -import { Component } from '@angular/core'; -import { CometChat } from '@cometchat/chat-sdk-javascript'; -import { CometChatOutgoingCallComponent } from '@cometchat/chat-uikit-angular'; - -@Component({ - selector: 'app-outgoing-call-demo', - standalone: true, - imports: [CometChatOutgoingCallComponent], - template: ` - - ` -}) -export class OutgoingCallDemoComponent { - outgoingCall!: CometChat.Call; - - // Standalone usage: the component does not cancel the call for you. - // Your handler must reject/cancel the call through the Chat SDK. - async onCallCanceled(): Promise { - const sessionId = this.outgoingCall?.getSessionId(); - if (sessionId) { - await CometChat.rejectCall(sessionId, CometChat.CALL_STATUS.CANCELLED); - } - } -} -``` + + You don't add this component yourself for the calls the kit places. [cometchat-call-buttons](/ui-kit/angular/components/cometchat-call-buttons), [cometchat-call-logs](/ui-kit/angular/components/cometchat-call-logs) and [cometchat-call-host](/ui-kit/angular/components/cometchat-call-host) draw it while a 1:1 call rings, cancel the call from its cancel button, and open the call once it's answered. To restyle that screen, use the [CSS variables](#css-variable-overrides) below. + + Drawn on its own, the component only shows the screen. Its cancel button stops the ringtone and emits `(callCanceled)`: cancelling the call, as [Cancel a call](/calls/javascript/ringing#cancel-a-call) describes, and opening it once it's answered are up to your app. + ## Properties @@ -98,7 +70,7 @@ export class OutgoingCallDemoComponent { | `customSoundForCalls` | `string` | `''` | Custom sound URL for the outgoing call ringtone. Supports global config override. | | `onError` | `((error: CometChat.CometChatException) => void) \| null` | `null` | Error callback invoked for any error during sound or cancel. | | `titleView` | `TemplateRef<{ $implicit: OutgoingCallTemplateContext }> \| null` | `null` | Replaces the default receiver name title. | -| `subtitleView` | `TemplateRef<{ $implicit: OutgoingCallTemplateContext }> \| null` | `null` | Replaces the default "Calling..." subtitle. | +| `subtitleView` | `TemplateRef<{ $implicit: OutgoingCallTemplateContext }> \| null` | `null` | Replaces the default "Calling..." subtitle. The screens the kit draws pass one that reads "Ringing..." once the callee's device rings. | | `avatarView` | `TemplateRef<{ $implicit: OutgoingCallTemplateContext }> \| null` | `null` | Replaces the default CometChatAvatar. | | `cancelButtonView` | `TemplateRef<{ $implicit: OutgoingCallTemplateContext }> \| null` | `null` | Replaces the default cancel button. | diff --git a/ui-kit/angular/components/components-overview.mdx b/ui-kit/angular/components/components-overview.mdx index 2d72bc7db..7cc203415 100644 --- a/ui-kit/angular/components/components-overview.mdx +++ b/ui-kit/angular/components/components-overview.mdx @@ -169,6 +169,7 @@ All components are imported from `@cometchat/chat-uikit-angular`. | Component | Purpose | Key Inputs | Page | | --- | --- | --- | --- | | cometchat-call-buttons | Voice and video call initiation buttons | `user`, `group` | [Call Buttons](/ui-kit/angular/components/cometchat-call-buttons) | +| cometchat-call-host | Draws the screens of every call, once at the app root | *(none)* | [Call Host](/ui-kit/angular/components/cometchat-call-host) | | cometchat-incoming-call | Incoming call notification with accept/decline | `call` | [Incoming Call](/ui-kit/angular/components/cometchat-incoming-call) | | cometchat-outgoing-call | Outgoing call screen with cancel control | `call` | [Outgoing Call](/ui-kit/angular/components/cometchat-outgoing-call) | | cometchat-call-logs | Scrollable list of call history | `callLogsRequestBuilder` | [Call Logs](/ui-kit/angular/components/cometchat-call-logs) | diff --git a/ui-kit/angular/customization/global-config.mdx b/ui-kit/angular/customization/global-config.mdx index b6d983a58..4ce1b7ade 100644 --- a/ui-kit/angular/customization/global-config.mdx +++ b/ui-kit/angular/customization/global-config.mdx @@ -108,7 +108,7 @@ import { COMETCHAT_GLOBAL_CONFIG } from '@cometchat/chat-uikit-angular'; | `hideAvatar` | `boolean` | `undefined` | Hide avatar across components | | `enablePinMessage` | `boolean` | `undefined` | Force the Pin Message surfaces on or off, overriding the app-level flag the Chat SDK reports | | `enableSaveMessage` | `boolean` | `undefined` | Force the Save Message surfaces on or off, overriding the app-level flag the Chat SDK reports | -| `callSettingsBuilder` | `CallSettingsBuilder` | `undefined` | Custom `CallSettingsBuilder` for call components (call buttons, call logs, ongoing call) | +| `callSettingsBuilder` | `SessionSettings` | `undefined` | A plain v5 `SessionSettings` object for the call screens (call buttons, message header, call logs, incoming calls). See [Call Settings Customization](#call-settings-customization) | All properties are optional. When a property is `undefined` (not set), the component falls back to its own internal default. @@ -140,17 +140,25 @@ See the [Pin and Save guide](/ui-kit/angular/guides/pin-and-save-messages). ## Call Settings Customization -The `callSettingsBuilder` property lets you provide a custom `CometChatCalls.CallSettingsBuilder` that is used across all call-related components. This is useful for configuring call UI features like layout, recording, analytics, or audio-only mode globally. +The `callSettingsBuilder` property takes a plain v5 `SessionSettings` object that is used across all call-related components. It isn't a builder: the kit lays the object over its own defaults, so you set only what you change. This is useful for configuring call UI features like the layout, muted audio at the start, or the recording button globally. + +- `sessionType` comes from the call (voice or video), whatever the object says. +- A 1:1 call's settings are fixed when the call is placed or starts ringing, so a change made while it rings or runs doesn't reach that call. `isPeerCall` is always on for it, so hanging up ends the call for both people. ### Global Call Settings +Add the provider to the `providers` already in your `app.config.ts`, next to `provideRouter`; replacing the file drops the router. + ```typescript expandable -import { CometChatCalls } from '@cometchat/calls-sdk-javascript'; +import { ApplicationConfig } from '@angular/core'; +import type { SessionSettings } from '@cometchat/calls-sdk-javascript'; import { COMETCHAT_GLOBAL_CONFIG } from '@cometchat/chat-uikit-angular'; -const customCallSettings = new CometChatCalls.CallSettingsBuilder() - .enableDefaultLayout(true) - .setIsAudioOnlyCall(false); +const customCallSettings: SessionSettings = { + layout: 'SIDEBAR', + startAudioMuted: true, + hideRecordingButton: false, +}; export const appConfig: ApplicationConfig = { providers: [ @@ -185,10 +193,11 @@ Even with a global `callSettingsBuilder`, you can override it on individual comp | Component | Behavior | |-----------|----------| -| [CometChatOngoingCall](/ui-kit/angular/components/cometchat-outgoing-call) | Accepts `callSettingsBuilder` as `@Input`. Passes it to `OngoingCallService`. | -| [CometChatCallButtons](/ui-kit/angular/components/cometchat-call-buttons) | Accepts `callSettingsBuilder` as `@Input`. Forwards to `CometChatOngoingCall`. | +| [CometChatOngoingCall](/ui-kit/angular/components/cometchat-outgoing-call) | Accepts `callSettingsBuilder` as `@Input`, else uses `GlobalConfig.callSettingsBuilder`. | +| [CometChatCallButtons](/ui-kit/angular/components/cometchat-call-buttons) | Accepts `callSettingsBuilder` as `@Input`. Uses it for the 1:1 calls it places, and forwards it to `CometChatOngoingCall` for group calls. | | [CometChatMessageHeader](/ui-kit/angular/components/cometchat-message-header) | Accepts `callSettingsBuilder` as `@Input`. Forwards to `CometChatCallButtons`. | -| [CometChatCallLogs](/ui-kit/angular/components/cometchat-call-logs) | Accepts `callSettingsBuilder` as `@Input`. Uses it in the ongoing call overlay. | +| [CometChatCallLogs](/ui-kit/angular/components/cometchat-call-logs) | Accepts `callSettingsBuilder` as `@Input`. Uses it for the calls placed from the logs. | +| [CometChatIncomingCall](/ui-kit/angular/components/cometchat-incoming-call) | No input. Uses `GlobalConfig.callSettingsBuilder` for the calls it answers. | ## Components That Read GlobalConfig @@ -206,18 +215,19 @@ The following components read from `COMETCHAT_GLOBAL_CONFIG` and apply the three | CometChatGroups | `hideGroupType`, `showScrollbar`, `showSearchBar`, `hideAvatar`, `disableDefaultContextMenu` | | CometChatGroupMembers | `hideUserStatus`, `showScrollbar`, `showSearchBar`, `hideAvatar`, `disableDefaultContextMenu` | | CometChatOutgoingCall | `disableSoundForCalls`, `customSoundForCalls` | -| CometChatIncomingCall | `disableSoundForCalls`, `customSoundForCalls` | +| CometChatIncomingCall | `disableSoundForCalls`, `customSoundForCalls`, `callSettingsBuilder` | ## Full Example ```typescript expandable import { ApplicationConfig } from '@angular/core'; -import { CometChatCalls } from '@cometchat/calls-sdk-javascript'; +import type { SessionSettings } from '@cometchat/calls-sdk-javascript'; import { COMETCHAT_GLOBAL_CONFIG, GlobalConfig } from '@cometchat/chat-uikit-angular'; -const callSettings = new CometChatCalls.CallSettingsBuilder() - .enableDefaultLayout(true) - .setIsAudioOnlyCall(false); +const callSettings: SessionSettings = { + layout: 'SIDEBAR', + startAudioMuted: true, +}; export const appConfig: ApplicationConfig = { providers: [ @@ -237,8 +247,6 @@ export const appConfig: ApplicationConfig = { disableSoundForCalls: false, // Calls - hideVoiceCallButton: false, - hideVideoCallButton: false, callSettingsBuilder: callSettings, // Context menu diff --git a/ui-kit/angular/integration.mdx b/ui-kit/angular/integration.mdx index 5522e1c0a..37b2c8705 100644 --- a/ui-kit/angular/integration.mdx +++ b/ui-kit/angular/integration.mdx @@ -4,19 +4,20 @@ sidebarTitle: "Integration" description: "Add CometChat to an Angular app in 6 steps: create project, install, init, login, add CSS, render." --- + | Field | Value | | --- | --- | | Package | `@cometchat/chat-uikit-angular` v5 | | Angular | 18โ€“22 (`@angular/core` / `@angular/common` `>=18.0.0 <23.0.0`, UI Kit 5.3.0 and later). UI Kit 5.2.x supports up to Angular 21 | -| Peer deps | `@cometchat/chat-sdk-javascript` ^4.2.0, `@cometchat/cards-angular` ^1.0.0, `dompurify` ^3.4.17; optional `@cometchat/calls-sdk-javascript` ^5.0.3 (calling only) | +| Peer deps | `@cometchat/chat-sdk-javascript` ^4.2.1, `@cometchat/cards-angular` ^1.0.0, `dompurify` ^3.4.17; optional `@cometchat/calls-sdk-javascript` ^5.1.1 (calling only) | | Init | `CometChatUIKit.init(UIKitSettings)` โ€” must resolve before `login()` | | Login | `CometChatUIKit.login("UID")` โ€” must resolve before rendering components | | Order | `init()` โ†’ `login()` โ†’ render. Breaking this order = blank screen | | Auth Key | Dev/testing only. Use Auth Token in production | | CSS | Add `node_modules/@cometchat/chat-uikit-angular/styles/css-variables.css` to the `angular.json` styles array, or `@import '../node_modules/@cometchat/chat-uikit-angular/styles/css-variables.css';` in `src/styles.css` (the package `exports` map has no `./styles` entry, so a bare package specifier does not resolve) | -| Calling | Optional. Install `@cometchat/calls-sdk-javascript` and call `.setCallingEnabled(true)` on the builder to enable | +| Calling | Optional. Install `@cometchat/calls-sdk-javascript` 5.1.1 or later and call `.setCallingEnabled(true)` on the builder to enable | @@ -72,12 +73,14 @@ yarn add @cometchat/chat-uikit-angular @cometchat/chat-sdk-javascript @cometchat `@cometchat/chat-sdk-javascript`, `@cometchat/cards-angular` and `dompurify` are required peer dependencies of the UI Kit. Install them explicitly as shown โ€” yarn and older npm versions don't add peer dependencies for you. Don't use `--legacy-peer-deps`: an `ERESOLVE` here almost always means the Angular major is outside 18โ€“22 (18โ€“21 for UI Kit 5.2.x). -If you want voice/video calling, also install: +If you want voice/video calling, also install the Calls SDK, 5.1.1 or later: ```bash -npm install @cometchat/calls-sdk-javascript +npm install @cometchat/calls-sdk-javascript@^5.1.1 ``` +On 5.0.x, every 1:1 call fails with the error `CALLS_SDK_UNAVAILABLE`. See [Call Features](/ui-kit/angular/call-features). + --- ## Step 3 โ€” Initialize CometChat diff --git a/ui-kit/angular/llms-angular-v5.mdx b/ui-kit/angular/llms-angular-v5.mdx index 11422b874..28bf47861 100644 --- a/ui-kit/angular/llms-angular-v5.mdx +++ b/ui-kit/angular/llms-angular-v5.mdx @@ -114,6 +114,7 @@ exhaustive inputs, long-tail components, theming tokens, or feature enablement. ## Components โ€” calling - [Call Features](/ui-kit/angular/call-features) - [Call Buttons](/ui-kit/angular/components/cometchat-call-buttons) +- [Call Host](/ui-kit/angular/components/cometchat-call-host) - [Call Logs](/ui-kit/angular/components/cometchat-call-logs) - [Incoming Call](/ui-kit/angular/components/cometchat-incoming-call) - [Outgoing Call](/ui-kit/angular/components/cometchat-outgoing-call) diff --git a/ui-kit/angular/methods.mdx b/ui-kit/angular/methods.mdx index 58e6c9a21..303c9baca 100644 --- a/ui-kit/angular/methods.mdx +++ b/ui-kit/angular/methods.mdx @@ -29,7 +29,7 @@ Auth Key is for development/testing only. In production, generate Auth Tokens on | `setAutoEstablishSocketConnection(autoEstablish)` | `boolean` | Control whether the WebSocket connects automatically on init | | `setAdminHost(adminHost)` | `string` | Override the admin API host (custom/on-premise deployments) | | `setClientHost(clientHost)` | `string` | Override the client API host (custom/on-premise deployments) | -| `setStorageMode(storageMode)` | `CometChat.StorageMode` | Set the storage mode for SDK data persistence | +| `setStorageMode(storageMode)` | `CometChat.StorageMode` | Set the storage mode for SDK data persistence. With calling enabled, the kit passes it to the Calls SDK too, unless your `CallAppSettings` sets its own `storageMode` | | `setOfflineConfig(config)` | `CometChatOfflineConfig` | Turn on offline support: cached chats and messages, and queued sends. Off unless `config.enabled` is `true`. Needs UI Kit 5.3.0+ and Chat SDK 4.3.1+. See [Offline Support](#offline-support) | | `build()` | โ€” | Returns the configured `UIKitSettings` instance | @@ -172,6 +172,8 @@ CometChatUIKit.getLoggedinUser() Ends the current user session. +With calling enabled, a call ends first, while the Calls SDK still knows the user: a call this user is placing is cancelled, a call they are in is left, and a call ringing for them stops ringing here. Stopping the ring leaves the session the kit prepared for it, which ends a 1:1 call for the caller too, recorded as unanswered. The kit waits at most 3 seconds for this, then logs out of the Chat SDK, then out of the Calls SDK. + ```typescript import { CometChatUIKit } from '@cometchat/chat-uikit-angular'; diff --git a/ui-kit/angular/quickstart.mdx b/ui-kit/angular/quickstart.mdx index 084af9445..2663083b4 100644 --- a/ui-kit/angular/quickstart.mdx +++ b/ui-kit/angular/quickstart.mdx @@ -117,8 +117,9 @@ CometChatUIKit.init(uiKitSettings) console.error('CometChat UIKit initialization failed:', error); }); ``` + - To enable voice and video calling, install `@cometchat/calls-sdk-javascript` and add `.setCallingEnabled(true)` to the builder. Without this, call buttons are hidden across all components. See [Call Features](/ui-kit/angular/call-features) for details. + To enable voice and video calling, install `@cometchat/calls-sdk-javascript` 5.1.1 or later and add `.setCallingEnabled(true)` to the builder. Without this, call buttons are hidden across all components. See [Call Features](/ui-kit/angular/call-features) for details. Offline support is off by default. To turn it on, add `.setOfflineConfig({ enabled: true })` to the builder (UI Kit 5.3.0+ and Chat SDK 4.3.1+). See [Offline Support](/ui-kit/angular/offline-support). diff --git a/ui-kit/angular/troubleshooting.mdx b/ui-kit/angular/troubleshooting.mdx index ebc486ba2..ff1c38bc9 100644 --- a/ui-kit/angular/troubleshooting.mdx +++ b/ui-kit/angular/troubleshooting.mdx @@ -53,12 +53,20 @@ description: "Common failure modes and fixes for the CometChat Angular UIKit." --- + ## Calling | Symptom | Cause | Fix | | --- | --- | --- | -| Call buttons not appearing in Message Header | `@cometchat/calls-sdk-javascript` not installed | Run `npm install @cometchat/calls-sdk-javascript` โ€” UIKit auto-detects it | +| Call buttons not appearing in Message Header | `@cometchat/calls-sdk-javascript` not installed, or calling not enabled | Run `npm install @cometchat/calls-sdk-javascript@^5.1.1` and call `.setCallingEnabled(true)` on the builder. See [Call Features](/ui-kit/angular/call-features) | | Incoming call screen not showing | `cometchat-incoming-call` not in the component tree | Render the component at the app root level so it can listen for incoming calls | +| `CALLS_SDK_UNAVAILABLE` when placing or answering a 1:1 call | The Calls SDK is older than 5.1, so it has no ringing flow | Install `@cometchat/calls-sdk-javascript` 5.1.1 or later | +| A call ends when the user opens another chat | No call host, so the call buttons that drew the call's screens were destroyed, and the call with them | Put [``](/ui-kit/angular/components/cometchat-call-host) once at the app root | +| A decline, a cancel or no answer shows a few seconds late | **Connect legacy ringing** is off, so the kit learns of it from the call's status, read every 3 seconds, and from the call's messages | Expected. See [How calls ring](/ui-kit/angular/call-features#how-calls-ring) | +| An app on legacy ringing keeps ringing after the caller cancels | **Connect legacy ringing** is off | Turn it on in the dashboard while some of your users are on legacy ringing. See [The Connect legacy ringing setting](/ui-kit/angular/call-features#the-connect-legacy-ringing-setting) | +| The caller's screen closes, recorded as unanswered, when the callee logs out while the call rings | Logout leaves the session the kit prepared for the ring, and the Calls SDK ends a 1:1 call when anyone leaves it | Expected. The callee's other devices stop ringing too | +| Later 1:1 calls are answered busy after the app's own `onAccept` or `onDecline` | The incoming call card is still up | Close it with `IncomingCallService.setIncomingCall(null)`. See [Custom Accept and Decline](/ui-kit/angular/components/cometchat-incoming-call#custom-accept-and-decline) | +| A call doesn't change the chat's preview or move it up the list | The app's conversation update settings (`CometChat.getConversationUpdateSettings()`) don't let call activities update conversations | Expected: the kit follows those settings. Turn on **Include Call Activities** in the dashboard if calls should update conversations | --- @@ -2985,11 +2993,12 @@ try { ##### CometChatUIKitCalls Not Initialized + **Problem**: Error message indicating `CometChatUIKitCalls` is not available. **Solutions**: -1. Ensure the `@cometchat/calls-sdk-javascript` package is installed -2. Enable calling on the UI Kit settings. `CometChatUIKit.init()` then loads and initializes the Calls SDK for you and connects it to the logged-in user's session โ€” don't call `CometChatUIKitCalls.init()` yourself: +1. Ensure `@cometchat/calls-sdk-javascript` 5.1.1 or later is installed +2. Enable calling on the UI Kit settings. The kit then loads and initializes the Calls SDK for you after login, and the Calls SDK reads the logged-in user from the Chat SDK โ€” don't call `CometChatUIKitCalls.init()` or log in to the Calls SDK yourself: ```typescript expandable import { CometChatUIKit, UIKitSettingsBuilder } from '@cometchat/chat-uikit-angular'; diff --git a/ui-kit/react/call-features.mdx b/ui-kit/react/call-features.mdx index 73ec76530..a094c8635 100644 --- a/ui-kit/react/call-features.mdx +++ b/ui-kit/react/call-features.mdx @@ -7,11 +7,12 @@ description: "Overview of CometChat React UI Kit calling features, including inc | Field | Value | | --- | --- | -| Packages | `@cometchat/chat-uikit-react` + `@cometchat/calls-sdk-javascript` (`npm install @cometchat/calls-sdk-javascript`) | +| Packages | `@cometchat/chat-uikit-react` + `@cometchat/calls-sdk-javascript` 5.1.1 or later (`npm install @cometchat/calls-sdk-javascript@^5.1.1`) | | Required setup | Call `.setCallingEnabled(true)` on `UIKitSettingsBuilder` during init โ€” Calls SDK must also be installed | | Call features | Incoming Call, Outgoing Call, Call Logs, Call Buttons (in Message Header) | | Key components | `CometChatMessageHeader` โ†’ [Message Header](/ui-kit/react/components/message-header) (includes call buttons), `CometChatIncomingCall` โ†’ [Incoming Call](/ui-kit/react/components/incoming-call), `CometChatOutgoingCall` โ†’ [Outgoing Call](/ui-kit/react/components/outgoing-call), `CometChatCallLogs` โ†’ [Call Logs](/ui-kit/react/components/call-logs) | | Enabling | Set `.setCallingEnabled(true)` on `UIKitSettingsBuilder` to activate call UI components | +| How 1:1 calls ring | Through the Calls SDK 5.1 ringing flow; group calls send a meeting message. See [How calls ring](#how-calls-ring) | | CSS class prefix | `.cometchat-` |
@@ -29,9 +30,13 @@ Ensure you have called `CometChatUIKit.init()` with `.setCallingEnabled(true)` a Install the Calls SDK and enable calling: ```bash lines -npm install @cometchat/calls-sdk-javascript +npm install @cometchat/calls-sdk-javascript@^5.1.1 ``` + +1:1 calls need the Calls SDK 5.1.1 or later. On 5.0.x, every 1:1 call fails with the error `CALLS_SDK_UNAVAILABLE`. + + Then set `.setCallingEnabled(true)` on your `UIKitSettingsBuilder`: ```tsx @@ -52,6 +57,24 @@ Call buttons render inside [MessageHeader](/ui-kit/react/components/message-head +## How calls ring + +From UI Kit 7.4.0, 1:1 calls ring through the Calls SDK, on its [ringing flow](/calls/javascript/ringing). The kit places, answers, declines and cancels them, so the app writes no ringing code: + +- The caller's screen reads "Outgoing Call", then "Ringing..." once the callee's device rings. +- The callee sees the [Incoming Call](/ui-kit/react/components/incoming-call) card. When one of the callee's tabs or devices answers or declines, the others stop ringing. +- If nobody answers within 45 seconds, the caller's kit ends the call as unanswered. +- A tab that is already in a call, placing one or ringing for one answers a new 1:1 call busy, without showing it. + +Group calls that the kit places don't ring. The kit sends a meeting message to the group, and members join the call from it. + +### The Connect legacy ringing setting + +**Connect legacy ringing**, in the dashboard under **Voice & Video Calls โ†’ Settings**, also sends calls on this flow as legacy call events. Turn it on while some of your users are on apps on legacy ringing, such as an older UI Kit or a mobile app that doesn't ring with the Calls SDK 5.1 and the Push Notifications SDK 2.0; see [While some users are still on legacy ringing](/calls/javascript/migrating-from-legacy-ringing#while-some-users-are-still-on-legacy-ringing). While it's off: + +- An app on legacy ringing that is called keeps ringing after the caller cancels. +- A decline, a cancel or no answer shows on the other side a few seconds late. The kit learns of it by reading the call's status every 3 seconds while the call rings, and from the call's messages once it ends. + ## Features ### Incoming Call diff --git a/ui-kit/react/calling-integration.mdx b/ui-kit/react/calling-integration.mdx index cc0e1377b..b253effdb 100644 --- a/ui-kit/react/calling-integration.mdx +++ b/ui-kit/react/calling-integration.mdx @@ -15,24 +15,28 @@ By the end of this guide you will have voice and video calling working in your R ## Step 1: Install the Calls SDK -The calling feature requires the optional `@cometchat/calls-sdk-javascript` peer dependency: +The calling feature requires the optional `@cometchat/calls-sdk-javascript` peer dependency, 5.1.1 or later: ```bash npm -npm install @cometchat/calls-sdk-javascript +npm install @cometchat/calls-sdk-javascript@^5.1.1 ``` ```bash yarn -yarn add @cometchat/calls-sdk-javascript +yarn add @cometchat/calls-sdk-javascript@^5.1.1 ``` ```bash pnpm -pnpm add @cometchat/calls-sdk-javascript +pnpm add @cometchat/calls-sdk-javascript@^5.1.1 ``` + +1:1 calls ring through the Calls SDK 5.1 ringing flow, so they need 5.1.1 or later. On 5.0.x, every 1:1 call fails with the error `CALLS_SDK_UNAVAILABLE`. See [How calls ring](/ui-kit/react/call-features#how-calls-ring). + + This package provides the WebRTC layer for voice and video calls. It is loaded lazily by the UI Kit โ€” no additional bundle cost until calling is actually used. ## Step 2: Enable Calling in UIKitSettingsBuilder @@ -71,6 +75,19 @@ The Calls SDK uses the same `appId` and `region` from your `UIKitSettings` โ€” n The `config` prop on `CometChatProvider` accepts a `CometChatGlobalConfig` object for UI/behavior flags (`hideReceipts`, `hideUserStatus`, `disableSoundForCalls`, `customSoundForCalls`, `callSettingsBuilder`). It does **not** take a separate calling app ID or region.
+### Call settings + +Every call's session settings are `callSettingsBuilder` laid over the kit's own defaults, so set only what you want to change. A component's own `callSettingsBuilder`, such as `CometChatCallButtons`' or `CometChatIncomingCall`'s, takes the place of this one for the calls it places or answers: + +```tsx + + {/* your app */} + +``` + +- `sessionType` comes from the call: the button pressed (voice or video), or the type of the call answered. +- A 1:1 call's session is set up when the call is placed, on the caller's side, and when it starts ringing, on the callee's, so set its settings here or on the component that places or answers it. `isPeerCall` is always on for it, so a hang-up ends the call for both people. + ## Step 4: Add Call Buttons via CometChatMessageHeader `CometChatMessageHeader` automatically renders voice and video call buttons when calling is enabled. No extra configuration needed โ€” just render the header with a `user` or `group`: @@ -116,7 +133,7 @@ With the setup complete, test a voice call: 1. Open your app with two different users in separate browser tabs 2. Click the **voice call** button (phone icon) in the chat header -3. The caller sees the `CometChatOutgoingCall` screen with a "Calling..." indicator +3. The caller sees the `CometChatOutgoingCall` screen. It reads "Outgoing Call", then "Ringing..." once the receiver's device rings 4. The receiver sees the `CometChatIncomingCall` overlay with accept/reject buttons 5. Once accepted, both users enter the `CometChatOngoingCall` view with live audio @@ -223,22 +240,57 @@ export default function App() { } ``` -`CometChatIncomingCall` listens for incoming call events and displays an accept/reject overlay. When the user accepts, it transitions to the `CometChatOngoingCall` screen internally. You can customize its behavior with callbacks: +`CometChatIncomingCall` listens for incoming call events and displays an accept/reject overlay. When the user accepts, the kit answers the call and opens the `CometChatOngoingCall` screen; when the user declines, the kit declines the call. Leave `onAccept` and `onDecline` unset for that. To run your own code when the user answers or declines, listen for the `ui:call/accepted` and `ui:call/rejected` events instead; see [Events](/ui-kit/react/event-system#call-actions). + +Pass `onAccept` only to draw the call screen yourself. The kit then stops ringing and hands your app the session it prepared while the call rang. Join it with `CometChatOngoingCall`: ```tsx +import { useState } from "react"; +import { CometChat } from "@cometchat/chat-sdk-javascript"; +import { CometChatIncomingCall, CometChatOngoingCall } from "@cometchat/chat-uikit-react"; + +function Calls() { + const [call, setCall] = useState(null); + + return ( + <> + + {call && ( + setCall(null)} + /> + )} + + ); +} +``` + +The call's session was set up when it started ringing, with the settings from Step 3, so set them there rather than on this `CometChatOngoingCall`. Pass `onDecline` only if your app declines the call itself: the kit then just stops ringing and leaves the session it prepared, which ends a 1:1 call for the caller as unanswered. + + +**Coming from 7.3 or earlier?** `onAccept` used to receive a call still to be answered, so apps answered it before joining: + +```tsx +// Up to 7.3 console.log("Call accepted:", call)} - onDecline={(call) => console.log("Call declined:", call)} + onAccept={(call) => { + CometChat.acceptCall(call.getSessionId()).then(setCall); + }} /> ``` +From 7.4, joining the session the kit prepared answers the call. Remove the `CometChat.acceptCall` call and pass the call straight on, as in the example above. A call from an app still on legacy ringing arrives unanswered, as before. + + `CometChatOutgoingCall` is rendered automatically by the `CometChatCallButtons` component when the user initiates a call โ€” you do not need to place it manually. ## Summary | Step | Action | |------|--------| -| 1 | Install `@cometchat/calls-sdk-javascript` | +| 1 | Install `@cometchat/calls-sdk-javascript` 5.1.1 or later | | 2 | Set `.setCallingEnabled(true)` on `UIKitSettingsBuilder` | | 3 | (Optional) Configure call behavior via `config` prop on `CometChatProvider` | | 4 | Call buttons appear in `CometChatMessageHeader` automatically | diff --git a/ui-kit/react/components/call-buttons.mdx b/ui-kit/react/components/call-buttons.mdx index 2d8ea8280..aada25452 100644 --- a/ui-kit/react/components/call-buttons.mdx +++ b/ui-kit/react/components/call-buttons.mdx @@ -16,7 +16,7 @@ description: "Voice and video call buttons for user or group conversations, with | Stitching | Pass `user` or `group`; the buttons manage the outgoing/ongoing call lifecycle internally (see [Calling Integration](/ui-kit/react/calling-integration)) | | Events emitted | `ui:call/outgoing`, `ui:message/sent` โ€” see [Event System](/ui-kit/react/event-system) | | Events received | `ui:call/rejected`, `ui:call/ended` โ€” see [Event System](/ui-kit/react/event-system) | -| SDK listeners (automatic) | Incoming call events (received/cancelled) and outgoing call events (accepted/rejected) to sync button state and screen transitions | +| Listeners (automatic) | The placed call's Calls SDK session and a status read every 3 s while it rings; the incoming call ring, to disable the buttons โ€” see [Listeners](#listeners-real-time-automatic) | | Full props | See [Props](#props) | @@ -137,6 +137,10 @@ function CallButtonsVideoOverride() { } ``` + +With `onVoiceCallClick` or `onVideoCallClick` set, the kit doesn't place the call, so it doesn't ring it either. To keep the kit's ringing and draw the call screens yourself, use the `useCometChatCallButtons` hook instead; see [Custom Call Screens](/ui-kit/react/guide-custom-call-screens). + + #### onCallEnded Fires after an ongoing call session ends and the component has reset its internal state. @@ -195,22 +199,24 @@ UI events this component subscribes to (published by other components): | `ui:call/rejected` | `{ call }` | Clears the active call and re-enables the buttons | | `ui:call/ended` | `{}` | Clears the active call and resets all call state | -### SDK Listeners (Real-Time, Automatic) +### Listeners (Real-Time, Automatic) -The component attaches SDK call listeners internally: +A 1:1 call rings through the Calls SDK (see [How calls ring](/ui-kit/react/call-features#how-calls-ring)), so the component follows the call it placed through the Calls SDK: -| SDK Listener | Internal behavior | +| Source | Internal behavior | | --- | --- | -| `onIncomingCallReceived` | Disables call buttons to prevent concurrent calls | -| `onIncomingCallCancelled` | Re-enables call buttons | -| `onOutgoingCallAccepted` | Transitions to the ongoing call screen | -| `onOutgoingCallRejected` | Clears the active call and resets state | +| The call's Calls SDK session: `onParticipantConnected` | Shows "Ringing..." on the outgoing call screen | +| The call's Calls SDK session: `onParticipantJoined` | Transitions to the ongoing call screen | +| The call's Calls SDK session: `onConnectionClosed`, and a read of the call's status every 3 seconds while it rings | Closes the outgoing call screen when the call is declined, answered busy or not answered | +| An incoming call ringing on the [Incoming Call](/ui-kit/react/components/incoming-call) card | Disables the buttons until the ring stops, to prevent concurrent calls | + +The Chat SDK's `CallListener` still covers the rest: `onIncomingCallReceived` and `onIncomingCallCancelled` disable and re-enable the buttons for a call from an app on legacy ringing, and `onOutgoingCallAccepted` and `onOutgoingCallRejected` arrive only when **Connect legacy ringing** is on. --- ## Call Settings -Customize the calling experience via `callSettingsBuilder`. In v7 this prop takes a session-settings **object** (`SessionSettings`), not a function: `CometChatCallButtons` passes it unchanged to the internal `CometChatOngoingCall` as its `callSettings`. +Customize the calling experience via `callSettingsBuilder`. In v7 this prop takes a session-settings **object** (`SessionSettings`), not a function. ```tsx import type { User } from "@cometchat/chat-sdk-javascript"; @@ -226,9 +232,7 @@ function CallButtonsCustomSettings({ chatUser }: { chatUser: User }) { } ``` - -The object replaces the built-in defaults, including the `sessionType` the component would pick for a voice call (`"VOICE"`). Set `sessionType` yourself if the same settings must also serve voice calls, or hide the button that doesn't match. - +The kit lays the object over its own defaults, so set only what you change, and `sessionType` comes from the button pressed. A 1:1 call's session is set up when the call is placed, so its settings come from here or the provider; `isPeerCall` is always on for it, so a hang-up ends the call for both people. --- @@ -357,7 +361,7 @@ All props are optional. Sorted alphabetically. ### callSettingsBuilder -Session settings for the ongoing call this component starts, passed unchanged to `CometChatOngoingCall` as `callSettings` (it replaces the built-in defaults). Falls back to `GlobalConfig.callSettingsBuilder`. See [Calling Integration](/ui-kit/react/calling-integration) for call-settings setup. +Session settings for the calls this component starts, laid over the kit's defaults, with `sessionType` from the button pressed. Falls back to `GlobalConfig.callSettingsBuilder`. See [Call Settings](#call-settings). | | | | --- | --- | diff --git a/ui-kit/react/components/call-logs.mdx b/ui-kit/react/components/call-logs.mdx index a06ef9c68..83284317d 100644 --- a/ui-kit/react/components/call-logs.mdx +++ b/ui-kit/react/components/call-logs.mdx @@ -43,7 +43,7 @@ The component handles: - Paginated fetching of call logs with infinite scroll - Call direction indicators (incoming, outgoing, missed) - Call duration and timestamp display -- Call button in trailing view to re-initiate calls +- Call button in trailing view to re-initiate calls, which ring through the Calls SDK as calls from the [call buttons](/ui-kit/react/components/call-buttons) do - Transition to outgoing/ongoing call screens internally when a call is initiated - Active call highlighting @@ -279,11 +279,11 @@ Callback when an SDK error occurs during fetch operations. ### callSettingsBuilder -Custom call settings builder for ongoing call sessions initiated from call logs. Falls back to `GlobalConfig.callSettingsBuilder`, then default settings. +Session settings (`SessionSettings`) for calls placed from the call logs. The call logs place calls with `CometChatCallButtons`, so they ring the same way, and their settings are laid over the kit's defaults, with `sessionType` from the call's type. Falls back to `GlobalConfig.callSettingsBuilder`. See [Call Settings](/ui-kit/react/components/call-buttons#call-settings). | | | | --- | --- | -| Type | `any` | +| Type | `SessionSettings` (typed `any`) | | Default | `undefined` | --- diff --git a/ui-kit/react/components/conversations.mdx b/ui-kit/react/components/conversations.mdx index 16e94cb09..94052db83 100644 --- a/ui-kit/react/components/conversations.mdx +++ b/ui-kit/react/components/conversations.mdx @@ -350,6 +350,7 @@ UI events this component subscribes to (published by other components). These fl | `ui:group/member-kicked` | `{ group, member, message }` | Updates last message and moves to top | | `ui:group/member-banned` | `{ group, member, message }` | Updates last message and moves to top | | `ui:group/member-unbanned` | `{ group, member, message }` | Updates last message and moves to top | +| `ui:call/outgoing`, `ui:call/accepted`, `ui:call/rejected`, `ui:call/ended` | `{ call }` | Moves the conversation to the top and keeps its unread count, only when call activities update conversations โ€” see [Calls in the List](#calls-in-the-list) | ### SDK Listeners (Automatic) @@ -360,11 +361,21 @@ These SDK listeners are attached internally. The component updates its state aut - Receipts: `onMessagesDelivered`, `onMessagesRead` - Presence: `onUserOnline`, `onUserOffline` - Groups: `onGroupMemberJoined`, `onGroupMemberLeft`, `onGroupMemberKicked`, `onGroupMemberBanned`, `onMemberAddedToGroup` +- Calls: the call events on the kit's event bus (`call/incoming`, `call/accepted`, `call/rejected`, `call/cancelled`, `call/ended`; see [Call Events](/ui-kit/react/event-system#call-events)), which follow the call activities setting too **Unread counts in large groups:** Unread message counts are calculated only for groups with up to 300 members. See [Properties and Constraints](/articles/properties-and-constraints#users-and-groups). +### Calls in the List + +Calls change the list only when the app's conversation update settings let call activities update conversations (**Include Call Activities** in the dashboard; read it with `CometChatUIKit.getConversationUpdateSettings()?.shouldUpdateOnCallActivities()`). Then: + +- A call moves the chat up but keeps its unread count. +- After a 1:1 call on the ringing flow ends, the list fetches the chat a few times, for up to about 25 seconds, until its last message shows how the call went. With **Connect legacy ringing** off, those messages reach no tab live (see [How calls ring](/ui-kit/react/call-features#how-calls-ring)). + +When call activities don't update conversations, calls leave the list as it is. + --- ## Customization diff --git a/ui-kit/react/components/incoming-call.mdx b/ui-kit/react/components/incoming-call.mdx index 26bbe0504..dd2a6c3b3 100644 --- a/ui-kit/react/components/incoming-call.mdx +++ b/ui-kit/react/components/incoming-call.mdx @@ -11,11 +11,11 @@ description: "Displays an incoming call notification with caller info, accept/de | Package | `@cometchat/chat-uikit-react` | | Import | `import { CometChatIncomingCall } from "@cometchat/chat-uikit-react";` | | CSS root class | `.cometchat-incoming-call` | -| Primary output | `onAccept: (call: Call) => void` โ€” fires when the call is accepted | +| Primary output | Answers and declines incoming calls; `onAccept` / `onDecline` take that over | | Prerequisites | App wrapped in [`CometChatProvider`](/ui-kit/react/cometchat-provider) with valid credentials + a logged-in user | -| Stitching | Mount at the app root to catch incoming calls; wire `onAccept` / `onDecline` | -| Events emitted | `ui:call/rejected`, `ui:call/ended` โ€” see [Event System](/ui-kit/react/event-system) | -| SDK listeners (automatic) | Incoming and outgoing call lifecycle โ€” handled internally | +| Stitching | Mount once at the app root to catch incoming calls; leave `onAccept` / `onDecline` unset to let the kit answer and decline | +| Events emitted | `ui:call/accepted`, `ui:call/rejected`, `ui:call/ended` โ€” see [Event System](/ui-kit/react/event-system) | +| Listeners (automatic) | The Chat SDK's `CallListener` for the incoming call, then the call's Calls SDK session and a status read every 3 s while a 1:1 call rings โ€” handled internally | | Full props | See [Props](#props) | @@ -41,8 +41,9 @@ description: "Displays an incoming call notification with caller info, accept/de The component handles: - Automatic detection of incoming calls via SDK `CallListener` - Caller avatar, name, and call type display (Voice/Video) -- Accept button โ€” transitions to `CometChatOngoingCall` internally -- Decline button โ€” rejects the call via SDK +- Accept button โ€” answers the call and transitions to `CometChatOngoingCall` internally +- Decline button โ€” declines the call, and the user's other tabs and devices stop ringing. Declining a group call only stops it ringing for this user: the call goes on for the group's other members +- Accept and Decline labels in the user's language (`incoming_call_confirm_yes`, `incoming_call_confirm_no`) - Incoming call sound playback (looping while notification is visible) - Self-managed visibility (renders nothing when no incoming call is active) @@ -64,12 +65,6 @@ function App() {
{/* Your app content */} { - console.log("Call accepted:", call.getSessionId()); - }} - onDecline={(call) => { - console.log("Call declined:", call.getSessionId()); - }} onCallEnded={() => { console.log("Call ended"); }} @@ -79,6 +74,8 @@ function App() { } ``` +Leave `onAccept` and `onDecline` unset to let the kit answer and decline. Passing them takes that over; see [onAccept](#onaccept) and [onDecline](#ondecline). + ### Full Layout Example ```tsx @@ -119,8 +116,8 @@ function ChatApp() { | Prop | Signature | Fires when | | --- | --- | --- | -| `onAccept` | `(call: Call) => void` | User clicks the accept button | -| `onDecline` | `(call: Call) => void` | User clicks the decline button | +| `onAccept` | `(call: Call) => void` | User clicks the accept button; the app then joins the call itself | +| `onDecline` | `(call: Call) => void` | User clicks the decline button; the app then declines the call itself | | `onCallEnded` | `() => void` | Ongoing call session ends | | `onError` | `((error: CometChatException) => void) \| null` | SDK error occurs | @@ -130,6 +127,7 @@ UI events this component publishes: | Event | Payload | Fires when | | --- | --- | --- | +| `ui:call/accepted` | `{ call }` | Call answered by user | | `ui:call/rejected` | `{ call }` | Call declined by user | | `ui:call/ended` | `{}` | Ongoing call ended | @@ -137,14 +135,14 @@ UI events this component publishes: This component does not subscribe to any UI events from other components. -### SDK Listeners (Automatic) +### Listeners (Automatic) + +The component learns of an incoming call from the Chat SDK's `CallListener` (`onIncomingCallReceived`) and shows the notification. A 1:1 call on the ringing flow (see [How calls ring](/ui-kit/react/call-features#how-calls-ring)) then rings through the Calls SDK: -These SDK `CallListener` callbacks are attached internally. The component updates its state automatically: +- The component prepares the call's session while it rings, so Accept joins at once. +- It hides the notification when the caller cancels, when the call is answered or declined in another tab or device, or when nobody answers. It learns this from the session's `onConnectionClosed`, from a read of the call's status every 3 seconds, and from its own 60-second limit. -- `onIncomingCallReceived` โ€” shows the incoming call notification -- `onIncomingCallCancelled` โ€” hides the notification (caller cancelled) -- `onOutgoingCallAccepted` โ€” transitions to ongoing call screen -- `onOutgoingCallRejected` โ€” hides the notification (call rejected elsewhere) +A call from an app on legacy ringing still follows the Chat SDK's `onIncomingCallCancelled`, `onOutgoingCallAccepted` and `onOutgoingCallRejected`. --- @@ -277,7 +275,9 @@ All props are optional. `Call` and `CometChatException` in the types below are t ### onAccept -Custom accept handler. When provided, overrides the default `CometChat.acceptCall` behavior. +Custom accept handler. When provided, the kit doesn't answer the call: it stops ringing and hands your app the session it prepared while the call rang. Join it with `CometChatOngoingCall` (or `useOngoingCall`); see the example in [Calling Integration](/ui-kit/react/calling-integration#step-7-render-cometchatincomingcall). The call's session was set up when it started ringing, with this component's `callSettingsBuilder` or the provider's, so set its settings there rather than on that `CometChatOngoingCall`. For a call from an app on legacy ringing, it replaces `CometChat.acceptCall`, as before. + +To run your own code when the user answers, and keep the kit's answer, listen for `ui:call/accepted` instead. | | | | --- | --- | @@ -288,7 +288,9 @@ Custom accept handler. When provided, overrides the default `CometChat.acceptCal ### onDecline -Custom decline handler. When provided, overrides the default `CometChat.rejectCall` behavior. +Custom decline handler. When provided, the kit doesn't decline the call: it only stops ringing and leaves the session it prepared, which ends a 1:1 call for the caller as unanswered. For a call from an app on legacy ringing, it replaces `CometChat.rejectCall`, as before. + +To run your own code when the user declines, and keep the kit's decline, listen for `ui:call/rejected` instead. | | | | --- | --- | @@ -332,32 +334,15 @@ Custom sound URL to play for incoming calls (replaces the built-in ringtone). ### callSettingsBuilder -Meant to customize the session that starts when the call is accepted: a function that receives the call and returns session settings (`SessionSettings`, the same object [`CometChatCallButtons`](/ui-kit/react/components/call-buttons#call-settings) takes). +Customizes the session of a call this component answers: a function that receives the call and returns session settings (`SessionSettings`, the same object [`CometChatCallButtons`](/ui-kit/react/components/call-buttons#call-settings) takes). Falls back to `GlobalConfig.callSettingsBuilder`. + +The kit lays these settings over its own defaults, and `sessionType` comes from the call's type. For a 1:1 call on the ringing flow, the session is set up when the call starts ringing, and `isPeerCall` is always on. | | | | --- | --- | | Type | `(call: Call) => SessionSettings` | | Default | `undefined` | - -In 7.2.4 the value this function returns is not applied: `CometChatIncomingCall` hands it to the ongoing call under a prop name the ongoing call does not read, so an accepted call uses the global or default settings. Set session settings for every call on `CometChatProvider` instead, which the ongoing call does read: - -```tsx -import { CometChatProvider, type SessionSettings } from "@cometchat/chat-uikit-react"; - -const callSettings: SessionSettings = { - layout: "SIDEBAR", - startVideoPaused: true, -}; - - - {/* ...your app, including */} - -``` - -`CometChat.CallSettingsBuilder` belongs to the older Calls SDK v4 integration; v7 calling takes a plain `SessionSettings` object. - - --- ### onError diff --git a/ui-kit/react/components/message-header.mdx b/ui-kit/react/components/message-header.mdx index dc657c1e4..194ea2afd 100644 --- a/ui-kit/react/components/message-header.mdx +++ b/ui-kit/react/components/message-header.mdx @@ -30,7 +30,7 @@ description: "Toolbar displaying conversation details with avatar, name, presenc "callSettingsBuilder": { "type": "SessionSettings (typed any in the 7.2.4 declarations)", "default": "GlobalConfig.callSettingsBuilder or built-in default", - "note": "Session-settings object (not a function) for calls started from the header; passed unchanged to CometChatCallButtons, which hands it to CometChatOngoingCall as callSettings." + "note": "Session-settings object (not a function) for calls started from the header; passed to CometChatCallButtons, which lays it over the kit's defaults." }, "lastActiveAtDateTimeFormat": { "type": "CometChatDateFormatConfig", @@ -704,7 +704,7 @@ Remove the "Pinned messages" entry from the overflow menu. The entry only appear ### callSettingsBuilder -Session settings for calls started from the header's call buttons. In v7 this prop takes a session-settings **object** (`SessionSettings`), not a builder function: the header passes it unchanged to `CometChatCallButtons`, which hands it to `CometChatOngoingCall` as `callSettings`. Falls back to `GlobalConfig.callSettingsBuilder`, then the built-in default. See [Call Buttons](/ui-kit/react/components/call-buttons#callsettingsbuilder). +Session settings for calls started from the header's call buttons. In v7 this prop takes a session-settings **object** (`SessionSettings`), not a builder function: the header passes it unchanged to `CometChatCallButtons`, which lays it over the kit's defaults, with `sessionType` from the button pressed. Falls back to `GlobalConfig.callSettingsBuilder`, then the built-in default. See [Call Settings](/ui-kit/react/components/call-buttons#call-settings). | | | | --- | --- | diff --git a/ui-kit/react/components/outgoing-call.mdx b/ui-kit/react/components/outgoing-call.mdx index 7aa24d994..03c16a5f5 100644 --- a/ui-kit/react/components/outgoing-call.mdx +++ b/ui-kit/react/components/outgoing-call.mdx @@ -20,7 +20,7 @@ description: "Displays the outgoing call screen with receiver info and a cancel ## Overview -`CometChatOutgoingCall` is a purely presentational component that displays the outgoing call screen while waiting for the receiver to answer. It shows the receiver's name, avatar, a "Calling..." subtitle, and an end-call button. +`CometChatOutgoingCall` is a purely presentational component that displays the outgoing call screen while waiting for the receiver to answer. It shows the receiver's name, avatar, an "Outgoing Call" subtitle that changes to "Ringing..." once the receiver's device rings, and an end-call button. **Live Preview** โ€” interact with the default outgoing call screen. @@ -38,13 +38,13 @@ description: "Displays the outgoing call screen with receiver info and a cancel The component handles: - Displaying receiver name and avatar from the `call` object -- "Calling..." subtitle text +- "Outgoing Call" subtitle text, then "Ringing..." once the receiver's device rings, for any call the kit placed (see [How calls ring](/ui-kit/react/call-features#how-calls-ring)) - End-call/cancel button - Outgoing call sound playback (looping while mounted, pauses on unmount) > **Required prop:** The `call` prop is required. The component needs a valid `CometChat.Call` object to render receiver information. -> **Typical usage:** `CometChatOutgoingCall` is typically rendered by `CometChatMessageHeader` or `CometChatIncomingCall` internally when a call is initiated, but it can be used standalone. +> **Typical usage:** `CometChatOutgoingCall` is typically rendered by `CometChatCallButtons` (inside `CometChatMessageHeader`) when a call is placed, but it can be used standalone. --- @@ -53,66 +53,58 @@ The component handles: ### Flat API ```tsx -import { CometChat } from "@cometchat/chat-sdk-javascript"; +import type { Call } from "@cometchat/chat-sdk-javascript"; import { CometChatOutgoingCall } from "@cometchat/chat-uikit-react"; -function OutgoingCallScreen({ call }: { call: CometChat.Call }) { - return ( - { - console.log("Call canceled by user"); - // Cancel the call via SDK - CometChat.rejectCall(call.getSessionId(), CometChat.CALL_STATUS.CANCELLED); - }} - /> - ); +function OutgoingCallScreen({ call, onCancel }: { call: Call; onCancel: () => void }) { + return ; } ``` +`CometChatOutgoingCall` only draws the screen: `onCallCanceled` must cancel the call itself. + ### Standalone Usage Example -```tsx -import { useState } from "react"; -import { CometChat } from "@cometchat/chat-sdk-javascript"; -import { CometChatOutgoingCall } from "@cometchat/chat-uikit-react"; +To place and cancel a call the way the kit does, so that it rings through the Calls SDK, use the `useCometChatCallButtons` hook. It places the call, gives you `activeCall` for this screen and `cancelOutgoingCall` for its button, and tells you when to show the ongoing call: -function CallManager() { - const [outgoingCall, setOutgoingCall] = useState(null); - - const initiateCall = async (receiverUID: string) => { - const call = new CometChat.Call( - receiverUID, - CometChat.CALL_TYPE.VIDEO, - CometChat.RECEIVER_TYPE.USER - ); - const initiatedCall = await CometChat.initiateCall(call); - setOutgoingCall(initiatedCall); - }; - - const cancelCall = () => { - if (outgoingCall) { - CometChat.rejectCall( - outgoingCall.getSessionId(), - CometChat.CALL_STATUS.CANCELLED - ); - setOutgoingCall(null); - } - }; +```tsx +import type { User } from "@cometchat/chat-sdk-javascript"; +import { + CometChatOngoingCall, + CometChatOutgoingCall, + useCometChatCallButtons, +} from "@cometchat/chat-uikit-react"; + +function CallManager({ user }: { user: User }) { + const { + activeCall, + callButtonsDisabled, + showOutgoingCallScreen, + showOngoingCall, + callSessionId, + initiateVideoCall, + cancelOutgoingCall, + resetCallState, + } = useCometChatCallButtons({ user }); return (
- {outgoingCall && ( - + + {showOutgoingCallScreen && activeCall && ( + + )} + {showOngoingCall && callSessionId && ( + )}
); } ``` +A call placed with `CometChat.initiateCall` and cancelled with `CometChat.rejectCall` goes the legacy way instead: it isn't on the ringing flow, and its screen never shows "Ringing...". See [Custom Call Screens](/ui-kit/react/guide-custom-call-screens) for the hook's full API. + --- ## Actions and Events @@ -134,7 +126,7 @@ This component does not subscribe to any UI events from other components. ### SDK Listeners (Automatic) -This component does not attach any SDK listeners. It is purely presentational โ€” the parent component is responsible for managing call state transitions (e.g., listening for `onOutgoingCallAccepted` or `onOutgoingCallRejected`). +This component does not attach any SDK listeners. It is purely presentational: the parent decides when to show and close it. With `useCometChatCallButtons`, use its `showOutgoingCallScreen` and `showOngoingCall` state, or listen for the call events (see [Events](/ui-kit/react/event-system#call-actions)). The Chat SDK's `onOutgoingCallAccepted` and `onOutgoingCallRejected` arrive only when **Connect legacy ringing** is on. --- @@ -157,7 +149,7 @@ Use view props to replace sections of the default UI while keeping the component | Slot | Type | Replaces | | --- | --- | --- | | `titleView` | `ReactNode` | Receiver name | -| `subtitleView` | `ReactNode` | "Calling..." text | +| `subtitleView` | `ReactNode` | "Outgoing Call" / "Ringing..." text | | `avatarView` | `ReactNode` | Receiver avatar | | `cancelButtonView` | `ReactNode` | End-call button | @@ -380,7 +372,7 @@ Custom view that replaces the receiver name. ### subtitleView -Custom view that replaces the "Calling..." text. +Custom view that replaces the "Outgoing Call" / "Ringing..." text. | | | | --- | --- | diff --git a/ui-kit/react/event-system.mdx b/ui-kit/react/event-system.mdx index 13e1e8755..4b6507d90 100644 --- a/ui-kit/react/event-system.mdx +++ b/ui-kit/react/event-system.mdx @@ -205,10 +205,12 @@ These events originate from the CometChat SDK (network). They fire when other us | --- | --- | --- | | `call/incoming` | `{ call: Call }` | Incoming call received | | `call/accepted` | `{ call: Call }` | Outgoing call was accepted | -| `call/rejected` | `{ call: Call }` | Outgoing call was rejected | -| `call/cancelled` | `{ call: Call }` | Incoming call was cancelled | +| `call/rejected` | `{ call: Call }` | Outgoing call was declined or answered busy | +| `call/cancelled` | `{ call: Call }` | Incoming call was cancelled or not answered | | `call/ended` | `{ call: Call }` | Call ended | +For a 1:1 call on the [ringing flow](/ui-kit/react/call-features#how-calls-ring), the Chat SDK reports only `call/incoming` while **Connect legacy ringing** is off. The kit publishes the other four itself as it learns how the call went: from the call's Calls SDK session, from the user's other tabs, or from the status read every 3 seconds while the call rings. Each is published once per call, even when the Chat SDK reports it too, and can arrive a few seconds after the event. `call.getStatus()` gives the outcome: `ongoing`, `rejected`, `busy`, `cancelled`, `unanswered` or `ended`. + ### Connection Events | Event Type | Payload | When | diff --git a/ui-kit/react/guide-custom-call-screens.mdx b/ui-kit/react/guide-custom-call-screens.mdx new file mode 100644 index 000000000..dd5a705d0 --- /dev/null +++ b/ui-kit/react/guide-custom-call-screens.mdx @@ -0,0 +1,217 @@ +--- +title: "Custom Call Screens" +sidebarTitle: "Custom Call Screens" +description: "Draw your own call buttons and call screens while the UI Kit still places, rings, answers and ends calls through the Calls SDK." +--- + +## Goal + +By the end of this guide your app draws its own call buttons and call screens, while the UI Kit still places, rings, answers and ends the calls. Use it when `CometChatCallButtons` and the screens it opens don't fit your design. + +## Prerequisites + +- Calling set up as in [Calling Integration](/ui-kit/react/calling-integration), with the Calls SDK 5.1.1 or later +- `CometChatIncomingCall` rendered once at the root of your app +- [How calls ring](/ui-kit/react/call-features#how-calls-ring): 1:1 calls ring through the Calls SDK, and group calls send a meeting message + +## Components Used + +| Component / API | Purpose | +|:----------------|:--------| +| `useCometChatCallButtons` | Places and cancels calls the way `CometChatCallButtons` does, and says which screen to show | +| `CometChatOutgoingCall` | The outgoing call screen: "Outgoing Call", then "Ringing..." | +| `CometChatOngoingCall` | Joins the call and draws it | +| `useOngoingCall` | Joins the call into an element of your own, for a call screen you draw yourself | +| `CometChatIncomingCall` with `onAccept` | Hands a call the user answers to your app | + +## Step 1: Place calls with `useCometChatCallButtons` + +`useCometChatCallButtons` does what `CometChatCallButtons` does, without drawing anything. Pass a `user` for a 1:1 call, which rings through the Calls SDK, or a `group` for a group call, which sends a meeting message. + +```tsx +import type { User } from "@cometchat/chat-sdk-javascript"; +import { useCometChatCallButtons } from "@cometchat/chat-uikit-react"; + +function MyCallButtons({ user }: { user: User }) { + const { callButtonsDisabled, initiateAudioCall, initiateVideoCall } = useCometChatCallButtons({ + user, + callSettingsBuilder: { layout: "SIDEBAR" }, + }); + + return ( +
+ + +
+ ); +} +``` + +### Options + +| Option | Type | Description | +| --- | --- | --- | +| `user` | `CometChat.User` | The user to call. Pass either `user` or `group` | +| `group` | `CometChat.Group` | The group to call | +| `callSettingsBuilder` | `SessionSettings` | Settings for a 1:1 call, laid over the kit's defaults when the call is placed; `sessionType` comes from the call's type. Falls back to `GlobalConfig.callSettingsBuilder`. A group call joins with your `CometChatOngoingCall`'s settings instead | +| `onError` | `((error: CometChat.CometChatException) => void) \| null` | Called when placing or cancelling a call fails | + +### Returns + +| Field | Type | Description | +| --- | --- | --- | +| `initiateAudioCall`, `initiateVideoCall` | `() => Promise` | Place a voice or video call | +| `cancelOutgoingCall` | `() => Promise` | Cancel the call while it rings | +| `resetCallState` | `() => void` | Clear the call once its screen closes | +| `callButtonsDisabled` | `boolean` | `true` while a call is being placed or runs, or an incoming call rings. Disable your buttons with it | +| `showOutgoingCallScreen` | `boolean` | Show the outgoing call screen | +| `showOngoingCall` | `boolean` | Show the ongoing call | +| `activeCall` | `CometChat.Call \| null` | The call this hook placed | +| `callSessionId` | `string` | The call's session ID, for `CometChatOngoingCall` | +| `isDirectCalling` | `boolean` | `true` for a group call | +| `isGroupAudioCall` | `boolean` | `true` for a group voice call | + +The app has one call at a time. A call placed from another button or hook shows here only as `callButtonsDisabled`; the other fields describe the call this hook placed. + +A call placed with this hook belongs to the component that uses it. If that component unmounts, a call still ringing is cancelled and the call's state is cleared. Use the hook in a component that stays mounted for the whole call, not in a chat header that remounts for each conversation. + +## Step 2: Show the outgoing call screen + +Take `showOutgoingCallScreen`, `activeCall` and `cancelOutgoingCall` from the same hook. While `showOutgoingCallScreen` is `true`, show `CometChatOutgoingCall` and cancel with `cancelOutgoingCall`: + +```tsx +{showOutgoingCallScreen && activeCall && ( + +)} +``` + +The screen reads "Outgoing Call", then "Ringing..." once the callee's device rings. Its title, subtitle, avatar and button can be replaced; see [Outgoing Call](/ui-kit/react/components/outgoing-call). When the callee answers, `showOutgoingCallScreen` turns `false` and `showOngoingCall` turns `true`. When the call is declined, busy, cancelled or not answered, both are `false`. + +## Step 3: Show the ongoing call + +Take `showOngoingCall`, `callSessionId`, `isGroupAudioCall`, `isDirectCalling` and `resetCallState` from the hook as well. While `showOngoingCall` is `true`, join the call with `CometChatOngoingCall`. This step uses `CometChat.CALL_TYPE`, a value, so import `CometChat` with `import { CometChat } from "@cometchat/chat-sdk-javascript"`: + +```tsx +{showOngoingCall && callSessionId && ( + +)} +``` + +For a 1:1 call, `CometChatOngoingCall` joins the session the Calls SDK prepared while the call rang, so the call starts at once. That session was set up with the hook's settings when the call was placed, so set them on the hook. A group call joins with the `callSettings` passed here, else the provider's, laid over the kit's defaults. + +To draw the call screen around the call yourself, join it with `useOngoingCall` instead. It renders the call into an element you give it, and joins a prepared session the same way: + +```tsx +import { useEffect, useRef } from "react"; +import { useOngoingCall } from "@cometchat/chat-uikit-react"; + +function MyCallScreen({ sessionId, onEnded }: { sessionId: string; onEnded: () => void }) { + const frame = useRef(null); + const { startCall, endCall, isCallActive } = useOngoingCall({ sessionId, onCallEnded: onEnded }); + + useEffect(() => { + if (frame.current) void startCall(frame.current); + }, [startCall]); + + return ( +
+
+ +
+ ); +} +``` + +`useOngoingCall` takes `sessionId`, `isAudioOnly`, `isDirectCalling`, `callSettings` (laid over the kit's defaults; falls back to the provider's), `onCallEnded` and `onError`, and returns `startCall(element)`, `endCall()` (ends the call), `endSession()` (only leaves the session here) and `isCallActive`. + +## Step 4: Answer calls in your own screen + +`CometChatIncomingCall` answers calls and opens its own call screen. To open yours instead, pass `onAccept`. The kit then stops ringing and hands your app the session it prepared while the call rang: + +```tsx +import { useState } from "react"; +import { CometChat } from "@cometchat/chat-sdk-javascript"; +import { CometChatIncomingCall, CometChatOngoingCall } from "@cometchat/chat-uikit-react"; + +function IncomingCalls() { + const [call, setCall] = useState(null); + + return ( + <> + + {call && ( + setCall(null)} + /> + )} + + ); +} +``` + +Leave `onDecline` unset so the kit still declines the call; see [Incoming Call](/ui-kit/react/components/incoming-call#ondecline). To change only how the card looks, use its view props (`itemView`, `titleView` and the rest) and keep the kit's answer. + +## Complete Example + +```tsx +import { CometChat } from "@cometchat/chat-sdk-javascript"; +import { + CometChatOngoingCall, + CometChatOutgoingCall, + useCometChatCallButtons, +} from "@cometchat/chat-uikit-react"; + +export function MyCallButtons({ user }: { user: CometChat.User }) { + const { + activeCall, + callButtonsDisabled, + showOutgoingCallScreen, + showOngoingCall, + callSessionId, + isDirectCalling, + isGroupAudioCall, + initiateAudioCall, + initiateVideoCall, + cancelOutgoingCall, + resetCallState, + } = useCometChatCallButtons({ user, callSettingsBuilder: { layout: "SIDEBAR" } }); + + return ( + <> + + + + {showOutgoingCallScreen && activeCall && ( + + )} + + {showOngoingCall && callSessionId && ( + + )} + + ); +} +``` + +Render `MyCallButtons` where your chat header is, and `IncomingCalls` from Step 4 once at the root of your app, in place of the `CometChatIncomingCall` from the prerequisites. + +## Next Steps + +- [Call Buttons](/ui-kit/react/components/call-buttons) โ€” the ready-made buttons this hook drives +- [Outgoing Call](/ui-kit/react/components/outgoing-call) โ€” customize the outgoing call screen +- [Incoming Call](/ui-kit/react/components/incoming-call) โ€” customize the incoming call card +- [Calling Integration](/ui-kit/react/calling-integration) โ€” call settings and setup diff --git a/ui-kit/react/integration-astro.mdx b/ui-kit/react/integration-astro.mdx index 88e617725..6a33edb5f 100644 --- a/ui-kit/react/integration-astro.mdx +++ b/ui-kit/react/integration-astro.mdx @@ -9,14 +9,14 @@ description: "Add CometChat to an Astro app in 5 steps: create project, install, | Field | Value | | --- | --- | | Package | `@cometchat/chat-uikit-react` v7.x | -| Peer deps | `react` `>=18 <21`, `react-dom` `>=18 <21`, `@cometchat/chat-sdk-javascript` ^4.2.0; optional `@cometchat/calls-sdk-javascript` ^5.0.3 (calling only) | +| Peer deps | `react` `>=18 <21`, `react-dom` `>=18 <21`, `@cometchat/chat-sdk-javascript` ^4.2.1; optional `@cometchat/calls-sdk-javascript` ^5.1.1 (calling only) | | Bundled deps | `dompurify`, `@cometchat/cards-react` โ€” regular dependencies, installed automatically. Do not add them yourself | | Init | `CometChatUIKit.init(UIKitSettings)` โ€” must resolve before `login()` | | Login | `CometChatUIKit.login("UID")` โ€” must resolve before rendering components | | Order | `init()` โ†’ `login()` โ†’ render ``. Breaking this order = blank screen | | Auth Key | Dev/testing only. Use Auth Token in production | | SSR | Use `client:only="react"` directive โ€” CometChat components cannot be server-rendered | -| Calling | Optional. Install `@cometchat/calls-sdk-javascript` and call `.setCallingEnabled(true)` on `UIKitSettingsBuilder` | +| Calling | Optional. Install `@cometchat/calls-sdk-javascript` (5.1.1 or later) and call `.setCallingEnabled(true)` on `UIKitSettingsBuilder` | | Offline support | Optional, off by default. Call `.setOfflineConfig({ enabled: true })` on `UIKitSettingsBuilder`. Needs UI Kit 7.3.0 and `@cometchat/chat-sdk-javascript` 4.3.1 or later. See [Offline Support](/ui-kit/react/offline-support) | | Other frameworks | [React.js](/ui-kit/react/integration-react) ยท [Next.js](/ui-kit/react/integration-nextjs) ยท [React Router](/ui-kit/react/integration-react-router) | @@ -78,7 +78,7 @@ yarn add @cometchat/chat-uikit-react @cometchat/chat-sdk-javascript If you want voice/video calling, also install: ```bash -npm install @cometchat/calls-sdk-javascript +npm install @cometchat/calls-sdk-javascript@^5.1.1 ``` --- diff --git a/ui-kit/react/integration-nextjs.mdx b/ui-kit/react/integration-nextjs.mdx index 2c7e25c3a..db8f173b9 100644 --- a/ui-kit/react/integration-nextjs.mdx +++ b/ui-kit/react/integration-nextjs.mdx @@ -9,14 +9,14 @@ description: "Add CometChat to a Next.js (App Router) app in 5 steps: create pro | Field | Value | | --- | --- | | Package | `@cometchat/chat-uikit-react` v7.x | -| Peer deps | `react` `>=18 <21`, `react-dom` `>=18 <21`, `@cometchat/chat-sdk-javascript` ^4.2.0; optional `@cometchat/calls-sdk-javascript` ^5.0.3 (calling only) | +| Peer deps | `react` `>=18 <21`, `react-dom` `>=18 <21`, `@cometchat/chat-sdk-javascript` ^4.2.1; optional `@cometchat/calls-sdk-javascript` ^5.1.1 (calling only) | | Bundled deps | `dompurify`, `@cometchat/cards-react` โ€” regular dependencies, installed automatically. Do not add them yourself | | Init | `CometChatUIKit.init(UIKitSettings)` โ€” must resolve before `login()` | | Login | `CometChatUIKit.login("UID")` โ€” must resolve before rendering components | | Order | `init()` โ†’ `login()` โ†’ render ``. Breaking this order = blank screen | | Auth Key | Dev/testing only. Use `loginWithAuthToken` in production | | SSR | CometChat components must be loaded with `dynamic(() => import(...), { ssr: false })` | -| Calling | Optional. Install `@cometchat/calls-sdk-javascript` and call `.setCallingEnabled(true)` on `UIKitSettingsBuilder` | +| Calling | Optional. Install `@cometchat/calls-sdk-javascript` (5.1.1 or later) and call `.setCallingEnabled(true)` on `UIKitSettingsBuilder` | | Offline support | Optional, off by default. Call `.setOfflineConfig({ enabled: true })` on `UIKitSettingsBuilder`. Needs UI Kit 7.3.0 and `@cometchat/chat-sdk-javascript` 4.3.1 or later. See [Offline Support](/ui-kit/react/offline-support) | | Other frameworks | [React.js](/ui-kit/react/integration-react) ยท [React Router](/ui-kit/react/integration-react-router) ยท [Astro](/ui-kit/react/integration-astro) | @@ -76,7 +76,7 @@ yarn add @cometchat/chat-uikit-react @cometchat/chat-sdk-javascript If you want voice/video calling, also install: ```bash -npm install @cometchat/calls-sdk-javascript +npm install @cometchat/calls-sdk-javascript@^5.1.1 ``` --- diff --git a/ui-kit/react/integration-react-router.mdx b/ui-kit/react/integration-react-router.mdx index a3074b8ef..722e2bea6 100644 --- a/ui-kit/react/integration-react-router.mdx +++ b/ui-kit/react/integration-react-router.mdx @@ -9,14 +9,14 @@ description: "Add CometChat to a React Router app in 5 steps: create project, in | Field | Value | | --- | --- | | Package | `@cometchat/chat-uikit-react` v7.x | -| Peer deps | `react` `>=18 <21`, `react-dom` `>=18 <21`, `@cometchat/chat-sdk-javascript` ^4.2.0; optional `@cometchat/calls-sdk-javascript` ^5.0.3 (calling only) | +| Peer deps | `react` `>=18 <21`, `react-dom` `>=18 <21`, `@cometchat/chat-sdk-javascript` ^4.2.1; optional `@cometchat/calls-sdk-javascript` ^5.1.1 (calling only) | | Bundled deps | `dompurify`, `@cometchat/cards-react` โ€” regular dependencies, installed automatically. Do not add them yourself | | Init | `CometChatUIKit.init(UIKitSettings)` โ€” must resolve before `login()` | | Login | `CometChatUIKit.login("UID")` โ€” must resolve before rendering components | | Order | `init()` โ†’ `login()` โ†’ render ``. Breaking this order = blank screen | | Auth Key | Dev/testing only. Use Auth Token in production | | SSR | N/A โ€” client-side SPA by default | -| Calling | Optional. Install `@cometchat/calls-sdk-javascript` and call `.setCallingEnabled(true)` on `UIKitSettingsBuilder` | +| Calling | Optional. Install `@cometchat/calls-sdk-javascript` (5.1.1 or later) and call `.setCallingEnabled(true)` on `UIKitSettingsBuilder` | | Offline support | Optional, off by default. Call `.setOfflineConfig({ enabled: true })` on `UIKitSettingsBuilder`. Needs UI Kit 7.3.0 and `@cometchat/chat-sdk-javascript` 4.3.1 or later. See [Offline Support](/ui-kit/react/offline-support) | | Other frameworks | [React.js](/ui-kit/react/integration-react) ยท [Next.js](/ui-kit/react/integration-nextjs) ยท [Astro](/ui-kit/react/integration-astro) | @@ -76,7 +76,7 @@ yarn add @cometchat/chat-uikit-react @cometchat/chat-sdk-javascript If you want voice/video calling, also install: ```bash -npm install @cometchat/calls-sdk-javascript +npm install @cometchat/calls-sdk-javascript@^5.1.1 ``` --- diff --git a/ui-kit/react/integration-react.mdx b/ui-kit/react/integration-react.mdx index 764bf2e5f..04ecad8dc 100644 --- a/ui-kit/react/integration-react.mdx +++ b/ui-kit/react/integration-react.mdx @@ -9,13 +9,13 @@ description: "Add CometChat to a React.js app in 4 steps: create project, instal | Field | Value | | --- | --- | | Package | `@cometchat/chat-uikit-react` v7.x | -| Peer deps | `react` `>=18 <21`, `react-dom` `>=18 <21`, `@cometchat/chat-sdk-javascript` ^4.2.0; optional `@cometchat/calls-sdk-javascript` ^5.0.3 (calling only) | +| Peer deps | `react` `>=18 <21`, `react-dom` `>=18 <21`, `@cometchat/chat-sdk-javascript` ^4.2.1; optional `@cometchat/calls-sdk-javascript` ^5.1.1 (calling only) | | Bundled deps | `dompurify`, `@cometchat/cards-react` โ€” regular dependencies, installed automatically. Do not add them yourself | | Init | `CometChatUIKit.init(UIKitSettings)` โ€” must resolve before `login()` | | Login | `CometChatUIKit.login("UID")` โ€” must resolve before rendering components | | Order | `init()` โ†’ `login()` โ†’ render ``. Breaking this order = blank screen | | Auth Key | Dev/testing only. Use Auth Token in production | -| Calling | Optional. Install `@cometchat/calls-sdk-javascript` and call `.setCallingEnabled(true)` on `UIKitSettingsBuilder` | +| Calling | Optional. Install `@cometchat/calls-sdk-javascript` (5.1.1 or later) and call `.setCallingEnabled(true)` on `UIKitSettingsBuilder` | | Offline support | Optional, off by default. Call `.setOfflineConfig({ enabled: true })` on `UIKitSettingsBuilder`. Needs UI Kit 7.3.0 and `@cometchat/chat-sdk-javascript` 4.3.1 or later. See [Offline Support](/ui-kit/react/offline-support) | | Other frameworks | [Next.js](/ui-kit/react/integration-nextjs) ยท [React Router](/ui-kit/react/integration-react-router) ยท [Astro](/ui-kit/react/integration-astro) | @@ -81,7 +81,7 @@ yarn add @cometchat/chat-uikit-react @cometchat/chat-sdk-javascript If you want voice/video calling, also install: ```bash -npm install @cometchat/calls-sdk-javascript +npm install @cometchat/calls-sdk-javascript@^5.1.1 ``` --- diff --git a/ui-kit/react/llms-react-v7.mdx b/ui-kit/react/llms-react-v7.mdx index 98c48b5ff..6c10cbec3 100644 --- a/ui-kit/react/llms-react-v7.mdx +++ b/ui-kit/react/llms-react-v7.mdx @@ -114,6 +114,7 @@ components, theming tokens, or feature enablement. - [Threaded Messages](/ui-kit/react/guide-threaded-messages) - [Message Privately](/ui-kit/react/guide-message-privately) - [Block / Unblock User](/ui-kit/react/guide-block-unblock-user) +- [Custom Call Screens](/ui-kit/react/guide-custom-call-screens) ## Framework recipes (full-page layouts) - React: [Conversation + Messages](/ui-kit/react/react-conversation) ยท [One-to-One / Group](/ui-kit/react/react-one-to-one-chat) ยท [Tab-Based](/ui-kit/react/react-tab-based-chat) diff --git a/ui-kit/react/methods.mdx b/ui-kit/react/methods.mdx index d54958c70..861564371 100644 --- a/ui-kit/react/methods.mdx +++ b/ui-kit/react/methods.mdx @@ -87,6 +87,8 @@ When using `sessionStorage`, configure it in your `UIKitSettingsBuilder` before ``` +With calling enabled, the kit passes the storage mode to the Calls SDK too, unless your `CallAppSettings` sets its own `storageMode`. + Session storage is cleared when the browser tab is closed. Use this mode if you want users to re-authenticate on every new tab/session. @@ -151,6 +153,14 @@ Log out the current user. await CometChatUIKit.logout(); ``` +With calling enabled, a call in this tab ends first, while the Calls SDK still knows the user: + +- A call the user is placing is cancelled. +- A call ringing for the user stops ringing here. Nothing declines it, but leaving the session the kit prepared for it ends a 1:1 call for the caller and the user's other devices too, and the caller's kit records it as unanswered. +- A call the user is in is left. + +The logout waits at most 3 seconds for this, then logs out of the Chat SDK, then the Calls SDK. + **Returns:** `Promise` With [offline support](/ui-kit/react/offline-support) on, logging out also deletes the user's cached data and unsent messages from the device. diff --git a/ui-kit/react/migration-overview.mdx b/ui-kit/react/migration-overview.mdx index 1988b4573..e3ee5193a 100644 --- a/ui-kit/react/migration-overview.mdx +++ b/ui-kit/react/migration-overview.mdx @@ -10,7 +10,7 @@ description: "Migration guide covering breaking changes, architecture shifts, an | --- | --- | | Package | `@cometchat/chat-uikit-react` v6 โ†’ v7 | | React minimum | `>=18.0.0 <21.0.0` | -| SDK peer dep | `@cometchat/chat-sdk-javascript` ^4.2.0 (required by 7.2.x and later) | +| SDK peer dep | `@cometchat/chat-sdk-javascript` ^4.2.1 (required by 7.4.x and later) | | Bundled deps | `dompurify` (new in v7) and `@cometchat/cards-react` (already a dependency since 6.5.0) โ€” installed automatically, not peer deps | | Removed dep | `rxjs` (no longer needed) | | Stylesheet | Delete the v6 `css-variables.css` import โ€” v7 loads its own styles | @@ -42,24 +42,24 @@ v7 is a ground-up rewrite that replaces global singletons with React-native patt ### 1. Update Dependencies ```bash -npm install @cometchat/chat-uikit-react@7 @cometchat/chat-sdk-javascript@^4.2.0 +npm install @cometchat/chat-uikit-react@7 @cometchat/chat-sdk-javascript@^4.2.1 npm uninstall rxjs # No longer needed for CometChat ``` | Package | v6 | v7 | | --- | --- | --- | -| `@cometchat/chat-uikit-react` | `^6.x` | `^7.3.0` | -| `@cometchat/chat-sdk-javascript` | `^4.x` | `^4.2.0` โ€” peer dep, required by 7.2.x and later | +| `@cometchat/chat-uikit-react` | `^6.x` | `^7.4.0` | +| `@cometchat/chat-sdk-javascript` | `^4.x` | `^4.2.1` โ€” peer dep, required by 7.4.x and later | | `react` | `>=18` | `>=18 <21` | | `rxjs` | Required | Not needed โ€” uninstall it | -| `@cometchat/calls-sdk-javascript` | Optional | Optional (unchanged) | +| `@cometchat/calls-sdk-javascript` | Optional | Optional; `^5.1.1` for calling โ€” see [How calls ring](/ui-kit/react/call-features#how-calls-ring) | | `dompurify` | โ€” | Bundled โ€” do **not** install it yourself | | `@cometchat/cards-react` | Bundled (since 6.5.0) | Bundled โ€” do **not** install it yourself | `dompurify` and `@cometchat/cards-react` are regular dependencies of the UI Kit, so npm pulls them in automatically. They are not peer dependencies and do not belong in your `package.json`. -Bump your SDK first. 7.2.x and later declare `@cometchat/chat-sdk-javascript` `^4.2.0`, so staying on a 4.1.x pin fails with `ERESOLVE` โ€” `^4` is not sufficient. Installing `^4.2.0` is safe on every v7 release, including 7.0.x and 7.1.x, whose ranges it also satisfies. +Bump your SDK first. 7.4.x declares `@cometchat/chat-sdk-javascript` `^4.2.1`, so a pin below 4.2.1 fails with `ERESOLVE` โ€” `^4` is not sufficient. Installing `^4.2.1` is safe on every v7 release, including 7.0.x through 7.3.x, whose ranges it also satisfies. **Delete your v6 stylesheet import.** v6 required you to import the base stylesheet yourself: diff --git a/ui-kit/react/migration-property-changes.mdx b/ui-kit/react/migration-property-changes.mdx index 282a51c80..383841b62 100644 --- a/ui-kit/react/migration-property-changes.mdx +++ b/ui-kit/react/migration-property-changes.mdx @@ -294,7 +294,7 @@ A v6 formatter that relied on that inherited behaviour compiles, and then does n | `onSummaryClick` | `() => void` | 7.0.0 | Summary button click | | `onVoiceCallClick` | `(entity: User \| Group) => void` | 7.0.0 | Voice call button click | | `onVideoCallClick` | `(entity: User \| Group) => void` | 7.0.0 | Video call button click | -| `callSettingsBuilder` | `SessionSettings` (typed `any` in the 7.2.4 declarations) | 7.0.0 | Session settings **object** (not a builder function) for calls started from the header, passed unchanged to `CometChatCallButtons` and on to `CometChatOngoingCall` as `callSettings` โ€” see [Message Header](/ui-kit/react/components/message-header#callsettingsbuilder) | +| `callSettingsBuilder` | `SessionSettings` (typed `any` in the 7.2.4 declarations) | 7.0.0 | Session settings **object** (not a builder function) for calls started from the header, passed unchanged to `CometChatCallButtons`, which lays them over the kit's defaults โ€” see [Message Header](/ui-kit/react/components/message-header#callsettingsbuilder) | --- diff --git a/ui-kit/react/overview.mdx b/ui-kit/react/overview.mdx index 02d148101..e9dbbe3be 100644 --- a/ui-kit/react/overview.mdx +++ b/ui-kit/react/overview.mdx @@ -9,7 +9,7 @@ description: "Prebuilt React components for chat, voice, and video calling. Supp | Field | Value | | --- | --- | | Package | `@cometchat/chat-uikit-react` v7.x | -| Peer deps | `react` `>=18 <21`, `react-dom` `>=18 <21`, `@cometchat/chat-sdk-javascript` ^4.2.0; optional `@cometchat/calls-sdk-javascript` ^5.0.3 (calling only) | +| Peer deps | `react` `>=18 <21`, `react-dom` `>=18 <21`, `@cometchat/chat-sdk-javascript` ^4.2.1; optional `@cometchat/calls-sdk-javascript` ^5.1.1 (calling only) | | Bundled deps | `dompurify`, `@cometchat/cards-react` โ€” regular dependencies, installed automatically. Do not add them yourself | | Calling | Optional โ€” `@cometchat/calls-sdk-javascript` | | SSR | SSR-safe โ€” no browser APIs at module scope. Next.js App Router compatible. | @@ -91,20 +91,21 @@ You can find these values in the [CometChat Dashboard](https://app.cometchat.com npm install @cometchat/chat-uikit-react @cometchat/chat-sdk-javascript react react-dom ``` + | Package | Version | Install | |---------|---------|---------| -| `@cometchat/chat-uikit-react` | `^7.3.0` (latest) | Yes | -| `@cometchat/chat-sdk-javascript` | `^4.2.0` | Yes โ€” peer dependency | +| `@cometchat/chat-uikit-react` | `^7.4.0` (latest) | Yes | +| `@cometchat/chat-sdk-javascript` | `^4.2.1` | Yes โ€” peer dependency | | `react` | `>=18.0.0 <21.0.0` | Yes โ€” peer dependency | | `react-dom` | `>=18.0.0 <21.0.0` | Yes โ€” peer dependency | -| `@cometchat/calls-sdk-javascript` | `^5.0.3` | Only for voice/video calling โ€” optional peer dependency | +| `@cometchat/calls-sdk-javascript` | `^5.1.1` | Only for voice/video calling โ€” optional peer dependency | | `dompurify` | `3.3.1` | No โ€” bundled as a regular dependency | | `@cometchat/cards-react` | `~1.0.0` | No โ€” bundled as a regular dependency | `dompurify` and `@cometchat/cards-react` are regular dependencies of the UI Kit, not peer dependencies, so npm installs them for you. Adding them to your own `package.json` is unnecessary and risks pinning a version the UI Kit was not tested against. -The versions above are correct as of `@cometchat/chat-uikit-react@7.3.x`, and `@cometchat/chat-sdk-javascript` `^4.2.0` also satisfies every earlier 7.x release, so it is safe whichever v7 version you are on. If you are pinned to an older SDK for unrelated reasons, the floor rises per release: 7.0.3 needs 4.1.12, 7.1.0 needs 4.1.13, and 7.2.x and 7.3.x need 4.2.0 (offline support additionally needs 4.3.1). The authoritative range is always the `peerDependencies` block of the version you install โ€” check it with `npm view @cometchat/chat-uikit-react@ peerDependencies`. +The versions above are correct as of `@cometchat/chat-uikit-react@7.4.x`, and `@cometchat/chat-sdk-javascript` `^4.2.1` also satisfies every earlier 7.x release, so it is safe whichever v7 version you are on. If you are pinned to an older SDK for unrelated reasons, the floor rises per release: 7.0.3 needs 4.1.12, 7.1.0 needs 4.1.13, 7.2.x and 7.3.x need 4.2.0 (offline support additionally needs 4.3.1), and 7.4.0 needs 4.2.1. 7.4.0 also raises the Calls SDK floor to 5.1.1, because 1:1 calls now ring through the Calls SDK; see [How calls ring](/ui-kit/react/call-features#how-calls-ring). The authoritative range is always the `peerDependencies` block of the version you install โ€” check it with `npm view @cometchat/chat-uikit-react@ peerDependencies`. --- diff --git a/ui-kit/react/troubleshooting.mdx b/ui-kit/react/troubleshooting.mdx index a222552de..56db34313 100644 --- a/ui-kit/react/troubleshooting.mdx +++ b/ui-kit/react/troubleshooting.mdx @@ -202,6 +202,21 @@ Then pass the custom theme name to the provider: ```tsx ``` + +--- + +## Calls + +1:1 calls ring through the Calls SDK 5.1 ringing flow; see [How calls ring](/ui-kit/react/call-features#how-calls-ring). + +| Symptom | Root cause | Solution | +| --- | --- | --- | +| Every 1:1 call fails with `CALLS_SDK_UNAVAILABLE` | The app has the Calls SDK 5.0.x, which has no ringing flow | Install `@cometchat/calls-sdk-javascript` 5.1.1 or later | +| A decline, cancel or no answer shows on the other side a few seconds late | With **Connect legacy ringing** off, no live event reports it. The kit reads the call's status every 3 seconds while it rings | Expected while Connect legacy ringing is off | +| A user on an older app keeps ringing after the caller cancels | The older app is on legacy ringing, and **Connect legacy ringing** is off | Turn on Connect legacy ringing in the dashboard; see [While some users are still on legacy ringing](/calls/javascript/migrating-from-legacy-ringing#while-some-users-are-still-on-legacy-ringing) | +| The callee logs out while the call rings, and the call ends for the caller as unanswered | Logout leaves the session the kit prepared for the call, and the Calls SDK ends a 1:1 call's room when anyone leaves it | Expected. Closing or reloading the callee's tab doesn't end the call: the caller keeps ringing, and the callee's other devices can still answer | +| A call doesn't change the chat's preview or move it up | The app's conversation update settings don't let call activities update conversations | Turn on **Include Call Activities** in the dashboard; see [Calls in the List](/ui-kit/react/components/conversations#calls-in-the-list) | + --- ## Offline Support Does Nothing