@chat21/chat21-web-widget 5.0.90-rc.3 → 5.0.90-rc.4
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 +2 -1
- package/package.json +1 -1
- package/src/app/component/conversation-detail/conversation/conversation.component.html +1 -0
- package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.html +5 -5
- package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.ts +72 -78
- package/src/app/providers/global-settings.service.ts +18 -0
- package/src/app/utils/globals.ts +3 -0
- package/src/assets/twp/index-dev.html +18 -0
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -119,6 +119,7 @@
|
|
|
119
119
|
[userEmail]="g?.userEmail"
|
|
120
120
|
[showAttachmentFooterButton]="g?.showAttachmentFooterButton"
|
|
121
121
|
[showEmojiFooterButton]="g?.showEmojiFooterButton"
|
|
122
|
+
[showRegisterAudioFooterButton]="g?.showRegisterAudioFooterButton"
|
|
122
123
|
[hideTextAreaContent]="(g?.singleConversation && hideTextAreaContent) || (isConversationArchived && !g?.allowReopen)"
|
|
123
124
|
[isConversationArchived]="isConversationArchived"
|
|
124
125
|
[hideTextReply]="hideFooterTextReply"
|
package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.html
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
<!-- ICON ATTACHMENT -->
|
|
12
12
|
<label *ngIf="showAttachmentFooterButton" 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">
|
|
14
|
-
<svg xmlns="http://www.w3.org/2000/svg"
|
|
15
|
-
<path d="
|
|
14
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24" viewBox="0 0 24 24" >
|
|
15
|
+
<path d="M18.4,13.2l-2.6,4.5c-1.5,2.6-4.9,3.6-7.6,2c-2.6-1.5-3.6-4.9-2-7.6l3.9-6.7c1.1-1.9,3.6-2.6,5.5-1.5 c1.9,1.1,2.6,3.6,1.5,5.5l-3.3,5.7c-0.7,1.3-2.3,1.7-3.6,1c-1.3-0.7-1.7-2.3-1-3.6l2-3.4c0.2-0.3,0.6-0.5,1-0.3s0.5,0.6,0.3,1 l-2,3.4c-0.3,0.5-0.2,1.1,0.3,1.5c0.4,0.4,1.1,0.4,1.5,0c0.1-0.1,0.2-0.2,0.2-0.3l3.3-5.7c0.7-1.2,0.3-2.8-1-3.5 c-1.2-0.7-2.8-0.3-3.5,1l-3.9,6.7C6.4,14.9,7,17.4,9,18.5c1.9,1.1,4.4,0.5,5.6-1.5l2.6-4.5c0.2-0.3,0.6-0.5,1-0.3 C18.5,12.5,18.6,12.9,18.4,13.2L18.4,13.2z"/>
|
|
16
16
|
</svg>
|
|
17
17
|
</span>
|
|
18
18
|
<input
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
[attr.placeholder] ="(footerMessagePlaceholder)? footerMessagePlaceholder : translationMap?.get('LABEL_PLACEHOLDER')"
|
|
52
52
|
start-focus-chat21-conversation-component
|
|
53
53
|
inputTextArea
|
|
54
|
-
#textbox
|
|
54
|
+
#textbox
|
|
55
55
|
tabindex="1501"
|
|
56
56
|
aria-labelledby="altTextArea"
|
|
57
57
|
rows="1"
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
</div>
|
|
68
68
|
|
|
69
69
|
<!-- ICON SEND -->
|
|
70
|
-
<div *ngIf="textInputTextArea && !isStopRec" tabindex="-1" class="chat21-textarea-button" [class.active]="textInputTextArea && !hideTextReply" id="chat21-button-send" (click)="onSendPressed($event)">
|
|
70
|
+
<div *ngIf="(textInputTextArea !== '' && !isStopRec) || !showRegisterAudioFooterButton" 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="!textInputTextArea" tabindex="-1" class="chat21-audio-button" [class.active]="isStopRec" id="chat21-button-rec">
|
|
79
|
+
<div *ngIf="showRegisterAudioFooterButton && !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
|
@@ -29,6 +29,7 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
29
29
|
@Input() userEmail: string;
|
|
30
30
|
@Input() showAttachmentFooterButton: boolean;
|
|
31
31
|
@Input() showEmojiFooterButton: boolean
|
|
32
|
+
@Input() showRegisterAudioFooterButton: boolean
|
|
32
33
|
// @Input() showContinueConversationButton: boolean;
|
|
33
34
|
@Input() isConversationArchived: boolean;
|
|
34
35
|
@Input() hideTextAreaContent: boolean;
|
|
@@ -318,83 +319,75 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
318
319
|
// msg = replaceEndOfLine(msg);
|
|
319
320
|
// msg = msg.trim();
|
|
320
321
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
}
|
|
322
|
+
let recipientFullname = this.translationMap.get('GUEST_LABEL');
|
|
323
|
+
// sponziello: adds ADDITIONAL ATTRIBUTES TO THE MESSAGE
|
|
324
|
+
const g_attributes = this.attributes;
|
|
325
|
+
// added <any> to resolve the Error occurred during the npm installation: Property 'userFullname' does not exist on type '{}'
|
|
326
|
+
const attributes = <any>{};
|
|
327
|
+
if (g_attributes) {
|
|
328
|
+
for (const [key, value] of Object.entries(g_attributes)) {
|
|
329
|
+
attributes[key] = value;
|
|
330
330
|
}
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
331
|
+
}
|
|
332
|
+
if (additional_attributes) {
|
|
333
|
+
for (const [key, value] of Object.entries(additional_attributes)) {
|
|
334
|
+
attributes[key] = value;
|
|
335
335
|
}
|
|
336
|
-
|
|
337
|
-
//
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
336
|
+
}
|
|
337
|
+
// fine-sponziello
|
|
338
|
+
// this.conversationHandlerService = this.chatManager.getConversationHandlerByConversationId(this.conversationWith)
|
|
339
|
+
const senderId = this.senderId;
|
|
340
|
+
const projectid = this.projectid;
|
|
341
|
+
const channelType = this.channelType;
|
|
342
|
+
const userFullname = this.userFullname;
|
|
343
|
+
const userEmail = this.userEmail;
|
|
344
|
+
const conversationWith = this.conversationWith;
|
|
344
345
|
|
|
345
346
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
347
|
+
if (userFullname) {
|
|
348
|
+
recipientFullname = userFullname;
|
|
349
|
+
} else if (userEmail) {
|
|
350
|
+
recipientFullname = userEmail;
|
|
351
|
+
} else if (attributes && attributes['userFullname']) {
|
|
352
|
+
recipientFullname = attributes['userFullname'];
|
|
353
|
+
} else {
|
|
354
|
+
recipientFullname = this.translationMap.get('GUEST_LABEL');
|
|
355
|
+
}
|
|
355
356
|
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
357
|
+
this.onBeforeMessageSent.emit({
|
|
358
|
+
senderFullname: recipientFullname,
|
|
359
|
+
text: msg,
|
|
360
|
+
type: type,
|
|
361
|
+
metadata: metadata,
|
|
362
|
+
conversationWith: conversationWith,
|
|
363
|
+
recipientFullname: recipientFullname,
|
|
364
|
+
attributes : attributes,
|
|
365
|
+
projectid: projectid,
|
|
366
|
+
channelType: channelType
|
|
367
|
+
})
|
|
367
368
|
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
try {
|
|
386
|
-
const target = document.getElementById('chat21-main-message-context') as HTMLInputElement;
|
|
387
|
-
target.value = '';
|
|
388
|
-
target.style.height = this.HEIGHT_DEFAULT;
|
|
389
|
-
} catch (e) {
|
|
390
|
-
this.logger.error('[CONV-FOOTER] > Error :' + e);
|
|
391
|
-
}
|
|
392
|
-
this.restoreTextArea();
|
|
369
|
+
this.conversationHandlerService = this.chatManager.getConversationHandlerByConversationId(this.conversationWith);
|
|
370
|
+
const messageSent = this.conversationHandlerService.sendMessage(
|
|
371
|
+
msg,
|
|
372
|
+
type,
|
|
373
|
+
metadata,
|
|
374
|
+
conversationWith,
|
|
375
|
+
recipientFullname,
|
|
376
|
+
senderId,
|
|
377
|
+
recipientFullname,
|
|
378
|
+
channelType ,
|
|
379
|
+
attributes
|
|
380
|
+
);
|
|
381
|
+
|
|
382
|
+
this.onAfterSendMessage.emit(messageSent)
|
|
383
|
+
// this.isNewConversation = false;
|
|
384
|
+
|
|
385
|
+
this.restoreTextArea();
|
|
393
386
|
}
|
|
394
387
|
}
|
|
395
388
|
|
|
396
389
|
private restoreTextArea() {
|
|
397
|
-
//
|
|
390
|
+
// that.logger.log('[CONV-FOOTER] AppComponent:restoreTextArea::restoreTextArea');
|
|
398
391
|
this.resizeInputField();
|
|
399
392
|
const textArea = (<HTMLInputElement>document.getElementById('chat21-main-message-context'));
|
|
400
393
|
this.textInputTextArea = ''; // clear the textarea
|
|
@@ -407,6 +400,7 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
407
400
|
this.logger.log('[CONV-FOOTER] AppComponent:restoreTextArea::restoreTextArea::textArea:', 'restored');
|
|
408
401
|
}
|
|
409
402
|
this.setFocusOnId('chat21-main-message-context');
|
|
403
|
+
this.isStopRec= false;
|
|
410
404
|
}
|
|
411
405
|
|
|
412
406
|
/**
|
|
@@ -418,18 +412,18 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
418
412
|
try {
|
|
419
413
|
const target = document.getElementById('chat21-main-message-context') as HTMLInputElement;
|
|
420
414
|
// tslint:disable-next-line:max-line-length
|
|
421
|
-
// that.logger.log('[CONV-FOOTER] H:: this.textInputTextArea', (document.getElementById('chat21-main-message-context') as HTMLInputElement).value , target.style.height, target.scrollHeight, target.offsetHeight, target.clientHeight);
|
|
422
415
|
target? target.style.height = '100%': null;
|
|
423
416
|
if (target && target.value === '\n') {
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
417
|
+
this.textInputTextArea = ''; // clear the textarea
|
|
418
|
+
target.value = '';
|
|
419
|
+
target.style.height = this.HEIGHT_DEFAULT;
|
|
420
|
+
} else if (target && target.scrollHeight > target.offsetHeight) {
|
|
421
|
+
target.style.height = target.scrollHeight + 2 + 'px';
|
|
422
|
+
target.style.minHeight = this.HEIGHT_DEFAULT;
|
|
423
|
+
} else if (target) {
|
|
424
|
+
target.style.height = this.HEIGHT_DEFAULT;
|
|
425
|
+
// segno sto scrivendo
|
|
426
|
+
// target.offsetHeight - 15 + 'px';
|
|
433
427
|
}
|
|
434
428
|
//this.setWritingMessages(target.value);
|
|
435
429
|
this.onChangeTextArea.emit({textAreaEl: target, minHeightDefault: this.HEIGHT_DEFAULT})
|
|
@@ -610,7 +604,7 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
610
604
|
const textarea = document.getElementById(id);
|
|
611
605
|
if (textarea) {
|
|
612
606
|
// that.logger.log('[CONV-FOOTER] 1--------> FOCUSSSSSS : ', textarea);
|
|
613
|
-
textarea.setAttribute('value', '
|
|
607
|
+
textarea.setAttribute('value', '');
|
|
614
608
|
textarea.focus();
|
|
615
609
|
}
|
|
616
610
|
}, 500);
|
|
@@ -506,6 +506,15 @@ export class GlobalSettingsService {
|
|
|
506
506
|
if (variables.hasOwnProperty('onPageChangeVisibilityMobile')) {
|
|
507
507
|
globals['onPageChangeVisibilityMobile'] = variables['onPageChangeVisibilityMobile'];
|
|
508
508
|
}
|
|
509
|
+
if (variables.hasOwnProperty('showEmojiFooterButton')) {
|
|
510
|
+
globals['showEmojiFooterButton'] = variables['showEmojiFooterButton'];
|
|
511
|
+
}
|
|
512
|
+
if (variables.hasOwnProperty('showAttachmentFooterButton')) {
|
|
513
|
+
globals['showAttachmentFooterButton'] = variables['showAttachmentFooterButton'];
|
|
514
|
+
}
|
|
515
|
+
if (variables.hasOwnProperty('showRegisterAudioFooterButton')) {
|
|
516
|
+
globals['showRegisterAudioFooterButton'] = variables['showRegisterAudioFooterButton'];
|
|
517
|
+
}
|
|
509
518
|
|
|
510
519
|
}
|
|
511
520
|
}
|
|
@@ -1047,6 +1056,11 @@ export class GlobalSettingsService {
|
|
|
1047
1056
|
if (TEMP !== undefined) {
|
|
1048
1057
|
globals.showEmojiFooterButton = (TEMP === true) ? true : false;
|
|
1049
1058
|
}
|
|
1059
|
+
TEMP = tiledeskSettings['showRegisterAudioFooterButton'];
|
|
1060
|
+
// this.logger.debug('[GLOBAL-SET] setVariablesFromSettings > showEmojiFooterButton:: ', TEMP]);
|
|
1061
|
+
if (TEMP !== undefined) {
|
|
1062
|
+
globals.showRegisterAudioFooterButton = (TEMP === true) ? true : false;
|
|
1063
|
+
}
|
|
1050
1064
|
}
|
|
1051
1065
|
|
|
1052
1066
|
/**
|
|
@@ -1321,6 +1335,10 @@ export class GlobalSettingsService {
|
|
|
1321
1335
|
if (TEMP !== null) {
|
|
1322
1336
|
this.globals.showEmojiFooterButton = (TEMP === true) ? true : false;
|
|
1323
1337
|
}
|
|
1338
|
+
TEMP = el.nativeElement.getAttribute('showRegisterAudioFooterButton');
|
|
1339
|
+
if (TEMP !== null) {
|
|
1340
|
+
this.globals.showRegisterAudioFooterButton = (TEMP === true) ? true : false;
|
|
1341
|
+
}
|
|
1324
1342
|
|
|
1325
1343
|
|
|
1326
1344
|
}
|
package/src/app/utils/globals.ts
CHANGED
|
@@ -218,6 +218,7 @@ export class Globals {
|
|
|
218
218
|
|
|
219
219
|
showEmojiFooterButton: boolean // ******* new ********
|
|
220
220
|
showAttachmentFooterButton: boolean // ******* new ********
|
|
221
|
+
showRegisterAudioFooterButton: boolean // ******* new ********
|
|
221
222
|
constructor(
|
|
222
223
|
) { }
|
|
223
224
|
|
|
@@ -417,6 +418,8 @@ export class Globals {
|
|
|
417
418
|
this.showEmojiFooterButton = true;
|
|
418
419
|
/** show/hide attachment option in footer chat-detail page */
|
|
419
420
|
this.showAttachmentFooterButton = true;
|
|
421
|
+
/** show/hide rec audio option in footer chat-detail page */
|
|
422
|
+
this.showRegisterAudioFooterButton = true;
|
|
420
423
|
|
|
421
424
|
// ============ END: SET EXTERNAL PARAMETERS ==============//
|
|
422
425
|
|
|
@@ -1355,6 +1355,13 @@
|
|
|
1355
1355
|
window.Tiledesk('restart')
|
|
1356
1356
|
}
|
|
1357
1357
|
|
|
1358
|
+
function onClickShowRegisterAudioFooterButton(){
|
|
1359
|
+
let status = document.querySelector('input[name="showRegisterAudioFooterButton"]:checked').value
|
|
1360
|
+
window.tiledeskSettings['showRegisterAudioFooterButton'] = stringToBoolean(status)
|
|
1361
|
+
console.log('onClickShowRegisterAudioFooterButton:', window.tiledeskSettings)
|
|
1362
|
+
window.Tiledesk('restart')
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1358
1365
|
|
|
1359
1366
|
|
|
1360
1367
|
|
|
@@ -2397,6 +2404,17 @@
|
|
|
2397
2404
|
</div>
|
|
2398
2405
|
</div>
|
|
2399
2406
|
|
|
2407
|
+
<div class="row">
|
|
2408
|
+
<div class="col-md-5 formElement"><span><em><strong>showRegisterAudioFooterButton</strong></em></span></div>
|
|
2409
|
+
<div class="col-md-5">
|
|
2410
|
+
<input class="form-check-input" type="radio" name="showRegisterAudioFooterButton" value="true" checked><label>True</label>
|
|
2411
|
+
<input class="form-check-input" type="radio" name="showRegisterAudioFooterButton" value="false"><label>False</label>
|
|
2412
|
+
</div>
|
|
2413
|
+
<div class="col-md-2">
|
|
2414
|
+
<button class="btn btn-light" onclick="onClickShowRegisterAudioFooterButton()">Test this setting <i class="fa fa-magic" aria-hidden="true"></i></button>
|
|
2415
|
+
</div>
|
|
2416
|
+
</div>
|
|
2417
|
+
|
|
2400
2418
|
|
|
2401
2419
|
<div><h3 style="line-height: 0.3;">MANAGE <em><strong>BUBBLE MESSAGE STYLES</strong></em></h3></div>
|
|
2402
2420
|
<div class="row">
|