Skip to content

Commit a58c2bf

Browse files
authored
Fix error when listening to spotlight and capabilities events for call with chat adapter (#5066)
* Fix event subscriptions to capabilitiesChanged and spotlightChanged events for AzureCommunicationCallWithChatAdapter * Change files * Update changelog comment * fix wrong unsubscription
1 parent 9a4358a commit a58c2bf

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "patch",
3+
"area": "fix",
4+
"workstream": "CallWithChatAdapter events",
5+
"comment": "Fix error when listening to capabilitiesChanged and spotlightChanged events from AzureCommunicationCallWithChatAdapter",
6+
"packageName": "@azure/communication-react",
7+
"email": "[email protected]",
8+
"dependentChangeType": "patch"
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "patch",
3+
"area": "fix",
4+
"workstream": "CallWithChatAdapter events",
5+
"comment": "Fix error when listening to capabilitiesChanged and spotlightChanged events from AzureCommunicationCallWithChatAdapter",
6+
"packageName": "@azure/communication-react",
7+
"email": "[email protected]",
8+
"dependentChangeType": "patch"
9+
}

packages/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -818,6 +818,12 @@ export class AzureCommunicationCallWithChatAdapter implements CallWithChatAdapte
818818
case 'chatInitialized':
819819
this.emitter.on(event, listener);
820820
break;
821+
case 'capabilitiesChanged':
822+
this.callAdapter.on('capabilitiesChanged', listener);
823+
break;
824+
case 'spotlightChanged':
825+
this.callAdapter.on('spotlightChanged', listener);
826+
break;
821827
default:
822828
throw `Unknown AzureCommunicationCallWithChatAdapter Event: ${event}`;
823829
}
@@ -943,6 +949,12 @@ export class AzureCommunicationCallWithChatAdapter implements CallWithChatAdapte
943949
case 'chatInitialized':
944950
this.emitter.off(event, listener);
945951
break;
952+
case 'capabilitiesChanged':
953+
this.callAdapter.off('capabilitiesChanged', listener);
954+
break;
955+
case 'spotlightChanged':
956+
this.callAdapter.off('spotlightChanged', listener);
957+
break;
946958
default:
947959
throw `Unknown AzureCommunicationCallWithChatAdapter Event: ${event}`;
948960
}

0 commit comments

Comments
 (0)