Skip to content

Commit 3d567e6

Browse files
maxwellmooney13PureCloud Jenkinsbeizhedenglonghjonzservies
authored
Release/v11.3.3 (#948)
Co-authored-by: PureCloud Jenkins <jenkins@genesys.com> Co-authored-by: Victor <wang_shaojie@icloud.com> Co-authored-by: Jon Hjelle <hjon@users.noreply.github.com> Co-authored-by: Zachary Servies <zachservies@gmail.com> Co-authored-by: Aidan Zimmermann <aidan.zimmermann@genesys.com> Co-authored-by: Aidan Zimmermann <aidan.zimmermann@gmail.com> Co-authored-by: Nils <nils.mak@aginsurance.be>
1 parent a485c21 commit 3d567e6

10 files changed

Lines changed: 122 additions & 8 deletions

changelog.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ All notable changes to this project will be documented in this file.
33
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
44
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
55

6-
# [Unreleased](https://github.com/MyPureCloud/genesys-cloud-webrtc-sdk/compare/v11.3.2...HEAD)
6+
# [Unreleased](https://github.com/MyPureCloud/genesys-cloud-webrtc-sdk/compare/v11.3.3...HEAD)
7+
8+
# [v11.3.3](https://github.com/MyPureCloud/genesys-cloud-webrtc-sdk/compare/v11.3.2...v11.3.3)
9+
#### Changed
10+
* [#937] - Exposes raw webmessage data from conversation topic
711

812
# [v11.3.2](https://github.com/MyPureCloud/genesys-cloud-webrtc-sdk/compare/v11.3.1...v11.3.2)
913
### Changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "genesys-cloud-webrtc-sdk",
3-
"version": "11.3.2",
3+
"version": "11.3.3",
44
"description": "client for the interfacing with Genesys Cloud WebRTC",
55
"repository": "https://github.com/mypurecloud/genesys-cloud-webrtc-sdk",
66
"license": "MIT",

src/client-private.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ export async function proxyStreamingClientEvents (this: GenesysCloudWebrtcSdk):
113113
export const handleConversationUpdate = function (this: GenesysCloudWebrtcSdk, updateEvent: SubscriptionEvent) {
114114
const update = new ConversationUpdate(updateEvent.eventBody);
115115
this.sessionManager.handleConversationUpdate(update);
116+
this.sessionManager.handleConversationUpdateRaw(updateEvent);
116117
};
117118

118119
export const handleDisconnectedEvent = function (this: GenesysCloudWebrtcSdk, eventData: { reconnecting: boolean }) {

src/sessions/base-session-handler.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
IUpdateOutgoingMedia,
1818
IConversationHeldRequest,
1919
IActiveConversationDescription,
20+
SubscriptionEvent,
2021
} from '../types/interfaces';
2122

2223
type ExtendedHTMLAudioElement = HTMLAudioElement & {
@@ -46,6 +47,10 @@ export default abstract class BaseSessionHandler {
4647

4748
abstract handleConversationUpdate (update: ConversationUpdate, sessions: IExtendedMediaSession[]): void;
4849

50+
handleConversationUpdateRaw (update: SubscriptionEvent): void {
51+
this.sdk.emit('conversationUpdateRaw', update);
52+
}
53+
4954
protected log (level: LogLevels, message: any, details?: any, logOptions?: ILogMessageOptions): void {
5055
this.sdk.logger[level].call(this.sdk.logger, message, details, logOptions);
5156
}

src/sessions/session-manager.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ import {
2121
IConversationHeldRequest,
2222
IPendingSessionActionParams,
2323
VideoMediaSession,
24-
IActiveConversationDescription
24+
IActiveConversationDescription,
25+
SubscriptionEvent
2526
} from '../types/interfaces';
2627
import { ConversationUpdate } from '../conversations/conversation-update';
2728
import { SessionTypesAsStrings } from 'genesys-cloud-streaming-client';
@@ -74,6 +75,15 @@ export class SessionManager {
7475
);
7576
}
7677

78+
handleConversationUpdateRaw (update: SubscriptionEvent): void {
79+
/* let each enabled handler process updates */
80+
this.sessionHandlers
81+
.filter(handler => !handler.disabled)
82+
.forEach(handler =>
83+
handler.handleConversationUpdateRaw(update)
84+
);
85+
}
86+
7787
getPendingSession (params: { conversationId?: string, sessionId?: string, sessionType?: SessionTypes | SessionTypesAsStrings }): IPendingSession | undefined {
7888
const session = this.pendingSessions
7989
.find(s => {

src/types/interfaces.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,6 +1020,7 @@ export interface SdkEvents {
10201020
handledPendingSession: ISessionIdAndConversationId;
10211021
cancelPendingSession: ISessionIdAndConversationId;
10221022
conversationUpdate: ISdkConversationUpdateEvent;
1023+
conversationUpdateRaw: SubscriptionEvent;
10231024
station: (event: { action: 'Associated' | 'Disassociated', station: IStation | null }) => void;
10241025
concurrentSoftphoneSessionsEnabled: boolean; // lineAppearence > 1
10251026
resolutionUpdated: IResolutionChange

test/unit/client-private.test.ts

Lines changed: 61 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ describe('setupStreamingClient', () => {
8989

9090
describe('handleConversationUpdate', () => {
9191
it('should call sessionManager.handleConversationUpdate with the transformed event', () => {
92-
mockSdk.sessionManager = { handleConversationUpdate: jest.fn() } as any;
93-
92+
mockSdk.sessionManager = { handleConversationUpdateRaw: jest.fn(), handleConversationUpdate: jest.fn() } as any;
93+
9494
const userId = '444kjskdk';
9595
const participant1 = {
9696
id: '7b809e10-fb79-4420-9d5f-69d232ddf490',
@@ -146,6 +146,65 @@ describe('handleConversationUpdate', () => {
146146
});
147147
});
148148

149+
describe('handleConversationUpdateRaw', () => {
150+
it('should call sessionManager.handleConversationUpdateRaw with the event', () => {
151+
mockSdk.sessionManager = { handleConversationUpdateRaw: jest.fn(), handleConversationUpdate: jest.fn() } as any;
152+
153+
const userId = '444kjskdk';
154+
const participant1 = {
155+
id: '7b809e10-fb79-4420-9d5f-69d232ddf490',
156+
userId: 'dad93e0d-31fa-4fd2-8fc4-d9d3f214ddcf',
157+
purpose: 'user',
158+
videos: [
159+
{
160+
state: CommunicationStates.connected,
161+
id: '5e2bf9b8-c9d5-4975-b89b-756b6bd0b3d5',
162+
context: '5d1130ff978496186c5ce304@conference.test-valve-1ym37mj1kao.orgspan.com',
163+
audioMuted: false,
164+
videoMuted: true,
165+
sharingScreen: false,
166+
peerCount: 0
167+
}
168+
]
169+
};
170+
171+
const local = {
172+
id: '7sdffs-4420-9d5f-69d232ddf490',
173+
userId,
174+
purpose: 'user',
175+
videos: [
176+
{
177+
state: CommunicationStates.connected,
178+
id: '5e2bf9b855125-b89b-756b6bd0b3d5',
179+
context: '5d1130ff978496186c5ce304@conference.test-valve-1ym37mj1kao.orgspan.com',
180+
audioMuted: false,
181+
videoMuted: true,
182+
sharingScreen: false,
183+
peerCount: 0
184+
}
185+
]
186+
};
187+
188+
const event: SubscriptionEvent = {
189+
eventBody: {
190+
id: 'ff5a3ba2-373b-42c7-912a-5309a2656095',
191+
participants: [participant1, local]
192+
},
193+
metadata: {
194+
correlationId: '11l2k31j'
195+
},
196+
topicName: `v2.users.${userId}.coversations`
197+
};
198+
199+
handleConversationUpdate.call(mockSdk, event);
200+
201+
const spy = mockSdk.sessionManager.handleConversationUpdateRaw;
202+
expect(spy).toHaveBeenCalled();
203+
const arg = (spy as jest.Mock).mock.calls[0][0];
204+
expect(arg).toEqual(event);
205+
});
206+
});
207+
149208
describe('handleDisconnectedEvent', () => {
150209
it('should emit disconnected event with message and eventData', () => {
151210
const eventData = { reconnecting: true };

test/unit/sessions/base-session-handler.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,9 @@ describe('handleConversationUpdate', () => {
466466
it('nothing to test', () => {
467467
handler.handleConversationUpdate({} as any, {} as any);
468468
});
469+
it('nothing to test', () => {
470+
handler.handleConversationUpdateRaw({} as any);
471+
});
469472
});
470473

471474
describe('handlePropose', () => {

test/unit/sessions/session-manager.test.ts

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,37 @@ describe('handleConversationUpdate', () => {
141141
});
142142
});
143143

144+
describe('handleConversationUpdateRaw', () => {
145+
it('should find all session that match the sessionType and call the associated handlers', () => {
146+
const conversationId = 'convoid123';
147+
148+
const spy = jest.fn();
149+
const fakeHandler = { handleConversationUpdateRaw: spy, sessionType: SessionTypes.collaborateVideo };
150+
sessionManager.sessionHandlers = [fakeHandler] as any;
151+
152+
const fakeUpdate = {
153+
id: conversationId
154+
};
155+
sessionManager.handleConversationUpdateRaw(fakeUpdate as any);
156+
expect(spy).toBeCalledTimes(1);
157+
expect(spy).toHaveBeenCalledWith(fakeUpdate);
158+
});
159+
160+
it('should not pass update to handler if the handler is disabled', async () => {
161+
const conversationId = 'convoid123';
162+
163+
const spy = jest.fn();
164+
const fakeHandler = { handleConversationUpdateRaw: spy, disabled: true };
165+
sessionManager.sessionHandlers = [fakeHandler] as any;
166+
167+
const fakeUpdate = {
168+
id: conversationId
169+
};
170+
sessionManager.handleConversationUpdateRaw(fakeUpdate as any);
171+
expect(spy).not.toHaveBeenCalled();
172+
});
173+
});
174+
144175
describe('getSession', () => {
145176
let session1: any;
146177
let session2: any;
@@ -913,7 +944,7 @@ describe('validateOutgoingMediaTracks()', () => {
913944
setMediaStateDevices(testDevices);
914945
mediaState = mockSdk.media.getState();
915946

916-
mockGetSessionById = jest.spyOn(sessionManager, 'getSessionBySessionId').mockImplementation((id) => sessions.find(s => s.id === id));
947+
mockGetSessionById = jest.spyOn(sessionManager, 'getSessionBySessionId').mockImplementation((id) => sessions.find(s => s.id === id)!);
917948
mockGetSessionHandler = jest.spyOn(sessionManager, 'getSessionHandler').mockReturnValue(mockSessionHandler as any);
918949
});
919950

0 commit comments

Comments
 (0)