@navservice/usuario 1.28.0 → 1.29.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.
@@ -0,0 +1,7 @@
1
+ type Props = {
2
+ email: string;
3
+ erroExterno?: string | null;
4
+ onConfirmarCodigo?: (codigo: string) => void;
5
+ };
6
+ export declare function EnviarCodigoOtpEmail({ email, erroExterno, onConfirmarCodigo }: Props): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1 @@
1
+ export { EnviarCodigoOtpEmail } from "./EnviarCodigoOtpParaEmail";
@@ -6,7 +6,7 @@ declare const contexto_usuario: {
6
6
  new (): {};
7
7
  register(props: t.Controller.Usuario.Register.Input): Promise<t.Controller.Usuario.Register.Response>;
8
8
  login(props: t.Controller.Usuario.Login.Input): Promise<AxiosResponse>;
9
- entrar_com_codigo_otp(props: t.Controller.CodigoOtp.EntrarComCodigoOtp.Input): Promise<AxiosResponse>;
9
+ entrar_com_codigo_otp(props: t.Controller.CodigoOtp.EntrarComCodigoOtp.Input): Promise<t.Controller.CodigoOtp.EntrarComCodigoOtp.Response>;
10
10
  login_register_google(props: t.Controller.Usuario.RegisterLoginGoogle.Input): Promise<void>;
11
11
  };
12
12
  contexto: {
package/build/es/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import { create as external_zustand_create } from "zustand";
3
3
  import { immer } from "zustand/middleware/immer";
4
4
  import v4 from "zod/v4";
5
- import react, { createElement, forwardRef, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from "react";
5
+ import react, { createElement, forwardRef, memo, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from "react";
6
6
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
7
  import { QRCodeSVG } from "qrcode.react";
8
8
  import { Outlet, useLocation, useNavigate, useSearchParams } from "react-router-dom";
@@ -2469,6 +2469,20 @@ const _data = class {
2469
2469
  var diferencaEmDias = Math.floor(diferenca / 86400000);
2470
2470
  return diferencaEmDias;
2471
2471
  }
2472
+ static SET_SECONDS_TO_DD_MM_YYYY_HH_MM(timestamp) {
2473
+ const segundos = Number(timestamp);
2474
+ if (!Number.isFinite(segundos)) return "-";
2475
+ const data = new Date(1000 * segundos);
2476
+ if (isNaN(data.getTime())) return "-";
2477
+ return data.toLocaleString("pt-BR", {
2478
+ timeZone: "America/Sao_Paulo",
2479
+ day: "2-digit",
2480
+ month: "2-digit",
2481
+ year: "numeric",
2482
+ hour: "2-digit",
2483
+ minute: "2-digit"
2484
+ });
2485
+ }
2472
2486
  };
2473
2487
  const utils_data = _data;
2474
2488
  class _form {
@@ -3030,7 +3044,7 @@ var type_controller_usuario_TypeControllerUsuario;
3030
3044
  GerarAutheticatorCode.InputSchema = v4.object({
3031
3045
  data: v4.object({
3032
3046
  autheticator: v4.object({
3033
- usuario_senha: v4.string()
3047
+ codigo_otp: v4.string()
3034
3048
  })
3035
3049
  })
3036
3050
  });
@@ -3050,7 +3064,7 @@ var type_controller_usuario_TypeControllerUsuario;
3050
3064
  DesativarAuthenticatorCode.InputSchema = v4.object({});
3051
3065
  })(TypeControlerAutheticator.DesativarAuthenticatorCode || (TypeControlerAutheticator.DesativarAuthenticatorCode = {}));
3052
3066
  (function(BuscarAuthenticatorPeloId) {
3053
- BuscarAuthenticatorPeloId.route = "/api/usuario/auth/buscar_authenticator_pelo_id";
3067
+ BuscarAuthenticatorPeloId.route = "/api/usuario/auth/authenticator";
3054
3068
  BuscarAuthenticatorPeloId.InputSchema = v4.object({});
3055
3069
  })(TypeControlerAutheticator.BuscarAuthenticatorPeloId || (TypeControlerAutheticator.BuscarAuthenticatorPeloId = {}));
3056
3070
  })(type_controller_authenticator_TypeControlerAutheticator || (type_controller_authenticator_TypeControlerAutheticator = {}));
@@ -3619,6 +3633,59 @@ const hasA11yProp = (props)=>{
3619
3633
  ]
3620
3634
  ];
3621
3635
  const Shield = createLucideIcon("shield", __iconNode);
3636
+ /**
3637
+ * @license lucide-react v0.544.0 - ISC
3638
+ *
3639
+ * This source code is licensed under the ISC license.
3640
+ * See the LICENSE file in the root directory of this source tree.
3641
+ */ const circle_check_iconNode = [
3642
+ [
3643
+ "circle",
3644
+ {
3645
+ cx: "12",
3646
+ cy: "12",
3647
+ r: "10",
3648
+ key: "1mglay"
3649
+ }
3650
+ ],
3651
+ [
3652
+ "path",
3653
+ {
3654
+ d: "m9 12 2 2 4-4",
3655
+ key: "dzmm74"
3656
+ }
3657
+ ]
3658
+ ];
3659
+ const CircleCheck = createLucideIcon("circle-check", circle_check_iconNode);
3660
+ /**
3661
+ * @license lucide-react v0.544.0 - ISC
3662
+ *
3663
+ * This source code is licensed under the ISC license.
3664
+ * See the LICENSE file in the root directory of this source tree.
3665
+ */ const shield_off_iconNode = [
3666
+ [
3667
+ "path",
3668
+ {
3669
+ d: "m2 2 20 20",
3670
+ key: "1ooewy"
3671
+ }
3672
+ ],
3673
+ [
3674
+ "path",
3675
+ {
3676
+ d: "M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71",
3677
+ key: "1jlk70"
3678
+ }
3679
+ ],
3680
+ [
3681
+ "path",
3682
+ {
3683
+ d: "M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264",
3684
+ key: "18rp1v"
3685
+ }
3686
+ ]
3687
+ ];
3688
+ const ShieldOff = createLucideIcon("shield-off", shield_off_iconNode);
3622
3689
  /**
3623
3690
  * @license lucide-react v0.544.0 - ISC
3624
3691
  *
@@ -3708,30 +3775,6 @@ const Key = createLucideIcon("key", key_iconNode);
3708
3775
  ]
3709
3776
  ];
3710
3777
  const Copy = createLucideIcon("copy", copy_iconNode);
3711
- /**
3712
- * @license lucide-react v0.544.0 - ISC
3713
- *
3714
- * This source code is licensed under the ISC license.
3715
- * See the LICENSE file in the root directory of this source tree.
3716
- */ const circle_check_iconNode = [
3717
- [
3718
- "circle",
3719
- {
3720
- cx: "12",
3721
- cy: "12",
3722
- r: "10",
3723
- key: "1mglay"
3724
- }
3725
- ],
3726
- [
3727
- "path",
3728
- {
3729
- d: "m9 12 2 2 4-4",
3730
- key: "dzmm74"
3731
- }
3732
- ]
3733
- ];
3734
- const CircleCheck = createLucideIcon("circle-check", circle_check_iconNode);
3735
3778
  /**
3736
3779
  * @license lucide-react v0.544.0 - ISC
3737
3780
  *
@@ -3795,9 +3838,7 @@ const DrawerPadrao = /*#__PURE__*/ forwardRef(({ title, children, onClose }, ref
3795
3838
  const [open, setOpen] = useState(false);
3796
3839
  const closeBtnRef = useRef(null);
3797
3840
  useImperativeHandle(ref, ()=>({
3798
- abrir: ()=>{
3799
- setOpen(true);
3800
- },
3841
+ abrir: ()=>setOpen(true),
3801
3842
  fechar: ()=>{
3802
3843
  setOpen(false);
3803
3844
  onClose?.();
@@ -3829,53 +3870,110 @@ const DrawerPadrao = /*#__PURE__*/ forwardRef(({ title, children, onClose }, ref
3829
3870
  return /*#__PURE__*/ jsxs("div", {
3830
3871
  role: "dialog",
3831
3872
  "aria-modal": "true",
3832
- className: `fixed inset-0 z-50 transition-opacity duration-300 ${open ? "opacity-100" : "opacity-0 pointer-events-none"}`,
3873
+ className: `fixed inset-0 z-50 transition-opacity duration-300
3874
+ ${open ? "opacity-100" : "opacity-0 pointer-events-none"}`,
3833
3875
  children: [
3834
3876
  /*#__PURE__*/ jsx("div", {
3835
- className: "absolute inset-0 bg-black/20 backdrop-blur-[1px]",
3877
+ className: "absolute inset-0 bg-black/30 backdrop-blur-[2px]",
3836
3878
  onClick: ()=>ref?.current?.fechar()
3837
3879
  }),
3838
3880
  /*#__PURE__*/ jsxs("aside", {
3839
- className: `absolute right-0 top-0 h-full w-full md:max-w-[720px] bg-white shadow-2xl border-l border-gray-200
3840
- transform transition-transform duration-400
3841
- ${open ? "translate-x-0" : "translate-x-full"}`,
3881
+ className: `absolute right-0 top-0 h-full w-full md:max-w-[720px]
3882
+ bg-theme-card border-l border-theme-border
3883
+ transform transition-transform duration-300 ease-out
3884
+ ${open ? "translate-x-0" : "translate-x-full"}`,
3842
3885
  onClick: (e)=>e.stopPropagation(),
3843
3886
  children: [
3844
3887
  /*#__PURE__*/ jsxs("div", {
3845
- className: "flex items-center justify-between p-3.5 border-b border-gray-200",
3888
+ className: "flex items-center justify-between px-4 py-3 border-b border-theme-border",
3846
3889
  children: [
3847
- title ?? /*#__PURE__*/ jsxs("div", {
3848
- className: "flex items-center gap-3",
3849
- children: [
3850
- /*#__PURE__*/ jsx(House, {
3851
- className: "h-6 w-6 text-gray-800"
3852
- }),
3853
- /*#__PURE__*/ jsx("h1", {
3854
- className: "text-xl font-bold text-gray-900",
3855
- children: title
3856
- })
3857
- ]
3890
+ /*#__PURE__*/ jsx("div", {
3891
+ className: "flex items-center gap-3 min-h-[40px]",
3892
+ children: title ? "string" == typeof title ? /*#__PURE__*/ jsxs(Fragment, {
3893
+ children: [
3894
+ /*#__PURE__*/ jsx("div", {
3895
+ className: "flex h-9 w-9 items-center justify-center rounded-full bg-primary-950/40 border border-theme-border",
3896
+ children: /*#__PURE__*/ jsx(House, {
3897
+ className: "h-4 w-4 text-primary-400"
3898
+ })
3899
+ }),
3900
+ /*#__PURE__*/ jsx("h1", {
3901
+ className: "text-sm font-semibold text-theme-text",
3902
+ children: title
3903
+ })
3904
+ ]
3905
+ }) : title : null
3858
3906
  }),
3859
3907
  /*#__PURE__*/ jsx("button", {
3860
3908
  ref: closeBtnRef,
3861
3909
  onClick: ()=>ref?.current?.fechar(),
3862
- className: "inline-flex items-center gap-2 cursor-pointer rounded-full border border-gray-200 bg-white px-2 py-2 text-sm text-gray-700 hover:bg-gray-50",
3863
3910
  "aria-label": "Fechar",
3911
+ className: " inline-flex items-center justify-center h-9 w-9 rounded-full border border-theme-border bg-theme-bg text-basic-400 hover:bg-default-800 focus:outline-none focus:ring-2 focus:ring-primary-600 transition ",
3864
3912
  children: /*#__PURE__*/ jsx(X, {
3865
- className: "h-4 w-4 text-red-600"
3913
+ className: "h-4 w-4"
3866
3914
  })
3867
3915
  })
3868
3916
  ]
3869
3917
  }),
3870
3918
  /*#__PURE__*/ jsx("div", {
3871
- className: "h-[calc(100%-64px)] overflow-auto",
3872
- children: children
3919
+ className: "h-[calc(100%-56px)] overflow-y-auto",
3920
+ children: /*#__PURE__*/ jsx(PessimisticReveal, {
3921
+ open: open,
3922
+ children: children
3923
+ })
3873
3924
  })
3874
3925
  ]
3875
3926
  })
3876
3927
  ]
3877
3928
  });
3878
3929
  });
3930
+ const PessimisticReveal = /*#__PURE__*/ memo(({ open, children, delay = 2000 })=>{
3931
+ const [loading, setLoading] = useState(false);
3932
+ const [show, setShow] = useState(false);
3933
+ useEffect(()=>{
3934
+ if (!open) {
3935
+ setLoading(false);
3936
+ setShow(false);
3937
+ return;
3938
+ }
3939
+ setLoading(true);
3940
+ setShow(false);
3941
+ const timer = setTimeout(()=>{
3942
+ setLoading(false);
3943
+ setShow(true);
3944
+ }, delay);
3945
+ return ()=>clearTimeout(timer);
3946
+ }, [
3947
+ open,
3948
+ delay
3949
+ ]);
3950
+ if (!open) return null;
3951
+ return /*#__PURE__*/ jsxs("div", {
3952
+ className: "relative h-full",
3953
+ children: [
3954
+ loading && /*#__PURE__*/ jsx("div", {
3955
+ className: "absolute inset-0 z-10 flex items-center justify-center",
3956
+ children: /*#__PURE__*/ jsxs("div", {
3957
+ className: "flex flex-col items-center gap-3",
3958
+ children: [
3959
+ /*#__PURE__*/ jsx("div", {
3960
+ className: "h-6 w-6 animate-spin rounded-full border-2 border-theme-border border-t-primary-500"
3961
+ }),
3962
+ /*#__PURE__*/ jsx("span", {
3963
+ className: "text-xs text-basic-400",
3964
+ children: "Carregando…"
3965
+ })
3966
+ ]
3967
+ })
3968
+ }),
3969
+ /*#__PURE__*/ jsx("div", {
3970
+ className: `h-full transition-opacity duration-300
3971
+ ${show ? "opacity-100" : "opacity-0 pointer-events-none"}`,
3972
+ children: children
3973
+ })
3974
+ ]
3975
+ });
3976
+ });
3879
3977
  const AuthAtivarDesativarAuthenticator = ()=>{
3880
3978
  const [senha, setSenha] = useState("");
3881
3979
  const [mostrarSenhaStep, setMostrarSenhaStep] = useState(false);
@@ -3901,7 +3999,8 @@ const AuthAtivarDesativarAuthenticator = ()=>{
3901
3999
  setCarregando(true);
3902
4000
  const response = await src_utils.api.servidor_pricipal.get({
3903
4001
  baseURLKey: "PUBLIC_BASE_URL_BACKEND_USUARIO",
3904
- url: shared_types.Controller.Autheticator.BuscarAuthenticatorPeloId.route
4002
+ url: shared_types.Controller.Autheticator.BuscarAuthenticatorPeloId.route,
4003
+ setToken: true
3905
4004
  });
3906
4005
  if (response?.data?.type !== "success") return;
3907
4006
  if (!response?.data?.results) return;
@@ -3927,7 +4026,7 @@ const AuthAtivarDesativarAuthenticator = ()=>{
3927
4026
  const data = {
3928
4027
  data: {
3929
4028
  autheticator: {
3930
- usuario_senha: senha
4029
+ codigo_otp: senha
3931
4030
  }
3932
4031
  }
3933
4032
  };
@@ -3966,7 +4065,7 @@ const AuthAtivarDesativarAuthenticator = ()=>{
3966
4065
  };
3967
4066
  const resp = await src_utils.api.servidor_pricipal.post({
3968
4067
  baseURLKey: "PUBLIC_BASE_URL_BACKEND_USUARIO",
3969
- url: "/usuario/auth/ativar_autheticator_code",
4068
+ url: shared_types.Controller.Autheticator.AtivarAutheticatorCode.route,
3970
4069
  data,
3971
4070
  setToken: true
3972
4071
  });
@@ -3980,98 +4079,127 @@ const AuthAtivarDesativarAuthenticator = ()=>{
3980
4079
  }
3981
4080
  }
3982
4081
  return /*#__PURE__*/ jsx("div", {
3983
- className: "max-w-xl mx-auto px-4 py-8",
4082
+ className: "w-full max-w-md mx-auto px-6 py-8 text-theme-text",
3984
4083
  children: /*#__PURE__*/ jsxs("div", {
3985
- className: "bg-white rounded-xl shadow-lg p-6 space-y-6",
4084
+ className: "space-y-8",
3986
4085
  children: [
3987
- /*#__PURE__*/ jsx("div", {
3988
- className: "flex justify-center",
3989
- children: /*#__PURE__*/ jsx(Shield, {
3990
- className: "w-12 h-12 text-primary-600"
3991
- })
3992
- }),
3993
- /*#__PURE__*/ jsx("h1", {
3994
- className: "text-center text-xl font-semibold text-basic-900",
3995
- children: "Autentica\xe7\xe3o de Dois Fatores"
4086
+ /*#__PURE__*/ jsxs("div", {
4087
+ className: "text-center space-y-3",
4088
+ children: [
4089
+ /*#__PURE__*/ jsx("div", {
4090
+ className: "mx-auto w-12 h-12 rounded-full bg-primary-950/40 flex items-center justify-center border border-theme-border",
4091
+ children: /*#__PURE__*/ jsx(Shield, {
4092
+ className: "w-6 h-6 text-primary-400"
4093
+ })
4094
+ }),
4095
+ /*#__PURE__*/ jsx("h1", {
4096
+ className: "text-lg font-semibold",
4097
+ children: "Autentica\xe7\xe3o em Dois Fatores"
4098
+ }),
4099
+ /*#__PURE__*/ jsx("p", {
4100
+ className: "text-sm text-basic-400",
4101
+ children: "Proteja sua conta com uma camada extra de seguran\xe7a."
4102
+ })
4103
+ ]
3996
4104
  }),
3997
4105
  authenticator && /*#__PURE__*/ jsxs("div", {
3998
- className: "bg-basic-50 rounded-lg p-4 text-sm text-basic-700 space-y-3",
4106
+ className: "rounded-xl border border-theme-border bg-theme-card p-5 space-y-4",
3999
4107
  children: [
4000
- /*#__PURE__*/ jsxs("p", {
4108
+ /*#__PURE__*/ jsxs("div", {
4109
+ className: "flex items-center justify-between text-sm",
4001
4110
  children: [
4002
4111
  /*#__PURE__*/ jsx("span", {
4003
- className: "font-medium",
4004
- children: "Criado em:"
4112
+ className: "text-basic-400",
4113
+ children: "Status"
4005
4114
  }),
4006
- " ",
4007
- new Date(authenticator.data.autheticator.data_criacao).toLocaleDateString()
4115
+ authenticator.data.autheticator.ativo ? /*#__PURE__*/ jsxs("span", {
4116
+ className: "inline-flex items-center gap-1 text-primary-400 font-medium",
4117
+ children: [
4118
+ /*#__PURE__*/ jsx(CircleCheck, {
4119
+ className: "w-4 h-4"
4120
+ }),
4121
+ "Ativo"
4122
+ ]
4123
+ }) : /*#__PURE__*/ jsxs("span", {
4124
+ className: "inline-flex items-center gap-1 text-error-400 font-medium",
4125
+ children: [
4126
+ /*#__PURE__*/ jsx(ShieldOff, {
4127
+ className: "w-4 h-4"
4128
+ }),
4129
+ "Inativo"
4130
+ ]
4131
+ })
4008
4132
  ]
4009
4133
  }),
4010
- /*#__PURE__*/ jsxs("p", {
4134
+ authenticator?.data?.autheticator?.data_criacao && /*#__PURE__*/ jsxs("p", {
4135
+ className: "text-xs text-basic-500",
4011
4136
  children: [
4012
- /*#__PURE__*/ jsx("span", {
4013
- className: "font-medium",
4014
- children: "Status:"
4015
- }),
4016
- " ",
4017
- authenticator.data.autheticator.ativo ? /*#__PURE__*/ jsx("span", {
4018
- className: "text-green-600 font-medium",
4019
- children: "Ativo"
4020
- }) : /*#__PURE__*/ jsx("span", {
4021
- className: "text-error-600 font-medium",
4022
- children: "Inativo"
4023
- })
4137
+ "Criado em ",
4138
+ src_utils.data.SET_SECONDS_TO_DD_MM_YYYY_HH_MM(authenticator.data.autheticator.data_criacao)
4024
4139
  ]
4025
4140
  }),
4026
4141
  /*#__PURE__*/ jsxs("div", {
4027
- className: "flex items-center text-xs text-orange-600 gap-1",
4142
+ className: "flex items-start gap-2 rounded-lg bg-error-950/30 border border-error-900/40 p-3 text-xs text-error-300",
4028
4143
  children: [
4029
4144
  /*#__PURE__*/ jsx(Info, {
4030
- className: "w-4 h-4"
4145
+ className: "w-4 h-4 mt-0.5 shrink-0"
4031
4146
  }),
4032
- "Nunca compartilhe seu c\xf3digo de autentica\xe7\xe3o."
4147
+ /*#__PURE__*/ jsx("span", {
4148
+ children: "Nunca compartilhe seus c\xf3digos de autentica\xe7\xe3o."
4149
+ })
4033
4150
  ]
4034
4151
  }),
4035
- authenticator.data.autheticator.ativo && /*#__PURE__*/ jsx("button", {
4036
- className: "w-full mt-3 bg-error-500 hover:bg-error-600 text-white font-medium py-2 rounded-lg transition-all",
4152
+ authenticator.data.autheticator.ativo && /*#__PURE__*/ jsxs("button", {
4037
4153
  onClick: desativarAuthenticator,
4038
4154
  disabled: carregando,
4039
- children: carregando ? "Desativando..." : "Desativar"
4155
+ className: "w-full mt-2 inline-flex items-center justify-center gap-2 rounded-lg bg-error-600/90 hover:bg-error-600 text-white text-sm font-medium py-2.5 transition disabled:opacity-60",
4156
+ children: [
4157
+ /*#__PURE__*/ jsx(ShieldOff, {
4158
+ className: "w-4 h-4"
4159
+ }),
4160
+ carregando ? "Desativando..." : "Desativar autenticação"
4161
+ ]
4040
4162
  })
4041
4163
  ]
4042
4164
  }),
4043
- !authenticatorData && !mostrarSenhaStep && !authenticator?.data?.autheticator?.ativo && !carregando && /*#__PURE__*/ jsx("div", {
4044
- className: "text-center",
4045
- children: /*#__PURE__*/ jsxs("button", {
4046
- onClick: ()=>setMostrarSenhaStep(true),
4047
- className: "flex items-center gap-2 mx-auto bg-primary-600 hover:bg-primary-700 text-white px-4 py-2 rounded-lg transition-all",
4048
- children: [
4049
- /*#__PURE__*/ jsx(Key, {
4050
- className: "w-4 h-4"
4051
- }),
4052
- "Gerar C\xf3digo Authenticator"
4053
- ]
4054
- })
4165
+ !authenticatorData && !mostrarSenhaStep && !authenticator?.data?.autheticator?.ativo && !carregando && /*#__PURE__*/ jsxs("button", {
4166
+ onClick: ()=>setMostrarSenhaStep(true),
4167
+ className: "w-full inline-flex items-center justify-center gap-2 rounded-lg bg-primary-600 hover:bg-primary-500 text-white text-sm font-medium py-2.5 transition",
4168
+ children: [
4169
+ /*#__PURE__*/ jsx(Key, {
4170
+ className: "w-4 h-4"
4171
+ }),
4172
+ "Ativar autentica\xe7\xe3o"
4173
+ ]
4055
4174
  }),
4056
4175
  mostrarSenhaStep && /*#__PURE__*/ jsxs("div", {
4057
- className: "space-y-3",
4176
+ className: "space-y-4",
4058
4177
  children: [
4059
- /*#__PURE__*/ jsx("input", {
4060
- type: "password",
4061
- value: senha,
4062
- onChange: (e)=>setSenha(e.target.value),
4063
- placeholder: "Digite sua senha",
4064
- className: "w-full border border-default-300 rounded-lg px-4 py-2 focus:ring-2 ring-primary-500 outline-none transition-all"
4178
+ /*#__PURE__*/ jsxs("div", {
4179
+ className: "space-y-1",
4180
+ children: [
4181
+ /*#__PURE__*/ jsx("label", {
4182
+ className: "text-xs text-basic-400",
4183
+ children: "Confirme sua senha"
4184
+ }),
4185
+ /*#__PURE__*/ jsx("input", {
4186
+ type: "password",
4187
+ value: senha,
4188
+ onChange: (e)=>setSenha(e.target.value),
4189
+ placeholder: "Digite sua senha",
4190
+ className: "w-full rounded-lg border border-theme-border bg-theme-bg px-4 py-2.5 text-sm focus:ring-2 focus:ring-primary-600 outline-none"
4191
+ })
4192
+ ]
4065
4193
  }),
4066
4194
  erro && /*#__PURE__*/ jsx("p", {
4067
- className: "text-error-600 text-sm",
4195
+ className: "text-error-400 text-xs",
4068
4196
  children: erro
4069
4197
  }),
4070
4198
  /*#__PURE__*/ jsx("button", {
4071
4199
  onClick: handleConfirmarSenha,
4072
4200
  disabled: carregando,
4073
- className: "w-full bg-primary-600 hover:bg-primary-700 text-white px-4 py-2 rounded-lg transition-all",
4074
- children: carregando ? "Gerando..." : "Confirmar"
4201
+ className: "w-full rounded-lg bg-primary-600 hover:bg-primary-500 text-white text-sm font-medium py-2.5 transition disabled:opacity-60",
4202
+ children: carregando ? "Gerando código..." : "Continuar"
4075
4203
  })
4076
4204
  ]
4077
4205
  }),
@@ -4079,42 +4207,42 @@ const AuthAtivarDesativarAuthenticator = ()=>{
4079
4207
  className: "space-y-6",
4080
4208
  children: [
4081
4209
  /*#__PURE__*/ jsxs("div", {
4082
- className: "text-center space-y-2",
4210
+ className: "text-center space-y-3",
4083
4211
  children: [
4084
4212
  /*#__PURE__*/ jsx("p", {
4085
- className: "font-medium text-basic-700",
4086
- children: "Escaneie o QR Code no seu app autenticador"
4213
+ className: "text-sm font-medium text-basic-300",
4214
+ children: "Escaneie o QR Code no app autenticador"
4087
4215
  }),
4088
4216
  /*#__PURE__*/ jsx("div", {
4089
- className: "flex justify-center",
4217
+ className: "flex justify-center rounded-xl border border-theme-border bg-theme-bg p-4",
4090
4218
  children: /*#__PURE__*/ jsx(QRCodeSVG, {
4091
4219
  value: authenticatorData.otpAuthUrl,
4092
- size: 200
4220
+ size: 180
4093
4221
  })
4094
4222
  }),
4095
4223
  /*#__PURE__*/ jsx("p", {
4096
- className: "text-basic-600",
4097
- children: "Ou use o c\xf3digo manual:"
4224
+ className: "text-xs text-basic-500",
4225
+ children: "Ou utilize o c\xf3digo manual"
4098
4226
  }),
4099
4227
  /*#__PURE__*/ jsxs("div", {
4100
- className: "relative flex items-center justify-center gap-2",
4228
+ className: "flex items-center justify-center gap-2",
4101
4229
  children: [
4102
4230
  /*#__PURE__*/ jsx("div", {
4103
- className: "bg-basic-100 px-3 py-2 rounded-lg font-mono text-sm max-w-xs overflow-x-auto",
4231
+ className: "rounded-lg bg-basic-900 px-3 py-2 font-mono text-xs max-w-[220px] overflow-x-auto border border-theme-border",
4104
4232
  children: authenticatorData.secret
4105
4233
  }),
4106
4234
  /*#__PURE__*/ jsx("button", {
4107
4235
  onClick: handleCopiar,
4108
- className: "bg-default-200 hover:bg-default-300 rounded-lg p-2 transition-all",
4236
+ className: "rounded-lg bg-default-800 hover:bg-default-700 p-2 transition border border-theme-border",
4109
4237
  children: /*#__PURE__*/ jsx(Copy, {
4110
- className: "w-4 h-4 text-basic-600"
4238
+ className: "w-4 h-4 text-basic-300"
4111
4239
  })
4112
- }),
4113
- copiado && /*#__PURE__*/ jsx("span", {
4114
- className: "absolute -top-6 bg-green-600 text-white text-xs px-2 py-1 rounded-md shadow",
4115
- children: "Copiado!"
4116
4240
  })
4117
4241
  ]
4242
+ }),
4243
+ copiado && /*#__PURE__*/ jsx("span", {
4244
+ className: "text-xs text-primary-400",
4245
+ children: "C\xf3digo copiado com sucesso"
4118
4246
  })
4119
4247
  ]
4120
4248
  }),
@@ -4122,31 +4250,31 @@ const AuthAtivarDesativarAuthenticator = ()=>{
4122
4250
  type: "text",
4123
4251
  value: codigoOtp,
4124
4252
  onChange: (e)=>setCodigoOtp(e.target.value),
4125
- placeholder: "Digite o c\xf3digo OTP do app",
4126
- className: "w-full border border-default-300 rounded-lg px-4 py-2 focus:ring-2 ring-primary-500 outline-none transition-all"
4253
+ placeholder: "C\xf3digo do app autenticador",
4254
+ className: "w-full rounded-lg border border-theme-border bg-theme-bg px-4 py-2.5 text-sm focus:ring-2 focus:ring-primary-600 outline-none"
4127
4255
  }),
4128
4256
  /*#__PURE__*/ jsx("button", {
4129
4257
  onClick: handleAtivar,
4130
4258
  disabled: carregando,
4131
- className: "w-full bg-primary-600 hover:bg-primary-700 text-white px-4 py-2 rounded-lg transition-all",
4132
- children: carregando ? "Ativando..." : "Ativar"
4259
+ className: "w-full rounded-lg bg-primary-600 hover:bg-primary-500 text-white text-sm font-medium py-2.5 transition disabled:opacity-60",
4260
+ children: carregando ? "Ativando..." : "Ativar autenticação"
4133
4261
  })
4134
4262
  ]
4135
4263
  }),
4136
4264
  ativado && /*#__PURE__*/ jsxs("div", {
4137
- className: "text-center space-y-3",
4265
+ className: "text-center space-y-2",
4138
4266
  children: [
4139
4267
  /*#__PURE__*/ jsx(CircleCheck, {
4140
- className: "w-10 h-10 text-green-600 mx-auto"
4268
+ className: "w-10 h-10 text-primary-400 mx-auto"
4141
4269
  }),
4142
4270
  /*#__PURE__*/ jsx("p", {
4143
- className: "text-green-700 font-medium",
4144
- children: "Autenticador ativado com sucesso!"
4271
+ className: "text-sm font-medium text-primary-300",
4272
+ children: "Autentica\xe7\xe3o ativada com sucesso"
4145
4273
  })
4146
4274
  ]
4147
4275
  }),
4148
4276
  erro && !mostrarSenhaStep && /*#__PURE__*/ jsx("p", {
4149
- className: "text-error-600 text-sm text-center",
4277
+ className: "text-error-400 text-xs text-center",
4150
4278
  children: erro
4151
4279
  })
4152
4280
  ]
@@ -4160,32 +4288,17 @@ function AuthAtivarDesativarAuthenticatorButton() {
4160
4288
  }
4161
4289
  return /*#__PURE__*/ jsxs(Fragment, {
4162
4290
  children: [
4163
- /*#__PURE__*/ jsxs("div", {
4164
- className: "px-4 py-3 space-y-2",
4291
+ /*#__PURE__*/ jsxs("button", {
4292
+ type: "button",
4293
+ onClick: abrirDrawer,
4294
+ className: "w-full flex items-center justify-between px-2 py-2 text-sm rounded-md text-zinc-700 dark:text-zinc-200 hover:bg-zinc-100 dark:hover:bg-zinc-800 transition",
4165
4295
  children: [
4166
- /*#__PURE__*/ jsxs("div", {
4167
- className: "flex items-center gap-2 text-sm font-medium text-zinc-900 dark:text-zinc-100",
4168
- children: [
4169
- /*#__PURE__*/ jsx(Shield, {
4170
- size: 18,
4171
- className: "text-zinc-500"
4172
- }),
4173
- "Seguran\xe7a"
4174
- ]
4296
+ /*#__PURE__*/ jsx("span", {
4297
+ children: "Autentica\xe7\xe3o em duas etapas"
4175
4298
  }),
4176
- /*#__PURE__*/ jsxs("button", {
4177
- type: "button",
4178
- onClick: abrirDrawer,
4179
- className: "w-full flex items-center justify-between px-2 py-2 text-sm rounded-md text-zinc-700 dark:text-zinc-200 hover:bg-zinc-100 dark:hover:bg-zinc-800 transition",
4180
- children: [
4181
- /*#__PURE__*/ jsx("span", {
4182
- children: "Autentica\xe7\xe3o em duas etapas"
4183
- }),
4184
- /*#__PURE__*/ jsx(ChevronRight, {
4185
- size: 14,
4186
- className: "text-zinc-400"
4187
- })
4188
- ]
4299
+ /*#__PURE__*/ jsx(ChevronRight, {
4300
+ size: 14,
4301
+ className: "text-zinc-400"
4189
4302
  })
4190
4303
  ]
4191
4304
  }),
@@ -4197,27 +4310,14 @@ function AuthAtivarDesativarAuthenticatorButton() {
4197
4310
  });
4198
4311
  }
4199
4312
  const TEMPO_COOLDOWN = 60;
4200
- const CHAVE_LS = "esqueci-senha-cooldown-ate";
4201
- function EsqueciMinhaSenha({ email: emailProp }) {
4202
- const location = useLocation();
4203
- const [search] = useSearchParams();
4204
- const emailDaNavegacao = location.state?.email;
4205
- const emailDaQuery = search.get("email") ?? void 0;
4206
- const emailDosParametros = useMemo(()=>emailProp ?? emailDaNavegacao ?? emailDaQuery, [
4207
- emailProp,
4208
- emailDaNavegacao,
4209
- emailDaQuery
4210
- ]);
4211
- const [emailInput, setEmailInput] = useState("");
4212
- const emailEfetivo = emailDosParametros ?? emailInput;
4213
- const [erroEmail, setErroEmail] = useState(null);
4313
+ const CHAVE_LS = "otp-email-cooldown-ate";
4314
+ function EnviarCodigoOtpEmail({ email, erroExterno, onConfirmarCodigo }) {
4214
4315
  const [erroEnvio, setErroEnvio] = useState(null);
4215
- const [erroOtp, setErroOtp] = useState(null);
4216
- const inputRef = useRef(null);
4316
+ const [erroOtpInterno, setErroOtpInterno] = useState(null);
4317
+ const erroOtp = erroExterno ?? erroOtpInterno;
4217
4318
  const [segundosRestantes, setSegundosRestantes] = useState(0);
4218
4319
  const intervaloRef = useRef(null);
4219
4320
  const [mostrarOtp, setMostrarOtp] = useState(false);
4220
- const [jaEnviouUmaVez, setJaEnviouUmaVez] = useState(false);
4221
4321
  const [otp, setOtp] = useState([
4222
4322
  "",
4223
4323
  "",
@@ -4227,6 +4327,7 @@ function EsqueciMinhaSenha({ email: emailProp }) {
4227
4327
  ""
4228
4328
  ]);
4229
4329
  const otpRefs = useRef([]);
4330
+ const emailValido = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
4230
4331
  useEffect(()=>{
4231
4332
  const ate = sessionStorage.getItem(CHAVE_LS);
4232
4333
  if (ate) {
@@ -4234,10 +4335,10 @@ function EsqueciMinhaSenha({ email: emailProp }) {
4234
4335
  if (diff > 0) iniciarContagem(diff);
4235
4336
  else sessionStorage.removeItem(CHAVE_LS);
4236
4337
  }
4237
- }, []);
4238
- useEffect(()=>()=>{
4338
+ return ()=>{
4239
4339
  if (intervaloRef.current) window.clearInterval(intervaloRef.current);
4240
- }, []);
4340
+ };
4341
+ }, []);
4241
4342
  function iniciarContagem(inicio = TEMPO_COOLDOWN) {
4242
4343
  setSegundosRestantes(inicio);
4243
4344
  if (intervaloRef.current) window.clearInterval(intervaloRef.current);
@@ -4253,32 +4354,16 @@ function EsqueciMinhaSenha({ email: emailProp }) {
4253
4354
  });
4254
4355
  }, 1000);
4255
4356
  }
4256
- const emailValido = (v)=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(v);
4257
- function validarEmailAtual() {
4258
- if (!emailEfetivo) {
4259
- setErroEmail("Informe um e-mail.");
4260
- if (!emailDosParametros) inputRef.current?.focus();
4261
- return false;
4262
- }
4263
- if (!emailValido(emailEfetivo)) {
4264
- setErroEmail("E-mail inválido.");
4265
- if (!emailDosParametros) inputRef.current?.focus();
4266
- return false;
4267
- }
4268
- setErroEmail(null);
4269
- return true;
4270
- }
4271
- async function aoEnviar() {
4357
+ async function enviarCodigo() {
4358
+ if (!emailValido || segundosRestantes > 0) return;
4272
4359
  try {
4273
4360
  setErroEnvio(null);
4274
- setErroOtp(null);
4275
- if (!validarEmailAtual()) return;
4276
- if (segundosRestantes > 0) return;
4361
+ setErroOtpInterno(null);
4277
4362
  const dadosBody = {
4278
4363
  data: {
4279
4364
  codigo_verificacao_otp: {
4280
4365
  tipo_codigo: "email",
4281
- email: emailEfetivo
4366
+ email
4282
4367
  }
4283
4368
  }
4284
4369
  };
@@ -4291,7 +4376,6 @@ function EsqueciMinhaSenha({ email: emailProp }) {
4291
4376
  data: dadosBody
4292
4377
  });
4293
4378
  setMostrarOtp(true);
4294
- setJaEnviouUmaVez(true);
4295
4379
  setOtp([
4296
4380
  "",
4297
4381
  "",
@@ -4302,11 +4386,11 @@ function EsqueciMinhaSenha({ email: emailProp }) {
4302
4386
  ]);
4303
4387
  setTimeout(()=>otpRefs.current[0]?.focus(), 0);
4304
4388
  } catch {
4305
- setErroEnvio("Não foi possível enviar o código. Tente novamente");
4389
+ setErroEnvio("Não foi possível enviar o código. Tente novamente.");
4306
4390
  }
4307
4391
  }
4308
4392
  function handleOtpChange(i, val) {
4309
- setErroOtp(null);
4393
+ setErroOtpInterno(null);
4310
4394
  const only = val.replace(/\D/g, "");
4311
4395
  const novo = [
4312
4396
  ...otp
@@ -4320,10 +4404,97 @@ function EsqueciMinhaSenha({ email: emailProp }) {
4320
4404
  if ("ArrowLeft" === e.key && i > 0) otpRefs.current[i - 1]?.focus();
4321
4405
  if ("ArrowRight" === e.key && i < 5) otpRefs.current[i + 1]?.focus();
4322
4406
  }
4323
- async function confirmarCodigo() {
4407
+ function confirmarCodigo() {
4408
+ const codigo = otp.join("");
4409
+ if (6 !== codigo.length) return void setErroOtpInterno("Digite os 6 dígitos do código.");
4410
+ onConfirmarCodigo?.(codigo);
4411
+ }
4412
+ const otpCompleto = 6 === otp.join("").length;
4413
+ return /*#__PURE__*/ jsxs("div", {
4414
+ children: [
4415
+ /*#__PURE__*/ jsx("button", {
4416
+ type: "button",
4417
+ onClick: enviarCodigo,
4418
+ disabled: !emailValido || segundosRestantes > 0,
4419
+ className: "w-full mt-4 rounded-lg py-2 text-sm font-medium transition-all border border-primary-300 bg-transparent text-primary-600 hover:bg-primary-50 hover:border-primary-400 disabled:opacity-50 disabled:cursor-not-allowed",
4420
+ children: segundosRestantes > 0 ? `Reenviar em ${segundosRestantes}s` : "Enviar código por e-mail"
4421
+ }),
4422
+ erroEnvio && /*#__PURE__*/ jsx("p", {
4423
+ className: "text-xs text-error-600 mt-2",
4424
+ children: erroEnvio
4425
+ }),
4426
+ mostrarOtp && /*#__PURE__*/ jsxs("div", {
4427
+ className: "mt-8",
4428
+ children: [
4429
+ /*#__PURE__*/ jsx("label", {
4430
+ className: "text-sm font-medium text-basic-700 mb-2 block",
4431
+ children: "C\xf3digo de verifica\xe7\xe3o"
4432
+ }),
4433
+ /*#__PURE__*/ jsx("div", {
4434
+ className: "flex justify-between gap-2",
4435
+ children: otp.map((v, i)=>/*#__PURE__*/ jsx("input", {
4436
+ value: v,
4437
+ ref: (el)=>{
4438
+ otpRefs.current[i] = el;
4439
+ },
4440
+ maxLength: 1,
4441
+ inputMode: "numeric",
4442
+ pattern: "[0-9]*",
4443
+ onChange: (e)=>handleOtpChange(i, e.target.value),
4444
+ onKeyDown: (e)=>handleOtpKeyDown(i, e),
4445
+ className: `w-10 h-12 text-center text-lg font-semibold rounded-lg border outline-none transition-all ${erroOtp ? "border-error-500 focus:ring-2 ring-error-300" : "border-default-300 focus:border-primary-500 focus:ring-2 ring-primary-300"}`
4446
+ }, i))
4447
+ }),
4448
+ erroOtp && /*#__PURE__*/ jsx("p", {
4449
+ className: "text-xs text-error-600 mt-1",
4450
+ children: erroOtp
4451
+ }),
4452
+ /*#__PURE__*/ jsx("button", {
4453
+ type: "button",
4454
+ onClick: confirmarCodigo,
4455
+ disabled: !otpCompleto,
4456
+ className: `w-full mt-4 ${otpCompleto && "cursor-pointer" || "cursor-not-allowed"} bg-primary-600 hover:bg-primary-700 disabled:bg-primary-400 text-white font-medium rounded-lg py-2 transition-all`,
4457
+ children: "Confirmar c\xf3digo"
4458
+ })
4459
+ ]
4460
+ })
4461
+ ]
4462
+ });
4463
+ }
4464
+ function EsqueciMinhaSenha({ email: emailProp }) {
4465
+ const location = useLocation();
4466
+ const [search] = useSearchParams();
4467
+ const emailDaNavegacao = location.state?.email;
4468
+ const emailDaQuery = search.get("email") ?? void 0;
4469
+ const emailDosParametros = useMemo(()=>emailProp ?? emailDaNavegacao ?? emailDaQuery, [
4470
+ emailProp,
4471
+ emailDaNavegacao,
4472
+ emailDaQuery
4473
+ ]);
4474
+ const [erroOtp, setErroOtp] = useState("");
4475
+ const [emailInput, setEmailInput] = useState("");
4476
+ const [erroEmail, setErroEmail] = useState(null);
4477
+ const inputRef = useRef(null);
4478
+ const emailValido = (v)=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(v);
4479
+ function validarEmailAtual() {
4480
+ if (!emailEfetivo) {
4481
+ setErroEmail("Informe um e-mail.");
4482
+ inputRef.current?.focus();
4483
+ return false;
4484
+ }
4485
+ if (!emailValido(emailEfetivo)) {
4486
+ setErroEmail("E-mail inválido.");
4487
+ inputRef.current?.focus();
4488
+ return false;
4489
+ }
4490
+ setErroEmail(null);
4491
+ return true;
4492
+ }
4493
+ const emailBloqueado = Boolean(emailDosParametros && emailDosParametros.length > 0);
4494
+ const emailEfetivo = emailBloqueado ? emailDosParametros : emailInput;
4495
+ async function confirmarCodigo(codigo) {
4324
4496
  try {
4325
- const codigo = otp.join("");
4326
- if (6 !== codigo.length) return void setErroOtp("Digite os 6 dígitos do código.");
4497
+ if (6 !== codigo.length) return void setErroOtp("Quantidade de caracteres inválida!");
4327
4498
  const dadosBody = {
4328
4499
  data: {
4329
4500
  codigo_verificacao_otp: {
@@ -4334,18 +4505,19 @@ function EsqueciMinhaSenha({ email: emailProp }) {
4334
4505
  }
4335
4506
  }
4336
4507
  };
4337
- await contexto_contexto_usuario.api.entrar_com_codigo_otp(dadosBody);
4508
+ const resultado = await contexto_contexto_usuario.api.entrar_com_codigo_otp(dadosBody);
4509
+ console.log(resultado.data.message, "resultado");
4510
+ if (resultado?.data?.code == "WARNING") setErroOtp(resultado?.data?.message);
4338
4511
  } catch {
4339
- setErroOtp("Código inválido ou expirado.");
4512
+ setErroOtp("Erro ao verificar código otp!");
4340
4513
  }
4341
4514
  }
4342
- const otpCompleto = 6 === otp.join("").length;
4343
4515
  return /*#__PURE__*/ jsx("div", {
4344
4516
  className: "flex min-h-screen p-4 items-center justify-center bg-basic-50",
4345
4517
  children: /*#__PURE__*/ jsx("div", {
4346
4518
  className: "w-full max-w-md",
4347
4519
  children: /*#__PURE__*/ jsxs("div", {
4348
- className: "relative bg-white border border-default-200 rounded-xl p-6 min-h-[520px] shadow-sm",
4520
+ className: "bg-white border border-default-200 rounded-xl p-6 shadow-sm",
4349
4521
  children: [
4350
4522
  /*#__PURE__*/ jsxs("div", {
4351
4523
  className: "text-center mb-6",
@@ -4356,7 +4528,7 @@ function EsqueciMinhaSenha({ email: emailProp }) {
4356
4528
  }),
4357
4529
  /*#__PURE__*/ jsx("p", {
4358
4530
  className: "text-sm text-basic-600",
4359
- children: "Digite o e-mail da conta para entrar sem senha"
4531
+ children: "Digite o e-mail da conta para entrar sem senha!"
4360
4532
  }),
4361
4533
  /*#__PURE__*/ jsx("p", {
4362
4534
  className: "text-xs text-default-500",
@@ -4364,103 +4536,32 @@ function EsqueciMinhaSenha({ email: emailProp }) {
4364
4536
  })
4365
4537
  ]
4366
4538
  }),
4367
- /*#__PURE__*/ jsxs("div", {
4368
- className: "mt-6",
4369
- children: [
4370
- /*#__PURE__*/ jsx("label", {
4371
- htmlFor: "email",
4372
- className: "text-sm font-medium text-basic-700 mb-1 block",
4373
- children: "E-mail"
4374
- }),
4375
- /*#__PURE__*/ jsx("input", {
4376
- id: "email",
4377
- ref: inputRef,
4378
- type: "email",
4379
- placeholder: "seu@email.com",
4380
- value: emailDosParametros ?? emailInput,
4381
- onChange: (e)=>{
4382
- if (emailDosParametros) return;
4383
- setEmailInput(e.target.value);
4384
- if (erroEmail) emailValido(e.target.value) ? setErroEmail(null) : setErroEmail("E-mail inválido.");
4385
- },
4386
- onBlur: ()=>!emailDosParametros && validarEmailAtual(),
4387
- autoComplete: "email",
4388
- className: `w-full px-4 py-2 rounded-lg border text-sm outline-none transition-all ${erroEmail ? "border-error-500 focus:ring-2 ring-error-300" : "border-default-300 focus:border-primary-500 focus:ring-2 ring-primary-300"}`
4389
- }),
4390
- erroEmail && /*#__PURE__*/ jsx("p", {
4391
- className: "text-xs text-error-600 mt-1",
4392
- children: erroEmail
4393
- }),
4394
- !erroEmail && /*#__PURE__*/ jsx("p", {
4395
- className: "text-xs text-basic-600 mt-1",
4396
- children: mostrarOtp ? "Digite o código abaixo." : "Usaremos este e-mail para enviar o código."
4397
- }),
4398
- erroEnvio && /*#__PURE__*/ jsx("p", {
4399
- className: "text-xs text-error-600 mt-2",
4400
- children: erroEnvio
4401
- }),
4402
- !jaEnviouUmaVez && /*#__PURE__*/ jsx("button", {
4403
- type: "button",
4404
- onClick: aoEnviar,
4405
- disabled: segundosRestantes > 0,
4406
- className: "w-full mt-4 bg-primary-600 hover:bg-primary-700 disabled:bg-primary-400 text-white font-medium rounded-lg py-2 transition-all",
4407
- children: segundosRestantes > 0 ? `Reenviar em ${segundosRestantes}s` : "Enviar código por e-mail"
4408
- })
4409
- ]
4539
+ /*#__PURE__*/ jsx("label", {
4540
+ className: "text-sm font-medium text-basic-700 mb-1 block",
4541
+ children: "E-mail"
4410
4542
  }),
4411
- mostrarOtp && /*#__PURE__*/ jsxs("div", {
4412
- className: "mt-8",
4413
- children: [
4414
- /*#__PURE__*/ jsx("label", {
4415
- className: "text-sm font-medium text-basic-700 mb-2 block",
4416
- children: "C\xf3digo de verifica\xe7\xe3o"
4417
- }),
4418
- /*#__PURE__*/ jsx("div", {
4419
- className: "flex justify-between gap-2",
4420
- children: otp.map((v, i)=>/*#__PURE__*/ jsx("input", {
4421
- value: v,
4422
- ref: (el)=>{
4423
- otpRefs.current[i] = el;
4424
- },
4425
- maxLength: 1,
4426
- inputMode: "numeric",
4427
- pattern: "[0-9]*",
4428
- onChange: (e)=>handleOtpChange(i, e.target.value),
4429
- onKeyDown: (e)=>handleOtpKeyDown(i, e),
4430
- className: `w-10 h-12 text-center text-lg font-semibold rounded-lg border outline-none transition-all ${erroOtp ? "border-error-500 focus:ring-2 ring-error-300" : "border-default-300 focus:border-primary-500 focus:ring-2 ring-primary-300"}`
4431
- }, i))
4432
- }),
4433
- erroOtp && /*#__PURE__*/ jsx("p", {
4434
- className: "text-xs text-error-600 mt-1",
4435
- children: erroOtp
4436
- }),
4437
- /*#__PURE__*/ jsx("button", {
4438
- type: "button",
4439
- onClick: confirmarCodigo,
4440
- disabled: !otpCompleto,
4441
- className: "w-full mt-4 bg-primary-600 hover:bg-primary-700 disabled:bg-primary-400 text-white font-medium rounded-lg py-2 transition-all",
4442
- children: "Confirmar c\xf3digo"
4443
- }),
4444
- /*#__PURE__*/ jsxs("div", {
4445
- className: "text-xs text-basic-600 mt-3",
4446
- children: [
4447
- "N\xe3o recebeu?",
4448
- " ",
4449
- segundosRestantes > 0 ? /*#__PURE__*/ jsxs(Fragment, {
4450
- children: [
4451
- "Aguarde ",
4452
- segundosRestantes,
4453
- "s."
4454
- ]
4455
- }) : /*#__PURE__*/ jsx("button", {
4456
- type: "button",
4457
- onClick: aoEnviar,
4458
- className: "text-primary-600 hover:text-primary-700 font-medium ml-1",
4459
- children: "Reenviar c\xf3digo"
4460
- })
4461
- ]
4462
- })
4463
- ]
4543
+ /*#__PURE__*/ jsx("input", {
4544
+ ref: inputRef,
4545
+ type: "email",
4546
+ placeholder: "seu@email.com",
4547
+ value: emailBloqueado ? emailDosParametros : emailInput,
4548
+ onChange: (e)=>{
4549
+ if (emailBloqueado) return;
4550
+ setEmailInput(e.target.value);
4551
+ if (erroEmail && emailValido(e.target.value)) setErroEmail(null);
4552
+ },
4553
+ onBlur: ()=>!emailBloqueado && validarEmailAtual(),
4554
+ autoComplete: "email",
4555
+ className: `w-full px-4 py-2 rounded-lg border text-sm outline-none transition-all ${erroEmail ? "border-error-500 focus:ring-2 ring-error-300" : "border-default-300 focus:border-primary-500 focus:ring-2 ring-primary-300"}`
4556
+ }),
4557
+ erroEmail && /*#__PURE__*/ jsx("p", {
4558
+ className: "text-xs text-error-600 mt-1",
4559
+ children: erroEmail
4560
+ }),
4561
+ /*#__PURE__*/ jsx(EnviarCodigoOtpEmail, {
4562
+ email: emailEfetivo,
4563
+ onConfirmarCodigo: confirmarCodigo,
4564
+ erroExterno: erroOtp
4464
4565
  })
4465
4566
  ]
4466
4567
  })
@@ -18,7 +18,7 @@ declare namespace TypeControlerAutheticator {
18
18
  const InputSchema: z4.ZodObject<{
19
19
  data: z4.ZodObject<{
20
20
  autheticator: z4.ZodObject<{
21
- usuario_senha: z4.ZodString;
21
+ codigo_otp: z4.ZodString;
22
22
  }, z4.core.$strip>;
23
23
  }, z4.core.$strip>;
24
24
  }, z4.core.$strip>;
@@ -62,7 +62,7 @@ declare namespace TypeControlerAutheticator {
62
62
  type Response = AxiosResponse<t.Geral.Response.C.Output<Output>>;
63
63
  }
64
64
  namespace BuscarAuthenticatorPeloId {
65
- const route: "/api/usuario/auth/buscar_authenticator_pelo_id";
65
+ const route: "/api/usuario/auth/authenticator";
66
66
  const InputSchema: z4.ZodObject<{}, z4.core.$strip>;
67
67
  type Input = z4.infer<typeof InputSchema>;
68
68
  type Output = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@navservice/usuario",
3
- "version": "1.28.0",
3
+ "version": "1.29.0",
4
4
  "description": "Service de autenticação de usuários unificado",
5
5
  "type": "module",
6
6
  "main": "./build/lib/index.js",