@overmap-ai/core 1.0.48-form-submission-view.0 → 1.0.48-form-submission-view.2

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 componentTypeStagesMapping = {};
1846
+ for (const [stageId, stage] of Object.entries(stagesMapping)) {
1847
+ if (stage.component_type === componentTypeId) {
1848
+ componentTypeStagesMapping[stageId] = stage;
1849
+ }
1850
+ }
1851
+ return componentTypeStagesMapping;
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
  };
@@ -15798,11 +15828,13 @@ export {
15798
15828
  selectCompletedStages,
15799
15829
  selectComponent,
15800
15830
  selectComponentAttachmentMapping,
15831
+ selectComponentSubmissionMapping,
15801
15832
  selectComponentType,
15802
15833
  selectComponentTypeAttachmentMapping,
15803
15834
  selectComponentTypeForm,
15804
15835
  selectComponentTypeFromComponent,
15805
15836
  selectComponentTypeFromComponents,
15837
+ selectComponentTypeStagesMapping,
15806
15838
  selectComponentTypes,
15807
15839
  selectComponentTypesByName,
15808
15840
  selectComponentTypesFromIds,
@@ -15810,6 +15842,7 @@ export {
15810
15842
  selectComponents,
15811
15843
  selectComponentsByType,
15812
15844
  selectComponentsFromComponentType,
15845
+ selectComponentsMapping,
15813
15846
  selectCreateProjectType,
15814
15847
  selectCurrentUser,
15815
15848
  selectDeletedRequests,