@@ -30,14 +30,14 @@ import {Room} from "matrix-js-sdk/src/models/room";
3030import { WidgetType } from "../widgets/WidgetType" ;
3131import { objectClone } from "./objects" ;
3232import { _t } from "../languageHandler" ;
33- import { MatrixCapabilities } from "matrix-widget-api" ;
33+ import { Capability , IWidgetData , MatrixCapabilities } from "matrix-widget-api" ;
3434import { IApp } from "../stores/WidgetStore" ; // TODO @@
3535
3636// How long we wait for the state event echo to come back from the server
3737// before waitFor[Room/User]Widget rejects its promise
3838const WIDGET_WAIT_TIME = 20000 ;
3939
40- export interface IWidget { // TODO @@
40+ export interface IWidgetEvent {
4141 id : string ;
4242 type : string ;
4343 sender : string ;
@@ -230,7 +230,7 @@ export default class WidgetUtils {
230230 widgetType : WidgetType ,
231231 widgetUrl : string ,
232232 widgetName : string ,
233- widgetData : object ,
233+ widgetData : IWidgetData ,
234234 ) {
235235 const content = {
236236 type : widgetType . preferred ,
@@ -332,7 +332,7 @@ export default class WidgetUtils {
332332 * Get user specific widgets (not linked to a specific room)
333333 * @return {object } Event content object containing current / active user widgets
334334 */
335- static getUserWidgets ( ) : Record < string , IWidget > {
335+ static getUserWidgets ( ) : Record < string , IWidgetEvent > {
336336 const client = MatrixClientPeg . get ( ) ;
337337 if ( ! client ) {
338338 throw new Error ( 'User not logged in' ) ;
@@ -348,15 +348,15 @@ export default class WidgetUtils {
348348 * Get user specific widgets (not linked to a specific room) as an array
349349 * @return {[object] } Array containing current / active user widgets
350350 */
351- static getUserWidgetsArray ( ) : IWidget [ ] {
351+ static getUserWidgetsArray ( ) : IWidgetEvent [ ] {
352352 return Object . values ( WidgetUtils . getUserWidgets ( ) ) ;
353353 }
354354
355355 /**
356356 * Get active stickerpicker widgets (stickerpickers are user widgets by nature)
357357 * @return {[object] } Array containing current / active stickerpicker widgets
358358 */
359- static getStickerpickerWidgets ( ) : IWidget [ ] {
359+ static getStickerpickerWidgets ( ) : IWidgetEvent [ ] {
360360 const widgets = WidgetUtils . getUserWidgetsArray ( ) ;
361361 return widgets . filter ( ( widget ) => widget . content && widget . content . type === "m.stickerpicker" ) ;
362362 }
@@ -365,12 +365,12 @@ export default class WidgetUtils {
365365 * Get all integration manager widgets for this user.
366366 * @returns {Object[] } An array of integration manager user widgets.
367367 */
368- static getIntegrationManagerWidgets ( ) : IWidget [ ] {
368+ static getIntegrationManagerWidgets ( ) : IWidgetEvent [ ] {
369369 const widgets = WidgetUtils . getUserWidgetsArray ( ) ;
370370 return widgets . filter ( w => w . content && w . content . type === "m.integration_manager" ) ;
371371 }
372372
373- static getRoomWidgetsOfType ( room : Room , type : WidgetType ) : IWidget [ ] {
373+ static getRoomWidgetsOfType ( room : Room , type : WidgetType ) : IWidgetEvent [ ] {
374374 const widgets = WidgetUtils . getRoomWidgets ( room ) ;
375375 return ( widgets || [ ] ) . filter ( w => {
376376 const content = w . getContent ( ) ;
@@ -385,7 +385,7 @@ export default class WidgetUtils {
385385 }
386386 const widgets = client . getAccountData ( 'm.widgets' ) ;
387387 if ( ! widgets ) return ;
388- const userWidgets : IWidget [ ] = widgets . getContent ( ) || { } ;
388+ const userWidgets : IWidgetEvent [ ] = widgets . getContent ( ) || { } ;
389389 Object . entries ( userWidgets ) . forEach ( ( [ key , widget ] ) => {
390390 if ( widget . content && widget . content . type === "m.integration_manager" ) {
391391 delete userWidgets [ key ] ;
@@ -415,7 +415,7 @@ export default class WidgetUtils {
415415 }
416416 const widgets = client . getAccountData ( 'm.widgets' ) ;
417417 if ( ! widgets ) return ;
418- const userWidgets : Record < string , IWidget > = widgets . getContent ( ) || { } ;
418+ const userWidgets : Record < string , IWidgetEvent > = widgets . getContent ( ) || { } ;
419419 Object . entries ( userWidgets ) . forEach ( ( [ key , widget ] ) => {
420420 if ( widget . content && widget . content . type === 'm.stickerpicker' ) {
421421 delete userWidgets [ key ] ;
0 commit comments