@chat21/chat21-web-widget 5.0.98 → 5.0.100
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,14 @@
|
|
|
6
6
|
### **Copyrigth**:
|
|
7
7
|
*Tiledesk SRL*
|
|
8
8
|
|
|
9
|
+
# 5.0.100
|
|
10
|
+
- **bug-fixed**: if conversation is deleted and user came back, widget shows the same stored conversation as opened (only if singleConversation mode is active)
|
|
11
|
+
|
|
12
|
+
# 5.0.99
|
|
13
|
+
|
|
14
|
+
# 5.0.99-rc1
|
|
15
|
+
- **bug-fixed**: audio duration not showed in mobile browser
|
|
16
|
+
|
|
9
17
|
# 5.0.98
|
|
10
18
|
- **bug-fixed**: meta info not rendered correctly
|
|
11
19
|
|
package/package.json
CHANGED
|
@@ -407,6 +407,7 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
|
|
|
407
407
|
// duration.hours < this.g.continueConversationBeforeTime? this.showContinueConversationButton = true: this.showContinueConversationButton = false
|
|
408
408
|
callback(this.isConversationArchived)
|
|
409
409
|
}else if(!conv) {
|
|
410
|
+
this.isConversationArchived = true
|
|
410
411
|
callback(null);
|
|
411
412
|
}
|
|
412
413
|
})
|
|
@@ -67,7 +67,7 @@ export class HomeConversationsComponent implements OnInit, OnDestroy {
|
|
|
67
67
|
availableAgents: Array<UserAgent> = [];
|
|
68
68
|
// ========= end:: variabili del componente ======== //
|
|
69
69
|
|
|
70
|
-
waitingTime:
|
|
70
|
+
waitingTime: number;
|
|
71
71
|
langService: HumanizeDurationLanguage = new HumanizeDurationLanguage();
|
|
72
72
|
humanizer: HumanizeDuration;
|
|
73
73
|
humanWaitingTime: string;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Component, ElementRef, AfterViewInit, Input, ViewChild } from '@angular/core';
|
|
2
2
|
import { DomSanitizer, SafeUrl } from '@angular/platform-browser';
|
|
3
|
+
import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
|
|
4
|
+
import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
|
|
3
5
|
import { convertColorToRGBA } from 'src/chat21-core/utils/utils';
|
|
4
6
|
|
|
5
7
|
@Component({
|
|
@@ -26,13 +28,13 @@ export class AudioComponent implements AfterViewInit {
|
|
|
26
28
|
currentTime: number = 0;
|
|
27
29
|
isPlaying: boolean = false;
|
|
28
30
|
|
|
31
|
+
private logger: LoggerService = LoggerInstance.getInstance();
|
|
29
32
|
constructor(
|
|
30
33
|
private sanitizer: DomSanitizer,
|
|
31
34
|
private elementRef: ElementRef
|
|
32
35
|
) {}
|
|
33
36
|
|
|
34
37
|
ngAfterViewInit() {
|
|
35
|
-
console.log('stylesssss', this.stylesMap)
|
|
36
38
|
if (this.audioBlob) {
|
|
37
39
|
this.rawAudioUrl = URL.createObjectURL(this.audioBlob);
|
|
38
40
|
this.audioUrl = this.sanitizer.bypassSecurityTrustUrl(this.rawAudioUrl);
|
|
@@ -136,21 +138,33 @@ export class AudioComponent implements AfterViewInit {
|
|
|
136
138
|
return `${minutes}:${sec < 10 ? '0' + sec : sec}`;
|
|
137
139
|
}
|
|
138
140
|
|
|
139
|
-
getAudioDuration() {
|
|
140
|
-
const audio = new Audio();
|
|
141
|
-
audio.src = this.rawAudioUrl!;
|
|
142
|
-
audio.addEventListener('loadedmetadata', () => {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
});
|
|
141
|
+
async getAudioDuration() {
|
|
142
|
+
// const audio = new Audio();
|
|
143
|
+
// audio.src = this.rawAudioUrl!;
|
|
144
|
+
// audio.addEventListener('loadedmetadata', () => {
|
|
145
|
+
// if (audio.duration === Infinity) {
|
|
146
|
+
// audio.currentTime = Number.MAX_SAFE_INTEGER;
|
|
147
|
+
// audio.ontimeupdate = () => {
|
|
148
|
+
// audio.ontimeupdate = null;
|
|
149
|
+
// audio.currentTime = 0;
|
|
150
|
+
// this.audioDuration = audio.duration;
|
|
151
|
+
// };
|
|
152
|
+
// } else {
|
|
153
|
+
// this.audioDuration = audio.duration;
|
|
154
|
+
// }
|
|
155
|
+
// });
|
|
156
|
+
|
|
157
|
+
const response = await fetch(this.rawAudioUrl!);
|
|
158
|
+
this.logger.debug('getAudioDuration: response ---> ', response)
|
|
159
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
160
|
+
this.logger.debug('getAudioDuration: arrayBuffer ---> ', arrayBuffer)
|
|
161
|
+
const audioContext = new (window.AudioContext || (window as any).webkitAudioContext)();
|
|
162
|
+
this.logger.debug('getAudioDuration: audioContext ---> ', audioContext)
|
|
163
|
+
const audioBuffer = await audioContext.decodeAudioData(arrayBuffer);
|
|
164
|
+
this.logger.debug('getAudioDuration: audioBuffer ---> ', audioBuffer)
|
|
165
|
+
this.audioDuration = audioBuffer.duration;
|
|
166
|
+
this.logger.debug('getAudioDuration: audioDuration ---> ', this.audioDuration)
|
|
167
|
+
|
|
154
168
|
}
|
|
155
169
|
|
|
156
170
|
extractFirstColor(gradient: string): string | null {
|