@chat21/chat21-web-widget 5.0.70 → 5.0.71-rc.10
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/.github/workflows/build.yml +2 -2
- package/CHANGELOG.md +37 -0
- package/Dockerfile +1 -1
- package/package.json +1 -1
- package/src/app/app.component.ts +49 -49
- package/src/app/component/conversation-detail/conversation/conversation.component.html +3 -2
- package/src/app/component/conversation-detail/conversation/conversation.component.scss +3 -2
- package/src/app/component/conversation-detail/conversation/conversation.component.ts +3 -8
- package/src/app/component/conversation-detail/conversation-content/conversation-content.component.html +2 -3
- package/src/app/component/conversation-detail/conversation-content/conversation-content.component.ts +2 -4
- package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.scss +1 -1
- package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.ts +8 -4
- package/src/app/component/last-message/last-message.component.scss +1 -1
- package/src/app/component/message/carousel/carousel.component.html +6 -2
- package/src/app/component/message/carousel/carousel.component.scss +22 -0
- package/src/app/component/message/carousel/carousel.component.ts +6 -5
- package/src/app/component/message/image/image.component.ts +0 -3
- package/src/app/providers/global-settings.service.ts +5 -0
- package/src/app/sass/_variables.scss +1 -1
- package/src/app/utils/constants.ts +0 -2
- package/src/app/utils/globals.ts +4 -3
- package/src/app/utils/rules.ts +1 -1
- package/src/assets/images/icons/no-image.svg +6 -0
- package/src/assets/js/chat21client.js +7 -3
- package/src/assets/twp/chatbot-panel.html +223 -19
- package/src/assets/twp/index-dev.html +56 -17
- package/src/assets/twp/index.html +110 -37
- package/src/chat21-core/models/conversation.ts +2 -1
- package/src/chat21-core/models/upload.ts +0 -1
- package/src/chat21-core/providers/abstract/upload.service.ts +3 -0
- package/src/chat21-core/providers/firebase/firebase-auth-service.ts +3 -3
- package/src/chat21-core/providers/firebase/firebase-conversation-handler.ts +1 -1
- package/src/chat21-core/providers/firebase/firebase-conversations-handler.ts +2 -1
- package/src/chat21-core/providers/firebase/firebase-upload.service.ts +128 -6
- package/src/chat21-core/providers/mqtt/mqtt-auth-service.ts +1 -1
- package/src/chat21-core/providers/mqtt/mqtt-conversation-handler.ts +1 -1
- package/src/chat21-core/providers/mqtt/mqtt-conversations-handler.ts +10 -1
- package/src/chat21-core/providers/mqtt/mqtt-presence.service.ts +1 -1
- package/src/chat21-core/providers/native/native-upload-service.ts +68 -0
- package/src/chat21-core/utils/constants.ts +15 -1
- package/src/chat21-core/utils/triggerHandler.ts +0 -1
- package/src/chat21-core/utils/utils-message.ts +8 -0
- package/src/chat21-core/utils/utils.ts +0 -39
- package/src/launch.js +0 -1
- package/src/widget-config-template.json +2 -2
- package/src/widget-config.json +2 -1
|
@@ -3,8 +3,8 @@ on:
|
|
|
3
3
|
push:
|
|
4
4
|
branches:
|
|
5
5
|
- master # The default branch
|
|
6
|
-
- branch
|
|
7
|
-
- features
|
|
6
|
+
- (branch|release)-.* # The other branches to be analyzed
|
|
7
|
+
- (features|release)/.*
|
|
8
8
|
pull_request:
|
|
9
9
|
types: [opened, synchronize, reopened]
|
|
10
10
|
jobs:
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# chat21-web-widget ver 5.0
|
|
2
2
|
|
|
3
|
+
### 5.0.71-rc.10
|
|
4
|
+
- bug-fixed: signInWithCustomToken override tiledesk_token key
|
|
5
|
+
|
|
6
|
+
### 5.0.71-rc.9
|
|
7
|
+
- added: brandSrc env property
|
|
8
|
+
|
|
9
|
+
### 5.0.71-rc.8
|
|
10
|
+
- chaged: chatbot-panel.html page UI (added header as style)
|
|
11
|
+
- bug-fixed: drop-zone area wrong height if footer in not visible
|
|
12
|
+
- bug-fixed: set archived conversations as read always
|
|
13
|
+
|
|
14
|
+
### 5.0.71-rc.5
|
|
15
|
+
- bug-fixed: last-message box is visible also if text is empty
|
|
16
|
+
|
|
17
|
+
### 5.0.71-rc.4
|
|
18
|
+
- added: uploadProfile method into upload.service files
|
|
19
|
+
- bug-fixed: if hiddenMessage is present and user restart conversation from header menu, flow does not restart from beginning
|
|
20
|
+
- bug-fixed: do not disable url buttons on carousel element
|
|
21
|
+
- bug-fixed: do not sound if convAdded is fired and on reconnect event
|
|
22
|
+
- bug-fixed: init Rules only if widget is closed
|
|
23
|
+
- removed: 'Powereb By Tiledesk' on conversation and home components only for cahtbot-panel.html page
|
|
24
|
+
|
|
25
|
+
### 5.0.71-rc.3
|
|
26
|
+
- added: delete method for firebase-upload service
|
|
27
|
+
- added: size attribute to metadata object while uploading file
|
|
28
|
+
- bug-fixed: cannot read property of undefined while reading auth() in onOpenCloseWidget method with singleConversation mode active
|
|
29
|
+
|
|
30
|
+
### 5.0.71-rc.2
|
|
31
|
+
- added: hiddenMessage tiledesk property to start a conversation with an hidden info message
|
|
32
|
+
- added: ability to listen from parent message and start a new Conversation with an hidden intentName info message
|
|
33
|
+
- changed: minor UI fix carousel component
|
|
34
|
+
|
|
35
|
+
### 5.0.71-rc.1
|
|
36
|
+
- added: ability to start conversation from an intent hiddenMessage name
|
|
37
|
+
- added: postMessage to notice parent the current message
|
|
38
|
+
- changed: carousel UI if image is not available
|
|
39
|
+
|
|
3
40
|
### 5.0.70 in PROD
|
|
4
41
|
|
|
5
42
|
### 5.0.70-rc.1
|
package/Dockerfile
CHANGED
package/package.json
CHANGED
package/src/app/app.component.ts
CHANGED
|
@@ -140,7 +140,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
140
140
|
const that = this;
|
|
141
141
|
const subChangedConversation = this.conversationsHandlerService.conversationChanged.subscribe((conversation) => {
|
|
142
142
|
// that.ngZone.run(() => {
|
|
143
|
-
|
|
143
|
+
if (conversation) {
|
|
144
144
|
this.onImageLoaded(conversation)
|
|
145
145
|
this.onConversationLoaded(conversation)
|
|
146
146
|
|
|
@@ -148,9 +148,9 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
148
148
|
that.disposeWidget();
|
|
149
149
|
return;
|
|
150
150
|
}
|
|
151
|
-
|
|
151
|
+
|
|
152
152
|
if(conversation.is_new && conversation.sender !== this.g.senderId && !isInfo(conversation)){
|
|
153
|
-
that.manageTabNotification();
|
|
153
|
+
that.manageTabNotification(conversation.sound);
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
if (that.g.isOpen === true) {
|
|
@@ -196,7 +196,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
196
196
|
return;
|
|
197
197
|
}
|
|
198
198
|
if (conversation.is_new) {
|
|
199
|
-
that.manageTabNotification()
|
|
199
|
+
that.manageTabNotification(false)
|
|
200
200
|
// this.soundMessage();
|
|
201
201
|
}
|
|
202
202
|
if(this.g.isOpen === false){
|
|
@@ -421,7 +421,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
421
421
|
that.showWidget();
|
|
422
422
|
}
|
|
423
423
|
|
|
424
|
-
if(this.g.botsRules){
|
|
424
|
+
if(this.g.botsRules && !this.g.isOpen){
|
|
425
425
|
const rules = new Rules(that.tiledeskRequestsService, that.appStorageService,that.g)
|
|
426
426
|
rules.initRules(that.g.windowContext, that.g.tiledeskToken, user, that.generateNewUidConversation(), that.g.botsRules)
|
|
427
427
|
}
|
|
@@ -690,42 +690,6 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
690
690
|
}
|
|
691
691
|
// ========= end:: START UI ============//
|
|
692
692
|
|
|
693
|
-
// private openNewConversation() {
|
|
694
|
-
// this.logger.debug('[APP-COMP] openNewConversation in APP COMPONENT');
|
|
695
|
-
// this.g.newConversationStart = true;
|
|
696
|
-
// // controllo i dipartimenti se sono 1 o 2 seleziono dipartimento e nascondo modale dipartimento
|
|
697
|
-
// // altrimenti mostro modale dipartimenti
|
|
698
|
-
// const preChatForm = this.g.preChatForm;
|
|
699
|
-
// const attributes = this.g.attributes;
|
|
700
|
-
// const departments = this.g.departments;
|
|
701
|
-
// // that.g.wdLog(['departments: ', departments, departments.length);
|
|
702
|
-
// if (preChatForm && (!attributes || !attributes.userFullname || !attributes.userEmail)) {
|
|
703
|
-
// // if (preChatForm && (!attributes.userFullname || !attributes.userEmail)) {
|
|
704
|
-
// this.isOpenConversation = false;
|
|
705
|
-
// this.g.setParameter('isOpenPrechatForm', true);
|
|
706
|
-
// // this.settingsSaverService.setVariable('isOpenPrechatForm', true);
|
|
707
|
-
// this.isOpenSelectionDepartment = false;
|
|
708
|
-
// if (departments && departments.length > 1 && this.g.departmentID == null) {
|
|
709
|
-
// this.isOpenSelectionDepartment = true;
|
|
710
|
-
// }
|
|
711
|
-
// } else {
|
|
712
|
-
// // this.g.isOpenPrechatForm = false;
|
|
713
|
-
// this.g.setParameter('isOpenPrechatForm', false);
|
|
714
|
-
// // this.settingsSaverService.setVariable('isOpenPrechatForm', false);
|
|
715
|
-
// this.isOpenConversation = false;
|
|
716
|
-
// this.isOpenSelectionDepartment = false;
|
|
717
|
-
// if (departments && departments.length > 1 && this.g.departmentID == null) {
|
|
718
|
-
// this.isOpenSelectionDepartment = true;
|
|
719
|
-
// } else {
|
|
720
|
-
// this.isOpenConversation = true;
|
|
721
|
-
// }
|
|
722
|
-
// }
|
|
723
|
-
|
|
724
|
-
// this.logger.debug('[APP-COMP] isOpenPrechatForm', this.g.isOpenPrechatForm, ' isOpenSelectionDepartment:', this.isOpenSelectionDepartment);
|
|
725
|
-
// if (this.g.isOpenPrechatForm === false && this.isOpenSelectionDepartment === false) {
|
|
726
|
-
// this.startNewConversation();
|
|
727
|
-
// }
|
|
728
|
-
// }
|
|
729
693
|
|
|
730
694
|
/**
|
|
731
695
|
* genero un nuovo conversationWith
|
|
@@ -748,6 +712,14 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
748
712
|
this.appStorageService.setItem('recipientId', newConvId)
|
|
749
713
|
this.logger.debug('[APP-COMP] recipientId: ', this.g.recipientId);
|
|
750
714
|
this.isConversationArchived = false;
|
|
715
|
+
|
|
716
|
+
/** allow to start conversation with an hidden message (without publishing 'new_conversation' event) */
|
|
717
|
+
this.logger.debug('[APP-COMP] AppComponent::startNewConversation hiddenMessage',this.g.hiddenMessage );
|
|
718
|
+
if(this.g.hiddenMessage){
|
|
719
|
+
this.onNewConversationWithMessage(this.g.hiddenMessage)
|
|
720
|
+
return;
|
|
721
|
+
}
|
|
722
|
+
|
|
751
723
|
this.triggerNewConversationEvent(newConvId);
|
|
752
724
|
}
|
|
753
725
|
|
|
@@ -781,9 +753,12 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
781
753
|
if (this.g.windowContext.window.location) {
|
|
782
754
|
attributes['sourcePage'] = this.g.windowContext.window.location.href;
|
|
783
755
|
}
|
|
784
|
-
if(this.g.windowContext.window.document){
|
|
756
|
+
if(this.g.windowContext.window.document) {
|
|
785
757
|
attributes['sourceTitle'] = this.g.windowContext.window.document.title;
|
|
786
758
|
}
|
|
759
|
+
// if(this.g.windowContext.window.document && this.g.windowContext.window.document.cookie) {
|
|
760
|
+
// attributes['cookie'] = this.g.windowContext.window.document.cookie;
|
|
761
|
+
// }
|
|
787
762
|
if (projectid) {
|
|
788
763
|
attributes['projectId'] = projectid;
|
|
789
764
|
}
|
|
@@ -936,7 +911,6 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
936
911
|
}).then((res)=> { this.showWidget() });
|
|
937
912
|
return;
|
|
938
913
|
}
|
|
939
|
-
|
|
940
914
|
this.conversationsHandlerService.getLastConversation((conv, error)=> {
|
|
941
915
|
this.logger.debug('[APP-COMP] getConverationRESTApi: conversation from rest API --> ', conv)
|
|
942
916
|
if(error){
|
|
@@ -1409,9 +1383,9 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
1409
1383
|
};
|
|
1410
1384
|
|
|
1411
1385
|
/** set state reinit */
|
|
1412
|
-
windowContext['tiledesk'].startConversation = function () {
|
|
1386
|
+
windowContext['tiledesk'].startConversation = function (text: string) {
|
|
1413
1387
|
ngZone.run(() => {
|
|
1414
|
-
windowContext['tiledesk']['angularcomponent'].component.onNewConversation();
|
|
1388
|
+
windowContext['tiledesk']['angularcomponent'].component.onNewConversation(text);
|
|
1415
1389
|
});
|
|
1416
1390
|
};
|
|
1417
1391
|
|
|
@@ -1499,7 +1473,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
1499
1473
|
}
|
|
1500
1474
|
}
|
|
1501
1475
|
|
|
1502
|
-
private manageTabNotification() {
|
|
1476
|
+
private manageTabNotification(canSound: boolean) {
|
|
1503
1477
|
if (!this.isTabVisible) {
|
|
1504
1478
|
// TAB IS HIDDEN --> manage title and SOUND
|
|
1505
1479
|
// this.g.windowContext.parent.title = "HIDDEN"
|
|
@@ -1519,7 +1493,8 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
1519
1493
|
}
|
|
1520
1494
|
}, 1000);
|
|
1521
1495
|
}
|
|
1522
|
-
|
|
1496
|
+
if(canSound)
|
|
1497
|
+
this.soundMessage()
|
|
1523
1498
|
}
|
|
1524
1499
|
|
|
1525
1500
|
|
|
@@ -1578,7 +1553,8 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
1578
1553
|
if(this.g.singleConversation){
|
|
1579
1554
|
this.isOpenHome = false;
|
|
1580
1555
|
this.g.setParameter('isOpenPrechatForm', false)
|
|
1581
|
-
this.
|
|
1556
|
+
this.initConversationsHandler(this.g.tenant, this.g.senderId)
|
|
1557
|
+
// this.manageWidgetSingleConversation()
|
|
1582
1558
|
} else if (this.g.startFromHome) {
|
|
1583
1559
|
this.isOpenHome = true;
|
|
1584
1560
|
this.isOpenConversation = false;
|
|
@@ -1741,8 +1717,9 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
1741
1717
|
* carico conversazione - stack 1
|
|
1742
1718
|
* home - stack 0
|
|
1743
1719
|
*/
|
|
1744
|
-
onNewConversation() {
|
|
1720
|
+
onNewConversation(text?: string) {
|
|
1745
1721
|
this.logger.debug('[APP-COMP] returnNewConversation in APP COMPONENT');
|
|
1722
|
+
if(text) this.g.setParameter('hiddenMessage', text);
|
|
1746
1723
|
this.g.newConversationStart = true;
|
|
1747
1724
|
// controllo i dipartimenti se sono 1 o 2 seleziono dipartimento e nascondo modale dipartimento
|
|
1748
1725
|
// altrimenti mostro modale dipartimenti
|
|
@@ -1779,6 +1756,28 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
1779
1756
|
}
|
|
1780
1757
|
}
|
|
1781
1758
|
|
|
1759
|
+
|
|
1760
|
+
onNewConversationWithMessage(text: string, subType: string = 'info'){
|
|
1761
|
+
this.logger.log('[APP-COMP] onNewConversationWithMessage in APP COMPONENT', text);
|
|
1762
|
+
|
|
1763
|
+
const newConvId = this.generateNewUidConversation();
|
|
1764
|
+
this.g.setParameter('recipientId', newConvId);
|
|
1765
|
+
this.appStorageService.setItem('recipientId', newConvId)
|
|
1766
|
+
|
|
1767
|
+
let message: any = {}
|
|
1768
|
+
message.attributes = { subtype: subType, ...this.g.attributes}
|
|
1769
|
+
message.userAgent = this.g.attributes['client']
|
|
1770
|
+
message.request_id = newConvId
|
|
1771
|
+
message.sourcePage = this.g.attributes['sourcePage']
|
|
1772
|
+
message.language = this.g.lang
|
|
1773
|
+
message.text = '/'+ text
|
|
1774
|
+
message.participants = this.g.participants
|
|
1775
|
+
message.departmentid = this.g.attributes.departmentId
|
|
1776
|
+
// this.sendMessage(message)
|
|
1777
|
+
this.tiledeskRequestsService.sendMessageToRequest(newConvId, this.g.tiledeskToken, message)
|
|
1778
|
+
return;
|
|
1779
|
+
}
|
|
1780
|
+
|
|
1782
1781
|
/**
|
|
1783
1782
|
* MODAL HOME:
|
|
1784
1783
|
* open all-conversation
|
|
@@ -1845,6 +1844,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
1845
1844
|
*/
|
|
1846
1845
|
onNewConversationButtonClicked(event){
|
|
1847
1846
|
this.logger.debug('[APP-COMP] onNewConversationButtonClicked');
|
|
1847
|
+
this.g.setParameter('hiddenMessage', null)
|
|
1848
1848
|
|
|
1849
1849
|
this.isOpenConversation = false;
|
|
1850
1850
|
this.g.singleConversation? this.isOpenHome = false: null;
|
|
@@ -37,9 +37,10 @@
|
|
|
37
37
|
(onMenuOptionShow)="onMenuOption($event)">
|
|
38
38
|
</chat-conversation-header>
|
|
39
39
|
|
|
40
|
-
<div id="dropZone_container" *ngIf="isHovering"
|
|
40
|
+
<div id="dropZone_container" *ngIf="isHovering"
|
|
41
|
+
[class.hideTextReply]="hideFooterTextReply && g?.poweredBy">
|
|
41
42
|
<div class="drop">
|
|
42
|
-
drop zone
|
|
43
|
+
<!-- drop zone -->
|
|
43
44
|
</div>
|
|
44
45
|
</div>
|
|
45
46
|
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
--foregroundColor: var(--col-msg-sent);
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
:host chat-conversation-content.hideTextReply ::ng-deep .chat21-sheet-content
|
|
12
|
+
:host chat-conversation-content.hideTextReply ::ng-deep .chat21-sheet-content,
|
|
13
|
+
:host #dropZone_container.hideTextReply{
|
|
13
14
|
|
|
14
15
|
bottom: var(--chat-footer-height) !important
|
|
15
16
|
}
|
|
@@ -143,7 +144,7 @@
|
|
|
143
144
|
#dropZone_container{
|
|
144
145
|
position: absolute;
|
|
145
146
|
top: 52px;
|
|
146
|
-
bottom:
|
|
147
|
+
bottom: calc(var(--chat-footer-logo-height) + var(--chat-footer-height));
|
|
147
148
|
left: 0;
|
|
148
149
|
right: 0;
|
|
149
150
|
background-color: rgba(240,248,255,0.6);
|
|
@@ -16,7 +16,6 @@ import {
|
|
|
16
16
|
import { MessageModel } from 'src/chat21-core/models/message';
|
|
17
17
|
|
|
18
18
|
// utils
|
|
19
|
-
import { isPopupUrl } from 'src/app/utils/utils';
|
|
20
19
|
import { v4 as uuidv4 } from 'uuid';
|
|
21
20
|
|
|
22
21
|
|
|
@@ -41,7 +40,7 @@ import { CustomTranslateService } from 'src/chat21-core/providers/custom-transla
|
|
|
41
40
|
import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
|
|
42
41
|
import { TiledeskRequestsService } from 'src/chat21-core/providers/tiledesk/tiledesk-requests.service';
|
|
43
42
|
import { LIVE_PAGE } from 'src/chat21-core/utils/constants';
|
|
44
|
-
import { getDateDifference
|
|
43
|
+
import { getDateDifference } from 'src/chat21-core/utils/utils';
|
|
45
44
|
import { isJustRecived, isUserBanned } from 'src/chat21-core/utils/utils-message';
|
|
46
45
|
import { AppComponent } from '../../../app.component';
|
|
47
46
|
import { ConversationContentComponent } from '../conversation-content/conversation-content.component';
|
|
@@ -113,11 +112,6 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
|
|
|
113
112
|
isOpenAttachmentPreview: Boolean = false;
|
|
114
113
|
attachments: Array<{ file: Array<any>, metadata: {}}>
|
|
115
114
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
isPopupUrl = isPopupUrl;
|
|
119
|
-
popupUrl = popupUrl;
|
|
120
|
-
|
|
121
115
|
// availableAgentsStatus = false; // indica quando è impostato lo stato degli agenti nel subscribe
|
|
122
116
|
messages: Array<MessageModel> = [];
|
|
123
117
|
|
|
@@ -504,7 +498,8 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
|
|
|
504
498
|
'',
|
|
505
499
|
'',
|
|
506
500
|
false,
|
|
507
|
-
'text'
|
|
501
|
+
'text',
|
|
502
|
+
false)
|
|
508
503
|
}
|
|
509
504
|
}
|
|
510
505
|
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
<!-- [ngClass]="{'slide-in-left': !isFirstMessage(message?.sender, i)}" -->
|
|
64
64
|
<chat-bubble-message class="messages msg_receive"
|
|
65
65
|
[ngClass]="{'slide-in-left': false}"
|
|
66
|
-
[class.no-background]="(isImage(message) || isFrame(message)) && ((message?.text && message?.text.trim() === '') || !message?.text)"
|
|
66
|
+
[class.no-background]="(isImage(message) || isFrame(message) || isCarousel(message)) && ((message?.text && message?.text.trim() === '') || !message?.text)"
|
|
67
67
|
[class.emoticon]="isEmojii(message?.text)"
|
|
68
68
|
[style.margin-left]="isSameSender(message?.sender, i)? '50px': null"
|
|
69
69
|
[ngStyle]="{'background': stylesMap.get('bubbleReceivedBackground'), 'color': stylesMap.get('bubbleReceivedTextColor')}"
|
|
@@ -109,8 +109,7 @@
|
|
|
109
109
|
</div>
|
|
110
110
|
|
|
111
111
|
<!-- carousel -->
|
|
112
|
-
<div *ngIf="message
|
|
113
|
-
&& message?.attributes?.attachment?.gallery" [ngClass]="{'slide-in-left': false}" class="carousel_container">
|
|
112
|
+
<div *ngIf="isCarousel(message)" [ngClass]="{'slide-in-left': false}" class="carousel_container">
|
|
114
113
|
<chat-carousel class="carousel_container"
|
|
115
114
|
[message]="message"
|
|
116
115
|
[isConversationArchived]="isConversationArchived"
|
package/src/app/component/conversation-detail/conversation-content/conversation-content.component.ts
CHANGED
|
@@ -5,8 +5,7 @@ import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service
|
|
|
5
5
|
import { UploadService } from 'src/chat21-core/providers/abstract/upload.service';
|
|
6
6
|
import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
|
|
7
7
|
import { MESSAGE_TYPE_INFO, MESSAGE_TYPE_MINE, MESSAGE_TYPE_OTHERS } from 'src/chat21-core/utils/constants';
|
|
8
|
-
import {
|
|
9
|
-
import { isEmojii, isFirstMessage, isFrame, isImage, isInfo, isLastMessage, isMine, isSameSender, messageType } from 'src/chat21-core/utils/utils-message';
|
|
8
|
+
import { isCarousel, isEmojii, isFirstMessage, isFrame, isImage, isInfo, isLastMessage, isMine, isSameSender, messageType } from 'src/chat21-core/utils/utils-message';
|
|
10
9
|
|
|
11
10
|
@Component({
|
|
12
11
|
selector: 'chat-conversation-content',
|
|
@@ -43,8 +42,7 @@ export class ConversationContentComponent implements OnInit {
|
|
|
43
42
|
// ========= end:: gestione scroll view messaggi ======= //
|
|
44
43
|
|
|
45
44
|
// ========= begin:: dichiarazione funzioni ======= //
|
|
46
|
-
|
|
47
|
-
popupUrl = popupUrl;
|
|
45
|
+
isCarousel = isCarousel;
|
|
48
46
|
// ========= end:: dichiarazione funzioni ======= //
|
|
49
47
|
|
|
50
48
|
// ========== begin:: set icon status message ======= //
|
package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.ts
CHANGED
|
@@ -131,6 +131,7 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
131
131
|
if (event.target.files && event.target.files[0]) {
|
|
132
132
|
const nameFile = event.target.files[0].name;
|
|
133
133
|
const typeFile = event.target.files[0].type;
|
|
134
|
+
const size = event.target.files[0].size
|
|
134
135
|
const reader = new FileReader();
|
|
135
136
|
that.logger.debug('[CONV-FOOTER] OK preload: ', nameFile, typeFile, reader);
|
|
136
137
|
reader.addEventListener('load', function () {
|
|
@@ -146,7 +147,7 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
146
147
|
that.logger.debug('[CONV-FOOTER] onload image');
|
|
147
148
|
// that.arrayFilesLoad.push(imageXLoad);
|
|
148
149
|
const uid = (new Date().getTime()).toString(36); // imageXLoad.src.substring(imageXLoad.src.length - 16);
|
|
149
|
-
that.arrayFilesLoad[0] = { uid: uid, file: imageXLoad, type: typeFile };
|
|
150
|
+
that.arrayFilesLoad[0] = { uid: uid, file: imageXLoad, type: typeFile, size: size };
|
|
150
151
|
that.logger.debug('[CONV-FOOTER] OK: ', that.arrayFilesLoad[0]);
|
|
151
152
|
// SEND MESSAGE
|
|
152
153
|
that.loadFile();
|
|
@@ -159,7 +160,7 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
159
160
|
};
|
|
160
161
|
// that.arrayFilesLoad.push(imageXLoad);
|
|
161
162
|
const uid = (new Date().getTime()).toString(36); // imageXLoad.src.substring(imageXLoad.src.length - 16);
|
|
162
|
-
that.arrayFilesLoad[0] = { uid: uid, file: fileXLoad, type: typeFile };
|
|
163
|
+
that.arrayFilesLoad[0] = { uid: uid, file: fileXLoad, type: typeFile, size: size };
|
|
163
164
|
that.logger.debug('[CONV-FOOTER] OK: ', that.arrayFilesLoad[0]);
|
|
164
165
|
// SEND MESSAGE
|
|
165
166
|
that.loadFile();
|
|
@@ -182,6 +183,7 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
182
183
|
const fileXLoad = this.arrayFilesLoad[0].file;
|
|
183
184
|
const uid = this.arrayFilesLoad[0].uid;
|
|
184
185
|
const type = this.arrayFilesLoad[0].type;
|
|
186
|
+
const size = this.arrayFilesLoad[0].size
|
|
185
187
|
this.logger.debug('[CONV-FOOTER] that.fileXLoad: ', type);
|
|
186
188
|
let metadata;
|
|
187
189
|
if (type.startsWith('image') && !type.includes('svg')) {
|
|
@@ -191,14 +193,16 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
191
193
|
'width': fileXLoad.width,
|
|
192
194
|
'height': fileXLoad.height,
|
|
193
195
|
'type': type,
|
|
194
|
-
'uid': uid
|
|
196
|
+
'uid': uid,
|
|
197
|
+
'size': size
|
|
195
198
|
};
|
|
196
199
|
} else {
|
|
197
200
|
metadata = {
|
|
198
201
|
'name': fileXLoad.title,
|
|
199
202
|
'src': fileXLoad.src,
|
|
200
203
|
'type': type,
|
|
201
|
-
'uid': uid
|
|
204
|
+
'uid': uid,
|
|
205
|
+
'size': size
|
|
202
206
|
};
|
|
203
207
|
}
|
|
204
208
|
this.logger.debug('[CONV-FOOTER] metadata -------> ', metadata);
|
|
@@ -8,9 +8,13 @@
|
|
|
8
8
|
<!-- <div class="card" style="width: 17px;"></div> -->
|
|
9
9
|
<div class="card" *ngFor="let card of gallery; let i = index">
|
|
10
10
|
<div [style.opacity]="i+1 === activeElement? 1: 0.5">
|
|
11
|
-
<div class="card-image">
|
|
11
|
+
<div class="card-image" *ngIf="card?.preview?.src !== ''">
|
|
12
12
|
<img [src]="card?.preview?.src" alt="img" draggable="false">
|
|
13
13
|
</div>
|
|
14
|
+
<div class="card-image card-image-placeholder" *ngIf="card?.preview?.src == ''">
|
|
15
|
+
<img src="assets/images/icons/no-image.svg" alt="img" draggable="false">
|
|
16
|
+
<span>Image not available</span>
|
|
17
|
+
</div>
|
|
14
18
|
<div class="card-content">
|
|
15
19
|
<div class="card-title">{{card?.title}}</div>
|
|
16
20
|
<div class="card-description">{{card?.description}}</div>
|
|
@@ -18,7 +22,7 @@
|
|
|
18
22
|
<div class="buttons" *ngIf="card?.buttons && card?.buttons.length > 0">
|
|
19
23
|
<div *ngFor="let button of card?.buttons"
|
|
20
24
|
class="single-button action"
|
|
21
|
-
[ngClass]="{'disabled': (isConversationArchived ||
|
|
25
|
+
[ngClass]="{'disabled': (isConversationArchived || button.type !== TYPE_BUTTON.URL), 'active': button?.active}"
|
|
22
26
|
(click)="actionButtonClick($event, button, i)" >
|
|
23
27
|
{{button.value}}
|
|
24
28
|
</div>
|
|
@@ -100,6 +100,26 @@
|
|
|
100
100
|
.carousel .card .card-image {
|
|
101
101
|
height: 150px;
|
|
102
102
|
width: var(--cardWidth);
|
|
103
|
+
border-radius: 8px 8px 0px 0px;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.carousel .card .card-image-placeholder{
|
|
107
|
+
display: flex;
|
|
108
|
+
flex-direction: column;
|
|
109
|
+
justify-content: center;
|
|
110
|
+
gap: 10px;
|
|
111
|
+
background: #c1b9b952;
|
|
112
|
+
align-items: center;
|
|
113
|
+
|
|
114
|
+
img{
|
|
115
|
+
width: 30px;
|
|
116
|
+
height: 30px;
|
|
117
|
+
filter: brightness(0) saturate(100%) invert(44%) sepia(8%) saturate(449%) hue-rotate(190deg) brightness(94%) contrast(93%);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
span{
|
|
121
|
+
font-size: 0.8rem;
|
|
122
|
+
}
|
|
103
123
|
}
|
|
104
124
|
.card .card-image img {
|
|
105
125
|
height: 100%;
|
|
@@ -109,7 +129,9 @@
|
|
|
109
129
|
background: transparent!important;
|
|
110
130
|
display: block;
|
|
111
131
|
max-width: 100% !important;
|
|
132
|
+
width: 100%;
|
|
112
133
|
border-radius: 8px 8px 0px 0px;
|
|
134
|
+
|
|
113
135
|
}
|
|
114
136
|
.carousel .card .card-content {
|
|
115
137
|
// font-weight: 500;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Component, ElementRef, EventEmitter, Input, OnInit, Output, SimpleChange, SimpleChanges, ViewChildren } from '@angular/core';
|
|
2
2
|
import { MessageModel } from 'src/chat21-core/models/message';
|
|
3
|
+
import { TYPE_BUTTON } from 'src/chat21-core/utils/constants';
|
|
4
|
+
import { isCarousel } from 'src/chat21-core/utils/utils-message';
|
|
3
5
|
|
|
4
6
|
@Component({
|
|
5
7
|
selector: 'chat-carousel',
|
|
@@ -30,11 +32,11 @@ export class CarouselComponent implements OnInit{
|
|
|
30
32
|
hoverTextColor: string;
|
|
31
33
|
type: string;
|
|
32
34
|
button: any;
|
|
33
|
-
|
|
35
|
+
TYPE_BUTTON = TYPE_BUTTON;
|
|
34
36
|
constructor(private elementRef: ElementRef) { }
|
|
35
37
|
|
|
36
38
|
ngOnInit() {
|
|
37
|
-
console.log('[CAROUSEL-MESSAGE] hello', this.message)
|
|
39
|
+
console.log('[CAROUSEL-MESSAGE] hello', this.message, isCarousel(this.message))
|
|
38
40
|
|
|
39
41
|
|
|
40
42
|
this.wrapper = this.elementRef.nativeElement.querySelector('.wrapper')
|
|
@@ -76,7 +78,7 @@ export class CarouselComponent implements OnInit{
|
|
|
76
78
|
ngOnChanges(changes: SimpleChanges){
|
|
77
79
|
if(this.message && this.message.attributes && this.message.attributes?.attachment && this.message.attributes?.attachment?.gallery){
|
|
78
80
|
this.gallery = this.message.attributes.attachment.gallery
|
|
79
|
-
console.log('carrrrrrrrr', this.wrapper, this.elementRef.nativeElement.querySelector(".card"))
|
|
81
|
+
// console.log('carrrrrrrrr', this.wrapper, this.elementRef.nativeElement.querySelector(".card"))
|
|
80
82
|
// this.firstCardWidth = (this.elementRef.nativeElement.querySelector(".card") as HTMLElement).offsetWidth
|
|
81
83
|
}
|
|
82
84
|
|
|
@@ -95,7 +97,7 @@ export class CarouselComponent implements OnInit{
|
|
|
95
97
|
let gap = 17
|
|
96
98
|
let cardPerView = Math.round(this.carousel.offsetWidth / width);
|
|
97
99
|
|
|
98
|
-
console.log('go to -->', direction, width, this.firstCardWidth, cardPerView, this.carousel.offsetWidth)
|
|
100
|
+
// console.log('go to -->', direction, width, this.firstCardWidth, cardPerView, this.carousel.offsetWidth)
|
|
99
101
|
|
|
100
102
|
// this.carousel.scrollLeft += direction == "previous" ? -(width+gap) : width+gap;
|
|
101
103
|
this.carousel.scrollLeft += direction == "previous" ? -width : width;
|
|
@@ -110,7 +112,6 @@ export class CarouselComponent implements OnInit{
|
|
|
110
112
|
actionButtonClick(ev, button, index){
|
|
111
113
|
this.button = button
|
|
112
114
|
this.type = button.type
|
|
113
|
-
console.log('buttonnnnnnn', ev, button)
|
|
114
115
|
if ( button && ((button.action && button.action !== '') || (button.link && button.link !== '') || button.text !== '' )) {
|
|
115
116
|
|
|
116
117
|
//set clicked button as the active one
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
|
2
2
|
import { saveAs } from 'file-saver';
|
|
3
|
-
import { popupUrl } from 'src/chat21-core/utils/utils';
|
|
4
3
|
|
|
5
4
|
@Component({
|
|
6
5
|
selector: 'chat-image',
|
|
@@ -16,9 +15,7 @@ export class ImageComponent implements OnInit {
|
|
|
16
15
|
|
|
17
16
|
loading: boolean = true
|
|
18
17
|
tooltipMessage: string;
|
|
19
|
-
|
|
20
18
|
|
|
21
|
-
popupUrl = popupUrl;
|
|
22
19
|
|
|
23
20
|
constructor() { }
|
|
24
21
|
|
|
@@ -1774,6 +1774,11 @@ export class GlobalSettingsService {
|
|
|
1774
1774
|
if (TEMP) {
|
|
1775
1775
|
globals.disconnetTime = stringToNumber(TEMP);
|
|
1776
1776
|
}
|
|
1777
|
+
|
|
1778
|
+
TEMP = getParameterByName(windowContext, 'tiledesk_hiddenMessage');
|
|
1779
|
+
if (TEMP) {
|
|
1780
|
+
globals.hiddenMessage = TEMP;
|
|
1781
|
+
}
|
|
1777
1782
|
|
|
1778
1783
|
}
|
|
1779
1784
|
|
|
@@ -65,8 +65,6 @@ export const FIREBASESTORAGE_BASE_URL_IMAGE = 'https://firebasestorage.googleapi
|
|
|
65
65
|
export const IMG_PROFILE_BOT = '/assets/images/avatar_bot_tiledesk.svg';
|
|
66
66
|
export const IMG_PROFILE_DEFAULT = '/assets/images/avatar_male_tiledesk.svg';
|
|
67
67
|
|
|
68
|
-
// localstorage
|
|
69
|
-
export const STORAGE_PREFIX = 'widget_';
|
|
70
68
|
|
|
71
69
|
// start conversation bot (proxy)
|
|
72
70
|
export const PROXY_MSG_START = '__start';
|