@chat21/chat21-ionic 3.0.85 → 3.0.86-rc.2
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 +121 -4
- package/README.md +2 -2
- 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 +131 -20
- package/src/app/app.module.ts +8 -3
- package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.ts +11 -4
- 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 -44
- 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 -154
- 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 +195 -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 +330 -138
- 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/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/logger/customLogger.ts +1 -1
- 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,3 @@
|
|
|
1
|
-
import { TYPE_DIRECT } from 'src/chat21-core/utils/constants';
|
|
2
|
-
import { TYPE_SUPPORT_GROUP, URL_SOUND_LIST_CONVERSATION } from './../../../chat21-core/utils/constants'
|
|
3
1
|
import {
|
|
4
2
|
Component,
|
|
5
3
|
OnInit,
|
|
@@ -47,17 +45,19 @@ import { ArchivedConversationsHandlerService } from 'src/chat21-core/providers/a
|
|
|
47
45
|
import { ConversationHandlerService } from 'src/chat21-core/providers/abstract/conversation-handler.service'
|
|
48
46
|
import { ContactsService } from 'src/app/services/contacts/contacts.service'
|
|
49
47
|
import { CannedResponsesService } from '../../services/canned-responses/canned-responses.service'
|
|
50
|
-
import { compareValues, getDateDifference, htmlEntities } from '
|
|
48
|
+
import { compareValues, getDateDifference, htmlEntities } from 'src/chat21-core/utils/utils'
|
|
51
49
|
import { ImageRepoService } from 'src/chat21-core/providers/abstract/image-repo.service'
|
|
52
50
|
import { PresenceService } from 'src/chat21-core/providers/abstract/presence.service'
|
|
53
|
-
import { CreateCannedResponsePage } from 'src/app/
|
|
51
|
+
import { CreateCannedResponsePage } from 'src/app/modals/create-canned-response/create-canned-response.page'
|
|
54
52
|
// utils
|
|
55
53
|
import {
|
|
56
54
|
TYPE_MSG_TEXT,
|
|
57
55
|
MESSAGE_TYPE_INFO,
|
|
58
56
|
MESSAGE_TYPE_MINE,
|
|
59
57
|
MESSAGE_TYPE_OTHERS,
|
|
60
|
-
|
|
58
|
+
URL_SOUND_LIST_CONVERSATION,
|
|
59
|
+
TYPE_DIRECT
|
|
60
|
+
} from 'src/chat21-core/utils/constants'
|
|
61
61
|
import {
|
|
62
62
|
checkPlatformIsMobile,
|
|
63
63
|
checkWindowWidthIsLessThan991px,
|
|
@@ -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.startConversation()
|
|
525
|
+
this.getLeadDetail()
|
|
527
526
|
}
|
|
528
527
|
this.addEventsKeyboard()
|
|
529
|
-
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,58 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
803
886
|
}
|
|
804
887
|
|
|
805
888
|
|
|
889
|
+
getLeadDetail(){
|
|
890
|
+
if(this.channelType !== TYPE_DIRECT){
|
|
891
|
+
const tiledeskToken= this.tiledeskAuthService.getTiledeskToken();
|
|
892
|
+
const projectId = this.getProjectIdSelectedConversation(this.conversationWith)
|
|
893
|
+
this.logger.debug('[CONVS-DETAIL] getLeadDetail - section ', projectId)
|
|
894
|
+
this.tiledeskService.getRequest(this.conversationWith, projectId, tiledeskToken).subscribe((request: any)=>{
|
|
895
|
+
this.logger.debug('[CONVS-DETAIL] getLeadDetail - selected REQUEST detail', request)
|
|
896
|
+
if(request.lead && request.lead.email){
|
|
897
|
+
this.leadInfo = {lead_id: request.lead.lead_id, hasEmail: true, email: request.lead.email, projectId: projectId}
|
|
898
|
+
this.presenceService.userIsOnline(this.leadInfo.lead_id);
|
|
899
|
+
}
|
|
900
|
+
}, (error)=>{
|
|
901
|
+
this.logger.error('[CONVS-DETAIL] - getLeadDetail - GET REQUEST DETAIL - ERROR ', error)
|
|
902
|
+
}, ()=>{
|
|
903
|
+
this.logger.debug('[CONVS-DETAIL] - getLeadDetail - GET REQUEST DETAIL * COMPLETE *')
|
|
904
|
+
})
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
sendEmail(message: string){
|
|
910
|
+
const tiledeskToken= this.tiledeskAuthService.getTiledeskToken();
|
|
911
|
+
const emailFormGroup = {
|
|
912
|
+
to: this.leadInfo.email,
|
|
913
|
+
subject: this.translationsMap.get('SUBJECT_OFFLINE_MESSAGE'),
|
|
914
|
+
text: message,
|
|
915
|
+
request_id: this.conversationWith
|
|
916
|
+
}
|
|
917
|
+
this.tiledeskService.sendEmail(tiledeskToken, this.leadInfo.projectId, emailFormGroup).subscribe((res)=> {
|
|
918
|
+
console.log('[SEND-EMAIL-MODAL] subscribe to sendEmail API response -->', res)
|
|
919
|
+
if(res && res.queued){
|
|
920
|
+
this.presentToast(this.translationsMap.get('SEND_EMAIL_SUCCESS_OFFLINE_MESSAGE'), 'success', '', 2000)
|
|
921
|
+
}
|
|
922
|
+
},(error)=> {
|
|
923
|
+
this.logger.error('[SEND-EMAIL-MODAL] subscribe to sendEmail API CALL - ERROR ', error)
|
|
924
|
+
this.presentToast(this.translationsMap.get('SEND_EMAIL_ERROR'), 'danger', '', 2000)
|
|
925
|
+
}, ()=> {
|
|
926
|
+
this.logger.log('[SEND-EMAIL-MODAL] subscribe to sendEmail API CALL /* COMPLETE */')
|
|
927
|
+
})
|
|
928
|
+
}
|
|
806
929
|
|
|
807
930
|
returnSendMessage(e: any) {
|
|
808
931
|
this.logger.log('[CONVS-DETAIL] - returnSendMessage event', e, ' - conversationWith', this.conversationWith)
|
|
809
932
|
try {
|
|
810
933
|
let message = ''
|
|
811
|
-
if (e.
|
|
812
|
-
message = e.
|
|
934
|
+
if (e.msg) {
|
|
935
|
+
message = e.msg
|
|
813
936
|
}
|
|
814
937
|
const type = e.type
|
|
815
938
|
const metadata = e.metadata
|
|
816
|
-
|
|
817
|
-
this.sendMessage(message, type, metadata)
|
|
939
|
+
const attributes = e.attributes
|
|
940
|
+
this.sendMessage(message, type, metadata, attributes)
|
|
818
941
|
} catch (err) {
|
|
819
942
|
this.logger.error('[CONVS-DETAIL] - returnSendMessage error: ', err)
|
|
820
943
|
}
|
|
@@ -882,6 +1005,10 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
882
1005
|
attributes,
|
|
883
1006
|
)
|
|
884
1007
|
|
|
1008
|
+
if(!this.leadIsOnline && this.leadInfo && this.leadInfo.email){
|
|
1009
|
+
this.logger.log('[CONVS-DETAIL] - SEND MESSAGE --> SENDING EMAIL', msg, this.leadInfo.email)
|
|
1010
|
+
this.sendEmail(msg)
|
|
1011
|
+
}
|
|
885
1012
|
isDevMode()? null : this.segmentNewAgentMessage(this.conversation)
|
|
886
1013
|
}
|
|
887
1014
|
}
|
|
@@ -895,37 +1022,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
895
1022
|
let subscription: any
|
|
896
1023
|
let subscriptionKey: string
|
|
897
1024
|
|
|
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
1025
|
subscriptionKey = 'messageAdded'
|
|
930
1026
|
subscription = this.subscriptions.find((item) => item.key === subscriptionKey)
|
|
931
1027
|
if (!subscription) {
|
|
@@ -975,6 +1071,39 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
975
1071
|
this.subscriptions.push(subscribe)
|
|
976
1072
|
}
|
|
977
1073
|
|
|
1074
|
+
subscriptionKey = 'conversationTyping';
|
|
1075
|
+
subscription = this.subscriptions.find(item => item.key === subscriptionKey);
|
|
1076
|
+
if (!subscription) {
|
|
1077
|
+
subscription = this.typingService.BSIsTyping.pipe(takeUntil(this.unsubscribe$)).subscribe((data: any) => {
|
|
1078
|
+
this.logger.debug('[CONVS-DETAIL] ***** BSIsTyping *****', data);
|
|
1079
|
+
if (data) {
|
|
1080
|
+
const isTypingUid = data.uid; //support-group-...
|
|
1081
|
+
if (this.conversationWith === isTypingUid) {
|
|
1082
|
+
that.subscribeTypings(data);
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
});
|
|
1086
|
+
const subscribe = {key: subscriptionKey, value: subscription };
|
|
1087
|
+
this.subscriptions.push(subscribe);
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
subscriptionKey = 'BSIsOnline';
|
|
1091
|
+
subscription = this.subscriptions.find(item => item.key === subscriptionKey);
|
|
1092
|
+
if (!subscription) {
|
|
1093
|
+
subscription = this.presenceService.BSIsOnline.subscribe((data: any) => {
|
|
1094
|
+
this.logger.log('[USER-PRESENCE-COMP] $subs to BSIsOnline - data ', data);
|
|
1095
|
+
if (data) {
|
|
1096
|
+
const userId = data.uid;
|
|
1097
|
+
const isOnline = data.isOnline;
|
|
1098
|
+
if (this.leadInfo && this.leadInfo.lead_id === userId) {
|
|
1099
|
+
this.leadIsOnline = isOnline;
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
});
|
|
1103
|
+
const subscribe = { key: subscriptionKey, value: subscription };
|
|
1104
|
+
this.subscriptions.push(subscribe);
|
|
1105
|
+
}
|
|
1106
|
+
|
|
978
1107
|
// subscriptionKey = 'onGroupChange';
|
|
979
1108
|
// subscription = this.subscriptions.find(item => item.key === subscriptionKey);
|
|
980
1109
|
// if (!subscription) {
|
|
@@ -995,18 +1124,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
995
1124
|
// }
|
|
996
1125
|
}
|
|
997
1126
|
|
|
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
1127
|
// -------------------------------------------------
|
|
1011
1128
|
// addEventsKeyboard
|
|
1012
1129
|
// -------------------------------------------------
|
|
@@ -1034,13 +1151,25 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1034
1151
|
this.conversationAvatar = setConversationAvatar(
|
|
1035
1152
|
this.conversationWith,
|
|
1036
1153
|
this.conversationWithFullname,
|
|
1037
|
-
this.channelType
|
|
1154
|
+
this.channelType,
|
|
1155
|
+
null,
|
|
1156
|
+
this.conversation.attributes['projectId'],
|
|
1157
|
+
this.conversation.attributes['project_name']
|
|
1038
1158
|
)
|
|
1039
|
-
|
|
1040
1159
|
}
|
|
1041
1160
|
if (msg.attributes && msg.attributes['updateUserEmail']) {
|
|
1042
1161
|
const userEmail = msg.attributes['updateUserEmail'];
|
|
1043
1162
|
this.logger.debug('[CONVS-DETAIL] newMessageAdded --> userEmail', userEmail)
|
|
1163
|
+
this.conversationAvatar = setConversationAvatar(
|
|
1164
|
+
this.conversationWith,
|
|
1165
|
+
this.conversationWithFullname,
|
|
1166
|
+
this.channelType,
|
|
1167
|
+
userEmail,
|
|
1168
|
+
this.conversation.attributes['projectId'],
|
|
1169
|
+
this.conversation.attributes['project_name']
|
|
1170
|
+
)
|
|
1171
|
+
this.getLeadDetail()
|
|
1172
|
+
|
|
1044
1173
|
}
|
|
1045
1174
|
}
|
|
1046
1175
|
|
|
@@ -1124,6 +1253,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1124
1253
|
}
|
|
1125
1254
|
|
|
1126
1255
|
this.heightMessageTextArea = height.toString() //e.target.scrollHeight + 20;
|
|
1256
|
+
this.scrollBottom(0)
|
|
1127
1257
|
const message = e.msg
|
|
1128
1258
|
this.logger.log('[CONVS-DETAIL] returnChangeTextArea heightMessageTextArea ', this.heightMessageTextArea)
|
|
1129
1259
|
|
|
@@ -1211,7 +1341,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1211
1341
|
this.logger.log('[CONVS-DETAIL] - returnChangeTextArea --> beforeSlash', beforeSlash)
|
|
1212
1342
|
this.logger.log('[CONVS-DETAIL] - returnChangeTextArea --> afterSlash', afterSlash)
|
|
1213
1343
|
|
|
1214
|
-
|
|
1215
1344
|
if(beforeSlash[beforeSlash.length-1].indexOf(' ') >= 0 && afterSlash === ''){
|
|
1216
1345
|
this.HIDE_CANNED_RESPONSES = false
|
|
1217
1346
|
} else if(beforeSlash[beforeSlash.length-1].indexOf(' ') < 0 && afterSlash === '' ){
|
|
@@ -1259,7 +1388,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1259
1388
|
|
|
1260
1389
|
replaceTagInMessage(canned, event?) {
|
|
1261
1390
|
const elTextArea = this.rowTextArea['el']
|
|
1262
|
-
const textArea = elTextArea.getElementsByTagName('ion-textarea')[0]
|
|
1391
|
+
const textArea = elTextArea.getElementsByTagName('ion-textarea')[0] as HTMLInputElement;
|
|
1263
1392
|
// console.log('[CONVS-DETAIL] replaceTagInMessage textArea ', textArea)
|
|
1264
1393
|
// console.log('[CONVS-DETAIL] replaceTagInMessage textArea value', textArea.value,)
|
|
1265
1394
|
|
|
@@ -1274,20 +1403,17 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1274
1403
|
// replace text
|
|
1275
1404
|
var strTEMP = textArea.value.replace(/\/.*/ig, canned.text)
|
|
1276
1405
|
strTEMP = this.replacePlaceholderInCanned(strTEMP)
|
|
1277
|
-
this.logger.log('[CONVS-DETAIL] replaceTagInMessage strSearch
|
|
1406
|
+
this.logger.log('[CONVS-DETAIL] replaceTagInMessage strSearch ', strTEMP)
|
|
1278
1407
|
// strTEMP = this.replacePlaceholderInCanned(strTEMP);
|
|
1279
1408
|
// textArea.value = '';
|
|
1280
1409
|
// that.messageString = strTEMP;
|
|
1281
1410
|
textArea.value = strTEMP
|
|
1282
|
-
this.logger.log('[CONVS-DETAIL] replaceTagInMessage strSearch after', strTEMP, textArea)
|
|
1283
1411
|
this.insertAtCursor(textArea, '')
|
|
1284
1412
|
this.setCaretPosition(textArea)
|
|
1285
1413
|
// setTimeout(() => {
|
|
1286
1414
|
// // textArea.focus();
|
|
1287
|
-
// textArea.selectionEnd = textArea.value.length;
|
|
1288
1415
|
// textArea.setFocus()
|
|
1289
1416
|
// // this.resizeTextArea()
|
|
1290
|
-
// // this.setCaretPosition(textArea)
|
|
1291
1417
|
// }, 200)
|
|
1292
1418
|
|
|
1293
1419
|
}
|
|
@@ -1331,7 +1457,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1331
1457
|
if(elTextArea){
|
|
1332
1458
|
// console.log("[CONVS-DETAIL] onClickOpenCannedResponses textArea value", textArea.value)
|
|
1333
1459
|
var lastChar = textArea.value[textArea.value.length - 1]
|
|
1334
|
-
this.logger.log('[CONVS-DETAIL] onClickOpenCannedResponses lastChar
|
|
1460
|
+
this.logger.log('[CONVS-DETAIL] onClickOpenCannedResponses lastChar --- textArea ', lastChar, textArea)
|
|
1335
1461
|
if (lastChar !== '/') {
|
|
1336
1462
|
this.insertAtCursor(textArea, '/')
|
|
1337
1463
|
}
|
|
@@ -1511,6 +1637,20 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1511
1637
|
}
|
|
1512
1638
|
}
|
|
1513
1639
|
|
|
1640
|
+
onOpenCloseInfoConversation(event){
|
|
1641
|
+
this.logger.debug('[CONVS-DETAIL] onOpenCloseInfoConversation - openInfoConversation ', event)
|
|
1642
|
+
this.resizeTextArea()
|
|
1643
|
+
this.openInfoConversation = event
|
|
1644
|
+
this.USER_HAS_OPENED_CLOSE_INFO_CONV = true
|
|
1645
|
+
}
|
|
1646
|
+
|
|
1647
|
+
onOpenFooterSection(event: string){
|
|
1648
|
+
this.logger.debug('[CONVS-DETAIL] onOpenFooterSection - section ', event)
|
|
1649
|
+
if(event === 'email'){
|
|
1650
|
+
this.getLeadDetail()
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1653
|
+
|
|
1514
1654
|
// -------------- START SCROLL/RESIZE -------------- //
|
|
1515
1655
|
/** */
|
|
1516
1656
|
resizeTextArea() {
|
|
@@ -1612,6 +1752,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1612
1752
|
this.heightMessageTextArea = '57' // NK edited
|
|
1613
1753
|
}
|
|
1614
1754
|
}
|
|
1755
|
+
|
|
1615
1756
|
checkAcceptedFile(draggedFileMimeType) {
|
|
1616
1757
|
let isAcceptFile = false
|
|
1617
1758
|
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept: ',this.appConfigProvider.getConfig().fileUploadAccept)
|
|
@@ -1633,26 +1774,17 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1633
1774
|
if (accept_file_segment[1] === '*') {
|
|
1634
1775
|
if (draggedFileMimeType.startsWith(accept_file_segment[0])) {
|
|
1635
1776
|
isAcceptFile = true
|
|
1636
|
-
this.logger.log(
|
|
1637
|
-
'[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept isAcceptFile',
|
|
1638
|
-
isAcceptFile,
|
|
1639
|
-
)
|
|
1777
|
+
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept isAcceptFile',isAcceptFile)
|
|
1640
1778
|
return isAcceptFile
|
|
1641
1779
|
} else {
|
|
1642
1780
|
isAcceptFile = false
|
|
1643
|
-
this.logger.log(
|
|
1644
|
-
'[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept isAcceptFile',
|
|
1645
|
-
isAcceptFile,
|
|
1646
|
-
)
|
|
1781
|
+
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept isAcceptFile',isAcceptFile)
|
|
1647
1782
|
return isAcceptFile
|
|
1648
1783
|
}
|
|
1649
1784
|
} else if (accept_file_segment[1] !== '*') {
|
|
1650
1785
|
if (draggedFileMimeType === accept_file) {
|
|
1651
1786
|
isAcceptFile = true
|
|
1652
|
-
this.logger.log(
|
|
1653
|
-
'[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept isAcceptFile',
|
|
1654
|
-
isAcceptFile,
|
|
1655
|
-
)
|
|
1787
|
+
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept isAcceptFile',isAcceptFile)
|
|
1656
1788
|
return isAcceptFile
|
|
1657
1789
|
}
|
|
1658
1790
|
}
|
|
@@ -1662,6 +1794,64 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1662
1794
|
}
|
|
1663
1795
|
}
|
|
1664
1796
|
|
|
1797
|
+
|
|
1798
|
+
initializeTyping() {
|
|
1799
|
+
this.logger.debug('[CONVS-DETAIL] membersconversation', this.membersConversation)
|
|
1800
|
+
if(this.loggedUser){
|
|
1801
|
+
this.membersConversation.push(this.loggedUser.uid)
|
|
1802
|
+
//this.setSubscriptions();
|
|
1803
|
+
this.typingService.isTyping(this.conversationWith, this.loggedUser.uid, this.isDirect);
|
|
1804
|
+
}
|
|
1805
|
+
}
|
|
1806
|
+
|
|
1807
|
+
/** */
|
|
1808
|
+
subscribeTypings(data: any) {
|
|
1809
|
+
const that = this;
|
|
1810
|
+
try {
|
|
1811
|
+
const key = data.uidUserTypingNow;
|
|
1812
|
+
const waitTime = data.waitTime
|
|
1813
|
+
this.nameUserTypingNow = null;
|
|
1814
|
+
this.idUserTypingNow = null;
|
|
1815
|
+
|
|
1816
|
+
if (data.nameUserTypingNow) {
|
|
1817
|
+
this.nameUserTypingNow = data.nameUserTypingNow;
|
|
1818
|
+
}
|
|
1819
|
+
if (data.uidUserTypingNow){
|
|
1820
|
+
this.idUserTypingNow = data.uidUserTypingNow
|
|
1821
|
+
}
|
|
1822
|
+
this.logger.debug('[CONV-COMP] subscribeTypings data:', data);
|
|
1823
|
+
const userTyping = this.membersConversation.includes(key);
|
|
1824
|
+
if ( !userTyping && key) {
|
|
1825
|
+
this.isTypings = true;
|
|
1826
|
+
setTimeout(function () {
|
|
1827
|
+
that.scrollBottom(0)
|
|
1828
|
+
}, 0);
|
|
1829
|
+
// clearTimeout(this.setTimeoutWritingMessages);
|
|
1830
|
+
this.setTimeoutWritingMessages = setTimeout(() => {
|
|
1831
|
+
that.isTypings = false;
|
|
1832
|
+
}, waitTime);
|
|
1833
|
+
// this.initiTimeout(waitTime)
|
|
1834
|
+
}
|
|
1835
|
+
} catch (error) {
|
|
1836
|
+
this.logger.error('[CONV-COMP] error: ', error);
|
|
1837
|
+
}
|
|
1838
|
+
|
|
1839
|
+
}
|
|
1840
|
+
|
|
1841
|
+
initiTimeout(waitTime){
|
|
1842
|
+
const that = this;
|
|
1843
|
+
this.setTimeoutWritingMessages = setTimeout(() => {
|
|
1844
|
+
that.isTypings = false;
|
|
1845
|
+
}, waitTime);
|
|
1846
|
+
}
|
|
1847
|
+
|
|
1848
|
+
resetTimeout(){
|
|
1849
|
+
this.isTypings = false
|
|
1850
|
+
this.setTimeoutWritingMessages = null;
|
|
1851
|
+
clearTimeout(this.setTimeoutWritingMessages)
|
|
1852
|
+
}
|
|
1853
|
+
|
|
1854
|
+
|
|
1665
1855
|
segmentNewAgentMessage(conversation: ConversationModel){
|
|
1666
1856
|
let user = this.loggedUser
|
|
1667
1857
|
if(window['analytics']){
|
|
@@ -1710,7 +1900,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1710
1900
|
}
|
|
1711
1901
|
}
|
|
1712
1902
|
}
|
|
1713
|
-
|
|
1903
|
+
|
|
1714
1904
|
// -------------------------------------------------------------
|
|
1715
1905
|
// DRAG FILE
|
|
1716
1906
|
// -------------------------------------------------------------
|
|
@@ -1740,7 +1930,8 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1740
1930
|
this.handleDropEvent(ev)
|
|
1741
1931
|
} else {
|
|
1742
1932
|
this.logger.log( '[CONVS-DETAIL] ----> FILE - DROP mimeType files ', mimeType,'NOT SUPPORTED FILE TYPE')
|
|
1743
|
-
this.
|
|
1933
|
+
this.presentToast(this.translationsMap.get('FAILED_TO_UPLOAD_THE_FORMAT_IS_NOT_SUPPORTED'), 'danger','toast-custom-class', 5000 )
|
|
1934
|
+
// this.presentToastOnlyImageFilesAreAllowedToDrag()
|
|
1744
1935
|
}
|
|
1745
1936
|
}
|
|
1746
1937
|
}
|
|
@@ -1768,14 +1959,15 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1768
1959
|
this.logger.log('[CONVS-DETAIL] ----> FILE - FILE - (dragleave) drag his.isHovering ',this.isHovering)
|
|
1769
1960
|
}
|
|
1770
1961
|
|
|
1771
|
-
async
|
|
1962
|
+
async presentToast(message: string, color: string, cssClass: string, duration: number = 2000, position: 'top' | 'bottom' | 'middle'= 'bottom'){
|
|
1772
1963
|
const toast = await this.toastController.create({
|
|
1773
|
-
message:
|
|
1774
|
-
duration:
|
|
1775
|
-
color:
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1964
|
+
message: message,
|
|
1965
|
+
duration: duration,
|
|
1966
|
+
color: color,
|
|
1967
|
+
position: position,
|
|
1968
|
+
cssClass: cssClass,
|
|
1969
|
+
});
|
|
1970
|
+
toast.present();
|
|
1779
1971
|
}
|
|
1780
1972
|
}
|
|
1781
1973
|
// END ALL //
|