@chat21/chat21-web-widget 5.0.84-rc.2 → 5.0.85
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 -5
- package/package.json +1 -1
- 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 +49 -131
- 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/utils/globals.ts +5 -5
- package/src/assets/i18n/en.json +1 -1
- package/src/assets/i18n/es.json +1 -1
- package/src/assets/i18n/fr.json +6 -6
- package/src/assets/i18n/it.json +1 -1
- package/src/assets/twp/blank.html +6 -3
- package/src/assets/twp/chatbot-panel.html +13 -5
- package/src/assets/twp/index-dev.html +16 -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/iframe-style.css +1 -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
package/package.json
CHANGED
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
|
@@ -59,8 +59,6 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
59
59
|
// ========= end:: send image ========= //
|
|
60
60
|
|
|
61
61
|
// isNewConversation = true;
|
|
62
|
-
isStartRec: boolean = false;
|
|
63
|
-
isStopRec: boolean = false;
|
|
64
62
|
textInputTextArea: string;
|
|
65
63
|
conversationHandlerService: ConversationHandlerService
|
|
66
64
|
|
|
@@ -100,7 +98,7 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
100
98
|
}
|
|
101
99
|
|
|
102
100
|
ngAfterViewInit() {
|
|
103
|
-
this.logger.
|
|
101
|
+
this.logger.debug('[CONV-FOOTER] --------ngAfterViewInit: conversation-footer-------- ');
|
|
104
102
|
// setTimeout(() => {
|
|
105
103
|
this.showEmojiPicker = true
|
|
106
104
|
// }, 500);
|
|
@@ -110,18 +108,19 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
110
108
|
// START LOAD IMAGE //
|
|
111
109
|
/** load the selected image locally and open the pop up preview */
|
|
112
110
|
detectFiles(event) {
|
|
113
|
-
this.logger.
|
|
111
|
+
this.logger.debug('[CONV-FOOTER] detectFiles: ', event);
|
|
112
|
+
|
|
114
113
|
if (event) {
|
|
115
114
|
this.selectedFiles = event.target.files;
|
|
116
|
-
this.logger.
|
|
115
|
+
this.logger.debug('[CONV-FOOTER] AppComponent:detectFiles::selectedFiles', this.selectedFiles);
|
|
117
116
|
// this.onAttachmentButtonClicked.emit(this.selectedFiles)
|
|
118
117
|
if (this.selectedFiles == null) {
|
|
119
118
|
this.isFilePendingToUpload = false;
|
|
120
119
|
} else {
|
|
121
120
|
this.isFilePendingToUpload = true;
|
|
122
121
|
}
|
|
123
|
-
this.logger.
|
|
124
|
-
this.logger.
|
|
122
|
+
this.logger.debug('[CONV-FOOTER] AppComponent:detectFiles::selectedFiles::isFilePendingToUpload', this.isFilePendingToUpload);
|
|
123
|
+
this.logger.debug('[CONV-FOOTER] fileChange: ', event.target.files);
|
|
125
124
|
if (event.target.files.length <= 0) {
|
|
126
125
|
this.isFilePendingToUpload = false;
|
|
127
126
|
} else {
|
|
@@ -134,27 +133,27 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
134
133
|
const typeFile = event.target.files[0].type;
|
|
135
134
|
const size = event.target.files[0].size
|
|
136
135
|
const reader = new FileReader();
|
|
137
|
-
that.logger.
|
|
136
|
+
that.logger.debug('[CONV-FOOTER] OK preload: ', nameFile, typeFile, reader);
|
|
138
137
|
reader.addEventListener('load', function () {
|
|
139
|
-
that.logger.
|
|
138
|
+
that.logger.debug('[CONV-FOOTER] addEventListener load', reader.result);
|
|
140
139
|
that.isFileSelected = true;
|
|
141
140
|
// se inizia con image
|
|
142
141
|
if (typeFile.startsWith('image') && !typeFile.includes('svg')) {
|
|
143
142
|
const imageXLoad = new Image;
|
|
144
|
-
that.logger.
|
|
143
|
+
that.logger.debug('[CONV-FOOTER] onload ', imageXLoad);
|
|
145
144
|
imageXLoad.src = reader.result.toString();
|
|
146
145
|
imageXLoad.title = nameFile;
|
|
147
146
|
imageXLoad.onload = function () {
|
|
148
|
-
that.logger.
|
|
147
|
+
that.logger.debug('[CONV-FOOTER] onload image');
|
|
149
148
|
// that.arrayFilesLoad.push(imageXLoad);
|
|
150
149
|
const uid = (new Date().getTime()).toString(36); // imageXLoad.src.substring(imageXLoad.src.length - 16);
|
|
151
150
|
that.arrayFilesLoad[0] = { uid: uid, file: imageXLoad, type: typeFile, size: size };
|
|
152
|
-
that.logger.
|
|
151
|
+
that.logger.debug('[CONV-FOOTER] OK: ', that.arrayFilesLoad[0]);
|
|
153
152
|
// SEND MESSAGE
|
|
154
153
|
that.loadFile();
|
|
155
154
|
};
|
|
156
155
|
} else {
|
|
157
|
-
that.logger.
|
|
156
|
+
that.logger.debug('[CONV-FOOTER] onload file');
|
|
158
157
|
const fileXLoad = {
|
|
159
158
|
src: reader.result.toString(),
|
|
160
159
|
title: nameFile
|
|
@@ -162,7 +161,7 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
162
161
|
// that.arrayFilesLoad.push(imageXLoad);
|
|
163
162
|
const uid = (new Date().getTime()).toString(36); // imageXLoad.src.substring(imageXLoad.src.length - 16);
|
|
164
163
|
that.arrayFilesLoad[0] = { uid: uid, file: fileXLoad, type: typeFile, size: size };
|
|
165
|
-
that.logger.
|
|
164
|
+
that.logger.debug('[CONV-FOOTER] OK: ', that.arrayFilesLoad[0]);
|
|
166
165
|
// SEND MESSAGE
|
|
167
166
|
that.loadFile();
|
|
168
167
|
}
|
|
@@ -170,24 +169,22 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
170
169
|
|
|
171
170
|
if (event.target.files[0]) {
|
|
172
171
|
reader.readAsDataURL(event.target.files[0]);
|
|
173
|
-
that.logger.
|
|
172
|
+
that.logger.debug('[CONV-FOOTER] reader-result: ', event.target.files[0]);
|
|
174
173
|
}
|
|
175
174
|
}
|
|
176
175
|
}
|
|
177
176
|
}
|
|
178
177
|
|
|
179
|
-
|
|
180
|
-
|
|
181
178
|
|
|
182
179
|
loadFile() {
|
|
183
|
-
this.logger.
|
|
180
|
+
this.logger.debug('[CONV-FOOTER] that.fileXLoad: ', this.arrayFilesLoad);
|
|
184
181
|
// at the moment I only manage the upload of one image at a time
|
|
185
182
|
if (this.arrayFilesLoad[0] && this.arrayFilesLoad[0].file) {
|
|
186
183
|
const fileXLoad = this.arrayFilesLoad[0].file;
|
|
187
184
|
const uid = this.arrayFilesLoad[0].uid;
|
|
188
185
|
const type = this.arrayFilesLoad[0].type;
|
|
189
186
|
const size = this.arrayFilesLoad[0].size
|
|
190
|
-
this.logger.
|
|
187
|
+
this.logger.debug('[CONV-FOOTER] that.fileXLoad: ', type);
|
|
191
188
|
let metadata;
|
|
192
189
|
if (type.startsWith('image') && !type.includes('svg')) {
|
|
193
190
|
metadata = {
|
|
@@ -208,7 +205,7 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
208
205
|
'size': size
|
|
209
206
|
};
|
|
210
207
|
}
|
|
211
|
-
this.logger.
|
|
208
|
+
this.logger.debug('[CONV-FOOTER] metadata -------> ', metadata);
|
|
212
209
|
// this.scrollToBottom();
|
|
213
210
|
// 1 - aggiungo messaggio localmente
|
|
214
211
|
// this.addLocalMessageImage(metadata);
|
|
@@ -225,20 +222,17 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
225
222
|
|
|
226
223
|
uploadSingle(metadata, file, messageText?: string) {
|
|
227
224
|
const that = this;
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
} catch (error) {
|
|
232
|
-
that.logger.log('[CONV-FOOTER] error::', error);
|
|
233
|
-
}
|
|
234
|
-
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);
|
|
235
228
|
// const file = this.selectedFiles.item(0);
|
|
236
229
|
const currentUpload = new UploadModel(file);
|
|
230
|
+
|
|
237
231
|
// const uploadTask = this.upSvc.pushUpload(currentUpload);
|
|
238
232
|
// uploadTask.then(snapshot => {
|
|
239
233
|
// return snapshot.ref.getDownloadURL(); // Will return a promise with the download link
|
|
240
234
|
// }).then(downloadURL => {
|
|
241
|
-
// that.logger.
|
|
235
|
+
// that.logger.debug('[CONV-FOOTER] AppComponent::uploadSingle:: downloadURL', downloadURL]);
|
|
242
236
|
// that.g.wdLog([`Successfully uploaded file and got download link - ${downloadURL}`]);
|
|
243
237
|
|
|
244
238
|
// metadata.src = downloadURL;
|
|
@@ -258,8 +252,8 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
258
252
|
// this.resetLoadImage();
|
|
259
253
|
|
|
260
254
|
this.uploadService.upload(this.senderId, currentUpload).then(data => {
|
|
261
|
-
that.logger.
|
|
262
|
-
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}`);
|
|
263
257
|
|
|
264
258
|
metadata.src = data.src;
|
|
265
259
|
metadata.downloadURL = data.downloadURL;
|
|
@@ -288,7 +282,7 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
288
282
|
that.logger.error(`[CONV-FOOTER] uploadSingle:: Failed to upload file and get link - ${error}`);
|
|
289
283
|
that.isFilePendingToUpload = false;
|
|
290
284
|
});
|
|
291
|
-
that.logger.
|
|
285
|
+
that.logger.debug('[CONV-FOOTER] reader-result: ', file);
|
|
292
286
|
}
|
|
293
287
|
|
|
294
288
|
/**
|
|
@@ -301,7 +295,7 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
301
295
|
sendMessage(msg: string, type: string, metadata?: any, additional_attributes?: any) { // sponziello
|
|
302
296
|
(metadata) ? metadata = metadata : metadata = '';
|
|
303
297
|
this.onEmojiiPickerShow.emit(false)
|
|
304
|
-
this.logger.
|
|
298
|
+
this.logger.debug('[CONV-FOOTER] SEND MESSAGE: ', msg, type, metadata, additional_attributes);
|
|
305
299
|
if (msg && msg.trim() !== '' || type === TYPE_MSG_IMAGE || type === TYPE_MSG_FILE ) {
|
|
306
300
|
|
|
307
301
|
// msg = htmlEntities(msg);
|
|
@@ -384,7 +378,7 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
384
378
|
}
|
|
385
379
|
|
|
386
380
|
private restoreTextArea() {
|
|
387
|
-
// that.logger.
|
|
381
|
+
// that.logger.debug('[CONV-FOOTER] AppComponent:restoreTextArea::restoreTextArea');
|
|
388
382
|
this.resizeInputField();
|
|
389
383
|
const textArea = (<HTMLInputElement>document.getElementById('chat21-main-message-context'));
|
|
390
384
|
this.textInputTextArea = ''; // clear the textarea
|
|
@@ -394,7 +388,7 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
394
388
|
if(textArea.style.height > this.HEIGHT_DEFAULT){
|
|
395
389
|
document.getElementById('chat21-button-send').style.removeProperty('right')
|
|
396
390
|
}
|
|
397
|
-
this.logger.
|
|
391
|
+
this.logger.debug('[CONV-FOOTER] AppComponent:restoreTextArea::restoreTextArea::textArea:', 'restored');
|
|
398
392
|
}
|
|
399
393
|
this.setFocusOnId('chat21-main-message-context');
|
|
400
394
|
}
|
|
@@ -408,7 +402,7 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
408
402
|
try {
|
|
409
403
|
const target = document.getElementById('chat21-main-message-context') as HTMLInputElement;
|
|
410
404
|
// tslint:disable-next-line:max-line-length
|
|
411
|
-
// 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);
|
|
412
406
|
target? target.style.height = '100%': null;
|
|
413
407
|
if (target && target.value === '\n') {
|
|
414
408
|
target.value = '';
|
|
@@ -428,104 +422,28 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
428
422
|
}
|
|
429
423
|
}
|
|
430
424
|
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
onStartRecording() {
|
|
434
|
-
this.isStartRec = true;
|
|
435
|
-
this.isStopRec = false;
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
onDeleteRecording(){
|
|
439
|
-
this.isStartRec = false;
|
|
440
|
-
this.isStopRec = false;
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
onEndRecording(audioBlob: Blob | null) {
|
|
444
|
-
this.isStartRec = false;
|
|
445
|
-
this.isStopRec = true;
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
onSendRecording(audioBlob: Blob | null) {
|
|
451
|
-
this.isStartRec = false;
|
|
452
|
-
if (audioBlob) {
|
|
453
|
-
this.convertBlobToBase64(audioBlob);
|
|
454
|
-
this.isStopRec = false;
|
|
455
|
-
} else {
|
|
456
|
-
this.isStopRec = false;
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
// Funzione per convertire Blob in Base64 usando FileReader
|
|
463
|
-
async convertBlobToBase64(audioBlob: Blob) {
|
|
464
|
-
let that = this;
|
|
465
|
-
if (audioBlob) {
|
|
466
|
-
this.isFilePendingToUpload = true;
|
|
467
|
-
} else {
|
|
468
|
-
this.isFilePendingToUpload = false;
|
|
469
|
-
}
|
|
470
|
-
const type = audioBlob.type;
|
|
471
|
-
const size = audioBlob.size;
|
|
472
|
-
const reader = new FileReader();
|
|
473
|
-
reader.readAsDataURL(audioBlob);
|
|
474
|
-
//reader.addEventListener('load', function () {
|
|
475
|
-
reader.onloadend = () => {
|
|
476
|
-
that.isFileSelected = true;
|
|
477
|
-
// const base64data = reader.result as string;
|
|
478
|
-
that.logger.log('[CONV-FOOTER] onload file');
|
|
479
|
-
const fileXLoad = {
|
|
480
|
-
src: reader.result.toString(),
|
|
481
|
-
title: 'audio-file'
|
|
482
|
-
};
|
|
483
|
-
const uid = (new Date().getTime()).toString(36);
|
|
484
|
-
that.arrayFilesLoad[0] = { uid: uid, file: fileXLoad, type: type, size: size };
|
|
485
|
-
that.logger.log('[CONV-FOOTER] OK: ', that.arrayFilesLoad[0]);
|
|
486
|
-
// SEND MESSAGE
|
|
487
|
-
let metadata = {
|
|
488
|
-
'name': 'audio-file',
|
|
489
|
-
'src': fileXLoad.src,
|
|
490
|
-
'type': type,
|
|
491
|
-
'uid': uid,
|
|
492
|
-
'size': size
|
|
493
|
-
};
|
|
494
|
-
|
|
495
|
-
const file = new File([audioBlob], "audio-file.mp3", {
|
|
496
|
-
type: audioBlob.type,
|
|
497
|
-
lastModified: Date.now()
|
|
498
|
-
});
|
|
499
|
-
|
|
500
|
-
that.uploadSingle(metadata, file, '');
|
|
501
|
-
};
|
|
502
|
-
//}, false);
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
425
|
onTextAreaChange(){
|
|
508
426
|
this.resizeInputField()
|
|
509
427
|
this.setWritingMessages(this.textInputTextArea)
|
|
510
428
|
}
|
|
511
429
|
|
|
512
430
|
onSendPressed(event) {
|
|
513
|
-
this.logger.
|
|
431
|
+
this.logger.debug('[CONV-FOOTER] onSendPressed:event', event);
|
|
514
432
|
event.preventDefault();
|
|
515
|
-
this.logger.
|
|
433
|
+
this.logger.debug('[CONV-FOOTER] AppComponent::onSendPressed::isFilePendingToUpload:', this.isFilePendingToUpload);
|
|
516
434
|
if (this.isFilePendingToUpload) {
|
|
517
|
-
this.logger.
|
|
435
|
+
this.logger.debug('[CONV-FOOTER] AppComponent::onSendPressed', 'is a file');
|
|
518
436
|
// its a file
|
|
519
437
|
this.loadFile();
|
|
520
438
|
this.isFilePendingToUpload = false;
|
|
521
439
|
// disabilito pulsanti
|
|
522
|
-
this.logger.
|
|
440
|
+
this.logger.debug('[CONV-FOOTER] AppComponent::onSendPressed::isFilePendingToUpload:', this.isFilePendingToUpload);
|
|
523
441
|
} else {
|
|
524
442
|
if ( this.textInputTextArea && this.textInputTextArea.length > 0 ) {
|
|
525
|
-
this.logger.
|
|
443
|
+
this.logger.debug('[CONV-FOOTER] AppComponent::onSendPressed', 'is a message');
|
|
526
444
|
// its a message
|
|
527
445
|
if (this.textInputTextArea.trim() !== '') {
|
|
528
|
-
// that.logger.
|
|
446
|
+
// that.logger.debug('[CONV-FOOTER] sendMessage -> ', this.textInputTextArea);
|
|
529
447
|
// this.resizeInputField();
|
|
530
448
|
// this.messagingService.sendMessage(msg, TYPE_MSG_TEXT);
|
|
531
449
|
// this.setDepartment();
|
|
@@ -599,7 +517,7 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
599
517
|
setTimeout(function () {
|
|
600
518
|
const textarea = document.getElementById(id);
|
|
601
519
|
if (textarea) {
|
|
602
|
-
// that.logger.
|
|
520
|
+
// that.logger.debug('[CONV-FOOTER] 1--------> FOCUSSSSSS : ', textarea);
|
|
603
521
|
textarea.setAttribute('value', ' ');
|
|
604
522
|
textarea.focus();
|
|
605
523
|
}
|
|
@@ -639,7 +557,7 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
639
557
|
this.textInputTextArea = ((document.getElementById('chat21-main-message-context') as HTMLInputElement).value);
|
|
640
558
|
if (keyCode === 13) { // ENTER pressed
|
|
641
559
|
if (this.textInputTextArea && this.textInputTextArea.trim() !== '') {
|
|
642
|
-
// that.logger.
|
|
560
|
+
// that.logger.debug('[CONV-FOOTER] sendMessage -> ', this.textInputTextArea);
|
|
643
561
|
// this.resizeInputField();
|
|
644
562
|
// this.messagingService.sendMessage(msg, TYPE_MSG_TEXT);
|
|
645
563
|
// this.setDepartment();
|
|
@@ -671,14 +589,14 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
671
589
|
this.resizeInputField()
|
|
672
590
|
const items = (event.clipboardData || event.originalEvent.clipboardData).items;
|
|
673
591
|
let file = null;
|
|
674
|
-
this.logger.
|
|
592
|
+
this.logger.debug('[CONV-FOOTER] onPaste items ', items);
|
|
675
593
|
for (const item of items) {
|
|
676
|
-
this.logger.
|
|
677
|
-
this.logger.
|
|
594
|
+
this.logger.debug('[CONV-FOOTER] onPaste item ', item);
|
|
595
|
+
this.logger.debug('[CONV-FOOTER] onPaste item.type ', item.type);
|
|
678
596
|
if (item.type.startsWith("image")) {
|
|
679
597
|
// SEND TEXT MESSAGE IF EXIST
|
|
680
598
|
// if(this.textInputTextArea){
|
|
681
|
-
// this.logger.
|
|
599
|
+
// this.logger.debug('[CONV-FOOTER] onPaste texttt ', this.textInputTextArea);
|
|
682
600
|
// this.sendMessage(this.textInputTextArea, TYPE_MSG_TEXT)
|
|
683
601
|
// }
|
|
684
602
|
|
|
@@ -688,12 +606,12 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
688
606
|
this.logger.error('[CONV-FOOTER] onPaste - error while restoring textArea:',e)
|
|
689
607
|
}
|
|
690
608
|
|
|
691
|
-
this.logger.
|
|
609
|
+
this.logger.debug('[CONV-FOOTER] onPaste item.type', item.type);
|
|
692
610
|
file = item.getAsFile();
|
|
693
611
|
const data = {target: new ClipboardEvent('').clipboardData || new DataTransfer()};
|
|
694
612
|
data.target.items.add(new File([file], file.name, { type: file.type }));
|
|
695
|
-
this.logger.
|
|
696
|
-
this.logger.
|
|
613
|
+
this.logger.debug('[CONV-FOOTER] onPaste data', data);
|
|
614
|
+
this.logger.debug('[CONV-FOOTER] onPaste file ', file);
|
|
697
615
|
this.detectFiles(data)
|
|
698
616
|
}
|
|
699
617
|
}
|
|
@@ -702,15 +620,15 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
702
620
|
onDrop(event){
|
|
703
621
|
const items = event.dataTransfer.files;
|
|
704
622
|
let file = null;
|
|
705
|
-
this.logger.
|
|
623
|
+
this.logger.debug('[CONV-FOOTER] onDrop items ', items);
|
|
706
624
|
for (const item of items) {
|
|
707
|
-
this.logger.
|
|
708
|
-
this.logger.
|
|
625
|
+
this.logger.debug('[CONV-FOOTER] onDrop item ', item);
|
|
626
|
+
this.logger.debug('[CONV-FOOTER] onDrop item.type ', item.type);
|
|
709
627
|
|
|
710
628
|
const data = {target: {files: new DataTransfer()}}
|
|
711
629
|
data.target.files = items
|
|
712
|
-
this.logger.
|
|
713
|
-
this.logger.
|
|
630
|
+
this.logger.debug('[CONV-FOOTER] onDrop data', data);
|
|
631
|
+
this.logger.debug('[CONV-FOOTER] onDrop file ', file);
|
|
714
632
|
this.detectFiles(data)
|
|
715
633
|
}
|
|
716
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
|
+
|