@webex/plugin-meetings 3.1.0 → 3.2.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.
Files changed (205) hide show
  1. package/dist/breakouts/breakout.js +1 -1
  2. package/dist/breakouts/index.js +1 -1
  3. package/dist/common/errors/reconnection-not-started.js +46 -0
  4. package/dist/common/errors/reconnection-not-started.js.map +1 -0
  5. package/dist/constants.js +16 -5
  6. package/dist/constants.js.map +1 -1
  7. package/dist/index.js +80 -0
  8. package/dist/index.js.map +1 -1
  9. package/dist/interpretation/index.js +1 -1
  10. package/dist/interpretation/siLanguage.js +1 -1
  11. package/dist/locus-info/controlsUtils.js +7 -1
  12. package/dist/locus-info/controlsUtils.js.map +1 -1
  13. package/dist/locus-info/index.js +10 -0
  14. package/dist/locus-info/index.js.map +1 -1
  15. package/dist/media/properties.js +102 -57
  16. package/dist/media/properties.js.map +1 -1
  17. package/dist/mediaQualityMetrics/config.js +10 -10
  18. package/dist/mediaQualityMetrics/config.js.map +1 -1
  19. package/dist/meeting/in-meeting-actions.js +6 -0
  20. package/dist/meeting/in-meeting-actions.js.map +1 -1
  21. package/dist/meeting/index.js +564 -475
  22. package/dist/meeting/index.js.map +1 -1
  23. package/dist/meeting/locusMediaRequest.js +27 -0
  24. package/dist/meeting/locusMediaRequest.js.map +1 -1
  25. package/dist/meeting/util.js +9 -16
  26. package/dist/meeting/util.js.map +1 -1
  27. package/dist/meeting/voicea-meeting.js +37 -49
  28. package/dist/meeting/voicea-meeting.js.map +1 -1
  29. package/dist/meeting-info/util.js +304 -267
  30. package/dist/meeting-info/util.js.map +1 -1
  31. package/dist/meeting-info/utilv2.js +334 -298
  32. package/dist/meeting-info/utilv2.js.map +1 -1
  33. package/dist/meetings/index.js +12 -28
  34. package/dist/meetings/index.js.map +1 -1
  35. package/dist/reachability/index.js +88 -9
  36. package/dist/reachability/index.js.map +1 -1
  37. package/dist/reconnection-manager/index.js +138 -109
  38. package/dist/reconnection-manager/index.js.map +1 -1
  39. package/dist/roap/request.js +3 -27
  40. package/dist/roap/request.js.map +1 -1
  41. package/dist/statsAnalyzer/index.js +8 -2
  42. package/dist/statsAnalyzer/index.js.map +1 -1
  43. package/dist/statsAnalyzer/mqaUtil.js +17 -0
  44. package/dist/statsAnalyzer/mqaUtil.js.map +1 -1
  45. package/dist/types/annotation/annotation.types.d.ts +42 -0
  46. package/dist/types/annotation/constants.d.ts +31 -0
  47. package/dist/types/annotation/index.d.ts +117 -0
  48. package/dist/types/breakouts/breakout.d.ts +8 -0
  49. package/dist/types/breakouts/collection.d.ts +5 -0
  50. package/dist/types/breakouts/edit-lock-error.d.ts +15 -0
  51. package/dist/types/breakouts/events.d.ts +8 -0
  52. package/dist/types/breakouts/index.d.ts +5 -0
  53. package/dist/types/breakouts/request.d.ts +22 -0
  54. package/dist/types/breakouts/utils.d.ts +15 -0
  55. package/dist/types/common/browser-detection.d.ts +9 -0
  56. package/dist/types/common/collection.d.ts +48 -0
  57. package/dist/types/common/config.d.ts +2 -0
  58. package/dist/types/common/errors/captcha-error.d.ts +15 -0
  59. package/dist/types/common/errors/intent-to-join.d.ts +16 -0
  60. package/dist/types/common/errors/join-meeting.d.ts +17 -0
  61. package/dist/types/common/errors/media.d.ts +15 -0
  62. package/dist/types/common/errors/no-meeting-info.d.ts +14 -0
  63. package/dist/types/common/errors/parameter.d.ts +15 -0
  64. package/dist/types/common/errors/password-error.d.ts +15 -0
  65. package/dist/types/common/errors/permission.d.ts +14 -0
  66. package/dist/types/common/errors/reclaim-host-role-errors.d.ts +60 -0
  67. package/dist/types/common/errors/reconnection-not-started.d.ts +13 -0
  68. package/dist/types/common/errors/reconnection.d.ts +15 -0
  69. package/dist/types/common/errors/stats.d.ts +15 -0
  70. package/dist/types/common/errors/webex-errors.d.ts +93 -0
  71. package/dist/types/common/errors/webex-meetings-error.d.ts +20 -0
  72. package/dist/types/common/events/events-scope.d.ts +17 -0
  73. package/dist/types/common/events/events.d.ts +12 -0
  74. package/dist/types/common/events/trigger-proxy.d.ts +2 -0
  75. package/dist/types/common/events/util.d.ts +2 -0
  76. package/dist/types/common/logs/logger-config.d.ts +2 -0
  77. package/dist/types/common/logs/logger-proxy.d.ts +2 -0
  78. package/dist/types/common/logs/request.d.ts +36 -0
  79. package/dist/types/common/queue.d.ts +34 -0
  80. package/dist/types/config.d.ts +73 -0
  81. package/dist/types/constants.d.ts +1098 -0
  82. package/dist/types/controls-options-manager/constants.d.ts +4 -0
  83. package/dist/types/controls-options-manager/enums.d.ts +15 -0
  84. package/dist/types/controls-options-manager/index.d.ts +136 -0
  85. package/dist/types/controls-options-manager/types.d.ts +43 -0
  86. package/dist/types/controls-options-manager/util.d.ts +1 -0
  87. package/dist/types/index.d.ts +19 -0
  88. package/dist/types/interceptors/index.d.ts +2 -0
  89. package/dist/types/interceptors/locusRetry.d.ts +27 -0
  90. package/dist/types/interpretation/collection.d.ts +5 -0
  91. package/dist/types/interpretation/index.d.ts +5 -0
  92. package/dist/types/interpretation/siLanguage.d.ts +5 -0
  93. package/dist/types/locus-info/controlsUtils.d.ts +2 -0
  94. package/dist/types/locus-info/embeddedAppsUtils.d.ts +2 -0
  95. package/dist/types/locus-info/fullState.d.ts +2 -0
  96. package/dist/types/locus-info/hostUtils.d.ts +2 -0
  97. package/dist/types/locus-info/index.d.ts +322 -0
  98. package/dist/types/locus-info/infoUtils.d.ts +2 -0
  99. package/dist/types/locus-info/mediaSharesUtils.d.ts +2 -0
  100. package/dist/types/locus-info/parser.d.ts +272 -0
  101. package/dist/types/locus-info/selfUtils.d.ts +2 -0
  102. package/dist/types/media/MediaConnectionAwaiter.d.ts +61 -0
  103. package/dist/types/media/index.d.ts +34 -0
  104. package/dist/types/media/properties.d.ts +117 -0
  105. package/dist/types/media/util.d.ts +2 -0
  106. package/dist/types/mediaQualityMetrics/config.d.ts +247 -0
  107. package/dist/types/meeting/in-meeting-actions.d.ts +173 -0
  108. package/dist/types/meeting/index.d.ts +1832 -0
  109. package/dist/types/meeting/locusMediaRequest.d.ts +75 -0
  110. package/dist/types/meeting/muteState.d.ts +178 -0
  111. package/dist/types/meeting/request.d.ts +295 -0
  112. package/dist/types/meeting/request.type.d.ts +11 -0
  113. package/dist/types/meeting/state.d.ts +9 -0
  114. package/dist/types/meeting/util.d.ts +122 -0
  115. package/dist/types/meeting/voicea-meeting.d.ts +17 -0
  116. package/dist/types/meeting-info/collection.d.ts +20 -0
  117. package/dist/types/meeting-info/index.d.ts +69 -0
  118. package/dist/types/meeting-info/meeting-info-v2.d.ts +123 -0
  119. package/dist/types/meeting-info/request.d.ts +22 -0
  120. package/dist/types/meeting-info/util.d.ts +49 -0
  121. package/dist/types/meeting-info/utilv2.d.ts +65 -0
  122. package/dist/types/meetings/collection.d.ts +40 -0
  123. package/dist/types/meetings/index.d.ts +383 -0
  124. package/dist/types/meetings/meetings.types.d.ts +4 -0
  125. package/dist/types/meetings/request.d.ts +27 -0
  126. package/dist/types/meetings/util.d.ts +18 -0
  127. package/dist/types/member/index.d.ts +160 -0
  128. package/dist/types/member/types.d.ts +32 -0
  129. package/dist/types/member/util.d.ts +2 -0
  130. package/dist/types/members/collection.d.ts +29 -0
  131. package/dist/types/members/index.d.ts +353 -0
  132. package/dist/types/members/request.d.ts +114 -0
  133. package/dist/types/members/types.d.ts +25 -0
  134. package/dist/types/members/util.d.ts +215 -0
  135. package/dist/types/metrics/constants.d.ts +70 -0
  136. package/dist/types/metrics/index.d.ts +45 -0
  137. package/dist/types/multistream/mediaRequestManager.d.ts +119 -0
  138. package/dist/types/multistream/receiveSlot.d.ts +68 -0
  139. package/dist/types/multistream/receiveSlotManager.d.ts +56 -0
  140. package/dist/types/multistream/remoteMedia.d.ts +72 -0
  141. package/dist/types/multistream/remoteMediaGroup.d.ts +49 -0
  142. package/dist/types/multistream/remoteMediaManager.d.ts +300 -0
  143. package/dist/types/multistream/sendSlotManager.d.ts +69 -0
  144. package/dist/types/networkQualityMonitor/index.d.ts +70 -0
  145. package/dist/types/personal-meeting-room/index.d.ts +47 -0
  146. package/dist/types/personal-meeting-room/request.d.ts +14 -0
  147. package/dist/types/personal-meeting-room/util.d.ts +2 -0
  148. package/dist/types/reachability/clusterReachability.d.ts +110 -0
  149. package/dist/types/reachability/index.d.ts +120 -0
  150. package/dist/types/reachability/request.d.ts +39 -0
  151. package/dist/types/reachability/util.d.ts +15 -0
  152. package/dist/types/reactions/constants.d.ts +3 -0
  153. package/dist/types/reactions/reactions.d.ts +4 -0
  154. package/dist/types/reactions/reactions.type.d.ts +52 -0
  155. package/dist/types/reconnection-manager/index.d.ts +126 -0
  156. package/dist/types/recording-controller/enums.d.ts +7 -0
  157. package/dist/types/recording-controller/index.d.ts +207 -0
  158. package/dist/types/recording-controller/util.d.ts +14 -0
  159. package/dist/types/roap/index.d.ts +86 -0
  160. package/dist/types/roap/request.d.ts +39 -0
  161. package/dist/types/roap/turnDiscovery.d.ts +155 -0
  162. package/dist/types/rtcMetrics/constants.d.ts +4 -0
  163. package/dist/types/rtcMetrics/index.d.ts +61 -0
  164. package/dist/types/statsAnalyzer/global.d.ts +36 -0
  165. package/dist/types/statsAnalyzer/index.d.ts +217 -0
  166. package/dist/types/statsAnalyzer/mqaUtil.d.ts +48 -0
  167. package/dist/types/transcription/index.d.ts +64 -0
  168. package/dist/types/webinar/collection.d.ts +16 -0
  169. package/dist/types/webinar/index.d.ts +5 -0
  170. package/dist/webinar/index.js +1 -1
  171. package/package.json +22 -22
  172. package/src/common/errors/reconnection-not-started.ts +25 -0
  173. package/src/constants.ts +14 -5
  174. package/src/index.ts +30 -0
  175. package/src/locus-info/controlsUtils.ts +11 -0
  176. package/src/locus-info/index.ts +16 -0
  177. package/src/media/properties.ts +67 -15
  178. package/src/mediaQualityMetrics/config.ts +13 -7
  179. package/src/meeting/in-meeting-actions.ts +12 -0
  180. package/src/meeting/index.ts +144 -107
  181. package/src/meeting/locusMediaRequest.ts +31 -0
  182. package/src/meeting/util.ts +9 -16
  183. package/src/meeting/voicea-meeting.ts +44 -46
  184. package/src/meeting-info/util.ts +241 -233
  185. package/src/meeting-info/utilv2.ts +250 -244
  186. package/src/meetings/index.ts +15 -27
  187. package/src/reachability/index.ts +60 -0
  188. package/src/reconnection-manager/index.ts +128 -105
  189. package/src/roap/request.ts +1 -24
  190. package/src/statsAnalyzer/index.ts +10 -3
  191. package/src/statsAnalyzer/mqaUtil.ts +23 -0
  192. package/test/unit/spec/locus-info/controlsUtils.js +20 -0
  193. package/test/unit/spec/locus-info/index.js +21 -0
  194. package/test/unit/spec/media/properties.ts +145 -140
  195. package/test/unit/spec/meeting/in-meeting-actions.ts +6 -0
  196. package/test/unit/spec/meeting/index.js +271 -105
  197. package/test/unit/spec/meeting/locusMediaRequest.ts +49 -0
  198. package/test/unit/spec/meeting/utils.js +3 -10
  199. package/test/unit/spec/meeting/voicea-meeting.ts +5 -14
  200. package/test/unit/spec/meetings/index.js +59 -17
  201. package/test/unit/spec/reachability/index.ts +266 -0
  202. package/test/unit/spec/reconnection-manager/index.js +127 -39
  203. package/test/unit/spec/roap/request.ts +0 -37
  204. package/test/unit/spec/stats-analyzer/index.js +100 -8
  205. package/src/common/errors/reconnection-in-progress.ts +0 -8
@@ -9,6 +9,8 @@ exports.default = void 0;
9
9
  var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
10
10
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
11
11
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
12
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
13
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
12
14
  var _url = _interopRequireDefault(require("url"));
13
15
  var _btoa = _interopRequireDefault(require("btoa"));
14
16
  var _common = require("@webex/common");
@@ -16,286 +18,321 @@ var _parameter = _interopRequireDefault(require("../common/errors/parameter"));
16
18
  var _loggerProxy = _interopRequireDefault(require("../common/logs/logger-proxy"));
17
19
  var _constants = require("../constants");
18
20
  // @ts-ignore
21
+ /**
22
+ * @class MeetingInfoUtil
23
+ */
24
+ var MeetingInfoUtil = exports.default = /*#__PURE__*/function () {
25
+ function MeetingInfoUtil() {
26
+ (0, _classCallCheck2.default)(this, MeetingInfoUtil);
27
+ }
28
+ (0, _createClass2.default)(MeetingInfoUtil, null, [{
29
+ key: "extractDestination",
30
+ value: function extractDestination(destination, type) {
31
+ var dest = destination;
32
+ if (type === _constants._LOCUS_ID_) {
33
+ if (!(destination && destination.url)) {
34
+ throw new _parameter.default('You cannot create a meeting by locus without a locus.url defined');
35
+ }
36
+ dest = destination.url;
37
+ }
38
+ return dest;
39
+ }
40
+ }, {
41
+ key: "getParsedUrl",
42
+ value: function getParsedUrl(link) {
43
+ try {
44
+ var parsedUrl = _url.default.parse(link);
45
+ if (!parsedUrl) {
46
+ return false;
47
+ }
48
+ // hack for links such as <company>.webex.com/meet/<user> without a protocol
49
+ if (!parsedUrl.protocol) {
50
+ parsedUrl = _url.default.parse("".concat(_constants.HTTPS_PROTOCOL).concat(link));
51
+ }
52
+ return parsedUrl;
53
+ } catch (error) {
54
+ _loggerProxy.default.logger.warn("Meeting-info:util#getParsedUrl --> unable to parse the URL, error: ".concat(error));
55
+ return null;
56
+ }
57
+ }
19
58
 
20
- var MeetingInfoUtil = {};
21
- MeetingInfoUtil.extractDestination = function (destination, type) {
22
- var dest = destination;
23
- if (type === _constants._LOCUS_ID_) {
24
- if (!(destination && destination.url)) {
25
- throw new _parameter.default('You cannot create a meeting by locus without a locus.url defined');
59
+ /**
60
+ * Helper function to check if a string matches a known meeting link pattern
61
+ * @param {String} value string to parse and see if it matches a meeting link
62
+ * @returns {Boolean}
63
+ */
64
+ }, {
65
+ key: "isMeetingLink",
66
+ value: function isMeetingLink(value) {
67
+ var parsedUrl = this.getParsedUrl(value);
68
+ var hostNameBool;
69
+ var pathNameBool;
70
+ if (parsedUrl) {
71
+ hostNameBool = parsedUrl.hostname && parsedUrl.hostname.includes(_constants.WEBEX_DOT_COM);
72
+ pathNameBool = parsedUrl.pathname && (parsedUrl.pathname.includes("/".concat(_constants.MEET)) || parsedUrl.pathname.includes("/".concat(_constants.MEET_M)) || parsedUrl.pathname.includes("/".concat(_constants.JOIN)));
73
+ }
74
+ return hostNameBool && pathNameBool;
26
75
  }
27
- dest = destination.url;
28
- }
29
- return dest;
30
- };
31
- MeetingInfoUtil.getParsedUrl = function (link) {
32
- try {
33
- var parsedUrl = _url.default.parse(link);
34
- if (!parsedUrl) {
76
+ }, {
77
+ key: "isConversationUrl",
78
+ value: function isConversationUrl(value, webex) {
79
+ var clusterId = webex.internal.services.getClusterId(value);
80
+ if (clusterId) {
81
+ return clusterId.endsWith(_constants.CONVERSATION_SERVICE);
82
+ }
35
83
  return false;
36
84
  }
37
- // hack for links such as <company>.webex.com/meet/<user> without a protocol
38
- if (!parsedUrl.protocol) {
39
- parsedUrl = _url.default.parse("".concat(_constants.HTTPS_PROTOCOL).concat(link));
85
+ }, {
86
+ key: "convertLinkToSip",
87
+ value: function convertLinkToSip(value) {
88
+ var parsedUrl = this.getParsedUrl(value);
89
+ if (!parsedUrl) {
90
+ return null;
91
+ }
92
+ var user;
93
+ if (parsedUrl.pathname) {
94
+ var userIndex = parsedUrl.pathname.lastIndexOf('/');
95
+ user = parsedUrl.pathname.substring(userIndex + 1);
96
+ }
97
+ if (!user) {
98
+ return null;
99
+ }
100
+ var company;
101
+ if (parsedUrl.hostname) {
102
+ var companyIndex = parsedUrl.hostname.lastIndexOf(".".concat(_constants.WEBEX_DOT_COM));
103
+ company = parsedUrl.hostname.substring(0, companyIndex).replace(_constants.WWW_DOT, '');
104
+ }
105
+ if (!company) {
106
+ return null;
107
+ }
108
+ return "".concat(user, "@").concat(company, ".").concat(_constants.WEBEX_DOT_COM);
40
109
  }
41
- return parsedUrl;
42
- } catch (error) {
43
- _loggerProxy.default.logger.warn("Meeting-info:util#getParsedUrl --> unable to parse the URL, error: ".concat(error));
44
- return null;
45
- }
46
- };
47
-
48
- /**
49
- * Helper function to check if a string matches a known meeting link pattern
50
- * @param {String} value string to parse and see if it matches a meeting link
51
- * @returns {Boolean}
52
- */
53
- MeetingInfoUtil.isMeetingLink = function (value) {
54
- var parsedUrl = MeetingInfoUtil.getParsedUrl(value);
55
- var hostNameBool = parsedUrl.hostname && parsedUrl.hostname.includes(_constants.WEBEX_DOT_COM);
56
- var pathNameBool = parsedUrl.pathname && (parsedUrl.pathname.includes("/".concat(_constants.MEET)) || parsedUrl.pathname.includes("/".concat(_constants.MEET_M)) || parsedUrl.pathname.includes("/".concat(_constants.JOIN)));
57
- return hostNameBool && pathNameBool;
58
- };
59
- MeetingInfoUtil.isConversationUrl = function (value, webex) {
60
- var clusterId = webex.internal.services.getClusterId(value);
61
- if (clusterId) {
62
- return clusterId.endsWith(_constants.CONVERSATION_SERVICE);
63
- }
64
- return false;
65
- };
66
- MeetingInfoUtil.convertLinkToSip = function (value) {
67
- var parsedUrl = MeetingInfoUtil.getParsedUrl(value);
68
- if (!parsedUrl) {
69
- return null;
70
- }
71
- var user;
72
- if (parsedUrl.pathname) {
73
- var userIndex = parsedUrl.pathname.lastIndexOf('/');
74
- user = parsedUrl.pathname.substring(userIndex + 1);
75
- }
76
- if (!user) {
77
- return null;
78
- }
79
- var company;
80
- if (parsedUrl.hostname) {
81
- var companyIndex = parsedUrl.hostname.lastIndexOf(".".concat(_constants.WEBEX_DOT_COM));
82
- company = parsedUrl.hostname.substring(0, companyIndex).replace(_constants.WWW_DOT, '');
83
- }
84
- if (!company) {
85
- return null;
86
- }
87
- return "".concat(user, "@").concat(company, ".").concat(_constants.WEBEX_DOT_COM);
88
- };
89
- MeetingInfoUtil.isSipUri = function (sipString) {
90
- // TODO: lets remove regex from this equation and user URI matchers and such
91
- // have not found a great sip uri parser library as of now
92
- var sipUri = _constants.DIALER_REGEX.SIP_ADDRESS.exec(sipString);
93
- return sipUri;
94
- };
95
- MeetingInfoUtil.isPhoneNumber = function (phoneNumber) {
96
- var isValidNumber = _constants.DIALER_REGEX.PHONE_NUMBER.test(phoneNumber);
97
- return isValidNumber;
98
- };
99
- MeetingInfoUtil.getHydraId = function (destination) {
100
- var _deconstructHydraId = (0, _common.deconstructHydraId)(destination),
101
- type = _deconstructHydraId.type,
102
- id = _deconstructHydraId.id,
103
- cluster = _deconstructHydraId.cluster;
104
- if (id && _constants.UUID_REG.test(id)) {
105
- if (type === _constants._ROOM_) {
106
- return {
107
- room: true,
108
- destination: id,
109
- cluster: cluster
110
- };
110
+ }, {
111
+ key: "isSipUri",
112
+ value: function isSipUri(sipString) {
113
+ // TODO: lets remove regex from this equation and user URI matchers and such
114
+ // have not found a great sip uri parser library as of now
115
+ var sipUri = _constants.DIALER_REGEX.SIP_ADDRESS.exec(sipString);
116
+ return sipUri;
111
117
  }
112
- if (type === _constants._PEOPLE_) {
113
- return {
114
- people: true,
115
- destination: id,
116
- cluster: cluster
117
- };
118
+ }, {
119
+ key: "isPhoneNumber",
120
+ value: function isPhoneNumber(phoneNumber) {
121
+ var isValidNumber = _constants.DIALER_REGEX.PHONE_NUMBER.test(phoneNumber);
122
+ return isValidNumber;
118
123
  }
119
- return {};
120
- }
121
- return {};
122
- };
123
- MeetingInfoUtil.getSipUriFromHydraPersonId = function (destination, webex) {
124
- return webex.people.get(destination).then(function (res) {
125
- if (res.emails && res.emails.length) {
126
- return res.emails[0];
124
+ }, {
125
+ key: "getHydraId",
126
+ value: function getHydraId(destination) {
127
+ var _deconstructHydraId = (0, _common.deconstructHydraId)(destination),
128
+ type = _deconstructHydraId.type,
129
+ id = _deconstructHydraId.id,
130
+ cluster = _deconstructHydraId.cluster;
131
+ if (id && _constants.UUID_REG.test(id)) {
132
+ if (type === _constants._ROOM_) {
133
+ return {
134
+ room: true,
135
+ destination: id,
136
+ cluster: cluster
137
+ };
138
+ }
139
+ if (type === _constants._PEOPLE_) {
140
+ return {
141
+ people: true,
142
+ destination: id,
143
+ cluster: cluster
144
+ };
145
+ }
146
+ return {};
147
+ }
148
+ return {};
127
149
  }
128
- throw new _parameter.default('Hydra Id Lookup was an invalid hydra person id.');
129
- }).catch(function (err) {
130
- _loggerProxy.default.logger.error("Meeting-info:util#MeetingInfoUtil.getSipUriFromHydraPersonId --> getSipUriFromHydraPersonId ".concat(err, " "));
131
- throw err;
132
- });
133
- };
134
- MeetingInfoUtil.generateOptions = /*#__PURE__*/function () {
135
- var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(from) {
136
- var destination, type, webex, options, hydraId, serviceUrl;
137
- return _regenerator.default.wrap(function _callee$(_context) {
138
- while (1) switch (_context.prev = _context.next) {
139
- case 0:
140
- destination = from.destination, type = from.type, webex = from.webex;
141
- if (!type) {
142
- _context.next = 3;
143
- break;
144
- }
145
- return _context.abrupt("return", {
146
- destination: destination,
147
- type: type
148
- });
149
- case 3:
150
- options = {};
151
- hydraId = MeetingInfoUtil.getHydraId(destination);
152
- if (!MeetingInfoUtil.isMeetingLink(destination)) {
153
- _context.next = 11;
154
- break;
150
+ }, {
151
+ key: "getSipUriFromHydraPersonId",
152
+ value: function getSipUriFromHydraPersonId(destination, webex) {
153
+ return webex.people.get(destination).then(function (res) {
154
+ if (res.emails && res.emails.length) {
155
+ return res.emails[0];
156
+ }
157
+ throw new _parameter.default('Hydra Id Lookup was an invalid hydra person id.');
158
+ }).catch(function (err) {
159
+ _loggerProxy.default.logger.error("Meeting-info:util#MeetingInfoUtil.getSipUriFromHydraPersonId --> getSipUriFromHydraPersonId ".concat(err, " "));
160
+ throw err;
161
+ });
162
+ }
163
+ }, {
164
+ key: "generateOptions",
165
+ value: function () {
166
+ var _generateOptions = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(from) {
167
+ var destination, type, webex, options, hydraId, serviceUrl;
168
+ return _regenerator.default.wrap(function _callee$(_context) {
169
+ while (1) switch (_context.prev = _context.next) {
170
+ case 0:
171
+ destination = from.destination, type = from.type, webex = from.webex;
172
+ if (!type) {
173
+ _context.next = 3;
174
+ break;
175
+ }
176
+ return _context.abrupt("return", {
177
+ destination: destination,
178
+ type: type
179
+ });
180
+ case 3:
181
+ options = {};
182
+ hydraId = this.getHydraId(destination);
183
+ if (!this.isMeetingLink(destination)) {
184
+ _context.next = 11;
185
+ break;
186
+ }
187
+ _loggerProxy.default.logger.warn('Meeting-info:util#generateOptions --> WARN, use of Meeting Link is deprecated, please use a SIP URI instead');
188
+ options.type = _constants._MEETING_LINK_;
189
+ options.destination = destination;
190
+ _context.next = 47;
191
+ break;
192
+ case 11:
193
+ if (!this.isSipUri(destination)) {
194
+ _context.next = 16;
195
+ break;
196
+ }
197
+ options.type = _constants._SIP_URI_;
198
+ options.destination = destination;
199
+ _context.next = 47;
200
+ break;
201
+ case 16:
202
+ if (!this.isPhoneNumber(destination)) {
203
+ _context.next = 21;
204
+ break;
205
+ }
206
+ options.type = _constants._SIP_URI_;
207
+ options.destination = destination;
208
+ _context.next = 47;
209
+ break;
210
+ case 21:
211
+ if (!this.isConversationUrl(destination, webex)) {
212
+ _context.next = 26;
213
+ break;
214
+ }
215
+ options.type = _constants._CONVERSATION_URL_;
216
+ options.destination = destination;
217
+ _context.next = 47;
218
+ break;
219
+ case 26:
220
+ if (!hydraId.people) {
221
+ _context.next = 31;
222
+ break;
223
+ }
224
+ options.type = _constants._SIP_URI_;
225
+ return _context.abrupt("return", this.getSipUriFromHydraPersonId(hydraId.destination, webex).then(function (res) {
226
+ options.destination = res;
227
+
228
+ // Since hydra person ids require a unique case in which they are
229
+ // entirely converted to a SIP URI, we need to set a flag for detecting
230
+ // this type of destination.
231
+ options.wasHydraPerson = true;
232
+ return _promise.default.resolve(options);
233
+ }));
234
+ case 31:
235
+ if (!hydraId.room) {
236
+ _context.next = 46;
237
+ break;
238
+ }
239
+ options.type = _constants._CONVERSATION_URL_;
240
+ _context.prev = 33;
241
+ _context.next = 36;
242
+ return webex.internal.services.waitForCatalog('postauth');
243
+ case 36:
244
+ serviceUrl = webex.internal.services.getServiceUrlFromClusterId({
245
+ cluster: hydraId.cluster
246
+ }, webex);
247
+ options.destination = hydraId.destination ? "".concat(serviceUrl, "/conversations/").concat(hydraId.destination) : serviceUrl;
248
+ _context.next = 44;
249
+ break;
250
+ case 40:
251
+ _context.prev = 40;
252
+ _context.t0 = _context["catch"](33);
253
+ _loggerProxy.default.logger.error("Meeting-info:util#generateOptions --> ".concat(_context.t0));
254
+ throw _context.t0;
255
+ case 44:
256
+ _context.next = 47;
257
+ break;
258
+ case 46:
259
+ throw new _parameter.default('MeetingInfo is fetched with the meeting link, SIP URI, phone number, Hydra people ID, or a conversation URL.');
260
+ case 47:
261
+ return _context.abrupt("return", _promise.default.resolve(options));
262
+ case 48:
263
+ case "end":
264
+ return _context.stop();
155
265
  }
156
- _loggerProxy.default.logger.warn('Meeting-info:util#generateOptions --> WARN, use of Meeting Link is deprecated, please use a SIP URI instead');
157
- options.type = _constants._MEETING_LINK_;
158
- options.destination = destination;
159
- _context.next = 47;
266
+ }, _callee, this, [[33, 40]]);
267
+ }));
268
+ function generateOptions(_x) {
269
+ return _generateOptions.apply(this, arguments);
270
+ }
271
+ return generateOptions;
272
+ }()
273
+ /**
274
+ * Helper function to build up a correct locus url depending on the value passed
275
+ * @param {String} type One of [SIP_URI, PERSONAL_ROOM, MEETING_ID, CONVERSATION_URL, LOCUS_ID, MEETING_LINK]
276
+ * @param {Object} value ?? value.value
277
+ * @returns {Object} returns an object with {resource, method}
278
+ */
279
+ }, {
280
+ key: "getResourceUrl",
281
+ value: function getResourceUrl(type, value) {
282
+ var resource = "/".concat(_constants.LOCI, "/").concat(_constants.MEETINGINFO);
283
+ var method = _constants.HTTP_VERBS.GET;
284
+ var uri = null;
285
+ switch (type) {
286
+ case _constants._SIP_URI_:
287
+ case _constants._PERSONAL_ROOM_:
288
+ case _constants._MEETING_ID_:
289
+ resource = "/".concat(_constants.LOCI, "/").concat(_constants.MEETINGINFO, "/").concat(encodeURIComponent(value), "?").concat(_constants.TYPE, "=").concat(type, "&").concat(_constants.USE_URI_LOOKUP_FALSE);
160
290
  break;
161
- case 11:
162
- if (!MeetingInfoUtil.isSipUri(destination)) {
163
- _context.next = 16;
164
- break;
165
- }
166
- options.type = _constants._SIP_URI_;
167
- options.destination = destination;
168
- _context.next = 47;
291
+ case _constants._CONVERSATION_URL_:
292
+ method = _constants.HTTP_VERBS.PUT;
169
293
  break;
170
- case 16:
171
- if (!MeetingInfoUtil.isPhoneNumber(destination)) {
172
- _context.next = 21;
173
- break;
174
- }
175
- options.type = _constants._SIP_URI_;
176
- options.destination = destination;
177
- _context.next = 47;
294
+ case _constants._LOCUS_ID_:
295
+ uri = "".concat(value, "/").concat(_constants.MEETINGINFO);
296
+ method = _constants.HTTP_VERBS.PUT;
178
297
  break;
179
- case 21:
180
- if (!MeetingInfoUtil.isConversationUrl(destination, webex)) {
181
- _context.next = 26;
182
- break;
183
- }
184
- options.type = _constants._CONVERSATION_URL_;
185
- options.destination = destination;
186
- _context.next = 47;
298
+ case _constants._MEETING_LINK_:
299
+ resource = "$/".concat(_constants.LOCI, "/").concat(_constants.MEETINGINFO, "/").concat((0, _btoa.default)(value), "?").concat(_constants.TYPE, "=").concat(_constants._MEETING_LINK_, "&").concat(_constants.USE_URI_LOOKUP_FALSE);
187
300
  break;
188
- case 26:
189
- if (!hydraId.people) {
190
- _context.next = 31;
191
- break;
192
- }
193
- options.type = _constants._SIP_URI_;
194
- return _context.abrupt("return", MeetingInfoUtil.getSipUriFromHydraPersonId(hydraId.destination, webex).then(function (res) {
195
- options.destination = res;
196
-
197
- // Since hydra person ids require a unique case in which they are
198
- // entirely converted to a SIP URI, we need to set a flag for detecting
199
- // this type of destination.
200
- options.wasHydraPerson = true;
201
- return _promise.default.resolve(options);
202
- }));
203
- case 31:
204
- if (!hydraId.room) {
205
- _context.next = 46;
206
- break;
207
- }
208
- options.type = _constants._CONVERSATION_URL_;
209
- _context.prev = 33;
210
- _context.next = 36;
211
- return webex.internal.services.waitForCatalog('postauth');
212
- case 36:
213
- serviceUrl = webex.internal.services.getServiceUrlFromClusterId({
214
- cluster: hydraId.cluster
215
- }, webex);
216
- options.destination = hydraId.destination ? "".concat(serviceUrl, "/conversations/").concat(hydraId.destination) : serviceUrl;
217
- _context.next = 44;
218
- break;
219
- case 40:
220
- _context.prev = 40;
221
- _context.t0 = _context["catch"](33);
222
- _loggerProxy.default.logger.error("Meeting-info:util#generateOptions --> ".concat(_context.t0));
223
- throw _context.t0;
224
- case 44:
225
- _context.next = 47;
226
- break;
227
- case 46:
228
- throw new _parameter.default('MeetingInfo is fetched with the meeting link, SIP URI, phone number, Hydra people ID, or a conversation URL.');
229
- case 47:
230
- return _context.abrupt("return", _promise.default.resolve(options));
231
- case 48:
232
- case "end":
233
- return _context.stop();
301
+ default:
302
+ }
303
+ return {
304
+ uri: uri,
305
+ resource: resource,
306
+ method: method
307
+ };
308
+ }
309
+ }, {
310
+ key: "getRequestParams",
311
+ value: function getRequestParams(resourceOptions, type, value, api) {
312
+ var requestParams = {
313
+ method: resourceOptions.method,
314
+ api: api,
315
+ resource: resourceOptions.resource
316
+ };
317
+ if (resourceOptions.method === _constants.HTTP_VERBS.GET) {
318
+ // for handling URL redirections
319
+ requestParams.resource = requestParams.resource.concat("&".concat(_constants.ALTERNATE_REDIRECT_TRUE));
320
+ } else if (type !== _constants._LOCUS_ID_) {
321
+ // locus id check is a PUT not sure why
322
+ requestParams.resource = requestParams.resource.concat("?".concat(_constants.ALTERNATE_REDIRECT_TRUE));
323
+ requestParams.body = {
324
+ value: value,
325
+ lookupType: type
326
+ };
327
+ } else if (type === _constants._LOCUS_ID_) {
328
+ requestParams = {
329
+ method: resourceOptions.method,
330
+ uri: resourceOptions.uri
331
+ };
234
332
  }
235
- }, _callee, null, [[33, 40]]);
236
- }));
237
- return function (_x) {
238
- return _ref.apply(this, arguments);
239
- };
333
+ return requestParams;
334
+ }
335
+ }]);
336
+ return MeetingInfoUtil;
240
337
  }();
241
-
242
- /**
243
- * Helper function to build up a correct locus url depending on the value passed
244
- * @param {String} type One of [SIP_URI, PERSONAL_ROOM, MEETING_ID, CONVERSATION_URL, LOCUS_ID, MEETING_LINK]
245
- * @param {Object} value ?? value.value
246
- * @returns {Object} returns an object with {resource, method}
247
- */
248
- MeetingInfoUtil.getResourceUrl = function (type, value) {
249
- var resource = "/".concat(_constants.LOCI, "/").concat(_constants.MEETINGINFO);
250
- var method = _constants.HTTP_VERBS.GET;
251
- var uri = null;
252
- switch (type) {
253
- case _constants._SIP_URI_:
254
- case _constants._PERSONAL_ROOM_:
255
- case _constants._MEETING_ID_:
256
- resource = "/".concat(_constants.LOCI, "/").concat(_constants.MEETINGINFO, "/").concat(encodeURIComponent(value), "?").concat(_constants.TYPE, "=").concat(type, "&").concat(_constants.USE_URI_LOOKUP_FALSE);
257
- break;
258
- case _constants._CONVERSATION_URL_:
259
- method = _constants.HTTP_VERBS.PUT;
260
- break;
261
- case _constants._LOCUS_ID_:
262
- uri = "".concat(value, "/").concat(_constants.MEETINGINFO);
263
- method = _constants.HTTP_VERBS.PUT;
264
- break;
265
- case _constants._MEETING_LINK_:
266
- resource = "$/".concat(_constants.LOCI, "/").concat(_constants.MEETINGINFO, "/").concat((0, _btoa.default)(value), "?").concat(_constants.TYPE, "=").concat(_constants._MEETING_LINK_, "&").concat(_constants.USE_URI_LOOKUP_FALSE);
267
- break;
268
- default:
269
- }
270
- return {
271
- uri: uri,
272
- resource: resource,
273
- method: method
274
- };
275
- };
276
- MeetingInfoUtil.getRequestParams = function (resourceOptions, type, value, api) {
277
- var requestParams = {
278
- method: resourceOptions.method,
279
- api: api,
280
- resource: resourceOptions.resource
281
- };
282
- if (resourceOptions.method === _constants.HTTP_VERBS.GET) {
283
- // for handling URL redirections
284
- requestParams.resource = requestParams.resource.concat("&".concat(_constants.ALTERNATE_REDIRECT_TRUE));
285
- } else if (type !== _constants._LOCUS_ID_) {
286
- // locus id check is a PUT not sure why
287
- requestParams.resource = requestParams.resource.concat("?".concat(_constants.ALTERNATE_REDIRECT_TRUE));
288
- requestParams.body = {
289
- value: value,
290
- lookupType: type
291
- };
292
- } else if (type === _constants._LOCUS_ID_) {
293
- requestParams = {
294
- method: resourceOptions.method,
295
- uri: resourceOptions.uri
296
- };
297
- }
298
- return requestParams;
299
- };
300
- var _default = exports.default = MeetingInfoUtil;
301
338
  //# sourceMappingURL=util.js.map