diff --git a/packages/common/src/constants.ts b/packages/common/src/constants.ts index bfaf1d4b8..953face35 100644 --- a/packages/common/src/constants.ts +++ b/packages/common/src/constants.ts @@ -75,8 +75,6 @@ export const DEFAULT_FEATURES = { watchListSizeLimit: MAX_WATCHLIST_ITEMS_COUNT, }; -export const simultaneousLoginWarningKey = 'simultaneous_logins'; - export const EPG_TYPE = { jwp: 'jwp', viewNexa: 'viewnexa', diff --git a/packages/ui-react/src/components/LoginForm/LoginForm.test.tsx b/packages/ui-react/src/components/LoginForm/LoginForm.test.tsx index c1f15c208..fd05a29f5 100644 --- a/packages/ui-react/src/components/LoginForm/LoginForm.test.tsx +++ b/packages/ui-react/src/components/LoginForm/LoginForm.test.tsx @@ -40,7 +40,6 @@ describe('', () => { errors={{}} socialLoginURLs={socialLoginURLs} submitting={false} - messageKey={null} />, { wrapper: createWrapper() }, ); @@ -62,7 +61,6 @@ describe('', () => { errors={{}} socialLoginURLs={null} submitting={false} - messageKey={null} />, { wrapper: createWrapper() }, ); @@ -85,7 +83,6 @@ describe('', () => { errors={{ email: 'Email error', password: 'Password error', form: 'Form error' }} socialLoginURLs={null} submitting={false} - messageKey={null} />, { wrapper: createWrapper() }, ); @@ -109,7 +106,6 @@ describe('', () => { errors={{}} socialLoginURLs={null} submitting={true} - messageKey={null} />, { wrapper: createWrapper() }, ); @@ -133,7 +129,6 @@ describe('', () => { errors={{}} socialLoginURLs={null} submitting={true} - messageKey={null} />, { wrapper: createWrapper() }, ); @@ -161,7 +156,6 @@ describe('', () => { errors={{}} socialLoginURLs={null} submitting={true} - messageKey={null} />, { wrapper: createWrapper() }, ); diff --git a/packages/ui-react/src/components/LoginForm/LoginForm.tsx b/packages/ui-react/src/components/LoginForm/LoginForm.tsx index 42a586471..927ba540f 100644 --- a/packages/ui-react/src/components/LoginForm/LoginForm.tsx +++ b/packages/ui-react/src/components/LoginForm/LoginForm.tsx @@ -6,7 +6,6 @@ import type { LoginFormData } from '@jwp/ott-common/types/account'; import { testId } from '@jwp/ott-common/src/utils/common'; import useToggle from '@jwp/ott-hooks-react/src/useToggle'; import type { SocialLoginURLs } from '@jwp/ott-hooks-react/src/useSocialLoginUrls'; -import { simultaneousLoginWarningKey } from '@jwp/ott-common/src/constants'; import Visibility from '@jwp/ott-theme/assets/icons/visibility.svg?react'; import VisibilityOff from '@jwp/ott-theme/assets/icons/visibility_off.svg?react'; @@ -32,29 +31,15 @@ type Props = { submitting: boolean; socialLoginURLs: SocialLoginURLs | null; siteName?: string; - messageKey: string | null; }; -const LoginForm: React.FC = ({ onSubmit, onChange, socialLoginURLs, values, errors, validationError, submitting, siteName, messageKey }: Props) => { +const LoginForm: React.FC = ({ onSubmit, onChange, socialLoginURLs, values, errors, validationError, submitting, siteName }: Props) => { const [viewPassword, toggleViewPassword] = useToggle(); const { t } = useTranslation('account'); const location = useLocation(); - const getTranslatedErrorMessage = (messageId: string | null) => { - switch (messageId) { - case simultaneousLoginWarningKey: - return t('login.simultaneous_logins'); - } - return t('login.unexpected_error'); - }; - return (
- {messageKey && ( -
- {getTranslatedErrorMessage(messageKey)} -
- )} {errors.form ? ( {errors.form} diff --git a/packages/ui-react/src/containers/AccountModal/AccountModal.tsx b/packages/ui-react/src/containers/AccountModal/AccountModal.tsx index 97bdea9e7..68e4ccfd4 100644 --- a/packages/ui-react/src/containers/AccountModal/AccountModal.tsx +++ b/packages/ui-react/src/containers/AccountModal/AccountModal.tsx @@ -31,7 +31,7 @@ import Login from './forms/Login'; import styles from './AccountModal.module.scss'; // @todo: connect with route typings -const PUBLIC_VIEWS = ['login', 'create-account', 'forgot-password', 'reset-password', 'send-confirmation', 'edit-password', 'simultaneous-logins']; +const PUBLIC_VIEWS = ['login', 'create-account', 'forgot-password', 'reset-password', 'send-confirmation', 'edit-password']; export type AccountModals = { login: 'login'; @@ -108,7 +108,7 @@ const AccountModal = () => { switch (view) { case 'login': - return ; + return ; case 'create-account': return ; case 'personal-details': diff --git a/packages/ui-react/src/containers/AccountModal/forms/Login.tsx b/packages/ui-react/src/containers/AccountModal/forms/Login.tsx index d477bf5e0..7d016a11b 100644 --- a/packages/ui-react/src/containers/AccountModal/forms/Login.tsx +++ b/packages/ui-react/src/containers/AccountModal/forms/Login.tsx @@ -13,11 +13,7 @@ import type { LoginFormData } from '@jwp/ott-common/types/account'; import LoginForm from '../../../components/LoginForm/LoginForm'; import { useAriaAnnouncer } from '../../AnnouncementProvider/AnnoucementProvider'; -type Props = { - messageKey: string | null; -}; - -const Login: React.FC = ({ messageKey }: Props) => { +const Login = () => { const accountController = getModule(AccountController); const { siteName } = useConfigStore((s) => s.config); @@ -53,7 +49,6 @@ const Login: React.FC = ({ messageKey }: Props) => { submitting={submitting} siteName={siteName} socialLoginURLs={socialLoginURLs} - messageKey={messageKey} onSubmit={handleSubmit} onChange={handleChange} /> diff --git a/platforms/web/public/locales/en/account.json b/platforms/web/public/locales/en/account.json index d1a5f837e..42c026fec 100644 --- a/platforms/web/public/locales/en/account.json +++ b/platforms/web/public/locales/en/account.json @@ -89,7 +89,6 @@ "sign_in": "Sign in", "sign_in_success": "Sign in successful", "sign_up": "Sign up", - "simultaneous_logins": "The maximum number of active sessions for this account has been reached. Signing in here will sign you out from another session or device.", "twitter": "Sign in with Twitter", "unexpected_error": "An unexpected error occurred.", "view_password": "View password", diff --git a/platforms/web/public/locales/es/account.json b/platforms/web/public/locales/es/account.json index ab871dec2..293720a96 100644 --- a/platforms/web/public/locales/es/account.json +++ b/platforms/web/public/locales/es/account.json @@ -95,7 +95,6 @@ "sign_in": "Iniciar sesión", "sign_in_success": "Has iniciado sesión correctamente.", "sign_up": "Registrarse", - "simultaneous_logins": "Se ha alcanzado el número máximo de sesiones activas para esta cuenta. Iniciar sesión aquí lo cerrará en otra sesión o dispositivo.", "twitter": "Inicia sesión con Twitter", "unexpected_error": "Ocurrió un error inesperado.", "view_password": "Ver contraseña", diff --git a/platforms/web/src/hooks/useNotifications.ts b/platforms/web/src/hooks/useNotifications.ts index 35b9fd2ef..6de5aa374 100644 --- a/platforms/web/src/hooks/useNotifications.ts +++ b/platforms/web/src/hooks/useNotifications.ts @@ -3,7 +3,6 @@ import { useLocation, useNavigate } from 'react-router'; import { getModule } from '@jwp/ott-common/src/modules/container'; import AccountController from '@jwp/ott-common/src/controllers/AccountController'; import { queryClient } from '@jwp/ott-ui-react/src/containers/QueryProvider/QueryProvider'; -import { simultaneousLoginWarningKey } from '@jwp/ott-common/src/constants'; import { modalURLFromLocation } from '@jwp/ott-ui-react/src/utils/location'; import { useAccountStore } from '@jwp/ott-common/src/stores/AccountStore'; import useEventCallback from '@jwp/ott-hooks-react/src/useEventCallback'; @@ -63,15 +62,6 @@ export default function useNotifications() { case NotificationsTypes.SUBSCRIBE_REQUIRES_ACTION: window.location.href = notification.resource?.redirect_to_url; break; - case NotificationsTypes.ACCOUNT_LOGOUT: - try { - await accountController?.logout(); - } finally { - if (notification.resource?.reason === 'sessions_limit') { - navigateToModal('login', { message: simultaneousLoginWarningKey }); - } - } - break; default: break; }