@chat21/chat21-web-widget 5.1.0-rc1 → 5.1.0-rc11
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 +43 -2
- package/Dockerfile +3 -3
- package/angular.json +21 -17
- package/deploy_amazon_beta.sh +6 -11
- package/deploy_amazon_prod.sh +4 -11
- package/deploy_beta.sh +11 -0
- package/deploy_prod.sh +12 -3
- package/package.json +18 -20
- package/src/app/app.component.spec.ts +13 -13
- package/src/app/app.module.ts +11 -13
- package/src/app/component/conversation-detail/conversation/conversation.component.html +1 -2
- package/src/app/component/conversation-detail/conversation/conversation.component.spec.ts +11 -13
- package/src/app/component/conversation-detail/conversation/conversation.component.ts +4 -2
- package/src/app/component/conversation-detail/conversation-audio-recorder/conversation-audio-recorder.component.scss +1 -0
- package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.html +22 -6
- package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.scss +45 -3
- package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.ts +60 -8
- package/src/app/component/conversation-detail/conversation-header/conversation-header.component.html +2 -2
- package/src/app/component/conversation-detail/conversation-header/conversation-header.component.spec.ts +10 -11
- package/src/app/component/conversation-detail/conversation-header/conversation-header.component.ts +0 -1
- package/src/app/component/eyeeye-catcher-card/eyeeye-catcher-card.component.ts +5 -1
- package/src/app/component/home-conversations/home-conversations.component.spec.ts +9 -11
- package/src/app/component/message/audio/audio.component.ts +30 -16
- package/src/app/component/star-rating-widget/star-rating-widget.component.spec.ts +10 -11
- package/src/app/pipe/date-ago.pipe.ts +2 -2
- package/src/app/providers/app-config.service.spec.ts +5 -6
- package/src/app/providers/global-settings.service.spec.ts +7 -8
- package/src/app/providers/global-settings.service.ts +1 -14
- package/src/app/providers/star-rating-widget.service.spec.ts +7 -8
- package/src/app/providers/translator.service.spec.ts +7 -9
- package/src/app/providers/waiting.service.spec.ts +7 -8
- package/src/app/sass/_variables.scss +6 -1
- package/src/app/sass/animations.scss +1 -0
- package/src/app/utils/globals.ts +1 -4
- package/src/app/utils/utils.ts +0 -9
- package/src/assets/i18n/en.json +3 -1
- package/src/assets/twp/chatbot-panel.html +8 -1
- package/src/assets/twp/index-dev.html +8 -18
- package/src/assets/twp/index.html +13 -3
- package/src/build_launch.js +9 -8
- package/src/chat21-core/providers/firebase/firebase-conversation-handler.ts +7 -1
- package/src/chat21-core/providers/mqtt/mqtt-conversation-handler.ts +8 -1
- package/src/chat21-core/providers/tiledesk/tiledesk-auth.service.spec.ts +8 -7
- package/src/chat21-core/providers/tiledesk/tiledesk-requests.service.spec.ts +10 -6
- package/src/chat21-core/utils/constants.ts +2 -0
- package/src/chat21-core/utils/utils-message.ts +32 -1
- package/src/chat21-core/utils/utils.ts +85 -2
- package/src/launch.js +11 -4
- package/src/launch_template.js +11 -4
- package/src/models/project.ts +4 -1
- package/tsconfig.json +1 -2
package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.scss
CHANGED
|
@@ -39,6 +39,9 @@
|
|
|
39
39
|
&.disabled {
|
|
40
40
|
background-color: rgb(232, 233, 237);
|
|
41
41
|
}
|
|
42
|
+
&.hasError{
|
|
43
|
+
box-shadow: 0 0 0 1px var(--chat-footer-border-color-error) inset;
|
|
44
|
+
}
|
|
42
45
|
}
|
|
43
46
|
|
|
44
47
|
.chat21-textarea-button {
|
|
@@ -52,6 +55,12 @@
|
|
|
52
55
|
opacity: 1;
|
|
53
56
|
cursor: pointer;
|
|
54
57
|
}
|
|
58
|
+
&.disabled{
|
|
59
|
+
opacity: 0.3 !important;
|
|
60
|
+
pointer-events: none !important;
|
|
61
|
+
cursor: not-allowed !important;
|
|
62
|
+
|
|
63
|
+
}
|
|
55
64
|
}
|
|
56
65
|
|
|
57
66
|
.chat21-textarea-button span svg:hover {
|
|
@@ -273,16 +282,18 @@ textarea:active{
|
|
|
273
282
|
|
|
274
283
|
}
|
|
275
284
|
|
|
285
|
+
.footerContainerAlert{
|
|
286
|
+
position: relative;
|
|
287
|
+
}
|
|
276
288
|
|
|
277
289
|
#hiddenFooter{
|
|
278
|
-
|
|
290
|
+
position: absolute;
|
|
279
291
|
bottom: 100%;
|
|
280
292
|
width: 100%;
|
|
281
293
|
height: var(--chat-footer-logo-height);
|
|
282
294
|
display: flex;
|
|
283
295
|
align-items: center;
|
|
284
296
|
justify-content: center;
|
|
285
|
-
// position: absolute;
|
|
286
297
|
// box-shadow: inset 0px -22px 16px -15px rgba(0,0,0,0.1);
|
|
287
298
|
&.hideTextReply{
|
|
288
299
|
height: var(--chat-footer-height);
|
|
@@ -344,6 +355,37 @@ textarea:active{
|
|
|
344
355
|
}
|
|
345
356
|
}
|
|
346
357
|
|
|
358
|
+
#textAlert{
|
|
359
|
+
bottom: 100%;
|
|
360
|
+
width: 100%;
|
|
361
|
+
height: var(--chat-footer-logo-height);
|
|
362
|
+
display: flex;
|
|
363
|
+
align-items: center;
|
|
364
|
+
justify-content: center;
|
|
365
|
+
background-color: var(--content-background-color);
|
|
366
|
+
position: absolute;
|
|
367
|
+
svg{
|
|
368
|
+
fill: var(--chat-footer-border-color-error);
|
|
369
|
+
}
|
|
370
|
+
// box-shadow: inset 0px -22px 16px -15px rgba(0,0,0,0.1);
|
|
371
|
+
div.alertText{
|
|
372
|
+
color: var(--dark-gray);
|
|
373
|
+
font-size: 1.2em;
|
|
374
|
+
font-weight: 500;
|
|
375
|
+
line-height: 22px;
|
|
376
|
+
font-family: Mulish, sans-serif;
|
|
377
|
+
letter-spacing: 0.24px;
|
|
378
|
+
-webkit-font-smoothing: antialiased;
|
|
379
|
+
padding: 4px 12px;
|
|
380
|
+
color: var(--chat-footer-border-color-error);
|
|
381
|
+
}
|
|
382
|
+
&.hideTextReply{
|
|
383
|
+
height: var(--chat-footer-height);
|
|
384
|
+
position: unset;
|
|
385
|
+
box-shadow: none;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
|
|
347
389
|
.fade-in-bottom {
|
|
348
390
|
-webkit-animation: fade-in-bottom 0.5s cubic-bezier(0.600, -0.280, 0.735, 0.045) 0.0s;
|
|
349
391
|
animation: fade-in-bottom 0.5s cubic-bezier(0.600, -0.280, 0.735, 0.045) 0.0s;
|
|
@@ -367,4 +409,4 @@ textarea:active{
|
|
|
367
409
|
// left: 10px;
|
|
368
410
|
border: none;
|
|
369
411
|
margin: -2px -2px 0px;
|
|
370
|
-
}
|
|
412
|
+
}
|
package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.ts
CHANGED
|
@@ -10,8 +10,9 @@ import { UploadService } from 'src/chat21-core/providers/abstract/upload.service
|
|
|
10
10
|
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
|
-
import { convertColorToRGBA } from 'src/chat21-core/utils/utils';
|
|
14
|
-
import { isImage } from 'src/chat21-core/utils/utils-message';
|
|
13
|
+
import { convertColorToRGBA, isAllowedUrlInText, isEmoji } from 'src/chat21-core/utils/utils';
|
|
14
|
+
import { findAndRemoveEmoji, isImage } from 'src/chat21-core/utils/utils-message';
|
|
15
|
+
import { ProjectModel } from 'src/models/project';
|
|
15
16
|
|
|
16
17
|
@Component({
|
|
17
18
|
selector: 'chat-conversation-footer',
|
|
@@ -24,7 +25,7 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
24
25
|
@Input() attributes: string;
|
|
25
26
|
@Input() senderId: string;
|
|
26
27
|
@Input() tenant: string;
|
|
27
|
-
@Input()
|
|
28
|
+
@Input() project: ProjectModel;
|
|
28
29
|
@Input() channelType: string;
|
|
29
30
|
@Input() userFullname: string;
|
|
30
31
|
@Input() userEmail: string;
|
|
@@ -81,10 +82,12 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
81
82
|
include: [ 'recent', 'people', 'nature', 'activity', 'flags']
|
|
82
83
|
}
|
|
83
84
|
|
|
85
|
+
showAlertEmoji: boolean = false
|
|
86
|
+
showAlertUrl: boolean = false;
|
|
87
|
+
|
|
84
88
|
convertColorToRGBA = convertColorToRGBA;
|
|
85
89
|
private logger: LoggerService = LoggerInstance.getInstance()
|
|
86
|
-
constructor(
|
|
87
|
-
private chatManager: ChatManager,
|
|
90
|
+
constructor(private chatManager: ChatManager,
|
|
88
91
|
private typingService: TypingService,
|
|
89
92
|
private uploadService: UploadService) { }
|
|
90
93
|
|
|
@@ -253,7 +256,6 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
253
256
|
// return snapshot.ref.getDownloadURL(); // Will return a promise with the download link
|
|
254
257
|
// }).then(downloadURL => {
|
|
255
258
|
// that.logger.log('[CONV-FOOTER] AppComponent::uploadSingle:: downloadURL', downloadURL]);
|
|
256
|
-
// that.g.wdLog([`Successfully uploaded file and got download link - ${downloadURL}`]);
|
|
257
259
|
|
|
258
260
|
// metadata.src = downloadURL;
|
|
259
261
|
// let type_message = TYPE_MSG_TEXT;
|
|
@@ -321,6 +323,13 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
321
323
|
(metadata) ? metadata = metadata : metadata = '';
|
|
322
324
|
this.onEmojiiPickerShow.emit(false)
|
|
323
325
|
this.logger.log('[CONV-FOOTER] SEND MESSAGE: ', msg, type, metadata, additional_attributes);
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
let checkUrlDomain = this.checkForUrlDomain(this.textInputTextArea)
|
|
329
|
+
if(!checkUrlDomain){
|
|
330
|
+
return
|
|
331
|
+
}
|
|
332
|
+
|
|
324
333
|
if (msg && msg.trim() !== '' || type === TYPE_MSG_IMAGE || type === TYPE_MSG_FILE ) {
|
|
325
334
|
|
|
326
335
|
// msg = htmlEntities(msg);
|
|
@@ -345,7 +354,7 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
345
354
|
// fine-sponziello
|
|
346
355
|
// this.conversationHandlerService = this.chatManager.getConversationHandlerByConversationId(this.conversationWith)
|
|
347
356
|
const senderId = this.senderId;
|
|
348
|
-
const projectid = this.
|
|
357
|
+
const projectid = this.project.id;
|
|
349
358
|
const channelType = this.channelType;
|
|
350
359
|
const userFullname = this.userFullname;
|
|
351
360
|
const userEmail = this.userEmail;
|
|
@@ -514,11 +523,49 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
514
523
|
//}, false);
|
|
515
524
|
}
|
|
516
525
|
|
|
526
|
+
|
|
527
|
+
checkForEmojii(text){
|
|
528
|
+
//remove emojii only if "emojii" exist and is set to false
|
|
529
|
+
if(this.project && this.project.settings?.allow_send_emoji === false){
|
|
530
|
+
this.showAlertEmoji = isEmoji(text);
|
|
531
|
+
if(this.showAlertEmoji){
|
|
532
|
+
return false
|
|
533
|
+
}
|
|
534
|
+
this.showAlertEmoji = false;
|
|
535
|
+
return true
|
|
536
|
+
}
|
|
537
|
+
this.showAlertEmoji = false;
|
|
538
|
+
return true
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
checkForUrlDomain(text){
|
|
542
|
+
if(this.project && this.project.settings?.allowed_urls === true){
|
|
543
|
+
this.showAlertUrl = !isAllowedUrlInText(text, this.project.settings?.allowed_urls_list);
|
|
544
|
+
if(this.showAlertUrl){
|
|
545
|
+
return false
|
|
546
|
+
}
|
|
547
|
+
this.showAlertUrl = false
|
|
548
|
+
return true
|
|
549
|
+
}
|
|
550
|
+
this.showAlertUrl = false
|
|
551
|
+
return true
|
|
552
|
+
|
|
553
|
+
|
|
554
|
+
}
|
|
555
|
+
|
|
517
556
|
|
|
518
557
|
|
|
519
558
|
onTextAreaChange(){
|
|
520
559
|
this.resizeInputField()
|
|
521
560
|
this.setWritingMessages(this.textInputTextArea)
|
|
561
|
+
|
|
562
|
+
//reset alert to defalt values before checking again
|
|
563
|
+
this.showAlertEmoji= false;
|
|
564
|
+
this.showAlertUrl = false;
|
|
565
|
+
let check = this.checkForEmojii(this.textInputTextArea)
|
|
566
|
+
if(!check){
|
|
567
|
+
return;
|
|
568
|
+
}
|
|
522
569
|
}
|
|
523
570
|
|
|
524
571
|
onSendPressed(event) {
|
|
@@ -587,6 +634,12 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
587
634
|
|
|
588
635
|
addEmoji(event){
|
|
589
636
|
this.onEmojiiPickerShow.emit(false); //de-activate emojii picker on select
|
|
637
|
+
|
|
638
|
+
let check = this.checkForEmojii(this.textInputTextArea)
|
|
639
|
+
if(!check){
|
|
640
|
+
return;
|
|
641
|
+
}
|
|
642
|
+
|
|
590
643
|
this.textInputTextArea = this.textInputTextArea.trimStart() + event.emoji.native + " "
|
|
591
644
|
this.setFocusOnId('chat21-main-message-context')
|
|
592
645
|
}
|
|
@@ -632,7 +685,6 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
632
685
|
* @param str
|
|
633
686
|
*/
|
|
634
687
|
setWritingMessages(str) {
|
|
635
|
-
//this.messagingService.setWritingMessages(str, this.g.channelType);
|
|
636
688
|
this.typingService.setTyping(this.conversationWith, str, this.senderId, this.userFullname )
|
|
637
689
|
}
|
|
638
690
|
|
package/src/app/component/conversation-detail/conversation-header/conversation-header.component.html
CHANGED
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
|
|
113
113
|
|
|
114
114
|
<!-- ICON RESTART CONVERSATION -->
|
|
115
|
-
<div class="c21-header-button c21-right" *ngIf="!hideRestartConversationOptionsMenu" (click)="restartChat()">
|
|
115
|
+
<!-- <div class="c21-header-button c21-right" *ngIf="!hideRestartConversationOptionsMenu" (click)="restartChat()">
|
|
116
116
|
<svg role="img" id="refresh" aria-labelledby="altIconTitle" class="icon-menu" xmlns="http://www.w3.org/2000/svg"
|
|
117
117
|
width="20px" height="20px" viewBox="0 0 20 20">
|
|
118
118
|
<path d="M9.6,18.2c0.6,0,1-0.7,1-1.5s-0.5-1.5-1-1.5H6c-0.6,0-1-0.7-1-1.5V7.8h1c0.4,0,0.8-0.4,1-0.9c0.2-0.6,0.1-1.2-0.2-1.6 l-2.1-3c-0.4-0.6-1.1-0.6-1.5,0l-2.1,3C0.9,5.7,0.8,6.3,1,6.9s0.5,0.9,1,0.9h1v5.9c0,2.5,1.4,4.4,3.1,4.4H9.6z"/>
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
<title id="altIconTitle">{{ translationMap?.get('RESTART') }}</title>
|
|
121
121
|
</svg>
|
|
122
122
|
<span class="label-menu-item">{{ translationMap?.get('RESTART') }}</span>
|
|
123
|
-
</div>
|
|
123
|
+
</div> -->
|
|
124
124
|
|
|
125
125
|
<!-- ICON MAXIMIZE -->
|
|
126
126
|
<!-- <div class="c21-header-button c21-right" *ngIf="heightStatus==='min'" (click)="maximizeMinimize('max')">
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
|
2
2
|
import { AppConfigService } from './../../../providers/app-config.service';
|
|
3
3
|
import { Globals } from './../../../utils/globals';
|
|
4
4
|
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
|
5
|
-
import {
|
|
5
|
+
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
|
6
6
|
|
|
7
7
|
import { ConversationHeaderComponent } from './conversation-header.component';
|
|
8
8
|
import { TypingService } from '../../../../chat21-core/providers/abstract/typing.service';
|
|
@@ -18,17 +18,16 @@ describe('ConversationHeaderComponent', () => {
|
|
|
18
18
|
|
|
19
19
|
beforeEach(waitForAsync(() => {
|
|
20
20
|
TestBed.configureTestingModule({
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
providers: [
|
|
21
|
+
declarations: [ConversationHeaderComponent],
|
|
22
|
+
schemas: [NO_ERRORS_SCHEMA],
|
|
23
|
+
imports: [],
|
|
24
|
+
providers: [
|
|
26
25
|
Globals,
|
|
27
26
|
TypingService,
|
|
28
|
-
AppConfigService
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
AppConfigService,
|
|
28
|
+
provideHttpClient(withInterceptorsFromDi())
|
|
29
|
+
]
|
|
30
|
+
})
|
|
32
31
|
.compileComponents();
|
|
33
32
|
}));
|
|
34
33
|
|
package/src/app/component/conversation-detail/conversation-header/conversation-header.component.ts
CHANGED
|
@@ -23,7 +23,6 @@ export class ConversationHeaderComponent implements OnInit, OnChanges {
|
|
|
23
23
|
@Input() typingLocation: string;
|
|
24
24
|
@Input() isTrascriptDownloadEnabled: boolean;
|
|
25
25
|
@Input() hideCloseConversationOptionMenu: boolean;
|
|
26
|
-
@Input() hideRestartConversationOptionsMenu: boolean;
|
|
27
26
|
@Input() hideHeaderCloseButton: boolean;
|
|
28
27
|
@Input() hideHeaderBackButton: boolean;
|
|
29
28
|
@Input() hideHeaderConversationOptionsMenu: boolean;
|
|
@@ -96,7 +96,6 @@ export class EyeeyeCatcherCardComponent implements OnInit {
|
|
|
96
96
|
title = this.g.calloutTitle.trim();
|
|
97
97
|
}
|
|
98
98
|
this.title = title;
|
|
99
|
-
const emojiRegex = require('emoji-regex');
|
|
100
99
|
const regex = emojiRegex();
|
|
101
100
|
let match: any;
|
|
102
101
|
// this.logger.debug('[EYEEYE-CATCHER-CARD]-->regex, emojiRegex', regex, emojiRegex)
|
|
@@ -163,3 +162,8 @@ export class EyeeyeCatcherCardComponent implements OnInit {
|
|
|
163
162
|
// this.displayEyeCatcherCardCloseBtnIsMobileWrapper = 'none';
|
|
164
163
|
// }
|
|
165
164
|
}
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
export default function emojiRegex(): RegExp {
|
|
168
|
+
return /(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u2700-\u27BF])|(?:\u24C2)|(?:[\u1F680-\u1F6FF])/g;
|
|
169
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CustomTranslateService } from './../../../chat21-core/providers/custom-translate.service';
|
|
2
2
|
import { TranslatorService } from './../../providers/translator.service';
|
|
3
|
-
import {
|
|
3
|
+
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
|
4
4
|
import { AppConfigService } from './../../providers/app-config.service';
|
|
5
5
|
import { WaitingService } from './../../providers/waiting.service';
|
|
6
6
|
import { ChatManager } from './../../../chat21-core/providers/chat-manager';
|
|
@@ -25,12 +25,10 @@ describe('HomeConversationsComponent', () => {
|
|
|
25
25
|
|
|
26
26
|
beforeEach(waitForAsync(() => {
|
|
27
27
|
TestBed.configureTestingModule({
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
],
|
|
33
|
-
providers: [
|
|
28
|
+
declarations: [HomeConversationsComponent],
|
|
29
|
+
schemas: [NO_ERRORS_SCHEMA],
|
|
30
|
+
imports: [TranslateModule.forRoot()],
|
|
31
|
+
providers: [
|
|
34
32
|
Globals,
|
|
35
33
|
ImageRepoService,
|
|
36
34
|
ChatManager,
|
|
@@ -39,10 +37,10 @@ describe('HomeConversationsComponent', () => {
|
|
|
39
37
|
WaitingService,
|
|
40
38
|
AppConfigService,
|
|
41
39
|
TranslatorService,
|
|
42
|
-
CustomTranslateService
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
CustomTranslateService,
|
|
41
|
+
provideHttpClient(withInterceptorsFromDi())
|
|
42
|
+
]
|
|
43
|
+
})
|
|
46
44
|
.compileComponents();
|
|
47
45
|
}));
|
|
48
46
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Component, ElementRef, AfterViewInit, Input, ViewChild } from '@angular/core';
|
|
2
2
|
import { DomSanitizer, SafeUrl } from '@angular/platform-browser';
|
|
3
|
+
import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
|
|
4
|
+
import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
|
|
3
5
|
import { convertColorToRGBA } from 'src/chat21-core/utils/utils';
|
|
4
6
|
|
|
5
7
|
@Component({
|
|
@@ -26,13 +28,13 @@ export class AudioComponent implements AfterViewInit {
|
|
|
26
28
|
currentTime: number = 0;
|
|
27
29
|
isPlaying: boolean = false;
|
|
28
30
|
|
|
31
|
+
private logger: LoggerService = LoggerInstance.getInstance();
|
|
29
32
|
constructor(
|
|
30
33
|
private sanitizer: DomSanitizer,
|
|
31
34
|
private elementRef: ElementRef
|
|
32
35
|
) {}
|
|
33
36
|
|
|
34
37
|
ngAfterViewInit() {
|
|
35
|
-
console.log('stylesssss', this.stylesMap)
|
|
36
38
|
if (this.audioBlob) {
|
|
37
39
|
this.rawAudioUrl = URL.createObjectURL(this.audioBlob);
|
|
38
40
|
this.audioUrl = this.sanitizer.bypassSecurityTrustUrl(this.rawAudioUrl);
|
|
@@ -136,21 +138,33 @@ export class AudioComponent implements AfterViewInit {
|
|
|
136
138
|
return `${minutes}:${sec < 10 ? '0' + sec : sec}`;
|
|
137
139
|
}
|
|
138
140
|
|
|
139
|
-
getAudioDuration() {
|
|
140
|
-
const audio = new Audio();
|
|
141
|
-
audio.src = this.rawAudioUrl!;
|
|
142
|
-
audio.addEventListener('loadedmetadata', () => {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
});
|
|
141
|
+
async getAudioDuration() {
|
|
142
|
+
// const audio = new Audio();
|
|
143
|
+
// audio.src = this.rawAudioUrl!;
|
|
144
|
+
// audio.addEventListener('loadedmetadata', () => {
|
|
145
|
+
// if (audio.duration === Infinity) {
|
|
146
|
+
// audio.currentTime = Number.MAX_SAFE_INTEGER;
|
|
147
|
+
// audio.ontimeupdate = () => {
|
|
148
|
+
// audio.ontimeupdate = null;
|
|
149
|
+
// audio.currentTime = 0;
|
|
150
|
+
// this.audioDuration = audio.duration;
|
|
151
|
+
// };
|
|
152
|
+
// } else {
|
|
153
|
+
// this.audioDuration = audio.duration;
|
|
154
|
+
// }
|
|
155
|
+
// });
|
|
156
|
+
|
|
157
|
+
const response = await fetch(this.rawAudioUrl!);
|
|
158
|
+
this.logger.debug('getAudioDuration: response ---> ', response)
|
|
159
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
160
|
+
this.logger.debug('getAudioDuration: arrayBuffer ---> ', arrayBuffer)
|
|
161
|
+
const audioContext = new (window.AudioContext || (window as any).webkitAudioContext)();
|
|
162
|
+
this.logger.debug('getAudioDuration: audioContext ---> ', audioContext)
|
|
163
|
+
const audioBuffer = await audioContext.decodeAudioData(arrayBuffer);
|
|
164
|
+
this.logger.debug('getAudioDuration: audioBuffer ---> ', audioBuffer)
|
|
165
|
+
this.audioDuration = audioBuffer.duration;
|
|
166
|
+
this.logger.debug('getAudioDuration: audioDuration ---> ', this.audioDuration)
|
|
167
|
+
|
|
154
168
|
}
|
|
155
169
|
|
|
156
170
|
extractFirstColor(gradient: string): string | null {
|
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
import { AppConfigService } from './../../providers/app-config.service';
|
|
2
2
|
import { StarRatingWidgetService } from './../../providers/star-rating-widget.service';
|
|
3
|
-
import {
|
|
3
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
4
4
|
|
|
5
5
|
import { StarRatingWidgetComponent } from './star-rating-widget.component';
|
|
6
6
|
import { Globals } from '../../utils/globals';
|
|
7
|
-
import {
|
|
7
|
+
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
|
8
8
|
|
|
9
9
|
describe('StarRatingWidgetComponent', () => {
|
|
10
10
|
let component: StarRatingWidgetComponent;
|
|
11
11
|
let fixture: ComponentFixture<StarRatingWidgetComponent>;
|
|
12
12
|
|
|
13
|
-
beforeEach(
|
|
13
|
+
beforeEach((() => {
|
|
14
14
|
TestBed.configureTestingModule({
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
],
|
|
19
|
-
providers: [
|
|
15
|
+
declarations: [StarRatingWidgetComponent],
|
|
16
|
+
imports: [],
|
|
17
|
+
providers: [
|
|
20
18
|
Globals,
|
|
21
19
|
AppConfigService,
|
|
22
|
-
StarRatingWidgetService
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
StarRatingWidgetService,
|
|
21
|
+
provideHttpClient(withInterceptorsFromDi())
|
|
22
|
+
]
|
|
23
|
+
})
|
|
25
24
|
.compileComponents();
|
|
26
25
|
}));
|
|
27
26
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Pipe, PipeTransform } from '@angular/core';
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import dayjs from 'dayjs';
|
|
4
|
+
import relativeTime from 'dayjs/plugin/relativeTime';
|
|
5
5
|
dayjs.extend(relativeTime)
|
|
6
6
|
|
|
7
7
|
@Pipe({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
|
2
2
|
import { TestBed } from '@angular/core/testing';
|
|
3
3
|
import { Globals } from '../utils/globals';
|
|
4
4
|
|
|
@@ -6,13 +6,12 @@ import { AppConfigService } from './app-config.service';
|
|
|
6
6
|
|
|
7
7
|
describe('AppConfigService', () => {
|
|
8
8
|
beforeEach(() => TestBed.configureTestingModule({
|
|
9
|
-
imports: [
|
|
10
|
-
HttpClientModule,
|
|
11
|
-
],
|
|
9
|
+
imports: [],
|
|
12
10
|
providers: [
|
|
13
|
-
|
|
11
|
+
Globals,
|
|
12
|
+
provideHttpClient(withInterceptorsFromDi())
|
|
14
13
|
]
|
|
15
|
-
|
|
14
|
+
}));
|
|
16
15
|
|
|
17
16
|
it('should be created', () => {
|
|
18
17
|
const service: AppConfigService = TestBed.get(AppConfigService);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Globals } from './../utils/globals';
|
|
2
|
-
import {
|
|
2
|
+
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
|
3
3
|
import { TestBed, inject } from '@angular/core/testing';
|
|
4
4
|
import { AppStorageService } from '../../chat21-core/providers/abstract/app-storage.service';
|
|
5
5
|
import { AppConfigService } from './app-config.service';
|
|
@@ -9,16 +9,15 @@ import { GlobalSettingsService } from './global-settings.service';
|
|
|
9
9
|
describe('GlobalSettingsService', () => {
|
|
10
10
|
beforeEach(() => {
|
|
11
11
|
TestBed.configureTestingModule({
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
],
|
|
15
|
-
providers: [
|
|
12
|
+
imports: [],
|
|
13
|
+
providers: [
|
|
16
14
|
GlobalSettingsService,
|
|
17
15
|
AppStorageService,
|
|
18
16
|
AppConfigService,
|
|
19
|
-
Globals
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
Globals,
|
|
18
|
+
provideHttpClient(withInterceptorsFromDi())
|
|
19
|
+
]
|
|
20
|
+
});
|
|
22
21
|
});
|
|
23
22
|
|
|
24
23
|
it('should be created', inject([GlobalSettingsService], (service: GlobalSettingsService) => {
|
|
@@ -93,6 +93,7 @@ export class GlobalSettingsService {
|
|
|
93
93
|
project['trialDaysLeft'],
|
|
94
94
|
project['trialExpired'],
|
|
95
95
|
project['updatedAt'],
|
|
96
|
+
project['settings'],
|
|
96
97
|
project['versions']
|
|
97
98
|
);
|
|
98
99
|
}
|
|
@@ -865,11 +866,6 @@ export class GlobalSettingsService {
|
|
|
865
866
|
if (TEMP !== undefined) {
|
|
866
867
|
globals.hideCloseConversationOptionMenu = (TEMP === true) ? true : false;;
|
|
867
868
|
}
|
|
868
|
-
TEMP = tiledeskSettings['hideRestartConversationOptionsMenu'];
|
|
869
|
-
// this.logger.debug('[GLOBAL-SET] setVariablesFromSettings > hideHeaderConversationOptionsMenu:: ', TEMP]);
|
|
870
|
-
if (TEMP !== undefined) {
|
|
871
|
-
globals.hideRestartConversationOptionsMenu = (TEMP === true) ? true : false;;
|
|
872
|
-
}
|
|
873
869
|
TEMP = tiledeskSettings['hideHeaderConversationOptionsMenu'];
|
|
874
870
|
// this.logger.debug('[GLOBAL-SET] setVariablesFromSettings > hideHeaderConversationOptionsMenu:: ', TEMP]);
|
|
875
871
|
if (TEMP !== undefined) {
|
|
@@ -1240,10 +1236,6 @@ export class GlobalSettingsService {
|
|
|
1240
1236
|
if (TEMP !== null) {
|
|
1241
1237
|
this.globals.hideCloseConversationOptionMenu = TEMP;
|
|
1242
1238
|
}
|
|
1243
|
-
TEMP = el.nativeElement.getAttribute('hideRestartConversationOptionsMenu');
|
|
1244
|
-
if (TEMP !== null) {
|
|
1245
|
-
this.globals.hideRestartConversationOptionsMenu = TEMP;
|
|
1246
|
-
}
|
|
1247
1239
|
TEMP = el.nativeElement.getAttribute('hideSettings');
|
|
1248
1240
|
if (TEMP !== null) {
|
|
1249
1241
|
this.globals.hideSettings = TEMP;
|
|
@@ -1637,11 +1629,6 @@ export class GlobalSettingsService {
|
|
|
1637
1629
|
globals.hideCloseConversationOptionMenu = stringToBoolean(TEMP);
|
|
1638
1630
|
}
|
|
1639
1631
|
|
|
1640
|
-
TEMP = getParameterByName(windowContext, 'tiledesk_hideRestartConversationOptionsMenu');
|
|
1641
|
-
if (TEMP) {
|
|
1642
|
-
globals.hideRestartConversationOptionsMenu = stringToBoolean(TEMP);
|
|
1643
|
-
}
|
|
1644
|
-
|
|
1645
1632
|
TEMP = getParameterByName(windowContext, 'tiledesk_hideSettings');
|
|
1646
1633
|
if (TEMP) {
|
|
1647
1634
|
globals.hideSettings = stringToBoolean(TEMP);
|
|
@@ -3,20 +3,19 @@ import { Globals } from '../utils/globals';
|
|
|
3
3
|
import { TestBed, inject } from '@angular/core/testing';
|
|
4
4
|
|
|
5
5
|
import { StarRatingWidgetService } from './star-rating-widget.service';
|
|
6
|
-
import {
|
|
6
|
+
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
|
7
7
|
|
|
8
8
|
describe('StarRatingWidgetService', () => {
|
|
9
9
|
beforeEach(() => {
|
|
10
10
|
TestBed.configureTestingModule({
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
],
|
|
14
|
-
providers: [
|
|
11
|
+
imports: [],
|
|
12
|
+
providers: [
|
|
15
13
|
StarRatingWidgetService,
|
|
16
14
|
Globals,
|
|
17
|
-
AppConfigService
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
AppConfigService,
|
|
16
|
+
provideHttpClient(withInterceptorsFromDi())
|
|
17
|
+
]
|
|
18
|
+
});
|
|
20
19
|
});
|
|
21
20
|
|
|
22
21
|
it('should be created', inject([StarRatingWidgetService], (service: StarRatingWidgetService) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
|
2
2
|
import { AppConfigService } from './app-config.service';
|
|
3
3
|
import { Globals } from './../utils/globals';
|
|
4
4
|
import { TranslateModule, TranslateService } from '@ngx-translate/core';
|
|
@@ -9,16 +9,14 @@ import { TranslatorService } from './translator.service';
|
|
|
9
9
|
describe('TranslatorService', () => {
|
|
10
10
|
beforeEach(() => {
|
|
11
11
|
TestBed.configureTestingModule({
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
TranslateModule.forRoot(),
|
|
15
|
-
],
|
|
16
|
-
providers: [
|
|
12
|
+
imports: [TranslateModule.forRoot()],
|
|
13
|
+
providers: [
|
|
17
14
|
TranslatorService,
|
|
18
15
|
Globals,
|
|
19
|
-
AppConfigService
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
AppConfigService,
|
|
17
|
+
provideHttpClient(withInterceptorsFromDi())
|
|
18
|
+
]
|
|
19
|
+
});
|
|
22
20
|
});
|
|
23
21
|
|
|
24
22
|
it('should be created', inject([TranslatorService], (service: TranslatorService) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
|
2
2
|
import { AppConfigService } from './app-config.service';
|
|
3
3
|
import { Globals } from './../utils/globals';
|
|
4
4
|
import { TestBed, inject } from '@angular/core/testing';
|
|
@@ -8,15 +8,14 @@ import { WaitingService } from './waiting.service';
|
|
|
8
8
|
describe('WaitingService', () => {
|
|
9
9
|
beforeEach(() => {
|
|
10
10
|
TestBed.configureTestingModule({
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
],
|
|
14
|
-
providers: [
|
|
11
|
+
imports: [],
|
|
12
|
+
providers: [
|
|
15
13
|
WaitingService,
|
|
16
14
|
Globals,
|
|
17
|
-
AppConfigService
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
AppConfigService,
|
|
16
|
+
provideHttpClient(withInterceptorsFromDi())
|
|
17
|
+
]
|
|
18
|
+
});
|
|
20
19
|
});
|
|
21
20
|
|
|
22
21
|
it('should be created', inject([WaitingService], (service: WaitingService) => {
|
|
@@ -31,8 +31,13 @@
|
|
|
31
31
|
--chat-footer-border-radius: 16px;
|
|
32
32
|
--chat-footer-background-color: #f6f7fb;
|
|
33
33
|
--chat-footer-color: #1a1a1a;
|
|
34
|
+
--chat-footer-border-color-error: #aa0404;
|
|
34
35
|
|
|
35
|
-
--icon-fill-color: #5f6368
|
|
36
|
+
--icon-fill-color: #5f6368;
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
--content-background-color: #fff;
|
|
40
|
+
--content-text-color: var(--black);
|
|
36
41
|
}
|
|
37
42
|
|
|
38
43
|
$trasp-black:rgba(0,0,0,0.8);
|