@lls/store 24.6.0 → 24.7.0-00ed974f
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/lib/index.js +153 -102
- package/package.json +6 -8
package/lib/index.js
CHANGED
|
@@ -742,19 +742,20 @@ var getToken = _.get("auth.token");
|
|
|
742
742
|
|
|
743
743
|
// src/selectors/school.ts
|
|
744
744
|
init_define_import_meta();
|
|
745
|
-
import { makeEntitiesFilter } from "@lls/utils";
|
|
745
|
+
import { makeEntitiesFilter, pipe } from "@lls/utils";
|
|
746
|
+
import _2 from "lodash/fp.js";
|
|
746
747
|
|
|
747
748
|
// src/selectors/crud.ts
|
|
748
749
|
init_define_import_meta();
|
|
749
750
|
import { createSearchSelector, makeGetAllEntities, makeGetEntityById } from "@lls/utils";
|
|
750
751
|
import { useMemo } from "react";
|
|
751
752
|
import { useSelector } from "react-redux";
|
|
752
|
-
var crud = (entityName, { search:
|
|
753
|
+
var crud = (entityName, { search: search31 }) => {
|
|
753
754
|
const getElements = makeGetAllEntities(entityName);
|
|
754
755
|
const makeSearchElements = () => createSearchSelector(
|
|
755
756
|
makeGetAllEntities(entityName),
|
|
756
757
|
(_state, params) => params,
|
|
757
|
-
(elements, params) =>
|
|
758
|
+
(elements, params) => search31(params)(elements)
|
|
758
759
|
);
|
|
759
760
|
const methodName = `${entityName.charAt(0).toUpperCase()}${entityName.slice(1)}`;
|
|
760
761
|
const getElementById = makeGetEntityById(entityName);
|
|
@@ -764,7 +765,7 @@ var crud = (entityName, { search: search30 }) => {
|
|
|
764
765
|
[`search${methodName}`]: makeSearchElements(),
|
|
765
766
|
[`get${methodName.replace(/s$/, "")}`]: getElementById,
|
|
766
767
|
[`makeSearch${methodName}`]: makeSearchElements,
|
|
767
|
-
[`filter${methodName}`]:
|
|
768
|
+
[`filter${methodName}`]: search31,
|
|
768
769
|
[`useSearch${methodName}`]: useSearch
|
|
769
770
|
};
|
|
770
771
|
return back;
|
|
@@ -777,15 +778,21 @@ var makeUseSearch = (makeSearchElements) => {
|
|
|
777
778
|
};
|
|
778
779
|
|
|
779
780
|
// src/selectors/school.ts
|
|
780
|
-
var search = ({ ids }) =>
|
|
781
|
+
var search = ({ ids, academyIds, sortByQuery }) => {
|
|
782
|
+
return (schools) => pipe(
|
|
783
|
+
schools,
|
|
784
|
+
makeEntitiesFilter({ id: ids, academy: academyIds }),
|
|
785
|
+
_2.isFunction(sortByQuery) ? sortByQuery : sortByQuery ? _2.sortBy(sortByQuery) : _2.identity
|
|
786
|
+
);
|
|
787
|
+
};
|
|
781
788
|
var { getSchools, getSchool, useSearchSchools } = crud("schools", {
|
|
782
789
|
search
|
|
783
790
|
});
|
|
784
791
|
|
|
785
792
|
// src/selectors/book.ts
|
|
786
793
|
init_define_import_meta();
|
|
787
|
-
import { createSearchSelector as createSearchSelector2, makeEntitiesFilter as makeEntitiesFilter2, makeGetEntityById as makeGetEntityById2, pipe } from "@lls/utils";
|
|
788
|
-
import
|
|
794
|
+
import { createSearchSelector as createSearchSelector2, makeEntitiesFilter as makeEntitiesFilter2, makeGetEntityById as makeGetEntityById2, pipe as pipe2 } from "@lls/utils";
|
|
795
|
+
import _3 from "lodash/fp.js";
|
|
789
796
|
var search2 = ({
|
|
790
797
|
ids,
|
|
791
798
|
levelIds,
|
|
@@ -803,7 +810,7 @@ var search2 = ({
|
|
|
803
810
|
isRenewed,
|
|
804
811
|
isPrimary
|
|
805
812
|
}) => {
|
|
806
|
-
return (books) =>
|
|
813
|
+
return (books) => pipe2(
|
|
807
814
|
books,
|
|
808
815
|
makeEntitiesFilter2({
|
|
809
816
|
id: ids,
|
|
@@ -821,13 +828,13 @@ var search2 = ({
|
|
|
821
828
|
isRenewed,
|
|
822
829
|
isPrimary
|
|
823
830
|
}),
|
|
824
|
-
|
|
831
|
+
_3.isFunction(sortByQuery) ? sortByQuery : sortByQuery ? _3.sortBy(sortByQuery) : _3.identity
|
|
825
832
|
);
|
|
826
833
|
};
|
|
827
834
|
var { getBooks, getBook, filterBooks, useSearchBooks, makeSearchBooks } = crud("books", {
|
|
828
835
|
search: search2
|
|
829
836
|
});
|
|
830
|
-
var makeSearchValidBooks = () => createSearchSelector2(makeSearchBooks(), (books) =>
|
|
837
|
+
var makeSearchValidBooks = () => createSearchSelector2(makeSearchBooks(), (books) => _3.filter({ valid: true, hasNewDesign: true }, books));
|
|
831
838
|
var useSearchValidBooks = makeUseSearch(makeSearchValidBooks);
|
|
832
839
|
var makeGetBook = () => makeGetEntityById2("books");
|
|
833
840
|
|
|
@@ -847,18 +854,18 @@ var getCurrentUser = makeGetCurrentUser();
|
|
|
847
854
|
|
|
848
855
|
// src/selectors/chapter.ts
|
|
849
856
|
init_define_import_meta();
|
|
850
|
-
import { makeEntitiesFilter as makeEntitiesFilter4, pipe as
|
|
851
|
-
import
|
|
852
|
-
var search4 = ({ bookIds, ids, hasTeacherBook, sortByQuery }) => (chapters) =>
|
|
857
|
+
import { makeEntitiesFilter as makeEntitiesFilter4, pipe as pipe3 } from "@lls/utils";
|
|
858
|
+
import _4 from "lodash/fp.js";
|
|
859
|
+
var search4 = ({ bookIds, ids, hasTeacherBook, sortByQuery }) => (chapters) => pipe3(
|
|
853
860
|
chapters,
|
|
854
861
|
makeEntitiesFilter4(
|
|
855
862
|
{
|
|
856
863
|
book: bookIds,
|
|
857
864
|
id: ids
|
|
858
865
|
},
|
|
859
|
-
!
|
|
866
|
+
!_4.isNil(hasTeacherBook) && ((chapter2) => !!chapter2?.teacherBook === hasTeacherBook)
|
|
860
867
|
),
|
|
861
|
-
|
|
868
|
+
_4.isFunction(sortByQuery) ? sortByQuery : sortByQuery ? _4.sortBy(sortByQuery) : _4.identity
|
|
862
869
|
);
|
|
863
870
|
var { getChapters, getChapter, useSearchChapters } = crud("chapters", {
|
|
864
871
|
search: search4
|
|
@@ -866,8 +873,8 @@ var { getChapters, getChapter, useSearchChapters } = crud("chapters", {
|
|
|
866
873
|
|
|
867
874
|
// src/selectors/page.ts
|
|
868
875
|
init_define_import_meta();
|
|
869
|
-
import { makeEntitiesFilter as makeEntitiesFilter5, pipe as
|
|
870
|
-
import
|
|
876
|
+
import { makeEntitiesFilter as makeEntitiesFilter5, pipe as pipe4 } from "@lls/utils";
|
|
877
|
+
import _5 from "lodash/fp.js";
|
|
871
878
|
var search5 = ({
|
|
872
879
|
ids,
|
|
873
880
|
chapterIds,
|
|
@@ -892,7 +899,7 @@ var search5 = ({
|
|
|
892
899
|
sortByQuery
|
|
893
900
|
}) => {
|
|
894
901
|
let pageById = false;
|
|
895
|
-
return (pages) =>
|
|
902
|
+
return (pages) => pipe4(
|
|
896
903
|
pages,
|
|
897
904
|
makeEntitiesFilter5(
|
|
898
905
|
{
|
|
@@ -916,12 +923,12 @@ var search5 = ({
|
|
|
916
923
|
isDraft
|
|
917
924
|
},
|
|
918
925
|
isParentCreatedFromScratch && ((page2, pages2) => {
|
|
919
|
-
pageById = pageById ||
|
|
920
|
-
return !!
|
|
926
|
+
pageById = pageById || _5.keyBy("id", pages2);
|
|
927
|
+
return !!_5.get([page2?.originalPage, "isCreatedFromScratch"], pageById);
|
|
921
928
|
}),
|
|
922
|
-
updatedAfter &&
|
|
929
|
+
updatedAfter && _5.flow(_5.get("updatedAt"), (date) => new Date(date).getTime() - updatedAfter.getTime() >= 0)
|
|
923
930
|
),
|
|
924
|
-
|
|
931
|
+
_5.isFunction(sortByQuery) ? sortByQuery : sortByQuery ? _5.sortBy(sortByQuery) : _5.identity
|
|
925
932
|
);
|
|
926
933
|
};
|
|
927
934
|
var { getPages, getPage, filterPages, useSearchPages, makeSearchPages } = crud("pages", {
|
|
@@ -935,8 +942,8 @@ var { useSearchPages: useSearchModifiedPages } = crud("pages", { search: searchM
|
|
|
935
942
|
|
|
936
943
|
// src/selectors/collection.ts
|
|
937
944
|
init_define_import_meta();
|
|
938
|
-
import
|
|
939
|
-
var search6 = (_params) =>
|
|
945
|
+
import _6 from "lodash/fp.js";
|
|
946
|
+
var search6 = (_params) => _6.identity;
|
|
940
947
|
var { getCollections, getCollection, useSearchCollections } = crud("collections", {
|
|
941
948
|
search: search6
|
|
942
949
|
});
|
|
@@ -959,8 +966,8 @@ var { getCommunityProjects, getCommunityProject, useSearchCommunityProjects } =
|
|
|
959
966
|
|
|
960
967
|
// src/selectors/contact.ts
|
|
961
968
|
init_define_import_meta();
|
|
962
|
-
import
|
|
963
|
-
var search8 = (_params) =>
|
|
969
|
+
import _7 from "lodash/fp.js";
|
|
970
|
+
var search8 = (_params) => _7.identity;
|
|
964
971
|
var { getContacts, getContact, useSearchContacts } = crud("contacts", {
|
|
965
972
|
search: search8
|
|
966
973
|
});
|
|
@@ -972,7 +979,7 @@ var search9 = ({ ids, read, pageIds }) => {
|
|
|
972
979
|
return makeEntitiesFilter7({ read, id: ids, page: pageIds });
|
|
973
980
|
};
|
|
974
981
|
var makeSearchCopyNotifications = () => createSearchSelector3(
|
|
975
|
-
[makeGetCurrentUser(), makeGetAllEntities2("copyNotifications"), (
|
|
982
|
+
[makeGetCurrentUser(), makeGetAllEntities2("copyNotifications"), (_20, params) => params],
|
|
976
983
|
(currentUser, copyNotifications, { pageIds, read }) => {
|
|
977
984
|
const ids = currentUser?.copyNotifications;
|
|
978
985
|
return search9({ ids, read, pageIds })(copyNotifications);
|
|
@@ -983,10 +990,17 @@ var useSearchCopyNotifications = makeUseSearch(makeSearchCopyNotifications);
|
|
|
983
990
|
// src/selectors/document.ts
|
|
984
991
|
init_define_import_meta();
|
|
985
992
|
import { makeEntitiesFilter as makeEntitiesFilter8 } from "@lls/utils";
|
|
986
|
-
var search10 = ({
|
|
993
|
+
var search10 = ({
|
|
994
|
+
ids,
|
|
995
|
+
uuids,
|
|
996
|
+
resourceIds,
|
|
997
|
+
levelIds
|
|
998
|
+
}) => {
|
|
987
999
|
return makeEntitiesFilter8({
|
|
988
1000
|
id: ids,
|
|
989
|
-
resourceId: resourceIds
|
|
1001
|
+
resourceId: resourceIds,
|
|
1002
|
+
levels: levelIds,
|
|
1003
|
+
uuidV2: uuids
|
|
990
1004
|
});
|
|
991
1005
|
};
|
|
992
1006
|
var { useSearchDocuments } = crud("documents", {
|
|
@@ -1000,7 +1014,7 @@ var search11 = ({ ids, read, pageIds }) => {
|
|
|
1000
1014
|
return makeEntitiesFilter9({ read, id: ids, page: pageIds });
|
|
1001
1015
|
};
|
|
1002
1016
|
var makeSearchDrawerNotifications = () => createSearchSelector4(
|
|
1003
|
-
[makeGetCurrentUser(), makeGetAllEntities3("drawerNotifications"), (
|
|
1017
|
+
[makeGetCurrentUser(), makeGetAllEntities3("drawerNotifications"), (_20, params) => params],
|
|
1004
1018
|
(currentUser, drawerNotifications, { read, pageIds }) => {
|
|
1005
1019
|
const ids = currentUser?.drawerNotifications;
|
|
1006
1020
|
return search11({ ids, read, pageIds })(drawerNotifications);
|
|
@@ -1015,8 +1029,8 @@ var getFaqs = makeGetAllEntities4("faq");
|
|
|
1015
1029
|
|
|
1016
1030
|
// src/selectors/garDivision.ts
|
|
1017
1031
|
init_define_import_meta();
|
|
1018
|
-
import
|
|
1019
|
-
var search12 = (_params) =>
|
|
1032
|
+
import _8 from "lodash/fp.js";
|
|
1033
|
+
var search12 = (_params) => _8.identity;
|
|
1020
1034
|
var { getGarDivisions, getGarDivision, useSearchGarDivisions } = crud("garDivisions", {
|
|
1021
1035
|
search: search12
|
|
1022
1036
|
});
|
|
@@ -1025,8 +1039,8 @@ var { getGarDivisions, getGarDivision, useSearchGarDivisions } = crud("garDivisi
|
|
|
1025
1039
|
init_define_import_meta();
|
|
1026
1040
|
var import_reselect2 = __toESM(require_lib(), 1);
|
|
1027
1041
|
import { makeEntitiesFilter as makeEntitiesFilter10 } from "@lls/utils";
|
|
1028
|
-
import
|
|
1029
|
-
var search13 = ({ ownerIds }) =>
|
|
1042
|
+
import _9 from "lodash/fp.js";
|
|
1043
|
+
var search13 = ({ ownerIds }) => _9.flow(makeEntitiesFilter10({ owner: ownerIds }), _9.orderBy("createdAt", ["desc"]));
|
|
1030
1044
|
var { getGroups, getGroup, useSearchGroups } = crud("groups", {
|
|
1031
1045
|
search: search13
|
|
1032
1046
|
});
|
|
@@ -1038,9 +1052,22 @@ var getUserGroups = (0, import_reselect2.createSelector)(
|
|
|
1038
1052
|
// src/selectors/level.ts
|
|
1039
1053
|
init_define_import_meta();
|
|
1040
1054
|
var import_reselect3 = __toESM(require_lib(), 1);
|
|
1055
|
+
import { createSearchSelector as createSearchSelector5, makeEntitiesFilter as makeEntitiesFilter12, makeGetAllEntities as makeGetAllEntities5 } from "@lls/utils";
|
|
1056
|
+
import _10 from "lodash/fp.js";
|
|
1057
|
+
|
|
1058
|
+
// src/selectors/schoolType.ts
|
|
1059
|
+
init_define_import_meta();
|
|
1041
1060
|
import { makeEntitiesFilter as makeEntitiesFilter11 } from "@lls/utils";
|
|
1042
|
-
|
|
1043
|
-
var
|
|
1061
|
+
var search14 = ({ slugs }) => makeEntitiesFilter11({ slug: slugs });
|
|
1062
|
+
var { getSchoolTypes, getSchoolType, useSearchSchoolTypes, makeSearchSchoolTypes, searchSchoolTypes } = crud(
|
|
1063
|
+
"schoolTypes",
|
|
1064
|
+
{
|
|
1065
|
+
search: search14
|
|
1066
|
+
}
|
|
1067
|
+
);
|
|
1068
|
+
|
|
1069
|
+
// src/selectors/level.ts
|
|
1070
|
+
var search15 = ({
|
|
1044
1071
|
ids,
|
|
1045
1072
|
slugs,
|
|
1046
1073
|
isPreSchool,
|
|
@@ -1048,9 +1075,10 @@ var search14 = ({
|
|
|
1048
1075
|
isHighSchool,
|
|
1049
1076
|
isProHighSchool,
|
|
1050
1077
|
isGenHighSchool,
|
|
1051
|
-
isElementarySchool
|
|
1052
|
-
|
|
1053
|
-
|
|
1078
|
+
isElementarySchool,
|
|
1079
|
+
schoolTypes
|
|
1080
|
+
}) => _10.flow(
|
|
1081
|
+
makeEntitiesFilter12({
|
|
1054
1082
|
id: ids,
|
|
1055
1083
|
slug: slugs,
|
|
1056
1084
|
isPreSchool,
|
|
@@ -1058,35 +1086,49 @@ var search14 = ({
|
|
|
1058
1086
|
isHighSchool,
|
|
1059
1087
|
isProHighSchool,
|
|
1060
1088
|
isGenHighSchool,
|
|
1061
|
-
isElementarySchool
|
|
1089
|
+
isElementarySchool,
|
|
1090
|
+
schoolTypes
|
|
1062
1091
|
}),
|
|
1063
|
-
|
|
1092
|
+
_10.orderBy("order", "desc")
|
|
1064
1093
|
);
|
|
1065
|
-
var
|
|
1066
|
-
|
|
1067
|
-
|
|
1094
|
+
var makeSearchLevels = () => {
|
|
1095
|
+
const searchSchoolTypes2 = makeSearchSchoolTypes();
|
|
1096
|
+
return createSearchSelector5(
|
|
1097
|
+
makeGetAllEntities5("levels"),
|
|
1098
|
+
(state, { schoolTypes }) => schoolTypes ? searchSchoolTypes2(state, { slugs: schoolTypes }) : void 0,
|
|
1099
|
+
(_state, params) => params,
|
|
1100
|
+
(levels, schoolTypes, params) => search15({ ...params, schoolTypes: schoolTypes?.length ? schoolTypes?.map(({ id }) => id) : void 0 })(levels)
|
|
1101
|
+
);
|
|
1102
|
+
};
|
|
1103
|
+
var crudLevels = crud("levels", { search: search15 });
|
|
1104
|
+
var { getLevel, searchLevels } = crudLevels;
|
|
1105
|
+
var getLevels = (0, import_reselect3.createSelector)(
|
|
1106
|
+
crudLevels.getLevels,
|
|
1107
|
+
_10.orderBy("order", "desc")
|
|
1108
|
+
);
|
|
1109
|
+
var useSearchLevels = makeUseSearch(makeSearchLevels);
|
|
1068
1110
|
|
|
1069
1111
|
// src/selectors/mainNotification.ts
|
|
1070
1112
|
init_define_import_meta();
|
|
1071
1113
|
var import_reselect4 = __toESM(require_lib(), 1);
|
|
1072
|
-
import { makeEntitiesFilter as
|
|
1073
|
-
import
|
|
1074
|
-
var
|
|
1114
|
+
import { makeEntitiesFilter as makeEntitiesFilter13, makeGetAllEntities as makeGetAllEntities6 } from "@lls/utils";
|
|
1115
|
+
import _11 from "lodash/fp.js";
|
|
1116
|
+
var search16 = ({ ids }) => makeEntitiesFilter13({ id: ids });
|
|
1075
1117
|
var getMainNotifications = (0, import_reselect4.createSelector)(
|
|
1076
|
-
[
|
|
1077
|
-
(userNotifications, notifications) =>
|
|
1118
|
+
[_11.flow(makeGetCurrentUser(), _11.get("mainNotifications")), makeGetAllEntities6("mainNotifications")],
|
|
1119
|
+
(userNotifications, notifications) => search16({ ids: userNotifications })(notifications)
|
|
1078
1120
|
);
|
|
1079
1121
|
|
|
1080
1122
|
// src/selectors/news.ts
|
|
1081
1123
|
init_define_import_meta();
|
|
1082
|
-
import { makeEntitiesFilter as
|
|
1083
|
-
var
|
|
1124
|
+
import { makeEntitiesFilter as makeEntitiesFilter14 } from "@lls/utils";
|
|
1125
|
+
var search17 = ({ ids }) => makeEntitiesFilter14({ id: ids });
|
|
1084
1126
|
var {
|
|
1085
1127
|
getNews: getAllNews,
|
|
1086
1128
|
getNew: getNews,
|
|
1087
1129
|
useSearchNews
|
|
1088
1130
|
} = crud("news", {
|
|
1089
|
-
search:
|
|
1131
|
+
search: search17
|
|
1090
1132
|
});
|
|
1091
1133
|
|
|
1092
1134
|
// src/selectors/panorama.ts
|
|
@@ -1096,26 +1138,26 @@ var getPanorama = makeGetEntityById3("panoramas");
|
|
|
1096
1138
|
|
|
1097
1139
|
// src/selectors/premiumResource.ts
|
|
1098
1140
|
init_define_import_meta();
|
|
1099
|
-
import { makeEntitiesFilter as
|
|
1100
|
-
var
|
|
1141
|
+
import { makeEntitiesFilter as makeEntitiesFilter15 } from "@lls/utils";
|
|
1142
|
+
var search18 = ({ bookIds }) => makeEntitiesFilter15({ book: bookIds });
|
|
1101
1143
|
var { getPremiumResources, getPremiumResource, useSearchPremiumResources } = crud("premiumResources", {
|
|
1102
|
-
search:
|
|
1144
|
+
search: search18
|
|
1103
1145
|
});
|
|
1104
1146
|
|
|
1105
1147
|
// src/selectors/lexicalFlower.ts
|
|
1106
1148
|
init_define_import_meta();
|
|
1107
|
-
import { makeEntitiesFilter as
|
|
1108
|
-
var
|
|
1149
|
+
import { makeEntitiesFilter as makeEntitiesFilter16 } from "@lls/utils";
|
|
1150
|
+
var search19 = ({ ids }) => makeEntitiesFilter16({ id: ids });
|
|
1109
1151
|
var { getLexicalFlowers, useSearchLexicalFlowers } = crud("lexicalFlowers", {
|
|
1110
|
-
search:
|
|
1152
|
+
search: search19
|
|
1111
1153
|
});
|
|
1112
1154
|
|
|
1113
1155
|
// src/selectors/product.ts
|
|
1114
1156
|
init_define_import_meta();
|
|
1115
|
-
import
|
|
1116
|
-
import { createSearchSelector as
|
|
1117
|
-
var getProducts =
|
|
1118
|
-
var
|
|
1157
|
+
import _12 from "lodash/fp.js";
|
|
1158
|
+
import { createSearchSelector as createSearchSelector6, makeEntitiesFilter as makeEntitiesFilter17, makeGetAllEntities as makeGetAllEntities7 } from "@lls/utils";
|
|
1159
|
+
var getProducts = makeGetAllEntities7("products");
|
|
1160
|
+
var search20 = ({
|
|
1119
1161
|
ids,
|
|
1120
1162
|
eans,
|
|
1121
1163
|
isAdoptant,
|
|
@@ -1125,7 +1167,7 @@ var search19 = ({
|
|
|
1125
1167
|
productTypes
|
|
1126
1168
|
}) => {
|
|
1127
1169
|
let bookIds;
|
|
1128
|
-
const filter =
|
|
1170
|
+
const filter = makeEntitiesFilter17(
|
|
1129
1171
|
{
|
|
1130
1172
|
id: ids,
|
|
1131
1173
|
ean: eans,
|
|
@@ -1136,43 +1178,35 @@ var search19 = ({
|
|
|
1136
1178
|
levelIds || subjectIds ? (product2) => !!product2?.books?.some((bookId) => bookIds.has(bookId)) : false
|
|
1137
1179
|
);
|
|
1138
1180
|
return (products, books) => {
|
|
1139
|
-
bookIds = new Set(
|
|
1181
|
+
bookIds = new Set(_12.flow(_12.map("id"), _12.map(_12.parseInt(10)))(books));
|
|
1140
1182
|
return filter(products);
|
|
1141
1183
|
};
|
|
1142
1184
|
};
|
|
1143
1185
|
var makeSearchProducts = () => {
|
|
1144
1186
|
const searchBooks = makeSearchBooks();
|
|
1145
|
-
return
|
|
1146
|
-
|
|
1187
|
+
return createSearchSelector6(
|
|
1188
|
+
makeGetAllEntities7("products"),
|
|
1147
1189
|
(state, { levelIds, subjectIds }) => searchBooks(state, { levelIds, subjectIds }),
|
|
1148
1190
|
(_state, params) => params,
|
|
1149
|
-
(products, books, params) =>
|
|
1191
|
+
(products, books, params) => search20(params)(products, books)
|
|
1150
1192
|
);
|
|
1151
1193
|
};
|
|
1152
1194
|
var useSearchProducts = makeUseSearch(makeSearchProducts);
|
|
1153
1195
|
|
|
1154
1196
|
// src/selectors/resource.ts
|
|
1155
1197
|
init_define_import_meta();
|
|
1156
|
-
import { makeEntitiesFilter as
|
|
1157
|
-
var
|
|
1198
|
+
import { makeEntitiesFilter as makeEntitiesFilter18 } from "@lls/utils";
|
|
1199
|
+
var search21 = ({ chapterIds }) => makeEntitiesFilter18({
|
|
1158
1200
|
chapter: chapterIds
|
|
1159
1201
|
});
|
|
1160
1202
|
var { getResources, getResource, useSearchResources } = crud("resources", {
|
|
1161
|
-
search: search20
|
|
1162
|
-
});
|
|
1163
|
-
|
|
1164
|
-
// src/selectors/schoolType.ts
|
|
1165
|
-
init_define_import_meta();
|
|
1166
|
-
import { makeEntitiesFilter as makeEntitiesFilter18 } from "@lls/utils";
|
|
1167
|
-
var search21 = ({ slugs }) => makeEntitiesFilter18({ slug: slugs });
|
|
1168
|
-
var { getSchoolTypes, getSchoolType, useSearchSchoolTypes, makeSearchSchoolTypes } = crud("schoolTypes", {
|
|
1169
1203
|
search: search21
|
|
1170
1204
|
});
|
|
1171
1205
|
|
|
1172
1206
|
// src/selectors/sharedPage.ts
|
|
1173
1207
|
init_define_import_meta();
|
|
1174
|
-
import { createSearchSelector as
|
|
1175
|
-
import
|
|
1208
|
+
import { createSearchSelector as createSearchSelector7, makeEntitiesFilter as makeEntitiesFilter19 } from "@lls/utils";
|
|
1209
|
+
import _13 from "lodash/fp.js";
|
|
1176
1210
|
var search22 = ({
|
|
1177
1211
|
parentIds,
|
|
1178
1212
|
userIds,
|
|
@@ -1191,13 +1225,13 @@ var search22 = ({
|
|
|
1191
1225
|
var { getSharedPages, getSharedPage, useSearchSharedPages } = crud("sharedPages", {
|
|
1192
1226
|
search: search22
|
|
1193
1227
|
});
|
|
1194
|
-
var makeSearchCurrentUserSharedPages = () =>
|
|
1228
|
+
var makeSearchCurrentUserSharedPages = () => createSearchSelector7(
|
|
1195
1229
|
getCurrentUser,
|
|
1196
1230
|
getSharedPages,
|
|
1197
1231
|
(__, params) => params,
|
|
1198
1232
|
(user2, sharedPages, params) => {
|
|
1199
1233
|
const sharedUserPageIds = user2?.sharedPages ?? [];
|
|
1200
|
-
return search22({ ...params, ids:
|
|
1234
|
+
return search22({ ...params, ids: _13.intersection(sharedUserPageIds, params.ids || sharedUserPageIds) })(sharedPages);
|
|
1201
1235
|
}
|
|
1202
1236
|
);
|
|
1203
1237
|
var useSearchCurrentUserSharedPages = makeUseSearch(makeSearchCurrentUserSharedPages);
|
|
@@ -1212,8 +1246,8 @@ var { getStudents, getStudent, useSearchStudents } = crud("students", {
|
|
|
1212
1246
|
|
|
1213
1247
|
// src/selectors/subject.ts
|
|
1214
1248
|
init_define_import_meta();
|
|
1215
|
-
import { limitToTeacherSubjects, makeEntitiesFilter as makeEntitiesFilter21, pipe as
|
|
1216
|
-
import
|
|
1249
|
+
import { limitToTeacherSubjects, makeEntitiesFilter as makeEntitiesFilter21, pipe as pipe5 } from "@lls/utils";
|
|
1250
|
+
import _14 from "lodash/fp.js";
|
|
1217
1251
|
var search24 = ({
|
|
1218
1252
|
ids,
|
|
1219
1253
|
slugs,
|
|
@@ -1223,7 +1257,7 @@ var search24 = ({
|
|
|
1223
1257
|
hasBooks,
|
|
1224
1258
|
names,
|
|
1225
1259
|
sortByQuery
|
|
1226
|
-
}) => (subjects) =>
|
|
1260
|
+
}) => (subjects) => pipe5(
|
|
1227
1261
|
subjects,
|
|
1228
1262
|
makeEntitiesFilter21(
|
|
1229
1263
|
{
|
|
@@ -1233,10 +1267,10 @@ var search24 = ({
|
|
|
1233
1267
|
hasBooks,
|
|
1234
1268
|
schoolTypes
|
|
1235
1269
|
},
|
|
1236
|
-
!
|
|
1270
|
+
!_14.isNil(hasNewsletterUrl) && ((subject2) => Boolean(subject2?.newsletterUrl) === hasNewsletterUrl)
|
|
1237
1271
|
),
|
|
1238
|
-
(subjects2) =>
|
|
1239
|
-
|
|
1272
|
+
(subjects2) => _14.isNil(isTeacherSubject) ? subjects2 : limitToTeacherSubjects(subjects2),
|
|
1273
|
+
_14.isFunction(sortByQuery) ? sortByQuery : sortByQuery ? _14.sortBy(sortByQuery) : _14.identity
|
|
1240
1274
|
);
|
|
1241
1275
|
var { getSubjects, getSubject, useSearchSubjects, makeSearchSubjects } = crud("subjects", {
|
|
1242
1276
|
search: search24
|
|
@@ -1289,16 +1323,24 @@ var { getBuilderIos, getBuilderIo, useSearchBuilderIos } = crud("builderIos", {
|
|
|
1289
1323
|
|
|
1290
1324
|
// src/selectors/circonscription.ts
|
|
1291
1325
|
init_define_import_meta();
|
|
1292
|
-
import
|
|
1293
|
-
var search29 = (_params) =>
|
|
1326
|
+
import _15 from "lodash/fp.js";
|
|
1327
|
+
var search29 = (_params) => _15.identity;
|
|
1294
1328
|
var { getCirconscriptions } = crud("circonscriptions", {
|
|
1295
1329
|
search: search29
|
|
1296
1330
|
});
|
|
1297
1331
|
|
|
1332
|
+
// src/selectors/documentType.ts
|
|
1333
|
+
init_define_import_meta();
|
|
1334
|
+
import _16 from "lodash/fp.js";
|
|
1335
|
+
var search30 = (_params) => _16.identity;
|
|
1336
|
+
var { getDocumentTypes, getDocumentType } = crud("documentTypes", {
|
|
1337
|
+
search: search30
|
|
1338
|
+
});
|
|
1339
|
+
|
|
1298
1340
|
// src/reducers/entities.ts
|
|
1299
1341
|
init_define_import_meta();
|
|
1300
1342
|
import { makeReducer } from "@lls/utils";
|
|
1301
|
-
import
|
|
1343
|
+
import _17 from "lodash/fp.js";
|
|
1302
1344
|
|
|
1303
1345
|
// src/actions/index.ts
|
|
1304
1346
|
init_define_import_meta();
|
|
@@ -1321,16 +1363,16 @@ var resetAuth = makeActionCreator(actionTypes.RESET_AUTH);
|
|
|
1321
1363
|
// src/reducers/entities.ts
|
|
1322
1364
|
var deleteEntityReducer = (state, payload) => {
|
|
1323
1365
|
const { path } = payload;
|
|
1324
|
-
return
|
|
1366
|
+
return _17.omit(path, state);
|
|
1325
1367
|
};
|
|
1326
1368
|
var updateEntityReducer = (state, payload) => {
|
|
1327
1369
|
const { path, entity } = payload;
|
|
1328
|
-
const currentEntity =
|
|
1329
|
-
return
|
|
1370
|
+
const currentEntity = _17.get(path, state);
|
|
1371
|
+
return _17.set(path, _17.merge(currentEntity, entity), state);
|
|
1330
1372
|
};
|
|
1331
1373
|
var setEntityReducer = (state, payload) => {
|
|
1332
1374
|
const { path, entity } = payload;
|
|
1333
|
-
return
|
|
1375
|
+
return _17.set(path, entity, state);
|
|
1334
1376
|
};
|
|
1335
1377
|
var setEntitiesReducer = (state, payload) => {
|
|
1336
1378
|
if (typeof payload !== "object") return state;
|
|
@@ -1351,7 +1393,7 @@ var setEntitiesReducer = (state, payload) => {
|
|
|
1351
1393
|
}
|
|
1352
1394
|
const diff = Object.keys(entity).some((prop) => {
|
|
1353
1395
|
const value = entity[prop];
|
|
1354
|
-
if (!
|
|
1396
|
+
if (!_17.isEqual(state[entityName]?.[id]?.[prop], value)) {
|
|
1355
1397
|
return true;
|
|
1356
1398
|
}
|
|
1357
1399
|
});
|
|
@@ -1383,7 +1425,7 @@ var entities_default = entities;
|
|
|
1383
1425
|
// src/reducers/auth.ts
|
|
1384
1426
|
init_define_import_meta();
|
|
1385
1427
|
import { makeReducer as makeReducer2 } from "@lls/utils";
|
|
1386
|
-
import
|
|
1428
|
+
import _18 from "lodash/fp.js";
|
|
1387
1429
|
var initialState = {
|
|
1388
1430
|
id: void 0,
|
|
1389
1431
|
role: null,
|
|
@@ -1396,16 +1438,16 @@ var initialState = {
|
|
|
1396
1438
|
llsUserId: null
|
|
1397
1439
|
};
|
|
1398
1440
|
var auth = makeReducer2(initialState, {
|
|
1399
|
-
[actionTypes.SET_AUTH]:
|
|
1400
|
-
[actionTypes.RESET_AUTH]:
|
|
1441
|
+
[actionTypes.SET_AUTH]: _18.assign,
|
|
1442
|
+
[actionTypes.RESET_AUTH]: _18.constant(initialState)
|
|
1401
1443
|
});
|
|
1402
1444
|
var auth_default = auth;
|
|
1403
1445
|
|
|
1404
1446
|
// src/schema/index.ts
|
|
1405
1447
|
init_define_import_meta();
|
|
1406
1448
|
var import_normalizr = __toESM(require_normalizr(), 1);
|
|
1407
|
-
import
|
|
1408
|
-
var document = new import_normalizr.schema.Entity("documents"
|
|
1449
|
+
import _19 from "lodash/fp.js";
|
|
1450
|
+
var document = new import_normalizr.schema.Entity("documents");
|
|
1409
1451
|
var subject = new import_normalizr.schema.Entity("subjects");
|
|
1410
1452
|
var level = new import_normalizr.schema.Entity("levels");
|
|
1411
1453
|
var book = new import_normalizr.schema.Entity("books");
|
|
@@ -1465,7 +1507,8 @@ var garDivisionSchema = define(garDivision, {
|
|
|
1465
1507
|
school
|
|
1466
1508
|
});
|
|
1467
1509
|
var documentSchema = define(document, {
|
|
1468
|
-
page
|
|
1510
|
+
page,
|
|
1511
|
+
levels: [level]
|
|
1469
1512
|
});
|
|
1470
1513
|
var chapterSchema = define(chapter, {
|
|
1471
1514
|
book,
|
|
@@ -1555,6 +1598,9 @@ var newsSchema = define(news, {
|
|
|
1555
1598
|
var premiumResourceSchema = define(premiumResource, {
|
|
1556
1599
|
book
|
|
1557
1600
|
});
|
|
1601
|
+
var levelSchema = define(level, {
|
|
1602
|
+
schoolTypes: [schoolType]
|
|
1603
|
+
});
|
|
1558
1604
|
var querySchema = {
|
|
1559
1605
|
viewer: {
|
|
1560
1606
|
addCorrectionsToGroup: group,
|
|
@@ -1610,7 +1656,7 @@ var querySchema = {
|
|
|
1610
1656
|
}
|
|
1611
1657
|
}
|
|
1612
1658
|
};
|
|
1613
|
-
var normalizeData =
|
|
1659
|
+
var normalizeData = _19.flow((data) => (0, import_normalizr.normalize)(data, querySchema));
|
|
1614
1660
|
export {
|
|
1615
1661
|
auth_default as authReducer,
|
|
1616
1662
|
entities_default as entitiesReducer,
|
|
@@ -1632,6 +1678,8 @@ export {
|
|
|
1632
1678
|
getContact,
|
|
1633
1679
|
getContacts,
|
|
1634
1680
|
getCurrentUser,
|
|
1681
|
+
getDocumentType,
|
|
1682
|
+
getDocumentTypes,
|
|
1635
1683
|
getDraft,
|
|
1636
1684
|
getDrafts,
|
|
1637
1685
|
getFaqs,
|
|
@@ -1676,6 +1724,7 @@ export {
|
|
|
1676
1724
|
makeGetCurrentUser,
|
|
1677
1725
|
makeSearchBooks,
|
|
1678
1726
|
makeSearchDrawerNotifications,
|
|
1727
|
+
makeSearchLevels,
|
|
1679
1728
|
makeSearchPages,
|
|
1680
1729
|
makeSearchSchoolTypes,
|
|
1681
1730
|
makeSearchSubjects,
|
|
@@ -1683,6 +1732,8 @@ export {
|
|
|
1683
1732
|
makeUseSearch,
|
|
1684
1733
|
normalizeData,
|
|
1685
1734
|
querySchema,
|
|
1735
|
+
searchLevels,
|
|
1736
|
+
searchSchoolTypes,
|
|
1686
1737
|
setEntitiesReducer,
|
|
1687
1738
|
useSearchBooks,
|
|
1688
1739
|
useSearchBuilderIos,
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@lls/store",
|
|
3
3
|
"description": "model de donnée et selecteurs",
|
|
4
4
|
"homepage": "https://github.com/lelivrescolaire/monorepo/tree/dev/libs/store",
|
|
5
|
-
"version": "24.
|
|
5
|
+
"version": "24.7.0-00ed974f",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"types": "./lib/builttypes/store/src/index.d.ts",
|
|
8
8
|
"exports": {
|
|
@@ -46,11 +46,10 @@
|
|
|
46
46
|
"redux": "5.0.1",
|
|
47
47
|
"reselect": "4.1.8",
|
|
48
48
|
"typescript": "5.6.3",
|
|
49
|
-
"vite": "5.4.
|
|
50
|
-
"vite-tsconfig-paths": "5.1.
|
|
51
|
-
"
|
|
52
|
-
"@lls/
|
|
53
|
-
"@lls/vitescripts": "24.6.0"
|
|
49
|
+
"vite": "5.4.11",
|
|
50
|
+
"vite-tsconfig-paths": "5.1.3",
|
|
51
|
+
"@lls/utils": "24.7.0-00ed974f",
|
|
52
|
+
"@lls/vitescripts": "24.7.0-00ed974f"
|
|
54
53
|
},
|
|
55
54
|
"license": "ISC",
|
|
56
55
|
"dependencies": {
|
|
@@ -60,7 +59,6 @@
|
|
|
60
59
|
"build": "node build.mjs",
|
|
61
60
|
"lint": "pnpm biome check --apply src __tests__",
|
|
62
61
|
"dts": "pnpm tsc --project tsconfig.production.json",
|
|
63
|
-
"test": "
|
|
64
|
-
"v2test": "bun test"
|
|
62
|
+
"test": "bun test"
|
|
65
63
|
}
|
|
66
64
|
}
|