diff --git a/modules/widget-lifecycle/element-web/README.md b/modules/widget-lifecycle/element-web/README.md index 7cc0bc734c..cfe2569e4e 100644 --- a/modules/widget-lifecycle/element-web/README.md +++ b/modules/widget-lifecycle/element-web/README.md @@ -61,14 +61,3 @@ This is useful when widgets have multiple routes or capabilities include variabl } } ``` - -## Copyright & License - -Copyright (c) 2025 New Vector Ltd - -This software is multi licensed by New Vector Ltd (Element). It can be used either: - -(1) for free under the terms of the GNU Affero General Public License (as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version); OR - -(2) under the terms of a paid-for Element Commercial License agreement between you and Element (the terms of which may vary depending on what you and Element have agreed to). -Unless required by applicable law or agreed to in writing, software distributed under the Licenses is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the Licenses for the specific language governing permissions and limitations under the Licenses. diff --git a/modules/widget-lifecycle/element-web/e2e/fixture/widget.html b/modules/widget-lifecycle/element-web/e2e/fixture/widget.html index 1667a73c44..4c293c5c6d 100644 --- a/modules/widget-lifecycle/element-web/e2e/fixture/widget.html +++ b/modules/widget-lifecycle/element-web/e2e/fixture/widget.html @@ -1,4 +1,13 @@ - + @@ -19,6 +28,7 @@ let sendEventCount = 0; window.onmessage = async (ev) => { if (ev.data.action === "capabilities") { + // Step 1: Element is asking what capabilities this widget needs. window.parent.postMessage( Object.assign( { @@ -31,6 +41,8 @@ "*", ); } else if (ev.data.action === "notify_capabilities") { + // Step 2: Capabilities have been approved. Request an OpenID token + // so we can identify the current user in step 3. window.parent.postMessage( { api: "fromWidget", @@ -42,6 +54,8 @@ "*", ); } else if (ev.data.action === "get_openid" && ev.data.response?.state === "allowed") { + // Step 3: Token granted — exchange it for the user's Matrix ID and display it. + // Tests assert on this heading to verify identity was passed through correctly. const { access_token } = ev.data.response; const hsUrl = new URLSearchParams(window.location.search).get("hsUrl"); diff --git a/modules/widget-lifecycle/element-web/src/WidgetLifecycleModule.ts b/modules/widget-lifecycle/element-web/src/WidgetLifecycleModule.ts index 144a799291..ec2ca1034b 100644 --- a/modules/widget-lifecycle/element-web/src/WidgetLifecycleModule.ts +++ b/modules/widget-lifecycle/element-web/src/WidgetLifecycleModule.ts @@ -30,7 +30,7 @@ export default class WidgetLifecycleModule implements Module { public constructor(private api: ModuleApi) {} public async load(): Promise { - if (!this.api.widgetLifecycle?.registerPreloadApprover) { + if (!this.api.widgetLifecycle) { throw new Error( "Widget lifecycle API is not available. Update Element Web to a build that provides widget lifecycle module support.", ); diff --git a/modules/widget-lifecycle/element-web/src/config.ts b/modules/widget-lifecycle/element-web/src/config.ts index 0746ae37f1..ac22f816b2 100644 --- a/modules/widget-lifecycle/element-web/src/config.ts +++ b/modules/widget-lifecycle/element-web/src/config.ts @@ -32,16 +32,16 @@ const ModuleConfigSchema = z.partial( /** Map from URL patterns to their widget approval configuration. */ export type WidgetLifecycleModuleConfig = Record; -/** - * Parse and validate the widget lifecycle module configuration. - * Returns an empty config if the input is falsy; throws on schema violations. - */ declare module "@element-hq/element-web-module-api" { export interface Config { [CONFIG_KEY]: z.input; } } +/** + * Parse and validate the widget lifecycle module configuration. + * Returns an empty config if the input is falsy; throws on schema violations. + */ export const parseWidgetLifecycleConfig = (value: unknown): WidgetLifecycleModuleConfig => { if (!value) return {}; diff --git a/modules/widget-lifecycle/element-web/vite.config.ts b/modules/widget-lifecycle/element-web/vite.config.ts index 3e4bed43a0..cc1fa98eb7 100644 --- a/modules/widget-lifecycle/element-web/vite.config.ts +++ b/modules/widget-lifecycle/element-web/vite.config.ts @@ -1,5 +1,5 @@ /* -Copyright 2025 New Vector Ltd. +Copyright 2026 Element Creations Ltd. SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial Please see LICENSE files in the repository root for full details. diff --git a/modules/widget-lifecycle/element-web/vitest.config.ts b/modules/widget-lifecycle/element-web/vitest.config.ts index 7ec0ff7fd7..783608fb44 100644 --- a/modules/widget-lifecycle/element-web/vitest.config.ts +++ b/modules/widget-lifecycle/element-web/vitest.config.ts @@ -1,5 +1,5 @@ /* -Copyright 2025 New Vector Ltd. +Copyright 2026 Element Creations Ltd. SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial Please see LICENSE files in the repository root for full details.