@webex/plugin-meetings 2.37.0 → 2.37.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (308) hide show
  1. package/UPGRADING.md +9 -9
  2. package/browsers.js +19 -24
  3. package/dist/common/browser-detection.js +1 -20
  4. package/dist/common/browser-detection.js.map +1 -1
  5. package/dist/common/collection.js +5 -20
  6. package/dist/common/collection.js.map +1 -1
  7. package/dist/common/config.js +0 -7
  8. package/dist/common/config.js.map +1 -1
  9. package/dist/common/errors/captcha-error.js +5 -26
  10. package/dist/common/errors/captcha-error.js.map +1 -1
  11. package/dist/common/errors/intent-to-join.js +5 -26
  12. package/dist/common/errors/intent-to-join.js.map +1 -1
  13. package/dist/common/errors/join-meeting.js +6 -27
  14. package/dist/common/errors/join-meeting.js.map +1 -1
  15. package/dist/common/errors/media.js +5 -26
  16. package/dist/common/errors/media.js.map +1 -1
  17. package/dist/common/errors/parameter.js +5 -33
  18. package/dist/common/errors/parameter.js.map +1 -1
  19. package/dist/common/errors/password-error.js +5 -26
  20. package/dist/common/errors/password-error.js.map +1 -1
  21. package/dist/common/errors/permission.js +4 -25
  22. package/dist/common/errors/permission.js.map +1 -1
  23. package/dist/common/errors/reconnection-in-progress.js +0 -17
  24. package/dist/common/errors/reconnection-in-progress.js.map +1 -1
  25. package/dist/common/errors/reconnection.js +5 -26
  26. package/dist/common/errors/reconnection.js.map +1 -1
  27. package/dist/common/errors/stats.js +5 -26
  28. package/dist/common/errors/stats.js.map +1 -1
  29. package/dist/common/errors/webex-errors.js +7 -46
  30. package/dist/common/errors/webex-errors.js.map +1 -1
  31. package/dist/common/errors/webex-meetings-error.js +1 -24
  32. package/dist/common/errors/webex-meetings-error.js.map +1 -1
  33. package/dist/common/events/events-scope.js +0 -22
  34. package/dist/common/events/events-scope.js.map +1 -1
  35. package/dist/common/events/events.js +0 -23
  36. package/dist/common/events/events.js.map +1 -1
  37. package/dist/common/events/trigger-proxy.js +0 -12
  38. package/dist/common/events/trigger-proxy.js.map +1 -1
  39. package/dist/common/events/util.js +0 -15
  40. package/dist/common/events/util.js.map +1 -1
  41. package/dist/common/logs/logger-config.js +0 -4
  42. package/dist/common/logs/logger-config.js.map +1 -1
  43. package/dist/common/logs/logger-proxy.js +1 -8
  44. package/dist/common/logs/logger-proxy.js.map +1 -1
  45. package/dist/common/logs/request.js +35 -61
  46. package/dist/common/logs/request.js.map +1 -1
  47. package/dist/common/queue.js +4 -14
  48. package/dist/common/queue.js.map +1 -1
  49. package/dist/config.js +1 -5
  50. package/dist/config.js.map +1 -1
  51. package/dist/constants.js +46 -42
  52. package/dist/constants.js.map +1 -1
  53. package/dist/index.js +1 -17
  54. package/dist/index.js.map +1 -1
  55. package/dist/locus-info/controlsUtils.js +10 -28
  56. package/dist/locus-info/controlsUtils.js.map +1 -1
  57. package/dist/locus-info/embeddedAppsUtils.js +3 -26
  58. package/dist/locus-info/embeddedAppsUtils.js.map +1 -1
  59. package/dist/locus-info/fullState.js +0 -15
  60. package/dist/locus-info/fullState.js.map +1 -1
  61. package/dist/locus-info/hostUtils.js +4 -12
  62. package/dist/locus-info/hostUtils.js.map +1 -1
  63. package/dist/locus-info/index.js +101 -193
  64. package/dist/locus-info/index.js.map +1 -1
  65. package/dist/locus-info/infoUtils.js +0 -37
  66. package/dist/locus-info/infoUtils.js.map +1 -1
  67. package/dist/locus-info/mediaSharesUtils.js +12 -38
  68. package/dist/locus-info/mediaSharesUtils.js.map +1 -1
  69. package/dist/locus-info/parser.js +87 -123
  70. package/dist/locus-info/parser.js.map +1 -1
  71. package/dist/locus-info/selfUtils.js +16 -81
  72. package/dist/locus-info/selfUtils.js.map +1 -1
  73. package/dist/media/index.js +74 -137
  74. package/dist/media/index.js.map +1 -1
  75. package/dist/media/properties.js +64 -110
  76. package/dist/media/properties.js.map +1 -1
  77. package/dist/media/util.js +3 -17
  78. package/dist/media/util.js.map +1 -1
  79. package/dist/mediaQualityMetrics/config.js +10 -12
  80. package/dist/mediaQualityMetrics/config.js.map +1 -1
  81. package/dist/meeting/effectsState.js +120 -192
  82. package/dist/meeting/effectsState.js.map +1 -1
  83. package/dist/meeting/in-meeting-actions.js +0 -13
  84. package/dist/meeting/in-meeting-actions.js.map +1 -1
  85. package/dist/meeting/index.js +812 -1487
  86. package/dist/meeting/index.js.map +1 -1
  87. package/dist/meeting/muteState.js +31 -78
  88. package/dist/meeting/muteState.js.map +1 -1
  89. package/dist/meeting/request.js +157 -227
  90. package/dist/meeting/request.js.map +1 -1
  91. package/dist/meeting/state.js +21 -31
  92. package/dist/meeting/state.js.map +1 -1
  93. package/dist/meeting/util.js +25 -169
  94. package/dist/meeting/util.js.map +1 -1
  95. package/dist/meeting-info/collection.js +3 -25
  96. package/dist/meeting-info/collection.js.map +1 -1
  97. package/dist/meeting-info/index.js +10 -33
  98. package/dist/meeting-info/index.js.map +1 -1
  99. package/dist/meeting-info/meeting-info-v2.js +179 -268
  100. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  101. package/dist/meeting-info/request.js +1 -16
  102. package/dist/meeting-info/request.js.map +1 -1
  103. package/dist/meeting-info/util.js +98 -183
  104. package/dist/meeting-info/util.js.map +1 -1
  105. package/dist/meeting-info/utilv2.js +137 -228
  106. package/dist/meeting-info/utilv2.js.map +1 -1
  107. package/dist/meetings/collection.js +3 -21
  108. package/dist/meetings/collection.js.map +1 -1
  109. package/dist/meetings/index.js +451 -570
  110. package/dist/meetings/index.js.map +1 -1
  111. package/dist/meetings/request.js +7 -30
  112. package/dist/meetings/request.js.map +1 -1
  113. package/dist/meetings/util.js +94 -148
  114. package/dist/meetings/util.js.map +1 -1
  115. package/dist/member/index.js +49 -89
  116. package/dist/member/index.js.map +1 -1
  117. package/dist/member/util.js +17 -68
  118. package/dist/member/util.js.map +1 -1
  119. package/dist/members/collection.js +2 -12
  120. package/dist/members/collection.js.map +1 -1
  121. package/dist/members/index.js +68 -184
  122. package/dist/members/index.js.map +1 -1
  123. package/dist/members/request.js +21 -56
  124. package/dist/members/request.js.map +1 -1
  125. package/dist/members/util.js +9 -38
  126. package/dist/members/util.js.map +1 -1
  127. package/dist/metrics/config.js +0 -2
  128. package/dist/metrics/config.js.map +1 -1
  129. package/dist/metrics/constants.js +1 -2
  130. package/dist/metrics/constants.js.map +1 -1
  131. package/dist/metrics/index.js +48 -136
  132. package/dist/metrics/index.js.map +1 -1
  133. package/dist/networkQualityMonitor/index.js +28 -57
  134. package/dist/networkQualityMonitor/index.js.map +1 -1
  135. package/dist/peer-connection-manager/index.js +60 -190
  136. package/dist/peer-connection-manager/index.js.map +1 -1
  137. package/dist/peer-connection-manager/util.js +10 -24
  138. package/dist/peer-connection-manager/util.js.map +1 -1
  139. package/dist/personal-meeting-room/index.js +10 -45
  140. package/dist/personal-meeting-room/index.js.map +1 -1
  141. package/dist/personal-meeting-room/request.js +2 -33
  142. package/dist/personal-meeting-room/request.js.map +1 -1
  143. package/dist/personal-meeting-room/util.js +0 -13
  144. package/dist/personal-meeting-room/util.js.map +1 -1
  145. package/dist/reachability/index.js +100 -166
  146. package/dist/reachability/index.js.map +1 -1
  147. package/dist/reachability/request.js +2 -18
  148. package/dist/reachability/request.js.map +1 -1
  149. package/dist/reactions/reactions.js +0 -2
  150. package/dist/reactions/reactions.js.map +1 -1
  151. package/dist/reactions/reactions.type.js +0 -5
  152. package/dist/reactions/reactions.type.js.map +1 -1
  153. package/dist/reconnection-manager/index.js +294 -468
  154. package/dist/reconnection-manager/index.js.map +1 -1
  155. package/dist/roap/collection.js +1 -12
  156. package/dist/roap/collection.js.map +1 -1
  157. package/dist/roap/handler.js +15 -85
  158. package/dist/roap/handler.js.map +1 -1
  159. package/dist/roap/index.js +42 -94
  160. package/dist/roap/index.js.map +1 -1
  161. package/dist/roap/request.js +81 -148
  162. package/dist/roap/request.js.map +1 -1
  163. package/dist/roap/state.js +2 -39
  164. package/dist/roap/state.js.map +1 -1
  165. package/dist/roap/turnDiscovery.js +8 -52
  166. package/dist/roap/turnDiscovery.js.map +1 -1
  167. package/dist/roap/util.js +0 -26
  168. package/dist/roap/util.js.map +1 -1
  169. package/dist/statsAnalyzer/global.js +0 -2
  170. package/dist/statsAnalyzer/global.js.map +1 -1
  171. package/dist/statsAnalyzer/index.js +68 -168
  172. package/dist/statsAnalyzer/index.js.map +1 -1
  173. package/dist/statsAnalyzer/mqaUtil.js +54 -53
  174. package/dist/statsAnalyzer/mqaUtil.js.map +1 -1
  175. package/dist/transcription/index.js +13 -45
  176. package/dist/transcription/index.js.map +1 -1
  177. package/internal-README.md +7 -6
  178. package/package.json +17 -17
  179. package/src/common/browser-detection.ts +9 -6
  180. package/src/common/collection.ts +3 -1
  181. package/src/common/errors/captcha-error.ts +6 -6
  182. package/src/common/errors/intent-to-join.ts +6 -6
  183. package/src/common/errors/join-meeting.ts +12 -8
  184. package/src/common/errors/media.ts +6 -6
  185. package/src/common/errors/parameter.ts +9 -6
  186. package/src/common/errors/password-error.ts +6 -6
  187. package/src/common/errors/permission.ts +5 -5
  188. package/src/common/errors/reconnection.ts +6 -6
  189. package/src/common/errors/stats.ts +6 -6
  190. package/src/common/errors/webex-errors.ts +7 -5
  191. package/src/common/errors/webex-meetings-error.ts +1 -1
  192. package/src/common/events/events-scope.ts +5 -1
  193. package/src/common/events/events.ts +5 -1
  194. package/src/common/events/trigger-proxy.ts +8 -3
  195. package/src/common/events/util.ts +1 -2
  196. package/src/common/logs/logger-proxy.ts +21 -10
  197. package/src/common/logs/request.ts +11 -8
  198. package/src/config.ts +11 -11
  199. package/src/constants.ts +138 -119
  200. package/src/index.js +1 -1
  201. package/src/locus-info/controlsUtils.ts +34 -24
  202. package/src/locus-info/fullState.ts +15 -11
  203. package/src/locus-info/hostUtils.ts +4 -3
  204. package/src/locus-info/index.ts +25 -34
  205. package/src/locus-info/infoUtils.ts +12 -4
  206. package/src/locus-info/mediaSharesUtils.ts +4 -4
  207. package/src/locus-info/parser.ts +45 -68
  208. package/src/locus-info/selfUtils.ts +106 -57
  209. package/src/media/index.ts +118 -109
  210. package/src/media/properties.ts +26 -20
  211. package/src/media/util.ts +2 -2
  212. package/src/mediaQualityMetrics/config.ts +46 -46
  213. package/src/meeting/effectsState.ts +35 -35
  214. package/src/meeting/in-meeting-actions.ts +7 -3
  215. package/src/meeting/index.ts +1435 -1210
  216. package/src/meeting/muteState.ts +62 -31
  217. package/src/meeting/request.ts +160 -113
  218. package/src/meeting/state.ts +45 -30
  219. package/src/meeting/util.ts +131 -90
  220. package/src/meeting-info/collection.ts +2 -1
  221. package/src/meeting-info/index.ts +32 -30
  222. package/src/meeting-info/meeting-info-v2.ts +106 -108
  223. package/src/meeting-info/request.ts +9 -3
  224. package/src/meeting-info/util.ts +54 -46
  225. package/src/meeting-info/utilv2.ts +59 -53
  226. package/src/meetings/collection.ts +1 -1
  227. package/src/meetings/index.ts +513 -441
  228. package/src/meetings/request.ts +26 -24
  229. package/src/meetings/util.ts +26 -23
  230. package/src/member/index.ts +55 -49
  231. package/src/member/util.ts +26 -13
  232. package/src/members/collection.ts +0 -1
  233. package/src/members/index.ts +172 -121
  234. package/src/members/request.ts +46 -14
  235. package/src/members/util.ts +44 -42
  236. package/src/metrics/config.ts +254 -81
  237. package/src/metrics/constants.ts +0 -2
  238. package/src/metrics/index.ts +84 -71
  239. package/src/networkQualityMonitor/index.ts +20 -23
  240. package/src/peer-connection-manager/index.ts +321 -241
  241. package/src/peer-connection-manager/util.ts +4 -2
  242. package/src/personal-meeting-room/index.ts +12 -16
  243. package/src/personal-meeting-room/request.ts +10 -3
  244. package/src/personal-meeting-room/util.ts +3 -3
  245. package/src/reachability/index.ts +61 -59
  246. package/src/reachability/request.ts +36 -32
  247. package/src/reactions/reactions.ts +4 -4
  248. package/src/reactions/reactions.type.ts +2 -3
  249. package/src/reconnection-manager/index.ts +159 -98
  250. package/src/roap/collection.ts +2 -4
  251. package/src/roap/handler.ts +63 -32
  252. package/src/roap/index.ts +78 -58
  253. package/src/roap/request.ts +69 -54
  254. package/src/roap/state.ts +17 -11
  255. package/src/roap/turnDiscovery.ts +60 -31
  256. package/src/roap/util.ts +39 -31
  257. package/src/statsAnalyzer/global.ts +30 -33
  258. package/src/statsAnalyzer/index.ts +397 -169
  259. package/src/statsAnalyzer/mqaUtil.ts +178 -72
  260. package/src/transcription/index.ts +34 -32
  261. package/test/integration/spec/journey.js +666 -462
  262. package/test/integration/spec/space-meeting.js +318 -203
  263. package/test/integration/spec/transcription.js +6 -7
  264. package/test/unit/spec/common/browser-detection.js +9 -28
  265. package/test/unit/spec/fixture/locus.js +92 -90
  266. package/test/unit/spec/locus-info/controlsUtils.js +5 -5
  267. package/test/unit/spec/locus-info/embeddedAppsUtils.js +8 -6
  268. package/test/unit/spec/locus-info/index.js +1 -2
  269. package/test/unit/spec/locus-info/infoUtils.js +24 -31
  270. package/test/unit/spec/locus-info/lib/BasicSeqCmp.json +88 -430
  271. package/test/unit/spec/locus-info/lib/SeqCmp.json +513 -685
  272. package/test/unit/spec/locus-info/parser.js +3 -9
  273. package/test/unit/spec/locus-info/selfConstant.js +72 -103
  274. package/test/unit/spec/locus-info/selfUtils.js +21 -12
  275. package/test/unit/spec/meeting/effectsState.js +33 -45
  276. package/test/unit/spec/meeting/in-meeting-actions.ts +2 -3
  277. package/test/unit/spec/meeting/index.js +1141 -649
  278. package/test/unit/spec/meeting/muteState.js +42 -33
  279. package/test/unit/spec/meeting/request.js +56 -45
  280. package/test/unit/spec/meeting/utils.js +66 -49
  281. package/test/unit/spec/meeting-info/meetinginfov2.js +100 -73
  282. package/test/unit/spec/meeting-info/request.js +7 -9
  283. package/test/unit/spec/meeting-info/util.js +11 -12
  284. package/test/unit/spec/meeting-info/utilv2.js +110 -74
  285. package/test/unit/spec/meetings/collection.js +1 -1
  286. package/test/unit/spec/meetings/index.js +438 -257
  287. package/test/unit/spec/meetings/utils.js +14 -12
  288. package/test/unit/spec/member/index.js +0 -1
  289. package/test/unit/spec/member/util.js +5 -6
  290. package/test/unit/spec/members/index.js +84 -35
  291. package/test/unit/spec/members/request.js +29 -20
  292. package/test/unit/spec/members/utils.js +8 -5
  293. package/test/unit/spec/metrics/index.js +16 -21
  294. package/test/unit/spec/networkQualityMonitor/index.js +21 -15
  295. package/test/unit/spec/peerconnection-manager/index.js +88 -58
  296. package/test/unit/spec/peerconnection-manager/utils.js +5 -4
  297. package/test/unit/spec/peerconnection-manager/utils.test-fixtures.ts +7 -8
  298. package/test/unit/spec/personal-meeting-room/personal-meeting-room.js +2 -7
  299. package/test/unit/spec/reachability/index.ts +9 -11
  300. package/test/unit/spec/reconnection-manager/index.js +14 -17
  301. package/test/unit/spec/roap/index.ts +18 -8
  302. package/test/unit/spec/roap/turnDiscovery.ts +22 -19
  303. package/test/unit/spec/roap/util.js +3 -3
  304. package/test/unit/spec/stats-analyzer/index.js +29 -24
  305. package/test/utils/cmr.js +44 -42
  306. package/test/utils/testUtils.js +83 -74
  307. package/test/utils/webex-config.js +18 -18
  308. package/test/utils/webex-test-users.js +53 -50
@@ -1,52 +1,33 @@
1
1
  "use strict";
2
2
 
3
3
  var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
4
-
5
4
  var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
6
-
7
5
  _Object$defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
-
11
8
  exports.default = void 0;
12
-
13
9
  var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
14
-
15
10
  var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
16
-
17
11
  var _values = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/values"));
18
-
19
12
  var _now = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/date/now"));
20
-
21
13
  var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
22
-
23
14
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
24
-
25
15
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/toConsumableArray"));
26
-
27
16
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
28
-
29
17
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
30
-
31
18
  var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
32
-
33
19
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
34
-
35
20
  var _uniq2 = _interopRequireDefault(require("lodash/uniq"));
36
-
37
21
  var _loggerProxy = _interopRequireDefault(require("../common/logs/logger-proxy"));
38
-
39
22
  var _constants = require("../constants");
40
-
41
23
  var _request = _interopRequireDefault(require("./request"));
42
-
43
24
  var DEFAULT_TIMEOUT = 3000;
44
25
  var VIDEO_MESH_TIMEOUT = 1000;
26
+
45
27
  /**
46
28
  * @class Reachability
47
29
  * @export
48
30
  */
49
-
50
31
  var Reachability = /*#__PURE__*/function () {
51
32
  /**
52
33
  * Creates an instance of Reachability.
@@ -59,6 +40,7 @@ var Reachability = /*#__PURE__*/function () {
59
40
  (0, _defineProperty2.default)(this, "reachabilityRequest", void 0);
60
41
  (0, _defineProperty2.default)(this, "clusterLatencyResults", void 0);
61
42
  this.webex = webex;
43
+
62
44
  /**
63
45
  * internal request object for the server
64
46
  * @instance
@@ -66,8 +48,8 @@ var Reachability = /*#__PURE__*/function () {
66
48
  * @private
67
49
  * @memberof Reachability
68
50
  */
69
-
70
51
  this.reachabilityRequest = new _request.default(this.webex);
52
+
71
53
  /**
72
54
  * internal object of clusters latency results
73
55
  * @instance
@@ -75,9 +57,9 @@ var Reachability = /*#__PURE__*/function () {
75
57
  * @private
76
58
  * @memberof Reachability
77
59
  */
78
-
79
60
  this.clusterLatencyResults = {};
80
61
  }
62
+
81
63
  /**
82
64
  * fetches reachability data
83
65
  * @returns {Object} reachability data
@@ -85,73 +67,55 @@ var Reachability = /*#__PURE__*/function () {
85
67
  * @async
86
68
  * @memberof Reachability
87
69
  */
88
-
89
-
90
70
  (0, _createClass2.default)(Reachability, [{
91
71
  key: "gatherReachability",
92
72
  value: function () {
93
73
  var _gatherReachability = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
94
74
  var _window, _window$localStorage;
95
-
96
75
  var clusters, results;
97
76
  return _regenerator.default.wrap(function _callee$(_context) {
98
- while (1) {
99
- switch (_context.prev = _context.next) {
100
- case 0:
101
- this.setup(); // Remove stored reachability results to ensure no stale data
102
-
103
- if (!((_window = window) !== null && _window !== void 0 && (_window$localStorage = _window.localStorage) !== null && _window$localStorage !== void 0 && _window$localStorage.removeItem)) {
104
- _context.next = 5;
105
- break;
106
- }
77
+ while (1) switch (_context.prev = _context.next) {
78
+ case 0:
79
+ this.setup();
107
80
 
108
- window.localStorage.removeItem(_constants.REACHABILITY.localStorage);
109
- _context.next = 7;
81
+ // Remove stored reachability results to ensure no stale data
82
+ if (!((_window = window) !== null && _window !== void 0 && (_window$localStorage = _window.localStorage) !== null && _window$localStorage !== void 0 && _window$localStorage.removeItem)) {
83
+ _context.next = 5;
110
84
  break;
111
-
112
- case 5:
113
- _loggerProxy.default.logger.error('Reachability:index#gatherReachability --> Error in accessing LocalStorage.');
114
-
115
- return _context.abrupt("return", {});
116
-
117
- case 7:
118
- _context.prev = 7;
119
- _context.next = 10;
120
- return this.reachabilityRequest.getClusters();
121
-
122
- case 10:
123
- clusters = _context.sent;
124
- _context.next = 13;
125
- return this.performReachabilityCheck(clusters);
126
-
127
- case 13:
128
- results = _context.sent;
129
- window.localStorage.setItem(_constants.REACHABILITY.localStorage, (0, _stringify.default)(results));
130
-
131
- _loggerProxy.default.logger.log('Reachability:index#gatherReachability --> Reachability checks completed');
132
-
133
- return _context.abrupt("return", results);
134
-
135
- case 19:
136
- _context.prev = 19;
137
- _context.t0 = _context["catch"](7);
138
-
139
- _loggerProxy.default.logger.error("Reachability:index#gatherReachability --> Error in calling getClusters(): ".concat(_context.t0));
140
-
141
- return _context.abrupt("return", {});
142
-
143
- case 23:
144
- case "end":
145
- return _context.stop();
146
- }
85
+ }
86
+ window.localStorage.removeItem(_constants.REACHABILITY.localStorage);
87
+ _context.next = 7;
88
+ break;
89
+ case 5:
90
+ _loggerProxy.default.logger.error('Reachability:index#gatherReachability --> Error in accessing LocalStorage.');
91
+ return _context.abrupt("return", {});
92
+ case 7:
93
+ _context.prev = 7;
94
+ _context.next = 10;
95
+ return this.reachabilityRequest.getClusters();
96
+ case 10:
97
+ clusters = _context.sent;
98
+ _context.next = 13;
99
+ return this.performReachabilityCheck(clusters);
100
+ case 13:
101
+ results = _context.sent;
102
+ window.localStorage.setItem(_constants.REACHABILITY.localStorage, (0, _stringify.default)(results));
103
+ _loggerProxy.default.logger.log('Reachability:index#gatherReachability --> Reachability checks completed');
104
+ return _context.abrupt("return", results);
105
+ case 19:
106
+ _context.prev = 19;
107
+ _context.t0 = _context["catch"](7);
108
+ _loggerProxy.default.logger.error("Reachability:index#gatherReachability --> Error in calling getClusters(): ".concat(_context.t0));
109
+ return _context.abrupt("return", {});
110
+ case 23:
111
+ case "end":
112
+ return _context.stop();
147
113
  }
148
114
  }, _callee, this, [[7, 19]]);
149
115
  }));
150
-
151
116
  function gatherReachability() {
152
117
  return _gatherReachability.apply(this, arguments);
153
118
  }
154
-
155
119
  return gatherReachability;
156
120
  }()
157
121
  /**
@@ -160,28 +124,25 @@ var Reachability = /*#__PURE__*/function () {
160
124
  * @public
161
125
  * @memberof Reachability
162
126
  */
163
-
164
127
  }, {
165
128
  key: "isAnyClusterReachable",
166
129
  value: function isAnyClusterReachable() {
167
130
  var reachable = false;
168
131
  var reachabilityData = window.localStorage.getItem(_constants.REACHABILITY.localStorage);
169
-
170
132
  if (reachabilityData) {
171
133
  try {
172
134
  var reachabilityResults = JSON.parse(reachabilityData);
173
135
  reachable = (0, _values.default)(reachabilityResults).some(function (result) {
174
136
  var _result$udp, _result$tcp;
175
-
176
137
  return ((_result$udp = result.udp) === null || _result$udp === void 0 ? void 0 : _result$udp.reachable) === 'true' || ((_result$tcp = result.tcp) === null || _result$tcp === void 0 ? void 0 : _result$tcp.reachable) === 'true';
177
138
  });
178
139
  } catch (e) {
179
140
  _loggerProxy.default.logger.error("Roap:request#attachReachabilityData --> Error in parsing reachability data: ".concat(e));
180
141
  }
181
142
  }
182
-
183
143
  return reachable;
184
144
  }
145
+
185
146
  /**
186
147
  * Generate peerConnection config settings
187
148
  * @param {object} cluster
@@ -189,7 +150,6 @@ var Reachability = /*#__PURE__*/function () {
189
150
  * @private
190
151
  * @memberof Reachability
191
152
  */
192
-
193
153
  }, {
194
154
  key: "buildPeerConnectionConfig",
195
155
  value: function buildPeerConnectionConfig(cluster) {
@@ -206,6 +166,7 @@ var Reachability = /*#__PURE__*/function () {
206
166
  iceTransportPolicy: 'all'
207
167
  };
208
168
  }
169
+
209
170
  /**
210
171
  * Creates an RTCPeerConnection
211
172
  * @param {object} cluster
@@ -213,24 +174,23 @@ var Reachability = /*#__PURE__*/function () {
213
174
  * @private
214
175
  * @memberof Reachability
215
176
  */
216
-
217
177
  }, {
218
178
  key: "createPeerConnection",
219
179
  value: function createPeerConnection(cluster) {
220
180
  var key = cluster.key,
221
- config = cluster.config;
222
-
181
+ config = cluster.config;
223
182
  try {
224
- var peerConnection = new window.RTCPeerConnection(config); // @ts-ignore
183
+ var peerConnection = new window.RTCPeerConnection(config);
225
184
 
185
+ // @ts-ignore
226
186
  peerConnection.key = key;
227
187
  return peerConnection;
228
188
  } catch (peerConnectionError) {
229
189
  _loggerProxy.default.logger.log("Reachability:index#createPeerConnection --> Error creating peerConnection: ".concat(peerConnectionError));
230
-
231
190
  return null;
232
191
  }
233
192
  }
193
+
234
194
  /**
235
195
  * Gets total elapsed time
236
196
  * @param {RTCPeerConnection} peerConnection
@@ -238,7 +198,6 @@ var Reachability = /*#__PURE__*/function () {
238
198
  * @private
239
199
  * @memberof Reachability
240
200
  */
241
-
242
201
  }, {
243
202
  key: "getElapsedTime",
244
203
  value: function getElapsedTime(peerConnection) {
@@ -246,6 +205,7 @@ var Reachability = /*#__PURE__*/function () {
246
205
  delete peerConnection.begin;
247
206
  return (0, _now.default)() - startTime;
248
207
  }
208
+
249
209
  /**
250
210
  * creates offer and generates localSDP
251
211
  * @param {object} clusterList cluster List
@@ -253,66 +213,59 @@ var Reachability = /*#__PURE__*/function () {
253
213
  * @private
254
214
  * @memberof Reachability
255
215
  */
256
-
257
216
  }, {
258
217
  key: "getLocalSDPForClusters",
259
218
  value: function getLocalSDPForClusters(clusterList) {
260
219
  var _this = this;
261
-
262
220
  var clusters = (0, _toConsumableArray2.default)((0, _keys.default)(clusterList));
263
221
  clusters = clusters.map( /*#__PURE__*/function () {
264
222
  var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(key) {
265
223
  var cluster, config, peerConnection, description;
266
224
  return _regenerator.default.wrap(function _callee2$(_context2) {
267
- while (1) {
268
- switch (_context2.prev = _context2.next) {
269
- case 0:
270
- cluster = clusterList[key];
271
- config = _this.buildPeerConnectionConfig(cluster);
272
- peerConnection = _this.createPeerConnection({
273
- key: key,
274
- config: config
275
- });
276
- _context2.next = 5;
277
- return peerConnection.createOffer({
278
- offerToReceiveAudio: true
279
- });
280
-
281
- case 5:
282
- description = _context2.sent;
283
- // @ts-ignore
284
- peerConnection.begin = (0, _now.default)();
285
- peerConnection.setLocalDescription(description);
286
- return _context2.abrupt("return", _this.iceGatheringState(peerConnection, cluster.isVideoMesh ? VIDEO_MESH_TIMEOUT : DEFAULT_TIMEOUT).catch(function (iceGatheringStateError) {
287
- _loggerProxy.default.logger.log("Reachability:index#getLocalSDPForClusters --> Error in getLocalSDP : ".concat(iceGatheringStateError));
288
- }));
289
-
290
- case 9:
291
- case "end":
292
- return _context2.stop();
293
- }
225
+ while (1) switch (_context2.prev = _context2.next) {
226
+ case 0:
227
+ cluster = clusterList[key];
228
+ config = _this.buildPeerConnectionConfig(cluster);
229
+ peerConnection = _this.createPeerConnection({
230
+ key: key,
231
+ config: config
232
+ });
233
+ _context2.next = 5;
234
+ return peerConnection.createOffer({
235
+ offerToReceiveAudio: true
236
+ });
237
+ case 5:
238
+ description = _context2.sent;
239
+ // @ts-ignore
240
+ peerConnection.begin = (0, _now.default)();
241
+ peerConnection.setLocalDescription(description);
242
+ return _context2.abrupt("return", _this.iceGatheringState(peerConnection, cluster.isVideoMesh ? VIDEO_MESH_TIMEOUT : DEFAULT_TIMEOUT).catch(function (iceGatheringStateError) {
243
+ _loggerProxy.default.logger.log("Reachability:index#getLocalSDPForClusters --> Error in getLocalSDP : ".concat(iceGatheringStateError));
244
+ }));
245
+ case 9:
246
+ case "end":
247
+ return _context2.stop();
294
248
  }
295
249
  }, _callee2);
296
250
  }));
297
-
298
251
  return function (_x) {
299
252
  return _ref.apply(this, arguments);
300
253
  };
301
254
  }());
302
255
  return _promise.default.all(clusters).then(this.parseIceResultsToReachabilityResults).then(function (reachabilityLatencyResults) {
303
- _this.logUnreachableClusters(); // return results
304
-
256
+ _this.logUnreachableClusters();
305
257
 
258
+ // return results
306
259
  return reachabilityLatencyResults;
307
260
  });
308
261
  }
262
+
309
263
  /**
310
264
  * Get list of all unreachable clusters
311
265
  * @returns {array} Unreachable clusters
312
266
  * @private
313
267
  * @memberof Reachability
314
268
  */
315
-
316
269
  }, {
317
270
  key: "getUnreachablClusters",
318
271
  value: function getUnreachablClusters() {
@@ -320,13 +273,13 @@ var Reachability = /*#__PURE__*/function () {
320
273
  var clusters = this.clusterLatencyResults;
321
274
  (0, _keys.default)(clusters).forEach(function (key) {
322
275
  var cluster = clusters[key];
323
-
324
276
  if (cluster.unreachable && !cluster.reachable) {
325
277
  unreachableList.push(key);
326
278
  }
327
279
  });
328
280
  return unreachableList;
329
281
  }
282
+
330
283
  /**
331
284
  * Attach an event handler for the icegatheringstatechange
332
285
  * event and measure latency.
@@ -335,25 +288,22 @@ var Reachability = /*#__PURE__*/function () {
335
288
  * @private
336
289
  * @memberof Reachability
337
290
  */
338
-
339
291
  }, {
340
292
  key: "handleIceGatheringStateChange",
341
293
  value: function handleIceGatheringStateChange(peerConnection) {
342
294
  var _this2 = this;
343
-
344
295
  peerConnection.onicegatheringstatechange = function () {
345
296
  var COMPLETE = _constants.ICE_GATHERING_STATE.COMPLETE;
346
-
347
297
  if (peerConnection.iceConnectionState === COMPLETE) {
348
- var elapsed = _this2.getElapsedTime(peerConnection); // @ts-ignore
349
-
298
+ var elapsed = _this2.getElapsedTime(peerConnection);
350
299
 
300
+ // @ts-ignore
351
301
  _loggerProxy.default.logger.log("Reachability:index#onIceGatheringStateChange --> Successfully pinged ".concat(peerConnection.key, ":"), elapsed);
352
-
353
302
  _this2.setLatencyAndClose(peerConnection, elapsed);
354
303
  }
355
304
  };
356
305
  }
306
+
357
307
  /**
358
308
  * Attach an event handler for the icecandidate
359
309
  * event and measure latency.
@@ -362,25 +312,22 @@ var Reachability = /*#__PURE__*/function () {
362
312
  * @private
363
313
  * @memberof Reachability
364
314
  */
365
-
366
315
  }, {
367
316
  key: "handleOnIceCandidate",
368
317
  value: function handleOnIceCandidate(peerConnection) {
369
318
  var _this3 = this;
370
-
371
319
  peerConnection.onicecandidate = function (e) {
372
320
  var SERVER_REFLEXIVE = 'srflx';
373
-
374
321
  if (e.candidate && String(e.candidate.type).toLowerCase() === SERVER_REFLEXIVE) {
375
- var elapsed = _this3.getElapsedTime(peerConnection); // @ts-ignore
376
-
322
+ var elapsed = _this3.getElapsedTime(peerConnection);
377
323
 
324
+ // @ts-ignore
378
325
  _loggerProxy.default.logger.log("Reachability:index#onIceCandidate --> Successfully pinged ".concat(peerConnection.key, ":"), elapsed);
379
-
380
326
  _this3.setLatencyAndClose(peerConnection, elapsed);
381
327
  }
382
328
  };
383
329
  }
330
+
384
331
  /**
385
332
  * An event handler on an RTCPeerConnection when the state of the ICE
386
333
  * candidate gathering process changes. Used to measure connection
@@ -390,22 +337,18 @@ var Reachability = /*#__PURE__*/function () {
390
337
  * @param {number} timeout
391
338
  * @returns {Promise}
392
339
  */
393
-
394
340
  }, {
395
341
  key: "iceGatheringState",
396
342
  value: function iceGatheringState(peerConnection, timeout) {
397
343
  var _this4 = this;
398
-
399
344
  var ELAPSED = 'elapsed';
400
345
  return new _promise.default(function (resolve) {
401
346
  var peerConnectionProxy = new window.Proxy(peerConnection, {
402
347
  get: function get(target, property) {
403
348
  var targetMember = target[property];
404
-
405
349
  if (typeof targetMember === 'function') {
406
350
  return targetMember.bind(target);
407
351
  }
408
-
409
352
  return targetMember;
410
353
  },
411
354
  set: function set(target, property, value) {
@@ -417,35 +360,36 @@ var Reachability = /*#__PURE__*/function () {
417
360
  elapsed: value
418
361
  });
419
362
  return true;
420
- } // pass thru
421
-
363
+ }
422
364
 
365
+ // pass thru
423
366
  return window.Reflect.set(target, property, value);
424
367
  }
425
- }); // Using peerConnection proxy so handle functions below
426
- // won't be coupled to our promise implementation
368
+ });
427
369
 
370
+ // Using peerConnection proxy so handle functions below
371
+ // won't be coupled to our promise implementation
428
372
  _this4.handleIceGatheringStateChange(peerConnectionProxy);
373
+ _this4.handleOnIceCandidate(peerConnectionProxy);
429
374
 
430
- _this4.handleOnIceCandidate(peerConnectionProxy); // Set maximum timeout
431
-
432
-
375
+ // Set maximum timeout
433
376
  window.setTimeout(function () {
434
- var CLOSED = _constants.CONNECTION_STATE.CLOSED; // Close any open peerConnections
377
+ var CLOSED = _constants.CONNECTION_STATE.CLOSED;
435
378
 
379
+ // Close any open peerConnections
436
380
  if (peerConnectionProxy.connectionState !== CLOSED) {
437
381
  _this4.setLatencyAndClose(peerConnectionProxy, null);
438
382
  }
439
383
  }, timeout);
440
384
  });
441
385
  }
386
+
442
387
  /**
443
388
  * Make a log of unreachable clusters.
444
389
  * @returns {undefined}
445
390
  * @private
446
391
  * @memberof Reachability
447
392
  */
448
-
449
393
  }, {
450
394
  key: "logUnreachableClusters",
451
395
  value: function logUnreachableClusters() {
@@ -454,6 +398,7 @@ var Reachability = /*#__PURE__*/function () {
454
398
  _loggerProxy.default.logger.log("Reachability:index#logUnreachableClusters --> No ice candidate for ".concat(cluster, "."));
455
399
  });
456
400
  }
401
+
457
402
  /**
458
403
  * Calculates time to establish connection
459
404
  * @param {array} iceResults iceResults
@@ -461,16 +406,14 @@ var Reachability = /*#__PURE__*/function () {
461
406
  * @private
462
407
  * @memberof Reachability
463
408
  */
464
-
465
409
  }, {
466
410
  key: "parseIceResultsToReachabilityResults",
467
411
  value: function parseIceResultsToReachabilityResults(iceResults) {
468
412
  var reachabilityMap = {};
469
413
  iceResults.forEach(function (_ref2) {
470
414
  var clusterId = _ref2.clusterId,
471
- elapsed = _ref2.elapsed;
415
+ elapsed = _ref2.elapsed;
472
416
  var latencyResult;
473
-
474
417
  if (elapsed === null) {
475
418
  latencyResult = {
476
419
  reachable: 'false'
@@ -481,7 +424,6 @@ var Reachability = /*#__PURE__*/function () {
481
424
  latencyInMilliseconds: elapsed.toString()
482
425
  };
483
426
  }
484
-
485
427
  reachabilityMap[clusterId] = {
486
428
  udp: latencyResult,
487
429
  tcp: latencyResult
@@ -489,6 +431,7 @@ var Reachability = /*#__PURE__*/function () {
489
431
  });
490
432
  return reachabilityMap;
491
433
  }
434
+
492
435
  /**
493
436
  * fetches reachability data
494
437
  * @param {object} clusterList
@@ -496,33 +439,29 @@ var Reachability = /*#__PURE__*/function () {
496
439
  * @private
497
440
  * @memberof Reachability
498
441
  */
499
-
500
442
  }, {
501
443
  key: "performReachabilityCheck",
502
444
  value: function performReachabilityCheck(clusterList) {
503
445
  var _this5 = this;
504
-
505
446
  if (!clusterList || !(0, _keys.default)(clusterList).length) {
506
447
  return _promise.default.resolve({});
507
448
  }
508
-
509
449
  return new _promise.default(function (resolve) {
510
450
  _this5.getLocalSDPForClusters(clusterList).then(function (localSDPData) {
511
451
  if (!localSDPData || !(0, _keys.default)(localSDPData).length) {
512
452
  // TODO: handle the error condition properly and try retry
513
453
  _loggerProxy.default.logger.log('Reachability:index#performReachabilityCheck --> Local SDP is empty or has missing elements..returning');
514
-
515
454
  resolve({});
516
455
  } else {
517
456
  resolve(localSDPData);
518
457
  }
519
458
  }).catch(function (error) {
520
459
  _loggerProxy.default.logger.error("Reachability:index#performReachabilityCheck --> Error in getLocalSDPForClusters: ".concat(error));
521
-
522
460
  resolve({});
523
461
  });
524
462
  });
525
463
  }
464
+
526
465
  /**
527
466
  * Records latency and closes the peerConnection
528
467
  * @param {RTCPeerConnection} peerConnection
@@ -531,42 +470,38 @@ var Reachability = /*#__PURE__*/function () {
531
470
  * @private
532
471
  * @memberof Reachability
533
472
  */
534
-
535
473
  }, {
536
474
  key: "setLatencyAndClose",
537
475
  value: function setLatencyAndClose(peerConnection, elapsed) {
538
476
  var _intialState;
539
-
540
477
  var REACHABLE = 'reachable';
541
478
  var UNREACHABLE = 'unreachable';
542
- var CLOSED = _constants.CONNECTION_STATE.CLOSED; // @ts-ignore
543
-
479
+ var CLOSED = _constants.CONNECTION_STATE.CLOSED;
480
+ // @ts-ignore
544
481
  var key = peerConnection.key;
545
482
  var resultKey = elapsed === null ? UNREACHABLE : REACHABLE;
546
483
  var intialState = (_intialState = {}, (0, _defineProperty2.default)(_intialState, REACHABLE, 0), (0, _defineProperty2.default)(_intialState, UNREACHABLE, 0), _intialState);
547
-
548
484
  if (peerConnection.connectionState === CLOSED) {
549
485
  _loggerProxy.default.logger.log("Reachability:index#setLatencyAndClose --> Attempting to set latency of ".concat(elapsed, " on closed peerConnection."));
550
-
551
486
  return;
552
487
  }
553
-
554
488
  this.clusterLatencyResults[key] = this.clusterLatencyResults[key] || intialState;
555
- this.clusterLatencyResults[key][resultKey] += 1; // Set to null in case this fired from
556
- // an event other than onIceCandidate
489
+ this.clusterLatencyResults[key][resultKey] += 1;
557
490
 
491
+ // Set to null in case this fired from
492
+ // an event other than onIceCandidate
558
493
  peerConnection.onicecandidate = null;
559
- peerConnection.close(); // @ts-ignore
560
-
494
+ peerConnection.close();
495
+ // @ts-ignore
561
496
  peerConnection.elapsed = elapsed;
562
497
  }
498
+
563
499
  /**
564
500
  * utility function
565
501
  * @returns {undefined}
566
502
  * @private
567
503
  * @memberof Reachability
568
504
  */
569
-
570
505
  }, {
571
506
  key: "setup",
572
507
  value: function setup() {
@@ -575,6 +510,5 @@ var Reachability = /*#__PURE__*/function () {
575
510
  }]);
576
511
  return Reachability;
577
512
  }();
578
-
579
513
  exports.default = Reachability;
580
514
  //# sourceMappingURL=index.js.map