@greatapps/common 1.1.552 → 1.1.553
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/account/hooks/useDisableTwoFactorAuthForm.mjs +2 -0
- package/dist/components/account/hooks/useDisableTwoFactorAuthForm.mjs.map +1 -1
- package/dist/components/account/hooks/useTwoFactorAuthForm.mjs +1 -0
- package/dist/components/account/hooks/useTwoFactorAuthForm.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/account/hooks/useDisableTwoFactorAuthForm.tsx +2 -0
- package/src/components/account/hooks/useTwoFactorAuthForm.tsx +1 -0
|
@@ -19,6 +19,7 @@ function useDisableTwoFactorAuthForm({
|
|
|
19
19
|
mutationFn: (otpCode) => disableTwoFactorAction(otpCode),
|
|
20
20
|
onSuccess: (result) => {
|
|
21
21
|
if (!result.success) {
|
|
22
|
+
setCode("");
|
|
22
23
|
toast.custom((t) => /* @__PURE__ */ jsx(Toast, { variant: "error", message: result.error ?? "C\xF3digo inv\xE1lido", toastId: t }));
|
|
23
24
|
return;
|
|
24
25
|
}
|
|
@@ -28,6 +29,7 @@ function useDisableTwoFactorAuthForm({
|
|
|
28
29
|
onSuccess?.();
|
|
29
30
|
},
|
|
30
31
|
onError: () => {
|
|
32
|
+
setCode("");
|
|
31
33
|
toast.custom((t) => /* @__PURE__ */ jsx(Toast, { variant: "error", message: "Erro ao desabilitar 2FA. Tente novamente.", toastId: t }));
|
|
32
34
|
}
|
|
33
35
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/account/hooks/useDisableTwoFactorAuthForm.tsx"],"sourcesContent":["'use client';\r\n\r\nimport { useState, useCallback } from 'react';\r\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\r\nimport { toast } from 'sonner';\r\nimport { Toast } from '../../ui/feedback/Toast';\r\nimport { USER_QUERY_KEY } from '../../../modules/auth/hooks/useUserQuery';\r\nimport { disableTwoFactorAction } from '../../../modules/accounts/actions/account-management.action';\r\nimport { useWlQueryKey } from '../../../hooks/useAuthQueryKey';\r\n\r\ninterface UseDisableTwoFactorAuthFormProps {\r\n onClose: () => void;\r\n onSuccess?: () => void;\r\n}\r\n\r\nexport default function useDisableTwoFactorAuthForm({\r\n onClose,\r\n onSuccess,\r\n}: UseDisableTwoFactorAuthFormProps) {\r\n const [code, setCode] = useState('');\r\n const queryClient = useQueryClient();\r\n const userKey = useWlQueryKey([...USER_QUERY_KEY]);\r\n\r\n const isValid = code.length === 6;\r\n\r\n const mutation = useMutation({\r\n mutationFn: (otpCode: string) => disableTwoFactorAction(otpCode),\r\n onSuccess: (result) => {\r\n if (!result.success) {\r\n toast.custom((t) => (\r\n <Toast variant=\"error\" message={result.error ?? 'Código inválido'} toastId={t} />\r\n ));\r\n return;\r\n }\r\n\r\n queryClient.invalidateQueries({ queryKey: userKey });\r\n toast.custom((t) => (\r\n <Toast variant=\"success\" message=\"Autenticação de dois fatores desabilitada\" toastId={t} />\r\n ));\r\n setCode('');\r\n onSuccess?.();\r\n },\r\n onError: () => {\r\n toast.custom((t) => (\r\n <Toast variant=\"error\" message=\"Erro ao desabilitar 2FA. Tente novamente.\" toastId={t} />\r\n ));\r\n },\r\n });\r\n\r\n const { mutate, reset } = mutation;\r\n\r\n const handleClose = useCallback(() => {\r\n setCode('');\r\n reset();\r\n onClose();\r\n }, [onClose, reset]);\r\n\r\n const handleSubmit = useCallback(() => {\r\n if (!isValid) return;\r\n mutate(code);\r\n }, [code, isValid, mutate]);\r\n\r\n return {\r\n code,\r\n setCode,\r\n isValid,\r\n isLoading: mutation.isPending,\r\n handleClose,\r\n handleSubmit,\r\n };\r\n}\r\n"],"mappings":";
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/account/hooks/useDisableTwoFactorAuthForm.tsx"],"sourcesContent":["'use client';\r\n\r\nimport { useState, useCallback } from 'react';\r\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\r\nimport { toast } from 'sonner';\r\nimport { Toast } from '../../ui/feedback/Toast';\r\nimport { USER_QUERY_KEY } from '../../../modules/auth/hooks/useUserQuery';\r\nimport { disableTwoFactorAction } from '../../../modules/accounts/actions/account-management.action';\r\nimport { useWlQueryKey } from '../../../hooks/useAuthQueryKey';\r\n\r\ninterface UseDisableTwoFactorAuthFormProps {\r\n onClose: () => void;\r\n onSuccess?: () => void;\r\n}\r\n\r\nexport default function useDisableTwoFactorAuthForm({\r\n onClose,\r\n onSuccess,\r\n}: UseDisableTwoFactorAuthFormProps) {\r\n const [code, setCode] = useState('');\r\n const queryClient = useQueryClient();\r\n const userKey = useWlQueryKey([...USER_QUERY_KEY]);\r\n\r\n const isValid = code.length === 6;\r\n\r\n const mutation = useMutation({\r\n mutationFn: (otpCode: string) => disableTwoFactorAction(otpCode),\r\n onSuccess: (result) => {\r\n if (!result.success) {\r\n setCode('');\r\n toast.custom((t) => (\r\n <Toast variant=\"error\" message={result.error ?? 'Código inválido'} toastId={t} />\r\n ));\r\n return;\r\n }\r\n\r\n queryClient.invalidateQueries({ queryKey: userKey });\r\n toast.custom((t) => (\r\n <Toast variant=\"success\" message=\"Autenticação de dois fatores desabilitada\" toastId={t} />\r\n ));\r\n setCode('');\r\n onSuccess?.();\r\n },\r\n onError: () => {\r\n setCode('');\r\n toast.custom((t) => (\r\n <Toast variant=\"error\" message=\"Erro ao desabilitar 2FA. Tente novamente.\" toastId={t} />\r\n ));\r\n },\r\n });\r\n\r\n const { mutate, reset } = mutation;\r\n\r\n const handleClose = useCallback(() => {\r\n setCode('');\r\n reset();\r\n onClose();\r\n }, [onClose, reset]);\r\n\r\n const handleSubmit = useCallback(() => {\r\n if (!isValid) return;\r\n mutate(code);\r\n }, [code, isValid, mutate]);\r\n\r\n return {\r\n code,\r\n setCode,\r\n isValid,\r\n isLoading: mutation.isPending,\r\n handleClose,\r\n handleSubmit,\r\n };\r\n}\r\n"],"mappings":";AA+BU;AA7BV,SAAS,UAAU,mBAAmB;AACtC,SAAS,aAAa,sBAAsB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AAAA,IACA,WAAW,SAAS;AAAA,IACpB;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
|
|
@@ -25,6 +25,7 @@ function useTwoFactorAuthForm({ onSuccess, open } = {}) {
|
|
|
25
25
|
setStep("recovery");
|
|
26
26
|
},
|
|
27
27
|
onError: () => {
|
|
28
|
+
setCode("");
|
|
28
29
|
toast.custom((t) => /* @__PURE__ */ jsx(Toast, { variant: "error", message: "Erro ao confirmar c\xF3digo. Tente novamente.", toastId: t }));
|
|
29
30
|
}
|
|
30
31
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/account/hooks/useTwoFactorAuthForm.tsx"],"sourcesContent":["'use client';\n\nimport { useState, useCallback, useEffect } from 'react';\nimport { useMutation } from '@tanstack/react-query';\nimport { toast } from 'sonner';\nimport { Toast } from '../../ui/feedback/Toast';\nimport { copyToClipboard } from '../../../utils/browser/clipboard';\nimport {\n generateTwoFactorAction,\n confirmTwoFactorAction,\n} from '../../../modules/accounts/actions/account-management.action';\nimport { withAction } from '../../../utils/withAction';\n\ntype Step = 'code' | 'recovery';\n\ninterface UseTwoFactorAuthFormProps {\n onSuccess?: () => void;\n open?: boolean;\n}\n\nexport default function useTwoFactorAuthForm({ onSuccess, open }: UseTwoFactorAuthFormProps = {}) {\n const [code, setCode] = useState('');\n const [step, setStep] = useState<Step>('code');\n\n const generateMutation = useMutation({\n mutationFn: withAction(generateTwoFactorAction),\n onError: () => {\n toast.custom((t) => (\n <Toast variant=\"error\" message=\"Erro ao gerar QR Code. Tente novamente.\" toastId={t} />\n ));\n },\n });\n\n const confirmMutation = useMutation({\n mutationFn: withAction(confirmTwoFactorAction),\n onSuccess: () => {\n setStep('recovery');\n },\n onError: () => {\n toast.custom((t) => (\n <Toast variant=\"error\" message=\"Erro ao confirmar código. Tente novamente.\" toastId={t} />\n ));\n },\n });\n\n const { mutate: triggerGenerate } = generateMutation;\n\n useEffect(() => {\n if (open) {\n triggerGenerate();\n }\n }, [open, triggerGenerate]);\n\n const generateFailed = generateMutation.isError;\n\n const isCodeComplete = code.length === 6;\n\n const handleSubmit = () => {\n if (!isCodeComplete) return;\n confirmMutation.mutate(code);\n };\n\n const handleFinalize = () => {\n onSuccess?.();\n setTimeout(resetForm, 300);\n };\n\n const handleCopyCodes = useCallback(async () => {\n const codes = generateMutation.data?.backupCodes ?? [];\n const success = await copyToClipboard(codes.join('\\n'));\n if (success) {\n toast.custom((t) => (\n <Toast variant=\"success\" message=\"Códigos copiados com sucesso\" toastId={t} />\n ));\n }\n }, [generateMutation.data]);\n\n const resetForm = () => {\n setCode('');\n setStep('code');\n generateMutation.reset();\n confirmMutation.reset();\n };\n\n return {\n code,\n setCode,\n isCodeComplete,\n isGenerating: generateMutation.isPending,\n isConfirming: confirmMutation.isPending,\n generateFailed,\n retryGenerate: triggerGenerate,\n qrcode: generateMutation.data?.qrcode,\n backupCodes: generateMutation.data?.backupCodes ?? [],\n step,\n handleSubmit,\n handleFinalize,\n handleCopyCodes,\n resetForm,\n };\n}\n"],"mappings":";AA4BQ;AA1BR,SAAS,UAAU,aAAa,iBAAiB;AACjD,SAAS,mBAAmB;AAC5B,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,kBAAkB;AASZ,SAAR,qBAAsC,EAAE,WAAW,KAAK,IAA+B,CAAC,GAAG;AAChG,QAAM,CAAC,MAAM,OAAO,IAAI,SAAS,EAAE;AACnC,QAAM,CAAC,MAAM,OAAO,IAAI,SAAe,MAAM;AAE7C,QAAM,mBAAmB,YAAY;AAAA,IACnC,YAAY,WAAW,uBAAuB;AAAA,IAC9C,SAAS,MAAM;AACb,YAAM,OAAO,CAAC,MACZ,oBAAC,SAAM,SAAQ,SAAQ,SAAQ,2CAA0C,SAAS,GAAG,CACtF;AAAA,IACH;AAAA,EACF,CAAC;AAED,QAAM,kBAAkB,YAAY;AAAA,IAClC,YAAY,W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;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/account/hooks/useTwoFactorAuthForm.tsx"],"sourcesContent":["'use client';\n\nimport { useState, useCallback, useEffect } from 'react';\nimport { useMutation } from '@tanstack/react-query';\nimport { toast } from 'sonner';\nimport { Toast } from '../../ui/feedback/Toast';\nimport { copyToClipboard } from '../../../utils/browser/clipboard';\nimport {\n generateTwoFactorAction,\n confirmTwoFactorAction,\n} from '../../../modules/accounts/actions/account-management.action';\nimport { withAction } from '../../../utils/withAction';\n\ntype Step = 'code' | 'recovery';\n\ninterface UseTwoFactorAuthFormProps {\n onSuccess?: () => void;\n open?: boolean;\n}\n\nexport default function useTwoFactorAuthForm({ onSuccess, open }: UseTwoFactorAuthFormProps = {}) {\n const [code, setCode] = useState('');\n const [step, setStep] = useState<Step>('code');\n\n const generateMutation = useMutation({\n mutationFn: withAction(generateTwoFactorAction),\n onError: () => {\n toast.custom((t) => (\n <Toast variant=\"error\" message=\"Erro ao gerar QR Code. Tente novamente.\" toastId={t} />\n ));\n },\n });\n\n const confirmMutation = useMutation({\n mutationFn: withAction(confirmTwoFactorAction),\n onSuccess: () => {\n setStep('recovery');\n },\n onError: () => {\n setCode('');\n toast.custom((t) => (\n <Toast variant=\"error\" message=\"Erro ao confirmar código. Tente novamente.\" toastId={t} />\n ));\n },\n });\n\n const { mutate: triggerGenerate } = generateMutation;\n\n useEffect(() => {\n if (open) {\n triggerGenerate();\n }\n }, [open, triggerGenerate]);\n\n const generateFailed = generateMutation.isError;\n\n const isCodeComplete = code.length === 6;\n\n const handleSubmit = () => {\n if (!isCodeComplete) return;\n confirmMutation.mutate(code);\n };\n\n const handleFinalize = () => {\n onSuccess?.();\n setTimeout(resetForm, 300);\n };\n\n const handleCopyCodes = useCallback(async () => {\n const codes = generateMutation.data?.backupCodes ?? [];\n const success = await copyToClipboard(codes.join('\\n'));\n if (success) {\n toast.custom((t) => (\n <Toast variant=\"success\" message=\"Códigos copiados com sucesso\" toastId={t} />\n ));\n }\n }, [generateMutation.data]);\n\n const resetForm = () => {\n setCode('');\n setStep('code');\n generateMutation.reset();\n confirmMutation.reset();\n };\n\n return {\n code,\n setCode,\n isCodeComplete,\n isGenerating: generateMutation.isPending,\n isConfirming: confirmMutation.isPending,\n generateFailed,\n retryGenerate: triggerGenerate,\n qrcode: generateMutation.data?.qrcode,\n backupCodes: generateMutation.data?.backupCodes ?? [],\n step,\n handleSubmit,\n handleFinalize,\n handleCopyCodes,\n resetForm,\n };\n}\n"],"mappings":";AA4BQ;AA1BR,SAAS,UAAU,aAAa,iBAAiB;AACjD,SAAS,mBAAmB;AAC5B,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,kBAAkB;AASZ,SAAR,qBAAsC,EAAE,WAAW,KAAK,IAA+B,CAAC,GAAG;AAChG,QAAM,CAAC,MAAM,OAAO,IAAI,SAAS,EAAE;AACnC,QAAM,CAAC,MAAM,OAAO,IAAI,SAAe,MAAM;AAE7C,QAAM,mBAAmB,YAAY;AAAA,IACnC,YAAY,WAAW,uBAAuB;AAAA,IAC9C,SAAS,MAAM;AACb,YAAM,OAAO,CAAC,MACZ,oBAAC,SAAM,SAAQ,SAAQ,SAAQ,2CAA0C,SAAS,GAAG,CACtF;AAAA,IACH;AAAA,EACF,CAAC;AAED,QAAM,kBAAkB,YAAY;AAAA,IAClC,YAAY,WAAW,sBAAsB;AAAA,IAC7C,WAAW,MAAM;AACf,cAAQ,UAAU;AAAA,IACpB;AAAA,IACA,SAAS,MAAM;AACb,cAAQ,EAAE;AACV,YAAM,OAAO,CAAC,MACZ,oBAAC,SAAM,SAAQ,SAAQ,SAAQ,iDAA6C,SAAS,GAAG,CACzF;AAAA,IACH;AAAA,EACF,CAAC;AAED,QAAM,EAAE,QAAQ,gBAAgB,IAAI;AAEpC,YAAU,MAAM;AACd,QAAI,MAAM;AACR,sBAAgB;AAAA,IAClB;AAAA,EACF,GAAG,CAAC,MAAM,eAAe,CAAC;AAE1B,QAAM,iBAAiB,iBAAiB;AAExC,QAAM,iBAAiB,KAAK,WAAW;AAEvC,QAAM,eAAe,MAAM;AACzB,QAAI,CAAC,eAAgB;AACrB,oBAAgB,OAAO,IAAI;AAAA,EAC7B;AAEA,QAAM,iBAAiB,MAAM;AAC3B,gBAAY;AACZ,eAAW,WAAW,GAAG;AAAA,EAC3B;AAEA,QAAM,kBAAkB,YAAY,YAAY;AAC9C,UAAM,QAAQ,iBAAiB,MAAM,eAAe,CAAC;AACrD,UAAM,UAAU,MAAM,gBAAgB,MAAM,KAAK,IAAI,CAAC;AACtD,QAAI,SAAS;AACX,YAAM,OAAO,CAAC,MACZ,oBAAC,SAAM,SAAQ,WAAU,SAAQ,mCAA+B,SAAS,GAAG,CAC7E;AAAA,IACH;AAAA,EACF,GAAG,CAAC,iBAAiB,IAAI,CAAC;AAE1B,QAAM,YAAY,MAAM;AACtB,YAAQ,EAAE;AACV,YAAQ,MAAM;AACd,qBAAiB,MAAM;AACvB,oBAAgB,MAAM;AAAA,EACxB;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,cAAc,iBAAiB;AAAA,IAC/B,cAAc,gBAAgB;AAAA,IAC9B;AAAA,IACA,eAAe;AAAA,IACf,QAAQ,iBAAiB,MAAM;AAAA,IAC/B,aAAa,iBAAiB,MAAM,eAAe,CAAC;AAAA,IACpD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -27,6 +27,7 @@ export default function useDisableTwoFactorAuthForm({
|
|
|
27
27
|
mutationFn: (otpCode: string) => disableTwoFactorAction(otpCode),
|
|
28
28
|
onSuccess: (result) => {
|
|
29
29
|
if (!result.success) {
|
|
30
|
+
setCode('');
|
|
30
31
|
toast.custom((t) => (
|
|
31
32
|
<Toast variant="error" message={result.error ?? 'Código inválido'} toastId={t} />
|
|
32
33
|
));
|
|
@@ -41,6 +42,7 @@ export default function useDisableTwoFactorAuthForm({
|
|
|
41
42
|
onSuccess?.();
|
|
42
43
|
},
|
|
43
44
|
onError: () => {
|
|
45
|
+
setCode('');
|
|
44
46
|
toast.custom((t) => (
|
|
45
47
|
<Toast variant="error" message="Erro ao desabilitar 2FA. Tente novamente." toastId={t} />
|
|
46
48
|
));
|
|
@@ -37,6 +37,7 @@ export default function useTwoFactorAuthForm({ onSuccess, open }: UseTwoFactorAu
|
|
|
37
37
|
setStep('recovery');
|
|
38
38
|
},
|
|
39
39
|
onError: () => {
|
|
40
|
+
setCode('');
|
|
40
41
|
toast.custom((t) => (
|
|
41
42
|
<Toast variant="error" message="Erro ao confirmar código. Tente novamente." toastId={t} />
|
|
42
43
|
));
|