@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.
- package/README.md +22 -4
- package/android/build.gradle +5 -3
- package/android/src/main/java/com/zellosdk/ZelloAndroidSdkModule.kt +117 -7
- package/android/src/main/java/com/zellosdk/ZelloAndroidSdkModuleHelper.kt +76 -8
- package/ios/Extensions/ZelloConsoleSettings+Extension.swift +14 -0
- package/ios/Extensions/ZelloContact+Extension.swift +56 -2
- package/ios/Extensions/ZelloDispatchCall+Extension.swift +13 -0
- package/ios/Extensions/ZelloIOSSdkModule+Extension.swift +81 -8
- package/ios/ZelloIOSSdkModule.swift +61 -5
- package/ios/ZelloIOSSdkModuleBridge.m +14 -1
- package/lib/commonjs/docs/assets/highlight.css +18 -4
- package/lib/commonjs/docs/assets/navigation.js +1 -1
- package/lib/commonjs/docs/assets/navigation.js.map +1 -1
- package/lib/commonjs/docs/assets/search.js +1 -1
- package/lib/commonjs/docs/assets/search.js.map +1 -1
- package/lib/commonjs/docs/classes/sdk.Zello.html +75 -43
- package/lib/commonjs/docs/classes/types.ZelloAlertMessage.html +7 -7
- package/lib/commonjs/docs/classes/types.ZelloChannel.html +8 -8
- package/lib/commonjs/docs/classes/types.ZelloChannelUser.html +5 -4
- package/lib/commonjs/docs/classes/types.ZelloDispatchCall.html +7 -0
- package/lib/commonjs/docs/classes/types.ZelloDispatchChannel.html +19 -0
- package/lib/commonjs/docs/classes/types.ZelloGroupConversation.html +24 -0
- package/lib/commonjs/docs/classes/types.ZelloHistoryAlertMessage.html +8 -8
- package/lib/commonjs/docs/classes/types.ZelloHistoryImageMessage.html +7 -7
- package/lib/commonjs/docs/classes/types.ZelloHistoryLocationMessage.html +11 -11
- package/lib/commonjs/docs/classes/types.ZelloHistoryTextMessage.html +8 -8
- package/lib/commonjs/docs/classes/types.ZelloHistoryVoiceMessage.html +8 -8
- package/lib/commonjs/docs/classes/types.ZelloImageMessage.html +8 -8
- package/lib/commonjs/docs/classes/types.ZelloIncomingEmergency.html +7 -7
- package/lib/commonjs/docs/classes/types.ZelloIncomingVoiceMessage.html +6 -6
- package/lib/commonjs/docs/classes/types.ZelloLocationMessage.html +10 -10
- package/lib/commonjs/docs/classes/types.ZelloOutgoingEmergency.html +5 -5
- package/lib/commonjs/docs/classes/types.ZelloOutgoingVoiceMessage.html +7 -7
- package/lib/commonjs/docs/classes/types.ZelloRecentEntry.html +7 -7
- package/lib/commonjs/docs/classes/types.ZelloTextMessage.html +7 -7
- package/lib/commonjs/docs/classes/types.ZelloUser.html +10 -8
- package/lib/commonjs/docs/classes/types.ZelloUserSupportedFeatures.html +5 -0
- package/lib/commonjs/docs/enums/events.ZelloEvent.html +108 -67
- package/lib/commonjs/docs/enums/types.ZelloAccountStatus.html +3 -3
- package/lib/commonjs/docs/enums/types.ZelloChannelAlertLevel.html +3 -3
- package/lib/commonjs/docs/enums/types.ZelloChannelConnectionStatus.html +2 -2
- package/lib/commonjs/docs/enums/types.ZelloConnectionError.html +2 -2
- package/lib/commonjs/docs/enums/types.ZelloConnectionState.html +2 -2
- package/lib/commonjs/docs/enums/types.ZelloContactType.html +4 -2
- package/lib/commonjs/docs/enums/types.ZelloDispatchCallStatus.html +6 -0
- package/lib/commonjs/docs/enums/types.ZelloOutgoingVoiceMessageError.html +2 -2
- package/lib/commonjs/docs/enums/types.ZelloOutgoingVoiceMessageState.html +2 -2
- package/lib/commonjs/docs/enums/types.ZelloRecentEntryType.html +2 -2
- package/lib/commonjs/docs/enums/types.ZelloUserStatus.html +5 -5
- package/lib/commonjs/docs/index.html +16 -8
- package/lib/commonjs/docs/modules/events.html +1 -1
- package/lib/commonjs/docs/modules/index.html +9 -3
- package/lib/commonjs/docs/modules/sdk.html +1 -1
- package/lib/commonjs/docs/modules/types.html +7 -1
- package/lib/commonjs/docs/types/types.ZelloChannelOptions.html +4 -4
- package/lib/commonjs/docs/types/types.ZelloConfig.html +4 -3
- package/lib/commonjs/docs/types/types.ZelloConsoleSettings.html +8 -0
- package/lib/commonjs/docs/types/types.ZelloContact.html +1 -1
- package/lib/commonjs/docs/types/types.ZelloCredentials.html +2 -2
- package/lib/commonjs/docs/types/types.ZelloHistoryMessage.html +1 -1
- package/lib/commonjs/docs/types/types.ZelloMessage.html +1 -1
- package/lib/commonjs/events/index.js +11 -0
- package/lib/commonjs/events/index.js.map +1 -1
- package/lib/commonjs/sdk/index.js +237 -16
- package/lib/commonjs/sdk/index.js.map +1 -1
- package/lib/commonjs/types/index.js +110 -4
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/commonjs/utils/index.js +73 -9
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/module/docs/assets/highlight.css +18 -4
- package/lib/module/docs/assets/navigation.js +1 -1
- package/lib/module/docs/assets/navigation.js.map +1 -1
- package/lib/module/docs/assets/search.js +1 -1
- package/lib/module/docs/assets/search.js.map +1 -1
- package/lib/module/docs/classes/sdk.Zello.html +75 -43
- package/lib/module/docs/classes/types.ZelloAlertMessage.html +7 -7
- package/lib/module/docs/classes/types.ZelloChannel.html +8 -8
- package/lib/module/docs/classes/types.ZelloChannelUser.html +5 -4
- package/lib/module/docs/classes/types.ZelloDispatchCall.html +7 -0
- package/lib/module/docs/classes/types.ZelloDispatchChannel.html +19 -0
- package/lib/module/docs/classes/types.ZelloGroupConversation.html +24 -0
- package/lib/module/docs/classes/types.ZelloHistoryAlertMessage.html +8 -8
- package/lib/module/docs/classes/types.ZelloHistoryImageMessage.html +7 -7
- package/lib/module/docs/classes/types.ZelloHistoryLocationMessage.html +11 -11
- package/lib/module/docs/classes/types.ZelloHistoryTextMessage.html +8 -8
- package/lib/module/docs/classes/types.ZelloHistoryVoiceMessage.html +8 -8
- package/lib/module/docs/classes/types.ZelloImageMessage.html +8 -8
- package/lib/module/docs/classes/types.ZelloIncomingEmergency.html +7 -7
- package/lib/module/docs/classes/types.ZelloIncomingVoiceMessage.html +6 -6
- package/lib/module/docs/classes/types.ZelloLocationMessage.html +10 -10
- package/lib/module/docs/classes/types.ZelloOutgoingEmergency.html +5 -5
- package/lib/module/docs/classes/types.ZelloOutgoingVoiceMessage.html +7 -7
- package/lib/module/docs/classes/types.ZelloRecentEntry.html +7 -7
- package/lib/module/docs/classes/types.ZelloTextMessage.html +7 -7
- package/lib/module/docs/classes/types.ZelloUser.html +10 -8
- package/lib/module/docs/classes/types.ZelloUserSupportedFeatures.html +5 -0
- package/lib/module/docs/enums/events.ZelloEvent.html +108 -67
- package/lib/module/docs/enums/types.ZelloAccountStatus.html +3 -3
- package/lib/module/docs/enums/types.ZelloChannelAlertLevel.html +3 -3
- package/lib/module/docs/enums/types.ZelloChannelConnectionStatus.html +2 -2
- package/lib/module/docs/enums/types.ZelloConnectionError.html +2 -2
- package/lib/module/docs/enums/types.ZelloConnectionState.html +2 -2
- package/lib/module/docs/enums/types.ZelloContactType.html +4 -2
- package/lib/module/docs/enums/types.ZelloDispatchCallStatus.html +6 -0
- package/lib/module/docs/enums/types.ZelloOutgoingVoiceMessageError.html +2 -2
- package/lib/module/docs/enums/types.ZelloOutgoingVoiceMessageState.html +2 -2
- package/lib/module/docs/enums/types.ZelloRecentEntryType.html +2 -2
- package/lib/module/docs/enums/types.ZelloUserStatus.html +5 -5
- package/lib/module/docs/index.html +16 -8
- package/lib/module/docs/modules/events.html +1 -1
- package/lib/module/docs/modules/index.html +9 -3
- package/lib/module/docs/modules/sdk.html +1 -1
- package/lib/module/docs/modules/types.html +7 -1
- package/lib/module/docs/types/types.ZelloChannelOptions.html +4 -4
- package/lib/module/docs/types/types.ZelloConfig.html +4 -3
- package/lib/module/docs/types/types.ZelloConsoleSettings.html +8 -0
- package/lib/module/docs/types/types.ZelloContact.html +1 -1
- package/lib/module/docs/types/types.ZelloCredentials.html +2 -2
- package/lib/module/docs/types/types.ZelloHistoryMessage.html +1 -1
- package/lib/module/docs/types/types.ZelloMessage.html +1 -1
- package/lib/module/events/index.js +11 -0
- package/lib/module/events/index.js.map +1 -1
- package/lib/module/sdk/index.js +240 -17
- package/lib/module/sdk/index.js.map +1 -1
- package/lib/module/types/index.js +115 -3
- package/lib/module/types/index.js.map +1 -1
- package/lib/module/utils/index.js +71 -10
- package/lib/module/utils/index.js.map +1 -1
- package/lib/typescript/commonjs/src/events/index.d.ts +65 -2
- package/lib/typescript/commonjs/src/events/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/sdk/index.d.ts +53 -4
- package/lib/typescript/commonjs/src/sdk/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/index.d.ts +109 -6
- package/lib/typescript/commonjs/src/types/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/index.d.ts +4 -1
- package/lib/typescript/commonjs/src/utils/index.d.ts.map +1 -1
- package/lib/typescript/module/src/events/index.d.ts +65 -2
- package/lib/typescript/module/src/events/index.d.ts.map +1 -1
- package/lib/typescript/module/src/sdk/index.d.ts +53 -4
- package/lib/typescript/module/src/sdk/index.d.ts.map +1 -1
- package/lib/typescript/module/src/types/index.d.ts +109 -6
- package/lib/typescript/module/src/types/index.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/index.d.ts +4 -1
- package/lib/typescript/module/src/utils/index.d.ts.map +1 -1
- package/package.json +1 -2
- package/react-native-zello-sdk.podspec +1 -1
- package/src/events/index.ts +64 -1
- package/src/sdk/index.ts +286 -19
- package/src/types/index.ts +152 -5
- package/src/utils/index.ts +124 -29
package/src/utils/index.ts
CHANGED
|
@@ -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
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
eventContact.
|
|
35
|
-
? ZelloChannelConnectionStatus.
|
|
36
|
-
:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
+
}
|