@matrix-widget-toolkit/api 2.0.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -606,8 +606,8 @@ function isValidEventWithRelatesTo(event) {
606
606
  * The name of the room member state event.
607
607
  */
608
608
  var STATE_EVENT_ROOM_MEMBER = 'm.room.member';
609
- function isStringOrUndefined(value) {
610
- return value === undefined || typeof value === 'string';
609
+ function isStringUndefinedOrNull(value) {
610
+ return value === undefined || value === null || typeof value === 'string';
611
611
  }
612
612
  /**
613
613
  * Validates that `event` is has a valid structure for a
@@ -624,10 +624,12 @@ function isValidRoomMemberStateEvent(event) {
624
624
  if (typeof content.membership !== 'string') {
625
625
  return false;
626
626
  }
627
- if (!isStringOrUndefined(content.displayname)) {
627
+ if (!isStringUndefinedOrNull(content.displayname)) {
628
628
  return false;
629
629
  }
630
- if (!isStringOrUndefined(content.avatar_url)) {
630
+ // the avatar_url shouldn't be null, but some implementations
631
+ // set it as a valid value
632
+ if (!isStringUndefinedOrNull(content.avatar_url)) {
631
633
  return false;
632
634
  }
633
635
  return true;
@@ -1041,12 +1043,19 @@ var WidgetApiImpl = /** @class */ (function () {
1041
1043
  /** {@inheritDoc WidgetApi.widgetParameters} */
1042
1044
  widgetParameters, _a) {
1043
1045
  var _b = _a === void 0 ? {} : _a, _c = _b.capabilities, capabilities = _c === void 0 ? [] : _c, _d = _b.supportStandalone, supportStandalone = _d === void 0 ? false : _d;
1046
+ var _this = this;
1044
1047
  this.matrixWidgetApi = matrixWidgetApi$1;
1045
1048
  this.widgetId = widgetId;
1046
1049
  this.widgetParameters = widgetParameters;
1047
1050
  var eventName = "action:".concat(matrixWidgetApi.WidgetApiToWidgetAction.SendEvent);
1048
1051
  this.events$ = rxjs.fromEvent(this.matrixWidgetApi, eventName, function (event) {
1049
1052
  event.preventDefault();
1053
+ try {
1054
+ _this.matrixWidgetApi.transport.reply(event.detail, {});
1055
+ }
1056
+ catch (_) {
1057
+ // Ignore errors while replying
1058
+ }
1050
1059
  return event;
1051
1060
  }).pipe(rxjs.share());
1052
1061
  this.initialCapabilities = __spreadArray(__spreadArray([], capabilities, true), (supportStandalone ? [] : [matrixWidgetApi.MatrixCapabilities.RequiresClient]), true);
@@ -1292,7 +1301,6 @@ var WidgetApiImpl = /** @class */ (function () {
1292
1301
  };
1293
1302
  /** {@inheritDoc WidgetApi.observeStateEvents} */
1294
1303
  WidgetApiImpl.prototype.observeStateEvents = function (eventType, _a) {
1295
- var _this = this;
1296
1304
  var _b = _a === void 0 ? {} : _a, stateKey = _b.stateKey, roomIds = _b.roomIds;
1297
1305
  var currentRoomId = this.widgetParameters.roomId;
1298
1306
  if (!currentRoomId) {
@@ -1305,7 +1313,6 @@ var WidgetApiImpl = /** @class */ (function () {
1305
1313
  matrixEvent.state_key !== undefined &&
1306
1314
  (stateKey === undefined || matrixEvent.state_key === stateKey) &&
1307
1315
  isInRoom(matrixEvent, currentRoomId, roomIds)) {
1308
- _this.matrixWidgetApi.transport.reply(event.detail, {});
1309
1316
  return event.detail.data;
1310
1317
  }
1311
1318
  return undefined;
@@ -1316,45 +1323,31 @@ var WidgetApiImpl = /** @class */ (function () {
1316
1323
  WidgetApiImpl.prototype.sendStateEvent = function (eventType, content, _a) {
1317
1324
  var _b = _a === void 0 ? {} : _a, roomId = _b.roomId, _c = _b.stateKey, stateKey = _c === void 0 ? '' : _c;
1318
1325
  return __awaiter(this, void 0, void 0, function () {
1319
- var firstEvent$;
1320
- var _this = this;
1321
- return __generator(this, function (_d) {
1322
- firstEvent$ = this.events$.pipe(rxjs.map(function (event) {
1323
- var matrixEvent = event.detail.data;
1324
- if (matrixEvent.sender === _this.widgetParameters.userId &&
1325
- matrixEvent.state_key !== undefined &&
1326
- matrixEvent.type === eventType &&
1327
- (!roomId || matrixEvent.room_id === roomId)) {
1328
- _this.matrixWidgetApi.transport.reply(event.detail, {});
1329
- return event.detail.data;
1330
- }
1331
- return undefined;
1332
- }), rxjs.filter(isDefined), rxjs.first());
1333
- return [2 /*return*/, new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
1334
- var subscription, err_2;
1335
- return __generator(this, function (_a) {
1336
- switch (_a.label) {
1337
- case 0:
1338
- subscription = firstEvent$.subscribe({
1339
- next: function (event) { return resolve(event); },
1340
- error: function (err) { return reject(err); },
1341
- });
1342
- _a.label = 1;
1343
- case 1:
1344
- _a.trys.push([1, 3, , 4]);
1345
- return [4 /*yield*/, this.matrixWidgetApi.sendStateEvent(eventType, stateKey, content, roomId)];
1346
- case 2:
1347
- _a.sent();
1348
- return [3 /*break*/, 4];
1349
- case 3:
1350
- err_2 = _a.sent();
1351
- subscription.unsubscribe();
1352
- reject(err_2);
1353
- return [3 /*break*/, 4];
1354
- case 4: return [2 /*return*/];
1355
- }
1356
- });
1357
- }); })];
1326
+ var subject, subscription, _d, event_id_1, room_id_1, event_1;
1327
+ return __generator(this, function (_e) {
1328
+ switch (_e.label) {
1329
+ case 0:
1330
+ subject = new rxjs.ReplaySubject();
1331
+ subscription = this.events$.subscribe(function (e) { return subject.next(e); });
1332
+ _e.label = 1;
1333
+ case 1:
1334
+ _e.trys.push([1, , 4, 5]);
1335
+ return [4 /*yield*/, this.matrixWidgetApi.sendStateEvent(eventType, stateKey, content, roomId)];
1336
+ case 2:
1337
+ _d = _e.sent(), event_id_1 = _d.event_id, room_id_1 = _d.room_id;
1338
+ return [4 /*yield*/, rxjs.firstValueFrom(subject.pipe(rxjs.filter(function (event) {
1339
+ var matrixEvent = event.detail.data;
1340
+ return (matrixEvent.event_id === event_id_1 &&
1341
+ matrixEvent.room_id === room_id_1);
1342
+ }), rxjs.map(function (event) { return event.detail.data; })))];
1343
+ case 3:
1344
+ event_1 = _e.sent();
1345
+ return [2 /*return*/, event_1];
1346
+ case 4:
1347
+ subscription.unsubscribe();
1348
+ return [7 /*endfinally*/];
1349
+ case 5: return [2 /*return*/];
1350
+ }
1358
1351
  });
1359
1352
  });
1360
1353
  };
@@ -1372,7 +1365,6 @@ var WidgetApiImpl = /** @class */ (function () {
1372
1365
  };
1373
1366
  /** {@inheritDoc WidgetApi.observeRoomEvents} */
1374
1367
  WidgetApiImpl.prototype.observeRoomEvents = function (eventType, _a) {
1375
- var _this = this;
1376
1368
  var _b = _a === void 0 ? {} : _a, messageType = _b.messageType, roomIds = _b.roomIds;
1377
1369
  var currentRoomId = this.widgetParameters.roomId;
1378
1370
  if (!currentRoomId) {
@@ -1385,7 +1377,6 @@ var WidgetApiImpl = /** @class */ (function () {
1385
1377
  matrixEvent.state_key === undefined &&
1386
1378
  (!messageType || matrixEvent.content.msgtype === messageType) &&
1387
1379
  isInRoom(matrixEvent, currentRoomId, roomIds)) {
1388
- _this.matrixWidgetApi.transport.reply(event.detail, {});
1389
1380
  return event.detail.data;
1390
1381
  }
1391
1382
  return undefined;
@@ -1396,45 +1387,31 @@ var WidgetApiImpl = /** @class */ (function () {
1396
1387
  WidgetApiImpl.prototype.sendRoomEvent = function (eventType, content, _a) {
1397
1388
  var _b = _a === void 0 ? {} : _a, roomId = _b.roomId;
1398
1389
  return __awaiter(this, void 0, void 0, function () {
1399
- var firstEvents$;
1400
- var _this = this;
1401
- return __generator(this, function (_c) {
1402
- firstEvents$ = this.events$.pipe(rxjs.map(function (event) {
1403
- var matrixEvent = event.detail.data;
1404
- if (matrixEvent.sender === _this.widgetParameters.userId &&
1405
- matrixEvent.state_key === undefined &&
1406
- matrixEvent.type === eventType &&
1407
- (!roomId || matrixEvent.room_id === roomId)) {
1408
- _this.matrixWidgetApi.transport.reply(event.detail, {});
1409
- return event.detail.data;
1410
- }
1411
- return undefined;
1412
- }), rxjs.filter(isDefined), rxjs.first());
1413
- return [2 /*return*/, new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
1414
- var subscription, err_3;
1415
- return __generator(this, function (_a) {
1416
- switch (_a.label) {
1417
- case 0:
1418
- subscription = firstEvents$.subscribe({
1419
- next: function (event) { return resolve(event); },
1420
- error: function (err) { return reject(err); },
1421
- });
1422
- _a.label = 1;
1423
- case 1:
1424
- _a.trys.push([1, 3, , 4]);
1425
- return [4 /*yield*/, this.matrixWidgetApi.sendRoomEvent(eventType, content, roomId)];
1426
- case 2:
1427
- _a.sent();
1428
- return [3 /*break*/, 4];
1429
- case 3:
1430
- err_3 = _a.sent();
1431
- subscription.unsubscribe();
1432
- reject(err_3);
1433
- return [3 /*break*/, 4];
1434
- case 4: return [2 /*return*/];
1435
- }
1436
- });
1437
- }); })];
1390
+ var subject, subscription, _c, event_id_2, room_id_2, event_2;
1391
+ return __generator(this, function (_d) {
1392
+ switch (_d.label) {
1393
+ case 0:
1394
+ subject = new rxjs.ReplaySubject();
1395
+ subscription = this.events$.subscribe(function (e) { return subject.next(e); });
1396
+ _d.label = 1;
1397
+ case 1:
1398
+ _d.trys.push([1, , 4, 5]);
1399
+ return [4 /*yield*/, this.matrixWidgetApi.sendRoomEvent(eventType, content, roomId)];
1400
+ case 2:
1401
+ _c = _d.sent(), event_id_2 = _c.event_id, room_id_2 = _c.room_id;
1402
+ return [4 /*yield*/, rxjs.firstValueFrom(subject.pipe(rxjs.filter(function (event) {
1403
+ var matrixEvent = event.detail.data;
1404
+ return (matrixEvent.event_id === event_id_2 &&
1405
+ matrixEvent.room_id === room_id_2);
1406
+ }), rxjs.map(function (event) { return event.detail.data; })))];
1407
+ case 3:
1408
+ event_2 = _d.sent();
1409
+ return [2 /*return*/, event_2];
1410
+ case 4:
1411
+ subscription.unsubscribe();
1412
+ return [7 /*endfinally*/];
1413
+ case 5: return [2 /*return*/];
1414
+ }
1438
1415
  });
1439
1416
  });
1440
1417
  };
@@ -1586,7 +1563,7 @@ var WidgetApiImpl = /** @class */ (function () {
1586
1563
  WidgetApiImpl.prototype.requestOpenIDConnectTokenInternal = function () {
1587
1564
  var _a;
1588
1565
  return __awaiter(this, void 0, void 0, function () {
1589
- var leywayMilliseconds, openIdToken, err_4;
1566
+ var leywayMilliseconds, openIdToken, err_2;
1590
1567
  return __generator(this, function (_b) {
1591
1568
  switch (_b.label) {
1592
1569
  case 0:
@@ -1607,9 +1584,9 @@ var WidgetApiImpl = /** @class */ (function () {
1607
1584
  };
1608
1585
  return [2 /*return*/, openIdToken];
1609
1586
  case 3:
1610
- err_4 = _b.sent();
1587
+ err_2 = _b.sent();
1611
1588
  this.cachedOpenIdToken = undefined;
1612
- throw err_4;
1589
+ throw err_2;
1613
1590
  case 4: return [2 /*return*/];
1614
1591
  }
1615
1592
  });
@@ -1,6 +1,6 @@
1
1
  import { Symbols, WidgetEventCapability, EventDirection, WidgetApi, WidgetApiToWidgetAction, MatrixCapabilities } from 'matrix-widget-api';
2
2
  import { stringify, parse } from 'qs';
3
- import { filter, fromEvent, firstValueFrom, map, first, throwError, from, mergeAll, concat, share } from 'rxjs';
3
+ import { filter, fromEvent, firstValueFrom, map, first, throwError, from, mergeAll, concat, ReplaySubject, share } from 'rxjs';
4
4
 
5
5
  /*
6
6
  * Copyright 2022 Nordeck IT + Consulting GmbH
@@ -604,8 +604,8 @@ function isValidEventWithRelatesTo(event) {
604
604
  * The name of the room member state event.
605
605
  */
606
606
  var STATE_EVENT_ROOM_MEMBER = 'm.room.member';
607
- function isStringOrUndefined(value) {
608
- return value === undefined || typeof value === 'string';
607
+ function isStringUndefinedOrNull(value) {
608
+ return value === undefined || value === null || typeof value === 'string';
609
609
  }
610
610
  /**
611
611
  * Validates that `event` is has a valid structure for a
@@ -622,10 +622,12 @@ function isValidRoomMemberStateEvent(event) {
622
622
  if (typeof content.membership !== 'string') {
623
623
  return false;
624
624
  }
625
- if (!isStringOrUndefined(content.displayname)) {
625
+ if (!isStringUndefinedOrNull(content.displayname)) {
626
626
  return false;
627
627
  }
628
- if (!isStringOrUndefined(content.avatar_url)) {
628
+ // the avatar_url shouldn't be null, but some implementations
629
+ // set it as a valid value
630
+ if (!isStringUndefinedOrNull(content.avatar_url)) {
629
631
  return false;
630
632
  }
631
633
  return true;
@@ -1039,12 +1041,19 @@ var WidgetApiImpl = /** @class */ (function () {
1039
1041
  /** {@inheritDoc WidgetApi.widgetParameters} */
1040
1042
  widgetParameters, _a) {
1041
1043
  var _b = _a === void 0 ? {} : _a, _c = _b.capabilities, capabilities = _c === void 0 ? [] : _c, _d = _b.supportStandalone, supportStandalone = _d === void 0 ? false : _d;
1044
+ var _this = this;
1042
1045
  this.matrixWidgetApi = matrixWidgetApi;
1043
1046
  this.widgetId = widgetId;
1044
1047
  this.widgetParameters = widgetParameters;
1045
1048
  var eventName = "action:".concat(WidgetApiToWidgetAction.SendEvent);
1046
1049
  this.events$ = fromEvent(this.matrixWidgetApi, eventName, function (event) {
1047
1050
  event.preventDefault();
1051
+ try {
1052
+ _this.matrixWidgetApi.transport.reply(event.detail, {});
1053
+ }
1054
+ catch (_) {
1055
+ // Ignore errors while replying
1056
+ }
1048
1057
  return event;
1049
1058
  }).pipe(share());
1050
1059
  this.initialCapabilities = __spreadArray(__spreadArray([], capabilities, true), (supportStandalone ? [] : [MatrixCapabilities.RequiresClient]), true);
@@ -1290,7 +1299,6 @@ var WidgetApiImpl = /** @class */ (function () {
1290
1299
  };
1291
1300
  /** {@inheritDoc WidgetApi.observeStateEvents} */
1292
1301
  WidgetApiImpl.prototype.observeStateEvents = function (eventType, _a) {
1293
- var _this = this;
1294
1302
  var _b = _a === void 0 ? {} : _a, stateKey = _b.stateKey, roomIds = _b.roomIds;
1295
1303
  var currentRoomId = this.widgetParameters.roomId;
1296
1304
  if (!currentRoomId) {
@@ -1303,7 +1311,6 @@ var WidgetApiImpl = /** @class */ (function () {
1303
1311
  matrixEvent.state_key !== undefined &&
1304
1312
  (stateKey === undefined || matrixEvent.state_key === stateKey) &&
1305
1313
  isInRoom(matrixEvent, currentRoomId, roomIds)) {
1306
- _this.matrixWidgetApi.transport.reply(event.detail, {});
1307
1314
  return event.detail.data;
1308
1315
  }
1309
1316
  return undefined;
@@ -1314,45 +1321,31 @@ var WidgetApiImpl = /** @class */ (function () {
1314
1321
  WidgetApiImpl.prototype.sendStateEvent = function (eventType, content, _a) {
1315
1322
  var _b = _a === void 0 ? {} : _a, roomId = _b.roomId, _c = _b.stateKey, stateKey = _c === void 0 ? '' : _c;
1316
1323
  return __awaiter(this, void 0, void 0, function () {
1317
- var firstEvent$;
1318
- var _this = this;
1319
- return __generator(this, function (_d) {
1320
- firstEvent$ = this.events$.pipe(map(function (event) {
1321
- var matrixEvent = event.detail.data;
1322
- if (matrixEvent.sender === _this.widgetParameters.userId &&
1323
- matrixEvent.state_key !== undefined &&
1324
- matrixEvent.type === eventType &&
1325
- (!roomId || matrixEvent.room_id === roomId)) {
1326
- _this.matrixWidgetApi.transport.reply(event.detail, {});
1327
- return event.detail.data;
1328
- }
1329
- return undefined;
1330
- }), filter(isDefined), first());
1331
- return [2 /*return*/, new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
1332
- var subscription, err_2;
1333
- return __generator(this, function (_a) {
1334
- switch (_a.label) {
1335
- case 0:
1336
- subscription = firstEvent$.subscribe({
1337
- next: function (event) { return resolve(event); },
1338
- error: function (err) { return reject(err); },
1339
- });
1340
- _a.label = 1;
1341
- case 1:
1342
- _a.trys.push([1, 3, , 4]);
1343
- return [4 /*yield*/, this.matrixWidgetApi.sendStateEvent(eventType, stateKey, content, roomId)];
1344
- case 2:
1345
- _a.sent();
1346
- return [3 /*break*/, 4];
1347
- case 3:
1348
- err_2 = _a.sent();
1349
- subscription.unsubscribe();
1350
- reject(err_2);
1351
- return [3 /*break*/, 4];
1352
- case 4: return [2 /*return*/];
1353
- }
1354
- });
1355
- }); })];
1324
+ var subject, subscription, _d, event_id_1, room_id_1, event_1;
1325
+ return __generator(this, function (_e) {
1326
+ switch (_e.label) {
1327
+ case 0:
1328
+ subject = new ReplaySubject();
1329
+ subscription = this.events$.subscribe(function (e) { return subject.next(e); });
1330
+ _e.label = 1;
1331
+ case 1:
1332
+ _e.trys.push([1, , 4, 5]);
1333
+ return [4 /*yield*/, this.matrixWidgetApi.sendStateEvent(eventType, stateKey, content, roomId)];
1334
+ case 2:
1335
+ _d = _e.sent(), event_id_1 = _d.event_id, room_id_1 = _d.room_id;
1336
+ return [4 /*yield*/, firstValueFrom(subject.pipe(filter(function (event) {
1337
+ var matrixEvent = event.detail.data;
1338
+ return (matrixEvent.event_id === event_id_1 &&
1339
+ matrixEvent.room_id === room_id_1);
1340
+ }), map(function (event) { return event.detail.data; })))];
1341
+ case 3:
1342
+ event_1 = _e.sent();
1343
+ return [2 /*return*/, event_1];
1344
+ case 4:
1345
+ subscription.unsubscribe();
1346
+ return [7 /*endfinally*/];
1347
+ case 5: return [2 /*return*/];
1348
+ }
1356
1349
  });
1357
1350
  });
1358
1351
  };
@@ -1370,7 +1363,6 @@ var WidgetApiImpl = /** @class */ (function () {
1370
1363
  };
1371
1364
  /** {@inheritDoc WidgetApi.observeRoomEvents} */
1372
1365
  WidgetApiImpl.prototype.observeRoomEvents = function (eventType, _a) {
1373
- var _this = this;
1374
1366
  var _b = _a === void 0 ? {} : _a, messageType = _b.messageType, roomIds = _b.roomIds;
1375
1367
  var currentRoomId = this.widgetParameters.roomId;
1376
1368
  if (!currentRoomId) {
@@ -1383,7 +1375,6 @@ var WidgetApiImpl = /** @class */ (function () {
1383
1375
  matrixEvent.state_key === undefined &&
1384
1376
  (!messageType || matrixEvent.content.msgtype === messageType) &&
1385
1377
  isInRoom(matrixEvent, currentRoomId, roomIds)) {
1386
- _this.matrixWidgetApi.transport.reply(event.detail, {});
1387
1378
  return event.detail.data;
1388
1379
  }
1389
1380
  return undefined;
@@ -1394,45 +1385,31 @@ var WidgetApiImpl = /** @class */ (function () {
1394
1385
  WidgetApiImpl.prototype.sendRoomEvent = function (eventType, content, _a) {
1395
1386
  var _b = _a === void 0 ? {} : _a, roomId = _b.roomId;
1396
1387
  return __awaiter(this, void 0, void 0, function () {
1397
- var firstEvents$;
1398
- var _this = this;
1399
- return __generator(this, function (_c) {
1400
- firstEvents$ = this.events$.pipe(map(function (event) {
1401
- var matrixEvent = event.detail.data;
1402
- if (matrixEvent.sender === _this.widgetParameters.userId &&
1403
- matrixEvent.state_key === undefined &&
1404
- matrixEvent.type === eventType &&
1405
- (!roomId || matrixEvent.room_id === roomId)) {
1406
- _this.matrixWidgetApi.transport.reply(event.detail, {});
1407
- return event.detail.data;
1408
- }
1409
- return undefined;
1410
- }), filter(isDefined), first());
1411
- return [2 /*return*/, new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
1412
- var subscription, err_3;
1413
- return __generator(this, function (_a) {
1414
- switch (_a.label) {
1415
- case 0:
1416
- subscription = firstEvents$.subscribe({
1417
- next: function (event) { return resolve(event); },
1418
- error: function (err) { return reject(err); },
1419
- });
1420
- _a.label = 1;
1421
- case 1:
1422
- _a.trys.push([1, 3, , 4]);
1423
- return [4 /*yield*/, this.matrixWidgetApi.sendRoomEvent(eventType, content, roomId)];
1424
- case 2:
1425
- _a.sent();
1426
- return [3 /*break*/, 4];
1427
- case 3:
1428
- err_3 = _a.sent();
1429
- subscription.unsubscribe();
1430
- reject(err_3);
1431
- return [3 /*break*/, 4];
1432
- case 4: return [2 /*return*/];
1433
- }
1434
- });
1435
- }); })];
1388
+ var subject, subscription, _c, event_id_2, room_id_2, event_2;
1389
+ return __generator(this, function (_d) {
1390
+ switch (_d.label) {
1391
+ case 0:
1392
+ subject = new ReplaySubject();
1393
+ subscription = this.events$.subscribe(function (e) { return subject.next(e); });
1394
+ _d.label = 1;
1395
+ case 1:
1396
+ _d.trys.push([1, , 4, 5]);
1397
+ return [4 /*yield*/, this.matrixWidgetApi.sendRoomEvent(eventType, content, roomId)];
1398
+ case 2:
1399
+ _c = _d.sent(), event_id_2 = _c.event_id, room_id_2 = _c.room_id;
1400
+ return [4 /*yield*/, firstValueFrom(subject.pipe(filter(function (event) {
1401
+ var matrixEvent = event.detail.data;
1402
+ return (matrixEvent.event_id === event_id_2 &&
1403
+ matrixEvent.room_id === room_id_2);
1404
+ }), map(function (event) { return event.detail.data; })))];
1405
+ case 3:
1406
+ event_2 = _d.sent();
1407
+ return [2 /*return*/, event_2];
1408
+ case 4:
1409
+ subscription.unsubscribe();
1410
+ return [7 /*endfinally*/];
1411
+ case 5: return [2 /*return*/];
1412
+ }
1436
1413
  });
1437
1414
  });
1438
1415
  };
@@ -1584,7 +1561,7 @@ var WidgetApiImpl = /** @class */ (function () {
1584
1561
  WidgetApiImpl.prototype.requestOpenIDConnectTokenInternal = function () {
1585
1562
  var _a;
1586
1563
  return __awaiter(this, void 0, void 0, function () {
1587
- var leywayMilliseconds, openIdToken, err_4;
1564
+ var leywayMilliseconds, openIdToken, err_2;
1588
1565
  return __generator(this, function (_b) {
1589
1566
  switch (_b.label) {
1590
1567
  case 0:
@@ -1605,9 +1582,9 @@ var WidgetApiImpl = /** @class */ (function () {
1605
1582
  };
1606
1583
  return [2 /*return*/, openIdToken];
1607
1584
  case 3:
1608
- err_4 = _b.sent();
1585
+ err_2 = _b.sent();
1609
1586
  this.cachedOpenIdToken = undefined;
1610
- throw err_4;
1587
+ throw err_2;
1611
1588
  case 4: return [2 /*return*/];
1612
1589
  }
1613
1590
  });
package/build/index.d.ts CHANGED
@@ -370,11 +370,11 @@ export declare type RoomMemberStateEventContent = {
370
370
  /**
371
371
  * The display name for this user, if any.
372
372
  */
373
- displayname?: string;
373
+ displayname?: string | null;
374
374
  /**
375
375
  * The avatar URL for this user, if any.
376
376
  */
377
- avatar_url?: string;
377
+ avatar_url?: string | null;
378
378
  };
379
379
 
380
380
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@matrix-widget-toolkit/api",
3
- "version": "2.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "A simplified layer on top of matrix-widget-api to use build widgets.",
5
5
  "author": "Nordeck IT + Consulting GmbH",
6
6
  "license": "Apache-2.0",