@overmap-ai/core 1.0.38-component-fields.28 → 1.0.38-component-fields.30

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,
@@ -3328,7 +3346,7 @@ const selectNumberOfUserForms = createSelector([selectUserFormMapping], (userFor
3328
3346
  return Object.keys(userForms).length;
3329
3347
  });
3330
3348
  const selectNumberOfGeneralUserForms = createSelector([selectUserFormMapping], (userForms) => {
3331
- return Object.values(userForms).filter((form) => !form.component_type && !form.component_stage).length;
3349
+ return Object.values(userForms).filter((form) => !form.component_type).length;
3332
3350
  });
3333
3351
  const userFormReducer = userFormSlice.reducer;
3334
3352
  const initialState$1 = {
@@ -5640,6 +5658,46 @@ class UserFormService extends BaseApiService {
5640
5658
  throw e;
5641
5659
  }
5642
5660
  }
5661
+ async attachToComponentStage(formId2, componentStageId) {
5662
+ const { store } = this.client;
5663
+ store.dispatch(attachFormToComponentStage({ formId: formId2, componentStageId }));
5664
+ try {
5665
+ await this.enqueueRequest({
5666
+ description: "Attach form to component stage",
5667
+ method: HttpMethod.PATCH,
5668
+ url: `/forms/${formId2}/`,
5669
+ payload: { component_stage: componentStageId },
5670
+ queryParams: {
5671
+ component_stage: componentStageId
5672
+ },
5673
+ blockers: [formId2, componentStageId],
5674
+ blocks: [formId2]
5675
+ });
5676
+ } catch (e) {
5677
+ store.dispatch(removeFormFromComponentStage({ formId: formId2 }));
5678
+ throw e;
5679
+ }
5680
+ }
5681
+ async removeFromComponentStage(formId2, componentStageId) {
5682
+ const { store } = this.client;
5683
+ store.dispatch(removeFormFromComponentStage({ formId: formId2 }));
5684
+ try {
5685
+ await this.enqueueRequest({
5686
+ description: "Remove form from component stage",
5687
+ method: HttpMethod.PATCH,
5688
+ url: `/forms/${formId2}/`,
5689
+ payload: { component_stage: void 0 },
5690
+ queryParams: {
5691
+ component_stage: componentStageId
5692
+ },
5693
+ blockers: [formId2, componentStageId],
5694
+ blocks: [formId2]
5695
+ });
5696
+ } catch (e) {
5697
+ store.dispatch(attachFormToComponentStage({ formId: formId2, componentStageId }));
5698
+ throw e;
5699
+ }
5700
+ }
5643
5701
  async delete(formId2) {
5644
5702
  const { store } = this.client;
5645
5703
  const state = store.getState();
@@ -10464,9 +10522,9 @@ const FormBrowser = memo(
10464
10522
  }, [filter, maxResults, ownerFilter]);
10465
10523
  const userForms = useAppSelector(selectFilteredUserForms(ownerFilterOptions)) ?? [];
10466
10524
  const userFormMapping = useAppSelector(selectUserFormMapping);
10467
- const attachableUserForms = userForms.filter((form) => !form.component_type && !form.component_stage);
10525
+ const attachableUserForms = userForms.filter((form) => !form.component_type);
10468
10526
  const attachableUserFormMapping = Object.values(userFormMapping).filter(
10469
- (form) => !form.component_type && !form.component_stage
10527
+ (form) => !form.component_type
10470
10528
  );
10471
10529
  const handleToggleFavorite = useCallback(
10472
10530
  (form) => {
@@ -11976,6 +12034,7 @@ export {
11976
12034
  addUsers,
11977
12035
  addWorkspace,
11978
12036
  areArraysEqual,
12037
+ attachFormToComponentStage,
11979
12038
  authReducer,
11980
12039
  authSlice,
11981
12040
  blobToBase64,
@@ -12098,6 +12157,7 @@ export {
12098
12157
  removeComponent,
12099
12158
  removeEmailDomain,
12100
12159
  removeFavouriteProjectId,
12160
+ removeFormFromComponentStage,
12101
12161
  removeIssue,
12102
12162
  removeIssueComment,
12103
12163
  removeOrganizationAccess,