@chat21/chat21-web-widget 5.0.94-rc4 → 5.0.94-rc7

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
@@ -6,6 +6,15 @@
6
6
  ### **Copyrigth**:
7
7
  *Tiledesk SRL*
8
8
 
9
+ # 5.0.94-rc7
10
+ - **added**: touchstart and touchend events for mobile mic footer button
11
+
12
+ # 5.0.94-rc6
13
+ - **bug-fixed**: logoChat is not rendered if contains special characters (ex. "(" or ")" ) in the name of the resource
14
+
15
+ # 5.0.94-rc5
16
+ - **bug-fixed**: onNewConversationWithMessage create new conv and not use che current one just created
17
+
9
18
  # 5.0.94-rc4
10
19
  - **added**: publish onMessageCreated only if status is >= 100
11
20
 
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.94-rc4",
4
+ "version": "5.0.94-rc7",
5
5
  "license": "MIT",
6
6
  "homepage": "https://www.tiledesk.com",
7
7
  "repository": {
@@ -128,47 +128,6 @@ body {
128
128
  // // -webkit-animation: fade-in-dw-up 0.7s cubic-bezier(0.600, -0.280, 0.735, 0.045) 0.8s;
129
129
  // // animation: fade-in-dw-up 0.7s cubic-bezier(0.600, -0.280, 0.735, 0.045) 0.8s;
130
130
  // }
131
- .avatar-project {
132
- position: relative;
133
- padding: 0;
134
- margin: 0;
135
- height: 70px;//52px;
136
- width: 80px; //100%;
137
- line-height: 52px;
138
-
139
- .avatar-placeholder {
140
- position: absolute;
141
- top: 0;
142
- left: 0;
143
- width: 100%;
144
- height: 100%;
145
- border-radius: 50%;
146
- max-width: 52px;
147
- text-align: center;
148
- font-size: 20px;
149
- color: #ffffff;
150
- font-weight: 500;
151
- }
152
- .avatar-image {
153
- position: absolute;
154
- top: 0;
155
- bottom: 0;
156
- margin: 0px;
157
- left: 0;
158
- width: 100%; //90%;
159
- height: 100%; //80%;
160
- // max-width: 42px;
161
- max-height: 100%; //32px;
162
- text-align: left;
163
- background-color: transparent;
164
- background-repeat: no-repeat;
165
- background-size: contain;
166
- background-attachment: initial;
167
- background-position: left;
168
- background-origin: content-box;
169
- }
170
- }
171
-
172
131
 
173
132
  textarea::placeholder {
174
133
  color: var(--gray);
@@ -728,7 +728,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
728
728
  /** allow to start conversation with an hidden message (without publishing 'new_conversation' event) */
729
729
  this.logger.debug('[APP-COMP] AppComponent::startNewConversation hiddenMessage',this.g.hiddenMessage );
730
730
  if(this.g.hiddenMessage){
731
- this.onNewConversationWithMessage(this.g.hiddenMessage)
731
+ this.onNewConversationWithMessage(newConvId, this.g.hiddenMessage)
732
732
  }
733
733
 
734
734
  this.triggerNewConversationEvent(newConvId);
@@ -1791,24 +1791,20 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
1791
1791
  }
1792
1792
 
1793
1793
 
1794
- onNewConversationWithMessage(text: string, subType: string = 'info'){
1794
+ onNewConversationWithMessage(recipientId: string, text: string, subType: string = 'info'){
1795
1795
  this.logger.log('[APP-COMP] onNewConversationWithMessage in APP COMPONENT', text);
1796
1796
 
1797
- const newConvId = this.generateNewUidConversation();
1798
- this.g.setParameter('recipientId', newConvId);
1799
- this.appStorageService.setItem('recipientId', newConvId)
1800
-
1801
1797
  let message: any = {}
1802
1798
  message.attributes = { subtype: subType, ...this.g.attributes}
1803
1799
  message.userAgent = this.g.attributes['client']
1804
- message.request_id = newConvId
1800
+ message.request_id = recipientId
1805
1801
  message.sourcePage = this.g.attributes['sourcePage']
1806
1802
  message.language = this.g.lang
1807
1803
  message.text = '/'+ text
1808
1804
  message.participants = this.g.participants
1809
1805
  message.departmentid = this.g.attributes.departmentId
1810
1806
  // this.sendMessage(message)
1811
- this.tiledeskRequestsService.sendMessageToRequest(newConvId, this.g.tiledeskToken, message)
1807
+ this.tiledeskRequestsService.sendMessageToRequest(recipientId, this.g.tiledeskToken, message)
1812
1808
  return;
1813
1809
  }
1814
1810
 
@@ -1,31 +1,31 @@
1
1
  <div class="audio-recorder">
2
- <button *ngIf="audioUrl" (click)="deleteRecording()">
3
- <span class="v-align-center">
4
- <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px"><path d="M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm80-160h80v-360h-80v360Zm160 0h80v-360h-80v360Z"/></svg>
5
- <!-- <i class="material-icons">delete_outline</i> -->
6
- </span>
7
- </button>
2
+ <button *ngIf="audioUrl" (click)="deleteRecording()">
3
+ <span class="v-align-center">
4
+ <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px"><path d="M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm80-160h80v-360h-80v360Zm160 0h80v-360h-80v360Z"/></svg>
5
+ <!-- <i class="material-icons">delete_outline</i> -->
6
+ </span>
7
+ </button>
8
8
 
9
- <chat-audio class="test" *ngIf="audioBlob && audioUrl"
10
- [audioBlob] = "audioBlob"
11
- [color]="'var(--chat-footer-color)'"
12
- [fontSize]="stylesMap.get('fontSize')"
13
- [stylesMap]="stylesMap">
14
- </chat-audio>
15
-
16
- <button *ngIf="!audioUrl" class="mic-button" (mousedown)="startRecording()" (mouseup)="stopRecording()">
17
- <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px">
18
- <path d="M480-400q-50 0-85-35t-35-85v-240q0-50 35-85t85-35q50 0 85 35t35 85v240q0 50-35 85t-85 35Zm0-240Zm-40 520v-123q-104-14-172-93t-68-184h80q0 83 58.5 141.5T480-320q83 0 141.5-58.5T680-520h80q0 105-68 184t-172 93v123h-80Zm40-360q17 0 28.5-11.5T520-520v-240q0-17-11.5-28.5T480-800q-17 0-28.5 11.5T440-760v240q0 17 11.5 28.5T480-480Z"/>
19
- </svg>
20
- </button>
21
- <!-- <button *ngIf="isRecording" (click)="stopRecording()"><i class="material-icons">pause_circle_outline</i></button> -->
9
+ <chat-audio class="test" *ngIf="audioBlob && audioUrl"
10
+ [audioBlob] = "audioBlob"
11
+ [color]="'var(--chat-footer-color)'"
12
+ [fontSize]="stylesMap.get('fontSize')"
13
+ [stylesMap]="stylesMap">
14
+ </chat-audio>
22
15
 
23
- <button *ngIf="audioUrl" (click)="sendMessage()">
24
- <span class="v-align-center">
25
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="20" width="24" viewBox="0 0 24 20" xml:space="preserve">
26
- <path d="M1.8,18.9V1.7L22,10.3L1.8,18.9z M3.9,15.6l12.6-5.4L3.9,4.9v3.7l6.4,1.6l-6.4,1.6V15.6z M3.9,15.6V4.9v7V15.6z"/>
27
- </svg>
28
- </span>
29
- </button>
16
+ <button *ngIf="!audioUrl" class="mic-button" (mousedown)="startRecording($event)" (mouseup)="stopRecording($event)" (touchstart)="startRecording($event)" (touchend)="stopRecording($event)">
17
+ <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px">
18
+ <path d="M480-400q-50 0-85-35t-35-85v-240q0-50 35-85t85-35q50 0 85 35t35 85v240q0 50-35 85t-85 35Zm0-240Zm-40 520v-123q-104-14-172-93t-68-184h80q0 83 58.5 141.5T480-320q83 0 141.5-58.5T680-520h80q0 105-68 184t-172 93v123h-80Zm40-360q17 0 28.5-11.5T520-520v-240q0-17-11.5-28.5T480-800q-17 0-28.5 11.5T440-760v240q0 17 11.5 28.5T480-480Z"/>
19
+ </svg>
20
+ </button>
21
+ <!-- <button *ngIf="isRecording" (click)="stopRecording()"><i class="material-icons">pause_circle_outline</i></button> -->
22
+
23
+ <button *ngIf="audioUrl" (click)="sendMessage()">
24
+ <span class="v-align-center">
25
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="20" width="24" viewBox="0 0 24 20" xml:space="preserve">
26
+ <path d="M1.8,18.9V1.7L22,10.3L1.8,18.9z M3.9,15.6l12.6-5.4L3.9,4.9v3.7l6.4,1.6l-6.4,1.6V15.6z M3.9,15.6V4.9v7V15.6z"/>
27
+ </svg>
28
+ </span>
29
+ </button>
30
30
 
31
31
  </div>
@@ -29,8 +29,12 @@ export class ConversationAudioRecorderComponent {
29
29
  constructor(private sanitizer: DomSanitizer) {}
30
30
 
31
31
 
32
- startRecording() {
32
+ startRecording(event: Event) {
33
33
  // console.log('startRecording');
34
+ if (event.type === 'touchstart') {
35
+ event.preventDefault(); // Blocca il successivo mousedown
36
+ }
37
+
34
38
  this.startTime = Date.now();
35
39
  navigator.mediaDevices.getUserMedia({ audio: true })
36
40
  .then(stream => {
@@ -55,7 +59,12 @@ export class ConversationAudioRecorderComponent {
55
59
  });
56
60
  }
57
61
 
58
- stopRecording() {
62
+ stopRecording(event: Event) {
63
+
64
+ if (event.type === 'touchend') {
65
+ event.preventDefault(); // Previene il mouseup successivo
66
+ }
67
+
59
68
  let endTime = Date.now();
60
69
  let time = endTime - this.startTime;
61
70
  if(time > 500){
@@ -27,9 +27,7 @@
27
27
  <div class="c21-header-content">
28
28
  <!-- LOGO HEADER -->
29
29
  <div *ngIf="g.project.logoChat !== 'nologo'" class='avatar-project' item-start>
30
- <!-- <div *ngIf="g.project.logoChat == 'tiledesklogo'" #avatarPlaceholder class="avatar-placeholder" [style.background-color]="g.project.color" [innerHTML]="g.project.avatar"></div>
31
- <div *ngIf="g.project.logoChat !== 'tiledesklogo'" #avatarImage class="avatar-image" [style.background-image]="'url(' + g.project.logoChat + ')'"></div> -->
32
- <div #avatarImage class="avatar-image" [style.background-image]="'url(' + g.project.logoChat + ')'"></div>
30
+ <img #avatarImage class="avatar-image" [src]="g.project.logoChat"/>
33
31
  </div>
34
32
 
35
33
  <!-- MESSAGE HEADER -->
@@ -39,6 +39,36 @@
39
39
  width: 100%;
40
40
  height: 100%;
41
41
  position: absolute;
42
+
43
+ .avatar-project {
44
+ position: relative;
45
+ padding: 0;
46
+ margin: 0;
47
+ height: 70px;//52px;
48
+ width: 80px; //100%;
49
+ line-height: 52px;
50
+
51
+ .avatar-placeholder {
52
+ position: absolute;
53
+ top: 0;
54
+ left: 0;
55
+ width: 100%;
56
+ height: 100%;
57
+ border-radius: 50%;
58
+ max-width: 52px;
59
+ text-align: center;
60
+ font-size: 20px;
61
+ color: #ffffff;
62
+ font-weight: 500;
63
+ }
64
+ .avatar-image {
65
+ max-width: 100%;
66
+ max-height: 100%;
67
+ height: auto;
68
+ width: auto;
69
+ }
70
+ }
71
+
42
72
  .c21-header-button {
43
73
  display: block;
44
74
  width: 100%;