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

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 CHANGED
@@ -1,4 +1,10 @@
1
1
  # chat21-ionic ver 3.0
2
+ ù
3
+ ### 3.0.76-rc.4
4
+ - bug-fixed: if canned component is opened and press twice the canned icon, canned-component not opens
5
+ - bug-fixed: bot images not resized
6
+ - added: caching of canned responses per project
7
+ - aded: loader in canned-component
2
8
 
3
9
  ### 3.0.76-rc.3
4
10
  - bug-fixed: image-preview when agent click on image, don't fit the screen size
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@chat21/chat21-ionic",
3
3
  "author": "Tiledesk SRL",
4
- "version": "3.0.76-rc.3",
4
+ "version": "3.0.76-rc.4",
5
5
  "license": "MIT License",
6
6
  "homepage": "https://tiledesk.com/",
7
7
  "repository": {
@@ -1,5 +1,5 @@
1
- <div id="canned">
2
- <ion-list class="canned-list" *ngIf="tagsCannedFilter.length > 0">
1
+ <div>
2
+ <div class="canned-list" *ngIf="tagsCannedFilter.length > 0">
3
3
  <ion-item button="true" [ngClass]="{'is_active_item': i == arrowkeyLocation}" lines="none"
4
4
  class="canned-item no-ripple border" id="{{'canned-item_'+ i }}"
5
5
  *ngFor="let canned of tagsCannedFilter; let i = index;"
@@ -17,10 +17,17 @@
17
17
  <span class="add-canned-response-add-icon">+</span>
18
18
  <label class="add-canned-response-label" >{{translationMap?.get('AddNewCannedResponse')}}</label>
19
19
  </ion-item>
20
- </ion-list>
21
- <!-- <ion-list class="canned-list" *ngIf="tagsCannedFilter.length === 0 && HIDE_CANNED_RESPONSES === false">
22
- <ion-item button="true" >
23
- There are no canned responses available
24
- </ion-item>
25
- </ion-list> -->
20
+ </div>
21
+ <!-- -->
22
+ <div class="loader" *ngIf="tagsCannedFilter.length === 0">
23
+ <div class="box">
24
+ <div class="container">
25
+ <span class="circle"></span>
26
+ <span class="circle"></span>
27
+ <span class="circle"></span>
28
+ <span class="circle"></span>
29
+ </div>
30
+ <div class="label">{{translationMap.get('LABEL_LOADING')}}</div>
31
+ </div>
32
+ </div>
26
33
  </div>
@@ -72,6 +72,24 @@
72
72
  // list-style: none;
73
73
  z-index: 999999;
74
74
 
75
+ &::-webkit-scrollbar {
76
+ width: 6px;
77
+ height: 8px;
78
+ }
79
+
80
+ &::-webkit-scrollbar-track {
81
+ background: #f9f9f9;
82
+ }
83
+
84
+ &::-webkit-scrollbar-thumb {
85
+ background-color: #b9b9b9;
86
+ border-radius: 0px;
87
+ }
88
+
89
+ &::-webkit-scrollbar-thumb:hover {
90
+ background-color: #727272;
91
+ }
92
+
75
93
  .cannedContent{
76
94
  width: 100%;
77
95
  }
@@ -138,4 +156,69 @@ ion-item {
138
156
  .no-canned-available-text:hover {
139
157
  text-decoration: underline;
140
158
  }
159
+ }
160
+
161
+
162
+ .loader {
163
+ height: 310px;
164
+
165
+ .box{
166
+ top: 50%;
167
+ left: 50%;
168
+ transform: translate(-50%, -50%);
169
+ position: absolute;
170
+ }
171
+
172
+ .container{
173
+ height: 15px;
174
+ width: 105px;
175
+ display: flex;
176
+ position: relative;
177
+
178
+ .circle{
179
+ width: 15px;
180
+ height: 15px;
181
+ border-radius: 50%;
182
+ background-color: #1877f2;
183
+ animation: move 500ms linear 0ms infinite;
184
+ margin-right: 30px;
185
+
186
+ &:first-child{
187
+ position: absolute;
188
+ top:0;
189
+ left:0;
190
+ animation: grow 500ms linear 0ms infinite;
191
+ }
192
+
193
+ &:last-child{
194
+ position: absolute;
195
+ top: 0;
196
+ right: 0;
197
+ margin-right: 0;
198
+ animation: grow 500ms linear 0s infinite reverse;
199
+ }
200
+ }
201
+ }
202
+
203
+ .label{
204
+ text-align: center;
205
+ margin-top: 10px;
206
+ animation: blinker 1s linear infinite;
207
+ }
208
+
209
+ @keyframes grow {
210
+ from {transform: scale(0,0); opacity: 0;}
211
+ to {transform: scale(1,1); opacity: 1;}
212
+ }
213
+
214
+ @keyframes move {
215
+ from {transform: translateX(0px)}
216
+ to {transform: translateX(45px)}
217
+ }
218
+
219
+ @keyframes blinker {
220
+ 50% {
221
+ opacity: 0;
222
+ }
223
+ }
141
224
  }
@@ -1,3 +1,4 @@
1
+ import { AppStorageService } from 'src/chat21-core/providers/abstract/app-storage.service';
1
2
  import { Component, Input, OnInit, SimpleChange, ElementRef, Output, EventEmitter, HostListener } from '@angular/core';
2
3
  import { CreateCannedResponsePage } from 'src/app/pages/create-canned-response/create-canned-response.page';
3
4
  import { CannedResponsesService } from 'src/app/services/canned-responses/canned-responses.service';
@@ -24,6 +25,7 @@ export class CannedResponseComponent implements OnInit {
24
25
  @Output() onClickCanned = new EventEmitter<any>();
25
26
  @Output() onClickAddCannedResponse = new EventEmitter();
26
27
  public loggedUser: UserModel
28
+ public projectID: string;
27
29
 
28
30
  public tagsCanned: any = []
29
31
  public tagsCannedCount: number
@@ -36,6 +38,7 @@ export class CannedResponseComponent implements OnInit {
36
38
  public tiledeskAuthService: TiledeskAuthService,
37
39
  public tiledeskService: TiledeskService,
38
40
  public cannedResponsesService: CannedResponsesService,
41
+ public appStorageService: AppStorageService,
39
42
  public el: ElementRef
40
43
  ) { }
41
44
 
@@ -45,31 +48,49 @@ export class CannedResponseComponent implements OnInit {
45
48
 
46
49
  ngOnChanges(changes: SimpleChange){
47
50
  this.logger.debug('[CANNED] - loadTagsCanned strSearch ', this.currentString)
51
+ if(changes && changes['conversationWith'] && (changes['conversationWith'].previousValue !== changes['conversationWith'].currentValue)){
52
+ this.projectID = this.getProjectIdSelectedConversation(this.conversationWith)
53
+ this.loadStoredCanned(this.projectID)
54
+ }
48
55
  if(this.currentString !== undefined){
49
56
  this.loadTagsCanned(this.currentString, this.conversationWith)
50
57
  }
51
58
  }
52
59
 
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
+ getProjectIdSelectedConversation(conversationWith: string): string{
60
61
  const conversationWith_segments = conversationWith.split('-')
61
62
  // Removes the last element of the array if is = to the separator
62
63
  if (conversationWith_segments[conversationWith_segments.length - 1] === '') {
63
64
  conversationWith_segments.pop()
64
65
  }
65
66
 
66
- this.logger.log('[CANNED] - loadTagsCanned conversationWith_segments ', conversationWith_segments)
67
+ this.logger.log('[CANNED] - getProjectIdSelectedConversation conversationWith_segments ', conversationWith_segments)
67
68
  let projectId = ''
68
-
69
69
  if (conversationWith_segments.length === 4) {
70
70
  projectId = conversationWith_segments[2]
71
- this.logger.log('[CANNED] - loadTagsCanned projectId ', projectId)
72
- this.getAndShowCannedResponses(strSearch, projectId)
71
+ this.logger.log('[CANNED] - getProjectIdSelectedConversation projectId ', projectId)
72
+ }
73
+ return projectId
74
+ }
75
+
76
+
77
+ loadStoredCanned(projectId){
78
+ let storedCanned = this.appStorageService.getItem(projectId+'_canned')
79
+ if(storedCanned){
80
+ this.tagsCannedFilter = JSON.parse(storedCanned)
81
+ }
82
+ }
83
+
84
+ // ----------------------------------------------------------
85
+ // @ CANNED RESPONSES methods
86
+ // ----------------------------------------------------------
87
+ loadTagsCanned(strSearch, conversationWith) {
88
+ this.logger.log('[CANNED] - loadTagsCanned strSearch ', strSearch)
89
+ this.logger.log('[CANNED] - loadTagsCanned conversationWith ', conversationWith)
90
+
91
+ if (this.projectID) {
92
+ this.logger.log('[CANNED] - loadTagsCanned projectId ', this.projectID)
93
+ this.getAndShowCannedResponses(strSearch, this.projectID)
73
94
  } else {
74
95
  this.getProjectIdByConversationWith(strSearch, this.conversationWith)
75
96
  }
@@ -165,6 +186,7 @@ export class CannedResponseComponent implements OnInit {
165
186
  // }
166
187
  this.tagsCannedFilter.push(nocanned)
167
188
  }
189
+ this.appStorageService.setItem(this.projectID+'_canned', JSON.stringify(this.tagsCannedFilter))
168
190
  this.onLoadedCannedResponses.emit(this.tagsCannedFilter)
169
191
  }
170
192
 
@@ -235,7 +235,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
235
235
  // @ Lifehooks
236
236
  // -----------------------------------------------------------
237
237
  ngOnInit() {
238
- // this.logger.log('[CONVS-DETAIL] > ngOnInit - window.location: ', window.location);
238
+ this.logger.log('[CONVS-DETAIL] > ngOnInit - window.location: ', window.location);
239
239
  // this.logger.log('[CONVS-DETAIL] > ngOnInit - fileUploadAccept: ', this.appConfigProvider.getConfig().fileUploadAccept);
240
240
  // const accept_files = this.appConfigProvider.getConfig().fileUploadAccept;
241
241
  // this.logger.log('[CONVS-DETAIL] > ngOnInit - fileUploadAccept typeof accept_files ', typeof accept_files);
@@ -256,6 +256,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
256
256
  this.getOSCODE();
257
257
  this.getStoredProjectAndUserRole();
258
258
  this.listenToDsbrdPostMsgs();
259
+
259
260
  }
260
261
 
261
262
  listenToDsbrdPostMsgs() {
@@ -613,14 +614,12 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
613
614
  'YES_CANNED_RESPONSES',
614
615
  'THERE_ARE_NO_CANNED_RESPONSES_AVAILABLE',
615
616
  'TO_CREATE_THEM_GO_TO_THE_PROJECT',
616
- "AddNewCannedResponse"
617
+ "AddNewCannedResponse",
618
+ "LABEL_LOADING"
617
619
  ]
618
620
 
619
621
  this.translationMap = this.customTranslateService.translateLanguage(keys)
620
- this.logger.log(
621
- '[CONVS-DETAIL] x this.translationMap ',
622
- this.translationMap,
623
- )
622
+ this.logger.log('[CONVS-DETAIL] x this.translationMap ',this.translationMap)
624
623
  }
625
624
 
626
625
  // --------------------------------------------------------
@@ -1305,19 +1304,23 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1305
1304
 
1306
1305
  onClickOpenCannedResponses($event) {
1307
1306
  this.logger.log('[CONVS-DETAIL] - onClickOpenCannedResponses ', $event)
1308
- const elTextArea = this.rowTextArea['el']
1309
- const textArea = elTextArea.getElementsByTagName('ion-textarea')[0]
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, '/')
1307
+ this.HIDE_CANNED_RESPONSES = !this.HIDE_CANNED_RESPONSES
1308
+
1309
+ //HIDE_CANNED_RESPONSES: true --> not show CANNED component
1310
+ //HIDE_CANNED_RESPONSES: false --> show CANNED component and place '/' char in textarea
1311
+ if(!this.HIDE_CANNED_RESPONSES){
1312
+ const elTextArea = this.rowTextArea['el']
1313
+ const textArea = elTextArea.getElementsByTagName('ion-textarea')[0]
1314
+ if($event && elTextArea){
1315
+ this.logger.log('[CONVS-DETAIL] onClickOpenCannedResponses textArea ', textArea)
1316
+ // console.log("[CONVS-DETAIL] onClickOpenCannedResponses textArea value", textArea.value)
1317
+ var lastChar = textArea.value[textArea.value.length - 1]
1318
+ // console.log('[CONVS-DETAIL] onClickOpenCannedResponses lastChar', lastChar)
1319
+ if (lastChar !== '/') {
1320
+ this.insertAtCursor(textArea, '/')
1321
+ }
1322
+ this.setCaretPosition(textArea)
1317
1323
  }
1318
- this.setCaretPosition(textArea)
1319
- }else{
1320
- this.HIDE_CANNED_RESPONSES = true
1321
1324
  }
1322
1325
  }
1323
1326
 
package/src/global.scss CHANGED
@@ -393,7 +393,7 @@ app-info-support-group {
393
393
  ion-conversation-detail {
394
394
  img {
395
395
  border-style: none;
396
- max-width: 100% !important;
396
+ max-width: 300px !important;
397
397
  }
398
398
  }
399
399