@chat21/chat21-web-widget 5.0.54 → 5.0.56-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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # chat21-web-widget ver 5.0
2
2
 
3
+ ### 5.0.56-rc.1
4
+ - added: custom colors to senderFullname to better distinguish the user
5
+ - bug-fixed: cannot read text.trim() of undefined if no text is sent with an image
6
+ - bug-fixed: markdown not split work correctly
7
+ - bug-fixed: dispose loader bubbles if wait command message is received
8
+
9
+ ### 5.0.55 in PROD
10
+ - added: preflight property to /message API body
11
+
3
12
  ### 5.0.54 in PROD
4
13
 
5
14
  ### 5.0.53-rc.8
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.54",
4
+ "version": "5.0.56-rc.1",
5
5
  "license": "MIT",
6
6
  "homepage": "https://www.tiledesk.com",
7
7
  "repository": {
@@ -5,7 +5,7 @@
5
5
  <div class="c21-body-content" tabindex="1520" aria-label=" messaggi della conversazione: ">
6
6
 
7
7
  <!-- CONTENT !isNewConversation && [class.active]="isShowSpinner" -->
8
- <span *ngIf="messages && this.messages.length === 0">
8
+ <span *ngIf="messages && this.messages.length === 0 && !isTypings">
9
9
  <user-typing class="loading"
10
10
  [color]="stylesMap?.get('iconColor')"
11
11
  [translationMap]="translationMap"
@@ -34,7 +34,7 @@
34
34
  <!--backgroundColor non viene ancora usato -->
35
35
  <!-- class="messages msg_sent slide-in-right" -->
36
36
  <chat-bubble-message class="messages msg_sent"
37
- [class.no-background]="(isImage(message) || isFrame(message)) && message?.text.trim() === '' "
37
+ [class.no-background]="(isImage(message) || isFrame(message)) && message?.text && message?.textmessage?.text.trim() === '' "
38
38
  [class.emoticon]="isEmojii(message?.text)"
39
39
  [ngStyle]="{'background': stylesMap.get('bubbleSentBackground'), 'color': stylesMap.get('bubbleSentTextColor')}"
40
40
  [ngClass]="{'button-in-msg' : message?.metadata && message?.metadata?.button}"
@@ -70,7 +70,7 @@
70
70
  <!-- [ngClass]="{'slide-in-left': !isFirstMessage(message?.sender, i)}" -->
71
71
  <chat-bubble-message class="messages msg_receive"
72
72
  [ngClass]="{'slide-in-left': false}"
73
- [class.no-background]="(isImage(message) || isFrame(message)) && message?.text.trim() === '' "
73
+ [class.no-background]="(isImage(message) || isFrame(message)) && message?.text && message?.text.trim() === '' "
74
74
  [class.emoticon]="isEmojii(message?.text)"
75
75
  [style.margin-left]="isSameSender(message?.sender, i)? '50px': null"
76
76
  [ngStyle]="{'background': stylesMap.get('bubbleReceivedBackground'), 'color': stylesMap.get('bubbleReceivedTextColor')}"
@@ -6,8 +6,8 @@
6
6
 
7
7
  <div>
8
8
 
9
- <div *ngIf="messageType(MESSAGE_TYPE_OTHERS, message) && !isSameSender"
10
- [style.color]="convertColorToRGBA(fontColor, 65)"
9
+ <div *ngIf="messageType(MESSAGE_TYPE_OTHERS, message) && !isSameSender"
10
+ [style.color]="fullnameColor"
11
11
  [ngStyle]="{'margin': (isImage(message) || isFrame(message))? '10px 16px 8px 16px': '10px 8px 0px 8px'}" class="message_sender_fullname">
12
12
  {{message?.sender_fullname}}
13
13
  </div>
@@ -7,6 +7,7 @@ import { MESSAGE_TYPE_MINE, MESSAGE_TYPE_OTHERS } from 'src/chat21-core/utils/co
7
7
  import { convertColorToRGBA } from 'src/chat21-core/utils/utils';
8
8
  import { isFile, isFrame, isImage, messageType } from 'src/chat21-core/utils/utils-message';
9
9
  import { MAX_WIDTH_IMAGES, MIN_WIDTH_IMAGES} from 'src/chat21-core/utils/constants';
10
+ import { getColorBck } from 'src/chat21-core/utils/utils-user';
10
11
 
11
12
  @Component({
12
13
  selector: 'chat-bubble-message',
@@ -36,7 +37,7 @@ export class BubbleMessageComponent implements OnInit {
36
37
  MESSAGE_TYPE_OTHERS = MESSAGE_TYPE_OTHERS;
37
38
  // ========== end:: check message type functions ======= //
38
39
  sizeImage : { width: number, height: number}
39
-
40
+ fullnameColor: string;
40
41
  private logger: LoggerService = LoggerInstance.getInstance()
41
42
  constructor(public sanitizer: DomSanitizer) { }
42
43
 
@@ -48,6 +49,13 @@ export class BubbleMessageComponent implements OnInit {
48
49
  this.sizeImage = this.getMetadataSize(this.message.metadata)
49
50
  }
50
51
 
52
+ if(this.fontColor){
53
+ this.fullnameColor = convertColorToRGBA(this.fontColor, 65)
54
+ }
55
+ if(this.message && this.message.sender_fullname && this.message.sender_fullname.trim() !== ''){
56
+ this.fullnameColor = getColorBck(this.message.sender_fullname)
57
+ }
58
+
51
59
  }
52
60
 
53
61
  /**
@@ -28,5 +28,5 @@ p {
28
28
  }
29
29
 
30
30
  p ::ng-deep a {
31
- word-break: break-all
31
+ word-break: break-word;
32
32
  }
@@ -288,13 +288,14 @@
288
288
  }
289
289
  }, 1000);
290
290
 
291
+ setTimeout(() => {
292
+ document.getElementById("preloader").style.display = "none";
293
+ }, 1000);
294
+
291
295
  });
292
296
 
293
297
  window.Tiledesk('onInit', function(event_data) {
294
298
  console.log("onInit Tiledesk FN", event_data);
295
- setTimeout(() => {
296
- document.getElementById("preloader").style.display = "none";
297
- }, 1000);
298
299
  //open widget after 3s if is closed
299
300
  // setTimeout(() => {
300
301
  // if(event_data && event_data.detail && event_data.detail.global && !event_data.detail.global.isOpen){
@@ -60,7 +60,9 @@ export class TiledeskRequestsService {
60
60
  Authorization: token
61
61
  })
62
62
  };
63
- const body = message;
63
+ let body = message;
64
+ body['preflight'] = true
65
+
64
66
  return this.http.post(url, body, httpOptions).toPromise().then(res => {
65
67
  this.logger.log('[TILEDESK-SERVICE] - SEND MESSAGE TO A REQUEST res ', res);
66
68
  return res
@@ -5,21 +5,8 @@ import 'moment/locale/it.js';
5
5
  import * as firebase from 'firebase/app';
6
6
  import 'firebase/storage';
7
7
 
8
- import { environment } from '../../environments/environment';
9
8
  // tslint:disable-next-line:max-line-length
10
- import {
11
- MAX_WIDTH_IMAGES,
12
- STORAGE_PREFIX,
13
- TYPE_DIRECT,
14
- TYPE_SUPPORT_GROUP
15
- } from './constants';
16
-
17
- import {
18
- avatarPlaceholder,
19
- getColorBck,
20
- getImageUrlThumbFromFirebasestorage
21
- } from './utils-user';
22
- import { time } from 'console';
9
+
23
10
  import { ConversationModel } from '../models/conversation';
24
11
  /**
25
12
  * Shortest description for phone and tablet
@@ -226,19 +213,6 @@ export function supports_html5_session() {
226
213
  }
227
214
  }
228
215
 
229
- export function setStoragePrefix(): string{
230
- let prefix = STORAGE_PREFIX;
231
- try {
232
- // const sv = 'sv' + environment.shemaVersion + '_';
233
- // prefix = prefix + sv;
234
- prefix = environment.storage_prefix + '_';
235
- } catch (e) {
236
- this.g.wdLog(['> Error :' + e]);
237
- }
238
- return prefix + this.g.projectid + '_';
239
- }
240
-
241
-
242
216
  export function convertMessage(messageText) {
243
217
  if (messageText) {
244
218
  messageText = convert(messageText);
@@ -568,24 +542,6 @@ export function getDateDifference(startTimestampDate, endTimestampDate){
568
542
  return {days, hours, minutes}
569
543
  }
570
544
 
571
-
572
- // export function getUrlImgProfile(uid: string) {
573
- // const baseLocation = this.g.baseLocation;
574
- // if (!uid || uid === 'system' ) {
575
- // return baseLocation + IMG_PROFILE_BOT;
576
- // } else if ( uid === 'error') {
577
- // return baseLocation + IMG_PROFILE_DEFAULT;
578
- // } else {
579
- // return getImageUrlThumb(uid);
580
- // }
581
- // }
582
-
583
- export function getImageUrlThumb(FIREBASESTORAGE_BASE_URL_IMAGE: string, uid: string) {
584
- let imageurl = FIREBASESTORAGE_BASE_URL_IMAGE + environment['firebaseConfig'].storageBucket + '/o/profiles%2F' + uid + '%2Fthumb_photo.jpg?alt=media';
585
- return imageurl;
586
- }
587
-
588
-
589
545
  /**
590
546
  *
591
547
  * @param string