taxtank-core 0.2.4 → 0.3.0
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 +882 -452
- package/bundles/taxtank-core.umd.js.map +1 -1
- package/esm2015/lib/collections/property.collection.js +8 -1
- 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/services/property/equity-position-chart.service.js +45 -0
- package/esm2015/lib/tt-core.module.js +8 -4
- package/esm2015/public-api.js +7 -1
- package/fesm2015/taxtank-core.js +834 -427
- package/fesm2015/taxtank-core.js.map +1 -1
- package/lib/collections/property.collection.d.ts +5 -0
- 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/services/property/equity-position-chart.service.d.ts +15 -0
- package/lib/tt-core.module.d.ts +2 -1
- package/package.json +1 -1
- package/public-api.d.ts +6 -0
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
|
}] });
|
|
@@ -959,6 +1639,12 @@ class PropertyCollection extends AbstractCollection {
|
|
|
959
1639
|
return min < property.purchaseDate ? min : property.purchaseDate;
|
|
960
1640
|
}, new FinancialYear(new Date()).startDate);
|
|
961
1641
|
}
|
|
1642
|
+
/**
|
|
1643
|
+
* Get list of unique property categories from collection
|
|
1644
|
+
*/
|
|
1645
|
+
getCategories() {
|
|
1646
|
+
return uniqBy(this.items.map((property) => property.category), 'id');
|
|
1647
|
+
}
|
|
962
1648
|
}
|
|
963
1649
|
|
|
964
1650
|
class ServicePriceCollection extends AbstractCollection {
|
|
@@ -4245,6 +4931,36 @@ class ClientPortfolioChartData {
|
|
|
4245
4931
|
class ClientPortfolioReport {
|
|
4246
4932
|
}
|
|
4247
4933
|
|
|
4934
|
+
var AlphabetColorsEnum;
|
|
4935
|
+
(function (AlphabetColorsEnum) {
|
|
4936
|
+
AlphabetColorsEnum["A"] = "#9CC3D5";
|
|
4937
|
+
AlphabetColorsEnum["B"] = "#E69A8D";
|
|
4938
|
+
AlphabetColorsEnum["C"] = "#ED2B33";
|
|
4939
|
+
AlphabetColorsEnum["D"] = "#E3CD81";
|
|
4940
|
+
AlphabetColorsEnum["E"] = "#343148";
|
|
4941
|
+
AlphabetColorsEnum["F"] = "#2C5F2D";
|
|
4942
|
+
AlphabetColorsEnum["G"] = "#FFA177";
|
|
4943
|
+
AlphabetColorsEnum["H"] = "#435E55";
|
|
4944
|
+
AlphabetColorsEnum["I"] = "#2BAE66";
|
|
4945
|
+
AlphabetColorsEnum["J"] = "#3C1053";
|
|
4946
|
+
AlphabetColorsEnum["K"] = "#DD4132";
|
|
4947
|
+
AlphabetColorsEnum["L"] = "#FC766A";
|
|
4948
|
+
AlphabetColorsEnum["M"] = "#ADEFD1";
|
|
4949
|
+
AlphabetColorsEnum["N"] = "#79C000";
|
|
4950
|
+
AlphabetColorsEnum["O"] = "#D198C5";
|
|
4951
|
+
AlphabetColorsEnum["P"] = "#5B84B1";
|
|
4952
|
+
AlphabetColorsEnum["Q"] = "#A13941";
|
|
4953
|
+
AlphabetColorsEnum["R"] = "#D85A7F";
|
|
4954
|
+
AlphabetColorsEnum["S"] = "#00203F";
|
|
4955
|
+
AlphabetColorsEnum["T"] = "#42EADD";
|
|
4956
|
+
AlphabetColorsEnum["U"] = "#5F4B8B";
|
|
4957
|
+
AlphabetColorsEnum["V"] = "#FDDB27";
|
|
4958
|
+
AlphabetColorsEnum["W"] = "#CDB599";
|
|
4959
|
+
AlphabetColorsEnum["X"] = "#4B878B";
|
|
4960
|
+
AlphabetColorsEnum["Y"] = "#B0B8B4";
|
|
4961
|
+
AlphabetColorsEnum["Z"] = "#E3C9CE";
|
|
4962
|
+
})(AlphabetColorsEnum || (AlphabetColorsEnum = {}));
|
|
4963
|
+
|
|
4248
4964
|
/**
|
|
4249
4965
|
* Class to generate data-table structure based on provided collection.
|
|
4250
4966
|
* Use to work with HTML/PDF/XLSX tables
|
|
@@ -4363,259 +5079,93 @@ const DEPRECIATION_GROUPS = {
|
|
|
4363
5079
|
}
|
|
4364
5080
|
};
|
|
4365
5081
|
|
|
4366
|
-
class DepreciationReceipt$1 {
|
|
4367
|
-
}
|
|
4368
|
-
|
|
4369
|
-
class DepreciationReceipt extends DepreciationReceipt$1 {
|
|
4370
|
-
constructor() {
|
|
4371
|
-
super(...arguments);
|
|
4372
|
-
this.type = AssetTypeEnum.RECEIPTS;
|
|
4373
|
-
this.entityType = AssetEntityTypeEnum.DEPRECIATIONS;
|
|
4374
|
-
}
|
|
4375
|
-
}
|
|
4376
|
-
|
|
4377
|
-
class Document$1 {
|
|
4378
|
-
}
|
|
4379
|
-
|
|
4380
|
-
/**
|
|
4381
|
-
* Enum with document types which used to API url prefix
|
|
4382
|
-
*/
|
|
4383
|
-
var DocumentApiUrlPrefixEnum;
|
|
4384
|
-
(function (DocumentApiUrlPrefixEnum) {
|
|
4385
|
-
DocumentApiUrlPrefixEnum["FOLDERS"] = "folders";
|
|
4386
|
-
DocumentApiUrlPrefixEnum["PROPERTIES"] = "properties";
|
|
4387
|
-
})(DocumentApiUrlPrefixEnum || (DocumentApiUrlPrefixEnum = {}));
|
|
4388
|
-
|
|
4389
|
-
class Document extends Document$1 {
|
|
4390
|
-
constructor() {
|
|
4391
|
-
super(...arguments);
|
|
4392
|
-
this.type = AssetTypeEnum.DOCUMENTS;
|
|
4393
|
-
this.entityType = AssetEntityTypeEnum.FOLDERS;
|
|
4394
|
-
}
|
|
4395
|
-
/**
|
|
4396
|
-
* Get folder as document parent entity
|
|
4397
|
-
*/
|
|
4398
|
-
getEntity() {
|
|
4399
|
-
return this.folder;
|
|
4400
|
-
}
|
|
4401
|
-
/**
|
|
4402
|
-
* Get API url prefix
|
|
4403
|
-
*/
|
|
4404
|
-
getApiUrlPrefix() {
|
|
4405
|
-
return DocumentApiUrlPrefixEnum.FOLDERS;
|
|
4406
|
-
}
|
|
4407
|
-
}
|
|
4408
|
-
|
|
4409
|
-
const DOCUMENT_FILE_TYPES = {
|
|
4410
|
-
image: [
|
|
4411
|
-
'image/png',
|
|
4412
|
-
'image/jpg',
|
|
4413
|
-
'image/jpeg',
|
|
4414
|
-
'image/tiff',
|
|
4415
|
-
'image/bmp'
|
|
4416
|
-
],
|
|
4417
|
-
all: [
|
|
4418
|
-
'image/png',
|
|
4419
|
-
'image/jpg',
|
|
4420
|
-
'image/jpeg',
|
|
4421
|
-
'image/tiff',
|
|
4422
|
-
'image/bmp',
|
|
4423
|
-
'application/msword',
|
|
4424
|
-
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
4425
|
-
'application/pdf',
|
|
4426
|
-
'application/vnd.ms-excel',
|
|
4427
|
-
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
4428
|
-
'text/csv'
|
|
4429
|
-
]
|
|
4430
|
-
};
|
|
4431
|
-
|
|
4432
|
-
class DocumentFolder$1 {
|
|
4433
|
-
}
|
|
4434
|
-
|
|
4435
|
-
class DocumentFolder extends DocumentFolder$1 {
|
|
4436
|
-
}
|
|
4437
|
-
__decorate([
|
|
4438
|
-
Type(() => Document)
|
|
4439
|
-
], DocumentFolder.prototype, "documents", void 0);
|
|
4440
|
-
|
|
4441
|
-
class EmployeeInvite$1 {
|
|
4442
|
-
}
|
|
4443
|
-
|
|
4444
|
-
class EmployeeInvite extends EmployeeInvite$1 {
|
|
4445
|
-
}
|
|
4446
|
-
__decorate([
|
|
4447
|
-
Type(() => RegistrationInvite)
|
|
4448
|
-
], EmployeeInvite.prototype, "registrationInvite", void 0);
|
|
4449
|
-
__decorate([
|
|
4450
|
-
Type(() => User)
|
|
4451
|
-
], EmployeeInvite.prototype, "employee", void 0);
|
|
4452
|
-
|
|
4453
|
-
/**
|
|
4454
|
-
* Backend endpoint class
|
|
4455
|
-
*/
|
|
4456
|
-
class Endpoint {
|
|
4457
|
-
constructor(method, pattern) {
|
|
4458
|
-
this.method = method;
|
|
4459
|
-
this.pattern = pattern;
|
|
4460
|
-
}
|
|
4461
|
-
/**
|
|
4462
|
-
* check url with regexp
|
|
4463
|
-
* @param url
|
|
4464
|
-
*/
|
|
4465
|
-
test(url) {
|
|
4466
|
-
return this.regexp.test(url);
|
|
4467
|
-
}
|
|
4468
|
-
/**
|
|
4469
|
-
* Get regexp for endpoint
|
|
4470
|
-
*/
|
|
4471
|
-
get regexp() {
|
|
4472
|
-
return new RegExp(`^${this.method} \.\*${this.pattern}$`);
|
|
4473
|
-
}
|
|
4474
|
-
}
|
|
4475
|
-
|
|
4476
|
-
/**
|
|
4477
|
-
* List of all app endpoints
|
|
4478
|
-
*/
|
|
4479
|
-
const ENDPOINTS = {
|
|
4480
|
-
ASSETS_GET: new Endpoint('GET', '\\/assets\\/\.\*\\/\\d+'),
|
|
4481
|
-
BANK_ACCOUNTS_GET: new Endpoint('GET', '\\/bank-accounts'),
|
|
4482
|
-
BANK_ACCOUNTS_POST: new Endpoint('POST', '\\/bank-accounts'),
|
|
4483
|
-
BANK_ACCOUNTS_PUT: new Endpoint('PUT', '\\/bank-accounts\\/\\d+'),
|
|
4484
|
-
BANK_CONNECTION_POST: new Endpoint('POST', '\\/bank-connections'),
|
|
4485
|
-
BANK_TRANSACTIONS_GET: new Endpoint('GET', '\\/bank-transactions'),
|
|
4486
|
-
BANK_TRANSACTIONS_DELETE: new Endpoint('DELETE', '\\/bank-transactions\\/\\d+'),
|
|
4487
|
-
BANK_TRANSACTIONS_IMPORT_POST: new Endpoint('POST', '\\/bank-transactions\\/\\d+\\/import'),
|
|
4488
|
-
BASIQ_ACCOUNTS_GET: new Endpoint('GET', '\\/basiq\\/\\accounts'),
|
|
4489
|
-
CAPITAL_COSTS_GET: new Endpoint('GET', '\\/capital-costs'),
|
|
4490
|
-
CHARTS_INCOME_GET: new Endpoint('GET', '\\/charts\\/\\incomes'),
|
|
4491
|
-
CHARTS_EXPENSES_GET: new Endpoint('GET', '\\/charts\\/\\expenses'),
|
|
4492
|
-
CHART_ACCOUNTS_GET: new Endpoint('GET', '\\/chart-accounts'),
|
|
4493
|
-
CLIENTS_GET: new Endpoint('GET', '\\/clients'),
|
|
4494
|
-
CLIENTS_PUT: new Endpoint('PUT', '\\/clients'),
|
|
4495
|
-
CLIENTS_EXCLUDE_PUT: new Endpoint('PUT', '\\/clients\\/\\d+\\/exclude'),
|
|
4496
|
-
CLIENTS_INVITES_GET: new Endpoint('GET', '\\/clients\\/\\invites'),
|
|
4497
|
-
CLIENTS_INVITES_POST: new Endpoint('POST', '\\/clients\\/\\invites'),
|
|
4498
|
-
CLIENTS_INVITES_DELETE: new Endpoint('DELETE', '\\/clients\\/\\invites\\/\\d+'),
|
|
4499
|
-
CLIENTS_INVITES_ACCEPT_POST: new Endpoint('POST', '\\/clients\\/\\invites\\/\\d+\\/accept'),
|
|
4500
|
-
CLIENTS_INVITES_REJECT_POST: new Endpoint('POST', '\\/clients\\/\\invites\\/\\d+\\/reject'),
|
|
4501
|
-
CLIENTS_INVITES_RESEND_POST: new Endpoint('POST', '\\/clients\\/\\invites\\/\\d+\\/resend'),
|
|
4502
|
-
CLIENT_MOVEMENTS_GET: new Endpoint('GET', '\\/client-movements'),
|
|
4503
|
-
CLIENT_MOVEMENTS_POST: new Endpoint('POST', '\\/client-movements'),
|
|
4504
|
-
COUNTRIES_GET: new Endpoint('GET', '\\/countries'),
|
|
4505
|
-
DEPRECIATIONS_CLOSING_GET: new Endpoint('GET', '\\/depreciations\\/\\closing-balance\.\*'),
|
|
4506
|
-
DEPRECIATIONS_GET: new Endpoint('GET', '\\/depreciations'),
|
|
4507
|
-
DEPRECIATIONS_POST: new Endpoint('POST', '\\/depreciations'),
|
|
4508
|
-
DEPRECIATIONS_PUT: new Endpoint('PUT', '\\/depreciations\\/\\d+'),
|
|
4509
|
-
EMPLOYEES_GET: new Endpoint('GET', '\\/employees'),
|
|
4510
|
-
EMPLOYEES_INVITES_GET: new Endpoint('GET', '\\/employees\\/\\invites'),
|
|
4511
|
-
EMPLOYEES_INVITES_DELETE: new Endpoint('DELETE', '\\/employees\\/\\invites\\/\\d+'),
|
|
4512
|
-
EMPLOYEES_INVITE_POST: new Endpoint('POST', '\\/employees\\/\\invites'),
|
|
4513
|
-
EMPLOYEES_INVITES_REJECT_POST: new Endpoint('POST', '\\/employees\\/\\invites\\/\\d+\\/\\reject'),
|
|
4514
|
-
EMPLOYEES_INVITES_RESEND_POST: new Endpoint('POST', '\\/employees\\/\\invites\\/\\d+\\/\\resend'),
|
|
4515
|
-
FIRM_GET: new Endpoint('GET', '\\/firms'),
|
|
4516
|
-
FIRM_CURRENT_GET: new Endpoint('GET', '\\/firms\\/current'),
|
|
4517
|
-
FIRM_CURRENT_PUT: new Endpoint('PUT', '\\/firms\\/current\.\*'),
|
|
4518
|
-
FIRM_INVITE_POST: new Endpoint('POST', '\\/firms\\/invite'),
|
|
4519
|
-
FIRM_REGISTRATION_POST: new Endpoint('POST', '\\/firms\\/registration'),
|
|
4520
|
-
FIRM_UPDATE_PHOTO_POST: new Endpoint('POST', '\\/firms\\/photo\.\*'),
|
|
4521
|
-
FOLDERS_GET: new Endpoint('GET', '\\/folders'),
|
|
4522
|
-
FOLDERS_POST: new Endpoint('POST', '\\/folders'),
|
|
4523
|
-
FOLDERS_PUT: new Endpoint('PUT', '\\/folders\\/\\d+'),
|
|
4524
|
-
FOLDERS_DOCUMENTS_POST: new Endpoint('POST', '\\/folders\\/\\d+\\/documents'),
|
|
4525
|
-
FOLDERS_DOCUMENTS_PUT: new Endpoint('PUT', '\\/folders\\/\\d+\\/documents\\/\\d+'),
|
|
4526
|
-
INCOME_SOURCES_GET: new Endpoint('GET', '\\/income-sources'),
|
|
4527
|
-
INCOME_SOURCES_POST: new Endpoint('POST', '\\/income-sources'),
|
|
4528
|
-
INCOME_SOURCES_PUT: new Endpoint('PUT', '\\/income-sources'),
|
|
4529
|
-
INCOME_SOURCES_DELETE: new Endpoint('DELETE', '\\/income-sources\\/\\d+'),
|
|
4530
|
-
INCOME_SOURCE_FORECAST_GET: new Endpoint('GET', '\\/income-source-forecasts'),
|
|
4531
|
-
INCOME_SOURCE_FORECAST_POST: new Endpoint('POST', '\\/income-source-forecasts'),
|
|
4532
|
-
INCOME_SOURCE_FORECAST_PUT: new Endpoint('PUT', '\\/income-source-forecasts'),
|
|
4533
|
-
INCOME_SOURCE_FORECAST_DELETE: new Endpoint('DELETE', '\\/income-source-forecasts\\/\\d+'),
|
|
4534
|
-
INCOME_SOURCE_TYPES_GET: new Endpoint('GET', '\\/income-source-types'),
|
|
4535
|
-
LOANS_GET: new Endpoint('GET', '\\/bank-accounts\\/loans'),
|
|
4536
|
-
LOANS_POST: new Endpoint('POST', '\\/bank-accounts\\/loans'),
|
|
4537
|
-
LOANS_PUT: new Endpoint('PUT', '\\/bank-accounts\\/loans/\\d+'),
|
|
4538
|
-
LOANS_PAYOUT_POST: new Endpoint('POST', '\\/loans\\/\\d+\\/payout'),
|
|
4539
|
-
LOANS_PAYOUT_PUT: new Endpoint('PUT', '\\/loans\\/\\d+\\/payout\\/\\d+'),
|
|
4540
|
-
LOANS_PAYOUT_DELETE: new Endpoint('DELETE', '\\/loans\\/\\d+\\/payout\\/\\d+'),
|
|
4541
|
-
LOANS_CALCULATION_POST: new Endpoint('POST', '\\/bank-accounts\\/loans\\/calculation'),
|
|
4542
|
-
LOGIN_CHECK_POST: new Endpoint('POST', '\\/login_check'),
|
|
4543
|
-
NOTIFICATIONS_GET: new Endpoint('GET', '\\/service-notifications'),
|
|
4544
|
-
OCCUPATIONS_GET: new Endpoint('GET', '\\/occupations'),
|
|
4545
|
-
PROPERTIES_GET: new Endpoint('GET', '\\/properties'),
|
|
4546
|
-
PROPERTIES_POST: new Endpoint('POST', '\\/properties'),
|
|
4547
|
-
PROPERTY_PUT: new Endpoint('PUT', '\\/properties/\\d+'),
|
|
4548
|
-
PROPERTIES_PUT: new Endpoint('PUT', '\\/properties'),
|
|
4549
|
-
PROPERTIES_CATEGORIES_EQUITY_GET: new Endpoint('GET', '\\/properties\\/categories\\/equity'),
|
|
4550
|
-
PROPERTIES_CATEGORIES_GET: new Endpoint('GET', '\\/properties\\/categories'),
|
|
4551
|
-
PROPERTIES_CATEGORIES_PUT: new Endpoint('PUT', '\\/properties\\/categories\\/\\d+'),
|
|
4552
|
-
PROPERTIES_CATEGORIES_POST: new Endpoint('POST', '\\/properties\\/categories'),
|
|
4553
|
-
PROPERTIES_CATEGORY_MOVEMENTS_POST: new Endpoint('POST', '\\/properties\\/\\d+\\/category-movements'),
|
|
4554
|
-
PROPERTIES_CATEGORY_MOVEMENTS_PUT: new Endpoint('PUT', '\\/properties\\/\\d+\\/category-movements\\/\\d+'),
|
|
4555
|
-
PROPERTIES_CO_OWNERS_PUT: new Endpoint('PUT', '\\/properties\\/co-owners\\/\\d+'),
|
|
4556
|
-
PROPERTIES_CO_OWNERS_GET: new Endpoint('GET', '\\/properties\\/co-owners'),
|
|
4557
|
-
PROPERTIES_CO_OWNERS_POST: new Endpoint('POST', '\\/properties\\/co-owners'),
|
|
4558
|
-
PROPERTIES_DEACTIVATE_PUT: new Endpoint('PUT', '\\/properties\\/\\d+\\/deactivate'),
|
|
4559
|
-
PROPERTIES_DEPRECIATION_CAPITAL_PROJECT_GET: new Endpoint('GET', '\\/properties\\/\\d+\\/depreciation-capital-projects'),
|
|
4560
|
-
PROPERTIES_DEPRECIATION_CAPITAL_PROJECT_POST: new Endpoint('POST', '\\/properties\\/\\d+\\/depreciation-capital-projects'),
|
|
4561
|
-
PROPERTIES_DEPRECIATION_CAPITAL_PROJECT_PUT: new Endpoint('PUT', '\\/properties\\/\\d+\\/depreciation-capital-projects\\/\\d+'),
|
|
4562
|
-
PROPERTIES_DEPRECIATION_CAPITAL_PROJECT_DELETE: new Endpoint('DELETE', '\\/properties\\/\\d+\\/depreciation-capital-projects\\/\\d+'),
|
|
4563
|
-
PROPERTIES_DOCUMENTS_GET: new Endpoint('GET', '\\/properties\\/documents'),
|
|
4564
|
-
PROPERTIES_DOCUMENTS_POST: new Endpoint('POST', '\\/properties\\/\\d+\\/documents'),
|
|
4565
|
-
PROPERTIES_DOCUMENTS_PUT: new Endpoint('PUT', '\\/properties\\/documents\\/\\d+'),
|
|
4566
|
-
PROPERTIES_DOCUMENTS_DELETE: new Endpoint('DELETE', '\\/properties\\/documents\\/\\d+'),
|
|
4567
|
-
PROPERTIES_PHOTO_POST: new Endpoint('POST', '\\/properties\\/\\d+\\/photo\.\*'),
|
|
4568
|
-
PROPERTIES_SUGGESTIONS_GET: new Endpoint('GET', '/property\\/\\w+\\/v2\\/.*$'),
|
|
4569
|
-
PROPERTIES_VALUATIONS_DOCUMENTS_POST: new Endpoint('POST', '\\/properties\\/\\d+\\/valuations\\/\\d+\\/documents'),
|
|
4570
|
-
PRORATION_COST_POST: new Endpoint('POST', '\\/subscriptions\\/proration-cost'),
|
|
4571
|
-
SALARY_FORECAST_GET: new Endpoint('GET', '\\/salary-forecasts'),
|
|
4572
|
-
SALARY_FORECAST_POST: new Endpoint('POST', '\\/salary-forecasts'),
|
|
4573
|
-
SALARY_FORECAST_PUT: new Endpoint('PUT', '\\/salary-forecasts'),
|
|
4574
|
-
SERVICE_PRICES_GET: new Endpoint('GET', '\\/service-prices'),
|
|
4575
|
-
SERVICE_PAYMENTS_GET: new Endpoint('GET', '\\/service-payments'),
|
|
4576
|
-
STRIPE_BILLING_PORTAL_GET: new Endpoint('GET', '\\/stripe\\/billing-portal-session'),
|
|
4577
|
-
STRIPE_CHECKOUT_SESSION_POST: new Endpoint('POST', '\\/stripe\\/checkout-session'),
|
|
4578
|
-
SUBSCRIPTION_LAST_GET: new Endpoint('GET', '\\/subscriptions\\/last'),
|
|
4579
|
-
SUBSCRIPTION_ITEMS_PUT: new Endpoint('PUT', '\\/subscriptions\\/items'),
|
|
4580
|
-
TAX_CALCULATION_POST: new Endpoint('POST', '\\/tax-calculation'),
|
|
4581
|
-
TAX_REVIEWS_GET: new Endpoint('GET', '\\/tax-reviews'),
|
|
4582
|
-
TAX_REVIEWS_DELETE: new Endpoint('DELETE', '\\/tax-reviews\\/\\d+'),
|
|
4583
|
-
TAX_REVIEWS_POST: new Endpoint('POST', '\\/tax-reviews'),
|
|
4584
|
-
TAX_REVIEWS_PUT: new Endpoint('PUT', '\\/tax-reviews\\/\\d+'),
|
|
4585
|
-
TAX_SUMMARY_ACTUAL_GET: new Endpoint('GET', '\\/tax-summary\\/actuals'),
|
|
4586
|
-
TAX_SUMMARY_FORECAST_GET: new Endpoint('GET', '\\/tax-summary\\/forecasts'),
|
|
4587
|
-
TRANSACTION_DELETE: new Endpoint('DELETE', '\\/transactions\\/\\d+'),
|
|
4588
|
-
TRANSACTION_PUT: new Endpoint('PUT', '\\/transactions\\/\\d+'),
|
|
4589
|
-
TRANSACTIONS_GET: new Endpoint('GET', '\\/transactions'),
|
|
4590
|
-
TRANSACTIONS_POST: new Endpoint('POST', '\\/transactions'),
|
|
4591
|
-
TRANSACTIONS_PUT: new Endpoint('PUT', '\\/transactions'),
|
|
4592
|
-
TRANSACTIONS_ALLOCATIONS_GET: new Endpoint('GET', '\\/transactions-allocations'),
|
|
4593
|
-
TRANSACTIONS_ALLOCATIONS_POST: new Endpoint('POST', '\\/transactions-allocations'),
|
|
4594
|
-
TRANSACTIONS_ALLOCATIONS_DELETE: new Endpoint('DELETE', '\\/transactions-allocations\\/\\d+'),
|
|
4595
|
-
USER_CONFIRMATION_POST: new Endpoint('POST', '\\/users\\/confirmation'),
|
|
4596
|
-
USER_CURRENT_GET: new Endpoint('GET', '\\/users\\/current'),
|
|
4597
|
-
USER_CURRENT_PASSWORD_PUT: new Endpoint('PUT', '\\/users\\/current\\/password\.\*'),
|
|
4598
|
-
USER_EVENT_SETTINGS_GET: new Endpoint('GET', '\\/user-event-settings'),
|
|
4599
|
-
USER_EVENT_TYPES_GET: new Endpoint('GET', '\\/user-event-types'),
|
|
4600
|
-
USER_INVITE_DELETE: new Endpoint('DELETE', '\\/users\\/invite\\/\\d+'),
|
|
4601
|
-
USER_INVITE_POST: new Endpoint('POST', '\\/users\\/invite'),
|
|
4602
|
-
USER_INVITE_RESEND_POST: new Endpoint('POST', '\\/users\\/invite/\\d+\\/resend'),
|
|
4603
|
-
USER_PUT: new Endpoint('PUT', '\\/users\\/\\d+'),
|
|
4604
|
-
USER_REGISTRATION_POST: new Endpoint('POST', '\\/users\\/registration'),
|
|
4605
|
-
USER_RESET_PASSWORD_PUT: new Endpoint('PUT', '\\/users\\/reset-password'),
|
|
4606
|
-
USER_SEARCH_GET: new Endpoint('GET', '\\/users\\/search\.\*'),
|
|
4607
|
-
USER_UPDATE_PHOTO_POST: new Endpoint('POST', '\\/users\\/photo\.\*'),
|
|
4608
|
-
USER_STATUS_PUT: new Endpoint('PUT', '\\/users\\/status'),
|
|
4609
|
-
VEHICLES_GET: new Endpoint('GET', '\\/vehicles'),
|
|
4610
|
-
VEHICLES_POST: new Endpoint('POST', '\\/vehicles'),
|
|
4611
|
-
VEHICLES_PUT: new Endpoint('PUT', '\\/vehicles\\/\\d+'),
|
|
4612
|
-
VEHICLE_CLAIMS_GET: new Endpoint('GET', '\\/vehicle-claims'),
|
|
4613
|
-
VEHICLE_CLAIMS_POST: new Endpoint('POST', '\\/vehicle-claims'),
|
|
4614
|
-
VEHICLE_LOGBOOK_POST: new Endpoint('POST', '\\/vehicles\\/\\d+\\/logbooks'),
|
|
4615
|
-
VEHICLE_LOGBOOK_PUT: new Endpoint('PUT', '\\/vehicles\\/\\d+\\/logbooks\\/\\d+'),
|
|
4616
|
-
VEHICLE_CLAIMS_PUT: new Endpoint('PUT', '\\/vehicle-claims\\/\\d+')
|
|
4617
|
-
};
|
|
4618
|
-
|
|
5082
|
+
class DepreciationReceipt$1 {
|
|
5083
|
+
}
|
|
5084
|
+
|
|
5085
|
+
class DepreciationReceipt extends DepreciationReceipt$1 {
|
|
5086
|
+
constructor() {
|
|
5087
|
+
super(...arguments);
|
|
5088
|
+
this.type = AssetTypeEnum.RECEIPTS;
|
|
5089
|
+
this.entityType = AssetEntityTypeEnum.DEPRECIATIONS;
|
|
5090
|
+
}
|
|
5091
|
+
}
|
|
5092
|
+
|
|
5093
|
+
class Document$1 {
|
|
5094
|
+
}
|
|
5095
|
+
|
|
5096
|
+
/**
|
|
5097
|
+
* Enum with document types which used to API url prefix
|
|
5098
|
+
*/
|
|
5099
|
+
var DocumentApiUrlPrefixEnum;
|
|
5100
|
+
(function (DocumentApiUrlPrefixEnum) {
|
|
5101
|
+
DocumentApiUrlPrefixEnum["FOLDERS"] = "folders";
|
|
5102
|
+
DocumentApiUrlPrefixEnum["PROPERTIES"] = "properties";
|
|
5103
|
+
})(DocumentApiUrlPrefixEnum || (DocumentApiUrlPrefixEnum = {}));
|
|
5104
|
+
|
|
5105
|
+
class Document extends Document$1 {
|
|
5106
|
+
constructor() {
|
|
5107
|
+
super(...arguments);
|
|
5108
|
+
this.type = AssetTypeEnum.DOCUMENTS;
|
|
5109
|
+
this.entityType = AssetEntityTypeEnum.FOLDERS;
|
|
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
|
+
]
|
|
5146
|
+
};
|
|
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
|
+
|
|
4619
5169
|
/**
|
|
4620
5170
|
* any event happened in the app, which needs to be handled somehow (distributed to other part of the app)
|
|
4621
5171
|
*/
|
|
@@ -4945,13 +5495,6 @@ const CAPITAL_COSTS_ITEMS = [
|
|
|
4945
5495
|
}),
|
|
4946
5496
|
];
|
|
4947
5497
|
|
|
4948
|
-
/**
|
|
4949
|
-
* https://api-uat.corelogic.asia/property/au/v2/suggest.json
|
|
4950
|
-
* address suggestion from corelogic service
|
|
4951
|
-
*/
|
|
4952
|
-
class CorelogicSuggestion {
|
|
4953
|
-
}
|
|
4954
|
-
|
|
4955
5498
|
/**
|
|
4956
5499
|
* Enum with properties ownership filter options
|
|
4957
5500
|
*/
|
|
@@ -5563,41 +6106,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
5563
6106
|
args: ['environment']
|
|
5564
6107
|
}] }]; } });
|
|
5565
6108
|
|
|
5566
|
-
const KEY = '_switch_user';
|
|
5567
|
-
/**
|
|
5568
|
-
* provides user management to managers (users with ROLE_ACCOUNTANT for now, more in future)
|
|
5569
|
-
*/
|
|
5570
|
-
class UserSwitcherService {
|
|
5571
|
-
/**
|
|
5572
|
-
* get switched username
|
|
5573
|
-
*/
|
|
5574
|
-
get() {
|
|
5575
|
-
return localStorage[KEY];
|
|
5576
|
-
}
|
|
5577
|
-
/**
|
|
5578
|
-
* switch to user (username should be used for correct work of backend)
|
|
5579
|
-
*/
|
|
5580
|
-
set(username) {
|
|
5581
|
-
localStorage[KEY] = username;
|
|
5582
|
-
window.location.replace('/client/dashboard');
|
|
5583
|
-
}
|
|
5584
|
-
/**
|
|
5585
|
-
* go back to original user
|
|
5586
|
-
*/
|
|
5587
|
-
reset() {
|
|
5588
|
-
localStorage.removeItem(KEY);
|
|
5589
|
-
window.location.replace('/firm/dashboard');
|
|
5590
|
-
}
|
|
5591
|
-
}
|
|
5592
|
-
UserSwitcherService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: UserSwitcherService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5593
|
-
UserSwitcherService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: UserSwitcherService, providedIn: 'root' });
|
|
5594
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: UserSwitcherService, decorators: [{
|
|
5595
|
-
type: Injectable,
|
|
5596
|
-
args: [{
|
|
5597
|
-
providedIn: 'root'
|
|
5598
|
-
}]
|
|
5599
|
-
}] });
|
|
5600
|
-
|
|
5601
6109
|
/**
|
|
5602
6110
|
* Service to work with assets (documents, receipts, e.t.c.)
|
|
5603
6111
|
*/
|
|
@@ -5645,79 +6153,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
5645
6153
|
args: ['environment']
|
|
5646
6154
|
}] }]; } });
|
|
5647
6155
|
|
|
5648
|
-
const NAME_TOKEN = 'token';
|
|
5649
|
-
const NAME_REFRESH_TOKEN = 'refreshToken';
|
|
5650
|
-
class JwtService extends JwtHelperService {
|
|
5651
|
-
getToken() {
|
|
5652
|
-
return localStorage[NAME_TOKEN];
|
|
5653
|
-
}
|
|
5654
|
-
getRefreshToken() {
|
|
5655
|
-
return localStorage[NAME_REFRESH_TOKEN];
|
|
5656
|
-
}
|
|
5657
|
-
saveTokens(tokens) {
|
|
5658
|
-
localStorage[NAME_TOKEN] = tokens.token;
|
|
5659
|
-
localStorage[NAME_REFRESH_TOKEN] = tokens.refreshToken;
|
|
5660
|
-
}
|
|
5661
|
-
destroyTokens() {
|
|
5662
|
-
localStorage.removeItem(NAME_TOKEN);
|
|
5663
|
-
localStorage.removeItem(NAME_REFRESH_TOKEN);
|
|
5664
|
-
}
|
|
5665
|
-
getUser() {
|
|
5666
|
-
return this.decodeToken();
|
|
5667
|
-
}
|
|
5668
|
-
isMe(userId) {
|
|
5669
|
-
return this.getUser().id === userId;
|
|
5670
|
-
}
|
|
5671
|
-
}
|
|
5672
|
-
JwtService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: JwtService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
5673
|
-
JwtService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: JwtService, providedIn: 'root' });
|
|
5674
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: JwtService, decorators: [{
|
|
5675
|
-
type: Injectable,
|
|
5676
|
-
args: [{
|
|
5677
|
-
providedIn: 'root'
|
|
5678
|
-
}]
|
|
5679
|
-
}] });
|
|
5680
|
-
|
|
5681
|
-
class AuthService {
|
|
5682
|
-
constructor(http, jwtService, environment) {
|
|
5683
|
-
this.http = http;
|
|
5684
|
-
this.jwtService = jwtService;
|
|
5685
|
-
this.environment = environment;
|
|
5686
|
-
this.isLoggedInSubject = new BehaviorSubject(!this.jwtService.isTokenExpired());
|
|
5687
|
-
}
|
|
5688
|
-
setAuth(response) {
|
|
5689
|
-
this.jwtService.saveTokens(response);
|
|
5690
|
-
this.isLoggedInSubject.next(true);
|
|
5691
|
-
}
|
|
5692
|
-
login(username, password) {
|
|
5693
|
-
return this.http.post(`${this.environment.apiV2}/login_check`, { username, password }).pipe(map((response) => {
|
|
5694
|
-
this.setAuth(response);
|
|
5695
|
-
return response;
|
|
5696
|
-
}));
|
|
5697
|
-
}
|
|
5698
|
-
refresh(refreshToken) {
|
|
5699
|
-
return this.http.post(`${this.environment.apiV2}/token/refresh`, { refreshToken }).pipe(map((response) => {
|
|
5700
|
-
this.setAuth(response);
|
|
5701
|
-
return response;
|
|
5702
|
-
}));
|
|
5703
|
-
}
|
|
5704
|
-
logoutFront(url = '/login') {
|
|
5705
|
-
localStorage.clear();
|
|
5706
|
-
location.replace(url);
|
|
5707
|
-
}
|
|
5708
|
-
}
|
|
5709
|
-
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 });
|
|
5710
|
-
AuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AuthService, providedIn: 'root' });
|
|
5711
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AuthService, decorators: [{
|
|
5712
|
-
type: Injectable,
|
|
5713
|
-
args: [{
|
|
5714
|
-
providedIn: 'root'
|
|
5715
|
-
}]
|
|
5716
|
-
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: JwtService }, { type: undefined, decorators: [{
|
|
5717
|
-
type: Inject,
|
|
5718
|
-
args: ['environment']
|
|
5719
|
-
}] }]; } });
|
|
5720
|
-
|
|
5721
6156
|
// replace array element with the new one (only arrays of objects)
|
|
5722
6157
|
function replace(array, item, matchField = 'id') {
|
|
5723
6158
|
const index = array.findIndex((i) => i[matchField] === item[matchField]);
|
|
@@ -8022,63 +8457,35 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
8022
8457
|
}]
|
|
8023
8458
|
}] });
|
|
8024
8459
|
|
|
8025
|
-
|
|
8026
|
-
|
|
8027
|
-
|
|
8028
|
-
|
|
8029
|
-
get() {
|
|
8030
|
-
return this.activePreloaders.asObservable();
|
|
8031
|
-
}
|
|
8032
|
-
add(endpoint) {
|
|
8033
|
-
const activePreloaders = this.activePreloaders.getValue();
|
|
8034
|
-
activePreloaders.push(endpoint);
|
|
8035
|
-
this.activePreloaders.next(activePreloaders);
|
|
8036
|
-
}
|
|
8037
|
-
delete(endpoint) {
|
|
8038
|
-
let activePreloaders = this.activePreloaders.getValue();
|
|
8039
|
-
activePreloaders = activePreloaders.filter((preloader) => preloader !== endpoint);
|
|
8040
|
-
this.activePreloaders.next(activePreloaders);
|
|
8041
|
-
}
|
|
8042
|
-
}
|
|
8043
|
-
PreloaderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PreloaderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
8044
|
-
PreloaderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PreloaderService, providedIn: 'root' });
|
|
8045
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PreloaderService, decorators: [{
|
|
8046
|
-
type: Injectable,
|
|
8047
|
-
args: [{
|
|
8048
|
-
providedIn: 'root'
|
|
8049
|
-
}]
|
|
8050
|
-
}], ctorParameters: function () { return []; } });
|
|
8051
|
-
|
|
8052
|
-
class CorelogicService {
|
|
8460
|
+
/**
|
|
8461
|
+
* Service for get property equity position half-year history chart data
|
|
8462
|
+
*/
|
|
8463
|
+
class EquityPositionChartService {
|
|
8053
8464
|
constructor(http, environment) {
|
|
8054
8465
|
this.http = http;
|
|
8055
8466
|
this.environment = environment;
|
|
8056
|
-
this.accessTokenSubject = new ReplaySubject(1);
|
|
8057
|
-
}
|
|
8058
|
-
getAccessToken(force = false) {
|
|
8059
|
-
if (!this._accessToken || force) {
|
|
8060
|
-
this.http.get(`${this.environment.coreLogicUrl}/access/oauth/token?grant_type=client_credentials&client_id=${this.environment.coreLogicId}&client_secret=${this.environment.coreLogicSecret}`)
|
|
8061
|
-
.pipe(map((response) => {
|
|
8062
|
-
return response.access_token;
|
|
8063
|
-
}))
|
|
8064
|
-
.subscribe((token) => {
|
|
8065
|
-
this._accessToken = token;
|
|
8066
|
-
this.accessTokenSubject.next(this._accessToken);
|
|
8067
|
-
});
|
|
8068
|
-
}
|
|
8069
|
-
return this.accessTokenSubject.asObservable();
|
|
8070
8467
|
}
|
|
8071
|
-
|
|
8072
|
-
// @TODO
|
|
8073
|
-
return this.http.get(`${this.environment.
|
|
8468
|
+
get() {
|
|
8469
|
+
// @TODO refactor backend
|
|
8470
|
+
return this.http.get(`${this.environment.apiV2}/properties/categories/equity`)
|
|
8074
8471
|
.pipe(map((response) => {
|
|
8075
|
-
return response.
|
|
8472
|
+
return response.map((item) => {
|
|
8473
|
+
return plainToClass(ChartData, {
|
|
8474
|
+
name: item.category.name,
|
|
8475
|
+
data: item.equity.map((serie) => {
|
|
8476
|
+
return plainToClass(ChartSerie, {
|
|
8477
|
+
label: serie.date,
|
|
8478
|
+
value: serie.amount
|
|
8479
|
+
});
|
|
8480
|
+
})
|
|
8481
|
+
});
|
|
8482
|
+
});
|
|
8076
8483
|
}));
|
|
8077
8484
|
}
|
|
8078
8485
|
}
|
|
8079
|
-
|
|
8080
|
-
|
|
8081
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type:
|
|
8486
|
+
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 });
|
|
8487
|
+
EquityPositionChartService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: EquityPositionChartService, providedIn: 'root' });
|
|
8488
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: EquityPositionChartService, decorators: [{
|
|
8082
8489
|
type: Injectable,
|
|
8083
8490
|
args: [{
|
|
8084
8491
|
providedIn: 'root'
|
|
@@ -9865,5 +10272,5 @@ function taxReviewFilterPredicate(data, filter) {
|
|
|
9865
10272
|
* Generated bundle index. Do not edit.
|
|
9866
10273
|
*/
|
|
9867
10274
|
|
|
9868
|
-
export { AbstractCollection, Address, AddressService, AddressTypeEnum, 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, 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, EventDispatcherService, FinancialYear, Firm, FirmService, FirmTypeEnum, HeaderTitleService, IconsFileEnum, IncomeAmountTypeEnum, IncomePosition, IncomeSource, IncomeSourceChartData, IncomeSourceCollection, IncomeSourceForecast, IncomeSourceForecastService, IncomeSourceService, IncomeSourceType, IncomeSourceTypeEnum, IncomeSourceTypeListOtherEnum, IncomeSourceTypeListSalaryEnum, IncomeSourceTypeListWorkEnum, 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 };
|
|
10275
|
+
export { AbstractCollection, 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, 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 };
|
|
9869
10276
|
//# sourceMappingURL=taxtank-core.js.map
|