@chat21/chat21-ionic 3.4.13-rc3 → 3.4.13-rc5

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 (36) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/package.json +1 -1
  3. package/src/app/app.component.ts +15 -6
  4. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.html +1 -26
  5. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.ts +1 -1
  6. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.html +1 -0
  7. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.ts +1 -0
  8. package/src/app/chatlib/conversation-detail/message/options/options.component.html +1 -1
  9. package/src/app/chatlib/conversation-detail/message/options/options.component.ts +1 -0
  10. package/src/app/components/canned-response/canned-response.component.ts +4 -9
  11. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.html +3 -3
  12. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +1 -0
  13. package/src/app/components/conversation-info/info-content/info-content.component.ts +10 -14
  14. package/src/app/components/conversation-info/info-group/info-group.component.ts +2 -10
  15. package/src/app/components/copilot-popover/copilot-popover.component.html +1 -1
  16. package/src/app/components/copilot-popover/copilot-popover.component.ts +1 -2
  17. package/src/app/components/copilot-suggestions/copilot-suggestions.component.ts +14 -12
  18. package/src/app/components/navbar/navbar.component.ts +4 -4
  19. package/src/app/components/project-item/project-item.component.ts +3 -4
  20. package/src/app/modals/create-canned-response/create-canned-response.page.ts +6 -12
  21. package/src/app/modals/create-ticket/create-ticket.page.ts +10 -23
  22. package/src/app/modals/send-email/send-email.page.ts +1 -3
  23. package/src/app/pages/contacts-directory/contacts-directory.page.ts +3 -5
  24. package/src/app/pages/conversation-detail/conversation-detail.page.html +4 -2
  25. package/src/app/pages/conversation-detail/conversation-detail.page.ts +15 -32
  26. package/src/app/pages/conversations-list/conversations-list.page.ts +8 -16
  27. package/src/app/pages/create-requester/create-requester.page.ts +5 -10
  28. package/src/app/services/canned-responses/canned-responses.service.ts +25 -19
  29. package/src/app/services/contacts/contacts.service.ts +23 -20
  30. package/src/app/services/copilot/copilot.service.ts +27 -23
  31. package/src/app/services/projects/{projects.service.spec.ts → project.service.spec.ts} +2 -2
  32. package/src/app/services/projects/project.service.ts +68 -0
  33. package/src/app/services/tiledesk/tiledesk.service.ts +48 -82
  34. package/src/app/utils/project-utils.ts +140 -0
  35. package/src/chat21-core/utils/constants.ts +3 -0
  36. package/src/app/services/projects/projects.service.ts +0 -43
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # chat21-ionic ver 3.0
2
2
 
3
+ ### 3.4.13-rc.5
4
+ - removed: tiledeskToken from tiledesk-service
5
+
6
+ ### 3.4.13-rc.4
7
+ - added: management for copilot option in project.profile obj
8
+ - removed: token in each tiledesk Service method calls and added initialize method for each services
9
+
3
10
  ### 3.4.13-rc.3
4
11
  - added: copilot-popover on each received message
5
12
  - changed: canned-responsed no data ui
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-rc3",
4
+ "version": "3.4.13-rc5",
5
5
  "license": "MIT License",
6
6
  "homepage": "https://tiledesk.com/",
7
7
  "repository": {
@@ -40,7 +40,10 @@ import { Deeplinks } from '@ionic-native/deeplinks/ngx';
40
40
  import { TriggerEvents } from './services/triggerEvents/triggerEvents';
41
41
  import { Globals } from './utils/globals';
42
42
  import { GlobalSettingsService } from './services/global-settings/global-settings.service';
43
- import { commandToMessage, conversationToMessage, isSender } from 'src/chat21-core/utils/utils-message';
43
+ import { conversationToMessage } from 'src/chat21-core/utils/utils-message';
44
+ import { ProjectService } from './services/projects/project.service';
45
+ import { ContactsService } from './services/contacts/contacts.service';
46
+ import { TiledeskService } from './services/tiledesk/tiledesk.service';
44
47
 
45
48
  @Component({
46
49
  selector: 'app-root',
@@ -103,13 +106,10 @@ export class AppComponent implements OnInit {
103
106
  private appConfigProvider: AppConfigProvider,
104
107
  public events: EventsService,
105
108
  public triggerEvents: TriggerEvents,
106
- public config: Config,
107
109
  public chatManager: ChatManager,
108
110
  public translate: TranslateService,
109
111
  public alertController: AlertController,
110
112
  public navCtrl: NavController,
111
- // public userService: UserService,
112
- // public currentUserService: CurrentUserService,
113
113
  public modalController: ModalController,
114
114
  public messagingAuthService: MessagingAuthService,
115
115
  public tiledeskAuthService: TiledeskAuthService,
@@ -137,7 +137,12 @@ export class AppComponent implements OnInit {
137
137
  public fcm: FCM,
138
138
  public el: ElementRef,
139
139
  public g: Globals,
140
- public globalSettingsService: GlobalSettingsService
140
+ public globalSettingsService: GlobalSettingsService,
141
+
142
+ /**TILEDESK SERVICES */
143
+ private tiledeskService: TiledeskService,
144
+ private projectService: ProjectService,
145
+ private contactsService: ContactsService
141
146
  ) {
142
147
 
143
148
  this.saveInStorageNumberOfOpenedChatTab();
@@ -1153,7 +1158,7 @@ export class AppComponent implements OnInit {
1153
1158
  // this.logger.info('initialize FROM [APP-COMP] - [APP-COMP] - GO-ONLINE isOnline ', this.isOnline);
1154
1159
  // clearTimeout(this.timeModalLogin);
1155
1160
  const tiledeskToken = this.tiledeskAuthService.getTiledeskToken();
1156
-
1161
+ const serverBaseURL = this.appConfigProvider.getConfig().apiUrl
1157
1162
  // const supportmode = this.appConfigProvider.getConfig().supportMode;
1158
1163
  // this.logger.log('[APP-COMP] - GO-ONLINE - supportmode ', supportmode);
1159
1164
  // if (supportmode === true) {
@@ -1166,6 +1171,10 @@ export class AppComponent implements OnInit {
1166
1171
  this.logger.log('[APP-COMP] - GO-ONLINE - currentUser ', currentUser);
1167
1172
  this.chatManager.setTiledeskToken(tiledeskToken);
1168
1173
  this.chatManager.setCurrentUser(currentUser);
1174
+
1175
+ this.tiledeskService.initialize(serverBaseURL)
1176
+ this.projectService.initialize(serverBaseURL)
1177
+ this.contactsService.initialize(serverBaseURL)
1169
1178
  // this.chatManager.startApp();
1170
1179
 
1171
1180
  // ----------------------------------------------
@@ -97,16 +97,6 @@
97
97
  <div role="messaggio" *ngIf="messageType(MESSAGE_TYPE_MINE, message)" class="msg_container base_sent">
98
98
 
99
99
  <div class="message-date-hover"> {{message.timestamp | date:'HH:mm' }} </div>
100
-
101
- <!-- <ng-container *ngIf="areVisibleCAR && supportMode">
102
- <ion-button shape="round" size="small" class="btn-add-msg canned" ion-button fill="clear"
103
- (click)="presentCreateCannedResponseModal(message)" [tooltip]="addAsCannedResponseTooltipText"
104
- [options]="tooltipOptions" placement="bottom">
105
- <ion-icon slot="icon-only" name="flash-outline" style="font-size: 1em;"> </ion-icon>
106
- <span class="add-canned-response-add-icon">+</span>
107
- </ion-button>
108
- </ng-container> -->
109
-
110
100
 
111
101
  <div class="bubble-container">
112
102
 
@@ -174,6 +164,7 @@
174
164
  [fontSize]="stylesMap?.get('fontSize')"
175
165
  [fontFamily]="stylesMap?.get('fontFamily')"
176
166
  [stylesMap]="stylesMap"
167
+ [isCopilotEnabled]="isCopilotEnabled"
177
168
  (onBeforeMessageRender)="onBeforeMessageRenderFN($event)"
178
169
  (onAfterMessageRender)="onAfterMessageRenderFN($event)"
179
170
  (onElementRendered)="onElementRenderedFN($event)"
@@ -189,22 +180,6 @@
189
180
  </ion-button>
190
181
  </ng-container>
191
182
 
192
- <!-- <ng-container *ngIf="areVisibleCAR && supportMode">
193
- <ion-button shape="round" size="small" class="btn-add-msg canned" ion-button fill="clear"
194
- (click)="presentCreateCannedResponseModal(message)" [tooltip]="addAsCannedResponseTooltipText"
195
- [options]="tooltipOptions" placement="bottom">
196
- <ion-icon slot="icon-only" name="flash-outline" style="font-size: 1em;"> </ion-icon>
197
- <span class="add-canned-response-add-icon">+</span>
198
- </ion-button>
199
- </ng-container> -->
200
- <!-- <ng-container *ngIf="supportMode">
201
- <ion-button shape="round" size="small" class="btn-add-msg emoji" ion-button fill="clear"
202
- (click)="presentEmojiiModal()" tooltip="{{addAsCannedResponseTooltipText}}"
203
- [options]="tooltipOptions" placement="bottom">
204
- <ion-icon slot="icon-only" name="happy-outline" style="font-size: 1em;"> </ion-icon>
205
- </ion-button>
206
- </ng-container> -->
207
-
208
183
  <div class="message-date-hover" *ngIf="isChannelTypeGroup(channelType)"> {{message.timestamp | date:'HH:mm' }} </div>
209
184
  </div>
210
185
 
@@ -29,6 +29,7 @@ export class IonConversationDetailComponent extends ConversationContentComponent
29
29
  @Input() senderId: string;
30
30
  @Input() channelType: string;
31
31
  @Input() areVisibleCAR: boolean;
32
+ @Input() isCopilotEnabled: boolean = false
32
33
  @Input() supportMode: boolean;
33
34
  @Input() isMobile: boolean;
34
35
  @Input() openInfoConversation: boolean;
@@ -166,7 +167,6 @@ export class IonConversationDetailComponent extends ConversationContentComponent
166
167
  }else if(event.option === 'jsonInfo'){
167
168
  this.presentJsonMessageModal(event.data.message)
168
169
  } else if(event.option === 'copilot_question'){
169
- console.log('hereeeeeee', event)
170
170
  this.eventService.publish('copilot:new_question', {text: event.data.text})
171
171
 
172
172
  }
@@ -11,6 +11,7 @@
11
11
  </div> -->
12
12
  <chat-options
13
13
  [message]="message"
14
+ [isCopilotEnabled]="isCopilotEnabled"
14
15
  [logLevel]="logger.getLoggerConfig().logLevel"
15
16
  (onOptionsDataReturned)="onOptionsDataReturnedFN($event)">
16
17
  </chat-options>
@@ -26,6 +26,7 @@ export class BubbleMessageComponent implements OnInit, OnChanges {
26
26
  @Input() fontFamily: string;
27
27
  @Input() stylesMap: Map<string, string>;
28
28
  @Input() supportMode: boolean;
29
+ @Input() isCopilotEnabled: boolean = false;
29
30
  @Output() onBeforeMessageRender = new EventEmitter();
30
31
  @Output() onAfterMessageRender = new EventEmitter();
31
32
  @Output() onElementRendered = new EventEmitter<{element: string, status: boolean}>();
@@ -2,7 +2,7 @@
2
2
  <div class="options-logo" (click)="onClickOptionsMessage($event)" >
3
3
  <ion-icon name="chevron-down"></ion-icon>
4
4
  </div>
5
- <div class="options-logo" (click)="onClickOptionsCopilot($event)">
5
+ <div *ngIf="isCopilotEnabled" class="options-logo" (click)="onClickOptionsCopilot($event)">
6
6
  <ion-icon id="copilot" src="assets/images/icons/copilot.svg"></ion-icon>
7
7
  </div>
8
8
  </div>
@@ -14,6 +14,7 @@ import { CopilotPopoverComponent } from 'src/app/components/copilot-popover/copi
14
14
  export class OptionsComponent implements OnInit {
15
15
 
16
16
  @Input() message: MessageModel;
17
+ @Input() isCopilotEnabled: boolean = false;
17
18
  @Input() logLevel: number;
18
19
  @Output() onOptionsDataReturned = new EventEmitter<{option: string, data: any}>();
19
20
 
@@ -101,9 +101,7 @@ export class CannedResponseComponent implements OnInit {
101
101
  }
102
102
 
103
103
  getProjectIdByConversationWith(strSearch, conversationWith: string) {
104
- const tiledeskToken = this.tiledeskAuthService.getTiledeskToken()
105
-
106
- this.tiledeskService.getProjectIdByConvRecipient(tiledeskToken, conversationWith).subscribe((res) => {
104
+ this.tiledeskService.getProjectIdByConvRecipient(conversationWith).subscribe((res) => {
107
105
  this.logger.log('[CANNED] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT RES', res)
108
106
  if (res) {
109
107
  const projectId = res.id_project
@@ -120,12 +118,11 @@ export class CannedResponseComponent implements OnInit {
120
118
  }
121
119
 
122
120
  getAndShowCannedResponses(strSearch, projectId) {
123
- const tiledeskToken = this.tiledeskAuthService.getTiledeskToken()
124
121
  this.logger.log('[CANNED] - loadTagsCanned tagsCanned.length', this.tagsCanned.length)
125
122
  //if(this.tagsCanned.length <= 0 ){
126
123
  this.tagsCanned = []
127
124
  this.showLoading = true;
128
- this.cannedResponsesService.getAll(tiledeskToken, projectId).subscribe((res) => {
125
+ this.cannedResponsesService.getAll(projectId).subscribe((res) => {
129
126
  this.logger.log('[CANNED] - loadTagsCanned getCannedResponses RES', res)
130
127
 
131
128
  this.tagsCanned = res
@@ -205,9 +202,8 @@ export class CannedResponseComponent implements OnInit {
205
202
  onConfirmEditCanned(canned, ev){
206
203
  ev.preventDefault()
207
204
  ev.stopPropagation()
208
- const tiledeskToken = this.tiledeskAuthService.getTiledeskToken()
209
205
  this.logger.log('[CANNED] onConfirmEditCanned ', canned, ev)
210
- this.cannedResponsesService.edit(tiledeskToken, canned.id_project, canned).subscribe(cannedRes=> {
206
+ this.cannedResponsesService.edit(canned.id_project, canned).subscribe(cannedRes=> {
211
207
  canned.disabled = true
212
208
  }, (error) => {
213
209
  this.logger.error('[CANNED] - onConfirmEditCanned - ERROR ', error)
@@ -219,9 +215,8 @@ export class CannedResponseComponent implements OnInit {
219
215
  onDeleteCanned(canned, ev){
220
216
  ev.preventDefault()
221
217
  ev.stopPropagation()
222
- const tiledeskToken = this.tiledeskAuthService.getTiledeskToken()
223
218
  this.logger.log('[CANNED] onDeleteCanned ', canned)
224
- this.cannedResponsesService.delete(tiledeskToken, canned.id_project, canned._id).subscribe(cannedRes=> {
219
+ this.cannedResponsesService.delete(canned.id_project, canned._id).subscribe(cannedRes=> {
225
220
  if(cannedRes.status === 1000){
226
221
  this.tagsCannedFilter.splice(this.tagsCannedFilter.findIndex(el => el._id === canned._id), 1)
227
222
  }
@@ -28,7 +28,7 @@
28
28
  </div>
29
29
  </div>
30
30
 
31
- <div>
31
+ <div *ngIf="isCopilotEnabled">
32
32
  <!-- COPILOT-OPTION -->
33
33
  <div class="section-option" id="copilot" tooltip="{{translationMap?.get('COPILOT.ASK_AI')}}" placement="top">
34
34
  <ion-button id="copilot" fill="clear" [class.active]="section ==='copilot'" (click)="onOpenSection('copilot')">
@@ -61,12 +61,12 @@
61
61
  <ion-icon slot="icon-only" name="flash-outline" style="font-size: 24px;"></ion-icon>
62
62
  </ion-button>
63
63
  </div>
64
- <div *ngIf="conversationWith?.startsWith(CHANNEL_TYPE.SUPPORT_GROUP) && tagsCannedCount === 0"
64
+ <div *ngIf="conversationWith?.startsWith(CHANNEL_TYPE.SUPPORT_GROUP) && tagsCannedFilter.length === 0"
65
65
  tooltip="{{translationMap?.get('NO_CANNED_RESPONSES')}}" placement="top"
66
66
  class="no-canned-responses-btn-badge">
67
67
  <ion-icon name="alert-sharp" style="vertical-align: middle;"></ion-icon>
68
68
  </div>
69
- <div *ngIf="conversationWith?.startsWith(CHANNEL_TYPE.SUPPORT_GROUP) && (tagsCannedCount > 0)"
69
+ <div *ngIf="conversationWith?.startsWith(CHANNEL_TYPE.SUPPORT_GROUP) && (tagsCannedFilter.length > 0)"
70
70
  tooltip="{{translationMap?.get('YES_CANNED_RESPONSES')}}" placement="top" class="canned-responses-btn-badge">
71
71
  <ion-icon name="information-sharp" style="vertical-align: middle;"></ion-icon>
72
72
  </div>
@@ -52,6 +52,7 @@ export class MessageTextAreaComponent implements OnInit, AfterViewInit, OnChange
52
52
  @Input() channel: string;
53
53
  @Input() tagsCannedFilter: any;
54
54
  @Input() areVisibleCAR: boolean;
55
+ @Input() isCopilotEnabled: boolean = false;
55
56
  @Input() supportMode: boolean;
56
57
  @Input() leadInfo: {lead_id: string, hasEmail: boolean, email: string, projectId: string, presence: {}};
57
58
  @Input() fileUploadAccept: string;
@@ -110,9 +110,7 @@ export class InfoContentComponent implements OnInit {
110
110
  }
111
111
 
112
112
  getProjectIdByConversationWith(conversationWith: string) {
113
- const tiledeskToken = this.tiledeskAuthService.getTiledeskToken();
114
-
115
- this.tiledeskService.getProjectIdByConvRecipient(tiledeskToken, conversationWith).subscribe(res => {
113
+ this.tiledeskService.getProjectIdByConvRecipient(conversationWith).subscribe(res => {
116
114
  this.logger.log('[INFO-CONTENT-COMP] - GET PROJECTID BY CONV RECIPIENT RES', res);
117
115
 
118
116
  if (res) {
@@ -225,17 +223,15 @@ export class InfoContentComponent implements OnInit {
225
223
 
226
224
  this.member = null;
227
225
 
228
- const tiledeskToken = this.tiledeskAuthService.getTiledeskToken();
229
- this.contactsService.loadContactDetail(tiledeskToken, this.conversationWith)
230
- .subscribe(res => {
231
- this.logger.log('[INFO-CONTENT-COMP] - setInfoDirect loadContactDetail RES', res);
232
- this.member = res
233
- this.logger.log('[INFO-CONTENT-COMP] - setInfoDirect member', this.member);
234
- }, (error) => {
235
- this.logger.error('[INFO-CONTENT-COMP] - setInfoDirect loadContactDetail - ERROR ', error);
236
- }, () => {
237
- this.logger.log('I[INFO-CONTENT-COMP] - setInfoDirect loadContactDetail * COMPLETE *');
238
- });
226
+ this.contactsService.loadContactDetail(this.conversationWith).subscribe(res => {
227
+ this.logger.log('[INFO-CONTENT-COMP] - setInfoDirect loadContactDetail RES', res);
228
+ this.member = res
229
+ this.logger.log('[INFO-CONTENT-COMP] - setInfoDirect member', this.member);
230
+ }, (error) => {
231
+ this.logger.error('[INFO-CONTENT-COMP] - setInfoDirect loadContactDetail - ERROR ', error);
232
+ }, () => {
233
+ this.logger.log('I[INFO-CONTENT-COMP] - setInfoDirect loadContactDetail * COMPLETE *');
234
+ });
239
235
  }
240
236
 
241
237
  // ---------------------------------------------------
@@ -38,7 +38,6 @@ export class InfoGroupComponent implements OnInit, AfterViewInit, OnChanges {
38
38
  constructor(
39
39
  public imageRepoService: ImageRepoService,
40
40
  public presenceService: PresenceService,
41
- public tiledeskAuthService: TiledeskAuthService,
42
41
  public contactsService: ContactsService,
43
42
  public renderer: Renderer2,
44
43
  private router: Router,
@@ -56,10 +55,7 @@ export class InfoGroupComponent implements OnInit, AfterViewInit, OnChanges {
56
55
  // const currentUrl = this.router.url;
57
56
  // this.logger.log('InfoGroupComponent current_url ', currentUrl);
58
57
  // .pipe(takeUntil(this.unsubscribe$))
59
- router.events
60
- .pipe(filter(event => event instanceof NavigationEnd))
61
-
62
- .subscribe((event: NavigationEnd) => {
58
+ router.events.pipe(filter(event => event instanceof NavigationEnd)).subscribe((event: NavigationEnd) => {
63
59
  // console.log('InfoGroupComponent - router.events prev url :', event.url);
64
60
  this.previousUrl = event.url;
65
61
 
@@ -122,8 +118,6 @@ export class InfoGroupComponent implements OnInit, AfterViewInit, OnChanges {
122
118
 
123
119
  if (this.groupDetail) {
124
120
  if (this.groupDetail.uid.startsWith('group-')) {
125
- const tiledeskToken = this.tiledeskAuthService.getTiledeskToken();
126
-
127
121
  this.member_array = []
128
122
  const members_isonline_array = []
129
123
 
@@ -156,9 +150,7 @@ export class InfoGroupComponent implements OnInit, AfterViewInit, OnChanges {
156
150
 
157
151
  });
158
152
 
159
- this.contactsService.loadContactDetail(tiledeskToken, key)
160
- .pipe(takeUntil(this.unsubscribe$))
161
- .subscribe(user => {
153
+ this.contactsService.loadContactDetail(key).pipe(takeUntil(this.unsubscribe$)).subscribe(user => {
162
154
  this.logger.log('InfoGroupComponent group detail loadContactDetail RES', user);
163
155
  // this.logger.log('InfoGroupComponent group detail this.presenceService.BSIsOnline.value()', this.presenceService.BSIsOnline.getValue);
164
156
 
@@ -11,7 +11,7 @@
11
11
  [(ngModel)]="text"
12
12
  (ionChange)="ionChange($event);"
13
13
  (ionFocus)="ionFocus()"
14
- (keydown.enter)="onKeydown($event, messageString)">
14
+ (keydown.enter)="onKeydown($event)">
15
15
  </ion-textarea>
16
16
  </div>
17
17
  </div>
@@ -72,9 +72,8 @@ export class CopilotPopoverComponent implements OnInit {
72
72
  this.logger.log("[CONVS-DETAIL][MSG-TEXT-AREA] ionFocus event ");
73
73
  }
74
74
 
75
- onKeydown(e: any, text: string) {
75
+ onKeydown(e: any) {
76
76
  this.logger.log("[COPILOT-POPOVER] - returnChangeTextArea - onKeydown in MSG-TEXT-AREA event", e)
77
- this.logger.log("[COPILOT-POPOVER] - returnChangeTextArea - onKeydown in MSG-TEXT-AREA text", text)
78
77
  }
79
78
 
80
79
 
@@ -1,3 +1,4 @@
1
+ import { AppConfigProvider } from 'src/app/services/app-config';
1
2
  import { filter } from 'rxjs/operators';
2
3
  import { Component, ElementRef, EventEmitter, HostListener, Input, OnInit, Output, SimpleChange } from '@angular/core';
3
4
  import { CopilotService } from 'src/app/services/copilot/copilot.service';
@@ -39,19 +40,23 @@ export class CopilotSuggestionsComponent implements OnInit {
39
40
  public tiledeskAuthService: TiledeskAuthService,
40
41
  public tiledeskService: TiledeskService,
41
42
  public copilotService: CopilotService,
43
+ public appConfigProvider: AppConfigProvider,
42
44
  public el: ElementRef
43
- ) { }
45
+ ) {
46
+ const serverBaseUrl = this.appConfigProvider.getConfig().apiUrl
47
+ this.copilotService.initialize(serverBaseUrl)
48
+ }
44
49
 
45
50
  ngOnInit() {
46
51
  this.loggedUser = this.tiledeskAuthService.getCurrentUser()
47
52
  }
48
53
 
49
54
  ngOnChanges(changes: SimpleChange){
50
- this.logger.debug('[COPILOT] - loadTagsCanned strSearch ', this.currentString)
51
- if(changes && changes['conversationWith'] && (changes['conversationWith'].previousValue !== changes['conversationWith'].currentValue)){
52
- this.projectID = getProjectIdSelectedConversation(this.conversationWith)
53
- }
54
- this.loadSuggestions(this.conversationWith)
55
+ this.logger.debug('[COPILOT] - loadTagsCanned strSearch ', this.currentString)
56
+ if(changes && changes['conversationWith'] && (changes['conversationWith'].previousValue !== changes['conversationWith'].currentValue)){
57
+ this.projectID = getProjectIdSelectedConversation(this.conversationWith)
58
+ }
59
+ this.loadSuggestions(this.conversationWith)
55
60
  }
56
61
 
57
62
 
@@ -70,9 +75,7 @@ export class CopilotSuggestionsComponent implements OnInit {
70
75
  }
71
76
 
72
77
  getProjectIdByConversationWith(conversationWith: string) {
73
- const tiledeskToken = this.tiledeskAuthService.getTiledeskToken()
74
-
75
- this.tiledeskService.getProjectIdByConvRecipient(tiledeskToken, conversationWith).subscribe((res) => {
78
+ this.tiledeskService.getProjectIdByConvRecipient(conversationWith).subscribe((res) => {
76
79
  this.logger.log('[COPILOT] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT RES', res)
77
80
  if (res) {
78
81
  const projectId = res.id_project
@@ -90,13 +93,12 @@ export class CopilotSuggestionsComponent implements OnInit {
90
93
 
91
94
 
92
95
  getAndShowSuggestions(projectId) {
93
- const tiledeskToken = this.tiledeskAuthService.getTiledeskToken()
94
96
  this.logger.log('[COPILOT] - loadTagsCanned tagsCanned.length', this.suggestions.length)
95
97
  //if(this.tagsCanned.length <= 0 ){
96
98
  this.suggestions = []
97
99
  this.showLoading = true;
98
100
  if(this.question && this.question !== ''){
99
- this.copilotService.getAllFromQuestion(this.question, tiledeskToken, projectId, this.conversationWith).subscribe((res) => {
101
+ this.copilotService.getAllFromQuestion(this.question, projectId, this.conversationWith).subscribe((res) => {
100
102
  this.logger.log('[COPILOT] - loadTagsCanned getCannedResponses RES', res)
101
103
  this.suggestions = res.map(el => ({ ...el, disabled : true }))
102
104
  this.logger.log('[COPILOT] - loadTagsCanned getCannedResponses tagsCannedCount', this.suggestions)
@@ -108,7 +110,7 @@ export class CopilotSuggestionsComponent implements OnInit {
108
110
  this.onLoadedSuggestions.emit(this.suggestions)
109
111
  })
110
112
  } else {
111
- this.copilotService.getAll(tiledeskToken, projectId, this.conversationWith).subscribe((res) => {
113
+ this.copilotService.getAll(projectId, this.conversationWith).subscribe((res) => {
112
114
  this.logger.log('[COPILOT] - loadTagsCanned getCannedResponses RES', res)
113
115
  this.suggestions = res.map(el => ({ ...el, disabled : true }))
114
116
  this.logger.log('[COPILOT] - loadTagsCanned getCannedResponses tagsCannedCount', this.suggestions)
@@ -1,7 +1,7 @@
1
1
  import { AppConfigProvider } from 'src/app/services/app-config';
2
2
  import { TiledeskAuthService } from 'src/chat21-core/providers/tiledesk/tiledesk-auth.service';
3
3
  import { EventsService } from 'src/app/services/events-service';
4
- import { ProjectsService } from './../../services/projects/projects.service';
4
+ import { ProjectService } from '../../services/projects/project.service';
5
5
  import { ChangeDetectorRef, Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
6
6
  import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
7
7
  import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
@@ -33,7 +33,7 @@ export class NavbarComponent implements OnInit {
33
33
  public MT: boolean;
34
34
 
35
35
  constructor(
36
- private projectsService: ProjectsService,
36
+ private projectService: ProjectService,
37
37
  private tiledeskAuthService: TiledeskAuthService,
38
38
  private appConfigProvider: AppConfigProvider,
39
39
  private translateService: CustomTranslateService,
@@ -78,7 +78,7 @@ export class NavbarComponent implements OnInit {
78
78
 
79
79
  getProjects() {
80
80
  this.logger.log('[NAVBAR] calling getProjects ... ');
81
- this.projectsService.getProjects(this.tiledeskToken).subscribe((projects: any) => {
81
+ this.projectService.getProjects().subscribe((projects: any) => {
82
82
  this.logger.log('[NAVBAR] getProjects PROJECTS ', projects);
83
83
  if (projects) {
84
84
  // this.projects = projects;
@@ -170,7 +170,7 @@ export class NavbarComponent implements OnInit {
170
170
  url = baseUrl + '#/project/' + this.project.id_project.id + '/project-settings/general' + '?token=' + this.tiledeskToken
171
171
  }else if(event ==='allProjects'){
172
172
  url = baseUrl + '#/projects/' + '?token=' + this.tiledeskToken
173
- }else if('addProject'){
173
+ }else if(event === 'addProject'){
174
174
  url = baseUrl + '#/create-new-project/' + '?token=' + this.tiledeskToken
175
175
  }
176
176
  console.log('onClickDropdownOption-->', url)
@@ -14,6 +14,7 @@ import { WebSocketJs } from 'src/app/services/websocket/websocket-js';
14
14
  import { AppConfigProvider } from 'src/app/services/app-config';
15
15
  import { ConvertRequestToConversation } from 'src/chat21-core/utils/convertRequestToConversation';
16
16
  import { compareValues } from 'src/chat21-core/utils/utils';
17
+ import { ProjectService } from 'src/app/services/projects/project.service';
17
18
 
18
19
  @Component({
19
20
  selector: 'app-project-item',
@@ -46,7 +47,7 @@ export class ProjectItemComponent implements OnInit {
46
47
  public appStorageService: AppStorageService,
47
48
  private translateService: CustomTranslateService,
48
49
  public tiledeskAuthService: TiledeskAuthService,
49
- public tiledeskService: TiledeskService,
50
+ public projectService: ProjectService,
50
51
  public webSocketJs: WebSocketJs,
51
52
  private appConfigProvider: AppConfigProvider,
52
53
  public events: EventsService,
@@ -174,9 +175,7 @@ export class ProjectItemComponent implements OnInit {
174
175
 
175
176
  if (!stored_project || stored_project === 'undefined') {
176
177
  this.logger.log('PROJECT-ITEM - THERE IS NOT STORED LAST PROJECT OR IS UNDEFINED ', stored_project)
177
- const tiledeskToken = this.appStorageService.getItem('tiledeskToken');
178
- this.logger.log('[PROJECT-ITEM] - GET PROJECTS - tiledeskToken', tiledeskToken);
179
- this.tiledeskService.getProjects(tiledeskToken).subscribe(projects => {
178
+ this.projectService.getProjects().subscribe(projects => {
180
179
  this.logger.log('[PROJECT-ITEM - GET PROJECTS - RES', projects);
181
180
 
182
181
  this.logger.log('[INFO-CONTENT-COMP] - GET PROJECTS - RES this.project', this.project);
@@ -5,7 +5,6 @@ import { Validators, FormBuilder, FormGroup, FormControl } from '@angular/forms'
5
5
  import { TranslateService } from '@ngx-translate/core';
6
6
  import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
7
7
  import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
8
- import { TiledeskAuthService } from 'src/chat21-core/providers/tiledesk/tiledesk-auth.service';
9
8
  import { TiledeskService } from 'src/app/services/tiledesk/tiledesk.service';
10
9
  import { MenuController } from '@ionic/angular';
11
10
  import { EventsService } from 'src/app/services/events-service';
@@ -28,7 +27,6 @@ export class CreateCannedResponsePage implements OnInit {
28
27
  private logger: LoggerService = LoggerInstance.getInstance();
29
28
 
30
29
  prjctID: string;
31
- tiledeskToken: string;
32
30
  showSpinnerCreateCannedResponse: boolean = false;
33
31
  addWhiteSpaceBefore: boolean;
34
32
  mouseOverBtnAddRecipientNamePlaceholder: boolean = false;
@@ -40,7 +38,6 @@ export class CreateCannedResponsePage implements OnInit {
40
38
  private formBuilder: FormBuilder,
41
39
  private translate: TranslateService,
42
40
  private translateService: CustomTranslateService,
43
- public tiledeskAuthService: TiledeskAuthService,
44
41
  public tiledeskService: TiledeskService,
45
42
  public cannedResponsesService: CannedResponsesService,
46
43
  private menu: MenuController,
@@ -61,9 +58,7 @@ export class CreateCannedResponsePage implements OnInit {
61
58
  // this.getCurrentProjectId();
62
59
  // console.log('[CREATE-CANNED-RES] - conversationWith ', this.conversationWith)
63
60
  console.log('[CREATE-CANNED-RES] - message ', this.message, this.conversationWith)
64
- this.tiledeskToken = this.tiledeskAuthService.getTiledeskToken()
65
- this.logger.log('[CREATE-CANNED-RES] tiledeskToken ', this.tiledeskToken)
66
- this.getCurrentProjectId(this.conversationWith, this.tiledeskToken);
61
+ this.getCurrentProjectId(this.conversationWith);
67
62
 
68
63
 
69
64
  let keys= [
@@ -108,7 +103,7 @@ export class CreateCannedResponsePage implements OnInit {
108
103
  }
109
104
 
110
105
 
111
- getCurrentProjectId(conversation_id, tiledeskToken) {
106
+ getCurrentProjectId(conversation_id) {
112
107
  const conversationWith_segments = conversation_id.split('-')
113
108
  // Removes the last element of the array if is = to the separator
114
109
  if (
@@ -133,14 +128,13 @@ export class CreateCannedResponsePage implements OnInit {
133
128
  this.prjctID = conversationWith_segments[2]
134
129
  this.logger.log('[CREATE-CANNED-RES] - loadTagsCanned projectId ', this.prjctID)
135
130
  } else {
136
- this.getProjectIdByConversationWith(conversation_id, tiledeskToken)
131
+ this.getProjectIdByConversationWith(conversation_id)
137
132
  }
138
133
  }
139
134
 
140
- getProjectIdByConversationWith(conversationWith: string, tiledeskToken: string) {
141
- // const tiledeskToken = this.tiledeskAuthService.getTiledeskToken()
135
+ getProjectIdByConversationWith(conversationWith: string) {
142
136
 
143
- this.tiledeskService.getProjectIdByConvRecipient(tiledeskToken, conversationWith).subscribe((res) => {
137
+ this.tiledeskService.getProjectIdByConvRecipient(conversationWith).subscribe((res) => {
144
138
  this.logger.log('[CREATE-CANNED-RES] - GET PROJECTID BY CONV RECIPIENT RES', res)
145
139
  if (res) {
146
140
  this.prjctID = res.id_project
@@ -177,7 +171,7 @@ export class CreateCannedResponsePage implements OnInit {
177
171
  this.logger.log('[CREATE-CANNED-RES] - CREATE CANNED RESP - MSG ', message);
178
172
  this.logger.log('[CREATE-CANNED-RES] - CREATE CANNED RESP - TITLE ', title);
179
173
 
180
- this.cannedResponsesService.add(this.tiledeskToken, this.prjctID, title.trim(), message.trim()).subscribe((responses: any) => {
174
+ this.cannedResponsesService.add(this.prjctID, title.trim(), message.trim()).subscribe((responses: any) => {
181
175
  this.logger.log('[CREATE-CANNED-RES] - CREATE CANNED RESP - RES ', responses);
182
176
  }, (error) => {
183
177
  this.logger.error('[CREATE-CANNED-RES]- CREATE CANNED RESP - ERROR ', error);