taxtank-core 0.28.35 → 0.28.37

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 (72) hide show
  1. package/bundles/taxtank-core.umd.js +1630 -1336
  2. package/bundles/taxtank-core.umd.js.map +1 -1
  3. package/esm2015/lib/db/Models/bank/bank.js +1 -1
  4. package/esm2015/lib/forms/address/address.form.js +149 -0
  5. package/esm2015/lib/forms/address/index.js +2 -0
  6. package/esm2015/lib/forms/index.js +3 -1
  7. package/esm2015/lib/forms/phone/index.js +2 -0
  8. package/esm2015/lib/forms/phone/phone.form.js +15 -0
  9. package/esm2015/lib/forms/sole/sole-contact.form.js +7 -5
  10. package/esm2015/lib/interceptors/basiq-token.interceptor.js +1 -1
  11. package/esm2015/lib/interceptors/corelogic-interceptor.js +19 -20
  12. package/esm2015/lib/models/address/address.js +2 -2
  13. package/esm2015/lib/models/address/country.js +3 -1
  14. package/esm2015/lib/models/bank/bank-connection.js +2 -2
  15. package/esm2015/lib/models/bank/bank-external-stats.js +7 -0
  16. package/esm2015/lib/models/bank/bank.js +6 -2
  17. package/esm2015/lib/models/bank/basiq/basiq-config.js +12 -0
  18. package/esm2015/lib/models/bank/basiq/basiq-connections-response.interface.js +2 -0
  19. package/esm2015/lib/models/bank/basiq/basiq-job-response.js +12 -0
  20. package/esm2015/lib/models/bank/basiq/basiq-job-step.js +12 -0
  21. package/esm2015/lib/models/bank/basiq/basiq-job.js +4 -0
  22. package/esm2015/lib/models/bank/basiq/basiq-token-response.interface.js +2 -0
  23. package/esm2015/lib/models/bank/basiq/basiq-token.js +13 -0
  24. package/esm2015/lib/models/bank/basiq/index.js +8 -0
  25. package/esm2015/lib/models/bank/index.js +14 -0
  26. package/esm2015/lib/models/endpoint/endpoints.const.js +2 -1
  27. package/esm2015/lib/models/event/app-event-type.enum.js +58 -57
  28. package/esm2015/lib/models/index.js +2 -1
  29. package/esm2015/lib/models/phone/phone.js +8 -1
  30. package/esm2015/lib/services/http/bank/basiq/basiq-token.service.js +2 -2
  31. package/esm2015/lib/services/http/bank/basiq/basiq.service.js +51 -5
  32. package/esm2015/lib/services/http/user/user.service.js +8 -2
  33. package/esm2015/lib/validators/address-corelogic.validator.js +17 -0
  34. package/esm2015/lib/validators/phone-number.validator.js +11 -0
  35. package/esm2015/public-api.js +2 -15
  36. package/fesm2015/taxtank-core.js +1142 -880
  37. package/fesm2015/taxtank-core.js.map +1 -1
  38. package/lib/db/Models/bank/bank.d.ts +4 -5
  39. package/lib/forms/address/address.form.d.ts +58 -0
  40. package/lib/forms/address/index.d.ts +1 -0
  41. package/lib/forms/index.d.ts +2 -0
  42. package/lib/forms/phone/index.d.ts +1 -0
  43. package/lib/forms/phone/phone.form.d.ts +5 -0
  44. package/lib/interceptors/corelogic-interceptor.d.ts +1 -5
  45. package/lib/models/address/country.d.ts +1 -0
  46. package/lib/models/bank/bank-connection.d.ts +1 -1
  47. package/lib/models/bank/bank-external-stats.d.ts +11 -0
  48. package/lib/models/bank/bank.d.ts +2 -0
  49. package/lib/models/bank/{basiq-config.d.ts → basiq/basiq-config.d.ts} +0 -0
  50. package/lib/{services/http → models}/bank/basiq/basiq-connections-response.interface.d.ts +0 -0
  51. package/lib/models/bank/basiq/basiq-job-response.d.ts +5 -0
  52. package/lib/models/bank/basiq/basiq-job-step.d.ts +7 -0
  53. package/lib/models/bank/basiq/basiq-job.d.ts +3 -0
  54. package/lib/{services/http → models}/bank/basiq/basiq-token-response.interface.d.ts +0 -0
  55. package/lib/models/bank/{basiq-token.d.ts → basiq/basiq-token.d.ts} +0 -0
  56. package/lib/models/bank/basiq/index.d.ts +7 -0
  57. package/lib/models/bank/index.d.ts +13 -0
  58. package/lib/models/event/app-event-type.enum.d.ts +57 -56
  59. package/lib/models/index.d.ts +1 -0
  60. package/lib/models/phone/phone.d.ts +2 -0
  61. package/lib/services/http/bank/basiq/basiq-token.service.d.ts +1 -1
  62. package/lib/services/http/bank/basiq/basiq.service.d.ts +17 -3
  63. package/lib/validators/address-corelogic.validator.d.ts +5 -0
  64. package/lib/validators/phone-number.validator.d.ts +6 -0
  65. package/package.json +1 -1
  66. package/public-api.d.ts +1 -14
  67. package/esm2015/lib/models/bank/basiq-config.js +0 -12
  68. package/esm2015/lib/models/bank/basiq-job.js +0 -4
  69. package/esm2015/lib/models/bank/basiq-token.js +0 -13
  70. package/esm2015/lib/services/http/bank/basiq/basiq-connections-response.interface.js +0 -2
  71. package/esm2015/lib/services/http/bank/basiq/basiq-token-response.interface.js +0 -2
  72. package/lib/models/bank/basiq-job.d.ts +0 -3
@@ -4,21 +4,21 @@ import * as i1$1 from '@angular/common';
4
4
  import { CommonModule, DatePipe } from '@angular/common';
5
5
  import * as i1 from '@angular/common/http';
6
6
  import { HttpParams, HttpErrorResponse, HTTP_INTERCEPTORS } from '@angular/common/http';
7
- import { ReplaySubject, Subject, BehaviorSubject, throwError, Observable, combineLatest, forkJoin, of, from } from 'rxjs';
8
- import { map, filter, catchError, take, switchMap, finalize, mergeMap, skip, distinctUntilChanged } from 'rxjs/operators';
9
- import { plainToClass, classToPlain, Type, Exclude, Transform, Expose } from 'class-transformer';
7
+ import { map, mergeMap, filter, catchError, take, switchMap, finalize, skip, distinctUntilChanged, debounceTime } from 'rxjs/operators';
8
+ import { ReplaySubject, Subject, BehaviorSubject, throwError, Observable, of, combineLatest, forkJoin, from } from 'rxjs';
9
+ import { plainToClass, classToPlain, Type, Transform, Expose, Exclude } from 'class-transformer';
10
10
  import { JwtHelperService } from '@auth0/angular-jwt';
11
- import { __decorate, __awaiter } from 'tslib';
12
11
  import get from 'lodash/get';
13
- import last from 'lodash/last';
14
12
  import flatten from 'lodash/flatten';
15
13
  import hasIn from 'lodash/hasIn';
16
14
  import first from 'lodash/first';
17
- import * as moment$1 from 'moment';
18
- import { DateRange, extendMoment } from 'moment-range';
15
+ import last from 'lodash/last';
19
16
  import uniqBy from 'lodash/uniqBy';
20
17
  import concat from 'lodash/concat';
21
18
  import { throwError as throwError$1 } from 'rxjs/internal/observable/throwError';
19
+ import { __decorate, __awaiter } from 'tslib';
20
+ import * as moment$1 from 'moment';
21
+ import { DateRange, extendMoment } from 'moment-range';
22
22
  import cloneDeep$1 from 'lodash/cloneDeep';
23
23
  import { EventSourcePolyfill } from 'event-source-polyfill/src/eventsource.min.js';
24
24
  import compact from 'lodash/compact';
@@ -92,28 +92,26 @@ class CorelogicInterceptor {
92
92
  this.corelogicService = corelogicService;
93
93
  this.environment = environment;
94
94
  }
95
- /**
96
- * Check if requested url requested core logic, but not core logic auth api
97
- * @param req
98
- */
99
- addToken(req) {
100
- // don't need token for this endpoint
101
- if (req.url.includes(`${this.environment.coreLogicUrl}/access/oauth/token`)) {
102
- return req;
95
+ intercept(request, next) {
96
+ // skip non-corelogic requests
97
+ if (!request.url.includes(this.environment.coreLogicUrl)) {
98
+ return next.handle(request);
103
99
  }
104
- // add core logic token to request headers
105
- if (req.url.includes(this.environment.coreLogicUrl)) {
106
- return req.clone({
107
- setHeaders: {
108
- Authorization: 'Bearer ' + this.corelogicService._accessToken
109
- }
110
- });
100
+ // don't need token for this endpoint
101
+ if (request.url.includes(`${this.environment.coreLogicUrl}/access/oauth/token`)) {
102
+ return next.handle(request);
111
103
  }
112
- // return request without changes if url not related with core logic
113
- return req;
104
+ return this.corelogicService.getAccessToken()
105
+ .pipe(mergeMap((token) => {
106
+ return next.handle(this.addToken(request, token));
107
+ }));
114
108
  }
115
- intercept(request, next) {
116
- return next.handle(this.addToken(request));
109
+ addToken(request, token) {
110
+ return request.clone({
111
+ setHeaders: {
112
+ Authorization: 'Bearer ' + token
113
+ }
114
+ });
117
115
  }
118
116
  }
119
117
  CorelogicInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: CorelogicInterceptor, deps: [{ token: CorelogicService }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable });
@@ -207,62 +205,63 @@ var AppEventTypeEnum;
207
205
  AppEventTypeEnum[AppEventTypeEnum["BASIQ_CONSENT_UPDATED"] = 5] = "BASIQ_CONSENT_UPDATED";
208
206
  AppEventTypeEnum[AppEventTypeEnum["BASIQ_CONNECTION_UPDATED"] = 6] = "BASIQ_CONNECTION_UPDATED";
209
207
  AppEventTypeEnum[AppEventTypeEnum["BASIQ_JOB_CREATED"] = 7] = "BASIQ_JOB_CREATED";
210
- AppEventTypeEnum[AppEventTypeEnum["CLIENT_INVITE_ACCEPTED"] = 8] = "CLIENT_INVITE_ACCEPTED";
211
- AppEventTypeEnum[AppEventTypeEnum["CLIENT_OPEN_CHAT"] = 9] = "CLIENT_OPEN_CHAT";
212
- AppEventTypeEnum[AppEventTypeEnum["CLIENT_TRANSFER_TO_OTHER_EMPLOYEE"] = 10] = "CLIENT_TRANSFER_TO_OTHER_EMPLOYEE";
213
- AppEventTypeEnum[AppEventTypeEnum["CURRENT_USER_GET_FAILED"] = 11] = "CURRENT_USER_GET_FAILED";
214
- AppEventTypeEnum[AppEventTypeEnum["DEPRECIATION_DELETED"] = 12] = "DEPRECIATION_DELETED";
215
- AppEventTypeEnum[AppEventTypeEnum["DEPRECIATIONS_CREATED"] = 13] = "DEPRECIATIONS_CREATED";
216
- AppEventTypeEnum[AppEventTypeEnum["DEPRECIATION_UPDATED_WITH_RECEIPT"] = 14] = "DEPRECIATION_UPDATED_WITH_RECEIPT";
217
- AppEventTypeEnum[AppEventTypeEnum["DEPRECIATION_UPDATED_WITH_DELETED_RECEIPT"] = 15] = "DEPRECIATION_UPDATED_WITH_DELETED_RECEIPT";
218
- AppEventTypeEnum[AppEventTypeEnum["DEPRECIATION_RECEIPT_CREATED"] = 16] = "DEPRECIATION_RECEIPT_CREATED";
219
- AppEventTypeEnum[AppEventTypeEnum["DEPRECIATION_RECEIPT_DELETED"] = 17] = "DEPRECIATION_RECEIPT_DELETED";
220
- AppEventTypeEnum[AppEventTypeEnum["INCOME_SOURCES_CREATED"] = 18] = "INCOME_SOURCES_CREATED";
221
- AppEventTypeEnum[AppEventTypeEnum["INCOME_SOURCES_UPDATED"] = 19] = "INCOME_SOURCES_UPDATED";
222
- AppEventTypeEnum[AppEventTypeEnum["INCOME_SOURCES_FORECASTS_CREATED"] = 20] = "INCOME_SOURCES_FORECASTS_CREATED";
223
- AppEventTypeEnum[AppEventTypeEnum["INCOME_SOURCES_FORECASTS_UPDATED"] = 21] = "INCOME_SOURCES_FORECASTS_UPDATED";
224
- AppEventTypeEnum[AppEventTypeEnum["LOAN_UPDATED"] = 22] = "LOAN_UPDATED";
225
- AppEventTypeEnum[AppEventTypeEnum["LOAN_PAYOUT_UPDATED"] = 23] = "LOAN_PAYOUT_UPDATED";
226
- AppEventTypeEnum[AppEventTypeEnum["MESSAGE_CREATED"] = 24] = "MESSAGE_CREATED";
227
- AppEventTypeEnum[AppEventTypeEnum["MESSAGE_FILE_CREATED"] = 25] = "MESSAGE_FILE_CREATED";
228
- AppEventTypeEnum[AppEventTypeEnum["MESSAGE_FILE_DELETED"] = 26] = "MESSAGE_FILE_DELETED";
229
- AppEventTypeEnum[AppEventTypeEnum["NOTIFICATION_ADDED"] = 27] = "NOTIFICATION_ADDED";
230
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_DEPRECIATION_CALCULATION_UPDATED"] = 28] = "PROPERTY_DEPRECIATION_CALCULATION_UPDATED";
231
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_UPDATED"] = 29] = "PROPERTY_UPDATED";
232
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_UPDATED_WITH_DOCUMENT"] = 30] = "PROPERTY_UPDATED_WITH_DOCUMENT";
233
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_DOCUMENT_ADDED"] = 31] = "PROPERTY_DOCUMENT_ADDED";
234
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_MOVEMENT_CREATED"] = 32] = "PROPERTY_MOVEMENT_CREATED";
235
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_MOVEMENT_UPDATED"] = 33] = "PROPERTY_MOVEMENT_UPDATED";
236
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_MOVEMENT_DELETED"] = 34] = "PROPERTY_MOVEMENT_DELETED";
237
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SHARE_UPDATED"] = 35] = "PROPERTY_SHARE_UPDATED";
238
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SALE_ADDED"] = 36] = "PROPERTY_SALE_ADDED";
239
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SALE_DELETED"] = 37] = "PROPERTY_SALE_DELETED";
240
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SUBSCRIPTION_ADDED"] = 38] = "PROPERTY_SUBSCRIPTION_ADDED";
241
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SUBSCRIPTION_DELETED"] = 39] = "PROPERTY_SUBSCRIPTION_DELETED";
242
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_VALUATION_DOCUMENT_CREATED"] = 40] = "PROPERTY_VALUATION_DOCUMENT_CREATED";
243
- AppEventTypeEnum[AppEventTypeEnum["SERVICE_SUBSCRIPTION_UPDATED"] = 41] = "SERVICE_SUBSCRIPTION_UPDATED";
244
- AppEventTypeEnum[AppEventTypeEnum["SOLE_BUSINESS_CREATED"] = 42] = "SOLE_BUSINESS_CREATED";
245
- AppEventTypeEnum[AppEventTypeEnum["SOLE_DEPRECIATION_METHOD_UPDATED"] = 43] = "SOLE_DEPRECIATION_METHOD_UPDATED";
246
- AppEventTypeEnum[AppEventTypeEnum["SOLE_DETAILS_CREATED"] = 44] = "SOLE_DETAILS_CREATED";
247
- AppEventTypeEnum[AppEventTypeEnum["SOLE_DETAILS_UPDATED"] = 45] = "SOLE_DETAILS_UPDATED";
248
- AppEventTypeEnum[AppEventTypeEnum["TAX_REVIEW_UPDATED"] = 46] = "TAX_REVIEW_UPDATED";
249
- AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_CREATED"] = 47] = "TRANSACTION_CREATED";
250
- AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_DELETED"] = 48] = "TRANSACTION_DELETED";
251
- AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED"] = 49] = "TRANSACTION_UPDATED";
252
- AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED_WITH_RECEIPT"] = 50] = "TRANSACTION_UPDATED_WITH_RECEIPT";
253
- AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED_WITH_DELETED_RECEIPT"] = 51] = "TRANSACTION_UPDATED_WITH_DELETED_RECEIPT";
254
- AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_RECEIPT_CREATED"] = 52] = "TRANSACTION_RECEIPT_CREATED";
255
- AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_RECEIPT_DELETED"] = 53] = "TRANSACTION_RECEIPT_DELETED";
256
- AppEventTypeEnum[AppEventTypeEnum["TRANSACTIONS_CREATED"] = 54] = "TRANSACTIONS_CREATED";
257
- AppEventTypeEnum[AppEventTypeEnum["USER_UPDATED"] = 55] = "USER_UPDATED";
258
- AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_UPDATED"] = 56] = "VEHICLE_CLAIM_UPDATED";
259
- AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_CREATED"] = 57] = "VEHICLE_CLAIM_CREATED";
260
- AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_DETAILS_UPDATED"] = 58] = "VEHICLE_CLAIM_DETAILS_UPDATED";
261
- AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_DETAILS_CREATED"] = 59] = "VEHICLE_CLAIM_DETAILS_CREATED";
262
- AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_CREATED"] = 60] = "VEHICLE_LOGBOOK_CREATED";
263
- AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_UPDATED"] = 61] = "VEHICLE_LOGBOOK_UPDATED";
264
- AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_DELETED"] = 62] = "VEHICLE_LOGBOOK_DELETED";
265
- AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_BEST_PERIOD_UPDATED"] = 63] = "VEHICLE_LOGBOOK_BEST_PERIOD_UPDATED";
208
+ AppEventTypeEnum[AppEventTypeEnum["BASIQ_LOGIN_FINISHED"] = 8] = "BASIQ_LOGIN_FINISHED";
209
+ AppEventTypeEnum[AppEventTypeEnum["CLIENT_INVITE_ACCEPTED"] = 9] = "CLIENT_INVITE_ACCEPTED";
210
+ AppEventTypeEnum[AppEventTypeEnum["CLIENT_OPEN_CHAT"] = 10] = "CLIENT_OPEN_CHAT";
211
+ AppEventTypeEnum[AppEventTypeEnum["CLIENT_TRANSFER_TO_OTHER_EMPLOYEE"] = 11] = "CLIENT_TRANSFER_TO_OTHER_EMPLOYEE";
212
+ AppEventTypeEnum[AppEventTypeEnum["CURRENT_USER_GET_FAILED"] = 12] = "CURRENT_USER_GET_FAILED";
213
+ AppEventTypeEnum[AppEventTypeEnum["DEPRECIATION_DELETED"] = 13] = "DEPRECIATION_DELETED";
214
+ AppEventTypeEnum[AppEventTypeEnum["DEPRECIATIONS_CREATED"] = 14] = "DEPRECIATIONS_CREATED";
215
+ AppEventTypeEnum[AppEventTypeEnum["DEPRECIATION_UPDATED_WITH_RECEIPT"] = 15] = "DEPRECIATION_UPDATED_WITH_RECEIPT";
216
+ AppEventTypeEnum[AppEventTypeEnum["DEPRECIATION_UPDATED_WITH_DELETED_RECEIPT"] = 16] = "DEPRECIATION_UPDATED_WITH_DELETED_RECEIPT";
217
+ AppEventTypeEnum[AppEventTypeEnum["DEPRECIATION_RECEIPT_CREATED"] = 17] = "DEPRECIATION_RECEIPT_CREATED";
218
+ AppEventTypeEnum[AppEventTypeEnum["DEPRECIATION_RECEIPT_DELETED"] = 18] = "DEPRECIATION_RECEIPT_DELETED";
219
+ AppEventTypeEnum[AppEventTypeEnum["INCOME_SOURCES_CREATED"] = 19] = "INCOME_SOURCES_CREATED";
220
+ AppEventTypeEnum[AppEventTypeEnum["INCOME_SOURCES_UPDATED"] = 20] = "INCOME_SOURCES_UPDATED";
221
+ AppEventTypeEnum[AppEventTypeEnum["INCOME_SOURCES_FORECASTS_CREATED"] = 21] = "INCOME_SOURCES_FORECASTS_CREATED";
222
+ AppEventTypeEnum[AppEventTypeEnum["INCOME_SOURCES_FORECASTS_UPDATED"] = 22] = "INCOME_SOURCES_FORECASTS_UPDATED";
223
+ AppEventTypeEnum[AppEventTypeEnum["LOAN_UPDATED"] = 23] = "LOAN_UPDATED";
224
+ AppEventTypeEnum[AppEventTypeEnum["LOAN_PAYOUT_UPDATED"] = 24] = "LOAN_PAYOUT_UPDATED";
225
+ AppEventTypeEnum[AppEventTypeEnum["MESSAGE_CREATED"] = 25] = "MESSAGE_CREATED";
226
+ AppEventTypeEnum[AppEventTypeEnum["MESSAGE_FILE_CREATED"] = 26] = "MESSAGE_FILE_CREATED";
227
+ AppEventTypeEnum[AppEventTypeEnum["MESSAGE_FILE_DELETED"] = 27] = "MESSAGE_FILE_DELETED";
228
+ AppEventTypeEnum[AppEventTypeEnum["NOTIFICATION_ADDED"] = 28] = "NOTIFICATION_ADDED";
229
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_DEPRECIATION_CALCULATION_UPDATED"] = 29] = "PROPERTY_DEPRECIATION_CALCULATION_UPDATED";
230
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_UPDATED"] = 30] = "PROPERTY_UPDATED";
231
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_UPDATED_WITH_DOCUMENT"] = 31] = "PROPERTY_UPDATED_WITH_DOCUMENT";
232
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_DOCUMENT_ADDED"] = 32] = "PROPERTY_DOCUMENT_ADDED";
233
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_MOVEMENT_CREATED"] = 33] = "PROPERTY_MOVEMENT_CREATED";
234
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_MOVEMENT_UPDATED"] = 34] = "PROPERTY_MOVEMENT_UPDATED";
235
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_MOVEMENT_DELETED"] = 35] = "PROPERTY_MOVEMENT_DELETED";
236
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SHARE_UPDATED"] = 36] = "PROPERTY_SHARE_UPDATED";
237
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SALE_ADDED"] = 37] = "PROPERTY_SALE_ADDED";
238
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SALE_DELETED"] = 38] = "PROPERTY_SALE_DELETED";
239
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SUBSCRIPTION_ADDED"] = 39] = "PROPERTY_SUBSCRIPTION_ADDED";
240
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SUBSCRIPTION_DELETED"] = 40] = "PROPERTY_SUBSCRIPTION_DELETED";
241
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_VALUATION_DOCUMENT_CREATED"] = 41] = "PROPERTY_VALUATION_DOCUMENT_CREATED";
242
+ AppEventTypeEnum[AppEventTypeEnum["SERVICE_SUBSCRIPTION_UPDATED"] = 42] = "SERVICE_SUBSCRIPTION_UPDATED";
243
+ AppEventTypeEnum[AppEventTypeEnum["SOLE_BUSINESS_CREATED"] = 43] = "SOLE_BUSINESS_CREATED";
244
+ AppEventTypeEnum[AppEventTypeEnum["SOLE_DEPRECIATION_METHOD_UPDATED"] = 44] = "SOLE_DEPRECIATION_METHOD_UPDATED";
245
+ AppEventTypeEnum[AppEventTypeEnum["SOLE_DETAILS_CREATED"] = 45] = "SOLE_DETAILS_CREATED";
246
+ AppEventTypeEnum[AppEventTypeEnum["SOLE_DETAILS_UPDATED"] = 46] = "SOLE_DETAILS_UPDATED";
247
+ AppEventTypeEnum[AppEventTypeEnum["TAX_REVIEW_UPDATED"] = 47] = "TAX_REVIEW_UPDATED";
248
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_CREATED"] = 48] = "TRANSACTION_CREATED";
249
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_DELETED"] = 49] = "TRANSACTION_DELETED";
250
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED"] = 50] = "TRANSACTION_UPDATED";
251
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED_WITH_RECEIPT"] = 51] = "TRANSACTION_UPDATED_WITH_RECEIPT";
252
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED_WITH_DELETED_RECEIPT"] = 52] = "TRANSACTION_UPDATED_WITH_DELETED_RECEIPT";
253
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_RECEIPT_CREATED"] = 53] = "TRANSACTION_RECEIPT_CREATED";
254
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_RECEIPT_DELETED"] = 54] = "TRANSACTION_RECEIPT_DELETED";
255
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTIONS_CREATED"] = 55] = "TRANSACTIONS_CREATED";
256
+ AppEventTypeEnum[AppEventTypeEnum["USER_UPDATED"] = 56] = "USER_UPDATED";
257
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_UPDATED"] = 57] = "VEHICLE_CLAIM_UPDATED";
258
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_CREATED"] = 58] = "VEHICLE_CLAIM_CREATED";
259
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_DETAILS_UPDATED"] = 59] = "VEHICLE_CLAIM_DETAILS_UPDATED";
260
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_DETAILS_CREATED"] = 60] = "VEHICLE_CLAIM_DETAILS_CREATED";
261
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_CREATED"] = 61] = "VEHICLE_LOGBOOK_CREATED";
262
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_UPDATED"] = 62] = "VEHICLE_LOGBOOK_UPDATED";
263
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_DELETED"] = 63] = "VEHICLE_LOGBOOK_DELETED";
264
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_BEST_PERIOD_UPDATED"] = 64] = "VEHICLE_LOGBOOK_BEST_PERIOD_UPDATED";
266
265
  })(AppEventTypeEnum || (AppEventTypeEnum = {}));
267
266
 
268
267
  class EventDispatcherService {
@@ -609,6 +608,7 @@ const ENDPOINTS = {
609
608
  CLIENT_MOVEMENTS_GET: new Endpoint('GET', '\\/client-movements'),
610
609
  CLIENT_MOVEMENTS_POST: new Endpoint('POST', '\\/client-movements'),
611
610
  COUNTRIES_GET: new Endpoint('GET', '\\/countries'),
611
+ CORELOGIC_TOKEN_GET: new Endpoint('GET', '/access\\/oauth\\/token.*$'),
612
612
  DEPRECIATIONS_OPENING_GET: new Endpoint('GET', '\\/depreciations\\/\\opening-balance\.\*'),
613
613
  DEPRECIATIONS_GET: new Endpoint('GET', '\\/depreciations'),
614
614
  DEPRECIATIONS_POST: new Endpoint('POST', '\\/depreciations'),
@@ -1145,122 +1145,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
1145
1145
  args: ['environment']
1146
1146
  }] }, { type: ToastService }]; } });
1147
1147
 
1148
- class AbstractModel {
1149
- hasValue(value, path = 'id') {
1150
- return get(path) === value;
1151
- }
1152
- }
1153
-
1154
- class BankAccount$1 extends AbstractModel {
1155
- }
1156
-
1157
- var BankAccountTypeEnum;
1158
- (function (BankAccountTypeEnum) {
1159
- BankAccountTypeEnum[BankAccountTypeEnum["TRANSACTION"] = 1] = "TRANSACTION";
1160
- BankAccountTypeEnum[BankAccountTypeEnum["SAVINGS"] = 2] = "SAVINGS";
1161
- BankAccountTypeEnum[BankAccountTypeEnum["CREDIT_CARD"] = 3] = "CREDIT_CARD";
1162
- // @TODO Alex: should be removed by backend (TT-2107)
1163
- // MORTGAGE = 4,
1164
- BankAccountTypeEnum[BankAccountTypeEnum["LOAN"] = 5] = "LOAN";
1165
- BankAccountTypeEnum[BankAccountTypeEnum["INVESTMENT"] = 6] = "INVESTMENT";
1166
- BankAccountTypeEnum[BankAccountTypeEnum["TERM_DEPOSIT"] = 7] = "TERM_DEPOSIT";
1167
- BankAccountTypeEnum[BankAccountTypeEnum["OFFSET"] = 10] = "OFFSET";
1168
- })(BankAccountTypeEnum || (BankAccountTypeEnum = {}));
1169
-
1170
- var BankAccountStatusEnum;
1171
- (function (BankAccountStatusEnum) {
1172
- BankAccountStatusEnum[BankAccountStatusEnum["INACTIVE"] = 0] = "INACTIVE";
1173
- BankAccountStatusEnum[BankAccountStatusEnum["ACTIVE"] = 1] = "ACTIVE";
1174
- })(BankAccountStatusEnum || (BankAccountStatusEnum = {}));
1175
-
1176
- class Loan$1 extends AbstractModel {
1177
- }
1178
-
1179
- var LoanVehicleTypeEnum;
1180
- (function (LoanVehicleTypeEnum) {
1181
- LoanVehicleTypeEnum[LoanVehicleTypeEnum["AUTO_LOAN"] = 6] = "AUTO_LOAN";
1182
- LoanVehicleTypeEnum[LoanVehicleTypeEnum["CHATTEL_MORTGAGE"] = 9] = "CHATTEL_MORTGAGE";
1183
- LoanVehicleTypeEnum[LoanVehicleTypeEnum["COMMERCIAL_HIRE_PURCHASE"] = 10] = "COMMERCIAL_HIRE_PURCHASE";
1184
- })(LoanVehicleTypeEnum || (LoanVehicleTypeEnum = {}));
1185
-
1186
- // @Todo no base model from backend list
1187
- /**
1188
- * Loan payment class
1189
- */
1190
- class LoanPayment extends AbstractModel {
1191
- }
1192
- __decorate([
1193
- Type(() => Date)
1194
- ], LoanPayment.prototype, "date", void 0);
1195
-
1196
- class LoanPayout$1 extends AbstractModel {
1197
- }
1198
-
1199
- var LoanPayoutTypeEnum;
1200
- (function (LoanPayoutTypeEnum) {
1201
- LoanPayoutTypeEnum[LoanPayoutTypeEnum["REFINANCE"] = 1] = "REFINANCE";
1202
- LoanPayoutTypeEnum[LoanPayoutTypeEnum["PAYOUT"] = 2] = "PAYOUT";
1203
- })(LoanPayoutTypeEnum || (LoanPayoutTypeEnum = {}));
1204
-
1205
- class LoanPayout extends LoanPayout$1 {
1206
- /**
1207
- * Check if payout type is refinance
1208
- */
1209
- isRefinance() {
1210
- return this.type === LoanPayoutTypeEnum.REFINANCE;
1211
- }
1212
- }
1213
-
1214
- class FinancialYear {
1215
- constructor(date) {
1216
- this.yearStartDate = '-07-01';
1217
- this.yearEndDate = '-06-30';
1218
- if (date) {
1219
- this.year = date instanceof Date ? FinancialYear.toFinYear(date) : date;
1220
- }
1221
- else {
1222
- this.year = +localStorage.getItem('financialYear') || FinancialYear.toFinYear(new Date());
1223
- }
1224
- this.setStartDate(this.year);
1225
- this.setEndDate(this.year);
1226
- }
1227
- includes(date) {
1228
- return this.year === new FinancialYear(date).year;
1229
- }
1230
- static toFinYear(date) {
1231
- return date.getFullYear() + (date.getMonth() >= this.startMonthIndex ? 1 : 0);
1232
- }
1233
- get prevFinYear() {
1234
- return new FinancialYear(new Date(`${new Date().getFullYear() - 1}${this.yearStartDate}`));
1235
- }
1236
- /**
1237
- * Get date by desired month
1238
- */
1239
- getMonthDate(monthIndex) {
1240
- if (monthIndex >= FinancialYear.startMonthIndex) {
1241
- return new Date(`${this.year - 1}-${monthIndex + 1}-01`);
1242
- }
1243
- return new Date(`${this.year}-${monthIndex + 1}-01`);
1244
- }
1245
- setStartDate(year) {
1246
- this.startDate = new Date(`${year - 1}${this.yearStartDate}`);
1247
- }
1248
- setEndDate(year) {
1249
- this.endDate = new Date(`${year}${this.yearEndDate}`);
1250
- }
1251
- getPastMonths() {
1252
- const months = [];
1253
- const now = new Date();
1254
- const endDate = this.endDate < now ? this.endDate : now;
1255
- for (const d = this.startDate; d <= endDate; d.setMonth(d.getMonth() + 1)) {
1256
- months.push(d.getMonth());
1257
- }
1258
- return months;
1259
- }
1260
- }
1261
- FinancialYear.weeksInYear = 52;
1262
- FinancialYear.startMonthIndex = 6;
1263
-
1264
1148
  /**
1265
1149
  * List of collections grouped by passed property
1266
1150
  */
@@ -1484,96 +1368,503 @@ class Collection {
1484
1368
  }
1485
1369
  }
1486
1370
 
1487
- class ExportDataTable {
1488
- }
1489
-
1490
- class ExportableCollection extends Collection {
1491
- getExportFooter(type) {
1492
- return [];
1493
- }
1494
- ;
1495
- export(type) {
1496
- return plainToClass(ExportDataTable, {
1497
- header: this.getExportHeader(type),
1498
- body: this.getExportBody(type),
1499
- footer: [this.getExportFooter(type)]
1500
- });
1501
- }
1502
- }
1371
+ var BankAccountTypeEnum;
1372
+ (function (BankAccountTypeEnum) {
1373
+ BankAccountTypeEnum[BankAccountTypeEnum["TRANSACTION"] = 1] = "TRANSACTION";
1374
+ BankAccountTypeEnum[BankAccountTypeEnum["SAVINGS"] = 2] = "SAVINGS";
1375
+ BankAccountTypeEnum[BankAccountTypeEnum["CREDIT_CARD"] = 3] = "CREDIT_CARD";
1376
+ // @TODO Alex: should be removed by backend (TT-2107)
1377
+ // MORTGAGE = 4,
1378
+ BankAccountTypeEnum[BankAccountTypeEnum["LOAN"] = 5] = "LOAN";
1379
+ BankAccountTypeEnum[BankAccountTypeEnum["INVESTMENT"] = 6] = "INVESTMENT";
1380
+ BankAccountTypeEnum[BankAccountTypeEnum["TERM_DEPOSIT"] = 7] = "TERM_DEPOSIT";
1381
+ BankAccountTypeEnum[BankAccountTypeEnum["OFFSET"] = 10] = "OFFSET";
1382
+ })(BankAccountTypeEnum || (BankAccountTypeEnum = {}));
1503
1383
 
1504
- /**
1505
- * export table column
1506
- */
1507
- class ExportCell {
1508
- }
1384
+ const TYPE_LOAN = [
1385
+ BankAccountTypeEnum.CREDIT_CARD,
1386
+ BankAccountTypeEnum.LOAN
1387
+ ];
1509
1388
 
1510
1389
  /**
1511
- * type of export table column value
1390
+ * Collection of bank accounts.
1512
1391
  */
1513
- var ExportCellTypeEnum;
1514
- (function (ExportCellTypeEnum) {
1515
- ExportCellTypeEnum[ExportCellTypeEnum["STRING"] = 0] = "STRING";
1516
- ExportCellTypeEnum[ExportCellTypeEnum["CURRENCY"] = 1] = "CURRENCY";
1517
- ExportCellTypeEnum[ExportCellTypeEnum["DATE"] = 2] = "DATE";
1518
- })(ExportCellTypeEnum || (ExportCellTypeEnum = {}));
1519
-
1520
- class LoanPaymentCollection extends ExportableCollection {
1521
- getExportHeader() {
1522
- return [
1523
- 'Pmt No.',
1524
- 'Date',
1525
- 'Payment Due',
1526
- 'Interest Accrued',
1527
- 'Principal Paid',
1528
- 'Principal Balance',
1529
- 'Payout'
1530
- ];
1531
- }
1532
- getExportBody() {
1533
- return this.items.map((payment) => {
1534
- return [
1535
- plainToClass(ExportCell, { value: payment.number, type: ExportCellTypeEnum.STRING }),
1536
- plainToClass(ExportCell, { value: payment.date, type: ExportCellTypeEnum.DATE }),
1537
- plainToClass(ExportCell, { value: payment.paymentDue, type: ExportCellTypeEnum.CURRENCY }),
1538
- plainToClass(ExportCell, { value: payment.interestAccrued, type: ExportCellTypeEnum.CURRENCY }),
1539
- plainToClass(ExportCell, { value: payment.principalPaid, type: ExportCellTypeEnum.CURRENCY }),
1540
- plainToClass(ExportCell, { value: payment.principalBalance, type: ExportCellTypeEnum.CURRENCY }),
1541
- plainToClass(ExportCell, { value: payment.payout, type: ExportCellTypeEnum.CURRENCY }),
1542
- ];
1543
- });
1544
- }
1545
- get paymentDue() {
1546
- return this.sumBy('paymentDue');
1547
- }
1548
- getByFinYear(finYear = new FinancialYear()) {
1549
- return this.filter((payment) => {
1550
- return new Date(payment.date) >= finYear.startDate &&
1551
- new Date(payment.date) <= finYear.endDate;
1552
- });
1553
- }
1554
- getForCurrentYear() {
1555
- return this.getByFinYear(new FinancialYear());
1556
- }
1557
- }
1558
-
1559
- class Loan extends Loan$1 {
1392
+ class BankAccountCollection extends Collection {
1560
1393
  /**
1561
- * Check if loan type is related to LoanVehicleTypeEnum
1394
+ * get list of bank accounts with passed types
1562
1395
  */
1563
- isVehicle() {
1564
- return !this.bankAccount && this.type in LoanVehicleTypeEnum;
1396
+ getByType(types, isExclude = false) {
1397
+ // get types always as array (if only one passed)
1398
+ const typesArray = concat(types);
1399
+ return this.items.filter((bankAccount) => {
1400
+ if (isExclude) {
1401
+ return !typesArray.includes(bankAccount.type);
1402
+ }
1403
+ return typesArray.includes(bankAccount.type);
1404
+ });
1565
1405
  }
1566
1406
  /**
1567
- * Get the last payment for passed financial year
1568
- * @param year financial year for filter
1407
+ * get amount of initial loans
1569
1408
  */
1570
- getLastPaymentByYear(year) {
1571
- const finYear = new FinancialYear(new Date(year.toString()));
1572
- return last(this.payments.filter((payment) => payment.date > finYear.startDate && payment.date < finYear.endDate));
1409
+ getInitialLoanAmount() {
1410
+ return this.getByType(TYPE_LOAN)
1411
+ .reduce((sum, bankAccount) => {
1412
+ return sum += bankAccount.balances.length ? bankAccount.getOpeningBalance() : 0;
1413
+ }, 0);
1573
1414
  }
1574
1415
  /**
1575
- * The size of loan interest
1576
- * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/212369955/Loans+vehicle+loans
1416
+ * get amount of current loans
1417
+ */
1418
+ getCurrentLoanAmount() {
1419
+ return this.getByType(TYPE_LOAN)
1420
+ .reduce((sum, bankAccount) => {
1421
+ return sum += bankAccount.currentBalance;
1422
+ }, 0);
1423
+ }
1424
+ /**
1425
+ * get collection filtered by property id
1426
+ */
1427
+ getByPropertyId(id) {
1428
+ return new BankAccountCollection(this.items.filter((bankAccount) => {
1429
+ return bankAccount.bankAccountProperties.find((bankAccountProperty) => {
1430
+ return bankAccountProperty.property.id === id;
1431
+ });
1432
+ }));
1433
+ }
1434
+ /**
1435
+ * get collection filtered by properties ids
1436
+ */
1437
+ getByPropertiesIds(ids) {
1438
+ return new BankAccountCollection(this.items.filter((bankAccount) => {
1439
+ return bankAccount.bankAccountProperties.find((bankAccountProperty) => {
1440
+ return ids.includes(bankAccountProperty.property.id);
1441
+ });
1442
+ }));
1443
+ }
1444
+ /**
1445
+ * get collection of active bank accounts
1446
+ */
1447
+ getActiveBankAccounts() {
1448
+ return new BankAccountCollection(this.items.filter((bankAccount) => {
1449
+ return bankAccount.isActive();
1450
+ }));
1451
+ }
1452
+ /**
1453
+ * get reduction of loan (reduction of principle) percentage
1454
+ */
1455
+ getPrincipleReductionPercent() {
1456
+ const initialLoans = this.getInitialLoanAmount();
1457
+ const currentLoans = this.getCurrentLoanAmount();
1458
+ if (!initialLoans) {
1459
+ return 0;
1460
+ }
1461
+ return (initialLoans - currentLoans) / initialLoans * 100;
1462
+ }
1463
+ /**
1464
+ * Get collection of loan bank accounts
1465
+ */
1466
+ getLoanAccounts() {
1467
+ return new BankAccountCollection(this.getByType(TYPE_LOAN));
1468
+ }
1469
+ getSavingsAccounts() {
1470
+ return new BankAccountCollection(this.getByType(TYPE_LOAN, true));
1471
+ }
1472
+ getOpeningBalance() {
1473
+ return this.items.reduce((sum, bankAccount) => sum + bankAccount.getOpeningBalance(), 0);
1474
+ }
1475
+ get currentBalance() {
1476
+ return this.sumBy('currentBalance');
1477
+ }
1478
+ /**
1479
+ * Get Collection of bank accounts with property tank type
1480
+ */
1481
+ getPropertyBankAccounts() {
1482
+ return new BankAccountCollection(this.items.filter((bankAccount) => bankAccount.isPropertyTank()));
1483
+ }
1484
+ /**
1485
+ * Get Collection of bank accounts with work tank type
1486
+ */
1487
+ getWorkBankAccounts() {
1488
+ return new BankAccountCollection(this.items.filter((bankAccount) => bankAccount.isWorkTank()));
1489
+ }
1490
+ /**
1491
+ * Get Collection of bank accounts by tank type
1492
+ */
1493
+ getByTankType(tankType) {
1494
+ return new BankAccountCollection(this.items.filter((bankAccount) => bankAccount.tankType === tankType));
1495
+ }
1496
+ /**
1497
+ * Get list of all bank account properties
1498
+ */
1499
+ getBankAccountPropertiesList() {
1500
+ return flatten(this.items.map((bankAccount) => {
1501
+ return bankAccount.bankAccountProperties;
1502
+ }));
1503
+ }
1504
+ /**
1505
+ * Get lis of unique properties from all bank accounts properties
1506
+ */
1507
+ getProperties() {
1508
+ return uniqBy(this.getBankAccountPropertiesList().map((bankAccountProperty) => {
1509
+ return bankAccountProperty.property;
1510
+ }), 'id');
1511
+ }
1512
+ getPropertyBalanceAmount(propertyId) {
1513
+ return this.items.reduce((sum, bankAccount) => {
1514
+ return sum + bankAccount.getPropertyBalanceAmount(propertyId);
1515
+ }, 0);
1516
+ }
1517
+ }
1518
+
1519
+ var UserEventTypeTypeEnum;
1520
+ (function (UserEventTypeTypeEnum) {
1521
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["REGISTERED"] = 1000] = "REGISTERED";
1522
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["PASSWORD_RESET_REQUEST"] = 1001] = "PASSWORD_RESET_REQUEST";
1523
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["APP_FEATURES"] = 1010] = "APP_FEATURES";
1524
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["SUBSCRIBED"] = 2000] = "SUBSCRIBED";
1525
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["UNSUBSCRIBED"] = 2001] = "UNSUBSCRIBED";
1526
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["SUBSCRIPTION_UPDATE"] = 2004] = "SUBSCRIPTION_UPDATE";
1527
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["SUBSCRIPTION_TRIAL_UPDATE"] = 2005] = "SUBSCRIPTION_TRIAL_UPDATE";
1528
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["SUBSCRIPTION_PAYMENT_FAILED"] = 2006] = "SUBSCRIPTION_PAYMENT_FAILED";
1529
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE"] = 2010] = "CLIENT_INVITE";
1530
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE_TO_REGISTER"] = 2011] = "CLIENT_INVITE_TO_REGISTER";
1531
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_INVITE_ACCEPTED"] = 2012] = "FIRM_INVITE_ACCEPTED";
1532
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_INVITE_REJECTED"] = 2013] = "FIRM_INVITE_REJECTED";
1533
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_INVITE_REGISTERED"] = 2014] = "FIRM_INVITE_REGISTERED";
1534
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_INVITE"] = 2020] = "PROPERTY_SHARE_INVITE";
1535
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_INVITE_TO_REGISTER"] = 2021] = "PROPERTY_SHARE_INVITE_TO_REGISTER";
1536
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_INVITE_ACCEPTED"] = 2022] = "PROPERTY_SHARE_INVITE_ACCEPTED";
1537
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_INVITE_REJECTED"] = 2023] = "PROPERTY_SHARE_INVITE_REJECTED";
1538
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_INVITE_REGISTERED"] = 2024] = "PROPERTY_SHARE_INVITE_REGISTERED";
1539
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_CHANGE_REQUESTED"] = 2025] = "PROPERTY_SHARE_CHANGE_REQUESTED";
1540
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_CHANGE_ACCEPTED"] = 2026] = "PROPERTY_SHARE_CHANGE_ACCEPTED";
1541
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_CHANGE_REJECTED"] = 2027] = "PROPERTY_SHARE_CHANGE_REJECTED";
1542
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["OWNER_SUBSCRIBED"] = 2028] = "OWNER_SUBSCRIBED";
1543
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["OWNER_UNSUBSCRIBED"] = 2029] = "OWNER_UNSUBSCRIBED";
1544
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["BASIQ_NEW_ACCOUNTS"] = 2030] = "BASIQ_NEW_ACCOUNTS";
1545
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["BASIQ_FIRST_IMPORT_COMPLETE"] = 2031] = "BASIQ_FIRST_IMPORT_COMPLETE";
1546
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["BASIQ_AUTHORIZATION_FAIL"] = 2032] = "BASIQ_AUTHORIZATION_FAIL";
1547
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["TRANSACTION_ALLOCATE_REMINDER"] = 2033] = "TRANSACTION_ALLOCATE_REMINDER";
1548
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["REGISTRATION_INVITE"] = 2040] = "REGISTRATION_INVITE";
1549
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["REGISTRATION_INVITE_ACCEPTED"] = 2041] = "REGISTRATION_INVITE_ACCEPTED";
1550
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_EMAIL_CONFIRMED"] = 2050] = "CLIENT_EMAIL_CONFIRMED";
1551
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["TAX_REVIEW_REQUESTED"] = 2060] = "TAX_REVIEW_REQUESTED";
1552
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_INVITE_TO_REGISTER"] = 3000] = "FIRM_INVITE_TO_REGISTER";
1553
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_INVITE"] = 3001] = "FIRM_INVITE";
1554
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE_ACCEPTED"] = 3002] = "CLIENT_INVITE_ACCEPTED";
1555
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE_REJECTED"] = 3003] = "CLIENT_INVITE_REJECTED";
1556
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE_REGISTERED"] = 3004] = "CLIENT_INVITE_REGISTERED";
1557
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_NEW_CLIENT"] = 3005] = "FIRM_NEW_CLIENT";
1558
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_LOST_CLIENT"] = 3006] = "FIRM_LOST_CLIENT";
1559
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_INVITE"] = 3010] = "EMPLOYEE_INVITE";
1560
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_LOST_CLIENT"] = 3011] = "EMPLOYEE_LOST_CLIENT";
1561
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_NEW_CLIENT"] = 3012] = "EMPLOYEE_NEW_CLIENT";
1562
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_INVITE_ACCEPTED"] = 3013] = "EMPLOYEE_INVITE_ACCEPTED";
1563
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_EMAIL_CONFIRMED"] = 3020] = "EMPLOYEE_EMAIL_CONFIRMED";
1564
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["TAX_REVIEW_RECEIVED"] = 3030] = "TAX_REVIEW_RECEIVED";
1565
+ })(UserEventTypeTypeEnum || (UserEventTypeTypeEnum = {}));
1566
+
1567
+ /**
1568
+ * any event happened in the app, which needs to be handled somehow (distributed to other part of the app)
1569
+ */
1570
+ class AppEvent {
1571
+ constructor(type, payload) {
1572
+ this.type = type;
1573
+ this.payload = payload;
1574
+ }
1575
+ }
1576
+
1577
+ /**
1578
+ * Class describe configuration options for basiq connect control
1579
+ * https://www.npmjs.com/package/@basiq/basiq-connect-control
1580
+ */
1581
+ class BasiqConfig {
1582
+ constructor(options) {
1583
+ // ID of the DOM element to which Basiq Connect Control will be rendered;
1584
+ this.containerId = 'basiq-control';
1585
+ Object.assign(this, options);
1586
+ }
1587
+ }
1588
+
1589
+ class AbstractModel {
1590
+ hasValue(value, path = 'id') {
1591
+ return get(path) === value;
1592
+ }
1593
+ }
1594
+
1595
+ class BasiqJob$1 extends AbstractModel {
1596
+ }
1597
+
1598
+ class BasiqJob extends BasiqJob$1 {
1599
+ }
1600
+
1601
+ class BasiqJobStep {
1602
+ isVerifyCredentials() {
1603
+ return this.title === 'verify-credentials';
1604
+ }
1605
+ isInProgress() {
1606
+ return this.status === 'in-progress';
1607
+ }
1608
+ isSuccess() {
1609
+ return this.status === 'success';
1610
+ }
1611
+ }
1612
+
1613
+ class BasiqJobResponse {
1614
+ getVerifyCredentialsStep() {
1615
+ return this.steps.find((step) => step.isVerifyCredentials());
1616
+ }
1617
+ }
1618
+ __decorate([
1619
+ Type(() => BasiqJobStep)
1620
+ ], BasiqJobResponse.prototype, "steps", void 0);
1621
+
1622
+ /**
1623
+ * access token, needed to access basiq connect ui (https://github.com/basiqio/basiq-connect-ui)
1624
+ */
1625
+ class BasiqToken {
1626
+ constructor(value, expiresAt) {
1627
+ this.value = value;
1628
+ this.expiresAt = expiresAt;
1629
+ }
1630
+ isExpired() {
1631
+ return this.expiresAt < new Date();
1632
+ }
1633
+ }
1634
+
1635
+ class Bank$1 extends AbstractModel {
1636
+ }
1637
+
1638
+ var BankPopularEnum;
1639
+ (function (BankPopularEnum) {
1640
+ BankPopularEnum["BANKWEST"] = "Bank of Western Australia trading as BankWest";
1641
+ BankPopularEnum["ANZ"] = "Australia and New Zealand Banking Group Limited";
1642
+ BankPopularEnum["CBA"] = "Commonwealth Bank Australia";
1643
+ BankPopularEnum["WESTPAC"] = "Westpac Banking Corporation";
1644
+ BankPopularEnum["BENDIGO"] = "Bendigo and Adelaide Bank Limited";
1645
+ BankPopularEnum["ING_DIRECT"] = "ING Bank (Australia) Limited (trading as ING Direct)";
1646
+ BankPopularEnum["ST_GEORGE"] = "St. George Bank (a subsidiary of Westpac)";
1647
+ BankPopularEnum["SUNCORP"] = "Suncorp-Metway Limited";
1648
+ BankPopularEnum["CITIBANK"] = "Citibank";
1649
+ BankPopularEnum["BOQ"] = "Bank of Queensland Limited";
1650
+ })(BankPopularEnum || (BankPopularEnum = {}));
1651
+
1652
+ /**
1653
+ * Bank subclass, average bank response time for some operations in milliseconds
1654
+ * Used for basiq banks functionality to improve bank login UI/UX (loading progress)
1655
+ */
1656
+ class BankExternalStats {
1657
+ }
1658
+
1659
+ class Bank extends Bank$1 {
1660
+ getPhotoPlaceholder() {
1661
+ return this.name[0] + this.name[1];
1662
+ }
1663
+ getPhoto() {
1664
+ if (!this.logo) {
1665
+ return null;
1666
+ }
1667
+ return this.logo.includes('http') ? `${this.logo}` : `${localStorage.getItem('api_uri')}/${this.logo}`;
1668
+ }
1669
+ }
1670
+ __decorate([
1671
+ Transform(({ value }) => value ? value.replace(' ', '%20') : null)
1672
+ ], Bank.prototype, "logo", void 0);
1673
+ __decorate([
1674
+ Transform(({ obj }) => Object.values(BankPopularEnum).includes(obj.name)),
1675
+ Expose()
1676
+ ], Bank.prototype, "isPopular", void 0);
1677
+ __decorate([
1678
+ Type(() => BankExternalStats)
1679
+ ], Bank.prototype, "externalStats", void 0);
1680
+
1681
+ class BankAccount$1 extends AbstractModel {
1682
+ }
1683
+
1684
+ var BankAccountStatusEnum;
1685
+ (function (BankAccountStatusEnum) {
1686
+ BankAccountStatusEnum[BankAccountStatusEnum["INACTIVE"] = 0] = "INACTIVE";
1687
+ BankAccountStatusEnum[BankAccountStatusEnum["ACTIVE"] = 1] = "ACTIVE";
1688
+ })(BankAccountStatusEnum || (BankAccountStatusEnum = {}));
1689
+
1690
+ class Loan$1 extends AbstractModel {
1691
+ }
1692
+
1693
+ var LoanVehicleTypeEnum;
1694
+ (function (LoanVehicleTypeEnum) {
1695
+ LoanVehicleTypeEnum[LoanVehicleTypeEnum["AUTO_LOAN"] = 6] = "AUTO_LOAN";
1696
+ LoanVehicleTypeEnum[LoanVehicleTypeEnum["CHATTEL_MORTGAGE"] = 9] = "CHATTEL_MORTGAGE";
1697
+ LoanVehicleTypeEnum[LoanVehicleTypeEnum["COMMERCIAL_HIRE_PURCHASE"] = 10] = "COMMERCIAL_HIRE_PURCHASE";
1698
+ })(LoanVehicleTypeEnum || (LoanVehicleTypeEnum = {}));
1699
+
1700
+ // @Todo no base model from backend list
1701
+ /**
1702
+ * Loan payment class
1703
+ */
1704
+ class LoanPayment extends AbstractModel {
1705
+ }
1706
+ __decorate([
1707
+ Type(() => Date)
1708
+ ], LoanPayment.prototype, "date", void 0);
1709
+
1710
+ class LoanPayout$1 extends AbstractModel {
1711
+ }
1712
+
1713
+ var LoanPayoutTypeEnum;
1714
+ (function (LoanPayoutTypeEnum) {
1715
+ LoanPayoutTypeEnum[LoanPayoutTypeEnum["REFINANCE"] = 1] = "REFINANCE";
1716
+ LoanPayoutTypeEnum[LoanPayoutTypeEnum["PAYOUT"] = 2] = "PAYOUT";
1717
+ })(LoanPayoutTypeEnum || (LoanPayoutTypeEnum = {}));
1718
+
1719
+ class LoanPayout extends LoanPayout$1 {
1720
+ /**
1721
+ * Check if payout type is refinance
1722
+ */
1723
+ isRefinance() {
1724
+ return this.type === LoanPayoutTypeEnum.REFINANCE;
1725
+ }
1726
+ }
1727
+
1728
+ class FinancialYear {
1729
+ constructor(date) {
1730
+ this.yearStartDate = '-07-01';
1731
+ this.yearEndDate = '-06-30';
1732
+ if (date) {
1733
+ this.year = date instanceof Date ? FinancialYear.toFinYear(date) : date;
1734
+ }
1735
+ else {
1736
+ this.year = +localStorage.getItem('financialYear') || FinancialYear.toFinYear(new Date());
1737
+ }
1738
+ this.setStartDate(this.year);
1739
+ this.setEndDate(this.year);
1740
+ }
1741
+ includes(date) {
1742
+ return this.year === new FinancialYear(date).year;
1743
+ }
1744
+ static toFinYear(date) {
1745
+ return date.getFullYear() + (date.getMonth() >= this.startMonthIndex ? 1 : 0);
1746
+ }
1747
+ get prevFinYear() {
1748
+ return new FinancialYear(new Date(`${new Date().getFullYear() - 1}${this.yearStartDate}`));
1749
+ }
1750
+ /**
1751
+ * Get date by desired month
1752
+ */
1753
+ getMonthDate(monthIndex) {
1754
+ if (monthIndex >= FinancialYear.startMonthIndex) {
1755
+ return new Date(`${this.year - 1}-${monthIndex + 1}-01`);
1756
+ }
1757
+ return new Date(`${this.year}-${monthIndex + 1}-01`);
1758
+ }
1759
+ setStartDate(year) {
1760
+ this.startDate = new Date(`${year - 1}${this.yearStartDate}`);
1761
+ }
1762
+ setEndDate(year) {
1763
+ this.endDate = new Date(`${year}${this.yearEndDate}`);
1764
+ }
1765
+ getPastMonths() {
1766
+ const months = [];
1767
+ const now = new Date();
1768
+ const endDate = this.endDate < now ? this.endDate : now;
1769
+ for (const d = this.startDate; d <= endDate; d.setMonth(d.getMonth() + 1)) {
1770
+ months.push(d.getMonth());
1771
+ }
1772
+ return months;
1773
+ }
1774
+ }
1775
+ FinancialYear.weeksInYear = 52;
1776
+ FinancialYear.startMonthIndex = 6;
1777
+
1778
+ class ExportDataTable {
1779
+ }
1780
+
1781
+ class ExportableCollection extends Collection {
1782
+ getExportFooter(type) {
1783
+ return [];
1784
+ }
1785
+ ;
1786
+ export(type) {
1787
+ return plainToClass(ExportDataTable, {
1788
+ header: this.getExportHeader(type),
1789
+ body: this.getExportBody(type),
1790
+ footer: [this.getExportFooter(type)]
1791
+ });
1792
+ }
1793
+ }
1794
+
1795
+ /**
1796
+ * export table column
1797
+ */
1798
+ class ExportCell {
1799
+ }
1800
+
1801
+ /**
1802
+ * type of export table column value
1803
+ */
1804
+ var ExportCellTypeEnum;
1805
+ (function (ExportCellTypeEnum) {
1806
+ ExportCellTypeEnum[ExportCellTypeEnum["STRING"] = 0] = "STRING";
1807
+ ExportCellTypeEnum[ExportCellTypeEnum["CURRENCY"] = 1] = "CURRENCY";
1808
+ ExportCellTypeEnum[ExportCellTypeEnum["DATE"] = 2] = "DATE";
1809
+ })(ExportCellTypeEnum || (ExportCellTypeEnum = {}));
1810
+
1811
+ class LoanPaymentCollection extends ExportableCollection {
1812
+ getExportHeader() {
1813
+ return [
1814
+ 'Pmt No.',
1815
+ 'Date',
1816
+ 'Payment Due',
1817
+ 'Interest Accrued',
1818
+ 'Principal Paid',
1819
+ 'Principal Balance',
1820
+ 'Payout'
1821
+ ];
1822
+ }
1823
+ getExportBody() {
1824
+ return this.items.map((payment) => {
1825
+ return [
1826
+ plainToClass(ExportCell, { value: payment.number, type: ExportCellTypeEnum.STRING }),
1827
+ plainToClass(ExportCell, { value: payment.date, type: ExportCellTypeEnum.DATE }),
1828
+ plainToClass(ExportCell, { value: payment.paymentDue, type: ExportCellTypeEnum.CURRENCY }),
1829
+ plainToClass(ExportCell, { value: payment.interestAccrued, type: ExportCellTypeEnum.CURRENCY }),
1830
+ plainToClass(ExportCell, { value: payment.principalPaid, type: ExportCellTypeEnum.CURRENCY }),
1831
+ plainToClass(ExportCell, { value: payment.principalBalance, type: ExportCellTypeEnum.CURRENCY }),
1832
+ plainToClass(ExportCell, { value: payment.payout, type: ExportCellTypeEnum.CURRENCY }),
1833
+ ];
1834
+ });
1835
+ }
1836
+ get paymentDue() {
1837
+ return this.sumBy('paymentDue');
1838
+ }
1839
+ getByFinYear(finYear = new FinancialYear()) {
1840
+ return this.filter((payment) => {
1841
+ return new Date(payment.date) >= finYear.startDate &&
1842
+ new Date(payment.date) <= finYear.endDate;
1843
+ });
1844
+ }
1845
+ getForCurrentYear() {
1846
+ return this.getByFinYear(new FinancialYear());
1847
+ }
1848
+ }
1849
+
1850
+ class Loan extends Loan$1 {
1851
+ /**
1852
+ * Check if loan type is related to LoanVehicleTypeEnum
1853
+ */
1854
+ isVehicle() {
1855
+ return !this.bankAccount && this.type in LoanVehicleTypeEnum;
1856
+ }
1857
+ /**
1858
+ * Get the last payment for passed financial year
1859
+ * @param year financial year for filter
1860
+ */
1861
+ getLastPaymentByYear(year) {
1862
+ const finYear = new FinancialYear(new Date(year.toString()));
1863
+ return last(this.payments.filter((payment) => payment.date > finYear.startDate && payment.date < finYear.endDate));
1864
+ }
1865
+ /**
1866
+ * The size of loan interest
1867
+ * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/212369955/Loans+vehicle+loans
1577
1868
  * @TODO Vik/Nicole: need to update documentation. Derek gave the right formulas to Mikhail
1578
1869
  */
1579
1870
  getInterest() {
@@ -1681,6 +1972,7 @@ class Country extends Country$1 {
1681
1972
  return this.callingCode === '61';
1682
1973
  }
1683
1974
  }
1975
+ Country.australia = plainToClass(Country, { id: 14, name: 'Australia', callingCode: '61' });
1684
1976
 
1685
1977
  var AddressTypeEnum;
1686
1978
  (function (AddressTypeEnum) {
@@ -1700,7 +1992,7 @@ class Address extends Address$1 {
1700
1992
  return `${this.unitNumber ? this.unitNumber + '/' : ''}${this.address}`;
1701
1993
  }
1702
1994
  get nameLong() {
1703
- return `${this.name}, ${this.city}, ${this.state}`;
1995
+ return `${this.name} ${this.city} ${this.state} ${this.postcode}`;
1704
1996
  }
1705
1997
  }
1706
1998
  __decorate([
@@ -1737,12 +2029,16 @@ var PhoneTypeEnum;
1737
2029
  class Phone extends Phone$1 {
1738
2030
  constructor() {
1739
2031
  super(...arguments);
2032
+ this.country = Country.australia;
1740
2033
  this.type = PhoneTypeEnum.MOBILE;
1741
2034
  }
1742
2035
  toString() {
1743
2036
  return `+${this.country.callingCode} ${this.number}`;
1744
2037
  }
1745
2038
  }
2039
+ __decorate([
2040
+ Type(() => Country)
2041
+ ], Phone.prototype, "country", void 0);
1746
2042
 
1747
2043
  class Firm extends Firm$1 {
1748
2044
  /**
@@ -4328,48 +4624,6 @@ __decorate([
4328
4624
  class BankConnection$1 extends AbstractModel {
4329
4625
  }
4330
4626
 
4331
- class BasiqJob$1 extends AbstractModel {
4332
- }
4333
-
4334
- class BasiqJob extends BasiqJob$1 {
4335
- }
4336
-
4337
- class Bank$1 extends AbstractModel {
4338
- }
4339
-
4340
- var BankPopularEnum;
4341
- (function (BankPopularEnum) {
4342
- BankPopularEnum["BANKWEST"] = "Bank of Western Australia trading as BankWest";
4343
- BankPopularEnum["ANZ"] = "Australia and New Zealand Banking Group Limited";
4344
- BankPopularEnum["CBA"] = "Commonwealth Bank Australia";
4345
- BankPopularEnum["WESTPAC"] = "Westpac Banking Corporation";
4346
- BankPopularEnum["BENDIGO"] = "Bendigo and Adelaide Bank Limited";
4347
- BankPopularEnum["ING_DIRECT"] = "ING Bank (Australia) Limited (trading as ING Direct)";
4348
- BankPopularEnum["ST_GEORGE"] = "St. George Bank (a subsidiary of Westpac)";
4349
- BankPopularEnum["SUNCORP"] = "Suncorp-Metway Limited";
4350
- BankPopularEnum["CITIBANK"] = "Citibank";
4351
- BankPopularEnum["BOQ"] = "Bank of Queensland Limited";
4352
- })(BankPopularEnum || (BankPopularEnum = {}));
4353
-
4354
- class Bank extends Bank$1 {
4355
- getPhotoPlaceholder() {
4356
- return this.name[0] + this.name[1];
4357
- }
4358
- getPhoto() {
4359
- if (!this.logo) {
4360
- return null;
4361
- }
4362
- return this.logo.includes('http') ? `${this.logo}` : `${localStorage.getItem('api_uri')}/${this.logo}`;
4363
- }
4364
- }
4365
- __decorate([
4366
- Transform(({ value }) => value ? value.replace(' ', '%20') : null)
4367
- ], Bank.prototype, "logo", void 0);
4368
- __decorate([
4369
- Transform(({ obj }) => Object.values(BankPopularEnum).includes(obj.name)),
4370
- Expose()
4371
- ], Bank.prototype, "isPopular", void 0);
4372
-
4373
4627
  var BankConnectionStatusEnum;
4374
4628
  (function (BankConnectionStatusEnum) {
4375
4629
  BankConnectionStatusEnum[BankConnectionStatusEnum["PENDING"] = 1] = "PENDING";
@@ -4554,198 +4808,250 @@ __decorate([
4554
4808
  Transform(({ value }) => value === 4 ? BankAccountTypeEnum.LOAN : value)
4555
4809
  ], BankAccount.prototype, "type", void 0);
4556
4810
 
4557
- const TYPE_LOAN = [
4558
- BankAccountTypeEnum.CREDIT_CARD,
4559
- BankAccountTypeEnum.LOAN
4560
- ];
4561
-
4562
4811
  /**
4563
- * Collection of bank accounts.
4812
+ * bank account collection UI class with frontend specific data
4564
4813
  */
4565
- class BankAccountCollection extends Collection {
4566
- /**
4567
- * get list of bank accounts with passed types
4568
- */
4569
- getByType(types, isExclude = false) {
4570
- // get types always as array (if only one passed)
4571
- const typesArray = concat(types);
4572
- return this.items.filter((bankAccount) => {
4573
- if (isExclude) {
4574
- return !typesArray.includes(bankAccount.type);
4575
- }
4576
- return typesArray.includes(bankAccount.type);
4577
- });
4578
- }
4579
- /**
4580
- * get amount of initial loans
4581
- */
4582
- getInitialLoanAmount() {
4583
- return this.getByType(TYPE_LOAN)
4584
- .reduce((sum, bankAccount) => {
4585
- return sum += bankAccount.balances.length ? bankAccount.getOpeningBalance() : 0;
4586
- }, 0);
4814
+ class BankAccountChartData {
4815
+ constructor(bankAccounts) {
4816
+ this.bankAccounts = bankAccounts;
4587
4817
  }
4588
4818
  /**
4589
- * get amount of current loans
4819
+ * set value of pie chart data
4590
4820
  */
4591
- getCurrentLoanAmount() {
4592
- return this.getByType(TYPE_LOAN)
4593
- .reduce((sum, bankAccount) => {
4594
- return sum += bankAccount.currentBalance;
4595
- }, 0);
4821
+ getBalancePieChartData() {
4822
+ return this.bankAccounts.map((bankAccount) => {
4823
+ return {
4824
+ name: bankAccount.accountName,
4825
+ data: Math.abs(bankAccount.currentBalance)
4826
+ };
4827
+ });
4596
4828
  }
4597
4829
  /**
4598
- * get collection filtered by property id
4830
+ * set value of bar chart data
4599
4831
  */
4600
- getByPropertyId(id) {
4601
- return new BankAccountCollection(this.items.filter((bankAccount) => {
4602
- return bankAccount.bankAccountProperties.find((bankAccountProperty) => {
4603
- return bankAccountProperty.property.id === id;
4604
- });
4605
- }));
4832
+ getBalanceBarChartData() {
4833
+ return [{
4834
+ name: 'Balance',
4835
+ data: this.bankAccounts.map((bankAccount) => {
4836
+ return {
4837
+ label: bankAccount.accountName,
4838
+ value: bankAccount.currentBalance
4839
+ };
4840
+ })
4841
+ }];
4606
4842
  }
4607
- /**
4608
- * get collection filtered by properties ids
4609
- */
4610
- getByPropertiesIds(ids) {
4611
- return new BankAccountCollection(this.items.filter((bankAccount) => {
4612
- return bankAccount.bankAccountProperties.find((bankAccountProperty) => {
4613
- return ids.includes(bankAccountProperty.property.id);
4614
- });
4615
- }));
4843
+ }
4844
+
4845
+ /**
4846
+ * Const which contains array of bank account types
4847
+ */
4848
+ const BANK_ACCOUNT_TYPES = [
4849
+ { key: BankAccountTypeEnum.CREDIT_CARD, value: 'Credit Card Accounts' },
4850
+ { key: BankAccountTypeEnum.TERM_DEPOSIT, value: 'Deposit Accounts' },
4851
+ { key: BankAccountTypeEnum.INVESTMENT, value: 'Investment Accounts' },
4852
+ { key: BankAccountTypeEnum.LOAN, value: 'Loan Accounts' },
4853
+ { key: BankAccountTypeEnum.OFFSET, value: 'Offset' },
4854
+ { key: BankAccountTypeEnum.SAVINGS, value: 'Savings Accounts' },
4855
+ { key: BankAccountTypeEnum.TRANSACTION, value: 'Transaction Accounts' },
4856
+ ];
4857
+
4858
+ /**
4859
+ * Login data object for basiq banks
4860
+ */
4861
+ class BankLoginData {
4862
+ }
4863
+
4864
+ /**
4865
+ * enum with months indexes.
4866
+ * item value match with js Date month index from 0 to 11
4867
+ * Order of items match with financial year months order
4868
+ */
4869
+ var MonthNumberEnum;
4870
+ (function (MonthNumberEnum) {
4871
+ MonthNumberEnum[MonthNumberEnum["JULY"] = 6] = "JULY";
4872
+ MonthNumberEnum[MonthNumberEnum["AUGUST"] = 7] = "AUGUST";
4873
+ MonthNumberEnum[MonthNumberEnum["SEPTEMBER"] = 8] = "SEPTEMBER";
4874
+ MonthNumberEnum[MonthNumberEnum["OCTOBER"] = 9] = "OCTOBER";
4875
+ MonthNumberEnum[MonthNumberEnum["NOVEMBER"] = 10] = "NOVEMBER";
4876
+ MonthNumberEnum[MonthNumberEnum["DECEMBER"] = 11] = "DECEMBER";
4877
+ MonthNumberEnum[MonthNumberEnum["JANUARY"] = 0] = "JANUARY";
4878
+ MonthNumberEnum[MonthNumberEnum["FEBRUARY"] = 1] = "FEBRUARY";
4879
+ MonthNumberEnum[MonthNumberEnum["MARCH"] = 2] = "MARCH";
4880
+ MonthNumberEnum[MonthNumberEnum["APRIL"] = 3] = "APRIL";
4881
+ MonthNumberEnum[MonthNumberEnum["MAY"] = 4] = "MAY";
4882
+ MonthNumberEnum[MonthNumberEnum["JUNE"] = 5] = "JUNE";
4883
+ })(MonthNumberEnum || (MonthNumberEnum = {}));
4884
+
4885
+ /**
4886
+ * @TODO move to pipe/translation
4887
+ * enum with months short names.
4888
+ * Order of items match with financial year months order
4889
+ */
4890
+ var MonthNameShortEnum;
4891
+ (function (MonthNameShortEnum) {
4892
+ MonthNameShortEnum["JULY"] = "Jul";
4893
+ MonthNameShortEnum["AUGUST"] = "Aug";
4894
+ MonthNameShortEnum["SEPTEMBER"] = "Sep";
4895
+ MonthNameShortEnum["OCTOBER"] = "Oct";
4896
+ MonthNameShortEnum["NOVEMBER"] = "Nov";
4897
+ MonthNameShortEnum["DECEMBER"] = "Dec";
4898
+ MonthNameShortEnum["JANUARY"] = "Jan";
4899
+ MonthNameShortEnum["FEBRUARY"] = "Feb";
4900
+ MonthNameShortEnum["MARCH"] = "Mar";
4901
+ MonthNameShortEnum["APRIL"] = "Apr";
4902
+ MonthNameShortEnum["MAY"] = "May";
4903
+ MonthNameShortEnum["JUNE"] = "Jun";
4904
+ })(MonthNameShortEnum || (MonthNameShortEnum = {}));
4905
+
4906
+ /**
4907
+ * bank transactions collection UI class with frontend specific data
4908
+ */
4909
+ class BankTransactionChartData {
4910
+ constructor(bankTransactions) {
4911
+ this.bankTransactions = bankTransactions;
4616
4912
  }
4617
4913
  /**
4618
- * get collection of active bank accounts
4914
+ * get value of bar chart data
4619
4915
  */
4620
- getActiveBankAccounts() {
4621
- return new BankAccountCollection(this.items.filter((bankAccount) => {
4622
- return bankAccount.isActive();
4623
- }));
4916
+ getCashInOutBarChartData(months) {
4917
+ const chartData = this.calculateCashInOutBarChartData();
4918
+ if (!months) {
4919
+ return chartData;
4920
+ }
4921
+ return this.filterChartDataByMonths(months, chartData);
4624
4922
  }
4625
4923
  /**
4626
- * get reduction of loan (reduction of principle) percentage
4924
+ * get value of line chart data
4627
4925
  */
4628
- getPrincipleReductionPercent() {
4629
- const initialLoans = this.getInitialLoanAmount();
4630
- const currentLoans = this.getCurrentLoanAmount();
4631
- if (!initialLoans) {
4632
- return 0;
4926
+ getBalanceLineChartData(months) {
4927
+ const chartData = this.calculateBalanceLineChartData();
4928
+ if (!months) {
4929
+ return chartData;
4633
4930
  }
4634
- return (initialLoans - currentLoans) / initialLoans * 100;
4931
+ return this.filterChartDataByMonths(months, chartData);
4635
4932
  }
4636
4933
  /**
4637
- * Get collection of loan bank accounts
4934
+ * set bar chart data
4638
4935
  */
4639
- getLoanAccounts() {
4640
- return new BankAccountCollection(this.getByType(TYPE_LOAN));
4641
- }
4642
- getSavingsAccounts() {
4643
- return new BankAccountCollection(this.getByType(TYPE_LOAN, true));
4644
- }
4645
- getOpeningBalance() {
4646
- return this.items.reduce((sum, bankAccount) => sum + bankAccount.getOpeningBalance(), 0);
4647
- }
4648
- get currentBalance() {
4649
- return this.sumBy('currentBalance');
4936
+ calculateCashInOutBarChartData() {
4937
+ const chartData = [{
4938
+ name: 'Cash In',
4939
+ data: []
4940
+ }, {
4941
+ name: 'Cash Out',
4942
+ data: []
4943
+ }];
4944
+ for (const key in MonthNameShortEnum) {
4945
+ if (MonthNameShortEnum.hasOwnProperty(key)) {
4946
+ const bankTransactionsForMonth = this.bankTransactions.filter((bankTransaction) => {
4947
+ return +bankTransaction.date.getMonth() === +MonthNumberEnum[key];
4948
+ });
4949
+ const cashInForMonth = bankTransactionsForMonth
4950
+ .filter((bankTransaction) => bankTransaction.isCredit())
4951
+ .reduce((sum, bankTransaction) => sum += bankTransaction.allocatedAmount, 0);
4952
+ const cashOutForMonth = bankTransactionsForMonth
4953
+ .filter((bankTransaction) => bankTransaction.isDebit())
4954
+ .reduce((sum, bankTransaction) => sum += bankTransaction.allocatedAmount, 0);
4955
+ chartData[0].data.push({
4956
+ label: MonthNameShortEnum[key],
4957
+ value: cashInForMonth
4958
+ });
4959
+ chartData[1].data.push({
4960
+ label: MonthNameShortEnum[key],
4961
+ value: cashOutForMonth
4962
+ });
4963
+ }
4964
+ }
4965
+ return chartData;
4650
4966
  }
4651
4967
  /**
4652
- * Get Collection of bank accounts with property tank type
4968
+ * set line chart data
4653
4969
  */
4654
- getPropertyBankAccounts() {
4655
- return new BankAccountCollection(this.items.filter((bankAccount) => bankAccount.isPropertyTank()));
4970
+ calculateBalanceLineChartData() {
4971
+ const chartData = [{
4972
+ name: 'Balance',
4973
+ data: []
4974
+ }];
4975
+ for (const key in MonthNameShortEnum) {
4976
+ if (MonthNameShortEnum.hasOwnProperty(key)) {
4977
+ const bankTransactionsForMonth = this.bankTransactions.filter((bankTransaction) => {
4978
+ return +bankTransaction.date.getMonth() === +MonthNumberEnum[key];
4979
+ });
4980
+ const balanceForMonth = bankTransactionsForMonth.reduce((sum, bankTransaction) => {
4981
+ if (bankTransaction.isCredit()) {
4982
+ return sum += bankTransaction.allocatedAmount;
4983
+ }
4984
+ else {
4985
+ return sum -= bankTransaction.allocatedAmount;
4986
+ }
4987
+ }, 0);
4988
+ chartData[0].data.push({
4989
+ label: MonthNameShortEnum[key],
4990
+ value: balanceForMonth
4991
+ });
4992
+ }
4993
+ }
4994
+ return chartData;
4656
4995
  }
4657
4996
  /**
4658
- * Get Collection of bank accounts with work tank type
4997
+ * filter chart data for passed months
4659
4998
  */
4660
- getWorkBankAccounts() {
4661
- return new BankAccountCollection(this.items.filter((bankAccount) => bankAccount.isWorkTank()));
4999
+ filterChartDataByMonths(months, chartData) {
5000
+ const monthsNames = months.map((month) => MonthNumberEnum[month]).map((key) => MonthNameShortEnum[key]);
5001
+ const filteredChartData = cloneDeep$1(chartData);
5002
+ filteredChartData.forEach((chartDataItem) => {
5003
+ chartDataItem.data = chartDataItem.data.filter((serie) => monthsNames.includes(serie.label));
5004
+ });
5005
+ return filteredChartData;
4662
5006
  }
4663
- /**
4664
- * Get Collection of bank accounts by tank type
4665
- */
4666
- getByTankType(tankType) {
4667
- return new BankAccountCollection(this.items.filter((bankAccount) => bankAccount.tankType === tankType));
5007
+ }
5008
+
5009
+ var BankTransactionSummaryFieldsEnum;
5010
+ (function (BankTransactionSummaryFieldsEnum) {
5011
+ BankTransactionSummaryFieldsEnum["AMOUNT"] = "amount";
5012
+ BankTransactionSummaryFieldsEnum["ALLOCATED_AMOUNT"] = "allocatedAmount";
5013
+ })(BankTransactionSummaryFieldsEnum || (BankTransactionSummaryFieldsEnum = {}));
5014
+
5015
+ class Document$1 extends AbstractModel {
5016
+ }
5017
+
5018
+ /**
5019
+ * Enum with document types which used to API url prefix
5020
+ */
5021
+ var DocumentApiUrlPrefixEnum;
5022
+ (function (DocumentApiUrlPrefixEnum) {
5023
+ DocumentApiUrlPrefixEnum["FOLDERS"] = "folders";
5024
+ DocumentApiUrlPrefixEnum["PROPERTIES"] = "properties";
5025
+ })(DocumentApiUrlPrefixEnum || (DocumentApiUrlPrefixEnum = {}));
5026
+
5027
+ class Document extends Document$1 {
5028
+ constructor() {
5029
+ super(...arguments);
5030
+ this.type = AssetTypeEnum.DOCUMENTS;
5031
+ this.entityType = AssetEntityTypeEnum.FOLDERS;
4668
5032
  }
4669
5033
  /**
4670
- * Get list of all bank account properties
5034
+ * Get folder as document parent entity
4671
5035
  */
4672
- getBankAccountPropertiesList() {
4673
- return flatten(this.items.map((bankAccount) => {
4674
- return bankAccount.bankAccountProperties;
4675
- }));
5036
+ getEntity() {
5037
+ return this.folder;
4676
5038
  }
4677
5039
  /**
4678
- * Get lis of unique properties from all bank accounts properties
5040
+ * Get API url prefix
4679
5041
  */
4680
- getProperties() {
4681
- return uniqBy(this.getBankAccountPropertiesList().map((bankAccountProperty) => {
4682
- return bankAccountProperty.property;
4683
- }), 'id');
4684
- }
4685
- getPropertyBalanceAmount(propertyId) {
4686
- return this.items.reduce((sum, bankAccount) => {
4687
- return sum + bankAccount.getPropertyBalanceAmount(propertyId);
4688
- }, 0);
5042
+ getApiUrlPrefix() {
5043
+ return DocumentApiUrlPrefixEnum.FOLDERS;
4689
5044
  }
4690
5045
  }
4691
5046
 
4692
- var UserEventTypeTypeEnum;
4693
- (function (UserEventTypeTypeEnum) {
4694
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["REGISTERED"] = 1000] = "REGISTERED";
4695
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["PASSWORD_RESET_REQUEST"] = 1001] = "PASSWORD_RESET_REQUEST";
4696
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["APP_FEATURES"] = 1010] = "APP_FEATURES";
4697
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["SUBSCRIBED"] = 2000] = "SUBSCRIBED";
4698
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["UNSUBSCRIBED"] = 2001] = "UNSUBSCRIBED";
4699
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["SUBSCRIPTION_UPDATE"] = 2004] = "SUBSCRIPTION_UPDATE";
4700
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["SUBSCRIPTION_TRIAL_UPDATE"] = 2005] = "SUBSCRIPTION_TRIAL_UPDATE";
4701
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["SUBSCRIPTION_PAYMENT_FAILED"] = 2006] = "SUBSCRIPTION_PAYMENT_FAILED";
4702
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE"] = 2010] = "CLIENT_INVITE";
4703
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE_TO_REGISTER"] = 2011] = "CLIENT_INVITE_TO_REGISTER";
4704
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_INVITE_ACCEPTED"] = 2012] = "FIRM_INVITE_ACCEPTED";
4705
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_INVITE_REJECTED"] = 2013] = "FIRM_INVITE_REJECTED";
4706
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_INVITE_REGISTERED"] = 2014] = "FIRM_INVITE_REGISTERED";
4707
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_INVITE"] = 2020] = "PROPERTY_SHARE_INVITE";
4708
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_INVITE_TO_REGISTER"] = 2021] = "PROPERTY_SHARE_INVITE_TO_REGISTER";
4709
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_INVITE_ACCEPTED"] = 2022] = "PROPERTY_SHARE_INVITE_ACCEPTED";
4710
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_INVITE_REJECTED"] = 2023] = "PROPERTY_SHARE_INVITE_REJECTED";
4711
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_INVITE_REGISTERED"] = 2024] = "PROPERTY_SHARE_INVITE_REGISTERED";
4712
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_CHANGE_REQUESTED"] = 2025] = "PROPERTY_SHARE_CHANGE_REQUESTED";
4713
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_CHANGE_ACCEPTED"] = 2026] = "PROPERTY_SHARE_CHANGE_ACCEPTED";
4714
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_CHANGE_REJECTED"] = 2027] = "PROPERTY_SHARE_CHANGE_REJECTED";
4715
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["OWNER_SUBSCRIBED"] = 2028] = "OWNER_SUBSCRIBED";
4716
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["OWNER_UNSUBSCRIBED"] = 2029] = "OWNER_UNSUBSCRIBED";
4717
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["BASIQ_NEW_ACCOUNTS"] = 2030] = "BASIQ_NEW_ACCOUNTS";
4718
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["BASIQ_FIRST_IMPORT_COMPLETE"] = 2031] = "BASIQ_FIRST_IMPORT_COMPLETE";
4719
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["BASIQ_AUTHORIZATION_FAIL"] = 2032] = "BASIQ_AUTHORIZATION_FAIL";
4720
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["TRANSACTION_ALLOCATE_REMINDER"] = 2033] = "TRANSACTION_ALLOCATE_REMINDER";
4721
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["REGISTRATION_INVITE"] = 2040] = "REGISTRATION_INVITE";
4722
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["REGISTRATION_INVITE_ACCEPTED"] = 2041] = "REGISTRATION_INVITE_ACCEPTED";
4723
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_EMAIL_CONFIRMED"] = 2050] = "CLIENT_EMAIL_CONFIRMED";
4724
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["TAX_REVIEW_REQUESTED"] = 2060] = "TAX_REVIEW_REQUESTED";
4725
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_INVITE_TO_REGISTER"] = 3000] = "FIRM_INVITE_TO_REGISTER";
4726
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_INVITE"] = 3001] = "FIRM_INVITE";
4727
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE_ACCEPTED"] = 3002] = "CLIENT_INVITE_ACCEPTED";
4728
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE_REJECTED"] = 3003] = "CLIENT_INVITE_REJECTED";
4729
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE_REGISTERED"] = 3004] = "CLIENT_INVITE_REGISTERED";
4730
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_NEW_CLIENT"] = 3005] = "FIRM_NEW_CLIENT";
4731
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_LOST_CLIENT"] = 3006] = "FIRM_LOST_CLIENT";
4732
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_INVITE"] = 3010] = "EMPLOYEE_INVITE";
4733
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_LOST_CLIENT"] = 3011] = "EMPLOYEE_LOST_CLIENT";
4734
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_NEW_CLIENT"] = 3012] = "EMPLOYEE_NEW_CLIENT";
4735
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_INVITE_ACCEPTED"] = 3013] = "EMPLOYEE_INVITE_ACCEPTED";
4736
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_EMAIL_CONFIRMED"] = 3020] = "EMPLOYEE_EMAIL_CONFIRMED";
4737
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["TAX_REVIEW_RECEIVED"] = 3030] = "TAX_REVIEW_RECEIVED";
4738
- })(UserEventTypeTypeEnum || (UserEventTypeTypeEnum = {}));
5047
+ class DocumentFolder$1 extends AbstractModel {
5048
+ }
4739
5049
 
4740
- /**
4741
- * any event happened in the app, which needs to be handled somehow (distributed to other part of the app)
4742
- */
4743
- class AppEvent {
4744
- constructor(type, payload) {
4745
- this.type = type;
4746
- this.payload = payload;
4747
- }
5050
+ class DocumentFolder extends DocumentFolder$1 {
4748
5051
  }
5052
+ __decorate([
5053
+ Type(() => Document)
5054
+ ], DocumentFolder.prototype, "documents", void 0);
4749
5055
 
4750
5056
  /**
4751
5057
  * BankConnection means user account at specific bank (usually each user has only one at the same bank)
@@ -4837,6 +5143,7 @@ class BasiqService extends RestService {
4837
5143
  */
4838
5144
  listenEvents() {
4839
5145
  this.listenNotifications();
5146
+ this.listenJobs();
4840
5147
  }
4841
5148
  /**
4842
5149
  * Create a new Bank connection based on Basiq job.
@@ -4848,6 +5155,7 @@ class BasiqService extends RestService {
4848
5155
  // Send login data to basiq API to create a basiq job
4849
5156
  return this.http.post(`${BasiqService.basiqApiUrl}/users/${userId}/connections`, loginData)
4850
5157
  .pipe(mergeMap((response) => {
5158
+ this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.BASIQ_JOB_CREATED, response.id));
4851
5159
  // Create bank connection based on basiq job
4852
5160
  return this.bankConnectionService.add(plainToClass(BankConnection, { basiqJob: { externalId: response.id } }));
4853
5161
  }), catchError((error) => {
@@ -4868,8 +5176,12 @@ class BasiqService extends RestService {
4868
5176
  // Send login data and connection id to basiq API to create a basiq job
4869
5177
  return this.http.post(`${BasiqService.basiqApiUrl}/users/${userId}/connections`, Object.assign(data, { id: connection.externalId }))
4870
5178
  .pipe(mergeMap((response) => {
5179
+ this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.BASIQ_JOB_CREATED, response.id));
4871
5180
  // Create bank connection based on basiq job
4872
- return this.bankConnectionService.add(plainToClass(BankConnection, { id: connection.id, basiqJob: { externalId: response.id } }));
5181
+ return this.bankConnectionService.add(plainToClass(BankConnection, {
5182
+ id: connection.id,
5183
+ basiqJob: { externalId: response.id }
5184
+ }));
4873
5185
  }), catchError((error) => {
4874
5186
  // Show error when user provided wrong login data
4875
5187
  if (error.status === 401) {
@@ -4892,6 +5204,34 @@ class BasiqService extends RestService {
4892
5204
  return bankAccounts.removeBy('accountId', savedAccounts.mapBy('accountId'));
4893
5205
  }));
4894
5206
  }
5207
+ /**
5208
+ * Get status of credentials verifying. Expected statuses: 'in-progress', 'failed' or 'success'
5209
+ * We send this request by interval until basiq return success or failed
5210
+ * @TODO Alex (TT-2431): check logic and try to remove subscribe, use pipes instead
5211
+ * @TODO Alex (TT-2431): implement some limit and handle (message or something) if basiq stuck
5212
+ * @TODO Alex (TT-2431): check logic and handle case when user cancelled loading
5213
+ */
5214
+ checkBankCredentials(jobId) {
5215
+ this.http.get(`${BasiqService.basiqApiUrl}/jobs/${jobId}`)
5216
+ .pipe(
5217
+ // unsubscribe after each request to avoid wrong requests (example: user cancelled too long login and login to another bank, then we will send 2 different requests)
5218
+ take(1),
5219
+ // get verify-credentials step from basiq job
5220
+ map((response) => plainToClass(BasiqJobResponse, response).getVerifyCredentialsStep()),
5221
+ // check credentials status again if not finished
5222
+ filter((step) => {
5223
+ if (!step.isInProgress()) {
5224
+ return true;
5225
+ }
5226
+ setTimeout(() => {
5227
+ this.checkBankCredentials(jobId);
5228
+ }, BasiqService.bankCredintialsCheckInterval);
5229
+ return false;
5230
+ }))
5231
+ .subscribe((step) => {
5232
+ this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.BASIQ_LOGIN_FINISHED, step.isSuccess()));
5233
+ });
5234
+ }
4895
5235
  /**
4896
5236
  * listen to notifications to update basiq accounts list
4897
5237
  */
@@ -4902,8 +5242,20 @@ class BasiqService extends RestService {
4902
5242
  }
4903
5243
  });
4904
5244
  }
5245
+ /**
5246
+ * Listen Basiq job created to check its verify credentials status
5247
+ */
5248
+ listenJobs() {
5249
+ this.eventDispatcherService.on(AppEventTypeEnum.BASIQ_JOB_CREATED).subscribe((jobId) => {
5250
+ this.checkBankCredentials(jobId);
5251
+ });
5252
+ }
4905
5253
  }
4906
5254
  BasiqService.basiqApiUrl = 'https://au-api.basiq.io';
5255
+ /**
5256
+ * Basiq does not provide a hook, so we have to check job status manually every x seconds
5257
+ */
5258
+ BasiqService.bankCredintialsCheckInterval = 3000;
4907
5259
  BasiqService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BasiqService, deps: [{ token: i1.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }, { token: ToastService }, { token: BankConnectionService }], target: i0.ɵɵFactoryTarget.Injectable });
4908
5260
  BasiqService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BasiqService, providedIn: 'root' });
4909
5261
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BasiqService, decorators: [{
@@ -4916,19 +5268,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
4916
5268
  args: ['environment']
4917
5269
  }] }, { type: ToastService }, { type: BankConnectionService }]; } });
4918
5270
 
4919
- /**
4920
- * access token, needed to access basiq connect ui (https://github.com/basiqio/basiq-connect-ui)
4921
- */
4922
- class BasiqToken {
4923
- constructor(value, expiresAt) {
4924
- this.value = value;
4925
- this.expiresAt = expiresAt;
4926
- }
4927
- isExpired() {
4928
- return this.expiresAt < new Date();
4929
- }
4930
- }
4931
-
4932
5271
  class BasiqTokenService {
4933
5272
  constructor(http, environment) {
4934
5273
  this.http = http;
@@ -5170,6 +5509,12 @@ class UserService {
5170
5509
  * Create basiq (if not exist yet) to provide access to basiq api
5171
5510
  */
5172
5511
  createBasiq() {
5512
+ var _a;
5513
+ // no need to create basiqId if already exist
5514
+ // @TODO Alex (TT-2431): move this check to component or separated method
5515
+ if ((_a = this.cache) === null || _a === void 0 ? void 0 : _a.basiqId) {
5516
+ return of(this.cache.basiqId);
5517
+ }
5173
5518
  return this.http.post(`${this.environment.apiV2}/basiq/user`, {})
5174
5519
  .pipe(map((basiqId) => {
5175
5520
  this.cache = plainToClass(User, Object.assign(this.cache, { basiqId }));
@@ -5303,83 +5648,42 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
5303
5648
  provide: HTTP_INTERCEPTORS,
5304
5649
  useClass: BasiqClientIdInterceptor,
5305
5650
  multi: true
5306
- }
5307
- ]
5308
- }]
5309
- }] });
5310
-
5311
- class TtCoreModule {
5312
- static forRoot(environment) {
5313
- localStorage.setItem('api_uri', environment['api_uri']);
5314
- return {
5315
- ngModule: TtCoreModule,
5316
- providers: [
5317
- {
5318
- provide: 'environment',
5319
- useValue: environment
5320
- }
5321
- ]
5322
- };
5323
- }
5324
- }
5325
- TtCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TtCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
5326
- TtCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TtCoreModule, imports: [CommonModule,
5327
- InterceptorsModule] });
5328
- TtCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TtCoreModule, imports: [[
5329
- CommonModule,
5330
- InterceptorsModule
5331
- ]] });
5332
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TtCoreModule, decorators: [{
5333
- type: NgModule,
5334
- args: [{
5335
- declarations: [],
5336
- imports: [
5337
- CommonModule,
5338
- InterceptorsModule
5339
- ]
5340
- }]
5341
- }] });
5342
-
5343
- class Document$1 extends AbstractModel {
5344
- }
5345
-
5346
- /**
5347
- * Enum with document types which used to API url prefix
5348
- */
5349
- var DocumentApiUrlPrefixEnum;
5350
- (function (DocumentApiUrlPrefixEnum) {
5351
- DocumentApiUrlPrefixEnum["FOLDERS"] = "folders";
5352
- DocumentApiUrlPrefixEnum["PROPERTIES"] = "properties";
5353
- })(DocumentApiUrlPrefixEnum || (DocumentApiUrlPrefixEnum = {}));
5354
-
5355
- class Document extends Document$1 {
5356
- constructor() {
5357
- super(...arguments);
5358
- this.type = AssetTypeEnum.DOCUMENTS;
5359
- this.entityType = AssetEntityTypeEnum.FOLDERS;
5360
- }
5361
- /**
5362
- * Get folder as document parent entity
5363
- */
5364
- getEntity() {
5365
- return this.folder;
5366
- }
5367
- /**
5368
- * Get API url prefix
5369
- */
5370
- getApiUrlPrefix() {
5371
- return DocumentApiUrlPrefixEnum.FOLDERS;
5372
- }
5373
- }
5374
-
5375
- class DocumentFolder$1 extends AbstractModel {
5376
- }
5651
+ }
5652
+ ]
5653
+ }]
5654
+ }] });
5377
5655
 
5378
- class DocumentFolder extends DocumentFolder$1 {
5656
+ class TtCoreModule {
5657
+ static forRoot(environment) {
5658
+ localStorage.setItem('api_uri', environment['api_uri']);
5659
+ return {
5660
+ ngModule: TtCoreModule,
5661
+ providers: [
5662
+ {
5663
+ provide: 'environment',
5664
+ useValue: environment
5665
+ }
5666
+ ]
5667
+ };
5668
+ }
5379
5669
  }
5380
- __decorate([
5381
- Type(() => Document)
5382
- ], DocumentFolder.prototype, "documents", void 0);
5670
+ TtCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TtCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
5671
+ TtCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TtCoreModule, imports: [CommonModule,
5672
+ InterceptorsModule] });
5673
+ TtCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TtCoreModule, imports: [[
5674
+ CommonModule,
5675
+ InterceptorsModule
5676
+ ]] });
5677
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TtCoreModule, decorators: [{
5678
+ type: NgModule,
5679
+ args: [{
5680
+ declarations: [],
5681
+ imports: [
5682
+ CommonModule,
5683
+ InterceptorsModule
5684
+ ]
5685
+ }]
5686
+ }] });
5383
5687
 
5384
5688
  class VehicleClaimCollection extends Collection {
5385
5689
  /**
@@ -7475,239 +7779,23 @@ class AccountSetupItem extends AbstractModel {
7475
7779
  }
7476
7780
  }
7477
7781
 
7478
- var BadgeColorEnum;
7479
- (function (BadgeColorEnum) {
7480
- BadgeColorEnum["DEFAULT"] = "default";
7481
- BadgeColorEnum["GREEN"] = "green";
7482
- BadgeColorEnum["GOLD"] = "gold";
7483
- BadgeColorEnum["GRAY"] = "gray";
7484
- })(BadgeColorEnum || (BadgeColorEnum = {}));
7485
-
7486
- /**
7487
- * Class for UI element badge
7488
- */
7489
- class Badge extends AbstractModel {
7490
- constructor(text, color) {
7491
- super();
7492
- this.text = '';
7493
- this.text = text;
7494
- this.color = color || BadgeColorEnum.DEFAULT;
7495
- }
7496
- }
7497
-
7498
- /**
7499
- * bank account collection UI class with frontend specific data
7500
- */
7501
- class BankAccountChartData {
7502
- constructor(bankAccounts) {
7503
- this.bankAccounts = bankAccounts;
7504
- }
7505
- /**
7506
- * set value of pie chart data
7507
- */
7508
- getBalancePieChartData() {
7509
- return this.bankAccounts.map((bankAccount) => {
7510
- return {
7511
- name: bankAccount.accountName,
7512
- data: Math.abs(bankAccount.currentBalance)
7513
- };
7514
- });
7515
- }
7516
- /**
7517
- * set value of bar chart data
7518
- */
7519
- getBalanceBarChartData() {
7520
- return [{
7521
- name: 'Balance',
7522
- data: this.bankAccounts.map((bankAccount) => {
7523
- return {
7524
- label: bankAccount.accountName,
7525
- value: bankAccount.currentBalance
7526
- };
7527
- })
7528
- }];
7529
- }
7530
- }
7531
-
7532
- /**
7533
- * Const which contains array of bank account types
7534
- */
7535
- const BANK_ACCOUNT_TYPES = [
7536
- { key: BankAccountTypeEnum.CREDIT_CARD, value: 'Credit Card Accounts' },
7537
- { key: BankAccountTypeEnum.TERM_DEPOSIT, value: 'Deposit Accounts' },
7538
- { key: BankAccountTypeEnum.INVESTMENT, value: 'Investment Accounts' },
7539
- { key: BankAccountTypeEnum.LOAN, value: 'Loan Accounts' },
7540
- { key: BankAccountTypeEnum.OFFSET, value: 'Offset' },
7541
- { key: BankAccountTypeEnum.SAVINGS, value: 'Savings Accounts' },
7542
- { key: BankAccountTypeEnum.TRANSACTION, value: 'Transaction Accounts' },
7543
- ];
7544
-
7545
- /**
7546
- * Login data object for basiq banks
7547
- */
7548
- class BankLoginData {
7549
- }
7550
-
7551
- /**
7552
- * enum with months indexes.
7553
- * item value match with js Date month index from 0 to 11
7554
- * Order of items match with financial year months order
7555
- */
7556
- var MonthNumberEnum;
7557
- (function (MonthNumberEnum) {
7558
- MonthNumberEnum[MonthNumberEnum["JULY"] = 6] = "JULY";
7559
- MonthNumberEnum[MonthNumberEnum["AUGUST"] = 7] = "AUGUST";
7560
- MonthNumberEnum[MonthNumberEnum["SEPTEMBER"] = 8] = "SEPTEMBER";
7561
- MonthNumberEnum[MonthNumberEnum["OCTOBER"] = 9] = "OCTOBER";
7562
- MonthNumberEnum[MonthNumberEnum["NOVEMBER"] = 10] = "NOVEMBER";
7563
- MonthNumberEnum[MonthNumberEnum["DECEMBER"] = 11] = "DECEMBER";
7564
- MonthNumberEnum[MonthNumberEnum["JANUARY"] = 0] = "JANUARY";
7565
- MonthNumberEnum[MonthNumberEnum["FEBRUARY"] = 1] = "FEBRUARY";
7566
- MonthNumberEnum[MonthNumberEnum["MARCH"] = 2] = "MARCH";
7567
- MonthNumberEnum[MonthNumberEnum["APRIL"] = 3] = "APRIL";
7568
- MonthNumberEnum[MonthNumberEnum["MAY"] = 4] = "MAY";
7569
- MonthNumberEnum[MonthNumberEnum["JUNE"] = 5] = "JUNE";
7570
- })(MonthNumberEnum || (MonthNumberEnum = {}));
7571
-
7572
- /**
7573
- * @TODO move to pipe/translation
7574
- * enum with months short names.
7575
- * Order of items match with financial year months order
7576
- */
7577
- var MonthNameShortEnum;
7578
- (function (MonthNameShortEnum) {
7579
- MonthNameShortEnum["JULY"] = "Jul";
7580
- MonthNameShortEnum["AUGUST"] = "Aug";
7581
- MonthNameShortEnum["SEPTEMBER"] = "Sep";
7582
- MonthNameShortEnum["OCTOBER"] = "Oct";
7583
- MonthNameShortEnum["NOVEMBER"] = "Nov";
7584
- MonthNameShortEnum["DECEMBER"] = "Dec";
7585
- MonthNameShortEnum["JANUARY"] = "Jan";
7586
- MonthNameShortEnum["FEBRUARY"] = "Feb";
7587
- MonthNameShortEnum["MARCH"] = "Mar";
7588
- MonthNameShortEnum["APRIL"] = "Apr";
7589
- MonthNameShortEnum["MAY"] = "May";
7590
- MonthNameShortEnum["JUNE"] = "Jun";
7591
- })(MonthNameShortEnum || (MonthNameShortEnum = {}));
7592
-
7593
- /**
7594
- * bank transactions collection UI class with frontend specific data
7595
- */
7596
- class BankTransactionChartData {
7597
- constructor(bankTransactions) {
7598
- this.bankTransactions = bankTransactions;
7599
- }
7600
- /**
7601
- * get value of bar chart data
7602
- */
7603
- getCashInOutBarChartData(months) {
7604
- const chartData = this.calculateCashInOutBarChartData();
7605
- if (!months) {
7606
- return chartData;
7607
- }
7608
- return this.filterChartDataByMonths(months, chartData);
7609
- }
7610
- /**
7611
- * get value of line chart data
7612
- */
7613
- getBalanceLineChartData(months) {
7614
- const chartData = this.calculateBalanceLineChartData();
7615
- if (!months) {
7616
- return chartData;
7617
- }
7618
- return this.filterChartDataByMonths(months, chartData);
7619
- }
7620
- /**
7621
- * set bar chart data
7622
- */
7623
- calculateCashInOutBarChartData() {
7624
- const chartData = [{
7625
- name: 'Cash In',
7626
- data: []
7627
- }, {
7628
- name: 'Cash Out',
7629
- data: []
7630
- }];
7631
- for (const key in MonthNameShortEnum) {
7632
- if (MonthNameShortEnum.hasOwnProperty(key)) {
7633
- const bankTransactionsForMonth = this.bankTransactions.filter((bankTransaction) => {
7634
- return +bankTransaction.date.getMonth() === +MonthNumberEnum[key];
7635
- });
7636
- const cashInForMonth = bankTransactionsForMonth
7637
- .filter((bankTransaction) => bankTransaction.isCredit())
7638
- .reduce((sum, bankTransaction) => sum += bankTransaction.allocatedAmount, 0);
7639
- const cashOutForMonth = bankTransactionsForMonth
7640
- .filter((bankTransaction) => bankTransaction.isDebit())
7641
- .reduce((sum, bankTransaction) => sum += bankTransaction.allocatedAmount, 0);
7642
- chartData[0].data.push({
7643
- label: MonthNameShortEnum[key],
7644
- value: cashInForMonth
7645
- });
7646
- chartData[1].data.push({
7647
- label: MonthNameShortEnum[key],
7648
- value: cashOutForMonth
7649
- });
7650
- }
7651
- }
7652
- return chartData;
7653
- }
7654
- /**
7655
- * set line chart data
7656
- */
7657
- calculateBalanceLineChartData() {
7658
- const chartData = [{
7659
- name: 'Balance',
7660
- data: []
7661
- }];
7662
- for (const key in MonthNameShortEnum) {
7663
- if (MonthNameShortEnum.hasOwnProperty(key)) {
7664
- const bankTransactionsForMonth = this.bankTransactions.filter((bankTransaction) => {
7665
- return +bankTransaction.date.getMonth() === +MonthNumberEnum[key];
7666
- });
7667
- const balanceForMonth = bankTransactionsForMonth.reduce((sum, bankTransaction) => {
7668
- if (bankTransaction.isCredit()) {
7669
- return sum += bankTransaction.allocatedAmount;
7670
- }
7671
- else {
7672
- return sum -= bankTransaction.allocatedAmount;
7673
- }
7674
- }, 0);
7675
- chartData[0].data.push({
7676
- label: MonthNameShortEnum[key],
7677
- value: balanceForMonth
7678
- });
7679
- }
7680
- }
7681
- return chartData;
7682
- }
7683
- /**
7684
- * filter chart data for passed months
7685
- */
7686
- filterChartDataByMonths(months, chartData) {
7687
- const monthsNames = months.map((month) => MonthNumberEnum[month]).map((key) => MonthNameShortEnum[key]);
7688
- const filteredChartData = cloneDeep$1(chartData);
7689
- filteredChartData.forEach((chartDataItem) => {
7690
- chartDataItem.data = chartDataItem.data.filter((serie) => monthsNames.includes(serie.label));
7691
- });
7692
- return filteredChartData;
7693
- }
7694
- }
7695
-
7696
- var BankTransactionSummaryFieldsEnum;
7697
- (function (BankTransactionSummaryFieldsEnum) {
7698
- BankTransactionSummaryFieldsEnum["AMOUNT"] = "amount";
7699
- BankTransactionSummaryFieldsEnum["ALLOCATED_AMOUNT"] = "allocatedAmount";
7700
- })(BankTransactionSummaryFieldsEnum || (BankTransactionSummaryFieldsEnum = {}));
7782
+ var BadgeColorEnum;
7783
+ (function (BadgeColorEnum) {
7784
+ BadgeColorEnum["DEFAULT"] = "default";
7785
+ BadgeColorEnum["GREEN"] = "green";
7786
+ BadgeColorEnum["GOLD"] = "gold";
7787
+ BadgeColorEnum["GRAY"] = "gray";
7788
+ })(BadgeColorEnum || (BadgeColorEnum = {}));
7701
7789
 
7702
7790
  /**
7703
- * Class describe configuration options for basiq connect control
7704
- * https://www.npmjs.com/package/@basiq/basiq-connect-control
7791
+ * Class for UI element badge
7705
7792
  */
7706
- class BasiqConfig {
7707
- constructor(options) {
7708
- // ID of the DOM element to which Basiq Connect Control will be rendered;
7709
- this.containerId = 'basiq-control';
7710
- Object.assign(this, options);
7793
+ class Badge extends AbstractModel {
7794
+ constructor(text, color) {
7795
+ super();
7796
+ this.text = '';
7797
+ this.text = text;
7798
+ this.color = color || BadgeColorEnum.DEFAULT;
7711
7799
  }
7712
7800
  }
7713
7801
 
@@ -14665,87 +14753,6 @@ class AbstractForm extends FormGroup {
14665
14753
  }
14666
14754
  }
14667
14755
 
14668
- /**
14669
- * Form with loan details.
14670
- * Loan could be created from bank account (Bank Loan) or directly from loan page (Vehicle Loan)
14671
- */
14672
- class LoanForm extends AbstractForm {
14673
- constructor(loan = plainToClass(Loan, {})) {
14674
- super({
14675
- type: new FormControl(loan.type, Validators.required),
14676
- amount: new FormControl(loan.amount, Validators.required),
14677
- interestRate: new FormControl(loan.interestRate, [Validators.required, Validators.min(0), Validators.max(100)]),
14678
- commencementDate: new FormControl(loan.commencementDate, Validators.required),
14679
- repaymentAmount: new FormControl(loan.repaymentAmount, Validators.required),
14680
- repaymentFrequency: new FormControl(loan.repaymentFrequency, Validators.required),
14681
- term: new FormControl(loan.term, Validators.required),
14682
- // interestType is predefined for vehicle loans
14683
- interestType: new FormControl({ value: loan.interestType, disabled: !loan.bankAccount }, Validators.required),
14684
- // availableRedraw is predefined for vehicle loans
14685
- availableRedraw: new FormControl({ value: loan.availableRedraw, disabled: !loan.bankAccount }, Validators.required),
14686
- // repaymentType is predefined for vehicle loans
14687
- repaymentType: new FormControl({ value: loan.repaymentType, disabled: !loan.bankAccount }, Validators.required),
14688
- }, loan);
14689
- this.loan = loan;
14690
- // Set data which always the same for vehicle loans
14691
- if (!loan.bankAccount) {
14692
- Object.assign(this.model, {
14693
- repaymentType: LoanRepaymentTypeEnum.PRINCIPAL_AND_INTEREST,
14694
- availableRedraw: 0,
14695
- interestType: LoanInterestTypeEnum.FIXED_RATE
14696
- });
14697
- }
14698
- this.updateTermValidation();
14699
- this.listenEvents();
14700
- }
14701
- listenEvents() {
14702
- // We need to set term automatically only for bank loans.
14703
- // For vehicle loans user should fill it manually with validation depended of frequency
14704
- if (!!this.loan.bankAccount) {
14705
- this.listenTypeChanges();
14706
- }
14707
- else {
14708
- this.listenRepaymentFrequencyChanges();
14709
- }
14710
- }
14711
- /**
14712
- * Set term automatically by loan type changes
14713
- */
14714
- listenTypeChanges() {
14715
- this.get('type').valueChanges.subscribe((type) => {
14716
- this.get('term').setValue(LoanForm.mortgageLoanTypes.includes(type) ? Loan.mortgageDefaultTerm : Loan.loanDefaultTerm);
14717
- });
14718
- }
14719
- /**
14720
- * term validation depends on selected repaymentFrequency
14721
- */
14722
- listenRepaymentFrequencyChanges() {
14723
- this.get('repaymentFrequency').valueChanges.subscribe(() => {
14724
- this.updateTermValidation();
14725
- });
14726
- }
14727
- /**
14728
- * For vehicle loans term has a maximum value depended of repayment frequency
14729
- */
14730
- updateTermValidation() {
14731
- // no need terms for bank loans
14732
- if (!!this.loan.bankAccount) {
14733
- return;
14734
- }
14735
- const currentRepaymentFrequency = this.get('repaymentFrequency').value;
14736
- // term validation depends on selected repayment frequency, so can not validate when frequency is empty
14737
- // repaymentType is required field, so we don't need to clear validation
14738
- if (!currentRepaymentFrequency) {
14739
- return;
14740
- }
14741
- const termControl = this.get('term');
14742
- const maxTermValue = LoanMaxNumberOfPaymentsEnum[LoanRepaymentFrequencyEnum[currentRepaymentFrequency]];
14743
- termControl.setValidators([Validators.max(maxTermValue)]);
14744
- termControl.updateValueAndValidity();
14745
- }
14746
- }
14747
- LoanForm.mortgageLoanTypes = [LoanTypeEnum.MORTGAGE, LoanTypeEnum.HOME_EQUITY_LINE_OF_CREDIT, LoanTypeEnum.HOME_LOAN];
14748
-
14749
14756
  /**
14750
14757
  * Check if at least one form field is true, otherwise form is invalid.
14751
14758
  * Use with groups of boolean form controls (checkbox, toggle, etc.)
@@ -14876,6 +14883,242 @@ function fieldsSumValidator(field, summary = 100, fieldAlias) {
14876
14883
  };
14877
14884
  }
14878
14885
 
14886
+ /**
14887
+ * Validator for address, check if corelogic suggestion selected correctly
14888
+ */
14889
+ function addressCorelogicValidator() {
14890
+ return (form) => {
14891
+ if (form.isCorelogicRequired) {
14892
+ if (form.get('corelogicLocId').hasError('required')) {
14893
+ return { address: 'Street, city, state or postal code not specified' };
14894
+ }
14895
+ if (form.get('corelogicRefId').hasError('required')) {
14896
+ return { address: 'Unit/House number not specified' };
14897
+ }
14898
+ }
14899
+ return null;
14900
+ };
14901
+ }
14902
+
14903
+ /**
14904
+ * Address form. Works with corelogic or manual address
14905
+ */
14906
+ class AddressForm extends AbstractForm {
14907
+ /**
14908
+ * @param address instance which should be created/edited
14909
+ * @param isCorelogicRequired for example, for property we need corelogic location even for manual address,
14910
+ * so we have to search corelogic location based on manual fields values
14911
+ */
14912
+ constructor(address = plainToClass(Address, {}), isCorelogicRequired = false) {
14913
+ super({
14914
+ // prefill search input with address string for edit case
14915
+ searchQuery: new FormControl(address.address ? address.nameLong : null, Validators.required),
14916
+ type: new FormControl(address.type | AddressTypeEnum.STREET, Validators.required),
14917
+ // Corelogic fields
14918
+ corelogicLocId: new FormControl(address.corelogicLocId, conditionalValidator(() => isCorelogicRequired, Validators.required)),
14919
+ corelogicRefId: new FormControl(address.corelogicRefId, conditionalValidator(() => isCorelogicRequired, Validators.required)),
14920
+ // manual fields
14921
+ unitNumber: new FormControl({ value: address.unitNumber, disabled: true }),
14922
+ address: new FormControl({ value: address.address, disabled: true }, Validators.required),
14923
+ city: new FormControl({ value: address.city, disabled: true }, Validators.required),
14924
+ state: new FormControl({ value: address.state, disabled: true }, Validators.required),
14925
+ postcode: new FormControl({ value: address.postcode, disabled: true }, Validators.required),
14926
+ country: new FormControl({ value: address.country || Country.australia, disabled: true }, conditionalValidator(() => !isCorelogicRequired, Validators.required))
14927
+ }, address, addressCorelogicValidator());
14928
+ this.isCorelogicRequired = isCorelogicRequired;
14929
+ /**
14930
+ * Emit event to search address in corelogic when user filled enough data for corelogic
14931
+ */
14932
+ this.onSearch = new EventEmitter();
14933
+ this.listenEvents();
14934
+ }
14935
+ /**
14936
+ * Get search query for corelogic location search based on manual fields values
14937
+ */
14938
+ get manualSearchQuery() {
14939
+ if (!this.isManualSearchAvailable()) {
14940
+ return '';
14941
+ }
14942
+ return this.currentValue.nameLong;
14943
+ }
14944
+ listenEvents() {
14945
+ this.listenSearchQueryChanges();
14946
+ // no need to search corelogic locality when corelogic is not required
14947
+ if (this.isCorelogicRequired) {
14948
+ this.listenManualFieldsChanges();
14949
+ }
14950
+ }
14951
+ /**
14952
+ * Handle corelogic suggestion select
14953
+ */
14954
+ onSelectSuggestion(suggestion) {
14955
+ // if no suggestion then 'Add manually' option selected
14956
+ if (!suggestion) {
14957
+ this.switchToManual();
14958
+ return;
14959
+ }
14960
+ this.patchValue({
14961
+ corelogicLocId: suggestion.localityId,
14962
+ corelogicRefId: suggestion.propertyId
14963
+ });
14964
+ }
14965
+ /**
14966
+ * Enable manual mode
14967
+ */
14968
+ switchToManual() {
14969
+ this.isManual = true;
14970
+ this.get('searchQuery').disable();
14971
+ this.get('address').enable();
14972
+ this.get('unitNumber').enable();
14973
+ this.get('city').enable();
14974
+ this.get('state').enable();
14975
+ this.get('postcode').enable();
14976
+ if (!this.isCorelogicRequired) {
14977
+ this.get('country').enable();
14978
+ this.get('corelogicLocId').disable();
14979
+ this.get('corelogicRefId').disable();
14980
+ }
14981
+ }
14982
+ /**
14983
+ * Emit event to search address in corelogic when search field changes
14984
+ */
14985
+ listenSearchQueryChanges() {
14986
+ this.get('searchQuery').valueChanges
14987
+ .pipe(
14988
+ // delay to avoid search request for each value change
14989
+ debounceTime(AddressForm.searchDelay),
14990
+ // skip when value not changed
14991
+ distinctUntilChanged(),
14992
+ // value could be a string when user search and suggestion when user select option from autocomplete
14993
+ map((value) => {
14994
+ // no need to search when value is not actually search string
14995
+ if (!value || value instanceof CorelogicSuggestion) {
14996
+ return '';
14997
+ }
14998
+ // trim to avoid spaces in searchQuery, we should not send request started or finished with spaces
14999
+ // uppercase to make search string similar to corelogic format
15000
+ return value.trim();
15001
+ }),
15002
+ // do nothing when query is too short
15003
+ filter((searchQuery) => searchQuery.length >= AddressForm.minSearchLength))
15004
+ .subscribe((searchQuery) => {
15005
+ this.onSearch.emit(searchQuery);
15006
+ });
15007
+ }
15008
+ /**
15009
+ * Check if all fields required for manual corelogic search are filled before request sending
15010
+ */
15011
+ isManualSearchAvailable() {
15012
+ return this.get('address').valid && this.get('city').valid && this.get('state').valid && this.get('postcode').valid;
15013
+ }
15014
+ /**
15015
+ * When corelogic is required we have to search address even for manual address
15016
+ */
15017
+ listenManualFieldsChanges() {
15018
+ // subscribe to whole form because no other fields may be changed in this case except manual address fields we need
15019
+ this.valueChanges
15020
+ .pipe(
15021
+ // delay to avoid search request for each value change
15022
+ debounceTime(AddressForm.searchDelay),
15023
+ // do nothing when not all required fields filled
15024
+ filter(() => this.isManualSearchAvailable()), map(() => this.manualSearchQuery),
15025
+ // skip when value not changed
15026
+ distinctUntilChanged())
15027
+ .subscribe(() => {
15028
+ this.onSearch.emit(this.manualSearchQuery);
15029
+ });
15030
+ }
15031
+ }
15032
+ /**
15033
+ * Min search query required length
15034
+ */
15035
+ AddressForm.minSearchLength = 3;
15036
+ /**
15037
+ * Delay before corelogic request
15038
+ */
15039
+ AddressForm.searchDelay = 500;
15040
+
15041
+ /**
15042
+ * Form with loan details.
15043
+ * Loan could be created from bank account (Bank Loan) or directly from loan page (Vehicle Loan)
15044
+ */
15045
+ class LoanForm extends AbstractForm {
15046
+ constructor(loan = plainToClass(Loan, {})) {
15047
+ super({
15048
+ type: new FormControl(loan.type, Validators.required),
15049
+ amount: new FormControl(loan.amount, Validators.required),
15050
+ interestRate: new FormControl(loan.interestRate, [Validators.required, Validators.min(0), Validators.max(100)]),
15051
+ commencementDate: new FormControl(loan.commencementDate, Validators.required),
15052
+ repaymentAmount: new FormControl(loan.repaymentAmount, Validators.required),
15053
+ repaymentFrequency: new FormControl(loan.repaymentFrequency, Validators.required),
15054
+ term: new FormControl(loan.term, Validators.required),
15055
+ // interestType is predefined for vehicle loans
15056
+ interestType: new FormControl({ value: loan.interestType, disabled: !loan.bankAccount }, Validators.required),
15057
+ // availableRedraw is predefined for vehicle loans
15058
+ availableRedraw: new FormControl({ value: loan.availableRedraw, disabled: !loan.bankAccount }, Validators.required),
15059
+ // repaymentType is predefined for vehicle loans
15060
+ repaymentType: new FormControl({ value: loan.repaymentType, disabled: !loan.bankAccount }, Validators.required),
15061
+ }, loan);
15062
+ this.loan = loan;
15063
+ // Set data which always the same for vehicle loans
15064
+ if (!loan.bankAccount) {
15065
+ Object.assign(this.model, {
15066
+ repaymentType: LoanRepaymentTypeEnum.PRINCIPAL_AND_INTEREST,
15067
+ availableRedraw: 0,
15068
+ interestType: LoanInterestTypeEnum.FIXED_RATE
15069
+ });
15070
+ }
15071
+ this.updateTermValidation();
15072
+ this.listenEvents();
15073
+ }
15074
+ listenEvents() {
15075
+ // We need to set term automatically only for bank loans.
15076
+ // For vehicle loans user should fill it manually with validation depended of frequency
15077
+ if (!!this.loan.bankAccount) {
15078
+ this.listenTypeChanges();
15079
+ }
15080
+ else {
15081
+ this.listenRepaymentFrequencyChanges();
15082
+ }
15083
+ }
15084
+ /**
15085
+ * Set term automatically by loan type changes
15086
+ */
15087
+ listenTypeChanges() {
15088
+ this.get('type').valueChanges.subscribe((type) => {
15089
+ this.get('term').setValue(LoanForm.mortgageLoanTypes.includes(type) ? Loan.mortgageDefaultTerm : Loan.loanDefaultTerm);
15090
+ });
15091
+ }
15092
+ /**
15093
+ * term validation depends on selected repaymentFrequency
15094
+ */
15095
+ listenRepaymentFrequencyChanges() {
15096
+ this.get('repaymentFrequency').valueChanges.subscribe(() => {
15097
+ this.updateTermValidation();
15098
+ });
15099
+ }
15100
+ /**
15101
+ * For vehicle loans term has a maximum value depended of repayment frequency
15102
+ */
15103
+ updateTermValidation() {
15104
+ // no need terms for bank loans
15105
+ if (!!this.loan.bankAccount) {
15106
+ return;
15107
+ }
15108
+ const currentRepaymentFrequency = this.get('repaymentFrequency').value;
15109
+ // term validation depends on selected repayment frequency, so can not validate when frequency is empty
15110
+ // repaymentType is required field, so we don't need to clear validation
15111
+ if (!currentRepaymentFrequency) {
15112
+ return;
15113
+ }
15114
+ const termControl = this.get('term');
15115
+ const maxTermValue = LoanMaxNumberOfPaymentsEnum[LoanRepaymentFrequencyEnum[currentRepaymentFrequency]];
15116
+ termControl.setValidators([Validators.max(maxTermValue)]);
15117
+ termControl.updateValueAndValidity();
15118
+ }
15119
+ }
15120
+ LoanForm.mortgageLoanTypes = [LoanTypeEnum.MORTGAGE, LoanTypeEnum.HOME_EQUITY_LINE_OF_CREDIT, LoanTypeEnum.HOME_LOAN];
15121
+
14879
15122
  /**
14880
15123
  * Form array with bank account properties
14881
15124
  * @TODO create AbstractFormArray
@@ -15083,6 +15326,27 @@ class SoleBusinessLossForm extends AbstractForm {
15083
15326
  }
15084
15327
  }
15085
15328
 
15329
+ const phonePattern = /^(((\s*)?([- ()]?\d[- ()]?){0,30}(\s*)?)|)$/;
15330
+ /**
15331
+ * Validator for phone number
15332
+ * Allowed special symbols"-", "(", ")"
15333
+ */
15334
+ function phoneNumberValidator() {
15335
+ return (control) => {
15336
+ return phonePattern.test(control.value) ? null : { phoneInvalid: true };
15337
+ };
15338
+ }
15339
+
15340
+ class PhoneForm extends AbstractForm {
15341
+ constructor(phone = plainToClass(Phone, {})) {
15342
+ super({
15343
+ type: new FormControl(phone.type, Validators.required),
15344
+ country: new FormControl(phone.country, Validators.required),
15345
+ number: new FormControl(phone.number, [Validators.required, phoneNumberValidator()])
15346
+ }, phone);
15347
+ }
15348
+ }
15349
+
15086
15350
  class SoleContactForm extends AbstractForm {
15087
15351
  constructor(contact = plainToClass(SoleContact, {})) {
15088
15352
  super({
@@ -15091,10 +15355,8 @@ class SoleContactForm extends AbstractForm {
15091
15355
  firstName: new FormControl(contact.firstName, Validators.required),
15092
15356
  lastName: new FormControl(contact.lastName, Validators.required),
15093
15357
  email: new FormControl(contact.email, [Validators.required, Validators.email]),
15094
- // @TODO Alex: create phone form and phone form control
15095
- phone: new FormControl(contact.phone),
15096
- // @TODO Alex: create address form and address form control
15097
- address: new FormControl(contact.address)
15358
+ phone: new PhoneForm(contact.phone || plainToClass(Phone, {})),
15359
+ address: new AddressForm(contact.address || plainToClass(Address, {}))
15098
15360
  }, contact);
15099
15361
  }
15100
15362
  }
@@ -16219,5 +16481,5 @@ VehicleLogbookForm.maxDescriptionLength = 60;
16219
16481
  * Generated bundle index. Do not edit.
16220
16482
  */
16221
16483
 
16222
- export { AbstractForm, AbstractModel, AccountSetupItem, AccountSetupItemCollection, AccountSetupService, Address, AddressService, AddressTypeEnum, AlphabetColorsEnum, AppEvent, AppEventTypeEnum, AssetEntityTypeEnum, AssetTypeEnum, AssetsService, AuthService, BANK_ACCOUNT_TYPES, Badge, BadgeColorEnum, Bank, BankAccount, BankAccountAddManualForm, BankAccountAllocationForm, BankAccountCalculationService, BankAccountChartData, BankAccountCollection, BankAccountImportForm, BankAccountPropertiesForm, BankAccountProperty, BankAccountService, BankAccountStatusEnum, BankAccountTypeEnum, BankAccountsImportForm, BankConnection, BankConnectionService, BankConnectionStatusEnum, BankLoginData, BankLoginForm, BankService, BankTransaction, BankTransactionCalculationService, BankTransactionChartData, BankTransactionCollection, BankTransactionService, BankTransactionSummaryFieldsEnum, BankTransactionTypeEnum, BasiqConfig, BasiqJob, BasiqService, BasiqToken, BorrowingExpense, BorrowingExpenseLoan, BorrowingExpenseService, CAPITAL_COSTS_ITEMS, CHART_ACCOUNTS_CATEGORIES, CalculationFormItem, CalculationFormTypeEnum, CgtExemptionAndRolloverCodeEnum, ChartAccounts, ChartAccountsCategoryECollection, ChartAccountsCategoryEnum, ChartAccountsCollection, ChartAccountsDepreciation, ChartAccountsDepreciationService, ChartAccountsEtpEnum, ChartAccountsHeading, ChartAccountsHeadingListEnum, ChartAccountsHeadingTaxDeductibleEnum, ChartAccountsHeadingTaxableEnum, ChartAccountsHeadingVehicleListEnum, ChartAccountsListEnum, ChartAccountsMetadata, ChartAccountsMetadataListEnum, ChartAccountsMetadataTypeEnum, ChartAccountsService, ChartAccountsTaxLabelsEnum, ChartAccountsTypeEnum, ChartAccountsValue, ChartData, ChartSerie, Chat, ChatCollection, ChatService, ChatStatusEnum, ChatViewTypeEnum, ClientCollection, ClientDetails, ClientDetailsMedicareExemptionEnum, ClientDetailsWorkDepreciationCalculationEnum, ClientDetailsWorkingHolidayMakerEnum, ClientIncomeTypes, ClientIncomeTypesForm, ClientIncomeTypesService, ClientInvite, ClientInviteCollection, ClientInviteService, ClientInviteStatusEnum, ClientInviteTypeEnum, ClientMovement, ClientMovementCollection, ClientMovementService, ClientPortfolioChartData, ClientPortfolioReport, ClientPortfolioReportCollection, ClientPortfolioReportService, Collection, CollectionDictionary, CorelogicService, CorelogicSuggestion, Country, DEDUCTION_CATEGORIES, DEPRECIATION_GROUPS, DOCUMENT_FILE_TYPES, DeductionClothingTypeEnum, DeductionSelfEducationTypeEnum, Depreciation, DepreciationCalculationEnum, DepreciationCalculationPercentEnum, DepreciationCapitalProject, DepreciationCapitalProjectService, DepreciationCollection, DepreciationForecast, DepreciationForecastCollection, DepreciationGroup, DepreciationGroupEnum, DepreciationGroupItem, DepreciationLvpAssetTypeEnum, DepreciationLvpReportItem, DepreciationLvpReportItemCollection, DepreciationReceipt, DepreciationReceiptService, DepreciationReportItem, DepreciationReportItemCollection, DepreciationService, DepreciationTypeEnum, DepreciationWriteOffAmountEnum, Dictionary, Document, DocumentApiUrlPrefixEnum, DocumentFolder, DocumentFolderService, DocumentService, DocumentTypeEnum, ENDPOINTS, EmployeeCollection, EmployeeDetails, EmployeeInvite, EmployeeInviteService, EmployeeService, Endpoint, EquityPositionChartService, EventDispatcherService, ExportDataTable, ExportFormatEnum, ExportFormatterService, ExportableCollection, FacebookService, FinancialYear, Firm, FirmService, FirmTypeEnum, HeaderTitleService, IconsFileEnum, IncomeAmountTypeEnum, IncomePosition, IncomeSource, IncomeSourceChartData, IncomeSourceCollection, IncomeSourceForecast, IncomeSourceForecastService, IncomeSourceForecastTrustTypeEnum, IncomeSourceService, IncomeSourceType, IncomeSourceTypeEnum, IncomeSourceTypeListOtherEnum, IncomeSourceTypeListSoleEnum, IncomeSourceTypeListWorkEnum, InterceptorsModule, IntercomService, InviteStatusEnum, JwtService, KompassifyService, Loan, LoanBankTypeEnum, LoanCollection, LoanForm, LoanFrequencyEnum, LoanInterestTypeEnum, LoanMaxNumberOfPaymentsEnum, LoanPayment, LoanPaymentCollection, LoanPayout, LoanPayoutTypeEnum, LoanRepaymentFrequencyEnum, LoanRepaymentTypeEnum, LoanService, LoanTypeEnum, LoanVehicleTypeEnum, LogbookBestPeriodService, LogbookPeriod, LoginForm, MODULE_URL_LIST, MONTHS, Message, MessageCollection, MessageDocument, MessageDocumentCollection, MessageDocumentService, MessageService, MonthNameShortEnum, MonthNumberEnum, MyAccountHistory, MyAccountHistoryInitiatedByEnum, MyAccountHistoryStatusEnum, MyAccountHistoryTypeEnum, MyTaxBusinessOrLosses, MyTaxBusinessOrLossesForm, MyTaxCgt, MyTaxCgtForm, MyTaxDeductions, MyTaxDeductionsForm, MyTaxDividends, MyTaxDividendsForm, MyTaxEmployeeShareSchemes, MyTaxEmployeeShareSchemesForm, MyTaxEstimate, MyTaxIncomeStatements, MyTaxIncomeStatementsForm, MyTaxIncomeTests, MyTaxIncomeTestsForm, MyTaxInterest, MyTaxInterestForm, MyTaxLosses, MyTaxLossesForm, MyTaxMedicareForm, MyTaxOffsets, MyTaxOffsetsForm, MyTaxOtherIncome, MyTaxOtherIncomeForm, MyTaxPartnershipsAndTrusts, MyTaxPartnershipsAndTrustsForm, MyTaxRent, MyTaxRentForm, Notification, Occupation, OccupationService, PASSWORD_REGEXPS, PasswordForm, PdfFromDataTableService, PdfFromDomElementService, PdfFromHtmlTableService, PdfOrientationEnum, PdfSettings, Phone, PhoneTypeEnum, PreloaderService, Property, PropertyCalculationService, PropertyCategory, PropertyCategoryListEnum, PropertyCategoryMovement, PropertyCategoryMovementCollection, PropertyCategoryMovementService, PropertyCategoryService, PropertyCollection, PropertyDepreciationCalculationEnum, PropertyDocument, PropertyDocumentService, PropertyEquityChartData, PropertyEquityChartItem, PropertyForecast, PropertyReportItem, PropertyReportItemCollection, PropertyReportItemDepreciation, PropertyReportItemDepreciationCollection, PropertyReportItemTransaction, PropertyReportItemTransactionCollection, PropertySale, PropertySaleCollection, PropertySaleCostBase, PropertySaleCostBaseForm, PropertySaleCostSaleForm, PropertySaleExemptionsForm, PropertySaleService, PropertySaleTaxExemptionMetadata, PropertySaleTaxExemptionMetadataCollection, PropertyService, PropertyShare, PropertyShareAccessEnum, PropertyShareService, PropertyShareStatusEnum, PropertySubscription, PropertyTransactionReportService, PropertyValuation, RegisterClientForm, RegisterFirmForm, RegistrationInvite, RegistrationInviteStatusEnum, ReportItem, ReportItemCollection, ReportItemDetails, ResetPasswordForm, RewardfulService, SUBSCRIPTION_DESCRIPTION, SUBSCRIPTION_TITLE, SalaryForecast, SalaryForecastFrequencyEnum, SalaryForecastService, ServiceNotificationService, ServiceNotificationStatusEnum, ServiceNotificationTypeEnum, ServicePayment, ServicePaymentStatusEnum, ServicePrice, ServicePriceRecurringIntervalEnum, ServicePriceService, ServicePriceTypeEnum, ServiceProduct, ServiceProductIdEnum, ServiceProductStatusEnum, ServiceSubscription, ServiceSubscriptionCollection, ServiceSubscriptionItem, ServiceSubscriptionStatusEnum, ShareFilterOptionsEnum, SoleBusiness, SoleBusinessActivity, SoleBusinessActivityService, SoleBusinessAllocation, SoleBusinessAllocationsForm, SoleBusinessForm, SoleBusinessLoss, SoleBusinessLossForm, SoleBusinessLossOffsetRule, SoleBusinessLossOffsetRuleService, SoleBusinessLossReport, SoleBusinessLossService, SoleBusinessService, SoleContact, SoleContactForm, SoleContactService, SoleDepreciationMethod, SoleDepreciationMethodEnum, SoleDepreciationMethodForm, SoleDepreciationMethodService, SoleDetails, SoleDetailsForm, SoleDetailsService, SoleForecast, SoleForecastService, SoleInvoice, SoleInvoiceCollection, SoleInvoiceForm, SoleInvoiceItem, SoleInvoiceItemForm, SoleInvoiceService, SoleInvoiceStatusesEnum, SoleInvoiceTaxTypeEnum, SoleInvoiceTemplate, SoleInvoiceTemplateForm, SoleInvoiceTemplateService, SoleInvoiceTemplateTaxTypeEnum, SpareDocumentSpareTypeEnum, SseService, SubscriptionService, SubscriptionTypeEnum, TAX_RETURN_CATEGORIES, TYPE_LOAN, TankTypeEnum, TaxCalculationMedicareExemptionEnum, TaxCalculationTypeEnum, TaxExemption, TaxExemptionEnum, TaxExemptionMetadata, TaxExemptionMetadataEnum, TaxExemptionService, TaxReturnCategoryListEnum, TaxReturnCategorySectionEnum, TaxReview, TaxReviewCollection, TaxReviewHistoryService, TaxReviewService, TaxReviewStatusEnum, TaxSummary, TaxSummaryListEnum, TaxSummarySection, TaxSummarySectionEnum, TaxSummaryService, TaxSummaryTaxSummaryEnum, TaxSummaryTypeEnum, TicketFeedbackEnum, TicketStatusEnum, TicketTypesEnum, Toast, ToastService, ToastTypeEnum, Transaction, TransactionAllocation, TransactionAllocationCollection, TransactionAllocationService, TransactionBase, TransactionBaseCollection, TransactionCalculationService, TransactionCategoryEnum, TransactionCollection, TransactionMetadata, TransactionOperationEnum, TransactionReceipt, TransactionService, TransactionSourceEnum, TransactionTypeEnum, TtCoreModule, TutorialVideoService, USER_ROLES, USER_WORK_POSITION, User, UserEventSetting, UserEventSettingCollection, UserEventSettingFieldEnum, UserEventSettingService, UserEventStatusEnum, UserEventType, UserEventTypeCategory, UserEventTypeClientTypeEnum, UserEventTypeEmployeeTypeEnum, UserEventTypeFrequencyEnum, UserEventTypeService, UserEventTypeUserTypeEnum, UserInviteForm, UserMedicareExemptionEnum, UserRolesEnum, UserService, UserStatusEnum, UserSwitcherService, UserTitleEnum, UserToRegister, UserWorkDepreciationCalculationEnum, UserWorkingHolidayMakerEnum, UsersInviteService, Vehicle, VehicleClaim, VehicleClaimCollection, VehicleClaimDetails, VehicleClaimDetailsForm, VehicleClaimDetailsMethodEnum, VehicleClaimDetailsService, VehicleClaimForm, VehicleClaimService, VehicleExpense, VehicleExpenseCollection, VehicleForm, VehicleLogbook, VehicleLogbookCollection, VehicleLogbookForm, VehicleLogbookPurposeEnum, VehicleLogbookService, VehicleService, XlsxService, atLeastOneCheckedValidator, atoLinks, autocompleteValidator, cloneDeep, compare, compareMatOptions, conditionalValidator, createDate, displayMatOptions, enumToList, fieldsSumValidator, getDocIcon, minDateValidator, passwordMatchValidator, passwordValidator, replace, roundTo, sort, sortDeep, taxReviewFilterPredicate };
16484
+ export { AbstractForm, AbstractModel, AccountSetupItem, AccountSetupItemCollection, AccountSetupService, Address, AddressForm, AddressService, AddressTypeEnum, AlphabetColorsEnum, AppEvent, AppEventTypeEnum, AssetEntityTypeEnum, AssetTypeEnum, AssetsService, AuthService, BANK_ACCOUNT_TYPES, Badge, BadgeColorEnum, Bank, BankAccount, BankAccountAddManualForm, BankAccountAllocationForm, BankAccountCalculationService, BankAccountChartData, BankAccountCollection, BankAccountImportForm, BankAccountPropertiesForm, BankAccountProperty, BankAccountService, BankAccountStatusEnum, BankAccountTypeEnum, BankAccountsImportForm, BankConnection, BankConnectionService, BankConnectionStatusEnum, BankExternalStats, BankLoginData, BankLoginForm, BankService, BankTransaction, BankTransactionCalculationService, BankTransactionChartData, BankTransactionCollection, BankTransactionService, BankTransactionSummaryFieldsEnum, BankTransactionTypeEnum, BasiqConfig, BasiqJob, BasiqJobResponse, BasiqJobStep, BasiqService, BasiqToken, BasiqTokenService, BorrowingExpense, BorrowingExpenseLoan, BorrowingExpenseService, CAPITAL_COSTS_ITEMS, CHART_ACCOUNTS_CATEGORIES, CalculationFormItem, CalculationFormTypeEnum, CgtExemptionAndRolloverCodeEnum, ChartAccounts, ChartAccountsCategoryECollection, ChartAccountsCategoryEnum, ChartAccountsCollection, ChartAccountsDepreciation, ChartAccountsDepreciationService, ChartAccountsEtpEnum, ChartAccountsHeading, ChartAccountsHeadingListEnum, ChartAccountsHeadingTaxDeductibleEnum, ChartAccountsHeadingTaxableEnum, ChartAccountsHeadingVehicleListEnum, ChartAccountsListEnum, ChartAccountsMetadata, ChartAccountsMetadataListEnum, ChartAccountsMetadataTypeEnum, ChartAccountsService, ChartAccountsTaxLabelsEnum, ChartAccountsTypeEnum, ChartAccountsValue, ChartData, ChartSerie, Chat, ChatCollection, ChatService, ChatStatusEnum, ChatViewTypeEnum, ClientCollection, ClientDetails, ClientDetailsMedicareExemptionEnum, ClientDetailsWorkDepreciationCalculationEnum, ClientDetailsWorkingHolidayMakerEnum, ClientIncomeTypes, ClientIncomeTypesForm, ClientIncomeTypesService, ClientInvite, ClientInviteCollection, ClientInviteService, ClientInviteStatusEnum, ClientInviteTypeEnum, ClientMovement, ClientMovementCollection, ClientMovementService, ClientPortfolioChartData, ClientPortfolioReport, ClientPortfolioReportCollection, ClientPortfolioReportService, Collection, CollectionDictionary, CorelogicService, CorelogicSuggestion, Country, DEDUCTION_CATEGORIES, DEPRECIATION_GROUPS, DOCUMENT_FILE_TYPES, DeductionClothingTypeEnum, DeductionSelfEducationTypeEnum, Depreciation, DepreciationCalculationEnum, DepreciationCalculationPercentEnum, DepreciationCapitalProject, DepreciationCapitalProjectService, DepreciationCollection, DepreciationForecast, DepreciationForecastCollection, DepreciationGroup, DepreciationGroupEnum, DepreciationGroupItem, DepreciationLvpAssetTypeEnum, DepreciationLvpReportItem, DepreciationLvpReportItemCollection, DepreciationReceipt, DepreciationReceiptService, DepreciationReportItem, DepreciationReportItemCollection, DepreciationService, DepreciationTypeEnum, DepreciationWriteOffAmountEnum, Dictionary, Document, DocumentApiUrlPrefixEnum, DocumentFolder, DocumentFolderService, DocumentService, DocumentTypeEnum, ENDPOINTS, EmployeeCollection, EmployeeDetails, EmployeeInvite, EmployeeInviteService, EmployeeService, Endpoint, EquityPositionChartService, EventDispatcherService, ExportDataTable, ExportFormatEnum, ExportFormatterService, ExportableCollection, FacebookService, FinancialYear, Firm, FirmService, FirmTypeEnum, HeaderTitleService, IconsFileEnum, IncomeAmountTypeEnum, IncomePosition, IncomeSource, IncomeSourceChartData, IncomeSourceCollection, IncomeSourceForecast, IncomeSourceForecastService, IncomeSourceForecastTrustTypeEnum, IncomeSourceService, IncomeSourceType, IncomeSourceTypeEnum, IncomeSourceTypeListOtherEnum, IncomeSourceTypeListSoleEnum, IncomeSourceTypeListWorkEnum, InterceptorsModule, IntercomService, InviteStatusEnum, JwtService, KompassifyService, Loan, LoanBankTypeEnum, LoanCollection, LoanForm, LoanFrequencyEnum, LoanInterestTypeEnum, LoanMaxNumberOfPaymentsEnum, LoanPayment, LoanPaymentCollection, LoanPayout, LoanPayoutTypeEnum, LoanRepaymentFrequencyEnum, LoanRepaymentTypeEnum, LoanService, LoanTypeEnum, LoanVehicleTypeEnum, LogbookBestPeriodService, LogbookPeriod, LoginForm, MODULE_URL_LIST, MONTHS, Message, MessageCollection, MessageDocument, MessageDocumentCollection, MessageDocumentService, MessageService, MonthNameShortEnum, MonthNumberEnum, MyAccountHistory, MyAccountHistoryInitiatedByEnum, MyAccountHistoryStatusEnum, MyAccountHistoryTypeEnum, MyTaxBusinessOrLosses, MyTaxBusinessOrLossesForm, MyTaxCgt, MyTaxCgtForm, MyTaxDeductions, MyTaxDeductionsForm, MyTaxDividends, MyTaxDividendsForm, MyTaxEmployeeShareSchemes, MyTaxEmployeeShareSchemesForm, MyTaxEstimate, MyTaxIncomeStatements, MyTaxIncomeStatementsForm, MyTaxIncomeTests, MyTaxIncomeTestsForm, MyTaxInterest, MyTaxInterestForm, MyTaxLosses, MyTaxLossesForm, MyTaxMedicareForm, MyTaxOffsets, MyTaxOffsetsForm, MyTaxOtherIncome, MyTaxOtherIncomeForm, MyTaxPartnershipsAndTrusts, MyTaxPartnershipsAndTrustsForm, MyTaxRent, MyTaxRentForm, Notification, Occupation, OccupationService, PASSWORD_REGEXPS, PasswordForm, PdfFromDataTableService, PdfFromDomElementService, PdfFromHtmlTableService, PdfOrientationEnum, PdfSettings, Phone, PhoneForm, PhoneTypeEnum, PreloaderService, Property, PropertyCalculationService, PropertyCategory, PropertyCategoryListEnum, PropertyCategoryMovement, PropertyCategoryMovementCollection, PropertyCategoryMovementService, PropertyCategoryService, PropertyCollection, PropertyDepreciationCalculationEnum, PropertyDocument, PropertyDocumentService, PropertyEquityChartData, PropertyEquityChartItem, PropertyForecast, PropertyReportItem, PropertyReportItemCollection, PropertyReportItemDepreciation, PropertyReportItemDepreciationCollection, PropertyReportItemTransaction, PropertyReportItemTransactionCollection, PropertySale, PropertySaleCollection, PropertySaleCostBase, PropertySaleCostBaseForm, PropertySaleCostSaleForm, PropertySaleExemptionsForm, PropertySaleService, PropertySaleTaxExemptionMetadata, PropertySaleTaxExemptionMetadataCollection, PropertyService, PropertyShare, PropertyShareAccessEnum, PropertyShareService, PropertyShareStatusEnum, PropertySubscription, PropertyTransactionReportService, PropertyValuation, RegisterClientForm, RegisterFirmForm, RegistrationInvite, RegistrationInviteStatusEnum, ReportItem, ReportItemCollection, ReportItemDetails, ResetPasswordForm, RewardfulService, SUBSCRIPTION_DESCRIPTION, SUBSCRIPTION_TITLE, SalaryForecast, SalaryForecastFrequencyEnum, SalaryForecastService, ServiceNotificationService, ServiceNotificationStatusEnum, ServiceNotificationTypeEnum, ServicePayment, ServicePaymentStatusEnum, ServicePrice, ServicePriceRecurringIntervalEnum, ServicePriceService, ServicePriceTypeEnum, ServiceProduct, ServiceProductIdEnum, ServiceProductStatusEnum, ServiceSubscription, ServiceSubscriptionCollection, ServiceSubscriptionItem, ServiceSubscriptionStatusEnum, ShareFilterOptionsEnum, SoleBusiness, SoleBusinessActivity, SoleBusinessActivityService, SoleBusinessAllocation, SoleBusinessAllocationsForm, SoleBusinessForm, SoleBusinessLoss, SoleBusinessLossForm, SoleBusinessLossOffsetRule, SoleBusinessLossOffsetRuleService, SoleBusinessLossReport, SoleBusinessLossService, SoleBusinessService, SoleContact, SoleContactForm, SoleContactService, SoleDepreciationMethod, SoleDepreciationMethodEnum, SoleDepreciationMethodForm, SoleDepreciationMethodService, SoleDetails, SoleDetailsForm, SoleDetailsService, SoleForecast, SoleForecastService, SoleInvoice, SoleInvoiceCollection, SoleInvoiceForm, SoleInvoiceItem, SoleInvoiceItemForm, SoleInvoiceService, SoleInvoiceStatusesEnum, SoleInvoiceTaxTypeEnum, SoleInvoiceTemplate, SoleInvoiceTemplateForm, SoleInvoiceTemplateService, SoleInvoiceTemplateTaxTypeEnum, SpareDocumentSpareTypeEnum, SseService, SubscriptionService, SubscriptionTypeEnum, TAX_RETURN_CATEGORIES, TYPE_LOAN, TankTypeEnum, TaxCalculationMedicareExemptionEnum, TaxCalculationTypeEnum, TaxExemption, TaxExemptionEnum, TaxExemptionMetadata, TaxExemptionMetadataEnum, TaxExemptionService, TaxReturnCategoryListEnum, TaxReturnCategorySectionEnum, TaxReview, TaxReviewCollection, TaxReviewHistoryService, TaxReviewService, TaxReviewStatusEnum, TaxSummary, TaxSummaryListEnum, TaxSummarySection, TaxSummarySectionEnum, TaxSummaryService, TaxSummaryTaxSummaryEnum, TaxSummaryTypeEnum, TicketFeedbackEnum, TicketStatusEnum, TicketTypesEnum, Toast, ToastService, ToastTypeEnum, Transaction, TransactionAllocation, TransactionAllocationCollection, TransactionAllocationService, TransactionBase, TransactionBaseCollection, TransactionCalculationService, TransactionCategoryEnum, TransactionCollection, TransactionMetadata, TransactionOperationEnum, TransactionReceipt, TransactionService, TransactionSourceEnum, TransactionTypeEnum, TtCoreModule, TutorialVideoService, USER_ROLES, USER_WORK_POSITION, User, UserEventSetting, UserEventSettingCollection, UserEventSettingFieldEnum, UserEventSettingService, UserEventStatusEnum, UserEventType, UserEventTypeCategory, UserEventTypeClientTypeEnum, UserEventTypeEmployeeTypeEnum, UserEventTypeFrequencyEnum, UserEventTypeService, UserEventTypeUserTypeEnum, UserInviteForm, UserMedicareExemptionEnum, UserRolesEnum, UserService, UserStatusEnum, UserSwitcherService, UserTitleEnum, UserToRegister, UserWorkDepreciationCalculationEnum, UserWorkingHolidayMakerEnum, UsersInviteService, Vehicle, VehicleClaim, VehicleClaimCollection, VehicleClaimDetails, VehicleClaimDetailsForm, VehicleClaimDetailsMethodEnum, VehicleClaimDetailsService, VehicleClaimForm, VehicleClaimService, VehicleExpense, VehicleExpenseCollection, VehicleForm, VehicleLogbook, VehicleLogbookCollection, VehicleLogbookForm, VehicleLogbookPurposeEnum, VehicleLogbookService, VehicleService, XlsxService, atLeastOneCheckedValidator, atoLinks, autocompleteValidator, cloneDeep, compare, compareMatOptions, conditionalValidator, createDate, displayMatOptions, enumToList, fieldsSumValidator, getDocIcon, minDateValidator, passwordMatchValidator, passwordValidator, replace, roundTo, sort, sortDeep, taxReviewFilterPredicate };
16223
16485
  //# sourceMappingURL=taxtank-core.js.map