stream-chat-angular 4.2.0 → 4.3.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.
@@ -1 +1 @@
1
- export declare const version = "4.2.0";
1
+ export declare const version = "4.3.0";
@@ -355,7 +355,7 @@
355
355
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
356
356
  }
357
357
 
358
- var version = '4.2.0';
358
+ var version = '4.3.0';
359
359
 
360
360
  /**
361
361
  * The `NotificationService` can be used to add or remove notifications. By default the [`NotificationList`](../components/NotificationListComponent.mdx) component displays the currently active notifications.
@@ -2634,8 +2634,7 @@
2634
2634
  }
2635
2635
  Object.defineProperty(AvatarComponent.prototype, "initials", {
2636
2636
  get: function () {
2637
- var _this = this;
2638
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
2637
+ var _a, _b, _c, _d, _e;
2639
2638
  var result = '';
2640
2639
  if (this.type === 'user') {
2641
2640
  result = ((_a = this.name) === null || _a === void 0 ? void 0 : _a.toString()) || '';
@@ -2645,9 +2644,9 @@
2645
2644
  result = (_e = (_d = this.channel) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.name;
2646
2645
  }
2647
2646
  else {
2648
- var otherMembers = Object.values(((_g = (_f = this.channel) === null || _f === void 0 ? void 0 : _f.state) === null || _g === void 0 ? void 0 : _g.members) || {}).filter(function (m) { var _a; return m.user_id !== ((_a = _this.chatClientService.chatClient.user) === null || _a === void 0 ? void 0 : _a.id); });
2649
- if (otherMembers.length === 1) {
2650
- result = ((_h = otherMembers[0].user) === null || _h === void 0 ? void 0 : _h.name) || ((_j = otherMembers[0].user) === null || _j === void 0 ? void 0 : _j.id) || '';
2647
+ var otherMember = this.getOtherMemberIfOneToOneChannel();
2648
+ if (otherMember) {
2649
+ result = otherMember.name || otherMember.id || '';
2651
2650
  }
2652
2651
  else {
2653
2652
  result = '#';
@@ -2659,10 +2658,39 @@
2659
2658
  enumerable: false,
2660
2659
  configurable: true
2661
2660
  });
2661
+ Object.defineProperty(AvatarComponent.prototype, "fallbackChannelImage", {
2662
+ get: function () {
2663
+ if (this.type !== 'channel') {
2664
+ return undefined;
2665
+ }
2666
+ else {
2667
+ var otherMember = this.getOtherMemberIfOneToOneChannel();
2668
+ if (otherMember) {
2669
+ return otherMember.image;
2670
+ }
2671
+ else {
2672
+ return undefined;
2673
+ }
2674
+ }
2675
+ },
2676
+ enumerable: false,
2677
+ configurable: true
2678
+ });
2679
+ AvatarComponent.prototype.getOtherMemberIfOneToOneChannel = function () {
2680
+ var _this = this;
2681
+ var _a, _b;
2682
+ var otherMembers = Object.values(((_b = (_a = this.channel) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.members) || {}).filter(function (m) { var _a; return m.user_id !== ((_a = _this.chatClientService.chatClient.user) === null || _a === void 0 ? void 0 : _a.id); });
2683
+ if (otherMembers.length === 1) {
2684
+ return otherMembers[0].user;
2685
+ }
2686
+ else {
2687
+ return undefined;
2688
+ }
2689
+ };
2662
2690
  return AvatarComponent;
2663
2691
  }());
2664
2692
  AvatarComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: AvatarComponent, deps: [{ token: ChatClientService }], target: i0__namespace.ɵɵFactoryTarget.Component });
2665
- AvatarComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.5", type: AvatarComponent, selector: "stream-avatar", inputs: { name: "name", imageUrl: "imageUrl", size: "size", location: "location", channel: "channel", user: "user", type: "type" }, ngImport: i0__namespace, template: "<div\n class=\"str-chat__avatar str-chat__avatar--circle stream-chat__avatar--{{\n location\n }}\"\n title=\"{{ name }}\"\n [style]=\"{\n flexBasis: 'calc(var(--str-chat__spacing-px, 1px) * ' + size + ')',\n fontSize: 'calc(var(--str-chat__spacing-px, 1px) * ' + size / 2 + ')',\n height: 'calc(var(--str-chat__spacing-px, 1px) * ' + size + ')',\n lineHeight: 'calc(var(--str-chat__spacing-px, 1px) * ' + size + ')',\n width: 'calc(var(--str-chat__spacing-px, 1px) * ' + size + ')'\n }\"\n>\n <img\n *ngIf=\"imageUrl && !isError; else fallback\"\n class=\"str-chat__avatar-image str-chat__avatar-image{{\n isLoaded ? ' str-chat__avatar-image--loaded' : ''\n }}\"\n src=\"{{ imageUrl }}\"\n alt=\"{{ initials }}\"\n data-testid=\"avatar-img\"\n (load)=\"isLoaded = true\"\n (error)=\"isError = true\"\n [style]=\"{\n flexBasis: 'calc(var(--str-chat__spacing-px, 1px) * ' + size + ')',\n height: 'calc(var(--str-chat__spacing-px, 1px) * ' + size + ')',\n objectFit: 'cover',\n width: 'calc(var(--str-chat__spacing-px, 1px) * ' + size + ')'\n }\"\n />\n <ng-template #fallback>\n <div data-testid=\"fallback-img\" class=\"str-chat__avatar-fallback\">\n {{ initials }}\n </div>\n </ng-template>\n</div>\n", styles: [""], directives: [{ type: i4__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
2693
+ AvatarComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.5", type: AvatarComponent, selector: "stream-avatar", inputs: { name: "name", imageUrl: "imageUrl", size: "size", location: "location", channel: "channel", user: "user", type: "type" }, ngImport: i0__namespace, template: "<div\n class=\"str-chat__avatar str-chat__avatar--circle stream-chat__avatar--{{\n location\n }}\"\n title=\"{{ name }}\"\n [style]=\"{\n flexBasis: 'calc(var(--str-chat__spacing-px, 1px) * ' + size + ')',\n fontSize: 'calc(var(--str-chat__spacing-px, 1px) * ' + size / 2 + ')',\n height: 'calc(var(--str-chat__spacing-px, 1px) * ' + size + ')',\n lineHeight: 'calc(var(--str-chat__spacing-px, 1px) * ' + size + ')',\n width: 'calc(var(--str-chat__spacing-px, 1px) * ' + size + ')'\n }\"\n>\n <img\n *ngIf=\"(imageUrl || fallbackChannelImage) && !isError; else fallback\"\n class=\"str-chat__avatar-image str-chat__avatar-image{{\n isLoaded ? ' str-chat__avatar-image--loaded' : ''\n }}\"\n src=\"{{ imageUrl || fallbackChannelImage }}\"\n alt=\"{{ initials }}\"\n data-testid=\"avatar-img\"\n (load)=\"isLoaded = true\"\n (error)=\"isError = true\"\n [style]=\"{\n flexBasis: 'calc(var(--str-chat__spacing-px, 1px) * ' + size + ')',\n height: 'calc(var(--str-chat__spacing-px, 1px) * ' + size + ')',\n objectFit: 'cover',\n width: 'calc(var(--str-chat__spacing-px, 1px) * ' + size + ')'\n }\"\n />\n <ng-template #fallback>\n <div data-testid=\"fallback-img\" class=\"str-chat__avatar-fallback\">\n {{ initials }}\n </div>\n </ng-template>\n</div>\n", styles: [""], directives: [{ type: i4__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
2666
2694
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: AvatarComponent, decorators: [{
2667
2695
  type: i0.Component,
2668
2696
  args: [{