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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/dist/@Types/Condition.d.ts +6 -4
  2. package/dist/@Types/ErkValue.d.ts +16 -0
  3. package/dist/@Types/ErkValue.js +1 -0
  4. package/dist/@Types/Form.d.ts +1 -0
  5. package/dist/@Types/FormStep.d.ts +10 -8
  6. package/dist/@Types/FormStep.js +1 -2
  7. package/dist/@Types/User.d.ts +13 -0
  8. package/dist/@Types/User.js +1 -0
  9. package/dist/App/App.js +1 -1
  10. package/dist/App/AppFunctions.js +8 -3
  11. package/dist/App/AppHooks.js +20 -1
  12. package/dist/Form/Form.js +6 -2
  13. package/dist/Form/Form.module.css +48 -39
  14. package/dist/FormSteps/ApiSelectorStep/MaterialApiSelectorStep/MaterialApiSelectorStep.js +8 -4
  15. package/dist/FormSteps/CBRStepMapper.js +1 -1
  16. package/dist/FormSteps/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.js +2 -2
  17. package/dist/FormSteps/DatePickerRangeStep/MaterialDatePickerRangeStep/MaterialDatePickerRangeStep.js +1 -1
  18. package/dist/FormSteps/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValuePickerStep.js +52 -4
  19. package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/FileComponent/FileComponent.js +1 -1
  20. package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/FileComponent/FileComponent.module.css +1 -1
  21. package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.js +48 -17
  22. package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.module.css +16 -0
  23. package/dist/FormSteps/Step.js +0 -16
  24. package/dist/FormSteps/StepFunctions.js +6 -23
  25. package/dist/FormSteps/StepFunctions.test.js +3 -57
  26. package/dist/FormSteps/TitleStep/MaterialTitleStep/MaterialTitleStep.js +2 -1
  27. package/dist/Icons/@ErkIcon.d.ts +2 -2
  28. package/dist/Icons/@ErkIcon.js +2 -2
  29. package/dist/Icons/EmailIcon.d.ts +3 -0
  30. package/dist/Icons/{EditIcon.js → EmailIcon.js} +3 -3
  31. package/dist/Icons/Entities/SchoolIcon.d.ts +3 -0
  32. package/dist/Icons/Entities/SchoolIcon.js +7 -0
  33. package/dist/Icons/GroupIcon.d.ts +3 -0
  34. package/dist/Icons/GroupIcon.js +7 -0
  35. package/dist/Icons/LockedIcon.d.ts +3 -0
  36. package/dist/Icons/LockedIcon.js +7 -0
  37. package/dist/Login/Login.module.css +135 -0
  38. package/dist/Login/LoginLayout.module.css +68 -0
  39. package/dist/Login/LoginPage.d.ts +10 -0
  40. package/dist/Login/LoginPage.js +101 -0
  41. package/dist/Login/LoginTextField.d.ts +14 -0
  42. package/dist/Login/LoginTextField.js +29 -0
  43. package/dist/Services/ApiSelectorService.d.ts +366 -0
  44. package/dist/Services/ApiSelectorService.js +173 -0
  45. package/dist/Services/ApiSelectorService.test.d.ts +1 -0
  46. package/dist/Services/ApiSelectorService.test.js +87 -0
  47. package/dist/Services/DraftService.js +4 -1
  48. package/dist/Services/IntegrationService.d.ts +21 -0
  49. package/dist/Services/IntegrationService.js +22 -0
  50. package/dist/Services/UserService.d.ts +10 -0
  51. package/dist/Services/UserService.js +21 -0
  52. package/dist/Shared/ErkDatePicker/ErkDatePicker.js +11 -4
  53. package/dist/Shared/ErkDateRangePicker/ErkDateRangePicker.d.ts +3 -2
  54. package/dist/Shared/ErkDateRangePicker/ErkDateRangePicker.js +10 -4
  55. package/dist/Shared/ErkSelect/ErkSelect.d.ts +2 -2
  56. package/dist/Shared/InputIcon/InputIcon.js +6 -0
  57. package/dist/Shared/Navbar/Navbar.d.ts +2 -1
  58. package/dist/Shared/Navbar/Navbar.js +22 -3
  59. package/dist/Shared/Navbar/Navbar.module.css +22 -8
  60. package/dist/Shared/SmartDraftRenderer/LinkDecorator.d.ts +14 -0
  61. package/dist/Shared/SmartDraftRenderer/LinkDecorator.js +48 -0
  62. package/dist/Shared/SmartDraftRenderer/SmartDraftRenderer.js +10 -3
  63. package/dist/States/GlobalSlice.d.ts +4 -1
  64. package/dist/States/GlobalSlice.js +8 -1
  65. package/dist/constants/ErkIconTypes.d.ts +3 -1
  66. package/dist/constants/ErkIconTypes.js +2 -0
  67. package/dist/constants/ErkValueTypes.d.ts +6 -0
  68. package/dist/constants/ErkValueTypes.js +7 -0
  69. package/dist/constants/FormStepTypes.d.ts +3 -6
  70. package/dist/constants/FormStepTypes.js +1 -4
  71. package/dist/hooks.d.ts +3 -0
  72. package/dist/hooks.js +17 -1
  73. package/package.json +9 -3
  74. package/dist/@Types/AvailabilityFormStep.d.ts +0 -48
  75. package/dist/@Types/AvailabilityFormStep.js +0 -24
  76. package/dist/@Types/BankAccountFormStep.d.ts +0 -67
  77. package/dist/@Types/BankAccountFormStep.js +0 -14
  78. package/dist/@Types/BookingFormStep.d.ts +0 -156
  79. package/dist/@Types/BookingFormStep.js +0 -44
  80. package/dist/@Types/CalendarFormStep.d.ts +0 -192
  81. package/dist/@Types/CalendarFormStep.js +0 -48
  82. package/dist/@Types/CommunicationChannelFormStep.d.ts +0 -51
  83. package/dist/@Types/CommunicationChannelFormStep.js +0 -15
  84. package/dist/@Types/ConsentFormStep.d.ts +0 -36
  85. package/dist/@Types/ConsentFormStep.js +0 -8
  86. package/dist/@Types/EntityFormFormStep.d.ts +0 -66
  87. package/dist/@Types/EntityFormFormStep.js +0 -20
  88. package/dist/@Types/EventFormStep.d.ts +0 -52
  89. package/dist/@Types/EventFormStep.js +0 -13
  90. package/dist/@Types/ExternalReferenceFormStep.d.ts +0 -74
  91. package/dist/@Types/ExternalReferenceFormStep.js +0 -20
  92. package/dist/@Types/LocationFormStep.d.ts +0 -159
  93. package/dist/@Types/LocationFormStep.js +0 -46
  94. package/dist/@Types/NumericFormSteps.d.ts +0 -108
  95. package/dist/@Types/NumericFormSteps.js +0 -20
  96. package/dist/@Types/PredefinedSelectorFormStep.d.ts +0 -51
  97. package/dist/@Types/PredefinedSelectorFormStep.js +0 -39
  98. package/dist/@Types/StepRef.d.ts +0 -135
  99. package/dist/@Types/StepRef.js +0 -49
  100. package/dist/FormSteps/BookingStep/BookingStep.d.ts +0 -17
  101. package/dist/FormSteps/BookingStep/BookingStep.js +0 -14
  102. package/dist/FormSteps/BookingStep/MaterialBookingStep/MaterialBookingStep.d.ts +0 -3
  103. package/dist/FormSteps/BookingStep/MaterialBookingStep/MaterialBookingStep.js +0 -362
  104. package/dist/FormSteps/BookingStep/MaterialBookingStep/MaterialBookingStep.module.css +0 -174
  105. package/dist/FormSteps/CalendarStep/CalendarStep.d.ts +0 -7
  106. package/dist/FormSteps/CalendarStep/CalendarStep.js +0 -14
  107. package/dist/FormSteps/CalendarStep/MaterialCalendarStep/MaterialCalendarStep.d.ts +0 -3
  108. package/dist/FormSteps/CalendarStep/MaterialCalendarStep/MaterialCalendarStep.js +0 -269
  109. package/dist/FormSteps/CalendarStep/MaterialCalendarStep/MaterialCalendarStep.module.css +0 -531
  110. package/dist/FormSteps/LocationStep/LocationStep.d.ts +0 -10
  111. package/dist/FormSteps/LocationStep/LocationStep.js +0 -14
  112. package/dist/FormSteps/LocationStep/MaterialLocationStep/MaterialLocationStep.d.ts +0 -3
  113. package/dist/FormSteps/LocationStep/MaterialLocationStep/MaterialLocationStep.js +0 -47
  114. package/dist/FormSteps/LocationStep/MaterialLocationStep/MaterialLocationStep.module.css +0 -18
  115. package/dist/FormSteps/NumberStep/MaterialNumberStep/MaterialNumberStep.d.ts +0 -3
  116. package/dist/FormSteps/NumberStep/MaterialNumberStep/MaterialNumberStep.js +0 -168
  117. package/dist/FormSteps/NumberStep/MaterialNumberStep/MaterialNumberStep.module.css +0 -94
  118. package/dist/FormSteps/NumberStep/NumberStep.d.ts +0 -10
  119. package/dist/FormSteps/NumberStep/NumberStep.js +0 -14
  120. package/dist/Icons/AddIcon.d.ts +0 -3
  121. package/dist/Icons/AddIcon.js +0 -7
  122. package/dist/Icons/EditIcon.d.ts +0 -3
  123. package/dist/Icons/RemoveIcon.d.ts +0 -3
  124. package/dist/Icons/RemoveIcon.js +0 -7
  125. package/dist/Icons/ViewDayIcon.d.ts +0 -3
  126. package/dist/Icons/ViewDayIcon.js +0 -7
  127. package/dist/Icons/ViewWeekIcon.d.ts +0 -3
  128. package/dist/Icons/ViewWeekIcon.js +0 -7
  129. package/dist/Shared/ErkAddressAutocomplete/ErkAddressAutocomplete.d.ts +0 -19
  130. package/dist/Shared/ErkAddressAutocomplete/ErkAddressAutocomplete.js +0 -80
  131. package/dist/Shared/ErkAddressAutocomplete/ErkAddressAutocomplete.module.css +0 -82
  132. package/dist/Shared/ErkAddressAutocomplete/googlePlaces.d.ts +0 -29
  133. package/dist/Shared/ErkAddressAutocomplete/googlePlaces.js +0 -139
  134. package/dist/Shared/ErkLocationField/ErkLocationField.d.ts +0 -23
  135. package/dist/Shared/ErkLocationField/ErkLocationField.js +0 -73
  136. package/dist/Shared/ErkLocationField/ErkLocationField.module.css +0 -29
  137. package/dist/Shared/ErkLocationField/addressFields.d.ts +0 -12
  138. package/dist/Shared/ErkLocationField/addressFields.js +0 -34
  139. package/dist/Shared/ErkLocationField/locationRestrictions.d.ts +0 -6
  140. package/dist/Shared/ErkLocationField/locationRestrictions.js +0 -51
  141. package/dist/Shared/ErkLocationInput/ErkLocationInput.d.ts +0 -15
  142. package/dist/Shared/ErkLocationInput/ErkLocationInput.js +0 -499
  143. package/dist/Shared/ErkLocationInput/ErkLocationInput.module.css +0 -115
  144. package/dist/Shared/ErkNumberField/ErkNumberField.d.ts +0 -42
  145. package/dist/Shared/ErkNumberField/ErkNumberField.js +0 -170
@@ -0,0 +1,22 @@
1
+ import { RootApi } from '../Utils/_api';
2
+ import axiosInstance from '../Utils/AxiosAPI';
3
+ import widgetInstance from '../Utils/AxiosWidget';
4
+ export const IntegrationsApi = RootApi.injectEndpoints({
5
+ endpoints: (build) => ({
6
+ fetchFilterIntegration: build.query({
7
+ queryFn: async ({ idForm, idIntegration, payload }, { getState }) => {
8
+ const idOrganization = getState().forms[idForm].global.idOrganization;
9
+ let response;
10
+ if (idOrganization) {
11
+ response = await widgetInstance.post(`/form/integrations/${idIntegration}?idOrganization=${idOrganization}`, payload, { timeout: 120000 });
12
+ }
13
+ else {
14
+ response = await axiosInstance.post(`/form/integrations/${idIntegration}`, payload, {
15
+ timeout: 120000,
16
+ });
17
+ }
18
+ return { data: response.data };
19
+ },
20
+ }),
21
+ }),
22
+ });
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Function that handles the app's login
3
+ * @param credentials {email, password} of the user
4
+ * @returns an array with the users Token and RefreshToken
5
+ */
6
+ export declare const login: (apiKey: string, credentials: Record<string, string>) => Promise<string>;
7
+ /**
8
+ * Function that indicates to the server to delete the refresh token
9
+ */
10
+ export declare const logout: (apiKey: string) => Promise<void>;
@@ -0,0 +1,21 @@
1
+ import axiosInstance from '../Utils/AxiosAPI';
2
+ /**
3
+ * Function that handles the app's login
4
+ * @param credentials {email, password} of the user
5
+ * @returns an array with the users Token and RefreshToken
6
+ */
7
+ export const login = async (apiKey, credentials) => {
8
+ const response = await axiosInstance.post(`forms/${apiKey}/auth`, credentials);
9
+ return response?.data;
10
+ };
11
+ /**
12
+ * Function that indicates to the server to delete the refresh token
13
+ */
14
+ export const logout = async (apiKey) => {
15
+ await axiosInstance.delete(`forms/${apiKey}/auth`, {
16
+ headers: {
17
+ Authorization: 'Bearer ' + localStorage.getItem('refreshToken'),
18
+ },
19
+ timeout: 5000,
20
+ });
21
+ };
@@ -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 }) => ({
@@ -165,11 +167,16 @@ function CustomPickerField({ error, required, helperText, size = 'small', labelM
165
167
  },
166
168
  } }));
167
169
  }
168
- function CustomDatePicker({ error, required, disabled, readOnly, helperText, size = 'small', labelMargin = 5, pickTime = false, inputRef,
170
+ function CustomDatePicker({ error, required, disabled, readOnly, helperText, size = 'small', labelMargin = 5, pickTime = false, inputRef, label,
169
171
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
170
172
  orientation: _orientation, ...others }) {
173
+ // MUI X v9 no longer forwards `required` to the field-slot label when the field is a Material
174
+ // TextField (the legacy `slots.field` shape used here), so the required asterisk never renders.
175
+ // The picker's `label` does propagate to the field via the picker context, so bake the marker
176
+ // into the label to keep the required indicator visible.
177
+ const displayLabel = required && typeof label === 'string' ? `${label} *` : label;
171
178
  if (pickTime) {
172
- return (_jsx(StyledDateTimePicker, { ampm: true, size: size, reduceAnimations: true, ...others, disabled: disabled, readOnly: readOnly, defaultValue: required ? new Date() : undefined, showDaysOutsideCurrentMonth: true, slotProps: {
179
+ return (_jsx(StyledDateTimePicker, { ampm: true, size: size, reduceAnimations: true, ...others, label: displayLabel, disabled: disabled, readOnly: readOnly, defaultValue: required ? new Date() : undefined, showDaysOutsideCurrentMonth: true, slotProps: {
173
180
  actionBar: {
174
181
  actions: ['clear', 'accept'],
175
182
  },
@@ -229,7 +236,7 @@ orientation: _orientation, ...others }) {
229
236
  } }));
230
237
  }
231
238
  else {
232
- return (_jsx(StyledDatePicker, { ...others, size: size, reduceAnimations: true, readOnly: readOnly, disabled: disabled, defaultValue: required ? new Date() : undefined, showDaysOutsideCurrentMonth: true, views: ['year', 'month', 'day'], slotProps: {
239
+ return (_jsx(StyledDatePicker, { ...others, label: displayLabel, size: size, reduceAnimations: true, readOnly: readOnly, disabled: disabled, defaultValue: required ? new Date() : undefined, showDaysOutsideCurrentMonth: true, views: ['year', 'month', 'day'], slotProps: {
233
240
  actionBar: {
234
241
  actions: ['clear', 'accept'],
235
242
  },
@@ -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';
@@ -123,7 +124,12 @@ const formatDate = (date, showYear) => {
123
124
  return '';
124
125
  return format(date, showYear ? 'PP' : 'dd MMM');
125
126
  };
126
- function CustomDatePickerRange({ error, disabled, readOnly, helperText, size = 'small', labelMargin = 5, value, onChange, inputRef, shortcuts, ...others }) {
127
+ function CustomDatePickerRange({ error, disabled, readOnly, helperText, size = 'small', labelMargin = 5, value, onChange, inputRef, shortcuts, label, required, ...others }) {
128
+ // MUI X v9 no longer forwards `required` to the field-slot label when the field is a Material
129
+ // TextField (the legacy `slots.field` shape used here), so the required asterisk never renders.
130
+ // The picker's `label` does propagate to the field via the picker context, so bake the marker
131
+ // into the label to keep the required indicator visible.
132
+ const displayLabel = required && typeof label === 'string' ? `${label} *` : label;
127
133
  const [startDate, endDate] = value ?? [null, null];
128
134
  const hasCompleteRange = Boolean(startDate) && Boolean(endDate);
129
135
  const showYear = startDate &&
@@ -134,7 +140,7 @@ function CustomDatePickerRange({ error, disabled, readOnly, helperText, size = '
134
140
  const formattedStartDate = formatDate(startDate, Boolean(showYear));
135
141
  const formattedEndDate = formatDate(endDate, Boolean(showYear));
136
142
  const toolbarText = hasCompleteRange ? `${formattedStartDate} – ${formattedEndDate}` : '– –';
137
- return (_jsx(StyledDateRangePicker, { ...others, value: value, onChange: onChange, size: size, disabled: disabled, readOnly: readOnly, reduceAnimations: true, showDaysOutsideCurrentMonth: true, slots: {
143
+ return (_jsx(StyledDateRangePicker, { ...others, label: displayLabel, value: value, onChange: onChange, size: size, disabled: disabled, readOnly: readOnly, reduceAnimations: true, showDaysOutsideCurrentMonth: true, slots: {
138
144
  field: CustomRangePickerField,
139
145
  day: StyledDay,
140
146
  dialog: StyledDialog,
@@ -177,7 +183,7 @@ function CustomDatePickerRange({ error, disabled, readOnly, helperText, size = '
177
183
  field: {
178
184
  size,
179
185
  error,
180
- required: others.required,
186
+ required,
181
187
  helperText,
182
188
  labelMargin,
183
189
  fullWidth: true,
@@ -5,12 +5,12 @@ export interface SelectorStyleProps {
5
5
  readOnly?: boolean;
6
6
  }
7
7
  export declare const StyledSelect: import("@emotion/styled").StyledComponent<(import("@mui/material").FilledSelectProps & import("@mui/material").BaseSelectProps<unknown> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>) | (import("@mui/material").StandardSelectProps & import("@mui/material").BaseSelectProps<unknown> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>) | (import("@mui/material").OutlinedSelectProps & import("@mui/material").BaseSelectProps<unknown> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>), {}, {}>;
8
- export declare const StyledInputLabel: import("@emotion/styled").StyledComponent<import("@mui/material").InputLabelOwnProps & Pick<import("@mui/material").FormLabelOwnProps, "color" | "filled"> & import("@mui/material/OverridableComponent").CommonProps & Omit<React.DetailedHTMLProps<React.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "required" | "size" | "color" | "children" | "className" | "style" | "classes" | "disabled" | "sx" | "margin" | "error" | "filled" | "variant" | "focused" | "disableAnimation" | "shrink"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
8
+ export declare const StyledInputLabel: import("@emotion/styled").StyledComponent<import("@mui/material").InputLabelOwnProps & Pick<import("@mui/material").FormLabelOwnProps, "color" | "filled"> & import("@mui/material/OverridableComponent").CommonProps & Omit<React.DetailedHTMLProps<React.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "required" | "size" | "color" | "children" | "className" | "style" | "classes" | "error" | "disabled" | "sx" | "margin" | "filled" | "variant" | "focused" | "disableAnimation" | "shrink"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
9
9
  component?: React.ElementType | undefined;
10
10
  } & {
11
11
  open: boolean;
12
12
  }, {}, {}>;
13
- export declare const StyledHelperText: import("@emotion/styled").StyledComponent<import("@mui/material").FormHelperTextOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "required" | "children" | "className" | "style" | "classes" | "disabled" | "sx" | "margin" | "error" | "filled" | "variant" | "focused"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
13
+ export declare const StyledHelperText: import("@emotion/styled").StyledComponent<import("@mui/material").FormHelperTextOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "required" | "children" | "className" | "style" | "classes" | "error" | "disabled" | "sx" | "margin" | "filled" | "variant" | "focused"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
14
14
  component?: React.ElementType | undefined;
15
15
  }, {}, {}>;
16
16
  export type ErkSelectValue<Type extends string | number, Multiple, Clearable> = Multiple extends true ? Type[] : Clearable extends true ? Type | undefined : Type;
@@ -9,8 +9,10 @@ import DocumentIcon from '../../Icons/DocumentIcon';
9
9
  import CheckListIcon from '../../Icons/Entities/CheckListIcon';
10
10
  import GenericEntityIcon from '../../Icons/Entities/GenericEntityIcon';
11
11
  import HandShakeIcon from '../../Icons/Entities/HandshakeIcon';
12
+ import SchoolIcon from '../../Icons/Entities/SchoolIcon';
12
13
  import SupplierIcon from '../../Icons/Entities/SupplierIcon';
13
14
  import WorkIcon from '../../Icons/Entities/WorkIcon';
15
+ import GroupIcon from '../../Icons/GroupIcon';
14
16
  import LocationIcon from '../../Icons/LocationIcon';
15
17
  import PersonIcon from '../../Icons/PersonIcon';
16
18
  function InputIcon({ icon, ...others }) {
@@ -37,6 +39,10 @@ function InputIcon({ icon, ...others }) {
37
39
  return _jsx(CalendarIcon, { size: 23, ...others });
38
40
  case ErkIconTypes.WORK:
39
41
  return _jsx(WorkIcon, { size: 23, ...others });
42
+ case ErkIconTypes.SCHOOL:
43
+ return _jsx(SchoolIcon, { size: 23, ...others });
44
+ case ErkIconTypes.GROUP:
45
+ return _jsx(GroupIcon, { size: 23, ...others });
40
46
  case ErkIconTypes.LOCATION:
41
47
  return _jsx(LocationIcon, { size: 23, ...others });
42
48
  case ErkIconTypes.GENERIC:
@@ -1,8 +1,9 @@
1
1
  interface NavBarProps {
2
+ apiKey?: string;
2
3
  /** Url of the current logo of the current organization */
3
4
  logo?: string;
4
5
  /** The color of the navbar */
5
6
  color?: string;
6
7
  }
7
- declare function Navbar({ logo, color }: NavBarProps): JSX.Element;
8
+ declare function Navbar({ logo, color, apiKey }: NavBarProps): JSX.Element;
8
9
  export default Navbar;
@@ -1,6 +1,25 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from 'react';
2
3
  import styles from './Navbar.module.css';
3
- function Navbar({ logo, color }) {
4
- return (_jsx("div", { className: styles.navContainer, style: { backgroundColor: color }, children: _jsx("img", { src: logo, alt: "Organization Logo", className: styles.navImage }) }));
4
+ import { IconButton, Avatar, Menu, MenuItem } from '@mui/material';
5
+ import { logout } from '../../Services/UserService';
6
+ import { useAppSelector } from '../../hooks';
7
+ function Navbar({ logo, color, apiKey }) {
8
+ const [anchorEl, setAnchorEl] = useState(null);
9
+ const user = useAppSelector((state) => state.global.user);
10
+ const handleLogout = async () => {
11
+ setAnchorEl(null);
12
+ if (apiKey) {
13
+ try {
14
+ await logout(apiKey);
15
+ }
16
+ catch (err) {
17
+ console.error(err);
18
+ }
19
+ }
20
+ localStorage.removeItem('token');
21
+ window.location.reload();
22
+ };
23
+ return (_jsxs("div", { className: styles.navContainer, style: { backgroundColor: color }, children: [_jsx("img", { src: logo, alt: "Organization Logo", className: styles.navImage }), user && apiKey && (_jsxs(_Fragment, { children: [_jsx("div", { className: styles.navBarAvatar, children: _jsx(IconButton, { style: { width: 42, height: 42, padding: 0, margin: 'auto' }, "aria-label": "Mi Perfil", "aria-haspopup": "true", onClick: (event) => setAnchorEl(event.currentTarget), children: _jsx(Avatar, { style: { fontSize: '40px' }, alt: user?.name ?? user?.email }) }) }), _jsx(Menu, { id: "simple-menu", anchorEl: anchorEl, anchorOrigin: { vertical: 'bottom', horizontal: 'right' }, transformOrigin: { vertical: 'top', horizontal: 'right' }, open: Boolean(anchorEl), onClose: () => setAnchorEl(null), children: _jsx(MenuItem, { onClick: () => void handleLogout(), children: "Cerrar sesi\u00F3n" }) })] }))] }));
5
24
  }
6
25
  export default Navbar;
@@ -1,8 +1,22 @@
1
- .navContainer {
2
- height: 60px;
3
- display: flex;
4
- }
5
- .navImage {
6
- height: 40px;
7
- margin: auto 0 auto 15px;
8
- }
1
+ .navContainer {
2
+ height: 60px;
3
+ display: flex;
4
+ }
5
+ .navImage {
6
+ height: 40px;
7
+ margin: auto 0 auto 15px;
8
+ }
9
+
10
+ .navBarAvatar {
11
+ height: 60px;
12
+ display: flex;
13
+ align-items: center;
14
+ justify-content: center;
15
+ margin-left: auto;
16
+ margin-right: 15px;
17
+ }
18
+
19
+ .navBarAvatarIcon {
20
+ width: 100px;
21
+ height: 100px;
22
+ }
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { ContentBlock, ContentState } from 'draft-js';
3
+ export interface LinkComponentProps {
4
+ children: React.ReactNode;
5
+ contentState: ContentState;
6
+ entityKey?: string;
7
+ decoratedText: string;
8
+ }
9
+ export declare function LinkComponent({ children, decoratedText }: LinkComponentProps): JSX.Element;
10
+ export declare function findLinkEntities(contentBlock: ContentBlock, callback: (start: number, end: number) => void): void;
11
+ export declare const linkDecorator: {
12
+ strategy: typeof findLinkEntities;
13
+ component: typeof LinkComponent;
14
+ };
@@ -0,0 +1,48 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ export function LinkComponent({ children, decoratedText }) {
3
+ // Add protocol if missing
4
+ const getHref = (url) => {
5
+ if (url.startsWith('http://') || url.startsWith('https://')) {
6
+ return url;
7
+ }
8
+ return `https://${url}`;
9
+ };
10
+ const handleClick = (e) => {
11
+ e.preventDefault();
12
+ window.open(getHref(decoratedText), '_blank', 'noopener,noreferrer');
13
+ };
14
+ return (_jsx("a", { href: getHref(decoratedText), onClick: handleClick, style: {
15
+ color: '#1976d2',
16
+ textDecoration: 'underline',
17
+ cursor: 'pointer',
18
+ }, target: "_blank", rel: "noopener noreferrer", children: children }));
19
+ }
20
+ export function findLinkEntities(contentBlock, callback) {
21
+ try {
22
+ const text = contentBlock.getText();
23
+ // Return early if no text
24
+ if (!text)
25
+ return;
26
+ // Create a new regex instance for each call to avoid state issues
27
+ const urlRegex = /(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.[a-zA-Z0-9]+\.[^\s]{2,})/g;
28
+ let matchArr;
29
+ let start;
30
+ while ((matchArr = urlRegex.exec(text)) !== null) {
31
+ start = matchArr.index;
32
+ callback(start, start + matchArr[0].length);
33
+ // Prevent infinite loop if regex doesn't advance
34
+ if (matchArr.index === urlRegex.lastIndex) {
35
+ urlRegex.lastIndex++;
36
+ }
37
+ }
38
+ }
39
+ catch (error) {
40
+ // Fail silently to avoid breaking the editor
41
+ // eslint-disable-next-line no-console
42
+ console.warn('LinkDecorator: Error finding link entities:', error);
43
+ }
44
+ }
45
+ export const linkDecorator = {
46
+ strategy: findLinkEntities,
47
+ component: LinkComponent,
48
+ };
@@ -6,6 +6,7 @@ import { Editor } from 'react-draft-wysiwyg';
6
6
  import { produce } from 'immer';
7
7
  import CustomContext from '../../Contexts/CustomContext';
8
8
  import { FormDecoratorsStrategy, FormDecorator } from './FormDecorator';
9
+ import { linkDecorator } from './LinkDecorator';
9
10
  import { skipToken } from '@reduxjs/toolkit/query';
10
11
  import { useAppSelector } from '../../hooks';
11
12
  import { IdFormContext } from '../../Contexts/FormContext';
@@ -26,7 +27,8 @@ function SmartDraftRenderer({ draft, margin, onChange, property, dependencies })
26
27
  useEffect(() => {
27
28
  if (mapped && !postview)
28
29
  onChange?.(mapped);
29
- }, [mapped, onChange, postview]);
30
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- onChange is unstable by design; depending on it loops
31
+ }, [mapped, postview]);
30
32
  const { editorState, isEmpty } = useMemo(() => {
31
33
  const content = convertFromRaw(cleanUpDraftParams(isFetching ? draft : (mapped ?? draft)));
32
34
  return {
@@ -44,13 +46,18 @@ function cleanUpDraftParams(draft) {
44
46
  for (const block of draft.blocks) {
45
47
  for (const entity of block.entityRanges) {
46
48
  const { offset, length } = entity;
47
- //Change text into spaces
48
- block.text = block.text.replace(block.text.substring(offset, offset + length), ' '.repeat(length));
49
+ // Blank the parameter in place by code point: draft offsets count an
50
+ // emoji as one, so a positional splice keeps every later offset aligned
51
+ // (a value-based replace would also blank the wrong text on collisions).
52
+ const chars = [...block.text];
53
+ chars.splice(offset, length, ...' '.repeat(length));
54
+ block.text = chars.join('');
49
55
  }
50
56
  }
51
57
  });
52
58
  }
53
59
  const customDecorators = [
60
+ linkDecorator,
54
61
  {
55
62
  strategy: FormDecoratorsStrategy,
56
63
  component: FormDecorator,
@@ -3,6 +3,7 @@ import { type Reducer } from '@reduxjs/toolkit';
3
3
  import { SiteState } from './SiteSlice';
4
4
  import { EurekaDraft } from '../@Types/Draft/Draft';
5
5
  import { CountryCode } from 'libphonenumber-js';
6
+ import { User } from '../@Types/User';
6
7
  export interface GlobalState {
7
8
  apiKey?: string;
8
9
  idOrganization: string;
@@ -20,6 +21,8 @@ export interface GlobalState {
20
21
  partial: boolean;
21
22
  internal: boolean;
22
23
  loaded: boolean;
24
+ /** Current User */
25
+ user: User | null | undefined;
23
26
  }
24
27
  interface GlobalSliceAPI {
25
28
  reducer: Reducer<GlobalState>;
@@ -27,6 +30,6 @@ interface GlobalSliceAPI {
27
30
  name: string;
28
31
  reducerPath: string;
29
32
  }
30
- export declare const reset: import("@reduxjs/toolkit").ActionCreatorWithPayload<Omit<GlobalState, "loaded"> & SiteState, "global/reset">;
33
+ export declare const reset: import("@reduxjs/toolkit").ActionCreatorWithPayload<Omit<GlobalState, "loaded"> & SiteState, "global/reset">, setUser: import("@reduxjs/toolkit").ActionCreatorWithPayload<User | null, "global/setUser">;
31
34
  export declare const GlobalSlice: GlobalSliceAPI;
32
35
  export default GlobalSlice;
@@ -15,6 +15,7 @@ const initialState = {
15
15
  partial: false,
16
16
  internal: false,
17
17
  loaded: false,
18
+ user: undefined,
18
19
  };
19
20
  const _GlobalSlice = createSlice({
20
21
  name: 'global',
@@ -23,8 +24,14 @@ const _GlobalSlice = createSlice({
23
24
  reset: (state, action) => {
24
25
  return { ...state, ...action.payload, loaded: true };
25
26
  },
27
+ setUser: (state, action) => {
28
+ state.user = action.payload;
29
+ if (action.payload?._id) {
30
+ state.idCurrentAgent = action.payload._id;
31
+ }
32
+ },
26
33
  },
27
34
  });
28
- export const { reset } = _GlobalSlice.actions;
35
+ export const { reset, setUser } = _GlobalSlice.actions;
29
36
  export const GlobalSlice = _GlobalSlice;
30
37
  export default GlobalSlice;
@@ -11,5 +11,7 @@ export declare enum ErkIconTypes {
11
11
  GENERIC = "GENERIC",
12
12
  LOCATION = "LOCATION",
13
13
  CALENDAR = "CALENDAR",
14
- WORK = "WORK"
14
+ WORK = "WORK",
15
+ SCHOOL = "SCHOOL",
16
+ GROUP = "GROUP"
15
17
  }
@@ -13,4 +13,6 @@ export var ErkIconTypes;
13
13
  ErkIconTypes["LOCATION"] = "LOCATION";
14
14
  ErkIconTypes["CALENDAR"] = "CALENDAR";
15
15
  ErkIconTypes["WORK"] = "WORK";
16
+ ErkIconTypes["SCHOOL"] = "SCHOOL";
17
+ ErkIconTypes["GROUP"] = "GROUP";
16
18
  })(ErkIconTypes || (ErkIconTypes = {}));
@@ -0,0 +1,6 @@
1
+ export declare enum ErkValueTypes {
2
+ DRAFT = "DRAFT",
3
+ STEP = "STEP",
4
+ BOOLEAN = "BOOLEAN"
5
+ }
6
+ export default ErkValueTypes;
@@ -0,0 +1,7 @@
1
+ export var ErkValueTypes;
2
+ (function (ErkValueTypes) {
3
+ ErkValueTypes["DRAFT"] = "DRAFT";
4
+ ErkValueTypes["STEP"] = "STEP";
5
+ ErkValueTypes["BOOLEAN"] = "BOOLEAN";
6
+ })(ErkValueTypes || (ErkValueTypes = {}));
7
+ export default ErkValueTypes;
@@ -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",
@@ -62,7 +58,8 @@ export declare enum MapperStyleTypes {
62
58
  export declare enum EntityValueDataTypes {
63
59
  STEP = "STEP",
64
60
  VALUE = "VALUE",
65
- CURRENT_AGENT = "CURRENT_AGENT"
61
+ CURRENT_AGENT = "CURRENT_AGENT",
62
+ INTEGRATION = "INTEGRATION"
66
63
  }
67
64
  export declare enum ApiSelectorParamTypes {
68
65
  STEP = "STEP",
@@ -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) {
@@ -73,6 +69,7 @@ export var EntityValueDataTypes;
73
69
  EntityValueDataTypes["STEP"] = "STEP";
74
70
  EntityValueDataTypes["VALUE"] = "VALUE";
75
71
  EntityValueDataTypes["CURRENT_AGENT"] = "CURRENT_AGENT";
72
+ EntityValueDataTypes["INTEGRATION"] = "INTEGRATION";
76
73
  })(EntityValueDataTypes || (EntityValueDataTypes = {}));
77
74
  export var ApiSelectorParamTypes;
78
75
  (function (ApiSelectorParamTypes) {
package/dist/hooks.d.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  import type { TypedUseSelectorHook } from 'react-redux';
2
2
  import { type RootState, type AppDispatch } from './Utils/store';
3
+ import { ThunkAction } from '@reduxjs/toolkit';
4
+ import { QueryActionCreatorResult, QueryDefinition, ResultTypeFrom } from '@reduxjs/toolkit/query';
3
5
  export declare const useAppDispatch: () => AppDispatch;
4
6
  export declare const useAppSelector: TypedUseSelectorHook<RootState>;
5
7
  export declare const selectBreakPoint: (state: RootState) => number;
8
+ export declare function useApiSubscribe(): <D extends QueryDefinition<any, any, any, any>>(subscription: ThunkAction<QueryActionCreatorResult<D>, any, any, any>) => Promise<ResultTypeFrom<D> | undefined>;
package/dist/hooks.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { createDispatchHook, createSelectorHook } from 'react-redux';
2
2
  import { defaultRootState } from './Utils/store';
3
- import { useContext } from 'react';
3
+ import { useCallback, useContext, useEffect, useRef } from 'react';
4
4
  import { IdFormContext } from './Contexts/FormContext';
5
5
  import { StoreContext } from './Utils/StoreContext';
6
6
  const useSelector = createSelectorHook(StoreContext);
@@ -20,3 +20,19 @@ export const useAppSelector = (selector, options) => {
20
20
  return useSelector((state) => selector(state.forms[idForm] ?? defaultRootState), options);
21
21
  };
22
22
  export const selectBreakPoint = (state) => state.widthStats.currentBreakPoint;
23
+ export function useApiSubscribe() {
24
+ const dispatch = useAppDispatch();
25
+ const subscriptions = useRef([]);
26
+ useEffect(() => {
27
+ const subs = subscriptions.current;
28
+ return () => {
29
+ subs.forEach((unsubscribe) => unsubscribe());
30
+ };
31
+ }, []);
32
+ const subscribe = useCallback(async (subscription) => {
33
+ const result = dispatch(subscription);
34
+ result.unsubscribe();
35
+ return (await result).data;
36
+ }, [dispatch]);
37
+ return subscribe;
38
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@arquimedes.co/eureka-forms",
3
3
  "repository": "git://github.com/Arquimede5/Eureka-Forms.git",
4
- "version":"3.0.49-new-steps",
4
+ "version":"3.0.50-test",
5
5
  "scripts": {
6
6
  "watch": "tsgo --noEmit --watch --project tsconfig.app.json",
7
7
  "start": "vite",
@@ -16,12 +16,12 @@
16
16
  "build-storybook": "storybook build"
17
17
  },
18
18
  "dependencies": {
19
- "@base-ui/react": "^1.6.0",
20
19
  "@reduxjs/toolkit": "2.11.2",
21
20
  "axios": "1.16.0",
22
21
  "date-fns": "4.1.0",
23
22
  "draft-js": "0.11.7",
24
23
  "i18n-iso-countries": "7.14.0",
24
+ "jwt-decode": "4.0.0",
25
25
  "libphonenumber-js": "1.12.42",
26
26
  "logrocket": "12.1.1",
27
27
  "nanoid": "5.1.11",
@@ -112,5 +112,11 @@
112
112
  "main": "./dist/index.lib.js",
113
113
  "files": [
114
114
  "/dist"
115
- ]
115
+ ],
116
+ "allowScripts": {
117
+ "@mui/x-telemetry@9.2.0": true,
118
+ "core-js@3.49.0": true,
119
+ "cypress@15.7.1": true,
120
+ "esbuild@0.27.7": true
121
+ }
116
122
  }
@@ -1,48 +0,0 @@
1
- /**
2
- * @deprecated Renombrado a CalendarFormStep.
3
- * Este archivo existe solo para compatibilidad retroactiva.
4
- * Usar `CalendarFormStep.ts` directamente.
5
- */
6
- export type { CalendarStep as AvailabilityStep } from './CalendarFormStep';
7
- export type { CalendarValue as AvailabilityValue } from './CalendarFormStep';
8
- export { CalendarEventCategory as AvailabilityEventCategory } from './CalendarFormStep';
9
- export { CalendarDefaultView } from './CalendarFormStep';
10
- export type { CalendarEventTemplate } from './CalendarFormStep';
11
- export type { CalendarEvent } from './CalendarFormStep';
12
- export declare enum AvailabilityMode {
13
- WEEKLY = "WEEKLY",
14
- SPECIFIC_DATES = "SPECIFIC_DATES",
15
- COMBINED = "COMBINED"
16
- }
17
- export declare enum AvailabilityDayOfWeek {
18
- MONDAY = 1,
19
- TUESDAY = 2,
20
- WEDNESDAY = 3,
21
- THURSDAY = 4,
22
- FRIDAY = 5,
23
- SATURDAY = 6,
24
- SUNDAY = 7
25
- }
26
- export interface AvailabilitySlot {
27
- start: string;
28
- end: string;
29
- }
30
- export interface AvailabilityDay {
31
- day: AvailabilityDayOfWeek;
32
- slots: AvailabilitySlot[];
33
- recurrence?: string;
34
- }
35
- export interface AvailabilitySpecificDate {
36
- date: string;
37
- slots: AvailabilitySlot[];
38
- }
39
- export interface AvailabilityExclusion {
40
- date?: string;
41
- dateRange?: {
42
- start: string;
43
- end: string;
44
- };
45
- dayOfWeek?: AvailabilityDayOfWeek;
46
- slots?: AvailabilitySlot[];
47
- reason?: string;
48
- }