chat4app-client-angular 1.0.0 → 1.0.1
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/chat4app.service.spec.ts +17 -0
- package/chat4app.service.ts +502 -0
- package/package.json +8 -3
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Chat4AppService } from "./chat4app.service";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
describe('Chat4AppService', () => {
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
TestBed.configureTestingModule({
|
|
10
|
+
providers: [Chat4AppService]
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('should be created', inject([Chat4AppService], (service: Chat4AppService) => {
|
|
15
|
+
expect(service).toBeTruthy();
|
|
16
|
+
}));
|
|
17
|
+
});
|
|
@@ -0,0 +1,502 @@
|
|
|
1
|
+
import { Injectable, OnDestroy } from '@angular/core';
|
|
2
|
+
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
|
3
|
+
import { Observable, BehaviorSubject } from 'rxjs';
|
|
4
|
+
import { environment } from '../../environments/environment';
|
|
5
|
+
import * as Stomp from 'stompjs';
|
|
6
|
+
import * as SockJS from 'sockjs-client';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@Injectable()
|
|
12
|
+
export class Chat4AppService {
|
|
13
|
+
public chatUrl = environment.serverChat4app + "/api/v1/";
|
|
14
|
+
|
|
15
|
+
sock: any;
|
|
16
|
+
stompClient: any;
|
|
17
|
+
|
|
18
|
+
constructor(
|
|
19
|
+
private http: HttpClient
|
|
20
|
+
) {
|
|
21
|
+
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
init(callback: any, chatCallback?: IChatCallback, token?: string) {
|
|
25
|
+
this.getTokenChat4app().subscribe((res: any)=>{
|
|
26
|
+
this.setTokenChat4app(res.token);
|
|
27
|
+
|
|
28
|
+
if (chatCallback && token){
|
|
29
|
+
this.connectWebsocket(chatCallback, token);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
callback(res.token);
|
|
33
|
+
})
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
getChatUrlDownload(messageFileId: string){
|
|
37
|
+
return this.chatUrl + "chatmessage/getFile?messageFileId=" + messageFileId;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
getMessageChat(chatId: string,fromId: string,toId: string): Observable<Array<ChatMessage4App>> {
|
|
42
|
+
let url = this.chatUrl + "chatmessage/" + chatId + "/" + fromId + "/" + toId;
|
|
43
|
+
|
|
44
|
+
return this.http.get<Array<ChatMessage4App>>(url,
|
|
45
|
+
{
|
|
46
|
+
headers: new HttpHeaders().set('Authorization', this.getBearerToken())
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
}
|
|
50
|
+
getMessageChatByGrop(chatId: string,groupId: string, fromId: string): Observable<Array<ChatMessage4App>> {
|
|
51
|
+
let url = this.chatUrl + "chatmessage/byGroup/" + chatId + "/" + groupId + "/" + fromId;
|
|
52
|
+
|
|
53
|
+
return this.http.get<Array<ChatMessage4App>>(url,
|
|
54
|
+
{
|
|
55
|
+
headers: new HttpHeaders().set('Authorization', this.getBearerToken())
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
addMessageChat(chatMessage4App: ChatMessage4App): Observable<ChatMessage4App> {
|
|
62
|
+
let url = this.chatUrl + "chatmessage/" + chatMessage4App.chatId;
|
|
63
|
+
|
|
64
|
+
return this.http.post<ChatMessage4App>(url,chatMessage4App,
|
|
65
|
+
{
|
|
66
|
+
headers: new HttpHeaders().set('Authorization', this.getBearerToken())
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
}
|
|
70
|
+
props(chatFilterRequest4App: Array< ChatFilterRequest4App>): Observable<ChatUserResponse4App> {
|
|
71
|
+
let url = this.chatUrl + "chatmessage/props" ;
|
|
72
|
+
|
|
73
|
+
return this.http.post<ChatUserResponse4App>(url,chatFilterRequest4App,
|
|
74
|
+
{
|
|
75
|
+
headers: new HttpHeaders().set('Authorization', this.getBearerToken())
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
removeUsersChat(chatId: string, chatUsersId?: string[], chatUsersExternalId?: string[]): Observable<ChatUser4App[]> {
|
|
82
|
+
let params = new Array();
|
|
83
|
+
if (chatUsersId && chatUsersId.length>0) {
|
|
84
|
+
|
|
85
|
+
chatUsersId.forEach(cui=>{
|
|
86
|
+
params.push("chatUserId=" + cui);
|
|
87
|
+
});
|
|
88
|
+
} else if (chatUsersExternalId && chatUsersExternalId.length > 0){
|
|
89
|
+
chatUsersExternalId.forEach(cuei=>{
|
|
90
|
+
params.push("chatUserExternalId=" + cuei);
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
let url = this.chatUrl + "chatuser/" + chatId + "?" + params.join("&");
|
|
96
|
+
|
|
97
|
+
return this.http.delete<ChatUser4App[]>(url,
|
|
98
|
+
{
|
|
99
|
+
headers: new HttpHeaders().set('Authorization', this.getBearerToken())
|
|
100
|
+
})
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
removeUserChat(chatId: string, chatUserId?: string, chatUserExternalId?: string): Observable<ChatUser4App> {
|
|
104
|
+
let param = "";
|
|
105
|
+
if (chatUserId) {
|
|
106
|
+
param = "chatUserId=" + chatUserId;
|
|
107
|
+
} else {
|
|
108
|
+
param = "chatUserExternalId=" + chatUserExternalId;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
let url = this.chatUrl + "chatuser/" + chatId + "?" + param;
|
|
112
|
+
|
|
113
|
+
return this.http.delete<ChatUser4App>(url,
|
|
114
|
+
{
|
|
115
|
+
headers: new HttpHeaders().set('Authorization', this.getBearerToken())
|
|
116
|
+
})
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
updateUserChat(chatId: string, charUser4AppUpdate: ChatUser4App): Observable<ChatUser4App> {
|
|
120
|
+
|
|
121
|
+
let url = this.chatUrl + "chatuser/" + chatId ;
|
|
122
|
+
|
|
123
|
+
return this.http.put<ChatUser4App>(url, charUser4AppUpdate,
|
|
124
|
+
{
|
|
125
|
+
headers: new HttpHeaders().set('Authorization', this.getBearerToken())
|
|
126
|
+
})
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
createUserChat(chatId: string, chatUser4App: ChatUser4App): Observable<ChatUser4App> {
|
|
131
|
+
let url = this.chatUrl + "chatuser/" + chatId;
|
|
132
|
+
|
|
133
|
+
return this.http.post<ChatUser4App>(url,chatUser4App,
|
|
134
|
+
{
|
|
135
|
+
headers: new HttpHeaders().set('Authorization', this.getBearerToken())
|
|
136
|
+
})
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
createUsersChat(chatId: string, chatUser4App: ChatUser4App[]): Observable<ChatUser4App[]> {
|
|
140
|
+
let url = this.chatUrl + "chatuser/users/" + chatId;
|
|
141
|
+
|
|
142
|
+
return this.http.post<ChatUser4App[]>(url,chatUser4App,
|
|
143
|
+
{
|
|
144
|
+
headers: new HttpHeaders().set('Authorization', this.getBearerToken())
|
|
145
|
+
})
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
createChat(chat4app: Chat4App): Observable<Chat4App> {
|
|
150
|
+
let url = this.chatUrl + "chat";
|
|
151
|
+
|
|
152
|
+
return this.http.post<Chat4App>(url,chat4app,
|
|
153
|
+
{
|
|
154
|
+
headers: new HttpHeaders().set('Authorization', this.getBearerToken())
|
|
155
|
+
})
|
|
156
|
+
}
|
|
157
|
+
createUpdateChat(chat4app: Chat4App): Observable<Chat4App> {
|
|
158
|
+
let url = this.chatUrl + "chat";
|
|
159
|
+
|
|
160
|
+
return this.http.put<Chat4App>(url,chat4app,
|
|
161
|
+
{
|
|
162
|
+
headers: new HttpHeaders().set('Authorization', this.getBearerToken())
|
|
163
|
+
})
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
getLastMessageGroup(chatExternalId: string, groupId: string): Observable<ChatUserResponse4App> {
|
|
168
|
+
|
|
169
|
+
let url = this.chatUrl + "chatmessage/lastMessageGroup?chatExternalId=" + chatExternalId + "&groupId=" + groupId;
|
|
170
|
+
|
|
171
|
+
return this.http.get<ChatUserResponse4App>(url,
|
|
172
|
+
{
|
|
173
|
+
headers: new HttpHeaders().set('Authorization', this.getBearerToken())
|
|
174
|
+
})
|
|
175
|
+
}
|
|
176
|
+
getLastMessage(chatExternalId: string, chatUserExternalId: string): Observable<ChatUserResponse4App> {
|
|
177
|
+
|
|
178
|
+
let url = this.chatUrl + "chatmessage/lastMessage?chatExternalId=" + chatExternalId + "&chatUserExternalId=" + chatUserExternalId;
|
|
179
|
+
|
|
180
|
+
return this.http.get<ChatUserResponse4App>(url,
|
|
181
|
+
{
|
|
182
|
+
headers: new HttpHeaders().set('Authorization', this.getBearerToken())
|
|
183
|
+
})
|
|
184
|
+
}
|
|
185
|
+
countNotReadMessages(chatUserExternalId: string, chatExternalId?: string, groupId?: string): Observable<ChatUserResponse4App> {
|
|
186
|
+
|
|
187
|
+
let url = this.chatUrl + "chatmessage/countNotReadMessages?chatUserExternalId=" + chatUserExternalId ;
|
|
188
|
+
|
|
189
|
+
if (chatExternalId && chatExternalId.length>0) {
|
|
190
|
+
url += "&chatExternalId=" + chatExternalId;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
if (groupId && groupId.length>0) {
|
|
194
|
+
url += "&groupId=" + groupId;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
return this.http.get<ChatUserResponse4App>(url,
|
|
198
|
+
{
|
|
199
|
+
headers: new HttpHeaders().set('Authorization', this.getBearerToken())
|
|
200
|
+
})
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
getChatByExternalId(externalId: string): Observable<Chat4App> {
|
|
205
|
+
|
|
206
|
+
let url = this.chatUrl + "chat?externalId=" + externalId;
|
|
207
|
+
|
|
208
|
+
return this.http.get<Chat4App>(url,
|
|
209
|
+
{
|
|
210
|
+
headers: new HttpHeaders().set('Authorization', this.getBearerToken())
|
|
211
|
+
})
|
|
212
|
+
}
|
|
213
|
+
readMessage(chatMessageId: string, toId?: string): Observable<void> {
|
|
214
|
+
|
|
215
|
+
let url = this.chatUrl + "chatmessage/read/" + chatMessageId;
|
|
216
|
+
|
|
217
|
+
if (toId && toId.length> 0) {
|
|
218
|
+
url += "/" + toId;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return this.http.put<void>(url,null,
|
|
222
|
+
{
|
|
223
|
+
headers: new HttpHeaders().set('Authorization', this.getBearerToken())
|
|
224
|
+
})
|
|
225
|
+
}
|
|
226
|
+
online(chatId: string, chatUserId: string): Observable<number> {
|
|
227
|
+
|
|
228
|
+
let url = this.chatUrl + "chatmessage/online/" + chatId + "/" + chatUserId ;
|
|
229
|
+
|
|
230
|
+
return this.http.get<number>(url,
|
|
231
|
+
{
|
|
232
|
+
headers: new HttpHeaders().set('Authorization', this.getBearerToken())
|
|
233
|
+
})
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
public sendFile(chatId: string, fromId: string, toId: string, fileToUpload: File): Observable<ChatMessageFile4App> {
|
|
238
|
+
const endpoint = this.chatUrl + "chatmessage/sendFile/" + chatId + "/" + fromId + "/" + toId;
|
|
239
|
+
|
|
240
|
+
const formData: FormData = new FormData();
|
|
241
|
+
formData.append('file', fileToUpload);
|
|
242
|
+
|
|
243
|
+
return this.http
|
|
244
|
+
.post<ChatMessageFile4App>(endpoint, formData,
|
|
245
|
+
{
|
|
246
|
+
headers: new HttpHeaders().set('Authorization', this.getBearerToken())
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
public sendFileGroup(chatId: string, fromId: string, groupId: string, fileToUpload: File): Observable<ChatMessageFile4App> {
|
|
251
|
+
const endpoint = this.chatUrl + "chatmessage/sendFileGroup/" + chatId + "/" + fromId + "/" + groupId;
|
|
252
|
+
|
|
253
|
+
const formData: FormData = new FormData();
|
|
254
|
+
formData.append('file', fileToUpload);
|
|
255
|
+
|
|
256
|
+
return this.http
|
|
257
|
+
.post<ChatMessageFile4App>(endpoint, formData,
|
|
258
|
+
{
|
|
259
|
+
headers: new HttpHeaders().set('Authorization', this.getBearerToken())
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
/* Token */
|
|
265
|
+
getBearerToken(): string {
|
|
266
|
+
|
|
267
|
+
let ret = "Bearer " + window.sessionStorage.getItem("chat4AppSessionToken");
|
|
268
|
+
|
|
269
|
+
return ret;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
getTokenChat4app() {
|
|
273
|
+
return this.http.post("/rest/secured/chat-helper", null);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
setTokenChat4app(chat4AppSessionToken: string) {
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
window.sessionStorage.setItem("chat4AppSessionToken", chat4AppSessionToken);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
/* Connection */
|
|
284
|
+
|
|
285
|
+
onMessageFirebaseReceived(data: any, chatCallback: IChatCallback) {
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
//alert("onMessageReceived connectFirebase");
|
|
289
|
+
|
|
290
|
+
if (data.chatMessageId && data.type == "msg") {
|
|
291
|
+
|
|
292
|
+
let chat4appMessage = new Chat4AppMessageReceive();
|
|
293
|
+
chat4appMessage.data.chatId = data.chatId;
|
|
294
|
+
chat4appMessage.data.chatMessageId = data.chatMessageId;
|
|
295
|
+
chat4appMessage.data.externalId = data.externalId;
|
|
296
|
+
chat4appMessage.data.fromId = data.fromId;
|
|
297
|
+
chat4appMessage.data.toId = data.toId;
|
|
298
|
+
chat4appMessage.data.dateHour = data.dateHour;
|
|
299
|
+
chat4appMessage.data.type = data.type;
|
|
300
|
+
chat4appMessage.notification.body = data.body;
|
|
301
|
+
|
|
302
|
+
if (data.fileId && data.fileId.length > 0) {
|
|
303
|
+
chat4appMessage.data.fileId = data.fileId;
|
|
304
|
+
chat4appMessage.data.fileName = data.fileName;
|
|
305
|
+
chat4appMessage.data.fileSize = data.fileSize;
|
|
306
|
+
chat4appMessage.data.fileType =data.fileType;
|
|
307
|
+
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
let datTmp = new Map<string,string>();
|
|
311
|
+
|
|
312
|
+
for (let key in data) {
|
|
313
|
+
datTmp.set(key, data[key]);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
chat4appMessage.data.all = datTmp;
|
|
317
|
+
|
|
318
|
+
chatCallback.onMessage(chat4appMessage);
|
|
319
|
+
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
public connectWebsocket(chatCallback: IChatCallback, token: string) {
|
|
325
|
+
this.disconnect();
|
|
326
|
+
|
|
327
|
+
// let ichatcallback: Array<IChatCallback> = window["iChatCallback"] ;
|
|
328
|
+
|
|
329
|
+
// if (!ichatcallback) {
|
|
330
|
+
// ichatcallback = new Array();
|
|
331
|
+
|
|
332
|
+
// }
|
|
333
|
+
// ichatcallback.push(chatCallback);
|
|
334
|
+
|
|
335
|
+
// window["iChatCallback"] = ichatcallback;
|
|
336
|
+
|
|
337
|
+
let securityToken = this.getBearerToken();
|
|
338
|
+
|
|
339
|
+
this.sock = new SockJS( environment.serverChat4app + '/stomp/gkz-stomp-endpoint?token=' + securityToken);
|
|
340
|
+
this.stompClient = Stomp.over(this.sock);
|
|
341
|
+
this.stompClient.debug = function (msg: any) {
|
|
342
|
+
console.log(msg);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
this.stompClient.connect({}, (frame: any) => {
|
|
346
|
+
console.log(frame);
|
|
347
|
+
|
|
348
|
+
this.stompClient.subscribe('/queue/' + token, (msg: any) => {
|
|
349
|
+
//console.log('mensagem', msg);
|
|
350
|
+
|
|
351
|
+
if (msg.command == "MESSAGE" ) {
|
|
352
|
+
|
|
353
|
+
// console.log(msg)
|
|
354
|
+
|
|
355
|
+
let msgObj = JSON.parse(msg.body) ;
|
|
356
|
+
|
|
357
|
+
let datTmp = new Map<string,string>();
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
for (let key in msgObj.data) {
|
|
362
|
+
datTmp.set(key, msgObj.data[key]);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
msgObj.data.all = datTmp;
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
chatCallback.onMessage(msgObj);
|
|
369
|
+
//callback(msg.body);
|
|
370
|
+
// ichatcallback.forEach((iChat)=>{
|
|
371
|
+
// iChat.onMessage(JSON.parse(msg.body) );
|
|
372
|
+
// });
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
});
|
|
376
|
+
},
|
|
377
|
+
(message: any) => {
|
|
378
|
+
// check message for disconnect
|
|
379
|
+
console.log("Disconnect");
|
|
380
|
+
|
|
381
|
+
setTimeout(() => {
|
|
382
|
+
this.connectWebsocket(chatCallback, token);
|
|
383
|
+
}, 500);
|
|
384
|
+
|
|
385
|
+
});
|
|
386
|
+
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
public disconnect() {
|
|
390
|
+
console.log("disconnect")
|
|
391
|
+
try {
|
|
392
|
+
if (this.stompClient) {
|
|
393
|
+
this.stompClient.disconnect();
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
}catch (e) {
|
|
397
|
+
console.log(e);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
export class Chat4App {
|
|
406
|
+
id: string;
|
|
407
|
+
configId: string;
|
|
408
|
+
externalId: string;
|
|
409
|
+
title: string;
|
|
410
|
+
status: ChatStatus4App;
|
|
411
|
+
users: Array<ChatUser4App>;
|
|
412
|
+
|
|
413
|
+
}
|
|
414
|
+
export class ChatUser4App {
|
|
415
|
+
id: string;
|
|
416
|
+
name: string;
|
|
417
|
+
clientToken: string;
|
|
418
|
+
picturePath: string;
|
|
419
|
+
email: string;
|
|
420
|
+
externalId: string;
|
|
421
|
+
status: ChatUserStatus4App;
|
|
422
|
+
}
|
|
423
|
+
export class ChatMessage4App {
|
|
424
|
+
id: string;
|
|
425
|
+
fromId: string;
|
|
426
|
+
toId: string;
|
|
427
|
+
chatId: string;
|
|
428
|
+
title: string;
|
|
429
|
+
body: string;
|
|
430
|
+
meta: Array<ChatMessageMeta4App>;
|
|
431
|
+
groupId: string;
|
|
432
|
+
read: Boolean;
|
|
433
|
+
dateHourIncluded: Date;
|
|
434
|
+
chatMessageFile: ChatMessageFile4App;
|
|
435
|
+
}
|
|
436
|
+
export class ChatMessageFile4App {
|
|
437
|
+
id: string;
|
|
438
|
+
name: string;
|
|
439
|
+
type: string;
|
|
440
|
+
size: number;
|
|
441
|
+
fullPath: string;
|
|
442
|
+
}
|
|
443
|
+
export class ChatMessageMeta4App {
|
|
444
|
+
name: string;
|
|
445
|
+
value: string;
|
|
446
|
+
}
|
|
447
|
+
export class Chat4AppMessageReceive {
|
|
448
|
+
data: Chat4AppMessageReceiveData = new Chat4AppMessageReceiveData();
|
|
449
|
+
notification: Chat4AppMessageReceiveNotification = new Chat4AppMessageReceiveNotification();
|
|
450
|
+
token: string;
|
|
451
|
+
}
|
|
452
|
+
export class Chat4AppMessageReceiveData {
|
|
453
|
+
toId: string;
|
|
454
|
+
chatId: string;
|
|
455
|
+
dateHour: string;
|
|
456
|
+
chatMessageId: string;
|
|
457
|
+
externalId: string;
|
|
458
|
+
type: string;
|
|
459
|
+
fromId: string;
|
|
460
|
+
fileId: string;
|
|
461
|
+
fileName: string;
|
|
462
|
+
fileSize: number;
|
|
463
|
+
fileType: string;
|
|
464
|
+
all: Map<string,string>;
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
}
|
|
469
|
+
export class Chat4AppMessageReceiveNotification {
|
|
470
|
+
body: string;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
export class ChatUserResponse4App {
|
|
474
|
+
totalMessages: number;
|
|
475
|
+
chat: Chat4App;
|
|
476
|
+
chatMessage: ChatMessage4App;
|
|
477
|
+
chats: ChatUserResponse4App[];
|
|
478
|
+
}
|
|
479
|
+
export class ChatFilterRequest4App {
|
|
480
|
+
type: ChatFilterType;
|
|
481
|
+
chatExternalId: string;
|
|
482
|
+
chatUserExternalId: string;
|
|
483
|
+
groupId: string;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
export enum ChatStatus4App{
|
|
487
|
+
CREATED = "CREATED",
|
|
488
|
+
CLOSED = "CLOSED"
|
|
489
|
+
|
|
490
|
+
}
|
|
491
|
+
export enum ChatUserStatus4App{
|
|
492
|
+
REMOVED = "REMOVED"
|
|
493
|
+
|
|
494
|
+
}
|
|
495
|
+
export enum ChatFilterType {
|
|
496
|
+
COUNT_NOT_READ = 1,
|
|
497
|
+
LAST_MESSAGE = 2
|
|
498
|
+
}
|
|
499
|
+
export interface IChatCallback {
|
|
500
|
+
onMessage(msg: Chat4AppMessageReceive): void;
|
|
501
|
+
}
|
|
502
|
+
|
package/package.json
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chat4app-client-angular",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "",
|
|
5
|
-
"main": "
|
|
5
|
+
"main": "chat4app.service.ts",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
8
|
},
|
|
9
9
|
"author": "",
|
|
10
|
-
"license": "ISC"
|
|
10
|
+
"license": "ISC",
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"net": "^1.0.2",
|
|
13
|
+
"sockjs-client": "^1.6.1",
|
|
14
|
+
"stompjs": "^2.3.3"
|
|
15
|
+
}
|
|
11
16
|
}
|