taxtank-core 0.16.2 → 0.16.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.
- package/bundles/taxtank-core.umd.js +44 -31
- package/bundles/taxtank-core.umd.js.map +1 -1
- package/esm2015/lib/models/endpoint/endpoints.const.js +3 -2
- package/esm2015/lib/services/http/bank/basiq/basiq.service.js +3 -3
- package/esm2015/lib/services/http/property/property.service.js +1 -8
- package/esm2015/lib/services/http/user/user.service.js +40 -20
- package/fesm2015/taxtank-core.js +42 -29
- package/fesm2015/taxtank-core.js.map +1 -1
- package/lib/services/http/property/property.service.d.ts +0 -4
- package/lib/services/http/user/user.service.d.ts +15 -3
- package/package.json +1 -1
|
@@ -831,7 +831,8 @@
|
|
|
831
831
|
BANK_TRANSACTIONS_GET: new Endpoint('GET', '\\/bank-transactions'),
|
|
832
832
|
BANK_TRANSACTIONS_DELETE: new Endpoint('DELETE', '\\/bank-transactions\\/\\d+'),
|
|
833
833
|
BANK_TRANSACTIONS_IMPORT_POST: new Endpoint('POST', '\\/bank-transactions\\/\\d+\\/import'),
|
|
834
|
-
BASIQ_ACCOUNTS_GET: new Endpoint('GET', '\\/basiq
|
|
834
|
+
BASIQ_ACCOUNTS_GET: new Endpoint('GET', '\\/basiq\\/accounts'),
|
|
835
|
+
BASIQ_TOKEN_GET: new Endpoint('GET', '\\/basiq\\/tokens'),
|
|
835
836
|
CHARTS_INCOME_GET: new Endpoint('GET', '\\/charts\\/\\incomes'),
|
|
836
837
|
CHARTS_EXPENSES_GET: new Endpoint('GET', '\\/charts\\/\\expenses'),
|
|
837
838
|
CHART_ACCOUNTS_GET: new Endpoint('GET', '\\/chart-accounts'),
|
|
@@ -9266,7 +9267,6 @@
|
|
|
9266
9267
|
}
|
|
9267
9268
|
PropertyService.prototype.listenEvents = function () {
|
|
9268
9269
|
this.listenShareInviteAccepted();
|
|
9269
|
-
this.listenServiceSubscriptionUpdated();
|
|
9270
9270
|
// @TODO Alex: consider to refactor property movements logic similar to client-movements
|
|
9271
9271
|
this.listenMovementsChanged();
|
|
9272
9272
|
};
|
|
@@ -9277,13 +9277,6 @@
|
|
|
9277
9277
|
var _this = this;
|
|
9278
9278
|
this.eventDispatcherService.on(exports.AppEventTypeEnum.PROPERTY_SHARE_UPDATED).subscribe(function () { return _this.resetCache(); });
|
|
9279
9279
|
};
|
|
9280
|
-
/**
|
|
9281
|
-
* Update cache when user's service subscription is updated
|
|
9282
|
-
*/
|
|
9283
|
-
PropertyService.prototype.listenServiceSubscriptionUpdated = function () {
|
|
9284
|
-
var _this = this;
|
|
9285
|
-
this.eventDispatcherService.on(exports.AppEventTypeEnum.SERVICE_SUBSCRIPTION_UPDATED).subscribe(function () { return _this.resetCache(); });
|
|
9286
|
-
};
|
|
9287
9280
|
/**
|
|
9288
9281
|
* Update cache when property category changed
|
|
9289
9282
|
*/
|
|
@@ -10494,8 +10487,7 @@
|
|
|
10494
10487
|
*/
|
|
10495
10488
|
BasiqService.prototype.confirmConsents = function () {
|
|
10496
10489
|
var _this = this;
|
|
10497
|
-
return this.http.put(this.environment.apiV2 + "/basiq/consents", {}).pipe(operators.map(function (
|
|
10498
|
-
var isConfirmed = !!Object.values(response).length;
|
|
10490
|
+
return this.http.put(this.environment.apiV2 + "/basiq/consents", {}).pipe(operators.map(function (isConfirmed) {
|
|
10499
10491
|
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.BASIQ_CONSENT_UPDATED, isConfirmed));
|
|
10500
10492
|
return isConfirmed;
|
|
10501
10493
|
}));
|
|
@@ -10518,6 +10510,7 @@
|
|
|
10518
10510
|
return new BasiqToken(response['access_token'], new Date(now + response['expires_in'] * 1000));
|
|
10519
10511
|
}))
|
|
10520
10512
|
.subscribe(function (token) {
|
|
10513
|
+
_this.token = token;
|
|
10521
10514
|
_this.tokenSubject.next(token);
|
|
10522
10515
|
});
|
|
10523
10516
|
}
|
|
@@ -13330,34 +13323,41 @@
|
|
|
13330
13323
|
* Service to work with user
|
|
13331
13324
|
*/
|
|
13332
13325
|
var UserService = /** @class */ (function () {
|
|
13333
|
-
function UserService(http, jwtService, eventDispatcherService, environment) {
|
|
13326
|
+
function UserService(http, jwtService, eventDispatcherService, sseService, environment) {
|
|
13334
13327
|
this.http = http;
|
|
13335
13328
|
this.jwtService = jwtService;
|
|
13336
13329
|
this.eventDispatcherService = eventDispatcherService;
|
|
13330
|
+
this.sseService = sseService;
|
|
13337
13331
|
this.environment = environment;
|
|
13338
13332
|
this.cacheSubject = new rxjs.ReplaySubject(1);
|
|
13339
13333
|
this.listenEvents();
|
|
13340
13334
|
}
|
|
13341
|
-
|
|
13342
|
-
|
|
13343
|
-
|
|
13335
|
+
UserService.prototype.listenEvents = function () {
|
|
13336
|
+
this.listenServiceSubscriptionUpdated();
|
|
13337
|
+
this.listenBasiqConcentUpdated();
|
|
13338
|
+
};
|
|
13344
13339
|
UserService.prototype.get = function () {
|
|
13345
|
-
var _this = this;
|
|
13346
13340
|
if (!this.cache) {
|
|
13347
|
-
this.
|
|
13348
|
-
.pipe(operators.map(function (userBase) {
|
|
13349
|
-
return classTransformer.plainToClass(User, userBase);
|
|
13350
|
-
}))
|
|
13351
|
-
.subscribe(function (user) {
|
|
13352
|
-
localStorage.setItem('userId', user.id.toString());
|
|
13353
|
-
// @TODO remove
|
|
13354
|
-
localStorage.setItem('financialYear', user.financialYear.toString());
|
|
13355
|
-
_this.cache = user;
|
|
13356
|
-
_this.cacheSubject.next(_this.cache);
|
|
13357
|
-
});
|
|
13341
|
+
this.fetch().subscribe();
|
|
13358
13342
|
}
|
|
13359
13343
|
return this.cacheSubject.asObservable();
|
|
13360
13344
|
};
|
|
13345
|
+
/**
|
|
13346
|
+
* Get current user
|
|
13347
|
+
*/
|
|
13348
|
+
UserService.prototype.fetch = function () {
|
|
13349
|
+
var _this = this;
|
|
13350
|
+
return this.http.get(this.environment.apiV2 + "/users/current")
|
|
13351
|
+
.pipe(operators.map(function (userBase) {
|
|
13352
|
+
var user = classTransformer.plainToClass(User, userBase);
|
|
13353
|
+
localStorage.setItem('userId', user.id.toString());
|
|
13354
|
+
// @TODO remove
|
|
13355
|
+
localStorage.setItem('financialYear', user.financialYear.toString());
|
|
13356
|
+
_this.cache = user;
|
|
13357
|
+
_this.cacheSubject.next(_this.cache);
|
|
13358
|
+
return user;
|
|
13359
|
+
}));
|
|
13360
|
+
};
|
|
13361
13361
|
/**
|
|
13362
13362
|
* Register new user
|
|
13363
13363
|
*/
|
|
@@ -13431,7 +13431,20 @@
|
|
|
13431
13431
|
UserService.prototype.switchFinancialYear = function () {
|
|
13432
13432
|
return this.http.get(this.environment.apiV2 + "/financial-year/switch");
|
|
13433
13433
|
};
|
|
13434
|
-
|
|
13434
|
+
/**
|
|
13435
|
+
* clear service cache
|
|
13436
|
+
*/
|
|
13437
|
+
UserService.prototype.resetCache = function () {
|
|
13438
|
+
this.fetch().subscribe();
|
|
13439
|
+
};
|
|
13440
|
+
/**
|
|
13441
|
+
* Update cache when user's service subscription is updated
|
|
13442
|
+
*/
|
|
13443
|
+
UserService.prototype.listenServiceSubscriptionUpdated = function () {
|
|
13444
|
+
var _this = this;
|
|
13445
|
+
this.eventDispatcherService.on(exports.AppEventTypeEnum.SERVICE_SUBSCRIPTION_UPDATED).subscribe(function () { return _this.resetCache(); });
|
|
13446
|
+
};
|
|
13447
|
+
UserService.prototype.listenBasiqConcentUpdated = function () {
|
|
13435
13448
|
var _this = this;
|
|
13436
13449
|
this.eventDispatcherService.on(exports.AppEventTypeEnum.BASIQ_CONSENT_UPDATED).subscribe(function (isConfirmed) {
|
|
13437
13450
|
if (!isConfirmed) {
|
|
@@ -13439,13 +13452,13 @@
|
|
|
13439
13452
|
}
|
|
13440
13453
|
var user = clone__default["default"](_this.cache);
|
|
13441
13454
|
user.clientDetails.basiqConsentExist = true;
|
|
13442
|
-
_this.cache =
|
|
13455
|
+
_this.cache = user;
|
|
13443
13456
|
_this.cacheSubject.next(_this.cache);
|
|
13444
13457
|
});
|
|
13445
13458
|
};
|
|
13446
13459
|
return UserService;
|
|
13447
13460
|
}());
|
|
13448
|
-
UserService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: UserService, deps: [{ token: i1__namespace.HttpClient }, { token: JwtService }, { token: EventDispatcherService }, { token: 'environment' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
13461
|
+
UserService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: UserService, deps: [{ token: i1__namespace.HttpClient }, { token: JwtService }, { token: EventDispatcherService }, { token: SseService }, { token: 'environment' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
13449
13462
|
UserService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: UserService, providedIn: 'root' });
|
|
13450
13463
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: UserService, decorators: [{
|
|
13451
13464
|
type: i0.Injectable,
|
|
@@ -13453,7 +13466,7 @@
|
|
|
13453
13466
|
providedIn: 'root'
|
|
13454
13467
|
}]
|
|
13455
13468
|
}], ctorParameters: function () {
|
|
13456
|
-
return [{ type: i1__namespace.HttpClient }, { type: JwtService }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
13469
|
+
return [{ type: i1__namespace.HttpClient }, { type: JwtService }, { type: EventDispatcherService }, { type: SseService }, { type: undefined, decorators: [{
|
|
13457
13470
|
type: i0.Inject,
|
|
13458
13471
|
args: ['environment']
|
|
13459
13472
|
}] }];
|