@chat21/chat21-ionic 3.0.62-rc2 → 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 +38 -0
- package/README.md +6 -2
- package/deploy_prod.sh +5 -5
- package/package.json +7 -1
- package/src/app/app.component.ts +127 -69
- package/src/app/app.module.ts +1 -0
- package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.html +2 -0
- package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.ts +2 -1
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.html +34 -22
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.scss +33 -12
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.ts +4 -40
- 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.scss +1 -1
- 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/chatlib/conversation-detail/message/image/image.component.ts +5 -3
- package/src/app/chatlib/conversation-detail/message/return-receipt/return-receipt.component.scss +1 -1
- package/src/app/components/conversation-detail/bubble-my-message/bubble-my-message.component.html +1 -1
- package/src/app/components/conversation-detail/bubble-my-message/bubble-my-message.component.scss +4 -4
- package/src/app/components/conversation-detail/bubble-others-message/bubble-others-message.component.html +1 -1
- package/src/app/components/conversation-detail/bubble-others-message/bubble-others-message.component.scss +3 -3
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.html +3 -3
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.ts +10 -55
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.html +10 -4
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +4 -2
- package/src/app/components/image-viewer/image-viewer.component.ts +28 -10
- package/src/app/components/project-item/project-item.component.ts +6 -30
- package/src/app/components/sidebar/sidebar.component.html +2 -2
- package/src/app/components/sidebar/sidebar.component.ts +49 -83
- package/src/app/components/sidebar-user-details/sidebar-user-details.component.html +17 -1
- package/src/app/components/sidebar-user-details/sidebar-user-details.component.scss +52 -6
- package/src/app/components/sidebar-user-details/sidebar-user-details.component.ts +81 -111
- package/src/app/directives/safe-html.pipe.ts +2 -2
- package/src/app/pages/authentication/login/login.page.ts +20 -1
- package/src/app/pages/conversation-detail/conversation-detail.page.html +42 -19
- package/src/app/pages/conversation-detail/conversation-detail.page.scss +15 -6
- package/src/app/pages/conversation-detail/conversation-detail.page.ts +188 -264
- 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/services/nav-proxy.service.ts +15 -13
- package/src/app/shared/shared.module.ts +4 -0
- package/src/assets/i18n/de.json +2 -1
- package/src/assets/i18n/en.json +2 -1
- package/src/assets/i18n/es.json +2 -1
- package/src/assets/i18n/fr.json +2 -1
- package/src/assets/i18n/it.json +2 -1
- package/src/assets/i18n/pt.json +2 -1
- package/src/assets/i18n/ru.json +2 -1
- package/src/assets/i18n/sr.json +2 -1
- package/src/assets/i18n/tr.json +2 -1
- package/src/chat-config-pre-test.json +2 -1
- package/src/chat-config-pre.json +15 -3
- 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-conversation-handler.ts +2 -3
- package/src/chat21-core/providers/firebase/firebase-conversations-handler.ts +65 -9
- package/src/chat21-core/providers/logger/customLogger.ts +2 -10
- package/src/chat21-core/providers/tiledesk/tiledesk-auth.service.ts +1 -1
- package/src/chat21-core/utils/utils-message.ts +101 -85
- package/src/variables.scss +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,43 @@
|
|
|
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
|
+
|
|
9
|
+
### 3.0.63
|
|
10
|
+
- Deploys in production
|
|
11
|
+
|
|
12
|
+
### 3.0.62.4-rc2
|
|
13
|
+
- Fixed bug: in the modal window showing the image preview before download, the image name is missing
|
|
14
|
+
- Add the ability to display the app sidebar in "wide mode"
|
|
15
|
+
- Displays balloon messages with a light orange background for "internal notes" type message
|
|
16
|
+
- Updates the regex that detects if the message contains only one or more emojis
|
|
17
|
+
|
|
18
|
+
### 3.0.62.4-rc1
|
|
19
|
+
- Fixes the bug: when the user profile is updated in the dashboard it is not updated in the chat
|
|
20
|
+
- Fixes the bug: when is sent a message with only emojis, some emojis have the chat balloon background
|
|
21
|
+
- Fixes the bug: in the conversation detail header the requester's avatar does not update after the same has filled in the pre-chat form requested by the bot
|
|
22
|
+
- Fixes the bug: images that are not in the database cannot be downloaded
|
|
23
|
+
- Adds default chat color to emojis picker tabs
|
|
24
|
+
- Fixes the bug: the selected conversation is undefined
|
|
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
|
|
26
|
+
|
|
27
|
+
### 3.0.62.3
|
|
28
|
+
- Fixes the bug: the method setTyping fired twice after that a message is sent
|
|
29
|
+
- Other minor improvements
|
|
30
|
+
|
|
31
|
+
### 3.0.62.2
|
|
32
|
+
- Fixed bug: if the teammate has the role of agent when switching from the dashboard to the chat and vice versa, the icons that only owners and admins have access to are displayed briefly in the left sidebar
|
|
33
|
+
- Adds the "Edit Profile" button and a link to the help center in the teammate details drawer
|
|
34
|
+
|
|
35
|
+
### 3.0.62.1
|
|
36
|
+
- Allows agents to use the "Monitor" page
|
|
37
|
+
|
|
38
|
+
### 3.0.62
|
|
39
|
+
- Deploys in production
|
|
40
|
+
|
|
3
41
|
### 3.0.62-rc2
|
|
4
42
|
- Fixed bug: in the teammate drawer if the full name is too long it overlaps the email
|
|
5
43
|
- Fixed bug: in the teammate drawer if the email is too long it exceeds the width of the drawer
|
package/README.md
CHANGED
|
@@ -67,7 +67,7 @@ Use [Docker Compose Tiledesk installation guide](https://github.com/Tiledesk/til
|
|
|
67
67
|
fileUploadAccept:"*/*",
|
|
68
68
|
logLevel":"<YOUR-PREFERRED-LOG-LEVEL>",
|
|
69
69
|
supportMode: false,
|
|
70
|
-
|
|
70
|
+
writeToButton: false,
|
|
71
71
|
archivedButton: false,
|
|
72
72
|
firebaseConfig: {
|
|
73
73
|
tenant:"tilechat",
|
|
@@ -100,7 +100,11 @@ Use [Docker Compose Tiledesk installation guide](https://github.com/Tiledesk/til
|
|
|
100
100
|
|
|
101
101
|
* `wsUrl`: allows you to know in real time the agent's availability status, the agent's busy status and the number of unassigned conversations for a selected project
|
|
102
102
|
|
|
103
|
-
* `supportMode`: if set to true it
|
|
103
|
+
* `supportMode`: if it is set to true it shows the left sidebar which makes dashboard and chat management smarter
|
|
104
|
+
|
|
105
|
+
* `writeToButton`: if set to true, it makes the button for viewing the contact list visible and makes direct conversations with them possible
|
|
106
|
+
|
|
107
|
+
* `archivedButton`: if set to true, it makes the button for viewing archived conversations visible
|
|
104
108
|
|
|
105
109
|
### Push notification
|
|
106
110
|
* open `/src/firebase-messaging-sw.js` and replace messagingSenderId: with < your messagingSenderId >
|
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.62-rc2",
|
|
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",
|
|
@@ -52,6 +57,7 @@
|
|
|
52
57
|
"cordova-plugin-whitelist": "^1.3.5",
|
|
53
58
|
"cordova-res": "^0.15.1",
|
|
54
59
|
"core-js": "^2.5.4",
|
|
60
|
+
"file-saver": "^2.0.5",
|
|
55
61
|
"firebase": "^8.6.7",
|
|
56
62
|
"marked": "^2.0.1",
|
|
57
63
|
"material-design-icons": "^3.0.1",
|
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;
|
|
@@ -269,7 +270,6 @@ export class AppComponent implements OnInit {
|
|
|
269
270
|
|
|
270
271
|
saveInStorageNumberOfOpenedChatTab() {
|
|
271
272
|
// this.logger.log('Calling saveInStorageChatOpenedTab!');
|
|
272
|
-
|
|
273
273
|
// https://jsfiddle.net/jjjs5wd3/3/å
|
|
274
274
|
if (+localStorage.tabCount > 0) {
|
|
275
275
|
this.logger.log('Chat IONIC Already open!');
|
|
@@ -299,7 +299,7 @@ export class AppComponent implements OnInit {
|
|
|
299
299
|
ngOnInit() {
|
|
300
300
|
const appconfig = this.appConfigProvider.getConfig();
|
|
301
301
|
this.logger.log('[APP-COMP] ngOnInit appconfig', appconfig)
|
|
302
|
-
if (appconfig && appconfig.supportMode &&
|
|
302
|
+
if (appconfig && appconfig.supportMode && (appconfig.supportMode === true || appconfig.supportMode === 'true')) {
|
|
303
303
|
this.SUPPORT_MODE = true;
|
|
304
304
|
this.logger.log('[APP-COMP] appconfig > SUPPORT_MODE', this.SUPPORT_MODE)
|
|
305
305
|
} else {
|
|
@@ -342,8 +342,6 @@ export class AppComponent implements OnInit {
|
|
|
342
342
|
|
|
343
343
|
if (event && event.data && event.data.action && event.data.parameter) {
|
|
344
344
|
if (event.data.action === 'openJoinConversationModal') {
|
|
345
|
-
// console.log("[APP-COMP] message event action ", event.data.action);
|
|
346
|
-
// console.log("[APP-COMP] message event parameter ", event.data.parameter);
|
|
347
345
|
this.presentAlertConfirmJoinRequest(event.data.parameter, event.data.calledBy)
|
|
348
346
|
}
|
|
349
347
|
}
|
|
@@ -378,7 +376,6 @@ export class AppComponent implements OnInit {
|
|
|
378
376
|
|
|
379
377
|
async presentAlertConfirmJoinRequest(requestid, calledby) {
|
|
380
378
|
var iframeWin = <HTMLIFrameElement>document.getElementById("unassigned-convs-iframe")
|
|
381
|
-
// console.log("[APP-COMP] message event iframeWin ", iframeWin);
|
|
382
379
|
|
|
383
380
|
const isIFrame = (input: HTMLElement | null): input is HTMLIFrameElement =>
|
|
384
381
|
input !== null && input.tagName === 'IFRAME';
|
|
@@ -396,12 +393,10 @@ export class AppComponent implements OnInit {
|
|
|
396
393
|
role: 'cancel',
|
|
397
394
|
cssClass: 'secondary',
|
|
398
395
|
handler: (blah) => {
|
|
399
|
-
// console.log('Confirm Cancel: blah', blah);
|
|
400
396
|
}
|
|
401
397
|
}, {
|
|
402
398
|
text: 'Ok',
|
|
403
399
|
handler: () => {
|
|
404
|
-
// console.log('Confirm Okay');
|
|
405
400
|
|
|
406
401
|
if (isIFrame(iframeWin) && iframeWin.contentWindow) {
|
|
407
402
|
const msg = { action: "joinConversation", parameter: requestid, calledBy: calledby }
|
|
@@ -421,14 +416,12 @@ export class AppComponent implements OnInit {
|
|
|
421
416
|
signInWithCustomToken(token) {
|
|
422
417
|
// this.isOnline = false;
|
|
423
418
|
this.logger.log('[APP-COMP] SIGNINWITHCUSTOMTOKEN token', token)
|
|
424
|
-
this.tiledeskAuthService.signInWithCustomToken(token)
|
|
425
|
-
.then((user: any) => {
|
|
419
|
+
this.tiledeskAuthService.signInWithCustomToken(token).then((user: any) => {
|
|
426
420
|
this.logger.log('[APP-COMP] SIGNINWITHCUSTOMTOKEN AUTLOGIN user', user)
|
|
427
421
|
this.messagingAuthService.createCustomToken(token)
|
|
428
|
-
|
|
429
|
-
.catch(error => {
|
|
422
|
+
}).catch(error => {
|
|
430
423
|
this.logger.error('[APP-COMP] SIGNINWITHCUSTOMTOKEN error::', error)
|
|
431
|
-
|
|
424
|
+
})
|
|
432
425
|
}
|
|
433
426
|
|
|
434
427
|
/** */
|
|
@@ -564,30 +557,20 @@ export class AppComponent implements OnInit {
|
|
|
564
557
|
} else if (browserLang && stored_preferred_lang) {
|
|
565
558
|
chat_lang = stored_preferred_lang
|
|
566
559
|
}
|
|
567
|
-
|
|
560
|
+
|
|
568
561
|
this.logger.log('[APP-COMP] - chat_lang', chat_lang)
|
|
569
|
-
|
|
562
|
+
|
|
570
563
|
if (tranlatedLanguage.includes(chat_lang)) {
|
|
571
|
-
this.logger.log('[APP-COMP] tranlatedLanguage includes',chat_lang
|
|
564
|
+
this.logger.log('[APP-COMP] tranlatedLanguage includes', chat_lang, ': ', tranlatedLanguage.includes(chat_lang))
|
|
572
565
|
this.translate.setDefaultLang(chat_lang)
|
|
573
566
|
this.translate.use(chat_lang);
|
|
574
567
|
}
|
|
575
568
|
else {
|
|
576
|
-
this.logger.log('[APP-COMP] tranlatedLanguage includes',chat_lang
|
|
569
|
+
this.logger.log('[APP-COMP] tranlatedLanguage includes', chat_lang, ': ', tranlatedLanguage.includes(chat_lang))
|
|
577
570
|
this.translate.setDefaultLang('en');
|
|
578
571
|
this.translate.use('en');
|
|
579
572
|
}
|
|
580
573
|
|
|
581
|
-
// this.logger.debug('[APP-COMP] navigator.language: ', navigator.language);
|
|
582
|
-
// let language;
|
|
583
|
-
// if (navigator.language.indexOf('-') !== -1) {
|
|
584
|
-
// language = navigator.language.substring(0, navigator.language.indexOf('-'));
|
|
585
|
-
// } else if (navigator.language.indexOf('_') !== -1) {
|
|
586
|
-
// language = navigator.language.substring(0, navigator.language.indexOf('_'));
|
|
587
|
-
// } else {
|
|
588
|
-
// language = navigator.language;
|
|
589
|
-
// }
|
|
590
|
-
// this.translate.use(language);
|
|
591
574
|
}
|
|
592
575
|
|
|
593
576
|
|
|
@@ -659,6 +642,80 @@ export class AppComponent implements OnInit {
|
|
|
659
642
|
}
|
|
660
643
|
|
|
661
644
|
|
|
645
|
+
updateStoredCurrentUser() {
|
|
646
|
+
const storedCurrentUser = this.appStorageService.getItem('currentUser')
|
|
647
|
+
const storedDshbrdUser = localStorage.getItem('user')
|
|
648
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - stored currentUser', storedCurrentUser)
|
|
649
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - stored dshbrdUser', storedDshbrdUser)
|
|
650
|
+
if ((storedCurrentUser && storedCurrentUser !== 'undefined') && (storedDshbrdUser && storedDshbrdUser !== 'undefined')) {
|
|
651
|
+
const currentUser = JSON.parse(storedCurrentUser);
|
|
652
|
+
const dshbrdUser = JSON.parse(storedDshbrdUser);
|
|
653
|
+
if (currentUser && dshbrdUser) {
|
|
654
|
+
if (currentUser.color !== dshbrdUser.fillColour) {
|
|
655
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.color !== dshbrdUser.fillColour')
|
|
656
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.color ', currentUser.color)
|
|
657
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.fillColour ', dshbrdUser.fillColour)
|
|
658
|
+
currentUser.color = dshbrdUser.fillColour;
|
|
659
|
+
} else {
|
|
660
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.color === dshbrdUser.fillColour')
|
|
661
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.color ', currentUser.color)
|
|
662
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.fillColour ', dshbrdUser.fillColour)
|
|
663
|
+
}
|
|
664
|
+
if (currentUser.firstname !== dshbrdUser.firstname) {
|
|
665
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.firstname !== dshbrdUser.firstname')
|
|
666
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.firstname ', currentUser.firstname)
|
|
667
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.firstname ', dshbrdUser.firstname)
|
|
668
|
+
currentUser.firstname = dshbrdUser.firstname;
|
|
669
|
+
} else {
|
|
670
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.firstname === dshbrdUser.firstname')
|
|
671
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.firstname ', currentUser.firstname)
|
|
672
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.firstname ', dshbrdUser.firstname)
|
|
673
|
+
}
|
|
674
|
+
if (currentUser.lastname !== dshbrdUser.lastname) {
|
|
675
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.lastname !== dshbrdUser.lastname')
|
|
676
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.lastname ', currentUser.lastname)
|
|
677
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.lastname ', dshbrdUser.lastname)
|
|
678
|
+
currentUser.lastname = dshbrdUser.lastname;
|
|
679
|
+
} else {
|
|
680
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.lastname === dshbrdUser.lastname')
|
|
681
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.lastname ', currentUser.lastname)
|
|
682
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.lastname ', dshbrdUser.lastname)
|
|
683
|
+
}
|
|
684
|
+
if (currentUser.avatar !== dshbrdUser.fullname_initial) {
|
|
685
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.avatar !== dshbrdUser.fullname_initial')
|
|
686
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.avatar ', currentUser.avatar)
|
|
687
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.fullname_initial ', dshbrdUser.fullname_initial)
|
|
688
|
+
currentUser.avatar = dshbrdUser.fullname_initial
|
|
689
|
+
} else {
|
|
690
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.avatar === dshbrdUser.fullname_initial')
|
|
691
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.avatar ', currentUser.avatar)
|
|
692
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.fullname_initial ', dshbrdUser.fullname_initial)
|
|
693
|
+
}
|
|
694
|
+
let fullname = ""
|
|
695
|
+
if (dshbrdUser.firstname && !dshbrdUser.lastname) {
|
|
696
|
+
fullname = dshbrdUser.firstname
|
|
697
|
+
} else if (dshbrdUser.firstname && dshbrdUser.lastname) {
|
|
698
|
+
fullname = dshbrdUser.firstname + ' ' + dshbrdUser.lastname
|
|
699
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - fullname ', fullname)
|
|
700
|
+
}
|
|
701
|
+
if (fullname !== currentUser.fullname) {
|
|
702
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.fullname !== dshbrdUser.fullname ')
|
|
703
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.fullname ', fullname)
|
|
704
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.fullname ', currentUser.fullname)
|
|
705
|
+
currentUser.fullname = fullname
|
|
706
|
+
} else {
|
|
707
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.fullname === dshbrdUser.fullname ')
|
|
708
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.fullname ', fullname)
|
|
709
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.fullname ', currentUser.fullname)
|
|
710
|
+
}
|
|
711
|
+
this.appStorageService.setItem('currentUser', JSON.stringify(currentUser));
|
|
712
|
+
this.tiledeskAuthService.setCurrentUser(currentUser);
|
|
713
|
+
}
|
|
714
|
+
} else {
|
|
715
|
+
this.logger.error('[APP-COMP] updateStoredCurrentUser - currentuser or dashboarduser not found in storage')
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
|
|
662
719
|
/***************************************************+*/
|
|
663
720
|
/**------- AUTHENTICATION FUNCTIONS --> START <--- +*/
|
|
664
721
|
private initAuthentication() {
|
|
@@ -672,6 +729,9 @@ export class AppComponent implements OnInit {
|
|
|
672
729
|
this.logger.log('[APP-COMP] >>> initAuthentication I LOG IN WITH A TOKEN EXISTING IN THE LOCAL STORAGE OR WITH A TOKEN PASSED IN THE URL PARAMETERS <<<')
|
|
673
730
|
this.tiledeskAuthService.signInWithCustomToken(tiledeskToken).then(user => {
|
|
674
731
|
this.logger.log('[APP-COMP] >>> initAuthentication user ', user)
|
|
732
|
+
|
|
733
|
+
this.updateStoredCurrentUser()
|
|
734
|
+
|
|
675
735
|
this.messagingAuthService.createCustomToken(tiledeskToken)
|
|
676
736
|
}).catch(error => {
|
|
677
737
|
this.logger.error('[APP-COMP] initAuthentication SIGNINWITHCUSTOMTOKEN error::', error)
|
|
@@ -701,24 +761,7 @@ export class AppComponent implements OnInit {
|
|
|
701
761
|
/**------- AUTHENTICATION FUNCTIONS --> END <--- +*/
|
|
702
762
|
/***************************************************+*/
|
|
703
763
|
|
|
704
|
-
|
|
705
|
-
|
|
706
764
|
checkPlatform() {
|
|
707
|
-
// console.log('[APP-COMP] checkPlatform');
|
|
708
|
-
// let pageUrl = '';
|
|
709
|
-
// try {
|
|
710
|
-
// const pathPage = this.route.snapshot.firstChild.routeConfig.path;
|
|
711
|
-
// this.route.snapshot.firstChild.url.forEach(element => {
|
|
712
|
-
// pageUrl += '/' + element.path;
|
|
713
|
-
// });
|
|
714
|
-
// } catch (error) {
|
|
715
|
-
// this.logger.debug('error', error);
|
|
716
|
-
// }
|
|
717
|
-
// this.logger.debug('checkPlatform pathPage: ', pageUrl);
|
|
718
|
-
// if (!pageUrl || pageUrl === '') {
|
|
719
|
-
// pageUrl = '/conversations-list';
|
|
720
|
-
// }
|
|
721
|
-
|
|
722
765
|
if (checkPlatformIsMobile()) {
|
|
723
766
|
this.chatManager.startApp();
|
|
724
767
|
|
|
@@ -780,13 +823,10 @@ export class AppComponent implements OnInit {
|
|
|
780
823
|
}
|
|
781
824
|
|
|
782
825
|
private initAudio() {
|
|
783
|
-
// console.log('HERE IS initAudio ')
|
|
784
826
|
// SET AUDIO
|
|
785
827
|
const href = window.location.href;
|
|
786
828
|
const hrefArray = href.split('/#/');
|
|
787
829
|
const chatBaseUrl = hrefArray[0]
|
|
788
|
-
// console.log('initAudio href', href)
|
|
789
|
-
// console.log('initAudio chatBaseUrl', chatBaseUrl)
|
|
790
830
|
|
|
791
831
|
this.audio = new Audio();
|
|
792
832
|
this.audio.src = chatBaseUrl + URL_SOUND_LIST_CONVERSATION;
|
|
@@ -796,7 +836,6 @@ export class AppComponent implements OnInit {
|
|
|
796
836
|
private manageTabNotification() {
|
|
797
837
|
if (!this.isTabVisible) {
|
|
798
838
|
// TAB IS HIDDEN --> manage title and SOUND
|
|
799
|
-
// console.log('HERE IS manageTabNotification ')
|
|
800
839
|
let badgeNewConverstionNumber = this.conversationsHandlerService.countIsNew()
|
|
801
840
|
badgeNewConverstionNumber > 0 ? badgeNewConverstionNumber : badgeNewConverstionNumber = 1
|
|
802
841
|
document.title = "(" + badgeNewConverstionNumber + ") " + this.tabTitle
|
|
@@ -815,7 +854,6 @@ export class AppComponent implements OnInit {
|
|
|
815
854
|
}
|
|
816
855
|
|
|
817
856
|
soundMessage() {
|
|
818
|
-
// console.log('HERE IS soundMessage ')
|
|
819
857
|
const that = this;
|
|
820
858
|
// this.audio = new Audio();
|
|
821
859
|
// // this.audio.src = '/assets/sounds/pling.mp3';
|
|
@@ -851,11 +889,7 @@ export class AppComponent implements OnInit {
|
|
|
851
889
|
return;
|
|
852
890
|
}
|
|
853
891
|
|
|
854
|
-
this.BSAuthStateChangedSubscriptionRef = this.messagingAuthService.BSAuthStateChanged
|
|
855
|
-
|
|
856
|
-
// .pipe(takeUntil(this.unsubscribe$))
|
|
857
|
-
.pipe(filter((state) => state !== null))
|
|
858
|
-
.subscribe((state: any) => {
|
|
892
|
+
this.BSAuthStateChangedSubscriptionRef = this.messagingAuthService.BSAuthStateChanged.pipe(filter((state) => state !== null)).subscribe((state: any) => {
|
|
859
893
|
this.logger.log('initialize FROM [APP-COMP] - [APP-COMP] ***** BSAuthStateChanged state', state);
|
|
860
894
|
|
|
861
895
|
if (state && state === AUTH_STATE_ONLINE) {
|
|
@@ -884,24 +918,24 @@ export class AppComponent implements OnInit {
|
|
|
884
918
|
|
|
885
919
|
|
|
886
920
|
this.conversationsHandlerService.conversationAdded.subscribe((conversation: ConversationModel) => {
|
|
887
|
-
|
|
921
|
+
this.logger.log('[APP-COMP] ***** conversationsAdded *****', conversation);
|
|
888
922
|
// that.conversationsChanged(conversations);
|
|
889
923
|
if (conversation && conversation.is_new === true) {
|
|
890
924
|
this.manageTabNotification()
|
|
925
|
+
this.updateConversationsOnStorage()
|
|
891
926
|
}
|
|
892
927
|
});
|
|
893
928
|
|
|
894
929
|
this.conversationsHandlerService.conversationChanged.subscribe((conversation: ConversationModel) => {
|
|
895
|
-
|
|
896
930
|
// console.log('[APP-COMP] ***** subscribeConversationChanged conversation: ', conversation);
|
|
897
|
-
|
|
898
|
-
this.
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
this.logger.log('[APP-COMP] ***** subscribeConversationChanged current_user uid: ', currentUser.uid);
|
|
931
|
+
if(conversation) this.updateConversationsOnStorage();
|
|
932
|
+
const currentUser = this.tiledeskAuthService.getCurrentUser()
|
|
933
|
+
if (currentUser && currentUser !== null) {
|
|
934
|
+
this.logger.log('[APP-COMP] ***** subscribeConversationChanged currentUser: ', currentUser);
|
|
902
935
|
if (conversation && conversation.sender !== currentUser.uid) {
|
|
903
936
|
this.manageTabNotification();
|
|
904
937
|
}
|
|
938
|
+
|
|
905
939
|
}
|
|
906
940
|
});
|
|
907
941
|
}
|
|
@@ -964,9 +998,8 @@ export class AppComponent implements OnInit {
|
|
|
964
998
|
|
|
965
999
|
goOffLine = () => {
|
|
966
1000
|
this.logger.log('[APP-COMP] - GO-OFFLINE');
|
|
967
|
-
|
|
968
|
-
this.
|
|
969
|
-
if (supportmode === true) {
|
|
1001
|
+
this.logger.log('[APP-COMP] - GO-OFFINE - supportmode ', this.SUPPORT_MODE);
|
|
1002
|
+
if (this.SUPPORT_MODE === true) {
|
|
970
1003
|
this.webSocketClose()
|
|
971
1004
|
}
|
|
972
1005
|
// this.isOnline = false;
|
|
@@ -1007,7 +1040,7 @@ export class AppComponent implements OnInit {
|
|
|
1007
1040
|
let platformIsNow = PLATFORM_DESKTOP;
|
|
1008
1041
|
if (checkPlatformIsMobile()) {
|
|
1009
1042
|
platformIsNow = PLATFORM_MOBILE;
|
|
1010
|
-
this.logger.log('onResize platformIsNow ', platformIsNow)
|
|
1043
|
+
this.logger.log('onResize platformIsNow ', platformIsNow)
|
|
1011
1044
|
}
|
|
1012
1045
|
if (!this.platformIs || this.platformIs === '') {
|
|
1013
1046
|
this.platformIs = platformIsNow;
|
|
@@ -1049,6 +1082,7 @@ export class AppComponent implements OnInit {
|
|
|
1049
1082
|
|
|
1050
1083
|
|
|
1051
1084
|
if (hasClickedLogout === true) {
|
|
1085
|
+
this.appStorageService.removeItem('conversations')
|
|
1052
1086
|
// ----------------------------------------------
|
|
1053
1087
|
// PUSH NOTIFICATIONS
|
|
1054
1088
|
// ----------------------------------------------
|
|
@@ -1155,14 +1189,13 @@ export class AppComponent implements OnInit {
|
|
|
1155
1189
|
this.logger.log('[APP-COMP] initConversationsHandler ------------->', userId, this.tenant);
|
|
1156
1190
|
// 1 - init chatConversationsHandler and archviedConversationsHandler
|
|
1157
1191
|
this.conversationsHandlerService.initialize(this.tenant, userId, translationMap);
|
|
1158
|
-
|
|
1159
1192
|
// this.subscribeToConvs()
|
|
1160
|
-
this.
|
|
1161
|
-
|
|
1162
|
-
|
|
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')
|
|
1163
1197
|
const conversations = this.conversationsHandlerService.conversations;
|
|
1164
1198
|
this.logger.info('initialize FROM [APP-COMP] - [APP-COMP]-CONVS - INIT CONV CONVS', conversations)
|
|
1165
|
-
|
|
1166
1199
|
// this.logger.printDebug('SubscribeToConversations (convs-list-page) - conversations')
|
|
1167
1200
|
if (!conversations || conversations.length === 0) {
|
|
1168
1201
|
// that.showPlaceholder = true;
|
|
@@ -1173,6 +1206,31 @@ export class AppComponent implements OnInit {
|
|
|
1173
1206
|
|
|
1174
1207
|
}
|
|
1175
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
|
+
|
|
1176
1234
|
private initArchivedConversationsHandler(userId: string) {
|
|
1177
1235
|
const keys = ['YOU'];
|
|
1178
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
|
}),
|
package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.html
CHANGED
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
<!--backgroundColor non viene ancora usato -->
|
|
29
29
|
<tiledeskwidget-bubble-message class="messages msg_sent slide-in-right"
|
|
30
30
|
[ngClass]="{'button-in-msg' : message?.metadata && message?.metadata?.button}"
|
|
31
|
+
[class.chat-text-emoticon]="isEmojii(message?.text)"
|
|
31
32
|
[message]="message"
|
|
32
33
|
[textColor]="'col-msg-sent'"
|
|
33
34
|
(onBeforeMessageRender)="returnOnBeforeMessageRender($event)"
|
|
@@ -54,6 +55,7 @@
|
|
|
54
55
|
|
|
55
56
|
<!--backgroundColor non viene ancora usato -->
|
|
56
57
|
<tiledeskwidget-bubble-message class="messages msg_receive slide-in-left"
|
|
58
|
+
[class.chat-text-emoticon]="isEmojii(message?.text)"
|
|
57
59
|
[message]="message"
|
|
58
60
|
[textColor]="'black'"
|
|
59
61
|
(onBeforeMessageRender)="returnOnBeforeMessageRender($event)"
|
package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { MSG_STATUS_SENT, MSG_STATUS_RETURN_RECEIPT, MSG_STATUS_SENT_SERVER, MAX
|
|
|
5
5
|
import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
|
|
6
6
|
import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
|
|
7
7
|
import { UploadService } from 'src/chat21-core/providers/abstract/upload.service';
|
|
8
|
-
import { isInfo, isMine, messageType } from 'src/chat21-core/utils/utils-message';
|
|
8
|
+
import { isEmojii, isInfo, isMine, messageType } from 'src/chat21-core/utils/utils-message';
|
|
9
9
|
@Component({
|
|
10
10
|
selector: 'tiledeskwidget-conversation-content',
|
|
11
11
|
templateUrl: './conversation-content.component.html',
|
|
@@ -49,6 +49,7 @@ export class ConversationContentComponent implements OnInit {
|
|
|
49
49
|
isMine = isMine;
|
|
50
50
|
isInfo = isInfo;
|
|
51
51
|
messageType = messageType;
|
|
52
|
+
isEmojii = isEmojii;
|
|
52
53
|
|
|
53
54
|
MESSAGE_TYPE_INFO = MESSAGE_TYPE_INFO;
|
|
54
55
|
MESSAGE_TYPE_MINE = MESSAGE_TYPE_MINE;
|
|
@@ -68,9 +68,9 @@
|
|
|
68
68
|
</div>
|
|
69
69
|
</ng-container>
|
|
70
70
|
|
|
71
|
-
<div class="align-center
|
|
72
|
-
class="
|
|
73
|
-
|
|
71
|
+
<div class="align-center ion-text-center msg_info_container" *ngIf="messageType(MESSAGE_TYPE_INFO, message)">
|
|
72
|
+
<chat-info-message class="messages"
|
|
73
|
+
[message]="message">
|
|
74
74
|
</chat-info-message>
|
|
75
75
|
</div>
|
|
76
76
|
|
|
@@ -78,19 +78,25 @@
|
|
|
78
78
|
<div role="messaggio" *ngIf="messageType(MESSAGE_TYPE_MINE, message)" class="msg_container base_sent">
|
|
79
79
|
|
|
80
80
|
<!--backgroundColor non viene ancora usato -->
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
[
|
|
84
|
-
|
|
85
|
-
[message]="message"
|
|
86
|
-
|
|
87
|
-
[addAsCannedResponseTooltipText]="addAsCannedResponseTooltipText"
|
|
88
|
-
[
|
|
89
|
-
[
|
|
81
|
+
<chat-bubble-message class="messages msg_sent" id="message_msg_sent" style="position: relative;"
|
|
82
|
+
[ngClass]="{'has-metadata': (isImage(message) || isFrame(message)), 'privateMsg': (message?.attributes && message?.attributes?.subtype === 'private')}"
|
|
83
|
+
[class.emoticon]="isEmojii(message?.text)"
|
|
84
|
+
[ngClass]="{'button-in-msg' : message.metadata && message.metadata.button}"
|
|
85
|
+
[message]="message"
|
|
86
|
+
[textColor]="'col-msg-sent'"
|
|
87
|
+
[addAsCannedResponseTooltipText]="addAsCannedResponseTooltipText"
|
|
88
|
+
[areVisibleCAR]="areVisibleCAR"
|
|
89
|
+
[supportMode]="supportMode"
|
|
90
|
+
(onBeforeMessageRender)="returnOnBeforeMessageRender($event)"
|
|
91
|
+
(onAfterMessageRender)="returnOnAfterMessageRender($event)"
|
|
92
|
+
(onImageRendered)="onImageRenderedFN($event)">
|
|
90
93
|
</chat-bubble-message>
|
|
91
94
|
|
|
92
95
|
<!-- icon status message -->
|
|
93
|
-
<chat-return-receipt
|
|
96
|
+
<chat-return-receipt
|
|
97
|
+
[status]="message.status"
|
|
98
|
+
[message]="message"
|
|
99
|
+
[senderId]="senderId">
|
|
94
100
|
</chat-return-receipt>
|
|
95
101
|
|
|
96
102
|
</div>
|
|
@@ -112,21 +118,27 @@
|
|
|
112
118
|
|
|
113
119
|
<!--backgroundColor non viene ancora usato -->
|
|
114
120
|
|
|
115
|
-
<chat-bubble-message style="position: relative;"
|
|
116
|
-
[ngClass]="{'has-metadata': (isImage(message) || isFrame(message))}"
|
|
117
|
-
|
|
121
|
+
<chat-bubble-message class="messages msg_receive" id="message_msg_receive" style="position: relative;"
|
|
122
|
+
[ngClass]="{'has-metadata': (isImage(message) || isFrame(message))}"
|
|
123
|
+
[class.emoticon]="isEmojii(message?.text)"
|
|
124
|
+
[message]="message"
|
|
125
|
+
[textColor]="'black'"
|
|
126
|
+
[addAsCannedResponseTooltipText]="addAsCannedResponseTooltipText"
|
|
127
|
+
[areVisibleCAR]="areVisibleCAR"
|
|
128
|
+
[supportMode]="supportMode"
|
|
118
129
|
(onBeforeMessageRender)="returnOnBeforeMessageRender($event)"
|
|
119
|
-
(onAfterMessageRender)="returnOnAfterMessageRender($event)"
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
[class.emoticon]="message?.emoticon">
|
|
130
|
+
(onAfterMessageRender)="returnOnAfterMessageRender($event)"
|
|
131
|
+
(onImageRendered)="onImageRenderedFN($event)"
|
|
132
|
+
>
|
|
123
133
|
</chat-bubble-message>
|
|
124
134
|
</div>
|
|
125
135
|
|
|
126
136
|
<!-- message type:: button && -->
|
|
127
137
|
<div *ngIf="message?.attributes && message?.attributes?.attachment " class="slide-in-left">
|
|
128
|
-
<chat-message-attachment style="height: 100%; display: block;"
|
|
129
|
-
[
|
|
138
|
+
<chat-message-attachment style="height: 100%; display: block;"
|
|
139
|
+
[message]="message"
|
|
140
|
+
[isLastMessage]="isLastMessage(message?.uid)"
|
|
141
|
+
[stylesMap]="stylesMap"
|
|
130
142
|
(onAttachmentButtonClicked)="returnOnAttachmentButtonClicked($event)">
|
|
131
143
|
</chat-message-attachment>
|
|
132
144
|
</div>
|