From ad73b0c16eaa165f1f0096a070880459e2b48b9d Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 15 Aug 2023 16:00:17 +0100 Subject: [PATCH] Switch to importing most things from the main matrix-js-sdk export (#11406) * Switch to importing most things from the main matrix-js-sdk export * fix imports * Iterate * Fix tests --- .eslintrc.js | 201 ++++++++---------- src/Lifecycle.ts | 3 +- src/Login.ts | 4 +- src/MatrixClientPeg.ts | 2 +- src/SlashCommands.tsx | 3 +- .../security/CreateSecretStorageDialog.tsx | 3 +- src/components/structures/SpaceHierarchy.tsx | 21 +- src/components/structures/auth/Login.tsx | 4 +- .../structures/auth/Registration.tsx | 9 +- src/components/structures/auth/SoftLogout.tsx | 5 +- .../views/beacon/BeaconListItem.tsx | 3 +- src/components/views/beacon/BeaconMarker.tsx | 3 +- .../views/beacon/BeaconStatusTooltip.tsx | 3 +- .../views/beacon/DialogOwnBeaconStatus.tsx | 3 +- .../views/beacon/ShareLatestLocation.tsx | 4 +- src/components/views/beacon/displayStatus.ts | 4 +- .../views/dialogs/ForwardDialog.tsx | 13 +- .../views/dialogs/InteractiveAuthDialog.tsx | 3 +- .../views/dialogs/ServerPickerDialog.tsx | 2 +- .../security/CreateCrossSigningDialog.tsx | 3 +- .../dialogs/spotlight/SpotlightDialog.tsx | 12 +- src/components/views/elements/SSOButtons.tsx | 12 +- .../views/location/shareLocation.ts | 22 +- src/components/views/messages/MBeaconBody.tsx | 4 +- .../DynamicImportWysiwygComposer.tsx | 2 +- .../wysiwyg_composer/hooks/useEditing.ts | 2 +- .../views/spaces/SpaceCreateMenu.tsx | 10 +- src/dispatcher/payloads/JoinRoomPayload.ts | 2 +- .../payloads/SubmitAskToJoinPayload.ts | 2 +- src/hooks/room/useTopic.ts | 9 +- src/hooks/usePublicRoomDirectory.ts | 3 +- src/hooks/useSpaceResults.ts | 7 +- src/stores/OwnBeaconStore.ts | 11 +- src/stores/spaces/SpaceStore.ts | 2 +- src/stores/spaces/index.ts | 5 +- src/utils/AutoDiscoveryUtils.tsx | 9 +- src/utils/UserInteractiveAuth.ts | 2 +- src/utils/ValidatedServerConfig.ts | 3 +- src/utils/beacon/duration.ts | 5 +- src/utils/oidc/authorize.ts | 2 +- .../structures/SpaceHierarchy-test.tsx | 45 ++-- .../components/structures/auth/Login-test.tsx | 8 +- .../views/beacon/BeaconListItem-test.tsx | 3 +- .../location/LocationViewDialog-test.tsx | 3 +- .../views/location/shareLocation-test.ts | 8 +- .../views/messages/MLocationBody-test.tsx | 3 +- test/stores/OwnBeaconStore-test.ts | 16 +- test/test-utils/beacon.ts | 15 +- test/test-utils/location.ts | 5 +- test/test-utils/oidc.ts | 2 +- test/utils/AutoDiscoveryUtils-test.tsx | 3 +- test/utils/location/isSelfLocation-test.ts | 6 +- 52 files changed, 262 insertions(+), 277 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index f3a6e36493..785389dfd1 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -62,118 +62,6 @@ module.exports = { name: "matrix-js-sdk/src/index", message: "Please use matrix-js-sdk/src/matrix instead", }, - { - name: "matrix-js-sdk/src/models/typed-event-emitter", - message: "Please use matrix-js-sdk/src/matrix instead", - }, - { - name: "matrix-js-sdk/src/models/room", - message: "Please use matrix-js-sdk/src/matrix instead", - }, - { - name: "matrix-js-sdk/src/models/room-member", - message: "Please use matrix-js-sdk/src/matrix instead", - }, - { - name: "matrix-js-sdk/src/models/room-state", - message: "Please use matrix-js-sdk/src/matrix instead", - }, - { - name: "matrix-js-sdk/src/models/event", - message: "Please use matrix-js-sdk/src/matrix instead", - }, - { - name: "matrix-js-sdk/src/models/event-status", - message: "Please use matrix-js-sdk/src/matrix instead", - }, - { - name: "matrix-js-sdk/src/models/user", - message: "Please use matrix-js-sdk/src/matrix instead", - }, - { - name: "matrix-js-sdk/src/models/device", - message: "Please use matrix-js-sdk/src/matrix instead", - }, - { - name: "matrix-js-sdk/src/models/event-timeline", - message: "Please use matrix-js-sdk/src/matrix instead", - }, - { - name: "matrix-js-sdk/src/models/event-timeline-set", - message: "Please use matrix-js-sdk/src/matrix instead", - }, - { - name: "matrix-js-sdk/src/@types/partials", - message: "Please use matrix-js-sdk/src/matrix instead", - }, - { - name: "matrix-js-sdk/src/@types/event", - message: "Please use matrix-js-sdk/src/matrix instead", - }, - { - name: "matrix-js-sdk/src/client", - message: "Please use matrix-js-sdk/src/matrix instead", - }, - { - name: "matrix-js-sdk/src/models/search-result", - message: "Please use matrix-js-sdk/src/matrix instead", - }, - { - name: "matrix-js-sdk/src/models/poll", - message: "Please use matrix-js-sdk/src/matrix instead", - }, - { - name: "matrix-js-sdk/src/models/relations", - message: "Please use matrix-js-sdk/src/matrix instead", - }, - { - name: "matrix-js-sdk/src/http-api", - message: "Please use matrix-js-sdk/src/matrix instead", - }, - { - name: "matrix-js-sdk/src/@types/PushRules", - message: "Please use matrix-js-sdk/src/matrix instead", - }, - { - name: "matrix-js-sdk/src/@types/search", - message: "Please use matrix-js-sdk/src/matrix instead", - }, - { - name: "matrix-js-sdk/src/filter", - message: "Please use matrix-js-sdk/src/matrix instead", - }, - { - name: "matrix-js-sdk/src/webrtc/groupCall", - message: "Please use matrix-js-sdk/src/matrix instead", - }, - { - name: "matrix-js-sdk/src/service-types", - message: "Please use matrix-js-sdk/src/matrix instead", - }, - { - name: "matrix-js-sdk/src/sync", - message: "Please use matrix-js-sdk/src/matrix instead", - }, - { - name: "matrix-js-sdk/src/timeline-window", - message: "Please use matrix-js-sdk/src/matrix instead", - }, - { - name: "matrix-js-sdk/src/store/indexeddb", - message: "Please use matrix-js-sdk/src/matrix instead", - }, - { - name: "matrix-js-sdk/src/crypto/store/indexeddb-crypto-store", - message: "Please use matrix-js-sdk/src/matrix instead", - }, - { - name: "matrix-js-sdk/src/crypto/store/localStorage-crypto-store", - message: "Please use matrix-js-sdk/src/matrix instead", - }, - { - name: "matrix-js-sdk/src/models/thread", - message: "Please use matrix-js-sdk/src/matrix instead", - }, { name: "matrix-react-sdk", message: "Please use matrix-react-sdk/src/index instead", @@ -185,8 +73,93 @@ module.exports = { ], patterns: [ { - group: ["matrix-js-sdk/lib", "matrix-js-sdk/lib/", "matrix-js-sdk/lib/**"], - message: "Please use matrix-js-sdk/src/* instead", + group: [ + "matrix-js-sdk/src/**", + "!matrix-js-sdk/src/matrix", + "matrix-js-sdk/lib", + "matrix-js-sdk/lib/", + "matrix-js-sdk/lib/**", + // XXX: Temporarily allow these as they are not available via the main export + "!matrix-js-sdk/src/logger", + "!matrix-js-sdk/src/errors", + "!matrix-js-sdk/src/utils", + "!matrix-js-sdk/src/version-support", + "!matrix-js-sdk/src/randomstring", + "!matrix-js-sdk/src/sliding-sync", + "!matrix-js-sdk/src/browser-index", + "!matrix-js-sdk/src/feature", + "!matrix-js-sdk/src/NamespacedValue", + "!matrix-js-sdk/src/ReEmitter", + "!matrix-js-sdk/src/event-mapper", + "!matrix-js-sdk/src/interactive-auth", + "!matrix-js-sdk/src/secret-storage", + "!matrix-js-sdk/src/room-hierarchy", + "!matrix-js-sdk/src/rendezvous", + "!matrix-js-sdk/src/rendezvous/transports", + "!matrix-js-sdk/src/rendezvous/channels", + "!matrix-js-sdk/src/indexeddb-worker", + "!matrix-js-sdk/src/pushprocessor", + "!matrix-js-sdk/src/extensible_events_v1", + "!matrix-js-sdk/src/extensible_events_v1/PollStartEvent", + "!matrix-js-sdk/src/extensible_events_v1/PollResponseEvent", + "!matrix-js-sdk/src/extensible_events_v1/PollEndEvent", + "!matrix-js-sdk/src/extensible_events_v1/InvalidEventError", + "!matrix-js-sdk/src/crypto-api", + "!matrix-js-sdk/src/crypto-api/verification", + "!matrix-js-sdk/src/crypto", + "!matrix-js-sdk/src/crypto/algorithms", + "!matrix-js-sdk/src/crypto/api", + "!matrix-js-sdk/src/crypto/aes", + "!matrix-js-sdk/src/crypto/backup", + "!matrix-js-sdk/src/crypto/olmlib", + "!matrix-js-sdk/src/crypto/crypto", + "!matrix-js-sdk/src/crypto/keybackup", + "!matrix-js-sdk/src/crypto/RoomList", + "!matrix-js-sdk/src/crypto/deviceinfo", + "!matrix-js-sdk/src/crypto/key_passphrase", + "!matrix-js-sdk/src/crypto/CrossSigning", + "!matrix-js-sdk/src/crypto/recoverykey", + "!matrix-js-sdk/src/crypto/dehydration", + "!matrix-js-sdk/src/crypto/verification", + "!matrix-js-sdk/src/crypto/verification/SAS", + "!matrix-js-sdk/src/crypto/verification/QRCode", + "!matrix-js-sdk/src/crypto/verification/request", + "!matrix-js-sdk/src/crypto/verification/request/VerificationRequest", + "!matrix-js-sdk/src/common-crypto", + "!matrix-js-sdk/src/common-crypto/CryptoBackend", + "!matrix-js-sdk/src/oidc", + "!matrix-js-sdk/src/oidc/discovery", + "!matrix-js-sdk/src/oidc/authorize", + "!matrix-js-sdk/src/oidc/validate", + "!matrix-js-sdk/src/oidc/error", + "!matrix-js-sdk/src/oidc/register", + "!matrix-js-sdk/src/webrtc", + "!matrix-js-sdk/src/webrtc/call", + "!matrix-js-sdk/src/webrtc/callFeed", + "!matrix-js-sdk/src/webrtc/mediaHandler", + "!matrix-js-sdk/src/webrtc/callEventTypes", + "!matrix-js-sdk/src/webrtc/callEventHandler", + "!matrix-js-sdk/src/webrtc/groupCallEventHandler", + "!matrix-js-sdk/src/models", + "!matrix-js-sdk/src/models/read-receipt", + "!matrix-js-sdk/src/models/relations-container", + "!matrix-js-sdk/src/models/related-relations", + "!matrix-js-sdk/src/@types", + "!matrix-js-sdk/src/@types/global", + "!matrix-js-sdk/src/@types/auth", + "!matrix-js-sdk/src/@types/beacon", + "!matrix-js-sdk/src/@types/threepids", + "!matrix-js-sdk/src/@types/polls", + "!matrix-js-sdk/src/@types/crypto", + "!matrix-js-sdk/src/@types/local_notifications", + "!matrix-js-sdk/src/@types/location", + "!matrix-js-sdk/src/@types/topic", + "!matrix-js-sdk/src/@types/registration", + "!matrix-js-sdk/src/@types/read_receipts", + "!matrix-js-sdk/src/@types/extensible_events", + "!matrix-js-sdk/src/@types/IIdentityServerProvider", + ], + message: "Please use matrix-js-sdk/src/matrix instead", }, ], }, diff --git a/src/Lifecycle.ts b/src/Lifecycle.ts index 719b0a45fe..a5be8f7f5c 100644 --- a/src/Lifecycle.ts +++ b/src/Lifecycle.ts @@ -18,12 +18,11 @@ limitations under the License. */ import { ReactNode } from "react"; -import { createClient, MatrixClient } from "matrix-js-sdk/src/matrix"; +import { createClient, MatrixClient, SSOAction } from "matrix-js-sdk/src/matrix"; import { InvalidStoreError } from "matrix-js-sdk/src/errors"; import { decryptAES, encryptAES, IEncryptedPayload } from "matrix-js-sdk/src/crypto/aes"; import { QueryDict } from "matrix-js-sdk/src/utils"; import { logger } from "matrix-js-sdk/src/logger"; -import { SSOAction } from "matrix-js-sdk/src/@types/auth"; import { MINIMUM_MATRIX_VERSION } from "matrix-js-sdk/src/version-support"; import { IMatrixClientCreds, MatrixClientPeg } from "./MatrixClientPeg"; diff --git a/src/Login.ts b/src/Login.ts index d918aebc4b..5359b23540 100644 --- a/src/Login.ts +++ b/src/Login.ts @@ -15,9 +15,9 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { createClient, MatrixClient } from "matrix-js-sdk/src/matrix"; +import { createClient, MatrixClient, LoginFlow } from "matrix-js-sdk/src/matrix"; import { logger } from "matrix-js-sdk/src/logger"; -import { DELEGATED_OIDC_COMPATIBILITY, ILoginFlow, LoginFlow, LoginRequest } from "matrix-js-sdk/src/@types/auth"; +import { DELEGATED_OIDC_COMPATIBILITY, ILoginFlow, LoginRequest } from "matrix-js-sdk/src/@types/auth"; import { IMatrixClientCreds } from "./MatrixClientPeg"; import SecurityCustomisations from "./customisations/Security"; diff --git a/src/MatrixClientPeg.ts b/src/MatrixClientPeg.ts index 22c2dcb45c..5c75070211 100644 --- a/src/MatrixClientPeg.ts +++ b/src/MatrixClientPeg.ts @@ -26,8 +26,8 @@ import { EventTimelineSet, IStartClientOpts, MatrixClient, + MemoryStore, } from "matrix-js-sdk/src/matrix"; -import { MemoryStore } from "matrix-js-sdk/src/store/memory"; import * as utils from "matrix-js-sdk/src/utils"; import { verificationMethods } from "matrix-js-sdk/src/crypto"; import { SHOW_QR_CODE_METHOD } from "matrix-js-sdk/src/crypto/verification/QRCode"; diff --git a/src/SlashCommands.tsx b/src/SlashCommands.tsx index 0a3d2ba8b1..523faec5c8 100644 --- a/src/SlashCommands.tsx +++ b/src/SlashCommands.tsx @@ -18,8 +18,7 @@ limitations under the License. */ import * as React from "react"; -import { User, IContent, Direction } from "matrix-js-sdk/src/matrix"; -import * as ContentHelpers from "matrix-js-sdk/src/content-helpers"; +import { User, IContent, Direction, ContentHelpers } from "matrix-js-sdk/src/matrix"; import { logger } from "matrix-js-sdk/src/logger"; import { MRoomTopicEventContent } from "matrix-js-sdk/src/@types/topic"; diff --git a/src/async-components/views/dialogs/security/CreateSecretStorageDialog.tsx b/src/async-components/views/dialogs/security/CreateSecretStorageDialog.tsx index ba53b615a3..2a0cf58916 100644 --- a/src/async-components/views/dialogs/security/CreateSecretStorageDialog.tsx +++ b/src/async-components/views/dialogs/security/CreateSecretStorageDialog.tsx @@ -20,11 +20,10 @@ import FileSaver from "file-saver"; import { logger } from "matrix-js-sdk/src/logger"; import { IKeyBackupInfo } from "matrix-js-sdk/src/crypto/keybackup"; import { TrustInfo } from "matrix-js-sdk/src/crypto/backup"; -import { CrossSigningKeys, IAuthDict, MatrixError, UIAFlow } from "matrix-js-sdk/src/matrix"; +import { CrossSigningKeys, IAuthDict, MatrixError, UIAFlow, UIAResponse } from "matrix-js-sdk/src/matrix"; import { IRecoveryKey } from "matrix-js-sdk/src/crypto/api"; import { CryptoEvent } from "matrix-js-sdk/src/crypto"; import classNames from "classnames"; -import { UIAResponse } from "matrix-js-sdk/src/@types/uia"; import { MatrixClientPeg } from "../../../../MatrixClientPeg"; import { _t, _td } from "../../../../languageHandler"; diff --git a/src/components/structures/SpaceHierarchy.tsx b/src/components/structures/SpaceHierarchy.tsx index 4640ee9295..a4ffd4108f 100644 --- a/src/components/structures/SpaceHierarchy.tsx +++ b/src/components/structures/SpaceHierarchy.tsx @@ -38,9 +38,10 @@ import { RoomType, GuestAccess, HistoryVisibility, + HierarchyRelation, + HierarchyRoom, } from "matrix-js-sdk/src/matrix"; import { RoomHierarchy } from "matrix-js-sdk/src/room-hierarchy"; -import { IHierarchyRelation, IHierarchyRoom } from "matrix-js-sdk/src/@types/spaces"; import classNames from "classnames"; import { sortBy, uniqBy } from "lodash"; import { logger } from "matrix-js-sdk/src/logger"; @@ -85,7 +86,7 @@ interface IProps { } interface ITileProps { - room: IHierarchyRoom; + room: HierarchyRoom; suggested?: boolean; selected?: boolean; numChildRooms?: number; @@ -429,8 +430,8 @@ export const joinRoom = async (cli: MatrixClient, hierarchy: RoomHierarchy, room }; interface IHierarchyLevelProps { - root: IHierarchyRoom; - roomSet: Set; + root: HierarchyRoom; + roomSet: Set; hierarchy: RoomHierarchy; parents: Set; selectedMap?: Map>; @@ -439,7 +440,7 @@ interface IHierarchyLevelProps { onToggleClick?(parentId: string, childId: string): void; } -export const toLocalRoom = (cli: MatrixClient, room: IHierarchyRoom, hierarchy: RoomHierarchy): IHierarchyRoom => { +export const toLocalRoom = (cli: MatrixClient, room: HierarchyRoom, hierarchy: RoomHierarchy): HierarchyRoom => { const history = cli.getRoomUpgradeHistory( room.room_id, true, @@ -497,14 +498,14 @@ export const HierarchyLevel: React.FC = ({ }); const [subspaces, childRooms] = sortedChildren.reduce( - (result, ev: IHierarchyRelation) => { + (result, ev: HierarchyRelation) => { const room = hierarchy.roomMap.get(ev.state_key); if (room && roomSet.has(room)) { result[room.room_type === RoomType.Space ? 0 : 1].push(toLocalRoom(cli, room, hierarchy)); } return result; }, - [[] as IHierarchyRoom[], [] as IHierarchyRoom[]], + [[] as HierarchyRoom[], [] as HierarchyRoom[]], ); const newParents = new Set(parents).add(root.room_id); @@ -564,12 +565,12 @@ export const useRoomHierarchy = ( space: Room, ): { loading: boolean; - rooms?: IHierarchyRoom[]; + rooms?: HierarchyRoom[]; hierarchy?: RoomHierarchy; error?: Error; loadMore(pageSize?: number): Promise; } => { - const [rooms, setRooms] = useState([]); + const [rooms, setRooms] = useState([]); const [hierarchy, setHierarchy] = useState(); const [error, setError] = useState(); @@ -760,7 +761,7 @@ const SpaceHierarchy: React.FC = ({ space, initialText = "", showRoom, a const { loading, rooms, hierarchy, loadMore, error: hierarchyError } = useRoomHierarchy(space); - const filteredRoomSet = useMemo>(() => { + const filteredRoomSet = useMemo>(() => { if (!rooms?.length || !hierarchy) return new Set(); const lcQuery = query.toLowerCase().trim(); if (!lcQuery) return new Set(rooms); diff --git a/src/components/structures/auth/Login.tsx b/src/components/structures/auth/Login.tsx index 241c2dcc71..7307521ea2 100644 --- a/src/components/structures/auth/Login.tsx +++ b/src/components/structures/auth/Login.tsx @@ -17,7 +17,7 @@ limitations under the License. import React, { ReactNode } from "react"; import classNames from "classnames"; import { logger } from "matrix-js-sdk/src/logger"; -import { ISSOFlow, SSOAction } from "matrix-js-sdk/src/@types/auth"; +import { SSOFlow, SSOAction } from "matrix-js-sdk/src/matrix"; import { _t, _td, UserFriendlyError } from "../../../languageHandler"; import Login, { ClientLoginFlow, OidcNativeFlow } from "../../../Login"; @@ -487,7 +487,7 @@ export default class LoginComponent extends React.PureComponent }; private renderSsoStep = (loginType: "cas" | "sso"): JSX.Element => { - const flow = this.state.flows?.find((flow) => flow.type === "m.login." + loginType) as ISSOFlow; + const flow = this.state.flows?.find((flow) => flow.type === "m.login." + loginType) as SSOFlow; return ( { @@ -219,11 +220,11 @@ export default class Registration extends React.Component { this.loginLogic.setHomeserverUrl(hsUrl); this.loginLogic.setIdentityServerUrl(isUrl); - let ssoFlow: ISSOFlow | undefined; + let ssoFlow: SSOFlow | undefined; try { const loginFlows = await this.loginLogic.getFlows(); if (serverConfig !== this.latestServerConfig) return; // discard, serverConfig changed from under us - ssoFlow = loginFlows.find((f) => f.type === "m.login.sso" || f.type === "m.login.cas") as ISSOFlow; + ssoFlow = loginFlows.find((f) => f.type === "m.login.sso" || f.type === "m.login.cas") as SSOFlow; } catch (e) { if (serverConfig !== this.latestServerConfig) return; // discard, serverConfig changed from under us logger.error("Failed to get login flows to check for SSO support", e); diff --git a/src/components/structures/auth/SoftLogout.tsx b/src/components/structures/auth/SoftLogout.tsx index 4ff18492ef..cf4ff3642b 100644 --- a/src/components/structures/auth/SoftLogout.tsx +++ b/src/components/structures/auth/SoftLogout.tsx @@ -17,8 +17,7 @@ limitations under the License. import React, { ChangeEvent, SyntheticEvent } from "react"; import { logger } from "matrix-js-sdk/src/logger"; import { Optional } from "matrix-events-sdk"; -import { ISSOFlow, LoginFlow, SSOAction } from "matrix-js-sdk/src/@types/auth"; -import { MatrixError } from "matrix-js-sdk/src/matrix"; +import { SSOFlow, LoginFlow, SSOAction, MatrixError } from "matrix-js-sdk/src/matrix"; import { _t } from "../../../languageHandler"; import dis from "../../../dispatcher/dispatcher"; @@ -257,7 +256,7 @@ export default class SoftLogout extends React.Component { private renderSsoForm(introText: Optional): JSX.Element { const loginType = this.state.loginView === LoginView.CAS ? "cas" : "sso"; - const flow = this.state.flows.find((flow) => flow.type === "m.login." + loginType) as ISSOFlow; + const flow = this.state.flows.find((flow) => flow.type === "m.login." + loginType) as SSOFlow; return (
diff --git a/src/components/views/beacon/BeaconListItem.tsx b/src/components/views/beacon/BeaconListItem.tsx index caeff53bf5..4c523d9a7f 100644 --- a/src/components/views/beacon/BeaconListItem.tsx +++ b/src/components/views/beacon/BeaconListItem.tsx @@ -15,8 +15,7 @@ limitations under the License. */ import React, { HTMLProps, useContext } from "react"; -import { Beacon, BeaconEvent } from "matrix-js-sdk/src/matrix"; -import { LocationAssetType } from "matrix-js-sdk/src/@types/location"; +import { Beacon, BeaconEvent, LocationAssetType } from "matrix-js-sdk/src/matrix"; import MatrixClientContext from "../../../contexts/MatrixClientContext"; import { useEventEmitterState } from "../../../hooks/useEventEmitter"; diff --git a/src/components/views/beacon/BeaconMarker.tsx b/src/components/views/beacon/BeaconMarker.tsx index 2a63673b1a..217be7351e 100644 --- a/src/components/views/beacon/BeaconMarker.tsx +++ b/src/components/views/beacon/BeaconMarker.tsx @@ -16,8 +16,7 @@ limitations under the License. import React, { ReactNode, useContext } from "react"; import * as maplibregl from "maplibre-gl"; -import { Beacon, BeaconEvent } from "matrix-js-sdk/src/matrix"; -import { LocationAssetType } from "matrix-js-sdk/src/@types/location"; +import { Beacon, BeaconEvent, LocationAssetType } from "matrix-js-sdk/src/matrix"; import MatrixClientContext from "../../../contexts/MatrixClientContext"; import { useEventEmitterState } from "../../../hooks/useEventEmitter"; diff --git a/src/components/views/beacon/BeaconStatusTooltip.tsx b/src/components/views/beacon/BeaconStatusTooltip.tsx index d66f4a59d0..239fa419f6 100644 --- a/src/components/views/beacon/BeaconStatusTooltip.tsx +++ b/src/components/views/beacon/BeaconStatusTooltip.tsx @@ -15,8 +15,7 @@ limitations under the License. */ import React, { useContext } from "react"; -import { Beacon } from "matrix-js-sdk/src/matrix"; -import { LocationAssetType } from "matrix-js-sdk/src/@types/location"; +import { Beacon, LocationAssetType } from "matrix-js-sdk/src/matrix"; import MatrixClientContext from "../../../contexts/MatrixClientContext"; import BeaconStatus from "./BeaconStatus"; diff --git a/src/components/views/beacon/DialogOwnBeaconStatus.tsx b/src/components/views/beacon/DialogOwnBeaconStatus.tsx index 3c456004f4..eae7949989 100644 --- a/src/components/views/beacon/DialogOwnBeaconStatus.tsx +++ b/src/components/views/beacon/DialogOwnBeaconStatus.tsx @@ -15,8 +15,7 @@ limitations under the License. */ import React, { useContext } from "react"; -import { Room, Beacon } from "matrix-js-sdk/src/matrix"; -import { LocationAssetType } from "matrix-js-sdk/src/@types/location"; +import { Room, Beacon, LocationAssetType } from "matrix-js-sdk/src/matrix"; import { OwnBeaconStore, OwnBeaconStoreEvent } from "../../../stores/OwnBeaconStore"; import { useEventEmitterState } from "../../../hooks/useEventEmitter"; diff --git a/src/components/views/beacon/ShareLatestLocation.tsx b/src/components/views/beacon/ShareLatestLocation.tsx index ef525ad838..454ebe3ca6 100644 --- a/src/components/views/beacon/ShareLatestLocation.tsx +++ b/src/components/views/beacon/ShareLatestLocation.tsx @@ -15,7 +15,7 @@ limitations under the License. */ import React, { useEffect, useState } from "react"; -import { BeaconLocationState } from "matrix-js-sdk/src/content-helpers"; +import { ContentHelpers } from "matrix-js-sdk/src/matrix"; import { Icon as ExternalLinkIcon } from "../../../../res/img/external-link.svg"; import { _t } from "../../../languageHandler"; @@ -24,7 +24,7 @@ import CopyableText from "../elements/CopyableText"; import TooltipTarget from "../elements/TooltipTarget"; interface Props { - latestLocationState?: BeaconLocationState; + latestLocationState?: ContentHelpers.BeaconLocationState; } const ShareLatestLocation: React.FC = ({ latestLocationState }) => { diff --git a/src/components/views/beacon/displayStatus.ts b/src/components/views/beacon/displayStatus.ts index 48260cb672..a2cd4b662b 100644 --- a/src/components/views/beacon/displayStatus.ts +++ b/src/components/views/beacon/displayStatus.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { BeaconLocationState } from "matrix-js-sdk/src/content-helpers"; +import { ContentHelpers } from "matrix-js-sdk/src/matrix"; export enum BeaconDisplayStatus { Loading = "Loading", @@ -24,7 +24,7 @@ export enum BeaconDisplayStatus { } export const getBeaconDisplayStatus = ( isLive: boolean, - latestLocationState?: BeaconLocationState, + latestLocationState?: ContentHelpers.BeaconLocationState, error?: Error, waitingToStart?: boolean, ): BeaconDisplayStatus => { diff --git a/src/components/views/dialogs/ForwardDialog.tsx b/src/components/views/dialogs/ForwardDialog.tsx index 72fe8f2c7c..13d84b99e7 100644 --- a/src/components/views/dialogs/ForwardDialog.tsx +++ b/src/components/views/dialogs/ForwardDialog.tsx @@ -16,9 +16,16 @@ limitations under the License. import React, { useEffect, useMemo, useState } from "react"; import classnames from "classnames"; -import { IContent, MatrixEvent, Room, RoomMember, EventType, MatrixClient } from "matrix-js-sdk/src/matrix"; +import { + IContent, + MatrixEvent, + Room, + RoomMember, + EventType, + MatrixClient, + ContentHelpers, +} from "matrix-js-sdk/src/matrix"; import { ILocationContent, LocationAssetType, M_TIMESTAMP } from "matrix-js-sdk/src/@types/location"; -import { makeLocationContent } from "matrix-js-sdk/src/content-helpers"; import { M_BEACON } from "matrix-js-sdk/src/@types/beacon"; import { _t } from "../../../languageHandler"; @@ -176,7 +183,7 @@ const transformEvent = (event: MatrixEvent): { type: string; content: IContent } type, content: { ...content, - ...makeLocationContent( + ...ContentHelpers.makeLocationContent( undefined, // text geoUri, timestamp || Date.now(), diff --git a/src/components/views/dialogs/InteractiveAuthDialog.tsx b/src/components/views/dialogs/InteractiveAuthDialog.tsx index 4fbb3456f6..807ca383f0 100644 --- a/src/components/views/dialogs/InteractiveAuthDialog.tsx +++ b/src/components/views/dialogs/InteractiveAuthDialog.tsx @@ -17,9 +17,8 @@ limitations under the License. */ import React from "react"; -import { MatrixClient } from "matrix-js-sdk/src/matrix"; +import { MatrixClient, UIAResponse } from "matrix-js-sdk/src/matrix"; import { AuthType } from "matrix-js-sdk/src/interactive-auth"; -import { UIAResponse } from "matrix-js-sdk/src/@types/uia"; import { _t } from "../../../languageHandler"; import AccessibleButton from "../elements/AccessibleButton"; diff --git a/src/components/views/dialogs/ServerPickerDialog.tsx b/src/components/views/dialogs/ServerPickerDialog.tsx index 2ebbac67c6..c6148896a4 100644 --- a/src/components/views/dialogs/ServerPickerDialog.tsx +++ b/src/components/views/dialogs/ServerPickerDialog.tsx @@ -15,7 +15,7 @@ limitations under the License. */ import React, { ChangeEvent, createRef, SyntheticEvent } from "react"; -import { AutoDiscovery } from "matrix-js-sdk/src/autodiscovery"; +import { AutoDiscovery } from "matrix-js-sdk/src/matrix"; import { logger } from "matrix-js-sdk/src/logger"; import AutoDiscoveryUtils from "../../../utils/AutoDiscoveryUtils"; diff --git a/src/components/views/dialogs/security/CreateCrossSigningDialog.tsx b/src/components/views/dialogs/security/CreateCrossSigningDialog.tsx index ba54bc28f5..b632ac7160 100644 --- a/src/components/views/dialogs/security/CreateCrossSigningDialog.tsx +++ b/src/components/views/dialogs/security/CreateCrossSigningDialog.tsx @@ -16,9 +16,8 @@ limitations under the License. */ import React from "react"; -import { CrossSigningKeys, AuthDict, MatrixError, UIAFlow } from "matrix-js-sdk/src/matrix"; +import { CrossSigningKeys, AuthDict, MatrixError, UIAFlow, UIAResponse } from "matrix-js-sdk/src/matrix"; import { logger } from "matrix-js-sdk/src/logger"; -import { UIAResponse } from "matrix-js-sdk/src/@types/uia"; import { MatrixClientPeg } from "../../../../MatrixClientPeg"; import { _t } from "../../../../languageHandler"; diff --git a/src/components/views/dialogs/spotlight/SpotlightDialog.tsx b/src/components/views/dialogs/spotlight/SpotlightDialog.tsx index 8ccffaf1b8..886f78d4da 100644 --- a/src/components/views/dialogs/spotlight/SpotlightDialog.tsx +++ b/src/components/views/dialogs/spotlight/SpotlightDialog.tsx @@ -17,8 +17,14 @@ limitations under the License. import { WebSearch as WebSearchEvent } from "@matrix-org/analytics-events/types/typescript/WebSearch"; import classNames from "classnames"; import { capitalize, sum } from "lodash"; -import { IHierarchyRoom } from "matrix-js-sdk/src/@types/spaces"; -import { IPublicRoomsChunkRoom, MatrixClient, RoomMember, RoomType, Room } from "matrix-js-sdk/src/matrix"; +import { + IPublicRoomsChunkRoom, + MatrixClient, + RoomMember, + RoomType, + Room, + HierarchyRoom, +} from "matrix-js-sdk/src/matrix"; import { normalize } from "matrix-js-sdk/src/utils"; import React, { ChangeEvent, RefObject, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react"; import sanitizeHtml from "sanitize-html"; @@ -825,7 +831,7 @@ const SpotlightDialog: React.FC = ({ initialText = "", initialFilter = n
{spaceResults.slice(0, SECTION_LIMIT).map( - (room: IHierarchyRoom): JSX.Element => ( + (room: HierarchyRoom): JSX.Element => (