mirror of
https://github.com/vector-im/element-web.git
synced 2025-10-12 07:51:05 +02:00
Merge pull request #5596 from matrix-org/jryans/hybrid-from-config
Support managed hybrid widgets from config
This commit is contained in:
commit
b39fdaae45
@ -21,6 +21,7 @@ import WidgetUtils from "../utils/WidgetUtils";
|
|||||||
import { IStoredLayout, WidgetLayoutStore } from "../stores/widgets/WidgetLayoutStore";
|
import { IStoredLayout, WidgetLayoutStore } from "../stores/widgets/WidgetLayoutStore";
|
||||||
import WidgetEchoStore from "../stores/WidgetEchoStore";
|
import WidgetEchoStore from "../stores/WidgetEchoStore";
|
||||||
import WidgetStore from "../stores/WidgetStore";
|
import WidgetStore from "../stores/WidgetStore";
|
||||||
|
import SdkConfig from "../SdkConfig";
|
||||||
|
|
||||||
/* eslint-disable camelcase */
|
/* eslint-disable camelcase */
|
||||||
interface IManagedHybridWidgetData {
|
interface IManagedHybridWidgetData {
|
||||||
@ -30,10 +31,16 @@ interface IManagedHybridWidgetData {
|
|||||||
}
|
}
|
||||||
/* eslint-enable camelcase */
|
/* eslint-enable camelcase */
|
||||||
|
|
||||||
export function isManagedHybridWidgetEnabled(): boolean {
|
function getWidgetBuildUrl(): string {
|
||||||
const callBehaviour = getCallBehaviourWellKnown();
|
if (SdkConfig.get().widget_build_url) {
|
||||||
|
return SdkConfig.get().widget_build_url;
|
||||||
|
}
|
||||||
/* eslint-disable-next-line camelcase */
|
/* eslint-disable-next-line camelcase */
|
||||||
return !!callBehaviour?.widget_build_url;
|
return getCallBehaviourWellKnown()?.widget_build_url
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isManagedHybridWidgetEnabled(): boolean {
|
||||||
|
return !!getWidgetBuildUrl();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function addManagedHybridWidget(roomId: string) {
|
export async function addManagedHybridWidget(roomId: string) {
|
||||||
@ -51,7 +58,7 @@ export async function addManagedHybridWidget(roomId: string) {
|
|||||||
|
|
||||||
// Get widget data
|
// Get widget data
|
||||||
/* eslint-disable-next-line camelcase */
|
/* eslint-disable-next-line camelcase */
|
||||||
const widgetBuildUrl = getCallBehaviourWellKnown()?.widget_build_url;
|
const widgetBuildUrl = getWidgetBuildUrl();
|
||||||
if (!widgetBuildUrl) {
|
if (!widgetBuildUrl) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user