@webex/plugin-meetings 3.12.0-auth-prejoin-fetch.1 → 3.12.0-llmrefactor.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/aiEnableRequest/index.js +1 -1
  2. package/dist/annotation/index.js +53 -17
  3. package/dist/annotation/index.js.map +1 -1
  4. package/dist/breakouts/breakout.js +1 -1
  5. package/dist/breakouts/index.js +35 -9
  6. package/dist/breakouts/index.js.map +1 -1
  7. package/dist/hashTree/hashTreeParser.js +101 -48
  8. package/dist/hashTree/hashTreeParser.js.map +1 -1
  9. package/dist/interceptors/dataChannelAuthToken.js +41 -59
  10. package/dist/interceptors/dataChannelAuthToken.js.map +1 -1
  11. package/dist/interpretation/index.js +1 -1
  12. package/dist/interpretation/siLanguage.js +1 -1
  13. package/dist/locus-info/index.js +27 -2
  14. package/dist/locus-info/index.js.map +1 -1
  15. package/dist/locus-info/types.js +2 -1
  16. package/dist/locus-info/types.js.map +1 -1
  17. package/dist/meeting/index.js +913 -921
  18. package/dist/meeting/index.js.map +1 -1
  19. package/dist/meeting/util.js +5 -1
  20. package/dist/meeting/util.js.map +1 -1
  21. package/dist/meeting/voicea-meeting.js +2 -1
  22. package/dist/meeting/voicea-meeting.js.map +1 -1
  23. package/dist/meeting-info/meeting-info-v2.js +36 -92
  24. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  25. package/dist/meetings/index.js +33 -93
  26. package/dist/meetings/index.js.map +1 -1
  27. package/dist/meetings/meetings.types.js.map +1 -1
  28. package/dist/types/annotation/index.d.ts +19 -0
  29. package/dist/types/hashTree/hashTreeParser.d.ts +12 -0
  30. package/dist/types/locus-info/index.d.ts +6 -0
  31. package/dist/types/locus-info/types.d.ts +1 -0
  32. package/dist/types/meeting/index.d.ts +47 -20
  33. package/dist/types/meeting/util.d.ts +3 -1
  34. package/dist/types/meeting-info/meeting-info-v2.d.ts +1 -24
  35. package/dist/types/meetings/index.d.ts +2 -13
  36. package/dist/types/meetings/meetings.types.d.ts +1 -15
  37. package/dist/webinar/index.js +298 -255
  38. package/dist/webinar/index.js.map +1 -1
  39. package/package.json +21 -21
  40. package/src/annotation/index.ts +55 -25
  41. package/src/breakouts/index.ts +33 -11
  42. package/src/hashTree/hashTreeParser.ts +67 -3
  43. package/src/interceptors/dataChannelAuthToken.ts +48 -77
  44. package/src/locus-info/index.ts +20 -0
  45. package/src/locus-info/types.ts +1 -0
  46. package/src/meeting/index.ts +318 -332
  47. package/src/meeting/util.ts +2 -2
  48. package/src/meeting/voicea-meeting.ts +1 -1
  49. package/src/meeting-info/meeting-info-v2.ts +18 -74
  50. package/src/meetings/index.ts +6 -70
  51. package/src/meetings/meetings.types.ts +1 -17
  52. package/src/webinar/index.ts +168 -188
  53. package/test/unit/spec/annotation/index.ts +214 -182
  54. package/test/unit/spec/breakouts/index.ts +126 -25
  55. package/test/unit/spec/hashTree/hashTreeParser.ts +212 -1
  56. package/test/unit/spec/interceptors/dataChannelAuthToken.ts +81 -99
  57. package/test/unit/spec/locus-info/index.js +79 -0
  58. package/test/unit/spec/meeting/index.js +979 -701
  59. package/test/unit/spec/meeting/utils.js +16 -2
  60. package/test/unit/spec/meeting/voicea-meeting.ts +85 -1
  61. package/test/unit/spec/meeting-info/meetinginfov2.js +0 -210
  62. package/test/unit/spec/meetings/index.js +5 -231
  63. package/test/unit/spec/webinar/index.ts +886 -718
@@ -75,7 +75,7 @@ describe('plugin-meetings', () => {
75
75
  });
76
76
 
77
77
  describe('#cleanup', () => {
78
- it('do clean up on meeting object with LLM enabled', async () => {
78
+ it('cleans up an LLM-enabled meeting while preserving Voicea by default', async () => {
79
79
  meeting.config = {enableAutomaticLLM: true};
80
80
  await MeetingUtil.cleanUp(meeting);
81
81
  assert.calledOnce(meeting.cleanupLocalStreams);
@@ -87,7 +87,10 @@ describe('plugin-meetings', () => {
87
87
  assert.calledOnce(meeting.unsetPeerConnections);
88
88
  assert.calledOnce(meeting.reconnectionManager.cleanUp);
89
89
  assert.calledOnce(meeting.stopKeepAlive);
90
- assert.calledOnceWithExactly(meeting.cleanupLLMConneciton, {throwOnError: false});
90
+ assert.calledOnceWithExactly(meeting.cleanupLLMConneciton, {
91
+ throwOnError: false,
92
+ preserveVoiceaChannel: true,
93
+ });
91
94
  assert.calledOnce(meeting.breakouts.cleanUp);
92
95
  assert.calledOnce(meeting.simultaneousInterpretation.cleanUp);
93
96
  assert.calledOnce(meeting.locusInfo.cleanUp);
@@ -98,6 +101,17 @@ describe('plugin-meetings', () => {
98
101
  );
99
102
  });
100
103
 
104
+ it('cleans up an LLM-enabled meeting without preserving Voicea when requested', async () => {
105
+ meeting.config = {enableAutomaticLLM: true};
106
+
107
+ await MeetingUtil.cleanUp(meeting, {preserveVoiceaChannel: false});
108
+
109
+ assert.calledOnceWithExactly(meeting.cleanupLLMConneciton, {
110
+ throwOnError: false,
111
+ preserveVoiceaChannel: false,
112
+ });
113
+ });
114
+
101
115
  it('do clean up on meeting object with LLM disabled', async () => {
102
116
  meeting.config = {enableAutomaticLLM: false};
103
117
  await MeetingUtil.cleanUp(meeting);
@@ -150,6 +150,90 @@ describe('plugin-meetings', () => {
150
150
  });
151
151
 
152
152
  describe('processNewCaptions', () => {
153
+ const processCaptions = () => processNewCaptions({
154
+ data: fakeVoiceaPayload,
155
+ meeting: fakeMeeting
156
+ });
157
+
158
+ it('should process a final-only caption without an existing interim caption', () => {
159
+ const transcriptData = fakeMeeting.transcription;
160
+ const transcriptId = fakeVoiceaPayload.transcriptId;
161
+
162
+ delete transcriptData.interimCaptions[transcriptId];
163
+
164
+ assert.doesNotThrow(processCaptions);
165
+
166
+ const finalCaption = transcriptData.captions.find(caption => caption.id === transcriptId);
167
+
168
+ assert.exists(finalCaption);
169
+ assert.deepEqual(transcriptData.interimCaptions[transcriptId], []);
170
+ });
171
+
172
+ it('should process an interim caption received after a final caption', () => {
173
+ const transcriptData = fakeMeeting.transcription;
174
+ const transcriptId = fakeVoiceaPayload.transcriptId;
175
+
176
+ delete transcriptData.interimCaptions[transcriptId];
177
+
178
+ assert.doesNotThrow(processCaptions);
179
+
180
+ fakeVoiceaPayload.isFinal = false;
181
+
182
+ assert.doesNotThrow(processCaptions);
183
+
184
+ const speakerId = fakeMeeting.members.membersCollection.members[fakeMemberId].participant.person.id;
185
+ const interimId = `${transcriptId}_${speakerId}`;
186
+
187
+ assert.exists(transcriptData.captions.find(caption => caption.id === transcriptId));
188
+ assert.exists(transcriptData.captions.find(caption => caption.id === interimId));
189
+ assert.deepEqual(transcriptData.interimCaptions[transcriptId], [interimId]);
190
+ });
191
+
192
+ it('should process repeated final captions without throwing', () => {
193
+ const transcriptData = fakeMeeting.transcription;
194
+ const transcriptId = fakeVoiceaPayload.transcriptId;
195
+
196
+ delete transcriptData.interimCaptions[transcriptId];
197
+
198
+ assert.doesNotThrow(() => {
199
+ processCaptions();
200
+ processCaptions();
201
+ });
202
+
203
+ assert.exists(transcriptData.captions.find(caption => caption.id === transcriptId));
204
+ });
205
+
206
+ it('should process a final payload containing transcript entries for multiple CSIs without throwing', () => {
207
+ const transcriptData = fakeMeeting.transcription;
208
+ const transcriptId = fakeVoiceaPayload.transcriptId;
209
+ const firstCsi = 1234867712;
210
+ const secondCsi = 1234867713;
211
+ const secondCaptionText = 'Caption from a second CSI';
212
+
213
+ fakeVoiceaPayload.transcripts = [
214
+ {
215
+ ...fakeVoiceaPayload.transcripts[0],
216
+ csis: [firstCsi]
217
+ },
218
+ {
219
+ text: secondCaptionText,
220
+ csis: [secondCsi],
221
+ transcript_language_code: 'en'
222
+ }
223
+ ];
224
+
225
+ assert.doesNotThrow(processCaptions);
226
+
227
+ const finalCaptionTexts = transcriptData.captions
228
+ .filter(caption => caption.id === transcriptId)
229
+ .map(caption => caption.text);
230
+
231
+ assert.deepEqual(finalCaptionTexts, [
232
+ fakeVoiceaPayload.transcripts[0].text,
233
+ secondCaptionText
234
+ ]);
235
+ });
236
+
153
237
  it('should process new final captions correctly', () => {
154
238
  let transcriptData = fakeMeeting.transcription;
155
239
  let transcriptId = fakeVoiceaPayload.transcriptId;
@@ -254,4 +338,4 @@ describe('plugin-meetings', () => {
254
338
  });
255
339
  });
256
340
  });
257
- });
341
+ });
@@ -486,216 +486,6 @@ describe('plugin-meetings', () => {
486
486
  MeetingInfoUtil.getDirectMeetingInfoURI.restore();
487
487
  });
488
488
 
489
- it('should fetch and normalize preJoin meeting info with pre-meeting CA identifiers', async () => {
490
- const correlationId = 'correlation-id';
491
- const sessionCorrelationId = 'session-correlation-id';
492
- const meetingInfoBody = {
493
- meetingKey: '1234323',
494
- meetingId: 'global-meeting-id',
495
- confID: 'conference-id',
496
- };
497
- const requestResponse = {
498
- statusCode: 200,
499
- url: 'https://example.webex.com/wbxappapi/v1/preJoin',
500
- body: {meetingInfo: meetingInfoBody, guestJWT: 'not-consumed-by-meetings'},
501
- };
502
-
503
- webex.request.resolves(requestResponse);
504
-
505
- const preJoinMeetingInfo = MeetingInfo.createPreJoinProvider(webex, {
506
- correlationId,
507
- sessionCorrelationId,
508
- });
509
-
510
- const result = await preJoinMeetingInfo.fetchMeetingInfo(
511
- '1234323',
512
- DESTINATION_TYPE.MEETING_ID,
513
- null,
514
- null,
515
- null,
516
- null,
517
- {correlationId, joinTXId: 'join-transaction-id'},
518
- {sendCAevents: true}
519
- );
520
-
521
- assert.calledWith(webex.request, {
522
- method: 'POST',
523
- service: WBXAPPAPI_SERVICE,
524
- resource: 'preJoin',
525
- headers: {correlationId},
526
- body: {
527
- supportHostKey: true,
528
- supportCountryList: true,
529
- meetingKey: '1234323',
530
- joinTXId: 'join-transaction-id',
531
- disableWebRedirect: true,
532
- },
533
- });
534
- assert.deepEqual(result, {...requestResponse, body: meetingInfoBody});
535
- assert.deepEqual(webex.internal.newMetrics.submitClientEvent.firstCall.args[0], {
536
- name: 'client.meetinginfo.request',
537
- options: {
538
- correlationId,
539
- sessionCorrelationId,
540
- meetingJoinPhase: 'pre-join',
541
- },
542
- });
543
- assert.deepEqual(webex.internal.newMetrics.submitClientEvent.secondCall.args[0], {
544
- name: 'client.meetinginfo.response',
545
- payload: {
546
- identifiers: {meetingLookupUrl: requestResponse.url},
547
- },
548
- options: {
549
- correlationId,
550
- sessionCorrelationId,
551
- meetingJoinPhase: 'pre-join',
552
- webexConferenceIdStr: meetingInfoBody.confID,
553
- globalMeetingId: meetingInfoBody.meetingId,
554
- },
555
- });
556
- });
557
-
558
- it('should use the direct preJoin uri when the destination resolves to a Webex site', async () => {
559
- const correlationId = 'correlation-id';
560
- const body = {meetingKey: '1234323'};
561
- const meetingInfoBody = {meetingKey: '1234323'};
562
-
563
- sinon.stub(MeetingInfoUtil, 'getDestinationType').returns(
564
- Promise.resolve({
565
- type: DESTINATION_TYPE.SIP_URI,
566
- destination: 'example@something.webex.com',
567
- })
568
- );
569
- sinon.stub(MeetingInfoUtil, 'getRequestBody').returns(Promise.resolve(body));
570
- sinon
571
- .stub(MeetingInfoUtil, 'getDirectMeetingInfoURI')
572
- .returns('https://something.webex.com/wbxappapi/v1/meetingInfo');
573
- webex.request.resolves({statusCode: 200, body: {meetingInfo: meetingInfoBody}});
574
-
575
- const preJoinMeetingInfo = MeetingInfo.createPreJoinProvider(webex, {correlationId});
576
-
577
- const result = await preJoinMeetingInfo.fetchMeetingInfo(
578
- 'example@something.webex.com',
579
- DESTINATION_TYPE.SIP_URI,
580
- null,
581
- null,
582
- null,
583
- null,
584
- {}
585
- );
586
-
587
- assert.calledWith(webex.request, {
588
- method: 'POST',
589
- uri: 'https://something.webex.com/wbxappapi/v1/preJoin',
590
- headers: {correlationId},
591
- body,
592
- });
593
- assert.deepEqual(result.body, meetingInfoBody);
594
- });
595
-
596
- it('should keep using preJoin and its request context for subsequent provider requests', async () => {
597
- const correlationId = 'correlation-id';
598
- const meetingInfoBody = {meetingKey: '1234323'};
599
- const preJoinProvider = MeetingInfo.createPreJoinProvider(webex, {correlationId});
600
-
601
- webex.request.resolves({statusCode: 200, body: {meetingInfo: meetingInfoBody}});
602
-
603
- await preJoinProvider.fetchMeetingInfo('1234323', DESTINATION_TYPE.MEETING_ID);
604
- await preJoinProvider.fetchMeetingInfo('1234323', DESTINATION_TYPE.MEETING_ID, 'password');
605
-
606
- assert.calledTwice(webex.request);
607
- forEach(webex.request.args, ([requestOptions]) => {
608
- assert.equal(requestOptions.resource, 'preJoin');
609
- assert.deepEqual(requestOptions.headers, {correlationId});
610
- });
611
- });
612
-
613
- it('should preserve preJoin meeting info on password errors', async () => {
614
- const preJoinMeetingInfo = {meetingKey: '1234323'};
615
- const preJoinProvider = MeetingInfo.createPreJoinProvider(webex, {
616
- correlationId: 'correlation-id',
617
- });
618
-
619
- webex.request.rejects({
620
- statusCode: 403,
621
- body: {code: 403000, meetingInfo: preJoinMeetingInfo},
622
- });
623
-
624
- try {
625
- await preJoinProvider.fetchMeetingInfo(
626
- '1234323',
627
- DESTINATION_TYPE.MEETING_ID,
628
- null,
629
- null,
630
- null,
631
- null,
632
- {}
633
- );
634
- assert.fail('fetchMeetingInfo should have thrown, but has not done that');
635
- } catch (error) {
636
- assert.instanceOf(error, MeetingInfoV2PasswordError);
637
- assert.deepEqual(error.meetingInfo, preJoinMeetingInfo);
638
- }
639
- });
640
-
641
- forEach(
642
- [
643
- {errorCode: 403049, ErrorType: MeetingInfoV2PolicyError},
644
- {errorCode: 403022, ErrorType: MeetingInfoV2JoinWebinarError},
645
- {errorCode: 403003, ErrorType: MeetingInfoV2JoinForbiddenError},
646
- ],
647
- ({errorCode, ErrorType}) => {
648
- it(`should preserve preJoin meeting info for semantic error ${errorCode}`, async () => {
649
- const preJoinMeetingInfo = {meetingKey: '1234323'};
650
- const preJoinProvider = MeetingInfo.createPreJoinProvider(webex, {
651
- correlationId: 'correlation-id',
652
- });
653
-
654
- webex.request.rejects({
655
- statusCode: 403,
656
- body: {code: errorCode, message: 'semantic error', meetingInfo: preJoinMeetingInfo},
657
- });
658
-
659
- try {
660
- await preJoinProvider.fetchMeetingInfo(
661
- '1234323',
662
- DESTINATION_TYPE.MEETING_ID,
663
- null,
664
- null,
665
- null,
666
- null,
667
- {}
668
- );
669
- assert.fail('fetchMeetingInfo should have thrown, but has not done that');
670
- } catch (error) {
671
- assert.instanceOf(error, ErrorType);
672
- assert.deepEqual(error.meetingInfo, preJoinMeetingInfo);
673
- }
674
- });
675
- }
676
- );
677
-
678
- it('should reject a preJoin success response without meetingInfo', async () => {
679
- webex.request.resolves({statusCode: 200, body: {}});
680
-
681
- const preJoinProvider = MeetingInfo.createPreJoinProvider(webex, {
682
- correlationId: 'correlation-id',
683
- });
684
-
685
- await assert.isRejected(
686
- preJoinProvider.fetchMeetingInfo(
687
- '1234323',
688
- DESTINATION_TYPE.MEETING_ID,
689
- null,
690
- null,
691
- null,
692
- null,
693
- {}
694
- ),
695
- 'PreJoin response did not include meetingInfo'
696
- );
697
- });
698
-
699
489
  it('should fetch meeting info with provided password and captcha code', async () => {
700
490
  const requestResponse = {statusCode: 200, body: {meetingKey: '1234323'}};
701
491
 
@@ -16,7 +16,6 @@ import LoggerProxy from '@webex/plugin-meetings/src/common/logs/logger-proxy';
16
16
  import LoggerConfig from '@webex/plugin-meetings/src/common/logs/logger-config';
17
17
  import ParameterError from '@webex/plugin-meetings/src/common/errors/parameter';
18
18
  import Meeting, {CallStateForMetrics} from '@webex/plugin-meetings/src/meeting';
19
- import MeetingInfoV2 from '@webex/plugin-meetings/src/meeting-info/meeting-info-v2';
20
19
  import {Services} from '@webex/webex-core';
21
20
  import MeetingUtil from '@webex/plugin-meetings/src/meeting/util';
22
21
  import Meetings from '@webex/plugin-meetings/src/meetings';
@@ -143,6 +142,7 @@ describe('plugin-meetings', () => {
143
142
 
144
143
  Object.assign(webex.internal, {
145
144
  llm: {on: sinon.stub()},
145
+ voicea: {createChannel: sinon.stub().returns({})},
146
146
  device: {
147
147
  deviceType: 'FAKE_DEVICE',
148
148
  register: sinon.stub().returns(Promise.resolve()),
@@ -240,6 +240,10 @@ describe('plugin-meetings', () => {
240
240
 
241
241
  webex.meetings.destroy(meeting, test1);
242
242
 
243
+ assert.calledOnceWithExactly(MeetingUtil.cleanUp, meeting, {
244
+ preserveVoiceaChannel: false,
245
+ });
246
+
243
247
  // and it should still return the information after the meeting is destroyed
244
248
  assert.equal(
245
249
  webex.meetings.getBasicMeetingInformation(meetingIds.meetingId).id,
@@ -1860,73 +1864,6 @@ describe('plugin-meetings', () => {
1860
1864
  });
1861
1865
  });
1862
1866
  });
1863
- describe('#prefetchMeetingInfo', () => {
1864
- it('starts a reusable preJoin request without creating a Meeting', async () => {
1865
- const response = {body: {meetingJoinUrl: 'meeting-join-url'}};
1866
- const preJoinContext = {
1867
- correlationId: 'correlation-id',
1868
- sessionCorrelationId: 'session-correlation-id',
1869
- };
1870
-
1871
- const preJoinProvider = {fetchMeetingInfo: sinon.stub().resolves(response)};
1872
- const createPreJoinProvider = sinon
1873
- .stub(MeetingInfoV2, 'createPreJoinProvider')
1874
- .returns(preJoinProvider);
1875
- const createMeeting = sinon.stub(webex.meetings, 'createMeeting');
1876
-
1877
- const prefetchedMeetingInfo = webex.meetings.prefetchMeetingInfo({
1878
- destination: 'test destination',
1879
- type: DESTINATION_TYPE.MEETING_ID,
1880
- extraParams: {joinTXId: 'join-transaction-id'},
1881
- preJoinContext,
1882
- classificationId: 'classification-id',
1883
- });
1884
-
1885
- assert.calledOnceWithExactly(createPreJoinProvider, webex, preJoinContext);
1886
- assert.calledOnceWithExactly(
1887
- preJoinProvider.fetchMeetingInfo,
1888
- 'test destination',
1889
- DESTINATION_TYPE.MEETING_ID,
1890
- null,
1891
- null,
1892
- undefined,
1893
- null,
1894
- {joinTXId: 'join-transaction-id'},
1895
- {sendCAevents: true},
1896
- null,
1897
- null,
1898
- 'classification-id'
1899
- );
1900
- assert.deepEqual(await prefetchedMeetingInfo.request, response);
1901
- assert.deepEqual(prefetchedMeetingInfo, {
1902
- request: prefetchedMeetingInfo.request,
1903
- provider: preJoinProvider,
1904
- extraParams: {joinTXId: 'join-transaction-id'},
1905
- });
1906
- assert.notCalled(createMeeting);
1907
- });
1908
-
1909
- it('uses AppAPI for preJoin when unified meetings is not enabled yet', async () => {
1910
- const response = {body: {meetingJoinUrl: 'meeting-join-url'}};
1911
- const legacyFetchMeetingInfo = sinon.stub().resolves(response);
1912
- const appApiFetchMeetingInfo = sinon
1913
- .stub(MeetingInfoV2.prototype, 'fetchMeetingInfo')
1914
- .resolves(response);
1915
-
1916
- webex.meetings.meetingInfo = {fetchMeetingInfo: legacyFetchMeetingInfo};
1917
-
1918
- const prefetchedMeetingInfo = webex.meetings.prefetchMeetingInfo({
1919
- destination: 'test destination',
1920
- type: DESTINATION_TYPE.MEETING_ID,
1921
- preJoinContext: {correlationId: 'correlation-id'},
1922
- });
1923
-
1924
- assert.deepEqual(await prefetchedMeetingInfo.request, response);
1925
- assert.instanceOf(prefetchedMeetingInfo.provider, MeetingInfoV2);
1926
- assert.notCalled(legacyFetchMeetingInfo);
1927
- assert.calledOnce(appApiFetchMeetingInfo);
1928
- });
1929
- });
1930
1867
  describe('#create', () => {
1931
1868
  let infoOptions;
1932
1869
 
@@ -2129,77 +2066,6 @@ describe('plugin-meetings', () => {
2129
2066
  });
2130
2067
  });
2131
2068
 
2132
- it('consumes a prefetched request for an existing meeting without meeting info', async () => {
2133
- const prefetchedMeetingInfo = {
2134
- request: Promise.resolve({body: {meetingJoinUrl: 'meeting-join-url'}}),
2135
- provider: webex.meetings.meetingInfo,
2136
- extraParams: {},
2137
- };
2138
- const fakeMeeting = {
2139
- meetingInfo: {},
2140
- updateCallStateForMetrics: sinon.stub(),
2141
- consumePrefetchedMeetingInfo: sinon.stub().resolves(),
2142
- };
2143
-
2144
- webex.meetings.meetingCollection.getByKey = sinon.stub().returns(fakeMeeting);
2145
-
2146
- const meeting = await webex.meetings.create(
2147
- test1,
2148
- test2,
2149
- FAKE_USE_RANDOM_DELAY,
2150
- {},
2151
- correlationId,
2152
- true,
2153
- callStateForMetrics,
2154
- undefined,
2155
- undefined,
2156
- sessionCorrelationId,
2157
- classificationId,
2158
- prefetchedMeetingInfo
2159
- );
2160
-
2161
- assert.equal(meeting, fakeMeeting);
2162
- assert.calledOnceWithExactly(
2163
- fakeMeeting.consumePrefetchedMeetingInfo,
2164
- prefetchedMeetingInfo
2165
- );
2166
- assert.notCalled(webex.meetings.createMeeting);
2167
- });
2168
-
2169
- it('keeps an existing populated meeting instead of applying a prefetched response', async () => {
2170
- const prefetchedMeetingInfo = {
2171
- request: Promise.resolve({body: {meetingJoinUrl: 'meeting-join-url'}}),
2172
- provider: webex.meetings.meetingInfo,
2173
- extraParams: {},
2174
- };
2175
- const fakeMeeting = {
2176
- meetingInfo: {meetingJoinUrl: 'existing-meeting-join-url'},
2177
- updateCallStateForMetrics: sinon.stub(),
2178
- consumePrefetchedMeetingInfo: sinon.stub(),
2179
- };
2180
-
2181
- webex.meetings.meetingCollection.getByKey = sinon.stub().returns(fakeMeeting);
2182
-
2183
- const meeting = await webex.meetings.create(
2184
- test1,
2185
- test2,
2186
- FAKE_USE_RANDOM_DELAY,
2187
- {},
2188
- correlationId,
2189
- true,
2190
- callStateForMetrics,
2191
- undefined,
2192
- undefined,
2193
- sessionCorrelationId,
2194
- classificationId,
2195
- prefetchedMeetingInfo
2196
- );
2197
-
2198
- assert.equal(meeting, fakeMeeting);
2199
- assert.notCalled(fakeMeeting.consumePrefetchedMeetingInfo);
2200
- assert.notCalled(webex.meetings.createMeeting);
2201
- });
2202
-
2203
2069
  const checkCallCreateMeeting = async (createParameters, createMeetingParameters) => {
2204
2070
  const create = webex.meetings.create(...createParameters);
2205
2071
 
@@ -2961,98 +2827,6 @@ describe('plugin-meetings', () => {
2961
2827
  );
2962
2828
  });
2963
2829
 
2964
- it('accepts a prefetched response and keeps using preJoin for later requests', async () => {
2965
- const callState = {
2966
- correlationId: 'correlation-id',
2967
- sessionCorrelationId: 'session-correlation-id',
2968
- loginType: 'reuse-ci-token',
2969
- joinFlowVersion: 'NewFTE',
2970
- };
2971
- const permissionToken =
2972
- 'eyJhbGciOiJIUzI1NiJ9.eyJleHAiOiIxMjM0NTYiLCJwZXJtaXNzaW9uIjp7InVzZXJQb2xpY2llcyI6eyJhIjp0cnVlfX19.wkTk0Hp8sUlq2wi2nP4-Ym4Xb7aEUHzyXA1kzk6f0V0';
2973
- const preJoinProvider = {fetchMeetingInfo: sinon.stub()};
2974
- const prefetchedMeetingInfo = {
2975
- extraParams: {joinTXId: 'join-transaction-id'},
2976
- provider: preJoinProvider,
2977
- request: Promise.resolve({
2978
- body: {
2979
- permissionToken,
2980
- meetingJoinUrl: 'meetingJoinUrl',
2981
- },
2982
- }),
2983
- };
2984
-
2985
- const meeting = await webex.meetings.createMeeting(
2986
- 'test destination',
2987
- 'test type',
2988
- false,
2989
- {},
2990
- callState,
2991
- false,
2992
- undefined,
2993
- undefined,
2994
- undefined,
2995
- prefetchedMeetingInfo
2996
- );
2997
-
2998
- assert.notCalled(webex.meetings.meetingInfo.fetchMeetingInfo);
2999
- assert.equal(meeting.meetingJoinUrl, 'meetingJoinUrl');
3000
- assert.equal(meeting.permissionToken, permissionToken);
3001
- assert.deepEqual(meeting.selfUserPolicies, {a: true});
3002
- assert.equal(meeting.attrs.meetingInfoProvider, preJoinProvider);
3003
-
3004
- preJoinProvider.fetchMeetingInfo.resolves({
3005
- body: {meetingJoinUrl: 'refreshed-meetingJoinUrl', permissionToken},
3006
- });
3007
-
3008
- await meeting.refreshPermissionToken('test');
3009
-
3010
- assert.calledOnceWithExactly(
3011
- preJoinProvider.fetchMeetingInfo,
3012
- 'test destination',
3013
- 'test type',
3014
- null,
3015
- null,
3016
- undefined,
3017
- meeting.locusId,
3018
- {joinTXId: 'join-transaction-id', permissionToken},
3019
- {
3020
- meetingId: meeting.id,
3021
- sendCAevents: true,
3022
- correlationId: meeting.correlationId,
3023
- },
3024
- null,
3025
- null,
3026
- null
3027
- );
3028
-
3029
- preJoinProvider.fetchMeetingInfo.resetHistory();
3030
- preJoinProvider.fetchMeetingInfo.resolves({
3031
- body: {meetingJoinUrl: 'updated-meetingJoinUrl', permissionToken},
3032
- });
3033
-
3034
- await meeting.fetchMeetingInfo({sendCAevents: true});
3035
-
3036
- assert.calledOnceWithExactly(
3037
- preJoinProvider.fetchMeetingInfo,
3038
- 'test destination',
3039
- 'test type',
3040
- null,
3041
- null,
3042
- undefined,
3043
- meeting.locusId,
3044
- {},
3045
- {
3046
- meetingId: meeting.id,
3047
- sendCAevents: true,
3048
- correlationId: meeting.correlationId,
3049
- },
3050
- null,
3051
- null,
3052
- null
3053
- );
3054
- });
3055
-
3056
2830
  it('accepts injected meeting info with meeting lookup url', async () => {
3057
2831
  const meetingInfo = {
3058
2832
  permissionToken: