@zelloptt/react-native-zello-sdk 2.0.1 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (196) hide show
  1. package/README.md +58 -15
  2. package/android/build.gradle +29 -10
  3. package/android/gradle.properties +4 -4
  4. package/android/src/main/java/com/zellosdk/ZelloAndroidSdkModule.kt +93 -68
  5. package/android/src/main/java/com/zellosdk/ZelloAndroidSdkModuleHelper.kt +25 -0
  6. package/ios/Extensions/ZelloContact+Extension.swift +26 -3
  7. package/ios/Extensions/ZelloHistoryVoiceMessage+Extension.swift +3 -0
  8. package/ios/Extensions/ZelloIOSSdkModule+Extension.swift +8 -2
  9. package/ios/Extensions/ZelloIncomingEmergency+Extension.swift +1 -0
  10. package/ios/Extensions/ZelloTranscription+Extension.swift +18 -0
  11. package/ios/ZelloIOSSdkModule.swift +24 -7
  12. package/ios/ZelloIOSSdkModuleBridge.m +1 -0
  13. package/ios/ZelloSdkModule.h +8 -0
  14. package/ios/ZelloSdkModule.mm +189 -0
  15. package/ios/ZelloSdkModuleImpl.swift +280 -0
  16. package/lib/commonjs/docs/assets/highlight.css +1 -1
  17. package/lib/commonjs/docs/assets/icons.js +1 -1
  18. package/lib/commonjs/docs/assets/icons.js.map +1 -1
  19. package/lib/commonjs/docs/assets/icons.svg +1 -1
  20. package/lib/commonjs/docs/assets/main.js +220 -288
  21. package/lib/commonjs/docs/assets/main.js.map +1 -1
  22. package/lib/commonjs/docs/assets/navigation.js +1 -1
  23. package/lib/commonjs/docs/assets/navigation.js.map +1 -1
  24. package/lib/commonjs/docs/assets/search.js +1 -1
  25. package/lib/commonjs/docs/assets/search.js.map +1 -1
  26. package/lib/commonjs/docs/assets/style.css +21 -6
  27. package/lib/commonjs/docs/classes/sdk.Zello.html +793 -97
  28. package/lib/commonjs/docs/classes/types.ZelloAlertMessage.html +122 -9
  29. package/lib/commonjs/docs/classes/types.ZelloChannel.html +155 -10
  30. package/lib/commonjs/docs/classes/types.ZelloChannelUser.html +86 -4
  31. package/lib/commonjs/docs/classes/types.ZelloDispatchCall.html +90 -6
  32. package/lib/commonjs/docs/classes/types.ZelloDispatchChannel.html +163 -11
  33. package/lib/commonjs/docs/classes/types.ZelloGroupConversation.html +178 -13
  34. package/lib/commonjs/docs/classes/types.ZelloHistoryAlertMessage.html +131 -10
  35. package/lib/commonjs/docs/classes/types.ZelloHistoryImageMessage.html +123 -9
  36. package/lib/commonjs/docs/classes/types.ZelloHistoryLocationMessage.html +155 -13
  37. package/lib/commonjs/docs/classes/types.ZelloHistoryTextMessage.html +131 -10
  38. package/lib/commonjs/docs/classes/types.ZelloHistoryVoiceMessage.html +145 -10
  39. package/lib/commonjs/docs/classes/types.ZelloImageMessage.html +130 -10
  40. package/lib/commonjs/docs/classes/types.ZelloIncomingEmergency.html +114 -9
  41. package/lib/commonjs/docs/classes/types.ZelloIncomingVoiceMessage.html +124 -8
  42. package/lib/commonjs/docs/classes/types.ZelloLocationMessage.html +146 -12
  43. package/lib/commonjs/docs/classes/types.ZelloOutgoingEmergency.html +98 -7
  44. package/lib/commonjs/docs/classes/types.ZelloOutgoingVoiceMessage.html +120 -9
  45. package/lib/commonjs/docs/classes/types.ZelloRecentEntry.html +114 -9
  46. package/lib/commonjs/docs/classes/types.ZelloTextMessage.html +122 -9
  47. package/lib/commonjs/docs/classes/types.ZelloTranscription.html +122 -0
  48. package/lib/commonjs/docs/classes/types.ZelloTranslation.html +91 -0
  49. package/lib/commonjs/docs/classes/types.ZelloUser.html +142 -11
  50. package/lib/commonjs/docs/classes/types.ZelloUserSupportedFeatures.html +82 -5
  51. package/lib/commonjs/docs/enums/events.ZelloEvent.html +563 -95
  52. package/lib/commonjs/docs/enums/types.ZelloAccountStatus.html +67 -5
  53. package/lib/commonjs/docs/enums/types.ZelloChannelAlertLevel.html +67 -5
  54. package/lib/commonjs/docs/enums/types.ZelloChannelConnectionStatus.html +68 -3
  55. package/lib/commonjs/docs/enums/types.ZelloChannelType.html +84 -0
  56. package/lib/commonjs/docs/enums/types.ZelloConnectionError.html +68 -3
  57. package/lib/commonjs/docs/enums/types.ZelloConnectionState.html +73 -3
  58. package/lib/commonjs/docs/enums/types.ZelloContactType.html +73 -3
  59. package/lib/commonjs/docs/enums/types.ZelloDispatchCallStatus.html +73 -3
  60. package/lib/commonjs/docs/enums/types.ZelloOutgoingVoiceMessageError.html +63 -3
  61. package/lib/commonjs/docs/enums/types.ZelloOutgoingVoiceMessageState.html +78 -3
  62. package/lib/commonjs/docs/enums/types.ZelloRecentEntryType.html +78 -3
  63. package/lib/commonjs/docs/enums/types.ZelloUserStatus.html +81 -7
  64. package/lib/commonjs/docs/hierarchy.html +29 -1
  65. package/lib/commonjs/docs/index.html +122 -24
  66. package/lib/commonjs/docs/interfaces/specs_NativeZelloSdk.Spec.html +504 -0
  67. package/lib/commonjs/docs/modules/events.html +37 -1
  68. package/lib/commonjs/docs/modules/index.html +37 -1
  69. package/lib/commonjs/docs/modules/sdk.html +37 -1
  70. package/lib/commonjs/docs/modules/specs_NativeZelloSdk.html +41 -0
  71. package/lib/commonjs/docs/modules/types.html +45 -1
  72. package/lib/commonjs/docs/modules.html +36 -1
  73. package/lib/commonjs/docs/types/types.ZelloChannelOptions.html +114 -9
  74. package/lib/commonjs/docs/types/types.ZelloConfig.html +86 -7
  75. package/lib/commonjs/docs/types/types.ZelloConsoleSettings.html +96 -9
  76. package/lib/commonjs/docs/types/types.ZelloContact.html +80 -6
  77. package/lib/commonjs/docs/types/types.ZelloCredentials.html +75 -6
  78. package/lib/commonjs/docs/types/types.ZelloHistoryMessage.html +97 -8
  79. package/lib/commonjs/docs/types/types.ZelloMessage.html +91 -7
  80. package/lib/commonjs/docs/variables/specs_NativeZelloSdk.default.html +34 -0
  81. package/lib/commonjs/events/index.js +217 -0
  82. package/lib/commonjs/events/index.js.map +1 -1
  83. package/lib/commonjs/sdk/index.js +731 -911
  84. package/lib/commonjs/sdk/index.js.map +1 -1
  85. package/lib/commonjs/specs/NativeZelloSdk.js +27 -0
  86. package/lib/commonjs/specs/NativeZelloSdk.js.map +1 -0
  87. package/lib/commonjs/types/index.js +423 -302
  88. package/lib/commonjs/types/index.js.map +1 -1
  89. package/lib/commonjs/utils/index.js +27 -4
  90. package/lib/commonjs/utils/index.js.map +1 -1
  91. package/lib/module/docs/assets/highlight.css +1 -1
  92. package/lib/module/docs/assets/icons.js +1 -1
  93. package/lib/module/docs/assets/icons.js.map +1 -1
  94. package/lib/module/docs/assets/icons.svg +1 -1
  95. package/lib/module/docs/assets/main.js +220 -288
  96. package/lib/module/docs/assets/main.js.map +1 -1
  97. package/lib/module/docs/assets/navigation.js +1 -1
  98. package/lib/module/docs/assets/navigation.js.map +1 -1
  99. package/lib/module/docs/assets/search.js +1 -1
  100. package/lib/module/docs/assets/search.js.map +1 -1
  101. package/lib/module/docs/assets/style.css +21 -6
  102. package/lib/module/docs/classes/sdk.Zello.html +793 -97
  103. package/lib/module/docs/classes/types.ZelloAlertMessage.html +122 -9
  104. package/lib/module/docs/classes/types.ZelloChannel.html +155 -10
  105. package/lib/module/docs/classes/types.ZelloChannelUser.html +86 -4
  106. package/lib/module/docs/classes/types.ZelloDispatchCall.html +90 -6
  107. package/lib/module/docs/classes/types.ZelloDispatchChannel.html +163 -11
  108. package/lib/module/docs/classes/types.ZelloGroupConversation.html +178 -13
  109. package/lib/module/docs/classes/types.ZelloHistoryAlertMessage.html +131 -10
  110. package/lib/module/docs/classes/types.ZelloHistoryImageMessage.html +123 -9
  111. package/lib/module/docs/classes/types.ZelloHistoryLocationMessage.html +155 -13
  112. package/lib/module/docs/classes/types.ZelloHistoryTextMessage.html +131 -10
  113. package/lib/module/docs/classes/types.ZelloHistoryVoiceMessage.html +145 -10
  114. package/lib/module/docs/classes/types.ZelloImageMessage.html +130 -10
  115. package/lib/module/docs/classes/types.ZelloIncomingEmergency.html +114 -9
  116. package/lib/module/docs/classes/types.ZelloIncomingVoiceMessage.html +124 -8
  117. package/lib/module/docs/classes/types.ZelloLocationMessage.html +146 -12
  118. package/lib/module/docs/classes/types.ZelloOutgoingEmergency.html +98 -7
  119. package/lib/module/docs/classes/types.ZelloOutgoingVoiceMessage.html +120 -9
  120. package/lib/module/docs/classes/types.ZelloRecentEntry.html +114 -9
  121. package/lib/module/docs/classes/types.ZelloTextMessage.html +122 -9
  122. package/lib/module/docs/classes/types.ZelloTranscription.html +122 -0
  123. package/lib/module/docs/classes/types.ZelloTranslation.html +91 -0
  124. package/lib/module/docs/classes/types.ZelloUser.html +142 -11
  125. package/lib/module/docs/classes/types.ZelloUserSupportedFeatures.html +82 -5
  126. package/lib/module/docs/enums/events.ZelloEvent.html +563 -95
  127. package/lib/module/docs/enums/types.ZelloAccountStatus.html +67 -5
  128. package/lib/module/docs/enums/types.ZelloChannelAlertLevel.html +67 -5
  129. package/lib/module/docs/enums/types.ZelloChannelConnectionStatus.html +68 -3
  130. package/lib/module/docs/enums/types.ZelloChannelType.html +84 -0
  131. package/lib/module/docs/enums/types.ZelloConnectionError.html +68 -3
  132. package/lib/module/docs/enums/types.ZelloConnectionState.html +73 -3
  133. package/lib/module/docs/enums/types.ZelloContactType.html +73 -3
  134. package/lib/module/docs/enums/types.ZelloDispatchCallStatus.html +73 -3
  135. package/lib/module/docs/enums/types.ZelloOutgoingVoiceMessageError.html +63 -3
  136. package/lib/module/docs/enums/types.ZelloOutgoingVoiceMessageState.html +78 -3
  137. package/lib/module/docs/enums/types.ZelloRecentEntryType.html +78 -3
  138. package/lib/module/docs/enums/types.ZelloUserStatus.html +81 -7
  139. package/lib/module/docs/hierarchy.html +29 -1
  140. package/lib/module/docs/index.html +122 -24
  141. package/lib/module/docs/interfaces/specs_NativeZelloSdk.Spec.html +504 -0
  142. package/lib/module/docs/modules/events.html +37 -1
  143. package/lib/module/docs/modules/index.html +37 -1
  144. package/lib/module/docs/modules/sdk.html +37 -1
  145. package/lib/module/docs/modules/specs_NativeZelloSdk.html +41 -0
  146. package/lib/module/docs/modules/types.html +45 -1
  147. package/lib/module/docs/modules.html +36 -1
  148. package/lib/module/docs/types/types.ZelloChannelOptions.html +114 -9
  149. package/lib/module/docs/types/types.ZelloConfig.html +86 -7
  150. package/lib/module/docs/types/types.ZelloConsoleSettings.html +96 -9
  151. package/lib/module/docs/types/types.ZelloContact.html +80 -6
  152. package/lib/module/docs/types/types.ZelloCredentials.html +75 -6
  153. package/lib/module/docs/types/types.ZelloHistoryMessage.html +97 -8
  154. package/lib/module/docs/types/types.ZelloMessage.html +91 -7
  155. package/lib/module/docs/variables/specs_NativeZelloSdk.default.html +34 -0
  156. package/lib/module/events/index.js +217 -0
  157. package/lib/module/events/index.js.map +1 -1
  158. package/lib/module/sdk/index.js +730 -912
  159. package/lib/module/sdk/index.js.map +1 -1
  160. package/lib/module/specs/NativeZelloSdk.js +25 -0
  161. package/lib/module/specs/NativeZelloSdk.js.map +1 -0
  162. package/lib/module/types/index.js +378 -301
  163. package/lib/module/types/index.js.map +1 -1
  164. package/lib/module/utils/index.js +27 -5
  165. package/lib/module/utils/index.js.map +1 -1
  166. package/lib/typescript/commonjs/src/events/index.d.ts +9 -0
  167. package/lib/typescript/commonjs/src/events/index.d.ts.map +1 -1
  168. package/lib/typescript/commonjs/src/sdk/index.d.ts +10 -0
  169. package/lib/typescript/commonjs/src/sdk/index.d.ts.map +1 -1
  170. package/lib/typescript/commonjs/src/specs/NativeZelloSdk.d.ts +55 -0
  171. package/lib/typescript/commonjs/src/specs/NativeZelloSdk.d.ts.map +1 -0
  172. package/lib/typescript/commonjs/src/types/index.d.ts +106 -4
  173. package/lib/typescript/commonjs/src/types/index.d.ts.map +1 -1
  174. package/lib/typescript/commonjs/src/utils/index.d.ts +2 -1
  175. package/lib/typescript/commonjs/src/utils/index.d.ts.map +1 -1
  176. package/lib/typescript/module/src/events/index.d.ts +9 -0
  177. package/lib/typescript/module/src/events/index.d.ts.map +1 -1
  178. package/lib/typescript/module/src/index.d.ts +4 -4
  179. package/lib/typescript/module/src/index.d.ts.map +1 -1
  180. package/lib/typescript/module/src/sdk/index.d.ts +11 -1
  181. package/lib/typescript/module/src/sdk/index.d.ts.map +1 -1
  182. package/lib/typescript/module/src/specs/NativeZelloSdk.d.ts +55 -0
  183. package/lib/typescript/module/src/specs/NativeZelloSdk.d.ts.map +1 -0
  184. package/lib/typescript/module/src/types/index.d.ts +106 -4
  185. package/lib/typescript/module/src/types/index.d.ts.map +1 -1
  186. package/lib/typescript/module/src/utils/algorithms/index.d.ts +1 -1
  187. package/lib/typescript/module/src/utils/algorithms/index.d.ts.map +1 -1
  188. package/lib/typescript/module/src/utils/index.d.ts +2 -1
  189. package/lib/typescript/module/src/utils/index.d.ts.map +1 -1
  190. package/package.json +31 -15
  191. package/react-native-zello-sdk.podspec +26 -1
  192. package/src/events/index.ts +9 -0
  193. package/src/sdk/index.ts +105 -225
  194. package/src/specs/NativeZelloSdk.ts +89 -0
  195. package/src/types/index.ts +153 -6
  196. package/src/utils/index.ts +50 -3
@@ -7,26 +7,17 @@ exports.Zello = void 0;
7
7
  var _reactNative = require("react-native");
8
8
  var _index = require("../utils/index.js");
9
9
  var _index2 = require("../types/index.js");
10
- var _EventEmitter2 = _interopRequireDefault(require("react-native/Libraries/vendor/emitter/EventEmitter"));
10
+ var _EventEmitter = _interopRequireDefault(require("react-native/Libraries/vendor/emitter/EventEmitter"));
11
11
  var _index3 = require("../utils/algorithms/index.js");
12
12
  var _index4 = require("../events/index.js");
13
- var _Zello;
13
+ var _NativeZelloSdk = _interopRequireDefault(require("../specs/NativeZelloSdk.js"));
14
14
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
- function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
16
- function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
17
- function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
18
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
19
- function _possibleConstructorReturn(t, e) { if (e && ("object" == typeof e || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
20
- function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
21
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function () { return !!t; })(); }
22
- function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
23
- function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
24
- function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
25
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
26
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
27
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } // noinspection JSUnusedGlobalSymbols
15
+ // noinspection JSUnusedGlobalSymbols
16
+
17
+ // `ZelloIOSSdkModule` is the iOS RCTEventEmitter that owns the Zello delegate
18
+ // (see `getSdk`). All method calls go through the unified `NativeZelloSdk`
19
+ // TurboModule, which on Android also owns the delegate.
28
20
  const {
29
- ZelloAndroidSdkModule,
30
21
  ZelloIOSSdkModule
31
22
  } = _reactNative.NativeModules;
32
23
 
@@ -34,1010 +25,839 @@ const {
34
25
  * Zello SDK.
35
26
  * This class is a singleton, and can be accessed via {@link Zello.getInstance}.
36
27
  */
37
- let Zello = exports.Zello = /*#__PURE__*/function (_EventEmitter) {
38
- function Zello() {
39
- var _this;
40
- _classCallCheck(this, Zello);
41
- _this = _callSuper(this, Zello);
42
- /**
43
- * The current connection state of the SDK.
44
- */
45
- _defineProperty(_this, "state", _index2.ZelloConnectionState.Disconnected);
46
- /**
47
- * The currently selected contact.
48
- */
49
- _defineProperty(_this, "selectedContact", void 0);
50
- /**
51
- * The list of {@link ZelloUser} in the contact list. Sorted by name, ascending.
52
- */
53
- _defineProperty(_this, "users", []);
54
- /**
55
- * The list of {@link ZelloChannel} in the contact list. Sorted by name, ascending.
56
- */
57
- _defineProperty(_this, "channels", []);
58
- /**
59
- * The list of {@link ZelloGroupConversation} in the contact list. Sorted by name, ascending.
60
- */
61
- _defineProperty(_this, "groupConversations", []);
62
- /**
63
- * The current account status. undefined when {@link state} is not {@link ZelloConnectionState.Connected}.
64
- */
65
- _defineProperty(_this, "accountStatus", void 0);
66
- /**
67
- * The current incoming voice message.
68
- */
69
- _defineProperty(_this, "incomingVoiceMessage", void 0);
70
- /**
71
- * The current outgoing voice message.
72
- */
73
- _defineProperty(_this, "outgoingVoiceMessage", void 0);
74
- /**
75
- * The configured emergency channel.
76
- */
77
- _defineProperty(_this, "emergencyChannel", void 0);
78
- /**
79
- * The list of incoming emergencies. There can be multiple emergencies on the emergency channel at once.
80
- * Sorted by start timestamp, ascending.
81
- */
82
- _defineProperty(_this, "incomingEmergencies", []);
83
- /**
84
- * The current outgoing emergency.
85
- */
86
- _defineProperty(_this, "outgoingEmergency", void 0);
87
- /**
88
- * The list of recent entries. Sorted by timestamp, descending.
89
- */
90
- _defineProperty(_this, "recents", []);
91
- /**
92
- * The currently playing history voice message.
93
- */
94
- _defineProperty(_this, "historyVoiceMessage", void 0);
95
- /**
96
- * The console settings for the network.
97
- * This is only expected to be valid when {@link state} is {@link ZelloConnectionState.Connected}.
98
- */
99
- _defineProperty(_this, "consoleSettings", void 0);
100
- _defineProperty(_this, "eventListener", void 0);
28
+ class Zello extends _EventEmitter.default {
29
+ static getInstance() {
30
+ if (!Zello.instance) {
31
+ Zello.instance = new Zello();
32
+ }
33
+ return Zello.instance;
34
+ }
35
+
36
+ /**
37
+ * The current connection state of the SDK.
38
+ */
39
+ state = _index2.ZelloConnectionState.Disconnected;
40
+
41
+ /**
42
+ * The currently selected contact.
43
+ */
44
+
45
+ /**
46
+ * The list of {@link ZelloUser} in the contact list. Sorted by name, ascending.
47
+ */
48
+ users = [];
49
+ /**
50
+ * The list of {@link ZelloChannel} in the contact list. Sorted by name, ascending.
51
+ */
52
+ channels = [];
53
+ /**
54
+ * The list of {@link ZelloGroupConversation} in the contact list. Sorted by name, ascending.
55
+ */
56
+ groupConversations = [];
57
+
58
+ /**
59
+ * The current account status. undefined when {@link state} is not {@link ZelloConnectionState.Connected}.
60
+ */
61
+
62
+ /**
63
+ * The current incoming voice message.
64
+ */
65
+
66
+ /**
67
+ * The current outgoing voice message.
68
+ */
69
+
70
+ /**
71
+ * The configured emergency channel.
72
+ */
73
+
74
+ /**
75
+ * The list of incoming emergencies. There can be multiple emergencies on the emergency channel at once.
76
+ * Sorted by start timestamp, ascending.
77
+ */
78
+ incomingEmergencies = [];
79
+ /**
80
+ * The current outgoing emergency.
81
+ */
82
+
83
+ /**
84
+ * The list of recent entries. Sorted by timestamp, descending.
85
+ */
86
+ recents = [];
87
+
88
+ /**
89
+ * The currently playing history voice message.
90
+ */
91
+
92
+ /**
93
+ * The console settings for the network.
94
+ * This is only expected to be valid when {@link state} is {@link ZelloConnectionState.Connected}.
95
+ */
96
+
97
+ constructor() {
98
+ super();
99
+ // Accessing the native module instantiates it, which registers the SDK
100
+ // delegate that drives events. The events themselves arrive on the global
101
+ // DeviceEventEmitter 'zellosdk' channel (bridgeless-safe on both platforms).
101
102
  const sdk = Zello.getSdk();
102
103
  if (sdk) {
103
- let eventEmitter;
104
- if (_index.isAndroid) {
105
- eventEmitter = new _reactNative.NativeEventEmitter();
106
- } else {
107
- eventEmitter = new _reactNative.NativeEventEmitter(sdk);
108
- }
109
- _this.setupEventListener(eventEmitter);
104
+ this.setupEventListener();
110
105
  }
111
- return _this;
112
106
  }
113
107
 
114
108
  /**
115
109
  * Sets configuration variables for the SDK.
116
110
  * @param config The configuration to set.
117
111
  */
118
- _inherits(Zello, _EventEmitter);
119
- return _createClass(Zello, [{
120
- key: "configure",
121
- value: function configure(config) {
122
- if (_index.isAndroid) {
123
- ZelloAndroidSdkModule.configure(config.android.enableOfflineMessagePushNotifications, config.android.enableForegroundService);
124
- } else {
125
- ZelloIOSSdkModule.configure(config.ios.isDebugBuild, config.ios.appGroup);
126
- }
127
- }
112
+ configure(config) {
113
+ _NativeZelloSdk.default.configure(config);
114
+ }
128
115
 
129
- /**
130
- * Destroys the SDK instance and cleans up resources.
131
- * Call this when you are done using the SDK instance for good (application quit).
132
- */
133
- }, {
134
- key: "destroy",
135
- value: function destroy() {
136
- this.removeAllListeners();
137
- this.eventListener?.remove();
138
- }
116
+ /**
117
+ * Destroys the SDK instance and cleans up resources.
118
+ * Call this when you are done using the SDK instance for good (application quit).
119
+ */
120
+ destroy() {
121
+ this.removeAllListeners();
122
+ this.eventListener?.remove();
123
+ }
139
124
 
140
- /**
141
- * Signs into to the Zello Work network using the provided credentials.
142
- * This will typically trigger the {@link ZelloEvent.CONNECT_STARTED} event, followed by either {@link ZelloEvent.CONNECT_SUCCEEDED} or {@link ZelloEvent.CONNECT_FAILED}.
143
- * However, if the state is incorrect, {@link ZelloEvent.CONNECT_FAILED} will be triggered immediately.
144
- * @param credentials The credentials to use for signing in.
145
- */
146
- }, {
147
- key: "connect",
148
- value: function connect(credentials) {
149
- if (_index.isAndroid) {
150
- ZelloAndroidSdkModule.connect(credentials.network, credentials.username, credentials.password);
151
- } else {
152
- ZelloIOSSdkModule.connect(credentials.network, credentials.username, credentials.password);
153
- }
154
- }
125
+ /**
126
+ * Signs into to the Zello Work network using the provided credentials.
127
+ * This will typically trigger the {@link ZelloEvent.CONNECT_STARTED} event, followed by either {@link ZelloEvent.CONNECT_SUCCEEDED} or {@link ZelloEvent.CONNECT_FAILED}.
128
+ * However, if the state is incorrect, {@link ZelloEvent.CONNECT_FAILED} will be triggered immediately.
129
+ * @param credentials The credentials to use for signing in.
130
+ */
131
+ connect(credentials) {
132
+ _NativeZelloSdk.default.connect(credentials.network, credentials.username, credentials.password);
133
+ }
155
134
 
156
- /**
157
- * Signs out of the Zello Work network.
158
- * This will trigger the {@link ZelloEvent.DISCONNECTED} event.
159
- */
160
- }, {
161
- key: "disconnect",
162
- value: function disconnect() {
163
- if (_index.isAndroid) {
164
- ZelloAndroidSdkModule.disconnect();
165
- } else {
166
- ZelloIOSSdkModule.disconnect();
167
- }
168
- }
135
+ /**
136
+ * Signs out of the Zello Work network.
137
+ * This will trigger the {@link ZelloEvent.DISCONNECTED} event.
138
+ */
139
+ disconnect() {
140
+ _NativeZelloSdk.default.disconnect();
141
+ }
169
142
 
170
- /**
171
- * Returns the user with the given name. Case-insensitive.
172
- * @param name The name of the user to search for.
173
- * @return The user with the given name, or null if no user with that name exists.
174
- */
175
- }, {
176
- key: "getUser",
177
- value: function getUser(name) {
178
- return (0, _index3.sortedArrayFind)(this.users, name, _index3.compareNameAscending);
179
- }
143
+ /**
144
+ * Returns the user with the given name. Case-insensitive.
145
+ * @param name The name of the user to search for.
146
+ * @return The user with the given name, or null if no user with that name exists.
147
+ */
148
+ getUser(name) {
149
+ return (0, _index3.sortedArrayFind)(this.users, name, _index3.compareNameAscending);
150
+ }
180
151
 
181
- /**
182
- * Returns the channel with the given name. Case-insensitive.
183
- * @param name The name of the channel to search for.
184
- * @return The channel with the given name, or null if no channel with that name exists.
185
- */
186
- }, {
187
- key: "getChannel",
188
- value: function getChannel(name) {
189
- return (0, _index3.sortedArrayFind)(this.channels, name, _index3.compareNameAscending);
190
- }
152
+ /**
153
+ * Returns the channel with the given name. Case-insensitive.
154
+ * @param name The name of the channel to search for.
155
+ * @return The channel with the given name, or null if no channel with that name exists.
156
+ */
157
+ getChannel(name) {
158
+ return (0, _index3.sortedArrayFind)(this.channels, name, _index3.compareNameAscending);
159
+ }
191
160
 
192
- /**
193
- * Returns the group conversation with the given name. Case-insensitive.
194
- * @param name The name of the group conversation to search for.
195
- * @return The group conversation with the given name, or null if no group conversation with that name exists.
196
- */
197
- }, {
198
- key: "getGroupConversation",
199
- value: function getGroupConversation(name) {
200
- return (0, _index3.sortedArrayFind)(this.groupConversations, name, _index3.compareNameAscending);
201
- }
161
+ /**
162
+ * Returns the group conversation with the given name. Case-insensitive.
163
+ * @param name The name of the group conversation to search for.
164
+ * @return The group conversation with the given name, or null if no group conversation with that name exists.
165
+ */
166
+ getGroupConversation(name) {
167
+ return (0, _index3.sortedArrayFind)(this.groupConversations, name, _index3.compareNameAscending);
168
+ }
202
169
 
203
- /**
204
- * Sets the selected contact.
205
- * While optional, this is typically used for tracking the contact that the user is currently interacting with.
206
- * This will trigger the {@link ZelloEvent.SELECTED_CONTACT_CHANGED} event.
207
- * @param contact The contact to set as selected.
208
- */
209
- }, {
210
- key: "setSelectedContact",
211
- value: function setSelectedContact(contact) {
212
- if (_index.isAndroid) {
213
- ZelloAndroidSdkModule.setSelectedContact(contact.name, contact.type);
214
- } else {
215
- ZelloIOSSdkModule.selectContact(contact.name, contact.type);
216
- }
217
- }
170
+ /**
171
+ * Sets the selected contact.
172
+ * While optional, this is typically used for tracking the contact that the user is currently interacting with.
173
+ * This will trigger the {@link ZelloEvent.SELECTED_CONTACT_CHANGED} event.
174
+ * @param contact The contact to set as selected.
175
+ */
176
+ setSelectedContact(contact) {
177
+ _NativeZelloSdk.default.selectContact(contact.name, contact.type);
178
+ }
218
179
 
219
- /**
220
- * Sets the user's online account status.
221
- * This will trigger the {@link ZelloEvent.ACCOUNT_STATUS_CHANGED} event.
222
- * @param status The account status to set.
223
- */
224
- }, {
225
- key: "setAccountStatus",
226
- value: function setAccountStatus(status) {
227
- if (_index.isAndroid) {
228
- ZelloAndroidSdkModule.setAccountStatus(status);
229
- } else {
230
- ZelloIOSSdkModule.setAccountStatus(status);
231
- }
232
- }
180
+ /**
181
+ * Sets the user's online account status.
182
+ * This will trigger the {@link ZelloEvent.ACCOUNT_STATUS_CHANGED} event.
183
+ * @param status The account status to set.
184
+ */
185
+ setAccountStatus(status) {
186
+ _NativeZelloSdk.default.setAccountStatus(status);
187
+ }
233
188
 
234
- /**
235
- * Connects to the given channel.
236
- * Once connected, the user will be able to send and receive messages from the channel.
237
- * This will trigger the {@link ZelloEvent.CONTACT_LIST_UPDATED} event.
238
- * @param channel The channel to connect to.
239
- */
240
- }, {
241
- key: "connectChannel",
242
- value: function connectChannel(channel) {
243
- if (_index.isAndroid) {
244
- ZelloAndroidSdkModule.connectChannel(channel.name);
245
- } else {
246
- if (channel.type === _index2.ZelloContactType.GroupConversation) {
247
- ZelloIOSSdkModule.connectGroupConversation(channel.name);
248
- } else {
249
- ZelloIOSSdkModule.connectChannel(channel.name);
250
- }
251
- }
189
+ /**
190
+ * Connects to the given channel.
191
+ * Once connected, the user will be able to send and receive messages from the channel.
192
+ * This will trigger the {@link ZelloEvent.CONTACT_LIST_UPDATED} event.
193
+ * @param channel The channel to connect to.
194
+ */
195
+ connectChannel(channel) {
196
+ if (channel.type === _index2.ZelloContactType.GroupConversation) {
197
+ _NativeZelloSdk.default.connectGroupConversation(channel.name);
198
+ } else {
199
+ _NativeZelloSdk.default.connectChannel(channel.name);
252
200
  }
201
+ }
253
202
 
254
- /**
255
- * Disconnects from the given channel.
256
- * Once disconnected, the user will no longer be able to send or receive messages from the channel.
257
- * This will trigger the {@link ZelloEvent.CONTACT_LIST_UPDATED} event.
258
- * @param channel The channel to disconnect from.
259
- */
260
- }, {
261
- key: "disconnectChannel",
262
- value: function disconnectChannel(channel) {
263
- if (_index.isAndroid) {
264
- ZelloAndroidSdkModule.disconnectChannel(channel.name);
265
- } else {
266
- if (channel.type === _index2.ZelloContactType.GroupConversation) {
267
- ZelloIOSSdkModule.disconnectGroupConversation(channel.name);
268
- } else {
269
- ZelloIOSSdkModule.disconnectChannel(channel.name);
270
- }
271
- }
203
+ /**
204
+ * Disconnects from the given channel.
205
+ * Once disconnected, the user will no longer be able to send or receive messages from the channel.
206
+ * This will trigger the {@link ZelloEvent.CONTACT_LIST_UPDATED} event.
207
+ * @param channel The channel to disconnect from.
208
+ */
209
+ disconnectChannel(channel) {
210
+ if (channel.type === _index2.ZelloContactType.GroupConversation) {
211
+ _NativeZelloSdk.default.disconnectGroupConversation(channel.name);
212
+ } else {
213
+ _NativeZelloSdk.default.disconnectChannel(channel.name);
272
214
  }
215
+ }
273
216
 
274
- /**
275
- * Starts a voice message with the given contact.
276
- * This will trigger the {@link ZelloEvent.OUTGOING_VOICE_MESSAGE_CONNECTING} event, followed by the {@link ZelloEvent.OUTGOING_VOICE_MESSAGE_STARTED} event.
277
- * If there is an error, the {@link ZelloEvent.OUTGOING_VOICE_MESSAGE_STOPPED} event will be triggered.
278
- * @param contact The contact to start the voice message with.
279
- */
280
- }, {
281
- key: "startVoiceMessage",
282
- value: function startVoiceMessage(contact) {
283
- if (_index.isAndroid) {
284
- ZelloAndroidSdkModule.startVoiceMessage(contact.name, contact.type);
285
- } else {
286
- ZelloIOSSdkModule.startVoiceMessage(contact.name, contact.type);
287
- }
288
- }
217
+ /**
218
+ * Starts a voice message with the given contact.
219
+ * This will trigger the {@link ZelloEvent.OUTGOING_VOICE_MESSAGE_CONNECTING} event, followed by the {@link ZelloEvent.OUTGOING_VOICE_MESSAGE_STARTED} event.
220
+ * If there is an error, the {@link ZelloEvent.OUTGOING_VOICE_MESSAGE_STOPPED} event will be triggered.
221
+ * @param contact The contact to start the voice message with.
222
+ */
223
+ startVoiceMessage(contact) {
224
+ _NativeZelloSdk.default.startVoiceMessage(contact.name, contact.type);
225
+ }
289
226
 
290
- /**
291
- * Stops the current outgoing voice message.
292
- * This will trigger the {@link ZelloEvent.OUTGOING_VOICE_MESSAGE_STOPPED} event.
293
- */
294
- }, {
295
- key: "stopVoiceMessage",
296
- value: function stopVoiceMessage() {
297
- if (_index.isAndroid) {
298
- ZelloAndroidSdkModule.stopVoiceMessage();
299
- } else {
300
- ZelloIOSSdkModule.stopVoiceMessage();
301
- }
302
- }
227
+ /**
228
+ * Stops the current outgoing voice message.
229
+ * This will trigger the {@link ZelloEvent.OUTGOING_VOICE_MESSAGE_STOPPED} event.
230
+ */
231
+ stopVoiceMessage() {
232
+ _NativeZelloSdk.default.stopVoiceMessage();
233
+ }
303
234
 
304
- /**
305
- * Sends the image message data to the given contact.
306
- * This will trigger the {@link ZelloEvent.OUTGOING_IMAGE_MESSAGE_SENT} or {@link ZelloEvent.OUTGOING_IMAGE_MESSAGE_SEND_FAILED} event.
307
- * @param contact The contact to send the image to.
308
- * @param data The image data to send.
309
- */
310
- }, {
311
- key: "sendImage",
312
- value: function sendImage(contact, data) {
313
- if (_index.isAndroid) {
314
- ZelloAndroidSdkModule.sendImage(contact.name, contact.type, data);
315
- } else {
316
- ZelloIOSSdkModule.sendImage(contact.name, contact.type, data);
317
- }
318
- }
235
+ /**
236
+ * Sends the image message data to the given contact.
237
+ * This will trigger the {@link ZelloEvent.OUTGOING_IMAGE_MESSAGE_SENT} or {@link ZelloEvent.OUTGOING_IMAGE_MESSAGE_SEND_FAILED} event.
238
+ * @param contact The contact to send the image to.
239
+ * @param data The image data to send.
240
+ */
241
+ sendImage(contact, data) {
242
+ _NativeZelloSdk.default.sendImage(contact.name, contact.type, data);
243
+ }
319
244
 
320
- /**
321
- * Sends the alert message to the given contact.
322
- * This will trigger the {@link ZelloEvent.OUTGOING_ALERT_MESSAGE_SENT} or {@link ZelloEvent.OUTGOING_ALERT_MESSAGE_SEND_FAILED} event.
323
- * @param contact The contact to send the alert to.
324
- */
325
- }, {
326
- key: "sendLocation",
327
- value: function sendLocation(contact) {
328
- if (_index.isAndroid) {
329
- ZelloAndroidSdkModule.sendLocation(contact.name, contact.type);
330
- } else {
331
- ZelloIOSSdkModule.sendLocation(contact.name, contact.type);
332
- }
333
- }
245
+ /**
246
+ * Sends the alert message to the given contact.
247
+ * This will trigger the {@link ZelloEvent.OUTGOING_ALERT_MESSAGE_SENT} or {@link ZelloEvent.OUTGOING_ALERT_MESSAGE_SEND_FAILED} event.
248
+ * @param contact The contact to send the alert to.
249
+ */
250
+ sendLocation(contact) {
251
+ _NativeZelloSdk.default.sendLocation(contact.name, contact.type);
252
+ }
334
253
 
335
- /**
336
- * Sends the text message to the given contact.
337
- * This will trigger the {@link ZelloEvent.OUTGOING_TEXT_MESSAGE_SENT} or {@link ZelloEvent.OUTGOING_TEXT_MESSAGE_SEND_FAILED} event.
338
- * @param contact The contact to send the text to.
339
- * @param text The text to send.
340
- */
341
- }, {
342
- key: "sendText",
343
- value: function sendText(contact, text) {
344
- if (_index.isAndroid) {
345
- ZelloAndroidSdkModule.sendText(contact.name, contact.type, text);
346
- } else {
347
- ZelloIOSSdkModule.sendText(contact.name, contact.type, text);
348
- }
349
- }
254
+ /**
255
+ * Sends the text message to the given contact.
256
+ * This will trigger the {@link ZelloEvent.OUTGOING_TEXT_MESSAGE_SENT} or {@link ZelloEvent.OUTGOING_TEXT_MESSAGE_SEND_FAILED} event.
257
+ * @param contact The contact to send the text to.
258
+ * @param text The text to send.
259
+ */
260
+ sendText(contact, text) {
261
+ _NativeZelloSdk.default.sendText(contact.name, contact.type, text);
262
+ }
350
263
 
351
- /**
352
- * Sends the alert message to the given contact.
353
- * This will trigger the {@link ZelloEvent.OUTGOING_ALERT_MESSAGE_SENT} or {@link ZelloEvent.OUTGOING_ALERT_MESSAGE_SEND_FAILED} event.
354
- * @param contact The contact to send the alert to.
355
- * @param text The text to send.
356
- * @param level Optional; The alert level to send. Only applicable for channels.
357
- */
358
- }, {
359
- key: "sendAlert",
360
- value: function sendAlert(contact, text, level) {
361
- if (_index.isAndroid) {
362
- ZelloAndroidSdkModule.sendAlert(contact.name, contact.type, text, level);
363
- } else {
364
- ZelloIOSSdkModule.sendAlert(contact.name, contact.type, text, level);
365
- }
366
- }
264
+ /**
265
+ * Sends the alert message to the given contact.
266
+ * This will trigger the {@link ZelloEvent.OUTGOING_ALERT_MESSAGE_SENT} or {@link ZelloEvent.OUTGOING_ALERT_MESSAGE_SEND_FAILED} event.
267
+ * @param contact The contact to send the alert to.
268
+ * @param text The text to send.
269
+ * @param level Optional; The alert level to send. Only applicable for channels.
270
+ */
271
+ sendAlert(contact, text, level) {
272
+ _NativeZelloSdk.default.sendAlert(contact.name, contact.type, text, level ?? '');
273
+ }
367
274
 
368
- /**
369
- * Submits a problem report to Zello.
370
- * Additionally, please contact us to provide more information on what happened.
371
- */
372
- }, {
373
- key: "submitProblemReport",
374
- value: function submitProblemReport() {
375
- if (_index.isAndroid) {
376
- ZelloAndroidSdkModule.submitProblemReport();
377
- } else {
378
- ZelloIOSSdkModule.submitProblemReport();
379
- }
380
- }
275
+ /**
276
+ * Submits a problem report to Zello.
277
+ * Additionally, please contact us to provide more information on what happened.
278
+ */
279
+ submitProblemReport() {
280
+ _NativeZelloSdk.default.submitProblemReport();
281
+ }
381
282
 
382
- /**
383
- * Mutes the given contact. When muted, incoming messages from this contact will not play live, but will still appear in the history.
384
- * This will trigger the {@link ZelloEvent.CONTACT_LIST_UPDATED} event.
385
- * @param contact The contact to mute.
386
- */
387
- }, {
388
- key: "muteContact",
389
- value: function muteContact(contact) {
390
- if (_index.isAndroid) {
391
- ZelloAndroidSdkModule.muteContact(contact.name, contact.type);
392
- } else {
393
- ZelloIOSSdkModule.muteContact(contact.name, contact.type);
394
- }
395
- }
283
+ /**
284
+ * Mutes the given contact. When muted, incoming messages from this contact will not play live, but will still appear in the history.
285
+ * This will trigger the {@link ZelloEvent.CONTACT_LIST_UPDATED} event.
286
+ * @param contact The contact to mute.
287
+ */
288
+ muteContact(contact) {
289
+ _NativeZelloSdk.default.muteContact(contact.name, contact.type);
290
+ }
396
291
 
397
- /**
398
- * Unmutes a previously muted contact. When unmuted, incoming messages from this contact will play live.
399
- * This will trigger the {@link ZelloEvent.CONTACT_LIST_UPDATED} event.
400
- * @param contact The contact to unmute.
401
- */
402
- }, {
403
- key: "unmuteContact",
404
- value: function unmuteContact(contact) {
405
- if (_index.isAndroid) {
406
- ZelloAndroidSdkModule.unmuteContact(contact.name, contact.type);
407
- } else {
408
- ZelloIOSSdkModule.unmuteContact(contact.name, contact.type);
409
- }
410
- }
292
+ /**
293
+ * Unmutes a previously muted contact. When unmuted, incoming messages from this contact will play live.
294
+ * This will trigger the {@link ZelloEvent.CONTACT_LIST_UPDATED} event.
295
+ * @param contact The contact to unmute.
296
+ */
297
+ unmuteContact(contact) {
298
+ _NativeZelloSdk.default.unmuteContact(contact.name, contact.type);
299
+ }
411
300
 
412
- /**
413
- * Starts an outgoing emergency to the emergency channel.
414
- * Upon starting, the user's location will be sent, an alert message will be sent, and a 10-second-long voice message will start recording.
415
- * This will trigger the {@link ZelloEvent.OUTGOING_EMERGENCY_STARTED} event.
416
- */
417
- }, {
418
- key: "startEmergency",
419
- value: function startEmergency() {
420
- if (_index.isAndroid) {
421
- ZelloAndroidSdkModule.startEmergency();
422
- } else {
423
- ZelloIOSSdkModule.startEmergency();
424
- }
425
- }
301
+ /**
302
+ * Starts an outgoing emergency to the emergency channel.
303
+ * Upon starting, the user's location will be sent, an alert message will be sent, and a 10-second-long voice message will start recording.
304
+ * This will trigger the {@link ZelloEvent.OUTGOING_EMERGENCY_STARTED} event.
305
+ */
306
+ startEmergency() {
307
+ _NativeZelloSdk.default.startEmergency();
308
+ }
426
309
 
427
- /**
428
- * Stops the outgoing emergency.
429
- * This will trigger the {@link ZelloEvent.OUTGOING_EMERGENCY_STOPPED} event.
430
- */
431
- }, {
432
- key: "stopEmergency",
433
- value: function stopEmergency() {
434
- if (_index.isAndroid) {
435
- ZelloAndroidSdkModule.stopEmergency();
436
- } else {
437
- ZelloIOSSdkModule.stopEmergency();
438
- }
439
- }
310
+ /**
311
+ * Stops the outgoing emergency.
312
+ * This will trigger the {@link ZelloEvent.OUTGOING_EMERGENCY_STOPPED} event.
313
+ */
314
+ stopEmergency() {
315
+ _NativeZelloSdk.default.stopEmergency();
316
+ }
440
317
 
441
- /**
442
- * Returns the history messages for the given contact.
443
- * @param contact The contact to get the history for.
444
- * @param size Optional; The number of history items to retrieve. Defaults to 50.
445
- * @return The history items for the given contact.
446
- */
447
- }, {
448
- key: "getHistory",
449
- value: function getHistory(contact, size) {
450
- const defaultHistorySize = 50;
451
- return new Promise(resolve => {
452
- const callback = history => {
453
- if (!history) {
454
- resolve([]);
455
- return;
456
- }
457
- const messages = history.map(message => (0, _index.bridgeHistoryMessageToSdkHistoryMessage)(message)).filter(item => item !== undefined);
458
- resolve(messages);
459
- };
460
- if (_index.isAndroid) {
461
- ZelloAndroidSdkModule.getHistory(contact.name, contact.type, size ?? defaultHistorySize, callback);
462
- } else {
463
- ZelloIOSSdkModule.getHistory(contact.name, contact.type, size ?? defaultHistorySize, callback);
464
- }
465
- });
466
- }
318
+ /**
319
+ * Stops an incoming emergency started by another user on the emergency channel.
320
+ *
321
+ * This requires the emergency channel's {@link ZelloChannelOptions.allowEmergencyEndOthers | allowEmergencyEndOthers} option
322
+ * to be true; otherwise this method has no effect.
323
+ *
324
+ * On success, this will trigger the {@link ZelloEvent.INCOMING_EMERGENCY_STOPPED} event for the emergency.
325
+ * @param incomingEmergency The incoming emergency to stop. Must be one of the entries currently in {@link incomingEmergencies}.
326
+ */
327
+ stopIncomingEmergency(incomingEmergency) {
328
+ _NativeZelloSdk.default.stopIncomingEmergency(incomingEmergency.emergencyId);
329
+ }
467
330
 
468
- /**
469
- * Plays the given history message.
470
- * This will trigger the {@link ZelloEvent.HISTORY_PLAYBACK_STARTED} event.
471
- * @param message The history message to play.
472
- */
473
- }, {
474
- key: "playHistoryMessage",
475
- value: function playHistoryMessage(message) {
476
- if (_index.isAndroid) {
477
- ZelloAndroidSdkModule.playHistoryMessage(message.historyId, message.contact.name, message.contact.type);
478
- } else {
479
- ZelloIOSSdkModule.playHistoryMessage(message.historyId, message.contact.name, message.contact.type);
480
- }
331
+ /**
332
+ * Returns the history messages for the given contact.
333
+ * @param contact The contact to get the history for.
334
+ * @param size Optional; The number of history items to retrieve. Defaults to 50.
335
+ * @return The history items for the given contact.
336
+ */
337
+ async getHistory(contact, size) {
338
+ const defaultHistorySize = 50;
339
+ const history = await _NativeZelloSdk.default.getHistory(contact.name, contact.type, size ?? defaultHistorySize);
340
+ if (!history) {
341
+ return [];
481
342
  }
343
+ return history.map(message => (0, _index.bridgeHistoryMessageToSdkHistoryMessage)(message)).filter(item => item !== undefined);
344
+ }
482
345
 
483
- /**
484
- * Stops the current history message playback.
485
- * This will trigger the {@link ZelloEvent.HISTORY_PLAYBACK_STOPPED} event.
486
- */
487
- }, {
488
- key: "stopHistoryMessagePlayback",
489
- value: function stopHistoryMessagePlayback() {
490
- if (_index.isAndroid) {
491
- ZelloAndroidSdkModule.stopHistoryMessagePlayback();
492
- } else {
493
- ZelloIOSSdkModule.stopHistoryMessagePlayback();
494
- }
495
- }
346
+ /**
347
+ * Plays the given history message.
348
+ * This will trigger the {@link ZelloEvent.HISTORY_PLAYBACK_STARTED} event.
349
+ * @param message The history message to play.
350
+ */
351
+ playHistoryMessage(message) {
352
+ _NativeZelloSdk.default.playHistoryMessage(message.historyId, message.contact.name, message.contact.type);
353
+ }
496
354
 
497
- /**
498
- * Returns the image data for the given history image message.
499
- * @param message The history image message to get the image data for.
500
- * @return The image data for the given history image message.
501
- */
502
- }, {
503
- key: "getImageDataForHistoryImageMessage",
504
- value: function getImageDataForHistoryImageMessage(message) {
505
- return new Promise(resolve => {
506
- if (_index.isAndroid) {
507
- ZelloAndroidSdkModule.getImageDataForHistoryImageMessage(message.historyId, message.contact.name, message.contact.type, data => resolve(data));
508
- } else {
509
- ZelloIOSSdkModule.getHistoryImageData(message.historyId, message.contact.name, message.contact.type, data => resolve(data));
510
- }
511
- });
512
- }
355
+ /**
356
+ * Stops the current history message playback.
357
+ * This will trigger the {@link ZelloEvent.HISTORY_PLAYBACK_STOPPED} event.
358
+ */
359
+ stopHistoryMessagePlayback() {
360
+ _NativeZelloSdk.default.stopHistoryMessagePlayback();
361
+ }
513
362
 
514
- /**
515
- * Ends the dispatch call for the given dispatch channel.
516
- * This will trigger the {@link ZelloEvent.DISPATCH_CALL_ENDED} event.
517
- *
518
- * If {@link consoleSettings | ZelloConsoleSettings.allowNonDispatchersToEndCalls} is false, this method will do nothing.
519
- *
520
- * @param channel The dispatch channel to end the call for.
521
- */
522
- }, {
523
- key: "endDispatchCall",
524
- value: function endDispatchCall(channel) {
525
- if (_index.isAndroid) {
526
- ZelloAndroidSdkModule.endDispatchCall(channel.name);
527
- } else {
528
- ZelloIOSSdkModule.endDispatchCall(channel.name);
529
- }
530
- }
363
+ /**
364
+ * Returns the image data for the given history image message.
365
+ * @param message The history image message to get the image data for.
366
+ * @return The image data for the given history image message.
367
+ */
368
+ getImageDataForHistoryImageMessage(message) {
369
+ return _NativeZelloSdk.default.getHistoryImageData(message.historyId, message.contact.name, message.contact.type);
370
+ }
531
371
 
532
- /**
533
- * Creates a new group conversation with the given users.
534
- * This will trigger the {@link ZelloEvent.GROUP_CONVERSATION_CREATED} and {@link ZelloEvent.CONTACT_LIST_UPDATED} events.
535
- * @param users The users to create the group conversation with.
536
- * @param displayName Optional; The display name of the group conversation. The conversation can be renamed later by using {@link renameGroupConversation}.
537
- */
538
- }, {
539
- key: "createGroupConversation",
540
- value: function createGroupConversation(users, displayName) {
541
- if (!this.consoleSettings?.allowGroupConversations) {
542
- return;
543
- }
544
- if (_index.isAndroid) {
545
- ZelloAndroidSdkModule.createGroupConversation(users.map(user => user.name), displayName);
546
- } else {
547
- ZelloIOSSdkModule.createGroupConversation(users.map(user => user.name), displayName);
548
- }
372
+ /**
373
+ * Ends the dispatch call for the given dispatch channel.
374
+ * This will trigger the {@link ZelloEvent.DISPATCH_CALL_ENDED} event.
375
+ *
376
+ * If {@link consoleSettings | ZelloConsoleSettings.allowNonDispatchersToEndCalls} is false, this method will do nothing.
377
+ *
378
+ * @param channel The dispatch channel to end the call for.
379
+ */
380
+ endDispatchCall(channel) {
381
+ _NativeZelloSdk.default.endDispatchCall(channel.name);
382
+ }
383
+
384
+ /**
385
+ * Creates a new group conversation with the given users.
386
+ * This will trigger the {@link ZelloEvent.GROUP_CONVERSATION_CREATED} and {@link ZelloEvent.CONTACT_LIST_UPDATED} events.
387
+ * @param users The users to create the group conversation with.
388
+ * @param displayName Optional; The display name of the group conversation. The conversation can be renamed later by using {@link renameGroupConversation}.
389
+ */
390
+ createGroupConversation(users, displayName) {
391
+ if (!this.consoleSettings?.allowGroupConversations) {
392
+ return;
549
393
  }
394
+ _NativeZelloSdk.default.createGroupConversation(users.map(user => user.name), displayName ?? '');
395
+ }
550
396
 
551
- /**
552
- * Adds users to the given group conversation.
553
- * This will trigger the {@link ZelloEvent.GROUP_CONVERSATION_USERS_ADDED} and {@link ZelloEvent.CONTACT_LIST_UPDATED} events.
554
- * @param groupConversation The group conversation to add users to.
555
- * @param users The users to add to the group conversation.
556
- */
557
- }, {
558
- key: "addUsersToGroupConversation",
559
- value: function addUsersToGroupConversation(groupConversation, users) {
560
- if (!this.consoleSettings?.allowGroupConversations) {
561
- return;
562
- }
563
- if (_index.isAndroid) {
564
- ZelloAndroidSdkModule.addUsersToGroupConversation(groupConversation.name, users.map(user => user.name));
565
- } else {
566
- ZelloIOSSdkModule.addUsersToGroupConversation(groupConversation.name, users.map(user => user.name));
567
- }
397
+ /**
398
+ * Adds users to the given group conversation.
399
+ * This will trigger the {@link ZelloEvent.GROUP_CONVERSATION_USERS_ADDED} and {@link ZelloEvent.CONTACT_LIST_UPDATED} events.
400
+ * @param groupConversation The group conversation to add users to.
401
+ * @param users The users to add to the group conversation.
402
+ */
403
+ addUsersToGroupConversation(groupConversation, users) {
404
+ if (!this.consoleSettings?.allowGroupConversations) {
405
+ return;
568
406
  }
407
+ _NativeZelloSdk.default.addUsersToGroupConversation(groupConversation.name, users.map(user => user.name));
408
+ }
569
409
 
570
- /**
571
- * Removes the user from the group conversation.
572
- * This will trigger the {@link ZelloEvent.GROUP_CONVERSATION_LEFT} and {@link ZelloEvent.CONTACT_LIST_UPDATED} events.
573
- * @param groupConversation The group conversation to leave.
574
- */
575
- }, {
576
- key: "leaveGroupConversation",
577
- value: function leaveGroupConversation(groupConversation) {
578
- if (!this.consoleSettings?.allowGroupConversations) {
579
- return;
580
- }
581
- if (_index.isAndroid) {
582
- ZelloAndroidSdkModule.leaveGroupConversation(groupConversation.name);
583
- } else {
584
- ZelloIOSSdkModule.leaveGroupConversation(groupConversation.name);
585
- }
410
+ /**
411
+ * Removes the user from the group conversation.
412
+ * This will trigger the {@link ZelloEvent.GROUP_CONVERSATION_LEFT} and {@link ZelloEvent.CONTACT_LIST_UPDATED} events.
413
+ * @param groupConversation The group conversation to leave.
414
+ */
415
+ leaveGroupConversation(groupConversation) {
416
+ if (!this.consoleSettings?.allowGroupConversations) {
417
+ return;
586
418
  }
419
+ _NativeZelloSdk.default.leaveGroupConversation(groupConversation.name);
420
+ }
587
421
 
588
- /**
589
- * Renames the group conversation.
590
- * This will trigger the {@link ZelloEvent.GROUP_CONVERSATION_RENAMED} and {@link ZelloEvent.CONTACT_LIST_UPDATED} events.
591
- * @param groupConversation The group conversation to rename.
592
- * @param name The new name for the group conversation.
593
- */
594
- }, {
595
- key: "renameGroupConversation",
596
- value: function renameGroupConversation(groupConversation, name) {
597
- if (!this.consoleSettings?.allowGroupConversations) {
598
- return;
599
- }
600
- if (_index.isAndroid) {
601
- ZelloAndroidSdkModule.renameGroupConversation(groupConversation.name, name);
602
- } else {
603
- ZelloIOSSdkModule.renameGroupConversation(groupConversation.name, name);
604
- }
422
+ /**
423
+ * Renames the group conversation.
424
+ * This will trigger the {@link ZelloEvent.GROUP_CONVERSATION_RENAMED} and {@link ZelloEvent.CONTACT_LIST_UPDATED} events.
425
+ * @param groupConversation The group conversation to rename.
426
+ * @param name The new name for the group conversation.
427
+ */
428
+ renameGroupConversation(groupConversation, name) {
429
+ if (!this.consoleSettings?.allowGroupConversations) {
430
+ return;
605
431
  }
606
- }, {
607
- key: "setupEventListener",
608
- value: function setupEventListener(eventEmitter) {
609
- this.eventListener = eventEmitter.addListener('zellosdk', event => {
610
- const eventName = event.eventName;
611
- switch (eventName) {
612
- case 'onConnectFailed':
613
- {
614
- this.state = _index2.ZelloConnectionState.Disconnected;
615
- const error = event.error?.toLowerCase() ?? _index2.ZelloConnectionError.Unknown;
616
- this.emit(_index4.ZelloEvent.CONNECT_FAILED, this.state, error);
617
- break;
618
- }
619
- case 'onConnectStarted':
620
- {
621
- this.state = _index2.ZelloConnectionState.Connecting;
622
- this.emit(_index4.ZelloEvent.CONNECT_STARTED, this.state);
623
- break;
624
- }
625
- case 'onConnectSucceeded':
626
- {
627
- this.state = _index2.ZelloConnectionState.Connected;
628
- this.emit(_index4.ZelloEvent.CONNECT_SUCCEEDED, this.state);
629
- break;
432
+ _NativeZelloSdk.default.renameGroupConversation(groupConversation.name, name);
433
+ }
434
+ setupEventListener() {
435
+ this.eventListener = _reactNative.DeviceEventEmitter.addListener('zellosdk', event => {
436
+ const eventName = event.eventName;
437
+ switch (eventName) {
438
+ case 'onConnectFailed':
439
+ {
440
+ this.state = _index2.ZelloConnectionState.Disconnected;
441
+ const error = event.error?.toLowerCase() ?? _index2.ZelloConnectionError.Unknown;
442
+ this.emit(_index4.ZelloEvent.CONNECT_FAILED, this.state, error);
443
+ break;
444
+ }
445
+ case 'onConnectStarted':
446
+ {
447
+ this.state = _index2.ZelloConnectionState.Connecting;
448
+ this.emit(_index4.ZelloEvent.CONNECT_STARTED, this.state);
449
+ break;
450
+ }
451
+ case 'onConnectSucceeded':
452
+ {
453
+ this.state = _index2.ZelloConnectionState.Connected;
454
+ this.emit(_index4.ZelloEvent.CONNECT_SUCCEEDED, this.state);
455
+ break;
456
+ }
457
+ case 'onDisconnected':
458
+ {
459
+ this.state = _index2.ZelloConnectionState.Disconnected;
460
+ this.emit(_index4.ZelloEvent.DISCONNECTED, this.state);
461
+ break;
462
+ }
463
+ case 'onWillReconnect':
464
+ {
465
+ this.state = _index2.ZelloConnectionState.Reconnecting;
466
+ this.emit(_index4.ZelloEvent.RECONNECTING, this.state);
467
+ break;
468
+ }
469
+ case 'onContactListUpdated':
470
+ {
471
+ this.clearContactList();
472
+ this.users = event.users.map(user => (0, _index.bridgeContactToSdkContact)(user));
473
+ this.users.sort(_index3.compareNameAscending);
474
+ this.channels = event.channels.map(channel => (0, _index.bridgeContactToSdkContact)(channel));
475
+ this.channels.sort(_index3.compareNameAscending);
476
+ this.groupConversations = event.groupConversations.map(groupConversation => (0, _index.bridgeContactToSdkContact)(groupConversation));
477
+ this.groupConversations.sort(_index3.compareNameAscending);
478
+ if (event.emergencyChannel) {
479
+ this.emergencyChannel = (0, _index.bridgeContactToSdkContact)(event.emergencyChannel);
480
+ }
481
+ this.emit(_index4.ZelloEvent.CONTACT_LIST_UPDATED, this.users, this.channels, this.groupConversations);
482
+ break;
483
+ }
484
+ case 'onSelectedContactChanged':
485
+ {
486
+ this.selectedContact = event.contact ? (0, _index.bridgeContactToSdkContact)(event.contact) : undefined;
487
+ this.emit(_index4.ZelloEvent.SELECTED_CONTACT_CHANGED, this.selectedContact);
488
+ break;
489
+ }
490
+ case 'onAccountStatusChanged':
491
+ {
492
+ const statusValue = event.status?.toLowerCase();
493
+ if (!statusValue || Object.values(_index2.ZelloAccountStatus).includes(statusValue)) {
494
+ this.accountStatus = statusValue;
495
+ this.emit(_index4.ZelloEvent.ACCOUNT_STATUS_CHANGED, this.accountStatus);
630
496
  }
631
- case 'onDisconnected':
632
- {
633
- this.state = _index2.ZelloConnectionState.Disconnected;
634
- this.emit(_index4.ZelloEvent.DISCONNECTED, this.state);
497
+ break;
498
+ }
499
+ case 'onIncomingVoiceMessageStarted':
500
+ {
501
+ const contact = (0, _index.bridgeContactToSdkContact)(event.contact);
502
+ if (!contact) {
635
503
  break;
636
504
  }
637
- case 'onWillReconnect':
638
- {
639
- this.state = _index2.ZelloConnectionState.Reconnecting;
640
- this.emit(_index4.ZelloEvent.RECONNECTING, this.state);
505
+ this.incomingVoiceMessage = new _index2.ZelloIncomingVoiceMessage(contact, (0, _index.bridgeChannelUserToSdkChannelUser)(event.channelUser), parseInt(event.timestamp, 10), event.isTranslation === true);
506
+ this.emit(_index4.ZelloEvent.INCOMING_VOICE_MESSAGE_STARTED, this.incomingVoiceMessage);
507
+ break;
508
+ }
509
+ case 'onIncomingVoiceMessageStopped':
510
+ {
511
+ this.incomingVoiceMessage = undefined;
512
+ const contact = (0, _index.bridgeContactToSdkContact)(event.contact);
513
+ if (!contact) {
641
514
  break;
642
515
  }
643
- case 'onContactListUpdated':
644
- {
645
- this.clearContactList();
646
- this.users = event.users.map(user => (0, _index.bridgeContactToSdkContact)(user));
647
- this.users.sort(_index3.compareNameAscending);
648
- this.channels = event.channels.map(channel => (0, _index.bridgeContactToSdkContact)(channel));
649
- this.channels.sort(_index3.compareNameAscending);
650
- this.groupConversations = event.groupConversations.map(groupConversation => (0, _index.bridgeContactToSdkContact)(groupConversation));
651
- this.groupConversations.sort(_index3.compareNameAscending);
652
- if (event.emergencyChannel) {
653
- this.emergencyChannel = (0, _index.bridgeContactToSdkContact)(event.emergencyChannel);
654
- }
655
- this.emit(_index4.ZelloEvent.CONTACT_LIST_UPDATED, this.users, this.channels, this.groupConversations);
516
+ this.emit(_index4.ZelloEvent.INCOMING_VOICE_MESSAGE_STOPPED, new _index2.ZelloIncomingVoiceMessage(contact, (0, _index.bridgeChannelUserToSdkChannelUser)(event.channelUser), parseInt(event.timestamp, 10), event.isTranslation === true));
517
+ break;
518
+ }
519
+ case 'onOutgoingVoiceMessageConnecting':
520
+ {
521
+ const contact = (0, _index.bridgeContactToSdkContact)(event.contact);
522
+ if (!contact) {
656
523
  break;
657
524
  }
658
- case 'onSelectedContactChanged':
659
- {
660
- this.selectedContact = event.contact ? (0, _index.bridgeContactToSdkContact)(event.contact) : undefined;
661
- this.emit(_index4.ZelloEvent.SELECTED_CONTACT_CHANGED, this.selectedContact);
525
+ this.outgoingVoiceMessage = new _index2.ZelloOutgoingVoiceMessage(contact, parseInt(event.timestamp, 10), _index2.ZelloOutgoingVoiceMessageState.Connecting);
526
+ this.emit(_index4.ZelloEvent.OUTGOING_VOICE_MESSAGE_CONNECTING, this.outgoingVoiceMessage);
527
+ break;
528
+ }
529
+ case 'onOutgoingVoiceMessageStarted':
530
+ {
531
+ const contact = (0, _index.bridgeContactToSdkContact)(event.contact);
532
+ if (!contact) {
662
533
  break;
663
534
  }
664
- case 'onAccountStatusChanged':
665
- {
666
- const statusValue = event.status?.toLowerCase();
667
- if (!statusValue || Object.values(_index2.ZelloAccountStatus).includes(statusValue)) {
668
- this.accountStatus = statusValue;
669
- this.emit(_index4.ZelloEvent.ACCOUNT_STATUS_CHANGED, this.accountStatus);
670
- }
535
+ this.outgoingVoiceMessage = new _index2.ZelloOutgoingVoiceMessage(contact, parseInt(event.timestamp, 10), _index2.ZelloOutgoingVoiceMessageState.Sending);
536
+ this.emit(_index4.ZelloEvent.OUTGOING_VOICE_MESSAGE_STARTED, this.outgoingVoiceMessage);
537
+ break;
538
+ }
539
+ case 'onOutgoingVoiceMessageStopped':
540
+ {
541
+ this.outgoingVoiceMessage = undefined;
542
+ const contact = (0, _index.bridgeContactToSdkContact)(event.contact);
543
+ if (!contact) {
671
544
  break;
672
545
  }
673
- case 'onIncomingVoiceMessageStarted':
674
- {
675
- const contact = (0, _index.bridgeContactToSdkContact)(event.contact);
676
- if (!contact) {
677
- break;
678
- }
679
- this.incomingVoiceMessage = new _index2.ZelloIncomingVoiceMessage(contact, (0, _index.bridgeChannelUserToSdkChannelUser)(event.channelUser), parseInt(event.timestamp, 10));
680
- this.emit(_index4.ZelloEvent.INCOMING_VOICE_MESSAGE_STARTED, this.incomingVoiceMessage);
681
- break;
546
+ const isError = event.error != null; // This checks for both null and undefined
547
+ let error;
548
+ if (isError) {
549
+ error = event.error?.toLowerCase() ?? _index2.ZelloOutgoingVoiceMessageError.Unknown;
682
550
  }
683
- case 'onIncomingVoiceMessageStopped':
684
- {
685
- this.incomingVoiceMessage = undefined;
686
- const contact = (0, _index.bridgeContactToSdkContact)(event.contact);
687
- if (!contact) {
688
- break;
689
- }
690
- this.emit(_index4.ZelloEvent.INCOMING_VOICE_MESSAGE_STOPPED, new _index2.ZelloIncomingVoiceMessage(contact, (0, _index.bridgeChannelUserToSdkChannelUser)(event.channelUser), parseInt(event.timestamp, 10)));
551
+ this.emit(_index4.ZelloEvent.OUTGOING_VOICE_MESSAGE_STOPPED, new _index2.ZelloOutgoingVoiceMessage(contact, parseInt(event.timestamp, 10), isError ? _index2.ZelloOutgoingVoiceMessageState.Failed : _index2.ZelloOutgoingVoiceMessageState.Sent), error);
552
+ break;
553
+ }
554
+ case 'onIncomingImageMessage':
555
+ {
556
+ const contact = (0, _index.bridgeContactToSdkContact)(event.contact);
557
+ if (!contact) {
691
558
  break;
692
559
  }
693
- case 'onOutgoingVoiceMessageConnecting':
694
- {
695
- const contact = (0, _index.bridgeContactToSdkContact)(event.contact);
696
- if (!contact) {
697
- break;
698
- }
699
- this.outgoingVoiceMessage = new _index2.ZelloOutgoingVoiceMessage(contact, parseInt(event.timestamp, 10), _index2.ZelloOutgoingVoiceMessageState.Connecting);
700
- this.emit(_index4.ZelloEvent.OUTGOING_VOICE_MESSAGE_CONNECTING, this.outgoingVoiceMessage);
560
+ this.emit(_index4.ZelloEvent.INCOMING_IMAGE_MESSAGE_RECEIVED, new _index2.ZelloImageMessage(contact, (0, _index.bridgeChannelUserToSdkChannelUser)(event.channelUser), true, parseInt(event.timestamp, 10), event.thumbnail, event.image));
561
+ break;
562
+ }
563
+ case 'onOutgoingImageMessageSent':
564
+ {
565
+ const contact = (0, _index.bridgeContactToSdkContact)(event.contact);
566
+ if (!contact) {
701
567
  break;
702
568
  }
703
- case 'onOutgoingVoiceMessageStarted':
704
- {
705
- const contact = (0, _index.bridgeContactToSdkContact)(event.contact);
706
- if (!contact) {
707
- break;
708
- }
709
- this.outgoingVoiceMessage = new _index2.ZelloOutgoingVoiceMessage(contact, parseInt(event.timestamp, 10), _index2.ZelloOutgoingVoiceMessageState.Sending);
710
- this.emit(_index4.ZelloEvent.OUTGOING_VOICE_MESSAGE_STARTED, this.outgoingVoiceMessage);
569
+ this.emit(_index4.ZelloEvent.OUTGOING_IMAGE_MESSAGE_SENT, new _index2.ZelloImageMessage(contact, undefined, false, parseInt(event.timestamp, 10), event.thumbnail, event.image));
570
+ break;
571
+ }
572
+ case 'onOutgoingImageMessageSendFailed':
573
+ {
574
+ const contact = (0, _index.bridgeContactToSdkContact)(event.contact);
575
+ if (!contact) {
711
576
  break;
712
577
  }
713
- case 'onOutgoingVoiceMessageStopped':
714
- {
715
- this.outgoingVoiceMessage = undefined;
716
- const contact = (0, _index.bridgeContactToSdkContact)(event.contact);
717
- if (!contact) {
718
- break;
719
- }
720
- const isError = event.error != null; // This checks for both null and undefined
721
- let error;
722
- if (isError) {
723
- error = event.error?.toLowerCase() ?? _index2.ZelloOutgoingVoiceMessageError.Unknown;
724
- }
725
- this.emit(_index4.ZelloEvent.OUTGOING_VOICE_MESSAGE_STOPPED, new _index2.ZelloOutgoingVoiceMessage(contact, parseInt(event.timestamp, 10), isError ? _index2.ZelloOutgoingVoiceMessageState.Failed : _index2.ZelloOutgoingVoiceMessageState.Sent), error);
578
+ this.emit(_index4.ZelloEvent.OUTGOING_IMAGE_MESSAGE_SEND_FAILED, new _index2.ZelloImageMessage(contact, undefined, false, parseInt(event.timestamp, 10), event.thumbnail, event.image));
579
+ break;
580
+ }
581
+ case 'onIncomingAlertMessage':
582
+ {
583
+ const contact = (0, _index.bridgeContactToSdkContact)(event.contact);
584
+ if (!contact) {
726
585
  break;
727
586
  }
728
- case 'onIncomingImageMessage':
729
- {
730
- const contact = (0, _index.bridgeContactToSdkContact)(event.contact);
731
- if (!contact) {
732
- break;
733
- }
734
- this.emit(_index4.ZelloEvent.INCOMING_IMAGE_MESSAGE_RECEIVED, new _index2.ZelloImageMessage(contact, (0, _index.bridgeChannelUserToSdkChannelUser)(event.channelUser), true, parseInt(event.timestamp, 10), event.thumbnail, event.image));
587
+ this.emit(_index4.ZelloEvent.INCOMING_ALERT_MESSAGE_RECEIVED, new _index2.ZelloAlertMessage(contact, (0, _index.bridgeChannelUserToSdkChannelUser)(event.channelUser), true, parseInt(event.timestamp, 10), event.text));
588
+ break;
589
+ }
590
+ case 'onOutgoingAlertMessageSent':
591
+ {
592
+ const contact = (0, _index.bridgeContactToSdkContact)(event.contact);
593
+ if (!contact) {
735
594
  break;
736
595
  }
737
- case 'onOutgoingImageMessageSent':
738
- {
739
- const contact = (0, _index.bridgeContactToSdkContact)(event.contact);
740
- if (!contact) {
741
- break;
742
- }
743
- this.emit(_index4.ZelloEvent.OUTGOING_IMAGE_MESSAGE_SENT, new _index2.ZelloImageMessage(contact, undefined, false, parseInt(event.timestamp, 10), event.thumbnail, event.image));
596
+ this.emit(_index4.ZelloEvent.OUTGOING_ALERT_MESSAGE_SENT, new _index2.ZelloAlertMessage(contact, undefined, false, parseInt(event.timestamp, 10), event.text));
597
+ break;
598
+ }
599
+ case 'onOutgoingAlertMessageSendFailed':
600
+ {
601
+ const contact = (0, _index.bridgeContactToSdkContact)(event.contact);
602
+ if (!contact) {
744
603
  break;
745
604
  }
746
- case 'onOutgoingImageMessageSendFailed':
747
- {
748
- const contact = (0, _index.bridgeContactToSdkContact)(event.contact);
749
- if (!contact) {
750
- break;
751
- }
752
- this.emit(_index4.ZelloEvent.OUTGOING_IMAGE_MESSAGE_SEND_FAILED, new _index2.ZelloImageMessage(contact, undefined, false, parseInt(event.timestamp, 10), event.thumbnail, event.image));
605
+ this.emit(_index4.ZelloEvent.OUTGOING_ALERT_MESSAGE_SEND_FAILED, new _index2.ZelloAlertMessage(contact, undefined, false, parseInt(event.timestamp, 10), event.text));
606
+ break;
607
+ }
608
+ case 'onIncomingTextMessage':
609
+ {
610
+ const contact = (0, _index.bridgeContactToSdkContact)(event.contact);
611
+ if (!contact) {
753
612
  break;
754
613
  }
755
- case 'onIncomingAlertMessage':
756
- {
757
- const contact = (0, _index.bridgeContactToSdkContact)(event.contact);
758
- if (!contact) {
759
- break;
760
- }
761
- this.emit(_index4.ZelloEvent.INCOMING_ALERT_MESSAGE_RECEIVED, new _index2.ZelloAlertMessage(contact, (0, _index.bridgeChannelUserToSdkChannelUser)(event.channelUser), true, parseInt(event.timestamp, 10), event.text));
614
+ this.emit(_index4.ZelloEvent.INCOMING_TEXT_MESSAGE_RECEIVED, new _index2.ZelloTextMessage(contact, (0, _index.bridgeChannelUserToSdkChannelUser)(event.channelUser), true, parseInt(event.timestamp, 10), event.text));
615
+ break;
616
+ }
617
+ case 'onOutgoingTextMessageSent':
618
+ {
619
+ const contact = (0, _index.bridgeContactToSdkContact)(event.contact);
620
+ if (!contact) {
762
621
  break;
763
622
  }
764
- case 'onOutgoingAlertMessageSent':
765
- {
766
- const contact = (0, _index.bridgeContactToSdkContact)(event.contact);
767
- if (!contact) {
768
- break;
769
- }
770
- this.emit(_index4.ZelloEvent.OUTGOING_ALERT_MESSAGE_SENT, new _index2.ZelloAlertMessage(contact, undefined, false, parseInt(event.timestamp, 10), event.text));
623
+ this.emit(_index4.ZelloEvent.OUTGOING_TEXT_MESSAGE_SENT, new _index2.ZelloTextMessage(contact, undefined, false, parseInt(event.timestamp, 10), event.text));
624
+ break;
625
+ }
626
+ case 'onOutgoingTextMessageSendFailed':
627
+ {
628
+ const contact = (0, _index.bridgeContactToSdkContact)(event.contact);
629
+ if (!contact) {
771
630
  break;
772
631
  }
773
- case 'onOutgoingAlertMessageSendFailed':
774
- {
775
- const contact = (0, _index.bridgeContactToSdkContact)(event.contact);
776
- if (!contact) {
777
- break;
778
- }
779
- this.emit(_index4.ZelloEvent.OUTGOING_ALERT_MESSAGE_SEND_FAILED, new _index2.ZelloAlertMessage(contact, undefined, false, parseInt(event.timestamp, 10), event.text));
632
+ this.emit(_index4.ZelloEvent.OUTGOING_TEXT_MESSAGE_SEND_FAILED, new _index2.ZelloTextMessage(contact, undefined, false, parseInt(event.timestamp, 10), event.text));
633
+ break;
634
+ }
635
+ case 'onIncomingLocationMessage':
636
+ {
637
+ const contact = (0, _index.bridgeContactToSdkContact)(event.contact);
638
+ if (!contact) {
780
639
  break;
781
640
  }
782
- case 'onIncomingTextMessage':
783
- {
784
- const contact = (0, _index.bridgeContactToSdkContact)(event.contact);
785
- if (!contact) {
786
- break;
787
- }
788
- this.emit(_index4.ZelloEvent.INCOMING_TEXT_MESSAGE_RECEIVED, new _index2.ZelloTextMessage(contact, (0, _index.bridgeChannelUserToSdkChannelUser)(event.channelUser), true, parseInt(event.timestamp, 10), event.text));
641
+ this.emit(_index4.ZelloEvent.INCOMING_LOCATION_MESSAGE_RECEIVED, new _index2.ZelloLocationMessage(contact, (0, _index.bridgeChannelUserToSdkChannelUser)(event.channelUser), true, parseInt(event.timestamp, 10), event.latitude, event.longitude, event.accuracy, event.address));
642
+ break;
643
+ }
644
+ case 'onOutgoingLocationMessageSent':
645
+ {
646
+ const contact = (0, _index.bridgeContactToSdkContact)(event.contact);
647
+ if (!contact) {
789
648
  break;
790
649
  }
791
- case 'onOutgoingTextMessageSent':
792
- {
793
- const contact = (0, _index.bridgeContactToSdkContact)(event.contact);
794
- if (!contact) {
795
- break;
796
- }
797
- this.emit(_index4.ZelloEvent.OUTGOING_TEXT_MESSAGE_SENT, new _index2.ZelloTextMessage(contact, undefined, false, parseInt(event.timestamp, 10), event.text));
650
+ this.emit(_index4.ZelloEvent.OUTGOING_LOCATION_MESSAGE_SENT, new _index2.ZelloLocationMessage(contact, undefined, false, parseInt(event.timestamp, 10), event.latitude, event.longitude, event.accuracy, event.address));
651
+ break;
652
+ }
653
+ case 'onOutgoingLocationMessageSendFailed':
654
+ {
655
+ const contact = (0, _index.bridgeContactToSdkContact)(event.contact);
656
+ if (!contact) {
798
657
  break;
799
658
  }
800
- case 'onOutgoingTextMessageSendFailed':
801
- {
802
- const contact = (0, _index.bridgeContactToSdkContact)(event.contact);
803
- if (!contact) {
804
- break;
659
+ this.emit(_index4.ZelloEvent.OUTGOING_LOCATION_MESSAGE_SEND_FAILED, new _index2.ZelloLocationMessage(contact, undefined, false, parseInt(event.timestamp, 10), event.latitude, event.longitude, event.accuracy, event.address));
660
+ break;
661
+ }
662
+ case 'onIncomingEmergencyStarted':
663
+ {
664
+ this.incomingEmergencies = [];
665
+ event.emergencies.forEach(emergency => {
666
+ const incomingEmergency = (0, _index.bridgeIncomingEmergencyToSdkIncomingEmergency)(emergency);
667
+ if (incomingEmergency) {
668
+ this.incomingEmergencies.push(incomingEmergency);
805
669
  }
806
- this.emit(_index4.ZelloEvent.OUTGOING_TEXT_MESSAGE_SEND_FAILED, new _index2.ZelloTextMessage(contact, undefined, false, parseInt(event.timestamp, 10), event.text));
807
- break;
808
- }
809
- case 'onIncomingLocationMessage':
810
- {
811
- const contact = (0, _index.bridgeContactToSdkContact)(event.contact);
812
- if (!contact) {
813
- break;
670
+ });
671
+ this.incomingEmergencies.sort((a, b) => a.startTimestamp - b.startTimestamp);
672
+ this.emit(_index4.ZelloEvent.INCOMING_EMERGENCY_STARTED, (0, _index.bridgeIncomingEmergencyToSdkIncomingEmergency)(event.emergency), this.incomingEmergencies);
673
+ break;
674
+ }
675
+ case 'onIncomingEmergencyStopped':
676
+ {
677
+ this.incomingEmergencies = [];
678
+ event.emergencies.forEach(emergency => {
679
+ const incomingEmergency = (0, _index.bridgeIncomingEmergencyToSdkIncomingEmergency)(emergency);
680
+ if (incomingEmergency) {
681
+ this.incomingEmergencies.push(incomingEmergency);
814
682
  }
815
- this.emit(_index4.ZelloEvent.INCOMING_LOCATION_MESSAGE_RECEIVED, new _index2.ZelloLocationMessage(contact, (0, _index.bridgeChannelUserToSdkChannelUser)(event.channelUser), true, parseInt(event.timestamp, 10), event.latitude, event.longitude, event.accuracy, event.address));
683
+ });
684
+ this.emit(_index4.ZelloEvent.INCOMING_EMERGENCY_STOPPED, (0, _index.bridgeIncomingEmergencyToSdkIncomingEmergency)(event.emergency));
685
+ break;
686
+ }
687
+ case 'onOutgoingEmergencyStarted':
688
+ {
689
+ const channel = (0, _index.bridgeContactToSdkContact)(event.channel);
690
+ if (!channel) {
816
691
  break;
817
692
  }
818
- case 'onOutgoingLocationMessageSent':
819
- {
820
- const contact = (0, _index.bridgeContactToSdkContact)(event.contact);
821
- if (!contact) {
822
- break;
823
- }
824
- this.emit(_index4.ZelloEvent.OUTGOING_LOCATION_MESSAGE_SENT, new _index2.ZelloLocationMessage(contact, undefined, false, parseInt(event.timestamp, 10), event.latitude, event.longitude, event.accuracy, event.address));
693
+ this.outgoingEmergency = new _index2.ZelloOutgoingEmergency(channel, parseInt(event.startTimestamp, 10), undefined);
694
+ this.emit(_index4.ZelloEvent.OUTGOING_EMERGENCY_STARTED, this.outgoingEmergency);
695
+ break;
696
+ }
697
+ case 'onOutgoingEmergencyStopped':
698
+ {
699
+ const channel = (0, _index.bridgeContactToSdkContact)(event.channel);
700
+ if (!channel) {
825
701
  break;
826
702
  }
827
- case 'onOutgoingLocationMessageSendFailed':
828
- {
829
- const contact = (0, _index.bridgeContactToSdkContact)(event.contact);
703
+ this.outgoingEmergency = undefined;
704
+ this.emit(_index4.ZelloEvent.OUTGOING_EMERGENCY_STOPPED, new _index2.ZelloOutgoingEmergency(channel, parseInt(event.startTimestamp, 10), event.endTimestamp));
705
+ break;
706
+ }
707
+ case 'onRecentsUpdated':
708
+ {
709
+ this.recents = event.recents.map(recent => {
710
+ const contact = (0, _index.bridgeContactToSdkContact)(recent.contact);
830
711
  if (!contact) {
831
- break;
832
- }
833
- this.emit(_index4.ZelloEvent.OUTGOING_LOCATION_MESSAGE_SEND_FAILED, new _index2.ZelloLocationMessage(contact, undefined, false, parseInt(event.timestamp, 10), event.latitude, event.longitude, event.accuracy, event.address));
834
- break;
835
- }
836
- case 'onIncomingEmergencyStarted':
837
- {
838
- this.incomingEmergencies = [];
839
- event.emergencies.forEach(emergency => {
840
- const incomingEmergency = (0, _index.bridgeIncomingEmergencyToSdkIncomingEmergency)(emergency);
841
- if (incomingEmergency) {
842
- this.incomingEmergencies.push(incomingEmergency);
843
- }
844
- });
845
- this.incomingEmergencies.sort((a, b) => a.startTimestamp - b.startTimestamp);
846
- this.emit(_index4.ZelloEvent.INCOMING_EMERGENCY_STARTED, (0, _index.bridgeIncomingEmergencyToSdkIncomingEmergency)(event.emergency), this.incomingEmergencies);
847
- break;
848
- }
849
- case 'onIncomingEmergencyStopped':
850
- {
851
- this.incomingEmergencies = [];
852
- event.emergencies.forEach(emergency => {
853
- const incomingEmergency = (0, _index.bridgeIncomingEmergencyToSdkIncomingEmergency)(emergency);
854
- if (incomingEmergency) {
855
- this.incomingEmergencies.push(incomingEmergency);
856
- }
857
- });
858
- this.emit(_index4.ZelloEvent.INCOMING_EMERGENCY_STOPPED, (0, _index.bridgeIncomingEmergencyToSdkIncomingEmergency)(event.emergency));
859
- break;
860
- }
861
- case 'onOutgoingEmergencyStarted':
862
- {
863
- const channel = (0, _index.bridgeContactToSdkContact)(event.channel);
864
- if (!channel) {
865
- break;
712
+ return undefined;
866
713
  }
867
- this.outgoingEmergency = new _index2.ZelloOutgoingEmergency(channel, parseInt(event.startTimestamp, 10), undefined);
868
- this.emit(_index4.ZelloEvent.OUTGOING_EMERGENCY_STARTED, this.outgoingEmergency);
869
- break;
870
- }
871
- case 'onOutgoingEmergencyStopped':
872
- {
873
- const channel = (0, _index.bridgeContactToSdkContact)(event.channel);
874
- if (!channel) {
875
- break;
876
- }
877
- this.outgoingEmergency = undefined;
878
- this.emit(_index4.ZelloEvent.OUTGOING_EMERGENCY_STOPPED, new _index2.ZelloOutgoingEmergency(channel, parseInt(event.startTimestamp, 10), event.endTimestamp));
879
- break;
880
- }
881
- case 'onRecentsUpdated':
882
- {
883
- this.recents = event.recents.map(recent => {
884
- const contact = (0, _index.bridgeContactToSdkContact)(recent.contact);
885
- if (!contact) {
886
- return undefined;
887
- }
888
- return new _index2.ZelloRecentEntry(contact, (0, _index.bridgeChannelUserToSdkChannelUser)(event.channelUser), parseInt(recent.timestamp, 10), recent.type.toLowerCase(), recent.incoming);
889
- }).filter(recent => recent !== undefined);
890
- this.emit(_index4.ZelloEvent.RECENTS_UPDATED, this.recents);
891
- break;
892
- }
893
- case 'onHistoryUpdated':
894
- {
895
- this.emit(_index4.ZelloEvent.HISTORY_UPDATED);
896
- break;
897
- }
898
- case 'onHistoryPlaybackStarted':
899
- {
900
- this.historyVoiceMessage = (0, _index.bridgeHistoryMessageToSdkHistoryMessage)(event);
901
- this.emit(_index4.ZelloEvent.HISTORY_PLAYBACK_STARTED, this.historyVoiceMessage);
902
- break;
903
- }
904
- case 'onHistoryPlaybackStopped':
905
- {
906
- this.historyVoiceMessage = undefined;
907
- this.emit(_index4.ZelloEvent.HISTORY_PLAYBACK_STOPPED, this.historyVoiceMessage);
714
+ return new _index2.ZelloRecentEntry(contact, (0, _index.bridgeChannelUserToSdkChannelUser)(event.channelUser), parseInt(recent.timestamp, 10), recent.type.toLowerCase(), recent.incoming);
715
+ }).filter(recent => recent !== undefined);
716
+ this.emit(_index4.ZelloEvent.RECENTS_UPDATED, this.recents);
717
+ break;
718
+ }
719
+ case 'onHistoryUpdated':
720
+ {
721
+ this.emit(_index4.ZelloEvent.HISTORY_UPDATED);
722
+ break;
723
+ }
724
+ case 'onHistoryPlaybackStarted':
725
+ {
726
+ this.historyVoiceMessage = (0, _index.bridgeHistoryMessageToSdkHistoryMessage)(event);
727
+ this.emit(_index4.ZelloEvent.HISTORY_PLAYBACK_STARTED, this.historyVoiceMessage);
728
+ break;
729
+ }
730
+ case 'onHistoryPlaybackStopped':
731
+ {
732
+ this.historyVoiceMessage = undefined;
733
+ this.emit(_index4.ZelloEvent.HISTORY_PLAYBACK_STOPPED, this.historyVoiceMessage);
734
+ break;
735
+ }
736
+ case 'onHistoryVoiceMessageTranscriptionAvailable':
737
+ {
738
+ const message = (0, _index.bridgeHistoryMessageToSdkHistoryMessage)(event);
739
+ if (!(message instanceof _index2.ZelloHistoryVoiceMessage)) {
908
740
  break;
909
741
  }
910
- case 'onConsoleSettingsChanged':
911
- {
912
- this.consoleSettings = (0, _index.bridgeConsoleSettingsToSdkConsoleSettings)(event);
913
- this.emit(_index4.ZelloEvent.CONSOLE_SETTINGS_CHANGED, this.consoleSettings);
742
+ this.emit(_index4.ZelloEvent.HISTORY_VOICE_MESSAGE_TRANSCRIPTION_AVAILABLE, message);
743
+ break;
744
+ }
745
+ case 'onConsoleSettingsChanged':
746
+ {
747
+ this.consoleSettings = (0, _index.bridgeConsoleSettingsToSdkConsoleSettings)(event);
748
+ this.emit(_index4.ZelloEvent.CONSOLE_SETTINGS_CHANGED, this.consoleSettings);
749
+ break;
750
+ }
751
+ case 'onDispatchCallTransferred':
752
+ case 'onDispatchCallEnded':
753
+ case 'onDispatchCallActive':
754
+ case 'onDispatchCallPending':
755
+ {
756
+ this.processDispatchCallEvent(event);
757
+ break;
758
+ }
759
+ case 'onGroupConversationLeft':
760
+ {
761
+ const groupConversation = (0, _index.bridgeContactToSdkContact)(event.conversation);
762
+ if (!groupConversation) {
914
763
  break;
915
764
  }
916
- case 'onDispatchCallTransferred':
917
- case 'onDispatchCallEnded':
918
- case 'onDispatchCallActive':
919
- case 'onDispatchCallPending':
920
- {
921
- this.processDispatchCallEvent(event);
765
+ this.emit(_index4.ZelloEvent.GROUP_CONVERSATION_LEFT, groupConversation);
766
+ break;
767
+ }
768
+ case 'onGroupConversationInvite':
769
+ {
770
+ const groupConversation = (0, _index.bridgeContactToSdkContact)(event.conversation);
771
+ if (!groupConversation) {
922
772
  break;
923
773
  }
924
- case 'onGroupConversationLeft':
925
- {
926
- const groupConversation = (0, _index.bridgeContactToSdkContact)(event.conversation);
927
- if (!groupConversation) {
928
- break;
929
- }
930
- this.emit(_index4.ZelloEvent.GROUP_CONVERSATION_LEFT, groupConversation);
774
+ this.emit(_index4.ZelloEvent.GROUP_CONVERSATION_INVITE, groupConversation);
775
+ break;
776
+ }
777
+ case 'onGroupConversationCreated':
778
+ {
779
+ const groupConversation = (0, _index.bridgeContactToSdkContact)(event.conversation);
780
+ if (!groupConversation) {
931
781
  break;
932
782
  }
933
- case 'onGroupConversationInvite':
934
- {
935
- const groupConversation = (0, _index.bridgeContactToSdkContact)(event.conversation);
936
- if (!groupConversation) {
937
- break;
938
- }
939
- this.emit(_index4.ZelloEvent.GROUP_CONVERSATION_INVITE, groupConversation);
783
+ this.emit(_index4.ZelloEvent.GROUP_CONVERSATION_CREATED, groupConversation);
784
+ break;
785
+ }
786
+ case 'onGroupConversationRenamed':
787
+ {
788
+ const groupConversation = (0, _index.bridgeContactToSdkContact)(event.conversation);
789
+ if (!groupConversation) {
940
790
  break;
941
791
  }
942
- case 'onGroupConversationCreated':
943
- {
944
- const groupConversation = (0, _index.bridgeContactToSdkContact)(event.conversation);
945
- if (!groupConversation) {
946
- break;
947
- }
948
- this.emit(_index4.ZelloEvent.GROUP_CONVERSATION_CREATED, groupConversation);
792
+ this.emit(_index4.ZelloEvent.GROUP_CONVERSATION_RENAMED, groupConversation);
793
+ break;
794
+ }
795
+ case 'onGroupConversationUsersAdded':
796
+ {
797
+ const groupConversation = (0, _index.bridgeContactToSdkContact)(event.conversation);
798
+ if (!groupConversation) {
949
799
  break;
950
800
  }
951
- case 'onGroupConversationRenamed':
952
- {
953
- const groupConversation = (0, _index.bridgeContactToSdkContact)(event.conversation);
954
- if (!groupConversation) {
955
- break;
956
- }
957
- this.emit(_index4.ZelloEvent.GROUP_CONVERSATION_RENAMED, groupConversation);
958
- break;
801
+ const users = event.users.map(user => (0, _index.bridgeChannelUserToSdkChannelUser)(user));
802
+ if (!users || users.length === 0) {
803
+ return;
959
804
  }
960
- case 'onGroupConversationUsersAdded':
961
- {
962
- const groupConversation = (0, _index.bridgeContactToSdkContact)(event.conversation);
963
- if (!groupConversation) {
964
- break;
965
- }
966
- const users = event.users.map(user => (0, _index.bridgeChannelUserToSdkChannelUser)(user));
967
- if (!users || users.length === 0) {
968
- return;
969
- }
970
- this.emit(_index4.ZelloEvent.GROUP_CONVERSATION_USERS_ADDED, groupConversation, users);
805
+ this.emit(_index4.ZelloEvent.GROUP_CONVERSATION_USERS_ADDED, groupConversation, users);
806
+ break;
807
+ }
808
+ case 'onGroupConversationUsersLeft':
809
+ {
810
+ const groupConversation = (0, _index.bridgeContactToSdkContact)(event.conversation);
811
+ if (!groupConversation) {
971
812
  break;
972
813
  }
973
- case 'onGroupConversationUsersLeft':
974
- {
975
- const groupConversation = (0, _index.bridgeContactToSdkContact)(event.conversation);
976
- if (!groupConversation) {
977
- break;
978
- }
979
- const users = event.users.map(user => (0, _index.bridgeChannelUserToSdkChannelUser)(user));
980
- if (!users || users.length === 0) {
981
- return;
982
- }
983
- this.emit(_index4.ZelloEvent.GROUP_CONVERSATION_USERS_LEFT, groupConversation, users);
984
- break;
814
+ const users = event.users.map(user => (0, _index.bridgeChannelUserToSdkChannelUser)(user));
815
+ if (!users || users.length === 0) {
816
+ return;
985
817
  }
986
- default:
818
+ this.emit(_index4.ZelloEvent.GROUP_CONVERSATION_USERS_LEFT, groupConversation, users);
987
819
  break;
988
- }
989
- });
990
- }
991
- }, {
992
- key: "processDispatchCallEvent",
993
- value: function processDispatchCallEvent(event) {
994
- const channel = (0, _index.bridgeContactToSdkContact)(event.channel);
995
- const call = (0, _index.bridgeCallToSdkCall)(event.call);
996
- if (!channel || !call) {
997
- return;
998
- }
999
- switch (event.name) {
1000
- case 'onDispatchCallTransferred':
1001
- this.emit(_index4.ZelloEvent.DISPATCH_CALL_TRANSFERRED, channel, call);
1002
- break;
1003
- case 'onDispatchCallEnded':
1004
- this.emit(_index4.ZelloEvent.DISPATCH_CALL_ENDED, channel, call);
1005
- break;
1006
- case 'onDispatchCallActive':
1007
- this.emit(_index4.ZelloEvent.DISPATCH_CALL_ACTIVE, channel, call);
1008
- break;
1009
- case 'onDispatchCallPending':
1010
- this.emit(_index4.ZelloEvent.DISPATCH_CALL_PENDING, channel, call);
1011
- break;
820
+ }
1012
821
  default:
1013
822
  break;
1014
823
  }
824
+ });
825
+ }
826
+ processDispatchCallEvent(event) {
827
+ const channel = (0, _index.bridgeContactToSdkContact)(event.channel);
828
+ const call = (0, _index.bridgeCallToSdkCall)(event.call);
829
+ if (!channel || !call) {
830
+ return;
831
+ }
832
+ switch (event.name) {
833
+ case 'onDispatchCallTransferred':
834
+ this.emit(_index4.ZelloEvent.DISPATCH_CALL_TRANSFERRED, channel, call);
835
+ break;
836
+ case 'onDispatchCallEnded':
837
+ this.emit(_index4.ZelloEvent.DISPATCH_CALL_ENDED, channel, call);
838
+ break;
839
+ case 'onDispatchCallActive':
840
+ this.emit(_index4.ZelloEvent.DISPATCH_CALL_ACTIVE, channel, call);
841
+ break;
842
+ case 'onDispatchCallPending':
843
+ this.emit(_index4.ZelloEvent.DISPATCH_CALL_PENDING, channel, call);
844
+ break;
845
+ default:
846
+ break;
1015
847
  }
1016
- }, {
1017
- key: "clearContactList",
1018
- value: function clearContactList() {
1019
- this.users = [];
1020
- this.channels = [];
1021
- this.groupConversations = [];
1022
- }
1023
- }], [{
1024
- key: "getInstance",
1025
- value: function getInstance() {
1026
- if (!Zello.instance) {
1027
- Zello.instance = new Zello();
1028
- }
1029
- return Zello.instance;
1030
- }
1031
- }, {
1032
- key: "getSdk",
1033
- value: function getSdk() {
1034
- if (_index.isAndroid) {
1035
- return ZelloAndroidSdkModule;
1036
- }
1037
- return ZelloIOSSdkModule;
1038
- }
1039
- }]);
1040
- }(_EventEmitter2.default);
1041
- _Zello = Zello;
1042
- _defineProperty(Zello, "instance", void 0);
848
+ }
849
+ clearContactList() {
850
+ this.users = [];
851
+ this.channels = [];
852
+ this.groupConversations = [];
853
+ }
854
+ static getSdk() {
855
+ // On Android the TurboModule owns the Zello delegate and is already created
856
+ // by importing the spec; on iOS the ZelloIOSSdkModule RCTEventEmitter owns
857
+ // it and is instantiated on access. Either way this only needs to be truthy
858
+ // so the DeviceEventEmitter listener gets registered.
859
+ return _index.isAndroid ? _NativeZelloSdk.default : ZelloIOSSdkModule;
860
+ }
861
+ }
862
+ exports.Zello = Zello;
1043
863
  //# sourceMappingURL=index.js.map