@overmap-ai/core 1.0.63-selector-standardization.8 → 1.0.63-selector-standardization.9

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.
@@ -1786,9 +1786,6 @@ const selectLicenses = (state) => {
1786
1786
  return state.licenseReducer.instances;
1787
1787
  };
1788
1788
  const selectLicense = (id) => (state) => state.licenseReducer.instances[id];
1789
- const selectActiveLicense = (state) => Object.values(state.licenseReducer.instances).find(
1790
- (license) => license.project === state.projectReducer.activeProjectId
1791
- ) ?? null;
1792
1789
  const selectLicenseForProject = (projectId) => (state) => Object.values(state.licenseReducer.instances).find((license) => license.project === projectId);
1793
1790
  const selectActiveStatusLicenses = createSelector(
1794
1791
  [selectLicenses],
@@ -4708,13 +4705,11 @@ class AssetAttachmentService extends BaseAttachmentService {
4708
4705
  class AssetTypeService extends BaseApiService {
4709
4706
  add(assetType) {
4710
4707
  const offlineAssetType = offline(assetType);
4711
- const { store } = this.client;
4712
- const activeProjectId = store.getState().projectReducer.activeProjectId;
4713
4708
  this.dispatch(addAssetType(offlineAssetType));
4714
4709
  const promise = this.enqueueRequest({
4715
4710
  description: "Create asset type",
4716
4711
  method: HttpMethod.POST,
4717
- url: `/projects/${activeProjectId}/asset-types/`,
4712
+ url: `/projects/${assetType.project}/asset-types/`,
4718
4713
  payload: { ...offlineAssetType },
4719
4714
  blockers: [],
4720
4715
  blocks: [offlineAssetType.offline_id]
@@ -5709,10 +5704,6 @@ class FormService extends BaseUploadService {
5709
5704
  const offlineRevision = offline(revision);
5710
5705
  const { store } = this.client;
5711
5706
  const state = store.getState();
5712
- const activeProjectId = state.projectReducer.activeProjectId;
5713
- if (!activeProjectId) {
5714
- throw new Error("Cannot create form revision when there is no active project.");
5715
- }
5716
5707
  const currentUserId = state.userReducer.currentUser.id;
5717
5708
  const { fields, images } = await separateImageFromFields(offlineRevision.fields);
5718
5709
  const fullRevision = {
@@ -5751,10 +5742,9 @@ class FormService extends BaseUploadService {
5751
5742
  });
5752
5743
  return [fullRevision, offlineFormRevisionAttachments, promise, attachmentsPromise];
5753
5744
  }
5754
- async favorite(formId) {
5745
+ async favorite(formId, projectId) {
5755
5746
  const { store } = this.client;
5756
5747
  const state = store.getState();
5757
- const activeProjectId = state.projectReducer.activeProjectId;
5758
5748
  const form = state.formReducer.instances[formId];
5759
5749
  if (!form) {
5760
5750
  throw new Error(`Expected form to exist, got ${form}`);
@@ -5764,7 +5754,7 @@ class FormService extends BaseUploadService {
5764
5754
  await this.enqueueRequest({
5765
5755
  description: "Favorite form",
5766
5756
  method: HttpMethod.POST,
5767
- url: `/forms/${formId}/favorite/${activeProjectId}/`,
5757
+ url: `/forms/${formId}/favorite/${projectId}/`,
5768
5758
  blockers: [formId, `favorite-${formId}`],
5769
5759
  blocks: [`favorite-${formId}`]
5770
5760
  });
@@ -5773,10 +5763,9 @@ class FormService extends BaseUploadService {
5773
5763
  throw e;
5774
5764
  }
5775
5765
  }
5776
- async unfavorite(formId) {
5766
+ async unfavorite(formId, projectId) {
5777
5767
  const { store } = this.client;
5778
5768
  const state = store.getState();
5779
- const activeProjectId = state.projectReducer.activeProjectId;
5780
5769
  const form = state.formReducer.instances[formId];
5781
5770
  if (!form) {
5782
5771
  throw new Error(`Expected form to exist, got ${form}`);
@@ -5786,7 +5775,7 @@ class FormService extends BaseUploadService {
5786
5775
  return await this.enqueueRequest({
5787
5776
  description: "Unfavorite form",
5788
5777
  method: HttpMethod.DELETE,
5789
- url: `/forms/${formId}/unfavorite/${activeProjectId}/`,
5778
+ url: `/forms/${formId}/unfavorite/${projectId}/`,
5790
5779
  blockers: [formId, `favorite-${formId}`],
5791
5780
  blocks: [`favorite-${formId}`]
5792
5781
  });
@@ -5998,10 +5987,6 @@ class FormSubmissionService extends BaseUploadService {
5998
5987
  async add(payload) {
5999
5988
  const { store } = this.client;
6000
5989
  const state = store.getState();
6001
- const activeProjectId = state.projectReducer.activeProjectId;
6002
- if (!activeProjectId) {
6003
- throw new Error("Expected an active project");
6004
- }
6005
5990
  const { values, files } = separateFilesFromValues(payload.values);
6006
5991
  const offlineSubmission = offline({
6007
5992
  ...payload,
@@ -6013,7 +5998,7 @@ class FormSubmissionService extends BaseUploadService {
6013
5998
  description: "Respond to form",
6014
5999
  method: HttpMethod.POST,
6015
6000
  url: `/forms/revisions/${payload.form_revision}/respond/`,
6016
- payload: { ...offlineSubmission, project: activeProjectId },
6001
+ payload: offlineSubmission,
6017
6002
  blockers: [payload.issue, payload.asset, payload.asset_stage, "add-form-entry"].filter(
6018
6003
  (x) => x !== void 0
6019
6004
  ),
@@ -6234,13 +6219,12 @@ class FormSubmissionService extends BaseUploadService {
6234
6219
  }
6235
6220
  class WorkspaceService extends BaseApiService {
6236
6221
  add(workspace) {
6237
- const { store } = this.client;
6238
6222
  const offlineWorkspace = offline(workspace);
6239
6223
  this.dispatch(addWorkspace(offlineWorkspace));
6240
6224
  const promise = this.enqueueRequest({
6241
6225
  description: "Create Workspace",
6242
6226
  method: HttpMethod.POST,
6243
- url: `/projects/${store.getState().projectReducer.activeProjectId}/workspaces/`,
6227
+ url: `/projects/${workspace.project}/workspaces/`,
6244
6228
  payload: offlineWorkspace,
6245
6229
  blockers: ["add-workspace"],
6246
6230
  blocks: [offlineWorkspace.offline_id]
@@ -7764,7 +7748,6 @@ export {
7764
7748
  saveActiveProjectFileBounds,
7765
7749
  searchIssues,
7766
7750
  selectAccessToken,
7767
- selectActiveLicense,
7768
7751
  selectActiveOrganizationAccess,
7769
7752
  selectActiveProject,
7770
7753
  selectActiveProjectAccess,