@webex/calling 3.0.0-next.4 → 3.0.0-next.40

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 (316) hide show
  1. package/CHANGELOG.md +1403 -1403
  2. package/README.md +74 -74
  3. package/dist/CallHistory/CallHistory.js +201 -0
  4. package/dist/CallHistory/CallHistory.js.map +1 -0
  5. package/dist/CallHistory/CallHistory.test.js +142 -0
  6. package/dist/CallHistory/CallHistory.test.js.map +1 -0
  7. package/dist/CallHistory/callHistoryFixtures.js +366 -0
  8. package/dist/CallHistory/callHistoryFixtures.js.map +1 -0
  9. package/dist/CallHistory/constants.js +17 -0
  10. package/dist/CallHistory/constants.js.map +1 -0
  11. package/dist/CallHistory/types.js +7 -0
  12. package/dist/CallHistory/types.js.map +1 -0
  13. package/dist/CallSettings/CallSettings.js +279 -0
  14. package/dist/CallSettings/CallSettings.js.map +1 -0
  15. package/dist/CallSettings/CallSettings.test.js +122 -0
  16. package/dist/CallSettings/CallSettings.test.js.map +1 -0
  17. package/dist/CallSettings/UcmBackendConnector.js +216 -0
  18. package/dist/CallSettings/UcmBackendConnector.js.map +1 -0
  19. package/dist/CallSettings/UcmBackendConnector.test.js +259 -0
  20. package/dist/CallSettings/UcmBackendConnector.test.js.map +1 -0
  21. package/dist/CallSettings/WxCallBackendConnector.js +547 -0
  22. package/dist/CallSettings/WxCallBackendConnector.js.map +1 -0
  23. package/dist/CallSettings/WxCallBackendConnector.test.js +802 -0
  24. package/dist/CallSettings/WxCallBackendConnector.test.js.map +1 -0
  25. package/dist/CallSettings/constants.js +19 -0
  26. package/dist/CallSettings/constants.js.map +1 -0
  27. package/dist/CallSettings/testFixtures.js +68 -0
  28. package/dist/CallSettings/testFixtures.js.map +1 -0
  29. package/dist/CallSettings/types.js +7 -0
  30. package/dist/CallSettings/types.js.map +1 -0
  31. package/dist/CallingClient/CallingClient.js +631 -0
  32. package/dist/CallingClient/CallingClient.js.map +1 -0
  33. package/dist/CallingClient/CallingClient.test.js +992 -0
  34. package/dist/CallingClient/CallingClient.test.js.map +1 -0
  35. package/dist/CallingClient/callRecordFixtures.js +101 -0
  36. package/dist/CallingClient/callRecordFixtures.js.map +1 -0
  37. package/dist/CallingClient/calling/CallerId/index.js +267 -0
  38. package/dist/CallingClient/calling/CallerId/index.js.map +1 -0
  39. package/dist/CallingClient/calling/CallerId/index.test.js +274 -0
  40. package/dist/CallingClient/calling/CallerId/index.test.js.map +1 -0
  41. package/dist/CallingClient/calling/CallerId/types.js +7 -0
  42. package/dist/CallingClient/calling/CallerId/types.js.map +1 -0
  43. package/dist/CallingClient/calling/call.js +3055 -0
  44. package/dist/CallingClient/calling/call.js.map +1 -0
  45. package/dist/CallingClient/calling/call.test.js +2858 -0
  46. package/dist/CallingClient/calling/call.test.js.map +1 -0
  47. package/dist/CallingClient/calling/callManager.js +432 -0
  48. package/dist/CallingClient/calling/callManager.js.map +1 -0
  49. package/dist/CallingClient/calling/callManager.test.js +683 -0
  50. package/dist/CallingClient/calling/callManager.test.js.map +1 -0
  51. package/dist/CallingClient/calling/index.js +30 -0
  52. package/dist/CallingClient/calling/index.js.map +1 -0
  53. package/dist/CallingClient/calling/types.js +69 -0
  54. package/dist/CallingClient/calling/types.js.map +1 -0
  55. package/dist/CallingClient/callingClientFixtures.js +143 -0
  56. package/dist/CallingClient/callingClientFixtures.js.map +1 -0
  57. package/dist/CallingClient/constants.js +134 -0
  58. package/dist/CallingClient/constants.js.map +1 -0
  59. package/dist/CallingClient/line/index.js +314 -0
  60. package/dist/CallingClient/line/index.js.map +1 -0
  61. package/dist/CallingClient/line/line.test.js +270 -0
  62. package/dist/CallingClient/line/line.test.js.map +1 -0
  63. package/dist/CallingClient/line/types.js +21 -0
  64. package/dist/CallingClient/line/types.js.map +1 -0
  65. package/dist/CallingClient/registration/index.js +19 -0
  66. package/dist/CallingClient/registration/index.js.map +1 -0
  67. package/dist/CallingClient/registration/register.js +1286 -0
  68. package/dist/CallingClient/registration/register.js.map +1 -0
  69. package/dist/CallingClient/registration/register.test.js +839 -0
  70. package/dist/CallingClient/registration/register.test.js.map +1 -0
  71. package/dist/CallingClient/registration/registerFixtures.js +36 -0
  72. package/dist/CallingClient/registration/registerFixtures.js.map +1 -0
  73. package/dist/CallingClient/registration/types.js +7 -0
  74. package/dist/CallingClient/registration/types.js.map +1 -0
  75. package/dist/CallingClient/types.js +7 -0
  76. package/dist/CallingClient/types.js.map +1 -0
  77. package/dist/Contacts/ContactsClient.js +1156 -0
  78. package/dist/Contacts/ContactsClient.js.map +1 -0
  79. package/dist/Contacts/ContactsClient.test.js +725 -0
  80. package/dist/Contacts/ContactsClient.test.js.map +1 -0
  81. package/dist/Contacts/constants.js +28 -0
  82. package/dist/Contacts/constants.js.map +1 -0
  83. package/dist/Contacts/contactFixtures.js +314 -0
  84. package/dist/Contacts/contactFixtures.js.map +1 -0
  85. package/dist/Contacts/types.js +43 -0
  86. package/dist/Contacts/types.js.map +1 -0
  87. package/dist/Errors/catalog/CallError.js +92 -0
  88. package/dist/Errors/catalog/CallError.js.map +1 -0
  89. package/dist/Errors/catalog/CallingDeviceError.js +86 -0
  90. package/dist/Errors/catalog/CallingDeviceError.js.map +1 -0
  91. package/dist/Errors/catalog/ExtendedError.js +44 -0
  92. package/dist/Errors/catalog/ExtendedError.js.map +1 -0
  93. package/dist/Errors/catalog/LineError.js +88 -0
  94. package/dist/Errors/catalog/LineError.js.map +1 -0
  95. package/dist/Errors/index.js +28 -0
  96. package/dist/Errors/index.js.map +1 -0
  97. package/dist/Errors/types.js +57 -0
  98. package/dist/Errors/types.js.map +1 -0
  99. package/dist/Events/impl/index.js +81 -0
  100. package/dist/Events/impl/index.js.map +1 -0
  101. package/dist/Events/types.js +103 -0
  102. package/dist/Events/types.js.map +1 -0
  103. package/dist/Logger/index.js +220 -0
  104. package/dist/Logger/index.js.map +1 -0
  105. package/dist/Logger/index.test.js +62 -0
  106. package/dist/Logger/index.test.js.map +1 -0
  107. package/dist/Logger/types.js +34 -0
  108. package/dist/Logger/types.js.map +1 -0
  109. package/dist/Metrics/index.js +327 -0
  110. package/dist/Metrics/index.js.map +1 -0
  111. package/dist/Metrics/index.test.js +291 -0
  112. package/dist/Metrics/index.test.js.map +1 -0
  113. package/dist/Metrics/types.js +45 -0
  114. package/dist/Metrics/types.js.map +1 -0
  115. package/dist/SDKConnector/index.js +104 -0
  116. package/dist/SDKConnector/index.js.map +1 -0
  117. package/dist/SDKConnector/index.test.js +9 -0
  118. package/dist/SDKConnector/index.test.js.map +1 -0
  119. package/dist/SDKConnector/types.js +7 -0
  120. package/dist/SDKConnector/types.js.map +1 -0
  121. package/dist/SDKConnector/utils.js +39 -0
  122. package/dist/SDKConnector/utils.js.map +1 -0
  123. package/dist/SDKConnector/utils.test.js +9 -0
  124. package/dist/SDKConnector/utils.test.js.map +1 -0
  125. package/dist/Voicemail/BroadworksBackendConnector.js +641 -0
  126. package/dist/Voicemail/BroadworksBackendConnector.js.map +1 -0
  127. package/dist/Voicemail/BroadworksBackendConnector.test.js +733 -0
  128. package/dist/Voicemail/BroadworksBackendConnector.test.js.map +1 -0
  129. package/dist/Voicemail/UcmBackendConnector.js +574 -0
  130. package/dist/Voicemail/UcmBackendConnector.js.map +1 -0
  131. package/dist/Voicemail/UcmBackendConnector.test.js +629 -0
  132. package/dist/Voicemail/UcmBackendConnector.test.js.map +1 -0
  133. package/dist/Voicemail/Voicemail.js +380 -0
  134. package/dist/Voicemail/Voicemail.js.map +1 -0
  135. package/dist/Voicemail/Voicemail.test.js +226 -0
  136. package/dist/Voicemail/Voicemail.test.js.map +1 -0
  137. package/dist/Voicemail/WxCallBackendConnector.js +547 -0
  138. package/dist/Voicemail/WxCallBackendConnector.js.map +1 -0
  139. package/dist/Voicemail/WxCallBackendConnector.test.js +942 -0
  140. package/dist/Voicemail/WxCallBackendConnector.test.js.map +1 -0
  141. package/dist/Voicemail/constants.js +37 -0
  142. package/dist/Voicemail/constants.js.map +1 -0
  143. package/dist/Voicemail/types.js +7 -0
  144. package/dist/Voicemail/types.js.map +1 -0
  145. package/dist/Voicemail/voicemailFixture.js +524 -0
  146. package/dist/Voicemail/voicemailFixture.js.map +1 -0
  147. package/dist/api.js +157 -0
  148. package/dist/api.js.map +1 -0
  149. package/dist/common/Utils.js +1257 -0
  150. package/dist/common/Utils.js.map +1 -0
  151. package/dist/common/Utils.test.js +1227 -0
  152. package/dist/common/Utils.test.js.map +1 -0
  153. package/dist/common/constants.js +49 -0
  154. package/dist/common/constants.js.map +1 -0
  155. package/dist/common/index.js +19 -0
  156. package/dist/common/index.js.map +1 -0
  157. package/dist/common/testUtil.js +959 -0
  158. package/dist/common/testUtil.js.map +1 -0
  159. package/dist/common/types.js +66 -0
  160. package/dist/common/types.js.map +1 -0
  161. package/dist/index.js +309 -0
  162. package/dist/index.js.map +1 -0
  163. package/dist/module/CallHistory/CallHistory.js +83 -81
  164. package/dist/module/CallHistory/callHistoryFixtures.js +366 -307
  165. package/dist/module/CallHistory/constants.js +9 -9
  166. package/dist/module/CallHistory/types.js +1 -1
  167. package/dist/module/CallSettings/CallSettings.js +65 -65
  168. package/dist/module/CallSettings/UcmBackendConnector.js +100 -100
  169. package/dist/module/CallSettings/WxCallBackendConnector.js +287 -287
  170. package/dist/module/CallSettings/constants.js +11 -11
  171. package/dist/module/CallSettings/testFixtures.js +62 -62
  172. package/dist/module/CallSettings/types.js +1 -1
  173. package/dist/module/CallingClient/CallingClient.js +265 -248
  174. package/dist/module/CallingClient/callRecordFixtures.js +93 -93
  175. package/dist/module/CallingClient/calling/CallerId/index.js +149 -169
  176. package/dist/module/CallingClient/calling/CallerId/types.js +1 -1
  177. package/dist/module/CallingClient/calling/call.js +1701 -1658
  178. package/dist/module/CallingClient/calling/callManager.js +278 -284
  179. package/dist/module/CallingClient/calling/index.js +2 -2
  180. package/dist/module/CallingClient/calling/types.js +53 -53
  181. package/dist/module/CallingClient/callingClientFixtures.js +156 -38
  182. package/dist/module/CallingClient/constants.js +126 -122
  183. package/dist/module/CallingClient/line/index.js +155 -158
  184. package/dist/module/CallingClient/line/types.js +10 -15
  185. package/dist/module/CallingClient/registration/index.js +1 -1
  186. package/dist/module/CallingClient/registration/register.js +515 -507
  187. package/dist/module/CallingClient/registration/registerFixtures.js +28 -28
  188. package/dist/module/CallingClient/registration/types.js +1 -1
  189. package/dist/module/CallingClient/types.js +1 -1
  190. package/dist/module/Contacts/ContactsClient.js +487 -484
  191. package/dist/module/Contacts/constants.js +20 -20
  192. package/dist/module/Contacts/contactFixtures.js +284 -284
  193. package/dist/module/Contacts/types.js +10 -10
  194. package/dist/module/Errors/catalog/CallError.js +26 -26
  195. package/dist/module/Errors/catalog/CallingDeviceError.js +18 -18
  196. package/dist/module/Errors/catalog/ExtendedError.js +10 -10
  197. package/dist/module/Errors/catalog/LineError.js +24 -24
  198. package/dist/module/Errors/index.js +3 -2
  199. package/dist/module/Errors/types.js +48 -48
  200. package/dist/module/Events/impl/index.js +19 -19
  201. package/dist/module/Events/types.js +85 -83
  202. package/dist/module/Logger/index.js +114 -114
  203. package/dist/module/Logger/types.js +25 -25
  204. package/dist/module/Metrics/index.js +232 -232
  205. package/dist/module/Metrics/types.js +37 -37
  206. package/dist/module/SDKConnector/index.js +39 -39
  207. package/dist/module/SDKConnector/types.js +1 -1
  208. package/dist/module/SDKConnector/utils.js +12 -12
  209. package/dist/module/Voicemail/BroadworksBackendConnector.js +291 -291
  210. package/dist/module/Voicemail/UcmBackendConnector.js +279 -279
  211. package/dist/module/Voicemail/Voicemail.js +110 -110
  212. package/dist/module/Voicemail/WxCallBackendConnector.js +279 -279
  213. package/dist/module/Voicemail/constants.js +29 -29
  214. package/dist/module/Voicemail/types.js +1 -1
  215. package/dist/module/Voicemail/voicemailFixture.js +510 -510
  216. package/dist/module/api.js +7 -6
  217. package/dist/module/common/Utils.js +797 -802
  218. package/dist/module/common/constants.js +41 -41
  219. package/dist/module/common/index.js +1 -1
  220. package/dist/module/common/testUtil.js +939 -938
  221. package/dist/module/common/types.js +58 -57
  222. package/dist/module/index.js +17 -8
  223. package/dist/types/CallHistory/CallHistory.d.ts +18 -17
  224. package/dist/types/CallHistory/CallHistory.d.ts.map +1 -1
  225. package/dist/types/CallHistory/callHistoryFixtures.d.ts +95 -94
  226. package/dist/types/CallHistory/callHistoryFixtures.d.ts.map +1 -1
  227. package/dist/types/CallHistory/constants.d.ts +9 -9
  228. package/dist/types/CallHistory/types.d.ts +18 -18
  229. package/dist/types/CallSettings/CallSettings.d.ts +19 -19
  230. package/dist/types/CallSettings/CallSettings.d.ts.map +1 -1
  231. package/dist/types/CallSettings/UcmBackendConnector.d.ts +19 -19
  232. package/dist/types/CallSettings/UcmBackendConnector.d.ts.map +1 -1
  233. package/dist/types/CallSettings/WxCallBackendConnector.d.ts +21 -21
  234. package/dist/types/CallSettings/constants.d.ts +11 -11
  235. package/dist/types/CallSettings/testFixtures.d.ts +15 -15
  236. package/dist/types/CallSettings/types.d.ts +108 -107
  237. package/dist/types/CallSettings/types.d.ts.map +1 -1
  238. package/dist/types/CallingClient/CallingClient.d.ts +37 -35
  239. package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
  240. package/dist/types/CallingClient/callRecordFixtures.d.ts +3 -3
  241. package/dist/types/CallingClient/calling/CallerId/index.d.ts +17 -17
  242. package/dist/types/CallingClient/calling/CallerId/index.d.ts.map +1 -1
  243. package/dist/types/CallingClient/calling/CallerId/types.d.ts +41 -41
  244. package/dist/types/CallingClient/calling/CallerId/types.d.ts.map +1 -1
  245. package/dist/types/CallingClient/calling/call.d.ts +98 -96
  246. package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
  247. package/dist/types/CallingClient/calling/callManager.d.ts +24 -25
  248. package/dist/types/CallingClient/calling/callManager.d.ts.map +1 -1
  249. package/dist/types/CallingClient/calling/index.d.ts +2 -2
  250. package/dist/types/CallingClient/calling/types.d.ts +206 -206
  251. package/dist/types/CallingClient/calling/types.d.ts.map +1 -1
  252. package/dist/types/CallingClient/callingClientFixtures.d.ts +86 -18
  253. package/dist/types/CallingClient/callingClientFixtures.d.ts.map +1 -1
  254. package/dist/types/CallingClient/constants.d.ts +126 -122
  255. package/dist/types/CallingClient/constants.d.ts.map +1 -1
  256. package/dist/types/CallingClient/line/index.d.ts +43 -43
  257. package/dist/types/CallingClient/line/index.d.ts.map +1 -1
  258. package/dist/types/CallingClient/line/types.d.ts +43 -55
  259. package/dist/types/CallingClient/line/types.d.ts.map +1 -1
  260. package/dist/types/CallingClient/registration/index.d.ts +1 -1
  261. package/dist/types/CallingClient/registration/register.d.ts +64 -64
  262. package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
  263. package/dist/types/CallingClient/registration/registerFixtures.d.ts +28 -28
  264. package/dist/types/CallingClient/registration/types.d.ts +20 -20
  265. package/dist/types/CallingClient/registration/types.d.ts.map +1 -1
  266. package/dist/types/CallingClient/types.d.ts +31 -29
  267. package/dist/types/CallingClient/types.d.ts.map +1 -1
  268. package/dist/types/Contacts/ContactsClient.d.ts +27 -26
  269. package/dist/types/Contacts/ContactsClient.d.ts.map +1 -1
  270. package/dist/types/Contacts/constants.d.ts +19 -19
  271. package/dist/types/Contacts/contactFixtures.d.ts +280 -280
  272. package/dist/types/Contacts/types.d.ts +74 -72
  273. package/dist/types/Contacts/types.d.ts.map +1 -1
  274. package/dist/types/Errors/catalog/CallError.d.ts +11 -11
  275. package/dist/types/Errors/catalog/CallingDeviceError.d.ts +10 -10
  276. package/dist/types/Errors/catalog/CallingDeviceError.d.ts.map +1 -1
  277. package/dist/types/Errors/catalog/ExtendedError.d.ts +6 -6
  278. package/dist/types/Errors/catalog/LineError.d.ts +10 -10
  279. package/dist/types/Errors/catalog/LineError.d.ts.map +1 -1
  280. package/dist/types/Errors/index.d.ts +3 -2
  281. package/dist/types/Errors/index.d.ts.map +1 -1
  282. package/dist/types/Errors/types.d.ts +59 -60
  283. package/dist/types/Errors/types.d.ts.map +1 -1
  284. package/dist/types/Events/impl/index.d.ts +8 -8
  285. package/dist/types/Events/types.d.ts +311 -288
  286. package/dist/types/Events/types.d.ts.map +1 -1
  287. package/dist/types/Logger/index.d.ts +12 -12
  288. package/dist/types/Logger/types.d.ts +25 -25
  289. package/dist/types/Metrics/index.d.ts +5 -5
  290. package/dist/types/Metrics/types.d.ts +42 -42
  291. package/dist/types/SDKConnector/index.d.ts +12 -12
  292. package/dist/types/SDKConnector/types.d.ts +129 -128
  293. package/dist/types/SDKConnector/types.d.ts.map +1 -1
  294. package/dist/types/SDKConnector/utils.d.ts +5 -5
  295. package/dist/types/Voicemail/BroadworksBackendConnector.d.ts +27 -27
  296. package/dist/types/Voicemail/UcmBackendConnector.d.ts +34 -34
  297. package/dist/types/Voicemail/Voicemail.d.ts +27 -27
  298. package/dist/types/Voicemail/Voicemail.d.ts.map +1 -1
  299. package/dist/types/Voicemail/WxCallBackendConnector.d.ts +23 -23
  300. package/dist/types/Voicemail/constants.d.ts +29 -29
  301. package/dist/types/Voicemail/types.d.ts +133 -133
  302. package/dist/types/Voicemail/types.d.ts.map +1 -1
  303. package/dist/types/Voicemail/voicemailFixture.d.ts +417 -417
  304. package/dist/types/api.d.ts +16 -16
  305. package/dist/types/api.d.ts.map +1 -1
  306. package/dist/types/common/Utils.d.ts +34 -34
  307. package/dist/types/common/Utils.d.ts.map +1 -1
  308. package/dist/types/common/constants.d.ts +41 -41
  309. package/dist/types/common/index.d.ts +1 -1
  310. package/dist/types/common/testUtil.d.ts +3612 -3611
  311. package/dist/types/common/testUtil.d.ts.map +1 -1
  312. package/dist/types/common/types.d.ts +192 -191
  313. package/dist/types/common/types.d.ts.map +1 -1
  314. package/dist/types/index.d.ts +21 -8
  315. package/dist/types/index.d.ts.map +1 -1
  316. package/package.json +5 -3
@@ -0,0 +1,327 @@
1
+ "use strict";
2
+
3
+ var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
4
+ var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
5
+ _Object$defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.getMetricManager = exports.default = void 0;
9
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
10
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
11
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
12
+ var _constants = require("../CallingClient/constants");
13
+ var _types = require("./types");
14
+ var _Logger = _interopRequireDefault(require("../Logger"));
15
+ var metricManager;
16
+
17
+ /**
18
+ *
19
+ */
20
+ var MetricManager = /*#__PURE__*/function () {
21
+ /**
22
+ * @param webex - Webex object used to send metrics.
23
+ * @param indicator - Service Indicator.
24
+ */
25
+ function MetricManager(webex, indicator) {
26
+ (0, _classCallCheck2.default)(this, MetricManager);
27
+ (0, _defineProperty2.default)(this, "webex", void 0);
28
+ (0, _defineProperty2.default)(this, "deviceInfo", void 0);
29
+ (0, _defineProperty2.default)(this, "serviceIndicator", void 0);
30
+ _Logger.default.info('Initializing metric manager...', {
31
+ file: _constants.METRIC_FILE
32
+ });
33
+ this.webex = webex;
34
+ this.serviceIndicator = indicator;
35
+ }
36
+
37
+ /**
38
+ * @param deviceInfo - DeviceInfo object.
39
+ */
40
+ (0, _createClass2.default)(MetricManager, [{
41
+ key: "setDeviceInfo",
42
+ value: function setDeviceInfo(deviceInfo) {
43
+ this.deviceInfo = deviceInfo;
44
+ }
45
+
46
+ /**
47
+ * @param name - Name of the metric being submitted.
48
+ * @param metricAction - Type of action sent in the metric.
49
+ * @param type - Type of metric.
50
+ * @param clientError - Error object used to populate error details in metric.
51
+ */
52
+ }, {
53
+ key: "submitRegistrationMetric",
54
+ value: function submitRegistrationMetric(name, metricAction, type, clientError) {
55
+ var data;
56
+ switch (name) {
57
+ case _types.METRIC_EVENT.REGISTRATION:
58
+ {
59
+ var _this$deviceInfo, _this$deviceInfo$devi, _this$deviceInfo2, _this$deviceInfo2$dev, _this$deviceInfo3, _this$deviceInfo3$dev;
60
+ data = {
61
+ tags: {
62
+ action: metricAction,
63
+ device_id: (_this$deviceInfo = this.deviceInfo) === null || _this$deviceInfo === void 0 ? void 0 : (_this$deviceInfo$devi = _this$deviceInfo.device) === null || _this$deviceInfo$devi === void 0 ? void 0 : _this$deviceInfo$devi.deviceId,
64
+ service_indicator: this.serviceIndicator
65
+ },
66
+ fields: {
67
+ device_url: (_this$deviceInfo2 = this.deviceInfo) === null || _this$deviceInfo2 === void 0 ? void 0 : (_this$deviceInfo2$dev = _this$deviceInfo2.device) === null || _this$deviceInfo2$dev === void 0 ? void 0 : _this$deviceInfo2$dev.clientDeviceUri,
68
+ mobius_url: (_this$deviceInfo3 = this.deviceInfo) === null || _this$deviceInfo3 === void 0 ? void 0 : (_this$deviceInfo3$dev = _this$deviceInfo3.device) === null || _this$deviceInfo3$dev === void 0 ? void 0 : _this$deviceInfo3$dev.uri,
69
+ calling_sdk_version: _constants.VERSION
70
+ },
71
+ type: type
72
+ };
73
+ break;
74
+ }
75
+ case _types.METRIC_EVENT.REGISTRATION_ERROR:
76
+ {
77
+ if (clientError) {
78
+ var _this$deviceInfo4, _this$deviceInfo4$dev, _this$deviceInfo5, _this$deviceInfo5$dev, _this$deviceInfo6, _this$deviceInfo6$dev;
79
+ data = {
80
+ tags: {
81
+ action: metricAction,
82
+ device_id: (_this$deviceInfo4 = this.deviceInfo) === null || _this$deviceInfo4 === void 0 ? void 0 : (_this$deviceInfo4$dev = _this$deviceInfo4.device) === null || _this$deviceInfo4$dev === void 0 ? void 0 : _this$deviceInfo4$dev.deviceId,
83
+ service_indicator: this.serviceIndicator
84
+ },
85
+ fields: {
86
+ device_url: (_this$deviceInfo5 = this.deviceInfo) === null || _this$deviceInfo5 === void 0 ? void 0 : (_this$deviceInfo5$dev = _this$deviceInfo5.device) === null || _this$deviceInfo5$dev === void 0 ? void 0 : _this$deviceInfo5$dev.clientDeviceUri,
87
+ mobius_url: (_this$deviceInfo6 = this.deviceInfo) === null || _this$deviceInfo6 === void 0 ? void 0 : (_this$deviceInfo6$dev = _this$deviceInfo6.device) === null || _this$deviceInfo6$dev === void 0 ? void 0 : _this$deviceInfo6$dev.uri,
88
+ calling_sdk_version: _constants.VERSION,
89
+ error: clientError.getError().message,
90
+ error_type: clientError.getError().type
91
+ },
92
+ type: type
93
+ };
94
+ }
95
+ break;
96
+ }
97
+ default:
98
+ _Logger.default.warn('Invalid metric name received. Rejecting request to submit metric.', {
99
+ file: _constants.METRIC_FILE,
100
+ method: this.submitRegistrationMetric.name
101
+ });
102
+ break;
103
+ }
104
+ if (data) {
105
+ this.webex.internal.metrics.submitClientMetrics(name, data);
106
+ }
107
+ }
108
+
109
+ /**
110
+ * @param name - Name of the metric being submitted.
111
+ * @param metricAction - Type of action sent in the metric.
112
+ * @param type - Type of metric.
113
+ * @param callId - Call ID of the call sending the metric.
114
+ * @param correlationId - Correlation ID of the call sending the metric.
115
+ * @param callError - Error object used to populate error details in metric.
116
+ */
117
+ }, {
118
+ key: "submitCallMetric",
119
+ value: function submitCallMetric(name, metricAction, type, callId, correlationId, callError) {
120
+ var data;
121
+ switch (name) {
122
+ case _types.METRIC_EVENT.CALL:
123
+ {
124
+ var _this$deviceInfo7, _this$deviceInfo7$dev, _this$deviceInfo8, _this$deviceInfo8$dev, _this$deviceInfo9, _this$deviceInfo9$dev;
125
+ data = {
126
+ tags: {
127
+ action: metricAction,
128
+ device_id: (_this$deviceInfo7 = this.deviceInfo) === null || _this$deviceInfo7 === void 0 ? void 0 : (_this$deviceInfo7$dev = _this$deviceInfo7.device) === null || _this$deviceInfo7$dev === void 0 ? void 0 : _this$deviceInfo7$dev.deviceId,
129
+ service_indicator: this.serviceIndicator
130
+ },
131
+ fields: {
132
+ device_url: (_this$deviceInfo8 = this.deviceInfo) === null || _this$deviceInfo8 === void 0 ? void 0 : (_this$deviceInfo8$dev = _this$deviceInfo8.device) === null || _this$deviceInfo8$dev === void 0 ? void 0 : _this$deviceInfo8$dev.clientDeviceUri,
133
+ mobius_url: (_this$deviceInfo9 = this.deviceInfo) === null || _this$deviceInfo9 === void 0 ? void 0 : (_this$deviceInfo9$dev = _this$deviceInfo9.device) === null || _this$deviceInfo9$dev === void 0 ? void 0 : _this$deviceInfo9$dev.uri,
134
+ calling_sdk_version: _constants.VERSION,
135
+ call_id: callId,
136
+ correlation_id: correlationId
137
+ },
138
+ type: type
139
+ };
140
+ break;
141
+ }
142
+ case _types.METRIC_EVENT.CALL_ERROR:
143
+ {
144
+ if (callError) {
145
+ var _this$deviceInfo10, _this$deviceInfo10$de, _this$deviceInfo11, _this$deviceInfo11$de, _this$deviceInfo12, _this$deviceInfo12$de;
146
+ data = {
147
+ tags: {
148
+ action: metricAction,
149
+ device_id: (_this$deviceInfo10 = this.deviceInfo) === null || _this$deviceInfo10 === void 0 ? void 0 : (_this$deviceInfo10$de = _this$deviceInfo10.device) === null || _this$deviceInfo10$de === void 0 ? void 0 : _this$deviceInfo10$de.deviceId,
150
+ service_indicator: this.serviceIndicator
151
+ },
152
+ fields: {
153
+ device_url: (_this$deviceInfo11 = this.deviceInfo) === null || _this$deviceInfo11 === void 0 ? void 0 : (_this$deviceInfo11$de = _this$deviceInfo11.device) === null || _this$deviceInfo11$de === void 0 ? void 0 : _this$deviceInfo11$de.clientDeviceUri,
154
+ mobius_url: (_this$deviceInfo12 = this.deviceInfo) === null || _this$deviceInfo12 === void 0 ? void 0 : (_this$deviceInfo12$de = _this$deviceInfo12.device) === null || _this$deviceInfo12$de === void 0 ? void 0 : _this$deviceInfo12$de.uri,
155
+ calling_sdk_version: _constants.VERSION,
156
+ call_id: callId,
157
+ correlation_id: correlationId,
158
+ error: callError.getCallError().message,
159
+ error_type: callError.getCallError().type
160
+ },
161
+ type: type
162
+ };
163
+ }
164
+ break;
165
+ }
166
+ default:
167
+ _Logger.default.warn('Invalid metric name received. Rejecting request to submit metric.', {
168
+ file: _constants.METRIC_FILE,
169
+ method: this.submitCallMetric.name
170
+ });
171
+ break;
172
+ }
173
+ if (data) {
174
+ this.webex.internal.metrics.submitClientMetrics(name, data);
175
+ }
176
+ }
177
+
178
+ /**
179
+ * @param name - Name of the metric being submitted.
180
+ * @param metricAction - Type of action sent in the metric.
181
+ * @param type - Type of metric.
182
+ * @param callId - Call ID of the call sending the metric.
183
+ * @param correlationId - Correlation ID of the call sending the metric.
184
+ * @param localSdp - Local SDP information for media metric.
185
+ * @param remoteSdp - Remote SDP information for media metric.
186
+ * @param callError - Error object used to populate error details in metric.
187
+ */
188
+ }, {
189
+ key: "submitMediaMetric",
190
+ value: function submitMediaMetric(name, metricAction, type, callId, correlationId, localSdp, remoteSdp, callError) {
191
+ var data;
192
+ switch (name) {
193
+ case _types.METRIC_EVENT.MEDIA:
194
+ {
195
+ var _this$deviceInfo13, _this$deviceInfo13$de, _this$deviceInfo14, _this$deviceInfo14$de, _this$deviceInfo15, _this$deviceInfo15$de;
196
+ data = {
197
+ tags: {
198
+ action: metricAction,
199
+ device_id: (_this$deviceInfo13 = this.deviceInfo) === null || _this$deviceInfo13 === void 0 ? void 0 : (_this$deviceInfo13$de = _this$deviceInfo13.device) === null || _this$deviceInfo13$de === void 0 ? void 0 : _this$deviceInfo13$de.deviceId,
200
+ service_indicator: this.serviceIndicator
201
+ },
202
+ fields: {
203
+ device_url: (_this$deviceInfo14 = this.deviceInfo) === null || _this$deviceInfo14 === void 0 ? void 0 : (_this$deviceInfo14$de = _this$deviceInfo14.device) === null || _this$deviceInfo14$de === void 0 ? void 0 : _this$deviceInfo14$de.clientDeviceUri,
204
+ mobius_url: (_this$deviceInfo15 = this.deviceInfo) === null || _this$deviceInfo15 === void 0 ? void 0 : (_this$deviceInfo15$de = _this$deviceInfo15.device) === null || _this$deviceInfo15$de === void 0 ? void 0 : _this$deviceInfo15$de.uri,
205
+ calling_sdk_version: _constants.VERSION,
206
+ call_id: callId,
207
+ correlation_id: correlationId,
208
+ local_media_details: localSdp,
209
+ remote_media_details: remoteSdp
210
+ },
211
+ type: type
212
+ };
213
+ break;
214
+ }
215
+ case _types.METRIC_EVENT.MEDIA_ERROR:
216
+ {
217
+ if (callError) {
218
+ var _this$deviceInfo16, _this$deviceInfo16$de, _this$deviceInfo17, _this$deviceInfo17$de, _this$deviceInfo18, _this$deviceInfo18$de;
219
+ data = {
220
+ tags: {
221
+ action: metricAction,
222
+ device_id: (_this$deviceInfo16 = this.deviceInfo) === null || _this$deviceInfo16 === void 0 ? void 0 : (_this$deviceInfo16$de = _this$deviceInfo16.device) === null || _this$deviceInfo16$de === void 0 ? void 0 : _this$deviceInfo16$de.deviceId,
223
+ service_indicator: this.serviceIndicator
224
+ },
225
+ fields: {
226
+ device_url: (_this$deviceInfo17 = this.deviceInfo) === null || _this$deviceInfo17 === void 0 ? void 0 : (_this$deviceInfo17$de = _this$deviceInfo17.device) === null || _this$deviceInfo17$de === void 0 ? void 0 : _this$deviceInfo17$de.clientDeviceUri,
227
+ mobius_url: (_this$deviceInfo18 = this.deviceInfo) === null || _this$deviceInfo18 === void 0 ? void 0 : (_this$deviceInfo18$de = _this$deviceInfo18.device) === null || _this$deviceInfo18$de === void 0 ? void 0 : _this$deviceInfo18$de.uri,
228
+ calling_sdk_version: _constants.VERSION,
229
+ call_id: callId,
230
+ correlation_id: correlationId,
231
+ local_media_details: localSdp,
232
+ remote_media_details: remoteSdp,
233
+ error: callError.getCallError().message,
234
+ error_type: callError.getCallError().type
235
+ },
236
+ type: type
237
+ };
238
+ }
239
+ break;
240
+ }
241
+ default:
242
+ _Logger.default.warn('Invalid metric name received. Rejecting request to submit metric.', {
243
+ file: _constants.METRIC_FILE,
244
+ method: this.submitMediaMetric.name
245
+ });
246
+ break;
247
+ }
248
+ if (data) {
249
+ this.webex.internal.metrics.submitClientMetrics(name, data);
250
+ }
251
+ }
252
+
253
+ /**
254
+ * @param name - Name of the metric being submitted.
255
+ * @param metricAction - Type of action sent in the metric.
256
+ * @param type - Type of metric.
257
+ * @param messageId - Message identifier of a Voicemail message.
258
+ * @param voicemailError - Error string used to populate error details in metric.
259
+ * @param statusCode - Status code used to populate error details in metric.
260
+ */
261
+ }, {
262
+ key: "submitVoicemailMetric",
263
+ value: function submitVoicemailMetric(name, metricAction, type, messageId, voicemailError, statusCode) {
264
+ var data;
265
+ switch (name) {
266
+ case _types.METRIC_EVENT.VOICEMAIL:
267
+ {
268
+ var _this$deviceInfo19, _this$deviceInfo19$de, _this$deviceInfo20, _this$deviceInfo20$de;
269
+ data = {
270
+ tags: {
271
+ action: metricAction,
272
+ device_id: (_this$deviceInfo19 = this.deviceInfo) === null || _this$deviceInfo19 === void 0 ? void 0 : (_this$deviceInfo19$de = _this$deviceInfo19.device) === null || _this$deviceInfo19$de === void 0 ? void 0 : _this$deviceInfo19$de.deviceId,
273
+ message_id: messageId
274
+ },
275
+ fields: {
276
+ device_url: (_this$deviceInfo20 = this.deviceInfo) === null || _this$deviceInfo20 === void 0 ? void 0 : (_this$deviceInfo20$de = _this$deviceInfo20.device) === null || _this$deviceInfo20$de === void 0 ? void 0 : _this$deviceInfo20$de.clientDeviceUri,
277
+ calling_sdk_version: _constants.VERSION
278
+ },
279
+ type: type
280
+ };
281
+ break;
282
+ }
283
+ case _types.METRIC_EVENT.VOICEMAIL_ERROR:
284
+ {
285
+ var _this$deviceInfo21, _this$deviceInfo21$de, _this$deviceInfo22, _this$deviceInfo22$de;
286
+ data = {
287
+ tags: {
288
+ action: metricAction,
289
+ device_id: (_this$deviceInfo21 = this.deviceInfo) === null || _this$deviceInfo21 === void 0 ? void 0 : (_this$deviceInfo21$de = _this$deviceInfo21.device) === null || _this$deviceInfo21$de === void 0 ? void 0 : _this$deviceInfo21$de.deviceId,
290
+ message_id: messageId,
291
+ error: voicemailError,
292
+ status_code: statusCode
293
+ },
294
+ fields: {
295
+ device_url: (_this$deviceInfo22 = this.deviceInfo) === null || _this$deviceInfo22 === void 0 ? void 0 : (_this$deviceInfo22$de = _this$deviceInfo22.device) === null || _this$deviceInfo22$de === void 0 ? void 0 : _this$deviceInfo22$de.clientDeviceUri,
296
+ calling_sdk_version: _constants.VERSION
297
+ },
298
+ type: type
299
+ };
300
+ break;
301
+ }
302
+ default:
303
+ _Logger.default.warn('Invalid metric name received. Rejecting request to submit metric.', {
304
+ file: _constants.METRIC_FILE,
305
+ method: this.submitVoicemailMetric.name
306
+ });
307
+ break;
308
+ }
309
+ if (data) {
310
+ this.webex.internal.metrics.submitClientMetrics(name, data);
311
+ }
312
+ }
313
+ }]);
314
+ return MetricManager;
315
+ }();
316
+ /**
317
+ * @param webex - Webex object to communicate with metrics microservice.
318
+ * @param indicator - Service Indicator.
319
+ */
320
+ var getMetricManager = exports.getMetricManager = function getMetricManager(webex, indicator) {
321
+ if (!metricManager) {
322
+ metricManager = new MetricManager(webex, indicator);
323
+ }
324
+ return metricManager;
325
+ };
326
+ var _default = exports.default = getMetricManager;
327
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_constants","require","_types","_Logger","_interopRequireDefault","metricManager","MetricManager","webex","indicator","_classCallCheck2","default","_defineProperty2","log","info","file","METRIC_FILE","serviceIndicator","_createClass2","key","value","setDeviceInfo","deviceInfo","submitRegistrationMetric","name","metricAction","type","clientError","data","METRIC_EVENT","REGISTRATION","_this$deviceInfo","_this$deviceInfo$devi","_this$deviceInfo2","_this$deviceInfo2$dev","_this$deviceInfo3","_this$deviceInfo3$dev","tags","action","device_id","device","deviceId","service_indicator","fields","device_url","clientDeviceUri","mobius_url","uri","calling_sdk_version","VERSION","REGISTRATION_ERROR","_this$deviceInfo4","_this$deviceInfo4$dev","_this$deviceInfo5","_this$deviceInfo5$dev","_this$deviceInfo6","_this$deviceInfo6$dev","error","getError","message","error_type","warn","method","internal","metrics","submitClientMetrics","submitCallMetric","callId","correlationId","callError","CALL","_this$deviceInfo7","_this$deviceInfo7$dev","_this$deviceInfo8","_this$deviceInfo8$dev","_this$deviceInfo9","_this$deviceInfo9$dev","call_id","correlation_id","CALL_ERROR","_this$deviceInfo10","_this$deviceInfo10$de","_this$deviceInfo11","_this$deviceInfo11$de","_this$deviceInfo12","_this$deviceInfo12$de","getCallError","submitMediaMetric","localSdp","remoteSdp","MEDIA","_this$deviceInfo13","_this$deviceInfo13$de","_this$deviceInfo14","_this$deviceInfo14$de","_this$deviceInfo15","_this$deviceInfo15$de","local_media_details","remote_media_details","MEDIA_ERROR","_this$deviceInfo16","_this$deviceInfo16$de","_this$deviceInfo17","_this$deviceInfo17$de","_this$deviceInfo18","_this$deviceInfo18$de","submitVoicemailMetric","messageId","voicemailError","statusCode","VOICEMAIL","_this$deviceInfo19","_this$deviceInfo19$de","_this$deviceInfo20","_this$deviceInfo20$de","message_id","VOICEMAIL_ERROR","_this$deviceInfo21","_this$deviceInfo21$de","_this$deviceInfo22","_this$deviceInfo22$de","status_code","getMetricManager","exports","_default"],"sources":["index.ts"],"sourcesContent":["import {CallError, CallingClientError} from '../Errors';\nimport {METRIC_FILE, VERSION} from '../CallingClient/constants';\nimport {CallId, CorrelationId, IDeviceInfo, ServiceIndicator} from '../common/types';\nimport {WebexSDK} from '../SDKConnector/types';\nimport {REG_ACTION, IMetricManager, METRIC_TYPE, METRIC_EVENT} from './types';\nimport {LineError} from '../Errors/catalog/LineError';\nimport log from '../Logger';\n\nlet metricManager: IMetricManager;\n\n/**\n *\n */\nclass MetricManager implements IMetricManager {\n private webex: WebexSDK;\n\n private deviceInfo?: IDeviceInfo;\n\n private serviceIndicator?: ServiceIndicator;\n\n /**\n * @param webex - Webex object used to send metrics.\n * @param indicator - Service Indicator.\n */\n public constructor(webex: WebexSDK, indicator?: ServiceIndicator) {\n log.info('Initializing metric manager...', {file: METRIC_FILE});\n this.webex = webex;\n this.serviceIndicator = indicator;\n }\n\n /**\n * @param deviceInfo - DeviceInfo object.\n */\n public setDeviceInfo(deviceInfo: IDeviceInfo) {\n this.deviceInfo = deviceInfo;\n }\n\n /**\n * @param name - Name of the metric being submitted.\n * @param metricAction - Type of action sent in the metric.\n * @param type - Type of metric.\n * @param clientError - Error object used to populate error details in metric.\n */\n public submitRegistrationMetric(\n name: METRIC_EVENT,\n metricAction: REG_ACTION,\n type: METRIC_TYPE,\n clientError: LineError | CallingClientError | undefined\n ) {\n let data;\n\n switch (name) {\n case METRIC_EVENT.REGISTRATION: {\n data = {\n tags: {\n action: metricAction,\n device_id: this.deviceInfo?.device?.deviceId,\n service_indicator: this.serviceIndicator,\n },\n fields: {\n device_url: this.deviceInfo?.device?.clientDeviceUri,\n mobius_url: this.deviceInfo?.device?.uri,\n calling_sdk_version: VERSION,\n },\n type,\n };\n break;\n }\n\n case METRIC_EVENT.REGISTRATION_ERROR: {\n if (clientError) {\n data = {\n tags: {\n action: metricAction,\n device_id: this.deviceInfo?.device?.deviceId,\n service_indicator: this.serviceIndicator,\n },\n fields: {\n device_url: this.deviceInfo?.device?.clientDeviceUri,\n mobius_url: this.deviceInfo?.device?.uri,\n calling_sdk_version: VERSION,\n error: clientError.getError().message,\n error_type: clientError.getError().type,\n },\n type,\n };\n }\n break;\n }\n\n default:\n log.warn('Invalid metric name received. Rejecting request to submit metric.', {\n file: METRIC_FILE,\n method: this.submitRegistrationMetric.name,\n });\n break;\n }\n\n if (data) {\n this.webex.internal.metrics.submitClientMetrics(name, data);\n }\n }\n\n /**\n * @param name - Name of the metric being submitted.\n * @param metricAction - Type of action sent in the metric.\n * @param type - Type of metric.\n * @param callId - Call ID of the call sending the metric.\n * @param correlationId - Correlation ID of the call sending the metric.\n * @param callError - Error object used to populate error details in metric.\n */\n public submitCallMetric(\n name: METRIC_EVENT,\n metricAction: string,\n type: METRIC_TYPE,\n callId: CallId,\n correlationId: CorrelationId,\n callError?: CallError\n ) {\n let data;\n\n switch (name) {\n case METRIC_EVENT.CALL: {\n data = {\n tags: {\n action: metricAction,\n device_id: this.deviceInfo?.device?.deviceId,\n service_indicator: this.serviceIndicator,\n },\n fields: {\n device_url: this.deviceInfo?.device?.clientDeviceUri,\n mobius_url: this.deviceInfo?.device?.uri,\n calling_sdk_version: VERSION,\n call_id: callId,\n correlation_id: correlationId,\n },\n type,\n };\n break;\n }\n\n case METRIC_EVENT.CALL_ERROR: {\n if (callError) {\n data = {\n tags: {\n action: metricAction,\n device_id: this.deviceInfo?.device?.deviceId,\n service_indicator: this.serviceIndicator,\n },\n fields: {\n device_url: this.deviceInfo?.device?.clientDeviceUri,\n mobius_url: this.deviceInfo?.device?.uri,\n calling_sdk_version: VERSION,\n call_id: callId,\n correlation_id: correlationId,\n error: callError.getCallError().message,\n error_type: callError.getCallError().type,\n },\n type,\n };\n }\n break;\n }\n\n default:\n log.warn('Invalid metric name received. Rejecting request to submit metric.', {\n file: METRIC_FILE,\n method: this.submitCallMetric.name,\n });\n break;\n }\n\n if (data) {\n this.webex.internal.metrics.submitClientMetrics(name, data);\n }\n }\n\n /**\n * @param name - Name of the metric being submitted.\n * @param metricAction - Type of action sent in the metric.\n * @param type - Type of metric.\n * @param callId - Call ID of the call sending the metric.\n * @param correlationId - Correlation ID of the call sending the metric.\n * @param localSdp - Local SDP information for media metric.\n * @param remoteSdp - Remote SDP information for media metric.\n * @param callError - Error object used to populate error details in metric.\n */\n public submitMediaMetric(\n name: METRIC_EVENT,\n metricAction: string,\n type: METRIC_TYPE,\n callId: CallId,\n correlationId: CorrelationId,\n localSdp?: string,\n remoteSdp?: string,\n callError?: CallError\n ) {\n let data;\n\n switch (name) {\n case METRIC_EVENT.MEDIA: {\n data = {\n tags: {\n action: metricAction,\n device_id: this.deviceInfo?.device?.deviceId,\n service_indicator: this.serviceIndicator,\n },\n fields: {\n device_url: this.deviceInfo?.device?.clientDeviceUri,\n mobius_url: this.deviceInfo?.device?.uri,\n calling_sdk_version: VERSION,\n call_id: callId,\n correlation_id: correlationId,\n local_media_details: localSdp,\n remote_media_details: remoteSdp,\n },\n type,\n };\n break;\n }\n\n case METRIC_EVENT.MEDIA_ERROR: {\n if (callError) {\n data = {\n tags: {\n action: metricAction,\n device_id: this.deviceInfo?.device?.deviceId,\n service_indicator: this.serviceIndicator,\n },\n fields: {\n device_url: this.deviceInfo?.device?.clientDeviceUri,\n mobius_url: this.deviceInfo?.device?.uri,\n calling_sdk_version: VERSION,\n call_id: callId,\n correlation_id: correlationId,\n local_media_details: localSdp,\n remote_media_details: remoteSdp,\n error: callError.getCallError().message,\n error_type: callError.getCallError().type,\n },\n type,\n };\n }\n break;\n }\n\n default:\n log.warn('Invalid metric name received. Rejecting request to submit metric.', {\n file: METRIC_FILE,\n method: this.submitMediaMetric.name,\n });\n break;\n }\n\n if (data) {\n this.webex.internal.metrics.submitClientMetrics(name, data);\n }\n }\n\n /**\n * @param name - Name of the metric being submitted.\n * @param metricAction - Type of action sent in the metric.\n * @param type - Type of metric.\n * @param messageId - Message identifier of a Voicemail message.\n * @param voicemailError - Error string used to populate error details in metric.\n * @param statusCode - Status code used to populate error details in metric.\n */\n public submitVoicemailMetric(\n name: METRIC_EVENT,\n metricAction: string,\n type: METRIC_TYPE,\n messageId?: string,\n voicemailError?: string,\n statusCode?: number\n ) {\n let data;\n\n switch (name) {\n case METRIC_EVENT.VOICEMAIL: {\n data = {\n tags: {\n action: metricAction,\n device_id: this.deviceInfo?.device?.deviceId,\n message_id: messageId,\n },\n fields: {\n device_url: this.deviceInfo?.device?.clientDeviceUri,\n calling_sdk_version: VERSION,\n },\n type,\n };\n break;\n }\n\n case METRIC_EVENT.VOICEMAIL_ERROR: {\n data = {\n tags: {\n action: metricAction,\n device_id: this.deviceInfo?.device?.deviceId,\n message_id: messageId,\n error: voicemailError,\n status_code: statusCode,\n },\n fields: {\n device_url: this.deviceInfo?.device?.clientDeviceUri,\n calling_sdk_version: VERSION,\n },\n type,\n };\n break;\n }\n\n default:\n log.warn('Invalid metric name received. Rejecting request to submit metric.', {\n file: METRIC_FILE,\n method: this.submitVoicemailMetric.name,\n });\n break;\n }\n if (data) {\n this.webex.internal.metrics.submitClientMetrics(name, data);\n }\n }\n}\n\n/**\n * @param webex - Webex object to communicate with metrics microservice.\n * @param indicator - Service Indicator.\n */\nexport const getMetricManager = (webex: WebexSDK, indicator?: ServiceIndicator): IMetricManager => {\n if (!metricManager) {\n metricManager = new MetricManager(webex, indicator);\n }\n\n return metricManager;\n};\n\nexport default getMetricManager;\n"],"mappings":";;;;;;;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AAGA,IAAAC,MAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAII,aAA6B;;AAEjC;AACA;AACA;AAFA,IAGMC,aAAa;EAOjB;AACF;AACA;AACA;EACE,SAAAA,cAAmBC,KAAe,EAAEC,SAA4B,EAAE;IAAA,IAAAC,gBAAA,CAAAC,OAAA,QAAAJ,aAAA;IAAA,IAAAK,gBAAA,CAAAD,OAAA;IAAA,IAAAC,gBAAA,CAAAD,OAAA;IAAA,IAAAC,gBAAA,CAAAD,OAAA;IAChEE,eAAG,CAACC,IAAI,CAAC,gCAAgC,EAAE;MAACC,IAAI,EAAEC;IAAW,CAAC,CAAC;IAC/D,IAAI,CAACR,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACS,gBAAgB,GAAGR,SAAS;EACnC;;EAEA;AACF;AACA;EAFE,IAAAS,aAAA,CAAAP,OAAA,EAAAJ,aAAA;IAAAY,GAAA;IAAAC,KAAA,EAGA,SAAAC,cAAqBC,UAAuB,EAAE;MAC5C,IAAI,CAACA,UAAU,GAAGA,UAAU;IAC9B;;IAEA;AACF;AACA;AACA;AACA;AACA;EALE;IAAAH,GAAA;IAAAC,KAAA,EAMA,SAAAG,yBACEC,IAAkB,EAClBC,YAAwB,EACxBC,IAAiB,EACjBC,WAAuD,EACvD;MACA,IAAIC,IAAI;MAER,QAAQJ,IAAI;QACV,KAAKK,mBAAY,CAACC,YAAY;UAAE;YAAA,IAAAC,gBAAA,EAAAC,qBAAA,EAAAC,iBAAA,EAAAC,qBAAA,EAAAC,iBAAA,EAAAC,qBAAA;YAC9BR,IAAI,GAAG;cACLS,IAAI,EAAE;gBACJC,MAAM,EAAEb,YAAY;gBACpBc,SAAS,GAAAR,gBAAA,GAAE,IAAI,CA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B8C,MAAM,EAAE,IAAI,CAAC4C,qBAAqB,CAAClF;UACrC,CAAC,CAAC;UACF;MACJ;MACA,IAAII,IAAI,EAAE;QACR,IAAI,CAACpB,KAAK,CAACuD,QAAQ,CAACC,OAAO,CAACC,mBAAmB,CAACzC,IAAI,EAAEI,IAAI,CAAC;MAC7D;IACF;EAAC;EAAA,OAAArB,aAAA;AAAA;AAGH;AACA;AACA;AACA;AACO,IAAMmH,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAG,SAAnBA,gBAAgBA,CAAIlH,KAAe,EAAEC,SAA4B,EAAqB;EACjG,IAAI,CAACH,aAAa,EAAE;IAClBA,aAAa,GAAG,IAAIC,aAAa,CAACC,KAAK,EAAEC,SAAS,CAAC;EACrD;EAEA,OAAOH,aAAa;AACtB,CAAC;AAAC,IAAAsH,QAAA,GAAAD,OAAA,CAAAhH,OAAA,GAEa+G,gBAAgB"}
@@ -0,0 +1,291 @@
1
+ "use strict";
2
+
3
+ var _Object$keys = require("@babel/runtime-corejs2/core-js/object/keys");
4
+ var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs2/core-js/object/get-own-property-symbols");
5
+ var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptor");
6
+ var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptors");
7
+ var _Object$defineProperties = require("@babel/runtime-corejs2/core-js/object/define-properties");
8
+ var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
9
+ var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
11
+ var _testUtil = require("../common/testUtil");
12
+ var _index = require("./index");
13
+ var _types = require("./types");
14
+ var _constants = require("../CallingClient/constants");
15
+ var _CallingDeviceError = require("../Errors/catalog/CallingDeviceError");
16
+ var _types2 = require("../Errors/types");
17
+ var _types3 = require("../common/types");
18
+ var _Logger = _interopRequireDefault(require("../Logger"));
19
+ var _CallError = require("../Errors/catalog/CallError");
20
+ function ownKeys(e, r) { var t = _Object$keys(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; }
21
+ 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, _defineProperty2.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; } /* eslint-disable dot-notation */
22
+ var webex = (0, _testUtil.getTestUtilsWebex)();
23
+ describe('CALLING: Metric tests', function () {
24
+ var metricManager = (0, _index.getMetricManager)(webex, _types3.ServiceIndicator.CALLING);
25
+ var mockDeviceInfo = (0, _testUtil.getMockDeviceInfo)();
26
+ var mockSubmitClientMetric = jest.fn();
27
+ webex.internal.metrics.submitClientMetrics = mockSubmitClientMetric;
28
+ var mockCallId = '123456';
29
+ var mockCorrelationId = '0931237';
30
+ var mockCallAction = 'S_SEND_CALL_SETUP';
31
+ var mockMediaAction = 'S_SEND_ROAP_OFFER';
32
+ beforeEach(function () {
33
+ mockSubmitClientMetric.mockClear();
34
+ });
35
+ it('initialize metric manager', function () {
36
+ expect(metricManager).not.toBeNull();
37
+ expect(metricManager['deviceInfo']).toBeUndefined();
38
+ });
39
+ it('update deviceInfo in metric manager', function () {
40
+ expect(metricManager['deviceInfo']).toBeUndefined();
41
+ metricManager.setDeviceInfo(mockDeviceInfo);
42
+ expect(metricManager['deviceInfo']).toEqual(mockDeviceInfo);
43
+ });
44
+ describe('CallingClient metric tests', function () {
45
+ it('submit registration success metric', function () {
46
+ metricManager.setDeviceInfo(mockDeviceInfo);
47
+ var expectedData = {
48
+ tags: {
49
+ action: _types.REG_ACTION.REGISTER,
50
+ device_id: mockDeviceInfo.device.deviceId,
51
+ service_indicator: _types3.ServiceIndicator.CALLING
52
+ },
53
+ fields: {
54
+ device_url: mockDeviceInfo.device.clientDeviceUri,
55
+ mobius_url: mockDeviceInfo.device.uri,
56
+ calling_sdk_version: _constants.VERSION
57
+ },
58
+ type: _types.METRIC_TYPE.BEHAVIORAL
59
+ };
60
+ metricManager.submitRegistrationMetric(_types.METRIC_EVENT.REGISTRATION, _types.REG_ACTION.REGISTER, _types.METRIC_TYPE.BEHAVIORAL);
61
+ expect(mockSubmitClientMetric).toBeCalledOnceWith(_types.METRIC_EVENT.REGISTRATION, expectedData);
62
+ });
63
+ it('submit registration failure metric', function () {
64
+ metricManager.setDeviceInfo(mockDeviceInfo);
65
+ var clientError = (0, _CallingDeviceError.createClientError)('', {}, _types2.ERROR_TYPE.DEFAULT, _types3.RegistrationStatus.INACTIVE);
66
+ var err = {};
67
+ err.context = {};
68
+ err.message = 'Unknown Error';
69
+ err.type = _types2.ERROR_TYPE.SERVICE_UNAVAILABLE;
70
+ clientError.setError(err);
71
+ var expectedData = {
72
+ tags: {
73
+ action: _types.REG_ACTION.REGISTER,
74
+ device_id: mockDeviceInfo.device.deviceId,
75
+ service_indicator: _types3.ServiceIndicator.CALLING
76
+ },
77
+ fields: {
78
+ device_url: mockDeviceInfo.device.clientDeviceUri,
79
+ mobius_url: mockDeviceInfo.device.uri,
80
+ calling_sdk_version: _constants.VERSION,
81
+ error: clientError.getError().message,
82
+ error_type: clientError.getError().type
83
+ },
84
+ type: _types.METRIC_TYPE.BEHAVIORAL
85
+ };
86
+ metricManager.submitRegistrationMetric(_types.METRIC_EVENT.REGISTRATION_ERROR, _types.REG_ACTION.REGISTER, _types.METRIC_TYPE.BEHAVIORAL, clientError);
87
+ expect(mockSubmitClientMetric).toBeCalledOnceWith(_types.METRIC_EVENT.REGISTRATION_ERROR, expectedData);
88
+ });
89
+ it('submit unknown registration metric', function () {
90
+ var logSpy = jest.spyOn(_Logger.default, 'warn');
91
+ metricManager.submitRegistrationMetric('invalidMetricName', _types.REG_ACTION.REGISTER, _types.METRIC_TYPE.OPERATIONAL);
92
+ expect(mockSubmitClientMetric).not.toBeCalled();
93
+ expect(logSpy).toBeCalledOnceWith('Invalid metric name received. Rejecting request to submit metric.', {
94
+ file: 'metric',
95
+ method: 'submitRegistrationMetric'
96
+ });
97
+ });
98
+ });
99
+ describe('Call Metric tests', function () {
100
+ beforeAll(function () {
101
+ metricManager.setDeviceInfo(mockDeviceInfo);
102
+ });
103
+ it('submit call success metric', function () {
104
+ var expectedData = {
105
+ tags: {
106
+ action: mockCallAction,
107
+ device_id: mockDeviceInfo.device.deviceId,
108
+ service_indicator: _types3.ServiceIndicator.CALLING
109
+ },
110
+ fields: {
111
+ device_url: mockDeviceInfo.device.clientDeviceUri,
112
+ mobius_url: mockDeviceInfo.device.uri,
113
+ calling_sdk_version: _constants.VERSION,
114
+ call_id: mockCallId,
115
+ correlation_id: mockCorrelationId
116
+ },
117
+ type: _types.METRIC_TYPE.BEHAVIORAL
118
+ };
119
+ metricManager.submitCallMetric(_types.METRIC_EVENT.CALL, mockCallAction, _types.METRIC_TYPE.BEHAVIORAL, mockCallId, mockCorrelationId);
120
+ expect(mockSubmitClientMetric).toBeCalledOnceWith(_types.METRIC_EVENT.CALL, expectedData);
121
+ });
122
+ it('submit call failure metric', function () {
123
+ var callError = (0, _CallError.createCallError)('', {}, _types2.ERROR_TYPE.DEFAULT, mockCorrelationId, _types2.ERROR_LAYER.CALL_CONTROL);
124
+ var err = {};
125
+ err.context = {};
126
+ err.message = 'An invalid status update has been received for the call. Wait a moment and try again.';
127
+ err.type = _types2.ERROR_TYPE.FORBIDDEN_ERROR;
128
+ callError.setCallError(err);
129
+ var expectedData = {
130
+ tags: {
131
+ action: mockCallAction,
132
+ device_id: mockDeviceInfo.device.deviceId,
133
+ service_indicator: _types3.ServiceIndicator.CALLING
134
+ },
135
+ fields: {
136
+ device_url: mockDeviceInfo.device.clientDeviceUri,
137
+ mobius_url: mockDeviceInfo.device.uri,
138
+ calling_sdk_version: _constants.VERSION,
139
+ call_id: mockCallId,
140
+ correlation_id: mockCorrelationId,
141
+ error: callError.getCallError().message,
142
+ error_type: callError.getCallError().type
143
+ },
144
+ type: _types.METRIC_TYPE.BEHAVIORAL
145
+ };
146
+ metricManager.submitCallMetric(_types.METRIC_EVENT.CALL_ERROR, mockCallAction, _types.METRIC_TYPE.BEHAVIORAL, mockCallId, mockCorrelationId, callError);
147
+ expect(mockSubmitClientMetric).toBeCalledOnceWith(_types.METRIC_EVENT.CALL_ERROR, expectedData);
148
+ });
149
+ it('submit unknown call metric', function () {
150
+ var logSpy = jest.spyOn(_Logger.default, 'warn');
151
+ metricManager.submitCallMetric('invalidMetricName', mockCallAction, _types.METRIC_TYPE.OPERATIONAL, mockCallId, mockCorrelationId);
152
+ expect(mockSubmitClientMetric).not.toBeCalled();
153
+ expect(logSpy).toBeCalledOnceWith('Invalid metric name received. Rejecting request to submit metric.', {
154
+ file: 'metric',
155
+ method: 'submitCallMetric'
156
+ });
157
+ });
158
+ });
159
+ describe('Media Metric tests', function () {
160
+ var mockSdp = 'sdpInformation';
161
+ beforeAll(function () {
162
+ metricManager.setDeviceInfo(mockDeviceInfo);
163
+ });
164
+ it('submit media success metric', function () {
165
+ var expectedData = {
166
+ tags: {
167
+ action: mockMediaAction,
168
+ device_id: mockDeviceInfo.device.deviceId,
169
+ service_indicator: _types3.ServiceIndicator.CALLING
170
+ },
171
+ fields: {
172
+ device_url: mockDeviceInfo.device.clientDeviceUri,
173
+ mobius_url: mockDeviceInfo.device.uri,
174
+ calling_sdk_version: _constants.VERSION,
175
+ call_id: mockCallId,
176
+ correlation_id: mockCorrelationId,
177
+ local_media_details: mockSdp,
178
+ remote_media_details: mockSdp
179
+ },
180
+ type: _types.METRIC_TYPE.BEHAVIORAL
181
+ };
182
+ metricManager.submitMediaMetric(_types.METRIC_EVENT.MEDIA, mockMediaAction, _types.METRIC_TYPE.BEHAVIORAL, mockCallId, mockCorrelationId, mockSdp, mockSdp);
183
+ expect(mockSubmitClientMetric).toBeCalledOnceWith(_types.METRIC_EVENT.MEDIA, expectedData);
184
+ });
185
+ it('submit media failure metric', function () {
186
+ var callError = (0, _CallError.createCallError)('', {}, _types2.ERROR_TYPE.DEFAULT, mockCorrelationId, _types2.ERROR_LAYER.MEDIA);
187
+ var err = {};
188
+ err.context = {};
189
+ err.message = 'An error occurred while parsing the provided information. Wait a moment and try again.';
190
+ err.type = _types2.ERROR_TYPE.SERVICE_UNAVAILABLE;
191
+ callError.setCallError(err);
192
+ var expectedData = {
193
+ tags: {
194
+ action: mockMediaAction,
195
+ device_id: mockDeviceInfo.device.deviceId,
196
+ service_indicator: _types3.ServiceIndicator.CALLING
197
+ },
198
+ fields: {
199
+ device_url: mockDeviceInfo.device.clientDeviceUri,
200
+ mobius_url: mockDeviceInfo.device.uri,
201
+ calling_sdk_version: _constants.VERSION,
202
+ call_id: mockCallId,
203
+ correlation_id: mockCorrelationId,
204
+ local_media_details: mockSdp,
205
+ remote_media_details: mockSdp,
206
+ error: callError.getCallError().message,
207
+ error_type: callError.getCallError().type
208
+ },
209
+ type: _types.METRIC_TYPE.BEHAVIORAL
210
+ };
211
+ metricManager.submitMediaMetric(_types.METRIC_EVENT.MEDIA_ERROR, mockMediaAction, _types.METRIC_TYPE.BEHAVIORAL, mockCallId, mockCorrelationId, mockSdp, mockSdp, callError);
212
+ expect(mockSubmitClientMetric).toBeCalledOnceWith(_types.METRIC_EVENT.MEDIA_ERROR, expectedData);
213
+ });
214
+ it('submit unknown media metric', function () {
215
+ var logSpy = jest.spyOn(_Logger.default, 'warn');
216
+ metricManager.submitMediaMetric('invalidMetricName', mockMediaAction, _types.METRIC_TYPE.OPERATIONAL, mockCallId, mockCorrelationId, mockSdp, mockSdp);
217
+ expect(mockSubmitClientMetric).not.toBeCalled();
218
+ expect(logSpy).toBeCalledOnceWith('Invalid metric name received. Rejecting request to submit metric.', {
219
+ file: 'metric',
220
+ method: 'submitMediaMetric'
221
+ });
222
+ });
223
+ });
224
+ describe('Voicemail metric tests', function () {
225
+ beforeAll(function () {
226
+ return metricManager.setDeviceInfo(mockDeviceInfo);
227
+ });
228
+ it('submit voicemail success metric', function () {
229
+ var expectedData1 = {
230
+ tags: {
231
+ action: _types.VOICEMAIL_ACTION.GET_VOICEMAILS,
232
+ device_id: mockDeviceInfo.device.deviceId
233
+ },
234
+ fields: {
235
+ device_url: mockDeviceInfo.device.clientDeviceUri,
236
+ calling_sdk_version: _constants.VERSION
237
+ },
238
+ type: _types.METRIC_TYPE.BEHAVIORAL
239
+ };
240
+ metricManager.submitVoicemailMetric(_types.METRIC_EVENT.VOICEMAIL, _types.VOICEMAIL_ACTION.GET_VOICEMAILS, _types.METRIC_TYPE.BEHAVIORAL);
241
+ expect(mockSubmitClientMetric).toBeCalledOnceWith(_types.METRIC_EVENT.VOICEMAIL, expectedData1);
242
+ mockSubmitClientMetric.mockClear();
243
+ var expectedData2 = _objectSpread(_objectSpread({}, expectedData1), {}, {
244
+ tags: _objectSpread(_objectSpread({}, expectedData1.tags), {}, {
245
+ message_id: 'messageId',
246
+ action: _types.VOICEMAIL_ACTION.DELETE
247
+ })
248
+ });
249
+ metricManager.submitVoicemailMetric(_types.METRIC_EVENT.VOICEMAIL, _types.VOICEMAIL_ACTION.DELETE, _types.METRIC_TYPE.BEHAVIORAL, 'messageId');
250
+ expect(mockSubmitClientMetric).toBeCalledOnceWith(_types.METRIC_EVENT.VOICEMAIL, expectedData2);
251
+ });
252
+ it('submit voicemail failure metric', function () {
253
+ var errorMessage = 'User is not authenticated';
254
+ var expectedData1 = {
255
+ tags: {
256
+ action: _types.VOICEMAIL_ACTION.GET_VOICEMAILS,
257
+ device_id: mockDeviceInfo.device.deviceId,
258
+ message_id: undefined,
259
+ error: errorMessage,
260
+ status_code: 401
261
+ },
262
+ fields: {
263
+ device_url: mockDeviceInfo.device.clientDeviceUri,
264
+ calling_sdk_version: _constants.VERSION
265
+ },
266
+ type: _types.METRIC_TYPE.BEHAVIORAL
267
+ };
268
+ metricManager.submitVoicemailMetric(_types.METRIC_EVENT.VOICEMAIL_ERROR, _types.VOICEMAIL_ACTION.GET_VOICEMAILS, _types.METRIC_TYPE.BEHAVIORAL, undefined, errorMessage, 401);
269
+ expect(mockSubmitClientMetric).toBeCalledOnceWith(_types.METRIC_EVENT.VOICEMAIL_ERROR, expectedData1);
270
+ mockSubmitClientMetric.mockClear();
271
+ var expectedData2 = _objectSpread(_objectSpread({}, expectedData1), {}, {
272
+ tags: _objectSpread(_objectSpread({}, expectedData1.tags), {}, {
273
+ message_id: 'messageId',
274
+ action: _types.VOICEMAIL_ACTION.DELETE
275
+ })
276
+ });
277
+ metricManager.submitVoicemailMetric(_types.METRIC_EVENT.VOICEMAIL_ERROR, _types.VOICEMAIL_ACTION.DELETE, _types.METRIC_TYPE.BEHAVIORAL, 'messageId', errorMessage, 401);
278
+ expect(mockSubmitClientMetric).toBeCalledOnceWith(_types.METRIC_EVENT.VOICEMAIL_ERROR, expectedData2);
279
+ });
280
+ it('submit unknown voicemail metric', function () {
281
+ var logSpy = jest.spyOn(_Logger.default, 'warn');
282
+ metricManager.submitVoicemailMetric('invalidMetricName', _types.VOICEMAIL_ACTION.GET_VOICEMAILS, _types.METRIC_TYPE.BEHAVIORAL);
283
+ expect(mockSubmitClientMetric).not.toBeCalled();
284
+ expect(logSpy).toBeCalledOnceWith('Invalid metric name received. Rejecting request to submit metric.', {
285
+ file: 'metric',
286
+ method: 'submitVoicemailMetric'
287
+ });
288
+ });
289
+ });
290
+ });
291
+ //# sourceMappingURL=index.test.js.map