@lls/store 24.1.59-bf92ba76 → 24.1.59-c7b931f7
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 +31 -421
- package/package.json +4 -4
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: search3 }) => {
|
|
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) => search3(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,65 +761,15 @@ 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
|
});
|
|
767
768
|
|
|
768
|
-
// src/selectors/book.ts
|
|
769
|
-
init_define_import_meta();
|
|
770
|
-
import {
|
|
771
|
-
createSearchSelector as createSearchSelector2,
|
|
772
|
-
filterEntitiesArrayFieldByValues,
|
|
773
|
-
filterEntitiesSimpleFieldByValue,
|
|
774
|
-
filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues2,
|
|
775
|
-
makeGetEntityById as makeGetEntityById2
|
|
776
|
-
} from "@lls/utils";
|
|
777
|
-
import _2 from "lodash/fp.js";
|
|
778
|
-
var search2 = ({
|
|
779
|
-
ids,
|
|
780
|
-
levelIds,
|
|
781
|
-
subjectIds,
|
|
782
|
-
years,
|
|
783
|
-
isValid,
|
|
784
|
-
isWorkbook,
|
|
785
|
-
isWorkplan,
|
|
786
|
-
hasNoTeacherBook,
|
|
787
|
-
sortByQuery,
|
|
788
|
-
hasNewDesign,
|
|
789
|
-
slugs,
|
|
790
|
-
uris,
|
|
791
|
-
publishers,
|
|
792
|
-
isRenewed,
|
|
793
|
-
isPrimary
|
|
794
|
-
}) => _2.flow(
|
|
795
|
-
filterEntitiesSimpleFieldByValues2("id", ids),
|
|
796
|
-
filterEntitiesSimpleFieldByValues2("year", years),
|
|
797
|
-
filterEntitiesArrayFieldByValues("levels", levelIds),
|
|
798
|
-
filterEntitiesArrayFieldByValues("subjects", subjectIds),
|
|
799
|
-
filterEntitiesSimpleFieldByValues2("valid", _2.isNil(isValid) ? void 0 : [isValid]),
|
|
800
|
-
filterEntitiesSimpleFieldByValues2("publisher", publishers),
|
|
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]),
|
|
805
|
-
filterEntitiesSimpleFieldByValues2("slug", slugs),
|
|
806
|
-
filterEntitiesSimpleFieldByValues2("uri", uris),
|
|
807
|
-
filterEntitiesSimpleFieldByValues2("isRenewed", _2.isNil(isRenewed) ? void 0 : [isRenewed]),
|
|
808
|
-
filterEntitiesSimpleFieldByValue("isPrimary", isPrimary),
|
|
809
|
-
_2.isFunction(sortByQuery) ? sortByQuery : sortByQuery ? _2.sortBy(sortByQuery) : _2.identity
|
|
810
|
-
);
|
|
811
|
-
var { getBooks, getBook, searchBooks, makeSearchBooks } = crud("books", {
|
|
812
|
-
search: search2
|
|
813
|
-
});
|
|
814
|
-
var makeSearchValidBooks = () => createSearchSelector2(makeSearchBooks(), (books) => _2.filter({ valid: true, hasNewDesign: true }, books));
|
|
815
|
-
var searchValidBooks = makeSearchValidBooks();
|
|
816
|
-
var makeGetBook = () => makeGetEntityById2("books");
|
|
817
|
-
|
|
818
769
|
// src/selectors/user.ts
|
|
819
770
|
init_define_import_meta();
|
|
820
771
|
var import_reselect = __toESM(require_lib(), 1);
|
|
821
|
-
import { filterEntitiesArrayFieldByValues
|
|
772
|
+
import { filterEntitiesArrayFieldByValues, filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues2 } from "@lls/utils";
|
|
822
773
|
import _4 from "lodash/fp.js";
|
|
823
774
|
|
|
824
775
|
// src/selectors/auth.ts
|
|
@@ -829,9 +780,9 @@ var getIsLogged = _3.flow(_3.get("auth.id"), _3.negate(_3.isNil));
|
|
|
829
780
|
var getToken = _3.get("auth.token");
|
|
830
781
|
|
|
831
782
|
// src/selectors/user.ts
|
|
832
|
-
var
|
|
783
|
+
var search2 = ({ ids, schoolIds }) => _4.flow(filterEntitiesArrayFieldByValues("schools", schoolIds), filterEntitiesSimpleFieldByValues2("id", ids));
|
|
833
784
|
var { getUsers, getUser, searchUsers, makeSearchUsers } = crud("users", {
|
|
834
|
-
search:
|
|
785
|
+
search: search2
|
|
835
786
|
});
|
|
836
787
|
var getCurrentUser = (0, import_reselect.createSelector)(
|
|
837
788
|
getAuth,
|
|
@@ -839,287 +790,10 @@ var getCurrentUser = (0, import_reselect.createSelector)(
|
|
|
839
790
|
(auth2, users) => users?.find((user2) => user2?.id === auth2?.id)
|
|
840
791
|
);
|
|
841
792
|
|
|
842
|
-
// src/selectors/chapter.ts
|
|
843
|
-
init_define_import_meta();
|
|
844
|
-
import { filterEntitiesFieldExists, filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues4 } from "@lls/utils";
|
|
845
|
-
import _5 from "lodash/fp.js";
|
|
846
|
-
var search4 = ({ bookIds, ids, hasTeacherBook }) => _5.flow(
|
|
847
|
-
filterEntitiesSimpleFieldByValues4("book", bookIds),
|
|
848
|
-
filterEntitiesSimpleFieldByValues4("id", ids),
|
|
849
|
-
filterEntitiesFieldExists("teacherBook", hasTeacherBook)
|
|
850
|
-
);
|
|
851
|
-
var { getChapters, getChapter, searchChapters, makeSearchChapters } = crud("chapters", {
|
|
852
|
-
search: search4
|
|
853
|
-
});
|
|
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
|
-
|
|
1119
793
|
// src/reducers/entities.ts
|
|
1120
794
|
init_define_import_meta();
|
|
1121
795
|
import { makeReducer } from "@lls/utils";
|
|
1122
|
-
import
|
|
796
|
+
import _5 from "lodash/fp.js";
|
|
1123
797
|
|
|
1124
798
|
// src/actions/index.ts
|
|
1125
799
|
init_define_import_meta();
|
|
@@ -1142,23 +816,23 @@ var resetAuth = makeActionCreator(actionTypes.RESET_AUTH);
|
|
|
1142
816
|
// src/reducers/entities.ts
|
|
1143
817
|
var deleteEntityReducer = (state, payload) => {
|
|
1144
818
|
const { path } = payload;
|
|
1145
|
-
return
|
|
819
|
+
return _5.omit(path, state);
|
|
1146
820
|
};
|
|
1147
821
|
var updateEntityReducer = (state, payload) => {
|
|
1148
822
|
const { path, entity } = payload;
|
|
1149
|
-
const currentEntity =
|
|
1150
|
-
return
|
|
823
|
+
const currentEntity = _5.get(path, state);
|
|
824
|
+
return _5.set(path, _5.merge(currentEntity, entity), state);
|
|
1151
825
|
};
|
|
1152
826
|
var setEntityReducer = (state, payload) => {
|
|
1153
827
|
const { path, entity } = payload;
|
|
1154
|
-
return
|
|
828
|
+
return _5.set(path, entity, state);
|
|
1155
829
|
};
|
|
1156
830
|
var shallowAssign = (old, next, transform) => {
|
|
1157
831
|
let updated = false;
|
|
1158
|
-
const merged =
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
if (
|
|
832
|
+
const merged = _5.flow(
|
|
833
|
+
_5.toPairs,
|
|
834
|
+
_5.reduce((memo, [key, val]) => {
|
|
835
|
+
if (_5.isEmpty(val)) return memo;
|
|
1162
836
|
if (!old[key]) {
|
|
1163
837
|
updated = true;
|
|
1164
838
|
memo[key] = val;
|
|
@@ -1171,7 +845,7 @@ var shallowAssign = (old, next, transform) => {
|
|
|
1171
845
|
return memo;
|
|
1172
846
|
}
|
|
1173
847
|
return memo;
|
|
1174
|
-
},
|
|
848
|
+
}, _5.clone(old))
|
|
1175
849
|
)(next);
|
|
1176
850
|
return updated ? merged : old;
|
|
1177
851
|
};
|
|
@@ -1180,7 +854,7 @@ var setEntitiesReducer = (state, payload) => {
|
|
|
1180
854
|
return shallowAssign(
|
|
1181
855
|
entityKind,
|
|
1182
856
|
nextEntityKind,
|
|
1183
|
-
(oldEntity, nextEntity) =>
|
|
857
|
+
(oldEntity, nextEntity) => _5.isEqual(oldEntity, nextEntity) ? oldEntity : _5.assign(oldEntity, nextEntity)
|
|
1184
858
|
);
|
|
1185
859
|
});
|
|
1186
860
|
};
|
|
@@ -1198,7 +872,7 @@ var entities_default = entities;
|
|
|
1198
872
|
// src/reducers/auth.ts
|
|
1199
873
|
init_define_import_meta();
|
|
1200
874
|
import { makeReducer as makeReducer2 } from "@lls/utils";
|
|
1201
|
-
import
|
|
875
|
+
import _6 from "lodash/fp.js";
|
|
1202
876
|
var initialState = {
|
|
1203
877
|
id: void 0,
|
|
1204
878
|
role: null,
|
|
@@ -1211,15 +885,15 @@ var initialState = {
|
|
|
1211
885
|
llsUserId: null
|
|
1212
886
|
};
|
|
1213
887
|
var auth = makeReducer2(initialState, {
|
|
1214
|
-
[actionTypes.SET_AUTH]:
|
|
1215
|
-
[actionTypes.RESET_AUTH]:
|
|
888
|
+
[actionTypes.SET_AUTH]: _6.assign,
|
|
889
|
+
[actionTypes.RESET_AUTH]: _6.constant(initialState)
|
|
1216
890
|
});
|
|
1217
891
|
var auth_default = auth;
|
|
1218
892
|
|
|
1219
893
|
// src/schema/index.ts
|
|
1220
894
|
init_define_import_meta();
|
|
1221
895
|
var import_normalizr = __toESM(require_normalizr(), 1);
|
|
1222
|
-
import
|
|
896
|
+
import _7 from "lodash/fp.js";
|
|
1223
897
|
var document = new import_normalizr.schema.Entity("documents", {}, { idAttribute: "resourceId" });
|
|
1224
898
|
var subject = new import_normalizr.schema.Entity("subjects");
|
|
1225
899
|
var level = new import_normalizr.schema.Entity("levels");
|
|
@@ -1234,7 +908,6 @@ var teacher = new import_normalizr.schema.Entity("teachers");
|
|
|
1234
908
|
var faq = new import_normalizr.schema.Entity("faq");
|
|
1235
909
|
var product = new import_normalizr.schema.Entity("products");
|
|
1236
910
|
var communityProjects = new import_normalizr.schema.Entity("communityProjects");
|
|
1237
|
-
var builderIo = new import_normalizr.schema.Entity("builderIos");
|
|
1238
911
|
var grammarRule = new import_normalizr.schema.Entity("grammarRules", {}, { idAttribute: "objectID" });
|
|
1239
912
|
var mainNotification = new import_normalizr.schema.Entity("mainNotifications");
|
|
1240
913
|
var explorerResult = new import_normalizr.schema.Entity("explorerResults", {}, { idAttribute: "resourceId" });
|
|
@@ -1397,8 +1070,7 @@ var querySchema = {
|
|
|
1397
1070
|
addLikeFaq: faq,
|
|
1398
1071
|
communityProjects: [communityProjects],
|
|
1399
1072
|
createAnalytics: analytic,
|
|
1400
|
-
faq: [faq]
|
|
1401
|
-
builderIos: [builderIo]
|
|
1073
|
+
faq: [faq]
|
|
1402
1074
|
},
|
|
1403
1075
|
static: {
|
|
1404
1076
|
projetVoltaire: {
|
|
@@ -1406,82 +1078,20 @@ var querySchema = {
|
|
|
1406
1078
|
}
|
|
1407
1079
|
}
|
|
1408
1080
|
};
|
|
1409
|
-
var normalizeData =
|
|
1081
|
+
var normalizeData = _7.flow((data) => (0, import_normalizr.normalize)(data, querySchema));
|
|
1410
1082
|
export {
|
|
1411
1083
|
auth_default as authReducer,
|
|
1412
1084
|
entities_default as entitiesReducer,
|
|
1413
|
-
getAllNews,
|
|
1414
|
-
getBook,
|
|
1415
|
-
getBooks,
|
|
1416
|
-
getChapter,
|
|
1417
|
-
getChapters,
|
|
1418
|
-
getCollection,
|
|
1419
|
-
getCollections,
|
|
1420
|
-
getCommunityProject,
|
|
1421
|
-
getCommunityProjects,
|
|
1422
|
-
getContact,
|
|
1423
|
-
getContacts,
|
|
1424
1085
|
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
1086
|
getSchool,
|
|
1442
1087
|
getSchools,
|
|
1443
1088
|
getUser,
|
|
1444
|
-
getUserGroups,
|
|
1445
1089
|
getUsers,
|
|
1446
|
-
makeGetBook,
|
|
1447
|
-
makeGetDraftPage,
|
|
1448
|
-
makeSearchBooks,
|
|
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,
|
|
1463
1090
|
makeSearchSchools,
|
|
1464
1091
|
makeSearchUsers,
|
|
1465
|
-
makeSearchValidBooks,
|
|
1466
1092
|
normalizeData,
|
|
1467
1093
|
querySchema,
|
|
1468
|
-
searchBooks,
|
|
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,
|
|
1483
1094
|
searchSchools,
|
|
1484
1095
|
searchUsers,
|
|
1485
|
-
searchValidBooks,
|
|
1486
1096
|
setEntitiesReducer
|
|
1487
1097
|
};
|
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-c7b931f7",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"types": "./lib/builttypes/store/src/index.d.ts",
|
|
8
8
|
"exports": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"react": "*"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@biomejs/biome": "1.8.4-nightly.
|
|
31
|
+
"@biomejs/biome": "1.8.4-nightly.a579bf7",
|
|
32
32
|
"@types/lodash": "4.17.6",
|
|
33
33
|
"@types/node": "20.14.10",
|
|
34
34
|
"@types/react": "18.3.3",
|
|
@@ -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-c7b931f7",
|
|
45
|
+
"@lls/vitescripts": "24.1.59-c7b931f7"
|
|
46
46
|
},
|
|
47
47
|
"license": "ISC",
|
|
48
48
|
"dependencies": {
|