@chat21/chat21-web-widget 5.0.89-rc.2 → 5.0.90-rc.1
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 +10 -5
- package/package.json +1 -1
- package/src/app/app.component.ts +15 -11
- package/src/app/app.module.ts +2 -5
- 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 +41 -123
- 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 +5 -30
- 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/utils/globals.ts +1 -1
- package/src/assets/twp/index-dev.html +0 -1
- 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/CHANGELOG.md
CHANGED
|
@@ -6,11 +6,16 @@
|
|
|
6
6
|
### **Copyrigth**:
|
|
7
7
|
*Tiledesk SRL*
|
|
8
8
|
|
|
9
|
-
# 5.0.
|
|
10
|
-
-
|
|
9
|
+
# 5.0.90-rc.1
|
|
10
|
+
- **bug-fixed**: if autoStart is false, container page is blocked on mobile when onPageChangeVisibilityMobile is set to 'open'
|
|
11
|
+
|
|
12
|
+
# 5.0.89 in PROD
|
|
13
|
+
|
|
14
|
+
# 5.0.88 in PROD
|
|
15
|
+
|
|
16
|
+
# 5.0.87 in PROD
|
|
11
17
|
|
|
12
|
-
# 5.0.
|
|
13
|
-
- **added**: remove recipientId from storage after conversation is closed
|
|
18
|
+
# 5.0.86 in PROD
|
|
14
19
|
|
|
15
20
|
# 5.0.85-rc.2
|
|
16
21
|
- **added**: loading progress indicator while closing a conversation
|
|
@@ -19,7 +24,7 @@
|
|
|
19
24
|
- **added**: hide header restart menu option if conversation is closed
|
|
20
25
|
- **removed**: continueConversationBeforeTime settings property
|
|
21
26
|
|
|
22
|
-
# 5.0.
|
|
27
|
+
# 5.0.84 in PROD
|
|
23
28
|
|
|
24
29
|
# 5.0.84-rc.4
|
|
25
30
|
- **added**: checkAcceptedFile fn on dragleave event conversation-content component
|
package/package.json
CHANGED
package/src/app/app.component.ts
CHANGED
|
@@ -267,17 +267,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
267
267
|
this.disposeWidget()
|
|
268
268
|
return;
|
|
269
269
|
}
|
|
270
|
-
|
|
271
|
-
if(this.g.isMobile && this.g.onPageChangeVisibilityMobile !== 'last'){
|
|
272
|
-
let isOpen = this.g.onPageChangeVisibilityMobile === 'open'? true: false
|
|
273
|
-
this.g.setIsOpen(isOpen)
|
|
274
|
-
this.appStorageService.setItem('isOpen', isOpen)
|
|
275
|
-
}
|
|
276
|
-
if(!this.g.isMobile && this.g.onPageChangeVisibilityDesktop !== 'last'){
|
|
277
|
-
let isOpen = this.g.onPageChangeVisibilityDesktop === 'open'? true: false
|
|
278
|
-
this.g.setIsOpen(isOpen)
|
|
279
|
-
this.appStorageService.setItem('isOpen', isOpen)
|
|
280
|
-
}
|
|
270
|
+
|
|
281
271
|
|
|
282
272
|
/**CHECK IF JWT IS IN URL PARAMETERS */
|
|
283
273
|
this.logger.debug('[APP-COMP] check if token is passed throw url: ', this.g.jwt);
|
|
@@ -433,6 +423,20 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
433
423
|
that.listenToWidgetClick()
|
|
434
424
|
}
|
|
435
425
|
|
|
426
|
+
|
|
427
|
+
//set status (open /close)
|
|
428
|
+
if(this.g.isMobile && this.g.onPageChangeVisibilityMobile !== 'last'){
|
|
429
|
+
let isOpen = this.g.onPageChangeVisibilityMobile === 'open'? true: false
|
|
430
|
+
this.g.setIsOpen(isOpen)
|
|
431
|
+
this.appStorageService.setItem('isOpen', isOpen)
|
|
432
|
+
}
|
|
433
|
+
if(!this.g.isMobile && this.g.onPageChangeVisibilityDesktop !== 'last'){
|
|
434
|
+
let isOpen = this.g.onPageChangeVisibilityDesktop === 'open'? true: false
|
|
435
|
+
this.g.setIsOpen(isOpen)
|
|
436
|
+
this.appStorageService.setItem('isOpen', isOpen)
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
|
|
436
440
|
} else if (state && state === AUTH_STATE_OFFLINE && !this.forceDisconnect) {
|
|
437
441
|
/** non sono loggato */
|
|
438
442
|
that.logger.info('[APP-COMP] OFFLINE - NO CURRENT USER AUTENTICATE: ');
|
package/src/app/app.module.ts
CHANGED
|
@@ -15,7 +15,6 @@ import { ConversationContentComponent } from './component/conversation-detail/co
|
|
|
15
15
|
import { ConversationFooterComponent } from './component/conversation-detail/conversation-footer/conversation-footer.component';
|
|
16
16
|
import { ConversationInternalFrameComponent } from './component/conversation-detail/conversation-internal-frame/conversation-internal-frame.component';
|
|
17
17
|
import { ConversationPreviewComponent } from './component/conversation-detail/conversation-preview/conversation-preview.component';
|
|
18
|
-
import { ConversationAudioRecorderComponent } from './component/conversation-detail/conversation-audio-recorder/conversation-audio-recorder.component';
|
|
19
18
|
/** CONVERSATION-DETAIL COMPONENTS */
|
|
20
19
|
import { BubbleMessageComponent } from './component/message/bubble-message/bubble-message.component';
|
|
21
20
|
import { AvatarComponent } from './component/message/avatar/avatar.component';
|
|
@@ -24,7 +23,7 @@ import { ImageComponent } from './component/message/image/image.component';
|
|
|
24
23
|
import { InfoMessageComponent } from './component/message/info-message/info-message.component';
|
|
25
24
|
import { HtmlComponent } from './component/message/html/html.component';
|
|
26
25
|
import { FrameComponent } from './component/message/frame/frame.component';
|
|
27
|
-
import {
|
|
26
|
+
import { AudioComponent } from './component/message/audio/audio.component';
|
|
28
27
|
import { UserTypingComponent } from './../chat21-core/utils/user-typing/user-typing.component';
|
|
29
28
|
/** MESSAGE ATTACHMENTS COMPONENTS */
|
|
30
29
|
import { MessageAttachmentComponent } from './component/message-attachment/message-attachment.component';
|
|
@@ -139,7 +138,6 @@ import { ConfirmCloseComponent } from './modals/confirm-close/confirm-close.comp
|
|
|
139
138
|
|
|
140
139
|
|
|
141
140
|
|
|
142
|
-
|
|
143
141
|
const appInitializerFn = (appConfig: AppConfigService, brandService: BrandService, logger: NGXLogger) => {
|
|
144
142
|
return async() => {
|
|
145
143
|
let customLogger = new CustomLogger(logger)
|
|
@@ -278,7 +276,6 @@ export function uploadFactory(http: HttpClient, appConfig: AppConfigService, app
|
|
|
278
276
|
ConversationFooterComponent,
|
|
279
277
|
ConversationPreviewComponent,
|
|
280
278
|
ConversationInternalFrameComponent,
|
|
281
|
-
ConversationAudioRecorderComponent,
|
|
282
279
|
BubbleMessageComponent,
|
|
283
280
|
AvatarComponent,
|
|
284
281
|
FrameComponent,
|
|
@@ -290,7 +287,6 @@ export function uploadFactory(http: HttpClient, appConfig: AppConfigService, app
|
|
|
290
287
|
ActionButtonComponent,
|
|
291
288
|
LinkButtonComponent,
|
|
292
289
|
TextButtonComponent,
|
|
293
|
-
AudioTrackComponent,
|
|
294
290
|
UserTypingComponent,
|
|
295
291
|
/**DIRECTIVES */
|
|
296
292
|
HtmlEntitiesEncodePipe,
|
|
@@ -299,6 +295,7 @@ export function uploadFactory(http: HttpClient, appConfig: AppConfigService, app
|
|
|
299
295
|
SafeHtmlPipe,
|
|
300
296
|
LikeUnlikeComponent,
|
|
301
297
|
TooltipDirective,
|
|
298
|
+
AudioComponent,
|
|
302
299
|
CarouselComponent,
|
|
303
300
|
NetworkOfflineComponent,
|
|
304
301
|
ConfirmCloseComponent
|
package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.html
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<!-- TEXTAREA + ICONS: conv active-->
|
|
8
8
|
<div class="textarea-container" *ngIf="!hideTextAreaContent && !hideTextReply">
|
|
9
9
|
|
|
10
|
-
<div
|
|
10
|
+
<div class="icons-container">
|
|
11
11
|
<!-- ICON ATTACHMENT -->
|
|
12
12
|
<label *ngIf="showAttachmentButton == true" tabindex="1502" aria-label="allegati" for="chat21-file" class="chat21-textarea-button" [class.active]="!isFilePendingToUpload && !hideTextReply" id="chat21-start-upload-doc">
|
|
13
13
|
<span class="v-align-center">
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
|
|
47
|
-
<div
|
|
47
|
+
<div class="visible-text-area" [class.disabled] = "( isConversationArchived || hideTextReply)? true : null">
|
|
48
48
|
<!-- isFilePendingToUpload || -->
|
|
49
49
|
<textarea
|
|
50
50
|
[attr.disabled] = "(hideTextReply)? true : null"
|
|
@@ -67,24 +67,13 @@
|
|
|
67
67
|
</div>
|
|
68
68
|
|
|
69
69
|
<!-- ICON SEND -->
|
|
70
|
-
<div
|
|
70
|
+
<div tabindex="-1" class="chat21-textarea-button" [class.active]="textInputTextArea && !hideTextReply" id="chat21-button-send" (click)="onSendPressed($event)">
|
|
71
71
|
<span class="v-align-center">
|
|
72
72
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="24" width="24" viewBox="0 0 24 24" style="enable-background:new 0 0 24 24;" xml:space="preserve">
|
|
73
73
|
<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"/>
|
|
74
74
|
</svg>
|
|
75
75
|
</span>
|
|
76
76
|
</div>
|
|
77
|
-
|
|
78
|
-
<!-- ICON REC -->
|
|
79
|
-
<div *ngIf="!textInputTextArea" tabindex="-1" class="chat21-audio-button" [class.active]="isStopRec" id="chat21-button-rec">
|
|
80
|
-
<chat-audio-recorder
|
|
81
|
-
(startRecordingEvent)="onStartRecording()"
|
|
82
|
-
(deleteRecordingEvent)="onDeleteRecording()"
|
|
83
|
-
(endRecordingEvent)="onEndRecording($event)"
|
|
84
|
-
(sendRecordingEvent)="onSendRecording($event)"
|
|
85
|
-
[stylesMap]="stylesMap">
|
|
86
|
-
</chat-audio-recorder>
|
|
87
|
-
</div>
|
|
88
77
|
</div>
|
|
89
78
|
|
|
90
79
|
|
package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.scss
CHANGED
|
@@ -7,16 +7,14 @@
|
|
|
7
7
|
display: flex;
|
|
8
8
|
width: 100%;
|
|
9
9
|
align-items: center;
|
|
10
|
-
gap:
|
|
10
|
+
gap: 10px;
|
|
11
11
|
justify-content: space-between;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
.icons-container{
|
|
15
15
|
display: flex;
|
|
16
16
|
align-self: flex-end;
|
|
17
|
-
margin-left: 8px
|
|
18
|
-
gap: 2px;
|
|
19
|
-
margin-right: 8px;
|
|
17
|
+
margin-left: 8px
|
|
20
18
|
}
|
|
21
19
|
|
|
22
20
|
.visible-text-area {
|
|
@@ -33,6 +31,7 @@
|
|
|
33
31
|
.chat21-textarea-button {
|
|
34
32
|
fill: var(--icon-fill-color);
|
|
35
33
|
pointer-events: auto;
|
|
34
|
+
|
|
36
35
|
height: var(--chat-footer-height);
|
|
37
36
|
bottom: 22px;
|
|
38
37
|
opacity: 0.3;
|
|
@@ -186,29 +185,11 @@ textarea:active{
|
|
|
186
185
|
}
|
|
187
186
|
|
|
188
187
|
#chat21-button-send {
|
|
188
|
+
// right: 8px;
|
|
189
|
+
// bottom: 0;
|
|
189
190
|
display: flex;
|
|
190
191
|
align-self: flex-end;
|
|
191
|
-
margin: 0 8px
|
|
192
|
-
width: 34px;
|
|
193
|
-
text-align: center;
|
|
194
|
-
justify-content: center;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
#chat21-button-rec {
|
|
198
|
-
display: flex;
|
|
199
|
-
width: 34px;
|
|
200
|
-
text-align: center;
|
|
201
|
-
justify-content: center;
|
|
202
|
-
height: var(--chat-footer-height);
|
|
203
|
-
&.active{
|
|
204
|
-
width: 100%;
|
|
205
|
-
}
|
|
206
|
-
chat-audio-recorder {
|
|
207
|
-
width: 100%;
|
|
208
|
-
display: flex;
|
|
209
|
-
align-items: center;
|
|
210
|
-
justify-content: center;
|
|
211
|
-
}
|
|
192
|
+
margin: 0 8px
|
|
212
193
|
}
|
|
213
194
|
|
|
214
195
|
#chat21-file{
|
|
@@ -356,4 +337,7 @@ textarea:active{
|
|
|
356
337
|
// left: 10px;
|
|
357
338
|
border: none;
|
|
358
339
|
margin: -2px -2px 0px;
|
|
359
|
-
|
|
340
|
+
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
|
package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.ts
CHANGED
|
@@ -60,8 +60,6 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
60
60
|
// ========= end:: send image ========= //
|
|
61
61
|
|
|
62
62
|
// isNewConversation = true;
|
|
63
|
-
isStartRec: boolean = false;
|
|
64
|
-
isStopRec: boolean = false;
|
|
65
63
|
textInputTextArea: string;
|
|
66
64
|
conversationHandlerService: ConversationHandlerService
|
|
67
65
|
|
|
@@ -101,7 +99,7 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
101
99
|
}
|
|
102
100
|
|
|
103
101
|
ngAfterViewInit() {
|
|
104
|
-
this.logger.
|
|
102
|
+
this.logger.debug('[CONV-FOOTER] --------ngAfterViewInit: conversation-footer-------- ');
|
|
105
103
|
// setTimeout(() => {
|
|
106
104
|
this.showEmojiPicker = true
|
|
107
105
|
// }, 500);
|
|
@@ -111,18 +109,19 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
111
109
|
// START LOAD IMAGE //
|
|
112
110
|
/** load the selected image locally and open the pop up preview */
|
|
113
111
|
detectFiles(event) {
|
|
114
|
-
this.logger.
|
|
112
|
+
this.logger.debug('[CONV-FOOTER] detectFiles: ', event);
|
|
113
|
+
|
|
115
114
|
if (event) {
|
|
116
115
|
this.selectedFiles = event.target.files;
|
|
117
|
-
this.logger.
|
|
116
|
+
this.logger.debug('[CONV-FOOTER] AppComponent:detectFiles::selectedFiles', this.selectedFiles);
|
|
118
117
|
// this.onAttachmentButtonClicked.emit(this.selectedFiles)
|
|
119
118
|
if (this.selectedFiles == null) {
|
|
120
119
|
this.isFilePendingToUpload = false;
|
|
121
120
|
} else {
|
|
122
121
|
this.isFilePendingToUpload = true;
|
|
123
122
|
}
|
|
124
|
-
this.logger.
|
|
125
|
-
this.logger.
|
|
123
|
+
this.logger.debug('[CONV-FOOTER] AppComponent:detectFiles::selectedFiles::isFilePendingToUpload', this.isFilePendingToUpload);
|
|
124
|
+
this.logger.debug('[CONV-FOOTER] fileChange: ', event.target.files);
|
|
126
125
|
if (event.target.files.length <= 0) {
|
|
127
126
|
this.isFilePendingToUpload = false;
|
|
128
127
|
} else {
|
|
@@ -185,18 +184,16 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
185
184
|
}
|
|
186
185
|
}
|
|
187
186
|
|
|
188
|
-
|
|
189
|
-
|
|
190
187
|
|
|
191
188
|
loadFile() {
|
|
192
|
-
this.logger.
|
|
189
|
+
this.logger.debug('[CONV-FOOTER] that.fileXLoad: ', this.arrayFilesLoad);
|
|
193
190
|
// at the moment I only manage the upload of one image at a time
|
|
194
191
|
if (this.arrayFilesLoad[0] && this.arrayFilesLoad[0].file) {
|
|
195
192
|
const fileXLoad = this.arrayFilesLoad[0].file;
|
|
196
193
|
const uid = this.arrayFilesLoad[0].uid;
|
|
197
194
|
const type = this.arrayFilesLoad[0].type;
|
|
198
195
|
const size = this.arrayFilesLoad[0].size
|
|
199
|
-
this.logger.
|
|
196
|
+
this.logger.debug('[CONV-FOOTER] that.fileXLoad: ', type);
|
|
200
197
|
let metadata;
|
|
201
198
|
if (type.startsWith('image') && !type.includes('svg')) {
|
|
202
199
|
metadata = {
|
|
@@ -217,7 +214,7 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
217
214
|
'size': size
|
|
218
215
|
};
|
|
219
216
|
}
|
|
220
|
-
this.logger.
|
|
217
|
+
this.logger.debug('[CONV-FOOTER] metadata -------> ', metadata);
|
|
221
218
|
// this.scrollToBottom();
|
|
222
219
|
// 1 - aggiungo messaggio localmente
|
|
223
220
|
// this.addLocalMessageImage(metadata);
|
|
@@ -234,20 +231,17 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
234
231
|
|
|
235
232
|
uploadSingle(metadata, file, messageText?: string) {
|
|
236
233
|
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);
|
|
234
|
+
const send_order_btn = <HTMLInputElement>document.getElementById('chat21-start-upload-doc');
|
|
235
|
+
send_order_btn.disabled = true;
|
|
236
|
+
that.logger.debug('[CONV-FOOTER] AppComponent::uploadSingle::', metadata, file);
|
|
244
237
|
// const file = this.selectedFiles.item(0);
|
|
245
238
|
const currentUpload = new UploadModel(file);
|
|
239
|
+
|
|
246
240
|
// const uploadTask = this.upSvc.pushUpload(currentUpload);
|
|
247
241
|
// uploadTask.then(snapshot => {
|
|
248
242
|
// return snapshot.ref.getDownloadURL(); // Will return a promise with the download link
|
|
249
243
|
// }).then(downloadURL => {
|
|
250
|
-
// that.logger.
|
|
244
|
+
// that.logger.debug('[CONV-FOOTER] AppComponent::uploadSingle:: downloadURL', downloadURL]);
|
|
251
245
|
// that.g.wdLog([`Successfully uploaded file and got download link - ${downloadURL}`]);
|
|
252
246
|
|
|
253
247
|
// metadata.src = downloadURL;
|
|
@@ -267,8 +261,8 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
267
261
|
// this.resetLoadImage();
|
|
268
262
|
|
|
269
263
|
this.uploadService.upload(this.senderId, currentUpload).then(data => {
|
|
270
|
-
that.logger.
|
|
271
|
-
that.logger.
|
|
264
|
+
that.logger.debug('[CONV-FOOTER] AppComponent::uploadSingle:: downloadURL', data);
|
|
265
|
+
that.logger.debug(`[CONV-FOOTER] Successfully uploaded file and got download link - ${data}`);
|
|
272
266
|
|
|
273
267
|
metadata.src = data.src;
|
|
274
268
|
metadata.downloadURL = data.downloadURL;
|
|
@@ -297,7 +291,7 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
297
291
|
that.logger.error(`[CONV-FOOTER] uploadSingle:: Failed to upload file and get link - ${error}`);
|
|
298
292
|
that.isFilePendingToUpload = false;
|
|
299
293
|
});
|
|
300
|
-
that.logger.
|
|
294
|
+
that.logger.debug('[CONV-FOOTER] reader-result: ', file);
|
|
301
295
|
}
|
|
302
296
|
|
|
303
297
|
/**
|
|
@@ -310,7 +304,7 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
310
304
|
sendMessage(msg: string, type: string, metadata?: any, additional_attributes?: any) { // sponziello
|
|
311
305
|
(metadata) ? metadata = metadata : metadata = '';
|
|
312
306
|
this.onEmojiiPickerShow.emit(false)
|
|
313
|
-
this.logger.
|
|
307
|
+
this.logger.debug('[CONV-FOOTER] SEND MESSAGE: ', msg, type, metadata, additional_attributes);
|
|
314
308
|
if (msg && msg.trim() !== '' || type === TYPE_MSG_IMAGE || type === TYPE_MSG_FILE ) {
|
|
315
309
|
|
|
316
310
|
// msg = htmlEntities(msg);
|
|
@@ -393,7 +387,7 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
393
387
|
}
|
|
394
388
|
|
|
395
389
|
private restoreTextArea() {
|
|
396
|
-
// that.logger.
|
|
390
|
+
// that.logger.debug('[CONV-FOOTER] AppComponent:restoreTextArea::restoreTextArea');
|
|
397
391
|
this.resizeInputField();
|
|
398
392
|
const textArea = (<HTMLInputElement>document.getElementById('chat21-main-message-context'));
|
|
399
393
|
this.textInputTextArea = ''; // clear the textarea
|
|
@@ -403,7 +397,7 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
403
397
|
if(textArea.style.height > this.HEIGHT_DEFAULT){
|
|
404
398
|
document.getElementById('chat21-button-send').style.removeProperty('right')
|
|
405
399
|
}
|
|
406
|
-
this.logger.
|
|
400
|
+
this.logger.debug('[CONV-FOOTER] AppComponent:restoreTextArea::restoreTextArea::textArea:', 'restored');
|
|
407
401
|
}
|
|
408
402
|
this.setFocusOnId('chat21-main-message-context');
|
|
409
403
|
}
|
|
@@ -417,7 +411,7 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
417
411
|
try {
|
|
418
412
|
const target = document.getElementById('chat21-main-message-context') as HTMLInputElement;
|
|
419
413
|
// tslint:disable-next-line:max-line-length
|
|
420
|
-
// that.logger.
|
|
414
|
+
// 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
415
|
target? target.style.height = '100%': null;
|
|
422
416
|
if (target && target.value === '\n') {
|
|
423
417
|
target.value = '';
|
|
@@ -437,104 +431,28 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
437
431
|
}
|
|
438
432
|
}
|
|
439
433
|
|
|
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
434
|
onTextAreaChange(){
|
|
517
435
|
this.resizeInputField()
|
|
518
436
|
this.setWritingMessages(this.textInputTextArea)
|
|
519
437
|
}
|
|
520
438
|
|
|
521
439
|
onSendPressed(event) {
|
|
522
|
-
this.logger.
|
|
440
|
+
this.logger.debug('[CONV-FOOTER] onSendPressed:event', event);
|
|
523
441
|
event.preventDefault();
|
|
524
|
-
this.logger.
|
|
442
|
+
this.logger.debug('[CONV-FOOTER] AppComponent::onSendPressed::isFilePendingToUpload:', this.isFilePendingToUpload);
|
|
525
443
|
if (this.isFilePendingToUpload) {
|
|
526
|
-
this.logger.
|
|
444
|
+
this.logger.debug('[CONV-FOOTER] AppComponent::onSendPressed', 'is a file');
|
|
527
445
|
// its a file
|
|
528
446
|
this.loadFile();
|
|
529
447
|
this.isFilePendingToUpload = false;
|
|
530
448
|
// disabilito pulsanti
|
|
531
|
-
this.logger.
|
|
449
|
+
this.logger.debug('[CONV-FOOTER] AppComponent::onSendPressed::isFilePendingToUpload:', this.isFilePendingToUpload);
|
|
532
450
|
} else {
|
|
533
451
|
if ( this.textInputTextArea && this.textInputTextArea.length > 0 ) {
|
|
534
|
-
this.logger.
|
|
452
|
+
this.logger.debug('[CONV-FOOTER] AppComponent::onSendPressed', 'is a message');
|
|
535
453
|
// its a message
|
|
536
454
|
if (this.textInputTextArea.trim() !== '') {
|
|
537
|
-
// that.logger.
|
|
455
|
+
// that.logger.debug('[CONV-FOOTER] sendMessage -> ', this.textInputTextArea);
|
|
538
456
|
// this.resizeInputField();
|
|
539
457
|
// this.messagingService.sendMessage(msg, TYPE_MSG_TEXT);
|
|
540
458
|
// this.setDepartment();
|
|
@@ -608,7 +526,7 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
608
526
|
setTimeout(function () {
|
|
609
527
|
const textarea = document.getElementById(id);
|
|
610
528
|
if (textarea) {
|
|
611
|
-
// that.logger.
|
|
529
|
+
// that.logger.debug('[CONV-FOOTER] 1--------> FOCUSSSSSS : ', textarea);
|
|
612
530
|
textarea.setAttribute('value', ' ');
|
|
613
531
|
textarea.focus();
|
|
614
532
|
}
|
|
@@ -648,7 +566,7 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
648
566
|
this.textInputTextArea = ((document.getElementById('chat21-main-message-context') as HTMLInputElement).value);
|
|
649
567
|
if (keyCode === 13) { // ENTER pressed
|
|
650
568
|
if (this.textInputTextArea && this.textInputTextArea.trim() !== '') {
|
|
651
|
-
// that.logger.
|
|
569
|
+
// that.logger.debug('[CONV-FOOTER] sendMessage -> ', this.textInputTextArea);
|
|
652
570
|
// this.resizeInputField();
|
|
653
571
|
// this.messagingService.sendMessage(msg, TYPE_MSG_TEXT);
|
|
654
572
|
// this.setDepartment();
|
|
@@ -680,14 +598,14 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
680
598
|
this.resizeInputField()
|
|
681
599
|
const items = (event.clipboardData || event.originalEvent.clipboardData).items;
|
|
682
600
|
let file = null;
|
|
683
|
-
this.logger.
|
|
601
|
+
this.logger.debug('[CONV-FOOTER] onPaste items ', items);
|
|
684
602
|
for (const item of items) {
|
|
685
|
-
this.logger.
|
|
686
|
-
this.logger.
|
|
603
|
+
this.logger.debug('[CONV-FOOTER] onPaste item ', item);
|
|
604
|
+
this.logger.debug('[CONV-FOOTER] onPaste item.type ', item.type);
|
|
687
605
|
if (item.type.startsWith("image")) {
|
|
688
606
|
// SEND TEXT MESSAGE IF EXIST
|
|
689
607
|
// if(this.textInputTextArea){
|
|
690
|
-
// this.logger.
|
|
608
|
+
// this.logger.debug('[CONV-FOOTER] onPaste texttt ', this.textInputTextArea);
|
|
691
609
|
// this.sendMessage(this.textInputTextArea, TYPE_MSG_TEXT)
|
|
692
610
|
// }
|
|
693
611
|
|
|
@@ -697,12 +615,12 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
697
615
|
this.logger.error('[CONV-FOOTER] onPaste - error while restoring textArea:',e)
|
|
698
616
|
}
|
|
699
617
|
|
|
700
|
-
this.logger.
|
|
618
|
+
this.logger.debug('[CONV-FOOTER] onPaste item.type', item.type);
|
|
701
619
|
file = item.getAsFile();
|
|
702
620
|
const data = {target: new ClipboardEvent('').clipboardData || new DataTransfer()};
|
|
703
621
|
data.target.items.add(new File([file], file.name, { type: file.type }));
|
|
704
|
-
this.logger.
|
|
705
|
-
this.logger.
|
|
622
|
+
this.logger.debug('[CONV-FOOTER] onPaste data', data);
|
|
623
|
+
this.logger.debug('[CONV-FOOTER] onPaste file ', file);
|
|
706
624
|
this.detectFiles(data)
|
|
707
625
|
}
|
|
708
626
|
}
|
|
@@ -711,15 +629,15 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
711
629
|
onDrop(event){
|
|
712
630
|
const items = event.dataTransfer.files;
|
|
713
631
|
let file = null;
|
|
714
|
-
this.logger.
|
|
632
|
+
this.logger.debug('[CONV-FOOTER] onDrop items ', items);
|
|
715
633
|
for (const item of items) {
|
|
716
|
-
this.logger.
|
|
717
|
-
this.logger.
|
|
634
|
+
this.logger.debug('[CONV-FOOTER] onDrop item ', item);
|
|
635
|
+
this.logger.debug('[CONV-FOOTER] onDrop item.type ', item.type);
|
|
718
636
|
|
|
719
637
|
const data = {target: {files: new DataTransfer()}}
|
|
720
638
|
data.target.files = items
|
|
721
|
-
this.logger.
|
|
722
|
-
this.logger.
|
|
639
|
+
this.logger.debug('[CONV-FOOTER] onDrop data', data);
|
|
640
|
+
this.logger.debug('[CONV-FOOTER] onDrop file ', file);
|
|
723
641
|
this.detectFiles(data)
|
|
724
642
|
}
|
|
725
643
|
}
|
|
@@ -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
|
+
|