@chat21/chat21-ionic 3.1.0 → 3.2.0

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,13 @@
1
1
  # chat21-ionic ver 3.0
2
2
 
3
+ ### 3.2.0 in PROD
4
+ - changed: API_URL template key in favour of SERVER_BASE_URL
5
+
6
+ ### 3.2.0-rc.1
7
+ - added: CONV_TYPE enum for all channel_type
8
+ - bug-fixed: do not sent automatic offline message if channel_type is messanger
9
+ - bug-fixed: disabled email section in conversation-detail footer if channel_type is whatsapp or messanger
10
+
3
11
  ### 3.1.0 in PROD
4
12
 
5
13
  ### 3.1.0-rc2
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@chat21/chat21-ionic",
3
3
  "author": "Tiledesk SRL",
4
- "version": "3.1.0",
4
+ "version": "3.2.0",
5
5
  "license": "MIT License",
6
6
  "homepage": "https://tiledesk.com/",
7
7
  "repository": {
@@ -826,7 +826,7 @@ export class AppComponent implements OnInit {
826
826
  this.hadBeenCalledOpenModal = true;
827
827
  }
828
828
  }, 1000)
829
- }else{
829
+ }else {
830
830
  this.goToDashboardLogin()
831
831
  }
832
832
  }
@@ -95,23 +95,23 @@
95
95
  <ion-label>
96
96
  <div class="conversation_project truncate">
97
97
  <!-- DIRECT CONV -->
98
- <div *ngIf="conversation.channel_type === TYPE_DIRECT">
98
+ <div *ngIf="conversation.channel_type === CHANNEL_TYPE.DIRECT">
99
99
  <img class="channel-icon" src="assets/images/channel_icons/direct.svg">
100
100
  <span class="truncate">{{translationsMap.get('DIRECT_CHAT')}}</span>
101
101
  </div>
102
102
  <!-- GROUP CONV -->
103
- <div *ngIf="conversation.uid.startsWith(TYPE_GROUP)">
103
+ <div *ngIf="conversation.uid.startsWith(CHANNEL_TYPE.GROUP)">
104
104
  <img class="channel-icon" src="assets/images/channel_icons/group.svg">
105
105
  <span class="truncate">{{translationsMap.get('GROUP_CHAT')}}</span>
106
106
  </div>
107
107
  <!-- SUPPORT-GROUP CONV -->
108
- <div *ngIf="conversation.uid.startsWith(TYPE_SUPPORT_GROUP) && !IS_ON_MOBILE_DEVICE">
109
- <img class="channel-icon" src="assets/images/channel_icons/chat21.svg" *ngIf="conversation?.attributes && ( (conversation?.attributes?.request_channel && conversation?.attributes?.request_channel === CHANNEL_TYPE_CHAT21) || !conversation?.attributes?.request_channel) " >
110
- <img class="channel-icon" src="assets/images/channel_icons/email-logo.svg" *ngIf="conversation?.attributes && conversation?.attributes?.request_channel && conversation?.attributes?.request_channel === CHANNEL_TYPE_EMAIL" >
111
- <img class="channel-icon" src="assets/images/channel_icons/form-logo_v2.svg" *ngIf="conversation?.attributes && conversation?.attributes?.request_channel && conversation?.attributes?.request_channel === CHANNEL_TYPE_FORM" >
112
- <img class="channel-icon" src="assets/images/channel_icons/messenger-logo.svg" *ngIf="conversation?.attributes && conversation?.attributes?.request_channel && conversation?.attributes?.request_channel === CHANNEL_TYPE_MESSANGER" >
113
- <img class="channel-icon" src="assets/images/channel_icons/whatsapp-logo.svg" *ngIf="conversation?.attributes && conversation?.attributes?.request_channel && conversation?.attributes?.request_channel === CHANNEL_TYPE_WHATSAPP" >
114
- <img class="channel-icon" src="assets/images/channel_icons/telegram-logo.svg" *ngIf="conversation?.attributes && conversation?.attributes?.request_channel && conversation?.attributes?.request_channel === CHANNEL_TYPE_TELEGRAM" >
108
+ <div *ngIf="conversation.uid.startsWith(CHANNEL_TYPE.SUPPORT_GROUP) && !IS_ON_MOBILE_DEVICE">
109
+ <img class="channel-icon" src="assets/images/channel_icons/chat21.svg" *ngIf="conversation?.attributes && ( (conversation?.attributes?.request_channel && conversation?.attributes?.request_channel === CHANNEL_TYPE.CHAT21) || !conversation?.attributes?.request_channel) " >
110
+ <img class="channel-icon" src="assets/images/channel_icons/email-logo.svg" *ngIf="conversation?.attributes && conversation?.attributes?.request_channel && conversation?.attributes?.request_channel === CHANNEL_TYPE.EMAIL" >
111
+ <img class="channel-icon" src="assets/images/channel_icons/form-logo_v2.svg" *ngIf="conversation?.attributes && conversation?.attributes?.request_channel && conversation?.attributes?.request_channel === CHANNEL_TYPE.FORM" >
112
+ <img class="channel-icon" src="assets/images/channel_icons/messenger-logo.svg" *ngIf="conversation?.attributes && conversation?.attributes?.request_channel && conversation?.attributes?.request_channel === CHANNEL_TYPE.MESSENGER" >
113
+ <img class="channel-icon" src="assets/images/channel_icons/whatsapp-logo.svg" *ngIf="conversation?.attributes && conversation?.attributes?.request_channel && conversation?.attributes?.request_channel === CHANNEL_TYPE.WHATSAPP" >
114
+ <img class="channel-icon" src="assets/images/channel_icons/telegram-logo.svg" *ngIf="conversation?.attributes && conversation?.attributes?.request_channel && conversation?.attributes?.request_channel === CHANNEL_TYPE.TELEGRAM" >
115
115
  <span *ngIf="conversation?.attributes?.project_name" class="truncate">{{conversation?.attributes?.project_name}}</span>
116
116
  <span *ngIf="!conversation?.attributes?.project_name" class="truncate">{{conversation?.attributes?.projectId}}</span>
117
117
  </div>
@@ -1,8 +1,6 @@
1
- import { CHANNEL_TYPE_CHAT21, CHANNEL_TYPE_EMAIL, CHANNEL_TYPE_FORM, CHANNEL_TYPE_MESSANGER, CHANNEL_TYPE_TELEGRAM, CHANNEL_TYPE_WHATSAPP, TYPE_GROUP, TYPE_SUPPORT_GROUP } from './../../../../chat21-core/utils/constants';
2
- import { TYPE_DIRECT } from 'src/chat21-core/utils/constants';
1
+ import { CHANNEL_TYPE } from 'src/chat21-core/utils/constants';
3
2
  import { Component, EventEmitter, Input, IterableDiffers, KeyValueDiffers, OnInit, Output, SimpleChange } from '@angular/core';
4
3
  import { ConversationModel } from 'src/chat21-core/models/conversation';
5
- import { ImageRepoService } from 'src/chat21-core/providers/abstract/image-repo.service';
6
4
  import { convertMessage, isOnMobileDevice } from 'src/chat21-core/utils/utils';
7
5
  import { ListConversationsComponent } from '../list-conversations/list-conversations.component';
8
6
  import { Platform } from '@ionic/angular';
@@ -55,17 +53,8 @@ export class IonListConversationsComponent extends ListConversationsComponent im
55
53
  public youAreNoLongerAmongTheTeammatesManagingThisConversation_lbl: string;
56
54
  public ok_lbl: string;
57
55
 
58
- TYPE_DIRECT = TYPE_DIRECT;
59
- TYPE_GROUP = TYPE_GROUP;
60
- TYPE_SUPPORT_GROUP = TYPE_SUPPORT_GROUP;
61
-
62
56
  //ATTRIBUTES CHANNEL
63
- CHANNEL_TYPE_CHAT21 = CHANNEL_TYPE_CHAT21;
64
- CHANNEL_TYPE_EMAIL = CHANNEL_TYPE_EMAIL;
65
- CHANNEL_TYPE_FORM = CHANNEL_TYPE_FORM;
66
- CHANNEL_TYPE_MESSANGER = CHANNEL_TYPE_MESSANGER;
67
- CHANNEL_TYPE_WHATSAPP = CHANNEL_TYPE_WHATSAPP;
68
- CHANNEL_TYPE_TELEGRAM = CHANNEL_TYPE_TELEGRAM;
57
+ CHANNEL_TYPE = CHANNEL_TYPE
69
58
 
70
59
  IS_ON_MOBILE_DEVICE: boolean
71
60
  /**
@@ -62,7 +62,6 @@ export class CannedResponseComponent implements OnInit {
62
62
  if(this.currentString !== undefined){
63
63
  this.loadTagsCanned(this.currentString, this.conversationWith)
64
64
  }
65
- console.log('can show canneddddddd', this.canShowCanned)
66
65
  }
67
66
 
68
67
  // getProjectIdSelectedConversation(conversationWith: string): string{
@@ -38,18 +38,18 @@
38
38
  <span class="truncate">{{translationsMap.get('DIRECT_CHAT')}}</span> -->
39
39
  </div>
40
40
  <!-- GROUP CONV -->
41
- <div *ngIf="conversationUid?.startsWith(TYPE_GROUP)">
41
+ <div *ngIf="conversationUid?.startsWith(CHANNEL_TYPE.GROUP)">
42
42
  <svg xmlns="http://www.w3.org/2000/svg" height="15" width="15" viewBox="0 0 24 24" fill="#000000"><path d="M16 11c1.66 0 2.99-1.34 2.99-3S17.66 5 16 5c-1.66 0-3 1.34-3 3s1.34 3 3 3zm-8 0c1.66 0 2.99-1.34 2.99-3S9.66 5 8 5C6.34 5 5 6.34 5 8s1.34 3 3 3zm0 2c-2.33 0-7 1.17-7 3.5V19h14v-2.5c0-2.33-4.67-3.5-7-3.5zm8 0c-.29 0-.62.02-.97.05 1.16.84 1.97 1.97 1.97 3.45V19h6v-2.5c0-2.33-4.67-3.5-7-3.5z"/></svg>
43
43
  <span class="truncate">{{translationsMap.get('GROUP_CHAT')}}</span>
44
44
  </div>
45
45
  <!-- SUPPORT-GROUP CONV -->
46
- <div *ngIf="conversationUid?.startsWith(TYPE_SUPPORT_GROUP) && !IS_ON_MOBILE_DEVICE">
47
- <img class="channel-icon" src="assets/images/channel_icons/chat21.svg" *ngIf="( (conversationAvatar?.request_channel && conversationAvatar?.request_channel === CHANNEL_TYPE_CHAT21) || !conversationAvatar?.request_channel) " >
48
- <img class="channel-icon" src="assets/images/channel_icons/email-logo.svg" *ngIf="conversationAvatar?.request_channel && conversationAvatar?.request_channel === CHANNEL_TYPE_EMAIL" >
49
- <img class="channel-icon" src="assets/images/channel_icons/form-logo_v2.svg" *ngIf="conversationAvatar?.request_channel && conversationAvatar?.request_channel === CHANNEL_TYPE_FORM" >
50
- <img class="channel-icon" src="assets/images/channel_icons/messenger-logo.svg" *ngIf="conversationAvatar?.request_channel && conversationAvatar?.request_channel === CHANNEL_TYPE_MESSANGER" >
51
- <img class="channel-icon" src="assets/images/channel_icons/whatsapp-logo.svg" *ngIf="conversationAvatar?.request_channel && conversationAvatar?.request_channel === CHANNEL_TYPE_WHATSAPP" >
52
- <img class="channel-icon" src="assets/images/channel_icons/telegram-logo.svg" *ngIf="conversationAvatar?.request_channel && conversationAvatar?.request_channel === CHANNEL_TYPE_TELEGRAM" >
46
+ <div *ngIf="conversationUid?.startsWith(CHANNEL_TYPE.SUPPORT_GROUP) && !IS_ON_MOBILE_DEVICE">
47
+ <img class="channel-icon" src="assets/images/channel_icons/chat21.svg" *ngIf="( (conversationAvatar?.request_channel && conversationAvatar?.request_channel === CHANNEL_TYPE.CHAT21) || !conversationAvatar?.request_channel) " >
48
+ <img class="channel-icon" src="assets/images/channel_icons/email-logo.svg" *ngIf="conversationAvatar?.request_channel && conversationAvatar?.request_channel === CHANNEL_TYPE.EMAIL" >
49
+ <img class="channel-icon" src="assets/images/channel_icons/form-logo_v2.svg" *ngIf="conversationAvatar?.request_channel && conversationAvatar?.request_channel === CHANNEL_TYPE.FORM" >
50
+ <img class="channel-icon" src="assets/images/channel_icons/messenger-logo.svg" *ngIf="conversationAvatar?.request_channel && conversationAvatar?.request_channel === CHANNEL_TYPE.MESSENGER" >
51
+ <img class="channel-icon" src="assets/images/channel_icons/whatsapp-logo.svg" *ngIf="conversationAvatar?.request_channel && conversationAvatar?.request_channel === CHANNEL_TYPE.WHATSAPP" >
52
+ <img class="channel-icon" src="assets/images/channel_icons/telegram-logo.svg" *ngIf="conversationAvatar?.request_channel && conversationAvatar?.request_channel === CHANNEL_TYPE.TELEGRAM" >
53
53
  <span *ngIf="conversationAvatar?.project_name" class="truncate">{{conversationAvatar?.project_name}}</span>
54
54
  <span *ngIf="!conversationAvatar?.project_name" class="truncate">{{conversationAvatar?.projectId}}</span>
55
55
  </div>
@@ -1,4 +1,3 @@
1
- import { CHANNEL_TYPE_CHAT21, CHANNEL_TYPE_EMAIL, CHANNEL_TYPE_FORM, CHANNEL_TYPE_MESSANGER, CHANNEL_TYPE_TELEGRAM, CHANNEL_TYPE_WHATSAPP, TYPE_GROUP } from './../../../../chat21-core/utils/constants';
2
1
  import {
3
2
  Component,
4
3
  OnInit,
@@ -19,7 +18,7 @@ import { ModalController } from '@ionic/angular'
19
18
  import { EventsService } from 'src/app/services/events-service'
20
19
  import { CreateTicketPage } from 'src/app/modals/create-ticket/create-ticket.page'
21
20
  import { TiledeskService } from 'src/app/services/tiledesk/tiledesk.service'
22
- import { TYPE_DIRECT, TYPE_SUPPORT_GROUP } from 'src/chat21-core/utils/constants'
21
+ import { CHANNEL_TYPE } from 'src/chat21-core/utils/constants'
23
22
  import { isOnMobileDevice } from 'src/chat21-core/utils/utils';
24
23
 
25
24
  @Component({
@@ -48,16 +47,8 @@ export class HeaderConversationDetailComponent implements OnInit, OnChanges {
48
47
  IS_ON_MOBILE_DEVICE: boolean
49
48
  private logger: LoggerService = LoggerInstance.getInstance()
50
49
 
51
- TYPE_SUPPORT_GROUP = TYPE_SUPPORT_GROUP
52
- TYPE_GROUP = TYPE_GROUP
53
-
54
50
  //ATTRIBUTES CHANNEL
55
- CHANNEL_TYPE_CHAT21 = CHANNEL_TYPE_CHAT21;
56
- CHANNEL_TYPE_EMAIL = CHANNEL_TYPE_EMAIL;
57
- CHANNEL_TYPE_FORM = CHANNEL_TYPE_FORM;
58
- CHANNEL_TYPE_MESSANGER = CHANNEL_TYPE_MESSANGER;
59
- CHANNEL_TYPE_WHATSAPP = CHANNEL_TYPE_WHATSAPP;
60
- CHANNEL_TYPE_TELEGRAM = CHANNEL_TYPE_TELEGRAM;
51
+ CHANNEL_TYPE = CHANNEL_TYPE
61
52
 
62
53
  constructor(
63
54
  public imageRepoService: ImageRepoService,
@@ -96,7 +87,7 @@ export class HeaderConversationDetailComponent implements OnInit, OnChanges {
96
87
  // ----------------------------------------------------
97
88
  initialize() {
98
89
  this.getPlatformName()
99
- if ( this.conversationAvatar && this.conversationAvatar.channelType === TYPE_DIRECT ) {
90
+ if (this.conversationAvatar && this.conversationAvatar.channelType === CHANNEL_TYPE.DIRECT ) {
100
91
  this.isDirect = true
101
92
  }
102
93
  }
@@ -9,20 +9,20 @@
9
9
  </div>
10
10
  <!-- EMAIL-OPTION -->
11
11
  <div *ngIf="emailSection" class="section-option" id="email" tooltip="{{translationMap?.get('EMAIL.LABEL_TOOLTIP')}}" placement="top">
12
- <ion-button fill="clear" [class.active]="section==='email'" (click)="onOpenSection('email')" [disabled]="channelType === 'direct'">
12
+ <ion-button fill="clear" [class.active]="section==='email'" (click)="onOpenSection('email')" [disabled]="channelType === 'direct' || channel == CHANNEL_TYPE.WHATSAPP || channel == CHANNEL_TYPE.MESSENGER">
13
13
  <ion-icon name="mail-open"></ion-icon>
14
14
  {{translationMap.get('LABEL_EMAIL')}}
15
15
  </ion-button>
16
16
  </div>
17
17
 
18
18
  <div *ngIf="whatsappTemplatesSection" class="section-option" id="template" tooltip="{{translationMap?.get('WHATSAPP.LABEL_TOOLTIP')}}" placement="top">
19
- <ion-button fill="clear" [class.active]="section==='templates'" (click)="onOpenSection('templates');onOpenTemplateModal()" [disabled]="channel !== CHANNEL_TYPE_WHATSAPP">
19
+ <ion-button fill="clear" [class.active]="section==='templates'" (click)="onOpenSection('templates');onOpenTemplateModal()" [disabled]="channel !== CHANNEL_TYPE.WHATSAPP">
20
20
  <ion-icon name="logo-whatsapp"></ion-icon>
21
21
  {{translationMap?.get('WHATSAPP.LABEL_TEMPLATES')}}
22
22
  </ion-button>
23
23
  </div>
24
24
 
25
- <div *ngIf="section==='chat' && channel !== CHANNEL_TYPE_WHATSAPP && messageString && (leadInfo?.presence['status']==='offline' && leadInfo?.hasEmail)" class="section-option offline-lead-tip" >
25
+ <div *ngIf="section==='chat' && channel !== CHANNEL_TYPE.WHATSAPP && messageString && (leadInfo?.presence['status']==='offline' && leadInfo?.hasEmail)" class="section-option offline-lead-tip" >
26
26
  {{translationMap.get('EMAIL.EMAIL_OFFLINE_TIP')}}
27
27
  </div>
28
28
 
@@ -46,16 +46,16 @@
46
46
  <div class="canned-responses-btn-wpr"
47
47
  tooltip="{{translationMap?.get('CANNED_RESPONSES')}}" placement="top">
48
48
  <ion-button ion-button fill="clear" class="canned-responses-btn" (click)="openCannedResponses()"
49
- [disabled]="!conversationWith?.startsWith(TYPE_SUPPORT_GROUP) || disableTextarea">
49
+ [disabled]="!conversationWith?.startsWith(CHANNEL_TYPE.SUPPORT_GROUP) || disableTextarea">
50
50
  <ion-icon slot="icon-only" name="flash-outline" style="font-size: 24px;"></ion-icon>
51
51
  </ion-button>
52
52
  </div>
53
- <div *ngIf="conversationWith?.startsWith(TYPE_SUPPORT_GROUP) && tagsCannedCount === 0"
53
+ <div *ngIf="conversationWith?.startsWith(CHANNEL_TYPE.SUPPORT_GROUP) && tagsCannedCount === 0"
54
54
  tooltip="{{translationMap?.get('NO_CANNED_RESPONSES')}}" placement="top"
55
55
  class="no-canned-responses-btn-badge">
56
56
  <ion-icon name="alert-sharp" style="vertical-align: middle;"></ion-icon>
57
57
  </div>
58
- <div *ngIf="conversationWith?.startsWith(TYPE_SUPPORT_GROUP) && (tagsCannedCount > 0)"
58
+ <div *ngIf="conversationWith?.startsWith(CHANNEL_TYPE.SUPPORT_GROUP) && (tagsCannedCount > 0)"
59
59
  tooltip="{{translationMap?.get('YES_CANNED_RESPONSES')}}" placement="top" class="canned-responses-btn-badge">
60
60
  <ion-icon name="information-sharp" style="vertical-align: middle;"></ion-icon>
61
61
  </div>
@@ -12,7 +12,7 @@ import { LoaderPreviewPage } from 'src/app/modals/loader-preview/loader-preview.
12
12
  // Services
13
13
  import { UploadService } from 'src/chat21-core/providers/abstract/upload.service';
14
14
  // utils
15
- import { CHANNEL_TYPE_WHATSAPP, TYPE_MSG_EMAIL, TYPE_MSG_TEXT, TYPE_SUPPORT_GROUP } from 'src/chat21-core/utils/constants';
15
+ import { TYPE_MSG_EMAIL, TYPE_MSG_TEXT, CHANNEL_TYPE } from 'src/chat21-core/utils/constants';
16
16
  // Models
17
17
  import { UploadModel } from 'src/chat21-core/models/upload';
18
18
 
@@ -74,9 +74,8 @@ export class MessageTextAreaComponent implements OnInit, AfterViewInit, OnChange
74
74
  public countClicks: number = 0;
75
75
  public IS_ON_MOBILE_DEVICE: boolean;
76
76
 
77
- TYPE_SUPPORT_GROUP = TYPE_SUPPORT_GROUP;
77
+ CHANNEL_TYPE = CHANNEL_TYPE;
78
78
  TYPE_MSG_TEXT = TYPE_MSG_TEXT;
79
- CHANNEL_TYPE_WHATSAPP = CHANNEL_TYPE_WHATSAPP;
80
79
  msg: string
81
80
 
82
81
  section: string= 'chat'
@@ -11,8 +11,6 @@ import { ConversationsHandlerService } from 'src/chat21-core/providers/abstract/
11
11
  import { ActivatedRoute, NavigationEnd, Router } from '@angular/router';
12
12
  import { ContactsService } from 'src/app/services/contacts/contacts.service';
13
13
  import { AppConfigProvider } from '../../../services/app-config';
14
- import { setChannelType } from '../../../../chat21-core/utils/utils';
15
- import { TYPE_SUPPORT_GROUP, TYPE_DIRECT, TYPE_GROUP } from '../../../../chat21-core/utils/constants';
16
14
  import { DomSanitizer } from '@angular/platform-browser';
17
15
 
18
16
  import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
@@ -60,8 +60,7 @@ import {
60
60
  TYPE_DIRECT,
61
61
  TYPE_MSG_EMAIL,
62
62
  TYPE_MSG_FORM,
63
- CHANNEL_TYPE_TELEGRAM,
64
- CHANNEL_TYPE_WHATSAPP,
63
+ CHANNEL_TYPE,
65
64
  INFO_MESSAGE_TYPE
66
65
  } from 'src/chat21-core/utils/constants'
67
66
  import {
@@ -347,8 +346,8 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
347
346
  conv.channel_type,
348
347
  null,
349
348
  conv.attributes['projectId'],
350
- conv.attributes['project_name']),
351
- conv.attributes['channel']
349
+ conv.attributes['project_name'],
350
+ conv.attributes['request_channel'])
352
351
  }
353
352
 
354
353
  }
@@ -1113,17 +1112,18 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1113
1112
 
1114
1113
 
1115
1114
  const emailSectionMsg = (attributes && attributes['offline_channel'] === TYPE_MSG_EMAIL)
1116
- const channelIsNotEmailOrFormOrWhatsappOrTelegram = (attributes && attributes['request_channel'] && (attributes['request_channel'] === TYPE_MSG_EMAIL ||
1115
+ const channelIsNotWeb = (attributes && attributes['request_channel'] && (attributes['request_channel'] === TYPE_MSG_EMAIL ||
1117
1116
  attributes['request_channel'] === TYPE_MSG_FORM ||
1118
- attributes['request_channel'] === CHANNEL_TYPE_WHATSAPP ||
1119
- attributes['request_channel'] === CHANNEL_TYPE_TELEGRAM))
1117
+ attributes['request_channel'] === CHANNEL_TYPE.WHATSAPP ||
1118
+ attributes['request_channel'] === CHANNEL_TYPE.MESSENGER ||
1119
+ attributes['request_channel'] === CHANNEL_TYPE.TELEGRAM))
1120
1120
 
1121
1121
  if ((msg && msg.trim() !== '') || type !== TYPE_MSG_TEXT) {
1122
1122
 
1123
1123
 
1124
1124
  if (this.isEmailEnabled &&
1125
1125
  this.leadInfo && this.leadInfo.presence && this.leadInfo.presence['status'] === 'offline' &&
1126
- this.leadInfo.email && !emailSectionMsg && !channelIsNotEmailOrFormOrWhatsappOrTelegram) {
1126
+ this.leadInfo.email && !emailSectionMsg && !channelIsNotWeb) {
1127
1127
  this.logger.log('[CONVS-DETAIL] - SEND MESSAGE --> SENDING EMAIL', msg, this.leadInfo.email)
1128
1128
  let msgText = this.createEmailText(msg)
1129
1129
  this.sendEmail(msgText).subscribe(status => {
@@ -78,7 +78,8 @@ export class BrandService {
78
78
  COMPANY_SITE_NAME:"tiledesk.com",
79
79
  COMPANY_SITE_URL:"https://www.tiledesk.com",
80
80
  CONTACT_US_EMAIL: "support@tiledesk.com",
81
- COMPANY_PRIMARY_COLOR:""
81
+ COMPANY_PRIMARY_COLOR:"",
82
+ DOCS:false
82
83
  }
83
84
  }
84
85
 
@@ -184,17 +185,17 @@ export class BrandService {
184
185
  if (url && url !== 'CHANGEIT') {
185
186
  const data = await this.httpClient.get(url).toPromise();
186
187
 
187
- console.log('[BRAND-SERV] **** GET BRAND FROM URL ****', url);
188
+ this.logger.log('[BRAND-SERV] **** GET BRAND FROM URL ****', url);
188
189
 
189
190
  this.brand =data
190
191
 
191
- console.log('[BRAND-SERV] loadBrand - brand: ', this.brand);
192
+ this.logger.log('[BRAND-SERV] loadBrand - brand: ', this.brand);
192
193
 
193
194
  const resources = new BrandResources(this);
194
195
  resources.loadResources()
195
196
  }
196
197
  } catch (err) {
197
- console.error('[BRAND-SERV] loadBrand error : ', err);
198
+ this.logger.error('[BRAND-SERV] loadBrand error : ', err);
198
199
 
199
200
  this.brand = this._brand;
200
201
  }
@@ -203,7 +204,7 @@ export class BrandService {
203
204
  }
204
205
 
205
206
  getBrand() {
206
- console.log('BrandService getBrand has been called - brand: ', this.brand);
207
+ //this.logger.log('BrandService getBrand has been called - brand: ', this.brand);
207
208
  return { ...this.brand['CHAT'], ...this.brand['COMMON'] }
208
209
  }
209
210
 
@@ -34,7 +34,7 @@ export class TriggerEvents {
34
34
  const windowContext = this.windowContext;
35
35
  if (windowContext){
36
36
  // window.parent.dispatchEvent(onAuthStateChanged);
37
- window.parent.postMessage({type: "onAuthStateChanged", detail: detailObj}, '*')
37
+ windowContext.postMessage({type: "onAuthStateChanged", detail: detailObj}, '*')
38
38
  // this.el.nativeElement.dispatchEvent(onAuthStateChanged);
39
39
  }
40
40
  } catch (e) {
@@ -49,7 +49,7 @@ export class TriggerEvents {
49
49
  const windowContext = this.windowContext;
50
50
  if (windowContext){
51
51
  // windowContext.document.dispatchEvent(onAfterMessageSend);
52
- window.parent.postMessage({type: "onAfterMessageSend", detail: { message: messageSent }}, '*')
52
+ windowContext.postMessage({type: "onAfterMessageSend", detail: { message: messageSent }}, '*')
53
53
  }
54
54
  } catch (e) {
55
55
  this.logger.error('[TRIGGER-HANDLER] > Error:' + e);
@@ -65,7 +65,7 @@ export class TriggerEvents {
65
65
  const windowContext = this.windowContext;
66
66
  if (windowContext){
67
67
  // windowContext.document.dispatchEvent(onAfterMessageReceived);
68
- window.parent.postMessage({type: "onAfterMessageReceived", detail: { message: message }}, '*')
68
+ windowContext.postMessage({type: "onAfterMessageReceived", detail: { message: message }}, '*')
69
69
  }
70
70
  } catch (e) {
71
71
  this.logger.error('[TRIGGER-HANDLER] > Error:' + e);
@@ -80,7 +80,7 @@ export class TriggerEvents {
80
80
  const windowContext = this.windowContext;
81
81
  if (windowContext){
82
82
  // windowContext.document.dispatchEvent(onNewConversation);
83
- window.parent.postMessage({type: "onNewConversation", detail: { conversation: conversation}}, '*')
83
+ windowContext.postMessage({type: "onNewConversation", detail: { conversation: conversation}}, '*')
84
84
  }
85
85
  } catch (e) {
86
86
  this.logger.error('[TRIGGER-HANDLER] > Error:' + e);
@@ -1,12 +1,4 @@
1
- import { style } from '@angular/animations';
2
1
  import { Injectable } from '@angular/core';
3
- import { BehaviorSubject } from 'rxjs';
4
- import { environment } from '../../environments/environment';
5
-
6
- /** CONSTANTS */
7
- import { CHANNEL_TYPE_GROUP } from 'src/chat21-core/utils/constants';
8
- import { getParameterByName } from 'src/chat21-core/utils/utils';
9
-
10
2
 
11
3
  @Injectable({
12
4
  providedIn: 'root'
@@ -27,7 +27,7 @@
27
27
  "MQTTendpoint": "${MQTT_ENDPOINT}",
28
28
  "APIendpoint": "${MQTT_APIENDPOINT}"
29
29
  },
30
- "apiUrl": "${API_URL}",
30
+ "apiUrl": "${SERVER_BASE_URL}",
31
31
  "brandSrc": "${BRAND_SRC}",
32
32
  "whatsappTemplatesBaseUrl":"${WHATSAPP_TEMPLATES_BASE_URL}",
33
33
  "baseImageUrl": "${API_BASEIMAGE_URL}",
@@ -40,14 +40,17 @@ export const PARENT_PAGE_DETAIL_CONVERSATION = 'dettaglio-conversazione ';
40
40
  export const BCK_COLOR_CONVERSATION_SELECTED = '#EEEEEE ';
41
41
  export const BCK_COLOR_CONVERSATION_UNSELECTED = '#FFFFFF ';
42
42
 
43
- export const TYPE_SUPPORT_GROUP = 'support-group';
44
- export const CHANNEL_TYPE_GROUP = 'group';
45
- export const CHANNEL_TYPE_CHAT21 = 'chat21';
46
- export const CHANNEL_TYPE_EMAIL = 'email';
47
- export const CHANNEL_TYPE_FORM = 'form';
48
- export const CHANNEL_TYPE_MESSANGER = 'messanger';
49
- export const CHANNEL_TYPE_WHATSAPP = 'whatsapp';
50
- export const CHANNEL_TYPE_TELEGRAM = 'telegram';
43
+ export enum CHANNEL_TYPE {
44
+ SUPPORT_GROUP = 'support-group',
45
+ GROUP = 'group',
46
+ DIRECT = 'direct',
47
+ CHAT21 = 'chat21',
48
+ EMAIL = 'email',
49
+ FORM = 'form',
50
+ MESSENGER = 'messenger',
51
+ WHATSAPP = 'whatsapp',
52
+ TELEGRAM = 'telegram'
53
+ }
51
54
 
52
55
  // TYPES MESSAGES
53
56
  export const TYPE_MSG_TEXT = 'text';
@@ -79,7 +82,8 @@ export enum INFO_MESSAGE_TYPE {
79
82
  MEMBER_LEFT_GROUP = "MEMBER_LEFT_GROUP",
80
83
  LEAD_UPDATED = "LEAD_UPDATED",
81
84
  TOUCHING_OPERATOR = "TOUCHING_OPERATOR",
82
- LIVE_PAGE = "LIVE_PAGE"
85
+ LIVE_PAGE = "LIVE_PAGE",
86
+ PLAN_EXPIRED = "PLAN_EXPIRED"
83
87
  }
84
88
 
85
89
 
@@ -1,4 +1,4 @@
1
- import { TYPE_DIRECT, TYPE_SUPPORT_GROUP } from 'src/chat21-core/utils/constants';
1
+ import { CHANNEL_TYPE } from 'src/chat21-core/utils/constants';
2
2
  import { ConversationModel } from 'src/chat21-core/models/conversation';
3
3
  import { Inject, Injectable, OnInit } from '@angular/core';
4
4
  import { avatarPlaceholder, getColorBck } from './utils-user';
@@ -17,7 +17,7 @@ export class ConvertRequestToConversation {
17
17
  return new ConversationModel(
18
18
  request.request_id,
19
19
  request.attributes,
20
- request.request_id && (request.request_id.startsWith('group-') || request.request_id.startsWith('support-group'))? TYPE_SUPPORT_GROUP: TYPE_DIRECT,
20
+ request.request_id && (request.request_id.startsWith('group-') || request.request_id.startsWith('support-group'))? CHANNEL_TYPE.SUPPORT_GROUP: CHANNEL_TYPE.DIRECT,
21
21
  request.lead && request.lead.fullname ? request.lead.fullname: null,
22
22
  request.request_id,
23
23
  request.request_id,
@@ -6,9 +6,8 @@ import {
6
6
  MESSAGE_TYPE_MINE,
7
7
  MESSAGE_TYPE_OTHERS,
8
8
  MAX_WIDTH_IMAGES,
9
- CHANNEL_TYPE_GROUP,
10
- TYPE_SUPPORT_GROUP,
11
- INFO_MESSAGE_TYPE
9
+ INFO_MESSAGE_TYPE,
10
+ CHANNEL_TYPE
12
11
  } from '../../chat21-core/utils/constants';
13
12
 
14
13
  /** */
@@ -153,7 +152,7 @@ export function getSizeImg(message: any, maxWidthImage?: number): any {
153
152
 
154
153
  /** */
155
154
  export function isChannelTypeGroup(channelType: string) {
156
- if (channelType === CHANNEL_TYPE_GROUP || channelType === TYPE_SUPPORT_GROUP) {
155
+ if (channelType === CHANNEL_TYPE.GROUP || channelType === CHANNEL_TYPE.SUPPORT_GROUP) {
157
156
  return true;
158
157
  }
159
158
  return false;
@@ -2,15 +2,13 @@
2
2
  import * as moment from 'moment/moment';
3
3
  // import * as moment from 'moment-timezone';
4
4
  import 'moment/locale/it.js';
5
- import { FIREBASESTORAGE_BASE_URL_IMAGE, STORAGE_PREFIX, TYPE_GROUP } from './constants';
5
+ import { CHANNEL_TYPE } from './constants';
6
6
 
7
7
  import { HttpClient } from '@angular/common/http';
8
8
  import { TranslateHttpLoader } from '@ngx-translate/http-loader';
9
- import { AngularDelegate, ModalController } from '@ionic/angular';
9
+ import { ModalController } from '@ionic/angular';
10
10
  import { ConversationModel } from '../models/conversation';
11
11
 
12
- import { MAX_WIDTH_IMAGES, TYPE_DIRECT, TYPE_SUPPORT_GROUP } from './constants';
13
-
14
12
  import { avatarPlaceholder, getColorBck } from './utils-user';
15
13
 
16
14
  /**
@@ -536,9 +534,9 @@ export function setConversationAvatar(
536
534
 
537
535
  /** */
538
536
  export function setChannelType(conversationWith: string): string {
539
- let channelType = TYPE_DIRECT;
540
- if (conversationWith.includes(TYPE_GROUP + '-')) {
541
- channelType = TYPE_GROUP;
537
+ let channelType = CHANNEL_TYPE.DIRECT;
538
+ if (conversationWith.includes(CHANNEL_TYPE.GROUP + '-')) {
539
+ channelType = CHANNEL_TYPE.GROUP;
542
540
  }
543
541
  return channelType;
544
542
  }