@senior-gestao-empresarial/angular-components 6.9.0 → 6.9.1
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.
- package/bundles/senior-gestao-empresarial-angular-components.umd.js +49 -29
- package/bundles/senior-gestao-empresarial-angular-components.umd.js.map +1 -1
- package/bundles/senior-gestao-empresarial-angular-components.umd.min.js +1 -1
- package/bundles/senior-gestao-empresarial-angular-components.umd.min.js.map +1 -1
- package/components/websocket/websocket.service.d.ts +5 -9
- package/esm2015/components/websocket/websocket.service.js +49 -34
- package/esm5/components/websocket/websocket.service.js +56 -36
- package/fesm2015/senior-gestao-empresarial-angular-components.js +43 -28
- package/fesm2015/senior-gestao-empresarial-angular-components.js.map +1 -1
- package/fesm5/senior-gestao-empresarial-angular-components.js +50 -30
- package/fesm5/senior-gestao-empresarial-angular-components.js.map +1 -1
- package/package.json +1 -1
- package/senior-gestao-empresarial-angular-components.metadata.json +1 -1
|
@@ -7190,8 +7190,6 @@
|
|
|
7190
7190
|
/** @private */
|
|
7191
7191
|
this.isConnecting = false;
|
|
7192
7192
|
/** @private */
|
|
7193
|
-
this.isReconnecting = false;
|
|
7194
|
-
/** @private */
|
|
7195
7193
|
this.primitiveManagers = new Map();
|
|
7196
7194
|
/** @private */
|
|
7197
7195
|
this.connect$ = new rxjs.Subject();
|
|
@@ -7238,11 +7236,12 @@
|
|
|
7238
7236
|
var domain = _a.domain, service = _a.service, primitive = _a.primitive;
|
|
7239
7237
|
var key = this.getPrimitiveManagerKey(domain, service, primitive);
|
|
7240
7238
|
return this.onConnect().pipe(operators.switchMap(function () {
|
|
7241
|
-
return _this.primitiveManagers.has(key) &&
|
|
7239
|
+
return _this.primitiveManagers.has(key) &&
|
|
7240
|
+
_this.primitiveManagers.get(key).isSubscribed
|
|
7242
7241
|
? rxjs.of(void 0).pipe(operators.take(1))
|
|
7243
7242
|
: _this.subscribe$.pipe(operators.filter(function (primitiveManager) {
|
|
7244
7243
|
return _this.getPrimitiveManagerKey(primitiveManager.domain, primitiveManager.service, primitiveManager.primitive) === key;
|
|
7245
|
-
}), operators.take(1),
|
|
7244
|
+
}), operators.take(1), operators.map(function () { return void 0; }));
|
|
7246
7245
|
}));
|
|
7247
7246
|
};
|
|
7248
7247
|
/**
|
|
@@ -7273,21 +7272,29 @@
|
|
|
7273
7272
|
primitive: primitive,
|
|
7274
7273
|
stompSubscriptions: [],
|
|
7275
7274
|
event$: new rxjs.Subject(),
|
|
7276
|
-
isSubscribed: false
|
|
7275
|
+
isSubscribed: false
|
|
7277
7276
|
};
|
|
7278
7277
|
this.primitiveManagers.set(key, primitiveManager);
|
|
7279
7278
|
if (this.isConnected) {
|
|
7280
7279
|
this.createStompSubscriptions(primitiveManager);
|
|
7281
|
-
return primitiveManager.event
|
|
7280
|
+
return primitiveManager.event$
|
|
7281
|
+
.asObservable()
|
|
7282
|
+
.pipe(operators.finalize(function () {
|
|
7283
|
+
return _this.disconnectPrimitiveOnFinalize(primitiveManager);
|
|
7284
|
+
}));
|
|
7282
7285
|
}
|
|
7283
7286
|
else {
|
|
7284
|
-
if (!this.
|
|
7287
|
+
if (!this.isConnecting) {
|
|
7285
7288
|
this.connect();
|
|
7286
7289
|
}
|
|
7287
7290
|
this.connect$.pipe(operators.first()).subscribe(function () {
|
|
7288
7291
|
_this.createStompSubscriptions(primitiveManager);
|
|
7289
7292
|
});
|
|
7290
|
-
return primitiveManager.event
|
|
7293
|
+
return primitiveManager.event$
|
|
7294
|
+
.asObservable()
|
|
7295
|
+
.pipe(operators.finalize(function () {
|
|
7296
|
+
return _this.disconnectPrimitiveOnFinalize(primitiveManager);
|
|
7297
|
+
}));
|
|
7291
7298
|
}
|
|
7292
7299
|
};
|
|
7293
7300
|
/** @private */
|
|
@@ -7296,7 +7303,10 @@
|
|
|
7296
7303
|
var stompSubscriptionWithToken = this.createStompSubscription(withTokenUrl, primitiveManager);
|
|
7297
7304
|
var withoutTokenUrl = this.getSubscriptionUrlWithoutToken(primitiveManager.domain, primitiveManager.service, primitiveManager.primitive);
|
|
7298
7305
|
var stompSubscriptionWithoutToken = this.createStompSubscription(withoutTokenUrl, primitiveManager);
|
|
7299
|
-
primitiveManager.stompSubscriptions = [
|
|
7306
|
+
primitiveManager.stompSubscriptions = [
|
|
7307
|
+
stompSubscriptionWithToken,
|
|
7308
|
+
stompSubscriptionWithoutToken
|
|
7309
|
+
];
|
|
7300
7310
|
primitiveManager.isSubscribed = true;
|
|
7301
7311
|
this.subscribe$.next(primitiveManager);
|
|
7302
7312
|
};
|
|
@@ -7307,7 +7317,6 @@
|
|
|
7307
7317
|
this.isConnecting = true;
|
|
7308
7318
|
this._stompClient.connect({}, function () {
|
|
7309
7319
|
_this.isConnecting = false;
|
|
7310
|
-
_this.isReconnecting = false;
|
|
7311
7320
|
_this.isConnected = true;
|
|
7312
7321
|
if (_this.wasConnected) {
|
|
7313
7322
|
_this.reconnectPrimitives();
|
|
@@ -7321,19 +7330,26 @@
|
|
|
7321
7330
|
}, function (error) {
|
|
7322
7331
|
_this.isConnected = false;
|
|
7323
7332
|
_this.error$.next(error);
|
|
7324
|
-
_this.
|
|
7325
|
-
|
|
7326
|
-
|
|
7327
|
-
|
|
7328
|
-
|
|
7329
|
-
|
|
7333
|
+
rxjs.race(_this.disconnect$.pipe(operators.take(1), operators.map(function () { return ({ wasDisconnected: true }); })), rxjs.timer(WebsocketService_1.RECONNECT_INTERVAL).pipe(operators.take(1), operators.switchMap(function () {
|
|
7334
|
+
return rxjs.iif(function () { return document.hidden; }, rxjs.fromEvent(document, 'visibilitychange').pipe(operators.first()), rxjs.of(void 0));
|
|
7335
|
+
}), operators.map(function () { return ({ wasDisconnected: false }); })))
|
|
7336
|
+
.pipe(operators.take(1))
|
|
7337
|
+
.subscribe({
|
|
7338
|
+
next: function (_a) {
|
|
7339
|
+
var wasDisconnected = _a.wasDisconnected;
|
|
7340
|
+
if (!wasDisconnected &&
|
|
7341
|
+
!(_this.isConnected || _this.isConnecting)) {
|
|
7342
|
+
_this.connect();
|
|
7343
|
+
}
|
|
7344
|
+
}
|
|
7345
|
+
});
|
|
7330
7346
|
});
|
|
7331
7347
|
};
|
|
7332
7348
|
WebsocketService.prototype.disconnect = function () {
|
|
7333
7349
|
var e_1, _a, e_2, _b, e_3, _c;
|
|
7334
|
-
|
|
7335
|
-
if (observersCount > 0)
|
|
7350
|
+
if (this.getObserversCount() > 0) {
|
|
7336
7351
|
return;
|
|
7352
|
+
}
|
|
7337
7353
|
try {
|
|
7338
7354
|
for (var _d = __values(this.primitiveManagers.values()), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
7339
7355
|
var primitiveManager = _e.value;
|
|
@@ -7382,19 +7398,25 @@
|
|
|
7382
7398
|
};
|
|
7383
7399
|
/** @private */
|
|
7384
7400
|
WebsocketService.prototype.getSubscriptionUrlWithToken = function (domain, service, primitive) {
|
|
7385
|
-
var tenant = WebsocketService_1.TOKEN
|
|
7386
|
-
|
|
7401
|
+
var tenant = WebsocketService_1.TOKEN
|
|
7402
|
+
? WebsocketService_1.TOKEN.username.split('@')[1]
|
|
7403
|
+
: null;
|
|
7404
|
+
var token = WebsocketService_1.TOKEN
|
|
7405
|
+
? WebsocketService_1.TOKEN.access_token
|
|
7406
|
+
: null;
|
|
7387
7407
|
return "/topic/" + tenant + "/" + token + "/" + domain + "/" + service + "/" + primitive;
|
|
7388
7408
|
};
|
|
7389
7409
|
/** @private */
|
|
7390
7410
|
WebsocketService.prototype.getSubscriptionUrlWithoutToken = function (domain, service, primitive) {
|
|
7391
|
-
var tenant = WebsocketService_1.TOKEN
|
|
7411
|
+
var tenant = WebsocketService_1.TOKEN
|
|
7412
|
+
? WebsocketService_1.TOKEN.username.split('@')[1]
|
|
7413
|
+
: null;
|
|
7392
7414
|
return "/topic/" + tenant + "/" + domain + "/" + service + "/" + primitive;
|
|
7393
7415
|
};
|
|
7394
7416
|
/** @private */
|
|
7395
7417
|
WebsocketService.prototype.createStompSubscription = function (destination, primitiveManager) {
|
|
7396
7418
|
return this._stompClient.subscribe(destination, function (message) {
|
|
7397
|
-
var event = JSON.parse(message.body ||
|
|
7419
|
+
var event = JSON.parse(message.body || '{}');
|
|
7398
7420
|
primitiveManager.event$.next(event);
|
|
7399
7421
|
});
|
|
7400
7422
|
};
|
|
@@ -7470,22 +7492,20 @@
|
|
|
7470
7492
|
return domain + "/" + service + "/" + primitive;
|
|
7471
7493
|
};
|
|
7472
7494
|
var WebsocketService_1;
|
|
7473
|
-
/** @private */
|
|
7474
7495
|
WebsocketService.RECONNECT_INTERVAL = 3000;
|
|
7475
|
-
/** @private */
|
|
7476
7496
|
WebsocketService.CONNECTION_TIMEOUT = 15000;
|
|
7477
7497
|
/** @private */
|
|
7478
|
-
WebsocketService.BASE_URL_COOKIE =
|
|
7498
|
+
WebsocketService.BASE_URL_COOKIE = 'com.senior.base.url';
|
|
7479
7499
|
/** @private */
|
|
7480
|
-
WebsocketService.TOKEN_COOKIE =
|
|
7500
|
+
WebsocketService.TOKEN_COOKIE = 'com.senior.token';
|
|
7481
7501
|
/** @private */
|
|
7482
|
-
WebsocketService.TOKEN = JSON.parse(jsCookie.get(WebsocketService_1.TOKEN_COOKIE) ||
|
|
7502
|
+
WebsocketService.TOKEN = JSON.parse(jsCookie.get(WebsocketService_1.TOKEN_COOKIE) || '{}');
|
|
7483
7503
|
/** @private */
|
|
7484
|
-
WebsocketService.WEBSOCKET_URL = jsCookie.get(WebsocketService_1.BASE_URL_COOKIE) +
|
|
7504
|
+
WebsocketService.WEBSOCKET_URL = jsCookie.get(WebsocketService_1.BASE_URL_COOKIE) + '/websocket/';
|
|
7485
7505
|
WebsocketService.ɵprov = core.ɵɵdefineInjectable({ factory: function WebsocketService_Factory() { return new WebsocketService(); }, token: WebsocketService, providedIn: "root" });
|
|
7486
7506
|
WebsocketService = WebsocketService_1 = __decorate([
|
|
7487
7507
|
core.Injectable({
|
|
7488
|
-
providedIn:
|
|
7508
|
+
providedIn: 'root'
|
|
7489
7509
|
})
|
|
7490
7510
|
], WebsocketService);
|
|
7491
7511
|
return WebsocketService;
|