diff options
Diffstat (limited to 'includes/external/matrix/node_modules/matrix-widget-api/src/interfaces')
34 files changed, 1418 insertions, 0 deletions
diff --git a/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/ApiVersion.ts b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/ApiVersion.ts new file mode 100644 index 0000000..6586c14 --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/ApiVersion.ts @@ -0,0 +1,50 @@ +/* + * Copyright 2020 The Matrix.org Foundation C.I.C. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export enum MatrixApiVersion { + Prerelease1 = "0.0.1", + Prerelease2 = "0.0.2", + //V010 = "0.1.0", // first release +} + +export enum UnstableApiVersion { + MSC2762 = "org.matrix.msc2762", + MSC2871 = "org.matrix.msc2871", + MSC2931 = "org.matrix.msc2931", + MSC2974 = "org.matrix.msc2974", + MSC2876 = "org.matrix.msc2876", + MSC3819 = "org.matrix.msc3819", + MSC3846 = "town.robin.msc3846", + MSC3869 = "org.matrix.msc3869", + MSC3973 = "org.matrix.msc3973", +} + +export type ApiVersion = MatrixApiVersion | UnstableApiVersion | string; + +export const CurrentApiVersions: ApiVersion[] = [ + MatrixApiVersion.Prerelease1, + MatrixApiVersion.Prerelease2, + //MatrixApiVersion.V010, + UnstableApiVersion.MSC2762, + UnstableApiVersion.MSC2871, + UnstableApiVersion.MSC2931, + UnstableApiVersion.MSC2974, + UnstableApiVersion.MSC2876, + UnstableApiVersion.MSC3819, + UnstableApiVersion.MSC3846, + UnstableApiVersion.MSC3869, + UnstableApiVersion.MSC3973, +]; diff --git a/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/Capabilities.ts b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/Capabilities.ts new file mode 100644 index 0000000..1572105 --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/Capabilities.ts @@ -0,0 +1,71 @@ +/* + * Copyright 2020 - 2021 The Matrix.org Foundation C.I.C. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { Symbols } from "../Symbols"; + +export enum MatrixCapabilities { + Screenshots = "m.capability.screenshot", + StickerSending = "m.sticker", + AlwaysOnScreen = "m.always_on_screen", + /** + * @deprecated It is not recommended to rely on this existing - it can be removed without notice. + * Ask Element to not give the option to move the widget into a separate tab. + */ + RequiresClient = "io.element.requires_client", + /** + * @deprecated It is not recommended to rely on this existing - it can be removed without notice. + */ + MSC2931Navigate = "org.matrix.msc2931.navigate", + MSC3846TurnServers = "town.robin.msc3846.turn_servers", + /** + * @deprecated It is not recommended to rely on this existing - it can be removed without notice. + */ + MSC3973UserDirectorySearch = "org.matrix.msc3973.user_directory_search", +} + +export type Capability = MatrixCapabilities | string; + +export const StickerpickerCapabilities: Capability[] = [MatrixCapabilities.StickerSending]; +export const VideoConferenceCapabilities: Capability[] = [MatrixCapabilities.AlwaysOnScreen]; + +/** + * Determines if a capability is a capability for a timeline. + * @param {Capability} capability The capability to test. + * @returns {boolean} True if a timeline capability, false otherwise. + */ +export function isTimelineCapability(capability: Capability): boolean { + // TODO: Change when MSC2762 becomes stable. + return capability?.startsWith("org.matrix.msc2762.timeline:"); +} + +/** + * Determines if a capability is a timeline capability for the given room. + * @param {Capability} capability The capability to test. + * @param {string | Symbols.AnyRoom} roomId The room ID, or `Symbols.AnyRoom` for that designation. + * @returns {boolean} True if a matching capability, false otherwise. + */ +export function isTimelineCapabilityFor(capability: Capability, roomId: string | Symbols.AnyRoom): boolean { + return capability === `org.matrix.msc2762.timeline:${roomId}`; +} + +/** + * Gets the room ID described by a timeline capability. + * @param {string} capability The capability to parse. + * @returns {string} The room ID. + */ +export function getTimelineRoomIDFromCapability(capability: Capability): string { + return capability.substring(capability.indexOf(":") + 1); +} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/CapabilitiesAction.ts b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/CapabilitiesAction.ts new file mode 100644 index 0000000..365bb79 --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/CapabilitiesAction.ts @@ -0,0 +1,60 @@ +/* + * Copyright 2020 The Matrix.org Foundation C.I.C. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { IWidgetApiRequest, IWidgetApiRequestData, IWidgetApiRequestEmptyData } from "./IWidgetApiRequest"; +import { WidgetApiFromWidgetAction, WidgetApiToWidgetAction } from "./WidgetApiAction"; +import { Capability } from "./Capabilities"; +import { IWidgetApiAcknowledgeResponseData, IWidgetApiResponseData } from "./IWidgetApiResponse"; + +export interface ICapabilitiesActionRequest extends IWidgetApiRequest { + action: WidgetApiToWidgetAction.Capabilities; + data: IWidgetApiRequestEmptyData; +} + +export interface ICapabilitiesActionResponseData extends IWidgetApiResponseData { + capabilities: Capability[]; +} + +export interface ICapabilitiesActionResponse extends ICapabilitiesActionRequest { + response: ICapabilitiesActionResponseData; +} + +export interface INotifyCapabilitiesActionRequestData extends IWidgetApiRequestData { + requested: Capability[]; + approved: Capability[]; +} + +export interface INotifyCapabilitiesActionRequest extends IWidgetApiRequest { + action: WidgetApiToWidgetAction.NotifyCapabilities; + data: INotifyCapabilitiesActionRequestData; +} + +export interface INotifyCapabilitiesActionResponse extends INotifyCapabilitiesActionRequest { + response: IWidgetApiAcknowledgeResponseData; +} + +export interface IRenegotiateCapabilitiesActionRequest extends IWidgetApiRequest { + action: WidgetApiFromWidgetAction.MSC2974RenegotiateCapabilities; + data: IRenegotiateCapabilitiesRequestData; +} + +export interface IRenegotiateCapabilitiesRequestData extends IWidgetApiResponseData { + capabilities: Capability[]; +} + +export interface IRenegotiateCapabilitiesActionResponse extends IRenegotiateCapabilitiesActionRequest { + // nothing +} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/ContentLoadedAction.ts b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/ContentLoadedAction.ts new file mode 100644 index 0000000..ceca93f --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/ContentLoadedAction.ts @@ -0,0 +1,28 @@ +/* + * Copyright 2020 The Matrix.org Foundation C.I.C. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { IWidgetApiRequest, IWidgetApiRequestEmptyData } from "./IWidgetApiRequest"; +import { WidgetApiFromWidgetAction } from "./WidgetApiAction"; +import { IWidgetApiAcknowledgeResponseData } from "./IWidgetApiResponse"; + +export interface IContentLoadedActionRequest extends IWidgetApiRequest { + action: WidgetApiFromWidgetAction.ContentLoaded; + data: IWidgetApiRequestEmptyData; +} + +export interface IContentLoadedActionResponse extends IContentLoadedActionRequest { + response: IWidgetApiAcknowledgeResponseData; +} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/GetOpenIDAction.ts b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/GetOpenIDAction.ts new file mode 100644 index 0000000..000313c --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/GetOpenIDAction.ts @@ -0,0 +1,49 @@ +/* + * Copyright 2020 The Matrix.org Foundation C.I.C. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { IWidgetApiRequest, IWidgetApiRequestData } from "./IWidgetApiRequest"; +import { WidgetApiFromWidgetAction } from "./WidgetApiAction"; +import { IWidgetApiResponseData } from "./IWidgetApiResponse"; + +export enum OpenIDRequestState { + Allowed = "allowed", + Blocked = "blocked", + PendingUserConfirmation = "request", +} + +export interface IOpenIDCredentials { + access_token?: string; // eslint-disable-line camelcase + expires_in?: number; // eslint-disable-line camelcase + matrix_server_name?: string; // eslint-disable-line camelcase + token_type?: "Bearer" | string; // eslint-disable-line camelcase +} + +export interface IGetOpenIDActionRequestData extends IWidgetApiRequestData { + // nothing +} + +export interface IGetOpenIDActionRequest extends IWidgetApiRequest { + action: WidgetApiFromWidgetAction.GetOpenIDCredentials; + data: IGetOpenIDActionRequestData; +} + +export interface IGetOpenIDActionResponseData extends IWidgetApiResponseData, IOpenIDCredentials { + state: OpenIDRequestState; +} + +export interface IGetOpenIDActionResponse extends IGetOpenIDActionRequest { + response: IGetOpenIDActionResponseData; +} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/ICustomWidgetData.ts b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/ICustomWidgetData.ts new file mode 100644 index 0000000..56657fb --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/ICustomWidgetData.ts @@ -0,0 +1,27 @@ +/* + * Copyright 2020 The Matrix.org Foundation C.I.C. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { IWidgetData } from "./IWidget"; + +/** + * Widget data for m.custom specifically. + */ +export interface ICustomWidgetData extends IWidgetData { + /** + * The URL for the widget if the templated URL is not exactly what will be loaded. + */ + url?: string; +} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/IJitsiWidgetData.ts b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/IJitsiWidgetData.ts new file mode 100644 index 0000000..65b22a0 --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/IJitsiWidgetData.ts @@ -0,0 +1,38 @@ +/* + * Copyright 2020 The Matrix.org Foundation C.I.C. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { IWidgetData } from "./IWidget"; + +/** + * Widget data for m.jitsi widgets. + */ +export interface IJitsiWidgetData extends IWidgetData { + /** + * The domain where the Jitsi Meet conference is being held. + */ + domain: string; + + /** + * The conference ID (also known as the room name) where the conference is being held. + */ + conferenceId: string; + + /** + * Optional. True to indicate that the conference should be without video, false + * otherwise (default). + */ + isAudioOnly?: boolean; +} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/IRoomEvent.ts b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/IRoomEvent.ts new file mode 100644 index 0000000..5e90005 --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/IRoomEvent.ts @@ -0,0 +1,26 @@ +/* + * Copyright 2020 - 2021 The Matrix.org Foundation C.I.C. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export interface IRoomEvent { + type: string; + sender: string; + event_id: string; // eslint-disable-line camelcase + room_id: string; // eslint-disable-line camelcase + state_key?: string; // eslint-disable-line camelcase + origin_server_ts: number; // eslint-disable-line camelcase + content: unknown; + unsigned: unknown; +} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/IStickerpickerWidgetData.ts b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/IStickerpickerWidgetData.ts new file mode 100644 index 0000000..1459fa5 --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/IStickerpickerWidgetData.ts @@ -0,0 +1,21 @@ +/* + * Copyright 2020 The Matrix.org Foundation C.I.C. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { IWidgetData } from "./IWidget"; + +export interface IStickerpickerWidgetData extends IWidgetData { + // no additional properties (for now) +} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/IWidget.ts b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/IWidget.ts new file mode 100644 index 0000000..a6ee670 --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/IWidget.ts @@ -0,0 +1,75 @@ +/* + * Copyright 2020 The Matrix.org Foundation C.I.C. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { WidgetType } from "./WidgetType"; + +/** + * Widget data. + */ +export interface IWidgetData { + /** + * Optional title for the widget. + */ + title?: string; + + /** + * Custom keys for inclusion in the template URL. + */ + [key: string]: unknown; +} + +/** + * Common properties of a widget. + * https://matrix.org/docs/spec/widgets/latest#widgetcommonproperties-schema + */ +export interface IWidget { + /** + * The ID of the widget. + */ + id: string; + + /** + * The user ID who originally created the widget. + */ + creatorUserId: string; + + /** + * Optional name for the widget. + */ + name?: string; + + /** + * The type of widget. + */ + type: WidgetType; + + /** + * The URL for the widget, with template variables. + */ + url: string; + + /** + * Optional flag to indicate whether or not the client should initiate communication + * right after the iframe loads (default, true) or when the widget indicates it is + * ready (false). + */ + waitForIframeLoad?: boolean; + + /** + * Data for the widget. + */ + data?: IWidgetData; +} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/IWidgetApiErrorResponse.ts b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/IWidgetApiErrorResponse.ts new file mode 100644 index 0000000..f9e123f --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/IWidgetApiErrorResponse.ts @@ -0,0 +1,35 @@ +/* + * Copyright 2020 The Matrix.org Foundation C.I.C. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { IWidgetApiResponse, IWidgetApiResponseData } from "./IWidgetApiResponse"; + +export interface IWidgetApiErrorResponseData extends IWidgetApiResponseData { + error: { + message: string; + }; +} + +export interface IWidgetApiErrorResponse extends IWidgetApiResponse { + response: IWidgetApiErrorResponseData; +} + +export function isErrorResponse(responseData: IWidgetApiResponseData): boolean { + if ("error" in responseData) { + const err = <IWidgetApiErrorResponseData>responseData; + return !!err.error.message; + } + return false; +} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/IWidgetApiRequest.ts b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/IWidgetApiRequest.ts new file mode 100644 index 0000000..ec9e211 --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/IWidgetApiRequest.ts @@ -0,0 +1,37 @@ +/* + * Copyright 2020 The Matrix.org Foundation C.I.C. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { WidgetApiDirection } from "./WidgetApiDirection"; +import { WidgetApiAction } from "./WidgetApiAction"; + +export interface IWidgetApiRequestData { + [key: string]: unknown; +} + +export interface IWidgetApiRequestEmptyData extends IWidgetApiRequestData { + // nothing +} + +export interface IWidgetApiRequest { + api: WidgetApiDirection; + requestId: string; + action: WidgetApiAction; + widgetId: string; + data: IWidgetApiRequestData; + // XXX: This is for Scalar support + // TODO: Fix scalar + visible?: any; +} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/IWidgetApiResponse.ts b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/IWidgetApiResponse.ts new file mode 100644 index 0000000..2347b6f --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/IWidgetApiResponse.ts @@ -0,0 +1,29 @@ +/* + * Copyright 2020 The Matrix.org Foundation C.I.C. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { IWidgetApiRequest } from "./IWidgetApiRequest"; + +export interface IWidgetApiResponseData { + [key: string]: unknown; +} + +export interface IWidgetApiAcknowledgeResponseData extends IWidgetApiResponseData { + // nothing +} + +export interface IWidgetApiResponse extends IWidgetApiRequest { + response: IWidgetApiResponseData; +} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/ModalButtonKind.ts b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/ModalButtonKind.ts new file mode 100644 index 0000000..e82c939 --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/ModalButtonKind.ts @@ -0,0 +1,23 @@ +/* + * Copyright 2020 The Matrix.org Foundation C.I.C. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export enum ModalButtonKind { + Primary = "m.primary", + Secondary = "m.secondary", + Warning = "m.warning", + Danger = "m.danger", + Link = "m.link", +} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/ModalWidgetActions.ts b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/ModalWidgetActions.ts new file mode 100644 index 0000000..b8f07d4 --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/ModalWidgetActions.ts @@ -0,0 +1,89 @@ +/* + * Copyright 2020 The Matrix.org Foundation C.I.C. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { IWidgetApiRequest, IWidgetApiRequestData } from "./IWidgetApiRequest"; +import { WidgetApiFromWidgetAction, WidgetApiToWidgetAction } from "./WidgetApiAction"; +import { IWidgetApiAcknowledgeResponseData, IWidgetApiResponse } from "./IWidgetApiResponse"; +import { IWidget } from "./IWidget"; +import { ModalButtonKind } from "./ModalButtonKind"; + +export enum BuiltInModalButtonID { + Close = "m.close", +} +export type ModalButtonID = BuiltInModalButtonID | string; + +export interface IModalWidgetCreateData extends IWidgetApiRequestData { + [key: string]: unknown; +} + +export interface IModalWidgetReturnData { + [key: string]: unknown; +} + +// Types for a normal modal requesting the opening a modal widget +export interface IModalWidgetOpenRequestDataButton { + id: ModalButtonID; + label: string; + kind: ModalButtonKind | string; + disabled?: boolean; +} + +export interface IModalWidgetOpenRequestData extends IModalWidgetCreateData, Omit<IWidget, "id" | "creatorUserId"> { + buttons?: IModalWidgetOpenRequestDataButton[]; +} + +export interface IModalWidgetOpenRequest extends IWidgetApiRequest { + action: WidgetApiFromWidgetAction.OpenModalWidget; + data: IModalWidgetOpenRequestData; +} + +export interface IModalWidgetOpenResponse extends IWidgetApiResponse { + response: IWidgetApiAcknowledgeResponseData; +} + +// Types for a modal widget receiving notifications that its buttons have been pressed +export interface IModalWidgetButtonClickedRequestData extends IWidgetApiRequestData { + id: IModalWidgetOpenRequestDataButton["id"]; +} + +export interface IModalWidgetButtonClickedRequest extends IWidgetApiRequest { + action: WidgetApiToWidgetAction.ButtonClicked; + data: IModalWidgetButtonClickedRequestData; +} + +export interface IModalWidgetButtonClickedResponse extends IWidgetApiResponse { + response: IWidgetApiAcknowledgeResponseData; +} + +// Types for a modal widget requesting close +export interface IModalWidgetCloseRequest extends IWidgetApiRequest { + action: WidgetApiFromWidgetAction.CloseModalWidget; + data: IModalWidgetReturnData; +} + +export interface IModalWidgetCloseResponse extends IWidgetApiResponse { + response: IWidgetApiAcknowledgeResponseData; +} + +// Types for a normal widget being notified that the modal widget it opened has been closed +export interface IModalWidgetCloseNotificationRequest extends IWidgetApiRequest { + action: WidgetApiToWidgetAction.CloseModalWidget; + data: IModalWidgetReturnData; +} + +export interface IModalWidgetCloseNotificationResponse extends IWidgetApiResponse { + response: IWidgetApiAcknowledgeResponseData; +} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/NavigateAction.ts b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/NavigateAction.ts new file mode 100644 index 0000000..04960eb --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/NavigateAction.ts @@ -0,0 +1,32 @@ +/* + * Copyright 2020 The Matrix.org Foundation C.I.C. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { IWidgetApiRequest, IWidgetApiRequestData } from "./IWidgetApiRequest"; +import { WidgetApiFromWidgetAction } from "./WidgetApiAction"; +import { IWidgetApiAcknowledgeResponseData } from "./IWidgetApiResponse"; + +export interface INavigateActionRequest extends IWidgetApiRequest { + action: WidgetApiFromWidgetAction.MSC2931Navigate; + data: INavigateActionRequestData; +} + +export interface INavigateActionRequestData extends IWidgetApiRequestData { + uri: string; +} + +export interface INavigateActionResponse extends INavigateActionRequest { + response: IWidgetApiAcknowledgeResponseData; +} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/OpenIDCredentialsAction.ts b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/OpenIDCredentialsAction.ts new file mode 100644 index 0000000..c4766f1 --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/OpenIDCredentialsAction.ts @@ -0,0 +1,38 @@ +/* + * Copyright 2020 The Matrix.org Foundation C.I.C. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { IWidgetApiRequest, IWidgetApiRequestData } from "./IWidgetApiRequest"; +import { WidgetApiToWidgetAction } from "./WidgetApiAction"; +import { IWidgetApiResponseData } from "./IWidgetApiResponse"; +import { IOpenIDCredentials, OpenIDRequestState } from "./GetOpenIDAction"; + +export interface IOpenIDCredentialsActionRequestData extends IWidgetApiRequestData, IOpenIDCredentials { + state: OpenIDRequestState; + original_request_id: string; // eslint-disable-line camelcase +} + +export interface IOpenIDCredentialsActionRequest extends IWidgetApiRequest { + action: WidgetApiToWidgetAction.OpenIDCredentials; + data: IOpenIDCredentialsActionRequestData; +} + +export interface IOpenIDCredentialsActionResponseData extends IWidgetApiResponseData { + // nothing +} + +export interface IOpenIDCredentialsIDActionResponse extends IOpenIDCredentialsActionRequest { + response: IOpenIDCredentialsActionResponseData; +} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/ReadEventAction.ts b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/ReadEventAction.ts new file mode 100644 index 0000000..8cea7cf --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/ReadEventAction.ts @@ -0,0 +1,42 @@ +/* + * Copyright 2021 The Matrix.org Foundation C.I.C. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { IWidgetApiRequest, IWidgetApiRequestData } from "./IWidgetApiRequest"; +import { WidgetApiFromWidgetAction } from "./WidgetApiAction"; +import { IWidgetApiResponseData } from "./IWidgetApiResponse"; +import { IRoomEvent } from "./IRoomEvent"; +import { Symbols } from "../Symbols"; + +export interface IReadEventFromWidgetRequestData extends IWidgetApiRequestData { + state_key?: string | boolean; // eslint-disable-line camelcase + msgtype?: string; + type: string; + limit?: number; + room_ids?: Symbols.AnyRoom | string[]; // eslint-disable-line camelcase +} + +export interface IReadEventFromWidgetActionRequest extends IWidgetApiRequest { + action: WidgetApiFromWidgetAction.MSC2876ReadEvents; + data: IReadEventFromWidgetRequestData; +} + +export interface IReadEventFromWidgetResponseData extends IWidgetApiResponseData { + events: IRoomEvent[]; +} + +export interface IReadEventFromWidgetActionResponse extends IReadEventFromWidgetActionRequest { + response: IReadEventFromWidgetResponseData; +} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/ReadRelationsAction.ts b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/ReadRelationsAction.ts new file mode 100644 index 0000000..76a041a --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/ReadRelationsAction.ts @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Nordeck IT + Consulting GmbH. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { IRoomEvent } from "./IRoomEvent"; +import { IWidgetApiRequest, IWidgetApiRequestData } from "./IWidgetApiRequest"; +import { IWidgetApiResponseData } from "./IWidgetApiResponse"; +import { WidgetApiFromWidgetAction } from "./WidgetApiAction"; + +export interface IReadRelationsFromWidgetRequestData extends IWidgetApiRequestData { + event_id: string; // eslint-disable-line camelcase + rel_type?: string; // eslint-disable-line camelcase + event_type?: string; // eslint-disable-line camelcase + room_id?: string; // eslint-disable-line camelcase + + limit?: number; + from?: string; + to?: string; + direction?: 'f' | 'b'; +} + +export interface IReadRelationsFromWidgetActionRequest extends IWidgetApiRequest { + action: WidgetApiFromWidgetAction.MSC3869ReadRelations; + data: IReadRelationsFromWidgetRequestData; +} + +export interface IReadRelationsFromWidgetResponseData extends IWidgetApiResponseData { + chunk: IRoomEvent[]; + + next_batch?: string; // eslint-disable-line camelcase + prev_batch?: string; // eslint-disable-line camelcase +} + +export interface IReadRelationsFromWidgetActionResponse extends IReadRelationsFromWidgetActionRequest { + response: IReadRelationsFromWidgetResponseData; +} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/ScreenshotAction.ts b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/ScreenshotAction.ts new file mode 100644 index 0000000..f9ec315 --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/ScreenshotAction.ts @@ -0,0 +1,32 @@ +/* + * Copyright 2020 The Matrix.org Foundation C.I.C. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { IWidgetApiRequest, IWidgetApiRequestEmptyData } from "./IWidgetApiRequest"; +import { WidgetApiToWidgetAction } from "./WidgetApiAction"; +import { IWidgetApiResponseData } from "./IWidgetApiResponse"; + +export interface IScreenshotActionRequest extends IWidgetApiRequest { + action: WidgetApiToWidgetAction.TakeScreenshot; + data: IWidgetApiRequestEmptyData; +} + +export interface IScreenshotActionResponseData extends IWidgetApiResponseData { + screenshot: Blob; +} + +export interface IScreenshotActionResponse extends IScreenshotActionRequest { + response: IScreenshotActionResponseData; +} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/SendEventAction.ts b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/SendEventAction.ts new file mode 100644 index 0000000..8fe6da0 --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/SendEventAction.ts @@ -0,0 +1,57 @@ +/* + * Copyright 2020 - 2021 The Matrix.org Foundation C.I.C. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { IWidgetApiRequest, IWidgetApiRequestData } from "./IWidgetApiRequest"; +import { WidgetApiFromWidgetAction, WidgetApiToWidgetAction } from "./WidgetApiAction"; +import { IWidgetApiResponseData } from "./IWidgetApiResponse"; +import { IRoomEvent } from "./IRoomEvent"; + +export interface ISendEventFromWidgetRequestData extends IWidgetApiRequestData { + state_key?: string; // eslint-disable-line camelcase + type: string; + content: unknown; + room_id?: string; // eslint-disable-line camelcase +} + +export interface ISendEventFromWidgetActionRequest extends IWidgetApiRequest { + action: WidgetApiFromWidgetAction.SendEvent; + data: ISendEventFromWidgetRequestData; +} + +export interface ISendEventFromWidgetResponseData extends IWidgetApiResponseData { + room_id: string; // eslint-disable-line camelcase + event_id: string; // eslint-disable-line camelcase +} + +export interface ISendEventFromWidgetActionResponse extends ISendEventFromWidgetActionRequest { + response: ISendEventFromWidgetResponseData; +} + +export interface ISendEventToWidgetRequestData extends IWidgetApiRequestData, IRoomEvent { +} + +export interface ISendEventToWidgetActionRequest extends IWidgetApiRequest { + action: WidgetApiToWidgetAction.SendEvent; + data: ISendEventToWidgetRequestData; +} + +export interface ISendEventToWidgetResponseData extends IWidgetApiResponseData { + // nothing +} + +export interface ISendEventToWidgetActionResponse extends ISendEventToWidgetActionRequest { + response: ISendEventToWidgetResponseData; +} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/SendToDeviceAction.ts b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/SendToDeviceAction.ts new file mode 100644 index 0000000..e7507b3 --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/SendToDeviceAction.ts @@ -0,0 +1,56 @@ +/* + * Copyright 2022 The Matrix.org Foundation C.I.C. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { IWidgetApiRequest, IWidgetApiRequestData } from "./IWidgetApiRequest"; +import { WidgetApiFromWidgetAction, WidgetApiToWidgetAction } from "./WidgetApiAction"; +import { IWidgetApiResponseData } from "./IWidgetApiResponse"; +import { IRoomEvent } from "./IRoomEvent"; + +export interface ISendToDeviceFromWidgetRequestData extends IWidgetApiRequestData { + type: string; + encrypted: boolean; + messages: { [userId: string]: { [deviceId: string]: object } }; +} + +export interface ISendToDeviceFromWidgetActionRequest extends IWidgetApiRequest { + action: WidgetApiFromWidgetAction.SendToDevice; + data: ISendToDeviceFromWidgetRequestData; +} + +export interface ISendToDeviceFromWidgetResponseData extends IWidgetApiResponseData { + // nothing +} + +export interface ISendToDeviceFromWidgetActionResponse extends ISendToDeviceFromWidgetActionRequest { + response: ISendToDeviceFromWidgetResponseData; +} + +export interface ISendToDeviceToWidgetRequestData extends IWidgetApiRequestData, IRoomEvent { + encrypted: boolean; +} + +export interface ISendToDeviceToWidgetActionRequest extends IWidgetApiRequest { + action: WidgetApiToWidgetAction.SendToDevice; + data: ISendToDeviceToWidgetRequestData; +} + +export interface ISendToDeviceToWidgetResponseData extends IWidgetApiResponseData { + // nothing +} + +export interface ISendToDeviceToWidgetActionResponse extends ISendToDeviceToWidgetActionRequest { + response: ISendToDeviceToWidgetResponseData; +} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/SetModalButtonEnabledAction.ts b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/SetModalButtonEnabledAction.ts new file mode 100644 index 0000000..5702e8c --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/SetModalButtonEnabledAction.ts @@ -0,0 +1,34 @@ +/* + * Copyright 2020 The Matrix.org Foundation C.I.C. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { IWidgetApiRequest, IWidgetApiRequestData } from "./IWidgetApiRequest"; +import { WidgetApiFromWidgetAction } from "./WidgetApiAction"; +import { IWidgetApiAcknowledgeResponseData } from "./IWidgetApiResponse"; +import { ModalButtonID } from "./ModalWidgetActions"; + +export interface ISetModalButtonEnabledActionRequestData extends IWidgetApiRequestData { + enabled: boolean; + button: ModalButtonID; +} + +export interface ISetModalButtonEnabledActionRequest extends IWidgetApiRequest { + action: WidgetApiFromWidgetAction.SetModalButtonEnabled; + data: ISetModalButtonEnabledActionRequestData; +} + +export interface ISetModalButtonEnabledActionResponse extends ISetModalButtonEnabledActionRequest { + response: IWidgetApiAcknowledgeResponseData; +} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/StickerAction.ts b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/StickerAction.ts new file mode 100644 index 0000000..13cb94a --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/StickerAction.ts @@ -0,0 +1,48 @@ +/* + * Copyright 2020 The Matrix.org Foundation C.I.C. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { IWidgetApiRequest, IWidgetApiRequestData } from "./IWidgetApiRequest"; +import { WidgetApiFromWidgetAction } from "./WidgetApiAction"; +import { IWidgetApiAcknowledgeResponseData } from "./IWidgetApiResponse"; + +export interface IStickerActionRequestData extends IWidgetApiRequestData { + name: string; + description?: string; + content: { + url: string; + info?: { + h?: number; + w?: number; + mimetype?: string; + size?: number; + thumbnail_info?: { // eslint-disable-line camelcase + h?: number; + w?: number; + mimetype?: string; + size?: number; + }; + }; + }; +} + +export interface IStickerActionRequest extends IWidgetApiRequest { + action: WidgetApiFromWidgetAction.SendSticker; + data: IStickerActionRequestData; +} + +export interface IStickerActionResponse extends IStickerActionRequest { + response: IWidgetApiAcknowledgeResponseData; +} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/StickyAction.ts b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/StickyAction.ts new file mode 100644 index 0000000..7d49f02 --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/StickyAction.ts @@ -0,0 +1,36 @@ +/* + * Copyright 2020 The Matrix.org Foundation C.I.C. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { IWidgetApiRequest, IWidgetApiRequestData } from "./IWidgetApiRequest"; +import { WidgetApiFromWidgetAction } from "./WidgetApiAction"; +import { IWidgetApiResponseData } from "./IWidgetApiResponse"; + +export interface IStickyActionRequestData extends IWidgetApiRequestData { + value: boolean; +} + +export interface IStickyActionRequest extends IWidgetApiRequest { + action: WidgetApiFromWidgetAction.UpdateAlwaysOnScreen; + data: IStickyActionRequestData; +} + +export interface IStickyActionResponseData extends IWidgetApiResponseData { + success: boolean; +} + +export interface IStickyActionResponse extends IStickyActionRequest { + response: IStickyActionResponseData; +} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/SupportedVersionsAction.ts b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/SupportedVersionsAction.ts new file mode 100644 index 0000000..8486ebc --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/SupportedVersionsAction.ts @@ -0,0 +1,33 @@ +/* + * Copyright 2020 The Matrix.org Foundation C.I.C. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { IWidgetApiRequest, IWidgetApiRequestEmptyData } from "./IWidgetApiRequest"; +import { WidgetApiFromWidgetAction, WidgetApiToWidgetAction } from "./WidgetApiAction"; +import { ApiVersion } from "./ApiVersion"; +import { IWidgetApiResponseData } from "./IWidgetApiResponse"; + +export interface ISupportedVersionsActionRequest extends IWidgetApiRequest { + action: WidgetApiFromWidgetAction.SupportedApiVersions | WidgetApiToWidgetAction.SupportedApiVersions; + data: IWidgetApiRequestEmptyData; +} + +export interface ISupportedVersionsActionResponseData extends IWidgetApiResponseData { + supported_versions: ApiVersion[]; // eslint-disable-line camelcase +} + +export interface ISupportedVersionsActionResponse extends ISupportedVersionsActionRequest { + response: ISupportedVersionsActionResponseData; +} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/TurnServerActions.ts b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/TurnServerActions.ts new file mode 100644 index 0000000..3a9bd29 --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/TurnServerActions.ts @@ -0,0 +1,55 @@ +/* + * Copyright 2022 The Matrix.org Foundation C.I.C. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { IWidgetApiRequest, IWidgetApiRequestData, IWidgetApiRequestEmptyData } from "./IWidgetApiRequest"; +import { WidgetApiFromWidgetAction, WidgetApiToWidgetAction } from "./WidgetApiAction"; +import { IWidgetApiAcknowledgeResponseData, IWidgetApiResponse } from "./IWidgetApiResponse"; + +export interface ITurnServer { + uris: string[]; + username: string; + password: string; +} + +export interface IWatchTurnServersRequest extends IWidgetApiRequest { + action: WidgetApiFromWidgetAction.WatchTurnServers; + data: IWidgetApiRequestEmptyData; +} + +export interface IWatchTurnServersResponse extends IWidgetApiResponse { + response: IWidgetApiAcknowledgeResponseData; +} + +export interface IUnwatchTurnServersRequest extends IWidgetApiRequest { + action: WidgetApiFromWidgetAction.UnwatchTurnServers; + data: IWidgetApiRequestEmptyData; +} + +export interface IUnwatchTurnServersResponse extends IWidgetApiResponse { + response: IWidgetApiAcknowledgeResponseData; +} + +export interface IUpdateTurnServersRequestData extends IWidgetApiRequestData, ITurnServer { +} + +export interface IUpdateTurnServersRequest extends IWidgetApiRequest { + action: WidgetApiToWidgetAction.UpdateTurnServers; + data: IUpdateTurnServersRequestData; +} + +export interface IUpdateTurnServersResponse extends IWidgetApiResponse { + response: IWidgetApiAcknowledgeResponseData; +} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/UserDirectorySearchAction.ts b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/UserDirectorySearchAction.ts new file mode 100644 index 0000000..fb900cc --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/UserDirectorySearchAction.ts @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Nordeck IT + Consulting GmbH. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { IWidgetApiRequest, IWidgetApiRequestData } from "./IWidgetApiRequest"; +import { IWidgetApiResponseData } from "./IWidgetApiResponse"; +import { WidgetApiFromWidgetAction } from "./WidgetApiAction"; + +export interface IUserDirectorySearchFromWidgetRequestData extends IWidgetApiRequestData { + search_term: string; // eslint-disable-line camelcase + limit?: number; +} + +export interface IUserDirectorySearchFromWidgetActionRequest extends IWidgetApiRequest { + action: WidgetApiFromWidgetAction.MSC3973UserDirectorySearch; + data: IUserDirectorySearchFromWidgetRequestData; +} + +export interface IUserDirectorySearchFromWidgetResponseData extends IWidgetApiResponseData { + limited: boolean; + results: Array<{ + user_id: string; // eslint-disable-line camelcase + display_name?: string; // eslint-disable-line camelcase + avatar_url?: string; // eslint-disable-line camelcase + }>; +} + +export interface IUserDirectorySearchFromWidgetActionResponse extends IUserDirectorySearchFromWidgetActionRequest { + response: IUserDirectorySearchFromWidgetResponseData; +} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/VisibilityAction.ts b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/VisibilityAction.ts new file mode 100644 index 0000000..55aa53f --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/VisibilityAction.ts @@ -0,0 +1,32 @@ +/* + * Copyright 2020 The Matrix.org Foundation C.I.C. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { IWidgetApiRequest, IWidgetApiRequestData } from "./IWidgetApiRequest"; +import { WidgetApiToWidgetAction } from "./WidgetApiAction"; +import { IWidgetApiAcknowledgeResponseData } from "./IWidgetApiResponse"; + +export interface IVisibilityActionRequestData extends IWidgetApiRequestData { + visible: boolean; +} + +export interface IVisibilityActionRequest extends IWidgetApiRequest { + action: WidgetApiToWidgetAction.UpdateVisibility; + data: IVisibilityActionRequestData; +} + +export interface IVisibilityActionResponse extends IVisibilityActionRequest { + response: IWidgetApiAcknowledgeResponseData; +} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/WidgetApiAction.ts b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/WidgetApiAction.ts new file mode 100644 index 0000000..34c8aa3 --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/WidgetApiAction.ts @@ -0,0 +1,72 @@ +/* + * Copyright 2020 The Matrix.org Foundation C.I.C. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export enum WidgetApiToWidgetAction { + SupportedApiVersions = "supported_api_versions", + Capabilities = "capabilities", + NotifyCapabilities = "notify_capabilities", + TakeScreenshot = "screenshot", + UpdateVisibility = "visibility", + OpenIDCredentials = "openid_credentials", + WidgetConfig = "widget_config", + CloseModalWidget = "close_modal", + ButtonClicked = "button_clicked", + SendEvent = "send_event", + SendToDevice = "send_to_device", + UpdateTurnServers = "update_turn_servers", +} + +export enum WidgetApiFromWidgetAction { + SupportedApiVersions = "supported_api_versions", + ContentLoaded = "content_loaded", + SendSticker = "m.sticker", + UpdateAlwaysOnScreen = "set_always_on_screen", + GetOpenIDCredentials = "get_openid", + CloseModalWidget = "close_modal", + OpenModalWidget = "open_modal", + SetModalButtonEnabled = "set_button_enabled", + SendEvent = "send_event", + SendToDevice = "send_to_device", + WatchTurnServers = "watch_turn_servers", + UnwatchTurnServers = "unwatch_turn_servers", + + /** + * @deprecated It is not recommended to rely on this existing - it can be removed without notice. + */ + MSC2876ReadEvents = "org.matrix.msc2876.read_events", + + /** + * @deprecated It is not recommended to rely on this existing - it can be removed without notice. + */ + MSC2931Navigate = "org.matrix.msc2931.navigate", + + /** + * @deprecated It is not recommended to rely on this existing - it can be removed without notice. + */ + MSC2974RenegotiateCapabilities = "org.matrix.msc2974.request_capabilities", + + /** + * @deprecated It is not recommended to rely on this existing - it can be removed without notice. + */ + MSC3869ReadRelations = "org.matrix.msc3869.read_relations", + + /** + * @deprecated It is not recommended to rely on this existing - it can be removed without notice. + */ + MSC3973UserDirectorySearch = "org.matrix.msc3973.user_directory_search", +} + +export type WidgetApiAction = WidgetApiToWidgetAction | WidgetApiFromWidgetAction | string; diff --git a/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/WidgetApiDirection.ts b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/WidgetApiDirection.ts new file mode 100644 index 0000000..e11e144 --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/WidgetApiDirection.ts @@ -0,0 +1,30 @@ +/* + * Copyright 2020 The Matrix.org Foundation C.I.C. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export enum WidgetApiDirection { + ToWidget = "toWidget", + FromWidget = "fromWidget", +} + +export function invertedDirection(dir: WidgetApiDirection): WidgetApiDirection { + if (dir === WidgetApiDirection.ToWidget) { + return WidgetApiDirection.FromWidget; + } else if (dir === WidgetApiDirection.FromWidget) { + return WidgetApiDirection.ToWidget; + } else { + throw new Error("Invalid direction"); + } +} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/WidgetConfigAction.ts b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/WidgetConfigAction.ts new file mode 100644 index 0000000..b10314c --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/WidgetConfigAction.ts @@ -0,0 +1,29 @@ +/* + * Copyright 2020 The Matrix.org Foundation C.I.C. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { IWidgetApiRequest } from "./IWidgetApiRequest"; +import { WidgetApiToWidgetAction } from "./WidgetApiAction"; +import { IWidgetApiAcknowledgeResponseData, IWidgetApiResponse } from "./IWidgetApiResponse"; +import { IModalWidgetOpenRequestData } from "./ModalWidgetActions"; + +export interface IWidgetConfigRequest extends IWidgetApiRequest { + action: WidgetApiToWidgetAction.WidgetConfig; + data: IModalWidgetOpenRequestData; +} + +export interface IWidgetConfigResponse extends IWidgetApiResponse { + response: IWidgetApiAcknowledgeResponseData; +} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/WidgetKind.ts b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/WidgetKind.ts new file mode 100644 index 0000000..374e198 --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/WidgetKind.ts @@ -0,0 +1,21 @@ +/* + * Copyright 2020 The Matrix.org Foundation C.I.C. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export enum WidgetKind { + Room = "room", + Account = "account", + Modal = "modal", +} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/WidgetType.ts b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/WidgetType.ts new file mode 100644 index 0000000..d6b3e33 --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-widget-api/src/interfaces/WidgetType.ts @@ -0,0 +1,23 @@ +/* + * Copyright 2020 The Matrix.org Foundation C.I.C. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export enum MatrixWidgetType { + Custom = "m.custom", + JitsiMeet = "m.jitsi", + Stickerpicker = "m.stickerpicker", +} + +export type WidgetType = MatrixWidgetType | string; |