From 8d6a67e67d06c83846c5c8a06b23f613980ac652 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Tue, 25 Oct 2022 17:00:23 -0600 Subject: [PATCH] Fully move auth types to js-sdk (#9499) * Fully move auth types to js-sdk The SSO buttons were the only consumer of these types, so let's just move them. They've been in the js-sdk for a while now, and webpack is screaming about missing exports (because they're all interfaces and types, which don't exist after transpiling). * Fix the other cases too --- src/Login.ts | 7 ------- src/components/structures/auth/Login.tsx | 3 ++- src/components/structures/auth/Registration.tsx | 3 ++- src/components/structures/auth/SoftLogout.tsx | 3 ++- src/components/views/elements/SSOButtons.tsx | 2 +- 5 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/Login.ts b/src/Login.ts index c36f5770b9..4dc96bc17d 100644 --- a/src/Login.ts +++ b/src/Login.ts @@ -24,13 +24,6 @@ import { ILoginParams, LoginFlow } from "matrix-js-sdk/src/@types/auth"; import { IMatrixClientCreds } from "./MatrixClientPeg"; import SecurityCustomisations from "./customisations/Security"; -export { - IdentityProviderBrand, - IIdentityProvider, - ISSOFlow, - LoginFlow, -} from "matrix-js-sdk/src/@types/auth"; - interface ILoginOptions { defaultDeviceDisplayName?: string; } diff --git a/src/components/structures/auth/Login.tsx b/src/components/structures/auth/Login.tsx index c9fc7e001d..7c1564c9d9 100644 --- a/src/components/structures/auth/Login.tsx +++ b/src/components/structures/auth/Login.tsx @@ -18,9 +18,10 @@ import React, { ReactNode } from 'react'; import { ConnectionError, MatrixError } from "matrix-js-sdk/src/http-api"; import classNames from "classnames"; import { logger } from "matrix-js-sdk/src/logger"; +import { ISSOFlow, LoginFlow } from "matrix-js-sdk/src/@types/auth"; import { _t, _td } from '../../../languageHandler'; -import Login, { ISSOFlow, LoginFlow } from '../../../Login'; +import Login from '../../../Login'; import SdkConfig from '../../../SdkConfig'; import { messageForResourceLimitError } from '../../../utils/ErrorUtils'; import AutoDiscoveryUtils from "../../../utils/AutoDiscoveryUtils"; diff --git a/src/components/structures/auth/Registration.tsx b/src/components/structures/auth/Registration.tsx index b5770110f6..c155b5acc2 100644 --- a/src/components/structures/auth/Registration.tsx +++ b/src/components/structures/auth/Registration.tsx @@ -19,6 +19,7 @@ import React, { Fragment, ReactNode } from 'react'; import { MatrixClient } from "matrix-js-sdk/src/client"; import classNames from "classnames"; import { logger } from "matrix-js-sdk/src/logger"; +import { ISSOFlow } from "matrix-js-sdk/src/@types/auth"; import { _t, _td } from '../../../languageHandler'; import { messageForResourceLimitError } from '../../../utils/ErrorUtils'; @@ -26,7 +27,7 @@ import AutoDiscoveryUtils from "../../../utils/AutoDiscoveryUtils"; import * as Lifecycle from '../../../Lifecycle'; import { IMatrixClientCreds, MatrixClientPeg } from "../../../MatrixClientPeg"; import AuthPage from "../../views/auth/AuthPage"; -import Login, { ISSOFlow } from "../../../Login"; +import Login from "../../../Login"; import dis from "../../../dispatcher/dispatcher"; import SSOButtons from "../../views/elements/SSOButtons"; import ServerPicker from '../../views/elements/ServerPicker'; diff --git a/src/components/structures/auth/SoftLogout.tsx b/src/components/structures/auth/SoftLogout.tsx index 64dcdce645..7b946070ca 100644 --- a/src/components/structures/auth/SoftLogout.tsx +++ b/src/components/structures/auth/SoftLogout.tsx @@ -17,13 +17,14 @@ limitations under the License. import React from 'react'; import { logger } from "matrix-js-sdk/src/logger"; import { Optional } from "matrix-events-sdk"; +import { ISSOFlow, LoginFlow } from "matrix-js-sdk/src/@types/auth"; import { _t } from '../../../languageHandler'; import dis from '../../../dispatcher/dispatcher'; import * as Lifecycle from '../../../Lifecycle'; import Modal from '../../../Modal'; import { MatrixClientPeg } from "../../../MatrixClientPeg"; -import { ISSOFlow, LoginFlow, sendLoginRequest } from "../../../Login"; +import { sendLoginRequest } from "../../../Login"; import AuthPage from "../../views/auth/AuthPage"; import { SSO_HOMESERVER_URL_KEY, SSO_ID_SERVER_URL_KEY } from "../../../BasePlatform"; import SSOButtons from "../../views/elements/SSOButtons"; diff --git a/src/components/views/elements/SSOButtons.tsx b/src/components/views/elements/SSOButtons.tsx index 666e55eab4..4332c914e7 100644 --- a/src/components/views/elements/SSOButtons.tsx +++ b/src/components/views/elements/SSOButtons.tsx @@ -19,11 +19,11 @@ import { chunk } from "lodash"; import classNames from "classnames"; import { MatrixClient } from "matrix-js-sdk/src/client"; import { Signup } from "@matrix-org/analytics-events/types/typescript/Signup"; +import { IdentityProviderBrand, IIdentityProvider, ISSOFlow } from "matrix-js-sdk/src/@types/auth"; import PlatformPeg from "../../../PlatformPeg"; import AccessibleButton from "./AccessibleButton"; import { _t } from "../../../languageHandler"; -import { IdentityProviderBrand, IIdentityProvider, ISSOFlow } from "../../../Login"; import AccessibleTooltipButton from "./AccessibleTooltipButton"; import { mediaFromMxc } from "../../../customisations/Media"; import { PosthogAnalytics } from "../../../PosthogAnalytics";