@chat21/chat21-ionic 3.0.85 → 3.0.86-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 +116 -4
- package/README.md +2 -2
- package/deploy_amazon_beta.sh +29 -0
- package/deploy_amazon_prod.sh +30 -0
- package/package.json +4 -3
- package/src/app/app-routing.module.ts +7 -2
- package/src/app/app.component.html +7 -1
- package/src/app/app.component.scss +20 -2
- package/src/app/app.component.ts +130 -19
- package/src/app/app.module.ts +8 -3
- package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.ts +8 -1
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.html +86 -23
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.scss +188 -88
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.ts +42 -3
- package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.html +11 -24
- package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.scss +6 -10
- package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.spec.ts +2 -2
- package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.ts +16 -26
- package/src/app/chatlib/conversation-detail/message/buttons/action-button/action-button.component.html +5 -1
- package/src/app/chatlib/conversation-detail/message/buttons/action-button/action-button.component.scss +22 -15
- package/src/app/chatlib/conversation-detail/message/buttons/action-button/action-button.component.ts +25 -5
- package/src/app/chatlib/conversation-detail/message/buttons/link-button/link-button.component.html +2 -1
- package/src/app/chatlib/conversation-detail/message/buttons/link-button/link-button.component.scss +14 -15
- package/src/app/chatlib/conversation-detail/message/buttons/link-button/link-button.component.ts +24 -5
- package/src/app/chatlib/conversation-detail/message/buttons/text-button/text-button.component.html +6 -1
- package/src/app/chatlib/conversation-detail/message/buttons/text-button/text-button.component.scss +12 -13
- package/src/app/chatlib/conversation-detail/message/buttons/text-button/text-button.component.ts +26 -5
- package/src/app/chatlib/conversation-detail/message/frame/frame.component.html +8 -2
- package/src/app/chatlib/conversation-detail/message/frame/frame.component.scss +36 -0
- package/src/app/chatlib/conversation-detail/message/frame/frame.component.ts +2 -2
- package/src/app/chatlib/conversation-detail/message/html/html.component.ts +0 -1
- package/src/app/chatlib/conversation-detail/message/image/image.component.html +3 -2
- package/src/app/chatlib/conversation-detail/message/image/image.component.scss +17 -5
- package/src/app/chatlib/conversation-detail/message/image/image.component.ts +1 -1
- package/src/app/chatlib/conversation-detail/message/info-message/info-message.component.scss +3 -2
- package/src/app/chatlib/conversation-detail/message/message-attachment/message-attachment.component.html +16 -6
- package/src/app/chatlib/conversation-detail/message/message-attachment/message-attachment.component.scss +1 -3
- package/src/app/chatlib/conversation-detail/message/message-attachment/message-attachment.component.ts +2 -0
- package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.html +78 -52
- package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.scss +63 -20
- package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.ts +14 -10
- package/src/app/components/canned-response/canned-response.component.html +9 -9
- package/src/app/components/canned-response/canned-response.component.scss +14 -7
- package/src/app/components/canned-response/canned-response.component.ts +5 -4
- package/src/app/components/contacts-directory/contacts-directory.component.html +22 -26
- package/src/app/components/contacts-directory/contacts-directory.component.scss +8 -6
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.html +64 -47
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.scss +98 -61
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.ts +24 -40
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component_2.html +116 -0
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.html +39 -42
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.scss +67 -4
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +82 -152
- package/src/app/components/conversation-info/info-content/info-content.component.html +23 -2
- package/src/app/components/conversation-info/info-content/info-content.component.ts +5 -6
- package/src/app/components/conversation-info/info-direct/info-direct.component.html +7 -14
- package/src/app/components/conversation-info/info-direct/info-direct.component.scss +23 -0
- package/src/app/components/conversation-info/info-direct/info-direct.component.ts +1 -6
- package/src/app/components/conversation-info/info-group/info-group.component.html +44 -108
- package/src/app/components/conversation-info/info-group/info-group.component.scss +101 -61
- package/src/app/components/conversation-info/info-group/info-group.component.ts +1 -0
- package/src/app/components/conversation-info/info-support-group/info-support-group.component.html +2 -1
- package/src/app/components/conversation-info/info-support-group/info-support-group.component.ts +0 -1
- package/src/app/components/{ddp-header/ddp-header.component.html → conversations-list/header-conversations-list/header-conversations-list.component.html} +3 -3
- package/src/app/components/{ddp-header/ddp-header.component.scss → conversations-list/header-conversations-list/header-conversations-list.component.scss} +16 -4
- package/src/app/components/{conversation-detail/bubble-my-message/bubble-my-message.component.spec.ts → conversations-list/header-conversations-list/header-conversations-list.component.spec.ts} +6 -6
- package/src/app/components/{ddp-header/ddp-header.component.ts → conversations-list/header-conversations-list/header-conversations-list.component.ts} +7 -16
- package/src/app/components/conversations-list/header-conversations-list-archived/header-conversations-list-archived.component.html +12 -0
- package/src/app/components/conversations-list/header-conversations-list-archived/header-conversations-list-archived.component.scss +14 -0
- package/src/app/components/{conversation-detail/option-header/option-header.component.spec.ts → conversations-list/header-conversations-list-archived/header-conversations-list-archived.component.spec.ts} +5 -5
- package/src/app/components/{conversation-detail/option-header/option-header.component.ts → conversations-list/header-conversations-list-archived/header-conversations-list-archived.component.ts} +5 -4
- package/src/app/components/navbar/navbar.component.html +103 -0
- package/src/app/components/navbar/navbar.component.scss +249 -0
- package/src/app/components/{ddp-header/ddp-header.component.spec.ts → navbar/navbar.component.spec.ts} +6 -6
- package/src/app/components/navbar/navbar.component.ts +190 -0
- package/src/app/components/project-item/project-item.component.html +98 -149
- package/src/app/components/project-item/project-item.component.scss +43 -35
- package/src/app/components/project-item/project-item.component.ts +16 -4
- package/src/app/components/sidebar-user-details/sidebar-user-details.component.html +5 -5
- package/src/app/components/sidebar-user-details/sidebar-user-details.component.ts +24 -13
- package/src/app/components/utils/user-presence/user-presence.component.html +7 -2
- package/src/app/components/utils/user-presence/user-presence.component.scss +35 -18
- package/src/app/components/utils/user-presence/user-presence.component.ts +6 -10
- package/src/app/{pages → modals}/create-canned-response/create-canned-response-routing.module.ts +0 -0
- package/src/app/{pages → modals}/create-canned-response/create-canned-response.module.ts +0 -0
- package/src/app/{pages → modals}/create-canned-response/create-canned-response.page.html +0 -0
- package/src/app/{pages → modals}/create-canned-response/create-canned-response.page.scss +0 -0
- package/src/app/{pages → modals}/create-canned-response/create-canned-response.page.spec.ts +0 -0
- package/src/app/{pages → modals}/create-canned-response/create-canned-response.page.ts +13 -13
- package/src/app/{pages → modals}/loader-preview/loader-preview-routing.module.ts +0 -0
- package/src/app/{pages → modals}/loader-preview/loader-preview.module.ts +0 -0
- package/src/app/{pages → modals}/loader-preview/loader-preview.page.html +1 -1
- package/src/app/{pages → modals}/loader-preview/loader-preview.page.scss +4 -0
- package/src/app/{pages → modals}/loader-preview/loader-preview.page.spec.ts +0 -0
- package/src/app/{pages → modals}/loader-preview/loader-preview.page.ts +1 -2
- package/src/app/modals/send-email/send-email-routing.module.ts +17 -0
- package/src/app/modals/send-email/send-email.module.ts +31 -0
- package/src/app/modals/send-email/send-email.page.html +46 -0
- package/src/app/modals/send-email/send-email.page.scss +161 -0
- package/src/app/modals/send-email/send-email.page.spec.ts +24 -0
- package/src/app/modals/send-email/send-email.page.ts +89 -0
- package/src/app/pages/contacts-directory/contacts-directory.page.html +1 -1
- package/src/app/pages/contacts-directory/contacts-directory.page.scss +47 -0
- package/src/app/pages/contacts-directory/contacts-directory.page.ts +2 -0
- package/src/app/pages/conversation-detail/conversation-detail.module.ts +0 -8
- package/src/app/pages/conversation-detail/conversation-detail.page.html +48 -27
- package/src/app/pages/conversation-detail/conversation-detail.page.scss +45 -254
- package/src/app/pages/conversation-detail/conversation-detail.page.ts +325 -135
- package/src/app/pages/conversations-list/conversations-list.page.html +11 -8
- package/src/app/pages/conversations-list/conversations-list.page.scss +18 -2
- package/src/app/pages/conversations-list/conversations-list.page.ts +26 -24
- package/src/app/pages/profile-info/profile-info.page.html +2 -4
- package/src/app/pages/unassigned-conversations/unassigned-conversations.page.html +1 -1
- package/src/app/pages/unassigned-conversations/unassigned-conversations.page.scss +42 -0
- package/src/app/pages/unassigned-conversations/unassigned-conversations.page.ts +1 -0
- package/src/app/services/canned-responses/canned-responses.service.ts +26 -0
- package/src/app/services/projects/projects.service.spec.ts +12 -0
- package/src/app/services/projects/projects.service.ts +43 -0
- package/src/app/services/tiledesk/tiledesk.service.ts +33 -17
- package/src/app/services/websocket/websocket.service.ts +1 -1
- package/src/app/shared/shared.module.ts +24 -33
- package/src/app/utils/toast.spec.ts +7 -0
- package/src/app/utils/toast.ts +48 -0
- package/src/assets/i18n/ar.json +288 -265
- package/src/assets/i18n/az.json +24 -1
- package/src/assets/i18n/de.json +25 -2
- package/src/assets/i18n/en.json +25 -2
- package/src/assets/i18n/es.json +26 -3
- package/src/assets/i18n/fr.json +24 -1
- package/src/assets/i18n/it.json +24 -1
- package/src/assets/i18n/kk.json +25 -2
- package/src/assets/i18n/pt.json +25 -2
- package/src/assets/i18n/ru.json +24 -1
- package/src/assets/i18n/sr.json +287 -264
- package/src/assets/i18n/sv.json +25 -2
- package/src/assets/i18n/tr.json +25 -2
- package/src/assets/i18n/uk.json +25 -2
- package/src/assets/i18n/uz.json +24 -1
- package/src/assets/js/chat21client.js +1 -1
- package/src/assets/sounds/interface-start.mp3 +0 -0
- package/src/assets/sounds/wheep-wheep.mp3 +0 -0
- package/src/chat-config-mqtt-localhost.json +2 -2
- package/src/chat-config-native-mqtt.json +3 -0
- package/src/chat21-core/models/conversation.ts +0 -1
- package/src/chat21-core/models/projects.ts +27 -0
- package/src/chat21-core/providers/firebase/firebase-typing.service.ts +7 -9
- package/src/chat21-core/providers/mqtt/mqtt-auth-service.ts +7 -8
- package/src/chat21-core/utils/constants.ts +7 -1
- package/src/chat21-core/utils/convertRequestToConversation.ts +41 -0
- package/src/chat21-core/utils/user-typing/user-typing.component.html +8 -5
- package/src/chat21-core/utils/user-typing/user-typing.component.scss +87 -17
- package/src/chat21-core/utils/user-typing/user-typing.component.ts +12 -94
- package/src/chat21-core/utils/utils.ts +41 -11
- package/src/global.scss +59 -255
- package/src/index.html +0 -9
- package/src/variables.scss +30 -10
- package/src/app/components/conversation-detail/bubble-day-message/bubble-day-message.component.html +0 -3
- package/src/app/components/conversation-detail/bubble-day-message/bubble-day-message.component.scss +0 -21
- package/src/app/components/conversation-detail/bubble-day-message/bubble-day-message.component.spec.ts +0 -24
- package/src/app/components/conversation-detail/bubble-day-message/bubble-day-message.component.ts +0 -14
- package/src/app/components/conversation-detail/bubble-my-message/bubble-my-message.component.html +0 -54
- package/src/app/components/conversation-detail/bubble-my-message/bubble-my-message.component.scss +0 -98
- package/src/app/components/conversation-detail/bubble-my-message/bubble-my-message.component.ts +0 -84
- package/src/app/components/conversation-detail/bubble-others-message/bubble-others-message.component.html +0 -30
- package/src/app/components/conversation-detail/bubble-others-message/bubble-others-message.component.scss +0 -83
- package/src/app/components/conversation-detail/bubble-others-message/bubble-others-message.component.spec.ts +0 -24
- package/src/app/components/conversation-detail/bubble-others-message/bubble-others-message.component.ts +0 -68
- package/src/app/components/conversation-detail/bubble-system-message/bubble-system-message.component.html +0 -3
- package/src/app/components/conversation-detail/bubble-system-message/bubble-system-message.component.scss +0 -10
- package/src/app/components/conversation-detail/bubble-system-message/bubble-system-message.component.spec.ts +0 -24
- package/src/app/components/conversation-detail/bubble-system-message/bubble-system-message.component.ts +0 -14
- package/src/app/components/conversation-detail/option-header/option-header.component.html +0 -13
- package/src/app/components/conversation-detail/option-header/option-header.component.scss +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TYPE_DIRECT } from 'src/chat21-core/utils/constants';
|
|
2
|
-
import {
|
|
2
|
+
import { URL_SOUND_LIST_CONVERSATION } from './../../../chat21-core/utils/constants'
|
|
3
3
|
import {
|
|
4
4
|
Component,
|
|
5
5
|
OnInit,
|
|
@@ -50,7 +50,7 @@ import { CannedResponsesService } from '../../services/canned-responses/canned-r
|
|
|
50
50
|
import { compareValues, getDateDifference, htmlEntities } from '../../../chat21-core/utils/utils'
|
|
51
51
|
import { ImageRepoService } from 'src/chat21-core/providers/abstract/image-repo.service'
|
|
52
52
|
import { PresenceService } from 'src/chat21-core/providers/abstract/presence.service'
|
|
53
|
-
import { CreateCannedResponsePage } from 'src/app/
|
|
53
|
+
import { CreateCannedResponsePage } from 'src/app/modals/create-canned-response/create-canned-response.page'
|
|
54
54
|
// utils
|
|
55
55
|
import {
|
|
56
56
|
TYPE_MSG_TEXT,
|
|
@@ -111,22 +111,20 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
111
111
|
public groupDetail: GroupModel
|
|
112
112
|
public messageSelected: any
|
|
113
113
|
public channelType: string
|
|
114
|
-
public
|
|
114
|
+
public leadIsOnline: boolean
|
|
115
115
|
public lastConnectionDate: string
|
|
116
116
|
public showMessageWelcome: boolean
|
|
117
117
|
public openInfoConversation = false
|
|
118
|
-
public openInfoMessage: boolean // check is open info message
|
|
119
118
|
public isMobile = false
|
|
120
119
|
public isLessThan991px = false // nk added
|
|
121
|
-
public isTyping = false
|
|
122
|
-
public nameUserTypingNow: string
|
|
123
120
|
|
|
124
121
|
public heightMessageTextArea = ''
|
|
125
|
-
public
|
|
122
|
+
public translationsMap: Map<string, string> = new Map()
|
|
123
|
+
public translationsHeaderMap: Map<string, string> = new Map()
|
|
124
|
+
public translationsContentMap: Map<string, string> = new Map()
|
|
126
125
|
public conversationAvatar: any
|
|
127
|
-
public
|
|
126
|
+
public leadInfo: {lead_id: string, hasEmail: boolean , email: string, projectId: string};
|
|
128
127
|
public member: UserModel
|
|
129
|
-
public urlConversationSupportGroup: any
|
|
130
128
|
public isFileSelected: boolean
|
|
131
129
|
public showIonContent = false
|
|
132
130
|
public conv_type: string
|
|
@@ -150,7 +148,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
150
148
|
//SOUND
|
|
151
149
|
setTimeoutSound: any;
|
|
152
150
|
audio: any;
|
|
153
|
-
isOpenInfoConversation: boolean;
|
|
154
151
|
USER_HAS_OPENED_CLOSE_INFO_CONV: boolean = false;
|
|
155
152
|
isHovering: boolean = false;
|
|
156
153
|
conversation_count: number;
|
|
@@ -172,6 +169,15 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
172
169
|
public disableTextarea: boolean;
|
|
173
170
|
appsidebarIsWide: boolean;
|
|
174
171
|
|
|
172
|
+
// ========== begin:: typying =======
|
|
173
|
+
public isTypings = false;
|
|
174
|
+
public isDirect = false;
|
|
175
|
+
public idUserTypingNow: string;
|
|
176
|
+
public nameUserTypingNow: string;
|
|
177
|
+
private setTimeoutWritingMessages;
|
|
178
|
+
membersConversation = ['SYSTEM'];
|
|
179
|
+
// ========== end:: typying =======
|
|
180
|
+
|
|
175
181
|
/**
|
|
176
182
|
* Constructor
|
|
177
183
|
* @param route
|
|
@@ -210,13 +216,17 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
210
216
|
public archivedConversationsHandlerService: ArchivedConversationsHandlerService,
|
|
211
217
|
public conversationHandlerService: ConversationHandlerService,
|
|
212
218
|
public groupService: GroupsHandlerService,
|
|
219
|
+
public contactsService: ContactsService,
|
|
213
220
|
public conversationHandlerBuilderService: ConversationHandlerBuilderService,
|
|
214
221
|
public cannedResponsesService: CannedResponsesService,
|
|
222
|
+
public imageRepoService: ImageRepoService,
|
|
215
223
|
public presenceService: PresenceService,
|
|
216
224
|
public toastController: ToastController,
|
|
217
225
|
public tiledeskService: TiledeskService,
|
|
218
226
|
private networkService: NetworkService,
|
|
219
227
|
private events: EventsService,
|
|
228
|
+
private renderer: Renderer2,
|
|
229
|
+
private el: ElementRef
|
|
220
230
|
) {
|
|
221
231
|
// Change list on date change
|
|
222
232
|
this.route.paramMap.subscribe((params) => {
|
|
@@ -236,21 +246,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
236
246
|
// -----------------------------------------------------------
|
|
237
247
|
ngOnInit() {
|
|
238
248
|
this.logger.log('[CONVS-DETAIL] > ngOnInit - window.location: ', window.location);
|
|
239
|
-
|
|
240
|
-
// const accept_files = this.appConfigProvider.getConfig().fileUploadAccept;
|
|
241
|
-
// this.logger.log('[CONVS-DETAIL] > ngOnInit - fileUploadAccept typeof accept_files ', typeof accept_files);
|
|
242
|
-
// const accept_files_array = accept_files.split(',')
|
|
243
|
-
// this.logger.log('[CONVS-DETAIL] > ngOnInit - fileUploadAccept accept_files_array ', accept_files_array);
|
|
244
|
-
// this.logger.log('[CONVS-DETAIL] > ngOnInit - fileUploadAccept accept_files_array typeof: ', typeof accept_files_array);
|
|
245
|
-
|
|
246
|
-
// accept_files_array.forEach(accept_file => {
|
|
247
|
-
// this.logger.log('[CONVS-DETAIL] > ngOnInit - fileUploadAccept accept_file ', accept_file);
|
|
248
|
-
// const accept_file_segment = accept_file.split('/')
|
|
249
|
-
// this.logger.log('[CONVS-DETAIL] > ngOnInit - fileUploadAccept accept_file_segment ', accept_file_segment);
|
|
250
|
-
// if (accept_file_segment[1] === '*') {
|
|
251
|
-
|
|
252
|
-
// }
|
|
253
|
-
// });
|
|
249
|
+
|
|
254
250
|
this.getConversations();
|
|
255
251
|
this.watchToConnectionStatus();
|
|
256
252
|
this.getOSCODE();
|
|
@@ -271,21 +267,21 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
271
267
|
// console.log('[CONVS-DETAIL] HAS CLICKED ENLARGE SIDEBAR WIDE chatAreaEle ', chatAreaEle)
|
|
272
268
|
|
|
273
269
|
if (event && event.data && event.data.action && event.data.action === 'openAppsSidebarWideMode' && event.data.parameter === true) {
|
|
274
|
-
this.logger.log('[CONVS-DETAIL]
|
|
270
|
+
this.logger.log('[CONVS-DETAIL] openAppsSidebarWideMode EVENT-> open' )
|
|
275
271
|
this.appsidebarIsWide = true
|
|
276
272
|
// chat21InfoConversationEle.classList.add("info-convs-apps-sidebar-wide");
|
|
277
273
|
// chatAreaEle.classList.add("chat-area-apps-sidebar-wide");
|
|
278
274
|
}
|
|
279
275
|
|
|
280
276
|
if (event && event.data && event.data.action && event.data.action === 'openAppsSidebarWideMode' && event.data.parameter === false) {
|
|
281
|
-
this.logger.log('[CONVS-DETAIL]
|
|
277
|
+
this.logger.log('[CONVS-DETAIL] openAppsSidebarWideMode EVENT-> close')
|
|
282
278
|
this.appsidebarIsWide = false
|
|
283
279
|
// chat21InfoConversationEle.classList.remove("info-convs-apps-sidebar-wide");
|
|
284
280
|
// chatAreaEle.classList.remove("chat-area-apps-sidebar-wide");
|
|
285
281
|
}
|
|
286
282
|
|
|
287
283
|
if (event && event.data && event.data.action && event.data.action === 'closeAppsSidebarWideMode' && event.data.parameter === true) {
|
|
288
|
-
this.logger.log('[CONVS-DETAIL]
|
|
284
|
+
this.logger.log('[CONVS-DETAIL] closeAppsSidebarWideMode EVENT-> close')
|
|
289
285
|
this.appsidebarIsWide = false
|
|
290
286
|
// chat21InfoConversationEle.classList.remove("info-convs-apps-sidebar-wide");
|
|
291
287
|
// chatAreaEle.classList.remove("chat-area-apps-sidebar-wide");
|
|
@@ -335,7 +331,13 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
335
331
|
// this.updateConversationBadge()
|
|
336
332
|
// }
|
|
337
333
|
if(conv.uid && conv.uid === this.conversationWith){
|
|
338
|
-
this.conversationAvatar = setConversationAvatar(
|
|
334
|
+
this.conversationAvatar = setConversationAvatar(
|
|
335
|
+
conv.conversation_with,
|
|
336
|
+
conv.conversation_with_fullname,
|
|
337
|
+
conv.channel_type,
|
|
338
|
+
null,
|
|
339
|
+
conv.attributes['projectId'],
|
|
340
|
+
conv.attributes['project_name'])
|
|
339
341
|
}
|
|
340
342
|
|
|
341
343
|
}
|
|
@@ -473,6 +475,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
473
475
|
this.loggedUser = this.tiledeskAuthService.getCurrentUser()
|
|
474
476
|
this.logger.log('[CONVS-DETAIL] - initialize -> loggedUser: ', this.loggedUser)
|
|
475
477
|
this.translations()
|
|
478
|
+
this.setStyleMap()
|
|
476
479
|
// this.conversationSelected = localStorage.getItem('conversationSelected');
|
|
477
480
|
this.showButtonToBottom = false
|
|
478
481
|
this.showMessageWelcome = false
|
|
@@ -487,7 +490,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
487
490
|
|
|
488
491
|
this.messages = [] // list messages of conversation
|
|
489
492
|
this.isFileSelected = false // indicates if a file has been selected (image to upload)
|
|
490
|
-
this.openInfoMessage = false // indicates whether the info message panel is open
|
|
491
493
|
|
|
492
494
|
if (checkPlatformIsMobile()) {
|
|
493
495
|
this.isMobile = true
|
|
@@ -503,19 +505,14 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
503
505
|
if (checkWindowWidthIsLessThan991px()) {
|
|
504
506
|
this.logger.log('[CONVS-DETAIL] - initialize -> checkWindowWidthIsLessThan991px ', checkWindowWidthIsLessThan991px())
|
|
505
507
|
this.openInfoConversation = false // indica se è aperto il box info conversazione
|
|
506
|
-
this.
|
|
507
|
-
this.logger.log('[CONVS-DETAIL] - initialize -> openInfoConversation ', this.openInfoConversation, ' -> isOpenInfoConversation ', this.isOpenInfoConversation)
|
|
508
|
+
this.logger.log('[CONVS-DETAIL] - initialize -> openInfoConversation ', this.openInfoConversation)
|
|
508
509
|
} else {
|
|
509
510
|
this.logger.log('[CONVS-DETAIL] - initialize -> checkWindowWidthIsLessThan991px ', checkWindowWidthIsLessThan991px())
|
|
510
511
|
this.openInfoConversation = true
|
|
511
|
-
this.
|
|
512
|
-
this.logger.log('[CONVS-DETAIL] - initialize -> openInfoConversation ', this.openInfoConversation, ' -> isOpenInfoConversation ', this.isOpenInfoConversation)
|
|
512
|
+
this.logger.log('[CONVS-DETAIL] - initialize -> openInfoConversation ', this.openInfoConversation)
|
|
513
513
|
}
|
|
514
514
|
}
|
|
515
515
|
|
|
516
|
-
this.online = false
|
|
517
|
-
this.lastConnectionDate = ''
|
|
518
|
-
|
|
519
516
|
// init handler vengono prima delle sottoscrizioni!
|
|
520
517
|
// this.initConversationsHandler(); // nk
|
|
521
518
|
if (this.conversationWith) {
|
|
@@ -524,10 +521,13 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
524
521
|
this.initConversationHandler()
|
|
525
522
|
this.initGroupsHandler()
|
|
526
523
|
this.initSubscriptions()
|
|
524
|
+
this.getLeadDetail()
|
|
527
525
|
}
|
|
528
526
|
this.addEventsKeyboard()
|
|
529
527
|
this.startConversation()
|
|
530
528
|
this.updateConversationBadge() // AGGIORNO STATO DELLA CONVERSAZIONE A 'LETTA' (is_new = false)
|
|
529
|
+
|
|
530
|
+
this.initializeTyping();
|
|
531
531
|
}
|
|
532
532
|
|
|
533
533
|
_getProjectIdByConversationWith(conversationWith: string) {
|
|
@@ -562,13 +562,20 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
562
562
|
})
|
|
563
563
|
}
|
|
564
564
|
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
565
|
+
getProjectIdSelectedConversation(conversationWith: string): string{
|
|
566
|
+
const conversationWith_segments = conversationWith.split('-')
|
|
567
|
+
// Removes the last element of the array if is = to the separator
|
|
568
|
+
if (conversationWith_segments[conversationWith_segments.length - 1] === '') {
|
|
569
|
+
conversationWith_segments.pop()
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
this.logger.log('[CONVS-DETAIL] - getProjectIdSelectedConversation conversationWith_segments ', conversationWith_segments)
|
|
573
|
+
let projectId = ''
|
|
574
|
+
if (conversationWith_segments.length === 4) {
|
|
575
|
+
projectId = conversationWith_segments[2]
|
|
576
|
+
this.logger.log('[CONVS-DETAIL] - getProjectIdSelectedConversation projectId ', projectId)
|
|
577
|
+
}
|
|
578
|
+
return projectId
|
|
572
579
|
}
|
|
573
580
|
|
|
574
581
|
@HostListener('window:resize', ['$event'])
|
|
@@ -577,7 +584,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
577
584
|
if (newInnerWidth < 991) {
|
|
578
585
|
if (this.USER_HAS_OPENED_CLOSE_INFO_CONV === false) {
|
|
579
586
|
this.openInfoConversation = false
|
|
580
|
-
this.isOpenInfoConversation = false
|
|
581
587
|
}
|
|
582
588
|
}
|
|
583
589
|
}
|
|
@@ -596,7 +602,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
596
602
|
'LABEL_TO',
|
|
597
603
|
'LABEL_LAST_ACCESS',
|
|
598
604
|
'ARRAY_DAYS',
|
|
599
|
-
|
|
605
|
+
|
|
600
606
|
'LABEL_INFO_ADVANCED',
|
|
601
607
|
'ID_CONVERSATION',
|
|
602
608
|
'UPLOAD_FILE_ERROR',
|
|
@@ -615,11 +621,48 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
615
621
|
'THERE_ARE_NO_CANNED_RESPONSES_AVAILABLE',
|
|
616
622
|
'TO_CREATE_THEM_GO_TO_THE_PROJECT',
|
|
617
623
|
"AddNewCannedResponse",
|
|
618
|
-
"LABEL_LOADING"
|
|
624
|
+
"LABEL_LOADING",
|
|
625
|
+
"DIRECT_CHAT",
|
|
626
|
+
"GROUP_CHAT",
|
|
627
|
+
|
|
628
|
+
"LABEL_CHAT",
|
|
629
|
+
"LABEL_EMAIL",
|
|
630
|
+
"EMAIL_PLACEHOLDER",
|
|
631
|
+
"EMAIL_NOT_FOUND_PLACEHOLDER",
|
|
632
|
+
"SUBJECT",
|
|
633
|
+
"MESSAGE",
|
|
634
|
+
"MESSAGE_PLACEHOLDER",
|
|
635
|
+
"LABEL_SEND",
|
|
636
|
+
"SEND_EMAIL_SUCCESS",
|
|
637
|
+
"SEND_EMAIL_ERROR",
|
|
638
|
+
"SUBJECT_OFFLINE_MESSAGE",
|
|
639
|
+
"SEND_EMAIL_SUCCESS_OFFLINE_MESSAGE"
|
|
640
|
+
]
|
|
641
|
+
|
|
642
|
+
const keysHeader = [
|
|
643
|
+
'DIRECT_CHAT',
|
|
644
|
+
'GROUP_CHAT',
|
|
645
|
+
'LABEL_IS_WRITING',
|
|
646
|
+
'LABEL_ONLINE',
|
|
647
|
+
'LABEL_OFFLINE',
|
|
648
|
+
'LABEL_TODAY',
|
|
649
|
+
'LABEL_TOMORROW',
|
|
650
|
+
'LABEL_TO',
|
|
651
|
+
'LABEL_LAST_ACCESS',
|
|
652
|
+
'ARRAY_DAYS',
|
|
653
|
+
'Resolve',
|
|
654
|
+
]
|
|
655
|
+
|
|
656
|
+
const keysContentDetail = [
|
|
657
|
+
'LABEL_OPEN_INFO_CONVERSATION',
|
|
658
|
+
'LABEL_CLOSE_GROUP',
|
|
659
|
+
'LABEL_IS_WRITING',
|
|
619
660
|
]
|
|
620
661
|
|
|
621
|
-
this.
|
|
622
|
-
this.
|
|
662
|
+
this.translationsMap = this.customTranslateService.translateLanguage(keys)
|
|
663
|
+
this.translationsHeaderMap = this.customTranslateService.translateLanguage(keysHeader)
|
|
664
|
+
this.translationsContentMap = this.customTranslateService.translateLanguage(keysContentDetail)
|
|
665
|
+
this.logger.log('[CONVS-DETAIL] x this.translationMap ',this.translationsMap)
|
|
623
666
|
}
|
|
624
667
|
|
|
625
668
|
// --------------------------------------------------------
|
|
@@ -646,6 +689,19 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
646
689
|
return this.customTranslateService.translateLanguage(keys)
|
|
647
690
|
}
|
|
648
691
|
|
|
692
|
+
private setStyleMap(){
|
|
693
|
+
this.styleMap.set('themeColor', 'var(--basic-blue)')
|
|
694
|
+
.set('bubbleReceivedBackground','var(--bck-msg-received)')
|
|
695
|
+
.set('bubbleReceivedTextColor', 'var(--col-msg-received)')
|
|
696
|
+
.set('bubbleSentBackground', 'var(--bck-msg-sent)')
|
|
697
|
+
.set('bubbleSentTextColor', 'var(--col-msg-sent)')
|
|
698
|
+
.set('buttonFontSize','var(--button-in-msg-font-size)')
|
|
699
|
+
.set('buttonBackgroundColor', 'var(--buttonBackgroundColor)')
|
|
700
|
+
.set('buttonTextColor', 'var(--buttonTextColor)')
|
|
701
|
+
.set('buttonHoverBackgroundColor', 'var(--buttonHoverBackgroundColor)')
|
|
702
|
+
.set('buttonHoverTextColor', 'var(--buttonHoverTextColor)')
|
|
703
|
+
|
|
704
|
+
}
|
|
649
705
|
// -------------------------------------------------------------------------------------
|
|
650
706
|
// * retrieving the handler from chatManager
|
|
651
707
|
// * if it DOESN'T EXIST I create a handler and connect and store it in the chatmanager
|
|
@@ -708,12 +764,12 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
708
764
|
}
|
|
709
765
|
|
|
710
766
|
//TODO: servono ???
|
|
711
|
-
if (this.loggedUser && this.loggedUser.email) {
|
|
712
|
-
|
|
713
|
-
}
|
|
714
|
-
if (this.loggedUser && this.loggedUser.fullname) {
|
|
715
|
-
|
|
716
|
-
}
|
|
767
|
+
// if (this.loggedUser && this.loggedUser.email) {
|
|
768
|
+
// attributes.userEmail = this.loggedUser.email
|
|
769
|
+
// }
|
|
770
|
+
// if (this.loggedUser && this.loggedUser.fullname) {
|
|
771
|
+
// attributes.userFullname = this.loggedUser.fullname
|
|
772
|
+
// }
|
|
717
773
|
|
|
718
774
|
return attributes
|
|
719
775
|
}
|
|
@@ -731,6 +787,18 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
731
787
|
}
|
|
732
788
|
}
|
|
733
789
|
|
|
790
|
+
onConversationLoaded(conversation): ConversationModel{
|
|
791
|
+
if(conversation.attributes && conversation.attributes['projectId']){
|
|
792
|
+
let project = localStorage.getItem(conversation.attributes['projectId'])
|
|
793
|
+
if(project){
|
|
794
|
+
project = JSON.parse(project)
|
|
795
|
+
conversation.attributes.project_name = project['name']
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
}
|
|
799
|
+
return conversation
|
|
800
|
+
}
|
|
801
|
+
|
|
734
802
|
setHeaderContent() {
|
|
735
803
|
// this.logger.log('[CONVS-DETAIL] - setHeaderContent conversationWith', this.conversationWith)
|
|
736
804
|
// this.logger.log('[CONVS-DETAIL] - setHeaderContent conversationsHandlerService', this.conversationsHandlerService)
|
|
@@ -745,7 +813,11 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
745
813
|
conv.conversation_with,
|
|
746
814
|
conv.conversation_with_fullname,
|
|
747
815
|
conv.channel_type,
|
|
816
|
+
null,
|
|
817
|
+
conv.attributes['projectId'],
|
|
818
|
+
conv.attributes['project_name']
|
|
748
819
|
)
|
|
820
|
+
|
|
749
821
|
}
|
|
750
822
|
if(!conv){
|
|
751
823
|
this.logger.debug('[CONV-COMP] setHeaderContent getConversationDetail: conv not exist --> search in archived list', this.conversationWith, this.conv_type)
|
|
@@ -758,9 +830,13 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
758
830
|
conv.conversation_with,
|
|
759
831
|
conv.conversation_with_fullname,
|
|
760
832
|
conv.channel_type,
|
|
833
|
+
null,
|
|
834
|
+
conv.attributes['projectId'],
|
|
835
|
+
conv.attributes['project_name']
|
|
761
836
|
)
|
|
762
837
|
let duration = getDateDifference(conv.timestamp, Date.now())
|
|
763
|
-
duration.days > 10 && conv.channel_type !== TYPE_DIRECT? this.disableTextarea = true: this.disableTextarea = false
|
|
838
|
+
duration.days > 10 && conv.channel_type !== TYPE_DIRECT? this.disableTextarea = true: this.disableTextarea = false
|
|
839
|
+
}
|
|
764
840
|
})
|
|
765
841
|
}
|
|
766
842
|
this.logger.log('[CONVS-DETAIL] - setHeaderContent > conversationAvatar: ', this.conversationAvatar)
|
|
@@ -775,9 +851,13 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
775
851
|
conv.conversation_with,
|
|
776
852
|
conv.conversation_with_fullname,
|
|
777
853
|
conv.channel_type,
|
|
854
|
+
null,
|
|
855
|
+
conv.attributes['projectId'],
|
|
856
|
+
conv.attributes['project_name']
|
|
778
857
|
)
|
|
779
858
|
let duration = getDateDifference(conv.timestamp, Date.now())
|
|
780
|
-
duration.days > 10 && conv.channel_type !== TYPE_DIRECT? this.disableTextarea = true: this.disableTextarea = false
|
|
859
|
+
duration.days > 10 && conv.channel_type !== TYPE_DIRECT? this.disableTextarea = true: this.disableTextarea = false
|
|
860
|
+
}
|
|
781
861
|
if(!conv){
|
|
782
862
|
this.conversationsHandlerService.getConversationDetail(this.conversationWith, (conv) => {
|
|
783
863
|
if (conv) {
|
|
@@ -786,6 +866,9 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
786
866
|
conv.conversation_with,
|
|
787
867
|
conv.conversation_with_fullname,
|
|
788
868
|
conv.channel_type,
|
|
869
|
+
null,
|
|
870
|
+
conv.attributes['projectId'],
|
|
871
|
+
conv.attributes['project_name']
|
|
789
872
|
)
|
|
790
873
|
}
|
|
791
874
|
this.logger.log('[CONVS-DETAIL] - setHeaderContent > conversationAvatar: ', this.conversationAvatar)
|
|
@@ -803,18 +886,56 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
803
886
|
}
|
|
804
887
|
|
|
805
888
|
|
|
889
|
+
getLeadDetail(){
|
|
890
|
+
const tiledeskToken= this.tiledeskAuthService.getTiledeskToken();
|
|
891
|
+
const projectId = this.getProjectIdSelectedConversation(this.conversationWith)
|
|
892
|
+
this.logger.debug('[CONVS-DETAIL] getLeadDetail - section ', projectId)
|
|
893
|
+
this.tiledeskService.getRequest(this.conversationWith, projectId, tiledeskToken).subscribe((request: any)=>{
|
|
894
|
+
this.logger.debug('[CONVS-DETAIL] getLeadDetail - selected REQUEST detail', request)
|
|
895
|
+
if(request.lead && request.lead.email){
|
|
896
|
+
this.leadInfo = {lead_id: request.lead.lead_id, hasEmail: true, email: request.lead.email, projectId: projectId}
|
|
897
|
+
this.presenceService.userIsOnline(this.leadInfo.lead_id);
|
|
898
|
+
}
|
|
899
|
+
}, (error)=>{
|
|
900
|
+
this.logger.error('[CONVS-DETAIL] - getLeadDetail - GET REQUEST DETAIL - ERROR ', error)
|
|
901
|
+
}, ()=>{
|
|
902
|
+
this.logger.debug('[CONVS-DETAIL] - getLeadDetail - GET REQUEST DETAIL * COMPLETE *')
|
|
903
|
+
})
|
|
904
|
+
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
sendEmail(message: string){
|
|
908
|
+
const tiledeskToken= this.tiledeskAuthService.getTiledeskToken();
|
|
909
|
+
const emailFormGroup = {
|
|
910
|
+
to: this.leadInfo.email,
|
|
911
|
+
subject: this.translationsMap.get('SUBJECT_OFFLINE_MESSAGE'),
|
|
912
|
+
text: message,
|
|
913
|
+
request_id: this.conversationWith
|
|
914
|
+
}
|
|
915
|
+
this.tiledeskService.sendEmail(tiledeskToken, this.leadInfo.projectId, emailFormGroup).subscribe((res)=> {
|
|
916
|
+
console.log('[SEND-EMAIL-MODAL] subscribe to sendEmail API response -->', res)
|
|
917
|
+
if(res && res.queued){
|
|
918
|
+
this.presentToast(this.translationsMap.get('SEND_EMAIL_SUCCESS_OFFLINE_MESSAGE'), 'success', '', 2000)
|
|
919
|
+
}
|
|
920
|
+
},(error)=> {
|
|
921
|
+
this.logger.error('[SEND-EMAIL-MODAL] subscribe to sendEmail API CALL - ERROR ', error)
|
|
922
|
+
this.presentToast(this.translationsMap.get('SEND_EMAIL_ERROR'), 'danger', '', 2000)
|
|
923
|
+
}, ()=> {
|
|
924
|
+
this.logger.log('[SEND-EMAIL-MODAL] subscribe to sendEmail API CALL /* COMPLETE */')
|
|
925
|
+
})
|
|
926
|
+
}
|
|
806
927
|
|
|
807
928
|
returnSendMessage(e: any) {
|
|
808
929
|
this.logger.log('[CONVS-DETAIL] - returnSendMessage event', e, ' - conversationWith', this.conversationWith)
|
|
809
930
|
try {
|
|
810
931
|
let message = ''
|
|
811
|
-
if (e.
|
|
812
|
-
message = e.
|
|
932
|
+
if (e.msg) {
|
|
933
|
+
message = e.msg
|
|
813
934
|
}
|
|
814
935
|
const type = e.type
|
|
815
936
|
const metadata = e.metadata
|
|
816
|
-
|
|
817
|
-
this.sendMessage(message, type, metadata)
|
|
937
|
+
const attributes = e.attributes
|
|
938
|
+
this.sendMessage(message, type, metadata, attributes)
|
|
818
939
|
} catch (err) {
|
|
819
940
|
this.logger.error('[CONVS-DETAIL] - returnSendMessage error: ', err)
|
|
820
941
|
}
|
|
@@ -881,7 +1002,11 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
881
1002
|
this.channelType,
|
|
882
1003
|
attributes,
|
|
883
1004
|
)
|
|
884
|
-
|
|
1005
|
+
|
|
1006
|
+
if(!this.leadIsOnline && this.leadInfo.email){
|
|
1007
|
+
this.logger.log('[CONVS-DETAIL] - SEND MESSAGE --> SENDING EMAIL', msg, this.leadInfo.email)
|
|
1008
|
+
this.sendEmail(msg)
|
|
1009
|
+
}
|
|
885
1010
|
isDevMode()? null : this.segmentNewAgentMessage(this.conversation)
|
|
886
1011
|
}
|
|
887
1012
|
}
|
|
@@ -895,37 +1020,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
895
1020
|
let subscription: any
|
|
896
1021
|
let subscriptionKey: string
|
|
897
1022
|
|
|
898
|
-
// subscriptionKey = 'BSConversationsChanged'
|
|
899
|
-
// subscription = this.subscriptions.find((item) => item.key === subscriptionKey)
|
|
900
|
-
// if (!subscription) {
|
|
901
|
-
// subscription = this.conversationsHandlerService.conversationChanged.subscribe((data: ConversationModel) => {
|
|
902
|
-
// this.logger.log('[CONVS-DETAIL] subscribe BSConversationsChanged data ', data, ' this.loggedUser.uid:', this.loggedUser.uid)
|
|
903
|
-
|
|
904
|
-
// if (data && data.sender !== this.loggedUser.uid) {
|
|
905
|
-
// this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange data sender ', data.sender)
|
|
906
|
-
// this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange this.loggedUser.uid ', this.loggedUser.uid)
|
|
907
|
-
// this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange is_new ', data.is_new)
|
|
908
|
-
// this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange showButtonToBottom ', this.showButtonToBottom)
|
|
909
|
-
// // UPDATE THE CONVERSATION TO 'READ' IF IT IS ME WHO WRITES THE LAST MESSAGE OF THE CONVERSATION
|
|
910
|
-
// // AND IF THE POSITION OF THE SCROLL IS AT THE END
|
|
911
|
-
// if (!this.showButtonToBottom && data.is_new) {
|
|
912
|
-
// // ARE AT THE END
|
|
913
|
-
// this.updateConversationBadge()
|
|
914
|
-
// }
|
|
915
|
-
// if(data.uid === this.conversationWith){
|
|
916
|
-
// this.conversationAvatar = setConversationAvatar(
|
|
917
|
-
// data.conversation_with,
|
|
918
|
-
// data.conversation_with_fullname,
|
|
919
|
-
// data.channel_type,
|
|
920
|
-
// )
|
|
921
|
-
// }
|
|
922
|
-
|
|
923
|
-
// }
|
|
924
|
-
// })
|
|
925
|
-
// const subscribe = { key: subscriptionKey, value: subscription }
|
|
926
|
-
// this.subscriptions.push(subscribe)
|
|
927
|
-
// }
|
|
928
|
-
|
|
929
1023
|
subscriptionKey = 'messageAdded'
|
|
930
1024
|
subscription = this.subscriptions.find((item) => item.key === subscriptionKey)
|
|
931
1025
|
if (!subscription) {
|
|
@@ -975,6 +1069,39 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
975
1069
|
this.subscriptions.push(subscribe)
|
|
976
1070
|
}
|
|
977
1071
|
|
|
1072
|
+
subscriptionKey = 'conversationTyping';
|
|
1073
|
+
subscription = this.subscriptions.find(item => item.key === subscriptionKey);
|
|
1074
|
+
if (!subscription) {
|
|
1075
|
+
subscription = this.typingService.BSIsTyping.pipe(takeUntil(this.unsubscribe$)).subscribe((data: any) => {
|
|
1076
|
+
this.logger.debug('[CONVS-DETAIL] ***** BSIsTyping *****', data);
|
|
1077
|
+
if (data) {
|
|
1078
|
+
const isTypingUid = data.uid; //support-group-...
|
|
1079
|
+
if (this.conversationWith === isTypingUid) {
|
|
1080
|
+
that.subscribeTypings(data);
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
});
|
|
1084
|
+
const subscribe = {key: subscriptionKey, value: subscription };
|
|
1085
|
+
this.subscriptions.push(subscribe);
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
subscriptionKey = 'BSIsOnline';
|
|
1089
|
+
subscription = this.subscriptions.find(item => item.key === subscriptionKey);
|
|
1090
|
+
if (!subscription) {
|
|
1091
|
+
subscription = this.presenceService.BSIsOnline.subscribe((data: any) => {
|
|
1092
|
+
this.logger.log('[USER-PRESENCE-COMP] $subs to BSIsOnline - data ', data);
|
|
1093
|
+
if (data) {
|
|
1094
|
+
const userId = data.uid;
|
|
1095
|
+
const isOnline = data.isOnline;
|
|
1096
|
+
if (this.leadInfo && this.leadInfo.lead_id === userId) {
|
|
1097
|
+
this.leadIsOnline = isOnline;
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
});
|
|
1101
|
+
const subscribe = { key: subscriptionKey, value: subscription };
|
|
1102
|
+
this.subscriptions.push(subscribe);
|
|
1103
|
+
}
|
|
1104
|
+
|
|
978
1105
|
// subscriptionKey = 'onGroupChange';
|
|
979
1106
|
// subscription = this.subscriptions.find(item => item.key === subscriptionKey);
|
|
980
1107
|
// if (!subscription) {
|
|
@@ -995,18 +1122,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
995
1122
|
// }
|
|
996
1123
|
}
|
|
997
1124
|
|
|
998
|
-
onConversationLoaded(conversation): ConversationModel{
|
|
999
|
-
if(conversation.attributes && conversation.attributes['projectId']){
|
|
1000
|
-
let project = localStorage.getItem(conversation.attributes['projectId'])
|
|
1001
|
-
if(project){
|
|
1002
|
-
project = JSON.parse(project)
|
|
1003
|
-
conversation.attributes.project_name = project['name']
|
|
1004
|
-
}
|
|
1005
|
-
}
|
|
1006
|
-
return conversation
|
|
1007
|
-
}
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
1125
|
// -------------------------------------------------
|
|
1011
1126
|
// addEventsKeyboard
|
|
1012
1127
|
// -------------------------------------------------
|
|
@@ -1034,13 +1149,25 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1034
1149
|
this.conversationAvatar = setConversationAvatar(
|
|
1035
1150
|
this.conversationWith,
|
|
1036
1151
|
this.conversationWithFullname,
|
|
1037
|
-
this.channelType
|
|
1152
|
+
this.channelType,
|
|
1153
|
+
null,
|
|
1154
|
+
this.conversation.attributes['projectId'],
|
|
1155
|
+
this.conversation.attributes['project_name']
|
|
1038
1156
|
)
|
|
1039
|
-
|
|
1040
1157
|
}
|
|
1041
1158
|
if (msg.attributes && msg.attributes['updateUserEmail']) {
|
|
1042
1159
|
const userEmail = msg.attributes['updateUserEmail'];
|
|
1043
1160
|
this.logger.debug('[CONVS-DETAIL] newMessageAdded --> userEmail', userEmail)
|
|
1161
|
+
this.conversationAvatar = setConversationAvatar(
|
|
1162
|
+
this.conversationWith,
|
|
1163
|
+
this.conversationWithFullname,
|
|
1164
|
+
this.channelType,
|
|
1165
|
+
userEmail,
|
|
1166
|
+
this.conversation.attributes['projectId'],
|
|
1167
|
+
this.conversation.attributes['project_name']
|
|
1168
|
+
)
|
|
1169
|
+
this.getLeadDetail()
|
|
1170
|
+
|
|
1044
1171
|
}
|
|
1045
1172
|
}
|
|
1046
1173
|
|
|
@@ -1124,6 +1251,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1124
1251
|
}
|
|
1125
1252
|
|
|
1126
1253
|
this.heightMessageTextArea = height.toString() //e.target.scrollHeight + 20;
|
|
1254
|
+
this.scrollBottom(0)
|
|
1127
1255
|
const message = e.msg
|
|
1128
1256
|
this.logger.log('[CONVS-DETAIL] returnChangeTextArea heightMessageTextArea ', this.heightMessageTextArea)
|
|
1129
1257
|
|
|
@@ -1211,7 +1339,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1211
1339
|
this.logger.log('[CONVS-DETAIL] - returnChangeTextArea --> beforeSlash', beforeSlash)
|
|
1212
1340
|
this.logger.log('[CONVS-DETAIL] - returnChangeTextArea --> afterSlash', afterSlash)
|
|
1213
1341
|
|
|
1214
|
-
|
|
1215
1342
|
if(beforeSlash[beforeSlash.length-1].indexOf(' ') >= 0 && afterSlash === ''){
|
|
1216
1343
|
this.HIDE_CANNED_RESPONSES = false
|
|
1217
1344
|
} else if(beforeSlash[beforeSlash.length-1].indexOf(' ') < 0 && afterSlash === '' ){
|
|
@@ -1259,7 +1386,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1259
1386
|
|
|
1260
1387
|
replaceTagInMessage(canned, event?) {
|
|
1261
1388
|
const elTextArea = this.rowTextArea['el']
|
|
1262
|
-
const textArea = elTextArea.getElementsByTagName('ion-textarea')[0]
|
|
1389
|
+
const textArea = elTextArea.getElementsByTagName('ion-textarea')[0] as HTMLInputElement;
|
|
1263
1390
|
// console.log('[CONVS-DETAIL] replaceTagInMessage textArea ', textArea)
|
|
1264
1391
|
// console.log('[CONVS-DETAIL] replaceTagInMessage textArea value', textArea.value,)
|
|
1265
1392
|
|
|
@@ -1274,20 +1401,17 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1274
1401
|
// replace text
|
|
1275
1402
|
var strTEMP = textArea.value.replace(/\/.*/ig, canned.text)
|
|
1276
1403
|
strTEMP = this.replacePlaceholderInCanned(strTEMP)
|
|
1277
|
-
this.logger.log('[CONVS-DETAIL] replaceTagInMessage strSearch
|
|
1404
|
+
this.logger.log('[CONVS-DETAIL] replaceTagInMessage strSearch ', strTEMP)
|
|
1278
1405
|
// strTEMP = this.replacePlaceholderInCanned(strTEMP);
|
|
1279
1406
|
// textArea.value = '';
|
|
1280
1407
|
// that.messageString = strTEMP;
|
|
1281
1408
|
textArea.value = strTEMP
|
|
1282
|
-
this.logger.log('[CONVS-DETAIL] replaceTagInMessage strSearch after', strTEMP, textArea)
|
|
1283
1409
|
this.insertAtCursor(textArea, '')
|
|
1284
1410
|
this.setCaretPosition(textArea)
|
|
1285
1411
|
// setTimeout(() => {
|
|
1286
1412
|
// // textArea.focus();
|
|
1287
|
-
// textArea.selectionEnd = textArea.value.length;
|
|
1288
1413
|
// textArea.setFocus()
|
|
1289
1414
|
// // this.resizeTextArea()
|
|
1290
|
-
// // this.setCaretPosition(textArea)
|
|
1291
1415
|
// }, 200)
|
|
1292
1416
|
|
|
1293
1417
|
}
|
|
@@ -1331,7 +1455,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1331
1455
|
if(elTextArea){
|
|
1332
1456
|
// console.log("[CONVS-DETAIL] onClickOpenCannedResponses textArea value", textArea.value)
|
|
1333
1457
|
var lastChar = textArea.value[textArea.value.length - 1]
|
|
1334
|
-
this.logger.log('[CONVS-DETAIL] onClickOpenCannedResponses lastChar
|
|
1458
|
+
this.logger.log('[CONVS-DETAIL] onClickOpenCannedResponses lastChar --- textArea ', lastChar, textArea)
|
|
1335
1459
|
if (lastChar !== '/') {
|
|
1336
1460
|
this.insertAtCursor(textArea, '/')
|
|
1337
1461
|
}
|
|
@@ -1511,6 +1635,20 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1511
1635
|
}
|
|
1512
1636
|
}
|
|
1513
1637
|
|
|
1638
|
+
onOpenCloseInfoConversation(event){
|
|
1639
|
+
this.logger.debug('[CONVS-DETAIL] onOpenCloseInfoConversation - openInfoConversation ', event)
|
|
1640
|
+
this.resizeTextArea()
|
|
1641
|
+
this.openInfoConversation = event
|
|
1642
|
+
this.USER_HAS_OPENED_CLOSE_INFO_CONV = true
|
|
1643
|
+
}
|
|
1644
|
+
|
|
1645
|
+
onOpenFooterSection(event: string){
|
|
1646
|
+
this.logger.debug('[CONVS-DETAIL] onOpenFooterSection - section ', event)
|
|
1647
|
+
if(event === 'email'){
|
|
1648
|
+
this.getLeadDetail()
|
|
1649
|
+
}
|
|
1650
|
+
}
|
|
1651
|
+
|
|
1514
1652
|
// -------------- START SCROLL/RESIZE -------------- //
|
|
1515
1653
|
/** */
|
|
1516
1654
|
resizeTextArea() {
|
|
@@ -1612,6 +1750,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1612
1750
|
this.heightMessageTextArea = '57' // NK edited
|
|
1613
1751
|
}
|
|
1614
1752
|
}
|
|
1753
|
+
|
|
1615
1754
|
checkAcceptedFile(draggedFileMimeType) {
|
|
1616
1755
|
let isAcceptFile = false
|
|
1617
1756
|
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept: ',this.appConfigProvider.getConfig().fileUploadAccept)
|
|
@@ -1633,26 +1772,17 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1633
1772
|
if (accept_file_segment[1] === '*') {
|
|
1634
1773
|
if (draggedFileMimeType.startsWith(accept_file_segment[0])) {
|
|
1635
1774
|
isAcceptFile = true
|
|
1636
|
-
this.logger.log(
|
|
1637
|
-
'[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept isAcceptFile',
|
|
1638
|
-
isAcceptFile,
|
|
1639
|
-
)
|
|
1775
|
+
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept isAcceptFile',isAcceptFile)
|
|
1640
1776
|
return isAcceptFile
|
|
1641
1777
|
} else {
|
|
1642
1778
|
isAcceptFile = false
|
|
1643
|
-
this.logger.log(
|
|
1644
|
-
'[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept isAcceptFile',
|
|
1645
|
-
isAcceptFile,
|
|
1646
|
-
)
|
|
1779
|
+
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept isAcceptFile',isAcceptFile)
|
|
1647
1780
|
return isAcceptFile
|
|
1648
1781
|
}
|
|
1649
1782
|
} else if (accept_file_segment[1] !== '*') {
|
|
1650
1783
|
if (draggedFileMimeType === accept_file) {
|
|
1651
1784
|
isAcceptFile = true
|
|
1652
|
-
this.logger.log(
|
|
1653
|
-
'[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept isAcceptFile',
|
|
1654
|
-
isAcceptFile,
|
|
1655
|
-
)
|
|
1785
|
+
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept isAcceptFile',isAcceptFile)
|
|
1656
1786
|
return isAcceptFile
|
|
1657
1787
|
}
|
|
1658
1788
|
}
|
|
@@ -1662,6 +1792,64 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1662
1792
|
}
|
|
1663
1793
|
}
|
|
1664
1794
|
|
|
1795
|
+
|
|
1796
|
+
initializeTyping() {
|
|
1797
|
+
this.logger.debug('[CONVS-DETAIL] membersconversation', this.membersConversation)
|
|
1798
|
+
if(this.loggedUser){
|
|
1799
|
+
this.membersConversation.push(this.loggedUser.uid)
|
|
1800
|
+
//this.setSubscriptions();
|
|
1801
|
+
this.typingService.isTyping(this.conversationWith, this.loggedUser.uid, this.isDirect);
|
|
1802
|
+
}
|
|
1803
|
+
}
|
|
1804
|
+
|
|
1805
|
+
/** */
|
|
1806
|
+
subscribeTypings(data: any) {
|
|
1807
|
+
const that = this;
|
|
1808
|
+
try {
|
|
1809
|
+
const key = data.uidUserTypingNow;
|
|
1810
|
+
const waitTime = data.waitTime
|
|
1811
|
+
this.nameUserTypingNow = null;
|
|
1812
|
+
this.idUserTypingNow = null;
|
|
1813
|
+
|
|
1814
|
+
if (data.nameUserTypingNow) {
|
|
1815
|
+
this.nameUserTypingNow = data.nameUserTypingNow;
|
|
1816
|
+
}
|
|
1817
|
+
if (data.uidUserTypingNow){
|
|
1818
|
+
this.idUserTypingNow = data.uidUserTypingNow
|
|
1819
|
+
}
|
|
1820
|
+
this.logger.debug('[CONV-COMP] subscribeTypings data:', data);
|
|
1821
|
+
const userTyping = this.membersConversation.includes(key);
|
|
1822
|
+
if ( !userTyping && key) {
|
|
1823
|
+
this.isTypings = true;
|
|
1824
|
+
setTimeout(function () {
|
|
1825
|
+
that.scrollBottom(0)
|
|
1826
|
+
}, 0);
|
|
1827
|
+
// clearTimeout(this.setTimeoutWritingMessages);
|
|
1828
|
+
this.setTimeoutWritingMessages = setTimeout(() => {
|
|
1829
|
+
that.isTypings = false;
|
|
1830
|
+
}, waitTime);
|
|
1831
|
+
// this.initiTimeout(waitTime)
|
|
1832
|
+
}
|
|
1833
|
+
} catch (error) {
|
|
1834
|
+
this.logger.error('[CONV-COMP] error: ', error);
|
|
1835
|
+
}
|
|
1836
|
+
|
|
1837
|
+
}
|
|
1838
|
+
|
|
1839
|
+
initiTimeout(waitTime){
|
|
1840
|
+
const that = this;
|
|
1841
|
+
this.setTimeoutWritingMessages = setTimeout(() => {
|
|
1842
|
+
that.isTypings = false;
|
|
1843
|
+
}, waitTime);
|
|
1844
|
+
}
|
|
1845
|
+
|
|
1846
|
+
resetTimeout(){
|
|
1847
|
+
this.isTypings = false
|
|
1848
|
+
this.setTimeoutWritingMessages = null;
|
|
1849
|
+
clearTimeout(this.setTimeoutWritingMessages)
|
|
1850
|
+
}
|
|
1851
|
+
|
|
1852
|
+
|
|
1665
1853
|
segmentNewAgentMessage(conversation: ConversationModel){
|
|
1666
1854
|
let user = this.loggedUser
|
|
1667
1855
|
if(window['analytics']){
|
|
@@ -1710,7 +1898,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1710
1898
|
}
|
|
1711
1899
|
}
|
|
1712
1900
|
}
|
|
1713
|
-
|
|
1901
|
+
|
|
1714
1902
|
// -------------------------------------------------------------
|
|
1715
1903
|
// DRAG FILE
|
|
1716
1904
|
// -------------------------------------------------------------
|
|
@@ -1740,7 +1928,8 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1740
1928
|
this.handleDropEvent(ev)
|
|
1741
1929
|
} else {
|
|
1742
1930
|
this.logger.log( '[CONVS-DETAIL] ----> FILE - DROP mimeType files ', mimeType,'NOT SUPPORTED FILE TYPE')
|
|
1743
|
-
this.
|
|
1931
|
+
this.presentToast(this.translationsMap.get('FAILED_TO_UPLOAD_THE_FORMAT_IS_NOT_SUPPORTED'), 'danger','toast-custom-class', 5000 )
|
|
1932
|
+
// this.presentToastOnlyImageFilesAreAllowedToDrag()
|
|
1744
1933
|
}
|
|
1745
1934
|
}
|
|
1746
1935
|
}
|
|
@@ -1768,14 +1957,15 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1768
1957
|
this.logger.log('[CONVS-DETAIL] ----> FILE - FILE - (dragleave) drag his.isHovering ',this.isHovering)
|
|
1769
1958
|
}
|
|
1770
1959
|
|
|
1771
|
-
async
|
|
1960
|
+
async presentToast(message: string, color: string, cssClass: string, duration: number = 2000, position: 'top' | 'bottom' | 'middle'= 'bottom'){
|
|
1772
1961
|
const toast = await this.toastController.create({
|
|
1773
|
-
message:
|
|
1774
|
-
duration:
|
|
1775
|
-
color:
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1962
|
+
message: message,
|
|
1963
|
+
duration: duration,
|
|
1964
|
+
color: color,
|
|
1965
|
+
position: position,
|
|
1966
|
+
cssClass: cssClass,
|
|
1967
|
+
});
|
|
1968
|
+
toast.present();
|
|
1779
1969
|
}
|
|
1780
1970
|
}
|
|
1781
1971
|
// END ALL //
|