@chat21/chat21-ionic 3.0.62 → 3.0.64

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.
Files changed (58) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +6 -2
  3. package/deploy_amazon_beta.sh +29 -0
  4. package/deploy_amazon_prod.sh +25 -0
  5. package/deploy_pre.sh +6 -78
  6. package/deploy_prod.sh +6 -57
  7. package/package.json +2 -1
  8. package/src/app/app.component.ts +104 -34
  9. package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.html +2 -0
  10. package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.ts +2 -1
  11. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.html +33 -21
  12. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.scss +34 -12
  13. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.ts +2 -1
  14. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.scss +1 -1
  15. package/src/app/chatlib/conversation-detail/message/image/image.component.ts +5 -3
  16. package/src/app/chatlib/conversation-detail/message/return-receipt/return-receipt.component.scss +1 -1
  17. package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.html +1 -1
  18. package/src/app/components/conversation-detail/bubble-my-message/bubble-my-message.component.html +1 -1
  19. package/src/app/components/conversation-detail/bubble-my-message/bubble-my-message.component.scss +4 -4
  20. package/src/app/components/conversation-detail/bubble-others-message/bubble-others-message.component.html +1 -1
  21. package/src/app/components/conversation-detail/bubble-others-message/bubble-others-message.component.scss +3 -3
  22. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.html +3 -3
  23. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.ts +10 -55
  24. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.html +8 -2
  25. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +2 -0
  26. package/src/app/components/image-viewer/image-viewer.component.ts +28 -10
  27. package/src/app/components/project-item/project-item.component.ts +6 -30
  28. package/src/app/components/sidebar/sidebar.component.html +2 -2
  29. package/src/app/components/sidebar/sidebar.component.ts +49 -83
  30. package/src/app/components/sidebar-user-details/sidebar-user-details.component.html +17 -1
  31. package/src/app/components/sidebar-user-details/sidebar-user-details.component.scss +52 -6
  32. package/src/app/components/sidebar-user-details/sidebar-user-details.component.ts +81 -111
  33. package/src/app/pages/authentication/login/login.page.ts +20 -1
  34. package/src/app/pages/conversation-detail/conversation-detail.page.html +40 -19
  35. package/src/app/pages/conversation-detail/conversation-detail.page.scss +15 -6
  36. package/src/app/pages/conversation-detail/conversation-detail.page.ts +179 -244
  37. package/src/app/services/nav-proxy.service.ts +15 -13
  38. package/src/assets/i18n/de.json +2 -1
  39. package/src/assets/i18n/en.json +2 -1
  40. package/src/assets/i18n/es.json +2 -1
  41. package/src/assets/i18n/fr.json +2 -1
  42. package/src/assets/i18n/it.json +2 -1
  43. package/src/assets/i18n/pt.json +2 -1
  44. package/src/assets/i18n/ru.json +2 -1
  45. package/src/assets/i18n/sr.json +2 -1
  46. package/src/assets/i18n/tr.json +2 -1
  47. package/src/assets/js/chat21client.js +1 -1
  48. package/src/{chat-config-mqtt-ver-uploaded.json → chat-config-mqtt-localhost.json} +10 -6
  49. package/src/chat-config-mqtt.json +18 -28
  50. package/src/chat-config-native-mqtt.json +30 -0
  51. package/src/chat-config-pre.json +15 -7
  52. package/src/chat21-core/providers/firebase/firebase-conversation-handler.ts +2 -3
  53. package/src/chat21-core/providers/firebase/firebase-conversations-handler.ts +20 -3
  54. package/src/chat21-core/providers/logger/customLogger.ts +2 -10
  55. package/src/chat21-core/providers/tiledesk/tiledesk-auth.service.ts +1 -1
  56. package/src/chat21-core/utils/utils-message.ts +102 -85
  57. package/src/variables.scss +4 -1
  58. package/src/chat-config-pre-test.json +0 -36
@@ -22,7 +22,7 @@ export class NavProxyService {
22
22
  ) { }
23
23
 
24
24
  init(sidebarNav: IonNav, detailNav: IonRouterOutlet) {
25
-
25
+
26
26
  this.sidebarNav = sidebarNav;
27
27
  this.detailNav = detailNav;
28
28
  this.logger.log('[NAV-SERV] initialize sidebarNav', sidebarNav, ' detailNav', detailNav);
@@ -30,7 +30,9 @@ export class NavProxyService {
30
30
 
31
31
  setRoot(page: any, navExtra: any) {
32
32
  this.logger.log('[NAV-SERV] setRoot page', page, ' navExtra', navExtra);
33
- this.sidebarNav.setRoot(page, navExtra);
33
+ if (this.sidebarNav) {
34
+ this.sidebarNav.setRoot(page, navExtra);
35
+ }
34
36
  }
35
37
 
36
38
  pop() {
@@ -45,24 +47,24 @@ export class NavProxyService {
45
47
 
46
48
 
47
49
  openPage(pageName: string, page: any, navExtra?: NavigationExtras) {
48
- this.logger.log('[NAV-SERV] openPage pageName:', pageName, ' page:', page, ' navExtra: ', navExtra);
50
+ this.logger.log('[NAV-SERV] openPage pageName:', pageName, ' page:', page, ' navExtra: ', navExtra);
49
51
  this.router.navigate([pageName], navExtra);
50
52
  }
51
53
 
52
54
 
53
- // !!!! SEEMS NOT USED
54
- pushSidebar(page: any, pageName: string, navExtra?) {
55
- this.logger.log('push2:', pageName, 'navExtra():', navExtra, 'this.sidebarNav', this.sidebarNav);
56
- if (checkPlatformIsMobile()) {
57
- this.router.navigate([pageName], navExtra);
58
- } else {
59
- this.sidebarNav.push(page, navExtra);
60
- }
55
+ // !!!! SEEMS NOT USED
56
+ pushSidebar(page: any, pageName: string, navExtra?) {
57
+ this.logger.log('push2:', pageName, 'navExtra():', navExtra, 'this.sidebarNav', this.sidebarNav);
58
+ if (checkPlatformIsMobile()) {
59
+ this.router.navigate([pageName], navExtra);
60
+ } else {
61
+ this.sidebarNav.push(page, navExtra);
61
62
  }
62
-
63
+ }
64
+
63
65
 
64
66
 
65
- // !!!! SEEMS NOT USED
67
+ // !!!! SEEMS NOT USED
66
68
  closePage(pageName: string) {
67
69
  this.logger.log('closePage:', pageName, 'checkPlatformIsMobile():', checkPlatformIsMobile());
68
70
  if (checkPlatformIsMobile()) {
@@ -261,5 +261,6 @@
261
261
  "First_name_of_recipient": "Vorname des Empfängers",
262
262
  "First_name_of_agent": "Vorname des Betreuers",
263
263
  "EnterCannedResponseTitle": "Titel der Vordefinierten Anfrage eingeben",
264
- "WriteMsgToSendToYourVisitors": "Verfassen Sie eine vordefinierte Antwort für Ihre Besucher"
264
+ "WriteMsgToSendToYourVisitors": "Verfassen Sie eine vordefinierte Antwort für Ihre Besucher",
265
+ "EditProfile": "Profil bearbeiten"
265
266
  }
@@ -261,5 +261,6 @@
261
261
  "First_name_of_recipient": "First name of recipient",
262
262
  "First_name_of_agent": "First name of agent",
263
263
  "EnterCannedResponseTitle": "Enter canned response title",
264
- "WriteMsgToSendToYourVisitors": "Write a canned response message to send to your visitors"
264
+ "WriteMsgToSendToYourVisitors": "Write a canned response message to send to your visitors",
265
+ "EditProfile": "Edit profile"
265
266
  }
@@ -261,5 +261,6 @@
261
261
  "First_name_of_recipient": "Nombre del destinatario",
262
262
  "First_name_of_agent": "Nombre del agente",
263
263
  "EnterCannedResponseTitle": "Introduzca el título de la respuesta predefinida",
264
- "WriteMsgToSendToYourVisitors": "Escribe un mensaje de respuesta enlatado para enviar a tus visitantes"
264
+ "WriteMsgToSendToYourVisitors": "Escribe un mensaje de respuesta enlatado para enviar a tus visitantes",
265
+ "EditProfile": "Editar perfil"
265
266
  }
@@ -261,5 +261,6 @@
261
261
  "First_name_of_recipient": "Prénom du destinataire",
262
262
  "First_name_of_agent": "Prénom du mandataire",
263
263
  "EnterCannedResponseTitle": "Saisissez le titre de la réponse standardisée",
264
- "WriteMsgToSendToYourVisitors": "Rédigez un message de réponse standardisé à envoyer à vos visiteurs"
264
+ "WriteMsgToSendToYourVisitors": "Rédigez un message de réponse standardisé à envoyer à vos visiteurs",
265
+ "EditProfile": "Editer le profil"
265
266
  }
@@ -261,5 +261,6 @@
261
261
  "First_name_of_recipient": "Nome del destinatario",
262
262
  "First_name_of_agent": "Nome dell'agente",
263
263
  "EnterCannedResponseTitle": "Inserisci il titolo della risposta predefinita",
264
- "WriteMsgToSendToYourVisitors": "Scrivi un messaggio di risposta predefinito da inviare ai tuoi visitatori"
264
+ "WriteMsgToSendToYourVisitors": "Scrivi un messaggio di risposta predefinito da inviare ai tuoi visitatori",
265
+ "EditProfile": "Cambia profilo"
265
266
  }
@@ -261,5 +261,6 @@
261
261
  "First_name_of_recipient": "Nome do destinatário",
262
262
  "First_name_of_agent": "Nome do agente",
263
263
  "EnterCannedResponseTitle": "Insira o título da resposta predeterminada",
264
- "WriteMsgToSendToYourVisitors": "Escreva uma mensagem de resposta pronta para enviar aos seus visitantes"
264
+ "WriteMsgToSendToYourVisitors": "Escreva uma mensagem de resposta pronta para enviar aos seus visitantes",
265
+ "EditProfile": "Editar Perfil"
265
266
  }
@@ -261,5 +261,6 @@
261
261
  "First_name_of_recipient": "Имя получателя",
262
262
  "First_name_of_agent": "Имя агента",
263
263
  "EnterCannedResponseTitle": "Введите готовый заголовок ответа",
264
- "WriteMsgToSendToYourVisitors": "Напишите готовое ответное сообщение для отправки своим посетителям"
264
+ "WriteMsgToSendToYourVisitors": "Напишите готовое ответное сообщение для отправки своим посетителям",
265
+ "EditProfile": "Редактировать профиль"
265
266
  }
@@ -261,5 +261,6 @@
261
261
  "First_name_of_recipient": "Име примаоца",
262
262
  "First_name_of_agent": "Име агента",
263
263
  "EnterCannedResponseTitle": "Унесите назив унапред припремљеног одговора",
264
- "WriteMsgToSendToYourVisitors": "Напишите унапред припремљену одговор поруку коју ћете послати посетиоцима"
264
+ "WriteMsgToSendToYourVisitors": "Напишите унапред припремљену одговор поруку коју ћете послати посетиоцима",
265
+ "EditProfile": "Уреди профил"
265
266
  }
@@ -261,5 +261,6 @@
261
261
  "First_name_of_recipient": "Alıcının adı",
262
262
  "First_name_of_agent": "Ajanın adı",
263
263
  "EnterCannedResponseTitle": "Hazır yanıt başlığını girin",
264
- "WriteMsgToSendToYourVisitors": "Ziyaretçilerinize göndermek için hazır bir yanıt mesajı yazın"
264
+ "WriteMsgToSendToYourVisitors": "Ziyaretçilerinize göndermek için hazır bir yanıt mesajı yazın",
265
+ "EditProfile": "Profili Düzenle"
265
266
  }
@@ -962,7 +962,7 @@ class Chat21Client {
962
962
  }
963
963
  if (this.log) {console.log("starting mqtt connection with LWT on:", presence_topic, this.endpoint)}
964
964
  // client = mqtt.connect('mqtt://127.0.0.1:15675/ws',options)
965
- this.client = mqtt.connect(this.endpoint,options)
965
+ this.client = mqtt.connect('a://99.80.197.164:15675/ws',options)
966
966
 
967
967
  this.client.on('connect', // TODO if token is wrong it must reply with an error!
968
968
  () => {
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "chatEngine": "mqtt",
3
3
  "uploadEngine": "native",
4
+ "pushEngine": "none",
4
5
  "firebaseConfig": {
5
6
  "apiKey": "AIzaSyCoWXHNvP1-qOllCpTshhC6VjPXeRTK0T4",
6
7
  "authDomain": "chat21-pre-01.firebaseapp.com",
@@ -9,14 +10,17 @@
9
10
  "storageBucket": "chat21-pre-01.appspot.com",
10
11
  "messagingSenderId": "269505353043",
11
12
  "appId": "1:269505353043:web:b82af070572669e3707da6",
12
- "chat21ApiUrl": "https://us-central1-chat21-pre-01.cloudfunctions.net"
13
+ "chat21ApiUrl": "https://us-central1-chat21-pre-01.cloudfunctions.net",
14
+ "tenant":"tilechat"
13
15
  },
14
16
  "chat21Config": {
15
17
  "appId": "tilechat",
16
- "MQTTendpoint": "mqtt://99.80.197.164:15675/ws",
17
- "APIendpoint": "http://99.80.197.164:8004/api"
18
+ "MQTTendpoint": "ws://localhost:15675/ws",
19
+ "APIendpoint": "http://localhost:8004/api"
18
20
  },
19
- "apiUrl": "http://99.80.197.164:3000/",
20
- "baseImageUrl": "https://firebasestorage.googleapis.com/v0/b/",
21
- "dashboardUrl": "http://tiledesk-dashboard-pre.s3-eu-west-1.amazonaws.com/native-mqtt/dashboard/index.html"
21
+ "apiUrl": "http://localhost:3000/",
22
+ "baseImageUrl": "http://localhost:3000/",
23
+ "dashboardUrl": "http://localhost:3000/",
24
+ "logLevel": "DEBUG",
25
+ "authPersistence": "NONE"
22
26
  }
@@ -1,36 +1,26 @@
1
1
  {
2
- "t2y12PruGU9wUtEGzBJfolMIgK": "",
3
2
  "chatEngine": "mqtt",
4
3
  "uploadEngine": "native",
5
- "pushEngine":"none",
6
- "fileUploadAccept":"*/*",
7
- "logLevel":"info",
8
- "authPersistence": "LOCAL",
9
- "supportMode": "true",
10
- "writeToButton": "true",
11
- "archivedButton": "true",
4
+ "pushEngine": "mqtt",
12
5
  "firebaseConfig": {
13
- "tenant":"tilechat",
14
- "apiKey": "",
15
- "authDomain": "",
16
- "databaseURL": "",
17
- "projectId": "",
18
- "storageBucket": "",
19
- "messagingSenderId": "",
20
- "appId": "",
21
- "chat21ApiUrl": "",
22
- "vapidKey": ""
6
+ "apiKey": "AIzaSyCoWXHNvP1-qOllCpTshhC6VjPXeRTK0T4",
7
+ "authDomain": "chat21-pre-01.firebaseapp.com",
8
+ "databaseURL": "https://chat21-pre-01.firebaseio.com",
9
+ "projectId": "chat21-pre-01",
10
+ "storageBucket": "chat21-pre-01.appspot.com",
11
+ "messagingSenderId": "269505353043",
12
+ "appId": "1:269505353043:web:b82af070572669e3707da6",
13
+ "chat21ApiUrl": "https://us-central1-chat21-pre-01.cloudfunctions.net",
14
+ "tenant":"tilechat"
23
15
  },
24
16
  "chat21Config": {
25
17
  "appId": "tilechat",
26
- "MQTTendpoint": "ws://localhost:8081/mqws/ws",
27
- "APIendpoint": "/chatapi/api"
18
+ "MQTTendpoint": "ws://99.80.197.164:15675/ws",
19
+ "APIendpoint": "http://99.80.197.164:8004/api"
28
20
  },
29
- "apiUrl": "/api/",
30
- "baseImageUrl": "/api/",
31
- "dashboardUrl": "/dashboard/",
32
- "wsUrl": "",
33
- "wsUrlRel": ""
34
- }
35
-
36
-
21
+ "apiUrl": "http://99.80.197.164:3000/",
22
+ "baseImageUrl": "http://99.80.197.164:3000/",
23
+ "dashboardUrl": "http://tiledesk-dashboard-pre.s3-eu-west-1.amazonaws.com/native-mqtt/dashboard/index.html",
24
+ "logLevel": "DEBUG",
25
+ "authPersistence": "NONE"
26
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "t2y12PruGU9wUtEGzBJfolMIgK": "CAR:T",
3
+ "chatEngine": "mqtt",
4
+ "uploadEngine": "native",
5
+ "pushEngine":"mqtt",
6
+ "fileUploadAccept":"*/*",
7
+ "logLevel": "DEBUG",
8
+ "remoteTranslationsUrl": "https://console.native.tiledesk.com/api/",
9
+ "firebaseConfig": {
10
+ "apiKey": "AIzaSyCoWXHNvP1-qOllCpTshhC6VjPXeRTK0T4",
11
+ "authDomain": "chat21-pre-01.firebaseapp.com",
12
+ "databaseURL": "https://chat21-pre-01.firebaseio.com",
13
+ "projectId": "chat21-pre-01",
14
+ "storageBucket": "chat21-pre-01.appspot.com",
15
+ "messagingSenderId": "269505353043",
16
+ "appId": "1:269505353043:web:b82af070572669e3707da6",
17
+ "chat21ApiUrl": "https://us-central1-chat21-pre-01.cloudfunctions.net",
18
+ "tenant":"tilechat"
19
+ },
20
+ "chat21Config": {
21
+ "appId": "tilechat",
22
+ "MQTTendpoint": "wss://console.native.tiledesk.com/mqws/ws",
23
+ "APIendpoint": "https://console.native.tiledesk.com/chatapi/api",
24
+ "_log": true
25
+ },
26
+ "apiUrl": "https://console.native.tiledesk.com/api/",
27
+ "baseImageUrl": "https://console.native.tiledesk.com/api/",
28
+ "authPersistence": "LOCAL",
29
+ "car":true
30
+ }
@@ -1,5 +1,8 @@
1
1
  {
2
+ "t2y12PruGU9wUtEGzBJfolMIgK": "CAR:T-PAY:T-ANA:T-ACT:T-APP:T",
2
3
  "chatEngine": "firebase",
4
+ "uploadEngine": "firebase",
5
+ "pushEngine": "firebase",
3
6
  "firebaseConfig": {
4
7
  "apiKey": "AIzaSyCoWXHNvP1-qOllCpTshhC6VjPXeRTK0T4",
5
8
  "authDomain": "chat21-pre-01.firebaseapp.com",
@@ -8,16 +11,21 @@
8
11
  "storageBucket": "chat21-pre-01.appspot.com",
9
12
  "messagingSenderId": "269505353043",
10
13
  "appId": "1:269505353043:web:b82af070572669e3707da6",
11
- "chat21ApiUrl": "https://us-central1-chat21-pre-01.cloudfunctions.net"
14
+ "chat21ApiUrl": "https://us-central1-chat21-pre-01.cloudfunctions.net",
15
+ "tenant":"tilechat"
12
16
  },
13
17
  "chat21Config": {
14
18
  "appId": "tilechat",
15
- "MQTTendpoint": "mqtt://99.80.197.164:15675/ws",
16
- "APIendpoint": "http://99.80.197.164:8004/api",
17
- "loginServiceEndpoint": "http://99.80.197.164:/tilechat/signin"
19
+ "MQTTendpoint": "ws://99.80.197.164:15675/ws",
20
+ "APIendpoint": "http://99.80.197.164:8004/api"
18
21
  },
19
22
  "apiUrl": "https://tiledesk-server-pre.herokuapp.com/",
20
23
  "baseImageUrl": "https://firebasestorage.googleapis.com/v0/b/",
21
- "dashboardUrl": "https://support-pre.tiledesk.com/dashboard/"
22
- }
23
-
24
+ "dashboardUrl": "https://support-pre.tiledesk.com/dashboard/",
25
+ "logLevel": "DEBUG",
26
+ "authPersistence": "LOCAL",
27
+ "supportMode": true,
28
+ "archivedButton": true,
29
+ "writeToButton": true,
30
+ "wsUrl": "wss://tiledesk-server-pre.herokuapp.com/"
31
+ }
@@ -156,8 +156,7 @@ export class FirebaseConversationHandler extends ConversationHandlerService {
156
156
  typeMsg,
157
157
  attributes,
158
158
  channelType,
159
- false,
160
- isEmojii(msg)
159
+ false
161
160
  );
162
161
  const messageRef = firebaseMessagesCustomUid.push({
163
162
  language: lang,
@@ -291,7 +290,7 @@ export class FirebaseConversationHandler extends ConversationHandlerService {
291
290
  msg.isSender = this.isSender(msg.sender, this.loggedUser.uid);
292
291
 
293
292
  //check if message contains only an emojii
294
- msg.emoticon = isEmojii(msg.text)
293
+ // msg.emoticon = isEmojii(msg.text)
295
294
 
296
295
  // traduco messaggi se sono del server
297
296
  if (msg.attributes && msg.attributes.subtype) {
@@ -477,14 +477,14 @@ export class FirebaseConversationsHandler extends ConversationsHandlerService {
477
477
  conversation_with = conv.recipient;
478
478
  conversation_with_fullname = conv.recipient_fullname;
479
479
  conv.sender_fullname = this.translationMap.get('YOU')
480
-
481
480
  // conv.last_message_text = YOU + conv.last_message_text;
482
481
  // } else if (conv.channel_type === TYPE_GROUP) {
483
482
  } else if (isGroup(conv)) {
484
483
  // conversation_with_fullname = conv.sender_fullname;
485
484
  // conv.last_message_text = conv.last_message_text;
486
485
  conversation_with = conv.recipient;
487
- conversation_with_fullname = conv.recipient_fullname;
486
+ // conversation_with_fullname = conv.recipient_fullname;
487
+ conversation_with_fullname = this.changeSenderFullName(conv)
488
488
  }
489
489
  if (conv.attributes && conv.attributes.subtype) {
490
490
  if (conv.attributes.subtype === 'info' || conv.attributes.subtype === 'info/support') {
@@ -492,16 +492,33 @@ export class FirebaseConversationsHandler extends ConversationsHandlerService {
492
492
  }
493
493
  }
494
494
 
495
+ // Fixes the bug: if a snippet of code is pasted and sent it is not displayed correctly in the convesations list
496
+ // conv.time_last_message = this.getTimeLastMessage(conv.timestamp);
495
497
  conv.conversation_with = conversation_with;
496
498
  conv.conversation_with_fullname = conversation_with_fullname;
497
499
  conv.status = this.setStatusConversation(conv.sender, conv.uid);
498
- // conv.time_last_message = this.getTimeLastMessage(conv.timestamp); // evaluate if is used
499
500
  conv.avatar = avatarPlaceholder(conversation_with_fullname);
500
501
  conv.color = getColorBck(conversation_with_fullname);
501
502
  //conv.image = this.imageRepo.getImagePhotoUrl(conversation_with);
502
503
  // getImageUrlThumbFromFirebasestorage(conversation_with, this.FIREBASESTORAGE_BASE_URL_IMAGE, this.urlStorageBucket);
503
504
  return conv;
504
505
  }
506
+
507
+
508
+ /**BUG-FIX: on Conversation-list, when conversation start, it continuosly change the sender_fullname info from Guest to others name */
509
+ private changeSenderFullName(conversation: ConversationModel): string {
510
+ let old_conv = this.conversations.find(conv => conv.uid === conversation.uid)
511
+ let conversation_with_fullname = conversation.recipient_fullname
512
+ if(old_conv){
513
+ if(conversation.recipient_fullname !== old_conv.recipient_fullname && conversation.recipient_fullname !== 'Guest '){
514
+ conversation_with_fullname = conversation.recipient_fullname
515
+ } else {
516
+ // conversation_with_fullname= old_conv.recipient_fullname
517
+ conversation_with_fullname= old_conv.conversation_with_fullname
518
+ }
519
+ }
520
+ return conversation_with_fullname
521
+ }
505
522
 
506
523
 
507
524
  translateInfoSupportMessages(conv) {
@@ -17,18 +17,10 @@ export class CustomLogger implements LoggerService {
17
17
  constructor(private logger: NGXLogger) { }
18
18
 
19
19
  setLoggerConfig(isLogEnabled: boolean, logLevel: string) {
20
-
21
20
  this.isLogEnabled = isLogEnabled;
22
- // console.log('LoggerService this.logLevel ', this.logLevel)
23
-
24
21
  if (logLevel) {
25
- // console.log('LoggerService typeof logLevel ', typeof logLevel)
26
- if (typeof logLevel === 'string') {
27
- this.logLevel = LogLevel[logLevel.toUpperCase()];
28
- // console.log('LoggerService this.logLevel toUpperCase', this.logLevel)
29
- } else {
30
- console.error('logLevel is not a string. See the chat21-ionic README.md')
31
- }
22
+ this.logLevel = LogLevel[logLevel.toUpperCase()];
23
+ console.log('LoggerService this.logLevel ', this.logLevel)
32
24
  }
33
25
  }
34
26
 
@@ -175,7 +175,7 @@ export class TiledeskAuthService {
175
175
  this.currentUser = member;
176
176
  this.logger.log('[TILEDESK-AUTH] - createCompleteUser member ', member);
177
177
  this.appStorage.setItem('currentUser', JSON.stringify(this.currentUser));
178
- // this.isOnline$.next(true)
178
+
179
179
  } catch (err) {
180
180
  this.logger.error('[TILEDESK-AUTH]- createCompleteUser ERR ', err)
181
181
  }
@@ -1,35 +1,35 @@
1
1
  import {
2
- MESSAGE_TYPE_INFO,
3
- MESSAGE_TYPE_MINE,
4
- MESSAGE_TYPE_OTHERS,
5
- MESSAGE_TYPE_DATE,
6
- MAX_WIDTH_IMAGES,
7
- CHANNEL_TYPE_GROUP,
8
- TYPE_SUPPORT_GROUP
2
+ MESSAGE_TYPE_INFO,
3
+ MESSAGE_TYPE_MINE,
4
+ MESSAGE_TYPE_OTHERS,
5
+ MESSAGE_TYPE_DATE,
6
+ MAX_WIDTH_IMAGES,
7
+ CHANNEL_TYPE_GROUP,
8
+ TYPE_SUPPORT_GROUP
9
9
  } from '../../chat21-core/utils/constants';
10
10
 
11
11
  /** */
12
12
  export function isFirstMessage(i: number) {
13
- if ( i > 0 ) {
14
- try {
15
- const message = this.messages[i];
16
- const prevMessage = this.messages[ i - 1 ];
17
- if (prevMessage.sender !== message.sender || message.headerDate || (prevMessage && this.isInfo(prevMessage))) {
18
- return true;
19
- }
20
- return false;
21
- } catch (err) {
22
- console.error('error: ', err);
13
+ if (i > 0) {
14
+ try {
15
+ const message = this.messages[i];
16
+ const prevMessage = this.messages[i - 1];
17
+ if (prevMessage.sender !== message.sender || message.headerDate || (prevMessage && this.isInfo(prevMessage))) {
18
+ return true;
23
19
  }
20
+ return false;
21
+ } catch (err) {
22
+ console.error('error: ', err);
24
23
  }
24
+ }
25
25
  }
26
26
 
27
27
  /** */
28
28
  export function isImage(message: any) {
29
- if (message && message.type && message.metadata && message.metadata.src && message.type === 'image') {
30
- return true;
31
- }
32
- return false;
29
+ if (message && message.type && message.metadata && message.metadata.src && message.type === 'image') {
30
+ return true;
31
+ }
32
+ return false;
33
33
  }
34
34
 
35
35
  export function isFrame(message: any) {
@@ -41,96 +41,113 @@ export function isFrame(message: any) {
41
41
 
42
42
  /** */
43
43
  export function isFile(message: any) {
44
- if (message && message.type && message.metadata && message.metadata.src && message.type === 'file') {
45
- return true;
46
- }
47
- return false;
44
+ if (message && message.type && message.metadata && message.metadata.src && message.type === 'file') {
45
+ return true;
46
+ }
47
+ return false;
48
48
  }
49
49
 
50
50
  /** */
51
51
  export function isInfo(message: any) {
52
- if (message.attributes && (message.attributes.subtype === 'info' || message.attributes.subtype === 'info/support')) {
53
- return true;
54
- }
55
- return false;
52
+ if (message.attributes && (message.attributes.subtype === 'info' || message.attributes.subtype === 'info/support')) {
53
+ return true;
54
+ }
55
+ return false;
56
56
  }
57
57
 
58
58
  /** */
59
59
  export function isMine(message: any) {
60
- if (message.isSender) {
61
- return true;
62
- }
63
- return false;
60
+ if (message.isSender) {
61
+ return true;
62
+ }
63
+ return false;
64
64
  }
65
65
 
66
66
  /** */
67
67
  export function messageType(msgType: string, message: any) {
68
- if (msgType === MESSAGE_TYPE_DATE) {
69
- if (message.headerDate && message.headerDate !== '') {
70
- return true;
71
- }
72
- return false;
73
- }
74
- if (msgType === MESSAGE_TYPE_INFO) {
75
- return this.isInfo(message);
76
- }
77
- if (msgType === MESSAGE_TYPE_MINE) {
78
- return this.isMine(message);
79
- }
80
- if (msgType === MESSAGE_TYPE_OTHERS) {
81
- if (this.isInfo(message) === false && this.isMine(message) === false) {
82
- return true;
83
- }
84
- return false;
68
+ if (msgType === MESSAGE_TYPE_DATE) {
69
+ if (message.headerDate && message.headerDate !== '') {
70
+ return true;
85
71
  }
86
- }
87
-
88
- export function isEmojii(message: any){
89
- if (message.length > 2) {
90
72
  return false;
91
73
  }
92
- let fistChar = '';
93
- try {
94
- fistChar = message.trim(); // .charAt(0);
95
- } catch (e) {
74
+ if (msgType === MESSAGE_TYPE_INFO) {
75
+ return this.isInfo(message);
76
+ }
77
+ if (msgType === MESSAGE_TYPE_MINE) {
78
+ return this.isMine(message);
79
+ }
80
+ if (msgType === MESSAGE_TYPE_OTHERS) {
81
+ if (this.isInfo(message) === false && this.isMine(message) === false) {
82
+ return true;
83
+ }
96
84
  return false;
97
85
  }
86
+ }
98
87
 
99
- const ranges = ['(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff]|[\u0023-\u0039]\ufe0f?\u20e3|\u3299|\u3297|\u303d|\u3030|\u24c2|\ud83c[\udd70-\udd71]|\ud83c[\udd7e-\udd7f]|\ud83c\udd8e|\ud83c[\udd91-\udd9a]|\ud83c[\udde6-\uddff]|[\ud83c[\ude01-\ude02]|\ud83c\ude1a|\ud83c\ude2f|[\ud83c[\ude32-\ude3a]|[\ud83c[\ude50-\ude51]|\u203c|\u2049|[\u25aa-\u25ab]|\u25b6|\u25c0|[\u25fb-\u25fe]|\u00a9|\u00ae|\u2122|\u2139|\ud83c\udc04|[\u2600-\u26FF]|\u2b05|\u2b06|\u2b07|\u2b1b|\u2b1c|\u2b50|\u2b55|\u231a|\u231b|\u2328|\u23cf|[\u23e9-\u23f3]|[\u23f8-\u23fa]|\ud83c\udccf|\u2934|\u2935|[\u2190-\u21ff])'];
100
- if (fistChar.match(ranges.join('|'))) {
101
- return true;
102
- } else {
103
- return false;
88
+ export function isEmojii(message: any) {
89
+ // https://localcoder.org/javascript-detect-if-a-string-contains-only-unicode-emojis
90
+
91
+ // let emoji = '';
92
+ // try {
93
+ // emoji = message.trim(); // .charAt(0);
94
+ // if (emoji.length > 2) {
95
+ // return false;
96
+ // }
97
+ // } catch (e) {
98
+ // return false;
99
+ // }
100
+ // // const regex = '(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])'
101
+ // const ranges = ['(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff]|[\u0023-\u0039]\ufe0f?\u20e3|\u3299|\u3297|\u303d|\u3030|\u24c2|\ud83c[\udd70-\udd71]|\ud83c[\udd7e-\udd7f]|\ud83c\udd8e|\ud83c[\udd91-\udd9a]|\ud83c[\udde6-\uddff]|[\ud83c[\ude01-\ude02]|\ud83c\ude1a|\ud83c\ude2f|[\ud83c[\ude32-\ude3a]|[\ud83c[\ude50-\ude51]|\u203c|\u2049|[\u25aa-\u25ab]|\u25b6|\u25c0|[\u25fb-\u25fe]|\u00a9|\u00ae|\u2122|\u2139|\ud83c\udc04|[\u2600-\u26FF]|\u2b05|\u2b06|\u2b07|\u2b1b|\u2b1c|\u2b50|\u2b55|\u231a|\u231b|\u2328|\u23cf|[\u23e9-\u23f3]|[\u23f8-\u23fa]|\ud83c\udccf|\u2934|\u2935|[\u2190-\u21ff])'];
102
+ // if (emoji.match(ranges.join('|'))) {
103
+ // return true;
104
+ // } else {
105
+ // return false;
106
+ // }
107
+ // https://localcoder.org/javascript-detect-if-a-string-contains-only-unicode-emojis
108
+ try {
109
+ if(!message) return false;
110
+ const onlyEmojis = message.replace(new RegExp('[\u0000-\u1eeff]', 'g'), '')
111
+ const visibleChars = message.replace(new RegExp('[\n\r\s]+|( )+', 'g'), '')
112
+ if(onlyEmojis === '' || visibleChars == '') return false
113
+ return onlyEmojis.length === visibleChars.length
114
+ } catch(e) {
115
+ return false
104
116
  }
105
117
  }
106
118
 
119
+
120
+
121
+
107
122
  /** */
108
123
  export function getSizeImg(message: any, maxWidthImage?: number): any {
109
- try {
110
- const metadata = message.metadata;
111
- const sizeImage = {
112
- width: metadata.width,
113
- height: metadata.height
114
- };
115
- if (!maxWidthImage) {
116
- maxWidthImage = MAX_WIDTH_IMAGES;
117
- }
118
- if (metadata.width && metadata.width > maxWidthImage) {
119
- const rapporto = (metadata['width'] / metadata['height']);
120
- sizeImage.width = maxWidthImage;
121
- sizeImage.height = maxWidthImage / rapporto;
122
- }
123
- return sizeImage;
124
- } catch (err) {
125
- console.error('error: ', err);
126
- return;
124
+ try {
125
+ const metadata = message.metadata;
126
+ const sizeImage = {
127
+ width: metadata.width,
128
+ height: metadata.height
129
+ };
130
+ if (!maxWidthImage) {
131
+ maxWidthImage = MAX_WIDTH_IMAGES;
127
132
  }
133
+ if (metadata.width && metadata.width > maxWidthImage) {
134
+ const rapporto = (metadata['width'] / metadata['height']);
135
+ sizeImage.width = maxWidthImage;
136
+ sizeImage.height = maxWidthImage / rapporto;
137
+ }
138
+ return sizeImage;
139
+ } catch (err) {
140
+ console.error('error: ', err);
141
+ return;
142
+ }
128
143
  }
129
144
 
130
145
  /** */
131
146
  export function isChannelTypeGroup(channelType: string) {
132
- if (channelType === CHANNEL_TYPE_GROUP || channelType === TYPE_SUPPORT_GROUP) {
133
- return true;
134
- }
135
- return false;
147
+ if (channelType === CHANNEL_TYPE_GROUP || channelType === TYPE_SUPPORT_GROUP) {
148
+ return true;
149
+ }
150
+ return false;
136
151
  }
152
+
153
+