@bigbinary/neeto-molecules 1.0.22 → 1.0.24

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/dist/Sidebar.js CHANGED
@@ -1,11 +1,10 @@
1
1
  import React, { useRef, useCallback, useEffect, Children, isValidElement, cloneElement, forwardRef, useState } from 'react';
2
2
  import { toLower, mergeDeepLeft, not } from 'ramda';
3
- import { useLocation, NavLink } from 'react-router-dom';
4
- import { useOnClickOutside } from '@bigbinary/neeto-commons-frontend/react-utils';
3
+ import { Link, useLocation, NavLink } from 'react-router-dom';
5
4
  import { NeetoIcon, Close, Search, AppSwitcher as AppSwitcher$1, Book, Keyboard, ChatEmpty, Gift, User, Settings, LeftArrow, Help } from '@bigbinary/neeto-icons';
6
5
  import { Typography, Button, Input, Tooltip, Avatar } from '@bigbinary/neetoui';
7
6
  import { useTranslation } from 'react-i18next';
8
- import { capitalize, noop as noop$1, truncate } from '@bigbinary/neeto-commons-frontend/pure';
7
+ import { capitalize, noop as noop$1, truncate, findBy } from '@bigbinary/neeto-commons-frontend/pure';
9
8
  import * as AppIcons from '@bigbinary/neeto-icons/app-icons';
10
9
  import { t as t$1 } from 'i18next';
11
10
  import { resetAuthTokens } from '@bigbinary/neeto-commons-frontend/utils';
@@ -32579,9 +32578,499 @@ var Portal = function Portal(_ref) {
32579
32578
  return /*#__PURE__*/reactDom.exports.createPortal(children, target.current);
32580
32579
  };
32581
32580
 
32581
+ function cov_1r2ywuxngm() {
32582
+ var path = "/home/runner/work/neeto-molecules/neeto-molecules/src/components/Sidebar/AppSwitcher/utils.js";
32583
+ var hash = "288fa234e84e26ed8fa5ff782656864c5f046c27";
32584
+ var global = new Function("return this")();
32585
+ var gcv = "__coverage__";
32586
+ var coverageData = {
32587
+ path: "/home/runner/work/neeto-molecules/neeto-molecules/src/components/Sidebar/AppSwitcher/utils.js",
32588
+ statementMap: {
32589
+ "0": {
32590
+ start: {
32591
+ line: 3,
32592
+ column: 33
32593
+ },
32594
+ end: {
32595
+ line: 29,
32596
+ column: 1
32597
+ }
32598
+ },
32599
+ "1": {
32600
+ start: {
32601
+ line: 4,
32602
+ column: 2
32603
+ },
32604
+ end: {
32605
+ line: 28,
32606
+ column: 39
32607
+ }
32608
+ },
32609
+ "2": {
32610
+ start: {
32611
+ line: 5,
32612
+ column: 21
32613
+ },
32614
+ end: {
32615
+ line: 20,
32616
+ column: 5
32617
+ }
32618
+ },
32619
+ "3": {
32620
+ start: {
32621
+ line: 7,
32622
+ column: 6
32623
+ },
32624
+ end: {
32625
+ line: 9,
32626
+ column: 7
32627
+ }
32628
+ },
32629
+ "4": {
32630
+ start: {
32631
+ line: 8,
32632
+ column: 8
32633
+ },
32634
+ end: {
32635
+ line: 8,
32636
+ column: 15
32637
+ }
32638
+ },
32639
+ "5": {
32640
+ start: {
32641
+ line: 11,
32642
+ column: 6
32643
+ },
32644
+ end: {
32645
+ line: 18,
32646
+ column: 7
32647
+ }
32648
+ },
32649
+ "6": {
32650
+ start: {
32651
+ line: 13,
32652
+ column: 8
32653
+ },
32654
+ end: {
32655
+ line: 15,
32656
+ column: 9
32657
+ }
32658
+ },
32659
+ "7": {
32660
+ start: {
32661
+ line: 14,
32662
+ column: 10
32663
+ },
32664
+ end: {
32665
+ line: 14,
32666
+ column: 25
32667
+ }
32668
+ },
32669
+ "8": {
32670
+ start: {
32671
+ line: 17,
32672
+ column: 8
32673
+ },
32674
+ end: {
32675
+ line: 17,
32676
+ column: 15
32677
+ }
32678
+ },
32679
+ "9": {
32680
+ start: {
32681
+ line: 19,
32682
+ column: 6
32683
+ },
32684
+ end: {
32685
+ line: 19,
32686
+ column: 21
32687
+ }
32688
+ },
32689
+ "10": {
32690
+ start: {
32691
+ line: 21,
32692
+ column: 4
32693
+ },
32694
+ end: {
32695
+ line: 21,
32696
+ column: 53
32697
+ }
32698
+ },
32699
+ "11": {
32700
+ start: {
32701
+ line: 22,
32702
+ column: 4
32703
+ },
32704
+ end: {
32705
+ line: 22,
32706
+ column: 54
32707
+ }
32708
+ },
32709
+ "12": {
32710
+ start: {
32711
+ line: 24,
32712
+ column: 4
32713
+ },
32714
+ end: {
32715
+ line: 27,
32716
+ column: 6
32717
+ }
32718
+ },
32719
+ "13": {
32720
+ start: {
32721
+ line: 25,
32722
+ column: 6
32723
+ },
32724
+ end: {
32725
+ line: 25,
32726
+ column: 58
32727
+ }
32728
+ },
32729
+ "14": {
32730
+ start: {
32731
+ line: 26,
32732
+ column: 6
32733
+ },
32734
+ end: {
32735
+ line: 26,
32736
+ column: 59
32737
+ }
32738
+ }
32739
+ },
32740
+ fnMap: {
32741
+ "0": {
32742
+ name: "(anonymous_0)",
32743
+ decl: {
32744
+ start: {
32745
+ line: 3,
32746
+ column: 33
32747
+ },
32748
+ end: {
32749
+ line: 3,
32750
+ column: 34
32751
+ }
32752
+ },
32753
+ loc: {
32754
+ start: {
32755
+ line: 3,
32756
+ column: 69
32757
+ },
32758
+ end: {
32759
+ line: 29,
32760
+ column: 1
32761
+ }
32762
+ },
32763
+ line: 3
32764
+ },
32765
+ "1": {
32766
+ name: "(anonymous_1)",
32767
+ decl: {
32768
+ start: {
32769
+ line: 4,
32770
+ column: 12
32771
+ },
32772
+ end: {
32773
+ line: 4,
32774
+ column: 13
32775
+ }
32776
+ },
32777
+ loc: {
32778
+ start: {
32779
+ line: 4,
32780
+ column: 18
32781
+ },
32782
+ end: {
32783
+ line: 28,
32784
+ column: 3
32785
+ }
32786
+ },
32787
+ line: 4
32788
+ },
32789
+ "2": {
32790
+ name: "(anonymous_2)",
32791
+ decl: {
32792
+ start: {
32793
+ line: 5,
32794
+ column: 21
32795
+ },
32796
+ end: {
32797
+ line: 5,
32798
+ column: 22
32799
+ }
32800
+ },
32801
+ loc: {
32802
+ start: {
32803
+ line: 5,
32804
+ column: 30
32805
+ },
32806
+ end: {
32807
+ line: 20,
32808
+ column: 5
32809
+ }
32810
+ },
32811
+ line: 5
32812
+ },
32813
+ "3": {
32814
+ name: "(anonymous_3)",
32815
+ decl: {
32816
+ start: {
32817
+ line: 24,
32818
+ column: 11
32819
+ },
32820
+ end: {
32821
+ line: 24,
32822
+ column: 12
32823
+ }
32824
+ },
32825
+ loc: {
32826
+ start: {
32827
+ line: 24,
32828
+ column: 17
32829
+ },
32830
+ end: {
32831
+ line: 27,
32832
+ column: 5
32833
+ }
32834
+ },
32835
+ line: 24
32836
+ }
32837
+ },
32838
+ branchMap: {
32839
+ "0": {
32840
+ loc: {
32841
+ start: {
32842
+ line: 7,
32843
+ column: 6
32844
+ },
32845
+ end: {
32846
+ line: 9,
32847
+ column: 7
32848
+ }
32849
+ },
32850
+ type: "if",
32851
+ locations: [{
32852
+ start: {
32853
+ line: 7,
32854
+ column: 6
32855
+ },
32856
+ end: {
32857
+ line: 9,
32858
+ column: 7
32859
+ }
32860
+ }, {
32861
+ start: {
32862
+ line: undefined,
32863
+ column: undefined
32864
+ },
32865
+ end: {
32866
+ line: undefined,
32867
+ column: undefined
32868
+ }
32869
+ }],
32870
+ line: 7
32871
+ },
32872
+ "1": {
32873
+ loc: {
32874
+ start: {
32875
+ line: 7,
32876
+ column: 10
32877
+ },
32878
+ end: {
32879
+ line: 7,
32880
+ column: 72
32881
+ }
32882
+ },
32883
+ type: "binary-expr",
32884
+ locations: [{
32885
+ start: {
32886
+ line: 7,
32887
+ column: 10
32888
+ },
32889
+ end: {
32890
+ line: 7,
32891
+ column: 28
32892
+ }
32893
+ }, {
32894
+ start: {
32895
+ line: 7,
32896
+ column: 32
32897
+ },
32898
+ end: {
32899
+ line: 7,
32900
+ column: 72
32901
+ }
32902
+ }],
32903
+ line: 7
32904
+ },
32905
+ "2": {
32906
+ loc: {
32907
+ start: {
32908
+ line: 11,
32909
+ column: 6
32910
+ },
32911
+ end: {
32912
+ line: 18,
32913
+ column: 7
32914
+ }
32915
+ },
32916
+ type: "if",
32917
+ locations: [{
32918
+ start: {
32919
+ line: 11,
32920
+ column: 6
32921
+ },
32922
+ end: {
32923
+ line: 18,
32924
+ column: 7
32925
+ }
32926
+ }, {
32927
+ start: {
32928
+ line: undefined,
32929
+ column: undefined
32930
+ },
32931
+ end: {
32932
+ line: undefined,
32933
+ column: undefined
32934
+ }
32935
+ }],
32936
+ line: 11
32937
+ },
32938
+ "3": {
32939
+ loc: {
32940
+ start: {
32941
+ line: 13,
32942
+ column: 8
32943
+ },
32944
+ end: {
32945
+ line: 15,
32946
+ column: 9
32947
+ }
32948
+ },
32949
+ type: "if",
32950
+ locations: [{
32951
+ start: {
32952
+ line: 13,
32953
+ column: 8
32954
+ },
32955
+ end: {
32956
+ line: 15,
32957
+ column: 9
32958
+ }
32959
+ }, {
32960
+ start: {
32961
+ line: undefined,
32962
+ column: undefined
32963
+ },
32964
+ end: {
32965
+ line: undefined,
32966
+ column: undefined
32967
+ }
32968
+ }],
32969
+ line: 13
32970
+ }
32971
+ },
32972
+ s: {
32973
+ "0": 0,
32974
+ "1": 0,
32975
+ "2": 0,
32976
+ "3": 0,
32977
+ "4": 0,
32978
+ "5": 0,
32979
+ "6": 0,
32980
+ "7": 0,
32981
+ "8": 0,
32982
+ "9": 0,
32983
+ "10": 0,
32984
+ "11": 0,
32985
+ "12": 0,
32986
+ "13": 0,
32987
+ "14": 0
32988
+ },
32989
+ f: {
32990
+ "0": 0,
32991
+ "1": 0,
32992
+ "2": 0,
32993
+ "3": 0
32994
+ },
32995
+ b: {
32996
+ "0": [0, 0],
32997
+ "1": [0, 0],
32998
+ "2": [0, 0],
32999
+ "3": [0, 0]
33000
+ },
33001
+ _coverageSchema: "1a1c01bbd47fc00a2c39e90264f33305004495a9",
33002
+ hash: "288fa234e84e26ed8fa5ff782656864c5f046c27"
33003
+ };
33004
+ var coverage = global[gcv] || (global[gcv] = {});
33005
+ if (!coverage[path] || coverage[path].hash !== hash) {
33006
+ coverage[path] = coverageData;
33007
+ }
33008
+ var actualCoverage = coverage[path];
33009
+ {
33010
+ // @ts-ignore
33011
+ cov_1r2ywuxngm = function () {
33012
+ return actualCoverage;
33013
+ };
33014
+ }
33015
+ return actualCoverage;
33016
+ }
33017
+ cov_1r2ywuxngm();
33018
+ cov_1r2ywuxngm().s[0]++;
33019
+ var useOnClickOutside = function useOnClickOutside(insideRef, outsideRef, handler) {
33020
+ cov_1r2ywuxngm().f[0]++;
33021
+ cov_1r2ywuxngm().s[1]++;
33022
+ useEffect(function () {
33023
+ cov_1r2ywuxngm().f[1]++;
33024
+ cov_1r2ywuxngm().s[2]++;
33025
+ var listener = function listener(event) {
33026
+ cov_1r2ywuxngm().f[2]++;
33027
+ cov_1r2ywuxngm().s[3]++;
33028
+ // Do nothing if clicking ref's element or descendent elements
33029
+ if ((cov_1r2ywuxngm().b[1][0]++, !insideRef.current) || (cov_1r2ywuxngm().b[1][1]++, insideRef.current.contains(event.target))) {
33030
+ cov_1r2ywuxngm().b[0][0]++;
33031
+ cov_1r2ywuxngm().s[4]++;
33032
+ return;
33033
+ } else {
33034
+ cov_1r2ywuxngm().b[0][1]++;
33035
+ }
33036
+ cov_1r2ywuxngm().s[5]++;
33037
+ if (outsideRef.current) {
33038
+ cov_1r2ywuxngm().b[2][0]++;
33039
+ cov_1r2ywuxngm().s[6]++;
33040
+ // If Outside ref exists, trigger the handler if it contains the event target.
33041
+ if (outsideRef.current.contains(event.target)) {
33042
+ cov_1r2ywuxngm().b[3][0]++;
33043
+ cov_1r2ywuxngm().s[7]++;
33044
+ handler(event);
33045
+ } else {
33046
+ cov_1r2ywuxngm().b[3][1]++;
33047
+ }
33048
+ cov_1r2ywuxngm().s[8]++;
33049
+ return;
33050
+ } else {
33051
+ cov_1r2ywuxngm().b[2][1]++;
33052
+ }
33053
+ cov_1r2ywuxngm().s[9]++;
33054
+ handler(event);
33055
+ };
33056
+ cov_1r2ywuxngm().s[10]++;
33057
+ document.addEventListener("mousedown", listener);
33058
+ cov_1r2ywuxngm().s[11]++;
33059
+ document.addEventListener("touchstart", listener);
33060
+ cov_1r2ywuxngm().s[12]++;
33061
+ return function () {
33062
+ cov_1r2ywuxngm().f[3]++;
33063
+ cov_1r2ywuxngm().s[13]++;
33064
+ document.removeEventListener("mousedown", listener);
33065
+ cov_1r2ywuxngm().s[14]++;
33066
+ document.removeEventListener("touchstart", listener);
33067
+ };
33068
+ }, [insideRef, outsideRef, handler]);
33069
+ };
33070
+
32582
33071
  function cov_2lck7amjw7() {
32583
33072
  var path = "/home/runner/work/neeto-molecules/neeto-molecules/src/components/Sidebar/AppSwitcher/index.jsx";
32584
- var hash = "9e7dfb5276cd6b4e1c47045af63d80b09e5c44ed";
33073
+ var hash = "f48177db9e544dcc6e11b963cf49f5c34e8e9e6d";
32585
33074
  var global = new Function("return this")();
32586
33075
  var gcv = "__coverage__";
32587
33076
  var coverageData = {
@@ -32624,7 +33113,7 @@ function cov_2lck7amjw7() {
32624
33113
  },
32625
33114
  end: {
32626
33115
  line: 16,
32627
- column: 42
33116
+ column: 55
32628
33117
  }
32629
33118
  },
32630
33119
  "4": {
@@ -32688,7 +33177,7 @@ function cov_2lck7amjw7() {
32688
33177
  },
32689
33178
  b: {},
32690
33179
  _coverageSchema: "1a1c01bbd47fc00a2c39e90264f33305004495a9",
32691
- hash: "9e7dfb5276cd6b4e1c47045af63d80b09e5c44ed"
33180
+ hash: "f48177db9e544dcc6e11b963cf49f5c34e8e9e6d"
32692
33181
  };
32693
33182
  var coverage = global[gcv] || (global[gcv] = {});
32694
33183
  if (!coverage[path] || coverage[path].hash !== hash) {
@@ -32712,7 +33201,7 @@ var AppSwitcher = function AppSwitcher(_ref) {
32712
33201
  var paneWrapper = (cov_2lck7amjw7().s[1]++, useRef(null));
32713
33202
  var backdropRef = (cov_2lck7amjw7().s[2]++, useRef(null));
32714
33203
  cov_2lck7amjw7().s[3]++;
32715
- useOnClickOutside(backdropRef, onClose);
33204
+ useOnClickOutside(paneWrapper, backdropRef, onClose);
32716
33205
  cov_2lck7amjw7().s[4]++;
32717
33206
  useHotkeys("esc", onClose);
32718
33207
  cov_2lck7amjw7().s[5]++;
@@ -35020,7 +35509,7 @@ var Footer = function Footer(_ref) {
35020
35509
 
35021
35510
  function cov_17k34ad0bz() {
35022
35511
  var path = "/home/runner/work/neeto-molecules/neeto-molecules/src/components/Sidebar/Header.jsx";
35023
- var hash = "a9924345c51fae250c82767af6b2cf501c3bc435";
35512
+ var hash = "fff7fb107aeb6ef1908194eb0afb1951e6504740";
35024
35513
  var global = new Function("return this")();
35025
35514
  var gcv = "__coverage__";
35026
35515
  var coverageData = {
@@ -35028,41 +35517,51 @@ function cov_17k34ad0bz() {
35028
35517
  statementMap: {
35029
35518
  "0": {
35030
35519
  start: {
35031
- line: 9,
35520
+ line: 10,
35032
35521
  column: 15
35033
35522
  },
35034
35523
  end: {
35035
- line: 26,
35524
+ line: 36,
35036
35525
  column: 1
35037
35526
  }
35038
35527
  },
35039
35528
  "1": {
35040
35529
  start: {
35041
- line: 10,
35530
+ line: 11,
35042
35531
  column: 19
35043
35532
  },
35044
35533
  end: {
35045
- line: 12,
35534
+ line: 13,
35046
35535
  column: 5
35047
35536
  }
35048
35537
  },
35049
35538
  "2": {
35050
35539
  start: {
35051
- line: 14,
35540
+ line: 15,
35052
35541
  column: 22
35053
35542
  },
35054
35543
  end: {
35055
- line: 14,
35544
+ line: 15,
35056
35545
  column: 44
35057
35546
  }
35058
35547
  },
35059
35548
  "3": {
35060
35549
  start: {
35061
- line: 16,
35550
+ line: 17,
35551
+ column: 18
35552
+ },
35553
+ end: {
35554
+ line: 22,
35555
+ column: 3
35556
+ }
35557
+ },
35558
+ "4": {
35559
+ start: {
35560
+ line: 24,
35062
35561
  column: 2
35063
35562
  },
35064
35563
  end: {
35065
- line: 25,
35564
+ line: 35,
35066
35565
  column: 4
35067
35566
  }
35068
35567
  }
@@ -35072,67 +35571,68 @@ function cov_17k34ad0bz() {
35072
35571
  name: "(anonymous_0)",
35073
35572
  decl: {
35074
35573
  start: {
35075
- line: 9,
35574
+ line: 10,
35076
35575
  column: 15
35077
35576
  },
35078
35577
  end: {
35079
- line: 9,
35578
+ line: 10,
35080
35579
  column: 16
35081
35580
  }
35082
35581
  },
35083
35582
  loc: {
35084
35583
  start: {
35085
- line: 9,
35584
+ line: 10,
35086
35585
  column: 21
35087
35586
  },
35088
35587
  end: {
35089
- line: 26,
35588
+ line: 36,
35090
35589
  column: 1
35091
35590
  }
35092
35591
  },
35093
- line: 9
35592
+ line: 10
35094
35593
  }
35095
35594
  },
35096
35595
  branchMap: {
35097
35596
  "0": {
35098
35597
  loc: {
35099
35598
  start: {
35100
- line: 22,
35101
- column: 9
35599
+ line: 31,
35600
+ column: 11
35102
35601
  },
35103
35602
  end: {
35104
- line: 22,
35105
- column: 50
35603
+ line: 31,
35604
+ column: 52
35106
35605
  }
35107
35606
  },
35108
35607
  type: "cond-expr",
35109
35608
  locations: [{
35110
35609
  start: {
35111
- line: 22,
35112
- column: 23
35610
+ line: 31,
35611
+ column: 25
35113
35612
  },
35114
35613
  end: {
35115
- line: 22,
35116
- column: 38
35614
+ line: 31,
35615
+ column: 40
35117
35616
  }
35118
35617
  }, {
35119
35618
  start: {
35120
- line: 22,
35121
- column: 41
35619
+ line: 31,
35620
+ column: 43
35122
35621
  },
35123
35622
  end: {
35124
- line: 22,
35125
- column: 50
35623
+ line: 31,
35624
+ column: 52
35126
35625
  }
35127
35626
  }],
35128
- line: 22
35627
+ line: 31
35129
35628
  }
35130
35629
  },
35131
35630
  s: {
35132
35631
  "0": 0,
35133
35632
  "1": 0,
35134
35633
  "2": 0,
35135
- "3": 0
35634
+ "3": 0,
35635
+ "4": 0
35136
35636
  },
35137
35637
  f: {
35138
35638
  "0": 0
@@ -35141,7 +35641,7 @@ function cov_17k34ad0bz() {
35141
35641
  "0": [0, 0]
35142
35642
  },
35143
35643
  _coverageSchema: "1a1c01bbd47fc00a2c39e90264f33305004495a9",
35144
- hash: "a9924345c51fae250c82767af6b2cf501c3bc435"
35644
+ hash: "fff7fb107aeb6ef1908194eb0afb1951e6504740"
35145
35645
  };
35146
35646
  var coverage = global[gcv] || (global[gcv] = {});
35147
35647
  if (!coverage[path] || coverage[path].hash !== hash) {
@@ -35162,13 +35662,18 @@ var Header = function Header() {
35162
35662
  cov_17k34ad0bz().f[0]++;
35163
35663
  var logoName = (cov_17k34ad0bz().s[1]++, "Neeto".concat(capitalize(globalProps.appName.substr(5).toLowerCase())));
35164
35664
  var ProductLogo = (cov_17k34ad0bz().s[2]++, ProductLogos[logoName]);
35165
- cov_17k34ad0bz().s[3]++;
35665
+ var homeUrl = (cov_17k34ad0bz().s[3]++, new URL(findBy({
35666
+ name: globalProps.appName.split("neeto")[1]
35667
+ }, globalProps.neetoApps).url));
35668
+ cov_17k34ad0bz().s[4]++;
35166
35669
  return /*#__PURE__*/React.createElement("div", {
35167
35670
  className: "neeto-ui-flex neeto-ui-items-center neeto-molecules-sidebar__header",
35168
35671
  "data-cy": "sidebar-info"
35169
35672
  }, /*#__PURE__*/React.createElement("div", {
35170
35673
  className: "neeto-molecules-sidebar__logo flex flex-shrink-0 items-center justify-center"
35171
- }, ProductLogo ? (cov_17k34ad0bz().b[0][0]++, /*#__PURE__*/React.createElement(ProductLogo, null)) : (cov_17k34ad0bz().b[0][1]++, /*#__PURE__*/React.createElement(Neeto, null))));
35674
+ }, /*#__PURE__*/React.createElement(Link, {
35675
+ to: homeUrl.pathname
35676
+ }, ProductLogo ? (cov_17k34ad0bz().b[0][0]++, /*#__PURE__*/React.createElement(ProductLogo, null)) : (cov_17k34ad0bz().b[0][1]++, /*#__PURE__*/React.createElement(Neeto, null)))));
35172
35677
  };
35173
35678
 
35174
35679
  var _excluded = ["label", "to", "icon", "description"];