@webex/plugin-meetings 3.9.0-next.20 → 3.9.0-next.22
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/dist/breakouts/breakout.js +1 -1
- package/dist/breakouts/index.js +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/interceptors/index.js +7 -0
- package/dist/interceptors/index.js.map +1 -1
- package/dist/interceptors/locusRouteToken.js +116 -0
- package/dist/interceptors/locusRouteToken.js.map +1 -0
- package/dist/interpretation/index.js +1 -1
- package/dist/interpretation/siLanguage.js +1 -1
- package/dist/types/interceptors/index.d.ts +2 -1
- package/dist/types/interceptors/locusRouteToken.d.ts +38 -0
- package/dist/webinar/index.js +1 -1
- package/package.json +14 -14
- package/src/index.ts +2 -1
- package/src/interceptors/index.ts +2 -1
- package/src/interceptors/locusRouteToken.ts +80 -0
- package/test/unit/spec/common/browser-detection.js +0 -24
- package/test/unit/spec/interceptors/locusRouteToken.ts +87 -0
- package/test/unit/spec/meetings/index.js +0 -4
- package/test/unit/spec/roap/turnDiscovery.ts +3 -3
package/dist/breakouts/index.js
CHANGED
@@ -1110,7 +1110,7 @@ var Breakouts = _webexCore.WebexPlugin.extend({
|
|
1110
1110
|
this.trigger(_constants.BREAKOUTS.EVENTS.ASK_RETURN_TO_MAIN);
|
1111
1111
|
}
|
1112
1112
|
},
|
1113
|
-
version: "3.9.0-next.
|
1113
|
+
version: "3.9.0-next.22"
|
1114
1114
|
});
|
1115
1115
|
var _default = exports.default = Breakouts;
|
1116
1116
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js
CHANGED
@@ -241,7 +241,8 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
241
241
|
(0, _webexCore.registerPlugin)('meetings', _meetings.default, {
|
242
242
|
config: _config.default,
|
243
243
|
interceptors: {
|
244
|
-
LocusRetryStatusInterceptor: _interceptors.LocusRetryStatusInterceptor.create
|
244
|
+
LocusRetryStatusInterceptor: _interceptors.LocusRetryStatusInterceptor.create,
|
245
|
+
LocusRouteTokenInterceptor: _interceptors.LocusRouteTokenInterceptor.create
|
245
246
|
}
|
246
247
|
});
|
247
248
|
var _default = exports.default = _meetings.default;
|
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_webexCore","require","_meetings","_interopRequireDefault","_config","_interceptors","_captchaError","_intentToJoin","_passwordError","_permission","_joinWebinarError","_reclaimHostRoleErrors","_meeting","_utilv","_joinMeeting","_mediaHelpers","_CONSTANTS","_interopRequireWildcard","exports","CONSTANTS","_REACTIONS","REACTIONS","_sdkAnnotationTypes","sdkAnnotationTypes","_MeetingInfoV","MeetingInfoV2","_remoteMedia","_triggerProxy","_getRequireWildcardCache","e","_WeakMap","r","t","__esModule","_typeof","default","has","get","n","__proto__","a","_Object$defineProperty","_Object$getOwnPropertyDescriptor","u","Object","prototype","hasOwnProperty","call","i","set","registerPlugin","Meetings","config","interceptors","LocusRetryStatusInterceptor","create","_default"],"sources":["index.ts"],"sourcesContent":["/* eslint-env browser */\nimport {registerPlugin} from '@webex/webex-core';\n\nimport Meetings from './meetings';\nimport config from './config';\nimport {LocusRetryStatusInterceptor} from './interceptors';\nimport CaptchaError from './common/errors/captcha-error';\nimport IntentToJoinError from './common/errors/intent-to-join';\nimport PasswordError from './common/errors/password-error';\nimport PermissionError from './common/errors/permission';\nimport JoinWebinarError from './common/errors/join-webinar-error';\nimport {\n ReclaimHostEmptyWrongKeyError,\n ReclaimHostIsHostAlreadyError,\n ReclaimHostNotAllowedError,\n ReclaimHostNotSupportedError,\n} from './common/errors/reclaim-host-role-errors';\nimport Meeting from './meeting';\nimport MeetingInfoUtil from './meeting-info/utilv2';\nimport JoinMeetingError from './common/errors/join-meeting';\n\nregisterPlugin('meetings', Meetings, {\n config,\n interceptors: {\n LocusRetryStatusInterceptor: LocusRetryStatusInterceptor.create,\n },\n});\n\nexport {\n LocalStream,\n LocalDisplayStream,\n LocalSystemAudioStream,\n LocalStreamEventNames,\n StreamEventNames,\n RemoteStreamEventNames,\n type ServerMuteReason,\n LocalMicrophoneStreamEventNames,\n LocalCameraStreamEventNames,\n LocalMicrophoneStream,\n LocalCameraStream,\n createMicrophoneStream,\n createCameraStream,\n createCameraAndMicrophoneStreams,\n createDisplayStream,\n createDisplayStreamWithAudio,\n createDisplayMedia,\n FacingMode,\n DisplaySurface,\n PresetCameraConstraints,\n type VideoContentHint,\n type StreamState,\n} from '@webex/media-helpers';\n\nexport default Meetings;\n\nexport * as CONSTANTS from './constants';\nexport * as REACTIONS from './reactions/reactions';\nexport * as sdkAnnotationTypes from './annotation/annotation.types';\nexport * as MeetingInfoV2 from './meeting-info/meeting-info-v2';\nexport {type Reaction} from './reactions/reactions.type';\n\nexport {\n CaptchaError,\n IntentToJoinError,\n JoinMeetingError,\n PasswordError,\n PermissionError,\n ReclaimHostIsHostAlreadyError,\n ReclaimHostNotAllowedError,\n ReclaimHostNotSupportedError,\n ReclaimHostEmptyWrongKeyError,\n Meeting,\n MeetingInfoUtil,\n JoinWebinarError,\n};\n\nexport {RemoteMedia} from './multistream/remoteMedia';\n\nexport {default as TriggerProxy} from './common/events/trigger-proxy';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,aAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,cAAA,GAAAL,sBAAA,CAAAF,OAAA;AACA,IAAAQ,WAAA,GAAAN,sBAAA,CAAAF,OAAA;AACA,IAAAS,iBAAA,GAAAP,sBAAA,CAAAF,OAAA;AACA,IAAAU,sBAAA,GAAAV,OAAA;AAMA,IAAAW,QAAA,GAAAT,sBAAA,CAAAF,OAAA;AACA,IAAAY,MAAA,GAAAV,sBAAA,CAAAF,OAAA;AACA,IAAAa,YAAA,GAAAX,sBAAA,CAAAF,OAAA;
|
1
|
+
{"version":3,"names":["_webexCore","require","_meetings","_interopRequireDefault","_config","_interceptors","_captchaError","_intentToJoin","_passwordError","_permission","_joinWebinarError","_reclaimHostRoleErrors","_meeting","_utilv","_joinMeeting","_mediaHelpers","_CONSTANTS","_interopRequireWildcard","exports","CONSTANTS","_REACTIONS","REACTIONS","_sdkAnnotationTypes","sdkAnnotationTypes","_MeetingInfoV","MeetingInfoV2","_remoteMedia","_triggerProxy","_getRequireWildcardCache","e","_WeakMap","r","t","__esModule","_typeof","default","has","get","n","__proto__","a","_Object$defineProperty","_Object$getOwnPropertyDescriptor","u","Object","prototype","hasOwnProperty","call","i","set","registerPlugin","Meetings","config","interceptors","LocusRetryStatusInterceptor","create","LocusRouteTokenInterceptor","_default"],"sources":["index.ts"],"sourcesContent":["/* eslint-env browser */\nimport {registerPlugin} from '@webex/webex-core';\n\nimport Meetings from './meetings';\nimport config from './config';\nimport {LocusRetryStatusInterceptor, LocusRouteTokenInterceptor} from './interceptors';\nimport CaptchaError from './common/errors/captcha-error';\nimport IntentToJoinError from './common/errors/intent-to-join';\nimport PasswordError from './common/errors/password-error';\nimport PermissionError from './common/errors/permission';\nimport JoinWebinarError from './common/errors/join-webinar-error';\nimport {\n ReclaimHostEmptyWrongKeyError,\n ReclaimHostIsHostAlreadyError,\n ReclaimHostNotAllowedError,\n ReclaimHostNotSupportedError,\n} from './common/errors/reclaim-host-role-errors';\nimport Meeting from './meeting';\nimport MeetingInfoUtil from './meeting-info/utilv2';\nimport JoinMeetingError from './common/errors/join-meeting';\n\nregisterPlugin('meetings', Meetings, {\n config,\n interceptors: {\n LocusRetryStatusInterceptor: LocusRetryStatusInterceptor.create,\n LocusRouteTokenInterceptor: LocusRouteTokenInterceptor.create,\n },\n});\n\nexport {\n LocalStream,\n LocalDisplayStream,\n LocalSystemAudioStream,\n LocalStreamEventNames,\n StreamEventNames,\n RemoteStreamEventNames,\n type ServerMuteReason,\n LocalMicrophoneStreamEventNames,\n LocalCameraStreamEventNames,\n LocalMicrophoneStream,\n LocalCameraStream,\n createMicrophoneStream,\n createCameraStream,\n createCameraAndMicrophoneStreams,\n createDisplayStream,\n createDisplayStreamWithAudio,\n createDisplayMedia,\n FacingMode,\n DisplaySurface,\n PresetCameraConstraints,\n type VideoContentHint,\n type StreamState,\n} from '@webex/media-helpers';\n\nexport default Meetings;\n\nexport * as CONSTANTS from './constants';\nexport * as REACTIONS from './reactions/reactions';\nexport * as sdkAnnotationTypes from './annotation/annotation.types';\nexport * as MeetingInfoV2 from './meeting-info/meeting-info-v2';\nexport {type Reaction} from './reactions/reactions.type';\n\nexport {\n CaptchaError,\n IntentToJoinError,\n JoinMeetingError,\n PasswordError,\n PermissionError,\n ReclaimHostIsHostAlreadyError,\n ReclaimHostNotAllowedError,\n ReclaimHostNotSupportedError,\n ReclaimHostEmptyWrongKeyError,\n Meeting,\n MeetingInfoUtil,\n JoinWebinarError,\n};\n\nexport {RemoteMedia} from './multistream/remoteMedia';\n\nexport {default as TriggerProxy} from './common/events/trigger-proxy';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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
|
return _locusRetry.default;
|
12
12
|
}
|
13
13
|
});
|
14
|
+
_Object$defineProperty(exports, "LocusRouteTokenInterceptor", {
|
15
|
+
enumerable: true,
|
16
|
+
get: function get() {
|
17
|
+
return _locusRouteToken.default;
|
18
|
+
}
|
19
|
+
});
|
14
20
|
var _locusRetry = _interopRequireDefault(require("./locusRetry"));
|
21
|
+
var _locusRouteToken = _interopRequireDefault(require("./locusRouteToken"));
|
15
22
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_locusRetry","_interopRequireDefault","require"],"sources":["index.ts"],"sourcesContent":["import LocusRetryStatusInterceptor from './locusRetry';\n\nexport {LocusRetryStatusInterceptor};\n"],"mappings":"
|
1
|
+
{"version":3,"names":["_locusRetry","_interopRequireDefault","require","_locusRouteToken"],"sources":["index.ts"],"sourcesContent":["import LocusRetryStatusInterceptor from './locusRetry';\nimport LocusRouteTokenInterceptor from './locusRouteToken';\n\nexport {LocusRetryStatusInterceptor, LocusRouteTokenInterceptor};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAF,sBAAA,CAAAC,OAAA"}
|
@@ -0,0 +1,116 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _Reflect$construct = require("@babel/runtime-corejs2/core-js/reflect/construct");
|
4
|
+
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
5
|
+
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
6
|
+
_Object$defineProperty(exports, "__esModule", {
|
7
|
+
value: true
|
8
|
+
});
|
9
|
+
exports.default = void 0;
|
10
|
+
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
11
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
|
13
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/inherits"));
|
14
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/possibleConstructorReturn"));
|
15
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/getPrototypeOf"));
|
16
|
+
var _httpCore = require("@webex/http-core");
|
17
|
+
var _lodash = require("lodash");
|
18
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
19
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /*!
|
20
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
21
|
+
*/
|
22
|
+
var LOCUS_ID_REGEX = /\/locus\/api\/v1\/loci\/([a-f0-9-]{36})/i;
|
23
|
+
var X_CISCO_PART_ROUTE_TOKEN = 'X-Cisco-Part-Route-Token';
|
24
|
+
var ROUTE_TOKEN = {};
|
25
|
+
|
26
|
+
/**
|
27
|
+
* @class LocusRouteTokenInterceptor
|
28
|
+
*/
|
29
|
+
var LocusRouteTokenInterceptor = exports.default = /*#__PURE__*/function (_Interceptor) {
|
30
|
+
(0, _inherits2.default)(LocusRouteTokenInterceptor, _Interceptor);
|
31
|
+
var _super = _createSuper(LocusRouteTokenInterceptor);
|
32
|
+
function LocusRouteTokenInterceptor() {
|
33
|
+
(0, _classCallCheck2.default)(this, LocusRouteTokenInterceptor);
|
34
|
+
return _super.apply(this, arguments);
|
35
|
+
}
|
36
|
+
(0, _createClass2.default)(LocusRouteTokenInterceptor, [{
|
37
|
+
key: "getLocusIdByRequestUrl",
|
38
|
+
value: function getLocusIdByRequestUrl(url) {
|
39
|
+
var _url$match;
|
40
|
+
return url === null || url === void 0 ? void 0 : (_url$match = url.match(LOCUS_ID_REGEX)) === null || _url$match === void 0 ? void 0 : _url$match[1];
|
41
|
+
}
|
42
|
+
|
43
|
+
/**
|
44
|
+
* @param {Object} options
|
45
|
+
* @param {HttpResponse} response
|
46
|
+
* @returns {Promise<HttpResponse>}
|
47
|
+
*/
|
48
|
+
}, {
|
49
|
+
key: "onResponse",
|
50
|
+
value: function onResponse(options, response) {
|
51
|
+
var locusId = this.getLocusIdByRequestUrl(options.uri);
|
52
|
+
if (locusId) {
|
53
|
+
var hasRouteToken = (0, _lodash.has)(response.headers, X_CISCO_PART_ROUTE_TOKEN);
|
54
|
+
var token = response.headers[X_CISCO_PART_ROUTE_TOKEN];
|
55
|
+
if (hasRouteToken) {
|
56
|
+
this.updateToken(locusId, token);
|
57
|
+
}
|
58
|
+
}
|
59
|
+
return _promise.default.resolve(response);
|
60
|
+
}
|
61
|
+
|
62
|
+
/**
|
63
|
+
* @param {Object} options
|
64
|
+
* @returns {Promise<Object>} options
|
65
|
+
*/
|
66
|
+
}, {
|
67
|
+
key: "onRequest",
|
68
|
+
value: function onRequest(options) {
|
69
|
+
var locusId = this.getLocusIdByRequestUrl(options.uri);
|
70
|
+
if (locusId) {
|
71
|
+
var token = this.getToken(locusId);
|
72
|
+
if (token) {
|
73
|
+
options.headers[X_CISCO_PART_ROUTE_TOKEN] = token;
|
74
|
+
}
|
75
|
+
}
|
76
|
+
return _promise.default.resolve(options);
|
77
|
+
}
|
78
|
+
|
79
|
+
/**
|
80
|
+
* Update the meeting route token
|
81
|
+
* @param {string} locusId
|
82
|
+
* @param {string} token
|
83
|
+
* @returns {void}
|
84
|
+
*/
|
85
|
+
}, {
|
86
|
+
key: "updateToken",
|
87
|
+
value: function updateToken(locusId, token) {
|
88
|
+
ROUTE_TOKEN[locusId] = token;
|
89
|
+
}
|
90
|
+
|
91
|
+
/**
|
92
|
+
* Get the meeting route token
|
93
|
+
* @param {string} locusId
|
94
|
+
* @returns {string|undefined}
|
95
|
+
*/
|
96
|
+
}, {
|
97
|
+
key: "getToken",
|
98
|
+
value: function getToken(locusId) {
|
99
|
+
return ROUTE_TOKEN[locusId];
|
100
|
+
}
|
101
|
+
}], [{
|
102
|
+
key: "create",
|
103
|
+
value:
|
104
|
+
/**
|
105
|
+
* @returns {LocusRouteTokenInterceptor}
|
106
|
+
*/
|
107
|
+
function create() {
|
108
|
+
// @ts-ignore
|
109
|
+
return new LocusRouteTokenInterceptor({
|
110
|
+
webex: this
|
111
|
+
});
|
112
|
+
}
|
113
|
+
}]);
|
114
|
+
return LocusRouteTokenInterceptor;
|
115
|
+
}(_httpCore.Interceptor);
|
116
|
+
//# sourceMappingURL=locusRouteToken.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_httpCore","require","_lodash","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf2","default","result","NewTarget","constructor","_Reflect$construct","arguments","apply","_possibleConstructorReturn2","Reflect","sham","Proxy","Boolean","prototype","valueOf","call","e","LOCUS_ID_REGEX","X_CISCO_PART_ROUTE_TOKEN","ROUTE_TOKEN","LocusRouteTokenInterceptor","exports","_Interceptor","_inherits2","_super","_classCallCheck2","_createClass2","key","value","getLocusIdByRequestUrl","url","_url$match","match","onResponse","options","response","locusId","uri","hasRouteToken","has","headers","token","updateToken","_promise","resolve","onRequest","getToken","create","webex","Interceptor"],"sources":["locusRouteToken.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {Interceptor} from '@webex/http-core';\nimport {has} from 'lodash';\n\nconst LOCUS_ID_REGEX = /\\/locus\\/api\\/v1\\/loci\\/([a-f0-9-]{36})/i;\nconst X_CISCO_PART_ROUTE_TOKEN = 'X-Cisco-Part-Route-Token';\nconst ROUTE_TOKEN = {};\n\n/**\n * @class LocusRouteTokenInterceptor\n */\nexport default class LocusRouteTokenInterceptor extends Interceptor {\n /**\n * @returns {LocusRouteTokenInterceptor}\n */\n static create() {\n // @ts-ignore\n return new LocusRouteTokenInterceptor({webex: this});\n }\n\n getLocusIdByRequestUrl(url: string) {\n return url?.match(LOCUS_ID_REGEX)?.[1];\n }\n\n /**\n * @param {Object} options\n * @param {HttpResponse} response\n * @returns {Promise<HttpResponse>}\n */\n onResponse(options, response) {\n const locusId = this.getLocusIdByRequestUrl(options.uri);\n if (locusId) {\n const hasRouteToken = has(response.headers, X_CISCO_PART_ROUTE_TOKEN);\n const token = response.headers[X_CISCO_PART_ROUTE_TOKEN];\n if (hasRouteToken) {\n this.updateToken(locusId, token);\n }\n }\n\n return Promise.resolve(response);\n }\n\n /**\n * @param {Object} options\n * @returns {Promise<Object>} options\n */\n onRequest(options) {\n const locusId = this.getLocusIdByRequestUrl(options.uri);\n if (locusId) {\n const token = this.getToken(locusId);\n if (token) {\n options.headers[X_CISCO_PART_ROUTE_TOKEN] = token;\n }\n }\n\n return Promise.resolve(options);\n }\n\n /**\n * Update the meeting route token\n * @param {string} locusId\n * @param {string} token\n * @returns {void}\n */\n updateToken(locusId, token) {\n ROUTE_TOKEN[locusId] = token;\n }\n\n /**\n * Get the meeting route token\n * @param {string} locusId\n * @returns {string|undefined}\n */\n getToken(locusId) {\n return ROUTE_TOKEN[locusId];\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAIA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAA2B,SAAAE,aAAAC,OAAA,QAAAC,yBAAA,GAAAC,yBAAA,oBAAAC,qBAAA,QAAAC,KAAA,OAAAC,gBAAA,CAAAC,OAAA,EAAAN,OAAA,GAAAO,MAAA,MAAAN,y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d;MACA,OAAO,IAAI3B,0BAA0B,CAAC;QAAC4B,KAAK,EAAE;MAAI,CAAC,CAAC;IACtD;EAAC;EAAA,OAAA5B,0BAAA;AAAA,EAPqD6B,qBAAW"}
|
@@ -373,7 +373,7 @@ var SimultaneousInterpretation = _webexCore.WebexPlugin.extend({
|
|
373
373
|
throw error;
|
374
374
|
});
|
375
375
|
},
|
376
|
-
version: "3.9.0-next.
|
376
|
+
version: "3.9.0-next.22"
|
377
377
|
});
|
378
378
|
var _default = exports.default = SimultaneousInterpretation;
|
379
379
|
//# sourceMappingURL=index.js.map
|
@@ -18,7 +18,7 @@ var SILanguage = _webexCore.WebexPlugin.extend({
|
|
18
18
|
languageCode: 'number',
|
19
19
|
languageName: 'string'
|
20
20
|
},
|
21
|
-
version: "3.9.0-next.
|
21
|
+
version: "3.9.0-next.22"
|
22
22
|
});
|
23
23
|
var _default = exports.default = SILanguage;
|
24
24
|
//# sourceMappingURL=siLanguage.js.map
|
@@ -0,0 +1,38 @@
|
|
1
|
+
/*!
|
2
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
3
|
+
*/
|
4
|
+
import { Interceptor } from '@webex/http-core';
|
5
|
+
/**
|
6
|
+
* @class LocusRouteTokenInterceptor
|
7
|
+
*/
|
8
|
+
export default class LocusRouteTokenInterceptor extends Interceptor {
|
9
|
+
/**
|
10
|
+
* @returns {LocusRouteTokenInterceptor}
|
11
|
+
*/
|
12
|
+
static create(): LocusRouteTokenInterceptor;
|
13
|
+
getLocusIdByRequestUrl(url: string): string;
|
14
|
+
/**
|
15
|
+
* @param {Object} options
|
16
|
+
* @param {HttpResponse} response
|
17
|
+
* @returns {Promise<HttpResponse>}
|
18
|
+
*/
|
19
|
+
onResponse(options: any, response: any): Promise<any>;
|
20
|
+
/**
|
21
|
+
* @param {Object} options
|
22
|
+
* @returns {Promise<Object>} options
|
23
|
+
*/
|
24
|
+
onRequest(options: any): Promise<any>;
|
25
|
+
/**
|
26
|
+
* Update the meeting route token
|
27
|
+
* @param {string} locusId
|
28
|
+
* @param {string} token
|
29
|
+
* @returns {void}
|
30
|
+
*/
|
31
|
+
updateToken(locusId: any, token: any): void;
|
32
|
+
/**
|
33
|
+
* Get the meeting route token
|
34
|
+
* @param {string} locusId
|
35
|
+
* @returns {string|undefined}
|
36
|
+
*/
|
37
|
+
getToken(locusId: any): any;
|
38
|
+
}
|
package/dist/webinar/index.js
CHANGED
package/package.json
CHANGED
@@ -19,7 +19,7 @@
|
|
19
19
|
"directory": "packages/@webex/plugin-meetings"
|
20
20
|
},
|
21
21
|
"engines": {
|
22
|
-
"node": ">=
|
22
|
+
"node": ">=18"
|
23
23
|
},
|
24
24
|
"browserify": {
|
25
25
|
"transform": [
|
@@ -43,7 +43,7 @@
|
|
43
43
|
"@webex/eslint-config-legacy": "0.0.0",
|
44
44
|
"@webex/jest-config-legacy": "0.0.0",
|
45
45
|
"@webex/legacy-tools": "0.0.0",
|
46
|
-
"@webex/plugin-rooms": "3.9.0-next.
|
46
|
+
"@webex/plugin-rooms": "3.9.0-next.5",
|
47
47
|
"@webex/test-helper-chai": "3.8.1-next.11",
|
48
48
|
"@webex/test-helper-mocha": "3.8.1-next.11",
|
49
49
|
"@webex/test-helper-mock-webex": "3.8.1-next.11",
|
@@ -63,20 +63,20 @@
|
|
63
63
|
"@webex/common": "3.8.1-next.11",
|
64
64
|
"@webex/event-dictionary-ts": "^1.0.1930",
|
65
65
|
"@webex/internal-media-core": "2.19.0",
|
66
|
-
"@webex/internal-plugin-conversation": "3.9.0-next.
|
67
|
-
"@webex/internal-plugin-device": "3.9.0-next.
|
68
|
-
"@webex/internal-plugin-llm": "3.9.0-next.
|
69
|
-
"@webex/internal-plugin-mercury": "3.9.0-next.
|
70
|
-
"@webex/internal-plugin-metrics": "3.9.0-next.
|
71
|
-
"@webex/internal-plugin-support": "3.9.0-next.
|
72
|
-
"@webex/internal-plugin-user": "3.9.0-next.
|
73
|
-
"@webex/internal-plugin-voicea": "3.9.0-next.
|
66
|
+
"@webex/internal-plugin-conversation": "3.9.0-next.5",
|
67
|
+
"@webex/internal-plugin-device": "3.9.0-next.4",
|
68
|
+
"@webex/internal-plugin-llm": "3.9.0-next.4",
|
69
|
+
"@webex/internal-plugin-mercury": "3.9.0-next.4",
|
70
|
+
"@webex/internal-plugin-metrics": "3.9.0-next.4",
|
71
|
+
"@webex/internal-plugin-support": "3.9.0-next.6",
|
72
|
+
"@webex/internal-plugin-user": "3.9.0-next.4",
|
73
|
+
"@webex/internal-plugin-voicea": "3.9.0-next.5",
|
74
74
|
"@webex/media-helpers": "3.9.0-next.1",
|
75
|
-
"@webex/plugin-people": "3.9.0-next.
|
76
|
-
"@webex/plugin-rooms": "3.9.0-next.
|
75
|
+
"@webex/plugin-people": "3.9.0-next.4",
|
76
|
+
"@webex/plugin-rooms": "3.9.0-next.5",
|
77
77
|
"@webex/ts-sdp": "^1.8.1",
|
78
78
|
"@webex/web-capabilities": "^1.6.0",
|
79
|
-
"@webex/webex-core": "3.9.0-next.
|
79
|
+
"@webex/webex-core": "3.9.0-next.4",
|
80
80
|
"ampersand-collection": "^2.0.2",
|
81
81
|
"bowser": "^2.11.0",
|
82
82
|
"btoa": "^1.2.1",
|
@@ -92,5 +92,5 @@
|
|
92
92
|
"//": [
|
93
93
|
"TODO: upgrade jwt-decode when moving to node 18"
|
94
94
|
],
|
95
|
-
"version": "3.9.0-next.
|
95
|
+
"version": "3.9.0-next.22"
|
96
96
|
}
|
package/src/index.ts
CHANGED
@@ -3,7 +3,7 @@ import {registerPlugin} from '@webex/webex-core';
|
|
3
3
|
|
4
4
|
import Meetings from './meetings';
|
5
5
|
import config from './config';
|
6
|
-
import {LocusRetryStatusInterceptor} from './interceptors';
|
6
|
+
import {LocusRetryStatusInterceptor, LocusRouteTokenInterceptor} from './interceptors';
|
7
7
|
import CaptchaError from './common/errors/captcha-error';
|
8
8
|
import IntentToJoinError from './common/errors/intent-to-join';
|
9
9
|
import PasswordError from './common/errors/password-error';
|
@@ -23,6 +23,7 @@ registerPlugin('meetings', Meetings, {
|
|
23
23
|
config,
|
24
24
|
interceptors: {
|
25
25
|
LocusRetryStatusInterceptor: LocusRetryStatusInterceptor.create,
|
26
|
+
LocusRouteTokenInterceptor: LocusRouteTokenInterceptor.create,
|
26
27
|
},
|
27
28
|
});
|
28
29
|
|
@@ -0,0 +1,80 @@
|
|
1
|
+
/*!
|
2
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
3
|
+
*/
|
4
|
+
|
5
|
+
import {Interceptor} from '@webex/http-core';
|
6
|
+
import {has} from 'lodash';
|
7
|
+
|
8
|
+
const LOCUS_ID_REGEX = /\/locus\/api\/v1\/loci\/([a-f0-9-]{36})/i;
|
9
|
+
const X_CISCO_PART_ROUTE_TOKEN = 'X-Cisco-Part-Route-Token';
|
10
|
+
const ROUTE_TOKEN = {};
|
11
|
+
|
12
|
+
/**
|
13
|
+
* @class LocusRouteTokenInterceptor
|
14
|
+
*/
|
15
|
+
export default class LocusRouteTokenInterceptor extends Interceptor {
|
16
|
+
/**
|
17
|
+
* @returns {LocusRouteTokenInterceptor}
|
18
|
+
*/
|
19
|
+
static create() {
|
20
|
+
// @ts-ignore
|
21
|
+
return new LocusRouteTokenInterceptor({webex: this});
|
22
|
+
}
|
23
|
+
|
24
|
+
getLocusIdByRequestUrl(url: string) {
|
25
|
+
return url?.match(LOCUS_ID_REGEX)?.[1];
|
26
|
+
}
|
27
|
+
|
28
|
+
/**
|
29
|
+
* @param {Object} options
|
30
|
+
* @param {HttpResponse} response
|
31
|
+
* @returns {Promise<HttpResponse>}
|
32
|
+
*/
|
33
|
+
onResponse(options, response) {
|
34
|
+
const locusId = this.getLocusIdByRequestUrl(options.uri);
|
35
|
+
if (locusId) {
|
36
|
+
const hasRouteToken = has(response.headers, X_CISCO_PART_ROUTE_TOKEN);
|
37
|
+
const token = response.headers[X_CISCO_PART_ROUTE_TOKEN];
|
38
|
+
if (hasRouteToken) {
|
39
|
+
this.updateToken(locusId, token);
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
return Promise.resolve(response);
|
44
|
+
}
|
45
|
+
|
46
|
+
/**
|
47
|
+
* @param {Object} options
|
48
|
+
* @returns {Promise<Object>} options
|
49
|
+
*/
|
50
|
+
onRequest(options) {
|
51
|
+
const locusId = this.getLocusIdByRequestUrl(options.uri);
|
52
|
+
if (locusId) {
|
53
|
+
const token = this.getToken(locusId);
|
54
|
+
if (token) {
|
55
|
+
options.headers[X_CISCO_PART_ROUTE_TOKEN] = token;
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
return Promise.resolve(options);
|
60
|
+
}
|
61
|
+
|
62
|
+
/**
|
63
|
+
* Update the meeting route token
|
64
|
+
* @param {string} locusId
|
65
|
+
* @param {string} token
|
66
|
+
* @returns {void}
|
67
|
+
*/
|
68
|
+
updateToken(locusId, token) {
|
69
|
+
ROUTE_TOKEN[locusId] = token;
|
70
|
+
}
|
71
|
+
|
72
|
+
/**
|
73
|
+
* Get the meeting route token
|
74
|
+
* @param {string} locusId
|
75
|
+
* @returns {string|undefined}
|
76
|
+
*/
|
77
|
+
getToken(locusId) {
|
78
|
+
return ROUTE_TOKEN[locusId];
|
79
|
+
}
|
80
|
+
}
|
@@ -18,16 +18,6 @@ const USER_AGENT_SAFARI_MAC =
|
|
18
18
|
const USER_AGENT_FIREFOX_MAC =
|
19
19
|
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:87.0) ' + 'Gecko/20100101 Firefox/87.0';
|
20
20
|
|
21
|
-
const mockDetectionObject = {
|
22
|
-
/* eslint-disable global-require */
|
23
|
-
getOSName: () => require('os').platform(),
|
24
|
-
getOSVersion: () => require('os').release(),
|
25
|
-
/* eslint-enable global-require */
|
26
|
-
getBrowserName: () => '',
|
27
|
-
getBrowserVersion: () => '',
|
28
|
-
isBrowser: () => false,
|
29
|
-
};
|
30
|
-
|
31
21
|
describe('common/browser-detection', () => {
|
32
22
|
it('returns the correct browser name.', () => {
|
33
23
|
assert.equal(
|
@@ -102,18 +92,4 @@ describe('common/browser-detection', () => {
|
|
102
92
|
'This browser is NOT Firefox'
|
103
93
|
);
|
104
94
|
});
|
105
|
-
|
106
|
-
it('returns the mock object when there is no userAgent', () => {
|
107
|
-
Object.defineProperty(global.window.navigator, 'userAgent', {
|
108
|
-
get: () => undefined,
|
109
|
-
configurable: true,
|
110
|
-
});
|
111
|
-
|
112
|
-
const {getBrowserName, getBrowserVersion, getOSName, getOSVersion} = BrowserDetection(null);
|
113
|
-
|
114
|
-
assert.equal(getBrowserName(), mockDetectionObject.getBrowserName());
|
115
|
-
assert.equal(getBrowserVersion(), mockDetectionObject.getBrowserVersion());
|
116
|
-
assert.equal(getOSName(), mockDetectionObject.getOSName());
|
117
|
-
assert.equal(getOSVersion(), mockDetectionObject.getOSVersion());
|
118
|
-
});
|
119
95
|
});
|
@@ -0,0 +1,87 @@
|
|
1
|
+
/*!
|
2
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
3
|
+
*/
|
4
|
+
|
5
|
+
/* eslint-disable camelcase */
|
6
|
+
import 'jsdom-global/register';
|
7
|
+
import {assert} from '@webex/test-helper-chai';
|
8
|
+
import MockWebex from '@webex/test-helper-mock-webex';
|
9
|
+
import {LocusRouteTokenInterceptor} from '@webex/plugin-meetings/src/interceptors';
|
10
|
+
import Meetings from '@webex/plugin-meetings';
|
11
|
+
|
12
|
+
const X_CISCO_PART_ROUTE_TOKEN = 'X-Cisco-Part-Route-Token';
|
13
|
+
|
14
|
+
describe('LocusRouteTokenInterceptor', () => {
|
15
|
+
let interceptor, webex;
|
16
|
+
const TEST_LOCUS_ID = '0f1eba56-91e2-2a11-9b2b-1e2da077f066';
|
17
|
+
beforeEach(() => {
|
18
|
+
webex = new MockWebex({
|
19
|
+
children: {
|
20
|
+
meetings: Meetings,
|
21
|
+
},
|
22
|
+
});
|
23
|
+
interceptor = Reflect.apply(LocusRouteTokenInterceptor.create, webex, []);
|
24
|
+
});
|
25
|
+
|
26
|
+
it('getLocusIdByRequestUrl should return locusId from url', () => {
|
27
|
+
const url = `https://locus-test.webex.com/locus/api/v1/loci/${TEST_LOCUS_ID}/foo`;
|
28
|
+
assert.equal(interceptor.getLocusIdByRequestUrl(url), TEST_LOCUS_ID);
|
29
|
+
});
|
30
|
+
|
31
|
+
it('getLocusIdByRequestUrl should return undefined when no locusId in url', () => {
|
32
|
+
const url = 'https://locus-test.webex.com/locus/api/v1/foo';
|
33
|
+
assert.isUndefined(interceptor.getLocusIdByRequestUrl(url));
|
34
|
+
});
|
35
|
+
|
36
|
+
it('getLocusIdByRequestUrl should return undefined when url is undefined', () => {
|
37
|
+
assert.isUndefined(interceptor.getLocusIdByRequestUrl(undefined));
|
38
|
+
});
|
39
|
+
|
40
|
+
it('onResponse should store route token when header exists', async () => {
|
41
|
+
const response = {
|
42
|
+
headers: {
|
43
|
+
[X_CISCO_PART_ROUTE_TOKEN]: 'test-token',
|
44
|
+
},
|
45
|
+
};
|
46
|
+
|
47
|
+
const result = await interceptor.onResponse(
|
48
|
+
{
|
49
|
+
uri: `https://locus-test.webex.com/locus/api/v1/loci/${TEST_LOCUS_ID}/foo`,
|
50
|
+
},
|
51
|
+
response
|
52
|
+
);
|
53
|
+
assert.equal(result, response);
|
54
|
+
assert.equal(interceptor.getToken(TEST_LOCUS_ID), 'test-token');
|
55
|
+
});
|
56
|
+
|
57
|
+
it('onResponse should not store token when header missing', async () => {
|
58
|
+
interceptor.updateToken(TEST_LOCUS_ID);
|
59
|
+
const response = {headers: {}};
|
60
|
+
|
61
|
+
await interceptor.onResponse({}, response);
|
62
|
+
assert.isUndefined(interceptor.getToken(TEST_LOCUS_ID));
|
63
|
+
});
|
64
|
+
|
65
|
+
it('onRequest should attach token to headers when token exists', async () => {
|
66
|
+
interceptor.updateToken(TEST_LOCUS_ID, 'abc123');
|
67
|
+
|
68
|
+
const options = {
|
69
|
+
headers: {},
|
70
|
+
uri: `https://locus-test.webex.com/locus/api/v1/loci/${TEST_LOCUS_ID}/foo`,
|
71
|
+
};
|
72
|
+
const result = await interceptor.onRequest(options);
|
73
|
+
assert.equal(result.headers[X_CISCO_PART_ROUTE_TOKEN], 'abc123');
|
74
|
+
});
|
75
|
+
|
76
|
+
it('onRequest should not attach token if none is stored', async () => {
|
77
|
+
interceptor.updateToken(TEST_LOCUS_ID);
|
78
|
+
const options = {headers: {}};
|
79
|
+
const result = await interceptor.onRequest(options);
|
80
|
+
assert.isUndefined(result.headers[X_CISCO_PART_ROUTE_TOKEN]);
|
81
|
+
});
|
82
|
+
|
83
|
+
it('updateToken & getToken should work as pair', () => {
|
84
|
+
interceptor.updateToken(TEST_LOCUS_ID, 'abc456');
|
85
|
+
assert.equal(interceptor.getToken(TEST_LOCUS_ID), 'abc456');
|
86
|
+
});
|
87
|
+
});
|
@@ -3,10 +3,6 @@
|
|
3
3
|
*/
|
4
4
|
import 'jsdom-global/register';
|
5
5
|
|
6
|
-
// Polyfill for crypto: https://github.com/jsdom/jsdom/issues/1612#issuecomment-663210638
|
7
|
-
import {Crypto} from '@peculiar/webcrypto';
|
8
|
-
global.crypto = new Crypto();
|
9
|
-
|
10
6
|
import Device from '@webex/internal-plugin-device';
|
11
7
|
import {CatalogDetails} from '@webex/internal-plugin-device';
|
12
8
|
import Mercury from '@webex/internal-plugin-mercury';
|
@@ -321,7 +321,7 @@ describe('TurnDiscovery', () => {
|
|
321
321
|
result,
|
322
322
|
undefined,
|
323
323
|
undefined,
|
324
|
-
|
324
|
+
`failure: Unexpected token 'o', "not a json" is not valid JSON`
|
325
325
|
);
|
326
326
|
checkFailureMetricsSent();
|
327
327
|
});
|
@@ -568,7 +568,7 @@ describe('TurnDiscovery', () => {
|
|
568
568
|
// @ts-ignore
|
569
569
|
mockRoapRequest.sendRoap.resetHistory();
|
570
570
|
|
571
|
-
// simulate the response with some empty urls, normally there would be just 1, but we put more just for the sake of testing
|
571
|
+
// simulate the response with some empty urls, normally there would be just 1, but we put more just for the sake of testing
|
572
572
|
td.handleTurnDiscoveryResponse(
|
573
573
|
{
|
574
574
|
messageType: 'TURN_DISCOVERY_RESPONSE',
|
@@ -960,7 +960,7 @@ describe('TurnDiscovery', () => {
|
|
960
960
|
|
961
961
|
assert.deepEqual(result, {
|
962
962
|
turnServerInfo: undefined,
|
963
|
-
turnDiscoverySkippedReason:
|
963
|
+
turnDiscoverySkippedReason: `failure: Unexpected token 'o', "not a json" is not valid JSON`,
|
964
964
|
});
|
965
965
|
});
|
966
966
|
|