@banta/sdk 4.4.4 → 4.4.5

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.
@@ -125,7 +125,9 @@
125
125
  function LightboxComponent() {
126
126
  }
127
127
  LightboxComponent.prototype.ngAfterViewInit = function () {
128
- document.body.appendChild(this.containerElement.nativeElement);
128
+ if (typeof window !== 'undefined') {
129
+ document.body.appendChild(this.containerElement.nativeElement);
130
+ }
129
131
  };
130
132
  LightboxComponent.prototype.ngOnDestroy = function () {
131
133
  this.containerElement.nativeElement.remove();
@@ -8247,7 +8249,7 @@
8247
8249
  user: null,
8248
8250
  sentAt: Date.now(),
8249
8251
  likes: 0,
8250
- url: location.href,
8252
+ url: typeof window !== 'undefined' ? location.href : undefined,
8251
8253
  message: text
8252
8254
  };
8253
8255
  _b.label = 1;
@@ -9088,20 +9090,23 @@
9088
9090
  });
9089
9091
  BantaCommentsComponent.prototype.ngAfterViewInit = function () {
9090
9092
  var _this = this;
9091
- var callback = function () {
9092
- var size = _this.elementRef.nativeElement.getBoundingClientRect();
9093
- _this.ngZone.run(function () {
9094
- _this.width = size.width;
9095
- _this.height = size.height;
9096
- });
9097
- };
9098
- this.resizeObserver = new ResizeObserver(callback);
9099
- this.resizeObserver.observe(this.elementRef.nativeElement);
9100
- callback();
9093
+ if (typeof window !== 'undefined') {
9094
+ var callback = function () {
9095
+ var size = _this.elementRef.nativeElement.getBoundingClientRect();
9096
+ _this.ngZone.run(function () {
9097
+ _this.width = size.width;
9098
+ _this.height = size.height;
9099
+ });
9100
+ };
9101
+ this.resizeObserver = new ResizeObserver(callback);
9102
+ this.resizeObserver.observe(this.elementRef.nativeElement);
9103
+ callback();
9104
+ }
9101
9105
  };
9102
9106
  BantaCommentsComponent.prototype.ngOnDestroy = function () {
9103
9107
  this._subs.unsubscribe();
9104
- this.resizeObserver.disconnect();
9108
+ if (this.resizeObserver)
9109
+ this.resizeObserver.disconnect();
9105
9110
  };
9106
9111
  BantaCommentsComponent.prototype.setSourceFromTopicID = function (topicID) {
9107
9112
  return __awaiter(this, void 0, void 0, function () {
@@ -9313,6 +9318,8 @@
9313
9318
  });
9314
9319
  // UI Interactions
9315
9320
  BantaCommentsComponent.prototype.scrollToComment = function (commentId) {
9321
+ if (typeof window === 'undefined')
9322
+ return;
9316
9323
  setTimeout(function () {
9317
9324
  var comment = document.querySelectorAll("[data-comment-id=\"" + commentId + "\"]");
9318
9325
  if (comment.length > 0) {
@@ -10051,13 +10058,17 @@
10051
10058
  configurable: true
10052
10059
  });
10053
10060
  CommentFieldComponent.prototype.ngAfterViewInit = function () {
10054
- var root = document.body.querySelector('[ng-version]') || document.body;
10055
- root.appendChild(this.autocompleteEl.nativeElement);
10061
+ if (typeof window !== 'undefined') {
10062
+ var root = document.body.querySelector('[ng-version]') || document.body;
10063
+ root.appendChild(this.autocompleteEl.nativeElement);
10064
+ }
10056
10065
  };
10057
10066
  CommentFieldComponent.prototype.sendPermissionDenied = function (message) {
10058
10067
  this._permissionDeniedError.next(message);
10059
10068
  };
10060
10069
  CommentFieldComponent.prototype.showAutoComplete = function (options) {
10070
+ if (typeof window === 'undefined')
10071
+ return;
10061
10072
  this.autoCompleteSelected = 0;
10062
10073
  this.autocompleteOptions = options;
10063
10074
  var pos = this.autocompleteContainerEl.nativeElement.getBoundingClientRect();
@@ -10088,7 +10099,7 @@
10088
10099
  }, 5 * 1000);
10089
10100
  }, 100);
10090
10101
  // On mobile, just show an alert dialog
10091
- if (window.innerWidth < 430)
10102
+ if (typeof window !== 'undefined' && window.innerWidth < 430)
10092
10103
  alert(message);
10093
10104
  };
10094
10105
  Object.defineProperty(CommentFieldComponent.prototype, "isValidMessage", {
@@ -10279,7 +10290,7 @@
10279
10290
  message = {
10280
10291
  user: this.user,
10281
10292
  sentAt: Date.now(),
10282
- url: location.href,
10293
+ url: typeof window !== 'undefined' ? location.href : undefined,
10283
10294
  likes: 0,
10284
10295
  message: text,
10285
10296
  attachments: this.chatMessageAttachments.filter(function (x) { return x.url; })