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<IHierarchyRoom>; + root: HierarchyRoom; + roomSet: Set<HierarchyRoom>; hierarchy: RoomHierarchy; parents: Set<string>; selectedMap?: Map<string, Set<string>>; @@ -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<IHierarchyLevelProps> = ({ }); 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<void>; } => { - const [rooms, setRooms] = useState<IHierarchyRoom[]>([]); + const [rooms, setRooms] = useState<HierarchyRoom[]>([]); const [hierarchy, setHierarchy] = useState<RoomHierarchy>(); const [error, setError] = useState<Error | undefined>(); @@ -760,7 +761,7 @@ const SpaceHierarchy: React.FC<IProps> = ({ space, initialText = "", showRoom, a const { loading, rooms, hierarchy, loadMore, error: hierarchyError } = useRoomHierarchy(space); - const filteredRoomSet = useMemo<Set<IHierarchyRoom>>(() => { + const filteredRoomSet = useMemo<Set<HierarchyRoom>>(() => { 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<IProps, IState> }; 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 ( <SSOButtons diff --git a/src/components/structures/auth/Registration.tsx b/src/components/structures/auth/Registration.tsx index 71b34462fd..37edecdd35 100644 --- a/src/components/structures/auth/Registration.tsx +++ b/src/components/structures/auth/Registration.tsx @@ -24,11 +24,12 @@ import { IRegisterRequestParams, IRequestTokenResponse, MatrixClient, + SSOFlow, + SSOAction, } from "matrix-js-sdk/src/matrix"; import React, { Fragment, 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 { RegisterResponse } from "matrix-js-sdk/src/@types/registration"; import { _t } from "../../../languageHandler"; @@ -121,7 +122,7 @@ interface IState { differentLoggedInUserId?: string; // the SSO flow definition, this is fetched from /login as that's the only // place it is exposed. - ssoFlow?: ISSOFlow; + ssoFlow?: SSOFlow; } export default class Registration extends React.Component<IProps, IState> { @@ -219,11 +220,11 @@ export default class Registration extends React.Component<IProps, IState> { 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<IProps, IState> { private renderSsoForm(introText: Optional<string>): 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 ( <div> 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<Props> = ({ 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<IProps> = ({ initialText = "", initialFilter = n </h4> <div> {spaceResults.slice(0, SECTION_LIMIT).map( - (room: IHierarchyRoom): JSX.Element => ( + (room: HierarchyRoom): JSX.Element => ( <Option id={`mx_SpotlightDialog_button_result_${room.room_id}`} key={room.room_id} diff --git a/src/components/views/elements/SSOButtons.tsx b/src/components/views/elements/SSOButtons.tsx index 9b8c4bd80f..2c881d2ae3 100644 --- a/src/components/views/elements/SSOButtons.tsx +++ b/src/components/views/elements/SSOButtons.tsx @@ -17,15 +17,9 @@ limitations under the License. import React from "react"; import { chunk } from "lodash"; import classNames from "classnames"; -import { MatrixClient } from "matrix-js-sdk/src/matrix"; +import { MatrixClient, IdentityProviderBrand, SSOFlow, SSOAction } from "matrix-js-sdk/src/matrix"; import { Signup } from "@matrix-org/analytics-events/types/typescript/Signup"; -import { - IdentityProviderBrand, - IIdentityProvider, - ISSOFlow, - DELEGATED_OIDC_COMPATIBILITY, - SSOAction, -} from "matrix-js-sdk/src/@types/auth"; +import { IIdentityProvider, DELEGATED_OIDC_COMPATIBILITY } from "matrix-js-sdk/src/@types/auth"; import PlatformPeg from "../../../PlatformPeg"; import AccessibleButton from "./AccessibleButton"; @@ -147,7 +141,7 @@ const SSOButton: React.FC<ISSOButtonProps> = ({ interface IProps { matrixClient: MatrixClient; - flow: ISSOFlow; + flow: SSOFlow; loginType: "sso" | "cas"; fragmentAfterLogin?: string; primary?: boolean; diff --git a/src/components/views/location/shareLocation.ts b/src/components/views/location/shareLocation.ts index a0c7b6febc..0bfc58427e 100644 --- a/src/components/views/location/shareLocation.ts +++ b/src/components/views/location/shareLocation.ts @@ -14,10 +14,16 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { MatrixClient, IContent, IEventRelation, MatrixError, THREAD_RELATION_TYPE } from "matrix-js-sdk/src/matrix"; -import { makeLocationContent, makeBeaconInfoContent } from "matrix-js-sdk/src/content-helpers"; +import { + MatrixClient, + IContent, + IEventRelation, + MatrixError, + THREAD_RELATION_TYPE, + ContentHelpers, + LocationAssetType, +} from "matrix-js-sdk/src/matrix"; import { logger } from "matrix-js-sdk/src/logger"; -import { LocationAssetType } from "matrix-js-sdk/src/@types/location"; import { _t } from "../../../languageHandler"; import Modal from "../../../Modal"; @@ -109,7 +115,7 @@ export const shareLiveLocation = try { await OwnBeaconStore.instance.createLiveBeacon( roomId, - makeBeaconInfoContent( + ContentHelpers.makeBeaconInfoContent( timeout ?? DEFAULT_LIVE_DURATION, true /* isLive */, description, @@ -134,7 +140,13 @@ export const shareLocation = try { const threadId = (relation?.rel_type === THREAD_RELATION_TYPE.name && relation?.event_id) || null; const assetType = shareType === LocationShareType.Pin ? LocationAssetType.Pin : LocationAssetType.Self; - const content = makeLocationContent(undefined, uri, timestamp, undefined, assetType) as IContent; + const content = ContentHelpers.makeLocationContent( + undefined, + uri, + timestamp, + undefined, + assetType, + ) as IContent; await doMaybeLocalRoomAction( roomId, (actualRoomId: string) => client.sendMessage(actualRoomId, threadId, content), diff --git a/src/components/views/messages/MBeaconBody.tsx b/src/components/views/messages/MBeaconBody.tsx index c8e7f3b17e..74d5127ae0 100644 --- a/src/components/views/messages/MBeaconBody.tsx +++ b/src/components/views/messages/MBeaconBody.tsx @@ -23,8 +23,8 @@ import { MatrixClient, RelationType, IRedactOpts, + ContentHelpers, } from "matrix-js-sdk/src/matrix"; -import { BeaconLocationState } from "matrix-js-sdk/src/content-helpers"; import { randomString } from "matrix-js-sdk/src/randomstring"; import { M_BEACON } from "matrix-js-sdk/src/@types/beacon"; import classNames from "classnames"; @@ -51,7 +51,7 @@ const useBeaconState = ( ): { beacon?: Beacon; description?: string; - latestLocationState?: BeaconLocationState; + latestLocationState?: ContentHelpers.BeaconLocationState; isLive?: boolean; waitingToStart?: boolean; } => { diff --git a/src/components/views/rooms/wysiwyg_composer/DynamicImportWysiwygComposer.tsx b/src/components/views/rooms/wysiwyg_composer/DynamicImportWysiwygComposer.tsx index 2e02fb5719..97e5b67596 100644 --- a/src/components/views/rooms/wysiwyg_composer/DynamicImportWysiwygComposer.tsx +++ b/src/components/views/rooms/wysiwyg_composer/DynamicImportWysiwygComposer.tsx @@ -15,7 +15,7 @@ limitations under the License. */ import React, { ComponentProps, lazy, Suspense } from "react"; -import { ISendEventResponse } from "matrix-js-sdk/src/@types/requests"; +import { ISendEventResponse } from "matrix-js-sdk/src/matrix"; // we need to import the types for TS, but do not import the sendMessage // function to avoid importing from "@matrix-org/matrix-wysiwyg" diff --git a/src/components/views/rooms/wysiwyg_composer/hooks/useEditing.ts b/src/components/views/rooms/wysiwyg_composer/hooks/useEditing.ts index e646046e59..11b80c38f7 100644 --- a/src/components/views/rooms/wysiwyg_composer/hooks/useEditing.ts +++ b/src/components/views/rooms/wysiwyg_composer/hooks/useEditing.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { ISendEventResponse } from "matrix-js-sdk/src/@types/requests"; +import { ISendEventResponse } from "matrix-js-sdk/src/matrix"; import { useCallback, useState } from "react"; import { useMatrixClientContext } from "../../../../../contexts/MatrixClientContext"; diff --git a/src/components/views/spaces/SpaceCreateMenu.tsx b/src/components/views/spaces/SpaceCreateMenu.tsx index b80f7c8196..d24ad9fb1f 100644 --- a/src/components/views/spaces/SpaceCreateMenu.tsx +++ b/src/components/views/spaces/SpaceCreateMenu.tsx @@ -26,8 +26,14 @@ import React, { ReactNode, } from "react"; import classNames from "classnames"; -import { RoomType, HistoryVisibility, Preset, Visibility, MatrixClient } from "matrix-js-sdk/src/matrix"; -import { ICreateRoomOpts } from "matrix-js-sdk/src/@types/requests"; +import { + RoomType, + HistoryVisibility, + Preset, + Visibility, + MatrixClient, + ICreateRoomOpts, +} from "matrix-js-sdk/src/matrix"; import { logger } from "matrix-js-sdk/src/logger"; import { _t } from "../../../languageHandler"; diff --git a/src/dispatcher/payloads/JoinRoomPayload.ts b/src/dispatcher/payloads/JoinRoomPayload.ts index bb3ab532cc..f55920483e 100644 --- a/src/dispatcher/payloads/JoinRoomPayload.ts +++ b/src/dispatcher/payloads/JoinRoomPayload.ts @@ -15,7 +15,7 @@ limitations under the License. */ import { JoinedRoom as JoinedRoomEvent } from "@matrix-org/analytics-events/types/typescript/JoinedRoom"; -import { IJoinRoomOpts } from "matrix-js-sdk/src/@types/requests"; +import { IJoinRoomOpts } from "matrix-js-sdk/src/matrix"; import { ActionPayload } from "../payloads"; import { Action } from "../actions"; diff --git a/src/dispatcher/payloads/SubmitAskToJoinPayload.ts b/src/dispatcher/payloads/SubmitAskToJoinPayload.ts index 814739861f..b531f0fb1e 100644 --- a/src/dispatcher/payloads/SubmitAskToJoinPayload.ts +++ b/src/dispatcher/payloads/SubmitAskToJoinPayload.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { KnockRoomOpts } from "matrix-js-sdk/src/@types/requests"; +import { KnockRoomOpts } from "matrix-js-sdk/src/matrix"; import { Action } from "../actions"; import { ActionPayload } from "../payloads"; diff --git a/src/hooks/room/useTopic.ts b/src/hooks/room/useTopic.ts index 11dc4e5275..c1485fd6cf 100644 --- a/src/hooks/room/useTopic.ts +++ b/src/hooks/room/useTopic.ts @@ -15,19 +15,18 @@ limitations under the License. */ import { useEffect, useState } from "react"; -import { EventType, MatrixEvent, Room, RoomStateEvent } from "matrix-js-sdk/src/matrix"; -import { parseTopicContent, TopicState } from "matrix-js-sdk/src/content-helpers"; +import { EventType, MatrixEvent, Room, RoomStateEvent, ContentHelpers } from "matrix-js-sdk/src/matrix"; import { MRoomTopicEventContent } from "matrix-js-sdk/src/@types/topic"; import { Optional } from "matrix-events-sdk"; import { useTypedEventEmitter } from "../useEventEmitter"; -export const getTopic = (room?: Room): Optional<TopicState> => { +export const getTopic = (room?: Room): Optional<ContentHelpers.TopicState> => { const content = room?.currentState?.getStateEvents(EventType.RoomTopic, "")?.getContent<MRoomTopicEventContent>(); - return !!content ? parseTopicContent(content) : null; + return !!content ? ContentHelpers.parseTopicContent(content) : null; }; -export function useTopic(room?: Room): Optional<TopicState> { +export function useTopic(room?: Room): Optional<ContentHelpers.TopicState> { const [topic, setTopic] = useState(getTopic(room)); useTypedEventEmitter(room?.currentState, RoomStateEvent.Events, (ev: MatrixEvent) => { if (ev.getType() !== EventType.RoomTopic) return; diff --git a/src/hooks/usePublicRoomDirectory.ts b/src/hooks/usePublicRoomDirectory.ts index f514497785..c5a015b292 100644 --- a/src/hooks/usePublicRoomDirectory.ts +++ b/src/hooks/usePublicRoomDirectory.ts @@ -14,8 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { RoomType, IProtocol, IPublicRoomsChunkRoom } from "matrix-js-sdk/src/matrix"; -import { IRoomDirectoryOptions } from "matrix-js-sdk/src/@types/requests"; +import { RoomType, IProtocol, IPublicRoomsChunkRoom, IRoomDirectoryOptions } from "matrix-js-sdk/src/matrix"; import { useCallback, useEffect, useState } from "react"; import { IPublicRoomDirectoryConfig } from "../components/views/directory/NetworkDropdown"; diff --git a/src/hooks/useSpaceResults.ts b/src/hooks/useSpaceResults.ts index ebeed76239..f21e071610 100644 --- a/src/hooks/useSpaceResults.ts +++ b/src/hooks/useSpaceResults.ts @@ -15,15 +15,14 @@ limitations under the License. */ import { useCallback, useEffect, useMemo, useState } from "react"; -import { Room, RoomType } from "matrix-js-sdk/src/matrix"; -import { IHierarchyRoom } from "matrix-js-sdk/src/@types/spaces"; +import { Room, RoomType, HierarchyRoom } from "matrix-js-sdk/src/matrix"; import { RoomHierarchy } from "matrix-js-sdk/src/room-hierarchy"; import { normalize } from "matrix-js-sdk/src/utils"; import { MatrixClientPeg } from "../MatrixClientPeg"; -export const useSpaceResults = (space: Room | undefined, query: string): [IHierarchyRoom[], boolean] => { - const [rooms, setRooms] = useState<IHierarchyRoom[]>([]); +export const useSpaceResults = (space: Room | undefined, query: string): [HierarchyRoom[], boolean] => { + const [rooms, setRooms] = useState<HierarchyRoom[]>([]); const [hierarchy, setHierarchy] = useState<RoomHierarchy>(); const resetHierarchy = useCallback(() => { diff --git a/src/stores/OwnBeaconStore.ts b/src/stores/OwnBeaconStore.ts index 2dcef5554c..bdece66512 100644 --- a/src/stores/OwnBeaconStore.ts +++ b/src/stores/OwnBeaconStore.ts @@ -24,8 +24,8 @@ import { RoomMember, RoomState, RoomStateEvent, + ContentHelpers, } from "matrix-js-sdk/src/matrix"; -import { BeaconInfoState, makeBeaconContent, makeBeaconInfoContent } from "matrix-js-sdk/src/content-helpers"; import { MBeaconInfoEventContent, M_BEACON } from "matrix-js-sdk/src/@types/beacon"; import { logger } from "matrix-js-sdk/src/logger"; @@ -549,13 +549,16 @@ export class OwnBeaconStore extends AsyncStoreWithClient<OwnBeaconStoreState> { * Records error in beaconUpdateErrors * rethrows */ - private updateBeaconEvent = async (beacon: Beacon, update: Partial<BeaconInfoState>): Promise<void> => { + private updateBeaconEvent = async ( + beacon: Beacon, + update: Partial<ContentHelpers.BeaconInfoState>, + ): Promise<void> => { const { description, timeout, timestamp, live, assetType } = { ...beacon.beaconInfo, ...update, }; - const updateContent = makeBeaconInfoContent(timeout, live, description, assetType, timestamp); + const updateContent = ContentHelpers.makeBeaconInfoContent(timeout, live, description, assetType, timestamp); try { await this.matrixClient!.unstable_setLiveBeacon(beacon.roomId, updateContent); @@ -593,7 +596,7 @@ export class OwnBeaconStore extends AsyncStoreWithClient<OwnBeaconStoreState> { * Sends m.location event to referencing given beacon */ private sendLocationToBeacon = async (beacon: Beacon, { geoUri, timestamp }: TimedGeoUri): Promise<void> => { - const content = makeBeaconContent(geoUri, timestamp, beacon.beaconInfoId); + const content = ContentHelpers.makeBeaconContent(geoUri, timestamp, beacon.beaconInfoId); try { await this.matrixClient!.sendEvent(beacon.roomId, M_BEACON.name, content); this.incrementBeaconLocationPublishErrorCount(beacon.identifier, false); diff --git a/src/stores/spaces/SpaceStore.ts b/src/stores/spaces/SpaceStore.ts index 0d2b7eab66..0075e99231 100644 --- a/src/stores/spaces/SpaceStore.ts +++ b/src/stores/spaces/SpaceStore.ts @@ -24,9 +24,9 @@ import { RoomStateEvent, MatrixEvent, ClientEvent, + ISendEventResponse, } from "matrix-js-sdk/src/matrix"; import { logger } from "matrix-js-sdk/src/logger"; -import { ISendEventResponse } from "matrix-js-sdk/src/@types/requests"; import { AsyncStoreWithClient } from "../AsyncStoreWithClient"; import defaultDispatcher from "../../dispatcher/dispatcher"; diff --git a/src/stores/spaces/index.ts b/src/stores/spaces/index.ts index 6e5f325767..fc4a3c0164 100644 --- a/src/stores/spaces/index.ts +++ b/src/stores/spaces/index.ts @@ -14,8 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { Room } from "matrix-js-sdk/src/matrix"; -import { IHierarchyRoom } from "matrix-js-sdk/src/@types/spaces"; +import { Room, HierarchyRoom } from "matrix-js-sdk/src/matrix"; import { _t } from "../../languageHandler"; @@ -50,7 +49,7 @@ export const getMetaSpaceName = (spaceKey: MetaSpace, allRoomsInHome = false): s export type SpaceKey = MetaSpace | Room["roomId"]; -export interface ISuggestedRoom extends IHierarchyRoom { +export interface ISuggestedRoom extends HierarchyRoom { viaServers: string[]; } diff --git a/src/utils/AutoDiscoveryUtils.tsx b/src/utils/AutoDiscoveryUtils.tsx index 9a2572b6f3..8027eb7292 100644 --- a/src/utils/AutoDiscoveryUtils.tsx +++ b/src/utils/AutoDiscoveryUtils.tsx @@ -15,8 +15,13 @@ limitations under the License. */ import React, { ReactNode } from "react"; -import { AutoDiscovery, ClientConfig, OidcClientConfig } from "matrix-js-sdk/src/autodiscovery"; -import { M_AUTHENTICATION, IClientWellKnown } from "matrix-js-sdk/src/matrix"; +import { + AutoDiscovery, + ClientConfig, + OidcClientConfig, + M_AUTHENTICATION, + IClientWellKnown, +} from "matrix-js-sdk/src/matrix"; import { logger } from "matrix-js-sdk/src/logger"; import { _t, UserFriendlyError } from "../languageHandler"; diff --git a/src/utils/UserInteractiveAuth.ts b/src/utils/UserInteractiveAuth.ts index e78f88cbce..04d48db298 100644 --- a/src/utils/UserInteractiveAuth.ts +++ b/src/utils/UserInteractiveAuth.ts @@ -15,7 +15,7 @@ limitations under the License. */ import { AuthDict } from "matrix-js-sdk/src/interactive-auth"; -import { UIAResponse } from "matrix-js-sdk/src/@types/uia"; +import { UIAResponse } from "matrix-js-sdk/src/matrix"; import Modal from "../Modal"; import InteractiveAuthDialog, { InteractiveAuthDialogProps } from "../components/views/dialogs/InteractiveAuthDialog"; diff --git a/src/utils/ValidatedServerConfig.ts b/src/utils/ValidatedServerConfig.ts index f46737207e..14a28b058d 100644 --- a/src/utils/ValidatedServerConfig.ts +++ b/src/utils/ValidatedServerConfig.ts @@ -14,8 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { OidcClientConfig } from "matrix-js-sdk/src/autodiscovery"; -import { IDelegatedAuthConfig } from "matrix-js-sdk/src/matrix"; +import { OidcClientConfig, IDelegatedAuthConfig } from "matrix-js-sdk/src/matrix"; import { ValidatedIssuerConfig } from "matrix-js-sdk/src/oidc/validate"; export type ValidatedDelegatedAuthConfig = IDelegatedAuthConfig & ValidatedIssuerConfig; diff --git a/src/utils/beacon/duration.ts b/src/utils/beacon/duration.ts index a0a3686101..9ccbdc7b65 100644 --- a/src/utils/beacon/duration.ts +++ b/src/utils/beacon/duration.ts @@ -14,8 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { BeaconInfoState } from "matrix-js-sdk/src/content-helpers"; -import { Beacon } from "matrix-js-sdk/src/matrix"; +import { Beacon, ContentHelpers } from "matrix-js-sdk/src/matrix"; /** * Get ms until expiry @@ -27,7 +26,7 @@ import { Beacon } from "matrix-js-sdk/src/matrix"; export const msUntilExpiry = (startTimestamp: number, durationMs: number): number => Math.max(0, startTimestamp + durationMs - Date.now()); -export const getBeaconMsUntilExpiry = (beaconInfo: BeaconInfoState): number => +export const getBeaconMsUntilExpiry = (beaconInfo: ContentHelpers.BeaconInfoState): number => msUntilExpiry(beaconInfo.timestamp || 0, beaconInfo.timeout); export const getBeaconExpiryTimestamp = (beacon: Beacon): number => diff --git a/src/utils/oidc/authorize.ts b/src/utils/oidc/authorize.ts index 08a8068d9a..7943aecd80 100644 --- a/src/utils/oidc/authorize.ts +++ b/src/utils/oidc/authorize.ts @@ -16,7 +16,7 @@ limitations under the License. import { completeAuthorizationCodeGrant, generateOidcAuthorizationUrl } from "matrix-js-sdk/src/oidc/authorize"; import { QueryDict } from "matrix-js-sdk/src/utils"; -import { OidcClientConfig } from "matrix-js-sdk/src/autodiscovery"; +import { OidcClientConfig } from "matrix-js-sdk/src/matrix"; import { randomString } from "matrix-js-sdk/src/randomstring"; /** diff --git a/test/components/structures/SpaceHierarchy-test.tsx b/test/components/structures/SpaceHierarchy-test.tsx index 5e414f5111..0fb8dd52a1 100644 --- a/test/components/structures/SpaceHierarchy-test.tsx +++ b/test/components/structures/SpaceHierarchy-test.tsx @@ -17,9 +17,8 @@ limitations under the License. import React from "react"; import { mocked } from "jest-mock"; import { fireEvent, render, screen, waitFor, waitForElementToBeRemoved } from "@testing-library/react"; -import { MatrixClient, Room } from "matrix-js-sdk/src/matrix"; +import { MatrixClient, Room, HierarchyRoom } from "matrix-js-sdk/src/matrix"; import { RoomHierarchy } from "matrix-js-sdk/src/room-hierarchy"; -import { IHierarchyRoom } from "matrix-js-sdk/src/@types/spaces"; import { MatrixClientPeg } from "../../../src/MatrixClientPeg"; import { mkStubRoom, stubClient } from "../../test-utils"; @@ -85,41 +84,41 @@ describe("SpaceHierarchy", () => { it("grabs last room that is in hierarchy when latest version is in hierarchy", () => { const hierarchy = { roomMap: new Map([ - [roomV1.roomId, { room_id: roomV1.roomId } as IHierarchyRoom], - [roomV2.roomId, { room_id: roomV2.roomId } as IHierarchyRoom], - [roomV3.roomId, { room_id: roomV3.roomId } as IHierarchyRoom], + [roomV1.roomId, { room_id: roomV1.roomId } as HierarchyRoom], + [roomV2.roomId, { room_id: roomV2.roomId } as HierarchyRoom], + [roomV3.roomId, { room_id: roomV3.roomId } as HierarchyRoom], ]), } as RoomHierarchy; - const localRoomV1 = toLocalRoom(client, { room_id: roomV1.roomId } as IHierarchyRoom, hierarchy); + const localRoomV1 = toLocalRoom(client, { room_id: roomV1.roomId } as HierarchyRoom, hierarchy); expect(localRoomV1.room_id).toEqual(roomV3.roomId); - const localRoomV2 = toLocalRoom(client, { room_id: roomV2.roomId } as IHierarchyRoom, hierarchy); + const localRoomV2 = toLocalRoom(client, { room_id: roomV2.roomId } as HierarchyRoom, hierarchy); expect(localRoomV2.room_id).toEqual(roomV3.roomId); - const localRoomV3 = toLocalRoom(client, { room_id: roomV3.roomId } as IHierarchyRoom, hierarchy); + const localRoomV3 = toLocalRoom(client, { room_id: roomV3.roomId } as HierarchyRoom, hierarchy); expect(localRoomV3.room_id).toEqual(roomV3.roomId); }); it("grabs last room that is in hierarchy when latest version is *not* in hierarchy", () => { const hierarchy = { roomMap: new Map([ - [roomV1.roomId, { room_id: roomV1.roomId } as IHierarchyRoom], - [roomV2.roomId, { room_id: roomV2.roomId } as IHierarchyRoom], + [roomV1.roomId, { room_id: roomV1.roomId } as HierarchyRoom], + [roomV2.roomId, { room_id: roomV2.roomId } as HierarchyRoom], ]), } as RoomHierarchy; - const localRoomV1 = toLocalRoom(client, { room_id: roomV1.roomId } as IHierarchyRoom, hierarchy); + const localRoomV1 = toLocalRoom(client, { room_id: roomV1.roomId } as HierarchyRoom, hierarchy); expect(localRoomV1.room_id).toEqual(roomV2.roomId); - const localRoomV2 = toLocalRoom(client, { room_id: roomV2.roomId } as IHierarchyRoom, hierarchy); + const localRoomV2 = toLocalRoom(client, { room_id: roomV2.roomId } as HierarchyRoom, hierarchy); expect(localRoomV2.room_id).toEqual(roomV2.roomId); - const localRoomV3 = toLocalRoom(client, { room_id: roomV3.roomId } as IHierarchyRoom, hierarchy); + const localRoomV3 = toLocalRoom(client, { room_id: roomV3.roomId } as HierarchyRoom, hierarchy); expect(localRoomV3.room_id).toEqual(roomV2.roomId); }); it("returns specified room when none of the versions is in hierarchy", () => { const hierarchy = { roomMap: new Map([]) } as RoomHierarchy; - const localRoomV1 = toLocalRoom(client, { room_id: roomV1.roomId } as IHierarchyRoom, hierarchy); + const localRoomV1 = toLocalRoom(client, { room_id: roomV1.roomId } as HierarchyRoom, hierarchy); expect(localRoomV1.room_id).toEqual(roomV1.roomId); - const localRoomV2 = toLocalRoom(client, { room_id: roomV2.roomId } as IHierarchyRoom, hierarchy); + const localRoomV2 = toLocalRoom(client, { room_id: roomV2.roomId } as HierarchyRoom, hierarchy); expect(localRoomV2.room_id).toEqual(roomV2.roomId); - const localRoomV3 = toLocalRoom(client, { room_id: roomV3.roomId } as IHierarchyRoom, hierarchy); + const localRoomV3 = toLocalRoom(client, { room_id: roomV3.roomId } as HierarchyRoom, hierarchy); expect(localRoomV3.room_id).toEqual(roomV3.roomId); }); @@ -130,7 +129,7 @@ describe("SpaceHierarchy", () => { it("Passes through the dynamic predecessor setting", async () => { mocked(client.getRoomUpgradeHistory).mockClear(); const hierarchy = { roomMap: new Map([]) } as RoomHierarchy; - toLocalRoom(client, { room_id: roomV1.roomId } as IHierarchyRoom, hierarchy); + toLocalRoom(client, { room_id: roomV1.roomId } as HierarchyRoom, hierarchy); expect(client.getRoomUpgradeHistory).toHaveBeenCalledWith(roomV1.roomId, true, false); }); }); @@ -146,7 +145,7 @@ describe("SpaceHierarchy", () => { it("Passes through the dynamic predecessor setting", async () => { mocked(client.getRoomUpgradeHistory).mockClear(); const hierarchy = { roomMap: new Map([]) } as RoomHierarchy; - toLocalRoom(client, { room_id: roomV1.roomId } as IHierarchyRoom, hierarchy); + toLocalRoom(client, { room_id: roomV1.roomId } as HierarchyRoom, hierarchy); expect(client.getRoomUpgradeHistory).toHaveBeenCalledWith(roomV1.roomId, true, true); }); }); @@ -183,7 +182,7 @@ describe("SpaceHierarchy", () => { ); [room1, room2, space1, room3].forEach((r) => mocked(r.getMyMembership).mockReturnValue("leave")); - const hierarchyRoot: IHierarchyRoom = { + const hierarchyRoot: HierarchyRoom = { room_id: root.roomId, num_joined_members: 1, room_type: "m.space", @@ -213,21 +212,21 @@ describe("SpaceHierarchy", () => { world_readable: true, guest_can_join: true, }; - const hierarchyRoom1: IHierarchyRoom = { + const hierarchyRoom1: HierarchyRoom = { room_id: room1.roomId, num_joined_members: 2, children_state: [], world_readable: true, guest_can_join: true, }; - const hierarchyRoom2: IHierarchyRoom = { + const hierarchyRoom2: HierarchyRoom = { room_id: room2.roomId, num_joined_members: 3, children_state: [], world_readable: true, guest_can_join: true, }; - const hierarchyRoom3: IHierarchyRoom = { + const hierarchyRoom3: HierarchyRoom = { name: "Nested room", room_id: room3.roomId, num_joined_members: 3, @@ -235,7 +234,7 @@ describe("SpaceHierarchy", () => { world_readable: true, guest_can_join: true, }; - const hierarchySpace1: IHierarchyRoom = { + const hierarchySpace1: HierarchyRoom = { room_id: space1.roomId, name: "Nested space", num_joined_members: 1, diff --git a/test/components/structures/auth/Login-test.tsx b/test/components/structures/auth/Login-test.tsx index d79692f909..9a9a1a8329 100644 --- a/test/components/structures/auth/Login-test.tsx +++ b/test/components/structures/auth/Login-test.tsx @@ -20,7 +20,7 @@ import { mocked, MockedObject } from "jest-mock"; import fetchMock from "fetch-mock-jest"; import { DELEGATED_OIDC_COMPATIBILITY, IdentityProviderBrand } from "matrix-js-sdk/src/@types/auth"; import { logger } from "matrix-js-sdk/src/logger"; -import { createClient, MatrixClient } from "matrix-js-sdk/src/matrix"; +import * as Matrix from "matrix-js-sdk/src/matrix"; import { OidcError } from "matrix-js-sdk/src/oidc/error"; import SdkConfig from "../../../../src/SdkConfig"; @@ -32,8 +32,6 @@ import { Features } from "../../../../src/settings/Settings"; import { ValidatedDelegatedAuthConfig } from "../../../../src/utils/ValidatedServerConfig"; import * as registerClientUtils from "../../../../src/utils/oidc/registerClient"; -jest.mock("matrix-js-sdk/src/matrix"); - jest.useRealTimers(); const oidcStaticClientsConfig = { @@ -48,7 +46,7 @@ describe("Login", function () { const mockClient = mocked({ login: jest.fn().mockResolvedValue({}), loginFlows: jest.fn(), - } as unknown as MatrixClient); + } as unknown as Matrix.MatrixClient); beforeEach(function () { SdkConfig.put({ @@ -62,7 +60,7 @@ describe("Login", function () { user_id: "@user:server", }); mockClient.loginFlows.mockClear().mockResolvedValue({ flows: [{ type: "m.login.password" }] }); - mocked(createClient).mockImplementation((opts) => { + jest.spyOn(Matrix, "createClient").mockImplementation((opts) => { mockClient.idBaseUrl = opts.idBaseUrl; mockClient.baseUrl = opts.baseUrl; return mockClient; diff --git a/test/components/views/beacon/BeaconListItem-test.tsx b/test/components/views/beacon/BeaconListItem-test.tsx index cab8da30a0..10497b369f 100644 --- a/test/components/views/beacon/BeaconListItem-test.tsx +++ b/test/components/views/beacon/BeaconListItem-test.tsx @@ -16,8 +16,7 @@ limitations under the License. import React from "react"; import { act, fireEvent, render } from "@testing-library/react"; -import { Beacon, RoomMember, MatrixEvent } from "matrix-js-sdk/src/matrix"; -import { LocationAssetType } from "matrix-js-sdk/src/@types/location"; +import { Beacon, RoomMember, MatrixEvent, LocationAssetType } from "matrix-js-sdk/src/matrix"; import BeaconListItem from "../../../../src/components/views/beacon/BeaconListItem"; import MatrixClientContext from "../../../../src/contexts/MatrixClientContext"; diff --git a/test/components/views/location/LocationViewDialog-test.tsx b/test/components/views/location/LocationViewDialog-test.tsx index f4108cd625..fb85ac2db6 100644 --- a/test/components/views/location/LocationViewDialog-test.tsx +++ b/test/components/views/location/LocationViewDialog-test.tsx @@ -16,8 +16,7 @@ limitations under the License. import React from "react"; import { render, RenderResult } from "@testing-library/react"; -import { RoomMember } from "matrix-js-sdk/src/matrix"; -import { LocationAssetType } from "matrix-js-sdk/src/@types/location"; +import { RoomMember, LocationAssetType } from "matrix-js-sdk/src/matrix"; import LocationViewDialog from "../../../../src/components/views/location/LocationViewDialog"; import { TILE_SERVER_WK_KEY } from "../../../../src/utils/WellKnownUtils"; diff --git a/test/components/views/location/shareLocation-test.ts b/test/components/views/location/shareLocation-test.ts index 6213e1a531..017430fd22 100644 --- a/test/components/views/location/shareLocation-test.ts +++ b/test/components/views/location/shareLocation-test.ts @@ -15,8 +15,7 @@ limitations under the License. */ import { mocked } from "jest-mock"; -import { MatrixClient } from "matrix-js-sdk/src/matrix"; -import { makeLocationContent } from "matrix-js-sdk/src/content-helpers"; +import { ContentHelpers, MatrixClient } from "matrix-js-sdk/src/matrix"; import { LegacyLocationEventContent, MLocationEventContent } from "matrix-js-sdk/src/@types/location"; import { doMaybeLocalRoomAction } from "../../../../src/utils/local-room"; @@ -30,10 +29,6 @@ jest.mock("../../../../src/utils/local-room", () => ({ doMaybeLocalRoomAction: jest.fn(), })); -jest.mock("matrix-js-sdk/src/content-helpers", () => ({ - makeLocationContent: jest.fn(), -})); - describe("shareLocation", () => { const roomId = "!room:example.com"; const shareType = LocationShareType.Pin; @@ -42,6 +37,7 @@ describe("shareLocation", () => { let shareLocationFn: ShareLocationFn; beforeEach(() => { + const makeLocationContent = jest.spyOn(ContentHelpers, "makeLocationContent"); client = { sendMessage: jest.fn(), } as unknown as MatrixClient; diff --git a/test/components/views/messages/MLocationBody-test.tsx b/test/components/views/messages/MLocationBody-test.tsx index 753cb6eca2..7f3bddaa4c 100644 --- a/test/components/views/messages/MLocationBody-test.tsx +++ b/test/components/views/messages/MLocationBody-test.tsx @@ -16,8 +16,7 @@ limitations under the License. import React, { ComponentProps } from "react"; import { fireEvent, render } from "@testing-library/react"; -import { LocationAssetType } from "matrix-js-sdk/src/@types/location"; -import { ClientEvent, RoomMember, SyncState } from "matrix-js-sdk/src/matrix"; +import { LocationAssetType, ClientEvent, RoomMember, SyncState } from "matrix-js-sdk/src/matrix"; import * as maplibregl from "maplibre-gl"; import { logger } from "matrix-js-sdk/src/logger"; diff --git a/test/stores/OwnBeaconStore-test.ts b/test/stores/OwnBeaconStore-test.ts index b3aae13166..9867fb2728 100644 --- a/test/stores/OwnBeaconStore-test.ts +++ b/test/stores/OwnBeaconStore-test.ts @@ -22,8 +22,8 @@ import { MatrixEvent, RoomStateEvent, RoomMember, + ContentHelpers, } from "matrix-js-sdk/src/matrix"; -import { makeBeaconContent, makeBeaconInfoContent } from "matrix-js-sdk/src/content-helpers"; import { M_BEACON } from "matrix-js-sdk/src/@types/beacon"; import { logger } from "matrix-js-sdk/src/logger"; import { Mocked } from "jest-mock"; @@ -239,12 +239,12 @@ describe("OwnBeaconStore", () => { expect(mockClient.sendEvent).toHaveBeenCalledWith( room1Id, M_BEACON.name, - makeBeaconContent(defaultLocationUri, now, alicesRoom1BeaconInfo.getId()!), + ContentHelpers.makeBeaconContent(defaultLocationUri, now, alicesRoom1BeaconInfo.getId()!), ); expect(mockClient.sendEvent).toHaveBeenCalledWith( room2Id, M_BEACON.name, - makeBeaconContent(defaultLocationUri, now, alicesRoom2BeaconInfo.getId()!), + ContentHelpers.makeBeaconContent(defaultLocationUri, now, alicesRoom2BeaconInfo.getId()!), ); }); }); @@ -1155,14 +1155,14 @@ describe("OwnBeaconStore", () => { it("creates a live beacon", async () => { const store = await makeOwnBeaconStore(); - const content = makeBeaconInfoContent(100); + const content = ContentHelpers.makeBeaconInfoContent(100); await store.createLiveBeacon(room1Id, content); expect(mockClient.unstable_createLiveBeacon).toHaveBeenCalledWith(room1Id, content); }); it("sets new beacon event id in local storage", async () => { const store = await makeOwnBeaconStore(); - const content = makeBeaconInfoContent(100); + const content = ContentHelpers.makeBeaconInfoContent(100); await store.createLiveBeacon(room1Id, content); expect(localStorageSetSpy).toHaveBeenCalledWith( @@ -1174,7 +1174,7 @@ describe("OwnBeaconStore", () => { it("handles saving beacon event id when local storage has bad value", async () => { localStorageGetSpy.mockReturnValue(JSON.stringify({ id: "1" })); const store = await makeOwnBeaconStore(); - const content = makeBeaconInfoContent(100); + const content = ContentHelpers.makeBeaconInfoContent(100); await store.createLiveBeacon(room1Id, content); // stored successfully @@ -1183,7 +1183,7 @@ describe("OwnBeaconStore", () => { it("creates a live beacon without error when no beacons exist for room", async () => { const store = await makeOwnBeaconStore(); - const content = makeBeaconInfoContent(100); + const content = ContentHelpers.makeBeaconInfoContent(100); await store.createLiveBeacon(room1Id, content); // didn't throw, no error log @@ -1195,7 +1195,7 @@ describe("OwnBeaconStore", () => { makeRoomsWithStateEvents([alicesRoom1BeaconInfo, alicesRoom2BeaconInfo]); const store = await makeOwnBeaconStore(); - const content = makeBeaconInfoContent(100); + const content = ContentHelpers.makeBeaconInfoContent(100); await store.createLiveBeacon(room1Id, content); // stop alicesRoom1BeaconInfo diff --git a/test/test-utils/beacon.ts b/test/test-utils/beacon.ts index 18ef73bdae..0cea7820bc 100644 --- a/test/test-utils/beacon.ts +++ b/test/test-utils/beacon.ts @@ -15,10 +15,15 @@ limitations under the License. */ import { MockedObject } from "jest-mock"; -import { makeBeaconInfoContent, makeBeaconContent } from "matrix-js-sdk/src/content-helpers"; -import { MatrixClient, MatrixEvent, Beacon, getBeaconInfoIdentifier } from "matrix-js-sdk/src/matrix"; +import { + MatrixClient, + MatrixEvent, + Beacon, + getBeaconInfoIdentifier, + ContentHelpers, + LocationAssetType, +} from "matrix-js-sdk/src/matrix"; import { M_BEACON, M_BEACON_INFO } from "matrix-js-sdk/src/@types/beacon"; -import { LocationAssetType } from "matrix-js-sdk/src/@types/location"; import { getMockGeolocationPositionError } from "./location"; import { makeRoomWithStateEvents } from "./room"; @@ -54,7 +59,7 @@ export const makeBeaconInfoEvent = ( room_id: roomId, state_key: sender, sender, - content: makeBeaconInfoContent(timeout, isLive, description, assetType, timestamp), + content: ContentHelpers.makeBeaconInfoContent(timeout, isLive, description, assetType, timestamp), }); event.event.origin_server_ts = Date.now(); @@ -97,7 +102,7 @@ export const makeBeaconEvent = ( type: M_BEACON.name, room_id: roomId, sender, - content: makeBeaconContent(geoUri, timestamp, beaconInfoId, description), + content: ContentHelpers.makeBeaconContent(geoUri, timestamp, beaconInfoId, description), }); }; diff --git a/test/test-utils/location.ts b/test/test-utils/location.ts index 044259d52f..548e131360 100644 --- a/test/test-utils/location.ts +++ b/test/test-utils/location.ts @@ -15,8 +15,7 @@ limitations under the License. */ import { LocationAssetType, M_LOCATION } from "matrix-js-sdk/src/@types/location"; -import { makeLocationContent } from "matrix-js-sdk/src/content-helpers"; -import { MatrixEvent, EventType } from "matrix-js-sdk/src/matrix"; +import { MatrixEvent, EventType, ContentHelpers } from "matrix-js-sdk/src/matrix"; let id = 1; export const makeLegacyLocationEvent = (geoUri: string): MatrixEvent => { @@ -35,7 +34,7 @@ export const makeLocationEvent = (geoUri: string, assetType?: LocationAssetType) return new MatrixEvent({ event_id: `$${++id}`, type: M_LOCATION.name, - content: makeLocationContent( + content: ContentHelpers.makeLocationContent( `Found at ${geoUri} at 2021-12-21T12:22+0000`, geoUri, 252523, diff --git a/test/test-utils/oidc.ts b/test/test-utils/oidc.ts index aa042eba5d..2432e3350f 100644 --- a/test/test-utils/oidc.ts +++ b/test/test-utils/oidc.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { OidcClientConfig } from "matrix-js-sdk/src/autodiscovery"; +import { OidcClientConfig } from "matrix-js-sdk/src/matrix"; import { ValidatedIssuerMetadata } from "matrix-js-sdk/src/oidc/validate"; /** diff --git a/test/utils/AutoDiscoveryUtils-test.tsx b/test/utils/AutoDiscoveryUtils-test.tsx index d1465179c4..81692aad91 100644 --- a/test/utils/AutoDiscoveryUtils-test.tsx +++ b/test/utils/AutoDiscoveryUtils-test.tsx @@ -14,9 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { AutoDiscovery, AutoDiscoveryAction, ClientConfig } from "matrix-js-sdk/src/autodiscovery"; +import { AutoDiscovery, AutoDiscoveryAction, ClientConfig, M_AUTHENTICATION } from "matrix-js-sdk/src/matrix"; import { logger } from "matrix-js-sdk/src/logger"; -import { M_AUTHENTICATION } from "matrix-js-sdk/src/matrix"; import AutoDiscoveryUtils from "../../src/utils/AutoDiscoveryUtils"; diff --git a/test/utils/location/isSelfLocation-test.ts b/test/utils/location/isSelfLocation-test.ts index a9d1f705e8..02d9b0253c 100644 --- a/test/utils/location/isSelfLocation-test.ts +++ b/test/utils/location/isSelfLocation-test.ts @@ -22,13 +22,13 @@ import { M_LOCATION, M_TIMESTAMP, } from "matrix-js-sdk/src/@types/location"; -import { makeLocationContent } from "matrix-js-sdk/src/content-helpers"; +import { ContentHelpers } from "matrix-js-sdk/src/matrix"; import { isSelfLocation } from "../../../src/utils/location"; describe("isSelfLocation", () => { it("Returns true for a full m.asset event", () => { - const content = makeLocationContent("", "0", Date.now()); + const content = ContentHelpers.makeLocationContent("", "0", Date.now()); expect(isSelfLocation(content)).toBe(true); }); @@ -61,7 +61,7 @@ describe("isSelfLocation", () => { }); it("Returns false for an unknown asset type", () => { - const content = makeLocationContent( + const content = ContentHelpers.makeLocationContent( undefined /* text */, "geo:foo", 0,