@chat21/chat21-ionic 3.0.86-rc.3 → 3.0.86-rc.4
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/package.json +1 -1
- package/src/app/app.component.scss +2 -0
- package/src/app/app.module.ts +0 -1
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.html +49 -29
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.scss +82 -3
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.ts +45 -2
- package/src/app/components/bubbleMessageInfo-popover/bubbleinfo-popover.component.html +3 -0
- package/src/app/components/bubbleMessageInfo-popover/bubbleinfo-popover.component.scss +0 -0
- package/src/app/components/bubbleMessageInfo-popover/bubbleinfo-popover.component.spec.ts +24 -0
- package/src/app/components/bubbleMessageInfo-popover/bubbleinfo-popover.component.ts +28 -0
- package/src/app/components/canned-response/canned-response.component.ts +0 -1
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.html +2 -0
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +15 -6
- package/src/app/components/conversations-list/header-conversations-list/header-conversations-list.component.scss +2 -2
- package/src/app/components/project-item/project-item.component.scss +11 -241
- package/src/app/modals/create-canned-response/create-canned-response.page.html +64 -86
- package/src/app/modals/create-canned-response/create-canned-response.page.scss +169 -1
- package/src/app/modals/create-canned-response/create-canned-response.page.ts +61 -94
- package/src/app/modals/loader-preview/loader-preview.page.html +1 -1
- package/src/app/modals/loader-preview/loader-preview.page.scss +1 -1
- package/src/app/modals/send-email/send-email.page.html +2 -2
- package/src/app/modals/send-email/send-email.page.scss +5 -22
- package/src/app/modals/send-email/send-email.page.ts +4 -0
- package/src/app/pages/conversation-detail/conversation-detail.module.ts +3 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CannedResponsesService } from 'src/app/services/canned-responses/canned-responses.service';
|
|
2
|
-
import { Component, Input, OnInit } from '@angular/core';
|
|
2
|
+
import { Component, ElementRef, Input, OnInit, ViewChild } from '@angular/core';
|
|
3
3
|
import { ModalController } from '@ionic/angular';
|
|
4
4
|
import { Validators, FormBuilder, FormGroup, FormControl } from '@angular/forms';
|
|
5
5
|
import { TranslateService } from '@ngx-translate/core';
|
|
@@ -10,6 +10,7 @@ import { TiledeskService } from 'src/app/services/tiledesk/tiledesk.service';
|
|
|
10
10
|
import { MenuController } from '@ionic/angular';
|
|
11
11
|
import { EventsService } from 'src/app/services/events-service';
|
|
12
12
|
import { ActivatedRoute } from '@angular/router';
|
|
13
|
+
import { CustomTranslateService } from 'src/chat21-core/providers/custom-translate.service';
|
|
13
14
|
|
|
14
15
|
@Component({
|
|
15
16
|
selector: 'app-create-canned-response',
|
|
@@ -17,13 +18,14 @@ import { ActivatedRoute } from '@angular/router';
|
|
|
17
18
|
styleUrls: ['./create-canned-response.page.scss'],
|
|
18
19
|
})
|
|
19
20
|
export class CreateCannedResponsePage implements OnInit {
|
|
20
|
-
|
|
21
|
-
public canned_response_title: string;
|
|
22
|
-
public canned_response_message: string;
|
|
23
|
-
validations_form: FormGroup;
|
|
21
|
+
|
|
24
22
|
@Input() message: any
|
|
25
23
|
@Input() conversationWith: string;
|
|
26
|
-
|
|
24
|
+
|
|
25
|
+
@ViewChild('div_input_topic', {static: true}) input_topic: ElementRef;
|
|
26
|
+
|
|
27
|
+
cannedFormGroup: FormGroup;
|
|
28
|
+
private logger: LoggerService = LoggerInstance.getInstance();
|
|
27
29
|
|
|
28
30
|
prjctID: string;
|
|
29
31
|
tiledeskToken: string;
|
|
@@ -31,12 +33,13 @@ export class CreateCannedResponsePage implements OnInit {
|
|
|
31
33
|
addWhiteSpaceBefore: boolean;
|
|
32
34
|
mouseOverBtnAddRecipientNamePlaceholder: boolean = false;
|
|
33
35
|
mouseOverBtnAddAgentNamePlaceholder: boolean = false;
|
|
34
|
-
|
|
36
|
+
translationsMap: Map<string, string> = new Map<string, string>()
|
|
35
37
|
// public conversationWith: string;
|
|
36
38
|
constructor(
|
|
37
39
|
public modalController: ModalController,
|
|
38
40
|
private formBuilder: FormBuilder,
|
|
39
41
|
private translate: TranslateService,
|
|
42
|
+
private translateService: CustomTranslateService,
|
|
40
43
|
public tiledeskAuthService: TiledeskAuthService,
|
|
41
44
|
public tiledeskService: TiledeskService,
|
|
42
45
|
public cannedResponsesService: CannedResponsesService,
|
|
@@ -57,23 +60,10 @@ export class CreateCannedResponsePage implements OnInit {
|
|
|
57
60
|
ngOnInit() {
|
|
58
61
|
// this.getCurrentProjectId();
|
|
59
62
|
// console.log('[CREATE-CANNED-RES] - conversationWith ', this.conversationWith)
|
|
60
|
-
|
|
61
|
-
if (this.message) {
|
|
62
|
-
this.conversation_id = this.message.recipient
|
|
63
|
-
this.logger.log('[CREATE-CANNED-RES] - conversationWith get from @input message (passed by bubble-message)', this.conversation_id)
|
|
64
|
-
} else {
|
|
65
|
-
this.logger.log('[CREATE-CANNED-RES] - @input message is UNDEFINED')
|
|
66
|
-
}
|
|
67
|
-
if (this.conversationWith) {
|
|
68
|
-
this.conversation_id = this.conversationWith;
|
|
69
|
-
this.logger.log('[CREATE-CANNED-RES] - conversationWith get from @input conversationWith (passed by conversation detail) ', this.conversation_id)
|
|
70
|
-
} else {
|
|
71
|
-
this.logger.log('[CREATE-CANNED-RES] - @input conversationWith is UNDEFINED')
|
|
72
|
-
}
|
|
73
|
-
|
|
63
|
+
console.log('[CREATE-CANNED-RES] - message ', this.message, this.conversationWith)
|
|
74
64
|
this.tiledeskToken = this.tiledeskAuthService.getTiledeskToken()
|
|
75
65
|
this.logger.log('[CREATE-CANNED-RES] tiledeskToken ', this.tiledeskToken)
|
|
76
|
-
this.getCurrentProjectId(this.
|
|
66
|
+
this.getCurrentProjectId(this.conversationWith, this.tiledeskToken);
|
|
77
67
|
|
|
78
68
|
// const stored_project = localStorage.getItem('last_project')
|
|
79
69
|
// const storedPrjctObjct = JSON.parse(stored_project)
|
|
@@ -82,12 +72,44 @@ export class CreateCannedResponsePage implements OnInit {
|
|
|
82
72
|
// this.prjctID = storedPrjctObjct.id_project.id
|
|
83
73
|
// this.logger.log('[CREATE-CANNED-RES] this.prjctID ', this.prjctID)
|
|
84
74
|
// }
|
|
85
|
-
|
|
86
75
|
|
|
76
|
+
let keys= [
|
|
77
|
+
'Title',
|
|
78
|
+
'EnterCannedResponseTitle',
|
|
79
|
+
'Message',
|
|
80
|
+
'WriteMsgToSendToYourVisitors',
|
|
81
|
+
'AddCustomization',
|
|
82
|
+
'Add',
|
|
83
|
+
'First_name_of_recipient',
|
|
84
|
+
'First_name_of_agent',
|
|
85
|
+
'SelectACustomizationToAddToYourMessage',
|
|
86
|
+
'recipient_name_desc',
|
|
87
|
+
'agent_name_desc'
|
|
88
|
+
]
|
|
89
|
+
|
|
90
|
+
this.translationsMap = this.translateService.translateLanguage(keys)
|
|
91
|
+
|
|
92
|
+
this.cannedFormGroup = this.buildForm()
|
|
93
|
+
this.cannedFormGroup.valueChanges.subscribe((value)=> {
|
|
94
|
+
value.title !== ''? this.input_topic.nativeElement.classList.add('hasValue') : this.input_topic.nativeElement.classList.remove('hasValue')
|
|
95
|
+
});
|
|
96
|
+
if(this.message && (this.message !== '' || this.message !== null)){
|
|
97
|
+
this.cannedFormGroup.patchValue({ message: this.message})
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
buildForm() : FormGroup{
|
|
102
|
+
return this.formBuilder.group({
|
|
103
|
+
title: ['', [Validators.required]],
|
|
104
|
+
message: ['', [Validators.required]]
|
|
105
|
+
});
|
|
106
|
+
}
|
|
87
107
|
|
|
88
|
-
|
|
108
|
+
addFocus(){
|
|
109
|
+
this.input_topic.nativeElement.querySelector('input[formcontrolname="title"]').focus()
|
|
89
110
|
}
|
|
90
111
|
|
|
112
|
+
|
|
91
113
|
getCurrentProjectId(conversation_id, tiledeskToken) {
|
|
92
114
|
const conversationWith_segments = conversation_id.split('-')
|
|
93
115
|
// Removes the last element of the array if is = to the separator
|
|
@@ -134,30 +156,7 @@ export class CreateCannedResponsePage implements OnInit {
|
|
|
134
156
|
}
|
|
135
157
|
|
|
136
158
|
|
|
137
|
-
|
|
138
|
-
this.validations_form = this.formBuilder.group({
|
|
139
|
-
title: new FormControl('', Validators.required),
|
|
140
|
-
message: new FormControl('', Validators.required),
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
this.setValues()
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
setValues() {
|
|
147
|
-
if (this.message && this.message.text) {
|
|
148
|
-
let cannedTitle = ''
|
|
149
|
-
const titleMaxCharacters = 37
|
|
150
|
-
if (this.message.text.length > titleMaxCharacters) {
|
|
151
|
-
cannedTitle = this.message.text.substring(0, titleMaxCharacters) + '...'
|
|
152
|
-
} else {
|
|
153
|
-
cannedTitle = this.message.text
|
|
154
|
-
}
|
|
155
|
-
this.logger.log('[CREATE-CANNED-RES] - cannedTitle ', cannedTitle.trim())
|
|
156
|
-
this.logger.log('[CREATE-CANNED-RES] - cannedMsg ', this.message.text.trim())
|
|
157
|
-
this.validations_form.controls['title'].setValue(cannedTitle);
|
|
158
|
-
this.validations_form.controls['message'].setValue(this.message.text);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
159
|
+
|
|
161
160
|
|
|
162
161
|
|
|
163
162
|
validation_messages = {
|
|
@@ -169,21 +168,18 @@ export class CreateCannedResponsePage implements OnInit {
|
|
|
169
168
|
],
|
|
170
169
|
};
|
|
171
170
|
|
|
172
|
-
onSubmit(
|
|
173
|
-
this.
|
|
174
|
-
this.
|
|
175
|
-
this.
|
|
176
|
-
this.logger.log('[CREATE-CANNED-RES] ON SUBMIT canned_response_title', this.canned_response_title);
|
|
177
|
-
this.logger.log('[CREATE-CANNED-RES] ON SUBMIT canned_response_title', this.canned_response_message);
|
|
178
|
-
this.createResponse(this.canned_response_message, this.canned_response_title)
|
|
171
|
+
onSubmit() {
|
|
172
|
+
const canned = this.cannedFormGroup.value
|
|
173
|
+
this.logger.log('[CREATE-CANNED-RES] ON SUBMIT VALUES', canned);
|
|
174
|
+
this.createResponse(canned.message, canned.title)
|
|
179
175
|
}
|
|
180
176
|
|
|
181
|
-
createResponse(
|
|
177
|
+
createResponse(message: string, title: string) {
|
|
182
178
|
this.showSpinnerCreateCannedResponse = true;
|
|
183
|
-
this.logger.log('[CREATE-CANNED-RES] - CREATE CANNED RESP - MSG ',
|
|
184
|
-
this.logger.log('[CREATE-CANNED-RES] - CREATE CANNED RESP - TITLE ',
|
|
179
|
+
this.logger.log('[CREATE-CANNED-RES] - CREATE CANNED RESP - MSG ', message);
|
|
180
|
+
this.logger.log('[CREATE-CANNED-RES] - CREATE CANNED RESP - TITLE ', title);
|
|
185
181
|
|
|
186
|
-
this.cannedResponsesService.add(this.tiledeskToken, this.prjctID,
|
|
182
|
+
this.cannedResponsesService.add(this.tiledeskToken, this.prjctID, title.trim(), message.trim()).subscribe((responses: any) => {
|
|
187
183
|
this.logger.log('[CREATE-CANNED-RES] - CREATE CANNED RESP - RES ', responses);
|
|
188
184
|
}, (error) => {
|
|
189
185
|
this.logger.error('[CREATE-CANNED-RES]- CREATE CANNED RESP - ERROR ', error);
|
|
@@ -201,50 +197,21 @@ export class CreateCannedResponsePage implements OnInit {
|
|
|
201
197
|
this.menu.open('custom');
|
|
202
198
|
}
|
|
203
199
|
|
|
204
|
-
|
|
205
|
-
this.menu.close('custom')
|
|
206
|
-
this.menu.enable(false, 'custom');
|
|
207
|
-
this.insertCustomField('$recipient_name')
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
onOverBtnAddRecipientNamePlaceholder() {
|
|
211
|
-
this.mouseOverBtnAddRecipientNamePlaceholder = true;
|
|
212
|
-
this.logger.log('[CREATE-CANNED-RES] - isOverRecipientName ', this.mouseOverBtnAddRecipientNamePlaceholder);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
onOutBtnAddRecipientNamePlaceholder() {
|
|
216
|
-
this.mouseOverBtnAddRecipientNamePlaceholder = false;
|
|
217
|
-
this.logger.log('[CREATE-CANNED-RES] - isOutRecipientName ', this.mouseOverBtnAddRecipientNamePlaceholder);
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
addAgentNamePlaceholderToTheMsg() {
|
|
200
|
+
addPlaceholdertoMsg(key) {
|
|
221
201
|
this.menu.close('custom')
|
|
222
202
|
this.menu.enable(false, 'custom');
|
|
223
|
-
this.insertCustomField(
|
|
203
|
+
this.insertCustomField(key)
|
|
224
204
|
}
|
|
225
205
|
|
|
226
|
-
onOverBtnAddAgentNamePlaceholder() {
|
|
227
|
-
this.mouseOverBtnAddAgentNamePlaceholder = true;
|
|
228
|
-
this.logger.log('[CREATE-CANNED-RES] - isOverAgentName ', this.mouseOverBtnAddAgentNamePlaceholder);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
onOutBtnAddAgentNamePlaceholder() {
|
|
232
|
-
this.mouseOverBtnAddAgentNamePlaceholder = false;
|
|
233
|
-
this.logger.log('[CREATE-CANNED-RES] - isOutAgentName ', this.mouseOverBtnAddAgentNamePlaceholder);
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
206
|
|
|
240
207
|
cannedResponseMessageChanged($event) {
|
|
241
|
-
this.logger.log('[CREATE-CANNED-RES] - ON MSG CHANGED ', $event);
|
|
208
|
+
// this.logger.log('[CREATE-CANNED-RES] - ON MSG CHANGED ', $event);
|
|
242
209
|
|
|
243
210
|
if (/\s$/.test($event)) {
|
|
244
|
-
this.logger.log('[CREATE-CANNED-RES] - ON MSG CHANGED - string contains space at last');
|
|
211
|
+
// this.logger.log('[CREATE-CANNED-RES] - ON MSG CHANGED - string contains space at last');
|
|
245
212
|
this.addWhiteSpaceBefore = false;
|
|
246
213
|
} else {
|
|
247
|
-
this.logger.log('[CREATE-CANNED-RES] - ON MSG CHANGED - string does not contain space at last');
|
|
214
|
+
// this.logger.log('[CREATE-CANNED-RES] - ON MSG CHANGED - string does not contain space at last');
|
|
248
215
|
// IS USED TO ADD A WHITE SPACE TO THE 'PERSONALIZATION' VALUE IF THE STRING DOES NOT CONTAIN SPACE AT LAST
|
|
249
216
|
this.addWhiteSpaceBefore = true;
|
|
250
217
|
}
|
|
@@ -252,7 +219,7 @@ export class CreateCannedResponsePage implements OnInit {
|
|
|
252
219
|
}
|
|
253
220
|
|
|
254
221
|
insertCustomField(customfieldValue: string) {
|
|
255
|
-
const elTextarea = <HTMLElement>document.querySelector('
|
|
222
|
+
const elTextarea = <HTMLElement>document.querySelector('#message');
|
|
256
223
|
this.logger.log('[CREATE-CANNED-RES] - GET TEXT AREA - elTextarea ', elTextarea);
|
|
257
224
|
if (elTextarea) {
|
|
258
225
|
this.insertAtCursor(elTextarea, customfieldValue)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<ion-header>
|
|
1
|
+
<ion-header no-border class="ion-no-border">
|
|
2
2
|
<ion-toolbar>
|
|
3
3
|
<ion-title>{{'LABEL_EMAIL' | translate}}</ion-title>
|
|
4
4
|
<ion-buttons slot="end">
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
</div> -->
|
|
21
21
|
<div class="field-wrapper" id="div_input_topic" #div_input_topic>
|
|
22
22
|
<input type="text" formControlName="subject" >
|
|
23
|
-
<div class="field-placeholder"><span>{{translationMap?.get('SUBJECT')}}</span></div>
|
|
23
|
+
<div class="field-placeholder" (click)="addFocus()"><span>{{translationMap?.get('SUBJECT')}}</span></div>
|
|
24
24
|
</div>
|
|
25
25
|
|
|
26
26
|
<ion-label class="message-placeholder">{{translationMap?.get('MESSAGE')}}</ion-label>
|
|
@@ -29,25 +29,7 @@ ion-input{
|
|
|
29
29
|
// outline: none;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
ion-input:focus{
|
|
33
|
-
// border-color: rgb(5, 102, 255);
|
|
34
|
-
}
|
|
35
32
|
|
|
36
|
-
// ion-label{
|
|
37
|
-
// align-self: flex-start;
|
|
38
|
-
// display: inline-block;
|
|
39
|
-
// font-size: 12px;
|
|
40
|
-
// line-height: 16px;
|
|
41
|
-
// letter-spacing: -0.01em;
|
|
42
|
-
// padding: 0px 8px 2px;
|
|
43
|
-
// margin-left: 8px;
|
|
44
|
-
// background-color: rgb(255, 255, 255);
|
|
45
|
-
// position: absolute;
|
|
46
|
-
// top: 0px;
|
|
47
|
-
// transform: translateY(-7px);
|
|
48
|
-
// transition: transform 0.1s ease 0s;
|
|
49
|
-
// border-radius: 4px;
|
|
50
|
-
// }
|
|
51
33
|
|
|
52
34
|
.field-wrapper{
|
|
53
35
|
position: relative;
|
|
@@ -80,7 +62,7 @@ ion-input:focus{
|
|
|
80
62
|
z-index: 1;
|
|
81
63
|
|
|
82
64
|
text-align: left;
|
|
83
|
-
width: 100%;
|
|
65
|
+
// width: 100%;
|
|
84
66
|
}
|
|
85
67
|
|
|
86
68
|
.field-wrapper .field-placeholder span{
|
|
@@ -89,10 +71,11 @@ ion-input:focus{
|
|
|
89
71
|
}
|
|
90
72
|
|
|
91
73
|
.field-wrapper input:not([disabled]):focus~.field-placeholder,
|
|
74
|
+
.field-placeholder:target,
|
|
92
75
|
.field-wrapper.hasValue input:not([disabled])~.field-placeholder{
|
|
93
|
-
-webkit-transform: scale(.75) translateY(-35px) translateX(-
|
|
94
|
-
transform: scale(.75) translateY(-35px) translateX(-
|
|
95
|
-
color
|
|
76
|
+
-webkit-transform: scale(.75) translateY(-35px) translateX(-18px);
|
|
77
|
+
transform: scale(.75) translateY(-35px) translateX(-18px);
|
|
78
|
+
color:rgb(0,86,192);
|
|
96
79
|
font-weight: bold;
|
|
97
80
|
}
|
|
98
81
|
|
|
@@ -46,6 +46,10 @@ export class SendEmailModal implements OnInit {
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
addFocus(){
|
|
50
|
+
this.input_topic.nativeElement.querySelector('input[formcontrolname="subject"]').focus()
|
|
51
|
+
}
|
|
52
|
+
|
|
49
53
|
buildFormGroup(): FormGroup{
|
|
50
54
|
return this.formBuilder.group({
|
|
51
55
|
subject: ['', [Validators.required]],
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { BubbleInfoPopoverComponent } from '../../components/bubbleMessageInfo-popover/bubbleinfo-popover.component';
|
|
2
|
+
import { BubbleMessageComponent } from './../../chatlib/conversation-detail/message/bubble-message/bubble-message.component';
|
|
1
3
|
import { CannedResponseComponent } from './../../components/canned-response/canned-response.component';
|
|
2
4
|
import { TruncatePipe } from './../../directives/truncate.pipe';
|
|
3
5
|
import { IonConversationDetailComponent } from '../../chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component';
|
|
@@ -61,6 +63,7 @@ import { PickerModule } from '@ctrl/ngx-emoji-mart';
|
|
|
61
63
|
HeaderConversationDetailComponent,
|
|
62
64
|
MessageTextAreaComponent,
|
|
63
65
|
CannedResponseComponent,
|
|
66
|
+
BubbleInfoPopoverComponent,
|
|
64
67
|
// InfoContentComponent,
|
|
65
68
|
// InfoSupportGroupComponent,
|
|
66
69
|
// InfoDirectComponent,
|