taxtank-core 0.16.0 → 0.16.3
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 +104 -62
- package/bundles/taxtank-core.umd.js.map +1 -1
- package/esm2015/lib/db/Models/user/client-details.js +1 -1
- package/esm2015/lib/models/event/app-event-type.enum.js +38 -37
- package/esm2015/lib/services/http/bank/basiq/basiq.service.js +17 -1
- package/esm2015/lib/services/http/property/property.service.js +1 -8
- package/esm2015/lib/services/http/user/user.service.js +51 -18
- package/fesm2015/taxtank-core.js +100 -60
- package/fesm2015/taxtank-core.js.map +1 -1
- package/lib/db/Models/user/client-details.d.ts +1 -1
- package/lib/models/event/app-event-type.enum.d.ts +37 -36
- package/lib/services/http/bank/basiq/basiq.service.d.ts +8 -0
- package/lib/services/http/property/property.service.d.ts +0 -4
- package/lib/services/http/user/user.service.d.ts +17 -3
- package/package.json +1 -1
package/fesm2015/taxtank-core.js
CHANGED
|
@@ -5805,42 +5805,43 @@ var AppEventTypeEnum;
|
|
|
5805
5805
|
AppEventTypeEnum[AppEventTypeEnum["BANK_ACCOUNT_CREATED"] = 2] = "BANK_ACCOUNT_CREATED";
|
|
5806
5806
|
AppEventTypeEnum[AppEventTypeEnum["BANK_ACCOUNT_UPDATED"] = 3] = "BANK_ACCOUNT_UPDATED";
|
|
5807
5807
|
AppEventTypeEnum[AppEventTypeEnum["BANK_TRANSACTION_ALLOCATED"] = 4] = "BANK_TRANSACTION_ALLOCATED";
|
|
5808
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
5809
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
5810
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
5811
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
5812
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
5813
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
5814
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
5815
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
5816
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
5817
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
5818
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
5819
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
5820
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
5821
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
5822
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
5823
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
5824
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
5825
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
5826
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
5827
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
5828
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
5829
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
5830
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
5831
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
5832
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
5833
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
5834
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
5835
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
5836
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
5837
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
5838
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
5839
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
5840
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
5841
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
5842
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
5843
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
5808
|
+
AppEventTypeEnum[AppEventTypeEnum["BASIQ_CONSENT_UPDATED"] = 5] = "BASIQ_CONSENT_UPDATED";
|
|
5809
|
+
AppEventTypeEnum[AppEventTypeEnum["CLIENT_INVITE_ACCEPTED"] = 6] = "CLIENT_INVITE_ACCEPTED";
|
|
5810
|
+
AppEventTypeEnum[AppEventTypeEnum["CLIENT_OPEN_CHAT"] = 7] = "CLIENT_OPEN_CHAT";
|
|
5811
|
+
AppEventTypeEnum[AppEventTypeEnum["CLIENT_TRANSFER_TO_OTHER_EMPLOYEE"] = 8] = "CLIENT_TRANSFER_TO_OTHER_EMPLOYEE";
|
|
5812
|
+
AppEventTypeEnum[AppEventTypeEnum["DEPRECIATION_DELETED"] = 9] = "DEPRECIATION_DELETED";
|
|
5813
|
+
AppEventTypeEnum[AppEventTypeEnum["DEPRECIATIONS_CREATED"] = 10] = "DEPRECIATIONS_CREATED";
|
|
5814
|
+
AppEventTypeEnum[AppEventTypeEnum["INCOME_SOURCES_CREATED"] = 11] = "INCOME_SOURCES_CREATED";
|
|
5815
|
+
AppEventTypeEnum[AppEventTypeEnum["INCOME_SOURCES_UPDATED"] = 12] = "INCOME_SOURCES_UPDATED";
|
|
5816
|
+
AppEventTypeEnum[AppEventTypeEnum["INCOME_SOURCES_FORECASTS_CREATED"] = 13] = "INCOME_SOURCES_FORECASTS_CREATED";
|
|
5817
|
+
AppEventTypeEnum[AppEventTypeEnum["INCOME_SOURCES_FORECASTS_UPDATED"] = 14] = "INCOME_SOURCES_FORECASTS_UPDATED";
|
|
5818
|
+
AppEventTypeEnum[AppEventTypeEnum["LOAN_UPDATED"] = 15] = "LOAN_UPDATED";
|
|
5819
|
+
AppEventTypeEnum[AppEventTypeEnum["LOAN_PAYOUT_UPDATED"] = 16] = "LOAN_PAYOUT_UPDATED";
|
|
5820
|
+
AppEventTypeEnum[AppEventTypeEnum["MESSAGE_CREATED"] = 17] = "MESSAGE_CREATED";
|
|
5821
|
+
AppEventTypeEnum[AppEventTypeEnum["MESSAGE_FILE_CREATED"] = 18] = "MESSAGE_FILE_CREATED";
|
|
5822
|
+
AppEventTypeEnum[AppEventTypeEnum["MESSAGE_FILE_DELETED"] = 19] = "MESSAGE_FILE_DELETED";
|
|
5823
|
+
AppEventTypeEnum[AppEventTypeEnum["NOTIFICATION_ADDED"] = 20] = "NOTIFICATION_ADDED";
|
|
5824
|
+
AppEventTypeEnum[AppEventTypeEnum["PROPERTY_UPDATED_WITH_DOCUMENT"] = 21] = "PROPERTY_UPDATED_WITH_DOCUMENT";
|
|
5825
|
+
AppEventTypeEnum[AppEventTypeEnum["PROPERTY_DOCUMENT_ADDED"] = 22] = "PROPERTY_DOCUMENT_ADDED";
|
|
5826
|
+
AppEventTypeEnum[AppEventTypeEnum["PROPERTY_MOVEMENT_CREATED"] = 23] = "PROPERTY_MOVEMENT_CREATED";
|
|
5827
|
+
AppEventTypeEnum[AppEventTypeEnum["PROPERTY_MOVEMENT_UPDATED"] = 24] = "PROPERTY_MOVEMENT_UPDATED";
|
|
5828
|
+
AppEventTypeEnum[AppEventTypeEnum["PROPERTY_MOVEMENT_DELETED"] = 25] = "PROPERTY_MOVEMENT_DELETED";
|
|
5829
|
+
AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SHARE_UPDATED"] = 26] = "PROPERTY_SHARE_UPDATED";
|
|
5830
|
+
AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SUBSCRIPTION_ADDED"] = 27] = "PROPERTY_SUBSCRIPTION_ADDED";
|
|
5831
|
+
AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SUBSCRIPTION_DELETED"] = 28] = "PROPERTY_SUBSCRIPTION_DELETED";
|
|
5832
|
+
AppEventTypeEnum[AppEventTypeEnum["PROPERTY_VALUATION_DOCUMENT_CREATED"] = 29] = "PROPERTY_VALUATION_DOCUMENT_CREATED";
|
|
5833
|
+
AppEventTypeEnum[AppEventTypeEnum["SERVICE_SUBSCRIPTION_UPDATED"] = 30] = "SERVICE_SUBSCRIPTION_UPDATED";
|
|
5834
|
+
AppEventTypeEnum[AppEventTypeEnum["TAX_REVIEW_UPDATED"] = 31] = "TAX_REVIEW_UPDATED";
|
|
5835
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_CREATED"] = 32] = "TRANSACTION_CREATED";
|
|
5836
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_DELETED"] = 33] = "TRANSACTION_DELETED";
|
|
5837
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED"] = 34] = "TRANSACTION_UPDATED";
|
|
5838
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTIONS_CREATED"] = 35] = "TRANSACTIONS_CREATED";
|
|
5839
|
+
AppEventTypeEnum[AppEventTypeEnum["USER_UPDATED"] = 36] = "USER_UPDATED";
|
|
5840
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_UPDATED"] = 37] = "VEHICLE_CLAIM_UPDATED";
|
|
5841
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_CREATED"] = 38] = "VEHICLE_CLAIM_CREATED";
|
|
5842
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_CREATED"] = 39] = "VEHICLE_LOGBOOK_CREATED";
|
|
5843
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_UPDATED"] = 40] = "VEHICLE_LOGBOOK_UPDATED";
|
|
5844
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_DELETED"] = 41] = "VEHICLE_LOGBOOK_DELETED";
|
|
5844
5845
|
})(AppEventTypeEnum || (AppEventTypeEnum = {}));
|
|
5845
5846
|
|
|
5846
5847
|
/**
|
|
@@ -7222,7 +7223,6 @@ class PropertyService extends RestService {
|
|
|
7222
7223
|
}
|
|
7223
7224
|
listenEvents() {
|
|
7224
7225
|
this.listenShareInviteAccepted();
|
|
7225
|
-
this.listenServiceSubscriptionUpdated();
|
|
7226
7226
|
// @TODO Alex: consider to refactor property movements logic similar to client-movements
|
|
7227
7227
|
this.listenMovementsChanged();
|
|
7228
7228
|
}
|
|
@@ -7232,12 +7232,6 @@ class PropertyService extends RestService {
|
|
|
7232
7232
|
listenShareInviteAccepted() {
|
|
7233
7233
|
this.eventDispatcherService.on(AppEventTypeEnum.PROPERTY_SHARE_UPDATED).subscribe(() => this.resetCache());
|
|
7234
7234
|
}
|
|
7235
|
-
/**
|
|
7236
|
-
* Update cache when user's service subscription is updated
|
|
7237
|
-
*/
|
|
7238
|
-
listenServiceSubscriptionUpdated() {
|
|
7239
|
-
this.eventDispatcherService.on(AppEventTypeEnum.SERVICE_SUBSCRIPTION_UPDATED).subscribe(() => this.resetCache());
|
|
7240
|
-
}
|
|
7241
7235
|
/**
|
|
7242
7236
|
* Update cache when property category changed
|
|
7243
7237
|
*/
|
|
@@ -8366,6 +8360,21 @@ class BasiqService extends RestService {
|
|
|
8366
8360
|
this.listenToBankConnectionAdded();
|
|
8367
8361
|
this.listenNotifications();
|
|
8368
8362
|
}
|
|
8363
|
+
/**
|
|
8364
|
+
* Update user's basiq consents data on backend
|
|
8365
|
+
*/
|
|
8366
|
+
confirmConsents() {
|
|
8367
|
+
return this.http.put(`${this.environment.apiV2}/basiq/consents`, {}).pipe(map((isConfirmed) => {
|
|
8368
|
+
this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.BASIQ_CONSENT_UPDATED, isConfirmed));
|
|
8369
|
+
return isConfirmed;
|
|
8370
|
+
}));
|
|
8371
|
+
}
|
|
8372
|
+
/**
|
|
8373
|
+
* Notify backend to update connections
|
|
8374
|
+
*/
|
|
8375
|
+
updateConnections() {
|
|
8376
|
+
return this.http.post(`${this.environment.apiV2}/basiq/connections`, {});
|
|
8377
|
+
}
|
|
8369
8378
|
/**
|
|
8370
8379
|
* access token to use basiq connect ui iframe
|
|
8371
8380
|
*/
|
|
@@ -10925,32 +10934,40 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
10925
10934
|
* Service to work with user
|
|
10926
10935
|
*/
|
|
10927
10936
|
class UserService {
|
|
10928
|
-
constructor(http, jwtService, eventDispatcherService, environment) {
|
|
10937
|
+
constructor(http, jwtService, eventDispatcherService, sseService, environment) {
|
|
10929
10938
|
this.http = http;
|
|
10930
10939
|
this.jwtService = jwtService;
|
|
10931
10940
|
this.eventDispatcherService = eventDispatcherService;
|
|
10941
|
+
this.sseService = sseService;
|
|
10932
10942
|
this.environment = environment;
|
|
10933
10943
|
this.cacheSubject = new ReplaySubject(1);
|
|
10944
|
+
this.listenEvents();
|
|
10945
|
+
}
|
|
10946
|
+
listenEvents() {
|
|
10947
|
+
this.listenServiceSubscriptionUpdated();
|
|
10948
|
+
this.listenBasiqConcentUpdated();
|
|
10934
10949
|
}
|
|
10935
|
-
/**
|
|
10936
|
-
* Get current user
|
|
10937
|
-
*/
|
|
10938
10950
|
get() {
|
|
10939
10951
|
if (!this.cache) {
|
|
10940
|
-
this.
|
|
10941
|
-
.pipe(map((userBase) => {
|
|
10942
|
-
return plainToClass(User, userBase);
|
|
10943
|
-
}))
|
|
10944
|
-
.subscribe((user) => {
|
|
10945
|
-
localStorage.setItem('userId', user.id.toString());
|
|
10946
|
-
// @TODO remove
|
|
10947
|
-
localStorage.setItem('financialYear', user.financialYear.toString());
|
|
10948
|
-
this.cache = user;
|
|
10949
|
-
this.cacheSubject.next(this.cache);
|
|
10950
|
-
});
|
|
10952
|
+
this.fetch().subscribe();
|
|
10951
10953
|
}
|
|
10952
10954
|
return this.cacheSubject.asObservable();
|
|
10953
10955
|
}
|
|
10956
|
+
/**
|
|
10957
|
+
* Get current user
|
|
10958
|
+
*/
|
|
10959
|
+
fetch() {
|
|
10960
|
+
return this.http.get(`${this.environment.apiV2}/users/current`)
|
|
10961
|
+
.pipe(map((userBase) => {
|
|
10962
|
+
const user = plainToClass(User, userBase);
|
|
10963
|
+
localStorage.setItem('userId', user.id.toString());
|
|
10964
|
+
// @TODO remove
|
|
10965
|
+
localStorage.setItem('financialYear', user.financialYear.toString());
|
|
10966
|
+
this.cache = user;
|
|
10967
|
+
this.cacheSubject.next(this.cache);
|
|
10968
|
+
return user;
|
|
10969
|
+
}));
|
|
10970
|
+
}
|
|
10954
10971
|
/**
|
|
10955
10972
|
* Register new user
|
|
10956
10973
|
*/
|
|
@@ -11021,15 +11038,38 @@ class UserService {
|
|
|
11021
11038
|
switchFinancialYear() {
|
|
11022
11039
|
return this.http.get(`${this.environment.apiV2}/financial-year/switch`);
|
|
11023
11040
|
}
|
|
11041
|
+
/**
|
|
11042
|
+
* clear service cache
|
|
11043
|
+
*/
|
|
11044
|
+
resetCache() {
|
|
11045
|
+
this.fetch().subscribe();
|
|
11046
|
+
}
|
|
11047
|
+
/**
|
|
11048
|
+
* Update cache when user's service subscription is updated
|
|
11049
|
+
*/
|
|
11050
|
+
listenServiceSubscriptionUpdated() {
|
|
11051
|
+
this.eventDispatcherService.on(AppEventTypeEnum.SERVICE_SUBSCRIPTION_UPDATED).subscribe(() => this.resetCache());
|
|
11052
|
+
}
|
|
11053
|
+
listenBasiqConcentUpdated() {
|
|
11054
|
+
this.eventDispatcherService.on(AppEventTypeEnum.BASIQ_CONSENT_UPDATED).subscribe((isConfirmed) => {
|
|
11055
|
+
if (!isConfirmed) {
|
|
11056
|
+
return;
|
|
11057
|
+
}
|
|
11058
|
+
const user = clone(this.cache);
|
|
11059
|
+
user.clientDetails.basiqConsentExist = true;
|
|
11060
|
+
this.cache = user;
|
|
11061
|
+
this.cacheSubject.next(this.cache);
|
|
11062
|
+
});
|
|
11063
|
+
}
|
|
11024
11064
|
}
|
|
11025
|
-
UserService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: UserService, deps: [{ token: i1.HttpClient }, { token: JwtService }, { token: EventDispatcherService }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
11065
|
+
UserService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: UserService, deps: [{ token: i1.HttpClient }, { token: JwtService }, { token: EventDispatcherService }, { token: SseService }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
11026
11066
|
UserService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: UserService, providedIn: 'root' });
|
|
11027
11067
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: UserService, decorators: [{
|
|
11028
11068
|
type: Injectable,
|
|
11029
11069
|
args: [{
|
|
11030
11070
|
providedIn: 'root'
|
|
11031
11071
|
}]
|
|
11032
|
-
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: JwtService }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
11072
|
+
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: JwtService }, { type: EventDispatcherService }, { type: SseService }, { type: undefined, decorators: [{
|
|
11033
11073
|
type: Inject,
|
|
11034
11074
|
args: ['environment']
|
|
11035
11075
|
}] }]; } });
|