@joelbarron/react-web-dev-kit 0.1.0
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/README.md +236 -0
- package/dist/auth/client.d.ts +44 -0
- package/dist/auth/client.d.ts.map +1 -0
- package/dist/auth/client.js +354 -0
- package/dist/auth/constants/countryCallingCodes.d.ts +9 -0
- package/dist/auth/constants/countryCallingCodes.d.ts.map +1 -0
- package/dist/auth/constants/countryCallingCodes.js +209 -0
- package/dist/auth/constants/gender.d.ts +9 -0
- package/dist/auth/constants/gender.d.ts.map +1 -0
- package/dist/auth/constants/gender.js +12 -0
- package/dist/auth/constants/index.d.ts +3 -0
- package/dist/auth/constants/index.d.ts.map +1 -0
- package/dist/auth/constants/index.js +2 -0
- package/dist/auth/forms/account/AuthAccountConfirmationForm.d.ts +18 -0
- package/dist/auth/forms/account/AuthAccountConfirmationForm.d.ts.map +1 -0
- package/dist/auth/forms/account/AuthAccountConfirmationForm.js +166 -0
- package/dist/auth/forms/account/index.d.ts +2 -0
- package/dist/auth/forms/account/index.d.ts.map +1 -0
- package/dist/auth/forms/account/index.js +1 -0
- package/dist/auth/forms/errorParser.d.ts +7 -0
- package/dist/auth/forms/errorParser.d.ts.map +1 -0
- package/dist/auth/forms/errorParser.js +65 -0
- package/dist/auth/forms/index.d.ts +6 -0
- package/dist/auth/forms/index.d.ts.map +1 -0
- package/dist/auth/forms/index.js +5 -0
- package/dist/auth/forms/password/AuthForgotPasswordForm.d.ts +12 -0
- package/dist/auth/forms/password/AuthForgotPasswordForm.d.ts.map +1 -0
- package/dist/auth/forms/password/AuthForgotPasswordForm.js +71 -0
- package/dist/auth/forms/password/AuthPasswordResetConfirmForm.d.ts +15 -0
- package/dist/auth/forms/password/AuthPasswordResetConfirmForm.d.ts.map +1 -0
- package/dist/auth/forms/password/AuthPasswordResetConfirmForm.js +88 -0
- package/dist/auth/forms/password/AuthResetPasswordForm.d.ts +12 -0
- package/dist/auth/forms/password/AuthResetPasswordForm.d.ts.map +1 -0
- package/dist/auth/forms/password/AuthResetPasswordForm.js +18 -0
- package/dist/auth/forms/password/index.d.ts +4 -0
- package/dist/auth/forms/password/index.d.ts.map +1 -0
- package/dist/auth/forms/password/index.js +3 -0
- package/dist/auth/forms/sign-in/AuthOtpSignInForm.d.ts +24 -0
- package/dist/auth/forms/sign-in/AuthOtpSignInForm.d.ts.map +1 -0
- package/dist/auth/forms/sign-in/AuthOtpSignInForm.js +226 -0
- package/dist/auth/forms/sign-in/AuthPasswordSignInForm.d.ts +21 -0
- package/dist/auth/forms/sign-in/AuthPasswordSignInForm.d.ts.map +1 -0
- package/dist/auth/forms/sign-in/AuthPasswordSignInForm.js +120 -0
- package/dist/auth/forms/sign-in/index.d.ts +3 -0
- package/dist/auth/forms/sign-in/index.d.ts.map +1 -0
- package/dist/auth/forms/sign-in/index.js +2 -0
- package/dist/auth/forms/sign-up/AuthSignUpForm.d.ts +36 -0
- package/dist/auth/forms/sign-up/AuthSignUpForm.d.ts.map +1 -0
- package/dist/auth/forms/sign-up/AuthSignUpForm.js +164 -0
- package/dist/auth/forms/sign-up/index.d.ts +2 -0
- package/dist/auth/forms/sign-up/index.d.ts.map +1 -0
- package/dist/auth/forms/sign-up/index.js +1 -0
- package/dist/auth/fuse/createFuseAuthViews.d.ts +24 -0
- package/dist/auth/fuse/createFuseAuthViews.d.ts.map +1 -0
- package/dist/auth/fuse/createFuseAuthViews.js +360 -0
- package/dist/auth/fuse/fuseAdapter.d.ts +40 -0
- package/dist/auth/fuse/fuseAdapter.d.ts.map +1 -0
- package/dist/auth/fuse/fuseAdapter.js +265 -0
- package/dist/auth/fuse/fuseIntegration.d.ts +59 -0
- package/dist/auth/fuse/fuseIntegration.d.ts.map +1 -0
- package/dist/auth/fuse/fuseIntegration.js +85 -0
- package/dist/auth/fuse/index.d.ts +4 -0
- package/dist/auth/fuse/index.d.ts.map +1 -0
- package/dist/auth/fuse/index.js +3 -0
- package/dist/auth/index.d.ts +11 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +10 -0
- package/dist/auth/provider.d.ts +35 -0
- package/dist/auth/provider.d.ts.map +1 -0
- package/dist/auth/provider.js +133 -0
- package/dist/auth/query.d.ts +23 -0
- package/dist/auth/query.d.ts.map +1 -0
- package/dist/auth/query.js +103 -0
- package/dist/auth/routes.d.ts +37 -0
- package/dist/auth/routes.d.ts.map +1 -0
- package/dist/auth/routes.js +73 -0
- package/dist/auth/social/providerAuth.d.ts +76 -0
- package/dist/auth/social/providerAuth.d.ts.map +1 -0
- package/dist/auth/social/providerAuth.js +130 -0
- package/dist/auth/storage.d.ts +3 -0
- package/dist/auth/storage.d.ts.map +1 -0
- package/dist/auth/storage.js +20 -0
- package/dist/auth/types.d.ts +208 -0
- package/dist/auth/types.d.ts.map +1 -0
- package/dist/auth/types.js +1 -0
- package/dist/auth/ui/AuthPagesMessageSection.d.ts +3 -0
- package/dist/auth/ui/AuthPagesMessageSection.d.ts.map +1 -0
- package/dist/auth/ui/AuthPagesMessageSection.js +39 -0
- package/dist/auth/ui/AuthPrimaryButton.d.ts +9 -0
- package/dist/auth/ui/AuthPrimaryButton.d.ts.map +1 -0
- package/dist/auth/ui/AuthPrimaryButton.js +19 -0
- package/dist/auth/ui/AuthRoleSelectionDialog.d.ts +14 -0
- package/dist/auth/ui/AuthRoleSelectionDialog.d.ts.map +1 -0
- package/dist/auth/ui/AuthRoleSelectionDialog.js +39 -0
- package/dist/auth/ui/AuthRoutePageWrapper.d.ts +12 -0
- package/dist/auth/ui/AuthRoutePageWrapper.d.ts.map +1 -0
- package/dist/auth/ui/AuthRoutePageWrapper.js +59 -0
- package/dist/auth/ui/AuthSecondaryButton.d.ts +7 -0
- package/dist/auth/ui/AuthSecondaryButton.d.ts.map +1 -0
- package/dist/auth/ui/AuthSecondaryButton.js +18 -0
- package/dist/auth/ui/AuthSocialProviderButton.d.ts +11 -0
- package/dist/auth/ui/AuthSocialProviderButton.d.ts.map +1 -0
- package/dist/auth/ui/AuthSocialProviderButton.js +30 -0
- package/dist/auth/ui/SignInPageTitle.d.ts +6 -0
- package/dist/auth/ui/SignInPageTitle.d.ts.map +1 -0
- package/dist/auth/ui/SignInPageTitle.js +7 -0
- package/dist/auth/ui/SignOutPageTitle.d.ts +6 -0
- package/dist/auth/ui/SignOutPageTitle.d.ts.map +1 -0
- package/dist/auth/ui/SignOutPageTitle.js +7 -0
- package/dist/auth/ui/SignUpPageTitle.d.ts +6 -0
- package/dist/auth/ui/SignUpPageTitle.d.ts.map +1 -0
- package/dist/auth/ui/SignUpPageTitle.js +7 -0
- package/dist/auth/ui/index.d.ts +11 -0
- package/dist/auth/ui/index.d.ts.map +1 -0
- package/dist/auth/ui/index.js +10 -0
- package/dist/auth/ui/types.d.ts +15 -0
- package/dist/auth/ui/types.d.ts.map +1 -0
- package/dist/auth/ui/types.js +1 -0
- package/dist/config/createConfig.d.ts +13 -0
- package/dist/config/createConfig.d.ts.map +1 -0
- package/dist/config/createConfig.js +104 -0
- package/dist/config/defaults.d.ts +3 -0
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/defaults.js +38 -0
- package/dist/config/index.d.ts +5 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +4 -0
- package/dist/config/merge.d.ts +2 -0
- package/dist/config/merge.d.ts.map +1 -0
- package/dist/config/merge.js +18 -0
- package/dist/config/types.d.ts +46 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +1 -0
- package/dist/forms/JBCheckboxField.d.ts +12 -0
- package/dist/forms/JBCheckboxField.d.ts.map +1 -0
- package/dist/forms/JBCheckboxField.js +36 -0
- package/dist/forms/JBDatePickerField.d.ts +12 -0
- package/dist/forms/JBDatePickerField.d.ts.map +1 -0
- package/dist/forms/JBDatePickerField.js +14 -0
- package/dist/forms/JBRadioGroupField.d.ts +10 -0
- package/dist/forms/JBRadioGroupField.d.ts.map +1 -0
- package/dist/forms/JBRadioGroupField.js +8 -0
- package/dist/forms/JBSelectField.d.ts +9 -0
- package/dist/forms/JBSelectField.d.ts.map +1 -0
- package/dist/forms/JBSelectField.js +8 -0
- package/dist/forms/JBSwitchField.d.ts +11 -0
- package/dist/forms/JBSwitchField.d.ts.map +1 -0
- package/dist/forms/JBSwitchField.js +10 -0
- package/dist/forms/JBTextField.d.ts +6 -0
- package/dist/forms/JBTextField.d.ts.map +1 -0
- package/dist/forms/JBTextField.js +8 -0
- package/dist/forms/JBTimePickerField.d.ts +12 -0
- package/dist/forms/JBTimePickerField.d.ts.map +1 -0
- package/dist/forms/JBTimePickerField.js +14 -0
- package/dist/forms/index.d.ts +11 -0
- package/dist/forms/index.d.ts.map +1 -0
- package/dist/forms/index.js +10 -0
- package/dist/forms/rules.d.ts +16 -0
- package/dist/forms/rules.d.ts.map +1 -0
- package/dist/forms/rules.js +21 -0
- package/dist/forms/types.d.ts +12 -0
- package/dist/forms/types.d.ts.map +1 -0
- package/dist/forms/types.js +1 -0
- package/dist/forms/utils.d.ts +5 -0
- package/dist/forms/utils.d.ts.map +1 -0
- package/dist/forms/utils.js +7 -0
- package/dist/grid/JBGrid.d.ts +3 -0
- package/dist/grid/JBGrid.d.ts.map +1 -0
- package/dist/grid/JBGrid.js +89 -0
- package/dist/grid/JBGridHeader.d.ts +3 -0
- package/dist/grid/JBGridHeader.d.ts.map +1 -0
- package/dist/grid/JBGridHeader.js +22 -0
- package/dist/grid/JBGridProviders.d.ts +10 -0
- package/dist/grid/JBGridProviders.d.ts.map +1 -0
- package/dist/grid/JBGridProviders.js +31 -0
- package/dist/grid/index.d.ts +5 -0
- package/dist/grid/index.d.ts.map +1 -0
- package/dist/grid/index.js +4 -0
- package/dist/grid/types.d.ts +81 -0
- package/dist/grid/types.d.ts.map +1 -0
- package/dist/grid/types.js +1 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +2 -0
- package/dist/hooks/useJBDebouncedValue.d.ts +2 -0
- package/dist/hooks/useJBDebouncedValue.d.ts.map +1 -0
- package/dist/hooks/useJBDebouncedValue.js +11 -0
- package/dist/hooks/useJBRedirect.d.ts +10 -0
- package/dist/hooks/useJBRedirect.d.ts.map +1 -0
- package/dist/hooks/useJBRedirect.js +11 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/query/createQueryClient.d.ts +8 -0
- package/dist/query/createQueryClient.d.ts.map +1 -0
- package/dist/query/createQueryClient.js +25 -0
- package/dist/query/http.d.ts +3 -0
- package/dist/query/http.d.ts.map +1 -0
- package/dist/query/http.js +12 -0
- package/dist/query/index.d.ts +3 -0
- package/dist/query/index.d.ts.map +1 -0
- package/dist/query/index.js +2 -0
- package/dist/utils/format.d.ts +4 -0
- package/dist/utils/format.d.ts.map +1 -0
- package/dist/utils/format.js +28 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/query.d.ts +2 -0
- package/dist/utils/query.d.ts.map +1 -0
- package/dist/utils/query.js +4 -0
- package/dist/utils/regex.d.ts +7 -0
- package/dist/utils/regex.d.ts.map +1 -0
- package/dist/utils/regex.js +6 -0
- package/package.json +85 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthPagesMessageSection.d.ts","sourceRoot":"","sources":["../../../src/auth/ui/AuthPagesMessageSection.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAalD,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,uBAAuB,2CAoHrE"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Avatar from '@mui/material/Avatar';
|
|
3
|
+
import AvatarGroup from '@mui/material/AvatarGroup';
|
|
4
|
+
import Box from '@mui/material/Box';
|
|
5
|
+
const defaultTitleLines = ['Bienvenido a', 'nuestra comunidad'];
|
|
6
|
+
const defaultDescription = 'Fuse ayuda a desarrolladores a construir paneles organizados, bien estructurados y con módulos visuales de alta calidad. Únete y empieza a construir tu aplicación hoy.';
|
|
7
|
+
const defaultFooterText = 'Más de 17k personas ya se unieron, ahora te toca a ti.';
|
|
8
|
+
const defaultAvatarUrls = [
|
|
9
|
+
'/assets/images/avatars/female-18.jpg',
|
|
10
|
+
'/assets/images/avatars/female-11.jpg',
|
|
11
|
+
'/assets/images/avatars/male-09.jpg',
|
|
12
|
+
'/assets/images/avatars/male-16.jpg'
|
|
13
|
+
];
|
|
14
|
+
export function AuthPagesMessageSection(props) {
|
|
15
|
+
const { titleLines = defaultTitleLines, description = defaultDescription, footerText = defaultFooterText, avatarUrls = defaultAvatarUrls } = props;
|
|
16
|
+
return (_jsxs(Box, { sx: {
|
|
17
|
+
position: 'relative',
|
|
18
|
+
display: { xs: 'none', md: 'flex' },
|
|
19
|
+
height: '100%',
|
|
20
|
+
flex: '1 1 auto',
|
|
21
|
+
alignItems: 'center',
|
|
22
|
+
justifyContent: 'center',
|
|
23
|
+
overflow: 'hidden',
|
|
24
|
+
p: 6,
|
|
25
|
+
px: { lg: 10 },
|
|
26
|
+
backgroundColor: 'primary.dark',
|
|
27
|
+
color: 'primary.contrastText'
|
|
28
|
+
}, children: [_jsx("svg", { style: { pointerEvents: 'none', position: 'absolute', inset: 0 }, viewBox: "0 0 960 540", width: "100%", height: "100%", preserveAspectRatio: "xMidYMax slice", xmlns: "http://www.w3.org/2000/svg", children: _jsxs(Box, { component: "g", sx: { opacity: 0.05 }, fill: "none", stroke: "currentColor", strokeWidth: "100", children: [_jsx("circle", { r: "234", cx: "196", cy: "23" }), _jsx("circle", { r: "234", cx: "790", cy: "491" })] }) }), _jsxs(Box, { component: "svg", sx: {
|
|
29
|
+
position: 'absolute',
|
|
30
|
+
top: -64,
|
|
31
|
+
right: -64,
|
|
32
|
+
opacity: 0.2,
|
|
33
|
+
color: 'primary.light'
|
|
34
|
+
}, viewBox: "0 0 220 192", width: "220px", height: "192px", fill: "none", children: [_jsx("defs", { children: _jsx("pattern", { id: "jb-auth-message-pattern", x: "0", y: "0", width: "20", height: "20", patternUnits: "userSpaceOnUse", children: _jsx("rect", { x: "0", y: "0", width: "4", height: "4", fill: "currentColor" }) }) }), _jsx("rect", { width: "220", height: "192", fill: "url(#jb-auth-message-pattern)" })] }), _jsxs(Box, { sx: { position: 'relative', zIndex: 10, width: '100%', maxWidth: 896 }, children: [_jsx(Box, { sx: { fontSize: 64, lineHeight: 1, fontWeight: 700, color: 'grey.100' }, children: titleLines.map((line) => (_jsx(Box, { children: line }, line))) }), _jsx(Box, { sx: { mt: 3, fontSize: 18, lineHeight: 1.5, letterSpacing: '-0.01em', color: 'grey.400' }, children: description }), _jsxs(Box, { sx: { mt: 4, display: 'flex', alignItems: 'center' }, children: [_jsx(AvatarGroup, { sx: {
|
|
35
|
+
'& .MuiAvatar-root': {
|
|
36
|
+
borderColor: 'primary.main'
|
|
37
|
+
}
|
|
38
|
+
}, children: avatarUrls.map((avatarUrl) => (_jsx(Avatar, { src: avatarUrl }, avatarUrl))) }), _jsx(Box, { sx: { ml: 2, fontWeight: 500, letterSpacing: '-0.01em', color: 'grey.400' }, children: footerText })] })] })] }));
|
|
39
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ButtonProps } from '@mui/material/Button';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
type AuthPrimaryButtonProps = Omit<ButtonProps, 'variant' | 'color'> & {
|
|
4
|
+
loading?: boolean;
|
|
5
|
+
loadingLabel?: ReactNode;
|
|
6
|
+
};
|
|
7
|
+
export declare function AuthPrimaryButton(props: AuthPrimaryButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=AuthPrimaryButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthPrimaryButton.d.ts","sourceRoot":"","sources":["../../../src/auth/ui/AuthPrimaryButton.tsx"],"names":[],"mappings":"AAAA,OAAe,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,KAAK,sBAAsB,GAAG,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,OAAO,CAAC,GAAG;IACrE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,SAAS,CAAC;CAC1B,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,2CAiC9D"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import Button from '@mui/material/Button';
|
|
3
|
+
import CircularProgress from '@mui/material/CircularProgress';
|
|
4
|
+
export function AuthPrimaryButton(props) {
|
|
5
|
+
const { loading = false, loadingLabel, children, disabled, sx, ...rest } = props;
|
|
6
|
+
return (_jsx(Button, { ...rest, variant: "contained", color: "secondary", disabled: Boolean(disabled) || loading, startIcon: loading ? (_jsx(CircularProgress, { size: 16, color: "inherit" })) : undefined, sx: {
|
|
7
|
+
width: '100%',
|
|
8
|
+
minHeight: 38,
|
|
9
|
+
'&.Mui-disabled': {
|
|
10
|
+
opacity: 1,
|
|
11
|
+
color: 'common.white',
|
|
12
|
+
backgroundColor: 'secondary.main'
|
|
13
|
+
},
|
|
14
|
+
'&.Mui-disabled.MuiButton-contained': {
|
|
15
|
+
opacity: 0.6
|
|
16
|
+
},
|
|
17
|
+
...(sx ?? {})
|
|
18
|
+
}, children: loading ? loadingLabel ?? children : children }));
|
|
19
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SelectOption } from '../../forms';
|
|
2
|
+
export type AuthRoleSelectionDialogProps = {
|
|
3
|
+
open: boolean;
|
|
4
|
+
options: SelectOption<string>[];
|
|
5
|
+
initialRole?: string;
|
|
6
|
+
title?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
confirmLabel?: string;
|
|
9
|
+
cancelLabel?: string;
|
|
10
|
+
onCancel: () => void;
|
|
11
|
+
onConfirm: (role: string) => void;
|
|
12
|
+
};
|
|
13
|
+
export declare function AuthRoleSelectionDialog(props: AuthRoleSelectionDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
//# sourceMappingURL=AuthRoleSelectionDialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthRoleSelectionDialog.d.ts","sourceRoot":"","sources":["../../../src/auth/ui/AuthRoleSelectionDialog.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAqB,YAAY,EAAE,MAAM,aAAa,CAAC;AAQ9D,MAAM,MAAM,4BAA4B,GAAG;IACzC,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC,CAAC;AAMF,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,4BAA4B,2CAuE1E"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { zodResolver } from '@hookform/resolvers/zod';
|
|
3
|
+
import Dialog from '@mui/material/Dialog';
|
|
4
|
+
import DialogActions from '@mui/material/DialogActions';
|
|
5
|
+
import DialogContent from '@mui/material/DialogContent';
|
|
6
|
+
import DialogContentText from '@mui/material/DialogContentText';
|
|
7
|
+
import DialogTitle from '@mui/material/DialogTitle';
|
|
8
|
+
import { useEffect } from 'react';
|
|
9
|
+
import { useForm } from 'react-hook-form';
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
import { JBRadioGroupField } from '../../forms';
|
|
12
|
+
import { AuthPrimaryButton } from './AuthPrimaryButton';
|
|
13
|
+
import { AuthSecondaryButton } from './AuthSecondaryButton';
|
|
14
|
+
const roleSelectionSchema = z.object({
|
|
15
|
+
role: z.string().nonempty('Selecciona un rol para continuar.')
|
|
16
|
+
});
|
|
17
|
+
export function AuthRoleSelectionDialog(props) {
|
|
18
|
+
const { open, options, initialRole, title = 'Selecciona tu rol', description = 'Elige el tipo de perfil con el que deseas continuar.', confirmLabel = 'Continuar', cancelLabel = 'Cancelar', onCancel, onConfirm } = props;
|
|
19
|
+
const fallbackRole = initialRole ?? options[0]?.value ?? '';
|
|
20
|
+
const { control, handleSubmit, reset, formState } = useForm({
|
|
21
|
+
mode: 'onSubmit',
|
|
22
|
+
resolver: zodResolver(roleSelectionSchema),
|
|
23
|
+
defaultValues: {
|
|
24
|
+
role: fallbackRole
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
const { isSubmitting } = formState;
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (!open) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
reset({
|
|
33
|
+
role: initialRole ?? options[0]?.value ?? ''
|
|
34
|
+
});
|
|
35
|
+
}, [open, initialRole, options, reset]);
|
|
36
|
+
return (_jsxs(Dialog, { open: open, onClose: onCancel, fullWidth: true, maxWidth: 'xs', children: [_jsx(DialogTitle, { children: title }), _jsxs(DialogContent, { children: [_jsx(DialogContentText, { sx: { mb: 2 }, children: description }), _jsx(JBRadioGroupField, { control: control, name: 'role', options: options, formControlProps: { fullWidth: true } })] }), _jsxs(DialogActions, { children: [_jsx(AuthSecondaryButton, { sx: { mt: 0 }, type: 'button', onClick: onCancel, disabled: isSubmitting, children: cancelLabel }), _jsx(AuthPrimaryButton, { sx: { mt: 0 }, type: 'button', onClick: () => {
|
|
37
|
+
void handleSubmit((values) => onConfirm(values.role))();
|
|
38
|
+
}, loading: isSubmitting, loadingLabel: 'Guardando...', children: confirmLabel })] })] }));
|
|
39
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ComponentType, ReactNode } from 'react';
|
|
2
|
+
import { AuthPageWrapperProps } from '../routes';
|
|
3
|
+
import { AuthMessageSectionProps, AuthPageLayoutVariant } from './types';
|
|
4
|
+
type AuthRoutePageWrapperProps = AuthPageWrapperProps & {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
layoutVariant?: AuthPageLayoutVariant;
|
|
7
|
+
messageSectionProps?: AuthMessageSectionProps;
|
|
8
|
+
MessageSectionComponent?: ComponentType<AuthMessageSectionProps>;
|
|
9
|
+
};
|
|
10
|
+
export declare function AuthRoutePageWrapper(props: AuthRoutePageWrapperProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=AuthRoutePageWrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthRoutePageWrapper.d.ts","sourceRoot":"","sources":["../../../src/auth/ui/AuthRoutePageWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAEjD,OAAO,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAEzE,KAAK,yBAAyB,GAAG,oBAAoB,GAAG;IACtD,QAAQ,EAAE,SAAS,CAAC;IACpB,aAAa,CAAC,EAAE,qBAAqB,CAAC;IACtC,mBAAmB,CAAC,EAAE,uBAAuB,CAAC;IAC9C,uBAAuB,CAAC,EAAE,aAAa,CAAC,uBAAuB,CAAC,CAAC;CAClE,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,2CAmFpE"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Box from '@mui/material/Box';
|
|
3
|
+
import Paper from '@mui/material/Paper';
|
|
4
|
+
import { AuthPagesMessageSection } from './AuthPagesMessageSection';
|
|
5
|
+
export function AuthRoutePageWrapper(props) {
|
|
6
|
+
const { children, routeKey, layoutVariant = 'split', messageSectionProps, MessageSectionComponent = AuthPagesMessageSection } = props;
|
|
7
|
+
const isSignOut = routeKey === 'signOut';
|
|
8
|
+
if (layoutVariant === 'modern') {
|
|
9
|
+
return (_jsx(Box, { sx: {
|
|
10
|
+
display: 'flex',
|
|
11
|
+
minWidth: 0,
|
|
12
|
+
flex: '1 1 auto',
|
|
13
|
+
flexDirection: 'column',
|
|
14
|
+
alignItems: 'center',
|
|
15
|
+
justifyContent: 'center',
|
|
16
|
+
p: { md: 4 }
|
|
17
|
+
}, children: _jsxs(Paper, { sx: {
|
|
18
|
+
display: 'flex',
|
|
19
|
+
minHeight: { xs: '100%', sm: 'auto' },
|
|
20
|
+
width: { xs: '100%', md: '100%' },
|
|
21
|
+
maxWidth: { md: 1280 },
|
|
22
|
+
overflow: 'hidden',
|
|
23
|
+
borderRadius: { xs: 0, sm: 3 },
|
|
24
|
+
boxShadow: { xs: 'none', sm: 1 }
|
|
25
|
+
}, children: [_jsx(Box, { sx: {
|
|
26
|
+
width: { xs: '100%', md: '50%' },
|
|
27
|
+
px: { xs: 2, sm: 6, md: 8 },
|
|
28
|
+
py: { xs: 2, sm: 6, md: 8 },
|
|
29
|
+
borderRight: (theme) => (theme.direction === 'ltr' ? 1 : 0),
|
|
30
|
+
borderLeft: (theme) => (theme.direction === 'rtl' ? 1 : 0),
|
|
31
|
+
borderColor: 'divider',
|
|
32
|
+
display: 'flex',
|
|
33
|
+
alignItems: 'center',
|
|
34
|
+
justifyContent: isSignOut ? 'center' : 'flex-start'
|
|
35
|
+
}, children: children }), _jsx(MessageSectionComponent, { ...(messageSectionProps ?? {}) })] }) }));
|
|
36
|
+
}
|
|
37
|
+
return (_jsxs(Box, { sx: {
|
|
38
|
+
display: 'flex',
|
|
39
|
+
minWidth: 0,
|
|
40
|
+
flex: '1 1 auto',
|
|
41
|
+
flexDirection: { xs: 'column', sm: 'row' },
|
|
42
|
+
alignItems: { xs: 'center', md: 'flex-start' },
|
|
43
|
+
justifyContent: { sm: 'center', md: 'flex-start' }
|
|
44
|
+
}, children: [_jsx(Paper, { sx: {
|
|
45
|
+
height: { xs: '100%', sm: 'auto', md: '100%' },
|
|
46
|
+
width: { xs: '100%', sm: 'auto', md: layoutVariant === 'split' ? '50%' : '100%' },
|
|
47
|
+
px: { xs: 2, sm: 6, md: 8 },
|
|
48
|
+
py: { xs: layoutVariant === 'fullScreen' ? 2 : 1, sm: 6, md: layoutVariant === 'fullScreen' ? 12 : 8 },
|
|
49
|
+
borderRadius: { xs: 0, sm: 3, md: 0 },
|
|
50
|
+
boxShadow: { xs: 'none', sm: 1, md: 'none' },
|
|
51
|
+
display: { md: 'flex' },
|
|
52
|
+
alignItems: { md: 'center' },
|
|
53
|
+
justifyContent: { md: 'flex-end' },
|
|
54
|
+
borderRight: (theme) => (theme.direction === 'ltr' ? 1 : 0),
|
|
55
|
+
borderLeft: (theme) => (theme.direction === 'rtl' ? 1 : 0),
|
|
56
|
+
borderColor: 'divider',
|
|
57
|
+
...(isSignOut ? { alignItems: { xs: 'center', md: 'center' } } : null)
|
|
58
|
+
}, children: children }), _jsx(MessageSectionComponent, { ...(messageSectionProps ?? {}) })] }));
|
|
59
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ButtonProps } from "@mui/material/Button";
|
|
2
|
+
type AuthSecondaryButtonProps = Omit<ButtonProps, "variant"> & {
|
|
3
|
+
to?: string;
|
|
4
|
+
};
|
|
5
|
+
export declare function AuthSecondaryButton(props: AuthSecondaryButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=AuthSecondaryButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthSecondaryButton.d.ts","sourceRoot":"","sources":["../../../src/auth/ui/AuthSecondaryButton.tsx"],"names":[],"mappings":"AAAA,OAAe,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAE3D,KAAK,wBAAwB,GAAG,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,GAAG;IAC7D,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,2CAsBlE"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import Button from "@mui/material/Button";
|
|
3
|
+
export function AuthSecondaryButton(props) {
|
|
4
|
+
const { sx, ...rest } = props;
|
|
5
|
+
return (_jsx(Button, { ...rest, variant: "outlined", sx: {
|
|
6
|
+
width: "100%",
|
|
7
|
+
minHeight: 38,
|
|
8
|
+
borderWidth: 1,
|
|
9
|
+
borderColor: "rgba(15, 23, 42, 0.28)",
|
|
10
|
+
color: "text.primary",
|
|
11
|
+
fontWeight: 600,
|
|
12
|
+
"&:hover": {
|
|
13
|
+
borderWidth: 1,
|
|
14
|
+
borderColor: "rgba(15, 23, 42, 0.45)",
|
|
15
|
+
},
|
|
16
|
+
...(sx ?? {}),
|
|
17
|
+
} }));
|
|
18
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ButtonProps } from '@mui/material/Button';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { SocialProvider } from '../types';
|
|
4
|
+
type AuthSocialProviderButtonProps = Omit<ButtonProps, 'variant' | 'color'> & {
|
|
5
|
+
provider: SocialProvider;
|
|
6
|
+
loading?: boolean;
|
|
7
|
+
loadingLabel?: ReactNode;
|
|
8
|
+
};
|
|
9
|
+
export declare function AuthSocialProviderButton(props: AuthSocialProviderButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=AuthSocialProviderButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthSocialProviderButton.d.ts","sourceRoot":"","sources":["../../../src/auth/ui/AuthSocialProviderButton.tsx"],"names":[],"mappings":"AAGA,OAAe,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,KAAK,6BAA6B,GAAG,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,OAAO,CAAC,GAAG;IAC5E,QAAQ,EAAE,cAAc,CAAC;IACzB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,SAAS,CAAC;CAC1B,CAAC;AAcF,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,6BAA6B,2CAkC5E"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import AppleIcon from '@mui/icons-material/Apple';
|
|
3
|
+
import FacebookIcon from '@mui/icons-material/Facebook';
|
|
4
|
+
import GoogleIcon from '@mui/icons-material/Google';
|
|
5
|
+
import Button from '@mui/material/Button';
|
|
6
|
+
import CircularProgress from '@mui/material/CircularProgress';
|
|
7
|
+
const providerIcon = {
|
|
8
|
+
google: _jsx(GoogleIcon, { fontSize: 'small' }),
|
|
9
|
+
facebook: _jsx(FacebookIcon, { fontSize: 'small' }),
|
|
10
|
+
apple: _jsx(AppleIcon, { fontSize: 'small' })
|
|
11
|
+
};
|
|
12
|
+
const providerLabel = {
|
|
13
|
+
google: 'Google',
|
|
14
|
+
facebook: 'Facebook',
|
|
15
|
+
apple: 'Apple'
|
|
16
|
+
};
|
|
17
|
+
export function AuthSocialProviderButton(props) {
|
|
18
|
+
const { provider, loading = false, loadingLabel, children, disabled, sx, ...rest } = props;
|
|
19
|
+
const label = children ?? providerLabel[provider];
|
|
20
|
+
return (_jsx(Button, { ...rest, variant: 'outlined', color: 'inherit', disabled: Boolean(disabled) || loading, "aria-label": providerLabel[provider], startIcon: loading ? (_jsx(CircularProgress, { size: 16, color: 'inherit' })) : (providerIcon[provider]), sx: {
|
|
21
|
+
width: '100%',
|
|
22
|
+
minWidth: 0,
|
|
23
|
+
minHeight: 38,
|
|
24
|
+
justifyContent: 'center',
|
|
25
|
+
'& .MuiButton-startIcon': {
|
|
26
|
+
marginRight: 1
|
|
27
|
+
},
|
|
28
|
+
...(sx ?? {})
|
|
29
|
+
}, children: loading ? loadingLabel ?? label : label }));
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SignInPageTitle.d.ts","sourceRoot":"","sources":["../../../src/auth/ui/SignInPageTitle.tsx"],"names":[],"mappings":"AAGA,KAAK,oBAAoB,GAAG;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,2CAiB1D"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Box from '@mui/material/Box';
|
|
3
|
+
import Typography from '@mui/material/Typography';
|
|
4
|
+
export function SignInPageTitle(props) {
|
|
5
|
+
const { logoSrc = '/assets/images/logo/logo.svg' } = props;
|
|
6
|
+
return (_jsxs(Box, { sx: { width: '100%' }, children: [_jsx("img", { style: { width: 48 }, src: logoSrc, alt: "logo" }), _jsx(Typography, { sx: { mt: 4, fontSize: 36, lineHeight: 1.25, fontWeight: 800, letterSpacing: '-0.02em' }, children: "Iniciar sesi\u00F3n" })] }));
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SignOutPageTitle.d.ts","sourceRoot":"","sources":["../../../src/auth/ui/SignOutPageTitle.tsx"],"names":[],"mappings":"AAGA,KAAK,qBAAqB,GAAG;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,2CAiB5D"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Box from '@mui/material/Box';
|
|
3
|
+
import Typography from '@mui/material/Typography';
|
|
4
|
+
export function SignOutPageTitle(props) {
|
|
5
|
+
const { logoSrc = '/assets/images/logo/logo.svg' } = props;
|
|
6
|
+
return (_jsxs(Box, { sx: { width: '100%' }, children: [_jsx("img", { style: { width: 48, display: 'block', marginInline: 'auto' }, src: logoSrc, alt: "logo" }), _jsx(Typography, { sx: { mt: 4, textAlign: 'center', fontSize: 36, lineHeight: 1.25, fontWeight: 800, letterSpacing: '-0.02em' }, children: "Has cerrado sesi\u00F3n" })] }));
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SignUpPageTitle.d.ts","sourceRoot":"","sources":["../../../src/auth/ui/SignUpPageTitle.tsx"],"names":[],"mappings":"AAGA,KAAK,oBAAoB,GAAG;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,2CAiB1D"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Box from '@mui/material/Box';
|
|
3
|
+
import Typography from '@mui/material/Typography';
|
|
4
|
+
export function SignUpPageTitle(props) {
|
|
5
|
+
const { logoSrc = '/assets/images/logo/logo.svg' } = props;
|
|
6
|
+
return (_jsxs(Box, { sx: { width: '100%' }, children: [_jsx("img", { style: { width: 48 }, src: logoSrc, alt: "logo" }), _jsx(Typography, { sx: { mt: 4, fontSize: 36, lineHeight: 1.25, fontWeight: 800, letterSpacing: '-0.02em' }, children: "Crear cuenta" })] }));
|
|
7
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './types';
|
|
2
|
+
export * from './AuthPagesMessageSection';
|
|
3
|
+
export * from './AuthRoutePageWrapper';
|
|
4
|
+
export * from './AuthPrimaryButton';
|
|
5
|
+
export * from './AuthSecondaryButton';
|
|
6
|
+
export * from './AuthSocialProviderButton';
|
|
7
|
+
export * from './AuthRoleSelectionDialog';
|
|
8
|
+
export * from './SignInPageTitle';
|
|
9
|
+
export * from './SignUpPageTitle';
|
|
10
|
+
export * from './SignOutPageTitle';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/auth/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './types';
|
|
2
|
+
export * from './AuthPagesMessageSection';
|
|
3
|
+
export * from './AuthRoutePageWrapper';
|
|
4
|
+
export * from './AuthPrimaryButton';
|
|
5
|
+
export * from './AuthSecondaryButton';
|
|
6
|
+
export * from './AuthSocialProviderButton';
|
|
7
|
+
export * from './AuthRoleSelectionDialog';
|
|
8
|
+
export * from './SignInPageTitle';
|
|
9
|
+
export * from './SignUpPageTitle';
|
|
10
|
+
export * from './SignOutPageTitle';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ComponentType, ReactNode } from 'react';
|
|
2
|
+
export type AuthLinkComponentProps = {
|
|
3
|
+
to: string;
|
|
4
|
+
className?: string;
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
};
|
|
7
|
+
export type AuthLinkComponent = ComponentType<AuthLinkComponentProps>;
|
|
8
|
+
export type AuthPageLayoutVariant = 'split' | 'fullScreen' | 'modern';
|
|
9
|
+
export type AuthMessageSectionProps = {
|
|
10
|
+
titleLines?: string[];
|
|
11
|
+
description?: string;
|
|
12
|
+
footerText?: string;
|
|
13
|
+
avatarUrls?: string[];
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/auth/ui/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEjD,MAAM,MAAM,sBAAsB,GAAG;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,aAAa,CAAC,sBAAsB,CAAC,CAAC;AAEtE,MAAM,MAAM,qBAAqB,GAAG,OAAO,GAAG,YAAY,GAAG,QAAQ,CAAC;AAEtE,MAAM,MAAM,uBAAuB,GAAG;IACpC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { JBApiHostConfig, JBAppConfig, JBAppConfigOverrides, JBAppStage, JBAuthProfileRoleOption, JBAuthSocialConfig, JBStageValueMap } from './types';
|
|
2
|
+
export declare const createJBWebConfig: (baseConfig?: JBAppConfigOverrides, overrides?: JBAppConfigOverrides) => JBAppConfig;
|
|
3
|
+
export declare const resolveApiHostByStage: (hostConfig: JBApiHostConfig, stage: JBAppStage) => string;
|
|
4
|
+
export declare const getStageValue: <T>(stageMap: JBStageValueMap<T> | undefined, stage: JBAppStage, fallback?: T) => T | undefined;
|
|
5
|
+
export declare const getApiBaseUrl: (config: JBAppConfig) => string;
|
|
6
|
+
export declare const getConfigStageValue: <T>(config: Pick<JBAppConfig, "stage">, stageMap: JBStageValueMap<T> | undefined, fallback?: T) => T | undefined;
|
|
7
|
+
export declare const createJBWebConfigFromEnv: (baseConfig?: JBAppConfigOverrides, env?: Record<string, string | undefined>) => JBAppConfig;
|
|
8
|
+
export declare const getAuthBasePath: (config: JBAppConfig) => string;
|
|
9
|
+
export declare const getAuthProfileRoles: (config: JBAppConfig) => JBAuthProfileRoleOption[];
|
|
10
|
+
export declare const getAuthSignupProfileRoles: (config: JBAppConfig) => JBAuthProfileRoleOption[];
|
|
11
|
+
export declare const getAuthDefaultProfileRole: (config: JBAppConfig) => string | undefined;
|
|
12
|
+
export declare const getAuthSocialConfig: (config: JBAppConfig) => JBAuthSocialConfig;
|
|
13
|
+
//# sourceMappingURL=createConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createConfig.d.ts","sourceRoot":"","sources":["../../src/config/createConfig.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,eAAe,EACf,WAAW,EACX,oBAAoB,EACpB,UAAU,EAEV,uBAAuB,EACvB,kBAAkB,EAElB,eAAe,EAChB,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,iBAAiB,GAC5B,aAAa,oBAAoB,EACjC,YAAY,oBAAoB,KAC/B,WA6BF,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,YAAY,eAAe,EAAE,OAAO,UAAU,KAAG,MAEtF,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,CAAC,EAC7B,UAAU,eAAe,CAAC,CAAC,CAAC,GAAG,SAAS,EACxC,OAAO,UAAU,EACjB,WAAW,CAAC,KACX,CAAC,GAAG,SAQN,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,QAAQ,WAAW,KAAG,MAEnD,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,CAAC,EACnC,QAAQ,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,EAClC,UAAU,eAAe,CAAC,CAAC,CAAC,GAAG,SAAS,EACxC,WAAW,CAAC,KACX,CAAC,GAAG,SAEN,CAAC;AAEF,eAAO,MAAM,wBAAwB,GACnC,aAAa,oBAAoB,EACjC,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,KACvC,WAgDF,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,QAAQ,WAAW,KAAG,MAErD,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,QAAQ,WAAW,KAAG,uBAAuB,EAEhF,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAI,QAAQ,WAAW,KAAG,uBAAuB,EAEtF,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAI,QAAQ,WAAW,KAAG,MAAM,GAAG,SAExE,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,QAAQ,WAAW,KAAG,kBAEzD,CAAC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { defaultJBAppConfig } from './defaults';
|
|
2
|
+
import { deepMerge } from './merge';
|
|
3
|
+
export const createJBWebConfig = (baseConfig, overrides) => {
|
|
4
|
+
const withBase = deepMerge(defaultJBAppConfig, baseConfig);
|
|
5
|
+
const resolvedConfig = deepMerge(withBase, overrides);
|
|
6
|
+
const signupRoles = (resolvedConfig.auth?.profileRoles ?? []).filter((role) => role.allowSignup === true);
|
|
7
|
+
const defaultProfileRole = resolvedConfig.auth?.defaultProfileRole;
|
|
8
|
+
if (defaultProfileRole) {
|
|
9
|
+
const hasValidDefaultSignupRole = signupRoles.some((role) => role.value === defaultProfileRole);
|
|
10
|
+
if (!hasValidDefaultSignupRole) {
|
|
11
|
+
throw new Error(`[jb-web-config] auth.defaultProfileRole="${defaultProfileRole}" must exist in auth.profileRoles with allowSignup=true.`);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
const socialConfig = resolvedConfig.auth?.social;
|
|
15
|
+
if (socialConfig) {
|
|
16
|
+
Object.keys(socialConfig).forEach((providerName) => {
|
|
17
|
+
const providerConfig = socialConfig[providerName];
|
|
18
|
+
if (providerConfig?.enabled && !providerConfig.clientId?.trim()) {
|
|
19
|
+
throw new Error(`[jb-web-config] auth.social.${providerName}.clientId is required when auth.social.${providerName}.enabled=true.`);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return resolvedConfig;
|
|
24
|
+
};
|
|
25
|
+
export const resolveApiHostByStage = (hostConfig, stage) => {
|
|
26
|
+
return hostConfig[stage];
|
|
27
|
+
};
|
|
28
|
+
export const getStageValue = (stageMap, stage, fallback) => {
|
|
29
|
+
if (!stageMap) {
|
|
30
|
+
return fallback;
|
|
31
|
+
}
|
|
32
|
+
const lowerStage = stage.toLowerCase();
|
|
33
|
+
const value = stageMap[stage] ?? stageMap[lowerStage];
|
|
34
|
+
return value ?? fallback;
|
|
35
|
+
};
|
|
36
|
+
export const getApiBaseUrl = (config) => {
|
|
37
|
+
return resolveApiHostByStage(config.api.host, config.stage);
|
|
38
|
+
};
|
|
39
|
+
export const getConfigStageValue = (config, stageMap, fallback) => {
|
|
40
|
+
return getStageValue(stageMap, config.stage, fallback);
|
|
41
|
+
};
|
|
42
|
+
export const createJBWebConfigFromEnv = (baseConfig, env) => {
|
|
43
|
+
const runtimeEnv = env ?? {};
|
|
44
|
+
const parseBooleanEnv = (value) => {
|
|
45
|
+
if (typeof value === 'undefined') {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
if (value === 'true') {
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
if (value === 'false') {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
return undefined;
|
|
55
|
+
};
|
|
56
|
+
const googleEnabled = parseBooleanEnv(runtimeEnv.VITE_AUTH_SOCIAL_GOOGLE_ENABLED);
|
|
57
|
+
const facebookEnabled = parseBooleanEnv(runtimeEnv.VITE_AUTH_SOCIAL_FACEBOOK_ENABLED);
|
|
58
|
+
const appleEnabled = parseBooleanEnv(runtimeEnv.VITE_AUTH_SOCIAL_APPLE_ENABLED);
|
|
59
|
+
return createJBWebConfig(baseConfig, {
|
|
60
|
+
debug: runtimeEnv.VITE_DEBUG === 'true' ? true : undefined,
|
|
61
|
+
stage: runtimeEnv.VITE_STAGE,
|
|
62
|
+
integrations: {
|
|
63
|
+
mapboxToken: runtimeEnv.VITE_MAPBOX_TOKEN
|
|
64
|
+
},
|
|
65
|
+
auth: {
|
|
66
|
+
apiBasePath: runtimeEnv.VITE_AUTH_BASE_PATH,
|
|
67
|
+
social: {
|
|
68
|
+
google: {
|
|
69
|
+
...(typeof googleEnabled === 'boolean' ? { enabled: googleEnabled } : {}),
|
|
70
|
+
clientId: runtimeEnv.VITE_AUTH_SOCIAL_GOOGLE_CLIENT_ID,
|
|
71
|
+
redirectUri: runtimeEnv.VITE_AUTH_SOCIAL_GOOGLE_REDIRECT_URI,
|
|
72
|
+
scope: runtimeEnv.VITE_AUTH_SOCIAL_GOOGLE_SCOPE
|
|
73
|
+
},
|
|
74
|
+
facebook: {
|
|
75
|
+
...(typeof facebookEnabled === 'boolean' ? { enabled: facebookEnabled } : {}),
|
|
76
|
+
clientId: runtimeEnv.VITE_AUTH_SOCIAL_FACEBOOK_CLIENT_ID,
|
|
77
|
+
redirectUri: runtimeEnv.VITE_AUTH_SOCIAL_FACEBOOK_REDIRECT_URI,
|
|
78
|
+
scope: runtimeEnv.VITE_AUTH_SOCIAL_FACEBOOK_SCOPE
|
|
79
|
+
},
|
|
80
|
+
apple: {
|
|
81
|
+
...(typeof appleEnabled === 'boolean' ? { enabled: appleEnabled } : {}),
|
|
82
|
+
clientId: runtimeEnv.VITE_AUTH_SOCIAL_APPLE_CLIENT_ID,
|
|
83
|
+
redirectUri: runtimeEnv.VITE_AUTH_SOCIAL_APPLE_REDIRECT_URI,
|
|
84
|
+
scope: runtimeEnv.VITE_AUTH_SOCIAL_APPLE_SCOPE
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
export const getAuthBasePath = (config) => {
|
|
91
|
+
return config.auth?.apiBasePath || '/authentication';
|
|
92
|
+
};
|
|
93
|
+
export const getAuthProfileRoles = (config) => {
|
|
94
|
+
return config.auth?.profileRoles ?? [];
|
|
95
|
+
};
|
|
96
|
+
export const getAuthSignupProfileRoles = (config) => {
|
|
97
|
+
return getAuthProfileRoles(config).filter((role) => role.allowSignup);
|
|
98
|
+
};
|
|
99
|
+
export const getAuthDefaultProfileRole = (config) => {
|
|
100
|
+
return config.auth?.defaultProfileRole;
|
|
101
|
+
};
|
|
102
|
+
export const getAuthSocialConfig = (config) => {
|
|
103
|
+
return config.auth?.social ?? defaultJBAppConfig.auth.social;
|
|
104
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/config/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,eAAO,MAAM,kBAAkB,EAAE,WAsChC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export const defaultJBAppConfig = {
|
|
2
|
+
debug: false,
|
|
3
|
+
forceHideStage: false,
|
|
4
|
+
stage: 'DEVELOPMENT',
|
|
5
|
+
defaultRows: 10,
|
|
6
|
+
maxRows: 999999999,
|
|
7
|
+
momentLocale: 'es-mx',
|
|
8
|
+
defaultLocaleDate: 'es',
|
|
9
|
+
dateFormat: 'YYYY-MM-DD',
|
|
10
|
+
dateTimeFormat: 'dddd DD MMM YYYY HH:mm:ss',
|
|
11
|
+
defaultFormatDateAPI: 'YYYY-MM-DD',
|
|
12
|
+
api: {
|
|
13
|
+
version: 'v1',
|
|
14
|
+
host: {
|
|
15
|
+
PRODUCTION: 'https://api.example.com',
|
|
16
|
+
QA: 'https://api-qa.example.com',
|
|
17
|
+
DEVELOPMENT: 'http://127.0.0.1:8000',
|
|
18
|
+
LOCAL: 'http://localhost:8000'
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
auth: {
|
|
22
|
+
apiBasePath: '/authentication',
|
|
23
|
+
profileRoles: [],
|
|
24
|
+
defaultProfileRole: undefined,
|
|
25
|
+
social: {
|
|
26
|
+
google: {
|
|
27
|
+
enabled: false
|
|
28
|
+
},
|
|
29
|
+
facebook: {
|
|
30
|
+
enabled: false
|
|
31
|
+
},
|
|
32
|
+
apple: {
|
|
33
|
+
enabled: false
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
integrations: {}
|
|
38
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../src/config/merge.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,EAAE,YAAY,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAG,CAqB3G,CAAC"}
|