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.
Files changed (27) hide show
  1. package/bundles/taxtank-core.umd.js +882 -452
  2. package/bundles/taxtank-core.umd.js.map +1 -1
  3. package/esm2015/lib/collections/property.collection.js +8 -1
  4. package/esm2015/lib/interceptors/corelogic-interceptor.js +44 -0
  5. package/esm2015/lib/interceptors/financial-year-interceptor.js +30 -0
  6. package/esm2015/lib/interceptors/interceptors.module.js +74 -0
  7. package/esm2015/lib/interceptors/jwt-interceptor.js +137 -0
  8. package/esm2015/lib/interceptors/preloader.interceptor.js +32 -0
  9. package/esm2015/lib/interceptors/user-switcher-interceptor.js +42 -0
  10. package/esm2015/lib/models/color/alphabet-colors.enum.js +30 -0
  11. package/esm2015/lib/services/property/equity-position-chart.service.js +45 -0
  12. package/esm2015/lib/tt-core.module.js +8 -4
  13. package/esm2015/public-api.js +7 -1
  14. package/fesm2015/taxtank-core.js +834 -427
  15. package/fesm2015/taxtank-core.js.map +1 -1
  16. package/lib/collections/property.collection.d.ts +5 -0
  17. package/lib/interceptors/corelogic-interceptor.d.ts +20 -0
  18. package/lib/interceptors/financial-year-interceptor.d.ts +12 -0
  19. package/lib/interceptors/interceptors.module.d.ts +6 -0
  20. package/lib/interceptors/jwt-interceptor.d.ts +42 -0
  21. package/lib/interceptors/preloader.interceptor.d.ts +15 -0
  22. package/lib/interceptors/user-switcher-interceptor.d.ts +19 -0
  23. package/lib/models/color/alphabet-colors.enum.d.ts +28 -0
  24. package/lib/services/property/equity-position-chart.service.d.ts +15 -0
  25. package/lib/tt-core.module.d.ts +2 -1
  26. package/package.json +1 -1
  27. package/public-api.d.ts +6 -0
@@ -1,5 +1,6 @@
1
1
  import { AbstractCollection } from './abstract.collection';
2
2
  import { Property } from '../models/property/property';
3
+ import { PropertyCategory } from '../models/property/property-category';
3
4
  export declare class PropertyCollection extends AbstractCollection<Property> {
4
5
  /**
5
6
  * Get new property collection filtered by category id
@@ -30,4 +31,8 @@ export declare class PropertyCollection extends AbstractCollection<Property> {
30
31
  get marketValueGrowth(): number;
31
32
  getOwnerOccupiedProperties(): PropertyCollection;
32
33
  get earliestPurchaseDate(): Date;
34
+ /**
35
+ * Get list of unique property categories from collection
36
+ */
37
+ getCategories(): PropertyCategory[];
33
38
  }
@@ -0,0 +1,20 @@
1
+ import { Observable } from 'rxjs';
2
+ import { HttpRequest, HttpHandler, HttpEvent, HttpInterceptor } from '@angular/common/http';
3
+ import { CorelogicService } from '../services/property/corelogic.service';
4
+ import * as i0 from "@angular/core";
5
+ /**
6
+ * Corelogic interceptor add Core Logic access token for each search requests related with Core Logic API
7
+ */
8
+ export declare class CorelogicInterceptor implements HttpInterceptor {
9
+ private corelogicService;
10
+ private environment;
11
+ constructor(corelogicService: CorelogicService, environment: any);
12
+ /**
13
+ * Check if requested url requested core logic, but not core logic auth api
14
+ * @param req
15
+ */
16
+ addToken(req: HttpRequest<any>): HttpRequest<any>;
17
+ intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>>;
18
+ static ɵfac: i0.ɵɵFactoryDeclaration<CorelogicInterceptor, never>;
19
+ static ɵprov: i0.ɵɵInjectableDeclaration<CorelogicInterceptor>;
20
+ }
@@ -0,0 +1,12 @@
1
+ import { Observable } from 'rxjs';
2
+ import { HttpRequest, HttpHandler, HttpEvent, HttpInterceptor } from '@angular/common/http';
3
+ import * as i0 from "@angular/core";
4
+ /**
5
+ * Financial Year interceptor add financialYear parameter to requests because a lot of POST and GET requests require this parameter
6
+ * @TODO now we can get current fin year from user on backend. So we can remove this interceptor
7
+ */
8
+ export declare class FinancialYearInterceptor implements HttpInterceptor {
9
+ intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>>;
10
+ static ɵfac: i0.ɵɵFactoryDeclaration<FinancialYearInterceptor, never>;
11
+ static ɵprov: i0.ɵɵInjectableDeclaration<FinancialYearInterceptor>;
12
+ }
@@ -0,0 +1,6 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class InterceptorsModule {
3
+ static ɵfac: i0.ɵɵFactoryDeclaration<InterceptorsModule, never>;
4
+ static ɵmod: i0.ɵɵNgModuleDeclaration<InterceptorsModule, never, never, never>;
5
+ static ɵinj: i0.ɵɵInjectorDeclaration<InterceptorsModule>;
6
+ }
@@ -0,0 +1,42 @@
1
+ import { BehaviorSubject, Observable } from 'rxjs';
2
+ import { HttpErrorResponse, HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http';
3
+ import { JwtService } from '../services/auth/jwt.service';
4
+ import { AuthService } from '../services/auth/auth.service';
5
+ import * as i0 from "@angular/core";
6
+ /**
7
+ * JWT Interceptor add jwt token to each request related with TaxTank API
8
+ */
9
+ export declare class JwtInterceptor implements HttpInterceptor {
10
+ jwtService: JwtService;
11
+ private authService;
12
+ private environment;
13
+ isRefreshingToken: boolean;
14
+ tokenSubject: BehaviorSubject<string>;
15
+ constructor(jwtService: JwtService, authService: AuthService, environment: any);
16
+ addToken(req: HttpRequest<any>): HttpRequest<any>;
17
+ intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>>;
18
+ /**
19
+ * @TODO log
20
+ * @TODO waiting for backend to handle errors in a better way
21
+ */
22
+ handle400Error(err: HttpErrorResponse): void;
23
+ /**
24
+ * @TODO log
25
+ * @TODO waiting for backend to handle errors in a better way
26
+ */
27
+ handle403Error(err: HttpErrorResponse): void;
28
+ /**
29
+ * @TODO log
30
+ */
31
+ handle500Error(): void;
32
+ handle401Error(req: HttpRequest<any>, next: HttpHandler, err: HttpErrorResponse): Observable<HttpEvent<any>>;
33
+ /**
34
+ * Handle error messages
35
+ * @param errorResponse from which messages should be taken
36
+ *
37
+ * @TODO move to separated interceptor
38
+ */
39
+ private showErrorMessages;
40
+ static ɵfac: i0.ɵɵFactoryDeclaration<JwtInterceptor, never>;
41
+ static ɵprov: i0.ɵɵInjectableDeclaration<JwtInterceptor>;
42
+ }
@@ -0,0 +1,15 @@
1
+ import { HttpRequest, HttpHandler, HttpEvent, HttpInterceptor } from '@angular/common/http';
2
+ import { Observable } from 'rxjs';
3
+ import { PreloaderService } from '../services/preloader/preloader.service';
4
+ import * as i0 from "@angular/core";
5
+ /**
6
+ * interceptor for preloader handling
7
+ */
8
+ export declare class PreloaderInterceptor implements HttpInterceptor {
9
+ private preloaderService;
10
+ constructor(preloaderService: PreloaderService);
11
+ intercept(request: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>>;
12
+ private findEndpoint;
13
+ static ɵfac: i0.ɵɵFactoryDeclaration<PreloaderInterceptor, never>;
14
+ static ɵprov: i0.ɵɵInjectableDeclaration<PreloaderInterceptor>;
15
+ }
@@ -0,0 +1,19 @@
1
+ import { Observable } from 'rxjs';
2
+ import { HttpRequest, HttpHandler, HttpEvent, HttpInterceptor } from '@angular/common/http';
3
+ import { UserSwitcherService } from '../services/user/user-switcher.service';
4
+ import * as i0 from "@angular/core";
5
+ /**
6
+ * Impersonate current's user (manager) to client experience with help of special header
7
+ */
8
+ export declare class UserSwitcherInterceptor implements HttpInterceptor {
9
+ userSwitcherService: UserSwitcherService;
10
+ private environment;
11
+ constructor(userSwitcherService: UserSwitcherService, environment: any);
12
+ /**
13
+ * add token header if request url contain TaxTank API URL
14
+ */
15
+ switch(req: HttpRequest<any>, username: string): HttpRequest<any>;
16
+ intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>>;
17
+ static ɵfac: i0.ɵɵFactoryDeclaration<UserSwitcherInterceptor, never>;
18
+ static ɵprov: i0.ɵɵInjectableDeclaration<UserSwitcherInterceptor>;
19
+ }
@@ -0,0 +1,28 @@
1
+ export declare enum AlphabetColorsEnum {
2
+ A = "#9CC3D5",
3
+ B = "#E69A8D",
4
+ C = "#ED2B33",
5
+ D = "#E3CD81",
6
+ E = "#343148",
7
+ F = "#2C5F2D",
8
+ G = "#FFA177",
9
+ H = "#435E55",
10
+ I = "#2BAE66",
11
+ J = "#3C1053",
12
+ K = "#DD4132",
13
+ L = "#FC766A",
14
+ M = "#ADEFD1",
15
+ N = "#79C000",
16
+ O = "#D198C5",
17
+ P = "#5B84B1",
18
+ Q = "#A13941",
19
+ R = "#D85A7F",
20
+ S = "#00203F",
21
+ T = "#42EADD",
22
+ U = "#5F4B8B",
23
+ V = "#FDDB27",
24
+ W = "#CDB599",
25
+ X = "#4B878B",
26
+ Y = "#B0B8B4",
27
+ Z = "#E3C9CE"
28
+ }
@@ -0,0 +1,15 @@
1
+ import { Observable } from 'rxjs';
2
+ import { HttpClient } from '@angular/common/http';
3
+ import { ChartData } from '../../models/chart/chart-data';
4
+ import * as i0 from "@angular/core";
5
+ /**
6
+ * Service for get property equity position half-year history chart data
7
+ */
8
+ export declare class EquityPositionChartService {
9
+ private http;
10
+ private environment;
11
+ constructor(http: HttpClient, environment: any);
12
+ get(): Observable<ChartData[]>;
13
+ static ɵfac: i0.ɵɵFactoryDeclaration<EquityPositionChartService, never>;
14
+ static ɵprov: i0.ɵɵInjectableDeclaration<EquityPositionChartService>;
15
+ }
@@ -1,9 +1,10 @@
1
1
  import { ModuleWithProviders } from '@angular/core';
2
2
  import * as i0 from "@angular/core";
3
3
  import * as i1 from "@angular/common";
4
+ import * as i2 from "./interceptors/interceptors.module";
4
5
  export declare class TtCoreModule {
5
6
  static forRoot(environment: object): ModuleWithProviders<TtCoreModule>;
6
7
  static ɵfac: i0.ɵɵFactoryDeclaration<TtCoreModule, never>;
7
- static ɵmod: i0.ɵɵNgModuleDeclaration<TtCoreModule, never, [typeof i1.CommonModule], never>;
8
+ static ɵmod: i0.ɵɵNgModuleDeclaration<TtCoreModule, never, [typeof i1.CommonModule, typeof i2.InterceptorsModule], never>;
8
9
  static ɵinj: i0.ɵɵInjectorDeclaration<TtCoreModule>;
9
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taxtank-core",
3
- "version": "0.2.4",
3
+ "version": "0.3.0",
4
4
  "private": false,
5
5
  "peerDependencies": {
6
6
  "@angular/common": "^12.2.3 || ~13.0.0",
package/public-api.d.ts CHANGED
@@ -150,6 +150,7 @@ export * from './lib/models/client/client-invite';
150
150
  export * from './lib/models/client/client-movement';
151
151
  export * from './lib/models/client/client-portfolio-chart-data';
152
152
  export * from './lib/models/client/client-portfolio-report';
153
+ export * from './lib/models/color/alphabet-colors.enum';
153
154
  export * from './lib/models/data-table/data-table';
154
155
  export * from './lib/models/data-table/data-table-column';
155
156
  export * from './lib/models/depreciation/depreciation';
@@ -286,6 +287,7 @@ export * from './lib/services/notification/notification.service';
286
287
  export * from './lib/services/pdf/pdf.service';
287
288
  export * from './lib/services/preloader/preloader.service';
288
289
  export * from './lib/services/property/corelogic.service';
290
+ export * from './lib/services/property/equity-position-chart.service';
289
291
  export * from './lib/services/property/property.service';
290
292
  export * from './lib/services/property/property-calculation.service';
291
293
  export * from './lib/services/property/property-capital-cost.service';
@@ -336,3 +338,7 @@ export * from './lib/functions/mat-sort-options';
336
338
  export * from './lib/functions/round-to';
337
339
  export * from './lib/functions/tax-review-filter-predicate';
338
340
  export * from './lib/functions/array';
341
+ /**
342
+ * Interceptors
343
+ */
344
+ export * from './lib/interceptors/interceptors.module';