@chat21/chat21-ionic 3.0.61-rc12 → 3.0.61-rc16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,12 +1,22 @@
1
1
  # chat21-ionic ver 3.0
2
2
 
3
+ ### 3.0.61-rc16
4
+ - Does not allow teammates with agent role to access the "settings sidebar"
5
+
6
+ ### 3.0.61-rc15
7
+ - Increase the size of the emoji and remove the background color when it is sent or received without text
8
+ - Adds the ability to open sidebar menu items in a new tab by combining left mouse button + CMD keyboard key
9
+
10
+ ### 3.0.61-rc14
11
+ - Fixes the bug: the page to which the sidebar Settings menu item redirects is not correct for team members with agent role
12
+ - Fixes the bug: right clicking on the sidebar menu items doesn't show the context menu
13
+
3
14
  ### 3.0.61-rc12
4
- - Fixes the bug: it is not possible to read the requester's id which occurs when in the modal window "Create ticket" after selecting the requester the same is deleted
5
15
  - Improves the alignment of left sidebar menu item icons
6
- - Adds the ability teammates to add a message as a canned response
16
+ - Adds the ability to add a message as a canned response
7
17
  - Hides the "Open canned responses" button if the "supportMode" environment variable is set to false
8
18
  - Fixes the bug: "Settings" menu item in the left sidebar redirects to the "Canned responses" page instead of the "Widget" page
9
- - Adds the ability to add a canned response
19
+ - Adds the ability to add a new canned response
10
20
  - Fixes the bug: "Resolve conversation" from conversation detail header doesn't work on mobile
11
21
  - Adds the ability to insert emoji in the message text
12
22
  - Fixes the bug: on iOS mobile devices in the conversation detail the requester's avatar is not vertically aligned
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chat21/chat21-ionic",
3
- "version": "3.0.61-rc12",
3
+ "version": "3.0.61-rc16",
4
4
  "author": "Tiledesk SRL",
5
5
  "homepage": "https://tiledesk.com/",
6
6
  "scripts": {
@@ -58,20 +58,19 @@
58
58
 
59
59
  <ng-container *ngIf="first || (messages[i - 1].timestamp | date:'d') !== (message.timestamp | date:'d')">
60
60
  <div class="long-date-divider-wpr">
61
- <div class="long-date-divider-border-b"></div>
62
- <div class="long-date-divider">
63
- <!-- {{message.timestamp | date: 'longDate' : 'it'}} -->
64
- {{message.timestamp | amDateFormat:'LL'}}
65
-
66
- </div>
67
- <div class="long-date-divider-border-b"></div>
61
+ <div class="long-date-divider-border-b"></div>
62
+ <div class="long-date-divider">
63
+ <!-- {{message.timestamp | date: 'longDate' : 'it'}} -->
64
+ {{message.timestamp | amDateFormat:'LL'}}
65
+
66
+ </div>
67
+ <div class="long-date-divider-border-b"></div>
68
68
  </div>
69
- </ng-container>
69
+ </ng-container>
70
70
 
71
71
  <div class="align-center" class="ion-text-center" *ngIf="messageType(MESSAGE_TYPE_INFO, message)"
72
72
  class="msg_info_container">
73
- <chat-info-message class="messages"
74
- [message]="message">
73
+ <chat-info-message class="messages" [message]="message">
75
74
  </chat-info-message>
76
75
  </div>
77
76
 
@@ -79,16 +78,15 @@
79
78
  <div role="messaggio" *ngIf="messageType(MESSAGE_TYPE_MINE, message)" class="msg_container base_sent">
80
79
 
81
80
  <!--backgroundColor non viene ancora usato -->
82
- <chat-bubble-message style="position: relative;" [ngClass]="{'has-metadata': (isImage(message) || isFrame(message))}"
83
- class="messages msg_sent" id="message_msg_sent"
84
- [ngClass]="{'button-in-msg' : message.metadata && message.metadata.button}" [message]="message"
85
- [textColor]="'col-msg-sent'"
86
- (onBeforeMessageRender)="returnOnBeforeMessageRender($event)"
87
- (onAfterMessageRender)="returnOnAfterMessageRender($event)"
88
- (onImageRendered)="onImageRenderedFN($event)"
89
- [addAsCannedResponseTooltipText]="addAsCannedResponseTooltipText"
90
- [areVisibleCAR]="areVisibleCAR"
91
- [support_mode]="support_mode">
81
+
82
+ <chat-bubble-message style="position: relative;"
83
+ [ngClass]="{'has-metadata': (isImage(message) || isFrame(message))}" class="messages msg_sent"
84
+ id="message_msg_sent" [ngClass]="{'button-in-msg' : message.metadata && message.metadata.button}"
85
+ [message]="message" [textColor]="'col-msg-sent'" (onBeforeMessageRender)="returnOnBeforeMessageRender($event)"
86
+ (onAfterMessageRender)="returnOnAfterMessageRender($event)" (onImageRendered)="onImageRenderedFN($event)"
87
+ [addAsCannedResponseTooltipText]="addAsCannedResponseTooltipText" [areVisibleCAR]="areVisibleCAR"
88
+ [support_mode]="support_mode"
89
+ [class.emoticon]="message?.emoticon">
92
90
  </chat-bubble-message>
93
91
 
94
92
  <!-- icon status message -->
@@ -113,35 +111,30 @@
113
111
  </chat-avatar-image> -->
114
112
 
115
113
  <!--backgroundColor non viene ancora usato -->
116
-
117
- <chat-bubble-message style="position: relative;" [ngClass]="{'has-metadata': (isImage(message) || isFrame(message))}" class="messages msg_receive" id="message_msg_receive"
118
- [message]="message"
119
- [textColor]="'black'"
114
+
115
+ <chat-bubble-message style="position: relative;"
116
+ [ngClass]="{'has-metadata': (isImage(message) || isFrame(message))}" class="messages msg_receive"
117
+ id="message_msg_receive" [message]="message" [textColor]="'black'"
120
118
  (onBeforeMessageRender)="returnOnBeforeMessageRender($event)"
121
- (onAfterMessageRender)="returnOnAfterMessageRender($event)"
122
- (onImageRendered)="onImageRenderedFN($event)"
123
- [addAsCannedResponseTooltipText]="addAsCannedResponseTooltipText"
124
- [areVisibleCAR]="areVisibleCAR"
125
- [support_mode]="support_mode" >
119
+ (onAfterMessageRender)="returnOnAfterMessageRender($event)" (onImageRendered)="onImageRenderedFN($event)"
120
+ [addAsCannedResponseTooltipText]="addAsCannedResponseTooltipText" [areVisibleCAR]="areVisibleCAR"
121
+ [support_mode]="support_mode"
122
+ [class.emoticon]="message?.emoticon">
126
123
  </chat-bubble-message>
127
124
  </div>
128
125
 
129
126
  <!-- message type:: button && -->
130
- <div *ngIf="message?.attributes && message?.attributes?.attachment " class="slide-in-left" >
131
- <chat-message-attachment
132
- style="height: 100%; display: block;"
133
- [message]="message"
134
- [isLastMessage] = "isLastMessage(message?.uid)"
135
- [stylesMap]="stylesMap"
136
- (onAttachmentButtonClicked)="returnOnAttachmentButtonClicked($event)">
127
+ <div *ngIf="message?.attributes && message?.attributes?.attachment " class="slide-in-left">
128
+ <chat-message-attachment style="height: 100%; display: block;" [message]="message"
129
+ [isLastMessage]="isLastMessage(message?.uid)" [stylesMap]="stylesMap"
130
+ (onAttachmentButtonClicked)="returnOnAttachmentButtonClicked($event)">
137
131
  </chat-message-attachment>
138
132
  </div>
139
133
  </div>
140
134
  <!-- (fileType === 'file' && uploadProgress !== 100) -->
141
135
 
142
136
  <!-- uploadProgress -> {{ uploadProgress }} -->
143
- <div *ngIf="uploadProgress !== 100" class="msg_container base_sent"
144
- style="margin-right: 20px;">
137
+ <div *ngIf="uploadProgress !== 100" class="msg_container base_sent" style="margin-right: 20px;">
145
138
  <div class="messages msg_sent">
146
139
  <div class="spinner">
147
140
  <div class="bounce1"></div>
@@ -91,10 +91,12 @@ ion-item {
91
91
  border-top-right-radius: 8px;
92
92
  border-bottom-right-radius: 0px;
93
93
  }
94
- // .msg_sent:hover {
95
- // background-color: rgba(0, 153, 255, 0.6);
96
- // }
97
-
94
+ .emoticon {
95
+ background: unset !important;
96
+ font-size: 4em;
97
+ padding-bottom: 21px;
98
+ padding-top: 30px;
99
+ }
98
100
  .has-metadata {
99
101
  max-width: 100% !important;
100
102
  }
@@ -144,9 +146,10 @@ ion-item {
144
146
  border-bottom-left-radius: 0px;
145
147
  }
146
148
 
147
- // .msg_receive:hover {
148
- // background-color: rgba(247, 247, 247, 0.6);
149
- // }
149
+ .emoticon {
150
+ background: unset !important;
151
+ font-size: 4em;
152
+ }
150
153
 
151
154
  .has-metadata {
152
155
  max-width: 100% !important;
@@ -290,3 +293,17 @@ ion-item {
290
293
  font-size: 10px;
291
294
  left: 0px;
292
295
  }
296
+ // ---------------------------------------------------------
297
+ // emoticon
298
+ // ---------------------------------------------------------
299
+
300
+ :host .base_sent .msg_sent ::ng-deep div > div > div > .chat-text-emoticon > p > p {
301
+ margin-bottom: 6px !important;
302
+ margin-right: -7px !important;
303
+ }
304
+
305
+ :host .base_receive .msg_receive ::ng-deep div > div > div > .chat-text-emoticon > p > p {
306
+ margin-bottom: 41px !important;
307
+ margin-left: -8px !important;
308
+ margin-top: 49px !important;
309
+ }
@@ -43,6 +43,7 @@
43
43
  </ng-template> -->
44
44
 
45
45
  <chat-text [text]="message?.text" [color]="textColor" [message]="message"
46
+ [class.chat-text-emoticon]="message?.emoticon"
46
47
  (onBeforeMessageRender)="returnOnBeforeMessageRender($event)"
47
48
  (onAfterMessageRender)="returnOnAfterMessageRender($event)">
48
49
  </chat-text>
@@ -21,7 +21,6 @@
21
21
  font-variant: normal;
22
22
  font-weight: 300;
23
23
  overflow: hidden;
24
-
25
24
  }
26
25
  img {
27
26
  border-radius: 8px;
@@ -32,30 +31,33 @@
32
31
  height: auto;
33
32
  object-fit: cover;
34
33
  }
34
+
35
35
  .message_innerhtml {
36
36
  margin: 0px;
37
37
  // padding: 0px 14px;
38
- &.marked{
39
- padding:8px;
40
- margin-block-start: -1em!important;
41
- margin-block-end: -1em!important;
38
+ &.marked {
39
+ padding: 8px;
40
+ margin-block-start: -1em !important;
41
+ margin-block-end: -1em !important;
42
42
  }
43
-
43
+
44
44
  .text-message {
45
45
  padding-top: 14px;
46
46
  }
47
47
  }
48
-
49
48
  }
50
49
  // > .button-native
51
- .btn-add-msg-as-canned-response {
50
+ .btn-add-msg-as-canned-response {
52
51
  // padding-left: 5px ;
53
52
  // padding-right: 5px ;
54
53
  border-radius: 50%;
55
- --padding-end: 7px ;
56
- --padding-start: 7px ;
57
- box-shadow: 0 1px 2px 0 rgb(0 0 0 / 6%)
58
-
54
+ --padding-end: 7px;
55
+ --padding-start: 7px;
56
+ box-shadow: 0 1px 2px 0 rgb(0 0 0 / 6%);
59
57
  }
60
58
 
59
+ // .emoticon {
60
+ // padding: 35px 0px !important;
61
+ // }
62
+
61
63
 
@@ -71,11 +71,12 @@
71
71
  </li>
72
72
 
73
73
  <!-- ------------------------------------------- -->
74
- <!-- HOME -->
74
+ <!-- HOME (click)="goToHome()"" -->
75
75
  <!-- ------------------------------------------- -->
76
- <li (click)="goToHome()" matTooltip="Home" #tooltip="matTooltip" matTooltipPosition='right'
76
+
77
+ <li matTooltip="Home" #tooltip="matTooltip" matTooltipPosition='right'
77
78
  matTooltipHideDelay="100" matTooltipClass="custom-mat-tooltip">
78
- <a class="customAncor">
79
+ <a target="_self" href="{{ dashboard_home_url }}" class="customAncor">
79
80
  <i class="material-icons sidebar-icons">
80
81
  home
81
82
  </i>
@@ -84,12 +85,12 @@
84
85
 
85
86
 
86
87
  <!-- ---------------------------------- -->
87
- <!-- Bot -->
88
+ <!-- Bot (click)="goToBots()" -->
88
89
  <!-- ---------------------------------- -->
89
90
  <ng-container *ngIf="USER_ROLE !== 'agent'">
90
- <li (click)="goToBots()" id="bot-anchor-wpr" matTooltipClass="custom-mat-tooltip" matTooltip="Bots"
91
+ <li id="bot-anchor-wpr" matTooltipClass="custom-mat-tooltip" matTooltip="Bots"
91
92
  #tooltip="matTooltip" matTooltipPosition='right' matTooltipHideDelay="100" style="text-align: center;">
92
- <a id="bot-anchor" #botbtn class="customAncor" style="height: 40px;margin-right: 0px !important;">
93
+ <a target="_self" href="{{ dashboard_bots_url }}" id="bot-anchor" #botbtn class="customAncor" style="height: 40px;margin-right: 0px !important;">
93
94
  <span class="bot-icon-wpr">
94
95
  <svg version="1.1" id="Objects" xmlns="http://www.w3.org/2000/svg"
95
96
  xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 30 30"
@@ -114,12 +115,12 @@
114
115
  </ng-container>
115
116
 
116
117
  <!-- ------------------------------------------- -->
117
- <!-- Conversations (VISITORS) {{ conversations_lbl }} -->
118
+ <!-- Conversations (MONITOR) (click)="goToConversations()" -->
118
119
  <!-- ------------------------------------------- -->
119
120
  <ng-container *ngIf="USER_ROLE !== 'agent'">
120
- <li (click)="goToConversations()" matTooltipClass="custom-mat-tooltip" matTooltip="Monitor"
121
+ <li matTooltipClass="custom-mat-tooltip" matTooltip="Monitor"
121
122
  #tooltip="matTooltip" matTooltipPosition='right' matTooltipHideDelay="100" style="text-align: center;">
122
- <a class="customAncor" style="height: 40px;margin-right: 0px !important;">
123
+ <a target="_self" href="{{ dashboard_convs_url }}" class="customAncor" style="height: 40px;margin-right: 0px !important;">
123
124
  <!-- <i class="material-icons sidebar-icons">forum</i> -->
124
125
  <span class="realtime-icon-wpr" >
125
126
 
@@ -136,22 +137,22 @@
136
137
  </ng-container>
137
138
 
138
139
  <!-- ------------------------------------------- -->
139
- <!-- CONTACTS (LEADS) -->
140
+ <!-- CONTACTS (LEADS) (click)="goToContacts()" -->
140
141
  <!-- ------------------------------------------- -->
141
- <li (click)="goToContacts()" matTooltipClass="custom-mat-tooltip" matTooltip="{{ contacts_lbl }}"
142
+ <li matTooltipClass="custom-mat-tooltip" matTooltip="{{ contacts_lbl }}"
142
143
  #tooltip="matTooltip" matTooltipPosition='right' matTooltipHideDelay="100" style="text-align: center;">
143
- <a class="customAncor">
144
+ <a target="_self" href="{{ dashboard_contacts_url }}" class="customAncor">
144
145
  <i class="material-icons sidebar-icons">contacts</i>
145
146
  </a>
146
147
  </li>
147
148
 
148
149
  <!-- ------------------------------------------- -->
149
- <!-- APPS -->
150
+ <!-- APPS (click)="goToAppStore()" -->
150
151
  <!-- ------------------------------------------- -->
151
152
  <ng-container *ngIf="isVisibleAPP && USER_ROLE !== 'agent'">
152
- <li (click)="goToAppStore()" matTooltipClass="custom-mat-tooltip" matTooltip="{{ apps_lbl }}"
153
+ <li matTooltipClass="custom-mat-tooltip" matTooltip="{{ apps_lbl }}"
153
154
  #tooltip="matTooltip" matTooltipPosition='right' matTooltipHideDelay="100" style="text-align: center;">
154
- <a class="customAncor" style="margin-right: 0px !important;">
155
+ <a target="_self" href="{{ dashboard_app_url }}" class="customAncor" style="margin-right: 0px !important;">
155
156
  <!-- <i class="material-icons sidebar-icons">apps</i> -->
156
157
  <!-- <i class="material-icons sidebar-icons">dashboard_customize</i> -->
157
158
  <span class="dashboard-customize-icon-wpr">
@@ -166,12 +167,12 @@
166
167
  </ng-container>
167
168
 
168
169
  <!-- ------------------------------------------- -->
169
- <!-- ANALYTICS -->
170
+ <!-- ANALYTICS (click)="goToAnalytics()" -->
170
171
  <!-- ------------------------------------------- -->
171
172
  <ng-container *ngIf="isVisibleANA && USER_ROLE !== 'agent'">
172
- <li (click)="goToAnalytics()" matTooltipClass="custom-mat-tooltip" matTooltip="{{ analytics_lbl }}"
173
- #tooltip="matTooltip" matTooltipPosition='right' matTooltipHideDelay="100" style="text-align: center;">
174
- <a class="customAncor" style="margin-right: 0px !important;">
173
+ <li matTooltipClass="custom-mat-tooltip" matTooltip="{{ analytics_lbl }}"
174
+ #tooltip="matTooltip" matTooltipPosition='right' matTooltipHideDelay="100" style="text-align: center;" >
175
+ <a target="_self" href="{{ dashboard_analytics_url }}" class="customAncor" style="margin-right: 0px !important;">
175
176
  <!-- <i class="material-icons sidebar-icons">trending_up</i> -->
176
177
  <!-- <i class="material-icons sidebar-icons"> analytics </i> -->
177
178
  <!-- <i class="material-icons sidebar-icons"> bar_chart </i> -->
@@ -187,12 +188,12 @@
187
188
  </ng-container>
188
189
 
189
190
  <!-- ------------------------------------------- -->
190
- <!-- ACTIVITIES -->
191
+ <!-- ACTIVITIES (click)="goToActivities()" -->
191
192
  <!-- ------------------------------------------- -->
192
193
  <ng-container *ngIf="isVisibleACT">
193
- <li *ngIf="USER_ROLE !== 'agent'" (click)="goToActivities()" matTooltipClass="custom-mat-tooltip"
194
+ <li *ngIf="USER_ROLE !== 'agent'" matTooltipClass="custom-mat-tooltip"
194
195
  matTooltip="{{ activities_lbl }}" #tooltip="matTooltip" matTooltipPosition='right' matTooltipHideDelay="100" style="text-align: center;">
195
- <a class="customAncor">
196
+ <a target="_self" href="{{ dashboard_activities_url }}" class="customAncor">
196
197
  <i class="material-icons sidebar-icons">assignment</i>
197
198
  </a>
198
199
  </li>
@@ -200,21 +201,21 @@
200
201
 
201
202
 
202
203
  <!-- ------------------------------------------- -->
203
- <!-- REQUESTS HISTORY -->
204
+ <!-- REQUESTS HISTORY (click)="goToHistory()" -->
204
205
  <!-- ------------------------------------------- -->
205
- <li (click)="goToHistory()" matTooltipClass="custom-mat-tooltip" matTooltip="{{ history_lbl }}"
206
+ <li matTooltipClass="custom-mat-tooltip" matTooltip="{{ history_lbl }}"
206
207
  #tooltip="matTooltip" matTooltipPosition='right' matTooltipHideDelay="100" style="text-align: center;">
207
- <a class="customAncor">
208
+ <a target="_self" href="{{ dashboard_history_url }}" class="customAncor">
208
209
  <i class="material-icons sidebar-icons">history</i>
209
210
  </a>
210
211
  </li>
211
212
 
212
213
  <!-- ----------------------------------------------------------------------------------- -->
213
- <!-- SETTINGS // old: goToSettings_CannedResponses() *ngIf="USER_ROLE !== 'agent'" -->
214
+ <!-- SETTINGS // old: goToSettings_CannedResponses() *ngIf="USER_ROLE !== 'agent'" (click)="goToWidgetSetUpOrToCannedResponses()" -->
214
215
  <!-- ----------------------------------------------------------------------------------- -->
215
- <li (click)="goToWidgetSetUp()" matTooltipClass="custom-mat-tooltip"
216
+ <li *ngIf="USER_ROLE !== 'agent'" matTooltipClass="custom-mat-tooltip"
216
217
  matTooltip="{{ settings_lbl }}" #tooltip="matTooltip" matTooltipPosition='right' matTooltipHideDelay="100" style="text-align: center;">
217
- <a class="customAncor">
218
+ <a target="_self" href="{{ dashboard_settings_url }}" class="customAncor">
218
219
  <i class="material-icons sidebar-icons">settings</i>
219
220
  </a>
220
221
  </li>
@@ -49,6 +49,15 @@ export class SidebarComponent implements OnInit {
49
49
  countClickOnOpenUserDetailSidebar: number = 0
50
50
  USER_PHOTO_PROFILE_EXIST: boolean;
51
51
  currentUser: any;
52
+ dashboard_home_url: string;
53
+ dashboard_bots_url: string;
54
+ dashboard_convs_url: string;
55
+ dashboard_contacts_url: string;
56
+ dashboard_app_url: string;
57
+ dashboard_analytics_url: string;
58
+ dashboard_activities_url: string;
59
+ dashboard_history_url: string;
60
+ dashboard_settings_url: string;
52
61
  constructor(
53
62
  public imageRepoService: ImageRepoService,
54
63
  public appStorageService: AppStorageService,
@@ -84,8 +93,44 @@ export class SidebarComponent implements OnInit {
84
93
  // height: '35px'
85
94
  // };
86
95
  // }
96
+
97
+
98
+ }
99
+
100
+
101
+ getStoredProjectAndUserRole() {
102
+ const stored_project = localStorage.getItem('last_project')
103
+ // console.log('[SIDEBAR] stored_project ', stored_project)
104
+ if (stored_project) {
105
+ const project = JSON.parse(stored_project)
106
+ this.logger.log('[SIDEBAR] project ', project)
107
+
108
+ this.project_id = project.id_project.id
109
+ this.logger.log('[SIDEBAR] project_id ', this.project_id)
110
+
111
+ this.USER_ROLE = project.role;
112
+ this.logger.log('[SIDEBAR] USER_ROLE ', this.USER_ROLE)
113
+ this.buildURLs(this.USER_ROLE)
114
+ }
87
115
  }
88
116
 
117
+ buildURLs(USER_ROLE) {
118
+ this.dashboard_home_url = this.DASHBOARD_URL + this.project_id + '/home'
119
+ this.dashboard_bots_url = this.DASHBOARD_URL + this.project_id + '/bots'
120
+ this.dashboard_convs_url = this.DASHBOARD_URL + this.project_id + '/wsrequests'
121
+ this.dashboard_contacts_url = this.DASHBOARD_URL + this.project_id + '/contacts'
122
+ this.dashboard_app_url = this.DASHBOARD_URL + this.project_id + '/app-store'
123
+ this.dashboard_analytics_url = this.DASHBOARD_URL + this.project_id + '/analytics'
124
+ this.dashboard_activities_url = this.DASHBOARD_URL + this.project_id + '/activities'
125
+ this.dashboard_history_url = this.DASHBOARD_URL + this.project_id + '/history'
126
+ this.dashboard_settings_url = ''
127
+ if (USER_ROLE !== 'agent') {
128
+ this.dashboard_settings_url = this.DASHBOARD_URL + this.project_id + '/widget-set-up'
129
+ } else if (USER_ROLE === 'agent') {
130
+ this.dashboard_settings_url = this.DASHBOARD_URL + this.project_id + '/cannedresponses'
131
+ }
132
+
133
+ }
89
134
 
90
135
  subcribeToAuthStateChanged() {
91
136
  this.messagingAuthService.BSAuthStateChanged.subscribe((state) => {
@@ -378,35 +423,23 @@ export class SidebarComponent implements OnInit {
378
423
  // }
379
424
  // }
380
425
 
381
- getStoredProjectAndUserRole() {
382
- const stored_project = localStorage.getItem('last_project')
383
- // console.log('[SIDEBAR] stored_project ', stored_project)
384
- if (stored_project) {
385
- const project = JSON.parse(stored_project)
386
- this.logger.log('[SIDEBAR] project ', project)
387
426
 
388
- this.project_id = project.id_project.id
389
- this.logger.log('[SIDEBAR] project_id ', this.project_id)
390
-
391
- this.USER_ROLE = project.role;
392
- this.logger.log('[SIDEBAR] USER_ROLE ', this.USER_ROLE)
393
- }
394
- }
395
427
 
396
428
  goToHome() {
397
429
  let url = this.DASHBOARD_URL + this.project_id + '/home'
430
+ this.dashboard_home_url = url;
398
431
  const myWindow = window.open(url, '_self');
399
432
  myWindow.focus();
400
433
  }
401
434
 
402
- goToConversations() {
403
- let url = this.DASHBOARD_URL + this.project_id + '/wsrequests'
435
+ goToBots() {
436
+ let url = this.DASHBOARD_URL + this.project_id + '/bots'
404
437
  const myWindow = window.open(url, '_self');
405
438
  myWindow.focus();
406
439
  }
407
440
 
408
- goToBots() {
409
- let url = this.DASHBOARD_URL + this.project_id + '/bots'
441
+ goToConversations() {
442
+ let url = this.DASHBOARD_URL + this.project_id + '/wsrequests'
410
443
  const myWindow = window.open(url, '_self');
411
444
  myWindow.focus();
412
445
  }
@@ -443,10 +476,12 @@ export class SidebarComponent implements OnInit {
443
476
  myWindow.focus();
444
477
  }
445
478
 
446
- goToSettings_CannedResponses() {
447
- let url = this.DASHBOARD_URL + this.project_id + '/cannedresponses'
448
- const myWindow = window.open(url, '_self');
449
- myWindow.focus();
479
+ goToWidgetSetUpOrToCannedResponses() {
480
+ if (this.USER_ROLE !== 'agent') {
481
+ this.goToWidgetSetUp()
482
+ } else if (this.USER_ROLE === 'agent') {
483
+ this.goToSettings_CannedResponses()
484
+ }
450
485
  }
451
486
 
452
487
  goToWidgetSetUp() {
@@ -455,6 +490,14 @@ export class SidebarComponent implements OnInit {
455
490
  myWindow.focus();
456
491
  }
457
492
 
493
+ goToSettings_CannedResponses() {
494
+ let url = this.DASHBOARD_URL + this.project_id + '/cannedresponses'
495
+ const myWindow = window.open(url, '_self');
496
+ myWindow.focus();
497
+ }
498
+
499
+
500
+
458
501
  public translations() {
459
502
  const keys = [
460
503
  'Available',
@@ -18,11 +18,11 @@ import { ConversationHandlerService } from '../abstract/conversation-handler.ser
18
18
  import { LoggerService } from '../abstract/logger.service';
19
19
  import { LoggerInstance } from '../logger/loggerInstance';
20
20
  // utils
21
- import { MSG_STATUS_RECEIVED, CHAT_REOPENED, CHAT_CLOSED, MEMBER_JOINED_GROUP, TYPE_DIRECT, MESSAGE_TYPE_INFO , TOUCHING_OPERATOR} from '../../utils/constants';
21
+ import { MSG_STATUS_RECEIVED, CHAT_REOPENED, CHAT_CLOSED, MEMBER_JOINED_GROUP, TYPE_DIRECT, MESSAGE_TYPE_INFO, TOUCHING_OPERATOR } from '../../utils/constants';
22
22
  import { compareValues, searchIndexInArrayForUid, conversationMessagesRef } from '../../utils/utils';
23
23
 
24
24
 
25
- import { messageType } from 'src/chat21-core/utils/utils-message';
25
+ import { messageType, isEmojii } from 'src/chat21-core/utils/utils-message';
26
26
 
27
27
 
28
28
 
@@ -156,7 +156,8 @@ export class FirebaseConversationHandler extends ConversationHandlerService {
156
156
  typeMsg,
157
157
  attributes,
158
158
  channelType,
159
- false
159
+ false,
160
+ isEmojii(msg)
160
161
  );
161
162
  const messageRef = firebaseMessagesCustomUid.push({
162
163
  language: lang,
@@ -288,6 +289,10 @@ export class FirebaseConversationHandler extends ConversationHandlerService {
288
289
 
289
290
  // verifico che il sender è il logged user
290
291
  msg.isSender = this.isSender(msg.sender, this.loggedUser.uid);
292
+
293
+ //check if message contains only an emojii
294
+ msg.emoticon = isEmojii(msg.text)
295
+
291
296
  // traduco messaggi se sono del server
292
297
  if (msg.attributes && msg.attributes.subtype) {
293
298
  if (msg.attributes.subtype === 'info' || msg.attributes.subtype === 'info/support') {
@@ -85,6 +85,25 @@ export function messageType(msgType: string, message: any) {
85
85
  }
86
86
  }
87
87
 
88
+ export function isEmojii(message: any){
89
+ if (message.length > 2) {
90
+ return false;
91
+ }
92
+ let fistChar = '';
93
+ try {
94
+ fistChar = message.trim(); // .charAt(0);
95
+ } catch (e) {
96
+ return false;
97
+ }
98
+
99
+ const ranges = ['(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff]|[\u0023-\u0039]\ufe0f?\u20e3|\u3299|\u3297|\u303d|\u3030|\u24c2|\ud83c[\udd70-\udd71]|\ud83c[\udd7e-\udd7f]|\ud83c\udd8e|\ud83c[\udd91-\udd9a]|\ud83c[\udde6-\uddff]|[\ud83c[\ude01-\ude02]|\ud83c\ude1a|\ud83c\ude2f|[\ud83c[\ude32-\ude3a]|[\ud83c[\ude50-\ude51]|\u203c|\u2049|[\u25aa-\u25ab]|\u25b6|\u25c0|[\u25fb-\u25fe]|\u00a9|\u00ae|\u2122|\u2139|\ud83c\udc04|[\u2600-\u26FF]|\u2b05|\u2b06|\u2b07|\u2b1b|\u2b1c|\u2b50|\u2b55|\u231a|\u231b|\u2328|\u23cf|[\u23e9-\u23f3]|[\u23f8-\u23fa]|\ud83c\udccf|\u2934|\u2935|[\u2190-\u21ff])'];
100
+ if (fistChar.match(ranges.join('|'))) {
101
+ return true;
102
+ } else {
103
+ return false;
104
+ }
105
+ }
106
+
88
107
  /** */
89
108
  export function getSizeImg(message: any, maxWidthImage?: number): any {
90
109
  try {