@chat21/chat21-ionic 3.0.104 → 3.0.105-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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # chat21-ionic ver 3.0
2
2
 
3
+ ### 3.0.105.rc.1
4
+ - added: get tiledeskToken from tiledesk_token key in favour of appStorageService.getItem('tiledeskToken')
5
+
6
+ ### 3.0.104.1 in PROD
7
+ - minor bug fixing
8
+
3
9
  ### 3.0.104 in PROD
4
10
  - bug-fixed: messages are lost after chrome close all websocket connections due to inactivity and mqtt not reconnected automatically
5
11
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@chat21/chat21-ionic",
3
3
  "author": "Tiledesk SRL",
4
- "version": "3.0.104",
4
+ "version": "3.0.105-rc1",
5
5
  "license": "MIT License",
6
6
  "homepage": "https://tiledesk.com/",
7
7
  "repository": {
@@ -281,11 +281,11 @@ export class AppComponent implements OnInit {
281
281
  this.logger.log('[APP-COMP] ngOnInit AUTOLOGIN token get with getParameterByName ', token)
282
282
  // save token in local storage then
283
283
 
284
- const storedToken = this.appStorageService.getItem('tiledeskToken');
284
+ const storedToken = localStorage.getItem('tiledesk_token')
285
285
  this.logger.log('[APP-COMP] ngOnInit AUTOLOGIN storedToken ', storedToken)
286
286
  this.logger.log('[APP-COMP] ngOnInit AUTOLOGIN SAVE THE PARAMS TOKEN ', token)
287
287
  if (storedToken !== token) {
288
- this.appStorageService.setItem('tiledeskToken', token);
288
+ localStorage.setItem('tiledesk_token', token)
289
289
  } else {
290
290
  this.logger.log('[APP-COMP] ngOnInit AUTOLOGIN the current user already exist DON\'T SAVE ')
291
291
  }
@@ -506,7 +506,7 @@ export class AppComponent implements OnInit {
506
506
  this.deeplinks.route({'/conversation-detail': ConversationListPage}).subscribe(match => {
507
507
  this.logger.log('[APP-COMP] deeplinks match route', JSON.stringify(match.$args))
508
508
  if(match.$args && match.$args.jwt){
509
- this.appStorageService.setItem('tiledeskToken', decodeURIComponent(match.$args.jwt))
509
+ localStorage.setItem('tiledesk_token', decodeURIComponent(match.$args.jwt))
510
510
  this.initAuthentication()
511
511
  }
512
512
  }, (nomatch)=> {
@@ -697,7 +697,7 @@ export class AppComponent implements OnInit {
697
697
  /***************************************************+*/
698
698
  /**------- AUTHENTICATION FUNCTIONS --> START <--- +*/
699
699
  private initAuthentication() {
700
- const tiledeskToken = this.appStorageService.getItem('tiledeskToken')
700
+ const tiledeskToken = localStorage.getItem('tiledesk_token')
701
701
 
702
702
  this.logger.log('[APP-COMP] >>> INIT-AUTHENTICATION !!! ')
703
703
  this.logger.log('[APP-COMP] >>> initAuthentication tiledeskToken ', tiledeskToken)
@@ -1381,10 +1381,13 @@ export class AppComponent implements OnInit {
1381
1381
  }
1382
1382
 
1383
1383
  private segmentSignIn(){
1384
+ const that = this
1384
1385
  let user = this.tiledeskAuthService.getCurrentUser()
1385
1386
  if(window['analytics']){
1386
1387
  try {
1387
- window['analytics'].page("Chat Auth Page, Signin", {});
1388
+ window['analytics'].page("Chat Auth Page, Signin", {
1389
+ version: that.version
1390
+ });
1388
1391
  } catch (err) {
1389
1392
  this.logger.error('Event:Signed In [page] error', err);
1390
1393
  }
@@ -160,13 +160,13 @@
160
160
  </ion-note>
161
161
 
162
162
  <ion-buttons slot="end">
163
- <ion-button *ngIf="!conversation.archived" tooltip="{{ translationsMap?.get('Resolve')}}" placement="bottom"
163
+ <ion-button *ngIf="!conversation.archived" placement="bottom"
164
164
  [ngClass]="{'hide': !isApp, 'button-on-desktop': !isApp, 'button-on-mobile': isApp }"
165
165
  id="{{ 'close_conversation_button' + conversation.uid }}" class="close-conversation-button" ion-button clear
166
166
  item-end (click)="closeConversation(conversation);$event.stopPropagation();" padding>
167
167
  <ion-icon slot="icon-only" style="display:block;" id="{{ 'close_button_icon' + conversation.uid }}" name="archive-outline" item-end></ion-icon>
168
- <div *ngIf="conversation?.recipient.startsWith('support-group')" tooltip="{{ translationsMap?.get('Resolve')}}"></div>
169
- <div *ngIf="conversation?.recipient.startsWith('support-group')" tooltip="{{ translationsMap?.get('Archive')}}"></div>
168
+ <!-- <div *ngIf="conversation?.recipient.startsWith('support-group')" tooltip="{{ translationsMap?.get('Resolve')}}"></div>
169
+ <div *ngIf="conversation?.recipient.startsWith('support-group')" tooltip="{{ translationsMap?.get('Archive')}}"></div> -->
170
170
  </ion-button>
171
171
 
172
172
  <!-- <ion-button *ngIf="conversation?.recipient.startsWith('support-group') && !conversation.archived" [tooltip]="joinTooltip" [options]="tooltip_options" placement="bottom" content-type="template"
@@ -137,7 +137,7 @@ export class LoginComponent implements OnInit {
137
137
  signInWithGoogle(){
138
138
  // const url = this.SERVER_BASE_PATH + "auth/google"
139
139
  const url = "https://eu.rtmv3.tiledesk.com/api/auth/google" + '?forced_redirect_url=chat://conversation-detail?from=google'
140
- this.iab.create(url, '_system', 'locaation=yes')
140
+ this.iab.create(url, '_system', 'location=yes')
141
141
  }
142
142
 
143
143
  /** */
@@ -124,6 +124,7 @@ export class LoginPage implements OnInit {
124
124
  this.tiledeskAuthService.signInWithEmailAndPassword(auth.email, auth.password)
125
125
  .then(tiledeskToken => {
126
126
  this.messagingAuthService.createCustomToken(tiledeskToken)
127
+ localStorage.setItem('tiledesk_token', tiledeskToken)
127
128
  // Here edit stored current user
128
129
  // this.updateStoredCurrentUser()
129
130
  })
@@ -325,10 +325,8 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
325
325
  // console.log('[CONVS-DETAIL] conversations', conversations);
326
326
  this.conversation_count = conversations.length
327
327
  if (conv && this.loggedUser && conv.sender !== this.loggedUser.uid) {
328
- this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange data sender ', conv.sender)
328
+ this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange ', conv)
329
329
  this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange this.loggedUser.uid ', this.loggedUser.uid)
330
- this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange is_new ', conv.is_new)
331
- this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange showButtonToBottom ', this.showButtonToBottom)
332
330
  // UPDATE THE CONVERSATION TO 'READ' IF IT IS ME WHO WRITES THE LAST MESSAGE OF THE CONVERSATION
333
331
  // AND IF THE POSITION OF THE SCROLL IS AT THE END
334
332
  // if (!this.showButtonToBottom && conv.is_new) {
@@ -748,15 +746,15 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
748
746
  // .set('buttonHoverBackgroundColor', 'var(--buttonHoverBackgroundColor)')
749
747
  // .set('buttonHoverTextColor', 'var(--buttonHoverTextColor)')
750
748
  this.styleMap.set('themeColor', '#2a69c1')
751
- .set('bubbleReceivedBackground', '#f0f2f7')
752
- .set('bubbleReceivedTextColor', '#06132b')
753
- .set('bubbleSentBackground', '#2a6ac1')
754
- .set('bubbleSentTextColor', '#ffffff')
755
- .set('buttonFontSize', '15px')
756
- .set('buttonBackgroundColor', '#ffffff')
757
- .set('buttonTextColor', '#2a6ac1')
758
- .set('buttonHoverBackgroundColor', '#2a6ac1')
759
- .set('buttonHoverTextColor', ' #ffffff')
749
+ .set('bubbleReceivedBackground', '#f0f2f7')
750
+ .set('bubbleReceivedTextColor', '#06132b')
751
+ .set('bubbleSentBackground', '#2a6ac1')
752
+ .set('bubbleSentTextColor', '#ffffff')
753
+ .set('buttonFontSize', '15px')
754
+ .set('buttonBackgroundColor', '#ffffff')
755
+ .set('buttonTextColor', '#2a6ac1')
756
+ .set('buttonHoverBackgroundColor', '#2a6ac1')
757
+ .set('buttonHoverTextColor', ' #ffffff')
760
758
 
761
759
  }
762
760
  // -------------------------------------------------------------------------------------
@@ -1116,14 +1114,17 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1116
1114
 
1117
1115
 
1118
1116
  const emailSectionMsg = (attributes && attributes['offline_channel'] === TYPE_MSG_EMAIL)
1119
- const channelIsNotEmailOrFormOrWhatsapp = (attributes && attributes['request_channel'] && (attributes['request_channel'] === TYPE_MSG_EMAIL || attributes['request_channel'] === TYPE_MSG_FORM || attributes['request_channel'] === CHANNEL_TYPE_WHATSAPP))
1117
+ const channelIsNotEmailOrFormOrWhatsappOrTelegram = (attributes && attributes['request_channel'] && (attributes['request_channel'] === TYPE_MSG_EMAIL ||
1118
+ attributes['request_channel'] === TYPE_MSG_FORM ||
1119
+ attributes['request_channel'] === CHANNEL_TYPE_WHATSAPP ||
1120
+ attributes['request_channel'] === CHANNEL_TYPE_TELEGRAM))
1120
1121
 
1121
1122
  if ((msg && msg.trim() !== '') || type !== TYPE_MSG_TEXT) {
1122
1123
 
1123
1124
 
1124
1125
  if (this.isEmailEnabled &&
1125
1126
  this.leadInfo && this.leadInfo.presence && this.leadInfo.presence['status'] === 'offline' &&
1126
- this.leadInfo.email && !emailSectionMsg && !channelIsNotEmailOrFormOrWhatsapp) {
1127
+ this.leadInfo.email && !emailSectionMsg && !channelIsNotEmailOrFormOrWhatsappOrTelegram) {
1127
1128
  this.logger.log('[CONVS-DETAIL] - SEND MESSAGE --> SENDING EMAIL', msg, this.leadInfo.email)
1128
1129
  let msgText = this.createEmailText(msg)
1129
1130
  this.sendEmail(msgText).subscribe(status => {
@@ -583,7 +583,7 @@ export class ConversationListPage implements OnInit {
583
583
  if (conversation) {
584
584
  this.onImageLoaded(conversation)
585
585
  this.onConversationLoaded(conversation)
586
- conversation.is_new && this.isInitialized? this.segmentNewConversationAdded(conversation) : null;
586
+ // conversation.is_new && this.isInitialized? this.segmentNewConversationAdded(conversation) : null;
587
587
  }
588
588
  })
589
589
 
@@ -852,9 +852,6 @@ export class ConversationListPage implements OnInit {
852
852
  conversation.attributes.project_name = project['name']
853
853
  }
854
854
  }
855
- // if(conversation.conversation_with_fullname === 'Guest '){
856
- // conversation.conversation_with_fullname = 'guest' + '#' + this.getUUidConversation(conversation.uid)
857
- // }
858
855
 
859
856
  }
860
857
 
@@ -1142,103 +1139,4 @@ export class ConversationListPage implements OnInit {
1142
1139
  }
1143
1140
  }
1144
1141
 
1145
- // ------------------------------------------------------------------
1146
- // !!! Not used methods !!!
1147
- // ------------------------------------------------------------------
1148
-
1149
- // /**
1150
- // * ::: openArchivedConversationsPage :::
1151
- // * Open the archived conversations page
1152
- // * (metodo richiamato da html)
1153
- // */
1154
- // openArchivedConversationsPage() {
1155
- // this.logger.log('[CONVS-LIST-PAGE] openArchivedConversationsPage');
1156
- // }
1157
-
1158
- // // info page
1159
- // returnCloseInfoPage() {
1160
- // this.logger.log('[CONVS-LIST-PAGE] returnCloseInfoPage');
1161
- // // this.isShowMenuPage = false;
1162
- // this.initialize();
1163
-
1164
- // }
1165
-
1166
- // private navigatePage() {
1167
- // this.logger.log('[CONVS-LIST-PAGE] navigatePage:: >>>> conversationSelected ', this.conversationSelected);
1168
- // let urlPage = 'detail/';
1169
- // if (this.conversationSelected) {
1170
- // // urlPage = 'conversation-detail/' + this.uidConvSelected;
1171
- // urlPage = 'conversation-detail/' + this.uidConvSelected + '/' + this.conversationSelected.conversation_with_fullname;
1172
- // // this.openDetailsWithState(this.conversationSelected);
1173
- // }
1174
- // // else {
1175
- // // this.router.navigateByUrl('detail');
1176
- // // }
1177
-
1178
- // const navigationExtras: NavigationExtras = {
1179
- // state: {
1180
- // conversationSelected: this.conversationSelected
1181
- // }
1182
- // };
1183
- // this.navService.openPage(urlPage, ConversationDetailPage, navigationExtras);
1184
- // }
1185
-
1186
- // openDetailsWithState(conversationSelected) {
1187
- // console.log('openDetailsWithState:: >>>> conversationSelected ', conversationSelected);
1188
- // let navigationExtras: NavigationExtras = {
1189
- // state: {
1190
- // conversationSelected: conversationSelected
1191
- // }
1192
- // };
1193
- // this.router.navigate(['conversation-detail/' + this.uidConvSelected], navigationExtras);
1194
- // }
1195
-
1196
- // /**
1197
- // * ::: subscribeLoggedUserLogin :::
1198
- // * effettuato il login:
1199
- // * 1 - imposto loggedUser
1200
- // * 2 - dismetto modale
1201
- // * 3 - inizializzo elenco conversazioni
1202
- // */
1203
- // subscribeLoggedUserLogin = (user: any) => {
1204
- // console.log('3 ************** subscribeLoggedUserLogin', user);
1205
- // this.loggedUser = user;
1206
- // try {
1207
- // closeModal(this.modalController);
1208
- // } catch (err) {
1209
- // console.error('-> error:', err);
1210
- // }
1211
- // this.initialize();
1212
- // }
1213
-
1214
- /**
1215
- * ::: conversationsChanged :::
1216
- * evento richiamato su add, change, remove dell'elenco delle conversazioni
1217
- * 1 - aggiorno elenco conversazioni
1218
- * 2 - aggiorno il conto delle nuove conversazioni
1219
- * 4 - se esiste un uidReciverFromUrl (passato nell'url)
1220
- * e se esiste una conversazione con lo stesso id di uidReciverFromUrl
1221
- * imposto questa come conversazione attiva (operazione da fare una sola volta al caricamento delle conversazioni)
1222
- * e la carico nella pagina di dettaglio e azzero la variabile uidReciverFromUrl!!!
1223
- * 5 - altrimenti se esiste una conversazione con lo stesso id della conversazione attiva
1224
- * e la pagina di dettaglio è vuota (placeholder), carico la conversazione attiva (uidConvSelected) nella pagina di dettaglio
1225
- * (operazione da fare una sola volta al caricamento delle conversazioni)
1226
- */
1227
-
1228
- // ------------------------------------------------------------------------------------
1229
- // ::: readAllMessages ::: ??????????? SEEMS NOT USED ?????????????????
1230
- // when all chat messages are displayed,
1231
- // that is when in the conversation detail I go to the bottom of the page,
1232
- // the readAllMessages event is triggered and is intercepted in the conversation list
1233
- // and modify the current conversation by bringing is_new to false
1234
- // ------------------------------------------------------------------------------------
1235
- // readAllMessages = (uid: string) => {
1236
- // this.logger.log('[CONVS-LIST-PAGE] readAllMessages', uid);
1237
- // const conversationSelected = this.conversations.find(item => item.uid === this.uidConvSelected);
1238
- // if (conversationSelected) {
1239
- // conversationSelected.is_new = false;
1240
- // conversationSelected.status = '0';
1241
- // conversationSelected.selected = true;
1242
- // }
1243
- // }
1244
1142
  }
@@ -323,6 +323,11 @@ export class MQTTConversationsHandler extends ConversationsHandlerService {
323
323
  // this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
324
324
  conv.type = snap[k];
325
325
  }
326
+ if (k === 'conversation_with_fullname') {
327
+ // this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
328
+ conv.conversation_with_fullname = snap[k];
329
+ }
330
+ conv = this.completeConversation(conv)
326
331
  });
327
332
  }
328
333