@chat21/chat21-web-widget 5.0.71-rc.1 → 5.0.71-rc.10

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 (43) hide show
  1. package/.github/workflows/build.yml +2 -2
  2. package/CHANGELOG.md +32 -0
  3. package/Dockerfile +1 -1
  4. package/package.json +1 -1
  5. package/src/app/app.component.ts +41 -63
  6. package/src/app/component/conversation-detail/conversation/conversation.component.html +3 -2
  7. package/src/app/component/conversation-detail/conversation/conversation.component.scss +3 -2
  8. package/src/app/component/conversation-detail/conversation/conversation.component.ts +1 -7
  9. package/src/app/component/conversation-detail/conversation-content/conversation-content.component.html +2 -3
  10. package/src/app/component/conversation-detail/conversation-content/conversation-content.component.ts +2 -4
  11. package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.scss +1 -1
  12. package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.ts +8 -4
  13. package/src/app/component/last-message/last-message.component.scss +1 -1
  14. package/src/app/component/message/carousel/carousel.component.html +1 -1
  15. package/src/app/component/message/carousel/carousel.component.scss +1 -0
  16. package/src/app/component/message/carousel/carousel.component.ts +5 -4
  17. package/src/app/component/message/image/image.component.ts +0 -3
  18. package/src/app/providers/global-settings.service.ts +5 -0
  19. package/src/app/sass/_variables.scss +1 -1
  20. package/src/app/utils/constants.ts +0 -2
  21. package/src/app/utils/globals.ts +4 -3
  22. package/src/app/utils/rules.ts +1 -1
  23. package/src/assets/js/chat21client.js +1 -1
  24. package/src/assets/twp/chatbot-panel.html +205 -11
  25. package/src/assets/twp/index-dev.html +56 -17
  26. package/src/assets/twp/index.html +110 -37
  27. package/src/chat21-core/models/upload.ts +0 -1
  28. package/src/chat21-core/providers/abstract/upload.service.ts +3 -0
  29. package/src/chat21-core/providers/firebase/firebase-auth-service.ts +3 -3
  30. package/src/chat21-core/providers/firebase/firebase-conversation-handler.ts +1 -1
  31. package/src/chat21-core/providers/firebase/firebase-conversations-handler.ts +2 -1
  32. package/src/chat21-core/providers/firebase/firebase-upload.service.ts +128 -6
  33. package/src/chat21-core/providers/mqtt/mqtt-auth-service.ts +1 -1
  34. package/src/chat21-core/providers/mqtt/mqtt-conversation-handler.ts +1 -1
  35. package/src/chat21-core/providers/mqtt/mqtt-conversations-handler.ts +7 -1
  36. package/src/chat21-core/providers/native/native-upload-service.ts +68 -0
  37. package/src/chat21-core/utils/constants.ts +15 -1
  38. package/src/chat21-core/utils/triggerHandler.ts +0 -1
  39. package/src/chat21-core/utils/utils-message.ts +8 -0
  40. package/src/chat21-core/utils/utils.ts +0 -39
  41. package/src/launch.js +0 -1
  42. package/src/widget-config-template.json +2 -2
  43. package/src/widget-config.json +2 -1
@@ -14,11 +14,26 @@
14
14
  @-ms-keyframes blink {0%{opacity:1;} 50%{opacity:0;} 100%{opacity:1;}} /* IE */
15
15
  @keyframes blink {0%{opacity:1;} 50%{opacity:0;} 100%{opacity:1;}} /* Opera and prob css3 final iteration */
16
16
 
17
+ :root {
18
+
19
+ }
20
+
21
+ body{
22
+ --font-family-poppins: 'Poppins', 'Roboto', Arial, sans-serif;
23
+ --blu: #506493;
24
+ --gray-light-02: rgb(223, 227, 237);
25
+ --base-company-logo: rgb(224,106,88);
26
+ --header-height: 60px;
27
+
28
+ }
29
+
17
30
  #preloader {
18
31
  background: #fff;
19
32
  position: fixed;
20
33
  top: 0;
21
34
  left: 0;
35
+ bottom: 0;
36
+ right: 0;
22
37
  height: 100%;
23
38
  width: 100%;
24
39
  z-index: 999999;
@@ -51,6 +66,52 @@
51
66
  animation:blink normal 2s infinite ease-in-out; /* Opera and prob css3 final iteration */
52
67
  }
53
68
 
69
+ .loader{
70
+ display: block;
71
+ z-index: 99;
72
+ position: absolute;
73
+ top: calc( 50% - 50px);
74
+ left: calc( 50% - 50px);
75
+ width: 100px;
76
+ height: 100px;
77
+ border: 3px solid rgb(224, 106, 88);
78
+ border-radius: 50%;
79
+
80
+ animation: spin 7s ease-in-out;
81
+ animation-iteration-count: infinite;
82
+ transition-duration: 0.1s;
83
+ }
84
+
85
+ .loader:hover {
86
+ scale: 0.95;
87
+ /*Loader on hover effect*/
88
+ }
89
+
90
+ .loader:active {
91
+ scale: 1.2;
92
+ /*Loader on click effect*/
93
+ }
94
+
95
+ @keyframes spin {
96
+ 0% {
97
+ transform: rotate(0deg);
98
+ border-bottom: solid 3px transparent;
99
+ border-top: solid 3px transparent;
100
+ }
101
+ 50% {
102
+ transform: rotate(1800deg);
103
+ border: 3px solid white;
104
+ border-left: solid 3px transparent;
105
+ border-right: solid 3px transparent;
106
+ }
107
+ 100% {
108
+ /*Reversed spinning*/
109
+ transform: rotate(0deg);
110
+ border-bottom: solid 3px transparent;
111
+ border-top: solid 3px transparent;
112
+ }
113
+ }
114
+
54
115
  #deferred-styles {
55
116
  display: none;
56
117
  }
@@ -162,6 +223,71 @@
162
223
  z-index: 2;
163
224
  position: absolute;
164
225
  cursor: pointer;
226
+ font-size: 21px;
227
+ height: var(--header-height);
228
+ font-family: var(--font-family-poppins);
229
+ color: var(--blu);
230
+ background: white;
231
+ border-bottom: 1px solid var(--gray-light-02);
232
+ display: flex;
233
+ width: 100%;
234
+
235
+ }
236
+
237
+ .header-left{
238
+ max-width: var(--header-height);
239
+ width: 100%;
240
+ transition: 0.3s;
241
+ border-right: 1px solid transparent;
242
+ /* border-right: 1px solid var(--gray-light-02); */
243
+ padding: 10px;
244
+ }
245
+
246
+ .header-left div {
247
+ display: flex;
248
+ justify-content: center;
249
+ align-items: center;
250
+ position: relative;
251
+ width: 100%;
252
+ height: 100%;
253
+ border-radius: 50%;
254
+ box-shadow: rgba(17, 49, 96, 0.16) 0px 8px 16px 0px, rgba(17, 49, 96, 0.06) 0px 0px 0px 1px; ;
255
+ }
256
+
257
+ .header-left div .logo {
258
+ opacity: 1;
259
+ width: 25px;
260
+ position: absolute;
261
+ transition: opacity 0.2s ease-in-out;
262
+ }
263
+
264
+ .header-right {
265
+ display: flex;
266
+ align-items: center;
267
+ justify-content: start;
268
+ width: 100%;
269
+ padding: 0px 10px;
270
+ box-sizing: border-box;
271
+ }
272
+
273
+ .header-right .header-go-back {
274
+ cursor: pointer;
275
+ position: relative;
276
+ }
277
+
278
+ .header-right .header-go-back .cds-text {
279
+ font-weight: 700;
280
+ color: var(--base-company-logo);
281
+ }
282
+
283
+ .header-right .header-title{
284
+ display: flex;
285
+ align-items: center;
286
+ justify-content: center;
287
+ gap: 5px;
288
+ font-weight: 300;
289
+ width: 80%;
290
+
165
291
  }
166
292
 
167
293
  .share-btn{
@@ -198,7 +324,9 @@
198
324
  }
199
325
 
200
326
  .b-agent-demo_powered_by a {
201
- display: inline-block;
327
+ display: inline-flex;
328
+ align-items: center;
329
+ gap: 10px;
202
330
  margin-top: 30px;
203
331
  margin-bottom: 30px;
204
332
  text-decoration: none;
@@ -212,8 +340,7 @@
212
340
  }
213
341
  .b-agent-demo_powered_by img {
214
342
  display: inline-block;
215
- height: 24px;
216
- /* margin-left: 20px; */
343
+ height: 40px;
217
344
  }
218
345
 
219
346
  /* The snackbar - position it at the bottom and in the middle of the screen */
@@ -263,6 +390,12 @@
263
390
  to {bottom: 0; opacity: 0;}
264
391
  }
265
392
 
393
+ @media (max-width: 451px) {
394
+ .cds-text{
395
+ display: none;
396
+ }
397
+ }
398
+
266
399
  </style>
267
400
 
268
401
  <!-- <script type="text/javascript">
@@ -368,8 +501,9 @@
368
501
  });
369
502
 
370
503
  window.Tiledesk('onBeforeInit', function(event_data) {
371
- console.log("onBeforeInit Tiledesk FN", event_data);
372
-
504
+ // console.log("onBeforeInit Tiledesk FN", event_data);
505
+ var brandSrc = event_data.detail.appConfigs.brandSrc? getBrandResources(event_data.detail.appConfigs.brandSrc) : null;
506
+
373
507
  setTimeout(() => {
374
508
  document.getElementById("preloader").style.display = "none";
375
509
  if(event_data && event_data.detail && event_data.detail.appConfigs){
@@ -387,7 +521,8 @@
387
521
  });
388
522
 
389
523
  window.Tiledesk('onInit', function(event_data) {
390
- console.log("onInit Tiledesk FN", event_data);
524
+ // console.log("onInit Tiledesk FN", event_data);
525
+ window.Tiledesk('setParameter', {key: 'poweredBy', value: ''})
391
526
  // setTimeout(() => {
392
527
  // document.getElementById("preloader").style.display = "none";
393
528
  // }, 1000);
@@ -400,7 +535,7 @@
400
535
  });
401
536
 
402
537
  window.Tiledesk('onAuthStateChanged', function(event_data) {
403
- console.log("AUTHENTICATED!", event_data);
538
+ // console.log("AUTHENTICATED!", event_data);
404
539
  // if(event_data.detail.isLogged){
405
540
  // console.log("isLogged!!!!", event_data);
406
541
  // window.Tiledesk('show')
@@ -408,13 +543,20 @@
408
543
  });
409
544
 
410
545
  window.Tiledesk('onMessageCreated', function(event_data) {
411
- console.log("onMessageCreated!", event_data);
546
+ // console.log("onMessageCreated!", event_data);
412
547
  window.parent.postMessage(event_data.detail, '*')
413
548
  // if(event_data.detail.isLogged){
414
549
  // console.log("isLogged!!!!", event_data);
415
550
  // window.Tiledesk('show')
416
551
  // }
417
552
  });
553
+
554
+ window.addEventListener('message', (event_data)=> {
555
+ if(event_data && event_data.data && event_data.data.action === 'restart'){
556
+ window.Tiledesk('startConversation', event_data.data.intentName)
557
+ }
558
+ })
559
+
418
560
  </script>
419
561
 
420
562
  <script type="application/javascript">
@@ -433,6 +575,7 @@
433
575
 
434
576
  var url = new URL(currentUrl);
435
577
  var tiledesk_projectid = url.searchParams.get("tiledesk_projectid");
578
+ var tiledesk_widgetTitle = url.searchParams.get("tiledesk_widgetTitle");
436
579
  var project_name = url.searchParams.get("project_name");
437
580
  var role = url.searchParams.get("role")
438
581
  var urlConsole = baseUrlConsole + "#/projects/"+tiledesk_projectid+"/home";
@@ -449,6 +592,36 @@
449
592
  return(false);
450
593
  }
451
594
 
595
+ window.onload = function() {
596
+ document.getElementById("tiledesk_widgetTitle").innerHTML = tiledesk_widgetTitle;
597
+ }
598
+
599
+
600
+ function getBrandResources(url) {
601
+ var xhr = new XMLHttpRequest();
602
+ xhr.onreadystatechange = function () {
603
+ if (xhr.readyState === 4) {
604
+ var brandJson = JSON.parse(xhr.response)
605
+ if(brandJson){
606
+ /** TITLE AND FAVICON **/
607
+ brandJson['WIDGET'].META_TITLE? document.body.title = brandJson['WIDGET'].META_TITLE : null;
608
+ brandJson['WIDGET'].FAVICON_URL? document.querySelector("link[rel~='icon']").setAttribute('href', brandJson['WIDGET'].FAVICON_URL) : null;
609
+ /** FOOTER-LOGO **/
610
+ brandJson['COMMON'].COMPANY_LOGO? document.getElementById('footer-logo').src = brandJson['COMMON'].COMPANY_LOGO : null;
611
+ brandJson['COMMON'].COMPANY_SITE_NAME? document.getElementById('footer-logo').alt = brandJson['COMMON'].COMPANY_SITE_NAME : null;
612
+ brandJson['COMMON'].COMPANY_SITE_URL? document.getElementById('footer-link').href = brandJson['COMMON'].COMPANY_SITE_URL : null;
613
+ /** HEADER-LOGO **/
614
+ brandJson['COMMON'].BASE_LOGO_NO_TEXT? document.getElementById('header-logo').src = brandJson['COMMON'].BASE_LOGO_NO_TEXT: null;
615
+ brandJson['COMMON'].BRAND_PRIMARY_COLOR? document.body.style.setProperty('--base-company-logo', brandJson['COMMON'].BRAND_PRIMARY_COLOR): null;
616
+ }
617
+ }
618
+
619
+ }
620
+ xhr.open('GET', url, true);
621
+ xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
622
+ xhr.send();
623
+ }
624
+
452
625
 
453
626
 
454
627
  </script>
@@ -457,15 +630,36 @@
457
630
 
458
631
  <body class="website white" >
459
632
 
633
+ <!-- <div id="preloader">
634
+ <div class="logo"></div>
635
+ </div> -->
460
636
 
461
637
  <div id="preloader">
462
- <div class="logo"></div>
638
+ <div class="loader"></div>
463
639
  </div>
464
640
 
465
641
  <header id="header">
466
642
  <!-- <ul class="nav navbar-nav navbar-left">
467
643
  <li class="sign-up"><button class="share-btn" onclick="copyLink()">SHARE THIS PROTOTYPE</button></li>
468
644
  </ul> -->
645
+ <div class="header-left">
646
+ <div>
647
+ <img id="header-logo" class="logo" src="./tiledesk_widget_files/logo-short.png">
648
+ </div>
649
+ </div>
650
+ <div class="header-right">
651
+ <div class="header-go-back">
652
+ <!-- <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#006cff">
653
+ <path d="M0 0h24v24H0z" fill="none"/><path d="M11.67 3.87L9.9 2.1 0 12l9.9 9.9 1.77-1.77L3.54 12z"/>
654
+ </svg> -->
655
+ <span class="cds-text">
656
+ Design Studio
657
+ </span>
658
+
659
+ </div>
660
+ <div class="header-title ellips" id="tiledesk_widgetTitle"></div>
661
+ </div>
662
+
469
663
  </header>
470
664
  <!-- The actual snackbar -->
471
665
  <div id="snackbar">Copied to clipboard...</div>
@@ -475,9 +669,9 @@
475
669
 
476
670
  <footer id="footer">
477
671
  <div class="b-agent-demo_powered_by">
478
- <a href="https://console.tiledesk.com/" target="_blank" style="cursor: pointer;text-decoration: none;">
672
+ <a href="https://console.tiledesk.com/" target="_blank" style="cursor: pointer;text-decoration: none;" id="footer-link">
479
673
  <span style="position: relative; top: 2px;">Powered by</span>
480
- <img src="./tiledesk_widget_files/logo@2x-black.png">
674
+ <img src="./tiledesk_widget_files/logo@2x-black.png" id="footer-logo">
481
675
  </a>
482
676
  </div>
483
677
  </footer>
@@ -86,6 +86,16 @@
86
86
  height: 100%;
87
87
  }
88
88
 
89
+ .container{
90
+ display: flex;
91
+ align-items: center;
92
+ width: 100% !important;
93
+ justify-content: space-around;
94
+ }
95
+ #header-logo{
96
+ height: 50px;
97
+ }
98
+
89
99
  #wrapper {
90
100
  /* display: block!important; */
91
101
  min-height: 100%;
@@ -112,6 +122,8 @@
112
122
  left: 0px;
113
123
  right: 0px;
114
124
  width: 100%;
125
+ justify-content: flex-start;
126
+ flex-direction: row;
115
127
  }
116
128
 
117
129
  .row {
@@ -180,7 +192,9 @@
180
192
  }
181
193
 
182
194
  .b-agent-demo_powered_by a {
183
- display: inline-block;
195
+ display: inline-flex;
196
+ align-items: center;
197
+ gap: 10px;
184
198
  margin-top: 30px;
185
199
  margin-bottom: 30px;
186
200
  text-decoration: none;
@@ -436,6 +450,8 @@
436
450
  window.Tiledesk('onBeforeInit', function(event_data) {
437
451
  console.log("onBeforeInit Tiledesk FN", event_data);
438
452
 
453
+ var brandSrc = event_data.detail.appConfigs.brandSrc? getBrandResources(event_data.detail.appConfigs.brandSrc) : null;
454
+
439
455
  setTimeout(() => {
440
456
  if(event_data && event_data.detail && event_data.detail.appConfigs){
441
457
 
@@ -610,7 +626,7 @@
610
626
  TelegramShareUrl,
611
627
  '_blank'
612
628
  );
613
- }
629
+ }
614
630
 
615
631
  function shareOnWhatsapp() {
616
632
  var WhatsappShareUrl = "whatsapp://send?text=" + currentUrl;
@@ -633,6 +649,32 @@
633
649
  );
634
650
  }
635
651
 
652
+ function getBrandResources(url) {
653
+ var xhr = new XMLHttpRequest();
654
+ xhr.onreadystatechange = function () {
655
+ if (xhr.readyState === 4) {
656
+ var brandJson = JSON.parse(xhr.response)
657
+ if(brandJson){
658
+ /** TITLE AND FAVICON **/
659
+ brandJson['WIDGET'].META_TITLE? document.body.title = brandJson['WIDGET'].META_TITLE : null;
660
+ brandJson['WIDGET'].FAVICON_URL? document.querySelector("link[rel~='icon']").setAttribute('href', brandJson['WIDGET'].FAVICON_URL) : null;
661
+ /** FOOTER-LOGO **/
662
+ brandJson['COMMON'].COMPANY_LOGO? document.getElementById('footer-logo').src = brandJson['COMMON'].COMPANY_LOGO : null;
663
+ brandJson['COMMON'].COMPANY_SITE_NAME? document.getElementById('footer-logo').alt = brandJson['COMMON'].COMPANY_SITE_NAME : null;
664
+ brandJson['COMMON'].COMPANY_SITE_URL? document.getElementById('footer-link').href = brandJson['COMMON'].COMPANY_SITE_URL : null;
665
+ /** HEADER-LOGO **/
666
+ brandJson['COMMON'].BASE_LOGO_WHITE? document.getElementById('header-logo').src = brandJson['COMMON'].BASE_LOGO_WHITE : null;
667
+ /** HEADER-DOCS RESOURCES **/
668
+ document.getElementsByClassName('docs')[0].style.display = 'none'
669
+ }
670
+ }
671
+ }
672
+ xhr.open('GET', url, true);
673
+ xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
674
+ xhr.send();
675
+ }
676
+
677
+
636
678
  function onClickTestButton(event){
637
679
  console.log('onClickTestButton: event-->',event)
638
680
  if(event ==='hide'){
@@ -640,6 +682,7 @@
640
682
  }else{
641
683
  window.Tiledesk(event);
642
684
  }
685
+ window.Tiledesk('setParameter', {key: 'poweredBy', value: ''})
643
686
  }
644
687
 
645
688
  function onClickSignInAnonymous(){
@@ -1565,7 +1608,7 @@
1565
1608
  <span class="icon-bar"></span>
1566
1609
  <span class="icon-bar"></span>
1567
1610
  </button>
1568
- <a class="navbar-brand" href="https://console.tiledesk.com/"></a>
1611
+ <img src="tiledesk_widget_files/logo.png" id="header-logo">
1569
1612
  </div>
1570
1613
 
1571
1614
  <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
@@ -1585,7 +1628,7 @@
1585
1628
 
1586
1629
  <div id="main" class="container">
1587
1630
  <div class="row">
1588
- <div class="col-md-7">
1631
+ <div class="col-md-12">
1589
1632
  <h1 style="min-height: 39px;">TEST ACTIONS</h1>
1590
1633
  <h3 id="project_name" style="min-height: 39px;"></h3>
1591
1634
  <div class="row method_container">
@@ -2374,20 +2417,16 @@
2374
2417
  </div>
2375
2418
  </div>
2376
2419
 
2377
- <div class="col-md-6"></div>
2378
2420
  </div>
2379
2421
 
2380
- <div class="row">
2381
- <div class="col-md-6">
2382
- <h1 id="project_name" style="min-height: 39px;"></h1>
2383
- <h2></h2>
2384
- <div class="b_integrations_agent_links">
2385
- <a href="" data-toggle="modal" data-target="#embedModal" id="enbed" style="display: none;"><i class="fa-code fa"></i>Embed</a>
2386
- <!-- <a href="mailto:?subject=Tiledesk%20widget%20test%20page"><i class="fa-envelope-o fa" target="_blank"></i>Email</a> -->
2387
- <a href="" data-toggle="modal" data-target="#shareModal"><i class="fa-reply fa"></i>Share</a>
2388
- </div>
2422
+ <div class="row" style="width: 100%;">
2423
+ <h1 id="project_name" style="min-height: 39px;"></h1>
2424
+ <h2></h2>
2425
+ <div class="b_integrations_agent_links">
2426
+ <a href="" data-toggle="modal" data-target="#embedModal" id="enbed" style="display: none;"><i class="fa-code fa"></i>Embed</a>
2427
+ <!-- <a href="mailto:?subject=Tiledesk%20widget%20test%20page"><i class="fa-envelope-o fa" target="_blank"></i>Email</a> -->
2428
+ <a href="" data-toggle="modal" data-target="#shareModal"><i class="fa-reply fa"></i>Share</a>
2389
2429
  </div>
2390
- <div class="col-md-6"></div>
2391
2430
  </div>
2392
2431
 
2393
2432
 
@@ -2468,9 +2507,9 @@
2468
2507
 
2469
2508
  <footer id="footer">
2470
2509
  <div class="b-agent-demo_powered_by">
2471
- <a href="https://console.tiledesk.com/" target="_blank" style="cursor: pointer;text-decoration: none;">
2510
+ <a href="https://console.tiledesk.com/" target="_blank" style="cursor: pointer;text-decoration: none;" id="footer-link">
2472
2511
  <span style="position: relative; top: 2px;">Powered by</span>
2473
- <img src="./tiledesk_widget_files/logo@2x-black.png">
2512
+ <img src="./tiledesk_widget_files/logo@2x-black.png" id="footer-logo">
2474
2513
  </a>
2475
2514
  </div>
2476
2515
  </footer>