@chat21/chat21-web-widget 5.0.52-rc.4 → 5.0.53-rc.1

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 (46) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/angular.json +1 -3
  3. package/dist/assets/twp/chatbot-panel.html +4 -64
  4. package/dist/base_script.html +57 -0
  5. package/dist/launch.js +4 -61
  6. package/dist/main.js +1 -1
  7. package/package.json +1 -1
  8. package/src/app/app.component.ts +4 -12
  9. package/src/app/app.module.ts +2 -0
  10. package/src/app/component/conversation-detail/conversation/conversation.component.html +13 -1
  11. package/src/app/component/conversation-detail/conversation/conversation.component.scss +19 -0
  12. package/src/app/component/conversation-detail/conversation/conversation.component.ts +51 -30
  13. package/src/app/component/conversation-detail/conversation-content/conversation-content.component.ts +0 -1
  14. package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.ts +22 -2
  15. package/src/app/component/conversation-detail/conversation-preview/conversation-preview.component.ts +0 -1
  16. package/src/app/component/eyeeye-catcher-card/eyeeye-catcher-card.component.ts +1 -2
  17. package/src/app/component/form/prechat-form/prechat-form.component.ts +0 -12
  18. package/src/app/component/home/home.component.html +7 -15
  19. package/src/app/component/home-conversations/home-conversations.component.ts +12 -72
  20. package/src/app/component/list-conversations/list-conversations.component.ts +1 -57
  21. package/src/app/component/message/avatar/avatar.component.ts +0 -1
  22. package/src/app/component/message/bubble-message/bubble-message.component.ts +0 -2
  23. package/src/app/component/message/image/image.component.ts +0 -1
  24. package/src/app/providers/global-settings.service.ts +2 -3
  25. package/src/app/providers/translator.service.ts +0 -2
  26. package/src/app/utils/globals.ts +1 -7
  27. package/src/app/utils/rules.ts +13 -0
  28. package/src/assets/twp/chatbot-panel.html +4 -64
  29. package/src/base_script.html +57 -0
  30. package/src/chat21-core/providers/abstract/logger.service.ts +1 -0
  31. package/src/chat21-core/providers/firebase/firebase-archivedconversations-handler.ts +0 -41
  32. package/src/chat21-core/providers/firebase/firebase-conversation-handler.ts +0 -4
  33. package/src/chat21-core/providers/firebase/firebase-image-repo.ts +0 -2
  34. package/src/chat21-core/providers/firebase/firebase-notifications.ts +1 -75
  35. package/src/chat21-core/providers/logger/customLogger.ts +4 -0
  36. package/src/chat21-core/providers/mqtt/chat-service.ts +1 -3
  37. package/src/chat21-core/providers/mqtt/mqtt-archivedconversations-handler.ts +0 -1
  38. package/src/chat21-core/providers/mqtt/mqtt-notifications.ts +0 -2
  39. package/src/chat21-core/providers/mqtt/mqtt-presence.service.ts +0 -13
  40. package/src/launch.js +4 -61
  41. package/dist/test-auth-remote.html +0 -95
  42. package/dist/test-auth.html +0 -49
  43. package/dist/test-buttons.html +0 -147
  44. package/src/test-auth-remote.html +0 -95
  45. package/src/test-auth.html +0 -49
  46. package/src/test-buttons.html +0 -147
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.52-rc.4",
4
+ "version": "5.0.53-rc.1",
5
5
  "license": "MIT License",
6
6
  "homepage": "https://www.tiledesk.com",
7
7
  "repository": {
@@ -43,6 +43,7 @@ import { supports_html5_storage } from 'src/chat21-core/utils/utils';
43
43
  import { AUTH_STATE_OFFLINE, AUTH_STATE_ONLINE, TYPE_MSG_FILE, TYPE_MSG_IMAGE, URL_SOUND_LIST_CONVERSATION } from 'src/chat21-core/utils/constants';
44
44
  import { isInfo, isUserBanned } from 'src/chat21-core/utils/utils-message';
45
45
  import { MessageModel } from 'src/chat21-core/models/message';
46
+ import { Rules } from './utils/rules';
46
47
 
47
48
  interface MessageObj {
48
49
  tenant?: string;
@@ -107,6 +108,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
107
108
  private el: ElementRef,
108
109
  private ngZone: NgZone,
109
110
  public g: Globals,
111
+ private rules: Rules,
110
112
  public triggerHandler: Triggerhandler,
111
113
  public globalSettingsService: GlobalSettingsService,
112
114
  private settingsSaverService: SettingsSaverService,
@@ -945,23 +947,13 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
945
947
  if(error){
946
948
  this.logger.error("[APP-COMP] getConverationRESTApi: ERORR while retriving data", error)
947
949
  }
950
+
948
951
  if(conv){
949
952
  //start widget from this conversation
950
953
  const recipientId : string = conv.uid
951
954
  this.g.setParameter('recipientId', recipientId);
952
955
  this.appStorageService.setItem('recipientId', recipientId)
953
- // this.startUI();
954
- // if (this.g.isOpen === true) {
955
- // console.log('conversation from rest API go to conversationdetail -->', recipientId)
956
- // this.isOpenHome = false;
957
- // this.isOpenConversation = true;
958
- // this.isOpenSelectionDepartment = false;
959
- // this.isConversationArchived = false;
960
- // this.triggerOnOpenEvent();
961
- // } else {
962
- // this.triggerOnCloseEvent();
963
- // }
964
- }else {
956
+ } else {
965
957
  //start widget with NEW CONVERSATION
966
958
  this.logger.debug("[APP-COMP] getConverationRESTApi: NO active conversations")
967
959
  // this.isOpenHome = false;
@@ -127,6 +127,7 @@ import { Triggerhandler } from 'src/chat21-core/utils/triggerHandler';
127
127
  import { WaitingService } from './providers/waiting.service';
128
128
  import { StarRatingWidgetService } from './providers/star-rating-widget.service';
129
129
  import { LikeUnlikeComponent } from './component/message/like-unlike/like-unlike.component';
130
+ import { Rules } from './utils/rules';
130
131
 
131
132
 
132
133
  const appInitializerFn = (appConfig: AppConfigService, logger: NGXLogger) => {
@@ -315,6 +316,7 @@ export function uploadFactory(http: HttpClient, appConfig: AppConfigService, app
315
316
  AppConfigService,
316
317
  Chat21Service,
317
318
  Globals,
319
+ Rules,
318
320
  GlobalSettingsService,
319
321
  SettingsSaverService,
320
322
  StarRatingWidgetService,
@@ -37,6 +37,12 @@
37
37
  (onMenuOptionShow)="onMenuOption($event)">
38
38
  </chat-conversation-header>
39
39
 
40
+ <div id="dropZone_container" *ngIf="isHovering">
41
+ <div class="drop">
42
+ drop zone
43
+ </div>
44
+ </div>
45
+
40
46
  <!-- CONTENT -->
41
47
  <chat-conversation-content
42
48
  [messages]="messages"
@@ -55,9 +61,14 @@
55
61
  (onAttachmentButtonClicked)="onAttachmentButtonClicked($event)"
56
62
  (onScrollContent)="onScrollContent($event)"
57
63
  (onMenuOptionShow)="onMenuOption($event)"
58
- (onEmojiiPickerShow)="onEmojiiPickerShow($event)">
64
+ (onEmojiiPickerShow)="onEmojiiPickerShow($event)"
65
+ (drop)="drop($event)"
66
+ (dragover)="allowDrop($event)"
67
+ (dragleave)="drag($event)" >
59
68
  </chat-conversation-content>
60
69
 
70
+
71
+
61
72
  <!-- INTERNAL FRAME FOR SELF ACTION LINK BUTTONS-->
62
73
  <chat-internal-frame *ngIf="isButtonUrl"
63
74
  [button]="buttonClicked"
@@ -105,6 +116,7 @@
105
116
  [isEmojiiPickerShow]="isEmojiiPickerShow"
106
117
  [footerMessagePlaceholder]="footerMessagePlaceholder"
107
118
  [fileUploadAccept]="appConfigService?.getConfig().fileUploadAccept"
119
+ [dropEvent]="dropEvent"
108
120
  [stylesMap]="stylesMap"
109
121
  [translationMap]="translationMapFooter"
110
122
  (onEmojiiPickerShow)="onEmojiiPickerShow($event)"
@@ -468,6 +468,25 @@
468
468
 
469
469
  }
470
470
 
471
+ #dropZone_container{
472
+ position: absolute;
473
+ top: 52px;
474
+ bottom: 56px;
475
+ left: 0;
476
+ right: 0;
477
+ background-color: rgba(240,248,255,0.6);
478
+ .drop{
479
+ position: absolute;
480
+ top: 0;
481
+ bottom: 0;
482
+ left: 0;
483
+ right: 0;
484
+ margin: 5px;
485
+ border: 2px dashed #a4acb3;
486
+ border-radius: 16px;
487
+ }
488
+ }
489
+
471
490
  /* ==================== OPTION MENU CONTAINER ==================== */
472
491
  #c21-options-menu {
473
492
  width: auto;
@@ -139,6 +139,11 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
139
139
  isIE = /msie\s|trident\//i.test(window.navigator.userAgent);
140
140
  firstScroll = true;
141
141
 
142
+ // ========== begin:: DRAG & DROP =======
143
+ isHovering: boolean = false
144
+ dropEvent: Event
145
+ // ========== end:: DRAG & DROP =======
146
+
142
147
  tooltipOptions = {
143
148
  'show-delay': 1500,
144
149
  'tooltip-class': 'chat-tooltip',
@@ -929,7 +934,6 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
929
934
  // try {
930
935
  // that.isScrolling = true;
931
936
  // const objDiv = document.getElementById(that.idDivScroll) as HTMLElement;
932
- // console.log('divto scrool', objDiv);
933
937
  // // const element = objDiv[0] as HTMLElement;
934
938
  // setTimeout(function () {
935
939
 
@@ -1180,34 +1184,6 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
1180
1184
  }
1181
1185
  // ========= end:: DESTROY ALL SUBSCRIPTIONS ============//
1182
1186
 
1183
-
1184
-
1185
- /**
1186
- * regola sound message:
1187
- * se lo invio io -> NO SOUND
1188
- * se non sono nella conversazione -> SOUND
1189
- * se sono nella conversazione in fondo alla pagina -> NO SOUND
1190
- * altrimenti -> SOUND
1191
- */
1192
- // soundMessage(timestamp?) {
1193
- // if (!isJustRecived(this.g.startedAt.getTime(), timestamp)) {
1194
- // return;
1195
- // }
1196
- // const soundEnabled = this.g.soundEnabled;
1197
- // const baseLocation = this.g.baseLocation;
1198
- // if ( soundEnabled ) {
1199
- // const that = this;
1200
- // this.audio = new Audio();
1201
- // this.audio.src = baseLocation + '/assets/sounds/justsaying.mp3';
1202
- // this.audio.load();
1203
- // // console.log('conversation play');
1204
- // clearTimeout(this.setTimeoutSound);
1205
- // this.setTimeoutSound = setTimeout(function () {
1206
- // that.audio.play();
1207
- // that.logger.debug('[CONV-COMP] ****** soundMessage 1 *****', that.audio.src);
1208
- // }, 1000);
1209
- // }
1210
- // }
1211
1187
  private onIncreaseWith(){
1212
1188
  try{
1213
1189
  const tiledeskDiv = this.g.windowContext.window.document.getElementById('tiledeskdiv')
@@ -1253,7 +1229,6 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
1253
1229
 
1254
1230
  /** */
1255
1231
  private actionButton(event: any) {
1256
- // console.log(event);
1257
1232
  const action = event.action ? event.action : '';
1258
1233
  const message = event.value ? event.value : '';
1259
1234
  const subtype = event.show_echo ? '' : 'info';
@@ -1280,4 +1255,50 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
1280
1255
  }
1281
1256
  // ========= END:: TRIGGER FUNCTIONS ============//
1282
1257
 
1258
+
1259
+ drop(event){
1260
+ event.preventDefault()
1261
+ event.stopPropagation()
1262
+
1263
+ this.logger.log('[CONV-COMP] ----> FILE - DROP ev ', event)
1264
+ const fileList = event.dataTransfer.files
1265
+ this.logger.log('[CONV-COMP] ----> FILE - DROP ev.dataTransfer.files ',fileList)
1266
+ this.isHovering = false
1267
+ if (fileList.length > 0) {
1268
+ const file: File = fileList[0]
1269
+ this.logger.log('[CONV-COMP] ----> FILE - DROP file ', file)
1270
+
1271
+ var mimeType = fileList[0].type
1272
+ this.logger.log('[CONV-COMP] ----> FILE - DROP mimeType files ', mimeType)
1273
+
1274
+ // if (mimeType.startsWith("image") || mimeType.startsWith("application")) {
1275
+ // this.logger.log('[CONV-COMP] ----> FILE - DROP mimeType files: ', this.appConfigProvider.getConfig().fileUploadAccept);
1276
+ // this.checkAcceptedFile(mimeType);
1277
+ // const isAccepted = this.checkAcceptedFile(mimeType)
1278
+ // this.logger.log('[CONV-COMP] > checkAcceptedFile - fileUploadAccept isAcceptFile FILE - DROP',isAccepted)
1279
+ // if (isAccepted === true) {
1280
+ this.dropEvent = event
1281
+ // } else {
1282
+ // this.logger.log( '[CONV-COMP] ----> FILE - DROP mimeType files ', mimeType,'NOT SUPPORTED FILE TYPE')
1283
+ // this.presentToast(this.translationsMap.get('FAILED_TO_UPLOAD_THE_FORMAT_IS_NOT_SUPPORTED'), 'danger','toast-custom-class', 5000 )
1284
+ // // this.presentToastOnlyImageFilesAreAllowedToDrag()
1285
+ // }
1286
+
1287
+ }
1288
+ }
1289
+
1290
+ allowDrop(event: any) {
1291
+ event.preventDefault()
1292
+ event.stopPropagation()
1293
+ this.logger.log('[CONV-COMP] ----> FILE - (dragover) allowDrop ev ', event)
1294
+ this.isHovering = true
1295
+ }
1296
+
1297
+ drag(event){
1298
+ event.preventDefault()
1299
+ event.stopPropagation()
1300
+ console.log('dragleave-->', event)
1301
+ this.isHovering = false
1302
+ }
1303
+
1283
1304
  }
@@ -148,7 +148,6 @@ export class ConversationContentComponent implements OnInit {
148
148
 
149
149
  // LISTEN TO SCROLL POSITION
150
150
  onScroll(event): void {
151
- // console.log('************** SCROLLLLLLLLLL *****************');
152
151
  this.startScroll = false;
153
152
  if (this.scrollMe) {
154
153
  const divScrollMe = this.scrollMe.nativeElement;
@@ -37,6 +37,7 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
37
37
  @Input() fileUploadAccept: string;
38
38
  @Input() stylesMap: Map<string, string>
39
39
  @Input() translationMap: Map< string, string>;
40
+ @Input() dropEvent: Event;
40
41
  @Output() onEmojiiPickerShow = new EventEmitter<boolean>();
41
42
  @Output() onBeforeMessageSent = new EventEmitter();
42
43
  @Output() onAfterSendMessage = new EventEmitter<MessageModel>();
@@ -86,6 +87,11 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
86
87
  if(changes['hideTextReply'] && changes['hideTextReply'].currentValue !== undefined){
87
88
  this.restoreTextArea();
88
89
  }
90
+
91
+ if(changes['dropEvent'] && changes['dropEvent'].currentValue !== undefined){
92
+ this.onDrop(this.dropEvent)
93
+ }
94
+
89
95
  }
90
96
 
91
97
  ngAfterViewInit() {
@@ -355,7 +361,6 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
355
361
  const target = document.getElementById('chat21-main-message-context') as HTMLInputElement;
356
362
  target.value = '';
357
363
  target.style.height = this.HEIGHT_DEFAULT;
358
- // console.log('target.style.height: ', target.style.height);
359
364
  } catch (e) {
360
365
  this.logger.error('[CONV-FOOTER] > Error :' + e);
361
366
  }
@@ -511,7 +516,6 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
511
516
  */
512
517
  onkeypress(event) {
513
518
  const keyCode = event.which || event.keyCode;
514
- // console.log('keycode', keyCode)
515
519
  this.textInputTextArea = ((document.getElementById('chat21-main-message-context') as HTMLInputElement).value);
516
520
  if (keyCode === 13) { // ENTER pressed
517
521
  if (this.textInputTextArea && this.textInputTextArea.trim() !== '') {
@@ -575,4 +579,20 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
575
579
  }
576
580
  }
577
581
 
582
+ onDrop(event){
583
+ const items = event.dataTransfer.files;
584
+ let file = null;
585
+ this.logger.debug('[CONV-FOOTER] onDrop items ', items);
586
+ for (const item of items) {
587
+ this.logger.debug('[CONV-FOOTER] onDrop item ', item);
588
+ this.logger.debug('[CONV-FOOTER] onDrop item.type ', item.type);
589
+
590
+ const data = {target: {files: new DataTransfer()}}
591
+ data.target.files = items
592
+ this.logger.debug('[CONV-FOOTER] onDrop data', data);
593
+ this.logger.debug('[CONV-FOOTER] onDrop file ', file);
594
+ this.detectFiles(data)
595
+ }
596
+ }
597
+
578
598
  }
@@ -266,7 +266,6 @@ export class ConversationPreviewComponent implements OnInit {
266
266
  this.restoreTextArea();
267
267
  }
268
268
  } else if (keyCode === 9) {
269
- // console.log('TAB pressedddd')
270
269
  event.preventDefault();
271
270
  }
272
271
  }
@@ -77,7 +77,7 @@ export class EyeeyeCatcherCardComponent implements OnInit {
77
77
  this.checkIsEmoji();
78
78
  const isOpen = this.g.isOpen;
79
79
  this.logger.debug('[EYEEYE-CATCHER-CARD] openEyeCatcher: calloutStaus ---------> ', this.g.calloutStaus);
80
- // console.log('this.g.isMobile', this.g.isMobile);
80
+
81
81
  if (isOpen === false && this.g.calloutStaus) { // && this.g.isMobile === false
82
82
  this.onCloseEyeCatcherCard.emit(true);
83
83
  // this.g.displayEyeCatcherCard = 'block';
@@ -104,7 +104,6 @@ export class EyeeyeCatcherCardComponent implements OnInit {
104
104
  while (match = regex.exec(title)) {
105
105
  const emoji = match[0];
106
106
  this.logger.debug('[EYEEYE-CATCHER-CARD]--> match', match)
107
- // console.log(`Matched sequence ${ emoji } — code points: ${ [...emoji].length }`);
108
107
  if (title.indexOf(emoji) === 0) {
109
108
  this.title = title.replace(emoji, '');
110
109
  this.emoticon = emoji;
@@ -92,10 +92,8 @@ export class PrechatFormComponent implements OnInit, AfterViewInit {
92
92
  if (this.g.attributes) {
93
93
  const attributes = this.g.attributes;
94
94
  if ( this.privacyInputField && this.privacyInputField.nativeElement.checked === false) {
95
- // console.log(this.privacyInputField.nativeElement.checked);
96
95
  this.g.privacyApproved = false;
97
96
  const spanCheck = window.document.getElementById('span-checkmark');
98
- // console.log('-----------> ', spanCheck);
99
97
  if (spanCheck) {
100
98
  spanCheck.classList.add('unchecked');
101
99
  }
@@ -118,16 +116,6 @@ export class PrechatFormComponent implements OnInit, AfterViewInit {
118
116
  }
119
117
  }
120
118
 
121
-
122
- /** */
123
- // checkInput() {
124
- // const spanCheck = window.document.getElementById('span-checkmark');
125
- // // console.log('-----------> ', spanCheck);
126
- // if (spanCheck) {
127
- // spanCheck.classList.remove('unchecked');
128
- // }
129
- // }
130
-
131
119
  returnClosePage() {
132
120
  this.onClosePage.emit();
133
121
  }
@@ -73,9 +73,6 @@
73
73
  <div id="c21-whatsapp" *ngIf="g?.whatsappNumber && g?.whatsappNumber.trim() !== ''">
74
74
  <button tabindex="1040" aflistconv #aflistconv class="c21-button-primary" (click)="openConversationOnPlatform('whatsapp')">
75
75
  <span class="v-align-center">
76
- <!-- <svg [ngStyle]="{'fill': 'yellow' }" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24">
77
- <path d="M2.01 21L23 12 2.01 3 2 10l15 2-15 2z" [ngStyle]="{'fill': g.themeForegroundColor}"/>
78
- </svg> -->
79
76
  <svg aria-labelledby="altIconTitle" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="28" height="28" viewBox="0 0 1219.547 1225.016">
80
77
  <path fill="#E0E0E0" d="M1041.858 178.02C927.206 63.289 774.753.07 612.325 0 277.617 0 5.232 272.298 5.098 606.991c-.039 106.986 27.915 211.42 81.048 303.476L0 1225.016l321.898-84.406c88.689 48.368 188.547 73.855 290.166 73.896h.258.003c334.654 0 607.08-272.346 607.222-607.023.056-162.208-63.052-314.724-177.689-429.463zm-429.533 933.963h-.197c-90.578-.048-179.402-24.366-256.878-70.339l-18.438-10.93-191.021 50.083 51-186.176-12.013-19.087c-50.525-80.336-77.198-173.175-77.16-268.504.111-278.186 226.507-504.503 504.898-504.503 134.812.056 261.519 52.604 356.814 147.965 95.289 95.36 147.728 222.128 147.688 356.948-.118 278.195-226.522 504.543-504.693 504.543z"/>
81
78
  <linearGradient id="a" gradientUnits="userSpaceOnUse" x1="609.77" y1="1190.114" x2="609.77" y2="21.084">
@@ -87,6 +84,9 @@
87
84
  <path fill="#FFF" d="M1036.898 176.091C923.562 62.677 772.859.185 612.297.114 281.43.114 12.172 269.286 12.039 600.137 12 705.896 39.633 809.13 92.156 900.13L7 1211.067l318.203-83.438c87.672 47.812 186.383 73.008 286.836 73.047h.255.003c330.812 0 600.109-269.219 600.25-600.055.055-160.343-62.328-311.108-175.649-424.53zm-424.601 923.242h-.195c-89.539-.047-177.344-24.086-253.93-69.531l-18.227-10.805-188.828 49.508 50.414-184.039-11.875-18.867c-49.945-79.414-76.312-171.188-76.273-265.422.109-274.992 223.906-498.711 499.102-498.711 133.266.055 258.516 52 352.719 146.266 94.195 94.266 146.031 219.578 145.992 352.852-.118 274.999-223.923 498.749-498.899 498.749z"/>
88
85
  <title id="altIconTitle">Whatsapp</title>
89
86
  </svg>
87
+ <!-- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="28" height="28" focusable="false" viewBox="0 0 448 512" xml:space="preserve">
88
+ <path stroke="#5f6368" stroke-width="8px" fill="#5f6368" d="M380.9,97.1C339,55.1,283.2,32,223.9,32c-122.4,0-222,99.6-222,222c0,39.1,10.2,77.3,29.6,111L0,480l117.7-30.9 c32.4,17.7,68.9,27,106.1,27h0.1c122.3,0,224.1-99.6,224.1-222C448,194.8,422.8,139.1,380.9,97.1z M223.9,438.7 c-33.2,0-65.7-8.9-94-25.7l-6.7-4l-69.8,18.3L72,359.2l-4.4-7c-18.5-29.4-28.2-63.3-28.2-98.2c0-101.7,82.8-184.5,184.6-184.5 c49.3,0,95.6,19.2,130.4,54.1s56.2,81.2,56.1,130.5C410.5,355.9,325.6,438.7,223.9,438.7z M325.1,300.5c-5.5-2.8-32.8-16.2-37.9-18 c-5.1-1.9-8.8-2.8-12.5,2.8c-3.7,5.6-14.3,18-17.6,21.8c-3.2,3.7-6.5,4.2-12,1.4c-32.6-16.3-54-29.1-75.5-66 c-5.7-9.8,5.7-9.1,16.3-30.3c1.8-3.7,0.9-6.9-0.5-9.7s-12.5-30.1-17.1-41.2c-4.5-10.8-9.1-9.3-12.5-9.5c-3.2-0.2-6.9-0.2-10.6-0.2 c-3.7,0-9.7,1.4-14.8,6.9c-5.1,5.6-19.4,19-19.4,46.3s19.9,53.7,22.6,57.4c2.8,3.7,39.1,59.7,94.8,83.8c35.2,15.2,49,16.5,66.6,13.9 c10.7-1.6,32.8-13.4,37.4-26.4s4.6-24.1,3.2-26.4C334.3,304.6,330.6,303.2,325.1,300.5z"/>
89
+ </svg> -->
90
90
  </span>
91
91
  <div class="clear"></div>
92
92
  </button>
@@ -94,9 +94,6 @@
94
94
  <div id="c21-telegram" *ngIf="g?.telegramUsername && g?.telegramUsername.trim() !== ''">
95
95
  <button tabindex="1040" aflistconv #aflistconv class="c21-button-primary" (click)="openConversationOnPlatform('telegram')">
96
96
  <span class="v-align-center">
97
- <!-- <svg [ngStyle]="{'fill': 'yellow' }" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24">
98
- <path d="M2.01 21L23 12 2.01 3 2 10l15 2-15 2z" [ngStyle]="{'fill': g.themeForegroundColor}"/>
99
- </svg> -->
100
97
  <svg aria-labelledby="altIconTitle" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="26" height="26" viewBox="0 0 368 368" style="enable-background:new 0 0 368 368;" xml:space="preserve">
101
98
  <g id="XMLID_1_">
102
99
  <linearGradient id="XMLID_7_" gradientUnits="userSpaceOnUse" x1="-66.831" y1="-68.1757" x2="-65.3102" y2="-68.1757" gradientTransform="matrix(-60 139.992 -139.992 -60 -13316.416 5324.4634)">
@@ -114,9 +111,8 @@
114
111
  </g>
115
112
  <title id="altIconTitle">Telegram</title>
116
113
  </svg>
117
- <!-- <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24">
118
- <path [ngStyle]="{'fill': g.themeForegroundColor}" d="M13.92,11.22s-1.22-.6-1.44-.68a.76.76,0,0,0-.27-.06.46.46,0,0,0-.4.24c-.12.17-.48.59-.59.72l-.05,0-.25-.1A6.22,6.22,0,0,1,8.54,9.26l0,0s.05-.06.07-.09l.2-.23.1-.11a1.36,1.36,0,0,0,.19-.31l0-.05a.54.54,0,0,0,0-.52c0-.06-.53-1.27-.58-1.4-.13-.31-.3-.45-.54-.45H7.88a3,3,0,0,0-1,.26,2.08,2.08,0,0,0-.77,1.76A3.78,3.78,0,0,0,7,10.17a.09.09,0,0,0,0,.05,7.81,7.81,0,0,0,3.33,2.89,5.37,5.37,0,0,0,2,.51h0l.32,0h.06a2.13,2.13,0,0,0,1.48-1,1.7,1.7,0,0,0,.09-1.08A.72.72,0,0,0,13.92,11.22Z" transform="translate(-1.83 -1.83)"/>
119
- <path [ngStyle]="{'fill': g.themeForegroundColor}" d="M10.14,1.83a8,8,0,0,0-8,8,7.86,7.86,0,0,0,1.1,4L1.85,17.89a.19.19,0,0,0,0,.21.21.21,0,0,0,.15.07h.06l4.24-1.35a8,8,0,0,0,11.82-7A8,8,0,0,0,10.14,1.83Zm0,14.27a6.37,6.37,0,0,1-3.49-1,.19.19,0,0,0-.12,0H6.47l-2.12.68.68-2a.22.22,0,0,0,0-.19A6.22,6.22,0,0,1,3.79,9.8a6.36,6.36,0,1,1,6.35,6.3Z" transform="translate(-1.83 -1.83)"/>
114
+ <!-- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="26" height="26" viewBox="0 0 448 512" xml:space="preserve">
115
+ <path fill="#5f6368" d="M446.7,98.6l-67.6,318.8c-5.1,22.5-18.4,28.1-37.3,17.5l-103-75.9l-49.7,47.8c-5.5,5.5-10.1,10.1-20.7,10.1 l7.4-104.9l190.9-172.5c8.3-7.4-1.8-11.5-12.9-4.1L117.8,284L16.2,252.2c-22.1-6.9-22.5-22.1,4.6-32.7L418.2,66.4 C436.6,59.5,452.7,70.5,446.7,98.6z"/>
120
116
  </svg> -->
121
117
  </span>
122
118
  <div class="clear"></div>
@@ -125,9 +121,6 @@
125
121
  <div id="c21-messanger" *ngIf="g?.messangerPageTitle && g?.messangerPageTitle.trim() !== ''">
126
122
  <button tabindex="1040" aflistconv #aflistconv class="c21-button-primary" (click)="openConversationOnPlatform('messanger')">
127
123
  <span class="v-align-center">
128
- <!-- <svg [ngStyle]="{'fill': 'yellow' }" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24">
129
- <path d="M2.01 21L23 12 2.01 3 2 10l15 2-15 2z" [ngStyle]="{'fill': g.themeForegroundColor}"/>
130
- </svg> -->
131
124
  <svg aria-labelledby="altIconTitle" xmlns="http://www.w3.org/2000/svg" width="26" height="26" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" viewBox="0 0 800 800">
132
125
  <radialGradient id="Gradient" cx="101.925" cy="809.0079" r="1.0896" gradientTransform="matrix(800 0 0 -799.9985 -81386 648000.75)" gradientUnits="userSpaceOnUse">
133
126
  <stop offset="0" style="stop-color:#0099FF"/>
@@ -139,9 +132,8 @@
139
132
  <path fill="#FFFFFF" d="M159.8,501.5l117.5-186.4c18.7-29.7,58.7-37,86.8-16l93.5,70.1c8.6,6.4,20.4,6.4,28.9-0.1 l126.2-95.8c16.8-12.8,38.8,7.4,27.6,25.3L522.7,484.9c-18.7,29.7-58.7,37-86.8,16l-93.5-70.1c-8.6-6.4-20.4-6.4-28.9,0.1 l-126.2,95.8C170.5,539.5,148.5,519.4,159.8,501.5z"/>
140
133
  <title id="altIconTitle">Facebook Messanger</title>
141
134
  </svg>
142
- <!-- <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24">
143
- <path [ngStyle]="{'fill': g.themeForegroundColor}" d="M13.92,11.22s-1.22-.6-1.44-.68a.76.76,0,0,0-.27-.06.46.46,0,0,0-.4.24c-.12.17-.48.59-.59.72l-.05,0-.25-.1A6.22,6.22,0,0,1,8.54,9.26l0,0s.05-.06.07-.09l.2-.23.1-.11a1.36,1.36,0,0,0,.19-.31l0-.05a.54.54,0,0,0,0-.52c0-.06-.53-1.27-.58-1.4-.13-.31-.3-.45-.54-.45H7.88a3,3,0,0,0-1,.26,2.08,2.08,0,0,0-.77,1.76A3.78,3.78,0,0,0,7,10.17a.09.09,0,0,0,0,.05,7.81,7.81,0,0,0,3.33,2.89,5.37,5.37,0,0,0,2,.51h0l.32,0h.06a2.13,2.13,0,0,0,1.48-1,1.7,1.7,0,0,0,.09-1.08A.72.72,0,0,0,13.92,11.22Z" transform="translate(-1.83 -1.83)"/>
144
- <path [ngStyle]="{'fill': g.themeForegroundColor}" d="M10.14,1.83a8,8,0,0,0-8,8,7.86,7.86,0,0,0,1.1,4L1.85,17.89a.19.19,0,0,0,0,.21.21.21,0,0,0,.15.07h.06l4.24-1.35a8,8,0,0,0,11.82-7A8,8,0,0,0,10.14,1.83Zm0,14.27a6.37,6.37,0,0,1-3.49-1,.19.19,0,0,0-.12,0H6.47l-2.12.68.68-2a.22.22,0,0,0,0-.19A6.22,6.22,0,0,1,3.79,9.8a6.36,6.36,0,1,1,6.35,6.3Z" transform="translate(-1.83 -1.83)"/>
135
+ <!-- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="26" height="26" focusable="false" viewBox="0 0 512 512" xml:space="preserve">
136
+ <path fill="#5f6368" d="M256.5,8C116.5,8,8,110.3,8,248.6c0,72.3,29.7,134.8,78.1,177.9c8.3,7.5,6.6,11.9,8.1,58.2 c0.4,11,9.6,19.6,20.6,19.2c2.5-0.1,5-0.6,7.3-1.7c52.9-23.3,53.6-25.1,62.6-22.7c153.3,42.2,319.4-55.9,319.4-231 C504,110.3,396.6,8,256.5,8z M405.8,193.1l-73,115.6c-11.1,17.4-34.1,22.6-51.6,11.5c-0.8-0.5-1.6-1-2.3-1.6l-58.1-43.5 c-5.3-4-12.7-4-18,0l-78.4,59.4c-10.5,7.9-24.2-4.6-17.1-15.7l73-115.6c11-17.4,34.1-22.6,51.6-11.6c0.8,0.5,1.6,1.1,2.4,1.6 l58.1,43.5c5.3,4,12.7,4,18,0l78.4-59.4C399.1,169.5,412.8,182,405.8,193.1L405.8,193.1z"/>
145
137
  </svg> -->
146
138
  </span>
147
139
  <div class="clear"></div>
@@ -86,7 +86,6 @@ export class HomeConversationsComponent implements OnInit, OnDestroy {
86
86
  public translatorService: TranslatorService,
87
87
  private customTranslateService: CustomTranslateService,
88
88
  ) {
89
- // console.log(this.langService);
90
89
  // https://www.npmjs.com/package/humanize-duration-ts
91
90
  // https://github.com/Nightapes/HumanizeDuration.ts/blob/master/src/humanize-duration.ts
92
91
  this.humanizer = new HumanizeDuration(this.langService);
@@ -165,89 +164,30 @@ export class HomeConversationsComponent implements OnInit, OnDestroy {
165
164
 
166
165
  that.waitingTime = wt;
167
166
  that.logger.debug('[HOMECONVERSATIONS] that.waitingTime', that.waitingTime);
168
- // console.log('that.waitingTime', that.waitingTime);
169
167
 
170
168
  const lang = that.translatorService.getLanguage();
171
169
  that.humanWaitingTime = this.humanizer.humanize(wt, {language: lang});
172
- // console.log('LIST CONVERSATION humanWaitingTime ', that.humanWaitingTime);
173
- // console.log('LIST CONVERSATION g.WAITING_TIME_FOUND ', this.g.WAITING_TIME_FOUND)
174
- // console.log('LIST CONVERSATION g.WAITING_TIME_FOUND contains $reply_time', this.g.WAITING_TIME_FOUND.includes("$reply_time") )
175
-
170
+
176
171
  // REPLACE
177
172
  if (this.g.WAITING_TIME_FOUND.includes("$reply_time")) {
178
173
  // REPLACE if exist
179
174
  this.WAITING_TIME_FOUND_WITH_REPLYTIME_PLACEHOLDER = this.g.WAITING_TIME_FOUND.replace("$reply_time", that.humanWaitingTime);
180
175
  }
181
- // console.log('LIST CONVERSATION WAITING_TIME_FOUND_WITH_REPLYTIME_PLACEHOLDER', this.WAITING_TIME_FOUND_WITH_REPLYTIME_PLACEHOLDER)
182
- // console.log('LIST CONVERSATION g.dynamicWaitTimeReply ', this.g.dynamicWaitTimeReply )
183
- // console.log('LIST CONVERSATION typeof g.dynamicWaitTimeReply ', typeof this.g.dynamicWaitTimeReply )
184
-
185
- // console.log('xxx', this.humanizer.humanize(wt));
186
- // 'The team typically replies in ' + moment.duration(response[0].waiting_time_avg).format();
187
176
  }
188
- // else {
189
- // that.waitingTimeMessage = 'waiting_time_not_found';
190
- // // that.waitingTimeMessage = 'Will reply as soon as they can';
191
- // }
177
+
192
178
  });
193
179
  }
194
180
 
195
- }
196
-
197
- checkShowAllConversation() {
198
- if (this.archivedConversations && this.archivedConversations.length > 0) {
199
- return true;
200
- } else if (this.listConversations && this.listConversations.length > 0) {
201
- return true;
202
181
  }
203
- return false;
204
- }
205
- // msToTime(duration) {
206
- // let milliseconds = parseInt((duration % 1000) / 100),
207
- // seconds = parseInt((duration / 1000) % 60),
208
- // minutes = parseInt((duration / (1000 * 60)) % 60),
209
- // hours = parseInt((duration / (1000 * 60 * 60)) % 24);
210
-
211
- // hours = (hours < 10) ? "0" + hours : hours;
212
- // minutes = (minutes < 10) ? "0" + minutes : minutes;
213
- // seconds = (seconds < 10) ? "0" + seconds : seconds;
214
-
215
- // return hours + ":" + minutes + ":" + seconds + "." + milliseconds;
216
- // }
217
-
218
-
219
- // dhm(t) {
220
- // let cd = 24 * 60 * 60 * 1000,
221
- // ch = 60 * 60 * 1000,
222
- // d = Math.floor(t / cd),
223
- // h = Math.floor( (t - d * cd) / ch),
224
- // m = Math.round( (t - d * cd - h * ch) / 60000),
225
- // pad = function(n){ return n < 10 ? '0' + n : n; };
226
- // if ( m === 60 ) {
227
- // h++;
228
- // m = 0;
229
- // }
230
- // if ( h === 24 ) {
231
- // d++;
232
- // h = 0;
233
- // }
234
- // return [d, pad(h), pad(m)].join(':');
235
- // }
236
-
237
-
238
- // setImageProfile(agent) {
239
- // //console.log(agent);
240
- // this.contactService.setImageProfile(agent)
241
- // .then(function (snapshot) {
242
- // if (snapshot.val().trim()) {
243
- // agent.image = snapshot.val();
244
- // }
245
- // })
246
- // .catch(function (err) {
247
- // console.log(err);
248
- // });
249
- // }
250
182
 
183
+ checkShowAllConversation() {
184
+ if (this.archivedConversations && this.archivedConversations.length > 0) {
185
+ return true;
186
+ } else if (this.listConversations && this.listConversations.length > 0) {
187
+ return true;
188
+ }
189
+ return false;
190
+ }
251
191
 
252
192
 
253
193
  // ========= begin:: ACTIONS ============//
@@ -284,8 +224,8 @@ checkShowAllConversation() {
284
224
  this.unsubscribe();
285
225
  }
286
226
 
287
- /** */
288
- unsubscribe() {
227
+ /** */
228
+ unsubscribe() {
289
229
  this.subscriptions.forEach(function (subscription) {
290
230
  subscription.unsubscribe();
291
231
  });
@@ -45,22 +45,10 @@ export class ListConversationsComponent implements OnInit {
45
45
 
46
46
  ngOnInit() {
47
47
  this.logger.debug('[LISTCONVERSATIONS] ngOnInit', this.listConversations);
48
- // console.log('empDifferMap::' + JSON.stringify(this.listConversations))
49
- // this.listConversations.forEach(emp => {
50
- // this.empDifferMap[emp.uid] = this.kvDiffers.find(emp).create();
51
- // this.empMap[emp.uid] = emp;
52
- // console.log('empDifferMap::', this.empDifferMap, this.empMap)
53
- // })
54
48
  }
55
49
 
56
50
  ngOnChanges(changes: SimpleChanges){
57
- // console.log('empDifferMap:: 1111' + JSON.stringify(this.listConversations[1]))
58
- // console.log('empDifferMap:: 1111', this.listConversations)
59
- // this.listConversations.forEach(emp => {
60
- // this.empDifferMap[emp.uid] = this.kvDiffers.find(emp).create();
61
- // this.empMap[emp.uid] = emp;
62
- // console.log('empDifferMap::', this.empDifferMap, this.empMap)
63
- // })
51
+
64
52
  }
65
53
 
66
54
  public openConversationByID(conversation) {
@@ -79,51 +67,7 @@ export class ListConversationsComponent implements OnInit {
79
67
 
80
68
  ngDoCheck() {
81
69
  let changesListConversation = this.iterableDifferListConv.diff(this.listConversations);
82
- if(changesListConversation){
83
- // changesListConversation.forEachAddedItem(element => {
84
- // let conv = element.item
85
- // this.onImageLoaded.emit(conv)
86
- // this.onConversationLoaded.emit(conv)
87
- // });
88
- // changesListConversation.forEachRemovedItem(element => {
89
- // });
90
- // changesListConversation.forEachOperation((element: IterableChangeRecord<ConversationModel>, adjustedPreviousIndex: number, currentIndex: number) => {
91
- // // if (item.previousIndex == null) {
92
- // // console.log('itemmmm 1111', item, adjustedPreviousIndex)
93
- // // } else if (currentIndex == null) {
94
- // // console.log('itemmmm 2222', item, adjustedPreviousIndex)
95
- // // } else {
96
- // // console.log('itemmmm 3333', item, adjustedPreviousIndex)
97
- // // }
98
- // if(element.currentIndex == null || element.previousIndex == null){
99
- // console.log('itemmmm 44444', element, adjustedPreviousIndex, currentIndex)
100
- // let conv = element.item
101
- // this.onImageLoaded.emit(conv)
102
- // this.onConversationLoaded.emit(conv)
103
- // }
104
- // });
105
- // changesListConversation.forEachItem((item: IterableChangeRecord<ConversationModel>)=> {
106
- // console.log('itemmmm forEachItem', item)
107
- // });
108
-
109
- }
110
-
111
70
 
112
- //Detect changes in object inside array
113
- // for (let [key, empDiffer] of this.objDiffers) {
114
- // let empChanges = empDiffer.diff(this.differ.get(key));
115
- // if (empChanges) {
116
- // empChanges.forEachChangedItem(record => {
117
- // console.log('--- Employee with id ' + key + ' updated ---');
118
- // // this.changeLogs.push('--- Employee with id ' + key + ' updated ---');
119
- // console.log('Previous value: ' + record.previousValue);
120
- // // this.changeLogs.push('Previous value: ' + record.previousValue);
121
- // console.log('Current value: ' + record.currentValue);
122
- // // this.changeLogs.push('Current value: ' + record.currentValue);
123
- // });
124
- // }
125
- // }
126
-
127
71
  }
128
72
 
129
73
 
@@ -23,7 +23,6 @@ export class AvatarComponent implements OnInit {
23
23
  let url = this.imageRepoService.getImagePhotoUrl(this.senderID)
24
24
  // this.imageRepoService.checkImageExists(url, (existImage)=> {
25
25
  // existImage? this.url = url: null;
26
- // console.log('existttttt', existImage)
27
26
  // })
28
27
  this.checkImageExists(url, (existImage)=> {
29
28
  existImage? this.url = url: null;