@arquimedes.co/eureka-forms 1.9.118 → 1.9.119-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 (34) hide show
  1. package/dist/@Types/Branding.d.ts +13 -0
  2. package/dist/@Types/Branding.js +1 -0
  3. package/dist/@Types/Form.d.ts +2 -0
  4. package/dist/@Types/FormStep.d.ts +37 -2
  5. package/dist/@Types/Organization.d.ts +3 -11
  6. package/dist/App.js +26 -16
  7. package/dist/FormComponents/Form/ColumnForm/ColumnForm.d.ts +8 -1
  8. package/dist/FormComponents/Form/ColumnForm/ColumnForm.js +8 -2
  9. package/dist/FormComponents/Form/Form.d.ts +3 -1
  10. package/dist/FormComponents/Form/Form.js +5 -5
  11. package/dist/FormComponents/Section/Section.d.ts +3 -2
  12. package/dist/FormComponents/Step/@Construction/CBRElementStep/CBRElementStep.js +6 -6
  13. package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/MaterialCBRIncidentsStep.js +4 -1
  14. package/dist/FormComponents/Step/@Construction/CBRPropertyStep/CBRPropertyStep.js +6 -6
  15. package/dist/FormComponents/Step/AYFStepMapper.js +13 -16
  16. package/dist/FormComponents/Step/ApiSelectorStep/ApiSelectorStep.d.ts +15 -0
  17. package/dist/FormComponents/Step/ApiSelectorStep/ApiSelectorStep.js +35 -0
  18. package/dist/FormComponents/Step/ApiSelectorStep/MaterialApiSelectorStep/MaterialApiSelectorStep.d.ts +4 -0
  19. package/dist/FormComponents/Step/ApiSelectorStep/MaterialApiSelectorStep/MaterialApiSelectorStep.js +213 -0
  20. package/dist/FormComponents/Step/ApiSelectorStep/MaterialApiSelectorStep/MaterialApiSelectorStep.module.css +25 -0
  21. package/dist/FormComponents/Step/CBRStepMapper.js +10 -10
  22. package/dist/FormComponents/Step/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValuePickerStep.js +14 -11
  23. package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/MaterialMapperStep.js +17 -5
  24. package/dist/FormComponents/Step/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.js +60 -26
  25. package/dist/FormComponents/Step/SmartSelectStep/SmartSelectStep.d.ts +2 -1
  26. package/dist/FormComponents/Step/Step.js +4 -0
  27. package/dist/FormComponents/Step/StepFunctions.d.ts +2 -2
  28. package/dist/FormComponents/Step/StepFunctions.js +19 -4
  29. package/dist/FormComponents/Step/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.js +4 -1
  30. package/dist/constants/FormStepTypes.d.ts +10 -1
  31. package/dist/constants/FormStepTypes.js +11 -0
  32. package/dist/shared/RoundedSmartSelect/RoundedSmartSelect.d.ts +3 -1
  33. package/dist/shared/RoundedSmartSelect/RoundedSmartSelect.js +8 -6
  34. package/package.json +1 -1
@@ -0,0 +1,13 @@
1
+ export interface Branding {
2
+ name: string;
3
+ images: {
4
+ logoUrl: string;
5
+ iconUrl: string;
6
+ };
7
+ colors: {
8
+ primaryColor: string;
9
+ secondaryColor: string;
10
+ contrastColor: string;
11
+ navbarColor?: string;
12
+ };
13
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,5 @@
1
1
  import { FormStyleTypes, FormTypes } from '../constants/FormStepTypes';
2
+ import { Branding } from './Branding';
2
3
  import { FormStep } from './FormStep';
3
4
  export interface Form {
4
5
  apiKey?: string;
@@ -11,6 +12,7 @@ export interface Form {
11
12
  hasCaptcha?: boolean;
12
13
  isStandAlone?: boolean;
13
14
  style?: FormStyle;
15
+ Branding?: Branding;
14
16
  classifiers?: Record<string, Classifier>;
15
17
  terms?: Term[];
16
18
  }
@@ -1,6 +1,6 @@
1
- import Types, { ClassifierOptionTypes, OptionTypes, RatingTypes, MapperStyleTypes, EntityValueOptionTypes, EntityValueDataTypes } from '../constants/FormStepTypes';
1
+ import Types, { ClassifierOptionTypes, OptionTypes, RatingTypes, MapperStyleTypes, EntityValueOptionTypes, EntityValueDataTypes, ApiSelectorOptionTypes, ApiSelectorParamTypes } from '../constants/FormStepTypes';
2
2
  import * as GSteps from './GenericFormSteps';
3
- export type FormStep = Title | Rating | CheckBox | TextArea | TextInput | DatePicker | FileUpload | Separator | FormSelector | ClassifierSelector | Collapsible | EntityValuePicker | Mapper;
3
+ export type FormStep = Title | Rating | CheckBox | TextArea | TextInput | DatePicker | FileUpload | Separator | FormSelector | ClassifierSelector | Collapsible | EntityValuePicker | ApiSelector | Mapper;
4
4
  export interface Title extends GSteps.GBaseStep {
5
5
  type: Types.TITLE;
6
6
  title: string;
@@ -140,6 +140,41 @@ export interface ValueEntityValuePickerFilter {
140
140
  type: EntityValueDataTypes.VALUE;
141
141
  value: any;
142
142
  }
143
+ export interface ApiSelector extends GSteps.GSmartSelect {
144
+ type: Types.API_SELECTOR;
145
+ icon: string | null;
146
+ url: string;
147
+ pathParams: ApiSelectorParam[];
148
+ queryParams: ApiSelectorParam[];
149
+ /** Headers? Body, etc?? */
150
+ labelAttribute: string;
151
+ idAttribute: string;
152
+ /** Only has maxSize if level === 0 */
153
+ maxSize?: number;
154
+ options: Record<string, ApiSelectorOption>;
155
+ }
156
+ export type ApiSelectorOption = NestedApiSelectorOption | HideApiSelectorOption;
157
+ interface NestedApiSelectorOption {
158
+ type: ApiSelectorOptionTypes.NESTED;
159
+ idOption: string;
160
+ steps: string[];
161
+ }
162
+ interface HideApiSelectorOption {
163
+ type: ApiSelectorOptionTypes.HIDE;
164
+ idOption: string;
165
+ }
166
+ export type ApiSelectorParam = StepApiSelectorParam | ValueApiSelectorParam;
167
+ export interface StepApiSelectorParam {
168
+ type: ApiSelectorParamTypes.STEP;
169
+ key: string;
170
+ idStep: string;
171
+ required: boolean;
172
+ }
173
+ export interface ValueApiSelectorParam {
174
+ type: ApiSelectorParamTypes.VALUE;
175
+ key: string;
176
+ value: string;
177
+ }
143
178
  export interface Mapper extends GSteps.GBaseStep {
144
179
  type: Types.MAPPER;
145
180
  style: {
@@ -1,17 +1,9 @@
1
+ import { Branding } from './Branding';
1
2
  export interface Organization {
2
3
  /** The Organization's id */
3
4
  idOrganization: string;
4
5
  /** The Organization's name */
5
6
  name: string;
6
- /** The organization Logo url */
7
- logoUrl: string;
8
- /** The organization Favicon url */
9
- iconUrl?: string;
10
- mainCity?: string;
11
- styles?: {
12
- primaryColor: string;
13
- secondaryColor: string;
14
- contrastColor: string;
15
- navbarColor?: string;
16
- };
7
+ branding: Branding;
8
+ customBrandings: boolean;
17
9
  }
package/dist/App.js CHANGED
@@ -76,6 +76,7 @@ function App(_a) {
76
76
  var _g = useState(undefined), form = _g[0], setForm = _g[1];
77
77
  var _h = useState({}), originalValues = _h[0], setOriginalValues = _h[1];
78
78
  var _j = useState(undefined), organizationInfo = _j[0], setOrganizationInfo = _j[1];
79
+ var _k = useState(), branding = _k[0], setBranding = _k[1];
79
80
  var migrateFormData = function (formData, valuesData) {
80
81
  var form = migrateForm(formData, classifiers);
81
82
  var steps = Object.values(form.steps);
@@ -100,6 +101,9 @@ function App(_a) {
100
101
  case 1:
101
102
  response = _a.sent();
102
103
  if (response.data) {
104
+ if (!response.data.customBrandings) {
105
+ setBranding(response.data.branding);
106
+ }
103
107
  setOrganizationInfo(response.data);
104
108
  migrateFormData(formData, valuesData);
105
109
  }
@@ -115,6 +119,7 @@ function App(_a) {
115
119
  }
116
120
  else {
117
121
  migrateFormData(__assign({}, formData), valuesData);
122
+ setBranding(undefined);
118
123
  setOrganizationInfo(null);
119
124
  }
120
125
  }
@@ -132,6 +137,7 @@ function App(_a) {
132
137
  console.error('ERROREMBED');
133
138
  //Error in embed
134
139
  setForm(null);
140
+ setBranding(undefined);
135
141
  setOrganizationInfo(null);
136
142
  }
137
143
  }, []);
@@ -190,25 +196,27 @@ function App(_a) {
190
196
  case 4:
191
197
  response = _a;
192
198
  if (response === null || response === void 0 ? void 0 : response.data) {
193
- if (response === null || response === void 0 ? void 0 : response.data) {
194
- // document.title = currentOrg.name;
195
- // const favicon: any = document.getElementById('favicon');
196
- // if (favicon !== undefined) {
197
- // favicon.href = currentOrg.partialLogoUrl;
198
- // }
199
- //TODO cambiar el color del navbar en movil
200
- // eslint-disable-next-line no-console
201
- console.log(response === null || response === void 0 ? void 0 : response.data);
202
- setOrganizationInfo(response === null || response === void 0 ? void 0 : response.data);
203
- }
204
- else {
205
- setOrganizationInfo(null);
199
+ // document.title = currentOrg.name;
200
+ // const favicon: any = document.getElementById('favicon');
201
+ // if (favicon !== undefined) {
202
+ // favicon.href = currentOrg.partialLogoUrl;
203
+ // }
204
+ //TODO cambiar el color del navbar en movil
205
+ // eslint-disable-next-line no-console
206
+ setOrganizationInfo(response === null || response === void 0 ? void 0 : response.data);
207
+ if (!response.data.customBrandings) {
208
+ setBranding(response === null || response === void 0 ? void 0 : response.data.branding);
206
209
  }
207
210
  }
211
+ else {
212
+ setBranding(undefined);
213
+ setOrganizationInfo(null);
214
+ }
208
215
  return [3 /*break*/, 6];
209
216
  case 5:
210
217
  error_2 = _b.sent();
211
218
  console.error(error_2);
219
+ setBranding(undefined);
212
220
  setOrganizationInfo(null);
213
221
  return [3 /*break*/, 6];
214
222
  case 6: return [2 /*return*/];
@@ -227,6 +235,8 @@ function App(_a) {
227
235
  case 1:
228
236
  response = _a.sent();
229
237
  if (response) {
238
+ if (response.data.branding)
239
+ setBranding(response.data.branding);
230
240
  migrateFormData(response.data, valuesData);
231
241
  }
232
242
  return [3 /*break*/, 3];
@@ -241,9 +251,9 @@ function App(_a) {
241
251
  }); };
242
252
  if (form === undefined || organizationInfo === undefined) {
243
253
  if (isWidget) {
244
- return (_jsx("div", __assign({ className: styles.widgetContainer }, { children: _jsx("div", __assign({ className: styles.curtain }, { children: _jsx(Loader, { size: 50, color: (_c = (_b = organizationInfo === null || organizationInfo === void 0 ? void 0 : organizationInfo.styles) === null || _b === void 0 ? void 0 : _b.primaryColor) !== null && _c !== void 0 ? _c : '#b8b8b8' }) })) })));
254
+ return (_jsx("div", __assign({ className: styles.widgetContainer }, { children: _jsx("div", __assign({ className: styles.curtain }, { children: _jsx(Loader, { size: 50, color: (_c = (_b = branding === null || branding === void 0 ? void 0 : branding.colors) === null || _b === void 0 ? void 0 : _b.primaryColor) !== null && _c !== void 0 ? _c : '#b8b8b8' }) })) })));
245
255
  }
246
- return (_jsx("div", __assign({ className: styles.curtain }, { children: _jsx(Loader, { size: 50, color: (_e = (_d = organizationInfo === null || organizationInfo === void 0 ? void 0 : organizationInfo.styles) === null || _d === void 0 ? void 0 : _d.primaryColor) !== null && _e !== void 0 ? _e : '#b8b8b8' }) })));
256
+ return (_jsx("div", __assign({ className: styles.curtain }, { children: _jsx(Loader, { size: 50, color: (_e = (_d = branding === null || branding === void 0 ? void 0 : branding.colors) === null || _d === void 0 ? void 0 : _d.primaryColor) !== null && _e !== void 0 ? _e : '#b8b8b8' }) })));
247
257
  }
248
258
  else if (form === null) {
249
259
  if (organizationInfo === null) {
@@ -260,7 +270,7 @@ function App(_a) {
260
270
  }
261
271
  }
262
272
  else {
263
- return (_jsx("div", __assign({ ref: containerRef, className: styles.container }, { children: _jsx(FormComponent, __assign({}, others, { form: form, reload: function () {
273
+ return (_jsx("div", __assign({ ref: containerRef, className: styles.container }, { children: _jsx(FormComponent, __assign({}, others, { form: form, branding: branding, reload: function () {
264
274
  var tempForm = __assign({}, form);
265
275
  setForm(undefined);
266
276
  setTimeout(function () {
@@ -1,8 +1,15 @@
1
1
  /// <reference types="react" />
2
2
  import { FormComponentProps } from '../Form';
3
+ import Types from '../../../constants/FormStepTypes';
3
4
  import { CustomStep } from '../../../App';
4
5
  import { FormStep } from '../../../@Types/FormStep';
6
+ export interface StepDependency {
7
+ value: any | undefined;
8
+ type: Types;
9
+ empty?: boolean;
10
+ }
11
+ export type DependencyStore = Record<string, StepDependency>;
5
12
  declare function ColumnForm({ form, apiKey, reload, domain, postview, internal, formStyle, sendLabel, widthStats, customSteps, customSend, customSubmit, handleLoaded, originalValues, ...others }: FormComponentProps): JSX.Element;
6
13
  export default ColumnForm;
7
14
  export declare const calcValue: (idStep: string, steps: Record<string, FormStep>, values: Record<string, any>, customSteps: Record<string, CustomStep>, deleteIds: string[], value?: any) => any;
8
- export declare function calcStepDependencyValue(depStep: FormStep, originalValues: Record<string, any>, customSteps?: Record<string, CustomStep>): any;
15
+ export declare function calcStepDependencyValue(depStep: FormStep, originalValues: Record<string, any>, customSteps?: Record<string, CustomStep>): StepDependency['value'];
@@ -325,10 +325,16 @@ function calcDependencies(steps, originalValues, customSteps, allSteps, dependen
325
325
  var idDep = _e[_d];
326
326
  var depStep = allSteps[idDep];
327
327
  if (depStep && dependencies[idDep] === undefined) {
328
- dependencies[idDep] = calcStepDependencyValue(depStep, originalValues, customSteps);
328
+ dependencies[idDep] = {
329
+ type: depStep.type,
330
+ value: calcStepDependencyValue(depStep, originalValues, customSteps),
331
+ };
329
332
  }
330
333
  else if (dependencies[idDep] === undefined) {
331
- dependencies[idDep] = originalValues[idDep];
334
+ dependencies[idDep] = {
335
+ type: depStep.type,
336
+ value: originalValues[idDep],
337
+ };
332
338
  }
333
339
  }
334
340
  }
@@ -2,6 +2,7 @@
2
2
  import { Organization } from '../../@Types/@Types';
3
3
  import { Form, FormStyle } from '../../@Types/Form';
4
4
  import { CustomStep } from '../../App';
5
+ import { Branding } from '../../@Types/Branding';
5
6
  export declare const getLocale: () => any;
6
7
  export interface WidthStats {
7
8
  currentBreakPoint: number;
@@ -11,6 +12,7 @@ export interface WidthStats {
11
12
  export interface FormComponentProps {
12
13
  form: Form;
13
14
  organization: Organization;
15
+ branding?: Branding;
14
16
  originalValues: Record<string, unknown>;
15
17
  customSteps: Record<string, CustomStep>;
16
18
  customStepProps: Record<string, any>;
@@ -34,7 +36,7 @@ export interface FormComponentProps {
34
36
  /** The custom send label to display */
35
37
  sendLabel?: string;
36
38
  }
37
- declare function FormComponent({ form, isWidget, internal, postview, organization, containerRef, ...others }: Omit<FormComponentProps, 'widthStats' | 'formStyle' | 'handleLoaded'> & {
39
+ declare function FormComponent({ form, isWidget, internal, postview, branding, organization, containerRef, ...others }: Omit<FormComponentProps, 'widthStats' | 'formStyle' | 'handleLoaded'> & {
38
40
  containerRef: any;
39
41
  organization: Organization | null;
40
42
  isWidget: boolean;
@@ -49,7 +49,7 @@ export var getLocale = function () {
49
49
  };
50
50
  function FormComponent(_a) {
51
51
  var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
52
- var form = _a.form, isWidget = _a.isWidget, internal = _a.internal, postview = _a.postview, organization = _a.organization, containerRef = _a.containerRef, others = __rest(_a, ["form", "isWidget", "internal", "postview", "organization", "containerRef"]);
52
+ var form = _a.form, isWidget = _a.isWidget, internal = _a.internal, postview = _a.postview, branding = _a.branding, organization = _a.organization, containerRef = _a.containerRef, others = __rest(_a, ["form", "isWidget", "internal", "postview", "branding", "organization", "containerRef"]);
53
53
  var _p = useState(false), loaded = _p[0], setLoaded = _p[1];
54
54
  var _q = useState(undefined), widthStats = _q[0], setWidthStats = _q[1];
55
55
  /** Calcs the currentBreakPoint and if is mobile */
@@ -92,22 +92,22 @@ function FormComponent(_a) {
92
92
  ? 'transparent'
93
93
  : (_d = (_c = form.style) === null || _c === void 0 ? void 0 : _c.backgroundColor) !== null && _d !== void 0 ? _d : InternalFormStyle.backgroundColor,
94
94
  minHeight: form.isStandAlone && !isWidget ? '100vh' : '100%',
95
- } }, { children: _jsx("div", __assign({ className: styles.widgetFormContainer, ref: containerRef }, { children: _jsx(FormTypeComponent, __assign({}, others, { handleLoaded: function () {
95
+ } }, { children: _jsx("div", __assign({ className: styles.widgetFormContainer, ref: containerRef }, { children: _jsx(FormTypeComponent, __assign({}, others, { branding: branding, handleLoaded: function () {
96
96
  setLoaded(true);
97
97
  }, widthStats: widthStats, form: form, internal: internal, postview: postview, organization: organization, formStyle: internal
98
98
  ? InternalFormStyle
99
99
  : __assign(__assign({}, InternalFormStyle), ((_e = form.style) !== null && _e !== void 0 ? _e : {})) })) })) })));
100
100
  }
101
- else if (organization && widthStats !== undefined) {
101
+ else if (organization && branding && widthStats !== undefined) {
102
102
  //Standalone cant have widget
103
- return (_jsxs(React.Fragment, { children: [_jsx(Navbar, { logo: organization.logoUrl, color: (_g = (_f = organization.styles) === null || _f === void 0 ? void 0 : _f.navbarColor) !== null && _g !== void 0 ? _g : (_h = organization.styles) === null || _h === void 0 ? void 0 : _h.primaryColor }), _jsx("div", __assign({ className: styles.standAloneFormContainer, ref: containerRef, style: {
103
+ return (_jsxs(React.Fragment, { children: [_jsx(Navbar, { logo: branding.images.logoUrl, color: (_g = (_f = branding.colors) === null || _f === void 0 ? void 0 : _f.navbarColor) !== null && _g !== void 0 ? _g : (_h = branding.colors) === null || _h === void 0 ? void 0 : _h.primaryColor }), _jsx("div", __assign({ className: styles.standAloneFormContainer, ref: containerRef, style: {
104
104
  background: (_k = (_j = form.style) === null || _j === void 0 ? void 0 : _j.standAloneBackgroundColor) !== null && _k !== void 0 ? _k : '#ffffff',
105
105
  } }, { children: _jsx("div", __assign({ className: widthStats.isResponsive
106
106
  ? styles.fullScreenStandAloneForm
107
107
  : styles.standAloneFormCard, style: {
108
108
  backgroundColor: (_m = (_l = form.style) === null || _l === void 0 ? void 0 : _l.backgroundColor) !== null && _m !== void 0 ? _m : InternalFormStyle.backgroundColor,
109
109
  visibility: loaded ? 'visible' : 'hidden',
110
- } }, { children: _jsx(FormTypeComponent, __assign({}, others, { internal: internal, postview: postview, widthStats: widthStats, form: form, formStyle: (_o = form.style) !== null && _o !== void 0 ? _o : InternalFormStyle, organization: organization, handleLoaded: function () {
110
+ } }, { children: _jsx(FormTypeComponent, __assign({}, others, { branding: branding, internal: internal, postview: postview, widthStats: widthStats, form: form, formStyle: (_o = form.style) !== null && _o !== void 0 ? _o : InternalFormStyle, organization: organization, handleLoaded: function () {
111
111
  setLoaded(true);
112
112
  } })) })) }))] }));
113
113
  }
@@ -4,6 +4,7 @@ import { Organization } from '../../@Types';
4
4
  import { Form, FormStyle, Section } from '../../@Types/Form';
5
5
  import { CustomStep } from '../../App';
6
6
  import { WidthStats } from '../Form/Form';
7
+ import { DependencyStore } from '../Form/ColumnForm/ColumnForm';
7
8
  export interface RecursiveData {
8
9
  form: Form;
9
10
  organization: Organization;
@@ -24,8 +25,8 @@ export interface RecursiveData {
24
25
  customStepProps: Record<string, any>;
25
26
  /** Function to call on postview to fetch the download url of a file */
26
27
  fetchDownloadUrl?: (S3Key: string, fileName: string) => Promise<string>;
27
- dependencyStore: Record<string, any>;
28
- setDependencyStore: React.Dispatch<React.SetStateAction<Record<string, any>>>;
28
+ dependencyStore: DependencyStore;
29
+ setDependencyStore: React.Dispatch<React.SetStateAction<DependencyStore>>;
29
30
  setFocus: (id: string) => void;
30
31
  setValue: (id: string, value: any) => void;
31
32
  }
@@ -81,19 +81,19 @@ var getElementOptions = function (_a, step, dependencyStore) {
81
81
  var idOrganization = _a.idOrganization;
82
82
  return __awaiter(void 0, void 0, void 0, function () {
83
83
  var idProyecto, response, father_1;
84
- var _b;
85
- return __generator(this, function (_c) {
86
- switch (_c.label) {
84
+ var _b, _c;
85
+ return __generator(this, function (_d) {
86
+ switch (_d.label) {
87
87
  case 0:
88
88
  if (!step.dependencies) return [3 /*break*/, 2];
89
- idProyecto = (_b = dependencyStore[step.dependencies[0]]) === null || _b === void 0 ? void 0 : _b.id;
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
90
  if (!idProyecto) {
91
91
  return [2 /*return*/, null]; //null para indicar que falta la depedency
92
92
  }
93
93
  return [4 /*yield*/, axios.get("https://integrations.".concat(process.env.REACT_APP_DOMAIN, "/sinco/cbr/Locativas?idOrganization=").concat(idOrganization))];
94
94
  case 1:
95
- response = (_c.sent()).data;
96
- father_1 = dependencyStore[step.dependencies[1]];
95
+ response = (_d.sent()).data;
96
+ father_1 = dependencyStore[step.dependencies[1]].value;
97
97
  if (father_1 !== undefined && father_1.id === undefined) {
98
98
  return [2 /*return*/, null];
99
99
  }
@@ -80,7 +80,10 @@ function Incidents(_a) {
80
80
  newStep.subStep = idSubStep;
81
81
  }
82
82
  if (idParent) {
83
- dependencyStore[idParent] = null;
83
+ dependencyStore[idParent] = {
84
+ type: steps[idParent].type,
85
+ value: null,
86
+ };
84
87
  (_b = (_a = newStep.dependencies) === null || _a === void 0 ? void 0 : _a.push) === null || _b === void 0 ? void 0 : _b.call(_a, idParent);
85
88
  }
86
89
  steps[idStep] = newStep;
@@ -63,13 +63,13 @@ function CBRPropertyStepComponent(props) {
63
63
  var idOrganization = _a.idOrganization;
64
64
  return __awaiter(_this, void 0, void 0, function () {
65
65
  var idProyecto, idMacroProyecto;
66
- var _b, _c;
67
- return __generator(this, function (_d) {
68
- switch (_d.label) {
66
+ var _b, _c, _d, _e;
67
+ return __generator(this, function (_f) {
68
+ switch (_f.label) {
69
69
  case 0:
70
70
  if (!step.dependencies) return [3 /*break*/, 2];
71
- idProyecto = (_b = dependencyStore[step.dependencies[0]]) === null || _b === void 0 ? void 0 : _b.id;
72
- idMacroProyecto = (_c = dependencyStore[step.dependencies[0]]) === null || _c === void 0 ? void 0 : _c.idMacroProyecto;
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
73
  if (!idProyecto) {
74
74
  return [2 /*return*/, null]; //null para indicar que falta la depedency
75
75
  }
@@ -80,7 +80,7 @@ function CBRPropertyStepComponent(props) {
80
80
  idProyecto +
81
81
  '&idOrganization=' +
82
82
  idOrganization)];
83
- case 1: return [2 /*return*/, (_d.sent()).data];
83
+ case 1: return [2 /*return*/, (_f.sent()).data];
84
84
  case 2: return [2 /*return*/, null];
85
85
  }
86
86
  });
@@ -76,27 +76,24 @@ function AYFStepMapper(props) {
76
76
  });
77
77
  }); };
78
78
  var getCiudadesOptions = function (_a, step, dependencyStore) {
79
- var idOrganization = _a.idOrganization, mainCity = _a.mainCity;
79
+ var idOrganization = _a.idOrganization;
80
80
  return __awaiter(_this, void 0, void 0, function () {
81
81
  var nit, params, _i, _b, dep, value, error_1;
82
- var _c, _d;
83
- return __generator(this, function (_e) {
84
- switch (_e.label) {
82
+ var _c, _d, _e, _f;
83
+ return __generator(this, function (_g) {
84
+ switch (_g.label) {
85
85
  case 0:
86
- nit = dependencyStore[step.idNitStep];
87
- if (!nit) {
88
- return [2 /*return*/, [mainCity !== null && mainCity !== void 0 ? mainCity : 'BOGOTA']];
89
- }
86
+ nit = (_c = dependencyStore[step.idNitStep]) === null || _c === void 0 ? void 0 : _c.value;
90
87
  params = new URLSearchParams({
91
88
  idOrganization: idOrganization,
92
89
  idCompany: nit,
93
90
  nit: 'true',
94
91
  });
95
- for (_i = 0, _b = (_c = step.dependencies) !== null && _c !== void 0 ? _c : []; _i < _b.length; _i++) {
92
+ for (_i = 0, _b = (_d = step.dependencies) !== null && _d !== void 0 ? _d : []; _i < _b.length; _i++) {
96
93
  dep = _b[_i];
97
- value = dependencyStore[dep];
94
+ value = (_e = dependencyStore[dep]) === null || _e === void 0 ? void 0 : _e.value;
98
95
  if (value && dep.startsWith('AYF')) {
99
- switch ((_d = dep.split('-')) === null || _d === void 0 ? void 0 : _d[0]) {
96
+ switch ((_f = dep.split('-')) === null || _f === void 0 ? void 0 : _f[0]) {
100
97
  case AYFFormStepTypes.AYF_START_MONTH:
101
98
  params.set('startMonth', value.id);
102
99
  break;
@@ -111,14 +108,14 @@ function AYFStepMapper(props) {
111
108
  }
112
109
  }
113
110
  }
114
- _e.label = 1;
111
+ _g.label = 1;
115
112
  case 1:
116
- _e.trys.push([1, 3, , 4]);
113
+ _g.trys.push([1, 3, , 4]);
117
114
  return [4 /*yield*/, axios.get(baseUrl + 'CiudadesICA?' + params.toString())];
118
- case 2: return [2 /*return*/, (_e.sent()).data];
115
+ case 2: return [2 /*return*/, (_g.sent()).data];
119
116
  case 3:
120
- error_1 = _e.sent();
121
- return [2 /*return*/, [mainCity !== null && mainCity !== void 0 ? mainCity : 'BOGOTA']];
117
+ error_1 = _g.sent();
118
+ return [2 /*return*/, null];
122
119
  case 4: return [2 /*return*/];
123
120
  }
124
121
  });
@@ -0,0 +1,15 @@
1
+ /// <reference types="react" />
2
+ import { ApiSelector } from '../../../@Types/FormStep';
3
+ import { StepProps } from '../Step';
4
+ export interface StepOptions {
5
+ id: string | number;
6
+ label: string;
7
+ }
8
+ export interface ApiSelectorStepProps extends StepProps {
9
+ /** The ApiSelectorStep to display */
10
+ step: ApiSelector;
11
+ /** Default value to display */
12
+ defaultValue?: Date | null;
13
+ }
14
+ declare function ApiSelectorStep({ ...props }: ApiSelectorStepProps): JSX.Element;
15
+ export default ApiSelectorStep;
@@ -0,0 +1,35 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
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
+ import { jsx as _jsx } from "react/jsx-runtime";
24
+ import { FormStyleTypes } from '../../../constants/FormStepTypes';
25
+ import MaterialApiSelectorStep from './MaterialApiSelectorStep/MaterialApiSelectorStep';
26
+ function ApiSelectorStep(_a) {
27
+ var props = __rest(_a, []);
28
+ switch (props.formStyle.type) {
29
+ case FormStyleTypes.MATERIAL:
30
+ default: {
31
+ return _jsx(MaterialApiSelectorStep, __assign({}, props));
32
+ }
33
+ }
34
+ }
35
+ export default ApiSelectorStep;
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { ApiSelectorStepProps } from '../ApiSelectorStep';
3
+ export default ApiSelectorStep;
4
+ declare function ApiSelectorStep(props: ApiSelectorStepProps): JSX.Element;