@joelbarron/react-web-dev-kit 0.1.3 → 0.1.4

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 (56) hide show
  1. package/dist/auth/client.d.ts +2 -1
  2. package/dist/auth/client.d.ts.map +1 -1
  3. package/dist/auth/client.js +14 -1
  4. package/dist/auth/forms/account/AuthAccountConfirmationForm.d.ts.map +1 -1
  5. package/dist/auth/forms/account/AuthAccountConfirmationForm.js +3 -2
  6. package/dist/auth/forms/password/AuthForgotPasswordForm.d.ts +4 -0
  7. package/dist/auth/forms/password/AuthForgotPasswordForm.d.ts.map +1 -1
  8. package/dist/auth/forms/password/AuthForgotPasswordForm.js +43 -5
  9. package/dist/auth/forms/password/AuthPasswordResetConfirmForm.d.ts +2 -0
  10. package/dist/auth/forms/password/AuthPasswordResetConfirmForm.d.ts.map +1 -1
  11. package/dist/auth/forms/password/AuthPasswordResetConfirmForm.js +84 -9
  12. package/dist/auth/forms/password/AuthResetPasswordForm.d.ts.map +1 -1
  13. package/dist/auth/forms/password/AuthResetPasswordForm.js +5 -1
  14. package/dist/auth/forms/password/passwordValidation.d.ts +3 -0
  15. package/dist/auth/forms/password/passwordValidation.d.ts.map +1 -0
  16. package/dist/auth/forms/password/passwordValidation.js +45 -0
  17. package/dist/auth/forms/sign-in/AuthOtpSignInForm.d.ts.map +1 -1
  18. package/dist/auth/forms/sign-in/AuthOtpSignInForm.js +2 -1
  19. package/dist/auth/forms/sign-in/AuthPasswordSignInForm.d.ts +1 -0
  20. package/dist/auth/forms/sign-in/AuthPasswordSignInForm.d.ts.map +1 -1
  21. package/dist/auth/forms/sign-in/AuthPasswordSignInForm.js +36 -8
  22. package/dist/auth/forms/sign-up/AuthSignUpForm.d.ts +1 -0
  23. package/dist/auth/forms/sign-up/AuthSignUpForm.d.ts.map +1 -1
  24. package/dist/auth/forms/sign-up/AuthSignUpForm.js +33 -7
  25. package/dist/auth/fuse/createFuseAuthViews.d.ts.map +1 -1
  26. package/dist/auth/fuse/createFuseAuthViews.js +121 -60
  27. package/dist/auth/fuse/fuseAdapter.d.ts +2 -1
  28. package/dist/auth/fuse/fuseAdapter.d.ts.map +1 -1
  29. package/dist/auth/fuse/fuseAdapter.js +6 -0
  30. package/dist/auth/social/providerAuth.d.ts +9 -1
  31. package/dist/auth/social/providerAuth.d.ts.map +1 -1
  32. package/dist/auth/social/providerAuth.js +19 -1
  33. package/dist/auth/types.d.ts +18 -0
  34. package/dist/auth/types.d.ts.map +1 -1
  35. package/dist/auth/ui/AuthPageTitle.d.ts +7 -0
  36. package/dist/auth/ui/AuthPageTitle.d.ts.map +1 -0
  37. package/dist/auth/ui/AuthPageTitle.js +7 -0
  38. package/dist/auth/ui/AuthPrimaryButton.js +3 -3
  39. package/dist/auth/ui/AuthRoutePageWrapper.d.ts.map +1 -1
  40. package/dist/auth/ui/AuthRoutePageWrapper.js +17 -12
  41. package/dist/auth/ui/AuthSocialProviderButton.d.ts +1 -1
  42. package/dist/auth/ui/AuthSocialProviderButton.d.ts.map +1 -1
  43. package/dist/auth/ui/AuthSocialProviderButton.js +5 -2
  44. package/dist/auth/ui/SignInPageTitle.js +1 -1
  45. package/dist/auth/ui/index.d.ts +1 -3
  46. package/dist/auth/ui/index.d.ts.map +1 -1
  47. package/dist/auth/ui/index.js +1 -3
  48. package/dist/forms/JBDatePickerField.d.ts.map +1 -1
  49. package/dist/forms/JBDatePickerField.js +4 -2
  50. package/dist/forms/JBSelectField.d.ts.map +1 -1
  51. package/dist/forms/JBSelectField.js +2 -2
  52. package/dist/forms/JBTextField.d.ts.map +1 -1
  53. package/dist/forms/JBTextField.js +2 -2
  54. package/dist/forms/JBTimePickerField.d.ts.map +1 -1
  55. package/dist/forms/JBTimePickerField.js +4 -2
  56. package/package.json +1 -1
@@ -22,6 +22,7 @@ export type AuthSignUpFormValues = z.infer<typeof signUpSchema>;
22
22
  export type AuthSignUpFormProps = {
23
23
  defaultValues?: Partial<AuthSignUpFormValues>;
24
24
  loading?: boolean;
25
+ disabled?: boolean;
25
26
  submitLabel?: string;
26
27
  fieldsScrollable?: boolean;
27
28
  formMaxHeight?: string | number;
@@ -1 +1 @@
1
- {"version":3,"file":"AuthSignUpForm.d.ts","sourceRoot":"","sources":["../../../../src/auth/forms/sign-up/AuthSignUpForm.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAA+C,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE3F,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAI9C,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;iBAmBd,CAAC;AAEL,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAEhE,MAAM,MAAM,mBAAmB,GAAG;IAChC,aAAa,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAC9C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAChC,WAAW,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,GAAG;QAAE,WAAW,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IACtE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACnE,CAAC;AAeF,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,2CAiRxD"}
1
+ {"version":3,"file":"AuthSignUpForm.d.ts","sourceRoot":"","sources":["../../../../src/auth/forms/sign-up/AuthSignUpForm.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAA+C,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE3F,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAK9C,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;iBAkCd,CAAC;AAEL,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAEhE,MAAM,MAAM,mBAAmB,GAAG;IAChC,aAAa,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAC9C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAChC,WAAW,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,GAAG;QAAE,WAAW,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IACtE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACnE,CAAC;AAeF,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,2CAuTxD"}
@@ -1,14 +1,20 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { zodResolver } from '@hookform/resolvers/zod';
3
+ import PersonAddAlt1OutlinedIcon from '@mui/icons-material/PersonAddAlt1Outlined';
4
+ import VisibilityOffOutlinedIcon from '@mui/icons-material/VisibilityOffOutlined';
5
+ import VisibilityOutlinedIcon from '@mui/icons-material/VisibilityOutlined';
3
6
  import Alert from '@mui/material/Alert';
4
7
  import Box from '@mui/material/Box';
8
+ import IconButton from '@mui/material/IconButton';
9
+ import InputAdornment from '@mui/material/InputAdornment';
5
10
  import _ from 'lodash';
6
- import { useEffect } from 'react';
11
+ import { useEffect, useState } from 'react';
7
12
  import { useForm, useWatch } from 'react-hook-form';
8
13
  import { z } from 'zod';
9
14
  import { JBCheckboxField, JBSelectField, JBTextField } from '../../../forms';
10
15
  import { DEFAULT_GENDER, GENDERS, GENDER_SELECT_OPTIONS } from '../../constants';
11
16
  import { AuthPrimaryButton } from '../../ui';
17
+ import { getDjangoLikePasswordError, isPasswordTooSimilar } from '../password/passwordValidation';
12
18
  import { parseAuthError } from '../errorParser';
13
19
  const signUpSchema = z
14
20
  .object({
@@ -19,16 +25,30 @@ const signUpSchema = z
19
25
  birthday: z.string().optional(),
20
26
  gender: z.enum(GENDERS).optional(),
21
27
  role: z.string().optional(),
22
- password: z
23
- .string()
24
- .nonempty('Debes ingresar la contraseña.')
25
- .min(8, 'La contraseña es muy corta - mínimo 8 caracteres.'),
28
+ password: z.string().nonempty('Debes ingresar la contraseña.'),
26
29
  passwordConfirm: z.string().nonempty('La confirmación de contraseña es obligatoria'),
27
30
  acceptTermsConditions: z.boolean().refine((val) => val === true, 'Debes aceptar los términos y condiciones.')
28
31
  })
29
32
  .refine((data) => data.password === data.passwordConfirm, {
30
33
  message: 'Las contraseñas deben coincidir',
31
34
  path: ['passwordConfirm']
35
+ })
36
+ .superRefine((data, ctx) => {
37
+ const passwordError = getDjangoLikePasswordError(data.password);
38
+ if (passwordError) {
39
+ ctx.addIssue({
40
+ code: z.ZodIssueCode.custom,
41
+ message: passwordError,
42
+ path: ['password']
43
+ });
44
+ }
45
+ if (isPasswordTooSimilar(data.password, [data.email, data.firstName, data.lastName1, data.lastName2])) {
46
+ ctx.addIssue({
47
+ code: z.ZodIssueCode.custom,
48
+ message: 'La contraseña es demasiado similar a tus datos personales.',
49
+ path: ['password']
50
+ });
51
+ }
32
52
  });
33
53
  const defaultValues = {
34
54
  firstName: '',
@@ -43,7 +63,7 @@ const defaultValues = {
43
63
  acceptTermsConditions: false
44
64
  };
45
65
  export function AuthSignUpForm(props) {
46
- const { defaultValues: valuesFromProps, loading = false, submitLabel = 'Crear cuenta', fieldsScrollable = false, formMaxHeight = 'min(72dvh, 620px)', roleOptions, defaultRole, onSubmit } = props;
66
+ const { defaultValues: valuesFromProps, loading = false, disabled = false, submitLabel = 'Crear cuenta', fieldsScrollable = false, formMaxHeight = 'min(72dvh, 620px)', roleOptions, defaultRole, onSubmit } = props;
47
67
  const signupRoleOptions = (roleOptions ?? []).filter((roleOption) => roleOption.allowSignup !== false);
48
68
  const resolvedDefaultRole = valuesFromProps?.role ??
49
69
  defaultRole ??
@@ -62,6 +82,8 @@ export function AuthSignUpForm(props) {
62
82
  const isLoading = loading || isSubmitting;
63
83
  const passwordValue = useWatch({ control, name: 'password' });
64
84
  const passwordConfirmValue = useWatch({ control, name: 'passwordConfirm' });
85
+ const [showPassword, setShowPassword] = useState(false);
86
+ const [showPasswordConfirm, setShowPasswordConfirm] = useState(false);
65
87
  useEffect(() => {
66
88
  if (!passwordConfirmValue) {
67
89
  return;
@@ -160,5 +182,9 @@ export function AuthSignUpForm(props) {
160
182
  pb: 1
161
183
  }
162
184
  : null)
163
- }, children: [_jsx(JBTextField, { control: control, name: "firstName", sx: { mb: 3 }, label: "Nombre(s)", autoFocus: true, type: "text", variant: "outlined", required: true, fullWidth: true }), _jsx(JBTextField, { control: control, name: "lastName1", sx: { mb: 3 }, label: "Primer apellido", type: "text", variant: "outlined", required: true, fullWidth: true }), _jsx(JBTextField, { control: control, name: "lastName2", sx: { mb: 3 }, label: "Segundo apellido", type: "text", variant: "outlined", fullWidth: true }), _jsx(JBTextField, { control: control, name: "email", sx: { mb: 3 }, label: "Correo electr\u00F3nico", type: "email", variant: "outlined", required: true, fullWidth: true }), _jsx(JBTextField, { control: control, name: "birthday", sx: { mb: 3 }, label: "Fecha de nacimiento", type: "date", InputLabelProps: { shrink: true }, variant: "outlined", fullWidth: true }), _jsx(JBSelectField, { control: control, name: "gender", sx: { mb: 3 }, label: "G\u00E9nero", variant: "outlined", fullWidth: true, options: GENDER_SELECT_OPTIONS }), signupRoleOptions.length > 0 ? (_jsx(JBSelectField, { control: control, name: "role", sx: { mb: 3 }, label: "Rol de perfil", variant: "outlined", fullWidth: true, options: signupRoleOptions, required: true })) : null, _jsx(JBTextField, { control: control, name: "password", sx: { mb: 3 }, label: "Contrase\u00F1a", type: "password", variant: "outlined", required: true, fullWidth: true }), _jsx(JBTextField, { control: control, name: "passwordConfirm", sx: { mb: 3 }, label: "Confirmar contrase\u00F1a", type: "password", variant: "outlined", required: true, fullWidth: true }), _jsx(JBCheckboxField, { control: control, name: "acceptTermsConditions", size: "small", label: "Acepto t\u00E9rminos y pol\u00EDticas de privacidad" })] }), errors.root?.message ? (_jsx(Alert, { sx: { mt: 2 }, severity: "error", children: errors.root.message })) : null, _jsx(AuthPrimaryButton, { sx: { mt: 3 }, "aria-label": submitLabel, disabled: isLoading || _.isEmpty(dirtyFields) || !isValid, loading: isLoading, loadingLabel: "Creando cuenta...", type: "submit", size: "large", children: submitLabel })] }));
185
+ }, children: [_jsx(JBTextField, { control: control, name: "firstName", sx: { mb: 3 }, label: "Nombre(s)", autoFocus: true, type: "text", variant: "outlined", required: true, fullWidth: true, disabled: disabled }), _jsx(JBTextField, { control: control, name: "lastName1", sx: { mb: 3 }, label: "Primer apellido", type: "text", variant: "outlined", required: true, fullWidth: true, disabled: disabled }), _jsx(JBTextField, { control: control, name: "lastName2", sx: { mb: 3 }, label: "Segundo apellido", type: "text", variant: "outlined", fullWidth: true, disabled: disabled }), _jsx(JBTextField, { control: control, name: "email", sx: { mb: 3 }, label: "Correo electr\u00F3nico", type: "email", variant: "outlined", required: true, fullWidth: true, disabled: disabled }), _jsx(JBTextField, { control: control, name: "birthday", sx: { mb: 3 }, label: "Fecha de nacimiento", type: "date", InputLabelProps: { shrink: true }, variant: "outlined", fullWidth: true, disabled: disabled }), _jsx(JBSelectField, { control: control, name: "gender", sx: { mb: 3 }, label: "G\u00E9nero", variant: "outlined", fullWidth: true, options: GENDER_SELECT_OPTIONS, disabled: disabled }), signupRoleOptions.length > 0 ? (_jsx(JBSelectField, { control: control, name: "role", sx: { mb: 3 }, label: "Rol de perfil", variant: "outlined", fullWidth: true, options: signupRoleOptions, required: true, disabled: disabled })) : null, _jsx(JBTextField, { control: control, name: "password", sx: { mb: 3 }, label: "Contrase\u00F1a", type: showPassword ? 'text' : 'password', InputProps: {
186
+ endAdornment: (_jsx(InputAdornment, { position: "end", children: _jsx(IconButton, { edge: "end", "aria-label": showPassword ? 'Ocultar contraseña' : 'Mostrar contraseña', onClick: () => setShowPassword((prev) => !prev), children: showPassword ? _jsx(VisibilityOffOutlinedIcon, {}) : _jsx(VisibilityOutlinedIcon, {}) }) }))
187
+ }, variant: "outlined", required: true, fullWidth: true, disabled: disabled }), _jsx(JBTextField, { control: control, name: "passwordConfirm", sx: { mb: 3 }, label: "Confirmar contrase\u00F1a", type: showPasswordConfirm ? 'text' : 'password', InputProps: {
188
+ endAdornment: (_jsx(InputAdornment, { position: "end", children: _jsx(IconButton, { edge: "end", "aria-label": showPasswordConfirm ? 'Ocultar confirmación de contraseña' : 'Mostrar confirmación de contraseña', onClick: () => setShowPasswordConfirm((prev) => !prev), children: showPasswordConfirm ? _jsx(VisibilityOffOutlinedIcon, {}) : _jsx(VisibilityOutlinedIcon, {}) }) }))
189
+ }, variant: "outlined", required: true, fullWidth: true, disabled: disabled }), _jsx(JBCheckboxField, { control: control, name: "acceptTermsConditions", size: "small", label: "Acepto t\u00E9rminos y pol\u00EDticas de privacidad", disabled: disabled })] }), errors.root?.message ? (_jsx(Alert, { sx: { mt: 2 }, severity: "error", children: errors.root.message })) : null, _jsx(AuthPrimaryButton, { sx: { mt: 3 }, "aria-label": submitLabel, disabled: disabled || isLoading || _.isEmpty(dirtyFields) || !isValid, loading: isLoading, loadingLabel: "Creando cuenta...", startIcon: _jsx(PersonAddAlt1OutlinedIcon, { fontSize: "small" }), type: "submit", size: "large", children: submitLabel })] }));
164
190
  }
@@ -1 +1 @@
1
- {"version":3,"file":"createFuseAuthViews.d.ts","sourceRoot":"","sources":["../../../src/auth/fuse/createFuseAuthViews.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAG3E,OAAO,EACL,iBAAiB,EAOlB,MAAM,OAAO,CAAC;AAsbf,KAAK,0BAA0B,GAAG;IAChC,aAAa,EAAE,iBAAiB,CAAC;IACjC,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,iBAAiB,CAAC,EAAE,uBAAuB,EAAE,CAAC;IAC9C,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAClC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE;QACzB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACnC,KAAK,IAAI,CAAC;CACZ,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,0BAA0B;;;;;;;EAyatE"}
1
+ {"version":3,"file":"createFuseAuthViews.d.ts","sourceRoot":"","sources":["../../../src/auth/fuse/createFuseAuthViews.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAY3E,OAAO,EACL,iBAAiB,EAKlB,MAAM,OAAO,CAAC;AA4hBf,KAAK,0BAA0B,GAAG;IAChC,aAAa,EAAE,iBAAiB,CAAC;IACjC,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,iBAAiB,CAAC,EAAE,uBAAuB,EAAE,CAAC;IAC9C,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAClC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE;QACzB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACnC,KAAK,IAAI,CAAC;CACZ,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,0BAA0B;;;;;;;EAuYtE"}
@@ -1,15 +1,17 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import Box from "@mui/material/Box";
2
+ import ArrowBackOutlinedIcon from '@mui/icons-material/ArrowBackOutlined';
3
+ import EmailOutlinedIcon from '@mui/icons-material/EmailOutlined';
4
+ import PersonAddAlt1OutlinedIcon from '@mui/icons-material/PersonAddAlt1Outlined';
3
5
  import Alert from "@mui/material/Alert";
6
+ import Box from "@mui/material/Box";
4
7
  import Typography from "@mui/material/Typography";
5
- import PhoneIphoneIcon from "@mui/icons-material/PhoneIphone";
6
8
  import { useCallback, useMemo, useRef, useState } from "react";
7
9
  import { useNavigate, useSearchParams } from "react-router";
8
10
  import { AuthAccountConfirmationForm, AuthForgotPasswordForm, AuthOtpSignInForm, AuthPasswordResetConfirmForm, AuthPasswordSignInForm, AuthSignUpForm, } from "../forms";
11
+ import { parseAuthError } from "../forms/errorParser";
9
12
  import { authenticateWithSocialProvider } from "../social/providerAuth";
13
+ import { AuthPageTitle, AuthRoleSelectionDialog, AuthSecondaryButton, AuthSocialProviderButton, } from "../ui";
10
14
  import { useFuseJwtAuth } from "./fuseAdapter";
11
- import { AuthRoleSelectionDialog, AuthSocialProviderButton, AuthSecondaryButton, SignInPageTitle, SignOutPageTitle, SignUpPageTitle, } from "../ui";
12
- import { parseAuthError } from "../forms/errorParser";
13
15
  const IS_DEV = typeof window !== "undefined" && window.location.hostname === "localhost";
14
16
  const DEV_LOGIN_DEFAULT_VALUES = IS_DEV
15
17
  ? {
@@ -39,6 +41,55 @@ const DEV_OTP_DEFAULT_VALUES = IS_DEV
39
41
  }
40
42
  : undefined;
41
43
  const SOCIAL_PROVIDER_ORDER = ["google", "facebook", "apple"];
44
+ const parseBooleanLike = (value) => {
45
+ if (typeof value === "boolean") {
46
+ return value;
47
+ }
48
+ if (typeof value === "string") {
49
+ const normalized = value.trim().toLowerCase();
50
+ if (normalized === "true") {
51
+ return true;
52
+ }
53
+ if (normalized === "false") {
54
+ return false;
55
+ }
56
+ }
57
+ if (typeof value === "number") {
58
+ if (value === 1) {
59
+ return true;
60
+ }
61
+ if (value === 0) {
62
+ return false;
63
+ }
64
+ }
65
+ return undefined;
66
+ };
67
+ const shouldSelectRoleForSocialLogin = (precheckResponse, hasRoleOptions) => {
68
+ if (!hasRoleOptions) {
69
+ return false;
70
+ }
71
+ const userExists = parseBooleanLike(precheckResponse.userExists) ??
72
+ parseBooleanLike(precheckResponse.user_exists);
73
+ if (typeof userExists === "boolean") {
74
+ return !userExists;
75
+ }
76
+ const wouldCreateUser = parseBooleanLike(precheckResponse.wouldCreateUser) ??
77
+ parseBooleanLike(precheckResponse.would_create_user);
78
+ if (typeof wouldCreateUser === "boolean") {
79
+ return wouldCreateUser;
80
+ }
81
+ const socialAccountExists = parseBooleanLike(precheckResponse.socialAccountExists) ??
82
+ parseBooleanLike(precheckResponse.social_account_exists);
83
+ if (socialAccountExists === true) {
84
+ return false;
85
+ }
86
+ const linkedExistingUser = parseBooleanLike(precheckResponse.linkedExistingUser) ??
87
+ parseBooleanLike(precheckResponse.linked_existing_user);
88
+ if (linkedExistingUser === true) {
89
+ return false;
90
+ }
91
+ return hasRoleOptions;
92
+ };
42
93
  function getEnabledSocialProviders(socialConfig, showDebugSocial) {
43
94
  if (!socialConfig) {
44
95
  return [];
@@ -66,7 +117,7 @@ function getEnabledSocialProviders(socialConfig, showDebugSocial) {
66
117
  });
67
118
  }
68
119
  function FuseSignInController(props) {
69
- const { LinkComponent, mode = "password", onBackToPassword, requestRoleSelection } = props;
120
+ const { LinkComponent, mode = "password", disabled = false, onBackToPassword, requestRoleSelection } = props;
70
121
  const { signIn, requestOtp, signInOtp } = useFuseJwtAuth();
71
122
  if (mode === "otp") {
72
123
  return (_jsx(AuthOtpSignInForm, { defaultValues: DEV_OTP_DEFAULT_VALUES, requestRoleSelection: requestRoleSelection, onBackToPassword: onBackToPassword, onRequestOtp: ({ phone }) => requestOtp({
@@ -79,15 +130,15 @@ function FuseSignInController(props) {
79
130
  role,
80
131
  }) }));
81
132
  }
82
- return (_jsx(AuthPasswordSignInForm, { defaultValues: DEV_LOGIN_DEFAULT_VALUES, LinkComponent: LinkComponent, onSubmit: (values) => signIn({
133
+ return (_jsx(AuthPasswordSignInForm, { defaultValues: DEV_LOGIN_DEFAULT_VALUES, disabled: disabled, LinkComponent: LinkComponent, onSubmit: (values) => signIn({
83
134
  login: values.login,
84
135
  password: values.password,
85
136
  }) }));
86
137
  }
87
138
  function FuseSignUpController(props) {
88
- const { onSuccess, requestRoleSelection, requiresRoleSelection = false } = props;
139
+ const { onSuccess, requestRoleSelection, requiresRoleSelection = false, disabled = false } = props;
89
140
  const { signUp } = useFuseJwtAuth();
90
- return (_jsx(AuthSignUpForm, { defaultValues: DEV_SIGN_UP_DEFAULT_VALUES, onSubmit: async (values) => {
141
+ return (_jsx(AuthSignUpForm, { defaultValues: DEV_SIGN_UP_DEFAULT_VALUES, disabled: disabled, onSubmit: async (values) => {
91
142
  const selectedRole = requestRoleSelection
92
143
  ? await requestRoleSelection()
93
144
  : values.role;
@@ -120,32 +171,42 @@ function FuseOtpSignUpForm(props) {
120
171
  }
121
172
  function FuseAuthAlternativesSection(props) {
122
173
  const { onSmsClick, socialProviders = [], onSocialClick, socialLoadingProvider, socialError } = props;
123
- return (_jsxs(_Fragment, { children: [_jsxs(Box, { sx: { mt: 4, display: "flex", alignItems: "center" }, children: [_jsx(Box, { sx: { mt: "1px", flex: 1, borderTop: 1, borderColor: "divider" } }), _jsx(Typography, { sx: { mx: 1 }, color: "text.secondary", children: "O contin\u00FAa con" }), _jsx(Box, { sx: { mt: "1px", flex: 1, borderTop: 1, borderColor: "divider" } })] }), _jsxs(Box, { sx: {
174
+ return (_jsxs(_Fragment, { children: [_jsxs(Box, { sx: { mt: 4, display: "flex", alignItems: "center" }, children: [_jsx(Box, { sx: { mt: "1px", flex: 1, borderTop: 1, borderColor: "divider" } }), _jsx(Typography, { sx: { mx: 1 }, color: "text.secondary", children: "O accede con" }), _jsx(Box, { sx: { mt: "1px", flex: 1, borderTop: 1, borderColor: "divider" } })] }), _jsxs(Box, { sx: {
124
175
  mt: 4,
125
176
  display: "grid",
126
177
  gridTemplateColumns: "repeat(2, minmax(0, 1fr))",
127
178
  gap: 1.5
128
- }, children: [socialProviders.map((socialProvider) => (_jsx(AuthSocialProviderButton, { provider: socialProvider.provider, loading: socialLoadingProvider === socialProvider.provider, disabled: Boolean(socialLoadingProvider && socialLoadingProvider !== socialProvider.provider), onClick: () => onSocialClick?.(socialProvider.provider) }, socialProvider.provider))), _jsx(AuthSecondaryButton, { sx: { minWidth: 0 }, "aria-label": "SMS", onClick: onSmsClick, startIcon: _jsx(PhoneIphoneIcon, { fontSize: "small" }), children: "SMS" })] }), socialError ? (_jsx(Alert, { severity: "error", sx: { mt: 2 }, children: socialError })) : null] }));
179
+ }, children: [socialProviders.map((socialProvider) => (_jsx(AuthSocialProviderButton, { provider: socialProvider.provider, loading: socialLoadingProvider === socialProvider.provider, disabled: Boolean(socialLoadingProvider && socialLoadingProvider !== socialProvider.provider), onClick: () => onSocialClick?.(socialProvider.provider) }, socialProvider.provider))), _jsx(AuthSocialProviderButton, { "aria-label": "SMS", provider: "sms", disabled: Boolean(socialLoadingProvider), onClick: onSmsClick, children: "SMS" })] }), socialError ? (_jsx(Alert, { severity: "error", sx: { mt: 2 }, children: socialError })) : null] }));
129
180
  }
130
181
  function FuseSignUpCtaSection(props) {
131
- const { LinkComponent, signUpPath = "/sign-up" } = props;
132
- return (_jsxs(_Fragment, { children: [_jsxs(Box, { sx: { mt: 6, display: "flex", alignItems: "center" }, children: [_jsx(Box, { sx: { mt: "1px", flex: 1, borderTop: 1, borderColor: "divider" } }), _jsx(Typography, { sx: { mx: 1 }, color: "text.secondary", children: "\u00BFNo tienes una cuenta?" }), _jsx(Box, { sx: { mt: "1px", flex: 1, borderTop: 1, borderColor: "divider" } })] }), _jsx(Box, { sx: { mt: 2, display: "flex", alignItems: "center", gap: 2 }, children: _jsx(AuthSecondaryButton, { component: LinkComponent, to: signUpPath, sx: { flex: 1 }, "aria-label": "Crear cuenta", children: "Crear cuenta" }) })] }));
182
+ const { LinkComponent, signUpPath = "/sign-up", disabled = false } = props;
183
+ return (_jsxs(_Fragment, { children: [_jsxs(Box, { sx: { mt: 6, display: "flex", alignItems: "center" }, children: [_jsx(Box, { sx: { mt: "1px", flex: 1, borderTop: 1, borderColor: "divider" } }), _jsx(Typography, { sx: { mx: 1 }, color: "text.secondary", children: "\u00BFNo tienes una cuenta?" }), _jsx(Box, { sx: { mt: "1px", flex: 1, borderTop: 1, borderColor: "divider" } })] }), _jsx(Box, { sx: { mt: 2, display: "flex", alignItems: "center", gap: 2 }, children: _jsx(AuthSecondaryButton, { component: LinkComponent, to: signUpPath, sx: { flex: 1 }, disabled: disabled, startIcon: _jsx(PersonAddAlt1OutlinedIcon, { fontSize: "small" }), onClick: (event) => {
184
+ if (disabled) {
185
+ event.preventDefault();
186
+ }
187
+ }, "aria-label": "Crear cuenta", children: "Crear cuenta" }) })] }));
133
188
  }
134
189
  function FuseSignInCtaSection(props) {
135
- const { LinkComponent, signInPath = "/sign-in" } = props;
136
- return (_jsxs(_Fragment, { children: [_jsxs(Box, { sx: { mt: 6, display: "flex", alignItems: "center" }, children: [_jsx(Box, { sx: { mt: "1px", flex: 1, borderTop: 1, borderColor: "divider" } }), _jsx(Typography, { sx: { mx: 1 }, color: "text.secondary", children: "\u00BFYa tienes una cuenta?" }), _jsx(Box, { sx: { mt: "1px", flex: 1, borderTop: 1, borderColor: "divider" } })] }), _jsx(Box, { sx: { mt: 2, display: "flex", alignItems: "center", gap: 2 }, children: _jsx(AuthSecondaryButton, { component: LinkComponent, to: signInPath, sx: { flex: 1 }, "aria-label": "Iniciar sesi\u00F3n", children: "Iniciar sesi\u00F3n" }) })] }));
190
+ const { LinkComponent, signInPath = "/sign-in", disabled = false } = props;
191
+ return (_jsxs(_Fragment, { children: [_jsxs(Box, { sx: { mt: 6, display: "flex", alignItems: "center" }, children: [_jsx(Box, { sx: { mt: "1px", flex: 1, borderTop: 1, borderColor: "divider" } }), _jsx(Typography, { sx: { mx: 1 }, color: "text.secondary", children: "\u00BFYa tienes una cuenta?" }), _jsx(Box, { sx: { mt: "1px", flex: 1, borderTop: 1, borderColor: "divider" } })] }), _jsx(Box, { sx: { mt: 2, display: "flex", alignItems: "center", gap: 2 }, children: _jsx(AuthSecondaryButton, { component: LinkComponent, to: signInPath, sx: { flex: 1 }, disabled: disabled, startIcon: _jsx(EmailOutlinedIcon, { fontSize: "small" }), onClick: (event) => {
192
+ if (disabled) {
193
+ event.preventDefault();
194
+ }
195
+ }, "aria-label": "Iniciar sesi\u00F3n", children: "Iniciar sesi\u00F3n" }) })] }));
137
196
  }
138
- function FuseForgotPasswordPageForm() {
197
+ function FuseForgotPasswordPageForm(props) {
198
+ const { LinkComponent } = props;
139
199
  const { requestPasswordReset } = useFuseJwtAuth();
140
- return (_jsx(AuthForgotPasswordForm, { onSubmit: (values) => requestPasswordReset({ email: values.email }) }));
200
+ return (_jsxs(_Fragment, { children: [_jsx(AuthForgotPasswordForm, { onSubmit: (values) => requestPasswordReset({ email: values.email }) }), _jsx(AuthSecondaryButton, { sx: { mt: 2 }, component: LinkComponent, to: "/sign-in", startIcon: _jsx(ArrowBackOutlinedIcon, { fontSize: "small" }), "aria-label": "Regresar a iniciar sesi\u00F3n", children: "Regresar a iniciar sesi\u00F3n" })] }));
141
201
  }
142
202
  function FuseResetPasswordPageForm(props) {
143
203
  const { initialUid = "", initialToken = "" } = props;
144
204
  const { confirmPasswordReset } = useFuseJwtAuth();
205
+ const navigate = useNavigate();
145
206
  return (_jsx(AuthPasswordResetConfirmForm, { defaultValues: {
146
207
  uid: initialUid,
147
208
  token: initialToken,
148
- }, onSubmit: (values) => confirmPasswordReset(values) }));
209
+ }, onGoToSignIn: () => navigate('/sign-in'), onSubmit: (values) => confirmPasswordReset(values) }));
149
210
  }
150
211
  function FuseAccountConfirmationPageForm(props) {
151
212
  const { initialUid = "", initialToken = "" } = props;
@@ -190,7 +251,7 @@ export function createFuseAuthViews(options) {
190
251
  const { LinkComponent, accountConfirmationPath = "/verify-email", signUpRoleOptions, defaultSignUpRole, socialConfig, showDebugSocial = false, onSignUpSuccess, } = options;
191
252
  function SignInPageView() {
192
253
  const [mode, setMode] = useState("password");
193
- const { signInSocial } = useFuseJwtAuth();
254
+ const { signInSocial, signInSocialPrecheck } = useFuseJwtAuth();
194
255
  const [socialLoadingProvider, setSocialLoadingProvider] = useState(null);
195
256
  const [socialError, setSocialError] = useState(null);
196
257
  const signupRoleOptions = (signUpRoleOptions ?? [])
@@ -201,6 +262,7 @@ export function createFuseAuthViews(options) {
201
262
  }));
202
263
  const { requestRoleSelection, dialog, hasRoleOptions } = useRoleSelectionDialog(signupRoleOptions, defaultSignUpRole);
203
264
  const enabledSocialProviders = useMemo(() => getEnabledSocialProviders(socialConfig, showDebugSocial), [socialConfig, showDebugSocial]);
265
+ const isAuthFlowBusy = socialLoadingProvider !== null;
204
266
  const onSocialClick = useCallback(async (provider) => {
205
267
  const providerConfig = enabledSocialProviders.find((item) => item.provider === provider);
206
268
  if (!providerConfig) {
@@ -216,8 +278,19 @@ export function createFuseAuthViews(options) {
216
278
  if (showDebugSocial) {
217
279
  console.info("[jb-auth][social] provider token payload ready", { provider, tokenPayload });
218
280
  }
219
- const selectedRole = hasRoleOptions ? await requestRoleSelection() : undefined;
220
- if (hasRoleOptions && !selectedRole) {
281
+ const baseSocialPayload = {
282
+ ...tokenPayload,
283
+ provider,
284
+ client: "web",
285
+ termsAndConditionsAccepted: true,
286
+ };
287
+ if (showDebugSocial) {
288
+ console.info("[jb-auth][social] sending social precheck", { provider, client: "web" });
289
+ }
290
+ const socialPrecheckResponse = await signInSocialPrecheck(baseSocialPayload);
291
+ const shouldSelectRole = shouldSelectRoleForSocialLogin(socialPrecheckResponse, hasRoleOptions);
292
+ const selectedRole = shouldSelectRole ? await requestRoleSelection() : undefined;
293
+ if (shouldSelectRole && !selectedRole) {
221
294
  return;
222
295
  }
223
296
  if (showDebugSocial) {
@@ -228,11 +301,8 @@ export function createFuseAuthViews(options) {
228
301
  });
229
302
  }
230
303
  await signInSocial({
231
- ...tokenPayload,
232
- provider,
304
+ ...baseSocialPayload,
233
305
  role: selectedRole,
234
- client: "web",
235
- termsAndConditionsAccepted: true,
236
306
  });
237
307
  }
238
308
  catch (error) {
@@ -240,12 +310,12 @@ export function createFuseAuthViews(options) {
240
310
  console.error("[jb-auth][social] flow failed", { provider, error });
241
311
  }
242
312
  const parsed = parseAuthError(error);
243
- setSocialError(parsed.rootMessage || "No se pudo continuar con el proveedor social.");
313
+ setSocialError(parsed.rootMessage || "No se pudo acceder con el proveedor social.");
244
314
  }
245
315
  finally {
246
316
  setSocialLoadingProvider(null);
247
317
  }
248
- }, [enabledSocialProviders, hasRoleOptions, requestRoleSelection, showDebugSocial, signInSocial]);
318
+ }, [enabledSocialProviders, hasRoleOptions, requestRoleSelection, showDebugSocial, signInSocial, signInSocialPrecheck]);
249
319
  return (_jsxs(Box, { sx: {
250
320
  mx: { xs: "auto", sm: 0 },
251
321
  width: { xs: "100%", sm: 320 },
@@ -253,11 +323,11 @@ export function createFuseAuthViews(options) {
253
323
  display: "flex",
254
324
  flexDirection: "column",
255
325
  gap: 4,
256
- }, children: [_jsx(SignInPageTitle, {}), _jsxs(Box, { sx: { width: "100%" }, children: [_jsx(FuseSignInController, { LinkComponent: LinkComponent, mode: mode, requestRoleSelection: requestRoleSelection, onBackToPassword: () => setMode("password") }), mode === "password" && (_jsxs(_Fragment, { children: [_jsx(FuseSignUpCtaSection, { LinkComponent: LinkComponent }), _jsx(FuseAuthAlternativesSection, { onSmsClick: () => setMode("otp"), socialProviders: enabledSocialProviders, onSocialClick: onSocialClick, socialLoadingProvider: socialLoadingProvider, socialError: socialError })] }))] }), dialog] }));
326
+ }, children: [_jsx(AuthPageTitle, { title: "Iniciar sesi\u00F3n" }), _jsxs(Box, { sx: { width: "100%" }, children: [_jsx(FuseSignInController, { LinkComponent: LinkComponent, mode: mode, disabled: isAuthFlowBusy, requestRoleSelection: requestRoleSelection, onBackToPassword: () => setMode("password") }), mode === "password" && (_jsxs(_Fragment, { children: [_jsx(FuseSignUpCtaSection, { LinkComponent: LinkComponent, disabled: isAuthFlowBusy }), _jsx(FuseAuthAlternativesSection, { onSmsClick: () => setMode("otp"), socialProviders: enabledSocialProviders, onSocialClick: onSocialClick, socialLoadingProvider: socialLoadingProvider, socialError: socialError })] }))] }), dialog] }));
257
327
  }
258
328
  function SignUpPageView() {
259
329
  const [mode, setMode] = useState("password");
260
- const { signInSocial } = useFuseJwtAuth();
330
+ const { signInSocial, signInSocialPrecheck } = useFuseJwtAuth();
261
331
  const [socialLoadingProvider, setSocialLoadingProvider] = useState(null);
262
332
  const [socialError, setSocialError] = useState(null);
263
333
  const navigate = useNavigate();
@@ -269,6 +339,7 @@ export function createFuseAuthViews(options) {
269
339
  }));
270
340
  const { requestRoleSelection, dialog, hasRoleOptions } = useRoleSelectionDialog(signupRoleOptions, defaultSignUpRole);
271
341
  const enabledSocialProviders = useMemo(() => getEnabledSocialProviders(socialConfig, showDebugSocial), [socialConfig, showDebugSocial]);
342
+ const isAuthFlowBusy = socialLoadingProvider !== null;
272
343
  const onSocialClick = useCallback(async (provider) => {
273
344
  const providerConfig = enabledSocialProviders.find((item) => item.provider === provider);
274
345
  if (!providerConfig) {
@@ -284,8 +355,19 @@ export function createFuseAuthViews(options) {
284
355
  if (showDebugSocial) {
285
356
  console.info("[jb-auth][social] provider token payload ready", { provider, tokenPayload });
286
357
  }
287
- const selectedRole = hasRoleOptions ? await requestRoleSelection() : undefined;
288
- if (hasRoleOptions && !selectedRole) {
358
+ const baseSocialPayload = {
359
+ ...tokenPayload,
360
+ provider,
361
+ client: "web",
362
+ termsAndConditionsAccepted: true,
363
+ };
364
+ if (showDebugSocial) {
365
+ console.info("[jb-auth][social] sending social precheck", { provider, client: "web" });
366
+ }
367
+ const socialPrecheckResponse = await signInSocialPrecheck(baseSocialPayload);
368
+ const shouldSelectRole = shouldSelectRoleForSocialLogin(socialPrecheckResponse, hasRoleOptions);
369
+ const selectedRole = shouldSelectRole ? await requestRoleSelection() : undefined;
370
+ if (shouldSelectRole && !selectedRole) {
289
371
  return;
290
372
  }
291
373
  if (showDebugSocial) {
@@ -296,11 +378,8 @@ export function createFuseAuthViews(options) {
296
378
  });
297
379
  }
298
380
  await signInSocial({
299
- ...tokenPayload,
300
- provider,
381
+ ...baseSocialPayload,
301
382
  role: selectedRole,
302
- client: "web",
303
- termsAndConditionsAccepted: true,
304
383
  });
305
384
  }
306
385
  catch (error) {
@@ -308,12 +387,12 @@ export function createFuseAuthViews(options) {
308
387
  console.error("[jb-auth][social] flow failed", { provider, error });
309
388
  }
310
389
  const parsed = parseAuthError(error);
311
- setSocialError(parsed.rootMessage || "No se pudo continuar con el proveedor social.");
390
+ setSocialError(parsed.rootMessage || "No se pudo acceder con el proveedor social.");
312
391
  }
313
392
  finally {
314
393
  setSocialLoadingProvider(null);
315
394
  }
316
- }, [enabledSocialProviders, hasRoleOptions, requestRoleSelection, showDebugSocial, signInSocial]);
395
+ }, [enabledSocialProviders, hasRoleOptions, requestRoleSelection, showDebugSocial, signInSocial, signInSocialPrecheck]);
317
396
  return (_jsxs(Box, { sx: {
318
397
  mx: { xs: "auto", sm: 0 },
319
398
  width: { xs: "100%", sm: 320 },
@@ -321,11 +400,11 @@ export function createFuseAuthViews(options) {
321
400
  display: "flex",
322
401
  flexDirection: "column",
323
402
  gap: 4,
324
- }, children: [_jsx(SignUpPageTitle, {}), _jsx(Box, { sx: { width: "100%" }, children: mode === "password" ? (_jsxs(_Fragment, { children: [_jsx(FuseSignUpController, { requiresRoleSelection: hasRoleOptions, requestRoleSelection: requestRoleSelection, onSuccess: (payload) => {
403
+ }, children: [_jsx(AuthPageTitle, { title: "Crear cuenta" }), _jsx(Box, { sx: { width: "100%" }, children: mode === "password" ? (_jsxs(_Fragment, { children: [_jsx(FuseSignUpController, { disabled: isAuthFlowBusy, requiresRoleSelection: hasRoleOptions, requestRoleSelection: requestRoleSelection, onSuccess: (payload) => {
325
404
  const { email } = payload;
326
405
  onSignUpSuccess?.(payload);
327
406
  navigate(`${accountConfirmationPath}?email=${encodeURIComponent(email)}`);
328
- } }), _jsx(FuseSignInCtaSection, { LinkComponent: LinkComponent }), _jsx(FuseAuthAlternativesSection, { onSmsClick: () => setMode("otp"), socialProviders: enabledSocialProviders, onSocialClick: onSocialClick, socialLoadingProvider: socialLoadingProvider, socialError: socialError })] })) : (_jsx(FuseOtpSignUpForm, { requestRoleSelection: requestRoleSelection, onBackToPassword: () => setMode("password") })) }), dialog] }));
407
+ } }), _jsx(FuseSignInCtaSection, { LinkComponent: LinkComponent, disabled: isAuthFlowBusy }), _jsx(FuseAuthAlternativesSection, { onSmsClick: () => setMode("otp"), socialProviders: enabledSocialProviders, onSocialClick: onSocialClick, socialLoadingProvider: socialLoadingProvider, socialError: socialError })] })) : (_jsx(FuseOtpSignUpForm, { requestRoleSelection: requestRoleSelection, onBackToPassword: () => setMode("password") })) }), dialog] }));
329
408
  }
330
409
  function ForgotPasswordPageView() {
331
410
  return (_jsxs(Box, { sx: {
@@ -335,13 +414,7 @@ export function createFuseAuthViews(options) {
335
414
  display: "flex",
336
415
  flexDirection: "column",
337
416
  gap: 4,
338
- }, children: [_jsxs(Box, { sx: { width: "100%" }, children: [_jsx("img", { style: { width: 48 }, src: "/assets/images/logo/logo.svg", alt: "logo" }), _jsx(Typography, { sx: {
339
- mt: 4,
340
- fontSize: 36,
341
- lineHeight: 1.25,
342
- fontWeight: 800,
343
- letterSpacing: "-0.02em",
344
- }, children: "Olvid\u00E9 mi contrase\u00F1a" }), _jsx(Typography, { sx: { mt: 1.5, fontSize: 16 }, color: "text.secondary", children: "Ingresa tu correo y te enviaremos un enlace para restablecer tu contrase\u00F1a." })] }), _jsx(FuseForgotPasswordPageForm, {}), _jsxs(Typography, { sx: { fontSize: 16, fontWeight: 500 }, color: "text.secondary", children: ["Volver a ", _jsx(LinkComponent, { to: "/sign-in", children: "Iniciar sesi\u00F3n" })] })] }));
417
+ }, children: [_jsxs(Box, { sx: { width: "100%" }, children: [_jsx(AuthPageTitle, { title: "Olvid\u00E9 mi contrase\u00F1a" }), _jsx(Typography, { sx: { mt: 1.5, fontSize: 16, textAlign: "center" }, color: "text.secondary", children: "Ingresa tu correo y te enviaremos un enlace para restablecer tu contrase\u00F1a." })] }), _jsx(FuseForgotPasswordPageForm, { LinkComponent: LinkComponent })] }));
345
418
  }
346
419
  function ResetPasswordPageView() {
347
420
  const [searchParams] = useSearchParams();
@@ -354,20 +427,14 @@ export function createFuseAuthViews(options) {
354
427
  display: "flex",
355
428
  flexDirection: "column",
356
429
  gap: 4,
357
- }, children: [_jsxs(Box, { sx: { width: "100%" }, children: [_jsx("img", { style: { width: 48 }, src: "/assets/images/logo/logo.svg", alt: "logo" }), _jsx(Typography, { sx: {
358
- mt: 4,
359
- fontSize: 36,
360
- lineHeight: 1.25,
361
- fontWeight: 800,
362
- letterSpacing: "-0.02em",
363
- }, children: "Restablecer contrase\u00F1a" }), _jsx(Typography, { sx: { mt: 1.5, fontSize: 16 }, color: "text.secondary", children: "Define una nueva contrase\u00F1a para volver a acceder a tu cuenta." })] }), _jsx(FuseResetPasswordPageForm, { initialUid: initialUid, initialToken: initialToken }), _jsxs(Typography, { sx: { fontSize: 16, fontWeight: 500 }, color: "text.secondary", children: ["Volver a ", _jsx(LinkComponent, { to: "/sign-in", children: "Iniciar sesi\u00F3n" })] })] }));
430
+ }, children: [_jsxs(Box, { sx: { width: "100%" }, children: [_jsx(AuthPageTitle, { title: "Restablecer contrase\u00F1a" }), _jsx(Typography, { sx: { mt: 1.5, fontSize: 16 }, color: "text.secondary", children: "Define una nueva contrase\u00F1a para volver a acceder a tu cuenta." })] }), _jsx(FuseResetPasswordPageForm, { initialUid: initialUid, initialToken: initialToken })] }));
364
431
  }
365
432
  function SignOutPageView() {
366
433
  return (_jsxs(Box, { sx: {
367
434
  mx: { xs: "auto", sm: 0 },
368
435
  width: { xs: "100%", sm: 320 },
369
436
  maxWidth: 320,
370
- }, children: [_jsx(SignOutPageTitle, {}), _jsxs(Typography, { sx: { mt: 2, textAlign: "center", fontSize: 16, fontWeight: 500 }, color: "text.secondary", children: ["Ir a ", _jsx(LinkComponent, { to: "/sign-in", children: "iniciar sesi\u00F3n" })] })] }));
437
+ }, children: [_jsx(AuthPageTitle, { title: "Has cerrado sesi\u00F3n" }), _jsxs(Typography, { sx: { mt: 2, textAlign: "center", fontSize: 16, fontWeight: 500 }, color: "text.secondary", children: ["Ir a ", _jsx(LinkComponent, { to: "/sign-in", children: "iniciar sesi\u00F3n" })] })] }));
371
438
  }
372
439
  function AccountConfirmationPageView() {
373
440
  const [searchParams] = useSearchParams();
@@ -380,13 +447,7 @@ export function createFuseAuthViews(options) {
380
447
  display: "flex",
381
448
  flexDirection: "column",
382
449
  gap: 4,
383
- }, children: [_jsxs(Box, { sx: { width: "100%" }, children: [_jsx("img", { style: { width: 48 }, src: "/assets/images/logo/logo.svg", alt: "logo" }), _jsx(Typography, { sx: {
384
- mt: 4,
385
- fontSize: 36,
386
- lineHeight: 1.25,
387
- fontWeight: 800,
388
- letterSpacing: "-0.02em",
389
- }, children: "Verificar cuenta" }), _jsx(Typography, { sx: { mt: 1.5, fontSize: 16 }, color: "text.secondary", children: "Estamos validando tu enlace de confirmaci\u00F3n." })] }), _jsx(FuseAccountConfirmationPageForm, { initialUid: initialUid, initialToken: initialToken })] }));
450
+ }, children: [_jsxs(Box, { sx: { width: "100%" }, children: [_jsx(AuthPageTitle, { title: "Verificar cuenta" }), _jsx(Typography, { sx: { mt: 1.5, fontSize: 16 }, color: "text.secondary", children: "Estamos validando tu enlace de confirmaci\u00F3n." })] }), _jsx(FuseAccountConfirmationPageForm, { initialUid: initialUid, initialToken: initialToken })] }));
390
451
  }
391
452
  return {
392
453
  SignInPageView,
@@ -1,6 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { AuthClient } from '../client';
3
- import { AccountConfirmationPayload, AccountConfirmationResendPayload, LoginSocialPayload, PasswordChangePayload, PasswordResetConfirmPayload, PasswordResetRequestPayload, RegisterPayload, RequestOtpPayload, VerifyOtpPayload } from '../types';
3
+ import { AccountConfirmationPayload, AccountConfirmationResendPayload, LoginSocialPrecheckResponse, LoginSocialPayload, PasswordChangePayload, PasswordResetConfirmPayload, PasswordResetRequestPayload, RegisterPayload, RequestOtpPayload, VerifyOtpPayload } from '../types';
4
4
  type JsonRecord = Record<string, unknown>;
5
5
  type FuseAuthState<TUser = JsonRecord> = {
6
6
  authStatus: 'configuring' | 'authenticated' | 'unauthenticated';
@@ -14,6 +14,7 @@ export type FuseJwtAuthContextType<TUser = JsonRecord> = FuseAuthState<TUser> &
14
14
  username?: string;
15
15
  }) => Promise<JsonRecord>;
16
16
  signInSocial: (payload: LoginSocialPayload) => Promise<JsonRecord>;
17
+ signInSocialPrecheck: (payload: LoginSocialPayload) => Promise<LoginSocialPrecheckResponse>;
17
18
  requestOtp: (payload: RequestOtpPayload) => Promise<Record<string, unknown>>;
18
19
  signInOtp: (payload: VerifyOtpPayload) => Promise<JsonRecord>;
19
20
  signUp: (payload: RegisterPayload) => Promise<JsonRecord>;
@@ -1 +1 @@
1
- {"version":3,"file":"fuseAdapter.d.ts","sourceRoot":"","sources":["../../../src/auth/fuse/fuseAdapter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EAOV,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAA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AAyB,EAAE,CAAC,OAAO,EAAE,gCAAgC,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC3G,oBAAoB,EAAE,CAAC,OAAO,EAAE,2BAA2B,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACjG,oBAAoB,EAAE,CAAC,OAAO,EAAE,2BAA2B,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACjG,cAAc,EAAE,CAAC,OAAO,EAAE,qBAAqB,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACrF,aAAa,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IAC1D,WAAW,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;IACtD,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,YAAY,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CAC5C,CAAC;AAEF,KAAK,8BAA8B,GAAG;IACpC,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IACpD,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC;QACd,OAAO,EAAE,MAAM,IAAI,CAAC;KACrB,CAAC,CAAC;CACJ,CAAC;AAsEF,eAAO,MAAM,yBAAyB,GAAI,YAAY,UAAU,aAC1B,8BAA8B,4CA2QnE,CAAC;AAEF,eAAO,MAAM,cAAc,0CAM1B,CAAC"}
@@ -164,6 +164,10 @@ export const createFuseJwtAuthProvider = (authClient) => {
164
164
  refresh_token: session.refreshToken
165
165
  };
166
166
  }, []);
167
+ const signInSocialPrecheck = useCallback(async (payload) => authClient.loginSocialPrecheck({
168
+ ...payload,
169
+ client: payload.client ?? 'web'
170
+ }), []);
167
171
  const signInOtp = useCallback(async (payload) => {
168
172
  const session = normalizeSession(await authClient.verifyOtp({
169
173
  ...payload,
@@ -220,6 +224,7 @@ export const createFuseJwtAuthProvider = (authClient) => {
220
224
  ...authState,
221
225
  signIn,
222
226
  signInSocial,
227
+ signInSocialPrecheck,
223
228
  requestOtp,
224
229
  signInOtp,
225
230
  signUp,
@@ -236,6 +241,7 @@ export const createFuseJwtAuthProvider = (authClient) => {
236
241
  authState,
237
242
  signIn,
238
243
  signInSocial,
244
+ signInSocialPrecheck,
239
245
  requestOtp,
240
246
  signInOtp,
241
247
  signUp,
@@ -18,6 +18,14 @@ type GoogleCodeResponse = {
18
18
  type GoogleCredentialResponse = {
19
19
  credential?: string;
20
20
  };
21
+ type GooglePromptMomentNotification = {
22
+ isNotDisplayed?: () => boolean;
23
+ isSkippedMoment?: () => boolean;
24
+ isDismissedMoment?: () => boolean;
25
+ getNotDisplayedReason?: () => string;
26
+ getSkippedReason?: () => string;
27
+ getDismissedReason?: () => string;
28
+ };
21
29
  type AppleSignInResponse = {
22
30
  authorization?: {
23
31
  code?: string;
@@ -43,7 +51,7 @@ declare global {
43
51
  client_id: string;
44
52
  callback: (response: GoogleCredentialResponse) => void;
45
53
  }) => void;
46
- prompt: () => void;
54
+ prompt: (listener?: (notification: GooglePromptMomentNotification) => void) => void;
47
55
  cancel: () => void;
48
56
  };
49
57
  oauth2?: {
@@ -1 +1 @@
1
- {"version":3,"file":"providerAuth.d.ts","sourceRoot":"","sources":["../../../src/auth/social/providerAuth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE9D,KAAK,0BAA0B,GAAG;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,EA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UAAU,CAAC,CAc7H,CAAC"}
@@ -79,7 +79,25 @@ const authenticateWithGoogle = async (config) => {
79
79
  resolve(credentialResponse);
80
80
  }
81
81
  });
82
- window.google.accounts.id.prompt();
82
+ window.google.accounts.id.cancel();
83
+ window.google.accounts.id.prompt((notification) => {
84
+ if (settled) {
85
+ return;
86
+ }
87
+ const isNotDisplayed = notification?.isNotDisplayed?.() ?? false;
88
+ const isSkipped = notification?.isSkippedMoment?.() ?? false;
89
+ const isDismissed = notification?.isDismissedMoment?.() ?? false;
90
+ if (!isNotDisplayed && !isSkipped && !isDismissed) {
91
+ return;
92
+ }
93
+ settled = true;
94
+ window.clearTimeout(timeoutId);
95
+ const reason = notification?.getNotDisplayedReason?.() ||
96
+ notification?.getSkippedReason?.() ||
97
+ notification?.getDismissedReason?.() ||
98
+ 'Google sign-in cancelled';
99
+ reject(new Error(`Google authentication was not completed: ${reason}`));
100
+ });
83
101
  });
84
102
  if (!response.credential) {
85
103
  throw new Error('Google authentication failed.');