@webex/plugin-meetings 1.151.7 → 1.152.0
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/common/errors/captcha-error.js +64 -0
- package/dist/common/errors/captcha-error.js.map +1 -0
- package/dist/common/errors/password-error.js +64 -0
- package/dist/common/errors/password-error.js.map +1 -0
- package/dist/constants.js +33 -1
- package/dist/constants.js.map +1 -1
- package/dist/meeting/index.js +665 -429
- package/dist/meeting/index.js.map +1 -1
- package/dist/meeting/request.js +59 -32
- package/dist/meeting/request.js.map +1 -1
- package/dist/meeting/util.js +12 -0
- package/dist/meeting/util.js.map +1 -1
- package/dist/meeting-info/meeting-info-v2.js +142 -8
- package/dist/meeting-info/meeting-info-v2.js.map +1 -1
- package/dist/meeting-info/utilv2.js +12 -1
- package/dist/meeting-info/utilv2.js.map +1 -1
- package/dist/meetings/index.js +25 -19
- package/dist/meetings/index.js.map +1 -1
- package/package.json +5 -5
- package/src/common/errors/captcha-error.js +21 -0
- package/src/common/errors/password-error.js +21 -0
- package/src/constants.js +24 -0
- package/src/meeting/index.js +170 -0
- package/src/meeting/request.js +27 -0
- package/src/meeting/util.js +15 -4
- package/src/meeting-info/meeting-info-v2.js +67 -3
- package/src/meeting-info/utilv2.js +12 -1
- package/src/meetings/index.js +10 -8
- package/test/unit/spec/meeting/index.js +293 -2
- package/test/unit/spec/meeting-info/meetinginfov2.js +74 -1
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _Reflect$construct = require("@babel/runtime-corejs2/core-js/reflect/construct");
|
|
4
|
+
|
|
5
|
+
var _Object$keys = require("@babel/runtime-corejs2/core-js/object/keys");
|
|
6
|
+
|
|
7
|
+
var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs2/core-js/object/get-own-property-symbols");
|
|
8
|
+
|
|
9
|
+
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptor");
|
|
10
|
+
|
|
11
|
+
var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptors");
|
|
12
|
+
|
|
13
|
+
var _Object$defineProperties = require("@babel/runtime-corejs2/core-js/object/define-properties");
|
|
14
|
+
|
|
3
15
|
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
4
16
|
|
|
5
17
|
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
@@ -8,23 +20,115 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
8
20
|
value: true
|
|
9
21
|
});
|
|
10
22
|
|
|
11
|
-
exports.default = void 0;
|
|
23
|
+
exports.default = exports.MeetingInfoV2CaptchaError = exports.MeetingInfoV2PasswordError = void 0;
|
|
12
24
|
|
|
13
25
|
var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
|
|
14
26
|
|
|
27
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
|
|
28
|
+
|
|
15
29
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
|
|
16
30
|
|
|
31
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
|
|
32
|
+
|
|
17
33
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
|
|
18
34
|
|
|
19
|
-
var
|
|
35
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/inherits"));
|
|
36
|
+
|
|
37
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/possibleConstructorReturn"));
|
|
38
|
+
|
|
39
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/getPrototypeOf"));
|
|
40
|
+
|
|
41
|
+
var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/wrapNativeSuper"));
|
|
20
42
|
|
|
21
43
|
var _constants = require("../constants");
|
|
22
44
|
|
|
23
45
|
var _utilv = _interopRequireDefault(require("./utilv2"));
|
|
24
46
|
|
|
47
|
+
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
48
|
+
|
|
49
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
50
|
+
|
|
51
|
+
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); }; }
|
|
52
|
+
|
|
53
|
+
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; } }
|
|
54
|
+
|
|
55
|
+
var PASSWORD_ERROR_DEFAULT_MESSAGE = 'Password required. Call fetchMeetingInfo() with password argument';
|
|
56
|
+
var CAPTCHA_ERROR_DEFAULT_MESSAGE = 'Captcha required. Call fetchMeetingInfo() with captchaInfo argument';
|
|
57
|
+
/**
|
|
58
|
+
* Error to indicate that wbxappapi requires a password
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
var MeetingInfoV2PasswordError = /*#__PURE__*/function (_Error) {
|
|
62
|
+
(0, _inherits2.default)(MeetingInfoV2PasswordError, _Error);
|
|
63
|
+
|
|
64
|
+
var _super = _createSuper(MeetingInfoV2PasswordError);
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
*
|
|
68
|
+
* @constructor
|
|
69
|
+
* @param {Number} [wbxAppApiErrorCode]
|
|
70
|
+
* @param {Object} [meetingInfo]
|
|
71
|
+
* @param {String} [message]
|
|
72
|
+
*/
|
|
73
|
+
function MeetingInfoV2PasswordError(wbxAppApiErrorCode, meetingInfo) {
|
|
74
|
+
var _this;
|
|
75
|
+
|
|
76
|
+
var message = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : PASSWORD_ERROR_DEFAULT_MESSAGE;
|
|
77
|
+
(0, _classCallCheck2.default)(this, MeetingInfoV2PasswordError);
|
|
78
|
+
_this = _super.call(this, "".concat(message, ", code=").concat(wbxAppApiErrorCode));
|
|
79
|
+
_this.name = 'MeetingInfoV2PasswordError';
|
|
80
|
+
_this.sdkMessage = message;
|
|
81
|
+
_this.stack = new Error().stack;
|
|
82
|
+
_this.wbxAppApiCode = wbxAppApiErrorCode;
|
|
83
|
+
_this.meetingInfo = meetingInfo;
|
|
84
|
+
return _this;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return MeetingInfoV2PasswordError;
|
|
88
|
+
}( /*#__PURE__*/(0, _wrapNativeSuper2.default)(Error));
|
|
89
|
+
/**
|
|
90
|
+
* Error to indicate that wbxappapi requires a captcha
|
|
91
|
+
*/
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
exports.MeetingInfoV2PasswordError = MeetingInfoV2PasswordError;
|
|
95
|
+
|
|
96
|
+
var MeetingInfoV2CaptchaError = /*#__PURE__*/function (_Error2) {
|
|
97
|
+
(0, _inherits2.default)(MeetingInfoV2CaptchaError, _Error2);
|
|
98
|
+
|
|
99
|
+
var _super2 = _createSuper(MeetingInfoV2CaptchaError);
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
*
|
|
103
|
+
* @constructor
|
|
104
|
+
* @param {Number} [wbxAppApiErrorCode]
|
|
105
|
+
* @param {Object} [captchaInfo]
|
|
106
|
+
* @param {String} [message]
|
|
107
|
+
*/
|
|
108
|
+
function MeetingInfoV2CaptchaError(wbxAppApiErrorCode, captchaInfo) {
|
|
109
|
+
var _this2;
|
|
110
|
+
|
|
111
|
+
var message = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : CAPTCHA_ERROR_DEFAULT_MESSAGE;
|
|
112
|
+
(0, _classCallCheck2.default)(this, MeetingInfoV2CaptchaError);
|
|
113
|
+
_this2 = _super2.call(this, "".concat(message, ", code=").concat(wbxAppApiErrorCode));
|
|
114
|
+
_this2.name = 'MeetingInfoV2PasswordError';
|
|
115
|
+
_this2.sdkMessage = message;
|
|
116
|
+
_this2.stack = new Error().stack;
|
|
117
|
+
_this2.wbxAppApiCode = wbxAppApiErrorCode;
|
|
118
|
+
_this2.isPasswordRequired = wbxAppApiErrorCode === 423005;
|
|
119
|
+
_this2.captchaInfo = captchaInfo;
|
|
120
|
+
return _this2;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return MeetingInfoV2CaptchaError;
|
|
124
|
+
}( /*#__PURE__*/(0, _wrapNativeSuper2.default)(Error));
|
|
25
125
|
/**
|
|
26
126
|
* @class MeetingInfo
|
|
27
127
|
*/
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
exports.MeetingInfoV2CaptchaError = MeetingInfoV2CaptchaError;
|
|
131
|
+
|
|
28
132
|
var MeetingInfoV2 = /*#__PURE__*/function () {
|
|
29
133
|
/**
|
|
30
134
|
*
|
|
@@ -58,6 +162,10 @@ var MeetingInfoV2 = /*#__PURE__*/function () {
|
|
|
58
162
|
* Fetches meeting info from the server
|
|
59
163
|
* @param {String} destination one of many different types of destinations to look up info for
|
|
60
164
|
* @param {String} [type] to match up with the destination value
|
|
165
|
+
* @param {String} password
|
|
166
|
+
* @param {Object} captchaInfo
|
|
167
|
+
* @param {String} captchaInfo.code
|
|
168
|
+
* @param {String} captchaInfo.id
|
|
61
169
|
* @returns {Promise} returns a meeting info object
|
|
62
170
|
* @public
|
|
63
171
|
* @memberof MeetingInfo
|
|
@@ -68,6 +176,8 @@ var MeetingInfoV2 = /*#__PURE__*/function () {
|
|
|
68
176
|
value: function () {
|
|
69
177
|
var _fetchMeetingInfo = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(destination) {
|
|
70
178
|
var type,
|
|
179
|
+
password,
|
|
180
|
+
captchaInfo,
|
|
71
181
|
destinationType,
|
|
72
182
|
body,
|
|
73
183
|
_args = arguments;
|
|
@@ -76,28 +186,52 @@ var MeetingInfoV2 = /*#__PURE__*/function () {
|
|
|
76
186
|
switch (_context.prev = _context.next) {
|
|
77
187
|
case 0:
|
|
78
188
|
type = _args.length > 1 && _args[1] !== undefined ? _args[1] : null;
|
|
79
|
-
|
|
189
|
+
password = _args.length > 2 && _args[2] !== undefined ? _args[2] : null;
|
|
190
|
+
captchaInfo = _args.length > 3 && _args[3] !== undefined ? _args[3] : null;
|
|
191
|
+
_context.next = 5;
|
|
80
192
|
return _utilv.default.getDestinationType({
|
|
81
193
|
destination: destination,
|
|
82
194
|
type: type,
|
|
83
195
|
webex: this.webex
|
|
84
196
|
});
|
|
85
197
|
|
|
86
|
-
case
|
|
198
|
+
case 5:
|
|
87
199
|
destinationType = _context.sent;
|
|
88
|
-
_context.next =
|
|
89
|
-
return _utilv.default.getRequestBody(destinationType)
|
|
200
|
+
_context.next = 8;
|
|
201
|
+
return _utilv.default.getRequestBody(_objectSpread(_objectSpread({}, destinationType), {}, {
|
|
202
|
+
password: password,
|
|
203
|
+
captchaInfo: captchaInfo
|
|
204
|
+
}));
|
|
90
205
|
|
|
91
|
-
case
|
|
206
|
+
case 8:
|
|
92
207
|
body = _context.sent;
|
|
93
208
|
return _context.abrupt("return", this.webex.request({
|
|
94
209
|
method: _constants.HTTP_VERBS.POST,
|
|
95
210
|
service: 'webex-appapi-service',
|
|
96
211
|
resource: 'meetingInfo',
|
|
97
212
|
body: body
|
|
213
|
+
}).catch(function (err) {
|
|
214
|
+
if ((err === null || err === void 0 ? void 0 : err.statusCode) === 403) {
|
|
215
|
+
var _err$body, _err$body2, _err$body2$data;
|
|
216
|
+
|
|
217
|
+
throw new MeetingInfoV2PasswordError((_err$body = err.body) === null || _err$body === void 0 ? void 0 : _err$body.code, (_err$body2 = err.body) === null || _err$body2 === void 0 ? void 0 : (_err$body2$data = _err$body2.data) === null || _err$body2$data === void 0 ? void 0 : _err$body2$data.meetingInfo);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
if ((err === null || err === void 0 ? void 0 : err.statusCode) === 423) {
|
|
221
|
+
var _err$body3;
|
|
222
|
+
|
|
223
|
+
throw new MeetingInfoV2CaptchaError((_err$body3 = err.body) === null || _err$body3 === void 0 ? void 0 : _err$body3.code, {
|
|
224
|
+
captchaId: err.body.captchaID,
|
|
225
|
+
verificationImageURL: err.body.verificationImageURL,
|
|
226
|
+
verificationAudioURL: err.body.verificationAudioURL,
|
|
227
|
+
refreshURL: err.body.refreshURL
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
throw err;
|
|
98
232
|
}));
|
|
99
233
|
|
|
100
|
-
case
|
|
234
|
+
case 10:
|
|
101
235
|
case "end":
|
|
102
236
|
return _context.stop();
|
|
103
237
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["meeting-info-v2.js"],"names":["MeetingInfoV2","webex","destination","type","MeetingInfoUtil","getDestinationType","destinationType","getRequestBody","body","request","method","HTTP_VERBS","POST","service","resource"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["meeting-info-v2.js"],"names":["PASSWORD_ERROR_DEFAULT_MESSAGE","CAPTCHA_ERROR_DEFAULT_MESSAGE","MeetingInfoV2PasswordError","wbxAppApiErrorCode","meetingInfo","message","name","sdkMessage","stack","Error","wbxAppApiCode","MeetingInfoV2CaptchaError","captchaInfo","isPasswordRequired","MeetingInfoV2","webex","destination","type","MeetingInfoUtil","getDestinationType","password","destinationType","getRequestBody","body","request","method","HTTP_VERBS","POST","service","resource","catch","err","statusCode","code","data","captchaId","captchaID","verificationImageURL","verificationAudioURL","refreshURL"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AAEA;;;;;;;;;;AAEA,IAAMA,8BAA8B,GAAG,mEAAvC;AACA,IAAMC,6BAA6B,GAAG,qEAAtC;AAEA;AACA;AACA;;IACaC,0B;;;;;AACX;AACF;AACA;AACA;AACA;AACA;AACA;AACE,sCAAYC,kBAAZ,EAAgCC,WAAhC,EAAuF;AAAA;;AAAA,QAA1CC,OAA0C,uEAAhCL,8BAAgC;AAAA;AACrF,wCAASK,OAAT,oBAA0BF,kBAA1B;AACA,UAAKG,IAAL,GAAY,4BAAZ;AACA,UAAKC,UAAL,GAAkBF,OAAlB;AACA,UAAKG,KAAL,GAAc,IAAIC,KAAJ,EAAD,CAAcD,KAA3B;AACA,UAAKE,aAAL,GAAqBP,kBAArB;AACA,UAAKC,WAAL,GAAmBA,WAAnB;AANqF;AAOtF;;;+CAf6CK,K;AAkBhD;AACA;AACA;;;;;IACaE,yB;;;;;AACX;AACF;AACA;AACA;AACA;AACA;AACA;AACE,qCAAYR,kBAAZ,EAAgCS,WAAhC,EAAsF;AAAA;;AAAA,QAAzCP,OAAyC,uEAA/BJ,6BAA+B;AAAA;AACpF,0CAASI,OAAT,oBAA0BF,kBAA1B;AACA,WAAKG,IAAL,GAAY,4BAAZ;AACA,WAAKC,UAAL,GAAkBF,OAAlB;AACA,WAAKG,KAAL,GAAc,IAAIC,KAAJ,EAAD,CAAcD,KAA3B;AACA,WAAKE,aAAL,GAAq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IADK;AAExBC,kBAAAA,OAAO,EAAE,sBAFe;AAGxBC,kBAAAA,QAAQ,EAAE,aAHc;AAIxBN,kBAAAA,IAAI,EAAJA;AAJwB,iBAAnB,EAMJO,KANI,CAME,UAACC,GAAD,EAAS;AACd,sBAAI,CAAAA,GAAG,SAAH,IAAAA,GAAG,WAAH,YAAAA,GAAG,CAAEC,UAAL,MAAoB,GAAxB,EAA6B;AAAA;;AAC3B,0BAAM,IAAI9B,0BAAJ,cAA+B6B,GAAG,CAACR,IAAnC,8CAA+B,UAAUU,IAAzC,gBAA+CF,GAAG,CAACR,IAAnD,kEAA+C,WAAUW,IAAzD,oDAA+C,gBAAgB9B,WAA/D,CAAN;AACD;;AACD,sBAAI,CAAA2B,GAAG,SAAH,IAAAA,GAAG,WAAH,YAAAA,GAAG,CAAEC,UAAL,MAAoB,GAAxB,EAA6B;AAAA;;AAC3B,0BAAM,IAAIrB,yBAAJ,eAA8BoB,GAAG,CAACR,IAAlC,+CAA8B,WAAUU,IAAxC,EAA8C;AAClDE,sBAAAA,SAAS,EAAEJ,GAAG,CAACR,IAAJ,CAASa,SAD8B;AAElDC,sBAAAA,oBAAoB,EAAEN,GAAG,CAACR,IAAJ,CAASc,oBAFmB;AAGlDC,sBAAAA,oBAAoB,EAAEP,GAAG,CAACR,IAAJ,CAASe,oBAHmB;AAIlDC,sBAAAA,UAAU,EAAER,GAAG,CAACR,IAAJ,CAASgB;AAJ6B,qBAA9C,CAAN;AAMD;;AACD,wBAAMR,GAAN;AACD,iBAnBI,CART;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O","sourcesContent":["\nimport {HTTP_VERBS} from '../constants';\n\nimport MeetingInfoUtil from './utilv2';\n\nconst PASSWORD_ERROR_DEFAULT_MESSAGE = 'Password required. Call fetchMeetingInfo() with password argument';\nconst CAPTCHA_ERROR_DEFAULT_MESSAGE = 'Captcha required. Call fetchMeetingInfo() with captchaInfo argument';\n\n/**\n * Error to indicate that wbxappapi requires a password\n */\nexport class MeetingInfoV2PasswordError extends Error {\n /**\n *\n * @constructor\n * @param {Number} [wbxAppApiErrorCode]\n * @param {Object} [meetingInfo]\n * @param {String} [message]\n */\n constructor(wbxAppApiErrorCode, meetingInfo, message = PASSWORD_ERROR_DEFAULT_MESSAGE) {\n super(`${message}, code=${wbxAppApiErrorCode}`);\n this.name = 'MeetingInfoV2PasswordError';\n this.sdkMessage = message;\n this.stack = (new Error()).stack;\n this.wbxAppApiCode = wbxAppApiErrorCode;\n this.meetingInfo = meetingInfo;\n }\n}\n\n/**\n * Error to indicate that wbxappapi requires a captcha\n */\nexport class MeetingInfoV2CaptchaError extends Error {\n /**\n *\n * @constructor\n * @param {Number} [wbxAppApiErrorCode]\n * @param {Object} [captchaInfo]\n * @param {String} [message]\n */\n constructor(wbxAppApiErrorCode, captchaInfo, message = CAPTCHA_ERROR_DEFAULT_MESSAGE) {\n super(`${message}, code=${wbxAppApiErrorCode}`);\n this.name = 'MeetingInfoV2PasswordError';\n this.sdkMessage = message;\n this.stack = (new Error()).stack;\n this.wbxAppApiCode = wbxAppApiErrorCode;\n this.isPasswordRequired = wbxAppApiErrorCode === 423005;\n this.captchaInfo = captchaInfo;\n }\n}\n\n/**\n * @class MeetingInfo\n */\nexport default class MeetingInfoV2 {\n /**\n *\n * @param {WebexSDK} webex\n */\n constructor(webex) {\n this.webex = webex;\n }\n\n /**\n * converts hydra id into conversation url and persons Id\n * @param {String} destination one of many different types of destinations to look up info for\n * @param {String} [type] to match up with the destination value\n * @returns {Promise} returns destination and type\n * @public\n * @memberof MeetingInfo\n */\n fetchInfoOptions(destination, type = null) {\n return MeetingInfoUtil.getDestinationType({\n destination,\n type,\n webex: this.webex\n });\n }\n\n /**\n * Fetches meeting info from the server\n * @param {String} destination one of many different types of destinations to look up info for\n * @param {String} [type] to match up with the destination value\n * @param {String} password\n * @param {Object} captchaInfo\n * @param {String} captchaInfo.code\n * @param {String} captchaInfo.id\n * @returns {Promise} returns a meeting info object\n * @public\n * @memberof MeetingInfo\n */\n async fetchMeetingInfo(destination, type = null, password = null, captchaInfo = null) {\n const destinationType = await MeetingInfoUtil.getDestinationType({\n destination,\n type,\n webex: this.webex\n });\n const body = await MeetingInfoUtil.getRequestBody({...destinationType, password, captchaInfo});\n\n return this.webex.request({\n method: HTTP_VERBS.POST,\n service: 'webex-appapi-service',\n resource: 'meetingInfo',\n body\n })\n .catch((err) => {\n if (err?.statusCode === 403) {\n throw new MeetingInfoV2PasswordError(err.body?.code, err.body?.data?.meetingInfo);\n }\n if (err?.statusCode === 423) {\n throw new MeetingInfoV2CaptchaError(err.body?.code, {\n captchaId: err.body.captchaID,\n verificationImageURL: err.body.verificationImageURL,\n verificationAudioURL: err.body.verificationAudioURL,\n refreshURL: err.body.refreshURL\n });\n }\n throw err;\n });\n }\n}\n\n"]}
|
|
@@ -322,7 +322,9 @@ MeetingInfoUtil.getRequestBody = function (options) {
|
|
|
322
322
|
var _destination$info, _destination$info2;
|
|
323
323
|
|
|
324
324
|
var type = options.type,
|
|
325
|
-
destination = options.destination
|
|
325
|
+
destination = options.destination,
|
|
326
|
+
password = options.password,
|
|
327
|
+
captchaInfo = options.captchaInfo;
|
|
326
328
|
var body = {
|
|
327
329
|
supportHostKey: true
|
|
328
330
|
};
|
|
@@ -368,6 +370,15 @@ MeetingInfoUtil.getRequestBody = function (options) {
|
|
|
368
370
|
default:
|
|
369
371
|
}
|
|
370
372
|
|
|
373
|
+
if (password) {
|
|
374
|
+
body.password = password;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
if (captchaInfo) {
|
|
378
|
+
body.captchaID = captchaInfo.id;
|
|
379
|
+
body.captchaVerifyCode = captchaInfo.code;
|
|
380
|
+
}
|
|
381
|
+
|
|
371
382
|
return body;
|
|
372
383
|
};
|
|
373
384
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["utilv2.js"],"names":["MeetingInfoUtil","getParsedUrl","link","parsedUrl","url","parse","protocol","HTTPS_PROTOCOL","error","LoggerProxy","logger","warn","isMeetingLink","value","hostNameBool","hostname","includes","WEBEX_DOT_COM","pathNameBool","pathname","MEET","MEET_M","JOIN","isConversationUrl","webex","clusterId","internal","services","getClusterId","endsWith","CONVERSATION_SERVICE","isSipUri","sipString","sipUri","DIALER_REGEX","SIP_ADDRESS","exec","isPhoneNumber","phoneNumber","isValidNumber","PHONE_NUMBER","test","getHydraId","destination","type","id","cluster","UUID_REG","_ROOM_","room","_PEOPLE_","people","getSipUriFromHydraPersonId","get","then","res","emails","length","ParameterError","catch","err","getDestinationType","from","_PERSONAL_ROOM_","userId","device","orgId","options","VALID_EMAIL_ADDRESS","email","list","items","hydraId","_MEETING_LINK_","_SIP_URI_","_CONVERSATION_URL_","wasHydraPerson","resolve","waitForCatalog","conversationUrl","conversation","getUrlFromClusterId","getRequestBody","body","supportHostKey","sipUrl","_MEETING_ID_","meetingKey","_LOCUS_ID_","info","webExMeetingId","meetingUrl","_MEETING_UUID_","meetingUUID"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;AAEA;;AAIA;;AAoBA;;AACA;;AAEA,IAAMA,eAAe,GAAG,EAAxB;;AAEAA,eAAe,CAACC,YAAhB,GAA+B,UAACC,IAAD,EAAU;AACvC,MAAI;AACF,QAAIC,SAAS,GAAGC,aAAIC,KAAJ,CAAUH,IAAV,CAAhB;;AAEA,QAAI,CAACC,SAAL,EAAgB;AACd,aAAO,KAAP;AACD,KALC,CAMF;;;AACA,QAAI,CAACA,SAAS,CAACG,QAAf,EAAyB;AACvBH,MAAAA,SAAS,GAAGC,aAAIC,KAAJ,WAAaE,yBAAb,SAA8BL,IAA9B,EAAZ;AACD;;AAED,WAAOC,SAAP;AACD,GAZD,CAaA,OAAOK,KAAP,EAAc;AACZC,yBAAYC,MAAZ,CAAmBC,IAAnB,8EAA8FH,KAA9F;;AAEA,WAAO,IAAP;AACD;AACF,CAnBD;AAqBA;AACA;AACA;AACA;AACA;;;AACAR,eAAe,CAACY,aAAhB,GAAgC,UAAC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GAAb;;AAIA,UAAQxC,IAAR;AACE,SAAK8B,oBAAL;AACES,MAAAA,IAAI,CAACE,MAAL,GAAc1C,WAAd;AACA;;AACF,SAAKoB,0BAAL;AACEoB,MAAAA,IAAI,CAACnB,MAAL,GAAcrB,WAAW,CAACqB,MAA1B;AACAmB,MAAAA,IAAI,CAACjB,KAAL,GAAavB,WAAW,CAACuB,KAAzB;AACA;;AACF,SAAKoB,uBAAL;AACEH,MAAAA,IAAI,CAACI,UAAL,GAAkB5C,WAAlB;AACA;;AACF,SAAKgC,6BAAL;AACEQ,MAAAA,IAAI,CAACJ,eAAL,GAAuBpC,WAAvB;AACA;;AACF,SAAK6C,qBAAL;AACE;AACA,+BAAI7C,WAAW,CAAC8C,IAAhB,8CAAI,kBAAkBC,cAAtB,EAAsC;AACpCP,QAAAA,IAAI,CAACI,UAAL,GAAkB5C,WAAW,CAAC8C,IAAZ,CAAiBC,cAAnC;AACD,OAFD,MAGK,0BAAI/C,WAAW,CAAC8C,IAAhB,+CAAI,mBAAkBxD,MAAtB,EAA8B;AACjCkD,QAAAA,IAAI,CAACE,MAAL,GAAc1C,WAAW,CAAC8C,IAAZ,CAAiBxD,MAA/B;AACD;;AACD;;AACF,SAAKwC,yBAAL;AACEU,MAAAA,IAAI,CAACQ,UAAL,GAAkBhD,WAAlB;AACA;;AACF,SAAKiD,yBAAL;AAAqB;AACnBT,QAAAA,IAAI,CAACU,WAAL,GAAmBlD,WAAnB;AACA;AACD;;AACD;AA9BF;;AAiCA,SAAOwC,IAAP;AACD,CAxCD;;eA0CenF,e","sourcesContent":["import url from 'url';\n\nimport {\n deconstructHydraId\n} from '@webex/common';\n\nimport {\n _SIP_URI_,\n _PERSONAL_ROOM_,\n _MEETING_ID_,\n _CONVERSATION_URL_,\n _LOCUS_ID_,\n _MEETING_LINK_,\n _PEOPLE_,\n _ROOM_,\n _MEETING_UUID_,\n DIALER_REGEX,\n WEBEX_DOT_COM,\n CONVERSATION_SERVICE,\n JOIN,\n MEET,\n MEET_M,\n HTTPS_PROTOCOL,\n UUID_REG,\n VALID_EMAIL_ADDRESS\n} from '../constants';\nimport ParameterError from '../common/errors/parameter';\nimport LoggerProxy from '../common/logs/logger-proxy';\n\nconst MeetingInfoUtil = {};\n\nMeetingInfoUtil.getParsedUrl = (link) => {\n try {\n let parsedUrl = url.parse(link);\n\n if (!parsedUrl) {\n return false;\n }\n // hack for links such as <company>.webex.com/meet/<user> without a protocol\n if (!parsedUrl.protocol) {\n parsedUrl = url.parse(`${HTTPS_PROTOCOL}${link}`);\n }\n\n return parsedUrl;\n }\n catch (error) {\n LoggerProxy.logger.warn(`Meeting-info:util#getParsedUrl --> unable to parse the URL, error: ${error}`);\n\n return null;\n }\n};\n\n/**\n * Helper function to check if a string matches a known meeting link pattern\n * @param {String} value string to parse and see if it matches a meeting link\n * @returns {Boolean}\n */\nMeetingInfoUtil.isMeetingLink = (value) => {\n const parsedUrl = MeetingInfoUtil.getParsedUrl(value);\n const hostNameBool = parsedUrl.hostname && parsedUrl.hostname.includes(WEBEX_DOT_COM);\n const pathNameBool = parsedUrl.pathname && (parsedUrl.pathname.includes(`/${MEET}`) || parsedUrl.pathname.includes(`/${MEET_M}`) || parsedUrl.pathname.includes(`/${JOIN}`));\n\n return hostNameBool && pathNameBool;\n};\n\nMeetingInfoUtil.isConversationUrl = (value, webex) => {\n const clusterId = webex.internal.services.getClusterId(value);\n\n if (clusterId) {\n return clusterId.endsWith(CONVERSATION_SERVICE);\n }\n\n return false;\n};\n\n\nMeetingInfoUtil.isSipUri = (sipString) => {\n // TODO: lets remove regex from this equation and user URI matchers and such\n // have not found a great sip uri parser library as of now\n const sipUri = DIALER_REGEX.SIP_ADDRESS.exec(sipString);\n\n return sipUri;\n};\n\nMeetingInfoUtil.isPhoneNumber = (phoneNumber) => {\n const isValidNumber = DIALER_REGEX.PHONE_NUMBER.test(phoneNumber);\n\n return isValidNumber;\n};\n\nMeetingInfoUtil.getHydraId = (destination) => {\n const {type, id, cluster} = deconstructHydraId(destination);\n\n if (id && UUID_REG.test(id)) {\n if (type === _ROOM_) {\n return {room: true, destination: id, cluster};\n }\n if (type === _PEOPLE_) {\n return {people: true, destination: id, cluster};\n }\n\n return {};\n }\n\n return {};\n};\n\nMeetingInfoUtil.getSipUriFromHydraPersonId = (destination, webex) => webex.people.get(destination).then((res) => {\n if (res.emails && res.emails.length) {\n return res.emails[0];\n }\n throw new ParameterError('Hydra Id Lookup was an invalid hydra person id.');\n}).catch((err) => {\n LoggerProxy.logger.error(`Meeting-info:util#MeetingInfoUtil.getSipUriFromHydraPersonId --> getSipUriFromHydraPersonId ${err} `);\n throw err;\n});\n\n\nMeetingInfoUtil.getDestinationType = async (from) => {\n const {type, webex} = from;\n let {destination} = from;\n\n if (type === _PERSONAL_ROOM_) { // this case checks if your type is personal room\n if (!destination) { // if we are not getting anything in desination we fetch org and user ids from webex instance\n destination = {\n userId: webex.internal.device.userId,\n orgId: webex.internal.device.orgId\n };\n }\n else {\n const options = VALID_EMAIL_ADDRESS.test(destination) ? {email: destination} : {id: destination};// we are assuming userId as default\n const res = await webex.people.list(options);\n\n let {orgId, id: userId} = res.items[0];\n\n userId = deconstructHydraId(userId).id;\n orgId = deconstructHydraId(orgId).id;\n destination = {userId, orgId};\n }\n }\n if (type) {\n return {\n destination,\n type\n };\n }\n const options = {};\n const hydraId = MeetingInfoUtil.getHydraId(destination);\n\n if (MeetingInfoUtil.isMeetingLink(destination)) {\n LoggerProxy.logger.warn('Meeting-info:util#generateOptions --> WARN, use of Meeting Link is deprecated, please use a SIP URI instead');\n\n options.type = _MEETING_LINK_;\n options.destination = destination;\n }\n else if (MeetingInfoUtil.isSipUri(destination)) {\n options.type = _SIP_URI_;\n options.destination = destination;\n }\n else if (MeetingInfoUtil.isPhoneNumber(destination)) {\n options.type = _SIP_URI_;\n options.destination = destination;\n }\n else if (MeetingInfoUtil.isConversationUrl(destination, webex)) {\n options.type = _CONVERSATION_URL_;\n options.destination = destination;\n }\n else if (hydraId.people) {\n options.type = _SIP_URI_;\n\n return MeetingInfoUtil.getSipUriFromHydraPersonId(hydraId.destination, webex).then((res) => {\n options.destination = res;\n\n // Since hydra person ids require a unique case in which they are\n // entirely converted to a SIP URI, we need to set a flag for detecting\n // this type of destination.\n options.wasHydraPerson = true;\n\n return Promise.resolve(options);\n });\n }\n else if (hydraId.room) {\n options.type = _CONVERSATION_URL_;\n try {\n await webex.internal.services.waitForCatalog('postauth');\n\n const conversationUrl = webex.internal.conversation.getUrlFromClusterId({\n cluster: hydraId.cluster,\n id: hydraId.destination\n });\n\n options.destination = conversationUrl;\n }\n catch (e) {\n LoggerProxy.logger.error(`Meeting-info:util#getDestinationType --> ${e}`);\n throw (e);\n }\n }\n else {\n LoggerProxy.logger.warn('Meeting-info:util#getDestinationType --> (\\'MeetingInfo is fetched with meeting link, sip uri, phone number, hydra room id, hydra people id, or a conversation url.');\n throw new ParameterError('MeetingInfo is fetched with meeting link, sip uri, phone number, hydra room id, hydra people id, or a conversation url.');\n }\n\n return Promise.resolve(options);\n};\n\n/**\n * Helper function to build up a correct locus url depending on the value passed\n * @param {Object} options type and value to fetch meeting info\n * @param {String} options.type One of [SIP_URI, PERSONAL_ROOM, MEETING_ID, CONVERSATION_URL, LOCUS_ID, MEETING_LINK]\n * @param {Object} options.destination ?? value.value\n * @returns {Object} returns an object with {resource, method}\n */\nMeetingInfoUtil.getRequestBody = (options) => {\n const {type, destination} = options;\n const body = {\n supportHostKey: true\n };\n\n switch (type) {\n case _SIP_URI_:\n body.sipUrl = destination;\n break;\n case _PERSONAL_ROOM_:\n body.userId = destination.userId;\n body.orgId = destination.orgId;\n break;\n case _MEETING_ID_:\n body.meetingKey = destination;\n break;\n case _CONVERSATION_URL_:\n body.conversationUrl = destination;\n break;\n case _LOCUS_ID_:\n // use meetingID for the completer meeting info for the already started meeting\n if (destination.info?.webExMeetingId) {\n body.meetingKey = destination.info.webExMeetingId;\n }\n else if (destination.info?.sipUri) {\n body.sipUrl = destination.info.sipUri;\n }\n break;\n case _MEETING_LINK_:\n body.meetingUrl = destination;\n break;\n case _MEETING_UUID_: {\n body.meetingUUID = destination;\n break;\n }\n default:\n }\n\n return body;\n};\n\nexport default MeetingInfoUtil;\n"]}
|
|
1
|
+
{"version":3,"sources":["utilv2.js"],"names":["MeetingInfoUtil","getParsedUrl","link","parsedUrl","url","parse","protocol","HTTPS_PROTOCOL","error","LoggerProxy","logger","warn","isMeetingLink","value","hostNameBool","hostname","includes","WEBEX_DOT_COM","pathNameBool","pathname","MEET","MEET_M","JOIN","isConversationUrl","webex","clusterId","internal","services","getClusterId","endsWith","CONVERSATION_SERVICE","isSipUri","sipString","sipUri","DIALER_REGEX","SIP_ADDRESS","exec","isPhoneNumber","phoneNumber","isValidNumber","PHONE_NUMBER","test","getHydraId","destination","type","id","cluster","UUID_REG","_ROOM_","room","_PEOPLE_","people","getSipUriFromHydraPersonId","get","then","res","emails","length","ParameterError","catch","err","getDestinationType","from","_PERSONAL_ROOM_","userId","device","orgId","options","VALID_EMAIL_ADDRESS","email","list","items","hydraId","_MEETING_LINK_","_SIP_URI_","_CONVERSATION_URL_","wasHydraPerson","resolve","waitForCatalog","conversationUrl","conversation","getUrlFromClusterId","getRequestBody","password","captchaInfo","body","supportHostKey","sipUrl","_MEETING_ID_","meetingKey","_LOCUS_ID_","info","webExMeetingId","meetingUrl","_MEETING_UUID_","meetingUUID","captchaID","captchaVerifyCode","code"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;AAEA;;AAIA;;AAoBA;;AACA;;AAEA,IAAMA,eAAe,GAAG,EAAxB;;AAEAA,eAAe,CAACC,YAAhB,GAA+B,UAACC,IAAD,EAAU;AACvC,MAAI;AACF,QAAIC,SAAS,GAAGC,aAAIC,KAAJ,CAAUH,IAAV,CAAhB;;AAEA,QAAI,CAACC,SAAL,EAAgB;AACd,aAAO,KAAP;AACD,KALC,CAMF;;;AACA,QAAI,CAACA,SAAS,CAACG,QAAf,EAAyB;AACvBH,MAAAA,SAAS,GAAGC,a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AL,GAAmBpD,WAAnB;AACA;AACD;;AACD;AA9BF;;AAiCA,MAAIwC,QAAJ,EAAc;AACZE,IAAAA,IAAI,CAACF,QAAL,GAAgBA,QAAhB;AACD;;AAED,MAAIC,WAAJ,EAAiB;AACfC,IAAAA,IAAI,CAACW,SAAL,GAAiBZ,WAAW,CAACvC,EAA7B;AACAwC,IAAAA,IAAI,CAACY,iBAAL,GAAyBb,WAAW,CAACc,IAArC;AACD;;AAED,SAAOb,IAAP;AACD,CAnDD;;eAqDerF,e","sourcesContent":["import url from 'url';\n\nimport {\n deconstructHydraId\n} from '@webex/common';\n\nimport {\n _SIP_URI_,\n _PERSONAL_ROOM_,\n _MEETING_ID_,\n _CONVERSATION_URL_,\n _LOCUS_ID_,\n _MEETING_LINK_,\n _PEOPLE_,\n _ROOM_,\n _MEETING_UUID_,\n DIALER_REGEX,\n WEBEX_DOT_COM,\n CONVERSATION_SERVICE,\n JOIN,\n MEET,\n MEET_M,\n HTTPS_PROTOCOL,\n UUID_REG,\n VALID_EMAIL_ADDRESS\n} from '../constants';\nimport ParameterError from '../common/errors/parameter';\nimport LoggerProxy from '../common/logs/logger-proxy';\n\nconst MeetingInfoUtil = {};\n\nMeetingInfoUtil.getParsedUrl = (link) => {\n try {\n let parsedUrl = url.parse(link);\n\n if (!parsedUrl) {\n return false;\n }\n // hack for links such as <company>.webex.com/meet/<user> without a protocol\n if (!parsedUrl.protocol) {\n parsedUrl = url.parse(`${HTTPS_PROTOCOL}${link}`);\n }\n\n return parsedUrl;\n }\n catch (error) {\n LoggerProxy.logger.warn(`Meeting-info:util#getParsedUrl --> unable to parse the URL, error: ${error}`);\n\n return null;\n }\n};\n\n/**\n * Helper function to check if a string matches a known meeting link pattern\n * @param {String} value string to parse and see if it matches a meeting link\n * @returns {Boolean}\n */\nMeetingInfoUtil.isMeetingLink = (value) => {\n const parsedUrl = MeetingInfoUtil.getParsedUrl(value);\n const hostNameBool = parsedUrl.hostname && parsedUrl.hostname.includes(WEBEX_DOT_COM);\n const pathNameBool = parsedUrl.pathname && (parsedUrl.pathname.includes(`/${MEET}`) || parsedUrl.pathname.includes(`/${MEET_M}`) || parsedUrl.pathname.includes(`/${JOIN}`));\n\n return hostNameBool && pathNameBool;\n};\n\nMeetingInfoUtil.isConversationUrl = (value, webex) => {\n const clusterId = webex.internal.services.getClusterId(value);\n\n if (clusterId) {\n return clusterId.endsWith(CONVERSATION_SERVICE);\n }\n\n return false;\n};\n\n\nMeetingInfoUtil.isSipUri = (sipString) => {\n // TODO: lets remove regex from this equation and user URI matchers and such\n // have not found a great sip uri parser library as of now\n const sipUri = DIALER_REGEX.SIP_ADDRESS.exec(sipString);\n\n return sipUri;\n};\n\nMeetingInfoUtil.isPhoneNumber = (phoneNumber) => {\n const isValidNumber = DIALER_REGEX.PHONE_NUMBER.test(phoneNumber);\n\n return isValidNumber;\n};\n\nMeetingInfoUtil.getHydraId = (destination) => {\n const {type, id, cluster} = deconstructHydraId(destination);\n\n if (id && UUID_REG.test(id)) {\n if (type === _ROOM_) {\n return {room: true, destination: id, cluster};\n }\n if (type === _PEOPLE_) {\n return {people: true, destination: id, cluster};\n }\n\n return {};\n }\n\n return {};\n};\n\nMeetingInfoUtil.getSipUriFromHydraPersonId = (destination, webex) => webex.people.get(destination).then((res) => {\n if (res.emails && res.emails.length) {\n return res.emails[0];\n }\n throw new ParameterError('Hydra Id Lookup was an invalid hydra person id.');\n}).catch((err) => {\n LoggerProxy.logger.error(`Meeting-info:util#MeetingInfoUtil.getSipUriFromHydraPersonId --> getSipUriFromHydraPersonId ${err} `);\n throw err;\n});\n\n\nMeetingInfoUtil.getDestinationType = async (from) => {\n const {type, webex} = from;\n let {destination} = from;\n\n if (type === _PERSONAL_ROOM_) { // this case checks if your type is personal room\n if (!destination) { // if we are not getting anything in desination we fetch org and user ids from webex instance\n destination = {\n userId: webex.internal.device.userId,\n orgId: webex.internal.device.orgId\n };\n }\n else {\n const options = VALID_EMAIL_ADDRESS.test(destination) ? {email: destination} : {id: destination};// we are assuming userId as default\n const res = await webex.people.list(options);\n\n let {orgId, id: userId} = res.items[0];\n\n userId = deconstructHydraId(userId).id;\n orgId = deconstructHydraId(orgId).id;\n destination = {userId, orgId};\n }\n }\n if (type) {\n return {\n destination,\n type\n };\n }\n const options = {};\n const hydraId = MeetingInfoUtil.getHydraId(destination);\n\n if (MeetingInfoUtil.isMeetingLink(destination)) {\n LoggerProxy.logger.warn('Meeting-info:util#generateOptions --> WARN, use of Meeting Link is deprecated, please use a SIP URI instead');\n\n options.type = _MEETING_LINK_;\n options.destination = destination;\n }\n else if (MeetingInfoUtil.isSipUri(destination)) {\n options.type = _SIP_URI_;\n options.destination = destination;\n }\n else if (MeetingInfoUtil.isPhoneNumber(destination)) {\n options.type = _SIP_URI_;\n options.destination = destination;\n }\n else if (MeetingInfoUtil.isConversationUrl(destination, webex)) {\n options.type = _CONVERSATION_URL_;\n options.destination = destination;\n }\n else if (hydraId.people) {\n options.type = _SIP_URI_;\n\n return MeetingInfoUtil.getSipUriFromHydraPersonId(hydraId.destination, webex).then((res) => {\n options.destination = res;\n\n // Since hydra person ids require a unique case in which they are\n // entirely converted to a SIP URI, we need to set a flag for detecting\n // this type of destination.\n options.wasHydraPerson = true;\n\n return Promise.resolve(options);\n });\n }\n else if (hydraId.room) {\n options.type = _CONVERSATION_URL_;\n try {\n await webex.internal.services.waitForCatalog('postauth');\n\n const conversationUrl = webex.internal.conversation.getUrlFromClusterId({\n cluster: hydraId.cluster,\n id: hydraId.destination\n });\n\n options.destination = conversationUrl;\n }\n catch (e) {\n LoggerProxy.logger.error(`Meeting-info:util#getDestinationType --> ${e}`);\n throw (e);\n }\n }\n else {\n LoggerProxy.logger.warn('Meeting-info:util#getDestinationType --> (\\'MeetingInfo is fetched with meeting link, sip uri, phone number, hydra room id, hydra people id, or a conversation url.');\n throw new ParameterError('MeetingInfo is fetched with meeting link, sip uri, phone number, hydra room id, hydra people id, or a conversation url.');\n }\n\n return Promise.resolve(options);\n};\n\n/**\n * Helper function to build up a correct locus url depending on the value passed\n * @param {Object} options type and value to fetch meeting info\n * @param {String} options.type One of [SIP_URI, PERSONAL_ROOM, MEETING_ID, CONVERSATION_URL, LOCUS_ID, MEETING_LINK]\n * @param {Object} options.destination ?? value.value\n * @returns {Object} returns an object with {resource, method}\n */\nMeetingInfoUtil.getRequestBody = (options) => {\n const {\n type, destination, password, captchaInfo\n } = options;\n const body = {\n supportHostKey: true\n };\n\n switch (type) {\n case _SIP_URI_:\n body.sipUrl = destination;\n break;\n case _PERSONAL_ROOM_:\n body.userId = destination.userId;\n body.orgId = destination.orgId;\n break;\n case _MEETING_ID_:\n body.meetingKey = destination;\n break;\n case _CONVERSATION_URL_:\n body.conversationUrl = destination;\n break;\n case _LOCUS_ID_:\n // use meetingID for the completer meeting info for the already started meeting\n if (destination.info?.webExMeetingId) {\n body.meetingKey = destination.info.webExMeetingId;\n }\n else if (destination.info?.sipUri) {\n body.sipUrl = destination.info.sipUri;\n }\n break;\n case _MEETING_LINK_:\n body.meetingUrl = destination;\n break;\n case _MEETING_UUID_: {\n body.meetingUUID = destination;\n break;\n }\n default:\n }\n\n if (password) {\n body.password = password;\n }\n\n if (captchaInfo) {\n body.captchaID = captchaInfo.id;\n body.captchaVerifyCode = captchaInfo.code;\n }\n\n return body;\n};\n\nexport default MeetingInfoUtil;\n"]}
|
package/dist/meetings/index.js
CHANGED
|
@@ -78,6 +78,10 @@ var _analyzer = _interopRequireDefault(require("../analyzer/analyzer"));
|
|
|
78
78
|
|
|
79
79
|
var _calculator = _interopRequireDefault(require("../analyzer/calculator"));
|
|
80
80
|
|
|
81
|
+
var _passwordError = _interopRequireDefault(require("../common/errors/password-error"));
|
|
82
|
+
|
|
83
|
+
var _captchaError = _interopRequireDefault(require("../common/errors/captcha-error"));
|
|
84
|
+
|
|
81
85
|
var _collection = _interopRequireDefault(require("./collection"));
|
|
82
86
|
|
|
83
87
|
var _util2 = _interopRequireDefault(require("./util"));
|
|
@@ -776,7 +780,6 @@ var Meetings = /*#__PURE__*/function (_WebexPlugin) {
|
|
|
776
780
|
var _createMeeting = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(destination) {
|
|
777
781
|
var type,
|
|
778
782
|
meeting,
|
|
779
|
-
info,
|
|
780
783
|
meetingAddedType,
|
|
781
784
|
_args = arguments;
|
|
782
785
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
@@ -789,39 +792,42 @@ var Meetings = /*#__PURE__*/function (_WebexPlugin) {
|
|
|
789
792
|
deviceUrl: this.webex.internal.device.url,
|
|
790
793
|
orgId: this.webex.internal.device.orgId,
|
|
791
794
|
roapSeq: 0,
|
|
792
|
-
locus: type === _constants._LOCUS_ID_ ? destination : null
|
|
793
|
-
|
|
795
|
+
locus: type === _constants._LOCUS_ID_ ? destination : null,
|
|
796
|
+
// pass the locus object if present
|
|
797
|
+
meetingInfoProvider: this.meetingInfo
|
|
794
798
|
}, {
|
|
795
799
|
parent: this.webex
|
|
796
800
|
});
|
|
797
801
|
this.meetingCollection.set(meeting);
|
|
798
802
|
_context.prev = 3;
|
|
799
803
|
_context.next = 6;
|
|
800
|
-
return
|
|
804
|
+
return meeting.fetchMeetingInfo({
|
|
805
|
+
destination: destination,
|
|
806
|
+
type: type
|
|
807
|
+
});
|
|
801
808
|
|
|
802
809
|
case 6:
|
|
803
|
-
|
|
804
|
-
meeting.parseMeetingInfo(info);
|
|
805
|
-
meeting.meetingInfo = info ? info.body : null;
|
|
806
|
-
_context.next = 17;
|
|
810
|
+
_context.next = 13;
|
|
807
811
|
break;
|
|
808
812
|
|
|
809
|
-
case
|
|
810
|
-
_context.prev =
|
|
813
|
+
case 8:
|
|
814
|
+
_context.prev = 8;
|
|
811
815
|
_context.t0 = _context["catch"](3);
|
|
812
816
|
|
|
813
|
-
|
|
814
|
-
|
|
817
|
+
if (!(_context.t0 instanceof _captchaError.default) && !(_context.t0 instanceof _passwordError.default)) {
|
|
818
|
+
// if there is no meeting info we assume its a 1:1 call or wireless share
|
|
819
|
+
_loggerProxy.default.logger.info("Meetings:index#createMeeting --> Info Unable to fetch meeting info for ".concat(destination, "."));
|
|
815
820
|
|
|
816
|
-
|
|
821
|
+
_loggerProxy.default.logger.info('Meetings:index#createMeeting --> Info assuming this destination is a 1:1 or wireless share');
|
|
822
|
+
}
|
|
817
823
|
|
|
818
824
|
_loggerProxy.default.logger.debug("Meetings:index#createMeeting --> Debug ".concat(_context.t0, " fetching /meetingInfo for creation.")); // We need to save this info for future reference
|
|
819
825
|
|
|
820
826
|
|
|
821
827
|
meeting.destination = destination;
|
|
822
828
|
|
|
823
|
-
case
|
|
824
|
-
_context.prev =
|
|
829
|
+
case 13:
|
|
830
|
+
_context.prev = 13;
|
|
825
831
|
|
|
826
832
|
// For type LOCUS_ID we need to parse the locus object to get the information
|
|
827
833
|
// about the caller and callee
|
|
@@ -844,17 +850,17 @@ var Meetings = /*#__PURE__*/function (_WebexPlugin) {
|
|
|
844
850
|
});
|
|
845
851
|
}
|
|
846
852
|
|
|
847
|
-
return _context.finish(
|
|
853
|
+
return _context.finish(13);
|
|
848
854
|
|
|
849
|
-
case
|
|
855
|
+
case 16:
|
|
850
856
|
return _context.abrupt("return", meeting);
|
|
851
857
|
|
|
852
|
-
case
|
|
858
|
+
case 17:
|
|
853
859
|
case "end":
|
|
854
860
|
return _context.stop();
|
|
855
861
|
}
|
|
856
862
|
}
|
|
857
|
-
}, _callee, this, [[3,
|
|
863
|
+
}, _callee, this, [[3, 8, 13, 16]]);
|
|
858
864
|
}));
|
|
859
865
|
|
|
860
866
|
function createMeeting(_x) {
|