@senior-gestao-empresarial/angular-components 4.22.0 → 4.22.2-7c0b6b2c-1273-4faf-bd8a-91d677cec9bd

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'), require('primeng/breadcrumb'), require('@angular/router'), require('rxjs'), require('rxjs/operators'), require('moment'), require('@seniorsistemas/angular-components'), require('@angular/common/http'), require('primeng/api'), require('@ngx-translate/core'), require('@seniorsistemas/platform-components'), require('@seniorsistemas/senior-platform-data'), require('@angular/forms'), require('js-cookie'), require('@stomp/stompjs'), require('ngx-cookie-service'), require('sockjs-client')) :
3
- typeof define === 'function' && define.amd ? define('@senior-gestao-empresarial/angular-components', ['exports', '@angular/core', '@angular/common', 'primeng/breadcrumb', '@angular/router', 'rxjs', 'rxjs/operators', 'moment', '@seniorsistemas/angular-components', '@angular/common/http', 'primeng/api', '@ngx-translate/core', '@seniorsistemas/platform-components', '@seniorsistemas/senior-platform-data', '@angular/forms', 'js-cookie', '@stomp/stompjs', 'ngx-cookie-service', 'sockjs-client'], factory) :
4
- (global = global || self, factory((global['senior-gestao-empresarial'] = global['senior-gestao-empresarial'] || {}, global['senior-gestao-empresarial']['angular-components'] = {}), global.ng.core, global.ng.common, global.breadcrumb, global.ng.router, global.rxjs, global.rxjs.operators, global.moment_, global.angularComponents, global.ng.common.http, global.api, global.core$1, global.platformComponents, global.seniorPlatformData, global.ng.forms, global.jsCookie, global.stompjs, global.ngxCookieService, global.SockJS));
5
- }(this, (function (exports, core, common, breadcrumb, router, rxjs, operators, moment_, angularComponents, http, api, core$1, platformComponents, seniorPlatformData, forms, jsCookie, stompjs, ngxCookieService, SockJS) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('primeng/breadcrumb'), require('@angular/router'), require('rxjs'), require('rxjs/operators'), require('moment'), require('@seniorsistemas/angular-components'), require('@angular/common/http'), require('primeng/api'), require('@ngx-translate/core'), require('@seniorsistemas/platform-components'), require('@seniorsistemas/senior-platform-data'), require('@angular/forms'), require('js-cookie'), require('@stomp/stompjs'), require('sockjs-client')) :
3
+ typeof define === 'function' && define.amd ? define('@senior-gestao-empresarial/angular-components', ['exports', '@angular/core', '@angular/common', 'primeng/breadcrumb', '@angular/router', 'rxjs', 'rxjs/operators', 'moment', '@seniorsistemas/angular-components', '@angular/common/http', 'primeng/api', '@ngx-translate/core', '@seniorsistemas/platform-components', '@seniorsistemas/senior-platform-data', '@angular/forms', 'js-cookie', '@stomp/stompjs', 'sockjs-client'], factory) :
4
+ (global = global || self, factory((global['senior-gestao-empresarial'] = global['senior-gestao-empresarial'] || {}, global['senior-gestao-empresarial']['angular-components'] = {}), global.ng.core, global.ng.common, global.breadcrumb, global.ng.router, global.rxjs, global.rxjs.operators, global.moment_, global.angularComponents, global.ng.common.http, global.api, global.core$1, global.platformComponents, global.seniorPlatformData, global.ng.forms, global.jsCookie, global.stompjs, global.SockJS));
5
+ }(this, (function (exports, core, common, breadcrumb, router, rxjs, operators, moment_, angularComponents, http, api, core$1, platformComponents, seniorPlatformData, forms, jsCookie, stompjs, SockJS) { 'use strict';
6
6
 
7
7
  /*! *****************************************************************************
8
8
  Copyright (c) Microsoft Corporation.
@@ -6609,98 +6609,98 @@
6609
6609
  }());
6610
6610
 
6611
6611
  var WebsocketService = /** @class */ (function () {
6612
- function WebsocketService(cookieService) {
6613
- this.cookieService = cookieService;
6614
- this.baseUrl = null;
6615
- this.username = null;
6612
+ function WebsocketService() {
6616
6613
  this.focused = true;
6614
+ this.wasConnected = false;
6617
6615
  this.connected = false;
6618
6616
  this.isConnecting = false;
6619
- this.stompSubscriptions = new Map();
6620
- // private primitiveSubjects: Map<string, Subject<any>> = new Map<string, Subject<any>>();
6621
6617
  this.primitiveManagers = new Map();
6622
- this.disconnectSubject = new rxjs.Subject();
6623
6618
  this.connect$ = new rxjs.Subject();
6619
+ this.disconnect$ = new rxjs.Subject();
6620
+ this.reconnect$ = new rxjs.Subject();
6621
+ this.error$ = new rxjs.Subject();
6624
6622
  window.onfocus = this.onFocus;
6625
6623
  window.onblur = this.onBlur;
6626
6624
  this.connect();
6627
6625
  }
6628
6626
  WebsocketService_1 = WebsocketService;
6629
6627
  /**
6630
- * Observable resposável por emitir uma notificação quando a conexão websocket é estabelecida.
6631
- * @return Um `Observable<void>` que emite uma notificação quando a conexão websocket é estabelecida ou já está em andamento.
6628
+ * Observable responsável por emitir uma notificação quando a conexão websocket é estabelecida.
6629
+ * @return Um `Observable<void>` que emite uma notificação quando a conexão websocket é estabelecida.
6632
6630
  */
6633
6631
  WebsocketService.prototype.onConnect = function () {
6634
6632
  var _this = this;
6635
6633
  setTimeout(function () {
6636
6634
  if (_this.isConnected()) {
6637
- _this.publishOnConnect();
6635
+ _this.connect$.next();
6638
6636
  }
6639
6637
  }, 0);
6640
- return this.connect$.asObservable();
6638
+ return this.connect$.pipe(operators.first());
6641
6639
  };
6642
6640
  /**
6643
- * Observable resposável por emitir uma notificação quando a conexão é finalizada.
6644
- * @return Um `Observable<void>` que emite uma notificação quando a conexão é finalizada.
6641
+ * Observable responsável por emitir uma notificação quando a conexão é desconectada.
6642
+ * @return Um `Observable<void>` que emite uma notificação quando a conexão é desconectada.
6645
6643
  */
6646
6644
  WebsocketService.prototype.onDisconnect = function () {
6647
- return this.disconnectSubject.asObservable();
6645
+ return this.disconnect$.asObservable();
6646
+ };
6647
+ /**
6648
+ * Observable responsável por emitir uma notificação quando a conexão é reconectada.
6649
+ * @return Um `Observable<void>` que emite uma notificação quando a conexão é reconectada.
6650
+ */
6651
+ WebsocketService.prototype.onReconnect = function () {
6652
+ return this.reconnect$.asObservable();
6653
+ };
6654
+ /**
6655
+ * Observable responsável por emitir uma notificação quando ocorre algum erro.
6656
+ * @return Um `Observable<FrameImpl>` que emite uma notificação quando ocorre algum erro.
6657
+ */
6658
+ WebsocketService.prototype.onError = function () {
6659
+ return this.error$.asObservable();
6648
6660
  };
6649
6661
  /**
6650
6662
  * Observable responsável por emitir uma notificação quando um evento é publicado.
6651
6663
  * @typeParam `<T>` Tipo do objeto que o retorno do `observable` vai devolver.
6652
- * @param domain Dominio da primitva.
6664
+ * @param domain Dominio da primitiva.
6653
6665
  * @param service Service da primitiva.
6654
6666
  * @param primitive Primitiva que será "observada" pelo client.
6655
- * @param identifierPath Caminho até a propriedade considerada o indentificador do registro.
6667
+ * @param identifierPath Caminho até a propriedade considerada o identificador do registro.
6656
6668
  * @return Um `observable` que emite notificações toda vez que o respectivo evento é publicado no sistema.
6657
6669
  */
6658
6670
  WebsocketService.prototype.onEvent = function (domain, service, primitive, identifierPath) {
6659
6671
  var _this = this;
6660
- var primitiveManager = this.primitiveManagers.get(primitive);
6661
- if (primitiveManager) {
6662
- return primitiveManager.subject.asObservable();
6672
+ if (this.primitiveManagers.has(primitive)) {
6673
+ return this.primitiveManagers.get(primitive).subject.asObservable();
6663
6674
  }
6664
- primitiveManager = {
6675
+ var primitiveManager = {
6676
+ domain: domain,
6677
+ service: service,
6678
+ primitive: primitive,
6679
+ stompSubscriptions: [],
6665
6680
  subject: new rxjs.Subject(),
6666
6681
  identifierPath: identifierPath,
6667
6682
  publishedEvents: [],
6668
6683
  };
6684
+ this.primitiveManagers.set(primitive, primitiveManager);
6669
6685
  if (this.isConnected()) {
6670
- var url = this.getSubscriptionUserUrl(domain, service, primitive);
6671
- this.primitiveManagers.set(primitive, primitiveManager);
6672
- var stompSubscription = this._stompClient.subscribe(url, function (message) {
6673
- var event = JSON.parse(message.body || "{}");
6674
- _this.addPublishedEvent(primitiveManager, event);
6675
- primitiveManager.subject.next(event);
6676
- });
6677
- this.stompSubscriptions.set(primitive, stompSubscription);
6678
- return primitiveManager.subject.asObservable();
6686
+ this.createStompSubscriptions(primitiveManager);
6687
+ return primitiveManager.subject.pipe(operators.finalize(function () { return _this.disconnectPrimitiveOnFinalize(primitive); }));
6679
6688
  }
6680
6689
  else {
6681
6690
  if (!this.isConnecting) {
6682
6691
  this.connect();
6683
6692
  }
6684
- this.onConnect()
6685
- .pipe(operators.take(1))
6686
- .subscribe(function () {
6687
- var url = _this.getSubscriptionUserUrl(domain, service, primitive);
6688
- _this.primitiveManagers.set(primitive, primitiveManager);
6689
- var stompSubscription = _this._stompClient.subscribe(url, function (message) {
6690
- var event = JSON.parse(message.body || "{}");
6691
- _this.addPublishedEvent(primitiveManager, event);
6692
- primitiveManager.subject.next(event);
6693
- });
6694
- _this.stompSubscriptions.set(primitive, stompSubscription);
6693
+ this.connect$.pipe(operators.first()).subscribe(function () {
6694
+ _this.createStompSubscriptions(primitiveManager);
6695
6695
  });
6696
- return primitiveManager.subject.asObservable();
6696
+ return primitiveManager.subject.pipe(operators.finalize(function () { return _this.disconnectPrimitiveOnFinalize(primitive); }));
6697
6697
  }
6698
6698
  };
6699
6699
  /**
6700
- * Retorna todos os eventos ouvidos para a respectiva primitiva.
6700
+ * Retorna todos os eventos ouvidos pela primitiva com os respectivos identificadores.
6701
6701
  * @typeParam `<T>` Tipo do evento retornado pela primitiva.
6702
6702
  * @param primitive Primitiva que será "observada" pelo client.
6703
- * @param identifiers Array com os indentificadores interessados.
6703
+ * @param identifiers Array com os identificadores interessados.
6704
6704
  * @return Array contendo o último evento recebido de cada identificador fornecido.
6705
6705
  */
6706
6706
  WebsocketService.prototype.getPublishedEvents = function (primitive, identifiers) {
@@ -6732,9 +6732,7 @@
6732
6732
  WebsocketService.prototype.addPublishedEvent = function (primitiveManager, event) {
6733
6733
  var _this = this;
6734
6734
  var identifier = this.getIdentifierFromEvent(primitiveManager.identifierPath, event);
6735
- var eventIndex = primitiveManager.publishedEvents.findIndex(function (x) {
6736
- return _this.getIdentifierFromEvent(primitiveManager.identifierPath, x) === identifier;
6737
- });
6735
+ var eventIndex = primitiveManager.publishedEvents.findIndex(function (x) { return _this.getIdentifierFromEvent(primitiveManager.identifierPath, x) === identifier; });
6738
6736
  if (eventIndex !== -1) {
6739
6737
  primitiveManager.publishedEvents[eventIndex] = __assign(__assign({}, primitiveManager.publishedEvents[eventIndex]), event);
6740
6738
  }
@@ -6742,6 +6740,13 @@
6742
6740
  primitiveManager.publishedEvents.push(event);
6743
6741
  }
6744
6742
  };
6743
+ WebsocketService.prototype.createStompSubscriptions = function (primitiveManager) {
6744
+ var withTokenUrl = this.getSubscriptionUrlWithToken(primitiveManager.domain, primitiveManager.service, primitiveManager.primitive);
6745
+ var stompSubscriptionWithToken = this.createStompSubscription(withTokenUrl, primitiveManager);
6746
+ var withoutTokenUrl = this.getSubscriptionUrlWithoutToken(primitiveManager.domain, primitiveManager.service, primitiveManager.primitive);
6747
+ var stompSubscriptionWithoutToken = this.createStompSubscription(withoutTokenUrl, primitiveManager);
6748
+ primitiveManager.stompSubscriptions = [stompSubscriptionWithToken, stompSubscriptionWithoutToken];
6749
+ };
6745
6750
  WebsocketService.prototype.getIdentifierFromEvent = function (identifierPath, event) {
6746
6751
  var e_2, _a;
6747
6752
  var properties = identifierPath.split(".");
@@ -6765,21 +6770,24 @@
6765
6770
  var _this = this;
6766
6771
  this.createStompClient();
6767
6772
  this.isConnecting = true;
6773
+ this._stompClient.activate();
6768
6774
  this._stompClient.connect({}, function () {
6769
- _this.setConnected(true);
6770
- // console.log('setou false isConnecting');
6771
6775
  _this.isConnecting = false;
6772
- // console.log('connectou dentro do connect cb');
6773
- _this.publishOnConnect();
6774
- }, function () {
6776
+ _this.setConnected(true);
6777
+ if (_this.wasConnected) {
6778
+ _this.reconnectPrimitives();
6779
+ _this.reconnect$.next();
6780
+ }
6781
+ else {
6782
+ _this.wasConnected = true;
6783
+ _this.connect$.next();
6784
+ }
6785
+ }, function (error) {
6775
6786
  _this.setConnected(false);
6776
- // this.reconnectWebSocket();
6787
+ _this.error$.next(error);
6788
+ _this.reconnect();
6777
6789
  });
6778
6790
  };
6779
- WebsocketService.prototype.publishOnConnect = function () {
6780
- this.connect$.next();
6781
- this.connect$.observers = [];
6782
- };
6783
6791
  WebsocketService.prototype.onFocus = function () {
6784
6792
  this.focused = true;
6785
6793
  };
@@ -6787,46 +6795,55 @@
6787
6795
  this.focused = false;
6788
6796
  };
6789
6797
  WebsocketService.prototype.disconnect = function () {
6790
- var e_3, _a, e_4, _b;
6791
- var observersCount = 0;
6798
+ var e_3, _a, e_4, _b, e_5, _c;
6799
+ var observersCount = this.getObserversCount();
6800
+ if (observersCount > 0)
6801
+ return;
6792
6802
  try {
6793
- for (var _c = __values(this.primitiveManagers.values()), _d = _c.next(); !_d.done; _d = _c.next()) {
6794
- var primitiveManager = _d.value;
6795
- observersCount += primitiveManager.subject.observers.length;
6803
+ for (var _d = __values(this.primitiveManagers.values()), _e = _d.next(); !_e.done; _e = _d.next()) {
6804
+ var primitiveManager = _e.value;
6805
+ try {
6806
+ for (var _f = (e_4 = void 0, __values(primitiveManager.stompSubscriptions)), _g = _f.next(); !_g.done; _g = _f.next()) {
6807
+ var stompSubscription = _g.value;
6808
+ stompSubscription.unsubscribe();
6809
+ }
6810
+ }
6811
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
6812
+ finally {
6813
+ try {
6814
+ if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
6815
+ }
6816
+ finally { if (e_4) throw e_4.error; }
6817
+ }
6796
6818
  }
6797
6819
  }
6798
6820
  catch (e_3_1) { e_3 = { error: e_3_1 }; }
6799
6821
  finally {
6800
6822
  try {
6801
- if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
6823
+ if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
6802
6824
  }
6803
6825
  finally { if (e_3) throw e_3.error; }
6804
6826
  }
6805
- if (observersCount === 0) {
6806
- this.stompSubscriptions.forEach(function (stompSubscription) {
6807
- stompSubscription.unsubscribe();
6808
- });
6809
- try {
6810
- for (var _e = __values(this.primitiveManagers.values()), _f = _e.next(); !_f.done; _f = _e.next()) {
6811
- var primitiveManager = _f.value;
6812
- primitiveManager.subject.complete();
6813
- }
6827
+ try {
6828
+ for (var _h = __values(this.primitiveManagers.values()), _j = _h.next(); !_j.done; _j = _h.next()) {
6829
+ var primitiveManager = _j.value;
6830
+ primitiveManager.subject.complete();
6814
6831
  }
6815
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
6816
- finally {
6817
- try {
6818
- if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
6819
- }
6820
- finally { if (e_4) throw e_4.error; }
6832
+ }
6833
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
6834
+ finally {
6835
+ try {
6836
+ if (_j && !_j.done && (_c = _h.return)) _c.call(_h);
6821
6837
  }
6822
- this.stompSubscriptions.clear();
6823
- this.primitiveManagers.clear();
6824
- this._stompClient.disconnect();
6825
- this._stompClient.deactivate();
6826
- this.setConnected(false);
6827
- this.isConnecting = false;
6828
- this.disconnectSubject.next();
6838
+ finally { if (e_5) throw e_5.error; }
6829
6839
  }
6840
+ this.primitiveManagers.clear();
6841
+ this._stompClient.disconnect();
6842
+ this._stompClient.deactivate();
6843
+ this.setConnected(false);
6844
+ this.isConnecting = false;
6845
+ this.wasConnected = false;
6846
+ this.disconnect$.next();
6830
6847
  };
6831
6848
  WebsocketService.prototype.isConnected = function () {
6832
6849
  return this.connected;
@@ -6834,56 +6851,124 @@
6834
6851
  WebsocketService.prototype.setConnected = function (connected) {
6835
6852
  this.connected = connected;
6836
6853
  };
6837
- WebsocketService.prototype.getSubscriptionUserUrl = function (domain, service, primitive) {
6854
+ WebsocketService.prototype.getSubscriptionUrlWithToken = function (domain, service, primitive) {
6838
6855
  var tenant = WebsocketService_1.TOKEN ? WebsocketService_1.TOKEN.username.split("@")[1] : null;
6839
6856
  var token = WebsocketService_1.TOKEN ? WebsocketService_1.TOKEN.access_token : null;
6840
6857
  return "/topic/" + tenant + "/" + token + "/" + domain + "/" + service + "/" + primitive;
6841
6858
  };
6859
+ WebsocketService.prototype.getSubscriptionUrlWithoutToken = function (domain, service, primitive) {
6860
+ var tenant = WebsocketService_1.TOKEN ? WebsocketService_1.TOKEN.username.split("@")[1] : null;
6861
+ return "/topic/" + tenant + "/" + domain + "/" + service + "/" + primitive;
6862
+ };
6863
+ WebsocketService.prototype.createStompSubscription = function (destination, primitiveManager) {
6864
+ var _this = this;
6865
+ return this._stompClient.subscribe(destination, function (message) {
6866
+ var event = JSON.parse(message.body || "{}");
6867
+ _this.addPublishedEvent(primitiveManager, event);
6868
+ primitiveManager.subject.next(event);
6869
+ });
6870
+ };
6842
6871
  WebsocketService.prototype.createStompClient = function () {
6843
6872
  var ws = new SockJS(WebsocketService_1.WEBSOCKET_URL + "subscription", null, { timeout: WebsocketService_1.CONNECTION_TIMEOUT });
6844
6873
  this._stompClient = stompjs.Stomp.over(ws);
6874
+ // this._stompClient.debug = (str) => console.log(new Date().toISOString(), str);
6845
6875
  this._stompClient.debug = function () { }; // Para remover os logs.
6846
6876
  };
6847
- WebsocketService.prototype.getBaseUrl = function () {
6848
- return this.cookieService.get("com.senior.base.url");
6849
- };
6850
- WebsocketService.prototype.getUserName = function () {
6851
- var token = this.cookieService.get("com.senior.token");
6852
- return token && JSON.parse(token).username;
6853
- };
6854
- WebsocketService.prototype.reconnectWebSocket = function () {
6877
+ WebsocketService.prototype.reconnect = function () {
6855
6878
  var _this = this;
6856
- this._stompClient.disconnect();
6857
- var baseUrl = this.getBaseUrl();
6858
- if (this.baseUrl !== null && baseUrl != this.baseUrl) {
6859
- // //console.log('ws disconnected: base url changed', this.baseUrl, ' -> ', baseUrl || 'null');
6860
- return;
6861
- }
6862
- var username = this.getUserName();
6863
- if (this.username !== null && username != this.username) {
6864
- // //console.log('ws disconnected: username changed', this.username, ' -> ', username || 'null');
6865
- return;
6866
- }
6879
+ if (this.connected)
6880
+ this._stompClient.disconnect();
6867
6881
  setTimeout(function () {
6882
+ if (_this.getObserversCount() === 0)
6883
+ return;
6868
6884
  if (_this.focused) {
6869
6885
  _this.connect();
6870
6886
  }
6871
6887
  else {
6872
- _this.reconnectWebSocket();
6888
+ _this.reconnect();
6873
6889
  }
6874
6890
  }, WebsocketService_1.RECONNECT_TIMER);
6875
6891
  };
6892
+ WebsocketService.prototype.reconnectPrimitives = function () {
6893
+ var e_6, _a, e_7, _b;
6894
+ try {
6895
+ for (var _c = __values(this.primitiveManagers.values()), _d = _c.next(); !_d.done; _d = _c.next()) {
6896
+ var primitiveManager = _d.value;
6897
+ try {
6898
+ for (var _e = (e_7 = void 0, __values(primitiveManager.stompSubscriptions)), _f = _e.next(); !_f.done; _f = _e.next()) {
6899
+ var stompSubscription = _f.value;
6900
+ stompSubscription.unsubscribe();
6901
+ }
6902
+ }
6903
+ catch (e_7_1) { e_7 = { error: e_7_1 }; }
6904
+ finally {
6905
+ try {
6906
+ if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
6907
+ }
6908
+ finally { if (e_7) throw e_7.error; }
6909
+ }
6910
+ this.createStompSubscriptions(primitiveManager);
6911
+ }
6912
+ }
6913
+ catch (e_6_1) { e_6 = { error: e_6_1 }; }
6914
+ finally {
6915
+ try {
6916
+ if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
6917
+ }
6918
+ finally { if (e_6) throw e_6.error; }
6919
+ }
6920
+ };
6921
+ WebsocketService.prototype.getObserversCount = function () {
6922
+ var e_8, _a;
6923
+ var observersCount = 0;
6924
+ try {
6925
+ for (var _b = __values(this.primitiveManagers.values()), _c = _b.next(); !_c.done; _c = _b.next()) {
6926
+ var primitiveManager = _c.value;
6927
+ observersCount += primitiveManager.subject.observers.length;
6928
+ }
6929
+ }
6930
+ catch (e_8_1) { e_8 = { error: e_8_1 }; }
6931
+ finally {
6932
+ try {
6933
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
6934
+ }
6935
+ finally { if (e_8) throw e_8.error; }
6936
+ }
6937
+ return observersCount;
6938
+ };
6939
+ WebsocketService.prototype.disconnectPrimitiveOnFinalize = function (primitive) {
6940
+ var e_9, _a;
6941
+ var primitiveManager = this.primitiveManagers.get(primitive);
6942
+ if (!primitiveManager)
6943
+ return;
6944
+ // @IMPORTANT: Replace .observers.length with .observed in rxjs 7.0+
6945
+ var hasObservers = !(primitiveManager.subject.observers.length === 1);
6946
+ if (hasObservers)
6947
+ return;
6948
+ try {
6949
+ for (var _b = __values(primitiveManager.stompSubscriptions), _c = _b.next(); !_c.done; _c = _b.next()) {
6950
+ var stompSubscription = _c.value;
6951
+ stompSubscription.unsubscribe();
6952
+ }
6953
+ }
6954
+ catch (e_9_1) { e_9 = { error: e_9_1 }; }
6955
+ finally {
6956
+ try {
6957
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
6958
+ }
6959
+ finally { if (e_9) throw e_9.error; }
6960
+ }
6961
+ this.primitiveManagers.delete(primitive);
6962
+ this.disconnect();
6963
+ };
6876
6964
  var WebsocketService_1;
6877
6965
  WebsocketService.RECONNECT_TIMER = 3000;
6878
- WebsocketService.CONNECTION_TIMEOUT = 30000;
6966
+ WebsocketService.CONNECTION_TIMEOUT = 15000;
6879
6967
  WebsocketService.BASE_URL_COOKIE = "com.senior.base.url";
6880
6968
  WebsocketService.TOKEN_COOKIE = "com.senior.token";
6881
6969
  WebsocketService.TOKEN = JSON.parse(jsCookie.get(WebsocketService_1.TOKEN_COOKIE) || "{}");
6882
6970
  WebsocketService.WEBSOCKET_URL = jsCookie.get(WebsocketService_1.BASE_URL_COOKIE) + "/websocket/";
6883
- WebsocketService.ctorParameters = function () { return [
6884
- { type: ngxCookieService.CookieService }
6885
- ]; };
6886
- WebsocketService.ɵprov = core.ɵɵdefineInjectable({ factory: function WebsocketService_Factory() { return new WebsocketService(core.ɵɵinject(ngxCookieService.CookieService)); }, token: WebsocketService, providedIn: "root" });
6971
+ WebsocketService.ɵprov = core.ɵɵdefineInjectable({ factory: function WebsocketService_Factory() { return new WebsocketService(); }, token: WebsocketService, providedIn: "root" });
6887
6972
  WebsocketService = WebsocketService_1 = __decorate([
6888
6973
  core.Injectable({
6889
6974
  providedIn: "root",