@overmap-ai/core 1.0.65-bulk-form-submit.0 → 1.0.65-current-user-cleaup.0

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.
@@ -645,7 +645,7 @@ var __publicField = (obj, key, value) => {
645
645
  const fullAssetMarkerSize = 45;
646
646
  const DEFAULT_ISSUE_STATUS = IssueStatus.BACKLOG;
647
647
  const DEFAULT_ISSUE_PRIORITY = IssuePriority.MEDIUM;
648
- const OUTBOX_RETRY_DELAY = 5e3;
648
+ const OUTBOX_RETRY_DELAY = 6e4;
649
649
  const EMPTY_ARRAY = Object.freeze([]);
650
650
  let debug = false;
651
651
  const REACT_APP_DEBUG_MEMOIZATION = {}.REACT_APP_DEBUG_MEMOIZATION || "";
@@ -1621,12 +1621,7 @@ var __publicField = (obj, key, value) => {
1621
1621
  })(LicenseStatus || {});
1622
1622
  const initialState$p = {
1623
1623
  users: {},
1624
- currentUser: {
1625
- id: 0,
1626
- username: "",
1627
- email: "",
1628
- profile: { file: null, file_sha1: null, favourite_project_ids: [], tour_step: -1 }
1629
- }
1624
+ currentUser: null
1630
1625
  };
1631
1626
  const userSlice = toolkit.createSlice({
1632
1627
  name: "users",
@@ -1649,6 +1644,8 @@ var __publicField = (obj, key, value) => {
1649
1644
  state.currentUser = action.payload;
1650
1645
  },
1651
1646
  setProfilePicture: (state, action) => {
1647
+ if (!state.currentUser)
1648
+ return;
1652
1649
  state.currentUser.profile.file = action.payload.file ?? null;
1653
1650
  state.currentUser.profile.file_sha1 = action.payload.file_sha1 ?? null;
1654
1651
  const currentUser = state.users[state.currentUser.id];
@@ -1658,32 +1655,12 @@ var __publicField = (obj, key, value) => {
1658
1655
  currentUser.profile.file = action.payload.file ?? null;
1659
1656
  currentUser.profile.file_sha1 = action.payload.file_sha1 ?? null;
1660
1657
  },
1661
- addFavouriteProjectId: (state, action) => {
1662
- state.currentUser.profile.favourite_project_ids.push(action.payload);
1663
- },
1664
- removeFavouriteProjectId: (state, action) => {
1665
- state.currentUser.profile.favourite_project_ids = state.currentUser.profile.favourite_project_ids.filter(
1666
- (id) => id !== action.payload
1667
- );
1668
- },
1669
- setTourStep: (state, action) => {
1670
- state.currentUser.profile.tour_step = action.payload;
1671
- },
1672
1658
  removeUser: (state, action) => {
1673
1659
  delete state.users[action.payload];
1674
1660
  }
1675
1661
  }
1676
1662
  });
1677
- const {
1678
- setCurrentUser,
1679
- setProfilePicture,
1680
- setUsers,
1681
- addUsers,
1682
- addFavouriteProjectId,
1683
- removeFavouriteProjectId,
1684
- setTourStep,
1685
- removeUser
1686
- } = userSlice.actions;
1663
+ const { setCurrentUser, setProfilePicture, setUsers, addUsers, removeUser } = userSlice.actions;
1687
1664
  const userReducer = userSlice.reducer;
1688
1665
  const selectCurrentUser = (state) => state.userReducer.currentUser;
1689
1666
  const selectUsersMapping = (state) => state.userReducer.users;
@@ -1704,7 +1681,6 @@ var __publicField = (obj, key, value) => {
1704
1681
  return fallbackToEmptyArray(users);
1705
1682
  })
1706
1683
  );
1707
- const selectFavouriteProjects = (state) => state.userReducer.currentUser.profile.favourite_project_ids;
1708
1684
  const organizationAccessAdapter = createModelAdapter(
1709
1685
  (organizationAccess) => organizationAccess.offline_id
1710
1686
  );
@@ -1730,7 +1706,7 @@ var __publicField = (obj, key, value) => {
1730
1706
  [selectCurrentUser, selectOrganizationAccesses],
1731
1707
  (currentUser, organizationAccesses) => {
1732
1708
  const activeOrganizationAccess = Object.values(organizationAccesses).find(
1733
- (organizationAccess) => organizationAccess.user === currentUser.id
1709
+ (organizationAccess) => organizationAccess.user === (currentUser == null ? void 0 : currentUser.id)
1734
1710
  );
1735
1711
  return activeOrganizationAccess ?? null;
1736
1712
  }
@@ -1920,9 +1896,9 @@ var __publicField = (obj, key, value) => {
1920
1896
  [selectCurrentUser, selectProjectUsersAsMapping, selectProjectAccessUserMapping],
1921
1897
  (currentUser, userMapping, projectAccessMapping) => {
1922
1898
  return Object.values(userMapping).sort((userA, userB) => {
1923
- if (userA.id === currentUser.id) {
1899
+ if (userA.id === (currentUser == null ? void 0 : currentUser.id)) {
1924
1900
  return -1;
1925
- } else if (userB.id === currentUser.id) {
1901
+ } else if (userB.id === (currentUser == null ? void 0 : currentUser.id)) {
1926
1902
  return 1;
1927
1903
  }
1928
1904
  const projectAccessesA = projectAccessMapping[userA.id];
@@ -1999,9 +1975,9 @@ var __publicField = (obj, key, value) => {
1999
1975
  [selectCurrentUser, selectOrganizationUsersAsMapping, selectOrganizationAccessUserMapping],
2000
1976
  (currentUser, userMapping, organizationAccessMapping) => {
2001
1977
  return Object.values(userMapping).sort((userA, userB) => {
2002
- if (userA.id === currentUser.id) {
1978
+ if (userA.id === (currentUser == null ? void 0 : currentUser.id)) {
2003
1979
  return -1;
2004
- } else if (userB.id === currentUser.id) {
1980
+ } else if (userB.id === (currentUser == null ? void 0 : currentUser.id)) {
2005
1981
  return 1;
2006
1982
  }
2007
1983
  const organizationAccessesA = organizationAccessMapping[userA.id];
@@ -6211,22 +6187,50 @@ var __publicField = (obj, key, value) => {
6211
6187
  }
6212
6188
  }
6213
6189
  async refreshStore(projectId) {
6214
- const submissions = await this.enqueueRequest({
6215
- description: "Fetch form submissions",
6190
+ const formSubmissions = {};
6191
+ const modelSubmissions = await this.enqueueRequest({
6192
+ description: "Fetch model submissions",
6216
6193
  method: HttpMethod.GET,
6217
- url: `/forms/in-project/${projectId}/submissions/`,
6194
+ url: `/forms/in-project/${projectId}/submissions/model/latest/`,
6218
6195
  blockers: [],
6219
6196
  blocks: []
6220
6197
  });
6221
- this.dispatch(initializeFormSubmissions(submissions));
6222
- const attachments = await this.enqueueRequest({
6223
- description: "Fetch form attachments",
6198
+ for (const modelSubmission of modelSubmissions) {
6199
+ formSubmissions[modelSubmission.offline_id] = modelSubmission;
6200
+ }
6201
+ const standaloneSubmissions = await this.enqueueRequest({
6202
+ description: "Fetch standalone submissions",
6224
6203
  method: HttpMethod.GET,
6225
- url: `/forms/in-project/${projectId}/attachments/`,
6204
+ url: `/forms/in-project/${projectId}/submissions/standalone/`,
6226
6205
  blockers: [],
6227
6206
  blocks: []
6228
6207
  });
6229
- this.dispatch(initializeFormSubmissionAttachments(attachments));
6208
+ for (const standaloneSubmission of standaloneSubmissions) {
6209
+ formSubmissions[standaloneSubmission.offline_id] = standaloneSubmission;
6210
+ }
6211
+ this.dispatch(initializeFormSubmissions(Object.values(formSubmissions)));
6212
+ const attachments = {};
6213
+ const modelAttachments = await this.enqueueRequest({
6214
+ description: "Fetch model submission attachments",
6215
+ method: HttpMethod.GET,
6216
+ url: `/forms/in-project/${projectId}/attachments/model/latest/`,
6217
+ blockers: [],
6218
+ blocks: []
6219
+ });
6220
+ for (const modelAttachment of modelAttachments) {
6221
+ attachments[modelAttachment.offline_id] = modelAttachment;
6222
+ }
6223
+ const standaloneAttachments = await this.enqueueRequest({
6224
+ description: "Fetch standalone submission attachments",
6225
+ method: HttpMethod.GET,
6226
+ url: `/forms/in-project/${projectId}/attachments/standalone/`,
6227
+ blockers: [],
6228
+ blocks: []
6229
+ });
6230
+ for (const standaloneAttachent of standaloneAttachments) {
6231
+ attachments[standaloneAttachent.offline_id] = standaloneAttachent;
6232
+ }
6233
+ this.dispatch(initializeFormSubmissionAttachments(Object.values(attachments)));
6230
6234
  }
6231
6235
  }
6232
6236
  class WorkspaceService extends BaseApiService {
@@ -7593,7 +7597,6 @@ var __publicField = (obj, key, value) => {
7593
7597
  exports2.addDocumentAttachments = addDocumentAttachments;
7594
7598
  exports2.addDocuments = addDocuments;
7595
7599
  exports2.addEmailDomain = addEmailDomain;
7596
- exports2.addFavouriteProjectId = addFavouriteProjectId;
7597
7600
  exports2.addForm = addForm;
7598
7601
  exports2.addFormRevision = addFormRevision;
7599
7602
  exports2.addFormRevisionAttachment = addFormRevisionAttachment;
@@ -7823,7 +7826,6 @@ var __publicField = (obj, key, value) => {
7823
7826
  exports2.rehydratedReducer = rehydratedReducer;
7824
7827
  exports2.rehydratedSlice = rehydratedSlice;
7825
7828
  exports2.removeDocuments = removeDocuments;
7826
- exports2.removeFavouriteProjectId = removeFavouriteProjectId;
7827
7829
  exports2.removeIssueType = removeIssueType;
7828
7830
  exports2.removeProjectFile = removeProjectFile;
7829
7831
  exports2.removeProjectFilesOfProject = removeProjectFilesOfProject;
@@ -7902,7 +7904,6 @@ var __publicField = (obj, key, value) => {
7902
7904
  exports2.selectEmailDomains = selectEmailDomains;
7903
7905
  exports2.selectEmailDomainsAsMapping = selectEmailDomainsAsMapping;
7904
7906
  exports2.selectEmailDomainsOfOrganization = selectEmailDomainsOfOrganization;
7905
- exports2.selectFavouriteProjects = selectFavouriteProjects;
7906
7907
  exports2.selectFilteredForms = selectFilteredForms;
7907
7908
  exports2.selectFormById = selectFormById;
7908
7909
  exports2.selectFormMapping = selectFormMapping;
@@ -8059,7 +8060,6 @@ var __publicField = (obj, key, value) => {
8059
8060
  exports2.setStageCompletions = setStageCompletions;
8060
8061
  exports2.setTeam = setTeam;
8061
8062
  exports2.setTokens = setTokens;
8062
- exports2.setTourStep = setTourStep;
8063
8063
  exports2.setUploadUrl = setUploadUrl;
8064
8064
  exports2.setUsers = setUsers;
8065
8065
  exports2.setWorkspaces = setWorkspaces;