@chat21/chat21-ionic 3.0.74-rc.1 → 3.0.75

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,8 +1,18 @@
1
1
  # chat21-ionic ver 3.0
2
2
 
3
+ ### 3.0.75 in PROD
4
+
5
+ ### 3.0.75-rc.2
6
+ - bug-fixed: unserved request count not updated correctly after a request is assigned
7
+
8
+ ### 3.0.75-rc.1
9
+ - added: handled ESC keyboard button to dismiss image preview component
10
+
11
+ ### 3.0.74 in PROD
3
12
 
4
13
  ### 3.0.74-rc.1
5
14
  - changed: dashboardUrl in env from absolute to relative http url
15
+ - bug-fixed: not get projectId if is direct covnersation
6
16
 
7
17
  ### 3.0.73 in PROD
8
18
 
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.74-rc.1",
4
+ "version": "3.0.75",
5
5
  "license": "MIT License",
6
6
  "homepage": "https://tiledesk.com/",
7
7
  "repository": {
@@ -1150,7 +1150,7 @@ export class AppComponent implements OnInit {
1150
1150
 
1151
1151
  subscribeUnservedRequestCount = (unservedRequestCount) => {
1152
1152
  if(unservedRequestCount && unservedRequestCount > 0){
1153
- console.log("hasToSoundUnservedRequestCount::::", this.hasToSoundUnservedRequestCount, this.isInitialized)
1153
+ this.logger.debug("hasToSoundUnservedRequestCount::::", this.hasToSoundUnservedRequestCount, this.isInitialized)
1154
1154
  if(this.hasToSoundUnservedRequestCount){
1155
1155
  this.manageTabNotification(unservedRequestCount) //sound and alternate title
1156
1156
  } else {
@@ -2,7 +2,7 @@
2
2
  <!-- [ngStyle]="{'padding': (isImage(message) || isFrame(message))?'0px':'0 8px'}" -->
3
3
  <!-- isImage >{{isImage(message) }} message.metadata.width {{message?.metadata?.width }} -->
4
4
  <div id="bubble-message"
5
- [ngStyle]="{'padding': (isImage(message) || isFrame(message))?'0px':'0 8px', 'width': (isImage(message) || isFrame(message))? message?.metadata?.width + 'px' : null }"
5
+ [ngStyle]="{'padding': (isImage(message) || isFrame(message))?'0px':'0 8px', 'width': (isImage(message) || isFrame(message))? sizeImage?.width + 'px' : null }"
6
6
  class="messages primary-color" [class.emoticon]="message?.emoticon">
7
7
 
8
8
 
@@ -20,8 +20,8 @@
20
20
  [height]="getMetadataSize(message.metadata).height" -->
21
21
  <chat-image *ngIf="isImage(message)"
22
22
  [metadata]="message.metadata"
23
- [width]="message.metadata.width"
24
- [height]="message.metadata.height"
23
+ [width]="sizeImage?.width"
24
+ [height]="sizeImage?.height"
25
25
  (onImageRendered)="onImageRenderedFN($event)">
26
26
  </chat-image>
27
27
 
@@ -1,7 +1,7 @@
1
1
  import { Component, ElementRef, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core';
2
2
  import { DomSanitizer } from '@angular/platform-browser';
3
3
  import { MessageModel } from 'src/chat21-core/models/message';
4
- import { MAX_WIDTH_IMAGES } from 'src/chat21-core/utils/constants';
4
+ import { MAX_WIDTH_IMAGES, MIN_WIDTH_IMAGES } from 'src/chat21-core/utils/constants';
5
5
  import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
6
6
  import { isFile, isFrame, isImage } from 'src/chat21-core/utils/utils-message';
7
7
  import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
@@ -39,6 +39,7 @@ export class BubbleMessageComponent implements OnInit, OnChanges {
39
39
  'hideDelayAfterClick': 3000,
40
40
  'hide-delay': 200
41
41
  };
42
+ sizeImage : { width: number, height: number}
42
43
 
43
44
  private logger: LoggerService = LoggerInstance.getInstance()
44
45
 
@@ -72,7 +73,7 @@ export class BubbleMessageComponent implements OnInit, OnChanges {
72
73
  } else if (this.browserLang && stored_preferred_lang) {
73
74
  chat_lang = stored_preferred_lang
74
75
  }
75
- moment.locale(chat_lang , {
76
+ moment.updateLocale(chat_lang , {
76
77
  calendar: {
77
78
  sameElse: 'LLLL'
78
79
  }
@@ -81,7 +82,7 @@ export class BubbleMessageComponent implements OnInit, OnChanges {
81
82
 
82
83
  ngOnChanges() {
83
84
  if (this.message && this.message.metadata && typeof this.message.metadata === 'object') {
84
- this.getMetadataSize(this.message.metadata)
85
+ this.sizeImage = this.getMetadataSize(this.message.metadata)
85
86
  }
86
87
  }
87
88
 
@@ -112,27 +113,36 @@ export class BubbleMessageComponent implements OnInit, OnChanges {
112
113
  // }
113
114
 
114
115
  getMetadataSize(metadata): any {
115
- if (metadata.width === undefined) {
116
- metadata.width = MAX_WIDTH_IMAGES
117
- }
118
- if (metadata.height === undefined) {
119
- metadata.height = MAX_WIDTH_IMAGES
120
- }
116
+ // if (metadata.width === undefined) {
117
+ // metadata.width = MAX_WIDTH_IMAGES
118
+ // }
119
+ // if (metadata.height === undefined) {
120
+ // metadata.height = MAX_WIDTH_IMAGES
121
+ // }
122
+
123
+ const sizeImage = {
124
+ width: metadata.width,
125
+ height: metadata.height
126
+ };
121
127
 
122
128
  if (metadata.width && metadata.width < MAX_WIDTH_IMAGES) {
123
129
  if (metadata.width <= 55) {
124
130
  const ratio = (metadata['width'] / metadata['height']);
125
- metadata.width = 200;
126
- metadata.height = 200 / ratio;
131
+ sizeImage.width = MIN_WIDTH_IMAGES;
132
+ sizeImage.height = MIN_WIDTH_IMAGES / ratio;
127
133
  } else if (metadata.width > 55) {
128
- metadata.width = this.message.metadata.width;
129
- metadata.height = this.message.metadata.height;
134
+ sizeImage.width = metadata.width;
135
+ sizeImage.height = metadata.height
130
136
  }
137
+
131
138
  } else if (metadata.width && metadata.width > MAX_WIDTH_IMAGES) {
132
139
  const ratio = (metadata['width'] / metadata['height']);
133
- metadata.width = MAX_WIDTH_IMAGES;
134
- metadata.height = MAX_WIDTH_IMAGES / ratio;
140
+ sizeImage.width = MAX_WIDTH_IMAGES;
141
+ sizeImage.height = MAX_WIDTH_IMAGES / ratio;
135
142
  }
143
+ // metadata.width = sizeImage.width
144
+ // metadata.height = sizeImage.height
145
+ return sizeImage
136
146
  }
137
147
 
138
148
 
@@ -1,9 +1,14 @@
1
- <div [ngStyle]="{ 'max-width': width +'px', 'max-height': height +'px' }" style="position: relative; ">
2
- <div *ngIf="loading" class="loader" [ngStyle]="{ 'width': width +'px', 'height': height +'px' }"></div>
1
+ <!-- [ngStyle]="{ 'max-width': width +'px', 'max-height': height +'px' }" style="position: relative; " -->
2
+ <div [ngStyle]="{ 'max-width': width +'px', 'max-height': height +'px' }" class="c21-img-container">
3
+ <div *ngIf="loading" class="loader" [ngStyle]="{ 'width': width , 'height': height }"></div>
3
4
  <!-- [tooltip]="timeTooltipRight" [options]="tooltipOptions" placement="bottom" content-type="template" -->
4
- <img id="myImg" [ngStyle]="{ 'width': width +'px', 'height': height +'px' }" style="cursor:pointer"
5
- class="message-contentX message-content-imageX" [ngClass]="{'isLoadingImage': loading}"
6
- [src]="metadata.src" (load)="onLoaded($event)" (click)="openImageViewerModal(metadata.src, metadata.name)" />
5
+ <img id="myImg"
6
+ class="message-contentX message-content-imageX"
7
+ [ngClass]="{'isLoadingImage': loading}"
8
+ [ngStyle]="{ 'width': width , 'height': height }"
9
+ [src]="metadata.src"
10
+ (load)="onLoaded($event)"
11
+ (click)="openImageViewerModal(metadata.src, metadata.name)" />
7
12
  <!-- <ng-template #timeTooltipRight>
8
13
  <span>{{ tooltipMessage }}</span>
9
14
  </ng-template> -->
@@ -8,6 +8,21 @@ img {
8
8
  object-fit: cover;
9
9
  }
10
10
 
11
+ img:hover{
12
+ cursor: pointer;
13
+ }
14
+
15
+ .c21-img-container {
16
+ text-align: center;
17
+ width: 100%;
18
+ // background-image: linear-gradient(rgba(255,255,255,.5), rgba(255,255,255,.5)), url("https://firebasestorage.googleapis.com/v0/b/chat21-pre-01.appspot.com/o/public%2Fimages%2Fb4361ea5-5e37-433c-b727-9034eb5586fe%2F6d74f795-5873-49a8-9165-38f48642df51%2Ffacebook_like%20(3).png?alt=media&token=79afcfe5-ba0c-4573-9263-0877e0225c84");
19
+ // background-repeat: no-repeat;
20
+ // background-position: 50% 0;
21
+ // background-size: cover;
22
+ // border-top-left-radius: $border-radius-bubble-message;
23
+ // border-top-right-radius: $border-radius-bubble-message;
24
+ }
25
+
11
26
  .isLoadingImage {
12
27
  // position: relative;
13
28
  // top: 6px;
@@ -1,4 +1,4 @@
1
- import { Component, OnInit } from '@angular/core';
1
+ import { Component, HostListener, OnInit } from '@angular/core';
2
2
  import { saveAs } from 'file-saver';
3
3
  @Component({
4
4
  selector: 'app-image-viewer',
@@ -53,4 +53,12 @@ export class ImageViewerComponent implements OnInit {
53
53
  this.closeImageViewerModal()
54
54
  }
55
55
 
56
+ @HostListener('document:keydown', ['$event'])
57
+ onKeyPress(event){
58
+ const keyCode = event.which || event.keyCode;
59
+ if (keyCode === 27) { // Esc keyboard code
60
+ this.closeImageViewerModal()
61
+ }
62
+ }
63
+
56
64
  }
@@ -311,10 +311,11 @@ export class ProjectItemComponent implements OnInit {
311
311
  }
312
312
  });
313
313
  //not sound if unservedRequest is already chached and web-sk is closed and restart again
314
- if(this.unservedRequestCount < count){
315
- this.unservedRequestCount = count;
314
+ if(count > this.unservedRequestCount ){
316
315
  this.events.publish('unservedRequest:count', this.unservedRequestCount)
317
316
  }
317
+ this.unservedRequestCount = count;
318
+
318
319
  }
319
320
  }, error => {
320
321
  this.logger.error('[PROJECT-ITEM] UNSERVED REQUEST COUNT * error * ', error)
@@ -337,6 +337,10 @@ ion-list {
337
337
  // font-size: 12px !important;
338
338
  }
339
339
 
340
+ .ion-text-center {
341
+ pointer-events: none;
342
+ }
343
+
340
344
  // #convs-list {
341
345
  // overflow: hidden;
342
346
  // }
@@ -46,7 +46,7 @@ export class TiledeskService {
46
46
  return this.http.put(url, body, httpOptions).pipe(map((res: any) => {
47
47
  this.logger.log('[TILEDESK-SERVICE] - closeSupportGroup - RES ', res);
48
48
  return res
49
- }))
49
+ }))
50
50
  }
51
51
 
52
52
  // http://tiledesk-server-pre.herokuapp.com/requests_util/lookup/id_project/support-group-60ffe291f725db00347661ef-b4cb6875785c4a23b27244fe498eecf44
@@ -65,7 +65,7 @@ export class TiledeskService {
65
65
  return this.http.get(lookupUrl, httpOptions).pipe(map((res: any) => {
66
66
  this.logger.log('[TILEDESK-SERVICE] GET PROJECTID BY CONV RECIPIENT - RES ', res);
67
67
  return res
68
- }))
68
+ }))
69
69
  }
70
70
 
71
71
  public getProjects(token: string) {
@@ -202,14 +202,14 @@ export class WebsocketService {
202
202
  self.logger.log("[WS-SERV] CHAT - CONVS - ON-DATA - notification ", notification);
203
203
 
204
204
  // console.log("[WS-SERV] CHAT - CONVS - ON-DATA - DATA notification > event > method ", notification.event.method);
205
- if (notification.event.method === 'CREATE') {
206
- self.wsRequestsList = [];
207
- self.wsRequestsList.push(data)
208
- self.logger.log("[WS-SERV] CHAT - CONVS - ON-DATA - DATA wsRequestsList ", self.wsRequestsList);
209
- if (self.wsRequestsList) {
210
- self.wsRequestsList$.next(self.wsRequestsList);
211
- }
212
- }
205
+ // if (notification.event.method === 'CREATE') {
206
+ // self.wsRequestsList = [];
207
+ // self.wsRequestsList.push(data)
208
+ // self.logger.log("[WS-SERV] CHAT - CONVS - ON-DATA - DATA wsRequestsList ", self.wsRequestsList);
209
+ // if (self.wsRequestsList) {
210
+ // self.wsRequestsList$.next(self.wsRequestsList);
211
+ // }
212
+ // }
213
213
  }
214
214
  );
215
215
  }
@@ -284,6 +284,7 @@ export class WebsocketService {
284
284
  this.wsRequestsList$.next(this.wsRequestsList);
285
285
  this.logger.log("[WS-SERV] - ON-UPATE CONVS LIST ", this.wsRequestsList);
286
286
  }
287
+
287
288
  }
288
289
  }
289
290
  }
@@ -29,5 +29,6 @@
29
29
  "supportMode": true,
30
30
  "archivedButton": true,
31
31
  "writeToButton": true,
32
- "wsUrl": "/ws/"
32
+ "wsUrl": "/ws/",
33
+ "showInfoMessage":"MEMBER_JOINED_GROUP,TOUCHING_OPERATOR"
33
34
  }
@@ -23,7 +23,7 @@
23
23
  },
24
24
  "apiUrl": "https://tiledesk-server-pre.herokuapp.com/",
25
25
  "baseImageUrl": "https://firebasestorage.googleapis.com/v0/b/",
26
- "dashboardUrl": "/dashboard/",
26
+ "dashboardUrl": "https://support-pre.tiledesk.com/dashboard/",
27
27
  "logLevel": "DEBUG",
28
28
  "authPersistence": "LOCAL",
29
29
  "supportMode": true,
@@ -280,6 +280,7 @@ export class FirebaseConversationHandler extends ConversationHandlerService {
280
280
  private messageGenerate(childSnapshot: any) {
281
281
  const msg: MessageModel = childSnapshot.val();
282
282
  msg.uid = childSnapshot.key;
283
+ msg.text = msg.text.trim() //remove black msg with only spaces
283
284
  // controllo fatto per i gruppi da rifattorizzare
284
285
  if (!msg.sender_fullname || msg.sender_fullname === 'undefined') {
285
286
  msg.sender_fullname = msg.sender;
@@ -287,6 +287,7 @@ export class MQTTConversationHandler extends ConversationHandlerService {
287
287
  this.logger.log("[MQTTConversationHandler] childSnapshot >" + JSON.stringify(childSnapshot));
288
288
  const msg = childSnapshot;
289
289
  msg.uid = childSnapshot.key;
290
+ msg.text = msg.text.trim() //remove black msg with only spaces
290
291
  // controllo fatto per i gruppi da rifattorizzare
291
292
  if (!msg.sender_fullname || msg.sender_fullname === 'undefined') {
292
293
  msg.sender_fullname = msg.sender;
@@ -44,6 +44,7 @@ export const CHANNEL_TYPE_GROUP = 'group';
44
44
  export const TYPE_MSG_TEXT = 'text';
45
45
  export const TYPE_MSG_IMAGE = 'image';
46
46
  export const MAX_WIDTH_IMAGES = 300;
47
+ export const MIN_WIDTH_IMAGES = 130;
47
48
  export const TYPE_DIRECT = 'direct';
48
49
  export const TYPE_GROUP = 'group';
49
50
  export const SYSTEM = 'system';