taxtank-core 0.2.4 → 0.4.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 (88) hide show
  1. package/bundles/taxtank-core.umd.js +1015 -469
  2. package/bundles/taxtank-core.umd.js.map +1 -1
  3. package/esm2015/lib/collections/bank-account.collection.js +3 -3
  4. package/esm2015/lib/collections/bank-transaction.collection.js +3 -3
  5. package/esm2015/lib/collections/client-movement.collection.js +3 -3
  6. package/esm2015/lib/collections/client-portfolio-report.collection.js +3 -3
  7. package/esm2015/lib/collections/client.collection.js +3 -3
  8. package/esm2015/lib/collections/collection-dictionary.js +1 -1
  9. package/esm2015/lib/collections/collection.js +75 -0
  10. package/esm2015/lib/collections/depreciation-forecast.collection.js +5 -5
  11. package/esm2015/lib/collections/depreciation.collection.js +3 -3
  12. package/esm2015/lib/collections/employee.collection.js +3 -3
  13. package/esm2015/lib/collections/income-source.collection.js +3 -3
  14. package/esm2015/lib/collections/loan.collection.js +3 -3
  15. package/esm2015/lib/collections/message-document.collection.js +3 -3
  16. package/esm2015/lib/collections/message.collection.js +3 -3
  17. package/esm2015/lib/collections/property.collection.js +10 -3
  18. package/esm2015/lib/collections/service-price.collection.js +3 -3
  19. package/esm2015/lib/collections/service-subscription.collection.js +3 -3
  20. package/esm2015/lib/collections/tax-return-category-item.collection.js +3 -3
  21. package/esm2015/lib/collections/tax-review.collection.js +3 -3
  22. package/esm2015/lib/collections/transaction-allocation.collection.js +3 -3
  23. package/esm2015/lib/collections/transaction.collection.js +3 -3
  24. package/esm2015/lib/collections/user-event-setting.collection.js +3 -3
  25. package/esm2015/lib/db/Enums/chart-accounts-metadata-list.enum.js +2 -1
  26. package/esm2015/lib/interceptors/corelogic-interceptor.js +44 -0
  27. package/esm2015/lib/interceptors/financial-year-interceptor.js +30 -0
  28. package/esm2015/lib/interceptors/interceptors.module.js +74 -0
  29. package/esm2015/lib/interceptors/jwt-interceptor.js +137 -0
  30. package/esm2015/lib/interceptors/preloader.interceptor.js +32 -0
  31. package/esm2015/lib/interceptors/user-switcher-interceptor.js +42 -0
  32. package/esm2015/lib/models/color/alphabet-colors.enum.js +30 -0
  33. package/esm2015/lib/models/data-table/data-table.js +6 -4
  34. package/esm2015/lib/models/event/app-event-type.enum.js +17 -14
  35. package/esm2015/lib/models/logbook/vehicle-claim.js +7 -1
  36. package/esm2015/lib/models/transaction/transaction.js +11 -2
  37. package/esm2015/lib/services/pdf/pdf.service.js +39 -6
  38. package/esm2015/lib/services/property/equity-position-chart.service.js +45 -0
  39. package/esm2015/lib/services/property/property-category-movement.service.js +47 -0
  40. package/esm2015/lib/services/property/property.service.js +12 -1
  41. package/esm2015/lib/services/xlsx/xlsx.service.js +1 -1
  42. package/esm2015/lib/tt-core.module.js +8 -4
  43. package/esm2015/public-api.js +9 -2
  44. package/fesm2015/taxtank-core.js +932 -428
  45. package/fesm2015/taxtank-core.js.map +1 -1
  46. package/lib/collections/bank-account.collection.d.ts +2 -2
  47. package/lib/collections/bank-transaction.collection.d.ts +2 -2
  48. package/lib/collections/client-movement.collection.d.ts +2 -2
  49. package/lib/collections/client-portfolio-report.collection.d.ts +2 -2
  50. package/lib/collections/client.collection.d.ts +2 -2
  51. package/lib/collections/collection-dictionary.d.ts +2 -2
  52. package/lib/collections/{abstract.collection.d.ts → collection.d.ts} +3 -9
  53. package/lib/collections/depreciation-forecast.collection.d.ts +2 -2
  54. package/lib/collections/depreciation.collection.d.ts +2 -2
  55. package/lib/collections/employee.collection.d.ts +2 -2
  56. package/lib/collections/income-source.collection.d.ts +2 -2
  57. package/lib/collections/loan.collection.d.ts +2 -2
  58. package/lib/collections/message-document.collection.d.ts +2 -2
  59. package/lib/collections/message.collection.d.ts +2 -2
  60. package/lib/collections/property.collection.d.ts +7 -2
  61. package/lib/collections/service-price.collection.d.ts +2 -2
  62. package/lib/collections/service-subscription.collection.d.ts +2 -2
  63. package/lib/collections/tax-return-category-item.collection.d.ts +2 -2
  64. package/lib/collections/tax-review.collection.d.ts +2 -2
  65. package/lib/collections/transaction-allocation.collection.d.ts +2 -2
  66. package/lib/collections/transaction.collection.d.ts +2 -2
  67. package/lib/collections/user-event-setting.collection.d.ts +2 -2
  68. package/lib/db/Enums/chart-accounts-metadata-list.enum.d.ts +1 -0
  69. package/lib/interceptors/corelogic-interceptor.d.ts +20 -0
  70. package/lib/interceptors/financial-year-interceptor.d.ts +12 -0
  71. package/lib/interceptors/interceptors.module.d.ts +6 -0
  72. package/lib/interceptors/jwt-interceptor.d.ts +42 -0
  73. package/lib/interceptors/preloader.interceptor.d.ts +15 -0
  74. package/lib/interceptors/user-switcher-interceptor.d.ts +19 -0
  75. package/lib/models/color/alphabet-colors.enum.d.ts +28 -0
  76. package/lib/models/data-table/data-table.d.ts +2 -2
  77. package/lib/models/event/app-event-type.enum.d.ts +16 -13
  78. package/lib/models/logbook/vehicle-claim.d.ts +4 -0
  79. package/lib/models/transaction/transaction.d.ts +3 -0
  80. package/lib/services/pdf/pdf.service.d.ts +10 -1
  81. package/lib/services/property/equity-position-chart.service.d.ts +15 -0
  82. package/lib/services/property/property-category-movement.service.d.ts +15 -0
  83. package/lib/services/property/property.service.d.ts +4 -0
  84. package/lib/services/xlsx/xlsx.service.d.ts +1 -1
  85. package/lib/tt-core.module.d.ts +2 -1
  86. package/package.json +1 -1
  87. package/public-api.d.ts +8 -1
  88. package/esm2015/lib/collections/abstract.collection.js +0 -83
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('lodash/has'), require('lodash/get'), require('lodash/flatten'), require('lodash/first'), require('lodash/last'), require('lodash/uniqBy'), require('lodash/concat'), require('lodash/compact'), require('class-transformer'), require('moment'), require('moment-range'), require('lodash/cloneDeep'), require('@angular/forms'), require('rxjs'), require('rxjs/operators'), require('@angular/common/http'), require('@auth0/angular-jwt'), require('lodash'), require('event-source-polyfill/src/eventsource.min.js'), require('@angular/router'), require('lodash/clone'), require('jspdf'), require('jspdf-autotable'), require('@stripe/stripe-js'), require('xlsx'), require('file-saver')) :
3
- typeof define === 'function' && define.amd ? define('taxtank-core', ['exports', '@angular/core', '@angular/common', 'lodash/has', 'lodash/get', 'lodash/flatten', 'lodash/first', 'lodash/last', 'lodash/uniqBy', 'lodash/concat', 'lodash/compact', 'class-transformer', 'moment', 'moment-range', 'lodash/cloneDeep', '@angular/forms', 'rxjs', 'rxjs/operators', '@angular/common/http', '@auth0/angular-jwt', 'lodash', 'event-source-polyfill/src/eventsource.min.js', '@angular/router', 'lodash/clone', 'jspdf', 'jspdf-autotable', '@stripe/stripe-js', 'xlsx', 'file-saver'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["taxtank-core"] = {}, global.ng.core, global.ng.common, global.has, global.get, global.flatten, global.first, global.last, global.uniqBy, global.concat, global.compact, global.classTransformer, global.moment, global.momentRange, global.cloneDeep$1, global.ng.forms, global.rxjs, global.rxjs.operators, global.ng.common.http, global.angularJwt, global._, global.eventsource_min_js, global.ng.router, global.clone, global.jsPDF, global.autoTable, global.stripeJs, global.xlsx, global.FileSaver));
5
- })(this, (function (exports, i0, common, has, get, flatten, first, last, uniqBy, concat, compact, classTransformer, moment, momentRange, cloneDeep$1, forms, rxjs, operators, i1, angularJwt, _, eventsource_min_js, i1$1, clone, jsPDF, autoTable, stripeJs, xlsx, FileSaver) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/common/http'), require('rxjs'), require('rxjs/operators'), require('class-transformer'), require('@auth0/angular-jwt'), require('lodash/has'), require('lodash/get'), require('lodash/flatten'), require('lodash/first'), require('lodash/last'), require('lodash/uniqBy'), require('lodash/concat'), require('lodash/compact'), require('moment'), require('moment-range'), require('lodash/cloneDeep'), require('@angular/forms'), require('lodash'), require('event-source-polyfill/src/eventsource.min.js'), require('@angular/router'), require('lodash/clone'), require('jspdf'), require('jspdf-autotable'), require('@stripe/stripe-js'), require('xlsx'), require('file-saver')) :
3
+ typeof define === 'function' && define.amd ? define('taxtank-core', ['exports', '@angular/core', '@angular/common', '@angular/common/http', 'rxjs', 'rxjs/operators', 'class-transformer', '@auth0/angular-jwt', 'lodash/has', 'lodash/get', 'lodash/flatten', 'lodash/first', 'lodash/last', 'lodash/uniqBy', 'lodash/concat', 'lodash/compact', 'moment', 'moment-range', 'lodash/cloneDeep', '@angular/forms', 'lodash', 'event-source-polyfill/src/eventsource.min.js', '@angular/router', 'lodash/clone', 'jspdf', 'jspdf-autotable', '@stripe/stripe-js', 'xlsx', 'file-saver'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["taxtank-core"] = {}, global.ng.core, global.ng.common, global.ng.common.http, global.rxjs, global.rxjs.operators, global.classTransformer, global.angularJwt, global.has, global.get, global.flatten, global.first, global.last, global.uniqBy, global.concat, global.compact, global.moment, global.momentRange, global.cloneDeep$1, global.ng.forms, global._, global.eventsource_min_js, global.ng.router, global.clone, global.jsPDF, global.autoTable, global.stripeJs, global.xlsx, global.FileSaver));
5
+ })(this, (function (exports, i0, common, i1, rxjs, operators, classTransformer, angularJwt, has, get, flatten, first, last, uniqBy, concat, compact, moment, momentRange, cloneDeep$1, forms, _, eventsource_min_js, i1$1, clone, jsPDF, autoTable, stripeJs, xlsx, FileSaver) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -25,6 +25,7 @@
25
25
  }
26
26
 
27
27
  var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
28
+ var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
28
29
  var has__default = /*#__PURE__*/_interopDefaultLegacy(has);
29
30
  var get__default = /*#__PURE__*/_interopDefaultLegacy(get);
30
31
  var flatten__default = /*#__PURE__*/_interopDefaultLegacy(flatten);
@@ -35,7 +36,6 @@
35
36
  var compact__default = /*#__PURE__*/_interopDefaultLegacy(compact);
36
37
  var moment__namespace = /*#__PURE__*/_interopNamespace(moment);
37
38
  var cloneDeep__default = /*#__PURE__*/_interopDefaultLegacy(cloneDeep$1);
38
- var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
39
39
  var ___default = /*#__PURE__*/_interopDefaultLegacy(_);
40
40
  var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
41
41
  var clone__default = /*#__PURE__*/_interopDefaultLegacy(clone);
@@ -44,36 +44,133 @@
44
44
  var xlsx__namespace = /*#__PURE__*/_interopNamespace(xlsx);
45
45
  var FileSaver__namespace = /*#__PURE__*/_interopNamespace(FileSaver);
46
46
 
47
- var TtCoreModule = /** @class */ (function () {
48
- function TtCoreModule() {
47
+ /**
48
+ * https://api-uat.corelogic.asia/property/au/v2/suggest.json
49
+ * address suggestion from corelogic service
50
+ */
51
+ var CorelogicSuggestion = /** @class */ (function () {
52
+ function CorelogicSuggestion() {
49
53
  }
50
- TtCoreModule.forRoot = function (environment) {
51
- localStorage.setItem('api_uri', environment['api_uri']);
52
- return {
53
- ngModule: TtCoreModule,
54
- providers: [
55
- {
56
- provide: 'environment',
57
- useValue: environment
58
- }
59
- ]
60
- };
54
+ return CorelogicSuggestion;
55
+ }());
56
+
57
+ var CorelogicService = /** @class */ (function () {
58
+ function CorelogicService(http, environment) {
59
+ this.http = http;
60
+ this.environment = environment;
61
+ this.accessTokenSubject = new rxjs.ReplaySubject(1);
62
+ }
63
+ CorelogicService.prototype.getAccessToken = function (force) {
64
+ var _this = this;
65
+ if (force === void 0) { force = false; }
66
+ if (!this._accessToken || force) {
67
+ this.http.get(this.environment.coreLogicUrl + "/access/oauth/token?grant_type=client_credentials&client_id=" + this.environment.coreLogicId + "&client_secret=" + this.environment.coreLogicSecret)
68
+ .pipe(operators.map(function (response) {
69
+ return response.access_token;
70
+ }))
71
+ .subscribe(function (token) {
72
+ _this._accessToken = token;
73
+ _this.accessTokenSubject.next(_this._accessToken);
74
+ });
75
+ }
76
+ return this.accessTokenSubject.asObservable();
61
77
  };
62
- return TtCoreModule;
78
+ CorelogicService.prototype.getSuggestions = function (query, country) {
79
+ if (country === void 0) { country = 'au'; }
80
+ // @TODO handle different countries in future
81
+ return this.http.get(this.environment.coreLogicUrl + "/property/" + country + "/v2/suggest.json?q=" + query)
82
+ .pipe(operators.map(function (response) {
83
+ return response.suggestions.map(function (item) { return classTransformer.plainToClass(CorelogicSuggestion, item); });
84
+ }));
85
+ };
86
+ return CorelogicService;
63
87
  }());
64
- TtCoreModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TtCoreModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
65
- TtCoreModulemod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TtCoreModule, imports: [common.CommonModule] });
66
- TtCoreModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TtCoreModule, imports: [[
67
- common.CommonModule
68
- ]] });
69
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TtCoreModule, decorators: [{
70
- type: i0.NgModule,
88
+ CorelogicService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: CorelogicService, deps: [{ token: i1__namespace.HttpClient }, { token: 'environment' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
89
+ CorelogicServiceprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: CorelogicService, providedIn: 'root' });
90
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: CorelogicService, decorators: [{
91
+ type: i0.Injectable,
71
92
  args: [{
72
- declarations: [],
73
- imports: [
74
- common.CommonModule
75
- ]
93
+ providedIn: 'root'
76
94
  }]
95
+ }], ctorParameters: function () {
96
+ return [{ type: i1__namespace.HttpClient }, { type: undefined, decorators: [{
97
+ type: i0.Inject,
98
+ args: ['environment']
99
+ }] }];
100
+ } });
101
+
102
+ /**
103
+ * Corelogic interceptor add Core Logic access token for each search requests related with Core Logic API
104
+ */
105
+ var CorelogicInterceptor = /** @class */ (function () {
106
+ function CorelogicInterceptor(corelogicService, environment) {
107
+ this.corelogicService = corelogicService;
108
+ this.environment = environment;
109
+ }
110
+ /**
111
+ * Check if requested url requested core logic, but not core logic auth api
112
+ * @param req
113
+ */
114
+ CorelogicInterceptor.prototype.addToken = function (req) {
115
+ // don't need token for this endpoint
116
+ if (req.url.includes(this.environment.coreLogicUrl + "/access/oauth/token")) {
117
+ return req;
118
+ }
119
+ // add core logic token to request headers
120
+ if (req.url.includes(this.environment.coreLogicUrl)) {
121
+ return req.clone({
122
+ setHeaders: {
123
+ Authorization: 'Bearer ' + this.corelogicService._accessToken
124
+ }
125
+ });
126
+ }
127
+ // return request without changes if url not related with core logic
128
+ return req;
129
+ };
130
+ CorelogicInterceptor.prototype.intercept = function (request, next) {
131
+ return next.handle(this.addToken(request));
132
+ };
133
+ return CorelogicInterceptor;
134
+ }());
135
+ CorelogicInterceptor.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: CorelogicInterceptor, deps: [{ token: CorelogicService }, { token: 'environment' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
136
+ CorelogicInterceptor.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: CorelogicInterceptor });
137
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: CorelogicInterceptor, decorators: [{
138
+ type: i0.Injectable
139
+ }], ctorParameters: function () {
140
+ return [{ type: CorelogicService }, { type: undefined, decorators: [{
141
+ type: i0.Inject,
142
+ args: ['environment']
143
+ }] }];
144
+ } });
145
+
146
+ /**
147
+ * Financial Year interceptor add financialYear parameter to requests because a lot of POST and GET requests require this parameter
148
+ * @TODO now we can get current fin year from user on backend. So we can remove this interceptor
149
+ */
150
+ var FinancialYearInterceptor = /** @class */ (function () {
151
+ function FinancialYearInterceptor() {
152
+ }
153
+ FinancialYearInterceptor.prototype.intercept = function (request, next) {
154
+ // Set financial year parameter to requests
155
+ var params = new i1.HttpParams({
156
+ fromString: request.params.toString()
157
+ });
158
+ // clone request to add new parameters
159
+ var clonedReq = request.clone();
160
+ if (!params.get('financialYear')) {
161
+ params = params.set('financialYear', localStorage.getItem('financialYear'));
162
+ clonedReq = request.clone({
163
+ params: params
164
+ });
165
+ }
166
+ return next.handle(clonedReq);
167
+ };
168
+ return FinancialYearInterceptor;
169
+ }());
170
+ FinancialYearInterceptor.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FinancialYearInterceptor, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
171
+ FinancialYearInterceptor.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FinancialYearInterceptor });
172
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FinancialYearInterceptor, decorators: [{
173
+ type: i0.Injectable
77
174
  }] });
78
175
 
79
176
  /*! *****************************************************************************
@@ -394,6 +491,636 @@
394
491
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
395
492
  }
396
493
 
494
+ var NAME_TOKEN = 'token';
495
+ var NAME_REFRESH_TOKEN = 'refreshToken';
496
+ var JwtService = /** @class */ (function (_super) {
497
+ __extends(JwtService, _super);
498
+ function JwtService() {
499
+ return _super !== null && _super.apply(this, arguments) || this;
500
+ }
501
+ JwtService.prototype.getToken = function () {
502
+ return localStorage[NAME_TOKEN];
503
+ };
504
+ JwtService.prototype.getRefreshToken = function () {
505
+ return localStorage[NAME_REFRESH_TOKEN];
506
+ };
507
+ JwtService.prototype.saveTokens = function (tokens) {
508
+ localStorage[NAME_TOKEN] = tokens.token;
509
+ localStorage[NAME_REFRESH_TOKEN] = tokens.refreshToken;
510
+ };
511
+ JwtService.prototype.destroyTokens = function () {
512
+ localStorage.removeItem(NAME_TOKEN);
513
+ localStorage.removeItem(NAME_REFRESH_TOKEN);
514
+ };
515
+ JwtService.prototype.getUser = function () {
516
+ return this.decodeToken();
517
+ };
518
+ JwtService.prototype.isMe = function (userId) {
519
+ return this.getUser().id === userId;
520
+ };
521
+ return JwtService;
522
+ }(angularJwt.JwtHelperService));
523
+ JwtService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: JwtService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
524
+ JwtService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: JwtService, providedIn: 'root' });
525
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: JwtService, decorators: [{
526
+ type: i0.Injectable,
527
+ args: [{
528
+ providedIn: 'root'
529
+ }]
530
+ }] });
531
+
532
+ var AuthService = /** @class */ (function () {
533
+ function AuthService(http, jwtService, environment) {
534
+ this.http = http;
535
+ this.jwtService = jwtService;
536
+ this.environment = environment;
537
+ this.isLoggedInSubject = new rxjs.BehaviorSubject(!this.jwtService.isTokenExpired());
538
+ }
539
+ AuthService.prototype.setAuth = function (response) {
540
+ this.jwtService.saveTokens(response);
541
+ this.isLoggedInSubject.next(true);
542
+ };
543
+ AuthService.prototype.login = function (username, password) {
544
+ var _this = this;
545
+ return this.http.post(this.environment.apiV2 + "/login_check", { username: username, password: password }).pipe(operators.map(function (response) {
546
+ _this.setAuth(response);
547
+ return response;
548
+ }));
549
+ };
550
+ AuthService.prototype.refresh = function (refreshToken) {
551
+ var _this = this;
552
+ return this.http.post(this.environment.apiV2 + "/token/refresh", { refreshToken: refreshToken }).pipe(operators.map(function (response) {
553
+ _this.setAuth(response);
554
+ return response;
555
+ }));
556
+ };
557
+ AuthService.prototype.logoutFront = function (url) {
558
+ if (url === void 0) { url = '/login'; }
559
+ localStorage.clear();
560
+ location.replace(url);
561
+ };
562
+ return AuthService;
563
+ }());
564
+ AuthService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: AuthService, deps: [{ token: i1__namespace.HttpClient }, { token: JwtService }, { token: 'environment' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
565
+ AuthService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: AuthService, providedIn: 'root' });
566
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: AuthService, decorators: [{
567
+ type: i0.Injectable,
568
+ args: [{
569
+ providedIn: 'root'
570
+ }]
571
+ }], ctorParameters: function () {
572
+ return [{ type: i1__namespace.HttpClient }, { type: JwtService }, { type: undefined, decorators: [{
573
+ type: i0.Inject,
574
+ args: ['environment']
575
+ }] }];
576
+ } });
577
+
578
+ var MESSAGE_DEFAULT_500_ERROR = 'Unexpected error! Please try again later. You can send us via chat your questions.';
579
+ /**
580
+ * JWT Interceptor add jwt token to each request related with TaxTank API
581
+ */
582
+ var JwtInterceptor = /** @class */ (function () {
583
+ function JwtInterceptor(jwtService, authService, environment) {
584
+ this.jwtService = jwtService;
585
+ this.authService = authService;
586
+ this.environment = environment;
587
+ this.isRefreshingToken = false;
588
+ this.tokenSubject = new rxjs.BehaviorSubject(null);
589
+ }
590
+ JwtInterceptor.prototype.addToken = function (req) {
591
+ return req.clone({
592
+ setHeaders: { Authorization: 'Bearer ' + this.jwtService.getToken() },
593
+ withCredentials: true
594
+ });
595
+ };
596
+ JwtInterceptor.prototype.intercept = function (request, next) {
597
+ var _this = this;
598
+ // skip third party requests
599
+ if (!request.url.includes(this.environment.api_uri)) {
600
+ return next.handle(request);
601
+ }
602
+ // add token to every api request
603
+ return next.handle(this.addToken(request)).pipe(
604
+ // handle errors
605
+ operators.catchError(function (err) {
606
+ if (err instanceof i1.HttpErrorResponse) {
607
+ switch (err.status) {
608
+ // unexpected errors
609
+ case 405:
610
+ case 500:
611
+ _this.handle500Error();
612
+ break;
613
+ // expected errors
614
+ case 401:
615
+ return _this.handle401Error(request, next, err);
616
+ case 400:
617
+ case 403:
618
+ // @TODO in most cases 404 is not an error, handle in components
619
+ // case 404:
620
+ _this.showErrorMessages(err);
621
+ break;
622
+ }
623
+ }
624
+ return rxjs.throwError(err);
625
+ }));
626
+ };
627
+ /**
628
+ * @TODO log
629
+ * @TODO waiting for backend to handle errors in a better way
630
+ */
631
+ JwtInterceptor.prototype.handle400Error = function (err) {
632
+ // this.snackBar.open(err.error['hydra:description'], '', {
633
+ // panelClass: 'error'
634
+ // });
635
+ };
636
+ /**
637
+ * @TODO log
638
+ * @TODO waiting for backend to handle errors in a better way
639
+ */
640
+ JwtInterceptor.prototype.handle403Error = function (err) {
641
+ // this.snackBar.open(err.error['hydra:description'], '', {
642
+ // panelClass: 'error'
643
+ // });
644
+ };
645
+ /**
646
+ * @TODO log
647
+ */
648
+ JwtInterceptor.prototype.handle500Error = function () {
649
+ // this.snackBar.open(MESSAGE_DEFAULT_500_ERROR, '', {
650
+ // panelClass: 'error'
651
+ // });
652
+ };
653
+ JwtInterceptor.prototype.handle401Error = function (req, next, err) {
654
+ var _this = this;
655
+ if (req.url.includes('token/refresh') || req.url.includes('login')) {
656
+ if (req.url.includes('token/refresh')) {
657
+ this.authService.logoutFront();
658
+ }
659
+ return rxjs.throwError(err);
660
+ }
661
+ // refreshing token, wait until it's done and retry the request
662
+ if (this.isRefreshingToken) {
663
+ return this.tokenSubject.pipe(operators.filter(function (token) { return token != null; }), operators.take(1), operators.switchMap(function (token) { return next.handle(_this.addToken(req)); }));
664
+ // refresh token
665
+ }
666
+ else {
667
+ // subsequent requests should wait until refresh token is ready
668
+ this.isRefreshingToken = true;
669
+ this.tokenSubject.next(null);
670
+ return this.authService.refresh(this.jwtService.getRefreshToken()).pipe(operators.switchMap(function (tokens) {
671
+ _this.tokenSubject.next(tokens.token);
672
+ return next.handle(_this.addToken(req));
673
+ }), operators.catchError(function () {
674
+ _this.authService.logoutFront();
675
+ return rxjs.throwError(err);
676
+ }), operators.finalize(function () {
677
+ _this.isRefreshingToken = false;
678
+ }));
679
+ }
680
+ };
681
+ /**
682
+ * Handle error messages
683
+ * @param errorResponse from which messages should be taken
684
+ *
685
+ * @TODO move to separated interceptor
686
+ */
687
+ JwtInterceptor.prototype.showErrorMessages = function (errorResponse) {
688
+ if (!errorResponse.error.violations) {
689
+ // this.snackBar.open('Something went wrong', '', {
690
+ // panelClass: 'error'
691
+ // });
692
+ return;
693
+ }
694
+ errorResponse.error.violations.forEach(function (violation) {
695
+ // this.snackBar.open(violation['message'], '', {
696
+ // panelClass: 'error'
697
+ // });
698
+ });
699
+ };
700
+ return JwtInterceptor;
701
+ }());
702
+ JwtInterceptor.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: JwtInterceptor, deps: [{ token: JwtService }, { token: AuthService }, { token: 'environment' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
703
+ JwtInterceptor.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: JwtInterceptor });
704
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: JwtInterceptor, decorators: [{
705
+ type: i0.Injectable
706
+ }], ctorParameters: function () {
707
+ return [{ type: JwtService }, { type: AuthService }, { type: undefined, decorators: [{
708
+ type: i0.Inject,
709
+ args: ['environment']
710
+ }] }];
711
+ } });
712
+
713
+ var KEY = '_switch_user';
714
+ /**
715
+ * provides user management to managers (users with ROLE_ACCOUNTANT for now, more in future)
716
+ */
717
+ var UserSwitcherService = /** @class */ (function () {
718
+ function UserSwitcherService() {
719
+ }
720
+ /**
721
+ * get switched username
722
+ */
723
+ UserSwitcherService.prototype.get = function () {
724
+ return localStorage[KEY];
725
+ };
726
+ /**
727
+ * switch to user (username should be used for correct work of backend)
728
+ */
729
+ UserSwitcherService.prototype.set = function (username) {
730
+ localStorage[KEY] = username;
731
+ window.location.replace('/client/dashboard');
732
+ };
733
+ /**
734
+ * go back to original user
735
+ */
736
+ UserSwitcherService.prototype.reset = function () {
737
+ localStorage.removeItem(KEY);
738
+ window.location.replace('/firm/dashboard');
739
+ };
740
+ return UserSwitcherService;
741
+ }());
742
+ UserSwitcherService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: UserSwitcherService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
743
+ UserSwitcherService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: UserSwitcherService, providedIn: 'root' });
744
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: UserSwitcherService, decorators: [{
745
+ type: i0.Injectable,
746
+ args: [{
747
+ providedIn: 'root'
748
+ }]
749
+ }] });
750
+
751
+ /**
752
+ * Impersonate current's user (manager) to client experience with help of special header
753
+ */
754
+ var UserSwitcherInterceptor = /** @class */ (function () {
755
+ function UserSwitcherInterceptor(userSwitcherService, environment) {
756
+ this.userSwitcherService = userSwitcherService;
757
+ this.environment = environment;
758
+ }
759
+ /**
760
+ * add token header if request url contain TaxTank API URL
761
+ */
762
+ UserSwitcherInterceptor.prototype.switch = function (req, username) {
763
+ // skip third party api requests
764
+ if (!req.url.includes(this.environment.api_uri) || !username) {
765
+ return req;
766
+ }
767
+ var params = new i1.HttpParams({ fromString: req.params.toString() }).set('_switch_user', username);
768
+ return req.clone({ params: params });
769
+ // @TODO move to header solution when backend can support it
770
+ // return req.clone({
771
+ // setHeaders: {
772
+ // HTTP_X_SWITCH_USER: username
773
+ // }
774
+ // });
775
+ };
776
+ UserSwitcherInterceptor.prototype.intercept = function (request, next) {
777
+ return next.handle(this.switch(request, this.userSwitcherService.get()));
778
+ };
779
+ return UserSwitcherInterceptor;
780
+ }());
781
+ UserSwitcherInterceptor.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: UserSwitcherInterceptor, deps: [{ token: UserSwitcherService }, { token: 'environment' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
782
+ UserSwitcherInterceptor.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: UserSwitcherInterceptor });
783
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: UserSwitcherInterceptor, decorators: [{
784
+ type: i0.Injectable
785
+ }], ctorParameters: function () {
786
+ return [{ type: UserSwitcherService }, { type: undefined, decorators: [{
787
+ type: i0.Inject,
788
+ args: ['environment']
789
+ }] }];
790
+ } });
791
+
792
+ /**
793
+ * Backend endpoint class
794
+ */
795
+ var Endpoint = /** @class */ (function () {
796
+ function Endpoint(method, pattern) {
797
+ this.method = method;
798
+ this.pattern = pattern;
799
+ }
800
+ /**
801
+ * check url with regexp
802
+ * @param url
803
+ */
804
+ Endpoint.prototype.test = function (url) {
805
+ return this.regexp.test(url);
806
+ };
807
+ Object.defineProperty(Endpoint.prototype, "regexp", {
808
+ /**
809
+ * Get regexp for endpoint
810
+ */
811
+ get: function () {
812
+ return new RegExp("^" + this.method + " .*" + this.pattern + "$");
813
+ },
814
+ enumerable: false,
815
+ configurable: true
816
+ });
817
+ return Endpoint;
818
+ }());
819
+
820
+ /**
821
+ * List of all app endpoints
822
+ */
823
+ var ENDPOINTS = {
824
+ ASSETS_GET: new Endpoint('GET', '\\/assets\\/\.\*\\/\\d+'),
825
+ BANK_ACCOUNTS_GET: new Endpoint('GET', '\\/bank-accounts'),
826
+ BANK_ACCOUNTS_POST: new Endpoint('POST', '\\/bank-accounts'),
827
+ BANK_ACCOUNTS_PUT: new Endpoint('PUT', '\\/bank-accounts\\/\\d+'),
828
+ BANK_CONNECTION_POST: new Endpoint('POST', '\\/bank-connections'),
829
+ BANK_TRANSACTIONS_GET: new Endpoint('GET', '\\/bank-transactions'),
830
+ BANK_TRANSACTIONS_DELETE: new Endpoint('DELETE', '\\/bank-transactions\\/\\d+'),
831
+ BANK_TRANSACTIONS_IMPORT_POST: new Endpoint('POST', '\\/bank-transactions\\/\\d+\\/import'),
832
+ BASIQ_ACCOUNTS_GET: new Endpoint('GET', '\\/basiq\\/\\accounts'),
833
+ CAPITAL_COSTS_GET: new Endpoint('GET', '\\/capital-costs'),
834
+ CHARTS_INCOME_GET: new Endpoint('GET', '\\/charts\\/\\incomes'),
835
+ CHARTS_EXPENSES_GET: new Endpoint('GET', '\\/charts\\/\\expenses'),
836
+ CHART_ACCOUNTS_GET: new Endpoint('GET', '\\/chart-accounts'),
837
+ CLIENTS_GET: new Endpoint('GET', '\\/clients'),
838
+ CLIENTS_PUT: new Endpoint('PUT', '\\/clients'),
839
+ CLIENTS_EXCLUDE_PUT: new Endpoint('PUT', '\\/clients\\/\\d+\\/exclude'),
840
+ CLIENTS_INVITES_GET: new Endpoint('GET', '\\/clients\\/\\invites'),
841
+ CLIENTS_INVITES_POST: new Endpoint('POST', '\\/clients\\/\\invites'),
842
+ CLIENTS_INVITES_DELETE: new Endpoint('DELETE', '\\/clients\\/\\invites\\/\\d+'),
843
+ CLIENTS_INVITES_ACCEPT_POST: new Endpoint('POST', '\\/clients\\/\\invites\\/\\d+\\/accept'),
844
+ CLIENTS_INVITES_REJECT_POST: new Endpoint('POST', '\\/clients\\/\\invites\\/\\d+\\/reject'),
845
+ CLIENTS_INVITES_RESEND_POST: new Endpoint('POST', '\\/clients\\/\\invites\\/\\d+\\/resend'),
846
+ CLIENT_MOVEMENTS_GET: new Endpoint('GET', '\\/client-movements'),
847
+ CLIENT_MOVEMENTS_POST: new Endpoint('POST', '\\/client-movements'),
848
+ COUNTRIES_GET: new Endpoint('GET', '\\/countries'),
849
+ DEPRECIATIONS_CLOSING_GET: new Endpoint('GET', '\\/depreciations\\/\\closing-balance\.\*'),
850
+ DEPRECIATIONS_GET: new Endpoint('GET', '\\/depreciations'),
851
+ DEPRECIATIONS_POST: new Endpoint('POST', '\\/depreciations'),
852
+ DEPRECIATIONS_PUT: new Endpoint('PUT', '\\/depreciations\\/\\d+'),
853
+ EMPLOYEES_GET: new Endpoint('GET', '\\/employees'),
854
+ EMPLOYEES_INVITES_GET: new Endpoint('GET', '\\/employees\\/\\invites'),
855
+ EMPLOYEES_INVITES_DELETE: new Endpoint('DELETE', '\\/employees\\/\\invites\\/\\d+'),
856
+ EMPLOYEES_INVITE_POST: new Endpoint('POST', '\\/employees\\/\\invites'),
857
+ EMPLOYEES_INVITES_REJECT_POST: new Endpoint('POST', '\\/employees\\/\\invites\\/\\d+\\/\\reject'),
858
+ EMPLOYEES_INVITES_RESEND_POST: new Endpoint('POST', '\\/employees\\/\\invites\\/\\d+\\/\\resend'),
859
+ FIRM_GET: new Endpoint('GET', '\\/firms'),
860
+ FIRM_CURRENT_GET: new Endpoint('GET', '\\/firms\\/current'),
861
+ FIRM_CURRENT_PUT: new Endpoint('PUT', '\\/firms\\/current\.\*'),
862
+ FIRM_INVITE_POST: new Endpoint('POST', '\\/firms\\/invite'),
863
+ FIRM_REGISTRATION_POST: new Endpoint('POST', '\\/firms\\/registration'),
864
+ FIRM_UPDATE_PHOTO_POST: new Endpoint('POST', '\\/firms\\/photo\.\*'),
865
+ FOLDERS_GET: new Endpoint('GET', '\\/folders'),
866
+ FOLDERS_POST: new Endpoint('POST', '\\/folders'),
867
+ FOLDERS_PUT: new Endpoint('PUT', '\\/folders\\/\\d+'),
868
+ FOLDERS_DOCUMENTS_POST: new Endpoint('POST', '\\/folders\\/\\d+\\/documents'),
869
+ FOLDERS_DOCUMENTS_PUT: new Endpoint('PUT', '\\/folders\\/\\d+\\/documents\\/\\d+'),
870
+ INCOME_SOURCES_GET: new Endpoint('GET', '\\/income-sources'),
871
+ INCOME_SOURCES_POST: new Endpoint('POST', '\\/income-sources'),
872
+ INCOME_SOURCES_PUT: new Endpoint('PUT', '\\/income-sources'),
873
+ INCOME_SOURCES_DELETE: new Endpoint('DELETE', '\\/income-sources\\/\\d+'),
874
+ INCOME_SOURCE_FORECAST_GET: new Endpoint('GET', '\\/income-source-forecasts'),
875
+ INCOME_SOURCE_FORECAST_POST: new Endpoint('POST', '\\/income-source-forecasts'),
876
+ INCOME_SOURCE_FORECAST_PUT: new Endpoint('PUT', '\\/income-source-forecasts'),
877
+ INCOME_SOURCE_FORECAST_DELETE: new Endpoint('DELETE', '\\/income-source-forecasts\\/\\d+'),
878
+ INCOME_SOURCE_TYPES_GET: new Endpoint('GET', '\\/income-source-types'),
879
+ LOANS_GET: new Endpoint('GET', '\\/bank-accounts\\/loans'),
880
+ LOANS_POST: new Endpoint('POST', '\\/bank-accounts\\/loans'),
881
+ LOANS_PUT: new Endpoint('PUT', '\\/bank-accounts\\/loans/\\d+'),
882
+ LOANS_PAYOUT_POST: new Endpoint('POST', '\\/loans\\/\\d+\\/payout'),
883
+ LOANS_PAYOUT_PUT: new Endpoint('PUT', '\\/loans\\/\\d+\\/payout\\/\\d+'),
884
+ LOANS_PAYOUT_DELETE: new Endpoint('DELETE', '\\/loans\\/\\d+\\/payout\\/\\d+'),
885
+ LOANS_CALCULATION_POST: new Endpoint('POST', '\\/bank-accounts\\/loans\\/calculation'),
886
+ LOGIN_CHECK_POST: new Endpoint('POST', '\\/login_check'),
887
+ NOTIFICATIONS_GET: new Endpoint('GET', '\\/service-notifications'),
888
+ OCCUPATIONS_GET: new Endpoint('GET', '\\/occupations'),
889
+ PROPERTIES_GET: new Endpoint('GET', '\\/properties'),
890
+ PROPERTIES_POST: new Endpoint('POST', '\\/properties'),
891
+ PROPERTY_PUT: new Endpoint('PUT', '\\/properties/\\d+'),
892
+ PROPERTIES_PUT: new Endpoint('PUT', '\\/properties'),
893
+ PROPERTIES_CATEGORIES_EQUITY_GET: new Endpoint('GET', '\\/properties\\/categories\\/equity'),
894
+ PROPERTIES_CATEGORIES_GET: new Endpoint('GET', '\\/properties\\/categories'),
895
+ PROPERTIES_CATEGORIES_PUT: new Endpoint('PUT', '\\/properties\\/categories\\/\\d+'),
896
+ PROPERTIES_CATEGORIES_POST: new Endpoint('POST', '\\/properties\\/categories'),
897
+ PROPERTIES_CATEGORY_MOVEMENTS_POST: new Endpoint('POST', '\\/properties\\/\\d+\\/category-movements'),
898
+ PROPERTIES_CATEGORY_MOVEMENTS_PUT: new Endpoint('PUT', '\\/properties\\/\\d+\\/category-movements\\/\\d+'),
899
+ PROPERTIES_CO_OWNERS_PUT: new Endpoint('PUT', '\\/properties\\/co-owners\\/\\d+'),
900
+ PROPERTIES_CO_OWNERS_GET: new Endpoint('GET', '\\/properties\\/co-owners'),
901
+ PROPERTIES_CO_OWNERS_POST: new Endpoint('POST', '\\/properties\\/co-owners'),
902
+ PROPERTIES_DEACTIVATE_PUT: new Endpoint('PUT', '\\/properties\\/\\d+\\/deactivate'),
903
+ PROPERTIES_DEPRECIATION_CAPITAL_PROJECT_GET: new Endpoint('GET', '\\/properties\\/\\d+\\/depreciation-capital-projects'),
904
+ PROPERTIES_DEPRECIATION_CAPITAL_PROJECT_POST: new Endpoint('POST', '\\/properties\\/\\d+\\/depreciation-capital-projects'),
905
+ PROPERTIES_DEPRECIATION_CAPITAL_PROJECT_PUT: new Endpoint('PUT', '\\/properties\\/\\d+\\/depreciation-capital-projects\\/\\d+'),
906
+ PROPERTIES_DEPRECIATION_CAPITAL_PROJECT_DELETE: new Endpoint('DELETE', '\\/properties\\/\\d+\\/depreciation-capital-projects\\/\\d+'),
907
+ PROPERTIES_DOCUMENTS_GET: new Endpoint('GET', '\\/properties\\/documents'),
908
+ PROPERTIES_DOCUMENTS_POST: new Endpoint('POST', '\\/properties\\/\\d+\\/documents'),
909
+ PROPERTIES_DOCUMENTS_PUT: new Endpoint('PUT', '\\/properties\\/documents\\/\\d+'),
910
+ PROPERTIES_DOCUMENTS_DELETE: new Endpoint('DELETE', '\\/properties\\/documents\\/\\d+'),
911
+ PROPERTIES_PHOTO_POST: new Endpoint('POST', '\\/properties\\/\\d+\\/photo\.\*'),
912
+ PROPERTIES_SUGGESTIONS_GET: new Endpoint('GET', '/property\\/\\w+\\/v2\\/.*$'),
913
+ PROPERTIES_VALUATIONS_DOCUMENTS_POST: new Endpoint('POST', '\\/properties\\/\\d+\\/valuations\\/\\d+\\/documents'),
914
+ PRORATION_COST_POST: new Endpoint('POST', '\\/subscriptions\\/proration-cost'),
915
+ SALARY_FORECAST_GET: new Endpoint('GET', '\\/salary-forecasts'),
916
+ SALARY_FORECAST_POST: new Endpoint('POST', '\\/salary-forecasts'),
917
+ SALARY_FORECAST_PUT: new Endpoint('PUT', '\\/salary-forecasts'),
918
+ SERVICE_PRICES_GET: new Endpoint('GET', '\\/service-prices'),
919
+ SERVICE_PAYMENTS_GET: new Endpoint('GET', '\\/service-payments'),
920
+ STRIPE_BILLING_PORTAL_GET: new Endpoint('GET', '\\/stripe\\/billing-portal-session'),
921
+ STRIPE_CHECKOUT_SESSION_POST: new Endpoint('POST', '\\/stripe\\/checkout-session'),
922
+ SUBSCRIPTION_LAST_GET: new Endpoint('GET', '\\/subscriptions\\/last'),
923
+ SUBSCRIPTION_ITEMS_PUT: new Endpoint('PUT', '\\/subscriptions\\/items'),
924
+ TAX_CALCULATION_POST: new Endpoint('POST', '\\/tax-calculation'),
925
+ TAX_REVIEWS_GET: new Endpoint('GET', '\\/tax-reviews'),
926
+ TAX_REVIEWS_DELETE: new Endpoint('DELETE', '\\/tax-reviews\\/\\d+'),
927
+ TAX_REVIEWS_POST: new Endpoint('POST', '\\/tax-reviews'),
928
+ TAX_REVIEWS_PUT: new Endpoint('PUT', '\\/tax-reviews\\/\\d+'),
929
+ TAX_SUMMARY_ACTUAL_GET: new Endpoint('GET', '\\/tax-summary\\/actuals'),
930
+ TAX_SUMMARY_FORECAST_GET: new Endpoint('GET', '\\/tax-summary\\/forecasts'),
931
+ TRANSACTION_DELETE: new Endpoint('DELETE', '\\/transactions\\/\\d+'),
932
+ TRANSACTION_PUT: new Endpoint('PUT', '\\/transactions\\/\\d+'),
933
+ TRANSACTIONS_GET: new Endpoint('GET', '\\/transactions'),
934
+ TRANSACTIONS_POST: new Endpoint('POST', '\\/transactions'),
935
+ TRANSACTIONS_PUT: new Endpoint('PUT', '\\/transactions'),
936
+ TRANSACTIONS_ALLOCATIONS_GET: new Endpoint('GET', '\\/transactions-allocations'),
937
+ TRANSACTIONS_ALLOCATIONS_POST: new Endpoint('POST', '\\/transactions-allocations'),
938
+ TRANSACTIONS_ALLOCATIONS_DELETE: new Endpoint('DELETE', '\\/transactions-allocations\\/\\d+'),
939
+ USER_CONFIRMATION_POST: new Endpoint('POST', '\\/users\\/confirmation'),
940
+ USER_CURRENT_GET: new Endpoint('GET', '\\/users\\/current'),
941
+ USER_CURRENT_PASSWORD_PUT: new Endpoint('PUT', '\\/users\\/current\\/password\.\*'),
942
+ USER_EVENT_SETTINGS_GET: new Endpoint('GET', '\\/user-event-settings'),
943
+ USER_EVENT_TYPES_GET: new Endpoint('GET', '\\/user-event-types'),
944
+ USER_INVITE_DELETE: new Endpoint('DELETE', '\\/users\\/invite\\/\\d+'),
945
+ USER_INVITE_POST: new Endpoint('POST', '\\/users\\/invite'),
946
+ USER_INVITE_RESEND_POST: new Endpoint('POST', '\\/users\\/invite/\\d+\\/resend'),
947
+ USER_PUT: new Endpoint('PUT', '\\/users\\/\\d+'),
948
+ USER_REGISTRATION_POST: new Endpoint('POST', '\\/users\\/registration'),
949
+ USER_RESET_PASSWORD_PUT: new Endpoint('PUT', '\\/users\\/reset-password'),
950
+ USER_SEARCH_GET: new Endpoint('GET', '\\/users\\/search\.\*'),
951
+ USER_UPDATE_PHOTO_POST: new Endpoint('POST', '\\/users\\/photo\.\*'),
952
+ USER_STATUS_PUT: new Endpoint('PUT', '\\/users\\/status'),
953
+ VEHICLES_GET: new Endpoint('GET', '\\/vehicles'),
954
+ VEHICLES_POST: new Endpoint('POST', '\\/vehicles'),
955
+ VEHICLES_PUT: new Endpoint('PUT', '\\/vehicles\\/\\d+'),
956
+ VEHICLE_CLAIMS_GET: new Endpoint('GET', '\\/vehicle-claims'),
957
+ VEHICLE_CLAIMS_POST: new Endpoint('POST', '\\/vehicle-claims'),
958
+ VEHICLE_LOGBOOK_POST: new Endpoint('POST', '\\/vehicles\\/\\d+\\/logbooks'),
959
+ VEHICLE_LOGBOOK_PUT: new Endpoint('PUT', '\\/vehicles\\/\\d+\\/logbooks\\/\\d+'),
960
+ VEHICLE_CLAIMS_PUT: new Endpoint('PUT', '\\/vehicle-claims\\/\\d+')
961
+ };
962
+
963
+ var PreloaderService = /** @class */ (function () {
964
+ function PreloaderService() {
965
+ this.activePreloaders = new rxjs.BehaviorSubject([]);
966
+ }
967
+ PreloaderService.prototype.get = function () {
968
+ return this.activePreloaders.asObservable();
969
+ };
970
+ PreloaderService.prototype.add = function (endpoint) {
971
+ var activePreloaders = this.activePreloaders.getValue();
972
+ activePreloaders.push(endpoint);
973
+ this.activePreloaders.next(activePreloaders);
974
+ };
975
+ PreloaderService.prototype.delete = function (endpoint) {
976
+ var activePreloaders = this.activePreloaders.getValue();
977
+ activePreloaders = activePreloaders.filter(function (preloader) { return preloader !== endpoint; });
978
+ this.activePreloaders.next(activePreloaders);
979
+ };
980
+ return PreloaderService;
981
+ }());
982
+ PreloaderService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PreloaderService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
983
+ PreloaderService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PreloaderService, providedIn: 'root' });
984
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PreloaderService, decorators: [{
985
+ type: i0.Injectable,
986
+ args: [{
987
+ providedIn: 'root'
988
+ }]
989
+ }], ctorParameters: function () { return []; } });
990
+
991
+ /**
992
+ * interceptor for preloader handling
993
+ */
994
+ var PreloaderInterceptor = /** @class */ (function () {
995
+ function PreloaderInterceptor(preloaderService) {
996
+ this.preloaderService = preloaderService;
997
+ }
998
+ PreloaderInterceptor.prototype.intercept = function (request, next) {
999
+ var _this = this;
1000
+ var endpoint = this.findEndpoint(request.method + " " + request.url);
1001
+ if (!!endpoint) {
1002
+ this.preloaderService.add(endpoint);
1003
+ return next.handle(request).pipe(operators.finalize(function () {
1004
+ _this.preloaderService.delete(endpoint);
1005
+ }));
1006
+ }
1007
+ return next.handle(request);
1008
+ };
1009
+ PreloaderInterceptor.prototype.findEndpoint = function (requestPath) {
1010
+ return Object.values(ENDPOINTS).find(function (endpoint) { return endpoint.test(requestPath); });
1011
+ };
1012
+ return PreloaderInterceptor;
1013
+ }());
1014
+ PreloaderInterceptor.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PreloaderInterceptor, deps: [{ token: PreloaderService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1015
+ PreloaderInterceptor.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PreloaderInterceptor });
1016
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PreloaderInterceptor, decorators: [{
1017
+ type: i0.Injectable
1018
+ }], ctorParameters: function () { return [{ type: PreloaderService }]; } });
1019
+
1020
+ var InterceptorsModule = /** @class */ (function () {
1021
+ function InterceptorsModule() {
1022
+ }
1023
+ return InterceptorsModule;
1024
+ }());
1025
+ InterceptorsModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: InterceptorsModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1026
+ InterceptorsModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: InterceptorsModule });
1027
+ InterceptorsModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: InterceptorsModule, providers: [
1028
+ {
1029
+ provide: i1.HTTP_INTERCEPTORS,
1030
+ useClass: CorelogicInterceptor,
1031
+ multi: true
1032
+ },
1033
+ // @TODO move to user module
1034
+ {
1035
+ provide: i1.HTTP_INTERCEPTORS,
1036
+ useClass: FinancialYearInterceptor,
1037
+ multi: true
1038
+ },
1039
+ {
1040
+ provide: i1.HTTP_INTERCEPTORS,
1041
+ useClass: JwtInterceptor,
1042
+ multi: true
1043
+ },
1044
+ {
1045
+ provide: i1.HTTP_INTERCEPTORS,
1046
+ useClass: UserSwitcherInterceptor,
1047
+ multi: true
1048
+ },
1049
+ {
1050
+ provide: i1.HTTP_INTERCEPTORS,
1051
+ useClass: PreloaderInterceptor,
1052
+ multi: true
1053
+ }
1054
+ ] });
1055
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: InterceptorsModule, decorators: [{
1056
+ type: i0.NgModule,
1057
+ args: [{
1058
+ providers: [
1059
+ {
1060
+ provide: i1.HTTP_INTERCEPTORS,
1061
+ useClass: CorelogicInterceptor,
1062
+ multi: true
1063
+ },
1064
+ // @TODO move to user module
1065
+ {
1066
+ provide: i1.HTTP_INTERCEPTORS,
1067
+ useClass: FinancialYearInterceptor,
1068
+ multi: true
1069
+ },
1070
+ {
1071
+ provide: i1.HTTP_INTERCEPTORS,
1072
+ useClass: JwtInterceptor,
1073
+ multi: true
1074
+ },
1075
+ {
1076
+ provide: i1.HTTP_INTERCEPTORS,
1077
+ useClass: UserSwitcherInterceptor,
1078
+ multi: true
1079
+ },
1080
+ {
1081
+ provide: i1.HTTP_INTERCEPTORS,
1082
+ useClass: PreloaderInterceptor,
1083
+ multi: true
1084
+ }
1085
+ ]
1086
+ }]
1087
+ }] });
1088
+
1089
+ var TtCoreModule = /** @class */ (function () {
1090
+ function TtCoreModule() {
1091
+ }
1092
+ TtCoreModule.forRoot = function (environment) {
1093
+ localStorage.setItem('api_uri', environment['api_uri']);
1094
+ return {
1095
+ ngModule: TtCoreModule,
1096
+ providers: [
1097
+ {
1098
+ provide: 'environment',
1099
+ useValue: environment
1100
+ }
1101
+ ]
1102
+ };
1103
+ };
1104
+ return TtCoreModule;
1105
+ }());
1106
+ TtCoreModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TtCoreModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1107
+ TtCoreModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TtCoreModule, imports: [common.CommonModule,
1108
+ InterceptorsModule] });
1109
+ TtCoreModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TtCoreModule, imports: [[
1110
+ common.CommonModule,
1111
+ InterceptorsModule
1112
+ ]] });
1113
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TtCoreModule, decorators: [{
1114
+ type: i0.NgModule,
1115
+ args: [{
1116
+ declarations: [],
1117
+ imports: [
1118
+ common.CommonModule,
1119
+ InterceptorsModule
1120
+ ]
1121
+ }]
1122
+ }] });
1123
+
397
1124
  /**
398
1125
  * List of collections grouped by passed property
399
1126
  */
@@ -489,25 +1216,25 @@
489
1216
 
490
1217
  var DEFAULT_INDEX = 'other';
491
1218
  /**
492
- * collection abstract class. Contains common properties and methods for all collections
1219
+ * Base collection class. Contains common properties and methods for all collections
493
1220
  */
494
- var AbstractCollection = /** @class */ (function () {
495
- function AbstractCollection(items) {
1221
+ var Collection = /** @class */ (function () {
1222
+ function Collection(items) {
496
1223
  if (items === void 0) { items = []; }
497
1224
  this.items = items;
498
1225
  }
499
- AbstractCollection.prototype.create = function (items) {
1226
+ Collection.prototype.create = function (items) {
500
1227
  if (items === void 0) { items = []; }
501
1228
  return new this.constructor(items);
502
1229
  };
503
- AbstractCollection.prototype.getBy = function (field, value) {
1230
+ Collection.prototype.getBy = function (field, value) {
504
1231
  return this.create(this.items.filter(function (item) { return item[field] === value; }));
505
1232
  };
506
- AbstractCollection.prototype.groupBy = function (path) {
1233
+ Collection.prototype.groupBy = function (path) {
507
1234
  if (path === void 0) { path = ''; }
508
1235
  return new CollectionDictionary(this, path);
509
1236
  };
510
- AbstractCollection.prototype.indexBy = function (path) {
1237
+ Collection.prototype.indexBy = function (path) {
511
1238
  // Create empty initial object for groups
512
1239
  var result = {};
513
1240
  this.toArray().forEach(function (model) {
@@ -518,11 +1245,11 @@
518
1245
  /**
519
1246
  * Iterator that allow to iterate collection items
520
1247
  */
521
- AbstractCollection.prototype[Symbol.iterator] = function () {
1248
+ Collection.prototype[Symbol.iterator] = function () {
522
1249
  // .values() returns Iterator instance for array
523
1250
  return this.items.values();
524
1251
  };
525
- Object.defineProperty(AbstractCollection.prototype, "length", {
1252
+ Object.defineProperty(Collection.prototype, "length", {
526
1253
  /**
527
1254
  * get collection length
528
1255
  */
@@ -532,55 +1259,46 @@
532
1259
  enumerable: false,
533
1260
  configurable: true
534
1261
  });
535
- /**
536
- * method returns amount of fields from passed items
537
- * @param field Name of field for calculation
538
- * @param items (optional) Array of items need to be calculated. All collection's items by default
539
- */
540
- AbstractCollection.prototype.getSummary = function (field, items) {
541
- if (items === void 0) { items = this.toArray(); }
542
- return items.reduce(function (sum, item) { return sum += item[field]; }, 0);
543
- };
544
1262
  /**
545
1263
  * Get list of items ids
546
1264
  */
547
- AbstractCollection.prototype.getIds = function () {
1265
+ Collection.prototype.getIds = function () {
548
1266
  return this.items.map(function (item) { return item['id']; });
549
1267
  };
550
1268
  /**
551
1269
  * Get single item by id
552
1270
  */
553
- AbstractCollection.prototype.getById = function (id) {
1271
+ Collection.prototype.getById = function (id) {
554
1272
  return this.items.find(function (item) { return item['id'] === id; });
555
1273
  };
556
- AbstractCollection.prototype.getByIds = function (ids) {
1274
+ Collection.prototype.getByIds = function (ids) {
557
1275
  return this.items.filter(function (item) { return ids.includes(item['id']); });
558
1276
  };
559
1277
  /**
560
1278
  * Get total sum of items by field
561
1279
  * @param field Name of the field for sum
562
1280
  */
563
- AbstractCollection.prototype.sumBy = function (field) {
1281
+ Collection.prototype.sumBy = function (field) {
564
1282
  return +this.items.reduce(function (sum, item) { return sum + Number(item[field]); }, 0).toFixed(2);
565
1283
  };
566
- AbstractCollection.prototype.toArray = function () {
1284
+ Collection.prototype.toArray = function () {
567
1285
  return __spreadArray([], __read(this.items));
568
1286
  };
569
- Object.defineProperty(AbstractCollection.prototype, "first", {
1287
+ Object.defineProperty(Collection.prototype, "first", {
570
1288
  get: function () {
571
1289
  return first__default["default"](this.items);
572
1290
  },
573
1291
  enumerable: false,
574
1292
  configurable: true
575
1293
  });
576
- Object.defineProperty(AbstractCollection.prototype, "last", {
1294
+ Object.defineProperty(Collection.prototype, "last", {
577
1295
  get: function () {
578
1296
  return last__default["default"](this.items);
579
1297
  },
580
1298
  enumerable: false,
581
1299
  configurable: true
582
1300
  });
583
- return AbstractCollection;
1301
+ return Collection;
584
1302
  }());
585
1303
 
586
1304
  exports.BankAccountTypeEnum = void 0;
@@ -739,7 +1457,7 @@
739
1457
  }, 0);
740
1458
  };
741
1459
  return BankAccountCollection;
742
- }(AbstractCollection));
1460
+ }(Collection));
743
1461
 
744
1462
  exports.TransactionOperationEnum = void 0;
745
1463
  (function (TransactionOperationEnum) {
@@ -880,7 +1598,7 @@
880
1598
  return new BankTransactionCollection(this.items.filter(function (bankTransaction) { return !bankTransaction.isAllocated(allocations); }));
881
1599
  };
882
1600
  return BankTransactionCollection;
883
- }(AbstractCollection));
1601
+ }(Collection));
884
1602
 
885
1603
  var ClientCollection = /** @class */ (function (_super) {
886
1604
  __extends(ClientCollection, _super);
@@ -888,7 +1606,7 @@
888
1606
  return _super !== null && _super.apply(this, arguments) || this;
889
1607
  }
890
1608
  return ClientCollection;
891
- }(AbstractCollection));
1609
+ }(Collection));
892
1610
 
893
1611
  exports.FirmTypeEnum = void 0;
894
1612
  (function (FirmTypeEnum) {
@@ -917,7 +1635,7 @@
917
1635
  configurable: true
918
1636
  });
919
1637
  return EmployeeCollection;
920
- }(AbstractCollection));
1638
+ }(Collection));
921
1639
 
922
1640
  /**
923
1641
  * Collection of tax review
@@ -970,7 +1688,7 @@
970
1688
  return new ClientMovementCollection(this.items.filter(function (clientMovement) { return clientMovement.firm.type === firmType; }));
971
1689
  };
972
1690
  return ClientMovementCollection;
973
- }(AbstractCollection));
1691
+ }(Collection));
974
1692
 
975
1693
  var ClientPortfolioReportCollection = /** @class */ (function (_super) {
976
1694
  __extends(ClientPortfolioReportCollection, _super);
@@ -1035,7 +1753,7 @@
1035
1753
  return this.items.find(function (item) { return item.category === name; });
1036
1754
  };
1037
1755
  return ClientPortfolioReportCollection;
1038
- }(AbstractCollection));
1756
+ }(Collection));
1039
1757
 
1040
1758
  exports.TankTypeEnum = void 0;
1041
1759
  (function (TankTypeEnum) {
@@ -1122,7 +1840,7 @@
1122
1840
  })), 'id');
1123
1841
  };
1124
1842
  return DepreciationCollection;
1125
- }(AbstractCollection));
1843
+ }(Collection));
1126
1844
 
1127
1845
  /**
1128
1846
  * Collection of depreciations
@@ -1140,20 +1858,20 @@
1140
1858
  };
1141
1859
  Object.defineProperty(DepreciationForecastCollection.prototype, "amount", {
1142
1860
  get: function () {
1143
- return this.getSummary('amount');
1861
+ return this.sumBy('amount');
1144
1862
  },
1145
1863
  enumerable: false,
1146
1864
  configurable: true
1147
1865
  });
1148
1866
  Object.defineProperty(DepreciationForecastCollection.prototype, "claimAmount", {
1149
1867
  get: function () {
1150
- return this.getSummary('claimAmount');
1868
+ return this.sumBy('claimAmount');
1151
1869
  },
1152
1870
  enumerable: false,
1153
1871
  configurable: true
1154
1872
  });
1155
1873
  return DepreciationForecastCollection;
1156
- }(AbstractCollection));
1874
+ }(Collection));
1157
1875
 
1158
1876
  /**
1159
1877
  * Collection of income sources
@@ -1198,7 +1916,7 @@
1198
1916
  configurable: true
1199
1917
  });
1200
1918
  return IncomeSourceCollection;
1201
- }(AbstractCollection));
1919
+ }(Collection));
1202
1920
 
1203
1921
  var LoanCollection = /** @class */ (function (_super) {
1204
1922
  __extends(LoanCollection, _super);
@@ -1220,7 +1938,7 @@
1220
1938
  return this.items.find(function (loan) { var _a; return ((_a = loan.bankAccount) === null || _a === void 0 ? void 0 : _a.id) === id; });
1221
1939
  };
1222
1940
  return LoanCollection;
1223
- }(AbstractCollection));
1941
+ }(Collection));
1224
1942
 
1225
1943
  var FinancialYear = /** @class */ (function () {
1226
1944
  function FinancialYear(date) {
@@ -1414,7 +2132,7 @@
1414
2132
  return !!this.getUnread().length;
1415
2133
  };
1416
2134
  return MessageCollection;
1417
- }(AbstractCollection));
2135
+ }(Collection));
1418
2136
 
1419
2137
  /**
1420
2138
  * Collection of MessageDocument instances
@@ -1431,7 +2149,7 @@
1431
2149
  return new MessageDocumentCollection(this.items.filter(function (doc) { return !doc.message; }));
1432
2150
  };
1433
2151
  return MessageDocumentCollection;
1434
- }(AbstractCollection));
2152
+ }(Collection));
1435
2153
 
1436
2154
  var PropertyCollection = /** @class */ (function (_super) {
1437
2155
  __extends(PropertyCollection, _super);
@@ -1530,8 +2248,14 @@
1530
2248
  enumerable: false,
1531
2249
  configurable: true
1532
2250
  });
2251
+ /**
2252
+ * Get list of unique property categories from collection
2253
+ */
2254
+ PropertyCollection.prototype.getCategories = function () {
2255
+ return uniqBy__default["default"](this.items.map(function (property) { return property.category; }), 'id');
2256
+ };
1533
2257
  return PropertyCollection;
1534
- }(AbstractCollection));
2258
+ }(Collection));
1535
2259
 
1536
2260
  var ServicePriceCollection = /** @class */ (function (_super) {
1537
2261
  __extends(ServicePriceCollection, _super);
@@ -1553,7 +2277,7 @@
1553
2277
  configurable: true
1554
2278
  });
1555
2279
  return ServicePriceCollection;
1556
- }(AbstractCollection));
2280
+ }(Collection));
1557
2281
 
1558
2282
  var ServiceSubscriptionCollection = /** @class */ (function (_super) {
1559
2283
  __extends(ServiceSubscriptionCollection, _super);
@@ -1586,7 +2310,7 @@
1586
2310
  return (_a = this.items.filter(function (subscription) { return subscription.propertyQuantity === properties; })[0]) !== null && _a !== void 0 ? _a : this.investor;
1587
2311
  };
1588
2312
  return ServiceSubscriptionCollection;
1589
- }(AbstractCollection));
2313
+ }(Collection));
1590
2314
 
1591
2315
  exports.TaxReturnCategoryListEnum = void 0;
1592
2316
  (function (TaxReturnCategoryListEnum) {
@@ -1846,7 +2570,7 @@
1846
2570
  return this.items.find(function (item) { return item.taxReturnCategory.id === category; });
1847
2571
  };
1848
2572
  return TaxReturnCategoryItemCollection;
1849
- }(AbstractCollection));
2573
+ }(Collection));
1850
2574
 
1851
2575
  /**
1852
2576
  * Collection of tax review
@@ -1904,7 +2628,7 @@
1904
2628
  return uniqBy__default["default"](this.items.map(function (review) { return review.employee; }), 'id');
1905
2629
  };
1906
2630
  return TaxReviewCollection;
1907
- }(AbstractCollection));
2631
+ }(Collection));
1908
2632
 
1909
2633
  var TransactionAllocationCollection = /** @class */ (function (_super) {
1910
2634
  __extends(TransactionAllocationCollection, _super);
@@ -1952,7 +2676,7 @@
1952
2676
  return !!this.items.find(function (allocation) { return allocation.bankTransaction.id === bankTransaction.id; });
1953
2677
  };
1954
2678
  return TransactionAllocationCollection;
1955
- }(AbstractCollection));
2679
+ }(Collection));
1956
2680
 
1957
2681
  /**
1958
2682
  * Collection of transactions
@@ -2100,7 +2824,7 @@
2100
2824
  return new TransactionCollection(this.items.filter(function (transaction) { return allocations.hasTransaction(transaction); }));
2101
2825
  };
2102
2826
  return TransactionCollection;
2103
- }(AbstractCollection));
2827
+ }(Collection));
2104
2828
 
2105
2829
  /**
2106
2830
  * Collection of user event settings
@@ -2114,7 +2838,7 @@
2114
2838
  return new UserEventSettingCollection(this.items.filter(function (setting) { return setting[field] !== null; }));
2115
2839
  };
2116
2840
  return UserEventSettingCollection;
2117
- }(AbstractCollection));
2841
+ }(Collection));
2118
2842
 
2119
2843
  exports.ChartAccountsCategoryEnum = void 0;
2120
2844
  (function (ChartAccountsCategoryEnum) {
@@ -2317,6 +3041,7 @@
2317
3041
  (function (ChartAccountsMetadataListEnum) {
2318
3042
  ChartAccountsMetadataListEnum[ChartAccountsMetadataListEnum["TAX_INSTALMENTS"] = 4] = "TAX_INSTALMENTS";
2319
3043
  ChartAccountsMetadataListEnum[ChartAccountsMetadataListEnum["FRANKING_CREDIT"] = 5] = "FRANKING_CREDIT";
3044
+ ChartAccountsMetadataListEnum[ChartAccountsMetadataListEnum["ELIGIBLE_FOR_REDUCTION"] = 6] = "ELIGIBLE_FOR_REDUCTION";
2320
3045
  ChartAccountsMetadataListEnum[ChartAccountsMetadataListEnum["SHARE_PERCENTAGE"] = 7] = "SHARE_PERCENTAGE";
2321
3046
  ChartAccountsMetadataListEnum[ChartAccountsMetadataListEnum["TAX_OFFSETS"] = 8] = "TAX_OFFSETS";
2322
3047
  ChartAccountsMetadataListEnum[ChartAccountsMetadataListEnum["HOURS"] = 11] = "HOURS";
@@ -4897,6 +5622,13 @@
4897
5622
  enumerable: false,
4898
5623
  configurable: true
4899
5624
  });
5625
+ Object.defineProperty(Transaction.prototype, "eligibleForReduction", {
5626
+ get: function () {
5627
+ return this.getMetadataFieldValue(exports.ChartAccountsMetadataListEnum.ELIGIBLE_FOR_REDUCTION);
5628
+ },
5629
+ enumerable: false,
5630
+ configurable: true
5631
+ });
4900
5632
  Object.defineProperty(Transaction.prototype, "untaxedElement", {
4901
5633
  get: function () {
4902
5634
  return this.getMetadataFieldValue(exports.ChartAccountsMetadataListEnum.UNTAXED_ELEMENT);
@@ -4915,6 +5647,20 @@
4915
5647
  enumerable: false,
4916
5648
  configurable: true
4917
5649
  });
5650
+ Object.defineProperty(Transaction.prototype, "debit", {
5651
+ get: function () {
5652
+ return this.isDebit() ? Math.abs(this.amount) : null;
5653
+ },
5654
+ enumerable: false,
5655
+ configurable: true
5656
+ });
5657
+ Object.defineProperty(Transaction.prototype, "credit", {
5658
+ get: function () {
5659
+ return this.isCredit() ? Math.abs(this.amount) : null;
5660
+ },
5661
+ enumerable: false,
5662
+ configurable: true
5663
+ });
4918
5664
  /**
4919
5665
  * Get value of transaction metadata field
4920
5666
  * @param field for which value should be returned
@@ -4938,7 +5684,7 @@
4938
5684
  (this.transactions
4939
5685
  .reduce(function (sum, transaction) { return sum + Math.abs(transaction.amount); }, 0) * modifier);
4940
5686
  case this.isWorkTank():
4941
- return this.amount + ((this.tax + this.frankingCredit - this.taxFreeComponent) * modifier);
5687
+ return this.amount + ((this.tax + this.frankingCredit - this.taxFreeComponent - this.eligibleForReduction) * modifier);
4942
5688
  default:
4943
5689
  return this.amount || 0;
4944
5690
  }
@@ -5645,6 +6391,36 @@
5645
6391
  return ClientPortfolioReport;
5646
6392
  }());
5647
6393
 
6394
+ exports.AlphabetColorsEnum = void 0;
6395
+ (function (AlphabetColorsEnum) {
6396
+ AlphabetColorsEnum["A"] = "#9CC3D5";
6397
+ AlphabetColorsEnum["B"] = "#E69A8D";
6398
+ AlphabetColorsEnum["C"] = "#ED2B33";
6399
+ AlphabetColorsEnum["D"] = "#E3CD81";
6400
+ AlphabetColorsEnum["E"] = "#343148";
6401
+ AlphabetColorsEnum["F"] = "#2C5F2D";
6402
+ AlphabetColorsEnum["G"] = "#FFA177";
6403
+ AlphabetColorsEnum["H"] = "#435E55";
6404
+ AlphabetColorsEnum["I"] = "#2BAE66";
6405
+ AlphabetColorsEnum["J"] = "#3C1053";
6406
+ AlphabetColorsEnum["K"] = "#DD4132";
6407
+ AlphabetColorsEnum["L"] = "#FC766A";
6408
+ AlphabetColorsEnum["M"] = "#ADEFD1";
6409
+ AlphabetColorsEnum["N"] = "#79C000";
6410
+ AlphabetColorsEnum["O"] = "#D198C5";
6411
+ AlphabetColorsEnum["P"] = "#5B84B1";
6412
+ AlphabetColorsEnum["Q"] = "#A13941";
6413
+ AlphabetColorsEnum["R"] = "#D85A7F";
6414
+ AlphabetColorsEnum["S"] = "#00203F";
6415
+ AlphabetColorsEnum["T"] = "#42EADD";
6416
+ AlphabetColorsEnum["U"] = "#5F4B8B";
6417
+ AlphabetColorsEnum["V"] = "#FDDB27";
6418
+ AlphabetColorsEnum["W"] = "#CDB599";
6419
+ AlphabetColorsEnum["X"] = "#4B878B";
6420
+ AlphabetColorsEnum["Y"] = "#B0B8B4";
6421
+ AlphabetColorsEnum["Z"] = "#E3C9CE";
6422
+ })(exports.AlphabetColorsEnum || (exports.AlphabetColorsEnum = {}));
6423
+
5648
6424
  /**
5649
6425
  * Class to generate data-table structure based on provided collection.
5650
6426
  * Use to work with HTML/PDF/XLSX tables
@@ -5679,9 +6455,11 @@
5679
6455
  if (!column.total) {
5680
6456
  return '';
5681
6457
  }
5682
- return collection.items
5683
- .reduce(function (sum, item) { return sum + Number(item[column.key]); }, 0)
5684
- .toString();
6458
+ var totalValue = collection.items.reduce(function (sum, item) {
6459
+ // check if current collection item has value. If not - don't add it to the sum
6460
+ return item[column.key] !== null ? sum + Number(item[column.key]) : sum;
6461
+ }, null);
6462
+ return (totalValue !== null && totalValue !== void 0 ? totalValue : '-').toString();
5685
6463
  });
5686
6464
  };
5687
6465
  return DataTable;
@@ -5874,188 +6652,17 @@
5874
6652
 
5875
6653
  var EmployeeInvite = /** @class */ (function (_super) {
5876
6654
  __extends(EmployeeInvite, _super);
5877
- function EmployeeInvite() {
5878
- return _super !== null && _super.apply(this, arguments) || this;
5879
- }
5880
- return EmployeeInvite;
5881
- }(EmployeeInvite$1));
5882
- __decorate([
5883
- classTransformer.Type(function () { return RegistrationInvite; })
5884
- ], EmployeeInvite.prototype, "registrationInvite", void 0);
5885
- __decorate([
5886
- classTransformer.Type(function () { return User; })
5887
- ], EmployeeInvite.prototype, "employee", void 0);
5888
-
5889
- /**
5890
- * Backend endpoint class
5891
- */
5892
- var Endpoint = /** @class */ (function () {
5893
- function Endpoint(method, pattern) {
5894
- this.method = method;
5895
- this.pattern = pattern;
5896
- }
5897
- /**
5898
- * check url with regexp
5899
- * @param url
5900
- */
5901
- Endpoint.prototype.test = function (url) {
5902
- return this.regexp.test(url);
5903
- };
5904
- Object.defineProperty(Endpoint.prototype, "regexp", {
5905
- /**
5906
- * Get regexp for endpoint
5907
- */
5908
- get: function () {
5909
- return new RegExp("^" + this.method + " .*" + this.pattern + "$");
5910
- },
5911
- enumerable: false,
5912
- configurable: true
5913
- });
5914
- return Endpoint;
5915
- }());
5916
-
5917
- /**
5918
- * List of all app endpoints
5919
- */
5920
- var ENDPOINTS = {
5921
- ASSETS_GET: new Endpoint('GET', '\\/assets\\/\.\*\\/\\d+'),
5922
- BANK_ACCOUNTS_GET: new Endpoint('GET', '\\/bank-accounts'),
5923
- BANK_ACCOUNTS_POST: new Endpoint('POST', '\\/bank-accounts'),
5924
- BANK_ACCOUNTS_PUT: new Endpoint('PUT', '\\/bank-accounts\\/\\d+'),
5925
- BANK_CONNECTION_POST: new Endpoint('POST', '\\/bank-connections'),
5926
- BANK_TRANSACTIONS_GET: new Endpoint('GET', '\\/bank-transactions'),
5927
- BANK_TRANSACTIONS_DELETE: new Endpoint('DELETE', '\\/bank-transactions\\/\\d+'),
5928
- BANK_TRANSACTIONS_IMPORT_POST: new Endpoint('POST', '\\/bank-transactions\\/\\d+\\/import'),
5929
- BASIQ_ACCOUNTS_GET: new Endpoint('GET', '\\/basiq\\/\\accounts'),
5930
- CAPITAL_COSTS_GET: new Endpoint('GET', '\\/capital-costs'),
5931
- CHARTS_INCOME_GET: new Endpoint('GET', '\\/charts\\/\\incomes'),
5932
- CHARTS_EXPENSES_GET: new Endpoint('GET', '\\/charts\\/\\expenses'),
5933
- CHART_ACCOUNTS_GET: new Endpoint('GET', '\\/chart-accounts'),
5934
- CLIENTS_GET: new Endpoint('GET', '\\/clients'),
5935
- CLIENTS_PUT: new Endpoint('PUT', '\\/clients'),
5936
- CLIENTS_EXCLUDE_PUT: new Endpoint('PUT', '\\/clients\\/\\d+\\/exclude'),
5937
- CLIENTS_INVITES_GET: new Endpoint('GET', '\\/clients\\/\\invites'),
5938
- CLIENTS_INVITES_POST: new Endpoint('POST', '\\/clients\\/\\invites'),
5939
- CLIENTS_INVITES_DELETE: new Endpoint('DELETE', '\\/clients\\/\\invites\\/\\d+'),
5940
- CLIENTS_INVITES_ACCEPT_POST: new Endpoint('POST', '\\/clients\\/\\invites\\/\\d+\\/accept'),
5941
- CLIENTS_INVITES_REJECT_POST: new Endpoint('POST', '\\/clients\\/\\invites\\/\\d+\\/reject'),
5942
- CLIENTS_INVITES_RESEND_POST: new Endpoint('POST', '\\/clients\\/\\invites\\/\\d+\\/resend'),
5943
- CLIENT_MOVEMENTS_GET: new Endpoint('GET', '\\/client-movements'),
5944
- CLIENT_MOVEMENTS_POST: new Endpoint('POST', '\\/client-movements'),
5945
- COUNTRIES_GET: new Endpoint('GET', '\\/countries'),
5946
- DEPRECIATIONS_CLOSING_GET: new Endpoint('GET', '\\/depreciations\\/\\closing-balance\.\*'),
5947
- DEPRECIATIONS_GET: new Endpoint('GET', '\\/depreciations'),
5948
- DEPRECIATIONS_POST: new Endpoint('POST', '\\/depreciations'),
5949
- DEPRECIATIONS_PUT: new Endpoint('PUT', '\\/depreciations\\/\\d+'),
5950
- EMPLOYEES_GET: new Endpoint('GET', '\\/employees'),
5951
- EMPLOYEES_INVITES_GET: new Endpoint('GET', '\\/employees\\/\\invites'),
5952
- EMPLOYEES_INVITES_DELETE: new Endpoint('DELETE', '\\/employees\\/\\invites\\/\\d+'),
5953
- EMPLOYEES_INVITE_POST: new Endpoint('POST', '\\/employees\\/\\invites'),
5954
- EMPLOYEES_INVITES_REJECT_POST: new Endpoint('POST', '\\/employees\\/\\invites\\/\\d+\\/\\reject'),
5955
- EMPLOYEES_INVITES_RESEND_POST: new Endpoint('POST', '\\/employees\\/\\invites\\/\\d+\\/\\resend'),
5956
- FIRM_GET: new Endpoint('GET', '\\/firms'),
5957
- FIRM_CURRENT_GET: new Endpoint('GET', '\\/firms\\/current'),
5958
- FIRM_CURRENT_PUT: new Endpoint('PUT', '\\/firms\\/current\.\*'),
5959
- FIRM_INVITE_POST: new Endpoint('POST', '\\/firms\\/invite'),
5960
- FIRM_REGISTRATION_POST: new Endpoint('POST', '\\/firms\\/registration'),
5961
- FIRM_UPDATE_PHOTO_POST: new Endpoint('POST', '\\/firms\\/photo\.\*'),
5962
- FOLDERS_GET: new Endpoint('GET', '\\/folders'),
5963
- FOLDERS_POST: new Endpoint('POST', '\\/folders'),
5964
- FOLDERS_PUT: new Endpoint('PUT', '\\/folders\\/\\d+'),
5965
- FOLDERS_DOCUMENTS_POST: new Endpoint('POST', '\\/folders\\/\\d+\\/documents'),
5966
- FOLDERS_DOCUMENTS_PUT: new Endpoint('PUT', '\\/folders\\/\\d+\\/documents\\/\\d+'),
5967
- INCOME_SOURCES_GET: new Endpoint('GET', '\\/income-sources'),
5968
- INCOME_SOURCES_POST: new Endpoint('POST', '\\/income-sources'),
5969
- INCOME_SOURCES_PUT: new Endpoint('PUT', '\\/income-sources'),
5970
- INCOME_SOURCES_DELETE: new Endpoint('DELETE', '\\/income-sources\\/\\d+'),
5971
- INCOME_SOURCE_FORECAST_GET: new Endpoint('GET', '\\/income-source-forecasts'),
5972
- INCOME_SOURCE_FORECAST_POST: new Endpoint('POST', '\\/income-source-forecasts'),
5973
- INCOME_SOURCE_FORECAST_PUT: new Endpoint('PUT', '\\/income-source-forecasts'),
5974
- INCOME_SOURCE_FORECAST_DELETE: new Endpoint('DELETE', '\\/income-source-forecasts\\/\\d+'),
5975
- INCOME_SOURCE_TYPES_GET: new Endpoint('GET', '\\/income-source-types'),
5976
- LOANS_GET: new Endpoint('GET', '\\/bank-accounts\\/loans'),
5977
- LOANS_POST: new Endpoint('POST', '\\/bank-accounts\\/loans'),
5978
- LOANS_PUT: new Endpoint('PUT', '\\/bank-accounts\\/loans/\\d+'),
5979
- LOANS_PAYOUT_POST: new Endpoint('POST', '\\/loans\\/\\d+\\/payout'),
5980
- LOANS_PAYOUT_PUT: new Endpoint('PUT', '\\/loans\\/\\d+\\/payout\\/\\d+'),
5981
- LOANS_PAYOUT_DELETE: new Endpoint('DELETE', '\\/loans\\/\\d+\\/payout\\/\\d+'),
5982
- LOANS_CALCULATION_POST: new Endpoint('POST', '\\/bank-accounts\\/loans\\/calculation'),
5983
- LOGIN_CHECK_POST: new Endpoint('POST', '\\/login_check'),
5984
- NOTIFICATIONS_GET: new Endpoint('GET', '\\/service-notifications'),
5985
- OCCUPATIONS_GET: new Endpoint('GET', '\\/occupations'),
5986
- PROPERTIES_GET: new Endpoint('GET', '\\/properties'),
5987
- PROPERTIES_POST: new Endpoint('POST', '\\/properties'),
5988
- PROPERTY_PUT: new Endpoint('PUT', '\\/properties/\\d+'),
5989
- PROPERTIES_PUT: new Endpoint('PUT', '\\/properties'),
5990
- PROPERTIES_CATEGORIES_EQUITY_GET: new Endpoint('GET', '\\/properties\\/categories\\/equity'),
5991
- PROPERTIES_CATEGORIES_GET: new Endpoint('GET', '\\/properties\\/categories'),
5992
- PROPERTIES_CATEGORIES_PUT: new Endpoint('PUT', '\\/properties\\/categories\\/\\d+'),
5993
- PROPERTIES_CATEGORIES_POST: new Endpoint('POST', '\\/properties\\/categories'),
5994
- PROPERTIES_CATEGORY_MOVEMENTS_POST: new Endpoint('POST', '\\/properties\\/\\d+\\/category-movements'),
5995
- PROPERTIES_CATEGORY_MOVEMENTS_PUT: new Endpoint('PUT', '\\/properties\\/\\d+\\/category-movements\\/\\d+'),
5996
- PROPERTIES_CO_OWNERS_PUT: new Endpoint('PUT', '\\/properties\\/co-owners\\/\\d+'),
5997
- PROPERTIES_CO_OWNERS_GET: new Endpoint('GET', '\\/properties\\/co-owners'),
5998
- PROPERTIES_CO_OWNERS_POST: new Endpoint('POST', '\\/properties\\/co-owners'),
5999
- PROPERTIES_DEACTIVATE_PUT: new Endpoint('PUT', '\\/properties\\/\\d+\\/deactivate'),
6000
- PROPERTIES_DEPRECIATION_CAPITAL_PROJECT_GET: new Endpoint('GET', '\\/properties\\/\\d+\\/depreciation-capital-projects'),
6001
- PROPERTIES_DEPRECIATION_CAPITAL_PROJECT_POST: new Endpoint('POST', '\\/properties\\/\\d+\\/depreciation-capital-projects'),
6002
- PROPERTIES_DEPRECIATION_CAPITAL_PROJECT_PUT: new Endpoint('PUT', '\\/properties\\/\\d+\\/depreciation-capital-projects\\/\\d+'),
6003
- PROPERTIES_DEPRECIATION_CAPITAL_PROJECT_DELETE: new Endpoint('DELETE', '\\/properties\\/\\d+\\/depreciation-capital-projects\\/\\d+'),
6004
- PROPERTIES_DOCUMENTS_GET: new Endpoint('GET', '\\/properties\\/documents'),
6005
- PROPERTIES_DOCUMENTS_POST: new Endpoint('POST', '\\/properties\\/\\d+\\/documents'),
6006
- PROPERTIES_DOCUMENTS_PUT: new Endpoint('PUT', '\\/properties\\/documents\\/\\d+'),
6007
- PROPERTIES_DOCUMENTS_DELETE: new Endpoint('DELETE', '\\/properties\\/documents\\/\\d+'),
6008
- PROPERTIES_PHOTO_POST: new Endpoint('POST', '\\/properties\\/\\d+\\/photo\.\*'),
6009
- PROPERTIES_SUGGESTIONS_GET: new Endpoint('GET', '/property\\/\\w+\\/v2\\/.*$'),
6010
- PROPERTIES_VALUATIONS_DOCUMENTS_POST: new Endpoint('POST', '\\/properties\\/\\d+\\/valuations\\/\\d+\\/documents'),
6011
- PRORATION_COST_POST: new Endpoint('POST', '\\/subscriptions\\/proration-cost'),
6012
- SALARY_FORECAST_GET: new Endpoint('GET', '\\/salary-forecasts'),
6013
- SALARY_FORECAST_POST: new Endpoint('POST', '\\/salary-forecasts'),
6014
- SALARY_FORECAST_PUT: new Endpoint('PUT', '\\/salary-forecasts'),
6015
- SERVICE_PRICES_GET: new Endpoint('GET', '\\/service-prices'),
6016
- SERVICE_PAYMENTS_GET: new Endpoint('GET', '\\/service-payments'),
6017
- STRIPE_BILLING_PORTAL_GET: new Endpoint('GET', '\\/stripe\\/billing-portal-session'),
6018
- STRIPE_CHECKOUT_SESSION_POST: new Endpoint('POST', '\\/stripe\\/checkout-session'),
6019
- SUBSCRIPTION_LAST_GET: new Endpoint('GET', '\\/subscriptions\\/last'),
6020
- SUBSCRIPTION_ITEMS_PUT: new Endpoint('PUT', '\\/subscriptions\\/items'),
6021
- TAX_CALCULATION_POST: new Endpoint('POST', '\\/tax-calculation'),
6022
- TAX_REVIEWS_GET: new Endpoint('GET', '\\/tax-reviews'),
6023
- TAX_REVIEWS_DELETE: new Endpoint('DELETE', '\\/tax-reviews\\/\\d+'),
6024
- TAX_REVIEWS_POST: new Endpoint('POST', '\\/tax-reviews'),
6025
- TAX_REVIEWS_PUT: new Endpoint('PUT', '\\/tax-reviews\\/\\d+'),
6026
- TAX_SUMMARY_ACTUAL_GET: new Endpoint('GET', '\\/tax-summary\\/actuals'),
6027
- TAX_SUMMARY_FORECAST_GET: new Endpoint('GET', '\\/tax-summary\\/forecasts'),
6028
- TRANSACTION_DELETE: new Endpoint('DELETE', '\\/transactions\\/\\d+'),
6029
- TRANSACTION_PUT: new Endpoint('PUT', '\\/transactions\\/\\d+'),
6030
- TRANSACTIONS_GET: new Endpoint('GET', '\\/transactions'),
6031
- TRANSACTIONS_POST: new Endpoint('POST', '\\/transactions'),
6032
- TRANSACTIONS_PUT: new Endpoint('PUT', '\\/transactions'),
6033
- TRANSACTIONS_ALLOCATIONS_GET: new Endpoint('GET', '\\/transactions-allocations'),
6034
- TRANSACTIONS_ALLOCATIONS_POST: new Endpoint('POST', '\\/transactions-allocations'),
6035
- TRANSACTIONS_ALLOCATIONS_DELETE: new Endpoint('DELETE', '\\/transactions-allocations\\/\\d+'),
6036
- USER_CONFIRMATION_POST: new Endpoint('POST', '\\/users\\/confirmation'),
6037
- USER_CURRENT_GET: new Endpoint('GET', '\\/users\\/current'),
6038
- USER_CURRENT_PASSWORD_PUT: new Endpoint('PUT', '\\/users\\/current\\/password\.\*'),
6039
- USER_EVENT_SETTINGS_GET: new Endpoint('GET', '\\/user-event-settings'),
6040
- USER_EVENT_TYPES_GET: new Endpoint('GET', '\\/user-event-types'),
6041
- USER_INVITE_DELETE: new Endpoint('DELETE', '\\/users\\/invite\\/\\d+'),
6042
- USER_INVITE_POST: new Endpoint('POST', '\\/users\\/invite'),
6043
- USER_INVITE_RESEND_POST: new Endpoint('POST', '\\/users\\/invite/\\d+\\/resend'),
6044
- USER_PUT: new Endpoint('PUT', '\\/users\\/\\d+'),
6045
- USER_REGISTRATION_POST: new Endpoint('POST', '\\/users\\/registration'),
6046
- USER_RESET_PASSWORD_PUT: new Endpoint('PUT', '\\/users\\/reset-password'),
6047
- USER_SEARCH_GET: new Endpoint('GET', '\\/users\\/search\.\*'),
6048
- USER_UPDATE_PHOTO_POST: new Endpoint('POST', '\\/users\\/photo\.\*'),
6049
- USER_STATUS_PUT: new Endpoint('PUT', '\\/users\\/status'),
6050
- VEHICLES_GET: new Endpoint('GET', '\\/vehicles'),
6051
- VEHICLES_POST: new Endpoint('POST', '\\/vehicles'),
6052
- VEHICLES_PUT: new Endpoint('PUT', '\\/vehicles\\/\\d+'),
6053
- VEHICLE_CLAIMS_GET: new Endpoint('GET', '\\/vehicle-claims'),
6054
- VEHICLE_CLAIMS_POST: new Endpoint('POST', '\\/vehicle-claims'),
6055
- VEHICLE_LOGBOOK_POST: new Endpoint('POST', '\\/vehicles\\/\\d+\\/logbooks'),
6056
- VEHICLE_LOGBOOK_PUT: new Endpoint('PUT', '\\/vehicles\\/\\d+\\/logbooks\\/\\d+'),
6057
- VEHICLE_CLAIMS_PUT: new Endpoint('PUT', '\\/vehicle-claims\\/\\d+')
6058
- };
6655
+ function EmployeeInvite() {
6656
+ return _super !== null && _super.apply(this, arguments) || this;
6657
+ }
6658
+ return EmployeeInvite;
6659
+ }(EmployeeInvite$1));
6660
+ __decorate([
6661
+ classTransformer.Type(function () { return RegistrationInvite; })
6662
+ ], EmployeeInvite.prototype, "registrationInvite", void 0);
6663
+ __decorate([
6664
+ classTransformer.Type(function () { return User; })
6665
+ ], EmployeeInvite.prototype, "employee", void 0);
6059
6666
 
6060
6667
  /**
6061
6668
  * any event happened in the app, which needs to be handled somehow (distributed to other part of the app)
@@ -6092,19 +6699,22 @@
6092
6699
  AppEventTypeEnum[AppEventTypeEnum["NOTIFICATION_ADDED"] = 19] = "NOTIFICATION_ADDED";
6093
6700
  AppEventTypeEnum[AppEventTypeEnum["PROPERTY_UPDATED_WITH_DOCUMENT"] = 20] = "PROPERTY_UPDATED_WITH_DOCUMENT";
6094
6701
  AppEventTypeEnum[AppEventTypeEnum["PROPERTY_DOCUMENT_ADDED"] = 21] = "PROPERTY_DOCUMENT_ADDED";
6095
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_OWNER_UPDATED"] = 22] = "PROPERTY_OWNER_UPDATED";
6096
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SUBSCRIPTION_ADDED"] = 23] = "PROPERTY_SUBSCRIPTION_ADDED";
6097
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SUBSCRIPTION_DELETED"] = 24] = "PROPERTY_SUBSCRIPTION_DELETED";
6098
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_VALUATION_DOCUMENT_CREATED"] = 25] = "PROPERTY_VALUATION_DOCUMENT_CREATED";
6099
- AppEventTypeEnum[AppEventTypeEnum["SERVICE_SUBSCRIPTION_UPDATED"] = 26] = "SERVICE_SUBSCRIPTION_UPDATED";
6100
- AppEventTypeEnum[AppEventTypeEnum["TAX_REVIEW_UPDATED"] = 27] = "TAX_REVIEW_UPDATED";
6101
- AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_CREATED"] = 28] = "TRANSACTION_CREATED";
6102
- AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_DELETED"] = 29] = "TRANSACTION_DELETED";
6103
- AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED"] = 30] = "TRANSACTION_UPDATED";
6104
- AppEventTypeEnum[AppEventTypeEnum["TRANSACTIONS_CREATED"] = 31] = "TRANSACTIONS_CREATED";
6105
- AppEventTypeEnum[AppEventTypeEnum["USER_UPDATED"] = 32] = "USER_UPDATED";
6106
- AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_UPDATED"] = 33] = "VEHICLE_CLAIM_UPDATED";
6107
- AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_CREATED"] = 34] = "VEHICLE_CLAIM_CREATED";
6702
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_MOVEMENT_CREATED"] = 22] = "PROPERTY_MOVEMENT_CREATED";
6703
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_MOVEMENT_UPDATED"] = 23] = "PROPERTY_MOVEMENT_UPDATED";
6704
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_MOVEMENT_DELETED"] = 24] = "PROPERTY_MOVEMENT_DELETED";
6705
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_OWNER_UPDATED"] = 25] = "PROPERTY_OWNER_UPDATED";
6706
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SUBSCRIPTION_ADDED"] = 26] = "PROPERTY_SUBSCRIPTION_ADDED";
6707
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SUBSCRIPTION_DELETED"] = 27] = "PROPERTY_SUBSCRIPTION_DELETED";
6708
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_VALUATION_DOCUMENT_CREATED"] = 28] = "PROPERTY_VALUATION_DOCUMENT_CREATED";
6709
+ AppEventTypeEnum[AppEventTypeEnum["SERVICE_SUBSCRIPTION_UPDATED"] = 29] = "SERVICE_SUBSCRIPTION_UPDATED";
6710
+ AppEventTypeEnum[AppEventTypeEnum["TAX_REVIEW_UPDATED"] = 30] = "TAX_REVIEW_UPDATED";
6711
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_CREATED"] = 31] = "TRANSACTION_CREATED";
6712
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_DELETED"] = 32] = "TRANSACTION_DELETED";
6713
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED"] = 33] = "TRANSACTION_UPDATED";
6714
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTIONS_CREATED"] = 34] = "TRANSACTIONS_CREATED";
6715
+ AppEventTypeEnum[AppEventTypeEnum["USER_UPDATED"] = 35] = "USER_UPDATED";
6716
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_UPDATED"] = 36] = "VEHICLE_CLAIM_UPDATED";
6717
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_CREATED"] = 37] = "VEHICLE_CLAIM_CREATED";
6108
6718
  })(exports.AppEventTypeEnum || (exports.AppEventTypeEnum = {}));
6109
6719
 
6110
6720
  exports.IconsFileEnum = void 0;
@@ -6332,6 +6942,12 @@
6332
6942
  enumerable: false,
6333
6943
  configurable: true
6334
6944
  });
6945
+ /**
6946
+ * Claim amount for Kms method
6947
+ */
6948
+ VehicleClaim.prototype.getKmsClaimAmount = function (vehicleClaimRate) {
6949
+ return +(this.kilometers * vehicleClaimRate).toFixed(2);
6950
+ };
6335
6951
  return VehicleClaim;
6336
6952
  }(VehicleClaim$1));
6337
6953
 
@@ -6466,16 +7082,6 @@
6466
7082
  }),
6467
7083
  ];
6468
7084
 
6469
- /**
6470
- * https://api-uat.corelogic.asia/property/au/v2/suggest.json
6471
- * address suggestion from corelogic service
6472
- */
6473
- var CorelogicSuggestion = /** @class */ (function () {
6474
- function CorelogicSuggestion() {
6475
- }
6476
- return CorelogicSuggestion;
6477
- }());
6478
-
6479
7085
  /**
6480
7086
  * Enum with properties ownership filter options
6481
7087
  */
@@ -7235,44 +7841,6 @@
7235
7841
  }] }];
7236
7842
  } });
7237
7843
 
7238
- var KEY = '_switch_user';
7239
- /**
7240
- * provides user management to managers (users with ROLE_ACCOUNTANT for now, more in future)
7241
- */
7242
- var UserSwitcherService = /** @class */ (function () {
7243
- function UserSwitcherService() {
7244
- }
7245
- /**
7246
- * get switched username
7247
- */
7248
- UserSwitcherService.prototype.get = function () {
7249
- return localStorage[KEY];
7250
- };
7251
- /**
7252
- * switch to user (username should be used for correct work of backend)
7253
- */
7254
- UserSwitcherService.prototype.set = function (username) {
7255
- localStorage[KEY] = username;
7256
- window.location.replace('/client/dashboard');
7257
- };
7258
- /**
7259
- * go back to original user
7260
- */
7261
- UserSwitcherService.prototype.reset = function () {
7262
- localStorage.removeItem(KEY);
7263
- window.location.replace('/firm/dashboard');
7264
- };
7265
- return UserSwitcherService;
7266
- }());
7267
- UserSwitcherService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: UserSwitcherService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
7268
- UserSwitcherService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: UserSwitcherService, providedIn: 'root' });
7269
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: UserSwitcherService, decorators: [{
7270
- type: i0.Injectable,
7271
- args: [{
7272
- providedIn: 'root'
7273
- }]
7274
- }] });
7275
-
7276
7844
  /**
7277
7845
  * Service to work with assets (documents, receipts, e.t.c.)
7278
7846
  */
@@ -7323,90 +7891,6 @@
7323
7891
  }] }];
7324
7892
  } });
7325
7893
 
7326
- var NAME_TOKEN = 'token';
7327
- var NAME_REFRESH_TOKEN = 'refreshToken';
7328
- var JwtService = /** @class */ (function (_super) {
7329
- __extends(JwtService, _super);
7330
- function JwtService() {
7331
- return _super !== null && _super.apply(this, arguments) || this;
7332
- }
7333
- JwtService.prototype.getToken = function () {
7334
- return localStorage[NAME_TOKEN];
7335
- };
7336
- JwtService.prototype.getRefreshToken = function () {
7337
- return localStorage[NAME_REFRESH_TOKEN];
7338
- };
7339
- JwtService.prototype.saveTokens = function (tokens) {
7340
- localStorage[NAME_TOKEN] = tokens.token;
7341
- localStorage[NAME_REFRESH_TOKEN] = tokens.refreshToken;
7342
- };
7343
- JwtService.prototype.destroyTokens = function () {
7344
- localStorage.removeItem(NAME_TOKEN);
7345
- localStorage.removeItem(NAME_REFRESH_TOKEN);
7346
- };
7347
- JwtService.prototype.getUser = function () {
7348
- return this.decodeToken();
7349
- };
7350
- JwtService.prototype.isMe = function (userId) {
7351
- return this.getUser().id === userId;
7352
- };
7353
- return JwtService;
7354
- }(angularJwt.JwtHelperService));
7355
- JwtService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: JwtService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
7356
- JwtService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: JwtService, providedIn: 'root' });
7357
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: JwtService, decorators: [{
7358
- type: i0.Injectable,
7359
- args: [{
7360
- providedIn: 'root'
7361
- }]
7362
- }] });
7363
-
7364
- var AuthService = /** @class */ (function () {
7365
- function AuthService(http, jwtService, environment) {
7366
- this.http = http;
7367
- this.jwtService = jwtService;
7368
- this.environment = environment;
7369
- this.isLoggedInSubject = new rxjs.BehaviorSubject(!this.jwtService.isTokenExpired());
7370
- }
7371
- AuthService.prototype.setAuth = function (response) {
7372
- this.jwtService.saveTokens(response);
7373
- this.isLoggedInSubject.next(true);
7374
- };
7375
- AuthService.prototype.login = function (username, password) {
7376
- var _this = this;
7377
- return this.http.post(this.environment.apiV2 + "/login_check", { username: username, password: password }).pipe(operators.map(function (response) {
7378
- _this.setAuth(response);
7379
- return response;
7380
- }));
7381
- };
7382
- AuthService.prototype.refresh = function (refreshToken) {
7383
- var _this = this;
7384
- return this.http.post(this.environment.apiV2 + "/token/refresh", { refreshToken: refreshToken }).pipe(operators.map(function (response) {
7385
- _this.setAuth(response);
7386
- return response;
7387
- }));
7388
- };
7389
- AuthService.prototype.logoutFront = function (url) {
7390
- if (url === void 0) { url = '/login'; }
7391
- localStorage.clear();
7392
- location.replace(url);
7393
- };
7394
- return AuthService;
7395
- }());
7396
- AuthService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: AuthService, deps: [{ token: i1__namespace.HttpClient }, { token: JwtService }, { token: 'environment' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
7397
- AuthService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: AuthService, providedIn: 'root' });
7398
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: AuthService, decorators: [{
7399
- type: i0.Injectable,
7400
- args: [{
7401
- providedIn: 'root'
7402
- }]
7403
- }], ctorParameters: function () {
7404
- return [{ type: i1__namespace.HttpClient }, { type: JwtService }, { type: undefined, decorators: [{
7405
- type: i0.Inject,
7406
- args: ['environment']
7407
- }] }];
7408
- } });
7409
-
7410
7894
  // replace array element with the new one (only arrays of objects)
7411
7895
  function replace(array, item, matchField) {
7412
7896
  if (matchField === void 0) { matchField = 'id'; }
@@ -9883,14 +10367,47 @@
9883
10367
  document.save(fileName + ".pdf");
9884
10368
  };
9885
10369
  /**
10370
+ * @Todo rename when all DataTable dependent methods will be cleared-up
10371
+ */
10372
+ PdfService.prototype.exportTables = function (tables, title, fileName) {
10373
+ var document = this.generateFromTables(tables, title);
10374
+ document.save(fileName + ".pdf");
10375
+ };
10376
+ /**
10377
+ * @Todo rename when all DataTable dependent methods will be cleared-up
10378
+ */
10379
+ PdfService.prototype.generateFromTables = function (tables, title) {
10380
+ var pdf = new jsPDF__default["default"]();
10381
+ // set document title
10382
+ pdf.setFontSize(PDF_CONFIG.text.fontSize)
10383
+ .setFont(PDF_CONFIG.text.fontName, PDF_CONFIG.text.fontStyle, PDF_CONFIG.text.fontWeight)
10384
+ .text(title, PDF_CONFIG.text.positionX, PDF_CONFIG.text.positionY);
10385
+ tables.forEach(function (table) {
10386
+ // coords of last table
10387
+ var lastTableCoords = pdf['lastAutoTable'].finalY || PDF_CONFIG.contentCoords.marginTop;
10388
+ // table options
10389
+ var options = {
10390
+ html: table,
10391
+ startY: lastTableCoords + PDF_CONFIG.contentTitleCoords.marginTop,
10392
+ footStyles: {
10393
+ fillColor: PDF_CONFIG.text.fillColor,
10394
+ textColor: PDF_CONFIG.text.textColor
10395
+ }
10396
+ };
10397
+ autoTable__default["default"](pdf, options);
10398
+ });
10399
+ return pdf;
10400
+ };
10401
+ /**
10402
+ * @Todo remove/refactor when all DataTable dependent methods will be cleared-up
9886
10403
  * Generate PDF file from provided data
9887
10404
  */
9888
10405
  PdfService.prototype.generatePdfFile = function (tables, title) {
9889
10406
  var pdf = new jsPDF__default["default"]();
9890
- // set document title
9891
- pdf.setFontSize(PDF_CONFIG.text.fontSize);
9892
- pdf.setFont(PDF_CONFIG.text.fontName, PDF_CONFIG.text.fontStyle, PDF_CONFIG.text.fontWeight);
9893
- pdf.text(title, PDF_CONFIG.text.positionX, PDF_CONFIG.text.positionY);
10407
+ // set document font params
10408
+ pdf.setFontSize(PDF_CONFIG.text.fontSize)
10409
+ .setFont(PDF_CONFIG.text.fontName, PDF_CONFIG.text.fontStyle, PDF_CONFIG.text.fontWeight)
10410
+ .text(title, PDF_CONFIG.text.positionX, PDF_CONFIG.text.positionY);
9894
10411
  tables.forEach(function (table) {
9895
10412
  // coords of last table
9896
10413
  var lastTableCoords = pdf['lastAutoTable'].finalY || PDF_CONFIG.contentCoords.marginTop;
@@ -9921,68 +10438,36 @@
9921
10438
  }]
9922
10439
  }] });
9923
10440
 
9924
- var PreloaderService = /** @class */ (function () {
9925
- function PreloaderService() {
9926
- this.activePreloaders = new rxjs.BehaviorSubject([]);
9927
- }
9928
- PreloaderService.prototype.get = function () {
9929
- return this.activePreloaders.asObservable();
9930
- };
9931
- PreloaderService.prototype.add = function (endpoint) {
9932
- var activePreloaders = this.activePreloaders.getValue();
9933
- activePreloaders.push(endpoint);
9934
- this.activePreloaders.next(activePreloaders);
9935
- };
9936
- PreloaderService.prototype.delete = function (endpoint) {
9937
- var activePreloaders = this.activePreloaders.getValue();
9938
- activePreloaders = activePreloaders.filter(function (preloader) { return preloader !== endpoint; });
9939
- this.activePreloaders.next(activePreloaders);
9940
- };
9941
- return PreloaderService;
9942
- }());
9943
- PreloaderService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PreloaderService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
9944
- PreloaderService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PreloaderService, providedIn: 'root' });
9945
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PreloaderService, decorators: [{
9946
- type: i0.Injectable,
9947
- args: [{
9948
- providedIn: 'root'
9949
- }]
9950
- }], ctorParameters: function () { return []; } });
9951
-
9952
- var CorelogicService = /** @class */ (function () {
9953
- function CorelogicService(http, environment) {
10441
+ /**
10442
+ * Service for get property equity position half-year history chart data
10443
+ */
10444
+ var EquityPositionChartService = /** @class */ (function () {
10445
+ function EquityPositionChartService(http, environment) {
9954
10446
  this.http = http;
9955
10447
  this.environment = environment;
9956
- this.accessTokenSubject = new rxjs.ReplaySubject(1);
9957
10448
  }
9958
- CorelogicService.prototype.getAccessToken = function (force) {
9959
- var _this = this;
9960
- if (force === void 0) { force = false; }
9961
- if (!this._accessToken || force) {
9962
- this.http.get(this.environment.coreLogicUrl + "/access/oauth/token?grant_type=client_credentials&client_id=" + this.environment.coreLogicId + "&client_secret=" + this.environment.coreLogicSecret)
9963
- .pipe(operators.map(function (response) {
9964
- return response.access_token;
9965
- }))
9966
- .subscribe(function (token) {
9967
- _this._accessToken = token;
9968
- _this.accessTokenSubject.next(_this._accessToken);
9969
- });
9970
- }
9971
- return this.accessTokenSubject.asObservable();
9972
- };
9973
- CorelogicService.prototype.getSuggestions = function (query, country) {
9974
- if (country === void 0) { country = 'au'; }
9975
- // @TODO handle different countries in future
9976
- return this.http.get(this.environment.coreLogicUrl + "/property/" + country + "/v2/suggest.json?q=" + query)
10449
+ EquityPositionChartService.prototype.get = function () {
10450
+ // @TODO refactor backend
10451
+ return this.http.get(this.environment.apiV2 + "/properties/categories/equity")
9977
10452
  .pipe(operators.map(function (response) {
9978
- return response.suggestions.map(function (item) { return classTransformer.plainToClass(CorelogicSuggestion, item); });
10453
+ return response.map(function (item) {
10454
+ return classTransformer.plainToClass(ChartData, {
10455
+ name: item.category.name,
10456
+ data: item.equity.map(function (serie) {
10457
+ return classTransformer.plainToClass(ChartSerie, {
10458
+ label: serie.date,
10459
+ value: serie.amount
10460
+ });
10461
+ })
10462
+ });
10463
+ });
9979
10464
  }));
9980
10465
  };
9981
- return CorelogicService;
10466
+ return EquityPositionChartService;
9982
10467
  }());
9983
- CorelogicService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: CorelogicService, deps: [{ token: i1__namespace.HttpClient }, { token: 'environment' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
9984
- CorelogicService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: CorelogicService, providedIn: 'root' });
9985
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: CorelogicService, decorators: [{
10468
+ EquityPositionChartService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: EquityPositionChartService, deps: [{ token: i1__namespace.HttpClient }, { token: 'environment' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
10469
+ EquityPositionChartService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: EquityPositionChartService, providedIn: 'root' });
10470
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: EquityPositionChartService, decorators: [{
9986
10471
  type: i0.Injectable,
9987
10472
  args: [{
9988
10473
  providedIn: 'root'
@@ -10012,6 +10497,8 @@
10012
10497
  PropertyService.prototype.listenEvents = function () {
10013
10498
  this.listenCoOwnerInviteAccepted();
10014
10499
  this.listenServiceSubscriptionUpdated();
10500
+ // @TODO Alex: consider to refactor property movements logic similar to client-movements
10501
+ this.listenMovementsChanged();
10015
10502
  };
10016
10503
  /**
10017
10504
  * Update cache when owner invitation accepted
@@ -10027,6 +10514,16 @@
10027
10514
  var _this = this;
10028
10515
  this.eventDispatcherService.on(exports.AppEventTypeEnum.SERVICE_SUBSCRIPTION_UPDATED).subscribe(function () { return _this.resetCache(); });
10029
10516
  };
10517
+ /**
10518
+ * Update cache when property category changed
10519
+ */
10520
+ PropertyService.prototype.listenMovementsChanged = function () {
10521
+ var _this = this;
10522
+ // @TODO change dispatcher logic to work with multiple events
10523
+ this.eventDispatcherService.on(exports.AppEventTypeEnum.PROPERTY_MOVEMENT_CREATED).subscribe(function () { return _this.resetCache(); });
10524
+ this.eventDispatcherService.on(exports.AppEventTypeEnum.PROPERTY_MOVEMENT_UPDATED).subscribe(function () { return _this.resetCache(); });
10525
+ this.eventDispatcherService.on(exports.AppEventTypeEnum.PROPERTY_MOVEMENT_DELETED).subscribe(function () { return _this.resetCache(); });
10526
+ };
10030
10527
  PropertyService.prototype.update = function (property) {
10031
10528
  var _this = this;
10032
10529
  return _super.prototype.update.call(this, property).pipe(operators.map(function (updatedProperty) {
@@ -10303,6 +10800,52 @@
10303
10800
  }]
10304
10801
  }] });
10305
10802
 
10803
+ var PropertyCategoryMovementService = /** @class */ (function (_super) {
10804
+ __extends(PropertyCategoryMovementService, _super);
10805
+ function PropertyCategoryMovementService() {
10806
+ var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
10807
+ _this.modelClass = PropertyCategoryMovement;
10808
+ _this.url = 'properties/category-movements';
10809
+ return _this;
10810
+ }
10811
+ PropertyCategoryMovementService.prototype.add = function (model) {
10812
+ var _this = this;
10813
+ return _super.prototype.add.call(this, model).pipe(operators.map(function (newMovement) {
10814
+ // @TODO Alex: we need to teach restService to dispatch events + limit list of methods (not all services have all 4 or even more considering batch requests) + collections
10815
+ _this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.PROPERTY_MOVEMENT_CREATED, null));
10816
+ return newMovement;
10817
+ }));
10818
+ };
10819
+ PropertyCategoryMovementService.prototype.update = function (model) {
10820
+ var _this = this;
10821
+ return _super.prototype.update.call(this, model).pipe(operators.map(function (updatedMovement) {
10822
+ _this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.PROPERTY_MOVEMENT_CREATED, null));
10823
+ return updatedMovement;
10824
+ }));
10825
+ };
10826
+ PropertyCategoryMovementService.prototype.delete = function (model) {
10827
+ var _this = this;
10828
+ return _super.prototype.delete.call(this, model).pipe(operators.map(function () {
10829
+ _this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.PROPERTY_MOVEMENT_CREATED, null));
10830
+ }));
10831
+ };
10832
+ // @TODO Alex: Move to collection
10833
+ PropertyCategoryMovementService.prototype.getByPropertyId = function (id) {
10834
+ return this.get().pipe(operators.map(function (movements) {
10835
+ return movements.filter(function (movement) { return movement.property.id === id; });
10836
+ }));
10837
+ };
10838
+ return PropertyCategoryMovementService;
10839
+ }(BaseRestService));
10840
+ PropertyCategoryMovementService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyCategoryMovementService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
10841
+ PropertyCategoryMovementService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyCategoryMovementService, providedIn: 'root' });
10842
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyCategoryMovementService, decorators: [{
10843
+ type: i0.Injectable,
10844
+ args: [{
10845
+ providedIn: 'root'
10846
+ }]
10847
+ }] });
10848
+
10306
10849
  /**
10307
10850
  * Class for work with Property Documents
10308
10851
  */
@@ -11923,7 +12466,6 @@
11923
12466
  * Generated bundle index. Do not edit.
11924
12467
  */
11925
12468
 
11926
- exports.AbstractCollection = AbstractCollection;
11927
12469
  exports.Address = Address;
11928
12470
  exports.AddressService = AddressService;
11929
12471
  exports.AppEvent = AppEvent;
@@ -11976,6 +12518,7 @@
11976
12518
  exports.ClientPortfolioReport = ClientPortfolioReport;
11977
12519
  exports.ClientPortfolioReportCollection = ClientPortfolioReportCollection;
11978
12520
  exports.ClientPortfolioReportService = ClientPortfolioReportService;
12521
+ exports.Collection = Collection;
11979
12522
  exports.CollectionDictionary = CollectionDictionary;
11980
12523
  exports.CorelogicService = CorelogicService;
11981
12524
  exports.CorelogicSuggestion = CorelogicSuggestion;
@@ -12004,6 +12547,7 @@
12004
12547
  exports.EmployeeInviteService = EmployeeInviteService;
12005
12548
  exports.EmployeeService = EmployeeService;
12006
12549
  exports.Endpoint = Endpoint;
12550
+ exports.EquityPositionChartService = EquityPositionChartService;
12007
12551
  exports.EventDispatcherService = EventDispatcherService;
12008
12552
  exports.FinancialYear = FinancialYear;
12009
12553
  exports.Firm = Firm;
@@ -12017,6 +12561,7 @@
12017
12561
  exports.IncomeSourceForecastService = IncomeSourceForecastService;
12018
12562
  exports.IncomeSourceService = IncomeSourceService;
12019
12563
  exports.IncomeSourceType = IncomeSourceType;
12564
+ exports.InterceptorsModule = InterceptorsModule;
12020
12565
  exports.IntercomService = IntercomService;
12021
12566
  exports.JwtService = JwtService;
12022
12567
  exports.Loan = Loan;
@@ -12048,6 +12593,7 @@
12048
12593
  exports.PropertyCapitalCostService = PropertyCapitalCostService;
12049
12594
  exports.PropertyCategory = PropertyCategory;
12050
12595
  exports.PropertyCategoryMovement = PropertyCategoryMovement;
12596
+ exports.PropertyCategoryMovementService = PropertyCategoryMovementService;
12051
12597
  exports.PropertyCategoryService = PropertyCategoryService;
12052
12598
  exports.PropertyCollection = PropertyCollection;
12053
12599
  exports.PropertyDocument = PropertyDocument;