@chat21/chat21-ionic 3.0.97-rc.5 → 3.0.97

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 CHANGED
@@ -1,5 +1,7 @@
1
1
  # chat21-ionic ver 3.0
2
2
 
3
+ ### 3.0.97 in PROD
4
+
3
5
  ### 3.0.97-rc.5
4
6
  - added: whatsapp templates section to send an already configured whatsapp templete only in case of a whatsapp conversation channel type
5
7
  - added: channel input var in message-text-area component to manage the type of current conversation
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@chat21/chat21-ionic",
3
3
  "author": "Tiledesk SRL",
4
- "version": "3.0.97-rc.5",
4
+ "version": "3.0.97",
5
5
  "license": "MIT License",
6
6
  "homepage": "https://tiledesk.com/",
7
7
  "repository": {
@@ -1151,16 +1151,16 @@ export class AppComponent implements OnInit {
1151
1151
 
1152
1152
  this.router.navigateByUrl('conversation-detail/'); //redirect to basePage
1153
1153
  if(this.IS_ON_MOBILE_DEVICE){
1154
- clearTimeout(this.timeModalLogin);
1155
- this.timeModalLogin = setTimeout(() => {
1156
- if (!this.hadBeenCalledOpenModal) {
1157
- this.authModal = this.presentModal('initAuthentication');
1158
- this.hadBeenCalledOpenModal = true;
1159
- }
1160
- }, 1000)
1161
- }else{
1162
- this.goToDashboardLogin()
1163
- }
1154
+ clearTimeout(this.timeModalLogin);
1155
+ this.timeModalLogin = setTimeout(() => {
1156
+ if (!this.hadBeenCalledOpenModal) {
1157
+ this.authModal = this.presentModal('initAuthentication');
1158
+ this.hadBeenCalledOpenModal = true;
1159
+ }
1160
+ }, 1000)
1161
+ }else{
1162
+ this.goToDashboardLogin()
1163
+ }
1164
1164
 
1165
1165
 
1166
1166
  // if (!this.hadBeenCalledOpenModal) {
@@ -85,7 +85,7 @@ export class MessageTextAreaComponent implements OnInit, AfterViewInit, OnChange
85
85
  addWhiteSpaceBefore: boolean;
86
86
  emojiPerLine: number = 9
87
87
  emojiColor: string ="#3880ff"
88
- emojiiCategories = [ 'recent', 'people', 'nature', 'activity'] //, 'custom']
88
+ emojiiCategories = [ 'recent', 'people', 'nature', 'activity', 'flags'] //, 'custom']
89
89
 
90
90
  customEmojis = [
91
91
  {
@@ -146,7 +146,7 @@ export class MessageTextAreaComponent implements OnInit, AfterViewInit, OnChange
146
146
 
147
147
  }
148
148
  this.logger.log('[CONVS-DETAIL] - returnChangeTextArea ngOnChanges in [MSG-TEXT-AREA] this.tagsCannedFilter.length ', this.tagsCannedFilter.length)
149
- this.logger.log('[CONVS-DETAIL] - returnChangeTextArea ngOnChanges in [MSG-TEXT-AREA] channel', this.channel )
149
+ this.logger.log('[CONVS-DETAIL] - returnChangeTextArea ngOnChanges in [MSG-TEXT-AREA] channel', this.channel, this.whatsappTemplatesSection, this.emailSection )
150
150
 
151
151
  // use case drop
152
152
  if (this.dropEvent) {
@@ -1,5 +1,3 @@
1
- ion-content{
2
- }
3
1
 
4
2
  .content-container{
5
3
  padding-top: 40px;
@@ -1,5 +1,5 @@
1
1
  <ion-header no-border class="ion-no-border">
2
- <ion-toolbar>
2
+ <ion-toolbar class="beta">
3
3
  <ion-title *ngIf="!editTemplateView">{{ 'WHATSAPP.SELECT_MESSAGE_TEMPLATE' | translate }}</ion-title>
4
4
  <ion-title *ngIf="editTemplateView">Review and send template</ion-title>
5
5
  <ion-buttons slot="end">
@@ -338,3 +338,29 @@ ion-footer {
338
338
  }
339
339
  }
340
340
 
341
+ ion-toolbar{
342
+ &.beta:after{
343
+ content: "beta";
344
+ position: fixed;
345
+ width: 80px;
346
+ height: 25px;
347
+ background: #EE8E4A;
348
+ top: 7px;
349
+ left: -20px;
350
+ text-align: center;
351
+ font-size: 13px;
352
+ font-family: sans-serif;
353
+ text-transform: uppercase;
354
+ font-weight: bold;
355
+ color: #fff;
356
+ line-height: 27px;
357
+ transform:rotate(-45deg);
358
+ }
359
+
360
+ ion-title{
361
+ margin-left: 30px;
362
+ }
363
+ }
364
+
365
+
366
+
@@ -227,7 +227,7 @@
227
227
  [loggedUser]="loggedUser"
228
228
  [conversationWith]="conversationWith"
229
229
  [channelType]="channelType"
230
- [channel]="conversation?.attributes?.channel"
230
+ [channel]="conversation?.attributes?.request_channel"
231
231
  [tagsCannedFilter]="tagsCannedFilter"
232
232
  [tagsCannedCount]="tagsCannedCount"
233
233
  [areVisibleCAR]="areVisibleCAR"
@@ -1068,14 +1068,14 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1068
1068
  msg = `[${metadata.name}](${metadata.src})`
1069
1069
  }
1070
1070
  }
1071
- this.conversation.attributes && this.conversation.attributes['channel'] ? attributes.channel = this.conversation.attributes['channel'] : null;
1071
+ this.conversation.attributes && this.conversation.attributes['request_channel'] ? attributes.channel = this.conversation.attributes['request_channel'] : null;
1072
1072
  metadata ? (metadata = metadata) : (metadata = '')
1073
1073
  this.logger.log('[CONVS-DETAIL] attributes--->>>> 1111', this.conversation.attributes, attributes)
1074
1074
  this.logger.log('[CONVS-DETAIL] - SEND MESSAGE msg: ', msg, ' - messages: ', this.messages, ' - loggedUser: ', this.loggedUser)
1075
1075
 
1076
1076
 
1077
1077
  const emailSectionMsg = (attributes && attributes['offline_channel'] === TYPE_MSG_EMAIL)
1078
- const channelIsNotEmailOrFormOrWhatsapp = (attributes && attributes['channel'] && (attributes['channel'] === TYPE_MSG_EMAIL || attributes['channel'] === TYPE_MSG_FORM || attributes['channel'] === CHANNEL_TYPE_WHATSAPP))
1078
+ const channelIsNotEmailOrFormOrWhatsapp = (attributes && attributes['request_channel'] && (attributes['request_channel'] === TYPE_MSG_EMAIL || attributes['request_channel'] === TYPE_MSG_FORM || attributes['request_channel'] === CHANNEL_TYPE_WHATSAPP))
1079
1079
 
1080
1080
  if ((msg && msg.trim() !== '') || type !== TYPE_MSG_TEXT) {
1081
1081
 
@@ -22,8 +22,9 @@ import { AppConfigProvider } from 'src/app/services/app-config';
22
22
  // utils
23
23
  import { avatarPlaceholder, getColorBck } from '../../utils/utils-user';
24
24
  import { compareValues, conversationsPathForUserId, searchIndexInArrayForUid, isGroup } from '../../utils/utils';
25
- import { TOUCHING_OPERATOR } from '../../utils/constants';
25
+ import { MESSAGE_TYPE_INFO, TOUCHING_OPERATOR } from '../../utils/constants';
26
26
  import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
27
+ import { messageType } from 'src/chat21-core/utils/utils-message';
27
28
 
28
29
 
29
30
  // @Injectable({ providedIn: 'root' })
@@ -517,6 +518,10 @@ export class FirebaseConversationsHandler extends ConversationsHandlerService {
517
518
 
518
519
  private changed(childSnapshot: any) {
519
520
  const oldConversation = this.conversations[searchIndexInArrayForUid(this.conversations, childSnapshot.key)]
521
+ //skip info message updates
522
+ if(messageType(MESSAGE_TYPE_INFO, oldConversation) ){
523
+ return;
524
+ }
520
525
  if (this.conversationGenerate(childSnapshot)) {
521
526
  const index = searchIndexInArrayForUid(this.conversations, childSnapshot.key);
522
527
  if (index > -1) {
@@ -23,6 +23,7 @@ import {
23
23
  searchIndexInArrayForUid,
24
24
  conversationMessagesRef
25
25
  } from '../../utils/utils';
26
+ import { v4 as uuidv4 } from 'uuid';
26
27
  import { isSender, messageType } from '../../utils/utils-message';
27
28
 
28
29
 
@@ -111,7 +112,13 @@ export class MQTTConversationHandler extends ConversationHandlerService {
111
112
  this.conversationWith, (message, topic) => {
112
113
  this.logger.log('[MQTTConversationHandler] message added:', message, 'on topic:', topic);
113
114
  const msg: MessageModel = message;
114
- msg.uid = message.message_id;
115
+
116
+ //allow to replace message in unknown status (pending status: '0')
117
+ if(message.attributes && message.attributes.tempUID){
118
+ msg.uid = message.attributes.tempUID;
119
+ }else{
120
+ msg.uid = message.message_id
121
+ }
115
122
 
116
123
  this.addedMessage(msg);
117
124
  });
@@ -170,6 +177,7 @@ export class MQTTConversationHandler extends ConversationHandlerService {
170
177
  const recipientFullname = conversationWithFullname;
171
178
  const recipientId = conversationWith;
172
179
  attributes.lang = language;
180
+ attributes.tempUID = uuidv4(); //allow to show message in a pending status
173
181
  this.chat21Service.chatClient.sendMessage(
174
182
  msg,
175
183
  typeMsg,
@@ -189,6 +197,25 @@ export class MQTTConversationHandler extends ConversationHandlerService {
189
197
  }
190
198
  }
191
199
  );
200
+
201
+ const message = new MessageModel(
202
+ attributes.tempUID, //allow to show message in a pending status
203
+ language,
204
+ conversationWith,
205
+ recipientFullname,
206
+ sender,
207
+ senderFullname,
208
+ 0,
209
+ metadataMsg,
210
+ msg,
211
+ Date.now(),
212
+ typeMsg,
213
+ attributes,
214
+ channelType,
215
+ false
216
+ );
217
+ this.addedMessage(message) //allow to show message in a pending status: add pending message in array of messages
218
+
192
219
  return new MessageModel(
193
220
  '',
194
221
  language,
@@ -402,7 +429,7 @@ export class MQTTConversationHandler extends ConversationHandlerService {
402
429
  */
403
430
  private updateMessageStatusReceived(msg) {
404
431
  this.logger.log('[MQTTConversationHandler] updateMessageStatusReceived', msg);
405
- if (msg['status'] < MSG_STATUS_RECEIVED) {
432
+ if (msg['status'] < MSG_STATUS_RECEIVED && msg['status'] > 0) {
406
433
  this.logger.log('[MQTTConversationHandler] status ', msg['status'], ' < (RECEIVED:200)', MSG_STATUS_RECEIVED);
407
434
  if (msg.sender !== this.loggedUser.uid && msg.status < MSG_STATUS_RECEIVED) {
408
435
  this.logger.log('[MQTTConversationHandler] updating message with status received');
@@ -17,6 +17,8 @@ import { compareValues, conversationsPathForUserId, searchIndexInArrayForUid } f
17
17
  import { LoggerService } from '../abstract/logger.service';
18
18
  import { LoggerInstance } from '../logger/loggerInstance';
19
19
  import { THIS_EXPR } from '@angular/compiler/src/output/output_ast';
20
+ import { messageType } from 'src/chat21-core/utils/utils-message';
21
+ import { MESSAGE_TYPE_INFO } from 'src/chat21-core/utils/constants';
20
22
  // import { ImageRepoService } from '../abstract/image-repo.service';
21
23
  // import { ConsoleReporter } from 'jasmine';
22
24
 
@@ -251,6 +253,13 @@ export class MQTTConversationsHandler extends ConversationsHandlerService {
251
253
  if (!conversation.conversation_with) {
252
254
  conversation.conversation_with = conversation.conversWith // conversWith comes from remote
253
255
  }
256
+
257
+ //skip info message updates
258
+ if(messageType(MESSAGE_TYPE_INFO, conversation) ){
259
+ return;
260
+ }
261
+
262
+
254
263
  const index = searchIndexInArrayForUid(this.conversations, conversation.conversation_with);
255
264
  const oldConversation = this.conversations[index]
256
265
  if (index > -1) {