@arquimedes.co/eureka-forms 3.0.46-new-steps → 3.0.48-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.
- package/dist/@Types/Condition.d.ts +6 -4
- package/dist/@Types/ErkValue.d.ts +16 -0
- package/dist/@Types/ErkValue.js +1 -0
- package/dist/@Types/Form.d.ts +1 -0
- package/dist/@Types/FormStep.d.ts +8 -1
- package/dist/@Types/User.d.ts +13 -0
- package/dist/@Types/User.js +1 -0
- package/dist/App/App.js +1 -1
- package/dist/App/AppFunctions.js +8 -3
- package/dist/App/AppHooks.js +20 -1
- package/dist/Form/Form.js +6 -2
- package/dist/Form/Form.module.css +48 -39
- package/dist/FormSteps/ApiSelectorStep/MaterialApiSelectorStep/MaterialApiSelectorStep.js +8 -4
- package/dist/FormSteps/CBRStepMapper.js +1 -1
- package/dist/FormSteps/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.js +2 -2
- package/dist/FormSteps/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValuePickerStep.js +52 -4
- package/dist/FormSteps/StepFunctions.js +6 -9
- package/dist/FormSteps/StepFunctions.test.js +3 -3
- package/dist/FormSteps/TitleStep/MaterialTitleStep/MaterialTitleStep.js +2 -1
- package/dist/Icons/@ErkIcon.d.ts +2 -2
- package/dist/Icons/@ErkIcon.js +2 -2
- package/dist/Icons/EmailIcon.d.ts +3 -0
- package/dist/Icons/EmailIcon.js +7 -0
- package/dist/Icons/Entities/SchoolIcon.d.ts +3 -0
- package/dist/Icons/Entities/SchoolIcon.js +7 -0
- package/dist/Icons/GroupIcon.d.ts +3 -0
- package/dist/Icons/GroupIcon.js +7 -0
- package/dist/Icons/LockedIcon.d.ts +3 -0
- package/dist/Icons/LockedIcon.js +7 -0
- package/dist/Login/Login.module.css +135 -0
- package/dist/Login/LoginLayout.module.css +68 -0
- package/dist/Login/LoginPage.d.ts +10 -0
- package/dist/Login/LoginPage.js +101 -0
- package/dist/Login/LoginTextField.d.ts +14 -0
- package/dist/Login/LoginTextField.js +29 -0
- package/dist/Services/ApiSelectorService.d.ts +366 -0
- package/dist/Services/ApiSelectorService.js +173 -0
- package/dist/Services/ApiSelectorService.test.d.ts +1 -0
- package/dist/Services/ApiSelectorService.test.js +87 -0
- package/dist/Services/DraftService.js +4 -1
- package/dist/Services/IntegrationService.d.ts +21 -0
- package/dist/Services/IntegrationService.js +22 -0
- package/dist/Services/UserService.d.ts +10 -0
- package/dist/Services/UserService.js +21 -0
- package/dist/Shared/ErkSelect/ErkSelect.d.ts +2 -2
- package/dist/Shared/InputIcon/InputIcon.js +6 -0
- package/dist/Shared/Navbar/Navbar.d.ts +2 -1
- package/dist/Shared/Navbar/Navbar.js +22 -3
- package/dist/Shared/Navbar/Navbar.module.css +22 -8
- package/dist/Shared/SmartDraftRenderer/LinkDecorator.d.ts +14 -0
- package/dist/Shared/SmartDraftRenderer/LinkDecorator.js +48 -0
- package/dist/Shared/SmartDraftRenderer/SmartDraftRenderer.js +8 -2
- package/dist/States/GlobalSlice.d.ts +4 -1
- package/dist/States/GlobalSlice.js +8 -1
- package/dist/constants/ErkIconTypes.d.ts +3 -1
- package/dist/constants/ErkIconTypes.js +2 -0
- package/dist/constants/ErkValueTypes.d.ts +6 -0
- package/dist/constants/ErkValueTypes.js +7 -0
- package/dist/constants/FormStepTypes.d.ts +2 -1
- package/dist/constants/FormStepTypes.js +1 -0
- package/dist/hooks.d.ts +3 -0
- package/dist/hooks.js +17 -1
- package/package.json +10 -3
- package/dist/@Types/AvailabilityFormStep.d.ts +0 -65
- package/dist/@Types/AvailabilityFormStep.js +0 -27
- package/dist/@Types/BankAccountFormStep.d.ts +0 -67
- package/dist/@Types/BankAccountFormStep.js +0 -14
- package/dist/@Types/CommunicationChannelFormStep.d.ts +0 -51
- package/dist/@Types/CommunicationChannelFormStep.js +0 -15
- package/dist/@Types/ConsentFormStep.d.ts +0 -36
- package/dist/@Types/ConsentFormStep.js +0 -8
- package/dist/@Types/EntityFormFormStep.d.ts +0 -66
- package/dist/@Types/EntityFormFormStep.js +0 -20
- package/dist/@Types/EventFormStep.d.ts +0 -52
- package/dist/@Types/EventFormStep.js +0 -13
- package/dist/@Types/ExternalReferenceFormStep.d.ts +0 -74
- package/dist/@Types/ExternalReferenceFormStep.js +0 -20
- package/dist/@Types/LocationFormStep.d.ts +0 -136
- package/dist/@Types/LocationFormStep.js +0 -33
- package/dist/@Types/NumericFormSteps.d.ts +0 -171
- package/dist/@Types/NumericFormSteps.js +0 -32
- package/dist/@Types/PredefinedSelectorFormStep.d.ts +0 -51
- package/dist/@Types/PredefinedSelectorFormStep.js +0 -39
- package/dist/@Types/StepRef.d.ts +0 -79
- package/dist/@Types/StepRef.js +0 -27
|
@@ -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
|
+
};
|
|
@@ -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" | "
|
|
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" | "
|
|
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
|
-
|
|
4
|
-
|
|
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';
|
|
@@ -44,13 +45,18 @@ function cleanUpDraftParams(draft) {
|
|
|
44
45
|
for (const block of draft.blocks) {
|
|
45
46
|
for (const entity of block.entityRanges) {
|
|
46
47
|
const { offset, length } = entity;
|
|
47
|
-
//
|
|
48
|
-
|
|
48
|
+
// Blank the parameter in place by code point: draft offsets count an
|
|
49
|
+
// emoji as one, so a positional splice keeps every later offset aligned
|
|
50
|
+
// (a value-based replace would also blank the wrong text on collisions).
|
|
51
|
+
const chars = [...block.text];
|
|
52
|
+
chars.splice(offset, length, ...' '.repeat(length));
|
|
53
|
+
block.text = chars.join('');
|
|
49
54
|
}
|
|
50
55
|
}
|
|
51
56
|
});
|
|
52
57
|
}
|
|
53
58
|
const customDecorators = [
|
|
59
|
+
linkDecorator,
|
|
54
60
|
{
|
|
55
61
|
strategy: FormDecoratorsStrategy,
|
|
56
62
|
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;
|
|
@@ -58,7 +58,8 @@ export declare enum MapperStyleTypes {
|
|
|
58
58
|
export declare enum EntityValueDataTypes {
|
|
59
59
|
STEP = "STEP",
|
|
60
60
|
VALUE = "VALUE",
|
|
61
|
-
CURRENT_AGENT = "CURRENT_AGENT"
|
|
61
|
+
CURRENT_AGENT = "CURRENT_AGENT",
|
|
62
|
+
INTEGRATION = "INTEGRATION"
|
|
62
63
|
}
|
|
63
64
|
export declare enum ApiSelectorParamTypes {
|
|
64
65
|
STEP = "STEP",
|
|
@@ -69,6 +69,7 @@ export var EntityValueDataTypes;
|
|
|
69
69
|
EntityValueDataTypes["STEP"] = "STEP";
|
|
70
70
|
EntityValueDataTypes["VALUE"] = "VALUE";
|
|
71
71
|
EntityValueDataTypes["CURRENT_AGENT"] = "CURRENT_AGENT";
|
|
72
|
+
EntityValueDataTypes["INTEGRATION"] = "INTEGRATION";
|
|
72
73
|
})(EntityValueDataTypes || (EntityValueDataTypes = {}));
|
|
73
74
|
export var ApiSelectorParamTypes;
|
|
74
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.
|
|
4
|
+
"version":"3.0.48-test",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"watch": "tsgo --noEmit --watch --project tsconfig.app.json",
|
|
7
7
|
"start": "vite",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"date-fns": "4.1.0",
|
|
22
22
|
"draft-js": "0.11.7",
|
|
23
23
|
"i18n-iso-countries": "7.14.0",
|
|
24
|
+
"jwt-decode": "4.0.0",
|
|
24
25
|
"libphonenumber-js": "1.12.42",
|
|
25
26
|
"logrocket": "12.1.1",
|
|
26
27
|
"nanoid": "5.1.11",
|
|
@@ -111,5 +112,11 @@
|
|
|
111
112
|
"main": "./dist/index.lib.js",
|
|
112
113
|
"files": [
|
|
113
114
|
"/dist"
|
|
114
|
-
]
|
|
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
|
+
}
|
|
122
|
+
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* DRAFT — AvailabilityFormStep types
|
|
3
|
-
*
|
|
4
|
-
* Paso para capturar ventanas de disponibilidad: días de la semana + rangos de hora.
|
|
5
|
-
* Ej: "Disponible lunes y miércoles de 9am a 12pm, y viernes de 2pm a 6pm"
|
|
6
|
-
*/
|
|
7
|
-
import { GBaseStep } from './GenericFormSteps';
|
|
8
|
-
/** Granularidad de los slots — define cada cuánto se pueden seleccionar franjas */
|
|
9
|
-
export declare enum AvailabilityGranularity {
|
|
10
|
-
HOUR = "HOUR",
|
|
11
|
-
HALF_HOUR = "HALF_HOUR",
|
|
12
|
-
QUARTER_HOUR = "QUARTER_HOUR"
|
|
13
|
-
}
|
|
14
|
-
/** Días de la semana (refleja DaysOfWeekTypes de Eureka-Types con valores 1-7) */
|
|
15
|
-
export declare enum AvailabilityDayOfWeek {
|
|
16
|
-
MONDAY = 1,
|
|
17
|
-
TUESDAY = 2,
|
|
18
|
-
WEDNESDAY = 3,
|
|
19
|
-
THURSDAY = 4,
|
|
20
|
-
FRIDAY = 5,
|
|
21
|
-
SATURDAY = 6,
|
|
22
|
-
SUNDAY = 7
|
|
23
|
-
}
|
|
24
|
-
export interface AvailabilityStep extends GBaseStep {
|
|
25
|
-
type: 'AVAILABILITY';
|
|
26
|
-
label: string;
|
|
27
|
-
description: string | null;
|
|
28
|
-
required: boolean;
|
|
29
|
-
/**
|
|
30
|
-
* Días que el usuario puede seleccionar.
|
|
31
|
-
* Si no se define, todos los días de la semana están disponibles.
|
|
32
|
-
*/
|
|
33
|
-
allowedDays?: AvailabilityDayOfWeek[];
|
|
34
|
-
granularity: AvailabilityGranularity;
|
|
35
|
-
/**
|
|
36
|
-
* Si true, el usuario puede agregar múltiples franjas por día.
|
|
37
|
-
* Si false, solo puede seleccionar una franja continua por día.
|
|
38
|
-
*/
|
|
39
|
-
allowMultipleSlots: boolean;
|
|
40
|
-
/**
|
|
41
|
-
* Hora mínima seleccionable en formato HH:mm (24h).
|
|
42
|
-
* Default: "00:00"
|
|
43
|
-
*/
|
|
44
|
-
minTime?: string;
|
|
45
|
-
/**
|
|
46
|
-
* Hora máxima seleccionable en formato HH:mm (24h).
|
|
47
|
-
* Default: "23:59"
|
|
48
|
-
*/
|
|
49
|
-
maxTime?: string;
|
|
50
|
-
size: 1 | 2 | 3 | 4;
|
|
51
|
-
}
|
|
52
|
-
/** Franja horaria dentro de un día */
|
|
53
|
-
export interface AvailabilitySlot {
|
|
54
|
-
/** Hora de inicio en formato HH:mm (24h) */
|
|
55
|
-
start: string;
|
|
56
|
-
/** Hora de fin en formato HH:mm (24h) */
|
|
57
|
-
end: string;
|
|
58
|
-
}
|
|
59
|
-
/** Disponibilidad de un día específico */
|
|
60
|
-
export interface AvailabilityDay {
|
|
61
|
-
day: AvailabilityDayOfWeek;
|
|
62
|
-
slots: AvailabilitySlot[];
|
|
63
|
-
}
|
|
64
|
-
/** Valor completo del paso — array de días con sus franjas */
|
|
65
|
-
export type AvailabilityValue = AvailabilityDay[];
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* DRAFT — AvailabilityFormStep types
|
|
3
|
-
*
|
|
4
|
-
* Paso para capturar ventanas de disponibilidad: días de la semana + rangos de hora.
|
|
5
|
-
* Ej: "Disponible lunes y miércoles de 9am a 12pm, y viernes de 2pm a 6pm"
|
|
6
|
-
*/
|
|
7
|
-
// ===========================================================================
|
|
8
|
-
// Enums
|
|
9
|
-
// ===========================================================================
|
|
10
|
-
/** Granularidad de los slots — define cada cuánto se pueden seleccionar franjas */
|
|
11
|
-
export var AvailabilityGranularity;
|
|
12
|
-
(function (AvailabilityGranularity) {
|
|
13
|
-
AvailabilityGranularity["HOUR"] = "HOUR";
|
|
14
|
-
AvailabilityGranularity["HALF_HOUR"] = "HALF_HOUR";
|
|
15
|
-
AvailabilityGranularity["QUARTER_HOUR"] = "QUARTER_HOUR";
|
|
16
|
-
})(AvailabilityGranularity || (AvailabilityGranularity = {}));
|
|
17
|
-
/** Días de la semana (refleja DaysOfWeekTypes de Eureka-Types con valores 1-7) */
|
|
18
|
-
export var AvailabilityDayOfWeek;
|
|
19
|
-
(function (AvailabilityDayOfWeek) {
|
|
20
|
-
AvailabilityDayOfWeek[AvailabilityDayOfWeek["MONDAY"] = 1] = "MONDAY";
|
|
21
|
-
AvailabilityDayOfWeek[AvailabilityDayOfWeek["TUESDAY"] = 2] = "TUESDAY";
|
|
22
|
-
AvailabilityDayOfWeek[AvailabilityDayOfWeek["WEDNESDAY"] = 3] = "WEDNESDAY";
|
|
23
|
-
AvailabilityDayOfWeek[AvailabilityDayOfWeek["THURSDAY"] = 4] = "THURSDAY";
|
|
24
|
-
AvailabilityDayOfWeek[AvailabilityDayOfWeek["FRIDAY"] = 5] = "FRIDAY";
|
|
25
|
-
AvailabilityDayOfWeek[AvailabilityDayOfWeek["SATURDAY"] = 6] = "SATURDAY";
|
|
26
|
-
AvailabilityDayOfWeek[AvailabilityDayOfWeek["SUNDAY"] = 7] = "SUNDAY";
|
|
27
|
-
})(AvailabilityDayOfWeek || (AvailabilityDayOfWeek = {}));
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* DRAFT — BankAccountFormStep types
|
|
3
|
-
*
|
|
4
|
-
* Paso para capturar información de una cuenta bancaria.
|
|
5
|
-
* Incluye banco, tipo de cuenta, número, país, moneda y titular opcional.
|
|
6
|
-
*/
|
|
7
|
-
import { GBaseStep } from './GenericFormSteps';
|
|
8
|
-
export declare enum BankAccountType {
|
|
9
|
-
SAVINGS = "SAVINGS",
|
|
10
|
-
CHECKING = "CHECKING"
|
|
11
|
-
}
|
|
12
|
-
export interface BankAccountStep extends GBaseStep {
|
|
13
|
-
type: 'BANK_ACCOUNT';
|
|
14
|
-
label: string;
|
|
15
|
-
description: string | null;
|
|
16
|
-
required: boolean;
|
|
17
|
-
/**
|
|
18
|
-
* País predeterminado para filtrar la lista de bancos.
|
|
19
|
-
* Código ISO 3166-1 alpha-2 (ej: "CO", "US", "MX").
|
|
20
|
-
* El usuario puede cambiarlo si no se restringe.
|
|
21
|
-
*/
|
|
22
|
-
defaultCountry?: string;
|
|
23
|
-
/**
|
|
24
|
-
* Si se define, solo se muestran bancos de estos países.
|
|
25
|
-
* Si no se define, se permite cualquier país.
|
|
26
|
-
*/
|
|
27
|
-
allowedCountries?: string[];
|
|
28
|
-
/**
|
|
29
|
-
* Si se define, solo se muestran estas monedas.
|
|
30
|
-
* Códigos ISO 4217 (ej: ["COP", "USD"]).
|
|
31
|
-
*/
|
|
32
|
-
allowedCurrencies?: string[];
|
|
33
|
-
/**
|
|
34
|
-
* Si true, se solicita información del titular de la cuenta
|
|
35
|
-
* (nombre / identificación).
|
|
36
|
-
*/
|
|
37
|
-
requireHolder: boolean;
|
|
38
|
-
size: 1 | 2 | 3 | 4;
|
|
39
|
-
}
|
|
40
|
-
export interface BankAccountHolder {
|
|
41
|
-
/** Nombre completo del titular */
|
|
42
|
-
name?: string;
|
|
43
|
-
/**
|
|
44
|
-
* Referencia a un registro de identidad en Capta.
|
|
45
|
-
* Puede ser el id del contacto o el número de documento.
|
|
46
|
-
*/
|
|
47
|
-
identityRef?: string;
|
|
48
|
-
}
|
|
49
|
-
export interface BankValue {
|
|
50
|
-
bank: {
|
|
51
|
-
/** Id interno del banco en el catálogo de Capta */
|
|
52
|
-
id: string;
|
|
53
|
-
/** Nombre display del banco */
|
|
54
|
-
label: string;
|
|
55
|
-
};
|
|
56
|
-
/**
|
|
57
|
-
* Tipo de cuenta. Se acepta string para bancos con tipos no estándar
|
|
58
|
-
* (ej: "NEQUI", "DAVIPLATA", "CORRIENTE_EXTERIOR").
|
|
59
|
-
*/
|
|
60
|
-
accountType: BankAccountType | string;
|
|
61
|
-
accountNumber: string;
|
|
62
|
-
/** Código ISO 3166-1 alpha-2 del país */
|
|
63
|
-
country: string;
|
|
64
|
-
/** Código ISO 4217 de la moneda */
|
|
65
|
-
currency: string;
|
|
66
|
-
holder?: BankAccountHolder;
|
|
67
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* DRAFT — BankAccountFormStep types
|
|
3
|
-
*
|
|
4
|
-
* Paso para capturar información de una cuenta bancaria.
|
|
5
|
-
* Incluye banco, tipo de cuenta, número, país, moneda y titular opcional.
|
|
6
|
-
*/
|
|
7
|
-
// ===========================================================================
|
|
8
|
-
// Enums
|
|
9
|
-
// ===========================================================================
|
|
10
|
-
export var BankAccountType;
|
|
11
|
-
(function (BankAccountType) {
|
|
12
|
-
BankAccountType["SAVINGS"] = "SAVINGS";
|
|
13
|
-
BankAccountType["CHECKING"] = "CHECKING";
|
|
14
|
-
})(BankAccountType || (BankAccountType = {}));
|