@webex/plugin-meetings 3.12.0-next.18 → 3.12.0-next.180
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.
- package/.sdd/manifest.json +1312 -0
- package/.sdd/templates/.source.json +30 -0
- package/.sdd/templates/component-repo/module-docs/module-spec-quality.md +111 -0
- package/.sdd/templates/component-repo/module-docs/module-spec.template.md +321 -0
- package/.sdd/templates/component-repo/reference-docs/adr/_adr-example.md +59 -0
- package/.sdd/templates/component-repo/reference-docs/patterns/_pattern-example.md +49 -0
- package/.sdd/templates/component-repo/reference-docs/rules/_rule-example.md +42 -0
- package/.sdd/templates/component-repo/standing-docs/AGENTS.template.md +120 -0
- package/.sdd/templates/component-repo/standing-docs/ARCHITECTURE.template.md +206 -0
- package/.sdd/templates/component-repo/standing-docs/CONTRACTS.template.md +90 -0
- package/.sdd/templates/component-repo/standing-docs/DATA_MODEL.template.md +68 -0
- package/.sdd/templates/component-repo/standing-docs/GETTING_STARTED.template.md +111 -0
- package/.sdd/templates/component-repo/standing-docs/GLOSSARY.template.md +57 -0
- package/.sdd/templates/component-repo/standing-docs/REVIEW_CHECKLIST.template.md +69 -0
- package/.sdd/templates/component-repo/standing-docs/RULES.template.md +96 -0
- package/.sdd/templates/component-repo/standing-docs/SECURITY.template.md +84 -0
- package/.sdd/templates/component-repo/standing-docs/SERVICE_STATE.template.md +82 -0
- package/.sdd/templates/component-repo/standing-docs/SPEC_INDEX.template.md +94 -0
- package/.sdd/templates/component-repo/standing-docs/TEST_INDEX.template.md +64 -0
- package/.sdd/templates/component-repo/template-map.json +112 -0
- package/AGENTS.md +135 -0
- package/ai-docs/ARCHITECTURE.md +207 -0
- package/ai-docs/CONTRACTS.md +267 -0
- package/ai-docs/DATA_MODEL.md +64 -0
- package/ai-docs/GETTING_STARTED.md +73 -0
- package/ai-docs/GLOSSARY.md +56 -0
- package/ai-docs/REVIEW_CHECKLIST.md +45 -0
- package/ai-docs/RULES.md +79 -0
- package/ai-docs/SECURITY.md +74 -0
- package/ai-docs/SERVICE_STATE.md +59 -0
- package/ai-docs/SPEC_INDEX.md +85 -0
- package/ai-docs/TEST_INDEX.md +45 -0
- package/ai-docs/adr/0001-migrate-existing-docs-into-sdd.md +61 -0
- package/ai-docs/patterns/defensive-error-propagation.md +55 -0
- package/ai-docs/patterns/event-scope-emission.md +46 -0
- package/ai-docs/patterns/source-to-test-path-mirroring.md +45 -0
- package/ai-docs/patterns/stateless-plugin-request-classes.md +53 -0
- package/ai-docs/patterns/typed-constants-and-enum-values.md +47 -0
- package/assets/README.md +26 -0
- package/assets/e2ee.js +2 -0
- package/assets/e2ee.wasm +0 -0
- package/dist/aiEnableRequest/index.js +15 -2
- package/dist/aiEnableRequest/index.js.map +1 -1
- package/dist/annotation/index.js +55 -19
- package/dist/annotation/index.js.map +1 -1
- package/dist/assets/e2ee.js +2 -0
- package/dist/assets/e2ee.wasm +0 -0
- package/dist/breakouts/breakout.js +8 -3
- package/dist/breakouts/breakout.js.map +1 -1
- package/dist/breakouts/events.js +29 -14
- package/dist/breakouts/events.js.map +1 -1
- package/dist/breakouts/index.js +128 -7
- package/dist/breakouts/index.js.map +1 -1
- package/dist/common/errors/webex-errors.js +54 -5
- package/dist/common/errors/webex-errors.js.map +1 -1
- package/dist/config.js +3 -2
- package/dist/config.js.map +1 -1
- package/dist/constants.js +39 -11
- package/dist/constants.js.map +1 -1
- package/dist/controls-options-manager/index.js +46 -10
- package/dist/controls-options-manager/index.js.map +1 -1
- package/dist/hashTree/constants.js +4 -1
- package/dist/hashTree/constants.js.map +1 -1
- package/dist/hashTree/hashTreeParser.js +1096 -391
- package/dist/hashTree/hashTreeParser.js.map +1 -1
- package/dist/hashTree/utils.js +20 -0
- package/dist/hashTree/utils.js.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/interceptors/dataChannelAuthToken.js +58 -16
- package/dist/interceptors/dataChannelAuthToken.js.map +1 -1
- package/dist/interceptors/locusRetry.js +24 -9
- package/dist/interceptors/locusRetry.js.map +1 -1
- package/dist/interpretation/index.js +55 -12
- package/dist/interpretation/index.js.map +1 -1
- package/dist/interpretation/interpretation.types.js +7 -0
- package/dist/interpretation/interpretation.types.js.map +1 -0
- package/dist/interpretation/siLanguage.js +1 -1
- package/dist/locus-info/controlsUtils.js +4 -1
- package/dist/locus-info/controlsUtils.js.map +1 -1
- package/dist/locus-info/index.js +615 -176
- package/dist/locus-info/index.js.map +1 -1
- package/dist/locus-info/infoUtils.js +36 -5
- package/dist/locus-info/infoUtils.js.map +1 -1
- package/dist/locus-info/types.js +20 -0
- package/dist/locus-info/types.js.map +1 -1
- package/dist/media/MediaConnectionAwaiter.js +229 -166
- package/dist/media/MediaConnectionAwaiter.js.map +1 -1
- package/dist/media/index.js +8 -2
- package/dist/media/index.js.map +1 -1
- package/dist/media/properties.js +4 -5
- package/dist/media/properties.js.map +1 -1
- package/dist/meeting/in-meeting-actions.js +5 -1
- package/dist/meeting/in-meeting-actions.js.map +1 -1
- package/dist/meeting/index.js +1844 -959
- package/dist/meeting/index.js.map +1 -1
- package/dist/meeting/locusMediaRequest.js +229 -82
- package/dist/meeting/locusMediaRequest.js.map +1 -1
- package/dist/meeting/muteState.js +10 -1
- package/dist/meeting/muteState.js.map +1 -1
- package/dist/meeting/request.js +5 -2
- package/dist/meeting/request.js.map +1 -1
- package/dist/meeting/util.js +42 -4
- package/dist/meeting/util.js.map +1 -1
- package/dist/meeting/voicea-meeting.js +2 -1
- package/dist/meeting/voicea-meeting.js.map +1 -1
- package/dist/meeting-info/meeting-info-v2.js +12 -5
- package/dist/meeting-info/meeting-info-v2.js.map +1 -1
- package/dist/meetings/index.js +304 -129
- package/dist/meetings/index.js.map +1 -1
- package/dist/meetings/meetings.types.js +6 -1
- package/dist/meetings/meetings.types.js.map +1 -1
- package/dist/meetings/request.js +39 -0
- package/dist/meetings/request.js.map +1 -1
- package/dist/meetings/util.js +116 -18
- package/dist/meetings/util.js.map +1 -1
- package/dist/member/index.js +10 -0
- package/dist/member/index.js.map +1 -1
- package/dist/member/types.js.map +1 -1
- package/dist/member/util.js +30 -0
- package/dist/member/util.js.map +1 -1
- package/dist/members/index.js +101 -43
- package/dist/members/index.js.map +1 -1
- package/dist/members/util.js +8 -1
- package/dist/members/util.js.map +1 -1
- package/dist/metrics/constants.js +7 -1
- package/dist/metrics/constants.js.map +1 -1
- package/dist/multistream/codec/constants.js +63 -0
- package/dist/multistream/codec/constants.js.map +1 -0
- package/dist/multistream/mediaRequestManager.js +62 -15
- package/dist/multistream/mediaRequestManager.js.map +1 -1
- package/dist/multistream/receiveSlot.js +9 -0
- package/dist/multistream/receiveSlot.js.map +1 -1
- package/dist/multistream/remoteMediaManager.js +32 -4
- package/dist/multistream/remoteMediaManager.js.map +1 -1
- package/dist/reachability/clusterReachability.js.map +1 -1
- package/dist/reachability/index.js +121 -83
- package/dist/reachability/index.js.map +1 -1
- package/dist/reachability/reachability.types.js +2 -0
- package/dist/reachability/reachability.types.js.map +1 -1
- package/dist/reachability/util.js +45 -0
- package/dist/reachability/util.js.map +1 -1
- package/dist/reactions/reactions.type.js.map +1 -1
- package/dist/recording-controller/index.js +1 -3
- package/dist/recording-controller/index.js.map +1 -1
- package/dist/roap/turnDiscovery.js +8 -1
- package/dist/roap/turnDiscovery.js.map +1 -1
- package/dist/types/annotation/index.d.ts +19 -0
- package/dist/types/common/errors/webex-errors.d.ts +36 -2
- package/dist/types/config.d.ts +3 -2
- package/dist/types/constants.d.ts +15 -2
- package/dist/types/controls-options-manager/index.d.ts +16 -0
- package/dist/types/hashTree/constants.d.ts +1 -0
- package/dist/types/hashTree/hashTreeParser.d.ts +201 -22
- package/dist/types/hashTree/utils.d.ts +7 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/interceptors/locusRetry.d.ts +4 -4
- package/dist/types/interpretation/interpretation.types.d.ts +10 -0
- package/dist/types/locus-info/index.d.ts +106 -8
- package/dist/types/locus-info/infoUtils.d.ts +8 -0
- package/dist/types/locus-info/types.d.ts +22 -1
- package/dist/types/media/MediaConnectionAwaiter.d.ts +66 -49
- package/dist/types/media/properties.d.ts +6 -2
- package/dist/types/meeting/in-meeting-actions.d.ts +4 -0
- package/dist/types/meeting/index.d.ts +217 -16
- package/dist/types/meeting/locusMediaRequest.d.ts +12 -0
- package/dist/types/meeting/request.d.ts +1 -0
- package/dist/types/meeting/util.d.ts +12 -1
- package/dist/types/meeting-info/meeting-info-v2.d.ts +1 -0
- package/dist/types/meetings/index.d.ts +40 -19
- package/dist/types/meetings/meetings.types.d.ts +15 -0
- package/dist/types/meetings/request.d.ts +14 -0
- package/dist/types/member/index.d.ts +1 -0
- package/dist/types/member/types.d.ts +1 -0
- package/dist/types/member/util.d.ts +9 -0
- package/dist/types/members/index.d.ts +15 -2
- package/dist/types/members/util.d.ts +1 -5
- package/dist/types/metrics/constants.d.ts +6 -0
- package/dist/types/multistream/codec/constants.d.ts +7 -0
- package/dist/types/multistream/mediaRequestManager.d.ts +22 -5
- package/dist/types/multistream/remoteMediaManager.d.ts +18 -0
- package/dist/types/reachability/clusterReachability.d.ts +3 -3
- package/dist/types/reachability/index.d.ts +10 -3
- package/dist/types/reachability/reachability.types.d.ts +7 -0
- package/dist/types/reachability/util.d.ts +17 -0
- package/dist/types/reactions/reactions.type.d.ts +3 -0
- package/dist/webinar/index.js +441 -252
- package/dist/webinar/index.js.map +1 -1
- package/package.json +26 -24
- package/src/aiEnableRequest/ai-docs/ai-enable-request-spec.md +223 -0
- package/src/aiEnableRequest/index.ts +16 -0
- package/src/annotation/ai-docs/annotation-spec.md +236 -0
- package/src/annotation/index.ts +61 -29
- package/src/breakouts/ai-docs/breakouts-spec.md +324 -0
- package/src/breakouts/breakout.ts +3 -1
- package/src/breakouts/events.ts +33 -11
- package/src/breakouts/index.ts +145 -3
- package/src/common/errors/webex-errors.ts +56 -3
- package/src/config.ts +3 -2
- package/src/constants.ts +23 -4
- package/src/controls-options-manager/ai-docs/controls-options-manager-spec.md +243 -0
- package/src/controls-options-manager/index.ts +62 -10
- package/src/hashTree/ai-docs/hash-tree-spec.md +267 -0
- package/src/hashTree/constants.ts +7 -0
- package/src/hashTree/hashTreeParser.ts +861 -193
- package/src/hashTree/utils.ts +19 -0
- package/src/index.ts +7 -0
- package/src/interceptors/ai-docs/interceptors-spec.md +247 -0
- package/src/interceptors/dataChannelAuthToken.ts +59 -12
- package/src/interceptors/locusRetry.ts +26 -5
- package/src/interpretation/ai-docs/interpretation-spec.md +256 -0
- package/src/interpretation/index.ts +65 -10
- package/src/interpretation/interpretation.types.ts +11 -0
- package/src/locus-info/ai-docs/locus-info-spec.md +293 -0
- package/src/locus-info/controlsUtils.ts +3 -1
- package/src/locus-info/index.ts +566 -164
- package/src/locus-info/infoUtils.ts +41 -6
- package/src/locus-info/types.ts +26 -1
- package/src/media/MediaConnectionAwaiter.ts +229 -196
- package/src/media/ai-docs/media-spec.md +267 -0
- package/src/media/index.ts +10 -1
- package/src/media/properties.ts +8 -3
- package/src/meeting/ai-docs/meeting-spec.md +401 -0
- package/src/meeting/in-meeting-actions.ts +8 -0
- package/src/meeting/index.ts +1085 -252
- package/src/meeting/locusMediaRequest.ts +106 -6
- package/src/meeting/muteState.ts +10 -1
- package/src/meeting/request.ts +11 -0
- package/src/meeting/util.ts +53 -9
- package/src/meeting/voicea-meeting.ts +1 -1
- package/src/meeting-info/ai-docs/meeting-info-spec.md +261 -0
- package/src/meeting-info/meeting-info-v2.ts +11 -4
- package/src/meetings/ai-docs/meetings-spec.md +296 -0
- package/src/meetings/index.ts +202 -81
- package/src/meetings/meetings.types.ts +19 -0
- package/src/meetings/request.ts +43 -0
- package/src/meetings/util.ts +117 -4
- package/src/member/ai-docs/member-spec.md +196 -0
- package/src/member/index.ts +10 -0
- package/src/member/types.ts +1 -0
- package/src/member/util.ts +29 -0
- package/src/members/ai-docs/members-spec.md +256 -0
- package/src/members/index.ts +70 -7
- package/src/members/util.ts +12 -4
- package/src/metrics/ai-docs/metrics-spec.md +185 -0
- package/src/metrics/constants.ts +6 -0
- package/src/multistream/ai-docs/multistream-spec.md +292 -0
- package/src/multistream/codec/constants.ts +58 -0
- package/src/multistream/mediaRequestManager.ts +119 -28
- package/src/multistream/receiveSlot.ts +18 -0
- package/src/multistream/remoteMediaManager.ts +23 -1
- package/src/personal-meeting-room/ai-docs/personal-meeting-room-spec.md +234 -0
- package/src/reachability/ai-docs/reachability-spec.md +261 -0
- package/src/reachability/clusterReachability.ts +3 -2
- package/src/reachability/index.ts +47 -16
- package/src/reachability/reachability.types.ts +11 -0
- package/src/reachability/util.ts +36 -0
- package/src/reactions/ai-docs/reactions-spec.md +198 -0
- package/src/reactions/reactions.type.ts +3 -0
- package/src/reconnection-manager/ai-docs/reconnection-manager-spec.md +272 -0
- package/src/recording-controller/ai-docs/recording-controller-spec.md +223 -0
- package/src/recording-controller/index.ts +1 -2
- package/src/roap/ai-docs/roap-spec.md +241 -0
- package/src/roap/turnDiscovery.ts +9 -1
- package/src/webinar/ai-docs/webinar-spec.md +243 -0
- package/src/webinar/index.ts +247 -89
- package/test/unit/spec/aiEnableRequest/index.ts +86 -0
- package/test/unit/spec/annotation/index.ts +214 -182
- package/test/unit/spec/breakouts/breakout.ts +9 -3
- package/test/unit/spec/breakouts/events.ts +120 -2
- package/test/unit/spec/breakouts/index.ts +336 -15
- package/test/unit/spec/common/errors/webex-errors.ts +78 -0
- package/test/unit/spec/controls-options-manager/index.js +139 -32
- package/test/unit/spec/hashTree/hashTreeParser.ts +2451 -184
- package/test/unit/spec/hashTree/utils.ts +37 -0
- package/test/unit/spec/interceptors/dataChannelAuthToken.ts +179 -1
- package/test/unit/spec/interceptors/locusRetry.ts +234 -5
- package/test/unit/spec/interpretation/index.ts +119 -4
- package/test/unit/spec/locus-info/controlsUtils.js +172 -57
- package/test/unit/spec/locus-info/index.js +1014 -58
- package/test/unit/spec/locus-info/infoUtils.js +184 -1
- package/test/unit/spec/media/MediaConnectionAwaiter.ts +479 -17
- package/test/unit/spec/media/index.ts +92 -0
- package/test/unit/spec/media/properties.ts +26 -26
- package/test/unit/spec/meeting/in-meeting-actions.ts +4 -0
- package/test/unit/spec/meeting/index.js +3462 -493
- package/test/unit/spec/meeting/locusMediaRequest.ts +406 -4
- package/test/unit/spec/meeting/muteState.js +81 -0
- package/test/unit/spec/meeting/request.js +12 -0
- package/test/unit/spec/meeting/utils.js +205 -19
- package/test/unit/spec/meeting/voicea-meeting.ts +85 -1
- package/test/unit/spec/meeting-info/meetinginfov2.js +88 -11
- package/test/unit/spec/meetings/index.js +549 -49
- package/test/unit/spec/meetings/request.js +141 -0
- package/test/unit/spec/meetings/utils.js +402 -51
- package/test/unit/spec/member/index.js +7 -0
- package/test/unit/spec/member/util.js +89 -0
- package/test/unit/spec/members/index.js +216 -0
- package/test/unit/spec/members/request.js +37 -1
- package/test/unit/spec/members/utils.js +63 -0
- package/test/unit/spec/multistream/mediaRequestManager.ts +501 -37
- package/test/unit/spec/multistream/remoteMediaManager.ts +46 -0
- package/test/unit/spec/reachability/index.ts +128 -46
- package/test/unit/spec/reachability/util.ts +31 -0
- package/test/unit/spec/recording-controller/index.js +9 -8
- package/test/unit/spec/roap/turnDiscovery.ts +20 -0
- package/test/unit/spec/webinar/index.ts +935 -466
package/src/webinar/index.ts
CHANGED
|
@@ -4,20 +4,23 @@
|
|
|
4
4
|
import {WebexPlugin, config} from '@webex/webex-core';
|
|
5
5
|
import uuid from 'uuid';
|
|
6
6
|
import {get} from 'lodash';
|
|
7
|
-
import
|
|
7
|
+
import type LLMChannel from '@webex/internal-plugin-llm';
|
|
8
8
|
import {
|
|
9
9
|
_ID_,
|
|
10
|
+
EVENT_TRIGGERS,
|
|
10
11
|
HEADERS,
|
|
11
12
|
HTTP_VERBS,
|
|
12
13
|
MEETINGS,
|
|
13
14
|
SELF_ROLES,
|
|
14
15
|
SHARE_STATUS,
|
|
15
16
|
DEFAULT_LARGE_SCALE_WEBINAR_ATTENDEE_SEARCH_LIMIT,
|
|
16
|
-
|
|
17
|
+
LOCUS_LLM_EVENT,
|
|
17
18
|
} from '../constants';
|
|
19
|
+
import Trigger from '../common/events/trigger-proxy';
|
|
18
20
|
|
|
19
21
|
import WebinarCollection from './collection';
|
|
20
22
|
import LoggerProxy from '../common/logs/logger-proxy';
|
|
23
|
+
import MeetingUtil from '../meeting/util';
|
|
21
24
|
import {sanitizeParams} from './utils';
|
|
22
25
|
|
|
23
26
|
/**
|
|
@@ -39,6 +42,21 @@ const Webinar = WebexPlugin.extend({
|
|
|
39
42
|
meetingId: 'string',
|
|
40
43
|
},
|
|
41
44
|
|
|
45
|
+
/**
|
|
46
|
+
* LLM channel for practice session, owned by this webinar instance.
|
|
47
|
+
* @private
|
|
48
|
+
* @type {LLMChannel|undefined}
|
|
49
|
+
*/
|
|
50
|
+
_practiceSessionLLMChannel: undefined as LLMChannel | undefined,
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Pending practice session datachannel token, saved from join response.
|
|
54
|
+
* Used when creating the practice session LLM channel.
|
|
55
|
+
* @private
|
|
56
|
+
* @type {string|undefined}
|
|
57
|
+
*/
|
|
58
|
+
_pendingPracticeSessionDatachannelToken: undefined as string | undefined,
|
|
59
|
+
|
|
42
60
|
/**
|
|
43
61
|
* Calls this to clean up listeners
|
|
44
62
|
* @returns {void}
|
|
@@ -98,13 +116,49 @@ const Webinar = WebexPlugin.extend({
|
|
|
98
116
|
return {isPromoted, isDemoted};
|
|
99
117
|
},
|
|
100
118
|
|
|
119
|
+
/**
|
|
120
|
+
* Resolves the meeting associated with this webinar instance, guarded against the
|
|
121
|
+
* meetingId pointer drifting onto an unrelated transient meeting (e.g. an inbound
|
|
122
|
+
* 1:1 call) that may exist in the meeting collection. Returns the meeting only when
|
|
123
|
+
* its locusUrl matches this webinar's tracked locusUrl. Returns undefined (with a
|
|
124
|
+
* warning) when the meeting cannot be resolved or when the webinar's locusUrl has
|
|
125
|
+
* not been initialized yet — callers must treat this as "no owned meeting" rather
|
|
126
|
+
* than fall through to an unvalidated lookup.
|
|
127
|
+
* @returns {object|undefined}
|
|
128
|
+
*/
|
|
129
|
+
getValidatedWebinarMeeting() {
|
|
130
|
+
const meeting = this.webex.meetings.getMeetingByType(_ID_, this.meetingId);
|
|
131
|
+
|
|
132
|
+
if (!meeting) {
|
|
133
|
+
return undefined;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (!this.locusUrl) {
|
|
137
|
+
LoggerProxy.logger.warn(
|
|
138
|
+
`Webinar:index#getValidatedWebinarMeeting --> skipping; webinar locusUrl is not yet initialized for meetingId ${this.meetingId}`
|
|
139
|
+
);
|
|
140
|
+
|
|
141
|
+
return undefined;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (meeting.locusUrl !== this.locusUrl) {
|
|
145
|
+
LoggerProxy.logger.warn(
|
|
146
|
+
`Webinar:index#getValidatedWebinarMeeting --> skipping; meeting ${this.meetingId} locusUrl ${meeting.locusUrl} does not match webinar locusUrl ${this.locusUrl}`
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
return undefined;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return meeting;
|
|
153
|
+
},
|
|
154
|
+
|
|
101
155
|
/**
|
|
102
156
|
* should join practice session data channel or not
|
|
103
157
|
* @param {Object} {isPromoted: boolean, isDemoted: boolean}} Role transition states
|
|
104
158
|
* @returns {void}
|
|
105
159
|
*/
|
|
106
160
|
updateStatusByRole({isPromoted, isDemoted}) {
|
|
107
|
-
const meeting = this.
|
|
161
|
+
const meeting = this.getValidatedWebinarMeeting();
|
|
108
162
|
|
|
109
163
|
if (
|
|
110
164
|
(isDemoted && meeting?.shareStatus === SHARE_STATUS.WHITEBOARD_SHARE_ACTIVE) ||
|
|
@@ -127,35 +181,103 @@ const Webinar = WebexPlugin.extend({
|
|
|
127
181
|
},
|
|
128
182
|
|
|
129
183
|
/**
|
|
130
|
-
*
|
|
184
|
+
* Returns the practice session LLM channel binding, if connected.
|
|
185
|
+
* @returns {string|undefined}
|
|
186
|
+
*/
|
|
187
|
+
getPracticeSessionBinding() {
|
|
188
|
+
return this._practiceSessionLLMChannel?.getBinding();
|
|
189
|
+
},
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Returns whether the practice session LLM channel is connected.
|
|
193
|
+
* @returns {boolean}
|
|
194
|
+
*/
|
|
195
|
+
isPracticeSessionLLMChannelConnected() {
|
|
196
|
+
return this._practiceSessionLLMChannel?.isConnected() ?? false;
|
|
197
|
+
},
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Returns the practice session LLM channel's locus URL, if available.
|
|
201
|
+
* @returns {string|undefined}
|
|
202
|
+
*/
|
|
203
|
+
getPracticeSessionLocusUrl() {
|
|
204
|
+
return this._practiceSessionLLMChannel?.getLocusUrl();
|
|
205
|
+
},
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Stores the practice session datachannel token for later use when
|
|
209
|
+
* creating the practice session LLM channel.
|
|
210
|
+
* @param {string} token - The datachannel token to store
|
|
211
|
+
* @returns {void}
|
|
212
|
+
*/
|
|
213
|
+
setPracticeSessionDatachannelToken(token: string) {
|
|
214
|
+
this._pendingPracticeSessionDatachannelToken = token;
|
|
215
|
+
},
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Disconnects the practice session LLM channel and cleans up listeners.
|
|
131
219
|
* @returns {Promise<void>}
|
|
132
220
|
*/
|
|
133
221
|
async cleanupPSDataChannel() {
|
|
222
|
+
// Remove pending online listener if any
|
|
134
223
|
if (this._pendingOnlineListener) {
|
|
135
|
-
|
|
136
|
-
|
|
224
|
+
const meeting = this.getValidatedWebinarMeeting();
|
|
225
|
+
meeting?.llmChannel?.off('online', this._pendingOnlineListener);
|
|
137
226
|
this._pendingOnlineListener = null;
|
|
138
227
|
}
|
|
139
228
|
|
|
140
|
-
const meeting = this.
|
|
229
|
+
const meeting = this.getValidatedWebinarMeeting();
|
|
141
230
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
{
|
|
231
|
+
if (!this._practiceSessionLLMChannel) {
|
|
232
|
+
// Even without PS channel, ensure voicea is bound to main channel
|
|
233
|
+
if (meeting?.voiceaChannel && meeting?.llmChannel) {
|
|
234
|
+
await meeting.voiceaChannel.switchLLMChannel(meeting.llmChannel);
|
|
235
|
+
meeting.startTranscriptionIfNeeded();
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
try {
|
|
242
|
+
await this._practiceSessionLLMChannel.disconnect({
|
|
145
243
|
code: 3050,
|
|
146
244
|
reason: 'done (permanent)',
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
245
|
+
});
|
|
246
|
+
} catch (error) {
|
|
247
|
+
LoggerProxy.logger.error(
|
|
248
|
+
'Webinar:index#cleanupPSDataChannel --> Failed to disconnect practice session LLM channel',
|
|
249
|
+
error
|
|
250
|
+
);
|
|
251
|
+
throw error;
|
|
252
|
+
} finally {
|
|
253
|
+
// Remove listeners from the channel
|
|
254
|
+
if (meeting) {
|
|
255
|
+
this._practiceSessionLLMChannel?.off('event:relay.event', meeting.processRelayEvent);
|
|
256
|
+
this._practiceSessionLLMChannel?.off(LOCUS_LLM_EVENT, meeting.processLocusLLMEvent);
|
|
257
|
+
this._practiceSessionLLMChannel?.off('online', meeting.handleLLMOnline);
|
|
258
|
+
|
|
259
|
+
// Switch annotation back to the meeting's default channel
|
|
260
|
+
if (meeting.llmChannel) {
|
|
261
|
+
meeting.annotation.registerChannel(meeting.llmChannel);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
this._practiceSessionLLMChannel = undefined;
|
|
265
|
+
|
|
266
|
+
// Switch voicea to current main channel. Switching after disconnect ensures:
|
|
267
|
+
// - If main channel was replaced during disconnect (concurrent updateLLMConnection),
|
|
268
|
+
// meeting.llmChannel will be the new channel
|
|
269
|
+
// - If the channel is still connecting, switchLLMChannel waits for it to come online
|
|
270
|
+
if (meeting?.voiceaChannel && meeting?.llmChannel) {
|
|
271
|
+
await meeting.voiceaChannel.switchLLMChannel(meeting.llmChannel);
|
|
272
|
+
meeting.startTranscriptionIfNeeded();
|
|
273
|
+
}
|
|
274
|
+
}
|
|
155
275
|
},
|
|
156
276
|
|
|
157
277
|
/**
|
|
158
278
|
* Ensures practice-session token exists before registering the practice LLM channel.
|
|
279
|
+
* Caller is responsible for passing a meeting that has already been resolved via
|
|
280
|
+
* getValidatedWebinarMeeting() — this method does not re-validate ownership.
|
|
159
281
|
* @param {object} meeting
|
|
160
282
|
* @returns {Promise<string|undefined>}
|
|
161
283
|
*/
|
|
@@ -167,10 +289,10 @@ const Webinar = WebexPlugin.extend({
|
|
|
167
289
|
return undefined;
|
|
168
290
|
}
|
|
169
291
|
|
|
170
|
-
//
|
|
171
|
-
const cachedToken =
|
|
172
|
-
|
|
173
|
-
|
|
292
|
+
// Check for cached token on the channel or pending token
|
|
293
|
+
const cachedToken =
|
|
294
|
+
this._practiceSessionLLMChannel?.getDatachannelToken() ??
|
|
295
|
+
this._pendingPracticeSessionDatachannelToken;
|
|
174
296
|
|
|
175
297
|
if (cachedToken) {
|
|
176
298
|
return cachedToken;
|
|
@@ -178,17 +300,18 @@ const Webinar = WebexPlugin.extend({
|
|
|
178
300
|
|
|
179
301
|
try {
|
|
180
302
|
const refreshResponse = await meeting.refreshDataChannelToken();
|
|
181
|
-
const {datachannelToken
|
|
303
|
+
const {datachannelToken} = refreshResponse?.body ?? {};
|
|
182
304
|
|
|
183
305
|
if (!datachannelToken) {
|
|
184
306
|
return undefined;
|
|
185
307
|
}
|
|
186
308
|
|
|
187
|
-
//
|
|
188
|
-
this.
|
|
189
|
-
datachannelToken
|
|
190
|
-
|
|
191
|
-
|
|
309
|
+
// Store token on the channel if it exists, otherwise save for later
|
|
310
|
+
if (this._practiceSessionLLMChannel) {
|
|
311
|
+
this._practiceSessionLLMChannel.setDatachannelToken(datachannelToken);
|
|
312
|
+
} else {
|
|
313
|
+
this._pendingPracticeSessionDatachannelToken = datachannelToken;
|
|
314
|
+
}
|
|
192
315
|
|
|
193
316
|
return datachannelToken;
|
|
194
317
|
} catch (error) {
|
|
@@ -203,15 +326,16 @@ const Webinar = WebexPlugin.extend({
|
|
|
203
326
|
},
|
|
204
327
|
|
|
205
328
|
/**
|
|
206
|
-
* Connects
|
|
207
|
-
*
|
|
329
|
+
* Connects practice session LLM channel. Creates a new channel if needed.
|
|
330
|
+
* Will disconnect if the meeting has ended or is no longer in practice session mode.
|
|
331
|
+
* Waits for the main LLM channel to be connected before connecting practice session.
|
|
208
332
|
* @returns {Promise}
|
|
209
333
|
*/
|
|
210
334
|
async updatePSDataChannel() {
|
|
211
335
|
this._updatePSDataChannelSequence = (this._updatePSDataChannelSequence || 0) + 1;
|
|
212
336
|
const invocationSequence = this._updatePSDataChannelSequence;
|
|
213
337
|
|
|
214
|
-
const meeting = this.
|
|
338
|
+
const meeting = this.getValidatedWebinarMeeting();
|
|
215
339
|
const isPracticeSession = meeting?.isJoined() && this.isJoinPracticeSessionDataChannel();
|
|
216
340
|
|
|
217
341
|
if (!isPracticeSession) {
|
|
@@ -224,48 +348,36 @@ const Webinar = WebexPlugin.extend({
|
|
|
224
348
|
const {url = undefined, info: {practiceSessionDatachannelUrl = undefined} = {}} =
|
|
225
349
|
meeting?.locusInfo || {};
|
|
226
350
|
|
|
227
|
-
// @ts-ignore
|
|
228
|
-
let practiceSessionDatachannelToken = this.webex.internal.llm.getDatachannelToken(
|
|
229
|
-
DataChannelTokenType.PracticeSession
|
|
230
|
-
);
|
|
231
|
-
|
|
232
|
-
const isCaptionBoxOn = this.webex.internal.voicea.getIsCaptionBoxOn();
|
|
233
|
-
|
|
234
351
|
if (!practiceSessionDatachannelUrl) {
|
|
235
352
|
return undefined;
|
|
236
353
|
}
|
|
237
|
-
|
|
238
|
-
|
|
354
|
+
|
|
355
|
+
// If already connected to same URLs, skip reconnect
|
|
356
|
+
if (this._practiceSessionLLMChannel?.isConnected()) {
|
|
239
357
|
if (
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
// @ts-ignore - Fix type
|
|
243
|
-
practiceSessionDatachannelUrl ===
|
|
244
|
-
this.webex.internal.llm.getDatachannelUrl(LLM_PRACTICE_SESSION)
|
|
358
|
+
url === this._practiceSessionLLMChannel.getLocusUrl() &&
|
|
359
|
+
practiceSessionDatachannelUrl === this._practiceSessionLLMChannel.getDatachannelUrl()
|
|
245
360
|
) {
|
|
246
361
|
return undefined;
|
|
247
362
|
}
|
|
248
|
-
|
|
363
|
+
// URLs changed, disconnect existing channel
|
|
249
364
|
await this.cleanupPSDataChannel();
|
|
250
365
|
}
|
|
251
366
|
|
|
252
|
-
// Ensure the default session
|
|
367
|
+
// Ensure the default session LLM channel is connected before connecting the practice session.
|
|
253
368
|
// Subscribe before checking isConnected() to avoid a race where the 'online' event fires
|
|
254
|
-
// between the check and the subscription —
|
|
255
|
-
if (!this._pendingOnlineListener) {
|
|
369
|
+
// between the check and the subscription — the channel does not replay missed events.
|
|
370
|
+
if (!this._pendingOnlineListener && meeting?.llmChannel) {
|
|
256
371
|
const onDefaultSessionConnected = () => {
|
|
257
372
|
this._pendingOnlineListener = null;
|
|
258
|
-
|
|
259
|
-
this.webex.internal.llm.off('online', onDefaultSessionConnected);
|
|
373
|
+
meeting.llmChannel?.off('online', onDefaultSessionConnected);
|
|
260
374
|
this.updatePSDataChannel();
|
|
261
375
|
};
|
|
262
376
|
this._pendingOnlineListener = onDefaultSessionConnected;
|
|
263
|
-
|
|
264
|
-
this.webex.internal.llm.on('online', onDefaultSessionConnected);
|
|
377
|
+
meeting.llmChannel.on('online', onDefaultSessionConnected);
|
|
265
378
|
}
|
|
266
379
|
|
|
267
|
-
|
|
268
|
-
if (!this.webex.internal.llm.isConnected()) {
|
|
380
|
+
if (!meeting?.llmChannel?.isConnected()) {
|
|
269
381
|
LoggerProxy.logger.info(
|
|
270
382
|
'Webinar:index#updatePSDataChannel --> default session not yet connected, deferring practice session connect.'
|
|
271
383
|
);
|
|
@@ -275,12 +387,16 @@ const Webinar = WebexPlugin.extend({
|
|
|
275
387
|
|
|
276
388
|
// Default session is already connected — cancel the pending listener and proceed
|
|
277
389
|
if (this._pendingOnlineListener) {
|
|
278
|
-
|
|
279
|
-
this.webex.internal.llm.off('online', this._pendingOnlineListener);
|
|
390
|
+
meeting.llmChannel.off('online', this._pendingOnlineListener);
|
|
280
391
|
this._pendingOnlineListener = null;
|
|
281
392
|
}
|
|
282
393
|
|
|
283
|
-
|
|
394
|
+
// Get token from pending or refresh if needed
|
|
395
|
+
let practiceSessionDatachannelToken =
|
|
396
|
+
this._pendingPracticeSessionDatachannelToken ??
|
|
397
|
+
this._practiceSessionLLMChannel?.getDatachannelToken();
|
|
398
|
+
|
|
399
|
+
const refreshedToken = await this.ensurePracticeSessionDatachannelToken(meeting);
|
|
284
400
|
|
|
285
401
|
const latestPracticeSessionDatachannelUrl = get(
|
|
286
402
|
meeting,
|
|
@@ -299,39 +415,64 @@ const Webinar = WebexPlugin.extend({
|
|
|
299
415
|
return undefined;
|
|
300
416
|
}
|
|
301
417
|
|
|
302
|
-
if (
|
|
303
|
-
practiceSessionDatachannelToken =
|
|
418
|
+
if (refreshedToken) {
|
|
419
|
+
practiceSessionDatachannelToken = refreshedToken;
|
|
304
420
|
}
|
|
305
421
|
|
|
422
|
+
// Create a new practice session LLM channel
|
|
306
423
|
// @ts-ignore - Fix type
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
if (isCaptionBoxOn) {
|
|
328
|
-
this.webex.internal.voicea.updateSubchannelSubscriptions({subscribe: ['transcription']});
|
|
424
|
+
const psChannel = this.webex.internal.llm.createChannel();
|
|
425
|
+
this._practiceSessionLLMChannel = psChannel;
|
|
426
|
+
|
|
427
|
+
// Set up refresh handler before registration
|
|
428
|
+
psChannel.setRefreshHandler(() => meeting.refreshDataChannelToken());
|
|
429
|
+
|
|
430
|
+
// If we have a pending token, store it on the channel
|
|
431
|
+
if (this._pendingPracticeSessionDatachannelToken) {
|
|
432
|
+
psChannel.setDatachannelToken(this._pendingPracticeSessionDatachannelToken);
|
|
433
|
+
this._pendingPracticeSessionDatachannelToken = undefined;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
return psChannel
|
|
437
|
+
.registerAndConnect(url, practiceSessionDatachannelUrl, practiceSessionDatachannelToken)
|
|
438
|
+
.then(async (registerAndConnectResult) => {
|
|
439
|
+
// Check if this channel is still the current one (race condition guard)
|
|
440
|
+
if (this._practiceSessionLLMChannel !== psChannel) {
|
|
441
|
+
psChannel.disconnect({code: 3050, reason: 'replaced'}).catch(() => {});
|
|
442
|
+
|
|
443
|
+
return undefined;
|
|
329
444
|
}
|
|
445
|
+
// Register event listeners on the practice session channel
|
|
446
|
+
psChannel.off('event:relay.event', meeting.processRelayEvent);
|
|
447
|
+
psChannel.on('event:relay.event', meeting.processRelayEvent);
|
|
448
|
+
psChannel.off(LOCUS_LLM_EVENT, meeting.processLocusLLMEvent);
|
|
449
|
+
psChannel.on(LOCUS_LLM_EVENT, meeting.processLocusLLMEvent);
|
|
450
|
+
psChannel.off('online', meeting.handleLLMOnline);
|
|
451
|
+
psChannel.on('online', meeting.handleLLMOnline);
|
|
452
|
+
|
|
453
|
+
// Switch annotation to practice session channel
|
|
454
|
+
meeting.annotation.registerChannel(psChannel);
|
|
455
|
+
|
|
456
|
+
// Switch meeting's voicea channel to use the PS LLM connection.
|
|
457
|
+
// The reconciler pattern preserves caption state and handles all timing.
|
|
458
|
+
// transcription is always initialized (reset to initial shape, never null).
|
|
459
|
+
if (meeting.voiceaChannel) {
|
|
460
|
+
await meeting.voiceaChannel.switchLLMChannel(psChannel);
|
|
461
|
+
meeting.startTranscriptionIfNeeded();
|
|
462
|
+
}
|
|
463
|
+
|
|
330
464
|
LoggerProxy.logger.info(
|
|
331
|
-
|
|
465
|
+
'Webinar:index#updatePSDataChannel --> enabled to receive relay events for practice session!'
|
|
332
466
|
);
|
|
333
467
|
|
|
334
468
|
return Promise.resolve(registerAndConnectResult);
|
|
469
|
+
})
|
|
470
|
+
.catch((error) => {
|
|
471
|
+
// Clean up the channel on failure, but only if it's still the current one
|
|
472
|
+
if (this._practiceSessionLLMChannel === psChannel) {
|
|
473
|
+
this._practiceSessionLLMChannel = undefined;
|
|
474
|
+
}
|
|
475
|
+
throw error;
|
|
335
476
|
});
|
|
336
477
|
},
|
|
337
478
|
|
|
@@ -341,6 +482,8 @@ const Webinar = WebexPlugin.extend({
|
|
|
341
482
|
* @returns {Promise}
|
|
342
483
|
*/
|
|
343
484
|
setPracticeSessionState(enabled) {
|
|
485
|
+
const meeting = this.getValidatedWebinarMeeting();
|
|
486
|
+
|
|
344
487
|
return this.request({
|
|
345
488
|
method: HTTP_VERBS.PATCH,
|
|
346
489
|
uri: `${this.locusUrl}/controls`,
|
|
@@ -349,10 +492,16 @@ const Webinar = WebexPlugin.extend({
|
|
|
349
492
|
enabled,
|
|
350
493
|
},
|
|
351
494
|
},
|
|
352
|
-
})
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
495
|
+
})
|
|
496
|
+
.then((response) => {
|
|
497
|
+
MeetingUtil.updateLocusFromApiResponse(meeting, response);
|
|
498
|
+
|
|
499
|
+
return response;
|
|
500
|
+
})
|
|
501
|
+
.catch((error) => {
|
|
502
|
+
LoggerProxy.logger.error('Meeting:webinar#setPracticeSessionState failed', error);
|
|
503
|
+
throw error;
|
|
504
|
+
});
|
|
356
505
|
},
|
|
357
506
|
|
|
358
507
|
/**
|
|
@@ -532,7 +681,14 @@ const Webinar = WebexPlugin.extend({
|
|
|
532
681
|
* @returns {Promise}
|
|
533
682
|
*/
|
|
534
683
|
async searchLargeScaleWebinarAttendees(payload) {
|
|
535
|
-
const meeting = this.
|
|
684
|
+
const meeting = this.getValidatedWebinarMeeting();
|
|
685
|
+
if (!meeting) {
|
|
686
|
+
LoggerProxy.logger.error(
|
|
687
|
+
'Meeting:webinar5k#searchLargeScaleWebinarAttendees failed --> webinar meeting could not be validated'
|
|
688
|
+
);
|
|
689
|
+
throw new Error('Meeting:webinar5k#Webinar meeting is not resolvable for the current locus');
|
|
690
|
+
}
|
|
691
|
+
|
|
536
692
|
const rawParams = {
|
|
537
693
|
search_text: payload?.queryString,
|
|
538
694
|
limit: payload?.limit ?? DEFAULT_LARGE_SCALE_WEBINAR_ATTENDEE_SEARCH_LIMIT,
|
|
@@ -540,7 +696,9 @@ const Webinar = WebexPlugin.extend({
|
|
|
540
696
|
};
|
|
541
697
|
const attendeeSearchUrl = meeting?.locusInfo?.links?.resources?.attendeeSearch?.url;
|
|
542
698
|
if (!attendeeSearchUrl) {
|
|
543
|
-
LoggerProxy.logger.error(
|
|
699
|
+
LoggerProxy.logger.error(
|
|
700
|
+
'Meeting:webinar5k#searchLargeScaleWebinarAttendees failed --> attendee search url unavailable'
|
|
701
|
+
);
|
|
544
702
|
throw new Error('Meeting:webinar5k#Attendee search url is not available');
|
|
545
703
|
}
|
|
546
704
|
|
|
@@ -55,6 +55,27 @@ describe('plugin-meetings', () => {
|
|
|
55
55
|
});
|
|
56
56
|
});
|
|
57
57
|
|
|
58
|
+
describe('#locusUrlUpdate', () => {
|
|
59
|
+
it('should update the locusUrl property', () => {
|
|
60
|
+
const testLocusUrl = 'https://locus-a.wbx2.com/locus/api/v1/loci/test-id';
|
|
61
|
+
|
|
62
|
+
aiEnableRequest.locusUrlUpdate(testLocusUrl);
|
|
63
|
+
|
|
64
|
+
assert.equal(aiEnableRequest.locusUrl, testLocusUrl);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('should handle updating locusUrl multiple times', () => {
|
|
68
|
+
const firstUrl = 'https://locus-a.wbx2.com/locus/api/v1/loci/test-id-1';
|
|
69
|
+
const secondUrl = 'https://locus-a.wbx2.com/locus/api/v1/loci/test-id-2';
|
|
70
|
+
|
|
71
|
+
aiEnableRequest.locusUrlUpdate(firstUrl);
|
|
72
|
+
assert.equal(aiEnableRequest.locusUrl, firstUrl);
|
|
73
|
+
|
|
74
|
+
aiEnableRequest.locusUrlUpdate(secondUrl);
|
|
75
|
+
assert.equal(aiEnableRequest.locusUrl, secondUrl);
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
|
|
58
79
|
describe('#selfParticipantIdUpdate', () => {
|
|
59
80
|
it('should update the selfParticipantId property', () => {
|
|
60
81
|
const testSelfParticipantId = 'participant-123';
|
|
@@ -254,6 +275,71 @@ describe('plugin-meetings', () => {
|
|
|
254
275
|
sinon.assert.notCalled(triggerSpy);
|
|
255
276
|
});
|
|
256
277
|
|
|
278
|
+
it('should not trigger event when locusUrl does not match', () => {
|
|
279
|
+
const testLocusUrl = 'https://locus-a.wbx2.com/locus/api/v1/loci/test-id';
|
|
280
|
+
const differentLocusUrl = 'https://locus-a.wbx2.com/locus/api/v1/loci/different-id';
|
|
281
|
+
|
|
282
|
+
aiEnableRequest.locusUrl = testLocusUrl;
|
|
283
|
+
|
|
284
|
+
// Reset the spy after setting locusUrl to avoid counting property change events
|
|
285
|
+
triggerSpy.resetHistory();
|
|
286
|
+
|
|
287
|
+
aiEnableRequest.listenToApprovalRequests();
|
|
288
|
+
|
|
289
|
+
const event = {
|
|
290
|
+
data: {
|
|
291
|
+
locusUrl: differentLocusUrl,
|
|
292
|
+
approval: {
|
|
293
|
+
resourceType: AI_ENABLE_REQUEST.RESOURCE_TYPE,
|
|
294
|
+
receivers: [{participantId: testSelfParticipantId}],
|
|
295
|
+
initiator: {participantId: testInitiatorId},
|
|
296
|
+
actionType: AI_ENABLE_REQUEST.ACTION_TYPE.REQUESTED,
|
|
297
|
+
url: testUrl,
|
|
298
|
+
},
|
|
299
|
+
},
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
webex.internal.mercury.emit(`event:${LOCUSEVENT.APPROVAL_REQUEST}`, event);
|
|
303
|
+
|
|
304
|
+
sinon.assert.notCalled(triggerSpy);
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
it('should trigger event when locusUrl matches', () => {
|
|
308
|
+
const testLocusUrl = 'https://locus-a.wbx2.com/locus/api/v1/loci/test-id';
|
|
309
|
+
|
|
310
|
+
aiEnableRequest.locusUrl = testLocusUrl;
|
|
311
|
+
|
|
312
|
+
// Reset the spy after setting locusUrl to avoid counting property change events
|
|
313
|
+
triggerSpy.resetHistory();
|
|
314
|
+
|
|
315
|
+
aiEnableRequest.listenToApprovalRequests();
|
|
316
|
+
|
|
317
|
+
const event = {
|
|
318
|
+
data: {
|
|
319
|
+
locusUrl: testLocusUrl,
|
|
320
|
+
approval: {
|
|
321
|
+
resourceType: AI_ENABLE_REQUEST.RESOURCE_TYPE,
|
|
322
|
+
receivers: [{participantId: testSelfParticipantId}],
|
|
323
|
+
initiator: {participantId: testInitiatorId},
|
|
324
|
+
actionType: AI_ENABLE_REQUEST.ACTION_TYPE.REQUESTED,
|
|
325
|
+
url: testUrl,
|
|
326
|
+
},
|
|
327
|
+
},
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
webex.internal.mercury.emit(`event:${LOCUSEVENT.APPROVAL_REQUEST}`, event);
|
|
331
|
+
|
|
332
|
+
sinon.assert.calledOnce(triggerSpy);
|
|
333
|
+
sinon.assert.calledWith(triggerSpy, AI_ENABLE_REQUEST.EVENTS.APPROVAL_REQUEST_ARRIVED, {
|
|
334
|
+
actionType: AI_ENABLE_REQUEST.ACTION_TYPE.REQUESTED,
|
|
335
|
+
isApprover: true,
|
|
336
|
+
isInitiator: false,
|
|
337
|
+
initiatorId: testInitiatorId,
|
|
338
|
+
approverId: testSelfParticipantId,
|
|
339
|
+
url: testUrl,
|
|
340
|
+
});
|
|
341
|
+
});
|
|
342
|
+
|
|
257
343
|
it('should handle events with different action types', () => {
|
|
258
344
|
aiEnableRequest.listenToApprovalRequests();
|
|
259
345
|
|