@matrix-widget-toolkit/api 2.0.0 → 3.0.0

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;
@@ -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;
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.0",
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",