@lls/store 24.1.59-7f7e47b5 → 24.1.59-8b07e64c
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 +413 -71
- 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: search24 }) => {
|
|
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) => search24(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}`]: search24
|
|
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, (_26, params) => params],
|
|
993
992
|
(currentUser, copyNotifications, { pageIds, read }) => _10.flow(
|
|
994
993
|
_10.get("copyNotifications"),
|
|
995
994
|
(ids) => _10.flow(
|
|
@@ -1001,10 +1000,280 @@ 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, (_26, 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/lexicalFlower.ts
|
|
1119
|
+
init_define_import_meta();
|
|
1120
|
+
import { filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues14 } from "@lls/utils";
|
|
1121
|
+
import _16 from "lodash/fp.js";
|
|
1122
|
+
var search15 = ({ ids }) => _16.flow(filterEntitiesSimpleFieldByValues14("id", ids));
|
|
1123
|
+
var { getLexicalFlowers, searchLexicalFlowers } = crud("lexicalFlowers", {
|
|
1124
|
+
search: search15
|
|
1125
|
+
});
|
|
1126
|
+
|
|
1127
|
+
// src/selectors/product.ts
|
|
1128
|
+
init_define_import_meta();
|
|
1129
|
+
import _17 from "lodash/fp.js";
|
|
1130
|
+
import {
|
|
1131
|
+
createSearchSelector as createSearchSelector6,
|
|
1132
|
+
filterEntitiesArrayFieldByValues as filterEntitiesArrayFieldByValues5,
|
|
1133
|
+
filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues15,
|
|
1134
|
+
makeGetAllEntities as makeGetAllEntities7
|
|
1135
|
+
} from "@lls/utils";
|
|
1136
|
+
var getProducts = makeGetAllEntities7("products");
|
|
1137
|
+
var search16 = ({
|
|
1138
|
+
ids,
|
|
1139
|
+
eans,
|
|
1140
|
+
isAdoptant,
|
|
1141
|
+
isSupportPlus,
|
|
1142
|
+
levelIds,
|
|
1143
|
+
subjectIds,
|
|
1144
|
+
productTypes
|
|
1145
|
+
}) => {
|
|
1146
|
+
return _17.flow(
|
|
1147
|
+
(products, books) => levelIds || subjectIds ? filterEntitiesArrayFieldByValues5("books", _17.map("id", books))(products) : products,
|
|
1148
|
+
filterEntitiesSimpleFieldByValues15("id", ids),
|
|
1149
|
+
filterEntitiesSimpleFieldByValues15("ean", eans),
|
|
1150
|
+
filterEntitiesSimpleFieldByValues15("isAdoptant", _17.isBoolean(isAdoptant) ? [isAdoptant] : void 0),
|
|
1151
|
+
filterEntitiesSimpleFieldByValues15("isSupportPlus", _17.isBoolean(isSupportPlus) ? [isSupportPlus] : void 0),
|
|
1152
|
+
filterEntitiesSimpleFieldByValues15("productType", productTypes)
|
|
1153
|
+
);
|
|
1154
|
+
};
|
|
1155
|
+
var searchBooks2 = makeSearchBooks();
|
|
1156
|
+
var searchProducts = createSearchSelector6(
|
|
1157
|
+
getProducts,
|
|
1158
|
+
(state, { levelIds, subjectIds }) => searchBooks2(state, { levelIds, subjectIds }),
|
|
1159
|
+
(_state, params) => params,
|
|
1160
|
+
(products, books, params) => search16(params)(products, books)
|
|
1161
|
+
);
|
|
1162
|
+
|
|
1163
|
+
// src/selectors/resource.ts
|
|
1164
|
+
init_define_import_meta();
|
|
1165
|
+
import { filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues16 } from "@lls/utils";
|
|
1166
|
+
import _18 from "lodash/fp.js";
|
|
1167
|
+
var search17 = ({ chapterIds }) => _18.flow(filterEntitiesSimpleFieldByValues16("chapter", chapterIds));
|
|
1168
|
+
var { getResources, getResource, searchResources, makeSearchResources } = crud("resources", {
|
|
1169
|
+
search: search17
|
|
1170
|
+
});
|
|
1171
|
+
|
|
1172
|
+
// src/selectors/schoolType.ts
|
|
1173
|
+
init_define_import_meta();
|
|
1174
|
+
import { filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues17 } from "@lls/utils";
|
|
1175
|
+
var search18 = ({ slugs }) => filterEntitiesSimpleFieldByValues17("slug", slugs);
|
|
1176
|
+
var { getSchoolTypes, getSchoolType, searchSchoolTypes, makeSearchSchoolTypes } = crud("schoolTypes", {
|
|
1177
|
+
search: search18
|
|
1178
|
+
});
|
|
1179
|
+
|
|
1180
|
+
// src/selectors/sharedPage.ts
|
|
1181
|
+
init_define_import_meta();
|
|
1182
|
+
import { createSearchSelector as createSearchSelector7, filterEntitiesSimpleFieldByValue as filterEntitiesSimpleFieldByValue3, filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues18 } from "@lls/utils";
|
|
1183
|
+
import _19 from "lodash/fp.js";
|
|
1184
|
+
var search19 = ({
|
|
1185
|
+
parentIds,
|
|
1186
|
+
userIds,
|
|
1187
|
+
bookIds,
|
|
1188
|
+
isCreatedFromScratch,
|
|
1189
|
+
isLearningAssessment,
|
|
1190
|
+
ids
|
|
1191
|
+
}) => _19.flow(
|
|
1192
|
+
filterEntitiesSimpleFieldByValues18("id", ids),
|
|
1193
|
+
filterEntitiesSimpleFieldByValues18("parent", parentIds),
|
|
1194
|
+
filterEntitiesSimpleFieldByValues18("user", userIds),
|
|
1195
|
+
filterEntitiesSimpleFieldByValues18("book", bookIds),
|
|
1196
|
+
filterEntitiesSimpleFieldByValue3("isLearningAssessment", isLearningAssessment),
|
|
1197
|
+
filterEntitiesSimpleFieldByValue3("isCreatedFromScratch", isCreatedFromScratch)
|
|
1198
|
+
);
|
|
1199
|
+
var { getSharedPages, getSharedPage, searchSharedPages, makeSearchSharedPages } = crud("sharedPages", {
|
|
1200
|
+
search: search19
|
|
1201
|
+
});
|
|
1202
|
+
var searchCurrentUserSharedPages = createSearchSelector7(
|
|
1203
|
+
getCurrentUser,
|
|
1204
|
+
getSharedPages,
|
|
1205
|
+
(_26, params) => params,
|
|
1206
|
+
(user2, sharedPages, params) => {
|
|
1207
|
+
const sharedUserPageIds = user2?.sharedPages ?? [];
|
|
1208
|
+
return search19({ ...params, ids: _19.intersection(sharedUserPageIds, params.ids || sharedUserPageIds) })(sharedPages);
|
|
1209
|
+
}
|
|
1210
|
+
);
|
|
1211
|
+
|
|
1212
|
+
// src/selectors/student.ts
|
|
1213
|
+
init_define_import_meta();
|
|
1214
|
+
import { filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues19 } from "@lls/utils";
|
|
1215
|
+
var search20 = ({ ids }) => filterEntitiesSimpleFieldByValues19("id", ids);
|
|
1216
|
+
var { getStudents, getStudent, searchStudents, makeSearchStudents } = crud("students", {
|
|
1217
|
+
search: search20
|
|
1218
|
+
});
|
|
1219
|
+
|
|
1220
|
+
// src/selectors/subject.ts
|
|
1221
|
+
init_define_import_meta();
|
|
1222
|
+
import {
|
|
1223
|
+
filterEntitiesArrayFieldByValues as filterEntitiesArrayFieldByValues6,
|
|
1224
|
+
filterEntitiesFieldExists as filterEntitiesFieldExists2,
|
|
1225
|
+
filterEntitiesSimpleFieldByValue as filterEntitiesSimpleFieldByValue4,
|
|
1226
|
+
filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues20,
|
|
1227
|
+
limitToTeacherSubjects
|
|
1228
|
+
} from "@lls/utils";
|
|
1229
|
+
import _20 from "lodash/fp.js";
|
|
1230
|
+
var search21 = ({
|
|
1231
|
+
ids,
|
|
1232
|
+
slugs,
|
|
1233
|
+
isTeacherSubject,
|
|
1234
|
+
hasNewsletterUrl,
|
|
1235
|
+
schoolTypes,
|
|
1236
|
+
hasBooks,
|
|
1237
|
+
names
|
|
1238
|
+
}) => _20.flow(
|
|
1239
|
+
filterEntitiesSimpleFieldByValues20("id", ids),
|
|
1240
|
+
filterEntitiesSimpleFieldByValues20("slug", slugs),
|
|
1241
|
+
filterEntitiesSimpleFieldByValues20("name", names),
|
|
1242
|
+
filterEntitiesSimpleFieldByValue4("hasBooks", hasBooks),
|
|
1243
|
+
filterEntitiesArrayFieldByValues6("schoolTypes", schoolTypes),
|
|
1244
|
+
(subjects) => _20.isNil(isTeacherSubject) ? subjects : limitToTeacherSubjects(subjects),
|
|
1245
|
+
filterEntitiesFieldExists2("newsletterUrl", hasNewsletterUrl)
|
|
1246
|
+
);
|
|
1247
|
+
var { getSubjects, getSubject, searchSubjects, makeSearchSubjects } = crud("subjects", {
|
|
1248
|
+
search: search21
|
|
1249
|
+
});
|
|
1250
|
+
|
|
1251
|
+
// src/selectors/teacher.ts
|
|
1252
|
+
init_define_import_meta();
|
|
1253
|
+
import { filterEntitiesArrayFieldByValues as filterEntitiesArrayFieldByValues7, filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues21 } from "@lls/utils";
|
|
1254
|
+
import _21 from "lodash/fp.js";
|
|
1255
|
+
var search22 = ({ ids, schoolIds }) => _21.flow(filterEntitiesSimpleFieldByValues21("id", ids), filterEntitiesArrayFieldByValues7("schools", schoolIds));
|
|
1256
|
+
var { getTeachers, getTeacher, searchTeachers, makeSearchTeachers } = crud("teachers", {
|
|
1257
|
+
search: search22
|
|
1258
|
+
});
|
|
1259
|
+
|
|
1260
|
+
// src/selectors/tool.ts
|
|
1261
|
+
init_define_import_meta();
|
|
1262
|
+
import { filterEntitiesArrayFieldByValues as filterEntitiesArrayFieldByValues8, filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues22 } from "@lls/utils";
|
|
1263
|
+
import _22 from "lodash/fp.js";
|
|
1264
|
+
var search23 = ({ ids, locked, bookIds }) => _22.flow(
|
|
1265
|
+
filterEntitiesSimpleFieldByValues22("id", ids),
|
|
1266
|
+
filterEntitiesSimpleFieldByValues22("locked", _22.isNil(locked) ? void 0 : [locked]),
|
|
1267
|
+
filterEntitiesArrayFieldByValues8("books", bookIds)
|
|
1268
|
+
);
|
|
1269
|
+
var { getTools, getTool, searchTools, makeSearchTools } = crud("tools", {
|
|
1270
|
+
search: search23
|
|
1271
|
+
});
|
|
1272
|
+
|
|
1004
1273
|
// src/reducers/entities.ts
|
|
1005
1274
|
init_define_import_meta();
|
|
1006
1275
|
import { makeReducer } from "@lls/utils";
|
|
1007
|
-
import
|
|
1276
|
+
import _23 from "lodash/fp.js";
|
|
1008
1277
|
|
|
1009
1278
|
// src/actions/index.ts
|
|
1010
1279
|
init_define_import_meta();
|
|
@@ -1027,47 +1296,53 @@ var resetAuth = makeActionCreator(actionTypes.RESET_AUTH);
|
|
|
1027
1296
|
// src/reducers/entities.ts
|
|
1028
1297
|
var deleteEntityReducer = (state, payload) => {
|
|
1029
1298
|
const { path } = payload;
|
|
1030
|
-
return
|
|
1299
|
+
return _23.omit(path, state);
|
|
1031
1300
|
};
|
|
1032
1301
|
var updateEntityReducer = (state, payload) => {
|
|
1033
1302
|
const { path, entity } = payload;
|
|
1034
|
-
const currentEntity =
|
|
1035
|
-
return
|
|
1303
|
+
const currentEntity = _23.get(path, state);
|
|
1304
|
+
return _23.set(path, _23.merge(currentEntity, entity), state);
|
|
1036
1305
|
};
|
|
1037
1306
|
var setEntityReducer = (state, payload) => {
|
|
1038
1307
|
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;
|
|
1308
|
+
return _23.set(path, entity, state);
|
|
1062
1309
|
};
|
|
1063
1310
|
var setEntitiesReducer = (state, payload) => {
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
)
|
|
1311
|
+
if (typeof payload !== "object") return state;
|
|
1312
|
+
const stateDrafts = {};
|
|
1313
|
+
Object.keys(payload).forEach((entityName) => {
|
|
1314
|
+
const entities2 = payload[entityName];
|
|
1315
|
+
const entityDraft = {};
|
|
1316
|
+
if (!entities2) {
|
|
1317
|
+
return;
|
|
1318
|
+
}
|
|
1319
|
+
Object.keys(entities2).forEach((id) => {
|
|
1320
|
+
const entity = entities2[id];
|
|
1321
|
+
if (!state[entityName]?.[id]) {
|
|
1322
|
+
entityDraft[id] = entity;
|
|
1323
|
+
} else {
|
|
1324
|
+
if (typeof entity === "undefined") {
|
|
1325
|
+
return;
|
|
1326
|
+
}
|
|
1327
|
+
const diff = Object.keys(entity).some((prop) => {
|
|
1328
|
+
const value = entity[prop];
|
|
1329
|
+
if (!_23.isEqual(state[entityName]?.[id]?.[prop], value)) {
|
|
1330
|
+
return true;
|
|
1331
|
+
}
|
|
1332
|
+
});
|
|
1333
|
+
if (diff) {
|
|
1334
|
+
entityDraft[id] = Object.assign({}, state[entityName]?.[id], entity);
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
});
|
|
1338
|
+
if (Object.keys(entityDraft).length !== 0) {
|
|
1339
|
+
stateDrafts[entityName] = { ...state[entityName], ...entityDraft };
|
|
1340
|
+
}
|
|
1070
1341
|
});
|
|
1342
|
+
if (Object.keys(stateDrafts).length !== 0) {
|
|
1343
|
+
return { ...state, ...stateDrafts };
|
|
1344
|
+
}
|
|
1345
|
+
return state;
|
|
1071
1346
|
};
|
|
1072
1347
|
var entities = makeReducer(
|
|
1073
1348
|
{},
|
|
@@ -1083,7 +1358,7 @@ var entities_default = entities;
|
|
|
1083
1358
|
// src/reducers/auth.ts
|
|
1084
1359
|
init_define_import_meta();
|
|
1085
1360
|
import { makeReducer as makeReducer2 } from "@lls/utils";
|
|
1086
|
-
import
|
|
1361
|
+
import _24 from "lodash/fp.js";
|
|
1087
1362
|
var initialState = {
|
|
1088
1363
|
id: void 0,
|
|
1089
1364
|
role: null,
|
|
@@ -1096,15 +1371,15 @@ var initialState = {
|
|
|
1096
1371
|
llsUserId: null
|
|
1097
1372
|
};
|
|
1098
1373
|
var auth = makeReducer2(initialState, {
|
|
1099
|
-
[actionTypes.SET_AUTH]:
|
|
1100
|
-
[actionTypes.RESET_AUTH]:
|
|
1374
|
+
[actionTypes.SET_AUTH]: _24.assign,
|
|
1375
|
+
[actionTypes.RESET_AUTH]: _24.constant(initialState)
|
|
1101
1376
|
});
|
|
1102
1377
|
var auth_default = auth;
|
|
1103
1378
|
|
|
1104
1379
|
// src/schema/index.ts
|
|
1105
1380
|
init_define_import_meta();
|
|
1106
1381
|
var import_normalizr = __toESM(require_normalizr(), 1);
|
|
1107
|
-
import
|
|
1382
|
+
import _25 from "lodash/fp.js";
|
|
1108
1383
|
var document = new import_normalizr.schema.Entity("documents", {}, { idAttribute: "resourceId" });
|
|
1109
1384
|
var subject = new import_normalizr.schema.Entity("subjects");
|
|
1110
1385
|
var level = new import_normalizr.schema.Entity("levels");
|
|
@@ -1120,6 +1395,7 @@ var faq = new import_normalizr.schema.Entity("faq");
|
|
|
1120
1395
|
var product = new import_normalizr.schema.Entity("products");
|
|
1121
1396
|
var communityProjects = new import_normalizr.schema.Entity("communityProjects");
|
|
1122
1397
|
var builderIo = new import_normalizr.schema.Entity("builderIos");
|
|
1398
|
+
var lexicalFlower = new import_normalizr.schema.Entity("lexicalFlowers");
|
|
1123
1399
|
var grammarRule = new import_normalizr.schema.Entity("grammarRules", {}, { idAttribute: "objectID" });
|
|
1124
1400
|
var mainNotification = new import_normalizr.schema.Entity("mainNotifications");
|
|
1125
1401
|
var explorerResult = new import_normalizr.schema.Entity("explorerResults", {}, { idAttribute: "resourceId" });
|
|
@@ -1199,7 +1475,8 @@ var userSchema = define(user, {
|
|
|
1199
1475
|
students: [student],
|
|
1200
1476
|
subjects: [subject],
|
|
1201
1477
|
teachers: [teacher],
|
|
1202
|
-
userPages: [page]
|
|
1478
|
+
userPages: [page],
|
|
1479
|
+
lexicalFlowers: { hits: [lexicalFlower] }
|
|
1203
1480
|
});
|
|
1204
1481
|
var notificationSchema = define(mainNotification, { page });
|
|
1205
1482
|
drawerNotification.define({ page });
|
|
@@ -1252,6 +1529,7 @@ var querySchema = {
|
|
|
1252
1529
|
createGroup: group,
|
|
1253
1530
|
createPage: page,
|
|
1254
1531
|
createUser: user,
|
|
1532
|
+
createLexicalFlower: lexicalFlower,
|
|
1255
1533
|
documents: { hits: [document] },
|
|
1256
1534
|
explorerResults: [explorerResult],
|
|
1257
1535
|
levels: [level],
|
|
@@ -1273,7 +1551,8 @@ var querySchema = {
|
|
|
1273
1551
|
updatePage: page,
|
|
1274
1552
|
updateTrialUser: user,
|
|
1275
1553
|
updateUserLastActivitySeenAt: user,
|
|
1276
|
-
updateUser: user
|
|
1554
|
+
updateUser: user,
|
|
1555
|
+
updateLexicalFlower: lexicalFlower
|
|
1277
1556
|
},
|
|
1278
1557
|
auth: {
|
|
1279
1558
|
user
|
|
@@ -1291,10 +1570,13 @@ var querySchema = {
|
|
|
1291
1570
|
}
|
|
1292
1571
|
}
|
|
1293
1572
|
};
|
|
1294
|
-
var normalizeData =
|
|
1573
|
+
var normalizeData = _25.flow((data) => (0, import_normalizr.normalize)(data, querySchema));
|
|
1295
1574
|
export {
|
|
1296
1575
|
auth_default as authReducer,
|
|
1297
1576
|
entities_default as entitiesReducer,
|
|
1577
|
+
filterPages,
|
|
1578
|
+
getAllNews,
|
|
1579
|
+
getAuth,
|
|
1298
1580
|
getBook,
|
|
1299
1581
|
getBooks,
|
|
1300
1582
|
getChapter,
|
|
@@ -1308,11 +1590,42 @@ export {
|
|
|
1308
1590
|
getCurrentUser,
|
|
1309
1591
|
getDraftPage,
|
|
1310
1592
|
getDraftPages,
|
|
1593
|
+
getFaqs,
|
|
1594
|
+
getGarDivision,
|
|
1595
|
+
getGarDivisions,
|
|
1596
|
+
getGroup,
|
|
1597
|
+
getGroups,
|
|
1598
|
+
getIsLogged,
|
|
1599
|
+
getLevel,
|
|
1600
|
+
getLevels,
|
|
1601
|
+
getLexicalFlowers,
|
|
1602
|
+
getMainNotifications,
|
|
1603
|
+
getNews,
|
|
1311
1604
|
getPage,
|
|
1312
1605
|
getPages,
|
|
1606
|
+
getPanorama,
|
|
1607
|
+
getPremiumResource,
|
|
1608
|
+
getPremiumResources,
|
|
1609
|
+
getProducts,
|
|
1610
|
+
getResource,
|
|
1611
|
+
getResources,
|
|
1313
1612
|
getSchool,
|
|
1613
|
+
getSchoolType,
|
|
1614
|
+
getSchoolTypes,
|
|
1314
1615
|
getSchools,
|
|
1616
|
+
getSharedPage,
|
|
1617
|
+
getSharedPages,
|
|
1618
|
+
getStudent,
|
|
1619
|
+
getStudents,
|
|
1620
|
+
getSubject,
|
|
1621
|
+
getSubjects,
|
|
1622
|
+
getTeacher,
|
|
1623
|
+
getTeachers,
|
|
1624
|
+
getToken,
|
|
1625
|
+
getTool,
|
|
1626
|
+
getTools,
|
|
1315
1627
|
getUser,
|
|
1628
|
+
getUserGroups,
|
|
1316
1629
|
getUsers,
|
|
1317
1630
|
makeGetBook,
|
|
1318
1631
|
makeGetDraftPage,
|
|
@@ -1323,9 +1636,22 @@ export {
|
|
|
1323
1636
|
makeSearchContacts,
|
|
1324
1637
|
makeSearchCopyNotifications,
|
|
1325
1638
|
makeSearchDraftPages,
|
|
1639
|
+
makeSearchDrawerNotifications,
|
|
1640
|
+
makeSearchGarDivisions,
|
|
1641
|
+
makeSearchGroups,
|
|
1642
|
+
makeSearchLevels,
|
|
1326
1643
|
makeSearchModifiedPages,
|
|
1644
|
+
makeSearchNews,
|
|
1327
1645
|
makeSearchPages,
|
|
1646
|
+
makeSearchPremiumResources,
|
|
1647
|
+
makeSearchResources,
|
|
1648
|
+
makeSearchSchoolTypes,
|
|
1328
1649
|
makeSearchSchools,
|
|
1650
|
+
makeSearchSharedPages,
|
|
1651
|
+
makeSearchStudents,
|
|
1652
|
+
makeSearchSubjects,
|
|
1653
|
+
makeSearchTeachers,
|
|
1654
|
+
makeSearchTools,
|
|
1329
1655
|
makeSearchUsers,
|
|
1330
1656
|
makeSearchValidBooks,
|
|
1331
1657
|
normalizeData,
|
|
@@ -1336,10 +1662,26 @@ export {
|
|
|
1336
1662
|
searchCommunityProjects,
|
|
1337
1663
|
searchContacts,
|
|
1338
1664
|
searchCopyNotifications,
|
|
1665
|
+
searchCurrentUserSharedPages,
|
|
1339
1666
|
searchDraftPages,
|
|
1667
|
+
searchDrawerNotifications,
|
|
1668
|
+
searchGarDivisions,
|
|
1669
|
+
searchGroups,
|
|
1670
|
+
searchLevels,
|
|
1671
|
+
searchLexicalFlowers,
|
|
1340
1672
|
searchModifiedPages,
|
|
1673
|
+
searchNews,
|
|
1341
1674
|
searchPages,
|
|
1675
|
+
searchPremiumResources,
|
|
1676
|
+
searchProducts,
|
|
1677
|
+
searchResources,
|
|
1678
|
+
searchSchoolTypes,
|
|
1342
1679
|
searchSchools,
|
|
1680
|
+
searchSharedPages,
|
|
1681
|
+
searchStudents,
|
|
1682
|
+
searchSubjects,
|
|
1683
|
+
searchTeachers,
|
|
1684
|
+
searchTools,
|
|
1343
1685
|
searchUsers,
|
|
1344
1686
|
searchValidBooks,
|
|
1345
1687
|
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-8b07e64c",
|
|
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-8b07e64c",
|
|
45
|
+
"@lls/vitescripts": "24.1.59-8b07e64c"
|
|
46
46
|
},
|
|
47
47
|
"license": "ISC",
|
|
48
48
|
"dependencies": {
|