@chat21/chat21-ionic 3.0.76-rc.1 → 3.0.76-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
  2. package/.github/ISSUE_TEMPLATE/custom.md +10 -0
  3. package/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  4. package/CHANGELOG.md +10 -0
  5. package/package.json +1 -1
  6. package/src/app/app.component.html +2 -0
  7. package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.html +1 -1
  8. package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.ts +15 -1
  9. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.html +1 -1
  10. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.scss +9 -2
  11. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.html +8 -1
  12. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.scss +5 -3
  13. package/src/app/components/canned-response/canned-response.component.html +26 -0
  14. package/src/app/components/canned-response/canned-response.component.scss +141 -0
  15. package/src/app/components/canned-response/canned-response.component.spec.ts +24 -0
  16. package/src/app/components/canned-response/canned-response.component.ts +281 -0
  17. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +9 -8
  18. package/src/app/components/image-viewer/image-viewer.component.html +22 -16
  19. package/src/app/components/image-viewer/image-viewer.component.scss +40 -56
  20. package/src/app/components/network-offline/network-offline.component.html +5 -0
  21. package/src/app/components/network-offline/network-offline.component.scss +30 -0
  22. package/src/app/components/network-offline/network-offline.component.spec.ts +24 -0
  23. package/src/app/components/network-offline/network-offline.component.ts +43 -0
  24. package/src/app/pages/conversation-detail/conversation-detail.module.ts +2 -0
  25. package/src/app/pages/conversation-detail/conversation-detail.page.html +25 -12
  26. package/src/app/pages/conversation-detail/conversation-detail.page.scss +14 -29
  27. package/src/app/pages/conversation-detail/conversation-detail.page.ts +81 -357
  28. package/src/app/pages/conversations-list/conversations-list.page.html +0 -23
  29. package/src/app/pages/conversations-list/conversations-list.page.ts +3 -21
  30. package/src/app/shared/shared.module.ts +4 -2
  31. package/src/assets/i18n/ar.json +2 -0
  32. package/src/assets/i18n/az.json +2 -0
  33. package/src/assets/i18n/de.json +2 -0
  34. package/src/assets/i18n/en.json +2 -0
  35. package/src/assets/i18n/es.json +2 -0
  36. package/src/assets/i18n/fr.json +2 -0
  37. package/src/assets/i18n/it.json +2 -0
  38. package/src/assets/i18n/kk.json +2 -0
  39. package/src/assets/i18n/pt.json +2 -0
  40. package/src/assets/i18n/ru.json +2 -0
  41. package/src/assets/i18n/sr.json +2 -0
  42. package/src/assets/i18n/sv.json +2 -0
  43. package/src/assets/i18n/tr.json +2 -0
  44. package/src/assets/i18n/uk.json +2 -0
  45. package/src/assets/i18n/uz.json +2 -0
  46. package/src/chat-config-mqtt-localhost.json +1 -1
  47. package/src/chat21-core/providers/firebase/firebase-conversations-handler.ts +2 -2
  48. package/src/global.scss +0 -137
@@ -130,10 +130,8 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
130
130
  public conv_type: string
131
131
 
132
132
  public messageStr: string;
133
- public tagsCanned: any = []
134
- public tagsCannedCount: number
135
- public tagsCannedFilter: Array<any> = []
136
- public HIDE_CANNED_RESPONSES: boolean = false
133
+ public tagsCannedFilter: Array<any>= [];
134
+ public HIDE_CANNED_RESPONSES: boolean = true
137
135
 
138
136
  public window: any = window
139
137
  public styleMap: Map<string, string> = new Map()
@@ -142,7 +140,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
142
140
  MESSAGE_TYPE_MINE = MESSAGE_TYPE_MINE
143
141
  MESSAGE_TYPE_OTHERS = MESSAGE_TYPE_OTHERS
144
142
 
145
- arrowkeyLocation = -1
143
+
146
144
  public_Key: any;
147
145
  areVisibleCAR: boolean;
148
146
  supportMode: boolean;
@@ -485,7 +483,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
485
483
  this.logger.log('[CONVS-DETAIL] - initialize -> conversationWith: ', this.conversationWith, ' -> conversationWithFullname: ', this.conversationWithFullname)
486
484
  this.subscriptions = []
487
485
  this.setHeightTextArea()
488
- this.tagsCanned = [] // list of canned
489
486
 
490
487
  this.messages = [] // list messages of conversation
491
488
  this.isFileSelected = false // indicates if a file has been selected (image to upload)
@@ -640,6 +637,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
640
637
  'INFO_A_NEW_SUPPORT_REQUEST_HAS_BEEN_ASSIGNED_TO_YOU',
641
638
  'INFO_SUPPORT_LEAD_UPDATED',
642
639
  'INFO_SUPPORT_MEMBER_LEFT_GROUP',
640
+ 'INFO_SUPPORT_MEMBER_ABANDONED_GROUP',
643
641
  'LABEL_TODAY',
644
642
  'LABEL_TOMORROW',
645
643
  'LABEL_LAST_ACCESS',
@@ -812,8 +810,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
812
810
 
813
811
  returnSendMessage(e: any) {
814
812
  this.logger.log('[CONVS-DETAIL] - returnSendMessage event', e, ' - conversationWith', this.conversationWith)
815
-
816
- this.logger.log('[CONVS-DETAIL] - returnSendMessage event message', e.message)
817
813
  try {
818
814
  let message = ''
819
815
  if (e.message) {
@@ -835,12 +831,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
835
831
  * @param metadata
836
832
  * @param additional_attributes
837
833
  */
838
- sendMessage(
839
- msg: string,
840
- type: string,
841
- metadata?: any,
842
- additional_attributes?: any,
843
- ) {
834
+ sendMessage(msg: string, type: string, metadata?: any, additional_attributes?: any) {
844
835
  this.logger.log('[CONVS-DETAIL] - SEND MESSAGE - MSG: ', msg)
845
836
  this.logger.log('[CONVS-DETAIL] - SEND MESSAGE - type: ', type)
846
837
  this.logger.log('[CONVS-DETAIL] - SEND MESSAGE - metadata: ', metadata)
@@ -879,18 +870,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
879
870
  }
880
871
  }
881
872
 
882
- // else if (type === 'image') {
883
- // if (msg) {
884
- // // msg = msg + '<br>' + 'File: ' + metadata.src;
885
- // msg = metadata.name + '\n' + msg
886
-
887
- // } else {
888
-
889
- // msg = metadata.name
890
- // }
891
-
892
- // }
893
-
894
873
  metadata ? (metadata = metadata) : (metadata = '')
895
874
  this.logger.log('[CONVS-DETAIL] - SEND MESSAGE msg: ', msg, ' - messages: ', this.messages, ' - loggedUser: ', this.loggedUser)
896
875
 
@@ -1171,7 +1150,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1171
1150
  this.logger.log('[CONVS-DETAIL] - returnChangeTextArea - canned responses pos of / (using lastIndexOf) ', pos)
1172
1151
 
1173
1152
  if (pos === -1) {
1174
- this.tagsCannedFilter = []
1153
+ // this.tagsCannedFilter = []
1175
1154
  this.HIDE_CANNED_RESPONSES = true
1176
1155
  }
1177
1156
  // test
@@ -1193,7 +1172,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1193
1172
  // --------------------------------------------
1194
1173
  // Load canned responses
1195
1174
  // --------------------------------------------
1196
- this.loadTagsCanned(strSearch, this.conversationWith)
1197
1175
  this.HIDE_CANNED_RESPONSES = false
1198
1176
  this.messageStr = strSearch
1199
1177
  // ------------------------------------------------------------------------------------------------------------------------------------------
@@ -1204,47 +1182,37 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1204
1182
  if (pos === 0 && after_slash.length === 1 && after_slash.trim() === '' ) {
1205
1183
  this.logger.log('[CONVS-DETAIL] - returnChangeTextArea after_slash --> there is a white space after ')
1206
1184
  this.HIDE_CANNED_RESPONSES = true
1207
- this.tagsCannedFilter = []
1185
+ // this.tagsCannedFilter = []
1208
1186
  } else if (pos === 0 && after_slash.length === 0) {
1209
1187
  this.logger.log('[CONVS-DETAIL] - returnChangeTextArea after_slash --> there is NOT a white space after')
1210
1188
  this.HIDE_CANNED_RESPONSES = false
1211
1189
  }
1212
1190
 
1213
- // if (pos > 0) {
1191
+ if (pos > 0) {
1214
1192
  // // ------------------------------------------------------------------------------------------------------------------------------------------
1215
1193
  // // Hide / display Canned when the SLASH has POSITION POS > and checking if there is a space after the SLASH (in this case they it be hidden)
1216
1194
  // // and if there is not a space before the SLASH (in this it will be hidden)
1217
1195
  // // ------------------------------------------------------------------------------------------------------------------------------------------
1218
1196
 
1219
- // let beforeSlash = message.substr(pos - 1)
1220
- // let afterSlash = message.substr(pos + 1)
1221
- // this.logger.log('[CONVS-DETAIL] - returnChangeTextArea * POS ', pos)
1222
-
1223
- // this.logger.log('[CONVS-DETAIL] - returnChangeTextArea --> beforeSlash', beforeSlash)
1224
- // this.logger.log('[CONVS-DETAIL] - returnChangeTextArea --> afterSlash', afterSlash)
1225
- // var afterSlashParts = afterSlash.split('/')
1226
- // var beforeSlashParts = beforeSlash.split('/')
1227
- // this.logger.log('[CONVS-DETAIL] - returnChangeTextArea --> afterSlash parts', afterSlashParts)
1228
- // this.logger.log('[CONVS-DETAIL] - returnChangeTextArea --> beforeSlash parts', beforeSlashParts)
1229
-
1230
- // if (beforeSlashParts.length === 2) {
1231
- // if (beforeSlashParts[0].indexOf(' ') >= 0 && afterSlashParts[0] === '') {
1232
- // this.HIDE_CANNED_RESPONSES = false
1233
- // this.logger.log('[CONVS-DETAIL] - returnChangeTextArea --> beforeSlash there is a white space After Not')
1234
- // // if (beforeSlashParts[0].indexOf(' ') >= 0 && afterSlashParts[0].indexOf(' ') >= 0)
1235
- // } else if (beforeSlashParts[0].indexOf(' ') < 0 && afterSlashParts[0] === '') {
1236
- // this.HIDE_CANNED_RESPONSES = true
1237
- // this.tagsCannedFilter = []
1238
- // this.logger.log('[CONVS-DETAIL] - returnChangeTextArea --> beforeSlash not thete is a white space After Not')
1239
- // } else if (beforeSlashParts[0].indexOf(' ') >= 0 && afterSlashParts[0] === ' ') {
1240
- // this.logger.log('[CONVS-DETAIL] - returnChangeTextArea --> beforeSlash not thete is a white space After YES')
1241
- // this.HIDE_CANNED_RESPONSES = true
1242
- // this.tagsCannedFilter = []
1243
- // }
1244
- // }
1245
- // }
1197
+ let beforeSlash = message.substr(0, pos)
1198
+ let afterSlash = message.substr(pos + 1)
1199
+ this.logger.log('[CONVS-DETAIL] - returnChangeTextArea * POS ', pos)
1200
+
1201
+ this.logger.log('[CONVS-DETAIL] - returnChangeTextArea --> beforeSlash', beforeSlash)
1202
+ this.logger.log('[CONVS-DETAIL] - returnChangeTextArea --> afterSlash', afterSlash)
1203
+
1204
+
1205
+ if(beforeSlash[beforeSlash.length-1].indexOf(' ') >= 0 && afterSlash[0] === ''){
1206
+ this.HIDE_CANNED_RESPONSES = false
1207
+ } else if(beforeSlash[beforeSlash.length-1].indexOf(' ') < 0 && afterSlash[0] === '' ){
1208
+ this.HIDE_CANNED_RESPONSES = true
1209
+ } else if(beforeSlash[beforeSlash.length-1].indexOf(' ') >= 0 && afterSlash[0] === ' '){
1210
+ this.HIDE_CANNED_RESPONSES = true
1211
+ // this.tagsCannedFilter = []
1212
+ }
1213
+ }
1246
1214
  } else {
1247
- this.tagsCannedFilter = []
1215
+ // this.tagsCannedFilter = []
1248
1216
  }
1249
1217
  }
1250
1218
  }, 300)
@@ -1255,143 +1223,12 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1255
1223
  }
1256
1224
  }
1257
1225
 
1258
- // ----------------------------------------------------------
1259
- // @ CANNED RESPONSES methods
1260
- // ----------------------------------------------------------
1261
- loadTagsCanned(strSearch, conversationWith) {
1262
- this.logger.log('[CONVS-DETAIL] - loadTagsCanned strSearch ', strSearch)
1263
- this.logger.log('[CONVS-DETAIL] - loadTagsCanned groupDetail ', this.groupDetail)
1264
- this.logger.log('[CONVS-DETAIL] - loadTagsCanned conversationWith ', conversationWith)
1265
-
1266
- const conversationWith_segments = conversationWith.split('-')
1267
- // Removes the last element of the array if is = to the separator
1268
- if (conversationWith_segments[conversationWith_segments.length - 1] === '') {
1269
- conversationWith_segments.pop()
1270
- }
1271
-
1272
- this.logger.log('[CONVS-DETAIL] - loadTagsCanned conversationWith_segments ', conversationWith_segments)
1273
- let project = ''
1274
-
1275
- if (conversationWith_segments.length === 4) {
1276
- project = conversationWith_segments[2]
1277
- this.logger.log('[CONVS-DETAIL] - loadTagsCanned projectId ', project)
1278
- this.getAndShowCannedResponses(strSearch, project)
1279
- } else {
1280
- this.getProjectIdByConversationWith(strSearch, this.conversationWith)
1281
- }
1282
- }
1283
-
1284
- getProjectIdByConversationWith(strSearch, conversationWith: string) {
1285
- const tiledeskToken = this.tiledeskAuthService.getTiledeskToken()
1286
-
1287
- this.tiledeskService.getProjectIdByConvRecipient(tiledeskToken, conversationWith).subscribe((res) => {
1288
- this.logger.log('[CONVS-DETAIL] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT RES', res)
1289
- if (res) {
1290
- const projectId = res.id_project
1291
- this.logger.log('[CONVS-DETAIL] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT projectId ', projectId)
1292
- if (projectId) {
1293
- this.getAndShowCannedResponses(strSearch, projectId)
1294
- }
1295
- }
1296
- }, (error) => {
1297
- this.logger.error('[CONVS-DETAIL] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT - ERROR ', error)
1298
- }, () => {
1299
- this.logger.log('[CONVS-DETAIL] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT * COMPLETE *')
1300
- })
1301
- }
1302
-
1303
- getAndShowCannedResponses(strSearch, projectId) {
1304
- const tiledeskToken = this.tiledeskAuthService.getTiledeskToken()
1305
- this.logger.log('[CONVS-DETAIL] - loadTagsCanned tagsCanned.length', this.tagsCanned.length)
1306
- //if(this.tagsCanned.length <= 0 ){
1307
- this.tagsCanned = []
1308
- this.cannedResponsesService.getAll(tiledeskToken, projectId).subscribe((res) => {
1309
- this.logger.log('[CONVS-DETAIL] - loadTagsCanned getCannedResponses RES', res)
1310
-
1311
- this.tagsCanned = res
1312
- this.tagsCannedCount = res.length
1313
- this.logger.log('[CONVS-DETAIL] - loadTagsCanned getCannedResponses tagsCannedCount', this.tagsCannedCount)
1314
- if (this.HIDE_CANNED_RESPONSES === false) {
1315
- this.showTagsCanned(strSearch)
1316
- }
1317
- }, (error) => {
1318
- this.logger.error('[CONVS-DETAIL] - loadTagsCanned getCannedResponses - ERROR ', error)
1319
- }, () => {
1320
- this.logger.log('[CONVS-DETAIL] - loadTagsCanned getCannedResponses * COMPLETE *')
1321
- })
1322
- }
1323
-
1324
- showTagsCanned(strSearch) {
1325
- this.logger.log('[CONVS-DETAIL] - showTagsCanned strSearch ', strSearch)
1326
- this.tagsCannedFilter = []
1327
- var tagsCannedClone = JSON.parse(JSON.stringify(this.tagsCanned))
1328
- this.logger.log('[CONVS-DETAIL] - showTagsCanned tagsCannedClone ', tagsCannedClone)
1329
- //this.logger.log("that.contacts lenght:: ", strSearch);
1330
- this.tagsCannedFilter = this.filterItems(tagsCannedClone, strSearch)
1331
- this.logger.log('[CONVS-DETAIL] - showTagsCanned tagsCannedFilter ', this.tagsCannedFilter)
1332
-
1333
- this.tagsCannedFilter.sort(compareValues('title', 'asc'))
1334
- var strReplace = strSearch
1335
- if (strSearch.length > 0) {
1336
- strReplace = "<b class='highlight-search-string'>" + strSearch + '</b>'
1337
- }
1338
- // for (var i = 0; i < this.tagsCannedFilter.length; i++) {
1339
- // let text = htmlEntities(this.tagsCannedFilter[i].text);
1340
- // // const textCanned = "<div class='cannedText'>" + this.replacePlaceholderInCanned(this.tagsCannedFilter[i].text) + '</div>'
1341
- // const textCanned = "<div class='cannedText'>" + this.replacePlaceholderInCanned(text) + '</div>'
1342
- // let title = htmlEntities(this.tagsCannedFilter[i].title)
1343
- // // this.tagsCannedFilter[i].title = "<div class='cannedContent'><div class='cannedTitle'>" + this.tagsCannedFilter[i].title.toString().replace(strSearch, strReplace.trim()) + '</div>' + textCanned + '</div>'
1344
- // this.tagsCannedFilter[i].title = "<div class='cannedContent'><div class='cannedTitle'>" + title.toString().replace(strSearch, strReplace.trim()) + '</div>' + textCanned + '</div>'
1345
- // }
1346
- this.tagsCannedFilter.forEach(canned => {
1347
- canned.text = this.replacePlaceholderInCanned(canned.text);
1348
- canned.disabled = true
1349
- });
1350
- if (this.tagsCannedCount === 0) {
1351
- // const button = this.renderer.createElement('button');
1352
- // const buttonText = this.renderer.createText('Click me');
1353
- // this.renderer.appendChild(button, buttonText);
1354
- // console.log('[CONVS-DETAIL] - this.el.nativeElement ', this.el.nativeElement)
1355
- // this.renderer.listen(button, 'click', () => { alert('hi'); });
1356
- // let nocanned = {}
1357
- // if (this.USER_ROLE !== 'agent') {
1358
- const nocanned = {
1359
- // "<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>'
1360
- // <div class='cannedText no-canned-available-text'>" + this.translationMap.get('AddNewCannedResponse') + '</div>
1361
- title:
1362
- "<div class='cannedContent'><div class='cannedTitle nocannedTitle #noCannedTitle'>" + this.translationMap.get('THERE_ARE_NO_CANNED_RESPONSES_AVAILABLE') + ".</div></div>",
1363
- text: 'There are no canned responses available',
1364
- }
1365
- // } else if (this.USER_ROLE === 'agent') {
1366
- // nocanned = {
1367
- // // "<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>'
1368
- // title:
1369
- // "<div class='cannedContent'><div class='cannedTitle nocannedTitle #noCannedTitle'>" + this.translationMap.get('THERE_ARE_NO_CANNED_RESPONSES_AVAILABLE') + ".</div></div>",
1370
- // text: 'There are no canned responses available',
1371
- // }
1372
- // }
1373
- this.tagsCannedFilter.push(nocanned)
1374
- }
1375
- }
1226
+
1376
1227
 
1377
1228
  toggleSidebar() {
1378
1229
  // console.log('[CONVS-DETAIL] has clicked test')
1379
1230
  }
1380
1231
 
1381
- filterItems(items, searchTerm) {
1382
- this.logger.log('[CONVS-DETAIL] filterItems tagsCannedClone ', items, ' searchTerm: ', searchTerm)
1383
- //this.logger.log("filterItems::: ",searchTerm);
1384
- return items.filter((item) => {
1385
- //this.logger.log("filterItems::: ", item.title.toString().toLowerCase());
1386
- this.logger.log('[CONVS-DETAIL] filtered tagsCannedClone item ', item)
1387
- return (
1388
- item.title
1389
- .toString()
1390
- .toLowerCase()
1391
- .indexOf(searchTerm.toString().toLowerCase()) > -1
1392
- )
1393
- })
1394
- }
1395
1232
 
1396
1233
  replacePlaceholderInCanned(str) {
1397
1234
  this.logger.log('[CONVS-DETAIL] - replacePlaceholderInCanned str ', str)
@@ -1402,94 +1239,43 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1402
1239
  return str
1403
1240
  }
1404
1241
 
1405
- replaceTagInMessage(canned, event) {
1406
- if(!canned.disabled){
1407
- event.preventDefault();
1408
- event.stopPropagation();
1409
- }else if (this.tagsCannedCount > 0) {
1410
- // console.log('[CONVS-DETAIL] replaceTagInMessage event ', event)
1411
- // console.log('[CONVS-DETAIL] replaceTagInMessage canned ', canned)
1412
- // console.log('[CONVS-DETAIL] replaceTagInMessage canned title', canned.title)
1413
- // console.log('[CONVS-DETAIL] replaceTagInMessage canned contains nocannedTitle', canned.title.includes('nocannedTitle'))
1414
-
1415
- const elTextArea = this.rowTextArea['el']
1416
- const textArea = elTextArea.getElementsByTagName('ion-textarea')[0]
1417
-
1418
- // console.log('[CONVS-DETAIL] replaceTagInMessage textArea ', textArea)
1419
- // console.log('[CONVS-DETAIL] replaceTagInMessage textArea value', textArea.value,)
1420
-
1421
- // var lastChar = textArea.value.substr(-1); // Selects the last character
1422
- // if (lastChar === '/') {
1423
- // textArea.value = textArea.value.substring(0, textArea.value.length() - 1);
1424
- // }
1425
- // this.insertAtCursor(this.textArea, textArea.value)
1426
-
1427
- this.arrowkeyLocation = -1
1428
- this.tagsCannedFilter = []
1429
- this.logger.log('[CONVS-DETAIL] replaceTagInMessage canned text ', canned.text)
1430
-
1431
- // replace text
1432
- var pos = textArea.value.lastIndexOf('/')
1433
- var strSearch = textArea.value.substr(pos)
1434
- this.logger.log('[CONVS-DETAIL] replaceTagInMessage strSearch ', strSearch)
1435
-
1436
- var strTEMP = textArea.value.replace(strSearch, canned.text)
1437
- strTEMP = this.replacePlaceholderInCanned(strTEMP)
1438
- this.logger.log('[CONVS-DETAIL] replaceTagInMessage strSearch ', strTEMP)
1439
- // strTEMP = this.replacePlaceholderInCanned(strTEMP);
1440
- // textArea.value = '';
1441
- // that.messageString = strTEMP;
1442
- textArea.value = strTEMP
1443
- setTimeout(() => {
1444
- // textArea.focus();
1445
- textArea.setFocus()
1446
- this.resizeTextArea()
1447
- }, 200)
1448
- }
1449
- else {
1450
- this.logger.log('[CONVS-DETAIL] THERE IS NOT CANNED ', canned.text)
1451
- }
1242
+ onLoadedCannedResponses(event){
1243
+ this.logger.log('[CONVS-DETAIL] onLoadedCannedResponses --> ',event)
1244
+ if(event && event.length > 0 ){
1245
+ this.tagsCannedFilter = event
1246
+ }
1452
1247
  }
1453
1248
 
1454
- onEditCanned(canned, ev){
1455
- ev.preventDefault()
1456
- ev.stopPropagation()
1457
- canned.disabled = false
1458
- this.logger.log('[CONVS-DETAIL] onEditCanned ', canned)
1249
+ replaceTagInMessage(canned, event?) {
1250
+ const elTextArea = this.rowTextArea['el']
1251
+ const textArea = elTextArea.getElementsByTagName('ion-textarea')[0]
1252
+ // console.log('[CONVS-DETAIL] replaceTagInMessage textArea ', textArea)
1253
+ // console.log('[CONVS-DETAIL] replaceTagInMessage textArea value', textArea.value,)
1254
+
1255
+ // var lastChar = textArea.value.substr(-1); // Selects the last character
1256
+ // if (lastChar === '/') {
1257
+ // textArea.value = textArea.value.substring(0, textArea.value.length() - 1);
1258
+ // }
1259
+ // this.insertAtCursor(this.textArea, textArea.value)
1260
+
1261
+ this.logger.log('[CONVS-DETAIL] replaceTagInMessage canned text ', canned.text)
1262
+
1263
+ // replace text
1264
+ var strTEMP = textArea.value.replace(/\/$/ig, canned.text)
1265
+ strTEMP = this.replacePlaceholderInCanned(strTEMP)
1266
+ this.logger.log('[CONVS-DETAIL] replaceTagInMessage strSearch ', strTEMP)
1267
+ // strTEMP = this.replacePlaceholderInCanned(strTEMP);
1268
+ // textArea.value = '';
1269
+ // that.messageString = strTEMP;
1270
+ textArea.value = strTEMP
1459
1271
  setTimeout(() => {
1460
- this.el.nativeElement.querySelector('#titleCanned_'+canned._id).setFocus()
1461
- }, 500);
1272
+ // textArea.focus();
1273
+ textArea.setFocus()
1274
+ // this.resizeTextArea()
1275
+ }, 200)
1276
+
1462
1277
  }
1463
1278
 
1464
- onConfirmEditCanned(canned, ev){
1465
- ev.preventDefault()
1466
- ev.stopPropagation()
1467
- const tiledeskToken = this.tiledeskAuthService.getTiledeskToken()
1468
- this.logger.log('[CONVS-DETAIL] onConfirmEditCanned ', canned, ev)
1469
- this.cannedResponsesService.edit(tiledeskToken, canned.id_project, canned).subscribe(cannedRes=> {
1470
- canned.disabled = true
1471
- }, (error) => {
1472
- this.logger.error('[CONVS-DETAIL] - onConfirmEditCanned - ERROR ', error)
1473
- }, () => {
1474
- this.logger.log('[CONVS-DETAIL] - onConfirmEditCanned * COMPLETE *')
1475
- })
1476
- }
1477
-
1478
- onDeleteCanned(canned, ev){
1479
- ev.preventDefault()
1480
- ev.stopPropagation()
1481
- const tiledeskToken = this.tiledeskAuthService.getTiledeskToken()
1482
- this.logger.log('[CONVS-DETAIL] onDeleteCanned ', canned)
1483
- this.cannedResponsesService.delete(tiledeskToken, canned.id_project, canned._id).subscribe(cannedRes=> {
1484
- if(cannedRes.status === 1000){
1485
- this.tagsCannedFilter.splice(this.tagsCannedFilter.findIndex(el => el._id === canned._id), 1)
1486
- }
1487
- }, (error) => {
1488
- this.logger.error('[CONVS-DETAIL] - onConfirmEditCanned - ERROR ', error)
1489
- }, () => {
1490
- this.logger.log('[CONVS-DETAIL] - onConfirmEditCanned * COMPLETE *')
1491
- })
1492
- }
1493
1279
 
1494
1280
  closeListCannedResponse(){
1495
1281
  this.logger.log('[CONVS-DETAIL] close list canned . . . ')
@@ -1517,27 +1303,22 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1517
1303
  return await modal.present()
1518
1304
  }
1519
1305
 
1520
- hasClickedOpenCannedResponses($event) {
1521
- this.logger.log('[CONVS-DETAIL] - hasClickedOpenCannedResponses ', $event)
1306
+ onClickOpenCannedResponses($event) {
1307
+ this.logger.log('[CONVS-DETAIL] - onClickOpenCannedResponses ', $event)
1522
1308
  const elTextArea = this.rowTextArea['el']
1523
1309
  const textArea = elTextArea.getElementsByTagName('ion-textarea')[0]
1524
-
1525
- this.logger.log('[CONVS-DETAIL] hasClickedOpenCannedResponses textArea ', textArea)
1526
- // console.log("[CONVS-DETAIL] hasClickedOpenCannedResponses textArea value", textArea.value)
1527
- var lastChar = textArea.value[textArea.value.length - 1]
1528
- // console.log('[CONVS-DETAIL] hasClickedOpenCannedResponses lastChar', lastChar)
1529
- if (lastChar !== '/') {
1530
- this.insertAtCursor(textArea, '/')
1310
+ if($event && elTextArea){
1311
+ this.logger.log('[CONVS-DETAIL] onClickOpenCannedResponses textArea ', textArea)
1312
+ // console.log("[CONVS-DETAIL] onClickOpenCannedResponses textArea value", textArea.value)
1313
+ var lastChar = textArea.value[textArea.value.length - 1]
1314
+ // console.log('[CONVS-DETAIL] onClickOpenCannedResponses lastChar', lastChar)
1315
+ if (lastChar !== '/') {
1316
+ this.insertAtCursor(textArea, '/')
1317
+ }
1318
+ this.setCaretPosition(textArea)
1319
+ }else{
1320
+ this.HIDE_CANNED_RESPONSES = true
1531
1321
  }
1532
- // console.log('[CONVS-DETAIL] hasClickedOpenCannedResponses textArea.value', textArea.value)
1533
- // setTimeout(() => {
1534
- // // if (textArea.value === '/') {
1535
- // // textArea.focus();
1536
- // textArea.setFocus();
1537
- // // }
1538
- // }, 1500);
1539
-
1540
- this.setCaretPosition(textArea)
1541
1322
  }
1542
1323
 
1543
1324
  setCaretPosition(ctrl) {
@@ -1589,40 +1370,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1589
1370
  }
1590
1371
  }
1591
1372
 
1592
- @HostListener('document:keydown', ['$event'])
1593
- handleKeyboardEvent(event: KeyboardEvent) {
1594
- // this.logger.log("CONVERSATION-DETAIL handleKeyboardEvent event.key ", event.key);
1595
-
1596
- if (this.tagsCannedFilter.length > 0) {
1597
- if (event.key === 'ArrowDown') {
1598
- this.arrowkeyLocation++
1599
- if (this.arrowkeyLocation === this.tagsCannedFilter.length) {
1600
- this.arrowkeyLocation--
1601
- }
1602
- // this.replaceTagInMessage(this.tagsCannedFilter[this.arrowkeyLocation])
1603
- } else if (event.key === 'ArrowUp') {
1604
- if (this.arrowkeyLocation > 0) {
1605
- this.arrowkeyLocation--
1606
- } else if (this.arrowkeyLocation < 0) {
1607
- this.arrowkeyLocation++
1608
- }
1609
- // this.replaceTagInMessage(this.tagsCannedFilter[this.arrowkeyLocation])
1610
- }
1611
-
1612
- if (event.key === 'Enter') {
1613
- const canned_selected = this.tagsCannedFilter[this.arrowkeyLocation]
1614
- this.logger.log(
1615
- '[CONVS-DETAIL] replaceTagInMessage canned_selected ',
1616
- canned_selected,
1617
- )
1618
- if (canned_selected) {
1619
- this.replaceTagInMessage(canned_selected, 'enter')
1620
- // event.preventDefault();
1621
- // return false;
1622
- }
1623
- }
1624
- }
1625
- }
1373
+
1626
1374
  // ----------------------------------------------------------
1627
1375
  // ./end CANNED RESPONSES methods
1628
1376
  // ----------------------------------------------------------
@@ -1904,41 +1652,25 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1904
1652
 
1905
1653
  this.logger.log('[CONVS-DETAIL] ----> FILE - DROP ev ', ev)
1906
1654
  const fileList = ev.dataTransfer.files
1907
- this.logger.log(
1908
- '[CONVS-DETAIL] ----> FILE - DROP ev.dataTransfer.files ',
1909
- fileList,
1910
- )
1655
+ this.logger.log('[CONVS-DETAIL] ----> FILE - DROP ev.dataTransfer.files ',fileList)
1911
1656
  this.isHovering = false
1912
- this.logger.log(
1913
- '[CONVS-DETAIL] ----> FILE - DROP isHovering ',
1914
- this.isHovering,
1915
- )
1657
+ this.logger.log('[CONVS-DETAIL] ----> FILE - DROP isHovering ',this.isHovering)
1916
1658
  if (fileList.length > 0) {
1917
1659
  const file: File = fileList[0]
1918
1660
  this.logger.log('[CONVS-DETAIL] ----> FILE - DROP file ', file)
1919
1661
 
1920
1662
  var mimeType = fileList[0].type
1921
- this.logger.log(
1922
- '[CONVS-DETAIL] ----> FILE - DROP mimeType files ',
1923
- mimeType,
1924
- )
1663
+ this.logger.log('[CONVS-DETAIL] ----> FILE - DROP mimeType files ', mimeType)
1925
1664
 
1926
1665
  // if (mimeType.startsWith("image") || mimeType.startsWith("application")) {
1927
1666
  // this.logger.log('[CONVS-DETAIL] ----> FILE - DROP mimeType files: ', this.appConfigProvider.getConfig().fileUploadAccept);
1928
1667
  // this.checkAcceptedFile(mimeType);
1929
1668
  const isAccepted = this.checkAcceptedFile(mimeType)
1930
- this.logger.log(
1931
- '[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept isAcceptFile FILE - DROP',
1932
- isAccepted,
1933
- )
1669
+ this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept isAcceptFile FILE - DROP',isAccepted)
1934
1670
  if (isAccepted === true) {
1935
1671
  this.handleDropEvent(ev)
1936
1672
  } else {
1937
- this.logger.log(
1938
- '[CONVS-DETAIL] ----> FILE - DROP mimeType files ',
1939
- mimeType,
1940
- 'NOT SUPPORTED FILE TYPE',
1941
- )
1673
+ this.logger.log( '[CONVS-DETAIL] ----> FILE - DROP mimeType files ', mimeType,'NOT SUPPORTED FILE TYPE')
1942
1674
  this.presentToastOnlyImageFilesAreAllowedToDrag()
1943
1675
  }
1944
1676
  }
@@ -1955,10 +1687,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1955
1687
  ev.stopPropagation()
1956
1688
  this.logger.log('[CONVS-DETAIL] ----> FILE - (dragover) allowDrop ev ', ev)
1957
1689
  this.isHovering = true
1958
- this.logger.log(
1959
- '[CONVS-DETAIL] ----> FILE - (dragover) allowDrop isHovering ',
1960
- this.isHovering,
1961
- )
1690
+ this.logger.log('[CONVS-DETAIL] ----> FILE - (dragover) allowDrop isHovering ',this.isHovering)
1962
1691
  }
1963
1692
 
1964
1693
  // DRAG LEAVE (WHEN LEAVE FROM THE DROP ZONE)
@@ -1967,17 +1696,12 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1967
1696
  ev.stopPropagation()
1968
1697
  this.logger.log('[CONVS-DETAIL] ----> FILE - (dragleave) drag ev ', ev)
1969
1698
  this.isHovering = false
1970
- this.logger.log(
1971
- '[CONVS-DETAIL] ----> FILE - FILE - (dragleave) drag his.isHovering ',
1972
- this.isHovering,
1973
- )
1699
+ this.logger.log('[CONVS-DETAIL] ----> FILE - FILE - (dragleave) drag his.isHovering ',this.isHovering)
1974
1700
  }
1975
1701
 
1976
1702
  async presentToastOnlyImageFilesAreAllowedToDrag() {
1977
1703
  const toast = await this.toastController.create({
1978
- message: this.translationMap.get(
1979
- 'FAILED_TO_UPLOAD_THE_FORMAT_IS_NOT_SUPPORTED',
1980
- ),
1704
+ message: this.translationMap.get('FAILED_TO_UPLOAD_THE_FORMAT_IS_NOT_SUPPORTED'),
1981
1705
  duration: 5000,
1982
1706
  color: 'danger',
1983
1707
  cssClass: 'toast-custom-class',
@@ -21,29 +21,6 @@
21
21
  <div id="scrollbar2">
22
22
  <ion-list>
23
23
 
24
- <!-- -------------------------------------------------------------------------- -->
25
- <!-- New <ion-spinner class="spinner-middle" style="margin-left: 19px;"></ion-spinner> -->
26
- <!-- -------------------------------------------------------------------------- -->
27
- <ion-item *ngIf="isOnline === false" style="padding-left:0px!important ;padding-right:0px!important" button="true" lines="none" class="ion-no-padding waiting-for-connection">
28
- <div tabindex="0"></div>
29
- <ion-avatar item-start>
30
- <div class="sk-fading-circle">
31
- <div class="sk-circle1 sk-circle"></div>
32
- <div class="sk-circle2 sk-circle"></div>
33
- <div class="sk-circle3 sk-circle"></div>
34
- <div class="sk-circle4 sk-circle"></div>
35
- <div class="sk-circle5 sk-circle"></div>
36
- <div class="sk-circle6 sk-circle"></div>
37
- <div class="sk-circle7 sk-circle"></div>
38
- <div class="sk-circle8 sk-circle"></div>
39
- <div class="sk-circle9 sk-circle"></div>
40
- <div class="sk-circle10 sk-circle"></div>
41
- <div class="sk-circle11 sk-circle"></div>
42
- <div class="sk-circle12 sk-circle"></div>
43
- </div>
44
- </ion-avatar>
45
- <ion-label part="message-text" class="waiting-for-network-msg"> Waiting for network</ion-label>
46
- </ion-item>
47
24
  <!-- supportMode && -->
48
25
  <ion-item *ngIf="displayNewConvsItem && conversationType !=='archived' && supportMode" class="ion-no-padding open-iframe-item">
49
26
  <div tabindex="0"></div>