@lls/store 24.1.59-10c33c33 → 24.1.59-19581805
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 +359 -45
- package/package.json +3 -3
package/lib/index.js
CHANGED
|
@@ -198,7 +198,7 @@ var require_lib = __commonJS({
|
|
|
198
198
|
for (var _len = arguments.length, memoizeOptionsFromArgs = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
199
199
|
memoizeOptionsFromArgs[_key - 1] = arguments[_key];
|
|
200
200
|
}
|
|
201
|
-
var
|
|
201
|
+
var createSelector6 = function createSelector7() {
|
|
202
202
|
for (var _len2 = arguments.length, funcs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
203
203
|
funcs[_key2] = arguments[_key2];
|
|
204
204
|
}
|
|
@@ -247,13 +247,13 @@ var require_lib = __commonJS({
|
|
|
247
247
|
});
|
|
248
248
|
return selector;
|
|
249
249
|
};
|
|
250
|
-
return
|
|
250
|
+
return createSelector6;
|
|
251
251
|
}
|
|
252
|
-
var
|
|
253
|
-
exports.createSelector =
|
|
252
|
+
var createSelector5 = /* @__PURE__ */ createSelectorCreator(_defaultMemoize.defaultMemoize);
|
|
253
|
+
exports.createSelector = createSelector5;
|
|
254
254
|
var createStructuredSelector = function createStructuredSelector2(selectors, selectorCreator) {
|
|
255
255
|
if (selectorCreator === void 0) {
|
|
256
|
-
selectorCreator =
|
|
256
|
+
selectorCreator = createSelector5;
|
|
257
257
|
}
|
|
258
258
|
if (typeof selectors !== "object") {
|
|
259
259
|
throw new Error("createStructuredSelector expects first argument to be an object " + ("where each property is a selector, instead received a " + typeof selectors));
|
|
@@ -736,20 +736,19 @@ init_define_import_meta();
|
|
|
736
736
|
// src/selectors/school.ts
|
|
737
737
|
init_define_import_meta();
|
|
738
738
|
import { filterEntitiesSimpleFieldByValues } from "@lls/utils";
|
|
739
|
-
import
|
|
739
|
+
import _ from "lodash/fp.js";
|
|
740
740
|
|
|
741
741
|
// src/selectors/crud.ts
|
|
742
742
|
init_define_import_meta();
|
|
743
743
|
import { createSearchSelector, makeGetAllEntities, makeGetEntityById } from "@lls/utils";
|
|
744
|
-
|
|
745
|
-
var crud = (entityName, { search: search5 }) => {
|
|
744
|
+
var crud = (entityName, { search: search15 }) => {
|
|
746
745
|
const getElements = makeGetAllEntities(entityName);
|
|
747
746
|
const makeSearchElements = () => createSearchSelector(
|
|
748
747
|
getElements,
|
|
749
748
|
(_state, params) => params,
|
|
750
|
-
(elements, params) =>
|
|
749
|
+
(elements, params) => search15(params)(elements)
|
|
751
750
|
);
|
|
752
|
-
const methodName =
|
|
751
|
+
const methodName = `${entityName.charAt(0).toUpperCase()}${entityName.slice(1)}`;
|
|
753
752
|
const getElementById = makeGetEntityById(entityName);
|
|
754
753
|
const back = {
|
|
755
754
|
[`get${methodName}`]: getElements,
|
|
@@ -761,7 +760,7 @@ var crud = (entityName, { search: search5 }) => {
|
|
|
761
760
|
};
|
|
762
761
|
|
|
763
762
|
// src/selectors/school.ts
|
|
764
|
-
var search = ({ ids }) =>
|
|
763
|
+
var search = ({ ids }) => _.flow(filterEntitiesSimpleFieldByValues("id", ids));
|
|
765
764
|
var { getSchools, getSchool, searchSchools, makeSearchSchools } = crud("schools", {
|
|
766
765
|
search
|
|
767
766
|
});
|
|
@@ -775,7 +774,7 @@ import {
|
|
|
775
774
|
filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues2,
|
|
776
775
|
makeGetEntityById as makeGetEntityById2
|
|
777
776
|
} from "@lls/utils";
|
|
778
|
-
import
|
|
777
|
+
import _2 from "lodash/fp.js";
|
|
779
778
|
var search2 = ({
|
|
780
779
|
ids,
|
|
781
780
|
levelIds,
|
|
@@ -792,27 +791,27 @@ var search2 = ({
|
|
|
792
791
|
publishers,
|
|
793
792
|
isRenewed,
|
|
794
793
|
isPrimary
|
|
795
|
-
}) =>
|
|
794
|
+
}) => _2.flow(
|
|
796
795
|
filterEntitiesSimpleFieldByValues2("id", ids),
|
|
797
796
|
filterEntitiesSimpleFieldByValues2("year", years),
|
|
798
797
|
filterEntitiesArrayFieldByValues("levels", levelIds),
|
|
799
798
|
filterEntitiesArrayFieldByValues("subjects", subjectIds),
|
|
800
|
-
filterEntitiesSimpleFieldByValues2("valid",
|
|
799
|
+
filterEntitiesSimpleFieldByValues2("valid", _2.isNil(isValid) ? void 0 : [isValid]),
|
|
801
800
|
filterEntitiesSimpleFieldByValues2("publisher", publishers),
|
|
802
|
-
filterEntitiesSimpleFieldByValues2("hasNewDesign",
|
|
803
|
-
filterEntitiesSimpleFieldByValues2("isWorkbook",
|
|
804
|
-
filterEntitiesSimpleFieldByValues2("isWorkplan",
|
|
805
|
-
filterEntitiesSimpleFieldByValues2("hasNoTeacherBook",
|
|
801
|
+
filterEntitiesSimpleFieldByValues2("hasNewDesign", _2.isNil(hasNewDesign) ? void 0 : [hasNewDesign]),
|
|
802
|
+
filterEntitiesSimpleFieldByValues2("isWorkbook", _2.isNil(isWorkbook) ? void 0 : [isWorkbook]),
|
|
803
|
+
filterEntitiesSimpleFieldByValues2("isWorkplan", _2.isNil(isWorkplan) ? void 0 : [isWorkplan]),
|
|
804
|
+
filterEntitiesSimpleFieldByValues2("hasNoTeacherBook", _2.isNil(hasNoTeacherBook) ? void 0 : [hasNoTeacherBook]),
|
|
806
805
|
filterEntitiesSimpleFieldByValues2("slug", slugs),
|
|
807
806
|
filterEntitiesSimpleFieldByValues2("uri", uris),
|
|
808
|
-
filterEntitiesSimpleFieldByValues2("isRenewed",
|
|
807
|
+
filterEntitiesSimpleFieldByValues2("isRenewed", _2.isNil(isRenewed) ? void 0 : [isRenewed]),
|
|
809
808
|
filterEntitiesSimpleFieldByValue("isPrimary", isPrimary),
|
|
810
|
-
|
|
809
|
+
_2.isFunction(sortByQuery) ? sortByQuery : sortByQuery ? _2.sortBy(sortByQuery) : _2.identity
|
|
811
810
|
);
|
|
812
811
|
var { getBooks, getBook, searchBooks, makeSearchBooks } = crud("books", {
|
|
813
812
|
search: search2
|
|
814
813
|
});
|
|
815
|
-
var makeSearchValidBooks = () => createSearchSelector2(makeSearchBooks(), (books) =>
|
|
814
|
+
var makeSearchValidBooks = () => createSearchSelector2(makeSearchBooks(), (books) => _2.filter({ valid: true, hasNewDesign: true }, books));
|
|
816
815
|
var searchValidBooks = makeSearchValidBooks();
|
|
817
816
|
var makeGetBook = () => makeGetEntityById2("books");
|
|
818
817
|
|
|
@@ -820,17 +819,17 @@ var makeGetBook = () => makeGetEntityById2("books");
|
|
|
820
819
|
init_define_import_meta();
|
|
821
820
|
var import_reselect = __toESM(require_lib(), 1);
|
|
822
821
|
import { filterEntitiesArrayFieldByValues as filterEntitiesArrayFieldByValues2, filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues3 } from "@lls/utils";
|
|
823
|
-
import
|
|
822
|
+
import _4 from "lodash/fp.js";
|
|
824
823
|
|
|
825
824
|
// src/selectors/auth.ts
|
|
826
825
|
init_define_import_meta();
|
|
827
|
-
import
|
|
828
|
-
var getAuth =
|
|
829
|
-
var getIsLogged =
|
|
830
|
-
var getToken =
|
|
826
|
+
import _3 from "lodash/fp.js";
|
|
827
|
+
var getAuth = _3.get("auth");
|
|
828
|
+
var getIsLogged = _3.flow(_3.get("auth.id"), _3.negate(_3.isNil));
|
|
829
|
+
var getToken = _3.get("auth.token");
|
|
831
830
|
|
|
832
831
|
// src/selectors/user.ts
|
|
833
|
-
var search3 = ({ ids, schoolIds }) =>
|
|
832
|
+
var search3 = ({ ids, schoolIds }) => _4.flow(filterEntitiesArrayFieldByValues2("schools", schoolIds), filterEntitiesSimpleFieldByValues3("id", ids));
|
|
834
833
|
var { getUsers, getUser, searchUsers, makeSearchUsers } = crud("users", {
|
|
835
834
|
search: search3
|
|
836
835
|
});
|
|
@@ -843,8 +842,8 @@ var getCurrentUser = (0, import_reselect.createSelector)(
|
|
|
843
842
|
// src/selectors/chapter.ts
|
|
844
843
|
init_define_import_meta();
|
|
845
844
|
import { filterEntitiesFieldExists, filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues4 } from "@lls/utils";
|
|
846
|
-
import
|
|
847
|
-
var search4 = ({ bookIds, ids, hasTeacherBook }) =>
|
|
845
|
+
import _5 from "lodash/fp.js";
|
|
846
|
+
var search4 = ({ bookIds, ids, hasTeacherBook }) => _5.flow(
|
|
848
847
|
filterEntitiesSimpleFieldByValues4("book", bookIds),
|
|
849
848
|
filterEntitiesSimpleFieldByValues4("id", ids),
|
|
850
849
|
filterEntitiesFieldExists("teacherBook", hasTeacherBook)
|
|
@@ -853,10 +852,274 @@ var { getChapters, getChapter, searchChapters, makeSearchChapters } = crud("chap
|
|
|
853
852
|
search: search4
|
|
854
853
|
});
|
|
855
854
|
|
|
855
|
+
// src/selectors/page.ts
|
|
856
|
+
init_define_import_meta();
|
|
857
|
+
import {
|
|
858
|
+
createSearchSelector as createSearchSelector3,
|
|
859
|
+
filterEntitiesArrayFieldByValues as filterEntitiesArrayFieldByValues3,
|
|
860
|
+
filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues5,
|
|
861
|
+
makeGetAllEntities as makeGetAllEntities2,
|
|
862
|
+
makeGetEntityById as makeGetEntityById3
|
|
863
|
+
} from "@lls/utils";
|
|
864
|
+
import _6 from "lodash/fp.js";
|
|
865
|
+
var search5 = ({
|
|
866
|
+
ids,
|
|
867
|
+
chapterIds,
|
|
868
|
+
isValid,
|
|
869
|
+
oldLessonIds,
|
|
870
|
+
premium,
|
|
871
|
+
thematicNames,
|
|
872
|
+
bookIds,
|
|
873
|
+
isOriginal,
|
|
874
|
+
hasNewDesign,
|
|
875
|
+
slugs,
|
|
876
|
+
isLearningAssessment,
|
|
877
|
+
isCreatedFromScratch
|
|
878
|
+
}) => _6.flow(
|
|
879
|
+
filterEntitiesSimpleFieldByValues5("id", ids),
|
|
880
|
+
filterEntitiesSimpleFieldByValues5("chapter", chapterIds),
|
|
881
|
+
filterEntitiesSimpleFieldByValues5("valid", _6.isNil(isValid) ? void 0 : [isValid]),
|
|
882
|
+
filterEntitiesSimpleFieldByValues5("isOriginal", _6.isNil(isOriginal) ? void 0 : [isOriginal]),
|
|
883
|
+
filterEntitiesSimpleFieldByValues5("hasNewDesign", _6.isNil(hasNewDesign) ? void 0 : [hasNewDesign]),
|
|
884
|
+
filterEntitiesSimpleFieldByValues5("slug", slugs),
|
|
885
|
+
filterEntitiesSimpleFieldByValues5("oldLesson", oldLessonIds),
|
|
886
|
+
filterEntitiesSimpleFieldByValues5(
|
|
887
|
+
"isLearningAssessment",
|
|
888
|
+
_6.isNil(isLearningAssessment) ? void 0 : [isLearningAssessment]
|
|
889
|
+
),
|
|
890
|
+
filterEntitiesSimpleFieldByValues5(
|
|
891
|
+
"isCreatedFromScratch",
|
|
892
|
+
_6.isNil(isCreatedFromScratch) ? void 0 : [isCreatedFromScratch]
|
|
893
|
+
),
|
|
894
|
+
filterEntitiesSimpleFieldByValues5("premium", _6.isNil(premium) ? void 0 : [premium]),
|
|
895
|
+
filterEntitiesSimpleFieldByValues5("thematicName", thematicNames),
|
|
896
|
+
filterEntitiesSimpleFieldByValues5("book", bookIds)
|
|
897
|
+
);
|
|
898
|
+
var { getPages, getPage, searchPages, makeSearchPages } = crud("pages", {
|
|
899
|
+
search: search5
|
|
900
|
+
});
|
|
901
|
+
var getDraftPages = makeGetAllEntities2("drafts");
|
|
902
|
+
var makeGetDraftPage = () => makeGetEntityById3("drafts");
|
|
903
|
+
var getDraftPage = makeGetDraftPage();
|
|
904
|
+
var makeSearchDraftPages = () => createSearchSelector3(
|
|
905
|
+
getDraftPages,
|
|
906
|
+
(_state, params) => params,
|
|
907
|
+
(pages, params) => search5(params)(pages)
|
|
908
|
+
);
|
|
909
|
+
var searchDraftPages = makeSearchDraftPages();
|
|
910
|
+
var makeSearchModifiedPages = () => createSearchSelector3(
|
|
911
|
+
getPages,
|
|
912
|
+
(_state, params) => params,
|
|
913
|
+
(pages, {
|
|
914
|
+
chapterIds,
|
|
915
|
+
userIds,
|
|
916
|
+
originalPageIds,
|
|
917
|
+
parentIds,
|
|
918
|
+
bookIds,
|
|
919
|
+
sharedUserIds,
|
|
920
|
+
updatedAfter,
|
|
921
|
+
isLearningAssessment,
|
|
922
|
+
thematicNames,
|
|
923
|
+
isDraft,
|
|
924
|
+
isCreatedFromScratch,
|
|
925
|
+
isParentCreatedFromScratch,
|
|
926
|
+
sharedGroups
|
|
927
|
+
}) => _6.flow(
|
|
928
|
+
filterEntitiesSimpleFieldByValues5("parent", parentIds),
|
|
929
|
+
filterEntitiesSimpleFieldByValues5("chapter", chapterIds),
|
|
930
|
+
filterEntitiesSimpleFieldByValues5("book", bookIds),
|
|
931
|
+
filterEntitiesSimpleFieldByValues5("user", userIds),
|
|
932
|
+
filterEntitiesSimpleFieldByValues5("originalPage", originalPageIds),
|
|
933
|
+
filterEntitiesArrayFieldByValues3("sharedUsers", sharedUserIds),
|
|
934
|
+
filterEntitiesArrayFieldByValues3("sharedGroups", sharedGroups),
|
|
935
|
+
filterEntitiesSimpleFieldByValues5("isOriginal", [false]),
|
|
936
|
+
filterEntitiesSimpleFieldByValues5("thematicName", thematicNames),
|
|
937
|
+
!_6.isNil(isLearningAssessment) ? filterEntitiesSimpleFieldByValues5("isLearningAssessment", [isLearningAssessment]) : _6.identity,
|
|
938
|
+
!_6.isNil(isCreatedFromScratch) ? filterEntitiesSimpleFieldByValues5("isCreatedFromScratch", [isCreatedFromScratch]) : _6.identity,
|
|
939
|
+
!_6.isNil(isDraft) ? filterEntitiesSimpleFieldByValues5("isDraft", [isDraft]) : _6.identity,
|
|
940
|
+
isParentCreatedFromScratch ? _6.filter(
|
|
941
|
+
(entity) => _6.flow(_6.find({ id: entity?.originalPage }), _6.get("isCreatedFromScratch"))(pages)
|
|
942
|
+
) : _6.identity,
|
|
943
|
+
updatedAfter ? _6.filter(
|
|
944
|
+
_6.flow(_6.get("updatedAt"), (date) => new Date(date) - updatedAfter >= 0)
|
|
945
|
+
) : _6.identity
|
|
946
|
+
)(pages)
|
|
947
|
+
);
|
|
948
|
+
var searchModifiedPages = makeSearchModifiedPages();
|
|
949
|
+
|
|
950
|
+
// src/selectors/collection.ts
|
|
951
|
+
init_define_import_meta();
|
|
952
|
+
import _7 from "lodash/fp.js";
|
|
953
|
+
var search6 = (_params) => _7.identity;
|
|
954
|
+
var { getCollections, getCollection, searchCollections, makeSearchCollections } = crud("collections", {
|
|
955
|
+
search: search6
|
|
956
|
+
});
|
|
957
|
+
|
|
958
|
+
// src/selectors/communityProject.ts
|
|
959
|
+
init_define_import_meta();
|
|
960
|
+
import { filterEntitiesArrayFieldByValues as filterEntitiesArrayFieldByValues4, filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues6 } from "@lls/utils";
|
|
961
|
+
import _8 from "lodash/fp.js";
|
|
962
|
+
var search7 = ({
|
|
963
|
+
slugs,
|
|
964
|
+
isFeatured,
|
|
965
|
+
projectTypes
|
|
966
|
+
}) => _8.flow(
|
|
967
|
+
filterEntitiesSimpleFieldByValues6("slug", slugs),
|
|
968
|
+
filterEntitiesSimpleFieldByValues6("isFeatured", _8.isNil(isFeatured) ? void 0 : [isFeatured]),
|
|
969
|
+
filterEntitiesArrayFieldByValues4("projectTypes", projectTypes)
|
|
970
|
+
);
|
|
971
|
+
var { getCommunityProjects, getCommunityProject, searchCommunityProjects, makeSearchCommunityProjects } = crud(
|
|
972
|
+
"communityProjects",
|
|
973
|
+
{
|
|
974
|
+
search: search7
|
|
975
|
+
}
|
|
976
|
+
);
|
|
977
|
+
|
|
978
|
+
// src/selectors/contact.ts
|
|
979
|
+
init_define_import_meta();
|
|
980
|
+
import _9 from "lodash/fp.js";
|
|
981
|
+
var search8 = (_params) => _9.identity;
|
|
982
|
+
var { getContacts, getContact, searchContacts, makeSearchContacts } = crud("contacts", {
|
|
983
|
+
search: search8
|
|
984
|
+
});
|
|
985
|
+
|
|
986
|
+
// src/selectors/copyNotification.ts
|
|
987
|
+
init_define_import_meta();
|
|
988
|
+
import { createSearchSelector as createSearchSelector4, filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues7, makeGetAllEntities as makeGetAllEntities3 } from "@lls/utils";
|
|
989
|
+
import _10 from "lodash/fp.js";
|
|
990
|
+
var getCopyNotifications = makeGetAllEntities3("copyNotifications");
|
|
991
|
+
var makeSearchCopyNotifications = () => createSearchSelector4(
|
|
992
|
+
[getCurrentUser, getCopyNotifications, (_19, params) => params],
|
|
993
|
+
(currentUser, copyNotifications, { pageIds, read }) => _10.flow(
|
|
994
|
+
_10.get("copyNotifications"),
|
|
995
|
+
(ids) => _10.flow(
|
|
996
|
+
filterEntitiesSimpleFieldByValues7("id", ids),
|
|
997
|
+
filterEntitiesSimpleFieldByValues7("page", pageIds),
|
|
998
|
+
filterEntitiesSimpleFieldByValues7("read", _10.isNil(read) ? void 0 : [read])
|
|
999
|
+
)(copyNotifications)
|
|
1000
|
+
)(currentUser)
|
|
1001
|
+
);
|
|
1002
|
+
var searchCopyNotifications = makeSearchCopyNotifications();
|
|
1003
|
+
|
|
1004
|
+
// src/selectors/drawerNotification.ts
|
|
1005
|
+
init_define_import_meta();
|
|
1006
|
+
import { createSearchSelector as createSearchSelector5, filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues8, makeGetAllEntities as makeGetAllEntities4 } from "@lls/utils";
|
|
1007
|
+
import _11 from "lodash/fp.js";
|
|
1008
|
+
var getDrawerNotifications = makeGetAllEntities4("drawerNotifications");
|
|
1009
|
+
var makeSearchDrawerNotifications = () => createSearchSelector5(
|
|
1010
|
+
[getCurrentUser, getDrawerNotifications, (_19, params) => params],
|
|
1011
|
+
(currentUser, drawerNotifications, { read, pageIds }) => _11.flow(
|
|
1012
|
+
_11.get("drawerNotifications"),
|
|
1013
|
+
(ids) => _11.flow(
|
|
1014
|
+
filterEntitiesSimpleFieldByValues8("id", ids),
|
|
1015
|
+
filterEntitiesSimpleFieldByValues8("read", _11.isNil(read) ? void 0 : [read]),
|
|
1016
|
+
filterEntitiesSimpleFieldByValues8("page", pageIds)
|
|
1017
|
+
)(drawerNotifications)
|
|
1018
|
+
)(currentUser)
|
|
1019
|
+
);
|
|
1020
|
+
var searchDrawerNotifications = makeSearchDrawerNotifications();
|
|
1021
|
+
|
|
1022
|
+
// src/selectors/faq.ts
|
|
1023
|
+
init_define_import_meta();
|
|
1024
|
+
import { makeGetAllEntities as makeGetAllEntities5 } from "@lls/utils";
|
|
1025
|
+
var getFaqs = makeGetAllEntities5("faq");
|
|
1026
|
+
|
|
1027
|
+
// src/selectors/garDivision.ts
|
|
1028
|
+
init_define_import_meta();
|
|
1029
|
+
import _12 from "lodash/fp.js";
|
|
1030
|
+
var search9 = (_params) => _12.identity;
|
|
1031
|
+
var { getGarDivisions, getGarDivision, searchGarDivisions, makeSearchGarDivisions } = crud("garDivisions", {
|
|
1032
|
+
search: search9
|
|
1033
|
+
});
|
|
1034
|
+
|
|
1035
|
+
// src/selectors/group.ts
|
|
1036
|
+
init_define_import_meta();
|
|
1037
|
+
var import_reselect2 = __toESM(require_lib(), 1);
|
|
1038
|
+
import { filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues9 } from "@lls/utils";
|
|
1039
|
+
import _13 from "lodash/fp.js";
|
|
1040
|
+
var search10 = ({ ownerIds }) => _13.flow(filterEntitiesSimpleFieldByValues9("owner", ownerIds), _13.orderBy("createdAt", ["desc"]));
|
|
1041
|
+
var { getGroups, getGroup, searchGroups, makeSearchGroups } = crud("groups", {
|
|
1042
|
+
search: search10
|
|
1043
|
+
});
|
|
1044
|
+
var getUserGroups = (0, import_reselect2.createSelector)(
|
|
1045
|
+
[getGroups, getCurrentUser],
|
|
1046
|
+
(groups, currentUser) => search10({ ownerIds: [currentUser?.id] })(groups)
|
|
1047
|
+
);
|
|
1048
|
+
|
|
1049
|
+
// src/selectors/level.ts
|
|
1050
|
+
init_define_import_meta();
|
|
1051
|
+
var import_reselect3 = __toESM(require_lib(), 1);
|
|
1052
|
+
import { filterEntitiesSimpleFieldByValue as filterEntitiesSimpleFieldByValue2, filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues10 } from "@lls/utils";
|
|
1053
|
+
import _14 from "lodash/fp.js";
|
|
1054
|
+
var search11 = ({
|
|
1055
|
+
ids,
|
|
1056
|
+
slugs,
|
|
1057
|
+
isPreSchool,
|
|
1058
|
+
isMiddleSchool,
|
|
1059
|
+
isHighSchool,
|
|
1060
|
+
isProHighSchool,
|
|
1061
|
+
isGenHighSchool,
|
|
1062
|
+
isElementarySchool
|
|
1063
|
+
}) => _14.flow(
|
|
1064
|
+
filterEntitiesSimpleFieldByValues10("id", ids),
|
|
1065
|
+
filterEntitiesSimpleFieldByValues10("slug", slugs),
|
|
1066
|
+
filterEntitiesSimpleFieldByValue2("isPreSchool", isPreSchool),
|
|
1067
|
+
filterEntitiesSimpleFieldByValue2("isMiddleSchool", isMiddleSchool),
|
|
1068
|
+
filterEntitiesSimpleFieldByValue2("isHighSchool", isHighSchool),
|
|
1069
|
+
filterEntitiesSimpleFieldByValue2("isProHighSchool", isProHighSchool),
|
|
1070
|
+
filterEntitiesSimpleFieldByValue2("isGenHighSchool", isGenHighSchool),
|
|
1071
|
+
filterEntitiesSimpleFieldByValue2("isElementarySchool", isElementarySchool),
|
|
1072
|
+
_14.orderBy("order", "desc")
|
|
1073
|
+
);
|
|
1074
|
+
var crudLevels = crud("levels", { search: search11 });
|
|
1075
|
+
var { getLevel, searchLevels, makeSearchLevels } = crudLevels;
|
|
1076
|
+
var getLevels = (0, import_reselect3.createSelector)(crudLevels.getLevels, _14.orderBy("order", "desc"));
|
|
1077
|
+
|
|
1078
|
+
// src/selectors/mainNotification.ts
|
|
1079
|
+
init_define_import_meta();
|
|
1080
|
+
var import_reselect4 = __toESM(require_lib(), 1);
|
|
1081
|
+
import { filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues11, makeGetAllEntities as makeGetAllEntities6 } from "@lls/utils";
|
|
1082
|
+
import _15 from "lodash/fp.js";
|
|
1083
|
+
var getAllMainNotifications = makeGetAllEntities6("mainNotifications");
|
|
1084
|
+
var search12 = ({ ids }) => _15.flow(filterEntitiesSimpleFieldByValues11("id", ids));
|
|
1085
|
+
var getMainNotifications = (0, import_reselect4.createSelector)(
|
|
1086
|
+
[_15.flow(getCurrentUser, _15.get("mainNotifications")), getAllMainNotifications],
|
|
1087
|
+
(userNotifications, notifications) => search12({ ids: userNotifications })(notifications)
|
|
1088
|
+
);
|
|
1089
|
+
|
|
1090
|
+
// src/selectors/news.ts
|
|
1091
|
+
init_define_import_meta();
|
|
1092
|
+
import { filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues12 } from "@lls/utils";
|
|
1093
|
+
var search13 = ({ ids }) => filterEntitiesSimpleFieldByValues12("id", ids);
|
|
1094
|
+
var {
|
|
1095
|
+
getNews: getAllNews,
|
|
1096
|
+
getNew: getNews,
|
|
1097
|
+
searchNews,
|
|
1098
|
+
makeSearchNews
|
|
1099
|
+
} = crud("news", {
|
|
1100
|
+
search: search13
|
|
1101
|
+
});
|
|
1102
|
+
|
|
1103
|
+
// src/selectors/panorama.ts
|
|
1104
|
+
init_define_import_meta();
|
|
1105
|
+
import { makeGetEntityById as makeGetEntityById4 } from "@lls/utils";
|
|
1106
|
+
var getPanorama = makeGetEntityById4("panoramas");
|
|
1107
|
+
|
|
1108
|
+
// src/selectors/premiumResource.ts
|
|
1109
|
+
init_define_import_meta();
|
|
1110
|
+
import { filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues13 } from "@lls/utils";
|
|
1111
|
+
var search14 = ({ bookIds }) => filterEntitiesSimpleFieldByValues13("book", bookIds);
|
|
1112
|
+
var { getPremiumResources, getPremiumResource, searchPremiumResources, makeSearchPremiumResources } = crud(
|
|
1113
|
+
"premiumResources",
|
|
1114
|
+
{
|
|
1115
|
+
search: search14
|
|
1116
|
+
}
|
|
1117
|
+
);
|
|
1118
|
+
|
|
856
1119
|
// src/reducers/entities.ts
|
|
857
1120
|
init_define_import_meta();
|
|
858
1121
|
import { makeReducer } from "@lls/utils";
|
|
859
|
-
import
|
|
1122
|
+
import _16 from "lodash/fp.js";
|
|
860
1123
|
|
|
861
1124
|
// src/actions/index.ts
|
|
862
1125
|
init_define_import_meta();
|
|
@@ -879,23 +1142,23 @@ var resetAuth = makeActionCreator(actionTypes.RESET_AUTH);
|
|
|
879
1142
|
// src/reducers/entities.ts
|
|
880
1143
|
var deleteEntityReducer = (state, payload) => {
|
|
881
1144
|
const { path } = payload;
|
|
882
|
-
return
|
|
1145
|
+
return _16.omit(path, state);
|
|
883
1146
|
};
|
|
884
1147
|
var updateEntityReducer = (state, payload) => {
|
|
885
1148
|
const { path, entity } = payload;
|
|
886
|
-
const currentEntity =
|
|
887
|
-
return
|
|
1149
|
+
const currentEntity = _16.get(path, state);
|
|
1150
|
+
return _16.set(path, _16.merge(currentEntity, entity), state);
|
|
888
1151
|
};
|
|
889
1152
|
var setEntityReducer = (state, payload) => {
|
|
890
1153
|
const { path, entity } = payload;
|
|
891
|
-
return
|
|
1154
|
+
return _16.set(path, entity, state);
|
|
892
1155
|
};
|
|
893
1156
|
var shallowAssign = (old, next, transform) => {
|
|
894
1157
|
let updated = false;
|
|
895
|
-
const merged =
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
if (
|
|
1158
|
+
const merged = _16.flow(
|
|
1159
|
+
_16.toPairs,
|
|
1160
|
+
_16.reduce((memo, [key, val]) => {
|
|
1161
|
+
if (_16.isEmpty(val)) return memo;
|
|
899
1162
|
if (!old[key]) {
|
|
900
1163
|
updated = true;
|
|
901
1164
|
memo[key] = val;
|
|
@@ -908,7 +1171,7 @@ var shallowAssign = (old, next, transform) => {
|
|
|
908
1171
|
return memo;
|
|
909
1172
|
}
|
|
910
1173
|
return memo;
|
|
911
|
-
},
|
|
1174
|
+
}, _16.clone(old))
|
|
912
1175
|
)(next);
|
|
913
1176
|
return updated ? merged : old;
|
|
914
1177
|
};
|
|
@@ -917,7 +1180,7 @@ var setEntitiesReducer = (state, payload) => {
|
|
|
917
1180
|
return shallowAssign(
|
|
918
1181
|
entityKind,
|
|
919
1182
|
nextEntityKind,
|
|
920
|
-
(oldEntity, nextEntity) =>
|
|
1183
|
+
(oldEntity, nextEntity) => _16.isEqual(oldEntity, nextEntity) ? oldEntity : _16.assign(oldEntity, nextEntity)
|
|
921
1184
|
);
|
|
922
1185
|
});
|
|
923
1186
|
};
|
|
@@ -935,7 +1198,7 @@ var entities_default = entities;
|
|
|
935
1198
|
// src/reducers/auth.ts
|
|
936
1199
|
init_define_import_meta();
|
|
937
1200
|
import { makeReducer as makeReducer2 } from "@lls/utils";
|
|
938
|
-
import
|
|
1201
|
+
import _17 from "lodash/fp.js";
|
|
939
1202
|
var initialState = {
|
|
940
1203
|
id: void 0,
|
|
941
1204
|
role: null,
|
|
@@ -948,15 +1211,15 @@ var initialState = {
|
|
|
948
1211
|
llsUserId: null
|
|
949
1212
|
};
|
|
950
1213
|
var auth = makeReducer2(initialState, {
|
|
951
|
-
[actionTypes.SET_AUTH]:
|
|
952
|
-
[actionTypes.RESET_AUTH]:
|
|
1214
|
+
[actionTypes.SET_AUTH]: _17.assign,
|
|
1215
|
+
[actionTypes.RESET_AUTH]: _17.constant(initialState)
|
|
953
1216
|
});
|
|
954
1217
|
var auth_default = auth;
|
|
955
1218
|
|
|
956
1219
|
// src/schema/index.ts
|
|
957
1220
|
init_define_import_meta();
|
|
958
1221
|
var import_normalizr = __toESM(require_normalizr(), 1);
|
|
959
|
-
import
|
|
1222
|
+
import _18 from "lodash/fp.js";
|
|
960
1223
|
var document = new import_normalizr.schema.Entity("documents", {}, { idAttribute: "resourceId" });
|
|
961
1224
|
var subject = new import_normalizr.schema.Entity("subjects");
|
|
962
1225
|
var level = new import_normalizr.schema.Entity("levels");
|
|
@@ -1143,22 +1406,60 @@ var querySchema = {
|
|
|
1143
1406
|
}
|
|
1144
1407
|
}
|
|
1145
1408
|
};
|
|
1146
|
-
var normalizeData =
|
|
1409
|
+
var normalizeData = _18.flow((data) => (0, import_normalizr.normalize)(data, querySchema));
|
|
1147
1410
|
export {
|
|
1148
1411
|
auth_default as authReducer,
|
|
1149
1412
|
entities_default as entitiesReducer,
|
|
1413
|
+
getAllNews,
|
|
1150
1414
|
getBook,
|
|
1151
1415
|
getBooks,
|
|
1152
1416
|
getChapter,
|
|
1153
1417
|
getChapters,
|
|
1418
|
+
getCollection,
|
|
1419
|
+
getCollections,
|
|
1420
|
+
getCommunityProject,
|
|
1421
|
+
getCommunityProjects,
|
|
1422
|
+
getContact,
|
|
1423
|
+
getContacts,
|
|
1154
1424
|
getCurrentUser,
|
|
1425
|
+
getDraftPage,
|
|
1426
|
+
getDraftPages,
|
|
1427
|
+
getFaqs,
|
|
1428
|
+
getGarDivision,
|
|
1429
|
+
getGarDivisions,
|
|
1430
|
+
getGroup,
|
|
1431
|
+
getGroups,
|
|
1432
|
+
getLevel,
|
|
1433
|
+
getLevels,
|
|
1434
|
+
getMainNotifications,
|
|
1435
|
+
getNews,
|
|
1436
|
+
getPage,
|
|
1437
|
+
getPages,
|
|
1438
|
+
getPanorama,
|
|
1439
|
+
getPremiumResource,
|
|
1440
|
+
getPremiumResources,
|
|
1155
1441
|
getSchool,
|
|
1156
1442
|
getSchools,
|
|
1157
1443
|
getUser,
|
|
1444
|
+
getUserGroups,
|
|
1158
1445
|
getUsers,
|
|
1159
1446
|
makeGetBook,
|
|
1447
|
+
makeGetDraftPage,
|
|
1160
1448
|
makeSearchBooks,
|
|
1161
1449
|
makeSearchChapters,
|
|
1450
|
+
makeSearchCollections,
|
|
1451
|
+
makeSearchCommunityProjects,
|
|
1452
|
+
makeSearchContacts,
|
|
1453
|
+
makeSearchCopyNotifications,
|
|
1454
|
+
makeSearchDraftPages,
|
|
1455
|
+
makeSearchDrawerNotifications,
|
|
1456
|
+
makeSearchGarDivisions,
|
|
1457
|
+
makeSearchGroups,
|
|
1458
|
+
makeSearchLevels,
|
|
1459
|
+
makeSearchModifiedPages,
|
|
1460
|
+
makeSearchNews,
|
|
1461
|
+
makeSearchPages,
|
|
1462
|
+
makeSearchPremiumResources,
|
|
1162
1463
|
makeSearchSchools,
|
|
1163
1464
|
makeSearchUsers,
|
|
1164
1465
|
makeSearchValidBooks,
|
|
@@ -1166,6 +1467,19 @@ export {
|
|
|
1166
1467
|
querySchema,
|
|
1167
1468
|
searchBooks,
|
|
1168
1469
|
searchChapters,
|
|
1470
|
+
searchCollections,
|
|
1471
|
+
searchCommunityProjects,
|
|
1472
|
+
searchContacts,
|
|
1473
|
+
searchCopyNotifications,
|
|
1474
|
+
searchDraftPages,
|
|
1475
|
+
searchDrawerNotifications,
|
|
1476
|
+
searchGarDivisions,
|
|
1477
|
+
searchGroups,
|
|
1478
|
+
searchLevels,
|
|
1479
|
+
searchModifiedPages,
|
|
1480
|
+
searchNews,
|
|
1481
|
+
searchPages,
|
|
1482
|
+
searchPremiumResources,
|
|
1169
1483
|
searchSchools,
|
|
1170
1484
|
searchUsers,
|
|
1171
1485
|
searchValidBooks,
|
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-19581805",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"types": "./lib/builttypes/store/src/index.d.ts",
|
|
8
8
|
"exports": {
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"vite": "5.3.3",
|
|
42
42
|
"vite-tsconfig-paths": "4.3.2",
|
|
43
43
|
"vitest": "2.0.0",
|
|
44
|
-
"@lls/utils": "24.1.59-
|
|
45
|
-
"@lls/vitescripts": "24.1.59-
|
|
44
|
+
"@lls/utils": "24.1.59-19581805",
|
|
45
|
+
"@lls/vitescripts": "24.1.59-19581805"
|
|
46
46
|
},
|
|
47
47
|
"license": "ISC",
|
|
48
48
|
"dependencies": {
|