chat4app-client-angular 0.0.1 → 0.0.4
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/bundles/chat4app-client-angular.umd.js +464 -0
- package/bundles/chat4app-client-angular.umd.js.map +1 -0
- package/bundles/chat4app-client-angular.umd.min.js +2 -0
- package/bundles/chat4app-client-angular.umd.min.js.map +1 -0
- package/chat4app-client-angular.d.ts +5 -0
- package/chat4app-client-angular.d.ts.map +1 -0
- package/chat4app-client-angular.metadata.json +1 -0
- package/esm2015/chat4app-client-angular.js +5 -0
- package/esm2015/lib/chat4app-client-angular.component.js +18 -0
- package/esm2015/lib/chat4app-client-angular.module.js +12 -0
- package/esm2015/lib/chat4app-client-angular.service.js +355 -0
- package/esm2015/public-api.js +7 -0
- package/fesm2015/chat4app-client-angular.js +393 -0
- package/fesm2015/chat4app-client-angular.js.map +1 -0
- package/lib/chat4app-client-angular.component.d.ts +6 -0
- package/lib/chat4app-client-angular.component.d.ts.map +1 -0
- package/lib/chat4app-client-angular.module.d.ts +3 -0
- package/lib/chat4app-client-angular.module.d.ts.map +1 -0
- package/lib/chat4app-client-angular.service.d.ts +135 -0
- package/lib/chat4app-client-angular.service.d.ts.map +1 -0
- package/package.json +10 -2
- package/{src/public-api.ts → public-api.d.ts} +1 -4
- package/public-api.d.ts.map +1 -0
- package/karma.conf.js +0 -44
- package/ng-package.json +0 -7
- package/src/lib/chat4app-client-angular.component.spec.ts +0 -25
- package/src/lib/chat4app-client-angular.component.ts +0 -20
- package/src/lib/chat4app-client-angular.module.ts +0 -12
- package/src/lib/chat4app-client-angular.service.spec.ts +0 -16
- package/src/lib/chat4app-client-angular.service.ts +0 -556
- package/src/test.ts +0 -26
- package/tsconfig.lib.json +0 -26
- package/tsconfig.lib.prod.json +0 -10
- package/tsconfig.spec.json +0 -17
- package/tslint.json +0 -17
|
@@ -0,0 +1,464 @@
|
|
|
1
|
+
(function (global, factory) {
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('stompjs'), require('sockjs-client'), require('@angular/common/http'), require('moment')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('chat4app-client-angular', ['exports', '@angular/core', 'stompjs', 'sockjs-client', '@angular/common/http', 'moment'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["chat4app-client-angular"] = {}, global.ng.core, global.Stomp, global.SockJS, global.ng.common.http, global.moment));
|
|
5
|
+
})(this, (function (exports, i0, Stomp, SockJS, i1, moment) { 'use strict';
|
|
6
|
+
|
|
7
|
+
function _interopNamespace(e) {
|
|
8
|
+
if (e && e.__esModule) return e;
|
|
9
|
+
var n = Object.create(null);
|
|
10
|
+
if (e) {
|
|
11
|
+
Object.keys(e).forEach(function (k) {
|
|
12
|
+
if (k !== 'default') {
|
|
13
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () { return e[k]; }
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
n["default"] = e;
|
|
22
|
+
return Object.freeze(n);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
|
|
26
|
+
var Stomp__namespace = /*#__PURE__*/_interopNamespace(Stomp);
|
|
27
|
+
var SockJS__namespace = /*#__PURE__*/_interopNamespace(SockJS);
|
|
28
|
+
var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
|
|
29
|
+
var moment__namespace = /*#__PURE__*/_interopNamespace(moment);
|
|
30
|
+
|
|
31
|
+
var Chat4appClientAngularService = /** @class */ (function () {
|
|
32
|
+
function Chat4appClientAngularService(http) {
|
|
33
|
+
this.http = http;
|
|
34
|
+
this.chatServer = "";
|
|
35
|
+
this.chatUrl = "";
|
|
36
|
+
}
|
|
37
|
+
Chat4appClientAngularService.prototype.ngOnInit = function () {
|
|
38
|
+
};
|
|
39
|
+
Chat4appClientAngularService.prototype.config = function (chat4AppConfig) {
|
|
40
|
+
this.chatServer = chat4AppConfig.endpoint;
|
|
41
|
+
this.chatUrl = chat4AppConfig.endpoint + "/api/v1/";
|
|
42
|
+
};
|
|
43
|
+
Chat4appClientAngularService.prototype.init = function (securityChatToken, callback, chatCallback, connectionClientId) {
|
|
44
|
+
if (!this.chatServer || this.chatServer.trim().length == 0) {
|
|
45
|
+
throw new Error("Endpoint is empty");
|
|
46
|
+
}
|
|
47
|
+
if (!securityChatToken || securityChatToken.trim().length == 0) {
|
|
48
|
+
throw new Error("SecurityChatToken is empty");
|
|
49
|
+
}
|
|
50
|
+
this.setTokenChat4app(securityChatToken);
|
|
51
|
+
if (chatCallback && connectionClientId) {
|
|
52
|
+
this.connectWebsocket(chatCallback, connectionClientId);
|
|
53
|
+
}
|
|
54
|
+
callback(securityChatToken);
|
|
55
|
+
};
|
|
56
|
+
Chat4appClientAngularService.prototype.getChatUrlDownload = function (messageFileId) {
|
|
57
|
+
return this.chatUrl + "chatmessage/getFile?messageFileId=" + messageFileId;
|
|
58
|
+
};
|
|
59
|
+
Chat4appClientAngularService.prototype.getMessageChat = function (chatId, fromId, toId) {
|
|
60
|
+
var url = this.chatUrl + "chatmessage/" + chatId + "/" + fromId + "/" + toId;
|
|
61
|
+
return this.http.get(url, {
|
|
62
|
+
headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
Chat4appClientAngularService.prototype.getMessageChatByGrop = function (chatId, groupId, fromId) {
|
|
66
|
+
var url = this.chatUrl + "chatmessage/byGroup/" + chatId + "/" + groupId + "/" + fromId;
|
|
67
|
+
return this.http.get(url, {
|
|
68
|
+
headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
Chat4appClientAngularService.prototype.addMessageChat = function (chatMessage4App) {
|
|
72
|
+
var url = this.chatUrl + "chatmessage/" + chatMessage4App.chatId;
|
|
73
|
+
return this.http.post(url, chatMessage4App, {
|
|
74
|
+
headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
Chat4appClientAngularService.prototype.props = function (chatFilterRequest4App) {
|
|
78
|
+
var url = this.chatUrl + "chatmessage/props";
|
|
79
|
+
return this.http.post(url, chatFilterRequest4App, {
|
|
80
|
+
headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
Chat4appClientAngularService.prototype.removeUsersChat = function (chatId, chatUsersId, chatUsersExternalId) {
|
|
84
|
+
var params = new Array();
|
|
85
|
+
if (chatUsersId && chatUsersId.length > 0) {
|
|
86
|
+
chatUsersId.forEach(function (cui) {
|
|
87
|
+
params.push("chatUserId=" + cui);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
else if (chatUsersExternalId && chatUsersExternalId.length > 0) {
|
|
91
|
+
chatUsersExternalId.forEach(function (cuei) {
|
|
92
|
+
params.push("chatUserExternalId=" + cuei);
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
var url = this.chatUrl + "chatuser/" + chatId + "?" + params.join("&");
|
|
96
|
+
return this.http.delete(url, {
|
|
97
|
+
headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
Chat4appClientAngularService.prototype.removeUserChat = function (chatId, chatUserId, chatUserExternalId) {
|
|
101
|
+
var param = "";
|
|
102
|
+
if (chatUserId) {
|
|
103
|
+
param = "chatUserId=" + chatUserId;
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
param = "chatUserExternalId=" + chatUserExternalId;
|
|
107
|
+
}
|
|
108
|
+
var url = this.chatUrl + "chatuser/" + chatId + "?" + param;
|
|
109
|
+
return this.http.delete(url, {
|
|
110
|
+
headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
Chat4appClientAngularService.prototype.updateUserChat = function (chatId, charUser4AppUpdate) {
|
|
114
|
+
var url = this.chatUrl + "chatuser/" + chatId;
|
|
115
|
+
return this.http.put(url, charUser4AppUpdate, {
|
|
116
|
+
headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
Chat4appClientAngularService.prototype.createUserChat = function (chatId, chatUser4App) {
|
|
120
|
+
var url = this.chatUrl + "chatuser/" + chatId;
|
|
121
|
+
return this.http.post(url, chatUser4App, {
|
|
122
|
+
headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
Chat4appClientAngularService.prototype.createUsersChat = function (chatId, chatUser4App) {
|
|
126
|
+
var url = this.chatUrl + "chatuser/users/" + chatId;
|
|
127
|
+
return this.http.post(url, chatUser4App, {
|
|
128
|
+
headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
|
|
129
|
+
});
|
|
130
|
+
};
|
|
131
|
+
Chat4appClientAngularService.prototype.createChat = function (chat4app) {
|
|
132
|
+
var url = this.chatUrl + "chat";
|
|
133
|
+
return this.http.post(url, chat4app, {
|
|
134
|
+
headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
|
|
135
|
+
});
|
|
136
|
+
};
|
|
137
|
+
Chat4appClientAngularService.prototype.createUpdateChat = function (chat4app) {
|
|
138
|
+
var url = this.chatUrl + "chat";
|
|
139
|
+
return this.http.put(url, chat4app, {
|
|
140
|
+
headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
Chat4appClientAngularService.prototype.getLastMessageGroup = function (chatExternalId, groupId) {
|
|
144
|
+
var url = this.chatUrl + "chatmessage/lastMessageGroup?chatExternalId=" + chatExternalId + "&groupId=" + groupId;
|
|
145
|
+
return this.http.get(url, {
|
|
146
|
+
headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
|
|
147
|
+
});
|
|
148
|
+
};
|
|
149
|
+
Chat4appClientAngularService.prototype.getLastMessage = function (chatExternalId, chatUserExternalId) {
|
|
150
|
+
var url = this.chatUrl + "chatmessage/lastMessage?chatExternalId=" + chatExternalId + "&chatUserExternalId=" + chatUserExternalId;
|
|
151
|
+
return this.http.get(url, {
|
|
152
|
+
headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
|
|
153
|
+
});
|
|
154
|
+
};
|
|
155
|
+
Chat4appClientAngularService.prototype.countNotReadMessages = function (chatUserExternalId, chatExternalId, groupId) {
|
|
156
|
+
var url = this.chatUrl + "chatmessage/countNotReadMessages?chatUserExternalId=" + chatUserExternalId;
|
|
157
|
+
if (chatExternalId && chatExternalId.length > 0) {
|
|
158
|
+
url += "&chatExternalId=" + chatExternalId;
|
|
159
|
+
}
|
|
160
|
+
if (groupId && groupId.length > 0) {
|
|
161
|
+
url += "&groupId=" + groupId;
|
|
162
|
+
}
|
|
163
|
+
return this.http.get(url, {
|
|
164
|
+
headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
|
|
165
|
+
});
|
|
166
|
+
};
|
|
167
|
+
Chat4appClientAngularService.prototype.getChatByExternalId = function (externalId) {
|
|
168
|
+
var url = this.chatUrl + "chat?externalId=" + externalId;
|
|
169
|
+
return this.http.get(url, {
|
|
170
|
+
headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
|
|
171
|
+
});
|
|
172
|
+
};
|
|
173
|
+
Chat4appClientAngularService.prototype.readMessage = function (chatMessageId, toId) {
|
|
174
|
+
var url = this.chatUrl + "chatmessage/read/" + chatMessageId;
|
|
175
|
+
if (toId && toId.length > 0) {
|
|
176
|
+
url += "/" + toId;
|
|
177
|
+
}
|
|
178
|
+
return this.http.put(url, null, {
|
|
179
|
+
headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
Chat4appClientAngularService.prototype.online = function (chatId, chatUserId) {
|
|
183
|
+
var url = this.chatUrl + "chatmessage/online/" + chatId + "/" + chatUserId;
|
|
184
|
+
return this.http.get(url, {
|
|
185
|
+
headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
|
|
186
|
+
});
|
|
187
|
+
};
|
|
188
|
+
Chat4appClientAngularService.prototype.sendFile = function (chatId, fromId, toId, fileToUpload) {
|
|
189
|
+
var endpoint = this.chatUrl + "chatmessage/sendFile/" + chatId + "/" + fromId + "/" + toId;
|
|
190
|
+
var formData = new FormData();
|
|
191
|
+
formData.append('file', fileToUpload);
|
|
192
|
+
return this.http
|
|
193
|
+
.post(endpoint, formData, {
|
|
194
|
+
headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
|
|
195
|
+
});
|
|
196
|
+
};
|
|
197
|
+
Chat4appClientAngularService.prototype.sendFileGroup = function (chatId, fromId, groupId, fileToUpload) {
|
|
198
|
+
var endpoint = this.chatUrl + "chatmessage/sendFileGroup/" + chatId + "/" + fromId + "/" + groupId;
|
|
199
|
+
var formData = new FormData();
|
|
200
|
+
formData.append('file', fileToUpload);
|
|
201
|
+
return this.http
|
|
202
|
+
.post(endpoint, formData, {
|
|
203
|
+
headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
|
|
204
|
+
});
|
|
205
|
+
};
|
|
206
|
+
/* Token */
|
|
207
|
+
Chat4appClientAngularService.prototype.getBearerToken = function () {
|
|
208
|
+
var ret = "Bearer " + window.sessionStorage.getItem("chat4AppSessionToken");
|
|
209
|
+
return ret;
|
|
210
|
+
};
|
|
211
|
+
Chat4appClientAngularService.prototype.setTokenChat4app = function (chat4AppSessionToken) {
|
|
212
|
+
window.sessionStorage.setItem("chat4AppSessionToken", chat4AppSessionToken);
|
|
213
|
+
};
|
|
214
|
+
/* Connection */
|
|
215
|
+
Chat4appClientAngularService.prototype.onMessageFirebaseReceived = function (data, chatCallback) {
|
|
216
|
+
//alert("onMessageReceived connectFirebase");
|
|
217
|
+
if (data.type == "msg") {
|
|
218
|
+
var chat4appMessage = new Chat4AppMessageReceive();
|
|
219
|
+
chat4appMessage.data.chatId = data.chatId;
|
|
220
|
+
chat4appMessage.data.chatMessageId = data.chatMessageId;
|
|
221
|
+
chat4appMessage.data.externalId = data.externalId;
|
|
222
|
+
chat4appMessage.data.fromId = data.fromId;
|
|
223
|
+
chat4appMessage.data.toId = data.toId;
|
|
224
|
+
chat4appMessage.data.dateHour = data.dateHour;
|
|
225
|
+
chat4appMessage.data.type = data.type;
|
|
226
|
+
chat4appMessage.notification.body = data.body;
|
|
227
|
+
if (data.fileId && data.fileId.length > 0) {
|
|
228
|
+
chat4appMessage.data.fileId = data.fileId;
|
|
229
|
+
chat4appMessage.data.fileName = data.fileName;
|
|
230
|
+
chat4appMessage.data.fileSize = data.fileSize;
|
|
231
|
+
chat4appMessage.data.fileType = data.fileType;
|
|
232
|
+
}
|
|
233
|
+
var datTmp = new Map();
|
|
234
|
+
for (var key in data) {
|
|
235
|
+
datTmp.set(key, data[key]);
|
|
236
|
+
}
|
|
237
|
+
chat4appMessage.data.all = datTmp;
|
|
238
|
+
chatCallback.onMessage(chat4appMessage);
|
|
239
|
+
}
|
|
240
|
+
else if ((data.type == "on" || data.type == "off")) {
|
|
241
|
+
var chat4appMessage = new Chat4AppMessageReceive();
|
|
242
|
+
chat4appMessage.data.chatId = data.chatId;
|
|
243
|
+
chat4appMessage.data.chatMessageId = data.chatMessageId;
|
|
244
|
+
chat4appMessage.data.externalId = data.externalId;
|
|
245
|
+
chat4appMessage.data.fromId = data.fromId;
|
|
246
|
+
chat4appMessage.data.toId = data.toId;
|
|
247
|
+
chat4appMessage.data.dateHour = data.dateHour;
|
|
248
|
+
chat4appMessage.data.type = data.type;
|
|
249
|
+
var datTmp = new Map();
|
|
250
|
+
for (var key in data) {
|
|
251
|
+
datTmp.set(key, data[key]);
|
|
252
|
+
}
|
|
253
|
+
chat4appMessage.data.all = datTmp;
|
|
254
|
+
chatCallback.onOffline(chat4appMessage);
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
Chat4appClientAngularService.prototype.connectWebsocket = function (chatCallback, token) {
|
|
258
|
+
var _this = this;
|
|
259
|
+
this.disconnect();
|
|
260
|
+
var securityToken = this.getBearerToken();
|
|
261
|
+
this.sock = new SockJS__namespace(this.chatServer + '/stomp/gkz-stomp-endpoint?token=' + securityToken);
|
|
262
|
+
this.stompClient = Stomp__namespace.over(this.sock);
|
|
263
|
+
this.stompClient.debug = function (msg) {
|
|
264
|
+
//console.log(msg);
|
|
265
|
+
};
|
|
266
|
+
this.stompClient.connect({}, function (frame) {
|
|
267
|
+
//console.log(frame);
|
|
268
|
+
_this.stompClient.subscribe('/queue/' + token, function (msg) {
|
|
269
|
+
//console.log('mensagem', msg);
|
|
270
|
+
if (msg.command == "MESSAGE") {
|
|
271
|
+
//console.log(msg)
|
|
272
|
+
var msgObj = JSON.parse(msg.body);
|
|
273
|
+
var datTmp = new Map();
|
|
274
|
+
for (var key in msgObj.data) {
|
|
275
|
+
datTmp.set(key, msgObj.data[key]);
|
|
276
|
+
}
|
|
277
|
+
msgObj.data.all = datTmp;
|
|
278
|
+
if (msgObj.data.type == "msg") {
|
|
279
|
+
chatCallback.onMessage(msgObj);
|
|
280
|
+
}
|
|
281
|
+
else if ((msgObj.data.type == "on" || msgObj.data.type == "off")) {
|
|
282
|
+
chatCallback.onOffline(msgObj);
|
|
283
|
+
}
|
|
284
|
+
//callback(msg.body);
|
|
285
|
+
// ichatcallback.forEach((iChat)=>{
|
|
286
|
+
// iChat.onMessage(JSON.parse(msg.body) );
|
|
287
|
+
// });
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
}, function (message) {
|
|
291
|
+
// check message for disconnect
|
|
292
|
+
//console.log("Disconnect");
|
|
293
|
+
setTimeout(function () {
|
|
294
|
+
_this.connectWebsocket(chatCallback, token);
|
|
295
|
+
}, 500);
|
|
296
|
+
});
|
|
297
|
+
};
|
|
298
|
+
Chat4appClientAngularService.prototype.disconnect = function () {
|
|
299
|
+
// console.log("disconnect")
|
|
300
|
+
try {
|
|
301
|
+
if (this.stompClient) {
|
|
302
|
+
this.stompClient.disconnect();
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
catch (e) {
|
|
306
|
+
console.log(e);
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
Chat4appClientAngularService.prototype.convertChat4AppMessageReceiveToChatMessage4App = function (msg) {
|
|
310
|
+
var message = new ChatMessage4App();
|
|
311
|
+
message.body = msg.notification.body;
|
|
312
|
+
message.chatId = msg.data.chatId;
|
|
313
|
+
message.fromId = msg.data.fromId;
|
|
314
|
+
message.toId = msg.data.toId;
|
|
315
|
+
message.dateHourIncluded = moment__namespace.utc(msg.data.dateHour, "DD-MM-YYYY hh:mm:ss").toDate();
|
|
316
|
+
if (msg.data.fileId && msg.data.fileId.length > 0) {
|
|
317
|
+
var messageFile = new ChatMessageFile4App();
|
|
318
|
+
messageFile.id = msg.data.fileId;
|
|
319
|
+
messageFile.name = msg.data.fileName;
|
|
320
|
+
messageFile.size = msg.data.fileSize;
|
|
321
|
+
messageFile.type = msg.data.fileType;
|
|
322
|
+
message.chatMessageFile = messageFile;
|
|
323
|
+
}
|
|
324
|
+
return message;
|
|
325
|
+
};
|
|
326
|
+
return Chat4appClientAngularService;
|
|
327
|
+
}());
|
|
328
|
+
Chat4appClientAngularService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function Chat4appClientAngularService_Factory() { return new Chat4appClientAngularService(i0__namespace.ɵɵinject(i1__namespace.HttpClient)); }, token: Chat4appClientAngularService, providedIn: "root" });
|
|
329
|
+
Chat4appClientAngularService.decorators = [
|
|
330
|
+
{ type: i0.Injectable, args: [{
|
|
331
|
+
providedIn: 'root'
|
|
332
|
+
},] }
|
|
333
|
+
];
|
|
334
|
+
Chat4appClientAngularService.ctorParameters = function () { return [
|
|
335
|
+
{ type: i1.HttpClient }
|
|
336
|
+
]; };
|
|
337
|
+
var Chat4App = /** @class */ (function () {
|
|
338
|
+
function Chat4App() {
|
|
339
|
+
}
|
|
340
|
+
return Chat4App;
|
|
341
|
+
}());
|
|
342
|
+
var ChatUser4App = /** @class */ (function () {
|
|
343
|
+
function ChatUser4App() {
|
|
344
|
+
}
|
|
345
|
+
return ChatUser4App;
|
|
346
|
+
}());
|
|
347
|
+
var ChatMessage4App = /** @class */ (function () {
|
|
348
|
+
function ChatMessage4App() {
|
|
349
|
+
}
|
|
350
|
+
return ChatMessage4App;
|
|
351
|
+
}());
|
|
352
|
+
var ChatMessageFile4App = /** @class */ (function () {
|
|
353
|
+
function ChatMessageFile4App() {
|
|
354
|
+
}
|
|
355
|
+
return ChatMessageFile4App;
|
|
356
|
+
}());
|
|
357
|
+
var ChatMessageMeta4App = /** @class */ (function () {
|
|
358
|
+
function ChatMessageMeta4App() {
|
|
359
|
+
}
|
|
360
|
+
return ChatMessageMeta4App;
|
|
361
|
+
}());
|
|
362
|
+
var Chat4AppMessageReceive = /** @class */ (function () {
|
|
363
|
+
function Chat4AppMessageReceive() {
|
|
364
|
+
this.data = new Chat4AppMessageReceiveData();
|
|
365
|
+
this.notification = new Chat4AppMessageReceiveNotification();
|
|
366
|
+
}
|
|
367
|
+
return Chat4AppMessageReceive;
|
|
368
|
+
}());
|
|
369
|
+
var Chat4AppMessageReceiveData = /** @class */ (function () {
|
|
370
|
+
function Chat4AppMessageReceiveData() {
|
|
371
|
+
}
|
|
372
|
+
return Chat4AppMessageReceiveData;
|
|
373
|
+
}());
|
|
374
|
+
var Chat4AppMessageReceiveNotification = /** @class */ (function () {
|
|
375
|
+
function Chat4AppMessageReceiveNotification() {
|
|
376
|
+
}
|
|
377
|
+
return Chat4AppMessageReceiveNotification;
|
|
378
|
+
}());
|
|
379
|
+
var ChatUserResponse4App = /** @class */ (function () {
|
|
380
|
+
function ChatUserResponse4App() {
|
|
381
|
+
}
|
|
382
|
+
return ChatUserResponse4App;
|
|
383
|
+
}());
|
|
384
|
+
var ChatFilterRequest4App = /** @class */ (function () {
|
|
385
|
+
function ChatFilterRequest4App() {
|
|
386
|
+
}
|
|
387
|
+
return ChatFilterRequest4App;
|
|
388
|
+
}());
|
|
389
|
+
var Chat4AppConfig = /** @class */ (function () {
|
|
390
|
+
function Chat4AppConfig(endpoint) {
|
|
391
|
+
this.endpoint = endpoint;
|
|
392
|
+
}
|
|
393
|
+
return Chat4AppConfig;
|
|
394
|
+
}());
|
|
395
|
+
exports.ChatStatus4App = void 0;
|
|
396
|
+
(function (ChatStatus4App) {
|
|
397
|
+
ChatStatus4App["CREATED"] = "CREATED";
|
|
398
|
+
ChatStatus4App["CLOSED"] = "CLOSED";
|
|
399
|
+
})(exports.ChatStatus4App || (exports.ChatStatus4App = {}));
|
|
400
|
+
exports.ChatUserStatus4App = void 0;
|
|
401
|
+
(function (ChatUserStatus4App) {
|
|
402
|
+
ChatUserStatus4App["REMOVED"] = "REMOVED";
|
|
403
|
+
})(exports.ChatUserStatus4App || (exports.ChatUserStatus4App = {}));
|
|
404
|
+
exports.ChatFilterType = void 0;
|
|
405
|
+
(function (ChatFilterType) {
|
|
406
|
+
ChatFilterType[ChatFilterType["COUNT_NOT_READ"] = 1] = "COUNT_NOT_READ";
|
|
407
|
+
ChatFilterType[ChatFilterType["LAST_MESSAGE"] = 2] = "LAST_MESSAGE";
|
|
408
|
+
})(exports.ChatFilterType || (exports.ChatFilterType = {}));
|
|
409
|
+
|
|
410
|
+
var Chat4appClientAngularComponent = /** @class */ (function () {
|
|
411
|
+
function Chat4appClientAngularComponent() {
|
|
412
|
+
}
|
|
413
|
+
Chat4appClientAngularComponent.prototype.ngOnInit = function () {
|
|
414
|
+
};
|
|
415
|
+
return Chat4appClientAngularComponent;
|
|
416
|
+
}());
|
|
417
|
+
Chat4appClientAngularComponent.decorators = [
|
|
418
|
+
{ type: i0.Component, args: [{
|
|
419
|
+
selector: 'lib-chat4app-client-angular',
|
|
420
|
+
template: "\n <p>\n chat4app-client-angular works!\n </p>\n "
|
|
421
|
+
},] }
|
|
422
|
+
];
|
|
423
|
+
Chat4appClientAngularComponent.ctorParameters = function () { return []; };
|
|
424
|
+
|
|
425
|
+
var Chat4appClientAngularModule = /** @class */ (function () {
|
|
426
|
+
function Chat4appClientAngularModule() {
|
|
427
|
+
}
|
|
428
|
+
return Chat4appClientAngularModule;
|
|
429
|
+
}());
|
|
430
|
+
Chat4appClientAngularModule.decorators = [
|
|
431
|
+
{ type: i0.NgModule, args: [{
|
|
432
|
+
declarations: [Chat4appClientAngularComponent],
|
|
433
|
+
imports: [],
|
|
434
|
+
exports: [Chat4appClientAngularComponent]
|
|
435
|
+
},] }
|
|
436
|
+
];
|
|
437
|
+
|
|
438
|
+
/*
|
|
439
|
+
* Public API Surface of chat4app-client-angular
|
|
440
|
+
*/
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* Generated bundle index. Do not edit.
|
|
444
|
+
*/
|
|
445
|
+
|
|
446
|
+
exports.Chat4App = Chat4App;
|
|
447
|
+
exports.Chat4AppConfig = Chat4AppConfig;
|
|
448
|
+
exports.Chat4AppMessageReceive = Chat4AppMessageReceive;
|
|
449
|
+
exports.Chat4AppMessageReceiveData = Chat4AppMessageReceiveData;
|
|
450
|
+
exports.Chat4AppMessageReceiveNotification = Chat4AppMessageReceiveNotification;
|
|
451
|
+
exports.Chat4appClientAngularComponent = Chat4appClientAngularComponent;
|
|
452
|
+
exports.Chat4appClientAngularModule = Chat4appClientAngularModule;
|
|
453
|
+
exports.Chat4appClientAngularService = Chat4appClientAngularService;
|
|
454
|
+
exports.ChatFilterRequest4App = ChatFilterRequest4App;
|
|
455
|
+
exports.ChatMessage4App = ChatMessage4App;
|
|
456
|
+
exports.ChatMessageFile4App = ChatMessageFile4App;
|
|
457
|
+
exports.ChatMessageMeta4App = ChatMessageMeta4App;
|
|
458
|
+
exports.ChatUser4App = ChatUser4App;
|
|
459
|
+
exports.ChatUserResponse4App = ChatUserResponse4App;
|
|
460
|
+
|
|
461
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
462
|
+
|
|
463
|
+
}));
|
|
464
|
+
//# sourceMappingURL=chat4app-client-angular.umd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat4app-client-angular.umd.js","sources":["../../../projects/chat4app-client-angular/src/lib/chat4app-client-angular.service.ts","../../../projects/chat4app-client-angular/src/lib/chat4app-client-angular.component.ts","../../../projects/chat4app-client-angular/src/lib/chat4app-client-angular.module.ts","../../../projects/chat4app-client-angular/src/public-api.ts","../../../projects/chat4app-client-angular/src/chat4app-client-angular.ts"],"sourcesContent":["import { Injectable, OnInit } from '@angular/core';\nimport * as Stomp from 'stompjs';\nimport * as SockJS from 'sockjs-client';\nimport { HttpClient, HttpHeaders } from '@angular/common/http';\nimport { Observable } from 'rxjs';\nimport * as moment from 'moment';\n\n\n\n@Injectable({\n providedIn: 'root'\n})\nexport class Chat4appClientAngularService implements OnInit {\n\n chatServer = \"\";\n chatUrl = \"\";\n \n sock: any;\n stompClient: any;\n\n constructor( private http: HttpClient) {\n \n }\n ngOnInit(): void {\n }\n\n config(chat4AppConfig: Chat4AppConfig) {\n this.chatServer = chat4AppConfig.endpoint;\n this.chatUrl = chat4AppConfig.endpoint + \"/api/v1/\" ;\n }\n \n init(securityChatToken: string, callback: any, chatCallback?: IChatCallback, connectionClientId?: string) {\n\n if (!this.chatServer || this.chatServer.trim().length == 0){\n throw new Error(\"Endpoint is empty\");\n }\n if (!securityChatToken || securityChatToken.trim().length == 0){\n throw new Error(\"SecurityChatToken is empty\");\n }\n\n this.setTokenChat4app(securityChatToken);\n \n if (chatCallback && connectionClientId) {\n this.connectWebsocket(chatCallback, connectionClientId);\n }\n \n callback(securityChatToken);\n }\n \n getChatUrlDownload(messageFileId: string) {\n return this.chatUrl + \"chatmessage/getFile?messageFileId=\" + messageFileId;\n }\n \n \n getMessageChat(chatId: string, fromId: string, toId: string): Observable<Array<ChatMessage4App>> {\n let url = this.chatUrl + \"chatmessage/\" + chatId + \"/\" + fromId + \"/\" + toId;\n \n return this.http.get<Array<ChatMessage4App>>(url,\n {\n headers: new HttpHeaders().set('Authorization', this.getBearerToken())\n })\n \n }\n getMessageChatByGrop(chatId: string, groupId: string, fromId: string): Observable<Array<ChatMessage4App>> {\n let url = this.chatUrl + \"chatmessage/byGroup/\" + chatId + \"/\" + groupId + \"/\" + fromId;\n \n return this.http.get<Array<ChatMessage4App>>(url,\n {\n headers: new HttpHeaders().set('Authorization', this.getBearerToken())\n })\n \n }\n \n \n addMessageChat(chatMessage4App: ChatMessage4App): Observable<ChatMessage4App> {\n let url = this.chatUrl + \"chatmessage/\" + chatMessage4App.chatId;\n \n return this.http.post<ChatMessage4App>(url, chatMessage4App,\n {\n headers: new HttpHeaders().set('Authorization', this.getBearerToken())\n })\n \n }\n props(chatFilterRequest4App: Array<ChatFilterRequest4App>): Observable<ChatUserResponse4App[]> {\n let url = this.chatUrl + \"chatmessage/props\";\n \n return this.http.post<ChatUserResponse4App[]>(url, chatFilterRequest4App,\n {\n headers: new HttpHeaders().set('Authorization', this.getBearerToken())\n })\n \n }\n \n \n removeUsersChat(chatId: string, chatUsersId?: string[], chatUsersExternalId?: string[]): Observable<ChatUser4App[]> {\n let params = new Array();\n if (chatUsersId && chatUsersId.length > 0) {\n \n chatUsersId.forEach(cui => {\n params.push(\"chatUserId=\" + cui);\n });\n } else if (chatUsersExternalId && chatUsersExternalId.length > 0) {\n chatUsersExternalId.forEach(cuei => {\n params.push(\"chatUserExternalId=\" + cuei);\n })\n \n }\n \n let url = this.chatUrl + \"chatuser/\" + chatId + \"?\" + params.join(\"&\");\n \n return this.http.delete<ChatUser4App[]>(url,\n {\n headers: new HttpHeaders().set('Authorization', this.getBearerToken())\n })\n }\n \n removeUserChat(chatId: string, chatUserId?: string, chatUserExternalId?: string): Observable<ChatUser4App> {\n let param = \"\";\n if (chatUserId) {\n param = \"chatUserId=\" + chatUserId;\n } else {\n param = \"chatUserExternalId=\" + chatUserExternalId;\n }\n \n let url = this.chatUrl + \"chatuser/\" + chatId + \"?\" + param;\n \n return this.http.delete<ChatUser4App>(url,\n {\n headers: new HttpHeaders().set('Authorization', this.getBearerToken())\n })\n }\n \n updateUserChat(chatId: string, charUser4AppUpdate: ChatUser4App): Observable<ChatUser4App> {\n \n let url = this.chatUrl + \"chatuser/\" + chatId;\n \n return this.http.put<ChatUser4App>(url, charUser4AppUpdate,\n {\n headers: new HttpHeaders().set('Authorization', this.getBearerToken())\n })\n }\n \n \n createUserChat(chatId: string, chatUser4App: ChatUser4App): Observable<ChatUser4App> {\n let url = this.chatUrl + \"chatuser/\" + chatId;\n \n return this.http.post<ChatUser4App>(url, chatUser4App,\n {\n headers: new HttpHeaders().set('Authorization', this.getBearerToken())\n })\n }\n \n createUsersChat(chatId: string, chatUser4App: ChatUser4App[]): Observable<ChatUser4App[]> {\n let url = this.chatUrl + \"chatuser/users/\" + chatId;\n \n return this.http.post<ChatUser4App[]>(url, chatUser4App,\n {\n headers: new HttpHeaders().set('Authorization', this.getBearerToken())\n })\n }\n \n \n createChat(chat4app: Chat4App): Observable<Chat4App> {\n let url = this.chatUrl + \"chat\";\n \n return this.http.post<Chat4App>(url, chat4app,\n {\n headers: new HttpHeaders().set('Authorization', this.getBearerToken())\n })\n }\n createUpdateChat(chat4app: Chat4App): Observable<Chat4App> {\n let url = this.chatUrl + \"chat\";\n \n return this.http.put<Chat4App>(url, chat4app,\n {\n headers: new HttpHeaders().set('Authorization', this.getBearerToken())\n })\n }\n \n \n getLastMessageGroup(chatExternalId: string, groupId: string): Observable<ChatUserResponse4App> {\n \n let url = this.chatUrl + \"chatmessage/lastMessageGroup?chatExternalId=\" + chatExternalId + \"&groupId=\" + groupId;\n \n return this.http.get<ChatUserResponse4App>(url,\n {\n headers: new HttpHeaders().set('Authorization', this.getBearerToken())\n })\n }\n getLastMessage(chatExternalId: string, chatUserExternalId: string): Observable<ChatUserResponse4App> {\n \n let url = this.chatUrl + \"chatmessage/lastMessage?chatExternalId=\" + chatExternalId + \"&chatUserExternalId=\" + chatUserExternalId;\n \n return this.http.get<ChatUserResponse4App>(url,\n {\n headers: new HttpHeaders().set('Authorization', this.getBearerToken())\n })\n }\n countNotReadMessages(chatUserExternalId: string, chatExternalId?: string, groupId?: string): Observable<ChatUserResponse4App> {\n \n let url = this.chatUrl + \"chatmessage/countNotReadMessages?chatUserExternalId=\" + chatUserExternalId;\n \n if (chatExternalId && chatExternalId.length > 0) {\n url += \"&chatExternalId=\" + chatExternalId;\n }\n \n if (groupId && groupId.length > 0) {\n url += \"&groupId=\" + groupId;\n }\n \n return this.http.get<ChatUserResponse4App>(url,\n {\n headers: new HttpHeaders().set('Authorization', this.getBearerToken())\n })\n }\n \n \n getChatByExternalId(externalId: string): Observable<Chat4App> {\n \n let url = this.chatUrl + \"chat?externalId=\" + externalId;\n \n return this.http.get<Chat4App>(url,\n {\n headers: new HttpHeaders().set('Authorization', this.getBearerToken())\n })\n }\n readMessage(chatMessageId: string, toId?: string): Observable<void> {\n \n let url = this.chatUrl + \"chatmessage/read/\" + chatMessageId;\n \n if (toId && toId.length > 0) {\n url += \"/\" + toId;\n }\n \n return this.http.put<void>(url, null,\n {\n headers: new HttpHeaders().set('Authorization', this.getBearerToken())\n })\n }\n online(chatId: string, chatUserId: string): Observable<number> {\n \n let url = this.chatUrl + \"chatmessage/online/\" + chatId + \"/\" + chatUserId;\n \n return this.http.get<number>(url,\n {\n headers: new HttpHeaders().set('Authorization', this.getBearerToken())\n })\n }\n \n \n sendFile(chatId: string, fromId: string, toId: string, fileToUpload: File): Observable<ChatMessageFile4App> {\n const endpoint = this.chatUrl + \"chatmessage/sendFile/\" + chatId + \"/\" + fromId + \"/\" + toId;\n \n const formData: FormData = new FormData();\n formData.append('file', fileToUpload);\n \n return this.http\n .post<ChatMessageFile4App>(endpoint, formData,\n {\n headers: new HttpHeaders().set('Authorization', this.getBearerToken())\n });\n }\n \n sendFileGroup(chatId: string, fromId: string, groupId: string, fileToUpload: File): Observable<ChatMessageFile4App> {\n const endpoint = this.chatUrl + \"chatmessage/sendFileGroup/\" + chatId + \"/\" + fromId + \"/\" + groupId;\n \n const formData: FormData = new FormData();\n formData.append('file', fileToUpload);\n \n return this.http\n .post<ChatMessageFile4App>(endpoint, formData,\n {\n headers: new HttpHeaders().set('Authorization', this.getBearerToken())\n });\n }\n \n \n /* Token */\n getBearerToken(): string {\n \n let ret = \"Bearer \" + window.sessionStorage.getItem(\"chat4AppSessionToken\");\n \n return ret;\n }\n \n \n setTokenChat4app(chat4AppSessionToken: string) {\n \n \n window.sessionStorage.setItem(\"chat4AppSessionToken\", chat4AppSessionToken);\n }\n \n \n /* Connection */\n \n onMessageFirebaseReceived(data: any, chatCallback: IChatCallback) {\n \n \n //alert(\"onMessageReceived connectFirebase\");\n \n if (data.type == \"msg\") {\n \n let chat4appMessage = new Chat4AppMessageReceive();\n chat4appMessage.data.chatId = data.chatId;\n chat4appMessage.data.chatMessageId = data.chatMessageId;\n chat4appMessage.data.externalId = data.externalId;\n chat4appMessage.data.fromId = data.fromId;\n chat4appMessage.data.toId = data.toId;\n chat4appMessage.data.dateHour = data.dateHour;\n chat4appMessage.data.type = data.type;\n chat4appMessage.notification.body = data.body;\n \n if (data.fileId && data.fileId.length > 0) {\n chat4appMessage.data.fileId = data.fileId;\n chat4appMessage.data.fileName = data.fileName;\n chat4appMessage.data.fileSize = data.fileSize;\n chat4appMessage.data.fileType = data.fileType;\n \n }\n \n let datTmp = new Map<string, string>();\n \n for (let key in data) {\n datTmp.set(key, data[key]);\n }\n \n chat4appMessage.data.all = datTmp;\n \n chatCallback.onMessage(chat4appMessage);\n \n } else if ((data.type == \"on\" || data.type == \"off\")) {\n let chat4appMessage = new Chat4AppMessageReceive();\n chat4appMessage.data.chatId = data.chatId;\n chat4appMessage.data.chatMessageId = data.chatMessageId;\n chat4appMessage.data.externalId = data.externalId;\n chat4appMessage.data.fromId = data.fromId;\n chat4appMessage.data.toId = data.toId;\n chat4appMessage.data.dateHour = data.dateHour;\n chat4appMessage.data.type = data.type;\n\n let datTmp = new Map<string, string>();\n \n for (let key in data) {\n datTmp.set(key, data[key]);\n }\n \n chat4appMessage.data.all = datTmp;\n \n chatCallback.onOffline(chat4appMessage);\n \n }\n }\n \n connectWebsocket(chatCallback: IChatCallback, token: string) {\n this.disconnect();\n \n let securityToken = this.getBearerToken();\n \n this.sock = new SockJS(this.chatServer + '/stomp/gkz-stomp-endpoint?token=' + securityToken);\n this.stompClient = Stomp.over(this.sock);\n this.stompClient.debug = function (msg: any) {\n //console.log(msg);\n }\n \n this.stompClient.connect({}, (frame: any) => {\n //console.log(frame);\n \n this.stompClient.subscribe('/queue/' + token, (msg: any) => {\n //console.log('mensagem', msg);\n \n if (msg.command == \"MESSAGE\") {\n \n //console.log(msg)\n \n let msgObj = JSON.parse(msg.body);\n \n let datTmp = new Map<string, string>();\n \n for (let key in msgObj.data) {\n datTmp.set(key, msgObj.data[key]);\n }\n \n msgObj.data.all = datTmp;\n \n if (msgObj.data.type == \"msg\") {\n chatCallback.onMessage(msgObj);\n } else if ((msgObj.data.type == \"on\" || msgObj.data.type == \"off\")) {\n chatCallback.onOffline(msgObj);\n }\n \n //callback(msg.body);\n // ichatcallback.forEach((iChat)=>{\n // iChat.onMessage(JSON.parse(msg.body) );\n // });\n }\n \n });\n },\n (message: any) => {\n // check message for disconnect\n //console.log(\"Disconnect\");\n \n setTimeout(() => {\n this.connectWebsocket(chatCallback, token);\n }, 500);\n \n });\n \n }\n \n disconnect() {\n// console.log(\"disconnect\")\n try {\n if (this.stompClient) {\n this.stompClient.disconnect();\n }\n \n } catch (e) {\n console.log(e);\n }\n }\n\n convertChat4AppMessageReceiveToChatMessage4App(msg: Chat4AppMessageReceive): ChatMessage4App{\n let message = new ChatMessage4App();\n message.body = msg.notification.body;\n message.chatId = msg.data.chatId;\n message.fromId = msg.data.fromId;\n message.toId = msg.data.toId;\n message.dateHourIncluded = moment.utc(msg.data.dateHour, \"DD-MM-YYYY hh:mm:ss\").toDate();\n\n if (msg.data.fileId && msg.data.fileId.length > 0) {\n let messageFile = new ChatMessageFile4App();\n \n messageFile.id = msg.data.fileId;\n messageFile.name = msg.data.fileName;\n messageFile.size = msg.data.fileSize;\n messageFile.type = msg.data.fileType;\n\n message.chatMessageFile = messageFile;\n }\n\n return message;\n\n }\n \n }\n \n \n export class Chat4App {\n id: string;\n configId: string;\n externalId: string;\n title: string;\n status: ChatStatus4App;\n users: Array<ChatUser4App>;\n \n }\n export class ChatUser4App {\n id: string;\n name: string;\n clientToken: string;\n picturePath: string;\n email: string;\n externalId: string;\n status: ChatUserStatus4App;\n }\n export class ChatMessage4App {\n id: string;\n fromId: string;\n toId: string;\n chatId: string;\n title: string;\n body: string;\n meta: Array<ChatMessageMeta4App>;\n groupId: string;\n read: Boolean;\n dateHourIncluded: Date;\n chatMessageFile: ChatMessageFile4App;\n }\n export class ChatMessageFile4App {\n id: string;\n name: string;\n type: string;\n size: number;\n fullPath: string;\n }\n export class ChatMessageMeta4App {\n name: string;\n value: string;\n }\n export class Chat4AppMessageReceive {\n data: Chat4AppMessageReceiveData = new Chat4AppMessageReceiveData();\n notification: Chat4AppMessageReceiveNotification = new Chat4AppMessageReceiveNotification();\n token: string;\n }\n export class Chat4AppMessageReceiveData {\n toId: string;\n chatId: string;\n dateHour: string;\n chatMessageId: string;\n externalId: string;\n type: string;\n fromId: string;\n fileId: string;\n fileName: string;\n fileSize: number;\n fileType: string;\n all: Map<string, string>;\n \n \n \n }\n export class Chat4AppMessageReceiveNotification {\n body: string;\n }\n \n export class ChatUserResponse4App {\n totalMessages: number;\n chat: Chat4App;\n chatMessage: ChatMessage4App;\n chats: ChatUserResponse4App[];\n }\n export class ChatFilterRequest4App {\n type: ChatFilterType;\n chatExternalId: string;\n chatUserExternalId: string;\n groupId: string;\n }\n export class Chat4AppConfig {\n constructor(public endpoint: string) {\n \n }\n }\n\n \n export enum ChatStatus4App {\n CREATED = \"CREATED\",\n CLOSED = \"CLOSED\"\n \n }\n export enum ChatUserStatus4App {\n REMOVED = \"REMOVED\"\n \n }\n export enum ChatFilterType {\n COUNT_NOT_READ = 1,\n LAST_MESSAGE = 2\n }\n \n export interface IChatCallback {\n onMessage(msg: Chat4AppMessageReceive): void;\n onOffline(msg: Chat4AppMessageReceive): void;\n }\n ","import { Component, OnInit } from '@angular/core';\n\n@Component({\n selector: 'lib-chat4app-client-angular',\n template: `\n <p>\n chat4app-client-angular works!\n </p>\n `,\n styles: [\n ]\n})\nexport class Chat4appClientAngularComponent implements OnInit {\n\n constructor() { }\n\n ngOnInit(): void {\n }\n\n}\n","import { NgModule } from '@angular/core';\nimport { Chat4appClientAngularComponent } from './chat4app-client-angular.component';\n\n\n\n@NgModule({\n declarations: [Chat4appClientAngularComponent],\n imports: [\n ],\n exports: [Chat4appClientAngularComponent]\n})\nexport class Chat4appClientAngularModule { }\n","/*\n * Public API Surface of chat4app-client-angular\n */\n\nexport * from './lib/chat4app-client-angular.service';\nexport * from './lib/chat4app-client-angular.component';\nexport * from './lib/chat4app-client-angular.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["HttpHeaders","SockJS","Stomp","moment","Injectable","HttpClient","ChatStatus4App","ChatUserStatus4App","ChatFilterType","Component","NgModule"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,QAAA,4BAAA,kBAAA,YAAA;IAQI,IAAA,SAAA,4BAAA,CAAqB,IAAgB,EAAA;IAAhB,QAAA,IAAI,CAAA,IAAA,GAAJ,IAAI,CAAY;IANrC,QAAA,IAAU,CAAA,UAAA,GAAG,EAAE,CAAC;IAChB,QAAA,IAAO,CAAA,OAAA,GAAG,EAAE,CAAC;SAOZ;IACD,IAAA,4BAAA,CAAA,SAAA,CAAA,QAAQ,GAAR,YAAA;SACC,CAAA;QAED,4BAAM,CAAA,SAAA,CAAA,MAAA,GAAN,UAAO,cAA8B,EAAA;IACnC,QAAA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@angular/core"),require("stompjs"),require("sockjs-client"),require("@angular/common/http"),require("moment")):"function"==typeof define&&define.amd?define("chat4app-client-angular",["exports","@angular/core","stompjs","sockjs-client","@angular/common/http","moment"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["chat4app-client-angular"]={},t.ng.core,t.Stomp,t.SockJS,t.ng.common.http,t.moment)}(this,(function(t,e,a,r,n,o){"use strict";function s(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(a){if("default"!==a){var r=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(e,a,r.get?r:{enumerable:!0,get:function(){return t[a]}})}})),e.default=t,Object.freeze(e)}var i=s(e),h=s(a),p=s(r),c=s(n),d=s(o),u=function(){function t(t){this.http=t,this.chatServer="",this.chatUrl=""}return t.prototype.ngOnInit=function(){},t.prototype.config=function(t){this.chatServer=t.endpoint,this.chatUrl=t.endpoint+"/api/v1/"},t.prototype.init=function(t,e,a,r){if(!this.chatServer||0==this.chatServer.trim().length)throw new Error("Endpoint is empty");if(!t||0==t.trim().length)throw new Error("SecurityChatToken is empty");this.setTokenChat4app(t),a&&r&&this.connectWebsocket(a,r),e(t)},t.prototype.getChatUrlDownload=function(t){return this.chatUrl+"chatmessage/getFile?messageFileId="+t},t.prototype.getMessageChat=function(t,e,a){var r=this.chatUrl+"chatmessage/"+t+"/"+e+"/"+a;return this.http.get(r,{headers:(new n.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.getMessageChatByGrop=function(t,e,a){var r=this.chatUrl+"chatmessage/byGroup/"+t+"/"+e+"/"+a;return this.http.get(r,{headers:(new n.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.addMessageChat=function(t){var e=this.chatUrl+"chatmessage/"+t.chatId;return this.http.post(e,t,{headers:(new n.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.props=function(t){var e=this.chatUrl+"chatmessage/props";return this.http.post(e,t,{headers:(new n.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.removeUsersChat=function(t,e,a){var r=new Array;e&&e.length>0?e.forEach((function(t){r.push("chatUserId="+t)})):a&&a.length>0&&a.forEach((function(t){r.push("chatUserExternalId="+t)}));var o=this.chatUrl+"chatuser/"+t+"?"+r.join("&");return this.http.delete(o,{headers:(new n.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.removeUserChat=function(t,e,a){var r="";r=e?"chatUserId="+e:"chatUserExternalId="+a;var o=this.chatUrl+"chatuser/"+t+"?"+r;return this.http.delete(o,{headers:(new n.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.updateUserChat=function(t,e){var a=this.chatUrl+"chatuser/"+t;return this.http.put(a,e,{headers:(new n.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.createUserChat=function(t,e){var a=this.chatUrl+"chatuser/"+t;return this.http.post(a,e,{headers:(new n.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.createUsersChat=function(t,e){var a=this.chatUrl+"chatuser/users/"+t;return this.http.post(a,e,{headers:(new n.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.createChat=function(t){var e=this.chatUrl+"chat";return this.http.post(e,t,{headers:(new n.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.createUpdateChat=function(t){var e=this.chatUrl+"chat";return this.http.put(e,t,{headers:(new n.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.getLastMessageGroup=function(t,e){var a=this.chatUrl+"chatmessage/lastMessageGroup?chatExternalId="+t+"&groupId="+e;return this.http.get(a,{headers:(new n.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.getLastMessage=function(t,e){var a=this.chatUrl+"chatmessage/lastMessage?chatExternalId="+t+"&chatUserExternalId="+e;return this.http.get(a,{headers:(new n.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.countNotReadMessages=function(t,e,a){var r=this.chatUrl+"chatmessage/countNotReadMessages?chatUserExternalId="+t;return e&&e.length>0&&(r+="&chatExternalId="+e),a&&a.length>0&&(r+="&groupId="+a),this.http.get(r,{headers:(new n.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.getChatByExternalId=function(t){var e=this.chatUrl+"chat?externalId="+t;return this.http.get(e,{headers:(new n.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.readMessage=function(t,e){var a=this.chatUrl+"chatmessage/read/"+t;return e&&e.length>0&&(a+="/"+e),this.http.put(a,null,{headers:(new n.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.online=function(t,e){var a=this.chatUrl+"chatmessage/online/"+t+"/"+e;return this.http.get(a,{headers:(new n.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.sendFile=function(t,e,a,r){var o=this.chatUrl+"chatmessage/sendFile/"+t+"/"+e+"/"+a,s=new FormData;return s.append("file",r),this.http.post(o,s,{headers:(new n.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.sendFileGroup=function(t,e,a,r){var o=this.chatUrl+"chatmessage/sendFileGroup/"+t+"/"+e+"/"+a,s=new FormData;return s.append("file",r),this.http.post(o,s,{headers:(new n.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.getBearerToken=function(){return"Bearer "+window.sessionStorage.getItem("chat4AppSessionToken")},t.prototype.setTokenChat4app=function(t){window.sessionStorage.setItem("chat4AppSessionToken",t)},t.prototype.onMessageFirebaseReceived=function(t,e){if("msg"==t.type){(n=new I).data.chatId=t.chatId,n.data.chatMessageId=t.chatMessageId,n.data.externalId=t.externalId,n.data.fromId=t.fromId,n.data.toId=t.toId,n.data.dateHour=t.dateHour,n.data.type=t.type,n.notification.body=t.body,t.fileId&&t.fileId.length>0&&(n.data.fileId=t.fileId,n.data.fileName=t.fileName,n.data.fileSize=t.fileSize,n.data.fileType=t.fileType);var a=new Map;for(var r in t)a.set(r,t[r]);n.data.all=a,e.onMessage(n)}else if("on"==t.type||"off"==t.type){var n;(n=new I).data.chatId=t.chatId,n.data.chatMessageId=t.chatMessageId,n.data.externalId=t.externalId,n.data.fromId=t.fromId,n.data.toId=t.toId,n.data.dateHour=t.dateHour,n.data.type=t.type;a=new Map;for(var r in t)a.set(r,t[r]);n.data.all=a,e.onOffline(n)}},t.prototype.connectWebsocket=function(t,e){var a=this;this.disconnect();var r=this.getBearerToken();this.sock=new p(this.chatServer+"/stomp/gkz-stomp-endpoint?token="+r),this.stompClient=h.over(this.sock),this.stompClient.debug=function(t){},this.stompClient.connect({},(function(r){a.stompClient.subscribe("/queue/"+e,(function(e){if("MESSAGE"==e.command){var a=JSON.parse(e.body),r=new Map;for(var n in a.data)r.set(n,a.data[n]);a.data.all=r,"msg"==a.data.type?t.onMessage(a):"on"!=a.data.type&&"off"!=a.data.type||t.onOffline(a)}}))}),(function(r){setTimeout((function(){a.connectWebsocket(t,e)}),500)}))},t.prototype.disconnect=function(){try{this.stompClient&&this.stompClient.disconnect()}catch(t){console.log(t)}},t.prototype.convertChat4AppMessageReceiveToChatMessage4App=function(t){var e=new m;if(e.body=t.notification.body,e.chatId=t.data.chatId,e.fromId=t.data.fromId,e.toId=t.data.toId,e.dateHourIncluded=d.utc(t.data.dateHour,"DD-MM-YYYY hh:mm:ss").toDate(),t.data.fileId&&t.data.fileId.length>0){var a=new v;a.id=t.data.fileId,a.name=t.data.fileName,a.size=t.data.fileSize,a.type=t.data.fileType,e.chatMessageFile=a}return e},t}();u.ɵprov=i.ɵɵdefineInjectable({factory:function(){return new u(i.ɵɵinject(c.HttpClient))},token:u,providedIn:"root"}),u.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],u.ctorParameters=function(){return[{type:n.HttpClient}]};var l,f,g=function(){},y=function(){},m=function(){},v=function(){},C=function(){},I=function(){this.data=new A,this.notification=new H},A=function(){},H=function(){},w=function(){},T=function(){},U=function(t){this.endpoint=t};t.ChatStatus4App=void 0,(l=t.ChatStatus4App||(t.ChatStatus4App={})).CREATED="CREATED",l.CLOSED="CLOSED",t.ChatUserStatus4App=void 0,(t.ChatUserStatus4App||(t.ChatUserStatus4App={})).REMOVED="REMOVED",t.ChatFilterType=void 0,(f=t.ChatFilterType||(t.ChatFilterType={}))[f.COUNT_NOT_READ=1]="COUNT_NOT_READ",f[f.LAST_MESSAGE=2]="LAST_MESSAGE";var M=function(){function t(){}return t.prototype.ngOnInit=function(){},t}();M.decorators=[{type:e.Component,args:[{selector:"lib-chat4app-client-angular",template:"\n <p>\n chat4app-client-angular works!\n </p>\n "}]}],M.ctorParameters=function(){return[]};var k=function(){};k.decorators=[{type:e.NgModule,args:[{declarations:[M],imports:[],exports:[M]}]}],t.Chat4App=g,t.Chat4AppConfig=U,t.Chat4AppMessageReceive=I,t.Chat4AppMessageReceiveData=A,t.Chat4AppMessageReceiveNotification=H,t.Chat4appClientAngularComponent=M,t.Chat4appClientAngularModule=k,t.Chat4appClientAngularService=u,t.ChatFilterRequest4App=T,t.ChatMessage4App=m,t.ChatMessageFile4App=v,t.ChatMessageMeta4App=C,t.ChatUser4App=y,t.ChatUserResponse4App=w,Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
2
|
+
//# sourceMappingURL=chat4app-client-angular.umd.min.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../projects/chat4app-client-angular/src/lib/chat4app-client-angular.service.ts","../../../projects/chat4app-client-angular/src/lib/chat4app-client-angular.component.ts","../../../projects/chat4app-client-angular/src/lib/chat4app-client-angular.module.ts"],"names":["Chat4appClientAngularService","http","this","chatServer","chatUrl","prototype","ngOnInit","config","chat4AppConfig","endpoint","init","securityChatToken","callback","chatCallback","connectionClientId","trim","length","Error","setTokenChat4app","connectWebsocket","getChatUrlDownload","messageFileId","getMessageChat","chatId","fromId","toId","url","get","headers","HttpHeaders","set","getBearerToken","getMessageChatByGrop","groupId","addMessageChat","chatMessage4App","post","props","chatFilterRequest4App","removeUsersChat","chatUsersId","chatUsersExternalId","params","Array","forEach","cui","push","cuei","join","delete","removeUserChat","chatUserId","chatUserExternalId","param","updateUserChat","charUser4AppUpdate","put","createUserChat","chatUser4App","createUsersChat","createChat","chat4app","createUpdateChat","getLastMessageGroup","chatExternalId","getLastMessage","countNotReadMessages","getChatByExternalId","externalId","readMessage","chatMessageId","online","sendFile","fileToUpload","formData","FormData","append","sendFileGroup","window","sessionStorage","getItem","chat4AppSessionToken","setItem","onMessageFirebaseReceived","data","type","chat4appMessage","Chat4AppMessageReceive","dateHour","notification","body","fileId","fileName","fileSize","fileType","datTmp","Map","key","all","onMessage","onOffline","token","_this","disconnect","securityToken","sock","SockJS","stompClient","Stomp","over","debug","msg","connect","frame","subscribe","command","msgObj","JSON","parse","message","setTimeout","e","console","log","convertChat4AppMessageReceiveToChatMessage4App","ChatMessage4App","dateHourIncluded","moment","utc","toDate","messageFile","ChatMessageFile4App","id","name","size","chatMessageFile","Injectable","args","providedIn","HttpClient","ChatStatus4App","ChatFilterType","Chat4App","ChatUser4App","ChatMessageMeta4App","Chat4AppMessageReceiveData","Chat4AppMessageReceiveNotification","ChatUserResponse4App","ChatFilterRequest4App","Chat4AppConfig","ChatUserStatus4App","Chat4appClientAngularComponent","Component","selector","template","Chat4appClientAngularModule","NgModule","declarations","imports","exports"],"mappings":"k2BAYAA,EAAA,WAQI,SAAAA,EAAqBC,GAAAC,KAAID,KAAJA,EANrBC,KAAUC,WAAG,GACbD,KAAOE,QAAG,UAQVJ,EAAAK,UAAAC,SAAA,aAGAN,EAAMK,UAAAE,OAAN,SAAOC,GACLN,KAAKC,WAAaK,EAAeC,SACjCP,KAAKE,QAAUI,EAAeC,SAAW,YAG3CT,EAAIK,UAAAK,KAAJ,SAAKC,EAA2BC,EAAeC,EAA8BC,GAEzE,IAAKZ,KAAKC,YAA+C,GAAjCD,KAAKC,WAAWY,OAAOC,OAC7C,MAAM,IAAIC,MAAM,qBAElB,IAAKN,GAAwD,GAAnCA,EAAkBI,OAAOC,OACjD,MAAM,IAAIC,MAAM,8BAGlBf,KAAKgB,iBAAiBP,GAElBE,GAAgBC,GAClBZ,KAAKiB,iBAAiBN,EAAcC,GAGtCF,EA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from 'stompjs';\nimport * as SockJS from 'sockjs-client';\nimport { HttpClient, HttpHeaders } from '@angular/common/http';\nimport { Observable } from 'rxjs';\nimport * as moment from 'moment';\n\n\n\n@Injectable({\n providedIn: 'root'\n})\nexport class Chat4appClientAngularService implements OnInit {\n\n chatServer = \"\";\n chatUrl = \"\";\n \n sock: any;\n stompClient: any;\n\n constructor( private http: HttpClient) {\n \n }\n ngOnInit(): void {\n }\n\n config(chat4AppConfig: Chat4AppConfig) {\n this.chatServer = chat4AppConfig.endpoint;\n this.chatUrl = chat4AppConfig.endpoint + \"/api/v1/\" ;\n }\n \n init(securityChatToken: string, callback: any, chatCallback?: IChatCallback, connectionClientId?: string) {\n\n if (!this.chatServer || this.chatServer.trim().length == 0){\n throw new Error(\"Endpoint is empty\");\n }\n if (!securityChatToken || securityChatToken.trim().length == 0){\n throw new Error(\"SecurityChatToken is empty\");\n }\n\n this.setTokenChat4app(securityChatToken);\n \n if (chatCallback && connectionClientId) {\n this.connectWebsocket(chatCallback, connectionClientId);\n }\n \n callback(securityChatToken);\n }\n \n getChatUrlDownload(messageFileId: string) {\n return this.chatUrl + \"chatmessage/getFile?messageFileId=\" + messageFileId;\n }\n \n \n getMessageChat(chatId: string, fromId: string, toId: string): Observable<Array<ChatMessage4App>> {\n let url = this.chatUrl + \"chatmessage/\" + chatId + \"/\" + fromId + \"/\" + toId;\n \n return this.http.get<Array<ChatMessage4App>>(url,\n {\n headers: new HttpHeaders().set('Authorization', this.getBearerToken())\n })\n \n }\n getMessageChatByGrop(chatId: string, groupId: string, fromId: string): Observable<Array<ChatMessage4App>> {\n let url = this.chatUrl + \"chatmessage/byGroup/\" + chatId + \"/\" + groupId + \"/\" + fromId;\n \n return this.http.get<Array<ChatMessage4App>>(url,\n {\n headers: new HttpHeaders().set('Authorization', this.getBearerToken())\n })\n \n }\n \n \n addMessageChat(chatMessage4App: ChatMessage4App): Observable<ChatMessage4App> {\n let url = this.chatUrl + \"chatmessage/\" + chatMessage4App.chatId;\n \n return this.http.post<ChatMessage4App>(url, chatMessage4App,\n {\n headers: new HttpHeaders().set('Authorization', this.getBearerToken())\n })\n \n }\n props(chatFilterRequest4App: Array<ChatFilterRequest4App>): Observable<ChatUserResponse4App[]> {\n let url = this.chatUrl + \"chatmessage/props\";\n \n return this.http.post<ChatUserResponse4App[]>(url, chatFilterRequest4App,\n {\n headers: new HttpHeaders().set('Authorization', this.getBearerToken())\n })\n \n }\n \n \n removeUsersChat(chatId: string, chatUsersId?: string[], chatUsersExternalId?: string[]): Observable<ChatUser4App[]> {\n let params = new Array();\n if (chatUsersId && chatUsersId.length > 0) {\n \n chatUsersId.forEach(cui => {\n params.push(\"chatUserId=\" + cui);\n });\n } else if (chatUsersExternalId && chatUsersExternalId.length > 0) {\n chatUsersExternalId.forEach(cuei => {\n params.push(\"chatUserExternalId=\" + cuei);\n })\n \n }\n \n let url = this.chatUrl + \"chatuser/\" + chatId + \"?\" + params.join(\"&\");\n \n return this.http.delete<ChatUser4App[]>(url,\n {\n headers: new HttpHeaders().set('Authorization', this.getBearerToken())\n })\n }\n \n removeUserChat(chatId: string, chatUserId?: string, chatUserExternalId?: string): Observable<ChatUser4App> {\n let param = \"\";\n if (chatUserId) {\n param = \"chatUserId=\" + chatUserId;\n } else {\n param = \"chatUserExternalId=\" + chatUserExternalId;\n }\n \n let url = this.chatUrl + \"chatuser/\" + chatId + \"?\" + param;\n \n return this.http.delete<ChatUser4App>(url,\n {\n headers: new HttpHeaders().set('Authorization', this.getBearerToken())\n })\n }\n \n updateUserChat(chatId: string, charUser4AppUpdate: ChatUser4App): Observable<ChatUser4App> {\n \n let url = this.chatUrl + \"chatuser/\" + chatId;\n \n return this.http.put<ChatUser4App>(url, charUser4AppUpdate,\n {\n headers: new HttpHeaders().set('Authorization', this.getBearerToken())\n })\n }\n \n \n createUserChat(chatId: string, chatUser4App: ChatUser4App): Observable<ChatUser4App> {\n let url = this.chatUrl + \"chatuser/\" + chatId;\n \n return this.http.post<ChatUser4App>(url, chatUser4App,\n {\n headers: new HttpHeaders().set('Authorization', this.getBearerToken())\n })\n }\n \n createUsersChat(chatId: string, chatUser4App: ChatUser4App[]): Observable<ChatUser4App[]> {\n let url = this.chatUrl + \"chatuser/users/\" + chatId;\n \n return this.http.post<ChatUser4App[]>(url, chatUser4App,\n {\n headers: new HttpHeaders().set('Authorization', this.getBearerToken())\n })\n }\n \n \n createChat(chat4app: Chat4App): Observable<Chat4App> {\n let url = this.chatUrl + \"chat\";\n \n return this.http.post<Chat4App>(url, chat4app,\n {\n headers: new HttpHeaders().set('Authorization', this.getBearerToken())\n })\n }\n createUpdateChat(chat4app: Chat4App): Observable<Chat4App> {\n let url = this.chatUrl + \"chat\";\n \n return this.http.put<Chat4App>(url, chat4app,\n {\n headers: new HttpHeaders().set('Authorization', this.getBearerToken())\n })\n }\n \n \n getLastMessageGroup(chatExternalId: string, groupId: string): Observable<ChatUserResponse4App> {\n \n let url = this.chatUrl + \"chatmessage/lastMessageGroup?chatExternalId=\" + chatExternalId + \"&groupId=\" + groupId;\n \n return this.http.get<ChatUserResponse4App>(url,\n {\n headers: new HttpHeaders().set('Authorization', this.getBearerToken())\n })\n }\n getLastMessage(chatExternalId: string, chatUserExternalId: string): Observable<ChatUserResponse4App> {\n \n let url = this.chatUrl + \"chatmessage/lastMessage?chatExternalId=\" + chatExternalId + \"&chatUserExternalId=\" + chatUserExternalId;\n \n return this.http.get<ChatUserResponse4App>(url,\n {\n headers: new HttpHeaders().set('Authorization', this.getBearerToken())\n })\n }\n countNotReadMessages(chatUserExternalId: string, chatExternalId?: string, groupId?: string): Observable<ChatUserResponse4App> {\n \n let url = this.chatUrl + \"chatmessage/countNotReadMessages?chatUserExternalId=\" + chatUserExternalId;\n \n if (chatExternalId && chatExternalId.length > 0) {\n url += \"&chatExternalId=\" + chatExternalId;\n }\n \n if (groupId && groupId.length > 0) {\n url += \"&groupId=\" + groupId;\n }\n \n return this.http.get<ChatUserResponse4App>(url,\n {\n headers: new HttpHeaders().set('Authorization', this.getBearerToken())\n })\n }\n \n \n getChatByExternalId(externalId: string): Observable<Chat4App> {\n \n let url = this.chatUrl + \"chat?externalId=\" + externalId;\n \n return this.http.get<Chat4App>(url,\n {\n headers: new HttpHeaders().set('Authorization', this.getBearerToken())\n })\n }\n readMessage(chatMessageId: string, toId?: string): Observable<void> {\n \n let url = this.chatUrl + \"chatmessage/read/\" + chatMessageId;\n \n if (toId && toId.length > 0) {\n url += \"/\" + toId;\n }\n \n return this.http.put<void>(url, null,\n {\n headers: new HttpHeaders().set('Authorization', this.getBearerToken())\n })\n }\n online(chatId: string, chatUserId: string): Observable<number> {\n \n let url = this.chatUrl + \"chatmessage/online/\" + chatId + \"/\" + chatUserId;\n \n return this.http.get<number>(url,\n {\n headers: new HttpHeaders().set('Authorization', this.getBearerToken())\n })\n }\n \n \n sendFile(chatId: string, fromId: string, toId: string, fileToUpload: File): Observable<ChatMessageFile4App> {\n const endpoint = this.chatUrl + \"chatmessage/sendFile/\" + chatId + \"/\" + fromId + \"/\" + toId;\n \n const formData: FormData = new FormData();\n formData.append('file', fileToUpload);\n \n return this.http\n .post<ChatMessageFile4App>(endpoint, formData,\n {\n headers: new HttpHeaders().set('Authorization', this.getBearerToken())\n });\n }\n \n sendFileGroup(chatId: string, fromId: string, groupId: string, fileToUpload: File): Observable<ChatMessageFile4App> {\n const endpoint = this.chatUrl + \"chatmessage/sendFileGroup/\" + chatId + \"/\" + fromId + \"/\" + groupId;\n \n const formData: FormData = new FormData();\n formData.append('file', fileToUpload);\n \n return this.http\n .post<ChatMessageFile4App>(endpoint, formData,\n {\n headers: new HttpHeaders().set('Authorization', this.getBearerToken())\n });\n }\n \n \n /* Token */\n getBearerToken(): string {\n \n let ret = \"Bearer \" + window.sessionStorage.getItem(\"chat4AppSessionToken\");\n \n return ret;\n }\n \n \n setTokenChat4app(chat4AppSessionToken: string) {\n \n \n window.sessionStorage.setItem(\"chat4AppSessionToken\", chat4AppSessionToken);\n }\n \n \n /* Connection */\n \n onMessageFirebaseReceived(data: any, chatCallback: IChatCallback) {\n \n \n //alert(\"onMessageReceived connectFirebase\");\n \n if (data.type == \"msg\") {\n \n let chat4appMessage = new Chat4AppMessageReceive();\n chat4appMessage.data.chatId = data.chatId;\n chat4appMessage.data.chatMessageId = data.chatMessageId;\n chat4appMessage.data.externalId = data.externalId;\n chat4appMessage.data.fromId = data.fromId;\n chat4appMessage.data.toId = data.toId;\n chat4appMessage.data.dateHour = data.dateHour;\n chat4appMessage.data.type = data.type;\n chat4appMessage.notification.body = data.body;\n \n if (data.fileId && data.fileId.length > 0) {\n chat4appMessage.data.fileId = data.fileId;\n chat4appMessage.data.fileName = data.fileName;\n chat4appMessage.data.fileSize = data.fileSize;\n chat4appMessage.data.fileType = data.fileType;\n \n }\n \n let datTmp = new Map<string, string>();\n \n for (let key in data) {\n datTmp.set(key, data[key]);\n }\n \n chat4appMessage.data.all = datTmp;\n \n chatCallback.onMessage(chat4appMessage);\n \n } else if ((data.type == \"on\" || data.type == \"off\")) {\n let chat4appMessage = new Chat4AppMessageReceive();\n chat4appMessage.data.chatId = data.chatId;\n chat4appMessage.data.chatMessageId = data.chatMessageId;\n chat4appMessage.data.externalId = data.externalId;\n chat4appMessage.data.fromId = data.fromId;\n chat4appMessage.data.toId = data.toId;\n chat4appMessage.data.dateHour = data.dateHour;\n chat4appMessage.data.type = data.type;\n\n let datTmp = new Map<string, string>();\n \n for (let key in data) {\n datTmp.set(key, data[key]);\n }\n \n chat4appMessage.data.all = datTmp;\n \n chatCallback.onOffline(chat4appMessage);\n \n }\n }\n \n connectWebsocket(chatCallback: IChatCallback, token: string) {\n this.disconnect();\n \n let securityToken = this.getBearerToken();\n \n this.sock = new SockJS(this.chatServer + '/stomp/gkz-stomp-endpoint?token=' + securityToken);\n this.stompClient = Stomp.over(this.sock);\n this.stompClient.debug = function (msg: any) {\n //console.log(msg);\n }\n \n this.stompClient.connect({}, (frame: any) => {\n //console.log(frame);\n \n this.stompClient.subscribe('/queue/' + token, (msg: any) => {\n //console.log('mensagem', msg);\n \n if (msg.command == \"MESSAGE\") {\n \n //console.log(msg)\n \n let msgObj = JSON.parse(msg.body);\n \n let datTmp = new Map<string, string>();\n \n for (let key in msgObj.data) {\n datTmp.set(key, msgObj.data[key]);\n }\n \n msgObj.data.all = datTmp;\n \n if (msgObj.data.type == \"msg\") {\n chatCallback.onMessage(msgObj);\n } else if ((msgObj.data.type == \"on\" || msgObj.data.type == \"off\")) {\n chatCallback.onOffline(msgObj);\n }\n \n //callback(msg.body);\n // ichatcallback.forEach((iChat)=>{\n // iChat.onMessage(JSON.parse(msg.body) );\n // });\n }\n \n });\n },\n (message: any) => {\n // check message for disconnect\n //console.log(\"Disconnect\");\n \n setTimeout(() => {\n this.connectWebsocket(chatCallback, token);\n }, 500);\n \n });\n \n }\n \n disconnect() {\n// console.log(\"disconnect\")\n try {\n if (this.stompClient) {\n this.stompClient.disconnect();\n }\n \n } catch (e) {\n console.log(e);\n }\n }\n\n convertChat4AppMessageReceiveToChatMessage4App(msg: Chat4AppMessageReceive): ChatMessage4App{\n let message = new ChatMessage4App();\n message.body = msg.notification.body;\n message.chatId = msg.data.chatId;\n message.fromId = msg.data.fromId;\n message.toId = msg.data.toId;\n message.dateHourIncluded = moment.utc(msg.data.dateHour, \"DD-MM-YYYY hh:mm:ss\").toDate();\n\n if (msg.data.fileId && msg.data.fileId.length > 0) {\n let messageFile = new ChatMessageFile4App();\n \n messageFile.id = msg.data.fileId;\n messageFile.name = msg.data.fileName;\n messageFile.size = msg.data.fileSize;\n messageFile.type = msg.data.fileType;\n\n message.chatMessageFile = messageFile;\n }\n\n return message;\n\n }\n \n }\n \n \n export class Chat4App {\n id: string;\n configId: string;\n externalId: string;\n title: string;\n status: ChatStatus4App;\n users: Array<ChatUser4App>;\n \n }\n export class ChatUser4App {\n id: string;\n name: string;\n clientToken: string;\n picturePath: string;\n email: string;\n externalId: string;\n status: ChatUserStatus4App;\n }\n export class ChatMessage4App {\n id: string;\n fromId: string;\n toId: string;\n chatId: string;\n title: string;\n body: string;\n meta: Array<ChatMessageMeta4App>;\n groupId: string;\n read: Boolean;\n dateHourIncluded: Date;\n chatMessageFile: ChatMessageFile4App;\n }\n export class ChatMessageFile4App {\n id: string;\n name: string;\n type: string;\n size: number;\n fullPath: string;\n }\n export class ChatMessageMeta4App {\n name: string;\n value: string;\n }\n export class Chat4AppMessageReceive {\n data: Chat4AppMessageReceiveData = new Chat4AppMessageReceiveData();\n notification: Chat4AppMessageReceiveNotification = new Chat4AppMessageReceiveNotification();\n token: string;\n }\n export class Chat4AppMessageReceiveData {\n toId: string;\n chatId: string;\n dateHour: string;\n chatMessageId: string;\n externalId: string;\n type: string;\n fromId: string;\n fileId: string;\n fileName: string;\n fileSize: number;\n fileType: string;\n all: Map<string, string>;\n \n \n \n }\n export class Chat4AppMessageReceiveNotification {\n body: string;\n }\n \n export class ChatUserResponse4App {\n totalMessages: number;\n chat: Chat4App;\n chatMessage: ChatMessage4App;\n chats: ChatUserResponse4App[];\n }\n export class ChatFilterRequest4App {\n type: ChatFilterType;\n chatExternalId: string;\n chatUserExternalId: string;\n groupId: string;\n }\n export class Chat4AppConfig {\n constructor(public endpoint: string) {\n \n }\n }\n\n \n export enum ChatStatus4App {\n CREATED = \"CREATED\",\n CLOSED = \"CLOSED\"\n \n }\n export enum ChatUserStatus4App {\n REMOVED = \"REMOVED\"\n \n }\n export enum ChatFilterType {\n COUNT_NOT_READ = 1,\n LAST_MESSAGE = 2\n }\n \n export interface IChatCallback {\n onMessage(msg: Chat4AppMessageReceive): void;\n onOffline(msg: Chat4AppMessageReceive): void;\n }\n ","import { Component, OnInit } from '@angular/core';\n\n@Component({\n selector: 'lib-chat4app-client-angular',\n template: `\n <p>\n chat4app-client-angular works!\n </p>\n `,\n styles: [\n ]\n})\nexport class Chat4appClientAngularComponent implements OnInit {\n\n constructor() { }\n\n ngOnInit(): void {\n }\n\n}\n","import { NgModule } from '@angular/core';\nimport { Chat4appClientAngularComponent } from './chat4app-client-angular.component';\n\n\n\n@NgModule({\n declarations: [Chat4appClientAngularComponent],\n imports: [\n ],\n exports: [Chat4appClientAngularComponent]\n})\nexport class Chat4appClientAngularModule { }\n"]}
|