@chat21/chat21-ionic 3.0.63 → 3.0.64-rc1
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/CHANGELOG.md +7 -1
- package/deploy_prod.sh +5 -5
- package/package.json +6 -1
- package/src/app/app.component.ts +45 -59
- package/src/app/app.module.ts +1 -0
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.html +2 -2
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.scss +0 -1
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.ts +2 -39
- package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.html +18 -6
- package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.ts +2 -2
- package/src/app/chatlib/conversation-detail/message/html/html.component.html +1 -0
- package/src/app/chatlib/conversation-detail/message/html/html.component.scss +79 -0
- package/src/app/chatlib/conversation-detail/message/html/html.component.spec.ts +25 -0
- package/src/app/chatlib/conversation-detail/message/html/html.component.ts +33 -0
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.html +2 -2
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +2 -2
- package/src/app/directives/safe-html.pipe.ts +2 -2
- package/src/app/pages/conversation-detail/conversation-detail.page.html +4 -2
- package/src/app/pages/conversation-detail/conversation-detail.page.ts +12 -23
- package/src/app/pages/conversations-list/conversations-list.page.html +21 -12
- package/src/app/pages/conversations-list/conversations-list.page.ts +58 -191
- package/src/app/pages/loader-preview/loader-preview.module.ts +1 -2
- package/src/app/shared/shared.module.ts +4 -0
- package/src/assets/js/chat21client.js +1 -1
- package/src/chat21-core/models/conversation.ts +1 -1
- package/src/chat21-core/providers/abstract/conversations-handler.service.ts +1 -1
- package/src/chat21-core/providers/firebase/firebase-conversations-handler.ts +65 -9
- package/src/chat21-core/utils/utils-message.ts +5 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# chat21-ionic ver 3.0
|
|
2
2
|
|
|
3
|
+
### 3.0.64-rc1
|
|
4
|
+
- Fixes the bug: in the conversation list, for the direct convesations, the name of the requester changes according to the order of arrival of the conversations
|
|
5
|
+
- Displays balloon messages with a light orange background for "internal notes" type message
|
|
6
|
+
- Adds the html component
|
|
7
|
+
- Improves chat performance by caching conversations
|
|
8
|
+
|
|
3
9
|
### 3.0.63
|
|
4
10
|
- Deploys in production
|
|
5
11
|
|
|
@@ -16,7 +22,7 @@
|
|
|
16
22
|
- Fixes the bug: images that are not in the database cannot be downloaded
|
|
17
23
|
- Adds default chat color to emojis picker tabs
|
|
18
24
|
- Fixes the bug: the selected conversation is undefined
|
|
19
|
-
- Fixes the bug: in the conversation list, the name of the requester changes according to the order of arrival of the conversations
|
|
25
|
+
- Fixes the bug: in the conversation list, for the support convesations, the name of the requester changes according to the order of arrival of the conversations
|
|
20
26
|
|
|
21
27
|
### 3.0.62.3
|
|
22
28
|
- Fixes the bug: the method setTyping fired twice after that a message is sent
|
package/deploy_prod.sh
CHANGED
|
@@ -27,16 +27,16 @@ cp -p config.xml platforms/browser/www/
|
|
|
27
27
|
cd platforms/browser/www
|
|
28
28
|
aws s3 sync . s3://tiledesk-console/v2/chat/
|
|
29
29
|
aws s3 sync . s3://tiledesk-console/v2/chat/$version/
|
|
30
|
-
cd ../../../
|
|
31
|
-
# aws cloudfront create-invalidation --distribution-id E2DTAKWHWQ7C3J --paths "/*"
|
|
32
|
-
|
|
33
|
-
# echo new version deployed on s3://tiledesk-dashboard/chat/$NEW_BUILD/
|
|
34
30
|
echo new version deployed on s3://tiledesk-console/v2/chat/$version/
|
|
35
|
-
# echo new version deployed on s3://tiledesk-console/v2/chat/
|
|
36
31
|
echo available on https://console.tiledesk.com/v2/chat/$version/index.html
|
|
37
32
|
echo available on https://console.tiledesk.com/v2/chat/index.html
|
|
38
33
|
|
|
39
34
|
|
|
35
|
+
###### CHAT in prod under latest
|
|
36
|
+
# cd platforms/browser/www
|
|
37
|
+
# aws s3 sync . s3://tiledesk-console/v2/chat/latest
|
|
38
|
+
# echo available on https://console.tiledesk.com/v2/chat/latest/index.html
|
|
39
|
+
|
|
40
40
|
###### CHAT-IONIC5
|
|
41
41
|
# cd platforms/browser/www
|
|
42
42
|
# #aws s3 sync . s3://tiledesk-dashboard/chat/
|
package/package.json
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chat21/chat21-ionic",
|
|
3
|
-
"version": "3.0.63",
|
|
4
3
|
"author": "Tiledesk SRL",
|
|
4
|
+
"version": "3.0.64-rc1",
|
|
5
|
+
"license": "AGPL-3.0",
|
|
5
6
|
"homepage": "https://tiledesk.com/",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/Tiledesk/chat21-ionic"
|
|
10
|
+
},
|
|
6
11
|
"scripts": {
|
|
7
12
|
"ng": "ng",
|
|
8
13
|
"start": "ng serve",
|
package/src/app/app.component.ts
CHANGED
|
@@ -90,6 +90,7 @@ export class AppComponent implements OnInit {
|
|
|
90
90
|
private setTimeoutSound: any;
|
|
91
91
|
private isTabVisible: boolean = true;
|
|
92
92
|
private tabTitle: string;
|
|
93
|
+
private setTimeoutConversationsEvent: any;
|
|
93
94
|
private logger: LoggerService = LoggerInstance.getInstance();
|
|
94
95
|
public toastMsgErrorWhileUnsubscribingFromNotifications: string;
|
|
95
96
|
public toastMsgCloseToast: string;
|
|
@@ -341,8 +342,6 @@ export class AppComponent implements OnInit {
|
|
|
341
342
|
|
|
342
343
|
if (event && event.data && event.data.action && event.data.parameter) {
|
|
343
344
|
if (event.data.action === 'openJoinConversationModal') {
|
|
344
|
-
// console.log("[APP-COMP] message event action ", event.data.action);
|
|
345
|
-
// console.log("[APP-COMP] message event parameter ", event.data.parameter);
|
|
346
345
|
this.presentAlertConfirmJoinRequest(event.data.parameter, event.data.calledBy)
|
|
347
346
|
}
|
|
348
347
|
}
|
|
@@ -377,7 +376,6 @@ export class AppComponent implements OnInit {
|
|
|
377
376
|
|
|
378
377
|
async presentAlertConfirmJoinRequest(requestid, calledby) {
|
|
379
378
|
var iframeWin = <HTMLIFrameElement>document.getElementById("unassigned-convs-iframe")
|
|
380
|
-
// console.log("[APP-COMP] message event iframeWin ", iframeWin);
|
|
381
379
|
|
|
382
380
|
const isIFrame = (input: HTMLElement | null): input is HTMLIFrameElement =>
|
|
383
381
|
input !== null && input.tagName === 'IFRAME';
|
|
@@ -395,12 +393,10 @@ export class AppComponent implements OnInit {
|
|
|
395
393
|
role: 'cancel',
|
|
396
394
|
cssClass: 'secondary',
|
|
397
395
|
handler: (blah) => {
|
|
398
|
-
// console.log('Confirm Cancel: blah', blah);
|
|
399
396
|
}
|
|
400
397
|
}, {
|
|
401
398
|
text: 'Ok',
|
|
402
399
|
handler: () => {
|
|
403
|
-
// console.log('Confirm Okay');
|
|
404
400
|
|
|
405
401
|
if (isIFrame(iframeWin) && iframeWin.contentWindow) {
|
|
406
402
|
const msg = { action: "joinConversation", parameter: requestid, calledBy: calledby }
|
|
@@ -420,14 +416,12 @@ export class AppComponent implements OnInit {
|
|
|
420
416
|
signInWithCustomToken(token) {
|
|
421
417
|
// this.isOnline = false;
|
|
422
418
|
this.logger.log('[APP-COMP] SIGNINWITHCUSTOMTOKEN token', token)
|
|
423
|
-
this.tiledeskAuthService.signInWithCustomToken(token)
|
|
424
|
-
.then((user: any) => {
|
|
419
|
+
this.tiledeskAuthService.signInWithCustomToken(token).then((user: any) => {
|
|
425
420
|
this.logger.log('[APP-COMP] SIGNINWITHCUSTOMTOKEN AUTLOGIN user', user)
|
|
426
421
|
this.messagingAuthService.createCustomToken(token)
|
|
427
|
-
|
|
428
|
-
.catch(error => {
|
|
422
|
+
}).catch(error => {
|
|
429
423
|
this.logger.error('[APP-COMP] SIGNINWITHCUSTOMTOKEN error::', error)
|
|
430
|
-
|
|
424
|
+
})
|
|
431
425
|
}
|
|
432
426
|
|
|
433
427
|
/** */
|
|
@@ -577,16 +571,6 @@ export class AppComponent implements OnInit {
|
|
|
577
571
|
this.translate.use('en');
|
|
578
572
|
}
|
|
579
573
|
|
|
580
|
-
// this.logger.debug('[APP-COMP] navigator.language: ', navigator.language);
|
|
581
|
-
// let language;
|
|
582
|
-
// if (navigator.language.indexOf('-') !== -1) {
|
|
583
|
-
// language = navigator.language.substring(0, navigator.language.indexOf('-'));
|
|
584
|
-
// } else if (navigator.language.indexOf('_') !== -1) {
|
|
585
|
-
// language = navigator.language.substring(0, navigator.language.indexOf('_'));
|
|
586
|
-
// } else {
|
|
587
|
-
// language = navigator.language;
|
|
588
|
-
// }
|
|
589
|
-
// this.translate.use(language);
|
|
590
574
|
}
|
|
591
575
|
|
|
592
576
|
|
|
@@ -661,7 +645,6 @@ export class AppComponent implements OnInit {
|
|
|
661
645
|
updateStoredCurrentUser() {
|
|
662
646
|
const storedCurrentUser = this.appStorageService.getItem('currentUser')
|
|
663
647
|
const storedDshbrdUser = localStorage.getItem('user')
|
|
664
|
-
|
|
665
648
|
this.logger.log('[APP-COMP] updateStoredCurrentUser - stored currentUser', storedCurrentUser)
|
|
666
649
|
this.logger.log('[APP-COMP] updateStoredCurrentUser - stored dshbrdUser', storedDshbrdUser)
|
|
667
650
|
if ((storedCurrentUser && storedCurrentUser !== 'undefined') && (storedDshbrdUser && storedDshbrdUser !== 'undefined')) {
|
|
@@ -678,7 +661,6 @@ export class AppComponent implements OnInit {
|
|
|
678
661
|
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.color ', currentUser.color)
|
|
679
662
|
this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.fillColour ', dshbrdUser.fillColour)
|
|
680
663
|
}
|
|
681
|
-
|
|
682
664
|
if (currentUser.firstname !== dshbrdUser.firstname) {
|
|
683
665
|
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.firstname !== dshbrdUser.firstname')
|
|
684
666
|
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.firstname ', currentUser.firstname)
|
|
@@ -689,7 +671,6 @@ export class AppComponent implements OnInit {
|
|
|
689
671
|
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.firstname ', currentUser.firstname)
|
|
690
672
|
this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.firstname ', dshbrdUser.firstname)
|
|
691
673
|
}
|
|
692
|
-
|
|
693
674
|
if (currentUser.lastname !== dshbrdUser.lastname) {
|
|
694
675
|
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.lastname !== dshbrdUser.lastname')
|
|
695
676
|
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.lastname ', currentUser.lastname)
|
|
@@ -700,7 +681,6 @@ export class AppComponent implements OnInit {
|
|
|
700
681
|
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.lastname ', currentUser.lastname)
|
|
701
682
|
this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.lastname ', dshbrdUser.lastname)
|
|
702
683
|
}
|
|
703
|
-
|
|
704
684
|
if (currentUser.avatar !== dshbrdUser.fullname_initial) {
|
|
705
685
|
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.avatar !== dshbrdUser.fullname_initial')
|
|
706
686
|
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.avatar ', currentUser.avatar)
|
|
@@ -711,7 +691,6 @@ export class AppComponent implements OnInit {
|
|
|
711
691
|
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.avatar ', currentUser.avatar)
|
|
712
692
|
this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.fullname_initial ', dshbrdUser.fullname_initial)
|
|
713
693
|
}
|
|
714
|
-
|
|
715
694
|
let fullname = ""
|
|
716
695
|
if (dshbrdUser.firstname && !dshbrdUser.lastname) {
|
|
717
696
|
fullname = dshbrdUser.firstname
|
|
@@ -719,7 +698,6 @@ export class AppComponent implements OnInit {
|
|
|
719
698
|
fullname = dshbrdUser.firstname + ' ' + dshbrdUser.lastname
|
|
720
699
|
this.logger.log('[APP-COMP] updateStoredCurrentUser - fullname ', fullname)
|
|
721
700
|
}
|
|
722
|
-
|
|
723
701
|
if (fullname !== currentUser.fullname) {
|
|
724
702
|
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.fullname !== dshbrdUser.fullname ')
|
|
725
703
|
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.fullname ', fullname)
|
|
@@ -730,7 +708,6 @@ export class AppComponent implements OnInit {
|
|
|
730
708
|
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.fullname ', fullname)
|
|
731
709
|
this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.fullname ', currentUser.fullname)
|
|
732
710
|
}
|
|
733
|
-
|
|
734
711
|
this.appStorageService.setItem('currentUser', JSON.stringify(currentUser));
|
|
735
712
|
this.tiledeskAuthService.setCurrentUser(currentUser);
|
|
736
713
|
}
|
|
@@ -846,13 +823,10 @@ export class AppComponent implements OnInit {
|
|
|
846
823
|
}
|
|
847
824
|
|
|
848
825
|
private initAudio() {
|
|
849
|
-
// console.log('HERE IS initAudio ')
|
|
850
826
|
// SET AUDIO
|
|
851
827
|
const href = window.location.href;
|
|
852
828
|
const hrefArray = href.split('/#/');
|
|
853
829
|
const chatBaseUrl = hrefArray[0]
|
|
854
|
-
// console.log('initAudio href', href)
|
|
855
|
-
// console.log('initAudio chatBaseUrl', chatBaseUrl)
|
|
856
830
|
|
|
857
831
|
this.audio = new Audio();
|
|
858
832
|
this.audio.src = chatBaseUrl + URL_SOUND_LIST_CONVERSATION;
|
|
@@ -862,7 +836,6 @@ export class AppComponent implements OnInit {
|
|
|
862
836
|
private manageTabNotification() {
|
|
863
837
|
if (!this.isTabVisible) {
|
|
864
838
|
// TAB IS HIDDEN --> manage title and SOUND
|
|
865
|
-
// console.log('HERE IS manageTabNotification ')
|
|
866
839
|
let badgeNewConverstionNumber = this.conversationsHandlerService.countIsNew()
|
|
867
840
|
badgeNewConverstionNumber > 0 ? badgeNewConverstionNumber : badgeNewConverstionNumber = 1
|
|
868
841
|
document.title = "(" + badgeNewConverstionNumber + ") " + this.tabTitle
|
|
@@ -881,7 +854,6 @@ export class AppComponent implements OnInit {
|
|
|
881
854
|
}
|
|
882
855
|
|
|
883
856
|
soundMessage() {
|
|
884
|
-
// console.log('HERE IS soundMessage ')
|
|
885
857
|
const that = this;
|
|
886
858
|
// this.audio = new Audio();
|
|
887
859
|
// // this.audio.src = '/assets/sounds/pling.mp3';
|
|
@@ -917,11 +889,7 @@ export class AppComponent implements OnInit {
|
|
|
917
889
|
return;
|
|
918
890
|
}
|
|
919
891
|
|
|
920
|
-
this.BSAuthStateChangedSubscriptionRef = this.messagingAuthService.BSAuthStateChanged
|
|
921
|
-
|
|
922
|
-
// .pipe(takeUntil(this.unsubscribe$))
|
|
923
|
-
.pipe(filter((state) => state !== null))
|
|
924
|
-
.subscribe((state: any) => {
|
|
892
|
+
this.BSAuthStateChangedSubscriptionRef = this.messagingAuthService.BSAuthStateChanged.pipe(filter((state) => state !== null)).subscribe((state: any) => {
|
|
925
893
|
this.logger.log('initialize FROM [APP-COMP] - [APP-COMP] ***** BSAuthStateChanged state', state);
|
|
926
894
|
|
|
927
895
|
if (state && state === AUTH_STATE_ONLINE) {
|
|
@@ -950,30 +918,24 @@ export class AppComponent implements OnInit {
|
|
|
950
918
|
|
|
951
919
|
|
|
952
920
|
this.conversationsHandlerService.conversationAdded.subscribe((conversation: ConversationModel) => {
|
|
953
|
-
|
|
921
|
+
this.logger.log('[APP-COMP] ***** conversationsAdded *****', conversation);
|
|
954
922
|
// that.conversationsChanged(conversations);
|
|
955
923
|
if (conversation && conversation.is_new === true) {
|
|
956
924
|
this.manageTabNotification()
|
|
925
|
+
this.updateConversationsOnStorage()
|
|
957
926
|
}
|
|
958
927
|
});
|
|
959
928
|
|
|
960
929
|
this.conversationsHandlerService.conversationChanged.subscribe((conversation: ConversationModel) => {
|
|
961
|
-
|
|
962
930
|
// console.log('[APP-COMP] ***** subscribeConversationChanged conversation: ', conversation);
|
|
963
|
-
|
|
964
|
-
const
|
|
965
|
-
if (
|
|
966
|
-
currentUser = JSON.parse(storedCurrentUser);
|
|
931
|
+
if(conversation) this.updateConversationsOnStorage();
|
|
932
|
+
const currentUser = this.tiledeskAuthService.getCurrentUser()
|
|
933
|
+
if (currentUser && currentUser !== null) {
|
|
967
934
|
this.logger.log('[APP-COMP] ***** subscribeConversationChanged currentUser: ', currentUser);
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
this.logger.log('[APP-COMP] ***** subscribeConversationChanged current_user uid: ', currentUser.uid);
|
|
971
|
-
if (conversation && conversation.sender !== currentUser.uid) {
|
|
972
|
-
this.manageTabNotification();
|
|
973
|
-
}
|
|
935
|
+
if (conversation && conversation.sender !== currentUser.uid) {
|
|
936
|
+
this.manageTabNotification();
|
|
974
937
|
}
|
|
975
|
-
|
|
976
|
-
this.logger.error('[APP-COMP] ***** subscribeConversationChanged currentUser nor found in storage ');
|
|
938
|
+
|
|
977
939
|
}
|
|
978
940
|
});
|
|
979
941
|
}
|
|
@@ -1036,9 +998,8 @@ export class AppComponent implements OnInit {
|
|
|
1036
998
|
|
|
1037
999
|
goOffLine = () => {
|
|
1038
1000
|
this.logger.log('[APP-COMP] - GO-OFFLINE');
|
|
1039
|
-
|
|
1040
|
-
this.
|
|
1041
|
-
if (supportmode === true) {
|
|
1001
|
+
this.logger.log('[APP-COMP] - GO-OFFINE - supportmode ', this.SUPPORT_MODE);
|
|
1002
|
+
if (this.SUPPORT_MODE === true) {
|
|
1042
1003
|
this.webSocketClose()
|
|
1043
1004
|
}
|
|
1044
1005
|
// this.isOnline = false;
|
|
@@ -1121,6 +1082,7 @@ export class AppComponent implements OnInit {
|
|
|
1121
1082
|
|
|
1122
1083
|
|
|
1123
1084
|
if (hasClickedLogout === true) {
|
|
1085
|
+
this.appStorageService.removeItem('conversations')
|
|
1124
1086
|
// ----------------------------------------------
|
|
1125
1087
|
// PUSH NOTIFICATIONS
|
|
1126
1088
|
// ----------------------------------------------
|
|
@@ -1227,14 +1189,13 @@ export class AppComponent implements OnInit {
|
|
|
1227
1189
|
this.logger.log('[APP-COMP] initConversationsHandler ------------->', userId, this.tenant);
|
|
1228
1190
|
// 1 - init chatConversationsHandler and archviedConversationsHandler
|
|
1229
1191
|
this.conversationsHandlerService.initialize(this.tenant, userId, translationMap);
|
|
1230
|
-
|
|
1231
1192
|
// this.subscribeToConvs()
|
|
1232
|
-
this.
|
|
1233
|
-
|
|
1234
|
-
|
|
1193
|
+
const lastTimestamp = this.manageStoredConversations()
|
|
1194
|
+
this.logger.log('[APP-COMP] initConversationsHandler: get lastTimestamp', lastTimestamp)
|
|
1195
|
+
this.conversationsHandlerService.subscribeToConversations(lastTimestamp, () => {
|
|
1196
|
+
// this.logger.log('[APP-COMP] - CONVS - INIT CONV')
|
|
1235
1197
|
const conversations = this.conversationsHandlerService.conversations;
|
|
1236
1198
|
this.logger.info('initialize FROM [APP-COMP] - [APP-COMP]-CONVS - INIT CONV CONVS', conversations)
|
|
1237
|
-
|
|
1238
1199
|
// this.logger.printDebug('SubscribeToConversations (convs-list-page) - conversations')
|
|
1239
1200
|
if (!conversations || conversations.length === 0) {
|
|
1240
1201
|
// that.showPlaceholder = true;
|
|
@@ -1245,6 +1206,31 @@ export class AppComponent implements OnInit {
|
|
|
1245
1206
|
|
|
1246
1207
|
}
|
|
1247
1208
|
|
|
1209
|
+
// START: manage conversations on firebase upon last timestamp from stored conversations
|
|
1210
|
+
private manageStoredConversations(): number {
|
|
1211
|
+
let timestamp = 0
|
|
1212
|
+
if(this.appStorageService.getItem('conversations')){
|
|
1213
|
+
const conversationsStored = JSON.parse(this.appStorageService.getItem('conversations'))
|
|
1214
|
+
if(conversationsStored && conversationsStored.length > 0) {
|
|
1215
|
+
this.conversationsHandlerService.conversations = conversationsStored
|
|
1216
|
+
timestamp = conversationsStored[0].timestamp
|
|
1217
|
+
this.events.publish('appcompSubscribeToConvs:loadingIsActive', false);
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
return timestamp
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
private updateConversationsOnStorage(){
|
|
1224
|
+
const that = this
|
|
1225
|
+
//reset timer and save conversation on storage after 2s
|
|
1226
|
+
clearTimeout(this.setTimeoutConversationsEvent);
|
|
1227
|
+
this.setTimeoutConversationsEvent = setTimeout(() => {
|
|
1228
|
+
this.logger.debug('[APP-COMP] updateConversationsOnStorage: reset timer and save conversations -> ', this.conversationsHandlerService.conversations.length)
|
|
1229
|
+
that.appStorageService.setItem('conversations', JSON.stringify(this.conversationsHandlerService.conversations))
|
|
1230
|
+
}, 2000);
|
|
1231
|
+
}
|
|
1232
|
+
// END: manage conversations on firebase upon last timestamp from stored conversations
|
|
1233
|
+
|
|
1248
1234
|
private initArchivedConversationsHandler(userId: string) {
|
|
1249
1235
|
const keys = ['YOU'];
|
|
1250
1236
|
|
package/src/app/app.module.ts
CHANGED
|
@@ -278,6 +278,7 @@ const appInitializerFn = (appConfig: AppConfigProvider, logger: NGXLogger) => {
|
|
|
278
278
|
serverLogLevel: NgxLoggerLevel.ERROR,
|
|
279
279
|
timestampFormat: 'HH:mm:ss.SSS',
|
|
280
280
|
enableSourceMaps: false,
|
|
281
|
+
disableFileDetails: true,
|
|
281
282
|
colorScheme: ['purple', 'yellow', 'gray', 'gray', 'red', 'red', 'red'],
|
|
282
283
|
serverLoggingUrl: 'https://tiledesk-server-pre.herokuapp.com/logs'
|
|
283
284
|
}),
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
[textColor]="'col-msg-sent'"
|
|
87
87
|
[addAsCannedResponseTooltipText]="addAsCannedResponseTooltipText"
|
|
88
88
|
[areVisibleCAR]="areVisibleCAR"
|
|
89
|
-
[
|
|
89
|
+
[supportMode]="supportMode"
|
|
90
90
|
(onBeforeMessageRender)="returnOnBeforeMessageRender($event)"
|
|
91
91
|
(onAfterMessageRender)="returnOnAfterMessageRender($event)"
|
|
92
92
|
(onImageRendered)="onImageRenderedFN($event)">
|
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
[textColor]="'black'"
|
|
126
126
|
[addAsCannedResponseTooltipText]="addAsCannedResponseTooltipText"
|
|
127
127
|
[areVisibleCAR]="areVisibleCAR"
|
|
128
|
-
[
|
|
128
|
+
[supportMode]="supportMode"
|
|
129
129
|
(onBeforeMessageRender)="returnOnBeforeMessageRender($event)"
|
|
130
130
|
(onAfterMessageRender)="returnOnAfterMessageRender($event)"
|
|
131
131
|
(onImageRendered)="onImageRenderedFN($event)"
|
|
@@ -22,12 +22,12 @@ export class IonConversationDetailComponent extends ConversationContentComponent
|
|
|
22
22
|
|
|
23
23
|
@Input() senderId: string;
|
|
24
24
|
@Input() channelType: string;
|
|
25
|
+
@Input() areVisibleCAR: boolean;
|
|
26
|
+
@Input() supportMode: boolean;
|
|
25
27
|
@Output() onImageRendered = new EventEmitter<boolean>()
|
|
26
28
|
@Output() onAddUploadingBubble = new EventEmitter<boolean>();
|
|
27
29
|
|
|
28
30
|
public public_Key: any
|
|
29
|
-
public areVisibleCAR: boolean
|
|
30
|
-
public support_mode: boolean
|
|
31
31
|
public uploadProgress: number = 100
|
|
32
32
|
public fileType: any
|
|
33
33
|
public browserLang: string;
|
|
@@ -64,48 +64,11 @@ export class IonConversationDetailComponent extends ConversationContentComponent
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
ngOnInit() {
|
|
67
|
-
this.getOSCODE()
|
|
68
67
|
this.listenToUploadFileProgress();
|
|
69
68
|
this.setMomentLocaleAndGetTranslation();
|
|
70
69
|
}
|
|
71
70
|
|
|
72
|
-
getOSCODE() {
|
|
73
|
-
this.support_mode = null
|
|
74
|
-
if( this.appConfigProvider.getConfig().supportMode === true || this.appConfigProvider.getConfig().supportMode === 'true') {
|
|
75
|
-
this.support_mode = true
|
|
76
|
-
} else if ( this.appConfigProvider.getConfig().supportMode === false || this.appConfigProvider.getConfig().supportMode === 'false') {
|
|
77
|
-
this.support_mode = false
|
|
78
|
-
} else if ( !this.appConfigProvider.getConfig().supportMode ) {
|
|
79
|
-
this.support_mode = false
|
|
80
|
-
}
|
|
81
|
-
this.public_Key = this.appConfigProvider.getConfig().t2y12PruGU9wUtEGzBJfolMIgK
|
|
82
|
-
this.logger.log('[CONVS-DETAIL][ION-CONVS-DETAIL] AppConfigService getAppConfig public_Key', this.public_Key)
|
|
83
|
-
|
|
84
|
-
if (this.public_Key) {
|
|
85
|
-
let keys = this.public_Key.split('-')
|
|
86
|
-
this.logger.log('[CONVS-DETAIL][ION-CONVS-DETAIL] PUBLIC-KEY - public_Key keys', keys)
|
|
87
|
-
|
|
88
|
-
keys.forEach((key) => {
|
|
89
|
-
if (key.includes('CAR')) {
|
|
90
|
-
let car = key.split(':')
|
|
91
|
-
if (car[1] === 'F') {
|
|
92
|
-
this.areVisibleCAR = false
|
|
93
|
-
this.logger.log('[CONVS-DETAIL][ION-CONVS-DETAIL] PUBLIC-KEY - areVisibleCAR', this.areVisibleCAR)
|
|
94
|
-
} else {
|
|
95
|
-
this.areVisibleCAR = true
|
|
96
|
-
this.logger.log('[CONVS-DETAIL][ION-CONVS-DETAIL] PUBLIC-KEY - areVisibleCAR', this.areVisibleCAR)
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
})
|
|
100
71
|
|
|
101
|
-
if (!this.public_Key.includes('CAR')) {
|
|
102
|
-
this.areVisibleCAR = false
|
|
103
|
-
// console.log('[CONVS-DETAIL][ION-CONVS-DETAIL] PUBLIC-KEY - areVisibleCAR', this.areVisibleCAR)
|
|
104
|
-
}
|
|
105
|
-
} else {
|
|
106
|
-
this.areVisibleCAR = false
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
72
|
|
|
110
73
|
setMomentLocaleAndGetTranslation() {
|
|
111
74
|
this.browserLang = this.translate.getBrowserLang();
|
package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.html
CHANGED
|
@@ -18,13 +18,18 @@
|
|
|
18
18
|
|
|
19
19
|
<!-- [width]="getMetadataSize(message.metadata).width"
|
|
20
20
|
[height]="getMetadataSize(message.metadata).height" -->
|
|
21
|
-
<chat-image *ngIf="isImage(message)"
|
|
22
|
-
[
|
|
21
|
+
<chat-image *ngIf="isImage(message)"
|
|
22
|
+
[metadata]="message.metadata"
|
|
23
|
+
[width]="message.metadata.width"
|
|
24
|
+
[height]="message.metadata.height"
|
|
25
|
+
(onImageRendered)="onImageRenderedFN($event)">
|
|
23
26
|
</chat-image>
|
|
24
27
|
|
|
25
28
|
<!-- [width]="getMetadataSize(message.metadata).width" -->
|
|
26
29
|
<!-- [height]="getMetadataSize(message.metadata).height"> -->
|
|
27
|
-
<chat-frame *ngIf="isFrame(message)"
|
|
30
|
+
<chat-frame *ngIf="isFrame(message)"
|
|
31
|
+
[metadata]="message.metadata"
|
|
32
|
+
[width]="message.metadata.width"
|
|
28
33
|
[height]="message.metadata.height">
|
|
29
34
|
</chat-frame>
|
|
30
35
|
|
|
@@ -42,13 +47,20 @@
|
|
|
42
47
|
<span> {{message.timestamp | amCalendar }} </span>
|
|
43
48
|
</ng-template> -->
|
|
44
49
|
|
|
45
|
-
<chat-text
|
|
46
|
-
|
|
50
|
+
<chat-text *ngIf="message?.type !=='html'"
|
|
51
|
+
[text]="message?.text"
|
|
52
|
+
[color]="textColor"
|
|
53
|
+
[message]="message"
|
|
54
|
+
[class.chat-text-emoticon]="message?.emoticon"
|
|
47
55
|
(onBeforeMessageRender)="returnOnBeforeMessageRender($event)"
|
|
48
56
|
(onAfterMessageRender)="returnOnAfterMessageRender($event)">
|
|
49
57
|
</chat-text>
|
|
50
58
|
|
|
51
|
-
<
|
|
59
|
+
<chat-html *ngIf="message?.type==='html'"
|
|
60
|
+
[htmlText]="message?.text">
|
|
61
|
+
</chat-html>
|
|
62
|
+
|
|
63
|
+
<ng-container *ngIf="areVisibleCAR && supportMode">
|
|
52
64
|
<ion-button shape="round" size="small" class="btn-add-msg-as-canned-response" ion-button fill="clear"
|
|
53
65
|
(click)="presentCreateCannedResponseModal()" tooltip="{{addAsCannedResponseTooltipText}}"
|
|
54
66
|
[options]="tooltipOptions" placement="bottom">
|
package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.ts
CHANGED
|
@@ -20,7 +20,7 @@ export class BubbleMessageComponent implements OnInit, OnChanges {
|
|
|
20
20
|
@Input() message: MessageModel;
|
|
21
21
|
@Input() textColor: string;
|
|
22
22
|
@Input() areVisibleCAR: boolean;
|
|
23
|
-
@Input()
|
|
23
|
+
@Input() supportMode: boolean;
|
|
24
24
|
@Output() onBeforeMessageRender = new EventEmitter();
|
|
25
25
|
@Output() onAfterMessageRender = new EventEmitter();
|
|
26
26
|
@Output() onImageRendered = new EventEmitter<boolean>()
|
|
@@ -89,7 +89,7 @@ export class BubbleMessageComponent implements OnInit, OnChanges {
|
|
|
89
89
|
ngOnChanges() {
|
|
90
90
|
this.logger.log('BUBBLE-MSG Hello !!!! this.message ', this.message)
|
|
91
91
|
this.logger.log('BUBBLE-MSG ngOnChanges areVisibleCAR', this.areVisibleCAR)
|
|
92
|
-
this.logger.log('BUBBLE-MSG ngOnChanges
|
|
92
|
+
this.logger.log('BUBBLE-MSG ngOnChanges supportMode', this.supportMode)
|
|
93
93
|
if (this.message && this.message.metadata && typeof this.message.metadata === 'object') {
|
|
94
94
|
this.getMetadataSize(this.message.metadata)
|
|
95
95
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<div id="htmlCode" #htmlCode [innerHTML]="htmlText | safeHtml"></div>
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// @import '../../../../sass/variables';
|
|
2
|
+
|
|
3
|
+
:root {
|
|
4
|
+
--themeColor: #62a8ea;
|
|
5
|
+
--foregroundColor: #ffffff;
|
|
6
|
+
--buttonFontSize: 12px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
::ng-deep {
|
|
11
|
+
|
|
12
|
+
.button-html {
|
|
13
|
+
padding: 8px 16px!important;
|
|
14
|
+
position: relative;
|
|
15
|
+
max-width: 300px;
|
|
16
|
+
min-width: inherit;
|
|
17
|
+
cursor: pointer !important;
|
|
18
|
+
border: 1px solid #62a8ea;
|
|
19
|
+
border-radius: 20px;
|
|
20
|
+
margin: 3px;
|
|
21
|
+
background: transparent;
|
|
22
|
+
overflow: hidden;
|
|
23
|
+
font-family: 'Muli', sans-serif !important;
|
|
24
|
+
font-size: 12px !important;
|
|
25
|
+
-o-text-overflow: ellipsis;
|
|
26
|
+
text-overflow: ellipsis;
|
|
27
|
+
white-space: nowrap;
|
|
28
|
+
letter-spacing: -0.24px;
|
|
29
|
+
-webkit-font-smoothing: antialiased;
|
|
30
|
+
color: #62a8ea;
|
|
31
|
+
line-height: 16px;
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.url {
|
|
36
|
+
transition: background-color .6s ease;
|
|
37
|
+
.icon-button-action {
|
|
38
|
+
position: absolute;
|
|
39
|
+
top: -1px;
|
|
40
|
+
right: 1px;
|
|
41
|
+
svg {
|
|
42
|
+
fill: #62a8ea;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
.icon-button-action-self{
|
|
46
|
+
position: absolute;
|
|
47
|
+
right: 1px;
|
|
48
|
+
svg {
|
|
49
|
+
fill: #62a8ea;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
&:focus,
|
|
53
|
+
&:hover {
|
|
54
|
+
color: white;
|
|
55
|
+
background: #62a8ea;
|
|
56
|
+
.icon-button-action, .icon-button-action-self {
|
|
57
|
+
svg {
|
|
58
|
+
fill: white;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
&:active{
|
|
63
|
+
font-size: 20px;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.text-html{
|
|
68
|
+
font-size: 1.4em;
|
|
69
|
+
margin: 0;
|
|
70
|
+
padding: 8px;
|
|
71
|
+
font-style: normal;
|
|
72
|
+
letter-spacing: normal;
|
|
73
|
+
font-stretch: normal;
|
|
74
|
+
font-variant: normal;
|
|
75
|
+
font-weight: 300;
|
|
76
|
+
overflow: hidden;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { HtmlComponent } from './html.component';
|
|
4
|
+
|
|
5
|
+
describe('HtmlComponent', () => {
|
|
6
|
+
let component: HtmlComponent;
|
|
7
|
+
let fixture: ComponentFixture<HtmlComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async(() => {
|
|
10
|
+
TestBed.configureTestingModule({
|
|
11
|
+
declarations: [ HtmlComponent ]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
}));
|
|
15
|
+
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
fixture = TestBed.createComponent(HtmlComponent);
|
|
18
|
+
component = fixture.componentInstance;
|
|
19
|
+
fixture.detectChanges();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should create', () => {
|
|
23
|
+
expect(component).toBeTruthy();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
|
|
2
|
+
import { Component, ElementRef, Input, OnInit, SimpleChange, SimpleChanges, ViewChild, ViewEncapsulation } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'chat-html',
|
|
6
|
+
templateUrl: './html.component.html',
|
|
7
|
+
styleUrls: ['./html.component.scss']
|
|
8
|
+
})
|
|
9
|
+
export class HtmlComponent implements OnInit {
|
|
10
|
+
|
|
11
|
+
@Input() htmlText: string;
|
|
12
|
+
@Input() fontSize: string;
|
|
13
|
+
@Input() themeColor: string;
|
|
14
|
+
@Input() foregroundColor: string;
|
|
15
|
+
|
|
16
|
+
@ViewChild('htmlCode', {static: true}) container;
|
|
17
|
+
|
|
18
|
+
constructor(private elementRef: ElementRef) { }
|
|
19
|
+
|
|
20
|
+
ngOnInit(){
|
|
21
|
+
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
ngOnChanges(changes: SimpleChanges){
|
|
25
|
+
//decomment if element should have same color of themeColor and fregroundColor
|
|
26
|
+
if(this.fontSize) this.elementRef.nativeElement.style.setProperty('--buttonFontSize', this.fontSize);
|
|
27
|
+
if(this.themeColor) this.elementRef.nativeElement.style.setProperty('--themeColor', this.themeColor);
|
|
28
|
+
if(this.foregroundColor) this.elementRef.nativeElement.style.setProperty('--foregroundColor', this.foregroundColor);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
}
|
package/src/app/components/conversation-detail/message-text-area/message-text-area.component.html
CHANGED
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
|
|
41
41
|
<div class="start-buttons" style="position: absolute;display: flex; top: 2px;">
|
|
42
42
|
|
|
43
|
-
<ng-container *ngIf="areVisibleCAR &&
|
|
43
|
+
<ng-container *ngIf="areVisibleCAR && supportMode">
|
|
44
44
|
<div class="canned-responses-btn-wpr" style="margin-left: -5px;"
|
|
45
45
|
tooltip="{{translationMap?.get('CANNED_RESPONSES')}}" [options]="tooltipOptions" placement="top">
|
|
46
46
|
<ion-button ion-button fill="clear" class="canned-responses-btn" (click)="openCannedResponses()"
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
|
|
111
111
|
|
|
112
112
|
|
|
113
|
-
<div class="text-message" [ngClass]="{'text-message-no-cr': areVisibleCAR === false ||
|
|
113
|
+
<div class="text-message" [ngClass]="{'text-message-no-cr': areVisibleCAR === false || supportMode === false}">
|
|
114
114
|
<ion-textarea id="ion-textarea" #messageTextArea #message_text_area #textArea rows="1"
|
|
115
115
|
[placeholder]="TEXAREA_PLACEHOLDER" autosize="false" auto-grow="true" autofocus="true" [value]=""
|
|
116
116
|
[(ngModel)]="messageString" (ionChange)="ionChange($event);" [disabled]="disableTextarea"
|