@arquimedes.co/eureka-forms 1.9.134 → 2.0.1-test

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.
Files changed (208) hide show
  1. package/dist/@Types/Form.d.ts +1 -1
  2. package/dist/@Types/FormStep.d.ts +2 -2
  3. package/dist/@Types/GenericFormSteps.d.ts +1 -0
  4. package/dist/App/App.css +6 -0
  5. package/dist/{App.d.ts → App/App.d.ts} +13 -21
  6. package/dist/App/App.js +76 -0
  7. package/dist/App/AppFunctions.d.ts +17 -0
  8. package/dist/App/AppFunctions.js +210 -0
  9. package/dist/App/AppHooks.d.ts +10 -0
  10. package/dist/App/AppHooks.js +235 -0
  11. package/dist/Contexts/CustomContext.d.ts +11 -0
  12. package/dist/Contexts/CustomContext.js +6 -0
  13. package/dist/Contexts/FormContext.d.ts +4 -0
  14. package/dist/Contexts/FormContext.js +19 -0
  15. package/dist/Contexts/SectionContext.d.ts +3 -0
  16. package/dist/Contexts/SectionContext.js +3 -0
  17. package/dist/Form/ConfirmationDialog/ConfirmationDialog.d.ts +2 -4
  18. package/dist/Form/ConfirmationDialog/ConfirmationDialog.js +3 -1
  19. package/dist/Form/Form.d.ts +17 -34
  20. package/dist/Form/Form.js +73 -124
  21. package/dist/Form/FormFunctions.d.ts +5 -4
  22. package/dist/Form/FormFunctions.js +24 -25
  23. package/dist/Form/FormTypes/ColumnForm/ColumnForm.d.ts +1 -1
  24. package/dist/Form/FormTypes/ColumnForm/ColumnForm.js +34 -58
  25. package/dist/Form/FormTypes/ColumnForm/ColumnForm.module.css +0 -4
  26. package/dist/Form/FormTypes/StepperForm/StepperForm.d.ts +1 -1
  27. package/dist/Form/FormTypes/StepperForm/StepperForm.js +122 -3
  28. package/dist/Form/FormTypes/StepperForm/StepperForm.module.css +53 -0
  29. package/dist/Form/Hooks.d.ts +9 -0
  30. package/dist/Form/Hooks.js +7 -0
  31. package/dist/Form/Section/MaterialSection/MaterialSection.d.ts +1 -1
  32. package/dist/Form/Section/MaterialSection/MaterialSection.js +15 -16
  33. package/dist/Form/Section/Section.d.ts +2 -34
  34. package/dist/Form/Section/Section.js +11 -5
  35. package/dist/Form/Terms/Term/MaterialTerm/MaterialTerm.d.ts +1 -1
  36. package/dist/Form/Terms/Term/MaterialTerm/MaterialTerm.js +19 -14
  37. package/dist/Form/Terms/Term/Term.d.ts +1 -8
  38. package/dist/Form/Terms/Term/Term.js +3 -1
  39. package/dist/Form/Terms/Terms.d.ts +1 -2
  40. package/dist/Form/Terms/Terms.js +17 -8
  41. package/dist/Form/Terms/Terms.module.css +3 -0
  42. package/dist/FormSteps/@Construction/CBRElementStep/CBRElementStep.d.ts +3 -3
  43. package/dist/FormSteps/@Construction/CBRElementStep/CBRElementStep.js +49 -38
  44. package/dist/FormSteps/@Construction/CBRIncidentsStep/CBRIncidentsStep.js +3 -1
  45. package/dist/FormSteps/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/Incident/Incident.d.ts +2 -2
  46. package/dist/FormSteps/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/Incident/Incident.js +11 -5
  47. package/dist/FormSteps/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/MaterialCBRIncidentsStep.js +29 -27
  48. package/dist/FormSteps/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/MaterialCBRIncidentsStep.module.css +0 -6
  49. package/dist/FormSteps/@Construction/CBRPropertyStep/CBRPropertyStep.js +39 -31
  50. package/dist/FormSteps/AYFStepMapper.js +42 -43
  51. package/dist/FormSteps/ApiSelectorStep/ApiSelectorStep.d.ts +1 -1
  52. package/dist/FormSteps/ApiSelectorStep/ApiSelectorStep.js +4 -14
  53. package/dist/FormSteps/ApiSelectorStep/MaterialApiSelectorStep/MaterialApiSelectorStep.js +84 -97
  54. package/dist/FormSteps/ApiSelectorStep/MaterialApiSelectorStep/MaterialApiSelectorStep.module.css +0 -9
  55. package/dist/FormSteps/CBRStepMapper.js +78 -74
  56. package/dist/FormSteps/CheckBoxStep/CheckBoxStep.d.ts +1 -1
  57. package/dist/FormSteps/CheckBoxStep/CheckBoxStep.js +4 -14
  58. package/dist/FormSteps/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.js +33 -26
  59. package/dist/FormSteps/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.module.css +17 -0
  60. package/dist/FormSteps/ClassifierSelectorStep/ClassifierSelectorStep.d.ts +1 -1
  61. package/dist/FormSteps/ClassifierSelectorStep/ClassifierSelectorStep.js +4 -14
  62. package/dist/FormSteps/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.js +34 -27
  63. package/dist/FormSteps/CollapsibleStep/CollapsibleStep.d.ts +1 -1
  64. package/dist/FormSteps/CollapsibleStep/CollapsibleStep.js +4 -2
  65. package/dist/FormSteps/CollapsibleStep/MaterialTitleStep/MaterialCollapsibleStep.js +16 -11
  66. package/dist/FormSteps/CustomStep.d.ts +22 -0
  67. package/dist/FormSteps/CustomStep.js +37 -0
  68. package/dist/FormSteps/DatePickerStep/DatePickerStep.js +3 -1
  69. package/dist/FormSteps/DatePickerStep/MaterialDatePickerStep/MaterialDatePickerStep.d.ts +1 -1
  70. package/dist/FormSteps/DatePickerStep/MaterialDatePickerStep/MaterialDatePickerStep.js +26 -14
  71. package/dist/FormSteps/EntityValueStep/EntityValuePickerStep.d.ts +1 -1
  72. package/dist/FormSteps/EntityValueStep/EntityValuePickerStep.js +4 -14
  73. package/dist/FormSteps/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValuePickerStep.js +93 -112
  74. package/dist/FormSteps/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValuePickerStep.module.css +0 -9
  75. package/dist/FormSteps/FileUploadStep/FileUploadStep.js +3 -1
  76. package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/FileComponent/FileComponent.d.ts +1 -1
  77. package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/FileComponent/FileComponent.js +1 -1
  78. package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/FileComponent/FileComponent.module.css +0 -7
  79. package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.js +32 -18
  80. package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.module.css +0 -7
  81. package/dist/FormSteps/MapperStep/MapperStep.d.ts +2 -2
  82. package/dist/FormSteps/MapperStep/MapperStep.js +4 -14
  83. package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/ListMapperElement/ListMapperElement.d.ts +1 -9
  84. package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/ListMapperElement/ListMapperElement.js +7 -2
  85. package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/MapperElement.d.ts +3 -2
  86. package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/MapperElement.js +18 -10
  87. package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/PillMapperElement/PillMapperElement.d.ts +1 -9
  88. package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/PillMapperElement/PillMapperElement.js +7 -2
  89. package/dist/FormSteps/MapperStep/MaterialMapperStep/MaterialMapperStep.d.ts +1 -1
  90. package/dist/FormSteps/MapperStep/MaterialMapperStep/MaterialMapperStep.js +44 -228
  91. package/dist/FormSteps/MapperStep/MaterialMapperStep/MaterialMapperStep.module.css +0 -7
  92. package/dist/FormSteps/RatingStep/MaterialRatingStep/MaterialRatingStep.js +30 -14
  93. package/dist/FormSteps/RatingStep/RatingStep.js +3 -1
  94. package/dist/FormSteps/SelectorStep/MaterialSelectorStep/MaterialSelectorStep.js +36 -26
  95. package/dist/FormSteps/SelectorStep/SelectorStep.d.ts +1 -1
  96. package/dist/FormSteps/SelectorStep/SelectorStep.js +4 -14
  97. package/dist/FormSteps/SeparatorStep/MaterialSeparatorStep/MaterialSeparatorStep.d.ts +1 -1
  98. package/dist/FormSteps/SeparatorStep/MaterialSeparatorStep/MaterialSeparatorStep.js +3 -1
  99. package/dist/FormSteps/SeparatorStep/SeparatorStep.d.ts +1 -1
  100. package/dist/FormSteps/SeparatorStep/SeparatorStep.js +4 -14
  101. package/dist/FormSteps/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.d.ts +5 -2
  102. package/dist/FormSteps/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.js +119 -199
  103. package/dist/FormSteps/SmartSelectStep/SmartSelectStep.d.ts +9 -10
  104. package/dist/FormSteps/SmartSelectStep/SmartSelectStep.js +3 -1
  105. package/dist/FormSteps/Step.d.ts +3 -4
  106. package/dist/FormSteps/Step.js +12 -8
  107. package/dist/FormSteps/StepFunctions.d.ts +10 -0
  108. package/dist/FormSteps/StepFunctions.js +156 -1
  109. package/dist/FormSteps/StepHooks.d.ts +23 -0
  110. package/dist/FormSteps/StepHooks.js +87 -0
  111. package/dist/FormSteps/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaEditorStep.d.ts +10 -0
  112. package/dist/FormSteps/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaEditorStep.js +148 -0
  113. package/dist/FormSteps/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.d.ts +1 -6
  114. package/dist/FormSteps/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.js +40 -186
  115. package/dist/FormSteps/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.module.css +0 -9
  116. package/dist/FormSteps/TextAreaStep/TextAreaStep.js +8 -2
  117. package/dist/FormSteps/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.d.ts +1 -1
  118. package/dist/FormSteps/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.js +43 -42
  119. package/dist/FormSteps/TextInputStep/TextInputStep.js +3 -1
  120. package/dist/FormSteps/TitleStep/MaterialTitleStep/MaterialTitleStep.js +11 -6
  121. package/dist/FormSteps/TitleStep/TitleStep.d.ts +1 -1
  122. package/dist/FormSteps/TitleStep/TitleStep.js +4 -14
  123. package/dist/Icons/Construction/LeakIcon.d.ts +2 -2
  124. package/dist/Icons/Construction/LeakIcon.js +2 -1
  125. package/dist/Icons/Construction/ProjectIcon.d.ts +2 -2
  126. package/dist/Icons/Construction/ProjectIcon.js +2 -1
  127. package/dist/Icons/Construction/PropertyIcon.d.ts +2 -2
  128. package/dist/Icons/Construction/PropertyIcon.js +2 -1
  129. package/dist/Icons/Construction/SpaceIcon.d.ts +2 -2
  130. package/dist/Icons/Construction/SpaceIcon.js +2 -1
  131. package/dist/Icons/DocumentIcon.d.ts +2 -2
  132. package/dist/Icons/DocumentIcon.js +2 -1
  133. package/dist/Icons/Entities/CheckListIcon.d.ts +2 -2
  134. package/dist/Icons/Entities/CheckListIcon.js +2 -1
  135. package/dist/Icons/Entities/GenericEntityIcon.d.ts +2 -1
  136. package/dist/Icons/Entities/GenericEntityIcon.js +1 -1
  137. package/dist/Icons/Entities/HandshakeIcon.d.ts +2 -1
  138. package/dist/Icons/Entities/HandshakeIcon.js +1 -1
  139. package/dist/Icons/Entities/SupplierIcon.d.ts +2 -1
  140. package/dist/Icons/Entities/SupplierIcon.js +4 -1
  141. package/dist/{controllers → Services}/FileService.d.ts +1 -1
  142. package/dist/{controllers → Services}/FileService.js +5 -5
  143. package/dist/Services/FormService.d.ts +5 -0
  144. package/dist/Services/FormService.js +59 -0
  145. package/dist/Services/OrganizationService.d.ts +2 -0
  146. package/dist/Services/OrganizationService.js +65 -0
  147. package/dist/Shared/Navbar/Navbar.module.css +8 -0
  148. package/dist/{shared → Shared}/Rating/Rating.d.ts +1 -1
  149. package/dist/Shared/Rating/Rating.module.css +18 -0
  150. package/dist/{shared → Shared}/Rating/Ratings/LikeRating.js +5 -5
  151. package/dist/{shared → Shared}/Rating/Ratings/SatisfactionRating.js +9 -9
  152. package/dist/{shared → Shared}/Rating/Ratings/ScaleRating.js +1 -2
  153. package/dist/{shared → Shared}/RoundedCheckBox/RoundedCheckBox.d.ts +1 -1
  154. package/dist/{shared → Shared}/RoundedSmartSelect/RoundedSmartSelect.js +4 -4
  155. package/dist/{shared → Shared}/RoundedTextField/RoundedTextField.d.ts +1 -1
  156. package/dist/{shared → Shared}/RoundedTextField/RoundedTextField.js +3 -2
  157. package/dist/Shared/RoundedTextField/RoundedTextField.stories.d.ts +24 -0
  158. package/dist/Shared/RoundedTextField/RoundedTextField.stories.js +25 -0
  159. package/dist/States/GlobalStateReducer.d.ts +35 -0
  160. package/dist/States/GlobalStateReducer.js +34 -0
  161. package/dist/States/SiteStateReducer.d.ts +63 -0
  162. package/dist/States/SiteStateReducer.js +110 -0
  163. package/dist/States/WidthStatsStateReducer.d.ts +11 -0
  164. package/dist/States/WidthStatsStateReducer.js +64 -0
  165. package/dist/Utils/DraftFunctions.d.ts +3 -0
  166. package/dist/Utils/DraftFunctions.js +42 -0
  167. package/dist/Utils/MaterialProviders.d.ts +6 -0
  168. package/dist/Utils/MaterialProviders.js +31 -0
  169. package/dist/Utils/store.d.ts +25 -0
  170. package/dist/Utils/store.js +52 -0
  171. package/dist/Widget.js +3 -3
  172. package/dist/constants/CBRFormStepTypes.d.ts +2 -2
  173. package/dist/constants/CBRFormStepTypes.js +22 -22
  174. package/dist/hooks.d.ts +5 -0
  175. package/dist/hooks.js +7 -0
  176. package/dist/index.js +1 -1
  177. package/dist/index.lib.d.ts +1 -1
  178. package/dist/index.lib.js +1 -1
  179. package/package.json +63 -44
  180. package/dist/App.js +0 -472
  181. package/dist/shared/Navbar/Navbar.module.css +0 -18
  182. package/dist/shared/Rating/Rating.module.css +0 -32
  183. package/dist/{App.module.css → App/App.module.css} +0 -0
  184. package/dist/{shared → Shared}/InputIcon/InputIcon.d.ts +0 -0
  185. package/dist/{shared → Shared}/InputIcon/InputIcon.js +0 -0
  186. package/dist/{shared → Shared}/Loader/Loader.d.ts +0 -0
  187. package/dist/{shared → Shared}/Loader/Loader.js +0 -0
  188. package/dist/{shared → Shared}/Loader/Loader.module.css +0 -0
  189. package/dist/{shared → Shared}/Navbar/Navbar.d.ts +0 -0
  190. package/dist/{shared → Shared}/Navbar/Navbar.js +0 -0
  191. package/dist/{shared → Shared}/Rating/Rating.js +2 -2
  192. /package/dist/{shared → Shared}/Rating/Ratings/LikeRating.d.ts +0 -0
  193. /package/dist/{shared → Shared}/Rating/Ratings/SatisfactionRating.d.ts +0 -0
  194. /package/dist/{shared → Shared}/Rating/Ratings/ScaleRating.d.ts +0 -0
  195. /package/dist/{shared → Shared}/RoundedButton/RoundedButton.d.ts +0 -0
  196. /package/dist/{shared → Shared}/RoundedButton/RoundedButton.js +0 -0
  197. /package/dist/{shared → Shared}/RoundedCheckBox/RoundedCheckBox.js +0 -0
  198. /package/dist/{shared → Shared}/RoundedDatePicker/RoundedDatePicker.d.ts +0 -0
  199. /package/dist/{shared → Shared}/RoundedDatePicker/RoundedDatePicker.js +0 -0
  200. /package/dist/{shared → Shared}/RoundedSelect/RoundedSelect.d.ts +0 -0
  201. /package/dist/{shared → Shared}/RoundedSelect/RoundedSelect.js +0 -0
  202. /package/dist/{shared → Shared}/RoundedSmartSelect/RoundedSmartSelect.d.ts +0 -0
  203. /package/dist/{AxiosAPI.d.ts → Utils/AxiosAPI.d.ts} +0 -0
  204. /package/dist/{AxiosAPI.js → Utils/AxiosAPI.js} +0 -0
  205. /package/dist/{AxiosWidget.d.ts → Utils/AxiosWidget.d.ts} +0 -0
  206. /package/dist/{AxiosWidget.js → Utils/AxiosWidget.js} +0 -0
  207. /package/dist/{utils/CbrFunctions.d.ts → Utils/CBRFunctions.d.ts} +0 -0
  208. /package/dist/{utils/CbrFunctions.js → Utils/CBRFunctions.js} +0 -0
@@ -45,11 +45,24 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
45
45
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
46
  }
47
47
  };
48
+ var __rest = (this && this.__rest) || function (s, e) {
49
+ var t = {};
50
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
51
+ t[p] = s[p];
52
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
53
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
54
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
55
+ t[p[i]] = s[p[i]];
56
+ }
57
+ return t;
58
+ };
48
59
  import { jsx as _jsx } from "react/jsx-runtime";
49
60
  import SmartSelectStep from '../../SmartSelectStep/SmartSelectStep';
50
61
  import CBRFormStepTypes from '../../../constants/CBRFormStepTypes';
51
62
  import axios from 'axios';
52
- import InputIcon from '../../../shared/InputIcon/InputIcon';
63
+ import InputIcon from '../../../Shared/InputIcon/InputIcon';
64
+ import FormContext from '../../../Contexts/FormContext';
65
+ import { useContext } from 'react';
53
66
  function CBRElementStepComponent(props) {
54
67
  return (_jsx(SmartSelectStep, __assign({}, props, { step: props.step, icon: _jsx(InputIcon, { icon: 'LEAK' }), getOptions: getElementOptions, getOptionSelected: function (option, value) {
55
68
  return option.id === value.id;
@@ -60,57 +73,55 @@ function CBRElementStepComponent(props) {
60
73
  else {
61
74
  return null;
62
75
  }
63
- } }, { children: _jsx(ElementSubStepRenderer, {}) })));
76
+ }, renderNestedSteps: function (value) { return (_jsx(ElementSubStepRenderer, __assign({ value: value }, props))); } })));
64
77
  }
65
78
  export default CBRElementStepComponent;
66
79
  function ElementSubStepRenderer(_a) {
67
80
  var _b;
68
- var value = _a.value, stepProps = _a.stepProps;
81
+ var value = _a.value, stepProps = __rest(_a, ["value"]);
82
+ var form = useContext(FormContext);
69
83
  if (!value || stepProps == undefined) {
70
84
  return _jsx("div", {});
71
85
  }
72
- var subStep = stepProps === null || stepProps === void 0 ? void 0 : stepProps.form.steps[(_b = stepProps.step.subStep) !== null && _b !== void 0 ? _b : ''];
86
+ var subStep = form.steps[(_b = stepProps.step.subStep) !== null && _b !== void 0 ? _b : ''];
73
87
  if ((subStep === null || subStep === void 0 ? void 0 : subStep.type) !== CBRFormStepTypes.CBR_LOCATIVAS) {
74
88
  return _jsx("div", {});
75
89
  }
76
90
  return (_jsx(SmartSelectStep, __assign({}, stepProps, { step: subStep, level: stepProps.level + 1, icon: _jsx(InputIcon, { icon: 'LEAK' }), getOptions: getElementOptions, calcDepError: calcDepError, getOptionSelected: function (option, value) {
77
91
  return option.id === value.id;
78
- }, getValueString: function (value) { return value === null || value === void 0 ? void 0 : value.id; } }, { children: _jsx(ElementSubStepRenderer, {}) })));
92
+ }, getValueString: function (value) { return value === null || value === void 0 ? void 0 : value.id; }, renderNestedSteps: function (value) { return (_jsx(ElementSubStepRenderer, __assign({ value: value }, stepProps, { step: subStep }))); } })));
79
93
  }
80
- var getElementOptions = function (_a, step, dependencyStore) {
81
- var idOrganization = _a.idOrganization;
82
- return __awaiter(void 0, void 0, void 0, function () {
83
- var idProyecto, response, father_1;
84
- var _b, _c, _d;
85
- return __generator(this, function (_e) {
86
- switch (_e.label) {
87
- case 0:
88
- if (!step.dependencies) return [3 /*break*/, 2];
89
- idProyecto = (_c = (_b = dependencyStore[step.dependencies[0]]) === null || _b === void 0 ? void 0 : _b.value) === null || _c === void 0 ? void 0 : _c.id;
90
- if (!idProyecto) {
91
- return [2 /*return*/, null]; //null para indicar que falta la depedency
92
- }
93
- return [4 /*yield*/, axios.get("https://integrations.".concat(process.env.REACT_APP_DOMAIN, "/sinco/cbr/Locativas?idOrganization=").concat(idOrganization))];
94
- case 1:
95
- response = (_e.sent()).data;
96
- father_1 = (_d = dependencyStore[step.dependencies[1]]) === null || _d === void 0 ? void 0 : _d.value;
97
- if (father_1 !== undefined && father_1.id === undefined) {
98
- return [2 /*return*/, null];
99
- }
100
- return [2 /*return*/, response.filter(function (locativa) {
101
- if (father_1 === null || father_1 === void 0 ? void 0 : father_1.id) {
102
- return (locativa.id.startsWith(father_1.id) &&
103
- locativa.id !== father_1.id);
104
- }
105
- else {
106
- return locativa.id.length === 2;
107
- }
108
- })];
109
- case 2: return [2 /*return*/, null];
110
- }
111
- });
94
+ var getElementOptions = function (idOrganization, step, dependencyStore) { return __awaiter(void 0, void 0, void 0, function () {
95
+ var idProyecto, response, father_1;
96
+ var _a, _b, _c;
97
+ return __generator(this, function (_d) {
98
+ switch (_d.label) {
99
+ case 0:
100
+ if (!(step.dependencies && idOrganization)) return [3 /*break*/, 2];
101
+ idProyecto = (_b = (_a = dependencyStore[step.dependencies[0]]) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.id;
102
+ if (!idProyecto) {
103
+ return [2 /*return*/, null]; //null para indicar que falta la depedency
104
+ }
105
+ return [4 /*yield*/, axios.get("https://integrations.".concat(process.env.REACT_APP_DOMAIN, "/sinco/cbr/Locativas?idOrganization=").concat(idOrganization))];
106
+ case 1:
107
+ response = (_d.sent()).data;
108
+ father_1 = (_c = dependencyStore[step.dependencies[1]]) === null || _c === void 0 ? void 0 : _c.value;
109
+ if (father_1 !== undefined && father_1.id === undefined) {
110
+ return [2 /*return*/, null];
111
+ }
112
+ return [2 /*return*/, response.filter(function (locativa) {
113
+ if (father_1 === null || father_1 === void 0 ? void 0 : father_1.id) {
114
+ return (locativa.id.startsWith(father_1.id) &&
115
+ locativa.id !== father_1.id);
116
+ }
117
+ else {
118
+ return locativa.id.length === 2;
119
+ }
120
+ })];
121
+ case 2: return [2 /*return*/, null];
122
+ }
112
123
  });
113
- };
124
+ }); };
114
125
  var calcDepError = function (steps) {
115
126
  for (var _i = 0, steps_1 = steps; _i < steps_1.length; _i++) {
116
127
  var step = steps_1[_i];
@@ -12,8 +12,10 @@ var __assign = (this && this.__assign) || function () {
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import { FormStyleTypes } from '../../../constants/FormStepTypes';
14
14
  import MaterialCBRIncidentsStep from './MaterialCBRIncidentsStep/MaterialCBRIncidentsStep';
15
+ import { useAppSelector } from '../../../hooks';
15
16
  function CBRIncidentsStep(props) {
16
- switch (props.formStyle.type) {
17
+ var formStyle = useAppSelector(function (state) { return state.global; }).formStyle;
18
+ switch (formStyle.type) {
17
19
  case FormStyleTypes.MATERIAL:
18
20
  default: {
19
21
  return _jsx(MaterialCBRIncidentsStep, __assign({}, props));
@@ -1,8 +1,8 @@
1
1
  /// <reference types="react" />
2
2
  import { CBRIncidentsStepProps } from '../../CBRIncidentsStep';
3
3
  import { Incident } from '../MaterialCBRIncidentsStep';
4
- declare function IncidentComponent({ step, form, level, incident, formStyle, handleDelete, ...others }: CBRIncidentsStepProps & {
4
+ declare function IncidentComponent({ step, level, incident, handleDelete, ...others }: CBRIncidentsStepProps & {
5
5
  incident: Incident;
6
- handleDelete: Function;
6
+ handleDelete: () => void;
7
7
  }): JSX.Element;
8
8
  export default IncidentComponent;
@@ -25,25 +25,31 @@ import styles from './Incident.module.css';
25
25
  import StepComponent from '../../../../Step';
26
26
  import DeleteRoundedIcon from '@material-ui/icons/DeleteRounded';
27
27
  import TextAreaStep from '../../../../TextAreaStep/TextAreaStep';
28
+ import FormContext from '../../../../../Contexts/FormContext';
29
+ import { useAppSelector } from '../../../../../hooks';
30
+ import { useContext } from 'react';
28
31
  function IncidentComponent(_a) {
29
- var step = _a.step, form = _a.form, level = _a.level, incident = _a.incident, formStyle = _a.formStyle, handleDelete = _a.handleDelete, others = __rest(_a, ["step", "form", "level", "incident", "formStyle", "handleDelete"]);
32
+ var step = _a.step, level = _a.level, incident = _a.incident, handleDelete = _a.handleDelete, others = __rest(_a, ["step", "level", "incident", "handleDelete"]);
33
+ var _b = useAppSelector(function (state) { return state.global; }), formStyle = _b.formStyle, postview = _b.postview;
34
+ var form = useContext(FormContext);
35
+ var widthStats = useAppSelector(function (state) { return state.widthStats; });
30
36
  var spaceStep = form.steps[incident.idSpaceStep];
31
37
  var elementStep = form.steps[incident.idElementStep];
32
38
  var commentStep = form.steps[incident.idCommentStep];
33
39
  if (incident.deleted) {
34
40
  return _jsx("div", {});
35
41
  }
36
- return (_jsx("div", __assign({ className: others.widthStats.isMobile || form.size.blockNum < 3
42
+ return (_jsx("div", __assign({ className: widthStats.isMobile || form.size.blockNum < 3
37
43
  ? styles.mobileContainer
38
44
  : styles.container }, { children: _jsxs("div", __assign({ className: styles.contentContainer, style: {
39
45
  width: (form.size.blockSize + form.size.spacingSize) *
40
46
  (form.size.blockNum - 1),
41
- } }, { children: [_jsxs("div", __assign({ className: styles.titleLbl, style: { color: formStyle.textColor } }, { children: [step.unitLabel + ' ' + incident.num, ":"] })), _jsx("div", __assign({ className: !others.editable || others.postview
47
+ } }, { children: [_jsxs("div", __assign({ className: styles.titleLbl, style: { color: formStyle.textColor } }, { children: [step.unitLabel + ' ' + incident.num, ":"] })), _jsx("div", __assign({ className: !others.editable || postview
42
48
  ? styles.disabledDeleteBtn
43
49
  : styles.deleteBtn, style: { color: formStyle.textColor }, onClick: function () {
44
- if (others.editable && !others.postview) {
50
+ if (others.editable && !postview) {
45
51
  handleDelete();
46
52
  }
47
- } }, { children: _jsx(DeleteRoundedIcon, { fontSize: "inherit" }) })), _jsx(StepComponent, __assign({}, others, { formStyle: formStyle, form: form, step: spaceStep, level: level + 1 })), _jsx(StepComponent, __assign({}, others, { form: form, formStyle: formStyle, step: elementStep, level: level + 1 })), _jsx(TextAreaStep, __assign({}, others, { form: form, formStyle: formStyle, step: commentStep, maxLength: 200, level: level + 1 }))] })) })));
53
+ } }, { children: _jsx(DeleteRoundedIcon, { fontSize: "inherit" }) })), _jsx(StepComponent, __assign({}, others, { step: spaceStep, level: level + 1 })), _jsx(StepComponent, __assign({}, others, { step: elementStep, level: level + 1 })), _jsx(TextAreaStep, __assign({}, others, { step: commentStep, maxLength: 200, level: level + 1 }))] })) })));
48
54
  }
49
55
  export default IncidentComponent;
@@ -31,18 +31,26 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
31
31
  };
32
32
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
33
33
  /* eslint-disable no-console */
34
- import { useEffect, useState } from 'react';
35
- import { Controller } from 'react-hook-form';
34
+ import { useContext, useEffect, useState } from 'react';
36
35
  import CBRFormStepTypes from '../../../../constants/CBRFormStepTypes';
37
36
  import IncidentComponent from './Incident/Incident';
38
37
  import styles from './MaterialCBRIncidentsStep.module.css';
39
38
  import { nanoid } from 'nanoid';
40
- import RoundedButton from '../../../../shared/RoundedButton/RoundedButton';
39
+ import RoundedButton from '../../../../Shared/RoundedButton/RoundedButton';
40
+ import FormContext from '../../../../Contexts/FormContext';
41
+ import { addStepsDependencies } from '../../../../States/SiteStateReducer';
42
+ import { useAppDispatch, useAppSelector } from '../../../../hooks';
43
+ import CustomContext from '../../../../Contexts/CustomContext';
44
+ import { Controller } from 'react-hook-form';
41
45
  function Incidents(_a) {
42
- var step = _a.step, form = _a.form, btnRef = _a.btnRef, editable = _a.editable, postview = _a.postview, onChange = _a.onChange, incidents = _a.incidents, formStyle = _a.formStyle, dependencyStore = _a.dependencyStore, setDependencyStore = _a.setDependencyStore, others = __rest(_a, ["step", "form", "btnRef", "editable", "postview", "onChange", "incidents", "formStyle", "dependencyStore", "setDependencyStore"]);
46
+ var step = _a.step, btnRef = _a.btnRef, editable = _a.editable, onChange = _a.onChange, incidents = _a.incidents, others = __rest(_a, ["step", "btnRef", "editable", "onChange", "incidents"]);
47
+ var customSteps = useContext(CustomContext).customSteps;
48
+ var _b = useAppSelector(function (state) { return state.global; }), formStyle = _b.formStyle, postview = _b.postview;
49
+ var dispatch = useAppDispatch();
50
+ var form = useContext(FormContext);
43
51
  /** Form to pass down with aditional steps */
44
- var _b = useState(__assign(__assign({}, form), { steps: __assign({}, form.steps) })), localForm = _b[0], setLocalForm = _b[1];
45
- var _c = useState(false), firstRender = _c[0], setFirstRender = _c[1];
52
+ var _c = useState(__assign(__assign({}, form), { steps: __assign({}, form.steps) })), localForm = _c[0], setLocalForm = _c[1];
53
+ var _d = useState(false), firstRender = _d[0], setFirstRender = _d[1];
46
54
  useEffect(function () {
47
55
  setFirstRender(true);
48
56
  }, []);
@@ -52,6 +60,7 @@ function Incidents(_a) {
52
60
  }
53
61
  }, [firstRender]);
54
62
  var handleAddIncident = function () {
63
+ var _a, _b;
55
64
  var current = incidents.filter(function (incident) { return !incident.deleted; });
56
65
  var newIncident = {
57
66
  idSpaceStep: CBRFormStepTypes.CBR_TIPO_ESPACIO + '-' + nanoid(),
@@ -62,40 +71,33 @@ function Incidents(_a) {
62
71
  var newSteps = __assign({}, localForm.steps);
63
72
  newSteps[newIncident.idSpaceStep] = __assign(__assign({}, step.spaceStep), { id: newIncident.idSpaceStep, type: CBRFormStepTypes.CBR_TIPO_ESPACIO, dependencies: step.dependencies });
64
73
  newSteps[newIncident.idCommentStep] = __assign(__assign({}, step.commentStep), { id: newIncident.idCommentStep, type: CBRFormStepTypes.CBR_COMENTARIO });
65
- setDependencyStore(function (dependencies) {
66
- var _a, _b;
67
- var deps = __assign({}, dependencies);
68
- addRecursiveElementStep(newIncident.idElementStep, step.elementStep, null, newSteps, deps, (_b = (_a = step.dependencies) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : '');
69
- onChange(__spreadArray(__spreadArray([], incidents, true), [newIncident], false));
70
- setLocalForm(__assign(__assign({}, localForm), { steps: newSteps }));
71
- return deps;
72
- });
74
+ addRecursiveElementStep(newIncident.idElementStep, step.elementStep, null, newSteps, (_b = (_a = step.dependencies) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : '');
75
+ onChange(__spreadArray(__spreadArray([], incidents, true), [newIncident], false));
76
+ setLocalForm(__assign(__assign({}, localForm), { steps: newSteps }));
77
+ dispatch(addStepsDependencies({
78
+ steps: newSteps,
79
+ customSteps: customSteps,
80
+ }));
73
81
  };
74
- var addRecursiveElementStep = function (idStep, step, idParent, steps, dependencyStore, idProjectDep) {
75
- var _a, _b;
82
+ var addRecursiveElementStep = function (idStep, step, idParent, steps, idProjectDep) {
76
83
  var idSubStep = CBRFormStepTypes.CBR_LOCATIVAS + '-' + nanoid();
77
84
  var newSubStep = step.subStep ? __assign({}, step.subStep) : undefined;
78
85
  var newStep = __assign(__assign({}, step), { id: idStep, type: CBRFormStepTypes.CBR_LOCATIVAS, dependencies: [idProjectDep], subStep: null });
86
+ if (idParent)
87
+ newStep.dependencies.push(idParent);
79
88
  if (newSubStep) {
80
89
  newStep.subStep = idSubStep;
81
90
  }
82
- if (idParent) {
83
- dependencyStore[idParent] = {
84
- type: steps[idParent].type,
85
- value: null,
86
- };
87
- (_b = (_a = newStep.dependencies) === null || _a === void 0 ? void 0 : _a.push) === null || _b === void 0 ? void 0 : _b.call(_a, idParent);
88
- }
89
91
  steps[idStep] = newStep;
90
92
  if (newSubStep) {
91
- addRecursiveElementStep(idSubStep, newSubStep, idStep, steps, dependencyStore, idProjectDep);
93
+ addRecursiveElementStep(idSubStep, newSubStep, idStep, steps, idProjectDep);
92
94
  }
93
95
  };
94
96
  return (_jsxs("div", __assign({ className: styles.container, style: { color: formStyle.textColor } }, { children: [_jsx("div", __assign({ className: styles.titleLbl }, { children: step.label })), step.description && (_jsx("p", __assign({ className: styles.descriptionPar, style: {
95
97
  margin: step.description
96
98
  ? '10px 0px'
97
99
  : '0px 0px 5px 0px',
98
- } }, { children: step.description }))), incidents.map(function (incident, index) { return (_jsx(IncidentComponent, __assign({ incident: incident, formStyle: formStyle, step: step, form: localForm, editable: editable, postview: postview, dependencyStore: dependencyStore, setDependencyStore: setDependencyStore, handleDelete: function () {
100
+ } }, { children: step.description }))), incidents.map(function (incident, index) { return (_jsx(IncidentComponent, __assign({ incident: incident, step: step, editable: editable, handleDelete: function () {
99
101
  var tempIncidents = __spreadArray([], incidents, true);
100
102
  tempIncidents[index].deleted = true;
101
103
  var n = 1;
@@ -107,14 +109,14 @@ function Incidents(_a) {
107
109
  }
108
110
  }
109
111
  onChange(tempIncidents);
110
- } }, others), index)); }), _jsxs("div", __assign({ className: styles.btnContainer }, { children: [_jsx("input", { ref: btnRef, className: styles.hiddenInput }), _jsx(RoundedButton, { disabled: !editable || postview, text: step.addBtnLabel, color: formStyle.primaryContrastColor, backgroundColor: formStyle.primaryColor, fontSize: '1rem', padding: '5px 15px 5px 15px', onClick: function () {
112
+ } }, others), index)); }), _jsxs("div", __assign({ className: styles.btnContainer }, { children: [_jsx("input", { ref: btnRef, className: 'hidden-input' }), _jsx(RoundedButton, { disabled: !editable || postview, text: step.addBtnLabel, color: formStyle.primaryContrastColor, backgroundColor: formStyle.primaryColor, fontSize: '1rem', padding: '5px 15px 5px 15px', onClick: function () {
111
113
  if (editable && !postview) {
112
114
  handleAddIncident();
113
115
  }
114
116
  } })] }))] })));
115
117
  }
116
118
  function CBRIncidentsStep(props) {
117
- return (_jsx(Controller, { name: props.step.id, control: props.control, defaultValue: [], rules: {
119
+ return (_jsx(Controller, { name: props.step.id, defaultValue: [], rules: {
118
120
  required: props.step.required
119
121
  ? 'Este campo es obligatorio'
120
122
  : undefined,
@@ -26,9 +26,3 @@
26
26
  margin-bottom: 3px;
27
27
  width: fit-content;
28
28
  }
29
- .hiddenInput {
30
- height: 0;
31
- width: 0;
32
- padding: 0;
33
- border-width: 0;
34
- }
@@ -53,41 +53,49 @@ import WarningRoundedIcon from '@material-ui/icons/WarningRounded';
53
53
  import axios from 'axios';
54
54
  import React, { useState } from 'react';
55
55
  import { Dialog } from '@material-ui/core';
56
- import RoundedButton from '../../../shared/RoundedButton/RoundedButton';
57
- import InputIcon from '../../../shared/InputIcon/InputIcon';
56
+ import RoundedButton from '../../../Shared/RoundedButton/RoundedButton';
57
+ import InputIcon from '../../../Shared/InputIcon/InputIcon';
58
+ import { useAppSelector } from '../../../hooks';
59
+ import CBRFormStepTypes from '../../../constants/CBRFormStepTypes';
58
60
  var baseUrl = "https://integrations.".concat(process.env.REACT_APP_DOMAIN, "/sinco/cbr/");
59
61
  function CBRPropertyStepComponent(props) {
60
62
  var _this = this;
63
+ var formStyle = useAppSelector(function (state) { return state.global; }).formStyle;
61
64
  var _a = useState(undefined), showWarning = _a[0], setShowWarning = _a[1];
62
- var getInmueblesOptions = function (_a, step, dependencyStore) {
63
- var idOrganization = _a.idOrganization;
64
- return __awaiter(_this, void 0, void 0, function () {
65
- var idProyecto, idMacroProyecto;
66
- var _b, _c, _d, _e;
67
- return __generator(this, function (_f) {
68
- switch (_f.label) {
69
- case 0:
70
- if (!step.dependencies) return [3 /*break*/, 2];
71
- idProyecto = (_c = (_b = dependencyStore[step.dependencies[0]]) === null || _b === void 0 ? void 0 : _b.value) === null || _c === void 0 ? void 0 : _c.id;
72
- idMacroProyecto = (_e = (_d = dependencyStore[step.dependencies[0]]) === null || _d === void 0 ? void 0 : _d.value) === null || _e === void 0 ? void 0 : _e.idMacroProyecto;
73
- if (!idProyecto) {
74
- return [2 /*return*/, null]; //null para indicar que falta la depedency
75
- }
76
- return [4 /*yield*/, axios.get(baseUrl +
77
- 'Inmuebles?idMacro=' +
78
- idMacroProyecto +
79
- '&idProyecto=' +
80
- idProyecto +
81
- '&idOrganization=' +
82
- idOrganization)];
83
- case 1: return [2 /*return*/, (_f.sent()).data];
84
- case 2: return [2 /*return*/, null];
85
- }
86
- });
65
+ var getInmueblesOptions = function (idOrganization, step, dependencyStore) { return __awaiter(_this, void 0, void 0, function () {
66
+ var idProyecto, idMacroProyecto;
67
+ var _a, _b, _c, _d;
68
+ return __generator(this, function (_e) {
69
+ switch (_e.label) {
70
+ case 0:
71
+ if (!(step.dependencies && idOrganization)) return [3 /*break*/, 2];
72
+ idProyecto = (_b = (_a = dependencyStore[step.dependencies[0]]) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.id;
73
+ idMacroProyecto = (_d = (_c = dependencyStore[step.dependencies[0]]) === null || _c === void 0 ? void 0 : _c.value) === null || _d === void 0 ? void 0 : _d.idMacroProyecto;
74
+ if (!idProyecto) {
75
+ return [2 /*return*/, null]; //null para indicar que falta la depedency
76
+ }
77
+ return [4 /*yield*/, axios.get(baseUrl +
78
+ 'Inmuebles?idMacro=' +
79
+ idMacroProyecto +
80
+ '&idProyecto=' +
81
+ idProyecto +
82
+ '&idOrganization=' +
83
+ idOrganization)];
84
+ case 1: return [2 /*return*/, (_e.sent()).data];
85
+ case 2: return [2 /*return*/, null];
86
+ }
87
87
  });
88
- };
89
- return (_jsxs(React.Fragment, { children: [_jsx(SmartSelectStep, __assign({}, props, { step: props.step, icon: _jsx(InputIcon, { icon: 'PROPERTY' }), getOptionSelected: function (option, value) {
88
+ }); };
89
+ return (_jsxs(React.Fragment, { children: [_jsx(SmartSelectStep, __assign({}, props, { icon: _jsx(InputIcon, { icon: 'PROPERTY' }), getOptionSelected: function (option, value) {
90
90
  return option.id === value.id;
91
+ }, calcDepError: function (steps) {
92
+ for (var _i = 0, steps_1 = steps; _i < steps_1.length; _i++) {
93
+ var step = steps_1[_i];
94
+ if (step.type === CBRFormStepTypes.CBR_PROYECTO) {
95
+ return 'Selecciona un proyecto';
96
+ }
97
+ }
98
+ return undefined;
91
99
  }, getValueString: function (value) { return value === null || value === void 0 ? void 0 : value.id; }, getValueWarning: props.step.validation
92
100
  ? function (value) {
93
101
  if (value &&
@@ -129,9 +137,9 @@ function CBRPropertyStepComponent(props) {
129
137
  maxWidth: '100vw',
130
138
  boxSizing: 'content-box',
131
139
  },
132
- }, open: true }, { children: _jsxs("div", __assign({ className: styles.confirmationContainer, style: { color: props.formStyle.textColor } }, { children: [_jsx("div", __assign({ className: styles.closeIcon, onClick: function () {
140
+ }, open: true }, { children: _jsxs("div", __assign({ className: styles.confirmationContainer, style: { color: formStyle.textColor } }, { children: [_jsx("div", __assign({ className: styles.closeIcon, onClick: function () {
133
141
  setShowWarning(undefined);
134
- } }, { children: _jsx(CloseRoundedIcon, { fontSize: "inherit" }) })), _jsxs("div", __assign({ className: styles.container }, { children: [_jsx("div", __assign({ className: styles.warningContainer, style: { color: props.formStyle.primaryColor } }, { children: _jsx(WarningRoundedIcon, { fontSize: "inherit", style: { fontSize: '160px' } }) })), _jsxs("div", __assign({ className: styles.messageContainer }, { children: ["La garant\u00EDa de su inmueble expir\u00F3 el d\u00EDa", ' ', showWarning.toLocaleDateString(), "."] })), _jsx("div", __assign({ className: styles.btnContainer }, { children: _jsx(RoundedButton, { text: 'Continuar', color: props.formStyle.primaryContrastColor, backgroundColor: props.formStyle.primaryColor, fontSize: '1rem', padding: '5px 15px 5px 15px', onClick: function () {
142
+ } }, { children: _jsx(CloseRoundedIcon, { fontSize: "inherit" }) })), _jsxs("div", __assign({ className: styles.container }, { children: [_jsx("div", __assign({ className: styles.warningContainer, style: { color: formStyle.primaryColor } }, { children: _jsx(WarningRoundedIcon, { fontSize: "inherit", style: { fontSize: '160px' } }) })), _jsxs("div", __assign({ className: styles.messageContainer }, { children: ["La garant\u00EDa de su inmueble expir\u00F3 el d\u00EDa", ' ', showWarning.toLocaleDateString(), "."] })), _jsx("div", __assign({ className: styles.btnContainer }, { children: _jsx(RoundedButton, { text: 'Continuar', color: formStyle.primaryContrastColor, backgroundColor: formStyle.primaryColor, fontSize: '1rem', padding: '5px 15px 5px 15px', onClick: function () {
135
143
  setShowWarning(undefined);
136
144
  } }) }))] }))] })) })))] }));
137
145
  }
@@ -75,52 +75,51 @@ function AYFStepMapper(props) {
75
75
  ]];
76
76
  });
77
77
  }); };
78
- var getCiudadesOptions = function (_a, step, dependencyStore) {
79
- var idOrganization = _a.idOrganization;
80
- return __awaiter(_this, void 0, void 0, function () {
81
- var nit, params, _i, _b, dep, value, error_1;
82
- var _c, _d, _e, _f;
83
- return __generator(this, function (_g) {
84
- switch (_g.label) {
85
- case 0:
86
- nit = (_c = dependencyStore[step.idNitStep]) === null || _c === void 0 ? void 0 : _c.value;
87
- params = new URLSearchParams({
88
- idOrganization: idOrganization,
89
- idCompany: nit,
90
- nit: 'true',
91
- });
92
- for (_i = 0, _b = (_d = step.dependencies) !== null && _d !== void 0 ? _d : []; _i < _b.length; _i++) {
93
- dep = _b[_i];
94
- value = (_e = dependencyStore[dep]) === null || _e === void 0 ? void 0 : _e.value;
95
- if (value && dep.startsWith('AYF')) {
96
- switch ((_f = dep.split('-')) === null || _f === void 0 ? void 0 : _f[0]) {
97
- case AYFFormStepTypes.AYF_START_MONTH:
98
- params.set('startMonth', value.id);
99
- break;
100
- case AYFFormStepTypes.AYF_END_MONTH:
101
- params.set('endMonth', value.id);
102
- break;
103
- case AYFFormStepTypes.AYF_YEAR:
104
- params.set('year', value);
105
- break;
106
- default:
107
- break;
108
- }
78
+ var getCiudadesOptions = function (idOrganization, step, dependencyStore) { return __awaiter(_this, void 0, void 0, function () {
79
+ var nit, params, _i, _a, dep, value, error_1;
80
+ var _b, _c, _d, _e;
81
+ return __generator(this, function (_f) {
82
+ switch (_f.label) {
83
+ case 0:
84
+ if (!idOrganization)
85
+ return [2 /*return*/, null];
86
+ nit = (_b = dependencyStore[step.idNitStep]) === null || _b === void 0 ? void 0 : _b.value;
87
+ params = new URLSearchParams({
88
+ idOrganization: idOrganization,
89
+ idCompany: nit,
90
+ nit: 'true',
91
+ });
92
+ for (_i = 0, _a = (_c = step.dependencies) !== null && _c !== void 0 ? _c : []; _i < _a.length; _i++) {
93
+ dep = _a[_i];
94
+ value = (_d = dependencyStore[dep]) === null || _d === void 0 ? void 0 : _d.value;
95
+ if (value && dep.startsWith('AYF')) {
96
+ switch ((_e = dep.split('-')) === null || _e === void 0 ? void 0 : _e[0]) {
97
+ case AYFFormStepTypes.AYF_START_MONTH:
98
+ params.set('startMonth', value.id);
99
+ break;
100
+ case AYFFormStepTypes.AYF_END_MONTH:
101
+ params.set('endMonth', value.id);
102
+ break;
103
+ case AYFFormStepTypes.AYF_YEAR:
104
+ params.set('year', value);
105
+ break;
106
+ default:
107
+ break;
109
108
  }
110
109
  }
111
- _g.label = 1;
112
- case 1:
113
- _g.trys.push([1, 3, , 4]);
114
- return [4 /*yield*/, axios.get(baseUrl + 'CiudadesICA?' + params.toString())];
115
- case 2: return [2 /*return*/, (_g.sent()).data];
116
- case 3:
117
- error_1 = _g.sent();
118
- return [2 /*return*/, null];
119
- case 4: return [2 /*return*/];
120
- }
121
- });
110
+ }
111
+ _f.label = 1;
112
+ case 1:
113
+ _f.trys.push([1, 3, , 4]);
114
+ return [4 /*yield*/, axios.get(baseUrl + 'CiudadesICA?' + params.toString())];
115
+ case 2: return [2 /*return*/, (_f.sent()).data];
116
+ case 3:
117
+ error_1 = _f.sent();
118
+ return [2 /*return*/, null];
119
+ case 4: return [2 /*return*/];
120
+ }
122
121
  });
123
- };
122
+ }); };
124
123
  switch (props.step.type) {
125
124
  case AYFFormStepTypes.AYF_START_MONTH:
126
125
  case AYFFormStepTypes.AYF_END_MONTH:
@@ -11,5 +11,5 @@ export interface ApiSelectorStepProps extends StepProps {
11
11
  /** Default value to display */
12
12
  defaultValue?: Date | null;
13
13
  }
14
- declare function ApiSelectorStep({ ...props }: ApiSelectorStepProps): JSX.Element;
14
+ declare function ApiSelectorStep(props: ApiSelectorStepProps): JSX.Element;
15
15
  export default ApiSelectorStep;
@@ -9,23 +9,13 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- var __rest = (this && this.__rest) || function (s, e) {
13
- var t = {};
14
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
- t[p] = s[p];
16
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
- t[p[i]] = s[p[i]];
20
- }
21
- return t;
22
- };
23
12
  import { jsx as _jsx } from "react/jsx-runtime";
24
13
  import { FormStyleTypes } from '../../constants/FormStepTypes';
14
+ import { useAppSelector } from '../../hooks';
25
15
  import MaterialApiSelectorStep from './MaterialApiSelectorStep/MaterialApiSelectorStep';
26
- function ApiSelectorStep(_a) {
27
- var props = __rest(_a, []);
28
- switch (props.formStyle.type) {
16
+ function ApiSelectorStep(props) {
17
+ var formStyle = useAppSelector(function (state) { return state.global; }).formStyle;
18
+ switch (formStyle.type) {
29
19
  case FormStyleTypes.MATERIAL:
30
20
  default: {
31
21
  return _jsx(MaterialApiSelectorStep, __assign({}, props));