@overmap-ai/core 1.0.38-component-fields.29 → 1.0.38-component-fields.31

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.
@@ -3097,6 +3097,22 @@ const userFormSlice = createSlice({
3097
3097
  }
3098
3098
  form.favorite = false;
3099
3099
  },
3100
+ attachFormToComponentStage: (state, action) => {
3101
+ const { formId: formId2, componentStageId } = action.payload;
3102
+ const form = state.userForms[formId2];
3103
+ if (!form) {
3104
+ throw new Error("No form exists with the id " + formId2);
3105
+ }
3106
+ form.component_stage = componentStageId;
3107
+ },
3108
+ removeFormFromComponentStage: (state, action) => {
3109
+ const { formId: formId2 } = action.payload;
3110
+ const form = state.userForms[formId2];
3111
+ if (!form) {
3112
+ throw new Error("No form exists with the id " + formId2);
3113
+ }
3114
+ form.component_stage = void 0;
3115
+ },
3100
3116
  deleteUserForm: (state, action) => {
3101
3117
  delete state.userForms[action.payload];
3102
3118
  }
@@ -3112,6 +3128,8 @@ const {
3112
3128
  deleteUserFormSubmissions,
3113
3129
  favoriteForm,
3114
3130
  unfavoriteForm,
3131
+ attachFormToComponentStage,
3132
+ removeFormFromComponentStage,
3115
3133
  deleteUserForm,
3116
3134
  deleteUserFormRevision,
3117
3135
  deleteUserFormRevisions,
@@ -5640,6 +5658,56 @@ class UserFormService extends BaseApiService {
5640
5658
  throw e;
5641
5659
  }
5642
5660
  }
5661
+ async attachToComponentStage(formId2, componentStageId) {
5662
+ const { store } = this.client;
5663
+ const activeProjectId = store.getState().projectReducer.activeProjectId;
5664
+ if (!activeProjectId) {
5665
+ throw new Error("Expected an active project.");
5666
+ }
5667
+ store.dispatch(attachFormToComponentStage({ formId: formId2, componentStageId }));
5668
+ try {
5669
+ await this.enqueueRequest({
5670
+ description: "Attach form to component stage",
5671
+ method: HttpMethod.PATCH,
5672
+ url: `/forms/${formId2}/`,
5673
+ payload: { component_stage: componentStageId },
5674
+ queryParams: {
5675
+ project_id: activeProjectId.toString(),
5676
+ component_stage: componentStageId
5677
+ },
5678
+ blockers: [formId2, componentStageId],
5679
+ blocks: [formId2]
5680
+ });
5681
+ } catch (e) {
5682
+ store.dispatch(removeFormFromComponentStage({ formId: formId2 }));
5683
+ throw e;
5684
+ }
5685
+ }
5686
+ async removeFromComponentStage(formId2, componentStageId) {
5687
+ const { store } = this.client;
5688
+ const activeProjectId = store.getState().projectReducer.activeProjectId;
5689
+ if (!activeProjectId) {
5690
+ throw new Error("Expected an active project.");
5691
+ }
5692
+ store.dispatch(removeFormFromComponentStage({ formId: formId2 }));
5693
+ try {
5694
+ await this.enqueueRequest({
5695
+ description: "Remove form from component stage",
5696
+ method: HttpMethod.PATCH,
5697
+ url: `/forms/${formId2}/`,
5698
+ payload: { component_stage: void 0 },
5699
+ queryParams: {
5700
+ project_id: activeProjectId.toString(),
5701
+ component_stage: componentStageId
5702
+ },
5703
+ blockers: [formId2, componentStageId],
5704
+ blocks: [formId2]
5705
+ });
5706
+ } catch (e) {
5707
+ store.dispatch(attachFormToComponentStage({ formId: formId2, componentStageId }));
5708
+ throw e;
5709
+ }
5710
+ }
5643
5711
  async delete(formId2) {
5644
5712
  const { store } = this.client;
5645
5713
  const state = store.getState();
@@ -11976,6 +12044,7 @@ export {
11976
12044
  addUsers,
11977
12045
  addWorkspace,
11978
12046
  areArraysEqual,
12047
+ attachFormToComponentStage,
11979
12048
  authReducer,
11980
12049
  authSlice,
11981
12050
  blobToBase64,
@@ -12098,6 +12167,7 @@ export {
12098
12167
  removeComponent,
12099
12168
  removeEmailDomain,
12100
12169
  removeFavouriteProjectId,
12170
+ removeFormFromComponentStage,
12101
12171
  removeIssue,
12102
12172
  removeIssueComment,
12103
12173
  removeOrganizationAccess,