@chat21/chat21-ionic 3.0.79-rc.2 → 3.0.79-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.
- package/CHANGELOG.md +10 -0
- package/README.md +1 -0
- package/env.sample +1 -0
- package/package.json +1 -1
- package/src/app/app.component.html +7 -1
- package/src/app/app.component.scss +16 -1
- package/src/app/app.component.ts +131 -5
- package/src/app/app.module.ts +3 -1
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.html +37 -12
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.scss +55 -50
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.ts +24 -0
- package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.html +0 -18
- package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.scss +1 -10
- package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.ts +1 -22
- package/src/app/chatlib/conversation-detail/message/message-attachment/message-attachment.component.scss +1 -3
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.html +6 -5
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +3 -82
- package/src/app/components/conversations-list/header-conversations-list/header-conversations-list.component.html +1 -1
- package/src/app/components/navbar/navbar.component.html +103 -0
- package/src/app/components/navbar/navbar.component.scss +249 -0
- package/src/app/components/{conversation-detail/bubble-my-message/bubble-my-message.component.spec.ts → navbar/navbar.component.spec.ts} +6 -6
- package/src/app/components/navbar/navbar.component.ts +189 -0
- package/src/app/components/project-item/project-item.component.ts +11 -1
- package/src/app/pages/conversation-detail/conversation-detail.module.ts +0 -8
- package/src/app/pages/conversation-detail/conversation-detail.page.ts +71 -2
- package/src/app/pages/conversations-list/conversations-list.page.scss +1 -0
- package/src/app/pages/conversations-list/conversations-list.page.ts +51 -22
- package/src/app/pages/create-canned-response/create-canned-response.page.ts +13 -13
- package/src/app/services/canned-responses/canned-responses.service.ts +26 -0
- package/src/app/services/projects/projects.service.spec.ts +12 -0
- package/src/app/services/projects/projects.service.ts +43 -0
- package/src/app/services/tiledesk/tiledesk.service.ts +1 -25
- package/src/app/shared/shared.module.ts +3 -12
- package/src/assets/i18n/ar.json +10 -2
- package/src/assets/i18n/az.json +9 -1
- package/src/assets/i18n/de.json +10 -2
- package/src/assets/i18n/en.json +10 -2
- package/src/assets/i18n/es.json +10 -2
- package/src/assets/i18n/fr.json +9 -1
- package/src/assets/i18n/it.json +9 -1
- package/src/assets/i18n/kk.json +10 -2
- package/src/assets/i18n/pt.json +10 -2
- package/src/assets/i18n/ru.json +9 -1
- package/src/assets/i18n/sr.json +277 -269
- package/src/assets/i18n/sv.json +10 -2
- package/src/assets/i18n/tr.json +10 -2
- package/src/assets/i18n/uk.json +10 -2
- package/src/assets/i18n/uz.json +9 -1
- package/src/chat-config-mqtt-localhost.json +1 -0
- package/src/chat-config-native-mqtt.json +1 -0
- package/src/chat-config-pre.json +2 -1
- package/src/chat-config-template.json +1 -0
- package/src/chat-config.json +1 -0
- package/src/chat21-core/models/conversation.ts +0 -1
- package/src/chat21-core/models/projects.ts +27 -0
- package/src/chat21-core/utils/convertRequestToConversation.ts +41 -0
- package/src/global.scss +1 -13
- package/src/index.html +6 -47
- package/src/variables.scss +5 -2
- package/src/app/components/conversation-detail/bubble-day-message/bubble-day-message.component.html +0 -3
- package/src/app/components/conversation-detail/bubble-day-message/bubble-day-message.component.scss +0 -21
- package/src/app/components/conversation-detail/bubble-day-message/bubble-day-message.component.spec.ts +0 -24
- package/src/app/components/conversation-detail/bubble-day-message/bubble-day-message.component.ts +0 -14
- package/src/app/components/conversation-detail/bubble-my-message/bubble-my-message.component.html +0 -54
- package/src/app/components/conversation-detail/bubble-my-message/bubble-my-message.component.scss +0 -98
- package/src/app/components/conversation-detail/bubble-my-message/bubble-my-message.component.ts +0 -84
- package/src/app/components/conversation-detail/bubble-others-message/bubble-others-message.component.html +0 -30
- package/src/app/components/conversation-detail/bubble-others-message/bubble-others-message.component.scss +0 -83
- package/src/app/components/conversation-detail/bubble-others-message/bubble-others-message.component.spec.ts +0 -24
- package/src/app/components/conversation-detail/bubble-others-message/bubble-others-message.component.ts +0 -68
- package/src/app/components/conversation-detail/bubble-system-message/bubble-system-message.component.html +0 -3
- package/src/app/components/conversation-detail/bubble-system-message/bubble-system-message.component.scss +0 -10
- package/src/app/components/conversation-detail/bubble-system-message/bubble-system-message.component.spec.ts +0 -24
- package/src/app/components/conversation-detail/bubble-system-message/bubble-system-message.component.ts +0 -14
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { AppConfigProvider } from 'src/app/services/app-config';
|
|
2
|
+
import { TiledeskAuthService } from 'src/chat21-core/providers/tiledesk/tiledesk-auth.service';
|
|
3
|
+
import { EventsService } from 'src/app/services/events-service';
|
|
4
|
+
import { ProjectsService } from './../../services/projects/projects.service';
|
|
5
|
+
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
|
6
|
+
import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
|
|
7
|
+
import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
|
|
8
|
+
import { Project } from 'src/chat21-core/models/projects';
|
|
9
|
+
import { CustomTranslateService } from 'src/chat21-core/providers/custom-translate.service';
|
|
10
|
+
|
|
11
|
+
@Component({
|
|
12
|
+
selector: 'app-navbar',
|
|
13
|
+
templateUrl: './navbar.component.html',
|
|
14
|
+
styleUrls: ['./navbar.component.scss'],
|
|
15
|
+
})
|
|
16
|
+
export class NavbarComponent implements OnInit {
|
|
17
|
+
|
|
18
|
+
@Input() isSoundEnabled: boolean;
|
|
19
|
+
@Output() onSoundChange = new EventEmitter<string>();
|
|
20
|
+
|
|
21
|
+
private logger: LoggerService = LoggerInstance.getInstance();
|
|
22
|
+
private tiledeskToken: string;
|
|
23
|
+
|
|
24
|
+
public projects: Project[];
|
|
25
|
+
public project: any;
|
|
26
|
+
private USER_ROLE: string;
|
|
27
|
+
|
|
28
|
+
public translationsMap: Map<string, string> = new Map();
|
|
29
|
+
|
|
30
|
+
public openDropdownProjects: boolean = false
|
|
31
|
+
private public_Key: string;
|
|
32
|
+
public isVisible: boolean;
|
|
33
|
+
public MT: boolean;
|
|
34
|
+
|
|
35
|
+
constructor(
|
|
36
|
+
private projectsService: ProjectsService,
|
|
37
|
+
private tiledeskAuthService: TiledeskAuthService,
|
|
38
|
+
private appConfigProvider: AppConfigProvider,
|
|
39
|
+
private translateService: CustomTranslateService,
|
|
40
|
+
private events: EventsService,
|
|
41
|
+
) { }
|
|
42
|
+
|
|
43
|
+
ngOnInit() {
|
|
44
|
+
this.listenToUserGoOnline();
|
|
45
|
+
this.getStoredProjectAndUserRole();
|
|
46
|
+
this.initTranslations();
|
|
47
|
+
this.getOSCODE();
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
initTranslations(){
|
|
51
|
+
let keys= [
|
|
52
|
+
"NAVBAR.SIMULATE_VISITOR",
|
|
53
|
+
"NAVBAR.PROJECT_SETTINGS",
|
|
54
|
+
"NAVBAR.VIEW_ALL_PROJECTS",
|
|
55
|
+
"NAVBAR.ADD_PROJECT",
|
|
56
|
+
"NAVBAR.RECENT_PROJECTS",
|
|
57
|
+
"NAVBAR.OTHER_PROJECTS"
|
|
58
|
+
]
|
|
59
|
+
|
|
60
|
+
this.translationsMap = this.translateService.translateLanguage(keys)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
listenToUserGoOnline(){
|
|
64
|
+
this.events.subscribe('go:online', (isOnline)=> {
|
|
65
|
+
this.logger.log('[NAVBAR] listen to go:online --> ', isOnline);
|
|
66
|
+
if(isOnline){
|
|
67
|
+
this.tiledeskToken = this.tiledeskAuthService.getTiledeskToken();
|
|
68
|
+
this.getProjects()
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
getProjects() {
|
|
74
|
+
this.logger.log('[NAVBAR] calling getProjects ... ');
|
|
75
|
+
this.projectsService.getProjects(this.tiledeskToken).subscribe((projects: any) => {
|
|
76
|
+
this.logger.log('[NAVBAR] getProjects PROJECTS ', projects);
|
|
77
|
+
if (projects) {
|
|
78
|
+
// this.projects = projects;
|
|
79
|
+
this.projects = projects.filter((project: any) => {
|
|
80
|
+
// this.logger.log('[NAVBAR] getProjects PROJECTS status ', project.id_project.status);
|
|
81
|
+
return project.id_project.status === 100;
|
|
82
|
+
});
|
|
83
|
+
this.logger.log('[NAVBAR] getProjects this.projects ', this.projects);
|
|
84
|
+
}
|
|
85
|
+
}, (error) => {
|
|
86
|
+
this.logger.error('[NAVBAR] getProjects - ERROR ', error)
|
|
87
|
+
}, () => {
|
|
88
|
+
this.logger.log('[NAVBAR] getProjects - COMPLETE')
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
getStoredProjectAndUserRole() {
|
|
93
|
+
this.events.subscribe('storage:last_project',project =>{
|
|
94
|
+
this.logger.log('[NAVBAR] stored_project ', project)
|
|
95
|
+
if (project && project !== 'undefined') {
|
|
96
|
+
this.project = project;
|
|
97
|
+
this.USER_ROLE = project.role;
|
|
98
|
+
}
|
|
99
|
+
})
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
getOSCODE() {
|
|
103
|
+
this.public_Key = this.appConfigProvider.getConfig().t2y12PruGU9wUtEGzBJfolMIgK;
|
|
104
|
+
this.logger.log('[NAVBAR] AppConfigService getAppConfig public_Key', this.public_Key)
|
|
105
|
+
this.logger.log('[NAVBAR] public_Key', this.public_Key)
|
|
106
|
+
|
|
107
|
+
let keys = this.public_Key.split("-");
|
|
108
|
+
// this.logger.log('PUBLIC-KEY (Navbar) - public_Key keys', keys)
|
|
109
|
+
|
|
110
|
+
keys.forEach(key => {
|
|
111
|
+
// this.logger.log('NavbarComponent public_Key key', key)
|
|
112
|
+
if (key.includes("PAY")) {
|
|
113
|
+
// this.logger.log('PUBLIC-KEY (Navbar) - key', key);
|
|
114
|
+
let pay = key.split(":");
|
|
115
|
+
// this.logger.log('PUBLIC-KEY (Navbar) - pay key&value', pay);
|
|
116
|
+
if (pay[1] === "F") {
|
|
117
|
+
this.isVisible = false;
|
|
118
|
+
// this.logger.log('PUBLIC-KEY (Navbar) - pay isVisible', this.isVisible);
|
|
119
|
+
} else {
|
|
120
|
+
this.isVisible = true;
|
|
121
|
+
// this.logger.log('PUBLIC-KEY (Navbar) - pay isVisible', this.isVisible);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (key.includes("MTT")) {
|
|
126
|
+
// this.logger.log('PUBLIC-KEY (Navbar) - key', key);
|
|
127
|
+
let mt = key.split(":");
|
|
128
|
+
// this.logger.log('PUBLIC-KEY (Navbar) - mt key&value', mt);
|
|
129
|
+
if (mt[1] === "F") {
|
|
130
|
+
this.MT = false;
|
|
131
|
+
// this.logger.log('PUBLIC-KEY (Navbar) - mt is', this.MT);
|
|
132
|
+
} else {
|
|
133
|
+
this.MT = true;
|
|
134
|
+
// this.logger.log('PUBLIC-KEY (Navbar) - mt is', this.MT);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
if (!this.public_Key.includes("MTT")) {
|
|
140
|
+
this.MT = false;
|
|
141
|
+
// this.logger.log('PUBLIC-KEY (Navbar) - mt is', this.MT);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
onClickSound(event: string){
|
|
148
|
+
this.onSoundChange.emit(event)
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
testWidgetPage() {
|
|
153
|
+
const simulateVisitorBtnElem = <HTMLElement>document.querySelector('.simulate-visitor-btn');
|
|
154
|
+
simulateVisitorBtnElem.blur();
|
|
155
|
+
// + '&isOpen=true'
|
|
156
|
+
const url = this.appConfigProvider.getConfig().testsiteBaseUrl + '?tiledesk_projectid=' + this.project.id_project.id + '&project_name=' + this.project.id_project.name + '&role=' + this.USER_ROLE
|
|
157
|
+
window.open(url, '_blank');
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
onClickDropdownOption(event: string){
|
|
161
|
+
const baseUrl = this.appConfigProvider.getConfig().dashboardUrl
|
|
162
|
+
let url = baseUrl
|
|
163
|
+
if(event === 'projectSettings'){
|
|
164
|
+
url = baseUrl + 'project/' + this.project.id_project.id + '/project-settings/general'
|
|
165
|
+
}else if(event ==='allProjects'){
|
|
166
|
+
url = baseUrl + 'project/'
|
|
167
|
+
}else if('addProject'){
|
|
168
|
+
url = baseUrl + 'create-new-project/'
|
|
169
|
+
}
|
|
170
|
+
window.open(url, '_blank');
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
goToHome(id_project: string, project_name: string,) {
|
|
174
|
+
// this.logger.log('!NAVBAR goToHome prjct ', prjct)
|
|
175
|
+
this.logger.log('[NAVBAR] goToHome id_project ', id_project, 'project_name', project_name)
|
|
176
|
+
// RUNS ONLY IF THE THE USER CLICK OVER A PROJECT WITH THE ID DIFFERENT FROM THE CURRENT PROJECT ID
|
|
177
|
+
const baseUrl = this.appConfigProvider.getConfig().dashboardUrl
|
|
178
|
+
if (id_project !== this.project.id_project.id) {
|
|
179
|
+
// this.subscription.unsubscribe();
|
|
180
|
+
// this.unsubscribe$.next();
|
|
181
|
+
// this.unsubscribe$.complete();
|
|
182
|
+
|
|
183
|
+
const url = this.appConfigProvider.getConfig().dashboardUrl + `/project/${id_project}/home`
|
|
184
|
+
window.open(url, '_blank');
|
|
185
|
+
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ConversationModel } from 'src/chat21-core/models/conversation';
|
|
1
2
|
import { EventsService } from './../../services/events-service';
|
|
2
3
|
import { Component, EventEmitter, HostListener, OnInit, Output } from '@angular/core';
|
|
3
4
|
import { WebsocketService } from 'src/app/services/websocket/websocket.service';
|
|
@@ -11,6 +12,8 @@ import { TiledeskAuthService } from 'src/chat21-core/providers/tiledesk/tiledesk
|
|
|
11
12
|
import { TiledeskService } from 'src/app/services/tiledesk/tiledesk.service';
|
|
12
13
|
import { WebSocketJs } from 'src/app/services/websocket/websocket-js';
|
|
13
14
|
import { AppConfigProvider } from 'src/app/services/app-config';
|
|
15
|
+
import { ConvertRequestToConversation } from 'src/chat21-core/utils/convertRequestToConversation';
|
|
16
|
+
import { compareValues } from 'src/chat21-core/utils/utils';
|
|
14
17
|
|
|
15
18
|
@Component({
|
|
16
19
|
selector: 'app-project-item',
|
|
@@ -28,6 +31,7 @@ export class ProjectItemComponent implements OnInit {
|
|
|
28
31
|
tiledeskToken: string;
|
|
29
32
|
|
|
30
33
|
unservedRequestCount: number = 0;
|
|
34
|
+
unservedConversations: ConversationModel[] = [];
|
|
31
35
|
currentUserRequestCount: number;
|
|
32
36
|
ROLE_IS_AGENT: boolean;
|
|
33
37
|
currentUserId: string;
|
|
@@ -54,7 +58,8 @@ export class ProjectItemComponent implements OnInit {
|
|
|
54
58
|
public tiledeskService: TiledeskService,
|
|
55
59
|
public webSocketJs: WebSocketJs,
|
|
56
60
|
private appConfigProvider: AppConfigProvider,
|
|
57
|
-
public events: EventsService
|
|
61
|
+
public events: EventsService,
|
|
62
|
+
public convertRequestToConversation: ConvertRequestToConversation
|
|
58
63
|
) { }
|
|
59
64
|
|
|
60
65
|
ngOnInit() {
|
|
@@ -308,6 +313,11 @@ export class ProjectItemComponent implements OnInit {
|
|
|
308
313
|
if (r['status'] === 100) {
|
|
309
314
|
if (this.hasmeInAgents(r['agents']) === true) {
|
|
310
315
|
count = count + 1;
|
|
316
|
+
let conv = this.convertRequestToConversation.getConvFromRequest(r)
|
|
317
|
+
if(!this.unservedConversations.find((el) => {return el.uid === conv.uid})){
|
|
318
|
+
this.unservedConversations.push(conv)
|
|
319
|
+
this.unservedConversations.sort(compareValues('timestamp', 'desc'))
|
|
320
|
+
}
|
|
311
321
|
}
|
|
312
322
|
}
|
|
313
323
|
});
|
|
@@ -21,10 +21,6 @@ import { ConversationDetailPage } from './conversation-detail.page';
|
|
|
21
21
|
// tslint:disable-next-line: max-line-length
|
|
22
22
|
import { HeaderConversationDetailComponent } from '../../components/conversation-detail/header-conversation-detail/header-conversation-detail.component';
|
|
23
23
|
import { MessageTextAreaComponent } from '../../components/conversation-detail/message-text-area/message-text-area.component';
|
|
24
|
-
import { BubbleDayMessageComponent } from '../../components/conversation-detail/bubble-day-message/bubble-day-message.component';
|
|
25
|
-
import { BubbleSystemMessageComponent } from '../../components/conversation-detail/bubble-system-message/bubble-system-message.component';
|
|
26
|
-
import { BubbleMyMessageComponent } from '../../components/conversation-detail/bubble-my-message/bubble-my-message.component';
|
|
27
|
-
import { BubbleOthersMessageComponent } from '../../components/conversation-detail/bubble-others-message/bubble-others-message.component';
|
|
28
24
|
// import { InfoContentComponent } from '../../components/conversation-info/info-content/info-content.component';
|
|
29
25
|
// import { InfoDirectComponent } from '../../components/conversation-info/info-direct/info-direct.component';
|
|
30
26
|
import { InfoContentComponent } from 'src/app/components/conversation-info/info-content/info-content.component';
|
|
@@ -65,10 +61,6 @@ import { PickerModule } from '@ctrl/ngx-emoji-mart';
|
|
|
65
61
|
HeaderConversationDetailComponent,
|
|
66
62
|
MessageTextAreaComponent,
|
|
67
63
|
CannedResponseComponent,
|
|
68
|
-
// BubbleDayMessageComponent,
|
|
69
|
-
// BubbleSystemMessageComponent,
|
|
70
|
-
// BubbleMyMessageComponent,
|
|
71
|
-
// BubbleOthersMessageComponent,
|
|
72
64
|
// InfoContentComponent,
|
|
73
65
|
// InfoSupportGroupComponent,
|
|
74
66
|
// InfoDirectComponent,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TYPE_DIRECT } from 'src/chat21-core/utils/constants';
|
|
1
2
|
import { URL_SOUND_LIST_CONVERSATION } from './../../../chat21-core/utils/constants'
|
|
2
3
|
import {
|
|
3
4
|
Component,
|
|
@@ -10,6 +11,7 @@ import {
|
|
|
10
11
|
HostListener,
|
|
11
12
|
ChangeDetectorRef,
|
|
12
13
|
Renderer2,
|
|
14
|
+
isDevMode
|
|
13
15
|
} from '@angular/core'
|
|
14
16
|
import { ActivatedRoute, NavigationEnd, Router } from '@angular/router'
|
|
15
17
|
import {
|
|
@@ -151,8 +153,9 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
151
153
|
conversation_count: number;
|
|
152
154
|
showSpinner: boolean = true;
|
|
153
155
|
dropEvent: any;
|
|
154
|
-
conversation:
|
|
156
|
+
conversation: ConversationModel;
|
|
155
157
|
USER_ROLE: string;
|
|
158
|
+
|
|
156
159
|
isMine = isMine
|
|
157
160
|
isInfo = isInfo
|
|
158
161
|
isFirstMessage = isFirstMessage
|
|
@@ -760,6 +763,18 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
760
763
|
}
|
|
761
764
|
}
|
|
762
765
|
|
|
766
|
+
onConversationLoaded(conversation): ConversationModel{
|
|
767
|
+
if(conversation.attributes && conversation.attributes['projectId']){
|
|
768
|
+
let project = localStorage.getItem(conversation.attributes['projectId'])
|
|
769
|
+
if(project){
|
|
770
|
+
project = JSON.parse(project)
|
|
771
|
+
conversation.attributes.project_name = project['name']
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
return conversation
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
|
|
763
778
|
setHeaderContent() {
|
|
764
779
|
// this.logger.log('[CONVS-DETAIL] - setHeaderContent conversationWith', this.conversationWith)
|
|
765
780
|
// this.logger.log('[CONVS-DETAIL] - setHeaderContent conversationsHandlerService', this.conversationsHandlerService)
|
|
@@ -769,6 +784,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
769
784
|
this.conversationsHandlerService.getConversationDetail(this.conversationWith, (conv) => {
|
|
770
785
|
this.logger.debug('[CONV-COMP] setHeaderContent getConversationDetail: conversationsHandlerService ', this.conversationWith, conv, this.conv_type)
|
|
771
786
|
if (conv) {
|
|
787
|
+
this.conversation = this.onConversationLoaded(conv)
|
|
772
788
|
this.conversationAvatar = setConversationAvatar(
|
|
773
789
|
conv.conversation_with,
|
|
774
790
|
conv.conversation_with_fullname,
|
|
@@ -783,6 +799,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
783
799
|
this.logger.debug('[CONV-COMP] setHeaderContent getConversationDetail: archivedConversationsHandlerService', this.conversationWith, conv)
|
|
784
800
|
if (conv) {
|
|
785
801
|
console.log('[CONVS-DETAIL] - setHeaderContent getConversationDetail (archived)', this.conversationWith, 'CONVS', conv)
|
|
802
|
+
this.conversation = this.onConversationLoaded(conv)
|
|
786
803
|
this.conversationAvatar = setConversationAvatar(
|
|
787
804
|
conv.conversation_with,
|
|
788
805
|
conv.conversation_with_fullname,
|
|
@@ -802,7 +819,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
802
819
|
this.logger.debug('[CONV-COMP] setHeaderContent getConversationDetail: archivedConversationsHandlerService', this.conversationWith, this.conv_type)
|
|
803
820
|
this.archivedConversationsHandlerService.getConversationDetail(this.conversationWith, (conv) => {
|
|
804
821
|
if (conv) {
|
|
805
|
-
|
|
822
|
+
this.conversation = this.onConversationLoaded(conv)
|
|
806
823
|
this.conversationAvatar = setConversationAvatar(
|
|
807
824
|
conv.conversation_with,
|
|
808
825
|
conv.conversation_with_fullname,
|
|
@@ -816,6 +833,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
816
833
|
if(!conv){
|
|
817
834
|
this.conversationsHandlerService.getConversationDetail(this.conversationWith, (conv) => {
|
|
818
835
|
if (conv) {
|
|
836
|
+
this.conversation = this.onConversationLoaded(conv)
|
|
819
837
|
this.conversationAvatar = setConversationAvatar(
|
|
820
838
|
conv.conversation_with,
|
|
821
839
|
conv.conversation_with_fullname,
|
|
@@ -917,6 +935,8 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
917
935
|
this.channelType,
|
|
918
936
|
attributes,
|
|
919
937
|
)
|
|
938
|
+
|
|
939
|
+
isDevMode()? null : this.segmentNewAgentMessage(this.conversation)
|
|
920
940
|
}
|
|
921
941
|
}
|
|
922
942
|
// ----------------------------------------------------------
|
|
@@ -1766,6 +1786,55 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1766
1786
|
clearTimeout(this.setTimeoutWritingMessages)
|
|
1767
1787
|
}
|
|
1768
1788
|
|
|
1789
|
+
|
|
1790
|
+
segmentNewAgentMessage(conversation: ConversationModel){
|
|
1791
|
+
let user = this.loggedUser
|
|
1792
|
+
try {
|
|
1793
|
+
window['analytics'].page("Chat Conversation Detail Page, Message Added", {});
|
|
1794
|
+
} catch (err) {
|
|
1795
|
+
this.logger.error('Event:Message Added [page] error', err);
|
|
1796
|
+
}
|
|
1797
|
+
|
|
1798
|
+
try {
|
|
1799
|
+
window['analytics'].identify(user.uid, {
|
|
1800
|
+
name: user.firstname + ' ' + user.lastname,
|
|
1801
|
+
email: user.email,
|
|
1802
|
+
logins: 5,
|
|
1803
|
+
});
|
|
1804
|
+
} catch (err) {
|
|
1805
|
+
this.logger.error('Event:Message Added [identify] error', err);
|
|
1806
|
+
}
|
|
1807
|
+
|
|
1808
|
+
try {
|
|
1809
|
+
window['analytics'].track('Message Added', {
|
|
1810
|
+
"username": user.firstname + ' ' + user.lastname,
|
|
1811
|
+
"userId": user.uid,
|
|
1812
|
+
"conversation_id": conversation.uid,
|
|
1813
|
+
"channel_type": conversation.channel_type,
|
|
1814
|
+
"conversation_with": conversation.conversation_with,
|
|
1815
|
+
"conversation_with_fullname": conversation.conversation_with_fullname,
|
|
1816
|
+
"department_name":(conversation.channel_type !== TYPE_DIRECT)? conversation.attributes.departmentName: null,
|
|
1817
|
+
"department_id":(conversation.channel_type !== TYPE_DIRECT)? conversation.attributes.departmentId: null,
|
|
1818
|
+
},
|
|
1819
|
+
{
|
|
1820
|
+
"context": {
|
|
1821
|
+
"groupId": (conversation.channel_type !== TYPE_DIRECT)? conversation.attributes.projectId: null
|
|
1822
|
+
}
|
|
1823
|
+
});
|
|
1824
|
+
} catch (err) {
|
|
1825
|
+
this.logger.error('Event:Message Added [track] error', err);
|
|
1826
|
+
}
|
|
1827
|
+
|
|
1828
|
+
try {
|
|
1829
|
+
window['analytics'].group(conversation.attributes.projectId, {
|
|
1830
|
+
name: (conversation.attributes.project_name)? conversation.attributes.project_name : null,
|
|
1831
|
+
// plan: projectProfileName,
|
|
1832
|
+
});
|
|
1833
|
+
} catch (err) {
|
|
1834
|
+
this.logger.error('Event:Message Added [group] error', err);
|
|
1835
|
+
}
|
|
1836
|
+
}
|
|
1837
|
+
|
|
1769
1838
|
// -------------------------------------------------------------
|
|
1770
1839
|
// DRAG FILE
|
|
1771
1840
|
// -------------------------------------------------------------
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AppStorageService } from 'src/chat21-core/providers/abstract/app-storage.service';
|
|
2
2
|
import { ArchivedConversationsHandlerService } from 'src/chat21-core/providers/abstract/archivedconversations-handler.service'
|
|
3
|
-
import { Component, OnInit, ViewChild } from '@angular/core'
|
|
3
|
+
import { Component, isDevMode, OnInit, ViewChild } from '@angular/core'
|
|
4
4
|
import { IonContent, ModalController } from '@ionic/angular'
|
|
5
5
|
import { ActivatedRoute, Router, NavigationExtras } from '@angular/router'
|
|
6
6
|
// config
|
|
@@ -47,6 +47,7 @@ import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance'
|
|
|
47
47
|
import { NetworkService } from 'src/app/services/network-service/network.service'
|
|
48
48
|
import { Subject } from 'rxjs'
|
|
49
49
|
import { takeUntil } from 'rxjs/operators'
|
|
50
|
+
import { TYPE_DIRECT } from 'src/chat21-core/utils/constants';
|
|
50
51
|
|
|
51
52
|
@Component({
|
|
52
53
|
selector: 'app-conversations-list',
|
|
@@ -479,6 +480,7 @@ export class ConversationListPage implements OnInit {
|
|
|
479
480
|
if (conversation) {
|
|
480
481
|
this.onImageLoaded(conversation)
|
|
481
482
|
this.onConversationLoaded(conversation)
|
|
483
|
+
!isDevMode() && conversation.is_new? this.segmentNewConversationAdded(conversation) : null;
|
|
482
484
|
}
|
|
483
485
|
})
|
|
484
486
|
|
|
@@ -515,27 +517,6 @@ export class ConversationListPage implements OnInit {
|
|
|
515
517
|
this.logger.log('[CONVS-LIST-PAGE] - subscribeLoggedUserLogout uidConvSelected ',this.uidConvSelected)
|
|
516
518
|
}
|
|
517
519
|
|
|
518
|
-
/**
|
|
519
|
-
* ::: subscribeChangedConversationSelected :::
|
|
520
|
-
* evento richiamato quando si seleziona un utente nell'elenco degli user
|
|
521
|
-
* apro dettaglio conversazione
|
|
522
|
-
*/
|
|
523
|
-
// --------------------------------
|
|
524
|
-
// !!!!!! IS USED? ?????
|
|
525
|
-
// ------------------------------
|
|
526
|
-
subscribeChangedConversationSelected = (user: UserModel, type: string) => {
|
|
527
|
-
this.logger.log('[CONVS-LIST-PAGE] ************** subscribeUidConvSelectedChanged navigateByUrl',user, type)
|
|
528
|
-
this.uidConvSelected = user.uid
|
|
529
|
-
this.logger.log('[CONVS-LIST-PAGE] ************** uidConvSelected ', this.uidConvSelected)
|
|
530
|
-
// this.conversationsHandlerService.uidConvSelected = user.uid;
|
|
531
|
-
const conversationSelected = this.conversations.find( (item) => item.uid === this.uidConvSelected)
|
|
532
|
-
if (conversationSelected) {
|
|
533
|
-
this.logger.log('[CONVS-LIST-PAGE] --> uidConvSelected: ',this.conversationSelected, this.uidConvSelected)
|
|
534
|
-
this.conversationSelected = conversationSelected
|
|
535
|
-
}
|
|
536
|
-
// this.router.navigateByUrl('conversation-detail/' + user.uid + '?conversationWithFullname=' + user.fullname);
|
|
537
|
-
}
|
|
538
|
-
|
|
539
520
|
/**
|
|
540
521
|
* ::: subscribeProfileInfoButtonClicked :::
|
|
541
522
|
* evento richiamato quando si seleziona bottone profile-info-modal
|
|
@@ -990,6 +971,54 @@ export class ConversationListPage implements OnInit {
|
|
|
990
971
|
return indexes
|
|
991
972
|
}
|
|
992
973
|
|
|
974
|
+
private segmentNewConversationAdded(conversation: ConversationModel){
|
|
975
|
+
let user = this.tiledeskAuthService.getCurrentUser()
|
|
976
|
+
try {
|
|
977
|
+
window['analytics'].page("Chat List Conversations Page, Conversation Added", {});
|
|
978
|
+
} catch (err) {
|
|
979
|
+
this.logger.error('Event:Conversation Added [page] error', err);
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
try {
|
|
983
|
+
window['analytics'].identify(user.uid, {
|
|
984
|
+
name: user.firstname + ' ' + user.lastname,
|
|
985
|
+
email: user.email,
|
|
986
|
+
logins: 5,
|
|
987
|
+
});
|
|
988
|
+
} catch (err) {
|
|
989
|
+
this.logger.error('Event:Conversation Added [identify] error', err);
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
try {
|
|
993
|
+
window['analytics'].track('Conversation Added', {
|
|
994
|
+
"username": user.firstname + ' ' + user.lastname,
|
|
995
|
+
"userId": user.uid,
|
|
996
|
+
"conversation_id": conversation.uid,
|
|
997
|
+
"channel_type": conversation.channel_type,
|
|
998
|
+
"conversation_with": conversation.conversation_with,
|
|
999
|
+
"conversation_with_fullname": conversation.conversation_with_fullname,
|
|
1000
|
+
"department_name":(conversation.channel_type !== TYPE_DIRECT)? conversation.attributes.departmentName: null,
|
|
1001
|
+
"department_id":(conversation.channel_type !== TYPE_DIRECT)? conversation.attributes.departmentId: null,
|
|
1002
|
+
},
|
|
1003
|
+
{
|
|
1004
|
+
"context": {
|
|
1005
|
+
"groupId": (conversation.channel_type !== TYPE_DIRECT)? conversation.attributes.projectId: null
|
|
1006
|
+
}
|
|
1007
|
+
});
|
|
1008
|
+
} catch (err) {
|
|
1009
|
+
this.logger.error('Event:Conversation Added [track] error', err);
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
try {
|
|
1013
|
+
window['analytics'].group(conversation.attributes.projectId, {
|
|
1014
|
+
name: (conversation.attributes.project_name)? conversation.attributes.project_name : null,
|
|
1015
|
+
// plan: projectProfileName,
|
|
1016
|
+
});
|
|
1017
|
+
} catch (err) {
|
|
1018
|
+
this.logger.error('Event:Conversation Added [group] error', err);
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
|
|
993
1022
|
// ------------------------------------------------------------------
|
|
994
1023
|
// !!! Not used methods !!!
|
|
995
1024
|
// ------------------------------------------------------------------
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CannedResponsesService } from 'src/app/services/canned-responses/canned-responses.service';
|
|
1
2
|
import { Component, Input, OnInit } from '@angular/core';
|
|
2
3
|
import { ModalController } from '@ionic/angular';
|
|
3
4
|
import { Validators, FormBuilder, FormGroup, FormControl } from '@angular/forms';
|
|
@@ -38,6 +39,7 @@ export class CreateCannedResponsePage implements OnInit {
|
|
|
38
39
|
private translate: TranslateService,
|
|
39
40
|
public tiledeskAuthService: TiledeskAuthService,
|
|
40
41
|
public tiledeskService: TiledeskService,
|
|
42
|
+
public cannedResponsesService: CannedResponsesService,
|
|
41
43
|
private menu: MenuController,
|
|
42
44
|
public events: EventsService,
|
|
43
45
|
private route: ActivatedRoute,
|
|
@@ -181,19 +183,17 @@ export class CreateCannedResponsePage implements OnInit {
|
|
|
181
183
|
this.logger.log('[CREATE-CANNED-RES] - CREATE CANNED RESP - MSG ', canned_response_message);
|
|
182
184
|
this.logger.log('[CREATE-CANNED-RES] - CREATE CANNED RESP - TITLE ', canned_response_title);
|
|
183
185
|
|
|
184
|
-
this.
|
|
185
|
-
.
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
this.events.publish('newcannedresponse:created', true);
|
|
196
|
-
});
|
|
186
|
+
this.cannedResponsesService.add(this.tiledeskToken, this.prjctID, canned_response_title.trim(), canned_response_message.trim()).subscribe((responses: any) => {
|
|
187
|
+
this.logger.log('[CREATE-CANNED-RES] - CREATE CANNED RESP - RES ', responses);
|
|
188
|
+
}, (error) => {
|
|
189
|
+
this.logger.error('[CREATE-CANNED-RES]- CREATE CANNED RESP - ERROR ', error);
|
|
190
|
+
this.showSpinnerCreateCannedResponse = false;
|
|
191
|
+
}, () => {
|
|
192
|
+
this.logger.log('[CREATE-CANNED-RES] - CREATE CANNED RESP * COMPLETE *');
|
|
193
|
+
this.showSpinnerCreateCannedResponse = false;
|
|
194
|
+
this.closeModalCreateCannedResponseModal()
|
|
195
|
+
this.events.publish('newcannedresponse:created', true);
|
|
196
|
+
});
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
openAddPersonalisationMenu() {
|
|
@@ -43,6 +43,32 @@ export class CannedResponsesService {
|
|
|
43
43
|
}))
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
// -------------------------------------------------------------------------------------
|
|
47
|
+
// @ Create - Save (POST) new canned response
|
|
48
|
+
// -------------------------------------------------------------------------------------
|
|
49
|
+
public add(token: string, projectid: string, title: string, message: string) {
|
|
50
|
+
const url = this.apiUrl + projectid + '/canned/'
|
|
51
|
+
this.logger.log('[TILEDESK-SERVICE] - CREATE CANNED-RES - URL', url);
|
|
52
|
+
|
|
53
|
+
const httpOptions = {
|
|
54
|
+
headers: new HttpHeaders({
|
|
55
|
+
'Content-Type': 'application/json',
|
|
56
|
+
Authorization: token
|
|
57
|
+
})
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const body = {
|
|
61
|
+
title: title,
|
|
62
|
+
text: message
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return this.http.post(url, JSON.stringify(body), httpOptions).pipe(map((res: any) => {
|
|
66
|
+
this.logger.log('[TILEDESK-SERVICE] - CREATE CANNED-RES - RES ', res);
|
|
67
|
+
return res
|
|
68
|
+
}))
|
|
69
|
+
|
|
70
|
+
}
|
|
71
|
+
|
|
46
72
|
public edit(token: string, projectid: string, canned: any){
|
|
47
73
|
const cannedResponsesURL = this.apiUrl + projectid + "/canned/"+ canned._id;
|
|
48
74
|
this.logger.log('[CANNED-RESPONSES-SERVICE] editCannedResponses - URL ', cannedResponsesURL);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { ProjectsService } from './projects.service';
|
|
4
|
+
|
|
5
|
+
describe('ProjectsService', () => {
|
|
6
|
+
beforeEach(() => TestBed.configureTestingModule({}));
|
|
7
|
+
|
|
8
|
+
it('should be created', () => {
|
|
9
|
+
const service: ProjectsService = TestBed.get(ProjectsService);
|
|
10
|
+
expect(service).toBeTruthy();
|
|
11
|
+
});
|
|
12
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
|
2
|
+
import { Injectable } from '@angular/core';
|
|
3
|
+
import { map } from 'rxjs/operators';
|
|
4
|
+
import { Project } from 'src/chat21-core/models/projects';
|
|
5
|
+
import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
|
|
6
|
+
import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
|
|
7
|
+
import { AppConfigProvider } from '../app-config';
|
|
8
|
+
|
|
9
|
+
@Injectable({
|
|
10
|
+
providedIn: 'root'
|
|
11
|
+
})
|
|
12
|
+
export class ProjectsService {
|
|
13
|
+
|
|
14
|
+
private apiUrl: string;
|
|
15
|
+
private logger: LoggerService = LoggerInstance.getInstance();
|
|
16
|
+
|
|
17
|
+
constructor(
|
|
18
|
+
public http: HttpClient,
|
|
19
|
+
public appConfigProvider: AppConfigProvider
|
|
20
|
+
) {
|
|
21
|
+
|
|
22
|
+
this.logger.log('[PROJECTS-SERVICE] HELLO !');
|
|
23
|
+
this.apiUrl = appConfigProvider.getConfig().apiUrl;
|
|
24
|
+
this.logger.log('[PROJECTS-SERVICE] apiUrl ', this.apiUrl);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public getProjects(token: string) {
|
|
28
|
+
const url = this.apiUrl + "projects/";
|
|
29
|
+
this.logger.log('[PROJECTS-SERVICE] getProjects - URL ', url);
|
|
30
|
+
|
|
31
|
+
const httpOptions = {
|
|
32
|
+
headers: new HttpHeaders({
|
|
33
|
+
'Content-Type': 'application/json',
|
|
34
|
+
Authorization: token
|
|
35
|
+
})
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
return this.http.get(url, httpOptions).pipe(map((res: Project[]) => {
|
|
39
|
+
this.logger.log('[PROJECTS-SERVICE] getProjects - RES ', res);
|
|
40
|
+
return res
|
|
41
|
+
}))
|
|
42
|
+
}
|
|
43
|
+
}
|