@chat21/chat21-ionic 3.0.71 → 3.0.73-rc.1

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 CHANGED
@@ -1,5 +1,14 @@
1
1
  # chat21-ionic ver 3.0
2
2
 
3
+ ### 3.0.73-rc.1
4
+ - bug-fixed: topic.split is not a function while a conversataion is closed by an agent in MQTT-conversations-handler.service
5
+ - removed: user id from contact-directory component
6
+
7
+ ### 3.0.72 in PROD
8
+
9
+ ### 3.0.72-rc.1
10
+ - added: user presence on contact-directory component
11
+
3
12
  ### 3.0.71 in PROD
4
13
 
5
14
  ### 3.0.71-rc.1
@@ -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-ionic5/$version/
30
- echo available on https://console.tiledesk.com/v2/chat-ionic5/$version/index.html
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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@chat21/chat21-ionic",
3
3
  "author": "Tiledesk SRL",
4
- "version": "3.0.71",
4
+ "version": "3.0.73-rc.1",
5
5
  "license": "AGPL-3.0",
6
6
  "homepage": "https://tiledesk.com/",
7
7
  "repository": {
@@ -10,10 +10,16 @@
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
- <p>{{ user.uid }}</p>
22
+ <!-- <p>{{ user.uid }}</p> -->
17
23
  </ion-label>
18
24
 
19
25
  </ion-item>
@@ -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
  }
@@ -10,6 +10,7 @@ export class OptionHeaderComponent implements OnInit {
10
10
 
11
11
  @Input() headerTitle: string
12
12
  @Output() onBackButton = new EventEmitter<boolean>();
13
+ static UserPresenceComponent: any[] | any;
13
14
 
14
15
  constructor() { }
15
16
 
@@ -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,2 @@
1
+ <div class="status-icon" [class.online]="isOnline" [style.border-color]="borderColor"></div>
2
+ <!-- <div class="online-point" [style.color]="fontColor">{{status}}</div> -->
@@ -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 {TranslateLoader, TranslateModule, TranslatePipe} from '@ngx-translate/core';
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,
Binary file
@@ -169,13 +169,14 @@ export class MQTTConversationsHandler extends ConversationsHandlerService {
169
169
  const handlerConversationDeleted = this.chat21Service.chatClient.onConversationDeleted( (conv, topic) => {
170
170
  this.logger.debug('[MQTTConversationsHandler] conversation deleted:', conv, topic);
171
171
  // example topic: apps.tilechat.users.ME.conversations.CONVERS-WITH.clientdeleted
172
- const topic_parts = topic.split("/")
173
- this.logger.debug('[MQTTConversationsHandler] topic and parts', topic_parts)
174
- if (topic_parts.length < 7) {
175
- this.logger.error('[MQTTConversationsHandler] Error. Not a conversation-deleted topic:', topic);
176
- return
177
- }
178
- const convers_with = topic_parts[5];
172
+ // const topic_parts = topic.split("/")
173
+ // this.logger.debug('[MQTTConversationsHandler] topic and parts', topic_parts)
174
+ // if (topic_parts.leßngth < 7) {
175
+ // this.logger.error('[MQTTConversationsHandler] Error. Not a conversation-deleted topic:', topic);
176
+ // return
177
+ // }
178
+ // const convers_with = topic_parts[5];
179
+ const convers_with = topic.conversWith;
179
180
  this.removed({
180
181
  uid: convers_with
181
182
  });
@@ -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
- export function getSizeImg(message: any, maxWidthImage?: number): any {
123
- try {
124
- const metadata = message.metadata;
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
- export function isChannelTypeGroup(channelType: string) {
146
- if (channelType === CHANNEL_TYPE_GROUP || channelType === TYPE_SUPPORT_GROUP) {
147
- return true;
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 false;
166
+ return true
150
167
  }
151
168
 
152
169