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

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,5 +1,13 @@
1
1
  # chat21-ionic ver 3.0
2
2
 
3
+ ## 3.0.76 in PROD
4
+
5
+ ### 3.0.76-rc.4
6
+ - bug-fixed: if canned component is opened and press twice the canned icon, canned-component not opens
7
+ - bug-fixed: bot images not resized
8
+ - added: caching of canned responses per project
9
+ - aded: loader in canned-component
10
+
3
11
  ### 3.0.76-rc.3
4
12
  - bug-fixed: image-preview when agent click on image, don't fit the screen size
5
13
  - added: network-connection component to manage no connections
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",
5
5
  "license": "MIT License",
6
6
  "homepage": "https://tiledesk.com/",
7
7
  "repository": {
@@ -31,8 +31,8 @@
31
31
  [class.chat-text-emoticon]="isEmojii(message?.text)"
32
32
  [message]="message"
33
33
  [textColor]="'col-msg-sent'"
34
- (onBeforeMessageRender)="returnOnBeforeMessageRender($event)"
35
- (onAfterMessageRender)="returnOnAfterMessageRender($event)">
34
+ (onBeforeMessageRender)="onBeforeMessageRenderFN($event)"
35
+ (onAfterMessageRender)="onAfterMessageRenderFN($event)">
36
36
  </tiledeskwidget-bubble-message>
37
37
 
38
38
  <!-- icon status message -->
@@ -58,8 +58,8 @@
58
58
  [class.chat-text-emoticon]="isEmojii(message?.text)"
59
59
  [message]="message"
60
60
  [textColor]="'black'"
61
- (onBeforeMessageRender)="returnOnBeforeMessageRender($event)"
62
- (onAfterMessageRender)="returnOnAfterMessageRender($event)">
61
+ (onBeforeMessageRender)="onBeforeMessageRenderFN($event)"
62
+ (onAfterMessageRender)="onAfterMessageRenderFN($event)">
63
63
  </tiledeskwidget-bubble-message>
64
64
 
65
65
  </div>
@@ -127,7 +127,7 @@
127
127
  [message]="message"
128
128
  [isLastMessage] = "isLastMessage(message?.uid)"
129
129
  [stylesMap]="stylesMap"
130
- (onAttachmentButtonClicked)="returnOnAttachmentButtonClicked($event)">
130
+ (onAttachmentButtonClicked)="onAttachmentButtonClickedFN($event)">
131
131
  </tiledeskwidget-message-attachment>
132
132
  </div>
133
133
 
@@ -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
 
@@ -131,6 +131,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
131
131
 
132
132
  public messageStr: string;
133
133
  public tagsCannedFilter: Array<any>= [];
134
+ public tagsCannedCount: number;
134
135
  public HIDE_CANNED_RESPONSES: boolean = true
135
136
 
136
137
  public window: any = window
@@ -235,7 +236,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
235
236
  // @ Lifehooks
236
237
  // -----------------------------------------------------------
237
238
  ngOnInit() {
238
- // this.logger.log('[CONVS-DETAIL] > ngOnInit - window.location: ', window.location);
239
+ this.logger.log('[CONVS-DETAIL] > ngOnInit - window.location: ', window.location);
239
240
  // this.logger.log('[CONVS-DETAIL] > ngOnInit - fileUploadAccept: ', this.appConfigProvider.getConfig().fileUploadAccept);
240
241
  // const accept_files = this.appConfigProvider.getConfig().fileUploadAccept;
241
242
  // this.logger.log('[CONVS-DETAIL] > ngOnInit - fileUploadAccept typeof accept_files ', typeof accept_files);
@@ -256,6 +257,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
256
257
  this.getOSCODE();
257
258
  this.getStoredProjectAndUserRole();
258
259
  this.listenToDsbrdPostMsgs();
260
+
259
261
  }
260
262
 
261
263
  listenToDsbrdPostMsgs() {
@@ -613,14 +615,12 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
613
615
  'YES_CANNED_RESPONSES',
614
616
  'THERE_ARE_NO_CANNED_RESPONSES_AVAILABLE',
615
617
  'TO_CREATE_THEM_GO_TO_THE_PROJECT',
616
- "AddNewCannedResponse"
618
+ "AddNewCannedResponse",
619
+ "LABEL_LOADING"
617
620
  ]
618
621
 
619
622
  this.translationMap = this.customTranslateService.translateLanguage(keys)
620
- this.logger.log(
621
- '[CONVS-DETAIL] x this.translationMap ',
622
- this.translationMap,
623
- )
623
+ this.logger.log('[CONVS-DETAIL] x this.translationMap ',this.translationMap)
624
624
  }
625
625
 
626
626
  // --------------------------------------------------------
@@ -1243,6 +1243,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1243
1243
  this.logger.log('[CONVS-DETAIL] onLoadedCannedResponses --> ',event)
1244
1244
  if(event && event.length > 0 ){
1245
1245
  this.tagsCannedFilter = event
1246
+ this.tagsCannedCount = event.length
1246
1247
  }
1247
1248
  }
1248
1249
 
@@ -1305,19 +1306,23 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1305
1306
 
1306
1307
  onClickOpenCannedResponses($event) {
1307
1308
  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, '/')
1309
+ this.HIDE_CANNED_RESPONSES = !this.HIDE_CANNED_RESPONSES
1310
+
1311
+ //HIDE_CANNED_RESPONSES: true --> not show CANNED component
1312
+ //HIDE_CANNED_RESPONSES: false --> show CANNED component and place '/' char in textarea
1313
+ if(!this.HIDE_CANNED_RESPONSES){
1314
+ const elTextArea = this.rowTextArea['el']
1315
+ const textArea = elTextArea.getElementsByTagName('ion-textarea')[0]
1316
+ if($event && elTextArea){
1317
+ this.logger.log('[CONVS-DETAIL] onClickOpenCannedResponses textArea ', textArea)
1318
+ // console.log("[CONVS-DETAIL] onClickOpenCannedResponses textArea value", textArea.value)
1319
+ var lastChar = textArea.value[textArea.value.length - 1]
1320
+ // console.log('[CONVS-DETAIL] onClickOpenCannedResponses lastChar', lastChar)
1321
+ if (lastChar !== '/') {
1322
+ this.insertAtCursor(textArea, '/')
1323
+ }
1324
+ this.setCaretPosition(textArea)
1317
1325
  }
1318
- this.setCaretPosition(textArea)
1319
- }else{
1320
- this.HIDE_CANNED_RESPONSES = true
1321
1326
  }
1322
1327
  }
1323
1328
 
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