@chat21/chat21-web-widget 5.0.91-rc3 → 5.0.91-rc4
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 +3 -0
- package/package.json +1 -1
- package/src/app/app.module.ts +2 -2
- package/src/app/component/conversation-detail/conversation-audio-recorder/conversation-audio-recorder.component.html +2 -2
- package/src/app/component/conversation-detail/conversation-audio-recorder/conversation-audio-recorder.component.scss +1 -1
- package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.ts +15 -7
- package/src/app/component/message/{audio-track/audio-track.component.scss → audio/audio.component.scss} +1 -0
- package/src/app/component/message/{audio-track/audio-track.component.spec.ts → audio/audio.component.spec.ts} +5 -5
- package/src/app/component/message/{audio-track/audio-track.component.ts → audio/audio.component.ts} +6 -6
- package/src/app/component/message/bubble-message/bubble-message.component.html +2 -2
- package/src/app/component/message/bubble-message/bubble-message.component.scss +1 -1
- /package/src/app/component/message/{audio-track/audio-track.component.html → audio/audio.component.html} +0 -0
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/src/app/app.module.ts
CHANGED
|
@@ -24,7 +24,7 @@ import { ImageComponent } from './component/message/image/image.component';
|
|
|
24
24
|
import { InfoMessageComponent } from './component/message/info-message/info-message.component';
|
|
25
25
|
import { HtmlComponent } from './component/message/html/html.component';
|
|
26
26
|
import { FrameComponent } from './component/message/frame/frame.component';
|
|
27
|
-
import {
|
|
27
|
+
import { AudioComponent } from './component/message/audio/audio.component';
|
|
28
28
|
import { UserTypingComponent } from './../chat21-core/utils/user-typing/user-typing.component';
|
|
29
29
|
/** MESSAGE ATTACHMENTS COMPONENTS */
|
|
30
30
|
import { MessageAttachmentComponent } from './component/message-attachment/message-attachment.component';
|
|
@@ -290,7 +290,7 @@ export function uploadFactory(http: HttpClient, appConfig: AppConfigService, app
|
|
|
290
290
|
ActionButtonComponent,
|
|
291
291
|
LinkButtonComponent,
|
|
292
292
|
TextButtonComponent,
|
|
293
|
-
|
|
293
|
+
AudioComponent,
|
|
294
294
|
UserTypingComponent,
|
|
295
295
|
/**DIRECTIVES */
|
|
296
296
|
HtmlEntitiesEncodePipe,
|
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
</span>
|
|
7
7
|
</button>
|
|
8
8
|
|
|
9
|
-
<chat-audio
|
|
9
|
+
<chat-audio class="test" *ngIf="audioBlob && audioUrl"
|
|
10
10
|
[audioBlob] = "audioBlob"
|
|
11
11
|
[color]="'var(--chat-footer-color)'"
|
|
12
12
|
[fontSize]="stylesMap.get('fontSize')"
|
|
13
13
|
[stylesMap]="stylesMap">
|
|
14
|
-
</chat-audio
|
|
14
|
+
</chat-audio>
|
|
15
15
|
|
|
16
16
|
<button *ngIf="!audioUrl" class="mic-button" (mousedown)="startRecording()" (mouseup)="stopRecording()">
|
|
17
17
|
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px">
|
package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.ts
CHANGED
|
@@ -11,6 +11,7 @@ import { ChatManager } from 'src/chat21-core/providers/chat-manager';
|
|
|
11
11
|
import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
|
|
12
12
|
import { TYPE_MSG_FILE, TYPE_MSG_IMAGE, TYPE_MSG_TEXT } from 'src/chat21-core/utils/constants';
|
|
13
13
|
import { convertColorToRGBA } from 'src/chat21-core/utils/utils';
|
|
14
|
+
import { isImage } from 'src/chat21-core/utils/utils-message';
|
|
14
15
|
|
|
15
16
|
@Component({
|
|
16
17
|
selector: 'chat-conversation-footer',
|
|
@@ -67,6 +68,8 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
67
68
|
textInputTextArea: string;
|
|
68
69
|
conversationHandlerService: ConversationHandlerService
|
|
69
70
|
|
|
71
|
+
isImage = isImage
|
|
72
|
+
|
|
70
73
|
showEmojiPicker: boolean = false; //To show/hide emoji picker
|
|
71
74
|
loadPickerModule: boolean = true;
|
|
72
75
|
emojiiOptions = {
|
|
@@ -278,16 +281,21 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
278
281
|
// let message = 'File: ' + metadata.src;
|
|
279
282
|
let message = `[${metadata.name}](${metadata.src})`
|
|
280
283
|
if (metadata.type.startsWith('image') && !metadata.type.includes('svg')) {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
284
|
+
/** CASE IMAGE */
|
|
285
|
+
type_message = TYPE_MSG_IMAGE;
|
|
286
|
+
// message = '';
|
|
287
|
+
message = messageText
|
|
288
|
+
} else if(metadata.type.startsWith('audio')){
|
|
289
|
+
/** CASE AUDIO */
|
|
290
|
+
type_message = TYPE_MSG_FILE
|
|
291
|
+
message = ''
|
|
292
|
+
}else if ((metadata.type.startsWith('image') && metadata.type.includes('svg')) || !metadata.type.startsWith('image')){
|
|
293
|
+
/** CASE FILE */
|
|
294
|
+
type_message = TYPE_MSG_FILE
|
|
287
295
|
message = message + '\n' + messageText
|
|
288
296
|
} else if (!metadata.type.startsWith('image')){
|
|
297
|
+
/** CASE FILE */
|
|
289
298
|
type_message = TYPE_MSG_FILE
|
|
290
|
-
// type_message = metadata.type
|
|
291
299
|
message = message + '\n' + messageText
|
|
292
300
|
}
|
|
293
301
|
that.sendMessage(message, type_message, metadata);
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { AudioComponent } from './audio.component';
|
|
4
4
|
|
|
5
5
|
describe('AudioTrackComponent', () => {
|
|
6
|
-
let component:
|
|
7
|
-
let fixture: ComponentFixture<
|
|
6
|
+
let component: AudioComponent;
|
|
7
|
+
let fixture: ComponentFixture<AudioComponent>;
|
|
8
8
|
|
|
9
9
|
beforeEach(async () => {
|
|
10
10
|
await TestBed.configureTestingModule({
|
|
11
|
-
declarations: [
|
|
11
|
+
declarations: [ AudioComponent ]
|
|
12
12
|
})
|
|
13
13
|
.compileComponents();
|
|
14
14
|
|
|
15
|
-
fixture = TestBed.createComponent(
|
|
15
|
+
fixture = TestBed.createComponent(AudioComponent);
|
|
16
16
|
component = fixture.componentInstance;
|
|
17
17
|
fixture.detectChanges();
|
|
18
18
|
});
|
package/src/app/component/message/{audio-track/audio-track.component.ts → audio/audio.component.ts}
RENAMED
|
@@ -3,11 +3,11 @@ import { DomSanitizer, SafeUrl } from '@angular/platform-browser';
|
|
|
3
3
|
import { convertColorToRGBA } from 'src/chat21-core/utils/utils';
|
|
4
4
|
|
|
5
5
|
@Component({
|
|
6
|
-
selector: 'chat-audio
|
|
7
|
-
templateUrl: './audio
|
|
8
|
-
styleUrls: ['./audio
|
|
6
|
+
selector: 'chat-audio',
|
|
7
|
+
templateUrl: './audio.component.html',
|
|
8
|
+
styleUrls: ['./audio.component.scss']
|
|
9
9
|
})
|
|
10
|
-
export class
|
|
10
|
+
export class AudioComponent implements AfterViewInit {
|
|
11
11
|
|
|
12
12
|
@ViewChild('audioElement', { static: true }) audioElement!: ElementRef<HTMLAudioElement>;
|
|
13
13
|
@ViewChild('canvasElement', { static: true }) waveformCanvas!: ElementRef<HTMLCanvasElement>;
|
|
@@ -68,7 +68,7 @@ export class AudioTrackComponent implements AfterViewInit {
|
|
|
68
68
|
const height = canvas.height;
|
|
69
69
|
const rawData = audioBuffer.getChannelData(0);
|
|
70
70
|
|
|
71
|
-
const samples =
|
|
71
|
+
const samples = 40;
|
|
72
72
|
const blockSize = Math.floor(rawData.length / samples);
|
|
73
73
|
const waveform = new Float32Array(samples);
|
|
74
74
|
|
|
@@ -81,7 +81,7 @@ export class AudioTrackComponent implements AfterViewInit {
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
canvasCtx.clearRect(0, 0, width, height);
|
|
84
|
-
const padding =
|
|
84
|
+
const padding = 2;
|
|
85
85
|
const barWidth = (width / samples) - padding * 2;
|
|
86
86
|
const audio = this.audioElement.nativeElement;
|
|
87
87
|
const playedPercent = audio.currentTime / this.audioDuration;
|
|
@@ -58,12 +58,12 @@
|
|
|
58
58
|
(onElementRendered)="onElementRenderedFN($event)">
|
|
59
59
|
</chat-audio> -->
|
|
60
60
|
|
|
61
|
-
<chat-audio
|
|
61
|
+
<chat-audio *ngIf="isAudio(message)"
|
|
62
62
|
[metadata]="message.metadata"
|
|
63
63
|
[color]="fontColor"
|
|
64
64
|
[fontSize]="fontSize"
|
|
65
65
|
[stylesMap]="stylesMap">
|
|
66
|
-
</chat-audio
|
|
66
|
+
</chat-audio>
|
|
67
67
|
|
|
68
68
|
|
|
69
69
|
<!-- <chat-frame *ngIf="message.metadata && message.metadata.type && message.metadata.type.includes('video')"
|
|
File without changes
|