@arquimedes.co/eureka-forms 3.0.48-test → 3.0.49-new-steps

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 (140) hide show
  1. package/dist/@Types/AvailabilityFormStep.d.ts +48 -0
  2. package/dist/@Types/AvailabilityFormStep.js +24 -0
  3. package/dist/@Types/BankAccountFormStep.d.ts +67 -0
  4. package/dist/@Types/BankAccountFormStep.js +14 -0
  5. package/dist/@Types/BookingFormStep.d.ts +156 -0
  6. package/dist/@Types/BookingFormStep.js +44 -0
  7. package/dist/@Types/CalendarFormStep.d.ts +192 -0
  8. package/dist/@Types/CalendarFormStep.js +48 -0
  9. package/dist/@Types/CommunicationChannelFormStep.d.ts +51 -0
  10. package/dist/@Types/CommunicationChannelFormStep.js +15 -0
  11. package/dist/@Types/Condition.d.ts +4 -6
  12. package/dist/@Types/ConsentFormStep.d.ts +36 -0
  13. package/dist/@Types/ConsentFormStep.js +8 -0
  14. package/dist/@Types/EntityFormFormStep.d.ts +66 -0
  15. package/dist/@Types/EntityFormFormStep.js +20 -0
  16. package/dist/@Types/EventFormStep.d.ts +52 -0
  17. package/dist/@Types/EventFormStep.js +13 -0
  18. package/dist/@Types/ExternalReferenceFormStep.d.ts +74 -0
  19. package/dist/@Types/ExternalReferenceFormStep.js +20 -0
  20. package/dist/@Types/Form.d.ts +0 -1
  21. package/dist/@Types/FormStep.d.ts +8 -10
  22. package/dist/@Types/FormStep.js +2 -1
  23. package/dist/@Types/LocationFormStep.d.ts +159 -0
  24. package/dist/@Types/LocationFormStep.js +46 -0
  25. package/dist/@Types/NumericFormSteps.d.ts +108 -0
  26. package/dist/@Types/NumericFormSteps.js +20 -0
  27. package/dist/@Types/PredefinedSelectorFormStep.d.ts +51 -0
  28. package/dist/@Types/PredefinedSelectorFormStep.js +39 -0
  29. package/dist/@Types/StepRef.d.ts +135 -0
  30. package/dist/@Types/StepRef.js +49 -0
  31. package/dist/App/App.js +1 -1
  32. package/dist/App/AppFunctions.js +3 -8
  33. package/dist/App/AppHooks.js +1 -20
  34. package/dist/Form/Form.js +2 -6
  35. package/dist/Form/Form.module.css +39 -48
  36. package/dist/FormSteps/ApiSelectorStep/MaterialApiSelectorStep/MaterialApiSelectorStep.js +4 -8
  37. package/dist/FormSteps/BookingStep/BookingStep.d.ts +17 -0
  38. package/dist/FormSteps/BookingStep/BookingStep.js +14 -0
  39. package/dist/FormSteps/BookingStep/MaterialBookingStep/MaterialBookingStep.d.ts +3 -0
  40. package/dist/FormSteps/BookingStep/MaterialBookingStep/MaterialBookingStep.js +362 -0
  41. package/dist/FormSteps/BookingStep/MaterialBookingStep/MaterialBookingStep.module.css +174 -0
  42. package/dist/FormSteps/CBRStepMapper.js +1 -1
  43. package/dist/FormSteps/CalendarStep/CalendarStep.d.ts +7 -0
  44. package/dist/FormSteps/CalendarStep/CalendarStep.js +14 -0
  45. package/dist/FormSteps/CalendarStep/MaterialCalendarStep/MaterialCalendarStep.d.ts +3 -0
  46. package/dist/FormSteps/CalendarStep/MaterialCalendarStep/MaterialCalendarStep.js +269 -0
  47. package/dist/FormSteps/CalendarStep/MaterialCalendarStep/MaterialCalendarStep.module.css +531 -0
  48. package/dist/FormSteps/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.js +2 -2
  49. package/dist/FormSteps/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValuePickerStep.js +4 -52
  50. package/dist/FormSteps/LocationStep/LocationStep.d.ts +10 -0
  51. package/dist/FormSteps/LocationStep/LocationStep.js +14 -0
  52. package/dist/FormSteps/LocationStep/MaterialLocationStep/MaterialLocationStep.d.ts +3 -0
  53. package/dist/FormSteps/LocationStep/MaterialLocationStep/MaterialLocationStep.js +47 -0
  54. package/dist/FormSteps/LocationStep/MaterialLocationStep/MaterialLocationStep.module.css +18 -0
  55. package/dist/FormSteps/NumberStep/MaterialNumberStep/MaterialNumberStep.d.ts +3 -0
  56. package/dist/FormSteps/NumberStep/MaterialNumberStep/MaterialNumberStep.js +168 -0
  57. package/dist/FormSteps/NumberStep/MaterialNumberStep/MaterialNumberStep.module.css +94 -0
  58. package/dist/FormSteps/NumberStep/NumberStep.d.ts +10 -0
  59. package/dist/FormSteps/NumberStep/NumberStep.js +14 -0
  60. package/dist/FormSteps/Step.js +16 -0
  61. package/dist/FormSteps/StepFunctions.js +23 -6
  62. package/dist/FormSteps/StepFunctions.test.js +57 -3
  63. package/dist/FormSteps/TitleStep/MaterialTitleStep/MaterialTitleStep.js +1 -2
  64. package/dist/Icons/@ErkIcon.d.ts +2 -2
  65. package/dist/Icons/@ErkIcon.js +2 -2
  66. package/dist/Icons/AddIcon.d.ts +3 -0
  67. package/dist/Icons/AddIcon.js +7 -0
  68. package/dist/Icons/EditIcon.d.ts +3 -0
  69. package/dist/Icons/{EmailIcon.js → EditIcon.js} +3 -3
  70. package/dist/Icons/RemoveIcon.d.ts +3 -0
  71. package/dist/Icons/RemoveIcon.js +7 -0
  72. package/dist/Icons/ViewDayIcon.d.ts +3 -0
  73. package/dist/Icons/ViewDayIcon.js +7 -0
  74. package/dist/Icons/ViewWeekIcon.d.ts +3 -0
  75. package/dist/Icons/ViewWeekIcon.js +7 -0
  76. package/dist/Services/DraftService.js +1 -4
  77. package/dist/Shared/ErkAddressAutocomplete/ErkAddressAutocomplete.d.ts +19 -0
  78. package/dist/Shared/ErkAddressAutocomplete/ErkAddressAutocomplete.js +80 -0
  79. package/dist/Shared/ErkAddressAutocomplete/ErkAddressAutocomplete.module.css +82 -0
  80. package/dist/Shared/ErkAddressAutocomplete/googlePlaces.d.ts +29 -0
  81. package/dist/Shared/ErkAddressAutocomplete/googlePlaces.js +139 -0
  82. package/dist/Shared/ErkDatePicker/ErkDatePicker.js +1 -3
  83. package/dist/Shared/ErkDateRangePicker/ErkDateRangePicker.d.ts +2 -3
  84. package/dist/Shared/ErkDateRangePicker/ErkDateRangePicker.js +1 -2
  85. package/dist/Shared/ErkLocationField/ErkLocationField.d.ts +23 -0
  86. package/dist/Shared/ErkLocationField/ErkLocationField.js +73 -0
  87. package/dist/Shared/ErkLocationField/ErkLocationField.module.css +29 -0
  88. package/dist/Shared/ErkLocationField/addressFields.d.ts +12 -0
  89. package/dist/Shared/ErkLocationField/addressFields.js +34 -0
  90. package/dist/Shared/ErkLocationField/locationRestrictions.d.ts +6 -0
  91. package/dist/Shared/ErkLocationField/locationRestrictions.js +51 -0
  92. package/dist/Shared/ErkLocationInput/ErkLocationInput.d.ts +15 -0
  93. package/dist/Shared/ErkLocationInput/ErkLocationInput.js +499 -0
  94. package/dist/Shared/ErkLocationInput/ErkLocationInput.module.css +115 -0
  95. package/dist/Shared/ErkNumberField/ErkNumberField.d.ts +42 -0
  96. package/dist/Shared/ErkNumberField/ErkNumberField.js +170 -0
  97. package/dist/Shared/ErkSelect/ErkSelect.d.ts +2 -2
  98. package/dist/Shared/InputIcon/InputIcon.js +0 -6
  99. package/dist/Shared/Navbar/Navbar.d.ts +1 -2
  100. package/dist/Shared/Navbar/Navbar.js +3 -22
  101. package/dist/Shared/Navbar/Navbar.module.css +8 -22
  102. package/dist/Shared/SmartDraftRenderer/SmartDraftRenderer.js +2 -8
  103. package/dist/States/GlobalSlice.d.ts +1 -4
  104. package/dist/States/GlobalSlice.js +1 -8
  105. package/dist/constants/ErkIconTypes.d.ts +1 -3
  106. package/dist/constants/ErkIconTypes.js +0 -2
  107. package/dist/constants/FormStepTypes.d.ts +6 -3
  108. package/dist/constants/FormStepTypes.js +4 -1
  109. package/dist/hooks.d.ts +0 -3
  110. package/dist/hooks.js +1 -17
  111. package/package.json +3 -9
  112. package/dist/@Types/ErkValue.d.ts +0 -16
  113. package/dist/@Types/ErkValue.js +0 -1
  114. package/dist/@Types/User.d.ts +0 -13
  115. package/dist/@Types/User.js +0 -1
  116. package/dist/Icons/EmailIcon.d.ts +0 -3
  117. package/dist/Icons/Entities/SchoolIcon.d.ts +0 -3
  118. package/dist/Icons/Entities/SchoolIcon.js +0 -7
  119. package/dist/Icons/GroupIcon.d.ts +0 -3
  120. package/dist/Icons/GroupIcon.js +0 -7
  121. package/dist/Icons/LockedIcon.d.ts +0 -3
  122. package/dist/Icons/LockedIcon.js +0 -7
  123. package/dist/Login/Login.module.css +0 -135
  124. package/dist/Login/LoginLayout.module.css +0 -68
  125. package/dist/Login/LoginPage.d.ts +0 -10
  126. package/dist/Login/LoginPage.js +0 -101
  127. package/dist/Login/LoginTextField.d.ts +0 -14
  128. package/dist/Login/LoginTextField.js +0 -29
  129. package/dist/Services/ApiSelectorService.d.ts +0 -366
  130. package/dist/Services/ApiSelectorService.js +0 -173
  131. package/dist/Services/ApiSelectorService.test.d.ts +0 -1
  132. package/dist/Services/ApiSelectorService.test.js +0 -87
  133. package/dist/Services/IntegrationService.d.ts +0 -21
  134. package/dist/Services/IntegrationService.js +0 -22
  135. package/dist/Services/UserService.d.ts +0 -10
  136. package/dist/Services/UserService.js +0 -21
  137. package/dist/Shared/SmartDraftRenderer/LinkDecorator.d.ts +0 -14
  138. package/dist/Shared/SmartDraftRenderer/LinkDecorator.js +0 -48
  139. package/dist/constants/ErkValueTypes.d.ts +0 -6
  140. package/dist/constants/ErkValueTypes.js +0 -7
@@ -0,0 +1,20 @@
1
+ /**
2
+ * NumericFormSteps types
3
+ * Cubre el paso relacionado con números y sus múltiples subtipos.
4
+ */
5
+ // ===========================================================================
6
+ // NUMBER
7
+ // ===========================================================================
8
+ /** Subtipo del paso numérico — discriminante secundario */
9
+ export var NumberStepType;
10
+ (function (NumberStepType) {
11
+ NumberStepType["INTEGER"] = "INTEGER";
12
+ NumberStepType["DECIMAL"] = "DECIMAL";
13
+ NumberStepType["PERCENTAGE"] = "PERCENTAGE";
14
+ /** Monto de dinero en una divisa (ej: 1500 COP). */
15
+ NumberStepType["MONEY"] = "MONEY";
16
+ /** Magnitud con unidad de medida (ej: 5 kg). */
17
+ NumberStepType["MEASURE"] = "MEASURE";
18
+ /** Precio por unidad: divisa sobre unidad (ej: 20 USD / hora). */
19
+ NumberStepType["UNIT_PRICE"] = "UNIT_PRICE";
20
+ })(NumberStepType || (NumberStepType = {}));
@@ -0,0 +1,51 @@
1
+ /**
2
+ * DRAFT — PredefinedSelectorFormStep types
3
+ *
4
+ * Paso que reemplaza tener que configurar manualmente opciones de selectores
5
+ * para listas fijas y controladas por Capta (países, ciudades, monedas, etc.).
6
+ * Las opciones vienen de APIs internas — el formulario no necesita configurarlas.
7
+ *
8
+ * También resuelve la cascada Country → State → City via parentStepId.
9
+ */
10
+ import { GSmartSelect } from './GenericFormSteps';
11
+ export declare enum PredefinedOptionType {
12
+ /** ISO 3166-1 — lista de países */
13
+ COUNTRY = "COUNTRY",
14
+ /**
15
+ * Departamento / provincia / estado.
16
+ * Requiere parentStepId apuntando a un step COUNTRY.
17
+ */
18
+ STATE = "STATE",
19
+ /**
20
+ * Ciudad / municipio.
21
+ * Requiere parentStepId apuntando a un step STATE (o COUNTRY si no hay STATE).
22
+ */
23
+ CITY = "CITY",
24
+ /** ISO 4217 — monedas (USD, COP, EUR, etc.) */
25
+ CURRENCY = "CURRENCY",
26
+ /** BCP 47 — idiomas (es, en, pt, etc.) */
27
+ LANGUAGE = "LANGUAGE",
28
+ /** Tipos de canal de comunicación (WhatsApp, Email, Teléfono) */
29
+ COMMUNICATION_CHANNEL_TYPE = "COMMUNICATION_CHANNEL_TYPE",
30
+ /** Tipos de documento de identidad por país (CC, NIT, Pasaporte, etc.) */
31
+ DOCUMENT_TYPE = "DOCUMENT_TYPE",
32
+ /** Días de la semana */
33
+ DAY_OF_WEEK = "DAY_OF_WEEK",
34
+ /** Meses del año */
35
+ MONTH = "MONTH"
36
+ }
37
+ export interface PredefinedSelectorStep extends GSmartSelect {
38
+ type: 'PREDEFINED_SELECTOR';
39
+ predefinedType: PredefinedOptionType;
40
+ /**
41
+ * Solo para STATE y CITY: id del step padre que filtra las opciones.
42
+ * - COUNTRY step → filtra estados del país seleccionado
43
+ * - STATE step → filtra ciudades del estado seleccionado
44
+ *
45
+ * Si no se especifica, se listan todas las opciones sin filtrar.
46
+ */
47
+ parentStepId?: string;
48
+ maxSize?: number;
49
+ defaultValue?: string;
50
+ }
51
+ export type PredefinedSelectorValue = string;
@@ -0,0 +1,39 @@
1
+ /**
2
+ * DRAFT — PredefinedSelectorFormStep types
3
+ *
4
+ * Paso que reemplaza tener que configurar manualmente opciones de selectores
5
+ * para listas fijas y controladas por Capta (países, ciudades, monedas, etc.).
6
+ * Las opciones vienen de APIs internas — el formulario no necesita configurarlas.
7
+ *
8
+ * También resuelve la cascada Country → State → City via parentStepId.
9
+ */
10
+ // ===========================================================================
11
+ // Tipos predefinidos disponibles
12
+ // ===========================================================================
13
+ export var PredefinedOptionType;
14
+ (function (PredefinedOptionType) {
15
+ /** ISO 3166-1 — lista de países */
16
+ PredefinedOptionType["COUNTRY"] = "COUNTRY";
17
+ /**
18
+ * Departamento / provincia / estado.
19
+ * Requiere parentStepId apuntando a un step COUNTRY.
20
+ */
21
+ PredefinedOptionType["STATE"] = "STATE";
22
+ /**
23
+ * Ciudad / municipio.
24
+ * Requiere parentStepId apuntando a un step STATE (o COUNTRY si no hay STATE).
25
+ */
26
+ PredefinedOptionType["CITY"] = "CITY";
27
+ /** ISO 4217 — monedas (USD, COP, EUR, etc.) */
28
+ PredefinedOptionType["CURRENCY"] = "CURRENCY";
29
+ /** BCP 47 — idiomas (es, en, pt, etc.) */
30
+ PredefinedOptionType["LANGUAGE"] = "LANGUAGE";
31
+ /** Tipos de canal de comunicación (WhatsApp, Email, Teléfono) */
32
+ PredefinedOptionType["COMMUNICATION_CHANNEL_TYPE"] = "COMMUNICATION_CHANNEL_TYPE";
33
+ /** Tipos de documento de identidad por país (CC, NIT, Pasaporte, etc.) */
34
+ PredefinedOptionType["DOCUMENT_TYPE"] = "DOCUMENT_TYPE";
35
+ /** Días de la semana */
36
+ PredefinedOptionType["DAY_OF_WEEK"] = "DAY_OF_WEEK";
37
+ /** Meses del año */
38
+ PredefinedOptionType["MONTH"] = "MONTH";
39
+ })(PredefinedOptionType || (PredefinedOptionType = {}));
@@ -0,0 +1,135 @@
1
+ /**
2
+ * DRAFT — Sistema de referencias dinámicas entre steps
3
+ *
4
+ * Permite que la configuración de un paso use el valor en tiempo de ejecución
5
+ * de otro step del mismo formulario, en lugar de un literal fijo.
6
+ *
7
+ * Patrón de uso:
8
+ *
9
+ * // Valor fijo definido en la configuración del formulario
10
+ * suffix: { type: 'FIXED', value: 'km' }
11
+ *
12
+ * // Valor tomado del step 'step_unidad' cuando el usuario interactúa
13
+ * suffix: { type: 'STEP_REF', idStep: 'step_unidad', fallback: 'm' }
14
+ *
15
+ * Se puede aplicar a cualquier campo de configuración cuyo valor deba
16
+ * responder a la selección previa del usuario: sufijos, unidades, monedas,
17
+ * títulos dinámicos, límites numéricos, etc.
18
+ */
19
+ /**
20
+ * Representa un valor estático/literal configurado en tiempo de diseño.
21
+ * No cambia dinámicamente según las respuestas del usuario.
22
+ *
23
+ * @typeParam T - Tipo de dato del valor estático.
24
+ */
25
+ export interface FixedRef<T> {
26
+ /**
27
+ * Indica que el valor es fijo.
28
+ */
29
+ type: 'FIXED';
30
+ /**
31
+ * El valor estático de tipo T.
32
+ * @example "km"
33
+ * @example 50
34
+ */
35
+ value: T;
36
+ }
37
+ /**
38
+ * Referencia dinámica al valor actual de otro step en el mismo formulario.
39
+ * El runtime del formulario sustituye esta referencia por el valor que el usuario
40
+ * haya ingresado en el step indicado.
41
+ *
42
+ * @typeParam TAllowed - Literal(es) de tipo de step permitidos como origen.
43
+ * Por defecto es `string` (cualquier tipo de step). Pasar un literal union
44
+ * permite al Form Builder filtrar la lista de steps disponibles en la UI.
45
+ *
46
+ * @example
47
+ * ```ts
48
+ * // Referencia a cualquier tipo de step
49
+ * const ref: StepRef = {
50
+ * type: 'STEP_REF',
51
+ * idStep: 'step_unidad_medida',
52
+ * fallback: 'm'
53
+ * }
54
+ *
55
+ * // Referencia restringida únicamente a pasos de tipo LOCATION
56
+ * const refLocation: StepRef<'LOCATION'> = {
57
+ * type: 'STEP_REF',
58
+ * idStep: 'step_destino_cliente',
59
+ * allowedStepTypes: ['LOCATION']
60
+ * }
61
+ * ```
62
+ */
63
+ export interface StepRef<TAllowed extends string = string> {
64
+ /**
65
+ * Indica que el valor se toma dinámicamente de otro paso.
66
+ */
67
+ type: 'STEP_REF';
68
+ /**
69
+ * ID del paso origen en el formulario del cual se leerá el valor en tiempo de ejecución.
70
+ * @example "step_ubicacion_cliente"
71
+ */
72
+ idStep: string;
73
+ /**
74
+ * Valor de respaldo (fallback) en formato de texto a utilizar mientras el paso referenciado
75
+ * no contenga ningún valor (ej: porque el usuario aún no llega a ese paso).
76
+ * Si se omite, el campo referenciador se comportará como vacío o sin unidad.
77
+ *
78
+ * @example "m"
79
+ */
80
+ fallback?: string;
81
+ /**
82
+ * Lista de tipos de pasos permitidos para esta referencia.
83
+ * Ayuda al Form Builder a filtrar la interfaz de selección de campos y es
84
+ * validada por el backend al guardar la configuración del formulario.
85
+ * Si no se define, se permite referenciar cualquier tipo de paso.
86
+ *
87
+ * @example ["LOCATION"]
88
+ * @example ["PREDEFINED_SELECTOR", "CHECKBOX"]
89
+ */
90
+ allowedStepTypes?: TAllowed[];
91
+ }
92
+ /**
93
+ * Tipo genérico para campos que admiten tanto un valor estático como una referencia dinámica.
94
+ *
95
+ * @typeParam T - Tipo del valor cuando es FIXED (ej: `string`, `number`, `boolean`).
96
+ * @typeParam TAllowed - Tipos de paso de origen permitidos si es STEP_REF.
97
+ *
98
+ * @example
99
+ * ```ts
100
+ * // Un sufijo de texto dinámico:
101
+ * const sufijo: DynamicRef<string> = { type: 'FIXED', value: 'km' };
102
+ *
103
+ * // Una coordenada geográfica que debe venir de un paso de mapa:
104
+ * const origen: DynamicRef<LocationCoords, 'LOCATION'> = {
105
+ * type: 'STEP_REF',
106
+ * idStep: 'step_mapa_inicio',
107
+ * allowedStepTypes: ['LOCATION']
108
+ * };
109
+ * ```
110
+ */
111
+ export type DynamicRef<T, TAllowed extends string = string> = FixedRef<T> | StepRef<TAllowed>;
112
+ /**
113
+ * Comprueba si la referencia dinámica recibida es de tipo FIXED.
114
+ * Funciona como Type Guard para TypeScript.
115
+ *
116
+ * @example
117
+ * ```ts
118
+ * if (isFixedRef(miRef)) {
119
+ * console.log("El valor es:", miRef.value);
120
+ * }
121
+ * ```
122
+ */
123
+ export declare function isFixedRef<T, TAllowed extends string = string>(ref: DynamicRef<T, TAllowed>): ref is FixedRef<T>;
124
+ /**
125
+ * Comprueba si la referencia dinámica recibida es de tipo STEP_REF.
126
+ * Funciona como Type Guard para TypeScript.
127
+ *
128
+ * @example
129
+ * ```ts
130
+ * if (isStepRef(miRef)) {
131
+ * console.log("Apunta al step:", miRef.idStep);
132
+ * }
133
+ * ```
134
+ */
135
+ export declare function isStepRef<T, TAllowed extends string = string>(ref: DynamicRef<T, TAllowed>): ref is StepRef<TAllowed>;
@@ -0,0 +1,49 @@
1
+ /**
2
+ * DRAFT — Sistema de referencias dinámicas entre steps
3
+ *
4
+ * Permite que la configuración de un paso use el valor en tiempo de ejecución
5
+ * de otro step del mismo formulario, en lugar de un literal fijo.
6
+ *
7
+ * Patrón de uso:
8
+ *
9
+ * // Valor fijo definido en la configuración del formulario
10
+ * suffix: { type: 'FIXED', value: 'km' }
11
+ *
12
+ * // Valor tomado del step 'step_unidad' cuando el usuario interactúa
13
+ * suffix: { type: 'STEP_REF', idStep: 'step_unidad', fallback: 'm' }
14
+ *
15
+ * Se puede aplicar a cualquier campo de configuración cuyo valor deba
16
+ * responder a la selección previa del usuario: sufijos, unidades, monedas,
17
+ * títulos dinámicos, límites numéricos, etc.
18
+ */
19
+ // ---------------------------------------------------------------------------
20
+ // Helpers de narrowing
21
+ // ---------------------------------------------------------------------------
22
+ /**
23
+ * Comprueba si la referencia dinámica recibida es de tipo FIXED.
24
+ * Funciona como Type Guard para TypeScript.
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * if (isFixedRef(miRef)) {
29
+ * console.log("El valor es:", miRef.value);
30
+ * }
31
+ * ```
32
+ */
33
+ export function isFixedRef(ref) {
34
+ return ref.type === 'FIXED';
35
+ }
36
+ /**
37
+ * Comprueba si la referencia dinámica recibida es de tipo STEP_REF.
38
+ * Funciona como Type Guard para TypeScript.
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * if (isStepRef(miRef)) {
43
+ * console.log("Apunta al step:", miRef.idStep);
44
+ * }
45
+ * ```
46
+ */
47
+ export function isStepRef(ref) {
48
+ return ref.type === 'STEP_REF';
49
+ }
package/dist/App/App.js CHANGED
@@ -13,7 +13,7 @@ import { nanoid } from '@reduxjs/toolkit';
13
13
  import { IdFormContext } from '../Contexts/FormContext';
14
14
  import { StoreContext } from '../Utils/StoreContext';
15
15
  function AppComponent({ formData, valuesData, ...props }) {
16
- const [idForm] = React.useState(nanoid(20));
16
+ const [idForm] = React.useState(nanoid(6));
17
17
  return (_jsx(IdFormContext.Provider, { value: idForm, children: _jsx(Provider, { store: store, context: StoreContext, children: _jsx(App, { formData: formData, valuesData: valuesData, ...props }) }) }));
18
18
  }
19
19
  export default AppComponent;
@@ -14,11 +14,11 @@ export const calcValuesStore = async (orgInfo, form, originalValues = {}, postvi
14
14
  await Promise.all(Object.keys(originalValues).map(async (idValue) => {
15
15
  const step = form.steps[idValue];
16
16
  if (step) {
17
- if (!values.sections[step.idSection])
18
- values.sections[step.idSection] = {};
19
17
  const value = await mapOriginalValue(orgInfo, step, originalValues[step.id], values, form);
20
18
  if (value !== undefined) {
21
19
  if (!form.hiddenSteps?.includes(step.id)) {
20
+ if (!values.sections[step.idSection])
21
+ values.sections[step.idSection] = {};
22
22
  values.sections[step.idSection][step.id] = value;
23
23
  }
24
24
  else {
@@ -163,7 +163,7 @@ export const mapOriginalValue = async (orgInfo, step, value, values, form, path
163
163
  }
164
164
  case FormStepTypes.ENTITYVALUEPICKER: {
165
165
  if (!value._id) {
166
- const params = typeof value !== 'string' ? new URLSearchParams(value) : new URLSearchParams();
166
+ const params = new URLSearchParams(value);
167
167
  const url = `${orgInfo.idOrganization}/entities/${step.idEntity}?${params.toString()}`;
168
168
  const entityValues = (await widgetInstance.get(url)).data;
169
169
  if (entityValues.length === 1) {
@@ -172,11 +172,6 @@ export const mapOriginalValue = async (orgInfo, step, value, values, form, path
172
172
  return undefined;
173
173
  return entityValues[0];
174
174
  }
175
- if (typeof value === 'string') {
176
- if (step.options[value]?.type === EntityValueOptionTypes.HIDE)
177
- return undefined;
178
- return entityValues.find((ev) => ev._id === value);
179
- }
180
175
  return null;
181
176
  }
182
177
  return value;
@@ -4,7 +4,6 @@ import { fetchOrganization } from '../Services/OrganizationService';
4
4
  import { fetchForm } from '../Services/FormService';
5
5
  import { calcCbrForm } from '../Utils/CBRFunctions';
6
6
  import { calcInitialSections, calcValuesStore } from './AppFunctions';
7
- import { jwtDecode } from 'jwt-decode';
8
7
  import { useAppDispatch } from '../hooks';
9
8
  import InternalFormStyle from '../constants/InternalFormStyle';
10
9
  import { calcDependencies } from '../Form/FormFunctions';
@@ -40,7 +39,6 @@ export const useSetupApp = (isEmbedded, props) => {
40
39
  const loadData = async () => {
41
40
  let idOrganization = others.idOrganization;
42
41
  let organization = null;
43
- let user = null;
44
42
  let form = formData ?? null;
45
43
  if (form && preview && form.isStandAlone) {
46
44
  organization = await loadOrg();
@@ -92,24 +90,7 @@ export const useSetupApp = (isEmbedded, props) => {
92
90
  return;
93
91
  const dependencies = {};
94
92
  const values = await calcValuesStore({ idOrganization, countryCode }, form, valuesData, postview, customSteps);
95
- if (form.hasLogin && !internal && !preview) {
96
- const token = localStorage.getItem('token');
97
- if (token) {
98
- try {
99
- user = jwtDecode(token);
100
- if (user && Date.now() / 1000 >= user.exp) {
101
- user = null;
102
- localStorage.removeItem('token');
103
- }
104
- }
105
- catch {
106
- user = null;
107
- localStorage.removeItem('token');
108
- }
109
- }
110
- }
111
93
  dispatch(reset({
112
- user,
113
94
  apiKey,
114
95
  formStyle: internal
115
96
  ? InternalFormStyle
@@ -123,7 +104,7 @@ export const useSetupApp = (isEmbedded, props) => {
123
104
  },
124
105
  internal: !!internal,
125
106
  idOrganization,
126
- idCurrentAgent: user?._id ?? idCurrentAgent,
107
+ idCurrentAgent,
127
108
  preview: !!preview,
128
109
  partial: !!partial,
129
110
  postview: !!postview,
package/dist/Form/Form.js CHANGED
@@ -17,10 +17,9 @@ import { useWidthStats } from './FormHooks';
17
17
  import { useAppDispatch, useAppSelector } from '../hooks';
18
18
  import FormContext, { IdFormContext } from '../Contexts/FormContext';
19
19
  import { getAppState } from '../Utils/store';
20
- import LoginPage from '../Login/LoginPage';
21
20
  import { focusStep } from '../States/SiteSlice';
22
21
  function FormComponent({ form, apiKey, reload, isWidget, branding, setSubmit, scrollToTop, customSteps, containerRef, customSubmit, customSubmitBtns, customConfirmation, }) {
23
- const { idOrganization, internal, postview, user } = useAppSelector((state) => state.global);
22
+ const { idOrganization, internal, postview } = useAppSelector((state) => state.global);
24
23
  const formMethods = useForm({
25
24
  mode: 'onTouched',
26
25
  shouldFocusError: true,
@@ -101,11 +100,8 @@ function FormComponent({ form, apiKey, reload, isWidget, branding, setSubmit, sc
101
100
  }, children: _jsx("div", { className: styles.widgetFormContainer, ref: containerRef, children: renderForm() }) }));
102
101
  }
103
102
  else {
104
- if (user === null && form.hasLogin) {
105
- return (_jsx("div", { className: styles.loginContainer, children: _jsx(LoginPage, { form: form }) }));
106
- }
107
103
  //Standalone cant have widget
108
- return (_jsxs(React.Fragment, { children: [_jsx(Navbar, { apiKey: form.apiKey, logo: branding?.images.logoUrl, color: branding?.colors?.navbarColor ?? branding?.colors?.primaryColor }), _jsx("div", { className: styles.standAloneFormContainer, ref: containerRef, style: {
104
+ return (_jsxs(React.Fragment, { children: [_jsx(Navbar, { logo: branding?.images.logoUrl, color: branding?.colors?.navbarColor ?? branding?.colors?.primaryColor }), _jsx("div", { className: styles.standAloneFormContainer, ref: containerRef, style: {
109
105
  background: form.style?.standAloneBackgroundColor ?? '#ffffff',
110
106
  }, children: _jsx("div", { className: isResponsive ? styles.fullScreenStandAloneForm : styles.standAloneFormCard, style: {
111
107
  backgroundColor: form.style?.backgroundColor ?? InternalFormStyle.backgroundColor,
@@ -1,48 +1,39 @@
1
- .standAloneFormContainer {
2
- width: 100%;
3
- max-width: 100%;
4
- overflow: hidden;
5
- min-height: calc(100vh - 60px);
6
- display: flex;
7
- overflow-x: hidden;
8
- }
9
-
10
- .fullScreenStandAloneForm {
11
- width: 100%;
12
- padding: 20px;
13
- min-height: 100%;
14
- overflow: hidden;
15
- }
16
-
17
- .loginContainer {
18
- width: 100%;
19
- max-width: 100%;
20
- overflow: hidden;
21
- min-height: 100vh;
22
- display: flex;
23
- overflow-x: hidden;
24
- }
25
-
26
- .standAloneFormCard {
27
- -webkit-box-shadow: -6px 0px 8px 5px rgba(0, 0, 0, 0.2);
28
- -moz-box-shadow: -6px 0px 8px 5px rgba(0, 0, 0, 0.2);
29
- box-shadow: -6px 0px 8px 5px rgba(0, 0, 0, 0.2);
30
- margin-top: 30px;
31
- margin-left: auto;
32
- margin-right: auto;
33
- height: fit-content;
34
- width: fit-content;
35
- border-radius: 15px;
36
- padding: 20px;
37
- margin-bottom: 30px;
38
- }
39
-
40
- .widgetFormContainer {
41
- padding-top: 10px;
42
- padding-bottom: 10px;
43
- margin-left: auto;
44
- margin-right: auto;
45
- height: fit-content;
46
- width: fit-content;
47
- max-width: 100%;
48
- }
1
+ .standAloneFormContainer {
2
+ width: 100%;
3
+ max-width: 100%;
4
+ overflow: hidden;
5
+ min-height: calc(100vh - 60px);
6
+ display: flex;
7
+ overflow-x: hidden;
8
+ }
9
+
10
+ .fullScreenStandAloneForm {
11
+ width: 100%;
12
+ padding: 20px;
13
+ min-height: 100%;
14
+ overflow: hidden;
15
+ }
16
+
17
+ .standAloneFormCard {
18
+ -webkit-box-shadow: -6px 0px 8px 5px rgba(0, 0, 0, 0.2);
19
+ -moz-box-shadow: -6px 0px 8px 5px rgba(0, 0, 0, 0.2);
20
+ box-shadow: -6px 0px 8px 5px rgba(0, 0, 0, 0.2);
21
+ margin-top: 30px;
22
+ margin-left: auto;
23
+ margin-right: auto;
24
+ height: fit-content;
25
+ width: fit-content;
26
+ border-radius: 15px;
27
+ padding: 20px;
28
+ margin-bottom: 30px;
29
+ }
30
+
31
+ .widgetFormContainer {
32
+ padding-top: 10px;
33
+ padding-bottom: 10px;
34
+ margin-left: auto;
35
+ margin-right: auto;
36
+ height: fit-content;
37
+ width: fit-content;
38
+ max-width: 100%;
39
+ }
@@ -3,12 +3,13 @@ import React, { useContext, useMemo } from 'react';
3
3
  import FormStepTypes, { ApiSelectorOptionTypes, ApiSelectorParamTypes } from '../../../constants/FormStepTypes';
4
4
  import StepComponent from '../../Step';
5
5
  import SmartSelect from '../../SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep';
6
+ import widgetInstance from '../../../Utils/AxiosWidget';
7
+ import axiosInstance from '../../../Utils/AxiosAPI';
6
8
  import InputIcon from '../../../Shared/InputIcon/InputIcon';
7
9
  import FormContext from '../../../Contexts/FormContext';
8
10
  import StepFillerContainer from '../../Utils/@StepFiller/StepFiller';
9
11
  import { recursivelyCalcConditionSteps } from '../../StepHooks';
10
12
  import { evaluateCondition } from '../../StepFunctions';
11
- import { fetchApiSelectorOptionsThrottled } from '../../../Services/ApiSelectorService';
12
13
  function ApiSelectorComponent({ step, editable, ...others }) {
13
14
  const form = useContext(FormContext);
14
15
  function calcOptionId(option) {
@@ -33,9 +34,6 @@ function ApiSelectorComponent({ step, editable, ...others }) {
33
34
  }
34
35
  else if (typeof currentValue === 'string')
35
36
  params.set(filter.key, currentValue);
36
- else if (step.url.includes('capta.co') && currentValue._id) {
37
- params.set(filter.key, currentValue._id);
38
- }
39
37
  else
40
38
  params.set(filter.key, currentValue.label ?? currentValue.id);
41
39
  }
@@ -56,10 +54,8 @@ function ApiSelectorComponent({ step, editable, ...others }) {
56
54
  if (!step.url.includes('?'))
57
55
  url += '?';
58
56
  url += params.toString();
59
- // Use the throttled fetch function that limits concurrent requests per URL
60
- const response = await fetchApiSelectorOptionsThrottled(url, idOrganization);
61
- return response.filter((option) => calcOptionId(option) !== undefined &&
62
- step.options[calcOptionId(option)]?.type !== ApiSelectorOptionTypes.HIDE);
57
+ const response = await (idOrganization ? widgetInstance.get(url) : axiosInstance.get(url));
58
+ return response.data.filter((option) => calcOptionId(option) && step.options[calcOptionId(option)]?.type !== ApiSelectorOptionTypes.HIDE);
63
59
  }, [form]);
64
60
  return (_jsx(StepFillerContainer, { step: step, children: _jsx(SmartSelect, { ...others, editable: editable, step: step, IconComponent: () => (step.icon ? _jsx(InputIcon, { icon: step.icon }) : undefined), getOptions: getApiOptions, getOptionSelected: (option, value) => calcOptionId(option) === calcOptionId(value), calcDepError: (steps) => {
65
61
  for (const step of steps) {
@@ -0,0 +1,17 @@
1
+ import { BookingStep } from '../../@Types/BookingFormStep';
2
+ import { BookingSlot } from '../../@Types/BookingFormStep';
3
+ import { StepProps } from '../Step';
4
+ export interface BookingStepProps extends StepProps {
5
+ step: BookingStep;
6
+ /**
7
+ * Callback to fetch available slots for a given person + date.
8
+ * The form host wires this to their availability API.
9
+ * If omitted, the component shows an empty slot list.
10
+ */
11
+ fetchSlots?: (params: {
12
+ personId?: string;
13
+ date: string;
14
+ }) => Promise<BookingSlot[]>;
15
+ }
16
+ declare function BookingStepComponent(props: BookingStepProps): JSX.Element;
17
+ export default BookingStepComponent;
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { FormStyleTypes } from '../../constants/FormStepTypes';
3
+ import MaterialBookingStep from './MaterialBookingStep/MaterialBookingStep';
4
+ import { useAppSelector } from '../../hooks';
5
+ function BookingStepComponent(props) {
6
+ const { formStyle } = useAppSelector((state) => state.global);
7
+ switch (formStyle.type) {
8
+ case FormStyleTypes.MATERIAL:
9
+ default: {
10
+ return _jsx(MaterialBookingStep, { ...props });
11
+ }
12
+ }
13
+ }
14
+ export default BookingStepComponent;
@@ -0,0 +1,3 @@
1
+ import { BookingStepProps } from '../BookingStep';
2
+ declare function MaterialBookingStep({ step, editable, fetchSlots }: BookingStepProps): JSX.Element;
3
+ export default MaterialBookingStep;