@overmap-ai/core 1.0.65-asset-models-improvements.3 → 1.0.65-asset-models-improvements.5

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.
@@ -1618,12 +1618,7 @@ var __publicField = (obj, key, value) => {
1618
1618
  const fileReducer = fileSlice.reducer;
1619
1619
  const initialState$p = {
1620
1620
  users: {},
1621
- currentUser: {
1622
- id: 0,
1623
- username: "",
1624
- email: "",
1625
- profile: { file: null, file_sha1: null, favourite_project_ids: [], tour_step: -1 }
1626
- }
1621
+ currentUser: null
1627
1622
  };
1628
1623
  const userSlice = toolkit.createSlice({
1629
1624
  name: "users",
@@ -1646,6 +1641,8 @@ var __publicField = (obj, key, value) => {
1646
1641
  state.currentUser = action.payload;
1647
1642
  },
1648
1643
  setProfilePicture: (state, action) => {
1644
+ if (!state.currentUser)
1645
+ return;
1649
1646
  state.currentUser.profile.file = action.payload.file ?? null;
1650
1647
  state.currentUser.profile.file_sha1 = action.payload.file_sha1 ?? null;
1651
1648
  const currentUser = state.users[state.currentUser.id];
@@ -1655,32 +1652,12 @@ var __publicField = (obj, key, value) => {
1655
1652
  currentUser.profile.file = action.payload.file ?? null;
1656
1653
  currentUser.profile.file_sha1 = action.payload.file_sha1 ?? null;
1657
1654
  },
1658
- addFavouriteProjectId: (state, action) => {
1659
- state.currentUser.profile.favourite_project_ids.push(action.payload);
1660
- },
1661
- removeFavouriteProjectId: (state, action) => {
1662
- state.currentUser.profile.favourite_project_ids = state.currentUser.profile.favourite_project_ids.filter(
1663
- (id) => id !== action.payload
1664
- );
1665
- },
1666
- setTourStep: (state, action) => {
1667
- state.currentUser.profile.tour_step = action.payload;
1668
- },
1669
1655
  removeUser: (state, action) => {
1670
1656
  delete state.users[action.payload];
1671
1657
  }
1672
1658
  }
1673
1659
  });
1674
- const {
1675
- setCurrentUser,
1676
- setProfilePicture,
1677
- setUsers,
1678
- addUsers,
1679
- addFavouriteProjectId,
1680
- removeFavouriteProjectId,
1681
- setTourStep,
1682
- removeUser
1683
- } = userSlice.actions;
1660
+ const { setCurrentUser, setProfilePicture, setUsers, addUsers, removeUser } = userSlice.actions;
1684
1661
  const userReducer = userSlice.reducer;
1685
1662
  const selectCurrentUser = (state) => state.userReducer.currentUser;
1686
1663
  const selectUsersMapping = (state) => state.userReducer.users;
@@ -1701,7 +1678,6 @@ var __publicField = (obj, key, value) => {
1701
1678
  return fallbackToEmptyArray(users);
1702
1679
  })
1703
1680
  );
1704
- const selectFavouriteProjects = (state) => state.userReducer.currentUser.profile.favourite_project_ids;
1705
1681
  const organizationAccessAdapter = createModelAdapter(
1706
1682
  (organizationAccess) => organizationAccess.offline_id
1707
1683
  );
@@ -1727,7 +1703,7 @@ var __publicField = (obj, key, value) => {
1727
1703
  [selectCurrentUser, selectOrganizationAccesses],
1728
1704
  (currentUser, organizationAccesses) => {
1729
1705
  const activeOrganizationAccess = Object.values(organizationAccesses).find(
1730
- (organizationAccess) => organizationAccess.user === currentUser.id
1706
+ (organizationAccess) => organizationAccess.user === (currentUser == null ? void 0 : currentUser.id)
1731
1707
  );
1732
1708
  return activeOrganizationAccess ?? null;
1733
1709
  }
@@ -1917,9 +1893,9 @@ var __publicField = (obj, key, value) => {
1917
1893
  [selectCurrentUser, selectProjectUsersAsMapping, selectProjectAccessUserMapping],
1918
1894
  (currentUser, userMapping, projectAccessMapping) => {
1919
1895
  return Object.values(userMapping).sort((userA, userB) => {
1920
- if (userA.id === currentUser.id) {
1896
+ if (userA.id === (currentUser == null ? void 0 : currentUser.id)) {
1921
1897
  return -1;
1922
- } else if (userB.id === currentUser.id) {
1898
+ } else if (userB.id === (currentUser == null ? void 0 : currentUser.id)) {
1923
1899
  return 1;
1924
1900
  }
1925
1901
  const projectAccessesA = projectAccessMapping[userA.id];
@@ -1996,9 +1972,9 @@ var __publicField = (obj, key, value) => {
1996
1972
  [selectCurrentUser, selectOrganizationUsersAsMapping, selectOrganizationAccessUserMapping],
1997
1973
  (currentUser, userMapping, organizationAccessMapping) => {
1998
1974
  return Object.values(userMapping).sort((userA, userB) => {
1999
- if (userA.id === currentUser.id) {
1975
+ if (userA.id === (currentUser == null ? void 0 : currentUser.id)) {
2000
1976
  return -1;
2001
- } else if (userB.id === currentUser.id) {
1977
+ } else if (userB.id === (currentUser == null ? void 0 : currentUser.id)) {
2002
1978
  return 1;
2003
1979
  }
2004
1980
  const organizationAccessesA = organizationAccessMapping[userA.id];
@@ -7714,7 +7690,6 @@ var __publicField = (obj, key, value) => {
7714
7690
  exports2.addDocumentAttachments = addDocumentAttachments;
7715
7691
  exports2.addDocuments = addDocuments;
7716
7692
  exports2.addEmailDomain = addEmailDomain;
7717
- exports2.addFavouriteProjectId = addFavouriteProjectId;
7718
7693
  exports2.addForm = addForm;
7719
7694
  exports2.addFormRevision = addFormRevision;
7720
7695
  exports2.addFormRevisionAttachment = addFormRevisionAttachment;
@@ -7946,7 +7921,6 @@ var __publicField = (obj, key, value) => {
7946
7921
  exports2.rehydratedReducer = rehydratedReducer;
7947
7922
  exports2.rehydratedSlice = rehydratedSlice;
7948
7923
  exports2.removeDocuments = removeDocuments;
7949
- exports2.removeFavouriteProjectId = removeFavouriteProjectId;
7950
7924
  exports2.removeIssueType = removeIssueType;
7951
7925
  exports2.removeProjectFile = removeProjectFile;
7952
7926
  exports2.removeProjectFilesOfProject = removeProjectFilesOfProject;
@@ -8026,7 +8000,6 @@ var __publicField = (obj, key, value) => {
8026
8000
  exports2.selectEmailDomains = selectEmailDomains;
8027
8001
  exports2.selectEmailDomainsAsMapping = selectEmailDomainsAsMapping;
8028
8002
  exports2.selectEmailDomainsOfOrganization = selectEmailDomainsOfOrganization;
8029
- exports2.selectFavouriteProjects = selectFavouriteProjects;
8030
8003
  exports2.selectFilteredForms = selectFilteredForms;
8031
8004
  exports2.selectFormById = selectFormById;
8032
8005
  exports2.selectFormMapping = selectFormMapping;
@@ -8184,7 +8157,6 @@ var __publicField = (obj, key, value) => {
8184
8157
  exports2.setRehydrated = setRehydrated;
8185
8158
  exports2.setTeam = setTeam;
8186
8159
  exports2.setTokens = setTokens;
8187
- exports2.setTourStep = setTourStep;
8188
8160
  exports2.setUploadUrl = setUploadUrl;
8189
8161
  exports2.setUsers = setUsers;
8190
8162
  exports2.setWorkspaces = setWorkspaces;