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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/angular.json +1 -0
  3. package/package.json +2 -1
  4. package/src/app/app-routing.module.ts +5 -0
  5. package/src/app/app.module.ts +6 -3
  6. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.html +23 -5
  7. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.scss +142 -49
  8. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.ts +101 -18
  9. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.html +20 -36
  10. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.scss +10 -0
  11. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.ts +35 -40
  12. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.scss +2 -0
  13. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.ts +28 -25
  14. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.html +57 -20
  15. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.scss +32 -9
  16. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +93 -24
  17. package/src/app/components/project-item/project-item.component.scss +1 -1
  18. package/src/app/components/sidebar/sidebar.component.html +9 -9
  19. package/src/app/components/sidebar/sidebar.component.ts +13 -10
  20. package/src/app/components/sidebar-user-details/sidebar-user-details.component.html +7 -0
  21. package/src/app/components/sidebar-user-details/sidebar-user-details.component.scss +13 -1
  22. package/src/app/components/sidebar-user-details/sidebar-user-details.component.ts +11 -7
  23. package/src/app/pages/conversation-detail/conversation-detail.module.ts +5 -1
  24. package/src/app/pages/conversation-detail/conversation-detail.page.html +19 -11
  25. package/src/app/pages/conversation-detail/conversation-detail.page.scss +28 -0
  26. package/src/app/pages/conversation-detail/conversation-detail.page.ts +221 -368
  27. package/src/app/pages/conversations-list/conversations-list.page.ts +6 -18
  28. package/src/app/pages/create-canned-response/create-canned-response-routing.module.ts +17 -0
  29. package/src/app/pages/create-canned-response/create-canned-response.module.ts +30 -0
  30. package/src/app/pages/create-canned-response/create-canned-response.page.html +150 -0
  31. package/src/app/pages/create-canned-response/create-canned-response.page.scss +55 -0
  32. package/src/app/pages/create-canned-response/create-canned-response.page.spec.ts +24 -0
  33. package/src/app/pages/create-canned-response/create-canned-response.page.ts +319 -0
  34. package/src/app/pages/create-requester/create-requester.page.html +1 -1
  35. package/src/app/pages/create-requester/create-requester.page.ts +1 -0
  36. package/src/app/pages/create-ticket/create-ticket.page.html +1 -1
  37. package/src/app/pages/create-ticket/create-ticket.page.ts +13 -4
  38. package/src/app/pages/profile-info/profile-info.page.html +2 -2
  39. package/src/app/pages/profile-info/profile-info.page.scss +12 -1
  40. package/src/app/services/tiledesk/tiledesk.service.ts +28 -0
  41. package/src/app/shared/shared.module.ts +1 -1
  42. package/src/assets/i18n/de.json +17 -3
  43. package/src/assets/i18n/en.json +17 -3
  44. package/src/assets/i18n/es.json +17 -3
  45. package/src/assets/i18n/fr.json +17 -3
  46. package/src/assets/i18n/it.json +17 -3
  47. package/src/assets/i18n/pt.json +17 -3
  48. package/src/assets/i18n/ru.json +17 -3
  49. package/src/assets/i18n/sr.json +17 -3
  50. package/src/assets/i18n/tr.json +17 -3
  51. package/src/global.scss +8 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # chat21-ionic ver 3.0
2
2
 
3
+ ### 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
+ - Improves the alignment of left sidebar menu item icons
6
+ - Adds the ability teammates to add a message as a canned response
7
+ - Hides the "Open canned responses" button if the "supportMode" environment variable is set to false
8
+ - 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
10
+ - Fixes the bug: "Resolve conversation" from conversation detail header doesn't work on mobile
11
+ - Adds the ability to insert emoji in the message text
12
+ - Fixes the bug: on iOS mobile devices in the conversation detail the requester's avatar is not vertically aligned
13
+ - Fixes the bug: on mobile devices in the "info profile" modal window the version number is not visible because it is on a white background
14
+ - Fixes the bug: in the "Create canned response" modal window the "Add personalisation" menu does not always work
15
+ - Adds the chat version number to the teammate details drawer
16
+ - Makes the right sidebar "Settings" menu item visible to teammates with agent role
17
+
3
18
  ### 3.0.61-rc11
4
19
  - Fixed the bug: the "Resolve" button is displayed in the header of the details of the archived conversations
5
20
  - Fixed the bug: in the header of the conversation detail the "Resolve" button remains active even after resolving the conversation
package/angular.json CHANGED
@@ -44,6 +44,7 @@
44
44
  "node_modules/@angular/material/prebuilt-themes/deeppurple-amber.css",
45
45
  "node_modules/roboto-fontface/css/roboto/roboto-fontface.css",
46
46
  "node_modules/@ng-select/ng-select/themes/default.theme.css",
47
+ "node_modules/@ctrl/ngx-emoji-mart/picker.css",
47
48
  {
48
49
  "input": "src/theme/variables.scss"
49
50
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chat21/chat21-ionic",
3
- "version": "3.0.61-rc11",
3
+ "version": "3.0.61-rc12",
4
4
  "author": "Tiledesk SRL",
5
5
  "homepage": "https://tiledesk.com/",
6
6
  "scripts": {
@@ -23,6 +23,7 @@
23
23
  "@angular/platform-browser": "~8.2.14",
24
24
  "@angular/platform-browser-dynamic": "~8.2.14",
25
25
  "@angular/router": "~8.2.14",
26
+ "@ctrl/ngx-emoji-mart": "^1.0.6",
26
27
  "@ionic-native/chooser": "^5.29.0",
27
28
  "@ionic-native/core": "^5.0.7",
28
29
  "@ionic-native/globalization": "^5.28.0",
@@ -56,11 +56,16 @@ const routes: Routes = [
56
56
  {
57
57
  path: 'create-requester',
58
58
  loadChildren: () => import('./pages/create-requester/create-requester.module').then( m => m.CreateRequesterPageModule)
59
+ },
60
+ {
61
+ path: 'create-canned-response',
62
+ loadChildren: () => import('./pages/create-canned-response/create-canned-response.module').then( m => m.CreateCannedResponsePageModule)
59
63
  }
60
64
 
61
65
 
62
66
 
63
67
 
68
+
64
69
  // {
65
70
  // path: 'conversation-detail/:IDConv',
66
71
  // loadChildren: () => import('./pages/conversation-detail/conversation-detail.module').then( m => m.ConversationDetailPageModule)
@@ -84,7 +84,7 @@ import { LoginPageModule } from './pages/authentication/login/login.module';
84
84
  import { LoaderPreviewPageModule } from './pages/loader-preview/loader-preview.module';
85
85
  import { CreateTicketPageModule } from './pages/create-ticket/create-ticket.module';
86
86
  import { CreateRequesterPageModule } from './pages/create-requester/create-requester.module';
87
-
87
+ import { CreateCannedResponsePageModule } from './pages/create-canned-response/create-canned-response.module';
88
88
  // UTILS
89
89
  import { ScrollbarThemeModule } from './utils/scrollbar-theme.directive';
90
90
  import { SharedModule } from 'src/app/shared/shared.module';
@@ -92,6 +92,8 @@ import { ConversationInfoModule } from 'src/app/components/conversation-info/con
92
92
 
93
93
 
94
94
  // Directives
95
+ // import { HtmlEntitiesEncodePipe } from './directives/html-entities-encode.pipe';
96
+ // import { MarkedPipe } from './directives/marked.pipe';
95
97
 
96
98
  import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
97
99
  import { Network } from '@ionic-native/network/ngx';
@@ -248,7 +250,7 @@ const appInitializerFn = (appConfig: AppConfigProvider, logger: NGXLogger) => {
248
250
 
249
251
  @NgModule({
250
252
  declarations: [
251
- AppComponent,
253
+ AppComponent
252
254
  ],
253
255
  entryComponents: [
254
256
  ],
@@ -285,7 +287,8 @@ const appInitializerFn = (appConfig: AppConfigProvider, logger: NGXLogger) => {
285
287
  NgxLinkifyjsModule.forRoot(),
286
288
  LoaderPreviewPageModule,
287
289
  CreateTicketPageModule,
288
- CreateRequesterPageModule
290
+ CreateRequesterPageModule,
291
+ CreateCannedResponsePageModule
289
292
  ],
290
293
  bootstrap: [AppComponent],
291
294
 
@@ -54,7 +54,19 @@
54
54
  <!-- ----------------------------------------------------------- -->
55
55
 
56
56
  <div class="conversation-wpr" style="height: 100%;">
57
- <div *ngFor="let message of messages; let i = index">
57
+ <div *ngFor="let message of messages; let i = index; let first = first; trackBy: trackByFn">
58
+
59
+ <ng-container *ngIf="first || (messages[i - 1].timestamp | date:'d') !== (message.timestamp | date:'d')">
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>
68
+ </div>
69
+ </ng-container>
58
70
 
59
71
  <div class="align-center" class="ion-text-center" *ngIf="messageType(MESSAGE_TYPE_INFO, message)"
60
72
  class="msg_info_container">
@@ -67,13 +79,16 @@
67
79
  <div role="messaggio" *ngIf="messageType(MESSAGE_TYPE_MINE, message)" class="msg_container base_sent">
68
80
 
69
81
  <!--backgroundColor non viene ancora usato -->
70
- <chat-bubble-message [ngClass]="{'has-metadata': (isImage(message) || isFrame(message))}"
82
+ <chat-bubble-message style="position: relative;" [ngClass]="{'has-metadata': (isImage(message) || isFrame(message))}"
71
83
  class="messages msg_sent" id="message_msg_sent"
72
84
  [ngClass]="{'button-in-msg' : message.metadata && message.metadata.button}" [message]="message"
73
85
  [textColor]="'col-msg-sent'"
74
86
  (onBeforeMessageRender)="returnOnBeforeMessageRender($event)"
75
87
  (onAfterMessageRender)="returnOnAfterMessageRender($event)"
76
- (onImageRendered)="onImageRenderedFN($event)">
88
+ (onImageRendered)="onImageRenderedFN($event)"
89
+ [addAsCannedResponseTooltipText]="addAsCannedResponseTooltipText"
90
+ [areVisibleCAR]="areVisibleCAR"
91
+ [support_mode]="support_mode">
77
92
  </chat-bubble-message>
78
93
 
79
94
  <!-- icon status message -->
@@ -99,12 +114,15 @@
99
114
 
100
115
  <!--backgroundColor non viene ancora usato -->
101
116
 
102
- <chat-bubble-message [ngClass]="{'has-metadata': (isImage(message) || isFrame(message))}" class="messages msg_receive" id="message_msg_receive"
117
+ <chat-bubble-message style="position: relative;" [ngClass]="{'has-metadata': (isImage(message) || isFrame(message))}" class="messages msg_receive" id="message_msg_receive"
103
118
  [message]="message"
104
119
  [textColor]="'black'"
105
120
  (onBeforeMessageRender)="returnOnBeforeMessageRender($event)"
106
121
  (onAfterMessageRender)="returnOnAfterMessageRender($event)"
107
- (onImageRendered)="onImageRenderedFN($event)">
122
+ (onImageRendered)="onImageRenderedFN($event)"
123
+ [addAsCannedResponseTooltipText]="addAsCannedResponseTooltipText"
124
+ [areVisibleCAR]="areVisibleCAR"
125
+ [support_mode]="support_mode" >
108
126
  </chat-bubble-message>
109
127
  </div>
110
128
 
@@ -2,29 +2,30 @@
2
2
  color: lightblue;
3
3
  }
4
4
 
5
- :host .base_sent .msg_sent ::ng-deep div > div > div > chat-text > p > p {
6
- margin-top:12px !important;
5
+ :host .base_sent .msg_sent ::ng-deep div > div > div > chat-text > p > p {
6
+ margin-top: 12px !important;
7
7
  // white-space: nowrap;
8
8
  // overflow: hidden;
9
9
  // text-overflow: ellipsis;
10
10
  }
11
11
 
12
- :host .base_sent .msg_sent ::ng-deep > div > div > chat-image > div {
12
+ :host .base_sent .msg_sent ::ng-deep > div > div > chat-image > div {
13
13
  // display: none !important;
14
14
  // border-radius: unset !important;
15
- img, .loader {
15
+ img,
16
+ .loader {
16
17
  border-top-right-radius: 6px !important;
17
18
  border-top-left-radius: 16px !important;
18
19
  border-bottom-left-radius: 16px !important;
19
20
  border-bottom-right-radius: 0px;
20
21
  }
21
-
22
22
  }
23
23
 
24
24
  :host .base_receive .msg_receive ::ng-deep > div > div > chat-image > div > img {
25
25
  // display: none !important;
26
26
  // border-radius: unset !important;
27
- img, .loader {
27
+ img,
28
+ .loader {
28
29
  border-top-left-radius: 6px !important;
29
30
  border-top-right-radius: 16px !important;
30
31
  border-bottom-right-radius: 16px !important;
@@ -38,9 +39,8 @@ ion-item {
38
39
  --min-height: 20px;
39
40
  --border-style: none;
40
41
 
41
- .input-wrapper{
42
-
43
- .align-center{
42
+ .input-wrapper {
43
+ .align-center {
44
44
  display: block;
45
45
  }
46
46
  }
@@ -53,12 +53,12 @@ ion-item {
53
53
  //opacity: 0px;
54
54
  }
55
55
 
56
- .msg_info_container{
56
+ .msg_info_container {
57
57
  text-align: center;
58
58
  padding: 2px 0px 2px 0px;
59
59
  }
60
60
 
61
- .message_sender_fullname{
61
+ .message_sender_fullname {
62
62
  font-size: 0.7em;
63
63
  margin: 0 0 1px 10px;
64
64
  color: var(--gray);
@@ -72,15 +72,15 @@ ion-item {
72
72
  // padding: 6px 6px 6px 6px;
73
73
  // box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
74
74
  // -webkit-animation: heartbeat 1.5s ease-in-out both;
75
- // animation: heartbeat 1.5s ease-in-out both;
75
+ // animation: heartbeat 1.5s ease-in-out both;
76
76
  }
77
-
77
+
78
78
  /* send message */
79
79
  .base_sent {
80
80
  align-items: flex-end;
81
81
  justify-content: flex-end;
82
- padding: 2px 0px 4px 40px;
83
-
82
+ // padding: 2px 0px 4px 40px;
83
+ padding: 2px 0px 14px 40px; // edited to display the date at the bottom of the "message bubble"
84
84
  .msg_sent {
85
85
  background-color: var(--bobble-blue);
86
86
  color: var(--col-msg-sent);
@@ -89,18 +89,21 @@ ion-item {
89
89
  max-width: calc(100% - 70px);
90
90
  min-width: 14px;
91
91
  border-top-right-radius: 8px;
92
- border-bottom-right-radius: 0px;
93
-
92
+ border-bottom-right-radius: 0px;
94
93
  }
94
+ // .msg_sent:hover {
95
+ // background-color: rgba(0, 153, 255, 0.6);
96
+ // }
95
97
 
96
98
  .has-metadata {
97
99
  max-width: 100% !important;
98
100
  }
99
101
  }
100
-
102
+
101
103
  /** recive message **/
102
104
  .base_receive {
103
- padding: 0px 0px 6px 0px;
105
+ // padding: 0px 0px 6px 0px;
106
+ padding: 0px 0px 15px 0px; // edited to display the date at the bottom of the "message bubble"
104
107
  /* avatar */
105
108
  .content-avatar {
106
109
  position: relative;
@@ -109,7 +112,7 @@ ion-item {
109
112
  height: 28px;
110
113
  margin-right: 6px;
111
114
 
112
- .profile_image{
115
+ .profile_image {
113
116
  position: relative;
114
117
  width: 25px;
115
118
  height: 25px;
@@ -118,7 +121,7 @@ ion-item {
118
121
  background-color: #ffffff;
119
122
  border: 1px solid #e2e2e2;
120
123
  }
121
- .profile_image img{
124
+ .profile_image img {
122
125
  max-width: 100%;
123
126
  width: 100%;
124
127
  height: 100%;
@@ -139,15 +142,18 @@ ion-item {
139
142
  width: auto;
140
143
  border-top-left-radius: 8px;
141
144
  border-bottom-left-radius: 0px;
145
+ }
146
+
147
+ // .msg_receive:hover {
148
+ // background-color: rgba(247, 247, 247, 0.6);
149
+ // }
142
150
 
143
- }
144
-
145
151
  .has-metadata {
146
152
  max-width: 100% !important;
147
153
  }
148
154
  }
149
155
 
150
- .time{
156
+ .time {
151
157
  margin-bottom: 20px;
152
158
  }
153
159
 
@@ -158,42 +164,129 @@ ion-item {
158
164
  min-height: 20px;
159
165
  padding: 7px;
160
166
  text-align: center;
161
- }
162
-
163
- .spinner > div {
167
+ }
168
+
169
+ .spinner > div {
164
170
  width: 10px;
165
171
  height: 10px;
166
172
  background-color: rgb(255, 255, 255);
167
-
173
+
168
174
  border-radius: 100%;
169
175
  display: inline-block;
170
176
  -webkit-animation: sk-bouncedelay 1.4s infinite ease-in-out both;
171
177
  animation: sk-bouncedelay 1.4s infinite ease-in-out both;
172
- }
173
-
174
- .spinner .bounce1 {
178
+ }
179
+
180
+ .spinner .bounce1 {
175
181
  -webkit-animation-delay: -0.32s;
176
182
  animation-delay: -0.32s;
177
- }
178
-
179
- .spinner .bounce2 {
183
+ }
184
+
185
+ .spinner .bounce2 {
180
186
  -webkit-animation-delay: -0.16s;
181
187
  animation-delay: -0.16s;
182
- }
183
-
184
- @-webkit-keyframes sk-bouncedelay {
185
- 0%, 80%, 100% { -webkit-transform: scale(0) }
186
- 40% { -webkit-transform: scale(1.0) }
187
- }
188
-
189
- @keyframes sk-bouncedelay {
190
- 0%, 80%, 100% {
191
- -webkit-transform: scale(0);
192
- transform: scale(0);
193
- } 40% {
194
- -webkit-transform: scale(1.0);
195
- transform: scale(1.0);
188
+ }
189
+
190
+ @-webkit-keyframes sk-bouncedelay {
191
+ 0%,
192
+ 80%,
193
+ 100% {
194
+ -webkit-transform: scale(0);
195
+ }
196
+ 40% {
197
+ -webkit-transform: scale(1);
198
+ }
199
+ }
200
+
201
+ @keyframes sk-bouncedelay {
202
+ 0%,
203
+ 80%,
204
+ 100% {
205
+ -webkit-transform: scale(0);
206
+ transform: scale(0);
207
+ }
208
+ 40% {
209
+ -webkit-transform: scale(1);
210
+ transform: scale(1);
196
211
  }
197
- }
212
+ }
213
+
214
+ // ---------------------------------------------------------
215
+ // Button add canned on the fly
216
+ // ---------------------------------------------------------
217
+ :host .base_sent .msg_sent ::ng-deep div > div > div > ion-button {
218
+ display: none;
219
+ position: absolute;
220
+ top: -3px;
221
+ left: -31px;
222
+ }
198
223
 
224
+ // :host .base_sent .msg_sent:hover ::ng-deep div > div > div > ion-button {
225
+ :host .base_sent:hover .msg_sent ::ng-deep div > div > div > ion-button {
226
+ display: block;
227
+ // position: absolute;
228
+ // top: -11px;
229
+ // left: -26px;
230
+ }
231
+
232
+ :host .base_receive .msg_receive ::ng-deep div > div > ion-button {
233
+ display: none;
234
+ position: absolute;
235
+ top: -3px;
236
+ right: -31px;
237
+ }
238
+
239
+ // :host .base_receive .msg_receive:hover ::ng-deep div > div > ion-button {
240
+ :host .base_receive:hover .msg_receive ::ng-deep div > div > ion-button {
241
+ display: block;
242
+ // position: absolute;
243
+ // top: -11px;
244
+ // left: 91px;
245
+ }
199
246
 
247
+ // ---------------------------------------------------------
248
+ // Long date divider
249
+ // ---------------------------------------------------------
250
+ .long-date-divider-wpr {
251
+ justify-content: center !important;
252
+ align-items: center !important;
253
+ display: flex !important;
254
+ margin-top: 0.75rem !important;
255
+ margin-bottom: 0.75rem !important;
256
+ }
257
+
258
+ .long-date-divider-border-b {
259
+ border-bottom: 1px solid #dee5ee !important;
260
+ flex: 1 1 auto !important;
261
+ margin-left: 1.1rem !important;
262
+ margin-right: 1.1rem !important;
263
+ }
264
+
265
+ .long-date-divider {
266
+ flex: 0 0 auto !important;
267
+ font-size: 0.75rem !important;
268
+ font-weight: 500 !important;
269
+ line-height: 1.25rem !important;
270
+ margin-left: 1rem !important;
271
+ margin-right: 1rem !important;
272
+ color: #64748b;
273
+ }
274
+
275
+ // ---------------------------------------------------------
276
+ // message date
277
+ // ---------------------------------------------------------
278
+ :host .base_sent .msg_sent ::ng-deep div > div > div > .message-date {
279
+ position: absolute;
280
+ bottom: -11px;
281
+ color: #64748b;
282
+ font-size: 10px;
283
+ right: 0px;
284
+ }
285
+
286
+ :host .base_receive .msg_receive ::ng-deep div > div > .message-date {
287
+ position: absolute;
288
+ bottom: -11px;
289
+ color: #64748b;
290
+ font-size: 10px;
291
+ left: 0px;
292
+ }
@@ -1,5 +1,5 @@
1
1
  import { ConversationContentComponent } from '../conversation-content/conversation-content.component';
2
- import { ChangeDetectorRef, Component, Input, OnInit, Output, EventEmitter} from '@angular/core';
2
+ import { ChangeDetectorRef, Component, Input, OnInit, Output, EventEmitter } from '@angular/core';
3
3
 
4
4
 
5
5
  import { MESSAGE_TYPE_INFO, MESSAGE_TYPE_MINE, MESSAGE_TYPE_OTHERS } from 'src/chat21-core/utils/constants';
@@ -9,23 +9,29 @@ import { isFile, isFrame, isImage } from 'src/chat21-core/utils/utils-message';
9
9
 
10
10
  import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
11
11
  import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
12
-
12
+ import { TiledeskAuthService } from 'src/chat21-core/providers/tiledesk/tiledesk-auth.service';
13
+ import { TranslateService } from '@ngx-translate/core';
14
+ import * as moment from 'moment';
15
+ import { AppConfigProvider } from 'src/app/services/app-config';
13
16
  @Component({
14
17
  selector: 'ion-conversation-detail',
15
18
  templateUrl: './ion-conversation-detail.component.html',
16
19
  styleUrls: ['./ion-conversation-detail.component.scss'],
17
20
  })
18
21
  export class IonConversationDetailComponent extends ConversationContentComponent implements OnInit {
19
-
22
+
20
23
  @Input() senderId: string;
21
24
  @Input() channelType: string;
22
- @Output() onImageRendered = new EventEmitter<boolean>()
25
+ @Output() onImageRendered = new EventEmitter<boolean>()
23
26
  @Output() onAddUploadingBubble = new EventEmitter<boolean>();
24
-
25
27
 
28
+ public public_Key: any
29
+ public areVisibleCAR: boolean
30
+ public support_mode: boolean
26
31
  public uploadProgress: number = 100
27
32
  public fileType: any
28
-
33
+ public browserLang: string;
34
+ public addAsCannedResponseTooltipText: string;
29
35
  isImage = isImage;
30
36
  isFile = isFile;
31
37
  isFrame = isFrame;
@@ -47,38 +53,105 @@ export class IonConversationDetailComponent extends ConversationContentComponent
47
53
  */
48
54
  constructor(
49
55
  public cdref: ChangeDetectorRef,
50
- public uploadService: UploadService
56
+ public uploadService: UploadService,
57
+ public tiledeskAuthService: TiledeskAuthService,
58
+ private translate: TranslateService,
59
+ public appConfigProvider: AppConfigProvider,
51
60
  ) {
52
61
  super(cdref, uploadService)
53
-
62
+
54
63
  }
55
64
 
56
- ngOnInit() {
57
- this.listenToUploadFileProgress()
65
+ ngOnInit() {
66
+ this.getOSCODE()
67
+ this.listenToUploadFileProgress();
68
+ this.setMomentLocaleAndGetTranslation();
69
+ }
70
+
71
+ getOSCODE() {
72
+ this.support_mode = this.appConfigProvider.getConfig().supportMode
73
+ this.public_Key = this.appConfigProvider.getConfig().t2y12PruGU9wUtEGzBJfolMIgK
74
+ this.logger.log('[CONVS-DETAIL][ION-CONVS-DETAIL] AppConfigService getAppConfig public_Key', this.public_Key)
75
+
76
+ if (this.public_Key) {
77
+ let keys = this.public_Key.split('-')
78
+ this.logger.log('[CONVS-DETAIL][ION-CONVS-DETAIL] PUBLIC-KEY - public_Key keys', keys)
79
+
80
+ keys.forEach((key) => {
81
+ if (key.includes('CAR')) {
82
+ let car = key.split(':')
83
+ if (car[1] === 'F') {
84
+ this.areVisibleCAR = false
85
+ this.logger.log('[CONVS-DETAIL][ION-CONVS-DETAIL] PUBLIC-KEY - areVisibleCAR', this.areVisibleCAR)
86
+ } else {
87
+ this.areVisibleCAR = true
88
+ this.logger.log('[CONVS-DETAIL][ION-CONVS-DETAIL] PUBLIC-KEY - areVisibleCAR', this.areVisibleCAR)
89
+ }
90
+ }
91
+ })
92
+
93
+ if (!this.public_Key.includes('CAR')) {
94
+ this.areVisibleCAR = false
95
+ console.log('[CONVS-DETAIL][ION-CONVS-DETAIL] PUBLIC-KEY - areVisibleCAR', this.areVisibleCAR)
96
+ }
97
+ } else {
98
+ this.areVisibleCAR = false
99
+ }
100
+ }
101
+
102
+ setMomentLocaleAndGetTranslation() {
103
+ this.browserLang = this.translate.getBrowserLang();
104
+ const currentUser = this.tiledeskAuthService.getCurrentUser();
105
+ this.logger.log('[CONVS-DETAIL][ION-CONVS-DETAIL] - ngOnInit - currentUser ', currentUser)
106
+ let currentUserId = ''
107
+ if (currentUser) {
108
+ currentUserId = currentUser.uid
109
+ this.logger.log('[CONVS-DETAIL][ION-CONVS-DETAIL]] - ngOnInit - currentUserId ', currentUserId)
110
+ }
111
+
112
+ const stored_preferred_lang = localStorage.getItem(currentUserId + '_lang');
113
+ this.logger.log('[CONVS-DETAIL][ION-CONVS-DETAIL] stored_preferred_lang: ', stored_preferred_lang);
114
+
115
+
116
+ let chat_lang = ''
117
+ if (this.browserLang && !stored_preferred_lang) {
118
+ chat_lang = this.browserLang
119
+ } else if (this.browserLang && stored_preferred_lang) {
120
+ chat_lang = stored_preferred_lang
121
+ }
122
+ moment.locale(chat_lang)
123
+ // this.translate.getTranslation(chat_lang).subscribe((labels: string) => {
124
+ // console.log('[CONVS-DETAIL] translations: ', labels);
125
+ // });
126
+ this.translate.get('AddAsCannedResponse')
127
+ .subscribe((text: string) => {
128
+ // console.log('[CONVS-DETAIL] AddAsCannedResponse translated: ', text);
129
+ this.addAsCannedResponseTooltipText = text
130
+ })
58
131
  }
59
132
 
60
133
  listenToUploadFileProgress() {
61
134
  this.logger.log('[CONVS-DETAIL][ION-CONVS-DETAIL] FIREBASE-UPLOAD - calling BSStateUpload ');
62
135
  this.uploadService.BSStateUpload.subscribe((data: any) => {
63
136
  this.logger.log('[CONVS-DETAIL][ION-CONVS-DETAIL] FIREBASE-UPLOAD - BSStateUpload data', data);
64
-
137
+
65
138
  if (data) {
66
139
  this.logger.log('[CONVS-DETAIL][ION-CONVS-DETAIL] FIREBASE-UPLOAD - BSStateUpload data.upload', data.upload);
67
140
  this.logger.log('[CONVS-DETAIL][ION-CONVS-DETAIL] FIREBASE-UPLOAD - BSStateUpload data.upload typeof', typeof data.upload);
68
141
  this.uploadProgress = data.upload
69
142
 
70
- if (isNaN(data.upload)) {
143
+ if (isNaN(data.upload)) {
71
144
  this.logger.log('[CONVS-DETAIL][ION-CONVS-DETAIL] FIREBASE-UPLOAD - BSStateUpload data.upload IS NaN (e.g. file size is 0)');
72
145
  this.uploadProgress = 100
73
146
  }
74
147
  // if (data.type.startsWith("application")) {
75
148
  // if (!data.type.startsWith("image")) {
76
-
77
- // this.fileType = 'file'
78
149
 
79
- this.addUploadingBubblePlaceholder(true)
150
+ // this.fileType = 'file'
151
+
152
+ this.addUploadingBubblePlaceholder(true)
80
153
 
81
- // this.logger.log('[CONVS-DETAIL][ION-CONVS-DETAIL] FIREBASE-UPLOAD - BSStateUpload this.fileType', this.fileType);
154
+ // this.logger.log('[CONVS-DETAIL][ION-CONVS-DETAIL] FIREBASE-UPLOAD - BSStateUpload this.fileType', this.fileType);
82
155
  // }
83
156
  }
84
157
  });
@@ -88,10 +161,20 @@ export class IonConversationDetailComponent extends ConversationContentComponent
88
161
  this.onAddUploadingBubble.emit(value);
89
162
  }
90
163
 
91
- onImageRenderedFN(event){
164
+ onImageRenderedFN(event) {
92
165
  this.logger.log('[CONVS-DETAIL][ION-CONVS-DETAIL] - onImageRenderedFN:::ionic', event)
93
166
  this.onImageRendered.emit(event)
94
167
  }
95
168
 
96
-
169
+ /**
170
+ * Track by function for ngFor loops
171
+ *
172
+ * @param index
173
+ * @param item
174
+ */
175
+ trackByFn(index: number, item: any): any {
176
+ // console.log('[CONVS-DETAIL][ION-CONVS-DETAIL] - trackByFn index', index)
177
+ // console.log('[CONVS-DETAIL][ION-CONVS-DETAIL] - trackByFn item', item)
178
+ return item.uid || index;
179
+ }
97
180
  }