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
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/common/http'), require('rxjs'), require('rxjs/operators'), require('class-transformer'), require('@auth0/angular-jwt'), require('lodash/get'), require('lodash/last'), require('lodash/flatten'), require('lodash/hasIn'), require('lodash/first'), require('moment'), require('moment-range'), require('lodash/uniqBy'), require('lodash/concat'), require('rxjs/internal/observable/throwError'), require('lodash/cloneDeep'), require('event-source-polyfill/src/eventsource.min.js'), require('lodash/compact'), require('lodash/differenceBy'), require('@angular/forms'), require('lodash/merge'), require('lodash/isEqual'), require('lodash/fromPairs'), require('lodash'), require('@angular/router'), require('lodash/clone'), require('html2pdf.js'), require('jspdf'), require('jspdf-autotable'), require('@stripe/stripe-js'), require('xlsx'), require('file-saver')) :
3
- typeof define === 'function' && define.amd ? define('taxtank-core', ['exports', '@angular/core', '@angular/common', '@angular/common/http', 'rxjs', 'rxjs/operators', 'class-transformer', '@auth0/angular-jwt', 'lodash/get', 'lodash/last', 'lodash/flatten', 'lodash/hasIn', 'lodash/first', 'moment', 'moment-range', 'lodash/uniqBy', 'lodash/concat', 'rxjs/internal/observable/throwError', 'lodash/cloneDeep', 'event-source-polyfill/src/eventsource.min.js', 'lodash/compact', 'lodash/differenceBy', '@angular/forms', 'lodash/merge', 'lodash/isEqual', 'lodash/fromPairs', 'lodash', '@angular/router', 'lodash/clone', 'html2pdf.js', 'jspdf', 'jspdf-autotable', '@stripe/stripe-js', 'xlsx', 'file-saver'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["taxtank-core"] = {}, global.ng.core, global.ng.common, global.ng.common.http, global.rxjs, global.rxjs.operators, global.classTransformer, global.angularJwt, global.get, global.last, global.flatten, global.hasIn, global.first, global.moment$1, global.momentRange, global.uniqBy, global.concat, global.rxjs["internal/observable/throwError"], global.cloneDeep$1, global.eventsource_min_js, global.compact, global.differenceBy, global.ng.forms, global.merge, global.isEqual, global.fromPairs, global._, global.ng.router, global.clone, global.html2pdf, global.jsPDF, global.autoTable, global.stripeJs, global.xlsx, global.FileSaver));
5
- })(this, (function (exports, i0, i1$1, i1, rxjs, operators, classTransformer, angularJwt, get, last, flatten, hasIn, first, moment$1, momentRange, uniqBy, concat, throwError, cloneDeep$1, eventsource_min_js, compact, differenceBy, forms, merge, isEqual, fromPairs, _, i1$2, clone, html2pdf, jsPDF, autoTable, stripeJs, xlsx, FileSaver) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/common/http'), require('rxjs/operators'), require('rxjs'), require('class-transformer'), require('@auth0/angular-jwt'), require('lodash/get'), require('lodash/flatten'), require('lodash/hasIn'), require('lodash/first'), require('lodash/last'), require('lodash/uniqBy'), require('lodash/concat'), require('rxjs/internal/observable/throwError'), require('moment'), require('moment-range'), require('lodash/cloneDeep'), require('event-source-polyfill/src/eventsource.min.js'), require('lodash/compact'), require('lodash/differenceBy'), require('@angular/forms'), require('lodash/merge'), require('lodash/isEqual'), require('lodash/fromPairs'), require('lodash'), require('@angular/router'), require('lodash/clone'), require('html2pdf.js'), require('jspdf'), require('jspdf-autotable'), require('@stripe/stripe-js'), require('xlsx'), require('file-saver')) :
3
+ typeof define === 'function' && define.amd ? define('taxtank-core', ['exports', '@angular/core', '@angular/common', '@angular/common/http', 'rxjs/operators', 'rxjs', 'class-transformer', '@auth0/angular-jwt', 'lodash/get', 'lodash/flatten', 'lodash/hasIn', 'lodash/first', 'lodash/last', 'lodash/uniqBy', 'lodash/concat', 'rxjs/internal/observable/throwError', 'moment', 'moment-range', 'lodash/cloneDeep', 'event-source-polyfill/src/eventsource.min.js', 'lodash/compact', 'lodash/differenceBy', '@angular/forms', 'lodash/merge', 'lodash/isEqual', 'lodash/fromPairs', 'lodash', '@angular/router', 'lodash/clone', 'html2pdf.js', 'jspdf', 'jspdf-autotable', '@stripe/stripe-js', 'xlsx', 'file-saver'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["taxtank-core"] = {}, global.ng.core, global.ng.common, global.ng.common.http, global.rxjs.operators, global.rxjs, global.classTransformer, global.angularJwt, global.get, global.flatten, global.hasIn, global.first, global.last, global.uniqBy, global.concat, global.rxjs["internal/observable/throwError"], global.moment$1, global.momentRange, global.cloneDeep$1, global.eventsource_min_js, global.compact, global.differenceBy, global.ng.forms, global.merge, global.isEqual, global.fromPairs, global._, global.ng.router, global.clone, global.html2pdf, global.jsPDF, global.autoTable, global.stripeJs, global.xlsx, global.FileSaver));
5
+ })(this, (function (exports, i0, i1$1, i1, operators, rxjs, classTransformer, angularJwt, get, flatten, hasIn, first, last, uniqBy, concat, throwError, moment$1, momentRange, cloneDeep$1, eventsource_min_js, compact, differenceBy, forms, merge, isEqual, fromPairs, _, i1$2, clone, html2pdf, jsPDF, autoTable, stripeJs, xlsx, FileSaver) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -28,13 +28,13 @@
28
28
  var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
29
29
  var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
30
30
  var get__default = /*#__PURE__*/_interopDefaultLegacy(get);
31
- var last__default = /*#__PURE__*/_interopDefaultLegacy(last);
32
31
  var flatten__default = /*#__PURE__*/_interopDefaultLegacy(flatten);
33
32
  var hasIn__default = /*#__PURE__*/_interopDefaultLegacy(hasIn);
34
33
  var first__default = /*#__PURE__*/_interopDefaultLegacy(first);
35
- var moment__namespace = /*#__PURE__*/_interopNamespace(moment$1);
34
+ var last__default = /*#__PURE__*/_interopDefaultLegacy(last);
36
35
  var uniqBy__default = /*#__PURE__*/_interopDefaultLegacy(uniqBy);
37
36
  var concat__default = /*#__PURE__*/_interopDefaultLegacy(concat);
37
+ var moment__namespace = /*#__PURE__*/_interopNamespace(moment$1);
38
38
  var cloneDeep__default = /*#__PURE__*/_interopDefaultLegacy(cloneDeep$1);
39
39
  var compact__default = /*#__PURE__*/_interopDefaultLegacy(compact);
40
40
  var differenceBy__default = /*#__PURE__*/_interopDefaultLegacy(differenceBy);
@@ -113,28 +113,27 @@
113
113
  this.corelogicService = corelogicService;
114
114
  this.environment = environment;
115
115
  }
116
- /**
117
- * Check if requested url requested core logic, but not core logic auth api
118
- * @param req
119
- */
120
- CorelogicInterceptor.prototype.addToken = function (req) {
121
- // don't need token for this endpoint
122
- if (req.url.includes(this.environment.coreLogicUrl + "/access/oauth/token")) {
123
- return req;
116
+ CorelogicInterceptor.prototype.intercept = function (request, next) {
117
+ var _this = this;
118
+ // skip non-corelogic requests
119
+ if (!request.url.includes(this.environment.coreLogicUrl)) {
120
+ return next.handle(request);
124
121
  }
125
- // add core logic token to request headers
126
- if (req.url.includes(this.environment.coreLogicUrl)) {
127
- return req.clone({
128
- setHeaders: {
129
- Authorization: 'Bearer ' + this.corelogicService._accessToken
130
- }
131
- });
122
+ // don't need token for this endpoint
123
+ if (request.url.includes(this.environment.coreLogicUrl + "/access/oauth/token")) {
124
+ return next.handle(request);
132
125
  }
133
- // return request without changes if url not related with core logic
134
- return req;
126
+ return this.corelogicService.getAccessToken()
127
+ .pipe(operators.mergeMap(function (token) {
128
+ return next.handle(_this.addToken(request, token));
129
+ }));
135
130
  };
136
- CorelogicInterceptor.prototype.intercept = function (request, next) {
137
- return next.handle(this.addToken(request));
131
+ CorelogicInterceptor.prototype.addToken = function (request, token) {
132
+ return request.clone({
133
+ setHeaders: {
134
+ Authorization: 'Bearer ' + token
135
+ }
136
+ });
138
137
  };
139
138
  return CorelogicInterceptor;
140
139
  }());
@@ -557,62 +556,63 @@
557
556
  AppEventTypeEnum[AppEventTypeEnum["BASIQ_CONSENT_UPDATED"] = 5] = "BASIQ_CONSENT_UPDATED";
558
557
  AppEventTypeEnum[AppEventTypeEnum["BASIQ_CONNECTION_UPDATED"] = 6] = "BASIQ_CONNECTION_UPDATED";
559
558
  AppEventTypeEnum[AppEventTypeEnum["BASIQ_JOB_CREATED"] = 7] = "BASIQ_JOB_CREATED";
560
- AppEventTypeEnum[AppEventTypeEnum["CLIENT_INVITE_ACCEPTED"] = 8] = "CLIENT_INVITE_ACCEPTED";
561
- AppEventTypeEnum[AppEventTypeEnum["CLIENT_OPEN_CHAT"] = 9] = "CLIENT_OPEN_CHAT";
562
- AppEventTypeEnum[AppEventTypeEnum["CLIENT_TRANSFER_TO_OTHER_EMPLOYEE"] = 10] = "CLIENT_TRANSFER_TO_OTHER_EMPLOYEE";
563
- AppEventTypeEnum[AppEventTypeEnum["CURRENT_USER_GET_FAILED"] = 11] = "CURRENT_USER_GET_FAILED";
564
- AppEventTypeEnum[AppEventTypeEnum["DEPRECIATION_DELETED"] = 12] = "DEPRECIATION_DELETED";
565
- AppEventTypeEnum[AppEventTypeEnum["DEPRECIATIONS_CREATED"] = 13] = "DEPRECIATIONS_CREATED";
566
- AppEventTypeEnum[AppEventTypeEnum["DEPRECIATION_UPDATED_WITH_RECEIPT"] = 14] = "DEPRECIATION_UPDATED_WITH_RECEIPT";
567
- AppEventTypeEnum[AppEventTypeEnum["DEPRECIATION_UPDATED_WITH_DELETED_RECEIPT"] = 15] = "DEPRECIATION_UPDATED_WITH_DELETED_RECEIPT";
568
- AppEventTypeEnum[AppEventTypeEnum["DEPRECIATION_RECEIPT_CREATED"] = 16] = "DEPRECIATION_RECEIPT_CREATED";
569
- AppEventTypeEnum[AppEventTypeEnum["DEPRECIATION_RECEIPT_DELETED"] = 17] = "DEPRECIATION_RECEIPT_DELETED";
570
- AppEventTypeEnum[AppEventTypeEnum["INCOME_SOURCES_CREATED"] = 18] = "INCOME_SOURCES_CREATED";
571
- AppEventTypeEnum[AppEventTypeEnum["INCOME_SOURCES_UPDATED"] = 19] = "INCOME_SOURCES_UPDATED";
572
- AppEventTypeEnum[AppEventTypeEnum["INCOME_SOURCES_FORECASTS_CREATED"] = 20] = "INCOME_SOURCES_FORECASTS_CREATED";
573
- AppEventTypeEnum[AppEventTypeEnum["INCOME_SOURCES_FORECASTS_UPDATED"] = 21] = "INCOME_SOURCES_FORECASTS_UPDATED";
574
- AppEventTypeEnum[AppEventTypeEnum["LOAN_UPDATED"] = 22] = "LOAN_UPDATED";
575
- AppEventTypeEnum[AppEventTypeEnum["LOAN_PAYOUT_UPDATED"] = 23] = "LOAN_PAYOUT_UPDATED";
576
- AppEventTypeEnum[AppEventTypeEnum["MESSAGE_CREATED"] = 24] = "MESSAGE_CREATED";
577
- AppEventTypeEnum[AppEventTypeEnum["MESSAGE_FILE_CREATED"] = 25] = "MESSAGE_FILE_CREATED";
578
- AppEventTypeEnum[AppEventTypeEnum["MESSAGE_FILE_DELETED"] = 26] = "MESSAGE_FILE_DELETED";
579
- AppEventTypeEnum[AppEventTypeEnum["NOTIFICATION_ADDED"] = 27] = "NOTIFICATION_ADDED";
580
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_DEPRECIATION_CALCULATION_UPDATED"] = 28] = "PROPERTY_DEPRECIATION_CALCULATION_UPDATED";
581
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_UPDATED"] = 29] = "PROPERTY_UPDATED";
582
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_UPDATED_WITH_DOCUMENT"] = 30] = "PROPERTY_UPDATED_WITH_DOCUMENT";
583
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_DOCUMENT_ADDED"] = 31] = "PROPERTY_DOCUMENT_ADDED";
584
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_MOVEMENT_CREATED"] = 32] = "PROPERTY_MOVEMENT_CREATED";
585
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_MOVEMENT_UPDATED"] = 33] = "PROPERTY_MOVEMENT_UPDATED";
586
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_MOVEMENT_DELETED"] = 34] = "PROPERTY_MOVEMENT_DELETED";
587
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SHARE_UPDATED"] = 35] = "PROPERTY_SHARE_UPDATED";
588
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SALE_ADDED"] = 36] = "PROPERTY_SALE_ADDED";
589
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SALE_DELETED"] = 37] = "PROPERTY_SALE_DELETED";
590
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SUBSCRIPTION_ADDED"] = 38] = "PROPERTY_SUBSCRIPTION_ADDED";
591
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SUBSCRIPTION_DELETED"] = 39] = "PROPERTY_SUBSCRIPTION_DELETED";
592
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_VALUATION_DOCUMENT_CREATED"] = 40] = "PROPERTY_VALUATION_DOCUMENT_CREATED";
593
- AppEventTypeEnum[AppEventTypeEnum["SERVICE_SUBSCRIPTION_UPDATED"] = 41] = "SERVICE_SUBSCRIPTION_UPDATED";
594
- AppEventTypeEnum[AppEventTypeEnum["SOLE_BUSINESS_CREATED"] = 42] = "SOLE_BUSINESS_CREATED";
595
- AppEventTypeEnum[AppEventTypeEnum["SOLE_DEPRECIATION_METHOD_UPDATED"] = 43] = "SOLE_DEPRECIATION_METHOD_UPDATED";
596
- AppEventTypeEnum[AppEventTypeEnum["SOLE_DETAILS_CREATED"] = 44] = "SOLE_DETAILS_CREATED";
597
- AppEventTypeEnum[AppEventTypeEnum["SOLE_DETAILS_UPDATED"] = 45] = "SOLE_DETAILS_UPDATED";
598
- AppEventTypeEnum[AppEventTypeEnum["TAX_REVIEW_UPDATED"] = 46] = "TAX_REVIEW_UPDATED";
599
- AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_CREATED"] = 47] = "TRANSACTION_CREATED";
600
- AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_DELETED"] = 48] = "TRANSACTION_DELETED";
601
- AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED"] = 49] = "TRANSACTION_UPDATED";
602
- AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED_WITH_RECEIPT"] = 50] = "TRANSACTION_UPDATED_WITH_RECEIPT";
603
- AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED_WITH_DELETED_RECEIPT"] = 51] = "TRANSACTION_UPDATED_WITH_DELETED_RECEIPT";
604
- AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_RECEIPT_CREATED"] = 52] = "TRANSACTION_RECEIPT_CREATED";
605
- AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_RECEIPT_DELETED"] = 53] = "TRANSACTION_RECEIPT_DELETED";
606
- AppEventTypeEnum[AppEventTypeEnum["TRANSACTIONS_CREATED"] = 54] = "TRANSACTIONS_CREATED";
607
- AppEventTypeEnum[AppEventTypeEnum["USER_UPDATED"] = 55] = "USER_UPDATED";
608
- AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_UPDATED"] = 56] = "VEHICLE_CLAIM_UPDATED";
609
- AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_CREATED"] = 57] = "VEHICLE_CLAIM_CREATED";
610
- AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_DETAILS_UPDATED"] = 58] = "VEHICLE_CLAIM_DETAILS_UPDATED";
611
- AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_DETAILS_CREATED"] = 59] = "VEHICLE_CLAIM_DETAILS_CREATED";
612
- AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_CREATED"] = 60] = "VEHICLE_LOGBOOK_CREATED";
613
- AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_UPDATED"] = 61] = "VEHICLE_LOGBOOK_UPDATED";
614
- AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_DELETED"] = 62] = "VEHICLE_LOGBOOK_DELETED";
615
- AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_BEST_PERIOD_UPDATED"] = 63] = "VEHICLE_LOGBOOK_BEST_PERIOD_UPDATED";
559
+ AppEventTypeEnum[AppEventTypeEnum["BASIQ_LOGIN_FINISHED"] = 8] = "BASIQ_LOGIN_FINISHED";
560
+ AppEventTypeEnum[AppEventTypeEnum["CLIENT_INVITE_ACCEPTED"] = 9] = "CLIENT_INVITE_ACCEPTED";
561
+ AppEventTypeEnum[AppEventTypeEnum["CLIENT_OPEN_CHAT"] = 10] = "CLIENT_OPEN_CHAT";
562
+ AppEventTypeEnum[AppEventTypeEnum["CLIENT_TRANSFER_TO_OTHER_EMPLOYEE"] = 11] = "CLIENT_TRANSFER_TO_OTHER_EMPLOYEE";
563
+ AppEventTypeEnum[AppEventTypeEnum["CURRENT_USER_GET_FAILED"] = 12] = "CURRENT_USER_GET_FAILED";
564
+ AppEventTypeEnum[AppEventTypeEnum["DEPRECIATION_DELETED"] = 13] = "DEPRECIATION_DELETED";
565
+ AppEventTypeEnum[AppEventTypeEnum["DEPRECIATIONS_CREATED"] = 14] = "DEPRECIATIONS_CREATED";
566
+ AppEventTypeEnum[AppEventTypeEnum["DEPRECIATION_UPDATED_WITH_RECEIPT"] = 15] = "DEPRECIATION_UPDATED_WITH_RECEIPT";
567
+ AppEventTypeEnum[AppEventTypeEnum["DEPRECIATION_UPDATED_WITH_DELETED_RECEIPT"] = 16] = "DEPRECIATION_UPDATED_WITH_DELETED_RECEIPT";
568
+ AppEventTypeEnum[AppEventTypeEnum["DEPRECIATION_RECEIPT_CREATED"] = 17] = "DEPRECIATION_RECEIPT_CREATED";
569
+ AppEventTypeEnum[AppEventTypeEnum["DEPRECIATION_RECEIPT_DELETED"] = 18] = "DEPRECIATION_RECEIPT_DELETED";
570
+ AppEventTypeEnum[AppEventTypeEnum["INCOME_SOURCES_CREATED"] = 19] = "INCOME_SOURCES_CREATED";
571
+ AppEventTypeEnum[AppEventTypeEnum["INCOME_SOURCES_UPDATED"] = 20] = "INCOME_SOURCES_UPDATED";
572
+ AppEventTypeEnum[AppEventTypeEnum["INCOME_SOURCES_FORECASTS_CREATED"] = 21] = "INCOME_SOURCES_FORECASTS_CREATED";
573
+ AppEventTypeEnum[AppEventTypeEnum["INCOME_SOURCES_FORECASTS_UPDATED"] = 22] = "INCOME_SOURCES_FORECASTS_UPDATED";
574
+ AppEventTypeEnum[AppEventTypeEnum["LOAN_UPDATED"] = 23] = "LOAN_UPDATED";
575
+ AppEventTypeEnum[AppEventTypeEnum["LOAN_PAYOUT_UPDATED"] = 24] = "LOAN_PAYOUT_UPDATED";
576
+ AppEventTypeEnum[AppEventTypeEnum["MESSAGE_CREATED"] = 25] = "MESSAGE_CREATED";
577
+ AppEventTypeEnum[AppEventTypeEnum["MESSAGE_FILE_CREATED"] = 26] = "MESSAGE_FILE_CREATED";
578
+ AppEventTypeEnum[AppEventTypeEnum["MESSAGE_FILE_DELETED"] = 27] = "MESSAGE_FILE_DELETED";
579
+ AppEventTypeEnum[AppEventTypeEnum["NOTIFICATION_ADDED"] = 28] = "NOTIFICATION_ADDED";
580
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_DEPRECIATION_CALCULATION_UPDATED"] = 29] = "PROPERTY_DEPRECIATION_CALCULATION_UPDATED";
581
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_UPDATED"] = 30] = "PROPERTY_UPDATED";
582
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_UPDATED_WITH_DOCUMENT"] = 31] = "PROPERTY_UPDATED_WITH_DOCUMENT";
583
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_DOCUMENT_ADDED"] = 32] = "PROPERTY_DOCUMENT_ADDED";
584
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_MOVEMENT_CREATED"] = 33] = "PROPERTY_MOVEMENT_CREATED";
585
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_MOVEMENT_UPDATED"] = 34] = "PROPERTY_MOVEMENT_UPDATED";
586
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_MOVEMENT_DELETED"] = 35] = "PROPERTY_MOVEMENT_DELETED";
587
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SHARE_UPDATED"] = 36] = "PROPERTY_SHARE_UPDATED";
588
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SALE_ADDED"] = 37] = "PROPERTY_SALE_ADDED";
589
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SALE_DELETED"] = 38] = "PROPERTY_SALE_DELETED";
590
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SUBSCRIPTION_ADDED"] = 39] = "PROPERTY_SUBSCRIPTION_ADDED";
591
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SUBSCRIPTION_DELETED"] = 40] = "PROPERTY_SUBSCRIPTION_DELETED";
592
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_VALUATION_DOCUMENT_CREATED"] = 41] = "PROPERTY_VALUATION_DOCUMENT_CREATED";
593
+ AppEventTypeEnum[AppEventTypeEnum["SERVICE_SUBSCRIPTION_UPDATED"] = 42] = "SERVICE_SUBSCRIPTION_UPDATED";
594
+ AppEventTypeEnum[AppEventTypeEnum["SOLE_BUSINESS_CREATED"] = 43] = "SOLE_BUSINESS_CREATED";
595
+ AppEventTypeEnum[AppEventTypeEnum["SOLE_DEPRECIATION_METHOD_UPDATED"] = 44] = "SOLE_DEPRECIATION_METHOD_UPDATED";
596
+ AppEventTypeEnum[AppEventTypeEnum["SOLE_DETAILS_CREATED"] = 45] = "SOLE_DETAILS_CREATED";
597
+ AppEventTypeEnum[AppEventTypeEnum["SOLE_DETAILS_UPDATED"] = 46] = "SOLE_DETAILS_UPDATED";
598
+ AppEventTypeEnum[AppEventTypeEnum["TAX_REVIEW_UPDATED"] = 47] = "TAX_REVIEW_UPDATED";
599
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_CREATED"] = 48] = "TRANSACTION_CREATED";
600
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_DELETED"] = 49] = "TRANSACTION_DELETED";
601
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED"] = 50] = "TRANSACTION_UPDATED";
602
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED_WITH_RECEIPT"] = 51] = "TRANSACTION_UPDATED_WITH_RECEIPT";
603
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED_WITH_DELETED_RECEIPT"] = 52] = "TRANSACTION_UPDATED_WITH_DELETED_RECEIPT";
604
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_RECEIPT_CREATED"] = 53] = "TRANSACTION_RECEIPT_CREATED";
605
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_RECEIPT_DELETED"] = 54] = "TRANSACTION_RECEIPT_DELETED";
606
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTIONS_CREATED"] = 55] = "TRANSACTIONS_CREATED";
607
+ AppEventTypeEnum[AppEventTypeEnum["USER_UPDATED"] = 56] = "USER_UPDATED";
608
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_UPDATED"] = 57] = "VEHICLE_CLAIM_UPDATED";
609
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_CREATED"] = 58] = "VEHICLE_CLAIM_CREATED";
610
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_DETAILS_UPDATED"] = 59] = "VEHICLE_CLAIM_DETAILS_UPDATED";
611
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_DETAILS_CREATED"] = 60] = "VEHICLE_CLAIM_DETAILS_CREATED";
612
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_CREATED"] = 61] = "VEHICLE_LOGBOOK_CREATED";
613
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_UPDATED"] = 62] = "VEHICLE_LOGBOOK_UPDATED";
614
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_DELETED"] = 63] = "VEHICLE_LOGBOOK_DELETED";
615
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_BEST_PERIOD_UPDATED"] = 64] = "VEHICLE_LOGBOOK_BEST_PERIOD_UPDATED";
616
616
  })(exports.AppEventTypeEnum || (exports.AppEventTypeEnum = {}));
617
617
 
618
618
  var EventDispatcherService = /** @class */ (function () {
@@ -983,6 +983,7 @@
983
983
  CLIENT_MOVEMENTS_GET: new Endpoint('GET', '\\/client-movements'),
984
984
  CLIENT_MOVEMENTS_POST: new Endpoint('POST', '\\/client-movements'),
985
985
  COUNTRIES_GET: new Endpoint('GET', '\\/countries'),
986
+ CORELOGIC_TOKEN_GET: new Endpoint('GET', '/access\\/oauth\\/token.*$'),
986
987
  DEPRECIATIONS_OPENING_GET: new Endpoint('GET', '\\/depreciations\\/\\opening-balance\.\*'),
987
988
  DEPRECIATIONS_GET: new Endpoint('GET', '\\/depreciations'),
988
989
  DEPRECIATIONS_POST: new Endpoint('POST', '\\/depreciations'),
@@ -1546,156 +1547,6 @@
1546
1547
  }] }, { type: ToastService }];
1547
1548
  } });
1548
1549
 
1549
- var AbstractModel = /** @class */ (function () {
1550
- function AbstractModel() {
1551
- }
1552
- AbstractModel.prototype.hasValue = function (value, path) {
1553
- if (path === void 0) { path = 'id'; }
1554
- return get__default["default"](path) === value;
1555
- };
1556
- return AbstractModel;
1557
- }());
1558
-
1559
- var BankAccount$1 = /** @class */ (function (_super) {
1560
- __extends(BankAccount, _super);
1561
- function BankAccount() {
1562
- return _super !== null && _super.apply(this, arguments) || this;
1563
- }
1564
- return BankAccount;
1565
- }(AbstractModel));
1566
-
1567
- exports.BankAccountTypeEnum = void 0;
1568
- (function (BankAccountTypeEnum) {
1569
- BankAccountTypeEnum[BankAccountTypeEnum["TRANSACTION"] = 1] = "TRANSACTION";
1570
- BankAccountTypeEnum[BankAccountTypeEnum["SAVINGS"] = 2] = "SAVINGS";
1571
- BankAccountTypeEnum[BankAccountTypeEnum["CREDIT_CARD"] = 3] = "CREDIT_CARD";
1572
- // @TODO Alex: should be removed by backend (TT-2107)
1573
- // MORTGAGE = 4,
1574
- BankAccountTypeEnum[BankAccountTypeEnum["LOAN"] = 5] = "LOAN";
1575
- BankAccountTypeEnum[BankAccountTypeEnum["INVESTMENT"] = 6] = "INVESTMENT";
1576
- BankAccountTypeEnum[BankAccountTypeEnum["TERM_DEPOSIT"] = 7] = "TERM_DEPOSIT";
1577
- BankAccountTypeEnum[BankAccountTypeEnum["OFFSET"] = 10] = "OFFSET";
1578
- })(exports.BankAccountTypeEnum || (exports.BankAccountTypeEnum = {}));
1579
-
1580
- exports.BankAccountStatusEnum = void 0;
1581
- (function (BankAccountStatusEnum) {
1582
- BankAccountStatusEnum[BankAccountStatusEnum["INACTIVE"] = 0] = "INACTIVE";
1583
- BankAccountStatusEnum[BankAccountStatusEnum["ACTIVE"] = 1] = "ACTIVE";
1584
- })(exports.BankAccountStatusEnum || (exports.BankAccountStatusEnum = {}));
1585
-
1586
- var Loan$1 = /** @class */ (function (_super) {
1587
- __extends(Loan, _super);
1588
- function Loan() {
1589
- return _super !== null && _super.apply(this, arguments) || this;
1590
- }
1591
- return Loan;
1592
- }(AbstractModel));
1593
-
1594
- exports.LoanVehicleTypeEnum = void 0;
1595
- (function (LoanVehicleTypeEnum) {
1596
- LoanVehicleTypeEnum[LoanVehicleTypeEnum["AUTO_LOAN"] = 6] = "AUTO_LOAN";
1597
- LoanVehicleTypeEnum[LoanVehicleTypeEnum["CHATTEL_MORTGAGE"] = 9] = "CHATTEL_MORTGAGE";
1598
- LoanVehicleTypeEnum[LoanVehicleTypeEnum["COMMERCIAL_HIRE_PURCHASE"] = 10] = "COMMERCIAL_HIRE_PURCHASE";
1599
- })(exports.LoanVehicleTypeEnum || (exports.LoanVehicleTypeEnum = {}));
1600
-
1601
- // @Todo no base model from backend list
1602
- /**
1603
- * Loan payment class
1604
- */
1605
- var LoanPayment = /** @class */ (function (_super) {
1606
- __extends(LoanPayment, _super);
1607
- function LoanPayment() {
1608
- return _super !== null && _super.apply(this, arguments) || this;
1609
- }
1610
- return LoanPayment;
1611
- }(AbstractModel));
1612
- __decorate([
1613
- classTransformer.Type(function () { return Date; })
1614
- ], LoanPayment.prototype, "date", void 0);
1615
-
1616
- var LoanPayout$1 = /** @class */ (function (_super) {
1617
- __extends(LoanPayout, _super);
1618
- function LoanPayout() {
1619
- return _super !== null && _super.apply(this, arguments) || this;
1620
- }
1621
- return LoanPayout;
1622
- }(AbstractModel));
1623
-
1624
- exports.LoanPayoutTypeEnum = void 0;
1625
- (function (LoanPayoutTypeEnum) {
1626
- LoanPayoutTypeEnum[LoanPayoutTypeEnum["REFINANCE"] = 1] = "REFINANCE";
1627
- LoanPayoutTypeEnum[LoanPayoutTypeEnum["PAYOUT"] = 2] = "PAYOUT";
1628
- })(exports.LoanPayoutTypeEnum || (exports.LoanPayoutTypeEnum = {}));
1629
-
1630
- var LoanPayout = /** @class */ (function (_super) {
1631
- __extends(LoanPayout, _super);
1632
- function LoanPayout() {
1633
- return _super !== null && _super.apply(this, arguments) || this;
1634
- }
1635
- /**
1636
- * Check if payout type is refinance
1637
- */
1638
- LoanPayout.prototype.isRefinance = function () {
1639
- return this.type === exports.LoanPayoutTypeEnum.REFINANCE;
1640
- };
1641
- return LoanPayout;
1642
- }(LoanPayout$1));
1643
-
1644
- var FinancialYear = /** @class */ (function () {
1645
- function FinancialYear(date) {
1646
- this.yearStartDate = '-07-01';
1647
- this.yearEndDate = '-06-30';
1648
- if (date) {
1649
- this.year = date instanceof Date ? FinancialYear.toFinYear(date) : date;
1650
- }
1651
- else {
1652
- this.year = +localStorage.getItem('financialYear') || FinancialYear.toFinYear(new Date());
1653
- }
1654
- this.setStartDate(this.year);
1655
- this.setEndDate(this.year);
1656
- }
1657
- FinancialYear.prototype.includes = function (date) {
1658
- return this.year === new FinancialYear(date).year;
1659
- };
1660
- FinancialYear.toFinYear = function (date) {
1661
- return date.getFullYear() + (date.getMonth() >= this.startMonthIndex ? 1 : 0);
1662
- };
1663
- Object.defineProperty(FinancialYear.prototype, "prevFinYear", {
1664
- get: function () {
1665
- return new FinancialYear(new Date("" + (new Date().getFullYear() - 1) + this.yearStartDate));
1666
- },
1667
- enumerable: false,
1668
- configurable: true
1669
- });
1670
- /**
1671
- * Get date by desired month
1672
- */
1673
- FinancialYear.prototype.getMonthDate = function (monthIndex) {
1674
- if (monthIndex >= FinancialYear.startMonthIndex) {
1675
- return new Date(this.year - 1 + "-" + (monthIndex + 1) + "-01");
1676
- }
1677
- return new Date(this.year + "-" + (monthIndex + 1) + "-01");
1678
- };
1679
- FinancialYear.prototype.setStartDate = function (year) {
1680
- this.startDate = new Date("" + (year - 1) + this.yearStartDate);
1681
- };
1682
- FinancialYear.prototype.setEndDate = function (year) {
1683
- this.endDate = new Date("" + year + this.yearEndDate);
1684
- };
1685
- FinancialYear.prototype.getPastMonths = function () {
1686
- var months = [];
1687
- var now = new Date();
1688
- var endDate = this.endDate < now ? this.endDate : now;
1689
- for (var d = this.startDate; d <= endDate; d.setMonth(d.getMonth() + 1)) {
1690
- months.push(d.getMonth());
1691
- }
1692
- return months;
1693
- };
1694
- return FinancialYear;
1695
- }());
1696
- FinancialYear.weeksInYear = 52;
1697
- FinancialYear.startMonthIndex = 6;
1698
-
1699
1550
  /**
1700
1551
  * List of collections grouped by passed property
1701
1552
  */
@@ -1956,519 +1807,1013 @@
1956
1807
  return Collection;
1957
1808
  }());
1958
1809
 
1959
- var ExportDataTable = /** @class */ (function () {
1960
- function ExportDataTable() {
1961
- }
1962
- return ExportDataTable;
1963
- }());
1964
-
1965
- var ExportableCollection = /** @class */ (function (_super) {
1966
- __extends(ExportableCollection, _super);
1967
- function ExportableCollection() {
1968
- return _super !== null && _super.apply(this, arguments) || this;
1969
- }
1970
- ExportableCollection.prototype.getExportFooter = function (type) {
1971
- return [];
1972
- };
1973
- ;
1974
- ExportableCollection.prototype.export = function (type) {
1975
- return classTransformer.plainToClass(ExportDataTable, {
1976
- header: this.getExportHeader(type),
1977
- body: this.getExportBody(type),
1978
- footer: [this.getExportFooter(type)]
1979
- });
1980
- };
1981
- return ExportableCollection;
1982
- }(Collection));
1810
+ exports.BankAccountTypeEnum = void 0;
1811
+ (function (BankAccountTypeEnum) {
1812
+ BankAccountTypeEnum[BankAccountTypeEnum["TRANSACTION"] = 1] = "TRANSACTION";
1813
+ BankAccountTypeEnum[BankAccountTypeEnum["SAVINGS"] = 2] = "SAVINGS";
1814
+ BankAccountTypeEnum[BankAccountTypeEnum["CREDIT_CARD"] = 3] = "CREDIT_CARD";
1815
+ // @TODO Alex: should be removed by backend (TT-2107)
1816
+ // MORTGAGE = 4,
1817
+ BankAccountTypeEnum[BankAccountTypeEnum["LOAN"] = 5] = "LOAN";
1818
+ BankAccountTypeEnum[BankAccountTypeEnum["INVESTMENT"] = 6] = "INVESTMENT";
1819
+ BankAccountTypeEnum[BankAccountTypeEnum["TERM_DEPOSIT"] = 7] = "TERM_DEPOSIT";
1820
+ BankAccountTypeEnum[BankAccountTypeEnum["OFFSET"] = 10] = "OFFSET";
1821
+ })(exports.BankAccountTypeEnum || (exports.BankAccountTypeEnum = {}));
1983
1822
 
1984
- /**
1985
- * export table column
1986
- */
1987
- var ExportCell = /** @class */ (function () {
1988
- function ExportCell() {
1989
- }
1990
- return ExportCell;
1991
- }());
1823
+ var TYPE_LOAN = [
1824
+ exports.BankAccountTypeEnum.CREDIT_CARD,
1825
+ exports.BankAccountTypeEnum.LOAN
1826
+ ];
1992
1827
 
1993
1828
  /**
1994
- * type of export table column value
1829
+ * Collection of bank accounts.
1995
1830
  */
1996
- var ExportCellTypeEnum;
1997
- (function (ExportCellTypeEnum) {
1998
- ExportCellTypeEnum[ExportCellTypeEnum["STRING"] = 0] = "STRING";
1999
- ExportCellTypeEnum[ExportCellTypeEnum["CURRENCY"] = 1] = "CURRENCY";
2000
- ExportCellTypeEnum[ExportCellTypeEnum["DATE"] = 2] = "DATE";
2001
- })(ExportCellTypeEnum || (ExportCellTypeEnum = {}));
2002
-
2003
- var LoanPaymentCollection = /** @class */ (function (_super) {
2004
- __extends(LoanPaymentCollection, _super);
2005
- function LoanPaymentCollection() {
1831
+ var BankAccountCollection = /** @class */ (function (_super) {
1832
+ __extends(BankAccountCollection, _super);
1833
+ function BankAccountCollection() {
2006
1834
  return _super !== null && _super.apply(this, arguments) || this;
2007
1835
  }
2008
- LoanPaymentCollection.prototype.getExportHeader = function () {
2009
- return [
2010
- 'Pmt No.',
2011
- 'Date',
2012
- 'Payment Due',
2013
- 'Interest Accrued',
2014
- 'Principal Paid',
2015
- 'Principal Balance',
2016
- 'Payout'
2017
- ];
2018
- };
2019
- LoanPaymentCollection.prototype.getExportBody = function () {
2020
- return this.items.map(function (payment) {
2021
- return [
2022
- classTransformer.plainToClass(ExportCell, { value: payment.number, type: ExportCellTypeEnum.STRING }),
2023
- classTransformer.plainToClass(ExportCell, { value: payment.date, type: ExportCellTypeEnum.DATE }),
2024
- classTransformer.plainToClass(ExportCell, { value: payment.paymentDue, type: ExportCellTypeEnum.CURRENCY }),
2025
- classTransformer.plainToClass(ExportCell, { value: payment.interestAccrued, type: ExportCellTypeEnum.CURRENCY }),
2026
- classTransformer.plainToClass(ExportCell, { value: payment.principalPaid, type: ExportCellTypeEnum.CURRENCY }),
2027
- classTransformer.plainToClass(ExportCell, { value: payment.principalBalance, type: ExportCellTypeEnum.CURRENCY }),
2028
- classTransformer.plainToClass(ExportCell, { value: payment.payout, type: ExportCellTypeEnum.CURRENCY }),
2029
- ];
1836
+ /**
1837
+ * get list of bank accounts with passed types
1838
+ */
1839
+ BankAccountCollection.prototype.getByType = function (types, isExclude) {
1840
+ if (isExclude === void 0) { isExclude = false; }
1841
+ // get types always as array (if only one passed)
1842
+ var typesArray = concat__default["default"](types);
1843
+ return this.items.filter(function (bankAccount) {
1844
+ if (isExclude) {
1845
+ return !typesArray.includes(bankAccount.type);
1846
+ }
1847
+ return typesArray.includes(bankAccount.type);
2030
1848
  });
2031
1849
  };
2032
- Object.defineProperty(LoanPaymentCollection.prototype, "paymentDue", {
1850
+ /**
1851
+ * get amount of initial loans
1852
+ */
1853
+ BankAccountCollection.prototype.getInitialLoanAmount = function () {
1854
+ return this.getByType(TYPE_LOAN)
1855
+ .reduce(function (sum, bankAccount) {
1856
+ return sum += bankAccount.balances.length ? bankAccount.getOpeningBalance() : 0;
1857
+ }, 0);
1858
+ };
1859
+ /**
1860
+ * get amount of current loans
1861
+ */
1862
+ BankAccountCollection.prototype.getCurrentLoanAmount = function () {
1863
+ return this.getByType(TYPE_LOAN)
1864
+ .reduce(function (sum, bankAccount) {
1865
+ return sum += bankAccount.currentBalance;
1866
+ }, 0);
1867
+ };
1868
+ /**
1869
+ * get collection filtered by property id
1870
+ */
1871
+ BankAccountCollection.prototype.getByPropertyId = function (id) {
1872
+ return new BankAccountCollection(this.items.filter(function (bankAccount) {
1873
+ return bankAccount.bankAccountProperties.find(function (bankAccountProperty) {
1874
+ return bankAccountProperty.property.id === id;
1875
+ });
1876
+ }));
1877
+ };
1878
+ /**
1879
+ * get collection filtered by properties ids
1880
+ */
1881
+ BankAccountCollection.prototype.getByPropertiesIds = function (ids) {
1882
+ return new BankAccountCollection(this.items.filter(function (bankAccount) {
1883
+ return bankAccount.bankAccountProperties.find(function (bankAccountProperty) {
1884
+ return ids.includes(bankAccountProperty.property.id);
1885
+ });
1886
+ }));
1887
+ };
1888
+ /**
1889
+ * get collection of active bank accounts
1890
+ */
1891
+ BankAccountCollection.prototype.getActiveBankAccounts = function () {
1892
+ return new BankAccountCollection(this.items.filter(function (bankAccount) {
1893
+ return bankAccount.isActive();
1894
+ }));
1895
+ };
1896
+ /**
1897
+ * get reduction of loan (reduction of principle) percentage
1898
+ */
1899
+ BankAccountCollection.prototype.getPrincipleReductionPercent = function () {
1900
+ var initialLoans = this.getInitialLoanAmount();
1901
+ var currentLoans = this.getCurrentLoanAmount();
1902
+ if (!initialLoans) {
1903
+ return 0;
1904
+ }
1905
+ return (initialLoans - currentLoans) / initialLoans * 100;
1906
+ };
1907
+ /**
1908
+ * Get collection of loan bank accounts
1909
+ */
1910
+ BankAccountCollection.prototype.getLoanAccounts = function () {
1911
+ return new BankAccountCollection(this.getByType(TYPE_LOAN));
1912
+ };
1913
+ BankAccountCollection.prototype.getSavingsAccounts = function () {
1914
+ return new BankAccountCollection(this.getByType(TYPE_LOAN, true));
1915
+ };
1916
+ BankAccountCollection.prototype.getOpeningBalance = function () {
1917
+ return this.items.reduce(function (sum, bankAccount) { return sum + bankAccount.getOpeningBalance(); }, 0);
1918
+ };
1919
+ Object.defineProperty(BankAccountCollection.prototype, "currentBalance", {
2033
1920
  get: function () {
2034
- return this.sumBy('paymentDue');
1921
+ return this.sumBy('currentBalance');
2035
1922
  },
2036
1923
  enumerable: false,
2037
1924
  configurable: true
2038
1925
  });
2039
- LoanPaymentCollection.prototype.getByFinYear = function (finYear) {
2040
- if (finYear === void 0) { finYear = new FinancialYear(); }
2041
- return this.filter(function (payment) {
2042
- return new Date(payment.date) >= finYear.startDate &&
2043
- new Date(payment.date) <= finYear.endDate;
2044
- });
2045
- };
2046
- LoanPaymentCollection.prototype.getForCurrentYear = function () {
2047
- return this.getByFinYear(new FinancialYear());
2048
- };
2049
- return LoanPaymentCollection;
2050
- }(ExportableCollection));
2051
-
2052
- var Loan = /** @class */ (function (_super) {
2053
- __extends(Loan, _super);
2054
- function Loan() {
2055
- return _super !== null && _super.apply(this, arguments) || this;
2056
- }
2057
1926
  /**
2058
- * Check if loan type is related to LoanVehicleTypeEnum
1927
+ * Get Collection of bank accounts with property tank type
2059
1928
  */
2060
- Loan.prototype.isVehicle = function () {
2061
- return !this.bankAccount && this.type in exports.LoanVehicleTypeEnum;
1929
+ BankAccountCollection.prototype.getPropertyBankAccounts = function () {
1930
+ return new BankAccountCollection(this.items.filter(function (bankAccount) { return bankAccount.isPropertyTank(); }));
2062
1931
  };
2063
1932
  /**
2064
- * Get the last payment for passed financial year
2065
- * @param year financial year for filter
1933
+ * Get Collection of bank accounts with work tank type
2066
1934
  */
2067
- Loan.prototype.getLastPaymentByYear = function (year) {
2068
- var finYear = new FinancialYear(new Date(year.toString()));
2069
- return last__default["default"](this.payments.filter(function (payment) { return payment.date > finYear.startDate && payment.date < finYear.endDate; }));
1935
+ BankAccountCollection.prototype.getWorkBankAccounts = function () {
1936
+ return new BankAccountCollection(this.items.filter(function (bankAccount) { return bankAccount.isWorkTank(); }));
2070
1937
  };
2071
1938
  /**
2072
- * The size of loan interest
2073
- * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/212369955/Loans+vehicle+loans
2074
- * @TODO Vik/Nicole: need to update documentation. Derek gave the right formulas to Mikhail
1939
+ * Get Collection of bank accounts by tank type
2075
1940
  */
2076
- Loan.prototype.getInterest = function () {
2077
- return new LoanPaymentCollection(this.payments).paymentDue - this.amount;
1941
+ BankAccountCollection.prototype.getByTankType = function (tankType) {
1942
+ return new BankAccountCollection(this.items.filter(function (bankAccount) { return bankAccount.tankType === tankType; }));
2078
1943
  };
2079
1944
  /**
2080
- * The last payment size
2081
- * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/212369955/Loans+vehicle+loans
2082
- * @TODO Vik/Nicole: need to update documentation. Derek gave the right formulas to Mikhail
1945
+ * Get list of all bank account properties
2083
1946
  */
2084
- Loan.prototype.getBalloonPayment = function () {
2085
- var lastPaymentDueAmount = new LoanPaymentCollection(this.payments).last.paymentDue;
2086
- return (lastPaymentDueAmount - this.repaymentAmount) > 0 ? lastPaymentDueAmount - this.repaymentAmount : 0;
1947
+ BankAccountCollection.prototype.getBankAccountPropertiesList = function () {
1948
+ return flatten__default["default"](this.items.map(function (bankAccount) {
1949
+ return bankAccount.bankAccountProperties;
1950
+ }));
2087
1951
  };
2088
1952
  /**
2089
- * Percent of ballon payment from all payments
2090
- * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/212369955/Loans+vehicle+loans
2091
- * @TODO Vik/Nicole: need to update documentation. Derek gave the right formulas to Mikhail
1953
+ * Get lis of unique properties from all bank accounts properties
2092
1954
  */
2093
- Loan.prototype.getBalloonPaymentPercentage = function () {
2094
- return this.getBalloonPayment() / new LoanPaymentCollection(this.payments).paymentDue * 100;
1955
+ BankAccountCollection.prototype.getProperties = function () {
1956
+ return uniqBy__default["default"](this.getBankAccountPropertiesList().map(function (bankAccountProperty) {
1957
+ return bankAccountProperty.property;
1958
+ }), 'id');
2095
1959
  };
2096
- return Loan;
2097
- }(Loan$1));
1960
+ BankAccountCollection.prototype.getPropertyBalanceAmount = function (propertyId) {
1961
+ return this.items.reduce(function (sum, bankAccount) {
1962
+ return sum + bankAccount.getPropertyBalanceAmount(propertyId);
1963
+ }, 0);
1964
+ };
1965
+ return BankAccountCollection;
1966
+ }(Collection));
1967
+
1968
+ var UserEventTypeTypeEnum;
1969
+ (function (UserEventTypeTypeEnum) {
1970
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["REGISTERED"] = 1000] = "REGISTERED";
1971
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["PASSWORD_RESET_REQUEST"] = 1001] = "PASSWORD_RESET_REQUEST";
1972
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["APP_FEATURES"] = 1010] = "APP_FEATURES";
1973
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["SUBSCRIBED"] = 2000] = "SUBSCRIBED";
1974
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["UNSUBSCRIBED"] = 2001] = "UNSUBSCRIBED";
1975
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["SUBSCRIPTION_UPDATE"] = 2004] = "SUBSCRIPTION_UPDATE";
1976
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["SUBSCRIPTION_TRIAL_UPDATE"] = 2005] = "SUBSCRIPTION_TRIAL_UPDATE";
1977
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["SUBSCRIPTION_PAYMENT_FAILED"] = 2006] = "SUBSCRIPTION_PAYMENT_FAILED";
1978
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE"] = 2010] = "CLIENT_INVITE";
1979
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE_TO_REGISTER"] = 2011] = "CLIENT_INVITE_TO_REGISTER";
1980
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_INVITE_ACCEPTED"] = 2012] = "FIRM_INVITE_ACCEPTED";
1981
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_INVITE_REJECTED"] = 2013] = "FIRM_INVITE_REJECTED";
1982
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_INVITE_REGISTERED"] = 2014] = "FIRM_INVITE_REGISTERED";
1983
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_INVITE"] = 2020] = "PROPERTY_SHARE_INVITE";
1984
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_INVITE_TO_REGISTER"] = 2021] = "PROPERTY_SHARE_INVITE_TO_REGISTER";
1985
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_INVITE_ACCEPTED"] = 2022] = "PROPERTY_SHARE_INVITE_ACCEPTED";
1986
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_INVITE_REJECTED"] = 2023] = "PROPERTY_SHARE_INVITE_REJECTED";
1987
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_INVITE_REGISTERED"] = 2024] = "PROPERTY_SHARE_INVITE_REGISTERED";
1988
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_CHANGE_REQUESTED"] = 2025] = "PROPERTY_SHARE_CHANGE_REQUESTED";
1989
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_CHANGE_ACCEPTED"] = 2026] = "PROPERTY_SHARE_CHANGE_ACCEPTED";
1990
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_CHANGE_REJECTED"] = 2027] = "PROPERTY_SHARE_CHANGE_REJECTED";
1991
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["OWNER_SUBSCRIBED"] = 2028] = "OWNER_SUBSCRIBED";
1992
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["OWNER_UNSUBSCRIBED"] = 2029] = "OWNER_UNSUBSCRIBED";
1993
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["BASIQ_NEW_ACCOUNTS"] = 2030] = "BASIQ_NEW_ACCOUNTS";
1994
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["BASIQ_FIRST_IMPORT_COMPLETE"] = 2031] = "BASIQ_FIRST_IMPORT_COMPLETE";
1995
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["BASIQ_AUTHORIZATION_FAIL"] = 2032] = "BASIQ_AUTHORIZATION_FAIL";
1996
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["TRANSACTION_ALLOCATE_REMINDER"] = 2033] = "TRANSACTION_ALLOCATE_REMINDER";
1997
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["REGISTRATION_INVITE"] = 2040] = "REGISTRATION_INVITE";
1998
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["REGISTRATION_INVITE_ACCEPTED"] = 2041] = "REGISTRATION_INVITE_ACCEPTED";
1999
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_EMAIL_CONFIRMED"] = 2050] = "CLIENT_EMAIL_CONFIRMED";
2000
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["TAX_REVIEW_REQUESTED"] = 2060] = "TAX_REVIEW_REQUESTED";
2001
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_INVITE_TO_REGISTER"] = 3000] = "FIRM_INVITE_TO_REGISTER";
2002
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_INVITE"] = 3001] = "FIRM_INVITE";
2003
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE_ACCEPTED"] = 3002] = "CLIENT_INVITE_ACCEPTED";
2004
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE_REJECTED"] = 3003] = "CLIENT_INVITE_REJECTED";
2005
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE_REGISTERED"] = 3004] = "CLIENT_INVITE_REGISTERED";
2006
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_NEW_CLIENT"] = 3005] = "FIRM_NEW_CLIENT";
2007
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_LOST_CLIENT"] = 3006] = "FIRM_LOST_CLIENT";
2008
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_INVITE"] = 3010] = "EMPLOYEE_INVITE";
2009
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_LOST_CLIENT"] = 3011] = "EMPLOYEE_LOST_CLIENT";
2010
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_NEW_CLIENT"] = 3012] = "EMPLOYEE_NEW_CLIENT";
2011
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_INVITE_ACCEPTED"] = 3013] = "EMPLOYEE_INVITE_ACCEPTED";
2012
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_EMAIL_CONFIRMED"] = 3020] = "EMPLOYEE_EMAIL_CONFIRMED";
2013
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["TAX_REVIEW_RECEIVED"] = 3030] = "TAX_REVIEW_RECEIVED";
2014
+ })(UserEventTypeTypeEnum || (UserEventTypeTypeEnum = {}));
2015
+
2098
2016
  /**
2099
- * 30 years is default mortgage term
2017
+ * any event happened in the app, which needs to be handled somehow (distributed to other part of the app)
2100
2018
  */
2101
- Loan.mortgageDefaultTerm = 360;
2019
+ var AppEvent = /** @class */ (function () {
2020
+ function AppEvent(type, payload) {
2021
+ this.type = type;
2022
+ this.payload = payload;
2023
+ }
2024
+ return AppEvent;
2025
+ }());
2026
+
2102
2027
  /**
2103
- * 5 years is default bank loan term
2028
+ * Class describe configuration options for basiq connect control
2029
+ * https://www.npmjs.com/package/@basiq/basiq-connect-control
2104
2030
  */
2105
- Loan.loanDefaultTerm = 60;
2106
- __decorate([
2107
- classTransformer.Type(function () { return LoanPayment; })
2108
- ], Loan.prototype, "payments", void 0);
2109
- __decorate([
2110
- classTransformer.Type(function () { return Date; })
2111
- ], Loan.prototype, "commencementDate", void 0);
2112
- __decorate([
2113
- classTransformer.Type(function () { return LoanPayout; })
2114
- ], Loan.prototype, "payout", void 0);
2115
-
2116
- exports.TankTypeEnum = void 0;
2117
- (function (TankTypeEnum) {
2118
- TankTypeEnum[TankTypeEnum["PROPERTY"] = 1] = "PROPERTY";
2119
- TankTypeEnum[TankTypeEnum["WORK"] = 2] = "WORK";
2120
- TankTypeEnum[TankTypeEnum["OTHER"] = 3] = "OTHER";
2121
- TankTypeEnum[TankTypeEnum["SOLE"] = 4] = "SOLE";
2122
- })(exports.TankTypeEnum || (exports.TankTypeEnum = {}));
2123
-
2124
- var BankAccountBalance = /** @class */ (function (_super) {
2125
- __extends(BankAccountBalance, _super);
2126
- function BankAccountBalance() {
2127
- return _super !== null && _super.apply(this, arguments) || this;
2031
+ var BasiqConfig = /** @class */ (function () {
2032
+ function BasiqConfig(options) {
2033
+ // ID of the DOM element to which Basiq Connect Control will be rendered;
2034
+ this.containerId = 'basiq-control';
2035
+ Object.assign(this, options);
2128
2036
  }
2129
- return BankAccountBalance;
2130
- }(AbstractModel));
2037
+ return BasiqConfig;
2038
+ }());
2131
2039
 
2132
- var BankAccountProperty$1 = /** @class */ (function (_super) {
2133
- __extends(BankAccountProperty, _super);
2134
- function BankAccountProperty() {
2135
- return _super !== null && _super.apply(this, arguments) || this;
2136
- }
2137
- return BankAccountProperty;
2138
- }(AbstractModel));
2040
+ var AbstractModel = /** @class */ (function () {
2041
+ function AbstractModel() {
2042
+ }
2043
+ AbstractModel.prototype.hasValue = function (value, path) {
2044
+ if (path === void 0) { path = 'id'; }
2045
+ return get__default["default"](path) === value;
2046
+ };
2047
+ return AbstractModel;
2048
+ }());
2139
2049
 
2140
- var Property$1 = /** @class */ (function (_super) {
2141
- __extends(Property, _super);
2142
- function Property() {
2050
+ var BasiqJob$1 = /** @class */ (function (_super) {
2051
+ __extends(BasiqJob, _super);
2052
+ function BasiqJob() {
2143
2053
  return _super !== null && _super.apply(this, arguments) || this;
2144
2054
  }
2145
- return Property;
2055
+ return BasiqJob;
2146
2056
  }(AbstractModel));
2147
2057
 
2148
- var PropertySubscription$1 = /** @class */ (function (_super) {
2149
- __extends(PropertySubscription, _super);
2150
- function PropertySubscription() {
2058
+ var BasiqJob = /** @class */ (function (_super) {
2059
+ __extends(BasiqJob, _super);
2060
+ function BasiqJob() {
2151
2061
  return _super !== null && _super.apply(this, arguments) || this;
2152
2062
  }
2153
- return PropertySubscription;
2154
- }(AbstractModel));
2063
+ return BasiqJob;
2064
+ }(BasiqJob$1));
2155
2065
 
2156
- var User$1 = /** @class */ (function (_super) {
2157
- __extends(User, _super);
2158
- function User() {
2159
- return _super !== null && _super.apply(this, arguments) || this;
2066
+ var BasiqJobStep = /** @class */ (function () {
2067
+ function BasiqJobStep() {
2160
2068
  }
2161
- return User;
2162
- }(AbstractModel));
2069
+ BasiqJobStep.prototype.isVerifyCredentials = function () {
2070
+ return this.title === 'verify-credentials';
2071
+ };
2072
+ BasiqJobStep.prototype.isInProgress = function () {
2073
+ return this.status === 'in-progress';
2074
+ };
2075
+ BasiqJobStep.prototype.isSuccess = function () {
2076
+ return this.status === 'success';
2077
+ };
2078
+ return BasiqJobStep;
2079
+ }());
2163
2080
 
2164
- exports.UserStatusEnum = void 0;
2165
- (function (UserStatusEnum) {
2166
- UserStatusEnum[UserStatusEnum["INACTIVE"] = 0] = "INACTIVE";
2167
- UserStatusEnum[UserStatusEnum["ON_BOARDING"] = 1] = "ON_BOARDING";
2168
- UserStatusEnum[UserStatusEnum["ACTIVE"] = 2] = "ACTIVE";
2169
- })(exports.UserStatusEnum || (exports.UserStatusEnum = {}));
2081
+ var BasiqJobResponse = /** @class */ (function () {
2082
+ function BasiqJobResponse() {
2083
+ }
2084
+ BasiqJobResponse.prototype.getVerifyCredentialsStep = function () {
2085
+ return this.steps.find(function (step) { return step.isVerifyCredentials(); });
2086
+ };
2087
+ return BasiqJobResponse;
2088
+ }());
2089
+ __decorate([
2090
+ classTransformer.Type(function () { return BasiqJobStep; })
2091
+ ], BasiqJobResponse.prototype, "steps", void 0);
2170
2092
 
2171
- exports.UserRolesEnum = void 0;
2172
- (function (UserRolesEnum) {
2173
- UserRolesEnum["FIRM_OWNER"] = "ROLE_FIRM_OWNER";
2174
- UserRolesEnum["FIRM_MANAGER"] = "ROLE_FIRM_MANAGER";
2175
- UserRolesEnum["CLIENT"] = "ROLE_CLIENT";
2176
- UserRolesEnum["EMPLOYEE"] = "ROLE_EMPLOYEE";
2177
- UserRolesEnum["ACCOUNTANT"] = "ROLE_ACCOUNTANT";
2178
- UserRolesEnum["ADVISOR"] = "ROLE_ADVISOR";
2179
- UserRolesEnum["USER"] = "ROLE_USER";
2180
- UserRolesEnum["SUBSCRIPTION"] = "ROLE_USER_SUBSCRIPTION";
2181
- UserRolesEnum["WORK_TANK"] = "ROLE_USER_WORK";
2182
- UserRolesEnum["PROPERTY_TANK"] = "ROLE_USER_PROPERTY";
2183
- UserRolesEnum["SOLE_TANK"] = "ROLE_USER_SOLE";
2184
- UserRolesEnum["SWITCH_USER"] = "ROLE_PREVIOUS_ADMIN";
2185
- })(exports.UserRolesEnum || (exports.UserRolesEnum = {}));
2093
+ /**
2094
+ * access token, needed to access basiq connect ui (https://github.com/basiqio/basiq-connect-ui)
2095
+ */
2096
+ var BasiqToken = /** @class */ (function () {
2097
+ function BasiqToken(value, expiresAt) {
2098
+ this.value = value;
2099
+ this.expiresAt = expiresAt;
2100
+ }
2101
+ BasiqToken.prototype.isExpired = function () {
2102
+ return this.expiresAt < new Date();
2103
+ };
2104
+ return BasiqToken;
2105
+ }());
2186
2106
 
2187
- var Address$1 = /** @class */ (function (_super) {
2188
- __extends(Address, _super);
2189
- function Address() {
2107
+ var Bank$1 = /** @class */ (function (_super) {
2108
+ __extends(Bank, _super);
2109
+ function Bank() {
2190
2110
  return _super !== null && _super.apply(this, arguments) || this;
2191
2111
  }
2192
- return Address;
2112
+ return Bank;
2193
2113
  }(AbstractModel));
2194
2114
 
2195
- var Country$1 = /** @class */ (function (_super) {
2196
- __extends(Country, _super);
2197
- function Country() {
2198
- return _super !== null && _super.apply(this, arguments) || this;
2115
+ var BankPopularEnum;
2116
+ (function (BankPopularEnum) {
2117
+ BankPopularEnum["BANKWEST"] = "Bank of Western Australia trading as BankWest";
2118
+ BankPopularEnum["ANZ"] = "Australia and New Zealand Banking Group Limited";
2119
+ BankPopularEnum["CBA"] = "Commonwealth Bank Australia";
2120
+ BankPopularEnum["WESTPAC"] = "Westpac Banking Corporation";
2121
+ BankPopularEnum["BENDIGO"] = "Bendigo and Adelaide Bank Limited";
2122
+ BankPopularEnum["ING_DIRECT"] = "ING Bank (Australia) Limited (trading as ING Direct)";
2123
+ BankPopularEnum["ST_GEORGE"] = "St. George Bank (a subsidiary of Westpac)";
2124
+ BankPopularEnum["SUNCORP"] = "Suncorp-Metway Limited";
2125
+ BankPopularEnum["CITIBANK"] = "Citibank";
2126
+ BankPopularEnum["BOQ"] = "Bank of Queensland Limited";
2127
+ })(BankPopularEnum || (BankPopularEnum = {}));
2128
+
2129
+ /**
2130
+ * Bank subclass, average bank response time for some operations in milliseconds
2131
+ * Used for basiq banks functionality to improve bank login UI/UX (loading progress)
2132
+ */
2133
+ var BankExternalStats = /** @class */ (function () {
2134
+ function BankExternalStats() {
2199
2135
  }
2200
- return Country;
2201
- }(AbstractModel));
2136
+ return BankExternalStats;
2137
+ }());
2202
2138
 
2203
- var Country = /** @class */ (function (_super) {
2204
- __extends(Country, _super);
2205
- function Country() {
2139
+ var Bank = /** @class */ (function (_super) {
2140
+ __extends(Bank, _super);
2141
+ function Bank() {
2206
2142
  return _super !== null && _super.apply(this, arguments) || this;
2207
2143
  }
2208
- Object.defineProperty(Country.prototype, "countryWithCode", {
2209
- /**
2210
- * Return country name with phone code
2211
- */
2212
- get: function () {
2213
- return this.name + " (+" + this.callingCode + ")";
2214
- },
2215
- enumerable: false,
2216
- configurable: true
2217
- });
2218
- /**
2219
- * Check if country calling code is Australian or not
2220
- */
2221
- Country.prototype.isAustralianCode = function () {
2222
- return this.callingCode === '61';
2144
+ Bank.prototype.getPhotoPlaceholder = function () {
2145
+ return this.name[0] + this.name[1];
2223
2146
  };
2224
- return Country;
2225
- }(Country$1));
2226
-
2227
- exports.AddressTypeEnum = void 0;
2228
- (function (AddressTypeEnum) {
2229
- AddressTypeEnum[AddressTypeEnum["STREET"] = 1] = "STREET";
2230
- AddressTypeEnum[AddressTypeEnum["POSTAL"] = 2] = "POSTAL";
2231
- })(exports.AddressTypeEnum || (exports.AddressTypeEnum = {}));
2232
-
2233
- var Address = /** @class */ (function (_super) {
2234
- __extends(Address, _super);
2235
- function Address() {
2236
- var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
2237
- _this.type = exports.AddressTypeEnum.STREET;
2238
- return _this;
2239
- }
2240
- Address.prototype.toString = function () {
2241
- return [this.unitNumber, this.address, this.city, this.state, this.postcode].filter(Boolean).join(', ');
2147
+ Bank.prototype.getPhoto = function () {
2148
+ if (!this.logo) {
2149
+ return null;
2150
+ }
2151
+ return this.logo.includes('http') ? "" + this.logo : localStorage.getItem('api_uri') + "/" + this.logo;
2242
2152
  };
2243
- Object.defineProperty(Address.prototype, "name", {
2244
- get: function () {
2245
- return "" + (this.unitNumber ? this.unitNumber + '/' : '') + this.address;
2246
- },
2247
- enumerable: false,
2248
- configurable: true
2249
- });
2250
- Object.defineProperty(Address.prototype, "nameLong", {
2251
- get: function () {
2252
- return this.name + ", " + this.city + ", " + this.state;
2253
- },
2254
- enumerable: false,
2255
- configurable: true
2256
- });
2257
- return Address;
2258
- }(Address$1));
2153
+ return Bank;
2154
+ }(Bank$1));
2259
2155
  __decorate([
2260
- classTransformer.Type((function () { return Country; }))
2261
- ], Address.prototype, "country", void 0);
2262
-
2263
- var _a$4;
2264
- var USER_WORK_POSITION = (_a$4 = {},
2265
- _a$4[exports.UserRolesEnum.EMPLOYEE] = 'Employee',
2266
- _a$4[exports.UserRolesEnum.FIRM_MANAGER] = 'Manager',
2267
- _a$4[exports.UserRolesEnum.FIRM_OWNER] = 'Firm Owner',
2268
- _a$4);
2156
+ classTransformer.Transform(function (_a) {
2157
+ var value = _a.value;
2158
+ return value ? value.replace(' ', '%20') : null;
2159
+ })
2160
+ ], Bank.prototype, "logo", void 0);
2161
+ __decorate([
2162
+ classTransformer.Transform(function (_a) {
2163
+ var obj = _a.obj;
2164
+ return Object.values(BankPopularEnum).includes(obj.name);
2165
+ }),
2166
+ classTransformer.Expose()
2167
+ ], Bank.prototype, "isPopular", void 0);
2168
+ __decorate([
2169
+ classTransformer.Type(function () { return BankExternalStats; })
2170
+ ], Bank.prototype, "externalStats", void 0);
2269
2171
 
2270
- var ClientDetails$1 = /** @class */ (function (_super) {
2271
- __extends(ClientDetails, _super);
2272
- function ClientDetails() {
2172
+ var BankAccount$1 = /** @class */ (function (_super) {
2173
+ __extends(BankAccount, _super);
2174
+ function BankAccount() {
2273
2175
  return _super !== null && _super.apply(this, arguments) || this;
2274
2176
  }
2275
- return ClientDetails;
2177
+ return BankAccount;
2276
2178
  }(AbstractModel));
2277
2179
 
2278
- var ClientDetails = /** @class */ (function (_super) {
2279
- __extends(ClientDetails, _super);
2280
- function ClientDetails() {
2281
- return _super !== null && _super.apply(this, arguments) || this;
2282
- }
2283
- return ClientDetails;
2284
- }(ClientDetails$1));
2180
+ exports.BankAccountStatusEnum = void 0;
2181
+ (function (BankAccountStatusEnum) {
2182
+ BankAccountStatusEnum[BankAccountStatusEnum["INACTIVE"] = 0] = "INACTIVE";
2183
+ BankAccountStatusEnum[BankAccountStatusEnum["ACTIVE"] = 1] = "ACTIVE";
2184
+ })(exports.BankAccountStatusEnum || (exports.BankAccountStatusEnum = {}));
2285
2185
 
2286
- var EmployeeDetails$1 = /** @class */ (function (_super) {
2287
- __extends(EmployeeDetails, _super);
2288
- function EmployeeDetails() {
2186
+ var Loan$1 = /** @class */ (function (_super) {
2187
+ __extends(Loan, _super);
2188
+ function Loan() {
2289
2189
  return _super !== null && _super.apply(this, arguments) || this;
2290
2190
  }
2291
- return EmployeeDetails;
2191
+ return Loan;
2292
2192
  }(AbstractModel));
2293
2193
 
2294
- var Firm$1 = /** @class */ (function (_super) {
2295
- __extends(Firm, _super);
2296
- function Firm() {
2194
+ exports.LoanVehicleTypeEnum = void 0;
2195
+ (function (LoanVehicleTypeEnum) {
2196
+ LoanVehicleTypeEnum[LoanVehicleTypeEnum["AUTO_LOAN"] = 6] = "AUTO_LOAN";
2197
+ LoanVehicleTypeEnum[LoanVehicleTypeEnum["CHATTEL_MORTGAGE"] = 9] = "CHATTEL_MORTGAGE";
2198
+ LoanVehicleTypeEnum[LoanVehicleTypeEnum["COMMERCIAL_HIRE_PURCHASE"] = 10] = "COMMERCIAL_HIRE_PURCHASE";
2199
+ })(exports.LoanVehicleTypeEnum || (exports.LoanVehicleTypeEnum = {}));
2200
+
2201
+ // @Todo no base model from backend list
2202
+ /**
2203
+ * Loan payment class
2204
+ */
2205
+ var LoanPayment = /** @class */ (function (_super) {
2206
+ __extends(LoanPayment, _super);
2207
+ function LoanPayment() {
2297
2208
  return _super !== null && _super.apply(this, arguments) || this;
2298
2209
  }
2299
- return Firm;
2210
+ return LoanPayment;
2300
2211
  }(AbstractModel));
2212
+ __decorate([
2213
+ classTransformer.Type(function () { return Date; })
2214
+ ], LoanPayment.prototype, "date", void 0);
2301
2215
 
2302
- var Phone$1 = /** @class */ (function (_super) {
2303
- __extends(Phone, _super);
2304
- function Phone() {
2216
+ var LoanPayout$1 = /** @class */ (function (_super) {
2217
+ __extends(LoanPayout, _super);
2218
+ function LoanPayout() {
2305
2219
  return _super !== null && _super.apply(this, arguments) || this;
2306
2220
  }
2307
- return Phone;
2221
+ return LoanPayout;
2308
2222
  }(AbstractModel));
2309
2223
 
2310
- exports.PhoneTypeEnum = void 0;
2311
- (function (PhoneTypeEnum) {
2312
- PhoneTypeEnum[PhoneTypeEnum["MOBILE"] = 1] = "MOBILE";
2313
- PhoneTypeEnum[PhoneTypeEnum["OFFICE"] = 2] = "OFFICE";
2314
- })(exports.PhoneTypeEnum || (exports.PhoneTypeEnum = {}));
2315
-
2316
- var Phone = /** @class */ (function (_super) {
2317
- __extends(Phone, _super);
2318
- function Phone() {
2319
- var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
2320
- _this.type = exports.PhoneTypeEnum.MOBILE;
2321
- return _this;
2322
- }
2323
- Phone.prototype.toString = function () {
2324
- return "+" + this.country.callingCode + " " + this.number;
2325
- };
2326
- return Phone;
2327
- }(Phone$1));
2224
+ exports.LoanPayoutTypeEnum = void 0;
2225
+ (function (LoanPayoutTypeEnum) {
2226
+ LoanPayoutTypeEnum[LoanPayoutTypeEnum["REFINANCE"] = 1] = "REFINANCE";
2227
+ LoanPayoutTypeEnum[LoanPayoutTypeEnum["PAYOUT"] = 2] = "PAYOUT";
2228
+ })(exports.LoanPayoutTypeEnum || (exports.LoanPayoutTypeEnum = {}));
2328
2229
 
2329
- var Firm = /** @class */ (function (_super) {
2330
- __extends(Firm, _super);
2331
- function Firm() {
2230
+ var LoanPayout = /** @class */ (function (_super) {
2231
+ __extends(LoanPayout, _super);
2232
+ function LoanPayout() {
2332
2233
  return _super !== null && _super.apply(this, arguments) || this;
2333
2234
  }
2334
2235
  /**
2335
- * get firm photo link
2236
+ * Check if payout type is refinance
2336
2237
  */
2337
- Firm.prototype.getPhoto = function () {
2338
- return this.photo;
2238
+ LoanPayout.prototype.isRefinance = function () {
2239
+ return this.type === exports.LoanPayoutTypeEnum.REFINANCE;
2240
+ };
2241
+ return LoanPayout;
2242
+ }(LoanPayout$1));
2243
+
2244
+ var FinancialYear = /** @class */ (function () {
2245
+ function FinancialYear(date) {
2246
+ this.yearStartDate = '-07-01';
2247
+ this.yearEndDate = '-06-30';
2248
+ if (date) {
2249
+ this.year = date instanceof Date ? FinancialYear.toFinYear(date) : date;
2250
+ }
2251
+ else {
2252
+ this.year = +localStorage.getItem('financialYear') || FinancialYear.toFinYear(new Date());
2253
+ }
2254
+ this.setStartDate(this.year);
2255
+ this.setEndDate(this.year);
2256
+ }
2257
+ FinancialYear.prototype.includes = function (date) {
2258
+ return this.year === new FinancialYear(date).year;
2259
+ };
2260
+ FinancialYear.toFinYear = function (date) {
2261
+ return date.getFullYear() + (date.getMonth() >= this.startMonthIndex ? 1 : 0);
2339
2262
  };
2263
+ Object.defineProperty(FinancialYear.prototype, "prevFinYear", {
2264
+ get: function () {
2265
+ return new FinancialYear(new Date("" + (new Date().getFullYear() - 1) + this.yearStartDate));
2266
+ },
2267
+ enumerable: false,
2268
+ configurable: true
2269
+ });
2340
2270
  /**
2341
- * get firm initials
2271
+ * Get date by desired month
2342
2272
  */
2343
- Firm.prototype.getPhotoPlaceholder = function () {
2344
- return "" + this.name[0].toUpperCase() + this.name[1];
2273
+ FinancialYear.prototype.getMonthDate = function (monthIndex) {
2274
+ if (monthIndex >= FinancialYear.startMonthIndex) {
2275
+ return new Date(this.year - 1 + "-" + (monthIndex + 1) + "-01");
2276
+ }
2277
+ return new Date(this.year + "-" + (monthIndex + 1) + "-01");
2345
2278
  };
2346
- return Firm;
2347
- }(Firm$1));
2348
- __decorate([
2349
- classTransformer.Type(function () { return User; })
2350
- ], Firm.prototype, "owner", void 0);
2351
- __decorate([
2352
- classTransformer.Type(function () { return Address; })
2353
- ], Firm.prototype, "address", void 0);
2354
- __decorate([
2355
- classTransformer.Type(function () { return Phone; })
2356
- ], Firm.prototype, "phone", void 0);
2357
-
2358
- var EmployeeDetails = /** @class */ (function (_super) {
2359
- __extends(EmployeeDetails, _super);
2360
- function EmployeeDetails() {
2361
- return _super !== null && _super.apply(this, arguments) || this;
2362
- }
2363
- return EmployeeDetails;
2364
- }(EmployeeDetails$1));
2365
- __decorate([
2366
- classTransformer.Type(function () { return Firm; })
2367
- ], EmployeeDetails.prototype, "firm", void 0);
2368
-
2369
- var ServiceSubscription$1 = /** @class */ (function (_super) {
2370
- __extends(ServiceSubscription, _super);
2371
- function ServiceSubscription() {
2372
- return _super !== null && _super.apply(this, arguments) || this;
2373
- }
2374
- return ServiceSubscription;
2375
- }(AbstractModel));
2376
-
2377
- var ServiceSubscriptionItem$1 = /** @class */ (function (_super) {
2378
- __extends(ServiceSubscriptionItem, _super);
2379
- function ServiceSubscriptionItem() {
2380
- return _super !== null && _super.apply(this, arguments) || this;
2381
- }
2382
- return ServiceSubscriptionItem;
2383
- }(AbstractModel));
2384
-
2385
- var ServicePrice$1 = /** @class */ (function (_super) {
2386
- __extends(ServicePrice, _super);
2387
- function ServicePrice() {
2388
- return _super !== null && _super.apply(this, arguments) || this;
2389
- }
2390
- return ServicePrice;
2391
- }(AbstractModel));
2279
+ FinancialYear.prototype.setStartDate = function (year) {
2280
+ this.startDate = new Date("" + (year - 1) + this.yearStartDate);
2281
+ };
2282
+ FinancialYear.prototype.setEndDate = function (year) {
2283
+ this.endDate = new Date("" + year + this.yearEndDate);
2284
+ };
2285
+ FinancialYear.prototype.getPastMonths = function () {
2286
+ var months = [];
2287
+ var now = new Date();
2288
+ var endDate = this.endDate < now ? this.endDate : now;
2289
+ for (var d = this.startDate; d <= endDate; d.setMonth(d.getMonth() + 1)) {
2290
+ months.push(d.getMonth());
2291
+ }
2292
+ return months;
2293
+ };
2294
+ return FinancialYear;
2295
+ }());
2296
+ FinancialYear.weeksInYear = 52;
2297
+ FinancialYear.startMonthIndex = 6;
2392
2298
 
2393
- var ServiceProduct$1 = /** @class */ (function (_super) {
2394
- __extends(ServiceProduct, _super);
2395
- function ServiceProduct() {
2396
- return _super !== null && _super.apply(this, arguments) || this;
2299
+ var ExportDataTable = /** @class */ (function () {
2300
+ function ExportDataTable() {
2397
2301
  }
2398
- return ServiceProduct;
2399
- }(AbstractModel));
2400
-
2401
- exports.ServiceProductStatusEnum = void 0;
2402
- (function (ServiceProductStatusEnum) {
2403
- ServiceProductStatusEnum[ServiceProductStatusEnum["ARCHIVED"] = 0] = "ARCHIVED";
2404
- ServiceProductStatusEnum[ServiceProductStatusEnum["ACTIVE"] = 1] = "ACTIVE";
2405
- })(exports.ServiceProductStatusEnum || (exports.ServiceProductStatusEnum = {}));
2406
-
2407
- exports.ServiceProductIdEnum = void 0;
2408
- (function (ServiceProductIdEnum) {
2409
- ServiceProductIdEnum[ServiceProductIdEnum["WORK_TANK_OLD"] = 1] = "WORK_TANK_OLD";
2410
- ServiceProductIdEnum[ServiceProductIdEnum["PROPERTY_OLD"] = 2] = "PROPERTY_OLD";
2411
- ServiceProductIdEnum[ServiceProductIdEnum["PROPERTY_TANK"] = 3] = "PROPERTY_TANK";
2412
- ServiceProductIdEnum[ServiceProductIdEnum["WORK_TANK"] = 4] = "WORK_TANK";
2413
- ServiceProductIdEnum[ServiceProductIdEnum["PROPERTIES"] = 5] = "PROPERTIES";
2414
- ServiceProductIdEnum[ServiceProductIdEnum["SOLE_TANK"] = 6] = "SOLE_TANK";
2415
- })(exports.ServiceProductIdEnum || (exports.ServiceProductIdEnum = {}));
2302
+ return ExportDataTable;
2303
+ }());
2416
2304
 
2417
- var ServiceProduct = /** @class */ (function (_super) {
2418
- __extends(ServiceProduct, _super);
2419
- function ServiceProduct() {
2305
+ var ExportableCollection = /** @class */ (function (_super) {
2306
+ __extends(ExportableCollection, _super);
2307
+ function ExportableCollection() {
2420
2308
  return _super !== null && _super.apply(this, arguments) || this;
2421
2309
  }
2422
- ServiceProduct.prototype.isProperties = function () {
2423
- return [exports.ServiceProductIdEnum.PROPERTY_OLD, exports.ServiceProductIdEnum.PROPERTIES].includes(this.id);
2424
- };
2425
- ServiceProduct.prototype.isWorkTank = function () {
2426
- return [exports.ServiceProductIdEnum.WORK_TANK_OLD, exports.ServiceProductIdEnum.WORK_TANK].includes(this.id);
2427
- };
2428
- ServiceProduct.prototype.isSoleTank = function () {
2429
- return this.id === exports.ServiceProductIdEnum.SOLE_TANK;
2310
+ ExportableCollection.prototype.getExportFooter = function (type) {
2311
+ return [];
2430
2312
  };
2431
- ServiceProduct.prototype.isArchived = function () {
2432
- return this.status === exports.ServiceProductStatusEnum.ARCHIVED;
2313
+ ;
2314
+ ExportableCollection.prototype.export = function (type) {
2315
+ return classTransformer.plainToClass(ExportDataTable, {
2316
+ header: this.getExportHeader(type),
2317
+ body: this.getExportBody(type),
2318
+ footer: [this.getExportFooter(type)]
2319
+ });
2433
2320
  };
2434
- return ServiceProduct;
2435
- }(ServiceProduct$1));
2321
+ return ExportableCollection;
2322
+ }(Collection));
2436
2323
 
2437
- var ServicePrice = /** @class */ (function (_super) {
2438
- __extends(ServicePrice, _super);
2439
- function ServicePrice() {
2440
- return _super !== null && _super.apply(this, arguments) || this;
2324
+ /**
2325
+ * export table column
2326
+ */
2327
+ var ExportCell = /** @class */ (function () {
2328
+ function ExportCell() {
2441
2329
  }
2442
- ServicePrice.prototype.toSubscriptionItem = function () {
2443
- return classTransformer.plainToClass(ServiceSubscriptionItem, { price: this, quantity: this.product.minQty });
2444
- };
2445
- return ServicePrice;
2446
- }(ServicePrice$1));
2447
- __decorate([
2448
- classTransformer.Type(function () { return ServiceProduct; })
2449
- ], ServicePrice.prototype, "product", void 0);
2330
+ return ExportCell;
2331
+ }());
2450
2332
 
2451
2333
  /**
2452
- * backend bd doesn't support dynamic prices, as far as we have just one product like that we keep it hardcoded
2334
+ * type of export table column value
2453
2335
  */
2454
- var PROPERTY_TANK_PRICE = 9;
2455
- var ServiceSubscriptionItem = /** @class */ (function (_super) {
2456
- __extends(ServiceSubscriptionItem, _super);
2457
- function ServiceSubscriptionItem() {
2336
+ var ExportCellTypeEnum;
2337
+ (function (ExportCellTypeEnum) {
2338
+ ExportCellTypeEnum[ExportCellTypeEnum["STRING"] = 0] = "STRING";
2339
+ ExportCellTypeEnum[ExportCellTypeEnum["CURRENCY"] = 1] = "CURRENCY";
2340
+ ExportCellTypeEnum[ExportCellTypeEnum["DATE"] = 2] = "DATE";
2341
+ })(ExportCellTypeEnum || (ExportCellTypeEnum = {}));
2342
+
2343
+ var LoanPaymentCollection = /** @class */ (function (_super) {
2344
+ __extends(LoanPaymentCollection, _super);
2345
+ function LoanPaymentCollection() {
2458
2346
  return _super !== null && _super.apply(this, arguments) || this;
2459
2347
  }
2460
- Object.defineProperty(ServiceSubscriptionItem.prototype, "total", {
2348
+ LoanPaymentCollection.prototype.getExportHeader = function () {
2349
+ return [
2350
+ 'Pmt No.',
2351
+ 'Date',
2352
+ 'Payment Due',
2353
+ 'Interest Accrued',
2354
+ 'Principal Paid',
2355
+ 'Principal Balance',
2356
+ 'Payout'
2357
+ ];
2358
+ };
2359
+ LoanPaymentCollection.prototype.getExportBody = function () {
2360
+ return this.items.map(function (payment) {
2361
+ return [
2362
+ classTransformer.plainToClass(ExportCell, { value: payment.number, type: ExportCellTypeEnum.STRING }),
2363
+ classTransformer.plainToClass(ExportCell, { value: payment.date, type: ExportCellTypeEnum.DATE }),
2364
+ classTransformer.plainToClass(ExportCell, { value: payment.paymentDue, type: ExportCellTypeEnum.CURRENCY }),
2365
+ classTransformer.plainToClass(ExportCell, { value: payment.interestAccrued, type: ExportCellTypeEnum.CURRENCY }),
2366
+ classTransformer.plainToClass(ExportCell, { value: payment.principalPaid, type: ExportCellTypeEnum.CURRENCY }),
2367
+ classTransformer.plainToClass(ExportCell, { value: payment.principalBalance, type: ExportCellTypeEnum.CURRENCY }),
2368
+ classTransformer.plainToClass(ExportCell, { value: payment.payout, type: ExportCellTypeEnum.CURRENCY }),
2369
+ ];
2370
+ });
2371
+ };
2372
+ Object.defineProperty(LoanPaymentCollection.prototype, "paymentDue", {
2461
2373
  get: function () {
2462
- var price = this.price.amount * this.quantity;
2463
- if (this.price.product.id === exports.ServiceProductIdEnum.PROPERTIES) {
2464
- price += PROPERTY_TANK_PRICE;
2465
- }
2466
- return price;
2374
+ return this.sumBy('paymentDue');
2467
2375
  },
2468
2376
  enumerable: false,
2469
2377
  configurable: true
2470
2378
  });
2471
- return ServiceSubscriptionItem;
2379
+ LoanPaymentCollection.prototype.getByFinYear = function (finYear) {
2380
+ if (finYear === void 0) { finYear = new FinancialYear(); }
2381
+ return this.filter(function (payment) {
2382
+ return new Date(payment.date) >= finYear.startDate &&
2383
+ new Date(payment.date) <= finYear.endDate;
2384
+ });
2385
+ };
2386
+ LoanPaymentCollection.prototype.getForCurrentYear = function () {
2387
+ return this.getByFinYear(new FinancialYear());
2388
+ };
2389
+ return LoanPaymentCollection;
2390
+ }(ExportableCollection));
2391
+
2392
+ var Loan = /** @class */ (function (_super) {
2393
+ __extends(Loan, _super);
2394
+ function Loan() {
2395
+ return _super !== null && _super.apply(this, arguments) || this;
2396
+ }
2397
+ /**
2398
+ * Check if loan type is related to LoanVehicleTypeEnum
2399
+ */
2400
+ Loan.prototype.isVehicle = function () {
2401
+ return !this.bankAccount && this.type in exports.LoanVehicleTypeEnum;
2402
+ };
2403
+ /**
2404
+ * Get the last payment for passed financial year
2405
+ * @param year financial year for filter
2406
+ */
2407
+ Loan.prototype.getLastPaymentByYear = function (year) {
2408
+ var finYear = new FinancialYear(new Date(year.toString()));
2409
+ return last__default["default"](this.payments.filter(function (payment) { return payment.date > finYear.startDate && payment.date < finYear.endDate; }));
2410
+ };
2411
+ /**
2412
+ * The size of loan interest
2413
+ * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/212369955/Loans+vehicle+loans
2414
+ * @TODO Vik/Nicole: need to update documentation. Derek gave the right formulas to Mikhail
2415
+ */
2416
+ Loan.prototype.getInterest = function () {
2417
+ return new LoanPaymentCollection(this.payments).paymentDue - this.amount;
2418
+ };
2419
+ /**
2420
+ * The last payment size
2421
+ * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/212369955/Loans+vehicle+loans
2422
+ * @TODO Vik/Nicole: need to update documentation. Derek gave the right formulas to Mikhail
2423
+ */
2424
+ Loan.prototype.getBalloonPayment = function () {
2425
+ var lastPaymentDueAmount = new LoanPaymentCollection(this.payments).last.paymentDue;
2426
+ return (lastPaymentDueAmount - this.repaymentAmount) > 0 ? lastPaymentDueAmount - this.repaymentAmount : 0;
2427
+ };
2428
+ /**
2429
+ * Percent of ballon payment from all payments
2430
+ * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/212369955/Loans+vehicle+loans
2431
+ * @TODO Vik/Nicole: need to update documentation. Derek gave the right formulas to Mikhail
2432
+ */
2433
+ Loan.prototype.getBalloonPaymentPercentage = function () {
2434
+ return this.getBalloonPayment() / new LoanPaymentCollection(this.payments).paymentDue * 100;
2435
+ };
2436
+ return Loan;
2437
+ }(Loan$1));
2438
+ /**
2439
+ * 30 years is default mortgage term
2440
+ */
2441
+ Loan.mortgageDefaultTerm = 360;
2442
+ /**
2443
+ * 5 years is default bank loan term
2444
+ */
2445
+ Loan.loanDefaultTerm = 60;
2446
+ __decorate([
2447
+ classTransformer.Type(function () { return LoanPayment; })
2448
+ ], Loan.prototype, "payments", void 0);
2449
+ __decorate([
2450
+ classTransformer.Type(function () { return Date; })
2451
+ ], Loan.prototype, "commencementDate", void 0);
2452
+ __decorate([
2453
+ classTransformer.Type(function () { return LoanPayout; })
2454
+ ], Loan.prototype, "payout", void 0);
2455
+
2456
+ exports.TankTypeEnum = void 0;
2457
+ (function (TankTypeEnum) {
2458
+ TankTypeEnum[TankTypeEnum["PROPERTY"] = 1] = "PROPERTY";
2459
+ TankTypeEnum[TankTypeEnum["WORK"] = 2] = "WORK";
2460
+ TankTypeEnum[TankTypeEnum["OTHER"] = 3] = "OTHER";
2461
+ TankTypeEnum[TankTypeEnum["SOLE"] = 4] = "SOLE";
2462
+ })(exports.TankTypeEnum || (exports.TankTypeEnum = {}));
2463
+
2464
+ var BankAccountBalance = /** @class */ (function (_super) {
2465
+ __extends(BankAccountBalance, _super);
2466
+ function BankAccountBalance() {
2467
+ return _super !== null && _super.apply(this, arguments) || this;
2468
+ }
2469
+ return BankAccountBalance;
2470
+ }(AbstractModel));
2471
+
2472
+ var BankAccountProperty$1 = /** @class */ (function (_super) {
2473
+ __extends(BankAccountProperty, _super);
2474
+ function BankAccountProperty() {
2475
+ return _super !== null && _super.apply(this, arguments) || this;
2476
+ }
2477
+ return BankAccountProperty;
2478
+ }(AbstractModel));
2479
+
2480
+ var Property$1 = /** @class */ (function (_super) {
2481
+ __extends(Property, _super);
2482
+ function Property() {
2483
+ return _super !== null && _super.apply(this, arguments) || this;
2484
+ }
2485
+ return Property;
2486
+ }(AbstractModel));
2487
+
2488
+ var PropertySubscription$1 = /** @class */ (function (_super) {
2489
+ __extends(PropertySubscription, _super);
2490
+ function PropertySubscription() {
2491
+ return _super !== null && _super.apply(this, arguments) || this;
2492
+ }
2493
+ return PropertySubscription;
2494
+ }(AbstractModel));
2495
+
2496
+ var User$1 = /** @class */ (function (_super) {
2497
+ __extends(User, _super);
2498
+ function User() {
2499
+ return _super !== null && _super.apply(this, arguments) || this;
2500
+ }
2501
+ return User;
2502
+ }(AbstractModel));
2503
+
2504
+ exports.UserStatusEnum = void 0;
2505
+ (function (UserStatusEnum) {
2506
+ UserStatusEnum[UserStatusEnum["INACTIVE"] = 0] = "INACTIVE";
2507
+ UserStatusEnum[UserStatusEnum["ON_BOARDING"] = 1] = "ON_BOARDING";
2508
+ UserStatusEnum[UserStatusEnum["ACTIVE"] = 2] = "ACTIVE";
2509
+ })(exports.UserStatusEnum || (exports.UserStatusEnum = {}));
2510
+
2511
+ exports.UserRolesEnum = void 0;
2512
+ (function (UserRolesEnum) {
2513
+ UserRolesEnum["FIRM_OWNER"] = "ROLE_FIRM_OWNER";
2514
+ UserRolesEnum["FIRM_MANAGER"] = "ROLE_FIRM_MANAGER";
2515
+ UserRolesEnum["CLIENT"] = "ROLE_CLIENT";
2516
+ UserRolesEnum["EMPLOYEE"] = "ROLE_EMPLOYEE";
2517
+ UserRolesEnum["ACCOUNTANT"] = "ROLE_ACCOUNTANT";
2518
+ UserRolesEnum["ADVISOR"] = "ROLE_ADVISOR";
2519
+ UserRolesEnum["USER"] = "ROLE_USER";
2520
+ UserRolesEnum["SUBSCRIPTION"] = "ROLE_USER_SUBSCRIPTION";
2521
+ UserRolesEnum["WORK_TANK"] = "ROLE_USER_WORK";
2522
+ UserRolesEnum["PROPERTY_TANK"] = "ROLE_USER_PROPERTY";
2523
+ UserRolesEnum["SOLE_TANK"] = "ROLE_USER_SOLE";
2524
+ UserRolesEnum["SWITCH_USER"] = "ROLE_PREVIOUS_ADMIN";
2525
+ })(exports.UserRolesEnum || (exports.UserRolesEnum = {}));
2526
+
2527
+ var Address$1 = /** @class */ (function (_super) {
2528
+ __extends(Address, _super);
2529
+ function Address() {
2530
+ return _super !== null && _super.apply(this, arguments) || this;
2531
+ }
2532
+ return Address;
2533
+ }(AbstractModel));
2534
+
2535
+ var Country$1 = /** @class */ (function (_super) {
2536
+ __extends(Country, _super);
2537
+ function Country() {
2538
+ return _super !== null && _super.apply(this, arguments) || this;
2539
+ }
2540
+ return Country;
2541
+ }(AbstractModel));
2542
+
2543
+ var Country = /** @class */ (function (_super) {
2544
+ __extends(Country, _super);
2545
+ function Country() {
2546
+ return _super !== null && _super.apply(this, arguments) || this;
2547
+ }
2548
+ Object.defineProperty(Country.prototype, "countryWithCode", {
2549
+ /**
2550
+ * Return country name with phone code
2551
+ */
2552
+ get: function () {
2553
+ return this.name + " (+" + this.callingCode + ")";
2554
+ },
2555
+ enumerable: false,
2556
+ configurable: true
2557
+ });
2558
+ /**
2559
+ * Check if country calling code is Australian or not
2560
+ */
2561
+ Country.prototype.isAustralianCode = function () {
2562
+ return this.callingCode === '61';
2563
+ };
2564
+ return Country;
2565
+ }(Country$1));
2566
+ Country.australia = classTransformer.plainToClass(Country, { id: 14, name: 'Australia', callingCode: '61' });
2567
+
2568
+ exports.AddressTypeEnum = void 0;
2569
+ (function (AddressTypeEnum) {
2570
+ AddressTypeEnum[AddressTypeEnum["STREET"] = 1] = "STREET";
2571
+ AddressTypeEnum[AddressTypeEnum["POSTAL"] = 2] = "POSTAL";
2572
+ })(exports.AddressTypeEnum || (exports.AddressTypeEnum = {}));
2573
+
2574
+ var Address = /** @class */ (function (_super) {
2575
+ __extends(Address, _super);
2576
+ function Address() {
2577
+ var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
2578
+ _this.type = exports.AddressTypeEnum.STREET;
2579
+ return _this;
2580
+ }
2581
+ Address.prototype.toString = function () {
2582
+ return [this.unitNumber, this.address, this.city, this.state, this.postcode].filter(Boolean).join(', ');
2583
+ };
2584
+ Object.defineProperty(Address.prototype, "name", {
2585
+ get: function () {
2586
+ return "" + (this.unitNumber ? this.unitNumber + '/' : '') + this.address;
2587
+ },
2588
+ enumerable: false,
2589
+ configurable: true
2590
+ });
2591
+ Object.defineProperty(Address.prototype, "nameLong", {
2592
+ get: function () {
2593
+ return this.name + " " + this.city + " " + this.state + " " + this.postcode;
2594
+ },
2595
+ enumerable: false,
2596
+ configurable: true
2597
+ });
2598
+ return Address;
2599
+ }(Address$1));
2600
+ __decorate([
2601
+ classTransformer.Type((function () { return Country; }))
2602
+ ], Address.prototype, "country", void 0);
2603
+
2604
+ var _a$4;
2605
+ var USER_WORK_POSITION = (_a$4 = {},
2606
+ _a$4[exports.UserRolesEnum.EMPLOYEE] = 'Employee',
2607
+ _a$4[exports.UserRolesEnum.FIRM_MANAGER] = 'Manager',
2608
+ _a$4[exports.UserRolesEnum.FIRM_OWNER] = 'Firm Owner',
2609
+ _a$4);
2610
+
2611
+ var ClientDetails$1 = /** @class */ (function (_super) {
2612
+ __extends(ClientDetails, _super);
2613
+ function ClientDetails() {
2614
+ return _super !== null && _super.apply(this, arguments) || this;
2615
+ }
2616
+ return ClientDetails;
2617
+ }(AbstractModel));
2618
+
2619
+ var ClientDetails = /** @class */ (function (_super) {
2620
+ __extends(ClientDetails, _super);
2621
+ function ClientDetails() {
2622
+ return _super !== null && _super.apply(this, arguments) || this;
2623
+ }
2624
+ return ClientDetails;
2625
+ }(ClientDetails$1));
2626
+
2627
+ var EmployeeDetails$1 = /** @class */ (function (_super) {
2628
+ __extends(EmployeeDetails, _super);
2629
+ function EmployeeDetails() {
2630
+ return _super !== null && _super.apply(this, arguments) || this;
2631
+ }
2632
+ return EmployeeDetails;
2633
+ }(AbstractModel));
2634
+
2635
+ var Firm$1 = /** @class */ (function (_super) {
2636
+ __extends(Firm, _super);
2637
+ function Firm() {
2638
+ return _super !== null && _super.apply(this, arguments) || this;
2639
+ }
2640
+ return Firm;
2641
+ }(AbstractModel));
2642
+
2643
+ var Phone$1 = /** @class */ (function (_super) {
2644
+ __extends(Phone, _super);
2645
+ function Phone() {
2646
+ return _super !== null && _super.apply(this, arguments) || this;
2647
+ }
2648
+ return Phone;
2649
+ }(AbstractModel));
2650
+
2651
+ exports.PhoneTypeEnum = void 0;
2652
+ (function (PhoneTypeEnum) {
2653
+ PhoneTypeEnum[PhoneTypeEnum["MOBILE"] = 1] = "MOBILE";
2654
+ PhoneTypeEnum[PhoneTypeEnum["OFFICE"] = 2] = "OFFICE";
2655
+ })(exports.PhoneTypeEnum || (exports.PhoneTypeEnum = {}));
2656
+
2657
+ var Phone = /** @class */ (function (_super) {
2658
+ __extends(Phone, _super);
2659
+ function Phone() {
2660
+ var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
2661
+ _this.country = Country.australia;
2662
+ _this.type = exports.PhoneTypeEnum.MOBILE;
2663
+ return _this;
2664
+ }
2665
+ Phone.prototype.toString = function () {
2666
+ return "+" + this.country.callingCode + " " + this.number;
2667
+ };
2668
+ return Phone;
2669
+ }(Phone$1));
2670
+ __decorate([
2671
+ classTransformer.Type(function () { return Country; })
2672
+ ], Phone.prototype, "country", void 0);
2673
+
2674
+ var Firm = /** @class */ (function (_super) {
2675
+ __extends(Firm, _super);
2676
+ function Firm() {
2677
+ return _super !== null && _super.apply(this, arguments) || this;
2678
+ }
2679
+ /**
2680
+ * get firm photo link
2681
+ */
2682
+ Firm.prototype.getPhoto = function () {
2683
+ return this.photo;
2684
+ };
2685
+ /**
2686
+ * get firm initials
2687
+ */
2688
+ Firm.prototype.getPhotoPlaceholder = function () {
2689
+ return "" + this.name[0].toUpperCase() + this.name[1];
2690
+ };
2691
+ return Firm;
2692
+ }(Firm$1));
2693
+ __decorate([
2694
+ classTransformer.Type(function () { return User; })
2695
+ ], Firm.prototype, "owner", void 0);
2696
+ __decorate([
2697
+ classTransformer.Type(function () { return Address; })
2698
+ ], Firm.prototype, "address", void 0);
2699
+ __decorate([
2700
+ classTransformer.Type(function () { return Phone; })
2701
+ ], Firm.prototype, "phone", void 0);
2702
+
2703
+ var EmployeeDetails = /** @class */ (function (_super) {
2704
+ __extends(EmployeeDetails, _super);
2705
+ function EmployeeDetails() {
2706
+ return _super !== null && _super.apply(this, arguments) || this;
2707
+ }
2708
+ return EmployeeDetails;
2709
+ }(EmployeeDetails$1));
2710
+ __decorate([
2711
+ classTransformer.Type(function () { return Firm; })
2712
+ ], EmployeeDetails.prototype, "firm", void 0);
2713
+
2714
+ var ServiceSubscription$1 = /** @class */ (function (_super) {
2715
+ __extends(ServiceSubscription, _super);
2716
+ function ServiceSubscription() {
2717
+ return _super !== null && _super.apply(this, arguments) || this;
2718
+ }
2719
+ return ServiceSubscription;
2720
+ }(AbstractModel));
2721
+
2722
+ var ServiceSubscriptionItem$1 = /** @class */ (function (_super) {
2723
+ __extends(ServiceSubscriptionItem, _super);
2724
+ function ServiceSubscriptionItem() {
2725
+ return _super !== null && _super.apply(this, arguments) || this;
2726
+ }
2727
+ return ServiceSubscriptionItem;
2728
+ }(AbstractModel));
2729
+
2730
+ var ServicePrice$1 = /** @class */ (function (_super) {
2731
+ __extends(ServicePrice, _super);
2732
+ function ServicePrice() {
2733
+ return _super !== null && _super.apply(this, arguments) || this;
2734
+ }
2735
+ return ServicePrice;
2736
+ }(AbstractModel));
2737
+
2738
+ var ServiceProduct$1 = /** @class */ (function (_super) {
2739
+ __extends(ServiceProduct, _super);
2740
+ function ServiceProduct() {
2741
+ return _super !== null && _super.apply(this, arguments) || this;
2742
+ }
2743
+ return ServiceProduct;
2744
+ }(AbstractModel));
2745
+
2746
+ exports.ServiceProductStatusEnum = void 0;
2747
+ (function (ServiceProductStatusEnum) {
2748
+ ServiceProductStatusEnum[ServiceProductStatusEnum["ARCHIVED"] = 0] = "ARCHIVED";
2749
+ ServiceProductStatusEnum[ServiceProductStatusEnum["ACTIVE"] = 1] = "ACTIVE";
2750
+ })(exports.ServiceProductStatusEnum || (exports.ServiceProductStatusEnum = {}));
2751
+
2752
+ exports.ServiceProductIdEnum = void 0;
2753
+ (function (ServiceProductIdEnum) {
2754
+ ServiceProductIdEnum[ServiceProductIdEnum["WORK_TANK_OLD"] = 1] = "WORK_TANK_OLD";
2755
+ ServiceProductIdEnum[ServiceProductIdEnum["PROPERTY_OLD"] = 2] = "PROPERTY_OLD";
2756
+ ServiceProductIdEnum[ServiceProductIdEnum["PROPERTY_TANK"] = 3] = "PROPERTY_TANK";
2757
+ ServiceProductIdEnum[ServiceProductIdEnum["WORK_TANK"] = 4] = "WORK_TANK";
2758
+ ServiceProductIdEnum[ServiceProductIdEnum["PROPERTIES"] = 5] = "PROPERTIES";
2759
+ ServiceProductIdEnum[ServiceProductIdEnum["SOLE_TANK"] = 6] = "SOLE_TANK";
2760
+ })(exports.ServiceProductIdEnum || (exports.ServiceProductIdEnum = {}));
2761
+
2762
+ var ServiceProduct = /** @class */ (function (_super) {
2763
+ __extends(ServiceProduct, _super);
2764
+ function ServiceProduct() {
2765
+ return _super !== null && _super.apply(this, arguments) || this;
2766
+ }
2767
+ ServiceProduct.prototype.isProperties = function () {
2768
+ return [exports.ServiceProductIdEnum.PROPERTY_OLD, exports.ServiceProductIdEnum.PROPERTIES].includes(this.id);
2769
+ };
2770
+ ServiceProduct.prototype.isWorkTank = function () {
2771
+ return [exports.ServiceProductIdEnum.WORK_TANK_OLD, exports.ServiceProductIdEnum.WORK_TANK].includes(this.id);
2772
+ };
2773
+ ServiceProduct.prototype.isSoleTank = function () {
2774
+ return this.id === exports.ServiceProductIdEnum.SOLE_TANK;
2775
+ };
2776
+ ServiceProduct.prototype.isArchived = function () {
2777
+ return this.status === exports.ServiceProductStatusEnum.ARCHIVED;
2778
+ };
2779
+ return ServiceProduct;
2780
+ }(ServiceProduct$1));
2781
+
2782
+ var ServicePrice = /** @class */ (function (_super) {
2783
+ __extends(ServicePrice, _super);
2784
+ function ServicePrice() {
2785
+ return _super !== null && _super.apply(this, arguments) || this;
2786
+ }
2787
+ ServicePrice.prototype.toSubscriptionItem = function () {
2788
+ return classTransformer.plainToClass(ServiceSubscriptionItem, { price: this, quantity: this.product.minQty });
2789
+ };
2790
+ return ServicePrice;
2791
+ }(ServicePrice$1));
2792
+ __decorate([
2793
+ classTransformer.Type(function () { return ServiceProduct; })
2794
+ ], ServicePrice.prototype, "product", void 0);
2795
+
2796
+ /**
2797
+ * backend bd doesn't support dynamic prices, as far as we have just one product like that we keep it hardcoded
2798
+ */
2799
+ var PROPERTY_TANK_PRICE = 9;
2800
+ var ServiceSubscriptionItem = /** @class */ (function (_super) {
2801
+ __extends(ServiceSubscriptionItem, _super);
2802
+ function ServiceSubscriptionItem() {
2803
+ return _super !== null && _super.apply(this, arguments) || this;
2804
+ }
2805
+ Object.defineProperty(ServiceSubscriptionItem.prototype, "total", {
2806
+ get: function () {
2807
+ var price = this.price.amount * this.quantity;
2808
+ if (this.price.product.id === exports.ServiceProductIdEnum.PROPERTIES) {
2809
+ price += PROPERTY_TANK_PRICE;
2810
+ }
2811
+ return price;
2812
+ },
2813
+ enumerable: false,
2814
+ configurable: true
2815
+ });
2816
+ return ServiceSubscriptionItem;
2472
2817
  }(ServiceSubscriptionItem$1));
2473
2818
  __decorate([
2474
2819
  classTransformer.Type(function () { return ServicePrice; })
@@ -5691,74 +6036,6 @@
5691
6036
  return BankConnection;
5692
6037
  }(AbstractModel));
5693
6038
 
5694
- var BasiqJob$1 = /** @class */ (function (_super) {
5695
- __extends(BasiqJob, _super);
5696
- function BasiqJob() {
5697
- return _super !== null && _super.apply(this, arguments) || this;
5698
- }
5699
- return BasiqJob;
5700
- }(AbstractModel));
5701
-
5702
- var BasiqJob = /** @class */ (function (_super) {
5703
- __extends(BasiqJob, _super);
5704
- function BasiqJob() {
5705
- return _super !== null && _super.apply(this, arguments) || this;
5706
- }
5707
- return BasiqJob;
5708
- }(BasiqJob$1));
5709
-
5710
- var Bank$1 = /** @class */ (function (_super) {
5711
- __extends(Bank, _super);
5712
- function Bank() {
5713
- return _super !== null && _super.apply(this, arguments) || this;
5714
- }
5715
- return Bank;
5716
- }(AbstractModel));
5717
-
5718
- var BankPopularEnum;
5719
- (function (BankPopularEnum) {
5720
- BankPopularEnum["BANKWEST"] = "Bank of Western Australia trading as BankWest";
5721
- BankPopularEnum["ANZ"] = "Australia and New Zealand Banking Group Limited";
5722
- BankPopularEnum["CBA"] = "Commonwealth Bank Australia";
5723
- BankPopularEnum["WESTPAC"] = "Westpac Banking Corporation";
5724
- BankPopularEnum["BENDIGO"] = "Bendigo and Adelaide Bank Limited";
5725
- BankPopularEnum["ING_DIRECT"] = "ING Bank (Australia) Limited (trading as ING Direct)";
5726
- BankPopularEnum["ST_GEORGE"] = "St. George Bank (a subsidiary of Westpac)";
5727
- BankPopularEnum["SUNCORP"] = "Suncorp-Metway Limited";
5728
- BankPopularEnum["CITIBANK"] = "Citibank";
5729
- BankPopularEnum["BOQ"] = "Bank of Queensland Limited";
5730
- })(BankPopularEnum || (BankPopularEnum = {}));
5731
-
5732
- var Bank = /** @class */ (function (_super) {
5733
- __extends(Bank, _super);
5734
- function Bank() {
5735
- return _super !== null && _super.apply(this, arguments) || this;
5736
- }
5737
- Bank.prototype.getPhotoPlaceholder = function () {
5738
- return this.name[0] + this.name[1];
5739
- };
5740
- Bank.prototype.getPhoto = function () {
5741
- if (!this.logo) {
5742
- return null;
5743
- }
5744
- return this.logo.includes('http') ? "" + this.logo : localStorage.getItem('api_uri') + "/" + this.logo;
5745
- };
5746
- return Bank;
5747
- }(Bank$1));
5748
- __decorate([
5749
- classTransformer.Transform(function (_a) {
5750
- var value = _a.value;
5751
- return value ? value.replace(' ', '%20') : null;
5752
- })
5753
- ], Bank.prototype, "logo", void 0);
5754
- __decorate([
5755
- classTransformer.Transform(function (_a) {
5756
- var obj = _a.obj;
5757
- return Object.values(BankPopularEnum).includes(obj.name);
5758
- }),
5759
- classTransformer.Expose()
5760
- ], Bank.prototype, "isPopular", void 0);
5761
-
5762
6039
  exports.BankConnectionStatusEnum = void 0;
5763
6040
  (function (BankConnectionStatusEnum) {
5764
6041
  BankConnectionStatusEnum[BankConnectionStatusEnum["PENDING"] = 1] = "PENDING";
@@ -5940,245 +6217,317 @@
5940
6217
  BankAccount.prototype.isActive = function () {
5941
6218
  return this.status === exports.BankAccountStatusEnum.ACTIVE;
5942
6219
  };
5943
- /**
5944
- * first import (transactions) of basiq accounts
5945
- */
5946
- BankAccount.prototype.isFirstImport = function () {
5947
- return !this.lastTransactionDate && !this.isManual;
5948
- };
5949
- /**
5950
- * Check if passed user id is owner of bank account
5951
- */
5952
- BankAccount.prototype.isOwner = function (userId) {
5953
- return this.bankConnection.user.id === userId;
5954
- };
5955
- return BankAccount;
5956
- }(BankAccount$1));
5957
- __decorate([
5958
- classTransformer.Type(function () { return BankAccountProperty; })
5959
- ], BankAccount.prototype, "bankAccountProperties", void 0);
5960
- __decorate([
5961
- classTransformer.Type(function () { return SoleBusinessAllocation; })
5962
- ], BankAccount.prototype, "businessAllocations", void 0);
5963
- __decorate([
5964
- classTransformer.Type(function () { return BankAccountBalance; })
5965
- ], BankAccount.prototype, "balances", void 0);
5966
- __decorate([
5967
- classTransformer.Type(function () { return Loan; })
5968
- ], BankAccount.prototype, "loan", void 0);
5969
- __decorate([
5970
- classTransformer.Type(function () { return BankConnection; })
5971
- ], BankAccount.prototype, "bankConnection", void 0);
5972
- __decorate([
5973
- classTransformer.Transform(function (_b) {
5974
- var value = _b.value;
5975
- return value === 4 ? exports.BankAccountTypeEnum.LOAN : value;
5976
- })
5977
- ], BankAccount.prototype, "type", void 0);
5978
-
5979
- var TYPE_LOAN = [
5980
- exports.BankAccountTypeEnum.CREDIT_CARD,
5981
- exports.BankAccountTypeEnum.LOAN
5982
- ];
5983
-
5984
- /**
5985
- * Collection of bank accounts.
5986
- */
5987
- var BankAccountCollection = /** @class */ (function (_super) {
5988
- __extends(BankAccountCollection, _super);
5989
- function BankAccountCollection() {
5990
- return _super !== null && _super.apply(this, arguments) || this;
5991
- }
5992
- /**
5993
- * get list of bank accounts with passed types
5994
- */
5995
- BankAccountCollection.prototype.getByType = function (types, isExclude) {
5996
- if (isExclude === void 0) { isExclude = false; }
5997
- // get types always as array (if only one passed)
5998
- var typesArray = concat__default["default"](types);
5999
- return this.items.filter(function (bankAccount) {
6000
- if (isExclude) {
6001
- return !typesArray.includes(bankAccount.type);
6002
- }
6003
- return typesArray.includes(bankAccount.type);
6004
- });
6005
- };
6006
- /**
6007
- * get amount of initial loans
6008
- */
6009
- BankAccountCollection.prototype.getInitialLoanAmount = function () {
6010
- return this.getByType(TYPE_LOAN)
6011
- .reduce(function (sum, bankAccount) {
6012
- return sum += bankAccount.balances.length ? bankAccount.getOpeningBalance() : 0;
6013
- }, 0);
6014
- };
6015
- /**
6016
- * get amount of current loans
6017
- */
6018
- BankAccountCollection.prototype.getCurrentLoanAmount = function () {
6019
- return this.getByType(TYPE_LOAN)
6020
- .reduce(function (sum, bankAccount) {
6021
- return sum += bankAccount.currentBalance;
6022
- }, 0);
6220
+ /**
6221
+ * first import (transactions) of basiq accounts
6222
+ */
6223
+ BankAccount.prototype.isFirstImport = function () {
6224
+ return !this.lastTransactionDate && !this.isManual;
6023
6225
  };
6024
6226
  /**
6025
- * get collection filtered by property id
6227
+ * Check if passed user id is owner of bank account
6026
6228
  */
6027
- BankAccountCollection.prototype.getByPropertyId = function (id) {
6028
- return new BankAccountCollection(this.items.filter(function (bankAccount) {
6029
- return bankAccount.bankAccountProperties.find(function (bankAccountProperty) {
6030
- return bankAccountProperty.property.id === id;
6031
- });
6032
- }));
6229
+ BankAccount.prototype.isOwner = function (userId) {
6230
+ return this.bankConnection.user.id === userId;
6033
6231
  };
6232
+ return BankAccount;
6233
+ }(BankAccount$1));
6234
+ __decorate([
6235
+ classTransformer.Type(function () { return BankAccountProperty; })
6236
+ ], BankAccount.prototype, "bankAccountProperties", void 0);
6237
+ __decorate([
6238
+ classTransformer.Type(function () { return SoleBusinessAllocation; })
6239
+ ], BankAccount.prototype, "businessAllocations", void 0);
6240
+ __decorate([
6241
+ classTransformer.Type(function () { return BankAccountBalance; })
6242
+ ], BankAccount.prototype, "balances", void 0);
6243
+ __decorate([
6244
+ classTransformer.Type(function () { return Loan; })
6245
+ ], BankAccount.prototype, "loan", void 0);
6246
+ __decorate([
6247
+ classTransformer.Type(function () { return BankConnection; })
6248
+ ], BankAccount.prototype, "bankConnection", void 0);
6249
+ __decorate([
6250
+ classTransformer.Transform(function (_b) {
6251
+ var value = _b.value;
6252
+ return value === 4 ? exports.BankAccountTypeEnum.LOAN : value;
6253
+ })
6254
+ ], BankAccount.prototype, "type", void 0);
6255
+
6256
+ /**
6257
+ * bank account collection UI class with frontend specific data
6258
+ */
6259
+ var BankAccountChartData = /** @class */ (function () {
6260
+ function BankAccountChartData(bankAccounts) {
6261
+ this.bankAccounts = bankAccounts;
6262
+ }
6034
6263
  /**
6035
- * get collection filtered by properties ids
6264
+ * set value of pie chart data
6036
6265
  */
6037
- BankAccountCollection.prototype.getByPropertiesIds = function (ids) {
6038
- return new BankAccountCollection(this.items.filter(function (bankAccount) {
6039
- return bankAccount.bankAccountProperties.find(function (bankAccountProperty) {
6040
- return ids.includes(bankAccountProperty.property.id);
6041
- });
6042
- }));
6266
+ BankAccountChartData.prototype.getBalancePieChartData = function () {
6267
+ return this.bankAccounts.map(function (bankAccount) {
6268
+ return {
6269
+ name: bankAccount.accountName,
6270
+ data: Math.abs(bankAccount.currentBalance)
6271
+ };
6272
+ });
6043
6273
  };
6044
6274
  /**
6045
- * get collection of active bank accounts
6275
+ * set value of bar chart data
6046
6276
  */
6047
- BankAccountCollection.prototype.getActiveBankAccounts = function () {
6048
- return new BankAccountCollection(this.items.filter(function (bankAccount) {
6049
- return bankAccount.isActive();
6050
- }));
6277
+ BankAccountChartData.prototype.getBalanceBarChartData = function () {
6278
+ return [{
6279
+ name: 'Balance',
6280
+ data: this.bankAccounts.map(function (bankAccount) {
6281
+ return {
6282
+ label: bankAccount.accountName,
6283
+ value: bankAccount.currentBalance
6284
+ };
6285
+ })
6286
+ }];
6051
6287
  };
6288
+ return BankAccountChartData;
6289
+ }());
6290
+
6291
+ /**
6292
+ * Const which contains array of bank account types
6293
+ */
6294
+ var BANK_ACCOUNT_TYPES = [
6295
+ { key: exports.BankAccountTypeEnum.CREDIT_CARD, value: 'Credit Card Accounts' },
6296
+ { key: exports.BankAccountTypeEnum.TERM_DEPOSIT, value: 'Deposit Accounts' },
6297
+ { key: exports.BankAccountTypeEnum.INVESTMENT, value: 'Investment Accounts' },
6298
+ { key: exports.BankAccountTypeEnum.LOAN, value: 'Loan Accounts' },
6299
+ { key: exports.BankAccountTypeEnum.OFFSET, value: 'Offset' },
6300
+ { key: exports.BankAccountTypeEnum.SAVINGS, value: 'Savings Accounts' },
6301
+ { key: exports.BankAccountTypeEnum.TRANSACTION, value: 'Transaction Accounts' },
6302
+ ];
6303
+
6304
+ /**
6305
+ * Login data object for basiq banks
6306
+ */
6307
+ var BankLoginData = /** @class */ (function () {
6308
+ function BankLoginData() {
6309
+ }
6310
+ return BankLoginData;
6311
+ }());
6312
+
6313
+ /**
6314
+ * enum with months indexes.
6315
+ * item value match with js Date month index from 0 to 11
6316
+ * Order of items match with financial year months order
6317
+ */
6318
+ exports.MonthNumberEnum = void 0;
6319
+ (function (MonthNumberEnum) {
6320
+ MonthNumberEnum[MonthNumberEnum["JULY"] = 6] = "JULY";
6321
+ MonthNumberEnum[MonthNumberEnum["AUGUST"] = 7] = "AUGUST";
6322
+ MonthNumberEnum[MonthNumberEnum["SEPTEMBER"] = 8] = "SEPTEMBER";
6323
+ MonthNumberEnum[MonthNumberEnum["OCTOBER"] = 9] = "OCTOBER";
6324
+ MonthNumberEnum[MonthNumberEnum["NOVEMBER"] = 10] = "NOVEMBER";
6325
+ MonthNumberEnum[MonthNumberEnum["DECEMBER"] = 11] = "DECEMBER";
6326
+ MonthNumberEnum[MonthNumberEnum["JANUARY"] = 0] = "JANUARY";
6327
+ MonthNumberEnum[MonthNumberEnum["FEBRUARY"] = 1] = "FEBRUARY";
6328
+ MonthNumberEnum[MonthNumberEnum["MARCH"] = 2] = "MARCH";
6329
+ MonthNumberEnum[MonthNumberEnum["APRIL"] = 3] = "APRIL";
6330
+ MonthNumberEnum[MonthNumberEnum["MAY"] = 4] = "MAY";
6331
+ MonthNumberEnum[MonthNumberEnum["JUNE"] = 5] = "JUNE";
6332
+ })(exports.MonthNumberEnum || (exports.MonthNumberEnum = {}));
6333
+
6334
+ /**
6335
+ * @TODO move to pipe/translation
6336
+ * enum with months short names.
6337
+ * Order of items match with financial year months order
6338
+ */
6339
+ exports.MonthNameShortEnum = void 0;
6340
+ (function (MonthNameShortEnum) {
6341
+ MonthNameShortEnum["JULY"] = "Jul";
6342
+ MonthNameShortEnum["AUGUST"] = "Aug";
6343
+ MonthNameShortEnum["SEPTEMBER"] = "Sep";
6344
+ MonthNameShortEnum["OCTOBER"] = "Oct";
6345
+ MonthNameShortEnum["NOVEMBER"] = "Nov";
6346
+ MonthNameShortEnum["DECEMBER"] = "Dec";
6347
+ MonthNameShortEnum["JANUARY"] = "Jan";
6348
+ MonthNameShortEnum["FEBRUARY"] = "Feb";
6349
+ MonthNameShortEnum["MARCH"] = "Mar";
6350
+ MonthNameShortEnum["APRIL"] = "Apr";
6351
+ MonthNameShortEnum["MAY"] = "May";
6352
+ MonthNameShortEnum["JUNE"] = "Jun";
6353
+ })(exports.MonthNameShortEnum || (exports.MonthNameShortEnum = {}));
6354
+
6355
+ /**
6356
+ * bank transactions collection UI class with frontend specific data
6357
+ */
6358
+ var BankTransactionChartData = /** @class */ (function () {
6359
+ function BankTransactionChartData(bankTransactions) {
6360
+ this.bankTransactions = bankTransactions;
6361
+ }
6052
6362
  /**
6053
- * get reduction of loan (reduction of principle) percentage
6363
+ * get value of bar chart data
6054
6364
  */
6055
- BankAccountCollection.prototype.getPrincipleReductionPercent = function () {
6056
- var initialLoans = this.getInitialLoanAmount();
6057
- var currentLoans = this.getCurrentLoanAmount();
6058
- if (!initialLoans) {
6059
- return 0;
6365
+ BankTransactionChartData.prototype.getCashInOutBarChartData = function (months) {
6366
+ var chartData = this.calculateCashInOutBarChartData();
6367
+ if (!months) {
6368
+ return chartData;
6060
6369
  }
6061
- return (initialLoans - currentLoans) / initialLoans * 100;
6370
+ return this.filterChartDataByMonths(months, chartData);
6062
6371
  };
6063
6372
  /**
6064
- * Get collection of loan bank accounts
6373
+ * get value of line chart data
6065
6374
  */
6066
- BankAccountCollection.prototype.getLoanAccounts = function () {
6067
- return new BankAccountCollection(this.getByType(TYPE_LOAN));
6068
- };
6069
- BankAccountCollection.prototype.getSavingsAccounts = function () {
6070
- return new BankAccountCollection(this.getByType(TYPE_LOAN, true));
6071
- };
6072
- BankAccountCollection.prototype.getOpeningBalance = function () {
6073
- return this.items.reduce(function (sum, bankAccount) { return sum + bankAccount.getOpeningBalance(); }, 0);
6375
+ BankTransactionChartData.prototype.getBalanceLineChartData = function (months) {
6376
+ var chartData = this.calculateBalanceLineChartData();
6377
+ if (!months) {
6378
+ return chartData;
6379
+ }
6380
+ return this.filterChartDataByMonths(months, chartData);
6074
6381
  };
6075
- Object.defineProperty(BankAccountCollection.prototype, "currentBalance", {
6076
- get: function () {
6077
- return this.sumBy('currentBalance');
6078
- },
6079
- enumerable: false,
6080
- configurable: true
6081
- });
6082
6382
  /**
6083
- * Get Collection of bank accounts with property tank type
6383
+ * set bar chart data
6084
6384
  */
6085
- BankAccountCollection.prototype.getPropertyBankAccounts = function () {
6086
- return new BankAccountCollection(this.items.filter(function (bankAccount) { return bankAccount.isPropertyTank(); }));
6385
+ BankTransactionChartData.prototype.calculateCashInOutBarChartData = function () {
6386
+ var chartData = [{
6387
+ name: 'Cash In',
6388
+ data: []
6389
+ }, {
6390
+ name: 'Cash Out',
6391
+ data: []
6392
+ }];
6393
+ var _loop_1 = function (key) {
6394
+ if (exports.MonthNameShortEnum.hasOwnProperty(key)) {
6395
+ var bankTransactionsForMonth = this_1.bankTransactions.filter(function (bankTransaction) {
6396
+ return +bankTransaction.date.getMonth() === +exports.MonthNumberEnum[key];
6397
+ });
6398
+ var cashInForMonth = bankTransactionsForMonth
6399
+ .filter(function (bankTransaction) { return bankTransaction.isCredit(); })
6400
+ .reduce(function (sum, bankTransaction) { return sum += bankTransaction.allocatedAmount; }, 0);
6401
+ var cashOutForMonth = bankTransactionsForMonth
6402
+ .filter(function (bankTransaction) { return bankTransaction.isDebit(); })
6403
+ .reduce(function (sum, bankTransaction) { return sum += bankTransaction.allocatedAmount; }, 0);
6404
+ chartData[0].data.push({
6405
+ label: exports.MonthNameShortEnum[key],
6406
+ value: cashInForMonth
6407
+ });
6408
+ chartData[1].data.push({
6409
+ label: exports.MonthNameShortEnum[key],
6410
+ value: cashOutForMonth
6411
+ });
6412
+ }
6413
+ };
6414
+ var this_1 = this;
6415
+ for (var key in exports.MonthNameShortEnum) {
6416
+ _loop_1(key);
6417
+ }
6418
+ return chartData;
6087
6419
  };
6088
6420
  /**
6089
- * Get Collection of bank accounts with work tank type
6421
+ * set line chart data
6090
6422
  */
6091
- BankAccountCollection.prototype.getWorkBankAccounts = function () {
6092
- return new BankAccountCollection(this.items.filter(function (bankAccount) { return bankAccount.isWorkTank(); }));
6423
+ BankTransactionChartData.prototype.calculateBalanceLineChartData = function () {
6424
+ var chartData = [{
6425
+ name: 'Balance',
6426
+ data: []
6427
+ }];
6428
+ var _loop_2 = function (key) {
6429
+ if (exports.MonthNameShortEnum.hasOwnProperty(key)) {
6430
+ var bankTransactionsForMonth = this_2.bankTransactions.filter(function (bankTransaction) {
6431
+ return +bankTransaction.date.getMonth() === +exports.MonthNumberEnum[key];
6432
+ });
6433
+ var balanceForMonth = bankTransactionsForMonth.reduce(function (sum, bankTransaction) {
6434
+ if (bankTransaction.isCredit()) {
6435
+ return sum += bankTransaction.allocatedAmount;
6436
+ }
6437
+ else {
6438
+ return sum -= bankTransaction.allocatedAmount;
6439
+ }
6440
+ }, 0);
6441
+ chartData[0].data.push({
6442
+ label: exports.MonthNameShortEnum[key],
6443
+ value: balanceForMonth
6444
+ });
6445
+ }
6446
+ };
6447
+ var this_2 = this;
6448
+ for (var key in exports.MonthNameShortEnum) {
6449
+ _loop_2(key);
6450
+ }
6451
+ return chartData;
6093
6452
  };
6094
6453
  /**
6095
- * Get Collection of bank accounts by tank type
6454
+ * filter chart data for passed months
6096
6455
  */
6097
- BankAccountCollection.prototype.getByTankType = function (tankType) {
6098
- return new BankAccountCollection(this.items.filter(function (bankAccount) { return bankAccount.tankType === tankType; }));
6456
+ BankTransactionChartData.prototype.filterChartDataByMonths = function (months, chartData) {
6457
+ var monthsNames = months.map(function (month) { return exports.MonthNumberEnum[month]; }).map(function (key) { return exports.MonthNameShortEnum[key]; });
6458
+ var filteredChartData = cloneDeep__default["default"](chartData);
6459
+ filteredChartData.forEach(function (chartDataItem) {
6460
+ chartDataItem.data = chartDataItem.data.filter(function (serie) { return monthsNames.includes(serie.label); });
6461
+ });
6462
+ return filteredChartData;
6099
6463
  };
6464
+ return BankTransactionChartData;
6465
+ }());
6466
+
6467
+ exports.BankTransactionSummaryFieldsEnum = void 0;
6468
+ (function (BankTransactionSummaryFieldsEnum) {
6469
+ BankTransactionSummaryFieldsEnum["AMOUNT"] = "amount";
6470
+ BankTransactionSummaryFieldsEnum["ALLOCATED_AMOUNT"] = "allocatedAmount";
6471
+ })(exports.BankTransactionSummaryFieldsEnum || (exports.BankTransactionSummaryFieldsEnum = {}));
6472
+
6473
+ var Document$1 = /** @class */ (function (_super) {
6474
+ __extends(Document, _super);
6475
+ function Document() {
6476
+ return _super !== null && _super.apply(this, arguments) || this;
6477
+ }
6478
+ return Document;
6479
+ }(AbstractModel));
6480
+
6481
+ /**
6482
+ * Enum with document types which used to API url prefix
6483
+ */
6484
+ exports.DocumentApiUrlPrefixEnum = void 0;
6485
+ (function (DocumentApiUrlPrefixEnum) {
6486
+ DocumentApiUrlPrefixEnum["FOLDERS"] = "folders";
6487
+ DocumentApiUrlPrefixEnum["PROPERTIES"] = "properties";
6488
+ })(exports.DocumentApiUrlPrefixEnum || (exports.DocumentApiUrlPrefixEnum = {}));
6489
+
6490
+ var Document = /** @class */ (function (_super) {
6491
+ __extends(Document, _super);
6492
+ function Document() {
6493
+ var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
6494
+ _this.type = exports.AssetTypeEnum.DOCUMENTS;
6495
+ _this.entityType = exports.AssetEntityTypeEnum.FOLDERS;
6496
+ return _this;
6497
+ }
6100
6498
  /**
6101
- * Get list of all bank account properties
6499
+ * Get folder as document parent entity
6102
6500
  */
6103
- BankAccountCollection.prototype.getBankAccountPropertiesList = function () {
6104
- return flatten__default["default"](this.items.map(function (bankAccount) {
6105
- return bankAccount.bankAccountProperties;
6106
- }));
6501
+ Document.prototype.getEntity = function () {
6502
+ return this.folder;
6107
6503
  };
6108
6504
  /**
6109
- * Get lis of unique properties from all bank accounts properties
6505
+ * Get API url prefix
6110
6506
  */
6111
- BankAccountCollection.prototype.getProperties = function () {
6112
- return uniqBy__default["default"](this.getBankAccountPropertiesList().map(function (bankAccountProperty) {
6113
- return bankAccountProperty.property;
6114
- }), 'id');
6115
- };
6116
- BankAccountCollection.prototype.getPropertyBalanceAmount = function (propertyId) {
6117
- return this.items.reduce(function (sum, bankAccount) {
6118
- return sum + bankAccount.getPropertyBalanceAmount(propertyId);
6119
- }, 0);
6507
+ Document.prototype.getApiUrlPrefix = function () {
6508
+ return exports.DocumentApiUrlPrefixEnum.FOLDERS;
6120
6509
  };
6121
- return BankAccountCollection;
6122
- }(Collection));
6510
+ return Document;
6511
+ }(Document$1));
6123
6512
 
6124
- var UserEventTypeTypeEnum;
6125
- (function (UserEventTypeTypeEnum) {
6126
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["REGISTERED"] = 1000] = "REGISTERED";
6127
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["PASSWORD_RESET_REQUEST"] = 1001] = "PASSWORD_RESET_REQUEST";
6128
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["APP_FEATURES"] = 1010] = "APP_FEATURES";
6129
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["SUBSCRIBED"] = 2000] = "SUBSCRIBED";
6130
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["UNSUBSCRIBED"] = 2001] = "UNSUBSCRIBED";
6131
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["SUBSCRIPTION_UPDATE"] = 2004] = "SUBSCRIPTION_UPDATE";
6132
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["SUBSCRIPTION_TRIAL_UPDATE"] = 2005] = "SUBSCRIPTION_TRIAL_UPDATE";
6133
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["SUBSCRIPTION_PAYMENT_FAILED"] = 2006] = "SUBSCRIPTION_PAYMENT_FAILED";
6134
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE"] = 2010] = "CLIENT_INVITE";
6135
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE_TO_REGISTER"] = 2011] = "CLIENT_INVITE_TO_REGISTER";
6136
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_INVITE_ACCEPTED"] = 2012] = "FIRM_INVITE_ACCEPTED";
6137
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_INVITE_REJECTED"] = 2013] = "FIRM_INVITE_REJECTED";
6138
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_INVITE_REGISTERED"] = 2014] = "FIRM_INVITE_REGISTERED";
6139
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_INVITE"] = 2020] = "PROPERTY_SHARE_INVITE";
6140
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_INVITE_TO_REGISTER"] = 2021] = "PROPERTY_SHARE_INVITE_TO_REGISTER";
6141
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_INVITE_ACCEPTED"] = 2022] = "PROPERTY_SHARE_INVITE_ACCEPTED";
6142
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_INVITE_REJECTED"] = 2023] = "PROPERTY_SHARE_INVITE_REJECTED";
6143
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_INVITE_REGISTERED"] = 2024] = "PROPERTY_SHARE_INVITE_REGISTERED";
6144
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_CHANGE_REQUESTED"] = 2025] = "PROPERTY_SHARE_CHANGE_REQUESTED";
6145
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_CHANGE_ACCEPTED"] = 2026] = "PROPERTY_SHARE_CHANGE_ACCEPTED";
6146
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_CHANGE_REJECTED"] = 2027] = "PROPERTY_SHARE_CHANGE_REJECTED";
6147
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["OWNER_SUBSCRIBED"] = 2028] = "OWNER_SUBSCRIBED";
6148
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["OWNER_UNSUBSCRIBED"] = 2029] = "OWNER_UNSUBSCRIBED";
6149
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["BASIQ_NEW_ACCOUNTS"] = 2030] = "BASIQ_NEW_ACCOUNTS";
6150
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["BASIQ_FIRST_IMPORT_COMPLETE"] = 2031] = "BASIQ_FIRST_IMPORT_COMPLETE";
6151
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["BASIQ_AUTHORIZATION_FAIL"] = 2032] = "BASIQ_AUTHORIZATION_FAIL";
6152
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["TRANSACTION_ALLOCATE_REMINDER"] = 2033] = "TRANSACTION_ALLOCATE_REMINDER";
6153
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["REGISTRATION_INVITE"] = 2040] = "REGISTRATION_INVITE";
6154
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["REGISTRATION_INVITE_ACCEPTED"] = 2041] = "REGISTRATION_INVITE_ACCEPTED";
6155
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_EMAIL_CONFIRMED"] = 2050] = "CLIENT_EMAIL_CONFIRMED";
6156
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["TAX_REVIEW_REQUESTED"] = 2060] = "TAX_REVIEW_REQUESTED";
6157
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_INVITE_TO_REGISTER"] = 3000] = "FIRM_INVITE_TO_REGISTER";
6158
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_INVITE"] = 3001] = "FIRM_INVITE";
6159
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE_ACCEPTED"] = 3002] = "CLIENT_INVITE_ACCEPTED";
6160
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE_REJECTED"] = 3003] = "CLIENT_INVITE_REJECTED";
6161
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE_REGISTERED"] = 3004] = "CLIENT_INVITE_REGISTERED";
6162
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_NEW_CLIENT"] = 3005] = "FIRM_NEW_CLIENT";
6163
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_LOST_CLIENT"] = 3006] = "FIRM_LOST_CLIENT";
6164
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_INVITE"] = 3010] = "EMPLOYEE_INVITE";
6165
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_LOST_CLIENT"] = 3011] = "EMPLOYEE_LOST_CLIENT";
6166
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_NEW_CLIENT"] = 3012] = "EMPLOYEE_NEW_CLIENT";
6167
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_INVITE_ACCEPTED"] = 3013] = "EMPLOYEE_INVITE_ACCEPTED";
6168
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_EMAIL_CONFIRMED"] = 3020] = "EMPLOYEE_EMAIL_CONFIRMED";
6169
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["TAX_REVIEW_RECEIVED"] = 3030] = "TAX_REVIEW_RECEIVED";
6170
- })(UserEventTypeTypeEnum || (UserEventTypeTypeEnum = {}));
6513
+ var DocumentFolder$1 = /** @class */ (function (_super) {
6514
+ __extends(DocumentFolder, _super);
6515
+ function DocumentFolder() {
6516
+ return _super !== null && _super.apply(this, arguments) || this;
6517
+ }
6518
+ return DocumentFolder;
6519
+ }(AbstractModel));
6171
6520
 
6172
- /**
6173
- * any event happened in the app, which needs to be handled somehow (distributed to other part of the app)
6174
- */
6175
- var AppEvent = /** @class */ (function () {
6176
- function AppEvent(type, payload) {
6177
- this.type = type;
6178
- this.payload = payload;
6521
+ var DocumentFolder = /** @class */ (function (_super) {
6522
+ __extends(DocumentFolder, _super);
6523
+ function DocumentFolder() {
6524
+ return _super !== null && _super.apply(this, arguments) || this;
6179
6525
  }
6180
- return AppEvent;
6181
- }());
6526
+ return DocumentFolder;
6527
+ }(DocumentFolder$1));
6528
+ __decorate([
6529
+ classTransformer.Type(function () { return Document; })
6530
+ ], DocumentFolder.prototype, "documents", void 0);
6182
6531
 
6183
6532
  /**
6184
6533
  * BankConnection means user account at specific bank (usually each user has only one at the same bank)
@@ -6278,6 +6627,7 @@
6278
6627
  */
6279
6628
  BasiqService.prototype.listenEvents = function () {
6280
6629
  this.listenNotifications();
6630
+ this.listenJobs();
6281
6631
  };
6282
6632
  /**
6283
6633
  * Create a new Bank connection based on Basiq job.
@@ -6290,6 +6640,7 @@
6290
6640
  // Send login data to basiq API to create a basiq job
6291
6641
  return this.http.post(BasiqService.basiqApiUrl + "/users/" + userId + "/connections", loginData)
6292
6642
  .pipe(operators.mergeMap(function (response) {
6643
+ _this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.BASIQ_JOB_CREATED, response.id));
6293
6644
  // Create bank connection based on basiq job
6294
6645
  return _this.bankConnectionService.add(classTransformer.plainToClass(BankConnection, { basiqJob: { externalId: response.id } }));
6295
6646
  }), operators.catchError(function (error) {
@@ -6311,8 +6662,12 @@
6311
6662
  // Send login data and connection id to basiq API to create a basiq job
6312
6663
  return this.http.post(BasiqService.basiqApiUrl + "/users/" + userId + "/connections", Object.assign(data, { id: connection.externalId }))
6313
6664
  .pipe(operators.mergeMap(function (response) {
6665
+ _this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.BASIQ_JOB_CREATED, response.id));
6314
6666
  // Create bank connection based on basiq job
6315
- return _this.bankConnectionService.add(classTransformer.plainToClass(BankConnection, { id: connection.id, basiqJob: { externalId: response.id } }));
6667
+ return _this.bankConnectionService.add(classTransformer.plainToClass(BankConnection, {
6668
+ id: connection.id,
6669
+ basiqJob: { externalId: response.id }
6670
+ }));
6316
6671
  }), operators.catchError(function (error) {
6317
6672
  // Show error when user provided wrong login data
6318
6673
  if (error.status === 401) {
@@ -6335,6 +6690,35 @@
6335
6690
  return bankAccounts.removeBy('accountId', savedAccounts.mapBy('accountId'));
6336
6691
  }));
6337
6692
  };
6693
+ /**
6694
+ * Get status of credentials verifying. Expected statuses: 'in-progress', 'failed' or 'success'
6695
+ * We send this request by interval until basiq return success or failed
6696
+ * @TODO Alex (TT-2431): check logic and try to remove subscribe, use pipes instead
6697
+ * @TODO Alex (TT-2431): implement some limit and handle (message or something) if basiq stuck
6698
+ * @TODO Alex (TT-2431): check logic and handle case when user cancelled loading
6699
+ */
6700
+ BasiqService.prototype.checkBankCredentials = function (jobId) {
6701
+ var _this = this;
6702
+ this.http.get(BasiqService.basiqApiUrl + "/jobs/" + jobId)
6703
+ .pipe(
6704
+ // 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)
6705
+ operators.take(1),
6706
+ // get verify-credentials step from basiq job
6707
+ operators.map(function (response) { return classTransformer.plainToClass(BasiqJobResponse, response).getVerifyCredentialsStep(); }),
6708
+ // check credentials status again if not finished
6709
+ operators.filter(function (step) {
6710
+ if (!step.isInProgress()) {
6711
+ return true;
6712
+ }
6713
+ setTimeout(function () {
6714
+ _this.checkBankCredentials(jobId);
6715
+ }, BasiqService.bankCredintialsCheckInterval);
6716
+ return false;
6717
+ }))
6718
+ .subscribe(function (step) {
6719
+ _this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.BASIQ_LOGIN_FINISHED, step.isSuccess()));
6720
+ });
6721
+ };
6338
6722
  /**
6339
6723
  * listen to notifications to update basiq accounts list
6340
6724
  */
@@ -6346,9 +6730,22 @@
6346
6730
  }
6347
6731
  });
6348
6732
  };
6733
+ /**
6734
+ * Listen Basiq job created to check its verify credentials status
6735
+ */
6736
+ BasiqService.prototype.listenJobs = function () {
6737
+ var _this = this;
6738
+ this.eventDispatcherService.on(exports.AppEventTypeEnum.BASIQ_JOB_CREATED).subscribe(function (jobId) {
6739
+ _this.checkBankCredentials(jobId);
6740
+ });
6741
+ };
6349
6742
  return BasiqService;
6350
6743
  }(RestService));
6351
6744
  BasiqService.basiqApiUrl = 'https://au-api.basiq.io';
6745
+ /**
6746
+ * Basiq does not provide a hook, so we have to check job status manually every x seconds
6747
+ */
6748
+ BasiqService.bankCredintialsCheckInterval = 3000;
6352
6749
  BasiqService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: BasiqService, deps: [{ token: i1__namespace.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }, { token: ToastService }, { token: BankConnectionService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
6353
6750
  BasiqService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: BasiqService, providedIn: 'root' });
6354
6751
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: BasiqService, decorators: [{
@@ -6363,20 +6760,6 @@
6363
6760
  }] }, { type: ToastService }, { type: BankConnectionService }];
6364
6761
  } });
6365
6762
 
6366
- /**
6367
- * access token, needed to access basiq connect ui (https://github.com/basiqio/basiq-connect-ui)
6368
- */
6369
- var BasiqToken = /** @class */ (function () {
6370
- function BasiqToken(value, expiresAt) {
6371
- this.value = value;
6372
- this.expiresAt = expiresAt;
6373
- }
6374
- BasiqToken.prototype.isExpired = function () {
6375
- return this.expiresAt < new Date();
6376
- };
6377
- return BasiqToken;
6378
- }());
6379
-
6380
6763
  var BasiqTokenService = /** @class */ (function () {
6381
6764
  function BasiqTokenService(http, environment) {
6382
6765
  this.http = http;
@@ -6634,6 +7017,12 @@
6634
7017
  */
6635
7018
  UserService.prototype.createBasiq = function () {
6636
7019
  var _this = this;
7020
+ var _a;
7021
+ // no need to create basiqId if already exist
7022
+ // @TODO Alex (TT-2431): move this check to component or separated method
7023
+ if ((_a = this.cache) === null || _a === void 0 ? void 0 : _a.basiqId) {
7024
+ return rxjs.of(this.cache.basiqId);
7025
+ }
6637
7026
  return this.http.post(this.environment.apiV2 + "/basiq/user", {})
6638
7027
  .pipe(operators.map(function (basiqId) {
6639
7028
  _this.cache = classTransformer.plainToClass(User, Object.assign(_this.cache, { basiqId: basiqId }));
@@ -6794,86 +7183,27 @@
6794
7183
  useValue: environment
6795
7184
  }
6796
7185
  ]
6797
- };
6798
- };
6799
- return TtCoreModule;
6800
- }());
6801
- TtCoreModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TtCoreModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
6802
- TtCoreModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TtCoreModule, imports: [i1$1.CommonModule,
6803
- InterceptorsModule] });
6804
- TtCoreModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TtCoreModule, imports: [[
6805
- i1$1.CommonModule,
6806
- InterceptorsModule
6807
- ]] });
6808
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TtCoreModule, decorators: [{
6809
- type: i0.NgModule,
6810
- args: [{
6811
- declarations: [],
6812
- imports: [
6813
- i1$1.CommonModule,
6814
- InterceptorsModule
6815
- ]
6816
- }]
6817
- }] });
6818
-
6819
- var Document$1 = /** @class */ (function (_super) {
6820
- __extends(Document, _super);
6821
- function Document() {
6822
- return _super !== null && _super.apply(this, arguments) || this;
6823
- }
6824
- return Document;
6825
- }(AbstractModel));
6826
-
6827
- /**
6828
- * Enum with document types which used to API url prefix
6829
- */
6830
- exports.DocumentApiUrlPrefixEnum = void 0;
6831
- (function (DocumentApiUrlPrefixEnum) {
6832
- DocumentApiUrlPrefixEnum["FOLDERS"] = "folders";
6833
- DocumentApiUrlPrefixEnum["PROPERTIES"] = "properties";
6834
- })(exports.DocumentApiUrlPrefixEnum || (exports.DocumentApiUrlPrefixEnum = {}));
6835
-
6836
- var Document = /** @class */ (function (_super) {
6837
- __extends(Document, _super);
6838
- function Document() {
6839
- var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
6840
- _this.type = exports.AssetTypeEnum.DOCUMENTS;
6841
- _this.entityType = exports.AssetEntityTypeEnum.FOLDERS;
6842
- return _this;
6843
- }
6844
- /**
6845
- * Get folder as document parent entity
6846
- */
6847
- Document.prototype.getEntity = function () {
6848
- return this.folder;
6849
- };
6850
- /**
6851
- * Get API url prefix
6852
- */
6853
- Document.prototype.getApiUrlPrefix = function () {
6854
- return exports.DocumentApiUrlPrefixEnum.FOLDERS;
6855
- };
6856
- return Document;
6857
- }(Document$1));
6858
-
6859
- var DocumentFolder$1 = /** @class */ (function (_super) {
6860
- __extends(DocumentFolder, _super);
6861
- function DocumentFolder() {
6862
- return _super !== null && _super.apply(this, arguments) || this;
6863
- }
6864
- return DocumentFolder;
6865
- }(AbstractModel));
6866
-
6867
- var DocumentFolder = /** @class */ (function (_super) {
6868
- __extends(DocumentFolder, _super);
6869
- function DocumentFolder() {
6870
- return _super !== null && _super.apply(this, arguments) || this;
6871
- }
6872
- return DocumentFolder;
6873
- }(DocumentFolder$1));
6874
- __decorate([
6875
- classTransformer.Type(function () { return Document; })
6876
- ], DocumentFolder.prototype, "documents", void 0);
7186
+ };
7187
+ };
7188
+ return TtCoreModule;
7189
+ }());
7190
+ TtCoreModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TtCoreModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
7191
+ TtCoreModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TtCoreModule, imports: [i1$1.CommonModule,
7192
+ InterceptorsModule] });
7193
+ TtCoreModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TtCoreModule, imports: [[
7194
+ i1$1.CommonModule,
7195
+ InterceptorsModule
7196
+ ]] });
7197
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TtCoreModule, decorators: [{
7198
+ type: i0.NgModule,
7199
+ args: [{
7200
+ declarations: [],
7201
+ imports: [
7202
+ i1$1.CommonModule,
7203
+ InterceptorsModule
7204
+ ]
7205
+ }]
7206
+ }] });
6877
7207
 
6878
7208
  var VehicleClaimCollection = /** @class */ (function (_super) {
6879
7209
  __extends(VehicleClaimCollection, _super);
@@ -9403,244 +9733,14 @@
9403
9733
  var Badge = /** @class */ (function (_super) {
9404
9734
  __extends(Badge, _super);
9405
9735
  function Badge(text, color) {
9406
- var _this = _super.call(this) || this;
9407
- _this.text = '';
9408
- _this.text = text;
9409
- _this.color = color || exports.BadgeColorEnum.DEFAULT;
9410
- return _this;
9411
- }
9412
- return Badge;
9413
- }(AbstractModel));
9414
-
9415
- /**
9416
- * bank account collection UI class with frontend specific data
9417
- */
9418
- var BankAccountChartData = /** @class */ (function () {
9419
- function BankAccountChartData(bankAccounts) {
9420
- this.bankAccounts = bankAccounts;
9421
- }
9422
- /**
9423
- * set value of pie chart data
9424
- */
9425
- BankAccountChartData.prototype.getBalancePieChartData = function () {
9426
- return this.bankAccounts.map(function (bankAccount) {
9427
- return {
9428
- name: bankAccount.accountName,
9429
- data: Math.abs(bankAccount.currentBalance)
9430
- };
9431
- });
9432
- };
9433
- /**
9434
- * set value of bar chart data
9435
- */
9436
- BankAccountChartData.prototype.getBalanceBarChartData = function () {
9437
- return [{
9438
- name: 'Balance',
9439
- data: this.bankAccounts.map(function (bankAccount) {
9440
- return {
9441
- label: bankAccount.accountName,
9442
- value: bankAccount.currentBalance
9443
- };
9444
- })
9445
- }];
9446
- };
9447
- return BankAccountChartData;
9448
- }());
9449
-
9450
- /**
9451
- * Const which contains array of bank account types
9452
- */
9453
- var BANK_ACCOUNT_TYPES = [
9454
- { key: exports.BankAccountTypeEnum.CREDIT_CARD, value: 'Credit Card Accounts' },
9455
- { key: exports.BankAccountTypeEnum.TERM_DEPOSIT, value: 'Deposit Accounts' },
9456
- { key: exports.BankAccountTypeEnum.INVESTMENT, value: 'Investment Accounts' },
9457
- { key: exports.BankAccountTypeEnum.LOAN, value: 'Loan Accounts' },
9458
- { key: exports.BankAccountTypeEnum.OFFSET, value: 'Offset' },
9459
- { key: exports.BankAccountTypeEnum.SAVINGS, value: 'Savings Accounts' },
9460
- { key: exports.BankAccountTypeEnum.TRANSACTION, value: 'Transaction Accounts' },
9461
- ];
9462
-
9463
- /**
9464
- * Login data object for basiq banks
9465
- */
9466
- var BankLoginData = /** @class */ (function () {
9467
- function BankLoginData() {
9468
- }
9469
- return BankLoginData;
9470
- }());
9471
-
9472
- /**
9473
- * enum with months indexes.
9474
- * item value match with js Date month index from 0 to 11
9475
- * Order of items match with financial year months order
9476
- */
9477
- exports.MonthNumberEnum = void 0;
9478
- (function (MonthNumberEnum) {
9479
- MonthNumberEnum[MonthNumberEnum["JULY"] = 6] = "JULY";
9480
- MonthNumberEnum[MonthNumberEnum["AUGUST"] = 7] = "AUGUST";
9481
- MonthNumberEnum[MonthNumberEnum["SEPTEMBER"] = 8] = "SEPTEMBER";
9482
- MonthNumberEnum[MonthNumberEnum["OCTOBER"] = 9] = "OCTOBER";
9483
- MonthNumberEnum[MonthNumberEnum["NOVEMBER"] = 10] = "NOVEMBER";
9484
- MonthNumberEnum[MonthNumberEnum["DECEMBER"] = 11] = "DECEMBER";
9485
- MonthNumberEnum[MonthNumberEnum["JANUARY"] = 0] = "JANUARY";
9486
- MonthNumberEnum[MonthNumberEnum["FEBRUARY"] = 1] = "FEBRUARY";
9487
- MonthNumberEnum[MonthNumberEnum["MARCH"] = 2] = "MARCH";
9488
- MonthNumberEnum[MonthNumberEnum["APRIL"] = 3] = "APRIL";
9489
- MonthNumberEnum[MonthNumberEnum["MAY"] = 4] = "MAY";
9490
- MonthNumberEnum[MonthNumberEnum["JUNE"] = 5] = "JUNE";
9491
- })(exports.MonthNumberEnum || (exports.MonthNumberEnum = {}));
9492
-
9493
- /**
9494
- * @TODO move to pipe/translation
9495
- * enum with months short names.
9496
- * Order of items match with financial year months order
9497
- */
9498
- exports.MonthNameShortEnum = void 0;
9499
- (function (MonthNameShortEnum) {
9500
- MonthNameShortEnum["JULY"] = "Jul";
9501
- MonthNameShortEnum["AUGUST"] = "Aug";
9502
- MonthNameShortEnum["SEPTEMBER"] = "Sep";
9503
- MonthNameShortEnum["OCTOBER"] = "Oct";
9504
- MonthNameShortEnum["NOVEMBER"] = "Nov";
9505
- MonthNameShortEnum["DECEMBER"] = "Dec";
9506
- MonthNameShortEnum["JANUARY"] = "Jan";
9507
- MonthNameShortEnum["FEBRUARY"] = "Feb";
9508
- MonthNameShortEnum["MARCH"] = "Mar";
9509
- MonthNameShortEnum["APRIL"] = "Apr";
9510
- MonthNameShortEnum["MAY"] = "May";
9511
- MonthNameShortEnum["JUNE"] = "Jun";
9512
- })(exports.MonthNameShortEnum || (exports.MonthNameShortEnum = {}));
9513
-
9514
- /**
9515
- * bank transactions collection UI class with frontend specific data
9516
- */
9517
- var BankTransactionChartData = /** @class */ (function () {
9518
- function BankTransactionChartData(bankTransactions) {
9519
- this.bankTransactions = bankTransactions;
9520
- }
9521
- /**
9522
- * get value of bar chart data
9523
- */
9524
- BankTransactionChartData.prototype.getCashInOutBarChartData = function (months) {
9525
- var chartData = this.calculateCashInOutBarChartData();
9526
- if (!months) {
9527
- return chartData;
9528
- }
9529
- return this.filterChartDataByMonths(months, chartData);
9530
- };
9531
- /**
9532
- * get value of line chart data
9533
- */
9534
- BankTransactionChartData.prototype.getBalanceLineChartData = function (months) {
9535
- var chartData = this.calculateBalanceLineChartData();
9536
- if (!months) {
9537
- return chartData;
9538
- }
9539
- return this.filterChartDataByMonths(months, chartData);
9540
- };
9541
- /**
9542
- * set bar chart data
9543
- */
9544
- BankTransactionChartData.prototype.calculateCashInOutBarChartData = function () {
9545
- var chartData = [{
9546
- name: 'Cash In',
9547
- data: []
9548
- }, {
9549
- name: 'Cash Out',
9550
- data: []
9551
- }];
9552
- var _loop_1 = function (key) {
9553
- if (exports.MonthNameShortEnum.hasOwnProperty(key)) {
9554
- var bankTransactionsForMonth = this_1.bankTransactions.filter(function (bankTransaction) {
9555
- return +bankTransaction.date.getMonth() === +exports.MonthNumberEnum[key];
9556
- });
9557
- var cashInForMonth = bankTransactionsForMonth
9558
- .filter(function (bankTransaction) { return bankTransaction.isCredit(); })
9559
- .reduce(function (sum, bankTransaction) { return sum += bankTransaction.allocatedAmount; }, 0);
9560
- var cashOutForMonth = bankTransactionsForMonth
9561
- .filter(function (bankTransaction) { return bankTransaction.isDebit(); })
9562
- .reduce(function (sum, bankTransaction) { return sum += bankTransaction.allocatedAmount; }, 0);
9563
- chartData[0].data.push({
9564
- label: exports.MonthNameShortEnum[key],
9565
- value: cashInForMonth
9566
- });
9567
- chartData[1].data.push({
9568
- label: exports.MonthNameShortEnum[key],
9569
- value: cashOutForMonth
9570
- });
9571
- }
9572
- };
9573
- var this_1 = this;
9574
- for (var key in exports.MonthNameShortEnum) {
9575
- _loop_1(key);
9576
- }
9577
- return chartData;
9578
- };
9579
- /**
9580
- * set line chart data
9581
- */
9582
- BankTransactionChartData.prototype.calculateBalanceLineChartData = function () {
9583
- var chartData = [{
9584
- name: 'Balance',
9585
- data: []
9586
- }];
9587
- var _loop_2 = function (key) {
9588
- if (exports.MonthNameShortEnum.hasOwnProperty(key)) {
9589
- var bankTransactionsForMonth = this_2.bankTransactions.filter(function (bankTransaction) {
9590
- return +bankTransaction.date.getMonth() === +exports.MonthNumberEnum[key];
9591
- });
9592
- var balanceForMonth = bankTransactionsForMonth.reduce(function (sum, bankTransaction) {
9593
- if (bankTransaction.isCredit()) {
9594
- return sum += bankTransaction.allocatedAmount;
9595
- }
9596
- else {
9597
- return sum -= bankTransaction.allocatedAmount;
9598
- }
9599
- }, 0);
9600
- chartData[0].data.push({
9601
- label: exports.MonthNameShortEnum[key],
9602
- value: balanceForMonth
9603
- });
9604
- }
9605
- };
9606
- var this_2 = this;
9607
- for (var key in exports.MonthNameShortEnum) {
9608
- _loop_2(key);
9609
- }
9610
- return chartData;
9611
- };
9612
- /**
9613
- * filter chart data for passed months
9614
- */
9615
- BankTransactionChartData.prototype.filterChartDataByMonths = function (months, chartData) {
9616
- var monthsNames = months.map(function (month) { return exports.MonthNumberEnum[month]; }).map(function (key) { return exports.MonthNameShortEnum[key]; });
9617
- var filteredChartData = cloneDeep__default["default"](chartData);
9618
- filteredChartData.forEach(function (chartDataItem) {
9619
- chartDataItem.data = chartDataItem.data.filter(function (serie) { return monthsNames.includes(serie.label); });
9620
- });
9621
- return filteredChartData;
9622
- };
9623
- return BankTransactionChartData;
9624
- }());
9625
-
9626
- exports.BankTransactionSummaryFieldsEnum = void 0;
9627
- (function (BankTransactionSummaryFieldsEnum) {
9628
- BankTransactionSummaryFieldsEnum["AMOUNT"] = "amount";
9629
- BankTransactionSummaryFieldsEnum["ALLOCATED_AMOUNT"] = "allocatedAmount";
9630
- })(exports.BankTransactionSummaryFieldsEnum || (exports.BankTransactionSummaryFieldsEnum = {}));
9631
-
9632
- /**
9633
- * Class describe configuration options for basiq connect control
9634
- * https://www.npmjs.com/package/@basiq/basiq-connect-control
9635
- */
9636
- var BasiqConfig = /** @class */ (function () {
9637
- function BasiqConfig(options) {
9638
- // ID of the DOM element to which Basiq Connect Control will be rendered;
9639
- this.containerId = 'basiq-control';
9640
- Object.assign(this, options);
9736
+ var _this = _super.call(this) || this;
9737
+ _this.text = '';
9738
+ _this.text = text;
9739
+ _this.color = color || exports.BadgeColorEnum.DEFAULT;
9740
+ return _this;
9641
9741
  }
9642
- return BasiqConfig;
9643
- }());
9742
+ return Badge;
9743
+ }(AbstractModel));
9644
9744
 
9645
9745
  var BorrowingExpense$1 = /** @class */ (function (_super) {
9646
9746
  __extends(BorrowingExpense, _super);
@@ -17451,93 +17551,6 @@
17451
17551
  return AbstractForm;
17452
17552
  }(forms.FormGroup));
17453
17553
 
17454
- /**
17455
- * Form with loan details.
17456
- * Loan could be created from bank account (Bank Loan) or directly from loan page (Vehicle Loan)
17457
- */
17458
- var LoanForm = /** @class */ (function (_super) {
17459
- __extends(LoanForm, _super);
17460
- function LoanForm(loan) {
17461
- if (loan === void 0) { loan = classTransformer.plainToClass(Loan, {}); }
17462
- var _this = _super.call(this, {
17463
- type: new forms.FormControl(loan.type, forms.Validators.required),
17464
- amount: new forms.FormControl(loan.amount, forms.Validators.required),
17465
- interestRate: new forms.FormControl(loan.interestRate, [forms.Validators.required, forms.Validators.min(0), forms.Validators.max(100)]),
17466
- commencementDate: new forms.FormControl(loan.commencementDate, forms.Validators.required),
17467
- repaymentAmount: new forms.FormControl(loan.repaymentAmount, forms.Validators.required),
17468
- repaymentFrequency: new forms.FormControl(loan.repaymentFrequency, forms.Validators.required),
17469
- term: new forms.FormControl(loan.term, forms.Validators.required),
17470
- // interestType is predefined for vehicle loans
17471
- interestType: new forms.FormControl({ value: loan.interestType, disabled: !loan.bankAccount }, forms.Validators.required),
17472
- // availableRedraw is predefined for vehicle loans
17473
- availableRedraw: new forms.FormControl({ value: loan.availableRedraw, disabled: !loan.bankAccount }, forms.Validators.required),
17474
- // repaymentType is predefined for vehicle loans
17475
- repaymentType: new forms.FormControl({ value: loan.repaymentType, disabled: !loan.bankAccount }, forms.Validators.required),
17476
- }, loan) || this;
17477
- _this.loan = loan;
17478
- // Set data which always the same for vehicle loans
17479
- if (!loan.bankAccount) {
17480
- Object.assign(_this.model, {
17481
- repaymentType: exports.LoanRepaymentTypeEnum.PRINCIPAL_AND_INTEREST,
17482
- availableRedraw: 0,
17483
- interestType: exports.LoanInterestTypeEnum.FIXED_RATE
17484
- });
17485
- }
17486
- _this.updateTermValidation();
17487
- _this.listenEvents();
17488
- return _this;
17489
- }
17490
- LoanForm.prototype.listenEvents = function () {
17491
- // We need to set term automatically only for bank loans.
17492
- // For vehicle loans user should fill it manually with validation depended of frequency
17493
- if (!!this.loan.bankAccount) {
17494
- this.listenTypeChanges();
17495
- }
17496
- else {
17497
- this.listenRepaymentFrequencyChanges();
17498
- }
17499
- };
17500
- /**
17501
- * Set term automatically by loan type changes
17502
- */
17503
- LoanForm.prototype.listenTypeChanges = function () {
17504
- var _this = this;
17505
- this.get('type').valueChanges.subscribe(function (type) {
17506
- _this.get('term').setValue(LoanForm.mortgageLoanTypes.includes(type) ? Loan.mortgageDefaultTerm : Loan.loanDefaultTerm);
17507
- });
17508
- };
17509
- /**
17510
- * term validation depends on selected repaymentFrequency
17511
- */
17512
- LoanForm.prototype.listenRepaymentFrequencyChanges = function () {
17513
- var _this = this;
17514
- this.get('repaymentFrequency').valueChanges.subscribe(function () {
17515
- _this.updateTermValidation();
17516
- });
17517
- };
17518
- /**
17519
- * For vehicle loans term has a maximum value depended of repayment frequency
17520
- */
17521
- LoanForm.prototype.updateTermValidation = function () {
17522
- // no need terms for bank loans
17523
- if (!!this.loan.bankAccount) {
17524
- return;
17525
- }
17526
- var currentRepaymentFrequency = this.get('repaymentFrequency').value;
17527
- // term validation depends on selected repayment frequency, so can not validate when frequency is empty
17528
- // repaymentType is required field, so we don't need to clear validation
17529
- if (!currentRepaymentFrequency) {
17530
- return;
17531
- }
17532
- var termControl = this.get('term');
17533
- var maxTermValue = exports.LoanMaxNumberOfPaymentsEnum[exports.LoanRepaymentFrequencyEnum[currentRepaymentFrequency]];
17534
- termControl.setValidators([forms.Validators.max(maxTermValue)]);
17535
- termControl.updateValueAndValidity();
17536
- };
17537
- return LoanForm;
17538
- }(AbstractForm));
17539
- LoanForm.mortgageLoanTypes = [exports.LoanTypeEnum.MORTGAGE, exports.LoanTypeEnum.HOME_EQUITY_LINE_OF_CREDIT, exports.LoanTypeEnum.HOME_LOAN];
17540
-
17541
17554
  /**
17542
17555
  * Check if at least one form field is true, otherwise form is invalid.
17543
17556
  * Use with groups of boolean form controls (checkbox, toggle, etc.)
@@ -17671,6 +17684,259 @@
17671
17684
  };
17672
17685
  }
17673
17686
 
17687
+ /**
17688
+ * Validator for address, check if corelogic suggestion selected correctly
17689
+ */
17690
+ function addressCorelogicValidator() {
17691
+ return function (form) {
17692
+ if (form.isCorelogicRequired) {
17693
+ if (form.get('corelogicLocId').hasError('required')) {
17694
+ return { address: 'Street, city, state or postal code not specified' };
17695
+ }
17696
+ if (form.get('corelogicRefId').hasError('required')) {
17697
+ return { address: 'Unit/House number not specified' };
17698
+ }
17699
+ }
17700
+ return null;
17701
+ };
17702
+ }
17703
+
17704
+ /**
17705
+ * Address form. Works with corelogic or manual address
17706
+ */
17707
+ var AddressForm = /** @class */ (function (_super) {
17708
+ __extends(AddressForm, _super);
17709
+ /**
17710
+ * @param address instance which should be created/edited
17711
+ * @param isCorelogicRequired for example, for property we need corelogic location even for manual address,
17712
+ * so we have to search corelogic location based on manual fields values
17713
+ */
17714
+ function AddressForm(address, isCorelogicRequired) {
17715
+ if (address === void 0) { address = classTransformer.plainToClass(Address, {}); }
17716
+ if (isCorelogicRequired === void 0) { isCorelogicRequired = false; }
17717
+ var _this = _super.call(this, {
17718
+ // prefill search input with address string for edit case
17719
+ searchQuery: new forms.FormControl(address.address ? address.nameLong : null, forms.Validators.required),
17720
+ type: new forms.FormControl(address.type | exports.AddressTypeEnum.STREET, forms.Validators.required),
17721
+ // Corelogic fields
17722
+ corelogicLocId: new forms.FormControl(address.corelogicLocId, conditionalValidator(function () { return isCorelogicRequired; }, forms.Validators.required)),
17723
+ corelogicRefId: new forms.FormControl(address.corelogicRefId, conditionalValidator(function () { return isCorelogicRequired; }, forms.Validators.required)),
17724
+ // manual fields
17725
+ unitNumber: new forms.FormControl({ value: address.unitNumber, disabled: true }),
17726
+ address: new forms.FormControl({ value: address.address, disabled: true }, forms.Validators.required),
17727
+ city: new forms.FormControl({ value: address.city, disabled: true }, forms.Validators.required),
17728
+ state: new forms.FormControl({ value: address.state, disabled: true }, forms.Validators.required),
17729
+ postcode: new forms.FormControl({ value: address.postcode, disabled: true }, forms.Validators.required),
17730
+ country: new forms.FormControl({ value: address.country || Country.australia, disabled: true }, conditionalValidator(function () { return !isCorelogicRequired; }, forms.Validators.required))
17731
+ }, address, addressCorelogicValidator()) || this;
17732
+ _this.isCorelogicRequired = isCorelogicRequired;
17733
+ /**
17734
+ * Emit event to search address in corelogic when user filled enough data for corelogic
17735
+ */
17736
+ _this.onSearch = new i0.EventEmitter();
17737
+ _this.listenEvents();
17738
+ return _this;
17739
+ }
17740
+ Object.defineProperty(AddressForm.prototype, "manualSearchQuery", {
17741
+ /**
17742
+ * Get search query for corelogic location search based on manual fields values
17743
+ */
17744
+ get: function () {
17745
+ if (!this.isManualSearchAvailable()) {
17746
+ return '';
17747
+ }
17748
+ return this.currentValue.nameLong;
17749
+ },
17750
+ enumerable: false,
17751
+ configurable: true
17752
+ });
17753
+ AddressForm.prototype.listenEvents = function () {
17754
+ this.listenSearchQueryChanges();
17755
+ // no need to search corelogic locality when corelogic is not required
17756
+ if (this.isCorelogicRequired) {
17757
+ this.listenManualFieldsChanges();
17758
+ }
17759
+ };
17760
+ /**
17761
+ * Handle corelogic suggestion select
17762
+ */
17763
+ AddressForm.prototype.onSelectSuggestion = function (suggestion) {
17764
+ // if no suggestion then 'Add manually' option selected
17765
+ if (!suggestion) {
17766
+ this.switchToManual();
17767
+ return;
17768
+ }
17769
+ this.patchValue({
17770
+ corelogicLocId: suggestion.localityId,
17771
+ corelogicRefId: suggestion.propertyId
17772
+ });
17773
+ };
17774
+ /**
17775
+ * Enable manual mode
17776
+ */
17777
+ AddressForm.prototype.switchToManual = function () {
17778
+ this.isManual = true;
17779
+ this.get('searchQuery').disable();
17780
+ this.get('address').enable();
17781
+ this.get('unitNumber').enable();
17782
+ this.get('city').enable();
17783
+ this.get('state').enable();
17784
+ this.get('postcode').enable();
17785
+ if (!this.isCorelogicRequired) {
17786
+ this.get('country').enable();
17787
+ this.get('corelogicLocId').disable();
17788
+ this.get('corelogicRefId').disable();
17789
+ }
17790
+ };
17791
+ /**
17792
+ * Emit event to search address in corelogic when search field changes
17793
+ */
17794
+ AddressForm.prototype.listenSearchQueryChanges = function () {
17795
+ var _this = this;
17796
+ this.get('searchQuery').valueChanges
17797
+ .pipe(
17798
+ // delay to avoid search request for each value change
17799
+ operators.debounceTime(AddressForm.searchDelay),
17800
+ // skip when value not changed
17801
+ operators.distinctUntilChanged(),
17802
+ // value could be a string when user search and suggestion when user select option from autocomplete
17803
+ operators.map(function (value) {
17804
+ // no need to search when value is not actually search string
17805
+ if (!value || value instanceof CorelogicSuggestion) {
17806
+ return '';
17807
+ }
17808
+ // trim to avoid spaces in searchQuery, we should not send request started or finished with spaces
17809
+ // uppercase to make search string similar to corelogic format
17810
+ return value.trim();
17811
+ }),
17812
+ // do nothing when query is too short
17813
+ operators.filter(function (searchQuery) { return searchQuery.length >= AddressForm.minSearchLength; }))
17814
+ .subscribe(function (searchQuery) {
17815
+ _this.onSearch.emit(searchQuery);
17816
+ });
17817
+ };
17818
+ /**
17819
+ * Check if all fields required for manual corelogic search are filled before request sending
17820
+ */
17821
+ AddressForm.prototype.isManualSearchAvailable = function () {
17822
+ return this.get('address').valid && this.get('city').valid && this.get('state').valid && this.get('postcode').valid;
17823
+ };
17824
+ /**
17825
+ * When corelogic is required we have to search address even for manual address
17826
+ */
17827
+ AddressForm.prototype.listenManualFieldsChanges = function () {
17828
+ var _this = this;
17829
+ // subscribe to whole form because no other fields may be changed in this case except manual address fields we need
17830
+ this.valueChanges
17831
+ .pipe(
17832
+ // delay to avoid search request for each value change
17833
+ operators.debounceTime(AddressForm.searchDelay),
17834
+ // do nothing when not all required fields filled
17835
+ operators.filter(function () { return _this.isManualSearchAvailable(); }), operators.map(function () { return _this.manualSearchQuery; }),
17836
+ // skip when value not changed
17837
+ operators.distinctUntilChanged())
17838
+ .subscribe(function () {
17839
+ _this.onSearch.emit(_this.manualSearchQuery);
17840
+ });
17841
+ };
17842
+ return AddressForm;
17843
+ }(AbstractForm));
17844
+ /**
17845
+ * Min search query required length
17846
+ */
17847
+ AddressForm.minSearchLength = 3;
17848
+ /**
17849
+ * Delay before corelogic request
17850
+ */
17851
+ AddressForm.searchDelay = 500;
17852
+
17853
+ /**
17854
+ * Form with loan details.
17855
+ * Loan could be created from bank account (Bank Loan) or directly from loan page (Vehicle Loan)
17856
+ */
17857
+ var LoanForm = /** @class */ (function (_super) {
17858
+ __extends(LoanForm, _super);
17859
+ function LoanForm(loan) {
17860
+ if (loan === void 0) { loan = classTransformer.plainToClass(Loan, {}); }
17861
+ var _this = _super.call(this, {
17862
+ type: new forms.FormControl(loan.type, forms.Validators.required),
17863
+ amount: new forms.FormControl(loan.amount, forms.Validators.required),
17864
+ interestRate: new forms.FormControl(loan.interestRate, [forms.Validators.required, forms.Validators.min(0), forms.Validators.max(100)]),
17865
+ commencementDate: new forms.FormControl(loan.commencementDate, forms.Validators.required),
17866
+ repaymentAmount: new forms.FormControl(loan.repaymentAmount, forms.Validators.required),
17867
+ repaymentFrequency: new forms.FormControl(loan.repaymentFrequency, forms.Validators.required),
17868
+ term: new forms.FormControl(loan.term, forms.Validators.required),
17869
+ // interestType is predefined for vehicle loans
17870
+ interestType: new forms.FormControl({ value: loan.interestType, disabled: !loan.bankAccount }, forms.Validators.required),
17871
+ // availableRedraw is predefined for vehicle loans
17872
+ availableRedraw: new forms.FormControl({ value: loan.availableRedraw, disabled: !loan.bankAccount }, forms.Validators.required),
17873
+ // repaymentType is predefined for vehicle loans
17874
+ repaymentType: new forms.FormControl({ value: loan.repaymentType, disabled: !loan.bankAccount }, forms.Validators.required),
17875
+ }, loan) || this;
17876
+ _this.loan = loan;
17877
+ // Set data which always the same for vehicle loans
17878
+ if (!loan.bankAccount) {
17879
+ Object.assign(_this.model, {
17880
+ repaymentType: exports.LoanRepaymentTypeEnum.PRINCIPAL_AND_INTEREST,
17881
+ availableRedraw: 0,
17882
+ interestType: exports.LoanInterestTypeEnum.FIXED_RATE
17883
+ });
17884
+ }
17885
+ _this.updateTermValidation();
17886
+ _this.listenEvents();
17887
+ return _this;
17888
+ }
17889
+ LoanForm.prototype.listenEvents = function () {
17890
+ // We need to set term automatically only for bank loans.
17891
+ // For vehicle loans user should fill it manually with validation depended of frequency
17892
+ if (!!this.loan.bankAccount) {
17893
+ this.listenTypeChanges();
17894
+ }
17895
+ else {
17896
+ this.listenRepaymentFrequencyChanges();
17897
+ }
17898
+ };
17899
+ /**
17900
+ * Set term automatically by loan type changes
17901
+ */
17902
+ LoanForm.prototype.listenTypeChanges = function () {
17903
+ var _this = this;
17904
+ this.get('type').valueChanges.subscribe(function (type) {
17905
+ _this.get('term').setValue(LoanForm.mortgageLoanTypes.includes(type) ? Loan.mortgageDefaultTerm : Loan.loanDefaultTerm);
17906
+ });
17907
+ };
17908
+ /**
17909
+ * term validation depends on selected repaymentFrequency
17910
+ */
17911
+ LoanForm.prototype.listenRepaymentFrequencyChanges = function () {
17912
+ var _this = this;
17913
+ this.get('repaymentFrequency').valueChanges.subscribe(function () {
17914
+ _this.updateTermValidation();
17915
+ });
17916
+ };
17917
+ /**
17918
+ * For vehicle loans term has a maximum value depended of repayment frequency
17919
+ */
17920
+ LoanForm.prototype.updateTermValidation = function () {
17921
+ // no need terms for bank loans
17922
+ if (!!this.loan.bankAccount) {
17923
+ return;
17924
+ }
17925
+ var currentRepaymentFrequency = this.get('repaymentFrequency').value;
17926
+ // term validation depends on selected repayment frequency, so can not validate when frequency is empty
17927
+ // repaymentType is required field, so we don't need to clear validation
17928
+ if (!currentRepaymentFrequency) {
17929
+ return;
17930
+ }
17931
+ var termControl = this.get('term');
17932
+ var maxTermValue = exports.LoanMaxNumberOfPaymentsEnum[exports.LoanRepaymentFrequencyEnum[currentRepaymentFrequency]];
17933
+ termControl.setValidators([forms.Validators.max(maxTermValue)]);
17934
+ termControl.updateValueAndValidity();
17935
+ };
17936
+ return LoanForm;
17937
+ }(AbstractForm));
17938
+ LoanForm.mortgageLoanTypes = [exports.LoanTypeEnum.MORTGAGE, exports.LoanTypeEnum.HOME_EQUITY_LINE_OF_CREDIT, exports.LoanTypeEnum.HOME_LOAN];
17939
+
17674
17940
  /**
17675
17941
  * Form array with bank account properties
17676
17942
  * @TODO create AbstractFormArray
@@ -17899,6 +18165,30 @@
17899
18165
  return SoleBusinessLossForm;
17900
18166
  }(AbstractForm));
17901
18167
 
18168
+ var phonePattern = /^(((\s*)?([- ()]?\d[- ()]?){0,30}(\s*)?)|)$/;
18169
+ /**
18170
+ * Validator for phone number
18171
+ * Allowed special symbols"-", "(", ")"
18172
+ */
18173
+ function phoneNumberValidator() {
18174
+ return function (control) {
18175
+ return phonePattern.test(control.value) ? null : { phoneInvalid: true };
18176
+ };
18177
+ }
18178
+
18179
+ var PhoneForm = /** @class */ (function (_super) {
18180
+ __extends(PhoneForm, _super);
18181
+ function PhoneForm(phone) {
18182
+ if (phone === void 0) { phone = classTransformer.plainToClass(Phone, {}); }
18183
+ return _super.call(this, {
18184
+ type: new forms.FormControl(phone.type, forms.Validators.required),
18185
+ country: new forms.FormControl(phone.country, forms.Validators.required),
18186
+ number: new forms.FormControl(phone.number, [forms.Validators.required, phoneNumberValidator()])
18187
+ }, phone) || this;
18188
+ }
18189
+ return PhoneForm;
18190
+ }(AbstractForm));
18191
+
17902
18192
  var SoleContactForm = /** @class */ (function (_super) {
17903
18193
  __extends(SoleContactForm, _super);
17904
18194
  function SoleContactForm(contact) {
@@ -17909,10 +18199,8 @@
17909
18199
  firstName: new forms.FormControl(contact.firstName, forms.Validators.required),
17910
18200
  lastName: new forms.FormControl(contact.lastName, forms.Validators.required),
17911
18201
  email: new forms.FormControl(contact.email, [forms.Validators.required, forms.Validators.email]),
17912
- // @TODO Alex: create phone form and phone form control
17913
- phone: new forms.FormControl(contact.phone),
17914
- // @TODO Alex: create address form and address form control
17915
- address: new forms.FormControl(contact.address)
18202
+ phone: new PhoneForm(contact.phone || classTransformer.plainToClass(Phone, {})),
18203
+ address: new AddressForm(contact.address || classTransformer.plainToClass(Address, {}))
17916
18204
  }, contact) || this;
17917
18205
  }
17918
18206
  return SoleContactForm;
@@ -19178,6 +19466,7 @@
19178
19466
  exports.AccountSetupItemCollection = AccountSetupItemCollection;
19179
19467
  exports.AccountSetupService = AccountSetupService;
19180
19468
  exports.Address = Address;
19469
+ exports.AddressForm = AddressForm;
19181
19470
  exports.AddressService = AddressService;
19182
19471
  exports.AppEvent = AppEvent;
19183
19472
  exports.AssetsService = AssetsService;
@@ -19198,6 +19487,7 @@
19198
19487
  exports.BankAccountsImportForm = BankAccountsImportForm;
19199
19488
  exports.BankConnection = BankConnection;
19200
19489
  exports.BankConnectionService = BankConnectionService;
19490
+ exports.BankExternalStats = BankExternalStats;
19201
19491
  exports.BankLoginData = BankLoginData;
19202
19492
  exports.BankLoginForm = BankLoginForm;
19203
19493
  exports.BankService = BankService;
@@ -19208,8 +19498,11 @@
19208
19498
  exports.BankTransactionService = BankTransactionService;
19209
19499
  exports.BasiqConfig = BasiqConfig;
19210
19500
  exports.BasiqJob = BasiqJob;
19501
+ exports.BasiqJobResponse = BasiqJobResponse;
19502
+ exports.BasiqJobStep = BasiqJobStep;
19211
19503
  exports.BasiqService = BasiqService;
19212
19504
  exports.BasiqToken = BasiqToken;
19505
+ exports.BasiqTokenService = BasiqTokenService;
19213
19506
  exports.BorrowingExpense = BorrowingExpense;
19214
19507
  exports.BorrowingExpenseLoan = BorrowingExpenseLoan;
19215
19508
  exports.BorrowingExpenseService = BorrowingExpenseService;
@@ -19359,6 +19652,7 @@
19359
19652
  exports.PdfFromHtmlTableService = PdfFromHtmlTableService;
19360
19653
  exports.PdfSettings = PdfSettings;
19361
19654
  exports.Phone = Phone;
19655
+ exports.PhoneForm = PhoneForm;
19362
19656
  exports.PreloaderService = PreloaderService;
19363
19657
  exports.Property = Property;
19364
19658
  exports.PropertyCalculationService = PropertyCalculationService;