@arquimedes.co/eureka-forms 3.0.19-refactor → 3.0.21-refactor

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 (57) hide show
  1. package/dist/@Types/FormStep.d.ts +7 -3
  2. package/dist/@Types/GenericFormSteps.d.ts +1 -0
  3. package/dist/App/App.css +11 -0
  4. package/dist/App/App.d.ts +6 -0
  5. package/dist/App/App.js +3 -1
  6. package/dist/App/AppFunctions.d.ts +4 -4
  7. package/dist/App/AppFunctions.test.js +70 -0
  8. package/dist/App/AppHooks.d.ts +1 -1
  9. package/dist/App/AppHooks.js +11 -2
  10. package/dist/Contexts/CustomContext.d.ts +3 -0
  11. package/dist/Form/ConfirmationDialog/ConfirmationDialog.d.ts +2 -1
  12. package/dist/Form/ConfirmationDialog/ConfirmationDialog.js +4 -10
  13. package/dist/Form/Form.d.ts +2 -0
  14. package/dist/Form/FormFunctions.js +4 -0
  15. package/dist/Form/FormFunctions.test.js +4 -0
  16. package/dist/FormSteps/@Construction/CBRElementStep/CBRElementStep.js +1 -1
  17. package/dist/FormSteps/@Construction/CBRPropertyStep/CBRPropertyStep.js +1 -1
  18. package/dist/FormSteps/AYFStepMapper.js +1 -1
  19. package/dist/FormSteps/ApiSelectorStep/MaterialApiSelectorStep/MaterialApiSelectorStep.js +1 -1
  20. package/dist/FormSteps/CBRStepMapper.js +5 -5
  21. package/dist/FormSteps/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValuePickerStep.js +9 -5
  22. package/dist/FormSteps/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.js +6 -3
  23. package/dist/FormSteps/SmartSelectStep/SmartSelectStep.d.ts +7 -4
  24. package/dist/FormSteps/StepFunctions.d.ts +1 -1
  25. package/dist/FormSteps/StepFunctions.js +7 -4
  26. package/dist/FormSteps/StepFunctions.test.js +2 -2
  27. package/dist/FormSteps/TitleStep/MaterialTitleStep/MaterialTitleStep.js +27 -16
  28. package/dist/Services/DraftService.d.ts +23 -0
  29. package/dist/Services/DraftService.js +30 -0
  30. package/dist/Shared/ErkDatePicker/ErkDatePicker.d.ts +2 -2
  31. package/dist/Shared/ErkSelect/ErkSelect.js +1 -1
  32. package/dist/Shared/ErkTimePicker/ErkTimePicker.js +1 -1
  33. package/dist/Shared/SmartDraftRenderer/DraftLoadingContext.d.ts +1 -0
  34. package/dist/Shared/SmartDraftRenderer/DraftLoadingContext.js +2 -0
  35. package/dist/Shared/SmartDraftRenderer/FormDecorator.d.ts +12 -0
  36. package/dist/Shared/SmartDraftRenderer/FormDecorator.js +20 -0
  37. package/dist/Shared/SmartDraftRenderer/FormDecorator.module.css +30 -0
  38. package/dist/Shared/SmartDraftRenderer/SmartDraftRenderer.d.ts +11 -0
  39. package/dist/Shared/SmartDraftRenderer/SmartDraftRenderer.js +58 -0
  40. package/dist/States/GlobalSlice.d.ts +4 -0
  41. package/dist/Utils/AxiosAPI.d.ts +10 -0
  42. package/dist/Utils/AxiosAPI.js +22 -0
  43. package/dist/Utils/MaterialProviders.d.ts +1 -1
  44. package/dist/Utils/MaterialProviders.js +1 -1
  45. package/dist/Utils/StoreContext.d.ts +2 -0
  46. package/dist/Utils/StoreContext.js +2 -0
  47. package/dist/Utils/TestUtils.d.ts +8 -2
  48. package/dist/Utils/TestUtils.js +11 -4
  49. package/dist/Utils/_api.d.ts +8 -0
  50. package/dist/Utils/_api.js +15 -0
  51. package/dist/Utils/store.d.ts +9 -3
  52. package/dist/Utils/store.js +7 -1
  53. package/dist/constants/FormStepTypes.d.ts +2 -1
  54. package/dist/constants/FormStepTypes.js +1 -0
  55. package/dist/hooks.d.ts +0 -2
  56. package/dist/hooks.js +1 -2
  57. package/package.json +17 -17
@@ -7,8 +7,8 @@ import { Time } from './Time';
7
7
  export type FormStep = Title | TimePicker | Rating | CheckBox | TextArea | TextInput | DatePicker | FileUpload | Separator | FormSelector | ClassifierSelector | Collapsible | EntityValuePicker | ApiSelector | Mapper;
8
8
  export interface Title extends GSteps.GBaseStep {
9
9
  type: FormStepTypes.TITLE;
10
- title: string;
11
- description: string | null;
10
+ title?: EurekaDraft;
11
+ description?: EurekaDraft;
12
12
  size?: 1 | 2 | 3 | 4;
13
13
  }
14
14
  export interface TimePicker extends GSteps.GTimePicker {
@@ -146,7 +146,7 @@ export interface ValueEntityValuePickerPath {
146
146
  type: EntityValueDataTypes.VALUE;
147
147
  idEntityValue: string | null;
148
148
  }
149
- export type EntityValuePickerFilter = StepEntityValuePickerFilter | ValueEntityValuePickerFilter;
149
+ export type EntityValuePickerFilter = StepEntityValuePickerFilter | ValueEntityValuePickerFilter | CurrentAgentEntityValuePickerFilter;
150
150
  export interface StepEntityValuePickerFilter {
151
151
  idProperty: string;
152
152
  type: EntityValueDataTypes.STEP;
@@ -159,6 +159,10 @@ export interface ValueEntityValuePickerFilter {
159
159
  type: EntityValueDataTypes.VALUE;
160
160
  value: any;
161
161
  }
162
+ export interface CurrentAgentEntityValuePickerFilter {
163
+ idProperty: string;
164
+ type: EntityValueDataTypes.CURRENT_AGENT;
165
+ }
162
166
  export interface ApiSelector extends GSteps.GSmartSelect {
163
167
  type: FormStepTypes.API_SELECTOR;
164
168
  icon?: ErkIconTypes;
@@ -2,6 +2,7 @@ import { Condition } from './Condition';
2
2
  export interface GBaseStep {
3
3
  id: string;
4
4
  idSection: string;
5
+ stepPath: string[];
5
6
  type: string;
6
7
  editable?: boolean;
7
8
  partial?: boolean;
package/dist/App/App.css CHANGED
@@ -18,3 +18,14 @@
18
18
  text-align: center;
19
19
  }
20
20
  }
21
+
22
+ .Erk-Forms-Draft {
23
+ text-align: center;
24
+ pointer-events: none;
25
+ }
26
+
27
+ .Erk-Forms-Draft {
28
+ .public-DraftStyleDefault-block {
29
+ margin: 1px 0px;
30
+ }
31
+ }
package/dist/App/App.d.ts CHANGED
@@ -3,9 +3,12 @@ import './App.css';
3
3
  import { CustomStep, CustomStepProps } from '../FormSteps/CustomStep';
4
4
  import { EditorState } from 'draft-js';
5
5
  import { CountryCode } from 'libphonenumber-js';
6
+ import { EurekaDraft } from '../@Types/Draft/Draft';
6
7
  export interface AppProps {
7
8
  /** If the app is currently a widget */
8
9
  isWidget?: boolean;
10
+ /** The id of the current agent using the form (Internal)*/
11
+ idCurrentAgent?: string;
9
12
  /** The apikey of the Form */
10
13
  apiKey?: string;
11
14
  /** The id of the form's organization */
@@ -35,6 +38,7 @@ export interface AppProps {
35
38
  /** Custom Confirmation Content */
36
39
  customConfirmation?: (confirmation: {
37
40
  url: string;
41
+ idTicket: string;
38
42
  caseNumber: string;
39
43
  }, renderIcon: () => JSX.Element, renderConfirmation: (state?: EditorState) => JSX.Element | null, renderLink: () => JSX.Element | null, onClose: () => void) => JSX.Element;
40
44
  customClientInfoStep?: (props: CustomStepProps) => JSX.Element;
@@ -46,6 +50,8 @@ export interface AppProps {
46
50
  customSubmitBtns?: null | ((onSubmit: () => Promise<Record<string, any> | void>, loading: boolean) => JSX.Element);
47
51
  /** Function to call on postview to fetch the download url of a file */
48
52
  fetchDownloadUrl?: (S3Key: string, fileName: string) => Promise<string>;
53
+ /** Function to call to map entities internally (postview, activities) */
54
+ mapDraftEntities?: (property: string, dependencies: Record<string, any>) => Promise<EurekaDraft>;
49
55
  /** Function to call after the confimation dialog has been closed */
50
56
  handleConfirmed?: () => void;
51
57
  /** Function called to scroll to the top */
package/dist/App/App.js CHANGED
@@ -7,10 +7,11 @@ import FormComponent from '../Form/Form';
7
7
  import { Provider } from 'react-redux';
8
8
  import { store } from '../Utils/store';
9
9
  import { useSetupApp } from './AppHooks';
10
- import { StoreContext, useAppSelector } from '../hooks';
10
+ import { useAppSelector } from '../hooks';
11
11
  import CustomContext from '../Contexts/CustomContext';
12
12
  import { nanoid } from '@reduxjs/toolkit';
13
13
  import { IdFormContext } from '../Contexts/FormContext';
14
+ import { StoreContext } from '../Utils/StoreContext';
14
15
  function AppComponent({ formData, valuesData, ...props }) {
15
16
  const [idForm] = React.useState(nanoid(6));
16
17
  return (_jsx(IdFormContext.Provider, { value: idForm, children: _jsx(Provider, { store: store, context: StoreContext, children: _jsx(App, { formData: formData, valuesData: valuesData, ...props }) }) }));
@@ -46,6 +47,7 @@ function App({ isWidget = true, ...props }) {
46
47
  return (_jsx(CustomContext.Provider, { value: {
47
48
  customSteps,
48
49
  sendLabel: props.sendLabel,
50
+ mapDraftEntities: props.mapDraftEntities,
49
51
  fetchDownloadUrl: props.fetchDownloadUrl,
50
52
  customStepProps: props.customStepProps ?? {},
51
53
  customClientInfoStep: props.customClientInfoStep,
@@ -6,8 +6,8 @@ import { MapperElement } from '../@Types/MapperElement';
6
6
  import { MapperValue } from '../FormSteps/MapperStep/MaterialMapperStep/MaterialMapperStep';
7
7
  import { CountryCode } from 'libphonenumber-js/max';
8
8
  export declare const calcValuesStore: (orgInfo: {
9
- idOrganization: string;
10
- countryCode: CountryCode;
9
+ idOrganization?: string;
10
+ countryCode?: CountryCode;
11
11
  }, form: Readonly<Form>, originalValues?: Record<string, any>, postview?: boolean, customSteps?: Record<string, CustomStep>) => Promise<ValuesStore>;
12
12
  export declare const addMapperStep: <Type>(step: Mapper, customSteps: Record<string, CustomStep>, path?: string) => {
13
13
  element: MapperElement<Type>;
@@ -17,7 +17,7 @@ export declare const addMapperStep: <Type>(step: Mapper, customSteps: Record<str
17
17
  steps: Record<string, FormStep>;
18
18
  };
19
19
  export declare const mapOriginalValue: (orgInfo: {
20
- idOrganization: string;
21
- countryCode: CountryCode;
20
+ idOrganization?: string;
21
+ countryCode?: CountryCode;
22
22
  }, step: FormStep, value: any, values: ValuesStore, form?: Readonly<Form>, path?: string) => Promise<any>;
23
23
  export declare const calcInitialSections: (form: Form) => Pick<SiteState, "previousSections" | "idCurrentSection" | "nextSections">;
@@ -46,6 +46,7 @@ describe('AppFunctions', function () {
46
46
  label: 'Step',
47
47
  description: null,
48
48
  idSection: 'FIRST',
49
+ stepPath: [],
49
50
  type: FormStepTypes.TEXTINPUT,
50
51
  required: true,
51
52
  size: 1,
@@ -68,6 +69,7 @@ describe('AppFunctions', function () {
68
69
  type: FormStepTypes.TEXTINPUT,
69
70
  required: true,
70
71
  size: 1,
72
+ stepPath: [],
71
73
  },
72
74
  },
73
75
  });
@@ -88,6 +90,7 @@ describe('AppFunctions', function () {
88
90
  rootSteps: [],
89
91
  steps: {},
90
92
  style: { type: MapperStyleTypes.PILL },
93
+ stepPath: [],
91
94
  unitLabel: 'Elemento',
92
95
  },
93
96
  },
@@ -99,6 +102,52 @@ describe('AppFunctions', function () {
99
102
  });
100
103
  test('Empty initial Mapper Step postview', async () => {
101
104
  const values = await calcValuesStore(OrgInfo, {
105
+ ...baseForm,
106
+ steps: {
107
+ idStep: {
108
+ id: 'idStep',
109
+ label: 'Step',
110
+ description: null,
111
+ idSection: 'FIRST',
112
+ type: FormStepTypes.TEXTINPUT,
113
+ required: true,
114
+ size: 1,
115
+ stepPath: [],
116
+ },
117
+ },
118
+ });
119
+ expect(values.sections.FIRST).toBeUndefined();
120
+ });
121
+ test('Empty initial Mapper Step', async () => {
122
+ const values = await calcValuesStore({}, {
123
+ ...baseForm,
124
+ steps: {
125
+ idStep: {
126
+ id: 'idStep',
127
+ label: 'Step',
128
+ description: null,
129
+ idSection: 'FIRST',
130
+ type: FormStepTypes.MAPPER,
131
+ required: true,
132
+ addBtnLabel: 'Add',
133
+ rootSteps: [],
134
+ steps: {},
135
+ style: { type: MapperStyleTypes.PILL },
136
+ unitLabel: 'Elemento',
137
+ stepPath: [],
138
+ },
139
+ },
140
+ sections: {
141
+ FIRST: {
142
+ ...baseForm.sections.FIRST,
143
+ steps: ['idStep'],
144
+ },
145
+ },
146
+ });
147
+ expect(Object.keys(values.sections.FIRST).length).toBe(1);
148
+ });
149
+ test('Empty initial Mapper Step postview', async () => {
150
+ const values = await calcValuesStore({}, {
102
151
  ...baseForm,
103
152
  steps: {
104
153
  idStep: {
@@ -113,6 +162,7 @@ describe('AppFunctions', function () {
113
162
  steps: {},
114
163
  style: { type: MapperStyleTypes.PILL },
115
164
  unitLabel: 'Elemento',
165
+ stepPath: [],
116
166
  },
117
167
  },
118
168
  sections: {
@@ -140,6 +190,7 @@ describe('AppFunctions', function () {
140
190
  steps: {},
141
191
  style: { type: MapperStyleTypes.PILL },
142
192
  unitLabel: 'Elemento',
193
+ stepPath: [],
143
194
  },
144
195
  },
145
196
  sections: {
@@ -182,6 +233,7 @@ describe('AppFunctions', function () {
182
233
  type: FormStepTypes.TEXTINPUT,
183
234
  required: true,
184
235
  size: 1,
236
+ stepPath: ['idStep'],
185
237
  },
186
238
  idSubMapperStep: {
187
239
  id: 'idSubMapperStep',
@@ -195,10 +247,12 @@ describe('AppFunctions', function () {
195
247
  steps: {},
196
248
  style: { type: MapperStyleTypes.PILL },
197
249
  unitLabel: 'SubElemento',
250
+ stepPath: ['idStep'],
198
251
  },
199
252
  },
200
253
  style: { type: MapperStyleTypes.PILL },
201
254
  unitLabel: 'Elemento',
255
+ stepPath: [],
202
256
  }, {});
203
257
  expect(element.ids).toBeDefined();
204
258
  expect(element.isOriginal).toBe(false);
@@ -231,6 +285,7 @@ describe('AppFunctions', function () {
231
285
  type: FormStepTypes.TEXTINPUT,
232
286
  required: true,
233
287
  size: 1,
288
+ stepPath: [],
234
289
  },
235
290
  };
236
291
  calcRecursiveData(element, newSteps, {});
@@ -255,6 +310,7 @@ describe('AppFunctions', function () {
255
310
  required: true,
256
311
  size: 1,
257
312
  dependencies: ['idParentStep'],
313
+ stepPath: [],
258
314
  },
259
315
  };
260
316
  calcRecursiveData(element, newSteps, {});
@@ -279,6 +335,7 @@ describe('AppFunctions', function () {
279
335
  type: FormStepTypes.TEXTINPUT,
280
336
  required: true,
281
337
  size: 1,
338
+ stepPath: [],
282
339
  },
283
340
  'idSubStep2-idElement': {
284
341
  id: 'idSubStep2-idElement',
@@ -289,6 +346,7 @@ describe('AppFunctions', function () {
289
346
  required: true,
290
347
  size: 1,
291
348
  dependencies: ['idSubStep'],
349
+ stepPath: [],
292
350
  },
293
351
  };
294
352
  calcRecursiveData(element, newSteps, {});
@@ -323,6 +381,7 @@ describe('AppFunctions', function () {
323
381
  },
324
382
  ],
325
383
  searchable: true,
384
+ stepPath: [],
326
385
  },
327
386
  'idSubStep2-idElement': {
328
387
  id: 'idSubStep2-idElement',
@@ -332,6 +391,7 @@ describe('AppFunctions', function () {
332
391
  type: FormStepTypes.TEXTINPUT,
333
392
  required: true,
334
393
  size: 1,
394
+ stepPath: [],
335
395
  },
336
396
  };
337
397
  calcRecursiveData(element, newSteps, {});
@@ -353,6 +413,7 @@ describe('AppFunctions', function () {
353
413
  type: FormStepTypes.TEXTINPUT,
354
414
  required: true,
355
415
  size: 1,
416
+ stepPath: [],
356
417
  }, undefined, values);
357
418
  expect(value).toBeUndefined();
358
419
  });
@@ -379,10 +440,12 @@ describe('AppFunctions', function () {
379
440
  type: FormStepTypes.TEXTINPUT,
380
441
  required: true,
381
442
  size: 1,
443
+ stepPath: ['idStep'],
382
444
  },
383
445
  },
384
446
  style: { type: MapperStyleTypes.PILL },
385
447
  unitLabel: 'Elemento',
448
+ stepPath: [],
386
449
  }, [
387
450
  {
388
451
  idSubStep: 'value',
@@ -401,6 +464,7 @@ describe('AppFunctions', function () {
401
464
  type: FormStepTypes.TEXTAREA,
402
465
  required: true,
403
466
  hasTextEditor: true,
467
+ stepPath: [],
404
468
  }, 'value', {
405
469
  global: {},
406
470
  sections: {},
@@ -417,6 +481,7 @@ describe('AppFunctions', function () {
417
481
  type: FormStepTypes.TEXTAREA,
418
482
  required: true,
419
483
  hasTextEditor: true,
484
+ stepPath: [],
420
485
  }, {
421
486
  draft: {
422
487
  blocks: [
@@ -448,6 +513,7 @@ describe('AppFunctions', function () {
448
513
  type: FormStepTypes.TEXTAREA,
449
514
  required: true,
450
515
  hasTextEditor: false,
516
+ stepPath: [],
451
517
  }, 'value', {
452
518
  global: {},
453
519
  sections: {},
@@ -463,6 +529,7 @@ describe('AppFunctions', function () {
463
529
  type: FormStepTypes.TEXTAREA,
464
530
  required: true,
465
531
  hasTextEditor: false,
532
+ stepPath: [],
466
533
  }, {
467
534
  draft: {
468
535
  blocks: [
@@ -502,6 +569,7 @@ describe('AppFunctions', function () {
502
569
  ],
503
570
  searchable: true,
504
571
  size: 1,
572
+ stepPath: [],
505
573
  }, 'value', {
506
574
  global: {},
507
575
  sections: {},
@@ -525,6 +593,7 @@ describe('AppFunctions', function () {
525
593
  ],
526
594
  searchable: true,
527
595
  size: 1,
596
+ stepPath: [],
528
597
  }, { label: 'Label', value: 'value' }, {
529
598
  global: {},
530
599
  sections: {},
@@ -549,6 +618,7 @@ describe('AppFunctions', function () {
549
618
  idClassifier: '1234',
550
619
  searchable: true,
551
620
  size: 1,
621
+ stepPath: [],
552
622
  }, '12345', {
553
623
  global: {},
554
624
  sections: {},
@@ -1,7 +1,7 @@
1
1
  import { Form, Organization } from '../@Types';
2
2
  import { AppProps } from './App';
3
3
  import { Branding } from '../@Types/Branding';
4
- export declare const useSetupApp: (isEmbedded: boolean, { preview, internal, postview, partial, editable, handleConfirmed, customSteps, valuesData, apiKey, formData, classifiers, ...others }: Omit<AppProps, "isWidget">) => {
4
+ export declare const useSetupApp: (isEmbedded: boolean, { preview, internal, postview, partial, editable, handleConfirmed, customSteps, valuesData, apiKey, formData, classifiers, idCurrentAgent, ...others }: Omit<AppProps, "isWidget">) => {
5
5
  form: Form | undefined | null;
6
6
  organization: Organization | undefined | null;
7
7
  branding: Branding | undefined;
@@ -10,7 +10,7 @@ import { calcDependencies } from '../Form/FormFunctions';
10
10
  import { iterateNestedSteps } from '../FormSteps/StepFunctions';
11
11
  import { createNextState } from '@reduxjs/toolkit';
12
12
  import { BaseConfirmationMessage } from '../Contexts/FormContext';
13
- export const useSetupApp = (isEmbedded, { preview, internal, postview, partial, editable, handleConfirmed, customSteps, valuesData, apiKey, formData, classifiers, ...others }) => {
13
+ export const useSetupApp = (isEmbedded, { preview, internal, postview, partial, editable, handleConfirmed, customSteps, valuesData, apiKey, formData, classifiers, idCurrentAgent, ...others }) => {
14
14
  const [form, setForm] = useState(undefined);
15
15
  const [organization, setOrganization] = useState(undefined);
16
16
  const dispatch = useAppDispatch();
@@ -64,8 +64,15 @@ export const useSetupApp = (isEmbedded, { preview, internal, postview, partial,
64
64
  /** Assign the idSection to all the forms steps */
65
65
  for (const section of Object.values(form.sections)) {
66
66
  for (const idStep of section.steps) {
67
- iterateNestedSteps(idStep, form.steps, (step) => {
67
+ iterateNestedSteps(idStep, form.steps, (step, path) => {
68
68
  step.idSection = section.id;
69
+ step.stepPath = path;
70
+ });
71
+ }
72
+ for (const idStep of form.hiddenSteps ?? []) {
73
+ iterateNestedSteps(idStep, form.steps, (step, path) => {
74
+ step.idSection = section.id;
75
+ step.stepPath = path;
69
76
  });
70
77
  }
71
78
  }
@@ -80,6 +87,7 @@ export const useSetupApp = (isEmbedded, { preview, internal, postview, partial,
80
87
  const dependencies = {};
81
88
  const values = await calcValuesStore({ idOrganization, countryCode }, form, valuesData, postview, customSteps);
82
89
  dispatch(reset({
90
+ apiKey,
83
91
  formStyle: internal
84
92
  ? InternalFormStyle
85
93
  : {
@@ -92,6 +100,7 @@ export const useSetupApp = (isEmbedded, { preview, internal, postview, partial,
92
100
  },
93
101
  internal: !!internal,
94
102
  idOrganization,
103
+ idCurrentAgent,
95
104
  preview: !!preview,
96
105
  partial: !!partial,
97
106
  postview: !!postview,
@@ -1,4 +1,5 @@
1
1
  import { CustomStep, CustomStepProps } from '../FormSteps/CustomStep';
2
+ import { EurekaDraft } from '../@Types/Draft/Draft';
2
3
  export interface CustomContextData {
3
4
  sendLabel?: string;
4
5
  customStepProps: Record<string, unknown>;
@@ -6,6 +7,8 @@ export interface CustomContextData {
6
7
  customClientInfoStep?: (props: CustomStepProps) => JSX.Element;
7
8
  /** Function to call on postview to fetch the download url of a file */
8
9
  fetchDownloadUrl?: (S3Key: string, fileName: string) => Promise<string>;
10
+ /** Function to call to map entities internally (postview, activities) */
11
+ mapDraftEntities?: (property: string, dependencies: Record<string, any>) => Promise<EurekaDraft>;
9
12
  }
10
13
  declare const CustomContext: import("react").Context<CustomContextData>;
11
14
  export default CustomContext;
@@ -3,9 +3,10 @@ interface ConfirmationDialogProps {
3
3
  confirmation: {
4
4
  case: string;
5
5
  url: string;
6
+ idTicket: string;
6
7
  };
7
8
  customConfirmation?: AppProps['customConfirmation'];
8
9
  onClose: () => void;
9
10
  }
10
- declare function ConfirmationDialog({ onClose, confirmation, customConfirmation, }: ConfirmationDialogProps): JSX.Element;
11
+ declare function ConfirmationDialog({ onClose, confirmation, customConfirmation }: ConfirmationDialogProps): JSX.Element;
11
12
  export default ConfirmationDialog;
@@ -9,7 +9,7 @@ import { mapDraftEntities } from '../../Utils/DraftFunctions';
9
9
  import FormContext from '../../Contexts/FormContext';
10
10
  import CloseIcon from '../../Icons/CloseIcon';
11
11
  import CheckCircleIcon from '../../Icons/CheckCircleIcon';
12
- function ConfirmationDialog({ onClose, confirmation, customConfirmation, }) {
12
+ function ConfirmationDialog({ onClose, confirmation, customConfirmation }) {
13
13
  const { formStyle, ...global } = useAppSelector((state) => state.global);
14
14
  const form = useContext(FormContext);
15
15
  const dependencies = useAppSelector((state) => state.site.dependencies);
@@ -20,12 +20,7 @@ function ConfirmationDialog({ onClose, confirmation, customConfirmation, }) {
20
20
  dependencies,
21
21
  ticket: { caseNumber: confirmation.case },
22
22
  }, global.confirmation.confirmationMessage)));
23
- }, [
24
- form,
25
- dependencies,
26
- confirmation.case,
27
- global.confirmation.confirmationMessage,
28
- ]);
23
+ }, [form, dependencies, confirmation.case, global.confirmation.confirmationMessage]);
29
24
  const hasText = editorState.getCurrentContent().hasText();
30
25
  const renderIcon = () => {
31
26
  return (_jsx("div", { className: styles.checkContainer, style: {
@@ -46,9 +41,7 @@ function ConfirmationDialog({ onClose, confirmation, customConfirmation, }) {
46
41
  const renderLink = () => {
47
42
  if (!global.confirmation.showLink)
48
43
  return null;
49
- return (_jsxs(_Fragment, { children: [_jsx("div", { className: widthStats.isMobile
50
- ? styles.mobileLinkContainer
51
- : styles.linkContainer, children: "Puedes consultar el estado aqui:" }), _jsx("a", { className: styles.url, "data-testid": "ResUrl", target: "_blank", rel: "noreferrer", href: confirmation.url, style: {
44
+ return (_jsxs(_Fragment, { children: [_jsx("div", { className: widthStats.isMobile ? styles.mobileLinkContainer : styles.linkContainer, children: "Puedes consultar el estado aqui:" }), _jsx("a", { className: styles.url, "data-testid": "ResUrl", target: "_blank", rel: "noreferrer", href: confirmation.url, style: {
52
45
  color: '#293241',
53
46
  fontSize: widthStats.isMobile ? '1rem' : '1.2rem',
54
47
  }, children: confirmation.url })] }));
@@ -67,6 +60,7 @@ function ConfirmationDialog({ onClose, confirmation, customConfirmation, }) {
67
60
  }, children: _jsx(CloseIcon, { style: { fontSize: 'inherit' } }) }), !customConfirmation && (_jsxs("div", { className: styles.container, children: [renderIcon(), renderConfirmation(), renderLink()] })), customConfirmation?.({
68
61
  url: confirmation.url,
69
62
  caseNumber: confirmation.case,
63
+ idTicket: confirmation.idTicket,
70
64
  }, renderIcon, renderConfirmation, renderLink, onClose)] }) }));
71
65
  }
72
66
  export default ConfirmationDialog;
@@ -8,6 +8,8 @@ import { Form } from '../@Types';
8
8
  import { FormStep } from '../@Types/FormStep';
9
9
  import { CBRFormStep } from '../@Types/CBRFormStep';
10
10
  export interface StepDependency {
11
+ /** The id of the step before it was mapped */
12
+ idOriginal: string;
11
13
  dependents: (FormStep | CBRFormStep)[];
12
14
  value: any;
13
15
  type: FormStepTypes | CBRFormStepTypes | 'ORIGINAL';
@@ -168,14 +168,18 @@ function calcStepDependency(idStep, steps, values, customSteps) {
168
168
  if (!originalValue)
169
169
  console.error('Missing Step Dependency:', idStep);
170
170
  return {
171
+ idOriginal: idStep,
171
172
  type: originalValue ? 'ORIGINAL' : 'MISSING',
172
173
  value: originalValue ?? null,
173
174
  dependents: [],
174
175
  };
175
176
  }
176
177
  const originalValue = values.sections[depStep.idSection]?.[depStep.id] ?? values.global[depStep.id];
178
+ if (!depStep.stepPath)
179
+ console.error('Missing stepPath', depStep);
177
180
  return {
178
181
  type: depStep.type,
182
+ idOriginal: depStep.stepPath?.[0] ?? [idStep],
179
183
  value: calcStepDependencyValue(depStep, originalValue, customSteps),
180
184
  dependents: [],
181
185
  };
@@ -42,6 +42,7 @@ describe('FormFunctions', function () {
42
42
  idSection: 'idSection',
43
43
  required: false,
44
44
  size: 1,
45
+ stepPath: [],
45
46
  },
46
47
  }, {}, {}, [], 'Value');
47
48
  expect(value).toBe('Value');
@@ -56,6 +57,7 @@ describe('FormFunctions', function () {
56
57
  idSection: 'idSection',
57
58
  required: false,
58
59
  hasTextEditor: false,
60
+ stepPath: [],
59
61
  },
60
62
  }, {}, {}, [], 'Value');
61
63
  expect(value.value).toBe('Value');
@@ -71,6 +73,7 @@ describe('FormFunctions', function () {
71
73
  idSection: 'idSection',
72
74
  required: false,
73
75
  hasTextEditor: true,
76
+ stepPath: [],
74
77
  },
75
78
  }, {}, {}, [], EditorState.createWithContent(ContentState.createFromText('Value')));
76
79
  expect(value.value).toBe('Value');
@@ -85,6 +88,7 @@ describe('FormFunctions', function () {
85
88
  description: '',
86
89
  idSection: 'idSection',
87
90
  required: false,
91
+ stepPath: [],
88
92
  },
89
93
  }, {}, {}, [], [
90
94
  {
@@ -28,7 +28,7 @@ function ElementSubStepRenderer({ value, ...stepProps }) {
28
28
  }
29
29
  return (_jsx(SmartSelectStep, { ...stepProps, step: subStep, IconComponent: () => _jsx(InputIcon, { icon: ErkIconTypes.LEAK }), getOptions: getElementOptions, calcDepError: calcDepError, getOptionSelected: (option, value) => option.id === value.id, getValueString: (value) => value?.id, renderNestedSteps: (value) => (_jsx(ElementSubStepRenderer, { value: value, ...stepProps, step: subStep })) }));
30
30
  }
31
- const getElementOptions = async (idOrganization, step, dependencyStore) => {
31
+ const getElementOptions = async (step, dependencyStore, { idOrganization }) => {
32
32
  if (step.dependencies && idOrganization) {
33
33
  const idProyecto = dependencyStore[step.dependencies[0]]?.value?.id;
34
34
  if (!idProyecto) {
@@ -15,7 +15,7 @@ const baseUrl = `https://integrations.${import.meta.env.VITE_REACT_APP_DOMAIN}/s
15
15
  function CBRPropertyStepComponent(props) {
16
16
  const { formStyle } = useAppSelector((state) => state.global);
17
17
  const [showWarning, setShowWarning] = useState(undefined);
18
- const getInmueblesOptions = async (idOrganization, step, dependencyStore) => {
18
+ const getInmueblesOptions = async (step, dependencyStore, { idOrganization }) => {
19
19
  if (step.dependencies && idOrganization) {
20
20
  const idProyecto = dependencyStore[step.dependencies[0]]?.value?.id;
21
21
  const idMacroProyecto = dependencyStore[step.dependencies[0]]?.value?.idMacroProyecto;
@@ -26,7 +26,7 @@ function AYFStepMapper(props) {
26
26
  { id: '12', label: 'Diciembre' },
27
27
  ];
28
28
  };
29
- const getCiudadesOptions = async (idOrganization, step, dependencyStore) => {
29
+ const getCiudadesOptions = async (step, dependencyStore, { idOrganization }) => {
30
30
  if (!idOrganization)
31
31
  return null;
32
32
  const nit = dependencyStore[step.idNitStep]?.value;
@@ -18,7 +18,7 @@ function ApiSelectorComponent({ step, editable, ...others }) {
18
18
  function calcOptionLabel(option) {
19
19
  return option?.[step.labelAttribute] ?? '';
20
20
  }
21
- const getApiOptions = useMemo(() => async (idOrganization, step, dependencyStore) => {
21
+ const getApiOptions = useMemo(() => async (step, dependencyStore, { idOrganization }) => {
22
22
  function calcOptionId(option) {
23
23
  return option?.[step.idAttribute] ?? '';
24
24
  }
@@ -12,12 +12,12 @@ import PersonIcon from '../Icons/PersonIcon';
12
12
  import { ErkIconTypes } from '../constants/ErkIconTypes';
13
13
  const baseUrl = `https://integrations.${import.meta.env.VITE_REACT_APP_DOMAIN}/sinco/cbr/`;
14
14
  function CBRStepMapper(props) {
15
- const getTipoDocOptions = async (idOrganization) => {
15
+ const getTipoDocOptions = async (_step, _dependencies, { idOrganization }) => {
16
16
  if (!idOrganization)
17
17
  return null;
18
18
  return (await axios.get(baseUrl + 'TiposDoc?idOrganization=' + idOrganization)).data;
19
19
  };
20
- const getProyectoOptions = async (idOrganization, step, dependencyStore) => {
20
+ const getProyectoOptions = async (step, dependencyStore, { idOrganization }) => {
21
21
  if (!idOrganization)
22
22
  return null;
23
23
  const idMacroProyecto = dependencyStore[step.dependencies?.[0] ?? '']?.value?.id;
@@ -27,17 +27,17 @@ function CBRStepMapper(props) {
27
27
  }
28
28
  return proyectos;
29
29
  };
30
- const getMacroProyectoOptions = async (idOrganization) => {
30
+ const getMacroProyectoOptions = async (_step, _dependencies, { idOrganization }) => {
31
31
  if (!idOrganization)
32
32
  return null;
33
33
  return (await axios.get(baseUrl + 'MacroProyectos?idOrganization=' + idOrganization)).data;
34
34
  };
35
- const getTipoSolicitanteOptions = async (idOrganization) => {
35
+ const getTipoSolicitanteOptions = async (_step, _dependencies, { idOrganization }) => {
36
36
  if (!idOrganization)
37
37
  return null;
38
38
  return (await axios.get(baseUrl + 'TiposSolicitante?idOrganization=' + idOrganization)).data;
39
39
  };
40
- const getTipoEspaciosOptions = async (idOrganization, step, dependencyStore) => {
40
+ const getTipoEspaciosOptions = async (step, dependencyStore, { idOrganization }) => {
41
41
  if (step.dependencies && idOrganization) {
42
42
  const idProyecto = dependencyStore[step.dependencies[0]]?.value?.id;
43
43
  if (!idProyecto) {