@chat21/chat21-web-widget 5.0.91-rc2 → 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 +6 -0
- package/package.json +1 -1
- package/src/app/app.module.ts +2 -2
- package/src/app/component/conversation-detail/conversation/conversation.component.html +1 -1
- 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.html +2 -2
- package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.ts +16 -8
- 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/providers/global-settings.service.ts +6 -6
- package/src/app/utils/globals.ts +2 -2
- package/src/assets/twp/index-dev.html +8 -8
- /package/src/app/component/message/{audio-track/audio-track.component.html → audio/audio.component.html} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,12 @@
|
|
|
6
6
|
### **Copyrigth**:
|
|
7
7
|
*Tiledesk SRL*
|
|
8
8
|
|
|
9
|
+
# 5.0.91-rc4
|
|
10
|
+
- **changed**: audio-track to audio component renamed
|
|
11
|
+
|
|
12
|
+
# 5.0.91-rc3
|
|
13
|
+
- **added**: showAudioRecorderFooterButton property variable
|
|
14
|
+
|
|
9
15
|
# 5.0.91-rc2
|
|
10
16
|
- **changed**: colors for chat-audio-track component managed
|
|
11
17
|
|
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,
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
[userEmail]="g?.userEmail"
|
|
120
120
|
[showAttachmentFooterButton]="g?.showAttachmentFooterButton"
|
|
121
121
|
[showEmojiFooterButton]="g?.showEmojiFooterButton"
|
|
122
|
-
[
|
|
122
|
+
[showAudioRecorderFooterButton]="g?.showAudioRecorderFooterButton"
|
|
123
123
|
[hideTextAreaContent]="(g?.singleConversation && hideTextAreaContent) || (isConversationArchived && !g?.allowReopen)"
|
|
124
124
|
[isConversationArchived]="isConversationArchived"
|
|
125
125
|
[hideTextReply]="hideFooterTextReply"
|
|
@@ -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.html
CHANGED
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
</div>
|
|
68
68
|
|
|
69
69
|
<!-- ICON SEND -->
|
|
70
|
-
<div *ngIf="(textInputTextArea !== '' && !isStopRec) || !
|
|
70
|
+
<div *ngIf="(textInputTextArea !== '' && !isStopRec) || !showAudioRecorderFooterButton" 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"/>
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
</div>
|
|
77
77
|
|
|
78
78
|
<!-- ICON REC -->
|
|
79
|
-
<div *ngIf="
|
|
79
|
+
<div *ngIf="showAudioRecorderFooterButton && !textInputTextArea" tabindex="-1" class="chat21-audio-button" [class.active]="isStopRec" id="chat21-button-rec">
|
|
80
80
|
<chat-audio-recorder
|
|
81
81
|
(startRecordingEvent)="onStartRecording()"
|
|
82
82
|
(deleteRecordingEvent)="onDeleteRecording()"
|
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',
|
|
@@ -29,7 +30,7 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
29
30
|
@Input() userEmail: string;
|
|
30
31
|
@Input() showAttachmentFooterButton: boolean;
|
|
31
32
|
@Input() showEmojiFooterButton: boolean
|
|
32
|
-
@Input()
|
|
33
|
+
@Input() showAudioRecorderFooterButton: boolean
|
|
33
34
|
// @Input() showContinueConversationButton: boolean;
|
|
34
35
|
@Input() isConversationArchived: boolean;
|
|
35
36
|
@Input() hideTextAreaContent: boolean;
|
|
@@ -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')"
|
|
@@ -512,8 +512,8 @@ export class GlobalSettingsService {
|
|
|
512
512
|
if (variables.hasOwnProperty('showAttachmentFooterButton')) {
|
|
513
513
|
globals['showAttachmentFooterButton'] = variables['showAttachmentFooterButton'];
|
|
514
514
|
}
|
|
515
|
-
if (variables.hasOwnProperty('
|
|
516
|
-
globals['
|
|
515
|
+
if (variables.hasOwnProperty('showAudioRecorderFooterButton')) {
|
|
516
|
+
globals['showAudioRecorderFooterButton'] = variables['showAudioRecorderFooterButton'];
|
|
517
517
|
}
|
|
518
518
|
|
|
519
519
|
}
|
|
@@ -1056,10 +1056,10 @@ export class GlobalSettingsService {
|
|
|
1056
1056
|
if (TEMP !== undefined) {
|
|
1057
1057
|
globals.showEmojiFooterButton = (TEMP === true) ? true : false;
|
|
1058
1058
|
}
|
|
1059
|
-
TEMP = tiledeskSettings['
|
|
1059
|
+
TEMP = tiledeskSettings['showAudioRecorderFooterButton'];
|
|
1060
1060
|
// this.logger.debug('[GLOBAL-SET] setVariablesFromSettings > showEmojiFooterButton:: ', TEMP]);
|
|
1061
1061
|
if (TEMP !== undefined) {
|
|
1062
|
-
globals.
|
|
1062
|
+
globals.showAudioRecorderFooterButton = (TEMP === true) ? true : false;
|
|
1063
1063
|
}
|
|
1064
1064
|
}
|
|
1065
1065
|
|
|
@@ -1335,9 +1335,9 @@ export class GlobalSettingsService {
|
|
|
1335
1335
|
if (TEMP !== null) {
|
|
1336
1336
|
this.globals.showEmojiFooterButton = (TEMP === true) ? true : false;
|
|
1337
1337
|
}
|
|
1338
|
-
TEMP = el.nativeElement.getAttribute('
|
|
1338
|
+
TEMP = el.nativeElement.getAttribute('showAudioRecorderFooterButton');
|
|
1339
1339
|
if (TEMP !== null) {
|
|
1340
|
-
this.globals.
|
|
1340
|
+
this.globals.showAudioRecorderFooterButton = (TEMP === true) ? true : false;
|
|
1341
1341
|
}
|
|
1342
1342
|
|
|
1343
1343
|
|
package/src/app/utils/globals.ts
CHANGED
|
@@ -218,7 +218,7 @@ export class Globals {
|
|
|
218
218
|
|
|
219
219
|
showEmojiFooterButton: boolean // ******* new ********
|
|
220
220
|
showAttachmentFooterButton: boolean // ******* new ********
|
|
221
|
-
|
|
221
|
+
showAudioRecorderFooterButton: boolean // ******* new ********
|
|
222
222
|
constructor(
|
|
223
223
|
) { }
|
|
224
224
|
|
|
@@ -419,7 +419,7 @@ export class Globals {
|
|
|
419
419
|
/** show/hide attachment option in footer chat-detail page */
|
|
420
420
|
this.showAttachmentFooterButton = true;
|
|
421
421
|
/** show/hide rec audio option in footer chat-detail page */
|
|
422
|
-
this.
|
|
422
|
+
this.showAudioRecorderFooterButton = true;
|
|
423
423
|
|
|
424
424
|
// ============ END: SET EXTERNAL PARAMETERS ==============//
|
|
425
425
|
|
|
@@ -1352,10 +1352,10 @@
|
|
|
1352
1352
|
window.Tiledesk('restart')
|
|
1353
1353
|
}
|
|
1354
1354
|
|
|
1355
|
-
function
|
|
1356
|
-
let status = document.querySelector('input[name="
|
|
1357
|
-
window.tiledeskSettings['
|
|
1358
|
-
console.log('
|
|
1355
|
+
function onClickshowAudioRecorderFooterButton(){
|
|
1356
|
+
let status = document.querySelector('input[name="showAudioRecorderFooterButton"]:checked').value
|
|
1357
|
+
window.tiledeskSettings['showAudioRecorderFooterButton'] = stringToBoolean(status)
|
|
1358
|
+
console.log('onClickshowAudioRecorderFooterButton:', window.tiledeskSettings)
|
|
1359
1359
|
window.Tiledesk('restart')
|
|
1360
1360
|
}
|
|
1361
1361
|
|
|
@@ -2402,13 +2402,13 @@
|
|
|
2402
2402
|
</div>
|
|
2403
2403
|
|
|
2404
2404
|
<div class="row">
|
|
2405
|
-
<div class="col-md-5 formElement"><span><em><strong>
|
|
2405
|
+
<div class="col-md-5 formElement"><span><em><strong>showAudioRecorderFooterButton</strong></em></span></div>
|
|
2406
2406
|
<div class="col-md-5">
|
|
2407
|
-
<input class="form-check-input" type="radio" name="
|
|
2408
|
-
<input class="form-check-input" type="radio" name="
|
|
2407
|
+
<input class="form-check-input" type="radio" name="showAudioRecorderFooterButton" value="true" checked><label>True</label>
|
|
2408
|
+
<input class="form-check-input" type="radio" name="showAudioRecorderFooterButton" value="false"><label>False</label>
|
|
2409
2409
|
</div>
|
|
2410
2410
|
<div class="col-md-2">
|
|
2411
|
-
<button class="btn btn-light" onclick="
|
|
2411
|
+
<button class="btn btn-light" onclick="onClickshowAudioRecorderFooterButton()">Test this setting <i class="fa fa-magic" aria-hidden="true"></i></button>
|
|
2412
2412
|
</div>
|
|
2413
2413
|
</div>
|
|
2414
2414
|
|
|
File without changes
|