@chat21/chat21-ionic 3.0.83 → 3.0.86-rc.1
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 +124 -4
- package/README.md +2 -2
- package/deploy_amazon_beta.sh +29 -0
- package/deploy_amazon_prod.sh +30 -0
- package/package.json +4 -3
- package/src/app/app-routing.module.ts +7 -2
- package/src/app/app.component.html +7 -1
- package/src/app/app.component.scss +20 -2
- package/src/app/app.component.ts +231 -114
- package/src/app/app.module.ts +8 -3
- package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.ts +8 -1
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.html +86 -23
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.scss +188 -88
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.ts +42 -3
- package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.html +11 -24
- package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.scss +6 -10
- package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.spec.ts +2 -2
- package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.ts +16 -26
- package/src/app/chatlib/conversation-detail/message/buttons/action-button/action-button.component.html +5 -1
- package/src/app/chatlib/conversation-detail/message/buttons/action-button/action-button.component.scss +22 -15
- package/src/app/chatlib/conversation-detail/message/buttons/action-button/action-button.component.ts +25 -5
- package/src/app/chatlib/conversation-detail/message/buttons/link-button/link-button.component.html +2 -1
- package/src/app/chatlib/conversation-detail/message/buttons/link-button/link-button.component.scss +14 -15
- package/src/app/chatlib/conversation-detail/message/buttons/link-button/link-button.component.ts +24 -5
- package/src/app/chatlib/conversation-detail/message/buttons/text-button/text-button.component.html +6 -1
- package/src/app/chatlib/conversation-detail/message/buttons/text-button/text-button.component.scss +12 -13
- package/src/app/chatlib/conversation-detail/message/buttons/text-button/text-button.component.ts +26 -5
- package/src/app/chatlib/conversation-detail/message/frame/frame.component.html +8 -2
- package/src/app/chatlib/conversation-detail/message/frame/frame.component.scss +36 -0
- package/src/app/chatlib/conversation-detail/message/frame/frame.component.ts +2 -2
- package/src/app/chatlib/conversation-detail/message/html/html.component.ts +0 -1
- package/src/app/chatlib/conversation-detail/message/image/image.component.html +3 -2
- package/src/app/chatlib/conversation-detail/message/image/image.component.scss +17 -5
- package/src/app/chatlib/conversation-detail/message/image/image.component.ts +1 -1
- package/src/app/chatlib/conversation-detail/message/info-message/info-message.component.scss +3 -2
- package/src/app/chatlib/conversation-detail/message/message-attachment/message-attachment.component.html +16 -6
- package/src/app/chatlib/conversation-detail/message/message-attachment/message-attachment.component.scss +1 -3
- package/src/app/chatlib/conversation-detail/message/message-attachment/message-attachment.component.ts +2 -0
- package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.html +78 -52
- package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.scss +63 -20
- package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.ts +14 -10
- package/src/app/components/canned-response/canned-response.component.html +9 -9
- package/src/app/components/canned-response/canned-response.component.scss +14 -7
- package/src/app/components/canned-response/canned-response.component.ts +5 -4
- package/src/app/components/contacts-directory/contacts-directory.component.html +22 -26
- package/src/app/components/contacts-directory/contacts-directory.component.scss +8 -6
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.html +64 -47
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.scss +98 -61
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.ts +24 -40
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component_2.html +116 -0
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.html +39 -42
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.scss +67 -4
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +82 -152
- package/src/app/components/conversation-info/info-content/info-content.component.html +23 -2
- package/src/app/components/conversation-info/info-content/info-content.component.ts +3 -6
- package/src/app/components/conversation-info/info-direct/info-direct.component.html +7 -14
- package/src/app/components/conversation-info/info-direct/info-direct.component.scss +23 -0
- package/src/app/components/conversation-info/info-direct/info-direct.component.ts +1 -6
- package/src/app/components/conversation-info/info-group/info-group.component.html +44 -108
- package/src/app/components/conversation-info/info-group/info-group.component.scss +101 -61
- package/src/app/components/conversation-info/info-group/info-group.component.ts +1 -0
- package/src/app/components/conversation-info/info-support-group/info-support-group.component.html +2 -1
- package/src/app/components/conversation-info/info-support-group/info-support-group.component.ts +0 -1
- package/src/app/components/{ddp-header/ddp-header.component.html → conversations-list/header-conversations-list/header-conversations-list.component.html} +3 -3
- package/src/app/components/{ddp-header/ddp-header.component.scss → conversations-list/header-conversations-list/header-conversations-list.component.scss} +16 -4
- package/src/app/components/{conversation-detail/bubble-my-message/bubble-my-message.component.spec.ts → conversations-list/header-conversations-list/header-conversations-list.component.spec.ts} +6 -6
- package/src/app/components/{ddp-header/ddp-header.component.ts → conversations-list/header-conversations-list/header-conversations-list.component.ts} +7 -16
- package/src/app/components/conversations-list/header-conversations-list-archived/header-conversations-list-archived.component.html +12 -0
- package/src/app/components/conversations-list/header-conversations-list-archived/header-conversations-list-archived.component.scss +14 -0
- package/src/app/components/{conversation-detail/option-header/option-header.component.spec.ts → conversations-list/header-conversations-list-archived/header-conversations-list-archived.component.spec.ts} +5 -5
- package/src/app/components/{conversation-detail/option-header/option-header.component.ts → conversations-list/header-conversations-list-archived/header-conversations-list-archived.component.ts} +5 -4
- package/src/app/components/navbar/navbar.component.html +103 -0
- package/src/app/components/navbar/navbar.component.scss +249 -0
- package/src/app/components/{ddp-header/ddp-header.component.spec.ts → navbar/navbar.component.spec.ts} +6 -6
- package/src/app/components/navbar/navbar.component.ts +190 -0
- package/src/app/components/project-item/project-item.component.html +98 -149
- package/src/app/components/project-item/project-item.component.scss +43 -35
- package/src/app/components/project-item/project-item.component.ts +16 -4
- package/src/app/components/sidebar-user-details/sidebar-user-details.component.html +5 -5
- package/src/app/components/sidebar-user-details/sidebar-user-details.component.ts +24 -13
- package/src/app/components/utils/user-presence/user-presence.component.html +7 -2
- package/src/app/components/utils/user-presence/user-presence.component.scss +35 -18
- package/src/app/components/utils/user-presence/user-presence.component.ts +6 -10
- package/src/app/{pages → modals}/create-canned-response/create-canned-response-routing.module.ts +0 -0
- package/src/app/{pages → modals}/create-canned-response/create-canned-response.module.ts +0 -0
- package/src/app/{pages → modals}/create-canned-response/create-canned-response.page.html +0 -0
- package/src/app/{pages → modals}/create-canned-response/create-canned-response.page.scss +0 -0
- package/src/app/{pages → modals}/create-canned-response/create-canned-response.page.spec.ts +0 -0
- package/src/app/{pages → modals}/create-canned-response/create-canned-response.page.ts +13 -13
- package/src/app/{pages → modals}/loader-preview/loader-preview-routing.module.ts +0 -0
- package/src/app/{pages → modals}/loader-preview/loader-preview.module.ts +0 -0
- package/src/app/{pages → modals}/loader-preview/loader-preview.page.html +1 -1
- package/src/app/{pages → modals}/loader-preview/loader-preview.page.scss +4 -0
- package/src/app/{pages → modals}/loader-preview/loader-preview.page.spec.ts +0 -0
- package/src/app/{pages → modals}/loader-preview/loader-preview.page.ts +1 -2
- package/src/app/modals/send-email/send-email-routing.module.ts +17 -0
- package/src/app/modals/send-email/send-email.module.ts +31 -0
- package/src/app/modals/send-email/send-email.page.html +46 -0
- package/src/app/modals/send-email/send-email.page.scss +161 -0
- package/src/app/modals/send-email/send-email.page.spec.ts +24 -0
- package/src/app/modals/send-email/send-email.page.ts +89 -0
- package/src/app/pages/contacts-directory/contacts-directory.page.html +1 -1
- package/src/app/pages/contacts-directory/contacts-directory.page.scss +47 -0
- package/src/app/pages/contacts-directory/contacts-directory.page.ts +2 -0
- package/src/app/pages/conversation-detail/conversation-detail.module.ts +0 -8
- package/src/app/pages/conversation-detail/conversation-detail.page.html +48 -27
- package/src/app/pages/conversation-detail/conversation-detail.page.scss +45 -254
- package/src/app/pages/conversation-detail/conversation-detail.page.ts +361 -173
- package/src/app/pages/conversations-list/conversations-list.page.html +11 -8
- package/src/app/pages/conversations-list/conversations-list.page.scss +18 -2
- package/src/app/pages/conversations-list/conversations-list.page.ts +69 -65
- package/src/app/pages/profile-info/profile-info.page.html +2 -4
- package/src/app/pages/unassigned-conversations/unassigned-conversations.page.html +1 -1
- package/src/app/pages/unassigned-conversations/unassigned-conversations.page.scss +42 -0
- package/src/app/pages/unassigned-conversations/unassigned-conversations.page.ts +1 -0
- package/src/app/services/canned-responses/canned-responses.service.ts +26 -0
- package/src/app/services/projects/projects.service.spec.ts +12 -0
- package/src/app/services/projects/projects.service.ts +43 -0
- package/src/app/services/tiledesk/tiledesk.service.ts +33 -17
- package/src/app/services/websocket/websocket.service.ts +1 -1
- package/src/app/shared/shared.module.ts +24 -33
- package/src/app/utils/toast.spec.ts +7 -0
- package/src/app/utils/toast.ts +48 -0
- package/src/assets/i18n/ar.json +288 -265
- package/src/assets/i18n/az.json +24 -1
- package/src/assets/i18n/de.json +25 -2
- package/src/assets/i18n/en.json +25 -2
- package/src/assets/i18n/es.json +26 -3
- package/src/assets/i18n/fr.json +24 -1
- package/src/assets/i18n/it.json +24 -1
- package/src/assets/i18n/kk.json +25 -2
- package/src/assets/i18n/pt.json +25 -2
- package/src/assets/i18n/ru.json +24 -1
- package/src/assets/i18n/sr.json +287 -264
- package/src/assets/i18n/sv.json +25 -2
- package/src/assets/i18n/tr.json +25 -2
- package/src/assets/i18n/uk.json +25 -2
- package/src/assets/i18n/uz.json +24 -1
- package/src/assets/js/chat21client.js +175 -148
- package/src/assets/sounds/interface-start.mp3 +0 -0
- package/src/assets/sounds/wheep-wheep.mp3 +0 -0
- package/src/chat-config-mqtt-localhost.json +2 -2
- package/src/chat-config-native-mqtt.json +3 -0
- package/src/chat21-core/models/conversation.ts +0 -1
- package/src/chat21-core/models/projects.ts +27 -0
- package/src/chat21-core/providers/firebase/firebase-typing.service.ts +7 -9
- package/src/chat21-core/providers/mqtt/mqtt-auth-service.ts +7 -8
- package/src/chat21-core/utils/constants.ts +7 -1
- package/src/chat21-core/utils/convertRequestToConversation.ts +41 -0
- package/src/chat21-core/utils/user-typing/user-typing.component.html +8 -5
- package/src/chat21-core/utils/user-typing/user-typing.component.scss +87 -17
- package/src/chat21-core/utils/user-typing/user-typing.component.ts +12 -94
- package/src/chat21-core/utils/utils.ts +41 -11
- package/src/global.scss +59 -255
- package/src/index.html +0 -9
- package/src/variables.scss +30 -10
- package/src/app/components/conversation-detail/bubble-day-message/bubble-day-message.component.html +0 -3
- package/src/app/components/conversation-detail/bubble-day-message/bubble-day-message.component.scss +0 -21
- package/src/app/components/conversation-detail/bubble-day-message/bubble-day-message.component.spec.ts +0 -24
- package/src/app/components/conversation-detail/bubble-day-message/bubble-day-message.component.ts +0 -14
- package/src/app/components/conversation-detail/bubble-my-message/bubble-my-message.component.html +0 -54
- package/src/app/components/conversation-detail/bubble-my-message/bubble-my-message.component.scss +0 -98
- package/src/app/components/conversation-detail/bubble-my-message/bubble-my-message.component.ts +0 -84
- package/src/app/components/conversation-detail/bubble-others-message/bubble-others-message.component.html +0 -30
- package/src/app/components/conversation-detail/bubble-others-message/bubble-others-message.component.scss +0 -83
- package/src/app/components/conversation-detail/bubble-others-message/bubble-others-message.component.spec.ts +0 -24
- package/src/app/components/conversation-detail/bubble-others-message/bubble-others-message.component.ts +0 -68
- package/src/app/components/conversation-detail/bubble-system-message/bubble-system-message.component.html +0 -3
- package/src/app/components/conversation-detail/bubble-system-message/bubble-system-message.component.scss +0 -10
- package/src/app/components/conversation-detail/bubble-system-message/bubble-system-message.component.spec.ts +0 -24
- package/src/app/components/conversation-detail/bubble-system-message/bubble-system-message.component.ts +0 -14
- package/src/app/components/conversation-detail/option-header/option-header.component.html +0 -13
- package/src/app/components/conversation-detail/option-header/option-header.component.scss +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
Chat21Client
|
|
3
3
|
|
|
4
|
-
v0.1.
|
|
4
|
+
v0.1.12.3
|
|
5
5
|
|
|
6
6
|
@Author Andrea Sponziello
|
|
7
7
|
(c) Tiledesk 2020
|
|
@@ -22,7 +22,7 @@ class Chat21Client {
|
|
|
22
22
|
this.client = null;
|
|
23
23
|
this.reconnections = 0 // just to check how many reconnections
|
|
24
24
|
this.client_id = this.uuidv4();
|
|
25
|
-
this.log = options.
|
|
25
|
+
this.log = options.log ? true : false;
|
|
26
26
|
if (options && options.MQTTendpoint) {
|
|
27
27
|
if (options.MQTTendpoint.startsWith('/')) {
|
|
28
28
|
if (this.log) {
|
|
@@ -75,7 +75,7 @@ class Chat21Client {
|
|
|
75
75
|
this.connected = false
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
subscribeToMyConversations() { // MESSAGES ETC.
|
|
78
|
+
subscribeToMyConversations(subscribedCallback) { // MESSAGES ETC.
|
|
79
79
|
// WILDCARS:
|
|
80
80
|
// MQTT: https://www.hivemq.com/blog/mqtt-essentials-part-5-mqtt-topics-best-practices/
|
|
81
81
|
// RABBITMQ: https://www.cloudamqp.com/blog/2015-09-03-part4-rabbitmq-for-beginners-exchanges-routing-keys-bindings.html#topic-exchange
|
|
@@ -84,9 +84,13 @@ class Chat21Client {
|
|
|
84
84
|
console.log("subscribing to:", this.user_id, "topic", this.topic_inbox);
|
|
85
85
|
}
|
|
86
86
|
this.client.subscribe(this.topic_inbox, (err) => {
|
|
87
|
+
if (err) {
|
|
88
|
+
console.error("An error occurred while subscribing user", this.user_id, "on topic:", this.topic_inbox, "Error:", err);
|
|
89
|
+
}
|
|
87
90
|
if (this.log) {
|
|
88
91
|
console.log("subscribed to:", this.topic_inbox, " with err", err)
|
|
89
92
|
}
|
|
93
|
+
subscribedCallback();
|
|
90
94
|
});
|
|
91
95
|
}
|
|
92
96
|
|
|
@@ -127,7 +131,9 @@ class Chat21Client {
|
|
|
127
131
|
// callback - function (err)
|
|
128
132
|
// console.log("recipient_id:", recipient_id)
|
|
129
133
|
let dest_topic = `apps/${this.appid}/outgoing/users/${this.user_id}/messages/${recipient_id}/outgoing`
|
|
130
|
-
|
|
134
|
+
if (this.log) {
|
|
135
|
+
console.log("dest_topic:", dest_topic)
|
|
136
|
+
}
|
|
131
137
|
// let outgoing_message = {
|
|
132
138
|
// text: text,
|
|
133
139
|
// type: type,
|
|
@@ -529,172 +535,179 @@ class Chat21Client {
|
|
|
529
535
|
this.onGroupUpdatedCallbacks.delete(handler);
|
|
530
536
|
}
|
|
531
537
|
|
|
532
|
-
start() {
|
|
538
|
+
start(subscribedCallback) {
|
|
533
539
|
if (this.on_message_handler) {
|
|
534
|
-
|
|
540
|
+
if (this.log) {
|
|
541
|
+
console.log("this.on_message_handler already subscribed. Reconnected num", this.reconnections)
|
|
542
|
+
}
|
|
543
|
+
callbsubscribedCallbackack();
|
|
535
544
|
return
|
|
536
545
|
}
|
|
537
|
-
this.subscribeToMyConversations()
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
// console.log("topic:" + topic + "\nmessage payload:" + message)
|
|
541
|
-
const _topic = this.parseTopic(topic)
|
|
542
|
-
if (!_topic) {
|
|
546
|
+
this.subscribeToMyConversations(() => {
|
|
547
|
+
// no more than one "on_message" handler, thanks.
|
|
548
|
+
this.on_message_handler = this.client.on('message', (topic, message) => {
|
|
543
549
|
if (this.log) {
|
|
544
|
-
console.log("
|
|
550
|
+
console.log("topic:" + topic + "\nmessage payload:" + message)
|
|
545
551
|
}
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
+
const _topic = this.parseTopic(topic)
|
|
553
|
+
if (!_topic) {
|
|
554
|
+
if (this.log) {
|
|
555
|
+
console.log("Invalid message topic:", topic);
|
|
556
|
+
}
|
|
557
|
+
return;
|
|
558
|
+
}
|
|
559
|
+
const conversWith = _topic.conversWith
|
|
560
|
+
try {
|
|
561
|
+
const message_json = JSON.parse(message.toString())
|
|
562
|
+
|
|
552
563
|
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
564
|
+
// TEMPORARILY DISABLED, ADDED-CONVERSATIONS ARE OBSERVED BY NEW MESSAGES.
|
|
565
|
+
// MOVED TO: this.onMessageAddedCallbacks
|
|
566
|
+
// if (this.onConversationAddedCallbacks) {
|
|
567
|
+
// if (topic.includes("/conversations/") && topic.endsWith(_CLIENTADDED)) {
|
|
568
|
+
// // map.forEach((value, key, map) =>)
|
|
569
|
+
// this.onConversationAddedCallbacks.forEach((callback, handler, map) => {
|
|
570
|
+
// callback(message_json, _topic)
|
|
571
|
+
// });
|
|
572
|
+
// }
|
|
573
|
+
// }
|
|
563
574
|
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
575
|
+
if (this.onConversationUpdatedCallbacks) {
|
|
576
|
+
// example topic: apps.tilechat.users.ME.conversations.CONVERS-WITH.clientdeleted
|
|
577
|
+
if (topic.includes("/conversations/") && topic.endsWith(_CLIENTUPDATED)) {
|
|
578
|
+
if (this.log) {
|
|
579
|
+
console.log("conversation updated! /conversations/, topic:", topic)
|
|
580
|
+
}
|
|
581
|
+
// map.forEach((value, key, map) =>)
|
|
582
|
+
this.onConversationUpdatedCallbacks.forEach((callback, handler, map) => {
|
|
583
|
+
callback(JSON.parse(message.toString()), _topic)
|
|
584
|
+
});
|
|
569
585
|
}
|
|
570
|
-
// map.forEach((value, key, map) =>)
|
|
571
|
-
this.onConversationUpdatedCallbacks.forEach((callback, handler, map) => {
|
|
572
|
-
callback(JSON.parse(message.toString()), _topic)
|
|
573
|
-
});
|
|
574
586
|
}
|
|
575
|
-
}
|
|
576
587
|
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
588
|
+
if (this.onConversationDeletedCallbacks) {
|
|
589
|
+
if (topic.includes("/conversations/") && topic.endsWith(_CLIENTDELETED)) {
|
|
590
|
+
// map.forEach((value, key, map) =>)
|
|
591
|
+
if (this.log) {
|
|
592
|
+
console.log("conversation deleted! /conversations/, topic:", topic, message.toString() );
|
|
593
|
+
}
|
|
594
|
+
this.onConversationDeletedCallbacks.forEach((callback, handler, map) => {
|
|
595
|
+
callback(JSON.parse(message.toString()), _topic)
|
|
596
|
+
});
|
|
582
597
|
}
|
|
583
|
-
this.onConversationDeletedCallbacks.forEach((callback, handler, map) => {
|
|
584
|
-
callback(JSON.parse(message.toString()), _topic)
|
|
585
|
-
});
|
|
586
598
|
}
|
|
587
|
-
}
|
|
588
599
|
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
600
|
+
if (this.onArchivedConversationAddedCallbacks) {
|
|
601
|
+
if (topic.includes("/archived_conversations/") && topic.endsWith(_CLIENTADDED)) {
|
|
602
|
+
// map.forEach((value, key, map) =>)
|
|
603
|
+
this.onArchivedConversationAddedCallbacks.forEach((callback, handler, map) => {
|
|
604
|
+
callback(JSON.parse(message.toString()), _topic)
|
|
605
|
+
});
|
|
606
|
+
}
|
|
595
607
|
}
|
|
596
|
-
}
|
|
597
608
|
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
609
|
+
if (this.onArchivedConversationDeletedCallbacks) {
|
|
610
|
+
if (topic.includes("/archived_conversations/") && topic.endsWith(_CLIENTDELETED)) {
|
|
611
|
+
// map.forEach((value, key, map) =>)
|
|
612
|
+
this.onArchivedConversationDeletedCallbacks.forEach((callback, handler, map) => {
|
|
613
|
+
callback(JSON.parse(message.toString()), _topic)
|
|
614
|
+
});
|
|
615
|
+
}
|
|
604
616
|
}
|
|
605
|
-
}
|
|
606
617
|
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
}
|
|
618
|
+
// *********************************************************
|
|
619
|
+
// This snippet is important to get all messages and notify
|
|
620
|
+
// conversation > added (to create a conversation entry)
|
|
621
|
+
// *********************************************************
|
|
622
|
+
// if (this.onMessageAddedCallbacks) {
|
|
623
|
+
// console.log("ttttttttt")
|
|
624
|
+
if (topic.includes("/messages/") && topic.endsWith(_CLIENTADDED)) {
|
|
625
|
+
if (this.onMessageAddedCallbacks) {
|
|
626
|
+
this.onMessageAddedCallbacks.forEach((callback, handler, map) => {
|
|
627
|
+
callback(JSON.parse(message.toString()), _topic)
|
|
628
|
+
});
|
|
629
|
+
}
|
|
630
|
+
// Observing conversations added from messages
|
|
631
|
+
// console.log("Observing conversations added from messages", message_json);
|
|
632
|
+
// if (this.onConversationAddedCallbacks) {
|
|
633
|
+
let update_conversation = true;
|
|
634
|
+
|
|
635
|
+
if (message_json.attributes && message_json.attributes.updateconversation == false) {
|
|
636
|
+
update_conversation = false
|
|
637
|
+
}
|
|
638
|
+
if (update_conversation && this.onConversationAddedCallbacks) {
|
|
639
|
+
this.onConversationAddedCallbacks.forEach((callback, handler, map) => {
|
|
640
|
+
message_json.is_new = true;
|
|
641
|
+
const message_for_conv_string = JSON.stringify(message_json);
|
|
642
|
+
callback(JSON.parse(message_for_conv_string), _topic)
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
// }
|
|
634
646
|
}
|
|
635
647
|
// }
|
|
636
|
-
}
|
|
637
|
-
// }
|
|
638
648
|
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
649
|
+
if (this.onMessageUpdatedCallbacks) {
|
|
650
|
+
if (topic.includes("/messages/") && topic.endsWith(_CLIENTUPDATED)) {
|
|
651
|
+
this.onMessageUpdatedCallbacks.forEach((callback, handler, map) => {
|
|
652
|
+
callback(JSON.parse(message.toString()), _topic)
|
|
653
|
+
});
|
|
654
|
+
}
|
|
644
655
|
}
|
|
645
|
-
}
|
|
646
656
|
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
657
|
+
if (this.onGroupUpdatedCallbacks) {
|
|
658
|
+
if (topic.includes("/groups/") && topic.endsWith(_CLIENTUPDATED)) {
|
|
659
|
+
this.onGroupUpdatedCallbacks.forEach((callback, handler, map) => {
|
|
660
|
+
callback(JSON.parse(message.toString()), _topic)
|
|
661
|
+
});
|
|
662
|
+
}
|
|
652
663
|
}
|
|
653
|
-
}
|
|
654
664
|
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
665
|
+
// // ******* NEW!!
|
|
666
|
+
this.callbackHandlers.forEach((value, key, map) => {
|
|
667
|
+
const callback_obj = value
|
|
668
|
+
// callback_obj = {
|
|
669
|
+
// "type": "onMessageUpdatedForConversation",
|
|
670
|
+
// "conversWith": conversWith,
|
|
671
|
+
// "callback": callback
|
|
672
|
+
// }
|
|
673
|
+
const type = callback_obj.type
|
|
674
|
+
if (topic.includes("/messages/") && topic.endsWith(_CLIENTADDED)) {
|
|
675
|
+
if (this.log) { console.log("/messages/_CLIENTADDED") }
|
|
676
|
+
if (type === CALLBACK_TYPE_ON_MESSAGE_ADDED_FOR_CONVERSATION) {
|
|
677
|
+
if (conversWith === callback_obj.conversWith) {
|
|
678
|
+
if (this.log) { console.log("/messages/_CLIENTADDED on: ", conversWith)}
|
|
679
|
+
callback_obj.callback(JSON.parse(message.toString()), _topic)
|
|
680
|
+
}
|
|
670
681
|
}
|
|
671
682
|
}
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
683
|
+
if (topic.includes("/messages/") && topic.endsWith(_CLIENTUPDATED)) {
|
|
684
|
+
if (this.log) {console.log("/messages/_CLIENTUPDATED")}
|
|
685
|
+
if (type === CALLBACK_TYPE_ON_MESSAGE_UPDATED_FOR_CONVERSATION) {
|
|
686
|
+
if (conversWith === callback_obj.conversWith) {
|
|
687
|
+
if (this.log) {console.log("/messages/_CLIENTUPDATED on: ", conversWith);}
|
|
688
|
+
callback_obj.callback(JSON.parse(message.toString()), _topic)
|
|
689
|
+
}
|
|
679
690
|
}
|
|
680
691
|
}
|
|
681
|
-
}
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
+
})
|
|
693
|
+
|
|
694
|
+
// if (topic.includes("/messages/") && topic.endsWith(_CLIENTUPDATED)) {
|
|
695
|
+
// this.onMessageUpdatedInConversationCallbacks.forEach((obj, handler, map) => {
|
|
696
|
+
// if (conversWith === obj.conversWith) {
|
|
697
|
+
// callback(message_json, _topic)
|
|
698
|
+
// }
|
|
699
|
+
// });
|
|
700
|
+
// }
|
|
701
|
+
|
|
692
702
|
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
703
|
+
}
|
|
704
|
+
catch (err) {
|
|
705
|
+
console.error("ERROR:", err)
|
|
706
|
+
}
|
|
707
|
+
})
|
|
708
|
+
subscribedCallback();
|
|
697
709
|
})
|
|
710
|
+
|
|
698
711
|
// console.log("HANDLER_:", this.on_message_handler)
|
|
699
712
|
}
|
|
700
713
|
|
|
@@ -763,14 +776,23 @@ class Chat21Client {
|
|
|
763
776
|
}
|
|
764
777
|
|
|
765
778
|
conversationDetail(conversWith, callback) {
|
|
779
|
+
if (this.log) {
|
|
780
|
+
console.log("conversationDetail(). searching on user:", this.user_id, " - conversWith:", conversWith)
|
|
781
|
+
}
|
|
766
782
|
this.crossConversationDetail(conversWith, false, callback);
|
|
767
783
|
}
|
|
768
784
|
|
|
769
785
|
archivedConversationDetail(conversWith, callback) {
|
|
786
|
+
if (this.log) {
|
|
787
|
+
console.log("archivedConversationDetail(). searching on user:", this.user_id, " - conversWith:", conversWith)
|
|
788
|
+
}
|
|
770
789
|
this.crossConversationDetail(conversWith, true, callback);
|
|
771
790
|
}
|
|
772
791
|
|
|
773
792
|
crossConversationDetail(conversWith, archived, callback) {
|
|
793
|
+
if (this.log) {
|
|
794
|
+
console.log("searching on user:", this.user_id, " - conv of conversWith:", conversWith, " - archived:", archived)
|
|
795
|
+
}
|
|
774
796
|
let path = "conversations";
|
|
775
797
|
if (archived) {
|
|
776
798
|
path = "archived_conversations"
|
|
@@ -778,8 +800,10 @@ class Chat21Client {
|
|
|
778
800
|
// ex.: http://localhost:8004/tilechat/04-ANDREASPONZIELLO/conversations/CONVERS_WITH
|
|
779
801
|
//const URL = `${this.APIendpoint}/${this.appid}/${this.user_id}/conversations/${conversWith}`
|
|
780
802
|
const URL = `${this.APIendpoint}/${this.appid}/${this.user_id}/${path}/${conversWith}`
|
|
781
|
-
|
|
782
|
-
|
|
803
|
+
if (this.log) {
|
|
804
|
+
console.log("getting conversation detail:", URL);
|
|
805
|
+
console.log("conversWith:", conversWith);
|
|
806
|
+
}
|
|
783
807
|
|
|
784
808
|
let options = {
|
|
785
809
|
url: URL,
|
|
@@ -790,7 +814,9 @@ class Chat21Client {
|
|
|
790
814
|
method: 'GET'
|
|
791
815
|
}
|
|
792
816
|
Chat21Client.myrequest(options, (err, response, json) => {
|
|
793
|
-
|
|
817
|
+
if (this.log) {
|
|
818
|
+
console.log("JSON...", json);
|
|
819
|
+
}
|
|
794
820
|
if (json && json.result && Array.isArray(json.result) && json.result.length ==1) {
|
|
795
821
|
callback(null, json.result[0]);
|
|
796
822
|
}
|
|
@@ -964,12 +990,13 @@ class Chat21Client {
|
|
|
964
990
|
|
|
965
991
|
this.client.on('connect', // TODO if token is wrong it must reply with an error!
|
|
966
992
|
() => {
|
|
967
|
-
if (this.log) {console.log("
|
|
993
|
+
if (this.log) {console.log("Chat client connected. User:" + user_id)}
|
|
968
994
|
if (!this.connected) {
|
|
969
|
-
if (this.log) {console.log("Chat client first connection
|
|
995
|
+
if (this.log) {console.log("Chat client first connection for:" + user_id)}
|
|
970
996
|
this.connected = true
|
|
971
|
-
this.start()
|
|
972
|
-
|
|
997
|
+
this.start( () => {
|
|
998
|
+
callback();
|
|
999
|
+
});
|
|
973
1000
|
}
|
|
974
1001
|
}
|
|
975
1002
|
);
|
|
@@ -1031,7 +1058,7 @@ class Chat21Client {
|
|
|
1031
1058
|
|
|
1032
1059
|
function isBrowser() {
|
|
1033
1060
|
return true;
|
|
1034
|
-
//return false;
|
|
1061
|
+
// return false;
|
|
1035
1062
|
}
|
|
1036
1063
|
|
|
1037
1064
|
export { Chat21Client }; // Browser
|
|
Binary file
|
|
Binary file
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"APIendpoint": "http://localhost:8004/api",
|
|
22
22
|
"_log": true
|
|
23
23
|
},
|
|
24
|
-
"apiUrl": "http://localhost:
|
|
24
|
+
"apiUrl": "http://localhost:8081/api/",
|
|
25
25
|
"baseImageUrl": "http://localhost:3000/",
|
|
26
|
-
"dashboardUrl": "http://localhost:8081/",
|
|
26
|
+
"dashboardUrl": "http://localhost:8081/dashboard/",
|
|
27
27
|
"testsiteBaseUrl": "http://localhost:8081/widget/assets/twp/index.html",
|
|
28
28
|
"logLevel": "DEBUG",
|
|
29
29
|
"authPersistence": "LOCAL",
|
|
@@ -28,5 +28,8 @@
|
|
|
28
28
|
"dashboardUrl": "https://console.native.tiledesk.com/dashboard/",
|
|
29
29
|
"testsiteBaseUrl":"https://console.native.tiledesk.com/widget/assets/twp/index.html",
|
|
30
30
|
"authPersistence": "LOCAL",
|
|
31
|
+
"supportMode": true,
|
|
32
|
+
"archivedButton": true,
|
|
33
|
+
"writeToButton": true,
|
|
31
34
|
"wsUrl":"wss://console.native.tiledesk.com/mqws/ws"
|
|
32
35
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface Project {
|
|
2
|
+
_id: string;
|
|
3
|
+
updatedAt?: any;
|
|
4
|
+
createdAt?: any;
|
|
5
|
+
name?: string;
|
|
6
|
+
activeOperatingHours?: boolean;
|
|
7
|
+
operatingHours?: any
|
|
8
|
+
createdBy?: string;
|
|
9
|
+
id_project?: any;
|
|
10
|
+
widget?: any;
|
|
11
|
+
settings?: any;
|
|
12
|
+
role?: string;
|
|
13
|
+
user_available?: boolean;
|
|
14
|
+
profile_name?: any;
|
|
15
|
+
profile_agents?: any;
|
|
16
|
+
trial_expired?: any;
|
|
17
|
+
trial_days_left?: number;
|
|
18
|
+
trial_days?: number;
|
|
19
|
+
profile_type?: string;
|
|
20
|
+
subscription_is_active?: any;
|
|
21
|
+
profile?: any;
|
|
22
|
+
subscription_end_date?: any;
|
|
23
|
+
subscription_id?: any;
|
|
24
|
+
subscription_creation_date?: any;
|
|
25
|
+
subscription_start_date?: any;
|
|
26
|
+
__v?: any;
|
|
27
|
+
}
|
|
@@ -12,11 +12,11 @@ import 'firebase/database';
|
|
|
12
12
|
import { TypingService } from '../abstract/typing.service';
|
|
13
13
|
import { CustomLogger } from '../logger/customLogger';
|
|
14
14
|
import { LoggerInstance } from '../logger/loggerInstance';
|
|
15
|
+
import { TIME_TYPING_MESSAGE } from 'src/chat21-core/utils/constants';
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
export class TypingModel {
|
|
18
19
|
|
|
19
|
-
|
|
20
20
|
constructor(
|
|
21
21
|
public uid: string,
|
|
22
22
|
public timestamp: any,
|
|
@@ -35,14 +35,11 @@ export class FirebaseTypingService extends TypingService {
|
|
|
35
35
|
BSIsTyping: BehaviorSubject<any> = new BehaviorSubject<any>(null);
|
|
36
36
|
BSSetTyping: BehaviorSubject<any> = new BehaviorSubject<any>(null);
|
|
37
37
|
|
|
38
|
-
// public params
|
|
39
|
-
// public tenant: string;
|
|
40
|
-
private tenant: string;
|
|
41
|
-
|
|
42
|
-
// private params
|
|
43
38
|
private urlNodeTypings: string;
|
|
44
39
|
private setTimeoutWritingMessages: any;
|
|
40
|
+
private tenant: string;
|
|
45
41
|
private logger: LoggerService = LoggerInstance.getInstance();
|
|
42
|
+
private ref: firebase.database.Query;
|
|
46
43
|
|
|
47
44
|
constructor() {
|
|
48
45
|
super();
|
|
@@ -64,10 +61,11 @@ export class FirebaseTypingService extends TypingService {
|
|
|
64
61
|
urlTyping = this.urlNodeTypings + idCurrentUser + '/' + idConversation;
|
|
65
62
|
}
|
|
66
63
|
this.logger.debug('[FIREBASETypingSERVICE] urlTyping: ', urlTyping);
|
|
67
|
-
|
|
68
|
-
ref.on('child_changed', (childSnapshot) => {
|
|
64
|
+
this.ref = firebase.database().ref(urlTyping);
|
|
65
|
+
this.ref.on('child_changed', (childSnapshot) => {
|
|
69
66
|
const precence: TypingModel = childSnapshot.val();
|
|
70
|
-
this.
|
|
67
|
+
this.logger.debug('[FIREBASETypingSERVICE] child_changed: ', precence);
|
|
68
|
+
this.BSIsTyping.next({uid: idConversation, uidUserTypingNow: precence.uid, nameUserTypingNow: precence.name, waitTime: TIME_TYPING_MESSAGE});
|
|
71
69
|
});
|
|
72
70
|
}
|
|
73
71
|
|
|
@@ -64,15 +64,14 @@ export class MQTTAuthService extends MessagingAuthService {
|
|
|
64
64
|
|
|
65
65
|
// logout(callback) {
|
|
66
66
|
logout(): Promise<boolean> {
|
|
67
|
-
this.logger.
|
|
67
|
+
this.logger.debug("[MQTTAuthService] logout: closing mqtt connection...");
|
|
68
68
|
return new Promise((resolve, reject) => {
|
|
69
69
|
this.chat21Service.chatClient.close(() => {
|
|
70
|
-
console.log("[MQTTAuthService] logout: mqtt connection closed. OK");
|
|
71
70
|
// remove
|
|
72
71
|
// this.appStorage.removeItem('tiledeskToken');
|
|
73
72
|
// this.appStorage.removeItem('currentUser');
|
|
74
73
|
this.currentUser = null;
|
|
75
|
-
|
|
74
|
+
this.logger.debug("[MQTTAuthService] logout: mqtt connection closed. user removed. OK");
|
|
76
75
|
this.BSSignOut.next(true);
|
|
77
76
|
this.BSAuthStateChanged.next('offline');
|
|
78
77
|
resolve(true)
|
|
@@ -94,7 +93,7 @@ z
|
|
|
94
93
|
|
|
95
94
|
/** */
|
|
96
95
|
getToken(): string {
|
|
97
|
-
this.logger.
|
|
96
|
+
this.logger.debug('[MQTTAuthService]::getToken');
|
|
98
97
|
return this.token;
|
|
99
98
|
}
|
|
100
99
|
|
|
@@ -255,19 +254,19 @@ z
|
|
|
255
254
|
// const that = this;
|
|
256
255
|
this.http.post(this.URL_TILEDESK_CREATE_CUSTOM_TOKEN, postData, { headers, responseType})
|
|
257
256
|
.subscribe(data => {
|
|
258
|
-
this.logger.
|
|
257
|
+
this.logger.debug("[MQTTAuthService] connectWithCustomToken: **** data", data)
|
|
259
258
|
const result = JSON.parse(data);
|
|
260
259
|
this.connectMQTT(result);
|
|
261
260
|
}, error => {
|
|
262
|
-
this.logger.
|
|
261
|
+
this.logger.error(error);
|
|
263
262
|
});
|
|
264
263
|
}
|
|
265
264
|
|
|
266
265
|
connectMQTT(credentials: any): any {
|
|
267
|
-
this.logger.
|
|
266
|
+
this.logger.debug('[MQTTAuthService] connectMQTT: **** credentials:', credentials);
|
|
268
267
|
const userid = credentials.userid;
|
|
269
268
|
this.chat21Service.chatClient.connect(userid, credentials.token, () => {
|
|
270
|
-
this.logger.
|
|
269
|
+
this.logger.debug('[MQTTAuthService] connectMQTT: Chat connected.');
|
|
271
270
|
this.BSAuthStateChanged.next('online');
|
|
272
271
|
});
|
|
273
272
|
}
|
|
@@ -43,8 +43,13 @@ export const CHANNEL_TYPE_GROUP = 'group';
|
|
|
43
43
|
// TYPES MESSAGES
|
|
44
44
|
export const TYPE_MSG_TEXT = 'text';
|
|
45
45
|
export const TYPE_MSG_IMAGE = 'image';
|
|
46
|
+
export const TYPE_MSG_FILE = 'file';
|
|
47
|
+
export const TYPE_MSG_BUTTON = 'button';
|
|
48
|
+
export const TYPE_MSG_EMAIL = 'email';
|
|
49
|
+
|
|
46
50
|
export const MAX_WIDTH_IMAGES = 300;
|
|
47
51
|
export const MIN_WIDTH_IMAGES = 130;
|
|
52
|
+
export const TIME_TYPING_MESSAGE = 2000;
|
|
48
53
|
export const TYPE_DIRECT = 'direct';
|
|
49
54
|
export const TYPE_GROUP = 'group';
|
|
50
55
|
export const SYSTEM = 'system';
|
|
@@ -69,7 +74,8 @@ export const TOUCHING_OPERATOR = "TOUCHING_OPERATOR";
|
|
|
69
74
|
// URLS
|
|
70
75
|
// export const URL_SOUND = 'assets/sounds/pling.mp3';
|
|
71
76
|
export const URL_SOUND_LIST_CONVERSATION = '/assets/sounds/pling.mp3';
|
|
72
|
-
export const
|
|
77
|
+
export const URL_SOUND_CONVERSATION_ADDED = '/assets/sounds/wheep-wheep.mp3';
|
|
78
|
+
export const URL_SOUND_CONVERSATION_UNASSIGNED = '/assets/sounds/interface-start.mp3'
|
|
73
79
|
// export const CHAT_SEND_BY_EMAIL_LINK =
|
|
74
80
|
// 'mailto:?subject=Transcript Chat Conversation&body=Salve,%0D%0A%0D%0Adi
|
|
75
81
|
// seguito potrà scaricare il transcript della conversazione intercorsa con il nostro servizio di
|