@chat21/chat21-web-widget 5.0.85-rc.2 → 5.0.86
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 +1 -19
- package/package.json +1 -1
- package/src/app/app.module.ts +2 -5
- package/src/app/component/conversation-detail/conversation/conversation.component.ts +15 -14
- package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.html +3 -14
- package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.scss +10 -26
- package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.ts +77 -168
- package/src/app/component/message/audio/audio.component.html +20 -0
- package/src/app/component/message/audio/audio.component.scss +122 -0
- package/src/app/component/message/{audio-track/audio-track.component.spec.ts → audio/audio.component.spec.ts} +6 -6
- package/src/app/component/message/audio/audio.component.ts +122 -0
- package/src/app/component/message/bubble-message/bubble-message.component.html +15 -31
- package/src/app/component/message/bubble-message/bubble-message.component.scss +0 -7
- package/src/app/component/message/bubble-message/bubble-message.component.ts +0 -1
- package/src/app/modals/confirm-close/confirm-close.component.html +1 -1
- package/src/app/utils/globals.ts +1 -1
- package/src/app/utils/utils.ts +0 -45
- package/src/assets/twp/blank.html +6 -3
- package/src/assets/twp/chatbot-panel.html +13 -5
- package/src/assets/twp/index-dev.html +15 -8
- package/src/assets/twp/index.html +13 -7
- package/src/assets/twp/tiledesk_widget_files/bootstrap.min.css +3 -4
- package/src/assets/twp/tiledesk_widget_files/bootstrap.min.js +4 -3
- package/src/assets/twp/tiledesk_widget_files/jquery.min.js +2 -2
- package/src/app/component/conversation-detail/conversation-audio-recorder/conversation-audio-recorder.component.html +0 -29
- package/src/app/component/conversation-detail/conversation-audio-recorder/conversation-audio-recorder.component.scss +0 -103
- package/src/app/component/conversation-detail/conversation-audio-recorder/conversation-audio-recorder.component.spec.ts +0 -23
- package/src/app/component/conversation-detail/conversation-audio-recorder/conversation-audio-recorder.component.ts +0 -96
- package/src/app/component/message/audio-track/audio-track.component.html +0 -32
- package/src/app/component/message/audio-track/audio-track.component.scss +0 -107
- package/src/app/component/message/audio-track/audio-track.component.ts +0 -147
package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Component, ComponentFactoryResolver, ElementRef, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges, ViewChild, ViewContainerRef } from '@angular/core';
|
|
2
2
|
import { Globals } from 'src/app/utils/globals';
|
|
3
|
-
import { checkAcceptedFile } from 'src/app/utils/utils';
|
|
4
3
|
import { MessageModel } from 'src/chat21-core/models/message';
|
|
5
4
|
import { UploadModel } from 'src/chat21-core/models/upload';
|
|
6
5
|
import { ConversationHandlerService } from 'src/chat21-core/providers/abstract/conversation-handler.service';
|
|
@@ -60,8 +59,6 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
60
59
|
// ========= end:: send image ========= //
|
|
61
60
|
|
|
62
61
|
// isNewConversation = true;
|
|
63
|
-
isStartRec: boolean = false;
|
|
64
|
-
isStopRec: boolean = false;
|
|
65
62
|
textInputTextArea: string;
|
|
66
63
|
conversationHandlerService: ConversationHandlerService
|
|
67
64
|
|
|
@@ -101,7 +98,7 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
101
98
|
}
|
|
102
99
|
|
|
103
100
|
ngAfterViewInit() {
|
|
104
|
-
this.logger.
|
|
101
|
+
this.logger.debug('[CONV-FOOTER] --------ngAfterViewInit: conversation-footer-------- ');
|
|
105
102
|
// setTimeout(() => {
|
|
106
103
|
this.showEmojiPicker = true
|
|
107
104
|
// }, 500);
|
|
@@ -111,18 +108,19 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
111
108
|
// START LOAD IMAGE //
|
|
112
109
|
/** load the selected image locally and open the pop up preview */
|
|
113
110
|
detectFiles(event) {
|
|
114
|
-
this.logger.
|
|
111
|
+
this.logger.debug('[CONV-FOOTER] detectFiles: ', event);
|
|
112
|
+
|
|
115
113
|
if (event) {
|
|
116
114
|
this.selectedFiles = event.target.files;
|
|
117
|
-
this.logger.
|
|
115
|
+
this.logger.debug('[CONV-FOOTER] AppComponent:detectFiles::selectedFiles', this.selectedFiles);
|
|
118
116
|
// this.onAttachmentButtonClicked.emit(this.selectedFiles)
|
|
119
117
|
if (this.selectedFiles == null) {
|
|
120
118
|
this.isFilePendingToUpload = false;
|
|
121
119
|
} else {
|
|
122
120
|
this.isFilePendingToUpload = true;
|
|
123
121
|
}
|
|
124
|
-
this.logger.
|
|
125
|
-
this.logger.
|
|
122
|
+
this.logger.debug('[CONV-FOOTER] AppComponent:detectFiles::selectedFiles::isFilePendingToUpload', this.isFilePendingToUpload);
|
|
123
|
+
this.logger.debug('[CONV-FOOTER] fileChange: ', event.target.files);
|
|
126
124
|
if (event.target.files.length <= 0) {
|
|
127
125
|
this.isFilePendingToUpload = false;
|
|
128
126
|
} else {
|
|
@@ -131,72 +129,62 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
131
129
|
|
|
132
130
|
const that = this;
|
|
133
131
|
if (event.target.files && event.target.files[0]) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
132
|
+
const nameFile = event.target.files[0].name;
|
|
133
|
+
const typeFile = event.target.files[0].type;
|
|
134
|
+
const size = event.target.files[0].size
|
|
135
|
+
const reader = new FileReader();
|
|
136
|
+
that.logger.debug('[CONV-FOOTER] OK preload: ', nameFile, typeFile, reader);
|
|
137
|
+
reader.addEventListener('load', function () {
|
|
138
|
+
that.logger.debug('[CONV-FOOTER] addEventListener load', reader.result);
|
|
139
|
+
that.isFileSelected = true;
|
|
140
|
+
// se inizia con image
|
|
141
|
+
if (typeFile.startsWith('image') && !typeFile.includes('svg')) {
|
|
142
|
+
const imageXLoad = new Image;
|
|
143
|
+
that.logger.debug('[CONV-FOOTER] onload ', imageXLoad);
|
|
144
|
+
imageXLoad.src = reader.result.toString();
|
|
145
|
+
imageXLoad.title = nameFile;
|
|
146
|
+
imageXLoad.onload = function () {
|
|
147
|
+
that.logger.debug('[CONV-FOOTER] onload image');
|
|
148
|
+
// that.arrayFilesLoad.push(imageXLoad);
|
|
149
|
+
const uid = (new Date().getTime()).toString(36); // imageXLoad.src.substring(imageXLoad.src.length - 16);
|
|
150
|
+
that.arrayFilesLoad[0] = { uid: uid, file: imageXLoad, type: typeFile, size: size };
|
|
151
|
+
that.logger.debug('[CONV-FOOTER] OK: ', that.arrayFilesLoad[0]);
|
|
152
|
+
// SEND MESSAGE
|
|
153
|
+
that.loadFile();
|
|
154
|
+
};
|
|
155
|
+
} else {
|
|
156
|
+
that.logger.debug('[CONV-FOOTER] onload file');
|
|
157
|
+
const fileXLoad = {
|
|
158
|
+
src: reader.result.toString(),
|
|
159
|
+
title: nameFile
|
|
160
|
+
};
|
|
158
161
|
// that.arrayFilesLoad.push(imageXLoad);
|
|
159
162
|
const uid = (new Date().getTime()).toString(36); // imageXLoad.src.substring(imageXLoad.src.length - 16);
|
|
160
|
-
that.arrayFilesLoad[0] = { uid: uid, file:
|
|
163
|
+
that.arrayFilesLoad[0] = { uid: uid, file: fileXLoad, type: typeFile, size: size };
|
|
161
164
|
that.logger.debug('[CONV-FOOTER] OK: ', that.arrayFilesLoad[0]);
|
|
162
165
|
// SEND MESSAGE
|
|
163
166
|
that.loadFile();
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
that.logger.debug('[CONV-FOOTER] onload file');
|
|
167
|
-
const fileXLoad = {
|
|
168
|
-
src: reader.result.toString(),
|
|
169
|
-
title: nameFile
|
|
170
|
-
};
|
|
171
|
-
// that.arrayFilesLoad.push(imageXLoad);
|
|
172
|
-
const uid = (new Date().getTime()).toString(36); // imageXLoad.src.substring(imageXLoad.src.length - 16);
|
|
173
|
-
that.arrayFilesLoad[0] = { uid: uid, file: fileXLoad, type: typeFile, size: size };
|
|
174
|
-
that.logger.debug('[CONV-FOOTER] OK: ', that.arrayFilesLoad[0]);
|
|
175
|
-
// SEND MESSAGE
|
|
176
|
-
that.loadFile();
|
|
177
|
-
}
|
|
178
|
-
}, false);
|
|
167
|
+
}
|
|
168
|
+
}, false);
|
|
179
169
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
170
|
+
if (event.target.files[0]) {
|
|
171
|
+
reader.readAsDataURL(event.target.files[0]);
|
|
172
|
+
that.logger.debug('[CONV-FOOTER] reader-result: ', event.target.files[0]);
|
|
173
|
+
}
|
|
184
174
|
}
|
|
185
175
|
}
|
|
186
176
|
}
|
|
187
177
|
|
|
188
|
-
|
|
189
|
-
|
|
190
178
|
|
|
191
179
|
loadFile() {
|
|
192
|
-
this.logger.
|
|
180
|
+
this.logger.debug('[CONV-FOOTER] that.fileXLoad: ', this.arrayFilesLoad);
|
|
193
181
|
// at the moment I only manage the upload of one image at a time
|
|
194
182
|
if (this.arrayFilesLoad[0] && this.arrayFilesLoad[0].file) {
|
|
195
183
|
const fileXLoad = this.arrayFilesLoad[0].file;
|
|
196
184
|
const uid = this.arrayFilesLoad[0].uid;
|
|
197
185
|
const type = this.arrayFilesLoad[0].type;
|
|
198
186
|
const size = this.arrayFilesLoad[0].size
|
|
199
|
-
this.logger.
|
|
187
|
+
this.logger.debug('[CONV-FOOTER] that.fileXLoad: ', type);
|
|
200
188
|
let metadata;
|
|
201
189
|
if (type.startsWith('image') && !type.includes('svg')) {
|
|
202
190
|
metadata = {
|
|
@@ -217,7 +205,7 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
217
205
|
'size': size
|
|
218
206
|
};
|
|
219
207
|
}
|
|
220
|
-
this.logger.
|
|
208
|
+
this.logger.debug('[CONV-FOOTER] metadata -------> ', metadata);
|
|
221
209
|
// this.scrollToBottom();
|
|
222
210
|
// 1 - aggiungo messaggio localmente
|
|
223
211
|
// this.addLocalMessageImage(metadata);
|
|
@@ -234,20 +222,17 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
234
222
|
|
|
235
223
|
uploadSingle(metadata, file, messageText?: string) {
|
|
236
224
|
const that = this;
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
} catch (error) {
|
|
241
|
-
that.logger.log('[CONV-FOOTER] error::', error);
|
|
242
|
-
}
|
|
243
|
-
that.logger.log('[CONV-FOOTER] AppComponent::uploadSingle::', metadata, file);
|
|
225
|
+
const send_order_btn = <HTMLInputElement>document.getElementById('chat21-start-upload-doc');
|
|
226
|
+
send_order_btn.disabled = true;
|
|
227
|
+
that.logger.debug('[CONV-FOOTER] AppComponent::uploadSingle::', metadata, file);
|
|
244
228
|
// const file = this.selectedFiles.item(0);
|
|
245
229
|
const currentUpload = new UploadModel(file);
|
|
230
|
+
|
|
246
231
|
// const uploadTask = this.upSvc.pushUpload(currentUpload);
|
|
247
232
|
// uploadTask.then(snapshot => {
|
|
248
233
|
// return snapshot.ref.getDownloadURL(); // Will return a promise with the download link
|
|
249
234
|
// }).then(downloadURL => {
|
|
250
|
-
// that.logger.
|
|
235
|
+
// that.logger.debug('[CONV-FOOTER] AppComponent::uploadSingle:: downloadURL', downloadURL]);
|
|
251
236
|
// that.g.wdLog([`Successfully uploaded file and got download link - ${downloadURL}`]);
|
|
252
237
|
|
|
253
238
|
// metadata.src = downloadURL;
|
|
@@ -267,8 +252,8 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
267
252
|
// this.resetLoadImage();
|
|
268
253
|
|
|
269
254
|
this.uploadService.upload(this.senderId, currentUpload).then(data => {
|
|
270
|
-
that.logger.
|
|
271
|
-
that.logger.
|
|
255
|
+
that.logger.debug('[CONV-FOOTER] AppComponent::uploadSingle:: downloadURL', data);
|
|
256
|
+
that.logger.debug(`[CONV-FOOTER] Successfully uploaded file and got download link - ${data}`);
|
|
272
257
|
|
|
273
258
|
metadata.src = data.src;
|
|
274
259
|
metadata.downloadURL = data.downloadURL;
|
|
@@ -297,7 +282,7 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
297
282
|
that.logger.error(`[CONV-FOOTER] uploadSingle:: Failed to upload file and get link - ${error}`);
|
|
298
283
|
that.isFilePendingToUpload = false;
|
|
299
284
|
});
|
|
300
|
-
that.logger.
|
|
285
|
+
that.logger.debug('[CONV-FOOTER] reader-result: ', file);
|
|
301
286
|
}
|
|
302
287
|
|
|
303
288
|
/**
|
|
@@ -310,7 +295,7 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
310
295
|
sendMessage(msg: string, type: string, metadata?: any, additional_attributes?: any) { // sponziello
|
|
311
296
|
(metadata) ? metadata = metadata : metadata = '';
|
|
312
297
|
this.onEmojiiPickerShow.emit(false)
|
|
313
|
-
this.logger.
|
|
298
|
+
this.logger.debug('[CONV-FOOTER] SEND MESSAGE: ', msg, type, metadata, additional_attributes);
|
|
314
299
|
if (msg && msg.trim() !== '' || type === TYPE_MSG_IMAGE || type === TYPE_MSG_FILE ) {
|
|
315
300
|
|
|
316
301
|
// msg = htmlEntities(msg);
|
|
@@ -393,7 +378,7 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
393
378
|
}
|
|
394
379
|
|
|
395
380
|
private restoreTextArea() {
|
|
396
|
-
// that.logger.
|
|
381
|
+
// that.logger.debug('[CONV-FOOTER] AppComponent:restoreTextArea::restoreTextArea');
|
|
397
382
|
this.resizeInputField();
|
|
398
383
|
const textArea = (<HTMLInputElement>document.getElementById('chat21-main-message-context'));
|
|
399
384
|
this.textInputTextArea = ''; // clear the textarea
|
|
@@ -403,7 +388,7 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
403
388
|
if(textArea.style.height > this.HEIGHT_DEFAULT){
|
|
404
389
|
document.getElementById('chat21-button-send').style.removeProperty('right')
|
|
405
390
|
}
|
|
406
|
-
this.logger.
|
|
391
|
+
this.logger.debug('[CONV-FOOTER] AppComponent:restoreTextArea::restoreTextArea::textArea:', 'restored');
|
|
407
392
|
}
|
|
408
393
|
this.setFocusOnId('chat21-main-message-context');
|
|
409
394
|
}
|
|
@@ -417,7 +402,7 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
417
402
|
try {
|
|
418
403
|
const target = document.getElementById('chat21-main-message-context') as HTMLInputElement;
|
|
419
404
|
// tslint:disable-next-line:max-line-length
|
|
420
|
-
// that.logger.
|
|
405
|
+
// that.logger.debug('[CONV-FOOTER] H:: this.textInputTextArea', (document.getElementById('chat21-main-message-context') as HTMLInputElement).value , target.style.height, target.scrollHeight, target.offsetHeight, target.clientHeight);
|
|
421
406
|
target? target.style.height = '100%': null;
|
|
422
407
|
if (target && target.value === '\n') {
|
|
423
408
|
target.value = '';
|
|
@@ -437,104 +422,28 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
437
422
|
}
|
|
438
423
|
}
|
|
439
424
|
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
onStartRecording() {
|
|
443
|
-
this.isStartRec = true;
|
|
444
|
-
this.isStopRec = false;
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
onDeleteRecording(){
|
|
448
|
-
this.isStartRec = false;
|
|
449
|
-
this.isStopRec = false;
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
onEndRecording(audioBlob: Blob | null) {
|
|
453
|
-
this.isStartRec = false;
|
|
454
|
-
this.isStopRec = true;
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
onSendRecording(audioBlob: Blob | null) {
|
|
460
|
-
this.isStartRec = false;
|
|
461
|
-
if (audioBlob) {
|
|
462
|
-
this.convertBlobToBase64(audioBlob);
|
|
463
|
-
this.isStopRec = false;
|
|
464
|
-
} else {
|
|
465
|
-
this.isStopRec = false;
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
// Funzione per convertire Blob in Base64 usando FileReader
|
|
472
|
-
async convertBlobToBase64(audioBlob: Blob) {
|
|
473
|
-
let that = this;
|
|
474
|
-
if (audioBlob) {
|
|
475
|
-
this.isFilePendingToUpload = true;
|
|
476
|
-
} else {
|
|
477
|
-
this.isFilePendingToUpload = false;
|
|
478
|
-
}
|
|
479
|
-
const type = audioBlob.type;
|
|
480
|
-
const size = audioBlob.size;
|
|
481
|
-
const reader = new FileReader();
|
|
482
|
-
reader.readAsDataURL(audioBlob);
|
|
483
|
-
//reader.addEventListener('load', function () {
|
|
484
|
-
reader.onloadend = () => {
|
|
485
|
-
that.isFileSelected = true;
|
|
486
|
-
// const base64data = reader.result as string;
|
|
487
|
-
that.logger.log('[CONV-FOOTER] onload file');
|
|
488
|
-
const fileXLoad = {
|
|
489
|
-
src: reader.result.toString(),
|
|
490
|
-
title: 'audio-file'
|
|
491
|
-
};
|
|
492
|
-
const uid = (new Date().getTime()).toString(36);
|
|
493
|
-
that.arrayFilesLoad[0] = { uid: uid, file: fileXLoad, type: type, size: size };
|
|
494
|
-
that.logger.log('[CONV-FOOTER] OK: ', that.arrayFilesLoad[0]);
|
|
495
|
-
// SEND MESSAGE
|
|
496
|
-
let metadata = {
|
|
497
|
-
'name': 'audio-file',
|
|
498
|
-
'src': fileXLoad.src,
|
|
499
|
-
'type': type,
|
|
500
|
-
'uid': uid,
|
|
501
|
-
'size': size
|
|
502
|
-
};
|
|
503
|
-
|
|
504
|
-
const file = new File([audioBlob], "audio-file.mp3", {
|
|
505
|
-
type: audioBlob.type,
|
|
506
|
-
lastModified: Date.now()
|
|
507
|
-
});
|
|
508
|
-
|
|
509
|
-
that.uploadSingle(metadata, file, '');
|
|
510
|
-
};
|
|
511
|
-
//}, false);
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
425
|
onTextAreaChange(){
|
|
517
426
|
this.resizeInputField()
|
|
518
427
|
this.setWritingMessages(this.textInputTextArea)
|
|
519
428
|
}
|
|
520
429
|
|
|
521
430
|
onSendPressed(event) {
|
|
522
|
-
this.logger.
|
|
431
|
+
this.logger.debug('[CONV-FOOTER] onSendPressed:event', event);
|
|
523
432
|
event.preventDefault();
|
|
524
|
-
this.logger.
|
|
433
|
+
this.logger.debug('[CONV-FOOTER] AppComponent::onSendPressed::isFilePendingToUpload:', this.isFilePendingToUpload);
|
|
525
434
|
if (this.isFilePendingToUpload) {
|
|
526
|
-
this.logger.
|
|
435
|
+
this.logger.debug('[CONV-FOOTER] AppComponent::onSendPressed', 'is a file');
|
|
527
436
|
// its a file
|
|
528
437
|
this.loadFile();
|
|
529
438
|
this.isFilePendingToUpload = false;
|
|
530
439
|
// disabilito pulsanti
|
|
531
|
-
this.logger.
|
|
440
|
+
this.logger.debug('[CONV-FOOTER] AppComponent::onSendPressed::isFilePendingToUpload:', this.isFilePendingToUpload);
|
|
532
441
|
} else {
|
|
533
442
|
if ( this.textInputTextArea && this.textInputTextArea.length > 0 ) {
|
|
534
|
-
this.logger.
|
|
443
|
+
this.logger.debug('[CONV-FOOTER] AppComponent::onSendPressed', 'is a message');
|
|
535
444
|
// its a message
|
|
536
445
|
if (this.textInputTextArea.trim() !== '') {
|
|
537
|
-
// that.logger.
|
|
446
|
+
// that.logger.debug('[CONV-FOOTER] sendMessage -> ', this.textInputTextArea);
|
|
538
447
|
// this.resizeInputField();
|
|
539
448
|
// this.messagingService.sendMessage(msg, TYPE_MSG_TEXT);
|
|
540
449
|
// this.setDepartment();
|
|
@@ -608,7 +517,7 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
608
517
|
setTimeout(function () {
|
|
609
518
|
const textarea = document.getElementById(id);
|
|
610
519
|
if (textarea) {
|
|
611
|
-
// that.logger.
|
|
520
|
+
// that.logger.debug('[CONV-FOOTER] 1--------> FOCUSSSSSS : ', textarea);
|
|
612
521
|
textarea.setAttribute('value', ' ');
|
|
613
522
|
textarea.focus();
|
|
614
523
|
}
|
|
@@ -648,7 +557,7 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
648
557
|
this.textInputTextArea = ((document.getElementById('chat21-main-message-context') as HTMLInputElement).value);
|
|
649
558
|
if (keyCode === 13) { // ENTER pressed
|
|
650
559
|
if (this.textInputTextArea && this.textInputTextArea.trim() !== '') {
|
|
651
|
-
// that.logger.
|
|
560
|
+
// that.logger.debug('[CONV-FOOTER] sendMessage -> ', this.textInputTextArea);
|
|
652
561
|
// this.resizeInputField();
|
|
653
562
|
// this.messagingService.sendMessage(msg, TYPE_MSG_TEXT);
|
|
654
563
|
// this.setDepartment();
|
|
@@ -680,14 +589,14 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
680
589
|
this.resizeInputField()
|
|
681
590
|
const items = (event.clipboardData || event.originalEvent.clipboardData).items;
|
|
682
591
|
let file = null;
|
|
683
|
-
this.logger.
|
|
592
|
+
this.logger.debug('[CONV-FOOTER] onPaste items ', items);
|
|
684
593
|
for (const item of items) {
|
|
685
|
-
this.logger.
|
|
686
|
-
this.logger.
|
|
594
|
+
this.logger.debug('[CONV-FOOTER] onPaste item ', item);
|
|
595
|
+
this.logger.debug('[CONV-FOOTER] onPaste item.type ', item.type);
|
|
687
596
|
if (item.type.startsWith("image")) {
|
|
688
597
|
// SEND TEXT MESSAGE IF EXIST
|
|
689
598
|
// if(this.textInputTextArea){
|
|
690
|
-
// this.logger.
|
|
599
|
+
// this.logger.debug('[CONV-FOOTER] onPaste texttt ', this.textInputTextArea);
|
|
691
600
|
// this.sendMessage(this.textInputTextArea, TYPE_MSG_TEXT)
|
|
692
601
|
// }
|
|
693
602
|
|
|
@@ -697,12 +606,12 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
697
606
|
this.logger.error('[CONV-FOOTER] onPaste - error while restoring textArea:',e)
|
|
698
607
|
}
|
|
699
608
|
|
|
700
|
-
this.logger.
|
|
609
|
+
this.logger.debug('[CONV-FOOTER] onPaste item.type', item.type);
|
|
701
610
|
file = item.getAsFile();
|
|
702
611
|
const data = {target: new ClipboardEvent('').clipboardData || new DataTransfer()};
|
|
703
612
|
data.target.items.add(new File([file], file.name, { type: file.type }));
|
|
704
|
-
this.logger.
|
|
705
|
-
this.logger.
|
|
613
|
+
this.logger.debug('[CONV-FOOTER] onPaste data', data);
|
|
614
|
+
this.logger.debug('[CONV-FOOTER] onPaste file ', file);
|
|
706
615
|
this.detectFiles(data)
|
|
707
616
|
}
|
|
708
617
|
}
|
|
@@ -711,15 +620,15 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
711
620
|
onDrop(event){
|
|
712
621
|
const items = event.dataTransfer.files;
|
|
713
622
|
let file = null;
|
|
714
|
-
this.logger.
|
|
623
|
+
this.logger.debug('[CONV-FOOTER] onDrop items ', items);
|
|
715
624
|
for (const item of items) {
|
|
716
|
-
this.logger.
|
|
717
|
-
this.logger.
|
|
625
|
+
this.logger.debug('[CONV-FOOTER] onDrop item ', item);
|
|
626
|
+
this.logger.debug('[CONV-FOOTER] onDrop item.type ', item.type);
|
|
718
627
|
|
|
719
628
|
const data = {target: {files: new DataTransfer()}}
|
|
720
629
|
data.target.files = items
|
|
721
|
-
this.logger.
|
|
722
|
-
this.logger.
|
|
630
|
+
this.logger.debug('[CONV-FOOTER] onDrop data', data);
|
|
631
|
+
this.logger.debug('[CONV-FOOTER] onDrop file ', file);
|
|
723
632
|
this.detectFiles(data)
|
|
724
633
|
}
|
|
725
634
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
<div id="audio_container" #audio_container>
|
|
4
|
+
|
|
5
|
+
<audio aria-label="traccia audio" #audio_msg controls controlsList="nodownload" id="audio_msg" (pause)="pauseAudioMsg($event)" (play)="playAudioMsg($event)" (timeupdate)="updateTimeAudioMsg($event)">
|
|
6
|
+
<source [src]="metadata?.src" [type]="metadata?.type">
|
|
7
|
+
<!-- {{metadata?.src}} -->
|
|
8
|
+
<!-- controlsList="nodownload" -->
|
|
9
|
+
</audio>
|
|
10
|
+
|
|
11
|
+
<!-- <button id="play-icon" (click)="onPlayPause('play')" *ngIf="status === 'play'">
|
|
12
|
+
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M10 8.64L15.27 12 10 15.36V8.64M8 5v14l11-7L8 5z"/></svg>
|
|
13
|
+
</button>
|
|
14
|
+
<button id="pause-icon" (click)="onPlayPause('pause')" *ngIf="status === 'pause'">
|
|
15
|
+
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M6 19h4V5H6v14zm8-14v14h4V5h-4z"/></svg>
|
|
16
|
+
</button>
|
|
17
|
+
<div id="duration" #duration>0:00</div>
|
|
18
|
+
<input type="range" id="seek-slider" max="100" value="0"> -->
|
|
19
|
+
</div>
|
|
20
|
+
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
#audio_container{
|
|
2
|
+
display: flex;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
#play-icon,
|
|
6
|
+
#pause-icon {
|
|
7
|
+
margin: 20px 2.5% 10px 2.5%;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.time {
|
|
11
|
+
display: inline-block;
|
|
12
|
+
width: 37px;
|
|
13
|
+
text-align: center;
|
|
14
|
+
font-size: 20px;
|
|
15
|
+
margin: 28.5px 0 18.5px 0;
|
|
16
|
+
float: left;
|
|
17
|
+
}
|
|
18
|
+
output {
|
|
19
|
+
display: inline-block;
|
|
20
|
+
width: 32px;
|
|
21
|
+
text-align: center;
|
|
22
|
+
font-size: 20px;
|
|
23
|
+
margin: 10px 2.5% 0 5%;
|
|
24
|
+
float: left;
|
|
25
|
+
clear: left;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
input[type="range"] {
|
|
29
|
+
position: relative;
|
|
30
|
+
-webkit-appearance: none;
|
|
31
|
+
width: 48%;
|
|
32
|
+
margin: 0;
|
|
33
|
+
padding: 0;
|
|
34
|
+
height: 19px;
|
|
35
|
+
margin: 30px 2.5% 20px 2.5%;
|
|
36
|
+
float: left;
|
|
37
|
+
outline: none;
|
|
38
|
+
}
|
|
39
|
+
input[type="range"]::-webkit-slider-runnable-track {
|
|
40
|
+
width: 100%;
|
|
41
|
+
height: 3px;
|
|
42
|
+
cursor: pointer;
|
|
43
|
+
background: linear-gradient(to right, rgba(0, 125, 181, 0.6) var(--buffered-width), rgba(0, 125, 181, 0.2) var(--buffered-width));
|
|
44
|
+
}
|
|
45
|
+
input[type="range"]::before {
|
|
46
|
+
position: absolute;
|
|
47
|
+
content: "";
|
|
48
|
+
top: 8px;
|
|
49
|
+
left: 0;
|
|
50
|
+
width: var(--seek-before-width);
|
|
51
|
+
height: 3px;
|
|
52
|
+
background-color: #007db5;
|
|
53
|
+
cursor: pointer;
|
|
54
|
+
}
|
|
55
|
+
input[type="range"]::-webkit-slider-thumb {
|
|
56
|
+
position: relative;
|
|
57
|
+
-webkit-appearance: none;
|
|
58
|
+
box-sizing: content-box;
|
|
59
|
+
border: 1px solid #007db5;
|
|
60
|
+
height: 15px;
|
|
61
|
+
width: 15px;
|
|
62
|
+
border-radius: 50%;
|
|
63
|
+
background-color: #fff;
|
|
64
|
+
cursor: pointer;
|
|
65
|
+
margin: -7px 0 0 0;
|
|
66
|
+
}
|
|
67
|
+
input[type="range"]:active::-webkit-slider-thumb {
|
|
68
|
+
transform: scale(1.2);
|
|
69
|
+
background: #007db5;
|
|
70
|
+
}
|
|
71
|
+
input[type="range"]::-moz-range-track {
|
|
72
|
+
width: 100%;
|
|
73
|
+
height: 3px;
|
|
74
|
+
cursor: pointer;
|
|
75
|
+
background: linear-gradient(to right, rgba(0, 125, 181, 0.6) var(--buffered-width), rgba(0, 125, 181, 0.2) var(--buffered-width));
|
|
76
|
+
}
|
|
77
|
+
input[type="range"]::-moz-range-progress {
|
|
78
|
+
background-color: #007db5;
|
|
79
|
+
}
|
|
80
|
+
input[type="range"]::-moz-focus-outer {
|
|
81
|
+
border: 0;
|
|
82
|
+
}
|
|
83
|
+
input[type="range"]::-moz-range-thumb {
|
|
84
|
+
box-sizing: content-box;
|
|
85
|
+
border: 1px solid #007db5;
|
|
86
|
+
height: 15px;
|
|
87
|
+
width: 15px;
|
|
88
|
+
border-radius: 50%;
|
|
89
|
+
background-color: #fff;
|
|
90
|
+
cursor: pointer;
|
|
91
|
+
}
|
|
92
|
+
input[type="range"]:active::-moz-range-thumb {
|
|
93
|
+
transform: scale(1.2);
|
|
94
|
+
background: #007db5;
|
|
95
|
+
}
|
|
96
|
+
input[type="range"]::-ms-track {
|
|
97
|
+
width: 100%;
|
|
98
|
+
height: 3px;
|
|
99
|
+
cursor: pointer;
|
|
100
|
+
background: transparent;
|
|
101
|
+
border: solid transparent;
|
|
102
|
+
color: transparent;
|
|
103
|
+
}
|
|
104
|
+
input[type="range"]::-ms-fill-lower {
|
|
105
|
+
background-color: #007db5;
|
|
106
|
+
}
|
|
107
|
+
input[type="range"]::-ms-fill-upper {
|
|
108
|
+
background: linear-gradient(to right, rgba(0, 125, 181, 0.6) var(--buffered-width), rgba(0, 125, 181, 0.2) var(--buffered-width));
|
|
109
|
+
}
|
|
110
|
+
input[type="range"]::-ms-thumb {
|
|
111
|
+
box-sizing: content-box;
|
|
112
|
+
border: 1px solid #007db5;
|
|
113
|
+
height: 15px;
|
|
114
|
+
width: 15px;
|
|
115
|
+
border-radius: 50%;
|
|
116
|
+
background-color: #fff;
|
|
117
|
+
cursor: pointer;
|
|
118
|
+
}
|
|
119
|
+
input[type="range"]:active::-ms-thumb {
|
|
120
|
+
transform: scale(1.2);
|
|
121
|
+
background: #007db5;
|
|
122
|
+
}
|
|
@@ -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
|
-
describe('
|
|
6
|
-
let component:
|
|
7
|
-
let fixture: ComponentFixture<
|
|
5
|
+
describe('AudioComponent', () => {
|
|
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
|
});
|