@webex/plugin-meetings 3.11.0-webex-services-ready.1 → 3.12.0-llmrefactor.1

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 (294) hide show
  1. package/AGENTS.md +9 -0
  2. package/dist/aiEnableRequest/index.js +197 -0
  3. package/dist/aiEnableRequest/index.js.map +1 -0
  4. package/dist/aiEnableRequest/utils.js +36 -0
  5. package/dist/aiEnableRequest/utils.js.map +1 -0
  6. package/dist/annotation/index.js +58 -13
  7. package/dist/annotation/index.js.map +1 -1
  8. package/dist/breakouts/breakout.js +8 -3
  9. package/dist/breakouts/breakout.js.map +1 -1
  10. package/dist/breakouts/events.js +29 -14
  11. package/dist/breakouts/events.js.map +1 -1
  12. package/dist/breakouts/index.js +124 -7
  13. package/dist/breakouts/index.js.map +1 -1
  14. package/dist/common/errors/webex-errors.js +49 -5
  15. package/dist/common/errors/webex-errors.js.map +1 -1
  16. package/dist/config.js +8 -3
  17. package/dist/config.js.map +1 -1
  18. package/dist/constants.js +60 -11
  19. package/dist/constants.js.map +1 -1
  20. package/dist/controls-options-manager/constants.js +11 -1
  21. package/dist/controls-options-manager/constants.js.map +1 -1
  22. package/dist/controls-options-manager/index.js +67 -29
  23. package/dist/controls-options-manager/index.js.map +1 -1
  24. package/dist/controls-options-manager/util.js +91 -0
  25. package/dist/controls-options-manager/util.js.map +1 -1
  26. package/dist/hashTree/constants.js +16 -2
  27. package/dist/hashTree/constants.js.map +1 -1
  28. package/dist/hashTree/hashTree.js +18 -0
  29. package/dist/hashTree/hashTree.js.map +1 -1
  30. package/dist/hashTree/hashTreeParser.js +1655 -538
  31. package/dist/hashTree/hashTreeParser.js.map +1 -1
  32. package/dist/hashTree/types.js +4 -2
  33. package/dist/hashTree/types.js.map +1 -1
  34. package/dist/hashTree/utils.js +52 -0
  35. package/dist/hashTree/utils.js.map +1 -1
  36. package/dist/index.js +18 -2
  37. package/dist/index.js.map +1 -1
  38. package/dist/interceptors/constant.js +12 -0
  39. package/dist/interceptors/constant.js.map +1 -0
  40. package/dist/interceptors/dataChannelAuthToken.js +332 -0
  41. package/dist/interceptors/dataChannelAuthToken.js.map +1 -0
  42. package/dist/interceptors/index.js +7 -0
  43. package/dist/interceptors/index.js.map +1 -1
  44. package/dist/interceptors/locusRetry.js +23 -8
  45. package/dist/interceptors/locusRetry.js.map +1 -1
  46. package/dist/interceptors/utils.js +27 -0
  47. package/dist/interceptors/utils.js.map +1 -0
  48. package/dist/interpretation/index.js +11 -2
  49. package/dist/interpretation/index.js.map +1 -1
  50. package/dist/interpretation/interpretation.types.js +7 -0
  51. package/dist/interpretation/interpretation.types.js.map +1 -0
  52. package/dist/interpretation/siLanguage.js +1 -1
  53. package/dist/locus-info/controlsUtils.js +9 -4
  54. package/dist/locus-info/controlsUtils.js.map +1 -1
  55. package/dist/locus-info/index.js +914 -212
  56. package/dist/locus-info/index.js.map +1 -1
  57. package/dist/locus-info/infoUtils.js +36 -5
  58. package/dist/locus-info/infoUtils.js.map +1 -1
  59. package/dist/locus-info/selfUtils.js +1 -0
  60. package/dist/locus-info/selfUtils.js.map +1 -1
  61. package/dist/locus-info/types.js +19 -0
  62. package/dist/locus-info/types.js.map +1 -1
  63. package/dist/media/MediaConnectionAwaiter.js +72 -3
  64. package/dist/media/MediaConnectionAwaiter.js.map +1 -1
  65. package/dist/media/index.js +8 -2
  66. package/dist/media/index.js.map +1 -1
  67. package/dist/media/properties.js +8 -7
  68. package/dist/media/properties.js.map +1 -1
  69. package/dist/meeting/in-meeting-actions.js +11 -1
  70. package/dist/meeting/in-meeting-actions.js.map +1 -1
  71. package/dist/meeting/index.js +2286 -1129
  72. package/dist/meeting/index.js.map +1 -1
  73. package/dist/meeting/locusMediaRequest.js +229 -82
  74. package/dist/meeting/locusMediaRequest.js.map +1 -1
  75. package/dist/meeting/muteState.js +10 -1
  76. package/dist/meeting/muteState.js.map +1 -1
  77. package/dist/meeting/request.js +55 -2
  78. package/dist/meeting/request.js.map +1 -1
  79. package/dist/meeting/request.type.js.map +1 -1
  80. package/dist/meeting/util.js +168 -5
  81. package/dist/meeting/util.js.map +1 -1
  82. package/dist/meeting-info/meeting-info-v2.js +2 -2
  83. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  84. package/dist/meetings/index.js +369 -162
  85. package/dist/meetings/index.js.map +1 -1
  86. package/dist/meetings/meetings.types.js +6 -1
  87. package/dist/meetings/meetings.types.js.map +1 -1
  88. package/dist/meetings/request.js +39 -0
  89. package/dist/meetings/request.js.map +1 -1
  90. package/dist/meetings/util.js +116 -18
  91. package/dist/meetings/util.js.map +1 -1
  92. package/dist/member/index.js +20 -0
  93. package/dist/member/index.js.map +1 -1
  94. package/dist/member/types.js.map +1 -1
  95. package/dist/member/util.js +40 -0
  96. package/dist/member/util.js.map +1 -1
  97. package/dist/members/index.js +101 -43
  98. package/dist/members/index.js.map +1 -1
  99. package/dist/members/util.js +8 -1
  100. package/dist/members/util.js.map +1 -1
  101. package/dist/metrics/constants.js +12 -1
  102. package/dist/metrics/constants.js.map +1 -1
  103. package/dist/multistream/codec/constants.js +63 -0
  104. package/dist/multistream/codec/constants.js.map +1 -0
  105. package/dist/multistream/mediaRequestManager.js +64 -68
  106. package/dist/multistream/mediaRequestManager.js.map +1 -1
  107. package/dist/multistream/receiveSlot.js +9 -0
  108. package/dist/multistream/receiveSlot.js.map +1 -1
  109. package/dist/multistream/remoteMediaManager.js +11 -0
  110. package/dist/multistream/remoteMediaManager.js.map +1 -1
  111. package/dist/multistream/sendSlotManager.js +116 -2
  112. package/dist/multistream/sendSlotManager.js.map +1 -1
  113. package/dist/reachability/clusterReachability.js.map +1 -1
  114. package/dist/reachability/index.js +121 -83
  115. package/dist/reachability/index.js.map +1 -1
  116. package/dist/reachability/reachability.types.js +2 -0
  117. package/dist/reachability/reachability.types.js.map +1 -1
  118. package/dist/reachability/util.js +45 -0
  119. package/dist/reachability/util.js.map +1 -1
  120. package/dist/reactions/reactions.type.js.map +1 -1
  121. package/dist/reconnection-manager/index.js +0 -1
  122. package/dist/reconnection-manager/index.js.map +1 -1
  123. package/dist/recording-controller/index.js +1 -3
  124. package/dist/recording-controller/index.js.map +1 -1
  125. package/dist/roap/turnDiscovery.js +8 -1
  126. package/dist/roap/turnDiscovery.js.map +1 -1
  127. package/dist/types/aiEnableRequest/index.d.ts +5 -0
  128. package/dist/types/aiEnableRequest/utils.d.ts +2 -0
  129. package/dist/types/annotation/index.d.ts +19 -0
  130. package/dist/types/common/errors/webex-errors.d.ts +32 -2
  131. package/dist/types/config.d.ts +6 -2
  132. package/dist/types/constants.d.ts +35 -1
  133. package/dist/types/controls-options-manager/constants.d.ts +6 -1
  134. package/dist/types/controls-options-manager/index.d.ts +16 -0
  135. package/dist/types/hashTree/constants.d.ts +3 -0
  136. package/dist/types/hashTree/hashTree.d.ts +7 -0
  137. package/dist/types/hashTree/hashTreeParser.d.ts +315 -30
  138. package/dist/types/hashTree/types.d.ts +3 -0
  139. package/dist/types/hashTree/utils.d.ts +24 -0
  140. package/dist/types/index.d.ts +4 -0
  141. package/dist/types/interceptors/constant.d.ts +5 -0
  142. package/dist/types/interceptors/dataChannelAuthToken.d.ts +43 -0
  143. package/dist/types/interceptors/index.d.ts +2 -1
  144. package/dist/types/interceptors/locusRetry.d.ts +4 -4
  145. package/dist/types/interceptors/utils.d.ts +1 -0
  146. package/dist/types/interpretation/interpretation.types.d.ts +10 -0
  147. package/dist/types/locus-info/index.d.ts +126 -15
  148. package/dist/types/locus-info/infoUtils.d.ts +8 -0
  149. package/dist/types/locus-info/types.d.ts +28 -1
  150. package/dist/types/media/MediaConnectionAwaiter.d.ts +20 -2
  151. package/dist/types/media/properties.d.ts +8 -3
  152. package/dist/types/meeting/in-meeting-actions.d.ts +10 -0
  153. package/dist/types/meeting/index.d.ts +271 -16
  154. package/dist/types/meeting/locusMediaRequest.d.ts +12 -0
  155. package/dist/types/meeting/request.d.ts +17 -1
  156. package/dist/types/meeting/request.type.d.ts +5 -0
  157. package/dist/types/meeting/util.d.ts +40 -0
  158. package/dist/types/meetings/index.d.ts +42 -20
  159. package/dist/types/meetings/meetings.types.d.ts +15 -0
  160. package/dist/types/meetings/request.d.ts +14 -0
  161. package/dist/types/member/index.d.ts +2 -0
  162. package/dist/types/member/types.d.ts +1 -0
  163. package/dist/types/member/util.d.ts +14 -0
  164. package/dist/types/members/index.d.ts +15 -2
  165. package/dist/types/members/util.d.ts +1 -5
  166. package/dist/types/metrics/constants.d.ts +11 -0
  167. package/dist/types/multistream/codec/constants.d.ts +7 -0
  168. package/dist/types/multistream/mediaRequestManager.d.ts +20 -26
  169. package/dist/types/multistream/sendSlotManager.d.ts +23 -1
  170. package/dist/types/reachability/clusterReachability.d.ts +3 -3
  171. package/dist/types/reachability/index.d.ts +10 -3
  172. package/dist/types/reachability/reachability.types.d.ts +7 -0
  173. package/dist/types/reachability/util.d.ts +17 -0
  174. package/dist/types/reactions/reactions.type.d.ts +4 -0
  175. package/dist/types/webinar/utils.d.ts +6 -0
  176. package/dist/webinar/index.js +611 -164
  177. package/dist/webinar/index.js.map +1 -1
  178. package/dist/webinar/utils.js +25 -0
  179. package/dist/webinar/utils.js.map +1 -0
  180. package/package.json +24 -23
  181. package/src/aiEnableRequest/README.md +84 -0
  182. package/src/aiEnableRequest/index.ts +186 -0
  183. package/src/aiEnableRequest/utils.ts +25 -0
  184. package/src/annotation/index.ts +62 -12
  185. package/src/breakouts/breakout.ts +3 -1
  186. package/src/breakouts/events.ts +33 -11
  187. package/src/breakouts/index.ts +143 -3
  188. package/src/common/errors/webex-errors.ts +50 -3
  189. package/src/config.ts +6 -2
  190. package/src/constants.ts +49 -3
  191. package/src/controls-options-manager/constants.ts +14 -1
  192. package/src/controls-options-manager/index.ts +87 -28
  193. package/src/controls-options-manager/util.ts +81 -1
  194. package/src/hashTree/constants.ts +17 -0
  195. package/src/hashTree/hashTree.ts +17 -0
  196. package/src/hashTree/hashTreeParser.ts +1482 -361
  197. package/src/hashTree/types.ts +4 -0
  198. package/src/hashTree/utils.ts +45 -0
  199. package/src/index.ts +14 -1
  200. package/src/interceptors/constant.ts +6 -0
  201. package/src/interceptors/dataChannelAuthToken.ts +217 -0
  202. package/src/interceptors/index.ts +2 -1
  203. package/src/interceptors/locusRetry.ts +25 -4
  204. package/src/interceptors/utils.ts +16 -0
  205. package/src/interpretation/index.ts +29 -11
  206. package/src/interpretation/interpretation.types.ts +11 -0
  207. package/src/locus-info/controlsUtils.ts +14 -1
  208. package/src/locus-info/index.ts +976 -203
  209. package/src/locus-info/infoUtils.ts +41 -6
  210. package/src/locus-info/selfUtils.ts +1 -0
  211. package/src/locus-info/types.ts +33 -1
  212. package/src/media/MediaConnectionAwaiter.ts +62 -5
  213. package/src/media/index.ts +10 -1
  214. package/src/media/properties.ts +11 -4
  215. package/src/meeting/in-meeting-actions.ts +20 -0
  216. package/src/meeting/index.ts +1244 -224
  217. package/src/meeting/locusMediaRequest.ts +106 -6
  218. package/src/meeting/muteState.ts +10 -1
  219. package/src/meeting/request.ts +53 -0
  220. package/src/meeting/request.type.ts +6 -0
  221. package/src/meeting/util.ts +207 -7
  222. package/src/meeting-info/meeting-info-v2.ts +4 -2
  223. package/src/meetings/index.ts +319 -117
  224. package/src/meetings/meetings.types.ts +19 -0
  225. package/src/meetings/request.ts +43 -0
  226. package/src/meetings/util.ts +117 -4
  227. package/src/member/index.ts +20 -0
  228. package/src/member/types.ts +1 -0
  229. package/src/member/util.ts +41 -0
  230. package/src/members/index.ts +70 -7
  231. package/src/members/util.ts +12 -4
  232. package/src/metrics/constants.ts +12 -0
  233. package/src/multistream/codec/constants.ts +58 -0
  234. package/src/multistream/mediaRequestManager.ts +117 -76
  235. package/src/multistream/receiveSlot.ts +18 -0
  236. package/src/multistream/remoteMediaManager.ts +13 -0
  237. package/src/multistream/sendSlotManager.ts +97 -3
  238. package/src/reachability/clusterReachability.ts +3 -2
  239. package/src/reachability/index.ts +47 -16
  240. package/src/reachability/reachability.types.ts +11 -0
  241. package/src/reachability/util.ts +36 -0
  242. package/src/reactions/reactions.type.ts +4 -0
  243. package/src/reconnection-manager/index.ts +0 -1
  244. package/src/recording-controller/index.ts +1 -2
  245. package/src/roap/turnDiscovery.ts +9 -1
  246. package/src/webinar/index.ts +415 -11
  247. package/src/webinar/utils.ts +16 -0
  248. package/test/unit/spec/aiEnableRequest/index.ts +1067 -0
  249. package/test/unit/spec/aiEnableRequest/utils.ts +130 -0
  250. package/test/unit/spec/annotation/index.ts +228 -134
  251. package/test/unit/spec/breakouts/breakout.ts +9 -3
  252. package/test/unit/spec/breakouts/events.ts +120 -2
  253. package/test/unit/spec/breakouts/index.ts +305 -18
  254. package/test/unit/spec/common/errors/webex-errors.ts +78 -0
  255. package/test/unit/spec/controls-options-manager/index.js +244 -29
  256. package/test/unit/spec/controls-options-manager/util.js +165 -0
  257. package/test/unit/spec/hashTree/hashTree.ts +66 -0
  258. package/test/unit/spec/hashTree/hashTreeParser.ts +4528 -171
  259. package/test/unit/spec/hashTree/utils.ts +125 -1
  260. package/test/unit/spec/interceptors/dataChannelAuthToken.ts +388 -0
  261. package/test/unit/spec/interceptors/locusRetry.ts +205 -4
  262. package/test/unit/spec/interceptors/utils.ts +75 -0
  263. package/test/unit/spec/interpretation/index.ts +26 -4
  264. package/test/unit/spec/locus-info/controlsUtils.js +200 -56
  265. package/test/unit/spec/locus-info/index.js +1861 -149
  266. package/test/unit/spec/locus-info/infoUtils.js +184 -1
  267. package/test/unit/spec/media/MediaConnectionAwaiter.ts +96 -1
  268. package/test/unit/spec/media/index.ts +92 -0
  269. package/test/unit/spec/media/properties.ts +35 -26
  270. package/test/unit/spec/meeting/in-meeting-actions.ts +12 -2
  271. package/test/unit/spec/meeting/index.js +3573 -353
  272. package/test/unit/spec/meeting/locusMediaRequest.ts +406 -4
  273. package/test/unit/spec/meeting/muteState.js +81 -0
  274. package/test/unit/spec/meeting/request.js +82 -0
  275. package/test/unit/spec/meeting/utils.js +595 -27
  276. package/test/unit/spec/meeting-info/meetinginfov2.js +19 -10
  277. package/test/unit/spec/meetings/index.js +1138 -86
  278. package/test/unit/spec/meetings/request.js +141 -0
  279. package/test/unit/spec/meetings/utils.js +402 -51
  280. package/test/unit/spec/member/index.js +35 -4
  281. package/test/unit/spec/member/util.js +154 -27
  282. package/test/unit/spec/members/index.js +216 -0
  283. package/test/unit/spec/members/request.js +37 -1
  284. package/test/unit/spec/members/utils.js +63 -0
  285. package/test/unit/spec/multistream/mediaRequestManager.ts +503 -122
  286. package/test/unit/spec/multistream/remoteMediaManager.ts +30 -0
  287. package/test/unit/spec/multistream/sendSlotManager.ts +135 -36
  288. package/test/unit/spec/reachability/index.ts +128 -46
  289. package/test/unit/spec/reachability/util.ts +31 -0
  290. package/test/unit/spec/reconnection-manager/index.js +4 -8
  291. package/test/unit/spec/recording-controller/index.js +9 -8
  292. package/test/unit/spec/roap/turnDiscovery.ts +20 -0
  293. package/test/unit/spec/webinar/index.ts +1087 -167
  294. package/test/unit/spec/webinar/utils.ts +39 -0
@@ -11,6 +11,7 @@ import MockWebex from '@webex/test-helper-mock-webex';
11
11
  import * as BrowserDetectionModule from '@webex/plugin-meetings/src/common/browser-detection';
12
12
  import PasswordError from '@webex/plugin-meetings/src/common/errors/password-error';
13
13
  import CaptchaError from '@webex/plugin-meetings/src/common/errors/captcha-error';
14
+ import {ServerRoles} from '@webex/plugin-meetings/src/member/types';
14
15
 
15
16
  describe('plugin-meetings', () => {
16
17
  let webex;
@@ -53,16 +54,19 @@ describe('plugin-meetings', () => {
53
54
  meeting.unsetPeerConnections = sinon.stub();
54
55
  meeting.reconnectionManager = {cleanUp: sinon.stub()};
55
56
  meeting.stopKeepAlive = sinon.stub();
56
- meeting.updateLLMConnection = sinon.stub();
57
+ meeting.cleanupLLMConneciton = sinon.stub().resolves();
57
58
  meeting.breakouts = {cleanUp: sinon.stub()};
59
+ meeting.webinar = {cleanUp: sinon.stub()};
58
60
  meeting.annotaion = {cleanUp: sinon.stub()};
59
61
  meeting.getWebexObject = sinon.stub().returns(webex);
60
62
  meeting.simultaneousInterpretation = {cleanUp: sinon.stub()};
63
+ meeting.locusInfo = {cleanUp: sinon.stub()};
61
64
  meeting.trigger = sinon.stub();
62
65
  meeting.webex = webex;
63
66
  meeting.webex.internal.newMetrics.callDiagnosticMetrics =
64
- meeting.webex.internal.newMetrics.callDiagnosticMetrics || {};
65
- meeting.webex.internal.newMetrics.callDiagnosticMetrics.clearEventLimitsForCorrelationId = sinon.stub();
67
+ meeting.webex.internal.newMetrics.callDiagnosticMetrics || {};
68
+ meeting.webex.internal.newMetrics.callDiagnosticMetrics.clearEventLimitsForCorrelationId =
69
+ sinon.stub();
66
70
  });
67
71
 
68
72
  afterEach(() => {
@@ -83,9 +87,10 @@ describe('plugin-meetings', () => {
83
87
  assert.calledOnce(meeting.unsetPeerConnections);
84
88
  assert.calledOnce(meeting.reconnectionManager.cleanUp);
85
89
  assert.calledOnce(meeting.stopKeepAlive);
86
- assert.calledOnce(meeting.updateLLMConnection);
90
+ assert.calledOnceWithExactly(meeting.cleanupLLMConneciton, {throwOnError: false});
87
91
  assert.calledOnce(meeting.breakouts.cleanUp);
88
92
  assert.calledOnce(meeting.simultaneousInterpretation.cleanUp);
93
+ assert.calledOnce(meeting.locusInfo.cleanUp);
89
94
  assert.calledOnce(webex.internal.device.meetingEnded);
90
95
  assert.calledOnceWithExactly(
91
96
  meeting.webex.internal.newMetrics.callDiagnosticMetrics.clearEventLimitsForCorrelationId,
@@ -104,9 +109,10 @@ describe('plugin-meetings', () => {
104
109
  assert.calledOnce(meeting.unsetPeerConnections);
105
110
  assert.calledOnce(meeting.reconnectionManager.cleanUp);
106
111
  assert.calledOnce(meeting.stopKeepAlive);
107
- assert.notCalled(meeting.updateLLMConnection);
112
+ assert.notCalled(meeting.cleanupLLMConneciton);
108
113
  assert.calledOnce(meeting.breakouts.cleanUp);
109
114
  assert.calledOnce(meeting.simultaneousInterpretation.cleanUp);
115
+ assert.calledOnce(meeting.locusInfo.cleanUp);
110
116
  assert.calledOnce(webex.internal.device.meetingEnded);
111
117
  assert.calledOnceWithExactly(
112
118
  meeting.webex.internal.newMetrics.callDiagnosticMetrics.clearEventLimitsForCorrelationId,
@@ -124,9 +130,10 @@ describe('plugin-meetings', () => {
124
130
  assert.calledOnce(meeting.unsetPeerConnections);
125
131
  assert.calledOnce(meeting.reconnectionManager.cleanUp);
126
132
  assert.calledOnce(meeting.stopKeepAlive);
127
- assert.notCalled(meeting.updateLLMConnection);
133
+ assert.notCalled(meeting.cleanupLLMConneciton);
128
134
  assert.calledOnce(meeting.breakouts.cleanUp);
129
135
  assert.calledOnce(meeting.simultaneousInterpretation.cleanUp);
136
+ assert.calledOnce(meeting.locusInfo.cleanUp);
130
137
  assert.calledOnce(webex.internal.device.meetingEnded);
131
138
  assert.calledOnceWithExactly(
132
139
  meeting.webex.internal.newMetrics.callDiagnosticMetrics.clearEventLimitsForCorrelationId,
@@ -245,7 +252,11 @@ describe('plugin-meetings', () => {
245
252
  const response = MeetingUtil.updateLocusFromApiResponse(meeting, originalResponse);
246
253
 
247
254
  assert.deepEqual(response, originalResponse);
248
- assert.calledOnceWithExactly(meeting.locusInfo.handleLocusAPIResponse, meeting, originalResponse.body);
255
+ assert.calledOnceWithExactly(
256
+ meeting.locusInfo.handleLocusAPIResponse,
257
+ meeting,
258
+ originalResponse.body
259
+ );
249
260
  });
250
261
 
251
262
  it('should handle locus being missing from the response', () => {
@@ -265,6 +276,31 @@ describe('plugin-meetings', () => {
265
276
  assert.notCalled(meeting.locusInfo.handleLocusAPIResponse);
266
277
  });
267
278
 
279
+ it('should call handleLocusAPIResponse when response body is an unwrapped LocusDTO', () => {
280
+ const meeting = {
281
+ locusInfo: {
282
+ handleLocusAPIResponse: sinon.stub(),
283
+ },
284
+ };
285
+
286
+ const originalResponse = {
287
+ body: {
288
+ url: 'https://locus-a.wbx2.com/locus/api/v1/loci/some-id',
289
+ participants: [],
290
+ self: {},
291
+ },
292
+ };
293
+
294
+ const response = MeetingUtil.updateLocusFromApiResponse(meeting, originalResponse);
295
+
296
+ assert.deepEqual(response, originalResponse);
297
+ assert.calledOnceWithExactly(
298
+ meeting.locusInfo.handleLocusAPIResponse,
299
+ meeting,
300
+ originalResponse.body
301
+ );
302
+ });
303
+
268
304
  it('should work with an undefined meeting', () => {
269
305
  const originalResponse = {
270
306
  body: {
@@ -283,6 +319,7 @@ describe('plugin-meetings', () => {
283
319
  const addSequenceSpy = sinon.spy(MeetingUtil, 'addSequence');
284
320
 
285
321
  const meeting = {
322
+ locusUrl: 'https://locus.example.com/loci/abc',
286
323
  request: sinon.stub().returns(Promise.resolve('result')),
287
324
  };
288
325
 
@@ -290,6 +327,7 @@ describe('plugin-meetings', () => {
290
327
 
291
328
  const options = {
292
329
  some: 'option',
330
+ uri: 'https://locus.example.com/loci/abc',
293
331
  body: {},
294
332
  };
295
333
 
@@ -303,7 +341,7 @@ describe('plugin-meetings', () => {
303
341
  addSequenceSpy.resetHistory();
304
342
 
305
343
  // body missing from options
306
- result = await locusDeltaRequest({});
344
+ result = await locusDeltaRequest({uri: 'https://locus.example.com/loci/abc'});
307
345
  assert.equal(result, 'result');
308
346
  assert.calledOnceWithExactly(updateLocusFromApiResponseSpy, meeting, 'result');
309
347
  assert.calledOnceWithExactly(addSequenceSpy, meeting, options.body);
@@ -317,6 +355,78 @@ describe('plugin-meetings', () => {
317
355
  WeakRef.prototype.deref.restore();
318
356
  });
319
357
 
358
+ it('calls updateLocusFromApiResponse when request uri starts with the meeting locusUrl', async () => {
359
+ const updateLocusFromApiResponseSpy = sinon.spy(MeetingUtil, 'updateLocusFromApiResponse');
360
+
361
+ const meeting = {
362
+ locusUrl: 'https://locus.example.com/loci/abc',
363
+ request: sinon.stub().returns(Promise.resolve('result')),
364
+ };
365
+
366
+ const locusDeltaRequest = MeetingUtil.generateLocusDeltaRequest(meeting);
367
+
368
+ const result = await locusDeltaRequest({
369
+ uri: 'https://locus.example.com/loci/abc/participant/123',
370
+ body: {},
371
+ });
372
+
373
+ assert.equal(result, 'result');
374
+ assert.calledOnceWithExactly(updateLocusFromApiResponseSpy, meeting, 'result');
375
+ });
376
+
377
+ it('does not call updateLocusFromApiResponse when request uri does not match the meeting locusUrl', async () => {
378
+ const updateLocusFromApiResponseSpy = sinon.spy(MeetingUtil, 'updateLocusFromApiResponse');
379
+
380
+ const meeting = {
381
+ locusUrl: 'https://locus.example.com/loci/abc',
382
+ request: sinon.stub().returns(Promise.resolve('result')),
383
+ };
384
+
385
+ const locusDeltaRequest = MeetingUtil.generateLocusDeltaRequest(meeting);
386
+
387
+ const result = await locusDeltaRequest({
388
+ uri: 'https://locus.example.com/loci/different',
389
+ body: {},
390
+ });
391
+
392
+ assert.equal(result, 'result');
393
+ assert.notCalled(updateLocusFromApiResponseSpy);
394
+ });
395
+
396
+ it('does not call updateLocusFromApiResponse when request uri is missing', async () => {
397
+ const updateLocusFromApiResponseSpy = sinon.spy(MeetingUtil, 'updateLocusFromApiResponse');
398
+
399
+ const meeting = {
400
+ locusUrl: 'https://locus.example.com/loci/abc',
401
+ request: sinon.stub().returns(Promise.resolve('result')),
402
+ };
403
+
404
+ const locusDeltaRequest = MeetingUtil.generateLocusDeltaRequest(meeting);
405
+
406
+ const result = await locusDeltaRequest({body: {}});
407
+
408
+ assert.equal(result, 'result');
409
+ assert.notCalled(updateLocusFromApiResponseSpy);
410
+ });
411
+
412
+ it('does not call updateLocusFromApiResponse when meeting locusUrl is missing', async () => {
413
+ const updateLocusFromApiResponseSpy = sinon.spy(MeetingUtil, 'updateLocusFromApiResponse');
414
+
415
+ const meeting = {
416
+ request: sinon.stub().returns(Promise.resolve('result')),
417
+ };
418
+
419
+ const locusDeltaRequest = MeetingUtil.generateLocusDeltaRequest(meeting);
420
+
421
+ const result = await locusDeltaRequest({
422
+ uri: 'https://locus.example.com/loci/abc',
423
+ body: {},
424
+ });
425
+
426
+ assert.equal(result, 'result');
427
+ assert.notCalled(updateLocusFromApiResponseSpy);
428
+ });
429
+
320
430
  it('calls generateBuildLocusDeltaRequestOptions as expected', () => {
321
431
  const generateBuildLocusDeltaRequestOptionsSpy = sinon.spy(
322
432
  MeetingUtil,
@@ -361,8 +471,8 @@ describe('plugin-meetings', () => {
361
471
  describe('remoteUpdateAudioVideo', () => {
362
472
  it('#Should call meetingRequest.locusMediaRequest with correct parameters and return the full response', async () => {
363
473
  const fakeResponse = {
364
- body: { locus: { url: 'locusUrl'}},
365
- headers: { },
474
+ body: {locus: {url: 'locusUrl'}},
475
+ headers: {},
366
476
  };
367
477
  const meeting = {
368
478
  id: 'meeting-id',
@@ -480,6 +590,11 @@ describe('plugin-meetings', () => {
480
590
  identifiers: {
481
591
  trackingId: 'trackingId',
482
592
  },
593
+ eventData: {
594
+ hasMismatchedSocket: false,
595
+ mercurySocketUrl: '',
596
+ deviceSocketUrl: 'ws://example.com',
597
+ },
483
598
  },
484
599
  options: {
485
600
  meetingId: meeting.id,
@@ -649,21 +764,26 @@ describe('plugin-meetings', () => {
649
764
  it('should post client event with error when join fails', async () => {
650
765
  const joinError = new Error('Join failed');
651
766
  meeting.meetingRequest.joinMeeting.rejects(joinError);
652
- meeting.meetingInfo = { meetingLookupUrl: 'test-lookup-url' };
767
+ meeting.meetingInfo = {meetingLookupUrl: 'test-lookup-url'};
653
768
 
654
769
  try {
655
770
  await MeetingUtil.joinMeeting(meeting, {});
656
771
  assert.fail('Expected joinMeeting to throw an error');
657
772
  } catch (error) {
658
773
  assert.equal(error, joinError);
659
-
774
+
660
775
  // Verify error client event was submitted
661
776
  assert.calledWith(webex.internal.newMetrics.submitClientEvent, {
662
777
  name: 'client.locus.join.response',
663
778
  payload: {
664
- identifiers: { meetingLookupUrl: 'test-lookup-url' },
779
+ identifiers: {meetingLookupUrl: 'test-lookup-url'},
780
+ eventData: {
781
+ hasMismatchedSocket: false,
782
+ mercurySocketUrl: '',
783
+ deviceSocketUrl: 'ws://example.com',
784
+ },
665
785
  },
666
- options: { meetingId: meeting.id, rawError: joinError },
786
+ options: {meetingId: meeting.id, rawError: joinError},
667
787
  });
668
788
  }
669
789
  });
@@ -721,7 +841,7 @@ describe('plugin-meetings', () => {
721
841
  assert.fail('Expected joinMeetingOptions to throw PasswordError');
722
842
  } catch (error) {
723
843
  assert.instanceOf(error, PasswordError);
724
-
844
+
725
845
  // Verify client event was submitted with error details
726
846
  assert.calledWith(webex.internal.newMetrics.submitClientEvent, {
727
847
  name: 'client.meetinginfo.response',
@@ -759,7 +879,7 @@ describe('plugin-meetings', () => {
759
879
  assert.fail('Expected joinMeetingOptions to throw CaptchaError');
760
880
  } catch (error) {
761
881
  assert.instanceOf(error, CaptchaError);
762
-
882
+
763
883
  // Verify client event was submitted with error details
764
884
  assert.calledWith(webex.internal.newMetrics.submitClientEvent, {
765
885
  name: 'client.meetinginfo.response',
@@ -921,6 +1041,153 @@ describe('plugin-meetings', () => {
921
1041
  });
922
1042
  });
923
1043
 
1044
+ describe('canViewTheParticipantList', () => {
1045
+ it('returns true when both VIEW_THE_PARTICIPANT_LIST and CAN_VIEW_THE_PARTICIPANT_LIST hints are present and canNotViewTheParticipantList is false', () => {
1046
+ assert.isTrue(
1047
+ MeetingUtil.canViewTheParticipantList(
1048
+ ['VIEW_THE_PARTICIPANT_LIST', 'CAN_VIEW_THE_PARTICIPANT_LIST'],
1049
+ false
1050
+ )
1051
+ );
1052
+ });
1053
+
1054
+ it('returns false when VIEW_THE_PARTICIPANT_LIST hint is missing', () => {
1055
+ assert.isFalse(
1056
+ MeetingUtil.canViewTheParticipantList(['CAN_VIEW_THE_PARTICIPANT_LIST'], false)
1057
+ );
1058
+ });
1059
+
1060
+ it('returns false when CAN_VIEW_THE_PARTICIPANT_LIST hint is missing', () => {
1061
+ assert.isFalse(
1062
+ MeetingUtil.canViewTheParticipantList(['VIEW_THE_PARTICIPANT_LIST'], false)
1063
+ );
1064
+ });
1065
+
1066
+ it('returns false when canNotViewTheParticipantList is true', () => {
1067
+ assert.isFalse(
1068
+ MeetingUtil.canViewTheParticipantList(
1069
+ ['VIEW_THE_PARTICIPANT_LIST', 'CAN_VIEW_THE_PARTICIPANT_LIST'],
1070
+ true
1071
+ )
1072
+ );
1073
+ });
1074
+
1075
+ it('returns false when display hints array is empty', () => {
1076
+ assert.isFalse(MeetingUtil.canViewTheParticipantList([], false));
1077
+ });
1078
+
1079
+ it('returns false when both conditions are violated', () => {
1080
+ assert.isFalse(MeetingUtil.canViewTheParticipantList([], true));
1081
+ });
1082
+
1083
+ it('returns true when canNotViewTheParticipantList is undefined (not yet set on meeting)', () => {
1084
+ assert.isTrue(
1085
+ MeetingUtil.canViewTheParticipantList(
1086
+ ['VIEW_THE_PARTICIPANT_LIST', 'CAN_VIEW_THE_PARTICIPANT_LIST'],
1087
+ undefined
1088
+ )
1089
+ );
1090
+ });
1091
+ });
1092
+
1093
+ describe('canAttendeeRequestAiAssistantEnabled', () => {
1094
+ it('returns false when user is a cohost', () => {
1095
+ assert.deepEqual(
1096
+ MeetingUtil.canAttendeeRequestAiAssistantEnabled(
1097
+ ['ATTENDEE_REQUEST_AI_ASSISTANT_ENABLED'],
1098
+ [ServerRoles.Cohost]
1099
+ ),
1100
+ false
1101
+ );
1102
+ });
1103
+
1104
+ it('returns false when user is a moderator', () => {
1105
+ assert.deepEqual(
1106
+ MeetingUtil.canAttendeeRequestAiAssistantEnabled(
1107
+ ['ATTENDEE_REQUEST_AI_ASSISTANT_ENABLED'],
1108
+ [ServerRoles.Moderator]
1109
+ ),
1110
+ false
1111
+ );
1112
+ });
1113
+
1114
+ it('returns false when user is both cohost and moderator', () => {
1115
+ assert.deepEqual(
1116
+ MeetingUtil.canAttendeeRequestAiAssistantEnabled(
1117
+ ['ATTENDEE_REQUEST_AI_ASSISTANT_ENABLED'],
1118
+ [ServerRoles.Cohost, ServerRoles.Moderator]
1119
+ ),
1120
+ false
1121
+ );
1122
+ });
1123
+
1124
+ it('returns true when user is an attendee and display hint is present', () => {
1125
+ assert.deepEqual(
1126
+ MeetingUtil.canAttendeeRequestAiAssistantEnabled(
1127
+ ['ATTENDEE_REQUEST_AI_ASSISTANT_ENABLED'],
1128
+ []
1129
+ ),
1130
+ true
1131
+ );
1132
+ });
1133
+
1134
+ it('returns true when user has other roles (not host/cohost) and display hint is present', () => {
1135
+ assert.deepEqual(
1136
+ MeetingUtil.canAttendeeRequestAiAssistantEnabled(
1137
+ ['ATTENDEE_REQUEST_AI_ASSISTANT_ENABLED'],
1138
+ ['SomeOtherRole']
1139
+ ),
1140
+ true
1141
+ );
1142
+ });
1143
+
1144
+ it('returns false when user is an attendee but display hint is not present', () => {
1145
+ assert.deepEqual(MeetingUtil.canAttendeeRequestAiAssistantEnabled([], []), false);
1146
+ });
1147
+
1148
+ it('returns false when user is an attendee with other display hints but not the AI assistant one', () => {
1149
+ assert.deepEqual(
1150
+ MeetingUtil.canAttendeeRequestAiAssistantEnabled(['SOME_OTHER_HINT', 'ANOTHER_HINT'], []),
1151
+ false
1152
+ );
1153
+ });
1154
+
1155
+ it('returns false when host/cohost even if display hint is not present', () => {
1156
+ assert.deepEqual(
1157
+ MeetingUtil.canAttendeeRequestAiAssistantEnabled([], [ServerRoles.Cohost]),
1158
+ false
1159
+ );
1160
+ assert.deepEqual(
1161
+ MeetingUtil.canAttendeeRequestAiAssistantEnabled([], [ServerRoles.Moderator]),
1162
+ false
1163
+ );
1164
+ });
1165
+ });
1166
+
1167
+ describe('attendeeRequestAiAssistantDeclinedAll', () => {
1168
+ it('returns true when display hint is present', () => {
1169
+ assert.isTrue(
1170
+ MeetingUtil.attendeeRequestAiAssistantDeclinedAll([
1171
+ 'ATTENDEE_REQUEST_AI_ASSISTANT_DECLINED_ALL',
1172
+ ])
1173
+ );
1174
+ });
1175
+
1176
+ it('returns false when display hint is not present', () => {
1177
+ assert.isFalse(MeetingUtil.attendeeRequestAiAssistantDeclinedAll([]));
1178
+ });
1179
+
1180
+ it('returns false when display hint is absent among other hints', () => {
1181
+ assert.isFalse(
1182
+ MeetingUtil.attendeeRequestAiAssistantDeclinedAll(['SOME_OTHER_HINT', 'ANOTHER_HINT'])
1183
+ );
1184
+ });
1185
+
1186
+ it('returns false when called with no arguments', () => {
1187
+ assert.isFalse(MeetingUtil.attendeeRequestAiAssistantDeclinedAll());
1188
+ });
1189
+ });
1190
+
924
1191
  describe('bothLeaveAndEndMeetingAvailable', () => {
925
1192
  it('works as expected', () => {
926
1193
  assert.deepEqual(
@@ -939,6 +1206,46 @@ describe('plugin-meetings', () => {
939
1206
  });
940
1207
  });
941
1208
 
1209
+ describe('requireHostEndMeetingBeforeLeave', () => {
1210
+ it('works as expected', () => {
1211
+ assert.deepEqual(
1212
+ MeetingUtil.requireHostEndMeetingBeforeLeave(['REQUIRE_HOST_END_MEETING_BEFORE_LEAVE']),
1213
+ true
1214
+ );
1215
+ assert.deepEqual(
1216
+ MeetingUtil.requireHostEndMeetingBeforeLeave([
1217
+ 'LEAVE_TRANSFER_HOST_END_MEETING',
1218
+ 'END_MEETING',
1219
+ ]),
1220
+ false
1221
+ );
1222
+ assert.deepEqual(
1223
+ MeetingUtil.requireHostEndMeetingBeforeLeave([
1224
+ 'REQUIRE_HOST_END_MEETING_BEFORE_LEAVE',
1225
+ 'END_MEETING',
1226
+ ]),
1227
+ true
1228
+ );
1229
+ assert.deepEqual(
1230
+ MeetingUtil.requireHostEndMeetingBeforeLeave([
1231
+ 'REQUIRE_HOST_END_MEETING_BEFORE_LEAVE',
1232
+ 'LEAVE_MEETING',
1233
+ ]),
1234
+ true
1235
+ );
1236
+ assert.deepEqual(
1237
+ MeetingUtil.requireHostEndMeetingBeforeLeave([
1238
+ 'REQUIRE_HOST_END_MEETING_BEFORE_LEAVE',
1239
+ 'LEAVE_MEETING',
1240
+ 'END_MEETING',
1241
+ ]),
1242
+ true
1243
+ );
1244
+ assert.deepEqual(MeetingUtil.requireHostEndMeetingBeforeLeave(['END_MEETING']), true);
1245
+ assert.deepEqual(MeetingUtil.requireHostEndMeetingBeforeLeave([]), false);
1246
+ });
1247
+ });
1248
+
942
1249
  describe('canUserLock', () => {
943
1250
  it('works as expected', () => {
944
1251
  assert.deepEqual(
@@ -972,15 +1279,18 @@ describe('plugin-meetings', () => {
972
1279
  {functionName: 'canStartManualCaption', displayHint: 'MANUAL_CAPTION_START'},
973
1280
  {functionName: 'canStopManualCaption', displayHint: 'MANUAL_CAPTION_STOP'},
974
1281
 
975
- {functionName: 'isLocalRecordingStarted',displayHint:'LOCAL_RECORDING_STATUS_STARTED'},
1282
+ {functionName: 'isLocalRecordingStarted', displayHint: 'LOCAL_RECORDING_STATUS_STARTED'},
976
1283
  {functionName: 'isLocalRecordingStopped', displayHint: 'LOCAL_RECORDING_STATUS_STOPPED'},
977
1284
  {functionName: 'isLocalRecordingPaused', displayHint: 'LOCAL_RECORDING_STATUS_PAUSED'},
978
- {functionName: 'isLocalStreamingStarted',displayHint:'STREAMING_STATUS_STARTED'},
1285
+ {functionName: 'isLocalStreamingStarted', displayHint: 'STREAMING_STATUS_STARTED'},
979
1286
  {functionName: 'isLocalStreamingStopped', displayHint: 'STREAMING_STATUS_STOPPED'},
980
1287
 
981
1288
  {functionName: 'isManualCaptionActive', displayHint: 'MANUAL_CAPTION_STATUS_ACTIVE'},
982
1289
 
983
- {functionName: 'isSpokenLanguageAutoDetectionEnabled', displayHint: 'SPOKEN_LANGUAGE_AUTO_DETECTION_ENABLED'},
1290
+ {
1291
+ functionName: 'isSpokenLanguageAutoDetectionEnabled',
1292
+ displayHint: 'SPOKEN_LANGUAGE_AUTO_DETECTION_ENABLED',
1293
+ },
984
1294
 
985
1295
  {functionName: 'isWebexAssistantActive', displayHint: 'WEBEX_ASSISTANT_STATUS_ACTIVE'},
986
1296
  {functionName: 'canViewCaptionPanel', displayHint: 'ENABLE_CAPTION_PANEL'},
@@ -988,6 +1298,10 @@ describe('plugin-meetings', () => {
988
1298
  {functionName: 'canSelectSpokenLanguages', displayHint: 'DISPLAY_NON_ENGLISH_ASR'},
989
1299
  {functionName: 'waitingForOthersToJoin', displayHint: 'WAITING_FOR_OTHERS'},
990
1300
  {functionName: 'showAutoEndMeetingWarning', displayHint: 'SHOW_AUTO_END_MEETING_WARNING'},
1301
+ {
1302
+ functionName: 'isAnonymizeDisplayNamesEnabled',
1303
+ displayHint: 'ANONYMOUS_DISPLAY_NAMES_ENABLED',
1304
+ },
991
1305
  ].forEach(({functionName, displayHint}) => {
992
1306
  describe(functionName, () => {
993
1307
  it('works as expected', () => {
@@ -1446,11 +1760,9 @@ describe('plugin-meetings', () => {
1446
1760
  id: 'selfId123',
1447
1761
  },
1448
1762
  },
1763
+ metaData: {id: 'some hash tree metadata'},
1449
1764
  dataSets: [{name: 'dataset1', url: 'http://dataset.com'}],
1450
- mediaConnections: [
1451
- {mediaId: 'mediaId456'},
1452
- {someOtherField: 'value'},
1453
- ],
1765
+ mediaConnections: [{mediaId: 'mediaId456'}, {someOtherField: 'value'}],
1454
1766
  },
1455
1767
  };
1456
1768
  });
@@ -1466,6 +1778,7 @@ describe('plugin-meetings', () => {
1466
1778
  locusId: '12345',
1467
1779
  selfId: 'selfId123',
1468
1780
  mediaId: 'mediaId456',
1781
+ metadata: {id: 'some hash tree metadata'},
1469
1782
  });
1470
1783
  });
1471
1784
 
@@ -1495,20 +1808,275 @@ describe('plugin-meetings', () => {
1495
1808
  locusUrl: 'https://locus-a.wbx2.com/locus/api/v1/loci/12345',
1496
1809
  locusId: '12345',
1497
1810
  selfId: 'selfId123',
1811
+ metadata: {id: 'some hash tree metadata'},
1498
1812
  });
1499
1813
  assert.isUndefined(result.mediaId);
1500
1814
  });
1501
1815
 
1502
1816
  it('handles mediaConnections without mediaId', () => {
1503
- response.body.mediaConnections = [
1504
- {someField: 'value1'},
1505
- {anotherField: 'value2'},
1506
- ];
1817
+ response.body.mediaConnections = [{someField: 'value1'}, {anotherField: 'value2'}];
1507
1818
 
1508
1819
  const result = MeetingUtil.parseLocusJoin(response);
1509
1820
 
1510
1821
  assert.isUndefined(result.mediaId);
1511
1822
  });
1512
1823
  });
1824
+
1825
+ describe('#sanitizeWebSocketUrl', () => {
1826
+ it('extracts protocol, host, and pathname from URL', () => {
1827
+ const url = 'wss://example.com:443/mercury/path?token=secret&key=value#fragment';
1828
+ const result = MeetingUtil.sanitizeWebSocketUrl(url);
1829
+
1830
+ assert.equal(result, 'wss://example.com:443/mercury/path');
1831
+ });
1832
+
1833
+ it('handles URL without query string or hash', () => {
1834
+ const url = 'wss://example.com/path';
1835
+ const result = MeetingUtil.sanitizeWebSocketUrl(url);
1836
+
1837
+ assert.equal(result, 'wss://example.com/path');
1838
+ });
1839
+
1840
+ it('removes authentication from URL', () => {
1841
+ const url = 'wss://user:password@example.com/path?token=secret';
1842
+ const result = MeetingUtil.sanitizeWebSocketUrl(url);
1843
+
1844
+ assert.equal(result, 'wss://example.com/path');
1845
+ });
1846
+
1847
+ it('returns empty string for null or undefined', () => {
1848
+ assert.equal(MeetingUtil.sanitizeWebSocketUrl(null), '');
1849
+ assert.equal(MeetingUtil.sanitizeWebSocketUrl(undefined), '');
1850
+ });
1851
+
1852
+ it('returns empty string for non-string input', () => {
1853
+ assert.equal(MeetingUtil.sanitizeWebSocketUrl(123), '');
1854
+ assert.equal(MeetingUtil.sanitizeWebSocketUrl({}), '');
1855
+ });
1856
+
1857
+ it('returns empty string for invalid URL', () => {
1858
+ const result = MeetingUtil.sanitizeWebSocketUrl('not a valid url');
1859
+
1860
+ assert.equal(result, '');
1861
+ });
1862
+
1863
+ it('handles URL without pathname', () => {
1864
+ const url = 'wss://example.com?query=value';
1865
+ const result = MeetingUtil.sanitizeWebSocketUrl(url);
1866
+
1867
+ assert.equal(result, 'wss://example.com');
1868
+ });
1869
+ });
1870
+
1871
+ describe('#_urlsPartiallyMatch', () => {
1872
+ it('returns true when URLs match exactly (ignoring query and hash)', () => {
1873
+ const url1 = 'wss://example.com:443/path?token=abc#fragment1';
1874
+ const url2 = 'wss://example.com:443/path?token=xyz#fragment2';
1875
+
1876
+ assert.isTrue(MeetingUtil._urlsPartiallyMatch(url1, url2));
1877
+ });
1878
+
1879
+ it('returns true when one URL is proxied and ends with the other', () => {
1880
+ const url1 = 'wss://other.example.com/somepath/mercury.example.com/v1/path';
1881
+ const url2 = 'wss://mercury.example.com/v1/path';
1882
+
1883
+ assert.isTrue(MeetingUtil._urlsPartiallyMatch(url1, url2));
1884
+ });
1885
+
1886
+ it('returns true when the second URL is proxied', () => {
1887
+ const url1 = 'wss://mercury.example.com/v1/path';
1888
+ const url2 = 'wss://other.example.com/somepath/mercury.example.com/v1/path';
1889
+
1890
+ assert.isTrue(MeetingUtil._urlsPartiallyMatch(url1, url2));
1891
+ });
1892
+
1893
+ it('returns false when hosts differ and no partial match', () => {
1894
+ const url1 = 'wss://example1.com/path';
1895
+ const url2 = 'wss://example2.com/path';
1896
+
1897
+ assert.isFalse(MeetingUtil._urlsPartiallyMatch(url1, url2));
1898
+ });
1899
+
1900
+ it('returns false when pathnames differ and no partial match', () => {
1901
+ const url1 = 'wss://example.com/path1';
1902
+ const url2 = 'wss://example.com/path2';
1903
+
1904
+ assert.isFalse(MeetingUtil._urlsPartiallyMatch(url1, url2));
1905
+ });
1906
+
1907
+ it('returns false when either URL is null or undefined', () => {
1908
+ const url = 'wss://example.com/path';
1909
+
1910
+ assert.isFalse(MeetingUtil._urlsPartiallyMatch(null, url));
1911
+ assert.isFalse(MeetingUtil._urlsPartiallyMatch(url, null));
1912
+ assert.isFalse(MeetingUtil._urlsPartiallyMatch(undefined, url));
1913
+ assert.isFalse(MeetingUtil._urlsPartiallyMatch(url, undefined));
1914
+ });
1915
+
1916
+ it('returns false when both URLs are null', () => {
1917
+ assert.isFalse(MeetingUtil._urlsPartiallyMatch(null, null));
1918
+ });
1919
+
1920
+ it('returns false when URL parsing fails', () => {
1921
+ const url1 = 'invalid url';
1922
+ const url2 = 'wss://example.com/path';
1923
+
1924
+ assert.isFalse(MeetingUtil._urlsPartiallyMatch(url1, url2));
1925
+ });
1926
+ });
1927
+
1928
+ describe('#getSocketUrlInfo', () => {
1929
+ it('returns socket URL info when URLs differ', () => {
1930
+ const testWebex = {
1931
+ internal: {
1932
+ mercury: {
1933
+ socket: {
1934
+ url: 'wss://mercury.example.com:443/path?token=abc',
1935
+ },
1936
+ },
1937
+ device: {
1938
+ webSocketUrl: 'wss://device.example.com:443/path?token=xyz',
1939
+ },
1940
+ },
1941
+ };
1942
+
1943
+ const result = MeetingUtil.getSocketUrlInfo(testWebex);
1944
+
1945
+ assert.isTrue(result.hasMismatchedSocket);
1946
+ assert.equal(result.mercurySocketUrl, 'wss://mercury.example.com:443/path');
1947
+ assert.equal(result.deviceSocketUrl, 'wss://device.example.com:443/path');
1948
+ });
1949
+
1950
+ it('returns socket URL info when URLs match', () => {
1951
+ const testWebex = {
1952
+ internal: {
1953
+ mercury: {
1954
+ socket: {
1955
+ url: 'wss://example.com:443/path?token=abc',
1956
+ },
1957
+ },
1958
+ device: {
1959
+ webSocketUrl: 'wss://example.com:443/path?token=xyz',
1960
+ },
1961
+ },
1962
+ };
1963
+
1964
+ const result = MeetingUtil.getSocketUrlInfo(testWebex);
1965
+
1966
+ assert.isFalse(result.hasMismatchedSocket);
1967
+ assert.equal(result.mercurySocketUrl, 'wss://example.com:443/path');
1968
+ assert.equal(result.deviceSocketUrl, 'wss://example.com:443/path');
1969
+ });
1970
+
1971
+ it('returns hasMismatchedSocket as false when one URL is proxied (partial match)', () => {
1972
+ const testWebex = {
1973
+ internal: {
1974
+ mercury: {
1975
+ socket: {
1976
+ url: 'wss://other.example.com/somepath/mercury.example.com/v1/apps/wx2/registrations/00000000-0000-0000-0000-000000000000/messages',
1977
+ },
1978
+ },
1979
+ device: {
1980
+ webSocketUrl:
1981
+ 'wss://mercury.example.com/v1/apps/wx2/registrations/00000000-0000-0000-0000-000000000000/messages',
1982
+ },
1983
+ },
1984
+ };
1985
+
1986
+ const result = MeetingUtil.getSocketUrlInfo(testWebex);
1987
+
1988
+ assert.isFalse(result.hasMismatchedSocket);
1989
+ assert.equal(
1990
+ result.mercurySocketUrl,
1991
+ 'wss://other.example.com/somepath/mercury.example.com/v1/apps/wx2/registrations/00000000-0000-0000-0000-000000000000/messages'
1992
+ );
1993
+ assert.equal(
1994
+ result.deviceSocketUrl,
1995
+ 'wss://mercury.example.com/v1/apps/wx2/registrations/00000000-0000-0000-0000-000000000000/messages'
1996
+ );
1997
+ });
1998
+
1999
+ it('returns false for hasMismatchedSocket when mercury socket URL is missing', () => {
2000
+ const testWebex = {
2001
+ internal: {
2002
+ mercury: {
2003
+ socket: {},
2004
+ },
2005
+ device: {
2006
+ webSocketUrl: 'wss://device.example.com:443/path',
2007
+ },
2008
+ },
2009
+ };
2010
+
2011
+ const result = MeetingUtil.getSocketUrlInfo(testWebex);
2012
+
2013
+ assert.isFalse(result.hasMismatchedSocket);
2014
+ assert.equal(result.mercurySocketUrl, '');
2015
+ assert.equal(result.deviceSocketUrl, 'wss://device.example.com:443/path');
2016
+ });
2017
+
2018
+ it('returns false for hasMismatchedSocket when device socket URL is missing', () => {
2019
+ const testWebex = {
2020
+ internal: {
2021
+ mercury: {
2022
+ socket: {
2023
+ url: 'wss://mercury.example.com:443/path',
2024
+ },
2025
+ },
2026
+ device: {},
2027
+ },
2028
+ };
2029
+
2030
+ const result = MeetingUtil.getSocketUrlInfo(testWebex);
2031
+
2032
+ assert.isFalse(result.hasMismatchedSocket);
2033
+ assert.equal(result.mercurySocketUrl, 'wss://mercury.example.com:443/path');
2034
+ assert.equal(result.deviceSocketUrl, '');
2035
+ });
2036
+
2037
+ it('returns default values when webex object is missing properties', () => {
2038
+ const testWebex = {
2039
+ internal: {},
2040
+ };
2041
+
2042
+ const result = MeetingUtil.getSocketUrlInfo(testWebex);
2043
+
2044
+ assert.isFalse(result.hasMismatchedSocket);
2045
+ assert.equal(result.mercurySocketUrl, '');
2046
+ assert.equal(result.deviceSocketUrl, '');
2047
+ });
2048
+
2049
+ it('handles error gracefully and returns default values', () => {
2050
+ const testWebex = null;
2051
+
2052
+ const result = MeetingUtil.getSocketUrlInfo(testWebex);
2053
+
2054
+ assert.isFalse(result.hasMismatchedSocket);
2055
+ assert.equal(result.mercurySocketUrl, '');
2056
+ assert.equal(result.deviceSocketUrl, '');
2057
+ });
2058
+
2059
+ it('sanitizes URLs by removing query parameters', () => {
2060
+ const testWebex = {
2061
+ internal: {
2062
+ mercury: {
2063
+ socket: {
2064
+ url: 'wss://mercury.example.com/path?secret=token123&key=value',
2065
+ },
2066
+ },
2067
+ device: {
2068
+ webSocketUrl: 'wss://device.example.com/path?secret=differenttoken&key=value',
2069
+ },
2070
+ },
2071
+ };
2072
+
2073
+ const result = MeetingUtil.getSocketUrlInfo(testWebex);
2074
+
2075
+ assert.notInclude(result.mercurySocketUrl, 'secret');
2076
+ assert.notInclude(result.mercurySocketUrl, 'token123');
2077
+ assert.notInclude(result.deviceSocketUrl, 'secret');
2078
+ assert.notInclude(result.deviceSocketUrl, 'differenttoken');
2079
+ });
2080
+ });
1513
2081
  });
1514
2082
  });