@chat21/chat21-ionic 3.0.75 → 3.0.76-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 +14 -1
- package/deploy_amazon_beta.sh +1 -1
- package/package.json +1 -1
- package/src/app/app.component.ts +1 -1
- package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.html +1 -1
- package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.ts +22 -8
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.html +9 -9
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.scss +9 -2
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.ts +5 -6
- package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.html +12 -5
- package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.scss +5 -13
- package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.ts +4 -9
- package/src/app/chatlib/conversation-detail/message/frame/frame.component.ts +8 -3
- package/src/app/chatlib/conversation-detail/message/image/image.component.ts +2 -2
- package/src/app/chatlib/conversation-detail/message/message-attachment/message-attachment.component.ts +6 -1
- package/src/app/components/canned-response/canned-response.component.html +26 -0
- package/src/app/components/canned-response/canned-response.component.scss +141 -0
- package/src/app/components/canned-response/canned-response.component.spec.ts +24 -0
- package/src/app/components/canned-response/canned-response.component.ts +281 -0
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.html +0 -2
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +10 -9
- package/src/app/pages/conversation-detail/conversation-detail.module.ts +2 -0
- package/src/app/pages/conversation-detail/conversation-detail.page.html +42 -13
- package/src/app/pages/conversation-detail/conversation-detail.page.scss +16 -21
- package/src/app/pages/conversation-detail/conversation-detail.page.ts +111 -329
- package/src/app/pages/conversations-list/conversations-list.page.ts +28 -2
- package/src/app/pages/loader-preview/loader-preview.page.ts +8 -27
- package/src/app/services/canned-responses/canned-responses.service.ts +43 -7
- package/src/app/utils/scrollbar-theme.directive.ts +2 -1
- package/src/assets/i18n/ar.json +2 -0
- package/src/assets/i18n/az.json +2 -0
- package/src/assets/i18n/de.json +2 -0
- package/src/assets/i18n/en.json +2 -0
- package/src/assets/i18n/es.json +2 -0
- package/src/assets/i18n/fr.json +2 -0
- package/src/assets/i18n/it.json +2 -0
- package/src/assets/i18n/kk.json +2 -0
- package/src/assets/i18n/pt.json +2 -0
- package/src/assets/i18n/ru.json +2 -0
- package/src/assets/i18n/sr.json +2 -0
- package/src/assets/i18n/sv.json +2 -0
- package/src/assets/i18n/tr.json +2 -0
- package/src/assets/i18n/uk.json +2 -0
- package/src/assets/i18n/uz.json +2 -0
- package/src/chat-config-pre.json +1 -1
- package/src/chat21-core/providers/firebase/firebase-conversation-handler.ts +14 -4
- package/src/chat21-core/providers/firebase/firebase-conversations-handler.ts +1 -1
- package/src/chat21-core/providers/mqtt/mqtt-conversation-handler.ts +22 -0
- package/src/chat21-core/utils/constants.ts +3 -1
- package/src/chat21-core/utils/utils.ts +14 -0
- package/src/global.scss +3 -113
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
import { Component, Input, OnInit, SimpleChange, ElementRef, Output, EventEmitter, HostListener } from '@angular/core';
|
|
2
|
+
import { CreateCannedResponsePage } from 'src/app/pages/create-canned-response/create-canned-response.page';
|
|
3
|
+
import { CannedResponsesService } from 'src/app/services/canned-responses/canned-responses.service';
|
|
4
|
+
import { TiledeskService } from 'src/app/services/tiledesk/tiledesk.service';
|
|
5
|
+
import { UserModel } from 'src/chat21-core/models/user';
|
|
6
|
+
import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
|
|
7
|
+
import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
|
|
8
|
+
import { TiledeskAuthService } from 'src/chat21-core/providers/tiledesk/tiledesk-auth.service';
|
|
9
|
+
import { compareValues, htmlEntities } from 'src/chat21-core/utils/utils';
|
|
10
|
+
|
|
11
|
+
@Component({
|
|
12
|
+
selector: 'app-canned-response',
|
|
13
|
+
templateUrl: './canned-response.component.html',
|
|
14
|
+
styleUrls: ['./canned-response.component.scss'],
|
|
15
|
+
})
|
|
16
|
+
export class CannedResponseComponent implements OnInit {
|
|
17
|
+
|
|
18
|
+
// @Input() tagsCannedFilter: any = []
|
|
19
|
+
@Input() conversationWith: string;
|
|
20
|
+
@Input() conversationWithFullname: string;
|
|
21
|
+
@Input() currentString: string;
|
|
22
|
+
@Input() translationMap: Map<string, string>;
|
|
23
|
+
@Output() onLoadedCannedResponses = new EventEmitter<[any]>();
|
|
24
|
+
@Output() onClickCanned = new EventEmitter<any>();
|
|
25
|
+
@Output() onClickAddCannedResponse = new EventEmitter();
|
|
26
|
+
public loggedUser: UserModel
|
|
27
|
+
|
|
28
|
+
public tagsCanned: any = []
|
|
29
|
+
public tagsCannedCount: number
|
|
30
|
+
public tagsCannedFilter: any = []
|
|
31
|
+
|
|
32
|
+
public arrowkeyLocation = -1
|
|
33
|
+
|
|
34
|
+
private logger: LoggerService = LoggerInstance.getInstance();
|
|
35
|
+
constructor(
|
|
36
|
+
public tiledeskAuthService: TiledeskAuthService,
|
|
37
|
+
public tiledeskService: TiledeskService,
|
|
38
|
+
public cannedResponsesService: CannedResponsesService,
|
|
39
|
+
public el: ElementRef
|
|
40
|
+
) { }
|
|
41
|
+
|
|
42
|
+
ngOnInit() {
|
|
43
|
+
this.loggedUser = this.tiledeskAuthService.getCurrentUser()
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
ngOnChanges(changes: SimpleChange){
|
|
47
|
+
this.logger.debug('[CANNED] - loadTagsCanned strSearch ', this.currentString)
|
|
48
|
+
if(this.currentString !== undefined){
|
|
49
|
+
this.loadTagsCanned(this.currentString, this.conversationWith)
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// ----------------------------------------------------------
|
|
54
|
+
// @ CANNED RESPONSES methods
|
|
55
|
+
// ----------------------------------------------------------
|
|
56
|
+
loadTagsCanned(strSearch, conversationWith) {
|
|
57
|
+
this.logger.log('[CANNED] - loadTagsCanned strSearch ', strSearch)
|
|
58
|
+
this.logger.log('[CANNED] - loadTagsCanned conversationWith ', conversationWith)
|
|
59
|
+
|
|
60
|
+
const conversationWith_segments = conversationWith.split('-')
|
|
61
|
+
// Removes the last element of the array if is = to the separator
|
|
62
|
+
if (conversationWith_segments[conversationWith_segments.length - 1] === '') {
|
|
63
|
+
conversationWith_segments.pop()
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
this.logger.log('[CANNED] - loadTagsCanned conversationWith_segments ', conversationWith_segments)
|
|
67
|
+
let projectId = ''
|
|
68
|
+
|
|
69
|
+
if (conversationWith_segments.length === 4) {
|
|
70
|
+
projectId = conversationWith_segments[2]
|
|
71
|
+
this.logger.log('[CANNED] - loadTagsCanned projectId ', projectId)
|
|
72
|
+
this.getAndShowCannedResponses(strSearch, projectId)
|
|
73
|
+
} else {
|
|
74
|
+
this.getProjectIdByConversationWith(strSearch, this.conversationWith)
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
getProjectIdByConversationWith(strSearch, conversationWith: string) {
|
|
79
|
+
const tiledeskToken = this.tiledeskAuthService.getTiledeskToken()
|
|
80
|
+
|
|
81
|
+
this.tiledeskService.getProjectIdByConvRecipient(tiledeskToken, conversationWith).subscribe((res) => {
|
|
82
|
+
this.logger.log('[CANNED] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT RES', res)
|
|
83
|
+
if (res) {
|
|
84
|
+
const projectId = res.id_project
|
|
85
|
+
this.logger.log('[CANNED] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT projectId ', projectId)
|
|
86
|
+
if (projectId) {
|
|
87
|
+
this.getAndShowCannedResponses(strSearch, projectId)
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}, (error) => {
|
|
91
|
+
this.logger.error('[CANNED] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT - ERROR ', error)
|
|
92
|
+
}, () => {
|
|
93
|
+
this.logger.log('[CANNED] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT * COMPLETE *')
|
|
94
|
+
})
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
getAndShowCannedResponses(strSearch, projectId) {
|
|
98
|
+
const tiledeskToken = this.tiledeskAuthService.getTiledeskToken()
|
|
99
|
+
this.logger.log('[CANNED] - loadTagsCanned tagsCanned.length', this.tagsCanned.length)
|
|
100
|
+
//if(this.tagsCanned.length <= 0 ){
|
|
101
|
+
this.tagsCanned = []
|
|
102
|
+
this.cannedResponsesService.getAll(tiledeskToken, projectId).subscribe((res) => {
|
|
103
|
+
this.logger.log('[CANNED] - loadTagsCanned getCannedResponses RES', res)
|
|
104
|
+
|
|
105
|
+
this.tagsCanned = res
|
|
106
|
+
this.tagsCannedCount = res.length
|
|
107
|
+
this.logger.log('[CANNED] - loadTagsCanned getCannedResponses tagsCannedCount', this.tagsCannedCount)
|
|
108
|
+
// if (this.HIDE_CANNED_RESPONSES === false) {
|
|
109
|
+
this.showTagsCanned(strSearch)
|
|
110
|
+
// }
|
|
111
|
+
}, (error) => {
|
|
112
|
+
this.logger.error('[CANNED] - loadTagsCanned getCannedResponses - ERROR ', error)
|
|
113
|
+
}, () => {
|
|
114
|
+
this.logger.log('[CANNED] - loadTagsCanned getCannedResponses * COMPLETE *')
|
|
115
|
+
})
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
showTagsCanned(strSearch) {
|
|
119
|
+
this.logger.log('[CANNED] - showTagsCanned strSearch ', strSearch)
|
|
120
|
+
this.tagsCannedFilter = []
|
|
121
|
+
var tagsCannedClone = JSON.parse(JSON.stringify(this.tagsCanned))
|
|
122
|
+
this.logger.log('[CANNED] - showTagsCanned tagsCannedClone ', tagsCannedClone)
|
|
123
|
+
//this.logger.log("that.contacts lenght:: ", strSearch);
|
|
124
|
+
this.tagsCannedFilter = this.filterItems(tagsCannedClone, strSearch)
|
|
125
|
+
this.logger.log('[CANNED] - showTagsCanned tagsCannedFilter ', this.tagsCannedFilter)
|
|
126
|
+
|
|
127
|
+
this.tagsCannedFilter.sort(compareValues('title', 'asc'))
|
|
128
|
+
var strReplace = strSearch
|
|
129
|
+
if (strSearch.length > 0) {
|
|
130
|
+
strReplace = "<b class='highlight-search-string'>" + strSearch + '</b>'
|
|
131
|
+
}
|
|
132
|
+
// for (var i = 0; i < this.tagsCannedFilter.length; i++) {
|
|
133
|
+
// let text = htmlEntities(this.tagsCannedFilter[i].text);
|
|
134
|
+
// // const textCanned = "<div class='cannedText'>" + this.replacePlaceholderInCanned(this.tagsCannedFilter[i].text) + '</div>'
|
|
135
|
+
// const textCanned = "<div class='cannedText'>" + this.replacePlaceholderInCanned(text) + '</div>'
|
|
136
|
+
// let title = htmlEntities(this.tagsCannedFilter[i].title)
|
|
137
|
+
// // this.tagsCannedFilter[i].title = "<div class='cannedContent'><div class='cannedTitle'>" + this.tagsCannedFilter[i].title.toString().replace(strSearch, strReplace.trim()) + '</div>' + textCanned + '</div>'
|
|
138
|
+
// this.tagsCannedFilter[i].title = "<div class='cannedContent'><div class='cannedTitle'>" + title.toString().replace(strSearch, strReplace.trim()) + '</div>' + textCanned + '</div>'
|
|
139
|
+
// }
|
|
140
|
+
this.tagsCannedFilter.forEach(canned => {
|
|
141
|
+
canned.text = this.replacePlaceholderInCanned(canned.text);
|
|
142
|
+
canned.disabled = true
|
|
143
|
+
});
|
|
144
|
+
if (this.tagsCannedCount === 0) {
|
|
145
|
+
// const button = this.renderer.createElement('button');
|
|
146
|
+
// const buttonText = this.renderer.createText('Click me');
|
|
147
|
+
// this.renderer.appendChild(button, buttonText);
|
|
148
|
+
// console.log('[CANNED] - this.el.nativeElement ', this.el.nativeElement)
|
|
149
|
+
// this.renderer.listen(button, 'click', () => { alert('hi'); });
|
|
150
|
+
// let nocanned = {}
|
|
151
|
+
// if (this.USER_ROLE !== 'agent') {
|
|
152
|
+
const nocanned = {
|
|
153
|
+
// "<div class='cannedContent'><div class='cannedTitle nocannedTitle #noCannedTitle'>" + this.translationMap.get('THERE_ARE_NO_CANNED_RESPONSES_AVAILABLE') + ".</div><div class='cannedText'>" + this.translationMap.get('TO_CREATE_THEM_GO_TO_THE_PROJECT') + '</div></div>'
|
|
154
|
+
// <div class='cannedText no-canned-available-text'>" + this.translationMap.get('AddNewCannedResponse') + '</div>
|
|
155
|
+
title: this.translationMap.get('THERE_ARE_NO_CANNED_RESPONSES_AVAILABLE') ,
|
|
156
|
+
text: '',
|
|
157
|
+
}
|
|
158
|
+
// } else if (this.USER_ROLE === 'agent') {
|
|
159
|
+
// nocanned = {
|
|
160
|
+
// // "<div class='cannedContent'><div class='cannedTitle nocannedTitle #noCannedTitle'>" + this.translationMap.get('THERE_ARE_NO_CANNED_RESPONSES_AVAILABLE') + ".</div><div class='cannedText'>" + this.translationMap.get('TO_CREATE_THEM_GO_TO_THE_PROJECT') + '</div></div>'
|
|
161
|
+
// title:
|
|
162
|
+
// "<div class='cannedContent'><div class='cannedTitle nocannedTitle #noCannedTitle'>" + this.translationMap.get('THERE_ARE_NO_CANNED_RESPONSES_AVAILABLE') + ".</div></div>",
|
|
163
|
+
// text: 'There are no canned responses available',
|
|
164
|
+
// }
|
|
165
|
+
// }
|
|
166
|
+
this.tagsCannedFilter.push(nocanned)
|
|
167
|
+
}
|
|
168
|
+
this.onLoadedCannedResponses.emit(this.tagsCannedFilter)
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
filterItems(items, searchTerm) {
|
|
172
|
+
this.logger.log('[CANNED] filterItems tagsCannedClone ', items, ' searchTerm: ', searchTerm)
|
|
173
|
+
//this.logger.log("filterItems::: ",searchTerm);
|
|
174
|
+
return items.filter((item) => {
|
|
175
|
+
//this.logger.log("filterItems::: ", item.title.toString().toLowerCase());
|
|
176
|
+
this.logger.log('[CANNED] filtered tagsCannedClone item ', item)
|
|
177
|
+
return item.title.toString().toLowerCase().indexOf(searchTerm.toString().toLowerCase()) > -1
|
|
178
|
+
})
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
replacePlaceholderInCanned(str) {
|
|
182
|
+
this.logger.log('[CANNED] - replacePlaceholderInCanned str ', str)
|
|
183
|
+
str = str.replace('$recipient_name', this.conversationWithFullname)
|
|
184
|
+
if (this.loggedUser && this.loggedUser.fullname) {
|
|
185
|
+
str = str.replace('$agent_name', this.loggedUser.fullname)
|
|
186
|
+
}
|
|
187
|
+
return str
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
onEditCanned(canned, ev){
|
|
192
|
+
ev.preventDefault()
|
|
193
|
+
ev.stopPropagation()
|
|
194
|
+
canned.disabled = false
|
|
195
|
+
this.logger.log('[CANNED] onEditCanned ', canned)
|
|
196
|
+
setTimeout(() => {
|
|
197
|
+
this.el.nativeElement.querySelector('#titleCanned_'+canned._id).setFocus()
|
|
198
|
+
}, 500);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
onConfirmEditCanned(canned, ev){
|
|
202
|
+
ev.preventDefault()
|
|
203
|
+
ev.stopPropagation()
|
|
204
|
+
const tiledeskToken = this.tiledeskAuthService.getTiledeskToken()
|
|
205
|
+
this.logger.log('[CANNED] onConfirmEditCanned ', canned, ev)
|
|
206
|
+
this.cannedResponsesService.edit(tiledeskToken, canned.id_project, canned).subscribe(cannedRes=> {
|
|
207
|
+
canned.disabled = true
|
|
208
|
+
}, (error) => {
|
|
209
|
+
this.logger.error('[CANNED] - onConfirmEditCanned - ERROR ', error)
|
|
210
|
+
}, () => {
|
|
211
|
+
this.logger.log('[CANNED] - onConfirmEditCanned * COMPLETE *')
|
|
212
|
+
})
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
onDeleteCanned(canned, ev){
|
|
216
|
+
ev.preventDefault()
|
|
217
|
+
ev.stopPropagation()
|
|
218
|
+
const tiledeskToken = this.tiledeskAuthService.getTiledeskToken()
|
|
219
|
+
this.logger.log('[CANNED] onDeleteCanned ', canned)
|
|
220
|
+
this.cannedResponsesService.delete(tiledeskToken, canned.id_project, canned._id).subscribe(cannedRes=> {
|
|
221
|
+
if(cannedRes.status === 1000){
|
|
222
|
+
this.tagsCannedFilter.splice(this.tagsCannedFilter.findIndex(el => el._id === canned._id), 1)
|
|
223
|
+
}
|
|
224
|
+
}, (error) => {
|
|
225
|
+
this.logger.error('[CANNED] - onConfirmEditCanned - ERROR ', error)
|
|
226
|
+
}, () => {
|
|
227
|
+
this.logger.log('[CANNED] - onConfirmEditCanned * COMPLETE *')
|
|
228
|
+
})
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
onClickCannedFN(canned, event){
|
|
232
|
+
if(!canned.disabled){
|
|
233
|
+
event.preventDefault();
|
|
234
|
+
event.stopPropagation();
|
|
235
|
+
} else if(this.tagsCannedCount > 0){
|
|
236
|
+
this.onClickCanned.emit(canned)
|
|
237
|
+
} else {
|
|
238
|
+
this.logger.log('[CANNED] THERE IS NOT CANNED ', canned.text)
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
onClickAddCannedResponseFN(){
|
|
243
|
+
this.onClickAddCannedResponse.emit()
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
@HostListener('document:keydown', ['$event'])
|
|
248
|
+
handleKeyboardEvent(event: KeyboardEvent) {
|
|
249
|
+
this.logger.log("CONVERSATION-DETAIL handleKeyboardEvent event.key ", event);
|
|
250
|
+
|
|
251
|
+
if (this.tagsCannedFilter.length > 0) {
|
|
252
|
+
if (event.key === 'ArrowDown') {
|
|
253
|
+
this.arrowkeyLocation++
|
|
254
|
+
if (this.arrowkeyLocation === this.tagsCannedFilter.length) {
|
|
255
|
+
this.arrowkeyLocation--
|
|
256
|
+
}
|
|
257
|
+
// this.replaceTagInMessage(this.tagsCannedFilter[this.arrowkeyLocation])
|
|
258
|
+
} else if (event.key === 'ArrowUp') {
|
|
259
|
+
if (this.arrowkeyLocation > 0) {
|
|
260
|
+
this.arrowkeyLocation--
|
|
261
|
+
} else if (this.arrowkeyLocation < 0) {
|
|
262
|
+
this.arrowkeyLocation++
|
|
263
|
+
}
|
|
264
|
+
// this.replaceTagInMessage(this.tagsCannedFilter[this.arrowkeyLocation])
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
if (event.key === 'Enter') {
|
|
268
|
+
const canned_selected = this.tagsCannedFilter[this.arrowkeyLocation]
|
|
269
|
+
this.logger.log('[CONVS-DETAIL] replaceTagInMessage canned_selected ',canned_selected)
|
|
270
|
+
if (canned_selected) {
|
|
271
|
+
this.arrowkeyLocation = -1
|
|
272
|
+
this.tagsCannedFilter = []
|
|
273
|
+
this.onClickCanned.emit(canned_selected)
|
|
274
|
+
// event.preventDefault();
|
|
275
|
+
// return false;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
}
|
package/src/app/components/conversation-detail/message-text-area/message-text-area.component.html
CHANGED
|
@@ -68,9 +68,7 @@
|
|
|
68
68
|
style="font-size: 30px;transform: rotate(42deg);"></ion-icon>
|
|
69
69
|
<input #fileInput type="file" (change)="onFileSelected($event)" capture="camera" id="file-input"
|
|
70
70
|
[accept]="fileUploadAccept">
|
|
71
|
-
|
|
72
71
|
</ion-button>
|
|
73
|
-
|
|
74
72
|
</div>
|
|
75
73
|
|
|
76
74
|
<!-- <ion-icon (click)="showEmojiPicker = !showEmojiPicker" color="secondary" name="happy" style="zoom:2;"></ion-icon> -->
|
package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UserModel } from 'src/chat21-core/models/user';
|
|
2
|
-
import { Component, OnInit, Output, EventEmitter, Input, AfterViewInit, ViewChild, ElementRef, OnChanges, HostListener, Renderer2 } from '@angular/core';
|
|
2
|
+
import { Component, OnInit, Output, EventEmitter, Input, AfterViewInit, ViewChild, ElementRef, OnChanges, HostListener, Renderer2, SimpleChange, SimpleChanges } from '@angular/core';
|
|
3
3
|
|
|
4
4
|
import { Chooser } from '@ionic-native/chooser/ngx';
|
|
5
5
|
import { IonTextarea, ModalController, ToastController } from '@ionic/angular';
|
|
@@ -43,7 +43,7 @@ export class MessageTextAreaComponent implements OnInit, AfterViewInit, OnChange
|
|
|
43
43
|
|
|
44
44
|
@Input() loggedUser: UserModel;
|
|
45
45
|
@Input() conversationWith: string;
|
|
46
|
-
@Input() tagsCannedFilter: any
|
|
46
|
+
@Input() tagsCannedFilter: any;
|
|
47
47
|
@Input() tagsCannedCount: number;
|
|
48
48
|
@Input() areVisibleCAR: boolean;
|
|
49
49
|
@Input() supportMode: boolean;
|
|
@@ -52,11 +52,11 @@ export class MessageTextAreaComponent implements OnInit, AfterViewInit, OnChange
|
|
|
52
52
|
@Input() isOpenInfoConversation: boolean;
|
|
53
53
|
@Input() translationMap: Map<string, string>;
|
|
54
54
|
@Input() dropEvent: any;
|
|
55
|
+
@Input() disableTextarea: boolean;
|
|
55
56
|
@Output() eventChangeTextArea = new EventEmitter<object>();
|
|
56
|
-
@Output() hasClickedOpenCannedResponses = new EventEmitter<boolean>();
|
|
57
57
|
@Output() eventSendMessage = new EventEmitter<object>();
|
|
58
|
+
@Output() onClickOpenCannedResponses = new EventEmitter<boolean>();
|
|
58
59
|
@Output() onPresentModalScrollToBottom = new EventEmitter<boolean>();
|
|
59
|
-
@Input() disableTextarea: boolean;
|
|
60
60
|
|
|
61
61
|
public conversationEnabled = false;
|
|
62
62
|
public messageString: string;
|
|
@@ -69,6 +69,7 @@ export class MessageTextAreaComponent implements OnInit, AfterViewInit, OnChange
|
|
|
69
69
|
public currentWindowWidth: any;
|
|
70
70
|
private logger: LoggerService = LoggerInstance.getInstance();
|
|
71
71
|
public countClicks: number = 0;
|
|
72
|
+
public openCanned: boolean = false;
|
|
72
73
|
public IS_SUPPORT_GROUP_CONVERSATION: boolean;
|
|
73
74
|
public IS_ON_MOBILE_DEVICE: boolean;
|
|
74
75
|
TYPE_MSG_TEXT = TYPE_MSG_TEXT;
|
|
@@ -140,9 +141,7 @@ export class MessageTextAreaComponent implements OnInit, AfterViewInit, OnChange
|
|
|
140
141
|
}
|
|
141
142
|
|
|
142
143
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
ngOnChanges() {
|
|
144
|
+
ngOnChanges(changes: SimpleChanges) {
|
|
146
145
|
if (this.translationMap) {
|
|
147
146
|
// this.LONG_TEXAREA_PLACEHOLDER = this.translationMap.get('LABEL_ENTER_MSG')
|
|
148
147
|
// this.SHORT_TEXAREA_PLACEHOLDER = this.translationMap.get('LABEL_ENTER_MSG_SHORT')
|
|
@@ -580,7 +579,8 @@ export class MessageTextAreaComponent implements OnInit, AfterViewInit, OnChange
|
|
|
580
579
|
}
|
|
581
580
|
|
|
582
581
|
openCannedResponses() {
|
|
583
|
-
this.
|
|
582
|
+
this.openCanned = !this.openCanned
|
|
583
|
+
this.onClickOpenCannedResponses.emit(this.openCanned);
|
|
584
584
|
}
|
|
585
585
|
|
|
586
586
|
|
|
@@ -698,8 +698,9 @@ export class MessageTextAreaComponent implements OnInit, AfterViewInit, OnChange
|
|
|
698
698
|
|
|
699
699
|
@HostListener('document:keydown', ['$event'])
|
|
700
700
|
handleKeyboardEvent(event: KeyboardEvent) {
|
|
701
|
-
|
|
701
|
+
this.logger.log("[CONVS-DETAIL][MSG-TEXT-AREA] handleKeyboardEvent event.key ", event);
|
|
702
702
|
// Note: on mac keyboard "metakey" matches "cmd"
|
|
703
|
+
|
|
703
704
|
if (event.key === 'Enter' && event.altKey || event.key === 'Enter' && event.ctrlKey || event.key === 'Enter' && event.metaKey) {
|
|
704
705
|
this.logger.log('[CONVS-DETAIL][MSG-TEXT-AREA] HAS PRESSED COMBO KEYS this.messageString', this.messageString);
|
|
705
706
|
if (this.messageString !== undefined && this.messageString.trim() !== '') {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CannedResponseComponent } from './../../components/canned-response/canned-response.component';
|
|
1
2
|
import { TruncatePipe } from './../../directives/truncate.pipe';
|
|
2
3
|
import { IonConversationDetailComponent } from '../../chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component';
|
|
3
4
|
import { TooltipModule } from 'ng2-tooltip-directive';
|
|
@@ -63,6 +64,7 @@ import { PickerModule } from '@ctrl/ngx-emoji-mart';
|
|
|
63
64
|
ConversationDetailPage,
|
|
64
65
|
HeaderConversationDetailComponent,
|
|
65
66
|
MessageTextAreaComponent,
|
|
67
|
+
CannedResponseComponent,
|
|
66
68
|
// BubbleDayMessageComponent,
|
|
67
69
|
// BubbleSystemMessageComponent,
|
|
68
70
|
// BubbleMyMessageComponent,
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
here is ignored
|
|
56
56
|
</span>
|
|
57
57
|
|
|
58
|
-
<div class="overlay" *ngIf="
|
|
58
|
+
<div class="overlay" *ngIf="!HIDE_CANNED_RESPONSES"></div>
|
|
59
59
|
|
|
60
60
|
<ng-template #content_welcome>
|
|
61
61
|
<!-- <div class="messageFirst">
|
|
@@ -118,6 +118,7 @@
|
|
|
118
118
|
</ion-grid>
|
|
119
119
|
|
|
120
120
|
|
|
121
|
+
|
|
121
122
|
<ion-conversation-detail *ngIf="isHovering === false" #conversationContentDetail
|
|
122
123
|
[channelType]="channelType"
|
|
123
124
|
[messages]="messages"
|
|
@@ -126,12 +127,12 @@
|
|
|
126
127
|
[areVisibleCAR]="areVisibleCAR"
|
|
127
128
|
[supportMode]= "supportMode"
|
|
128
129
|
[stylesMap]="styleMap"
|
|
129
|
-
(onBeforeMessageRender)="
|
|
130
|
-
(onAfterMessageRender)="
|
|
131
|
-
(onAttachmentButtonClicked)="
|
|
130
|
+
(onBeforeMessageRender)="onBeforeMessageRenderFN($event)"
|
|
131
|
+
(onAfterMessageRender)="onAfterMessageRenderFN($event)"
|
|
132
|
+
(onAttachmentButtonClicked)="onAttachmentButtonClickedFN($event)"
|
|
132
133
|
(onScrollContent)="returnOnScrollContent($event)"
|
|
133
134
|
(onMenuOptionShow)="returnOnMenuOption($event)"
|
|
134
|
-
(
|
|
135
|
+
(onElementRendered)="onElementRenderedFN($event)"
|
|
135
136
|
(onAddUploadingBubble)="addUploadingBubbleEvent($event)">
|
|
136
137
|
</ion-conversation-detail>
|
|
137
138
|
|
|
@@ -149,25 +150,53 @@
|
|
|
149
150
|
<!-- ----------------------------------------------------------- -->
|
|
150
151
|
<!-- Canned responses -->
|
|
151
152
|
<!-- ----------------------------------------------------------- -->
|
|
152
|
-
<
|
|
153
|
-
|
|
153
|
+
<app-canned-response *ngIf="HIDE_CANNED_RESPONSES === false"
|
|
154
|
+
id="canned"
|
|
155
|
+
[conversationWith]="conversationWith"
|
|
156
|
+
[conversationWithFullname]="conversationWithFullname"
|
|
157
|
+
[currentString]="messageStr"
|
|
158
|
+
[translationMap]="translationMap"
|
|
159
|
+
(onLoadedCannedResponses)="onLoadedCannedResponses($event)"
|
|
160
|
+
(onClickCanned)="replaceTagInMessage($event)"
|
|
161
|
+
(onClickAddCannedResponse)="presentCreateCannedResponseModal()">
|
|
162
|
+
</app-canned-response>
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
<!-- <div id="canned" *ngIf="tagsCannedFilter.length > 0 && HIDE_CANNED_RESPONSES === false">
|
|
166
|
+
<div class="header">
|
|
167
|
+
<ion-item lines="none"> <ion-icon class="canned-response-icon-header" name="flash-outline"></ion-icon> Canned responses</ion-item>
|
|
168
|
+
<ion-item lines="none" (click)="presentCreateCannedResponseModal()">
|
|
169
|
+
<ion-icon class="canned-response-icon-header" name="add" slot="start"></ion-icon>
|
|
170
|
+
New response
|
|
171
|
+
</ion-item>
|
|
172
|
+
<ion-item lines="none" (click)="closeListCannedResponse()"> <ion-icon class="canned-response-icon-header" name="close" ></ion-icon></ion-item>
|
|
173
|
+
</div>
|
|
174
|
+
<ion-list class="canned-list" >
|
|
154
175
|
<ion-item button="true" [ngClass]="{'is_active_item': i == arrowkeyLocation}" lines="none"
|
|
155
|
-
class="canned-item" id="{{'canned-item_'+ i }}"
|
|
156
|
-
*ngFor="let canned of tagsCannedFilter; let i = index;"
|
|
176
|
+
class="canned-item no-ripple border" id="{{'canned-item_'+ i }}"
|
|
177
|
+
*ngFor="let canned of tagsCannedFilter; let i = index;"
|
|
157
178
|
(click)="replaceTagInMessage(canned, $event)">
|
|
179
|
+
<div class="cannedContent">
|
|
180
|
+
<ion-input [(ngModel)]="canned.title" class="title" id="{{'titleCanned_'+canned._id}}" [disabled]="canned.disabled"></ion-input>
|
|
181
|
+
<ion-input [(ngModel)]="canned.text" class="text" [disabled]="canned.disabled"></ion-input>
|
|
182
|
+
</div>
|
|
183
|
+
<ion-icon class="canned-item-icon" name="checkmark-sharp" slot=end *ngIf="canned.createdBy === loggedUser.uid && !canned.disabled" (click)="onConfirmEditCanned(canned, $event)"></ion-icon>
|
|
184
|
+
<ion-icon class="canned-item-icon" name="pencil-sharp" slot=end *ngIf="canned.createdBy === loggedUser.uid && canned.disabled" (click)="onEditCanned(canned, $event)"></ion-icon>
|
|
185
|
+
<ion-icon class="canned-item-icon" name="trash-sharp" slot=end *ngIf="canned.createdBy === loggedUser.uid" (click)="onDeleteCanned(canned, $event)"></ion-icon>
|
|
158
186
|
</ion-item>
|
|
187
|
+
|
|
159
188
|
<ion-item class="canned-item add-canned-response-wpr" button="true" lines="none" (click)="presentCreateCannedResponseModal()">
|
|
160
189
|
<ion-icon class="add-canned-response-icon" name="flash-outline"></ion-icon>
|
|
161
190
|
<span class="add-canned-response-add-icon">+</span>
|
|
162
191
|
<label class="add-canned-response-label" >{{translationMap?.get('AddNewCannedResponse')}}</label>
|
|
163
192
|
</ion-item>
|
|
164
193
|
</ion-list>
|
|
165
|
-
|
|
194
|
+
<!- - <ion-list class="canned-list" *ngIf="tagsCannedFilter.length === 0 && HIDE_CANNED_RESPONSES === false">
|
|
166
195
|
<ion-item button="true" >
|
|
167
196
|
There are no canned responses available
|
|
168
197
|
</ion-item>
|
|
169
|
-
</ion-list>
|
|
170
|
-
</div>
|
|
198
|
+
</ion-list> - ->
|
|
199
|
+
</div> -->
|
|
171
200
|
|
|
172
201
|
|
|
173
202
|
|
|
@@ -188,7 +217,7 @@
|
|
|
188
217
|
[dropEvent]="dropEvent"
|
|
189
218
|
[disableTextarea]="disableTextarea"
|
|
190
219
|
(eventChangeTextArea)="returnChangeTextArea($event)"
|
|
191
|
-
(
|
|
220
|
+
(onClickOpenCannedResponses)="onClickOpenCannedResponses($event)"
|
|
192
221
|
(eventSendMessage)="returnSendMessage($event)"
|
|
193
222
|
(onPresentModalScrollToBottom)="onPresentModalScrollToBottom($event)">
|
|
194
223
|
</app-message-text-area>
|
|
@@ -25,22 +25,7 @@
|
|
|
25
25
|
font-size: 24px;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
color: #b3bfd0;
|
|
30
|
-
cursor: pointer;
|
|
31
|
-
font-size: 18px;
|
|
32
|
-
}
|
|
33
|
-
.add-canned-response-label {
|
|
34
|
-
color: #b3bfd0;
|
|
35
|
-
cursor: pointer;
|
|
36
|
-
}
|
|
37
|
-
.add-canned-response-add-icon {
|
|
38
|
-
color: #b3bfd0;
|
|
39
|
-
cursor: pointer;
|
|
40
|
-
position: relative;
|
|
41
|
-
top: 4px;
|
|
42
|
-
left: -6px;
|
|
43
|
-
}
|
|
28
|
+
|
|
44
29
|
|
|
45
30
|
#canned > ion-list > ion-item.canned-item.add-canned-response-wpr:hover > span {
|
|
46
31
|
color: #1877f2;
|
|
@@ -383,6 +368,20 @@ ion-content {
|
|
|
383
368
|
}
|
|
384
369
|
}
|
|
385
370
|
}
|
|
371
|
+
|
|
372
|
+
#canned {
|
|
373
|
+
z-index: 99999;
|
|
374
|
+
width: 100%;
|
|
375
|
+
// background: rgba(237,240,244,.9);
|
|
376
|
+
// position: fixed;
|
|
377
|
+
// top: 0;
|
|
378
|
+
// bottom: 0;
|
|
379
|
+
// left: 0;
|
|
380
|
+
// right: 0;
|
|
381
|
+
// overflow: hidden;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
|
|
386
385
|
}
|
|
387
386
|
|
|
388
387
|
.chat-area-apps-sidebar-wide {
|
|
@@ -488,13 +487,9 @@ ion-content {
|
|
|
488
487
|
right: 0;
|
|
489
488
|
left: 0;
|
|
490
489
|
bottom: 0;
|
|
491
|
-
z-index: 99998; // here plz remove this comma
|
|
490
|
+
// z-index: 99998; // here plz remove this comma
|
|
492
491
|
}
|
|
493
492
|
|
|
494
|
-
.is_active_item {
|
|
495
|
-
// background-color: #eaf1fd!important;
|
|
496
|
-
--background: #eaf1fd !important;
|
|
497
|
-
}
|
|
498
493
|
|
|
499
494
|
// -------------------------------------------------------------
|
|
500
495
|
// DRAG FILE
|