@lls/store 24.1.59-8b07e64c → 24.1.59-8e1a3cff
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 +207 -233
- package/package.json +11 -11
package/lib/index.js
CHANGED
|
@@ -742,8 +742,7 @@ var getToken = _.get("auth.token");
|
|
|
742
742
|
|
|
743
743
|
// src/selectors/school.ts
|
|
744
744
|
init_define_import_meta();
|
|
745
|
-
import {
|
|
746
|
-
import _2 from "lodash/fp.js";
|
|
745
|
+
import { makeEntitiesFilter } from "@lls/utils";
|
|
747
746
|
|
|
748
747
|
// src/selectors/crud.ts
|
|
749
748
|
init_define_import_meta();
|
|
@@ -768,21 +767,15 @@ var crud = (entityName, { search: search24 }) => {
|
|
|
768
767
|
};
|
|
769
768
|
|
|
770
769
|
// src/selectors/school.ts
|
|
771
|
-
var search = ({ ids }) =>
|
|
770
|
+
var search = ({ ids }) => makeEntitiesFilter({ id: ids });
|
|
772
771
|
var { getSchools, getSchool, searchSchools, makeSearchSchools } = crud("schools", {
|
|
773
772
|
search
|
|
774
773
|
});
|
|
775
774
|
|
|
776
775
|
// src/selectors/book.ts
|
|
777
776
|
init_define_import_meta();
|
|
778
|
-
import {
|
|
779
|
-
|
|
780
|
-
filterEntitiesArrayFieldByValues,
|
|
781
|
-
filterEntitiesSimpleFieldByValue,
|
|
782
|
-
filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues2,
|
|
783
|
-
makeGetEntityById as makeGetEntityById2
|
|
784
|
-
} from "@lls/utils";
|
|
785
|
-
import _3 from "lodash/fp.js";
|
|
777
|
+
import { createSearchSelector as createSearchSelector2, makeEntitiesFilter as makeEntitiesFilter2, makeGetEntityById as makeGetEntityById2, pipe } from "@lls/utils";
|
|
778
|
+
import _2 from "lodash/fp.js";
|
|
786
779
|
var search2 = ({
|
|
787
780
|
ids,
|
|
788
781
|
levelIds,
|
|
@@ -799,36 +792,43 @@ var search2 = ({
|
|
|
799
792
|
publishers,
|
|
800
793
|
isRenewed,
|
|
801
794
|
isPrimary
|
|
802
|
-
}) =>
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
795
|
+
}) => {
|
|
796
|
+
return (books) => pipe(
|
|
797
|
+
books,
|
|
798
|
+
makeEntitiesFilter2({
|
|
799
|
+
id: ids,
|
|
800
|
+
year: years,
|
|
801
|
+
levels: levelIds,
|
|
802
|
+
subjects: subjectIds,
|
|
803
|
+
valid: isValid,
|
|
804
|
+
publishers,
|
|
805
|
+
hasNewDesign,
|
|
806
|
+
isWorkbook,
|
|
807
|
+
isWorkplan,
|
|
808
|
+
hasNoTeacherBook,
|
|
809
|
+
slug: slugs,
|
|
810
|
+
uri: uris,
|
|
811
|
+
isRenewed,
|
|
812
|
+
isPrimary
|
|
813
|
+
}),
|
|
814
|
+
_2.isFunction(sortByQuery) ? sortByQuery : sortByQuery ? _2.sortBy(sortByQuery) : _2.identity
|
|
815
|
+
);
|
|
816
|
+
};
|
|
819
817
|
var { getBooks, getBook, searchBooks, makeSearchBooks } = crud("books", {
|
|
820
818
|
search: search2
|
|
821
819
|
});
|
|
822
|
-
var makeSearchValidBooks = () => createSearchSelector2(makeSearchBooks(), (books) =>
|
|
820
|
+
var makeSearchValidBooks = () => createSearchSelector2(makeSearchBooks(), (books) => _2.filter({ valid: true, hasNewDesign: true }, books));
|
|
823
821
|
var searchValidBooks = makeSearchValidBooks();
|
|
824
822
|
var makeGetBook = () => makeGetEntityById2("books");
|
|
825
823
|
|
|
826
824
|
// src/selectors/user.ts
|
|
827
825
|
init_define_import_meta();
|
|
828
826
|
var import_reselect = __toESM(require_lib(), 1);
|
|
829
|
-
import {
|
|
830
|
-
|
|
831
|
-
|
|
827
|
+
import { makeEntitiesFilter as makeEntitiesFilter3 } from "@lls/utils";
|
|
828
|
+
var search3 = ({ ids, schoolIds }) => makeEntitiesFilter3({
|
|
829
|
+
schools: schoolIds,
|
|
830
|
+
id: ids
|
|
831
|
+
});
|
|
832
832
|
var { getUsers, getUser, searchUsers, makeSearchUsers } = crud("users", {
|
|
833
833
|
search: search3
|
|
834
834
|
});
|
|
@@ -840,12 +840,14 @@ var getCurrentUser = (0, import_reselect.createSelector)(
|
|
|
840
840
|
|
|
841
841
|
// src/selectors/chapter.ts
|
|
842
842
|
init_define_import_meta();
|
|
843
|
-
import {
|
|
844
|
-
import
|
|
845
|
-
var search4 = ({ bookIds, ids, hasTeacherBook }) =>
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
843
|
+
import { makeEntitiesFilter as makeEntitiesFilter4 } from "@lls/utils";
|
|
844
|
+
import _3 from "lodash/fp.js";
|
|
845
|
+
var search4 = ({ bookIds, ids, hasTeacherBook }) => makeEntitiesFilter4(
|
|
846
|
+
{
|
|
847
|
+
book: bookIds,
|
|
848
|
+
id: ids
|
|
849
|
+
},
|
|
850
|
+
!_3.isNil(hasTeacherBook) && ((chapter2) => !!chapter2?.teacherBook === hasTeacherBook)
|
|
849
851
|
);
|
|
850
852
|
var { getChapters, getChapter, searchChapters, makeSearchChapters } = crud("chapters", {
|
|
851
853
|
search: search4
|
|
@@ -853,14 +855,8 @@ var { getChapters, getChapter, searchChapters, makeSearchChapters } = crud("chap
|
|
|
853
855
|
|
|
854
856
|
// src/selectors/page.ts
|
|
855
857
|
init_define_import_meta();
|
|
856
|
-
import {
|
|
857
|
-
|
|
858
|
-
filterEntitiesArrayFieldByValues as filterEntitiesArrayFieldByValues3,
|
|
859
|
-
filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues5,
|
|
860
|
-
makeGetAllEntities as makeGetAllEntities2,
|
|
861
|
-
makeGetEntityById as makeGetEntityById3
|
|
862
|
-
} from "@lls/utils";
|
|
863
|
-
import _6 from "lodash/fp.js";
|
|
858
|
+
import { createSearchSelector as createSearchSelector3, makeEntitiesFilter as makeEntitiesFilter5, makeGetAllEntities as makeGetAllEntities2, makeGetEntityById as makeGetEntityById3 } from "@lls/utils";
|
|
859
|
+
import _4 from "lodash/fp.js";
|
|
864
860
|
var search5 = ({
|
|
865
861
|
ids,
|
|
866
862
|
chapterIds,
|
|
@@ -873,27 +869,45 @@ var search5 = ({
|
|
|
873
869
|
hasNewDesign,
|
|
874
870
|
slugs,
|
|
875
871
|
isLearningAssessment,
|
|
876
|
-
isCreatedFromScratch
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
872
|
+
isCreatedFromScratch,
|
|
873
|
+
userIds,
|
|
874
|
+
parentIds,
|
|
875
|
+
originalPageIds,
|
|
876
|
+
sharedUserIds,
|
|
877
|
+
sharedGroups,
|
|
878
|
+
isDraft,
|
|
879
|
+
isParentCreatedFromScratch,
|
|
880
|
+
updatedAfter
|
|
881
|
+
}) => {
|
|
882
|
+
let pageById = false;
|
|
883
|
+
return makeEntitiesFilter5(
|
|
884
|
+
{
|
|
885
|
+
id: ids,
|
|
886
|
+
chapter: chapterIds,
|
|
887
|
+
valid: isValid,
|
|
888
|
+
isOriginal,
|
|
889
|
+
hasNewDesign,
|
|
890
|
+
slug: slugs,
|
|
891
|
+
oldLesson: oldLessonIds,
|
|
892
|
+
isLearningAssessment,
|
|
893
|
+
isCreatedFromScratch,
|
|
894
|
+
premium,
|
|
895
|
+
thematicName: thematicNames,
|
|
896
|
+
book: bookIds,
|
|
897
|
+
parent: parentIds,
|
|
898
|
+
user: userIds,
|
|
899
|
+
originalPage: originalPageIds,
|
|
900
|
+
sharedUsers: sharedUserIds,
|
|
901
|
+
sharedGroups,
|
|
902
|
+
isDraft
|
|
903
|
+
},
|
|
904
|
+
isParentCreatedFromScratch && ((page2, pages) => {
|
|
905
|
+
pageById = pageById || _4.keyBy("id", pages);
|
|
906
|
+
return !!_4.get([page2?.originalPage, "isCreatedFromScratch"], pageById);
|
|
907
|
+
}),
|
|
908
|
+
updatedAfter && _4.flow(_4.get("updatedAt"), (date) => new Date(date) - updatedAfter >= 0)
|
|
909
|
+
);
|
|
910
|
+
};
|
|
897
911
|
var { getPages, getPage, searchPages, makeSearchPages, filterPages } = crud("pages", {
|
|
898
912
|
search: search5
|
|
899
913
|
});
|
|
@@ -909,64 +923,30 @@ var searchDraftPages = makeSearchDraftPages();
|
|
|
909
923
|
var makeSearchModifiedPages = () => createSearchSelector3(
|
|
910
924
|
getPages,
|
|
911
925
|
(_state, params) => params,
|
|
912
|
-
(pages, {
|
|
913
|
-
chapterIds,
|
|
914
|
-
userIds,
|
|
915
|
-
originalPageIds,
|
|
916
|
-
parentIds,
|
|
917
|
-
bookIds,
|
|
918
|
-
sharedUserIds,
|
|
919
|
-
updatedAfter,
|
|
920
|
-
isLearningAssessment,
|
|
921
|
-
thematicNames,
|
|
922
|
-
isDraft,
|
|
923
|
-
isCreatedFromScratch,
|
|
924
|
-
isParentCreatedFromScratch,
|
|
925
|
-
sharedGroups
|
|
926
|
-
}) => _6.flow(
|
|
927
|
-
filterEntitiesSimpleFieldByValues5("parent", parentIds),
|
|
928
|
-
filterEntitiesSimpleFieldByValues5("chapter", chapterIds),
|
|
929
|
-
filterEntitiesSimpleFieldByValues5("book", bookIds),
|
|
930
|
-
filterEntitiesSimpleFieldByValues5("user", userIds),
|
|
931
|
-
filterEntitiesSimpleFieldByValues5("originalPage", originalPageIds),
|
|
932
|
-
filterEntitiesArrayFieldByValues3("sharedUsers", sharedUserIds),
|
|
933
|
-
filterEntitiesArrayFieldByValues3("sharedGroups", sharedGroups),
|
|
934
|
-
filterEntitiesSimpleFieldByValues5("isOriginal", [false]),
|
|
935
|
-
filterEntitiesSimpleFieldByValues5("thematicName", thematicNames),
|
|
936
|
-
!_6.isNil(isLearningAssessment) ? filterEntitiesSimpleFieldByValues5("isLearningAssessment", [isLearningAssessment]) : _6.identity,
|
|
937
|
-
!_6.isNil(isCreatedFromScratch) ? filterEntitiesSimpleFieldByValues5("isCreatedFromScratch", [isCreatedFromScratch]) : _6.identity,
|
|
938
|
-
!_6.isNil(isDraft) ? filterEntitiesSimpleFieldByValues5("isDraft", [isDraft]) : _6.identity,
|
|
939
|
-
isParentCreatedFromScratch ? _6.filter(
|
|
940
|
-
(entity) => _6.flow(_6.find({ id: entity?.originalPage }), _6.get("isCreatedFromScratch"))(pages)
|
|
941
|
-
) : _6.identity,
|
|
942
|
-
updatedAfter ? _6.filter(
|
|
943
|
-
_6.flow(_6.get("updatedAt"), (date) => new Date(date) - updatedAfter >= 0)
|
|
944
|
-
) : _6.identity
|
|
945
|
-
)(pages)
|
|
926
|
+
(pages, params) => search5({ ...params, isOriginal: false })(pages)
|
|
946
927
|
);
|
|
947
928
|
var searchModifiedPages = makeSearchModifiedPages();
|
|
948
929
|
|
|
949
930
|
// src/selectors/collection.ts
|
|
950
931
|
init_define_import_meta();
|
|
951
|
-
import
|
|
952
|
-
var search6 = (_params) =>
|
|
932
|
+
import _5 from "lodash/fp.js";
|
|
933
|
+
var search6 = (_params) => _5.identity;
|
|
953
934
|
var { getCollections, getCollection, searchCollections, makeSearchCollections } = crud("collections", {
|
|
954
935
|
search: search6
|
|
955
936
|
});
|
|
956
937
|
|
|
957
938
|
// src/selectors/communityProject.ts
|
|
958
939
|
init_define_import_meta();
|
|
959
|
-
import {
|
|
960
|
-
import _8 from "lodash/fp.js";
|
|
940
|
+
import { makeEntitiesFilter as makeEntitiesFilter6 } from "@lls/utils";
|
|
961
941
|
var search7 = ({
|
|
962
942
|
slugs,
|
|
963
943
|
isFeatured,
|
|
964
944
|
projectTypes
|
|
965
|
-
}) =>
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
);
|
|
945
|
+
}) => makeEntitiesFilter6({
|
|
946
|
+
slug: slugs,
|
|
947
|
+
isFeatured,
|
|
948
|
+
projectTypes
|
|
949
|
+
});
|
|
970
950
|
var { getCommunityProjects, getCommunityProject, searchCommunityProjects, makeSearchCommunityProjects } = crud(
|
|
971
951
|
"communityProjects",
|
|
972
952
|
{
|
|
@@ -976,45 +956,35 @@ var { getCommunityProjects, getCommunityProject, searchCommunityProjects, makeSe
|
|
|
976
956
|
|
|
977
957
|
// src/selectors/contact.ts
|
|
978
958
|
init_define_import_meta();
|
|
979
|
-
import
|
|
980
|
-
var search8 = (_params) =>
|
|
959
|
+
import _6 from "lodash/fp.js";
|
|
960
|
+
var search8 = (_params) => _6.identity;
|
|
981
961
|
var { getContacts, getContact, searchContacts, makeSearchContacts } = crud("contacts", {
|
|
982
962
|
search: search8
|
|
983
963
|
});
|
|
984
964
|
|
|
985
965
|
// src/selectors/copyNotification.ts
|
|
986
966
|
init_define_import_meta();
|
|
987
|
-
import { createSearchSelector as createSearchSelector4,
|
|
988
|
-
import _10 from "lodash/fp.js";
|
|
967
|
+
import { createSearchSelector as createSearchSelector4, makeEntitiesFilter as makeEntitiesFilter7, makeGetAllEntities as makeGetAllEntities3 } from "@lls/utils";
|
|
989
968
|
var getCopyNotifications = makeGetAllEntities3("copyNotifications");
|
|
990
969
|
var makeSearchCopyNotifications = () => createSearchSelector4(
|
|
991
|
-
[getCurrentUser, getCopyNotifications, (
|
|
992
|
-
(currentUser, copyNotifications, { pageIds, read }) =>
|
|
993
|
-
|
|
994
|
-
(ids
|
|
995
|
-
|
|
996
|
-
filterEntitiesSimpleFieldByValues7("page", pageIds),
|
|
997
|
-
filterEntitiesSimpleFieldByValues7("read", _10.isNil(read) ? void 0 : [read])
|
|
998
|
-
)(copyNotifications)
|
|
999
|
-
)(currentUser)
|
|
970
|
+
[getCurrentUser, getCopyNotifications, (_17, params) => params],
|
|
971
|
+
(currentUser, copyNotifications, { pageIds, read }) => {
|
|
972
|
+
const ids = currentUser?.copyNotifications;
|
|
973
|
+
return makeEntitiesFilter7({ id: ids, read, page: pageIds })(copyNotifications);
|
|
974
|
+
}
|
|
1000
975
|
);
|
|
1001
976
|
var searchCopyNotifications = makeSearchCopyNotifications();
|
|
1002
977
|
|
|
1003
978
|
// src/selectors/drawerNotification.ts
|
|
1004
979
|
init_define_import_meta();
|
|
1005
|
-
import { createSearchSelector as createSearchSelector5,
|
|
1006
|
-
import _11 from "lodash/fp.js";
|
|
980
|
+
import { createSearchSelector as createSearchSelector5, makeEntitiesFilter as makeEntitiesFilter8, makeGetAllEntities as makeGetAllEntities4 } from "@lls/utils";
|
|
1007
981
|
var getDrawerNotifications = makeGetAllEntities4("drawerNotifications");
|
|
1008
982
|
var makeSearchDrawerNotifications = () => createSearchSelector5(
|
|
1009
|
-
[getCurrentUser, getDrawerNotifications, (
|
|
1010
|
-
(currentUser, drawerNotifications, { read, pageIds }) =>
|
|
1011
|
-
|
|
1012
|
-
(ids
|
|
1013
|
-
|
|
1014
|
-
filterEntitiesSimpleFieldByValues8("read", _11.isNil(read) ? void 0 : [read]),
|
|
1015
|
-
filterEntitiesSimpleFieldByValues8("page", pageIds)
|
|
1016
|
-
)(drawerNotifications)
|
|
1017
|
-
)(currentUser)
|
|
983
|
+
[getCurrentUser, getDrawerNotifications, (_17, params) => params],
|
|
984
|
+
(currentUser, drawerNotifications, { read, pageIds }) => {
|
|
985
|
+
const ids = currentUser?.drawerNotifications;
|
|
986
|
+
return makeEntitiesFilter8({ id: ids, read, page: pageIds })(drawerNotifications);
|
|
987
|
+
}
|
|
1018
988
|
);
|
|
1019
989
|
var searchDrawerNotifications = makeSearchDrawerNotifications();
|
|
1020
990
|
|
|
@@ -1025,8 +995,8 @@ var getFaqs = makeGetAllEntities5("faq");
|
|
|
1025
995
|
|
|
1026
996
|
// src/selectors/garDivision.ts
|
|
1027
997
|
init_define_import_meta();
|
|
1028
|
-
import
|
|
1029
|
-
var search9 = (_params) =>
|
|
998
|
+
import _7 from "lodash/fp.js";
|
|
999
|
+
var search9 = (_params) => _7.identity;
|
|
1030
1000
|
var { getGarDivisions, getGarDivision, searchGarDivisions, makeSearchGarDivisions } = crud("garDivisions", {
|
|
1031
1001
|
search: search9
|
|
1032
1002
|
});
|
|
@@ -1034,9 +1004,9 @@ var { getGarDivisions, getGarDivision, searchGarDivisions, makeSearchGarDivision
|
|
|
1034
1004
|
// src/selectors/group.ts
|
|
1035
1005
|
init_define_import_meta();
|
|
1036
1006
|
var import_reselect2 = __toESM(require_lib(), 1);
|
|
1037
|
-
import {
|
|
1038
|
-
import
|
|
1039
|
-
var search10 = ({ ownerIds }) =>
|
|
1007
|
+
import { makeEntitiesFilter as makeEntitiesFilter9 } from "@lls/utils";
|
|
1008
|
+
import _8 from "lodash/fp.js";
|
|
1009
|
+
var search10 = ({ ownerIds }) => _8.flow(makeEntitiesFilter9({ owner: ownerIds }), _8.orderBy("createdAt", ["desc"]));
|
|
1040
1010
|
var { getGroups, getGroup, searchGroups, makeSearchGroups } = crud("groups", {
|
|
1041
1011
|
search: search10
|
|
1042
1012
|
});
|
|
@@ -1048,8 +1018,8 @@ var getUserGroups = (0, import_reselect2.createSelector)(
|
|
|
1048
1018
|
// src/selectors/level.ts
|
|
1049
1019
|
init_define_import_meta();
|
|
1050
1020
|
var import_reselect3 = __toESM(require_lib(), 1);
|
|
1051
|
-
import {
|
|
1052
|
-
import
|
|
1021
|
+
import { makeEntitiesFilter as makeEntitiesFilter10 } from "@lls/utils";
|
|
1022
|
+
import _9 from "lodash/fp.js";
|
|
1053
1023
|
var search11 = ({
|
|
1054
1024
|
ids,
|
|
1055
1025
|
slugs,
|
|
@@ -1059,37 +1029,39 @@ var search11 = ({
|
|
|
1059
1029
|
isProHighSchool,
|
|
1060
1030
|
isGenHighSchool,
|
|
1061
1031
|
isElementarySchool
|
|
1062
|
-
}) =>
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1032
|
+
}) => _9.flow(
|
|
1033
|
+
makeEntitiesFilter10({
|
|
1034
|
+
id: ids,
|
|
1035
|
+
slug: slugs,
|
|
1036
|
+
isPreSchool,
|
|
1037
|
+
isMiddleSchool,
|
|
1038
|
+
isHighSchool,
|
|
1039
|
+
isProHighSchool,
|
|
1040
|
+
isGenHighSchool,
|
|
1041
|
+
isElementarySchool
|
|
1042
|
+
}),
|
|
1043
|
+
_9.orderBy("order", "desc")
|
|
1072
1044
|
);
|
|
1073
1045
|
var crudLevels = crud("levels", { search: search11 });
|
|
1074
1046
|
var { getLevel, searchLevels, makeSearchLevels } = crudLevels;
|
|
1075
|
-
var getLevels = (0, import_reselect3.createSelector)(crudLevels.getLevels,
|
|
1047
|
+
var getLevels = (0, import_reselect3.createSelector)(crudLevels.getLevels, _9.orderBy("order", "desc"));
|
|
1076
1048
|
|
|
1077
1049
|
// src/selectors/mainNotification.ts
|
|
1078
1050
|
init_define_import_meta();
|
|
1079
1051
|
var import_reselect4 = __toESM(require_lib(), 1);
|
|
1080
|
-
import {
|
|
1081
|
-
import
|
|
1052
|
+
import { makeEntitiesFilter as makeEntitiesFilter11, makeGetAllEntities as makeGetAllEntities6 } from "@lls/utils";
|
|
1053
|
+
import _10 from "lodash/fp.js";
|
|
1082
1054
|
var getAllMainNotifications = makeGetAllEntities6("mainNotifications");
|
|
1083
|
-
var search12 = ({ ids }) =>
|
|
1055
|
+
var search12 = ({ ids }) => makeEntitiesFilter11({ id: ids });
|
|
1084
1056
|
var getMainNotifications = (0, import_reselect4.createSelector)(
|
|
1085
|
-
[
|
|
1057
|
+
[_10.flow(getCurrentUser, _10.get("mainNotifications")), getAllMainNotifications],
|
|
1086
1058
|
(userNotifications, notifications) => search12({ ids: userNotifications })(notifications)
|
|
1087
1059
|
);
|
|
1088
1060
|
|
|
1089
1061
|
// src/selectors/news.ts
|
|
1090
1062
|
init_define_import_meta();
|
|
1091
|
-
import {
|
|
1092
|
-
var search13 = ({ ids }) =>
|
|
1063
|
+
import { makeEntitiesFilter as makeEntitiesFilter12 } from "@lls/utils";
|
|
1064
|
+
var search13 = ({ ids }) => makeEntitiesFilter12({ id: ids });
|
|
1093
1065
|
var {
|
|
1094
1066
|
getNews: getAllNews,
|
|
1095
1067
|
getNew: getNews,
|
|
@@ -1106,8 +1078,8 @@ var getPanorama = makeGetEntityById4("panoramas");
|
|
|
1106
1078
|
|
|
1107
1079
|
// src/selectors/premiumResource.ts
|
|
1108
1080
|
init_define_import_meta();
|
|
1109
|
-
import {
|
|
1110
|
-
var search14 = ({ bookIds }) =>
|
|
1081
|
+
import { makeEntitiesFilter as makeEntitiesFilter13 } from "@lls/utils";
|
|
1082
|
+
var search14 = ({ bookIds }) => makeEntitiesFilter13({ book: bookIds });
|
|
1111
1083
|
var { getPremiumResources, getPremiumResource, searchPremiumResources, makeSearchPremiumResources } = crud(
|
|
1112
1084
|
"premiumResources",
|
|
1113
1085
|
{
|
|
@@ -1117,22 +1089,16 @@ var { getPremiumResources, getPremiumResource, searchPremiumResources, makeSearc
|
|
|
1117
1089
|
|
|
1118
1090
|
// src/selectors/lexicalFlower.ts
|
|
1119
1091
|
init_define_import_meta();
|
|
1120
|
-
import {
|
|
1121
|
-
|
|
1122
|
-
var search15 = ({ ids }) => _16.flow(filterEntitiesSimpleFieldByValues14("id", ids));
|
|
1092
|
+
import { makeEntitiesFilter as makeEntitiesFilter14 } from "@lls/utils";
|
|
1093
|
+
var search15 = ({ ids }) => makeEntitiesFilter14({ id: ids });
|
|
1123
1094
|
var { getLexicalFlowers, searchLexicalFlowers } = crud("lexicalFlowers", {
|
|
1124
1095
|
search: search15
|
|
1125
1096
|
});
|
|
1126
1097
|
|
|
1127
1098
|
// src/selectors/product.ts
|
|
1128
1099
|
init_define_import_meta();
|
|
1129
|
-
import
|
|
1130
|
-
import {
|
|
1131
|
-
createSearchSelector as createSearchSelector6,
|
|
1132
|
-
filterEntitiesArrayFieldByValues as filterEntitiesArrayFieldByValues5,
|
|
1133
|
-
filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues15,
|
|
1134
|
-
makeGetAllEntities as makeGetAllEntities7
|
|
1135
|
-
} from "@lls/utils";
|
|
1100
|
+
import _11 from "lodash/fp.js";
|
|
1101
|
+
import { createSearchSelector as createSearchSelector6, makeEntitiesFilter as makeEntitiesFilter15, makeGetAllEntities as makeGetAllEntities7 } from "@lls/utils";
|
|
1136
1102
|
var getProducts = makeGetAllEntities7("products");
|
|
1137
1103
|
var search16 = ({
|
|
1138
1104
|
ids,
|
|
@@ -1143,14 +1109,21 @@ var search16 = ({
|
|
|
1143
1109
|
subjectIds,
|
|
1144
1110
|
productTypes
|
|
1145
1111
|
}) => {
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1112
|
+
let bookIds;
|
|
1113
|
+
const filter = makeEntitiesFilter15(
|
|
1114
|
+
{
|
|
1115
|
+
id: ids,
|
|
1116
|
+
ean: eans,
|
|
1117
|
+
isAdoptant,
|
|
1118
|
+
isSupportPlus,
|
|
1119
|
+
productType: productTypes
|
|
1120
|
+
},
|
|
1121
|
+
levelIds || subjectIds ? (product2) => !!product2?.books?.some((bookId) => bookIds.has(bookId)) : false
|
|
1153
1122
|
);
|
|
1123
|
+
return (products, books) => {
|
|
1124
|
+
bookIds = new Set(_11.map("id", books));
|
|
1125
|
+
return filter(products);
|
|
1126
|
+
};
|
|
1154
1127
|
};
|
|
1155
1128
|
var searchBooks2 = makeSearchBooks();
|
|
1156
1129
|
var searchProducts = createSearchSelector6(
|
|
@@ -1162,25 +1135,26 @@ var searchProducts = createSearchSelector6(
|
|
|
1162
1135
|
|
|
1163
1136
|
// src/selectors/resource.ts
|
|
1164
1137
|
init_define_import_meta();
|
|
1165
|
-
import {
|
|
1166
|
-
|
|
1167
|
-
|
|
1138
|
+
import { makeEntitiesFilter as makeEntitiesFilter16 } from "@lls/utils";
|
|
1139
|
+
var search17 = ({ chapterIds }) => makeEntitiesFilter16({
|
|
1140
|
+
chapter: chapterIds
|
|
1141
|
+
});
|
|
1168
1142
|
var { getResources, getResource, searchResources, makeSearchResources } = crud("resources", {
|
|
1169
1143
|
search: search17
|
|
1170
1144
|
});
|
|
1171
1145
|
|
|
1172
1146
|
// src/selectors/schoolType.ts
|
|
1173
1147
|
init_define_import_meta();
|
|
1174
|
-
import {
|
|
1175
|
-
var search18 = ({ slugs }) =>
|
|
1148
|
+
import { makeEntitiesFilter as makeEntitiesFilter17 } from "@lls/utils";
|
|
1149
|
+
var search18 = ({ slugs }) => makeEntitiesFilter17({ slug: slugs });
|
|
1176
1150
|
var { getSchoolTypes, getSchoolType, searchSchoolTypes, makeSearchSchoolTypes } = crud("schoolTypes", {
|
|
1177
1151
|
search: search18
|
|
1178
1152
|
});
|
|
1179
1153
|
|
|
1180
1154
|
// src/selectors/sharedPage.ts
|
|
1181
1155
|
init_define_import_meta();
|
|
1182
|
-
import { createSearchSelector as createSearchSelector7,
|
|
1183
|
-
import
|
|
1156
|
+
import { createSearchSelector as createSearchSelector7, makeEntitiesFilter as makeEntitiesFilter18 } from "@lls/utils";
|
|
1157
|
+
import _12 from "lodash/fp.js";
|
|
1184
1158
|
var search19 = ({
|
|
1185
1159
|
parentIds,
|
|
1186
1160
|
userIds,
|
|
@@ -1188,45 +1162,39 @@ var search19 = ({
|
|
|
1188
1162
|
isCreatedFromScratch,
|
|
1189
1163
|
isLearningAssessment,
|
|
1190
1164
|
ids
|
|
1191
|
-
}) =>
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
);
|
|
1165
|
+
}) => makeEntitiesFilter18({
|
|
1166
|
+
id: ids,
|
|
1167
|
+
parent: parentIds,
|
|
1168
|
+
user: userIds,
|
|
1169
|
+
book: bookIds,
|
|
1170
|
+
isLearningAssessment,
|
|
1171
|
+
isCreatedFromScratch
|
|
1172
|
+
});
|
|
1199
1173
|
var { getSharedPages, getSharedPage, searchSharedPages, makeSearchSharedPages } = crud("sharedPages", {
|
|
1200
1174
|
search: search19
|
|
1201
1175
|
});
|
|
1202
1176
|
var searchCurrentUserSharedPages = createSearchSelector7(
|
|
1203
1177
|
getCurrentUser,
|
|
1204
1178
|
getSharedPages,
|
|
1205
|
-
(
|
|
1179
|
+
(_17, params) => params,
|
|
1206
1180
|
(user2, sharedPages, params) => {
|
|
1207
1181
|
const sharedUserPageIds = user2?.sharedPages ?? [];
|
|
1208
|
-
return search19({ ...params, ids:
|
|
1182
|
+
return search19({ ...params, ids: _12.intersection(sharedUserPageIds, params.ids || sharedUserPageIds) })(sharedPages);
|
|
1209
1183
|
}
|
|
1210
1184
|
);
|
|
1211
1185
|
|
|
1212
1186
|
// src/selectors/student.ts
|
|
1213
1187
|
init_define_import_meta();
|
|
1214
|
-
import {
|
|
1215
|
-
var search20 = ({ ids }) =>
|
|
1188
|
+
import { makeEntitiesFilter as makeEntitiesFilter19 } from "@lls/utils";
|
|
1189
|
+
var search20 = ({ ids }) => makeEntitiesFilter19({ id: ids });
|
|
1216
1190
|
var { getStudents, getStudent, searchStudents, makeSearchStudents } = crud("students", {
|
|
1217
1191
|
search: search20
|
|
1218
1192
|
});
|
|
1219
1193
|
|
|
1220
1194
|
// src/selectors/subject.ts
|
|
1221
1195
|
init_define_import_meta();
|
|
1222
|
-
import {
|
|
1223
|
-
|
|
1224
|
-
filterEntitiesFieldExists as filterEntitiesFieldExists2,
|
|
1225
|
-
filterEntitiesSimpleFieldByValue as filterEntitiesSimpleFieldByValue4,
|
|
1226
|
-
filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues20,
|
|
1227
|
-
limitToTeacherSubjects
|
|
1228
|
-
} from "@lls/utils";
|
|
1229
|
-
import _20 from "lodash/fp.js";
|
|
1196
|
+
import { limitToTeacherSubjects, makeEntitiesFilter as makeEntitiesFilter20, pipe as pipe2 } from "@lls/utils";
|
|
1197
|
+
import _13 from "lodash/fp.js";
|
|
1230
1198
|
var search21 = ({
|
|
1231
1199
|
ids,
|
|
1232
1200
|
slugs,
|
|
@@ -1235,14 +1203,19 @@ var search21 = ({
|
|
|
1235
1203
|
schoolTypes,
|
|
1236
1204
|
hasBooks,
|
|
1237
1205
|
names
|
|
1238
|
-
}) =>
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1206
|
+
}) => (subjects) => pipe2(
|
|
1207
|
+
subjects,
|
|
1208
|
+
makeEntitiesFilter20(
|
|
1209
|
+
{
|
|
1210
|
+
id: ids,
|
|
1211
|
+
slug: slugs,
|
|
1212
|
+
name: names,
|
|
1213
|
+
hasBooks,
|
|
1214
|
+
schoolTypes
|
|
1215
|
+
},
|
|
1216
|
+
!_13.isNil(hasNewsletterUrl) && ((subject2) => Boolean(subject2?.newsletterUrl) === hasNewsletterUrl)
|
|
1217
|
+
),
|
|
1218
|
+
(subjects2) => _13.isNil(isTeacherSubject) ? subjects2 : limitToTeacherSubjects(subjects2)
|
|
1246
1219
|
);
|
|
1247
1220
|
var { getSubjects, getSubject, searchSubjects, makeSearchSubjects } = crud("subjects", {
|
|
1248
1221
|
search: search21
|
|
@@ -1250,22 +1223,23 @@ var { getSubjects, getSubject, searchSubjects, makeSearchSubjects } = crud("subj
|
|
|
1250
1223
|
|
|
1251
1224
|
// src/selectors/teacher.ts
|
|
1252
1225
|
init_define_import_meta();
|
|
1253
|
-
import {
|
|
1254
|
-
|
|
1255
|
-
|
|
1226
|
+
import { makeEntitiesFilter as makeEntitiesFilter21 } from "@lls/utils";
|
|
1227
|
+
var search22 = ({ ids, schoolIds }) => makeEntitiesFilter21({
|
|
1228
|
+
id: ids,
|
|
1229
|
+
schools: schoolIds
|
|
1230
|
+
});
|
|
1256
1231
|
var { getTeachers, getTeacher, searchTeachers, makeSearchTeachers } = crud("teachers", {
|
|
1257
1232
|
search: search22
|
|
1258
1233
|
});
|
|
1259
1234
|
|
|
1260
1235
|
// src/selectors/tool.ts
|
|
1261
1236
|
init_define_import_meta();
|
|
1262
|
-
import {
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
);
|
|
1237
|
+
import { makeEntitiesFilter as makeEntitiesFilter22 } from "@lls/utils";
|
|
1238
|
+
var search23 = ({ ids, locked, bookIds }) => makeEntitiesFilter22({
|
|
1239
|
+
id: ids,
|
|
1240
|
+
locked,
|
|
1241
|
+
books: bookIds
|
|
1242
|
+
});
|
|
1269
1243
|
var { getTools, getTool, searchTools, makeSearchTools } = crud("tools", {
|
|
1270
1244
|
search: search23
|
|
1271
1245
|
});
|
|
@@ -1273,7 +1247,7 @@ var { getTools, getTool, searchTools, makeSearchTools } = crud("tools", {
|
|
|
1273
1247
|
// src/reducers/entities.ts
|
|
1274
1248
|
init_define_import_meta();
|
|
1275
1249
|
import { makeReducer } from "@lls/utils";
|
|
1276
|
-
import
|
|
1250
|
+
import _14 from "lodash/fp.js";
|
|
1277
1251
|
|
|
1278
1252
|
// src/actions/index.ts
|
|
1279
1253
|
init_define_import_meta();
|
|
@@ -1296,16 +1270,16 @@ var resetAuth = makeActionCreator(actionTypes.RESET_AUTH);
|
|
|
1296
1270
|
// src/reducers/entities.ts
|
|
1297
1271
|
var deleteEntityReducer = (state, payload) => {
|
|
1298
1272
|
const { path } = payload;
|
|
1299
|
-
return
|
|
1273
|
+
return _14.omit(path, state);
|
|
1300
1274
|
};
|
|
1301
1275
|
var updateEntityReducer = (state, payload) => {
|
|
1302
1276
|
const { path, entity } = payload;
|
|
1303
|
-
const currentEntity =
|
|
1304
|
-
return
|
|
1277
|
+
const currentEntity = _14.get(path, state);
|
|
1278
|
+
return _14.set(path, _14.merge(currentEntity, entity), state);
|
|
1305
1279
|
};
|
|
1306
1280
|
var setEntityReducer = (state, payload) => {
|
|
1307
1281
|
const { path, entity } = payload;
|
|
1308
|
-
return
|
|
1282
|
+
return _14.set(path, entity, state);
|
|
1309
1283
|
};
|
|
1310
1284
|
var setEntitiesReducer = (state, payload) => {
|
|
1311
1285
|
if (typeof payload !== "object") return state;
|
|
@@ -1326,7 +1300,7 @@ var setEntitiesReducer = (state, payload) => {
|
|
|
1326
1300
|
}
|
|
1327
1301
|
const diff = Object.keys(entity).some((prop) => {
|
|
1328
1302
|
const value = entity[prop];
|
|
1329
|
-
if (!
|
|
1303
|
+
if (!_14.isEqual(state[entityName]?.[id]?.[prop], value)) {
|
|
1330
1304
|
return true;
|
|
1331
1305
|
}
|
|
1332
1306
|
});
|
|
@@ -1358,7 +1332,7 @@ var entities_default = entities;
|
|
|
1358
1332
|
// src/reducers/auth.ts
|
|
1359
1333
|
init_define_import_meta();
|
|
1360
1334
|
import { makeReducer as makeReducer2 } from "@lls/utils";
|
|
1361
|
-
import
|
|
1335
|
+
import _15 from "lodash/fp.js";
|
|
1362
1336
|
var initialState = {
|
|
1363
1337
|
id: void 0,
|
|
1364
1338
|
role: null,
|
|
@@ -1371,15 +1345,15 @@ var initialState = {
|
|
|
1371
1345
|
llsUserId: null
|
|
1372
1346
|
};
|
|
1373
1347
|
var auth = makeReducer2(initialState, {
|
|
1374
|
-
[actionTypes.SET_AUTH]:
|
|
1375
|
-
[actionTypes.RESET_AUTH]:
|
|
1348
|
+
[actionTypes.SET_AUTH]: _15.assign,
|
|
1349
|
+
[actionTypes.RESET_AUTH]: _15.constant(initialState)
|
|
1376
1350
|
});
|
|
1377
1351
|
var auth_default = auth;
|
|
1378
1352
|
|
|
1379
1353
|
// src/schema/index.ts
|
|
1380
1354
|
init_define_import_meta();
|
|
1381
1355
|
var import_normalizr = __toESM(require_normalizr(), 1);
|
|
1382
|
-
import
|
|
1356
|
+
import _16 from "lodash/fp.js";
|
|
1383
1357
|
var document = new import_normalizr.schema.Entity("documents", {}, { idAttribute: "resourceId" });
|
|
1384
1358
|
var subject = new import_normalizr.schema.Entity("subjects");
|
|
1385
1359
|
var level = new import_normalizr.schema.Entity("levels");
|
|
@@ -1570,7 +1544,7 @@ var querySchema = {
|
|
|
1570
1544
|
}
|
|
1571
1545
|
}
|
|
1572
1546
|
};
|
|
1573
|
-
var normalizeData =
|
|
1547
|
+
var normalizeData = _16.flow((data) => (0, import_normalizr.normalize)(data, querySchema));
|
|
1574
1548
|
export {
|
|
1575
1549
|
auth_default as authReducer,
|
|
1576
1550
|
entities_default as entitiesReducer,
|
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.1.59-
|
|
5
|
+
"version": "24.1.59-8e1a3cff",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"types": "./lib/builttypes/store/src/index.d.ts",
|
|
8
8
|
"exports": {
|
|
@@ -28,21 +28,21 @@
|
|
|
28
28
|
"react": "*"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@biomejs/biome": "1.
|
|
32
|
-
"@types/lodash": "4.17.
|
|
33
|
-
"@types/node": "
|
|
34
|
-
"@types/react": "18.3.
|
|
31
|
+
"@biomejs/biome": "1.9.1",
|
|
32
|
+
"@types/lodash": "4.17.7",
|
|
33
|
+
"@types/node": "22.5.5",
|
|
34
|
+
"@types/react": "18.3.6",
|
|
35
35
|
"@vitejs/plugin-react-swc": "3.7.0",
|
|
36
|
-
"esbuild": "0.23.
|
|
36
|
+
"esbuild": "0.23.1",
|
|
37
37
|
"lodash": "4.17.21",
|
|
38
38
|
"react": "18.3.1",
|
|
39
39
|
"reselect": "4.1.8",
|
|
40
|
-
"typescript": "5.
|
|
41
|
-
"vite": "5.
|
|
40
|
+
"typescript": "5.6.2",
|
|
41
|
+
"vite": "5.4.6",
|
|
42
42
|
"vite-tsconfig-paths": "4.3.2",
|
|
43
|
-
"vitest": "2.
|
|
44
|
-
"@lls/utils": "24.1.59-
|
|
45
|
-
"@lls/vitescripts": "24.1.59-
|
|
43
|
+
"vitest": "2.1.1",
|
|
44
|
+
"@lls/utils": "24.1.59-8e1a3cff",
|
|
45
|
+
"@lls/vitescripts": "24.1.59-8e1a3cff"
|
|
46
46
|
},
|
|
47
47
|
"license": "ISC",
|
|
48
48
|
"dependencies": {
|