@chat21/chat21-ionic 3.0.101 → 3.0.103-rc.2
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 +20 -0
- package/angular.json +25 -11
- package/config.xml +5 -5
- package/package.json +76 -43
- package/src/app/app-routing.module.ts +21 -16
- package/src/app/app.component.ts +102 -116
- package/src/app/app.module.ts +29 -18
- package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.html +8 -8
- package/src/app/chatlib/conversation-detail/message/return-receipt/return-receipt.component.scss +3 -3
- package/src/app/components/authentication/login/login.component.html +31 -2
- package/src/app/components/authentication/login/login.component.scss +63 -0
- package/src/app/components/authentication/login/login.component.ts +12 -5
- package/src/app/components/canned-response/canned-response.component.html +3 -0
- package/src/app/components/canned-response/canned-response.component.ts +7 -0
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +2 -2
- package/src/app/components/conversation-info/conversation-info.module.ts +23 -1
- package/src/app/directives/marked.pipe.ts +1 -2
- package/src/app/modals/create-canned-response/create-canned-response.page.ts +1 -0
- package/src/app/modals/send-email/send-email.page.ts +4 -4
- package/src/app/modals/send-whatsapp-template/send-whatsapp-template.module.ts +0 -1
- package/src/app/pages/authentication/login/login.page.html +1 -1
- package/src/app/pages/authentication/login/login.page.ts +1 -1
- package/src/app/pages/conversation-detail/conversation-detail.module.ts +55 -18
- package/src/app/pages/conversation-detail/conversation-detail.page.html +1 -0
- package/src/app/pages/conversation-detail/conversation-detail.page.ts +33 -13
- package/src/app/pages/conversations-list/conversations-list.module.ts +24 -4
- package/src/app/services/tiledesk/tiledesk.service.ts +2 -2
- package/src/app/shared/shared.module.ts +92 -69
- package/src/assets/i18n/en.json +30 -30
- package/src/assets/js/chat21client.js +9 -3
- package/src/chat21-core/models/projects.ts +9 -9
- package/src/chat21-core/providers/abstract/conversations-handler.service.ts +0 -1
- package/src/chat21-core/providers/abstract/groups-handler.service.ts +0 -1
- package/src/chat21-core/providers/abstract/notifications.service.ts +1 -1
- package/src/chat21-core/providers/firebase/firebase-notifications.ts +30 -15
- package/src/chat21-core/providers/mqtt/mqtt-conversation-handler.ts +0 -1
- package/src/chat21-core/providers/mqtt/mqtt-conversations-handler.ts +3 -3
- package/src/chat21-core/providers/mqtt/mqtt-notifications.ts +31 -5
- package/src/chat21-core/providers/tiledesk/tiledesk-auth.service.ts +0 -2
- package/src/chat21-core/utils/constants.ts +6 -0
- package/src/chat21-core/utils/convertRequestToConversation.ts +1 -1
- package/src/chat21-core/utils/utils-message.ts +4 -4
- package/src/chat21-core/utils/utils.ts +0 -16
- package/tsconfig.app.json +0 -1
- package/src/app/shared/shared-conversation-info.module.ts +0 -33
- package/src/models/department.ts +0 -12
|
@@ -56,83 +56,106 @@ import { AudioComponent } from '../chatlib/conversation-detail/message/audio/aud
|
|
|
56
56
|
|
|
57
57
|
@NgModule({
|
|
58
58
|
declarations: [
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
59
|
+
//CONVERSATION_LIST
|
|
60
|
+
// ListConversationsComponent,
|
|
61
|
+
// IonListConversationsComponent,
|
|
62
|
+
// HeaderConversationsList,
|
|
63
|
+
// HeaderConversationsListArchived,
|
|
64
|
+
// HeaderConversationsListUnassigned,
|
|
65
|
+
// ProjectItemComponent,
|
|
66
|
+
//CONVERSATION_DETAIL
|
|
67
|
+
// IonConversationDetailComponent,
|
|
68
|
+
// ConversationContentComponent,
|
|
69
|
+
// UserTypingComponent,
|
|
70
|
+
// MessageAttachmentComponent,
|
|
71
|
+
// TextButtonComponent,
|
|
72
|
+
// LinkButtonComponent,
|
|
73
|
+
// ActionButtonComponent,
|
|
74
|
+
// InfoMessageComponent,
|
|
75
|
+
// AvatarComponent,
|
|
76
|
+
// BubbleMessageComponent,
|
|
77
|
+
// FrameComponent,
|
|
78
|
+
// ImageComponent,
|
|
79
|
+
// AudioComponent,
|
|
80
|
+
// ReturnReceiptComponent,
|
|
81
|
+
// TextComponent,
|
|
82
|
+
// OptionsComponent,
|
|
83
|
+
// HtmlComponent,
|
|
84
|
+
|
|
85
|
+
//CONVERSATION_DETAIL_INFO
|
|
86
|
+
// InfoContentComponent,
|
|
87
|
+
// InfoSupportGroupComponent,
|
|
88
|
+
// InfoDirectComponent,
|
|
89
|
+
// InfoGroupComponent,
|
|
90
|
+
// AdvancedInfoAccordionComponent,
|
|
91
|
+
|
|
92
|
+
//NAVBAR - SIDEBAR
|
|
93
|
+
NavbarComponent,
|
|
94
|
+
SidebarComponent,
|
|
95
|
+
SidebarUserDetailsComponent,
|
|
96
|
+
|
|
97
|
+
//DIRECTIVES
|
|
98
|
+
AutofocusDirective,
|
|
99
|
+
TooltipDirective,
|
|
100
|
+
MarkedPipe,
|
|
101
|
+
HtmlEntitiesEncodePipe,
|
|
102
|
+
SafeHtmlPipe,
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
AvatarProfileComponent,
|
|
107
|
+
UserPresenceComponent,
|
|
108
|
+
ImageViewerComponent,
|
|
109
|
+
NetworkOfflineComponent
|
|
110
|
+
],
|
|
111
|
+
exports: [
|
|
112
|
+
//CONVERSATION_LIST
|
|
113
|
+
// ListConversationsComponent,
|
|
114
|
+
// IonListConversationsComponent,
|
|
115
|
+
// HeaderConversationsList,
|
|
116
|
+
// HeaderConversationsListArchived,
|
|
117
|
+
// HeaderConversationsListUnassigned,
|
|
118
|
+
// ProjectItemComponent,
|
|
119
|
+
//CONVERSATION_DETAIL
|
|
120
|
+
// IonConversationDetailComponent,
|
|
121
|
+
// ConversationContentComponent,
|
|
122
|
+
// UserTypingComponent,
|
|
123
|
+
// TextButtonComponent,
|
|
124
|
+
// LinkButtonComponent,
|
|
125
|
+
// ActionButtonComponent,
|
|
126
|
+
// InfoMessageComponent,
|
|
127
|
+
// AvatarComponent,
|
|
128
|
+
// BubbleMessageComponent,
|
|
129
|
+
// MessageAttachmentComponent,
|
|
130
|
+
// FrameComponent,
|
|
131
|
+
// ImageComponent,
|
|
132
|
+
// AudioComponent,
|
|
133
|
+
// ReturnReceiptComponent,
|
|
134
|
+
// TextComponent,
|
|
135
|
+
// OptionsComponent,
|
|
136
|
+
//CONVERSATION_DETAIL_INFO
|
|
137
|
+
// InfoContentComponent,
|
|
138
|
+
// InfoSupportGroupComponent,
|
|
139
|
+
// InfoDirectComponent,
|
|
140
|
+
// InfoGroupComponent,
|
|
141
|
+
|
|
142
|
+
//NAVBAR - SIDEBAR
|
|
67
143
|
NavbarComponent,
|
|
68
144
|
SidebarComponent,
|
|
69
145
|
SidebarUserDetailsComponent,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
AvatarComponent,
|
|
74
|
-
BubbleMessageComponent,
|
|
75
|
-
MessageAttachmentComponent,
|
|
76
|
-
TextButtonComponent,
|
|
77
|
-
LinkButtonComponent,
|
|
78
|
-
ActionButtonComponent,
|
|
79
|
-
FrameComponent,
|
|
80
|
-
ImageComponent,
|
|
81
|
-
AudioComponent,
|
|
82
|
-
InfoMessageComponent,
|
|
83
|
-
ReturnReceiptComponent,
|
|
84
|
-
TextComponent,
|
|
85
|
-
OptionsComponent,
|
|
86
|
-
HtmlComponent,
|
|
87
|
-
InfoContentComponent,
|
|
88
|
-
InfoSupportGroupComponent,
|
|
89
|
-
InfoDirectComponent,
|
|
90
|
-
InfoGroupComponent,
|
|
91
|
-
AdvancedInfoAccordionComponent,
|
|
92
|
-
MarkedPipe,
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
//DIRECTIVES
|
|
93
149
|
AutofocusDirective,
|
|
150
|
+
TooltipDirective,
|
|
151
|
+
MarkedPipe,
|
|
94
152
|
HtmlEntitiesEncodePipe,
|
|
95
153
|
SafeHtmlPipe,
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
HeaderConversationsListUnassigned,
|
|
99
|
-
NetworkOfflineComponent
|
|
100
|
-
],
|
|
101
|
-
exports: [
|
|
102
|
-
// MessageTextAreaComponent,
|
|
103
|
-
AutofocusDirective,
|
|
104
|
-
TooltipDirective,
|
|
154
|
+
|
|
155
|
+
//COMMON COMPONENTS
|
|
105
156
|
AvatarProfileComponent,
|
|
106
|
-
HeaderConversationsList,
|
|
107
|
-
ImageViewerComponent,
|
|
108
|
-
NavbarComponent,
|
|
109
|
-
SidebarComponent,
|
|
110
|
-
SidebarUserDetailsComponent,
|
|
111
|
-
ProjectItemComponent,
|
|
112
157
|
UserPresenceComponent,
|
|
113
|
-
|
|
114
|
-
ListConversationsComponent,
|
|
115
|
-
IonListConversationsComponent,
|
|
116
|
-
IonConversationDetailComponent,
|
|
117
|
-
ConversationContentComponent,
|
|
118
|
-
AvatarComponent,
|
|
119
|
-
BubbleMessageComponent,
|
|
120
|
-
TextButtonComponent,
|
|
121
|
-
LinkButtonComponent,
|
|
122
|
-
ActionButtonComponent,
|
|
123
|
-
FrameComponent,
|
|
124
|
-
ImageComponent,
|
|
125
|
-
AudioComponent,
|
|
126
|
-
InfoMessageComponent,
|
|
127
|
-
ReturnReceiptComponent,
|
|
128
|
-
TextComponent,
|
|
129
|
-
OptionsComponent,
|
|
130
|
-
InfoContentComponent,
|
|
131
|
-
InfoSupportGroupComponent,
|
|
132
|
-
InfoDirectComponent,
|
|
133
|
-
InfoGroupComponent,
|
|
134
|
-
HeaderConversationsListArchived,
|
|
135
|
-
HeaderConversationsListUnassigned,
|
|
158
|
+
ImageViewerComponent,
|
|
136
159
|
NetworkOfflineComponent
|
|
137
160
|
|
|
138
161
|
],
|
package/src/assets/i18n/en.json
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
"LABEL_MSG_START_CHAT": "Start chatting",
|
|
5
5
|
"LABEL_AVAILABLE": "available",
|
|
6
6
|
"LABEL_NOT_AVAILABLE": "not available",
|
|
7
|
-
"LABEL_INACTIVE":"inactive",
|
|
8
|
-
"LABEL_ONLINE":"online",
|
|
9
|
-
"LABEL_OFFLINE":"offline",
|
|
7
|
+
"LABEL_INACTIVE": "inactive",
|
|
8
|
+
"LABEL_ONLINE": "online",
|
|
9
|
+
"LABEL_OFFLINE": "offline",
|
|
10
10
|
"LABEL_NO_MSG_HERE": "Still no message here...",
|
|
11
11
|
"LABEL_TODAY": "today",
|
|
12
12
|
"LABEL_TOMORROW": "yesterday",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"Sunday"
|
|
23
23
|
],
|
|
24
24
|
"LABEL_SEND": "Send",
|
|
25
|
-
"LABEL_CHAT":"Chat",
|
|
25
|
+
"LABEL_CHAT": "Chat",
|
|
26
26
|
"ID_CONVERSATION": "Id conversation",
|
|
27
27
|
"LABEL_CREATED_THE": "group created on",
|
|
28
28
|
"LABEL_INFO_ATTRIBUTE": "Attributes",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"LABEL_VIDEO_CHAT": "Video call",
|
|
48
48
|
"LABEL_LEAVE_GROUP": "Leave the group",
|
|
49
49
|
"LABEL_CLOSE_GROUP": "Close",
|
|
50
|
-
"LABEL_OPEN_INFO_CONVERSATION":"Open conversation details",
|
|
50
|
+
"LABEL_OPEN_INFO_CONVERSATION": "Open conversation details",
|
|
51
51
|
"ALERT_TITLE": "Attention!",
|
|
52
52
|
"CLOSE_ALERT_CONFIRM_LABEL": "OK",
|
|
53
53
|
"CLOSE_ALERT_CANCEL_LABEL": "CANCEL",
|
|
@@ -69,11 +69,11 @@
|
|
|
69
69
|
"INFO_SUPPORT_USER_ADDED_MESSAGE": "{{ subject }} {{ verb }} {{ complement }}",
|
|
70
70
|
"INFO_SUPPORT_CHAT_REOPENED": "Chat reopened",
|
|
71
71
|
"INFO_SUPPORT_CHAT_CLOSED": "Chat closed",
|
|
72
|
-
"INFO_SUPPORT_LEAD_UPDATED":"Lead updated",
|
|
73
|
-
"INFO_SUPPORT_MEMBER_LEFT_GROUP":"removed from group",
|
|
74
|
-
"INFO_SUPPORT_MEMBER_ABANDONED_GROUP":"has left the conversation",
|
|
72
|
+
"INFO_SUPPORT_LEAD_UPDATED": "Lead updated",
|
|
73
|
+
"INFO_SUPPORT_MEMBER_LEFT_GROUP": "removed from group",
|
|
74
|
+
"INFO_SUPPORT_MEMBER_ABANDONED_GROUP": "has left the conversation",
|
|
75
75
|
"INFO_A_NEW_SUPPORT_REQUEST_HAS_BEEN_ASSIGNED_TO_YOU": "A new support request has been assigned to you",
|
|
76
|
-
"INFO_SUPPORT_LIVE_PAGE":"Moved to",
|
|
76
|
+
"INFO_SUPPORT_LIVE_PAGE": "Moved to",
|
|
77
77
|
"LABEL_PROFILE": "Profile",
|
|
78
78
|
"LABEL_CLOSE": "Closed",
|
|
79
79
|
"LABEL_DISCONNECT": "Disconnect",
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
"LABEL_CLOSED": "Closed",
|
|
105
105
|
"LABEL_INFO": "Informations",
|
|
106
106
|
"ALERT_NOTIFICATION": "Warning: sending notifications is disabled, changes the browser settings to allow sending notifications.",
|
|
107
|
-
"ALERT_NO_CONNECTION":"Our apologies. There was some trouble connecting to network",
|
|
107
|
+
"ALERT_NO_CONNECTION": "Our apologies. There was some trouble connecting to network",
|
|
108
108
|
"LABEL_EXTERNAL_ID": "External Id",
|
|
109
109
|
"LABEL_IAT": "Iat",
|
|
110
110
|
"LABEL_REQUEST_DETAIL": "Request detail",
|
|
@@ -168,8 +168,8 @@
|
|
|
168
168
|
"WAITING_TIME_FOUND": "The team typically replies in $reply_time",
|
|
169
169
|
"WAITING_TIME_NOT_FOUND": "The team will reply as soon as possible",
|
|
170
170
|
"CLOSED": "CLOSED",
|
|
171
|
-
"DIRECT_CHAT":"Direct chat",
|
|
172
|
-
"GROUP_CHAT":"Group chat",
|
|
171
|
+
"DIRECT_CHAT": "Direct chat",
|
|
172
|
+
"GROUP_CHAT": "Group chat",
|
|
173
173
|
"PleaseSelectChatToStartMessaging": "Please select a chat to start messaging",
|
|
174
174
|
"FromThisAreNew": "------------------",
|
|
175
175
|
"Preview": "Preview",
|
|
@@ -218,35 +218,35 @@
|
|
|
218
218
|
"PaydPlanNamePro": "Pro Plan",
|
|
219
219
|
"PaydPlanNameEnterprise": "Enterprise plan",
|
|
220
220
|
"ProPlanTrial": "Pro Plan (trial)",
|
|
221
|
-
"FreePlan":"Free Plan",
|
|
221
|
+
"FreePlan": "Free Plan",
|
|
222
222
|
"SubscriptionPaymentProblem": "Subscription payment problem",
|
|
223
223
|
"ThePlanHasExpired": "The plan has expired",
|
|
224
224
|
"owner": "Owner",
|
|
225
225
|
"admin": "Administrator",
|
|
226
226
|
"agent": "Agent",
|
|
227
227
|
"Conversations": "Conversations",
|
|
228
|
-
"Apps":"Apps",
|
|
229
|
-
"Analytics":"Analytics",
|
|
228
|
+
"Apps": "Apps",
|
|
229
|
+
"Analytics": "Analytics",
|
|
230
230
|
"Activities": "Activities",
|
|
231
231
|
"History": "History",
|
|
232
232
|
"Settings": "Settings",
|
|
233
233
|
"Resolve": "Resolve",
|
|
234
234
|
"Archive": "Archive",
|
|
235
|
-
"JOIN_CONVERSATION":"Join conversation",
|
|
236
|
-
"COPY":"Copy",
|
|
237
|
-
"COPY_MESSAGE_TOAST":"<b> Copied to clipboard!</b> Paste it wherever you like.",
|
|
238
|
-
"ActionNotAllowed":"Action not allowed",
|
|
239
|
-
"YouAreNoLongerAmongTheTeammatesManagingThisConversation":"You are no longer among the teammates managing this conversation",
|
|
240
|
-
"TicketSuccessfullyCreated":"Ticket successfully created",
|
|
241
|
-
"Continue":"Continue",
|
|
242
|
-
"ViewArchivedConversations":"Archived conversations",
|
|
243
|
-
"ViewContactsList":"Contacts list",
|
|
244
|
-
"ViewedPage":"Viewed Page",
|
|
245
|
-
"AddAsCannedResponse":"Add as canned response",
|
|
246
|
-
"AddNewCannedResponse":"Add a new canned response",
|
|
247
|
-
"TitleIsRequired":"Title is required",
|
|
248
|
-
"MessageIsRequired":"Message is required",
|
|
249
|
-
"Already_present_in_the_dashboard_json":"........",
|
|
235
|
+
"JOIN_CONVERSATION": "Join conversation",
|
|
236
|
+
"COPY": "Copy",
|
|
237
|
+
"COPY_MESSAGE_TOAST": "<b> Copied to clipboard!</b> Paste it wherever you like.",
|
|
238
|
+
"ActionNotAllowed": "Action not allowed",
|
|
239
|
+
"YouAreNoLongerAmongTheTeammatesManagingThisConversation": "You are no longer among the teammates managing this conversation",
|
|
240
|
+
"TicketSuccessfullyCreated": "Ticket successfully created",
|
|
241
|
+
"Continue": "Continue",
|
|
242
|
+
"ViewArchivedConversations": "Archived conversations",
|
|
243
|
+
"ViewContactsList": "Contacts list",
|
|
244
|
+
"ViewedPage": "Viewed Page",
|
|
245
|
+
"AddAsCannedResponse": "Add as canned response",
|
|
246
|
+
"AddNewCannedResponse": "Add a new canned response",
|
|
247
|
+
"TitleIsRequired": "Title is required",
|
|
248
|
+
"MessageIsRequired": "Message is required",
|
|
249
|
+
"Already_present_in_the_dashboard_json": "........",
|
|
250
250
|
"CreateTicket": "Create ticket",
|
|
251
251
|
"Requester": "Requester",
|
|
252
252
|
"ViewRequesterDetails": "View requester details",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
Chat21Client
|
|
3
3
|
|
|
4
|
-
v0.1.12.
|
|
4
|
+
v0.1.12.6
|
|
5
5
|
|
|
6
6
|
@Author Andrea Sponziello
|
|
7
7
|
@Member Gabriele Panico
|
|
@@ -24,6 +24,7 @@ class Chat21Client {
|
|
|
24
24
|
this.reconnections = 0 // just to check how many reconnections
|
|
25
25
|
this.client_id = this.uuidv4();
|
|
26
26
|
this.log = options.log ? true : false;
|
|
27
|
+
|
|
27
28
|
if (options && options.MQTTendpoint) {
|
|
28
29
|
if (options.MQTTendpoint.startsWith('/')) {
|
|
29
30
|
if (this.log) {
|
|
@@ -99,7 +100,7 @@ class Chat21Client {
|
|
|
99
100
|
}
|
|
100
101
|
|
|
101
102
|
sendMessage(text, type, recipient_id, recipient_fullname, sender_fullname, attributes, metadata, channel_type, callback) {
|
|
102
|
-
// console.log("sendMessage:",
|
|
103
|
+
// console.log("sendMessage sattributes:", attributes);
|
|
103
104
|
let dest_topic = `apps/${this.appid}/outgoing/users/${this.user_id}/messages/${recipient_id}/outgoing`
|
|
104
105
|
// console.log("dest_topic:", dest_topic)
|
|
105
106
|
let outgoing_message = {
|
|
@@ -549,6 +550,7 @@ class Chat21Client {
|
|
|
549
550
|
}
|
|
550
551
|
this.subscribeToMyConversations(() => {
|
|
551
552
|
// no more than one "on_message" handler, thanks.
|
|
553
|
+
// console.log("Subscribed to MyConversations.");
|
|
552
554
|
this.on_message_handler = this.client.on('message', (topic, message) => {
|
|
553
555
|
if (this.log) {
|
|
554
556
|
console.log("topic:" + topic + "\nmessage payload:" + message)
|
|
@@ -628,6 +630,7 @@ class Chat21Client {
|
|
|
628
630
|
if (topic.includes("/messages/") && topic.endsWith(_CLIENTADDED)) {
|
|
629
631
|
if (this.onMessageAddedCallbacks) {
|
|
630
632
|
this.onMessageAddedCallbacks.forEach((callback, handler, map) => {
|
|
633
|
+
// console.log("DEBUG: MESSAGE:", message)
|
|
631
634
|
callback(JSON.parse(message.toString()), _topic)
|
|
632
635
|
});
|
|
633
636
|
}
|
|
@@ -922,6 +925,7 @@ class Chat21Client {
|
|
|
922
925
|
})
|
|
923
926
|
.then(function (response) {
|
|
924
927
|
if (log) {console.log("response.status:", response.status);}
|
|
928
|
+
// if (log) {console.log("response.data:", response.data);}
|
|
925
929
|
if (callback) {
|
|
926
930
|
callback(null, response.headers, response.data);
|
|
927
931
|
}
|
|
@@ -990,6 +994,7 @@ class Chat21Client {
|
|
|
990
994
|
}
|
|
991
995
|
if (this.log) {console.log("starting mqtt connection with LWT on:", this.presence_topic, this.endpoint)}
|
|
992
996
|
// client = mqtt.connect('mqtt://127.0.0.1:15675/ws',options)
|
|
997
|
+
//console.log("starting mqtt connection with LWT on:", this.presence_topic, this.endpoint)
|
|
993
998
|
this.client = mqtt.connect(this.endpoint,options)
|
|
994
999
|
|
|
995
1000
|
this.client.on('connect', // TODO if token is wrong it must reply with an error!
|
|
@@ -998,8 +1003,9 @@ class Chat21Client {
|
|
|
998
1003
|
if (!this.connected) {
|
|
999
1004
|
if (this.log) {console.log("Chat client first connection for:" + user_id)}
|
|
1000
1005
|
this.connected = true
|
|
1006
|
+
callback();
|
|
1001
1007
|
this.start( () => {
|
|
1002
|
-
callback();
|
|
1008
|
+
// callback();
|
|
1003
1009
|
});
|
|
1004
1010
|
}
|
|
1005
1011
|
this.client.publish(
|
|
@@ -13,15 +13,15 @@ export interface Project {
|
|
|
13
13
|
user_available?: boolean;
|
|
14
14
|
profile_name?: any;
|
|
15
15
|
profile_agents?: any;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
profile_type?: string;
|
|
20
|
-
|
|
16
|
+
trialExpired?: any;
|
|
17
|
+
trialDaysLeft?: number;
|
|
18
|
+
trialDays?: number;
|
|
19
|
+
// profile_type?: string;
|
|
20
|
+
isActiveSubscription?: boolean;
|
|
21
21
|
profile?: any;
|
|
22
|
-
subscription_end_date?: any;
|
|
23
|
-
subscription_id?: any;
|
|
24
|
-
subscription_creation_date?: any;
|
|
25
|
-
subscription_start_date?: any;
|
|
22
|
+
// subscription_end_date?: any;
|
|
23
|
+
// subscription_id?: any;
|
|
24
|
+
// subscription_creation_date?: any;
|
|
25
|
+
// subscription_start_date?: any;
|
|
26
26
|
__v?: any;
|
|
27
27
|
}
|
|
@@ -3,7 +3,6 @@ import { Injectable } from '@angular/core';
|
|
|
3
3
|
import { BehaviorSubject } from 'rxjs';
|
|
4
4
|
|
|
5
5
|
// models
|
|
6
|
-
import { ImageRepoService } from './image-repo.service';
|
|
7
6
|
import { ConversationModel } from './../../models/conversation';
|
|
8
7
|
// import { ImageRepoService } from './image-repo.service';
|
|
9
8
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { HttpClient } from '@angular/common/http';
|
|
2
2
|
import { Injectable } from '@angular/core';
|
|
3
3
|
import { BehaviorSubject, Observable, Subject } from 'rxjs';
|
|
4
|
-
import { AppConfigProvider } from 'src/app/services/app-config';
|
|
5
4
|
import { GroupModel } from 'src/chat21-core/models/group';
|
|
6
5
|
import { UserModel } from 'src/chat21-core/models/user';
|
|
7
6
|
|
|
@@ -19,7 +19,7 @@ export abstract class NotificationsService {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
abstract initialize(tenant: string, vapidKey: string): void;
|
|
22
|
+
abstract initialize(tenant: string, vapidKey: string, platform: string): void;
|
|
23
23
|
abstract getNotificationPermissionAndSaveToken(currentUserUid: string): void;
|
|
24
24
|
abstract removeNotificationsInstance(callback: (string) => void): void;
|
|
25
25
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Platform } from '@ionic/angular';
|
|
1
2
|
import { Injectable } from '@angular/core';
|
|
2
3
|
// services
|
|
3
4
|
import { NotificationsService } from '../abstract/notifications.service';
|
|
@@ -8,6 +9,7 @@ import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service
|
|
|
8
9
|
import firebase from "firebase/app";
|
|
9
10
|
import 'firebase/messaging';
|
|
10
11
|
import 'firebase/auth';
|
|
12
|
+
import { FCM } from 'cordova-plugin-fcm-with-dependecy-updated/ionic/ngx';
|
|
11
13
|
|
|
12
14
|
@Injectable({ providedIn: 'root' })
|
|
13
15
|
|
|
@@ -17,16 +19,17 @@ export class FirebaseNotifications extends NotificationsService {
|
|
|
17
19
|
private userId: string;
|
|
18
20
|
private tenant: string;
|
|
19
21
|
private vapidkey: string;
|
|
22
|
+
private platform: string;
|
|
20
23
|
private logger: LoggerService = LoggerInstance.getInstance();
|
|
21
|
-
constructor() {
|
|
24
|
+
constructor(private fcm: FCM) {
|
|
22
25
|
super();
|
|
23
26
|
}
|
|
24
27
|
|
|
25
|
-
initialize(tenant: string, vapId: string): void {
|
|
28
|
+
initialize(tenant: string, vapId: string, platform: string): void {
|
|
26
29
|
this.tenant = tenant
|
|
27
30
|
this.vapidkey = vapId
|
|
28
|
-
this.
|
|
29
|
-
|
|
31
|
+
platform === 'desktop'? this.platform = 'ionic' : this.platform = platform
|
|
32
|
+
this.logger.log('[FIREBASE-NOTIFICATIONS] initialize - tenant ', this.tenant, this.platform)
|
|
30
33
|
|
|
31
34
|
if (!('serviceWorker' in navigator)) {
|
|
32
35
|
// , disable or hide UI.
|
|
@@ -73,16 +76,6 @@ export class FirebaseNotifications extends NotificationsService {
|
|
|
73
76
|
this.logger.log('initialize FROM [APP-COMP] - [FIREBASE-NOTIFICATIONS] calling requestPermission - tenant ', this.tenant, ' currentUserUid ', currentUserUid)
|
|
74
77
|
// this.logger.log('[FIREBASE-NOTIFICATIONS] calling requestPermission - currentUserUid ', currentUserUid)
|
|
75
78
|
this.userId = currentUserUid;
|
|
76
|
-
// Service Worker explicit registration to explicitly define sw location at a path,
|
|
77
|
-
// const swRegistration = async () => {
|
|
78
|
-
// try {
|
|
79
|
-
// await navigator.serviceWorker.register('http://localhost:8101/firebase-messaging-sw.js');
|
|
80
|
-
// } catch (error) {
|
|
81
|
-
// console.error(error);
|
|
82
|
-
// }
|
|
83
|
-
// }
|
|
84
|
-
|
|
85
|
-
|
|
86
79
|
|
|
87
80
|
if (firebase.messaging.isSupported()) {
|
|
88
81
|
const messaging = firebase.messaging();
|
|
@@ -103,6 +96,28 @@ export class FirebaseNotifications extends NotificationsService {
|
|
|
103
96
|
});
|
|
104
97
|
} else {
|
|
105
98
|
this.logger.log('[FIREBASE-NOTIFICATIONS] >>>> FIREBASE MESSAGING IS NOT SUPPORTED')
|
|
99
|
+
|
|
100
|
+
if(this.platform == 'android' || this.platform === 'ios'){
|
|
101
|
+
this.logger.log('[MQTTNotificationService] >>>> FIREBASE MESSAGING: use FCM plugin')
|
|
102
|
+
this.fcm.onTokenRefresh().subscribe(FCMtoken => {
|
|
103
|
+
// Register your new token in your back-end if you want
|
|
104
|
+
// backend.registerToken(token);
|
|
105
|
+
this.FCMcurrentToken = FCMtoken;
|
|
106
|
+
console.log("[MQTTNotificationService] FCM: onTokenRefresh --->", FCMtoken);
|
|
107
|
+
this.updateToken(FCMtoken, currentUserUid)
|
|
108
|
+
});
|
|
109
|
+
this.fcm.requestPushPermission().then((permission) => {
|
|
110
|
+
console.log("[MQTTNotificationService] FCM: requestPushPermission --->", permission);
|
|
111
|
+
if(permission === true){
|
|
112
|
+
this.fcm.getToken().then(FCMtoken => {
|
|
113
|
+
console.log("[MQTTNotificationService] FCM: getToken --->", FCMtoken);
|
|
114
|
+
this.FCMcurrentToken = FCMtoken;
|
|
115
|
+
this.updateToken(FCMtoken, currentUserUid)
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
}
|
|
106
121
|
}
|
|
107
122
|
}
|
|
108
123
|
|
|
@@ -229,7 +244,7 @@ export class FirebaseNotifications extends NotificationsService {
|
|
|
229
244
|
const device_model = {
|
|
230
245
|
device_model: navigator.userAgent,
|
|
231
246
|
language: navigator.language,
|
|
232
|
-
platform:
|
|
247
|
+
platform: this.platform,
|
|
233
248
|
platform_version: this.BUILD_VERSION
|
|
234
249
|
}
|
|
235
250
|
|
|
@@ -99,7 +99,6 @@ export class MQTTConversationHandler extends ConversationHandlerService {
|
|
|
99
99
|
}
|
|
100
100
|
this.chat21Service.chatClient.lastMessages(this.conversationWith, (err, messages) => {
|
|
101
101
|
if (!err) {
|
|
102
|
-
this.logger.log('[MQTTConversationHandlerSERVICE] message lastMessages:', messages);
|
|
103
102
|
messages.sort(compareValues('timestamp', 'asc'));
|
|
104
103
|
messages.forEach(message => {
|
|
105
104
|
const msg: MessageModel = message;
|
|
@@ -254,11 +254,11 @@ export class MQTTConversationsHandler extends ConversationsHandlerService {
|
|
|
254
254
|
conversation.conversation_with = conversation.conversWith // conversWith comes from remote
|
|
255
255
|
}
|
|
256
256
|
|
|
257
|
-
|
|
258
|
-
|
|
257
|
+
//skip info message updates
|
|
258
|
+
if(messageType(MESSAGE_TYPE_INFO, conversation) ){
|
|
259
259
|
return;
|
|
260
260
|
}
|
|
261
|
-
|
|
261
|
+
|
|
262
262
|
|
|
263
263
|
const index = searchIndexInArrayForUid(this.conversations, conversation.conversation_with);
|
|
264
264
|
const oldConversation = this.conversations[index]
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
2
1
|
import { Injectable } from '@angular/core';
|
|
3
2
|
// services
|
|
4
3
|
import { NotificationsService } from '../abstract/notifications.service';
|
|
5
4
|
import { LoggerInstance } from '../logger/loggerInstance';
|
|
6
5
|
import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
|
|
6
|
+
import { FCM } from 'cordova-plugin-fcm-with-dependecy-updated/ionic/ngx';
|
|
7
7
|
// firebase
|
|
8
8
|
import firebase from "firebase/app";
|
|
9
9
|
import 'firebase/messaging';
|
|
@@ -21,22 +21,26 @@ export class MQTTNotifications extends NotificationsService {
|
|
|
21
21
|
private userId: string;
|
|
22
22
|
private tenant: string;
|
|
23
23
|
private vapidkey: string;
|
|
24
|
+
private platform: string;
|
|
24
25
|
private logger: LoggerService = LoggerInstance.getInstance();
|
|
25
26
|
|
|
26
27
|
constructor(
|
|
27
|
-
public chat21Service: Chat21Service
|
|
28
|
+
public chat21Service: Chat21Service,
|
|
29
|
+
private fcm: FCM
|
|
28
30
|
) {
|
|
29
31
|
super();
|
|
30
32
|
}
|
|
31
33
|
|
|
32
|
-
initialize(tenant: string, vapId: string): void {
|
|
34
|
+
initialize(tenant: string, vapId: string, platform: string): void {
|
|
33
35
|
this.tenant = tenant;
|
|
34
36
|
this.vapidkey = vapId;
|
|
37
|
+
platform === 'desktop'? this.platform = 'ionic' : this.platform = platform
|
|
38
|
+
this.logger.log('[MQTTNotificationService] initialize - tenant ', this.tenant, this.platform)
|
|
35
39
|
return;
|
|
36
40
|
}
|
|
37
41
|
|
|
38
42
|
getNotificationPermissionAndSaveToken(currentUserUid) {
|
|
39
|
-
this.logger.log("[MQTTNotificationService] getNotificationPermissionAndSaveToken()",currentUserUid
|
|
43
|
+
this.logger.log("[MQTTNotificationService] getNotificationPermissionAndSaveToken()",currentUserUid);
|
|
40
44
|
this.userId = currentUserUid;
|
|
41
45
|
if (firebase.messaging.isSupported()) {
|
|
42
46
|
this.logger.log("[MQTTNotificationService] firebase.messaging.isSupported -> YES");
|
|
@@ -58,6 +62,28 @@ export class MQTTNotifications extends NotificationsService {
|
|
|
58
62
|
});
|
|
59
63
|
} else {
|
|
60
64
|
this.logger.log('[MQTTNotificationService] >>>> FIREBASE MESSAGING IS NOT SUPPORTED')
|
|
65
|
+
|
|
66
|
+
if(this.platform == 'android' || this.platform === 'ios'){
|
|
67
|
+
this.logger.log('[MQTTNotificationService] >>>> FIREBASE MESSAGING: use FCM plugin')
|
|
68
|
+
this.fcm.onTokenRefresh().subscribe(FCMtoken => {
|
|
69
|
+
// Register your new token in your back-end if you want
|
|
70
|
+
// backend.registerToken(token);
|
|
71
|
+
this.FCMcurrentToken = FCMtoken;
|
|
72
|
+
console.log("[MQTTNotificationService] FCM: onTokenRefresh --->", FCMtoken);
|
|
73
|
+
this.saveToken(FCMtoken, currentUserUid)
|
|
74
|
+
});
|
|
75
|
+
this.fcm.requestPushPermission().then((permission) => {
|
|
76
|
+
console.log("[MQTTNotificationService] FCM: requestPushPermission --->", permission);
|
|
77
|
+
if(permission === true){
|
|
78
|
+
this.fcm.getToken().then(FCMtoken => {
|
|
79
|
+
console.log("[MQTTNotificationService] FCM: getToken --->", FCMtoken);
|
|
80
|
+
this.FCMcurrentToken = FCMtoken;
|
|
81
|
+
this.saveToken(FCMtoken, currentUserUid)
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
}
|
|
61
87
|
}
|
|
62
88
|
}
|
|
63
89
|
|
|
@@ -104,7 +130,7 @@ export class MQTTNotifications extends NotificationsService {
|
|
|
104
130
|
const device_model = {
|
|
105
131
|
device_model: navigator.userAgent,
|
|
106
132
|
language: navigator.language,
|
|
107
|
-
platform:
|
|
133
|
+
platform: this.platform,
|
|
108
134
|
platform_version: this.BUILD_VERSION
|
|
109
135
|
}
|
|
110
136
|
this.chat21Service.chatClient.saveInstance(FCMcurrentToken,device_model,(err, response) => {
|
|
@@ -132,8 +132,6 @@ export class TiledeskAuthService {
|
|
|
132
132
|
logOut() {
|
|
133
133
|
this.logger.log('[TILEDESK-AUTH] - LOGOUT')
|
|
134
134
|
this.appStorage.removeItem('tiledeskToken')
|
|
135
|
-
this.appStorage.removeItem('currentUser')
|
|
136
|
-
|
|
137
135
|
this.appStorage.removeItem('currentUser')
|
|
138
136
|
this.setCurrentUser(null);
|
|
139
137
|
// this.isOnline$.next(false)
|
|
@@ -129,6 +129,12 @@ export const LogLevel = {
|
|
|
129
129
|
'DEBUG': 3
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
+
export enum PLAN_NAME {
|
|
133
|
+
A = 'Growth',
|
|
134
|
+
B = 'Scale',
|
|
135
|
+
C = 'Plus',
|
|
136
|
+
}
|
|
137
|
+
|
|
132
138
|
export const tranlatedLanguage = ['it', 'en', 'de', 'es', 'pt', 'fr', 'ru', 'tr', 'sr', 'ar', 'uk', 'sv', 'az', 'kk', 'uz']
|
|
133
139
|
|
|
134
140
|
|
|
@@ -2,7 +2,7 @@ import { TYPE_DIRECT, TYPE_SUPPORT_GROUP } from 'src/chat21-core/utils/constants
|
|
|
2
2
|
import { ConversationModel } from 'src/chat21-core/models/conversation';
|
|
3
3
|
import { Inject, Injectable, OnInit } from '@angular/core';
|
|
4
4
|
import { avatarPlaceholder, getColorBck } from './utils-user';
|
|
5
|
-
import moment from 'moment';
|
|
5
|
+
import * as moment from 'moment';
|
|
6
6
|
|
|
7
7
|
@Injectable()
|
|
8
8
|
export class ConvertRequestToConversation {
|
|
@@ -27,10 +27,10 @@ export function isFrame(message: any) {
|
|
|
27
27
|
|
|
28
28
|
/** */
|
|
29
29
|
export function isFile(message: any) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
if (message && message.type && message.type === 'file' && message.metadata && message.metadata.src && !message.metadata.type.includes('audio')) {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
return false;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
export function isAudio(message: any) {
|