taxtank-core 0.2.2 → 0.3.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/taxtank-core.umd.js +969 -484
- package/bundles/taxtank-core.umd.js.map +1 -1
- package/esm2015/lib/collections/bank-account.collection.js +3 -3
- package/esm2015/lib/collections/bank-transaction.collection.js +3 -3
- package/esm2015/lib/collections/client-movement.collection.js +3 -3
- package/esm2015/lib/collections/client-portfolio-report.collection.js +3 -3
- package/esm2015/lib/collections/client.collection.js +3 -3
- package/esm2015/lib/collections/collection-dictionary.js +1 -1
- package/esm2015/lib/collections/collection.js +75 -0
- package/esm2015/lib/collections/depreciation-forecast.collection.js +5 -5
- package/esm2015/lib/collections/depreciation.collection.js +3 -3
- package/esm2015/lib/collections/employee.collection.js +3 -3
- package/esm2015/lib/collections/income-source.collection.js +3 -3
- package/esm2015/lib/collections/loan.collection.js +3 -3
- package/esm2015/lib/collections/message-document.collection.js +3 -3
- package/esm2015/lib/collections/message.collection.js +3 -3
- package/esm2015/lib/collections/property.collection.js +10 -3
- package/esm2015/lib/collections/service-price.collection.js +3 -3
- package/esm2015/lib/collections/service-subscription.collection.js +3 -3
- package/esm2015/lib/collections/tax-return-category-item.collection.js +3 -3
- package/esm2015/lib/collections/tax-review.collection.js +3 -3
- package/esm2015/lib/collections/transaction-allocation.collection.js +3 -3
- package/esm2015/lib/collections/transaction.collection.js +3 -3
- package/esm2015/lib/collections/user-event-setting.collection.js +3 -3
- package/esm2015/lib/db/Enums/chart-accounts-metadata-list.enum.js +2 -3
- package/esm2015/lib/interceptors/corelogic-interceptor.js +44 -0
- package/esm2015/lib/interceptors/financial-year-interceptor.js +30 -0
- package/esm2015/lib/interceptors/interceptors.module.js +74 -0
- package/esm2015/lib/interceptors/jwt-interceptor.js +137 -0
- package/esm2015/lib/interceptors/preloader.interceptor.js +32 -0
- package/esm2015/lib/interceptors/user-switcher-interceptor.js +42 -0
- package/esm2015/lib/models/color/alphabet-colors.enum.js +30 -0
- package/esm2015/lib/models/data-table/data-table.js +6 -4
- package/esm2015/lib/models/logbook/vehicle-claim.js +7 -1
- package/esm2015/lib/models/transaction/transaction.js +11 -5
- package/esm2015/lib/services/bank/bank-account.service.js +7 -1
- package/esm2015/lib/services/pdf/pdf.service.js +39 -6
- package/esm2015/lib/services/property/equity-position-chart.service.js +45 -0
- package/esm2015/lib/services/xlsx/xlsx.service.js +1 -1
- package/esm2015/lib/tt-core.module.js +8 -4
- package/esm2015/public-api.js +8 -2
- package/fesm2015/taxtank-core.js +893 -442
- package/fesm2015/taxtank-core.js.map +1 -1
- package/lib/collections/bank-account.collection.d.ts +2 -2
- package/lib/collections/bank-transaction.collection.d.ts +2 -2
- package/lib/collections/client-movement.collection.d.ts +2 -2
- package/lib/collections/client-portfolio-report.collection.d.ts +2 -2
- package/lib/collections/client.collection.d.ts +2 -2
- package/lib/collections/collection-dictionary.d.ts +2 -2
- package/lib/collections/{abstract.collection.d.ts → collection.d.ts} +3 -9
- package/lib/collections/depreciation-forecast.collection.d.ts +2 -2
- package/lib/collections/depreciation.collection.d.ts +2 -2
- package/lib/collections/employee.collection.d.ts +2 -2
- package/lib/collections/income-source.collection.d.ts +2 -2
- package/lib/collections/loan.collection.d.ts +2 -2
- package/lib/collections/message-document.collection.d.ts +2 -2
- package/lib/collections/message.collection.d.ts +2 -2
- package/lib/collections/property.collection.d.ts +7 -2
- package/lib/collections/service-price.collection.d.ts +2 -2
- package/lib/collections/service-subscription.collection.d.ts +2 -2
- package/lib/collections/tax-return-category-item.collection.d.ts +2 -2
- package/lib/collections/tax-review.collection.d.ts +2 -2
- package/lib/collections/transaction-allocation.collection.d.ts +2 -2
- package/lib/collections/transaction.collection.d.ts +2 -2
- package/lib/collections/user-event-setting.collection.d.ts +2 -2
- package/lib/db/Enums/chart-accounts-metadata-list.enum.d.ts +1 -2
- package/lib/interceptors/corelogic-interceptor.d.ts +20 -0
- package/lib/interceptors/financial-year-interceptor.d.ts +12 -0
- package/lib/interceptors/interceptors.module.d.ts +6 -0
- package/lib/interceptors/jwt-interceptor.d.ts +42 -0
- package/lib/interceptors/preloader.interceptor.d.ts +15 -0
- package/lib/interceptors/user-switcher-interceptor.d.ts +19 -0
- package/lib/models/color/alphabet-colors.enum.d.ts +28 -0
- package/lib/models/data-table/data-table.d.ts +2 -2
- package/lib/models/logbook/vehicle-claim.d.ts +4 -0
- package/lib/models/transaction/transaction.d.ts +3 -3
- package/lib/services/bank/bank-account.service.d.ts +1 -0
- package/lib/services/pdf/pdf.service.d.ts +10 -1
- package/lib/services/property/equity-position-chart.service.d.ts +15 -0
- package/lib/services/xlsx/xlsx.service.d.ts +1 -1
- package/lib/tt-core.module.d.ts +2 -1
- package/package.json +1 -1
- package/public-api.d.ts +7 -1
- package/esm2015/lib/collections/abstract.collection.js +0 -83
package/fesm2015/taxtank-core.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { Injectable, Inject, NgModule, EventEmitter } from '@angular/core';
|
|
3
3
|
import { CommonModule } from '@angular/common';
|
|
4
|
+
import * as i1 from '@angular/common/http';
|
|
5
|
+
import { HttpParams, HttpErrorResponse, HTTP_INTERCEPTORS } from '@angular/common/http';
|
|
6
|
+
import { ReplaySubject, BehaviorSubject, throwError, Subject, Observable, combineLatest, forkJoin } from 'rxjs';
|
|
7
|
+
import { map, catchError, filter, take, switchMap, finalize, mergeMap } from 'rxjs/operators';
|
|
8
|
+
import { plainToClass, Type, Exclude, Transform, Expose, classToPlain } from 'class-transformer';
|
|
9
|
+
import { JwtHelperService } from '@auth0/angular-jwt';
|
|
4
10
|
import has from 'lodash/has';
|
|
5
11
|
import get from 'lodash/get';
|
|
6
12
|
import flatten from 'lodash/flatten';
|
|
@@ -10,15 +16,10 @@ import uniqBy from 'lodash/uniqBy';
|
|
|
10
16
|
import concat from 'lodash/concat';
|
|
11
17
|
import compact from 'lodash/compact';
|
|
12
18
|
import { __decorate, __awaiter } from 'tslib';
|
|
13
|
-
import { Type, plainToClass, Exclude, Transform, Expose, classToPlain } from 'class-transformer';
|
|
14
19
|
import * as moment from 'moment';
|
|
15
20
|
import { DateRange } from 'moment-range';
|
|
16
21
|
import cloneDeep$1 from 'lodash/cloneDeep';
|
|
17
22
|
import { Validators } from '@angular/forms';
|
|
18
|
-
import { ReplaySubject, BehaviorSubject, Subject, Observable, combineLatest, forkJoin } from 'rxjs';
|
|
19
|
-
import { map, filter, mergeMap } from 'rxjs/operators';
|
|
20
|
-
import * as i1 from '@angular/common/http';
|
|
21
|
-
import { JwtHelperService } from '@auth0/angular-jwt';
|
|
22
23
|
import _ from 'lodash';
|
|
23
24
|
import { EventSourcePolyfill } from 'event-source-polyfill/src/eventsource.min.js';
|
|
24
25
|
import * as i1$1 from '@angular/router';
|
|
@@ -30,6 +31,682 @@ import { loadStripe } from '@stripe/stripe-js';
|
|
|
30
31
|
import * as xlsx from 'xlsx';
|
|
31
32
|
import * as FileSaver from 'file-saver';
|
|
32
33
|
|
|
34
|
+
/**
|
|
35
|
+
* https://api-uat.corelogic.asia/property/au/v2/suggest.json
|
|
36
|
+
* address suggestion from corelogic service
|
|
37
|
+
*/
|
|
38
|
+
class CorelogicSuggestion {
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
class CorelogicService {
|
|
42
|
+
constructor(http, environment) {
|
|
43
|
+
this.http = http;
|
|
44
|
+
this.environment = environment;
|
|
45
|
+
this.accessTokenSubject = new ReplaySubject(1);
|
|
46
|
+
}
|
|
47
|
+
getAccessToken(force = false) {
|
|
48
|
+
if (!this._accessToken || force) {
|
|
49
|
+
this.http.get(`${this.environment.coreLogicUrl}/access/oauth/token?grant_type=client_credentials&client_id=${this.environment.coreLogicId}&client_secret=${this.environment.coreLogicSecret}`)
|
|
50
|
+
.pipe(map((response) => {
|
|
51
|
+
return response.access_token;
|
|
52
|
+
}))
|
|
53
|
+
.subscribe((token) => {
|
|
54
|
+
this._accessToken = token;
|
|
55
|
+
this.accessTokenSubject.next(this._accessToken);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return this.accessTokenSubject.asObservable();
|
|
59
|
+
}
|
|
60
|
+
getSuggestions(query, country = 'au') {
|
|
61
|
+
// @TODO handle different countries in future
|
|
62
|
+
return this.http.get(`${this.environment.coreLogicUrl}/property/${country}/v2/suggest.json?q=${query}`)
|
|
63
|
+
.pipe(map((response) => {
|
|
64
|
+
return response.suggestions.map((item) => plainToClass(CorelogicSuggestion, item));
|
|
65
|
+
}));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
CorelogicService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: CorelogicService, deps: [{ token: i1.HttpClient }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
69
|
+
CorelogicService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: CorelogicService, providedIn: 'root' });
|
|
70
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: CorelogicService, decorators: [{
|
|
71
|
+
type: Injectable,
|
|
72
|
+
args: [{
|
|
73
|
+
providedIn: 'root'
|
|
74
|
+
}]
|
|
75
|
+
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: undefined, decorators: [{
|
|
76
|
+
type: Inject,
|
|
77
|
+
args: ['environment']
|
|
78
|
+
}] }]; } });
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Corelogic interceptor add Core Logic access token for each search requests related with Core Logic API
|
|
82
|
+
*/
|
|
83
|
+
class CorelogicInterceptor {
|
|
84
|
+
constructor(corelogicService, environment) {
|
|
85
|
+
this.corelogicService = corelogicService;
|
|
86
|
+
this.environment = environment;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Check if requested url requested core logic, but not core logic auth api
|
|
90
|
+
* @param req
|
|
91
|
+
*/
|
|
92
|
+
addToken(req) {
|
|
93
|
+
// don't need token for this endpoint
|
|
94
|
+
if (req.url.includes(`${this.environment.coreLogicUrl}/access/oauth/token`)) {
|
|
95
|
+
return req;
|
|
96
|
+
}
|
|
97
|
+
// add core logic token to request headers
|
|
98
|
+
if (req.url.includes(this.environment.coreLogicUrl)) {
|
|
99
|
+
return req.clone({
|
|
100
|
+
setHeaders: {
|
|
101
|
+
Authorization: 'Bearer ' + this.corelogicService._accessToken
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
// return request without changes if url not related with core logic
|
|
106
|
+
return req;
|
|
107
|
+
}
|
|
108
|
+
intercept(request, next) {
|
|
109
|
+
return next.handle(this.addToken(request));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
CorelogicInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: CorelogicInterceptor, deps: [{ token: CorelogicService }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
113
|
+
CorelogicInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: CorelogicInterceptor });
|
|
114
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: CorelogicInterceptor, decorators: [{
|
|
115
|
+
type: Injectable
|
|
116
|
+
}], ctorParameters: function () { return [{ type: CorelogicService }, { type: undefined, decorators: [{
|
|
117
|
+
type: Inject,
|
|
118
|
+
args: ['environment']
|
|
119
|
+
}] }]; } });
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Financial Year interceptor add financialYear parameter to requests because a lot of POST and GET requests require this parameter
|
|
123
|
+
* @TODO now we can get current fin year from user on backend. So we can remove this interceptor
|
|
124
|
+
*/
|
|
125
|
+
class FinancialYearInterceptor {
|
|
126
|
+
intercept(request, next) {
|
|
127
|
+
// Set financial year parameter to requests
|
|
128
|
+
let params = new HttpParams({
|
|
129
|
+
fromString: request.params.toString()
|
|
130
|
+
});
|
|
131
|
+
// clone request to add new parameters
|
|
132
|
+
let clonedReq = request.clone();
|
|
133
|
+
if (!params.get('financialYear')) {
|
|
134
|
+
params = params.set('financialYear', localStorage.getItem('financialYear'));
|
|
135
|
+
clonedReq = request.clone({
|
|
136
|
+
params: params
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
return next.handle(clonedReq);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
FinancialYearInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FinancialYearInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
143
|
+
FinancialYearInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FinancialYearInterceptor });
|
|
144
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FinancialYearInterceptor, decorators: [{
|
|
145
|
+
type: Injectable
|
|
146
|
+
}] });
|
|
147
|
+
|
|
148
|
+
const NAME_TOKEN = 'token';
|
|
149
|
+
const NAME_REFRESH_TOKEN = 'refreshToken';
|
|
150
|
+
class JwtService extends JwtHelperService {
|
|
151
|
+
getToken() {
|
|
152
|
+
return localStorage[NAME_TOKEN];
|
|
153
|
+
}
|
|
154
|
+
getRefreshToken() {
|
|
155
|
+
return localStorage[NAME_REFRESH_TOKEN];
|
|
156
|
+
}
|
|
157
|
+
saveTokens(tokens) {
|
|
158
|
+
localStorage[NAME_TOKEN] = tokens.token;
|
|
159
|
+
localStorage[NAME_REFRESH_TOKEN] = tokens.refreshToken;
|
|
160
|
+
}
|
|
161
|
+
destroyTokens() {
|
|
162
|
+
localStorage.removeItem(NAME_TOKEN);
|
|
163
|
+
localStorage.removeItem(NAME_REFRESH_TOKEN);
|
|
164
|
+
}
|
|
165
|
+
getUser() {
|
|
166
|
+
return this.decodeToken();
|
|
167
|
+
}
|
|
168
|
+
isMe(userId) {
|
|
169
|
+
return this.getUser().id === userId;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
JwtService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: JwtService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
173
|
+
JwtService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: JwtService, providedIn: 'root' });
|
|
174
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: JwtService, decorators: [{
|
|
175
|
+
type: Injectable,
|
|
176
|
+
args: [{
|
|
177
|
+
providedIn: 'root'
|
|
178
|
+
}]
|
|
179
|
+
}] });
|
|
180
|
+
|
|
181
|
+
class AuthService {
|
|
182
|
+
constructor(http, jwtService, environment) {
|
|
183
|
+
this.http = http;
|
|
184
|
+
this.jwtService = jwtService;
|
|
185
|
+
this.environment = environment;
|
|
186
|
+
this.isLoggedInSubject = new BehaviorSubject(!this.jwtService.isTokenExpired());
|
|
187
|
+
}
|
|
188
|
+
setAuth(response) {
|
|
189
|
+
this.jwtService.saveTokens(response);
|
|
190
|
+
this.isLoggedInSubject.next(true);
|
|
191
|
+
}
|
|
192
|
+
login(username, password) {
|
|
193
|
+
return this.http.post(`${this.environment.apiV2}/login_check`, { username, password }).pipe(map((response) => {
|
|
194
|
+
this.setAuth(response);
|
|
195
|
+
return response;
|
|
196
|
+
}));
|
|
197
|
+
}
|
|
198
|
+
refresh(refreshToken) {
|
|
199
|
+
return this.http.post(`${this.environment.apiV2}/token/refresh`, { refreshToken }).pipe(map((response) => {
|
|
200
|
+
this.setAuth(response);
|
|
201
|
+
return response;
|
|
202
|
+
}));
|
|
203
|
+
}
|
|
204
|
+
logoutFront(url = '/login') {
|
|
205
|
+
localStorage.clear();
|
|
206
|
+
location.replace(url);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
AuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AuthService, deps: [{ token: i1.HttpClient }, { token: JwtService }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
210
|
+
AuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AuthService, providedIn: 'root' });
|
|
211
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AuthService, decorators: [{
|
|
212
|
+
type: Injectable,
|
|
213
|
+
args: [{
|
|
214
|
+
providedIn: 'root'
|
|
215
|
+
}]
|
|
216
|
+
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: JwtService }, { type: undefined, decorators: [{
|
|
217
|
+
type: Inject,
|
|
218
|
+
args: ['environment']
|
|
219
|
+
}] }]; } });
|
|
220
|
+
|
|
221
|
+
const MESSAGE_DEFAULT_500_ERROR = 'Unexpected error! Please try again later. You can send us via chat your questions.';
|
|
222
|
+
/**
|
|
223
|
+
* JWT Interceptor add jwt token to each request related with TaxTank API
|
|
224
|
+
*/
|
|
225
|
+
class JwtInterceptor {
|
|
226
|
+
constructor(jwtService, authService, environment) {
|
|
227
|
+
this.jwtService = jwtService;
|
|
228
|
+
this.authService = authService;
|
|
229
|
+
this.environment = environment;
|
|
230
|
+
this.isRefreshingToken = false;
|
|
231
|
+
this.tokenSubject = new BehaviorSubject(null);
|
|
232
|
+
}
|
|
233
|
+
addToken(req) {
|
|
234
|
+
return req.clone({
|
|
235
|
+
setHeaders: { Authorization: 'Bearer ' + this.jwtService.getToken() },
|
|
236
|
+
withCredentials: true
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
intercept(request, next) {
|
|
240
|
+
// skip third party requests
|
|
241
|
+
if (!request.url.includes(this.environment.api_uri)) {
|
|
242
|
+
return next.handle(request);
|
|
243
|
+
}
|
|
244
|
+
// add token to every api request
|
|
245
|
+
return next.handle(this.addToken(request)).pipe(
|
|
246
|
+
// handle errors
|
|
247
|
+
catchError((err) => {
|
|
248
|
+
if (err instanceof HttpErrorResponse) {
|
|
249
|
+
switch (err.status) {
|
|
250
|
+
// unexpected errors
|
|
251
|
+
case 405:
|
|
252
|
+
case 500:
|
|
253
|
+
this.handle500Error();
|
|
254
|
+
break;
|
|
255
|
+
// expected errors
|
|
256
|
+
case 401:
|
|
257
|
+
return this.handle401Error(request, next, err);
|
|
258
|
+
case 400:
|
|
259
|
+
case 403:
|
|
260
|
+
// @TODO in most cases 404 is not an error, handle in components
|
|
261
|
+
// case 404:
|
|
262
|
+
this.showErrorMessages(err);
|
|
263
|
+
break;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
return throwError(err);
|
|
267
|
+
}));
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* @TODO log
|
|
271
|
+
* @TODO waiting for backend to handle errors in a better way
|
|
272
|
+
*/
|
|
273
|
+
handle400Error(err) {
|
|
274
|
+
// this.snackBar.open(err.error['hydra:description'], '', {
|
|
275
|
+
// panelClass: 'error'
|
|
276
|
+
// });
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* @TODO log
|
|
280
|
+
* @TODO waiting for backend to handle errors in a better way
|
|
281
|
+
*/
|
|
282
|
+
handle403Error(err) {
|
|
283
|
+
// this.snackBar.open(err.error['hydra:description'], '', {
|
|
284
|
+
// panelClass: 'error'
|
|
285
|
+
// });
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* @TODO log
|
|
289
|
+
*/
|
|
290
|
+
handle500Error() {
|
|
291
|
+
// this.snackBar.open(MESSAGE_DEFAULT_500_ERROR, '', {
|
|
292
|
+
// panelClass: 'error'
|
|
293
|
+
// });
|
|
294
|
+
}
|
|
295
|
+
handle401Error(req, next, err) {
|
|
296
|
+
if (req.url.includes('token/refresh') || req.url.includes('login')) {
|
|
297
|
+
if (req.url.includes('token/refresh')) {
|
|
298
|
+
this.authService.logoutFront();
|
|
299
|
+
}
|
|
300
|
+
return throwError(err);
|
|
301
|
+
}
|
|
302
|
+
// refreshing token, wait until it's done and retry the request
|
|
303
|
+
if (this.isRefreshingToken) {
|
|
304
|
+
return this.tokenSubject.pipe(filter(token => token != null), take(1), switchMap(token => next.handle(this.addToken(req))));
|
|
305
|
+
// refresh token
|
|
306
|
+
}
|
|
307
|
+
else {
|
|
308
|
+
// subsequent requests should wait until refresh token is ready
|
|
309
|
+
this.isRefreshingToken = true;
|
|
310
|
+
this.tokenSubject.next(null);
|
|
311
|
+
return this.authService.refresh(this.jwtService.getRefreshToken()).pipe(switchMap((tokens) => {
|
|
312
|
+
this.tokenSubject.next(tokens.token);
|
|
313
|
+
return next.handle(this.addToken(req));
|
|
314
|
+
}), catchError(() => {
|
|
315
|
+
this.authService.logoutFront();
|
|
316
|
+
return throwError(err);
|
|
317
|
+
}), finalize(() => {
|
|
318
|
+
this.isRefreshingToken = false;
|
|
319
|
+
}));
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Handle error messages
|
|
324
|
+
* @param errorResponse from which messages should be taken
|
|
325
|
+
*
|
|
326
|
+
* @TODO move to separated interceptor
|
|
327
|
+
*/
|
|
328
|
+
showErrorMessages(errorResponse) {
|
|
329
|
+
if (!errorResponse.error.violations) {
|
|
330
|
+
// this.snackBar.open('Something went wrong', '', {
|
|
331
|
+
// panelClass: 'error'
|
|
332
|
+
// });
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
errorResponse.error.violations.forEach((violation) => {
|
|
336
|
+
// this.snackBar.open(violation['message'], '', {
|
|
337
|
+
// panelClass: 'error'
|
|
338
|
+
// });
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
JwtInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: JwtInterceptor, deps: [{ token: JwtService }, { token: AuthService }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
343
|
+
JwtInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: JwtInterceptor });
|
|
344
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: JwtInterceptor, decorators: [{
|
|
345
|
+
type: Injectable
|
|
346
|
+
}], ctorParameters: function () { return [{ type: JwtService }, { type: AuthService }, { type: undefined, decorators: [{
|
|
347
|
+
type: Inject,
|
|
348
|
+
args: ['environment']
|
|
349
|
+
}] }]; } });
|
|
350
|
+
|
|
351
|
+
const KEY = '_switch_user';
|
|
352
|
+
/**
|
|
353
|
+
* provides user management to managers (users with ROLE_ACCOUNTANT for now, more in future)
|
|
354
|
+
*/
|
|
355
|
+
class UserSwitcherService {
|
|
356
|
+
/**
|
|
357
|
+
* get switched username
|
|
358
|
+
*/
|
|
359
|
+
get() {
|
|
360
|
+
return localStorage[KEY];
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* switch to user (username should be used for correct work of backend)
|
|
364
|
+
*/
|
|
365
|
+
set(username) {
|
|
366
|
+
localStorage[KEY] = username;
|
|
367
|
+
window.location.replace('/client/dashboard');
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* go back to original user
|
|
371
|
+
*/
|
|
372
|
+
reset() {
|
|
373
|
+
localStorage.removeItem(KEY);
|
|
374
|
+
window.location.replace('/firm/dashboard');
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
UserSwitcherService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: UserSwitcherService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
378
|
+
UserSwitcherService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: UserSwitcherService, providedIn: 'root' });
|
|
379
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: UserSwitcherService, decorators: [{
|
|
380
|
+
type: Injectable,
|
|
381
|
+
args: [{
|
|
382
|
+
providedIn: 'root'
|
|
383
|
+
}]
|
|
384
|
+
}] });
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* Impersonate current's user (manager) to client experience with help of special header
|
|
388
|
+
*/
|
|
389
|
+
class UserSwitcherInterceptor {
|
|
390
|
+
constructor(userSwitcherService, environment) {
|
|
391
|
+
this.userSwitcherService = userSwitcherService;
|
|
392
|
+
this.environment = environment;
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* add token header if request url contain TaxTank API URL
|
|
396
|
+
*/
|
|
397
|
+
switch(req, username) {
|
|
398
|
+
// skip third party api requests
|
|
399
|
+
if (!req.url.includes(this.environment.api_uri) || !username) {
|
|
400
|
+
return req;
|
|
401
|
+
}
|
|
402
|
+
const params = new HttpParams({ fromString: req.params.toString() }).set('_switch_user', username);
|
|
403
|
+
return req.clone({ params });
|
|
404
|
+
// @TODO move to header solution when backend can support it
|
|
405
|
+
// return req.clone({
|
|
406
|
+
// setHeaders: {
|
|
407
|
+
// HTTP_X_SWITCH_USER: username
|
|
408
|
+
// }
|
|
409
|
+
// });
|
|
410
|
+
}
|
|
411
|
+
intercept(request, next) {
|
|
412
|
+
return next.handle(this.switch(request, this.userSwitcherService.get()));
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
UserSwitcherInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: UserSwitcherInterceptor, deps: [{ token: UserSwitcherService }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
416
|
+
UserSwitcherInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: UserSwitcherInterceptor });
|
|
417
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: UserSwitcherInterceptor, decorators: [{
|
|
418
|
+
type: Injectable
|
|
419
|
+
}], ctorParameters: function () { return [{ type: UserSwitcherService }, { type: undefined, decorators: [{
|
|
420
|
+
type: Inject,
|
|
421
|
+
args: ['environment']
|
|
422
|
+
}] }]; } });
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* Backend endpoint class
|
|
426
|
+
*/
|
|
427
|
+
class Endpoint {
|
|
428
|
+
constructor(method, pattern) {
|
|
429
|
+
this.method = method;
|
|
430
|
+
this.pattern = pattern;
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* check url with regexp
|
|
434
|
+
* @param url
|
|
435
|
+
*/
|
|
436
|
+
test(url) {
|
|
437
|
+
return this.regexp.test(url);
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Get regexp for endpoint
|
|
441
|
+
*/
|
|
442
|
+
get regexp() {
|
|
443
|
+
return new RegExp(`^${this.method} \.\*${this.pattern}$`);
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* List of all app endpoints
|
|
449
|
+
*/
|
|
450
|
+
const ENDPOINTS = {
|
|
451
|
+
ASSETS_GET: new Endpoint('GET', '\\/assets\\/\.\*\\/\\d+'),
|
|
452
|
+
BANK_ACCOUNTS_GET: new Endpoint('GET', '\\/bank-accounts'),
|
|
453
|
+
BANK_ACCOUNTS_POST: new Endpoint('POST', '\\/bank-accounts'),
|
|
454
|
+
BANK_ACCOUNTS_PUT: new Endpoint('PUT', '\\/bank-accounts\\/\\d+'),
|
|
455
|
+
BANK_CONNECTION_POST: new Endpoint('POST', '\\/bank-connections'),
|
|
456
|
+
BANK_TRANSACTIONS_GET: new Endpoint('GET', '\\/bank-transactions'),
|
|
457
|
+
BANK_TRANSACTIONS_DELETE: new Endpoint('DELETE', '\\/bank-transactions\\/\\d+'),
|
|
458
|
+
BANK_TRANSACTIONS_IMPORT_POST: new Endpoint('POST', '\\/bank-transactions\\/\\d+\\/import'),
|
|
459
|
+
BASIQ_ACCOUNTS_GET: new Endpoint('GET', '\\/basiq\\/\\accounts'),
|
|
460
|
+
CAPITAL_COSTS_GET: new Endpoint('GET', '\\/capital-costs'),
|
|
461
|
+
CHARTS_INCOME_GET: new Endpoint('GET', '\\/charts\\/\\incomes'),
|
|
462
|
+
CHARTS_EXPENSES_GET: new Endpoint('GET', '\\/charts\\/\\expenses'),
|
|
463
|
+
CHART_ACCOUNTS_GET: new Endpoint('GET', '\\/chart-accounts'),
|
|
464
|
+
CLIENTS_GET: new Endpoint('GET', '\\/clients'),
|
|
465
|
+
CLIENTS_PUT: new Endpoint('PUT', '\\/clients'),
|
|
466
|
+
CLIENTS_EXCLUDE_PUT: new Endpoint('PUT', '\\/clients\\/\\d+\\/exclude'),
|
|
467
|
+
CLIENTS_INVITES_GET: new Endpoint('GET', '\\/clients\\/\\invites'),
|
|
468
|
+
CLIENTS_INVITES_POST: new Endpoint('POST', '\\/clients\\/\\invites'),
|
|
469
|
+
CLIENTS_INVITES_DELETE: new Endpoint('DELETE', '\\/clients\\/\\invites\\/\\d+'),
|
|
470
|
+
CLIENTS_INVITES_ACCEPT_POST: new Endpoint('POST', '\\/clients\\/\\invites\\/\\d+\\/accept'),
|
|
471
|
+
CLIENTS_INVITES_REJECT_POST: new Endpoint('POST', '\\/clients\\/\\invites\\/\\d+\\/reject'),
|
|
472
|
+
CLIENTS_INVITES_RESEND_POST: new Endpoint('POST', '\\/clients\\/\\invites\\/\\d+\\/resend'),
|
|
473
|
+
CLIENT_MOVEMENTS_GET: new Endpoint('GET', '\\/client-movements'),
|
|
474
|
+
CLIENT_MOVEMENTS_POST: new Endpoint('POST', '\\/client-movements'),
|
|
475
|
+
COUNTRIES_GET: new Endpoint('GET', '\\/countries'),
|
|
476
|
+
DEPRECIATIONS_CLOSING_GET: new Endpoint('GET', '\\/depreciations\\/\\closing-balance\.\*'),
|
|
477
|
+
DEPRECIATIONS_GET: new Endpoint('GET', '\\/depreciations'),
|
|
478
|
+
DEPRECIATIONS_POST: new Endpoint('POST', '\\/depreciations'),
|
|
479
|
+
DEPRECIATIONS_PUT: new Endpoint('PUT', '\\/depreciations\\/\\d+'),
|
|
480
|
+
EMPLOYEES_GET: new Endpoint('GET', '\\/employees'),
|
|
481
|
+
EMPLOYEES_INVITES_GET: new Endpoint('GET', '\\/employees\\/\\invites'),
|
|
482
|
+
EMPLOYEES_INVITES_DELETE: new Endpoint('DELETE', '\\/employees\\/\\invites\\/\\d+'),
|
|
483
|
+
EMPLOYEES_INVITE_POST: new Endpoint('POST', '\\/employees\\/\\invites'),
|
|
484
|
+
EMPLOYEES_INVITES_REJECT_POST: new Endpoint('POST', '\\/employees\\/\\invites\\/\\d+\\/\\reject'),
|
|
485
|
+
EMPLOYEES_INVITES_RESEND_POST: new Endpoint('POST', '\\/employees\\/\\invites\\/\\d+\\/\\resend'),
|
|
486
|
+
FIRM_GET: new Endpoint('GET', '\\/firms'),
|
|
487
|
+
FIRM_CURRENT_GET: new Endpoint('GET', '\\/firms\\/current'),
|
|
488
|
+
FIRM_CURRENT_PUT: new Endpoint('PUT', '\\/firms\\/current\.\*'),
|
|
489
|
+
FIRM_INVITE_POST: new Endpoint('POST', '\\/firms\\/invite'),
|
|
490
|
+
FIRM_REGISTRATION_POST: new Endpoint('POST', '\\/firms\\/registration'),
|
|
491
|
+
FIRM_UPDATE_PHOTO_POST: new Endpoint('POST', '\\/firms\\/photo\.\*'),
|
|
492
|
+
FOLDERS_GET: new Endpoint('GET', '\\/folders'),
|
|
493
|
+
FOLDERS_POST: new Endpoint('POST', '\\/folders'),
|
|
494
|
+
FOLDERS_PUT: new Endpoint('PUT', '\\/folders\\/\\d+'),
|
|
495
|
+
FOLDERS_DOCUMENTS_POST: new Endpoint('POST', '\\/folders\\/\\d+\\/documents'),
|
|
496
|
+
FOLDERS_DOCUMENTS_PUT: new Endpoint('PUT', '\\/folders\\/\\d+\\/documents\\/\\d+'),
|
|
497
|
+
INCOME_SOURCES_GET: new Endpoint('GET', '\\/income-sources'),
|
|
498
|
+
INCOME_SOURCES_POST: new Endpoint('POST', '\\/income-sources'),
|
|
499
|
+
INCOME_SOURCES_PUT: new Endpoint('PUT', '\\/income-sources'),
|
|
500
|
+
INCOME_SOURCES_DELETE: new Endpoint('DELETE', '\\/income-sources\\/\\d+'),
|
|
501
|
+
INCOME_SOURCE_FORECAST_GET: new Endpoint('GET', '\\/income-source-forecasts'),
|
|
502
|
+
INCOME_SOURCE_FORECAST_POST: new Endpoint('POST', '\\/income-source-forecasts'),
|
|
503
|
+
INCOME_SOURCE_FORECAST_PUT: new Endpoint('PUT', '\\/income-source-forecasts'),
|
|
504
|
+
INCOME_SOURCE_FORECAST_DELETE: new Endpoint('DELETE', '\\/income-source-forecasts\\/\\d+'),
|
|
505
|
+
INCOME_SOURCE_TYPES_GET: new Endpoint('GET', '\\/income-source-types'),
|
|
506
|
+
LOANS_GET: new Endpoint('GET', '\\/bank-accounts\\/loans'),
|
|
507
|
+
LOANS_POST: new Endpoint('POST', '\\/bank-accounts\\/loans'),
|
|
508
|
+
LOANS_PUT: new Endpoint('PUT', '\\/bank-accounts\\/loans/\\d+'),
|
|
509
|
+
LOANS_PAYOUT_POST: new Endpoint('POST', '\\/loans\\/\\d+\\/payout'),
|
|
510
|
+
LOANS_PAYOUT_PUT: new Endpoint('PUT', '\\/loans\\/\\d+\\/payout\\/\\d+'),
|
|
511
|
+
LOANS_PAYOUT_DELETE: new Endpoint('DELETE', '\\/loans\\/\\d+\\/payout\\/\\d+'),
|
|
512
|
+
LOANS_CALCULATION_POST: new Endpoint('POST', '\\/bank-accounts\\/loans\\/calculation'),
|
|
513
|
+
LOGIN_CHECK_POST: new Endpoint('POST', '\\/login_check'),
|
|
514
|
+
NOTIFICATIONS_GET: new Endpoint('GET', '\\/service-notifications'),
|
|
515
|
+
OCCUPATIONS_GET: new Endpoint('GET', '\\/occupations'),
|
|
516
|
+
PROPERTIES_GET: new Endpoint('GET', '\\/properties'),
|
|
517
|
+
PROPERTIES_POST: new Endpoint('POST', '\\/properties'),
|
|
518
|
+
PROPERTY_PUT: new Endpoint('PUT', '\\/properties/\\d+'),
|
|
519
|
+
PROPERTIES_PUT: new Endpoint('PUT', '\\/properties'),
|
|
520
|
+
PROPERTIES_CATEGORIES_EQUITY_GET: new Endpoint('GET', '\\/properties\\/categories\\/equity'),
|
|
521
|
+
PROPERTIES_CATEGORIES_GET: new Endpoint('GET', '\\/properties\\/categories'),
|
|
522
|
+
PROPERTIES_CATEGORIES_PUT: new Endpoint('PUT', '\\/properties\\/categories\\/\\d+'),
|
|
523
|
+
PROPERTIES_CATEGORIES_POST: new Endpoint('POST', '\\/properties\\/categories'),
|
|
524
|
+
PROPERTIES_CATEGORY_MOVEMENTS_POST: new Endpoint('POST', '\\/properties\\/\\d+\\/category-movements'),
|
|
525
|
+
PROPERTIES_CATEGORY_MOVEMENTS_PUT: new Endpoint('PUT', '\\/properties\\/\\d+\\/category-movements\\/\\d+'),
|
|
526
|
+
PROPERTIES_CO_OWNERS_PUT: new Endpoint('PUT', '\\/properties\\/co-owners\\/\\d+'),
|
|
527
|
+
PROPERTIES_CO_OWNERS_GET: new Endpoint('GET', '\\/properties\\/co-owners'),
|
|
528
|
+
PROPERTIES_CO_OWNERS_POST: new Endpoint('POST', '\\/properties\\/co-owners'),
|
|
529
|
+
PROPERTIES_DEACTIVATE_PUT: new Endpoint('PUT', '\\/properties\\/\\d+\\/deactivate'),
|
|
530
|
+
PROPERTIES_DEPRECIATION_CAPITAL_PROJECT_GET: new Endpoint('GET', '\\/properties\\/\\d+\\/depreciation-capital-projects'),
|
|
531
|
+
PROPERTIES_DEPRECIATION_CAPITAL_PROJECT_POST: new Endpoint('POST', '\\/properties\\/\\d+\\/depreciation-capital-projects'),
|
|
532
|
+
PROPERTIES_DEPRECIATION_CAPITAL_PROJECT_PUT: new Endpoint('PUT', '\\/properties\\/\\d+\\/depreciation-capital-projects\\/\\d+'),
|
|
533
|
+
PROPERTIES_DEPRECIATION_CAPITAL_PROJECT_DELETE: new Endpoint('DELETE', '\\/properties\\/\\d+\\/depreciation-capital-projects\\/\\d+'),
|
|
534
|
+
PROPERTIES_DOCUMENTS_GET: new Endpoint('GET', '\\/properties\\/documents'),
|
|
535
|
+
PROPERTIES_DOCUMENTS_POST: new Endpoint('POST', '\\/properties\\/\\d+\\/documents'),
|
|
536
|
+
PROPERTIES_DOCUMENTS_PUT: new Endpoint('PUT', '\\/properties\\/documents\\/\\d+'),
|
|
537
|
+
PROPERTIES_DOCUMENTS_DELETE: new Endpoint('DELETE', '\\/properties\\/documents\\/\\d+'),
|
|
538
|
+
PROPERTIES_PHOTO_POST: new Endpoint('POST', '\\/properties\\/\\d+\\/photo\.\*'),
|
|
539
|
+
PROPERTIES_SUGGESTIONS_GET: new Endpoint('GET', '/property\\/\\w+\\/v2\\/.*$'),
|
|
540
|
+
PROPERTIES_VALUATIONS_DOCUMENTS_POST: new Endpoint('POST', '\\/properties\\/\\d+\\/valuations\\/\\d+\\/documents'),
|
|
541
|
+
PRORATION_COST_POST: new Endpoint('POST', '\\/subscriptions\\/proration-cost'),
|
|
542
|
+
SALARY_FORECAST_GET: new Endpoint('GET', '\\/salary-forecasts'),
|
|
543
|
+
SALARY_FORECAST_POST: new Endpoint('POST', '\\/salary-forecasts'),
|
|
544
|
+
SALARY_FORECAST_PUT: new Endpoint('PUT', '\\/salary-forecasts'),
|
|
545
|
+
SERVICE_PRICES_GET: new Endpoint('GET', '\\/service-prices'),
|
|
546
|
+
SERVICE_PAYMENTS_GET: new Endpoint('GET', '\\/service-payments'),
|
|
547
|
+
STRIPE_BILLING_PORTAL_GET: new Endpoint('GET', '\\/stripe\\/billing-portal-session'),
|
|
548
|
+
STRIPE_CHECKOUT_SESSION_POST: new Endpoint('POST', '\\/stripe\\/checkout-session'),
|
|
549
|
+
SUBSCRIPTION_LAST_GET: new Endpoint('GET', '\\/subscriptions\\/last'),
|
|
550
|
+
SUBSCRIPTION_ITEMS_PUT: new Endpoint('PUT', '\\/subscriptions\\/items'),
|
|
551
|
+
TAX_CALCULATION_POST: new Endpoint('POST', '\\/tax-calculation'),
|
|
552
|
+
TAX_REVIEWS_GET: new Endpoint('GET', '\\/tax-reviews'),
|
|
553
|
+
TAX_REVIEWS_DELETE: new Endpoint('DELETE', '\\/tax-reviews\\/\\d+'),
|
|
554
|
+
TAX_REVIEWS_POST: new Endpoint('POST', '\\/tax-reviews'),
|
|
555
|
+
TAX_REVIEWS_PUT: new Endpoint('PUT', '\\/tax-reviews\\/\\d+'),
|
|
556
|
+
TAX_SUMMARY_ACTUAL_GET: new Endpoint('GET', '\\/tax-summary\\/actuals'),
|
|
557
|
+
TAX_SUMMARY_FORECAST_GET: new Endpoint('GET', '\\/tax-summary\\/forecasts'),
|
|
558
|
+
TRANSACTION_DELETE: new Endpoint('DELETE', '\\/transactions\\/\\d+'),
|
|
559
|
+
TRANSACTION_PUT: new Endpoint('PUT', '\\/transactions\\/\\d+'),
|
|
560
|
+
TRANSACTIONS_GET: new Endpoint('GET', '\\/transactions'),
|
|
561
|
+
TRANSACTIONS_POST: new Endpoint('POST', '\\/transactions'),
|
|
562
|
+
TRANSACTIONS_PUT: new Endpoint('PUT', '\\/transactions'),
|
|
563
|
+
TRANSACTIONS_ALLOCATIONS_GET: new Endpoint('GET', '\\/transactions-allocations'),
|
|
564
|
+
TRANSACTIONS_ALLOCATIONS_POST: new Endpoint('POST', '\\/transactions-allocations'),
|
|
565
|
+
TRANSACTIONS_ALLOCATIONS_DELETE: new Endpoint('DELETE', '\\/transactions-allocations\\/\\d+'),
|
|
566
|
+
USER_CONFIRMATION_POST: new Endpoint('POST', '\\/users\\/confirmation'),
|
|
567
|
+
USER_CURRENT_GET: new Endpoint('GET', '\\/users\\/current'),
|
|
568
|
+
USER_CURRENT_PASSWORD_PUT: new Endpoint('PUT', '\\/users\\/current\\/password\.\*'),
|
|
569
|
+
USER_EVENT_SETTINGS_GET: new Endpoint('GET', '\\/user-event-settings'),
|
|
570
|
+
USER_EVENT_TYPES_GET: new Endpoint('GET', '\\/user-event-types'),
|
|
571
|
+
USER_INVITE_DELETE: new Endpoint('DELETE', '\\/users\\/invite\\/\\d+'),
|
|
572
|
+
USER_INVITE_POST: new Endpoint('POST', '\\/users\\/invite'),
|
|
573
|
+
USER_INVITE_RESEND_POST: new Endpoint('POST', '\\/users\\/invite/\\d+\\/resend'),
|
|
574
|
+
USER_PUT: new Endpoint('PUT', '\\/users\\/\\d+'),
|
|
575
|
+
USER_REGISTRATION_POST: new Endpoint('POST', '\\/users\\/registration'),
|
|
576
|
+
USER_RESET_PASSWORD_PUT: new Endpoint('PUT', '\\/users\\/reset-password'),
|
|
577
|
+
USER_SEARCH_GET: new Endpoint('GET', '\\/users\\/search\.\*'),
|
|
578
|
+
USER_UPDATE_PHOTO_POST: new Endpoint('POST', '\\/users\\/photo\.\*'),
|
|
579
|
+
USER_STATUS_PUT: new Endpoint('PUT', '\\/users\\/status'),
|
|
580
|
+
VEHICLES_GET: new Endpoint('GET', '\\/vehicles'),
|
|
581
|
+
VEHICLES_POST: new Endpoint('POST', '\\/vehicles'),
|
|
582
|
+
VEHICLES_PUT: new Endpoint('PUT', '\\/vehicles\\/\\d+'),
|
|
583
|
+
VEHICLE_CLAIMS_GET: new Endpoint('GET', '\\/vehicle-claims'),
|
|
584
|
+
VEHICLE_CLAIMS_POST: new Endpoint('POST', '\\/vehicle-claims'),
|
|
585
|
+
VEHICLE_LOGBOOK_POST: new Endpoint('POST', '\\/vehicles\\/\\d+\\/logbooks'),
|
|
586
|
+
VEHICLE_LOGBOOK_PUT: new Endpoint('PUT', '\\/vehicles\\/\\d+\\/logbooks\\/\\d+'),
|
|
587
|
+
VEHICLE_CLAIMS_PUT: new Endpoint('PUT', '\\/vehicle-claims\\/\\d+')
|
|
588
|
+
};
|
|
589
|
+
|
|
590
|
+
class PreloaderService {
|
|
591
|
+
constructor() {
|
|
592
|
+
this.activePreloaders = new BehaviorSubject([]);
|
|
593
|
+
}
|
|
594
|
+
get() {
|
|
595
|
+
return this.activePreloaders.asObservable();
|
|
596
|
+
}
|
|
597
|
+
add(endpoint) {
|
|
598
|
+
const activePreloaders = this.activePreloaders.getValue();
|
|
599
|
+
activePreloaders.push(endpoint);
|
|
600
|
+
this.activePreloaders.next(activePreloaders);
|
|
601
|
+
}
|
|
602
|
+
delete(endpoint) {
|
|
603
|
+
let activePreloaders = this.activePreloaders.getValue();
|
|
604
|
+
activePreloaders = activePreloaders.filter((preloader) => preloader !== endpoint);
|
|
605
|
+
this.activePreloaders.next(activePreloaders);
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
PreloaderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PreloaderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
609
|
+
PreloaderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PreloaderService, providedIn: 'root' });
|
|
610
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PreloaderService, decorators: [{
|
|
611
|
+
type: Injectable,
|
|
612
|
+
args: [{
|
|
613
|
+
providedIn: 'root'
|
|
614
|
+
}]
|
|
615
|
+
}], ctorParameters: function () { return []; } });
|
|
616
|
+
|
|
617
|
+
/**
|
|
618
|
+
* interceptor for preloader handling
|
|
619
|
+
*/
|
|
620
|
+
class PreloaderInterceptor {
|
|
621
|
+
constructor(preloaderService) {
|
|
622
|
+
this.preloaderService = preloaderService;
|
|
623
|
+
}
|
|
624
|
+
intercept(request, next) {
|
|
625
|
+
const endpoint = this.findEndpoint(`${request.method} ${request.url}`);
|
|
626
|
+
if (!!endpoint) {
|
|
627
|
+
this.preloaderService.add(endpoint);
|
|
628
|
+
return next.handle(request).pipe(finalize(() => {
|
|
629
|
+
this.preloaderService.delete(endpoint);
|
|
630
|
+
}));
|
|
631
|
+
}
|
|
632
|
+
return next.handle(request);
|
|
633
|
+
}
|
|
634
|
+
findEndpoint(requestPath) {
|
|
635
|
+
return Object.values(ENDPOINTS).find((endpoint) => endpoint.test(requestPath));
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
PreloaderInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PreloaderInterceptor, deps: [{ token: PreloaderService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
639
|
+
PreloaderInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PreloaderInterceptor });
|
|
640
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PreloaderInterceptor, decorators: [{
|
|
641
|
+
type: Injectable
|
|
642
|
+
}], ctorParameters: function () { return [{ type: PreloaderService }]; } });
|
|
643
|
+
|
|
644
|
+
class InterceptorsModule {
|
|
645
|
+
}
|
|
646
|
+
InterceptorsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: InterceptorsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
647
|
+
InterceptorsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: InterceptorsModule });
|
|
648
|
+
InterceptorsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: InterceptorsModule, providers: [
|
|
649
|
+
{
|
|
650
|
+
provide: HTTP_INTERCEPTORS,
|
|
651
|
+
useClass: CorelogicInterceptor,
|
|
652
|
+
multi: true
|
|
653
|
+
},
|
|
654
|
+
// @TODO move to user module
|
|
655
|
+
{
|
|
656
|
+
provide: HTTP_INTERCEPTORS,
|
|
657
|
+
useClass: FinancialYearInterceptor,
|
|
658
|
+
multi: true
|
|
659
|
+
},
|
|
660
|
+
{
|
|
661
|
+
provide: HTTP_INTERCEPTORS,
|
|
662
|
+
useClass: JwtInterceptor,
|
|
663
|
+
multi: true
|
|
664
|
+
},
|
|
665
|
+
{
|
|
666
|
+
provide: HTTP_INTERCEPTORS,
|
|
667
|
+
useClass: UserSwitcherInterceptor,
|
|
668
|
+
multi: true
|
|
669
|
+
},
|
|
670
|
+
{
|
|
671
|
+
provide: HTTP_INTERCEPTORS,
|
|
672
|
+
useClass: PreloaderInterceptor,
|
|
673
|
+
multi: true
|
|
674
|
+
}
|
|
675
|
+
] });
|
|
676
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: InterceptorsModule, decorators: [{
|
|
677
|
+
type: NgModule,
|
|
678
|
+
args: [{
|
|
679
|
+
providers: [
|
|
680
|
+
{
|
|
681
|
+
provide: HTTP_INTERCEPTORS,
|
|
682
|
+
useClass: CorelogicInterceptor,
|
|
683
|
+
multi: true
|
|
684
|
+
},
|
|
685
|
+
// @TODO move to user module
|
|
686
|
+
{
|
|
687
|
+
provide: HTTP_INTERCEPTORS,
|
|
688
|
+
useClass: FinancialYearInterceptor,
|
|
689
|
+
multi: true
|
|
690
|
+
},
|
|
691
|
+
{
|
|
692
|
+
provide: HTTP_INTERCEPTORS,
|
|
693
|
+
useClass: JwtInterceptor,
|
|
694
|
+
multi: true
|
|
695
|
+
},
|
|
696
|
+
{
|
|
697
|
+
provide: HTTP_INTERCEPTORS,
|
|
698
|
+
useClass: UserSwitcherInterceptor,
|
|
699
|
+
multi: true
|
|
700
|
+
},
|
|
701
|
+
{
|
|
702
|
+
provide: HTTP_INTERCEPTORS,
|
|
703
|
+
useClass: PreloaderInterceptor,
|
|
704
|
+
multi: true
|
|
705
|
+
}
|
|
706
|
+
]
|
|
707
|
+
}]
|
|
708
|
+
}] });
|
|
709
|
+
|
|
33
710
|
class TtCoreModule {
|
|
34
711
|
static forRoot(environment) {
|
|
35
712
|
localStorage.setItem('api_uri', environment['api_uri']);
|
|
@@ -45,16 +722,19 @@ class TtCoreModule {
|
|
|
45
722
|
}
|
|
46
723
|
}
|
|
47
724
|
TtCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TtCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
48
|
-
TtCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TtCoreModule, imports: [CommonModule
|
|
725
|
+
TtCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TtCoreModule, imports: [CommonModule,
|
|
726
|
+
InterceptorsModule] });
|
|
49
727
|
TtCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TtCoreModule, imports: [[
|
|
50
|
-
CommonModule
|
|
728
|
+
CommonModule,
|
|
729
|
+
InterceptorsModule
|
|
51
730
|
]] });
|
|
52
731
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TtCoreModule, decorators: [{
|
|
53
732
|
type: NgModule,
|
|
54
733
|
args: [{
|
|
55
734
|
declarations: [],
|
|
56
735
|
imports: [
|
|
57
|
-
CommonModule
|
|
736
|
+
CommonModule,
|
|
737
|
+
InterceptorsModule
|
|
58
738
|
]
|
|
59
739
|
}]
|
|
60
740
|
}] });
|
|
@@ -144,9 +824,9 @@ class CollectionDictionary {
|
|
|
144
824
|
|
|
145
825
|
const DEFAULT_INDEX = 'other';
|
|
146
826
|
/**
|
|
147
|
-
* collection
|
|
827
|
+
* Base collection class. Contains common properties and methods for all collections
|
|
148
828
|
*/
|
|
149
|
-
class
|
|
829
|
+
class Collection {
|
|
150
830
|
constructor(items = []) {
|
|
151
831
|
this.items = items;
|
|
152
832
|
}
|
|
@@ -180,14 +860,6 @@ class AbstractCollection {
|
|
|
180
860
|
get length() {
|
|
181
861
|
return this.items.length;
|
|
182
862
|
}
|
|
183
|
-
/**
|
|
184
|
-
* method returns amount of fields from passed items
|
|
185
|
-
* @param field Name of field for calculation
|
|
186
|
-
* @param items (optional) Array of items need to be calculated. All collection's items by default
|
|
187
|
-
*/
|
|
188
|
-
getSummary(field, items = this.toArray()) {
|
|
189
|
-
return items.reduce((sum, item) => sum += item[field], 0);
|
|
190
|
-
}
|
|
191
863
|
/**
|
|
192
864
|
* Get list of items ids
|
|
193
865
|
*/
|
|
@@ -242,7 +914,7 @@ const TYPE_LOAN = [
|
|
|
242
914
|
/**
|
|
243
915
|
* Collection of bank accounts.
|
|
244
916
|
*/
|
|
245
|
-
class BankAccountCollection extends
|
|
917
|
+
class BankAccountCollection extends Collection {
|
|
246
918
|
/**
|
|
247
919
|
* get list of bank accounts with passed types
|
|
248
920
|
*/
|
|
@@ -386,7 +1058,7 @@ const TRANSACTION_TRANSFER_DELAY = 96 * 3600 * 1000;
|
|
|
386
1058
|
* @TODO find way to accept interface with allocation instead of bankTransaction to prevent wrong usage
|
|
387
1059
|
* because all amounts calculates with allocated amounts but not from bank transactions amounts.
|
|
388
1060
|
*/
|
|
389
|
-
class BankTransactionCollection extends
|
|
1061
|
+
class BankTransactionCollection extends Collection {
|
|
390
1062
|
getAmount() {
|
|
391
1063
|
return this.sumBy('amount');
|
|
392
1064
|
}
|
|
@@ -492,7 +1164,7 @@ class BankTransactionCollection extends AbstractCollection {
|
|
|
492
1164
|
}
|
|
493
1165
|
}
|
|
494
1166
|
|
|
495
|
-
class ClientCollection extends
|
|
1167
|
+
class ClientCollection extends Collection {
|
|
496
1168
|
}
|
|
497
1169
|
|
|
498
1170
|
var FirmTypeEnum;
|
|
@@ -501,7 +1173,7 @@ var FirmTypeEnum;
|
|
|
501
1173
|
FirmTypeEnum[FirmTypeEnum["ADVISOR"] = 2] = "ADVISOR";
|
|
502
1174
|
})(FirmTypeEnum || (FirmTypeEnum = {}));
|
|
503
1175
|
|
|
504
|
-
class EmployeeCollection extends
|
|
1176
|
+
class EmployeeCollection extends Collection {
|
|
505
1177
|
get accountant() {
|
|
506
1178
|
var _a;
|
|
507
1179
|
return (_a = this.items.filter((user) => user.employeeDetails.firm.type === FirmTypeEnum.ACCOUNTANT)[0]) !== null && _a !== void 0 ? _a : null;
|
|
@@ -514,7 +1186,7 @@ class EmployeeCollection extends AbstractCollection {
|
|
|
514
1186
|
/**
|
|
515
1187
|
* Collection of tax review
|
|
516
1188
|
*/
|
|
517
|
-
class ClientMovementCollection extends
|
|
1189
|
+
class ClientMovementCollection extends Collection {
|
|
518
1190
|
get active() {
|
|
519
1191
|
return new ClientMovementCollection(this.items.filter((clientMovement) => !clientMovement.dateTo));
|
|
520
1192
|
}
|
|
@@ -542,7 +1214,7 @@ class ClientMovementCollection extends AbstractCollection {
|
|
|
542
1214
|
/**
|
|
543
1215
|
* Collection of employee clients tax summary information
|
|
544
1216
|
*/
|
|
545
|
-
class ClientPortfolioReportCollection extends
|
|
1217
|
+
class ClientPortfolioReportCollection extends Collection {
|
|
546
1218
|
get marketValue() {
|
|
547
1219
|
return this.sumBy('marketValue');
|
|
548
1220
|
}
|
|
@@ -585,7 +1257,7 @@ var TankTypeEnum;
|
|
|
585
1257
|
TankTypeEnum[TankTypeEnum["OTHER"] = 3] = "OTHER";
|
|
586
1258
|
})(TankTypeEnum || (TankTypeEnum = {}));
|
|
587
1259
|
|
|
588
|
-
class DepreciationCollection extends
|
|
1260
|
+
class DepreciationCollection extends Collection {
|
|
589
1261
|
/**
|
|
590
1262
|
* Get total amount of all depreciations in the collection
|
|
591
1263
|
*/
|
|
@@ -651,7 +1323,7 @@ class DepreciationCollection extends AbstractCollection {
|
|
|
651
1323
|
/**
|
|
652
1324
|
* Collection of depreciations
|
|
653
1325
|
*/
|
|
654
|
-
class DepreciationForecastCollection extends
|
|
1326
|
+
class DepreciationForecastCollection extends Collection {
|
|
655
1327
|
filterByYear(financialYear) {
|
|
656
1328
|
return new DepreciationForecastCollection(this.items.filter((forecast) => forecast.financialYear === financialYear));
|
|
657
1329
|
}
|
|
@@ -659,17 +1331,17 @@ class DepreciationForecastCollection extends AbstractCollection {
|
|
|
659
1331
|
return this.items.reduce((sum, item) => sum + item.getClaimAmountByMonth(month), 0);
|
|
660
1332
|
}
|
|
661
1333
|
get amount() {
|
|
662
|
-
return this.
|
|
1334
|
+
return this.sumBy('amount');
|
|
663
1335
|
}
|
|
664
1336
|
get claimAmount() {
|
|
665
|
-
return this.
|
|
1337
|
+
return this.sumBy('claimAmount');
|
|
666
1338
|
}
|
|
667
1339
|
}
|
|
668
1340
|
|
|
669
1341
|
/**
|
|
670
1342
|
* Collection of income sources
|
|
671
1343
|
*/
|
|
672
|
-
class IncomeSourceCollection extends
|
|
1344
|
+
class IncomeSourceCollection extends Collection {
|
|
673
1345
|
filterByTank(tank) {
|
|
674
1346
|
return this.items.filter((incomeSource) => {
|
|
675
1347
|
switch (tank) {
|
|
@@ -702,7 +1374,7 @@ class IncomeSourceCollection extends AbstractCollection {
|
|
|
702
1374
|
}
|
|
703
1375
|
}
|
|
704
1376
|
|
|
705
|
-
class LoanCollection extends
|
|
1377
|
+
class LoanCollection extends Collection {
|
|
706
1378
|
/**
|
|
707
1379
|
* Get new collection of loans filtered by bank accounts ids
|
|
708
1380
|
* @param ids list of bank accounts ids for filter
|
|
@@ -866,7 +1538,7 @@ class LogbookCollection {
|
|
|
866
1538
|
}
|
|
867
1539
|
}
|
|
868
1540
|
|
|
869
|
-
class MessageCollection extends
|
|
1541
|
+
class MessageCollection extends Collection {
|
|
870
1542
|
getFirstUnreadMessage(user) {
|
|
871
1543
|
return this.items.find((message) => {
|
|
872
1544
|
return !message.isRead() && message.isFromEmployee() !== user.isEmployee();
|
|
@@ -889,7 +1561,7 @@ class MessageCollection extends AbstractCollection {
|
|
|
889
1561
|
/**
|
|
890
1562
|
* Collection of MessageDocument instances
|
|
891
1563
|
*/
|
|
892
|
-
class MessageDocumentCollection extends
|
|
1564
|
+
class MessageDocumentCollection extends Collection {
|
|
893
1565
|
/**
|
|
894
1566
|
* get list of documents which are not attached to any message
|
|
895
1567
|
*/
|
|
@@ -898,7 +1570,7 @@ class MessageDocumentCollection extends AbstractCollection {
|
|
|
898
1570
|
}
|
|
899
1571
|
}
|
|
900
1572
|
|
|
901
|
-
class PropertyCollection extends
|
|
1573
|
+
class PropertyCollection extends Collection {
|
|
902
1574
|
/**
|
|
903
1575
|
* Get new property collection filtered by category id
|
|
904
1576
|
* @param id id of category for filter
|
|
@@ -959,9 +1631,15 @@ class PropertyCollection extends AbstractCollection {
|
|
|
959
1631
|
return min < property.purchaseDate ? min : property.purchaseDate;
|
|
960
1632
|
}, new FinancialYear(new Date()).startDate);
|
|
961
1633
|
}
|
|
1634
|
+
/**
|
|
1635
|
+
* Get list of unique property categories from collection
|
|
1636
|
+
*/
|
|
1637
|
+
getCategories() {
|
|
1638
|
+
return uniqBy(this.items.map((property) => property.category), 'id');
|
|
1639
|
+
}
|
|
962
1640
|
}
|
|
963
1641
|
|
|
964
|
-
class ServicePriceCollection extends
|
|
1642
|
+
class ServicePriceCollection extends Collection {
|
|
965
1643
|
get work() {
|
|
966
1644
|
return this.items.filter((price) => price.product.isWork())[0];
|
|
967
1645
|
}
|
|
@@ -970,7 +1648,7 @@ class ServicePriceCollection extends AbstractCollection {
|
|
|
970
1648
|
}
|
|
971
1649
|
}
|
|
972
1650
|
|
|
973
|
-
class ServiceSubscriptionCollection extends
|
|
1651
|
+
class ServiceSubscriptionCollection extends Collection {
|
|
974
1652
|
get individual() {
|
|
975
1653
|
return this.items.filter((subscription) => subscription.isIndividual())[0];
|
|
976
1654
|
}
|
|
@@ -1025,7 +1703,7 @@ var TaxReturnCategorySectionEnum;
|
|
|
1025
1703
|
/**
|
|
1026
1704
|
* collection for tax return category items
|
|
1027
1705
|
*/
|
|
1028
|
-
class TaxReturnCategoryItemCollection extends
|
|
1706
|
+
class TaxReturnCategoryItemCollection extends Collection {
|
|
1029
1707
|
/**
|
|
1030
1708
|
* Work income
|
|
1031
1709
|
*/
|
|
@@ -1163,7 +1841,7 @@ class TaxReturnCategoryItemCollection extends AbstractCollection {
|
|
|
1163
1841
|
/**
|
|
1164
1842
|
* Collection of tax review
|
|
1165
1843
|
*/
|
|
1166
|
-
class TaxReviewCollection extends
|
|
1844
|
+
class TaxReviewCollection extends Collection {
|
|
1167
1845
|
/**
|
|
1168
1846
|
* Get tax reviews items with SENT & COMPLETED statuses
|
|
1169
1847
|
*/
|
|
@@ -1213,7 +1891,7 @@ class TaxReviewCollection extends AbstractCollection {
|
|
|
1213
1891
|
}
|
|
1214
1892
|
}
|
|
1215
1893
|
|
|
1216
|
-
class TransactionAllocationCollection extends
|
|
1894
|
+
class TransactionAllocationCollection extends Collection {
|
|
1217
1895
|
get amount() {
|
|
1218
1896
|
return this.sumBy('amount');
|
|
1219
1897
|
}
|
|
@@ -1254,7 +1932,7 @@ class TransactionAllocationCollection extends AbstractCollection {
|
|
|
1254
1932
|
/**
|
|
1255
1933
|
* Collection of transactions
|
|
1256
1934
|
*/
|
|
1257
|
-
class TransactionCollection extends
|
|
1935
|
+
class TransactionCollection extends Collection {
|
|
1258
1936
|
/**
|
|
1259
1937
|
* Get total amount of all transactions in the collection
|
|
1260
1938
|
*/
|
|
@@ -1373,7 +2051,7 @@ class TransactionCollection extends AbstractCollection {
|
|
|
1373
2051
|
/**
|
|
1374
2052
|
* Collection of user event settings
|
|
1375
2053
|
*/
|
|
1376
|
-
class UserEventSettingCollection extends
|
|
2054
|
+
class UserEventSettingCollection extends Collection {
|
|
1377
2055
|
getConfigurableBy(field) {
|
|
1378
2056
|
return new UserEventSettingCollection(this.items.filter((setting) => setting[field] !== null));
|
|
1379
2057
|
}
|
|
@@ -1581,8 +2259,7 @@ var ChartAccountsMetadataListEnum;
|
|
|
1581
2259
|
ChartAccountsMetadataListEnum[ChartAccountsMetadataListEnum["TAX_OFFSETS"] = 8] = "TAX_OFFSETS";
|
|
1582
2260
|
ChartAccountsMetadataListEnum[ChartAccountsMetadataListEnum["HOURS"] = 11] = "HOURS";
|
|
1583
2261
|
ChartAccountsMetadataListEnum[ChartAccountsMetadataListEnum["TAX_PAID"] = 13] = "TAX_PAID";
|
|
1584
|
-
ChartAccountsMetadataListEnum[ChartAccountsMetadataListEnum["
|
|
1585
|
-
ChartAccountsMetadataListEnum[ChartAccountsMetadataListEnum["NON_REDUNDANCY"] = 18] = "NON_REDUNDANCY";
|
|
2262
|
+
ChartAccountsMetadataListEnum[ChartAccountsMetadataListEnum["TAX_FREE_COMPONENT"] = 18] = "TAX_FREE_COMPONENT";
|
|
1586
2263
|
ChartAccountsMetadataListEnum[ChartAccountsMetadataListEnum["YEARS_OF_SERVICE"] = 19] = "YEARS_OF_SERVICE";
|
|
1587
2264
|
ChartAccountsMetadataListEnum[ChartAccountsMetadataListEnum["UNTAXED_ELEMENT"] = 24] = "UNTAXED_ELEMENT";
|
|
1588
2265
|
ChartAccountsMetadataListEnum[ChartAccountsMetadataListEnum["FRANKED"] = 26] = "FRANKED";
|
|
@@ -3612,9 +4289,9 @@ class Transaction extends Transaction$1 {
|
|
|
3612
4289
|
// @TODO fix hack while transactions refactoring (use class-transformer)
|
|
3613
4290
|
return +(Math.round(this.getIncomeAmountByType(IncomeAmountTypeEnum.GROSS) * 100) / 100).toFixed(2);
|
|
3614
4291
|
}
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
4292
|
+
get taxFreeComponent() {
|
|
4293
|
+
return this.getMetadataFieldValue(ChartAccountsMetadataListEnum.TAX_FREE_COMPONENT);
|
|
4294
|
+
}
|
|
3618
4295
|
get frankingCredit() {
|
|
3619
4296
|
return this.getMetadataFieldValue(ChartAccountsMetadataListEnum.FRANKING_CREDIT);
|
|
3620
4297
|
}
|
|
@@ -3628,6 +4305,12 @@ class Transaction extends Transaction$1 {
|
|
|
3628
4305
|
get isTransfer() {
|
|
3629
4306
|
return this.operation === TransactionOperationEnum.TRANSFER;
|
|
3630
4307
|
}
|
|
4308
|
+
get debit() {
|
|
4309
|
+
return this.isDebit() ? Math.abs(this.amount) : null;
|
|
4310
|
+
}
|
|
4311
|
+
get credit() {
|
|
4312
|
+
return this.isCredit() ? Math.abs(this.amount) : null;
|
|
4313
|
+
}
|
|
3631
4314
|
/**
|
|
3632
4315
|
* Get value of transaction metadata field
|
|
3633
4316
|
* @param field for which value should be returned
|
|
@@ -3651,7 +4334,7 @@ class Transaction extends Transaction$1 {
|
|
|
3651
4334
|
(this.transactions
|
|
3652
4335
|
.reduce((sum, transaction) => sum + Math.abs(transaction.amount), 0) * modifier);
|
|
3653
4336
|
case this.isWorkTank():
|
|
3654
|
-
return this.amount + ((this.tax + this.frankingCredit) * modifier);
|
|
4337
|
+
return this.amount + ((this.tax + this.frankingCredit - this.taxFreeComponent) * modifier);
|
|
3655
4338
|
default:
|
|
3656
4339
|
return this.amount || 0;
|
|
3657
4340
|
}
|
|
@@ -4246,6 +4929,36 @@ class ClientPortfolioChartData {
|
|
|
4246
4929
|
class ClientPortfolioReport {
|
|
4247
4930
|
}
|
|
4248
4931
|
|
|
4932
|
+
var AlphabetColorsEnum;
|
|
4933
|
+
(function (AlphabetColorsEnum) {
|
|
4934
|
+
AlphabetColorsEnum["A"] = "#9CC3D5";
|
|
4935
|
+
AlphabetColorsEnum["B"] = "#E69A8D";
|
|
4936
|
+
AlphabetColorsEnum["C"] = "#ED2B33";
|
|
4937
|
+
AlphabetColorsEnum["D"] = "#E3CD81";
|
|
4938
|
+
AlphabetColorsEnum["E"] = "#343148";
|
|
4939
|
+
AlphabetColorsEnum["F"] = "#2C5F2D";
|
|
4940
|
+
AlphabetColorsEnum["G"] = "#FFA177";
|
|
4941
|
+
AlphabetColorsEnum["H"] = "#435E55";
|
|
4942
|
+
AlphabetColorsEnum["I"] = "#2BAE66";
|
|
4943
|
+
AlphabetColorsEnum["J"] = "#3C1053";
|
|
4944
|
+
AlphabetColorsEnum["K"] = "#DD4132";
|
|
4945
|
+
AlphabetColorsEnum["L"] = "#FC766A";
|
|
4946
|
+
AlphabetColorsEnum["M"] = "#ADEFD1";
|
|
4947
|
+
AlphabetColorsEnum["N"] = "#79C000";
|
|
4948
|
+
AlphabetColorsEnum["O"] = "#D198C5";
|
|
4949
|
+
AlphabetColorsEnum["P"] = "#5B84B1";
|
|
4950
|
+
AlphabetColorsEnum["Q"] = "#A13941";
|
|
4951
|
+
AlphabetColorsEnum["R"] = "#D85A7F";
|
|
4952
|
+
AlphabetColorsEnum["S"] = "#00203F";
|
|
4953
|
+
AlphabetColorsEnum["T"] = "#42EADD";
|
|
4954
|
+
AlphabetColorsEnum["U"] = "#5F4B8B";
|
|
4955
|
+
AlphabetColorsEnum["V"] = "#FDDB27";
|
|
4956
|
+
AlphabetColorsEnum["W"] = "#CDB599";
|
|
4957
|
+
AlphabetColorsEnum["X"] = "#4B878B";
|
|
4958
|
+
AlphabetColorsEnum["Y"] = "#B0B8B4";
|
|
4959
|
+
AlphabetColorsEnum["Z"] = "#E3C9CE";
|
|
4960
|
+
})(AlphabetColorsEnum || (AlphabetColorsEnum = {}));
|
|
4961
|
+
|
|
4249
4962
|
/**
|
|
4250
4963
|
* Class to generate data-table structure based on provided collection.
|
|
4251
4964
|
* Use to work with HTML/PDF/XLSX tables
|
|
@@ -4279,9 +4992,11 @@ class DataTable {
|
|
|
4279
4992
|
if (!column.total) {
|
|
4280
4993
|
return '';
|
|
4281
4994
|
}
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
.
|
|
4995
|
+
const totalValue = collection.items.reduce((sum, item) => {
|
|
4996
|
+
// check if current collection item has value. If not - don't add it to the sum
|
|
4997
|
+
return item[column.key] !== null ? sum + Number(item[column.key]) : sum;
|
|
4998
|
+
}, null);
|
|
4999
|
+
return (totalValue !== null && totalValue !== void 0 ? totalValue : '-').toString();
|
|
4285
5000
|
});
|
|
4286
5001
|
}
|
|
4287
5002
|
}
|
|
@@ -4392,231 +5107,65 @@ class Document extends Document$1 {
|
|
|
4392
5107
|
super(...arguments);
|
|
4393
5108
|
this.type = AssetTypeEnum.DOCUMENTS;
|
|
4394
5109
|
this.entityType = AssetEntityTypeEnum.FOLDERS;
|
|
4395
|
-
}
|
|
4396
|
-
/**
|
|
4397
|
-
* Get folder as document parent entity
|
|
4398
|
-
*/
|
|
4399
|
-
getEntity() {
|
|
4400
|
-
return this.folder;
|
|
4401
|
-
}
|
|
4402
|
-
/**
|
|
4403
|
-
* Get API url prefix
|
|
4404
|
-
*/
|
|
4405
|
-
getApiUrlPrefix() {
|
|
4406
|
-
return DocumentApiUrlPrefixEnum.FOLDERS;
|
|
4407
|
-
}
|
|
4408
|
-
}
|
|
4409
|
-
|
|
4410
|
-
const DOCUMENT_FILE_TYPES = {
|
|
4411
|
-
image: [
|
|
4412
|
-
'image/png',
|
|
4413
|
-
'image/jpg',
|
|
4414
|
-
'image/jpeg',
|
|
4415
|
-
'image/tiff',
|
|
4416
|
-
'image/bmp'
|
|
4417
|
-
],
|
|
4418
|
-
all: [
|
|
4419
|
-
'image/png',
|
|
4420
|
-
'image/jpg',
|
|
4421
|
-
'image/jpeg',
|
|
4422
|
-
'image/tiff',
|
|
4423
|
-
'image/bmp',
|
|
4424
|
-
'application/msword',
|
|
4425
|
-
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
4426
|
-
'application/pdf',
|
|
4427
|
-
'application/vnd.ms-excel',
|
|
4428
|
-
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
4429
|
-
'text/csv'
|
|
4430
|
-
]
|
|
4431
|
-
};
|
|
4432
|
-
|
|
4433
|
-
class DocumentFolder$1 {
|
|
4434
|
-
}
|
|
4435
|
-
|
|
4436
|
-
class DocumentFolder extends DocumentFolder$1 {
|
|
4437
|
-
}
|
|
4438
|
-
__decorate([
|
|
4439
|
-
Type(() => Document)
|
|
4440
|
-
], DocumentFolder.prototype, "documents", void 0);
|
|
4441
|
-
|
|
4442
|
-
class EmployeeInvite$1 {
|
|
4443
|
-
}
|
|
4444
|
-
|
|
4445
|
-
class EmployeeInvite extends EmployeeInvite$1 {
|
|
4446
|
-
}
|
|
4447
|
-
__decorate([
|
|
4448
|
-
Type(() => RegistrationInvite)
|
|
4449
|
-
], EmployeeInvite.prototype, "registrationInvite", void 0);
|
|
4450
|
-
__decorate([
|
|
4451
|
-
Type(() => User)
|
|
4452
|
-
], EmployeeInvite.prototype, "employee", void 0);
|
|
4453
|
-
|
|
4454
|
-
/**
|
|
4455
|
-
* Backend endpoint class
|
|
4456
|
-
*/
|
|
4457
|
-
class Endpoint {
|
|
4458
|
-
constructor(method, pattern) {
|
|
4459
|
-
this.method = method;
|
|
4460
|
-
this.pattern = pattern;
|
|
4461
|
-
}
|
|
4462
|
-
/**
|
|
4463
|
-
* check url with regexp
|
|
4464
|
-
* @param url
|
|
4465
|
-
*/
|
|
4466
|
-
test(url) {
|
|
4467
|
-
return this.regexp.test(url);
|
|
4468
|
-
}
|
|
4469
|
-
/**
|
|
4470
|
-
* Get regexp for endpoint
|
|
4471
|
-
*/
|
|
4472
|
-
get regexp() {
|
|
4473
|
-
return new RegExp(`^${this.method} \.\*${this.pattern}$`);
|
|
4474
|
-
}
|
|
4475
|
-
}
|
|
4476
|
-
|
|
4477
|
-
/**
|
|
4478
|
-
* List of all app endpoints
|
|
4479
|
-
*/
|
|
4480
|
-
const ENDPOINTS = {
|
|
4481
|
-
ASSETS_GET: new Endpoint('GET', '\\/assets\\/\.\*\\/\\d+'),
|
|
4482
|
-
BANK_ACCOUNTS_GET: new Endpoint('GET', '\\/bank-accounts'),
|
|
4483
|
-
BANK_ACCOUNTS_POST: new Endpoint('POST', '\\/bank-accounts'),
|
|
4484
|
-
BANK_ACCOUNTS_PUT: new Endpoint('PUT', '\\/bank-accounts\\/\\d+'),
|
|
4485
|
-
BANK_CONNECTION_POST: new Endpoint('POST', '\\/bank-connections'),
|
|
4486
|
-
BANK_TRANSACTIONS_GET: new Endpoint('GET', '\\/bank-transactions'),
|
|
4487
|
-
BANK_TRANSACTIONS_DELETE: new Endpoint('DELETE', '\\/bank-transactions\\/\\d+'),
|
|
4488
|
-
BANK_TRANSACTIONS_IMPORT_POST: new Endpoint('POST', '\\/bank-transactions\\/\\d+\\/import'),
|
|
4489
|
-
BASIQ_ACCOUNTS_GET: new Endpoint('GET', '\\/basiq\\/\\accounts'),
|
|
4490
|
-
CAPITAL_COSTS_GET: new Endpoint('GET', '\\/capital-costs'),
|
|
4491
|
-
CHARTS_INCOME_GET: new Endpoint('GET', '\\/charts\\/\\incomes'),
|
|
4492
|
-
CHARTS_EXPENSES_GET: new Endpoint('GET', '\\/charts\\/\\expenses'),
|
|
4493
|
-
CHART_ACCOUNTS_GET: new Endpoint('GET', '\\/chart-accounts'),
|
|
4494
|
-
CLIENTS_GET: new Endpoint('GET', '\\/clients'),
|
|
4495
|
-
CLIENTS_PUT: new Endpoint('PUT', '\\/clients'),
|
|
4496
|
-
CLIENTS_EXCLUDE_PUT: new Endpoint('PUT', '\\/clients\\/\\d+\\/exclude'),
|
|
4497
|
-
CLIENTS_INVITES_GET: new Endpoint('GET', '\\/clients\\/\\invites'),
|
|
4498
|
-
CLIENTS_INVITES_POST: new Endpoint('POST', '\\/clients\\/\\invites'),
|
|
4499
|
-
CLIENTS_INVITES_DELETE: new Endpoint('DELETE', '\\/clients\\/\\invites\\/\\d+'),
|
|
4500
|
-
CLIENTS_INVITES_ACCEPT_POST: new Endpoint('POST', '\\/clients\\/\\invites\\/\\d+\\/accept'),
|
|
4501
|
-
CLIENTS_INVITES_REJECT_POST: new Endpoint('POST', '\\/clients\\/\\invites\\/\\d+\\/reject'),
|
|
4502
|
-
CLIENTS_INVITES_RESEND_POST: new Endpoint('POST', '\\/clients\\/\\invites\\/\\d+\\/resend'),
|
|
4503
|
-
CLIENT_MOVEMENTS_GET: new Endpoint('GET', '\\/client-movements'),
|
|
4504
|
-
CLIENT_MOVEMENTS_POST: new Endpoint('POST', '\\/client-movements'),
|
|
4505
|
-
COUNTRIES_GET: new Endpoint('GET', '\\/countries'),
|
|
4506
|
-
DEPRECIATIONS_CLOSING_GET: new Endpoint('GET', '\\/depreciations\\/\\closing-balance\.\*'),
|
|
4507
|
-
DEPRECIATIONS_GET: new Endpoint('GET', '\\/depreciations'),
|
|
4508
|
-
DEPRECIATIONS_POST: new Endpoint('POST', '\\/depreciations'),
|
|
4509
|
-
DEPRECIATIONS_PUT: new Endpoint('PUT', '\\/depreciations\\/\\d+'),
|
|
4510
|
-
EMPLOYEES_GET: new Endpoint('GET', '\\/employees'),
|
|
4511
|
-
EMPLOYEES_INVITES_GET: new Endpoint('GET', '\\/employees\\/\\invites'),
|
|
4512
|
-
EMPLOYEES_INVITES_DELETE: new Endpoint('DELETE', '\\/employees\\/\\invites\\/\\d+'),
|
|
4513
|
-
EMPLOYEES_INVITE_POST: new Endpoint('POST', '\\/employees\\/\\invites'),
|
|
4514
|
-
EMPLOYEES_INVITES_REJECT_POST: new Endpoint('POST', '\\/employees\\/\\invites\\/\\d+\\/\\reject'),
|
|
4515
|
-
EMPLOYEES_INVITES_RESEND_POST: new Endpoint('POST', '\\/employees\\/\\invites\\/\\d+\\/\\resend'),
|
|
4516
|
-
FIRM_GET: new Endpoint('GET', '\\/firms'),
|
|
4517
|
-
FIRM_CURRENT_GET: new Endpoint('GET', '\\/firms\\/current'),
|
|
4518
|
-
FIRM_CURRENT_PUT: new Endpoint('PUT', '\\/firms\\/current\.\*'),
|
|
4519
|
-
FIRM_INVITE_POST: new Endpoint('POST', '\\/firms\\/invite'),
|
|
4520
|
-
FIRM_REGISTRATION_POST: new Endpoint('POST', '\\/firms\\/registration'),
|
|
4521
|
-
FIRM_UPDATE_PHOTO_POST: new Endpoint('POST', '\\/firms\\/photo\.\*'),
|
|
4522
|
-
FOLDERS_GET: new Endpoint('GET', '\\/folders'),
|
|
4523
|
-
FOLDERS_POST: new Endpoint('POST', '\\/folders'),
|
|
4524
|
-
FOLDERS_PUT: new Endpoint('PUT', '\\/folders\\/\\d+'),
|
|
4525
|
-
FOLDERS_DOCUMENTS_POST: new Endpoint('POST', '\\/folders\\/\\d+\\/documents'),
|
|
4526
|
-
FOLDERS_DOCUMENTS_PUT: new Endpoint('PUT', '\\/folders\\/\\d+\\/documents\\/\\d+'),
|
|
4527
|
-
INCOME_SOURCES_GET: new Endpoint('GET', '\\/income-sources'),
|
|
4528
|
-
INCOME_SOURCES_POST: new Endpoint('POST', '\\/income-sources'),
|
|
4529
|
-
INCOME_SOURCES_PUT: new Endpoint('PUT', '\\/income-sources'),
|
|
4530
|
-
INCOME_SOURCES_DELETE: new Endpoint('DELETE', '\\/income-sources\\/\\d+'),
|
|
4531
|
-
INCOME_SOURCE_FORECAST_GET: new Endpoint('GET', '\\/income-source-forecasts'),
|
|
4532
|
-
INCOME_SOURCE_FORECAST_POST: new Endpoint('POST', '\\/income-source-forecasts'),
|
|
4533
|
-
INCOME_SOURCE_FORECAST_PUT: new Endpoint('PUT', '\\/income-source-forecasts'),
|
|
4534
|
-
INCOME_SOURCE_FORECAST_DELETE: new Endpoint('DELETE', '\\/income-source-forecasts\\/\\d+'),
|
|
4535
|
-
INCOME_SOURCE_TYPES_GET: new Endpoint('GET', '\\/income-source-types'),
|
|
4536
|
-
LOANS_GET: new Endpoint('GET', '\\/bank-accounts\\/loans'),
|
|
4537
|
-
LOANS_POST: new Endpoint('POST', '\\/bank-accounts\\/loans'),
|
|
4538
|
-
LOANS_PUT: new Endpoint('PUT', '\\/bank-accounts\\/loans/\\d+'),
|
|
4539
|
-
LOANS_PAYOUT_POST: new Endpoint('POST', '\\/loans\\/\\d+\\/payout'),
|
|
4540
|
-
LOANS_PAYOUT_PUT: new Endpoint('PUT', '\\/loans\\/\\d+\\/payout\\/\\d+'),
|
|
4541
|
-
LOANS_PAYOUT_DELETE: new Endpoint('DELETE', '\\/loans\\/\\d+\\/payout\\/\\d+'),
|
|
4542
|
-
LOANS_CALCULATION_POST: new Endpoint('POST', '\\/bank-accounts\\/loans\\/calculation'),
|
|
4543
|
-
LOGIN_CHECK_POST: new Endpoint('POST', '\\/login_check'),
|
|
4544
|
-
NOTIFICATIONS_GET: new Endpoint('GET', '\\/service-notifications'),
|
|
4545
|
-
OCCUPATIONS_GET: new Endpoint('GET', '\\/occupations'),
|
|
4546
|
-
PROPERTIES_GET: new Endpoint('GET', '\\/properties'),
|
|
4547
|
-
PROPERTIES_POST: new Endpoint('POST', '\\/properties'),
|
|
4548
|
-
PROPERTY_PUT: new Endpoint('PUT', '\\/properties/\\d+'),
|
|
4549
|
-
PROPERTIES_PUT: new Endpoint('PUT', '\\/properties'),
|
|
4550
|
-
PROPERTIES_CATEGORIES_EQUITY_GET: new Endpoint('GET', '\\/properties\\/categories\\/equity'),
|
|
4551
|
-
PROPERTIES_CATEGORIES_GET: new Endpoint('GET', '\\/properties\\/categories'),
|
|
4552
|
-
PROPERTIES_CATEGORIES_PUT: new Endpoint('PUT', '\\/properties\\/categories\\/\\d+'),
|
|
4553
|
-
PROPERTIES_CATEGORIES_POST: new Endpoint('POST', '\\/properties\\/categories'),
|
|
4554
|
-
PROPERTIES_CATEGORY_MOVEMENTS_POST: new Endpoint('POST', '\\/properties\\/\\d+\\/category-movements'),
|
|
4555
|
-
PROPERTIES_CATEGORY_MOVEMENTS_PUT: new Endpoint('PUT', '\\/properties\\/\\d+\\/category-movements\\/\\d+'),
|
|
4556
|
-
PROPERTIES_CO_OWNERS_PUT: new Endpoint('PUT', '\\/properties\\/co-owners\\/\\d+'),
|
|
4557
|
-
PROPERTIES_CO_OWNERS_GET: new Endpoint('GET', '\\/properties\\/co-owners'),
|
|
4558
|
-
PROPERTIES_CO_OWNERS_POST: new Endpoint('POST', '\\/properties\\/co-owners'),
|
|
4559
|
-
PROPERTIES_DEACTIVATE_PUT: new Endpoint('PUT', '\\/properties\\/\\d+\\/deactivate'),
|
|
4560
|
-
PROPERTIES_DEPRECIATION_CAPITAL_PROJECT_GET: new Endpoint('GET', '\\/properties\\/\\d+\\/depreciation-capital-projects'),
|
|
4561
|
-
PROPERTIES_DEPRECIATION_CAPITAL_PROJECT_POST: new Endpoint('POST', '\\/properties\\/\\d+\\/depreciation-capital-projects'),
|
|
4562
|
-
PROPERTIES_DEPRECIATION_CAPITAL_PROJECT_PUT: new Endpoint('PUT', '\\/properties\\/\\d+\\/depreciation-capital-projects\\/\\d+'),
|
|
4563
|
-
PROPERTIES_DEPRECIATION_CAPITAL_PROJECT_DELETE: new Endpoint('DELETE', '\\/properties\\/\\d+\\/depreciation-capital-projects\\/\\d+'),
|
|
4564
|
-
PROPERTIES_DOCUMENTS_GET: new Endpoint('GET', '\\/properties\\/documents'),
|
|
4565
|
-
PROPERTIES_DOCUMENTS_POST: new Endpoint('POST', '\\/properties\\/\\d+\\/documents'),
|
|
4566
|
-
PROPERTIES_DOCUMENTS_PUT: new Endpoint('PUT', '\\/properties\\/documents\\/\\d+'),
|
|
4567
|
-
PROPERTIES_DOCUMENTS_DELETE: new Endpoint('DELETE', '\\/properties\\/documents\\/\\d+'),
|
|
4568
|
-
PROPERTIES_PHOTO_POST: new Endpoint('POST', '\\/properties\\/\\d+\\/photo\.\*'),
|
|
4569
|
-
PROPERTIES_SUGGESTIONS_GET: new Endpoint('GET', '/property\\/\\w+\\/v2\\/.*$'),
|
|
4570
|
-
PROPERTIES_VALUATIONS_DOCUMENTS_POST: new Endpoint('POST', '\\/properties\\/\\d+\\/valuations\\/\\d+\\/documents'),
|
|
4571
|
-
PRORATION_COST_POST: new Endpoint('POST', '\\/subscriptions\\/proration-cost'),
|
|
4572
|
-
SALARY_FORECAST_GET: new Endpoint('GET', '\\/salary-forecasts'),
|
|
4573
|
-
SALARY_FORECAST_POST: new Endpoint('POST', '\\/salary-forecasts'),
|
|
4574
|
-
SALARY_FORECAST_PUT: new Endpoint('PUT', '\\/salary-forecasts'),
|
|
4575
|
-
SERVICE_PRICES_GET: new Endpoint('GET', '\\/service-prices'),
|
|
4576
|
-
SERVICE_PAYMENTS_GET: new Endpoint('GET', '\\/service-payments'),
|
|
4577
|
-
STRIPE_BILLING_PORTAL_GET: new Endpoint('GET', '\\/stripe\\/billing-portal-session'),
|
|
4578
|
-
STRIPE_CHECKOUT_SESSION_POST: new Endpoint('POST', '\\/stripe\\/checkout-session'),
|
|
4579
|
-
SUBSCRIPTION_LAST_GET: new Endpoint('GET', '\\/subscriptions\\/last'),
|
|
4580
|
-
SUBSCRIPTION_ITEMS_PUT: new Endpoint('PUT', '\\/subscriptions\\/items'),
|
|
4581
|
-
TAX_CALCULATION_POST: new Endpoint('POST', '\\/tax-calculation'),
|
|
4582
|
-
TAX_REVIEWS_GET: new Endpoint('GET', '\\/tax-reviews'),
|
|
4583
|
-
TAX_REVIEWS_DELETE: new Endpoint('DELETE', '\\/tax-reviews\\/\\d+'),
|
|
4584
|
-
TAX_REVIEWS_POST: new Endpoint('POST', '\\/tax-reviews'),
|
|
4585
|
-
TAX_REVIEWS_PUT: new Endpoint('PUT', '\\/tax-reviews\\/\\d+'),
|
|
4586
|
-
TAX_SUMMARY_ACTUAL_GET: new Endpoint('GET', '\\/tax-summary\\/actuals'),
|
|
4587
|
-
TAX_SUMMARY_FORECAST_GET: new Endpoint('GET', '\\/tax-summary\\/forecasts'),
|
|
4588
|
-
TRANSACTION_DELETE: new Endpoint('DELETE', '\\/transactions\\/\\d+'),
|
|
4589
|
-
TRANSACTION_PUT: new Endpoint('PUT', '\\/transactions\\/\\d+'),
|
|
4590
|
-
TRANSACTIONS_GET: new Endpoint('GET', '\\/transactions'),
|
|
4591
|
-
TRANSACTIONS_POST: new Endpoint('POST', '\\/transactions'),
|
|
4592
|
-
TRANSACTIONS_PUT: new Endpoint('PUT', '\\/transactions'),
|
|
4593
|
-
TRANSACTIONS_ALLOCATIONS_GET: new Endpoint('GET', '\\/transactions-allocations'),
|
|
4594
|
-
TRANSACTIONS_ALLOCATIONS_POST: new Endpoint('POST', '\\/transactions-allocations'),
|
|
4595
|
-
TRANSACTIONS_ALLOCATIONS_DELETE: new Endpoint('DELETE', '\\/transactions-allocations\\/\\d+'),
|
|
4596
|
-
USER_CONFIRMATION_POST: new Endpoint('POST', '\\/users\\/confirmation'),
|
|
4597
|
-
USER_CURRENT_GET: new Endpoint('GET', '\\/users\\/current'),
|
|
4598
|
-
USER_CURRENT_PASSWORD_PUT: new Endpoint('PUT', '\\/users\\/current\\/password\.\*'),
|
|
4599
|
-
USER_EVENT_SETTINGS_GET: new Endpoint('GET', '\\/user-event-settings'),
|
|
4600
|
-
USER_EVENT_TYPES_GET: new Endpoint('GET', '\\/user-event-types'),
|
|
4601
|
-
USER_INVITE_DELETE: new Endpoint('DELETE', '\\/users\\/invite\\/\\d+'),
|
|
4602
|
-
USER_INVITE_POST: new Endpoint('POST', '\\/users\\/invite'),
|
|
4603
|
-
USER_INVITE_RESEND_POST: new Endpoint('POST', '\\/users\\/invite/\\d+\\/resend'),
|
|
4604
|
-
USER_PUT: new Endpoint('PUT', '\\/users\\/\\d+'),
|
|
4605
|
-
USER_REGISTRATION_POST: new Endpoint('POST', '\\/users\\/registration'),
|
|
4606
|
-
USER_RESET_PASSWORD_PUT: new Endpoint('PUT', '\\/users\\/reset-password'),
|
|
4607
|
-
USER_SEARCH_GET: new Endpoint('GET', '\\/users\\/search\.\*'),
|
|
4608
|
-
USER_UPDATE_PHOTO_POST: new Endpoint('POST', '\\/users\\/photo\.\*'),
|
|
4609
|
-
USER_STATUS_PUT: new Endpoint('PUT', '\\/users\\/status'),
|
|
4610
|
-
VEHICLES_GET: new Endpoint('GET', '\\/vehicles'),
|
|
4611
|
-
VEHICLES_POST: new Endpoint('POST', '\\/vehicles'),
|
|
4612
|
-
VEHICLES_PUT: new Endpoint('PUT', '\\/vehicles\\/\\d+'),
|
|
4613
|
-
VEHICLE_CLAIMS_GET: new Endpoint('GET', '\\/vehicle-claims'),
|
|
4614
|
-
VEHICLE_CLAIMS_POST: new Endpoint('POST', '\\/vehicle-claims'),
|
|
4615
|
-
VEHICLE_LOGBOOK_POST: new Endpoint('POST', '\\/vehicles\\/\\d+\\/logbooks'),
|
|
4616
|
-
VEHICLE_LOGBOOK_PUT: new Endpoint('PUT', '\\/vehicles\\/\\d+\\/logbooks\\/\\d+'),
|
|
4617
|
-
VEHICLE_CLAIMS_PUT: new Endpoint('PUT', '\\/vehicle-claims\\/\\d+')
|
|
5110
|
+
}
|
|
5111
|
+
/**
|
|
5112
|
+
* Get folder as document parent entity
|
|
5113
|
+
*/
|
|
5114
|
+
getEntity() {
|
|
5115
|
+
return this.folder;
|
|
5116
|
+
}
|
|
5117
|
+
/**
|
|
5118
|
+
* Get API url prefix
|
|
5119
|
+
*/
|
|
5120
|
+
getApiUrlPrefix() {
|
|
5121
|
+
return DocumentApiUrlPrefixEnum.FOLDERS;
|
|
5122
|
+
}
|
|
5123
|
+
}
|
|
5124
|
+
|
|
5125
|
+
const DOCUMENT_FILE_TYPES = {
|
|
5126
|
+
image: [
|
|
5127
|
+
'image/png',
|
|
5128
|
+
'image/jpg',
|
|
5129
|
+
'image/jpeg',
|
|
5130
|
+
'image/tiff',
|
|
5131
|
+
'image/bmp'
|
|
5132
|
+
],
|
|
5133
|
+
all: [
|
|
5134
|
+
'image/png',
|
|
5135
|
+
'image/jpg',
|
|
5136
|
+
'image/jpeg',
|
|
5137
|
+
'image/tiff',
|
|
5138
|
+
'image/bmp',
|
|
5139
|
+
'application/msword',
|
|
5140
|
+
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
5141
|
+
'application/pdf',
|
|
5142
|
+
'application/vnd.ms-excel',
|
|
5143
|
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
5144
|
+
'text/csv'
|
|
5145
|
+
]
|
|
4618
5146
|
};
|
|
4619
5147
|
|
|
5148
|
+
class DocumentFolder$1 {
|
|
5149
|
+
}
|
|
5150
|
+
|
|
5151
|
+
class DocumentFolder extends DocumentFolder$1 {
|
|
5152
|
+
}
|
|
5153
|
+
__decorate([
|
|
5154
|
+
Type(() => Document)
|
|
5155
|
+
], DocumentFolder.prototype, "documents", void 0);
|
|
5156
|
+
|
|
5157
|
+
class EmployeeInvite$1 {
|
|
5158
|
+
}
|
|
5159
|
+
|
|
5160
|
+
class EmployeeInvite extends EmployeeInvite$1 {
|
|
5161
|
+
}
|
|
5162
|
+
__decorate([
|
|
5163
|
+
Type(() => RegistrationInvite)
|
|
5164
|
+
], EmployeeInvite.prototype, "registrationInvite", void 0);
|
|
5165
|
+
__decorate([
|
|
5166
|
+
Type(() => User)
|
|
5167
|
+
], EmployeeInvite.prototype, "employee", void 0);
|
|
5168
|
+
|
|
4620
5169
|
/**
|
|
4621
5170
|
* any event happened in the app, which needs to be handled somehow (distributed to other part of the app)
|
|
4622
5171
|
*/
|
|
@@ -4830,6 +5379,12 @@ class VehicleClaim extends VehicleClaim$1 {
|
|
|
4830
5379
|
get isLogbookMethod() {
|
|
4831
5380
|
return this.method === VehicleClaimMethodEnum.LOGBOOK;
|
|
4832
5381
|
}
|
|
5382
|
+
/**
|
|
5383
|
+
* Claim amount for Kms method
|
|
5384
|
+
*/
|
|
5385
|
+
getKmsClaimAmount(vehicleClaimRate) {
|
|
5386
|
+
return +(this.kilometers * vehicleClaimRate).toFixed(2);
|
|
5387
|
+
}
|
|
4833
5388
|
}
|
|
4834
5389
|
|
|
4835
5390
|
class ServiceNotification {
|
|
@@ -4946,13 +5501,6 @@ const CAPITAL_COSTS_ITEMS = [
|
|
|
4946
5501
|
}),
|
|
4947
5502
|
];
|
|
4948
5503
|
|
|
4949
|
-
/**
|
|
4950
|
-
* https://api-uat.corelogic.asia/property/au/v2/suggest.json
|
|
4951
|
-
* address suggestion from corelogic service
|
|
4952
|
-
*/
|
|
4953
|
-
class CorelogicSuggestion {
|
|
4954
|
-
}
|
|
4955
|
-
|
|
4956
5504
|
/**
|
|
4957
5505
|
* Enum with properties ownership filter options
|
|
4958
5506
|
*/
|
|
@@ -5564,41 +6112,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
5564
6112
|
args: ['environment']
|
|
5565
6113
|
}] }]; } });
|
|
5566
6114
|
|
|
5567
|
-
const KEY = '_switch_user';
|
|
5568
|
-
/**
|
|
5569
|
-
* provides user management to managers (users with ROLE_ACCOUNTANT for now, more in future)
|
|
5570
|
-
*/
|
|
5571
|
-
class UserSwitcherService {
|
|
5572
|
-
/**
|
|
5573
|
-
* get switched username
|
|
5574
|
-
*/
|
|
5575
|
-
get() {
|
|
5576
|
-
return localStorage[KEY];
|
|
5577
|
-
}
|
|
5578
|
-
/**
|
|
5579
|
-
* switch to user (username should be used for correct work of backend)
|
|
5580
|
-
*/
|
|
5581
|
-
set(username) {
|
|
5582
|
-
localStorage[KEY] = username;
|
|
5583
|
-
window.location.replace('/client/dashboard');
|
|
5584
|
-
}
|
|
5585
|
-
/**
|
|
5586
|
-
* go back to original user
|
|
5587
|
-
*/
|
|
5588
|
-
reset() {
|
|
5589
|
-
localStorage.removeItem(KEY);
|
|
5590
|
-
window.location.replace('/firm/dashboard');
|
|
5591
|
-
}
|
|
5592
|
-
}
|
|
5593
|
-
UserSwitcherService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: UserSwitcherService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5594
|
-
UserSwitcherService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: UserSwitcherService, providedIn: 'root' });
|
|
5595
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: UserSwitcherService, decorators: [{
|
|
5596
|
-
type: Injectable,
|
|
5597
|
-
args: [{
|
|
5598
|
-
providedIn: 'root'
|
|
5599
|
-
}]
|
|
5600
|
-
}] });
|
|
5601
|
-
|
|
5602
6115
|
/**
|
|
5603
6116
|
* Service to work with assets (documents, receipts, e.t.c.)
|
|
5604
6117
|
*/
|
|
@@ -5646,79 +6159,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
5646
6159
|
args: ['environment']
|
|
5647
6160
|
}] }]; } });
|
|
5648
6161
|
|
|
5649
|
-
const NAME_TOKEN = 'token';
|
|
5650
|
-
const NAME_REFRESH_TOKEN = 'refreshToken';
|
|
5651
|
-
class JwtService extends JwtHelperService {
|
|
5652
|
-
getToken() {
|
|
5653
|
-
return localStorage[NAME_TOKEN];
|
|
5654
|
-
}
|
|
5655
|
-
getRefreshToken() {
|
|
5656
|
-
return localStorage[NAME_REFRESH_TOKEN];
|
|
5657
|
-
}
|
|
5658
|
-
saveTokens(tokens) {
|
|
5659
|
-
localStorage[NAME_TOKEN] = tokens.token;
|
|
5660
|
-
localStorage[NAME_REFRESH_TOKEN] = tokens.refreshToken;
|
|
5661
|
-
}
|
|
5662
|
-
destroyTokens() {
|
|
5663
|
-
localStorage.removeItem(NAME_TOKEN);
|
|
5664
|
-
localStorage.removeItem(NAME_REFRESH_TOKEN);
|
|
5665
|
-
}
|
|
5666
|
-
getUser() {
|
|
5667
|
-
return this.decodeToken();
|
|
5668
|
-
}
|
|
5669
|
-
isMe(userId) {
|
|
5670
|
-
return this.getUser().id === userId;
|
|
5671
|
-
}
|
|
5672
|
-
}
|
|
5673
|
-
JwtService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: JwtService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
5674
|
-
JwtService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: JwtService, providedIn: 'root' });
|
|
5675
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: JwtService, decorators: [{
|
|
5676
|
-
type: Injectable,
|
|
5677
|
-
args: [{
|
|
5678
|
-
providedIn: 'root'
|
|
5679
|
-
}]
|
|
5680
|
-
}] });
|
|
5681
|
-
|
|
5682
|
-
class AuthService {
|
|
5683
|
-
constructor(http, jwtService, environment) {
|
|
5684
|
-
this.http = http;
|
|
5685
|
-
this.jwtService = jwtService;
|
|
5686
|
-
this.environment = environment;
|
|
5687
|
-
this.isLoggedInSubject = new BehaviorSubject(!this.jwtService.isTokenExpired());
|
|
5688
|
-
}
|
|
5689
|
-
setAuth(response) {
|
|
5690
|
-
this.jwtService.saveTokens(response);
|
|
5691
|
-
this.isLoggedInSubject.next(true);
|
|
5692
|
-
}
|
|
5693
|
-
login(username, password) {
|
|
5694
|
-
return this.http.post(`${this.environment.apiV2}/login_check`, { username, password }).pipe(map((response) => {
|
|
5695
|
-
this.setAuth(response);
|
|
5696
|
-
return response;
|
|
5697
|
-
}));
|
|
5698
|
-
}
|
|
5699
|
-
refresh(refreshToken) {
|
|
5700
|
-
return this.http.post(`${this.environment.apiV2}/token/refresh`, { refreshToken }).pipe(map((response) => {
|
|
5701
|
-
this.setAuth(response);
|
|
5702
|
-
return response;
|
|
5703
|
-
}));
|
|
5704
|
-
}
|
|
5705
|
-
logoutFront(url = '/login') {
|
|
5706
|
-
localStorage.clear();
|
|
5707
|
-
location.replace(url);
|
|
5708
|
-
}
|
|
5709
|
-
}
|
|
5710
|
-
AuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AuthService, deps: [{ token: i1.HttpClient }, { token: JwtService }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5711
|
-
AuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AuthService, providedIn: 'root' });
|
|
5712
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AuthService, decorators: [{
|
|
5713
|
-
type: Injectable,
|
|
5714
|
-
args: [{
|
|
5715
|
-
providedIn: 'root'
|
|
5716
|
-
}]
|
|
5717
|
-
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: JwtService }, { type: undefined, decorators: [{
|
|
5718
|
-
type: Inject,
|
|
5719
|
-
args: ['environment']
|
|
5720
|
-
}] }]; } });
|
|
5721
|
-
|
|
5722
6162
|
// replace array element with the new one (only arrays of objects)
|
|
5723
6163
|
function replace(array, item, matchField = 'id') {
|
|
5724
6164
|
const index = array.findIndex((i) => i[matchField] === item[matchField]);
|
|
@@ -6060,6 +6500,12 @@ class BankAccountService extends BaseRestService {
|
|
|
6060
6500
|
return updatedBankAccount;
|
|
6061
6501
|
}));
|
|
6062
6502
|
}
|
|
6503
|
+
getOwn() {
|
|
6504
|
+
return this.get()
|
|
6505
|
+
.pipe(map((bankAccounts) => {
|
|
6506
|
+
return bankAccounts.filter((bankAccount) => bankAccount.isOwner(+localStorage.getItem('userId')));
|
|
6507
|
+
}));
|
|
6508
|
+
}
|
|
6063
6509
|
/**
|
|
6064
6510
|
* Listen to EventDispatcherService events
|
|
6065
6511
|
*/
|
|
@@ -7980,14 +8426,47 @@ class PdfService {
|
|
|
7980
8426
|
document.save(`${fileName}.pdf`);
|
|
7981
8427
|
}
|
|
7982
8428
|
/**
|
|
8429
|
+
* @Todo rename when all DataTable dependent methods will be cleared-up
|
|
8430
|
+
*/
|
|
8431
|
+
exportTables(tables, title, fileName) {
|
|
8432
|
+
const document = this.generateFromTables(tables, title);
|
|
8433
|
+
document.save(`${fileName}.pdf`);
|
|
8434
|
+
}
|
|
8435
|
+
/**
|
|
8436
|
+
* @Todo rename when all DataTable dependent methods will be cleared-up
|
|
8437
|
+
*/
|
|
8438
|
+
generateFromTables(tables, title) {
|
|
8439
|
+
const pdf = new jsPDF();
|
|
8440
|
+
// set document title
|
|
8441
|
+
pdf.setFontSize(PDF_CONFIG.text.fontSize)
|
|
8442
|
+
.setFont(PDF_CONFIG.text.fontName, PDF_CONFIG.text.fontStyle, PDF_CONFIG.text.fontWeight)
|
|
8443
|
+
.text(title, PDF_CONFIG.text.positionX, PDF_CONFIG.text.positionY);
|
|
8444
|
+
tables.forEach((table) => {
|
|
8445
|
+
// coords of last table
|
|
8446
|
+
const lastTableCoords = pdf['lastAutoTable'].finalY || PDF_CONFIG.contentCoords.marginTop;
|
|
8447
|
+
// table options
|
|
8448
|
+
const options = {
|
|
8449
|
+
html: table,
|
|
8450
|
+
startY: lastTableCoords + PDF_CONFIG.contentTitleCoords.marginTop,
|
|
8451
|
+
footStyles: {
|
|
8452
|
+
fillColor: PDF_CONFIG.text.fillColor,
|
|
8453
|
+
textColor: PDF_CONFIG.text.textColor
|
|
8454
|
+
}
|
|
8455
|
+
};
|
|
8456
|
+
autoTable(pdf, options);
|
|
8457
|
+
});
|
|
8458
|
+
return pdf;
|
|
8459
|
+
}
|
|
8460
|
+
/**
|
|
8461
|
+
* @Todo remove/refactor when all DataTable dependent methods will be cleared-up
|
|
7983
8462
|
* Generate PDF file from provided data
|
|
7984
8463
|
*/
|
|
7985
8464
|
generatePdfFile(tables, title) {
|
|
7986
8465
|
const pdf = new jsPDF();
|
|
7987
|
-
// set document
|
|
7988
|
-
pdf.setFontSize(PDF_CONFIG.text.fontSize)
|
|
7989
|
-
|
|
7990
|
-
|
|
8466
|
+
// set document font params
|
|
8467
|
+
pdf.setFontSize(PDF_CONFIG.text.fontSize)
|
|
8468
|
+
.setFont(PDF_CONFIG.text.fontName, PDF_CONFIG.text.fontStyle, PDF_CONFIG.text.fontWeight)
|
|
8469
|
+
.text(title, PDF_CONFIG.text.positionX, PDF_CONFIG.text.positionY);
|
|
7991
8470
|
tables.forEach((table) => {
|
|
7992
8471
|
// coords of last table
|
|
7993
8472
|
const lastTableCoords = pdf['lastAutoTable'].finalY || PDF_CONFIG.contentCoords.marginTop;
|
|
@@ -8017,63 +8496,35 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
8017
8496
|
}]
|
|
8018
8497
|
}] });
|
|
8019
8498
|
|
|
8020
|
-
|
|
8021
|
-
|
|
8022
|
-
|
|
8023
|
-
|
|
8024
|
-
get() {
|
|
8025
|
-
return this.activePreloaders.asObservable();
|
|
8026
|
-
}
|
|
8027
|
-
add(endpoint) {
|
|
8028
|
-
const activePreloaders = this.activePreloaders.getValue();
|
|
8029
|
-
activePreloaders.push(endpoint);
|
|
8030
|
-
this.activePreloaders.next(activePreloaders);
|
|
8031
|
-
}
|
|
8032
|
-
delete(endpoint) {
|
|
8033
|
-
let activePreloaders = this.activePreloaders.getValue();
|
|
8034
|
-
activePreloaders = activePreloaders.filter((preloader) => preloader !== endpoint);
|
|
8035
|
-
this.activePreloaders.next(activePreloaders);
|
|
8036
|
-
}
|
|
8037
|
-
}
|
|
8038
|
-
PreloaderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PreloaderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
8039
|
-
PreloaderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PreloaderService, providedIn: 'root' });
|
|
8040
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PreloaderService, decorators: [{
|
|
8041
|
-
type: Injectable,
|
|
8042
|
-
args: [{
|
|
8043
|
-
providedIn: 'root'
|
|
8044
|
-
}]
|
|
8045
|
-
}], ctorParameters: function () { return []; } });
|
|
8046
|
-
|
|
8047
|
-
class CorelogicService {
|
|
8499
|
+
/**
|
|
8500
|
+
* Service for get property equity position half-year history chart data
|
|
8501
|
+
*/
|
|
8502
|
+
class EquityPositionChartService {
|
|
8048
8503
|
constructor(http, environment) {
|
|
8049
8504
|
this.http = http;
|
|
8050
8505
|
this.environment = environment;
|
|
8051
|
-
this.accessTokenSubject = new ReplaySubject(1);
|
|
8052
|
-
}
|
|
8053
|
-
getAccessToken(force = false) {
|
|
8054
|
-
if (!this._accessToken || force) {
|
|
8055
|
-
this.http.get(`${this.environment.coreLogicUrl}/access/oauth/token?grant_type=client_credentials&client_id=${this.environment.coreLogicId}&client_secret=${this.environment.coreLogicSecret}`)
|
|
8056
|
-
.pipe(map((response) => {
|
|
8057
|
-
return response.access_token;
|
|
8058
|
-
}))
|
|
8059
|
-
.subscribe((token) => {
|
|
8060
|
-
this._accessToken = token;
|
|
8061
|
-
this.accessTokenSubject.next(this._accessToken);
|
|
8062
|
-
});
|
|
8063
|
-
}
|
|
8064
|
-
return this.accessTokenSubject.asObservable();
|
|
8065
8506
|
}
|
|
8066
|
-
|
|
8067
|
-
// @TODO
|
|
8068
|
-
return this.http.get(`${this.environment.
|
|
8507
|
+
get() {
|
|
8508
|
+
// @TODO refactor backend
|
|
8509
|
+
return this.http.get(`${this.environment.apiV2}/properties/categories/equity`)
|
|
8069
8510
|
.pipe(map((response) => {
|
|
8070
|
-
return response.
|
|
8511
|
+
return response.map((item) => {
|
|
8512
|
+
return plainToClass(ChartData, {
|
|
8513
|
+
name: item.category.name,
|
|
8514
|
+
data: item.equity.map((serie) => {
|
|
8515
|
+
return plainToClass(ChartSerie, {
|
|
8516
|
+
label: serie.date,
|
|
8517
|
+
value: serie.amount
|
|
8518
|
+
});
|
|
8519
|
+
})
|
|
8520
|
+
});
|
|
8521
|
+
});
|
|
8071
8522
|
}));
|
|
8072
8523
|
}
|
|
8073
8524
|
}
|
|
8074
|
-
|
|
8075
|
-
|
|
8076
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type:
|
|
8525
|
+
EquityPositionChartService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: EquityPositionChartService, deps: [{ token: i1.HttpClient }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
8526
|
+
EquityPositionChartService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: EquityPositionChartService, providedIn: 'root' });
|
|
8527
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: EquityPositionChartService, decorators: [{
|
|
8077
8528
|
type: Injectable,
|
|
8078
8529
|
args: [{
|
|
8079
8530
|
providedIn: 'root'
|
|
@@ -9860,5 +10311,5 @@ function taxReviewFilterPredicate(data, filter) {
|
|
|
9860
10311
|
* Generated bundle index. Do not edit.
|
|
9861
10312
|
*/
|
|
9862
10313
|
|
|
9863
|
-
export {
|
|
10314
|
+
export { Address, AddressService, AddressTypeEnum, AlphabetColorsEnum, AppEvent, AppEventTypeEnum, AssetEntityTypeEnum, AssetTypeEnum, AssetsService, AuthService, BANK_ACCOUNT_TYPES, Bank, BankAccount, BankAccountCalculationService, BankAccountChartData, BankAccountCollection, BankAccountProperty, BankAccountService, BankAccountStatusEnum, BankAccountTypeEnum, BankConnection, BankConnectionService, BankConnectionStatusEnum, BankService, BankTransaction, BankTransactionCalculationService, BankTransactionChartData, BankTransactionCollection, BankTransactionService, BankTransactionSummaryFieldsEnum, BankTransactionTypeEnum, BasiqJob, BasiqService, BasiqToken, BorrowingExpense, BorrowingExpenseLoan, BorrowingExpenseService, CAPITAL_COSTS_ITEMS, CHART_ACCOUNTS_CATEGORIES, CalculationFormItem, CalculationFormTypeEnum, CapitalProjectService, ChartAccounts, ChartAccountsCategoryEnum, ChartAccountsDepreciation, ChartAccountsDepreciationService, ChartAccountsEtpEnum, ChartAccountsHeading, ChartAccountsHeadingTaxDeductibleEnum, ChartAccountsHeadingTaxableEnum, ChartAccountsHeadingVehicleListEnum, ChartAccountsListEnum, ChartAccountsMetadata, ChartAccountsMetadataListEnum, ChartAccountsMetadataTypeEnum, ChartAccountsService, ChartAccountsTaxLabelsEnum, ChartAccountsTypeEnum, ChartData, ChartSerie, Chat, ChatService, ChatStatusEnum, ChatViewTypeEnum, ClientCollection, ClientDetails, ClientDetailsMedicareExemptionEnum, ClientDetailsWorkDepreciationCalculationEnum, ClientDetailsWorkingHolidayMakerEnum, ClientInvite, ClientInviteService, ClientInviteStatusEnum, ClientInviteTypeEnum, ClientMovement, ClientMovementCollection, ClientMovementService, ClientPortfolioChartData, ClientPortfolioReport, ClientPortfolioReportCollection, ClientPortfolioReportService, Collection, CollectionDictionary, CorelogicService, CorelogicSuggestion, Country, DEFAULT_VEHICLE_EXPENSE, DEPRECIATION_GROUPS, DOCUMENT_FILE_TYPES, DataTable, DataTableColumn, Depreciation, DepreciationCalculationEnum, DepreciationCalculationPercentEnum, DepreciationCapitalProject, DepreciationCollection, DepreciationForecast, DepreciationForecastCollection, DepreciationGroup, DepreciationGroupEnum, DepreciationGroupItem, DepreciationReceipt, DepreciationService, DepreciationTypeEnum, DepreciationWriteOffAmountEnum, Document, DocumentApiUrlPrefixEnum, DocumentFolder, DocumentFolderService, ENDPOINTS, EmployeeCollection, EmployeeDetails, EmployeeInvite, EmployeeInviteService, EmployeeService, Endpoint, EquityPositionChartService, EventDispatcherService, FinancialYear, Firm, FirmService, FirmTypeEnum, HeaderTitleService, IconsFileEnum, IncomeAmountTypeEnum, IncomePosition, IncomeSource, IncomeSourceChartData, IncomeSourceCollection, IncomeSourceForecast, IncomeSourceForecastService, IncomeSourceService, IncomeSourceType, IncomeSourceTypeEnum, IncomeSourceTypeListOtherEnum, IncomeSourceTypeListSalaryEnum, IncomeSourceTypeListWorkEnum, InterceptorsModule, IntercomService, InviteStatusEnum, JwtService, Loan, LoanBankTypeEnum, LoanCollection, LoanFrequencyEnum, LoanInterestTypeEnum, LoanMaxNumberOfPaymentsEnum, LoanPayment, LoanPayout, LoanPayoutTypeEnum, LoanRepaymentFrequencyEnum, LoanRepaymentTypeEnum, LoanService, LoanTypeEnum, LoanVehicleTypeEnum, LogbookCollection, LogbookPeriod, MODULE_URL_LIST, MONTHS, Message, MessageCollection, MessageDocument, MessageDocumentCollection, MessageDocumentService, MessageService, MonthNameShortEnum, MonthNumberEnum, MyAccountHistory, MyAccountHistoryInitiatedByEnum, MyAccountHistoryStatusEnum, MyAccountHistoryTypeEnum, Notification, NotificationService, Occupation, OccupationService, OwnershipFilterOptionsEnum, PdfService, Phone, PhoneTypeEnum, PreloaderService, Property, PropertyCalculationService, PropertyCapitalCost, PropertyCapitalCostService, PropertyCategory, PropertyCategoryMovement, PropertyCategoryService, PropertyCollection, PropertyDepreciationCalculationEnum, PropertyDocument, PropertyDocumentService, PropertyEquityChartData, PropertyEquityChartItem, PropertyForecast, PropertyOwner, PropertyOwnerAccessEnum, PropertyOwnerService, PropertyOwnerStatusEnum, PropertyService, PropertySold, PropertySoldService, PropertySubscription, PropertyValuation, RegistrationInvite, RegistrationInviteStatusEnum, SUBSCRIPTION_DESCRIPTION, SUBSCRIPTION_TITLE, SalaryForecast, SalaryForecastFrequencyEnum, SalaryForecastService, ServiceNotificationStatusEnum, ServiceNotificationTypeEnum, ServicePayment, ServicePaymentStatusEnum, ServicePrice, ServicePriceCollection, ServicePriceRecurringIntervalEnum, ServicePriceTypeEnum, ServiceProduct, ServiceSubscription, ServiceSubscriptionCollection, ServiceSubscriptionItem, ServiceSubscriptionStatusEnum, SpareDocumentSpareTypeEnum, SseService, SubscriptionService, SubscriptionTypeEnum, TYPE_LOAN, TankTypeEnum, TaxCalculationMedicareExemptionEnum, TaxCalculationTypeEnum, TaxReturnCategoryItem, TaxReturnCategoryItemCollection, TaxReturnCategoryItemDetails, TaxReturnCategoryListEnum, TaxReturnCategorySectionEnum, TaxReview, TaxReviewCollection, TaxReviewHistoryService, TaxReviewService, TaxReviewStatusEnum, TaxSummary, TaxSummaryListEnum, TaxSummarySection, TaxSummarySectionEnum, TaxSummaryService, TaxSummaryTaxSummaryEnum, TaxSummaryTypeEnum, TicketFeedbackEnum, TicketStatusEnum, TicketTypesEnum, Transaction, TransactionAllocation, TransactionAllocationCollection, TransactionAllocationService, TransactionBase, TransactionCalculationService, TransactionCollection, TransactionMetadata, TransactionOperationEnum, TransactionReceipt, TransactionService, TransactionSourceEnum, TransactionTypeEnum, TtCoreModule, USER_ROLES, USER_WORK_POSITION, User, UserEventSetting, UserEventSettingCollection, UserEventSettingFieldEnum, UserEventSettingService, UserEventStatusEnum, UserEventType, UserEventTypeCategory, UserEventTypeClientTypeEnum, UserEventTypeEmployeeTypeEnum, UserEventTypeFrequencyEnum, UserEventTypeService, UserEventTypeUserTypeEnum, UserMedicareExemptionEnum, UserRolesEnum, UserService, UserStatusEnum, UserSwitcherService, UserTitleEnum, UserToRegister, UserWorkDepreciationCalculationEnum, UserWorkingHolidayMakerEnum, Vehicle, VehicleClaim, VehicleClaimMethodEnum, VehicleLogbook, VehicleLogbookPurposeEnum, WORK_TANK_LOGBOOK_PURPOSE_OPTIONS, WorkTankService, XlsxService, cloneDeep, compare, compareMatOptions, createDate, displayMatOptions, enumToList, getDocIcon, replace, roundTo, sort, sortDeep, taxReviewFilterPredicate };
|
|
9864
10315
|
//# sourceMappingURL=taxtank-core.js.map
|