@chat21/chat21-web-widget 5.0.53-rc.4 → 5.0.53
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 +3 -14
- package/package.json +1 -1
- package/src/app/app.component.ts +8 -18
- package/src/app/app.module.ts +8 -10
- package/src/app/component/conversation-detail/conversation/conversation.component.ts +1 -15
- package/src/app/component/conversation-detail/conversation-content/conversation-content.component.spec.ts +2 -2
- package/src/app/component/last-message/last-message.component.html +72 -83
- package/src/app/component/last-message/last-message.component.scss +42 -98
- package/src/app/component/last-message/last-message.component.spec.ts +2 -2
- package/src/app/component/last-message/last-message.component.ts +25 -49
- package/src/app/component/list-all-conversations/list-all-conversations.component.ts +1 -1
- package/src/app/component/message/bubble-message/bubble-message.component.html +5 -0
- package/src/app/component/message/html/html.component.spec.ts +1 -1
- package/src/app/component/message/info-message/info-message.component.spec.ts +1 -1
- package/src/app/component/message/text/text.component.scss +0 -4
- package/src/app/component/message/text/text.component.spec.ts +2 -2
- package/src/app/component/message-attachment/message-attachment.component.html +1 -1
- package/src/app/component/message-attachment/message-attachment.component.ts +0 -2
- package/src/app/{pipe → directives}/html-entites-encode.pipe.spec.ts +0 -0
- package/src/app/{pipe → directives}/html-entities-encode.pipe.ts +0 -0
- package/src/app/{pipe → directives}/marked.pipe.spec.ts +0 -0
- package/src/app/{pipe → directives}/marked.pipe.ts +0 -0
- package/src/app/{pipe → directives}/safe-html.pipe.spec.ts +0 -0
- package/src/app/{pipe → directives}/safe-html.pipe.ts +0 -0
- package/src/app/providers/global-settings.service.ts +12 -11
- package/src/app/utils/globals.ts +0 -3
- package/src/app/utils/rules.ts +5 -88
- package/src/assets/js/chat21client.js +4 -27
- package/src/assets/twp/index-dev.html +1 -1
- package/src/assets/twp/index.html +1 -1
- package/src/chat21-core/models/conversation.ts +2 -2
- package/src/chat21-core/models/upload.ts +0 -1
- package/src/chat21-core/providers/abstract/presence.service.ts +0 -1
- package/src/chat21-core/providers/firebase/firebase-conversation-handler.ts +106 -78
- package/src/chat21-core/providers/firebase/firebase-presence.service.ts +0 -4
- package/src/chat21-core/providers/mqtt/mqtt-conversation-handler.ts +29 -2
- package/src/chat21-core/providers/mqtt/mqtt-presence.service.ts +156 -13
- package/src/chat21-core/providers/tiledesk/tiledesk-requests.service.ts +4 -21
- package/src/chat21-core/utils/utils-message.ts +0 -36
- package/src/iframe-style.css +2 -2
- package/src/models/project.ts +1 -4
- package/src/app/providers/events.service.spec.ts +0 -16
- package/src/app/providers/events.service.ts +0 -76
- package/src/launch_old.js +0 -446
- package/src/models/rule.ts +0 -18
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { MessageModel } from './../../../chat21-core/models/message';
|
|
2
|
-
import { UserModel } from './../../../chat21-core/models/user';
|
|
3
|
-
import { EventsService } from './../../providers/events.service';
|
|
4
1
|
import { Component, OnInit, Output, OnDestroy, AfterViewInit, EventEmitter, Input, SimpleChanges } from '@angular/core';
|
|
5
2
|
import { Subscription } from 'rxjs';
|
|
6
3
|
// services
|
|
@@ -9,9 +6,9 @@ import { Globals } from 'src/app/utils/globals';
|
|
|
9
6
|
// utils
|
|
10
7
|
import { popupUrl, isPopupUrl, strip_tags } from '../../utils/utils';
|
|
11
8
|
|
|
12
|
-
import {
|
|
9
|
+
import { MAX_WIDTH_IMAGES} from 'src/app/utils/constants';
|
|
13
10
|
import { ConversationModel } from 'src/chat21-core/models/conversation';
|
|
14
|
-
import {
|
|
11
|
+
import { isImage } from 'src/chat21-core/utils/utils-message';
|
|
15
12
|
import { ImageRepoService } from 'src/chat21-core/providers/abstract/image-repo.service';
|
|
16
13
|
import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
|
|
17
14
|
import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
|
|
@@ -33,14 +30,15 @@ export class LastMessageComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
33
30
|
subscriptions: Subscription[] = []; /** */
|
|
34
31
|
// ========= end:: sottoscrizioni ======= //
|
|
35
32
|
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
isPopupUrl = isPopupUrl;
|
|
34
|
+
popupUrl = popupUrl;
|
|
35
|
+
strip_tags = strip_tags;
|
|
36
|
+
isImage = isImage;
|
|
37
|
+
|
|
38
38
|
private logger: LoggerService = LoggerInstance.getInstance();
|
|
39
|
-
public fileSelected: any;
|
|
40
|
-
public message: MessageModel;
|
|
41
39
|
|
|
42
40
|
constructor(
|
|
43
|
-
private
|
|
41
|
+
private imageRepoService: ImageRepoService,
|
|
44
42
|
public g: Globals,
|
|
45
43
|
// public conversationsService: ConversationsService
|
|
46
44
|
) { }
|
|
@@ -56,52 +54,32 @@ export class LastMessageComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
56
54
|
ngOnChanges(changes: SimpleChanges) {
|
|
57
55
|
this.logger.debug('[LASTMESSAGE] onChanges', changes)
|
|
58
56
|
if(this.conversation){
|
|
59
|
-
this.
|
|
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
|
-
// }
|
|
57
|
+
this.conversation.image = this.imageRepoService.getImagePhotoUrl(this.conversation.sender)
|
|
65
58
|
}
|
|
66
59
|
}
|
|
67
60
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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
|
+
}
|
|
79
72
|
// const MAX_WIDTH_IMAGES = 300;
|
|
80
|
-
|
|
81
73
|
const sizeImage = {
|
|
82
74
|
width: metadata.width,
|
|
83
75
|
height: metadata.height
|
|
84
76
|
};
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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;
|
|
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;
|
|
96
82
|
}
|
|
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
|
-
|
|
105
83
|
return sizeImage; // h.toString();
|
|
106
84
|
}
|
|
107
85
|
|
|
@@ -112,8 +90,6 @@ export class LastMessageComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
112
90
|
onAttachmentButtonClicked(event: any){
|
|
113
91
|
// this.onAttachmentButtonClicked.emit(event)
|
|
114
92
|
this.logger.debug('[LASTMESSAGE] onAttachmentButtonClicked', event)
|
|
115
|
-
this.events.publish('lastMessage:attachmentButtonClicked', event)
|
|
116
|
-
this.openConversationByID(this.conversation);
|
|
117
93
|
}
|
|
118
94
|
/** */
|
|
119
95
|
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]
|
|
152
|
+
this.logger.debug('[LISTALLCONVERSATIONS] onImageLoadedFN', conversation)
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
// private openConversationByID(conversation) {
|
|
@@ -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 '../../../
|
|
5
|
+
import { MarkedPipe } from '../../../directives/marked.pipe';
|
|
6
6
|
|
|
7
7
|
import { InfoMessageComponent } from './info-message.component';
|
|
8
8
|
import { NGXLogger } from 'ngx-logger';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { HtmlEntitiesEncodePipe } from './../../../
|
|
2
|
-
import { MarkedPipe } from './../../../
|
|
1
|
+
import { HtmlEntitiesEncodePipe } from './../../../directives/html-entities-encode.pipe';
|
|
2
|
+
import { MarkedPipe } from './../../../directives/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
|
|
4
|
+
<span *ngFor="let button of buttons" 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,8 +14,6 @@ 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;
|
|
19
17
|
@Input() stylesMap: Map<string, string>;
|
|
20
18
|
@Output() onAttachmentButtonClicked = new EventEmitter<any>();
|
|
21
19
|
@Output() onElementRendered = new EventEmitter<{element: string, status: boolean}>()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -408,17 +408,12 @@ export class GlobalSettingsService {
|
|
|
408
408
|
this.logger.error('[GLOBAL-SET] setVariablesFromService > Error is departments: ', error);
|
|
409
409
|
}
|
|
410
410
|
|
|
411
|
-
//
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
}
|
|
418
|
-
}catch(error){
|
|
419
|
-
this.logger.error('[GLOBAL-SET] setVariablesFromService > Error is botsRules: ', error);
|
|
420
|
-
}
|
|
421
|
-
|
|
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
|
+
// }
|
|
422
417
|
|
|
423
418
|
// AVAILABLE AGENTS
|
|
424
419
|
try {
|
|
@@ -432,6 +427,12 @@ export class GlobalSettingsService {
|
|
|
432
427
|
this.logger.error('[GLOBAL-SET] setVariablesFromService > Error is departments: ', error);
|
|
433
428
|
}
|
|
434
429
|
|
|
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
|
+
|
|
435
436
|
// WIDGET
|
|
436
437
|
try {
|
|
437
438
|
const variables = response.project.widget;
|
package/src/app/utils/globals.ts
CHANGED
|
@@ -14,7 +14,6 @@ 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';
|
|
18
17
|
|
|
19
18
|
@Injectable({
|
|
20
19
|
providedIn: 'root'
|
|
@@ -65,8 +64,6 @@ export class Globals {
|
|
|
65
64
|
isOpenMenuOptions: boolean;
|
|
66
65
|
isOpenPrechatForm: boolean;
|
|
67
66
|
|
|
68
|
-
botsRules: Rule[];
|
|
69
|
-
|
|
70
67
|
// areAgentsAvailable = false;
|
|
71
68
|
areAgentsAvailableText: string;
|
|
72
69
|
availableAgentsStatus = false; // indica quando è impostato lo stato degli agenti nel subscribe
|
package/src/app/utils/rules.ts
CHANGED
|
@@ -1,96 +1,13 @@
|
|
|
1
|
-
import { AppStorageService } from 'src/chat21-core/providers/abstract/app-storage.service';
|
|
2
|
-
import { Globals } from './globals';
|
|
3
|
-
import { UserModel } from './../../chat21-core/models/user';
|
|
4
1
|
import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
|
|
5
2
|
import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
|
|
6
|
-
import { TiledeskAuthService } from 'src/chat21-core/providers/tiledesk/tiledesk-auth.service';
|
|
7
|
-
import { TiledeskRequestsService } from 'src/chat21-core/providers/tiledesk/tiledesk-requests.service';
|
|
8
|
-
import { Inject, Injectable } from '@angular/core';
|
|
9
|
-
import { IRules, Rule } from 'src/models/rule';
|
|
10
|
-
import { getDateDifference } from 'src/chat21-core/utils/utils';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
@Injectable({
|
|
14
|
-
providedIn: 'root'
|
|
15
|
-
})
|
|
16
3
|
export class Rules {
|
|
17
4
|
|
|
18
|
-
private
|
|
19
|
-
private tiledeskToken: string;
|
|
20
|
-
private currentUser: UserModel;
|
|
21
|
-
private request_id: string;
|
|
22
|
-
private rules: Rule[]
|
|
23
|
-
private logger: LoggerService = LoggerInstance.getInstance()
|
|
24
|
-
constructor(
|
|
25
|
-
private tiledeskRequestsService: TiledeskRequestsService,
|
|
26
|
-
private appStorageService: AppStorageService,
|
|
27
|
-
private g: Globals
|
|
28
|
-
){}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
initRules(context: Window, tiledeskToken: string, currentUser: UserModel, request_id: string, rules:Rule[]){
|
|
32
|
-
this.logger.info('[RULES] initRules',context, currentUser, rules)
|
|
33
|
-
this.windowContext = context
|
|
34
|
-
this.tiledeskToken = tiledeskToken
|
|
35
|
-
this.currentUser = currentUser
|
|
36
|
-
this.request_id = request_id
|
|
37
|
-
this.rules = rules
|
|
38
|
-
this.checkRules()
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
checkRules(){
|
|
42
|
-
this.rules.forEach((rule, index)=>{
|
|
43
|
-
if(rule.when && new RegExp(rule.when.urlMatches).test(this.windowContext.location.href)){
|
|
44
|
-
if(this.checkIfAlreadyDone(rule)){
|
|
45
|
-
this.doAction(rule.do)
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
})
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
private doAction(action: Rule['do']){
|
|
54
|
-
this.logger.info('[RULES] doAction', this.currentUser, action)
|
|
55
|
-
let message = action.filter(obj => Object.keys(obj).includes('message'))
|
|
56
|
-
let wait = action.filter(obj => Object.keys(obj).includes('wait'))
|
|
57
|
-
if(message && message.length>0){
|
|
58
|
-
message[0]['message'].attributes = { ...this.g.attributes, ...message[0]['message'].attributes}
|
|
59
|
-
message[0]['message'].userAgent = this.g.attributes['client']
|
|
60
|
-
message[0]['message'].request_id = this.request_id
|
|
61
|
-
message[0]['message'].sourcePage = this.g.attributes['sourcePage']
|
|
62
|
-
message[0]['message'].language = this.g.lang
|
|
63
|
-
message[0]['message'].departmentid = this.g.attributes.departmentId
|
|
64
|
-
console.log('message[0]', message[0]['message'])
|
|
65
|
-
setTimeout(() => {
|
|
66
|
-
this.tiledeskRequestsService.sendMessageToRequest(this.request_id, this.tiledeskToken, message[0]['message'])
|
|
67
|
-
console.log('rulessss', this.appStorageService.getItem('_botsRules'))
|
|
68
|
-
}, wait[0]['wait']);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
5
|
+
private url = window.location
|
|
71
6
|
|
|
7
|
+
private logger: LoggerService = LoggerInstance.getInstance()
|
|
8
|
+
constructor(){}
|
|
72
9
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
let canHandleAction: boolean = false
|
|
76
|
-
if(storedRules && storedRules.hasOwnProperty(rule.uid)){
|
|
77
|
-
let timeDifference = getDateDifference(storedRules[rule.uid], Date.now())
|
|
78
|
-
if(timeDifference.hours > rule.when.triggerEvery){
|
|
79
|
-
storedRules[rule.uid]= Date.now()
|
|
80
|
-
canHandleAction = true
|
|
81
|
-
}else{
|
|
82
|
-
canHandleAction = false
|
|
83
|
-
}
|
|
84
|
-
}else{
|
|
85
|
-
canHandleAction = true
|
|
86
|
-
storedRules[rule.uid]= Date.now()
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
this.appStorageService.setItem('_rules', JSON.stringify(storedRules))
|
|
90
|
-
return canHandleAction
|
|
10
|
+
initRules(){
|
|
11
|
+
console.log('locationnnnnnn', this.url)
|
|
91
12
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
13
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
Chat21Client
|
|
3
3
|
|
|
4
|
-
v0.1.12.
|
|
4
|
+
v0.1.12.3
|
|
5
5
|
|
|
6
6
|
@Author Andrea Sponziello
|
|
7
7
|
(c) Tiledesk 2020
|
|
@@ -966,7 +966,7 @@ class Chat21Client {
|
|
|
966
966
|
if (this.client) {
|
|
967
967
|
this.client.end()
|
|
968
968
|
}
|
|
969
|
-
|
|
969
|
+
const presence_topic = 'apps/tilechat/users/' + this.user_id + '/presence/' + this.client_id
|
|
970
970
|
let options = {
|
|
971
971
|
keepalive: 10,
|
|
972
972
|
// protocolId: 'MQTT',
|
|
@@ -975,7 +975,7 @@ class Chat21Client {
|
|
|
975
975
|
reconnectPeriod: 1000,
|
|
976
976
|
// connectTimeout: 30 * 1000,
|
|
977
977
|
will: {
|
|
978
|
-
topic:
|
|
978
|
+
topic: presence_topic,
|
|
979
979
|
payload: '{"disconnected":true}',
|
|
980
980
|
qos: 1,
|
|
981
981
|
retain: true
|
|
@@ -985,7 +985,7 @@ class Chat21Client {
|
|
|
985
985
|
password: jwt,
|
|
986
986
|
rejectUnauthorized: false
|
|
987
987
|
}
|
|
988
|
-
if (this.log) {console.log("starting mqtt connection with LWT on:",
|
|
988
|
+
if (this.log) {console.log("starting mqtt connection with LWT on:", presence_topic, this.endpoint)}
|
|
989
989
|
// client = mqtt.connect('mqtt://127.0.0.1:15675/ws',options)
|
|
990
990
|
this.client = mqtt.connect(this.endpoint,options)
|
|
991
991
|
|
|
@@ -999,15 +999,6 @@ class Chat21Client {
|
|
|
999
999
|
callback();
|
|
1000
1000
|
});
|
|
1001
1001
|
}
|
|
1002
|
-
this.client.publish(
|
|
1003
|
-
this.presence_topic,
|
|
1004
|
-
JSON.stringify({connected: true}),
|
|
1005
|
-
null, (err) => {
|
|
1006
|
-
if (err) {
|
|
1007
|
-
console.error("Error con presence publish:", err);
|
|
1008
|
-
}
|
|
1009
|
-
}
|
|
1010
|
-
);
|
|
1011
1002
|
}
|
|
1012
1003
|
);
|
|
1013
1004
|
this.client.on('reconnect',
|
|
@@ -1032,20 +1023,6 @@ class Chat21Client {
|
|
|
1032
1023
|
);
|
|
1033
1024
|
}
|
|
1034
1025
|
|
|
1035
|
-
ImHere() {
|
|
1036
|
-
if (this.client) {
|
|
1037
|
-
this.client.publish(
|
|
1038
|
-
this.presence_topic,
|
|
1039
|
-
JSON.stringify({connected: true}),
|
|
1040
|
-
null, (err) => {
|
|
1041
|
-
if (err) {
|
|
1042
|
-
console.error("Error on presence publish:", err);
|
|
1043
|
-
}
|
|
1044
|
-
}
|
|
1045
|
-
);
|
|
1046
|
-
}
|
|
1047
|
-
}
|
|
1048
|
-
|
|
1049
1026
|
close(callback) {
|
|
1050
1027
|
if (this.topic_inbox) {
|
|
1051
1028
|
this.client.unsubscribe(this.topic_inbox, (err) => {
|
|
@@ -437,7 +437,7 @@
|
|
|
437
437
|
|
|
438
438
|
var enbedJs = event_data.detail.appConfigs.enbedJs? event_data.detail.appConfigs.enbedJs : false;
|
|
439
439
|
document.getElementById("enbed").style.display = enbedJs? "inline-block": "none";
|
|
440
|
-
document.getElementById("base_url").innerHTML = enbedJs ?
|
|
440
|
+
document.getElementById("base_url").innerHTML = enbedJs ? window.tiledesk.getBaseLocation() + '/launch.js': null;
|
|
441
441
|
|
|
442
442
|
baseUrlConsole = event_data.detail.appConfigs.dashboardUrl? event_data.detail.appConfigs.dashboardUrl : baseUrlConsole;
|
|
443
443
|
}
|
|
@@ -282,7 +282,7 @@
|
|
|
282
282
|
|
|
283
283
|
var enbedJs = event_data.detail.appConfigs.enbedJs? event_data.detail.appConfigs.enbedJs : false;
|
|
284
284
|
document.getElementById("enbed").style.display = enbedJs? "inline-block": "none";
|
|
285
|
-
document.getElementById("base_url").innerHTML = enbedJs ?
|
|
285
|
+
document.getElementById("base_url").innerHTML = enbedJs ? window.tiledesk.getBaseLocation() + '/launch.js': null;
|
|
286
286
|
|
|
287
287
|
baseUrlConsole = event_data.detail.appConfigs.dashboardUrl? event_data.detail.appConfigs.dashboardUrl : baseUrlConsole;
|
|
288
288
|
}
|
|
@@ -31,6 +31,5 @@ export abstract class PresenceService {
|
|
|
31
31
|
abstract userIsOnline(userid: string): Observable<any>
|
|
32
32
|
abstract lastOnlineForUser(userid: string): void;
|
|
33
33
|
abstract setPresence(userid: string): void;
|
|
34
|
-
abstract imHere():void;
|
|
35
34
|
abstract removePresence(): void;
|
|
36
35
|
}
|