@lls/store 24.6.0-69727080 → 24.6.0-95ee4e3c

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 +58 -65
  2. package/package.json +3 -3
package/lib/index.js CHANGED
@@ -742,8 +742,7 @@ var getToken = _.get("auth.token");
742
742
 
743
743
  // src/selectors/school.ts
744
744
  init_define_import_meta();
745
- import { makeEntitiesFilter, pipe } from "@lls/utils";
746
- import _2 from "lodash/fp.js";
745
+ import { makeEntitiesFilter } from "@lls/utils";
747
746
 
748
747
  // src/selectors/crud.ts
749
748
  init_define_import_meta();
@@ -778,21 +777,15 @@ var makeUseSearch = (makeSearchElements) => {
778
777
  };
779
778
 
780
779
  // src/selectors/school.ts
781
- var search = ({ ids, academyIds, sortByQuery }) => {
782
- return (schools) => pipe(
783
- schools,
784
- makeEntitiesFilter({ id: ids, academy: academyIds }),
785
- _2.isFunction(sortByQuery) ? sortByQuery : sortByQuery ? _2.sortBy(sortByQuery) : _2.identity
786
- );
787
- };
780
+ var search = ({ ids }) => makeEntitiesFilter({ id: ids });
788
781
  var { getSchools, getSchool, useSearchSchools } = crud("schools", {
789
782
  search
790
783
  });
791
784
 
792
785
  // src/selectors/book.ts
793
786
  init_define_import_meta();
794
- import { createSearchSelector as createSearchSelector2, makeEntitiesFilter as makeEntitiesFilter2, makeGetEntityById as makeGetEntityById2, pipe as pipe2 } from "@lls/utils";
795
- import _3 from "lodash/fp.js";
787
+ import { createSearchSelector as createSearchSelector2, makeEntitiesFilter as makeEntitiesFilter2, makeGetEntityById as makeGetEntityById2, pipe } from "@lls/utils";
788
+ import _2 from "lodash/fp.js";
796
789
  var search2 = ({
797
790
  ids,
798
791
  levelIds,
@@ -810,7 +803,7 @@ var search2 = ({
810
803
  isRenewed,
811
804
  isPrimary
812
805
  }) => {
813
- return (books) => pipe2(
806
+ return (books) => pipe(
814
807
  books,
815
808
  makeEntitiesFilter2({
816
809
  id: ids,
@@ -828,13 +821,13 @@ var search2 = ({
828
821
  isRenewed,
829
822
  isPrimary
830
823
  }),
831
- _3.isFunction(sortByQuery) ? sortByQuery : sortByQuery ? _3.sortBy(sortByQuery) : _3.identity
824
+ _2.isFunction(sortByQuery) ? sortByQuery : sortByQuery ? _2.sortBy(sortByQuery) : _2.identity
832
825
  );
833
826
  };
834
827
  var { getBooks, getBook, filterBooks, useSearchBooks, makeSearchBooks } = crud("books", {
835
828
  search: search2
836
829
  });
837
- var makeSearchValidBooks = () => createSearchSelector2(makeSearchBooks(), (books) => _3.filter({ valid: true, hasNewDesign: true }, books));
830
+ var makeSearchValidBooks = () => createSearchSelector2(makeSearchBooks(), (books) => _2.filter({ valid: true, hasNewDesign: true }, books));
838
831
  var useSearchValidBooks = makeUseSearch(makeSearchValidBooks);
839
832
  var makeGetBook = () => makeGetEntityById2("books");
840
833
 
@@ -854,18 +847,18 @@ var getCurrentUser = makeGetCurrentUser();
854
847
 
855
848
  // src/selectors/chapter.ts
856
849
  init_define_import_meta();
857
- import { makeEntitiesFilter as makeEntitiesFilter4, pipe as pipe3 } from "@lls/utils";
858
- import _4 from "lodash/fp.js";
859
- var search4 = ({ bookIds, ids, hasTeacherBook, sortByQuery }) => (chapters) => pipe3(
850
+ import { makeEntitiesFilter as makeEntitiesFilter4, pipe as pipe2 } from "@lls/utils";
851
+ import _3 from "lodash/fp.js";
852
+ var search4 = ({ bookIds, ids, hasTeacherBook, sortByQuery }) => (chapters) => pipe2(
860
853
  chapters,
861
854
  makeEntitiesFilter4(
862
855
  {
863
856
  book: bookIds,
864
857
  id: ids
865
858
  },
866
- !_4.isNil(hasTeacherBook) && ((chapter2) => !!chapter2?.teacherBook === hasTeacherBook)
859
+ !_3.isNil(hasTeacherBook) && ((chapter2) => !!chapter2?.teacherBook === hasTeacherBook)
867
860
  ),
868
- _4.isFunction(sortByQuery) ? sortByQuery : sortByQuery ? _4.sortBy(sortByQuery) : _4.identity
861
+ _3.isFunction(sortByQuery) ? sortByQuery : sortByQuery ? _3.sortBy(sortByQuery) : _3.identity
869
862
  );
870
863
  var { getChapters, getChapter, useSearchChapters } = crud("chapters", {
871
864
  search: search4
@@ -873,8 +866,8 @@ var { getChapters, getChapter, useSearchChapters } = crud("chapters", {
873
866
 
874
867
  // src/selectors/page.ts
875
868
  init_define_import_meta();
876
- import { makeEntitiesFilter as makeEntitiesFilter5, pipe as pipe4 } from "@lls/utils";
877
- import _5 from "lodash/fp.js";
869
+ import { makeEntitiesFilter as makeEntitiesFilter5, pipe as pipe3 } from "@lls/utils";
870
+ import _4 from "lodash/fp.js";
878
871
  var search5 = ({
879
872
  ids,
880
873
  chapterIds,
@@ -899,7 +892,7 @@ var search5 = ({
899
892
  sortByQuery
900
893
  }) => {
901
894
  let pageById = false;
902
- return (pages) => pipe4(
895
+ return (pages) => pipe3(
903
896
  pages,
904
897
  makeEntitiesFilter5(
905
898
  {
@@ -923,12 +916,12 @@ var search5 = ({
923
916
  isDraft
924
917
  },
925
918
  isParentCreatedFromScratch && ((page2, pages2) => {
926
- pageById = pageById || _5.keyBy("id", pages2);
927
- return !!_5.get([page2?.originalPage, "isCreatedFromScratch"], pageById);
919
+ pageById = pageById || _4.keyBy("id", pages2);
920
+ return !!_4.get([page2?.originalPage, "isCreatedFromScratch"], pageById);
928
921
  }),
929
- updatedAfter && _5.flow(_5.get("updatedAt"), (date) => new Date(date).getTime() - updatedAfter.getTime() >= 0)
922
+ updatedAfter && _4.flow(_4.get("updatedAt"), (date) => new Date(date).getTime() - updatedAfter.getTime() >= 0)
930
923
  ),
931
- _5.isFunction(sortByQuery) ? sortByQuery : sortByQuery ? _5.sortBy(sortByQuery) : _5.identity
924
+ _4.isFunction(sortByQuery) ? sortByQuery : sortByQuery ? _4.sortBy(sortByQuery) : _4.identity
932
925
  );
933
926
  };
934
927
  var { getPages, getPage, filterPages, useSearchPages, makeSearchPages } = crud("pages", {
@@ -942,8 +935,8 @@ var { useSearchPages: useSearchModifiedPages } = crud("pages", { search: searchM
942
935
 
943
936
  // src/selectors/collection.ts
944
937
  init_define_import_meta();
945
- import _6 from "lodash/fp.js";
946
- var search6 = (_params) => _6.identity;
938
+ import _5 from "lodash/fp.js";
939
+ var search6 = (_params) => _5.identity;
947
940
  var { getCollections, getCollection, useSearchCollections } = crud("collections", {
948
941
  search: search6
949
942
  });
@@ -966,8 +959,8 @@ var { getCommunityProjects, getCommunityProject, useSearchCommunityProjects } =
966
959
 
967
960
  // src/selectors/contact.ts
968
961
  init_define_import_meta();
969
- import _7 from "lodash/fp.js";
970
- var search8 = (_params) => _7.identity;
962
+ import _6 from "lodash/fp.js";
963
+ var search8 = (_params) => _6.identity;
971
964
  var { getContacts, getContact, useSearchContacts } = crud("contacts", {
972
965
  search: search8
973
966
  });
@@ -979,7 +972,7 @@ var search9 = ({ ids, read, pageIds }) => {
979
972
  return makeEntitiesFilter7({ read, id: ids, page: pageIds });
980
973
  };
981
974
  var makeSearchCopyNotifications = () => createSearchSelector3(
982
- [makeGetCurrentUser(), makeGetAllEntities2("copyNotifications"), (_19, params) => params],
975
+ [makeGetCurrentUser(), makeGetAllEntities2("copyNotifications"), (_18, params) => params],
983
976
  (currentUser, copyNotifications, { pageIds, read }) => {
984
977
  const ids = currentUser?.copyNotifications;
985
978
  return search9({ ids, read, pageIds })(copyNotifications);
@@ -1007,7 +1000,7 @@ var search11 = ({ ids, read, pageIds }) => {
1007
1000
  return makeEntitiesFilter9({ read, id: ids, page: pageIds });
1008
1001
  };
1009
1002
  var makeSearchDrawerNotifications = () => createSearchSelector4(
1010
- [makeGetCurrentUser(), makeGetAllEntities3("drawerNotifications"), (_19, params) => params],
1003
+ [makeGetCurrentUser(), makeGetAllEntities3("drawerNotifications"), (_18, params) => params],
1011
1004
  (currentUser, drawerNotifications, { read, pageIds }) => {
1012
1005
  const ids = currentUser?.drawerNotifications;
1013
1006
  return search11({ ids, read, pageIds })(drawerNotifications);
@@ -1022,8 +1015,8 @@ var getFaqs = makeGetAllEntities4("faq");
1022
1015
 
1023
1016
  // src/selectors/garDivision.ts
1024
1017
  init_define_import_meta();
1025
- import _8 from "lodash/fp.js";
1026
- var search12 = (_params) => _8.identity;
1018
+ import _7 from "lodash/fp.js";
1019
+ var search12 = (_params) => _7.identity;
1027
1020
  var { getGarDivisions, getGarDivision, useSearchGarDivisions } = crud("garDivisions", {
1028
1021
  search: search12
1029
1022
  });
@@ -1032,8 +1025,8 @@ var { getGarDivisions, getGarDivision, useSearchGarDivisions } = crud("garDivisi
1032
1025
  init_define_import_meta();
1033
1026
  var import_reselect2 = __toESM(require_lib(), 1);
1034
1027
  import { makeEntitiesFilter as makeEntitiesFilter10 } from "@lls/utils";
1035
- import _9 from "lodash/fp.js";
1036
- var search13 = ({ ownerIds }) => _9.flow(makeEntitiesFilter10({ owner: ownerIds }), _9.orderBy("createdAt", ["desc"]));
1028
+ import _8 from "lodash/fp.js";
1029
+ var search13 = ({ ownerIds }) => _8.flow(makeEntitiesFilter10({ owner: ownerIds }), _8.orderBy("createdAt", ["desc"]));
1037
1030
  var { getGroups, getGroup, useSearchGroups } = crud("groups", {
1038
1031
  search: search13
1039
1032
  });
@@ -1046,7 +1039,7 @@ var getUserGroups = (0, import_reselect2.createSelector)(
1046
1039
  init_define_import_meta();
1047
1040
  var import_reselect3 = __toESM(require_lib(), 1);
1048
1041
  import { makeEntitiesFilter as makeEntitiesFilter11 } from "@lls/utils";
1049
- import _10 from "lodash/fp.js";
1042
+ import _9 from "lodash/fp.js";
1050
1043
  var search14 = ({
1051
1044
  ids,
1052
1045
  slugs,
@@ -1056,7 +1049,7 @@ var search14 = ({
1056
1049
  isProHighSchool,
1057
1050
  isGenHighSchool,
1058
1051
  isElementarySchool
1059
- }) => _10.flow(
1052
+ }) => _9.flow(
1060
1053
  makeEntitiesFilter11({
1061
1054
  id: ids,
1062
1055
  slug: slugs,
@@ -1067,20 +1060,20 @@ var search14 = ({
1067
1060
  isGenHighSchool,
1068
1061
  isElementarySchool
1069
1062
  }),
1070
- _10.orderBy("order", "desc")
1063
+ _9.orderBy("order", "desc")
1071
1064
  );
1072
1065
  var crudLevels = crud("levels", { search: search14 });
1073
1066
  var { getLevel, useSearchLevels } = crudLevels;
1074
- var getLevels = (0, import_reselect3.createSelector)(crudLevels.getLevels, _10.orderBy("order", "desc"));
1067
+ var getLevels = (0, import_reselect3.createSelector)(crudLevels.getLevels, _9.orderBy("order", "desc"));
1075
1068
 
1076
1069
  // src/selectors/mainNotification.ts
1077
1070
  init_define_import_meta();
1078
1071
  var import_reselect4 = __toESM(require_lib(), 1);
1079
1072
  import { makeEntitiesFilter as makeEntitiesFilter12, makeGetAllEntities as makeGetAllEntities5 } from "@lls/utils";
1080
- import _11 from "lodash/fp.js";
1073
+ import _10 from "lodash/fp.js";
1081
1074
  var search15 = ({ ids }) => makeEntitiesFilter12({ id: ids });
1082
1075
  var getMainNotifications = (0, import_reselect4.createSelector)(
1083
- [_11.flow(makeGetCurrentUser(), _11.get("mainNotifications")), makeGetAllEntities5("mainNotifications")],
1076
+ [_10.flow(makeGetCurrentUser(), _10.get("mainNotifications")), makeGetAllEntities5("mainNotifications")],
1084
1077
  (userNotifications, notifications) => search15({ ids: userNotifications })(notifications)
1085
1078
  );
1086
1079
 
@@ -1119,7 +1112,7 @@ var { getLexicalFlowers, useSearchLexicalFlowers } = crud("lexicalFlowers", {
1119
1112
 
1120
1113
  // src/selectors/product.ts
1121
1114
  init_define_import_meta();
1122
- import _12 from "lodash/fp.js";
1115
+ import _11 from "lodash/fp.js";
1123
1116
  import { createSearchSelector as createSearchSelector5, makeEntitiesFilter as makeEntitiesFilter16, makeGetAllEntities as makeGetAllEntities6 } from "@lls/utils";
1124
1117
  var getProducts = makeGetAllEntities6("products");
1125
1118
  var search19 = ({
@@ -1143,7 +1136,7 @@ var search19 = ({
1143
1136
  levelIds || subjectIds ? (product2) => !!product2?.books?.some((bookId) => bookIds.has(bookId)) : false
1144
1137
  );
1145
1138
  return (products, books) => {
1146
- bookIds = new Set(_12.flow(_12.map("id"), _12.map(_12.parseInt(10)))(books));
1139
+ bookIds = new Set(_11.flow(_11.map("id"), _11.map(_11.parseInt(10)))(books));
1147
1140
  return filter(products);
1148
1141
  };
1149
1142
  };
@@ -1179,7 +1172,7 @@ var { getSchoolTypes, getSchoolType, useSearchSchoolTypes, makeSearchSchoolTypes
1179
1172
  // src/selectors/sharedPage.ts
1180
1173
  init_define_import_meta();
1181
1174
  import { createSearchSelector as createSearchSelector6, makeEntitiesFilter as makeEntitiesFilter19 } from "@lls/utils";
1182
- import _13 from "lodash/fp.js";
1175
+ import _12 from "lodash/fp.js";
1183
1176
  var search22 = ({
1184
1177
  parentIds,
1185
1178
  userIds,
@@ -1204,7 +1197,7 @@ var makeSearchCurrentUserSharedPages = () => createSearchSelector6(
1204
1197
  (__, params) => params,
1205
1198
  (user2, sharedPages, params) => {
1206
1199
  const sharedUserPageIds = user2?.sharedPages ?? [];
1207
- return search22({ ...params, ids: _13.intersection(sharedUserPageIds, params.ids || sharedUserPageIds) })(sharedPages);
1200
+ return search22({ ...params, ids: _12.intersection(sharedUserPageIds, params.ids || sharedUserPageIds) })(sharedPages);
1208
1201
  }
1209
1202
  );
1210
1203
  var useSearchCurrentUserSharedPages = makeUseSearch(makeSearchCurrentUserSharedPages);
@@ -1219,8 +1212,8 @@ var { getStudents, getStudent, useSearchStudents } = crud("students", {
1219
1212
 
1220
1213
  // src/selectors/subject.ts
1221
1214
  init_define_import_meta();
1222
- import { limitToTeacherSubjects, makeEntitiesFilter as makeEntitiesFilter21, pipe as pipe5 } from "@lls/utils";
1223
- import _14 from "lodash/fp.js";
1215
+ import { limitToTeacherSubjects, makeEntitiesFilter as makeEntitiesFilter21, pipe as pipe4 } from "@lls/utils";
1216
+ import _13 from "lodash/fp.js";
1224
1217
  var search24 = ({
1225
1218
  ids,
1226
1219
  slugs,
@@ -1230,7 +1223,7 @@ var search24 = ({
1230
1223
  hasBooks,
1231
1224
  names,
1232
1225
  sortByQuery
1233
- }) => (subjects) => pipe5(
1226
+ }) => (subjects) => pipe4(
1234
1227
  subjects,
1235
1228
  makeEntitiesFilter21(
1236
1229
  {
@@ -1240,10 +1233,10 @@ var search24 = ({
1240
1233
  hasBooks,
1241
1234
  schoolTypes
1242
1235
  },
1243
- !_14.isNil(hasNewsletterUrl) && ((subject2) => Boolean(subject2?.newsletterUrl) === hasNewsletterUrl)
1236
+ !_13.isNil(hasNewsletterUrl) && ((subject2) => Boolean(subject2?.newsletterUrl) === hasNewsletterUrl)
1244
1237
  ),
1245
- (subjects2) => _14.isNil(isTeacherSubject) ? subjects2 : limitToTeacherSubjects(subjects2),
1246
- _14.isFunction(sortByQuery) ? sortByQuery : sortByQuery ? _14.sortBy(sortByQuery) : _14.identity
1238
+ (subjects2) => _13.isNil(isTeacherSubject) ? subjects2 : limitToTeacherSubjects(subjects2),
1239
+ _13.isFunction(sortByQuery) ? sortByQuery : sortByQuery ? _13.sortBy(sortByQuery) : _13.identity
1247
1240
  );
1248
1241
  var { getSubjects, getSubject, useSearchSubjects, makeSearchSubjects } = crud("subjects", {
1249
1242
  search: search24
@@ -1296,8 +1289,8 @@ var { getBuilderIos, getBuilderIo, useSearchBuilderIos } = crud("builderIos", {
1296
1289
 
1297
1290
  // src/selectors/circonscription.ts
1298
1291
  init_define_import_meta();
1299
- import _15 from "lodash/fp.js";
1300
- var search29 = (_params) => _15.identity;
1292
+ import _14 from "lodash/fp.js";
1293
+ var search29 = (_params) => _14.identity;
1301
1294
  var { getCirconscriptions } = crud("circonscriptions", {
1302
1295
  search: search29
1303
1296
  });
@@ -1305,7 +1298,7 @@ var { getCirconscriptions } = crud("circonscriptions", {
1305
1298
  // src/reducers/entities.ts
1306
1299
  init_define_import_meta();
1307
1300
  import { makeReducer } from "@lls/utils";
1308
- import _16 from "lodash/fp.js";
1301
+ import _15 from "lodash/fp.js";
1309
1302
 
1310
1303
  // src/actions/index.ts
1311
1304
  init_define_import_meta();
@@ -1328,16 +1321,16 @@ var resetAuth = makeActionCreator(actionTypes.RESET_AUTH);
1328
1321
  // src/reducers/entities.ts
1329
1322
  var deleteEntityReducer = (state, payload) => {
1330
1323
  const { path } = payload;
1331
- return _16.omit(path, state);
1324
+ return _15.omit(path, state);
1332
1325
  };
1333
1326
  var updateEntityReducer = (state, payload) => {
1334
1327
  const { path, entity } = payload;
1335
- const currentEntity = _16.get(path, state);
1336
- return _16.set(path, _16.merge(currentEntity, entity), state);
1328
+ const currentEntity = _15.get(path, state);
1329
+ return _15.set(path, _15.merge(currentEntity, entity), state);
1337
1330
  };
1338
1331
  var setEntityReducer = (state, payload) => {
1339
1332
  const { path, entity } = payload;
1340
- return _16.set(path, entity, state);
1333
+ return _15.set(path, entity, state);
1341
1334
  };
1342
1335
  var setEntitiesReducer = (state, payload) => {
1343
1336
  if (typeof payload !== "object") return state;
@@ -1358,7 +1351,7 @@ var setEntitiesReducer = (state, payload) => {
1358
1351
  }
1359
1352
  const diff = Object.keys(entity).some((prop) => {
1360
1353
  const value = entity[prop];
1361
- if (!_16.isEqual(state[entityName]?.[id]?.[prop], value)) {
1354
+ if (!_15.isEqual(state[entityName]?.[id]?.[prop], value)) {
1362
1355
  return true;
1363
1356
  }
1364
1357
  });
@@ -1390,7 +1383,7 @@ var entities_default = entities;
1390
1383
  // src/reducers/auth.ts
1391
1384
  init_define_import_meta();
1392
1385
  import { makeReducer as makeReducer2 } from "@lls/utils";
1393
- import _17 from "lodash/fp.js";
1386
+ import _16 from "lodash/fp.js";
1394
1387
  var initialState = {
1395
1388
  id: void 0,
1396
1389
  role: null,
@@ -1403,15 +1396,15 @@ var initialState = {
1403
1396
  llsUserId: null
1404
1397
  };
1405
1398
  var auth = makeReducer2(initialState, {
1406
- [actionTypes.SET_AUTH]: _17.assign,
1407
- [actionTypes.RESET_AUTH]: _17.constant(initialState)
1399
+ [actionTypes.SET_AUTH]: _16.assign,
1400
+ [actionTypes.RESET_AUTH]: _16.constant(initialState)
1408
1401
  });
1409
1402
  var auth_default = auth;
1410
1403
 
1411
1404
  // src/schema/index.ts
1412
1405
  init_define_import_meta();
1413
1406
  var import_normalizr = __toESM(require_normalizr(), 1);
1414
- import _18 from "lodash/fp.js";
1407
+ import _17 from "lodash/fp.js";
1415
1408
  var document = new import_normalizr.schema.Entity("documents", {}, { idAttribute: "resourceId" });
1416
1409
  var subject = new import_normalizr.schema.Entity("subjects");
1417
1410
  var level = new import_normalizr.schema.Entity("levels");
@@ -1617,7 +1610,7 @@ var querySchema = {
1617
1610
  }
1618
1611
  }
1619
1612
  };
1620
- var normalizeData = _18.flow((data) => (0, import_normalizr.normalize)(data, querySchema));
1613
+ var normalizeData = _17.flow((data) => (0, import_normalizr.normalize)(data, querySchema));
1621
1614
  export {
1622
1615
  auth_default as authReducer,
1623
1616
  entities_default as entitiesReducer,
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.6.0-69727080",
5
+ "version": "24.6.0-95ee4e3c",
6
6
  "type": "module",
7
7
  "types": "./lib/builttypes/store/src/index.d.ts",
8
8
  "exports": {
@@ -49,8 +49,8 @@
49
49
  "vite": "5.4.10",
50
50
  "vite-tsconfig-paths": "5.1.0",
51
51
  "vitest": "2.1.4",
52
- "@lls/utils": "24.6.0-69727080",
53
- "@lls/vitescripts": "24.6.0-69727080"
52
+ "@lls/utils": "24.6.0-95ee4e3c",
53
+ "@lls/vitescripts": "24.6.0-95ee4e3c"
54
54
  },
55
55
  "license": "ISC",
56
56
  "dependencies": {