@chat21/chat21-ionic 3.0.71-rc.1 → 3.0.72
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 +8 -0
- package/deploy_amazon_prod.sh +2 -2
- package/package.json +1 -1
- package/src/app/chatlib/conversation-detail/message/info-message/info-message.component.ts +11 -0
- package/src/app/components/contacts-directory/contacts-directory.component.html +6 -0
- package/src/app/components/contacts-directory/contacts-directory.component.scss +9 -0
- package/src/app/components/contacts-directory/contacts-directory.component.ts +6 -1
- package/src/app/components/conversation-detail/option-header/option-header.component.ts +1 -0
- package/src/app/components/conversation-info/info-group/info-group.component.ts +1 -4
- package/src/app/components/utils/presence/presence.component.html +2 -0
- package/src/app/components/utils/presence/presence.component.scss +24 -0
- package/src/app/components/utils/presence/presence.component.spec.ts +24 -0
- package/src/app/components/utils/presence/presence.component.ts +22 -0
- package/src/app/pages/contacts-directory/contacts-directory.module.ts +4 -3
- package/src/app/pages/conversation-detail/conversation-detail.page.ts +1 -1
- package/src/app/shared/shared.module.ts +2 -1
- package/src/chat21-core/utils/utils-message.ts +45 -28
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
# chat21-ionic ver 3.0
|
|
2
2
|
|
|
3
|
+
### 3.0.72 in PROD
|
|
4
|
+
|
|
5
|
+
### 3.0.72-rc.1
|
|
6
|
+
- added: user presence on contact-directory component
|
|
7
|
+
|
|
8
|
+
### 3.0.71 in PROD
|
|
9
|
+
|
|
3
10
|
### 3.0.71-rc.1
|
|
4
11
|
- changed: native downloadURL on new file uploaded
|
|
5
12
|
- added: update lead info in conversation-detail and conversation-header when agent updates
|
|
6
13
|
- added: private message UI when agent receive a private message from other agents
|
|
14
|
+
- removed: scroll-bar from conversation-list page
|
|
7
15
|
|
|
8
16
|
### 3.0.70 in PROD
|
|
9
17
|
|
package/deploy_amazon_prod.sh
CHANGED
|
@@ -26,5 +26,5 @@ cd ../../../
|
|
|
26
26
|
# aws cloudfront create-invalidation --distribution-id E36UIP90GOSFPM --paths "/*"
|
|
27
27
|
|
|
28
28
|
# echo new version deployed on s3://tiledesk-dashboard/chat/$NEW_BUILD/
|
|
29
|
-
echo new version deployed on s3://tiledesk-console/v2/chat
|
|
30
|
-
echo available on https://console.tiledesk.com/v2/chat
|
|
29
|
+
echo new version deployed on s3://tiledesk-console/v2/chat/$version/
|
|
30
|
+
echo available on https://console.tiledesk.com/v2/chat/$version/index.html
|
package/package.json
CHANGED
|
@@ -16,6 +16,17 @@ export class InfoMessageComponent implements OnInit, OnChanges {
|
|
|
16
16
|
|
|
17
17
|
public message_text: string
|
|
18
18
|
private logger: LoggerService = LoggerInstance.getInstance()
|
|
19
|
+
|
|
20
|
+
tooltipOptions = {
|
|
21
|
+
'show-delay': 500,
|
|
22
|
+
'tooltip-class': 'chat-tooltip',
|
|
23
|
+
'theme': 'light',
|
|
24
|
+
'shadow': false,
|
|
25
|
+
'hide-delay-mobile': 0,
|
|
26
|
+
'hideDelayAfterClick': 3000,
|
|
27
|
+
'hide-delay': 200
|
|
28
|
+
};
|
|
29
|
+
|
|
19
30
|
constructor() { }
|
|
20
31
|
|
|
21
32
|
ngOnInit() {
|
|
@@ -10,7 +10,13 @@
|
|
|
10
10
|
<div #avatarPlaceholder class="avatar-placeholder" [ngStyle]="{'background': 'linear-gradient(rgb(255,255,255) -125%,' + user.color + ')'}" [innerHTML]="user.avatar"></div>
|
|
11
11
|
<div *ngIf="user.imageurl" #avatarImage class="avatar-profile" [style.background-image]="'url(' + user.imageurl + ')'"></div>
|
|
12
12
|
<!-- <div *ngIf="getImageAvatar(conversation.sender)" #avatarImage class="avatar-profile" [style.background-image]="'url(' + getImageAvatar(conversation.sender) + ')'"></div> -->
|
|
13
|
+
<div class="user-presence">
|
|
14
|
+
<app-presence
|
|
15
|
+
[isOnline]="user.online">
|
|
16
|
+
</app-presence>
|
|
17
|
+
</div>
|
|
13
18
|
</ion-avatar>
|
|
19
|
+
|
|
14
20
|
<ion-label>
|
|
15
21
|
<h2>{{ user.fullname }}</h2>
|
|
16
22
|
<p>{{ user.uid }}</p>
|
|
@@ -52,6 +52,13 @@ ion-item {
|
|
|
52
52
|
border-style: solid;
|
|
53
53
|
border-width: 0px;
|
|
54
54
|
}
|
|
55
|
+
.user-presence{
|
|
56
|
+
position: absolute;
|
|
57
|
+
width: 100%;
|
|
58
|
+
height: 40px;
|
|
59
|
+
top: 30px;
|
|
60
|
+
left: calc(50% + 15px);
|
|
61
|
+
}
|
|
55
62
|
}
|
|
56
63
|
ion-label {
|
|
57
64
|
flex: 1 1 0px;
|
|
@@ -81,6 +88,8 @@ ion-item {
|
|
|
81
88
|
}
|
|
82
89
|
|
|
83
90
|
}
|
|
91
|
+
|
|
92
|
+
|
|
84
93
|
ion-note {
|
|
85
94
|
position: absolute;
|
|
86
95
|
right: 8px;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PresenceService } from 'src/chat21-core/providers/abstract/presence.service';
|
|
1
2
|
import { Component, OnInit, Input, Output, EventEmitter, OnChanges } from '@angular/core';
|
|
2
3
|
import { UserModel } from 'src/chat21-core/models/user';
|
|
3
4
|
import { ImageRepoService } from 'src/chat21-core/providers/abstract/image-repo.service';
|
|
@@ -5,6 +6,7 @@ import { ImageRepoService } from 'src/chat21-core/providers/abstract/image-repo.
|
|
|
5
6
|
// Logger
|
|
6
7
|
import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
|
|
7
8
|
import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
|
|
9
|
+
import { filter } from 'rxjs/operators';
|
|
8
10
|
|
|
9
11
|
@Component({
|
|
10
12
|
selector: 'component-contacts-directory',
|
|
@@ -12,6 +14,7 @@ import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance'
|
|
|
12
14
|
styleUrls: ['./contacts-directory.component.scss'],
|
|
13
15
|
})
|
|
14
16
|
export class ContactsDirectoryComponent implements OnInit, OnChanges {
|
|
17
|
+
|
|
15
18
|
@Input() contacts: Array<UserModel>;
|
|
16
19
|
@Output() onOpenNewChat = new EventEmitter<UserModel>();
|
|
17
20
|
|
|
@@ -20,7 +23,8 @@ export class ContactsDirectoryComponent implements OnInit, OnChanges {
|
|
|
20
23
|
private logger: LoggerService = LoggerInstance.getInstance();
|
|
21
24
|
|
|
22
25
|
constructor(
|
|
23
|
-
public imageRepoService: ImageRepoService
|
|
26
|
+
public imageRepoService: ImageRepoService,
|
|
27
|
+
public presenceService: PresenceService
|
|
24
28
|
) { }
|
|
25
29
|
|
|
26
30
|
/**
|
|
@@ -35,6 +39,7 @@ export class ContactsDirectoryComponent implements OnInit, OnChanges {
|
|
|
35
39
|
if(this.contacts){
|
|
36
40
|
this.contacts.forEach(contact => {
|
|
37
41
|
contact.imageurl = this.imageRepoService.getImagePhotoUrl(contact.uid)
|
|
42
|
+
this.presenceService.userIsOnline(contact.uid).pipe(filter((isOnline) => isOnline !== null)).subscribe((status)=> {contact.online = status.isOnline })
|
|
38
43
|
});
|
|
39
44
|
}
|
|
40
45
|
}
|
|
@@ -148,10 +148,7 @@ export class InfoGroupComponent implements OnInit, AfterViewInit, OnChanges {
|
|
|
148
148
|
for (const [key, value] of Object.entries(this.groupDetail.members)) {
|
|
149
149
|
this.logger.log('CONVERSATION-DETAIL group detail Key:', key, ' -Value: ', value);
|
|
150
150
|
|
|
151
|
-
this.presenceService.userIsOnline(key)
|
|
152
|
-
.pipe(takeUntil(this.unsubscribe$))
|
|
153
|
-
.pipe(filter((isOnline) => isOnline !== null))
|
|
154
|
-
.subscribe((isOnline: any) => {
|
|
151
|
+
this.presenceService.userIsOnline(key).pipe(takeUntil(this.unsubscribe$)).pipe(filter((isOnline) => isOnline !== null)).subscribe((isOnline: any) => {
|
|
155
152
|
this.logger.log('InfoGroupComponent group detail BSIsOnline isOnline', isOnline)
|
|
156
153
|
members_isonline_array[key]['isSignin'] = isOnline.isOnline
|
|
157
154
|
if (this.member_array.length > 0) {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
.status-icon {
|
|
2
|
+
position: absolute;
|
|
3
|
+
width: 14px;
|
|
4
|
+
height: 14px;
|
|
5
|
+
top: 0px;
|
|
6
|
+
left: 0;
|
|
7
|
+
border: 2px solid #ffffff;
|
|
8
|
+
border-radius: 50%;
|
|
9
|
+
background-color: #f44336;
|
|
10
|
+
&.online {
|
|
11
|
+
background-color: #4caf50;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
}
|
|
15
|
+
.online-point {
|
|
16
|
+
position: absolute;
|
|
17
|
+
display: inline-block;
|
|
18
|
+
top: 0;
|
|
19
|
+
left: 20px;
|
|
20
|
+
color: rgba(255, 255, 255, 0.5);
|
|
21
|
+
font-size: 12px;
|
|
22
|
+
line-height: 14px;
|
|
23
|
+
text-align: left;
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
import { IonicModule } from '@ionic/angular';
|
|
3
|
+
|
|
4
|
+
import { PresenceComponent } from './presence.component';
|
|
5
|
+
|
|
6
|
+
describe('PresenceComponent', () => {
|
|
7
|
+
let component: PresenceComponent;
|
|
8
|
+
let fixture: ComponentFixture<PresenceComponent>;
|
|
9
|
+
|
|
10
|
+
beforeEach(async(() => {
|
|
11
|
+
TestBed.configureTestingModule({
|
|
12
|
+
declarations: [ PresenceComponent ],
|
|
13
|
+
imports: [IonicModule.forRoot()]
|
|
14
|
+
}).compileComponents();
|
|
15
|
+
|
|
16
|
+
fixture = TestBed.createComponent(PresenceComponent);
|
|
17
|
+
component = fixture.componentInstance;
|
|
18
|
+
fixture.detectChanges();
|
|
19
|
+
}));
|
|
20
|
+
|
|
21
|
+
it('should create', () => {
|
|
22
|
+
expect(component).toBeTruthy();
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Component, Input, OnInit } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
selector: 'app-presence',
|
|
5
|
+
templateUrl: './presence.component.html',
|
|
6
|
+
styleUrls: ['./presence.component.scss'],
|
|
7
|
+
})
|
|
8
|
+
export class PresenceComponent implements OnInit {
|
|
9
|
+
|
|
10
|
+
@Input() isOnline: boolean = false;
|
|
11
|
+
@Input() translationMap: Map<string, string>;
|
|
12
|
+
// @Input() fontColor: string;
|
|
13
|
+
// @Input() borderColor: string;
|
|
14
|
+
|
|
15
|
+
borderColor = '#ffffff';
|
|
16
|
+
fontColor = '#949494';
|
|
17
|
+
|
|
18
|
+
constructor() { }
|
|
19
|
+
|
|
20
|
+
ngOnInit() {}
|
|
21
|
+
|
|
22
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { PresenceComponent } from '../../components/utils/presence/presence.component';
|
|
1
2
|
import { NgModule } from '@angular/core';
|
|
2
3
|
import { CommonModule } from '@angular/common';
|
|
3
4
|
import { FormsModule } from '@angular/forms';
|
|
4
5
|
import { IonicModule } from '@ionic/angular';
|
|
5
|
-
import {
|
|
6
|
+
import {TranslateModule} from '@ngx-translate/core';
|
|
6
7
|
|
|
7
8
|
import { ContactsDirectoryPageRoutingModule } from './contacts-directory-routing.module';
|
|
8
9
|
import { ContactsDirectoryComponent } from '../../components/contacts-directory/contacts-directory.component';
|
|
@@ -10,7 +11,6 @@ import { ContactsDirectoryComponent } from '../../components/contacts-directory/
|
|
|
10
11
|
import { ContactsDirectoryPage } from './contacts-directory.page';
|
|
11
12
|
// import { ContactsDirectoryService } from '../../services/contacts-directory.service';
|
|
12
13
|
// import { TiledeskContactsDirectoryService } from '../../services/tiledesk/tiledesk-contacts-directory.service';
|
|
13
|
-
import { HttpClient } from '@angular/common/http';
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
// export function contactsFactory(http: HttpClient) {
|
|
@@ -36,7 +36,8 @@ import { HttpClient } from '@angular/common/http';
|
|
|
36
36
|
],
|
|
37
37
|
declarations: [
|
|
38
38
|
ContactsDirectoryPage,
|
|
39
|
-
ContactsDirectoryComponent
|
|
39
|
+
ContactsDirectoryComponent,
|
|
40
|
+
PresenceComponent
|
|
40
41
|
]
|
|
41
42
|
})
|
|
42
43
|
export class ContactsDirectoryPageModule {}
|
|
@@ -974,7 +974,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
974
974
|
subscriptionKey = 'messageInfo'
|
|
975
975
|
subscription = this.subscriptions.find((item) => item.key === subscriptionKey)
|
|
976
976
|
if (!subscription) {
|
|
977
|
-
subscription = this.conversationHandlerService.messageInfo.subscribe((msg: any) => {
|
|
977
|
+
subscription = this.conversationHandlerService.messageInfo.pipe(takeUntil(this.unsubscribe$)).subscribe((msg: any) => {
|
|
978
978
|
this.logger.log('[CONVS-DETAIL] subscribe to messageInfo - messageId ', msg)
|
|
979
979
|
if (msg) {
|
|
980
980
|
that.updateLeadInfo(msg)
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ContactsDirectoryComponent } from './../components/contacts-directory/contacts-directory.component';
|
|
1
2
|
import { HtmlComponent } from './../chatlib/conversation-detail/message/html/html.component';
|
|
2
3
|
import { BubbleOthersMessageComponent } from './../components/conversation-detail/bubble-others-message/bubble-others-message.component';
|
|
3
4
|
|
|
@@ -91,7 +92,7 @@ import { SafeHtmlPipe } from '../directives/safe-html.pipe';
|
|
|
91
92
|
AutofocusDirective,
|
|
92
93
|
HtmlEntitiesEncodePipe,
|
|
93
94
|
SafeHtmlPipe,
|
|
94
|
-
OptionHeaderComponent
|
|
95
|
+
OptionHeaderComponent,
|
|
95
96
|
],
|
|
96
97
|
exports: [
|
|
97
98
|
// MessageTextAreaComponent,
|
|
@@ -85,6 +85,37 @@ export function messageType(msgType: string, message: any) {
|
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
+
/** */
|
|
89
|
+
export function getSizeImg(message: any, maxWidthImage?: number): any {
|
|
90
|
+
try {
|
|
91
|
+
const metadata = message.metadata;
|
|
92
|
+
const sizeImage = {
|
|
93
|
+
width: metadata.width,
|
|
94
|
+
height: metadata.height
|
|
95
|
+
};
|
|
96
|
+
if (!maxWidthImage) {
|
|
97
|
+
maxWidthImage = MAX_WIDTH_IMAGES;
|
|
98
|
+
}
|
|
99
|
+
if (metadata.width && metadata.width > maxWidthImage) {
|
|
100
|
+
const rapporto = (metadata['width'] / metadata['height']);
|
|
101
|
+
sizeImage.width = maxWidthImage;
|
|
102
|
+
sizeImage.height = maxWidthImage / rapporto;
|
|
103
|
+
}
|
|
104
|
+
return sizeImage;
|
|
105
|
+
} catch (err) {
|
|
106
|
+
console.error('error: ', err);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** */
|
|
112
|
+
export function isChannelTypeGroup(channelType: string) {
|
|
113
|
+
if (channelType === CHANNEL_TYPE_GROUP || channelType === TYPE_SUPPORT_GROUP) {
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
|
|
88
119
|
export function isEmojii(message: any){
|
|
89
120
|
|
|
90
121
|
// let emoji = '';
|
|
@@ -115,38 +146,24 @@ export function isEmojii(message: any){
|
|
|
115
146
|
}
|
|
116
147
|
}
|
|
117
148
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
const sizeImage = {
|
|
126
|
-
width: metadata.width,
|
|
127
|
-
height: metadata.height
|
|
128
|
-
};
|
|
129
|
-
if (!maxWidthImage) {
|
|
130
|
-
maxWidthImage = MAX_WIDTH_IMAGES;
|
|
131
|
-
}
|
|
132
|
-
if (metadata.width && metadata.width > maxWidthImage) {
|
|
133
|
-
const rapporto = (metadata['width'] / metadata['height']);
|
|
134
|
-
sizeImage.width = maxWidthImage;
|
|
135
|
-
sizeImage.height = maxWidthImage / rapporto;
|
|
136
|
-
}
|
|
137
|
-
return sizeImage;
|
|
138
|
-
} catch (err) {
|
|
139
|
-
console.error('error: ', err);
|
|
140
|
-
return;
|
|
149
|
+
export function checkIfIsMemberJoinedGroup(msg, loggedUser): boolean{
|
|
150
|
+
if(msg && msg.attributes && msg.attributes.messagelabel
|
|
151
|
+
&& msg.attributes.messagelabel['key']=== "MEMBER_JOINED_GROUP"
|
|
152
|
+
&& msg.attributes.messagelabel.parameters['member_id'] !== loggedUser.uid
|
|
153
|
+
&& !msg.attributes.messagelabel.parameters['member_id'].includes('bot')
|
|
154
|
+
&& !msg.attributes.messagelabel.parameters['member_id'].includes('system')){
|
|
155
|
+
return true
|
|
141
156
|
}
|
|
157
|
+
return false
|
|
158
|
+
|
|
142
159
|
}
|
|
143
160
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
161
|
+
export function hideInfoMessage(msg, infoMessageKeyEnabled): boolean{
|
|
162
|
+
if(msg && msg.attributes && msg.attributes.messagelabel
|
|
163
|
+
&& infoMessageKeyEnabled.includes(msg.attributes.messagelabel['key'])){
|
|
164
|
+
return false
|
|
148
165
|
}
|
|
149
|
-
return
|
|
166
|
+
return true
|
|
150
167
|
}
|
|
151
168
|
|
|
152
169
|
|