@chat21/chat21-web-widget 5.0.71-rc.1 → 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 +32 -0
- package/Dockerfile +1 -1
- package/package.json +1 -1
- package/src/app/app.component.ts +41 -63
- 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 +1 -7
- 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 +1 -1
- package/src/app/component/message/carousel/carousel.component.scss +1 -0
- package/src/app/component/message/carousel/carousel.component.ts +5 -4
- 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/js/chat21client.js +1 -1
- package/src/assets/twp/chatbot-panel.html +205 -11
- package/src/assets/twp/index-dev.html +56 -17
- package/src/assets/twp/index.html +110 -37
- 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 +7 -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,37 @@
|
|
|
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
|
+
|
|
3
35
|
### 5.0.71-rc.1
|
|
4
36
|
- added: ability to start conversation from an intent hiddenMessage name
|
|
5
37
|
- added: postMessage to notice parent the current message
|
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
|
|
@@ -749,21 +713,10 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
749
713
|
this.logger.debug('[APP-COMP] recipientId: ', this.g.recipientId);
|
|
750
714
|
this.isConversationArchived = false;
|
|
751
715
|
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
this.
|
|
756
|
-
let message: any = {}
|
|
757
|
-
message.attributes = { subtype: 'info', ...this.g.attributes}
|
|
758
|
-
message.userAgent = this.g.attributes['client']
|
|
759
|
-
message.request_id = newConvId
|
|
760
|
-
message.sourcePage = this.g.attributes['sourcePage']
|
|
761
|
-
message.language = this.g.lang
|
|
762
|
-
message.text = '/'+ hiddenMessage
|
|
763
|
-
message.participants = [ participant ]
|
|
764
|
-
message.departmentid = this.g.attributes.departmentId
|
|
765
|
-
// this.sendMessage(message)
|
|
766
|
-
this.tiledeskRequestsService.sendMessageToRequest(newConvId, this.g.tiledeskToken, message)
|
|
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)
|
|
767
720
|
return;
|
|
768
721
|
}
|
|
769
722
|
|
|
@@ -958,7 +911,6 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
958
911
|
}).then((res)=> { this.showWidget() });
|
|
959
912
|
return;
|
|
960
913
|
}
|
|
961
|
-
|
|
962
914
|
this.conversationsHandlerService.getLastConversation((conv, error)=> {
|
|
963
915
|
this.logger.debug('[APP-COMP] getConverationRESTApi: conversation from rest API --> ', conv)
|
|
964
916
|
if(error){
|
|
@@ -1431,9 +1383,9 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
1431
1383
|
};
|
|
1432
1384
|
|
|
1433
1385
|
/** set state reinit */
|
|
1434
|
-
windowContext['tiledesk'].startConversation = function () {
|
|
1386
|
+
windowContext['tiledesk'].startConversation = function (text: string) {
|
|
1435
1387
|
ngZone.run(() => {
|
|
1436
|
-
windowContext['tiledesk']['angularcomponent'].component.onNewConversation();
|
|
1388
|
+
windowContext['tiledesk']['angularcomponent'].component.onNewConversation(text);
|
|
1437
1389
|
});
|
|
1438
1390
|
};
|
|
1439
1391
|
|
|
@@ -1521,7 +1473,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
1521
1473
|
}
|
|
1522
1474
|
}
|
|
1523
1475
|
|
|
1524
|
-
private manageTabNotification() {
|
|
1476
|
+
private manageTabNotification(canSound: boolean) {
|
|
1525
1477
|
if (!this.isTabVisible) {
|
|
1526
1478
|
// TAB IS HIDDEN --> manage title and SOUND
|
|
1527
1479
|
// this.g.windowContext.parent.title = "HIDDEN"
|
|
@@ -1541,7 +1493,8 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
1541
1493
|
}
|
|
1542
1494
|
}, 1000);
|
|
1543
1495
|
}
|
|
1544
|
-
|
|
1496
|
+
if(canSound)
|
|
1497
|
+
this.soundMessage()
|
|
1545
1498
|
}
|
|
1546
1499
|
|
|
1547
1500
|
|
|
@@ -1600,7 +1553,8 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
1600
1553
|
if(this.g.singleConversation){
|
|
1601
1554
|
this.isOpenHome = false;
|
|
1602
1555
|
this.g.setParameter('isOpenPrechatForm', false)
|
|
1603
|
-
this.
|
|
1556
|
+
this.initConversationsHandler(this.g.tenant, this.g.senderId)
|
|
1557
|
+
// this.manageWidgetSingleConversation()
|
|
1604
1558
|
} else if (this.g.startFromHome) {
|
|
1605
1559
|
this.isOpenHome = true;
|
|
1606
1560
|
this.isOpenConversation = false;
|
|
@@ -1763,8 +1717,9 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
1763
1717
|
* carico conversazione - stack 1
|
|
1764
1718
|
* home - stack 0
|
|
1765
1719
|
*/
|
|
1766
|
-
onNewConversation() {
|
|
1720
|
+
onNewConversation(text?: string) {
|
|
1767
1721
|
this.logger.debug('[APP-COMP] returnNewConversation in APP COMPONENT');
|
|
1722
|
+
if(text) this.g.setParameter('hiddenMessage', text);
|
|
1768
1723
|
this.g.newConversationStart = true;
|
|
1769
1724
|
// controllo i dipartimenti se sono 1 o 2 seleziono dipartimento e nascondo modale dipartimento
|
|
1770
1725
|
// altrimenti mostro modale dipartimenti
|
|
@@ -1801,6 +1756,28 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
1801
1756
|
}
|
|
1802
1757
|
}
|
|
1803
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
|
+
|
|
1804
1781
|
/**
|
|
1805
1782
|
* MODAL HOME:
|
|
1806
1783
|
* open all-conversation
|
|
@@ -1867,6 +1844,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
1867
1844
|
*/
|
|
1868
1845
|
onNewConversationButtonClicked(event){
|
|
1869
1846
|
this.logger.debug('[APP-COMP] onNewConversationButtonClicked');
|
|
1847
|
+
this.g.setParameter('hiddenMessage', null)
|
|
1870
1848
|
|
|
1871
1849
|
this.isOpenConversation = false;
|
|
1872
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
|
|
|
@@ -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);
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
<div class="buttons" *ngIf="card?.buttons && card?.buttons.length > 0">
|
|
23
23
|
<div *ngFor="let button of card?.buttons"
|
|
24
24
|
class="single-button action"
|
|
25
|
-
[ngClass]="{'disabled': (isConversationArchived ||
|
|
25
|
+
[ngClass]="{'disabled': (isConversationArchived || button.type !== TYPE_BUTTON.URL), 'active': button?.active}"
|
|
26
26
|
(click)="actionButtonClick($event, button, i)" >
|
|
27
27
|
{{button.value}}
|
|
28
28
|
</div>
|
|
@@ -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')
|
|
@@ -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';
|
package/src/app/utils/globals.ts
CHANGED
|
@@ -123,7 +123,6 @@ export class Globals {
|
|
|
123
123
|
LABEL_PREVIEW: string;
|
|
124
124
|
|
|
125
125
|
// ============ BEGIN: EXTERNAL PARAMETERS ==============//
|
|
126
|
-
globalsParameters: any;
|
|
127
126
|
autoStart: boolean;
|
|
128
127
|
startHidden: boolean;
|
|
129
128
|
isShown: boolean;
|
|
@@ -218,6 +217,8 @@ export class Globals {
|
|
|
218
217
|
onPageChangeVisibilityDesktop: 'open' | 'close' | 'last'; // ******* new ********
|
|
219
218
|
displayOnMobile: boolean; // ******* new ********
|
|
220
219
|
displayOnDesktop: boolean; // ******* new ********
|
|
220
|
+
|
|
221
|
+
hiddenMessage: string; // ******* new ********
|
|
221
222
|
constructor(
|
|
222
223
|
) { }
|
|
223
224
|
|
|
@@ -226,7 +227,6 @@ export class Globals {
|
|
|
226
227
|
* 1: initParameters
|
|
227
228
|
*/
|
|
228
229
|
initDefafultParameters() {
|
|
229
|
-
this.globalsParameters = {};
|
|
230
230
|
|
|
231
231
|
let wContext: any = window;
|
|
232
232
|
if (window.frameElement && window.frameElement.getAttribute('tiledesk_context') === 'parent') {
|
|
@@ -414,6 +414,8 @@ export class Globals {
|
|
|
414
414
|
this.displayOnMobile = true
|
|
415
415
|
this.onPageChangeVisibilityMobile = 'close'
|
|
416
416
|
|
|
417
|
+
/**set an hidden message to show when conversation starts */
|
|
418
|
+
this.hiddenMessage = null
|
|
417
419
|
|
|
418
420
|
// ============ END: SET EXTERNAL PARAMETERS ==============//
|
|
419
421
|
|
|
@@ -468,7 +470,6 @@ export class Globals {
|
|
|
468
470
|
|
|
469
471
|
this.newConversationStart = true;
|
|
470
472
|
|
|
471
|
-
|
|
472
473
|
}
|
|
473
474
|
|
|
474
475
|
|
package/src/app/utils/rules.ts
CHANGED
|
@@ -546,7 +546,7 @@ class Chat21Client {
|
|
|
546
546
|
if (this.log) {
|
|
547
547
|
console.log("this.on_message_handler already subscribed. Reconnected num", this.reconnections)
|
|
548
548
|
}
|
|
549
|
-
|
|
549
|
+
subscribedCallback();
|
|
550
550
|
return
|
|
551
551
|
}
|
|
552
552
|
this.subscribeToMyConversations(() => {
|