@lls/store 24.1.58-c0096e77 → 24.1.59-059267c8

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.
Files changed (2) hide show
  1. package/lib/index.js +632 -67
  2. package/package.json +11 -11
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 createSelector3 = function createSelector4() {
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 createSelector3;
250
+ return createSelector6;
251
251
  }
252
- var createSelector2 = /* @__PURE__ */ createSelectorCreator(_defaultMemoize.defaultMemoize);
253
- exports.createSelector = createSelector2;
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 = createSelector2;
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,56 +733,104 @@ 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
- import { filterEntitiesSimpleFieldByValues } from "@lls/utils";
739
- import _2 from "lodash/fp.js";
745
+ import { makeEntitiesFilter } from "@lls/utils";
740
746
 
741
747
  // src/selectors/crud.ts
742
748
  init_define_import_meta();
743
749
  import { createSearchSelector, makeGetAllEntities, makeGetEntityById } from "@lls/utils";
744
- import _ from "lodash/fp.js";
745
- var crud = (entityName, { search: search3 }) => {
750
+ var crud = (entityName, { search: search24 }) => {
746
751
  const getElements = makeGetAllEntities(entityName);
747
752
  const makeSearchElements = () => createSearchSelector(
748
753
  getElements,
749
754
  (_state, params) => params,
750
- (elements, params) => search3(params)(elements)
755
+ (elements, params) => search24(params)(elements)
751
756
  );
752
- const methodName = _.capitalize(entityName);
757
+ const methodName = `${entityName.charAt(0).toUpperCase()}${entityName.slice(1)}`;
753
758
  const getElementById = makeGetEntityById(entityName);
754
759
  const back = {
755
760
  [`get${methodName}`]: getElements,
756
761
  [`search${methodName}`]: makeSearchElements(),
757
762
  [`get${methodName.replace(/s$/, "")}`]: getElementById,
758
- [`makeSearch${methodName}`]: makeSearchElements
763
+ [`makeSearch${methodName}`]: makeSearchElements,
764
+ [`filter${methodName}`]: search24
759
765
  };
760
766
  return back;
761
767
  };
762
768
 
763
769
  // src/selectors/school.ts
764
- var search = ({ ids }) => _2.flow(filterEntitiesSimpleFieldByValues("id", ids));
770
+ var search = ({ ids }) => makeEntitiesFilter({ id: ids });
765
771
  var { getSchools, getSchool, searchSchools, makeSearchSchools } = crud("schools", {
766
772
  search
767
773
  });
768
774
 
769
- // src/selectors/user.ts
770
- init_define_import_meta();
771
- var import_reselect = __toESM(require_lib(), 1);
772
- import { filterEntitiesArrayFieldByValues, filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues2 } from "@lls/utils";
773
- import _4 from "lodash/fp.js";
774
-
775
- // src/selectors/auth.ts
775
+ // src/selectors/book.ts
776
776
  init_define_import_meta();
777
- import _3 from "lodash/fp.js";
778
- var getAuth = _3.get("auth");
779
- var getIsLogged = _3.flow(_3.get("auth.id"), _3.negate(_3.isNil));
780
- var getToken = _3.get("auth.token");
777
+ import { createSearchSelector as createSearchSelector2, makeEntitiesFilter as makeEntitiesFilter2, makeGetEntityById as makeGetEntityById2, pipe } from "@lls/utils";
778
+ import _2 from "lodash/fp.js";
779
+ var search2 = ({
780
+ ids,
781
+ levelIds,
782
+ subjectIds,
783
+ years,
784
+ isValid,
785
+ isWorkbook,
786
+ isWorkplan,
787
+ hasNoTeacherBook,
788
+ sortByQuery,
789
+ hasNewDesign,
790
+ slugs,
791
+ uris,
792
+ publishers,
793
+ isRenewed,
794
+ isPrimary
795
+ }) => {
796
+ return (books) => pipe(
797
+ books,
798
+ makeEntitiesFilter2({
799
+ id: ids,
800
+ year: years,
801
+ levels: levelIds,
802
+ subjects: subjectIds,
803
+ valid: isValid,
804
+ publishers,
805
+ hasNewDesign,
806
+ isWorkbook,
807
+ isWorkplan,
808
+ hasNoTeacherBook,
809
+ slug: slugs,
810
+ uri: uris,
811
+ isRenewed,
812
+ isPrimary
813
+ }),
814
+ _2.isFunction(sortByQuery) ? sortByQuery : sortByQuery ? _2.sortBy(sortByQuery) : _2.identity
815
+ );
816
+ };
817
+ var { getBooks, getBook, searchBooks, makeSearchBooks } = crud("books", {
818
+ search: search2
819
+ });
820
+ var makeSearchValidBooks = () => createSearchSelector2(makeSearchBooks(), (books) => _2.filter({ valid: true, hasNewDesign: true }, books));
821
+ var searchValidBooks = makeSearchValidBooks();
822
+ var makeGetBook = () => makeGetEntityById2("books");
781
823
 
782
824
  // src/selectors/user.ts
783
- var search2 = ({ ids, schoolIds }) => _4.flow(filterEntitiesArrayFieldByValues("schools", schoolIds), filterEntitiesSimpleFieldByValues2("id", ids));
825
+ init_define_import_meta();
826
+ var import_reselect = __toESM(require_lib(), 1);
827
+ import { makeEntitiesFilter as makeEntitiesFilter3 } from "@lls/utils";
828
+ var search3 = ({ ids, schoolIds }) => makeEntitiesFilter3({
829
+ schools: schoolIds,
830
+ id: ids
831
+ });
784
832
  var { getUsers, getUser, searchUsers, makeSearchUsers } = crud("users", {
785
- search: search2
833
+ search: search3
786
834
  });
787
835
  var getCurrentUser = (0, import_reselect.createSelector)(
788
836
  getAuth,
@@ -790,10 +838,416 @@ var getCurrentUser = (0, import_reselect.createSelector)(
790
838
  (auth2, users) => users?.find((user2) => user2?.id === auth2?.id)
791
839
  );
792
840
 
841
+ // src/selectors/chapter.ts
842
+ init_define_import_meta();
843
+ import { makeEntitiesFilter as makeEntitiesFilter4 } from "@lls/utils";
844
+ import _3 from "lodash/fp.js";
845
+ var search4 = ({ bookIds, ids, hasTeacherBook }) => makeEntitiesFilter4(
846
+ {
847
+ book: bookIds,
848
+ id: ids
849
+ },
850
+ !_3.isNil(hasTeacherBook) && ((chapter2) => !!chapter2?.teacherBook === hasTeacherBook)
851
+ );
852
+ var { getChapters, getChapter, searchChapters, makeSearchChapters } = crud("chapters", {
853
+ search: search4
854
+ });
855
+
856
+ // src/selectors/page.ts
857
+ init_define_import_meta();
858
+ import { createSearchSelector as createSearchSelector3, makeEntitiesFilter as makeEntitiesFilter5, makeGetAllEntities as makeGetAllEntities2, makeGetEntityById as makeGetEntityById3 } from "@lls/utils";
859
+ import _4 from "lodash/fp.js";
860
+ var search5 = ({
861
+ ids,
862
+ chapterIds,
863
+ isValid,
864
+ oldLessonIds,
865
+ premium,
866
+ thematicNames,
867
+ bookIds,
868
+ isOriginal,
869
+ hasNewDesign,
870
+ slugs,
871
+ isLearningAssessment,
872
+ isCreatedFromScratch,
873
+ userIds,
874
+ parentIds,
875
+ originalPageIds,
876
+ sharedUserIds,
877
+ sharedGroups,
878
+ isDraft,
879
+ isParentCreatedFromScratch,
880
+ updatedAfter
881
+ }) => {
882
+ let pageById = false;
883
+ return makeEntitiesFilter5(
884
+ {
885
+ id: ids,
886
+ chapter: chapterIds,
887
+ valid: isValid,
888
+ isOriginal,
889
+ hasNewDesign,
890
+ slug: slugs,
891
+ oldLesson: oldLessonIds,
892
+ isLearningAssessment,
893
+ isCreatedFromScratch,
894
+ premium,
895
+ thematicName: thematicNames,
896
+ book: bookIds,
897
+ parent: parentIds,
898
+ user: userIds,
899
+ originalPage: originalPageIds,
900
+ sharedUsers: sharedUserIds,
901
+ sharedGroups,
902
+ isDraft
903
+ },
904
+ isParentCreatedFromScratch && ((page2, pages) => {
905
+ pageById = pageById || _4.keyBy("id", pages);
906
+ return !!_4.get([page2?.originalPage, "isCreatedFromScratch"], pageById);
907
+ }),
908
+ updatedAfter && _4.flow(_4.get("updatedAt"), (date) => new Date(date) - updatedAfter >= 0)
909
+ );
910
+ };
911
+ var { getPages, getPage, searchPages, makeSearchPages, filterPages } = crud("pages", {
912
+ search: search5
913
+ });
914
+ var getDraftPages = makeGetAllEntities2("drafts");
915
+ var makeGetDraftPage = () => makeGetEntityById3("drafts");
916
+ var getDraftPage = makeGetDraftPage();
917
+ var makeSearchDraftPages = () => createSearchSelector3(
918
+ getDraftPages,
919
+ (_state, params) => params,
920
+ (pages, params) => search5(params)(pages)
921
+ );
922
+ var searchDraftPages = makeSearchDraftPages();
923
+ var makeSearchModifiedPages = () => createSearchSelector3(
924
+ getPages,
925
+ (_state, params) => params,
926
+ (pages, params) => search5({ ...params, isOriginal: false })(pages)
927
+ );
928
+ var searchModifiedPages = makeSearchModifiedPages();
929
+
930
+ // src/selectors/collection.ts
931
+ init_define_import_meta();
932
+ import _5 from "lodash/fp.js";
933
+ var search6 = (_params) => _5.identity;
934
+ var { getCollections, getCollection, searchCollections, makeSearchCollections } = crud("collections", {
935
+ search: search6
936
+ });
937
+
938
+ // src/selectors/communityProject.ts
939
+ init_define_import_meta();
940
+ import { makeEntitiesFilter as makeEntitiesFilter6 } from "@lls/utils";
941
+ var search7 = ({
942
+ slugs,
943
+ isFeatured,
944
+ projectTypes
945
+ }) => makeEntitiesFilter6({
946
+ slug: slugs,
947
+ isFeatured,
948
+ projectTypes
949
+ });
950
+ var { getCommunityProjects, getCommunityProject, searchCommunityProjects, makeSearchCommunityProjects } = crud(
951
+ "communityProjects",
952
+ {
953
+ search: search7
954
+ }
955
+ );
956
+
957
+ // src/selectors/contact.ts
958
+ init_define_import_meta();
959
+ import _6 from "lodash/fp.js";
960
+ var search8 = (_params) => _6.identity;
961
+ var { getContacts, getContact, searchContacts, makeSearchContacts } = crud("contacts", {
962
+ search: search8
963
+ });
964
+
965
+ // src/selectors/copyNotification.ts
966
+ init_define_import_meta();
967
+ import { createSearchSelector as createSearchSelector4, makeEntitiesFilter as makeEntitiesFilter7, makeGetAllEntities as makeGetAllEntities3 } from "@lls/utils";
968
+ var getCopyNotifications = makeGetAllEntities3("copyNotifications");
969
+ var makeSearchCopyNotifications = () => createSearchSelector4(
970
+ [getCurrentUser, getCopyNotifications, (_17, params) => params],
971
+ (currentUser, copyNotifications, { pageIds, read }) => {
972
+ const ids = currentUser?.copyNotifications;
973
+ return makeEntitiesFilter7({ id: ids, read, page: pageIds })(copyNotifications);
974
+ }
975
+ );
976
+ var searchCopyNotifications = makeSearchCopyNotifications();
977
+
978
+ // src/selectors/drawerNotification.ts
979
+ init_define_import_meta();
980
+ import { createSearchSelector as createSearchSelector5, makeEntitiesFilter as makeEntitiesFilter8, makeGetAllEntities as makeGetAllEntities4 } from "@lls/utils";
981
+ var getDrawerNotifications = makeGetAllEntities4("drawerNotifications");
982
+ var makeSearchDrawerNotifications = () => createSearchSelector5(
983
+ [getCurrentUser, getDrawerNotifications, (_17, params) => params],
984
+ (currentUser, drawerNotifications, { read, pageIds }) => {
985
+ const ids = currentUser?.drawerNotifications;
986
+ return makeEntitiesFilter8({ id: ids, read, page: pageIds })(drawerNotifications);
987
+ }
988
+ );
989
+ var searchDrawerNotifications = makeSearchDrawerNotifications();
990
+
991
+ // src/selectors/faq.ts
992
+ init_define_import_meta();
993
+ import { makeGetAllEntities as makeGetAllEntities5 } from "@lls/utils";
994
+ var getFaqs = makeGetAllEntities5("faq");
995
+
996
+ // src/selectors/garDivision.ts
997
+ init_define_import_meta();
998
+ import _7 from "lodash/fp.js";
999
+ var search9 = (_params) => _7.identity;
1000
+ var { getGarDivisions, getGarDivision, searchGarDivisions, makeSearchGarDivisions } = crud("garDivisions", {
1001
+ search: search9
1002
+ });
1003
+
1004
+ // src/selectors/group.ts
1005
+ init_define_import_meta();
1006
+ var import_reselect2 = __toESM(require_lib(), 1);
1007
+ import { makeEntitiesFilter as makeEntitiesFilter9 } from "@lls/utils";
1008
+ import _8 from "lodash/fp.js";
1009
+ var search10 = ({ ownerIds }) => _8.flow(makeEntitiesFilter9({ owner: ownerIds }), _8.orderBy("createdAt", ["desc"]));
1010
+ var { getGroups, getGroup, searchGroups, makeSearchGroups } = crud("groups", {
1011
+ search: search10
1012
+ });
1013
+ var getUserGroups = (0, import_reselect2.createSelector)(
1014
+ [getGroups, getCurrentUser],
1015
+ (groups, currentUser) => search10({ ownerIds: [currentUser?.id] })(groups)
1016
+ );
1017
+
1018
+ // src/selectors/level.ts
1019
+ init_define_import_meta();
1020
+ var import_reselect3 = __toESM(require_lib(), 1);
1021
+ import { makeEntitiesFilter as makeEntitiesFilter10 } from "@lls/utils";
1022
+ import _9 from "lodash/fp.js";
1023
+ var search11 = ({
1024
+ ids,
1025
+ slugs,
1026
+ isPreSchool,
1027
+ isMiddleSchool,
1028
+ isHighSchool,
1029
+ isProHighSchool,
1030
+ isGenHighSchool,
1031
+ isElementarySchool
1032
+ }) => _9.flow(
1033
+ makeEntitiesFilter10({
1034
+ id: ids,
1035
+ slug: slugs,
1036
+ isPreSchool,
1037
+ isMiddleSchool,
1038
+ isHighSchool,
1039
+ isProHighSchool,
1040
+ isGenHighSchool,
1041
+ isElementarySchool
1042
+ }),
1043
+ _9.orderBy("order", "desc")
1044
+ );
1045
+ var crudLevels = crud("levels", { search: search11 });
1046
+ var { getLevel, searchLevels, makeSearchLevels } = crudLevels;
1047
+ var getLevels = (0, import_reselect3.createSelector)(crudLevels.getLevels, _9.orderBy("order", "desc"));
1048
+
1049
+ // src/selectors/mainNotification.ts
1050
+ init_define_import_meta();
1051
+ var import_reselect4 = __toESM(require_lib(), 1);
1052
+ import { makeEntitiesFilter as makeEntitiesFilter11, makeGetAllEntities as makeGetAllEntities6 } from "@lls/utils";
1053
+ import _10 from "lodash/fp.js";
1054
+ var getAllMainNotifications = makeGetAllEntities6("mainNotifications");
1055
+ var search12 = ({ ids }) => makeEntitiesFilter11({ id: ids });
1056
+ var getMainNotifications = (0, import_reselect4.createSelector)(
1057
+ [_10.flow(getCurrentUser, _10.get("mainNotifications")), getAllMainNotifications],
1058
+ (userNotifications, notifications) => search12({ ids: userNotifications })(notifications)
1059
+ );
1060
+
1061
+ // src/selectors/news.ts
1062
+ init_define_import_meta();
1063
+ import { makeEntitiesFilter as makeEntitiesFilter12 } from "@lls/utils";
1064
+ var search13 = ({ ids }) => makeEntitiesFilter12({ id: ids });
1065
+ var {
1066
+ getNews: getAllNews,
1067
+ getNew: getNews,
1068
+ searchNews,
1069
+ makeSearchNews
1070
+ } = crud("news", {
1071
+ search: search13
1072
+ });
1073
+
1074
+ // src/selectors/panorama.ts
1075
+ init_define_import_meta();
1076
+ import { makeGetEntityById as makeGetEntityById4 } from "@lls/utils";
1077
+ var getPanorama = makeGetEntityById4("panoramas");
1078
+
1079
+ // src/selectors/premiumResource.ts
1080
+ init_define_import_meta();
1081
+ import { makeEntitiesFilter as makeEntitiesFilter13 } from "@lls/utils";
1082
+ var search14 = ({ bookIds }) => makeEntitiesFilter13({ book: bookIds });
1083
+ var { getPremiumResources, getPremiumResource, searchPremiumResources, makeSearchPremiumResources } = crud(
1084
+ "premiumResources",
1085
+ {
1086
+ search: search14
1087
+ }
1088
+ );
1089
+
1090
+ // src/selectors/lexicalFlower.ts
1091
+ init_define_import_meta();
1092
+ import { makeEntitiesFilter as makeEntitiesFilter14 } from "@lls/utils";
1093
+ var search15 = ({ ids }) => makeEntitiesFilter14({ id: ids });
1094
+ var { getLexicalFlowers, searchLexicalFlowers } = crud("lexicalFlowers", {
1095
+ search: search15
1096
+ });
1097
+
1098
+ // src/selectors/product.ts
1099
+ init_define_import_meta();
1100
+ import _11 from "lodash/fp.js";
1101
+ import { createSearchSelector as createSearchSelector6, makeEntitiesFilter as makeEntitiesFilter15, makeGetAllEntities as makeGetAllEntities7 } from "@lls/utils";
1102
+ var getProducts = makeGetAllEntities7("products");
1103
+ var search16 = ({
1104
+ ids,
1105
+ eans,
1106
+ isAdoptant,
1107
+ isSupportPlus,
1108
+ levelIds,
1109
+ subjectIds,
1110
+ productTypes
1111
+ }) => {
1112
+ let bookIds;
1113
+ const filter = makeEntitiesFilter15(
1114
+ {
1115
+ id: ids,
1116
+ ean: eans,
1117
+ isAdoptant,
1118
+ isSupportPlus,
1119
+ productType: productTypes
1120
+ },
1121
+ levelIds || subjectIds ? (product2) => !!product2?.books?.some((bookId) => bookIds.has(bookId)) : false
1122
+ );
1123
+ return (products, books) => {
1124
+ bookIds = new Set(_11.map("id", books));
1125
+ return filter(products);
1126
+ };
1127
+ };
1128
+ var searchBooks2 = makeSearchBooks();
1129
+ var searchProducts = createSearchSelector6(
1130
+ getProducts,
1131
+ (state, { levelIds, subjectIds }) => searchBooks2(state, { levelIds, subjectIds }),
1132
+ (_state, params) => params,
1133
+ (products, books, params) => search16(params)(products, books)
1134
+ );
1135
+
1136
+ // src/selectors/resource.ts
1137
+ init_define_import_meta();
1138
+ import { makeEntitiesFilter as makeEntitiesFilter16 } from "@lls/utils";
1139
+ var search17 = ({ chapterIds }) => makeEntitiesFilter16({
1140
+ chapter: chapterIds
1141
+ });
1142
+ var { getResources, getResource, searchResources, makeSearchResources } = crud("resources", {
1143
+ search: search17
1144
+ });
1145
+
1146
+ // src/selectors/schoolType.ts
1147
+ init_define_import_meta();
1148
+ import { makeEntitiesFilter as makeEntitiesFilter17 } from "@lls/utils";
1149
+ var search18 = ({ slugs }) => makeEntitiesFilter17({ slug: slugs });
1150
+ var { getSchoolTypes, getSchoolType, searchSchoolTypes, makeSearchSchoolTypes } = crud("schoolTypes", {
1151
+ search: search18
1152
+ });
1153
+
1154
+ // src/selectors/sharedPage.ts
1155
+ init_define_import_meta();
1156
+ import { createSearchSelector as createSearchSelector7, makeEntitiesFilter as makeEntitiesFilter18 } from "@lls/utils";
1157
+ import _12 from "lodash/fp.js";
1158
+ var search19 = ({
1159
+ parentIds,
1160
+ userIds,
1161
+ bookIds,
1162
+ isCreatedFromScratch,
1163
+ isLearningAssessment,
1164
+ ids
1165
+ }) => makeEntitiesFilter18({
1166
+ id: ids,
1167
+ parent: parentIds,
1168
+ user: userIds,
1169
+ book: bookIds,
1170
+ isLearningAssessment,
1171
+ isCreatedFromScratch
1172
+ });
1173
+ var { getSharedPages, getSharedPage, searchSharedPages, makeSearchSharedPages } = crud("sharedPages", {
1174
+ search: search19
1175
+ });
1176
+ var searchCurrentUserSharedPages = createSearchSelector7(
1177
+ getCurrentUser,
1178
+ getSharedPages,
1179
+ (_17, params) => params,
1180
+ (user2, sharedPages, params) => {
1181
+ const sharedUserPageIds = user2?.sharedPages ?? [];
1182
+ return search19({ ...params, ids: _12.intersection(sharedUserPageIds, params.ids || sharedUserPageIds) })(sharedPages);
1183
+ }
1184
+ );
1185
+
1186
+ // src/selectors/student.ts
1187
+ init_define_import_meta();
1188
+ import { makeEntitiesFilter as makeEntitiesFilter19 } from "@lls/utils";
1189
+ var search20 = ({ ids }) => makeEntitiesFilter19({ id: ids });
1190
+ var { getStudents, getStudent, searchStudents, makeSearchStudents } = crud("students", {
1191
+ search: search20
1192
+ });
1193
+
1194
+ // src/selectors/subject.ts
1195
+ init_define_import_meta();
1196
+ import { limitToTeacherSubjects, makeEntitiesFilter as makeEntitiesFilter20, pipe as pipe2 } from "@lls/utils";
1197
+ import _13 from "lodash/fp.js";
1198
+ var search21 = ({
1199
+ ids,
1200
+ slugs,
1201
+ isTeacherSubject,
1202
+ hasNewsletterUrl,
1203
+ schoolTypes,
1204
+ hasBooks,
1205
+ names
1206
+ }) => (subjects) => pipe2(
1207
+ subjects,
1208
+ makeEntitiesFilter20(
1209
+ {
1210
+ id: ids,
1211
+ slug: slugs,
1212
+ name: names,
1213
+ hasBooks,
1214
+ schoolTypes
1215
+ },
1216
+ !_13.isNil(hasNewsletterUrl) && ((subject2) => Boolean(subject2?.newsletterUrl) === hasNewsletterUrl)
1217
+ ),
1218
+ (subjects2) => _13.isNil(isTeacherSubject) ? subjects2 : limitToTeacherSubjects(subjects2)
1219
+ );
1220
+ var { getSubjects, getSubject, searchSubjects, makeSearchSubjects } = crud("subjects", {
1221
+ search: search21
1222
+ });
1223
+
1224
+ // src/selectors/teacher.ts
1225
+ init_define_import_meta();
1226
+ import { makeEntitiesFilter as makeEntitiesFilter21 } from "@lls/utils";
1227
+ var search22 = ({ ids, schoolIds }) => makeEntitiesFilter21({
1228
+ id: ids,
1229
+ schools: schoolIds
1230
+ });
1231
+ var { getTeachers, getTeacher, searchTeachers, makeSearchTeachers } = crud("teachers", {
1232
+ search: search22
1233
+ });
1234
+
1235
+ // src/selectors/tool.ts
1236
+ init_define_import_meta();
1237
+ import { makeEntitiesFilter as makeEntitiesFilter22 } from "@lls/utils";
1238
+ var search23 = ({ ids, locked, bookIds }) => makeEntitiesFilter22({
1239
+ id: ids,
1240
+ locked,
1241
+ books: bookIds
1242
+ });
1243
+ var { getTools, getTool, searchTools, makeSearchTools } = crud("tools", {
1244
+ search: search23
1245
+ });
1246
+
793
1247
  // src/reducers/entities.ts
794
1248
  init_define_import_meta();
795
1249
  import { makeReducer } from "@lls/utils";
796
- import _5 from "lodash/fp.js";
1250
+ import _14 from "lodash/fp.js";
797
1251
 
798
1252
  // src/actions/index.ts
799
1253
  init_define_import_meta();
@@ -816,47 +1270,53 @@ var resetAuth = makeActionCreator(actionTypes.RESET_AUTH);
816
1270
  // src/reducers/entities.ts
817
1271
  var deleteEntityReducer = (state, payload) => {
818
1272
  const { path } = payload;
819
- return _5.omit(path, state);
1273
+ return _14.omit(path, state);
820
1274
  };
821
1275
  var updateEntityReducer = (state, payload) => {
822
1276
  const { path, entity } = payload;
823
- const currentEntity = _5.get(path, state);
824
- return _5.set(path, _5.merge(currentEntity, entity), state);
1277
+ const currentEntity = _14.get(path, state);
1278
+ return _14.set(path, _14.merge(currentEntity, entity), state);
825
1279
  };
826
1280
  var setEntityReducer = (state, payload) => {
827
1281
  const { path, entity } = payload;
828
- return _5.set(path, entity, state);
829
- };
830
- var shallowAssign = (old, next, transform) => {
831
- let updated = false;
832
- const merged = _5.flow(
833
- _5.toPairs,
834
- _5.reduce((memo, [key, val]) => {
835
- if (_5.isEmpty(val)) return memo;
836
- if (!old[key]) {
837
- updated = true;
838
- memo[key] = val;
839
- return memo;
840
- }
841
- const maybeEqual = transform(old[key], next[key]);
842
- if (maybeEqual !== old[key]) {
843
- updated = true;
844
- memo[key] = maybeEqual;
845
- return memo;
846
- }
847
- return memo;
848
- }, _5.clone(old))
849
- )(next);
850
- return updated ? merged : old;
1282
+ return _14.set(path, entity, state);
851
1283
  };
852
1284
  var setEntitiesReducer = (state, payload) => {
853
- return shallowAssign(state, payload, (entityKind, nextEntityKind) => {
854
- return shallowAssign(
855
- entityKind,
856
- nextEntityKind,
857
- (oldEntity, nextEntity) => _5.isEqual(oldEntity, nextEntity) ? oldEntity : _5.assign(oldEntity, nextEntity)
858
- );
1285
+ if (typeof payload !== "object") return state;
1286
+ const stateDrafts = {};
1287
+ Object.keys(payload).forEach((entityName) => {
1288
+ const entities2 = payload[entityName];
1289
+ const entityDraft = {};
1290
+ if (!entities2) {
1291
+ return;
1292
+ }
1293
+ Object.keys(entities2).forEach((id) => {
1294
+ const entity = entities2[id];
1295
+ if (!state[entityName]?.[id]) {
1296
+ entityDraft[id] = entity;
1297
+ } else {
1298
+ if (typeof entity === "undefined") {
1299
+ return;
1300
+ }
1301
+ const diff = Object.keys(entity).some((prop) => {
1302
+ const value = entity[prop];
1303
+ if (!_14.isEqual(state[entityName]?.[id]?.[prop], value)) {
1304
+ return true;
1305
+ }
1306
+ });
1307
+ if (diff) {
1308
+ entityDraft[id] = Object.assign({}, state[entityName]?.[id], entity);
1309
+ }
1310
+ }
1311
+ });
1312
+ if (Object.keys(entityDraft).length !== 0) {
1313
+ stateDrafts[entityName] = { ...state[entityName], ...entityDraft };
1314
+ }
859
1315
  });
1316
+ if (Object.keys(stateDrafts).length !== 0) {
1317
+ return { ...state, ...stateDrafts };
1318
+ }
1319
+ return state;
860
1320
  };
861
1321
  var entities = makeReducer(
862
1322
  {},
@@ -872,7 +1332,7 @@ var entities_default = entities;
872
1332
  // src/reducers/auth.ts
873
1333
  init_define_import_meta();
874
1334
  import { makeReducer as makeReducer2 } from "@lls/utils";
875
- import _6 from "lodash/fp.js";
1335
+ import _15 from "lodash/fp.js";
876
1336
  var initialState = {
877
1337
  id: void 0,
878
1338
  role: null,
@@ -885,15 +1345,15 @@ var initialState = {
885
1345
  llsUserId: null
886
1346
  };
887
1347
  var auth = makeReducer2(initialState, {
888
- [actionTypes.SET_AUTH]: _6.assign,
889
- [actionTypes.RESET_AUTH]: _6.constant(initialState)
1348
+ [actionTypes.SET_AUTH]: _15.assign,
1349
+ [actionTypes.RESET_AUTH]: _15.constant(initialState)
890
1350
  });
891
1351
  var auth_default = auth;
892
1352
 
893
1353
  // src/schema/index.ts
894
1354
  init_define_import_meta();
895
1355
  var import_normalizr = __toESM(require_normalizr(), 1);
896
- import _7 from "lodash/fp.js";
1356
+ import _16 from "lodash/fp.js";
897
1357
  var document = new import_normalizr.schema.Entity("documents", {}, { idAttribute: "resourceId" });
898
1358
  var subject = new import_normalizr.schema.Entity("subjects");
899
1359
  var level = new import_normalizr.schema.Entity("levels");
@@ -908,6 +1368,8 @@ var teacher = new import_normalizr.schema.Entity("teachers");
908
1368
  var faq = new import_normalizr.schema.Entity("faq");
909
1369
  var product = new import_normalizr.schema.Entity("products");
910
1370
  var communityProjects = new import_normalizr.schema.Entity("communityProjects");
1371
+ var builderIo = new import_normalizr.schema.Entity("builderIos");
1372
+ var lexicalFlower = new import_normalizr.schema.Entity("lexicalFlowers");
911
1373
  var grammarRule = new import_normalizr.schema.Entity("grammarRules", {}, { idAttribute: "objectID" });
912
1374
  var mainNotification = new import_normalizr.schema.Entity("mainNotifications");
913
1375
  var explorerResult = new import_normalizr.schema.Entity("explorerResults", {}, { idAttribute: "resourceId" });
@@ -987,7 +1449,8 @@ var userSchema = define(user, {
987
1449
  students: [student],
988
1450
  subjects: [subject],
989
1451
  teachers: [teacher],
990
- userPages: [page]
1452
+ userPages: [page],
1453
+ lexicalFlowers: { hits: [lexicalFlower] }
991
1454
  });
992
1455
  var notificationSchema = define(mainNotification, { page });
993
1456
  drawerNotification.define({ page });
@@ -1040,6 +1503,7 @@ var querySchema = {
1040
1503
  createGroup: group,
1041
1504
  createPage: page,
1042
1505
  createUser: user,
1506
+ createLexicalFlower: lexicalFlower,
1043
1507
  documents: { hits: [document] },
1044
1508
  explorerResults: [explorerResult],
1045
1509
  levels: [level],
@@ -1061,7 +1525,8 @@ var querySchema = {
1061
1525
  updatePage: page,
1062
1526
  updateTrialUser: user,
1063
1527
  updateUserLastActivitySeenAt: user,
1064
- updateUser: user
1528
+ updateUser: user,
1529
+ updateLexicalFlower: lexicalFlower
1065
1530
  },
1066
1531
  auth: {
1067
1532
  user
@@ -1070,7 +1535,8 @@ var querySchema = {
1070
1535
  addLikeFaq: faq,
1071
1536
  communityProjects: [communityProjects],
1072
1537
  createAnalytics: analytic,
1073
- faq: [faq]
1538
+ faq: [faq],
1539
+ builderIos: [builderIo]
1074
1540
  },
1075
1541
  static: {
1076
1542
  projetVoltaire: {
@@ -1078,20 +1544,119 @@ var querySchema = {
1078
1544
  }
1079
1545
  }
1080
1546
  };
1081
- var normalizeData = _7.flow((data) => (0, import_normalizr.normalize)(data, querySchema));
1547
+ var normalizeData = _16.flow((data) => (0, import_normalizr.normalize)(data, querySchema));
1082
1548
  export {
1083
1549
  auth_default as authReducer,
1084
1550
  entities_default as entitiesReducer,
1551
+ filterPages,
1552
+ getAllNews,
1553
+ getAuth,
1554
+ getBook,
1555
+ getBooks,
1556
+ getChapter,
1557
+ getChapters,
1558
+ getCollection,
1559
+ getCollections,
1560
+ getCommunityProject,
1561
+ getCommunityProjects,
1562
+ getContact,
1563
+ getContacts,
1085
1564
  getCurrentUser,
1565
+ getDraftPage,
1566
+ getDraftPages,
1567
+ getFaqs,
1568
+ getGarDivision,
1569
+ getGarDivisions,
1570
+ getGroup,
1571
+ getGroups,
1572
+ getIsLogged,
1573
+ getLevel,
1574
+ getLevels,
1575
+ getLexicalFlowers,
1576
+ getMainNotifications,
1577
+ getNews,
1578
+ getPage,
1579
+ getPages,
1580
+ getPanorama,
1581
+ getPremiumResource,
1582
+ getPremiumResources,
1583
+ getProducts,
1584
+ getResource,
1585
+ getResources,
1086
1586
  getSchool,
1587
+ getSchoolType,
1588
+ getSchoolTypes,
1087
1589
  getSchools,
1590
+ getSharedPage,
1591
+ getSharedPages,
1592
+ getStudent,
1593
+ getStudents,
1594
+ getSubject,
1595
+ getSubjects,
1596
+ getTeacher,
1597
+ getTeachers,
1598
+ getToken,
1599
+ getTool,
1600
+ getTools,
1088
1601
  getUser,
1602
+ getUserGroups,
1089
1603
  getUsers,
1604
+ makeGetBook,
1605
+ makeGetDraftPage,
1606
+ makeSearchBooks,
1607
+ makeSearchChapters,
1608
+ makeSearchCollections,
1609
+ makeSearchCommunityProjects,
1610
+ makeSearchContacts,
1611
+ makeSearchCopyNotifications,
1612
+ makeSearchDraftPages,
1613
+ makeSearchDrawerNotifications,
1614
+ makeSearchGarDivisions,
1615
+ makeSearchGroups,
1616
+ makeSearchLevels,
1617
+ makeSearchModifiedPages,
1618
+ makeSearchNews,
1619
+ makeSearchPages,
1620
+ makeSearchPremiumResources,
1621
+ makeSearchResources,
1622
+ makeSearchSchoolTypes,
1090
1623
  makeSearchSchools,
1624
+ makeSearchSharedPages,
1625
+ makeSearchStudents,
1626
+ makeSearchSubjects,
1627
+ makeSearchTeachers,
1628
+ makeSearchTools,
1091
1629
  makeSearchUsers,
1630
+ makeSearchValidBooks,
1092
1631
  normalizeData,
1093
1632
  querySchema,
1633
+ searchBooks,
1634
+ searchChapters,
1635
+ searchCollections,
1636
+ searchCommunityProjects,
1637
+ searchContacts,
1638
+ searchCopyNotifications,
1639
+ searchCurrentUserSharedPages,
1640
+ searchDraftPages,
1641
+ searchDrawerNotifications,
1642
+ searchGarDivisions,
1643
+ searchGroups,
1644
+ searchLevels,
1645
+ searchLexicalFlowers,
1646
+ searchModifiedPages,
1647
+ searchNews,
1648
+ searchPages,
1649
+ searchPremiumResources,
1650
+ searchProducts,
1651
+ searchResources,
1652
+ searchSchoolTypes,
1094
1653
  searchSchools,
1654
+ searchSharedPages,
1655
+ searchStudents,
1656
+ searchSubjects,
1657
+ searchTeachers,
1658
+ searchTools,
1095
1659
  searchUsers,
1660
+ searchValidBooks,
1096
1661
  setEntitiesReducer
1097
1662
  };
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.58-c0096e77",
5
+ "version": "24.1.59-059267c8",
6
6
  "type": "module",
7
7
  "types": "./lib/builttypes/store/src/index.d.ts",
8
8
  "exports": {
@@ -28,21 +28,21 @@
28
28
  "react": "*"
29
29
  },
30
30
  "devDependencies": {
31
- "@biomejs/biome": "1.8.4-nightly.a579bf7",
32
- "@types/lodash": "4.17.6",
33
- "@types/node": "20.14.10",
34
- "@types/react": "18.3.3",
31
+ "@biomejs/biome": "1.9.1",
32
+ "@types/lodash": "4.17.7",
33
+ "@types/node": "22.5.5",
34
+ "@types/react": "18.3.6",
35
35
  "@vitejs/plugin-react-swc": "3.7.0",
36
- "esbuild": "0.23.0",
36
+ "esbuild": "0.23.1",
37
37
  "lodash": "4.17.21",
38
38
  "react": "18.3.1",
39
39
  "reselect": "4.1.8",
40
- "typescript": "5.5.4",
41
- "vite": "5.3.3",
40
+ "typescript": "5.6.2",
41
+ "vite": "5.4.6",
42
42
  "vite-tsconfig-paths": "4.3.2",
43
- "vitest": "2.0.0",
44
- "@lls/utils": "24.1.58-c0096e77",
45
- "@lls/vitescripts": "24.1.58-c0096e77"
43
+ "vitest": "2.1.1",
44
+ "@lls/utils": "24.1.59-059267c8",
45
+ "@lls/vitescripts": "24.1.59-059267c8"
46
46
  },
47
47
  "license": "ISC",
48
48
  "dependencies": {