@chat21/chat21-web-widget 5.0.56-rc.4 → 5.0.56-rc.6

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,16 @@
1
1
  # chat21-web-widget ver 5.0
2
2
 
3
+ ### 5.0.56-rc.6
4
+ - bug-fixed: setPresence not fired due to undefined reading Query in database
5
+ - bug-fixed: multiple rules was done--> do only the first that match the regex
6
+
7
+ ### 5.0.56-rc.5
8
+ - added: if hideFooterTextReply is set to true, hide footer input area and display logo
9
+ - added: mobileMarginX and mobileMarginY property to dev page
10
+ - added: root css variable to manage dynamic iframe height
11
+ - changed: minor UI changes in last-messsage and bubble-message components to display trasnsparent background if image/iframe/gif is received/sent
12
+ - bug-fixed: dynamic height in .messagePreview container div modify the height of the entire iframe also when it is open
13
+
3
14
  ### 5.0.56-rc.4
4
15
  - added: function to manage messagePreview height programatically
5
16
  - added: implementation of commands messages inside callout component
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@chat21/chat21-web-widget",
3
3
  "author": "Tiledesk SRL",
4
- "version": "5.0.56-rc.4",
4
+ "version": "5.0.56-rc.6",
5
5
  "license": "MIT",
6
6
  "homepage": "https://www.tiledesk.com",
7
7
  "repository": {
@@ -387,8 +387,9 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
387
387
  new Promise(async (resolve, reject)=> {
388
388
  that.typingService.initialize(this.g.tenant);
389
389
  await that.presenceService.initialize(this.g.tenant);
390
+ resolve(null)
390
391
  }).then(()=>{
391
- that.presenceService.setPresence(user.uid);
392
+ that.presenceService.setPresence(user.uid);
392
393
  });
393
394
 
394
395
  // this.initConversationsHandler(this.g.tenant, that.g.senderId);
@@ -92,7 +92,7 @@
92
92
  </chat-conversation-attachment-preview>
93
93
 
94
94
  <!-- FOOTER -->
95
- <div id="chat21-footer" [class.maximize-width]="(g?.singleConversation && hideTextAreaContent) || (isConversationArchived && !g?.allowReopen)">
95
+ <div id="chat21-footer" [class.maximize-width]="(g?.singleConversation && hideTextAreaContent) || (isConversationArchived && !g?.allowReopen)" [class.hideFooterReply]="hideFooterTextReply">
96
96
  <div *ngIf="showBadgeScroollToBottom" id="chat21-buttonToBottom" (click)="scrollToBottom()">
97
97
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path opacity=".87" fill="none" d="M24 24H0V0h24v24z"/><path d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6-1.41-1.41z"/></svg>
98
98
  <div *ngIf="messagesBadgeCount!=0" id="chat21-divBudge" class="c21-divBudge">{{messagesBadgeCount}}</div>
@@ -117,6 +117,7 @@
117
117
  [footerMessagePlaceholder]="footerMessagePlaceholder"
118
118
  [fileUploadAccept]="appConfigService?.getConfig().fileUploadAccept"
119
119
  [dropEvent]="dropEvent"
120
+ [poweredBy]="g?.poweredBy"
120
121
  [stylesMap]="stylesMap"
121
122
  [translationMap]="translationMapFooter"
122
123
  (onEmojiiPickerShow)="onEmojiiPickerShow($event)"
@@ -47,6 +47,10 @@
47
47
  padding: 8px 0px;
48
48
  }
49
49
 
50
+ &.hideFooterReply{
51
+ padding: 0px;
52
+ }
53
+
50
54
  /* button scroll to bottom page */
51
55
  #chat21-buttonToBottom {
52
56
  display: flex;
@@ -28,7 +28,7 @@
28
28
  <!--backgroundColor non viene ancora usato -->
29
29
  <!-- class="messages msg_sent slide-in-right" -->
30
30
  <chat-bubble-message class="messages msg_sent"
31
- [class.no-background]="(isImage(message) || isFrame(message)) && message?.text && message?.text.trim() === '' "
31
+ [class.no-background]="(isImage(message) || isFrame(message)) && ((message?.text && message?.text.trim() === '') || !message?.text)"
32
32
  [class.emoticon]="isEmojii(message?.text)"
33
33
  [ngStyle]="{'background': stylesMap.get('bubbleSentBackground'), 'color': stylesMap.get('bubbleSentTextColor')}"
34
34
  [ngClass]="{'button-in-msg' : message?.metadata && message?.metadata?.button}"
@@ -63,7 +63,7 @@
63
63
  <!-- [ngClass]="{'slide-in-left': !isFirstMessage(message?.sender, i)}" -->
64
64
  <chat-bubble-message class="messages msg_receive"
65
65
  [ngClass]="{'slide-in-left': false}"
66
- [class.no-background]="(isImage(message) || isFrame(message)) && message?.text && message?.text && message?.text.trim() === '' "
66
+ [class.no-background]="(isImage(message) || isFrame(message)) && ((message?.text && message?.text.trim() === '') || !message?.text)"
67
67
  [class.emoticon]="isEmojii(message?.text)"
68
68
  [style.margin-left]="isSameSender(message?.sender, i)? '50px': null"
69
69
  [ngStyle]="{'background': stylesMap.get('bubbleReceivedBackground'), 'color': stylesMap.get('bubbleReceivedTextColor')}"
@@ -148,42 +148,7 @@
148
148
  // padding: 6px 6px 6px 6px;
149
149
  // box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
150
150
  // -webkit-animation: heartbeat 1.5s ease-in-out both;
151
- // animation: heartbeat 1.5s ease-in-out both;
152
-
153
- p {
154
- font-size: 1.4em;
155
- margin: 0;
156
- padding: 14px;
157
- font-style: normal;
158
- letter-spacing: normal;
159
- font-stretch: normal;
160
- font-variant: normal;
161
- font-weight: 300;
162
- overflow: hidden;
163
- }
164
- img {
165
- border-radius: 8px;
166
- padding: 3px;
167
- margin-bottom: 0px;
168
- max-width: calc(100% - 6px);
169
- width: auto;
170
- height: auto;
171
- object-fit: cover;
172
- }
173
- .message_innerhtml {
174
- margin: 0px;
175
- // padding: 0px 14px;
176
- &.marked{
177
- padding:8px;
178
- margin-block-start: -1em!important;
179
- margin-block-end: -1em!important;
180
- }
181
-
182
- .text-message {
183
- padding-top: 14px;
184
- }
185
- }
186
-
151
+ // animation: heartbeat 1.5s ease-in-out both;
187
152
  }
188
153
 
189
154
  .base_info {
@@ -18,7 +18,11 @@
18
18
  </button>
19
19
  </div>
20
20
 
21
- <div class="visible-text-area" *ngIf="!hideTextAreaContent" [class.disabled] = "( isConversationArchived || hideTextReply)? true : null">
21
+ <div id="hiddenFooter" *ngIf="hideTextReply && !hideTextAreaContent" class="fade-in-bottom">
22
+ <div tabindex="-1" class="c21-powered-by" [innerHTML]="poweredBy"></div>
23
+ </div>
24
+
25
+ <div class="visible-text-area" *ngIf="!hideTextAreaContent && !hideTextReply" [class.disabled] = "( isConversationArchived || hideTextReply)? true : null">
22
26
  <!-- isFilePendingToUpload || -->
23
27
  <textarea
24
28
  [attr.disabled] = "(hideTextReply)? true : null"
@@ -40,7 +44,7 @@
40
44
 
41
45
  </div>
42
46
  <!-- -->
43
- <div #div_attached *ngIf="!hideTextAreaContent">
47
+ <div #div_attached *ngIf="!hideTextAreaContent && !hideTextReply">
44
48
  <!-- ICON ATTACHMENT -->
45
49
  <label *ngIf="showAttachmentButton == true" tabindex="1502" aria-label="allegati" for="chat21-file" class="chat21-textarea-button" [class.active]="!isFilePendingToUpload && !hideTextReply" id="chat21-start-upload-doc">
46
50
  <span class="v-align-center">
@@ -251,6 +251,56 @@ textarea:active{
251
251
 
252
252
  }
253
253
 
254
+
255
+ #hiddenFooter{
256
+ .c21-powered-by {
257
+ height: 40px;
258
+ text-align: center;
259
+ padding: 0;
260
+ // margin: 5px 0;
261
+ // position: absolute;
262
+ color: var(--gray);
263
+ // top: 0;
264
+ // left: 20px; //60px;
265
+ // right: 60px;
266
+ display: flex;
267
+ align-items: center;
268
+ justify-content: center;
269
+
270
+ &::ng-deep a {
271
+ text-decoration: none;
272
+ cursor: pointer;
273
+ display: inline-block;
274
+ color: var(--gray);
275
+ font-size: 1.1em;
276
+ font-weight: 500;
277
+ line-height: 22px;
278
+
279
+ font-family: Mulish, sans-serif;
280
+ letter-spacing: -0.24px;
281
+ -webkit-font-smoothing: antialiased;
282
+
283
+ span {
284
+ display: inline-block;
285
+ position: relative;
286
+ top: 2px;
287
+ }
288
+
289
+ img {
290
+ width: 80px; //60px;
291
+ height: auto;
292
+ max-height: 40px;
293
+ position: relative;
294
+ vertical-align: middle;
295
+ object-fit: contain;
296
+ }
297
+ }
298
+ b{
299
+ font-weight: bolder;
300
+ }
301
+ }
302
+ }
303
+
254
304
  .fade-in-bottom {
255
305
  -webkit-animation: fade-in-bottom 0.5s cubic-bezier(0.600, -0.280, 0.735, 0.045) 0.0s;
256
306
  animation: fade-in-bottom 0.5s cubic-bezier(0.600, -0.280, 0.735, 0.045) 0.0s;
@@ -35,9 +35,10 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
35
35
  @Input() isEmojiiPickerShow: boolean;
36
36
  @Input() footerMessagePlaceholder: string;
37
37
  @Input() fileUploadAccept: string;
38
+ @Input() dropEvent: Event;
39
+ @Input() poweredBy: string;
38
40
  @Input() stylesMap: Map<string, string>
39
41
  @Input() translationMap: Map< string, string>;
40
- @Input() dropEvent: Event;
41
42
  @Output() onEmojiiPickerShow = new EventEmitter<boolean>();
42
43
  @Output() onBeforeMessageSent = new EventEmitter();
43
44
  @Output() onAfterSendMessage = new EventEmitter<MessageModel>();
@@ -54,6 +54,7 @@
54
54
  .container{
55
55
  display: flex;
56
56
  flex-direction: column;
57
+ gap: 5px;
57
58
  }
58
59
 
59
60
  .messages {
@@ -11,17 +11,6 @@
11
11
  // -webkit-animation: heartbeat 1.5s ease-in-out both;
12
12
  // animation: heartbeat 1.5s ease-in-out both;
13
13
 
14
- // p {
15
- // font-size: 1.4em;
16
- // margin: 0;
17
- // padding: 14px;
18
- // font-style: normal;
19
- // letter-spacing: normal;
20
- // font-stretch: normal;
21
- // font-variant: normal;
22
- // font-weight: 300;
23
- // overflow: hidden;
24
- // }
25
14
 
26
15
  .message_sender_fullname{
27
16
  font-size: 12px;
@@ -37,18 +26,4 @@
37
26
  height: auto;
38
27
  object-fit: cover;
39
28
  }
40
- .message_innerhtml {
41
- margin: 0px;
42
- // padding: 0px 14px;
43
- &.marked{
44
- padding:8px;
45
- margin-block-start: -1em!important;
46
- margin-block-end: -1em!important;
47
- }
48
-
49
- .text-message {
50
- padding-top: 14px;
51
- }
52
- }
53
-
54
29
  }
@@ -589,11 +589,12 @@ export class Globals {
589
589
 
590
590
  setWidgetPreviewContainerSize(width: number, height: number){
591
591
  const divTiledeskWidget = this.windowContext.document.querySelector('.messagePreview');
592
-
592
+
593
593
  let headerPadding = 10
594
594
  let style = getComputedStyle(divTiledeskWidget)
595
- let currentHeight = +style.height.substring(0, style.height.length -2)
596
- divTiledeskWidget.style.height = currentHeight + height + headerPadding + 'px'
595
+ // console.log('computedddd', style.getPropertyValue('--messagePreviewHeight'))
596
+ let currentHeight = +style.getPropertyValue('--messagePreviewHeight').substring(0, style.getPropertyValue('--messagePreviewHeight').length -2)
597
+ this.windowContext.document.documentElement.style.setProperty('--messagePreviewHeight', currentHeight + height + headerPadding + 'px');
597
598
  }
598
599
 
599
600
 
@@ -38,10 +38,12 @@ export class Rules {
38
38
  }
39
39
 
40
40
  checkRules(){
41
+ let exit = false;
41
42
  this.rules.forEach((rule, index)=>{
42
- if(rule.when && new RegExp(rule.when.urlMatches).test(this.windowContext.location.href)){
43
+ if(!exit && rule.when && new RegExp(rule.when.urlMatches).test(this.windowContext.location.href)){
43
44
  if(this.checkIfAlreadyDone(rule)){
44
45
  this.doAction(rule.do)
46
+ exit = true
45
47
  return;
46
48
  }
47
49
 
@@ -50,7 +52,7 @@ export class Rules {
50
52
  }
51
53
 
52
54
  private doAction(action: Rule['do']){
53
- this.logger.info('[RULES] doAction', this.currentUser, action)
55
+ this.logger.info('[RULES] doAction', this.request_id, this.currentUser, action)
54
56
  let message = action.filter(obj => Object.keys(obj).includes('message'))
55
57
  if(message && message.length>0){
56
58
  message[0]['message'].attributes = { ...this.g.attributes, ...message[0]['message'].attributes}
@@ -387,10 +387,3 @@ export function getUnique(arr, comp) {
387
387
  // eliminate the dead keys & store unique objects
388
388
  .filter(e => arr[e]).map(e => arr[e]);
389
389
  }
390
-
391
- export function isJustRecived(startedAt, time) {
392
- if (time > startedAt) {
393
- return true;
394
- }
395
- return false;
396
- }
@@ -916,6 +916,22 @@
916
916
  window.Tiledesk('restart')
917
917
  }
918
918
 
919
+ function onClickMobileMarginX(){
920
+ let text = document.getElementById('mobileMarginX').value
921
+ text === ""? text= '100px': text
922
+ window.tiledeskSettings['mobileMarginX'] = text
923
+ console.log('onClickMobileMarginX:',window.tiledeskSettings);
924
+ window.Tiledesk('restart')
925
+ }
926
+
927
+ function onClickMobileMarginY(){
928
+ let text = document.getElementById('mobileMarginY').value
929
+ text === ""? text= '50px' : text //set default value if user not write a value
930
+ window.tiledeskSettings['mobileMarginY'] = text
931
+ console.log('onClickMobileMarginY:',window.tiledeskSettings);
932
+ window.Tiledesk('restart')
933
+ }
934
+
919
935
  function onClickAutoStart(){
920
936
  let status = document.querySelector('input[name="autoStart"]:checked').value
921
937
  window.tiledeskSettings['autoStart'] = stringToBoolean(status)
@@ -1816,6 +1832,24 @@
1816
1832
  <button class="btn btn-light" onclick="onClickMarginY()">Test this setting <i class="fa fa-magic" aria-hidden="true"></i></button>
1817
1833
  </div>
1818
1834
  </div>
1835
+ <div class="row">
1836
+ <div class="col-md-5 formElement"><span><em><strong>mobileMarginX</strong></em></span></div>
1837
+ <div class="col-md-5 formElement">
1838
+ <input class="form-control col-sm-2" type="text" id="mobileMarginX" name="mobileMarginX" placeholder="Ex. 100px, 1em">
1839
+ </div>
1840
+ <div class="col-md-2">
1841
+ <button class="btn btn-light" onclick="onClickMobileMarginX()">Test this setting <i class="fa fa-magic" aria-hidden="true"></i></button>
1842
+ </div>
1843
+ </div>
1844
+ <div class="row">
1845
+ <div class="col-md-5 formElement"><span><em><strong>mobileMarginY</strong></em></span></div>
1846
+ <div class="col-md-5 formElement">
1847
+ <input class="form-control col-sm-2" type="text" id="mobileMarginY" name="mobileMarginY" placeholder="Ex. 100px, 1em">
1848
+ </div>
1849
+ <div class="col-md-2 ">
1850
+ <button class="btn btn-light" onclick="onClickMobileMarginY()">Test this setting <i class="fa fa-magic" aria-hidden="true"></i></button>
1851
+ </div>
1852
+ </div>
1819
1853
  <div class="row">
1820
1854
  <div class="col-md-5 formElement"><span><em><strong>autoStart</strong></em></span></div>
1821
1855
  <div class="col-md-5">
@@ -87,6 +87,7 @@ export class FirebaseConversationHandler extends ConversationHandlerService {
87
87
  this.showInfoMessage = showInfoMessage
88
88
  // this.attributes = this.setAttributes();
89
89
  const { default: firebase} = await import("firebase/app");
90
+ await Promise.all([import("firebase/database")]);
90
91
  this.firebase = firebase
91
92
  this.ref = this.firebase.database['Query'];
92
93
  }
@@ -47,7 +47,9 @@ export class FirebasePresenceService extends PresenceService {
47
47
  this.urlNodePresence = '/apps/' + this.tenant + '/presence/';
48
48
 
49
49
  const { default: firebase} = await import("firebase/app");
50
+ await Promise.all([import("firebase/database")]);
50
51
  this.firebase = firebase
52
+ return;
51
53
  }
52
54
 
53
55
  /**
@@ -168,6 +170,7 @@ export class FirebasePresenceService extends PresenceService {
168
170
  */
169
171
  private referenceLastOnlineForUser(userid: string): any {
170
172
  const urlNodeLastOnLine = this.urlNodePresence + userid + '/lastOnline';
173
+ this.logger.log('referenceLastOnlineForUser', urlNodeLastOnLine)
171
174
  const lastOnlineRef = this.firebase.database().ref().child(urlNodeLastOnLine);
172
175
  return lastOnlineRef;
173
176
  }
@@ -53,7 +53,7 @@ export class MQTTPresenceService extends PresenceService {
53
53
  }
54
54
 
55
55
  public setPresence(userid: string): void {
56
-
56
+
57
57
  }
58
58
 
59
59
  /**
@@ -84,7 +84,7 @@ export function contactsRef(tenant) {
84
84
  // }
85
85
 
86
86
  /**
87
- * @deprecated
87
+ *
88
88
  */
89
89
  // export function setHeaderDate(translate, timestamp): string {
90
90
  // // const LABEL_TODAY = translate.get('LABEL_TODAY');
@@ -1,3 +1,7 @@
1
+ :root{
2
+ --messagePreviewHeight: 100px;
3
+ }
4
+
1
5
  #tiledesk-container {
2
6
  position: fixed;
3
7
  right: 0px;
@@ -70,7 +74,7 @@
70
74
  }
71
75
  #tiledesk-container.closed #tiledeskdiv.messagePreview {
72
76
  width: 340px; /*340px*/
73
- height: 100px; /*300px*/
77
+ height: var(--messagePreviewHeight); /*300px*/
74
78
  min-width: 340px;
75
79
  }
76
80