cozy-ui 79.2.2 → 79.2.3

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,3 +1,10 @@
1
+ ## [79.2.3](https://github.com/cozy/cozy-ui/compare/v79.2.2...v79.2.3) (2023-01-03)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **AppSections:** MakeMatcherFromSearch now accept unsupported filter ([1652d1c](https://github.com/cozy/cozy-ui/commit/1652d1c))
7
+
1
8
  ## [79.2.2](https://github.com/cozy/cozy-ui/compare/v79.2.1...v79.2.2) (2022-12-23)
2
9
 
3
10
 
package/CODEOWNERS CHANGED
@@ -1,2 +1,2 @@
1
1
  # General code owners
2
- * @JF-Cozy @Merkur39 @Ldoppea
2
+ * @JF-Cozy @Merkur39 @Ldoppea @zatteo
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-ui",
3
- "version": "79.2.2",
3
+ "version": "79.2.3",
4
4
  "description": "Cozy apps UI SDK",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -744,3 +744,229 @@ Array [
744
744
  },
745
745
  ]
746
746
  `;
747
+
748
+ exports[`makeMatcherFromSearch should work even for an unsupported filter 1`] = `
749
+ Array [
750
+ Object {
751
+ "categories": Array [
752
+ "cozy",
753
+ ],
754
+ "developer": Object {
755
+ "name": "Cozy",
756
+ },
757
+ "editor": "Cozy",
758
+ "icon": "<svg></svg>",
759
+ "installed": true,
760
+ "isInRegistry": true,
761
+ "label": 1,
762
+ "name": "Collect",
763
+ "name_prefix": "Cozy",
764
+ "permissions": Object {
765
+ "mock": Object {
766
+ "type": "io.mock.doctype",
767
+ },
768
+ "mock2": Object {
769
+ "type": "io.mock.doctype2",
770
+ },
771
+ },
772
+ "related": "http://collect.cozy.mock/",
773
+ "slug": "collect",
774
+ "tags": Array [
775
+ "konnector",
776
+ "collect",
777
+ "bills",
778
+ "providers",
779
+ "files",
780
+ ],
781
+ "type": "webapp",
782
+ "uninstallable": false,
783
+ "version": "3.0.0",
784
+ "versions": Object {
785
+ "beta": Array [
786
+ "3.0.0",
787
+ ],
788
+ "dev": Array [
789
+ "3.0.0",
790
+ ],
791
+ "stable": Array [
792
+ "3.0.0",
793
+ ],
794
+ },
795
+ },
796
+ Object {
797
+ "categories": Array [
798
+ "others",
799
+ ],
800
+ "developer": Object {
801
+ "name": "Cozy",
802
+ },
803
+ "editor": "Cozy",
804
+ "icon": "<svg></svg>",
805
+ "isInRegistry": true,
806
+ "locales": Object {
807
+ "name": "For Dev Only",
808
+ },
809
+ "name": "DevOnly",
810
+ "slug": "devonly",
811
+ "type": "webapp",
812
+ "uninstallable": true,
813
+ "versions": Object {
814
+ "beta": Array [],
815
+ "dev": Array [
816
+ "1.0.0-betaojdkehy989ekhflldh",
817
+ ],
818
+ "stable": Array [],
819
+ },
820
+ },
821
+ Object {
822
+ "categories": Array [
823
+ "cozy",
824
+ ],
825
+ "developer": Object {
826
+ "name": "Cozy",
827
+ },
828
+ "editor": "Cozy",
829
+ "icon": "<svg></svg>",
830
+ "installed": true,
831
+ "name": "Drive",
832
+ "name_prefix": "Cozy",
833
+ "permissions": Object {
834
+ "mock2": Object {
835
+ "type": "io.mock.doctype2",
836
+ },
837
+ },
838
+ "related": "http://drive.cozy.mock/",
839
+ "slug": "drive",
840
+ "tags": Array [
841
+ "search",
842
+ "files",
843
+ "folders",
844
+ ],
845
+ "type": "webapp",
846
+ "uninstallable": false,
847
+ "version": "3.0.0-beta89bnhj3993",
848
+ },
849
+ Object {
850
+ "categories": Array [
851
+ "isp",
852
+ "telecom",
853
+ ],
854
+ "developer": Object {
855
+ "name": "Cozy",
856
+ },
857
+ "icon": "<svg></svg>",
858
+ "isInRegistry": true,
859
+ "name": "Bouilligue",
860
+ "slug": "konnector-bouilligue",
861
+ "type": "konnector",
862
+ "uninstallable": true,
863
+ "versions": Object {
864
+ "beta": Array [
865
+ "0.1.0",
866
+ ],
867
+ "dev": Array [
868
+ "0.1.0",
869
+ ],
870
+ "stable": Array [
871
+ "0.1.0",
872
+ ],
873
+ },
874
+ },
875
+ Object {
876
+ "categories": Array [
877
+ "transport",
878
+ ],
879
+ "developer": Object {
880
+ "name": "Cozy",
881
+ },
882
+ "icon": "<svg></svg>",
883
+ "installed": true,
884
+ "isInRegistry": true,
885
+ "name": "Trinlane",
886
+ "permissions": Object {
887
+ "mock": Object {
888
+ "type": "io.mock.doctype",
889
+ },
890
+ },
891
+ "slug": "konnector-trinlane",
892
+ "tags": Array [
893
+ "transport",
894
+ "files",
895
+ "bills",
896
+ ],
897
+ "type": "konnector",
898
+ "uninstallable": true,
899
+ "version": "0.1.0",
900
+ "versions": Object {
901
+ "beta": Array [
902
+ "0.1.0",
903
+ ],
904
+ "dev": Array [
905
+ "0.1.0",
906
+ ],
907
+ "stable": Array [
908
+ "0.1.0",
909
+ ],
910
+ },
911
+ },
912
+ Object {
913
+ "categories": Array [
914
+ "cozy",
915
+ ],
916
+ "developer": Object {
917
+ "name": "Cozy",
918
+ },
919
+ "editor": "Cozy",
920
+ "icon": "<svg></svg>",
921
+ "isInRegistry": true,
922
+ "locales": Object {
923
+ "en": Object {
924
+ "long_description": "A long description finally short",
925
+ },
926
+ },
927
+ "name": "Photos",
928
+ "name_prefix": "Cozy",
929
+ "slug": "photos",
930
+ "type": "webapp",
931
+ "uninstallable": true,
932
+ "versions": Object {
933
+ "beta": Array [
934
+ "3.0.0",
935
+ ],
936
+ "dev": Array [
937
+ "3.0.0",
938
+ ],
939
+ "stable": Array [
940
+ "3.0.0",
941
+ ],
942
+ },
943
+ },
944
+ Object {
945
+ "availableVersion": "3.0.0",
946
+ "categories": Array [
947
+ "partners",
948
+ ],
949
+ "icon": "<svg></svg>",
950
+ "installed": true,
951
+ "isInRegistry": true,
952
+ "name": "Tasky",
953
+ "slug": "tasky",
954
+ "type": "webapp",
955
+ "uninstallable": true,
956
+ "versions": Object {
957
+ "beta": Array [
958
+ "3.0.0",
959
+ "1.0.0",
960
+ ],
961
+ "dev": Array [
962
+ "3.0.0",
963
+ "1.0.0",
964
+ ],
965
+ "stable": Array [
966
+ "3.0.0",
967
+ "1.0.0",
968
+ ],
969
+ },
970
+ },
971
+ ]
972
+ `;
@@ -52,7 +52,7 @@ export const makeMatcherFromSearch = (search = {}) => {
52
52
  // Create all predicates from the search object
53
53
  const predicates = Object.values(
54
54
  mapValues(search, (value, name) => {
55
- return searchAttrToMatcher[name](value)
55
+ return searchAttrToMatcher[name]?.(value)
56
56
  })
57
57
  )
58
58
  // Return a function returning true if all predicates pass
@@ -150,4 +150,9 @@ describe('makeMatcherFromSearch', () => {
150
150
  const matcher = makeMatcherFromSearch({ category: 'cozy' })
151
151
  expect([appWithoutCategories].filter(matcher)).toMatchSnapshot()
152
152
  })
153
+
154
+ it('should work even for an unsupported filter', () => {
155
+ const matcher = makeMatcherFromSearch({ unsupportedKey: 'omg' })
156
+ expect(mockApps.filter(matcher)).toMatchSnapshot()
157
+ })
153
158
  })
@@ -55,7 +55,6 @@ initialState = { open: isTesting() }
55
55
 
56
56
  const handleToggle = () => {setState(state => ({ open: !state.open }))}
57
57
 
58
- const colors = ['primary', 'secondary', 'success', 'error', 'warning', 'info']
59
58
  const initialVariants = [{ primary: true, secondary: true, success: false, error: false, warning: false, info: false }]
60
59
 
61
60
  ;
@@ -73,7 +73,9 @@ export var makeMatcherFromSearch = function makeMatcherFromSearch() {
73
73
  var search = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
74
74
  // Create all predicates from the search object
75
75
  var predicates = Object.values(mapValues(search, function (value, name) {
76
- return searchAttrToMatcher[name](value);
76
+ var _searchAttrToMatcher$;
77
+
78
+ return (_searchAttrToMatcher$ = searchAttrToMatcher[name]) === null || _searchAttrToMatcher$ === void 0 ? void 0 : _searchAttrToMatcher$.call(searchAttrToMatcher, value);
77
79
  })); // Return a function returning true if all predicates pass
78
80
 
79
81
  return overEvery(predicates);