@overmap-ai/core 1.0.48-form-submission-view.0 → 1.0.48-issue-attachment-bug.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.
@@ -1610,6 +1610,7 @@ const selectComponents = (state) => {
1610
1610
  }
1611
1611
  return prevComponents;
1612
1612
  };
1613
+ const selectComponentsMapping = (state) => state.componentReducer.components;
1613
1614
  const selectComponentsFromComponentType = (componentTypeId) => (state) => {
1614
1615
  if (!componentTypeId)
1615
1616
  return [];
@@ -1640,16 +1641,14 @@ const selectComponentTypeFromComponents = (state) => {
1640
1641
  }
1641
1642
  return ret;
1642
1643
  };
1643
- const selectComponentsByType = (componentTypeId) => (state) => {
1644
- const components = state.componentReducer.components;
1645
- const componentsOfType = [];
1646
- for (const component of Object.values(components)) {
1647
- if (component.component_type === componentTypeId) {
1648
- componentsOfType.push(component);
1644
+ const selectComponentsByType = restructureCreateSelectorWithArgs(
1645
+ createSelector(
1646
+ [selectComponents, (_state, componentTypeId) => componentTypeId],
1647
+ (components, componentTypeId) => {
1648
+ return components.filter((component) => component.component_type === componentTypeId);
1649
1649
  }
1650
- }
1651
- return componentsOfType;
1652
- };
1650
+ )
1651
+ );
1653
1652
  const selectNumberOfComponentsOfComponentType = (componentTypeId) => (state) => {
1654
1653
  var _a2;
1655
1654
  if (!componentTypeId)
@@ -1839,6 +1838,20 @@ const selectStagesFromComponentTypeIds = restructureCreateSelectorWithArgs(
1839
1838
  }
1840
1839
  )
1841
1840
  );
1841
+ const selectComponentTypeStagesMapping = restructureCreateSelectorWithArgs(
1842
+ createSelector(
1843
+ [selectStageMapping, (_state, componentTypeId) => componentTypeId],
1844
+ (stagesMapping, componentTypeId) => {
1845
+ const stagesMappingCopy = { ...stagesMapping };
1846
+ for (const stage in stagesMappingCopy) {
1847
+ if (stagesMappingCopy[stage].component_type !== componentTypeId) {
1848
+ delete stagesMappingCopy[stage];
1849
+ }
1850
+ }
1851
+ return stagesMappingCopy;
1852
+ }
1853
+ )
1854
+ );
1842
1855
  const selectStagesFromComponentType = restructureCreateSelectorWithArgs(
1843
1856
  createSelector(
1844
1857
  [selectStages, (_state, componentTypeId) => componentTypeId],
@@ -3700,6 +3713,23 @@ const selectSubmissionsForComponent = restructureCreateSelectorWithArgs(
3700
3713
  }
3701
3714
  )
3702
3715
  );
3716
+ const selectComponentSubmissionMapping = createSelector(
3717
+ [selectSubmissionMapping, selectComponentsMapping],
3718
+ (submissions, components) => {
3719
+ var _a2;
3720
+ const componentSubmissionMapping = {};
3721
+ for (const componentId in components) {
3722
+ componentSubmissionMapping[componentId] = [];
3723
+ }
3724
+ for (const submissionId in submissions) {
3725
+ const submission = submissions[submissionId];
3726
+ if (submission.component) {
3727
+ (_a2 = componentSubmissionMapping[submission.component]) == null ? void 0 : _a2.push(submission);
3728
+ }
3729
+ }
3730
+ return componentSubmissionMapping;
3731
+ }
3732
+ );
3703
3733
  const selectUserFormMapping = (state) => {
3704
3734
  return state.userFormReducer.userForms;
3705
3735
  };
@@ -4560,6 +4590,8 @@ class AttachmentService extends BaseApiService {
4560
4590
  await this.client.files.addCache(attachmentPayload.file, file_sha1);
4561
4591
  this.client.store.dispatch(addIssueAttachment(offlineAttachment));
4562
4592
  const [fileProps] = await this.client.files.uploadFileToS3(file_sha1);
4593
+ console.debug("fileProps", fileProps);
4594
+ console.debug("offlineAttachment", offlineAttachment);
4563
4595
  const promise = this.enqueueRequest({
4564
4596
  description: "Create attachment",
4565
4597
  method: HttpMethod.POST,
@@ -15798,11 +15830,13 @@ export {
15798
15830
  selectCompletedStages,
15799
15831
  selectComponent,
15800
15832
  selectComponentAttachmentMapping,
15833
+ selectComponentSubmissionMapping,
15801
15834
  selectComponentType,
15802
15835
  selectComponentTypeAttachmentMapping,
15803
15836
  selectComponentTypeForm,
15804
15837
  selectComponentTypeFromComponent,
15805
15838
  selectComponentTypeFromComponents,
15839
+ selectComponentTypeStagesMapping,
15806
15840
  selectComponentTypes,
15807
15841
  selectComponentTypesByName,
15808
15842
  selectComponentTypesFromIds,
@@ -15810,6 +15844,7 @@ export {
15810
15844
  selectComponents,
15811
15845
  selectComponentsByType,
15812
15846
  selectComponentsFromComponentType,
15847
+ selectComponentsMapping,
15813
15848
  selectCreateProjectType,
15814
15849
  selectCurrentUser,
15815
15850
  selectDeletedRequests,