@chat21/chat21-ionic 3.0.94 → 3.0.96-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.
Files changed (56) hide show
  1. package/.github/workflows/docker-community-push-latest.yml +1 -1
  2. package/.github/workflows/docker-image-tag-community-tag-push.yml +1 -1
  3. package/CHANGELOG.md +14 -0
  4. package/package.json +1 -1
  5. package/src/app/app.module.ts +4 -3
  6. package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.ts +18 -15
  7. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.html +2 -2
  8. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.scss +0 -7
  9. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.ts +0 -1
  10. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.html +1 -1
  11. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.scss +0 -15
  12. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.ts +11 -2
  13. package/src/app/chatlib/conversation-detail/message/text/text.component.scss +8 -3
  14. package/src/app/chatlib/list-conversations-component/list-conversations/list-conversations.component.html +1 -2
  15. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.html +5 -0
  16. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.scss +7 -0
  17. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +1 -1
  18. package/src/app/components/navbar/navbar.component.ts +1 -1
  19. package/src/app/pages/conversation-detail/conversation-detail.page.ts +39 -25
  20. package/src/app/services/websocket/websocket.service.ts +3 -3
  21. package/src/assets/i18n/ar.json +1 -0
  22. package/src/assets/i18n/az.json +1 -0
  23. package/src/assets/i18n/de.json +1 -0
  24. package/src/assets/i18n/en.json +1 -0
  25. package/src/assets/i18n/es.json +1 -0
  26. package/src/assets/i18n/fr.json +1 -0
  27. package/src/assets/i18n/it.json +1 -0
  28. package/src/assets/i18n/kk.json +1 -0
  29. package/src/assets/i18n/pt.json +1 -0
  30. package/src/assets/i18n/ru.json +1 -0
  31. package/src/assets/i18n/sr.json +1 -0
  32. package/src/assets/i18n/sv.json +1 -0
  33. package/src/assets/i18n/tr.json +1 -0
  34. package/src/assets/i18n/uk.json +1 -0
  35. package/src/assets/i18n/uz.json +1 -0
  36. package/src/chat21-core/providers/abstract/archivedconversations-handler.service.ts +5 -5
  37. package/src/chat21-core/providers/abstract/conversation-handler.service.ts +6 -6
  38. package/src/chat21-core/providers/abstract/conversations-handler.service.ts +6 -7
  39. package/src/chat21-core/providers/abstract/groups-handler.service.ts +5 -5
  40. package/src/chat21-core/providers/abstract/messagingAuth.service.ts +2 -2
  41. package/src/chat21-core/providers/abstract/presence.service.ts +3 -2
  42. package/src/chat21-core/providers/abstract/typing.service.ts +2 -2
  43. package/src/chat21-core/providers/abstract/upload.service.ts +1 -1
  44. package/src/chat21-core/providers/firebase/firebase-archivedconversations-handler.ts +2 -13
  45. package/src/chat21-core/providers/firebase/firebase-auth-service.ts +1 -1
  46. package/src/chat21-core/providers/firebase/firebase-conversations-handler.ts +1 -11
  47. package/src/chat21-core/providers/firebase/firebase-presence.service.ts +4 -3
  48. package/src/chat21-core/providers/mqtt/mqtt-archivedconversations-handler.ts +1 -34
  49. package/src/chat21-core/providers/mqtt/mqtt-auth-service.ts +0 -6
  50. package/src/chat21-core/providers/mqtt/mqtt-conversation-handler.ts +0 -1
  51. package/src/chat21-core/providers/mqtt/mqtt-conversations-handler.ts +2 -12
  52. package/src/chat21-core/providers/mqtt/mqtt-presence.service.ts +25 -19
  53. package/src/chat21-core/providers/mqtt/mqtt-typing.service.ts +0 -2
  54. package/src/chat21-core/providers/native/native-upload-service.ts +1 -0
  55. package/src/chat21-core/utils/utils-message.ts +69 -16
  56. package/src/chat21-core/utils/utils.ts +97 -97
@@ -14,7 +14,7 @@ jobs:
14
14
  steps:
15
15
  - uses: actions/checkout@v2
16
16
  name: Check out the repo
17
- - uses: docker/build-push-action@v1
17
+ - uses: docker/build-push-action@v2
18
18
  with:
19
19
  username: ${{ secrets.DOCKERHUB_USERNAME }}
20
20
  password: ${{ secrets.DOCKERHUB_TOKEN }}
@@ -13,7 +13,7 @@ jobs:
13
13
  - name: Check out the repo
14
14
  uses: actions/checkout@v2
15
15
  - name: Push to Docker Hub
16
- uses: docker/build-push-action@v1
16
+ uses: docker/build-push-action@v2
17
17
  with:
18
18
  username: ${{ secrets.DOCKERHUB_USERNAME }}
19
19
  password: ${{ secrets.DOCKERHUB_TOKEN }}
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # chat21-ionic ver 3.0
2
2
 
3
+ ### 3.0.96-rc.1
4
+ - added: isFirstMessage, isSameSender, isLastMessage, isFirstMessage function to utils-message
5
+ - added: online/offline status check for offline automatic email -> presence service impl
6
+ - added: websocket as mqtt-presence service dep
7
+ - added: tip message if lead has an email and is offline, when agent is on chat section in conversation-detail footer component
8
+
9
+ ### 3.0.95 in PROD
10
+ - bug-fixed: cannot upload PDF files
11
+
12
+ ### 3.0.95-rc.1
13
+ - added: custom colors to senderFullname to better distinguish the user
14
+ - bug-fixed: cannot read text.trim() of undefined if no text is sent with an image
15
+ - bug-fixed: markdown not split work correctly
16
+
3
17
  ### 3.0.94 in PROD
4
18
  - bug-fixed: error getting projectId during lead detail for conversations with more than 4 segment
5
19
 
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.94",
4
+ "version": "3.0.96-rc.1",
5
5
  "license": "MIT License",
6
6
  "homepage": "https://tiledesk.com/",
7
7
  "repository": {
@@ -29,6 +29,7 @@ import { CHAT_ENGINE_MQTT, CHAT_ENGINE_FIREBASE, UPLOAD_ENGINE_NATIVE } from '..
29
29
  // SERVICES
30
30
  import { AppConfigProvider } from './services/app-config';
31
31
  import { EventsService } from './services/events-service';
32
+ import { WebsocketService } from './services/websocket/websocket.service';
32
33
 
33
34
  // ABSTRACT SERVICES
34
35
  import { MessagingAuthService } from 'src/chat21-core/providers/abstract/messagingAuth.service';
@@ -197,10 +198,10 @@ export function typingFactory(appConfig: AppConfigProvider) {
197
198
  }
198
199
  }
199
200
 
200
- export function presenceFactory(appConfig: AppConfigProvider) {
201
+ export function presenceFactory(chat21Service: Chat21Service, appConfig: AppConfigProvider, webSockerService: WebsocketService) {
201
202
  const config = appConfig.getConfig()
202
203
  if (config.chatEngine === CHAT_ENGINE_MQTT) {
203
- return new MQTTPresenceService();
204
+ return new MQTTPresenceService(chat21Service, webSockerService)
204
205
  } else {
205
206
  return new FirebasePresenceService();
206
207
  }
@@ -317,7 +318,7 @@ const appInitializerFn = (appConfig: AppConfigProvider, logger: NGXLogger) => {
317
318
  {
318
319
  provide: PresenceService,
319
320
  useFactory: presenceFactory,
320
- deps: [AppConfigProvider]
321
+ deps: [Chat21Service, AppConfigProvider, WebsocketService]
321
322
  },
322
323
  {
323
324
  provide: TypingService,
@@ -5,7 +5,7 @@ import { MSG_STATUS_SENT, MSG_STATUS_RETURN_RECEIPT, MSG_STATUS_SENT_SERVER, MAX
5
5
  import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
6
6
  import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
7
7
  import { UploadService } from 'src/chat21-core/providers/abstract/upload.service';
8
- import { isEmojii, isInfo, isMine, messageType } from 'src/chat21-core/utils/utils-message';
8
+ import { isEmojii, isFirstMessage, isInfo, isLastMessage, isMine, isSameSender, messageType } from 'src/chat21-core/utils/utils-message';
9
9
  @Component({
10
10
  selector: 'tiledeskwidget-conversation-content',
11
11
  templateUrl: './conversation-content.component.html',
@@ -255,26 +255,29 @@ export class ConversationContentComponent implements OnInit {
255
255
  }, showDelay);
256
256
  }
257
257
 
258
- isLastMessage(idMessage: string) {
259
- // console.log('idMessage: ' + idMessage + 'id LAST Message: ' + this.messages[this.messages.length - 1].uid);
260
- if (idMessage === this.messages[this.messages.length - 1].uid) {
261
- return true;
262
- }
263
- return false;
258
+ isLastMessage(idMessage: string):boolean {
259
+ return isLastMessage(this.messages, idMessage)
260
+ // if (idMessage === this.messages[this.messages.length - 1].uid) {
261
+ // return true;
262
+ // }
263
+ // return false;
264
264
  }
265
265
 
266
266
  isSameSender(senderId, index):boolean{
267
- if(senderId && this.messages[index - 1] && (senderId === this.messages[index - 1].sender)){
268
- return true;
269
- }
270
- return false;
267
+ return isSameSender(this.messages, senderId, index)
268
+ // if(senderId && this.messages[index - 1] && (senderId === this.messages[index - 1].sender)){
269
+ // return true;
270
+ // }
271
+ // return false;
271
272
  }
272
273
 
274
+
273
275
  isFirstMessage(senderId, index):boolean{
274
- if(senderId && index == 0 && this.messages[index] && (this.messages[index] !== senderId)){
275
- return true;
276
- }
277
- return false;
276
+ return isFirstMessage(this.messages, senderId, index)
277
+ // if(senderId && index == 0 && this.messages[index] && (this.messages[index] !== senderId)){
278
+ // return true;
279
+ // }
280
+ // return false;
278
281
  }
279
282
 
280
283
  hideOutsideElements() {
@@ -121,7 +121,7 @@
121
121
  <!--backgroundColor non viene ancora usato -->
122
122
  <chat-bubble-message class="messages msg_sent" id="message_msg_sent" style="position: relative;"
123
123
  [ngClass]="{'has-metadata': (isImage(message) || isFrame(message)), 'privateMsg': (message?.attributes && message?.attributes?.subtype === 'private')}"
124
- [class.no-background]="(isImage(message) || isFrame(message)) && message?.text.trim() === '' "
124
+ [class.no-background]="(isImage(message) || isFrame(message)) && message?.text && message?.text.trim() === '' "
125
125
  [class.emoticon]="isEmojii(message?.text)"
126
126
  [ngStyle]="{'background': stylesMap.get('bubbleSentBackground'), 'color': stylesMap.get('bubbleSentTextColor')}"
127
127
  [ngClass]="{'button-in-msg' : message.metadata && message.metadata.button}"
@@ -168,7 +168,7 @@
168
168
  <!--backgroundColor non viene ancora usato -->
169
169
  <chat-bubble-message class="messages msg_receive" id="message_msg_receive"
170
170
  [ngClass]="{'has-metadata': (isImage(message) || isFrame(message)), 'privateMsg': (message?.attributes && message?.attributes?.subtype === 'private')}"
171
- [class.no-background]="(isImage(message) || isFrame(message)) && message?.text.trim() === '' "
171
+ [class.no-background]="(isImage(message) || isFrame(message)) && message?.text && message?.text.trim() === '' "
172
172
  [class.emoticon]="isEmojii(message?.text)"
173
173
  [ngStyle]="{'background': stylesMap?.get('bubbleReceivedBackground'), 'color': stylesMap.get('bubbleReceivedTextColor')}"
174
174
  [isSameSender]="isSameSender(message?.sender, i)"
@@ -2,13 +2,6 @@
2
2
  color: lightblue;
3
3
  }
4
4
 
5
- :host .base_sent .msg_sent ::ng-deep div > div > div > chat-text > p > p {
6
- margin-top: 12px !important;
7
- // white-space: nowrap;
8
- // overflow: hidden;
9
- // text-overflow: ellipsis;
10
- }
11
-
12
5
  :host .base_sent .msg_sent ::ng-deep > div > div > chat-image > div {
13
6
  // display: none !important;
14
7
  // border-radius: unset !important;
@@ -50,7 +50,6 @@ export class IonConversationDetailComponent extends ConversationContentComponent
50
50
 
51
51
  isMine = isMine;
52
52
  isInfo = isInfo;
53
- isFirstMessage = isFirstMessage;
54
53
  messageType = messageType;
55
54
  isChannelTypeGroup = isChannelTypeGroup;
56
55
  isEmojii = isEmojii;
@@ -18,7 +18,7 @@
18
18
  <div>
19
19
 
20
20
  <div *ngIf="messageType(MESSAGE_TYPE_OTHERS, message) && !isSameSender"
21
- [style.color]="convertColorToRGBA(fontColor, 65)"
21
+ [style.color]="fullnameColor"
22
22
  [ngStyle]="{'padding': (isImage(message) || isFrame(message))? '10px 16px 8px 16px': '10px 8px 0px 8px'}" class="message_sender_fullname">
23
23
  {{message?.sender_fullname}}
24
24
  </div>
@@ -83,21 +83,6 @@
83
83
  height: auto;
84
84
  object-fit: cover;
85
85
  }
86
-
87
- .message_innerhtml {
88
- margin: 0px;
89
- // padding: 0px 14px;
90
- &.marked {
91
- padding: 8px;
92
- margin-block-start: -1em !important;
93
- margin-block-end: -1em !important;
94
- }
95
-
96
- .text-message {
97
- padding-top: 14px;
98
- }
99
- }
100
-
101
86
  }
102
87
  // > .button-native
103
88
 
@@ -10,7 +10,8 @@ import { TiledeskAuthService } from 'src/chat21-core/providers/tiledesk/tiledesk
10
10
  import * as moment from 'moment';
11
11
  import { ModalController, PopoverController } from '@ionic/angular';
12
12
  import { convertColorToRGBA } from 'src/chat21-core/utils/utils';
13
- import { BubbleInfoPopoverComponent } from 'src/app/components/bubbleMessageInfo-popover/bubbleinfo-popover.component';
13
+ import { getColorBck } from 'src/chat21-core/utils/utils-user';
14
+
14
15
  @Component({
15
16
  selector: 'chat-bubble-message',
16
17
  templateUrl: './bubble-message.component.html',
@@ -53,7 +54,7 @@ export class BubbleMessageComponent implements OnInit, OnChanges {
53
54
  'hide-delay': 200
54
55
  };
55
56
  sizeImage : { width: number, height: number}
56
-
57
+ fullnameColor: string;
57
58
  public logger: LoggerService = LoggerInstance.getInstance()
58
59
 
59
60
  constructor(
@@ -98,6 +99,13 @@ export class BubbleMessageComponent implements OnInit, OnChanges {
98
99
  if (this.message && this.message.metadata && typeof this.message.metadata === 'object') {
99
100
  this.sizeImage = this.getMetadataSize(this.message.metadata)
100
101
  }
102
+
103
+ if(this.fontColor){
104
+ this.fullnameColor = convertColorToRGBA(this.fontColor, 65)
105
+ }
106
+ if(this.message && this.message.sender_fullname && this.message.sender_fullname.trim() !== ''){
107
+ this.fullnameColor = getColorBck(this.message.sender_fullname)
108
+ }
101
109
  }
102
110
 
103
111
 
@@ -257,3 +265,4 @@ export class BubbleMessageComponent implements OnInit, OnChanges {
257
265
 
258
266
 
259
267
  }
268
+
@@ -5,8 +5,8 @@
5
5
  // padding: 0px 14px;
6
6
  &.marked{
7
7
  padding:8px;
8
- margin-block-start: -1em!important;
9
- margin-block-end: -1em!important;
8
+ margin-block-start: 0em!important;
9
+ margin-block-end: 0em!important;
10
10
 
11
11
  a {
12
12
  word-break: break-all
@@ -28,7 +28,12 @@ p {
28
28
  }
29
29
 
30
30
  p ::ng-deep a {
31
- word-break: break-all
31
+ word-break: break-word
32
+ }
33
+
34
+ p ::ng-deep p{
35
+ margin-block-end: 0em;
36
+ margin-block-start: 0em
32
37
  }
33
38
 
34
39
 
@@ -9,7 +9,7 @@
9
9
  </div>
10
10
  </div>
11
11
  <div class="c21-right-conv">
12
- <div class="c21-last-time">{{conversation.time_last_message}}</div>
12
+ <div class="c21-last-time">{{conversation?.timestamp | amTimeAgo}}</div>
13
13
  <div class="truncate c21-name">{{conversation.sender_fullname }}</div>
14
14
  <div *ngIf="conversation.type ==='image'">
15
15
  <div [class.not-read]="conversation.is_new" class="c21-msg" style="float: left; margin-right: 5px;">
@@ -17,7 +17,6 @@
17
17
  width="20px" height="20px" viewBox="0 0 24 24">
18
18
  <path d="M0 0h24v24H0V0z" fill="none"/>
19
19
  <path d="M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4.86 8.86l-3 3.87L9 13.14 6 17h12l-3.86-5.14z"/>
20
- <!-- <title id="altIconTitle">{{ translationMap.get('CLOSED') }}</title> -->
21
20
  </svg>
22
21
  </div>
23
22
  <div [class.not-read]="conversation.is_new" class="truncate c21-msg">{{conversation.last_message_text}}</div>
@@ -14,6 +14,11 @@
14
14
  {{translationMap.get('LABEL_EMAIL')}}
15
15
  </ion-button>
16
16
  </div>
17
+
18
+ <div *ngIf="section==='chat' && messageString && leadInfo?.presence['status']==='offline'" class="section-option offline-lead-tip" >
19
+ {{translationMap.get('EMAIL_OFFLINE_TIP')}}
20
+ </div>
21
+
17
22
  </div>
18
23
 
19
24
  <ion-row id="message-email" [style.display]="section==='email'? 'flex': 'none'">
@@ -33,6 +33,13 @@
33
33
  }
34
34
  }
35
35
  }
36
+
37
+ .offline-lead-tip{
38
+ font-size: 12px;
39
+ width: 100%;
40
+ display: block;
41
+ text-align: right;
42
+ }
36
43
  }
37
44
 
38
45
  #message-email{
@@ -48,7 +48,7 @@ export class MessageTextAreaComponent implements OnInit, AfterViewInit, OnChange
48
48
  @Input() tagsCannedCount: number;
49
49
  @Input() areVisibleCAR: boolean;
50
50
  @Input() supportMode: boolean;
51
- @Input() leadInfo: {lead_id: string, hasEmail: boolean, email: string, projectId: string};
51
+ @Input() leadInfo: {lead_id: string, hasEmail: boolean, email: string, projectId: string, presence: {}};
52
52
  @Input() fileUploadAccept: string;
53
53
  @Input() emailSection: boolean;
54
54
  @Input() isOpenInfoConversation: boolean;
@@ -21,7 +21,7 @@ export class NavbarComponent implements OnInit {
21
21
  private logger: LoggerService = LoggerInstance.getInstance();
22
22
  private tiledeskToken: string;
23
23
 
24
- public projects: Project[];
24
+ public projects: Project[] = [];
25
25
  public project: any = [];
26
26
  private USER_ROLE: string;
27
27
 
@@ -84,6 +84,7 @@ import { TiledeskService } from '../../services/tiledesk/tiledesk.service'
84
84
  import { NetworkService } from '../../services/network-service/network.service'
85
85
  import { EventsService } from '../../services/events-service'
86
86
  import { ScrollbarThemeDirective } from 'src/app/utils/scrollbar-theme.directive'
87
+ import { WebsocketService } from 'src/app/services/websocket/websocket.service';
87
88
 
88
89
  @Component({
89
90
  selector: 'app-conversation-detail',
@@ -114,7 +115,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
114
115
  public groupDetail: GroupModel
115
116
  public messageSelected: any
116
117
  public channelType: string
117
- public leadIsOnline: boolean
118
118
  public lastConnectionDate: string
119
119
  public showMessageWelcome: boolean
120
120
  public openInfoConversation = false
@@ -126,7 +126,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
126
126
  public translationsHeaderMap: Map<string, string> = new Map()
127
127
  public translationsContentMap: Map<string, string> = new Map()
128
128
  public conversationAvatar: any
129
- public leadInfo: {lead_id: string, hasEmail: boolean , email: string, projectId: string};
129
+ public leadInfo: {lead_id: string, hasEmail: boolean , email: string, projectId: string, presence: {}};
130
130
  public liveInfo: {sourcePage: string, sourceTitle: string}
131
131
  public member: UserModel
132
132
  public isFileSelected: boolean
@@ -230,6 +230,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
230
230
  public tiledeskService: TiledeskService,
231
231
  private networkService: NetworkService,
232
232
  private events: EventsService,
233
+ private webSocketService: WebsocketService,
233
234
  private sanitizer: DomSanitizer
234
235
  ) {
235
236
  // Change list on date change
@@ -626,6 +627,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
626
627
 
627
628
  "LABEL_CHAT",
628
629
  "LABEL_EMAIL",
630
+ "EMAIL_OFFLINE_TIP",
629
631
  "EMAIL_PLACEHOLDER",
630
632
  "EMAIL_NOT_FOUND_PLACEHOLDER",
631
633
  "SUBJECT",
@@ -917,8 +919,17 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
917
919
  this.tiledeskService.getRequest(this.conversationWith, projectId, tiledeskToken).subscribe((request: any)=>{
918
920
  that.logger.debug('[CONVS-DETAIL] getLeadDetail - selected REQUEST detail', request)
919
921
  if(request.lead && request.lead.email){
920
- that.leadInfo = {lead_id: request.lead.lead_id, hasEmail: true, email: request.lead.email, projectId: projectId}
922
+ that.leadInfo = {
923
+ lead_id: request.lead.lead_id,
924
+ hasEmail: true,
925
+ email: request.lead.email,
926
+ projectId: projectId,
927
+ presence: {
928
+ status: 'offline'
929
+ }
930
+ }
921
931
  that.presenceService.userIsOnline(this.leadInfo.lead_id);
932
+ that.webSocketService.subscribeToWS_RequesterPresence(projectId, that.leadInfo.lead_id)
922
933
  }
923
934
  }, (error)=>{
924
935
  this.logger.error('[CONVS-DETAIL] - getLeadDetail - GET REQUEST DETAIL - ERROR ', error)
@@ -1022,29 +1033,29 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1022
1033
 
1023
1034
  if ((msg && msg.trim() !== '') || type !== TYPE_MSG_TEXT) {
1024
1035
 
1025
- //FIX TEMPORARY
1026
- this.leadIsOnline = true;
1027
1036
 
1028
- if(this.isEmailEnabled && !this.leadIsOnline && this.leadInfo && this.leadInfo.email && !emailSectionMsg){
1037
+ if(this.isEmailEnabled &&
1038
+ this.leadInfo && this.leadInfo.presence && this.leadInfo.presence['status']=== 'offline' &&
1039
+ this.leadInfo.email && !emailSectionMsg){
1029
1040
  this.logger.log('[CONVS-DETAIL] - SEND MESSAGE --> SENDING EMAIL', msg, this.leadInfo.email)
1030
- // this.sendEmail(msg).subscribe(status => {
1031
- // if(status){
1032
- // //SEND MESSAGE ALSO AS EMAIL
1033
- // attributes['channel']= 'offline_'+TYPE_MSG_EMAIL
1034
- // }
1035
-
1036
- // this.conversationHandlerService.sendMessage(
1037
- // msg,
1038
- // type,
1039
- // metadata,
1040
- // this.conversationWith,
1041
- // this.conversationWithFullname,
1042
- // this.loggedUser.uid,
1043
- // fullname,
1044
- // this.channelType,
1045
- // attributes,
1046
- // )
1047
- // })
1041
+ this.sendEmail(msg).subscribe(status => {
1042
+ if(status){
1043
+ //SEND MESSAGE ALSO AS EMAIL
1044
+ attributes['channel']= 'offline_'+TYPE_MSG_EMAIL
1045
+ }
1046
+
1047
+ this.conversationHandlerService.sendMessage(
1048
+ msg,
1049
+ type,
1050
+ metadata,
1051
+ this.conversationWith,
1052
+ this.conversationWithFullname,
1053
+ this.loggedUser.uid,
1054
+ fullname,
1055
+ this.channelType,
1056
+ attributes,
1057
+ )
1058
+ })
1048
1059
  }else {
1049
1060
  //send STANDARD TEXT MESSAGE
1050
1061
  this.conversationHandlerService.sendMessage(
@@ -1147,7 +1158,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1147
1158
  const userId = data.uid;
1148
1159
  const isOnline = data.isOnline;
1149
1160
  if (this.leadInfo && this.leadInfo.lead_id === userId) {
1150
- this.leadIsOnline = isOnline;
1161
+ this.leadInfo.presence['status'] = isOnline? 'online': 'offline';
1151
1162
  }
1152
1163
  }
1153
1164
  });
@@ -1243,6 +1254,9 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1243
1254
  subscription.value.unsubscribe() // vedere come fare l'unsubscribe!!!!
1244
1255
  })
1245
1256
  this.subscriptions = []
1257
+ if(this.leadInfo){
1258
+ this.webSocketService.unsubscribeToWS_RequesterPresence(this.leadInfo.projectId, this.leadInfo.lead_id)
1259
+ }
1246
1260
 
1247
1261
  // https://www.w3schools.com/jsref/met_element_removeeventlistener.asp
1248
1262
  window.removeEventListener('keyboardWillShow', null)
@@ -307,19 +307,19 @@ export class WebsocketService {
307
307
  this.webSocketJs.ref(path, 'subscribeToWS_RequesterPresence',
308
308
 
309
309
  function (data, notification) {
310
- // self.logger.log("[WS-REQUESTS-SERV] - SUBSCRIBE TO REQUESTER-PRECENCE - CREATE data ", data);
310
+ // this.logger.log("[WS-REQUESTS-SERV] - SUBSCRIBE TO REQUESTER-PRECENCE - CREATE data ", data);
311
311
 
312
312
  self.wsRequesterStatus$.next(data);
313
313
 
314
314
  }, function (data, notification) {
315
- self.logger.log("[WS-REQUESTS-SERV] - SUBSCRIBE TO REQUESTER-PRECENCE - UPDATE data ", data);
315
+ // this.logger.log("[WS-REQUESTS-SERV] - SUBSCRIBE TO REQUESTER-PRECENCE - UPDATE data ", data);
316
316
 
317
317
  self.wsRequesterStatus$.next(data);
318
318
 
319
319
  }, function (data, notification) {
320
320
 
321
321
  if (data) {
322
- // self.logger.log("[WS-REQUESTS-SERV] - SUBSCRIBE TO REQUESTER-PRECENCE - ON-DATA data ", data);
322
+ // this.logger.log("[WS-REQUESTS-SERV] - SUBSCRIBE TO REQUESTER-PRECENCE - ON-DATA data ", data);
323
323
  }
324
324
  }
325
325
  );
@@ -23,6 +23,7 @@
23
23
  ],
24
24
  "LABEL_SEND": "إرسال",
25
25
  "LABEL_CHAT":"دردشة",
26
+ "EMAIL_OFFLINE_TIP":"تحذير: المستخدم غير متصل! سيتم إرسال الرسالة عبر البريد الإلكتروني",
26
27
  "EMAIL_PLACEHOLDER":"المسودة متاحة هنا - انقر للتعديل",
27
28
  "EMAIL_NOT_FOUND_PLACEHOLDER":"لم يقدم هذا المستخدم عنوان بريد إلكتروني. قم بتحديث عنوان الزائر لإرسال بريد إلكتروني",
28
29
  "SUBJECT":"موضوعات",
@@ -23,6 +23,7 @@
23
23
  ],
24
24
  "LABEL_SEND": "Göndər",
25
25
  "LABEL_CHAT":"Söhbət",
26
+ "EMAIL_OFFLINE_TIP":"Xəbərdarlıq: istifadəçi oflayndır! Mesaj e-poçt vasitəsilə göndəriləcək",
26
27
  "EMAIL_PLACEHOLDER":"Qaralama burada mövcuddur - redaktə etmək üçün klikləyin",
27
28
  "EMAIL_NOT_FOUND_PLACEHOLDER":"Bu istifadəçi e-poçt ünvanı təqdim etməyib. E-poçt göndərmək üçün ziyarətçinin ünvanını yeniləyin",
28
29
  "SUBJECT":"Mövzu",
@@ -23,6 +23,7 @@
23
23
  ],
24
24
  "LABEL_SEND": "Senden",
25
25
  "LABEL_CHAT":"Plaudern",
26
+ "EMAIL_OFFLINE_TIP":"Achtung: Benutzer ist offline! Die Nachricht wird per E-Mail versendet",
26
27
  "EMAIL_PLACEHOLDER":"Entwurf hier verfügbar - zum Bearbeiten klicken",
27
28
  "EMAIL_NOT_FOUND_PLACEHOLDER":"Dieser Benutzer hat keine E-Mail-Adresse angegeben. Aktualisieren Sie die Adresse des Besuchers, um eine E-Mail zu senden",
28
29
  "SUBJECT":"Thema",
@@ -23,6 +23,7 @@
23
23
  ],
24
24
  "LABEL_SEND": "Send",
25
25
  "LABEL_CHAT":"Chat",
26
+ "EMAIL_OFFLINE_TIP":"Warning: user is offline! The message will be sent by email",
26
27
  "EMAIL_PLACEHOLDER":"Draft available here - click to edit",
27
28
  "EMAIL_NOT_FOUND_PLACEHOLDER":"This user has not provided an email address. Update the visitor's address to send an email",
28
29
  "SUBJECT":"Subject",
@@ -23,6 +23,7 @@
23
23
  ],
24
24
  "LABEL_SEND": "Send",
25
25
  "LABEL_CHAT":"Charla",
26
+ "EMAIL_OFFLINE_TIP":"Advertencia: ¡el usuario está desconectado! El mensaje será enviado por correo electrónico",
26
27
  "EMAIL_PLACEHOLDER":"Borrador disponible aquí - haga clic para editar",
27
28
  "EMAIL_NOT_FOUND_PLACEHOLDER":"Este usuario no ha proporcionado una dirección de correo electrónico. Actualizar la dirección del visitante para enviar un correo electrónico",
28
29
  "SUBJECT":"Sujeto",
@@ -23,6 +23,7 @@
23
23
  ],
24
24
  "LABEL_SEND": "Envoyer",
25
25
  "LABEL_CHAT":"Chatter",
26
+ "EMAIL_OFFLINE_TIP":"Attention : l'utilisateur est hors ligne ! Le message sera envoyé par email",
26
27
  "EMAIL_PLACEHOLDER":"Brouillon disponible ici - cliquez pour modifier",
27
28
  "EMAIL_NOT_FOUND_PLACEHOLDER":"Cet utilisateur n'a pas fourni d'adresse e-mail. Mettre à jour l'adresse du visiteur pour envoyer un e-mail",
28
29
  "SUBJECT":"Matière",
@@ -23,6 +23,7 @@
23
23
  ],
24
24
  "LABEL_SEND": "Invia",
25
25
  "LABEL_CHAT":"Chat",
26
+ "EMAIL_OFFLINE_TIP":"Attenzione: l'utente è offline! Il messaggio sarà mandato per email",
26
27
  "EMAIL_PLACEHOLDER":"Bozza disponibile qui - clicca per modificare",
27
28
  "EMAIL_NOT_FOUND_PLACEHOLDER":"Questo utente non ha fornito un indirizzo email. Aggiorna l'indirizzo del visitatore per inviare un'e-mail",
28
29
  "SUBJECT":"Oggetto",
@@ -23,6 +23,7 @@
23
23
  ],
24
24
  "LABEL_SEND": "Жіберу",
25
25
  "LABEL_CHAT":"Чат",
26
+ "EMAIL_OFFLINE_TIP":"Ескерту: пайдаланушы желіден тыс! Хабарлама электрондық пошта арқылы жіберіледі",
26
27
  "EMAIL_PLACEHOLDER":"Жоба осы жерде қолжетімді - өңдеу үшін басыңыз",
27
28
  "EMAIL_NOT_FOUND_PLACEHOLDER":"Бұл пайдаланушы электрондық пошта мекенжайын көрсетпеді. Электрондық поштаны жіберу үшін келушінің мекенжайын жаңартыңыз",
28
29
  "SUBJECT":"Тақырып",
@@ -23,6 +23,7 @@
23
23
  ],
24
24
  "LABEL_SEND": "Mandar",
25
25
  "LABEL_CHAT":"Bater papo",
26
+ "EMAIL_OFFLINE_TIP":"Aviso: o usuário está offline! A mensagem será enviada por e-mail",
26
27
  "EMAIL_PLACEHOLDER":"Rascunho disponível aqui - clique para editar",
27
28
  "EMAIL_NOT_FOUND_PLACEHOLDER":"Este usuário não forneceu um endereço de e-mail. Atualize o endereço do visitante para enviar um e-mail",
28
29
  "SUBJECT":"Sujeito",
@@ -23,6 +23,7 @@
23
23
  ],
24
24
  "LABEL_SEND": "Отправлять",
25
25
  "LABEL_CHAT":"Чат",
26
+ "EMAIL_OFFLINE_TIP":"Внимание: пользователь не в сети! Сообщение будет отправлено по электронной почте",
26
27
  "EMAIL_PLACEHOLDER":"Черновик доступен здесь - нажмите, чтобы изменить",
27
28
  "EMAIL_NOT_FOUND_PLACEHOLDER":"Этот пользователь не указал адрес электронной почты. Обновите адрес посетителя, чтобы отправить электронное письмо",
28
29
  "SUBJECT":"Предмет",
@@ -23,6 +23,7 @@
23
23
  ],
24
24
  "LABEL_SEND": "Пошаљи",
25
25
  "LABEL_CHAT":"Ћаскање",
26
+ "EMAIL_OFFLINE_TIP":"Упозорење: корисник није на мрежи! Порука ће бити послата е-поштом",
26
27
  "EMAIL_PLACEHOLDER":"Нацрт је доступан овде - кликните да бисте уредили",
27
28
  "EMAIL_NOT_FOUND_PLACEHOLDER":"Овај корисник није навео адресу е-поште. Ажурирајте адресу посетиоца да бисте послали е-поштуОвај корисник није навео адресу е-поште. Ажурирајте адресу посетиоца да бисте послали е-пошту",
28
29
  "SUBJECT":"Предмет",
@@ -23,6 +23,7 @@
23
23
  ],
24
24
  "LABEL_SEND": "Skicka",
25
25
  "LABEL_CHAT":"Chat",
26
+ "EMAIL_OFFLINE_TIP":"Varning: användaren är offline! Meddelandet kommer att skickas via e-post",
26
27
  "EMAIL_PLACEHOLDER":"Utkast tillgängligt här - klicka för att redigera",
27
28
  "EMAIL_NOT_FOUND_PLACEHOLDER":"Den här användaren har inte angett någon e-postadress. Uppdatera besökarens adress för att skicka ett e-postmeddelande",
28
29
  "SUBJECT":"Ämne",
@@ -23,6 +23,7 @@
23
23
  ],
24
24
  "LABEL_SEND": "Göndermek",
25
25
  "LABEL_CHAT":"Sohbet",
26
+ "EMAIL_OFFLINE_TIP":"Uyarı: kullanıcı çevrimdışı! Mesaj e-posta ile gönderilecek",
26
27
  "EMAIL_PLACEHOLDER":"Taslak burada mevcut - düzenlemek için tıklayın",
27
28
  "EMAIL_NOT_FOUND_PLACEHOLDER":"Bu kullanıcı bir e-posta adresi sağlamadı. E-posta göndermek için ziyaretçinin adresini güncelleyin",
28
29
  "SUBJECT":"Ders",
@@ -23,6 +23,7 @@
23
23
  ],
24
24
  "LABEL_SEND": "Надіслати",
25
25
  "LABEL_CHAT":"Чат",
26
+ "EMAIL_OFFLINE_TIP":"Попередження: користувач офлайн! Повідомлення буде надіслано електронною поштою",
26
27
  "EMAIL_PLACEHOLDER":"Чернетка доступна тут - натисніть, щоб змінити",
27
28
  "EMAIL_NOT_FOUND_PLACEHOLDER":"Цей користувач не вказав адресу електронної пошти. Оновіть адресу відвідувача, щоб надіслати електронний лист",
28
29
  "SUBJECT":"Тема",
@@ -24,6 +24,7 @@
24
24
  ],
25
25
  "LABEL_SEND": "Yuborish",
26
26
  "LABEL_CHAT":"Chat",
27
+ "EMAIL_OFFLINE_TIP":"Ogohlantirish: foydalanuvchi oflayn! Xabar elektron pochta orqali yuboriladi",
27
28
  "EMAIL_PLACEHOLDER":"Qoralama bu yerda mavjud - tahrirlash uchun bosing",
28
29
  "EMAIL_NOT_FOUND_PLACEHOLDER":"Bu foydalanuvchi elektron pochta manzilini ko'rsatmagan. Elektron pochta xabarini yuborish uchun tashrif buyuruvchining manzilini yangilang",
29
30
  "SUBJECT":"Mavzu",