@lls/store 24.1.59-a0007626 → 24.1.59-b0ab89de
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 +71 -413
- package/package.json +3 -3
package/lib/index.js
CHANGED
|
@@ -198,7 +198,7 @@ var require_lib = __commonJS({
|
|
|
198
198
|
for (var _len = arguments.length, memoizeOptionsFromArgs = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
199
199
|
memoizeOptionsFromArgs[_key - 1] = arguments[_key];
|
|
200
200
|
}
|
|
201
|
-
var
|
|
201
|
+
var createSelector3 = function createSelector4() {
|
|
202
202
|
for (var _len2 = arguments.length, funcs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
203
203
|
funcs[_key2] = arguments[_key2];
|
|
204
204
|
}
|
|
@@ -247,13 +247,13 @@ var require_lib = __commonJS({
|
|
|
247
247
|
});
|
|
248
248
|
return selector;
|
|
249
249
|
};
|
|
250
|
-
return
|
|
250
|
+
return createSelector3;
|
|
251
251
|
}
|
|
252
|
-
var
|
|
253
|
-
exports.createSelector =
|
|
252
|
+
var createSelector2 = /* @__PURE__ */ createSelectorCreator(_defaultMemoize.defaultMemoize);
|
|
253
|
+
exports.createSelector = createSelector2;
|
|
254
254
|
var createStructuredSelector = function createStructuredSelector2(selectors, selectorCreator) {
|
|
255
255
|
if (selectorCreator === void 0) {
|
|
256
|
-
selectorCreator =
|
|
256
|
+
selectorCreator = createSelector2;
|
|
257
257
|
}
|
|
258
258
|
if (typeof selectors !== "object") {
|
|
259
259
|
throw new Error("createStructuredSelector expects first argument to be an object " + ("where each property is a selector, instead received a " + typeof selectors));
|
|
@@ -733,27 +733,20 @@ 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
|
-
|
|
743
736
|
// src/selectors/school.ts
|
|
744
737
|
init_define_import_meta();
|
|
745
738
|
import { filterEntitiesSimpleFieldByValues } from "@lls/utils";
|
|
746
|
-
import
|
|
739
|
+
import _ from "lodash/fp.js";
|
|
747
740
|
|
|
748
741
|
// src/selectors/crud.ts
|
|
749
742
|
init_define_import_meta();
|
|
750
743
|
import { createSearchSelector, makeGetAllEntities, makeGetEntityById } from "@lls/utils";
|
|
751
|
-
var crud = (entityName, { search:
|
|
744
|
+
var crud = (entityName, { search: search9 }) => {
|
|
752
745
|
const getElements = makeGetAllEntities(entityName);
|
|
753
746
|
const makeSearchElements = () => createSearchSelector(
|
|
754
747
|
getElements,
|
|
755
748
|
(_state, params) => params,
|
|
756
|
-
(elements, params) =>
|
|
749
|
+
(elements, params) => search9(params)(elements)
|
|
757
750
|
);
|
|
758
751
|
const methodName = `${entityName.charAt(0).toUpperCase()}${entityName.slice(1)}`;
|
|
759
752
|
const getElementById = makeGetEntityById(entityName);
|
|
@@ -761,14 +754,13 @@ var crud = (entityName, { search: search24 }) => {
|
|
|
761
754
|
[`get${methodName}`]: getElements,
|
|
762
755
|
[`search${methodName}`]: makeSearchElements(),
|
|
763
756
|
[`get${methodName.replace(/s$/, "")}`]: getElementById,
|
|
764
|
-
[`makeSearch${methodName}`]: makeSearchElements
|
|
765
|
-
[`filter${methodName}`]: search24
|
|
757
|
+
[`makeSearch${methodName}`]: makeSearchElements
|
|
766
758
|
};
|
|
767
759
|
return back;
|
|
768
760
|
};
|
|
769
761
|
|
|
770
762
|
// src/selectors/school.ts
|
|
771
|
-
var search = ({ ids }) =>
|
|
763
|
+
var search = ({ ids }) => _.flow(filterEntitiesSimpleFieldByValues("id", ids));
|
|
772
764
|
var { getSchools, getSchool, searchSchools, makeSearchSchools } = crud("schools", {
|
|
773
765
|
search
|
|
774
766
|
});
|
|
@@ -782,7 +774,7 @@ import {
|
|
|
782
774
|
filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues2,
|
|
783
775
|
makeGetEntityById as makeGetEntityById2
|
|
784
776
|
} from "@lls/utils";
|
|
785
|
-
import
|
|
777
|
+
import _2 from "lodash/fp.js";
|
|
786
778
|
var search2 = ({
|
|
787
779
|
ids,
|
|
788
780
|
levelIds,
|
|
@@ -799,27 +791,27 @@ var search2 = ({
|
|
|
799
791
|
publishers,
|
|
800
792
|
isRenewed,
|
|
801
793
|
isPrimary
|
|
802
|
-
}) =>
|
|
794
|
+
}) => _2.flow(
|
|
803
795
|
filterEntitiesSimpleFieldByValues2("id", ids),
|
|
804
796
|
filterEntitiesSimpleFieldByValues2("year", years),
|
|
805
797
|
filterEntitiesArrayFieldByValues("levels", levelIds),
|
|
806
798
|
filterEntitiesArrayFieldByValues("subjects", subjectIds),
|
|
807
|
-
filterEntitiesSimpleFieldByValues2("valid",
|
|
799
|
+
filterEntitiesSimpleFieldByValues2("valid", _2.isNil(isValid) ? void 0 : [isValid]),
|
|
808
800
|
filterEntitiesSimpleFieldByValues2("publisher", publishers),
|
|
809
|
-
filterEntitiesSimpleFieldByValues2("hasNewDesign",
|
|
810
|
-
filterEntitiesSimpleFieldByValues2("isWorkbook",
|
|
811
|
-
filterEntitiesSimpleFieldByValues2("isWorkplan",
|
|
812
|
-
filterEntitiesSimpleFieldByValues2("hasNoTeacherBook",
|
|
801
|
+
filterEntitiesSimpleFieldByValues2("hasNewDesign", _2.isNil(hasNewDesign) ? void 0 : [hasNewDesign]),
|
|
802
|
+
filterEntitiesSimpleFieldByValues2("isWorkbook", _2.isNil(isWorkbook) ? void 0 : [isWorkbook]),
|
|
803
|
+
filterEntitiesSimpleFieldByValues2("isWorkplan", _2.isNil(isWorkplan) ? void 0 : [isWorkplan]),
|
|
804
|
+
filterEntitiesSimpleFieldByValues2("hasNoTeacherBook", _2.isNil(hasNoTeacherBook) ? void 0 : [hasNoTeacherBook]),
|
|
813
805
|
filterEntitiesSimpleFieldByValues2("slug", slugs),
|
|
814
806
|
filterEntitiesSimpleFieldByValues2("uri", uris),
|
|
815
|
-
filterEntitiesSimpleFieldByValues2("isRenewed",
|
|
807
|
+
filterEntitiesSimpleFieldByValues2("isRenewed", _2.isNil(isRenewed) ? void 0 : [isRenewed]),
|
|
816
808
|
filterEntitiesSimpleFieldByValue("isPrimary", isPrimary),
|
|
817
|
-
|
|
809
|
+
_2.isFunction(sortByQuery) ? sortByQuery : sortByQuery ? _2.sortBy(sortByQuery) : _2.identity
|
|
818
810
|
);
|
|
819
811
|
var { getBooks, getBook, searchBooks, makeSearchBooks } = crud("books", {
|
|
820
812
|
search: search2
|
|
821
813
|
});
|
|
822
|
-
var makeSearchValidBooks = () => createSearchSelector2(makeSearchBooks(), (books) =>
|
|
814
|
+
var makeSearchValidBooks = () => createSearchSelector2(makeSearchBooks(), (books) => _2.filter({ valid: true, hasNewDesign: true }, books));
|
|
823
815
|
var searchValidBooks = makeSearchValidBooks();
|
|
824
816
|
var makeGetBook = () => makeGetEntityById2("books");
|
|
825
817
|
|
|
@@ -828,6 +820,15 @@ init_define_import_meta();
|
|
|
828
820
|
var import_reselect = __toESM(require_lib(), 1);
|
|
829
821
|
import { filterEntitiesArrayFieldByValues as filterEntitiesArrayFieldByValues2, filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues3 } from "@lls/utils";
|
|
830
822
|
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
|
|
831
832
|
var search3 = ({ ids, schoolIds }) => _4.flow(filterEntitiesArrayFieldByValues2("schools", schoolIds), filterEntitiesSimpleFieldByValues3("id", ids));
|
|
832
833
|
var { getUsers, getUser, searchUsers, makeSearchUsers } = crud("users", {
|
|
833
834
|
search: search3
|
|
@@ -894,7 +895,7 @@ var search5 = ({
|
|
|
894
895
|
filterEntitiesSimpleFieldByValues5("thematicName", thematicNames),
|
|
895
896
|
filterEntitiesSimpleFieldByValues5("book", bookIds)
|
|
896
897
|
);
|
|
897
|
-
var { getPages, getPage, searchPages, makeSearchPages
|
|
898
|
+
var { getPages, getPage, searchPages, makeSearchPages } = crud("pages", {
|
|
898
899
|
search: search5
|
|
899
900
|
});
|
|
900
901
|
var getDraftPages = makeGetAllEntities2("drafts");
|
|
@@ -988,7 +989,7 @@ import { createSearchSelector as createSearchSelector4, filterEntitiesSimpleFiel
|
|
|
988
989
|
import _10 from "lodash/fp.js";
|
|
989
990
|
var getCopyNotifications = makeGetAllEntities3("copyNotifications");
|
|
990
991
|
var makeSearchCopyNotifications = () => createSearchSelector4(
|
|
991
|
-
[getCurrentUser, getCopyNotifications, (
|
|
992
|
+
[getCurrentUser, getCopyNotifications, (_14, params) => params],
|
|
992
993
|
(currentUser, copyNotifications, { pageIds, read }) => _10.flow(
|
|
993
994
|
_10.get("copyNotifications"),
|
|
994
995
|
(ids) => _10.flow(
|
|
@@ -1000,280 +1001,10 @@ var makeSearchCopyNotifications = () => createSearchSelector4(
|
|
|
1000
1001
|
);
|
|
1001
1002
|
var searchCopyNotifications = makeSearchCopyNotifications();
|
|
1002
1003
|
|
|
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
|
-
|
|
1273
1004
|
// src/reducers/entities.ts
|
|
1274
1005
|
init_define_import_meta();
|
|
1275
1006
|
import { makeReducer } from "@lls/utils";
|
|
1276
|
-
import
|
|
1007
|
+
import _11 from "lodash/fp.js";
|
|
1277
1008
|
|
|
1278
1009
|
// src/actions/index.ts
|
|
1279
1010
|
init_define_import_meta();
|
|
@@ -1296,53 +1027,47 @@ var resetAuth = makeActionCreator(actionTypes.RESET_AUTH);
|
|
|
1296
1027
|
// src/reducers/entities.ts
|
|
1297
1028
|
var deleteEntityReducer = (state, payload) => {
|
|
1298
1029
|
const { path } = payload;
|
|
1299
|
-
return
|
|
1030
|
+
return _11.omit(path, state);
|
|
1300
1031
|
};
|
|
1301
1032
|
var updateEntityReducer = (state, payload) => {
|
|
1302
1033
|
const { path, entity } = payload;
|
|
1303
|
-
const currentEntity =
|
|
1304
|
-
return
|
|
1034
|
+
const currentEntity = _11.get(path, state);
|
|
1035
|
+
return _11.set(path, _11.merge(currentEntity, entity), state);
|
|
1305
1036
|
};
|
|
1306
1037
|
var setEntityReducer = (state, payload) => {
|
|
1307
1038
|
const { path, entity } = payload;
|
|
1308
|
-
return
|
|
1039
|
+
return _11.set(path, entity, state);
|
|
1309
1040
|
};
|
|
1310
|
-
var
|
|
1311
|
-
|
|
1312
|
-
const
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
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
|
-
}
|
|
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;
|
|
1336
1051
|
}
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
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;
|
|
1062
|
+
};
|
|
1063
|
+
var setEntitiesReducer = (state, payload) => {
|
|
1064
|
+
return shallowAssign(state, payload, (entityKind, nextEntityKind) => {
|
|
1065
|
+
return shallowAssign(
|
|
1066
|
+
entityKind,
|
|
1067
|
+
nextEntityKind,
|
|
1068
|
+
(oldEntity, nextEntity) => _11.isEqual(oldEntity, nextEntity) ? oldEntity : _11.assign(oldEntity, nextEntity)
|
|
1069
|
+
);
|
|
1341
1070
|
});
|
|
1342
|
-
if (Object.keys(stateDrafts).length !== 0) {
|
|
1343
|
-
return { ...state, ...stateDrafts };
|
|
1344
|
-
}
|
|
1345
|
-
return state;
|
|
1346
1071
|
};
|
|
1347
1072
|
var entities = makeReducer(
|
|
1348
1073
|
{},
|
|
@@ -1358,7 +1083,7 @@ var entities_default = entities;
|
|
|
1358
1083
|
// src/reducers/auth.ts
|
|
1359
1084
|
init_define_import_meta();
|
|
1360
1085
|
import { makeReducer as makeReducer2 } from "@lls/utils";
|
|
1361
|
-
import
|
|
1086
|
+
import _12 from "lodash/fp.js";
|
|
1362
1087
|
var initialState = {
|
|
1363
1088
|
id: void 0,
|
|
1364
1089
|
role: null,
|
|
@@ -1371,15 +1096,15 @@ var initialState = {
|
|
|
1371
1096
|
llsUserId: null
|
|
1372
1097
|
};
|
|
1373
1098
|
var auth = makeReducer2(initialState, {
|
|
1374
|
-
[actionTypes.SET_AUTH]:
|
|
1375
|
-
[actionTypes.RESET_AUTH]:
|
|
1099
|
+
[actionTypes.SET_AUTH]: _12.assign,
|
|
1100
|
+
[actionTypes.RESET_AUTH]: _12.constant(initialState)
|
|
1376
1101
|
});
|
|
1377
1102
|
var auth_default = auth;
|
|
1378
1103
|
|
|
1379
1104
|
// src/schema/index.ts
|
|
1380
1105
|
init_define_import_meta();
|
|
1381
1106
|
var import_normalizr = __toESM(require_normalizr(), 1);
|
|
1382
|
-
import
|
|
1107
|
+
import _13 from "lodash/fp.js";
|
|
1383
1108
|
var document = new import_normalizr.schema.Entity("documents", {}, { idAttribute: "resourceId" });
|
|
1384
1109
|
var subject = new import_normalizr.schema.Entity("subjects");
|
|
1385
1110
|
var level = new import_normalizr.schema.Entity("levels");
|
|
@@ -1395,7 +1120,6 @@ var faq = new import_normalizr.schema.Entity("faq");
|
|
|
1395
1120
|
var product = new import_normalizr.schema.Entity("products");
|
|
1396
1121
|
var communityProjects = new import_normalizr.schema.Entity("communityProjects");
|
|
1397
1122
|
var builderIo = new import_normalizr.schema.Entity("builderIos");
|
|
1398
|
-
var lexicalFlower = new import_normalizr.schema.Entity("lexicalFlowers");
|
|
1399
1123
|
var grammarRule = new import_normalizr.schema.Entity("grammarRules", {}, { idAttribute: "objectID" });
|
|
1400
1124
|
var mainNotification = new import_normalizr.schema.Entity("mainNotifications");
|
|
1401
1125
|
var explorerResult = new import_normalizr.schema.Entity("explorerResults", {}, { idAttribute: "resourceId" });
|
|
@@ -1475,8 +1199,7 @@ var userSchema = define(user, {
|
|
|
1475
1199
|
students: [student],
|
|
1476
1200
|
subjects: [subject],
|
|
1477
1201
|
teachers: [teacher],
|
|
1478
|
-
userPages: [page]
|
|
1479
|
-
lexicalFlowers: { hits: [lexicalFlower] }
|
|
1202
|
+
userPages: [page]
|
|
1480
1203
|
});
|
|
1481
1204
|
var notificationSchema = define(mainNotification, { page });
|
|
1482
1205
|
drawerNotification.define({ page });
|
|
@@ -1529,7 +1252,6 @@ var querySchema = {
|
|
|
1529
1252
|
createGroup: group,
|
|
1530
1253
|
createPage: page,
|
|
1531
1254
|
createUser: user,
|
|
1532
|
-
createLexicalFlower: lexicalFlower,
|
|
1533
1255
|
documents: { hits: [document] },
|
|
1534
1256
|
explorerResults: [explorerResult],
|
|
1535
1257
|
levels: [level],
|
|
@@ -1551,8 +1273,7 @@ var querySchema = {
|
|
|
1551
1273
|
updatePage: page,
|
|
1552
1274
|
updateTrialUser: user,
|
|
1553
1275
|
updateUserLastActivitySeenAt: user,
|
|
1554
|
-
updateUser: user
|
|
1555
|
-
updateLexicalFlower: lexicalFlower
|
|
1276
|
+
updateUser: user
|
|
1556
1277
|
},
|
|
1557
1278
|
auth: {
|
|
1558
1279
|
user
|
|
@@ -1570,13 +1291,10 @@ var querySchema = {
|
|
|
1570
1291
|
}
|
|
1571
1292
|
}
|
|
1572
1293
|
};
|
|
1573
|
-
var normalizeData =
|
|
1294
|
+
var normalizeData = _13.flow((data) => (0, import_normalizr.normalize)(data, querySchema));
|
|
1574
1295
|
export {
|
|
1575
1296
|
auth_default as authReducer,
|
|
1576
1297
|
entities_default as entitiesReducer,
|
|
1577
|
-
filterPages,
|
|
1578
|
-
getAllNews,
|
|
1579
|
-
getAuth,
|
|
1580
1298
|
getBook,
|
|
1581
1299
|
getBooks,
|
|
1582
1300
|
getChapter,
|
|
@@ -1590,42 +1308,11 @@ export {
|
|
|
1590
1308
|
getCurrentUser,
|
|
1591
1309
|
getDraftPage,
|
|
1592
1310
|
getDraftPages,
|
|
1593
|
-
getFaqs,
|
|
1594
|
-
getGarDivision,
|
|
1595
|
-
getGarDivisions,
|
|
1596
|
-
getGroup,
|
|
1597
|
-
getGroups,
|
|
1598
|
-
getIsLogged,
|
|
1599
|
-
getLevel,
|
|
1600
|
-
getLevels,
|
|
1601
|
-
getLexicalFlowers,
|
|
1602
|
-
getMainNotifications,
|
|
1603
|
-
getNews,
|
|
1604
1311
|
getPage,
|
|
1605
1312
|
getPages,
|
|
1606
|
-
getPanorama,
|
|
1607
|
-
getPremiumResource,
|
|
1608
|
-
getPremiumResources,
|
|
1609
|
-
getProducts,
|
|
1610
|
-
getResource,
|
|
1611
|
-
getResources,
|
|
1612
1313
|
getSchool,
|
|
1613
|
-
getSchoolType,
|
|
1614
|
-
getSchoolTypes,
|
|
1615
1314
|
getSchools,
|
|
1616
|
-
getSharedPage,
|
|
1617
|
-
getSharedPages,
|
|
1618
|
-
getStudent,
|
|
1619
|
-
getStudents,
|
|
1620
|
-
getSubject,
|
|
1621
|
-
getSubjects,
|
|
1622
|
-
getTeacher,
|
|
1623
|
-
getTeachers,
|
|
1624
|
-
getToken,
|
|
1625
|
-
getTool,
|
|
1626
|
-
getTools,
|
|
1627
1315
|
getUser,
|
|
1628
|
-
getUserGroups,
|
|
1629
1316
|
getUsers,
|
|
1630
1317
|
makeGetBook,
|
|
1631
1318
|
makeGetDraftPage,
|
|
@@ -1636,22 +1323,9 @@ export {
|
|
|
1636
1323
|
makeSearchContacts,
|
|
1637
1324
|
makeSearchCopyNotifications,
|
|
1638
1325
|
makeSearchDraftPages,
|
|
1639
|
-
makeSearchDrawerNotifications,
|
|
1640
|
-
makeSearchGarDivisions,
|
|
1641
|
-
makeSearchGroups,
|
|
1642
|
-
makeSearchLevels,
|
|
1643
1326
|
makeSearchModifiedPages,
|
|
1644
|
-
makeSearchNews,
|
|
1645
1327
|
makeSearchPages,
|
|
1646
|
-
makeSearchPremiumResources,
|
|
1647
|
-
makeSearchResources,
|
|
1648
|
-
makeSearchSchoolTypes,
|
|
1649
1328
|
makeSearchSchools,
|
|
1650
|
-
makeSearchSharedPages,
|
|
1651
|
-
makeSearchStudents,
|
|
1652
|
-
makeSearchSubjects,
|
|
1653
|
-
makeSearchTeachers,
|
|
1654
|
-
makeSearchTools,
|
|
1655
1329
|
makeSearchUsers,
|
|
1656
1330
|
makeSearchValidBooks,
|
|
1657
1331
|
normalizeData,
|
|
@@ -1662,26 +1336,10 @@ export {
|
|
|
1662
1336
|
searchCommunityProjects,
|
|
1663
1337
|
searchContacts,
|
|
1664
1338
|
searchCopyNotifications,
|
|
1665
|
-
searchCurrentUserSharedPages,
|
|
1666
1339
|
searchDraftPages,
|
|
1667
|
-
searchDrawerNotifications,
|
|
1668
|
-
searchGarDivisions,
|
|
1669
|
-
searchGroups,
|
|
1670
|
-
searchLevels,
|
|
1671
|
-
searchLexicalFlowers,
|
|
1672
1340
|
searchModifiedPages,
|
|
1673
|
-
searchNews,
|
|
1674
1341
|
searchPages,
|
|
1675
|
-
searchPremiumResources,
|
|
1676
|
-
searchProducts,
|
|
1677
|
-
searchResources,
|
|
1678
|
-
searchSchoolTypes,
|
|
1679
1342
|
searchSchools,
|
|
1680
|
-
searchSharedPages,
|
|
1681
|
-
searchStudents,
|
|
1682
|
-
searchSubjects,
|
|
1683
|
-
searchTeachers,
|
|
1684
|
-
searchTools,
|
|
1685
1343
|
searchUsers,
|
|
1686
1344
|
searchValidBooks,
|
|
1687
1345
|
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-b0ab89de",
|
|
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-b0ab89de",
|
|
45
|
+
"@lls/vitescripts": "24.1.59-b0ab89de"
|
|
46
46
|
},
|
|
47
47
|
"license": "ISC",
|
|
48
48
|
"dependencies": {
|