@lls/store 24.1.59-7f7e47b5 → 24.1.59-80c28b0a
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 +396 -69
- 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));
|
|
@@ -733,20 +733,27 @@ var require_normalizr = __commonJS({
|
|
|
733
733
|
// src/index.ts
|
|
734
734
|
init_define_import_meta();
|
|
735
735
|
|
|
736
|
+
// src/selectors/auth.ts
|
|
737
|
+
init_define_import_meta();
|
|
738
|
+
import _ from "lodash/fp.js";
|
|
739
|
+
var getAuth = _.get("auth");
|
|
740
|
+
var getIsLogged = _.flow(_.get("auth.id"), _.negate(_.isNil));
|
|
741
|
+
var getToken = _.get("auth.token");
|
|
742
|
+
|
|
736
743
|
// src/selectors/school.ts
|
|
737
744
|
init_define_import_meta();
|
|
738
745
|
import { filterEntitiesSimpleFieldByValues } from "@lls/utils";
|
|
739
|
-
import
|
|
746
|
+
import _2 from "lodash/fp.js";
|
|
740
747
|
|
|
741
748
|
// src/selectors/crud.ts
|
|
742
749
|
init_define_import_meta();
|
|
743
750
|
import { createSearchSelector, makeGetAllEntities, makeGetEntityById } from "@lls/utils";
|
|
744
|
-
var crud = (entityName, { search:
|
|
751
|
+
var crud = (entityName, { search: search23 }) => {
|
|
745
752
|
const getElements = makeGetAllEntities(entityName);
|
|
746
753
|
const makeSearchElements = () => createSearchSelector(
|
|
747
754
|
getElements,
|
|
748
755
|
(_state, params) => params,
|
|
749
|
-
(elements, params) =>
|
|
756
|
+
(elements, params) => search23(params)(elements)
|
|
750
757
|
);
|
|
751
758
|
const methodName = `${entityName.charAt(0).toUpperCase()}${entityName.slice(1)}`;
|
|
752
759
|
const getElementById = makeGetEntityById(entityName);
|
|
@@ -754,13 +761,14 @@ var crud = (entityName, { search: search9 }) => {
|
|
|
754
761
|
[`get${methodName}`]: getElements,
|
|
755
762
|
[`search${methodName}`]: makeSearchElements(),
|
|
756
763
|
[`get${methodName.replace(/s$/, "")}`]: getElementById,
|
|
757
|
-
[`makeSearch${methodName}`]: makeSearchElements
|
|
764
|
+
[`makeSearch${methodName}`]: makeSearchElements,
|
|
765
|
+
[`filter${methodName}`]: search23
|
|
758
766
|
};
|
|
759
767
|
return back;
|
|
760
768
|
};
|
|
761
769
|
|
|
762
770
|
// src/selectors/school.ts
|
|
763
|
-
var search = ({ ids }) =>
|
|
771
|
+
var search = ({ ids }) => _2.flow(filterEntitiesSimpleFieldByValues("id", ids));
|
|
764
772
|
var { getSchools, getSchool, searchSchools, makeSearchSchools } = crud("schools", {
|
|
765
773
|
search
|
|
766
774
|
});
|
|
@@ -774,7 +782,7 @@ import {
|
|
|
774
782
|
filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues2,
|
|
775
783
|
makeGetEntityById as makeGetEntityById2
|
|
776
784
|
} from "@lls/utils";
|
|
777
|
-
import
|
|
785
|
+
import _3 from "lodash/fp.js";
|
|
778
786
|
var search2 = ({
|
|
779
787
|
ids,
|
|
780
788
|
levelIds,
|
|
@@ -791,27 +799,27 @@ var search2 = ({
|
|
|
791
799
|
publishers,
|
|
792
800
|
isRenewed,
|
|
793
801
|
isPrimary
|
|
794
|
-
}) =>
|
|
802
|
+
}) => _3.flow(
|
|
795
803
|
filterEntitiesSimpleFieldByValues2("id", ids),
|
|
796
804
|
filterEntitiesSimpleFieldByValues2("year", years),
|
|
797
805
|
filterEntitiesArrayFieldByValues("levels", levelIds),
|
|
798
806
|
filterEntitiesArrayFieldByValues("subjects", subjectIds),
|
|
799
|
-
filterEntitiesSimpleFieldByValues2("valid",
|
|
807
|
+
filterEntitiesSimpleFieldByValues2("valid", _3.isNil(isValid) ? void 0 : [isValid]),
|
|
800
808
|
filterEntitiesSimpleFieldByValues2("publisher", publishers),
|
|
801
|
-
filterEntitiesSimpleFieldByValues2("hasNewDesign",
|
|
802
|
-
filterEntitiesSimpleFieldByValues2("isWorkbook",
|
|
803
|
-
filterEntitiesSimpleFieldByValues2("isWorkplan",
|
|
804
|
-
filterEntitiesSimpleFieldByValues2("hasNoTeacherBook",
|
|
809
|
+
filterEntitiesSimpleFieldByValues2("hasNewDesign", _3.isNil(hasNewDesign) ? void 0 : [hasNewDesign]),
|
|
810
|
+
filterEntitiesSimpleFieldByValues2("isWorkbook", _3.isNil(isWorkbook) ? void 0 : [isWorkbook]),
|
|
811
|
+
filterEntitiesSimpleFieldByValues2("isWorkplan", _3.isNil(isWorkplan) ? void 0 : [isWorkplan]),
|
|
812
|
+
filterEntitiesSimpleFieldByValues2("hasNoTeacherBook", _3.isNil(hasNoTeacherBook) ? void 0 : [hasNoTeacherBook]),
|
|
805
813
|
filterEntitiesSimpleFieldByValues2("slug", slugs),
|
|
806
814
|
filterEntitiesSimpleFieldByValues2("uri", uris),
|
|
807
|
-
filterEntitiesSimpleFieldByValues2("isRenewed",
|
|
815
|
+
filterEntitiesSimpleFieldByValues2("isRenewed", _3.isNil(isRenewed) ? void 0 : [isRenewed]),
|
|
808
816
|
filterEntitiesSimpleFieldByValue("isPrimary", isPrimary),
|
|
809
|
-
|
|
817
|
+
_3.isFunction(sortByQuery) ? sortByQuery : sortByQuery ? _3.sortBy(sortByQuery) : _3.identity
|
|
810
818
|
);
|
|
811
819
|
var { getBooks, getBook, searchBooks, makeSearchBooks } = crud("books", {
|
|
812
820
|
search: search2
|
|
813
821
|
});
|
|
814
|
-
var makeSearchValidBooks = () => createSearchSelector2(makeSearchBooks(), (books) =>
|
|
822
|
+
var makeSearchValidBooks = () => createSearchSelector2(makeSearchBooks(), (books) => _3.filter({ valid: true, hasNewDesign: true }, books));
|
|
815
823
|
var searchValidBooks = makeSearchValidBooks();
|
|
816
824
|
var makeGetBook = () => makeGetEntityById2("books");
|
|
817
825
|
|
|
@@ -820,15 +828,6 @@ init_define_import_meta();
|
|
|
820
828
|
var import_reselect = __toESM(require_lib(), 1);
|
|
821
829
|
import { filterEntitiesArrayFieldByValues as filterEntitiesArrayFieldByValues2, filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues3 } from "@lls/utils";
|
|
822
830
|
import _4 from "lodash/fp.js";
|
|
823
|
-
|
|
824
|
-
// src/selectors/auth.ts
|
|
825
|
-
init_define_import_meta();
|
|
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");
|
|
830
|
-
|
|
831
|
-
// src/selectors/user.ts
|
|
832
831
|
var search3 = ({ ids, schoolIds }) => _4.flow(filterEntitiesArrayFieldByValues2("schools", schoolIds), filterEntitiesSimpleFieldByValues3("id", ids));
|
|
833
832
|
var { getUsers, getUser, searchUsers, makeSearchUsers } = crud("users", {
|
|
834
833
|
search: search3
|
|
@@ -895,7 +894,7 @@ var search5 = ({
|
|
|
895
894
|
filterEntitiesSimpleFieldByValues5("thematicName", thematicNames),
|
|
896
895
|
filterEntitiesSimpleFieldByValues5("book", bookIds)
|
|
897
896
|
);
|
|
898
|
-
var { getPages, getPage, searchPages, makeSearchPages } = crud("pages", {
|
|
897
|
+
var { getPages, getPage, searchPages, makeSearchPages, filterPages } = crud("pages", {
|
|
899
898
|
search: search5
|
|
900
899
|
});
|
|
901
900
|
var getDraftPages = makeGetAllEntities2("drafts");
|
|
@@ -989,7 +988,7 @@ import { createSearchSelector as createSearchSelector4, filterEntitiesSimpleFiel
|
|
|
989
988
|
import _10 from "lodash/fp.js";
|
|
990
989
|
var getCopyNotifications = makeGetAllEntities3("copyNotifications");
|
|
991
990
|
var makeSearchCopyNotifications = () => createSearchSelector4(
|
|
992
|
-
[getCurrentUser, getCopyNotifications, (
|
|
991
|
+
[getCurrentUser, getCopyNotifications, (_25, params) => params],
|
|
993
992
|
(currentUser, copyNotifications, { pageIds, read }) => _10.flow(
|
|
994
993
|
_10.get("copyNotifications"),
|
|
995
994
|
(ids) => _10.flow(
|
|
@@ -1001,10 +1000,271 @@ var makeSearchCopyNotifications = () => createSearchSelector4(
|
|
|
1001
1000
|
);
|
|
1002
1001
|
var searchCopyNotifications = makeSearchCopyNotifications();
|
|
1003
1002
|
|
|
1003
|
+
// src/selectors/drawerNotification.ts
|
|
1004
|
+
init_define_import_meta();
|
|
1005
|
+
import { createSearchSelector as createSearchSelector5, filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues8, makeGetAllEntities as makeGetAllEntities4 } from "@lls/utils";
|
|
1006
|
+
import _11 from "lodash/fp.js";
|
|
1007
|
+
var getDrawerNotifications = makeGetAllEntities4("drawerNotifications");
|
|
1008
|
+
var makeSearchDrawerNotifications = () => createSearchSelector5(
|
|
1009
|
+
[getCurrentUser, getDrawerNotifications, (_25, params) => params],
|
|
1010
|
+
(currentUser, drawerNotifications, { read, pageIds }) => _11.flow(
|
|
1011
|
+
_11.get("drawerNotifications"),
|
|
1012
|
+
(ids) => _11.flow(
|
|
1013
|
+
filterEntitiesSimpleFieldByValues8("id", ids),
|
|
1014
|
+
filterEntitiesSimpleFieldByValues8("read", _11.isNil(read) ? void 0 : [read]),
|
|
1015
|
+
filterEntitiesSimpleFieldByValues8("page", pageIds)
|
|
1016
|
+
)(drawerNotifications)
|
|
1017
|
+
)(currentUser)
|
|
1018
|
+
);
|
|
1019
|
+
var searchDrawerNotifications = makeSearchDrawerNotifications();
|
|
1020
|
+
|
|
1021
|
+
// src/selectors/faq.ts
|
|
1022
|
+
init_define_import_meta();
|
|
1023
|
+
import { makeGetAllEntities as makeGetAllEntities5 } from "@lls/utils";
|
|
1024
|
+
var getFaqs = makeGetAllEntities5("faq");
|
|
1025
|
+
|
|
1026
|
+
// src/selectors/garDivision.ts
|
|
1027
|
+
init_define_import_meta();
|
|
1028
|
+
import _12 from "lodash/fp.js";
|
|
1029
|
+
var search9 = (_params) => _12.identity;
|
|
1030
|
+
var { getGarDivisions, getGarDivision, searchGarDivisions, makeSearchGarDivisions } = crud("garDivisions", {
|
|
1031
|
+
search: search9
|
|
1032
|
+
});
|
|
1033
|
+
|
|
1034
|
+
// src/selectors/group.ts
|
|
1035
|
+
init_define_import_meta();
|
|
1036
|
+
var import_reselect2 = __toESM(require_lib(), 1);
|
|
1037
|
+
import { filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues9 } from "@lls/utils";
|
|
1038
|
+
import _13 from "lodash/fp.js";
|
|
1039
|
+
var search10 = ({ ownerIds }) => _13.flow(filterEntitiesSimpleFieldByValues9("owner", ownerIds), _13.orderBy("createdAt", ["desc"]));
|
|
1040
|
+
var { getGroups, getGroup, searchGroups, makeSearchGroups } = crud("groups", {
|
|
1041
|
+
search: search10
|
|
1042
|
+
});
|
|
1043
|
+
var getUserGroups = (0, import_reselect2.createSelector)(
|
|
1044
|
+
[getGroups, getCurrentUser],
|
|
1045
|
+
(groups, currentUser) => search10({ ownerIds: [currentUser?.id] })(groups)
|
|
1046
|
+
);
|
|
1047
|
+
|
|
1048
|
+
// src/selectors/level.ts
|
|
1049
|
+
init_define_import_meta();
|
|
1050
|
+
var import_reselect3 = __toESM(require_lib(), 1);
|
|
1051
|
+
import { filterEntitiesSimpleFieldByValue as filterEntitiesSimpleFieldByValue2, filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues10 } from "@lls/utils";
|
|
1052
|
+
import _14 from "lodash/fp.js";
|
|
1053
|
+
var search11 = ({
|
|
1054
|
+
ids,
|
|
1055
|
+
slugs,
|
|
1056
|
+
isPreSchool,
|
|
1057
|
+
isMiddleSchool,
|
|
1058
|
+
isHighSchool,
|
|
1059
|
+
isProHighSchool,
|
|
1060
|
+
isGenHighSchool,
|
|
1061
|
+
isElementarySchool
|
|
1062
|
+
}) => _14.flow(
|
|
1063
|
+
filterEntitiesSimpleFieldByValues10("id", ids),
|
|
1064
|
+
filterEntitiesSimpleFieldByValues10("slug", slugs),
|
|
1065
|
+
filterEntitiesSimpleFieldByValue2("isPreSchool", isPreSchool),
|
|
1066
|
+
filterEntitiesSimpleFieldByValue2("isMiddleSchool", isMiddleSchool),
|
|
1067
|
+
filterEntitiesSimpleFieldByValue2("isHighSchool", isHighSchool),
|
|
1068
|
+
filterEntitiesSimpleFieldByValue2("isProHighSchool", isProHighSchool),
|
|
1069
|
+
filterEntitiesSimpleFieldByValue2("isGenHighSchool", isGenHighSchool),
|
|
1070
|
+
filterEntitiesSimpleFieldByValue2("isElementarySchool", isElementarySchool),
|
|
1071
|
+
_14.orderBy("order", "desc")
|
|
1072
|
+
);
|
|
1073
|
+
var crudLevels = crud("levels", { search: search11 });
|
|
1074
|
+
var { getLevel, searchLevels, makeSearchLevels } = crudLevels;
|
|
1075
|
+
var getLevels = (0, import_reselect3.createSelector)(crudLevels.getLevels, _14.orderBy("order", "desc"));
|
|
1076
|
+
|
|
1077
|
+
// src/selectors/mainNotification.ts
|
|
1078
|
+
init_define_import_meta();
|
|
1079
|
+
var import_reselect4 = __toESM(require_lib(), 1);
|
|
1080
|
+
import { filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues11, makeGetAllEntities as makeGetAllEntities6 } from "@lls/utils";
|
|
1081
|
+
import _15 from "lodash/fp.js";
|
|
1082
|
+
var getAllMainNotifications = makeGetAllEntities6("mainNotifications");
|
|
1083
|
+
var search12 = ({ ids }) => _15.flow(filterEntitiesSimpleFieldByValues11("id", ids));
|
|
1084
|
+
var getMainNotifications = (0, import_reselect4.createSelector)(
|
|
1085
|
+
[_15.flow(getCurrentUser, _15.get("mainNotifications")), getAllMainNotifications],
|
|
1086
|
+
(userNotifications, notifications) => search12({ ids: userNotifications })(notifications)
|
|
1087
|
+
);
|
|
1088
|
+
|
|
1089
|
+
// src/selectors/news.ts
|
|
1090
|
+
init_define_import_meta();
|
|
1091
|
+
import { filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues12 } from "@lls/utils";
|
|
1092
|
+
var search13 = ({ ids }) => filterEntitiesSimpleFieldByValues12("id", ids);
|
|
1093
|
+
var {
|
|
1094
|
+
getNews: getAllNews,
|
|
1095
|
+
getNew: getNews,
|
|
1096
|
+
searchNews,
|
|
1097
|
+
makeSearchNews
|
|
1098
|
+
} = crud("news", {
|
|
1099
|
+
search: search13
|
|
1100
|
+
});
|
|
1101
|
+
|
|
1102
|
+
// src/selectors/panorama.ts
|
|
1103
|
+
init_define_import_meta();
|
|
1104
|
+
import { makeGetEntityById as makeGetEntityById4 } from "@lls/utils";
|
|
1105
|
+
var getPanorama = makeGetEntityById4("panoramas");
|
|
1106
|
+
|
|
1107
|
+
// src/selectors/premiumResource.ts
|
|
1108
|
+
init_define_import_meta();
|
|
1109
|
+
import { filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues13 } from "@lls/utils";
|
|
1110
|
+
var search14 = ({ bookIds }) => filterEntitiesSimpleFieldByValues13("book", bookIds);
|
|
1111
|
+
var { getPremiumResources, getPremiumResource, searchPremiumResources, makeSearchPremiumResources } = crud(
|
|
1112
|
+
"premiumResources",
|
|
1113
|
+
{
|
|
1114
|
+
search: search14
|
|
1115
|
+
}
|
|
1116
|
+
);
|
|
1117
|
+
|
|
1118
|
+
// src/selectors/product.ts
|
|
1119
|
+
init_define_import_meta();
|
|
1120
|
+
import _16 from "lodash/fp.js";
|
|
1121
|
+
import {
|
|
1122
|
+
createSearchSelector as createSearchSelector6,
|
|
1123
|
+
filterEntitiesArrayFieldByValues as filterEntitiesArrayFieldByValues5,
|
|
1124
|
+
filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues14,
|
|
1125
|
+
makeGetAllEntities as makeGetAllEntities7
|
|
1126
|
+
} from "@lls/utils";
|
|
1127
|
+
var getProducts = makeGetAllEntities7("products");
|
|
1128
|
+
var search15 = ({
|
|
1129
|
+
ids,
|
|
1130
|
+
eans,
|
|
1131
|
+
isAdoptant,
|
|
1132
|
+
isSupportPlus,
|
|
1133
|
+
levelIds,
|
|
1134
|
+
subjectIds,
|
|
1135
|
+
productTypes
|
|
1136
|
+
}) => {
|
|
1137
|
+
return _16.flow(
|
|
1138
|
+
(products, books) => levelIds || subjectIds ? filterEntitiesArrayFieldByValues5("books", _16.map("id", books))(products) : products,
|
|
1139
|
+
filterEntitiesSimpleFieldByValues14("id", ids),
|
|
1140
|
+
filterEntitiesSimpleFieldByValues14("ean", eans),
|
|
1141
|
+
filterEntitiesSimpleFieldByValues14("isAdoptant", _16.isBoolean(isAdoptant) ? [isAdoptant] : void 0),
|
|
1142
|
+
filterEntitiesSimpleFieldByValues14("isSupportPlus", _16.isBoolean(isSupportPlus) ? [isSupportPlus] : void 0),
|
|
1143
|
+
filterEntitiesSimpleFieldByValues14("productType", productTypes)
|
|
1144
|
+
);
|
|
1145
|
+
};
|
|
1146
|
+
var searchBooks2 = makeSearchBooks();
|
|
1147
|
+
var searchProducts = createSearchSelector6(
|
|
1148
|
+
getProducts,
|
|
1149
|
+
(state, { levelIds, subjectIds }) => searchBooks2(state, { levelIds, subjectIds }),
|
|
1150
|
+
(_state, params) => params,
|
|
1151
|
+
(products, books, params) => search15(params)(products, books)
|
|
1152
|
+
);
|
|
1153
|
+
|
|
1154
|
+
// src/selectors/resource.ts
|
|
1155
|
+
init_define_import_meta();
|
|
1156
|
+
import { filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues15 } from "@lls/utils";
|
|
1157
|
+
import _17 from "lodash/fp.js";
|
|
1158
|
+
var search16 = ({ chapterIds }) => _17.flow(filterEntitiesSimpleFieldByValues15("chapter", chapterIds));
|
|
1159
|
+
var { getResources, getResource, searchResources, makeSearchResources } = crud("resources", {
|
|
1160
|
+
search: search16
|
|
1161
|
+
});
|
|
1162
|
+
|
|
1163
|
+
// src/selectors/schoolType.ts
|
|
1164
|
+
init_define_import_meta();
|
|
1165
|
+
import { filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues16 } from "@lls/utils";
|
|
1166
|
+
var search17 = ({ slugs }) => filterEntitiesSimpleFieldByValues16("slug", slugs);
|
|
1167
|
+
var { getSchoolTypes, getSchoolType, searchSchoolTypes, makeSearchSchoolTypes } = crud("schoolTypes", {
|
|
1168
|
+
search: search17
|
|
1169
|
+
});
|
|
1170
|
+
|
|
1171
|
+
// src/selectors/sharedPage.ts
|
|
1172
|
+
init_define_import_meta();
|
|
1173
|
+
import { createSearchSelector as createSearchSelector7, filterEntitiesSimpleFieldByValue as filterEntitiesSimpleFieldByValue3, filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues17 } from "@lls/utils";
|
|
1174
|
+
import _18 from "lodash/fp.js";
|
|
1175
|
+
var search18 = ({
|
|
1176
|
+
parentIds,
|
|
1177
|
+
userIds,
|
|
1178
|
+
bookIds,
|
|
1179
|
+
isCreatedFromScratch,
|
|
1180
|
+
isLearningAssessment,
|
|
1181
|
+
ids
|
|
1182
|
+
}) => _18.flow(
|
|
1183
|
+
filterEntitiesSimpleFieldByValues17("id", ids),
|
|
1184
|
+
filterEntitiesSimpleFieldByValues17("parent", parentIds),
|
|
1185
|
+
filterEntitiesSimpleFieldByValues17("user", userIds),
|
|
1186
|
+
filterEntitiesSimpleFieldByValues17("book", bookIds),
|
|
1187
|
+
filterEntitiesSimpleFieldByValue3("isLearningAssessment", isLearningAssessment),
|
|
1188
|
+
filterEntitiesSimpleFieldByValue3("isCreatedFromScratch", isCreatedFromScratch)
|
|
1189
|
+
);
|
|
1190
|
+
var { getSharedPages, getSharedPage, searchSharedPages, makeSearchSharedPages } = crud("sharedPages", {
|
|
1191
|
+
search: search18
|
|
1192
|
+
});
|
|
1193
|
+
var searchCurrentUserSharedPages = createSearchSelector7(
|
|
1194
|
+
getCurrentUser,
|
|
1195
|
+
getSharedPages,
|
|
1196
|
+
(_25, params) => params,
|
|
1197
|
+
(user2, sharedPages, params) => {
|
|
1198
|
+
const sharedUserPageIds = user2?.sharedPages ?? [];
|
|
1199
|
+
return search18({ ...params, ids: _18.intersection(sharedUserPageIds, params.ids || sharedUserPageIds) })(sharedPages);
|
|
1200
|
+
}
|
|
1201
|
+
);
|
|
1202
|
+
|
|
1203
|
+
// src/selectors/student.ts
|
|
1204
|
+
init_define_import_meta();
|
|
1205
|
+
import { filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues18 } from "@lls/utils";
|
|
1206
|
+
var search19 = ({ ids }) => filterEntitiesSimpleFieldByValues18("id", ids);
|
|
1207
|
+
var { getStudents, getStudent, searchStudents, makeSearchStudents } = crud("students", {
|
|
1208
|
+
search: search19
|
|
1209
|
+
});
|
|
1210
|
+
|
|
1211
|
+
// src/selectors/subject.ts
|
|
1212
|
+
init_define_import_meta();
|
|
1213
|
+
import {
|
|
1214
|
+
filterEntitiesArrayFieldByValues as filterEntitiesArrayFieldByValues6,
|
|
1215
|
+
filterEntitiesFieldExists as filterEntitiesFieldExists2,
|
|
1216
|
+
filterEntitiesSimpleFieldByValue as filterEntitiesSimpleFieldByValue4,
|
|
1217
|
+
filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues19,
|
|
1218
|
+
limitToTeacherSubjects
|
|
1219
|
+
} from "@lls/utils";
|
|
1220
|
+
import _19 from "lodash/fp.js";
|
|
1221
|
+
var search20 = ({
|
|
1222
|
+
ids,
|
|
1223
|
+
slugs,
|
|
1224
|
+
isTeacherSubject,
|
|
1225
|
+
hasNewsletterUrl,
|
|
1226
|
+
schoolTypes,
|
|
1227
|
+
hasBooks,
|
|
1228
|
+
names
|
|
1229
|
+
}) => _19.flow(
|
|
1230
|
+
filterEntitiesSimpleFieldByValues19("id", ids),
|
|
1231
|
+
filterEntitiesSimpleFieldByValues19("slug", slugs),
|
|
1232
|
+
filterEntitiesSimpleFieldByValues19("name", names),
|
|
1233
|
+
filterEntitiesSimpleFieldByValue4("hasBooks", hasBooks),
|
|
1234
|
+
filterEntitiesArrayFieldByValues6("schoolTypes", schoolTypes),
|
|
1235
|
+
(subjects) => _19.isNil(isTeacherSubject) ? subjects : limitToTeacherSubjects(subjects),
|
|
1236
|
+
filterEntitiesFieldExists2("newsletterUrl", hasNewsletterUrl)
|
|
1237
|
+
);
|
|
1238
|
+
var { getSubjects, getSubject, searchSubjects, makeSearchSubjects } = crud("subjects", {
|
|
1239
|
+
search: search20
|
|
1240
|
+
});
|
|
1241
|
+
|
|
1242
|
+
// src/selectors/teacher.ts
|
|
1243
|
+
init_define_import_meta();
|
|
1244
|
+
import { filterEntitiesArrayFieldByValues as filterEntitiesArrayFieldByValues7, filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues20 } from "@lls/utils";
|
|
1245
|
+
import _20 from "lodash/fp.js";
|
|
1246
|
+
var search21 = ({ ids, schoolIds }) => _20.flow(filterEntitiesSimpleFieldByValues20("id", ids), filterEntitiesArrayFieldByValues7("schools", schoolIds));
|
|
1247
|
+
var { getTeachers, getTeacher, searchTeachers, makeSearchTeachers } = crud("teachers", {
|
|
1248
|
+
search: search21
|
|
1249
|
+
});
|
|
1250
|
+
|
|
1251
|
+
// src/selectors/tool.ts
|
|
1252
|
+
init_define_import_meta();
|
|
1253
|
+
import { filterEntitiesArrayFieldByValues as filterEntitiesArrayFieldByValues8, filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues21 } from "@lls/utils";
|
|
1254
|
+
import _21 from "lodash/fp.js";
|
|
1255
|
+
var search22 = ({ ids, locked, bookIds }) => _21.flow(
|
|
1256
|
+
filterEntitiesSimpleFieldByValues21("id", ids),
|
|
1257
|
+
filterEntitiesSimpleFieldByValues21("locked", _21.isNil(locked) ? void 0 : [locked]),
|
|
1258
|
+
filterEntitiesArrayFieldByValues8("books", bookIds)
|
|
1259
|
+
);
|
|
1260
|
+
var { getTools, getTool, searchTools, makeSearchTools } = crud("tools", {
|
|
1261
|
+
search: search22
|
|
1262
|
+
});
|
|
1263
|
+
|
|
1004
1264
|
// src/reducers/entities.ts
|
|
1005
1265
|
init_define_import_meta();
|
|
1006
1266
|
import { makeReducer } from "@lls/utils";
|
|
1007
|
-
import
|
|
1267
|
+
import _22 from "lodash/fp.js";
|
|
1008
1268
|
|
|
1009
1269
|
// src/actions/index.ts
|
|
1010
1270
|
init_define_import_meta();
|
|
@@ -1027,47 +1287,53 @@ var resetAuth = makeActionCreator(actionTypes.RESET_AUTH);
|
|
|
1027
1287
|
// src/reducers/entities.ts
|
|
1028
1288
|
var deleteEntityReducer = (state, payload) => {
|
|
1029
1289
|
const { path } = payload;
|
|
1030
|
-
return
|
|
1290
|
+
return _22.omit(path, state);
|
|
1031
1291
|
};
|
|
1032
1292
|
var updateEntityReducer = (state, payload) => {
|
|
1033
1293
|
const { path, entity } = payload;
|
|
1034
|
-
const currentEntity =
|
|
1035
|
-
return
|
|
1294
|
+
const currentEntity = _22.get(path, state);
|
|
1295
|
+
return _22.set(path, _22.merge(currentEntity, entity), state);
|
|
1036
1296
|
};
|
|
1037
1297
|
var setEntityReducer = (state, payload) => {
|
|
1038
1298
|
const { path, entity } = payload;
|
|
1039
|
-
return
|
|
1040
|
-
};
|
|
1041
|
-
var shallowAssign = (old, next, transform) => {
|
|
1042
|
-
let updated = false;
|
|
1043
|
-
const merged = _11.flow(
|
|
1044
|
-
_11.toPairs,
|
|
1045
|
-
_11.reduce((memo, [key, val]) => {
|
|
1046
|
-
if (_11.isEmpty(val)) return memo;
|
|
1047
|
-
if (!old[key]) {
|
|
1048
|
-
updated = true;
|
|
1049
|
-
memo[key] = val;
|
|
1050
|
-
return memo;
|
|
1051
|
-
}
|
|
1052
|
-
const maybeEqual = transform(old[key], next[key]);
|
|
1053
|
-
if (maybeEqual !== old[key]) {
|
|
1054
|
-
updated = true;
|
|
1055
|
-
memo[key] = maybeEqual;
|
|
1056
|
-
return memo;
|
|
1057
|
-
}
|
|
1058
|
-
return memo;
|
|
1059
|
-
}, _11.clone(old))
|
|
1060
|
-
)(next);
|
|
1061
|
-
return updated ? merged : old;
|
|
1299
|
+
return _22.set(path, entity, state);
|
|
1062
1300
|
};
|
|
1063
1301
|
var setEntitiesReducer = (state, payload) => {
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
)
|
|
1302
|
+
if (typeof payload !== "object") return state;
|
|
1303
|
+
const stateDrafts = {};
|
|
1304
|
+
Object.keys(payload).forEach((entityName) => {
|
|
1305
|
+
const entities2 = payload[entityName];
|
|
1306
|
+
const entityDraft = {};
|
|
1307
|
+
if (!entities2) {
|
|
1308
|
+
return;
|
|
1309
|
+
}
|
|
1310
|
+
Object.keys(entities2).forEach((id) => {
|
|
1311
|
+
const entity = entities2[id];
|
|
1312
|
+
if (!state[entityName]?.[id]) {
|
|
1313
|
+
entityDraft[id] = entity;
|
|
1314
|
+
} else {
|
|
1315
|
+
if (typeof entity === "undefined") {
|
|
1316
|
+
return;
|
|
1317
|
+
}
|
|
1318
|
+
const diff = Object.keys(entity).some((prop) => {
|
|
1319
|
+
const value = entity[prop];
|
|
1320
|
+
if (!_22.isEqual(state[entityName]?.[id]?.[prop], value)) {
|
|
1321
|
+
return true;
|
|
1322
|
+
}
|
|
1323
|
+
});
|
|
1324
|
+
if (diff) {
|
|
1325
|
+
entityDraft[id] = Object.assign({}, state[entityName]?.[id], entity);
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
});
|
|
1329
|
+
if (Object.keys(entityDraft).length !== 0) {
|
|
1330
|
+
stateDrafts[entityName] = { ...state[entityName], ...entityDraft };
|
|
1331
|
+
}
|
|
1070
1332
|
});
|
|
1333
|
+
if (Object.keys(stateDrafts).length !== 0) {
|
|
1334
|
+
return { ...state, ...stateDrafts };
|
|
1335
|
+
}
|
|
1336
|
+
return state;
|
|
1071
1337
|
};
|
|
1072
1338
|
var entities = makeReducer(
|
|
1073
1339
|
{},
|
|
@@ -1083,7 +1349,7 @@ var entities_default = entities;
|
|
|
1083
1349
|
// src/reducers/auth.ts
|
|
1084
1350
|
init_define_import_meta();
|
|
1085
1351
|
import { makeReducer as makeReducer2 } from "@lls/utils";
|
|
1086
|
-
import
|
|
1352
|
+
import _23 from "lodash/fp.js";
|
|
1087
1353
|
var initialState = {
|
|
1088
1354
|
id: void 0,
|
|
1089
1355
|
role: null,
|
|
@@ -1096,15 +1362,15 @@ var initialState = {
|
|
|
1096
1362
|
llsUserId: null
|
|
1097
1363
|
};
|
|
1098
1364
|
var auth = makeReducer2(initialState, {
|
|
1099
|
-
[actionTypes.SET_AUTH]:
|
|
1100
|
-
[actionTypes.RESET_AUTH]:
|
|
1365
|
+
[actionTypes.SET_AUTH]: _23.assign,
|
|
1366
|
+
[actionTypes.RESET_AUTH]: _23.constant(initialState)
|
|
1101
1367
|
});
|
|
1102
1368
|
var auth_default = auth;
|
|
1103
1369
|
|
|
1104
1370
|
// src/schema/index.ts
|
|
1105
1371
|
init_define_import_meta();
|
|
1106
1372
|
var import_normalizr = __toESM(require_normalizr(), 1);
|
|
1107
|
-
import
|
|
1373
|
+
import _24 from "lodash/fp.js";
|
|
1108
1374
|
var document = new import_normalizr.schema.Entity("documents", {}, { idAttribute: "resourceId" });
|
|
1109
1375
|
var subject = new import_normalizr.schema.Entity("subjects");
|
|
1110
1376
|
var level = new import_normalizr.schema.Entity("levels");
|
|
@@ -1291,10 +1557,13 @@ var querySchema = {
|
|
|
1291
1557
|
}
|
|
1292
1558
|
}
|
|
1293
1559
|
};
|
|
1294
|
-
var normalizeData =
|
|
1560
|
+
var normalizeData = _24.flow((data) => (0, import_normalizr.normalize)(data, querySchema));
|
|
1295
1561
|
export {
|
|
1296
1562
|
auth_default as authReducer,
|
|
1297
1563
|
entities_default as entitiesReducer,
|
|
1564
|
+
filterPages,
|
|
1565
|
+
getAllNews,
|
|
1566
|
+
getAuth,
|
|
1298
1567
|
getBook,
|
|
1299
1568
|
getBooks,
|
|
1300
1569
|
getChapter,
|
|
@@ -1308,11 +1577,41 @@ export {
|
|
|
1308
1577
|
getCurrentUser,
|
|
1309
1578
|
getDraftPage,
|
|
1310
1579
|
getDraftPages,
|
|
1580
|
+
getFaqs,
|
|
1581
|
+
getGarDivision,
|
|
1582
|
+
getGarDivisions,
|
|
1583
|
+
getGroup,
|
|
1584
|
+
getGroups,
|
|
1585
|
+
getIsLogged,
|
|
1586
|
+
getLevel,
|
|
1587
|
+
getLevels,
|
|
1588
|
+
getMainNotifications,
|
|
1589
|
+
getNews,
|
|
1311
1590
|
getPage,
|
|
1312
1591
|
getPages,
|
|
1592
|
+
getPanorama,
|
|
1593
|
+
getPremiumResource,
|
|
1594
|
+
getPremiumResources,
|
|
1595
|
+
getProducts,
|
|
1596
|
+
getResource,
|
|
1597
|
+
getResources,
|
|
1313
1598
|
getSchool,
|
|
1599
|
+
getSchoolType,
|
|
1600
|
+
getSchoolTypes,
|
|
1314
1601
|
getSchools,
|
|
1602
|
+
getSharedPage,
|
|
1603
|
+
getSharedPages,
|
|
1604
|
+
getStudent,
|
|
1605
|
+
getStudents,
|
|
1606
|
+
getSubject,
|
|
1607
|
+
getSubjects,
|
|
1608
|
+
getTeacher,
|
|
1609
|
+
getTeachers,
|
|
1610
|
+
getToken,
|
|
1611
|
+
getTool,
|
|
1612
|
+
getTools,
|
|
1315
1613
|
getUser,
|
|
1614
|
+
getUserGroups,
|
|
1316
1615
|
getUsers,
|
|
1317
1616
|
makeGetBook,
|
|
1318
1617
|
makeGetDraftPage,
|
|
@@ -1323,9 +1622,22 @@ export {
|
|
|
1323
1622
|
makeSearchContacts,
|
|
1324
1623
|
makeSearchCopyNotifications,
|
|
1325
1624
|
makeSearchDraftPages,
|
|
1625
|
+
makeSearchDrawerNotifications,
|
|
1626
|
+
makeSearchGarDivisions,
|
|
1627
|
+
makeSearchGroups,
|
|
1628
|
+
makeSearchLevels,
|
|
1326
1629
|
makeSearchModifiedPages,
|
|
1630
|
+
makeSearchNews,
|
|
1327
1631
|
makeSearchPages,
|
|
1632
|
+
makeSearchPremiumResources,
|
|
1633
|
+
makeSearchResources,
|
|
1634
|
+
makeSearchSchoolTypes,
|
|
1328
1635
|
makeSearchSchools,
|
|
1636
|
+
makeSearchSharedPages,
|
|
1637
|
+
makeSearchStudents,
|
|
1638
|
+
makeSearchSubjects,
|
|
1639
|
+
makeSearchTeachers,
|
|
1640
|
+
makeSearchTools,
|
|
1329
1641
|
makeSearchUsers,
|
|
1330
1642
|
makeSearchValidBooks,
|
|
1331
1643
|
normalizeData,
|
|
@@ -1336,10 +1648,25 @@ export {
|
|
|
1336
1648
|
searchCommunityProjects,
|
|
1337
1649
|
searchContacts,
|
|
1338
1650
|
searchCopyNotifications,
|
|
1651
|
+
searchCurrentUserSharedPages,
|
|
1339
1652
|
searchDraftPages,
|
|
1653
|
+
searchDrawerNotifications,
|
|
1654
|
+
searchGarDivisions,
|
|
1655
|
+
searchGroups,
|
|
1656
|
+
searchLevels,
|
|
1340
1657
|
searchModifiedPages,
|
|
1658
|
+
searchNews,
|
|
1341
1659
|
searchPages,
|
|
1660
|
+
searchPremiumResources,
|
|
1661
|
+
searchProducts,
|
|
1662
|
+
searchResources,
|
|
1663
|
+
searchSchoolTypes,
|
|
1342
1664
|
searchSchools,
|
|
1665
|
+
searchSharedPages,
|
|
1666
|
+
searchStudents,
|
|
1667
|
+
searchSubjects,
|
|
1668
|
+
searchTeachers,
|
|
1669
|
+
searchTools,
|
|
1343
1670
|
searchUsers,
|
|
1344
1671
|
searchValidBooks,
|
|
1345
1672
|
setEntitiesReducer
|
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-80c28b0a",
|
|
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-80c28b0a",
|
|
45
|
+
"@lls/vitescripts": "24.1.59-80c28b0a"
|
|
46
46
|
},
|
|
47
47
|
"license": "ISC",
|
|
48
48
|
"dependencies": {
|