@zelloptt/react-native-zello-sdk 0.3.3 → 1.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 (150) hide show
  1. package/README.md +22 -4
  2. package/android/build.gradle +5 -3
  3. package/android/src/main/java/com/zellosdk/ZelloAndroidSdkModule.kt +117 -7
  4. package/android/src/main/java/com/zellosdk/ZelloAndroidSdkModuleHelper.kt +76 -8
  5. package/ios/Extensions/ZelloConsoleSettings+Extension.swift +14 -0
  6. package/ios/Extensions/ZelloContact+Extension.swift +56 -2
  7. package/ios/Extensions/ZelloDispatchCall+Extension.swift +13 -0
  8. package/ios/Extensions/ZelloIOSSdkModule+Extension.swift +81 -8
  9. package/ios/ZelloIOSSdkModule.swift +61 -5
  10. package/ios/ZelloIOSSdkModuleBridge.m +14 -1
  11. package/lib/commonjs/docs/assets/highlight.css +18 -4
  12. package/lib/commonjs/docs/assets/navigation.js +1 -1
  13. package/lib/commonjs/docs/assets/navigation.js.map +1 -1
  14. package/lib/commonjs/docs/assets/search.js +1 -1
  15. package/lib/commonjs/docs/assets/search.js.map +1 -1
  16. package/lib/commonjs/docs/classes/sdk.Zello.html +75 -43
  17. package/lib/commonjs/docs/classes/types.ZelloAlertMessage.html +7 -7
  18. package/lib/commonjs/docs/classes/types.ZelloChannel.html +8 -8
  19. package/lib/commonjs/docs/classes/types.ZelloChannelUser.html +5 -4
  20. package/lib/commonjs/docs/classes/types.ZelloDispatchCall.html +7 -0
  21. package/lib/commonjs/docs/classes/types.ZelloDispatchChannel.html +19 -0
  22. package/lib/commonjs/docs/classes/types.ZelloGroupConversation.html +24 -0
  23. package/lib/commonjs/docs/classes/types.ZelloHistoryAlertMessage.html +8 -8
  24. package/lib/commonjs/docs/classes/types.ZelloHistoryImageMessage.html +7 -7
  25. package/lib/commonjs/docs/classes/types.ZelloHistoryLocationMessage.html +11 -11
  26. package/lib/commonjs/docs/classes/types.ZelloHistoryTextMessage.html +8 -8
  27. package/lib/commonjs/docs/classes/types.ZelloHistoryVoiceMessage.html +8 -8
  28. package/lib/commonjs/docs/classes/types.ZelloImageMessage.html +8 -8
  29. package/lib/commonjs/docs/classes/types.ZelloIncomingEmergency.html +7 -7
  30. package/lib/commonjs/docs/classes/types.ZelloIncomingVoiceMessage.html +6 -6
  31. package/lib/commonjs/docs/classes/types.ZelloLocationMessage.html +10 -10
  32. package/lib/commonjs/docs/classes/types.ZelloOutgoingEmergency.html +5 -5
  33. package/lib/commonjs/docs/classes/types.ZelloOutgoingVoiceMessage.html +7 -7
  34. package/lib/commonjs/docs/classes/types.ZelloRecentEntry.html +7 -7
  35. package/lib/commonjs/docs/classes/types.ZelloTextMessage.html +7 -7
  36. package/lib/commonjs/docs/classes/types.ZelloUser.html +10 -8
  37. package/lib/commonjs/docs/classes/types.ZelloUserSupportedFeatures.html +5 -0
  38. package/lib/commonjs/docs/enums/events.ZelloEvent.html +108 -67
  39. package/lib/commonjs/docs/enums/types.ZelloAccountStatus.html +3 -3
  40. package/lib/commonjs/docs/enums/types.ZelloChannelAlertLevel.html +3 -3
  41. package/lib/commonjs/docs/enums/types.ZelloChannelConnectionStatus.html +2 -2
  42. package/lib/commonjs/docs/enums/types.ZelloConnectionError.html +2 -2
  43. package/lib/commonjs/docs/enums/types.ZelloConnectionState.html +2 -2
  44. package/lib/commonjs/docs/enums/types.ZelloContactType.html +4 -2
  45. package/lib/commonjs/docs/enums/types.ZelloDispatchCallStatus.html +6 -0
  46. package/lib/commonjs/docs/enums/types.ZelloOutgoingVoiceMessageError.html +2 -2
  47. package/lib/commonjs/docs/enums/types.ZelloOutgoingVoiceMessageState.html +2 -2
  48. package/lib/commonjs/docs/enums/types.ZelloRecentEntryType.html +2 -2
  49. package/lib/commonjs/docs/enums/types.ZelloUserStatus.html +5 -5
  50. package/lib/commonjs/docs/index.html +16 -8
  51. package/lib/commonjs/docs/modules/events.html +1 -1
  52. package/lib/commonjs/docs/modules/index.html +9 -3
  53. package/lib/commonjs/docs/modules/sdk.html +1 -1
  54. package/lib/commonjs/docs/modules/types.html +7 -1
  55. package/lib/commonjs/docs/types/types.ZelloChannelOptions.html +4 -4
  56. package/lib/commonjs/docs/types/types.ZelloConfig.html +4 -3
  57. package/lib/commonjs/docs/types/types.ZelloConsoleSettings.html +8 -0
  58. package/lib/commonjs/docs/types/types.ZelloContact.html +1 -1
  59. package/lib/commonjs/docs/types/types.ZelloCredentials.html +2 -2
  60. package/lib/commonjs/docs/types/types.ZelloHistoryMessage.html +1 -1
  61. package/lib/commonjs/docs/types/types.ZelloMessage.html +1 -1
  62. package/lib/commonjs/events/index.js +11 -0
  63. package/lib/commonjs/events/index.js.map +1 -1
  64. package/lib/commonjs/sdk/index.js +237 -16
  65. package/lib/commonjs/sdk/index.js.map +1 -1
  66. package/lib/commonjs/types/index.js +110 -4
  67. package/lib/commonjs/types/index.js.map +1 -1
  68. package/lib/commonjs/utils/index.js +73 -9
  69. package/lib/commonjs/utils/index.js.map +1 -1
  70. package/lib/module/docs/assets/highlight.css +18 -4
  71. package/lib/module/docs/assets/navigation.js +1 -1
  72. package/lib/module/docs/assets/navigation.js.map +1 -1
  73. package/lib/module/docs/assets/search.js +1 -1
  74. package/lib/module/docs/assets/search.js.map +1 -1
  75. package/lib/module/docs/classes/sdk.Zello.html +75 -43
  76. package/lib/module/docs/classes/types.ZelloAlertMessage.html +7 -7
  77. package/lib/module/docs/classes/types.ZelloChannel.html +8 -8
  78. package/lib/module/docs/classes/types.ZelloChannelUser.html +5 -4
  79. package/lib/module/docs/classes/types.ZelloDispatchCall.html +7 -0
  80. package/lib/module/docs/classes/types.ZelloDispatchChannel.html +19 -0
  81. package/lib/module/docs/classes/types.ZelloGroupConversation.html +24 -0
  82. package/lib/module/docs/classes/types.ZelloHistoryAlertMessage.html +8 -8
  83. package/lib/module/docs/classes/types.ZelloHistoryImageMessage.html +7 -7
  84. package/lib/module/docs/classes/types.ZelloHistoryLocationMessage.html +11 -11
  85. package/lib/module/docs/classes/types.ZelloHistoryTextMessage.html +8 -8
  86. package/lib/module/docs/classes/types.ZelloHistoryVoiceMessage.html +8 -8
  87. package/lib/module/docs/classes/types.ZelloImageMessage.html +8 -8
  88. package/lib/module/docs/classes/types.ZelloIncomingEmergency.html +7 -7
  89. package/lib/module/docs/classes/types.ZelloIncomingVoiceMessage.html +6 -6
  90. package/lib/module/docs/classes/types.ZelloLocationMessage.html +10 -10
  91. package/lib/module/docs/classes/types.ZelloOutgoingEmergency.html +5 -5
  92. package/lib/module/docs/classes/types.ZelloOutgoingVoiceMessage.html +7 -7
  93. package/lib/module/docs/classes/types.ZelloRecentEntry.html +7 -7
  94. package/lib/module/docs/classes/types.ZelloTextMessage.html +7 -7
  95. package/lib/module/docs/classes/types.ZelloUser.html +10 -8
  96. package/lib/module/docs/classes/types.ZelloUserSupportedFeatures.html +5 -0
  97. package/lib/module/docs/enums/events.ZelloEvent.html +108 -67
  98. package/lib/module/docs/enums/types.ZelloAccountStatus.html +3 -3
  99. package/lib/module/docs/enums/types.ZelloChannelAlertLevel.html +3 -3
  100. package/lib/module/docs/enums/types.ZelloChannelConnectionStatus.html +2 -2
  101. package/lib/module/docs/enums/types.ZelloConnectionError.html +2 -2
  102. package/lib/module/docs/enums/types.ZelloConnectionState.html +2 -2
  103. package/lib/module/docs/enums/types.ZelloContactType.html +4 -2
  104. package/lib/module/docs/enums/types.ZelloDispatchCallStatus.html +6 -0
  105. package/lib/module/docs/enums/types.ZelloOutgoingVoiceMessageError.html +2 -2
  106. package/lib/module/docs/enums/types.ZelloOutgoingVoiceMessageState.html +2 -2
  107. package/lib/module/docs/enums/types.ZelloRecentEntryType.html +2 -2
  108. package/lib/module/docs/enums/types.ZelloUserStatus.html +5 -5
  109. package/lib/module/docs/index.html +16 -8
  110. package/lib/module/docs/modules/events.html +1 -1
  111. package/lib/module/docs/modules/index.html +9 -3
  112. package/lib/module/docs/modules/sdk.html +1 -1
  113. package/lib/module/docs/modules/types.html +7 -1
  114. package/lib/module/docs/types/types.ZelloChannelOptions.html +4 -4
  115. package/lib/module/docs/types/types.ZelloConfig.html +4 -3
  116. package/lib/module/docs/types/types.ZelloConsoleSettings.html +8 -0
  117. package/lib/module/docs/types/types.ZelloContact.html +1 -1
  118. package/lib/module/docs/types/types.ZelloCredentials.html +2 -2
  119. package/lib/module/docs/types/types.ZelloHistoryMessage.html +1 -1
  120. package/lib/module/docs/types/types.ZelloMessage.html +1 -1
  121. package/lib/module/events/index.js +11 -0
  122. package/lib/module/events/index.js.map +1 -1
  123. package/lib/module/sdk/index.js +240 -17
  124. package/lib/module/sdk/index.js.map +1 -1
  125. package/lib/module/types/index.js +115 -3
  126. package/lib/module/types/index.js.map +1 -1
  127. package/lib/module/utils/index.js +71 -10
  128. package/lib/module/utils/index.js.map +1 -1
  129. package/lib/typescript/commonjs/src/events/index.d.ts +65 -2
  130. package/lib/typescript/commonjs/src/events/index.d.ts.map +1 -1
  131. package/lib/typescript/commonjs/src/sdk/index.d.ts +53 -4
  132. package/lib/typescript/commonjs/src/sdk/index.d.ts.map +1 -1
  133. package/lib/typescript/commonjs/src/types/index.d.ts +109 -6
  134. package/lib/typescript/commonjs/src/types/index.d.ts.map +1 -1
  135. package/lib/typescript/commonjs/src/utils/index.d.ts +4 -1
  136. package/lib/typescript/commonjs/src/utils/index.d.ts.map +1 -1
  137. package/lib/typescript/module/src/events/index.d.ts +65 -2
  138. package/lib/typescript/module/src/events/index.d.ts.map +1 -1
  139. package/lib/typescript/module/src/sdk/index.d.ts +53 -4
  140. package/lib/typescript/module/src/sdk/index.d.ts.map +1 -1
  141. package/lib/typescript/module/src/types/index.d.ts +109 -6
  142. package/lib/typescript/module/src/types/index.d.ts.map +1 -1
  143. package/lib/typescript/module/src/utils/index.d.ts +4 -1
  144. package/lib/typescript/module/src/utils/index.d.ts.map +1 -1
  145. package/package.json +1 -2
  146. package/react-native-zello-sdk.podspec +1 -1
  147. package/src/events/index.ts +64 -1
  148. package/src/sdk/index.ts +286 -19
  149. package/src/types/index.ts +152 -5
  150. package/src/utils/index.ts +124 -29
@@ -1,8 +1,14 @@
1
1
  import {
2
2
  ZelloChannel,
3
3
  ZelloChannelConnectionStatus,
4
+ ZelloChannelOptions,
4
5
  ZelloChannelUser,
6
+ ZelloConsoleSettings,
5
7
  ZelloContact,
8
+ ZelloDispatchCall,
9
+ ZelloDispatchCallStatus,
10
+ ZelloDispatchChannel,
11
+ ZelloGroupConversation,
6
12
  ZelloHistoryAlertMessage,
7
13
  ZelloHistoryImageMessage,
8
14
  ZelloHistoryLocationMessage,
@@ -12,6 +18,7 @@ import {
12
18
  ZelloIncomingEmergency,
13
19
  ZelloUser,
14
20
  ZelloUserStatus,
21
+ ZelloUserSupportedFeatures,
15
22
  } from '../types';
16
23
  import { Platform } from 'react-native';
17
24
 
@@ -28,17 +35,72 @@ export function bridgeContactToSdkContact(
28
35
  const contactName = eventContact.name;
29
36
  if (contactName) {
30
37
  if (eventContact.isChannel) {
31
- contact = new ZelloChannel(
32
- contactName,
33
- eventContact.isMuted,
34
- eventContact.isConnected
35
- ? ZelloChannelConnectionStatus.Connected
36
- : eventContact.isConnecting
37
- ? ZelloChannelConnectionStatus.Connecting
38
- : ZelloChannelConnectionStatus.Disconnected,
39
- eventContact.usersOnline,
40
- eventContact.options
41
- );
38
+ const isMuted = eventContact.isMuted;
39
+ const connectionStatus = eventContact.isConnected
40
+ ? ZelloChannelConnectionStatus.Connected
41
+ : eventContact.isConnecting
42
+ ? ZelloChannelConnectionStatus.Connecting
43
+ : ZelloChannelConnectionStatus.Disconnected;
44
+ const usersOnline = eventContact.usersOnline;
45
+ const eventOptions = eventContact.options;
46
+ let options: ZelloChannelOptions | undefined;
47
+ if (eventOptions) {
48
+ options = {
49
+ noDisconnect: eventOptions.noDisconnect,
50
+ hidePowerButton: eventOptions.hidePowerButton,
51
+ listenOnly: eventOptions.listenOnly,
52
+ allowAlertMessages: eventOptions.allowAlerts,
53
+ allowLocationMessages: eventOptions.allowLocations,
54
+ allowTextMessages: eventOptions.allowTextMessages,
55
+ };
56
+ }
57
+ if (!options) {
58
+ return undefined;
59
+ }
60
+ if (eventContact.isDispatchChannel) {
61
+ let call: ZelloDispatchCall | undefined;
62
+ if (eventContact.currentCall) {
63
+ const statusValue =
64
+ eventContact.currentCall.status.toLowerCase() as ZelloDispatchCallStatus;
65
+ if (Object.values(ZelloDispatchCallStatus).includes(statusValue)) {
66
+ call = new ZelloDispatchCall(
67
+ statusValue,
68
+ eventContact.currentCall.dispatcher
69
+ );
70
+ }
71
+ }
72
+ contact = new ZelloDispatchChannel(
73
+ contactName,
74
+ isMuted,
75
+ connectionStatus,
76
+ usersOnline,
77
+ options,
78
+ call
79
+ );
80
+ } else if (eventContact.isGroupConversation) {
81
+ contact = new ZelloGroupConversation(
82
+ contactName,
83
+ isMuted,
84
+ connectionStatus,
85
+ usersOnline,
86
+ options,
87
+ eventContact.displayName,
88
+ eventContact.users.map((user: any) =>
89
+ bridgeChannelUserToSdkChannelUser(user)
90
+ ),
91
+ eventContact.onlineUsers.map((user: any) =>
92
+ bridgeChannelUserToSdkChannelUser(user)
93
+ )
94
+ );
95
+ } else {
96
+ contact = new ZelloChannel(
97
+ contactName,
98
+ isMuted,
99
+ connectionStatus,
100
+ usersOnline,
101
+ options
102
+ );
103
+ }
42
104
  } else {
43
105
  const statusValue = eventContact.status.toLowerCase() as ZelloUserStatus;
44
106
  let userStatus = ZelloUserStatus.Offline;
@@ -51,7 +113,10 @@ export function bridgeContactToSdkContact(
51
113
  eventContact.isMuted,
52
114
  userStatus,
53
115
  eventContact.profilePictureUrl,
54
- eventContact.profilePictureThumbnailUrl
116
+ eventContact.profilePictureThumbnailUrl,
117
+ new ZelloUserSupportedFeatures(
118
+ eventContact.supportedFeatures.groupConversations
119
+ )
55
120
  );
56
121
  }
57
122
  }
@@ -62,12 +127,13 @@ export function bridgeIncomingEmergencyToSdkIncomingEmergency(
62
127
  emergency: any
63
128
  ): ZelloIncomingEmergency | undefined {
64
129
  const channel = bridgeContactToSdkContact(emergency.channel) as ZelloChannel;
65
- if (!channel) {
130
+ const channelUser = bridgeChannelUserToSdkChannelUser(emergency.channelUser);
131
+ if (!channel || !channelUser) {
66
132
  return undefined;
67
133
  }
68
134
  return new ZelloIncomingEmergency(
69
135
  channel,
70
- new ZelloChannelUser(emergency.channelUserName),
136
+ channelUser,
71
137
  emergency.emergencyId,
72
138
  parseInt(emergency.startTimestamp, 10),
73
139
  parseInt(emergency.endTimestamp, 10)
@@ -85,9 +151,7 @@ export function bridgeHistoryMessageToSdkHistoryMessage(
85
151
  case 'voice':
86
152
  return new ZelloHistoryVoiceMessage(
87
153
  contact,
88
- message.channelUserName
89
- ? new ZelloChannelUser(message.channelUserName)
90
- : undefined,
154
+ bridgeChannelUserToSdkChannelUser(message.channelUser),
91
155
  parseInt(message.timestamp, 10),
92
156
  message.historyId,
93
157
  message.incoming,
@@ -96,9 +160,7 @@ export function bridgeHistoryMessageToSdkHistoryMessage(
96
160
  case 'image':
97
161
  return new ZelloHistoryImageMessage(
98
162
  contact,
99
- message.channelUserName
100
- ? new ZelloChannelUser(message.channelUserName)
101
- : undefined,
163
+ bridgeChannelUserToSdkChannelUser(message.channelUser),
102
164
  parseInt(message.timestamp, 10),
103
165
  message.historyId,
104
166
  message.incoming
@@ -106,9 +168,7 @@ export function bridgeHistoryMessageToSdkHistoryMessage(
106
168
  case 'location':
107
169
  return new ZelloHistoryLocationMessage(
108
170
  contact,
109
- message.channelUserName
110
- ? new ZelloChannelUser(message.channelUserName)
111
- : undefined,
171
+ bridgeChannelUserToSdkChannelUser(message.channelUser),
112
172
  parseInt(message.timestamp, 10),
113
173
  message.historyId,
114
174
  message.incoming,
@@ -120,9 +180,7 @@ export function bridgeHistoryMessageToSdkHistoryMessage(
120
180
  case 'text':
121
181
  return new ZelloHistoryTextMessage(
122
182
  contact,
123
- message.channelUserName
124
- ? new ZelloChannelUser(message.channelUserName)
125
- : undefined,
183
+ bridgeChannelUserToSdkChannelUser(message.channelUser),
126
184
  parseInt(message.timestamp, 10),
127
185
  message.historyId,
128
186
  message.incoming,
@@ -131,9 +189,7 @@ export function bridgeHistoryMessageToSdkHistoryMessage(
131
189
  case 'alert':
132
190
  return new ZelloHistoryAlertMessage(
133
191
  contact,
134
- message.channelUserName
135
- ? new ZelloChannelUser(message.channelUserName)
136
- : undefined,
192
+ bridgeChannelUserToSdkChannelUser(message.channelUser),
137
193
  parseInt(message.timestamp, 10),
138
194
  message.historyId,
139
195
  message.incoming,
@@ -143,3 +199,42 @@ export function bridgeHistoryMessageToSdkHistoryMessage(
143
199
  return undefined;
144
200
  }
145
201
  }
202
+
203
+ export function bridgeCallToSdkCall(call: any): ZelloDispatchCall | undefined {
204
+ if (!call) {
205
+ return undefined;
206
+ }
207
+ const statusValue = call.status.toLowerCase() as ZelloDispatchCallStatus;
208
+ if (!Object.values(ZelloDispatchCallStatus).includes(statusValue)) {
209
+ return undefined;
210
+ }
211
+ return new ZelloDispatchCall(statusValue, call.dispatcher);
212
+ }
213
+
214
+ export function bridgeConsoleSettingsToSdkConsoleSettings(
215
+ settings: any
216
+ ): ZelloConsoleSettings | undefined {
217
+ if (!settings) {
218
+ return undefined;
219
+ }
220
+ return {
221
+ allowNonDispatchersToEndCalls: settings.allowNonDispatchersToEndCalls,
222
+ allowImageMessages: settings.allowImageMessages,
223
+ allowLocationMessages: settings.allowLocationMessages,
224
+ allowTextMessages: settings.allowTextMessages,
225
+ allowAlertMessages: settings.allowAlertMessages,
226
+ allowGroupConversations: settings.allowGroupConversations,
227
+ };
228
+ }
229
+
230
+ export function bridgeChannelUserToSdkChannelUser(
231
+ channelUser: any
232
+ ): ZelloChannelUser | undefined {
233
+ if (!channelUser?.name) {
234
+ return undefined;
235
+ }
236
+ return new ZelloChannelUser(
237
+ channelUser.name,
238
+ channelUser.displayName ?? channelUser.name
239
+ );
240
+ }