@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
@@ -8,12 +8,33 @@ import LLMChannel from '@webex/internal-plugin-llm';
8
8
  import AnnotationService from '../../../../src/annotation/index';
9
9
  import {ANNOTATION_RELAY_TYPES, ANNOTATION_REQUEST_TYPE, EVENT_TRIGGERS} from '../../../../src/annotation/constants';
10
10
 
11
+ /**
12
+ * Creates a mock LLM channel for testing
13
+ * @param {Object} [options] - Options for the mock channel
14
+ * @param {boolean} [options.isConnected=true] - Whether the channel is connected
15
+ * @param {string} [options.binding] - The binding string
16
+ * @returns {Object} Mock channel
17
+ */
18
+ function createMockLLMChannel(options: {isConnected?: boolean; binding?: string} = {}) {
19
+ const mockWebSocket = new MockWebSocket();
20
+ const {isConnected = true, binding = 'binding'} = options;
21
+
22
+ return {
23
+ isConnected: sinon.stub().returns(isConnected),
24
+ getSocket: sinon.stub().returns(mockWebSocket),
25
+ getBinding: sinon.stub().returns(binding),
26
+ getLocusUrl: sinon.stub().returns('locusUrl'),
27
+ on: sinon.stub(),
28
+ off: sinon.stub(),
29
+ socket: mockWebSocket,
30
+ };
31
+ }
11
32
 
12
33
  describe('live-annotation', () => {
13
34
  const locusUrl = 'https://locus.wbx2.com/locus/api/v1/loci/163c1787-c1f5-47cc-95eb-ab2d660999e6';
14
35
 
15
36
  describe('annotation', () => {
16
- let webex, annotationService;
37
+ let webex, annotationService, mockChannel;
17
38
 
18
39
  beforeEach(() => {
19
40
  webex = new MockWebex({
@@ -24,25 +45,56 @@ describe('live-annotation', () => {
24
45
  },
25
46
  });
26
47
 
27
-
28
48
  annotationService = webex.internal.annotation;
29
- annotationService.connect = sinon.stub().resolves(true);
30
- annotationService.webex.internal.llm.isConnected = sinon.stub().returns(true);
31
- annotationService.webex.internal.llm.getBinding = sinon.stub().returns(undefined);
32
- annotationService.webex.internal.llm.getLocusUrl = sinon.stub().returns(locusUrl);
33
49
  annotationService.approvalUrl = 'url/approval';
34
50
  annotationService.locusUrl = locusUrl;
35
51
 
52
+ mockChannel = createMockLLMChannel();
36
53
 
37
54
  webex.request = sinon.stub().returns(Promise.resolve('REQUEST_RETURN_VALUE'));
38
- annotationService.register = sinon.stub().resolves({
39
- body: {
40
- binding: 'binding',
41
- webSocketUrl: 'url',
42
- },
55
+ });
56
+
57
+ afterEach(() => {
58
+ annotationService.unregisterChannel();
59
+ sinon.restore();
60
+ });
61
+
62
+ describe('#registerChannel', () => {
63
+ it('registers an LLM channel and subscribes to relay events', () => {
64
+ annotationService.registerChannel(mockChannel);
65
+
66
+ assert.calledOnceWithExactly(mockChannel.on, 'event:relay.event', sinon.match.func);
67
+ assert.equal(annotationService.channel, mockChannel);
68
+ });
69
+
70
+ it('unregisters existing channel before registering new one', () => {
71
+ const oldChannel = createMockLLMChannel();
72
+ annotationService.registerChannel(oldChannel);
73
+
74
+ const newChannel = createMockLLMChannel();
75
+ annotationService.registerChannel(newChannel);
76
+
77
+ assert.calledOnceWithExactly(oldChannel.off, 'event:relay.event', sinon.match.func);
78
+ assert.calledOnceWithExactly(newChannel.on, 'event:relay.event', sinon.match.func);
79
+ assert.equal(annotationService.channel, newChannel);
43
80
  });
44
81
  });
45
82
 
83
+ describe('#unregisterChannel', () => {
84
+ it('unregisters the current channel', () => {
85
+ annotationService.registerChannel(mockChannel);
86
+ annotationService.unregisterChannel();
87
+
88
+ assert.calledOnceWithExactly(mockChannel.off, 'event:relay.event', sinon.match.func);
89
+ assert.equal(annotationService.channel, undefined);
90
+ });
91
+
92
+ it('does nothing if no channel is registered', () => {
93
+ annotationService.unregisterChannel();
94
+ // Should not throw
95
+ assert.equal(annotationService.channel, undefined);
96
+ });
97
+ });
46
98
 
47
99
  describe('event message processing', () => {
48
100
  beforeEach(async () => {
@@ -55,10 +107,8 @@ describe('live-annotation', () => {
55
107
  annotationService.eventCommandProcessor({});
56
108
  assert.notCalled(spy);
57
109
 
58
-
59
110
  annotationService.eventCommandProcessor({
60
- data: {
61
- }
111
+ data: {}
62
112
  });
63
113
  assert.notCalled(spy);
64
114
 
@@ -92,11 +142,9 @@ describe('live-annotation', () => {
92
142
  }
93
143
  }
94
144
  });
95
- assert.notCalled(spy)
145
+ assert.notCalled(spy);
96
146
  });
97
147
 
98
-
99
-
100
148
  it('eventCommandProcessor call success', () => {
101
149
  const spy = sinon.spy();
102
150
  annotationService.on(EVENT_TRIGGERS.ANNOTATION_COMMAND, spy);
@@ -121,74 +169,82 @@ describe('live-annotation', () => {
121
169
  });
122
170
 
123
171
  it('eventDataProcessor call failed', () => {
124
-
125
- const spy = sinon.spy(annotationService, "processStrokeMessage");
172
+ const spy = sinon.spy(annotationService, 'processStrokeMessage');
126
173
 
127
174
  annotationService.eventDataProcessor();
128
-
129
175
  assert.notCalled(spy);
130
176
 
131
177
  annotationService.eventDataProcessor({data: {}});
132
-
133
178
  assert.notCalled(spy);
134
179
 
135
180
  annotationService.eventDataProcessor({data: {relayType: 'NOT:annotation.client'}});
136
-
137
181
  assert.notCalled(spy);
138
182
  });
139
183
 
140
-
141
184
  it('eventDataProcessor call success', () => {
185
+ const spy = sinon.spy(annotationService, 'processStrokeMessage');
142
186
 
143
- const spy = sinon.spy(annotationService, "processStrokeMessage");
144
-
145
- annotationService.eventDataProcessor({data: {relayType: 'annotation.client', request:{value:{encryptionKeyUrl:"encryptionKeyUrl"}}}});
187
+ annotationService.eventDataProcessor({
188
+ data: {
189
+ relayType: 'annotation.client',
190
+ request: {value: {encryptionKeyUrl: 'encryptionKeyUrl'}}
191
+ }
192
+ });
146
193
 
147
194
  assert.calledOnceWithExactly(spy, {
148
195
  relayType: 'annotation.client',
149
- request: { value: { encryptionKeyUrl: 'encryptionKeyUrl' } }
150
- } );
151
-
196
+ request: {value: {encryptionKeyUrl: 'encryptionKeyUrl'}}
197
+ });
152
198
  });
153
199
 
154
-
155
200
  it('processStrokeMessage', async () => {
156
201
  const spy = sinon.spy();
157
202
  annotationService.on(EVENT_TRIGGERS.ANNOTATION_STROKE_DATA, spy);
158
203
 
159
- await annotationService.processStrokeMessage({request:{value:{encryptionKeyUrl: 'encryptionKeyUrl', content: 'content'}}});
204
+ await annotationService.processStrokeMessage({
205
+ request: {value: {encryptionKeyUrl: 'encryptionKeyUrl', content: 'content'}}
206
+ });
160
207
 
161
208
  assert.calledOnceWithExactly(spy, {
162
- payload:{request:{value:{encryptionKeyUrl: 'encryptionKeyUrl', content: 'decryptedContent'}}} ,
209
+ payload: {request: {value: {encryptionKeyUrl: 'encryptionKeyUrl', content: 'decryptedContent'}}},
163
210
  });
164
-
165
211
  });
166
-
167
212
  });
168
213
 
169
- describe('event message processing',() =>{
214
+ describe('event registration via registerChannel', () => {
215
+ it('registers relay event handler when channel is registered', () => {
216
+ annotationService.registerChannel(mockChannel);
170
217
 
171
- it('listens to mercury events once', () => {
218
+ assert.calledOnceWithExactly(mockChannel.on, 'event:relay.event', sinon.match.func);
219
+ });
172
220
 
173
- const spy = sinon.spy(annotationService.webex.internal.mercury, 'on');
221
+ it('processes events through the registered handler', () => {
222
+ annotationService.decryptContent = sinon.stub().returns(Promise.resolve('decryptedContent'));
223
+ annotationService.registerChannel(mockChannel);
174
224
 
175
- annotationService.listenToEvents();
225
+ // Get the handler that was registered
226
+ const handler = mockChannel.on.getCall(0).args[1];
176
227
 
177
- assert.calledOnceWithExactly(spy, 'event:locus.approval_request', sinon.match.func,sinon.match.object);
178
- });
228
+ const spy = sinon.spy(annotationService, 'processStrokeMessage');
229
+ handler({
230
+ data: {
231
+ relayType: 'annotation.client',
232
+ request: {value: {encryptionKeyUrl: 'key'}}
233
+ }
234
+ });
179
235
 
180
- it('listens to llm events once', () => {
236
+ assert.calledOnce(spy);
237
+ });
181
238
 
182
- const spy = sinon.spy(webex.internal.llm, 'on');
239
+ it('listens to mercury events via listenToEvents', () => {
240
+ const spy = sinon.spy(annotationService.webex.internal.mercury, 'on');
183
241
 
184
242
  annotationService.listenToEvents();
185
243
 
186
- assert.calledOnceWithExactly(spy, 'event:relay.event', sinon.match.func,sinon.match.object);
244
+ assert.calledOnceWithExactly(spy, 'event:locus.approval_request', sinon.match.func, sinon.match.object);
187
245
  });
188
-
189
246
  });
190
247
 
191
-
192
248
  describe('encrypt/decrypt Content', () => {
193
249
  beforeEach(async () => {
194
250
  annotationService.webex.internal.encryption.encryptText = sinon.stub().returns(Promise.resolve('RETURN_VALUE'));
@@ -196,67 +252,72 @@ describe('live-annotation', () => {
196
252
  });
197
253
 
198
254
  it('encryptContent', async () => {
199
- const result = await annotationService.encryptContent("encryptionKeyUrl", "content");
200
- assert.calledOnceWithExactly(webex.internal.encryption.encryptText, "encryptionKeyUrl", "content");
201
- assert.equal(result, 'RETURN_VALUE')
255
+ const result = await annotationService.encryptContent('encryptionKeyUrl', 'content');
256
+ assert.calledOnceWithExactly(webex.internal.encryption.encryptText, 'encryptionKeyUrl', 'content');
257
+ assert.equal(result, 'RETURN_VALUE');
202
258
  });
203
259
 
204
- it('decryptContent', async() => {
205
- const result = await annotationService.decryptContent("decryptionKeyUrl", "content");
206
- assert.calledOnceWithExactly(webex.internal.encryption.decryptText, "decryptionKeyUrl", "content");
207
- assert.equal(result, 'RETURN_VALUE')
260
+ it('decryptContent', async () => {
261
+ const result = await annotationService.decryptContent('decryptionKeyUrl', 'content');
262
+ assert.calledOnceWithExactly(webex.internal.encryption.decryptText, 'decryptionKeyUrl', 'content');
263
+ assert.equal(result, 'RETURN_VALUE');
208
264
  });
209
-
210
265
  });
211
266
 
212
-
213
-
214
- describe('publish Stroke Data with LLM is not connected', () => {
215
-
216
- beforeEach(async () => {
217
- annotationService.webex.internal.llm.socket = new MockWebSocket();
218
- annotationService.webex.internal.llm.isConnected = sinon.stub().returns(false);
267
+ describe('publish Stroke Data with no channel registered', () => {
268
+ it('does not send when no channel is registered', async () => {
269
+ annotationService.sendStrokeData({});
270
+ // Should not throw, just return early
219
271
  });
272
+ });
220
273
 
221
- it('publish Stroke Data with LLM is not connected', async () => {
222
- annotationService.sendStrokeData("", {});
223
- assert.notCalled(annotationService.webex.internal.llm.socket.send);
224
- });
274
+ describe('publish Stroke Data with channel not connected', () => {
275
+ it('does not send when channel is not connected', async () => {
276
+ const disconnectedChannel = createMockLLMChannel({isConnected: false});
277
+ annotationService.registerChannel(disconnectedChannel);
225
278
 
279
+ annotationService.sendStrokeData({});
280
+ assert.notCalled(disconnectedChannel.socket.send);
281
+ });
226
282
  });
227
283
 
228
284
  describe('sendStrokeData', () => {
285
+ let strokeData;
229
286
 
230
287
  beforeEach(async () => {
231
- annotationService.webex.internal.llm.socket = new MockWebSocket();
232
- });
233
-
288
+ annotationService.registerChannel(mockChannel);
289
+ annotationService.webex.internal.encryption.encryptText = sinon.stub().returns(Promise.resolve('encryptedContent'));
234
290
 
235
- it('works on publish Stroke Data', async () => {
236
- const strokeData = {
291
+ strokeData = {
237
292
  content: {
238
- "contentsBuffer": [{
239
- "contentArray": [{
240
- "curveId": "58dcf45c-1fc5-46bf-a902-053621dd8977",
241
- "curvePoints": [592.593, 352.963, 3.400, 596.710, 352.963, 3.400, 600.000, 352.963, 3.398, 600.000, 352.963, 3.398],
242
- "stride": 3
243
- }], "type": "curve", "name": "contentUpdate"
244
- }], "action": "contentUpdate", "sender": {"name": "perfect", "id": "4dd5eaf9-4cf8-4f0f-a1d6-014bf5d00741"}
293
+ contentsBuffer: [{
294
+ contentArray: [{
295
+ curveId: '58dcf45c-1fc5-46bf-a902-053621dd8977',
296
+ curvePoints: [592.593, 352.963, 3.400, 596.710, 352.963, 3.400],
297
+ stride: 3
298
+ }],
299
+ type: 'curve',
300
+ name: 'contentUpdate'
301
+ }],
302
+ action: 'contentUpdate',
303
+ sender: {name: 'perfect', id: '4dd5eaf9-4cf8-4f0f-a1d6-014bf5d00741'}
245
304
  },
246
- deviceId: "525ead98-6c93-4fcb-899d-517305c47513",
305
+ deviceId: '525ead98-6c93-4fcb-899d-517305c47513',
247
306
  requesterId: '525ead98-6c93-4fcb-899d-517305c47513',
248
- toUserId: "987ead98-6c93-4fcb-899d-517305c47503",
307
+ toUserId: '987ead98-6c93-4fcb-899d-517305c47503',
249
308
  shareInstanceId: '7fa6fe07-dcb1-41ad-973d-7bcf65fab55d',
250
- encryptionKeyUrl: "encryptionKeyUrl",
309
+ encryptionKeyUrl: 'encryptionKeyUrl',
251
310
  version: '1',
252
- } ;
311
+ };
312
+ });
253
313
 
314
+ it('works on publish Stroke Data', async () => {
254
315
  annotationService.publishEncrypted(strokeData.content, strokeData);
255
316
 
256
317
  const sendObject = {
257
318
  id: sinon.match.string,
258
319
  type: 'publishRequest',
259
- recipients: {route: undefined},
320
+ recipients: {route: 'binding'},
260
321
  headers: {to: '987ead98-6c93-4fcb-899d-517305c47503'},
261
322
  data: {
262
323
  eventType: 'relay.event',
@@ -266,7 +327,7 @@ describe('live-annotation', () => {
266
327
  type: ANNOTATION_REQUEST_TYPE.ANNOTATION_MESSAGE,
267
328
  content: strokeData.content,
268
329
  version: '1',
269
- seq:sinon.match.number,
330
+ seq: sinon.match.number,
270
331
  deviceId: sinon.match.string,
271
332
  requesterId: sinon.match.string,
272
333
  shareInstanceId: strokeData.shareInstanceId,
@@ -280,23 +341,48 @@ describe('live-annotation', () => {
280
341
  filterMessage: false,
281
342
  };
282
343
 
283
- assert.calledOnceWithExactly(annotationService.webex.internal.llm.socket.send, sendObject);
344
+ assert.calledOnceWithExactly(mockChannel.socket.send, sendObject);
284
345
  });
285
346
 
286
- });
347
+ it('does not send if socket is not available', () => {
348
+ const channelWithoutSocket = createMockLLMChannel();
349
+ channelWithoutSocket.getSocket.returns(undefined);
350
+ annotationService.registerChannel(channelWithoutSocket);
287
351
 
352
+ annotationService.publishEncrypted(strokeData.content, strokeData);
288
353
 
289
- describe('Locus API collection', () => {
354
+ assert.notCalled(channelWithoutSocket.socket.send);
355
+ });
290
356
 
291
- describe('send approve request', () => {
292
- it('makes send request approved annotation as expected', async () => {
293
- const
294
- requestData = {
295
- toUserId: '4dd5eaf9-4cf8-4f0f-a1d6-014bf5d00741',
296
- toDeviceUrl: 'https://wdm-a.wbx2.com/wdm/api/v1/devices/a3018aa9-70cb-4142-ae9a-f03db4fe1057',
297
- shareInstanceId: '9428c492-da14-476f-a36c-b377ee8c4009',
298
- };
357
+ it('does not send if binding is not available', () => {
358
+ const channelWithoutBinding = createMockLLMChannel({binding: undefined});
359
+ channelWithoutBinding.getBinding.returns(undefined);
360
+ annotationService.registerChannel(channelWithoutBinding);
361
+
362
+ annotationService.publishEncrypted(strokeData.content, strokeData);
363
+
364
+ assert.notCalled(channelWithoutBinding.socket.send);
365
+ });
299
366
 
367
+ it('encrypts content before publishing', async () => {
368
+ await annotationService.sendStrokeData(strokeData);
369
+
370
+ assert.calledOnceWithExactly(
371
+ webex.internal.encryption.encryptText,
372
+ strokeData.encryptionKeyUrl,
373
+ strokeData.content
374
+ );
375
+ });
376
+ });
377
+
378
+ describe('Locus API collection', () => {
379
+ describe('send approve request', () => {
380
+ it('makes send request approved annotation as expected', async () => {
381
+ const requestData = {
382
+ toUserId: '4dd5eaf9-4cf8-4f0f-a1d6-014bf5d00741',
383
+ toDeviceUrl: 'https://wdm-a.wbx2.com/wdm/api/v1/devices/a3018aa9-70cb-4142-ae9a-f03db4fe1057',
384
+ shareInstanceId: '9428c492-da14-476f-a36c-b377ee8c4009',
385
+ };
300
386
 
301
387
  const result = await annotationService.approveAnnotation(requestData);
302
388
  assert.calledOnceWithExactly(webex.request, {
@@ -313,22 +399,20 @@ describe('live-annotation', () => {
313
399
  }
314
400
  });
315
401
 
316
- assert.equal(result, 'REQUEST_RETURN_VALUE')
402
+ assert.equal(result, 'REQUEST_RETURN_VALUE');
317
403
  });
318
404
  });
319
405
 
320
406
  describe('cancel Approve request', () => {
321
407
  it('makes the cancel Approve request annotation as expected', async () => {
322
- const
323
- requestData = {
324
- toUserId: '4dd5eaf9-4cf8-4f0f-a1d6-014bf5d00741',
325
- toDeviceUrl: 'https://wdm-a.wbx2.com/wdm/api/v1/devices/a3018aa9-70cb-4142-ae9a-f03db4fe1057',
326
- shareInstanceId: '9428c492-da14-476f-a36c-b377ee8c4009',
327
- };
328
- const approval = {url:"url/cancel"};
329
-
330
-
331
- const result = await annotationService.cancelApproveAnnotation(requestData,approval);
408
+ const requestData = {
409
+ toUserId: '4dd5eaf9-4cf8-4f0f-a1d6-014bf5d00741',
410
+ toDeviceUrl: 'https://wdm-a.wbx2.com/wdm/api/v1/devices/a3018aa9-70cb-4142-ae9a-f03db4fe1057',
411
+ shareInstanceId: '9428c492-da14-476f-a36c-b377ee8c4009',
412
+ };
413
+ const approval = {url: 'url/cancel'};
414
+
415
+ const result = await annotationService.cancelApproveAnnotation(requestData, approval);
332
416
  assert.calledOnceWithExactly(webex.request, {
333
417
  method: 'PUT',
334
418
  url: 'url/cancel',
@@ -339,21 +423,17 @@ describe('live-annotation', () => {
339
423
  }
340
424
  });
341
425
 
342
- assert.equal(result, 'REQUEST_RETURN_VALUE')
426
+ assert.equal(result, 'REQUEST_RETURN_VALUE');
343
427
  });
344
428
  });
345
429
 
346
-
347
-
348
430
  describe('close annotation', () => {
349
431
  it('makes the close annotation as expected', async () => {
350
- const
351
- requestData = {
352
- toUserId: '4dd5eaf9-4cf8-4f0f-a1d6-014bf5d00741',
353
- toDeviceUrl: 'https://wdm-a.wbx2.com/wdm/api/v1/devices/a3018aa9-70cb-4142-ae9a-f03db4fe1057',
354
- shareInstanceId: '9428c492-da14-476f-a36c-b377ee8c4009',
355
- };
356
-
432
+ const requestData = {
433
+ toUserId: '4dd5eaf9-4cf8-4f0f-a1d6-014bf5d00741',
434
+ toDeviceUrl: 'https://wdm-a.wbx2.com/wdm/api/v1/devices/a3018aa9-70cb-4142-ae9a-f03db4fe1057',
435
+ shareInstanceId: '9428c492-da14-476f-a36c-b377ee8c4009',
436
+ };
357
437
 
358
438
  const result = await annotationService.closeAnnotation(requestData);
359
439
  assert.calledOnceWithExactly(webex.request, {
@@ -370,16 +450,15 @@ describe('live-annotation', () => {
370
450
  }
371
451
  });
372
452
 
373
- assert.equal(result, 'REQUEST_RETURN_VALUE')
453
+ assert.equal(result, 'REQUEST_RETURN_VALUE');
374
454
  });
375
455
  });
376
456
 
377
-
378
457
  describe('declined annotation', () => {
379
458
  it('makes the declined annotation as expected', async () => {
380
459
  const approval = {
381
460
  url: 'approvalUrl'
382
- }
461
+ };
383
462
  const result = await annotationService.declineRequest(approval);
384
463
  assert.calledOnceWithExactly(webex.request, {
385
464
  method: 'PUT',
@@ -390,7 +469,7 @@ describe('live-annotation', () => {
390
469
  }
391
470
  });
392
471
 
393
- assert.equal(result, 'REQUEST_RETURN_VALUE')
472
+ assert.equal(result, 'REQUEST_RETURN_VALUE');
394
473
  });
395
474
  });
396
475
 
@@ -398,7 +477,7 @@ describe('live-annotation', () => {
398
477
  it('makes the accepted annotation as expected', async () => {
399
478
  const approval = {
400
479
  url: 'approvalUrl'
401
- }
480
+ };
402
481
  const result = await annotationService.acceptRequest(approval);
403
482
  assert.calledOnceWithExactly(webex.request, {
404
483
  method: 'PUT',
@@ -409,55 +488,70 @@ describe('live-annotation', () => {
409
488
  }
410
489
  });
411
490
 
412
- assert.equal(result, 'REQUEST_RETURN_VALUE')
491
+ assert.equal(result, 'REQUEST_RETURN_VALUE');
413
492
  });
414
493
  });
415
494
  });
416
495
 
417
496
  describe('#deregisterEvents', () => {
418
- let llmOn;
419
- let llmOff;
420
497
  let mercuryOn;
421
498
  let mercuryOff;
422
499
 
423
500
  beforeEach(() => {
424
- llmOn = sinon.spy(webex.internal.llm, 'on');
425
- llmOff = sinon.spy(webex.internal.llm, 'off');
426
501
  mercuryOn = sinon.spy(webex.internal.mercury, 'on');
427
502
  mercuryOff = sinon.spy(webex.internal.mercury, 'off');
428
503
  });
429
504
 
430
- it('cleans up events', () => {
505
+ it('cleans up mercury events and unregisters channel', () => {
506
+ annotationService.registerChannel(mockChannel);
431
507
  annotationService.locusUrlUpdate(locusUrl);
508
+
432
509
  assert.calledWith(
433
510
  mercuryOn,
434
511
  'event:locus.approval_request',
435
512
  annotationService.eventCommandProcessor,
436
513
  annotationService
437
514
  );
438
- assert.calledWith(
439
- llmOn,
440
- 'event:relay.event',
441
- annotationService.eventDataProcessor,
442
- annotationService
443
- );
444
515
  assert.match(annotationService.hasSubscribedToEvents, true);
445
516
 
446
517
  annotationService.deregisterEvents();
447
- assert.calledWith(llmOff, 'event:relay.event', annotationService.eventDataProcessor);
518
+
448
519
  assert.calledWith(
449
520
  mercuryOff,
450
521
  'event:locus.approval_request',
451
522
  annotationService.eventCommandProcessor
452
523
  );
524
+ assert.calledOnceWithExactly(mockChannel.off, 'event:relay.event', sinon.match.func);
525
+ assert.equal(annotationService.channel, undefined);
453
526
  assert.match(annotationService.hasSubscribedToEvents, false);
454
527
  });
455
528
 
456
- it('does not call llm off if events have not been registered', () => {
529
+ it('does not call off if events have not been registered', () => {
457
530
  annotationService.deregisterEvents();
458
- assert.notCalled(llmOff);
459
531
  assert.notCalled(mercuryOff);
460
532
  });
461
533
  });
534
+
535
+ describe('#locusUrlUpdate', () => {
536
+ it('updates locusUrl and calls listenToEvents', () => {
537
+ const newLocusUrl = 'https://new-locus-url.com';
538
+ const listenSpy = sinon.spy(annotationService, 'listenToEvents');
539
+
540
+ annotationService.locusUrlUpdate(newLocusUrl);
541
+
542
+ assert.equal(annotationService.locusUrl, newLocusUrl);
543
+ assert.calledOnce(listenSpy);
544
+ });
545
+ });
546
+
547
+ describe('#approvalUrlUpdate', () => {
548
+ it('updates approvalUrl', () => {
549
+ const newApprovalUrl = 'https://new-approval-url.com';
550
+
551
+ annotationService.approvalUrlUpdate(newApprovalUrl);
552
+
553
+ assert.equal(annotationService.approvalUrl, newApprovalUrl);
554
+ });
555
+ });
462
556
  });
463
557
  });
@@ -26,6 +26,7 @@ describe('plugin-meetings', () => {
26
26
  breakout.sessionId = 'sessionId';
27
27
  breakout.sessionType = 'BREAKOUT';
28
28
  breakout.url = 'url';
29
+ breakout.resourceLink = 'resource-link';
29
30
  breakout.collection = {
30
31
  parent: {
31
32
  meetingId: 'activeMeetingId',
@@ -45,6 +46,7 @@ describe('plugin-meetings', () => {
45
46
  describe('initialize', () => {
46
47
  it('creates the object correctly', () => {
47
48
  assert.instanceOf(breakout.breakoutRequest, BreakoutRequest);
49
+ assert.equal(breakout.resourceLink, 'resource-link');
48
50
  });
49
51
  });
50
52
 
@@ -217,10 +219,14 @@ describe('plugin-meetings', () => {
217
219
  locusParticipantsUpdate: sinon.stub(),
218
220
  };
219
221
 
220
- const locusData = {some: 'data'};
222
+ const locusData = {participants: [{id: 'participant-1'}], sequence: {entries: [123]}};
221
223
  const result = breakout.parseRoster(locusData);
222
224
 
223
- assert.calledOnceWithExactly(breakout.members.locusParticipantsUpdate, locusData);
225
+ assert.calledOnceWithExactly(breakout.members.locusParticipantsUpdate, {
226
+ participants: [{id: 'participant-1'}],
227
+ isReplace: true,
228
+ });
229
+ assert.equal(breakout.breakoutRosterLocus, locusData);
224
230
  assert.equal(result, undefined);
225
231
  });
226
232
  it('not call locusParticipantsUpdate if sequence is expired', () => {
@@ -228,7 +234,7 @@ describe('plugin-meetings', () => {
228
234
  locusParticipantsUpdate: sinon.stub(),
229
235
  };
230
236
  breakout.isNeedHandleRoster = sinon.stub().returns(false);
231
- const locusData = {some: 'data'};
237
+ const locusData = {participants: [{id: 'participant-1'}], sequence: {entries: [123]}};
232
238
  breakout.parseRoster(locusData);
233
239
 
234
240
  assert.notCalled(breakout.members.locusParticipantsUpdate);