@chat21/chat21-ionic 3.0.6-2.1 → 3.0.6-2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/package.json +1 -1
  3. package/src/app/app.component.ts +81 -6
  4. package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.html +2 -0
  5. package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.ts +2 -1
  6. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.html +33 -21
  7. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.scss +26 -11
  8. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.ts +3 -1
  9. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.scss +1 -1
  10. package/src/app/components/sidebar/sidebar.component.ts +1 -1
  11. package/src/app/components/sidebar-user-details/sidebar-user-details.component.html +17 -1
  12. package/src/app/components/sidebar-user-details/sidebar-user-details.component.scss +52 -6
  13. package/src/app/components/sidebar-user-details/sidebar-user-details.component.ts +28 -0
  14. package/src/app/pages/authentication/login/login.page.ts +12 -1
  15. package/src/app/pages/conversation-detail/conversation-detail.page.ts +10 -12
  16. package/src/assets/i18n/de.json +2 -1
  17. package/src/assets/i18n/en.json +2 -1
  18. package/src/assets/i18n/es.json +2 -1
  19. package/src/assets/i18n/fr.json +2 -1
  20. package/src/assets/i18n/it.json +2 -1
  21. package/src/assets/i18n/pt.json +2 -1
  22. package/src/assets/i18n/ru.json +2 -1
  23. package/src/assets/i18n/sr.json +2 -1
  24. package/src/assets/i18n/tr.json +2 -1
  25. package/src/assets/js/chat21client.js +1 -1
  26. package/src/chat-config-pre.json +15 -3
  27. package/src/chat21-core/providers/firebase/firebase-conversation-handler.ts +2 -3
  28. package/src/chat21-core/providers/logger/customLogger.ts +2 -10
  29. package/src/chat21-core/utils/utils-message.ts +22 -8
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # chat21-ionic ver 3.0
2
2
 
3
+ ### 3.0.62.4
4
+ - Fixed bug: when the user profile is updated in the dashboard it is not updated in the chat
5
+ - Fixed bug: when is sent a message with only emojis, some emojis have the chat balloon background
6
+
7
+ ### 3.0.62.3
8
+ - Fixes the bug: the method setTyping fired twice after that a message is sent
9
+ - Other minor improvements
10
+
11
+ ### 3.0.62.2
12
+ - Fixed bug: if the teammate has the role of agent when switching from the dashboard to the chat and vice versa, the icons that only owners and admins have access to are displayed briefly in the left sidebar
13
+ - Adds the "Edit Profile" button and a link to the help center in the teammate details drawer
14
+
3
15
  ### 3.0.62.1
4
16
  - Allows agents to use the "Monitor" page
5
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chat21/chat21-ionic",
3
- "version": "3.0.62.1",
3
+ "version": "3.0.62.4",
4
4
  "author": "Tiledesk SRL",
5
5
  "homepage": "https://tiledesk.com/",
6
6
  "scripts": {
@@ -299,7 +299,7 @@ export class AppComponent implements OnInit {
299
299
  ngOnInit() {
300
300
  const appconfig = this.appConfigProvider.getConfig();
301
301
  this.logger.log('[APP-COMP] ngOnInit appconfig', appconfig)
302
- if (appconfig && appconfig.supportMode && (appconfig.supportMode === true || appconfig.supportMode === 'true' )) {
302
+ if (appconfig && appconfig.supportMode && (appconfig.supportMode === true || appconfig.supportMode === 'true')) {
303
303
  this.SUPPORT_MODE = true;
304
304
  this.logger.log('[APP-COMP] appconfig > SUPPORT_MODE', this.SUPPORT_MODE)
305
305
  } else {
@@ -564,16 +564,16 @@ export class AppComponent implements OnInit {
564
564
  } else if (browserLang && stored_preferred_lang) {
565
565
  chat_lang = stored_preferred_lang
566
566
  }
567
-
567
+
568
568
  this.logger.log('[APP-COMP] - chat_lang', chat_lang)
569
-
569
+
570
570
  if (tranlatedLanguage.includes(chat_lang)) {
571
- this.logger.log('[APP-COMP] tranlatedLanguage includes',chat_lang , ': ', tranlatedLanguage.includes(chat_lang))
571
+ this.logger.log('[APP-COMP] tranlatedLanguage includes', chat_lang, ': ', tranlatedLanguage.includes(chat_lang))
572
572
  this.translate.setDefaultLang(chat_lang)
573
573
  this.translate.use(chat_lang);
574
574
  }
575
575
  else {
576
- this.logger.log('[APP-COMP] tranlatedLanguage includes',chat_lang , ': ', tranlatedLanguage.includes(chat_lang))
576
+ this.logger.log('[APP-COMP] tranlatedLanguage includes', chat_lang, ': ', tranlatedLanguage.includes(chat_lang))
577
577
  this.translate.setDefaultLang('en');
578
578
  this.translate.use('en');
579
579
  }
@@ -659,6 +659,78 @@ export class AppComponent implements OnInit {
659
659
  }
660
660
 
661
661
 
662
+ updateStoredCurrentUser() {
663
+ const currentUser = JSON.parse(this.appStorageService.getItem('currentUser'));
664
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser', currentUser)
665
+ const dshbrdUser = JSON.parse(localStorage.getItem('user'));
666
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser', dshbrdUser)
667
+
668
+ if (currentUser.color !== dshbrdUser.fillColour) {
669
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.color !== dshbrdUser.fillColour')
670
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.color ', currentUser.color)
671
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.fillColour ', dshbrdUser.fillColour)
672
+ currentUser.color = dshbrdUser.fillColour;
673
+ } else {
674
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.color === dshbrdUser.fillColour')
675
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.color ', currentUser.color)
676
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.fillColour ', dshbrdUser.fillColour)
677
+ }
678
+
679
+ if (currentUser.firstname !== dshbrdUser.firstname) {
680
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.firstname !== dshbrdUser.firstname')
681
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.firstname ', currentUser.firstname)
682
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.firstname ', dshbrdUser.firstname)
683
+ currentUser.firstname = dshbrdUser.firstname
684
+ } else {
685
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.firstname === dshbrdUser.firstname')
686
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.firstname ', currentUser.firstname)
687
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.firstname ', dshbrdUser.firstname)
688
+
689
+ }
690
+
691
+ if (currentUser.lastname !== dshbrdUser.lastname) {
692
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.lastname !== dshbrdUser.lastname')
693
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.lastname ', currentUser.lastname)
694
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.lastname ', dshbrdUser.lastname)
695
+ currentUser.lastname = dshbrdUser.lastname
696
+ } else {
697
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.lastname === dshbrdUser.lastname')
698
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.lastname ', currentUser.lastname)
699
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.lastname ', dshbrdUser.lastname)
700
+ }
701
+
702
+ if (currentUser.avatar !== dshbrdUser.fullname_initial) {
703
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.avatar !== dshbrdUser.fullname_initial')
704
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.avatar ', currentUser.avatar)
705
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.fullname_initial ', dshbrdUser.fullname_initial )
706
+ } else {
707
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.avatar === dshbrdUser.fullname_initial')
708
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.avatar ', currentUser.avatar)
709
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.fullname_initial ', dshbrdUser.fullname_initial )
710
+ }
711
+
712
+ let fullname = ""
713
+ if (dshbrdUser.firstname && !dshbrdUser.lastname ) {
714
+ fullname = dshbrdUser.firstname
715
+ } else if (dshbrdUser.firstname && dshbrdUser.lastname) {
716
+ fullname = dshbrdUser.firstname + ' ' + dshbrdUser.lastname
717
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - fullname ', fullname)
718
+ }
719
+
720
+ if (fullname !== currentUser.fullname) {
721
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.fullname !== dshbrdUser.fullname ')
722
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.fullname ' , fullname)
723
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.fullname ', currentUser.fullname )
724
+ currentUser.fullname = fullname
725
+ } else {
726
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.fullname === dshbrdUser.fullname ')
727
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.fullname ' , fullname)
728
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.fullname ', currentUser.fullname )
729
+ }
730
+
731
+ this.appStorageService.setItem('currentUser', JSON.stringify(currentUser));
732
+ }
733
+
662
734
  /***************************************************+*/
663
735
  /**------- AUTHENTICATION FUNCTIONS --> START <--- +*/
664
736
  private initAuthentication() {
@@ -672,6 +744,9 @@ export class AppComponent implements OnInit {
672
744
  this.logger.log('[APP-COMP] >>> initAuthentication I LOG IN WITH A TOKEN EXISTING IN THE LOCAL STORAGE OR WITH A TOKEN PASSED IN THE URL PARAMETERS <<<')
673
745
  this.tiledeskAuthService.signInWithCustomToken(tiledeskToken).then(user => {
674
746
  this.logger.log('[APP-COMP] >>> initAuthentication user ', user)
747
+
748
+ this.updateStoredCurrentUser()
749
+
675
750
  this.messagingAuthService.createCustomToken(tiledeskToken)
676
751
  }).catch(error => {
677
752
  this.logger.error('[APP-COMP] initAuthentication SIGNINWITHCUSTOMTOKEN error::', error)
@@ -1007,7 +1082,7 @@ export class AppComponent implements OnInit {
1007
1082
  let platformIsNow = PLATFORM_DESKTOP;
1008
1083
  if (checkPlatformIsMobile()) {
1009
1084
  platformIsNow = PLATFORM_MOBILE;
1010
- this.logger.log('onResize platformIsNow ', platformIsNow)
1085
+ this.logger.log('onResize platformIsNow ', platformIsNow)
1011
1086
  }
1012
1087
  if (!this.platformIs || this.platformIs === '') {
1013
1088
  this.platformIs = platformIsNow;
@@ -28,6 +28,7 @@
28
28
  <!--backgroundColor non viene ancora usato -->
29
29
  <tiledeskwidget-bubble-message class="messages msg_sent slide-in-right"
30
30
  [ngClass]="{'button-in-msg' : message?.metadata && message?.metadata?.button}"
31
+ [class.chat-text-emoticon]="isEmojii(message?.text)"
31
32
  [message]="message"
32
33
  [textColor]="'col-msg-sent'"
33
34
  (onBeforeMessageRender)="returnOnBeforeMessageRender($event)"
@@ -54,6 +55,7 @@
54
55
 
55
56
  <!--backgroundColor non viene ancora usato -->
56
57
  <tiledeskwidget-bubble-message class="messages msg_receive slide-in-left"
58
+ [class.chat-text-emoticon]="isEmojii(message?.text)"
57
59
  [message]="message"
58
60
  [textColor]="'black'"
59
61
  (onBeforeMessageRender)="returnOnBeforeMessageRender($event)"
@@ -5,7 +5,7 @@ import { MSG_STATUS_SENT, MSG_STATUS_RETURN_RECEIPT, MSG_STATUS_SENT_SERVER, MAX
5
5
  import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
6
6
  import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
7
7
  import { UploadService } from 'src/chat21-core/providers/abstract/upload.service';
8
- import { isInfo, isMine, messageType } from 'src/chat21-core/utils/utils-message';
8
+ import { isEmojii, isInfo, isMine, messageType } from 'src/chat21-core/utils/utils-message';
9
9
  @Component({
10
10
  selector: 'tiledeskwidget-conversation-content',
11
11
  templateUrl: './conversation-content.component.html',
@@ -49,6 +49,7 @@ export class ConversationContentComponent implements OnInit {
49
49
  isMine = isMine;
50
50
  isInfo = isInfo;
51
51
  messageType = messageType;
52
+ isEmojii = isEmojii;
52
53
 
53
54
  MESSAGE_TYPE_INFO = MESSAGE_TYPE_INFO;
54
55
  MESSAGE_TYPE_MINE = MESSAGE_TYPE_MINE;
@@ -68,9 +68,9 @@
68
68
  </div>
69
69
  </ng-container>
70
70
 
71
- <div class="align-center" class="ion-text-center" *ngIf="messageType(MESSAGE_TYPE_INFO, message)"
72
- class="msg_info_container">
73
- <chat-info-message class="messages" [message]="message">
71
+ <div class="align-center ion-text-center msg_info_container" *ngIf="messageType(MESSAGE_TYPE_INFO, message)">
72
+ <chat-info-message class="messages"
73
+ [message]="message">
74
74
  </chat-info-message>
75
75
  </div>
76
76
 
@@ -78,19 +78,25 @@
78
78
  <div role="messaggio" *ngIf="messageType(MESSAGE_TYPE_MINE, message)" class="msg_container base_sent">
79
79
 
80
80
  <!--backgroundColor non viene ancora usato -->
81
-
82
- <chat-bubble-message style="position: relative;"
83
- [ngClass]="{'has-metadata': (isImage(message) || isFrame(message))}" class="messages msg_sent"
84
- id="message_msg_sent" [ngClass]="{'button-in-msg' : message.metadata && message.metadata.button}"
85
- [message]="message" [textColor]="'col-msg-sent'" (onBeforeMessageRender)="returnOnBeforeMessageRender($event)"
86
- (onAfterMessageRender)="returnOnAfterMessageRender($event)" (onImageRendered)="onImageRenderedFN($event)"
87
- [addAsCannedResponseTooltipText]="addAsCannedResponseTooltipText" [areVisibleCAR]="areVisibleCAR"
81
+ <chat-bubble-message class="messages msg_sent" id="message_msg_sent" style="position: relative;"
82
+ [ngClass]="{'has-metadata': (isImage(message) || isFrame(message))}"
83
+ [class.emoticon]="isEmojii_2(message?.text)"
84
+ [ngClass]="{'button-in-msg' : message.metadata && message.metadata.button}"
85
+ [message]="message"
86
+ [textColor]="'col-msg-sent'"
87
+ [addAsCannedResponseTooltipText]="addAsCannedResponseTooltipText"
88
+ [areVisibleCAR]="areVisibleCAR"
88
89
  [support_mode]="support_mode"
89
- [class.emoticon]="message?.emoticon">
90
+ (onBeforeMessageRender)="returnOnBeforeMessageRender($event)"
91
+ (onAfterMessageRender)="returnOnAfterMessageRender($event)"
92
+ (onImageRendered)="onImageRenderedFN($event)">
90
93
  </chat-bubble-message>
91
94
 
92
95
  <!-- icon status message -->
93
- <chat-return-receipt [status]="message.status" [message]="message" [senderId]="senderId">
96
+ <chat-return-receipt
97
+ [status]="message.status"
98
+ [message]="message"
99
+ [senderId]="senderId">
94
100
  </chat-return-receipt>
95
101
 
96
102
  </div>
@@ -112,21 +118,27 @@
112
118
 
113
119
  <!--backgroundColor non viene ancora usato -->
114
120
 
115
- <chat-bubble-message style="position: relative;"
116
- [ngClass]="{'has-metadata': (isImage(message) || isFrame(message))}" class="messages msg_receive"
117
- id="message_msg_receive" [message]="message" [textColor]="'black'"
118
- (onBeforeMessageRender)="returnOnBeforeMessageRender($event)"
119
- (onAfterMessageRender)="returnOnAfterMessageRender($event)" (onImageRendered)="onImageRenderedFN($event)"
120
- [addAsCannedResponseTooltipText]="addAsCannedResponseTooltipText" [areVisibleCAR]="areVisibleCAR"
121
+ <chat-bubble-message class="messages msg_receive" id="message_msg_receive" style="position: relative;"
122
+ [ngClass]="{'has-metadata': (isImage(message) || isFrame(message))}"
123
+ [class.emoticon]="isEmojii_2(message?.text)"
124
+ [message]="message"
125
+ [textColor]="'black'"
126
+ [addAsCannedResponseTooltipText]="addAsCannedResponseTooltipText"
127
+ [areVisibleCAR]="areVisibleCAR"
121
128
  [support_mode]="support_mode"
122
- [class.emoticon]="message?.emoticon">
129
+ (onBeforeMessageRender)="returnOnBeforeMessageRender($event)"
130
+ (onAfterMessageRender)="returnOnAfterMessageRender($event)"
131
+ (onImageRendered)="onImageRenderedFN($event)"
132
+ >
123
133
  </chat-bubble-message>
124
134
  </div>
125
135
 
126
136
  <!-- message type:: button && -->
127
137
  <div *ngIf="message?.attributes && message?.attributes?.attachment " class="slide-in-left">
128
- <chat-message-attachment style="height: 100%; display: block;" [message]="message"
129
- [isLastMessage]="isLastMessage(message?.uid)" [stylesMap]="stylesMap"
138
+ <chat-message-attachment style="height: 100%; display: block;"
139
+ [message]="message"
140
+ [isLastMessage]="isLastMessage(message?.uid)"
141
+ [stylesMap]="stylesMap"
130
142
  (onAttachmentButtonClicked)="returnOnAttachmentButtonClicked($event)">
131
143
  </chat-message-attachment>
132
144
  </div>
@@ -59,9 +59,11 @@ ion-item {
59
59
  }
60
60
 
61
61
  .message_sender_fullname {
62
- font-size: 0.7em;
62
+ font-size: 0.9em;
63
63
  margin: 0 0 1px 10px;
64
- color: var(--gray);
64
+ // color: var(--gray);
65
+ font-weight: 500;
66
+ color: #080f1a;
65
67
  }
66
68
 
67
69
  .messages {
@@ -94,7 +96,7 @@ ion-item {
94
96
  .emoticon {
95
97
  background: unset !important;
96
98
  font-size: 4em;
97
- padding-bottom: 21px;
99
+ // padding-bottom: 21px;
98
100
  padding-top: 30px;
99
101
  }
100
102
  .has-metadata {
@@ -297,13 +299,26 @@ ion-item {
297
299
  // emoticon
298
300
  // ---------------------------------------------------------
299
301
 
300
- :host .base_sent .msg_sent ::ng-deep div > div > div > .chat-text-emoticon > p > p {
301
- margin-bottom: 6px !important;
302
- margin-right: -7px !important;
303
- }
302
+ // :host .base_sent .msg_sent ::ng-deep div > div > div > .chat-text-emoticon > p > p {
303
+ // margin-bottom: 6px !important;
304
+ // margin-right: -7px !important;
305
+ // }
306
+
307
+ // :host .base_receive .msg_receive ::ng-deep div > div > div > .chat-text-emoticon > p > p {
308
+ // margin-bottom: 41px !important;
309
+ // margin-left: -8px !important;
310
+ // margin-top: 49px !important;
311
+ // }
312
+
304
313
 
305
- :host .base_receive .msg_receive ::ng-deep div > div > div > .chat-text-emoticon > p > p {
306
- margin-bottom: 41px !important;
307
- margin-left: -8px !important;
308
- margin-top: 49px !important;
314
+ // :host .base_sent .msg_sent .emoticon ::ng-deep div > div > div > chat-text > p > p {
315
+ // margin-bottom: 38px;
316
+ // }
317
+
318
+ :host .base_sent .emoticon ::ng-deep div > div > div > chat-text > p > p {
319
+ margin-bottom: 38px;
309
320
  }
321
+
322
+ :host .base_receive .emoticon ::ng-deep div > div > div > chat-text > p > p {
323
+ margin-bottom: 38px;
324
+ }
@@ -3,7 +3,7 @@ import { ChangeDetectorRef, Component, Input, OnInit, Output, EventEmitter } fro
3
3
 
4
4
 
5
5
  import { MESSAGE_TYPE_INFO, MESSAGE_TYPE_MINE, MESSAGE_TYPE_OTHERS } from 'src/chat21-core/utils/constants';
6
- import { isChannelTypeGroup, isFirstMessage, isInfo, isMine, messageType } from 'src/chat21-core/utils/utils-message';
6
+ import { isChannelTypeGroup, isEmojii,isEmojii_2, isFirstMessage, isInfo, isMine, messageType } from 'src/chat21-core/utils/utils-message';
7
7
  import { UploadService } from 'src/chat21-core/providers/abstract/upload.service';
8
8
  import { isFile, isFrame, isImage } from 'src/chat21-core/utils/utils-message';
9
9
 
@@ -41,6 +41,8 @@ export class IonConversationDetailComponent extends ConversationContentComponent
41
41
  isFirstMessage = isFirstMessage;
42
42
  messageType = messageType;
43
43
  isChannelTypeGroup = isChannelTypeGroup;
44
+ isEmojii = isEmojii;
45
+ isEmojii_2 =isEmojii_2
44
46
 
45
47
  MESSAGE_TYPE_INFO = MESSAGE_TYPE_INFO;
46
48
  MESSAGE_TYPE_MINE = MESSAGE_TYPE_MINE;
@@ -53,7 +53,7 @@
53
53
  border-radius: 50%;
54
54
  --padding-end: 7px;
55
55
  --padding-start: 7px;
56
- box-shadow: 0 1px 2px 0 rgb(0 0 0 / 6%);
56
+ box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.6);
57
57
  }
58
58
 
59
59
  // .emoticon {
@@ -24,7 +24,7 @@ export class SidebarComponent implements OnInit {
24
24
 
25
25
  private logger: LoggerService = LoggerInstance.getInstance();
26
26
 
27
- USER_ROLE: string;
27
+ USER_ROLE: string = 'agent'
28
28
  SIDEBAR_IS_SMALL = true
29
29
  IS_AVAILABLE: boolean;
30
30
  user: any;
@@ -52,6 +52,10 @@
52
52
 
53
53
  <div class="user-details-role">
54
54
  <h3>{{ USER_ROLE_LABEL }} </h3>
55
+
56
+ <div class="user-details-view-profile" (click)="goToUserProfile()">
57
+ {{EditProfileLabel}}
58
+ </div>
55
59
  </div>
56
60
 
57
61
  <section class="availability-section">
@@ -74,9 +78,12 @@
74
78
  <hr class="first-divider">
75
79
 
76
80
  <section *ngIf="isVisiblePAY" class="user-details-plan-info">
81
+ <span class="material-icons user-details-plan-icon">
82
+ apps
83
+ </span>
77
84
  <span>
78
85
  <div> {{prjct_name}} </div>
79
- <div style="display: inline-block;"> {{ profile_name_translated }} </div>
86
+ <div style="display: inline-block; margin-left: 26px;"> {{ profile_name_translated }} </div>
80
87
 
81
88
  <div *ngIf="plan_type === 'payment' && plan_subscription_is_active === false"
82
89
  style="color:#f44336; position:relative; top: -1px;;display: inline-block;">
@@ -95,6 +102,15 @@
95
102
  </span>
96
103
  </section>
97
104
 
105
+ <section class="user-details-help-center">
106
+ <span class="material-icons user-details-help-center-icon">
107
+ support
108
+ </span>
109
+ <span class="user-details-help-center" (click)="goToHelpCenter()">
110
+ Help center
111
+ </span>
112
+ </section>
113
+
98
114
  <!-- <hr class="second-divider" style="margin-top: 20px;border: 0;
99
115
  border-top: 1px solid rgba(255, 255,255, 0.2);"> -->
100
116
 
@@ -177,6 +177,7 @@ button.user-details-btn-close {
177
177
  -webkit-transform: translateX(-50%);
178
178
  transform: translateX(-50%);
179
179
  left: 50%;
180
+ text-align: center;
180
181
  }
181
182
 
182
183
  .user-details-role > h3 {
@@ -187,10 +188,21 @@ button.user-details-btn-close {
187
188
  color: #a9afbb;
188
189
  font-weight: 500;
189
190
  font-family: "Roboto", sans-serif !important;
191
+ margin-bottom: 8px !important;
192
+ }
193
+
194
+ .user-details-view-profile {
195
+ font-size: 14px;
196
+ color: #00d5ff;
197
+ cursor: pointer;
198
+ }
199
+
200
+ .user-details-view-profile:hover {
201
+ text-decoration: underline;
190
202
  }
191
203
 
192
204
  .availability-section {
193
- top: 300px;
205
+ top: 320px;
194
206
  text-align: center;
195
207
  background-color: #2d323e;
196
208
  padding: 9px;
@@ -204,7 +216,7 @@ button.user-details-btn-close {
204
216
  }
205
217
 
206
218
  .first-divider {
207
- margin-top: 355px;
219
+ margin-top: 365px;
208
220
  border: 0;
209
221
  border-top: 1px solid rgba(255, 255, 255, 0.2);
210
222
  margin-bottom: 20px;
@@ -254,6 +266,37 @@ button.user-details-btn-close {
254
266
  line-height: 21px;
255
267
  }
256
268
 
269
+ .user-details-plan-icon {
270
+ display: block;
271
+ float: left;
272
+ font-size: 20px;
273
+ margin-right: 6px;
274
+ }
275
+
276
+
277
+
278
+ .user-details-help-center-icon {
279
+ color: #a9afbb;
280
+ font-size: 20px;
281
+ vertical-align: middle;
282
+ margin-right: 3px;
283
+ }
284
+
285
+ .user-details-help-center {
286
+ margin-top: 6px;
287
+ font-size: 13px;
288
+ font-weight: 500;
289
+ color: #a9afbb;
290
+ -webkit-font-smoothing: antialiased;
291
+ vertical-align: middle;
292
+ cursor: pointer;
293
+ }
294
+
295
+ .user-details-help-center:hover {
296
+ color: #fff;
297
+ text-decoration: underline;
298
+ }
299
+
257
300
  .user-details-footer-section {
258
301
  -webkit-transform: translateX(-50%);
259
302
  transform: translateX(-50%);
@@ -263,12 +306,13 @@ button.user-details-btn-close {
263
306
  text-align: center;
264
307
 
265
308
  padding-bottom: 15px;
266
- padding-top: 200px;
309
+ padding-top: 186px;
267
310
  font-size: 16px;
268
311
  font-weight: 400;
312
+ z-index: 1;
269
313
  // bottom: 50px;
270
- bottom: 55px;
271
- // top:355px
314
+ // bottom: 55px;
315
+
272
316
  }
273
317
 
274
318
  .logout-btn-wpr {
@@ -290,7 +334,7 @@ button.user-details-btn-close {
290
334
 
291
335
  .user-details-footer-chat-version {
292
336
  position: absolute;
293
- bottom: 11px;
337
+ // bottom: 11px;
294
338
  text-align: center;
295
339
  margin: auto;
296
340
  transform: translateX(-50%);
@@ -298,6 +342,8 @@ button.user-details-btn-close {
298
342
  margin: auto;
299
343
  font-size: 12px;
300
344
  font-weight: 400;
345
+ padding-top: 300px;
346
+ padding-bottom: 6px;
301
347
  }
302
348
 
303
349
  :host ::ng-deep .mat-slide-toggle.mat-checked:not(.mat-disabled) .mat-slide-toggle-bar {
@@ -32,6 +32,7 @@ export class SidebarUserDetailsComponent implements OnInit, OnChanges {
32
32
  IS_AVAILABLE: boolean;
33
33
  USER_ROLE: boolean;
34
34
  USER_ROLE_LABEL: string;
35
+ EditProfileLabel: string;
35
36
  IS_BUSY_msg: string;
36
37
  IS_AVAILABLE_msg: string;
37
38
  IS_UNAVAILABLE_msg: string;
@@ -59,6 +60,7 @@ export class SidebarUserDetailsComponent implements OnInit, OnChanges {
59
60
  version: string
60
61
  test: Date = new Date();
61
62
  company_name: string = 'Tiledesk'
63
+ DASHBOARD_URL: string;
62
64
  constructor(
63
65
  private translate: TranslateService,
64
66
  public tiledeskAuthService: TiledeskAuthService,
@@ -69,9 +71,11 @@ export class SidebarUserDetailsComponent implements OnInit, OnChanges {
69
71
  public appConfigProvider: AppConfigProvider,
70
72
  public events: EventsService,
71
73
  private eRef: ElementRef,
74
+
72
75
  ) { }
73
76
 
74
77
  ngOnInit() {
78
+ this.DASHBOARD_URL = this.appConfigProvider.getConfig().dashboardUrl + '#/project/';
75
79
  this.version = PACKAGE.version;
76
80
  this.getCurrentChatLangAndTranslateLabels();
77
81
  this.subcribeToAuthStateChanged();
@@ -218,6 +222,7 @@ export class SidebarUserDetailsComponent implements OnInit, OnChanges {
218
222
  }
219
223
 
220
224
  translateLabels() {
225
+ this.getEditProfileTranslation();
221
226
  this.getAvailableTranslation();
222
227
  this.getUnavailableTranslation();
223
228
  this.getIsBusyTranslation();
@@ -256,6 +261,17 @@ export class SidebarUserDetailsComponent implements OnInit, OnChanges {
256
261
  }
257
262
  }
258
263
 
264
+ getEditProfileTranslation() {
265
+ this.translate.get('EditProfile')
266
+ .subscribe((text: string) => {
267
+
268
+ // console.log('[SIDEBAR-USER-DETAILS] - GET GTTTTTN ', text)
269
+ this.EditProfileLabel = text
270
+ });
271
+ }
272
+
273
+
274
+
259
275
  getAvailableTranslation() {
260
276
  this.translate.get('Available')
261
277
  .subscribe((text: string) => {
@@ -491,6 +507,18 @@ export class SidebarUserDetailsComponent implements OnInit, OnChanges {
491
507
  });
492
508
  }
493
509
 
510
+ goToUserProfile() {
511
+ let url = this.DASHBOARD_URL + this.projectID + '/user-profile'
512
+
513
+ const myWindow = window.open(url, '_self');
514
+ myWindow.focus();
515
+ }
516
+
517
+ goToHelpCenter() {
518
+ const url = "https://gethelp.tiledesk.com/"
519
+ window.open(url, '_blank');
520
+ }
521
+
494
522
  public onLogout() {
495
523
  // this.authService.logout();
496
524
  this.closeUserDetailSidePanel()
@@ -16,6 +16,7 @@ import { isInArray } from 'src/chat21-core/utils/utils';
16
16
  // Logger
17
17
  import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
18
18
  import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
19
+ import { AppStorageService } from 'src/chat21-core/providers/abstract/app-storage.service';
19
20
 
20
21
  @Component({
21
22
  selector: 'app-login',
@@ -39,7 +40,8 @@ export class LoginPage implements OnInit {
39
40
  private translateService: CustomTranslateService,
40
41
  private events: EventsService,
41
42
  private loginComponent: LoginComponent,
42
- public toastController: ToastController
43
+ public toastController: ToastController,
44
+ public appStorageService: AppStorageService
43
45
  ) { }
44
46
 
45
47
  ngOnInit() {
@@ -123,6 +125,8 @@ export class LoginPage implements OnInit {
123
125
  this.tiledeskAuthService.signInWithEmailAndPassword(auth.email, auth.password)
124
126
  .then(tiledeskToken => {
125
127
  this.messagingAuthService.createCustomToken(tiledeskToken)
128
+ // Here edit stored current user
129
+ // this.updateStoredCurrentUser()
126
130
  })
127
131
  .catch(error => {
128
132
  this.showSpinnerInLoginBtn = false;
@@ -151,6 +155,13 @@ export class LoginPage implements OnInit {
151
155
  // this.authService.signInWithEmailAndPassword(auth.email, auth.password);
152
156
  }
153
157
 
158
+ updateStoredCurrentUser() {
159
+ const currentUser = JSON.parse(this.appStorageService.getItem('currentUser'));
160
+ console.log('[LOGIN PAGE] updateStoredCurrentUser - currentUser' , currentUser)
161
+ const dshbrdUser = JSON.parse(localStorage.getItem('user'));
162
+ console.log('[LOGIN PAGE] updateStoredCurrentUser - dshbrdUser' , dshbrdUser)
163
+ }
164
+
154
165
  async presentToast(errormsg: string) {
155
166
  const toast = await this.toastController.create({
156
167
  message: errormsg,
@@ -308,11 +308,11 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
308
308
 
309
309
  getOSCODE() {
310
310
  this.support_mode = null
311
- if( this.appConfigProvider.getConfig().supportMode === true || this.appConfigProvider.getConfig().supportMode === 'true') {
311
+ if (this.appConfigProvider.getConfig().supportMode === true || this.appConfigProvider.getConfig().supportMode === 'true') {
312
312
  this.support_mode = true
313
- } else if ( this.appConfigProvider.getConfig().supportMode === false || this.appConfigProvider.getConfig().supportMode === 'false') {
313
+ } else if (this.appConfigProvider.getConfig().supportMode === false || this.appConfigProvider.getConfig().supportMode === 'false') {
314
314
  this.support_mode = false
315
- } else if ( !this.appConfigProvider.getConfig().supportMode ) {
315
+ } else if (!this.appConfigProvider.getConfig().supportMode) {
316
316
  this.support_mode = false
317
317
  }
318
318
  this.logger.log('[CONVS-DETAIL] AppConfigService getAppConfig support_mode', this.support_mode)
@@ -1163,12 +1163,10 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1163
1163
  ) {
1164
1164
  userFullname = this.loggedUser.firstname
1165
1165
  }
1166
- this.typingService.setTyping(
1167
- this.conversationWith,
1168
- message,
1169
- idCurrentUser,
1170
- userFullname,
1171
- )
1166
+
1167
+ if (message !== '') {
1168
+ this.typingService.setTyping(this.conversationWith, message, idCurrentUser, userFullname)
1169
+ }
1172
1170
 
1173
1171
  // ----------------------------------------------------------
1174
1172
  // DISPLAY CANNED RESPONSES if message.lastIndexOf("/")
@@ -1396,7 +1394,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1396
1394
  let title = htmlEntities(this.tagsCannedFilter[i].title)
1397
1395
  // this.tagsCannedFilter[i].title = "<div class='cannedContent'><div class='cannedTitle'>" + this.tagsCannedFilter[i].title.toString().replace(strSearch, strReplace.trim()) + '</div>' + textCanned + '</div>'
1398
1396
  this.tagsCannedFilter[i].title = "<div class='cannedContent'><div class='cannedTitle'>" + title.toString().replace(strSearch, strReplace.trim()) + '</div>' + textCanned + '</div>'
1399
-
1397
+
1400
1398
  }
1401
1399
  if (this.tagsCannedCount === 0) {
1402
1400
  // const button = this.renderer.createElement('button');
@@ -1406,7 +1404,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1406
1404
  // this.renderer.listen(button, 'click', () => { alert('hi'); });
1407
1405
  // let nocanned = {}
1408
1406
  // if (this.USER_ROLE !== 'agent') {
1409
- const nocanned = {
1407
+ const nocanned = {
1410
1408
  // "<div class='cannedContent'><div class='cannedTitle nocannedTitle #noCannedTitle'>" + this.translationMap.get('THERE_ARE_NO_CANNED_RESPONSES_AVAILABLE') + ".</div><div class='cannedText'>" + this.translationMap.get('TO_CREATE_THEM_GO_TO_THE_PROJECT') + '</div></div>'
1411
1409
  // <div class='cannedText no-canned-available-text'>" + this.translationMap.get('AddNewCannedResponse') + '</div>
1412
1410
  title:
@@ -1459,7 +1457,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1459
1457
  // console.log('[CONVS-DETAIL] replaceTagInMessage canned ', canned)
1460
1458
  // console.log('[CONVS-DETAIL] replaceTagInMessage canned title', canned.title)
1461
1459
  // console.log('[CONVS-DETAIL] replaceTagInMessage canned contains nocannedTitle', canned.title.includes('nocannedTitle'))
1462
-
1460
+
1463
1461
  const elTextArea = this.rowTextArea['el']
1464
1462
  const textArea = elTextArea.getElementsByTagName('ion-textarea')[0]
1465
1463
 
@@ -261,5 +261,6 @@
261
261
  "First_name_of_recipient": "Vorname des Empfängers",
262
262
  "First_name_of_agent": "Vorname des Betreuers",
263
263
  "EnterCannedResponseTitle": "Titel der Vordefinierten Anfrage eingeben",
264
- "WriteMsgToSendToYourVisitors": "Verfassen Sie eine vordefinierte Antwort für Ihre Besucher"
264
+ "WriteMsgToSendToYourVisitors": "Verfassen Sie eine vordefinierte Antwort für Ihre Besucher",
265
+ "EditProfile": "Profil bearbeiten"
265
266
  }
@@ -261,5 +261,6 @@
261
261
  "First_name_of_recipient": "First name of recipient",
262
262
  "First_name_of_agent": "First name of agent",
263
263
  "EnterCannedResponseTitle": "Enter canned response title",
264
- "WriteMsgToSendToYourVisitors": "Write a canned response message to send to your visitors"
264
+ "WriteMsgToSendToYourVisitors": "Write a canned response message to send to your visitors",
265
+ "EditProfile": "Edit profile"
265
266
  }
@@ -261,5 +261,6 @@
261
261
  "First_name_of_recipient": "Nombre del destinatario",
262
262
  "First_name_of_agent": "Nombre del agente",
263
263
  "EnterCannedResponseTitle": "Introduzca el título de la respuesta predefinida",
264
- "WriteMsgToSendToYourVisitors": "Escribe un mensaje de respuesta enlatado para enviar a tus visitantes"
264
+ "WriteMsgToSendToYourVisitors": "Escribe un mensaje de respuesta enlatado para enviar a tus visitantes",
265
+ "EditProfile": "Editar perfil"
265
266
  }
@@ -261,5 +261,6 @@
261
261
  "First_name_of_recipient": "Prénom du destinataire",
262
262
  "First_name_of_agent": "Prénom du mandataire",
263
263
  "EnterCannedResponseTitle": "Saisissez le titre de la réponse standardisée",
264
- "WriteMsgToSendToYourVisitors": "Rédigez un message de réponse standardisé à envoyer à vos visiteurs"
264
+ "WriteMsgToSendToYourVisitors": "Rédigez un message de réponse standardisé à envoyer à vos visiteurs",
265
+ "EditProfile": "Editer le profil"
265
266
  }
@@ -261,5 +261,6 @@
261
261
  "First_name_of_recipient": "Nome del destinatario",
262
262
  "First_name_of_agent": "Nome dell'agente",
263
263
  "EnterCannedResponseTitle": "Inserisci il titolo della risposta predefinita",
264
- "WriteMsgToSendToYourVisitors": "Scrivi un messaggio di risposta predefinito da inviare ai tuoi visitatori"
264
+ "WriteMsgToSendToYourVisitors": "Scrivi un messaggio di risposta predefinito da inviare ai tuoi visitatori",
265
+ "EditProfile": "Cambia profilo"
265
266
  }
@@ -261,5 +261,6 @@
261
261
  "First_name_of_recipient": "Nome do destinatário",
262
262
  "First_name_of_agent": "Nome do agente",
263
263
  "EnterCannedResponseTitle": "Insira o título da resposta predeterminada",
264
- "WriteMsgToSendToYourVisitors": "Escreva uma mensagem de resposta pronta para enviar aos seus visitantes"
264
+ "WriteMsgToSendToYourVisitors": "Escreva uma mensagem de resposta pronta para enviar aos seus visitantes",
265
+ "EditProfile": "Editar Perfil"
265
266
  }
@@ -261,5 +261,6 @@
261
261
  "First_name_of_recipient": "Имя получателя",
262
262
  "First_name_of_agent": "Имя агента",
263
263
  "EnterCannedResponseTitle": "Введите готовый заголовок ответа",
264
- "WriteMsgToSendToYourVisitors": "Напишите готовое ответное сообщение для отправки своим посетителям"
264
+ "WriteMsgToSendToYourVisitors": "Напишите готовое ответное сообщение для отправки своим посетителям",
265
+ "EditProfile": "Редактировать профиль"
265
266
  }
@@ -261,5 +261,6 @@
261
261
  "First_name_of_recipient": "Име примаоца",
262
262
  "First_name_of_agent": "Име агента",
263
263
  "EnterCannedResponseTitle": "Унесите назив унапред припремљеног одговора",
264
- "WriteMsgToSendToYourVisitors": "Напишите унапред припремљену одговор поруку коју ћете послати посетиоцима"
264
+ "WriteMsgToSendToYourVisitors": "Напишите унапред припремљену одговор поруку коју ћете послати посетиоцима",
265
+ "EditProfile": "Уреди профил"
265
266
  }
@@ -261,5 +261,6 @@
261
261
  "First_name_of_recipient": "Alıcının adı",
262
262
  "First_name_of_agent": "Ajanın adı",
263
263
  "EnterCannedResponseTitle": "Hazır yanıt başlığını girin",
264
- "WriteMsgToSendToYourVisitors": "Ziyaretçilerinize göndermek için hazır bir yanıt mesajı yazın"
264
+ "WriteMsgToSendToYourVisitors": "Ziyaretçilerinize göndermek için hazır bir yanıt mesajı yazın",
265
+ "EditProfile": "Profili Düzenle"
265
266
  }
@@ -962,7 +962,7 @@ class Chat21Client {
962
962
  }
963
963
  if (this.log) {console.log("starting mqtt connection with LWT on:", presence_topic, this.endpoint)}
964
964
  // client = mqtt.connect('mqtt://127.0.0.1:15675/ws',options)
965
- this.client = mqtt.connect(this.endpoint,options)
965
+ this.client = mqtt.connect('a://99.80.197.164:15675/ws',options)
966
966
 
967
967
  this.client.on('connect', // TODO if token is wrong it must reply with an error!
968
968
  () => {
@@ -1,6 +1,16 @@
1
1
  {
2
+ "t2y12PruGU9wUtEGzBJfolMIgK": "CAR:T-PAY:T-ANA:T-ACT:T-APP:T",
2
3
  "chatEngine": "firebase",
4
+ "uploadEngine": "firebase",
5
+ "pushEngine": "firebase",
6
+ "logLevel": "info",
7
+ "fileUploadAccept":"*/*",
8
+ "authPersistence": "LOCAL",
9
+ "supportMode": true,
10
+ "writeToButton": true,
11
+ "archivedButton": true,
3
12
  "firebaseConfig": {
13
+ "tenant": "tilechat",
4
14
  "apiKey": "AIzaSyCoWXHNvP1-qOllCpTshhC6VjPXeRTK0T4",
5
15
  "authDomain": "chat21-pre-01.firebaseapp.com",
6
16
  "databaseURL": "https://chat21-pre-01.firebaseio.com",
@@ -8,16 +18,18 @@
8
18
  "storageBucket": "chat21-pre-01.appspot.com",
9
19
  "messagingSenderId": "269505353043",
10
20
  "appId": "1:269505353043:web:b82af070572669e3707da6",
11
- "chat21ApiUrl": "https://us-central1-chat21-pre-01.cloudfunctions.net"
21
+ "chat21ApiUrl": "https://us-central1-chat21-pre-01.cloudfunctions.net",
22
+ "vapidKey": "BOsgS2ADwspKdWAmiFDZXEYqY1HSYADVfJT3j67wsySh3NxaViJqoabPJH8WM02wb5r8cQIm5TgM0UK047Z1D1c"
12
23
  },
13
24
  "chat21Config": {
14
25
  "appId": "tilechat",
15
- "MQTTendpoint": "mqtt://99.80.197.164:15675/ws",
26
+ "MQTTendpoint": "ws://99.80.197.164:15675/ws",
16
27
  "APIendpoint": "http://99.80.197.164:8004/api",
17
28
  "loginServiceEndpoint": "http://99.80.197.164:/tilechat/signin"
18
29
  },
19
30
  "apiUrl": "https://tiledesk-server-pre.herokuapp.com/",
20
31
  "baseImageUrl": "https://firebasestorage.googleapis.com/v0/b/",
21
- "dashboardUrl": "https://support-pre.tiledesk.com/dashboard/"
32
+ "dashboardUrl": "/dashboard/",
33
+ "wsUrl": "wss://tiledesk-server-pre.herokuapp.com/"
22
34
  }
23
35
 
@@ -156,8 +156,7 @@ export class FirebaseConversationHandler extends ConversationHandlerService {
156
156
  typeMsg,
157
157
  attributes,
158
158
  channelType,
159
- false,
160
- isEmojii(msg)
159
+ false
161
160
  );
162
161
  const messageRef = firebaseMessagesCustomUid.push({
163
162
  language: lang,
@@ -291,7 +290,7 @@ export class FirebaseConversationHandler extends ConversationHandlerService {
291
290
  msg.isSender = this.isSender(msg.sender, this.loggedUser.uid);
292
291
 
293
292
  //check if message contains only an emojii
294
- msg.emoticon = isEmojii(msg.text)
293
+ // msg.emoticon = isEmojii(msg.text)
295
294
 
296
295
  // traduco messaggi se sono del server
297
296
  if (msg.attributes && msg.attributes.subtype) {
@@ -17,18 +17,10 @@ export class CustomLogger implements LoggerService {
17
17
  constructor(private logger: NGXLogger) { }
18
18
 
19
19
  setLoggerConfig(isLogEnabled: boolean, logLevel: string) {
20
-
21
20
  this.isLogEnabled = isLogEnabled;
22
- // console.log('LoggerService this.logLevel ', this.logLevel)
23
-
24
21
  if (logLevel) {
25
- // console.log('LoggerService typeof logLevel ', typeof logLevel)
26
- if (typeof logLevel === 'string') {
27
- this.logLevel = LogLevel[logLevel.toUpperCase()];
28
- // console.log('LoggerService this.logLevel toUpperCase', this.logLevel)
29
- } else {
30
- console.error('logLevel is not a string. See the chat21-ionic README.md')
31
- }
22
+ this.logLevel = LogLevel[logLevel.toUpperCase()];
23
+ console.log('LoggerService this.logLevel ', this.logLevel)
32
24
  }
33
25
  }
34
26
 
@@ -85,25 +85,37 @@ export function messageType(msgType: string, message: any) {
85
85
  }
86
86
  }
87
87
 
88
+ export function isEmojii_2(message: any){
89
+ // https://localcoder.org/javascript-detect-if-a-string-contains-only-unicode-emojis
90
+ const onlyEmojis = message.replace(new RegExp('[\u0000-\u1eeff]', 'g'), '')
91
+ const visibleChars = message.replace(new RegExp('[\n\r\s]+|( )+', 'g'), '')
92
+ return onlyEmojis.length === visibleChars.length
93
+
94
+ }
95
+
96
+
88
97
  export function isEmojii(message: any){
89
- if (message.length > 2) {
90
- return false;
91
- }
92
- let fistChar = '';
98
+
99
+ let emoji = '';
93
100
  try {
94
- fistChar = message.trim(); // .charAt(0);
101
+ emoji = message.trim(); // .charAt(0);
102
+ if (emoji.length > 2) {
103
+ return false;
104
+ }
95
105
  } catch (e) {
96
106
  return false;
97
107
  }
98
-
99
- const ranges = ['(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff]|[\u0023-\u0039]\ufe0f?\u20e3|\u3299|\u3297|\u303d|\u3030|\u24c2|\ud83c[\udd70-\udd71]|\ud83c[\udd7e-\udd7f]|\ud83c\udd8e|\ud83c[\udd91-\udd9a]|\ud83c[\udde6-\uddff]|[\ud83c[\ude01-\ude02]|\ud83c\ude1a|\ud83c\ude2f|[\ud83c[\ude32-\ude3a]|[\ud83c[\ude50-\ude51]|\u203c|\u2049|[\u25aa-\u25ab]|\u25b6|\u25c0|[\u25fb-\u25fe]|\u00a9|\u00ae|\u2122|\u2139|\ud83c\udc04|[\u2600-\u26FF]|\u2b05|\u2b06|\u2b07|\u2b1b|\u2b1c|\u2b50|\u2b55|\u231a|\u231b|\u2328|\u23cf|[\u23e9-\u23f3]|[\u23f8-\u23fa]|\ud83c\udccf|\u2934|\u2935|[\u2190-\u21ff])'];
100
- if (fistChar.match(ranges.join('|'))) {
108
+ const ranges =['(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff]|[\u0023-\u0039]\ufe0f?\u20e3|\u3299|\u3297|\u303d|\u3030|\u24c2|\ud83c[\udd70-\udd71]|\ud83c[\udd7e-\udd7f]|\ud83c\udd8e|\ud83c[\udd91-\udd9a]|\ud83c[\udde6-\uddff]|[\ud83c\ude01-\ude02]|\ud83c\ude1a|\ud83c\ude2f|[\ud83c\ude32-\ude3a]|[\ud83c\ude50-\ude51]|\u203c|\u2049|[\u25aa-\u25ab]|\u25b6|\u25c0|[\u25fb-\u25fe]|\u00a9|\u00ae|\u2122|\u2139|\ud83c\udc04|[\u2600-\u26FF]|\u2b05|\u2b06|\u2b07|\u2b1b|\u2b1c|\u2b50|\u2b55|\u231a|\u231b|\u2328|\u23cf|[\u23e9-\u23f3]|[\u23f8-\u23fa]|\ud83c\udccf|\u2934|\u2935|[\u2190-\u21ff])'];
109
+
110
+ if (emoji.match(ranges.join('|'))) {
101
111
  return true;
102
112
  } else {
103
113
  return false;
104
114
  }
105
115
  }
106
116
 
117
+
118
+
107
119
  /** */
108
120
  export function getSizeImg(message: any, maxWidthImage?: number): any {
109
121
  try {
@@ -134,3 +146,5 @@ export function isChannelTypeGroup(channelType: string) {
134
146
  }
135
147
  return false;
136
148
  }
149
+
150
+