chat4app-client-angular 0.0.5 → 0.0.6
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 +418 -406
- package/bundles/chat4app-client-angular.umd.js.map +1 -1
- package/bundles/chat4app-client-angular.umd.min.js +1 -1
- package/bundles/chat4app-client-angular.umd.min.js.map +1 -1
- package/chat4app-client-angular.d.ts +4 -4
- package/chat4app-client-angular.metadata.json +1 -1
- package/esm2015/chat4app-client-angular.js +4 -4
- package/esm2015/lib/chat4app-client-angular.component.js +13 -13
- package/esm2015/lib/chat4app-client-angular.module.js +11 -11
- package/esm2015/lib/chat4app-client-angular.service.js +364 -356
- package/esm2015/public-api.js +6 -6
- package/fesm2015/chat4app-client-angular.js +379 -371
- package/fesm2015/chat4app-client-angular.js.map +1 -1
- package/lib/chat4app-client-angular.component.d.ts +5 -5
- package/lib/chat4app-client-angular.module.d.ts +2 -2
- package/lib/chat4app-client-angular.service.d.ts +143 -134
- package/lib/chat4app-client-angular.service.d.ts.map +1 -1
- package/package.json +1 -1
- package/public-api.d.ts +3 -3
|
@@ -28,420 +28,431 @@
|
|
|
28
28
|
var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
|
|
29
29
|
var moment__namespace = /*#__PURE__*/_interopNamespace(moment);
|
|
30
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
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
chat4appMessage
|
|
225
|
-
chat4appMessage.data.
|
|
226
|
-
chat4appMessage.
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
chat4appMessage.data.
|
|
244
|
-
chat4appMessage
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
chat4appMessage
|
|
248
|
-
chat4appMessage.data.
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
chat4appMessage.data.
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
this.
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
}
|
|
296
|
-
})
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
message
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
Chat4appClientAngularService
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
}
|
|
394
|
-
return
|
|
395
|
-
}());
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
(function (
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
(
|
|
407
|
-
|
|
408
|
-
|
|
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
|
+
Chat4appClientAngularService.prototype.translateMessage = function (chatMessageId, languageTarget) {
|
|
207
|
+
var url = this.chatUrl + "chatmessage/translate/" + chatMessageId + "/" + languageTarget;
|
|
208
|
+
return this.http.get(url, {
|
|
209
|
+
headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
|
|
210
|
+
});
|
|
211
|
+
};
|
|
212
|
+
/* Token */
|
|
213
|
+
Chat4appClientAngularService.prototype.getBearerToken = function () {
|
|
214
|
+
var ret = "Bearer " + window.sessionStorage.getItem("chat4AppSessionToken");
|
|
215
|
+
return ret;
|
|
216
|
+
};
|
|
217
|
+
Chat4appClientAngularService.prototype.setTokenChat4app = function (chat4AppSessionToken) {
|
|
218
|
+
window.sessionStorage.setItem("chat4AppSessionToken", chat4AppSessionToken);
|
|
219
|
+
};
|
|
220
|
+
/* Connection */
|
|
221
|
+
Chat4appClientAngularService.prototype.onMessageFirebaseReceived = function (data, chatCallback) {
|
|
222
|
+
//alert("onMessageReceived connectFirebase");
|
|
223
|
+
if (data.type == "msg") {
|
|
224
|
+
var chat4appMessage = new Chat4AppMessageReceive();
|
|
225
|
+
chat4appMessage.data.chatId = data.chatId;
|
|
226
|
+
chat4appMessage.data.chatMessageId = data.chatMessageId;
|
|
227
|
+
chat4appMessage.data.externalId = data.externalId;
|
|
228
|
+
chat4appMessage.data.fromId = data.fromId;
|
|
229
|
+
chat4appMessage.data.toId = data.toId;
|
|
230
|
+
chat4appMessage.data.dateHour = data.dateHour;
|
|
231
|
+
chat4appMessage.data.type = data.type;
|
|
232
|
+
chat4appMessage.notification.body = data.body;
|
|
233
|
+
if (data.fileId && data.fileId.length > 0) {
|
|
234
|
+
chat4appMessage.data.fileId = data.fileId;
|
|
235
|
+
chat4appMessage.data.fileName = data.fileName;
|
|
236
|
+
chat4appMessage.data.fileSize = data.fileSize;
|
|
237
|
+
chat4appMessage.data.fileType = data.fileType;
|
|
238
|
+
}
|
|
239
|
+
var datTmp = new Map();
|
|
240
|
+
for (var key in data) {
|
|
241
|
+
datTmp.set(key, data[key]);
|
|
242
|
+
}
|
|
243
|
+
chat4appMessage.data.all = datTmp;
|
|
244
|
+
chatCallback.onMessage(chat4appMessage);
|
|
245
|
+
}
|
|
246
|
+
else if ((data.type == "on" || data.type == "off")) {
|
|
247
|
+
var chat4appMessage = new Chat4AppMessageReceive();
|
|
248
|
+
chat4appMessage.data.chatId = data.chatId;
|
|
249
|
+
chat4appMessage.data.chatMessageId = data.chatMessageId;
|
|
250
|
+
chat4appMessage.data.externalId = data.externalId;
|
|
251
|
+
chat4appMessage.data.fromId = data.fromId;
|
|
252
|
+
chat4appMessage.data.toId = data.toId;
|
|
253
|
+
chat4appMessage.data.dateHour = data.dateHour;
|
|
254
|
+
chat4appMessage.data.type = data.type;
|
|
255
|
+
var datTmp = new Map();
|
|
256
|
+
for (var key in data) {
|
|
257
|
+
datTmp.set(key, data[key]);
|
|
258
|
+
}
|
|
259
|
+
chat4appMessage.data.all = datTmp;
|
|
260
|
+
chatCallback.onOffline(chat4appMessage);
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
Chat4appClientAngularService.prototype.connectWebsocket = function (chatCallback, token) {
|
|
264
|
+
var _this = this;
|
|
265
|
+
this.disconnect();
|
|
266
|
+
var securityToken = this.getBearerToken();
|
|
267
|
+
this.sock = new SockJS__namespace(this.chatServer + '/stomp/gkz-stomp-endpoint?token=' + securityToken);
|
|
268
|
+
this.stompClient = Stomp__namespace.over(this.sock);
|
|
269
|
+
this.stompClient.debug = function (msg) {
|
|
270
|
+
//console.log(msg);
|
|
271
|
+
};
|
|
272
|
+
this.stompClient.connect({}, function (frame) {
|
|
273
|
+
//console.log(frame);
|
|
274
|
+
_this.stompClient.subscribe('/queue/' + token, function (msg) {
|
|
275
|
+
//console.log('mensagem', msg);
|
|
276
|
+
if (msg.command == "MESSAGE") {
|
|
277
|
+
//console.log(msg)
|
|
278
|
+
var msgObj = JSON.parse(msg.body);
|
|
279
|
+
var datTmp = new Map();
|
|
280
|
+
for (var key in msgObj.data) {
|
|
281
|
+
datTmp.set(key, msgObj.data[key]);
|
|
282
|
+
}
|
|
283
|
+
msgObj.data.all = datTmp;
|
|
284
|
+
if (msgObj.data.type == "msg") {
|
|
285
|
+
chatCallback.onMessage(msgObj);
|
|
286
|
+
}
|
|
287
|
+
else if ((msgObj.data.type == "on" || msgObj.data.type == "off")) {
|
|
288
|
+
chatCallback.onOffline(msgObj);
|
|
289
|
+
}
|
|
290
|
+
//callback(msg.body);
|
|
291
|
+
// ichatcallback.forEach((iChat)=>{
|
|
292
|
+
// iChat.onMessage(JSON.parse(msg.body) );
|
|
293
|
+
// });
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
}, function (message) {
|
|
297
|
+
// check message for disconnect
|
|
298
|
+
//console.log("Disconnect");
|
|
299
|
+
setTimeout(function () {
|
|
300
|
+
_this.connectWebsocket(chatCallback, token);
|
|
301
|
+
}, 500);
|
|
302
|
+
});
|
|
303
|
+
};
|
|
304
|
+
Chat4appClientAngularService.prototype.disconnect = function () {
|
|
305
|
+
// console.log("disconnect")
|
|
306
|
+
try {
|
|
307
|
+
if (this.stompClient) {
|
|
308
|
+
this.stompClient.disconnect();
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
catch (e) {
|
|
312
|
+
console.log(e);
|
|
313
|
+
}
|
|
314
|
+
};
|
|
315
|
+
Chat4appClientAngularService.prototype.convertChat4AppMessageReceiveToChatMessage4App = function (msg) {
|
|
316
|
+
var message = new ChatMessage4App();
|
|
317
|
+
message.body = msg.notification.body;
|
|
318
|
+
message.chatId = msg.data.chatId;
|
|
319
|
+
message.fromId = msg.data.fromId;
|
|
320
|
+
message.toId = msg.data.toId;
|
|
321
|
+
message.dateHourIncluded = moment__namespace.utc(msg.data.dateHour, "DD-MM-YYYY hh:mm:ss").toDate();
|
|
322
|
+
message.id = msg.data.chatMessageId;
|
|
323
|
+
if (msg.data.fileId && msg.data.fileId.length > 0) {
|
|
324
|
+
var messageFile = new ChatMessageFile4App();
|
|
325
|
+
messageFile.id = msg.data.fileId;
|
|
326
|
+
messageFile.name = msg.data.fileName;
|
|
327
|
+
messageFile.size = msg.data.fileSize;
|
|
328
|
+
messageFile.type = msg.data.fileType;
|
|
329
|
+
message.chatMessageFile = messageFile;
|
|
330
|
+
}
|
|
331
|
+
return message;
|
|
332
|
+
};
|
|
333
|
+
return Chat4appClientAngularService;
|
|
334
|
+
}());
|
|
335
|
+
Chat4appClientAngularService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function Chat4appClientAngularService_Factory() { return new Chat4appClientAngularService(i0__namespace.ɵɵinject(i1__namespace.HttpClient)); }, token: Chat4appClientAngularService, providedIn: "root" });
|
|
336
|
+
Chat4appClientAngularService.decorators = [
|
|
337
|
+
{ type: i0.Injectable, args: [{
|
|
338
|
+
providedIn: 'root'
|
|
339
|
+
},] }
|
|
340
|
+
];
|
|
341
|
+
Chat4appClientAngularService.ctorParameters = function () { return [
|
|
342
|
+
{ type: i1.HttpClient }
|
|
343
|
+
]; };
|
|
344
|
+
var Chat4App = /** @class */ (function () {
|
|
345
|
+
function Chat4App() {
|
|
346
|
+
}
|
|
347
|
+
return Chat4App;
|
|
348
|
+
}());
|
|
349
|
+
var ChatUser4App = /** @class */ (function () {
|
|
350
|
+
function ChatUser4App() {
|
|
351
|
+
}
|
|
352
|
+
return ChatUser4App;
|
|
353
|
+
}());
|
|
354
|
+
var ChatMessage4App = /** @class */ (function () {
|
|
355
|
+
function ChatMessage4App() {
|
|
356
|
+
}
|
|
357
|
+
return ChatMessage4App;
|
|
358
|
+
}());
|
|
359
|
+
var ChatMessageFile4App = /** @class */ (function () {
|
|
360
|
+
function ChatMessageFile4App() {
|
|
361
|
+
}
|
|
362
|
+
return ChatMessageFile4App;
|
|
363
|
+
}());
|
|
364
|
+
var ChatMessageMeta4App = /** @class */ (function () {
|
|
365
|
+
function ChatMessageMeta4App() {
|
|
366
|
+
}
|
|
367
|
+
return ChatMessageMeta4App;
|
|
368
|
+
}());
|
|
369
|
+
var Chat4AppMessageReceive = /** @class */ (function () {
|
|
370
|
+
function Chat4AppMessageReceive() {
|
|
371
|
+
this.data = new Chat4AppMessageReceiveData();
|
|
372
|
+
this.notification = new Chat4AppMessageReceiveNotification();
|
|
373
|
+
}
|
|
374
|
+
return Chat4AppMessageReceive;
|
|
375
|
+
}());
|
|
376
|
+
var Chat4AppMessageReceiveData = /** @class */ (function () {
|
|
377
|
+
function Chat4AppMessageReceiveData() {
|
|
378
|
+
}
|
|
379
|
+
return Chat4AppMessageReceiveData;
|
|
380
|
+
}());
|
|
381
|
+
var Chat4AppMessageReceiveNotification = /** @class */ (function () {
|
|
382
|
+
function Chat4AppMessageReceiveNotification() {
|
|
383
|
+
}
|
|
384
|
+
return Chat4AppMessageReceiveNotification;
|
|
385
|
+
}());
|
|
386
|
+
var ChatUserResponse4App = /** @class */ (function () {
|
|
387
|
+
function ChatUserResponse4App() {
|
|
388
|
+
}
|
|
389
|
+
return ChatUserResponse4App;
|
|
390
|
+
}());
|
|
391
|
+
var ChatFilterRequest4App = /** @class */ (function () {
|
|
392
|
+
function ChatFilterRequest4App() {
|
|
393
|
+
}
|
|
394
|
+
return ChatFilterRequest4App;
|
|
395
|
+
}());
|
|
396
|
+
var Chat4AppConfig = /** @class */ (function () {
|
|
397
|
+
function Chat4AppConfig(endpoint) {
|
|
398
|
+
this.endpoint = endpoint;
|
|
399
|
+
}
|
|
400
|
+
return Chat4AppConfig;
|
|
401
|
+
}());
|
|
402
|
+
var Chat4AppTranslate = /** @class */ (function () {
|
|
403
|
+
function Chat4AppTranslate() {
|
|
404
|
+
}
|
|
405
|
+
return Chat4AppTranslate;
|
|
406
|
+
}());
|
|
407
|
+
exports.ChatStatus4App = void 0;
|
|
408
|
+
(function (ChatStatus4App) {
|
|
409
|
+
ChatStatus4App["CREATED"] = "CREATED";
|
|
410
|
+
ChatStatus4App["CLOSED"] = "CLOSED";
|
|
411
|
+
})(exports.ChatStatus4App || (exports.ChatStatus4App = {}));
|
|
412
|
+
exports.ChatUserStatus4App = void 0;
|
|
413
|
+
(function (ChatUserStatus4App) {
|
|
414
|
+
ChatUserStatus4App["REMOVED"] = "REMOVED";
|
|
415
|
+
})(exports.ChatUserStatus4App || (exports.ChatUserStatus4App = {}));
|
|
416
|
+
exports.ChatFilterType = void 0;
|
|
417
|
+
(function (ChatFilterType) {
|
|
418
|
+
ChatFilterType[ChatFilterType["COUNT_NOT_READ"] = 1] = "COUNT_NOT_READ";
|
|
419
|
+
ChatFilterType[ChatFilterType["LAST_MESSAGE"] = 2] = "LAST_MESSAGE";
|
|
409
420
|
})(exports.ChatFilterType || (exports.ChatFilterType = {}));
|
|
410
421
|
|
|
411
|
-
var Chat4appClientAngularComponent = /** @class */ (function () {
|
|
412
|
-
function Chat4appClientAngularComponent() {
|
|
413
|
-
}
|
|
414
|
-
Chat4appClientAngularComponent.prototype.ngOnInit = function () {
|
|
415
|
-
};
|
|
416
|
-
return Chat4appClientAngularComponent;
|
|
417
|
-
}());
|
|
418
|
-
Chat4appClientAngularComponent.decorators = [
|
|
419
|
-
{ type: i0.Component, args: [{
|
|
420
|
-
selector: 'lib-chat4app-client-angular',
|
|
421
|
-
template: "\n <p>\n chat4app-client-angular works!\n </p>\n "
|
|
422
|
-
},] }
|
|
423
|
-
];
|
|
422
|
+
var Chat4appClientAngularComponent = /** @class */ (function () {
|
|
423
|
+
function Chat4appClientAngularComponent() {
|
|
424
|
+
}
|
|
425
|
+
Chat4appClientAngularComponent.prototype.ngOnInit = function () {
|
|
426
|
+
};
|
|
427
|
+
return Chat4appClientAngularComponent;
|
|
428
|
+
}());
|
|
429
|
+
Chat4appClientAngularComponent.decorators = [
|
|
430
|
+
{ type: i0.Component, args: [{
|
|
431
|
+
selector: 'lib-chat4app-client-angular',
|
|
432
|
+
template: "\n <p>\n chat4app-client-angular works!\n </p>\n "
|
|
433
|
+
},] }
|
|
434
|
+
];
|
|
424
435
|
Chat4appClientAngularComponent.ctorParameters = function () { return []; };
|
|
425
436
|
|
|
426
|
-
var Chat4appClientAngularModule = /** @class */ (function () {
|
|
427
|
-
function Chat4appClientAngularModule() {
|
|
428
|
-
}
|
|
429
|
-
return Chat4appClientAngularModule;
|
|
430
|
-
}());
|
|
431
|
-
Chat4appClientAngularModule.decorators = [
|
|
432
|
-
{ type: i0.NgModule, args: [{
|
|
433
|
-
declarations: [Chat4appClientAngularComponent],
|
|
434
|
-
imports: [],
|
|
435
|
-
exports: [Chat4appClientAngularComponent]
|
|
436
|
-
},] }
|
|
437
|
+
var Chat4appClientAngularModule = /** @class */ (function () {
|
|
438
|
+
function Chat4appClientAngularModule() {
|
|
439
|
+
}
|
|
440
|
+
return Chat4appClientAngularModule;
|
|
441
|
+
}());
|
|
442
|
+
Chat4appClientAngularModule.decorators = [
|
|
443
|
+
{ type: i0.NgModule, args: [{
|
|
444
|
+
declarations: [Chat4appClientAngularComponent],
|
|
445
|
+
imports: [],
|
|
446
|
+
exports: [Chat4appClientAngularComponent]
|
|
447
|
+
},] }
|
|
437
448
|
];
|
|
438
449
|
|
|
439
|
-
/*
|
|
440
|
-
* Public API Surface of chat4app-client-angular
|
|
450
|
+
/*
|
|
451
|
+
* Public API Surface of chat4app-client-angular
|
|
441
452
|
*/
|
|
442
453
|
|
|
443
|
-
/**
|
|
444
|
-
* Generated bundle index. Do not edit.
|
|
454
|
+
/**
|
|
455
|
+
* Generated bundle index. Do not edit.
|
|
445
456
|
*/
|
|
446
457
|
|
|
447
458
|
exports.Chat4App = Chat4App;
|
|
@@ -449,6 +460,7 @@
|
|
|
449
460
|
exports.Chat4AppMessageReceive = Chat4AppMessageReceive;
|
|
450
461
|
exports.Chat4AppMessageReceiveData = Chat4AppMessageReceiveData;
|
|
451
462
|
exports.Chat4AppMessageReceiveNotification = Chat4AppMessageReceiveNotification;
|
|
463
|
+
exports.Chat4AppTranslate = Chat4AppTranslate;
|
|
452
464
|
exports.Chat4appClientAngularComponent = Chat4appClientAngularComponent;
|
|
453
465
|
exports.Chat4appClientAngularModule = Chat4appClientAngularModule;
|
|
454
466
|
exports.Chat4appClientAngularService = Chat4appClientAngularService;
|