@chat21/chat21-web-widget 5.0.53-rc.2 → 5.0.53-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.
Files changed (55) hide show
  1. package/CHANGELOG.md +23 -1
  2. package/angular.json +3 -4
  3. package/karma.conf.js +1 -0
  4. package/package.json +5 -5
  5. package/src/app/app-routing.module.ts +1 -1
  6. package/src/app/app.component.ts +18 -8
  7. package/src/app/app.module.ts +10 -8
  8. package/src/app/component/conversation-detail/conversation/conversation.component.ts +15 -1
  9. package/src/app/component/conversation-detail/conversation-content/conversation-content.component.spec.ts +2 -2
  10. package/src/app/component/last-message/last-message.component.html +83 -72
  11. package/src/app/component/last-message/last-message.component.scss +98 -42
  12. package/src/app/component/last-message/last-message.component.spec.ts +2 -2
  13. package/src/app/component/last-message/last-message.component.ts +49 -25
  14. package/src/app/component/list-all-conversations/list-all-conversations.component.ts +1 -1
  15. package/src/app/component/message/bubble-message/bubble-message.component.html +0 -5
  16. package/src/app/component/message/html/html.component.spec.ts +1 -1
  17. package/src/app/component/message/info-message/info-message.component.spec.ts +1 -1
  18. package/src/app/component/message/text/text.component.scss +4 -0
  19. package/src/app/component/message/text/text.component.spec.ts +2 -2
  20. package/src/app/component/message-attachment/message-attachment.component.html +1 -1
  21. package/src/app/component/message-attachment/message-attachment.component.ts +2 -0
  22. package/src/app/{directives → pipe}/html-entites-encode.pipe.spec.ts +0 -0
  23. package/src/app/{directives → pipe}/html-entities-encode.pipe.ts +0 -0
  24. package/src/app/{directives → pipe}/marked.pipe.spec.ts +0 -0
  25. package/src/app/{directives → pipe}/marked.pipe.ts +0 -0
  26. package/src/app/{directives → pipe}/safe-html.pipe.spec.ts +0 -0
  27. package/src/app/{directives → pipe}/safe-html.pipe.ts +0 -0
  28. package/src/app/providers/events.service.spec.ts +16 -0
  29. package/src/app/providers/events.service.ts +76 -0
  30. package/src/app/providers/global-settings.service.ts +11 -12
  31. package/src/app/utils/globals.ts +4 -1
  32. package/src/app/utils/rules.ts +88 -5
  33. package/src/assets/js/chat21client.js +27 -4
  34. package/src/assets/twp/chatbot-panel.html +0 -5
  35. package/src/assets/twp/index-dev.html +3 -3
  36. package/src/assets/twp/index.html +4 -4
  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/notifications.service.ts +1 -1
  40. package/src/chat21-core/providers/abstract/presence.service.ts +1 -0
  41. package/src/chat21-core/providers/firebase/firebase-conversation-handler.ts +78 -106
  42. package/src/chat21-core/providers/firebase/firebase-notifications.ts +1 -1
  43. package/src/chat21-core/providers/firebase/firebase-presence.service.ts +4 -0
  44. package/src/chat21-core/providers/mqtt/mqtt-conversation-handler.ts +2 -29
  45. package/src/chat21-core/providers/mqtt/mqtt-notifications.ts +1 -1
  46. package/src/chat21-core/providers/mqtt/mqtt-presence.service.ts +13 -156
  47. package/src/chat21-core/providers/tiledesk/tiledesk-requests.service.ts +21 -4
  48. package/src/chat21-core/utils/utils-message.ts +36 -0
  49. package/src/iframe-style.css +2 -2
  50. package/src/launch.js +10 -6
  51. package/src/launch_old.js +446 -0
  52. package/src/main.ts +1 -0
  53. package/src/models/project.ts +4 -1
  54. package/src/models/rule.ts +18 -0
  55. package/src/base_script.html +0 -57
@@ -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,43 @@
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
+ // padding: 14px;
68
+ // padding: 6px 6px 6px 6px;
69
+ // box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
70
+ // -webkit-animation: heartbeat 1.5s ease-in-out both;
71
+ // animation: heartbeat 1.5s ease-in-out both;
72
+ }
73
+
74
+ .no-background{
75
+ background: transparent!important;
76
+ }
77
+
78
+ .emoticon {
79
+ background-color: transparent!important;
80
+ font-size: 4em;
81
+ margin: -15px 20px -10px 10px;
82
+ .message_innerhtml {
83
+ padding: 0;
84
+ margin: 0;
85
+ }
86
+ }
87
+
88
+
53
89
  .previewNewMessagge {
54
90
  position: relative;
55
91
  box-sizing: border-box;
56
92
  background-color: rgb(255, 255, 255);
57
- box-shadow: rgba(35, 47, 53, 0.09) 0px 2px 8px 0px;
93
+ box-shadow: rgba(0, 18, 46, 0.16) 0px 8px 12px 0px;
58
94
  clear: both;
59
95
  margin-left: 45px;
60
96
  margin-bottom: 8px;
61
- border-radius: 5px 5px 5px 0px;
62
- padding: 4;
63
- font-size: 14px;
97
+ border-radius: 12px 12px 12px 0px;
98
+ padding: 5px;
64
99
  }
65
100
 
66
101
  .previewNewMessagge::after {
@@ -77,22 +112,43 @@
77
112
 
78
113
  .c21-text.message_sender_fullname {
79
114
  font-size: 13px;
80
- padding: 0 10;
81
- margin: 4 0;
115
+ padding: 0px 10px;
116
+ margin: 4px 0px;
82
117
  clear: both;
83
118
  color: rgb(104, 104, 104);
84
119
  }
85
120
 
86
121
  .c21-box-text {
87
- max-height: 110;
122
+ max-height: 110px;
123
+ height: 100%;
124
+ width: 100%;
88
125
  overflow-y: auto;
126
+ overflow-x: hidden;
127
+ border-radius: 12px 12px 12px 0px;
128
+
129
+ &::-webkit-scrollbar {
130
+ width: 6px;
131
+ background-color: #00000000!important;
132
+ }
133
+
89
134
  }
90
135
 
136
+ .c21-box-text:hover {
137
+ &::-webkit-scrollbar-track {
138
+ background-color: #f9f9f9 !important;
139
+ }
140
+
141
+ &::-webkit-scrollbar-thumb {
142
+ background: #d3d6dc;
143
+ }
144
+ }
145
+
146
+
91
147
  .c21-text {
92
148
  font-size: 14px;
93
149
  color: black;
94
- padding: 0 10;
95
- margin: 0 0;// margin: 4 0;
150
+ padding: 0px 10px;
151
+ margin: 0px 0px;// margin: 4 0;
96
152
  line-height: 1.4;
97
153
  word-break: break-word;
98
154
  }
@@ -113,7 +169,7 @@
113
169
 
114
170
  .c21-text.c21-time {
115
171
  font-size: 13px;
116
- padding: 0 10;
172
+ padding: 0px 10px;
117
173
  clear: both;
118
174
  color: rgb(115, 115, 118);
119
175
  }
@@ -151,7 +207,7 @@
151
207
  .headerPreviewMessage {
152
208
  position: relative;
153
209
  height: 40;// height: 50;
154
- margin: 10 0 0 50;
210
+ margin: 10px 0px 0px 50px;
155
211
  }
156
212
 
157
213
  .boxButtons {
@@ -192,18 +248,18 @@
192
248
  .buttonClose span {
193
249
  width: 32px;
194
250
  height: 32px;
195
- padding: 0;
251
+ padding: 0px;
196
252
  }
197
253
 
198
254
  .buttonClose span svg {
199
- padding: 6;
255
+ padding: 6px;
200
256
  }
201
257
 
202
258
  #new_message {
203
259
  position: absolute;
204
- left: 0;
205
- right: 10;
206
- bottom: 0;
260
+ left: 0px;
261
+ right: 10px;
262
+ bottom: 0px;
207
263
  }
208
264
 
209
265
  /* ==================== 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'
@@ -24,7 +25,7 @@ export class Globals {
24
25
  obsIsOpen = new BehaviorSubject<boolean>(null);
25
26
 
26
27
  BASE_LOCATION = 'https://widget.tiledesk.com/v2';
27
- POWERED_BY ='<a tabindex="-1" target="_blank" href="http://www.tiledesk.com/"><img src="https://support-pre.tiledesk.com/dashboard/assets/img/logos/tiledesk-logo_new_gray.svg"/></a>'
28
+ POWERED_BY ='<a tabindex="-1" target="_blank" href="http://www.tiledesk.com/?utm_source=widget"><img src="https://support-pre.tiledesk.com/dashboard/assets/img/logos/tiledesk-logo_new_gray.svg"/></a>'
28
29
  DEFAULT_LOGO_CHAT = '/assets/images/tiledesk_logo_white_small.svg';
29
30
  WIDGET_TITLE = 'Tiledesk';
30
31
 
@@ -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