@lls/store 24.11.0-e34d1cd7 → 24.11.0-e9365b71

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 +30 -14
  2. package/package.json +5 -3
package/lib/index.js CHANGED
@@ -979,7 +979,7 @@ var search9 = ({ ids, read, pageIds }) => {
979
979
  return makeEntitiesFilter7({ read, id: ids, page: pageIds });
980
980
  };
981
981
  var makeSearchCopyNotifications = () => createSearchSelector3(
982
- [makeGetCurrentUser(), makeGetAllEntities2("copyNotifications"), (_19, params) => params],
982
+ [makeGetCurrentUser(), makeGetAllEntities2("copyNotifications"), (_20, params) => params],
983
983
  (currentUser, copyNotifications, { pageIds, read }) => {
984
984
  const ids = currentUser?.copyNotifications;
985
985
  return search9({ ids, read, pageIds })(copyNotifications);
@@ -1009,7 +1009,7 @@ var search10 = ({
1009
1009
  subDocumentType: subDocumentTypes
1010
1010
  });
1011
1011
  };
1012
- var { useSearchDocuments } = crud("documents", {
1012
+ var { useSearchDocuments, getDocument } = crud("documents", {
1013
1013
  search: search10
1014
1014
  });
1015
1015
 
@@ -1020,7 +1020,7 @@ var search11 = ({ ids, read, pageIds }) => {
1020
1020
  return makeEntitiesFilter9({ read, id: ids, page: pageIds });
1021
1021
  };
1022
1022
  var makeSearchDrawerNotifications = () => createSearchSelector4(
1023
- [makeGetCurrentUser(), makeGetAllEntities3("drawerNotifications"), (_19, params) => params],
1023
+ [makeGetCurrentUser(), makeGetAllEntities3("drawerNotifications"), (_20, params) => params],
1024
1024
  (currentUser, drawerNotifications, { read, pageIds }) => {
1025
1025
  const ids = currentUser?.drawerNotifications;
1026
1026
  return search11({ ids, read, pageIds })(drawerNotifications);
@@ -1357,10 +1357,15 @@ var { getDocumentTypes, getDocumentType, useSearchDocumentTypes } = crud("docume
1357
1357
  search: search30
1358
1358
  });
1359
1359
 
1360
+ // src/selectors/globalRights.ts
1361
+ init_define_import_meta();
1362
+ import _16 from "lodash/fp.js";
1363
+ var getGlobalRights = _16.get("entities.globalRights");
1364
+
1360
1365
  // src/reducers/entities.ts
1361
1366
  init_define_import_meta();
1362
1367
  import { makeReducer } from "@lls/utils";
1363
- import _16 from "lodash/fp.js";
1368
+ import _17 from "lodash/fp.js";
1364
1369
 
1365
1370
  // src/actions/index.ts
1366
1371
  init_define_import_meta();
@@ -1383,16 +1388,16 @@ var resetAuth = makeActionCreator(actionTypes.RESET_AUTH);
1383
1388
  // src/reducers/entities.ts
1384
1389
  var deleteEntityReducer = (state, payload) => {
1385
1390
  const { path } = payload;
1386
- return _16.omit(path, state);
1391
+ return _17.omit(path, state);
1387
1392
  };
1388
1393
  var updateEntityReducer = (state, payload) => {
1389
1394
  const { path, entity } = payload;
1390
- const currentEntity = _16.get(path, state);
1391
- return _16.set(path, _16.merge(currentEntity, entity), state);
1395
+ const currentEntity = _17.get(path, state);
1396
+ return _17.set(path, _17.merge(currentEntity, entity), state);
1392
1397
  };
1393
1398
  var setEntityReducer = (state, payload) => {
1394
1399
  const { path, entity } = payload;
1395
- return _16.set(path, entity, state);
1400
+ return _17.set(path, entity, state);
1396
1401
  };
1397
1402
  var setEntitiesReducer = (state, payload) => {
1398
1403
  if (typeof payload !== "object") return state;
@@ -1413,7 +1418,7 @@ var setEntitiesReducer = (state, payload) => {
1413
1418
  }
1414
1419
  const diff = Object.keys(entity).some((prop) => {
1415
1420
  const value = entity[prop];
1416
- if (!_16.isEqual(state[entityName]?.[id]?.[prop], value)) {
1421
+ if (!_17.isEqual(state[entityName]?.[id]?.[prop], value)) {
1417
1422
  return true;
1418
1423
  }
1419
1424
  });
@@ -1445,7 +1450,7 @@ var entities_default = entities;
1445
1450
  // src/reducers/auth.ts
1446
1451
  init_define_import_meta();
1447
1452
  import { makeReducer as makeReducer2 } from "@lls/utils";
1448
- import _17 from "lodash/fp.js";
1453
+ import _18 from "lodash/fp.js";
1449
1454
  var initialState = {
1450
1455
  id: void 0,
1451
1456
  role: null,
@@ -1458,15 +1463,15 @@ var initialState = {
1458
1463
  llsUserId: null
1459
1464
  };
1460
1465
  var auth = makeReducer2(initialState, {
1461
- [actionTypes.SET_AUTH]: _17.assign,
1462
- [actionTypes.RESET_AUTH]: _17.constant(initialState)
1466
+ [actionTypes.SET_AUTH]: _18.assign,
1467
+ [actionTypes.RESET_AUTH]: _18.constant(initialState)
1463
1468
  });
1464
1469
  var auth_default = auth;
1465
1470
 
1466
1471
  // src/schema/index.ts
1467
1472
  init_define_import_meta();
1468
1473
  var import_normalizr = __toESM(require_normalizr(), 1);
1469
- import _18 from "lodash/fp.js";
1474
+ import _19 from "lodash/fp.js";
1470
1475
  var document = new import_normalizr.schema.Entity("documents");
1471
1476
  var documentType = new import_normalizr.schema.Entity("documentTypes");
1472
1477
  var subDocumentType = new import_normalizr.schema.Entity("subDocumentTypes");
@@ -1485,6 +1490,14 @@ var product = new import_normalizr.schema.Entity("products");
1485
1490
  var communityProjects = new import_normalizr.schema.Entity("communityProjects");
1486
1491
  var builderIo = new import_normalizr.schema.Entity("builderIos");
1487
1492
  var lexicalFlower = new import_normalizr.schema.Entity("lexicalFlowers");
1493
+ var globalRights = new import_normalizr.schema.Entity(
1494
+ "globalRights",
1495
+ {},
1496
+ {
1497
+ idAttribute: (_20, __, key) => key
1498
+ // Use keys from globalRights(anonymous, classroom, connected, teacher) as Id
1499
+ }
1500
+ );
1488
1501
  var grammarRule = new import_normalizr.schema.Entity("grammarRules", {}, { idAttribute: "objectID" });
1489
1502
  var mainNotification = new import_normalizr.schema.Entity("mainNotifications");
1490
1503
  var explorerResult = new import_normalizr.schema.Entity("explorerResults", {}, { idAttribute: "resourceId" });
@@ -1647,6 +1660,7 @@ var querySchema = {
1647
1660
  subDocumentTypes: { hits: [subDocumentType] },
1648
1661
  explorerResults: [explorerResult],
1649
1662
  levels: [level],
1663
+ globalRights: new import_normalizr.schema.Values(globalRights),
1650
1664
  me: user,
1651
1665
  // mutations
1652
1666
  pages: { hits: [page] },
@@ -1685,7 +1699,7 @@ var querySchema = {
1685
1699
  }
1686
1700
  }
1687
1701
  };
1688
- var normalizeData = _18.flow((data) => (0, import_normalizr.normalize)(data, querySchema));
1702
+ var normalizeData = _19.flow((data) => (0, import_normalizr.normalize)(data, querySchema));
1689
1703
  export {
1690
1704
  auth_default as authReducer,
1691
1705
  entities_default as entitiesReducer,
@@ -1707,6 +1721,7 @@ export {
1707
1721
  getContact,
1708
1722
  getContacts,
1709
1723
  getCurrentUser,
1724
+ getDocument,
1710
1725
  getDocumentType,
1711
1726
  getDocumentTypes,
1712
1727
  getDraft,
@@ -1714,6 +1729,7 @@ export {
1714
1729
  getFaqs,
1715
1730
  getGarDivision,
1716
1731
  getGarDivisions,
1732
+ getGlobalRights,
1717
1733
  getGroup,
1718
1734
  getGroups,
1719
1735
  getIsLogged,
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.11.0-e34d1cd7",
5
+ "version": "24.11.0-e9365b71",
6
6
  "type": "module",
7
7
  "types": "./lib/builttypes/store/src/index.d.ts",
8
8
  "exports": {
@@ -24,6 +24,7 @@
24
24
  "keywords": [],
25
25
  "peerDependencies": {
26
26
  "@lls/utils": "*",
27
+ "@lls/common": "*",
27
28
  "lodash": "*",
28
29
  "react": "*",
29
30
  "react-redux": "*",
@@ -48,8 +49,9 @@
48
49
  "typescript": "5.6.3",
49
50
  "vite": "5.4.11",
50
51
  "vite-tsconfig-paths": "5.1.3",
51
- "@lls/utils": "24.11.0-e34d1cd7",
52
- "@lls/vitescripts": "24.11.0-e34d1cd7"
52
+ "@lls/common": "24.11.0-e9365b71",
53
+ "@lls/utils": "24.11.0-e9365b71",
54
+ "@lls/vitescripts": "24.11.0-e9365b71"
53
55
  },
54
56
  "license": "ISC",
55
57
  "dependencies": {