@lls/store 24.1.59-2800c639 → 24.1.59-288e5a19
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 +46 -362
- 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 createSelector3 = function createSelector4() {
|
|
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 createSelector3;
|
|
251
251
|
}
|
|
252
|
-
var
|
|
253
|
-
exports.createSelector =
|
|
252
|
+
var createSelector2 = /* @__PURE__ */ createSelectorCreator(_defaultMemoize.defaultMemoize);
|
|
253
|
+
exports.createSelector = createSelector2;
|
|
254
254
|
var createStructuredSelector = function createStructuredSelector2(selectors, selectorCreator) {
|
|
255
255
|
if (selectorCreator === void 0) {
|
|
256
|
-
selectorCreator =
|
|
256
|
+
selectorCreator = createSelector2;
|
|
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,19 +736,20 @@ 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 _2 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
|
-
|
|
744
|
+
import _ from "lodash/fp.js";
|
|
745
|
+
var crud = (entityName, { search: search5 }) => {
|
|
745
746
|
const getElements = makeGetAllEntities(entityName);
|
|
746
747
|
const makeSearchElements = () => createSearchSelector(
|
|
747
748
|
getElements,
|
|
748
749
|
(_state, params) => params,
|
|
749
|
-
(elements, params) =>
|
|
750
|
+
(elements, params) => search5(params)(elements)
|
|
750
751
|
);
|
|
751
|
-
const methodName =
|
|
752
|
+
const methodName = _.capitalize(entityName);
|
|
752
753
|
const getElementById = makeGetEntityById(entityName);
|
|
753
754
|
const back = {
|
|
754
755
|
[`get${methodName}`]: getElements,
|
|
@@ -760,7 +761,7 @@ var crud = (entityName, { search: search15 }) => {
|
|
|
760
761
|
};
|
|
761
762
|
|
|
762
763
|
// src/selectors/school.ts
|
|
763
|
-
var search = ({ ids }) =>
|
|
764
|
+
var search = ({ ids }) => _2.flow(filterEntitiesSimpleFieldByValues("id", ids));
|
|
764
765
|
var { getSchools, getSchool, searchSchools, makeSearchSchools } = crud("schools", {
|
|
765
766
|
search
|
|
766
767
|
});
|
|
@@ -774,7 +775,7 @@ import {
|
|
|
774
775
|
filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues2,
|
|
775
776
|
makeGetEntityById as makeGetEntityById2
|
|
776
777
|
} from "@lls/utils";
|
|
777
|
-
import
|
|
778
|
+
import _3 from "lodash/fp.js";
|
|
778
779
|
var search2 = ({
|
|
779
780
|
ids,
|
|
780
781
|
levelIds,
|
|
@@ -791,27 +792,27 @@ var search2 = ({
|
|
|
791
792
|
publishers,
|
|
792
793
|
isRenewed,
|
|
793
794
|
isPrimary
|
|
794
|
-
}) =>
|
|
795
|
+
}) => _3.flow(
|
|
795
796
|
filterEntitiesSimpleFieldByValues2("id", ids),
|
|
796
797
|
filterEntitiesSimpleFieldByValues2("year", years),
|
|
797
798
|
filterEntitiesArrayFieldByValues("levels", levelIds),
|
|
798
799
|
filterEntitiesArrayFieldByValues("subjects", subjectIds),
|
|
799
|
-
filterEntitiesSimpleFieldByValues2("valid",
|
|
800
|
+
filterEntitiesSimpleFieldByValues2("valid", _3.isNil(isValid) ? void 0 : [isValid]),
|
|
800
801
|
filterEntitiesSimpleFieldByValues2("publisher", publishers),
|
|
801
|
-
filterEntitiesSimpleFieldByValues2("hasNewDesign",
|
|
802
|
-
filterEntitiesSimpleFieldByValues2("isWorkbook",
|
|
803
|
-
filterEntitiesSimpleFieldByValues2("isWorkplan",
|
|
804
|
-
filterEntitiesSimpleFieldByValues2("hasNoTeacherBook",
|
|
802
|
+
filterEntitiesSimpleFieldByValues2("hasNewDesign", _3.isNil(hasNewDesign) ? void 0 : [hasNewDesign]),
|
|
803
|
+
filterEntitiesSimpleFieldByValues2("isWorkbook", _3.isNil(isWorkbook) ? void 0 : [isWorkbook]),
|
|
804
|
+
filterEntitiesSimpleFieldByValues2("isWorkplan", _3.isNil(isWorkplan) ? void 0 : [isWorkplan]),
|
|
805
|
+
filterEntitiesSimpleFieldByValues2("hasNoTeacherBook", _3.isNil(hasNoTeacherBook) ? void 0 : [hasNoTeacherBook]),
|
|
805
806
|
filterEntitiesSimpleFieldByValues2("slug", slugs),
|
|
806
807
|
filterEntitiesSimpleFieldByValues2("uri", uris),
|
|
807
|
-
filterEntitiesSimpleFieldByValues2("isRenewed",
|
|
808
|
+
filterEntitiesSimpleFieldByValues2("isRenewed", _3.isNil(isRenewed) ? void 0 : [isRenewed]),
|
|
808
809
|
filterEntitiesSimpleFieldByValue("isPrimary", isPrimary),
|
|
809
|
-
|
|
810
|
+
_3.isFunction(sortByQuery) ? sortByQuery : sortByQuery ? _3.sortBy(sortByQuery) : _3.identity
|
|
810
811
|
);
|
|
811
812
|
var { getBooks, getBook, searchBooks, makeSearchBooks } = crud("books", {
|
|
812
813
|
search: search2
|
|
813
814
|
});
|
|
814
|
-
var makeSearchValidBooks = () => createSearchSelector2(makeSearchBooks(), (books) =>
|
|
815
|
+
var makeSearchValidBooks = () => createSearchSelector2(makeSearchBooks(), (books) => _3.filter({ valid: true, hasNewDesign: true }, books));
|
|
815
816
|
var searchValidBooks = makeSearchValidBooks();
|
|
816
817
|
var makeGetBook = () => makeGetEntityById2("books");
|
|
817
818
|
|
|
@@ -819,17 +820,17 @@ var makeGetBook = () => makeGetEntityById2("books");
|
|
|
819
820
|
init_define_import_meta();
|
|
820
821
|
var import_reselect = __toESM(require_lib(), 1);
|
|
821
822
|
import { filterEntitiesArrayFieldByValues as filterEntitiesArrayFieldByValues2, filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues3 } from "@lls/utils";
|
|
822
|
-
import
|
|
823
|
+
import _5 from "lodash/fp.js";
|
|
823
824
|
|
|
824
825
|
// src/selectors/auth.ts
|
|
825
826
|
init_define_import_meta();
|
|
826
|
-
import
|
|
827
|
-
var getAuth =
|
|
828
|
-
var getIsLogged =
|
|
829
|
-
var getToken =
|
|
827
|
+
import _4 from "lodash/fp.js";
|
|
828
|
+
var getAuth = _4.get("auth");
|
|
829
|
+
var getIsLogged = _4.flow(_4.get("auth.id"), _4.negate(_4.isNil));
|
|
830
|
+
var getToken = _4.get("auth.token");
|
|
830
831
|
|
|
831
832
|
// src/selectors/user.ts
|
|
832
|
-
var search3 = ({ ids, schoolIds }) =>
|
|
833
|
+
var search3 = ({ ids, schoolIds }) => _5.flow(filterEntitiesArrayFieldByValues2("schools", schoolIds), filterEntitiesSimpleFieldByValues3("id", ids));
|
|
833
834
|
var { getUsers, getUser, searchUsers, makeSearchUsers } = crud("users", {
|
|
834
835
|
search: search3
|
|
835
836
|
});
|
|
@@ -842,8 +843,8 @@ var getCurrentUser = (0, import_reselect.createSelector)(
|
|
|
842
843
|
// src/selectors/chapter.ts
|
|
843
844
|
init_define_import_meta();
|
|
844
845
|
import { filterEntitiesFieldExists, filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues4 } from "@lls/utils";
|
|
845
|
-
import
|
|
846
|
-
var search4 = ({ bookIds, ids, hasTeacherBook }) =>
|
|
846
|
+
import _6 from "lodash/fp.js";
|
|
847
|
+
var search4 = ({ bookIds, ids, hasTeacherBook }) => _6.flow(
|
|
847
848
|
filterEntitiesSimpleFieldByValues4("book", bookIds),
|
|
848
849
|
filterEntitiesSimpleFieldByValues4("id", ids),
|
|
849
850
|
filterEntitiesFieldExists("teacherBook", hasTeacherBook)
|
|
@@ -852,274 +853,10 @@ var { getChapters, getChapter, searchChapters, makeSearchChapters } = crud("chap
|
|
|
852
853
|
search: search4
|
|
853
854
|
});
|
|
854
855
|
|
|
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
|
-
|
|
1119
856
|
// src/reducers/entities.ts
|
|
1120
857
|
init_define_import_meta();
|
|
1121
858
|
import { makeReducer } from "@lls/utils";
|
|
1122
|
-
import
|
|
859
|
+
import _7 from "lodash/fp.js";
|
|
1123
860
|
|
|
1124
861
|
// src/actions/index.ts
|
|
1125
862
|
init_define_import_meta();
|
|
@@ -1142,23 +879,23 @@ var resetAuth = makeActionCreator(actionTypes.RESET_AUTH);
|
|
|
1142
879
|
// src/reducers/entities.ts
|
|
1143
880
|
var deleteEntityReducer = (state, payload) => {
|
|
1144
881
|
const { path } = payload;
|
|
1145
|
-
return
|
|
882
|
+
return _7.omit(path, state);
|
|
1146
883
|
};
|
|
1147
884
|
var updateEntityReducer = (state, payload) => {
|
|
1148
885
|
const { path, entity } = payload;
|
|
1149
|
-
const currentEntity =
|
|
1150
|
-
return
|
|
886
|
+
const currentEntity = _7.get(path, state);
|
|
887
|
+
return _7.set(path, _7.merge(currentEntity, entity), state);
|
|
1151
888
|
};
|
|
1152
889
|
var setEntityReducer = (state, payload) => {
|
|
1153
890
|
const { path, entity } = payload;
|
|
1154
|
-
return
|
|
891
|
+
return _7.set(path, entity, state);
|
|
1155
892
|
};
|
|
1156
893
|
var shallowAssign = (old, next, transform) => {
|
|
1157
894
|
let updated = false;
|
|
1158
|
-
const merged =
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
if (
|
|
895
|
+
const merged = _7.flow(
|
|
896
|
+
_7.toPairs,
|
|
897
|
+
_7.reduce((memo, [key, val]) => {
|
|
898
|
+
if (_7.isEmpty(val)) return memo;
|
|
1162
899
|
if (!old[key]) {
|
|
1163
900
|
updated = true;
|
|
1164
901
|
memo[key] = val;
|
|
@@ -1171,7 +908,7 @@ var shallowAssign = (old, next, transform) => {
|
|
|
1171
908
|
return memo;
|
|
1172
909
|
}
|
|
1173
910
|
return memo;
|
|
1174
|
-
},
|
|
911
|
+
}, _7.clone(old))
|
|
1175
912
|
)(next);
|
|
1176
913
|
return updated ? merged : old;
|
|
1177
914
|
};
|
|
@@ -1180,7 +917,7 @@ var setEntitiesReducer = (state, payload) => {
|
|
|
1180
917
|
return shallowAssign(
|
|
1181
918
|
entityKind,
|
|
1182
919
|
nextEntityKind,
|
|
1183
|
-
(oldEntity, nextEntity) =>
|
|
920
|
+
(oldEntity, nextEntity) => _7.isEqual(oldEntity, nextEntity) ? oldEntity : _7.assign(oldEntity, nextEntity)
|
|
1184
921
|
);
|
|
1185
922
|
});
|
|
1186
923
|
};
|
|
@@ -1198,7 +935,7 @@ var entities_default = entities;
|
|
|
1198
935
|
// src/reducers/auth.ts
|
|
1199
936
|
init_define_import_meta();
|
|
1200
937
|
import { makeReducer as makeReducer2 } from "@lls/utils";
|
|
1201
|
-
import
|
|
938
|
+
import _8 from "lodash/fp.js";
|
|
1202
939
|
var initialState = {
|
|
1203
940
|
id: void 0,
|
|
1204
941
|
role: null,
|
|
@@ -1211,15 +948,15 @@ var initialState = {
|
|
|
1211
948
|
llsUserId: null
|
|
1212
949
|
};
|
|
1213
950
|
var auth = makeReducer2(initialState, {
|
|
1214
|
-
[actionTypes.SET_AUTH]:
|
|
1215
|
-
[actionTypes.RESET_AUTH]:
|
|
951
|
+
[actionTypes.SET_AUTH]: _8.assign,
|
|
952
|
+
[actionTypes.RESET_AUTH]: _8.constant(initialState)
|
|
1216
953
|
});
|
|
1217
954
|
var auth_default = auth;
|
|
1218
955
|
|
|
1219
956
|
// src/schema/index.ts
|
|
1220
957
|
init_define_import_meta();
|
|
1221
958
|
var import_normalizr = __toESM(require_normalizr(), 1);
|
|
1222
|
-
import
|
|
959
|
+
import _9 from "lodash/fp.js";
|
|
1223
960
|
var document = new import_normalizr.schema.Entity("documents", {}, { idAttribute: "resourceId" });
|
|
1224
961
|
var subject = new import_normalizr.schema.Entity("subjects");
|
|
1225
962
|
var level = new import_normalizr.schema.Entity("levels");
|
|
@@ -1234,7 +971,6 @@ var teacher = new import_normalizr.schema.Entity("teachers");
|
|
|
1234
971
|
var faq = new import_normalizr.schema.Entity("faq");
|
|
1235
972
|
var product = new import_normalizr.schema.Entity("products");
|
|
1236
973
|
var communityProjects = new import_normalizr.schema.Entity("communityProjects");
|
|
1237
|
-
var builderIo = new import_normalizr.schema.Entity("builderIos");
|
|
1238
974
|
var grammarRule = new import_normalizr.schema.Entity("grammarRules", {}, { idAttribute: "objectID" });
|
|
1239
975
|
var mainNotification = new import_normalizr.schema.Entity("mainNotifications");
|
|
1240
976
|
var explorerResult = new import_normalizr.schema.Entity("explorerResults", {}, { idAttribute: "resourceId" });
|
|
@@ -1397,8 +1133,7 @@ var querySchema = {
|
|
|
1397
1133
|
addLikeFaq: faq,
|
|
1398
1134
|
communityProjects: [communityProjects],
|
|
1399
1135
|
createAnalytics: analytic,
|
|
1400
|
-
faq: [faq]
|
|
1401
|
-
builderIos: [builderIo]
|
|
1136
|
+
faq: [faq]
|
|
1402
1137
|
},
|
|
1403
1138
|
static: {
|
|
1404
1139
|
projetVoltaire: {
|
|
@@ -1406,60 +1141,22 @@ var querySchema = {
|
|
|
1406
1141
|
}
|
|
1407
1142
|
}
|
|
1408
1143
|
};
|
|
1409
|
-
var normalizeData =
|
|
1144
|
+
var normalizeData = _9.flow((data) => (0, import_normalizr.normalize)(data, querySchema));
|
|
1410
1145
|
export {
|
|
1411
1146
|
auth_default as authReducer,
|
|
1412
1147
|
entities_default as entitiesReducer,
|
|
1413
|
-
getAllNews,
|
|
1414
1148
|
getBook,
|
|
1415
1149
|
getBooks,
|
|
1416
1150
|
getChapter,
|
|
1417
1151
|
getChapters,
|
|
1418
|
-
getCollection,
|
|
1419
|
-
getCollections,
|
|
1420
|
-
getCommunityProject,
|
|
1421
|
-
getCommunityProjects,
|
|
1422
|
-
getContact,
|
|
1423
|
-
getContacts,
|
|
1424
1152
|
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,
|
|
1441
1153
|
getSchool,
|
|
1442
1154
|
getSchools,
|
|
1443
1155
|
getUser,
|
|
1444
|
-
getUserGroups,
|
|
1445
1156
|
getUsers,
|
|
1446
1157
|
makeGetBook,
|
|
1447
|
-
makeGetDraftPage,
|
|
1448
1158
|
makeSearchBooks,
|
|
1449
1159
|
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,
|
|
1463
1160
|
makeSearchSchools,
|
|
1464
1161
|
makeSearchUsers,
|
|
1465
1162
|
makeSearchValidBooks,
|
|
@@ -1467,19 +1164,6 @@ export {
|
|
|
1467
1164
|
querySchema,
|
|
1468
1165
|
searchBooks,
|
|
1469
1166
|
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,
|
|
1483
1167
|
searchSchools,
|
|
1484
1168
|
searchUsers,
|
|
1485
1169
|
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-288e5a19",
|
|
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-288e5a19",
|
|
45
|
+
"@lls/vitescripts": "24.1.59-288e5a19"
|
|
46
46
|
},
|
|
47
47
|
"license": "ISC",
|
|
48
48
|
"dependencies": {
|