@chat21/chat21-web-widget 5.0.48-rc.2 → 5.0.48-rc.3

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/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.48-rc.2",
4
+ "version": "5.0.48-rc.3",
5
5
  "license": "MIT License",
6
6
  "homepage": "https://www.tiledesk.com",
7
7
  "repository": {
@@ -147,7 +147,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
147
147
  return;
148
148
  }
149
149
 
150
- if(conversation.sender !== this.g.senderId && !isInfo(conversation)){
150
+ if(conversation.is_new && conversation.sender !== this.g.senderId && !isInfo(conversation)){
151
151
  that.manageTabNotification();
152
152
  }
153
153
 
@@ -1422,6 +1422,13 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
1422
1422
  });
1423
1423
  };
1424
1424
 
1425
+ /** set state reinit */
1426
+ windowContext['tiledesk'].startConversation = function () {
1427
+ ngZone.run(() => {
1428
+ windowContext['tiledesk']['angularcomponent'].component.onNewConversation();
1429
+ });
1430
+ };
1431
+
1425
1432
  /** set state reinit */
1426
1433
  windowContext['tiledesk'].reInit = function () {
1427
1434
  ngZone.run(() => {
@@ -8,7 +8,6 @@ import { Subscription } from 'rxjs';
8
8
 
9
9
  import {
10
10
  CHANNEL_TYPE_DIRECT, CHANNEL_TYPE_GROUP, TYPE_MSG_TEXT,
11
- MSG_STATUS_SENT, MSG_STATUS_RETURN_RECEIPT, MSG_STATUS_SENT_SERVER,
12
11
  UID_SUPPORT_GROUP_MESSAGES
13
12
  } from 'src/app/utils/constants';
14
13
 
@@ -46,6 +45,7 @@ import { StarRatingWidgetService } from 'src/app/providers/star-rating-widget.se
46
45
  import { TiledeskRequestsService } from 'src/chat21-core/providers/tiledesk/tiledesk-requests.service';
47
46
  import moment from 'moment';
48
47
  import { isUserBanned } from 'src/chat21-core/utils/utils-message';
48
+ import { LIVE_PAGE } from 'src/chat21-core/utils/constants';
49
49
  // import { TranslateService } from '@ngx-translate/core';
50
50
 
51
51
  @Component({
@@ -254,6 +254,7 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
254
254
  'INFO_A_NEW_SUPPORT_REQUEST_HAS_BEEN_ASSIGNED_TO_YOU',
255
255
  'INFO_SUPPORT_LEAD_UPDATED',
256
256
  'INFO_SUPPORT_MEMBER_LEFT_GROUP',
257
+ 'INFO_SUPPORT_LIVE_PAGE',
257
258
  'LABEL_TODAY',
258
259
  'LABEL_TOMORROW',
259
260
  'LABEL_LOADING',
@@ -577,7 +578,7 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
577
578
 
578
579
  /* SEND FIRST MESSAGE if preChatForm has 'firstMessage' key */
579
580
  this.sendFirstMessagePreChatForm()
580
-
581
+
581
582
  this.logger.debug('[CONV-COMP] DETTAGLIO CONV - messages **************', this.messages);
582
583
  this.chatManager.addConversationHandler(this.conversationHandlerService);
583
584
 
@@ -626,6 +627,23 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
626
627
  }, 1000);
627
628
  }
628
629
 
630
+ /**
631
+ * allow widget to send Live info about the current page where the user is located (sourcePage and sourceTitle)
632
+ * NOT IN USE
633
+ */
634
+ sendLivePage(){
635
+ setTimeout(() => {
636
+ const message= 'Moved to: ' + this.g.attributes.sourcePage
637
+ const attributes={
638
+ subtype: 'info/support',
639
+ messagelabel: {key: LIVE_PAGE}
640
+ }
641
+ this.logger.debug('[CONV-COMP] sendLivePage --> attributes+message', attributes, message)
642
+ this.conversationFooter.sendMessage(message, TYPE_MSG_TEXT, null, attributes);
643
+ }, 1000);
644
+
645
+ }
646
+
629
647
 
630
648
  initializeTyping() {
631
649
  this.logger.debug('[CONV-COMP] membersconversation', this.membersConversation)
@@ -902,6 +920,8 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
902
920
  this.appStorageService.setItem('attributes', JSON.stringify(this.g.attributes));
903
921
  }
904
922
 
923
+
924
+
905
925
  scrollToBottom() {
906
926
  this.conversationContent.scrollToBottom();
907
927
  // const that = this;
@@ -1549,6 +1549,7 @@
1549
1549
  <button class="btn btn-light" onclick="onClickTestButton('close')">Close <em class="fa fa-arrow-down"></em></button>
1550
1550
  <button class="btn btn-light" onclick="onClickTestButton('hide')">Hide</button>
1551
1551
  <button class="btn btn-light" onclick="onClickTestButton('show')">Show</button>
1552
+ <button class="btn btn-light" onclick="onClickTestButton('startConversation')">Start Conversation</button>
1552
1553
  <button class="btn btn-light" onclick="onClickTestButton('dispose')">Dispose</button>
1553
1554
  <button class="btn btn-light" onclick="onClickTestButton('showCallout')">Show callout</button>
1554
1555
  <button class="btn btn-light" onclick="onClickTestButton('reInit')">ReInit</button>
@@ -1,4 +1,4 @@
1
- import { MEMBER_LEFT_GROUP, TOUCHING_OPERATOR } from './../../utils/constants';
1
+ import { LIVE_PAGE, MEMBER_LEFT_GROUP, TOUCHING_OPERATOR } from './../../utils/constants';
2
2
  import { CustomLogger } from './../logger/customLogger';
3
3
 
4
4
  import { Inject, Injectable, Optional } from '@angular/core';
@@ -372,6 +372,7 @@ export class FirebaseConversationHandler extends ConversationHandlerService {
372
372
  const INFO_SUPPORT_LEAD_UPDATED = this.translationMap.get('INFO_SUPPORT_LEAD_UPDATED');
373
373
  const INFO_SUPPORT_MEMBER_LEFT_GROUP = this.translationMap.get('INFO_SUPPORT_MEMBER_LEFT_GROUP');
374
374
  const INFO_A_NEW_SUPPORT_REQUEST_HAS_BEEN_ASSIGNED_TO_YOU = this.translationMap.get('INFO_A_NEW_SUPPORT_REQUEST_HAS_BEEN_ASSIGNED_TO_YOU');
375
+ const INFO_SUPPORT_LIVE_PAGE = this.translationMap.get('INFO_SUPPORT_LIVE_PAGE');
375
376
 
376
377
  if (message.attributes.messagelabel
377
378
  && message.attributes.messagelabel.parameters
@@ -413,13 +414,19 @@ export class FirebaseConversationHandler extends ConversationHandlerService {
413
414
  } else if ((message.attributes.messagelabel && message.attributes.messagelabel.key === LEAD_UPDATED)) {
414
415
  message.text = INFO_SUPPORT_LEAD_UPDATED;
415
416
  } else if ((message.attributes.messagelabel && message.attributes.messagelabel.key === MEMBER_LEFT_GROUP)) {
416
- let subject: string;
417
+ let subject: string = '';
417
418
  if (message.attributes.messagelabel.parameters.fullname) {
418
419
  subject = message.attributes.messagelabel.parameters.fullname;
419
420
  }else{
420
421
  subject = message.attributes.messagelabel.parameters.member_id;
421
422
  }
422
423
  message.text = subject + ' ' + INFO_SUPPORT_MEMBER_LEFT_GROUP ;
424
+ }else if(message.attributes.messagelabel && message.attributes.messagelabel.key === LIVE_PAGE){
425
+ let sourceUrl: string = '';
426
+ if(message.attributes && message.attributes.sourcePage){
427
+ sourceUrl = message.attributes.sourcePage
428
+ }
429
+ message.text= INFO_SUPPORT_LIVE_PAGE + ' ' + sourceUrl
423
430
  }
424
431
  }
425
432
 
@@ -156,7 +156,7 @@ export class MQTTConversationsHandler extends ConversationsHandlerService {
156
156
  this.changed(conversation);
157
157
  }
158
158
  else {
159
- this.logger.log('[MQTTConversationsHandler]Added conv -> Added!')
159
+ this.logger.log('[MQTTConversationsHandler] Added conv -> Added!')
160
160
  this.added(conversation);
161
161
  }
162
162
  });
@@ -269,10 +269,12 @@ export class MQTTConversationsHandler extends ConversationsHandlerService {
269
269
  conversation.conversation_with = conversation.conversWith // conversWith comes from remote
270
270
  }
271
271
  const index = searchIndexInArrayForUid(this.conversations, conversation.conversation_with);
272
+ const oldConversation = this.conversations[index]
272
273
  if (index > -1) {
273
274
  this.updateConversationWithSnapshot(this.conversations[index], conversation);
274
275
  this.logger.debug('[MQTTConversationsHandler] conversationchanged.isnew', JSON.stringify(conversation))
275
276
  this.conversationChanged.next(this.conversations[index]);
277
+ this.conversationChangedDetailed.next({value: this.conversations[index], previousValue: oldConversation})
276
278
  this.conversations.splice(index, 1, this.conversations[index])
277
279
  this.conversations.sort(compareValues('timestamp', 'desc'));
278
280
  }
@@ -65,6 +65,7 @@ export const MEMBER_JOINED_GROUP = 'MEMBER_JOINED_GROUP';
65
65
  export const MEMBER_LEFT_GROUP = "MEMBER_LEFT_GROUP"
66
66
  export const LEAD_UPDATED = "LEAD_UPDATED";
67
67
  export const TOUCHING_OPERATOR = "TOUCHING_OPERATOR";
68
+ export const LIVE_PAGE = "LIVE_PAGE"
68
69
 
69
70
  // URLS
70
71
  // export const URL_SOUND = 'assets/sounds/pling.mp3';
@@ -19,7 +19,7 @@
19
19
  "appId": "tilechat",
20
20
  "MQTTendpoint": "wss://eu.rtmv3.tiledesk.com/mqws/ws",
21
21
  "APIendpoint": "https://eu.rtmv3.tiledesk.com/chatapi/api",
22
- "_log": true
22
+ "log": true
23
23
  },
24
24
  "apiUrl": "https://api.tiledesk.com/v3/",
25
25
  "baseImageUrl": "https://eu.rtmv3.tiledesk.com/api/",