@chat21/chat21-ionic 3.4.27-rc2 → 3.4.27-rc4

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
@@ -8,6 +8,13 @@
8
8
  ### **Copyrigth**:
9
9
  *Tiledesk SRL*
10
10
 
11
+ # 3.4.27-rc4
12
+ - **bug-fixed**: extractUrls function is not able to detect url start with www or without https/http
13
+ - **bug-fixed**: if message is sent with keydown, error on domain check is not showed
14
+
15
+ # 3.4.27-rc3
16
+ - **bug-fixed**: cannot set user availability if supportMode is enabled and tiledesk_projectID url params is set
17
+
11
18
  # 3.4.27-rc2
12
19
  - **bug-fixed**: cannede responses role
13
20
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@chat21/chat21-ionic",
3
3
  "author": "Tiledesk SRL",
4
- "version": "3.4.27-rc2",
4
+ "version": "3.4.27-rc4",
5
5
  "license": "MIT License",
6
6
  "homepage": "https://tiledesk.com/",
7
7
  "repository": {
@@ -44,6 +44,7 @@ import { conversationToMessage } from 'src/chat21-core/utils/utils-message';
44
44
  import { ProjectService } from './services/projects/project.service';
45
45
  import { ContactsService } from './services/contacts/contacts.service';
46
46
  import { TiledeskService } from './services/tiledesk/tiledesk.service';
47
+ import { Project } from 'src/chat21-core/models/projects';
47
48
  import { ProjectUsersService } from './services/project_users/project-users.service';
48
49
 
49
50
  @Component({
@@ -1182,11 +1183,14 @@ export class AppComponent implements OnInit {
1182
1183
  this.contactsService.initialize(serverBaseURL)
1183
1184
  // this.chatManager.startApp();
1184
1185
 
1186
+
1187
+ //INIT WEBSOCKET
1188
+ this.connetWebsocket(tiledeskToken)
1189
+
1185
1190
  // ----------------------------------------------
1186
1191
  // PUSH NOTIFICATIONS
1187
1192
  // ----------------------------------------------
1188
1193
  const pushEngine = this.appConfigProvider.getConfig().pushEngine
1189
-
1190
1194
  if (currentUser) {
1191
1195
  if (pushEngine && pushEngine !== 'none') {
1192
1196
  this.notificationsService.getNotificationPermissionAndSaveToken(currentUser.uid);
@@ -1208,6 +1212,24 @@ export class AppComponent implements OnInit {
1208
1212
  } catch (err) {
1209
1213
  this.logger.error('[APP-COMP] -> error:', err);
1210
1214
  }
1215
+
1216
+ // ----------------------------------------------
1217
+ // LAST PROJECT FROM URL
1218
+ // ----------------------------------------------
1219
+ if(this.g.projectID){
1220
+ this.projectService.getProjects().subscribe({ next: (projects: Project[]) => {
1221
+ const project = projects.find(prjct => prjct.id_project._id === this.g.projectID)
1222
+ if(project){
1223
+ this.logger.log('[APP-COMP] - GET PROJECT - project found with this.projectID', project);
1224
+ localStorage.setItem('last_project', JSON.stringify(project))
1225
+ this.events.publish('storage:last_project', project)
1226
+ }
1227
+ }, error: (error) => {
1228
+ this.logger.log('[APP-COMP] - GET PROJECT - project NOT found with this.projectID', this.g.projectID, error);
1229
+ }, complete: () => {
1230
+
1231
+ }});
1232
+ }
1211
1233
  }
1212
1234
 
1213
1235
 
@@ -1253,6 +1275,21 @@ export class AppComponent implements OnInit {
1253
1275
  myWindow.focus();
1254
1276
  }
1255
1277
 
1278
+ connetWebsocket(tiledeskToken) {
1279
+
1280
+ this.logger.log('[WEBSOCKET-JS] connetWebsocket called in [PROJECT-ITEM] tiledeskToken ', tiledeskToken)
1281
+ const appconfig = this.appConfigProvider.getConfig();
1282
+ this.logger.log('[WEBSOCKET-JS] connetWebsocket called in [PROJECT-ITEM] wsUrl ', appconfig.wsUrl)
1283
+ const WS_URL = appconfig.wsUrl + '?token=' + tiledeskToken
1284
+ this.logger.log('[WEBSOCKET-JS] connetWebsocket called in [PROJECT-ITEM] wsUrl ', WS_URL)
1285
+ this.webSocketJs.init(
1286
+ WS_URL,
1287
+ undefined,
1288
+ undefined,
1289
+ undefined
1290
+ );
1291
+ }
1292
+
1256
1293
 
1257
1294
  webSocketClose() {
1258
1295
  this.logger.log('[APP-COMP] - GO-OFFLINE - webSocketClose');
@@ -566,8 +566,10 @@ export class MessageTextAreaComponent implements OnInit, AfterViewInit, OnChange
566
566
  if (!text.includes("/")) {
567
567
  this.logger.log('[CONVS-DETAIL][MSG-TEXT-AREA] onKeydown - SEND MESSAGE 1 message: ', message);
568
568
  this.logger.log("[CONVS-DETAIL] replaceTagInMessage onKeydown in msg-texarea SEND MESSAGE 1 message: ", message);
569
- this.messageString = '';
569
+
570
570
  this.sendMessage(text);
571
+ // this.messageString = '';
572
+
571
573
  this.countClicks = 0
572
574
  } else if (text.includes("/") && pos === 0 && this.countClicks > 1 && this.tagsCannedFilter.length > 0) {
573
575
  this.logger.log('[CONVS-DETAIL][MSG-TEXT-AREA] onKeydown - tagsCannedFilter.length 2: ', this.tagsCannedFilter.length);
@@ -579,9 +581,10 @@ export class MessageTextAreaComponent implements OnInit, AfterViewInit, OnChange
579
581
  this.logger.log("[CONVS-DETAIL] replaceTagInMessage onKeydown in msg-texarea SEND MESSAGE 2 this.countClicks: ", this.countClicks);
580
582
  this.logger.log("[CONVS-DETAIL][MSG-TEXT-AREA] onKeydown in msg-texarea SEND MESSAGE 2 this.countClicks: ", this.countClicks);
581
583
  this.logger.log('[CONVS-DETAIL][MSG-TEXT-AREA] onKeydown - SEND MESSAGE 2 message: ', message);
582
- this.messageString = '';
583
-
584
+
584
585
  this.sendMessage(text);
586
+ // this.messageString = '';
587
+
585
588
  this.countClicks = 0
586
589
  } else if (text.includes("/") && pos > 0 && this.countClicks > 1 && this.tagsCannedFilter.length > 0 && text.substr(-1) !== '/') {
587
590
  this.logger.log('[CONVS-DETAIL][MSG-TEXT-AREA] onKeydown - tagsCannedFilter.length 3: ', this.tagsCannedFilter.length);
@@ -593,17 +596,19 @@ export class MessageTextAreaComponent implements OnInit, AfterViewInit, OnChange
593
596
  this.logger.log("[CONVS-DETAIL] replaceTagInMessage onKeydown in msg-texarea SEND MESSAGE 2 this.countClicks: ", this.countClicks);
594
597
  this.logger.log("[CONVS-DETAIL][MSG-TEXT-AREA] onKeydown in msg-texarea SEND MESSAGE 2 this.countClicks: ", this.countClicks);
595
598
  this.logger.log('[CONVS-DETAIL][MSG-TEXT-AREA] onKeydown - SEND MESSAGE 2 message: ', message);
596
- this.messageString = '';
597
-
599
+
598
600
  this.sendMessage(text);
601
+ // this.messageString = '';
602
+
599
603
  this.countClicks = 0
600
604
  } else if (text.includes("/") && this.tagsCannedFilter.length === 0) {
601
605
  this.logger.log('[CONVS-DETAIL][MSG-TEXT-AREA] onKeydown - tagsCannedFilter.length 3: ', this.tagsCannedFilter.length);
602
606
  this.logger.log('[CONVS-DETAIL][MSG-TEXT-AREA] onKeydown - SEND MESSAGE 3 message: ', message);
603
607
  this.logger.log("[CONVS-DETAIL] replaceTagInMessage onKeydown in msg-texarea SEND MESSAGE 3 message: ", message);
604
- this.messageString = '';
605
-
608
+
606
609
  this.sendMessage(text);
610
+ // this.messageString = '';
611
+
607
612
  this.countClicks = 0
608
613
 
609
614
  }
@@ -85,17 +85,17 @@ export class ProjectItemComponent implements OnInit {
85
85
 
86
86
  connetWebsocket(tiledeskToken) {
87
87
 
88
- this.logger.log('[WEBSOCKET-JS] connetWebsocket called in [PROJECT-ITEM] tiledeskToken ', tiledeskToken)
89
- const appconfig = this.appConfigProvider.getConfig();
90
- this.logger.log('[WEBSOCKET-JS] connetWebsocket called in [PROJECT-ITEM] wsUrl ', appconfig.wsUrl)
91
- const WS_URL = appconfig.wsUrl + '?token=' + tiledeskToken
92
- this.logger.log('[WEBSOCKET-JS] connetWebsocket called in [PROJECT-ITEM] wsUrl ', WS_URL)
93
- this.webSocketJs.init(
94
- WS_URL,
95
- undefined,
96
- undefined,
97
- undefined
98
- );
88
+ // this.logger.log('[WEBSOCKET-JS] connetWebsocket called in [PROJECT-ITEM] tiledeskToken ', tiledeskToken)
89
+ // const appconfig = this.appConfigProvider.getConfig();
90
+ // this.logger.log('[WEBSOCKET-JS] connetWebsocket called in [PROJECT-ITEM] wsUrl ', appconfig.wsUrl)
91
+ // const WS_URL = appconfig.wsUrl + '?token=' + tiledeskToken
92
+ // this.logger.log('[WEBSOCKET-JS] connetWebsocket called in [PROJECT-ITEM] wsUrl ', WS_URL)
93
+ // this.webSocketJs.init(
94
+ // WS_URL,
95
+ // undefined,
96
+ // undefined,
97
+ // undefined
98
+ // );
99
99
 
100
100
  this.getLastProjectStoredAndSubscToWSAvailabilityAndConversations();
101
101
  }
@@ -81,11 +81,11 @@
81
81
  [searchable]="false">
82
82
  <ng-template ng-label-tmp let-item="item">
83
83
  <img style="width: 15px;height: 15px;position: relative; top: 1px;" height="15" width="15" [src]="item?.avatar" />
84
- <span id="sidebaravatar_{{item.name}}" style="text-transform: capitalize; margin-left:8px"> {{item.label}} </span>
84
+ <span id="sidebaravatar_{{item.name}}" style="text-transform: capitalize; margin-left:8px"> {{item.label | translate}} </span>
85
85
  </ng-template>
86
86
  <ng-template ng-option-tmp let-item="item" let-index="index">
87
87
  <img style="width: 15px;height: 15px;position: relative; top: 1px;" height="15" width="15" [src]="item?.avatar" />
88
- <span id="sidebaravatar_{{item.name}}" style="text-transform: capitalize; margin-left:8px"> {{item.label}} </span>
88
+ <span id="sidebaravatar_{{item.name}}" style="text-transform: capitalize; margin-left:8px"> {{item.label | translate}} </span>
89
89
  </ng-template>
90
90
  </ng-select>
91
91
  </section>
@@ -242,9 +242,9 @@ export class SidebarUserDetailsComponent implements OnInit, OnChanges {
242
242
  .set('SubscriptionPaymentProblem', text['SubscriptionPaymentProblem'])
243
243
  .set('ThePlanHasExpired', text['ThePlanHasExpired'])
244
244
 
245
- this.teammateStatus.forEach(element => {
246
- element.label = this.translationsMap.get(element.label)
247
- });
245
+ // this.teammateStatus.forEach(element => {
246
+ // element.label = this.translationsMap.get(element.label)
247
+ // });
248
248
 
249
249
  });
250
250
  }
@@ -261,7 +261,7 @@ export class SidebarUserDetailsComponent implements OnInit, OnChanges {
261
261
  listenToCurrentStoredProject() {
262
262
  this.events.subscribe('storage:last_project', projectObjct => {
263
263
  if (projectObjct && projectObjct !== 'undefined') {
264
- // this.logger.log('[SIDEBAR-USER-DETAILS] - GET STORED PROJECT ', projectObjct)
264
+ this.logger.log('[SIDEBAR-USER-DETAILS] - GET STORED PROJECT ', projectObjct)
265
265
 
266
266
  //TODO: recuperare info da root e non da id_project
267
267
  this.project = {
@@ -284,6 +284,8 @@ export class SidebarUserDetailsComponent implements OnInit, OnChanges {
284
284
  } else if (this.project.profile.type === 'payment' && this.project.profile.name === 'enterprise') {
285
285
  this.getEnterprisePlanTranslation();
286
286
  }
287
+
288
+ this.wsService.subscriptionToWsCurrentProjectUserAvailability(this.project._id, projectObjct._id);
287
289
  }
288
290
  })
289
291
 
@@ -329,14 +331,14 @@ export class SidebarUserDetailsComponent implements OnInit, OnChanges {
329
331
  // this.logger.log('teammateStatus ', this.teammateStatus)
330
332
  this.selectedStatus = this.teammateStatus[2].id;
331
333
  this.logger.debug('[SIDEBAR-USER-DETAILS] - PROFILE_STATUS selected option', this.teammateStatus[2].name);
332
- this.teammateStatus = this.teammateStatus.slice(0)
334
+ // this.teammateStatus = this.teammateStatus.slice(0)
333
335
  } else if (projectUser['user_available'] === false && (projectUser['profileStatus'] === '' || !projectUser['profileStatus'])) {
334
336
  this.selectedStatus = this.teammateStatus[1].id;
335
337
  this.logger.debug('[SIDEBAR-USER-DETAILS] - PROFILE_STATUS selected option', this.teammateStatus[1].name);
336
- this.teammateStatus = this.teammateStatus.slice(0)
338
+ // this.teammateStatus = this.teammateStatus.slice(0)
337
339
  } else if (projectUser['user_available'] === true && (projectUser['profileStatus'] === '' || !projectUser['profileStatus'])) {
338
340
  this.selectedStatus = this.teammateStatus[0].id
339
- this.teammateStatus = this.teammateStatus.slice(0)
341
+ // this.teammateStatus = this.teammateStatus.slice(0)
340
342
  this.logger.debug('[SIDEBAR-USER-DETAILS] - PROFILE_STATUS selected option', this.teammateStatus[0].name);
341
343
  }
342
344
  this.IS_BUSY = projectUser['isBusy']
@@ -22,6 +22,9 @@ import { MatTooltipModule } from '@angular/material/tooltip';
22
22
  import { MatSnackBarModule } from '@angular/material/snack-bar';
23
23
  import { MatSlideToggleModule } from '@angular/material/slide-toggle';
24
24
  import { SafeHtmlPipe } from '../directives/safe-html.pipe';
25
+ import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
26
+ import { createTranslateLoader } from 'src/chat21-core/utils/utils';
27
+ import { HttpClient } from '@angular/common/http';
25
28
 
26
29
  // import { MessageTextAreaComponent } from '../components/conversation-detail/message-text-area/message-text-area.component'; // MessageTextAreaComponent is part of the declarations ConversationDetailPageModule
27
30
 
@@ -140,6 +143,14 @@ import { SafeHtmlPipe } from '../directives/safe-html.pipe';
140
143
  NgSelectModule,
141
144
  FormsModule,
142
145
 
146
+ TranslateModule.forChild({
147
+ loader: {
148
+ provide: TranslateLoader,
149
+ useFactory: (createTranslateLoader),
150
+ deps: [HttpClient]
151
+ }
152
+ })
153
+
143
154
  ],
144
155
  schemas: [
145
156
  CUSTOM_ELEMENTS_SCHEMA,
@@ -1018,6 +1018,14 @@ export function isAllowedUrlInText(text: string, allowedUrls: string[]) {
1018
1018
  }
1019
1019
 
1020
1020
  function extractUrls(text: string): string[] {
1021
- const urlRegex = /https?:\/\/[^\s]+/g;
1022
- return text.match(urlRegex) || [];
1021
+ // Rileva URL con o senza protocollo (http/https)
1022
+ const urlRegex = /\b((https?:\/\/)?(www\.)?[a-z0-9.-]+\.[a-z]{2,})(\/[^\s]*)?/gi;
1023
+ const matches = text.match(urlRegex) || [];
1024
+ // Normalizza: aggiunge https:// se manca, così il parsing con new URL() funziona
1025
+ return matches.map((url) => {
1026
+ if (!/^https?:\/\//i.test(url)) {
1027
+ return 'https://' + url;
1028
+ }
1029
+ return url;
1030
+ });
1023
1031
  }