@chat21/chat21-ionic 3.4.13-rc1 → 3.4.13-rc2

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,9 @@
1
1
  # chat21-ionic ver 3.0
2
2
 
3
+ ### 3.4.13-rc.2
4
+ - added: no-suggestions in copilot component
5
+ - changed: HIDE_CANNED_RESPONSES with SHOW CANNED_RESPONSES
6
+
3
7
  ### 3.4.13-rc.1
4
8
  - added: copilot suggestions for agent responses
5
9
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@chat21/chat21-ionic",
3
3
  "author": "Tiledesk SRL",
4
- "version": "3.4.13-rc1",
4
+ "version": "3.4.13-rc2",
5
5
  "license": "MIT License",
6
6
  "homepage": "https://tiledesk.com/",
7
7
  "repository": {
@@ -31,7 +31,6 @@ export class CannedResponseComponent implements OnInit {
31
31
  public projectID: string;
32
32
 
33
33
  public tagsCanned: any = []
34
- public tagsCannedCount: number
35
34
  public tagsCannedFilter: any = []
36
35
 
37
36
  public arrowkeyLocation = -1
@@ -128,8 +127,6 @@ export class CannedResponseComponent implements OnInit {
128
127
  this.logger.log('[CANNED] - loadTagsCanned getCannedResponses RES', res)
129
128
 
130
129
  this.tagsCanned = res
131
- this.tagsCannedCount = res.length
132
- this.logger.log('[CANNED] - loadTagsCanned getCannedResponses tagsCannedCount', this.tagsCannedCount)
133
130
  // if (this.HIDE_CANNED_RESPONSES === false) {
134
131
  this.showTagsCanned(strSearch)
135
132
  // }
@@ -179,6 +176,7 @@ export class CannedResponseComponent implements OnInit {
179
176
  // <div class='cannedText no-canned-available-text'>" + this.translationMap.get('AddNewCannedResponse') + '</div>
180
177
  title: this.translationMap.get('THERE_ARE_NO_CANNED_RESPONSES_AVAILABLE') ,
181
178
  text: '',
179
+ disabled: true
182
180
  }
183
181
  // } else if (this.USER_ROLE === 'agent') {
184
182
  // nocanned = {
@@ -269,10 +267,9 @@ export class CannedResponseComponent implements OnInit {
269
267
  if(!canned.disabled){
270
268
  event.preventDefault();
271
269
  event.stopPropagation();
272
- } else if(this.tagsCannedCount > 0){
273
- this.onClickCanned.emit(canned)
274
270
  } else {
275
- this.logger.log('[CANNED] THERE IS NOT CANNED ', canned.text)
271
+ this.logger.log('[CANNED] THERE IS CANNED ', canned.text)
272
+ this.onClickCanned.emit(canned)
276
273
  }
277
274
  }
278
275
 
@@ -51,7 +51,6 @@ export class MessageTextAreaComponent implements OnInit, AfterViewInit, OnChange
51
51
  @Input() channelType: string;
52
52
  @Input() channel: string;
53
53
  @Input() tagsCannedFilter: any;
54
- @Input() tagsCannedCount: number;
55
54
  @Input() areVisibleCAR: boolean;
56
55
  @Input() supportMode: boolean;
57
56
  @Input() leadInfo: {lead_id: string, hasEmail: boolean, email: string, projectId: string, presence: {}};
@@ -18,7 +18,7 @@
18
18
  </ion-item> -->
19
19
  </div>
20
20
  <!-- LOADER -->
21
- <div class="loader" *ngIf="suggestions.length === 0">
21
+ <div class="loader" *ngIf="showLoading">
22
22
  <div class="box">
23
23
  <!-- <div class="container">
24
24
  <span class="circle" [ngStyle]="{'background-color': stylesMap?.get('themeColor')}"></span>
@@ -30,7 +30,12 @@
30
30
  <div class="label">{{translationMap.get('LABEL_LOADING')}}</div>
31
31
  </div>
32
32
  </div>
33
- <!-- <div *ngIf="!canShowCanned">
34
-
35
- </div> -->
33
+ <div class="no-data" *ngIf="suggestions.length === 0 && !showLoading">
34
+ <div class="container">
35
+ <ion-item button="false" lines="none" class="canned-item no-ripple border">
36
+ <ion-icon name="cloud-offline" slot="start"></ion-icon>
37
+ <ion-label>{{translationMap.get('COPILOT.NO_SUGGESTIONS_PRESENT')}}</ion-label>
38
+ </ion-item>
39
+ </div>
40
+ </div>
36
41
  </div>
@@ -202,4 +202,31 @@ ion-item {
202
202
  opacity: 0;
203
203
  }
204
204
  }
205
+ }
206
+
207
+
208
+ .no-data{
209
+
210
+ background-color: white !important;
211
+ width: 100%;
212
+ max-height: 310px;
213
+ overflow-y: auto;
214
+ // padding: 10px 0;
215
+ // margin: 0;
216
+ margin-bottom: 1px;
217
+ font-size: 14px;
218
+ line-height: 1.42857143;
219
+ color: #080f1a;
220
+ box-sizing: border-box;
221
+ -webkit-font-smoothing: antialiased;
222
+ // list-style: none;
223
+ z-index: 999999;
224
+
225
+ .container{
226
+ display: flex;
227
+ justify-content: center;
228
+ flex-direction: column;
229
+ align-items: center;
230
+
231
+ }
205
232
  }
@@ -28,7 +28,7 @@ export class CopilotSuggestionsComponent implements OnInit {
28
28
  public projectID: string;
29
29
 
30
30
  public suggestions: any = []
31
- public suggestionsCount: number
31
+ public showLoading: boolean = false
32
32
 
33
33
  public arrowkeyLocation = -1
34
34
 
@@ -93,15 +93,16 @@ export class CopilotSuggestionsComponent implements OnInit {
93
93
  this.logger.log('[COPILOT] - loadTagsCanned tagsCanned.length', this.suggestions.length)
94
94
  //if(this.tagsCanned.length <= 0 ){
95
95
  this.suggestions = []
96
+ this.showLoading = true;
96
97
  this.copilotService.getAll(tiledeskToken, projectId, this.conversationWith).subscribe((res) => {
97
98
  this.logger.log('[COPILOT] - loadTagsCanned getCannedResponses RES', res)
98
99
  this.suggestions = res.map(el => ({ ...el, disabled : true }))
99
- this.suggestionsCount = res.length
100
100
  this.logger.log('[COPILOT] - loadTagsCanned getCannedResponses tagsCannedCount', this.suggestions)
101
101
  }, (error) => {
102
102
  this.logger.error('[COPILOT] - loadTagsCanned getCannedResponses - ERROR ', error)
103
103
  }, () => {
104
104
  this.logger.log('[COPILOT] - loadTagsCanned getCannedResponses * COMPLETE *')
105
+ this.showLoading = false
105
106
  this.onLoadedSuggestions.emit(this.suggestions)
106
107
  })
107
108
  }
@@ -111,10 +112,9 @@ export class CopilotSuggestionsComponent implements OnInit {
111
112
  if(!suggestion.disabled){
112
113
  event.preventDefault();
113
114
  event.stopPropagation();
114
- } else if(this.suggestionsCount > 0){
115
- this.onClickSuggestion.emit(suggestion)
116
115
  } else {
117
116
  this.logger.log('[CANNED] THERE IS NOT CANNED ', suggestion.text)
117
+ this.onClickSuggestion.emit(suggestion)
118
118
  }
119
119
  }
120
120
 
@@ -61,7 +61,7 @@
61
61
  here is ignored
62
62
  </span>
63
63
 
64
- <div class="overlay" *ngIf="!HIDE_CANNED_RESPONSES || SHOW_COPILOT_SUGGESTIONS"></div>
64
+ <div class="overlay" *ngIf="SHOW_CANNED_RESPONSES || SHOW_COPILOT_SUGGESTIONS" (click)="this.SHOW_COPILOT_SUGGESTIONS=!this.SHOW_COPILOT_SUGGESTIONS; this.SHOW_CANNED_RESPONSES = !this.SHOW_CANNED_RESPONSES"></div>
65
65
 
66
66
  <ng-template #content_welcome>
67
67
  <!-- <div class="messageFirst">
@@ -168,7 +168,7 @@
168
168
  <!-- ----------------------------------------------------------- -->
169
169
  <!-- Canned responses -->
170
170
  <!-- ----------------------------------------------------------- -->
171
- <app-canned-response *ngIf="HIDE_CANNED_RESPONSES === false"
171
+ <app-canned-response *ngIf="SHOW_CANNED_RESPONSES"
172
172
  id="canned"
173
173
  [canShowCanned]="canShowCanned"
174
174
  [conversationWith]="conversationWith"
@@ -192,46 +192,7 @@
192
192
  (onClickSuggestion)="replaceSuggestionInMessage($event)">
193
193
  </copilot-suggestions>
194
194
 
195
-
196
- <!-- <div id="canned" *ngIf="tagsCannedFilter.length > 0 && HIDE_CANNED_RESPONSES === false">
197
- <div class="header">
198
- <ion-item lines="none"> <ion-icon class="canned-response-icon-header" name="flash-outline"></ion-icon> Canned responses</ion-item>
199
- <ion-item lines="none" (click)="presentCreateCannedResponseModal()">
200
- <ion-icon class="canned-response-icon-header" name="add" slot="start"></ion-icon>
201
- New response
202
- </ion-item>
203
- <ion-item lines="none" (click)="closeListCannedResponse()"> <ion-icon class="canned-response-icon-header" name="close" ></ion-icon></ion-item>
204
- </div>
205
- <ion-list class="canned-list" >
206
- <ion-item button="true" [ngClass]="{'is_active_item': i == arrowkeyLocation}" lines="none"
207
- class="canned-item no-ripple border" id="{{'canned-item_'+ i }}"
208
- *ngFor="let canned of tagsCannedFilter; let i = index;"
209
- (click)="replaceTagInMessage(canned, $event)">
210
- <div class="cannedContent">
211
- <ion-input [(ngModel)]="canned.title" class="title" id="{{'titleCanned_'+canned._id}}" [disabled]="canned.disabled"></ion-input>
212
- <ion-input [(ngModel)]="canned.text" class="text" [disabled]="canned.disabled"></ion-input>
213
- </div>
214
- <ion-icon class="canned-item-icon" name="checkmark-sharp" slot=end *ngIf="canned.createdBy === loggedUser.uid && !canned.disabled" (click)="onConfirmEditCanned(canned, $event)"></ion-icon>
215
- <ion-icon class="canned-item-icon" name="pencil-sharp" slot=end *ngIf="canned.createdBy === loggedUser.uid && canned.disabled" (click)="onEditCanned(canned, $event)"></ion-icon>
216
- <ion-icon class="canned-item-icon" name="trash-sharp" slot=end *ngIf="canned.createdBy === loggedUser.uid" (click)="onDeleteCanned(canned, $event)"></ion-icon>
217
- </ion-item>
218
-
219
- <ion-item class="canned-item add-canned-response-wpr" button="true" lines="none" (click)="presentCreateCannedResponseModal()">
220
- <ion-icon class="add-canned-response-icon" name="flash-outline"></ion-icon>
221
- <span class="add-canned-response-add-icon">+</span>
222
- <label class="add-canned-response-label" >{{translationMap?.get('AddNewCannedResponse')}}</label>
223
- </ion-item>
224
- </ion-list>
225
- <!- - <ion-list class="canned-list" *ngIf="tagsCannedFilter.length === 0 && HIDE_CANNED_RESPONSES === false">
226
- <ion-item button="true" >
227
- There are no canned responses available
228
- </ion-item>
229
- </ion-list> - ->
230
- </div> -->
231
-
232
-
233
-
234
-
195
+
235
196
  <!-- (eventReplaceMessageWithCanned)="replaceTagInMessage($event)" -->
236
197
  <!-- [tagsCannedFilter]="tagsCannedFilter" -->
237
198
  <!-- openInfoConversation {{openInfoConversation}} - isMobile {{isMobile}} -->
@@ -241,7 +202,6 @@
241
202
  [channelType]="channelType"
242
203
  [channel]="conversation?.attributes?.request_channel"
243
204
  [tagsCannedFilter]="tagsCannedFilter"
244
- [tagsCannedCount]="tagsCannedCount"
245
205
  [areVisibleCAR]="areVisibleCAR"
246
206
  [supportMode]="supportMode"
247
207
  [leadInfo]="leadInfo"
@@ -132,8 +132,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
132
132
 
133
133
  public messageStr: string;
134
134
  public tagsCannedFilter: Array<any> = [];
135
- public tagsCannedCount: number;
136
- public HIDE_CANNED_RESPONSES: boolean = true
135
+ public SHOW_CANNED_RESPONSES: boolean = false
137
136
  public canShowCanned: boolean = true
138
137
 
139
138
  public SHOW_COPILOT_SUGGESTIONS: boolean = false;
@@ -686,7 +685,8 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
686
685
  "WHATSAPP.ERROR_WHATSAPP_NOT_INSTALLED",
687
686
  "WHATSAPP.ERROR_WHATSAPP_GENERIC_ERROR",
688
687
 
689
- "COPILOT.ASK_AI"
688
+ "COPILOT.ASK_AI",
689
+ "COPILOT.NO_SUGGESTIONS_PRESENT"
690
690
 
691
691
  ]
692
692
 
@@ -1492,7 +1492,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1492
1492
 
1493
1493
  if (pos === -1) {
1494
1494
  // this.tagsCannedFilter = []
1495
- this.HIDE_CANNED_RESPONSES = true
1495
+ this.SHOW_CANNED_RESPONSES = false
1496
1496
  }
1497
1497
  // test
1498
1498
  // var rest = message.substring(0, message.lastIndexOf("/") + 1);
@@ -1521,12 +1521,12 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1521
1521
 
1522
1522
  var after_slash = message.substring(message.lastIndexOf('/') + 1, message.length)
1523
1523
  if (pos === 0 && after_slash.length === 1 && after_slash.trim() === '') {
1524
- this.logger.log('[CONVS-DETAIL] - returnChangeTextArea after_slash --> there is a white space after ')
1525
- this.HIDE_CANNED_RESPONSES = true
1524
+ this.logger.log('[CONVS-DETAIL] - returnChangeTextArea after_slash --> there is a white space after ');
1525
+ this.SHOW_CANNED_RESPONSES = false
1526
1526
  // this.tagsCannedFilter = []
1527
1527
  } else if (pos === 0 && after_slash.length === 0) {
1528
1528
  this.logger.log('[CONVS-DETAIL] - returnChangeTextArea after_slash --> there is NOT a white space after')
1529
- this.HIDE_CANNED_RESPONSES = false
1529
+ this.SHOW_CANNED_RESPONSES = true
1530
1530
  }
1531
1531
 
1532
1532
  if (pos > 0) {
@@ -1543,11 +1543,11 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1543
1543
  this.logger.log('[CONVS-DETAIL] - returnChangeTextArea --> afterSlash', afterSlash)
1544
1544
 
1545
1545
  if (beforeSlash[beforeSlash.length - 1].indexOf(' ') >= 0 && afterSlash === '') {
1546
- this.HIDE_CANNED_RESPONSES = false
1546
+ this.SHOW_CANNED_RESPONSES = true
1547
1547
  } else if (beforeSlash[beforeSlash.length - 1].indexOf(' ') < 0 && afterSlash === '') {
1548
- this.HIDE_CANNED_RESPONSES = true
1548
+ this.SHOW_CANNED_RESPONSES = false
1549
1549
  } else if (beforeSlash[beforeSlash.length - 1].indexOf(' ') >= 0 && afterSlash === ' ') {
1550
- this.HIDE_CANNED_RESPONSES = true
1550
+ this.SHOW_CANNED_RESPONSES = false
1551
1551
  // this.tagsCannedFilter = []
1552
1552
  }
1553
1553
  }
@@ -1583,7 +1583,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1583
1583
  this.logger.log('[CONVS-DETAIL] onLoadedCannedResponses --> ', event)
1584
1584
  if (event && event.length > 0) {
1585
1585
  this.tagsCannedFilter = event
1586
- this.tagsCannedCount = event.length
1587
1586
  }
1588
1587
  }
1589
1588
 
@@ -1619,13 +1618,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1619
1618
 
1620
1619
  }
1621
1620
 
1622
-
1623
- closeListCannedResponse() {
1624
- this.logger.log('[CONVS-DETAIL] close list canned . . . ')
1625
- this.HIDE_CANNED_RESPONSES = true
1626
- this.tagsCannedFilter = []
1627
- }
1628
-
1629
1621
  async presentCreateCannedResponseModal(): Promise<any> {
1630
1622
  const elTextArea = this.rowTextArea['el']
1631
1623
  const textArea = elTextArea.getElementsByTagName('ion-textarea')[0]
@@ -1648,11 +1640,11 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1648
1640
 
1649
1641
  onClickOpenCannedResponses($event) {
1650
1642
  this.logger.log('[CONVS-DETAIL] - onClickOpenCannedResponses ', $event)
1651
- this.HIDE_CANNED_RESPONSES = !this.HIDE_CANNED_RESPONSES
1643
+ this.SHOW_CANNED_RESPONSES = !this.SHOW_CANNED_RESPONSES
1652
1644
 
1653
1645
  //HIDE_CANNED_RESPONSES: true --> not show CANNED component
1654
1646
  //HIDE_CANNED_RESPONSES: false --> show CANNED component and place '/' char in textarea
1655
- if (!this.HIDE_CANNED_RESPONSES) {
1647
+ if (this.SHOW_CANNED_RESPONSES) {
1656
1648
  const elTextArea = this.rowTextArea['el']
1657
1649
  const textArea = elTextArea.getElementsByTagName('ion-textarea')[0]
1658
1650
  if (elTextArea) {
@@ -1671,30 +1663,18 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1671
1663
  /** COPILOT SUGGGESTIONS : start */
1672
1664
  onLoadedSuggestions(event){
1673
1665
  this.logger.log('[CONVS-DETAIL] onLoadedSuggestions --> ', event)
1674
- if (event && event.length > 0) {
1675
- // this.tagsCannedFilter = event
1676
- // this.tagsCannedCount = event.length
1677
- }
1678
1666
  }
1679
1667
 
1680
1668
  replaceSuggestionInMessage(suggestion, event?) {
1681
1669
  const elTextArea = this.rowTextArea['el']
1682
1670
  const textArea = elTextArea.getElementsByTagName('ion-textarea')[0] as HTMLInputElement;
1683
- // console.log('[CONVS-DETAIL] replaceTagInMessage textArea ', textArea)
1684
- // console.log('[CONVS-DETAIL] replaceTagInMessage textArea value', textArea.value,)
1685
1671
 
1686
- // var lastChar = textArea.value.substr(-1); // Selects the last character
1687
- // if (lastChar === '/') {
1688
- // textArea.value = textArea.value.substring(0, textArea.value.length() - 1);
1689
- // }
1690
- // this.insertAtCursor(this.textArea, textArea.value)
1691
-
1692
- this.logger.log('[CONVS-DETAIL] replaceTagInMessage canned text ', suggestion.text)
1672
+ this.logger.log('[CONVS-DETAIL] replaceSuggestionInMessage canned text ', suggestion.text)
1693
1673
 
1694
1674
  // replace text
1695
- var strTEMP = textArea.value + ' ' + suggestion.text
1675
+ var strTEMP = textArea.value + suggestion.text
1696
1676
  strTEMP = this.replacePlaceholderInCanned(strTEMP)
1697
- this.logger.log('[CONVS-DETAIL] replaceTagInMessage strSearch ', strTEMP)
1677
+ this.logger.log('[CONVS-DETAIL] replaceSuggestionInMessage strSearch ', strTEMP)
1698
1678
  // strTEMP = this.replacePlaceholderInCanned(strTEMP);
1699
1679
  // textArea.value = '';
1700
1680
  // that.messageString = strTEMP;
@@ -306,6 +306,7 @@
306
306
  "SEND_EMAIL_SUCCESS_OFFLINE_MESSAGE":"Message also sent by email 📩"
307
307
  },
308
308
  "COPILOT": {
309
- "ASK_AI":"Ask to AI"
309
+ "ASK_AI":"Ask to AI",
310
+ "NO_SUGGESTIONS_PRESENT":"No suggestions found"
310
311
  }
311
312
  }
@@ -306,6 +306,7 @@
306
306
  "SEND_EMAIL_SUCCESS_OFFLINE_MESSAGE":"Messaggio inviato anche via mail 📩"
307
307
  },
308
308
  "COPILOT": {
309
- "ASK_AI":"Chiedi all'AI"
309
+ "ASK_AI":"Chiedi all'AI",
310
+ "NO_SUGGESTIONS_PRESENT":"Nessun suggerimento trovato"
310
311
  }
311
312
  }