@mtgame/core 0.2.20 → 0.2.22

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,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common/http'), require('rxjs/operators'), require('rxjs'), require('centrifuge'), require('rxjs/internal/Subject'), require('@sentry/angular'), require('@angular/forms'), require('@angular/common')) :
3
- typeof define === 'function' && define.amd ? define('@mtgame/core', ['exports', '@angular/core', '@angular/common/http', 'rxjs/operators', 'rxjs', 'centrifuge', 'rxjs/internal/Subject', '@sentry/angular', '@angular/forms', '@angular/common'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.mtgame = global.mtgame || {}, global.mtgame.core = {}), global.ng.core, global.ng.common.http, global.rxjs.operators, global.rxjs, global.centrifuge, global.rxjs['internal/Subject'], global.angular, global.ng.forms, global.ng.common));
5
- }(this, (function (exports, i0, i1, operators, rxjs, centrifuge, Subject, angular, forms, common) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common/http'), require('rxjs/operators'), require('rxjs'), require('centrifuge'), require('@angular/common'), require('rxjs/internal/Subject'), require('@sentry/angular'), require('@angular/forms')) :
3
+ typeof define === 'function' && define.amd ? define('@mtgame/core', ['exports', '@angular/core', '@angular/common/http', 'rxjs/operators', 'rxjs', 'centrifuge', '@angular/common', 'rxjs/internal/Subject', '@sentry/angular', '@angular/forms'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.mtgame = global.mtgame || {}, global.mtgame.core = {}), global.ng.core, global.ng.common.http, global.rxjs.operators, global.rxjs, global.centrifuge, global.ng.common, global.rxjs['internal/Subject'], global.angular, global.ng.forms));
5
+ }(this, (function (exports, i0, i1, operators, rxjs, centrifuge, common, Subject, angular, forms) { 'use strict';
6
6
 
7
7
  function _interopNamespace(e) {
8
8
  if (e && e.__esModule) return e;
@@ -13418,9 +13418,10 @@
13418
13418
  ], exports.OrganizationStatistic);
13419
13419
 
13420
13420
  var CentrifugoService = /** @class */ (function () {
13421
- function CentrifugoService(httpClient, configService) {
13421
+ function CentrifugoService(httpClient, configService, platformId) {
13422
13422
  this.httpClient = httpClient;
13423
13423
  this.configService = configService;
13424
+ this.platformId = platformId;
13424
13425
  this.channels$ = {};
13425
13426
  this.subscriptions = {};
13426
13427
  this.connectedSubject = new rxjs.BehaviorSubject(false);
@@ -13434,6 +13435,11 @@
13434
13435
  });
13435
13436
  CentrifugoService.prototype.listen = function (channel) {
13436
13437
  var _this = this;
13438
+ if (!common.isPlatformBrowser(this.platformId)) {
13439
+ return new rxjs.Observable(function (observer) {
13440
+ observer.error('Centrifugo is not available in ssr mode');
13441
+ });
13442
+ }
13437
13443
  if (channel in this.channels$) {
13438
13444
  return this.channels$[channel];
13439
13445
  }
@@ -13455,6 +13461,11 @@
13455
13461
  };
13456
13462
  CentrifugoService.prototype.connect = function () {
13457
13463
  var _this = this;
13464
+ if (!common.isPlatformBrowser(this.platformId)) {
13465
+ return new rxjs.Observable(function (observer) {
13466
+ observer.error('Centrifugo is not available in ssr mode');
13467
+ });
13468
+ }
13458
13469
  if (!this.initializeEngineSubject) {
13459
13470
  this.initializeEngineSubject = new rxjs.ReplaySubject(1);
13460
13471
  this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/centrifugo_v2/")
@@ -13479,6 +13490,11 @@
13479
13490
  };
13480
13491
  CentrifugoService.prototype.publish = function (channel, message) {
13481
13492
  var _this = this;
13493
+ if (!common.isPlatformBrowser(this.platformId)) {
13494
+ return new rxjs.Observable(function (observer) {
13495
+ observer.error('Centrifugo is not available in ssr mode');
13496
+ });
13497
+ }
13482
13498
  return this.connect().pipe(operators.tap(function () { return _this.centrifuge.publish(channel, message); }));
13483
13499
  };
13484
13500
  CentrifugoService.prototype.disconnect = function () {
@@ -13523,13 +13539,14 @@
13523
13539
  };
13524
13540
  return CentrifugoService;
13525
13541
  }());
13526
- CentrifugoService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function CentrifugoService_Factory() { return new CentrifugoService(i0__namespace.ɵɵinject(i1__namespace.HttpClient), i0__namespace.ɵɵinject(ConfigService)); }, token: CentrifugoService, providedIn: "root" });
13542
+ CentrifugoService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function CentrifugoService_Factory() { return new CentrifugoService(i0__namespace.ɵɵinject(i1__namespace.HttpClient), i0__namespace.ɵɵinject(ConfigService), i0__namespace.ɵɵinject(i0__namespace.PLATFORM_ID)); }, token: CentrifugoService, providedIn: "root" });
13527
13543
  CentrifugoService.decorators = [
13528
13544
  { type: i0.Injectable, args: [{ providedIn: 'root' },] }
13529
13545
  ];
13530
13546
  CentrifugoService.ctorParameters = function () { return [
13531
13547
  { type: i1.HttpClient },
13532
- { type: ConfigService }
13548
+ { type: ConfigService },
13549
+ { type: String, decorators: [{ type: i0.Inject, args: [i0.PLATFORM_ID,] }] }
13533
13550
  ]; };
13534
13551
 
13535
13552
  var StorageEngineField = /** @class */ (function () {