@arquimedes.co/eureka-forms 3.0.52-new-steps → 3.0.53-claude-evlog-migration

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 (103) hide show
  1. package/dist/@Types/FormStep.d.ts +2 -7
  2. package/dist/@Types/FormStep.js +1 -2
  3. package/dist/App/App.stories.js +3 -2
  4. package/dist/App/AppHooks.js +2 -3
  5. package/dist/Form/Form.js +2 -1
  6. package/dist/Form/FormFunctions.js +3 -2
  7. package/dist/Form/FormTypes/ColumnForm/ColumnForm.js +2 -1
  8. package/dist/Form/FormTypes/StepperForm/StepperForm.js +2 -1
  9. package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/FileComponent/FileComponent.js +2 -1
  10. package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.js +3 -2
  11. package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/PagedMapperElement/PagedMapperElement.js +2 -1
  12. package/dist/FormSteps/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.js +2 -1
  13. package/dist/FormSteps/Step.js +2 -17
  14. package/dist/FormSteps/StepFunctions.js +2 -15
  15. package/dist/FormSteps/StepFunctions.test.js +0 -54
  16. package/dist/Login/LoginPage.js +2 -1
  17. package/dist/Shared/ErkDatePicker/ErkDatePicker.js +7 -5
  18. package/dist/Shared/ErkDateRangePicker/ErkDateRangePicker.d.ts +3 -2
  19. package/dist/Shared/ErkDateRangePicker/ErkDateRangePicker.js +5 -4
  20. package/dist/Shared/Navbar/Navbar.js +2 -1
  21. package/dist/Shared/SmartDraftRenderer/LinkDecorator.js +2 -2
  22. package/dist/Utils/Logger.d.ts +10 -0
  23. package/dist/Utils/Logger.js +31 -0
  24. package/dist/Utils/PhoneFunctions.js +3 -2
  25. package/dist/constants/FormStepTypes.d.ts +1 -5
  26. package/dist/constants/FormStepTypes.js +0 -4
  27. package/dist/main.js +2 -1
  28. package/package.json +8 -8
  29. package/dist/@Types/AvailabilityFormStep.d.ts +0 -48
  30. package/dist/@Types/AvailabilityFormStep.js +0 -24
  31. package/dist/@Types/BankAccountFormStep.d.ts +0 -67
  32. package/dist/@Types/BankAccountFormStep.js +0 -14
  33. package/dist/@Types/BookingFormStep.d.ts +0 -166
  34. package/dist/@Types/BookingFormStep.js +0 -44
  35. package/dist/@Types/CalendarFormStep.d.ts +0 -192
  36. package/dist/@Types/CalendarFormStep.js +0 -48
  37. package/dist/@Types/CommunicationChannelFormStep.d.ts +0 -51
  38. package/dist/@Types/CommunicationChannelFormStep.js +0 -15
  39. package/dist/@Types/ConsentFormStep.d.ts +0 -36
  40. package/dist/@Types/ConsentFormStep.js +0 -8
  41. package/dist/@Types/EntityFormFormStep.d.ts +0 -66
  42. package/dist/@Types/EntityFormFormStep.js +0 -20
  43. package/dist/@Types/EventFormStep.d.ts +0 -52
  44. package/dist/@Types/EventFormStep.js +0 -13
  45. package/dist/@Types/ExternalReferenceFormStep.d.ts +0 -74
  46. package/dist/@Types/ExternalReferenceFormStep.js +0 -20
  47. package/dist/@Types/LocationFormStep.d.ts +0 -159
  48. package/dist/@Types/LocationFormStep.js +0 -46
  49. package/dist/@Types/NumericFormSteps.d.ts +0 -108
  50. package/dist/@Types/NumericFormSteps.js +0 -20
  51. package/dist/@Types/PredefinedSelectorFormStep.d.ts +0 -51
  52. package/dist/@Types/PredefinedSelectorFormStep.js +0 -39
  53. package/dist/@Types/StepRef.d.ts +0 -135
  54. package/dist/@Types/StepRef.js +0 -49
  55. package/dist/FormSteps/BookingStep/BookingStep.d.ts +0 -17
  56. package/dist/FormSteps/BookingStep/BookingStep.js +0 -14
  57. package/dist/FormSteps/BookingStep/MaterialBookingStep/MaterialBookingStep.d.ts +0 -7
  58. package/dist/FormSteps/BookingStep/MaterialBookingStep/MaterialBookingStep.js +0 -31
  59. package/dist/FormSteps/CalendarStep/CalendarStep.d.ts +0 -7
  60. package/dist/FormSteps/CalendarStep/CalendarStep.js +0 -14
  61. package/dist/FormSteps/CalendarStep/MaterialCalendarStep/MaterialCalendarStep.d.ts +0 -3
  62. package/dist/FormSteps/CalendarStep/MaterialCalendarStep/MaterialCalendarStep.js +0 -269
  63. package/dist/FormSteps/CalendarStep/MaterialCalendarStep/MaterialCalendarStep.module.css +0 -531
  64. package/dist/FormSteps/LocationStep/LocationStep.d.ts +0 -10
  65. package/dist/FormSteps/LocationStep/LocationStep.js +0 -14
  66. package/dist/FormSteps/LocationStep/MaterialLocationStep/MaterialLocationStep.d.ts +0 -3
  67. package/dist/FormSteps/LocationStep/MaterialLocationStep/MaterialLocationStep.js +0 -47
  68. package/dist/FormSteps/LocationStep/MaterialLocationStep/MaterialLocationStep.module.css +0 -18
  69. package/dist/FormSteps/NumberStep/MaterialNumberStep/MaterialNumberStep.d.ts +0 -3
  70. package/dist/FormSteps/NumberStep/MaterialNumberStep/MaterialNumberStep.js +0 -168
  71. package/dist/FormSteps/NumberStep/MaterialNumberStep/MaterialNumberStep.module.css +0 -94
  72. package/dist/FormSteps/NumberStep/NumberStep.d.ts +0 -10
  73. package/dist/FormSteps/NumberStep/NumberStep.js +0 -14
  74. package/dist/Icons/AddIcon.d.ts +0 -3
  75. package/dist/Icons/AddIcon.js +0 -7
  76. package/dist/Icons/EditIcon.d.ts +0 -3
  77. package/dist/Icons/EditIcon.js +0 -7
  78. package/dist/Icons/RemoveIcon.d.ts +0 -3
  79. package/dist/Icons/RemoveIcon.js +0 -7
  80. package/dist/Icons/ViewDayIcon.d.ts +0 -3
  81. package/dist/Icons/ViewDayIcon.js +0 -7
  82. package/dist/Icons/ViewWeekIcon.d.ts +0 -3
  83. package/dist/Icons/ViewWeekIcon.js +0 -7
  84. package/dist/Shared/ErkAddressAutocomplete/ErkAddressAutocomplete.d.ts +0 -19
  85. package/dist/Shared/ErkAddressAutocomplete/ErkAddressAutocomplete.js +0 -80
  86. package/dist/Shared/ErkAddressAutocomplete/ErkAddressAutocomplete.module.css +0 -82
  87. package/dist/Shared/ErkAddressAutocomplete/googlePlaces.d.ts +0 -29
  88. package/dist/Shared/ErkAddressAutocomplete/googlePlaces.js +0 -139
  89. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.d.ts +0 -28
  90. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.js +0 -149
  91. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.module.css +0 -113
  92. package/dist/Shared/ErkLocationField/ErkLocationField.d.ts +0 -23
  93. package/dist/Shared/ErkLocationField/ErkLocationField.js +0 -73
  94. package/dist/Shared/ErkLocationField/ErkLocationField.module.css +0 -29
  95. package/dist/Shared/ErkLocationField/addressFields.d.ts +0 -12
  96. package/dist/Shared/ErkLocationField/addressFields.js +0 -34
  97. package/dist/Shared/ErkLocationField/locationRestrictions.d.ts +0 -6
  98. package/dist/Shared/ErkLocationField/locationRestrictions.js +0 -51
  99. package/dist/Shared/ErkLocationInput/ErkLocationInput.d.ts +0 -15
  100. package/dist/Shared/ErkLocationInput/ErkLocationInput.js +0 -502
  101. package/dist/Shared/ErkLocationInput/ErkLocationInput.module.css +0 -115
  102. package/dist/Shared/ErkNumberField/ErkNumberField.d.ts +0 -42
  103. package/dist/Shared/ErkNumberField/ErkNumberField.js +0 -170
@@ -5,13 +5,7 @@ import { EurekaDraft } from './Draft/Draft';
5
5
  import { ErkValue } from './ErkValue';
6
6
  import * as GSteps from './GenericFormSteps';
7
7
  import { Time } from './Time';
8
- import { LocationStep } from './LocationFormStep';
9
- import { NumberStep, NumberStepType } from './NumericFormSteps';
10
- import { BookingStep } from './BookingFormStep';
11
- import { CalendarStep } from './CalendarFormStep';
12
- export type { LocationStep, NumberStep, BookingStep, CalendarStep };
13
- export { NumberStepType };
14
- export type FormStep = Title | TimePicker | Rating | CheckBox | TextArea | TextInput | DatePicker | FileUpload | Separator | FormSelector | ClassifierSelector | Collapsible | EntityValuePicker | ApiSelector | Mapper | DatePickerRange | LocationStep | NumberStep | BookingStep | CalendarStep;
8
+ export type FormStep = Title | TimePicker | Rating | CheckBox | TextArea | TextInput | DatePicker | FileUpload | Separator | FormSelector | ClassifierSelector | Collapsible | EntityValuePicker | ApiSelector | Mapper | DatePickerRange;
15
9
  export interface Title extends GSteps.GBaseStep {
16
10
  type: FormStepTypes.TITLE;
17
11
  title?: EurekaDraft;
@@ -238,3 +232,4 @@ export interface Mapper extends GSteps.GBaseStep {
238
232
  deletable?: boolean;
239
233
  max?: number;
240
234
  }
235
+ export {};
@@ -1,2 +1 @@
1
- import { NumberStepType } from './NumericFormSteps';
2
- export { NumberStepType };
1
+ export {};
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import App from './App';
3
+ import { log } from '../Utils/Logger';
3
4
  /**
4
5
  * Stories to test full forms from a `{ form, values }` payload:
5
6
  *
@@ -149,8 +150,8 @@ const meta = {
149
150
  idOrganization: 'storybook',
150
151
  valuesData: {},
151
152
  customSubmit: (values) => {
152
- // eslint-disable-next-line no-console
153
- console.log('Storybook submit:', values);
153
+ // Storybook fixtures only — real submissions must never log field values.
154
+ log.info({ form: { id: 'storybook' }, action: { name: 'submit' }, fields: Object.keys(values) });
154
155
  return Promise.resolve();
155
156
  },
156
157
  },
@@ -11,6 +11,7 @@ import { calcDependencies } from '../Form/FormFunctions';
11
11
  import { iterateNestedSteps } from '../FormSteps/StepFunctions';
12
12
  import { createNextState } from '@reduxjs/toolkit';
13
13
  import { BaseConfirmationMessage } from '../Contexts/FormContext';
14
+ import { errorFields, log } from '../Utils/Logger';
14
15
  export const useSetupApp = (isEmbedded, props) => {
15
16
  const { preview, internal, postview, partial, editable, handleConfirmed, customSteps, valuesData, apiKey, formData, classifiers, idCurrentAgent, ...others } = props;
16
17
  const [form, setForm] = useState(undefined);
@@ -136,8 +137,6 @@ export const useSetupApp = (isEmbedded, props) => {
136
137
  };
137
138
  useEffect(() => {
138
139
  void loadData();
139
- // eslint-disable-next-line no-console
140
- console.log('Form props Changed!');
141
140
  return () => {
142
141
  dispatch({ type: 'CLEAR' });
143
142
  };
@@ -189,7 +188,7 @@ export const useLogRocket = (organization, form, { apiKey, internal, postview, p
189
188
  });
190
189
  }
191
190
  catch (error) {
192
- console.error('LogRocker Error', error);
191
+ log.warn({ session: { provider: 'logrocket' }, error: errorFields(error) });
193
192
  }
194
193
  }
195
194
  };
package/dist/Form/Form.js CHANGED
@@ -19,6 +19,7 @@ import FormContext, { IdFormContext } from '../Contexts/FormContext';
19
19
  import { getAppState } from '../Utils/store';
20
20
  import LoginPage from '../Login/LoginPage';
21
21
  import { focusStep } from '../States/SiteSlice';
22
+ import { errorFields, log } from '../Utils/Logger';
22
23
  function FormComponent({ form, apiKey, reload, isWidget, branding, setSubmit, scrollToTop, customSteps, containerRef, customSubmit, customSubmitBtns, customConfirmation, }) {
23
24
  const { idOrganization, internal, postview, user } = useAppSelector((state) => state.global);
24
25
  const formMethods = useForm({
@@ -76,7 +77,7 @@ function FormComponent({ form, apiKey, reload, isWidget, branding, setSubmit, sc
76
77
  setShowConfirmation(resp?.data);
77
78
  }
78
79
  catch (error) {
79
- console.error(error);
80
+ log.error({ form: { step: 'submit' }, error: errorFields(error) });
80
81
  }
81
82
  },
82
83
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -3,6 +3,7 @@ import FormStepTypes, { EntityValueDataTypes } from '../constants/FormStepTypes'
3
3
  import { calcStepDeps } from '../FormSteps/StepHooks';
4
4
  import { calcRecursiveData } from '../Utils/FormStepFunctions';
5
5
  import { isValidPhoneNumber } from '../Utils/PhoneFunctions';
6
+ import { log } from '../Utils/Logger';
6
7
  /**
7
8
  * Function that cals the value of a step to output on submit
8
9
  */
@@ -166,7 +167,7 @@ function calcStepDependency(idStep, steps, values, customSteps) {
166
167
  if (!depStep) {
167
168
  const originalValue = values.global[idStep];
168
169
  if (!originalValue)
169
- console.error('Missing Step Dependency:', idStep);
170
+ log.warn({ form: { step: idStep }, dependency: { resolved: false } });
170
171
  return {
171
172
  idOriginal: idStep,
172
173
  type: originalValue ? 'ORIGINAL' : 'MISSING',
@@ -176,7 +177,7 @@ function calcStepDependency(idStep, steps, values, customSteps) {
176
177
  }
177
178
  const originalValue = values.sections[depStep.idSection]?.[depStep.id] ?? values.global[depStep.id];
178
179
  if (!depStep.stepPath)
179
- console.error('Missing stepPath', depStep);
180
+ log.warn({ form: { step: depStep.id, type: depStep.type }, dependency: { stepPath: false } });
180
181
  return {
181
182
  type: depStep.type,
182
183
  idOriginal: depStep.stepPath?.[0] ?? [idStep],
@@ -11,6 +11,7 @@ import CustomBtn from '../../../Shared/CustomBtn/CustomBtn';
11
11
  import FormContext, { IdFormContext } from '../../../Contexts/FormContext';
12
12
  import { addPagedValues } from '../../../States/SiteSlice';
13
13
  import { getAppState } from '../../../Utils/store';
14
+ import { log } from '../../../Utils/Logger';
14
15
  function ColumnForm({ onSubmit, customSubmitBtns, ...props }) {
15
16
  const [loading, setLoading] = useState(false);
16
17
  const { postview, editable, formStyle } = useAppSelector((state) => state.global);
@@ -29,7 +30,7 @@ function ColumnForm({ onSubmit, customSubmitBtns, ...props }) {
29
30
  }, [props.setSubmit]);
30
31
  /** Esto se usa para no tener que escuchar todo el tiempo los errores del formulario */
31
32
  const handleErrors = handleSubmit(() => { }, (errors) => {
32
- console.error('Errors:', errors);
33
+ log.warn({ form: { type: 'column' }, validation: { fields: Object.keys(errors) } });
33
34
  });
34
35
  const submit = useCallback(async () => {
35
36
  setLoading(true);
@@ -11,6 +11,7 @@ import { getAppState } from '../../../Utils/store';
11
11
  import CustomBtn from '../../../Shared/CustomBtn/CustomBtn';
12
12
  import FormContext, { IdFormContext } from '../../../Contexts/FormContext';
13
13
  import { addPagedValues } from '../../../States/SiteSlice';
14
+ import { log } from '../../../Utils/Logger';
14
15
  function StepperForm({ onSubmit, scrollToTop }) {
15
16
  const [loading, setLoading] = useState(undefined);
16
17
  const { postview, editable, formStyle } = useAppSelector((state) => state.global);
@@ -24,7 +25,7 @@ function StepperForm({ onSubmit, scrollToTop }) {
24
25
  const next = useAppSelector((state) => state.site.nextSections);
25
26
  /** Esto se usa para no tener que escuchar todo el tiempo los errores del formulario */
26
27
  const handleErrors = handleSubmit(() => { }, (errors) => {
27
- console.error('Errors:', errors);
28
+ log.warn({ form: { type: 'stepper' }, validation: { fields: Object.keys(errors) } });
28
29
  });
29
30
  const handlePrevious = useCallback(() => {
30
31
  dispatch(SiteReducer.handlePrevious({ values: getValues(), form }));
@@ -6,6 +6,7 @@ import FileIcon from '../../../../Icons/FileIcon';
6
6
  import ErrorIcon from '../../../../Icons/ErrorIcon';
7
7
  import CloseIcon from '../../../../Icons/CloseIcon';
8
8
  import { isUploadedFileObject } from '../FileFunctions';
9
+ import { errorFields, log } from '../../../../Utils/Logger';
9
10
  function FileUploadComponent({ file, formStyle, error, editable, handleRemove, fetchDownloadUrl, }) {
10
11
  const [downloading, setDownloading] = useState(false);
11
12
  if (!file) {
@@ -23,7 +24,7 @@ function FileUploadComponent({ file, formStyle, error, editable, handleRemove, f
23
24
  setDownloading(false);
24
25
  }
25
26
  catch (error) {
26
- console.error(error);
27
+ log.error({ upload: { operation: 'download' }, error: errorFields(error) });
27
28
  }
28
29
  }
29
30
  };
@@ -10,6 +10,7 @@ import maxSize from '../../../constants/Files/FileMaxSize';
10
10
  import { useAppSelector } from '../../../hooks';
11
11
  import CustomContext from '../../../Contexts/CustomContext';
12
12
  import { useFormStep } from '../../StepHooks';
13
+ import { errorFields, log } from '../../../Utils/Logger';
13
14
  function FileUploadStep({ step, editable }) {
14
15
  const { ref, value, onChange, error: fieldError, } = useFormStep(step, {
15
16
  defaultValue: [],
@@ -65,7 +66,7 @@ function FileUploadStep({ step, editable }) {
65
66
  }
66
67
  }
67
68
  catch (error) {
68
- console.error(error);
69
+ log.error({ upload: { operation: 'validate' }, error: errorFields(error) });
69
70
  }
70
71
  }, [idOrganization]);
71
72
  const uploadFile = useCallback(async (pFile) => {
@@ -77,7 +78,7 @@ function FileUploadStep({ step, editable }) {
77
78
  setFileChange((prev) => prev.map((f) => (f.file === pFile.file ? { ...f, state: 'DONE', ...resp[0] } : f)));
78
79
  }
79
80
  catch (error) {
80
- console.error(error);
81
+ log.error({ upload: { operation: 'upload' }, error: errorFields(error) });
81
82
  }
82
83
  }, []);
83
84
  useEffect(() => {
@@ -10,6 +10,7 @@ import DeleteIcon from '../../../../../Icons/DeleteIcon';
10
10
  import { MobileStepper, styled } from '@mui/material';
11
11
  import ArrowRightIcon from '../../../../../Icons/ArrowRightIcon';
12
12
  import ArrowLeftIcon from '../../../../../Icons/ArrowLeftIcon';
13
+ import { log } from '../../../../../Utils/Logger';
13
14
  function PagedMapperElement({ step, num, loading, element, children, editable, onChange, value, handleDelete, customElementModifiers, customElementRender, }) {
14
15
  const deletable = step.deletable ?? true;
15
16
  const { size } = useContext(FormContext);
@@ -43,7 +44,7 @@ function PagedMapperElement({ step, num, loading, element, children, editable, o
43
44
  }, [value]);
44
45
  /** Esto se usa para no tener que escuchar todo el tiempo los errores del formulario */
45
46
  const handleErrors = handleSubmit(() => { }, (errors) => {
46
- console.error('Errors:', errors);
47
+ log.warn({ form: { type: 'mapper' }, validation: { fields: Object.keys(errors) } });
47
48
  });
48
49
  const handleChangePage = useCallback(async (index) => {
49
50
  const valid = await trigger(undefined, { shouldFocus: true });
@@ -10,6 +10,7 @@ import { selectDependencies, selectStepDependencies, useFormStep } from '../../S
10
10
  import { shallowEqual } from 'react-redux';
11
11
  import MaterialInputContainer from '../../Utils/MaterialInputContainer/MaterialInputContainer';
12
12
  import { FormTypes } from '../../../constants/FormStepTypes';
13
+ import { errorFields, log } from '../../../Utils/Logger';
13
14
  function SmartSelectStep({ step, editable, getOptions, calcDepError, defaultValue, filterOptions, IconComponent, valueOverwrite, getValueString, changeListener, getValueWarning, getOptionSelected, getOptionalDependencies = () => [], getOptionsConditionsIdSteps = () => [], renderNestedSteps, }) {
14
15
  const { ref, value, error, field, onChange: handleChange, } = useFormStep(step, {
15
16
  sizeChange: true,
@@ -82,7 +83,7 @@ function SmartSelectStep({ step, editable, getOptions, calcDepError, defaultValu
82
83
  }
83
84
  }
84
85
  catch (error) {
85
- console.error(error);
86
+ log.error({ api: { endpoint: 'smartSelect' }, error: errorFields(error) });
86
87
  setOptions(null);
87
88
  }
88
89
  setLoading(false);
@@ -24,17 +24,14 @@ import CustomContext from '../Contexts/CustomContext';
24
24
  import { selectOriginalValue, useCondition } from './StepHooks';
25
25
  import TimePickerStep from './TimePickerStep/TimePickerStep';
26
26
  import PhoneInputStep from './PhoneInputStep/PhoneInputStep';
27
- import LocationStepComponent from './LocationStep/LocationStep';
28
- import NumberStepComponent from './NumberStep/NumberStep';
29
- import BookingStepComponent from './BookingStep/BookingStep';
30
- import CalendarStepComponent from './CalendarStep/CalendarStep';
27
+ import { log } from '../Utils/Logger';
31
28
  function StepComponent({ step, ...props }) {
32
29
  const { postview, partial } = useAppSelector((state) => state.global);
33
30
  const { customSteps, customClientInfoStep } = useContext(CustomContext);
34
31
  const originalValue = useAppSelector((state) => selectOriginalValue(state, step));
35
32
  const showStep = useCondition(step.condition);
36
33
  if (!step) {
37
- console.error('Step not found!', step);
34
+ log.error({ form: { step }, render: { component: 'Step', reason: 'step_not_found' } });
38
35
  return _jsx("div", {});
39
36
  }
40
37
  if (!showStep)
@@ -78,18 +75,6 @@ function StepComponent({ step, ...props }) {
78
75
  case FormStepTypes.DATEPICKER: {
79
76
  return _jsx(DatePickerStep, { ...props, step: step, editable: editable });
80
77
  }
81
- case FormStepTypes.LOCATION: {
82
- return _jsx(LocationStepComponent, { ...props, step: step, editable: editable });
83
- }
84
- case FormStepTypes.NUMBER: {
85
- return _jsx(NumberStepComponent, { ...props, step: step, editable: editable });
86
- }
87
- case FormStepTypes.BOOKING: {
88
- return _jsx(BookingStepComponent, { ...props, step: step, editable: editable });
89
- }
90
- case FormStepTypes.CALENDAR: {
91
- return _jsx(CalendarStepComponent, { ...props, step: step, editable: editable });
92
- }
93
78
  case FormStepTypes.DATEPICKER_RANGE: {
94
79
  return _jsx(DatePickerRangeStep, { ...props, step: step, editable: editable });
95
80
  }
@@ -1,10 +1,10 @@
1
- import { NumberStepType, } from '../@Types/FormStep';
2
1
  import FormStepTypes, { ApiSelectorOptionTypes, ClassifierOptionTypes, EntityValueDataTypes, EntityValueOptionTypes, OptionTypes, } from '../constants/FormStepTypes';
3
2
  import CBRFormStepTypes from '../constants/CBRFormStepTypes';
4
3
  import AYFFormStepTypes from '../constants/AYFFormStepTypes';
5
4
  import { getRawText } from '../Utils/DraftFunctions';
6
5
  import ConditionTypes, { ExpressionTypes, OperatorTypes } from '../constants/ConditionTypes';
7
6
  import EntityPropertyTypes from '../constants/EntityPropertyTypes';
7
+ import { log } from '../Utils/Logger';
8
8
  export function calcFillerSize(step, steps, values, size) {
9
9
  const maxSize = step.maxSize ?? size.blockNum;
10
10
  if (maxSize < size.blockNum) {
@@ -88,8 +88,6 @@ function recursivelyCheckOpenSize(idStep, steps, values) {
88
88
  return size;
89
89
  }
90
90
  case FormStepTypes.DATEPICKER:
91
- case FormStepTypes.LOCATION:
92
- case FormStepTypes.NUMBER:
93
91
  case FormStepTypes.TEXTINPUT: {
94
92
  return step.size;
95
93
  }
@@ -120,17 +118,6 @@ export const calcDefaultValue = (step) => {
120
118
  return getRawText();
121
119
  else
122
120
  return '';
123
- case FormStepTypes.LOCATION:
124
- return step.defaultValue ?? null;
125
- case FormStepTypes.NUMBER: {
126
- const numStep = step;
127
- if (numStep.numberType === NumberStepType.MONEY ||
128
- numStep.numberType === NumberStepType.MEASURE ||
129
- numStep.numberType === NumberStepType.UNIT_PRICE) {
130
- return numStep.defaultValue ?? null;
131
- }
132
- return numStep.defaultValue ?? '';
133
- }
134
121
  case FormStepTypes.RATING:
135
122
  case FormStepTypes.DATEPICKER:
136
123
  case FormStepTypes.DATEPICKER_RANGE:
@@ -152,7 +139,7 @@ export const calcDefaultValue = (step) => {
152
139
  export const iterateNestedSteps = (idStep, steps, iteration, path = []) => {
153
140
  const step = steps[idStep];
154
141
  if (!step) {
155
- console.error('Missing Step:', idStep);
142
+ log.warn({ form: { step: idStep }, reason: 'missing_step' });
156
143
  return;
157
144
  }
158
145
  iteration(step, path);
@@ -1,4 +1,3 @@
1
- import * as Steps from '../@Types/FormStep';
2
1
  import AYFFormStepTypes from '../constants/AYFFormStepTypes';
3
2
  import CBRFormStepTypes from '../constants/CBRFormStepTypes';
4
3
  import FormStepTypes, { ApiSelectorOptionTypes, ClassifierOptionTypes, EntityValueOptionTypes, OptionTypes, } from '../constants/FormStepTypes';
@@ -497,13 +496,6 @@ describe('StepFunctions', function () {
497
496
  const defaultValue = calcDefaultValue(step);
498
497
  expect(defaultValue).toBe(null);
499
498
  });
500
- test('Location step type', async () => {
501
- const step = {
502
- type: FormStepTypes.LOCATION,
503
- };
504
- const defaultValue = calcDefaultValue(step);
505
- expect(defaultValue).toBe(null);
506
- });
507
499
  test('Mapper, FileUpload, CBRFormStep types', async () => {
508
500
  const step1 = {
509
501
  type: FormStepTypes.MAPPER,
@@ -535,52 +527,6 @@ describe('StepFunctions', function () {
535
527
  const defaultValue = calcDefaultValue(step);
536
528
  expect(defaultValue).toBeUndefined();
537
529
  });
538
- test('Number step type without defaultValue', async () => {
539
- const step1 = {
540
- type: FormStepTypes.NUMBER,
541
- numberType: Steps.NumberStepType.INTEGER,
542
- };
543
- const step2 = {
544
- type: FormStepTypes.NUMBER,
545
- numberType: Steps.NumberStepType.DECIMAL,
546
- };
547
- const step3 = {
548
- type: FormStepTypes.NUMBER,
549
- numberType: Steps.NumberStepType.PERCENTAGE,
550
- };
551
- const step4 = {
552
- type: FormStepTypes.NUMBER,
553
- numberType: Steps.NumberStepType.MONEY,
554
- };
555
- const step5 = {
556
- type: FormStepTypes.NUMBER,
557
- numberType: Steps.NumberStepType.MEASURE,
558
- };
559
- const step6 = {
560
- type: FormStepTypes.NUMBER,
561
- numberType: Steps.NumberStepType.UNIT_PRICE,
562
- };
563
- expect(calcDefaultValue(step1)).toBe('');
564
- expect(calcDefaultValue(step2)).toBe('');
565
- expect(calcDefaultValue(step3)).toBe('');
566
- expect(calcDefaultValue(step4)).toBe(null);
567
- expect(calcDefaultValue(step5)).toBe(null);
568
- expect(calcDefaultValue(step6)).toBe(null);
569
- });
570
- test('Number step type with defaultValue', async () => {
571
- const step1 = {
572
- type: FormStepTypes.NUMBER,
573
- numberType: Steps.NumberStepType.INTEGER,
574
- defaultValue: 42,
575
- };
576
- const step2 = {
577
- type: FormStepTypes.NUMBER,
578
- numberType: Steps.NumberStepType.MONEY,
579
- defaultValue: { value: 100, currency: 'USD' },
580
- };
581
- expect(calcDefaultValue(step1)).toBe(42);
582
- expect(calcDefaultValue(step2)).toEqual({ value: 100, currency: 'USD' });
583
- });
584
530
  });
585
531
  describe('iterateNestedSteps', function () {
586
532
  test('should iterate over nested steps', async () => {
@@ -11,6 +11,7 @@ import { setUser } from '../States/GlobalSlice';
11
11
  import { jwtDecode } from 'jwt-decode';
12
12
  import LoginTextField from './LoginTextField';
13
13
  import MaterialProviders from '../Utils/MaterialProviders';
14
+ import { errorFields, log } from '../Utils/Logger';
14
15
  const EMAIL_REGEX =
15
16
  // eslint-disable-next-line no-control-regex
16
17
  /^(?:[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/i;
@@ -51,7 +52,7 @@ function LoginPage({ form }) {
51
52
  catch (err) {
52
53
  setLoading(false);
53
54
  if (err?.response?.status !== 400) {
54
- console.error(err);
55
+ log.error({ action: { name: 'login' }, error: errorFields(err) });
55
56
  }
56
57
  if (err?.response?.data === 'Invalid Organization') {
57
58
  setError('password', {
@@ -2,9 +2,11 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import React, { useMemo } from 'react';
3
3
  import { format as dateFnsFormat, isValid } from 'date-fns';
4
4
  import { InputAdornment, styled, Dialog as MuiDialog } from '@mui/material';
5
- import { MobileDatePicker as MuiDatePicker, MobileDateTimePicker as MuiDateTimePicker, DatePickerToolbar as MuiDatePickerToolbar, DateTimePickerToolbar as MuiDateTimePickerToolbar, usePickerContext, PickerDay as MuiPickerDay, renderTimeViewClock, } from '@mui/x-date-pickers';
5
+ import { MobileDatePicker as MuiDatePicker, MobileDateTimePicker as MuiDateTimePicker, DatePickerToolbar as MuiDatePickerToolbar, DateTimePickerToolbar as MuiDateTimePickerToolbar, usePickerContext, } from '@mui/x-date-pickers';
6
+ import { PickerDay as MuiPickerDay } from '@mui/x-date-pickers/PickerDay';
6
7
  import { StyledTextField } from '../ErkTextField/ErkTextField';
7
8
  import CalendarIcon from '../../Icons/CalendarIcon';
9
+ import { renderTimeViewClock } from '@mui/x-date-pickers/timeViewRenderers';
8
10
  const StyledDateTimePicker = styled(MuiDateTimePicker, {
9
11
  shouldForwardProp: (propName) => propName !== 'size',
10
12
  })(({ disabled, readOnly, size }) => ({
@@ -126,10 +128,10 @@ const StyledDay = styled(MuiPickerDay)(({ theme }) => ({
126
128
  fontWeight: 500,
127
129
  fontSize: '0.9rem',
128
130
  lineHeight: 'normal',
129
- '&.Erk-MuiPickersDay-today': {
131
+ '&.Erk-MuiPickerDay-today': {
130
132
  backgroundColor: theme.palette.primary.main + '33',
131
133
  },
132
- '&.Erk-MuiPickersDay-dayOutsideMonth': {
134
+ '&.Erk-MuiPickerDay-dayOutsideMonth': {
133
135
  color: 'rgb(0,0,0,0.4)',
134
136
  '&.Mui-selected': {
135
137
  color: theme.palette.primary.contrastText,
@@ -169,7 +171,7 @@ function CustomDatePicker({ error, required, disabled, readOnly, helperText, siz
169
171
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
170
172
  orientation: _orientation, ...others }) {
171
173
  if (pickTime) {
172
- return (_jsx(StyledDateTimePicker, { ampm: true, size: size, reduceAnimations: true, ...others, label: label, disabled: disabled, readOnly: readOnly, showDaysOutsideCurrentMonth: true, slotProps: {
174
+ return (_jsx(StyledDateTimePicker, { ampm: true, size: size, reduceAnimations: true, orientation: "portrait", ...others, label: label, disabled: disabled, readOnly: readOnly, showDaysOutsideCurrentMonth: true, slotProps: {
173
175
  actionBar: {
174
176
  actions: ['clear', 'accept'],
175
177
  },
@@ -229,7 +231,7 @@ orientation: _orientation, ...others }) {
229
231
  } }));
230
232
  }
231
233
  else {
232
- return (_jsx(StyledDatePicker, { ...others, label: label, size: size, reduceAnimations: true, readOnly: readOnly, disabled: disabled, showDaysOutsideCurrentMonth: true, views: ['year', 'month', 'day'], slotProps: {
234
+ return (_jsx(StyledDatePicker, { ...others, label: label, size: size, reduceAnimations: true, orientation: "portrait", readOnly: readOnly, disabled: disabled, showDaysOutsideCurrentMonth: true, views: ['year', 'month', 'day'], slotProps: {
233
235
  actionBar: {
234
236
  actions: ['clear', 'accept'],
235
237
  },
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
- import { PickersShortcutsItem } from '@mui/x-date-pickers';
3
- import { MobileDateRangePickerProps as MuiDateRangePickerProps, DateRange } from '@mui/x-date-pickers-pro';
2
+ import { MobileDateRangePickerProps as MuiDateRangePickerProps } from '@mui/x-date-pickers-pro/MobileDateRangePicker';
3
+ import { DateRange } from '@mui/x-date-pickers-pro';
4
+ import { PickersShortcutsItem } from '@mui/x-date-pickers/PickersShortcuts';
4
5
  import { ErkTextFieldProps } from '../ErkTextField/ErkTextField';
5
6
  interface ErkDateRangePickerProps extends Omit<MuiDateRangePickerProps, 'ref' | 'onChange' | 'value' | 'slotProps'>, Pick<ErkTextFieldProps, 'error' | 'required' | 'helperText' | 'size'> {
6
7
  onChange?: (dateRange: DateRange<Date>) => void;
@@ -2,7 +2,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import React, { useMemo } from 'react';
3
3
  import { InputAdornment, styled, Dialog as MuiDialog } from '@mui/material';
4
4
  import { DatePickerToolbar as MuiDatePickerToolbar, usePickerContext, } from '@mui/x-date-pickers';
5
- import { MobileDateRangePicker as MuiDateRangePicker, DateRangePickerDay as MuiDateRangePickerDay, } from '@mui/x-date-pickers-pro';
5
+ import { MobileDateRangePicker as MuiDateRangePicker, } from '@mui/x-date-pickers-pro/MobileDateRangePicker';
6
+ import { DateRangePickerDay as MuiDateRangePickerDay } from '@mui/x-date-pickers-pro';
6
7
  import { format, isValid } from 'date-fns';
7
8
  import { StyledTextField } from '../ErkTextField/ErkTextField';
8
9
  import CalendarIcon from '../../Icons/CalendarIcon';
@@ -70,10 +71,10 @@ const StyledDay = styled(MuiDateRangePickerDay)(({ theme }) => ({
70
71
  fontWeight: 500,
71
72
  fontSize: '0.9rem',
72
73
  lineHeight: 'normal',
73
- '&.Erk-MuiPickersDay-today:not(.Erk-MuiDateRangePickerDay-rangeIntervalDayHighlight)': {
74
+ '&.Erk-MuiDateRangePickerDay-today:not(.Erk-MuiDateRangePickerDay-rangeIntervalDayHighlight)': {
74
75
  backgroundColor: theme.palette.primary.main + '33',
75
76
  },
76
- '&.Erk-MuiPickersDay-dayOutsideMonth': {
77
+ '&.Erk-MuiDateRangePickerDay-dayOutsideMonth': {
77
78
  color: 'rgb(0,0,0,0.4)',
78
79
  '&.Mui-selected': {
79
80
  color: theme.palette.primary.contrastText,
@@ -83,7 +84,7 @@ const StyledDay = styled(MuiDateRangePickerDay)(({ theme }) => ({
83
84
  backgroundColor: theme.palette.primary.main + '1a',
84
85
  },
85
86
  }));
86
- const CustomRangePickerField = React.forwardRef(function CustomRangePickerField({ error, required, helperText, size = 'small', labelMargin = 5, fullWidth = true, inputRef, }, ref) {
87
+ const CustomRangePickerField = React.forwardRef(function CustomRangePickerField({ error, required, helperText, size = 'small', labelMargin = 5, fullWidth = true, inputRef }, ref) {
87
88
  const { value, fieldFormat, setOpen, disabled, readOnly, label } = usePickerContext();
88
89
  const { displayValue, isInvalid } = useMemo(() => {
89
90
  const [startDate, endDate] = value ?? [null, null];
@@ -4,6 +4,7 @@ import styles from './Navbar.module.css';
4
4
  import { IconButton, Avatar, Menu, MenuItem } from '@mui/material';
5
5
  import { logout } from '../../Services/UserService';
6
6
  import { useAppSelector } from '../../hooks';
7
+ import { errorFields, log } from '../../Utils/Logger';
7
8
  function Navbar({ logo, color, apiKey }) {
8
9
  const [anchorEl, setAnchorEl] = useState(null);
9
10
  const user = useAppSelector((state) => state.global.user);
@@ -14,7 +15,7 @@ function Navbar({ logo, color, apiKey }) {
14
15
  await logout(apiKey);
15
16
  }
16
17
  catch (err) {
17
- console.error(err);
18
+ log.error({ action: { name: 'logout' }, error: errorFields(err) });
18
19
  }
19
20
  }
20
21
  localStorage.removeItem('token');
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { errorFields, log } from '../../Utils/Logger';
2
3
  export function LinkComponent({ children, decoratedText }) {
3
4
  // Add protocol if missing
4
5
  const getHref = (url) => {
@@ -38,8 +39,7 @@ export function findLinkEntities(contentBlock, callback) {
38
39
  }
39
40
  catch (error) {
40
41
  // Fail silently to avoid breaking the editor
41
- // eslint-disable-next-line no-console
42
- console.warn('LinkDecorator: Error finding link entities:', error);
42
+ log.warn({ render: { component: 'LinkDecorator' }, error: errorFields(error) });
43
43
  }
44
44
  }
45
45
  export const linkDecorator = {
@@ -0,0 +1,10 @@
1
+ import { log, parseError } from 'evlog';
2
+ /**
3
+ * Loggable fields for a caught value. The global `log` API takes plain objects, not `Error`s, and a stack
4
+ * trace adds nothing in a published form — the message and the class are what identify the failure.
5
+ */
6
+ export declare function errorFields(error: unknown): {
7
+ message: string;
8
+ name?: string;
9
+ };
10
+ export { log, parseError };
@@ -0,0 +1,31 @@
1
+ import { initLogger, log, parseError } from 'evlog';
2
+ /**
3
+ * Local runs are detected from the hostname rather than a build-time flag: this package ships through both
4
+ * the Vite app build and the webpack `Embeddables` build, and only one of them defines `import.meta.env`.
5
+ */
6
+ const isLocal = typeof window !== 'undefined' && /^(localhost|127\.0\.0\.1|\[::1\])$/.test(window.location.hostname);
7
+ /**
8
+ * Configure evlog for the form renderer. Runs on first import of this module, so every entry point (the
9
+ * Vite app, the webpack embeddable, and the published library) is covered without touching each one.
10
+ *
11
+ * `redact` stays on everywhere. These forms collect third parties' personal data on third parties' sites,
12
+ * so the redaction pass is the last line of defence behind the rule that field values are never logged at
13
+ * all — see `docs/CONVENCIONES_LOGS.md` §3 in the Eureka-All workspace.
14
+ */
15
+ initLogger({
16
+ env: { service: 'eureka-forms' },
17
+ pretty: isLocal,
18
+ redact: true,
19
+ // `debug` never reaches a published form.
20
+ minLevel: 'info',
21
+ });
22
+ /**
23
+ * Loggable fields for a caught value. The global `log` API takes plain objects, not `Error`s, and a stack
24
+ * trace adds nothing in a published form — the message and the class are what identify the failure.
25
+ */
26
+ export function errorFields(error) {
27
+ if (error instanceof Error)
28
+ return { message: error.message, name: error.name };
29
+ return { message: String(error) };
30
+ }
31
+ export { log, parseError };
@@ -1,5 +1,6 @@
1
1
  import * as libphonenumber from 'libphonenumber-js/max';
2
- import { guessCountryByPartialPhoneNumber, removeDialCode, } from 'react-international-phone';
2
+ import { guessCountryByPartialPhoneNumber, removeDialCode } from 'react-international-phone';
3
+ import { log } from './Logger';
3
4
  export function isValidPhoneNumber(phone) {
4
5
  if (!phone.startsWith('+'))
5
6
  phone = '+' + phone;
@@ -19,7 +20,7 @@ export function isEmptyPhoneNumber(phone) {
19
20
  return true;
20
21
  }
21
22
  if (!country) {
22
- console.error('Country not found for phone number:', phone);
23
+ log.warn({ validation: { field: 'phone', reason: 'country_not_found' } });
23
24
  return true;
24
25
  }
25
26
  return false;
@@ -21,11 +21,7 @@ export declare enum FormStepTypes {
21
21
  COLLAPSIBLE = "COLLAPSIBLE",
22
22
  MAPPER = "MAPPER",
23
23
  ENTITYVALUEPICKER = "ENTITYVALUEPICKER",
24
- API_SELECTOR = "API_SELECTOR",
25
- LOCATION = "LOCATION",
26
- NUMBER = "NUMBER",
27
- CALENDAR = "CALENDAR",
28
- BOOKING = "BOOKING"
24
+ API_SELECTOR = "API_SELECTOR"
29
25
  }
30
26
  export declare enum OptionTypes {
31
27
  DEFAULT = "DEFAULT",
@@ -25,10 +25,6 @@ export var FormStepTypes;
25
25
  FormStepTypes["MAPPER"] = "MAPPER";
26
26
  FormStepTypes["ENTITYVALUEPICKER"] = "ENTITYVALUEPICKER";
27
27
  FormStepTypes["API_SELECTOR"] = "API_SELECTOR";
28
- FormStepTypes["LOCATION"] = "LOCATION";
29
- FormStepTypes["NUMBER"] = "NUMBER";
30
- FormStepTypes["CALENDAR"] = "CALENDAR";
31
- FormStepTypes["BOOKING"] = "BOOKING";
32
28
  })(FormStepTypes || (FormStepTypes = {}));
33
29
  export var OptionTypes;
34
30
  (function (OptionTypes) {
package/dist/main.js CHANGED
@@ -5,6 +5,7 @@ import styles from './index.module.css';
5
5
  import App from './App/App';
6
6
  import './index.css';
7
7
  import './Utils/MuiClassnameSetup';
8
+ import { errorFields, log } from './Utils/Logger';
8
9
  const urlParams = new URLSearchParams(window.location.search);
9
10
  const values = urlParams.get('data-values');
10
11
  let dataValues = undefined;
@@ -13,7 +14,7 @@ if (values) {
13
14
  dataValues = JSON.parse(decodeURIComponent(values));
14
15
  }
15
16
  catch (error) {
16
- console.error('Invalid data-values JSON', error);
17
+ log.error({ form: { source: 'data-values' }, error: errorFields(error) });
17
18
  }
18
19
  }
19
20
  const idOrganization = urlParams.get('idOrganization') ?? undefined;