@webex/calling 3.12.0-next.13 → 3.12.0-next.131

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 (291) hide show
  1. package/dist/CallRecording/CallRecording.js +160 -0
  2. package/dist/CallRecording/CallRecording.js.map +1 -0
  3. package/dist/CallRecording/CallRecording.test.js +257 -0
  4. package/dist/CallRecording/CallRecording.test.js.map +1 -0
  5. package/dist/CallRecording/WxcCallRecordingConnector.js +748 -0
  6. package/dist/CallRecording/WxcCallRecordingConnector.js.map +1 -0
  7. package/dist/CallRecording/WxcCallRecordingConnector.test.js +824 -0
  8. package/dist/CallRecording/WxcCallRecordingConnector.test.js.map +1 -0
  9. package/dist/CallRecording/callRecordingFixtures.js +266 -0
  10. package/dist/CallRecording/callRecordingFixtures.js.map +1 -0
  11. package/dist/CallRecording/constants.js +35 -0
  12. package/dist/CallRecording/constants.js.map +1 -0
  13. package/dist/CallRecording/types.js +142 -0
  14. package/dist/CallRecording/types.js.map +1 -0
  15. package/dist/CallRecording/userhub.js +117 -0
  16. package/dist/CallRecording/userhub.js.map +1 -0
  17. package/dist/CallRecording/utils.js +42 -0
  18. package/dist/CallRecording/utils.js.map +1 -0
  19. package/dist/CallRecording/utils.test.js +97 -0
  20. package/dist/CallRecording/utils.test.js.map +1 -0
  21. package/dist/CallingClient/CallingClient.js +469 -233
  22. package/dist/CallingClient/CallingClient.js.map +1 -1
  23. package/dist/CallingClient/CallingClient.test.js +736 -179
  24. package/dist/CallingClient/CallingClient.test.js.map +1 -1
  25. package/dist/CallingClient/calling/CallerId/index.js +3 -1
  26. package/dist/CallingClient/calling/CallerId/index.js.map +1 -1
  27. package/dist/CallingClient/calling/CallerId/index.test.js +12 -2
  28. package/dist/CallingClient/calling/CallerId/index.test.js.map +1 -1
  29. package/dist/CallingClient/calling/call.js +645 -458
  30. package/dist/CallingClient/calling/call.js.map +1 -1
  31. package/dist/CallingClient/calling/call.test.js +928 -498
  32. package/dist/CallingClient/calling/call.test.js.map +1 -1
  33. package/dist/CallingClient/calling/callManager.js +106 -35
  34. package/dist/CallingClient/calling/callManager.js.map +1 -1
  35. package/dist/CallingClient/calling/callManager.test.js +140 -0
  36. package/dist/CallingClient/calling/callManager.test.js.map +1 -1
  37. package/dist/CallingClient/calling/types.js +5 -0
  38. package/dist/CallingClient/calling/types.js.map +1 -1
  39. package/dist/CallingClient/constants.js +33 -3
  40. package/dist/CallingClient/constants.js.map +1 -1
  41. package/dist/CallingClient/line/index.js +27 -3
  42. package/dist/CallingClient/line/index.js.map +1 -1
  43. package/dist/CallingClient/line/line.test.js +102 -17
  44. package/dist/CallingClient/line/line.test.js.map +1 -1
  45. package/dist/CallingClient/registration/register.js +971 -506
  46. package/dist/CallingClient/registration/register.js.map +1 -1
  47. package/dist/CallingClient/registration/register.test.js +946 -61
  48. package/dist/CallingClient/registration/register.test.js.map +1 -1
  49. package/dist/CallingClient/registration/types.js +26 -0
  50. package/dist/CallingClient/registration/types.js.map +1 -1
  51. package/dist/CallingClient/registration/webWorker.js +41 -104
  52. package/dist/CallingClient/registration/webWorker.js.map +1 -1
  53. package/dist/CallingClient/registration/webWorker.test.js +39 -153
  54. package/dist/CallingClient/registration/webWorker.test.js.map +1 -1
  55. package/dist/CallingClient/registration/webWorkerStr.js +1 -1
  56. package/dist/CallingClient/registration/webWorkerStr.js.map +1 -1
  57. package/dist/CallingClient/types.js +7 -0
  58. package/dist/CallingClient/types.js.map +1 -1
  59. package/dist/CallingClient/utils/constants.js +58 -0
  60. package/dist/CallingClient/utils/constants.js.map +1 -0
  61. package/dist/CallingClient/utils/index.js +63 -0
  62. package/dist/CallingClient/utils/index.js.map +1 -0
  63. package/dist/CallingClient/utils/mobiusSocketMapper.js +122 -0
  64. package/dist/CallingClient/utils/mobiusSocketMapper.js.map +1 -0
  65. package/dist/CallingClient/utils/mobiusSocketMapper.test.js +221 -0
  66. package/dist/CallingClient/utils/mobiusSocketMapper.test.js.map +1 -0
  67. package/dist/CallingClient/utils/request.js +435 -0
  68. package/dist/CallingClient/utils/request.js.map +1 -0
  69. package/dist/CallingClient/utils/request.test.js +999 -0
  70. package/dist/CallingClient/utils/request.test.js.map +1 -0
  71. package/dist/CallingClient/utils/types.js +7 -0
  72. package/dist/CallingClient/utils/types.js.map +1 -0
  73. package/dist/CallingClient/utils/wsFeatureFlag.js +70 -0
  74. package/dist/CallingClient/utils/wsFeatureFlag.js.map +1 -0
  75. package/dist/CallingClient/utils/wsFeatureFlag.test.js +139 -0
  76. package/dist/CallingClient/utils/wsFeatureFlag.test.js.map +1 -0
  77. package/dist/Contacts/ContactsClient.js +13 -11
  78. package/dist/Contacts/ContactsClient.js.map +1 -1
  79. package/dist/Contacts/ContactsClient.test.js +3 -8
  80. package/dist/Contacts/ContactsClient.test.js.map +1 -1
  81. package/dist/Errors/types.js +2 -0
  82. package/dist/Errors/types.js.map +1 -1
  83. package/dist/Events/types.js +38 -1
  84. package/dist/Events/types.js.map +1 -1
  85. package/dist/Metrics/index.js +63 -2
  86. package/dist/Metrics/index.js.map +1 -1
  87. package/dist/Metrics/index.test.js +357 -1
  88. package/dist/Metrics/index.test.js.map +1 -1
  89. package/dist/Metrics/types.js +19 -1
  90. package/dist/Metrics/types.js.map +1 -1
  91. package/dist/SDKConnector/types.js.map +1 -1
  92. package/dist/api.js +56 -0
  93. package/dist/api.js.map +1 -1
  94. package/dist/common/Utils.js +252 -127
  95. package/dist/common/Utils.js.map +1 -1
  96. package/dist/common/Utils.test.js +493 -229
  97. package/dist/common/Utils.test.js.map +1 -1
  98. package/dist/common/callUtils.js +187 -0
  99. package/dist/common/callUtils.js.map +1 -0
  100. package/dist/common/callUtils.test.js +313 -0
  101. package/dist/common/callUtils.test.js.map +1 -0
  102. package/dist/common/constants.js +27 -1
  103. package/dist/common/constants.js.map +1 -1
  104. package/dist/common/index.js +11 -0
  105. package/dist/common/index.js.map +1 -1
  106. package/dist/common/testUtil.js +11 -5
  107. package/dist/common/testUtil.js.map +1 -1
  108. package/dist/common/types.js +3 -0
  109. package/dist/common/types.js.map +1 -1
  110. package/dist/index.js +171 -40
  111. package/dist/index.js.map +1 -1
  112. package/dist/mobius-socket/config.js +24 -0
  113. package/dist/mobius-socket/config.js.map +1 -0
  114. package/dist/mobius-socket/errors.js +143 -0
  115. package/dist/mobius-socket/errors.js.map +1 -0
  116. package/dist/mobius-socket/errors.test.js +20 -0
  117. package/dist/mobius-socket/errors.test.js.map +1 -0
  118. package/dist/mobius-socket/index.js +57 -0
  119. package/dist/mobius-socket/index.js.map +1 -0
  120. package/dist/mobius-socket/mobius-socket-events.test.js +493 -0
  121. package/dist/mobius-socket/mobius-socket-events.test.js.map +1 -0
  122. package/dist/mobius-socket/mobius-socket.js +849 -0
  123. package/dist/mobius-socket/mobius-socket.js.map +1 -0
  124. package/dist/mobius-socket/mobius-socket.test.js +1898 -0
  125. package/dist/mobius-socket/mobius-socket.test.js.map +1 -0
  126. package/dist/mobius-socket/socket/constants.js +55 -0
  127. package/dist/mobius-socket/socket/constants.js.map +1 -0
  128. package/dist/mobius-socket/socket/index.js +15 -0
  129. package/dist/mobius-socket/socket/index.js.map +1 -0
  130. package/dist/mobius-socket/socket/socket-base.js +614 -0
  131. package/dist/mobius-socket/socket/socket-base.js.map +1 -0
  132. package/dist/mobius-socket/socket/socket.js +19 -0
  133. package/dist/mobius-socket/socket/socket.js.map +1 -0
  134. package/dist/mobius-socket/socket/socket.shim.js +26 -0
  135. package/dist/mobius-socket/socket/socket.shim.js.map +1 -0
  136. package/dist/mobius-socket/socket/types.js +7 -0
  137. package/dist/mobius-socket/socket/types.js.map +1 -0
  138. package/dist/mobius-socket/socket.test.js +747 -0
  139. package/dist/mobius-socket/socket.test.js.map +1 -0
  140. package/dist/mobius-socket/test/mocha-helpers.js +23 -0
  141. package/dist/mobius-socket/test/mocha-helpers.js.map +1 -0
  142. package/dist/mobius-socket/test/promise-tick.js +28 -0
  143. package/dist/mobius-socket/test/promise-tick.js.map +1 -0
  144. package/dist/mobius-socket/types.js +7 -0
  145. package/dist/mobius-socket/types.js.map +1 -0
  146. package/dist/module/CallRecording/CallRecording.js +56 -0
  147. package/dist/module/CallRecording/WxcCallRecordingConnector.js +349 -0
  148. package/dist/module/CallRecording/callRecordingFixtures.js +231 -0
  149. package/dist/module/CallRecording/constants.js +27 -0
  150. package/dist/module/CallRecording/types.js +19 -0
  151. package/dist/module/CallRecording/userhub.js +100 -0
  152. package/dist/module/CallRecording/utils.js +14 -0
  153. package/dist/module/CallingClient/CallingClient.js +137 -20
  154. package/dist/module/CallingClient/calling/CallerId/index.js +2 -2
  155. package/dist/module/CallingClient/calling/call.js +207 -68
  156. package/dist/module/CallingClient/calling/callManager.js +51 -11
  157. package/dist/module/CallingClient/calling/types.js +2 -0
  158. package/dist/module/CallingClient/constants.js +28 -0
  159. package/dist/module/CallingClient/line/index.js +11 -3
  160. package/dist/module/CallingClient/registration/register.js +297 -68
  161. package/dist/module/CallingClient/registration/types.js +5 -1
  162. package/dist/module/CallingClient/registration/webWorker.js +42 -61
  163. package/dist/module/CallingClient/registration/webWorkerStr.js +47 -82
  164. package/dist/module/CallingClient/utils/constants.js +36 -0
  165. package/dist/module/CallingClient/utils/index.js +5 -0
  166. package/dist/module/CallingClient/utils/mobiusSocketMapper.js +72 -0
  167. package/dist/module/CallingClient/utils/request.js +211 -0
  168. package/dist/module/CallingClient/utils/types.js +1 -0
  169. package/dist/module/CallingClient/utils/wsFeatureFlag.js +41 -0
  170. package/dist/module/Contacts/ContactsClient.js +1 -1
  171. package/dist/module/Errors/types.js +2 -0
  172. package/dist/module/Events/types.js +23 -0
  173. package/dist/module/Metrics/index.js +48 -1
  174. package/dist/module/Metrics/types.js +18 -0
  175. package/dist/module/api.js +3 -2
  176. package/dist/module/common/Utils.js +103 -58
  177. package/dist/module/common/callUtils.js +90 -0
  178. package/dist/module/common/constants.js +11 -0
  179. package/dist/module/common/index.js +1 -0
  180. package/dist/module/common/testUtil.js +7 -1
  181. package/dist/module/common/types.js +3 -0
  182. package/dist/module/index.js +7 -3
  183. package/dist/module/mobius-socket/config.js +15 -0
  184. package/dist/module/mobius-socket/errors.js +58 -0
  185. package/dist/module/mobius-socket/index.js +24 -0
  186. package/dist/module/mobius-socket/mobius-socket.js +593 -0
  187. package/dist/module/mobius-socket/socket/constants.js +26 -0
  188. package/dist/module/mobius-socket/socket/index.js +4 -0
  189. package/dist/module/mobius-socket/socket/socket-base.js +376 -0
  190. package/dist/module/mobius-socket/socket/socket.js +9 -0
  191. package/dist/module/mobius-socket/socket/socket.shim.js +12 -0
  192. package/dist/module/mobius-socket/socket/types.js +1 -0
  193. package/dist/module/mobius-socket/types.js +1 -0
  194. package/dist/types/CallRecording/CallRecording.d.ts +18 -0
  195. package/dist/types/CallRecording/CallRecording.d.ts.map +1 -0
  196. package/dist/types/CallRecording/WxcCallRecordingConnector.d.ts +27 -0
  197. package/dist/types/CallRecording/WxcCallRecordingConnector.d.ts.map +1 -0
  198. package/dist/types/CallRecording/callRecordingFixtures.d.ts +152 -0
  199. package/dist/types/CallRecording/callRecordingFixtures.d.ts.map +1 -0
  200. package/dist/types/CallRecording/constants.d.ts +28 -0
  201. package/dist/types/CallRecording/constants.d.ts.map +1 -0
  202. package/dist/types/CallRecording/types.d.ts +184 -0
  203. package/dist/types/CallRecording/types.d.ts.map +1 -0
  204. package/dist/types/CallRecording/userhub.d.ts +44 -0
  205. package/dist/types/CallRecording/userhub.d.ts.map +1 -0
  206. package/dist/types/CallRecording/utils.d.ts +3 -0
  207. package/dist/types/CallRecording/utils.d.ts.map +1 -0
  208. package/dist/types/CallingClient/CallingClient.d.ts +8 -0
  209. package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
  210. package/dist/types/CallingClient/calling/CallerId/index.d.ts.map +1 -1
  211. package/dist/types/CallingClient/calling/call.d.ts +17 -3
  212. package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
  213. package/dist/types/CallingClient/calling/callManager.d.ts +8 -4
  214. package/dist/types/CallingClient/calling/callManager.d.ts.map +1 -1
  215. package/dist/types/CallingClient/calling/types.d.ts +38 -9
  216. package/dist/types/CallingClient/calling/types.d.ts.map +1 -1
  217. package/dist/types/CallingClient/constants.d.ts +28 -0
  218. package/dist/types/CallingClient/constants.d.ts.map +1 -1
  219. package/dist/types/CallingClient/line/index.d.ts +3 -2
  220. package/dist/types/CallingClient/line/index.d.ts.map +1 -1
  221. package/dist/types/CallingClient/registration/register.d.ts +9 -1
  222. package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
  223. package/dist/types/CallingClient/registration/types.d.ts +26 -2
  224. package/dist/types/CallingClient/registration/types.d.ts.map +1 -1
  225. package/dist/types/CallingClient/registration/webWorker.d.ts.map +1 -1
  226. package/dist/types/CallingClient/registration/webWorkerStr.d.ts +1 -1
  227. package/dist/types/CallingClient/registration/webWorkerStr.d.ts.map +1 -1
  228. package/dist/types/CallingClient/types.d.ts +6 -2
  229. package/dist/types/CallingClient/types.d.ts.map +1 -1
  230. package/dist/types/CallingClient/utils/constants.d.ts +35 -0
  231. package/dist/types/CallingClient/utils/constants.d.ts.map +1 -0
  232. package/dist/types/CallingClient/utils/index.d.ts +6 -0
  233. package/dist/types/CallingClient/utils/index.d.ts.map +1 -0
  234. package/dist/types/CallingClient/utils/mobiusSocketMapper.d.ts +5 -0
  235. package/dist/types/CallingClient/utils/mobiusSocketMapper.d.ts.map +1 -0
  236. package/dist/types/CallingClient/utils/request.d.ts +28 -0
  237. package/dist/types/CallingClient/utils/request.d.ts.map +1 -0
  238. package/dist/types/CallingClient/utils/types.d.ts +34 -0
  239. package/dist/types/CallingClient/utils/types.d.ts.map +1 -0
  240. package/dist/types/CallingClient/utils/wsFeatureFlag.d.ts +4 -0
  241. package/dist/types/CallingClient/utils/wsFeatureFlag.d.ts.map +1 -0
  242. package/dist/types/Errors/types.d.ts +2 -0
  243. package/dist/types/Errors/types.d.ts.map +1 -1
  244. package/dist/types/Events/types.d.ts +80 -6
  245. package/dist/types/Events/types.d.ts.map +1 -1
  246. package/dist/types/Metrics/index.d.ts.map +1 -1
  247. package/dist/types/Metrics/types.d.ts +19 -2
  248. package/dist/types/Metrics/types.d.ts.map +1 -1
  249. package/dist/types/SDKConnector/types.d.ts +40 -12
  250. package/dist/types/SDKConnector/types.d.ts.map +1 -1
  251. package/dist/types/api.d.ts +6 -4
  252. package/dist/types/api.d.ts.map +1 -1
  253. package/dist/types/common/Utils.d.ts +11 -5
  254. package/dist/types/common/Utils.d.ts.map +1 -1
  255. package/dist/types/common/callUtils.d.ts +6 -0
  256. package/dist/types/common/callUtils.d.ts.map +1 -0
  257. package/dist/types/common/constants.d.ts +6 -0
  258. package/dist/types/common/constants.d.ts.map +1 -1
  259. package/dist/types/common/index.d.ts +1 -0
  260. package/dist/types/common/index.d.ts.map +1 -1
  261. package/dist/types/common/testUtil.d.ts +6 -1
  262. package/dist/types/common/testUtil.d.ts.map +1 -1
  263. package/dist/types/common/types.d.ts +5 -1
  264. package/dist/types/common/types.d.ts.map +1 -1
  265. package/dist/types/index.d.ts +9 -4
  266. package/dist/types/index.d.ts.map +1 -1
  267. package/dist/types/mobius-socket/config.d.ts +17 -0
  268. package/dist/types/mobius-socket/config.d.ts.map +1 -0
  269. package/dist/types/mobius-socket/errors.d.ts +32 -0
  270. package/dist/types/mobius-socket/errors.d.ts.map +1 -0
  271. package/dist/types/mobius-socket/index.d.ts +14 -0
  272. package/dist/types/mobius-socket/index.d.ts.map +1 -0
  273. package/dist/types/mobius-socket/mobius-socket.d.ts +48 -0
  274. package/dist/types/mobius-socket/mobius-socket.d.ts.map +1 -0
  275. package/dist/types/mobius-socket/socket/constants.d.ts +27 -0
  276. package/dist/types/mobius-socket/socket/constants.d.ts.map +1 -0
  277. package/dist/types/mobius-socket/socket/index.d.ts +5 -0
  278. package/dist/types/mobius-socket/socket/index.d.ts.map +1 -0
  279. package/dist/types/mobius-socket/socket/socket-base.d.ts +43 -0
  280. package/dist/types/mobius-socket/socket/socket-base.d.ts.map +1 -0
  281. package/dist/types/mobius-socket/socket/socket.d.ts +6 -0
  282. package/dist/types/mobius-socket/socket/socket.d.ts.map +1 -0
  283. package/dist/types/mobius-socket/socket/socket.shim.d.ts +6 -0
  284. package/dist/types/mobius-socket/socket/socket.shim.d.ts.map +1 -0
  285. package/dist/types/mobius-socket/socket/types.d.ts +61 -0
  286. package/dist/types/mobius-socket/socket/types.d.ts.map +1 -0
  287. package/dist/types/mobius-socket/types.d.ts +21 -0
  288. package/dist/types/mobius-socket/types.d.ts.map +1 -0
  289. package/package.json +20 -7
  290. package/src/mobius-socket/socket/socket.shim.ts +22 -0
  291. package/src/mobius-socket/socket/socket.ts +14 -0
@@ -0,0 +1,614 @@
1
+ "use strict";
2
+
3
+ var _Reflect$construct = require("@babel/runtime-corejs2/core-js/reflect/construct");
4
+ var _Object$keys2 = require("@babel/runtime-corejs2/core-js/object/keys");
5
+ var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs2/core-js/object/get-own-property-symbols");
6
+ var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptor");
7
+ var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptors");
8
+ var _Object$defineProperties = require("@babel/runtime-corejs2/core-js/object/define-properties");
9
+ var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
10
+ var _Array$from = require("@babel/runtime-corejs2/core-js/array/from");
11
+ var _Symbol = require("@babel/runtime-corejs2/core-js/symbol");
12
+ var _Symbol$iterator = require("@babel/runtime-corejs2/core-js/symbol/iterator");
13
+ var _Array$isArray = require("@babel/runtime-corejs2/core-js/array/is-array");
14
+ var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
15
+ _Object$defineProperty(exports, "__esModule", {
16
+ value: true
17
+ });
18
+ exports.default = void 0;
19
+ var _weakMap = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/weak-map"));
20
+ var _map = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/map"));
21
+ var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
22
+ var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
23
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/reflect/define-property"));
24
+ var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
25
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
26
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
27
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/possibleConstructorReturn"));
28
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/getPrototypeOf"));
29
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/inherits"));
30
+ var _defineProperty3 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
31
+ var _isObject2 = _interopRequireDefault(require("lodash/isObject"));
32
+ var _has2 = _interopRequireDefault(require("lodash/has"));
33
+ var _defaults2 = _interopRequireDefault(require("lodash/defaults"));
34
+ var _events = require("events");
35
+ var _common = require("@webex/common");
36
+ var _commonTimers = require("@webex/common-timers");
37
+ var _errors = require("../errors");
38
+ var _constants = require("./constants");
39
+ var _Utils = require("../../common/Utils");
40
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof _Symbol && r[_Symbol$iterator] || r["@@iterator"]; if (!t) { if (_Array$isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
41
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? _Array$from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
42
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
43
+ function ownKeys(e, r) { var t = _Object$keys2(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
44
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty3.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
45
+ function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? _Reflect$construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
46
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /*!
47
+ * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
48
+ */ // @ts-ignore - type not available
49
+ // @ts-ignore - type not available
50
+ var sockets = new _weakMap.default();
51
+ function createTrackingId() {
52
+ return "webex-js-sdk_".concat(crypto.randomUUID());
53
+ }
54
+
55
+ /**
56
+ * Generalized socket abstraction
57
+ */
58
+ var Socket = exports.default = /*#__PURE__*/function (_EventEmitter) {
59
+ /**
60
+ * Creates a new Socket instance.
61
+ */
62
+ function Socket() {
63
+ var _this;
64
+ (0, _classCallCheck2.default)(this, Socket);
65
+ _this = _callSuper(this, Socket);
66
+ (0, _defineProperty3.default)(_this, "domain", void 0);
67
+ (0, _defineProperty3.default)(_this, "pendingResponses", void 0);
68
+ (0, _defineProperty3.default)(_this, "forceCloseDelay", void 0);
69
+ (0, _defineProperty3.default)(_this, "logger", void 0);
70
+ (0, _defineProperty3.default)(_this, "refreshToken", void 0);
71
+ (0, _defineProperty3.default)(_this, "token", void 0);
72
+ (0, _defineProperty3.default)(_this, "trackingId", void 0);
73
+ (0, _defineProperty3.default)(_this, "wssResponseTimeout", void 0);
74
+ _this.domain = 'unknown-domain';
75
+ _this.pendingResponses = new _map.default();
76
+ _this.onmessage = _this.onmessage.bind(_this);
77
+ _this.onclose = _this.onclose.bind(_this);
78
+ _this.setMaxListeners(10);
79
+ return _this;
80
+ }
81
+
82
+ // TODO: Circle back and check if we are using binaryType and related getters. If not, we can remove these.
83
+ /**
84
+ * Gets the binary type of the WebSocket connection.
85
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/WebSocket
86
+ */
87
+ (0, _inherits2.default)(Socket, _EventEmitter);
88
+ return (0, _createClass2.default)(Socket, [{
89
+ key: "binaryType",
90
+ get: function get() {
91
+ var _sockets$get;
92
+ return ((_sockets$get = sockets.get(this)) === null || _sockets$get === void 0 ? void 0 : _sockets$get.binaryType) || '';
93
+ }
94
+
95
+ /**
96
+ * Gets the number of bytes of data that have been queued but not yet transmitted.
97
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/WebSocket
98
+ */
99
+ }, {
100
+ key: "bufferedAmount",
101
+ get: function get() {
102
+ var _sockets$get2;
103
+ return ((_sockets$get2 = sockets.get(this)) === null || _sockets$get2 === void 0 ? void 0 : _sockets$get2.bufferedAmount) || 0;
104
+ }
105
+
106
+ /**
107
+ * Gets the extensions selected by the server.
108
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/WebSocket
109
+ */
110
+ }, {
111
+ key: "extensions",
112
+ get: function get() {
113
+ var _sockets$get3;
114
+ return ((_sockets$get3 = sockets.get(this)) === null || _sockets$get3 === void 0 ? void 0 : _sockets$get3.extensions) || '';
115
+ }
116
+
117
+ /**
118
+ * Gets the sub-protocol selected by the server.
119
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/WebSocket
120
+ */
121
+ }, {
122
+ key: "protocol",
123
+ get: function get() {
124
+ var _sockets$get4;
125
+ return ((_sockets$get4 = sockets.get(this)) === null || _sockets$get4 === void 0 ? void 0 : _sockets$get4.protocol) || '';
126
+ }
127
+
128
+ /**
129
+ * Gets the current state of the WebSocket connection.
130
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/WebSocket
131
+ */
132
+ }, {
133
+ key: "readyState",
134
+ get: function get() {
135
+ var _sockets$get5;
136
+ return ((_sockets$get5 = sockets.get(this)) === null || _sockets$get5 === void 0 ? void 0 : _sockets$get5.readyState) || 0;
137
+ }
138
+
139
+ /**
140
+ * Gets the URL of the WebSocket connection.
141
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/WebSocket
142
+ */
143
+ }, {
144
+ key: "url",
145
+ get: function get() {
146
+ var _sockets$get6;
147
+ return ((_sockets$get6 = sockets.get(this)) === null || _sockets$get6 === void 0 ? void 0 : _sockets$get6.url) || '';
148
+ }
149
+
150
+ /**
151
+ * Provides the environmentally appropriate WebSocket constructor.
152
+ *
153
+ * @returns The WebSocket constructor (ws in NodeJS, WebSocket in browsers)
154
+ */
155
+ }, {
156
+ key: "close",
157
+ value:
158
+ /**
159
+ * Closes the socket.
160
+ * @param options - Close options containing code and reason
161
+ * @returns Promise that resolves when the socket is closed
162
+ */
163
+ function close(options) {
164
+ var _this2 = this;
165
+ return new _promise.default(function (resolve, reject) {
166
+ var socket = sockets.get(_this2);
167
+ if (!socket) {
168
+ // Open has not been called yet so there is no socket to close
169
+ resolve();
170
+ return;
171
+ }
172
+ // logger is defined once open is called
173
+ _this2.logger.info("socket,".concat(_this2.domain, ": closing"));
174
+ if (socket.readyState === _constants.SOCKET_READY_STATE.CLOSING || socket.readyState === _constants.SOCKET_READY_STATE.CLOSED) {
175
+ _this2.logger.info("socket,".concat(_this2.domain, ": already closed"));
176
+ resolve();
177
+ return;
178
+ }
179
+ var originalCode = options === null || options === void 0 ? void 0 : options.code;
180
+ var originalReason = options === null || options === void 0 ? void 0 : options.reason;
181
+ var resolvedOptions = (0, _defaults2.default)(options || {}, {
182
+ code: 1000,
183
+ reason: 'Done'
184
+ });
185
+ if (resolvedOptions.code && resolvedOptions.code !== 1000 && (resolvedOptions.code < 3000 || resolvedOptions.code > 4999)) {
186
+ reject(new Error('`options.code` must be 1000 or between 3000 and 4999 (inclusive)'));
187
+ return;
188
+ }
189
+ var closeTimer = (0, _commonTimers.safeSetTimeout)(function () {
190
+ try {
191
+ _this2.logger.info("socket,".concat(_this2.domain, ": no close event received, forcing closure"));
192
+ resolve(_this2.onclose(originalCode ? {
193
+ code: originalCode,
194
+ reason: originalReason || 'Done (unknown)'
195
+ } : {
196
+ code: 1000,
197
+ reason: 'Done (forced)'
198
+ }));
199
+ } catch (error) {
200
+ _this2.logger.warn("socket,".concat(_this2.domain, ": force-close failed"), error);
201
+ }
202
+ }, _this2.forceCloseDelay);
203
+ socket.onclose = function (event) {
204
+ _this2.logger.info("socket,".concat(_this2.domain, ": close event fired"), event.code, event.reason);
205
+ clearTimeout(closeTimer);
206
+ _this2.onclose(event);
207
+ resolve(event);
208
+ };
209
+
210
+ // If socket is still connecting, manually trigger close handler with desired code
211
+ // because calling close() on a CONNECTING socket may not preserve custom codes
212
+ if (socket.readyState === _constants.SOCKET_READY_STATE.CONNECTING) {
213
+ _this2.logger.info("socket,".concat(_this2.domain, ": socket still connecting, triggering close manually"));
214
+ clearTimeout(closeTimer);
215
+ var closeEvent = {
216
+ code: resolvedOptions.code,
217
+ reason: resolvedOptions.reason
218
+ };
219
+ _this2.onclose(closeEvent);
220
+ resolve(closeEvent);
221
+ try {
222
+ socket.close(resolvedOptions.code, resolvedOptions.reason);
223
+ } catch (error) {
224
+ _this2.logger.info("socket,".concat(_this2.domain, ": error while closing CONNECTING socket, likely due to browser incompatibility with custom close codes"), error);
225
+ }
226
+ } else {
227
+ socket.close(resolvedOptions.code, resolvedOptions.reason);
228
+ }
229
+ });
230
+ }
231
+
232
+ /**
233
+ * Opens a WebSocket connection and performs authentication.
234
+ *
235
+ * @param url - WebSocket URL to connect to
236
+ * @param options - Socket connection options including token, logger, and timeout settings
237
+ * @returns Promise that resolves when socket is opened and authenticated
238
+ */
239
+ }, {
240
+ key: "open",
241
+ value: function open(url, options) {
242
+ var _this3 = this;
243
+ try {
244
+ this.domain = new URL(url).hostname;
245
+ } catch (_unused) {
246
+ this.domain = url;
247
+ }
248
+ return new _promise.default(function (resolve, reject) {
249
+ /* eslint complexity: [0] */
250
+ if (!url) {
251
+ reject(new Error('`url` is required'));
252
+ return;
253
+ }
254
+ if (sockets.get(_this3)) {
255
+ reject(new Error('Socket#open() can only be called once per instance'));
256
+ return;
257
+ }
258
+ var resolvedOptions = options || {};
259
+ (0, _common.checkRequired)(['forceCloseDelay', 'token', 'trackingId', 'logger'], resolvedOptions);
260
+
261
+ /* Guard: reject before WebSocket creation if the target host is not trusted (AC-2 / U-03) */
262
+ if (!(0, _Utils.isMobiusWssHostAllowed)(_this3.domain)) {
263
+ reject(new _errors.ConnectionError({
264
+ code: 4000,
265
+ reason: "Host ".concat(_this3.domain, " is not in the Mobius WSS trusted allowlist")
266
+ }));
267
+ return;
268
+ }
269
+ (0, _keys.default)(resolvedOptions).forEach(function (key) {
270
+ (0, _defineProperty2.default)(_this3, key, {
271
+ enumerable: false,
272
+ value: resolvedOptions[key]
273
+ });
274
+ });
275
+ var WebSocket = Socket.getWebSocketConstructor();
276
+ _this3.logger.info("socket,".concat(_this3.domain, ": creating WebSocket"));
277
+ var socket = new WebSocket(url, [], resolvedOptions);
278
+ socket.binaryType = 'arraybuffer';
279
+ socket.onmessage = _this3.onmessage;
280
+ socket.onclose = function (event) {
281
+ event = _this3.fixCloseCode(event);
282
+ _this3.logger.info("socket,".concat(_this3.domain, ": closed before open"), event.code, event.reason);
283
+ switch (event.code) {
284
+ case 1005:
285
+ // IE 11 doesn't seem to allow 4XXX codes, so if we get a 1005, assume
286
+ // it's a bad websocket url. That'll trigger a device refresh; if it
287
+ // turns out we had a bad token, the device refresh should 401 and
288
+ // trigger a token refresh.
289
+ return reject(new _errors.UnknownResponse(event));
290
+ case 4400:
291
+ return reject(new _errors.BadRequest(event));
292
+ case 4401:
293
+ return reject(new _errors.NotAuthorized(event));
294
+ case 4403:
295
+ return reject(new _errors.Forbidden(event));
296
+ default:
297
+ return reject(new _errors.ConnectionError(event));
298
+ }
299
+ };
300
+ socket.onopen = function () {
301
+ _this3.logger.info("socket,".concat(_this3.domain, ": connected"));
302
+ _this3.authorize(_this3.token).then(function () {
303
+ _this3.logger.info("socket,".concat(_this3.domain, ": authorized"));
304
+ socket.onclose = _this3.onclose;
305
+ resolve();
306
+ }).catch(reject);
307
+ };
308
+ socket.onerror = function (event) {
309
+ _this3.logger.warn("socket,".concat(_this3.domain, ": error event fired"), event);
310
+ };
311
+ sockets.set(_this3, socket);
312
+ _this3.logger.info("socket,".concat(_this3.domain, ": waiting for server"));
313
+ });
314
+ }
315
+
316
+ /**
317
+ * Handles incoming CloseEvents.
318
+ * @param event - The close event containing code and reason
319
+ */
320
+ }, {
321
+ key: "onclose",
322
+ value: function onclose(event) {
323
+ this.logger.info("socket,".concat(this.domain, ": closed"), event.code, event.reason);
324
+ event = this.fixCloseCode(event);
325
+ this.rejectPendingResponses(new _errors.ConnectionError(event));
326
+ this.emit('close', event);
327
+
328
+ // Remove all listeners to (a) avoid reacting to late pongs and (b) ensure
329
+ // we don't have a retain cycle.
330
+ this.removeAllListeners();
331
+ }
332
+
333
+ /**
334
+ * Handles incoming message events from the WebSocket.
335
+ * @param event - The message event containing the data
336
+ */
337
+ }, {
338
+ key: "onmessage",
339
+ value: function onmessage(event) {
340
+ var _this4 = this;
341
+ try {
342
+ var data = JSON.parse(event.data);
343
+ var processedEvent = {
344
+ data: data
345
+ };
346
+ if (data.type === 'async_event') {
347
+ this.acknowledge(processedEvent).catch(function (error) {
348
+ _this4.logger.warn("socket,".concat(_this4.domain, ": failed to acknowledge async event"), error);
349
+ });
350
+ }
351
+
352
+ // Match pending request/response promises before emitting the public message event.
353
+ // The message is still emitted afterward for any external listeners that care about it.
354
+ this.handlePendingResponse(data);
355
+ this.emit('message', processedEvent);
356
+ } catch (error) {
357
+ /* istanbul ignore next */
358
+ this.logger.warn("socket,".concat(this.domain, ": error while receiving WebSocket message"), error);
359
+ }
360
+ }
361
+
362
+ /**
363
+ * Sends a message up the socket.
364
+ * @param data - Data to send (string or object that will be JSON stringified)
365
+ * @returns Promise that resolves when the message is sent
366
+ */
367
+ }, {
368
+ key: "send",
369
+ value: function send(data) {
370
+ var _this5 = this;
371
+ return new _promise.default(function (resolve, reject) {
372
+ if (_this5.readyState !== _constants.SOCKET_READY_STATE.OPEN) {
373
+ reject(new Error('INVALID_STATE_ERROR'));
374
+ return;
375
+ }
376
+ if ((0, _isObject2.default)(data)) {
377
+ data = (0, _stringify.default)(data);
378
+ }
379
+ var socket = sockets.get(_this5);
380
+ if (!socket) {
381
+ reject(new Error('INVALID_STATE_ERROR'));
382
+ return;
383
+ }
384
+ socket.send(data);
385
+ resolve();
386
+ });
387
+ }
388
+
389
+ /**
390
+ * Sends a request and resolves when the matching response arrives.
391
+ *
392
+ * @param data - Request data to send over the socket
393
+ * @param options - Request options including timeout and error handlers
394
+ * @returns Promise that resolves with the response data
395
+ */
396
+ }, {
397
+ key: "sendRequest",
398
+ value: function sendRequest(data) {
399
+ var _this6 = this;
400
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
401
+ if (!(0, _isObject2.default)(data)) {
402
+ return _promise.default.reject(new Error('`data` is required'));
403
+ }
404
+ var request = _objectSpread({}, data);
405
+ var trackingId = request.trackingId || createTrackingId();
406
+ var timeout = options.timeout || this.wssResponseTimeout || 10000;
407
+ if (this.pendingResponses.has(trackingId)) {
408
+ return _promise.default.reject(new Error("socket request already sent for trackingId ".concat(trackingId)));
409
+ }
410
+ request.trackingId = trackingId;
411
+ return new _promise.default(function (_resolve, _reject) {
412
+ var timeoutId = (0, _commonTimers.safeSetTimeout)(function () {
413
+ _this6.clearPendingResponse(trackingId);
414
+ _reject((0, _errors.createTimeoutError)(request));
415
+ }, timeout);
416
+ var pendingResponse = {
417
+ request: request,
418
+ resolve: function resolve(response) {
419
+ _this6.clearPendingResponse(trackingId);
420
+ _resolve(response);
421
+ },
422
+ reject: function reject(error) {
423
+ _this6.clearPendingResponse(trackingId);
424
+ _reject(error);
425
+ },
426
+ timeoutId: timeoutId
427
+ };
428
+ _this6.pendingResponses.set(trackingId, pendingResponse);
429
+ _this6.send(request).catch(function (error) {
430
+ _this6.clearPendingResponse(trackingId);
431
+ _reject(error);
432
+ });
433
+ });
434
+ }
435
+
436
+ /**
437
+ * Sends an acknowledgment for a specific async event.
438
+ * @param event - Message event containing the async event to acknowledge
439
+ * @returns Promise that resolves when acknowledgment is sent
440
+ */
441
+ }, {
442
+ key: "acknowledge",
443
+ value: function acknowledge(event) {
444
+ if (!event) {
445
+ return _promise.default.reject(new Error('`event` is required'));
446
+ }
447
+ if (!(0, _has2.default)(event, 'data.eventId')) {
448
+ return _promise.default.reject(new Error('`event.data.eventId` is required'));
449
+ }
450
+
451
+ // Don't try to acknowledge if socket is not in open state
452
+ if (this.readyState !== _constants.SOCKET_READY_STATE.OPEN) {
453
+ return _promise.default.resolve();
454
+ }
455
+ return this.send({
456
+ type: _constants.MESSAGE_TYPES.EVENT_ACK,
457
+ trackingId: event.data.trackingId || createTrackingId(),
458
+ eventId: event.data.eventId
459
+ }).catch(function (error) {
460
+ if (error.message === 'INVALID_STATE_ERROR') {
461
+ return _promise.default.resolve();
462
+ }
463
+ throw error;
464
+ });
465
+ }
466
+ }, {
467
+ key: "refresh",
468
+ value: function refresh(token) {
469
+ if (!token) {
470
+ return _promise.default.reject(new Error('`token` is required for Socket#refresh()'));
471
+ }
472
+ var refreshedToken;
473
+ if (typeof token === 'string') {
474
+ refreshedToken = token;
475
+ } else if (token && typeof token.toString === 'function') {
476
+ refreshedToken = token.toString();
477
+ } else {
478
+ refreshedToken = String(token);
479
+ }
480
+ return this.authorize(refreshedToken);
481
+ }
482
+
483
+ /**
484
+ * Sends an auth message up the socket with a refreshed token.
485
+ * @param token - Authentication token to send
486
+ * @returns Promise that resolves when authentication succeeds
487
+ */
488
+ }, {
489
+ key: "authorize",
490
+ value: function authorize(token) {
491
+ this.logger.info("socket,".concat(this.domain, ": authorizing"));
492
+ return this.sendRequest({
493
+ type: _constants.MESSAGE_TYPES.AUTH,
494
+ data: {
495
+ token: token
496
+ }
497
+ });
498
+ }
499
+
500
+ /**
501
+ * Clears a pending response entry.
502
+ * @param trackingId - Tracking ID of the response to clear
503
+ */
504
+ }, {
505
+ key: "clearPendingResponse",
506
+ value: function clearPendingResponse(trackingId) {
507
+ var pendingResponse = this.pendingResponses.get(trackingId);
508
+ if (pendingResponse !== null && pendingResponse !== void 0 && pendingResponse.timeoutId) {
509
+ clearTimeout(pendingResponse.timeoutId);
510
+ }
511
+ this.pendingResponses.delete(trackingId);
512
+ }
513
+
514
+ /**
515
+ * Rejects all pending responses with the provided error.
516
+ * @param error - Error to reject pending responses with
517
+ */
518
+ }, {
519
+ key: "rejectPendingResponses",
520
+ value: function rejectPendingResponses(error) {
521
+ if (!this.pendingResponses.size) {
522
+ return;
523
+ }
524
+ var _iterator = _createForOfIteratorHelper(this.pendingResponses.values()),
525
+ _step;
526
+ try {
527
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
528
+ var pendingResponse = _step.value;
529
+ pendingResponse.reject(error);
530
+ }
531
+ } catch (err) {
532
+ _iterator.e(err);
533
+ } finally {
534
+ _iterator.f();
535
+ }
536
+ }
537
+
538
+ /**
539
+ * Handles incoming responses for pending requests.
540
+ * @param response - Response data to match against pending requests
541
+ * @returns True if a matching pending request was found and handled
542
+ */
543
+ }, {
544
+ key: "handlePendingResponse",
545
+ value: function handlePendingResponse(response) {
546
+ var _this7 = this;
547
+ if (!response) {
548
+ return false;
549
+ }
550
+
551
+ // Pending request correlation currently requires trackingId on the response.
552
+ var pendingResponse = this.pendingResponses.get(response.trackingId || '');
553
+ if (!pendingResponse) {
554
+ return false;
555
+ }
556
+ if (response.subtype !== pendingResponse.request.type) {
557
+ return false;
558
+ }
559
+ var statusCode = response === null || response === void 0 ? void 0 : response.statusCode;
560
+ var statusMessage = response === null || response === void 0 ? void 0 : response.statusMessage;
561
+ if (statusCode === 440 && (response === null || response === void 0 ? void 0 : response.subtype) !== _constants.MESSAGE_TYPES.AUTH) {
562
+ if (typeof this.refreshToken === 'function') {
563
+ _promise.default.resolve(this.refreshToken(response)).catch(function (error) {
564
+ _this7.logger.warn("socket,".concat(_this7.domain, ": failed token-expiry re-auth"), error);
565
+ });
566
+ } else {
567
+ this.logger.warn("socket,".concat(this.domain, ": refreshToken callback is unavailable for statusCode 440"));
568
+ }
569
+ }
570
+ if (statusCode === undefined) {
571
+ var error = (0, _errors.createWssResponseError)(response, statusCode, statusMessage || 'Socket response missing status code');
572
+ pendingResponse.reject(error);
573
+ } else if (statusCode >= 200 && statusCode < 300) {
574
+ pendingResponse.resolve(response);
575
+ } else {
576
+ pendingResponse.reject((0, _errors.createWssResponseError)(response, statusCode, statusMessage));
577
+ }
578
+ return true;
579
+ }
580
+
581
+ /**
582
+ * Deals with the fact that some browsers drop some close codes (but not close reasons).
583
+ *
584
+ * @param event - Close event to fix
585
+ * @returns Fixed close event with corrected code if necessary
586
+ */
587
+ }, {
588
+ key: "fixCloseCode",
589
+ value: function fixCloseCode(event) {
590
+ if (event.code === 1005 && event.reason) {
591
+ switch (event.reason.toLowerCase()) {
592
+ case 'replaced':
593
+ this.logger.info("socket,".concat(this.domain, ": fixing CloseEvent code for reason: "), event.reason);
594
+ event.code = 4000;
595
+ break;
596
+ case 'authentication failed':
597
+ case 'authentication did not happen within the timeout window of 30000 seconds.':
598
+ this.logger.info("socket,".concat(this.domain, ": fixing CloseEvent code for reason: "), event.reason);
599
+ event.code = 1008;
600
+ break;
601
+ default:
602
+ // do nothing
603
+ }
604
+ }
605
+ return event;
606
+ }
607
+ }], [{
608
+ key: "getWebSocketConstructor",
609
+ value: function getWebSocketConstructor() {
610
+ throw new Error('Socket.getWebSocketConstructor() must be implemented in an environmentally appropriate way');
611
+ }
612
+ }]);
613
+ }(_events.EventEmitter);
614
+ //# sourceMappingURL=socket-base.js.map