diff --git a/packages/ui/src/containers/VerificationCode/use-sign-in-flow-code-verification.ts b/packages/ui/src/containers/VerificationCode/use-sign-in-flow-code-verification.ts index 39297673c..a22415384 100644 --- a/packages/ui/src/containers/VerificationCode/use-sign-in-flow-code-verification.ts +++ b/packages/ui/src/containers/VerificationCode/use-sign-in-flow-code-verification.ts @@ -15,7 +15,6 @@ import useErrorHandler from '@/hooks/use-error-handler'; import useRequiredProfileErrorHandler from '@/hooks/use-required-profile-error-handler'; import { useSieMethods } from '@/hooks/use-sie'; import type { VerificationCodeIdentifier } from '@/types'; -import { UserFlow } from '@/types'; import { formatPhoneNumberWithCountryCallingCode } from '@/utils/country-code'; import useGeneralVerificationCodeErrorHandler from './use-general-verification-code-error-handler'; @@ -40,7 +39,6 @@ const useSignInFlowCodeVerification = ( const requiredProfileErrorHandlers = useRequiredProfileErrorHandler({ replace: true, - flow: UserFlow.signIn, }); const showIdentifierErrorAlert = useIdentifierErrorAlert(); diff --git a/packages/ui/src/hooks/use-password-sign-in.ts b/packages/ui/src/hooks/use-password-sign-in.ts index 3528c7c28..c406e059e 100644 --- a/packages/ui/src/hooks/use-password-sign-in.ts +++ b/packages/ui/src/hooks/use-password-sign-in.ts @@ -5,7 +5,6 @@ import { signInWithPasswordIdentifier } from '@/apis/interaction'; import useApi from '@/hooks/use-api'; import type { ErrorHandlers } from '@/hooks/use-error-handler'; import useErrorHandler from '@/hooks/use-error-handler'; -import { UserFlow } from '@/types'; import useRequiredProfileErrorHandler from './use-required-profile-error-handler'; @@ -19,7 +18,7 @@ const usePasswordSignIn = () => { const handleError = useErrorHandler(); const asyncSignIn = useApi(signInWithPasswordIdentifier); - const requiredProfileErrorHandler = useRequiredProfileErrorHandler({ flow: UserFlow.signIn }); + const requiredProfileErrorHandler = useRequiredProfileErrorHandler(); const errorHandlers: ErrorHandlers = useMemo( () => ({ diff --git a/packages/ui/src/hooks/use-required-profile-error-handler.ts b/packages/ui/src/hooks/use-required-profile-error-handler.ts index cca83bc75..f7617720d 100644 --- a/packages/ui/src/hooks/use-required-profile-error-handler.ts +++ b/packages/ui/src/hooks/use-required-profile-error-handler.ts @@ -13,10 +13,9 @@ import { PageContext } from './use-page-context'; type Options = { replace?: boolean; linkSocial?: string; - flow?: UserFlow; }; -const useRequiredProfileErrorHandler = ({ replace, linkSocial, flow }: Options = {}) => { +const useRequiredProfileErrorHandler = ({ replace, linkSocial }: Options = {}) => { const navigate = useNavigate(); const { setToast } = useContext(PageContext); @@ -42,7 +41,7 @@ const useRequiredProfileErrorHandler = ({ replace, linkSocial, flow }: Options = { pathname: `/${UserFlow.continue}/${missingProfile}`, }, - { replace, state: { flow } } + { replace } ); break; } @@ -54,7 +53,7 @@ const useRequiredProfileErrorHandler = ({ replace, linkSocial, flow }: Options = pathname: `/${UserFlow.continue}/${missingProfile}`, search: linkSocialQueryString, }, - { replace, state: { registeredSocialIdentity, flow } } + { replace, state: { registeredSocialIdentity } } ); break; } @@ -66,7 +65,7 @@ const useRequiredProfileErrorHandler = ({ replace, linkSocial, flow }: Options = } }, }), - [flow, linkSocial, navigate, replace, setToast] + [linkSocial, navigate, replace, setToast] ); return requiredProfileErrorHandler; diff --git a/packages/ui/src/hooks/use-social-sign-in-listener.ts b/packages/ui/src/hooks/use-social-sign-in-listener.ts index e32afe033..b7357aade 100644 --- a/packages/ui/src/hooks/use-social-sign-in-listener.ts +++ b/packages/ui/src/hooks/use-social-sign-in-listener.ts @@ -6,7 +6,6 @@ import { useNavigate } from 'react-router-dom'; import { validate } from 'superstruct'; import { signInWithSocial } from '@/apis/interaction'; -import { UserFlow } from '@/types'; import { socialAccountNotExistErrorDataGuard } from '@/types/guard'; import { parseQueryParameters } from '@/utils'; import { stateValidation } from '@/utils/social-connectors'; @@ -55,7 +54,6 @@ const useSocialSignInListener = (connectorId?: string) => { ); const requiredProfileErrorHandlers = useRequiredProfileErrorHandler({ replace: true, - flow: UserFlow.signIn, }); const signInWithSocialErrorHandlers: ErrorHandlers = useMemo( () => ({ diff --git a/packages/ui/src/pages/Continue/index.tsx b/packages/ui/src/pages/Continue/index.tsx index 109a0ea4b..1e747b8e1 100644 --- a/packages/ui/src/pages/Continue/index.tsx +++ b/packages/ui/src/pages/Continue/index.tsx @@ -1,11 +1,7 @@ import { MissingProfile } from '@logto/schemas'; -import { conditional } from '@silverhand/essentials'; -import { useLocation, useParams } from 'react-router-dom'; -import { validate } from 'superstruct'; +import { useParams } from 'react-router-dom'; import ErrorPage from '@/pages/ErrorPage'; -import { UserFlow } from '@/types'; -import { continueFlowStateGuard } from '@/types/guard'; import SetEmailOrPhone from './SetEmailOrPhone'; import SetPassword from './SetPassword'; @@ -17,20 +13,13 @@ type Parameters = { const Continue = () => { const { method = '' } = useParams(); - const { state } = useLocation(); - - const [_, data] = validate(state, continueFlowStateGuard); - - const notification = conditional( - data?.flow === UserFlow.signIn && 'description.continue_with_more_information' - ); if (method === MissingProfile.password) { - return ; + return ; } if (method === MissingProfile.username) { - return ; + return ; } if ( @@ -38,7 +27,7 @@ const Continue = () => { method === MissingProfile.phone || method === MissingProfile.emailOrPhone ) { - return ; + return ; } return ; diff --git a/packages/ui/src/types/guard.ts b/packages/ui/src/types/guard.ts index b6084e161..e26b32e0e 100644 --- a/packages/ui/src/types/guard.ts +++ b/packages/ui/src/types/guard.ts @@ -16,13 +16,6 @@ export const passwordIdentifierStateGuard = s.object({ value: s.string(), }); -/* Continue Flow */ -export const continueFlowStateGuard = s.optional( - s.type({ - flow: userFlowGuard, - }) -); - /* Verification Code Flow Guard */ const verificationCodeMethodGuard = s.union([ s.literal(SignInIdentifier.Email),