@chat21/chat21-web-widget 5.0.71-rc.10 → 5.0.71-rc.12

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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # chat21-web-widget ver 5.0
2
2
 
3
+ ### 5.0.71-rc.12
4
+ - changed: index.js, index-dev.js and chatbot-panel.js UI improved
5
+
6
+ ### 5.0.71-rc.11
7
+ - added: INFO_MESSAGE_TYPE enum added to manage info message keys into message.attributes object
8
+ - changed: translations aligned for all lang
9
+ - changed: index.js, index-dev.js and chatbot-panel.js UI improved
10
+
3
11
  ### 5.0.71-rc.10
4
12
  - bug-fixed: signInWithCustomToken override tiledesk_token key
5
13
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@chat21/chat21-web-widget",
3
3
  "author": "Tiledesk SRL",
4
- "version": "5.0.71-rc.10",
4
+ "version": "5.0.71-rc.12",
5
5
  "license": "MIT",
6
6
  "homepage": "https://www.tiledesk.com",
7
7
  "repository": {
@@ -138,9 +138,42 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
138
138
  this.logger.info('[APP-CONF]---------------- ngAfterViewInit: APP.COMPONENT ---------------- ')
139
139
  this.ngZone.run(() => {
140
140
  const that = this;
141
+ const subAddedConversation = this.conversationsHandlerService.conversationAdded.subscribe((conversation) => {
142
+ // that.ngZone.run(() => {
143
+ if (that.g.isOpen === true && conversation) {
144
+ that.g.setParameter('displayEyeCatcherCard', 'none');
145
+ that.triggerOnConversationUpdated(conversation);
146
+ that.logger.debug('[APP-COMP] obsAddedConversation ::: ', conversation);
147
+ if (conversation.attributes && conversation.attributes['subtype'] === 'info') {
148
+ return;
149
+ }
150
+ if (conversation.is_new) {
151
+ that.manageTabNotification(false, 'conv-added')
152
+ // this.soundMessage();
153
+ }
154
+ if(this.g.isOpen === false){
155
+ that.lastConversation = conversation;
156
+ that.g.isOpenNewMessage = true;
157
+ }
158
+ } else {
159
+ //widget closed
160
+
161
+ let badgeNewConverstionNumber = that.conversationsHandlerService.countIsNew()
162
+ that.g.setParameter('conversationsBadge', badgeNewConverstionNumber);
163
+ }
164
+ // that.manageTabNotification()
165
+ // });
166
+ if(conversation){
167
+ this.onImageLoaded(conversation)
168
+ this.onConversationLoaded(conversation)
169
+ }
170
+
171
+ });
172
+ this.subscriptions.push(subAddedConversation);
173
+
141
174
  const subChangedConversation = this.conversationsHandlerService.conversationChanged.subscribe((conversation) => {
142
175
  // that.ngZone.run(() => {
143
- if (conversation) {
176
+ if (conversation) {
144
177
  this.onImageLoaded(conversation)
145
178
  this.onConversationLoaded(conversation)
146
179
 
@@ -150,7 +183,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
150
183
  }
151
184
 
152
185
  if(conversation.is_new && conversation.sender !== this.g.senderId && !isInfo(conversation)){
153
- that.manageTabNotification(conversation.sound);
186
+ that.manageTabNotification(conversation.sound, 'conv-changed');
154
187
  }
155
188
 
156
189
  if (that.g.isOpen === true) {
@@ -186,39 +219,6 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
186
219
  });
187
220
  this.subscriptions.push(subChangedConversation);
188
221
 
189
- const subAddedConversation = this.conversationsHandlerService.conversationAdded.subscribe((conversation) => {
190
- // that.ngZone.run(() => {
191
- if (that.g.isOpen === true && conversation) {
192
- that.g.setParameter('displayEyeCatcherCard', 'none');
193
- that.triggerOnConversationUpdated(conversation);
194
- that.logger.debug('[APP-COMP] obsAddedConversation ::: ', conversation);
195
- if (conversation.attributes && conversation.attributes['subtype'] === 'info') {
196
- return;
197
- }
198
- if (conversation.is_new) {
199
- that.manageTabNotification(false)
200
- // this.soundMessage();
201
- }
202
- if(this.g.isOpen === false){
203
- that.lastConversation = conversation;
204
- that.g.isOpenNewMessage = true;
205
- }
206
- } else {
207
- //widget closed
208
-
209
- let badgeNewConverstionNumber = that.conversationsHandlerService.countIsNew()
210
- that.g.setParameter('conversationsBadge', badgeNewConverstionNumber);
211
- }
212
- // that.manageTabNotification()
213
- // });
214
- if(conversation){
215
- this.onImageLoaded(conversation)
216
- this.onConversationLoaded(conversation)
217
- }
218
-
219
- });
220
- this.subscriptions.push(subAddedConversation);
221
-
222
222
  const subAddedArchivedConversations = this.archivedConversationsService.archivedConversationAdded.subscribe((conversation) => {
223
223
  // that.ngZone.run(() => {
224
224
  if (conversation) {
@@ -1473,7 +1473,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
1473
1473
  }
1474
1474
  }
1475
1475
 
1476
- private manageTabNotification(canSound: boolean) {
1476
+ private manageTabNotification(canSound: boolean, calledby: string) {
1477
1477
  if (!this.isTabVisible) {
1478
1478
  // TAB IS HIDDEN --> manage title and SOUND
1479
1479
  // this.g.windowContext.parent.title = "HIDDEN"
@@ -1493,6 +1493,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
1493
1493
  }
1494
1494
  }, 1000);
1495
1495
  }
1496
+ this.logger.debug('[APP-COMP] manageTabNotification canSound:calledby---->', canSound, calledby)
1496
1497
  if(canSound)
1497
1498
  this.soundMessage()
1498
1499
  }
@@ -39,10 +39,9 @@ import { TypingService } from 'src/chat21-core/providers/abstract/typing.service
39
39
  import { CustomTranslateService } from 'src/chat21-core/providers/custom-translate.service';
40
40
  import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
41
41
  import { TiledeskRequestsService } from 'src/chat21-core/providers/tiledesk/tiledesk-requests.service';
42
- import { LIVE_PAGE } from 'src/chat21-core/utils/constants';
42
+ import { INFO_MESSAGE_TYPE } from 'src/chat21-core/utils/constants';
43
43
  import { getDateDifference } from 'src/chat21-core/utils/utils';
44
44
  import { isJustRecived, isUserBanned } from 'src/chat21-core/utils/utils-message';
45
- import { AppComponent } from '../../../app.component';
46
45
  import { ConversationContentComponent } from '../conversation-content/conversation-content.component';
47
46
  // import { TranslateService } from '@ngx-translate/core';
48
47
 
@@ -167,7 +166,7 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
167
166
  public g: Globals,
168
167
  public starRatingWidgetService: StarRatingWidgetService,
169
168
  public sanitizer: DomSanitizer,
170
- public appComponent: AppComponent,
169
+ // public appComponent: AppComponent,
171
170
  public appStorageService: AppStorageService,
172
171
  public conversationHandlerBuilderService: ConversationHandlerBuilderService,
173
172
  public appConfigService: AppConfigService,
@@ -628,7 +627,7 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
628
627
  const message= 'Moved to: [' + this.g.attributes.sourceTitle + '](' + this.g.attributes.sourcePage + ')'
629
628
  const attributes={
630
629
  subtype: 'info/support',
631
- messagelabel: {key: LIVE_PAGE}
630
+ messagelabel: {key: INFO_MESSAGE_TYPE.LIVE_PAGE}
632
631
  }
633
632
  this.logger.debug('[CONV-COMP] sendLivePage --> attributes+message', attributes, message)
634
633
  this.conversationFooter.sendMessage(message, TYPE_MSG_TEXT, null, attributes);
@@ -210,7 +210,6 @@ export class TranslatorService {
210
210
  // this.setLanguage(globals.windowContext, globals.lang);
211
211
 
212
212
  const labels: string[] = [
213
- 'LABEL_TU',
214
213
  'LABEL_PLACEHOLDER',
215
214
  'LABEL_START_NW_CONV',
216
215
  'LABEL_SELECT_TOPIC',
@@ -264,7 +263,6 @@ export class TranslatorService {
264
263
 
265
264
  this._translate.get(labels).subscribe(res => {
266
265
  // console.log('»»»» initI18n »»»»»» »»»»»» GET TRANSLATED LABELS RES ', res);
267
- globals.LABEL_TU = res['LABEL_TU']
268
266
  globals.LABEL_PLACEHOLDER = res['LABEL_PLACEHOLDER']
269
267
  globals.LABEL_START_NW_CONV = res['LABEL_START_NW_CONV'];
270
268
  globals.LABEL_SELECT_TOPIC = res['LABEL_SELECT_TOPIC'];
@@ -288,8 +286,8 @@ export class TranslatorService {
288
286
  globals.BUTTON_EDIT_PROFILE = res['BUTTON_EDIT_PROFILE']; // is used ??
289
287
  globals.DOWNLOAD_TRANSCRIPT = res['DOWNLOAD_TRANSCRIPT'];
290
288
  globals.RATE_CHAT = res['RATE_CHAT']; // is used ??
291
- globals.WELLCOME_TITLE = res['WELLCOME_TITLE'];
292
- globals.WELLCOME_MSG = res['WELLCOME_MSG'];
289
+ globals.WELCOME_TITLE = res['WELCOME_TITLE'];
290
+ globals.WELCOME_MSG = res['WELCOME_MSG'];
293
291
  globals.OPTIONS = res['OPTIONS'];
294
292
  globals.SOUND_ON = res['SOUND_ON'];
295
293
  globals.SOUND_OFF = res['SOUND_OFF'];
@@ -52,7 +52,6 @@ export const BCK_COLOR_CONVERSATION_SELECTED = '#EEEEEE';
52
52
  export const BCK_COLOR_CONVERSATION_UNSELECTED = '#FFFFFF';
53
53
 
54
54
  // LABELS
55
- // export const LABEL_TU = 'you: ';
56
55
  // export const LABEL_MSG_PUSH_START_CHAT = 'Premi qui per chattare con qualcuno';
57
56
  // export const LABEL_MSG_START_CHAT = 'inizia a chattare';
58
57
  // export const LABEL_ACTIVE_NOW = 'attivo/a ora';
@@ -72,7 +72,6 @@ export class Globals {
72
72
  privacyApproved = false;
73
73
 
74
74
  // ============ BEGIN: LABELS ==============//
75
- LABEL_TU: string;
76
75
  LABEL_PLACEHOLDER: string;
77
76
  LABEL_START_NW_CONV: string;
78
77
  LABEL_SELECT_TOPIC: string;
@@ -1,5 +1,4 @@
1
1
  {
2
- "LABEL_TU": "",
3
2
  "LABEL_PLACEHOLDER": "type your message..",
4
3
  "LABEL_START_NW_CONV": "New conversation",
5
4
  "LABEL_WHATSAPP": "Message us",
@@ -17,7 +16,7 @@
17
16
  "GUEST_LABEL": "Guest",
18
17
  "ALL_AGENTS_OFFLINE_LABEL": "All operators are offline at the moment",
19
18
  "LABEL_LOADING": "Loading...",
20
- "CALLOUT_TITLE_PLACEHOLDER": "Need Help?",
19
+ "CALLOUT_TITLE_PLACEHOLDER": "🖐 Need Help?",
21
20
  "CALLOUT_MSG_PLACEHOLDER": "Click here and start chatting with us!",
22
21
  "CUSTOMER_SATISFACTION": "Customer satisfaction",
23
22
  "YOUR_OPINION_ON_OUR_CUSTOMER_SERVICE": "your opinion on our customer service",
@@ -35,8 +34,9 @@
35
34
  "BUTTON_CLOSE_TO_ICON": "Minimize chat",
36
35
  "BUTTON_EDIT_PROFILE": "Update profile",
37
36
  "RATE_CHAT": "Rate chat",
38
- "WELLCOME_TITLE": "Hi, welcome to Tiledesk 👋",
39
- "WELLCOME_MSG": "How can we help?",
37
+ "WELCOME_TITLE": "Hi, welcome to Tiledesk 👋",
38
+ "WELCOME_MSG": "How can we help?",
39
+ "WELCOME": "Welcome",
40
40
  "OPTIONS": "options",
41
41
  "SOUND_OFF": "Sound off",
42
42
  "SOUND_ON": "Sound on",
@@ -87,6 +87,5 @@
87
87
  "SENT_AN_IMAGE":"sent an image",
88
88
 
89
89
  "LABEL_PREVIEW": "Preview",
90
- "SWITCH_TO":"Or switch to:"
91
-
90
+ "SWITCH_TO": "Or switch to:"
92
91
  }
@@ -1,13 +1,14 @@
1
1
  {
2
- "LABEL_TU": "",
3
2
  "LABEL_PLACEHOLDER": "escribe tu mensaje..",
4
3
  "LABEL_START_NW_CONV": "Nueva conversación",
4
+ "LABEL_WHATSAPP": "Envíanos un mensaje",
5
5
  "LABEL_SELECT_TOPIC": "Elige un tema",
6
6
  "LABEL_COMPLETE_FORM": "Complete el formulario para iniciar una conversación con el próximo agente disponible.",
7
7
  "LABEL_FIELD_NAME": "Nombre",
8
8
  "LABEL_ERROR_FIELD_NAME": "Campo obligatorio (mínimo 5 caracteres).",
9
9
  "LABEL_FIELD_EMAIL": "Email",
10
10
  "LABEL_ERROR_FIELD_EMAIL": "Introduzca una dirección de correo electrónico válida.",
11
+ "LABEL_ERROR_FIELD_REQUIRED": "Campo obligatorio",
11
12
  "LABEL_WRITING": "esta escribiendo...",
12
13
  "LABEL_SEND_NEW_MESSAGE": "Enviar un mensaje nuevo",
13
14
  "AGENT_NOT_AVAILABLE": " Fuera de línea",
@@ -15,7 +16,7 @@
15
16
  "GUEST_LABEL": "Huésped",
16
17
  "ALL_AGENTS_OFFLINE_LABEL": "Todos los operadores están desconectados en este momento.",
17
18
  "LABEL_LOADING": "Cargando...",
18
- "CALLOUT_TITLE_PLACEHOLDER": "¿Necesitas ayuda?",
19
+ "CALLOUT_TITLE_PLACEHOLDER": "🖐 ¿Necesitas ayuda?",
19
20
  "CALLOUT_MSG_PLACEHOLDER": "¡Haz clic aquí y comienza a chatear con nosotros!",
20
21
  "CUSTOMER_SATISFACTION": "La satisfacción del cliente",
21
22
  "YOUR_OPINION_ON_OUR_CUSTOMER_SERVICE": "su opinión sobre nuestro servicio al cliente",
@@ -33,8 +34,9 @@
33
34
  "BUTTON_CLOSE_TO_ICON": "Minimiza el chat",
34
35
  "BUTTON_EDIT_PROFILE": "Actualización del perfil",
35
36
  "RATE_CHAT": "Califica el chat",
36
- "WELLCOME_TITLE": "Hola, bienvenido a Tiledesk 👋",
37
- "WELLCOME_MSG": "¿Cómo podemos ayudar?",
37
+ "WELCOME_TITLE": "Hola, bienvenido a Tiledesk 👋",
38
+ "WELCOME_MSG": "¿Cómo podemos ayudar?",
39
+ "WELCOME": "Podemos",
38
40
  "OPTIONS": "opciones",
39
41
  "SOUND_OFF": "Sonido apagado",
40
42
  "SOUND_ON": "Sonido encendido",
@@ -53,6 +55,7 @@
53
55
  "CLOSE_CHAT": "Cerrar chat",
54
56
  "MINIMIZE":"Minimizar",
55
57
  "MAXIMIZE":"Maximizar",
58
+
56
59
  "INFO_SUPPORT_USER_ADDED_SUBJECT":"tú",
57
60
  "INFO_SUPPORT_USER_ADDED_YOU_VERB":"han sido agregados a ",
58
61
  "INFO_SUPPORT_USER_ADDED_COMPLEMENT":"joined",
@@ -63,12 +66,7 @@
63
66
  "INFO_SUPPORT_MEMBER_LEFT_GROUP":"eliminado del grupo",
64
67
  "INFO_SUPPORT_MEMBER_ABANDONED_GROUP":"abandonó la conversación",
65
68
  "INFO_A_NEW_SUPPORT_REQUEST_HAS_BEEN_ASSIGNED_TO_YOU": "Se le ha asignado una nueva solicitud de soporte",
66
- "TICKET_TAKING":"La solicitud ha sido recibida y el personal de asistencia está tratando con ella. \nPara agregar más comentarios, responda a este correo electrónico.",
67
69
 
68
- "LABEL_ERROR_FIELD_REQUIRED": "Campo obligatorio",
69
- "SENT_AN_ATTACHMENT": "envió un archivo adjunto",
70
- "SENT_AN_IMAGE": "envió una imagen",
71
-
72
70
  "LABEL_PRECHAT_USER_FULLNAME": "Nombre completo",
73
71
  "LABEL_PRECHAT_USER_EMAIL": "Correo electrónico",
74
72
  "LABEL_PRECHAT_USER_EMAIL_ERROR": "Dirección de correo electrónico no válida",
@@ -84,5 +82,10 @@
84
82
  "LABEL_LAST_ACCESS": "ultimo acceso",
85
83
  "LABEL_TO": "a",
86
84
  "ARRAY_DAYS": ["Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado", "Domingo"],
87
- "LABEL_PREVIEW": "Avance"
85
+
86
+ "SENT_AN_ATTACHMENT": "envió un archivo adjunto",
87
+ "SENT_AN_IMAGE": "envió una imagen",
88
+
89
+ "LABEL_PREVIEW": "Avance",
90
+ "SWITCH_TO":"O cambiar a:"
88
91
  }
@@ -1,13 +1,14 @@
1
1
  {
2
- "LABEL_TU": "",
3
2
  "LABEL_PLACEHOLDER": "Écrivez votre question ...",
4
3
  "LABEL_START_NW_CONV": "Nouvelle conversation",
4
+ "LABEL_WHATSAPP": "Contactez-nous",
5
5
  "LABEL_SELECT_TOPIC": "Sélectionnez un sujet",
6
6
  "LABEL_COMPLETE_FORM": "Remplissez le formulaire pour démarrer une conversation avec le prochain agent disponible.",
7
7
  "LABEL_FIELD_NAME": "Prenom",
8
8
  "LABEL_ERROR_FIELD_NAME": "Nom demandé (minimum 2 caractères).",
9
9
  "LABEL_FIELD_EMAIL": "Email",
10
10
  "LABEL_ERROR_FIELD_EMAIL": "Entrer une adresse email valide.",
11
+ "LABEL_ERROR_FIELD_REQUIRED": "Champ obligatoire",
11
12
  "LABEL_WRITING": "écrit ...",
12
13
  "LABEL_SEND_NEW_MESSAGE": "Envoyez un nouveau message",
13
14
  "AGENT_NOT_AVAILABLE": " Hors ligne",
@@ -15,7 +16,7 @@
15
16
  "GUEST_LABEL": "Hôte",
16
17
  "ALL_AGENTS_OFFLINE_LABEL": "Tous les opérateurs sont actuellement hors ligne",
17
18
  "LABEL_LOADING": "Chargement en cours ...",
18
- "CALLOUT_TITLE_PLACEHOLDER": "Besoin d'aide?",
19
+ "CALLOUT_TITLE_PLACEHOLDER": "🖐 Besoin d'aide?",
19
20
  "CALLOUT_MSG_PLACEHOLDER": "Cliquez ici et commencez à discuter avec nous!",
20
21
  "CUSTOMER_SATISFACTION": "Évaluation des services",
21
22
  "YOUR_OPINION_ON_OUR_CUSTOMER_SERVICE": "votre avis sur notre service client",
@@ -33,8 +34,9 @@
33
34
  "BUTTON_CLOSE_TO_ICON": "Minimisez le chat",
34
35
  "BUTTON_EDIT_PROFILE": "Modifier le profil",
35
36
  "RATE_CHAT": "évaluer la conversation",
36
- "WELLCOME_TITLE": "Salut, bienvenue à Tiledesk 👋",
37
- "WELLCOME_MSG": "Comment pouvons-nous vous aider?",
37
+ "WELCOME_TITLE": "Salut, bienvenue à Tiledesk 👋",
38
+ "WELCOME_MSG": "Comment pouvons-nous vous aider?",
39
+ "WELCOME": "Bienvenue",
38
40
  "OPTIONS": "options",
39
41
  "SOUND_OFF": "Sound off",
40
42
  "SOUND_ON": "Sound on",
@@ -53,6 +55,7 @@
53
55
  "CLOSE_CHAT": "Fermer le chat",
54
56
  "MINIMIZE":"Minimiser",
55
57
  "MAXIMIZE":"Maximiser",
58
+
56
59
  "INFO_SUPPORT_USER_ADDED_SUBJECT":"toi",
57
60
  "INFO_SUPPORT_USER_ADDED_YOU_VERB":"ont été ajoutés à ",
58
61
  "INFO_SUPPORT_USER_ADDED_COMPLEMENT":"rejointe",
@@ -63,11 +66,6 @@
63
66
  "INFO_SUPPORT_MEMBER_LEFT_GROUP":"supprimé du groupe",
64
67
  "INFO_SUPPORT_MEMBER_ABANDONED_GROUP":"a quitté la conversation",
65
68
  "INFO_A_NEW_SUPPORT_REQUEST_HAS_BEEN_ASSIGNED_TO_YOU": "Une nouvelle demande de support vous a été attribuée",
66
- "TICKET_TAKING":"La demande a été reçue et le personnel d'assistance la traite.\nPour ajouter d'autres commentaires, répondez à cet e-mail.",
67
-
68
- "LABEL_ERROR_FIELD_REQUIRED": "Champ obligatoire",
69
- "SENT_AN_ATTACHMENT": "envoyé une pièce jointe",
70
- "SENT_AN_IMAGE": "envoyé une image",
71
69
 
72
70
  "LABEL_PRECHAT_USER_FULLNAME": "Nom complet",
73
71
  "LABEL_PRECHAT_USER_EMAIL": "E-mail",
@@ -84,5 +82,10 @@
84
82
  "LABEL_LAST_ACCESS": "dernier accès",
85
83
  "LABEL_TO": "à",
86
84
  "ARRAY_DAYS": ["Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi", "Dimanche"],
87
- "LABEL_PREVIEW": "Aperçu"
85
+
86
+ "SENT_AN_ATTACHMENT": "envoyé une pièce jointe",
87
+ "SENT_AN_IMAGE": "envoyé une image",
88
+
89
+ "LABEL_PREVIEW": "Aperçu",
90
+ "SWITCH_TO":"Ou passer à:"
88
91
  }
@@ -1,13 +1,14 @@
1
1
  {
2
- "LABEL_TU": "",
3
2
  "LABEL_PLACEHOLDER": "Scrivi la tua domanda...",
4
3
  "LABEL_START_NW_CONV": "Nuova conversazione",
4
+ "LABEL_WHATSAPP": "Contattaci",
5
5
  "LABEL_SELECT_TOPIC": "Seleziona un argomento",
6
6
  "LABEL_COMPLETE_FORM": "Completa il form per iniziare una conversazione con il prossimo agente disponibile.",
7
7
  "LABEL_FIELD_NAME": "Nome",
8
8
  "LABEL_ERROR_FIELD_NAME": "Nome richiesto (minimo 2 caratteri).",
9
9
  "LABEL_FIELD_EMAIL": "Email",
10
10
  "LABEL_ERROR_FIELD_EMAIL": "Inserisci un indirizzo email valido.",
11
+ "LABEL_ERROR_FIELD_REQUIRED": "Campo richiesto",
11
12
  "LABEL_WRITING": "sta scrivendo...",
12
13
  "LABEL_SEND_NEW_MESSAGE": "Invia un nuovo messaggio",
13
14
  "AGENT_NOT_AVAILABLE": " Offline",
@@ -15,7 +16,7 @@
15
16
  "GUEST_LABEL": "Ospite",
16
17
  "ALL_AGENTS_OFFLINE_LABEL": "Tutti gli operatori sono offline al momento",
17
18
  "LABEL_LOADING": "Caricamento...",
18
- "CALLOUT_TITLE_PLACEHOLDER": "Bisogno di aiuto?",
19
+ "CALLOUT_TITLE_PLACEHOLDER": "🖐 Bisogno di aiuto?",
19
20
  "CALLOUT_MSG_PLACEHOLDER": "Clicca qui e inizia a chattare con noi!",
20
21
  "CUSTOMER_SATISFACTION": "Valutazione servizio",
21
22
  "YOUR_OPINION_ON_OUR_CUSTOMER_SERVICE": "il tuo giudizio sul nostro servizio clienti",
@@ -33,8 +34,9 @@
33
34
  "BUTTON_CLOSE_TO_ICON": "Riduci a icona la chat",
34
35
  "BUTTON_EDIT_PROFILE": "Modifica profilo",
35
36
  "RATE_CHAT": "Valuta chat",
36
- "WELLCOME_TITLE": "Ciao, benvenuto su Tiledesk 👋",
37
- "WELLCOME_MSG": "Come possiamo aiutarti?",
37
+ "WELCOME_TITLE": "Ciao, benvenuto su Tiledesk 👋",
38
+ "WELCOME_MSG": "Come possiamo aiutarti?",
39
+ "WELCOME": "Benvenuto",
38
40
  "OPTIONS": "opzioni",
39
41
  "SOUND_OFF": "Suono spento",
40
42
  "SOUND_ON": "Suono acceso",
@@ -53,6 +55,7 @@
53
55
  "CLOSE_CHAT": "Chiudi chat",
54
56
  "MINIMIZE":"Minimizza",
55
57
  "MAXIMIZE":"Massimizza",
58
+
56
59
  "INFO_SUPPORT_USER_ADDED_SUBJECT":"tu",
57
60
  "INFO_SUPPORT_USER_ADDED_YOU_VERB":"sei stato aggiunto ",
58
61
  "INFO_SUPPORT_USER_ADDED_COMPLEMENT":"si è unito",
@@ -63,11 +66,6 @@
63
66
  "INFO_SUPPORT_MEMBER_LEFT_GROUP":"ha lasciato il gruppo",
64
67
  "INFO_SUPPORT_MEMBER_ABANDONED_GROUP": "ha abbandonato la conversazione",
65
68
  "INFO_A_NEW_SUPPORT_REQUEST_HAS_BEEN_ASSIGNED_TO_YOU": "Una nuova richiesta di supporto è stata assegnata a te",
66
- "TICKET_TAKING":"La richiesta è stata ricevuta e il personale di assistenza se ne sta occupando.\nPer aggiungere ulteriori commenti, rispondi a questa email.",
67
-
68
- "LABEL_ERROR_FIELD_REQUIRED": "Campo richiesto",
69
- "SENT_AN_ATTACHMENT": "ha inviato un allegato",
70
- "SENT_AN_IMAGE":"ha inviato un'immagine",
71
69
 
72
70
  "LABEL_PRECHAT_USER_FULLNAME": "Nome completo",
73
71
  "LABEL_PRECHAT_USER_EMAIL": "E-mail",
@@ -84,5 +82,10 @@
84
82
  "LABEL_LAST_ACCESS": "ultimo accesso",
85
83
  "LABEL_TO": "a",
86
84
  "ARRAY_DAYS": ["Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì", "Sabato", "Domenica"],
87
- "LABEL_PREVIEW": "Anteprima"
85
+
86
+ "SENT_AN_ATTACHMENT": "ha inviato un allegato",
87
+ "SENT_AN_IMAGE":"ha inviato un'immagine",
88
+
89
+ "LABEL_PREVIEW": "Anteprima",
90
+ "SWITCH_TO":"Oppure passa a:"
88
91
  }
@@ -1000,8 +1000,8 @@ class Chat21Client {
1000
1000
 
1001
1001
  this.client.on('connect', // TODO if token is wrong it must reply with an error!
1002
1002
  () => {
1003
+ console.log("Chat client connected. User:" + user_id)
1003
1004
  if (this.log) {
1004
- console.log("Chat client connected. User:" + user_id)
1005
1005
  console.log("Chat client connected. this.connected:" + this.connected)
1006
1006
  }
1007
1007
  if (!this.connected) {
@@ -1025,17 +1025,20 @@ class Chat21Client {
1025
1025
  );
1026
1026
  this.client.on('reconnect',
1027
1027
  () => {
1028
+ console.log("Chat client reconnect event")
1028
1029
  if (this.log) {console.log("Chat client reconnect event");}
1029
1030
  }
1030
1031
  );
1031
1032
  this.client.on('close',
1032
1033
  () => {
1034
+ console.log("Chat client reconnect event")
1033
1035
  this.connected = false
1034
1036
  if (this.log) {console.log("Chat client close event");}
1035
1037
  }
1036
1038
  );
1037
1039
  this.client.on('offline',
1038
1040
  () => {
1041
+ console.log("Chat client reconnect event")
1039
1042
  if (this.log) {console.log("Chat client offline event");}
1040
1043
  }
1041
1044
  );
@@ -14,10 +14,6 @@
14
14
  @-ms-keyframes blink {0%{opacity:1;} 50%{opacity:0;} 100%{opacity:1;}} /* IE */
15
15
  @keyframes blink {0%{opacity:1;} 50%{opacity:0;} 100%{opacity:1;}} /* Opera and prob css3 final iteration */
16
16
 
17
- :root {
18
-
19
- }
20
-
21
17
  body{
22
18
  --font-family-poppins: 'Poppins', 'Roboto', Arial, sans-serif;
23
19
  --blu: #506493;
@@ -466,8 +462,10 @@
466
462
  marginY: "50px",
467
463
  // calloutTimer: 1,
468
464
  singleConversation: true,
469
- restartConversation: true,
470
- hideCloseConversationOptionMenu: true
465
+ restartConversation: false,
466
+ hideHeaderCloseButton: true,
467
+ hideCloseConversationOptionMenu: true,
468
+ isLogEnabled:true
471
469
  // autostart: false
472
470
 
473
471
  };
@@ -14,6 +14,15 @@
14
14
  @-ms-keyframes blink {0%{opacity:1;} 50%{opacity:0;} 100%{opacity:1;}} /* IE */
15
15
  @keyframes blink {0%{opacity:1;} 50%{opacity:0;} 100%{opacity:1;}} /* Opera and prob css3 final iteration */
16
16
 
17
+ body{
18
+ --font-family-poppins: 'Poppins', 'Roboto', Arial, sans-serif;
19
+ --blu: #506493;
20
+ --gray-light-02: rgb(223, 227, 237);
21
+ --base-company-logo: rgb(224,106,88);
22
+ --header-height: 80px;
23
+ --footer-height: 80px;
24
+ }
25
+
17
26
  #preloader {
18
27
  background: #fff;
19
28
  position: fixed;
@@ -51,6 +60,52 @@
51
60
  animation:blink normal 2s infinite ease-in-out; /* Opera and prob css3 final iteration */
52
61
  }
53
62
 
63
+ .loader{
64
+ display: block;
65
+ z-index: 99;
66
+ position: absolute;
67
+ top: calc( 50% - 50px);
68
+ left: calc( 50% - 50px);
69
+ width: 100px;
70
+ height: 100px;
71
+ border: 3px solid var(--base-company-logo);
72
+ border-radius: 50%;
73
+
74
+ animation: spin 7s ease-in-out;
75
+ animation-iteration-count: infinite;
76
+ transition-duration: 0.1s;
77
+ }
78
+
79
+ .loader:hover {
80
+ scale: 0.95;
81
+ /*Loader on hover effect*/
82
+ }
83
+
84
+ .loader:active {
85
+ scale: 1.2;
86
+ /*Loader on click effect*/
87
+ }
88
+
89
+ @keyframes spin {
90
+ 0% {
91
+ transform: rotate(0deg);
92
+ border-bottom: solid 3px transparent;
93
+ border-top: solid 3px transparent;
94
+ }
95
+ 50% {
96
+ transform: rotate(1800deg);
97
+ border: 3px solid white;
98
+ border-left: solid 3px transparent;
99
+ border-right: solid 3px transparent;
100
+ }
101
+ 100% {
102
+ /*Reversed spinning*/
103
+ transform: rotate(0deg);
104
+ border-bottom: solid 3px transparent;
105
+ border-top: solid 3px transparent;
106
+ }
107
+ }
108
+
54
109
  #deferred-styles {
55
110
  display: none;
56
111
  }
@@ -93,7 +148,11 @@
93
148
  justify-content: space-around;
94
149
  }
95
150
  #header-logo{
96
- height: 50px;
151
+ max-height: 45px;
152
+ }
153
+
154
+ .navbar{
155
+ display: flex;
97
156
  }
98
157
 
99
158
  #wrapper {
@@ -108,22 +167,22 @@
108
167
  left: 0px;
109
168
  right: 0px;
110
169
  overflow: hidden;
111
- height: 80px;
170
+ height: var(--header-height);
171
+ font-family: var(--font-family-poppins);
112
172
  }
113
173
 
114
174
  #main {
175
+ padding: 20px;
115
176
  padding-bottom:100px;
116
- margin: 20px;
177
+ margin: 20px auto 20px auto;
178
+ /* width: 970px !important; */
179
+ justify-content: start;
117
180
 
118
181
  position: absolute;
119
- overflow: auto;
120
- top: 80px;
121
- bottom: 100px;
122
- left: 0px;
123
- right: 0px;
182
+ top: var(--header-height);
183
+ bottom: var(--footer-height);
184
+ overflow: scroll;
124
185
  width: 100%;
125
- justify-content: flex-start;
126
- flex-direction: row;
127
186
  }
128
187
 
129
188
  .row {
@@ -131,6 +190,12 @@
131
190
  margin-right: 0 !important;
132
191
  }
133
192
 
193
+ @media screen and (max-width: 1020px){
194
+ .row{
195
+ width: 100% !important;
196
+ }
197
+ }
198
+
134
199
 
135
200
  .b_frame {
136
201
  -webkit-box-shadow: 0px 19px 147px -41px rgba(0,0,0,0.75);
@@ -183,7 +248,7 @@
183
248
 
184
249
  /* position: relative;
185
250
  margin-top: -100px; negative value of footer height */
186
- height: 80px;
251
+ height: var(--footer-height);
187
252
  clear:both;
188
253
 
189
254
  position: absolute;
@@ -294,7 +359,7 @@
294
359
  }
295
360
 
296
361
  div.section .btn:hover{
297
- background: rgb(240,135,118);
362
+ background: var(--base-company-logo);
298
363
  color: #ffffff;
299
364
  }
300
365
 
@@ -352,7 +417,7 @@
352
417
  }
353
418
 
354
419
  div.method_container .btn:hover{
355
- background: rgb(240,135,118);
420
+ background: var(--base-company-logo);
356
421
  color: #ffffff;
357
422
  }
358
423
 
@@ -1592,8 +1657,12 @@
1592
1657
  </head>
1593
1658
 
1594
1659
  <body class="website white" >
1595
- <div id="preloader">
1660
+ <!-- <div id="preloader">
1596
1661
  <div class="logo"></div>
1662
+ </div> -->
1663
+
1664
+ <div id="preloader">
1665
+ <div class="loader"></div>
1597
1666
  </div>
1598
1667
 
1599
1668
  <div id="wrapper">
@@ -1626,9 +1695,8 @@
1626
1695
  </nav>
1627
1696
  </header>
1628
1697
 
1629
- <div id="main" class="container">
1630
- <div class="row">
1631
- <div class="col-md-12">
1698
+ <div id="main">
1699
+ <div class="row" style="width: 70%;">
1632
1700
  <h1 style="min-height: 39px;">TEST ACTIONS</h1>
1633
1701
  <h3 id="project_name" style="min-height: 39px;"></h3>
1634
1702
  <div class="row method_container">
@@ -2415,19 +2483,20 @@
2415
2483
  <button class="btn btn-light" onclick="onClickClearHistory()">Clear <i class="fa fa-trash" aria-hidden="true"></i></button>
2416
2484
  </div>
2417
2485
  </div>
2418
- </div>
2486
+
2487
+ <div class="row" style="width: 100%;">
2488
+ <h1 id="project_name" style="min-height: 39px;"></h1>
2489
+ <h2></h2>
2490
+ <div class="b_integrations_agent_links">
2491
+ <a href="" data-toggle="modal" data-target="#embedModal" id="enbed" style="display: none;"><i class="fa-code fa"></i>Embed</a>
2492
+ <!-- <a href="mailto:?subject=Tiledesk%20widget%20test%20page"><i class="fa-envelope-o fa" target="_blank"></i>Email</a> -->
2493
+ <a href="" data-toggle="modal" data-target="#shareModal"><i class="fa-reply fa"></i>Share</a>
2494
+ </div>
2495
+ </div>
2419
2496
 
2420
2497
  </div>
2421
2498
 
2422
- <div class="row" style="width: 100%;">
2423
- <h1 id="project_name" style="min-height: 39px;"></h1>
2424
- <h2></h2>
2425
- <div class="b_integrations_agent_links">
2426
- <a href="" data-toggle="modal" data-target="#embedModal" id="enbed" style="display: none;"><i class="fa-code fa"></i>Embed</a>
2427
- <!-- <a href="mailto:?subject=Tiledesk%20widget%20test%20page"><i class="fa-envelope-o fa" target="_blank"></i>Email</a> -->
2428
- <a href="" data-toggle="modal" data-target="#shareModal"><i class="fa-reply fa"></i>Share</a>
2429
- </div>
2430
- </div>
2499
+
2431
2500
 
2432
2501
 
2433
2502
  <div class="modal fade" tabindex="-1" id="embedModal" role="dialog">
@@ -14,6 +14,15 @@
14
14
  @-ms-keyframes blink {0%{opacity:1;} 50%{opacity:0;} 100%{opacity:1;}} /* IE */
15
15
  @keyframes blink {0%{opacity:1;} 50%{opacity:0;} 100%{opacity:1;}} /* Opera and prob css3 final iteration */
16
16
 
17
+ body{
18
+ --font-family-poppins: 'Poppins', 'Roboto', Arial, sans-serif;
19
+ --blu: #506493;
20
+ --gray-light-02: rgb(223, 227, 237);
21
+ --base-company-logo: rgb(224,106,88);
22
+ --header-height: 80px;
23
+ --footer-height: 80px;
24
+ }
25
+
17
26
  #preloader {
18
27
  background: #fff;
19
28
  position: absolute;
@@ -61,7 +70,7 @@
61
70
  left: calc( 50% - 50px);
62
71
  width: 100px;
63
72
  height: 100px;
64
- border: 3px solid rgb(224, 106, 88);
73
+ border: 3px solid var(--base-company-logo);
65
74
  border-radius: 50%;
66
75
 
67
76
  animation: spin 7s ease-in-out;
@@ -142,7 +151,7 @@
142
151
  justify-content: space-around;
143
152
  }
144
153
  #header-logo{
145
- height: 50px;
154
+ max-height: 45px;
146
155
  }
147
156
 
148
157
  #wrapper {
@@ -154,13 +163,17 @@
154
163
  #main {
155
164
  padding-bottom:100px;
156
165
  margin: 20px auto 0 auto;
157
- width: 970px !important;
166
+ /* width: 970px !important; */
158
167
  justify-content: start;
159
168
  }
160
169
 
170
+ .navbar{
171
+ display: flex;
172
+ }
173
+
161
174
  .row {
162
- margin-left: 0;
163
- margin-right: 0;
175
+ margin-left: 0 !important;
176
+ margin-right: 0 !important;
164
177
  }
165
178
 
166
179
 
@@ -195,7 +208,7 @@
195
208
 
196
209
  /* position: relative;
197
210
  margin-top: -100px; negative value of footer height */
198
- height: 80px;
211
+ height: var(--footer-height);
199
212
  clear:both;
200
213
 
201
214
  position: absolute;
@@ -1,5 +1,3 @@
1
- import { LIVE_PAGE, MEMBER_LEFT_GROUP, TOUCHING_OPERATOR } from './../../utils/constants';
2
-
3
1
  import { Inject, Injectable } from '@angular/core';
4
2
  import { BehaviorSubject } from 'rxjs';
5
3
 
@@ -17,14 +15,10 @@ import { LoggerService } from '../abstract/logger.service';
17
15
  import { LoggerInstance } from '../logger/loggerInstance';
18
16
 
19
17
  // utils
20
- import { MSG_STATUS_RECEIVED, CHAT_REOPENED, CHAT_CLOSED, MEMBER_JOINED_GROUP, TYPE_DIRECT, MESSAGE_TYPE_INFO, LEAD_UPDATED } from '../../utils/constants';
21
- import {
22
- compareValues,
23
- searchIndexInArrayForUid,
24
- conversationMessagesRef
25
- } from '../../utils/utils';
18
+ import { MSG_STATUS_RECEIVED, TYPE_DIRECT, MESSAGE_TYPE_INFO, INFO_MESSAGE_TYPE } from '../../utils/constants';
19
+ import { compareValues, searchIndexInArrayForUid, conversationMessagesRef } from '../../utils/utils';
26
20
  import { v4 as uuidv4 } from 'uuid';
27
- import { messageType, checkIfIsMemberJoinedGroup, hideInfoMessage, isJustRecived, isSender } from '../../utils/utils-message';
21
+ import { messageType, checkIfIsMemberJoinedGroup, hideInfoMessage, isJustRecived, isSender, infoMessageType } from '../../utils/utils-message';
28
22
 
29
23
  // @Injectable({ providedIn: 'root' })
30
24
  @Injectable()
@@ -377,10 +371,7 @@ export class FirebaseConversationHandler extends ConversationHandlerService {
377
371
  const INFO_A_NEW_SUPPORT_REQUEST_HAS_BEEN_ASSIGNED_TO_YOU = this.translationMap.get('INFO_A_NEW_SUPPORT_REQUEST_HAS_BEEN_ASSIGNED_TO_YOU');
378
372
  const INFO_SUPPORT_LIVE_PAGE = this.translationMap.get('INFO_SUPPORT_LIVE_PAGE');
379
373
 
380
- if (message.attributes.messagelabel
381
- && message.attributes.messagelabel.parameters
382
- && message.attributes.messagelabel.key === MEMBER_JOINED_GROUP
383
- ) {
374
+ if (infoMessageType(message) === INFO_MESSAGE_TYPE.MEMBER_JOINED_GROUP && message.attributes.messagelabel.parameters) {
384
375
  let subject: string;
385
376
  let verb: string;
386
377
  let complement: string;
@@ -403,18 +394,18 @@ export class FirebaseConversationHandler extends ConversationHandlerService {
403
394
  }
404
395
  }
405
396
  message.text = subject + ' ' + verb + ' ' + complement;
406
- } else if ((message.attributes.messagelabel && message.attributes.messagelabel.key === CHAT_REOPENED)) {
397
+ } else if (infoMessageType(message) === INFO_MESSAGE_TYPE.CHAT_REOPENED ) {
407
398
  message.text = INFO_SUPPORT_CHAT_REOPENED;
408
- } else if ((message.attributes.messagelabel && message.attributes.messagelabel.key === CHAT_CLOSED)) {
399
+ } else if (infoMessageType(message) === INFO_MESSAGE_TYPE.CHAT_CLOSED ) {
409
400
  message.text = INFO_SUPPORT_CHAT_CLOSED;
410
- } else if ((message.attributes && message.attributes.messagelabel && message.attributes.messagelabel.key === TOUCHING_OPERATOR) && message.sender === "system") {
401
+ } else if ((infoMessageType(message) === INFO_MESSAGE_TYPE.TOUCHING_OPERATOR) && message.sender === "system") {
411
402
  const textAfterColon = message.text.split(":")[1]
412
403
  if (textAfterColon !== undefined) {
413
404
  message.text = INFO_A_NEW_SUPPORT_REQUEST_HAS_BEEN_ASSIGNED_TO_YOU + ': ' + textAfterColon;
414
405
  }
415
- } else if ((message.attributes.messagelabel && message.attributes.messagelabel.key === LEAD_UPDATED)) {
406
+ } else if (infoMessageType(message) === INFO_MESSAGE_TYPE.LEAD_UPDATED) {
416
407
  message.text = INFO_SUPPORT_LEAD_UPDATED;
417
- } else if ((message.attributes.messagelabel && message.attributes.messagelabel.key === MEMBER_LEFT_GROUP)) {
408
+ } else if (infoMessageType(message) === INFO_MESSAGE_TYPE.MEMBER_LEFT_GROUP) {
418
409
  let subject: string = '';
419
410
  if (message.attributes.messagelabel.parameters.fullname) {
420
411
  subject = message.attributes.messagelabel.parameters.fullname;
@@ -422,7 +413,7 @@ export class FirebaseConversationHandler extends ConversationHandlerService {
422
413
  subject = message.attributes.messagelabel.parameters.member_id;
423
414
  }
424
415
  message.text = subject + ' ' + INFO_SUPPORT_MEMBER_LEFT_GROUP ;
425
- } else if(message.attributes.messagelabel && message.attributes.messagelabel.key === LIVE_PAGE){
416
+ } else if(infoMessageType(message) === INFO_MESSAGE_TYPE.LIVE_PAGE){
426
417
  let sourceUrl: string = '';
427
418
  if(message.attributes && message.attributes.sourcePage){
428
419
  sourceUrl = message.attributes.sourcePage
@@ -1,5 +1,3 @@
1
- import { async } from '@angular/core/testing';
2
- import { LIVE_PAGE, TOUCHING_OPERATOR } from './../../utils/constants';
3
1
  import { Inject, Injectable } from '@angular/core';
4
2
  import { BehaviorSubject } from 'rxjs';
5
3
 
@@ -17,15 +15,10 @@ import { UserModel } from '../../models/user';
17
15
  import { ConversationHandlerService } from '../abstract/conversation-handler.service';
18
16
 
19
17
  // utils
20
- import { MSG_STATUS_RECEIVED, CHAT_REOPENED, CHAT_CLOSED, MEMBER_JOINED_GROUP, TYPE_DIRECT, MESSAGE_TYPE_INFO, LEAD_UPDATED, MEMBER_LEFT_GROUP } from '../../utils/constants';
21
- import {
22
- htmlEntities,
23
- compareValues,
24
- searchIndexInArrayForUid,
25
- conversationMessagesRef
26
- } from '../../utils/utils';
18
+ import { MSG_STATUS_RECEIVED, TYPE_DIRECT, MESSAGE_TYPE_INFO, INFO_MESSAGE_TYPE } from '../../utils/constants';
19
+ import { compareValues, searchIndexInArrayForUid } from '../../utils/utils';
20
+ import { messageType, checkIfIsMemberJoinedGroup, hideInfoMessage, isJustRecived, isSender, infoMessageType } from '../../utils/utils-message';
27
21
  import { v4 as uuidv4 } from 'uuid';
28
- import { messageType, checkIfIsMemberJoinedGroup, hideInfoMessage, isJustRecived, isSender } from '../../utils/utils-message';
29
22
 
30
23
 
31
24
  // @Injectable({ providedIn: 'root' })
@@ -373,10 +366,7 @@ export class MQTTConversationHandler extends ConversationHandlerService {
373
366
  const INFO_A_NEW_SUPPORT_REQUEST_HAS_BEEN_ASSIGNED_TO_YOU = this.translationMap.get('INFO_A_NEW_SUPPORT_REQUEST_HAS_BEEN_ASSIGNED_TO_YOU');
374
367
  const INFO_SUPPORT_LIVE_PAGE = this.translationMap.get('INFO_SUPPORT_LIVE_PAGE');
375
368
 
376
- if (message.attributes.messagelabel
377
- && message.attributes.messagelabel.parameters
378
- && message.attributes.messagelabel.key === MEMBER_JOINED_GROUP
379
- ) {
369
+ if (infoMessageType(message) === INFO_MESSAGE_TYPE.MEMBER_JOINED_GROUP && message.attributes.messagelabel.parameters ) {
380
370
  let subject: string;
381
371
  let verb: string;
382
372
  let complement: string;
@@ -398,20 +388,20 @@ export class MQTTConversationHandler extends ConversationHandlerService {
398
388
  }
399
389
  }
400
390
  message.text = subject + ' ' + verb + ' ' + complement;
401
- } else if ((message.attributes.messagelabel && message.attributes.messagelabel.key === CHAT_REOPENED)) {
391
+ } else if (infoMessageType(message) === INFO_MESSAGE_TYPE.CHAT_REOPENED) {
402
392
  message.text = INFO_SUPPORT_CHAT_REOPENED;
403
- } else if ((message.attributes.messagelabel && message.attributes.messagelabel.key === CHAT_CLOSED)) {
393
+ } else if (infoMessageType(message) === INFO_MESSAGE_TYPE.CHAT_CLOSED) {
404
394
  message.text = INFO_SUPPORT_CHAT_CLOSED;
405
- } else if ((message.attributes && message.attributes.messagelabel && message.attributes.messagelabel.key === TOUCHING_OPERATOR) && message.sender === "system") {
395
+ } else if ((infoMessageType(message) ===INFO_MESSAGE_TYPE.TOUCHING_OPERATOR) && message.sender === "system") {
406
396
  // console.log('FIREBASEConversationHandlerSERVICE message text', message.text)
407
397
  const textAfterColon = message.text.split(":")[1]
408
398
  // console.log('FIREBASEConversationHandlerSERVICE message text - textAfterColon', textAfterColon)
409
399
  if (textAfterColon !== undefined) {
410
400
  message.text = INFO_A_NEW_SUPPORT_REQUEST_HAS_BEEN_ASSIGNED_TO_YOU + ': ' + textAfterColon;
411
401
  }
412
- } else if ((message.attributes.messagelabel && message.attributes.messagelabel.key === LEAD_UPDATED)) {
402
+ } else if (infoMessageType(message) === INFO_MESSAGE_TYPE.LEAD_UPDATED) {
413
403
  message.text = INFO_SUPPORT_LEAD_UPDATED;
414
- } else if ((message.attributes.messagelabel && message.attributes.messagelabel.key === MEMBER_LEFT_GROUP)) {
404
+ } else if (infoMessageType(message) === INFO_MESSAGE_TYPE.MEMBER_LEFT_GROUP) {
415
405
  let subject: string;
416
406
  if (message.attributes.messagelabel.parameters.fullname) {
417
407
  subject = message.attributes.messagelabel.parameters.fullname;
@@ -419,7 +409,7 @@ export class MQTTConversationHandler extends ConversationHandlerService {
419
409
  subject = message.attributes.messagelabel.parameters.member_id;
420
410
  }
421
411
  message.text = subject + ' ' + INFO_SUPPORT_MEMBER_LEFT_GROUP ;
422
- } else if(message.attributes.messagelabel && message.attributes.messagelabel.key === LIVE_PAGE){
412
+ } else if(infoMessageType(message) === INFO_MESSAGE_TYPE.LIVE_PAGE){
423
413
  let sourceUrl: string = '';
424
414
  if(message.attributes && message.attributes.sourcePage){
425
415
  sourceUrl = message.attributes.sourcePage
@@ -68,13 +68,15 @@ export const MESSAGE_TYPE_INFO = 'INFO';
68
68
  export const MESSAGE_TYPE_MINE = 'MINE';
69
69
  export const MESSAGE_TYPE_OTHERS = 'OTHERS';
70
70
 
71
- export const CHAT_REOPENED = 'CHAT_REOPENED';
72
- export const CHAT_CLOSED = 'CHAT_CLOSED';
73
- export const MEMBER_JOINED_GROUP = 'MEMBER_JOINED_GROUP';
74
- export const MEMBER_LEFT_GROUP = "MEMBER_LEFT_GROUP"
75
- export const LEAD_UPDATED = "LEAD_UPDATED";
76
- export const TOUCHING_OPERATOR = "TOUCHING_OPERATOR";
77
- export const LIVE_PAGE = "LIVE_PAGE"
71
+ export enum INFO_MESSAGE_TYPE {
72
+ CHAT_REOPENED = 'CHAT_REOPENED',
73
+ CHAT_CLOSED = 'CHAT_CLOSED',
74
+ MEMBER_JOINED_GROUP = 'MEMBER_JOINED_GROUP',
75
+ MEMBER_LEFT_GROUP = "MEMBER_LEFT_GROUP",
76
+ LEAD_UPDATED = "LEAD_UPDATED",
77
+ TOUCHING_OPERATOR = "TOUCHING_OPERATOR",
78
+ LIVE_PAGE = "LIVE_PAGE"
79
+ }
78
80
 
79
81
  // URLS
80
82
  // export const URL_SOUND = 'assets/sounds/pling.mp3';
@@ -7,7 +7,8 @@ import {
7
7
  MESSAGE_TYPE_OTHERS,
8
8
  MAX_WIDTH_IMAGES,
9
9
  CHANNEL_TYPE_GROUP,
10
- TYPE_SUPPORT_GROUP
10
+ TYPE_SUPPORT_GROUP,
11
+ INFO_MESSAGE_TYPE
11
12
  } from './constants';
12
13
 
13
14
  /** */
@@ -122,6 +123,27 @@ export function messageType(msgType: string, message: any) {
122
123
  }
123
124
  }
124
125
 
126
+ export function infoMessageType(msg: MessageModel): string{
127
+ if(msg && msg.attributes.messagelabel && msg.attributes.messagelabel.key === INFO_MESSAGE_TYPE.MEMBER_JOINED_GROUP){
128
+ return INFO_MESSAGE_TYPE.MEMBER_JOINED_GROUP
129
+ }
130
+ if(msg && msg.attributes.messagelabel && msg.attributes.messagelabel.key === INFO_MESSAGE_TYPE.CHAT_REOPENED){
131
+ return INFO_MESSAGE_TYPE.CHAT_REOPENED
132
+ }
133
+ if(msg && msg.attributes.messagelabel && msg.attributes.messagelabel.key === INFO_MESSAGE_TYPE.TOUCHING_OPERATOR){
134
+ return INFO_MESSAGE_TYPE.TOUCHING_OPERATOR
135
+ }
136
+ if(msg && msg.attributes.messagelabel && msg.attributes.messagelabel.key === INFO_MESSAGE_TYPE.LEAD_UPDATED){
137
+ return INFO_MESSAGE_TYPE.LEAD_UPDATED
138
+ }
139
+ if(msg && msg.attributes.messagelabel && msg.attributes.messagelabel.key === INFO_MESSAGE_TYPE.MEMBER_LEFT_GROUP){
140
+ return INFO_MESSAGE_TYPE.MEMBER_LEFT_GROUP
141
+ }
142
+ if(msg && msg.attributes.messagelabel && msg.attributes.messagelabel.key === INFO_MESSAGE_TYPE.LIVE_PAGE){
143
+ return INFO_MESSAGE_TYPE.LIVE_PAGE
144
+ }
145
+ }
146
+
125
147
  /** */
126
148
  export function getSizeImg(message: any, maxWidthImage?: number): any {
127
149
  try {