@chat21/chat21-ionic 3.0.79-rc.1 → 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 +14 -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 +182 -11
- 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/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.scss +1 -0
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.html +1 -2
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.scss +8 -5
- 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/contacts-directory/contacts-directory.page.scss +1 -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/pages/unassigned-conversations/unassigned-conversations.page.html +1 -1
- package/src/app/pages/unassigned-conversations/unassigned-conversations.page.scss +42 -0
- package/src/app/pages/unassigned-conversations/unassigned-conversations.page.ts +1 -0
- 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/assets/sounds/wheep-wheep.mp3 +0 -0
- 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/constants.ts +1 -1
- 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,249 @@
|
|
|
1
|
+
.navbar-absolute{
|
|
2
|
+
position: absolute;
|
|
3
|
+
width: calc(100% - var(--sidebar-width));
|
|
4
|
+
margin-left: var(--sidebar-width);
|
|
5
|
+
padding-top: 5px;
|
|
6
|
+
z-index: 1;
|
|
7
|
+
padding-bottom: 5px;
|
|
8
|
+
border-bottom: 1px solid #e7e7e7;
|
|
9
|
+
top: 0;
|
|
10
|
+
|
|
11
|
+
-webkit-font-smoothing: auto;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.navbar{
|
|
15
|
+
background-color: #fff;
|
|
16
|
+
color: #555;
|
|
17
|
+
min-height: var(--nav-bar-heigth);
|
|
18
|
+
transition: all 150ms ease 0s;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.container-fluid{
|
|
22
|
+
padding-right: 15px;
|
|
23
|
+
padding-left: 15px;
|
|
24
|
+
margin-right: auto;
|
|
25
|
+
margin-left: auto;
|
|
26
|
+
|
|
27
|
+
width: 100%;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
ion-navbar{
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.navbar-collapse{
|
|
36
|
+
border-top: none;
|
|
37
|
+
box-shadow: none;
|
|
38
|
+
|
|
39
|
+
padding-right: 15px;
|
|
40
|
+
padding-left: 15px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.navbar-right{
|
|
44
|
+
float: right;
|
|
45
|
+
|
|
46
|
+
display: inline-flex;
|
|
47
|
+
align-items: center;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.navbar-left{
|
|
51
|
+
float: left;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.simulate-visitor-btn{
|
|
55
|
+
font-size: 12px;
|
|
56
|
+
padding: 0px 11px 0px 4px !important;
|
|
57
|
+
max-height: 24px;
|
|
58
|
+
border-radius: 30px;
|
|
59
|
+
font-family: 'Poppins';
|
|
60
|
+
|
|
61
|
+
box-shadow: unset!important;
|
|
62
|
+
text-transform: none!important;
|
|
63
|
+
background: #3ecf8e!important;
|
|
64
|
+
color: #fff;
|
|
65
|
+
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.btn{
|
|
69
|
+
display: flex;
|
|
70
|
+
position: relative;
|
|
71
|
+
flex-flow: row nowrap;
|
|
72
|
+
align-items: center;
|
|
73
|
+
justify-content: center;
|
|
74
|
+
|
|
75
|
+
border: 1px solid transparent;
|
|
76
|
+
transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
.dropdown-toggle, .volume{
|
|
81
|
+
background-color: transparent;
|
|
82
|
+
color: inherit;
|
|
83
|
+
|
|
84
|
+
padding: 0px 15px;
|
|
85
|
+
font-weight: 400;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.project-dropdown {
|
|
89
|
+
max-width: 180px;
|
|
90
|
+
white-space: nowrap;
|
|
91
|
+
overflow: hidden;
|
|
92
|
+
text-overflow: ellipsis;
|
|
93
|
+
font-size: 12px;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
li{
|
|
97
|
+
position: relative;
|
|
98
|
+
display: block
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.dropdown-menu {
|
|
102
|
+
border-radius: 3px;
|
|
103
|
+
box-shadow: 0 2px 5px 0 rgb(0, 0, 0, 0.26);
|
|
104
|
+
|
|
105
|
+
position: absolute;
|
|
106
|
+
top: 100%;
|
|
107
|
+
right: 0;
|
|
108
|
+
left: auto;
|
|
109
|
+
z-index: 1000;
|
|
110
|
+
display: none;
|
|
111
|
+
float: left;
|
|
112
|
+
min-width: 160px;
|
|
113
|
+
padding: 5px 0;
|
|
114
|
+
margin: 2px 0 0;
|
|
115
|
+
font-size: 14px;
|
|
116
|
+
text-align: left;
|
|
117
|
+
list-style: none;
|
|
118
|
+
background-color: #fff;
|
|
119
|
+
-webkit-background-clip: padding-box;
|
|
120
|
+
background-clip: padding-box;
|
|
121
|
+
}
|
|
122
|
+
.dropdown-menu{
|
|
123
|
+
max-height: 240px;
|
|
124
|
+
overflow-y: auto;
|
|
125
|
+
}
|
|
126
|
+
.dropdown-menu:not(.open){
|
|
127
|
+
margin-top: -20px;
|
|
128
|
+
opacity: 0;
|
|
129
|
+
visibility: hidden;
|
|
130
|
+
display: block;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.dropdown-menu.open{
|
|
134
|
+
margin-top: 12px; //0;
|
|
135
|
+
opacity: 1;
|
|
136
|
+
visibility: visible;
|
|
137
|
+
display: block;
|
|
138
|
+
transition: all 150ms linear;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.dropdown-menu li {
|
|
142
|
+
position: relative;
|
|
143
|
+
|
|
144
|
+
.li-selected{
|
|
145
|
+
color: #4285f4;
|
|
146
|
+
background-color: #eee;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.dropdown-menu .divider{
|
|
151
|
+
background-color: rgba(0,0,0,.12);
|
|
152
|
+
margin: 5px 0;
|
|
153
|
+
|
|
154
|
+
height: 1px;
|
|
155
|
+
overflow: hidden;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.dropdown-menu li>a{
|
|
159
|
+
font-size: 13px;
|
|
160
|
+
padding: 10px 20px;
|
|
161
|
+
margin: 0 5px;
|
|
162
|
+
border-radius: 2px;
|
|
163
|
+
transition: all 150ms linear;
|
|
164
|
+
|
|
165
|
+
display: block;
|
|
166
|
+
clear: both;
|
|
167
|
+
font-weight: 400;
|
|
168
|
+
line-height: 1.42857143;
|
|
169
|
+
color: #333;
|
|
170
|
+
white-space: nowrap;
|
|
171
|
+
text-decoration: none;
|
|
172
|
+
|
|
173
|
+
cursor: pointer;
|
|
174
|
+
|
|
175
|
+
.material-icons {
|
|
176
|
+
vertical-align: middle;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
&:hover{
|
|
180
|
+
background-color: #3ea9f5;
|
|
181
|
+
color: #fff;
|
|
182
|
+
box-shadow: 0 12px 20px -10px rgba(62, 169, 245, 0.28), 0 4px 20px 0 rgba(0, 0, 0, 0.12), 0 7px 8px -5px rgba(62, 169, 245, 0.2);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
.material-icons {
|
|
188
|
+
font-family: "Material Icons";
|
|
189
|
+
font-weight: 400;
|
|
190
|
+
font-style: normal;
|
|
191
|
+
font-size: 24px;
|
|
192
|
+
line-height: 1;
|
|
193
|
+
letter-spacing: normal;
|
|
194
|
+
text-transform: none;
|
|
195
|
+
display: inline-block;
|
|
196
|
+
white-space: nowrap;
|
|
197
|
+
word-wrap: normal;
|
|
198
|
+
direction: ltr;
|
|
199
|
+
-webkit-font-smoothing: antialiased;
|
|
200
|
+
-moz-osx-font-smoothing: grayscale;
|
|
201
|
+
text-rendering: optimizeLegibility;
|
|
202
|
+
font-feature-settings: "liga";
|
|
203
|
+
|
|
204
|
+
top: 0;
|
|
205
|
+
position: relative;
|
|
206
|
+
font-size: 20px;
|
|
207
|
+
vertical-align: middle;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.ripple-container {
|
|
211
|
+
position: absolute;
|
|
212
|
+
top: 0;
|
|
213
|
+
left: 0;
|
|
214
|
+
z-index: 1;
|
|
215
|
+
width: 100%;
|
|
216
|
+
height: 100%;
|
|
217
|
+
overflow: hidden;
|
|
218
|
+
border-radius: inherit;
|
|
219
|
+
pointer-events: none;
|
|
220
|
+
|
|
221
|
+
.disabled &{
|
|
222
|
+
display: none;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
.ripple {
|
|
226
|
+
position: absolute;
|
|
227
|
+
width: 20px;
|
|
228
|
+
height: 20px;
|
|
229
|
+
margin-left: -10px;
|
|
230
|
+
margin-top: -10px;
|
|
231
|
+
border-radius: 100%;
|
|
232
|
+
background-color: #000; // fallback color
|
|
233
|
+
background-color: rgba(0,0,0,0.05);
|
|
234
|
+
transform: scale(1);
|
|
235
|
+
transform-origin: 50%;
|
|
236
|
+
opacity: 0;
|
|
237
|
+
pointer-events: none;
|
|
238
|
+
}
|
|
239
|
+
.ripple.ripple-on {
|
|
240
|
+
transition: opacity 0.15s ease-in 0s, transform 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.1s;
|
|
241
|
+
opacity: 0.1;
|
|
242
|
+
}
|
|
243
|
+
.ripple.ripple-out {
|
|
244
|
+
transition: opacity 0.1s linear 0s !important;
|
|
245
|
+
opacity: 0;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
2
|
import { IonicModule } from '@ionic/angular';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { NavbarComponent } from './navbar.component';
|
|
5
5
|
|
|
6
|
-
describe('
|
|
7
|
-
let component:
|
|
8
|
-
let fixture: ComponentFixture<
|
|
6
|
+
describe('NavbarComponent', () => {
|
|
7
|
+
let component: NavbarComponent;
|
|
8
|
+
let fixture: ComponentFixture<NavbarComponent>;
|
|
9
9
|
|
|
10
10
|
beforeEach(async(() => {
|
|
11
11
|
TestBed.configureTestingModule({
|
|
12
|
-
declarations: [
|
|
12
|
+
declarations: [ NavbarComponent ],
|
|
13
13
|
imports: [IonicModule.forRoot()]
|
|
14
14
|
}).compileComponents();
|
|
15
15
|
|
|
16
|
-
fixture = TestBed.createComponent(
|
|
16
|
+
fixture = TestBed.createComponent(NavbarComponent);
|
|
17
17
|
component = fixture.componentInstance;
|
|
18
18
|
fixture.detectChanges();
|
|
19
19
|
}));
|
|
@@ -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
|
// -------------------------------------------------------------
|