@chat21/chat21-web-widget 5.0.53 → 5.0.54

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 (49) hide show
  1. package/CHANGELOG.md +35 -2
  2. package/deploy_amazon_prod.sh +11 -2
  3. package/package.json +1 -1
  4. package/src/app/app.component.html +1 -1
  5. package/src/app/app.component.ts +18 -8
  6. package/src/app/app.module.ts +10 -8
  7. package/src/app/component/conversation-detail/conversation/conversation.component.ts +15 -1
  8. package/src/app/component/conversation-detail/conversation-content/conversation-content.component.spec.ts +2 -2
  9. package/src/app/component/form/inputs/form-text/form-text.component.scss +3 -1
  10. package/src/app/component/form/inputs/form-textarea/form-textarea.component.scss +1 -1
  11. package/src/app/component/home-conversations/home-conversations.component.html +5 -3
  12. package/src/app/component/last-message/last-message.component.html +83 -72
  13. package/src/app/component/last-message/last-message.component.scss +119 -42
  14. package/src/app/component/last-message/last-message.component.spec.ts +2 -2
  15. package/src/app/component/last-message/last-message.component.ts +49 -25
  16. package/src/app/component/list-all-conversations/list-all-conversations.component.ts +1 -1
  17. package/src/app/component/message/bubble-message/bubble-message.component.html +0 -5
  18. package/src/app/component/message/html/html.component.spec.ts +1 -1
  19. package/src/app/component/message/info-message/info-message.component.spec.ts +1 -1
  20. package/src/app/component/message/text/text.component.scss +4 -0
  21. package/src/app/component/message/text/text.component.spec.ts +2 -2
  22. package/src/app/component/message-attachment/message-attachment.component.html +1 -1
  23. package/src/app/component/message-attachment/message-attachment.component.ts +2 -0
  24. package/src/app/{directives → pipe}/html-entites-encode.pipe.spec.ts +0 -0
  25. package/src/app/{directives → pipe}/html-entities-encode.pipe.ts +0 -0
  26. package/src/app/{directives → pipe}/marked.pipe.spec.ts +0 -0
  27. package/src/app/{directives → pipe}/marked.pipe.ts +0 -0
  28. package/src/app/{directives → pipe}/safe-html.pipe.spec.ts +0 -0
  29. package/src/app/{directives → pipe}/safe-html.pipe.ts +0 -0
  30. package/src/app/providers/events.service.spec.ts +16 -0
  31. package/src/app/providers/events.service.ts +76 -0
  32. package/src/app/providers/global-settings.service.ts +11 -12
  33. package/src/app/utils/globals.ts +3 -0
  34. package/src/app/utils/rules.ts +84 -5
  35. package/src/assets/js/chat21client.js +27 -4
  36. package/src/assets/twp/index.html +5 -5
  37. package/src/chat21-core/models/conversation.ts +2 -2
  38. package/src/chat21-core/models/upload.ts +1 -0
  39. package/src/chat21-core/providers/abstract/presence.service.ts +1 -0
  40. package/src/chat21-core/providers/firebase/firebase-conversation-handler.ts +79 -106
  41. package/src/chat21-core/providers/firebase/firebase-presence.service.ts +4 -0
  42. package/src/chat21-core/providers/mqtt/mqtt-conversation-handler.ts +8 -33
  43. package/src/chat21-core/providers/mqtt/mqtt-presence.service.ts +13 -156
  44. package/src/chat21-core/providers/tiledesk/tiledesk-auth.service.ts +5 -0
  45. package/src/chat21-core/providers/tiledesk/tiledesk-requests.service.ts +21 -4
  46. package/src/chat21-core/utils/utils-message.ts +36 -0
  47. package/src/iframe-style.css +2 -2
  48. package/src/models/project.ts +4 -1
  49. package/src/models/rule.ts +19 -0
@@ -1,3 +1,5 @@
1
+ @import 'src/app/sass/variables';
2
+
1
3
  :host .c21-avatar-image ::ng-deep > chat-avatar-image {
2
4
 
3
5
  .c21-icon-avatar {
@@ -17,32 +19,39 @@
17
19
  }
18
20
 
19
21
  #messagePreview {
20
- position: relative;
21
- width: 320px;
22
- /* bottom: 90; */
23
- max-height: 200px;
24
- height: 100%;
25
- padding: 0px 10px 10px;
26
- background-color: transparent;
27
-
28
- font-family: "Helvetica Neue", "Apple Color Emoji", Helvetica, Arial, sans-serif;
29
- font-size: 100%;
30
- font-style: normal;
31
- letter-spacing: normal;
32
- font-stretch: normal;
33
- font-weight: normal;
34
- text-align: left;
35
- text-align-last: initial;
36
- text-indent: 0px;
37
- text-shadow: none;
38
- text-transform: none;
39
- box-sizing: content-box;
40
- -webkit-font-smoothing: antialiased;
41
- line-height: 1;
42
- font-variant: normal;
43
- }
44
-
45
- #new_message:hover {
22
+ // position: relative;
23
+ // width: 320px;
24
+ // /* bottom: 90; */
25
+ // max-height: 200px;
26
+ // height: 200px; //100%;
27
+ // padding: 0px 10px 10px;
28
+ // background-color: transparent;
29
+
30
+ // font-family: "Helvetica Neue", "Apple Color Emoji", Helvetica, Arial, sans-serif;
31
+ // font-size: 100%;
32
+ // font-style: normal;
33
+ // letter-spacing: normal;
34
+ // font-stretch: normal;
35
+ // font-weight: normal;
36
+ // text-align: left;
37
+ // text-align-last: initial;
38
+ // text-indent: 0px;
39
+ // text-shadow: none;
40
+ // text-transform: none;
41
+ // box-sizing: content-box;
42
+ // -webkit-font-smoothing: antialiased;
43
+ // line-height: 1;
44
+ // font-variant: normal;
45
+
46
+ position: fixed;
47
+ // right: 5px;
48
+ bottom: 90px;
49
+ // max-height: calc(100% - 75px);
50
+ width: 375px;
51
+ max-width: 100%;
52
+ }
53
+
54
+ #messagePreview:hover {
46
55
  .boxButtons {
47
56
  display: block;
48
57
  -webkit-animation: fade-in-dw-up 0.3s ease-in 0.0s;
@@ -50,17 +59,63 @@
50
59
  }
51
60
  }
52
61
 
62
+
63
+ .messages {
64
+ border-radius: $border-radius-bubble-message;
65
+ padding: 0;
66
+ word-wrap: break-word;
67
+
68
+ max-height: 160px;
69
+ display: flex;
70
+ overflow-y: auto;
71
+ // padding: 14px;
72
+ // padding: 6px 6px 6px 6px;
73
+ // box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
74
+ // -webkit-animation: heartbeat 1.5s ease-in-out both;
75
+ // animation: heartbeat 1.5s ease-in-out both;
76
+ &::-webkit-scrollbar {
77
+ width: 6px;
78
+ background-color: #00000000!important;
79
+ }
80
+
81
+ &:hover {
82
+ &::-webkit-scrollbar-track {
83
+ background-color: #f9f9f9 !important;
84
+ }
85
+
86
+ &::-webkit-scrollbar-thumb {
87
+ background: #777777;
88
+ }
89
+
90
+ }
91
+ }
92
+
93
+ .no-background{
94
+ background: transparent!important;
95
+ }
96
+
97
+ .emoticon {
98
+ background-color: transparent!important;
99
+ font-size: 4em;
100
+ margin: -15px 20px -10px 10px;
101
+ .message_innerhtml {
102
+ padding: 0;
103
+ margin: 0;
104
+ }
105
+ }
106
+
107
+
53
108
  .previewNewMessagge {
54
109
  position: relative;
55
110
  box-sizing: border-box;
56
111
  background-color: rgb(255, 255, 255);
57
- box-shadow: rgba(35, 47, 53, 0.09) 0px 2px 8px 0px;
112
+ box-shadow: rgba(0, 18, 46, 0.16) 0px 8px 12px 0px;
58
113
  clear: both;
59
114
  margin-left: 45px;
115
+ margin-right: 16px;
60
116
  margin-bottom: 8px;
61
- border-radius: 5px 5px 5px 0px;
62
- padding: 4;
63
- font-size: 14px;
117
+ border-radius: 12px 12px 12px 0px;
118
+ padding: 5px;
64
119
  }
65
120
 
66
121
  .previewNewMessagge::after {
@@ -77,22 +132,43 @@
77
132
 
78
133
  .c21-text.message_sender_fullname {
79
134
  font-size: 13px;
80
- padding: 0 10;
81
- margin: 4 0;
135
+ padding: 0px 10px;
136
+ margin: 4px 0px;
82
137
  clear: both;
83
138
  color: rgb(104, 104, 104);
84
139
  }
85
140
 
86
141
  .c21-box-text {
87
- max-height: 110;
142
+ max-height: 110px;
143
+ height: 100%;
144
+ width: 100%;
88
145
  overflow-y: auto;
146
+ overflow-x: hidden;
147
+ border-radius: 12px 12px 12px 0px;
148
+
149
+ &::-webkit-scrollbar {
150
+ width: 6px;
151
+ background-color: #00000000!important;
152
+ }
153
+
89
154
  }
90
155
 
156
+ .c21-box-text:hover {
157
+ &::-webkit-scrollbar-track {
158
+ background-color: #f9f9f9 !important;
159
+ }
160
+
161
+ &::-webkit-scrollbar-thumb {
162
+ background: #d3d6dc;
163
+ }
164
+ }
165
+
166
+
91
167
  .c21-text {
92
168
  font-size: 14px;
93
169
  color: black;
94
- padding: 0 10;
95
- margin: 0 0;// margin: 4 0;
170
+ padding: 0px 10px;
171
+ margin: 0px 0px;// margin: 4 0;
96
172
  line-height: 1.4;
97
173
  word-break: break-word;
98
174
  }
@@ -113,7 +189,7 @@
113
189
 
114
190
  .c21-text.c21-time {
115
191
  font-size: 13px;
116
- padding: 0 10;
192
+ padding: 0px 10px;
117
193
  clear: both;
118
194
  color: rgb(115, 115, 118);
119
195
  }
@@ -149,9 +225,10 @@
149
225
  }
150
226
 
151
227
  .headerPreviewMessage {
228
+ margin-right: 16px;
152
229
  position: relative;
153
230
  height: 40;// height: 50;
154
- margin: 10 0 0 50;
231
+ margin: 10px 0px 0px 50px;
155
232
  }
156
233
 
157
234
  .boxButtons {
@@ -192,18 +269,18 @@
192
269
  .buttonClose span {
193
270
  width: 32px;
194
271
  height: 32px;
195
- padding: 0;
272
+ padding: 0px;
196
273
  }
197
274
 
198
275
  .buttonClose span svg {
199
- padding: 6;
276
+ padding: 6px;
200
277
  }
201
278
 
202
279
  #new_message {
203
280
  position: absolute;
204
- left: 0;
205
- right: 10;
206
- bottom: 0;
281
+ left: 0px;
282
+ right: 10px;
283
+ bottom: 0px;
207
284
  }
208
285
 
209
286
  /* ==================== MOBILE VERSION ==================== */
@@ -1,11 +1,11 @@
1
- import { MarkedPipe } from './../../directives/marked.pipe';
1
+ import { MarkedPipe } from './../../pipe/marked.pipe';
2
2
  import { NO_ERRORS_SCHEMA } from '@angular/core';
3
3
  import { async, ComponentFixture, TestBed } from '@angular/core/testing';
4
4
  import { ImageRepoService } from '../../../chat21-core/providers/abstract/image-repo.service';
5
5
  import { Globals } from '../../utils/globals';
6
6
 
7
7
  import { LastMessageComponent } from './last-message.component';
8
- import { HtmlEntitiesEncodePipe } from '../../directives/html-entities-encode.pipe';
8
+ import { HtmlEntitiesEncodePipe } from '../../pipe/html-entities-encode.pipe';
9
9
 
10
10
  describe('LastMessageComponent', () => {
11
11
  let component: LastMessageComponent;
@@ -1,3 +1,6 @@
1
+ import { MessageModel } from './../../../chat21-core/models/message';
2
+ import { UserModel } from './../../../chat21-core/models/user';
3
+ import { EventsService } from './../../providers/events.service';
1
4
  import { Component, OnInit, Output, OnDestroy, AfterViewInit, EventEmitter, Input, SimpleChanges } from '@angular/core';
2
5
  import { Subscription } from 'rxjs';
3
6
  // services
@@ -6,9 +9,9 @@ import { Globals } from 'src/app/utils/globals';
6
9
  // utils
7
10
  import { popupUrl, isPopupUrl, strip_tags } from '../../utils/utils';
8
11
 
9
- import { MAX_WIDTH_IMAGES} from 'src/app/utils/constants';
12
+ import { MIN_WIDTH_IMAGES } from 'src/app/utils/constants';
10
13
  import { ConversationModel } from 'src/chat21-core/models/conversation';
11
- import { isImage } from 'src/chat21-core/utils/utils-message';
14
+ import { conversationToMessage, isEmojii, isImage } from 'src/chat21-core/utils/utils-message';
12
15
  import { ImageRepoService } from 'src/chat21-core/providers/abstract/image-repo.service';
13
16
  import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
14
17
  import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
@@ -30,15 +33,14 @@ export class LastMessageComponent implements OnInit, AfterViewInit, OnDestroy {
30
33
  subscriptions: Subscription[] = []; /** */
31
34
  // ========= end:: sottoscrizioni ======= //
32
35
 
33
- isPopupUrl = isPopupUrl;
34
- popupUrl = popupUrl;
35
- strip_tags = strip_tags;
36
- isImage = isImage;
37
-
36
+ isEmojii = isEmojii;
37
+
38
38
  private logger: LoggerService = LoggerInstance.getInstance();
39
+ public fileSelected: any;
40
+ public message: MessageModel;
39
41
 
40
42
  constructor(
41
- private imageRepoService: ImageRepoService,
43
+ private events: EventsService,
42
44
  public g: Globals,
43
45
  // public conversationsService: ConversationsService
44
46
  ) { }
@@ -54,32 +56,52 @@ export class LastMessageComponent implements OnInit, AfterViewInit, OnDestroy {
54
56
  ngOnChanges(changes: SimpleChanges) {
55
57
  this.logger.debug('[LASTMESSAGE] onChanges', changes)
56
58
  if(this.conversation){
57
- this.conversation.image = this.imageRepoService.getImagePhotoUrl(this.conversation.sender)
59
+ this.message = conversationToMessage(this.conversation, this.g.senderId)
60
+ console.log('messsageeeeeeeee', this.message)
61
+ // if(isImage(this.conversation)){
62
+ // this.fileSelected = Object.assign({}, this.conversation.metadata)
63
+ // this.fileSelected = Object.assign(this.fileSelected, this.getMetadataSize(this.fileSelected))
64
+ // }
58
65
  }
59
66
  }
60
67
 
61
- /**
62
- *
63
- * @param message
64
- */
65
- getMetadataSize(metadata): any {
66
- if(metadata.width === undefined){
67
- metadata.width= MAX_WIDTH_IMAGES
68
- }
69
- if(metadata.height === undefined){
70
- metadata.height = MAX_WIDTH_IMAGES
71
- }
68
+
69
+
70
+ getMetadataSize(metadata): {width, height} {
71
+ const MAX_WIDTH_IMAGES_PREVIEW = 230
72
+ const MAX_HEIGHT_IMAGES_PREIEW = 150
73
+ // if(metadata.width === undefined){
74
+ // metadata.width= MAX_WIDTH_IMAGES_PREVIEW
75
+ // }
76
+ // if(metadata.height === undefined){
77
+ // metadata.height = MAX_HEIGHT_IMAGES_PREIEW
78
+ // }
72
79
  // const MAX_WIDTH_IMAGES = 300;
80
+
73
81
  const sizeImage = {
74
82
  width: metadata.width,
75
83
  height: metadata.height
76
84
  };
77
- // that.g.wdLog(['message::: ', metadata);
78
- if (metadata.width && metadata.width > (MAX_WIDTH_IMAGES)) {
79
- const rapporto = (metadata['width'] / metadata['height']);
80
- sizeImage.width = MAX_WIDTH_IMAGES;
81
- sizeImage.height = (MAX_WIDTH_IMAGES) / rapporto;
85
+
86
+
87
+ // SCALE IN WIDTH --> for horizontal images
88
+ if (metadata.width && metadata.width > MAX_WIDTH_IMAGES_PREVIEW) {
89
+ const ratio = (metadata['width'] / metadata['height']);
90
+ sizeImage.width = metadata.width = MAX_WIDTH_IMAGES_PREVIEW;
91
+ sizeImage.height = metadata.height = MAX_WIDTH_IMAGES_PREVIEW / ratio;
92
+ } else if(metadata.width && metadata.width <= 55){
93
+ const ratio = (metadata['width'] / metadata['height']);
94
+ sizeImage.width = MIN_WIDTH_IMAGES;
95
+ sizeImage.height = MIN_WIDTH_IMAGES / ratio;
82
96
  }
97
+
98
+ // SCALE IN HEIGHT --> for vertical images
99
+ if(metadata.height && metadata.height > MAX_HEIGHT_IMAGES_PREIEW){
100
+ const ratio = (MAX_HEIGHT_IMAGES_PREIEW / metadata['width']);
101
+ sizeImage.width = MAX_HEIGHT_IMAGES_PREIEW / ratio;
102
+ sizeImage.height = MAX_HEIGHT_IMAGES_PREIEW ;
103
+ }
104
+
83
105
  return sizeImage; // h.toString();
84
106
  }
85
107
 
@@ -90,6 +112,8 @@ export class LastMessageComponent implements OnInit, AfterViewInit, OnDestroy {
90
112
  onAttachmentButtonClicked(event: any){
91
113
  // this.onAttachmentButtonClicked.emit(event)
92
114
  this.logger.debug('[LASTMESSAGE] onAttachmentButtonClicked', event)
115
+ this.events.publish('lastMessage:attachmentButtonClicked', event)
116
+ this.openConversationByID(this.conversation);
93
117
  }
94
118
  /** */
95
119
  openConversationByID(conversation) {
@@ -149,7 +149,7 @@ export class ListAllConversationsComponent implements OnInit, OnDestroy, AfterVi
149
149
  }
150
150
 
151
151
  onConversationLoadedFN(conversation: ConversationModel){
152
- this.logger.debug('[LISTALLCONVERSATIONS] onImageLoadedFN', conversation)
152
+ this.logger.debug('[LISTALLCONVERSATIONS] onConversationLoadedFN', conversation)
153
153
  }
154
154
 
155
155
  // private openConversationByID(conversation) {
@@ -80,11 +80,6 @@
80
80
  </div>
81
81
 
82
82
  </div>
83
-
84
- <!-- icon status message -->
85
- <!-- <chat-return-receipt *ngIf="isSender"
86
- [status]="message.status">
87
- </chat-return-receipt> -->
88
83
 
89
84
 
90
85
 
@@ -1,4 +1,4 @@
1
- import { SafeHtmlPipe } from './../../../directives/safe-html.pipe';
1
+ import { SafeHtmlPipe } from './../../../pipe/safe-html.pipe';
2
2
  import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
3
3
 
4
4
  import { HtmlComponent } from './html.component';
@@ -2,7 +2,7 @@ import { CustomLogger } from './../../../../chat21-core/providers/logger/customL
2
2
  import { LoggerInstance } from './../../../../chat21-core/providers/logger/loggerInstance';
3
3
  import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
4
4
  import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
5
- import { MarkedPipe } from '../../../directives/marked.pipe';
5
+ import { MarkedPipe } from '../../../pipe/marked.pipe';
6
6
 
7
7
  import { InfoMessageComponent } from './info-message.component';
8
8
  import { NGXLogger } from 'ngx-logger';
@@ -25,4 +25,8 @@ p {
25
25
  font-variant: normal;
26
26
  font-weight: 300;
27
27
  overflow: hidden;
28
+ }
29
+
30
+ p ::ng-deep a {
31
+ word-break: break-all
28
32
  }
@@ -1,5 +1,5 @@
1
- import { HtmlEntitiesEncodePipe } from './../../../directives/html-entities-encode.pipe';
2
- import { MarkedPipe } from './../../../directives/marked.pipe';
1
+ import { HtmlEntitiesEncodePipe } from './../../../pipe/html-entities-encode.pipe';
2
+ import { MarkedPipe } from './../../../pipe/marked.pipe';
3
3
  import { async, ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
4
4
 
5
5
  import { TextComponent } from './text.component';
@@ -1,7 +1,7 @@
1
1
  <div id="buttons-in-message">
2
2
  <div class="buttons-wrapper">
3
3
 
4
- <span *ngFor="let button of buttons" class="div-button">
4
+ <span *ngFor="let button of buttons | slice:0:limit" class="div-button">
5
5
 
6
6
  <chat-text-button-attachment *ngIf="button.type === 'text' && isLastMessage === true" class="div-button"
7
7
  [button]="button"
@@ -14,6 +14,8 @@ export class MessageAttachmentComponent implements OnInit {
14
14
  @Input() message: MessageModel;
15
15
  @Input() isConversationArchived: boolean;
16
16
  @Input() isLastMessage: boolean;
17
+ @Input() fullscreenMode: boolean;
18
+ @Input() limit: number;
17
19
  @Input() stylesMap: Map<string, string>;
18
20
  @Output() onAttachmentButtonClicked = new EventEmitter<any>();
19
21
  @Output() onElementRendered = new EventEmitter<{element: string, status: boolean}>()
File without changes
File without changes
File without changes
@@ -0,0 +1,16 @@
1
+ import { TestBed } from '@angular/core/testing';
2
+
3
+ import { EventsService } from './events.service';
4
+
5
+ describe('EventsService', () => {
6
+ let service: EventsService;
7
+
8
+ beforeEach(() => {
9
+ TestBed.configureTestingModule({});
10
+ service = TestBed.inject(EventsService);
11
+ });
12
+
13
+ it('should be created', () => {
14
+ expect(service).toBeTruthy();
15
+ });
16
+ });
@@ -0,0 +1,76 @@
1
+ import { Injectable } from '@angular/core';
2
+ export type EventHandler = (...args: any[]) => any;
3
+ @Injectable({
4
+ providedIn: 'root'
5
+ })
6
+ export class EventsService {
7
+ private c = new Map<string, EventHandler[]>();
8
+ constructor() { }
9
+
10
+ /**
11
+ * Subscribe to an event topic. Events that get posted to that topic will trigger the provided handler.
12
+ *
13
+ * @param topic the topic to subscribe to
14
+ * @param handler the event handler
15
+ */
16
+ subscribe(topic: string, ...handlers: EventHandler[]) {
17
+ let topics = this.c.get(topic);
18
+ if (!topics) {
19
+ this.c.set(topic, topics = []);
20
+ }
21
+ topics.push(...handlers);
22
+ }
23
+
24
+ /**
25
+ * Unsubscribe from the given topic. Your handler will no longer receive events published to this topic.
26
+ *
27
+ * @param topic the topic to unsubscribe from
28
+ * @param handler the event handler
29
+ *
30
+ * @return true if a handler was removed
31
+ */
32
+ unsubscribe(topic: string, handler?: EventHandler): boolean {
33
+ if (!handler) {
34
+ return this.c.delete(topic);
35
+ }
36
+
37
+ const topics = this.c.get(topic);
38
+ if (!topics) {
39
+ return false;
40
+ }
41
+
42
+ // We need to find and remove a specific handler
43
+ const index = topics.indexOf(handler);
44
+
45
+ if (index < 0) {
46
+ // Wasn't found, wasn't removed
47
+ return false;
48
+ }
49
+ topics.splice(index, 1);
50
+ if (topics.length === 0) {
51
+ this.c.delete(topic);
52
+ }
53
+ return true;
54
+ }
55
+
56
+ /**
57
+ * Publish an event to the given topic.
58
+ *
59
+ * @param topic the topic to publish to
60
+ * @param eventData the data to send as the event
61
+ */
62
+ publish(topic: string, ...args: any[]): any[] | null {
63
+ const topics = this.c.get(topic);
64
+ if (!topics) {
65
+ return null;
66
+ }
67
+ return topics.map(handler => {
68
+ try {
69
+ return handler(...args);
70
+ } catch (e) {
71
+ console.error(e);
72
+ return null;
73
+ }
74
+ });
75
+ }
76
+ }
@@ -408,12 +408,17 @@ export class GlobalSettingsService {
408
408
  this.logger.error('[GLOBAL-SET] setVariablesFromService > Error is departments: ', error);
409
409
  }
410
410
 
411
- // DEPARTMENTS
412
- // if (response && response.departments !== null) {
413
- // this.logger.debug('[GLOBAL-SET] response DEP ::::', response.departments);
414
- // // globals.setParameter('departments', response.departments);
415
- // this.initDepartments(response.departments);
416
- // }
411
+ // BOTS_RULES
412
+ try{
413
+ const botsRules = response.botsRules
414
+ if (typeof botsRules !== 'undefined') {
415
+ this.logger.debug('[GLOBAL-SET] setVariablesFromService > botsRules ::::', botsRules);
416
+ this.globals.botsRules = botsRules
417
+ }
418
+ }catch(error){
419
+ this.logger.error('[GLOBAL-SET] setVariablesFromService > Error is botsRules: ', error);
420
+ }
421
+
417
422
 
418
423
  // AVAILABLE AGENTS
419
424
  try {
@@ -427,12 +432,6 @@ export class GlobalSettingsService {
427
432
  this.logger.error('[GLOBAL-SET] setVariablesFromService > Error is departments: ', error);
428
433
  }
429
434
 
430
- // AVAILABLE AGENTS
431
- // if (response && response.user_available !== null) {
432
- // //this.logger.error('[GLOBAL-SET] setVariablesFromService > user_available ::::', response.user_available);
433
- // this.setAvailableAgentsStatus(response.user_available);
434
- // }
435
-
436
435
  // WIDGET
437
436
  try {
438
437
  const variables = response.project.widget;
@@ -14,6 +14,7 @@ import { DepartmentModel } from 'src/models/department';
14
14
  import { avatarPlaceholder, detectIfIsMobile, getParameterByName, setColorFromString } from 'src/app/utils/utils';
15
15
  import { ConversationModel } from 'src/chat21-core/models/conversation';
16
16
  import { convertColorToRGBA } from 'src/chat21-core/utils/utils';
17
+ import { Rule } from 'src/models/rule';
17
18
 
18
19
  @Injectable({
19
20
  providedIn: 'root'
@@ -64,6 +65,8 @@ export class Globals {
64
65
  isOpenMenuOptions: boolean;
65
66
  isOpenPrechatForm: boolean;
66
67
 
68
+ botsRules: Rule[];
69
+
67
70
  // areAgentsAvailable = false;
68
71
  areAgentsAvailableText: string;
69
72
  availableAgentsStatus = false; // indica quando è impostato lo stato degli agenti nel subscribe